diff --git a/litellm/proxy/_experimental/out/_next/static/62Q_aEBtV1y_OBZw06lMc/_buildManifest.js b/litellm/proxy/_experimental/out/_next/static/2LXGDkOr2SB7CgAEV-8bu/_buildManifest.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/62Q_aEBtV1y_OBZw06lMc/_buildManifest.js rename to litellm/proxy/_experimental/out/_next/static/2LXGDkOr2SB7CgAEV-8bu/_buildManifest.js diff --git a/litellm/proxy/_experimental/out/_next/static/62Q_aEBtV1y_OBZw06lMc/_ssgManifest.js b/litellm/proxy/_experimental/out/_next/static/2LXGDkOr2SB7CgAEV-8bu/_ssgManifest.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/62Q_aEBtV1y_OBZw06lMc/_ssgManifest.js rename to litellm/proxy/_experimental/out/_next/static/2LXGDkOr2SB7CgAEV-8bu/_ssgManifest.js diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1200-41ec436fdb8d0e64.js b/litellm/proxy/_experimental/out/_next/static/chunks/1200-41ec436fdb8d0e64.js new file mode 100644 index 0000000000..4adae0f290 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1200-41ec436fdb8d0e64.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1200],{90246:function(e,l,t){t.d(l,{n:function(){return s}});function s(e){let l=[e];return{all:l,lists:()=>[...l,"list"],list:e=>[...l,"list",{params:e}],details:()=>[...l,"detail"],detail:e=>[...l,"detail",e]}}},31200:function(e,l,t){t.d(l,{Z:function(){return lK}});var s=t(57437),a=t(29827),r=t(49804),i=t(67101),n=t(84264),o=t(2265),d=t(9114),c=t(19250),m=t(42673);let u=async(e,l,t)=>{try{var s,a;console.log("handling submit for formValues:",e);let l=e.model_mappings||[];if("model_mappings"in e&&delete e.model_mappings,e.model&&e.model.includes("all-wildcard")){let t=e.custom_llm_provider,a=(null!==(s=m.fK[t])&&void 0!==s?s:t.toLowerCase())+"/*";e.model_name=a,l.push({public_name:a,litellm_model:a}),e.model=a}let t=[];for(let s of l){let l={},r={},i=s.public_name;for(let[t,i]of(l.model=s.litellm_model,e.input_cost_per_token&&(e.input_cost_per_token=Number(e.input_cost_per_token)/1e6),e.output_cost_per_token&&(e.output_cost_per_token=Number(e.output_cost_per_token)/1e6),l.model=s.litellm_model,console.log("formValues add deployment:",e),Object.entries(e)))if(""!==i&&"custom_pricing"!==t&&"pricing_model"!==t&&"cache_control"!==t){if("model_name"==t)l.model=i;else if("custom_llm_provider"==t){console.log("custom_llm_provider:",i);let e=null!==(a=m.fK[i])&&void 0!==a?a:i.toLowerCase();l.custom_llm_provider=e,console.log("custom_llm_provider mappingResult:",e)}else if("model"==t)continue;else if("base_model"===t)r[t]=i;else if("team_id"===t)r.team_id=i;else if("model_access_group"===t)r.access_groups=i;else if("mode"==t)console.log("placing mode in modelInfo"),r.mode=i,delete l.mode;else if("custom_model_name"===t)l.model=i;else if("litellm_extra_params"==t){console.log("litellm_extra_params:",i);let e={};if(i&&void 0!=i){try{e=JSON.parse(i)}catch(e){throw d.Z.fromBackend("Failed to parse LiteLLM Extra Params: "+e),Error("Failed to parse litellm_extra_params: "+e)}for(let[t,s]of Object.entries(e))l[t]=s}}else if("model_info_params"==t){console.log("model_info_params:",i);let e={};if(i&&void 0!=i){try{e=JSON.parse(i)}catch(e){throw d.Z.fromBackend("Failed to parse LiteLLM Extra Params: "+e),Error("Failed to parse litellm_extra_params: "+e)}for(let[l,t]of Object.entries(e))r[l]=t}}else if("input_cost_per_token"===t||"output_cost_per_token"===t||"input_cost_per_second"===t){i&&(l[t]=Number(i));continue}else l[t]=i}t.push({litellmParamsObj:l,modelInfoObj:r,modelName:i})}return t}catch(e){d.Z.fromBackend("Failed to create model: "+e)}},h=async(e,l,t,s)=>{try{let a=await u(e,l,t);if(!a||0===a.length)return;for(let e of a){let{litellmParamsObj:t,modelInfoObj:s,modelName:a}=e,r={model_name:a,litellm_params:t,model_info:s},i=await (0,c.modelCreateCall)(l,r);console.log("response for model create call: ".concat(i.data))}s&&s(),t.resetFields()}catch(e){d.Z.fromBackend("Failed to add model: "+e)}};var x=t(11713),p=t(90246);let g=(0,p.n)("credentials"),f=e=>(0,x.a)({queryKey:g.list({}),queryFn:async()=>await (0,c.credentialListCall)(e),enabled:!!e}),j=(0,p.n)("models");(0,p.n)("modelHub");let v=(e,l,t)=>(0,x.a)({queryKey:j.list({filters:{...l&&{userID:l},...t&&{userRole:t}}}),queryFn:async()=>await (0,c.modelInfoCall)(e,l,t),enabled:!!(e&&l&&t)});var _=t(53410),y=t(74998),b=t(62490),N=t(10032),Z=t(21609),w=t(31283),C=t(57840),S=t(22116),k=t(37592),A=t(99981),E=t(5545);let M=(0,p.n)("providerFields"),I=()=>(0,x.a)({queryKey:M.list({}),queryFn:async()=>await (0,c.getProviderCreateMetadata)(),staleTime:864e5,gcTime:864e5});var F=t(3632),P=t(56522),L=t(47451),T=t(69410),R=t(65319),O=t(4260);let{Link:V}=C.default,D=e=>{var l,t,s,a,r;let i="password"===e.field_type?"password":"select"===e.field_type?"select":"upload"===e.field_type?"upload":"textarea"===e.field_type?"textarea":"text";return{key:e.key,label:e.label,placeholder:null!==(l=e.placeholder)&&void 0!==l?l:void 0,tooltip:null!==(t=e.tooltip)&&void 0!==t?t:void 0,required:null!==(s=e.required)&&void 0!==s&&s,type:i,options:null!==(a=e.options)&&void 0!==a?a:void 0,defaultValue:null!==(r=e.default_value)&&void 0!==r?r:void 0}},z={};var q=e=>{let{selectedProvider:l,uploadProps:t}=e,a=m.Cl[l],r=N.Z.useFormInstance(),{data:i,isLoading:n,error:d}=I(),c=o.useMemo(()=>{if(!i)return null;let e={};return i.forEach(l=>{let t=l.provider_display_name,s=l.credential_fields.map(D);e[t]=s,l.provider&&(e[l.provider]=s),l.litellm_provider&&(e[l.litellm_provider]=s)}),e},[i]);o.useEffect(()=>{c&&Object.assign(z,c)},[c]);let u=o.useMemo(()=>{var e;let t=null!==(e=z[a])&&void 0!==e?e:z[l];if(t)return t;if(!i)return[];let s=i.find(e=>e.provider_display_name===a||e.provider===l||e.litellm_provider===l);if(!s)return[];let r=s.credential_fields.map(D);return z[s.provider_display_name]=r,s.provider&&(z[s.provider]=r),s.litellm_provider&&(z[s.litellm_provider]=r),r},[a,l,i]),h={name:"file",accept:".json",beforeUpload:e=>{if("application/json"===e.type){let l=new FileReader;l.onload=e=>{if(e.target){let l=e.target.result;console.log("Setting field value from JSON, length: ".concat(l.length)),r.setFieldsValue({vertex_credentials:l}),console.log("Form values after setting:",r.getFieldsValue())}},l.readAsText(e)}return!1},onChange(e){console.log("Upload onChange triggered in ProviderSpecificFields"),console.log("Current form values:",r.getFieldsValue()),"uploading"!==e.file.status&&console.log(e.file,e.fileList)}};return(0,s.jsxs)(s.Fragment,{children:[n&&0===u.length&&(0,s.jsx)(L.Z,{children:(0,s.jsx)(T.Z,{span:24,children:(0,s.jsx)(P.x,{className:"mb-2",children:"Loading provider fields..."})})}),d&&0===u.length&&(0,s.jsx)(L.Z,{children:(0,s.jsx)(T.Z,{span:24,children:(0,s.jsx)(P.x,{className:"mb-2 text-red-500",children:d instanceof Error?d.message:"Failed to load provider credential fields"})})}),u.map(e=>{var l;return(0,s.jsxs)(o.Fragment,{children:[(0,s.jsx)(N.Z.Item,{label:e.label,name:e.key,rules:e.required?[{required:!0,message:"Required"}]:void 0,tooltip:e.tooltip,className:"vertex_credentials"===e.key?"mb-0":void 0,children:"select"===e.type?(0,s.jsx)(k.default,{placeholder:e.placeholder,defaultValue:e.defaultValue,children:null===(l=e.options)||void 0===l?void 0:l.map(e=>(0,s.jsx)(k.default.Option,{value:e,children:e},e))}):"upload"===e.type?(0,s.jsx)(R.default,{...h,onChange:l=>{(null==t?void 0:t.onChange)&&t.onChange(l),setTimeout(()=>{let l=r.getFieldValue(e.key);console.log("".concat(e.key," value after upload:"),JSON.stringify(l))},500)},children:(0,s.jsx)(E.ZP,{icon:(0,s.jsx)(F.Z,{}),children:"Click to Upload"})}):"textarea"===e.type?(0,s.jsx)(O.default.TextArea,{placeholder:e.placeholder,defaultValue:e.defaultValue,rows:6,style:{fontFamily:"monospace",fontSize:"12px"}}):(0,s.jsx)(P.o,{placeholder:e.placeholder,type:"password"===e.type?"password":"text",defaultValue:e.defaultValue})}),"vertex_credentials"===e.key&&(0,s.jsx)(L.Z,{children:(0,s.jsx)(T.Z,{children:(0,s.jsx)(P.x,{className:"mb-3 mt-1",children:"Give a gcp service account(.json file)"})})}),"base_model"===e.key&&(0,s.jsxs)(L.Z,{children:[(0,s.jsx)(T.Z,{span:10}),(0,s.jsx)(T.Z,{span:10,children:(0,s.jsxs)(P.x,{className:"mb-2",children:["The actual model your azure deployment uses. Used for accurate cost tracking. Select name from"," ",(0,s.jsx)(V,{href:"https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json",target:"_blank",children:"here"})]})})]})]},e.key)})]})};let{Link:B}=C.default;var U=e=>{let{open:l,onCancel:t,onAddCredential:a,uploadProps:r}=e,[i]=N.Z.useForm(),[n,d]=(0,o.useState)(m.Cl.OpenAI);return(0,s.jsx)(S.Z,{title:"Add New Credential",open:l,onCancel:()=>{t(),i.resetFields()},footer:null,width:600,children:(0,s.jsxs)(N.Z,{form:i,onFinish:e=>{a(Object.entries(e).reduce((e,l)=>{let[t,s]=l;return""!==s&&null!=s&&(e[t]=s),e},{})),i.resetFields()},layout:"vertical",children:[(0,s.jsx)(N.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],children:(0,s.jsx)(w.o,{placeholder:"Enter a friendly name for these credentials"})}),(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"Helper to auto-populate provider specific fields",children:(0,s.jsx)(k.default,{showSearch:!0,onChange:e=>{d(e),i.setFieldValue("custom_llm_provider",e)},children:Object.entries(m.Cl).map(e=>{let[l,t]=e;return(0,s.jsx)(k.default.Option,{value:l,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("img",{src:m.cd[t],alt:"".concat(l," logo"),className:"w-5 h-5",onError:e=>{let l=e.target,s=l.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,l)}}}),(0,s.jsx)("span",{children:t})]})},l)})})}),(0,s.jsx)(q,{selectedProvider:n,uploadProps:r}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(B,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E.ZP,{onClick:()=>{t(),i.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(E.ZP,{htmlType:"submit",children:"Add Credential"})]})]})]})})};let{Link:G}=C.default;function H(e){let{open:l,onCancel:t,onUpdateCredential:a,uploadProps:r,existingCredential:i}=e,[n]=N.Z.useForm(),[d,c]=(0,o.useState)(m.Cl.Anthropic);return(0,o.useEffect)(()=>{if(i){let e=Object.entries(i.credential_values||{}).reduce((e,l)=>{let[t,s]=l;return e[t]=null!=s?s:null,e},{});n.setFieldsValue({credential_name:i.credential_name,custom_llm_provider:i.credential_info.custom_llm_provider,...e}),c(i.credential_info.custom_llm_provider)}},[i]),(0,s.jsx)(S.Z,{title:"Edit Credential",open:l,onCancel:()=>{t(),n.resetFields()},footer:null,width:600,destroyOnHidden:!0,children:(0,s.jsxs)(N.Z,{form:n,onFinish:e=>{a(Object.entries(e).reduce((e,l)=>{let[t,s]=l;return""!==s&&null!=s&&(e[t]=s),e},{})),n.resetFields()},layout:"vertical",children:[(0,s.jsx)(N.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],initialValue:null==i?void 0:i.credential_name,children:(0,s.jsx)(w.o,{placeholder:"Enter a friendly name for these credentials",disabled:null!=i&&!!i.credential_name})}),(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"Helper to auto-populate provider specific fields",children:(0,s.jsx)(k.default,{showSearch:!0,onChange:e=>{c(e),n.setFieldValue("custom_llm_provider",e)},children:Object.entries(m.Cl).map(e=>{let[l,t]=e;return(0,s.jsx)(k.default.Option,{value:l,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("img",{src:m.cd[t],alt:"".concat(l," logo"),className:"w-5 h-5",onError:e=>{let l=e.target,s=l.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,l)}}}),(0,s.jsx)("span",{children:t})]})},l)})})}),(0,s.jsx)(q,{selectedProvider:d,uploadProps:r}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(G,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E.ZP,{onClick:()=>{t(),n.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(E.ZP,{htmlType:"submit",children:"Update Credential"})]})]})]})})}var K=t(80443),J=e=>{var l;let{uploadProps:t}=e,{accessToken:a}=(0,K.Z)(),{data:r,refetch:i}=f(a),n=(null==r?void 0:r.credentials)||[],[m,u]=(0,o.useState)(!1),[h,x]=(0,o.useState)(!1),[p,g]=(0,o.useState)(null),[j,v]=(0,o.useState)(null),[w,C]=(0,o.useState)(!1),[S,k]=(0,o.useState)(!1),[A]=N.Z.useForm(),E=["credential_name","custom_llm_provider"],M=async e=>{if(!a)return;let l=Object.entries(e).filter(e=>{let[l]=e;return!E.includes(l)}).reduce((e,l)=>{let[t,s]=l;return{...e,[t]:s}},{}),t={credential_name:e.credential_name,credential_values:l,credential_info:{custom_llm_provider:e.custom_llm_provider}};await (0,c.credentialUpdateCall)(a,e.credential_name,t),d.Z.success("Credential updated successfully"),x(!1),await i()},I=async e=>{if(!a)return;let l=Object.entries(e).filter(e=>{let[l]=e;return!E.includes(l)}).reduce((e,l)=>{let[t,s]=l;return{...e,[t]:s}},{}),t={credential_name:e.credential_name,credential_values:l,credential_info:{custom_llm_provider:e.custom_llm_provider}};await (0,c.credentialCreateCall)(a,t),d.Z.success("Credential added successfully"),u(!1),await i()},F=e=>{let l={openai:"blue",azure:"indigo",anthropic:"purple",default:"gray"},t=l[e.toLowerCase()]||l.default;return(0,s.jsx)(b.Ct,{color:t,size:"xs",children:e})},P=async()=>{if(a&&j){k(!0);try{await (0,c.credentialDeleteCall)(a,j.credential_name),d.Z.success("Credential deleted successfully"),await i()}catch(e){d.Z.error("Failed to delete credential")}finally{v(null),C(!1),k(!1)}}},L=e=>{v(e),C(!0)};return(0,s.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto p-2",children:[(0,s.jsx)(b.zx,{onClick:()=>u(!0),children:"Add Credential"}),(0,s.jsx)("div",{className:"flex justify-between items-center mt-4 mb-4",children:(0,s.jsx)(b.xv,{children:"Configured credentials for different AI providers. Add and manage your API credentials."})}),(0,s.jsx)(b.Zb,{children:(0,s.jsxs)(b.iA,{children:[(0,s.jsx)(b.ss,{children:(0,s.jsxs)(b.SC,{children:[(0,s.jsx)(b.xs,{children:"Credential Name"}),(0,s.jsx)(b.xs,{children:"Provider"}),(0,s.jsx)(b.xs,{children:"Actions"})]})}),(0,s.jsx)(b.RM,{children:n&&0!==n.length?n.map((e,l)=>{var t;return(0,s.jsxs)(b.SC,{children:[(0,s.jsx)(b.pj,{children:e.credential_name}),(0,s.jsx)(b.pj,{children:F((null===(t=e.credential_info)||void 0===t?void 0:t.custom_llm_provider)||"-")}),(0,s.jsxs)(b.pj,{children:[(0,s.jsx)(b.zx,{icon:_.Z,variant:"light",size:"sm",onClick:()=>{g(e),x(!0)}}),(0,s.jsx)(b.zx,{icon:y.Z,variant:"light",size:"sm",onClick:()=>L(e),className:"ml-2"})]})]},l)}):(0,s.jsx)(b.SC,{children:(0,s.jsx)(b.pj,{colSpan:4,className:"text-center py-4 text-gray-500",children:"No credentials configured"})})})]})}),m&&(0,s.jsx)(U,{onAddCredential:I,open:m,onCancel:()=>u(!1),uploadProps:t}),h&&(0,s.jsx)(H,{open:h,existingCredential:p,onUpdateCredential:M,uploadProps:t,onCancel:()=>x(!1)}),(0,s.jsx)(Z.Z,{isOpen:w,onCancel:()=>{v(null),C(!1)},onOk:P,title:"Delete Credential?",message:"Are you sure you want to delete this credential? This action cannot be undone and may break existing integrations.",resourceInformationTitle:"Credential Information",resourceInformation:[{label:"Credential Name",value:null==j?void 0:j.credential_name},{label:"Provider",value:(null==j?void 0:null===(l=j.credential_info)||void 0===l?void 0:l.custom_llm_provider)||"-"}],confirmLoading:S,requiredConfirmation:null==j?void 0:j.credential_name})]})};let W=e=>{var l;return(null==e?void 0:null===(l=e.model_info)||void 0===l?void 0:l.team_public_model_name)?e.model_info.team_public_model_name:(null==e?void 0:e.model_name)||"-"};var Y=t(23628),$=t(47323),Q=t(12485),X=t(18135),ee=t(35242),el=t(29706),et=t(77991),es=t(20347),ea=t(59341),er=t(5945),ei=t(84376),en=t(29),eo=t.n(en),ed=t(23496),ec=t(35291),em=t(23639),eu=t(15424);let{Text:eh}=C.default;var ex=e=>{let{formValues:l,accessToken:t,testMode:a,modelName:r="this model",onClose:i,onTestComplete:n}=e,[m,h]=o.useState(null),[x,p]=o.useState(null),[g,f]=o.useState(null),[j,v]=o.useState(!0),[_,y]=o.useState(!1),[b,N]=o.useState(!1),Z=async()=>{v(!0),N(!1),h(null),p(null),f(null),y(!1),await new Promise(e=>setTimeout(e,100));try{console.log("Testing connection with form values:",l);let a=await u(l,t,null);if(!a){console.log("No result from prepareModelAddRequest"),h("Failed to prepare model data. Please check your form inputs."),y(!1),v(!1);return}console.log("Result from prepareModelAddRequest:",a);let{litellmParamsObj:r,modelInfoObj:i,modelName:n}=a[0],o=await (0,c.testConnectionRequest)(t,r,i,null==i?void 0:i.mode);if("success"===o.status)d.Z.success("Connection test successful!"),h(null),y(!0);else{var e,s;let l=(null===(e=o.result)||void 0===e?void 0:e.error)||o.message||"Unknown error";h(l),p(r),f(null===(s=o.result)||void 0===s?void 0:s.raw_request_typed_dict),y(!1)}}catch(e){console.error("Test connection error:",e),h(e instanceof Error?e.message:String(e)),y(!1)}finally{v(!1),n&&n()}};o.useEffect(()=>{let e=setTimeout(()=>{Z()},200);return()=>clearTimeout(e)},[]);let w=e=>e?e.split("stack trace:")[0].trim().replace(/^litellm\.(.*?)Error: /,""):"Unknown error",C="string"==typeof m?w(m):(null==m?void 0:m.message)?w(m.message):"Unknown error",S=g?((e,l,t)=>{let s=JSON.stringify(l,null,2).split("\n").map(e=>" ".concat(e)).join("\n"),a=Object.entries(t).map(e=>{let[l,t]=e;return"-H '".concat(l,": ").concat(t,"'")}).join(" \\\n ");return"curl -X POST \\\n ".concat(e," \\\n ").concat(a?"".concat(a," \\\n "):"","-H 'Content-Type: application/json' \\\n -d '{\n").concat(s,"\n }'")})(g.raw_request_api_base,g.raw_request_body,g.raw_request_headers||{}):"";return(0,s.jsxs)("div",{style:{padding:"24px",borderRadius:"8px",backgroundColor:"#fff"},children:[j?(0,s.jsxs)("div",{style:{textAlign:"center",padding:"32px 20px"},className:"jsx-dc9a0e2d897fe63b",children:[(0,s.jsx)("div",{style:{marginBottom:"16px"},className:"jsx-dc9a0e2d897fe63b loading-spinner",children:(0,s.jsx)("div",{style:{border:"3px solid #f3f3f3",borderTop:"3px solid #1890ff",borderRadius:"50%",width:"30px",height:"30px",animation:"spin 1s linear infinite",margin:"0 auto"},className:"jsx-dc9a0e2d897fe63b"})}),(0,s.jsxs)(eh,{style:{fontSize:"16px"},children:["Testing connection to ",r,"..."]}),(0,s.jsx)(eo(),{id:"dc9a0e2d897fe63b",children:"@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg);transform:rotate(0deg)}100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);-moz-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}"})]}):_?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 20px"},children:[(0,s.jsx)("div",{style:{color:"#52c41a",fontSize:"24px",display:"flex",alignItems:"center"},children:(0,s.jsx)("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"check-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"})})}),(0,s.jsxs)(eh,{type:"success",style:{fontSize:"18px",fontWeight:500,marginLeft:"10px"},children:["Connection to ",r," successful!"]})]}):(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"20px"},children:[(0,s.jsx)(ec.Z,{style:{color:"#ff4d4f",fontSize:"24px",marginRight:"12px"}}),(0,s.jsxs)(eh,{type:"danger",style:{fontSize:"18px",fontWeight:500},children:["Connection to ",r," failed"]})]}),(0,s.jsxs)("div",{style:{backgroundColor:"#fff2f0",border:"1px solid #ffccc7",borderRadius:"8px",padding:"16px",marginBottom:"20px",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.03)"},children:[(0,s.jsxs)(eh,{strong:!0,style:{display:"block",marginBottom:"8px"},children:["Error:"," "]}),(0,s.jsx)(eh,{type:"danger",style:{fontSize:"14px",lineHeight:"1.5"},children:C}),m&&(0,s.jsx)("div",{style:{marginTop:"12px"},children:(0,s.jsx)(E.ZP,{type:"link",onClick:()=>N(!b),style:{paddingLeft:0,height:"auto"},children:b?"Hide Details":"Show Details"})})]}),b&&(0,s.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,s.jsx)(eh,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"Troubleshooting Details"}),(0,s.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"200px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5"},children:"string"==typeof m?m:JSON.stringify(m,null,2)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(eh,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"API Request"}),(0,s.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"250px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5"},children:S||"No request data available"}),(0,s.jsx)(E.ZP,{style:{marginTop:"8px"},icon:(0,s.jsx)(em.Z,{}),onClick:()=>{navigator.clipboard.writeText(S||""),d.Z.success("Copied to clipboard")},children:"Copy to Clipboard"})]})]})}),(0,s.jsx)(ed.Z,{style:{margin:"24px 0 16px"}}),(0,s.jsx)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:(0,s.jsx)(E.ZP,{type:"link",href:"https://docs.litellm.ai/docs/providers",target:"_blank",icon:(0,s.jsx)(eu.Z,{}),children:"View Documentation"})})]})};let ep=async(e,l,t,s)=>{try{console.log("=== AUTO ROUTER SUBMIT HANDLER CALLED ==="),console.log("handling auto router submit for formValues:",e),console.log("Access token:",l?"Present":"Missing"),console.log("Form:",t?"Present":"Missing"),console.log("Callback:",s?"Present":"Missing");let a={model_name:e.auto_router_name,litellm_params:{model:"auto_router/".concat(e.auto_router_name),auto_router_config:JSON.stringify(e.auto_router_config),auto_router_default_model:e.auto_router_default_model},model_info:{}};e.auto_router_embedding_model&&"custom"!==e.auto_router_embedding_model?a.litellm_params.auto_router_embedding_model=e.auto_router_embedding_model:e.custom_embedding_model&&(a.litellm_params.auto_router_embedding_model=e.custom_embedding_model),e.team_id&&(a.model_info.team_id=e.team_id),e.model_access_group&&e.model_access_group.length>0&&(a.model_info.access_groups=e.model_access_group),console.log("Auto router configuration to be created:",a),console.log("Auto router config (stringified):",a.litellm_params.auto_router_config),console.log("Calling modelCreateCall with:",{accessToken:l?"Present":"Missing",config:a});let r=await (0,c.modelCreateCall)(l,a);console.log("response for auto router create call:",r),t.resetFields()}catch(e){console.error("Failed to add auto router:",e),d.Z.fromBackend("Failed to add auto router: "+e)}};var eg=t(10703),ef=t(44851),ej=t(19015),ev=t(96473),e_=t(70464),ey=t(26349),eb=t(92280);let{TextArea:eN}=O.default,{Panel:eZ}=ef.default;var ew=e=>{let{modelInfo:l,value:t,onChange:a}=e,[r,i]=(0,o.useState)([]),[n,d]=(0,o.useState)(!1),[c,m]=(0,o.useState)([]);(0,o.useEffect)(()=>{if(null==t?void 0:t.routes){let e=t.routes.map((e,l)=>({id:e.id||"route-".concat(l,"-").concat(Date.now()),model:e.name||e.model||"",utterances:e.utterances||[],description:e.description||"",score_threshold:e.score_threshold||.5}));i(e),m(e.map(e=>e.id))}else i([]),m([])},[t]);let u=e=>{let l=r.filter(l=>l.id!==e);i(l),x(l),m(l=>l.filter(l=>l!==e))},h=(e,l,t)=>{let s=r.map(s=>s.id===e?{...s,[l]:t}:s);i(s),x(s)},x=e=>{let l={routes:e.map(e=>({name:e.model,utterances:e.utterances,description:e.description,score_threshold:e.score_threshold}))};null==a||a(l)},p=l.map(e=>({value:e.model_group,label:e.model_group}));return(0,s.jsxs)("div",{className:"w-full max-w-none",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-6 w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(eb.x,{className:"text-lg font-semibold",children:"Routes Configuration"}),(0,s.jsx)(A.Z,{title:"Configure routing logic to automatically select the best model based on user input patterns",children:(0,s.jsx)(eu.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(E.ZP,{type:"primary",icon:(0,s.jsx)(ev.Z,{}),onClick:()=>{let e="route-".concat(Date.now()),l=[...r,{id:e,model:"",utterances:[],description:"",score_threshold:.5}];i(l),x(l),m(l=>[...l,e])},className:"bg-blue-600 hover:bg-blue-700",children:"Add Route"})]}),0===r.length?(0,s.jsx)("div",{className:"text-center py-12 text-gray-500 bg-gray-50 rounded-lg border-2 border-dashed border-gray-200 mb-6",children:(0,s.jsx)(eb.x,{children:"No routes configured. Click “Add Route” to get started."})}):(0,s.jsx)("div",{className:"space-y-3 mb-6 w-full",children:r.map((e,l)=>(0,s.jsx)(er.Z,{className:"border border-gray-200 shadow-sm w-full",bodyStyle:{padding:0},children:(0,s.jsx)(ef.default,{ghost:!0,expandIcon:e=>{let{isActive:l}=e;return(0,s.jsx)(e_.Z,{rotate:l?180:0})},activeKey:c,onChange:e=>m(Array.isArray(e)?e:[e].filter(Boolean)),items:[{key:e.id,label:(0,s.jsxs)("div",{className:"flex justify-between items-center py-2",children:[(0,s.jsxs)(eb.x,{className:"font-medium text-base",children:["Route ",l+1,": ",e.model||"Unnamed"]}),(0,s.jsx)(E.ZP,{type:"text",danger:!0,icon:(0,s.jsx)(ey.Z,{}),onClick:l=>{l.stopPropagation(),u(e.id)},className:"mr-2"})]}),children:(0,s.jsxs)("div",{className:"px-6 pb-6 w-full",children:[(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsx)(eb.x,{className:"text-sm font-medium mb-2 block",children:"Model"}),(0,s.jsx)(k.default,{value:e.model,onChange:l=>h(e.id,"model",l),placeholder:"Select model",showSearch:!0,style:{width:"100%"},options:p})]}),(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsx)(eb.x,{className:"text-sm font-medium mb-2 block",children:"Description"}),(0,s.jsx)(eN,{value:e.description,onChange:l=>h(e.id,"description",l.target.value),placeholder:"Describe when this route should be used...",rows:2,style:{width:"100%"}})]}),(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)(eb.x,{className:"text-sm font-medium",children:"Score Threshold"}),(0,s.jsx)(A.Z,{title:"Minimum similarity score to route to this model (0-1)",children:(0,s.jsx)(eu.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(ej.Z,{value:e.score_threshold,onChange:l=>h(e.id,"score_threshold",l||0),min:0,max:1,step:.1,style:{width:"100%"},placeholder:"0.5"})]}),(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)(eb.x,{className:"text-sm font-medium",children:"Example Utterances"}),(0,s.jsx)(A.Z,{title:"Training examples for this route. Type an utterance and press Enter to add it.",children:(0,s.jsx)(eu.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(eb.x,{className:"text-xs text-gray-500 mb-2",children:"Type an utterance and press Enter to add it. You can also paste multiple lines."}),(0,s.jsx)(k.default,{mode:"tags",value:e.utterances,onChange:l=>h(e.id,"utterances",l),placeholder:"Type an utterance and press Enter...",style:{width:"100%"},tokenSeparators:["\n"],maxTagCount:"responsive",allowClear:!0})]})]})}]})},e.id))}),(0,s.jsxs)("div",{className:"border-t pt-6 w-full",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4 w-full",children:[(0,s.jsx)(eb.x,{className:"text-lg font-semibold",children:"JSON Preview"}),(0,s.jsx)(E.ZP,{type:"link",onClick:()=>d(!n),className:"text-blue-600 p-0",children:n?"Hide":"Show"})]}),n&&(0,s.jsx)(er.Z,{className:"bg-gray-50 w-full",children:(0,s.jsx)("pre",{className:"text-sm overflow-auto max-h-64 w-full",children:JSON.stringify({routes:r.map(e=>({name:e.model,utterances:e.utterances,description:e.description,score_threshold:e.score_threshold}))},null,2)})})]})]})};let{Title:eC,Link:eS}=C.default;var ek=e=>{let{form:l,handleOk:t,accessToken:a,userRole:r}=e,[i,n]=(0,o.useState)(!1),[m,u]=(0,o.useState)(!1),[h,x]=(0,o.useState)(""),[p,g]=(0,o.useState)([]),[f,j]=(0,o.useState)([]),[v,_]=(0,o.useState)(!1),[y,b]=(0,o.useState)(!1),[Z,w]=(0,o.useState)(null);(0,o.useEffect)(()=>{(async()=>{g((await (0,c.modelAvailableCall)(a,"","",!1,null,!0,!0)).data.map(e=>e.id))})()},[a]),(0,o.useEffect)(()=>{(async()=>{try{let e=await (0,eg.p)(a);console.log("Fetched models for auto router:",e),j(e)}catch(e){console.error("Error fetching model info for auto router:",e)}})()},[a]);let M=es.ZL.includes(r),I=async()=>{u(!0),x("test-".concat(Date.now())),n(!0)},F=()=>{console.log("Auto router submit triggered!"),console.log("Router config:",Z);let e=l.getFieldsValue();if(console.log("Form values:",e),!e.auto_router_name){d.Z.fromBackend("Please enter an Auto Router Name");return}if(!e.auto_router_default_model){d.Z.fromBackend("Please select a Default Model");return}if(l.setFieldsValue({custom_llm_provider:"auto_router",model:e.auto_router_name,api_key:"not_required_for_auto_router"}),!Z||!Z.routes||0===Z.routes.length){d.Z.fromBackend("Please configure at least one route for the auto router");return}if(Z.routes.filter(e=>!e.name||!e.description||0===e.utterances.length).length>0){d.Z.fromBackend("Please ensure all routes have a target model, description, and at least one utterance");return}l.validateFields().then(e=>{console.log("Form validation passed, submitting with values:",e);let s={...e,auto_router_config:Z};console.log("Final submit values:",s),ep(s,a,l,t)}).catch(e=>{console.error("Validation failed:",e);let l=e.errorFields||[];if(l.length>0){let e=l.map(e=>{let l=e.name[0];return({auto_router_name:"Auto Router Name",auto_router_default_model:"Default Model",auto_router_embedding_model:"Embedding Model"})[l]||l});d.Z.fromBackend("Please fill in the following required fields: ".concat(e.join(", ")))}else d.Z.fromBackend("Please fill in all required fields")})};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eC,{level:2,children:"Add Auto Router"}),(0,s.jsx)(P.x,{className:"text-gray-600 mb-6",children:"Create an auto router with intelligent routing logic that automatically selects the best model based on user input patterns and semantic matching."}),(0,s.jsx)(er.Z,{children:(0,s.jsxs)(N.Z,{form:l,onFinish:F,labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:[(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Auto router name is required"}],label:"Auto Router Name",name:"auto_router_name",tooltip:"Unique name for this auto router configuration",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(P.o,{placeholder:"e.g., auto_router_1, smart_routing"})}),(0,s.jsx)("div",{className:"w-full mb-4",children:(0,s.jsx)(ew,{modelInfo:f,value:Z,onChange:e=>{w(e),l.setFieldValue("auto_router_config",e)}})}),(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Default model is required"}],label:"Default Model",name:"auto_router_default_model",tooltip:"Fallback model to use when auto routing logic cannot determine the best model",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(k.default,{placeholder:"Select a default model",onChange:e=>{_("custom"===e)},options:[...Array.from(new Set(f.map(e=>e.model_group))).map(e=>({value:e,label:e})),{value:"custom",label:"Enter custom model name"}],style:{width:"100%"},showSearch:!0})}),(0,s.jsx)(N.Z.Item,{label:"Embedding Model",name:"auto_router_embedding_model",tooltip:"Optional: Embedding model to use for semantic routing decisions",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(k.default,{value:l.getFieldValue("auto_router_embedding_model"),placeholder:"Select an embedding model (optional)",onChange:e=>{b("custom"===e),l.setFieldValue("auto_router_embedding_model",e)},options:[...Array.from(new Set(f.map(e=>e.model_group))).map(e=>({value:e,label:e})),{value:"custom",label:"Enter custom model name"}],style:{width:"100%"},showSearch:!0,allowClear:!0})}),(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"Additional Settings"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),M&&(0,s.jsx)(N.Z.Item,{label:"Model Access Group",name:"model_access_group",className:"mb-4",tooltip:"Use model access groups to control who can access this auto router",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:p.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})}),(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(C.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{className:"space-x-2",children:[(0,s.jsx)(E.ZP,{onClick:I,loading:m,children:"Test Connect"}),(0,s.jsx)(E.ZP,{onClick:()=>{console.log("Add Auto Router button clicked!"),console.log("Current router config:",Z),console.log("Current form values:",l.getFieldsValue()),F()},children:"Add Auto Router"})]})]})]})}),(0,s.jsx)(S.Z,{title:"Connection Test Results",open:i,onCancel:()=>{n(!1),u(!1)},footer:[(0,s.jsx)(E.ZP,{onClick:()=>{n(!1),u(!1)},children:"Close"},"close")],width:700,children:i&&(0,s.jsx)(ex,{formValues:l.getFieldsValue(),accessToken:a,testMode:"chat",modelName:l.getFieldValue("auto_router_name"),onClose:()=>{n(!1),u(!1)},onTestComplete:()=>u(!1)},h)})]})};let eA=[{value:"chat",label:"Chat - /chat/completions"},{value:"completion",label:"Completion - /completions"},{value:"embedding",label:"Embedding - /embeddings"},{value:"audio_speech",label:"Audio Speech - /audio/speech"},{value:"audio_transcription",label:"Audio Transcription - /audio/transcriptions"},{value:"image_generation",label:"Image Generation - /images/generations"},{value:"video_generation",label:"Video Generation - /videos"},{value:"rerank",label:"Rerank - /rerank"},{value:"realtime",label:"Realtime - /realtime"},{value:"batch",label:"Batch - /batch"},{value:"ocr",label:"OCR - /ocr"}];var eE=t(63709),eM=t(26210),eI=t(34766),eF=t(45246),eP=t(24199);let{Text:eL}=C.default;var eT=e=>{let{form:l,showCacheControl:t,onCacheControlChange:a}=e,r=e=>{let t=l.getFieldValue("litellm_extra_params");try{let s=t?JSON.parse(t):{};e.length>0?s.cache_control_injection_points=e:delete s.cache_control_injection_points,Object.keys(s).length>0?l.setFieldValue("litellm_extra_params",JSON.stringify(s,null,2)):l.setFieldValue("litellm_extra_params","")}catch(e){console.error("Error updating cache control points:",e)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(N.Z.Item,{label:"Cache Control Injection Points",name:"cache_control",valuePropName:"checked",className:"mb-4",tooltip:"Tell litellm where to inject cache control checkpoints. You can specify either by role (to apply to all messages of that role) or by specific message index.",children:(0,s.jsx)(eE.Z,{onChange:a,className:"bg-gray-600"})}),t&&(0,s.jsxs)("div",{className:"ml-6 pl-4 border-l-2 border-gray-200",children:[(0,s.jsx)(eL,{className:"text-sm text-gray-500 block mb-4",children:"Providers like Anthropic, Bedrock API require users to specify where to inject cache control checkpoints, litellm can automatically add them for you as a cost saving feature."}),(0,s.jsx)(N.Z.List,{name:"cache_control_injection_points",initialValue:[{location:"message"}],children:(e,t)=>{let{add:a,remove:i}=t;return(0,s.jsxs)(s.Fragment,{children:[e.map((t,a)=>(0,s.jsxs)("div",{className:"flex items-center mb-4 gap-4",children:[(0,s.jsx)(N.Z.Item,{...t,label:"Type",name:[t.name,"location"],initialValue:"message",className:"mb-0",style:{width:"180px"},children:(0,s.jsx)(k.default,{disabled:!0,options:[{value:"message",label:"Message"}]})}),(0,s.jsx)(N.Z.Item,{...t,label:"Role",name:[t.name,"role"],className:"mb-0",style:{width:"180px"},tooltip:"LiteLLM will mark all messages of this role as cacheable",children:(0,s.jsx)(k.default,{placeholder:"Select a role",allowClear:!0,options:[{value:"user",label:"User"},{value:"system",label:"System"},{value:"assistant",label:"Assistant"}],onChange:()=>{r(l.getFieldValue("cache_control_points"))}})}),(0,s.jsx)(N.Z.Item,{...t,label:"Index",name:[t.name,"index"],className:"mb-0",style:{width:"180px"},tooltip:"(Optional) If set litellm will mark the message at this index as cacheable",children:(0,s.jsx)(eP.Z,{type:"number",placeholder:"Optional",step:1,onChange:()=>{r(l.getFieldValue("cache_control_points"))}})}),e.length>1&&(0,s.jsx)(eF.Z,{className:"text-red-500 cursor-pointer text-lg ml-12",onClick:()=>{i(t.name),setTimeout(()=>{r(l.getFieldValue("cache_control_points"))},0)}})]},t.key)),(0,s.jsx)(N.Z.Item,{children:(0,s.jsxs)("button",{type:"button",className:"flex items-center justify-center w-full border border-dashed border-gray-300 py-2 px-4 text-gray-600 hover:text-blue-600 hover:border-blue-300 transition-all rounded",onClick:()=>a(),children:[(0,s.jsx)(ev.Z,{className:"mr-2"}),"Add Injection Point"]})})]})}})]})]})},eR=t(9309);let{Link:eO}=C.default;var eV=e=>{let{showAdvancedSettings:l,setShowAdvancedSettings:t,teams:a,guardrailsList:r,tagsList:i}=e,[n]=N.Z.useForm(),[d,c]=o.useState(!1),[m,u]=o.useState("per_token"),[h,x]=o.useState(!1),p=(e,l)=>l&&(isNaN(Number(l))||0>Number(l))?Promise.reject("Please enter a valid positive number"):Promise.resolve();return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)(eM.UQ,{className:"mt-2 mb-4",children:[(0,s.jsx)(eM._m,{children:(0,s.jsx)("b",{children:"Advanced Settings"})}),(0,s.jsx)(eM.X1,{children:(0,s.jsxs)("div",{className:"bg-white rounded-lg",children:[(0,s.jsx)(N.Z.Item,{label:"Custom Pricing",name:"custom_pricing",valuePropName:"checked",className:"mb-4",children:(0,s.jsx)(eE.Z,{onChange:e=>{c(e),e||n.setFieldsValue({input_cost_per_token:void 0,output_cost_per_token:void 0,input_cost_per_second:void 0})},className:"bg-gray-600"})}),(0,s.jsx)(N.Z.Item,{label:(0,s.jsxs)("span",{children:["Guardrails"," ",(0,s.jsx)(A.Z,{title:"Apply safety guardrails to this key to filter content or enforce policies",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(eu.Z,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-4",help:"Select existing guardrails. Go to 'Guardrails' tab to create new guardrails.",children:(0,s.jsx)(k.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter guardrails",options:r.map(e=>({value:e,label:e}))})}),(0,s.jsx)(N.Z.Item,{label:"Tags",name:"tags",className:"mb-4",children:(0,s.jsx)(k.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter tags",options:Object.values(i).map(e=>({value:e.name,label:e.name,title:e.description||e.name}))})}),d&&(0,s.jsxs)("div",{className:"ml-6 pl-4 border-l-2 border-gray-200",children:[(0,s.jsx)(N.Z.Item,{label:"Pricing Model",name:"pricing_model",className:"mb-4",children:(0,s.jsx)(k.default,{defaultValue:"per_token",onChange:e=>u(e),options:[{value:"per_token",label:"Per Million Tokens"},{value:"per_second",label:"Per Second"}]})}),"per_token"===m?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(N.Z.Item,{label:"Input Cost (per 1M tokens)",name:"input_cost_per_token",rules:[{validator:p}],className:"mb-4",children:(0,s.jsx)(eM.oi,{})}),(0,s.jsx)(N.Z.Item,{label:"Output Cost (per 1M tokens)",name:"output_cost_per_token",rules:[{validator:p}],className:"mb-4",children:(0,s.jsx)(eM.oi,{})})]}):(0,s.jsx)(N.Z.Item,{label:"Cost Per Second",name:"input_cost_per_second",rules:[{validator:p}],className:"mb-4",children:(0,s.jsx)(eM.oi,{})})]}),(0,s.jsx)(N.Z.Item,{label:"Use in pass through routes",name:"use_in_pass_through",valuePropName:"checked",className:"mb-4 mt-4",tooltip:(0,s.jsxs)("span",{children:["Allow using these credentials in pass through routes."," ",(0,s.jsx)(eO,{href:"https://docs.litellm.ai/docs/pass_through/vertex_ai",target:"_blank",children:"Learn more"})]}),children:(0,s.jsx)(eE.Z,{onChange:e=>{let l=n.getFieldValue("litellm_extra_params");try{let t=l?JSON.parse(l):{};e?t.use_in_pass_through=!0:delete t.use_in_pass_through,Object.keys(t).length>0?n.setFieldValue("litellm_extra_params",JSON.stringify(t,null,2)):n.setFieldValue("litellm_extra_params","")}catch(l){e?n.setFieldValue("litellm_extra_params",JSON.stringify({use_in_pass_through:!0},null,2)):n.setFieldValue("litellm_extra_params","")}},className:"bg-gray-600"})}),(0,s.jsx)(eT,{form:n,showCacheControl:h,onCacheControlChange:e=>{if(x(e),!e){let e=n.getFieldValue("litellm_extra_params");try{let l=e?JSON.parse(e):{};delete l.cache_control_injection_points,Object.keys(l).length>0?n.setFieldValue("litellm_extra_params",JSON.stringify(l,null,2)):n.setFieldValue("litellm_extra_params","")}catch(e){n.setFieldValue("litellm_extra_params","")}}}}),(0,s.jsx)(N.Z.Item,{label:"LiteLLM Params",name:"litellm_extra_params",tooltip:"Optional litellm params used for making a litellm.completion() call.",className:"mb-4 mt-4",rules:[{validator:eR.Ac}],children:(0,s.jsx)(eI.Z,{rows:4,placeholder:'{ "rpm": 100, "timeout": 0, "stream_timeout": 0 }'})}),(0,s.jsxs)(L.Z,{className:"mb-4",children:[(0,s.jsx)(T.Z,{span:10}),(0,s.jsx)(T.Z,{span:10,children:(0,s.jsxs)(eM.xv,{className:"text-gray-600 text-sm",children:["Pass JSON of litellm supported params"," ",(0,s.jsx)(eO,{href:"https://docs.litellm.ai/docs/completion/input",target:"_blank",children:"litellm.completion() call"})]})})]}),(0,s.jsx)(N.Z.Item,{label:"Model Info",name:"model_info_params",tooltip:"Optional model info params. Returned when calling `/model/info` endpoint.",className:"mb-0",rules:[{validator:eR.Ac}],children:(0,s.jsx)(eI.Z,{rows:4,placeholder:'{ "mode": "chat" }'})})]})})]})})},eD=t(56609),ez=t(67187);let eq=e=>{let{content:l,children:t,width:a="auto",className:r=""}=e,[i,n]=(0,o.useState)(!1),[d,c]=(0,o.useState)("top"),m=(0,o.useRef)(null),u=()=>{if(m.current){let e=m.current.getBoundingClientRect(),l=e.top,t=window.innerHeight-e.bottom;l<300&&t>300?c("bottom"):c("top")}};return(0,s.jsxs)("div",{className:"relative inline-block",ref:m,children:[t||(0,s.jsx)(ez.Z,{className:"ml-1 text-gray-500 cursor-help",onMouseEnter:()=>{u(),n(!0)},onMouseLeave:()=>n(!1)}),i&&(0,s.jsxs)("div",{className:"absolute left-1/2 -translate-x-1/2 z-50 bg-black/90 text-white p-2 rounded-md text-sm font-normal shadow-lg ".concat(r),style:{["top"===d?"bottom":"top"]:"100%",width:a,marginBottom:"top"===d?"8px":"0",marginTop:"bottom"===d?"8px":"0"},children:[l,(0,s.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2 w-0 h-0",style:{top:"top"===d?"100%":"auto",bottom:"bottom"===d?"100%":"auto",borderTop:"top"===d?"6px solid rgba(0, 0, 0, 0.9)":"6px solid transparent",borderBottom:"bottom"===d?"6px solid rgba(0, 0, 0, 0.9)":"6px solid transparent",borderLeft:"6px solid transparent",borderRight:"6px solid transparent"}})]})]})};var eB=()=>{let e=N.Z.useFormInstance(),[l,t]=(0,o.useState)(0),a=N.Z.useWatch("model",e)||[],r=Array.isArray(a)?a:[a],i=N.Z.useWatch("custom_model_name",e),n=!r.includes("all-wildcard"),d=N.Z.useWatch("custom_llm_provider",e);if((0,o.useEffect)(()=>{if(i&&r.includes("custom")){let l=(e.getFieldValue("model_mappings")||[]).map(e=>"custom"===e.public_name||"custom"===e.litellm_model?d===m.Cl.Azure?{public_name:i,litellm_model:"azure/".concat(i)}:{public_name:i,litellm_model:i}:e);e.setFieldValue("model_mappings",l),t(e=>e+1)}},[i,r,d,e]),(0,o.useEffect)(()=>{if(r.length>0&&!r.includes("all-wildcard")){let l=e.getFieldValue("model_mappings")||[];if(l.length!==r.length||!r.every(e=>l.some(l=>"custom"===e?"custom"===l.litellm_model||l.litellm_model===i:d===m.Cl.Azure?l.litellm_model==="azure/".concat(e):l.litellm_model===e))){let l=r.map(e=>"custom"===e&&i?d===m.Cl.Azure?{public_name:i,litellm_model:"azure/".concat(i)}:{public_name:i,litellm_model:i}:d===m.Cl.Azure?{public_name:e,litellm_model:"azure/".concat(e)}:{public_name:e,litellm_model:e});e.setFieldValue("model_mappings",l),t(e=>e+1)}}},[r,i,d,e]),!n)return null;let c=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"mb-2 font-normal",children:"The name you specify in your API calls to LiteLLM Proxy"}),(0,s.jsxs)("div",{className:"mb-2 font-normal",children:[(0,s.jsx)("strong",{children:"Example:"})," If you name your public model"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"example-name"}),", and choose"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"openai/qwen-plus-latest"})," as the LiteLLM model"]}),(0,s.jsxs)("div",{className:"mb-2 font-normal",children:[(0,s.jsx)("strong",{children:"Usage:"})," You make an API call to the LiteLLM proxy with"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:'model = "example-name"'})]}),(0,s.jsxs)("div",{className:"font-normal",children:[(0,s.jsx)("strong",{children:"Result:"})," LiteLLM sends"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"qwen-plus-latest"})," to the provider"]})]}),u=(0,s.jsx)("div",{children:"The model name LiteLLM will send to the LLM API"}),h=[{title:(0,s.jsxs)("span",{className:"flex items-center",children:["Public Model Name",(0,s.jsx)(eq,{content:c,width:"500px"})]}),dataIndex:"public_name",key:"public_name",render:(l,t,a)=>(0,s.jsx)(w.o,{value:l,onChange:l=>{let t=[...e.getFieldValue("model_mappings")];t[a].public_name=l.target.value,e.setFieldValue("model_mappings",t)}})},{title:(0,s.jsxs)("span",{className:"flex items-center",children:["LiteLLM Model Name",(0,s.jsx)(eq,{content:u,width:"360px"})]}),dataIndex:"litellm_model",key:"litellm_model"}];return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(N.Z.Item,{label:"Model Mappings",name:"model_mappings",tooltip:"Map public model names to LiteLLM model names for load balancing",labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",rules:[{required:!0,validator:async(e,l)=>{if(!l||0===l.length)throw Error("At least one model mapping is required");if(l.filter(e=>!e.public_name||""===e.public_name.trim()).length>0)throw Error("All model mappings must have valid public names")}}],children:(0,s.jsx)(eD.Z,{dataSource:e.getFieldValue("model_mappings"),columns:h,pagination:!1,size:"small"},l)})})},eU=e=>{let{selectedProvider:l,providerModels:t,getPlaceholder:a}=e,r=N.Z.useFormInstance(),i=e=>{let t=e.target.value,s=(r.getFieldValue("model_mappings")||[]).map(e=>"custom"===e.public_name||"custom"===e.litellm_model?l===m.Cl.Azure?{public_name:t,litellm_model:"azure/".concat(t)}:{public_name:t,litellm_model:t}:e);r.setFieldsValue({model_mappings:s})};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(N.Z.Item,{label:"LiteLLM Model Name(s)",tooltip:"The model name LiteLLM will send to the LLM API",className:"mb-0",children:[(0,s.jsx)(N.Z.Item,{name:"model",rules:[{required:!0,message:"Please enter ".concat(l===m.Cl.Azure?"a deployment name":"at least one model",".")}],noStyle:!0,children:l===m.Cl.Azure||l===m.Cl.OpenAI_Compatible||l===m.Cl.Ollama?(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(P.o,{placeholder:a(l),onChange:l===m.Cl.Azure?e=>{let l=e.target.value,t=l?[{public_name:l,litellm_model:"azure/".concat(l)}]:[];r.setFieldsValue({model:l,model_mappings:t})}:void 0})}):t.length>0?(0,s.jsx)(k.default,{mode:"multiple",allowClear:!0,showSearch:!0,placeholder:"Select models",onChange:e=>{let t=Array.isArray(e)?e:[e];if(t.includes("all-wildcard"))r.setFieldsValue({model_name:void 0,model_mappings:[]});else if(JSON.stringify(r.getFieldValue("model"))!==JSON.stringify(t)){let e=t.map(e=>l===m.Cl.Azure?{public_name:e,litellm_model:"azure/".concat(e)}:{public_name:e,litellm_model:e});r.setFieldsValue({model:t,model_mappings:e})}},optionFilterProp:"children",filterOption:(e,l)=>{var t;return(null!==(t=null==l?void 0:l.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:[{label:"Custom Model Name (Enter below)",value:"custom"},{label:"All ".concat(l," Models (Wildcard)"),value:"all-wildcard"},...t.map(e=>({label:e,value:e}))],style:{width:"100%"}}):(0,s.jsx)(P.o,{placeholder:a(l)})}),(0,s.jsx)(N.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.model!==l.model,children:e=>{let{getFieldValue:t}=e,a=t("model")||[];return(Array.isArray(a)?a:[a]).includes("custom")&&(0,s.jsx)(N.Z.Item,{name:"custom_model_name",rules:[{required:!0,message:"Please enter a custom model name."}],className:"mt-2",children:(0,s.jsx)(P.o,{placeholder:l===m.Cl.Azure?"Enter Azure deployment name":"Enter custom model name",onChange:i})})}})]}),(0,s.jsxs)(L.Z,{children:[(0,s.jsx)(T.Z,{span:10}),(0,s.jsx)(T.Z,{span:14,children:(0,s.jsx)(P.x,{className:"mb-3 mt-1",children:l===m.Cl.Azure?"Your deployment name will be saved as the public model name, and LiteLLM will use 'azure/deployment-name' internally":"The model name LiteLLM will send to the LLM API"})})]})]})};let{Title:eG,Link:eH}=C.default;var eK=e=>{let{form:l,handleOk:t,selectedProvider:a,setSelectedProvider:r,providerModels:i,setProviderModelsFn:d,getPlaceholder:u,uploadProps:h,showAdvancedSettings:x,setShowAdvancedSettings:p,teams:g,credentials:f,accessToken:j,userRole:v,premiumUser:_}=e,[y]=N.Z.useForm(),[b,Z]=(0,o.useState)("chat"),[w,M]=(0,o.useState)(!1),[F,P]=(0,o.useState)(!1),[R,O]=(0,o.useState)([]),[V,D]=(0,o.useState)({}),[z,B]=(0,o.useState)(""),{data:U,isLoading:G,error:H}=I();(0,o.useEffect)(()=>{(async()=>{try{let e=(await (0,c.getGuardrailsList)(j)).guardrails.map(e=>e.guardrail_name);O(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})()},[j]),(0,o.useEffect)(()=>{(async()=>{try{let e=await (0,c.tagListCall)(j);D(e)}catch(e){console.error("Failed to fetch tags:",e)}})()},[j]);let K=async()=>{P(!0),B("test-".concat(Date.now())),M(!0)},[J,W]=(0,o.useState)(!1),[Y,$]=(0,o.useState)([]);(0,o.useEffect)(()=>{(async()=>{$((await (0,c.modelAvailableCall)(j,"","",!1,null,!0,!0)).data.map(e=>e.id))})()},[j]);let en=(0,o.useMemo)(()=>U?[...U].sort((e,l)=>e.provider_display_name.localeCompare(l.provider_display_name)):[],[U]),eo=H?H instanceof Error?H.message:"Failed to load providers":null,ed=es.ZL.includes(v);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(X.Z,{className:"w-full",children:[(0,s.jsxs)(ee.Z,{className:"mb-4",children:[(0,s.jsx)(Q.Z,{children:"Add Model"}),(0,s.jsx)(Q.Z,{children:"Add Auto Router"})]}),(0,s.jsxs)(et.Z,{children:[(0,s.jsxs)(el.Z,{children:[(0,s.jsx)(eG,{level:2,children:"Add Model"}),(0,s.jsx)(er.Z,{children:(0,s.jsx)(N.Z,{form:l,onFinish:e=>{console.log("\uD83D\uDD25 Form onFinish triggered with values:",e),t()},onFinishFailed:e=>{console.log("\uD83D\uDCA5 Form onFinishFailed triggered:",e)},labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"E.g. OpenAI, Azure OpenAI, Anthropic, Bedrock, etc.",labelCol:{span:10},labelAlign:"left",children:(0,s.jsxs)(k.default,{showSearch:!0,loading:G,placeholder:G?"Loading providers...":"Select a provider",optionFilterProp:"data-label",onChange:e=>{r(e),d(e),l.setFieldsValue({custom_llm_provider:e}),l.setFieldsValue({model:[],model_name:void 0})},children:[eo&&0===en.length&&(0,s.jsx)(k.default.Option,{value:"",children:eo},"__error"),en.map(e=>{var l;let t=e.provider_display_name,a=e.provider,r=null!==(l=m.cd[t])&&void 0!==l?l:"";return(0,s.jsx)(k.default.Option,{value:a,"data-label":t,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r?(0,s.jsx)("img",{src:r,alt:"".concat(t," logo"),className:"w-5 h-5",onError:e=>{let l=e.currentTarget,s=l.parentElement;if(s&&s.contains(l))try{let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,l)}catch(e){console.error("Failed to replace provider logo fallback:",e)}}}):(0,s.jsx)("div",{className:"w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",children:t.charAt(0)}),(0,s.jsx)("span",{children:t})]})},a)})]})}),(0,s.jsx)(eU,{selectedProvider:a,providerModels:i,getPlaceholder:u}),(0,s.jsx)(eB,{}),(0,s.jsx)(N.Z.Item,{label:"Mode",name:"mode",className:"mb-1",children:(0,s.jsx)(k.default,{style:{width:"100%"},value:b,onChange:e=>Z(e),options:eA})}),(0,s.jsxs)(L.Z,{children:[(0,s.jsx)(T.Z,{span:10}),(0,s.jsx)(T.Z,{span:10,children:(0,s.jsxs)(n.Z,{className:"mb-5 mt-1",children:[(0,s.jsx)("strong",{children:"Optional"})," - LiteLLM endpoint to use when health checking this model"," ",(0,s.jsx)(eH,{href:"https://docs.litellm.ai/docs/proxy/health#health",target:"_blank",children:"Learn more"})]})})]}),(0,s.jsx)("div",{className:"mb-4",children:(0,s.jsx)(C.default.Text,{className:"text-sm text-gray-500 mb-2",children:"Either select existing credentials OR enter new provider credentials below"})}),(0,s.jsx)(N.Z.Item,{label:"Existing Credentials",name:"litellm_credential_name",initialValue:null,children:(0,s.jsx)(k.default,{showSearch:!0,placeholder:"Select or search for existing credentials",optionFilterProp:"children",filterOption:(e,l)=>{var t;return(null!==(t=null==l?void 0:l.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:[{value:null,label:"None"},...f.map(e=>({value:e.credential_name,label:e.credential_name}))],allowClear:!0})}),(0,s.jsx)(N.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.litellm_credential_name!==l.litellm_credential_name||e.provider!==l.provider,children:e=>{let{getFieldValue:l}=e,t=l("litellm_credential_name");return(console.log("\uD83D\uDD11 Credential Name Changed:",t),t)?null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"OR"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(0,s.jsx)(q,{selectedProvider:a,uploadProps:h})]})}}),(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"Additional Model Info Settings"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(0,s.jsx)(N.Z.Item,{label:"Team-BYOK Model",tooltip:"Only use this model + credential combination for this team. Useful when teams want to onboard their own OpenAI keys.",className:"mb-4",children:(0,s.jsx)(A.Z,{title:_?"":"This is an enterprise-only feature. Upgrade to premium to restrict model+credential combinations to a specific team.",placement:"top",children:(0,s.jsx)(ea.Z,{checked:J,onChange:e=>{W(e),e||l.setFieldValue("team_id",void 0)},disabled:!_})})}),J&&(0,s.jsx)(N.Z.Item,{label:"Select Team",name:"team_id",className:"mb-4",tooltip:"Only keys for this team will be able to call this model.",rules:[{required:J&&!ed,message:"Please select a team."}],children:(0,s.jsx)(ei.Z,{teams:g,disabled:!_})}),ed&&(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(N.Z.Item,{label:"Model Access Group",name:"model_access_group",className:"mb-4",tooltip:"Use model access groups to give users access to select models, and add new ones to the group over time.",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:Y.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})})}),(0,s.jsx)(eV,{showAdvancedSettings:x,setShowAdvancedSettings:p,teams:g,guardrailsList:R,tagsList:V}),(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(C.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{className:"space-x-2",children:[(0,s.jsx)(E.ZP,{onClick:K,loading:F,children:"Test Connect"}),(0,s.jsx)(E.ZP,{htmlType:"submit",children:"Add Model"})]})]})]})})})]}),(0,s.jsx)(el.Z,{children:(0,s.jsx)(ek,{form:y,handleOk:()=>{y.validateFields().then(e=>{ep(e,j,y,t)}).catch(e=>{console.error("Validation failed:",e)})},accessToken:j,userRole:v})})]})]}),(0,s.jsx)(S.Z,{title:"Connection Test Results",open:w,onCancel:()=>{M(!1),P(!1)},footer:[(0,s.jsx)(E.ZP,{onClick:()=>{M(!1),P(!1)},children:"Close"},"close")],width:700,children:w&&(0,s.jsx)(ex,{formValues:l.getFieldsValue(),accessToken:j,testMode:b,modelName:l.getFieldValue("model_name")||l.getFieldValue("model"),onClose:()=>{M(!1),P(!1)},onTestComplete:()=>P(!1)},z)})]})},eJ=t(10900),eW=t(45589),eY=t(78489),e$=t(12514),eQ=t(49566),eX=t(96761),e0=t(30401),e1=t(78867),e2=t(59872),e4=e=>{let{isVisible:l,onCancel:t,onSuccess:a,modelData:r,accessToken:i,userRole:n}=e,[m]=N.Z.useForm(),[u,h]=(0,o.useState)(!1),[x,p]=(0,o.useState)([]),[g,f]=(0,o.useState)([]),[j,v]=(0,o.useState)(!1),[_,y]=(0,o.useState)(!1),[b,Z]=(0,o.useState)(null);(0,o.useEffect)(()=>{l&&r&&w()},[l,r]),(0,o.useEffect)(()=>{let e=async()=>{if(i)try{let e=await (0,c.modelAvailableCall)(i,"","",!1,null,!0,!0);p(e.data.map(e=>e.id))}catch(e){console.error("Error fetching model access groups:",e)}},t=async()=>{if(i)try{let e=await (0,eg.p)(i);f(e)}catch(e){console.error("Error fetching model info:",e)}};l&&(e(),t())},[l,i]);let w=()=>{try{var e,l,t,s,a,i;let n=null;(null===(e=r.litellm_params)||void 0===e?void 0:e.auto_router_config)&&(n="string"==typeof r.litellm_params.auto_router_config?JSON.parse(r.litellm_params.auto_router_config):r.litellm_params.auto_router_config),Z(n),m.setFieldsValue({auto_router_name:r.model_name,auto_router_default_model:(null===(l=r.litellm_params)||void 0===l?void 0:l.auto_router_default_model)||"",auto_router_embedding_model:(null===(t=r.litellm_params)||void 0===t?void 0:t.auto_router_embedding_model)||"",model_access_group:(null===(s=r.model_info)||void 0===s?void 0:s.access_groups)||[]});let o=new Set(g.map(e=>e.model_group));v(!o.has(null===(a=r.litellm_params)||void 0===a?void 0:a.auto_router_default_model)),y(!o.has(null===(i=r.litellm_params)||void 0===i?void 0:i.auto_router_embedding_model))}catch(e){console.error("Error parsing auto router config:",e),d.Z.fromBackend("Error loading auto router configuration")}},C=async()=>{try{h(!0);let e=await m.validateFields(),l={...r.litellm_params,auto_router_config:JSON.stringify(b),auto_router_default_model:e.auto_router_default_model,auto_router_embedding_model:e.auto_router_embedding_model||void 0},s={...r.model_info,access_groups:e.model_access_group||[]},n={model_name:e.auto_router_name,litellm_params:l,model_info:s};await (0,c.modelPatchUpdateCall)(i,n,r.model_info.id);let o={...r,model_name:e.auto_router_name,litellm_params:l,model_info:s};d.Z.success("Auto router configuration updated successfully"),a(o),t()}catch(e){console.error("Error updating auto router:",e),d.Z.fromBackend("Failed to update auto router configuration")}finally{h(!1)}},A=g.map(e=>({value:e.model_group,label:e.model_group}));return(0,s.jsx)(S.Z,{title:"Edit Auto Router Configuration",open:l,onCancel:t,footer:[(0,s.jsx)(E.ZP,{onClick:t,children:"Cancel"},"cancel"),(0,s.jsx)(E.ZP,{loading:u,onClick:C,children:"Save Changes"},"submit")],width:1e3,destroyOnClose:!0,children:(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)(P.x,{className:"text-gray-600",children:"Edit the auto router configuration including routing logic, default models, and access settings."}),(0,s.jsxs)(N.Z,{form:m,layout:"vertical",className:"space-y-4",children:[(0,s.jsx)(N.Z.Item,{label:"Auto Router Name",name:"auto_router_name",rules:[{required:!0,message:"Auto router name is required"}],children:(0,s.jsx)(P.o,{placeholder:"e.g., auto_router_1, smart_routing"})}),(0,s.jsx)("div",{className:"w-full",children:(0,s.jsx)(ew,{modelInfo:g,value:b,onChange:e=>{Z(e)}})}),(0,s.jsx)(N.Z.Item,{label:"Default Model",name:"auto_router_default_model",rules:[{required:!0,message:"Default model is required"}],children:(0,s.jsx)(k.default,{placeholder:"Select a default model",onChange:e=>{v("custom"===e)},options:[...A,{value:"custom",label:"Enter custom model name"}],showSearch:!0})}),(0,s.jsx)(N.Z.Item,{label:"Embedding Model",name:"auto_router_embedding_model",children:(0,s.jsx)(k.default,{placeholder:"Select an embedding model (optional)",onChange:e=>{y("custom"===e)},options:[...A,{value:"custom",label:"Enter custom model name"}],showSearch:!0,allowClear:!0})}),"Admin"===n&&(0,s.jsx)(N.Z.Item,{label:"Model Access Groups",name:"model_access_group",tooltip:"Control who can access this auto router",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:x.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})})]})]})})};let{Title:e5,Link:e6}=C.default;var e3=e=>{let{isVisible:l,onCancel:t,onAddCredential:a,existingCredential:r,setIsCredentialModalOpen:i}=e,[n]=N.Z.useForm();return console.log("existingCredential in add credentials tab: ".concat(JSON.stringify(r))),(0,s.jsx)(S.Z,{title:"Reuse Credentials",visible:l,onCancel:()=>{t(),n.resetFields()},footer:null,width:600,children:(0,s.jsxs)(N.Z,{form:n,onFinish:e=>{a(e),n.resetFields(),i(!1)},layout:"vertical",children:[(0,s.jsx)(N.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],initialValue:null==r?void 0:r.credential_name,children:(0,s.jsx)(w.o,{placeholder:"Enter a friendly name for these credentials"})}),Object.entries((null==r?void 0:r.credential_values)||{}).map(e=>{let[l,t]=e;return(0,s.jsx)(N.Z.Item,{label:l,name:l,initialValue:t,children:(0,s.jsx)(w.o,{placeholder:"Enter ".concat(l),disabled:!0})},l)}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(e6,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E.ZP,{onClick:()=>{t(),n.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(E.ZP,{htmlType:"submit",children:"Reuse Credentials"})]})]})]})})};function e8(e){var l,t,a,r,u,h,x,p,g,f,j,v,_,b,Z,w,C,M,I,F,P,L,T,R,V,D,z,q,B,U,G,H;let{modelId:K,onClose:J,modelData:$,accessToken:es,userID:ea,userRole:er,editModel:ei,setEditModalVisible:en,setSelectedModel:eo,onModelUpdate:ed,modelAccessGroups:ec}=e,[em]=N.Z.useForm(),[eh,ex]=(0,o.useState)(null),[ep,eg]=(0,o.useState)(!1),[ef,ej]=(0,o.useState)(!1),[ev,e_]=(0,o.useState)(!1),[ey,eb]=(0,o.useState)(!1),[eN,eZ]=(0,o.useState)(!1),[ew,eC]=(0,o.useState)(null),[eS,ek]=(0,o.useState)(!1),[eA,eE]=(0,o.useState)({}),[eM,eI]=(0,o.useState)(!1),[eF,eL]=(0,o.useState)([]),[eO,eV]=(0,o.useState)({}),eD=("Admin"===er||(null==$?void 0:null===(l=$.model_info)||void 0===l?void 0:l.created_by)===ea)&&(null==$?void 0:null===(t=$.model_info)||void 0===t?void 0:t.db_model),ez="Admin"===er,eq=(null==$?void 0:null===(a=$.litellm_params)||void 0===a?void 0:a.auto_router_config)!=null,eB=(null==$?void 0:null===(r=$.litellm_params)||void 0===r?void 0:r.litellm_credential_name)!=null&&(null==$?void 0:null===(u=$.litellm_params)||void 0===u?void 0:u.litellm_credential_name)!=void 0;console.log("usingExistingCredential, ",eB),console.log("modelData.litellm_params.litellm_credential_name, ",null==$?void 0:null===(h=$.litellm_params)||void 0===h?void 0:h.litellm_credential_name),console.log("tagsList, ",null===(x=$.litellm_params)||void 0===x?void 0:x.tags),(0,o.useEffect)(()=>{let e=async()=>{var e,l,t,s,a,r,i;if(!es)return;let n=await (0,c.modelInfoV1Call)(es,K);console.log("modelInfoResponse, ",n);let o=n.data[0];o&&!o.litellm_model_name&&(o={...o,litellm_model_name:null!==(i=null!==(r=null!==(a=null==o?void 0:null===(l=o.litellm_params)||void 0===l?void 0:l.litellm_model_name)&&void 0!==a?a:null==o?void 0:null===(t=o.litellm_params)||void 0===t?void 0:t.model)&&void 0!==r?r:null==o?void 0:null===(s=o.model_info)||void 0===s?void 0:s.key)&&void 0!==i?i:null}),ex(o),(null==o?void 0:null===(e=o.litellm_params)||void 0===e?void 0:e.cache_control_injection_points)&&ek(!0)},l=async()=>{if(es)try{let e=(await (0,c.getGuardrailsList)(es)).guardrails.map(e=>e.guardrail_name);eL(e)}catch(e){console.error("Failed to fetch guardrails:",e)}},t=async()=>{if(es)try{let e=await (0,c.tagListCall)(es);eV(e)}catch(e){console.error("Failed to fetch tags:",e)}};(async()=>{if(console.log("accessToken, ",es),!es||eB)return;let e=await (0,c.credentialGetCall)(es,null,K);console.log("existingCredentialResponse, ",e),eC({credential_name:e.credential_name,credential_values:e.credential_values,credential_info:e.credential_info})})(),e(),l(),t()},[es,K]);let eU=async e=>{var l;if(console.log("values, ",e),!es)return;let t={credential_name:e.credential_name,model_id:K,credential_info:{custom_llm_provider:null===(l=eh.litellm_params)||void 0===l?void 0:l.custom_llm_provider}};d.Z.info("Storing credential.."),console.log("credentialResponse, ",await (0,c.credentialCreateCall)(es,t)),d.Z.success("Credential stored successfully")},eG=async e=>{try{var l;let t;if(!es)return;eb(!0),console.log("values.model_name, ",e.model_name);let s={};try{s=e.litellm_extra_params?JSON.parse(e.litellm_extra_params):{}}catch(e){d.Z.fromBackend("Invalid JSON in LiteLLM Params"),eb(!1);return}let a={...e.litellm_params,...s,model:e.litellm_model_name,api_base:e.api_base,custom_llm_provider:e.custom_llm_provider,organization:e.organization,tpm:e.tpm,rpm:e.rpm,max_retries:e.max_retries,timeout:e.timeout,stream_timeout:e.stream_timeout,input_cost_per_token:e.input_cost/1e6,output_cost_per_token:e.output_cost/1e6,tags:e.tags};e.guardrails&&(a.guardrails=e.guardrails),e.cache_control&&(null===(l=e.cache_control_injection_points)||void 0===l?void 0:l.length)>0?a.cache_control_injection_points=e.cache_control_injection_points:delete a.cache_control_injection_points;try{t=e.model_info?JSON.parse(e.model_info):$.model_info,e.model_access_group&&(t={...t,access_groups:e.model_access_group})}catch(e){d.Z.fromBackend("Invalid JSON in Model Info");return}let r={model_name:e.model_name,litellm_params:a,model_info:t};await (0,c.modelPatchUpdateCall)(es,r,K);let i={...eh,model_name:e.model_name,litellm_model_name:e.litellm_model_name,litellm_params:a,model_info:t};ex(i),ed&&ed(i),d.Z.success("Model settings updated successfully"),e_(!1),eZ(!1)}catch(e){console.error("Error updating model:",e),d.Z.fromBackend("Failed to update model settings")}finally{eb(!1)}};if(!$)return(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(eY.Z,{icon:eJ.Z,variant:"light",onClick:J,className:"mb-4",children:"Back to Models"}),(0,s.jsx)(n.Z,{children:"Model not found"})]});let eH=async()=>{if(es)try{var e,l,t;d.Z.info("Testing connection...");let s=await (0,c.testConnectionRequest)(es,{custom_llm_provider:eh.litellm_params.custom_llm_provider,litellm_credential_name:eh.litellm_params.litellm_credential_name,model:eh.litellm_model_name},{mode:null===(e=eh.model_info)||void 0===e?void 0:e.mode},null===(l=eh.model_info)||void 0===l?void 0:l.mode);if("success"===s.status)d.Z.success("Connection test successful!");else throw Error((null==s?void 0:null===(t=s.result)||void 0===t?void 0:t.error)||(null==s?void 0:s.message)||"Unknown error")}catch(e){e instanceof Error?d.Z.error("Error testing connection: "+(0,eR.aS)(e.message,100)):d.Z.error("Error testing connection: "+String(e))}},eK=async()=>{try{if(!es)return;await (0,c.modelDeleteCall)(es,K),d.Z.success("Model deleted successfully"),ed&&ed({deleted:!0,model_info:{id:K}}),J()}catch(e){console.error("Error deleting the model:",e),d.Z.fromBackend("Failed to delete model")}},e5=async(e,l)=>{await (0,e2.vQ)(e)&&(eE(e=>({...e,[l]:!0})),setTimeout(()=>{eE(e=>({...e,[l]:!1}))},2e3))};return(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(eY.Z,{icon:eJ.Z,variant:"light",onClick:J,className:"mb-4",children:"Back to Models"}),(0,s.jsxs)(eX.Z,{children:["Public Model Name: ",W($)]}),(0,s.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,s.jsx)(n.Z,{className:"text-gray-500 font-mono",children:$.model_info.id}),(0,s.jsx)(E.ZP,{type:"text",size:"small",icon:eA["model-id"]?(0,s.jsx)(e0.Z,{size:12}):(0,s.jsx)(e1.Z,{size:12}),onClick:()=>e5($.model_info.id,"model-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eA["model-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(eY.Z,{variant:"secondary",icon:Y.Z,onClick:eH,className:"flex items-center gap-2","data-testid":"test-connection-button",children:"Test Connection"}),(0,s.jsx)(eY.Z,{icon:eW.Z,variant:"secondary",onClick:()=>ej(!0),className:"flex items-center",disabled:!ez,"data-testid":"reuse-credentials-button",children:"Re-use Credentials"}),(0,s.jsx)(eY.Z,{icon:y.Z,variant:"secondary",onClick:()=>eg(!0),className:"flex items-center text-red-500 border-red-500 hover:text-red-700",disabled:!eD,"data-testid":"delete-model-button",children:"Delete Model"})]})]}),(0,s.jsxs)(X.Z,{children:[(0,s.jsxs)(ee.Z,{className:"mb-6",children:[(0,s.jsx)(Q.Z,{children:"Overview"}),(0,s.jsx)(Q.Z,{children:"Raw JSON"})]}),(0,s.jsxs)(et.Z,{children:[(0,s.jsxs)(el.Z,{children:[(0,s.jsxs)(i.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6 mb-6",children:[(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(n.Z,{children:"Provider"}),(0,s.jsxs)("div",{className:"mt-2 flex items-center space-x-2",children:[$.provider&&(0,s.jsx)("img",{src:(0,m.dr)($.provider).logo,alt:"".concat($.provider," logo"),className:"w-4 h-4",onError:e=>{let l=e.currentTarget,t=l.parentElement;if(t&&t.contains(l))try{var s;let e=document.createElement("div");e.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=(null===(s=$.provider)||void 0===s?void 0:s.charAt(0))||"-",t.replaceChild(e,l)}catch(e){console.error("Failed to replace provider logo fallback:",e)}}}),(0,s.jsx)(eX.Z,{children:$.provider||"Not Set"})]})]}),(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(n.Z,{children:"LiteLLM Model"}),(0,s.jsx)("div",{className:"mt-2 overflow-hidden",children:(0,s.jsx)(A.Z,{title:$.litellm_model_name||"Not Set",children:(0,s.jsx)("div",{className:"break-all text-sm font-medium leading-relaxed cursor-pointer",children:$.litellm_model_name||"Not Set"})})})]}),(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(n.Z,{children:"Pricing"}),(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsxs)(n.Z,{children:["Input: $",$.input_cost,"/1M tokens"]}),(0,s.jsxs)(n.Z,{children:["Output: $",$.output_cost,"/1M tokens"]})]})]})]}),(0,s.jsxs)("div",{className:"mb-6 text-sm text-gray-500 flex items-center gap-x-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-x-2",children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Created At"," ",$.model_info.created_at?new Date($.model_info.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"Not Set"]}),(0,s.jsxs)("div",{className:"flex items-center gap-x-2",children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})}),"Created By ",$.model_info.created_by||"Not Set"]})]}),(0,s.jsxs)(e$.Z,{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(eX.Z,{children:"Model Settings"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[eq&&eD&&!eN&&(0,s.jsx)(eY.Z,{onClick:()=>eI(!0),className:"flex items-center",children:"Edit Auto Router"}),eD?!eN&&(0,s.jsx)(eY.Z,{onClick:()=>eZ(!0),className:"flex items-center",children:"Edit Settings"}):(0,s.jsx)(A.Z,{title:"Only DB models can be edited. You must be an admin or the creator of the model to edit it.",children:(0,s.jsx)(eu.Z,{})})]})]}),eh?(0,s.jsx)(N.Z,{form:em,onFinish:eG,initialValues:{model_name:eh.model_name,litellm_model_name:eh.litellm_model_name,api_base:eh.litellm_params.api_base,custom_llm_provider:eh.litellm_params.custom_llm_provider,organization:eh.litellm_params.organization,tpm:eh.litellm_params.tpm,rpm:eh.litellm_params.rpm,max_retries:eh.litellm_params.max_retries,timeout:eh.litellm_params.timeout,stream_timeout:eh.litellm_params.stream_timeout,input_cost:eh.litellm_params.input_cost_per_token?1e6*eh.litellm_params.input_cost_per_token:(null===(p=eh.model_info)||void 0===p?void 0:p.input_cost_per_token)*1e6||null,output_cost:(null===(g=eh.litellm_params)||void 0===g?void 0:g.output_cost_per_token)?1e6*eh.litellm_params.output_cost_per_token:(null===(f=eh.model_info)||void 0===f?void 0:f.output_cost_per_token)*1e6||null,cache_control:null!==(j=eh.litellm_params)&&void 0!==j&&!!j.cache_control_injection_points,cache_control_injection_points:(null===(v=eh.litellm_params)||void 0===v?void 0:v.cache_control_injection_points)||[],model_access_group:Array.isArray(null===(_=eh.model_info)||void 0===_?void 0:_.access_groups)?eh.model_info.access_groups:[],guardrails:Array.isArray(null===(b=eh.litellm_params)||void 0===b?void 0:b.guardrails)?eh.litellm_params.guardrails:[],tags:Array.isArray(null===(Z=eh.litellm_params)||void 0===Z?void 0:Z.tags)?eh.litellm_params.tags:[],litellm_extra_params:JSON.stringify(eh.litellm_params||{},null,2)},layout:"vertical",onValuesChange:()=>e_(!0),children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Model Name"}),eN?(0,s.jsx)(N.Z.Item,{name:"model_name",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter model name"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:eh.model_name})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"LiteLLM Model Name"}),eN?(0,s.jsx)(N.Z.Item,{name:"litellm_model_name",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter LiteLLM model name"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:eh.litellm_model_name})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Input Cost (per 1M tokens)"}),eN?(0,s.jsx)(N.Z.Item,{name:"input_cost",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter input cost"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null==eh?void 0:null===(w=eh.litellm_params)||void 0===w?void 0:w.input_cost_per_token)?((null===(C=eh.litellm_params)||void 0===C?void 0:C.input_cost_per_token)*1e6).toFixed(4):(null==eh?void 0:null===(M=eh.model_info)||void 0===M?void 0:M.input_cost_per_token)?(1e6*eh.model_info.input_cost_per_token).toFixed(4):null})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Output Cost (per 1M tokens)"}),eN?(0,s.jsx)(N.Z.Item,{name:"output_cost",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter output cost"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null==eh?void 0:null===(I=eh.litellm_params)||void 0===I?void 0:I.output_cost_per_token)?(1e6*eh.litellm_params.output_cost_per_token).toFixed(4):(null==eh?void 0:null===(F=eh.model_info)||void 0===F?void 0:F.output_cost_per_token)?(1e6*eh.model_info.output_cost_per_token).toFixed(4):null})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"API Base"}),eN?(0,s.jsx)(N.Z.Item,{name:"api_base",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter API base"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(P=eh.litellm_params)||void 0===P?void 0:P.api_base)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Custom LLM Provider"}),eN?(0,s.jsx)(N.Z.Item,{name:"custom_llm_provider",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter custom LLM provider"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(L=eh.litellm_params)||void 0===L?void 0:L.custom_llm_provider)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Organization"}),eN?(0,s.jsx)(N.Z.Item,{name:"organization",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter organization"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(T=eh.litellm_params)||void 0===T?void 0:T.organization)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"TPM (Tokens per Minute)"}),eN?(0,s.jsx)(N.Z.Item,{name:"tpm",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter TPM"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(R=eh.litellm_params)||void 0===R?void 0:R.tpm)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"RPM (Requests per Minute)"}),eN?(0,s.jsx)(N.Z.Item,{name:"rpm",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter RPM"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(V=eh.litellm_params)||void 0===V?void 0:V.rpm)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Max Retries"}),eN?(0,s.jsx)(N.Z.Item,{name:"max_retries",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter max retries"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(D=eh.litellm_params)||void 0===D?void 0:D.max_retries)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Timeout (seconds)"}),eN?(0,s.jsx)(N.Z.Item,{name:"timeout",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter timeout"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(z=eh.litellm_params)||void 0===z?void 0:z.timeout)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Stream Timeout (seconds)"}),eN?(0,s.jsx)(N.Z.Item,{name:"stream_timeout",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter stream timeout"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(q=eh.litellm_params)||void 0===q?void 0:q.stream_timeout)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Model Access Groups"}),eN?(0,s.jsx)(N.Z.Item,{name:"model_access_group",className:"mb-0",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:null==ec?void 0:ec.map(e=>({value:e,label:e}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(B=eh.model_info)||void 0===B?void 0:B.access_groups)?Array.isArray(eh.model_info.access_groups)?eh.model_info.access_groups.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:eh.model_info.access_groups.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800",children:e},l))}):"No groups assigned":eh.model_info.access_groups:"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)(n.Z,{className:"font-medium",children:["Guardrails",(0,s.jsx)(A.Z,{title:"Apply safety guardrails to this model to filter content or enforce policies",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(eu.Z,{style:{marginLeft:"4px"}})})})]}),eN?(0,s.jsx)(N.Z.Item,{name:"guardrails",className:"mb-0",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing guardrails or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:eF.map(e=>({value:e,label:e}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(U=eh.litellm_params)||void 0===U?void 0:U.guardrails)?Array.isArray(eh.litellm_params.guardrails)?eh.litellm_params.guardrails.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:eh.litellm_params.guardrails.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800",children:e},l))}):"No guardrails assigned":eh.litellm_params.guardrails:"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Tags"}),eN?(0,s.jsx)(N.Z.Item,{name:"tags",className:"mb-0",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing tags or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:Object.values(eO).map(e=>({value:e.name,label:e.name,title:e.description||e.name}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(G=eh.litellm_params)||void 0===G?void 0:G.tags)?Array.isArray(eh.litellm_params.tags)?eh.litellm_params.tags.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:eh.litellm_params.tags.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-purple-100 text-purple-800",children:e},l))}):"No tags assigned":eh.litellm_params.tags:"Not Set"})]}),eN?(0,s.jsx)(eT,{form:em,showCacheControl:eS,onCacheControlChange:e=>ek(e)}):(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Cache Control"}),(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(H=eh.litellm_params)||void 0===H?void 0:H.cache_control_injection_points)?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{children:"Enabled"}),(0,s.jsx)("div",{className:"mt-2",children:eh.litellm_params.cache_control_injection_points.map((e,l)=>(0,s.jsxs)("div",{className:"text-sm text-gray-600 mb-1",children:["Location: ",e.location,",",e.role&&(0,s.jsxs)("span",{children:[" Role: ",e.role]}),void 0!==e.index&&(0,s.jsxs)("span",{children:[" Index: ",e.index]})]},l))})]}):"Disabled"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Model Info"}),eN?(0,s.jsx)(N.Z.Item,{name:"model_info",className:"mb-0",children:(0,s.jsx)(O.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}',defaultValue:JSON.stringify($.model_info,null,2)})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(0,s.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(eh.model_info,null,2)})})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)(n.Z,{className:"font-medium",children:["LiteLLM Params",(0,s.jsx)(A.Z,{title:"Optional litellm params used for making a litellm.completion() call. Some params are automatically added by LiteLLM.",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/completion/input",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(eu.Z,{style:{marginLeft:"4px"}})})})]}),eN?(0,s.jsx)(N.Z.Item,{name:"litellm_extra_params",rules:[{validator:eR.Ac}],children:(0,s.jsx)(O.default.TextArea,{rows:4,placeholder:'{ "rpm": 100, "timeout": 0, "stream_timeout": 0 }'})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(0,s.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(eh.litellm_params,null,2)})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Team ID"}),(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:$.model_info.team_id||"Not Set"})]})]}),eN&&(0,s.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,s.jsx)(eY.Z,{variant:"secondary",onClick:()=>{em.resetFields(),e_(!1),eZ(!1)},disabled:ey,children:"Cancel"}),(0,s.jsx)(eY.Z,{variant:"primary",onClick:()=>em.submit(),loading:ey,children:"Save Changes"})]})]})}):(0,s.jsx)(n.Z,{children:"Loading..."})]})]}),(0,s.jsx)(el.Z,{children:(0,s.jsx)(e$.Z,{children:(0,s.jsx)("pre",{className:"bg-gray-100 p-4 rounded text-xs overflow-auto",children:JSON.stringify($,null,2)})})})]})]}),ep&&(0,s.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,s.jsxs)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,s.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,s.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,s.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:"​"}),(0,s.jsxs)("div",{className:"inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full",children:[(0,s.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,s.jsx)("div",{className:"sm:flex sm:items-start",children:(0,s.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,s.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Model"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this model?"})})]})})}),(0,s.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,s.jsx)(E.ZP,{onClick:eK,className:"ml-2",danger:!0,children:"Delete"}),(0,s.jsx)(E.ZP,{onClick:()=>eg(!1),children:"Cancel"})]})]})]})}),ef&&!eB?(0,s.jsx)(e3,{isVisible:ef,onCancel:()=>ej(!1),onAddCredential:eU,existingCredential:ew,setIsCredentialModalOpen:ej}):(0,s.jsx)(S.Z,{open:ef,onCancel:()=>ej(!1),title:"Using Existing Credential",children:(0,s.jsx)(n.Z,{children:$.litellm_params.litellm_credential_name})}),(0,s.jsx)(e4,{isVisible:eM,onCancel:()=>eI(!1),onSuccess:e=>{ex(e),ed&&ed(e)},modelData:eh||$,accessToken:es||"",userRole:er||""})]})}var e9=t(33293),e7=t(11318),le=t(8048),ll=t(41649);let lt=e=>{let{provider:l,className:t="w-4 h-4"}=e,[a,r]=(0,o.useState)(!1),{logo:i}=(0,m.dr)(l);return a||!i?(0,s.jsx)("div",{className:"".concat(t," rounded-full bg-gray-200 flex items-center justify-center text-xs"),children:(null==l?void 0:l.charAt(0))||"-"}):(0,s.jsx)("img",{src:i,alt:"".concat(l," logo"),className:t,onError:()=>r(!0)})},ls=(e,l,t,a,r,i,n,o,d,c,m)=>[{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model ID"}),accessorKey:"model_info.id",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)(A.Z,{title:t.model_info.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>a(t.model_info.id),children:t.model_info.id})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model Information"}),accessorKey:"model_name",size:250,cell:e=>{let{row:l}=e,t=l.original,a=i(l.original)||"-",r=(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Provider:"})," ",t.provider||"-"]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Public Model Name:"})," ",a]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"LiteLLM Model Name:"})," ",t.litellm_model_name||"-"]})]});return(0,s.jsx)(A.Z,{title:r,children:(0,s.jsxs)("div",{className:"flex items-start space-x-2 min-w-0 w-full max-w-[250px]",children:[(0,s.jsx)("div",{className:"flex-shrink-0 mt-0.5",children:t.provider?(0,s.jsx)(lt,{provider:t.provider}):(0,s.jsx)("div",{className:"w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",children:"-"})}),(0,s.jsxs)("div",{className:"flex flex-col min-w-0 flex-1",children:[(0,s.jsx)("div",{className:"text-xs font-medium text-gray-900 truncate max-w-[210px]",children:a}),(0,s.jsx)("div",{className:"text-xs text-gray-500 truncate mt-0.5 max-w-[210px]",children:t.litellm_model_name||"-"})]})]})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Credentials"}),accessorKey:"litellm_credential_name",size:180,cell:e=>{var l;let{row:t}=e,a=null===(l=t.original.litellm_params)||void 0===l?void 0:l.litellm_credential_name;return a?(0,s.jsx)(A.Z,{title:"Credential: ".concat(a),children:(0,s.jsxs)("div",{className:"flex items-center space-x-2 max-w-[180px]",children:[(0,s.jsx)(eW.Z,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}),(0,s.jsx)("span",{className:"text-xs truncate",title:a,children:a})]})}):(0,s.jsxs)("div",{className:"flex items-center space-x-2 max-w-[180px]",children:[(0,s.jsx)(eW.Z,{className:"w-4 h-4 text-gray-300 flex-shrink-0"}),(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"No credentials"})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Created By"}),accessorKey:"model_info.created_by",sortingFn:"datetime",size:160,cell:e=>{var l;let{row:t}=e,a=t.original,r=!(null===(l=a.model_info)||void 0===l?void 0:l.db_model),i=a.model_info.created_by,n=a.model_info.created_at?new Date(a.model_info.created_at).toLocaleDateString():null;return(0,s.jsxs)("div",{className:"flex flex-col min-w-0 max-w-[160px]",children:[(0,s.jsx)("div",{className:"text-xs font-medium text-gray-900 truncate",title:r?"Defined in config":i||"Unknown",children:r?"Defined in config":i||"Unknown"}),(0,s.jsx)("div",{className:"text-xs text-gray-500 truncate mt-0.5",title:r?"Config file":n||"Unknown date",children:r?"-":n||"Unknown date"})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Updated At"}),accessorKey:"model_info.updated_at",sortingFn:"datetime",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)("span",{className:"text-xs",children:t.model_info.updated_at?new Date(t.model_info.updated_at).toLocaleDateString():"-"})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Costs"}),accessorKey:"input_cost",size:120,cell:e=>{let{row:l}=e,t=l.original,a=t.input_cost,r=t.output_cost;return a||r?(0,s.jsx)(A.Z,{title:"Cost per 1M tokens",children:(0,s.jsxs)("div",{className:"flex flex-col min-w-0 max-w-[120px]",children:[a&&(0,s.jsxs)("div",{className:"text-xs font-medium text-gray-900 truncate",children:["In: $",a]}),r&&(0,s.jsxs)("div",{className:"text-xs text-gray-500 truncate mt-0.5",children:["Out: $",r]})]})}):(0,s.jsx)("div",{className:"max-w-[120px]",children:(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"-"})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Team ID"}),accessorKey:"model_info.team_id",cell:e=>{let{row:l}=e,t=l.original;return t.model_info.team_id?(0,s.jsx)("div",{className:"overflow-hidden",children:(0,s.jsx)(A.Z,{title:t.model_info.team_id,children:(0,s.jsxs)(eY.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>r(t.model_info.team_id),children:[t.model_info.team_id.slice(0,7),"..."]})})}):"-"}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model Access Group"}),accessorKey:"model_info.model_access_group",enableSorting:!1,cell:e=>{let{row:l}=e,t=l.original,a=t.model_info.access_groups;if(!a||0===a.length)return"-";let r=t.model_info.id,i=c.has(r),n=a.length>1,o=()=>{let e=new Set(c);i?e.delete(r):e.add(r),m(e)};return(0,s.jsxs)("div",{className:"flex items-center gap-1 overflow-hidden",children:[(0,s.jsx)(ll.Z,{size:"xs",color:"blue",className:"text-xs px-1.5 py-0.5 h-5 leading-tight flex-shrink-0",children:a[0]}),(i||!n&&2===a.length)&&a.slice(1).map((e,l)=>(0,s.jsx)(ll.Z,{size:"xs",color:"blue",className:"text-xs px-1.5 py-0.5 h-5 leading-tight flex-shrink-0",children:e},l+1)),n&&(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),o()},className:"text-xs text-blue-600 hover:text-blue-800 px-1 py-0.5 rounded hover:bg-blue-50 h-5 leading-tight flex-shrink-0 whitespace-nowrap",children:i?"−":"+".concat(a.length-1)})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Status"}),accessorKey:"model_info.db_model",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)("div",{className:"\n inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium\n ".concat(t.model_info.db_model?"bg-blue-50 text-blue-600":"bg-gray-100 text-gray-600","\n "),children:t.model_info.db_model?"DB Model":"Config Model"})}},{id:"actions",header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Actions"}),cell:t=>{var r,i;let{row:n}=t,o=n.original,c="Admin"===e||(null===(r=o.model_info)||void 0===r?void 0:r.created_by)===l,m=!(null===(i=o.model_info)||void 0===i?void 0:i.db_model);return(0,s.jsx)("div",{className:"flex items-center justify-end gap-2 pr-4",children:m?(0,s.jsx)(A.Z,{title:"Config model cannot be deleted on the dashboard. Please delete it from the config file.",children:(0,s.jsx)($.Z,{icon:y.Z,size:"sm",className:"opacity-50 cursor-not-allowed"})}):(0,s.jsx)(A.Z,{title:"Delete model",children:(0,s.jsx)($.Z,{icon:y.Z,size:"sm",onClick:()=>{c&&(a(o.model_info.id),d(!1))},className:c?"cursor-pointer hover:text-red-600":"opacity-50 cursor-not-allowed"})})})}}];var la=t(27281),lr=t(57365),li=e=>{let{selectedModelGroup:l,setSelectedModelGroup:t,availableModelGroups:a,availableModelAccessGroups:r,setSelectedModelId:d,setSelectedTeamId:c,setEditModel:m,modelData:u}=e,{userId:h,userRole:x,premiumUser:p}=(0,K.Z)(),{teams:g}=(0,e7.Z)(),[f,j]=(0,o.useState)(""),[v,_]=(0,o.useState)("current_team"),[y,b]=(0,o.useState)("personal"),[N,Z]=(0,o.useState)(!1),[w,C]=(0,o.useState)(null),[S,k]=(0,o.useState)(new Set),[A,E]=(0,o.useState)({pageIndex:0,pageSize:50}),M=(0,o.useRef)(null),I=(0,o.useMemo)(()=>u&&u.data&&0!==u.data.length?u.data.filter(e=>{var t,s,a,r,i,n;let o=""===f||e.model_name.toLowerCase().includes(f.toLowerCase()),d="all"===l||e.model_name===l||!l||"wildcard"===l&&(null===(t=e.model_name)||void 0===t?void 0:t.includes("*")),c="all"===w||(null===(s=e.model_info.access_groups)||void 0===s?void 0:s.includes(w))||!w,m=!0;if("current_team"===v){if("personal"===y)m=(null===(a=e.model_info)||void 0===a?void 0:a.direct_access)===!0;else{let l=(null===(i=e.model_info)||void 0===i?void 0:null===(r=i.access_via_team_ids)||void 0===r?void 0:r.includes(y.team_id))===!0,t=(null===(n=y.models)||void 0===n?void 0:n.some(l=>{var t,s;return null===(s=e.model_info)||void 0===s?void 0:null===(t=s.access_groups)||void 0===t?void 0:t.includes(l)}))===!0;m=l||t}}return o&&d&&c&&m}):[],[u,f,l,w,y,v]),F=(0,o.useMemo)(()=>{let e=A.pageIndex*A.pageSize,l=e+A.pageSize;return I.slice(e,l)},[I,A.pageIndex,A.pageSize]);return(0,o.useEffect)(()=>{E(e=>({...e,pageIndex:0}))},[f,l,w,y,v]),(0,s.jsx)(el.Z,{children:(0,s.jsx)(i.Z,{children:(0,s.jsx)("div",{className:"flex flex-col space-y-4",children:(0,s.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,s.jsxs)("div",{className:"border-b px-6 py-4 bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)(n.Z,{className:"text-lg font-semibold text-gray-900",children:"Current Team:"}),(0,s.jsxs)(la.Z,{className:"w-80",defaultValue:"personal",value:"personal"===y?"personal":y.team_id,onValueChange:e=>{if("personal"===e)b("personal");else{let l=null==g?void 0:g.find(l=>l.team_id===e);l&&b(l)}},children:[(0,s.jsx)(lr.Z,{value:"personal",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"Personal"})]})}),null==g?void 0:g.filter(e=>e.team_id).map(e=>(0,s.jsx)(lr.Z,{value:e.team_id,children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:e.team_alias?"".concat(e.team_alias.slice(0,30),"..."):"Team ".concat(e.team_id.slice(0,30),"...")})]})},e.team_id))]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)(n.Z,{className:"text-lg font-semibold text-gray-900",children:"View:"}),(0,s.jsxs)(la.Z,{className:"w-64",defaultValue:"current_team",value:v,onValueChange:e=>_(e),children:[(0,s.jsx)(lr.Z,{value:"current_team",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-purple-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"Current Team Models"})]})}),(0,s.jsx)(lr.Z,{value:"all",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-gray-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"All Available Models"})]})})]})]})]}),"current_team"===v&&(0,s.jsxs)("div",{className:"flex items-start gap-2 mt-3",children:[(0,s.jsx)(eu.Z,{className:"text-gray-400 mt-0.5 flex-shrink-0 text-xs"}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"personal"===y?(0,s.jsxs)("span",{children:["To access these models: Create a Virtual Key without selecting a team on the"," ",(0,s.jsx)("a",{href:"/public?login=success&page=api-keys",className:"text-gray-600 hover:text-gray-800 underline",children:"Virtual Keys page"})]}):(0,s.jsxs)("span",{children:['To access these models: Create a Virtual Key and select Team as "',"string"!=typeof y?y.team_alias||y.team_id:"",'" on the'," ",(0,s.jsx)("a",{href:"/public?login=success&page=api-keys",className:"text-gray-600 hover:text-gray-800 underline",children:"Virtual Keys page"})]})})]})]}),(0,s.jsx)("div",{className:"border-b px-6 py-4",children:(0,s.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,s.jsxs)("div",{className:"relative w-64",children:[(0,s.jsx)("input",{type:"text",placeholder:"Search model names...",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:f,onChange:e=>j(e.target.value)}),(0,s.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]}),(0,s.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 ".concat(N?"bg-gray-100":""),onClick:()=>Z(!N),children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),"Filters"]}),(0,s.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",onClick:()=>{j(""),t("all"),C(null),b("personal"),_("current_team"),E({pageIndex:0,pageSize:50})},children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Reset Filters"]})]}),N&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,s.jsx)("div",{className:"w-64",children:(0,s.jsxs)(la.Z,{value:null!=l?l:"all",onValueChange:e=>t("all"===e?"all":e),placeholder:"Filter by Public Model Name",children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Models"}),(0,s.jsx)(lr.Z,{value:"wildcard",children:"Wildcard Models (*)"}),a.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,children:e},l))]})}),(0,s.jsx)("div",{className:"w-64",children:(0,s.jsxs)(la.Z,{value:null!=w?w:"all",onValueChange:e=>C("all"===e?null:e),placeholder:"Filter by Model Access Group",children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Model Access Groups"}),r.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,children:e},l))]})})]}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("span",{className:"text-sm text-gray-700",children:I.length>0?"Showing ".concat(A.pageIndex*A.pageSize+1," - ").concat(Math.min((A.pageIndex+1)*A.pageSize,I.length)," of ").concat(I.length," results"):"Showing 0 results"}),I.length>A.pageSize&&(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("button",{onClick:()=>E(e=>({...e,pageIndex:e.pageIndex-1})),disabled:0===A.pageIndex,className:"px-3 py-1 text-sm border rounded-md ".concat(0===A.pageIndex?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Previous"}),(0,s.jsx)("button",{onClick:()=>E(e=>({...e,pageIndex:e.pageIndex+1})),disabled:A.pageIndex>=Math.ceil(I.length/A.pageSize)-1,className:"px-3 py-1 text-sm border rounded-md ".concat(A.pageIndex>=Math.ceil(I.length/A.pageSize)-1?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Next"})]})]})]})}),(0,s.jsx)(le.C,{columns:ls(x,h,p,d,c,W,()=>{},()=>{},m,S,k),data:F,isLoading:!1,table:M})]})})})})},ln=t(75105),lo=t(40278),ld=t(97765),lc=t(21626),lm=t(97214),lu=t(28241),lh=t(58834),lx=t(69552),lp=t(71876),lg=t(39789),lf=t(79326),lj=t(2356),lv=t(59664),l_=e=>{let{modelMetrics:l,modelMetricsCategories:t,customTooltip:a,premiumUser:r}=e;return(0,s.jsx)(lv.Z,{title:"Time to First token (s)",className:"h-72",data:l,index:"date",showLegend:!1,categories:t,colors:["indigo","rose"],connectNulls:!0,customTooltip:a})},ly=e=>{let{setSelectedAPIKey:l,keys:t,teams:a,setSelectedCustomer:r,allEndUsers:i}=e,{premiumUser:d}=(0,K.Z)(),[c,m]=(0,o.useState)(null);return(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"mb-1",children:"Select API Key Name"}),d?(0,s.jsxs)("div",{children:[(0,s.jsxs)(la.Z,{defaultValue:"all-keys",children:[(0,s.jsx)(lr.Z,{value:"all-keys",onClick:()=>{l(null)},children:"All Keys"},"all-keys"),null==t?void 0:t.map((e,t)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,s.jsx)(lr.Z,{value:String(t),onClick:()=>{l(e)},children:e.key_alias},t):null)]}),(0,s.jsx)(n.Z,{className:"mt-1",children:"Select Customer Name"}),(0,s.jsxs)(la.Z,{defaultValue:"all-customers",children:[(0,s.jsx)(lr.Z,{value:"all-customers",onClick:()=>{r(null)},children:"All Customers"},"all-customers"),null==i?void 0:i.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,onClick:()=>{r(e)},children:e},l))]}),(0,s.jsx)(n.Z,{className:"mt-1",children:"Select Team"}),(0,s.jsxs)(la.Z,{className:"w-64 relative z-50",defaultValue:"all",value:null!=c?c:"all",onValueChange:e=>m("all"===e?null:e),children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Teams"}),null==a?void 0:a.filter(e=>e.team_id).map(e=>(0,s.jsx)(lr.Z,{value:e.team_id,children:e.team_alias?"".concat(e.team_alias," (").concat(e.team_id.slice(0,8),"...)"):"Team ".concat(e.team_id.slice(0,8),"...")},e.team_id))]})]}):(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"mt-1",children:"Select Team"}),(0,s.jsxs)(la.Z,{className:"w-64 relative z-50",defaultValue:"all",value:null!=c?c:"all",onValueChange:e=>m("all"===e?null:e),children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Teams"}),null==a?void 0:a.filter(e=>e.team_id).map(e=>(0,s.jsx)(lr.Z,{value:e.team_id,children:e.team_alias?"".concat(e.team_alias," (").concat(e.team_id.slice(0,8),"...)"):"Team ".concat(e.team_id.slice(0,8),"...")},e.team_id))]})]})]})},lb=e=>{let{dateValue:l,setDateValue:t,selectedModelGroup:a,availableModelGroups:d,setShowAdvancedFilters:m,modelMetrics:u,modelMetricsCategories:h,streamingModelMetrics:x,streamingModelMetricsCategories:p,customTooltip:g,slowResponsesData:f,modelExceptions:j,globalExceptionData:v,allExceptions:_,globalExceptionPerDeployment:y,setSelectedAPIKey:b,keys:N,setSelectedCustomer:Z,teams:w,allEndUsers:C,selectedAPIKey:S,selectedCustomer:k,selectedTeam:A,setSelectedModelGroup:E,setModelMetrics:M,setModelMetricsCategories:I,setStreamingModelMetrics:F,setStreamingModelMetricsCategories:P,setSlowResponsesData:L,setModelExceptions:T,setAllExceptions:R,setGlobalExceptionData:O,setGlobalExceptionPerDeployment:V}=e,{accessToken:D,userId:z,userRole:q,premiumUser:B}=(0,K.Z)();(0,o.useEffect)(()=>{U(a,l.from,l.to)},[S,k,A]);let U=async(e,l,t)=>{if(console.log("Updating model metrics for group:",e),!D||!z||!q||!l||!t)return;console.log("inside updateModelMetrics - startTime:",l,"endTime:",t),E(e);let s=null==S?void 0:S.token;void 0===s&&(s=null);let a=k;void 0===a&&(a=null);try{let r=await (0,c.modelMetricsCall)(D,z,q,e,l.toISOString(),t.toISOString(),s,a);console.log("Model metrics response:",r),M(r.data),I(r.all_api_bases);let i=await (0,c.streamingModelMetricsCall)(D,e,l.toISOString(),t.toISOString());F(i.data),P(i.all_api_bases);let n=await (0,c.modelExceptionsCall)(D,z,q,e,l.toISOString(),t.toISOString(),s,a);console.log("Model exceptions response:",n),T(n.data),R(n.exception_types);let o=await (0,c.modelMetricsSlowResponsesCall)(D,z,q,e,l.toISOString(),t.toISOString(),s,a);if(console.log("slowResponses:",o),L(o),e){let s=await (0,c.adminGlobalActivityExceptions)(D,null==l?void 0:l.toISOString().split("T")[0],null==t?void 0:t.toISOString().split("T")[0],e);O(s);let a=await (0,c.adminGlobalActivityExceptionsPerDeployment)(D,null==l?void 0:l.toISOString().split("T")[0],null==t?void 0:t.toISOString().split("T")[0],e);V(a)}}catch(e){console.error("Failed to fetch model metrics",e)}};return(0,s.jsxs)(el.Z,{children:[(0,s.jsx)("div",{className:"mb-4 rounded-md border border-red-500 bg-red-50 p-4",children:(0,s.jsx)(n.Z,{className:"font-semibold text-red-700",children:"This page is deprecated and will be removed in the future. Some functionality may not work as expected."})}),(0,s.jsxs)(i.Z,{numItems:4,className:"mt-2 mb-2",children:[(0,s.jsx)(r.Z,{children:(0,s.jsx)(lg.Z,{value:l,className:"mr-2",onValueChange:e=>{t(e),U(a,e.from,e.to)}})}),(0,s.jsxs)(r.Z,{className:"ml-2",children:[(0,s.jsx)(n.Z,{children:"Select Model Group"}),(0,s.jsx)(la.Z,{defaultValue:a||d[0],value:a||d[0],children:d.map((e,t)=>(0,s.jsx)(lr.Z,{value:e,onClick:()=>U(e,l.from,l.to),children:e},t))})]}),(0,s.jsx)(r.Z,{children:(0,s.jsx)(lf.Z,{trigger:"click",content:(0,s.jsx)(ly,{allEndUsers:C,keys:N,setSelectedAPIKey:b,setSelectedCustomer:Z,teams:w}),overlayStyle:{width:"20vw"},children:(0,s.jsx)(eY.Z,{icon:lj.Z,size:"md",variant:"secondary",className:"mt-4 ml-2",style:{border:"none"},onClick:()=>m(!0)})})})]}),(0,s.jsxs)(i.Z,{numItems:2,children:[(0,s.jsx)(r.Z,{children:(0,s.jsx)(e$.Z,{className:"mr-2 max-h-[400px] min-h-[400px]",children:(0,s.jsxs)(X.Z,{children:[(0,s.jsxs)(ee.Z,{variant:"line",defaultValue:"1",children:[(0,s.jsx)(Q.Z,{value:"1",children:"Avg. Latency per Token"}),(0,s.jsx)(Q.Z,{value:"2",children:"Time to first token"})]}),(0,s.jsxs)(et.Z,{children:[(0,s.jsxs)(el.Z,{children:[(0,s.jsx)("p",{className:"text-gray-500 italic",children:" (seconds/token)"}),(0,s.jsx)(n.Z,{className:"text-gray-500 italic mt-1 mb-1",children:"average Latency for successfull requests divided by the total tokens"}),u&&h&&(0,s.jsx)(ln.Z,{title:"Model Latency",className:"h-72",data:u,showLegend:!1,index:"date",categories:h,connectNulls:!0,customTooltip:g})]}),(0,s.jsx)(el.Z,{children:(0,s.jsx)(l_,{modelMetrics:x,modelMetricsCategories:p,customTooltip:g,premiumUser:B})})]})]})})}),(0,s.jsx)(r.Z,{children:(0,s.jsx)(e$.Z,{className:"ml-2 max-h-[400px] min-h-[400px] overflow-y-auto",children:(0,s.jsxs)(lc.Z,{children:[(0,s.jsx)(lh.Z,{children:(0,s.jsxs)(lp.Z,{children:[(0,s.jsx)(lx.Z,{children:"Deployment"}),(0,s.jsx)(lx.Z,{children:"Success Responses"}),(0,s.jsxs)(lx.Z,{children:["Slow Responses ",(0,s.jsx)("p",{children:"Success Responses taking 600+s"})]})]})}),(0,s.jsx)(lm.Z,{children:f.map((e,l)=>(0,s.jsxs)(lp.Z,{children:[(0,s.jsx)(lu.Z,{children:e.api_base}),(0,s.jsx)(lu.Z,{children:e.total_count}),(0,s.jsx)(lu.Z,{children:e.slow_count})]},l))})]})})})]}),(0,s.jsx)(i.Z,{numItems:1,className:"gap-2 w-full mt-2",children:(0,s.jsxs)(e$.Z,{children:[(0,s.jsxs)(eX.Z,{children:["All Exceptions for ",a]}),(0,s.jsx)(lo.Z,{className:"h-60",data:j,index:"model",categories:_,stack:!0,yAxisWidth:30})]})}),(0,s.jsxs)(i.Z,{numItems:1,className:"gap-2 w-full mt-2",children:[(0,s.jsxs)(e$.Z,{children:[(0,s.jsxs)(eX.Z,{children:["All Up Rate Limit Errors (429) for ",a]}),(0,s.jsxs)(i.Z,{numItems:1,children:[(0,s.jsxs)(r.Z,{children:[(0,s.jsxs)(ld.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",v.sum_num_rate_limit_exceptions]}),(0,s.jsx)(lo.Z,{className:"h-40",data:v.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]}),(0,s.jsx)(r.Z,{})]})]}),B?(0,s.jsx)(s.Fragment,{children:y.map((e,l)=>(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(eX.Z,{children:e.api_base?e.api_base:"Unknown API Base"}),(0,s.jsx)(i.Z,{numItems:1,children:(0,s.jsxs)(r.Z,{children:[(0,s.jsxs)(ld.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors (429) ",e.sum_num_rate_limit_exceptions]}),(0,s.jsx)(lo.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]},l))}):(0,s.jsx)(s.Fragment,{children:y&&y.length>0&&y.slice(0,1).map((e,l)=>(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(eX.Z,{children:"✨ Rate Limit Errors by Deployment"}),(0,s.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to see exceptions for all deployments"}),(0,s.jsx)(eY.Z,{variant:"primary",className:"mb-2",children:(0,s.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})}),(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(eX.Z,{children:e.api_base}),(0,s.jsx)(i.Z,{numItems:1,children:(0,s.jsxs)(r.Z,{children:[(0,s.jsxs)(ld.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",e.sum_num_rate_limit_exceptions]}),(0,s.jsx)(lo.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]})]},l))})]})]})};let lN={"BadRequestError (400)":"BadRequestErrorRetries","AuthenticationError (401)":"AuthenticationErrorRetries","TimeoutError (408)":"TimeoutErrorRetries","RateLimitError (429)":"RateLimitErrorRetries","ContentPolicyViolationError (400)":"ContentPolicyViolationErrorRetries","InternalServerError (500)":"InternalServerErrorRetries"};var lZ=e=>{let{selectedModelGroup:l,setSelectedModelGroup:t,availableModelGroups:a,globalRetryPolicy:r,setGlobalRetryPolicy:i,defaultRetry:o,modelGroupRetryPolicy:d,setModelGroupRetryPolicy:c,handleSaveRetrySettings:m}=e;return(0,s.jsxs)(el.Z,{children:[(0,s.jsx)("div",{className:"flex items-center gap-4 mb-6",children:(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(n.Z,{children:"Retry Policy Scope:"}),(0,s.jsxs)(la.Z,{className:"ml-2 w-48",defaultValue:"global",value:"global"===l?"global":l||a[0],onValueChange:e=>t(e),children:[(0,s.jsx)(lr.Z,{value:"global",children:"Global Default"}),a.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,onClick:()=>t(e),children:e},l))]})]})}),"global"===l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eX.Z,{children:"Global Retry Policy"}),(0,s.jsx)(n.Z,{className:"mb-6",children:"Default retry settings applied to all model groups unless overridden"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(eX.Z,{children:["Retry Policy for ",l]}),(0,s.jsx)(n.Z,{className:"mb-6",children:"Model-specific retry settings. Falls back to global defaults if not set."})]}),lN&&(0,s.jsx)("table",{children:(0,s.jsx)("tbody",{children:Object.entries(lN).map((e,t)=>{var a,m,u,h;let x,[p,g]=e;if("global"===l)x=null!==(a=null==r?void 0:r[g])&&void 0!==a?a:o;else{let e=null==d?void 0:null===(m=d[l])||void 0===m?void 0:m[g];x=null!=e?e:null!==(u=null==r?void 0:r[g])&&void 0!==u?u:o}return(0,s.jsxs)("tr",{className:"flex justify-between items-center mt-2",children:[(0,s.jsxs)("td",{children:[(0,s.jsx)(n.Z,{children:p}),"global"!==l&&(0,s.jsxs)(n.Z,{className:"text-xs text-gray-500 ml-2",children:["(Global: ",null!==(h=null==r?void 0:r[g])&&void 0!==h?h:o,")"]})]}),(0,s.jsx)("td",{children:(0,s.jsx)(ej.Z,{className:"ml-5",value:x,min:0,step:1,onChange:e=>{"global"===l?i(l=>null==e?l:{...null!=l?l:{},[g]:e}):c(t=>{var s;let a=null!==(s=null==t?void 0:t[l])&&void 0!==s?s:{};return{...null!=t?t:{},[l]:{...a,[g]:e}}})}})})]},t)})})}),(0,s.jsx)(eY.Z,{className:"mt-6 mr-8",onClick:m,children:"Save"})]})},lw=t(58760),lC=t(867),lS=t(3810),lk=t(89245),lA=t(5540),lE=t(8881);let{Text:lM}=C.default;var lI=e=>{let{accessToken:l,onReloadSuccess:t,buttonText:a="Reload Price Data",showIcon:r=!0,size:i="middle",type:n="primary",className:m=""}=e,[u,h]=(0,o.useState)(!1),[x,p]=(0,o.useState)(!1),[g,f]=(0,o.useState)(!1),[j,v]=(0,o.useState)(!1),[_,y]=(0,o.useState)(6),[b,N]=(0,o.useState)(null),[Z,w]=(0,o.useState)(!1);(0,o.useEffect)(()=>{C();let e=setInterval(()=>{C()},3e4);return()=>clearInterval(e)},[l]);let C=async()=>{if(l){w(!0);try{console.log("Fetching reload status...");let e=await (0,c.getModelCostMapReloadStatus)(l);console.log("Received status:",e),N(e)}catch(e){console.error("Failed to fetch reload status:",e),N({scheduled:!1,interval_hours:null,last_run:null,next_run:null})}finally{w(!1)}}},k=async()=>{if(!l){d.Z.fromBackend("No access token available");return}h(!0);try{let e=await (0,c.reloadModelCostMap)(l);"success"===e.status?(d.Z.success("Price data reloaded successfully! ".concat(e.models_count||0," models updated.")),null==t||t(),await C()):d.Z.fromBackend("Failed to reload price data")}catch(e){console.error("Error reloading price data:",e),d.Z.fromBackend("Failed to reload price data. Please try again.")}finally{h(!1)}},A=async()=>{if(!l){d.Z.fromBackend("No access token available");return}if(_<=0){d.Z.fromBackend("Hours must be greater than 0");return}p(!0);try{let e=await (0,c.scheduleModelCostMapReload)(l,_);"success"===e.status?(d.Z.success("Periodic reload scheduled for every ".concat(_," hours")),v(!1),await C()):d.Z.fromBackend("Failed to schedule periodic reload")}catch(e){console.error("Error scheduling reload:",e),d.Z.fromBackend("Failed to schedule periodic reload. Please try again.")}finally{p(!1)}},M=async()=>{if(!l){d.Z.fromBackend("No access token available");return}f(!0);try{let e=await (0,c.cancelModelCostMapReload)(l);"success"===e.status?(d.Z.success("Periodic reload cancelled successfully"),await C()):d.Z.fromBackend("Failed to cancel periodic reload")}catch(e){console.error("Error cancelling reload:",e),d.Z.fromBackend("Failed to cancel periodic reload. Please try again.")}finally{f(!1)}},I=e=>{if(!e)return"Never";try{return new Date(e).toLocaleString()}catch(l){return e}};return(0,s.jsxs)("div",{className:m,children:[(0,s.jsxs)(lw.Z,{direction:"horizontal",size:"middle",style:{marginBottom:16},children:[(0,s.jsx)(lC.Z,{title:"Hard Refresh Price Data",description:"This will immediately fetch the latest pricing information from the remote source. Continue?",onConfirm:k,okText:"Yes",cancelText:"No",okButtonProps:{style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem",transition:"all 0.2s ease-in-out"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#4f46e5"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#6366f1"}},children:(0,s.jsx)(E.ZP,{type:n,size:i,loading:u,icon:r?(0,s.jsx)(lk.Z,{}):void 0,style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem",transition:"all 0.2s ease-in-out"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#4f46e5"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#6366f1"},children:a})}),(null==b?void 0:b.scheduled)?(0,s.jsx)(E.ZP,{type:"default",size:i,danger:!0,icon:(0,s.jsx)(lE.Z,{}),loading:g,onClick:M,style:{borderColor:"#ff4d4f",color:"#ff4d4f",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem"},children:"Cancel Periodic Reload"}):(0,s.jsx)(E.ZP,{type:"default",size:i,icon:(0,s.jsx)(lA.Z,{}),onClick:()=>v(!0),style:{borderColor:"#d9d9d9",color:"#6366f1",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem"},children:"Set Up Periodic Reload"})]}),b&&(0,s.jsx)(er.Z,{size:"small",style:{backgroundColor:"#f8f9fa",border:"1px solid #e9ecef",borderRadius:8},children:(0,s.jsxs)(lw.Z,{direction:"vertical",size:"small",style:{width:"100%"},children:[b.scheduled?(0,s.jsx)("div",{children:(0,s.jsxs)(lS.Z,{color:"green",icon:(0,s.jsx)(lA.Z,{}),children:["Scheduled every ",b.interval_hours," hours"]})}):(0,s.jsx)(lM,{type:"secondary",children:"No periodic reload scheduled"}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(lM,{type:"secondary",style:{fontSize:"12px"},children:"Last run:"}),(0,s.jsx)(lM,{style:{fontSize:"12px"},children:I(b.last_run)})]}),b.scheduled&&(0,s.jsxs)(s.Fragment,{children:[b.next_run&&(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(lM,{type:"secondary",style:{fontSize:"12px"},children:"Next run:"}),(0,s.jsx)(lM,{style:{fontSize:"12px"},children:I(b.next_run)})]}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(lM,{type:"secondary",style:{fontSize:"12px"},children:"Status:"}),(0,s.jsx)(lS.Z,{color:(null==b?void 0:b.scheduled)?b.last_run?"success":"processing":"default",children:(null==b?void 0:b.scheduled)?b.last_run?"Active":"Ready":"Not scheduled"})]})]})]})}),(0,s.jsxs)(S.Z,{title:"Set Up Periodic Reload",open:j,onOk:A,onCancel:()=>v(!1),confirmLoading:x,okText:"Schedule",cancelText:"Cancel",okButtonProps:{style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white"}},children:[(0,s.jsx)("div",{style:{marginBottom:16},children:(0,s.jsx)(lM,{children:"Set up automatic reload of price data every:"})}),(0,s.jsx)("div",{style:{marginBottom:16},children:(0,s.jsx)(ej.Z,{min:1,max:168,value:_,onChange:e=>y(e||6),addonAfter:"hours",style:{width:"100%"}})}),(0,s.jsx)("div",{children:(0,s.jsxs)(lM,{type:"secondary",children:["This will automatically fetch the latest pricing data from the remote source every ",_," hours."]})})]})]})},lF=e=>{let{setModelMap:l}=e,{accessToken:t}=(0,K.Z)();return(0,s.jsx)(el.Z,{children:(0,s.jsxs)("div",{className:"p-6",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)(eX.Z,{children:"Price Data Management"}),(0,s.jsx)(n.Z,{className:"text-tremor-content",children:"Manage model pricing data and configure automatic reload schedules"})]}),(0,s.jsx)(lI,{accessToken:t,onReloadSuccess:()=>{(async()=>{l(await (0,c.modelCostMap)(t))})()},buttonText:"Reload Price Data",size:"middle",type:"primary",className:"w-full"})]})})},lP=t(4156),lL=t(15731),lT=t(91126);let lR=(e,l,t,a,r,i,n,o,d,c,m)=>[{header:()=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(lP.Z,{checked:t,indeterminate:l.length>0&&!t,onChange:e=>r(e.target.checked),onClick:e=>e.stopPropagation()}),(0,s.jsx)("span",{children:"Model ID"})]}),accessorKey:"model_info.id",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:t}=e,r=t.original,i=r.model_name,n=l.includes(i);return(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(lP.Z,{checked:n,onChange:e=>a(i,e.target.checked),onClick:e=>e.stopPropagation()}),(0,s.jsx)(A.Z,{title:r.model_info.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>m&&m(r.model_info.id),children:r.model_info.id})})]})}},{header:"Model Name",accessorKey:"model_name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,t=l.original,a=o(t)||t.model_name;return(0,s.jsx)("div",{className:"font-medium text-sm",children:(0,s.jsx)(A.Z,{title:a,children:(0,s.jsx)("div",{className:"truncate max-w-[200px]",children:a})})})}},{header:"Health Status",accessorKey:"health_status",enableSorting:!0,sortingFn:(e,l,t)=>{var s,a;let r=e.getValue("health_status")||"unknown",i=l.getValue("health_status")||"unknown",n={healthy:0,checking:1,unknown:2,unhealthy:3};return(null!==(s=n[r])&&void 0!==s?s:4)-(null!==(a=n[i])&&void 0!==a?a:4)},cell:l=>{var t;let{row:a}=l,r=a.original,i={status:r.health_status,loading:r.health_loading,error:r.health_error};if(i.loading)return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse"}),(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse",style:{animationDelay:"0.2s"}}),(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse",style:{animationDelay:"0.4s"}})]}),(0,s.jsx)(eb.x,{className:"text-gray-600 text-sm",children:"Checking..."})]});let o=r.model_name,d="healthy"===i.status&&(null===(t=e[o])||void 0===t?void 0:t.successResponse);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[n(i.status),d&&c&&(0,s.jsx)(A.Z,{title:"View response details",placement:"top",children:(0,s.jsx)("button",{onClick:()=>{var l;return c(o,null===(l=e[o])||void 0===l?void 0:l.successResponse)},className:"p-1 text-green-600 hover:text-green-800 hover:bg-green-50 rounded cursor-pointer transition-colors",children:(0,s.jsx)(lL.Z,{className:"h-4 w-4"})})})]})}},{header:"Error Details",accessorKey:"health_error",enableSorting:!1,cell:l=>{let{row:t}=l,a=t.original.model_name,r=e[a];if(!(null==r?void 0:r.error))return(0,s.jsx)(eb.x,{className:"text-gray-400 text-sm",children:"No errors"});let i=r.error,n=r.fullError||r.error;return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"max-w-[200px]",children:(0,s.jsx)(A.Z,{title:i,placement:"top",children:(0,s.jsx)(eb.x,{className:"text-red-600 text-sm truncate",children:i})})}),d&&n!==i&&(0,s.jsx)(A.Z,{title:"View full error details",placement:"top",children:(0,s.jsx)("button",{onClick:()=>d(a,i,n),className:"p-1 text-red-600 hover:text-red-800 hover:bg-red-50 rounded cursor-pointer transition-colors",children:(0,s.jsx)(lL.Z,{className:"h-4 w-4"})})})]})}},{header:"Last Check",accessorKey:"last_check",enableSorting:!0,sortingFn:(e,l,t)=>{let s=e.getValue("last_check")||"Never checked",a=l.getValue("last_check")||"Never checked";if("Never checked"===s&&"Never checked"===a)return 0;if("Never checked"===s)return 1;if("Never checked"===a)return -1;if("Check in progress..."===s&&"Check in progress..."===a)return 0;if("Check in progress..."===s)return -1;if("Check in progress..."===a)return 1;let r=new Date(s),i=new Date(a);return isNaN(r.getTime())&&isNaN(i.getTime())?0:isNaN(r.getTime())?1:isNaN(i.getTime())?-1:i.getTime()-r.getTime()},cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)(eb.x,{className:"text-gray-600 text-sm",children:t.health_loading?"Check in progress...":t.last_check})}},{header:"Last Success",accessorKey:"last_success",enableSorting:!0,sortingFn:(e,l,t)=>{let s=e.getValue("last_success")||"Never succeeded",a=l.getValue("last_success")||"Never succeeded";if("Never succeeded"===s&&"Never succeeded"===a)return 0;if("Never succeeded"===s)return 1;if("Never succeeded"===a)return -1;if("None"===s&&"None"===a)return 0;if("None"===s)return 1;if("None"===a)return -1;let r=new Date(s),i=new Date(a);return isNaN(r.getTime())&&isNaN(i.getTime())?0:isNaN(r.getTime())?1:isNaN(i.getTime())?-1:i.getTime()-r.getTime()},cell:l=>{let{row:t}=l,a=e[t.original.model_name],r=(null==a?void 0:a.lastSuccess)||"None";return(0,s.jsx)(eb.x,{className:"text-gray-600 text-sm",children:r})}},{header:"Actions",id:"actions",cell:e=>{let{row:l}=e,t=l.original,a=t.model_name,r=t.health_status&&"none"!==t.health_status,n=t.health_loading?"Checking...":r?"Re-run Health Check":"Run Health Check";return(0,s.jsx)(A.Z,{title:n,placement:"top",children:(0,s.jsx)("button",{className:"p-2 rounded-md transition-colors ".concat(t.health_loading?"text-gray-400 cursor-not-allowed bg-gray-100":"text-indigo-600 hover:text-indigo-700 hover:bg-indigo-50"),onClick:()=>{t.health_loading||i(a)},disabled:t.health_loading,children:t.health_loading?(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse"}),(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse",style:{animationDelay:"0.2s"}}),(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse",style:{animationDelay:"0.4s"}})]}):r?(0,s.jsx)(Y.Z,{className:"h-4 w-4"}):(0,s.jsx)(lT.Z,{className:"h-4 w-4"})})})},enableSorting:!1}],lO=[{pattern:/Missing .* API Key/i,replacement:"Missing API Key"},{pattern:/Connection timeout/i,replacement:"Connection timeout"},{pattern:/Network.*not.*ok/i,replacement:"Network connection failed"},{pattern:/403.*Forbidden/i,replacement:"Access forbidden - check API key permissions"},{pattern:/401.*Unauthorized/i,replacement:"Unauthorized - invalid API key"},{pattern:/429.*rate limit/i,replacement:"Rate limit exceeded"},{pattern:/500.*Internal Server Error/i,replacement:"Provider internal server error"},{pattern:/litellm\.AuthenticationError/i,replacement:"Authentication failed"},{pattern:/litellm\.RateLimitError/i,replacement:"Rate limit exceeded"},{pattern:/litellm\.APIError/i,replacement:"API error"}];var lV=e=>{let{accessToken:l,modelData:t,all_models_on_proxy:a,getDisplayModelName:r,setSelectedModelId:i}=e,[d,m]=(0,o.useState)({}),[u,h]=(0,o.useState)([]),[x,p]=(0,o.useState)(!1),[g,f]=(0,o.useState)(!1),[j,v]=(0,o.useState)(null),[_,y]=(0,o.useState)(!1),[b,N]=(0,o.useState)(null),Z=(0,o.useRef)(null);(0,o.useEffect)(()=>{l&&(null==t?void 0:t.data)&&(async()=>{let e={};t.data.forEach(l=>{e[l.model_name]={status:"none",lastCheck:"None",lastSuccess:"None",loading:!1,error:void 0,fullError:void 0,successResponse:void 0}});try{let s=await (0,c.latestHealthChecksCall)(l);s&&s.latest_health_checks&&"object"==typeof s.latest_health_checks&&Object.entries(s.latest_health_checks).forEach(l=>{let[s,a]=l;if(!a)return;let r=null,i=t.data.find(e=>e.model_name===s);if(i)r=i.model_name;else{let e=t.data.find(e=>e.model_info&&e.model_info.id===s);if(e)r=e.model_name;else if(a.model_name){let e=t.data.find(e=>e.model_name===a.model_name);e&&(r=e.model_name)}}if(r){let l=a.error_message||void 0;e[r]={status:a.status||"unknown",lastCheck:a.checked_at?new Date(a.checked_at).toLocaleString():"None",lastSuccess:"healthy"===a.status&&a.checked_at?new Date(a.checked_at).toLocaleString():"None",loading:!1,error:l?w(l):void 0,fullError:l,successResponse:"healthy"===a.status?a:void 0}}})}catch(e){console.warn("Failed to load health check history (using default states):",e)}m(e)})()},[l,t]);let w=e=>{var l;if(!e)return"Health check failed";let t="string"==typeof e?e:JSON.stringify(e),s=t.match(/(\w+Error):\s*(\d{3})/i);if(s)return"".concat(s[1],": ").concat(s[2]);let a=t.match(/(AuthenticationError|RateLimitError|BadRequestError|InternalServerError|TimeoutError|NotFoundError|ForbiddenError|ServiceUnavailableError|BadGatewayError|ContentPolicyViolationError|\w+Error)/i),r=t.match(/\b(400|401|403|404|408|429|500|502|503|504)\b/);if(a&&r)return"".concat(a[1],": ").concat(r[1]);if(r){let e=r[1];return"".concat({400:"BadRequestError",401:"AuthenticationError",403:"ForbiddenError",404:"NotFoundError",408:"TimeoutError",429:"RateLimitError",500:"InternalServerError",502:"BadGatewayError",503:"ServiceUnavailableError",504:"GatewayTimeoutError"}[e],": ").concat(e)}if(a){let e=a[1],l={AuthenticationError:"401",RateLimitError:"429",BadRequestError:"400",InternalServerError:"500",TimeoutError:"408",NotFoundError:"404",ForbiddenError:"403",ServiceUnavailableError:"503",BadGatewayError:"502",GatewayTimeoutError:"504",ContentPolicyViolationError:"400"}[e];return l?"".concat(e,": ").concat(l):e}for(let{pattern:e,replacement:l}of lO)if(e.test(t))return l;if(/missing.*api.*key|invalid.*key|unauthorized/i.test(t))return"AuthenticationError: 401";if(/rate.*limit|too.*many.*requests/i.test(t))return"RateLimitError: 429";if(/timeout|timed.*out/i.test(t))return"TimeoutError: 408";if(/not.*found/i.test(t))return"NotFoundError: 404";if(/forbidden|access.*denied/i.test(t))return"ForbiddenError: 403";if(/internal.*server.*error/i.test(t))return"InternalServerError: 500";let i=t.replace(/[\n\r]+/g," ").replace(/\s+/g," ").trim(),n=null===(l=i.split(/[.!?]/)[0])||void 0===l?void 0:l.trim();return n&&n.length>0?n.length>100?n.substring(0,97)+"...":n:i.length>100?i.substring(0,97)+"...":i},C=async e=>{if(l){m(l=>({...l,[e]:{...l[e],loading:!0,status:"checking"}}));try{var s,a;let r=await (0,c.individualModelHealthCheckCall)(l,e),i=new Date().toLocaleString();if(r.unhealthy_count>0&&r.unhealthy_endpoints&&r.unhealthy_endpoints.length>0){let l=(null===(s=r.unhealthy_endpoints[0])||void 0===s?void 0:s.error)||"Health check failed",t=w(l);m(s=>{var a;return{...s,[e]:{status:"unhealthy",lastCheck:i,lastSuccess:(null===(a=s[e])||void 0===a?void 0:a.lastSuccess)||"None",loading:!1,error:t,fullError:l}}})}else m(l=>({...l,[e]:{status:"healthy",lastCheck:i,lastSuccess:i,loading:!1,successResponse:r}}));try{let s=await (0,c.latestHealthChecksCall)(l),r=t.data.find(l=>l.model_name===e);if(r){let l=r.model_info.id,t=null===(a=s.latest_health_checks)||void 0===a?void 0:a[l];if(t){let l=t.error_message||void 0;m(s=>{var a,r,i,n,o,d,c;return{...s,[e]:{status:t.status||(null===(a=s[e])||void 0===a?void 0:a.status)||"unknown",lastCheck:t.checked_at?new Date(t.checked_at).toLocaleString():(null===(r=s[e])||void 0===r?void 0:r.lastCheck)||"None",lastSuccess:"healthy"===t.status?t.checked_at?new Date(t.checked_at).toLocaleString():(null===(i=s[e])||void 0===i?void 0:i.lastSuccess)||"None":(null===(n=s[e])||void 0===n?void 0:n.lastSuccess)||"None",loading:!1,error:l?w(l):null===(o=s[e])||void 0===o?void 0:o.error,fullError:l||(null===(d=s[e])||void 0===d?void 0:d.fullError),successResponse:"healthy"===t.status?t:null===(c=s[e])||void 0===c?void 0:c.successResponse}}})}}}catch(e){console.debug("Could not fetch updated status from database (non-critical):",e)}}catch(a){let l=new Date().toLocaleString(),t=a instanceof Error?a.message:String(a),s=w(t);m(a=>{var r;return{...a,[e]:{status:"unhealthy",lastCheck:l,lastSuccess:(null===(r=a[e])||void 0===r?void 0:r.lastSuccess)||"None",loading:!1,error:s,fullError:t}}})}}},k=async()=>{let e=u.length>0?u:a,s=e.reduce((e,l)=>(e[l]={...d[l],loading:!0,status:"checking"},e),{});m(e=>({...e,...s}));let r={},i=e.map(async e=>{if(l)try{let s=await (0,c.individualModelHealthCheckCall)(l,e);r[e]=s;let a=new Date().toLocaleString();if(s.unhealthy_count>0&&s.unhealthy_endpoints&&s.unhealthy_endpoints.length>0){var t;let l=(null===(t=s.unhealthy_endpoints[0])||void 0===t?void 0:t.error)||"Health check failed",r=w(l);m(t=>{var s;return{...t,[e]:{status:"unhealthy",lastCheck:a,lastSuccess:(null===(s=t[e])||void 0===s?void 0:s.lastSuccess)||"None",loading:!1,error:r,fullError:l}}})}else m(l=>({...l,[e]:{status:"healthy",lastCheck:a,lastSuccess:a,loading:!1,successResponse:s}}))}catch(a){console.error("Health check failed for ".concat(e,":"),a);let l=new Date().toLocaleString(),t=a instanceof Error?a.message:String(a),s=w(t);m(a=>{var r;return{...a,[e]:{status:"unhealthy",lastCheck:l,lastSuccess:(null===(r=a[e])||void 0===r?void 0:r.lastSuccess)||"None",loading:!1,error:s,fullError:t}}})}});await Promise.allSettled(i);try{if(!l)return;let s=await (0,c.latestHealthChecksCall)(l);s.latest_health_checks&&Object.entries(s.latest_health_checks).forEach(l=>{let[s,a]=l,r=t.data.find(e=>e.model_info.id===s);if(r&&e.includes(r.model_name)&&a){let e=r.model_name,l=a.error_message||void 0;m(t=>{let s=t[e];return{...t,[e]:{status:a.status||(null==s?void 0:s.status)||"unknown",lastCheck:a.checked_at?new Date(a.checked_at).toLocaleString():(null==s?void 0:s.lastCheck)||"None",lastSuccess:"healthy"===a.status&&a.checked_at?new Date(a.checked_at).toLocaleString():(null==s?void 0:s.lastSuccess)||"None",loading:!1,error:l?w(l):null==s?void 0:s.error,fullError:l||(null==s?void 0:s.fullError),successResponse:"healthy"===a.status?a:null==s?void 0:s.successResponse}}})}})}catch(e){console.warn("Failed to fetch updated health statuses from database (non-critical):",e)}},A=e=>{p(e),e?h(a):h([])},M=()=>{f(!1),v(null)},I=()=>{y(!1),N(null)};return(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-6",children:(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(eX.Z,{children:"Model Health Status"}),(0,s.jsx)(n.Z,{className:"text-gray-600 mt-1",children:"Run health checks on individual models to verify they are working correctly"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[u.length>0&&(0,s.jsx)(eY.Z,{size:"sm",variant:"light",onClick:()=>A(!1),className:"px-3 py-1 text-sm",children:"Clear Selection"}),(0,s.jsx)(eY.Z,{size:"sm",variant:"secondary",onClick:k,disabled:Object.values(d).some(e=>e.loading),className:"px-3 py-1 text-sm",children:u.length>0&&u.length{l?h(l=>[...l,e]):(h(l=>l.filter(l=>l!==e)),p(!1))},A,C,e=>{switch(e){case"healthy":return(0,s.jsx)(ll.Z,{color:"emerald",children:"healthy"});case"unhealthy":return(0,s.jsx)(ll.Z,{color:"red",children:"unhealthy"});case"checking":return(0,s.jsx)(ll.Z,{color:"blue",children:"checking"});case"none":return(0,s.jsx)(ll.Z,{color:"gray",children:"none"});default:return(0,s.jsx)(ll.Z,{color:"gray",children:"unknown"})}},r,(e,l,t)=>{v({modelName:e,cleanedError:l,fullError:t}),f(!0)},(e,l)=>{N({modelName:e,response:l}),y(!0)},i),data:t.data.map(e=>{let l=d[e.model_name]||{status:"none",lastCheck:"None",loading:!1};return{model_name:e.model_name,model_info:e.model_info,provider:e.provider,litellm_model_name:e.litellm_model_name,health_status:l.status,last_check:l.lastCheck,last_success:l.lastSuccess||"None",health_loading:l.loading,health_error:l.error,health_full_error:l.fullError}}),isLoading:!1,table:Z})}),(0,s.jsx)(S.Z,{title:j?"Health Check Error - ".concat(j.modelName):"Error Details",open:g,onCancel:M,footer:[(0,s.jsx)(E.ZP,{onClick:M,children:"Close"},"close")],width:800,children:j&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Error:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-red-50 border border-red-200 rounded-md",children:(0,s.jsx)(n.Z,{className:"text-red-800",children:j.cleanedError})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Full Error Details:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md max-h-96 overflow-y-auto",children:(0,s.jsx)("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:j.fullError})})]})]})}),(0,s.jsx)(S.Z,{title:b?"Health Check Response - ".concat(b.modelName):"Response Details",open:_,onCancel:I,footer:[(0,s.jsx)(E.ZP,{onClick:I,children:"Close"},"close")],width:800,children:b&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Status:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-green-50 border border-green-200 rounded-md",children:(0,s.jsx)(n.Z,{className:"text-green-800",children:"Health check passed successfully"})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Response Details:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md max-h-96 overflow-y-auto",children:(0,s.jsx)("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:JSON.stringify(b.response,null,2)})})]})]})})]})},lD=t(86462),lz=t(47686),lq=t(77355),lB=t(93416),lU=t(95704),lG=e=>{let{accessToken:l,initialModelGroupAlias:t={},onAliasUpdate:a}=e,[r,i]=(0,o.useState)([]),[n,m]=(0,o.useState)({aliasName:"",targetModelGroup:""}),[u,h]=(0,o.useState)(null),[x,p]=(0,o.useState)(!0);(0,o.useEffect)(()=>{i(Object.entries(t).map((e,l)=>{var t;let[s,a]=e;return{id:"".concat(l,"-").concat(s),aliasName:s,targetModelGroup:"string"==typeof a?a:null!==(t=null==a?void 0:a.model)&&void 0!==t?t:""}}))},[t]);let g=async e=>{if(!l)return console.error("Access token is missing"),!1;try{let t={};return e.forEach(e=>{t[e.aliasName]=e.targetModelGroup}),console.log("Saving model group alias:",t),await (0,c.setCallbacksCall)(l,{router_settings:{model_group_alias:t}}),a&&a(t),!0}catch(e){return console.error("Failed to save model group alias settings:",e),d.Z.fromBackend("Failed to save model group alias settings"),!1}},f=async()=>{if(!n.aliasName||!n.targetModelGroup){d.Z.fromBackend("Please provide both alias name and target model group");return}if(r.some(e=>e.aliasName===n.aliasName)){d.Z.fromBackend("An alias with this name already exists");return}let e=[...r,{id:"".concat(Date.now(),"-").concat(n.aliasName),aliasName:n.aliasName,targetModelGroup:n.targetModelGroup}];await g(e)&&(i(e),m({aliasName:"",targetModelGroup:""}),d.Z.success("Alias added successfully"))},j=e=>{h({...e})},v=async()=>{if(!u)return;if(!u.aliasName||!u.targetModelGroup){d.Z.fromBackend("Please provide both alias name and target model group");return}if(r.some(e=>e.id!==u.id&&e.aliasName===u.aliasName)){d.Z.fromBackend("An alias with this name already exists");return}let e=r.map(e=>e.id===u.id?u:e);await g(e)&&(i(e),h(null),d.Z.success("Alias updated successfully"))},_=()=>{h(null)},b=async e=>{let l=r.filter(l=>l.id!==e);await g(l)&&(i(l),d.Z.success("Alias deleted successfully"))},N=r.reduce((e,l)=>(e[l.aliasName]=l.targetModelGroup,e),{});return(0,s.jsxs)(lU.Zb,{className:"mb-6",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>p(!x),children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)(lU.Dx,{className:"mb-0",children:"Model Group Alias Settings"}),(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Create aliases for your model groups to simplify API calls. For example, you can create an alias 'gpt-4o' that points to 'gpt-4o-mini-openai' model group."})]}),(0,s.jsx)("div",{className:"flex items-center",children:x?(0,s.jsx)(lD.Z,{className:"w-5 h-5 text-gray-500"}):(0,s.jsx)(lz.Z,{className:"w-5 h-5 text-gray-500"})})]}),x&&(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)(lU.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Alias"}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Alias Name"}),(0,s.jsx)("input",{type:"text",value:n.aliasName,onChange:e=>m({...n,aliasName:e.target.value}),placeholder:"e.g., gpt-4o",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Target Model Group"}),(0,s.jsx)("input",{type:"text",value:n.targetModelGroup,onChange:e=>m({...n,targetModelGroup:e.target.value}),placeholder:"e.g., gpt-4o-mini-openai",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,s.jsx)("div",{className:"flex items-end",children:(0,s.jsxs)("button",{onClick:f,disabled:!n.aliasName||!n.targetModelGroup,className:"flex items-center px-4 py-2 rounded-md text-sm ".concat(n.aliasName&&n.targetModelGroup?"bg-green-600 text-white hover:bg-green-700":"bg-gray-300 text-gray-500 cursor-not-allowed"),children:[(0,s.jsx)(lq.Z,{className:"w-4 h-4 mr-1"}),"Add Alias"]})})]})]}),(0,s.jsx)(lU.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Aliases"}),(0,s.jsx)("div",{className:"rounded-lg custom-border relative mb-6",children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)(lU.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,s.jsx)(lU.ss,{children:(0,s.jsxs)(lU.SC,{children:[(0,s.jsx)(lU.xs,{className:"py-1 h-8",children:"Alias Name"}),(0,s.jsx)(lU.xs,{className:"py-1 h-8",children:"Target Model Group"}),(0,s.jsx)(lU.xs,{className:"py-1 h-8",children:"Actions"})]})}),(0,s.jsxs)(lU.RM,{children:[r.map(e=>(0,s.jsx)(lU.SC,{className:"h-8",children:u&&u.id===e.id?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(lU.pj,{className:"py-0.5",children:(0,s.jsx)("input",{type:"text",value:u.aliasName,onChange:e=>h({...u,aliasName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,s.jsx)(lU.pj,{className:"py-0.5",children:(0,s.jsx)("input",{type:"text",value:u.targetModelGroup,onChange:e=>h({...u,targetModelGroup:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,s.jsx)(lU.pj,{className:"py-0.5 whitespace-nowrap",children:(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("button",{onClick:v,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,s.jsx)("button",{onClick:_,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(lU.pj,{className:"py-0.5 text-sm text-gray-900",children:e.aliasName}),(0,s.jsx)(lU.pj,{className:"py-0.5 text-sm text-gray-500",children:e.targetModelGroup}),(0,s.jsx)(lU.pj,{className:"py-0.5 whitespace-nowrap",children:(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("button",{onClick:()=>j(e),className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,s.jsx)(lB.Z,{className:"w-3 h-3"})}),(0,s.jsx)("button",{onClick:()=>b(e.id),className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,s.jsx)(y.Z,{className:"w-3 h-3"})})]})})]})},e.id)),0===r.length&&(0,s.jsx)(lU.SC,{children:(0,s.jsx)(lU.pj,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No aliases added yet. Add a new alias above."})})]})]})})}),(0,s.jsxs)(lU.Zb,{children:[(0,s.jsx)(lU.Dx,{className:"mb-4",children:"Configuration Example"}),(0,s.jsx)(lU.xv,{className:"text-gray-600 mb-4",children:"Here's how your current aliases would look in the config.yaml:"}),(0,s.jsx)("div",{className:"bg-gray-100 rounded-lg p-4 font-mono text-sm",children:(0,s.jsxs)("div",{className:"text-gray-700",children:["router_settings:",(0,s.jsx)("br",{}),"\xa0\xa0model_group_alias:",0===Object.keys(N).length?(0,s.jsxs)("span",{className:"text-gray-500",children:[(0,s.jsx)("br",{}),"\xa0\xa0\xa0\xa0# No aliases configured yet"]}):Object.entries(N).map(e=>{let[l,t]=e;return(0,s.jsxs)("span",{children:[(0,s.jsx)("br",{}),'\xa0\xa0\xa0\xa0"',l,'": "',t,'"']},l)})]})})]})]})]})},lH=t(27593),lK=e=>{let{accessToken:l,token:t,userRole:u,userID:x,modelData:p={data:[]},keys:g,setModelData:j,premiumUser:_,teams:y}=e,[b]=N.Z.useForm(),[Z,w]=(0,o.useState)(null),[S,k]=(0,o.useState)(""),[A,E]=(0,o.useState)([]),[M,I]=(0,o.useState)([]),[F,P]=(0,o.useState)(m.Cl.Anthropic),[L,T]=(0,o.useState)(!1),[R,O]=(0,o.useState)(null),[V,D]=(0,o.useState)([]),[z,q]=(0,o.useState)([]),[B,U]=(0,o.useState)(null),[G,H]=(0,o.useState)([]),[K,ea]=(0,o.useState)([]),[er,ei]=(0,o.useState)([]),[en,eo]=(0,o.useState)([]),[ed,ec]=(0,o.useState)([]),[em,eu]=(0,o.useState)([]),[eh,ex]=(0,o.useState)([]),[ep,eg]=(0,o.useState)({from:new Date(Date.now()-6048e5),to:new Date}),[ef,ej]=(0,o.useState)(null),[ev,e_]=(0,o.useState)(null),[ey,eb]=(0,o.useState)(0),[eN,eZ]=(0,o.useState)({}),[ew,eC]=(0,o.useState)([]),[eS,ek]=(0,o.useState)(!1),[eA,eE]=(0,o.useState)(null),[eM,eI]=(0,o.useState)(null),[eF,eP]=(0,o.useState)([]),[eL,eT]=(0,o.useState)({}),[eR,eO]=(0,o.useState)(!1),[eV,eD]=(0,o.useState)(null),[ez,eq]=(0,o.useState)(!1),[eB,eU]=(0,o.useState)(null),[eG,eH]=(0,o.useState)(null),[eJ,eW]=(0,o.useState)(!1),eY=(0,o.useRef)(null),[e$,eQ]=(0,o.useState)(0),eX=(0,a.NL)(),{data:e0,isLoading:e1,refetch:e2}=v(l,x,u),{data:e4}=f(l),e5=(null==e4?void 0:e4.credentials)||[];(0,o.useEffect)(()=>{let e=e=>{eY.current&&!eY.current.contains(e.target)&&eW(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let e6={name:"file",accept:".json",pastable:!1,beforeUpload:e=>{if("application/json"===e.type){let l=new FileReader;l.onload=e=>{if(e.target){let l=e.target.result;b.setFieldsValue({vertex_credentials:l})}},l.readAsText(e)}return!1},onChange(e){"done"===e.file.status?d.Z.success("".concat(e.file.name," file uploaded successfully")):"error"===e.file.status&&d.Z.fromBackend("".concat(e.file.name," file upload failed."))}},e3=()=>{k(new Date().toLocaleString()),eX.invalidateQueries({queryKey:["models","list"]}),e2()},e7=async()=>{if(l)try{let e={router_settings:{}};"global"===B?(ev&&(e.router_settings.retry_policy=ev),d.Z.success("Global retry settings saved successfully")):(ef&&(e.router_settings.model_group_retry_policy=ef),d.Z.success("Retry settings saved successfully for ".concat(B))),await (0,c.setCallbacksCall)(l,e)}catch(e){d.Z.fromBackend("Failed to save retry settings")}};if((0,o.useEffect)(()=>{if(!l||!t||!u||!x||!e0)return;let e=async()=>{try{var e,t,s,a,r,i,n,o,d,m,h,p;j(e0);let g=await (0,c.modelSettingsCall)(l);g&&I(g);let f=new Set;for(let e=0;e0&&(y=v[v.length-1]);let b=await (0,c.modelMetricsCall)(l,x,u,y,null===(e=ep.from)||void 0===e?void 0:e.toISOString(),null===(t=ep.to)||void 0===t?void 0:t.toISOString(),null==eA?void 0:eA.token,eM);H(b.data),ea(b.all_api_bases);let N=await (0,c.streamingModelMetricsCall)(l,y,null===(s=ep.from)||void 0===s?void 0:s.toISOString(),null===(a=ep.to)||void 0===a?void 0:a.toISOString());ei(N.data),eo(N.all_api_bases);let Z=await (0,c.modelExceptionsCall)(l,x,u,y,null===(r=ep.from)||void 0===r?void 0:r.toISOString(),null===(i=ep.to)||void 0===i?void 0:i.toISOString(),null==eA?void 0:eA.token,eM);ec(Z.data),eu(Z.exception_types);let w=await (0,c.modelMetricsSlowResponsesCall)(l,x,u,y,null===(n=ep.from)||void 0===n?void 0:n.toISOString(),null===(o=ep.to)||void 0===o?void 0:o.toISOString(),null==eA?void 0:eA.token,eM),C=await (0,c.adminGlobalActivityExceptions)(l,null===(d=ep.from)||void 0===d?void 0:d.toISOString().split("T")[0],null===(m=ep.to)||void 0===m?void 0:m.toISOString().split("T")[0],y);eZ(C);let S=await (0,c.adminGlobalActivityExceptionsPerDeployment)(l,null===(h=ep.from)||void 0===h?void 0:h.toISOString().split("T")[0],null===(p=ep.to)||void 0===p?void 0:p.toISOString().split("T")[0],y);eC(S),ex(w);let k=await (0,c.allEndUsersCall)(l);eP(null==k?void 0:k.map(e=>e.user_id));let A=(await (0,c.getCallbacksCall)(l,x,u)).router_settings,E=A.model_group_retry_policy,M=A.num_retries;ej(E),e_(A.retry_policy),eb(M);let F=A.model_group_alias||{};eT(F)}catch(e){console.error("Error fetching model data:",e)}};l&&t&&u&&x&&e0&&e();let s=async()=>{w(await (0,c.modelCostMap)(l))};null==Z&&s()},[l,t,u,x,e0]),!p||e1||!l||!t||!u||!x)return(0,s.jsx)("div",{children:"Loading..."});let le=[],ll=[];for(let e=0;enull!=Z&&"object"==typeof Z&&e in Z?Z[e].litellm_provider:"openai";if(t){let e=t.split("/"),l=e[0];(r=s)||(r=1===e.length?m(t):l)}else r="-";a&&(i=null==a?void 0:a.input_cost_per_token,n=null==a?void 0:a.output_cost_per_token,o=null==a?void 0:a.max_tokens,d=null==a?void 0:a.max_input_tokens),(null==l?void 0:l.litellm_params)&&(c=Object.fromEntries(Object.entries(null==l?void 0:l.litellm_params).filter(e=>{let[l]=e;return"model"!==l&&"api_base"!==l}))),p.data[e].provider=r,p.data[e].input_cost=i,p.data[e].output_cost=n,p.data[e].litellm_model_name=t,ll.push(r),p.data[e].input_cost&&(p.data[e].input_cost=(1e6*Number(p.data[e].input_cost)).toFixed(2)),p.data[e].output_cost&&(p.data[e].output_cost=(1e6*Number(p.data[e].output_cost)).toFixed(2)),p.data[e].max_tokens=o,p.data[e].max_input_tokens=d,p.data[e].api_base=null==l?void 0:null===(la=l.litellm_params)||void 0===la?void 0:la.api_base,p.data[e].cleanedLitellmParams=c,le.push(l.model_name)}if(u&&"Admin Viewer"==u){let{Title:e,Paragraph:l}=C.default;return(0,s.jsxs)("div",{children:[(0,s.jsx)(e,{level:1,children:"Access Denied"}),(0,s.jsx)(l,{children:"Ask your proxy admin for access to view all models"})]})}return(Object.keys(m.Cl).find(e=>m.Cl[e]===F),eB)?(0,s.jsx)("div",{className:"w-full h-full",children:(0,s.jsx)(e9.Z,{teamId:eB,onClose:()=>eU(null),accessToken:l,is_team_admin:"Admin"===u,is_proxy_admin:"Proxy Admin"===u,userModels:le,editTeam:!1,onUpdate:e3})}):(0,s.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,s.jsx)(i.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,s.jsxs)(r.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[(0,s.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Model Management"}),es.ZL.includes(u)?(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Add and manage models for the proxy"}):(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Add models for teams you are an admin for."})]})}),eV?(0,s.jsx)(e8,{modelId:eV,editModel:!0,onClose:()=>{eD(null),eq(!1)},modelData:p.data.find(e=>e.model_info.id===eV),accessToken:l,userID:x,userRole:u,setEditModalVisible:T,setSelectedModel:O,onModelUpdate:e=>{e.deleted?j({...p,data:p.data.filter(l=>l.model_info.id!==e.model_info.id)}):j({...p,data:p.data.map(l=>l.model_info.id===e.model_info.id?e:l)}),eX.invalidateQueries({queryKey:["models","list"]}),e3()},modelAccessGroups:z}):(0,s.jsxs)(X.Z,{index:e$,onIndexChange:eQ,className:"gap-2 h-[75vh] w-full ",children:[(0,s.jsxs)(ee.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,s.jsxs)("div",{className:"flex",children:[es.ZL.includes(u)?(0,s.jsx)(Q.Z,{children:"All Models"}):(0,s.jsx)(Q.Z,{children:"Your Models"}),(0,s.jsx)(Q.Z,{children:"Add Model"}),es.ZL.includes(u)&&(0,s.jsx)(Q.Z,{children:"LLM Credentials"}),es.ZL.includes(u)&&(0,s.jsx)(Q.Z,{children:"Pass-Through Endpoints"}),es.ZL.includes(u)&&(0,s.jsx)(Q.Z,{children:"Health Status"}),es.ZL.includes(u)&&(0,s.jsx)(Q.Z,{children:"Model Analytics"}),es.ZL.includes(u)&&(0,s.jsx)(Q.Z,{children:"Model Retry Settings"}),es.ZL.includes(u)&&(0,s.jsx)(Q.Z,{children:"Model Group Alias"}),es.ZL.includes(u)&&(0,s.jsx)(Q.Z,{children:"Price Data Reload"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[S&&(0,s.jsxs)(n.Z,{children:["Last Refreshed: ",S]}),(0,s.jsx)($.Z,{icon:Y.Z,variant:"shadow",size:"xs",className:"self-center",onClick:e3})]})]}),(0,s.jsxs)(et.Z,{children:[(0,s.jsx)(li,{selectedModelGroup:B,setSelectedModelGroup:U,availableModelGroups:V,availableModelAccessGroups:z,setSelectedModelId:eD,setSelectedTeamId:eU,setEditModel:eq,modelData:p}),(0,s.jsx)(el.Z,{className:"h-full",children:(0,s.jsx)(eK,{form:b,handleOk:()=>{b.validateFields().then(e=>{h(e,l,b,e3)}).catch(e=>{var l;let t=(null===(l=e.errorFields)||void 0===l?void 0:l.map(e=>"".concat(e.name.join("."),": ").concat(e.errors.join(", "))).join(" | "))||"Unknown validation error";d.Z.fromBackend("Please fill in the following required fields: ".concat(t))})},selectedProvider:F,setSelectedProvider:P,providerModels:A,setProviderModelsFn:e=>{E((0,m.bK)(e,Z))},getPlaceholder:m.ph,uploadProps:e6,showAdvancedSettings:eR,setShowAdvancedSettings:eO,teams:y,credentials:e5,accessToken:l,userRole:u,premiumUser:_})}),(0,s.jsx)(el.Z,{children:(0,s.jsx)(J,{uploadProps:e6})}),(0,s.jsx)(el.Z,{children:(0,s.jsx)(lH.Z,{accessToken:l,userRole:u,userID:x,modelData:p,premiumUser:_})}),(0,s.jsx)(el.Z,{children:(0,s.jsx)(lV,{accessToken:l,modelData:p,all_models_on_proxy:le,getDisplayModelName:W,setSelectedModelId:eD})}),(0,s.jsx)(lb,{dateValue:ep,setDateValue:eg,selectedModelGroup:B,availableModelGroups:V,setShowAdvancedFilters:ek,modelMetrics:G,modelMetricsCategories:K,streamingModelMetrics:er,streamingModelMetricsCategories:en,customTooltip:e=>{var l,t;let{payload:a,active:r}=e;if(!r||!a)return null;let i=null===(t=a[0])||void 0===t?void 0:null===(l=t.payload)||void 0===l?void 0:l.date,n=a.sort((e,l)=>l.value-e.value);if(n.length>5){let e=n.length-5;(n=n.slice(0,5)).push({dataKey:"".concat(e," other deployments"),value:a.slice(5).reduce((e,l)=>e+l.value,0),color:"gray"})}return(0,s.jsxs)("div",{className:"w-150 rounded-tremor-default border border-tremor-border bg-tremor-background p-2 text-tremor-default shadow-tremor-dropdown",children:[i&&(0,s.jsxs)("p",{className:"text-tremor-content-emphasis mb-2",children:["Date: ",i]}),n.map((e,l)=>{let t=parseFloat(e.value.toFixed(5)),a=0===t&&e.value>0?"<0.00001":t.toFixed(5);return(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 mt-1 rounded-full bg-".concat(e.color,"-500")}),(0,s.jsx)("p",{className:"text-tremor-content",children:e.dataKey})]}),(0,s.jsx)("p",{className:"font-medium text-tremor-content-emphasis text-righ ml-2",children:a})]},l)})]})},slowResponsesData:eh,modelExceptions:ed,globalExceptionData:eN,allExceptions:em,globalExceptionPerDeployment:ew,allEndUsers:eF,keys:g,setSelectedAPIKey:eE,setSelectedCustomer:eI,teams:y,selectedAPIKey:eA,selectedCustomer:eM,selectedTeam:eG,setAllExceptions:eu,setGlobalExceptionData:eZ,setGlobalExceptionPerDeployment:eC,setModelExceptions:ec,setModelMetrics:H,setModelMetricsCategories:ea,setSelectedModelGroup:U,setSlowResponsesData:ex,setStreamingModelMetrics:ei,setStreamingModelMetricsCategories:eo}),(0,s.jsx)(lZ,{selectedModelGroup:B,setSelectedModelGroup:U,availableModelGroups:V,globalRetryPolicy:ev,setGlobalRetryPolicy:e_,defaultRetry:ey,modelGroupRetryPolicy:ef,setModelGroupRetryPolicy:ej,handleSaveRetrySettings:e7}),(0,s.jsx)(el.Z,{children:(0,s.jsx)(lG,{accessToken:l,initialModelGroupAlias:eL,onAliasUpdate:eT})}),(0,s.jsx)(lF,{setModelMap:w})]})]})]})})})}},27593:function(e,l,t){t.d(l,{Z:function(){return Y}});var s=t(57437),a=t(2265),r=t(78489),i=t(47323),n=t(84264),o=t(96761),d=t(19250),c=t(99981),m=t(33866),u=t(15731),h=t(53410),x=t(74998),p=t(59341),g=t(49566),f=t(12514),j=t(97765),v=t(37592),_=t(10032),y=t(22116),b=t(51653),N=t(24199),Z=t(12660),w=t(15424),C=t(58760),S=t(5545),k=t(45246),A=t(96473),E=t(31283),M=e=>{let{value:l={},onChange:t}=e,[r,i]=(0,a.useState)(Object.entries(l)),n=e=>{let l=r.filter((l,t)=>t!==e);i(l),null==t||t(Object.fromEntries(l))},o=(e,l,s)=>{let a=[...r];a[e]=[l,s],i(a),null==t||t(Object.fromEntries(a))};return(0,s.jsxs)("div",{children:[r.map((e,l)=>{let[t,a]=e;return(0,s.jsxs)(C.Z,{style:{display:"flex",marginBottom:8},align:"center",children:[(0,s.jsx)(E.o,{placeholder:"Header Name",value:t,onChange:e=>o(l,e.target.value,a)}),(0,s.jsx)(E.o,{placeholder:"Header Value",value:a,onChange:e=>o(l,t,e.target.value)}),(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,s.jsx)(k.Z,{onClick:()=>n(l),style:{cursor:"pointer"}})})]},l)}),(0,s.jsx)(S.ZP,{type:"dashed",onClick:()=>{i([...r,["",""]])},icon:(0,s.jsx)(A.Z,{}),children:"Add Header"})]})},I=t(77565),F=e=>{let{pathValue:l,targetValue:t,includeSubpath:a}=e,r=(0,d.getProxyBaseUrl)();return l&&t?(0,s.jsxs)(f.Z,{className:"p-5",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Route Preview"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-5",children:"How your requests will be routed"}),(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-base font-semibold text-gray-900 mb-3",children:"Basic routing:"}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Your endpoint"}),(0,s.jsx)("code",{className:"font-mono text-sm text-gray-900",children:l?"".concat(r).concat(l):""})]}),(0,s.jsx)("div",{className:"text-gray-400",children:(0,s.jsx)(I.Z,{className:"text-lg"})}),(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Forwards to"}),(0,s.jsx)("code",{className:"font-mono text-sm text-gray-900",children:t})]})]})]}),a&&(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-base font-semibold text-gray-900 mb-3",children:"With subpaths:"}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Your endpoint + subpath"}),(0,s.jsxs)("code",{className:"font-mono text-sm text-gray-900",children:[l&&"".concat(r).concat(l),(0,s.jsx)("span",{className:"text-blue-600",children:"/v1/text-to-image/base/model"})]})]}),(0,s.jsx)("div",{className:"text-gray-400",children:(0,s.jsx)(I.Z,{className:"text-lg"})}),(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Forwards to"}),(0,s.jsxs)("code",{className:"font-mono text-sm text-gray-900",children:[t,(0,s.jsx)("span",{className:"text-blue-600",children:"/v1/text-to-image/base/model"})]})]})]}),(0,s.jsxs)("div",{className:"mt-3 text-sm text-gray-600",children:["Any path after ",l," will be appended to the target URL"]})]})}),!a&&(0,s.jsx)("div",{className:"mt-4 p-3 bg-blue-50 rounded-md border border-blue-200",children:(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)(w.Z,{className:"text-blue-500 mt-0.5 mr-2 flex-shrink-0"}),(0,s.jsxs)("div",{className:"text-sm text-blue-700",children:[(0,s.jsx)("span",{className:"font-medium",children:"Not seeing the routing you wanted?"})," Try enabling - Include Subpaths - above - this allows subroutes like"," ",(0,s.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded font-mono text-xs",children:"/api/v1/models"})," to be forwarded automatically."]})]})})]})]}):null},P=t(9114),L=t(63709),T=e=>{let{premiumUser:l,authEnabled:t,onAuthChange:a}=e;return(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Security"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-4",children:"When enabled, requests to this endpoint will require a valid LiteLLM Virtual Key"}),l?(0,s.jsx)(_.Z.Item,{name:"auth",valuePropName:"checked",className:"mb-0",children:(0,s.jsx)(L.Z,{checked:t,onChange:e=>{a(e)}})}):(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center mb-3",children:[(0,s.jsx)(L.Z,{disabled:!0,checked:!1,style:{outline:"2px solid #d1d5db",outlineOffset:"2px"}}),(0,s.jsx)("span",{className:"ml-2 text-sm text-gray-400",children:"Authentication (Premium)"})]}),(0,s.jsx)("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,s.jsxs)(n.Z,{className:"text-sm text-yellow-800",children:["Setting authentication for pass-through endpoints is a LiteLLM Enterprise feature. Get a trial key"," ",(0,s.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"here"}),"."]})})]})]})},R=t(67479),O=e=>{let{accessToken:l,value:t={},onChange:r,disabled:i=!1}=e,[n,d]=(0,a.useState)(Object.keys(t)),[m,u]=(0,a.useState)(t);(0,a.useEffect)(()=>{u(t),d(Object.keys(t))},[t]);let h=(e,l,t)=>{var s,a;let i=m[e]||{},n={...m,[e]:{...i,[l]:t.length>0?t:void 0}};(null===(s=n[e])||void 0===s?void 0:s.request_fields)||(null===(a=n[e])||void 0===a?void 0:a.response_fields)||(n[e]=null),u(n),r&&r(n)};return(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Guardrails"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Configure guardrails to enforce policies on requests and responses. Guardrails are opt-in for passthrough endpoints."}),(0,s.jsx)(b.Z,{message:(0,s.jsxs)("span",{children:["Field-Level Targeting"," ",(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/pass_through_guardrails#field-level-targeting",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"(Learn More)"})]}),description:(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("div",{children:"Optionally specify which fields to check. If left empty, the entire request/response is sent to the guardrail."}),(0,s.jsxs)("div",{className:"text-xs space-y-1 mt-2",children:[(0,s.jsx)("div",{className:"font-medium",children:"Common Examples:"}),(0,s.jsxs)("div",{children:["• ",(0,s.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"query"})," - Single field"]}),(0,s.jsxs)("div",{children:["• ",(0,s.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"documents[*].text"})," - All text in documents array"]}),(0,s.jsxs)("div",{children:["• ",(0,s.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"messages[*].content"})," - All message contents"]})]})]}),type:"info",showIcon:!0,className:"mb-4"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Select Guardrails",(0,s.jsx)(c.Z,{title:"Choose which guardrails should run on this endpoint. Org/team/key level guardrails will also be included.",children:(0,s.jsx)(w.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),children:(0,s.jsx)(R.Z,{accessToken:l,value:n,onChange:e=>{d(e);let l={};e.forEach(e=>{l[e]=m[e]||null}),u(l),r&&r(l)},disabled:i})}),n.length>0&&(0,s.jsxs)("div",{className:"mt-6 space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-700",children:"Field Targeting (Optional)"}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"\uD83D\uDCA1 Tip: Leave empty to check entire payload"})]}),n.map(e=>{var l,t;return(0,s.jsxs)(f.Z,{className:"p-4 bg-gray-50",children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-900 mb-3",children:e}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,s.jsxs)("label",{className:"text-xs text-gray-600 flex items-center",children:["Request Fields (pre_call)",(0,s.jsx)(c.Z,{title:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium mb-1",children:"Specify which request fields to check"}),(0,s.jsxs)("div",{className:"text-xs space-y-1",children:[(0,s.jsx)("div",{children:"Examples:"}),(0,s.jsx)("div",{children:"• query"}),(0,s.jsx)("div",{children:"• documents[*].text"}),(0,s.jsx)("div",{children:"• messages[*].content"})]})]}),children:(0,s.jsx)(w.Z,{className:"ml-1 text-gray-400"})})]}),(0,s.jsxs)("div",{className:"flex gap-1",children:[(0,s.jsx)("button",{type:"button",onClick:()=>{var l;let t=(null===(l=m[e])||void 0===l?void 0:l.request_fields)||[];h(e,"request_fields",[...t,"query"])},className:"text-xs px-2 py-1 bg-white border border-gray-300 rounded hover:bg-gray-50",disabled:i,children:"+ query"}),(0,s.jsx)("button",{type:"button",onClick:()=>{var l;let t=(null===(l=m[e])||void 0===l?void 0:l.request_fields)||[];h(e,"request_fields",[...t,"documents[*]"])},className:"text-xs px-2 py-1 bg-white border border-gray-300 rounded hover:bg-gray-50",disabled:i,children:"+ documents[*]"})]})]}),(0,s.jsx)(v.default,{mode:"tags",style:{width:"100%"},placeholder:"Type field name or use + buttons above (e.g., query, documents[*].text)",value:(null===(l=m[e])||void 0===l?void 0:l.request_fields)||[],onChange:l=>h(e,"request_fields",l),disabled:i,tokenSeparators:[","]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,s.jsxs)("label",{className:"text-xs text-gray-600 flex items-center",children:["Response Fields (post_call)",(0,s.jsx)(c.Z,{title:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium mb-1",children:"Specify which response fields to check"}),(0,s.jsxs)("div",{className:"text-xs space-y-1",children:[(0,s.jsx)("div",{children:"Examples:"}),(0,s.jsx)("div",{children:"• results[*].text"}),(0,s.jsx)("div",{children:"• choices[*].message.content"})]})]}),children:(0,s.jsx)(w.Z,{className:"ml-1 text-gray-400"})})]}),(0,s.jsx)("div",{className:"flex gap-1",children:(0,s.jsx)("button",{type:"button",onClick:()=>{var l;let t=(null===(l=m[e])||void 0===l?void 0:l.response_fields)||[];h(e,"response_fields",[...t,"results[*]"])},className:"text-xs px-2 py-1 bg-white border border-gray-300 rounded hover:bg-gray-50",disabled:i,children:"+ results[*]"})})]}),(0,s.jsx)(v.default,{mode:"tags",style:{width:"100%"},placeholder:"Type field name or use + buttons above (e.g., results[*].text)",value:(null===(t=m[e])||void 0===t?void 0:t.response_fields)||[],onChange:l=>h(e,"response_fields",l),disabled:i,tokenSeparators:[","]})]})]})]},e)})]})]})};let{Option:V}=v.default;var D=e=>{let{accessToken:l,setPassThroughItems:t,passThroughItems:i,premiumUser:n=!1}=e,[m]=_.Z.useForm(),[u,h]=(0,a.useState)(!1),[x,v]=(0,a.useState)(!1),[C,S]=(0,a.useState)(""),[k,A]=(0,a.useState)(""),[E,I]=(0,a.useState)(""),[L,R]=(0,a.useState)(!0),[V,D]=(0,a.useState)(!1),[z,q]=(0,a.useState)({}),B=()=>{m.resetFields(),A(""),I(""),R(!0),q({}),h(!1)},U=e=>{let l=e;e&&!e.startsWith("/")&&(l="/"+e),A(l),m.setFieldsValue({path:l})},G=async e=>{console.log("addPassThrough called with:",e),v(!0);try{!n&&"auth"in e&&delete e.auth,z&&Object.keys(z).length>0&&(e.guardrails=z),console.log("formValues: ".concat(JSON.stringify(e)));let s=(await (0,d.createPassThroughEndpoint)(l,e)).endpoints[0],a=[...i,s];t(a),P.Z.success("Pass-through endpoint created successfully"),m.resetFields(),A(""),I(""),R(!0),q({}),h(!1)}catch(e){P.Z.fromBackend("Error creating pass-through endpoint: "+e)}finally{v(!1)}};return(0,s.jsxs)("div",{children:[(0,s.jsx)(r.Z,{className:"mx-auto mb-4 mt-4",onClick:()=>h(!0),children:"+ Add Pass-Through Endpoint"}),(0,s.jsx)(y.Z,{title:(0,s.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[(0,s.jsx)(Z.Z,{className:"text-xl text-blue-500"}),(0,s.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add Pass-Through Endpoint"})]}),open:u,width:1e3,onCancel:B,footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,s.jsxs)("div",{className:"mt-6",children:[(0,s.jsx)(b.Z,{message:"What is a Pass-Through Endpoint?",description:"Route requests from your LiteLLM proxy to any external API. Perfect for custom models, image generation APIs, or any service you want to proxy through LiteLLM.",type:"info",showIcon:!0,className:"mb-6"}),(0,s.jsxs)(_.Z,{form:m,onFinish:G,layout:"vertical",className:"space-y-6",initialValues:{include_subpath:!0,path:k,target:E},children:[(0,s.jsxs)(f.Z,{className:"p-5",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Route Configuration"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-5",children:"Configure how requests to your domain will be forwarded to the target API"}),(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsx)(_.Z.Item,{label:(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Path Prefix"}),name:"path",rules:[{required:!0,message:"Path is required",pattern:/^\//}],extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Example: /bria, /adobe-photoshop, /elasticsearch"}),className:"mb-4",children:(0,s.jsx)("div",{className:"flex items-center",children:(0,s.jsx)(g.Z,{placeholder:"bria",value:k,onChange:e=>U(e.target.value),className:"flex-1"})})}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Target URL"}),name:"target",rules:[{required:!0,message:"Target URL is required"},{type:"url",message:"Please enter a valid URL"}],extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Example:https://engine.prod.bria-api.com"}),className:"mb-4",children:(0,s.jsx)(g.Z,{placeholder:"https://engine.prod.bria-api.com",value:E,onChange:e=>{I(e.target.value),m.setFieldsValue({target:e.target.value})}})}),(0,s.jsxs)("div",{className:"flex items-center justify-between py-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-700",children:"Include Subpaths"}),(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:"Forward all subpaths to the target API (recommended for REST APIs)"})]}),(0,s.jsx)(_.Z.Item,{name:"include_subpath",valuePropName:"checked",className:"mb-0",children:(0,s.jsx)(p.Z,{checked:L,onChange:R})})]})]})]}),(0,s.jsx)(F,{pathValue:k,targetValue:E,includeSubpath:L}),(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Headers"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Add headers that will be sent with every request to the target API"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authentication Headers",(0,s.jsx)(c.Z,{title:"Authentication and other headers to forward with requests",children:(0,s.jsx)(w.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"headers",rules:[{required:!0,message:"Please configure the headers"}],extra:(0,s.jsxs)("div",{className:"text-xs text-gray-500 mt-2",children:[(0,s.jsx)("div",{className:"font-medium mb-1",children:"Add authentication tokens and other required headers"}),(0,s.jsx)("div",{children:"Common examples: auth_token, Authorization, x-api-key"})]}),children:(0,s.jsx)(M,{})})]}),(0,s.jsx)(T,{premiumUser:n,authEnabled:V,onAuthChange:e=>{D(e),m.setFieldsValue({auth:e})}}),(0,s.jsx)(O,{accessToken:l,value:z,onChange:q}),(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Billing"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Optional cost tracking for this endpoint"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Cost Per Request (USD)",(0,s.jsx)(c.Z,{title:"Optional: Track costs for requests to this endpoint",children:(0,s.jsx)(w.Z,{className:"ml-2 text-gray-400 hover:text-gray-600"})})]}),name:"cost_per_request",extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-2",children:"The cost charged for each request through this endpoint"}),children:(0,s.jsx)(N.Z,{min:0,step:.001,precision:4,placeholder:"2.0000",size:"large"})})]}),(0,s.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:[(0,s.jsx)(r.Z,{variant:"secondary",onClick:B,children:"Cancel"}),(0,s.jsx)(r.Z,{variant:"primary",loading:x,onClick:()=>{console.log("Submit button clicked"),m.submit()},children:x?"Creating...":"Add Pass-Through Endpoint"})]})]})]})})]})},z=t(30078),q=t(4260),B=t(19015),U=t(87769),G=t(42208);let H=e=>{let{value:l}=e,[t,r]=(0,a.useState)(!1),i=JSON.stringify(l,null,2);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("pre",{className:"font-mono text-xs bg-gray-50 p-2 rounded max-w-md overflow-auto",children:t?i:"••••••••"}),(0,s.jsx)("button",{onClick:()=>r(!t),className:"p-1 hover:bg-gray-100 rounded",type:"button",children:t?(0,s.jsx)(U.Z,{className:"w-4 h-4 text-gray-500"}):(0,s.jsx)(G.Z,{className:"w-4 h-4 text-gray-500"})})]})};var K=e=>{let{endpointData:l,onClose:t,accessToken:r,isAdmin:i,premiumUser:n=!1,onEndpointUpdated:o}=e,[c,m]=(0,a.useState)(l),[u,h]=(0,a.useState)(!1),[x,p]=(0,a.useState)(!1),[g,f]=(0,a.useState)((null==l?void 0:l.auth)||!1),[j,v]=(0,a.useState)((null==l?void 0:l.guardrails)||{}),[y]=_.Z.useForm(),b=async e=>{try{if(!r||!(null==c?void 0:c.id))return;let l={};if(e.headers)try{l="string"==typeof e.headers?JSON.parse(e.headers):e.headers}catch(e){P.Z.fromBackend("Invalid JSON format for headers");return}let t={path:c.path,target:e.target,headers:l,include_subpath:e.include_subpath,cost_per_request:e.cost_per_request,auth:n?e.auth:void 0,guardrails:j&&Object.keys(j).length>0?j:void 0};await (0,d.updatePassThroughEndpoint)(r,c.id,t),m({...c,...t}),p(!1),o&&o()}catch(e){console.error("Error updating endpoint:",e),P.Z.fromBackend("Failed to update pass through endpoint")}},N=async()=>{try{if(!r||!(null==c?void 0:c.id))return;await (0,d.deletePassThroughEndpointsCall)(r,c.id),P.Z.success("Pass through endpoint deleted successfully"),t(),o&&o()}catch(e){console.error("Error deleting endpoint:",e),P.Z.fromBackend("Failed to delete pass through endpoint")}};return u?(0,s.jsx)("div",{className:"p-4",children:"Loading..."}):c?(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,s.jsxs)("div",{children:[(0,s.jsx)(S.ZP,{onClick:t,className:"mb-4",children:"← Back"}),(0,s.jsxs)(z.Dx,{children:["Pass Through Endpoint: ",c.path]}),(0,s.jsx)(z.xv,{className:"text-gray-500 font-mono",children:c.id})]})}),(0,s.jsxs)(z.v0,{children:[(0,s.jsxs)(z.td,{className:"mb-4",children:[(0,s.jsx)(z.OK,{children:"Overview"},"overview"),i?(0,s.jsx)(z.OK,{children:"Settings"},"settings"):(0,s.jsx)(s.Fragment,{})]}),(0,s.jsxs)(z.nP,{children:[(0,s.jsxs)(z.x4,{children:[(0,s.jsxs)(z.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,s.jsxs)(z.Zb,{children:[(0,s.jsx)(z.xv,{children:"Path"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(z.Dx,{className:"font-mono",children:c.path})})]}),(0,s.jsxs)(z.Zb,{children:[(0,s.jsx)(z.xv,{children:"Target"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(z.Dx,{children:c.target})})]}),(0,s.jsxs)(z.Zb,{children:[(0,s.jsx)(z.xv,{children:"Configuration"}),(0,s.jsxs)("div",{className:"mt-2 space-y-2",children:[(0,s.jsx)("div",{children:(0,s.jsx)(z.Ct,{color:c.include_subpath?"green":"gray",children:c.include_subpath?"Include Subpath":"Exact Path"})}),(0,s.jsx)("div",{children:(0,s.jsx)(z.Ct,{color:c.auth?"blue":"gray",children:c.auth?"Auth Required":"No Auth"})}),void 0!==c.cost_per_request&&(0,s.jsx)("div",{children:(0,s.jsxs)(z.xv,{children:["Cost per request: $",c.cost_per_request]})})]})]})]}),(0,s.jsx)("div",{className:"mt-6",children:(0,s.jsx)(F,{pathValue:c.path,targetValue:c.target,includeSubpath:c.include_subpath||!1})}),c.headers&&Object.keys(c.headers).length>0&&(0,s.jsxs)(z.Zb,{className:"mt-6",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Headers"}),(0,s.jsxs)(z.Ct,{color:"blue",children:[Object.keys(c.headers).length," headers configured"]})]}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(H,{value:c.headers})})]}),c.guardrails&&Object.keys(c.guardrails).length>0&&(0,s.jsxs)(z.Zb,{className:"mt-6",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Guardrails"}),(0,s.jsxs)(z.Ct,{color:"purple",children:[Object.keys(c.guardrails).length," guardrails configured"]})]}),(0,s.jsx)("div",{className:"mt-4 space-y-2",children:Object.entries(c.guardrails).map(e=>{let[l,t]=e;return(0,s.jsxs)("div",{className:"p-3 bg-gray-50 rounded",children:[(0,s.jsx)("div",{className:"font-medium text-sm",children:l}),t&&(t.request_fields||t.response_fields)&&(0,s.jsxs)("div",{className:"mt-2 text-xs text-gray-600 space-y-1",children:[t.request_fields&&(0,s.jsxs)("div",{children:["Request fields: ",t.request_fields.join(", ")]}),t.response_fields&&(0,s.jsxs)("div",{children:["Response fields: ",t.response_fields.join(", ")]})]}),!t&&(0,s.jsx)("div",{className:"text-xs text-gray-600 mt-1",children:"Uses entire payload"})]},l)})})]})]}),i&&(0,s.jsx)(z.x4,{children:(0,s.jsxs)(z.Zb,{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(z.Dx,{children:"Pass Through Endpoint Settings"}),(0,s.jsx)("div",{className:"space-x-2",children:!x&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(z.zx,{onClick:()=>p(!0),children:"Edit Settings"}),(0,s.jsx)(z.zx,{onClick:N,variant:"secondary",color:"red",children:"Delete Endpoint"})]})})]}),x?(0,s.jsxs)(_.Z,{form:y,onFinish:b,initialValues:{target:c.target,headers:c.headers?JSON.stringify(c.headers,null,2):"",include_subpath:c.include_subpath||!1,cost_per_request:c.cost_per_request,auth:c.auth||!1},layout:"vertical",children:[(0,s.jsx)(_.Z.Item,{label:"Target URL",name:"target",rules:[{required:!0,message:"Please input a target URL"}],children:(0,s.jsx)(z.oi,{placeholder:"https://api.example.com"})}),(0,s.jsx)(_.Z.Item,{label:"Headers (JSON)",name:"headers",children:(0,s.jsx)(q.default.TextArea,{rows:5,placeholder:'{"Authorization": "Bearer your-token", "Content-Type": "application/json"}'})}),(0,s.jsx)(_.Z.Item,{label:"Include Subpath",name:"include_subpath",valuePropName:"checked",children:(0,s.jsx)(L.Z,{})}),(0,s.jsx)(_.Z.Item,{label:"Cost per Request",name:"cost_per_request",children:(0,s.jsx)(B.Z,{min:0,step:.01,precision:2,placeholder:"0.00",addonBefore:"$"})}),(0,s.jsx)(T,{premiumUser:n,authEnabled:g,onAuthChange:e=>{f(e),y.setFieldsValue({auth:e})}}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(O,{accessToken:r||"",value:j,onChange:v})}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 mt-6",children:[(0,s.jsx)(S.ZP,{onClick:()=>p(!1),children:"Cancel"}),(0,s.jsx)(z.zx,{children:"Save Changes"})]})]}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Path"}),(0,s.jsx)("div",{className:"font-mono",children:c.path})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Target URL"}),(0,s.jsx)("div",{children:c.target})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Include Subpath"}),(0,s.jsx)(z.Ct,{color:c.include_subpath?"green":"gray",children:c.include_subpath?"Yes":"No"})]}),void 0!==c.cost_per_request&&(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Cost per Request"}),(0,s.jsxs)("div",{children:["$",c.cost_per_request]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Authentication Required"}),(0,s.jsx)(z.Ct,{color:c.auth?"green":"gray",children:c.auth?"Yes":"No"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Headers"}),c.headers&&Object.keys(c.headers).length>0?(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(H,{value:c.headers})}):(0,s.jsx)("div",{className:"text-gray-500",children:"No headers configured"})]})]})]})})]})]})]}):(0,s.jsx)("div",{className:"p-4",children:"Pass through endpoint not found"})},J=t(12322);let W=e=>{let{value:l}=e,[t,r]=(0,a.useState)(!1),i=JSON.stringify(l);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("span",{className:"font-mono text-xs",children:t?i:"••••••••"}),(0,s.jsx)("button",{onClick:()=>r(!t),className:"p-1 hover:bg-gray-100 rounded",type:"button",children:t?(0,s.jsx)(U.Z,{className:"w-4 h-4 text-gray-500"}):(0,s.jsx)(G.Z,{className:"w-4 h-4 text-gray-500"})})]})};var Y=e=>{let{accessToken:l,userRole:t,userID:p,modelData:g,premiumUser:f}=e,[j,v]=(0,a.useState)([]),[_,y]=(0,a.useState)(null),[b,N]=(0,a.useState)(!1),[Z,w]=(0,a.useState)(null);(0,a.useEffect)(()=>{l&&t&&p&&(0,d.getPassThroughEndpointsCall)(l).then(e=>{v(e.endpoints)})},[l,t,p]);let C=async e=>{w(e),N(!0)},S=async()=>{if(null!=Z&&l){try{await (0,d.deletePassThroughEndpointsCall)(l,Z);let e=j.filter(e=>e.id!==Z);v(e),P.Z.success("Endpoint deleted successfully.")}catch(e){console.error("Error deleting the endpoint:",e),P.Z.fromBackend("Error deleting the endpoint: "+e)}N(!1),w(null)}},k=(e,l)=>{C(e)},A=[{header:"ID",accessorKey:"id",cell:e=>(0,s.jsx)(c.Z,{title:e.row.original.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>e.row.original.id&&y(e.row.original.id),children:e.row.original.id})})},{header:"Path",accessorKey:"path"},{header:"Target",accessorKey:"target",cell:e=>(0,s.jsx)(n.Z,{children:e.getValue()})},{header:()=>(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{children:"Authentication"}),(0,s.jsx)(c.Z,{title:"LiteLLM Virtual Key required to call endpoint",children:(0,s.jsx)(u.Z,{className:"w-4 h-4 text-gray-400 cursor-help"})})]}),accessorKey:"auth",cell:e=>(0,s.jsx)(m.Z,{color:e.getValue()?"green":"gray",children:e.getValue()?"Yes":"No"})},{header:"Headers",accessorKey:"headers",cell:e=>(0,s.jsx)(W,{value:e.getValue()||{}})},{header:"Actions",id:"actions",cell:e=>{let{row:l}=e;return(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)(i.Z,{icon:h.Z,size:"sm",onClick:()=>l.original.id&&y(l.original.id),title:"Edit"}),(0,s.jsx)(i.Z,{icon:x.Z,size:"sm",onClick:()=>k(l.original.id,l.index),title:"Delete"})]})}}];if(!l)return null;if(_){console.log("selectedEndpointId",_),console.log("generalSettings",j);let e=j.find(e=>e.id===_);return e?(0,s.jsx)(K,{endpointData:e,onClose:()=>y(null),accessToken:l,isAdmin:"Admin"===t||"admin"===t,premiumUser:f,onEndpointUpdated:()=>{l&&(0,d.getPassThroughEndpointsCall)(l).then(e=>{v(e.endpoints)})}}):(0,s.jsx)("div",{children:"Endpoint not found"})}return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(o.Z,{children:"Pass Through Endpoints"}),(0,s.jsx)(n.Z,{className:"text-tremor-content",children:"Configure and manage your pass-through endpoints"})]}),(0,s.jsx)(D,{accessToken:l,setPassThroughItems:v,passThroughItems:j,premiumUser:f}),(0,s.jsx)(J.w,{data:j,columns:A,renderSubComponent:()=>(0,s.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:!1,noDataMessage:"No pass-through endpoints configured"}),b&&(0,s.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,s.jsxs)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,s.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,s.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,s.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:"​"}),(0,s.jsxs)("div",{className:"inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full",children:[(0,s.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,s.jsx)("div",{className:"sm:flex sm:items-start",children:(0,s.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,s.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Pass-Through Endpoint"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this pass-through endpoint? This action cannot be undone."})})]})})}),(0,s.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,s.jsx)(r.Z,{onClick:S,color:"red",className:"ml-2",children:"Delete"}),(0,s.jsx)(r.Z,{onClick:()=>{N(!1),w(null)},children:"Cancel"})]})]})]})})]})}},39789:function(e,l,t){t.d(l,{Z:function(){return n}});var s=t(57437),a=t(2265),r=t(88237),i=t(84264),n=e=>{let{value:l,onValueChange:t,label:n="Select Time Range",className:o="",showTimeRange:d=!0}=e,[c,m]=(0,a.useState)(!1),u=(0,a.useRef)(null),h=(0,a.useCallback)(e=>{m(!0),setTimeout(()=>m(!1),1500),t(e),requestIdleCallback(()=>{if(e.from){let l;let s={...e},a=new Date(e.from);l=new Date(e.to?e.to:e.from),a.toDateString(),l.toDateString(),a.setHours(0,0,0,0),l.setHours(23,59,59,999),s.from=a,s.to=l,t(s)}},{timeout:100})},[t]),x=(0,a.useCallback)((e,l)=>{if(!e||!l)return"";let t=e=>e.toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0,timeZoneName:"short"});if(e.toDateString()!==l.toDateString())return"".concat(t(e)," - ").concat(t(l));{let t=e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),s=e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}),a=l.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0,timeZoneName:"short"});return"".concat(t,": ").concat(s," - ").concat(a)}},[]);return(0,s.jsxs)("div",{className:o,children:[n&&(0,s.jsx)(i.Z,{className:"mb-2",children:n}),(0,s.jsxs)("div",{className:"relative w-fit",children:[(0,s.jsx)("div",{ref:u,children:(0,s.jsx)(r.Z,{enableSelect:!0,value:l,onValueChange:h,placeholder:"Select date range",enableClear:!1,style:{zIndex:100}})}),c&&(0,s.jsx)("div",{className:"absolute top-1/2 animate-pulse",style:{left:"calc(100% + 8px)",transform:"translateY(-50%)",zIndex:110},children:(0,s.jsxs)("div",{className:"flex items-center gap-1 text-green-600 text-sm font-medium bg-white px-2 py-1 rounded-full border border-green-200 shadow-sm whitespace-nowrap",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-green-500 text-white rounded-full flex items-center justify-center text-xs",children:"✓"}),(0,s.jsx)("span",{className:"text-xs",children:"Selected"})]})})]}),d&&l.from&&l.to&&(0,s.jsx)(i.Z,{className:"mt-2 text-xs text-gray-500",children:x(l.from,l.to)})]})}},12322:function(e,l,t){t.d(l,{w:function(){return o}});var s=t(57437),a=t(2265),r=t(71594),i=t(24525),n=t(19130);function o(e){let{data:l=[],columns:t,getRowCanExpand:o,renderSubComponent:d,isLoading:c=!1,loadingMessage:m="\uD83D\uDE85 Loading logs...",noDataMessage:u="No logs found"}=e,h=(0,r.b7)({data:l,columns:t,getRowCanExpand:o,getRowId:(e,l)=>{var t;return null!==(t=null==e?void 0:e.request_id)&&void 0!==t?t:String(l)},getCoreRowModel:(0,i.sC)(),getExpandedRowModel:(0,i.rV)()});return(0,s.jsx)("div",{className:"rounded-lg custom-border overflow-x-auto w-full max-w-full box-border",children:(0,s.jsxs)(n.iA,{className:"[&_td]:py-0.5 [&_th]:py-1 table-fixed w-full box-border",style:{minWidth:"400px"},children:[(0,s.jsx)(n.ss,{children:h.getHeaderGroups().map(e=>(0,s.jsx)(n.SC,{children:e.headers.map(e=>(0,s.jsx)(n.xs,{className:"py-1 h-8",children:e.isPlaceholder?null:(0,r.ie)(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,s.jsx)(n.RM,{children:c?(0,s.jsx)(n.SC,{children:(0,s.jsx)(n.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:m})})})}):h.getRowModel().rows.length>0?h.getRowModel().rows.map(e=>(0,s.jsxs)(a.Fragment,{children:[(0,s.jsx)(n.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,s.jsx)(n.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,r.ie)(e.column.columnDef.cell,e.getContext())},e.id))}),e.getIsExpanded()&&(0,s.jsx)(n.SC,{children:(0,s.jsx)(n.pj,{colSpan:e.getVisibleCells().length,className:"p-0",children:(0,s.jsx)("div",{className:"w-full max-w-full overflow-hidden box-border",children:d({row:e})})})})]},e.id)):(0,s.jsx)(n.SC,{children:(0,s.jsx)(n.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:u})})})})})]})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1200-72b27753cc974b47.js b/litellm/proxy/_experimental/out/_next/static/chunks/1200-72b27753cc974b47.js deleted file mode 100644 index 07e7706744..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1200-72b27753cc974b47.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1200],{90246:function(e,l,t){t.d(l,{n:function(){return s}});function s(e){let l=[e];return{all:l,lists:()=>[...l,"list"],list:e=>[...l,"list",{params:e}],details:()=>[...l,"detail"],detail:e=>[...l,"detail",e]}}},31200:function(e,l,t){t.d(l,{Z:function(){return lK}});var s=t(57437),a=t(29827),r=t(49804),i=t(67101),n=t(84264),o=t(2265),d=t(9114),c=t(19250),m=t(42673);let u=async(e,l,t)=>{try{var s,a;console.log("handling submit for formValues:",e);let l=e.model_mappings||[];if("model_mappings"in e&&delete e.model_mappings,e.model&&e.model.includes("all-wildcard")){let t=e.custom_llm_provider,a=(null!==(s=m.fK[t])&&void 0!==s?s:t.toLowerCase())+"/*";e.model_name=a,l.push({public_name:a,litellm_model:a}),e.model=a}let t=[];for(let s of l){let l={},r={},i=s.public_name;for(let[t,i]of(l.model=s.litellm_model,e.input_cost_per_token&&(e.input_cost_per_token=Number(e.input_cost_per_token)/1e6),e.output_cost_per_token&&(e.output_cost_per_token=Number(e.output_cost_per_token)/1e6),l.model=s.litellm_model,console.log("formValues add deployment:",e),Object.entries(e)))if(""!==i&&"custom_pricing"!==t&&"pricing_model"!==t&&"cache_control"!==t){if("model_name"==t)l.model=i;else if("custom_llm_provider"==t){console.log("custom_llm_provider:",i);let e=null!==(a=m.fK[i])&&void 0!==a?a:i.toLowerCase();l.custom_llm_provider=e,console.log("custom_llm_provider mappingResult:",e)}else if("model"==t)continue;else if("base_model"===t)r[t]=i;else if("team_id"===t)r.team_id=i;else if("model_access_group"===t)r.access_groups=i;else if("mode"==t)console.log("placing mode in modelInfo"),r.mode=i,delete l.mode;else if("custom_model_name"===t)l.model=i;else if("litellm_extra_params"==t){console.log("litellm_extra_params:",i);let e={};if(i&&void 0!=i){try{e=JSON.parse(i)}catch(e){throw d.Z.fromBackend("Failed to parse LiteLLM Extra Params: "+e),Error("Failed to parse litellm_extra_params: "+e)}for(let[t,s]of Object.entries(e))l[t]=s}}else if("model_info_params"==t){console.log("model_info_params:",i);let e={};if(i&&void 0!=i){try{e=JSON.parse(i)}catch(e){throw d.Z.fromBackend("Failed to parse LiteLLM Extra Params: "+e),Error("Failed to parse litellm_extra_params: "+e)}for(let[l,t]of Object.entries(e))r[l]=t}}else if("input_cost_per_token"===t||"output_cost_per_token"===t||"input_cost_per_second"===t){i&&(l[t]=Number(i));continue}else l[t]=i}t.push({litellmParamsObj:l,modelInfoObj:r,modelName:i})}return t}catch(e){d.Z.fromBackend("Failed to create model: "+e)}},h=async(e,l,t,s)=>{try{let a=await u(e,l,t);if(!a||0===a.length)return;for(let e of a){let{litellmParamsObj:t,modelInfoObj:s,modelName:a}=e,r={model_name:a,litellm_params:t,model_info:s},i=await (0,c.modelCreateCall)(l,r);console.log("response for model create call: ".concat(i.data))}s&&s(),t.resetFields()}catch(e){d.Z.fromBackend("Failed to add model: "+e)}};var x=t(11713),p=t(90246);let g=(0,p.n)("credentials"),f=e=>(0,x.a)({queryKey:g.list({}),queryFn:async()=>await (0,c.credentialListCall)(e),enabled:!!e}),j=(0,p.n)("models");(0,p.n)("modelHub");let v=(e,l,t)=>(0,x.a)({queryKey:j.list({filters:{...l&&{userID:l},...t&&{userRole:t}}}),queryFn:async()=>await (0,c.modelInfoCall)(e,l,t),enabled:!!(e&&l&&t)});var _=t(53410),y=t(74998),b=t(62490),N=t(10032),Z=t(21609),w=t(31283),C=t(57840),S=t(22116),k=t(37592),A=t(99981),E=t(5545);let M=(0,p.n)("providerFields"),I=()=>(0,x.a)({queryKey:M.list({}),queryFn:async()=>await (0,c.getProviderCreateMetadata)(),staleTime:864e5,gcTime:864e5});var F=t(3632),P=t(56522),L=t(47451),T=t(69410),R=t(65319);let{Link:O}=C.default,V=e=>{var l,t,s,a,r;let i="password"===e.field_type?"password":"select"===e.field_type?"select":"upload"===e.field_type?"upload":"text";return{key:e.key,label:e.label,placeholder:null!==(l=e.placeholder)&&void 0!==l?l:void 0,tooltip:null!==(t=e.tooltip)&&void 0!==t?t:void 0,required:null!==(s=e.required)&&void 0!==s&&s,type:i,options:null!==(a=e.options)&&void 0!==a?a:void 0,defaultValue:null!==(r=e.default_value)&&void 0!==r?r:void 0}},D={};var z=e=>{let{selectedProvider:l,uploadProps:t}=e,a=m.Cl[l],r=N.Z.useFormInstance(),{data:i,isLoading:n,error:d}=I(),c=o.useMemo(()=>{if(!i)return null;let e={};return i.forEach(l=>{let t=l.provider_display_name,s=l.credential_fields.map(V);e[t]=s,l.provider&&(e[l.provider]=s),l.litellm_provider&&(e[l.litellm_provider]=s)}),e},[i]);o.useEffect(()=>{c&&Object.assign(D,c)},[c]);let u=o.useMemo(()=>{var e;let t=null!==(e=D[a])&&void 0!==e?e:D[l];if(t)return t;if(!i)return[];let s=i.find(e=>e.provider_display_name===a||e.provider===l||e.litellm_provider===l);if(!s)return[];let r=s.credential_fields.map(V);return D[s.provider_display_name]=r,s.provider&&(D[s.provider]=r),s.litellm_provider&&(D[s.litellm_provider]=r),r},[a,l,i]),h={name:"file",accept:".json",beforeUpload:e=>{if("application/json"===e.type){let l=new FileReader;l.onload=e=>{if(e.target){let l=e.target.result;console.log("Setting field value from JSON, length: ".concat(l.length)),r.setFieldsValue({vertex_credentials:l}),console.log("Form values after setting:",r.getFieldsValue())}},l.readAsText(e)}return!1},onChange(e){console.log("Upload onChange triggered in ProviderSpecificFields"),console.log("Current form values:",r.getFieldsValue()),"uploading"!==e.file.status&&console.log(e.file,e.fileList)}};return(0,s.jsxs)(s.Fragment,{children:[n&&0===u.length&&(0,s.jsx)(L.Z,{children:(0,s.jsx)(T.Z,{span:24,children:(0,s.jsx)(P.x,{className:"mb-2",children:"Loading provider fields..."})})}),d&&0===u.length&&(0,s.jsx)(L.Z,{children:(0,s.jsx)(T.Z,{span:24,children:(0,s.jsx)(P.x,{className:"mb-2 text-red-500",children:d instanceof Error?d.message:"Failed to load provider credential fields"})})}),u.map(e=>{var l;return(0,s.jsxs)(o.Fragment,{children:[(0,s.jsx)(N.Z.Item,{label:e.label,name:e.key,rules:e.required?[{required:!0,message:"Required"}]:void 0,tooltip:e.tooltip,className:"vertex_credentials"===e.key?"mb-0":void 0,children:"select"===e.type?(0,s.jsx)(k.default,{placeholder:e.placeholder,defaultValue:e.defaultValue,children:null===(l=e.options)||void 0===l?void 0:l.map(e=>(0,s.jsx)(k.default.Option,{value:e,children:e},e))}):"upload"===e.type?(0,s.jsx)(R.default,{...h,onChange:l=>{(null==t?void 0:t.onChange)&&t.onChange(l),setTimeout(()=>{let l=r.getFieldValue(e.key);console.log("".concat(e.key," value after upload:"),JSON.stringify(l))},500)},children:(0,s.jsx)(E.ZP,{icon:(0,s.jsx)(F.Z,{}),children:"Click to Upload"})}):(0,s.jsx)(P.o,{placeholder:e.placeholder,type:"password"===e.type?"password":"text",defaultValue:e.defaultValue})}),"vertex_credentials"===e.key&&(0,s.jsx)(L.Z,{children:(0,s.jsx)(T.Z,{children:(0,s.jsx)(P.x,{className:"mb-3 mt-1",children:"Give a gcp service account(.json file)"})})}),"base_model"===e.key&&(0,s.jsxs)(L.Z,{children:[(0,s.jsx)(T.Z,{span:10}),(0,s.jsx)(T.Z,{span:10,children:(0,s.jsxs)(P.x,{className:"mb-2",children:["The actual model your azure deployment uses. Used for accurate cost tracking. Select name from"," ",(0,s.jsx)(O,{href:"https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json",target:"_blank",children:"here"})]})})]})]},e.key)})]})};let{Link:q}=C.default;var B=e=>{let{open:l,onCancel:t,onAddCredential:a,uploadProps:r}=e,[i]=N.Z.useForm(),[n,d]=(0,o.useState)(m.Cl.OpenAI);return(0,s.jsx)(S.Z,{title:"Add New Credential",open:l,onCancel:()=>{t(),i.resetFields()},footer:null,width:600,children:(0,s.jsxs)(N.Z,{form:i,onFinish:e=>{a(Object.entries(e).reduce((e,l)=>{let[t,s]=l;return""!==s&&null!=s&&(e[t]=s),e},{})),i.resetFields()},layout:"vertical",children:[(0,s.jsx)(N.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],children:(0,s.jsx)(w.o,{placeholder:"Enter a friendly name for these credentials"})}),(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"Helper to auto-populate provider specific fields",children:(0,s.jsx)(k.default,{showSearch:!0,onChange:e=>{d(e),i.setFieldValue("custom_llm_provider",e)},children:Object.entries(m.Cl).map(e=>{let[l,t]=e;return(0,s.jsx)(k.default.Option,{value:l,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("img",{src:m.cd[t],alt:"".concat(l," logo"),className:"w-5 h-5",onError:e=>{let l=e.target,s=l.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,l)}}}),(0,s.jsx)("span",{children:t})]})},l)})})}),(0,s.jsx)(z,{selectedProvider:n,uploadProps:r}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(q,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E.ZP,{onClick:()=>{t(),i.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(E.ZP,{htmlType:"submit",children:"Add Credential"})]})]})]})})};let{Link:U}=C.default;function G(e){let{open:l,onCancel:t,onUpdateCredential:a,uploadProps:r,existingCredential:i}=e,[n]=N.Z.useForm(),[d,c]=(0,o.useState)(m.Cl.Anthropic);return(0,o.useEffect)(()=>{if(i){let e=Object.entries(i.credential_values||{}).reduce((e,l)=>{let[t,s]=l;return e[t]=null!=s?s:null,e},{});n.setFieldsValue({credential_name:i.credential_name,custom_llm_provider:i.credential_info.custom_llm_provider,...e}),c(i.credential_info.custom_llm_provider)}},[i]),(0,s.jsx)(S.Z,{title:"Edit Credential",open:l,onCancel:()=>{t(),n.resetFields()},footer:null,width:600,destroyOnHidden:!0,children:(0,s.jsxs)(N.Z,{form:n,onFinish:e=>{a(Object.entries(e).reduce((e,l)=>{let[t,s]=l;return""!==s&&null!=s&&(e[t]=s),e},{})),n.resetFields()},layout:"vertical",children:[(0,s.jsx)(N.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],initialValue:null==i?void 0:i.credential_name,children:(0,s.jsx)(w.o,{placeholder:"Enter a friendly name for these credentials",disabled:null!=i&&!!i.credential_name})}),(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"Helper to auto-populate provider specific fields",children:(0,s.jsx)(k.default,{showSearch:!0,onChange:e=>{c(e),n.setFieldValue("custom_llm_provider",e)},children:Object.entries(m.Cl).map(e=>{let[l,t]=e;return(0,s.jsx)(k.default.Option,{value:l,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("img",{src:m.cd[t],alt:"".concat(l," logo"),className:"w-5 h-5",onError:e=>{let l=e.target,s=l.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,l)}}}),(0,s.jsx)("span",{children:t})]})},l)})})}),(0,s.jsx)(z,{selectedProvider:d,uploadProps:r}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(U,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E.ZP,{onClick:()=>{t(),n.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(E.ZP,{htmlType:"submit",children:"Update Credential"})]})]})]})})}var H=t(39760),K=e=>{var l;let{uploadProps:t}=e,{accessToken:a}=(0,H.Z)(),{data:r,refetch:i}=f(a),n=(null==r?void 0:r.credentials)||[],[m,u]=(0,o.useState)(!1),[h,x]=(0,o.useState)(!1),[p,g]=(0,o.useState)(null),[j,v]=(0,o.useState)(null),[w,C]=(0,o.useState)(!1),[S,k]=(0,o.useState)(!1),[A]=N.Z.useForm(),E=["credential_name","custom_llm_provider"],M=async e=>{if(!a)return;let l=Object.entries(e).filter(e=>{let[l]=e;return!E.includes(l)}).reduce((e,l)=>{let[t,s]=l;return{...e,[t]:s}},{}),t={credential_name:e.credential_name,credential_values:l,credential_info:{custom_llm_provider:e.custom_llm_provider}};await (0,c.credentialUpdateCall)(a,e.credential_name,t),d.Z.success("Credential updated successfully"),x(!1),await i()},I=async e=>{if(!a)return;let l=Object.entries(e).filter(e=>{let[l]=e;return!E.includes(l)}).reduce((e,l)=>{let[t,s]=l;return{...e,[t]:s}},{}),t={credential_name:e.credential_name,credential_values:l,credential_info:{custom_llm_provider:e.custom_llm_provider}};await (0,c.credentialCreateCall)(a,t),d.Z.success("Credential added successfully"),u(!1),await i()},F=e=>{let l={openai:"blue",azure:"indigo",anthropic:"purple",default:"gray"},t=l[e.toLowerCase()]||l.default;return(0,s.jsx)(b.Ct,{color:t,size:"xs",children:e})},P=async()=>{if(a&&j){k(!0);try{await (0,c.credentialDeleteCall)(a,j.credential_name),d.Z.success("Credential deleted successfully"),await i()}catch(e){d.Z.error("Failed to delete credential")}finally{v(null),C(!1),k(!1)}}},L=e=>{v(e),C(!0)};return(0,s.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto p-2",children:[(0,s.jsx)(b.zx,{onClick:()=>u(!0),children:"Add Credential"}),(0,s.jsx)("div",{className:"flex justify-between items-center mt-4 mb-4",children:(0,s.jsx)(b.xv,{children:"Configured credentials for different AI providers. Add and manage your API credentials."})}),(0,s.jsx)(b.Zb,{children:(0,s.jsxs)(b.iA,{children:[(0,s.jsx)(b.ss,{children:(0,s.jsxs)(b.SC,{children:[(0,s.jsx)(b.xs,{children:"Credential Name"}),(0,s.jsx)(b.xs,{children:"Provider"}),(0,s.jsx)(b.xs,{children:"Actions"})]})}),(0,s.jsx)(b.RM,{children:n&&0!==n.length?n.map((e,l)=>{var t;return(0,s.jsxs)(b.SC,{children:[(0,s.jsx)(b.pj,{children:e.credential_name}),(0,s.jsx)(b.pj,{children:F((null===(t=e.credential_info)||void 0===t?void 0:t.custom_llm_provider)||"-")}),(0,s.jsxs)(b.pj,{children:[(0,s.jsx)(b.zx,{icon:_.Z,variant:"light",size:"sm",onClick:()=>{g(e),x(!0)}}),(0,s.jsx)(b.zx,{icon:y.Z,variant:"light",size:"sm",onClick:()=>L(e),className:"ml-2"})]})]},l)}):(0,s.jsx)(b.SC,{children:(0,s.jsx)(b.pj,{colSpan:4,className:"text-center py-4 text-gray-500",children:"No credentials configured"})})})]})}),m&&(0,s.jsx)(B,{onAddCredential:I,open:m,onCancel:()=>u(!1),uploadProps:t}),h&&(0,s.jsx)(G,{open:h,existingCredential:p,onUpdateCredential:M,uploadProps:t,onCancel:()=>x(!1)}),(0,s.jsx)(Z.Z,{isOpen:w,onCancel:()=>{v(null),C(!1)},onOk:P,title:"Delete Credential?",message:"Are you sure you want to delete this credential? This action cannot be undone and may break existing integrations.",resourceInformationTitle:"Credential Information",resourceInformation:[{label:"Credential Name",value:null==j?void 0:j.credential_name},{label:"Provider",value:(null==j?void 0:null===(l=j.credential_info)||void 0===l?void 0:l.custom_llm_provider)||"-"}],confirmLoading:S,requiredConfirmation:null==j?void 0:j.credential_name})]})};let J=e=>{var l;return(null==e?void 0:null===(l=e.model_info)||void 0===l?void 0:l.team_public_model_name)?e.model_info.team_public_model_name:(null==e?void 0:e.model_name)||"-"};var W=t(23628),Y=t(47323),$=t(12485),Q=t(18135),X=t(35242),ee=t(29706),el=t(77991),et=t(20347),es=t(59341),ea=t(5945),er=t(84376),ei=t(29),en=t.n(ei),eo=t(23496),ed=t(35291),ec=t(23639),em=t(15424);let{Text:eu}=C.default;var eh=e=>{let{formValues:l,accessToken:t,testMode:a,modelName:r="this model",onClose:i,onTestComplete:n}=e,[m,h]=o.useState(null),[x,p]=o.useState(null),[g,f]=o.useState(null),[j,v]=o.useState(!0),[_,y]=o.useState(!1),[b,N]=o.useState(!1),Z=async()=>{v(!0),N(!1),h(null),p(null),f(null),y(!1),await new Promise(e=>setTimeout(e,100));try{console.log("Testing connection with form values:",l);let a=await u(l,t,null);if(!a){console.log("No result from prepareModelAddRequest"),h("Failed to prepare model data. Please check your form inputs."),y(!1),v(!1);return}console.log("Result from prepareModelAddRequest:",a);let{litellmParamsObj:r,modelInfoObj:i,modelName:n}=a[0],o=await (0,c.testConnectionRequest)(t,r,i,null==i?void 0:i.mode);if("success"===o.status)d.Z.success("Connection test successful!"),h(null),y(!0);else{var e,s;let l=(null===(e=o.result)||void 0===e?void 0:e.error)||o.message||"Unknown error";h(l),p(r),f(null===(s=o.result)||void 0===s?void 0:s.raw_request_typed_dict),y(!1)}}catch(e){console.error("Test connection error:",e),h(e instanceof Error?e.message:String(e)),y(!1)}finally{v(!1),n&&n()}};o.useEffect(()=>{let e=setTimeout(()=>{Z()},200);return()=>clearTimeout(e)},[]);let w=e=>e?e.split("stack trace:")[0].trim().replace(/^litellm\.(.*?)Error: /,""):"Unknown error",C="string"==typeof m?w(m):(null==m?void 0:m.message)?w(m.message):"Unknown error",S=g?((e,l,t)=>{let s=JSON.stringify(l,null,2).split("\n").map(e=>" ".concat(e)).join("\n"),a=Object.entries(t).map(e=>{let[l,t]=e;return"-H '".concat(l,": ").concat(t,"'")}).join(" \\\n ");return"curl -X POST \\\n ".concat(e," \\\n ").concat(a?"".concat(a," \\\n "):"","-H 'Content-Type: application/json' \\\n -d '{\n").concat(s,"\n }'")})(g.raw_request_api_base,g.raw_request_body,g.raw_request_headers||{}):"";return(0,s.jsxs)("div",{style:{padding:"24px",borderRadius:"8px",backgroundColor:"#fff"},children:[j?(0,s.jsxs)("div",{style:{textAlign:"center",padding:"32px 20px"},className:"jsx-dc9a0e2d897fe63b",children:[(0,s.jsx)("div",{style:{marginBottom:"16px"},className:"jsx-dc9a0e2d897fe63b loading-spinner",children:(0,s.jsx)("div",{style:{border:"3px solid #f3f3f3",borderTop:"3px solid #1890ff",borderRadius:"50%",width:"30px",height:"30px",animation:"spin 1s linear infinite",margin:"0 auto"},className:"jsx-dc9a0e2d897fe63b"})}),(0,s.jsxs)(eu,{style:{fontSize:"16px"},children:["Testing connection to ",r,"..."]}),(0,s.jsx)(en(),{id:"dc9a0e2d897fe63b",children:"@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg);transform:rotate(0deg)}100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);-moz-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}"})]}):_?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 20px"},children:[(0,s.jsx)("div",{style:{color:"#52c41a",fontSize:"24px",display:"flex",alignItems:"center"},children:(0,s.jsx)("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"check-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"})})}),(0,s.jsxs)(eu,{type:"success",style:{fontSize:"18px",fontWeight:500,marginLeft:"10px"},children:["Connection to ",r," successful!"]})]}):(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"20px"},children:[(0,s.jsx)(ed.Z,{style:{color:"#ff4d4f",fontSize:"24px",marginRight:"12px"}}),(0,s.jsxs)(eu,{type:"danger",style:{fontSize:"18px",fontWeight:500},children:["Connection to ",r," failed"]})]}),(0,s.jsxs)("div",{style:{backgroundColor:"#fff2f0",border:"1px solid #ffccc7",borderRadius:"8px",padding:"16px",marginBottom:"20px",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.03)"},children:[(0,s.jsxs)(eu,{strong:!0,style:{display:"block",marginBottom:"8px"},children:["Error:"," "]}),(0,s.jsx)(eu,{type:"danger",style:{fontSize:"14px",lineHeight:"1.5"},children:C}),m&&(0,s.jsx)("div",{style:{marginTop:"12px"},children:(0,s.jsx)(E.ZP,{type:"link",onClick:()=>N(!b),style:{paddingLeft:0,height:"auto"},children:b?"Hide Details":"Show Details"})})]}),b&&(0,s.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,s.jsx)(eu,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"Troubleshooting Details"}),(0,s.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"200px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5"},children:"string"==typeof m?m:JSON.stringify(m,null,2)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(eu,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"API Request"}),(0,s.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"250px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5"},children:S||"No request data available"}),(0,s.jsx)(E.ZP,{style:{marginTop:"8px"},icon:(0,s.jsx)(ec.Z,{}),onClick:()=>{navigator.clipboard.writeText(S||""),d.Z.success("Copied to clipboard")},children:"Copy to Clipboard"})]})]})}),(0,s.jsx)(eo.Z,{style:{margin:"24px 0 16px"}}),(0,s.jsx)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:(0,s.jsx)(E.ZP,{type:"link",href:"https://docs.litellm.ai/docs/providers",target:"_blank",icon:(0,s.jsx)(em.Z,{}),children:"View Documentation"})})]})};let ex=async(e,l,t,s)=>{try{console.log("=== AUTO ROUTER SUBMIT HANDLER CALLED ==="),console.log("handling auto router submit for formValues:",e),console.log("Access token:",l?"Present":"Missing"),console.log("Form:",t?"Present":"Missing"),console.log("Callback:",s?"Present":"Missing");let a={model_name:e.auto_router_name,litellm_params:{model:"auto_router/".concat(e.auto_router_name),auto_router_config:JSON.stringify(e.auto_router_config),auto_router_default_model:e.auto_router_default_model},model_info:{}};e.auto_router_embedding_model&&"custom"!==e.auto_router_embedding_model?a.litellm_params.auto_router_embedding_model=e.auto_router_embedding_model:e.custom_embedding_model&&(a.litellm_params.auto_router_embedding_model=e.custom_embedding_model),e.team_id&&(a.model_info.team_id=e.team_id),e.model_access_group&&e.model_access_group.length>0&&(a.model_info.access_groups=e.model_access_group),console.log("Auto router configuration to be created:",a),console.log("Auto router config (stringified):",a.litellm_params.auto_router_config),console.log("Calling modelCreateCall with:",{accessToken:l?"Present":"Missing",config:a});let r=await (0,c.modelCreateCall)(l,a);console.log("response for auto router create call:",r),t.resetFields()}catch(e){console.error("Failed to add auto router:",e),d.Z.fromBackend("Failed to add auto router: "+e)}};var ep=t(10703),eg=t(4260),ef=t(44851),ej=t(19015),ev=t(96473),e_=t(70464),ey=t(26349),eb=t(92280);let{TextArea:eN}=eg.default,{Panel:eZ}=ef.default;var ew=e=>{let{modelInfo:l,value:t,onChange:a}=e,[r,i]=(0,o.useState)([]),[n,d]=(0,o.useState)(!1),[c,m]=(0,o.useState)([]);(0,o.useEffect)(()=>{if(null==t?void 0:t.routes){let e=t.routes.map((e,l)=>({id:e.id||"route-".concat(l,"-").concat(Date.now()),model:e.name||e.model||"",utterances:e.utterances||[],description:e.description||"",score_threshold:e.score_threshold||.5}));i(e),m(e.map(e=>e.id))}else i([]),m([])},[t]);let u=e=>{let l=r.filter(l=>l.id!==e);i(l),x(l),m(l=>l.filter(l=>l!==e))},h=(e,l,t)=>{let s=r.map(s=>s.id===e?{...s,[l]:t}:s);i(s),x(s)},x=e=>{let l={routes:e.map(e=>({name:e.model,utterances:e.utterances,description:e.description,score_threshold:e.score_threshold}))};null==a||a(l)},p=l.map(e=>({value:e.model_group,label:e.model_group}));return(0,s.jsxs)("div",{className:"w-full max-w-none",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-6 w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(eb.x,{className:"text-lg font-semibold",children:"Routes Configuration"}),(0,s.jsx)(A.Z,{title:"Configure routing logic to automatically select the best model based on user input patterns",children:(0,s.jsx)(em.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(E.ZP,{type:"primary",icon:(0,s.jsx)(ev.Z,{}),onClick:()=>{let e="route-".concat(Date.now()),l=[...r,{id:e,model:"",utterances:[],description:"",score_threshold:.5}];i(l),x(l),m(l=>[...l,e])},className:"bg-blue-600 hover:bg-blue-700",children:"Add Route"})]}),0===r.length?(0,s.jsx)("div",{className:"text-center py-12 text-gray-500 bg-gray-50 rounded-lg border-2 border-dashed border-gray-200 mb-6",children:(0,s.jsx)(eb.x,{children:"No routes configured. Click “Add Route” to get started."})}):(0,s.jsx)("div",{className:"space-y-3 mb-6 w-full",children:r.map((e,l)=>(0,s.jsx)(ea.Z,{className:"border border-gray-200 shadow-sm w-full",bodyStyle:{padding:0},children:(0,s.jsx)(ef.default,{ghost:!0,expandIcon:e=>{let{isActive:l}=e;return(0,s.jsx)(e_.Z,{rotate:l?180:0})},activeKey:c,onChange:e=>m(Array.isArray(e)?e:[e].filter(Boolean)),items:[{key:e.id,label:(0,s.jsxs)("div",{className:"flex justify-between items-center py-2",children:[(0,s.jsxs)(eb.x,{className:"font-medium text-base",children:["Route ",l+1,": ",e.model||"Unnamed"]}),(0,s.jsx)(E.ZP,{type:"text",danger:!0,icon:(0,s.jsx)(ey.Z,{}),onClick:l=>{l.stopPropagation(),u(e.id)},className:"mr-2"})]}),children:(0,s.jsxs)("div",{className:"px-6 pb-6 w-full",children:[(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsx)(eb.x,{className:"text-sm font-medium mb-2 block",children:"Model"}),(0,s.jsx)(k.default,{value:e.model,onChange:l=>h(e.id,"model",l),placeholder:"Select model",showSearch:!0,style:{width:"100%"},options:p})]}),(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsx)(eb.x,{className:"text-sm font-medium mb-2 block",children:"Description"}),(0,s.jsx)(eN,{value:e.description,onChange:l=>h(e.id,"description",l.target.value),placeholder:"Describe when this route should be used...",rows:2,style:{width:"100%"}})]}),(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)(eb.x,{className:"text-sm font-medium",children:"Score Threshold"}),(0,s.jsx)(A.Z,{title:"Minimum similarity score to route to this model (0-1)",children:(0,s.jsx)(em.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(ej.Z,{value:e.score_threshold,onChange:l=>h(e.id,"score_threshold",l||0),min:0,max:1,step:.1,style:{width:"100%"},placeholder:"0.5"})]}),(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)(eb.x,{className:"text-sm font-medium",children:"Example Utterances"}),(0,s.jsx)(A.Z,{title:"Training examples for this route. Type an utterance and press Enter to add it.",children:(0,s.jsx)(em.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(eb.x,{className:"text-xs text-gray-500 mb-2",children:"Type an utterance and press Enter to add it. You can also paste multiple lines."}),(0,s.jsx)(k.default,{mode:"tags",value:e.utterances,onChange:l=>h(e.id,"utterances",l),placeholder:"Type an utterance and press Enter...",style:{width:"100%"},tokenSeparators:["\n"],maxTagCount:"responsive",allowClear:!0})]})]})}]})},e.id))}),(0,s.jsxs)("div",{className:"border-t pt-6 w-full",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4 w-full",children:[(0,s.jsx)(eb.x,{className:"text-lg font-semibold",children:"JSON Preview"}),(0,s.jsx)(E.ZP,{type:"link",onClick:()=>d(!n),className:"text-blue-600 p-0",children:n?"Hide":"Show"})]}),n&&(0,s.jsx)(ea.Z,{className:"bg-gray-50 w-full",children:(0,s.jsx)("pre",{className:"text-sm overflow-auto max-h-64 w-full",children:JSON.stringify({routes:r.map(e=>({name:e.model,utterances:e.utterances,description:e.description,score_threshold:e.score_threshold}))},null,2)})})]})]})};let{Title:eC,Link:eS}=C.default;var ek=e=>{let{form:l,handleOk:t,accessToken:a,userRole:r}=e,[i,n]=(0,o.useState)(!1),[m,u]=(0,o.useState)(!1),[h,x]=(0,o.useState)(""),[p,g]=(0,o.useState)([]),[f,j]=(0,o.useState)([]),[v,_]=(0,o.useState)(!1),[y,b]=(0,o.useState)(!1),[Z,w]=(0,o.useState)(null);(0,o.useEffect)(()=>{(async()=>{g((await (0,c.modelAvailableCall)(a,"","",!1,null,!0,!0)).data.map(e=>e.id))})()},[a]),(0,o.useEffect)(()=>{(async()=>{try{let e=await (0,ep.p)(a);console.log("Fetched models for auto router:",e),j(e)}catch(e){console.error("Error fetching model info for auto router:",e)}})()},[a]);let M=et.ZL.includes(r),I=async()=>{u(!0),x("test-".concat(Date.now())),n(!0)},F=()=>{console.log("Auto router submit triggered!"),console.log("Router config:",Z);let e=l.getFieldsValue();if(console.log("Form values:",e),!e.auto_router_name){d.Z.fromBackend("Please enter an Auto Router Name");return}if(!e.auto_router_default_model){d.Z.fromBackend("Please select a Default Model");return}if(l.setFieldsValue({custom_llm_provider:"auto_router",model:e.auto_router_name,api_key:"not_required_for_auto_router"}),!Z||!Z.routes||0===Z.routes.length){d.Z.fromBackend("Please configure at least one route for the auto router");return}if(Z.routes.filter(e=>!e.name||!e.description||0===e.utterances.length).length>0){d.Z.fromBackend("Please ensure all routes have a target model, description, and at least one utterance");return}l.validateFields().then(e=>{console.log("Form validation passed, submitting with values:",e);let s={...e,auto_router_config:Z};console.log("Final submit values:",s),ex(s,a,l,t)}).catch(e=>{console.error("Validation failed:",e);let l=e.errorFields||[];if(l.length>0){let e=l.map(e=>{let l=e.name[0];return({auto_router_name:"Auto Router Name",auto_router_default_model:"Default Model",auto_router_embedding_model:"Embedding Model"})[l]||l});d.Z.fromBackend("Please fill in the following required fields: ".concat(e.join(", ")))}else d.Z.fromBackend("Please fill in all required fields")})};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eC,{level:2,children:"Add Auto Router"}),(0,s.jsx)(P.x,{className:"text-gray-600 mb-6",children:"Create an auto router with intelligent routing logic that automatically selects the best model based on user input patterns and semantic matching."}),(0,s.jsx)(ea.Z,{children:(0,s.jsxs)(N.Z,{form:l,onFinish:F,labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:[(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Auto router name is required"}],label:"Auto Router Name",name:"auto_router_name",tooltip:"Unique name for this auto router configuration",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(P.o,{placeholder:"e.g., auto_router_1, smart_routing"})}),(0,s.jsx)("div",{className:"w-full mb-4",children:(0,s.jsx)(ew,{modelInfo:f,value:Z,onChange:e=>{w(e),l.setFieldValue("auto_router_config",e)}})}),(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Default model is required"}],label:"Default Model",name:"auto_router_default_model",tooltip:"Fallback model to use when auto routing logic cannot determine the best model",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(k.default,{placeholder:"Select a default model",onChange:e=>{_("custom"===e)},options:[...Array.from(new Set(f.map(e=>e.model_group))).map(e=>({value:e,label:e})),{value:"custom",label:"Enter custom model name"}],style:{width:"100%"},showSearch:!0})}),(0,s.jsx)(N.Z.Item,{label:"Embedding Model",name:"auto_router_embedding_model",tooltip:"Optional: Embedding model to use for semantic routing decisions",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(k.default,{value:l.getFieldValue("auto_router_embedding_model"),placeholder:"Select an embedding model (optional)",onChange:e=>{b("custom"===e),l.setFieldValue("auto_router_embedding_model",e)},options:[...Array.from(new Set(f.map(e=>e.model_group))).map(e=>({value:e,label:e})),{value:"custom",label:"Enter custom model name"}],style:{width:"100%"},showSearch:!0,allowClear:!0})}),(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"Additional Settings"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),M&&(0,s.jsx)(N.Z.Item,{label:"Model Access Group",name:"model_access_group",className:"mb-4",tooltip:"Use model access groups to control who can access this auto router",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:p.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})}),(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(C.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{className:"space-x-2",children:[(0,s.jsx)(E.ZP,{onClick:I,loading:m,children:"Test Connect"}),(0,s.jsx)(E.ZP,{onClick:()=>{console.log("Add Auto Router button clicked!"),console.log("Current router config:",Z),console.log("Current form values:",l.getFieldsValue()),F()},children:"Add Auto Router"})]})]})]})}),(0,s.jsx)(S.Z,{title:"Connection Test Results",open:i,onCancel:()=>{n(!1),u(!1)},footer:[(0,s.jsx)(E.ZP,{onClick:()=>{n(!1),u(!1)},children:"Close"},"close")],width:700,children:i&&(0,s.jsx)(eh,{formValues:l.getFieldsValue(),accessToken:a,testMode:"chat",modelName:l.getFieldValue("auto_router_name"),onClose:()=>{n(!1),u(!1)},onTestComplete:()=>u(!1)},h)})]})};let eA=[{value:"chat",label:"Chat - /chat/completions"},{value:"completion",label:"Completion - /completions"},{value:"embedding",label:"Embedding - /embeddings"},{value:"audio_speech",label:"Audio Speech - /audio/speech"},{value:"audio_transcription",label:"Audio Transcription - /audio/transcriptions"},{value:"image_generation",label:"Image Generation - /images/generations"},{value:"video_generation",label:"Video Generation - /videos"},{value:"rerank",label:"Rerank - /rerank"},{value:"realtime",label:"Realtime - /realtime"},{value:"batch",label:"Batch - /batch"},{value:"ocr",label:"OCR - /ocr"}];var eE=t(63709),eM=t(26210),eI=t(34766),eF=t(45246),eP=t(24199);let{Text:eL}=C.default;var eT=e=>{let{form:l,showCacheControl:t,onCacheControlChange:a}=e,r=e=>{let t=l.getFieldValue("litellm_extra_params");try{let s=t?JSON.parse(t):{};e.length>0?s.cache_control_injection_points=e:delete s.cache_control_injection_points,Object.keys(s).length>0?l.setFieldValue("litellm_extra_params",JSON.stringify(s,null,2)):l.setFieldValue("litellm_extra_params","")}catch(e){console.error("Error updating cache control points:",e)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(N.Z.Item,{label:"Cache Control Injection Points",name:"cache_control",valuePropName:"checked",className:"mb-4",tooltip:"Tell litellm where to inject cache control checkpoints. You can specify either by role (to apply to all messages of that role) or by specific message index.",children:(0,s.jsx)(eE.Z,{onChange:a,className:"bg-gray-600"})}),t&&(0,s.jsxs)("div",{className:"ml-6 pl-4 border-l-2 border-gray-200",children:[(0,s.jsx)(eL,{className:"text-sm text-gray-500 block mb-4",children:"Providers like Anthropic, Bedrock API require users to specify where to inject cache control checkpoints, litellm can automatically add them for you as a cost saving feature."}),(0,s.jsx)(N.Z.List,{name:"cache_control_injection_points",initialValue:[{location:"message"}],children:(e,t)=>{let{add:a,remove:i}=t;return(0,s.jsxs)(s.Fragment,{children:[e.map((t,a)=>(0,s.jsxs)("div",{className:"flex items-center mb-4 gap-4",children:[(0,s.jsx)(N.Z.Item,{...t,label:"Type",name:[t.name,"location"],initialValue:"message",className:"mb-0",style:{width:"180px"},children:(0,s.jsx)(k.default,{disabled:!0,options:[{value:"message",label:"Message"}]})}),(0,s.jsx)(N.Z.Item,{...t,label:"Role",name:[t.name,"role"],className:"mb-0",style:{width:"180px"},tooltip:"LiteLLM will mark all messages of this role as cacheable",children:(0,s.jsx)(k.default,{placeholder:"Select a role",allowClear:!0,options:[{value:"user",label:"User"},{value:"system",label:"System"},{value:"assistant",label:"Assistant"}],onChange:()=>{r(l.getFieldValue("cache_control_points"))}})}),(0,s.jsx)(N.Z.Item,{...t,label:"Index",name:[t.name,"index"],className:"mb-0",style:{width:"180px"},tooltip:"(Optional) If set litellm will mark the message at this index as cacheable",children:(0,s.jsx)(eP.Z,{type:"number",placeholder:"Optional",step:1,onChange:()=>{r(l.getFieldValue("cache_control_points"))}})}),e.length>1&&(0,s.jsx)(eF.Z,{className:"text-red-500 cursor-pointer text-lg ml-12",onClick:()=>{i(t.name),setTimeout(()=>{r(l.getFieldValue("cache_control_points"))},0)}})]},t.key)),(0,s.jsx)(N.Z.Item,{children:(0,s.jsxs)("button",{type:"button",className:"flex items-center justify-center w-full border border-dashed border-gray-300 py-2 px-4 text-gray-600 hover:text-blue-600 hover:border-blue-300 transition-all rounded",onClick:()=>a(),children:[(0,s.jsx)(ev.Z,{className:"mr-2"}),"Add Injection Point"]})})]})}})]})]})},eR=t(9309);let{Link:eO}=C.default;var eV=e=>{let{showAdvancedSettings:l,setShowAdvancedSettings:t,teams:a,guardrailsList:r,tagsList:i}=e,[n]=N.Z.useForm(),[d,c]=o.useState(!1),[m,u]=o.useState("per_token"),[h,x]=o.useState(!1),p=(e,l)=>l&&(isNaN(Number(l))||0>Number(l))?Promise.reject("Please enter a valid positive number"):Promise.resolve();return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)(eM.UQ,{className:"mt-2 mb-4",children:[(0,s.jsx)(eM._m,{children:(0,s.jsx)("b",{children:"Advanced Settings"})}),(0,s.jsx)(eM.X1,{children:(0,s.jsxs)("div",{className:"bg-white rounded-lg",children:[(0,s.jsx)(N.Z.Item,{label:"Custom Pricing",name:"custom_pricing",valuePropName:"checked",className:"mb-4",children:(0,s.jsx)(eE.Z,{onChange:e=>{c(e),e||n.setFieldsValue({input_cost_per_token:void 0,output_cost_per_token:void 0,input_cost_per_second:void 0})},className:"bg-gray-600"})}),(0,s.jsx)(N.Z.Item,{label:(0,s.jsxs)("span",{children:["Guardrails"," ",(0,s.jsx)(A.Z,{title:"Apply safety guardrails to this key to filter content or enforce policies",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(em.Z,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-4",help:"Select existing guardrails. Go to 'Guardrails' tab to create new guardrails.",children:(0,s.jsx)(k.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter guardrails",options:r.map(e=>({value:e,label:e}))})}),(0,s.jsx)(N.Z.Item,{label:"Tags",name:"tags",className:"mb-4",children:(0,s.jsx)(k.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter tags",options:Object.values(i).map(e=>({value:e.name,label:e.name,title:e.description||e.name}))})}),d&&(0,s.jsxs)("div",{className:"ml-6 pl-4 border-l-2 border-gray-200",children:[(0,s.jsx)(N.Z.Item,{label:"Pricing Model",name:"pricing_model",className:"mb-4",children:(0,s.jsx)(k.default,{defaultValue:"per_token",onChange:e=>u(e),options:[{value:"per_token",label:"Per Million Tokens"},{value:"per_second",label:"Per Second"}]})}),"per_token"===m?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(N.Z.Item,{label:"Input Cost (per 1M tokens)",name:"input_cost_per_token",rules:[{validator:p}],className:"mb-4",children:(0,s.jsx)(eM.oi,{})}),(0,s.jsx)(N.Z.Item,{label:"Output Cost (per 1M tokens)",name:"output_cost_per_token",rules:[{validator:p}],className:"mb-4",children:(0,s.jsx)(eM.oi,{})})]}):(0,s.jsx)(N.Z.Item,{label:"Cost Per Second",name:"input_cost_per_second",rules:[{validator:p}],className:"mb-4",children:(0,s.jsx)(eM.oi,{})})]}),(0,s.jsx)(N.Z.Item,{label:"Use in pass through routes",name:"use_in_pass_through",valuePropName:"checked",className:"mb-4 mt-4",tooltip:(0,s.jsxs)("span",{children:["Allow using these credentials in pass through routes."," ",(0,s.jsx)(eO,{href:"https://docs.litellm.ai/docs/pass_through/vertex_ai",target:"_blank",children:"Learn more"})]}),children:(0,s.jsx)(eE.Z,{onChange:e=>{let l=n.getFieldValue("litellm_extra_params");try{let t=l?JSON.parse(l):{};e?t.use_in_pass_through=!0:delete t.use_in_pass_through,Object.keys(t).length>0?n.setFieldValue("litellm_extra_params",JSON.stringify(t,null,2)):n.setFieldValue("litellm_extra_params","")}catch(l){e?n.setFieldValue("litellm_extra_params",JSON.stringify({use_in_pass_through:!0},null,2)):n.setFieldValue("litellm_extra_params","")}},className:"bg-gray-600"})}),(0,s.jsx)(eT,{form:n,showCacheControl:h,onCacheControlChange:e=>{if(x(e),!e){let e=n.getFieldValue("litellm_extra_params");try{let l=e?JSON.parse(e):{};delete l.cache_control_injection_points,Object.keys(l).length>0?n.setFieldValue("litellm_extra_params",JSON.stringify(l,null,2)):n.setFieldValue("litellm_extra_params","")}catch(e){n.setFieldValue("litellm_extra_params","")}}}}),(0,s.jsx)(N.Z.Item,{label:"LiteLLM Params",name:"litellm_extra_params",tooltip:"Optional litellm params used for making a litellm.completion() call.",className:"mb-4 mt-4",rules:[{validator:eR.Ac}],children:(0,s.jsx)(eI.Z,{rows:4,placeholder:'{ "rpm": 100, "timeout": 0, "stream_timeout": 0 }'})}),(0,s.jsxs)(L.Z,{className:"mb-4",children:[(0,s.jsx)(T.Z,{span:10}),(0,s.jsx)(T.Z,{span:10,children:(0,s.jsxs)(eM.xv,{className:"text-gray-600 text-sm",children:["Pass JSON of litellm supported params"," ",(0,s.jsx)(eO,{href:"https://docs.litellm.ai/docs/completion/input",target:"_blank",children:"litellm.completion() call"})]})})]}),(0,s.jsx)(N.Z.Item,{label:"Model Info",name:"model_info_params",tooltip:"Optional model info params. Returned when calling `/model/info` endpoint.",className:"mb-0",rules:[{validator:eR.Ac}],children:(0,s.jsx)(eI.Z,{rows:4,placeholder:'{ "mode": "chat" }'})})]})})]})})},eD=t(56609),ez=t(67187);let eq=e=>{let{content:l,children:t,width:a="auto",className:r=""}=e,[i,n]=(0,o.useState)(!1),[d,c]=(0,o.useState)("top"),m=(0,o.useRef)(null),u=()=>{if(m.current){let e=m.current.getBoundingClientRect(),l=e.top,t=window.innerHeight-e.bottom;l<300&&t>300?c("bottom"):c("top")}};return(0,s.jsxs)("div",{className:"relative inline-block",ref:m,children:[t||(0,s.jsx)(ez.Z,{className:"ml-1 text-gray-500 cursor-help",onMouseEnter:()=>{u(),n(!0)},onMouseLeave:()=>n(!1)}),i&&(0,s.jsxs)("div",{className:"absolute left-1/2 -translate-x-1/2 z-50 bg-black/90 text-white p-2 rounded-md text-sm font-normal shadow-lg ".concat(r),style:{["top"===d?"bottom":"top"]:"100%",width:a,marginBottom:"top"===d?"8px":"0",marginTop:"bottom"===d?"8px":"0"},children:[l,(0,s.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2 w-0 h-0",style:{top:"top"===d?"100%":"auto",bottom:"bottom"===d?"100%":"auto",borderTop:"top"===d?"6px solid rgba(0, 0, 0, 0.9)":"6px solid transparent",borderBottom:"bottom"===d?"6px solid rgba(0, 0, 0, 0.9)":"6px solid transparent",borderLeft:"6px solid transparent",borderRight:"6px solid transparent"}})]})]})};var eB=()=>{let e=N.Z.useFormInstance(),[l,t]=(0,o.useState)(0),a=N.Z.useWatch("model",e)||[],r=Array.isArray(a)?a:[a],i=N.Z.useWatch("custom_model_name",e),n=!r.includes("all-wildcard"),d=N.Z.useWatch("custom_llm_provider",e);if((0,o.useEffect)(()=>{if(i&&r.includes("custom")){let l=(e.getFieldValue("model_mappings")||[]).map(e=>"custom"===e.public_name||"custom"===e.litellm_model?d===m.Cl.Azure?{public_name:i,litellm_model:"azure/".concat(i)}:{public_name:i,litellm_model:i}:e);e.setFieldValue("model_mappings",l),t(e=>e+1)}},[i,r,d,e]),(0,o.useEffect)(()=>{if(r.length>0&&!r.includes("all-wildcard")){let l=e.getFieldValue("model_mappings")||[];if(l.length!==r.length||!r.every(e=>l.some(l=>"custom"===e?"custom"===l.litellm_model||l.litellm_model===i:d===m.Cl.Azure?l.litellm_model==="azure/".concat(e):l.litellm_model===e))){let l=r.map(e=>"custom"===e&&i?d===m.Cl.Azure?{public_name:i,litellm_model:"azure/".concat(i)}:{public_name:i,litellm_model:i}:d===m.Cl.Azure?{public_name:e,litellm_model:"azure/".concat(e)}:{public_name:e,litellm_model:e});e.setFieldValue("model_mappings",l),t(e=>e+1)}}},[r,i,d,e]),!n)return null;let c=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"mb-2 font-normal",children:"The name you specify in your API calls to LiteLLM Proxy"}),(0,s.jsxs)("div",{className:"mb-2 font-normal",children:[(0,s.jsx)("strong",{children:"Example:"})," If you name your public model"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"example-name"}),", and choose"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"openai/qwen-plus-latest"})," as the LiteLLM model"]}),(0,s.jsxs)("div",{className:"mb-2 font-normal",children:[(0,s.jsx)("strong",{children:"Usage:"})," You make an API call to the LiteLLM proxy with"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:'model = "example-name"'})]}),(0,s.jsxs)("div",{className:"font-normal",children:[(0,s.jsx)("strong",{children:"Result:"})," LiteLLM sends"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"qwen-plus-latest"})," to the provider"]})]}),u=(0,s.jsx)("div",{children:"The model name LiteLLM will send to the LLM API"}),h=[{title:(0,s.jsxs)("span",{className:"flex items-center",children:["Public Model Name",(0,s.jsx)(eq,{content:c,width:"500px"})]}),dataIndex:"public_name",key:"public_name",render:(l,t,a)=>(0,s.jsx)(w.o,{value:l,onChange:l=>{let t=[...e.getFieldValue("model_mappings")];t[a].public_name=l.target.value,e.setFieldValue("model_mappings",t)}})},{title:(0,s.jsxs)("span",{className:"flex items-center",children:["LiteLLM Model Name",(0,s.jsx)(eq,{content:u,width:"360px"})]}),dataIndex:"litellm_model",key:"litellm_model"}];return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(N.Z.Item,{label:"Model Mappings",name:"model_mappings",tooltip:"Map public model names to LiteLLM model names for load balancing",labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",rules:[{required:!0,validator:async(e,l)=>{if(!l||0===l.length)throw Error("At least one model mapping is required");if(l.filter(e=>!e.public_name||""===e.public_name.trim()).length>0)throw Error("All model mappings must have valid public names")}}],children:(0,s.jsx)(eD.Z,{dataSource:e.getFieldValue("model_mappings"),columns:h,pagination:!1,size:"small"},l)})})},eU=e=>{let{selectedProvider:l,providerModels:t,getPlaceholder:a}=e,r=N.Z.useFormInstance(),i=e=>{let t=e.target.value,s=(r.getFieldValue("model_mappings")||[]).map(e=>"custom"===e.public_name||"custom"===e.litellm_model?l===m.Cl.Azure?{public_name:t,litellm_model:"azure/".concat(t)}:{public_name:t,litellm_model:t}:e);r.setFieldsValue({model_mappings:s})};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(N.Z.Item,{label:"LiteLLM Model Name(s)",tooltip:"The model name LiteLLM will send to the LLM API",className:"mb-0",children:[(0,s.jsx)(N.Z.Item,{name:"model",rules:[{required:!0,message:"Please enter ".concat(l===m.Cl.Azure?"a deployment name":"at least one model",".")}],noStyle:!0,children:l===m.Cl.Azure||l===m.Cl.OpenAI_Compatible||l===m.Cl.Ollama?(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(P.o,{placeholder:a(l),onChange:l===m.Cl.Azure?e=>{let l=e.target.value,t=l?[{public_name:l,litellm_model:"azure/".concat(l)}]:[];r.setFieldsValue({model:l,model_mappings:t})}:void 0})}):t.length>0?(0,s.jsx)(k.default,{mode:"multiple",allowClear:!0,showSearch:!0,placeholder:"Select models",onChange:e=>{let t=Array.isArray(e)?e:[e];if(t.includes("all-wildcard"))r.setFieldsValue({model_name:void 0,model_mappings:[]});else if(JSON.stringify(r.getFieldValue("model"))!==JSON.stringify(t)){let e=t.map(e=>l===m.Cl.Azure?{public_name:e,litellm_model:"azure/".concat(e)}:{public_name:e,litellm_model:e});r.setFieldsValue({model:t,model_mappings:e})}},optionFilterProp:"children",filterOption:(e,l)=>{var t;return(null!==(t=null==l?void 0:l.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:[{label:"Custom Model Name (Enter below)",value:"custom"},{label:"All ".concat(l," Models (Wildcard)"),value:"all-wildcard"},...t.map(e=>({label:e,value:e}))],style:{width:"100%"}}):(0,s.jsx)(P.o,{placeholder:a(l)})}),(0,s.jsx)(N.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.model!==l.model,children:e=>{let{getFieldValue:t}=e,a=t("model")||[];return(Array.isArray(a)?a:[a]).includes("custom")&&(0,s.jsx)(N.Z.Item,{name:"custom_model_name",rules:[{required:!0,message:"Please enter a custom model name."}],className:"mt-2",children:(0,s.jsx)(P.o,{placeholder:l===m.Cl.Azure?"Enter Azure deployment name":"Enter custom model name",onChange:i})})}})]}),(0,s.jsxs)(L.Z,{children:[(0,s.jsx)(T.Z,{span:10}),(0,s.jsx)(T.Z,{span:14,children:(0,s.jsx)(P.x,{className:"mb-3 mt-1",children:l===m.Cl.Azure?"Your deployment name will be saved as the public model name, and LiteLLM will use 'azure/deployment-name' internally":"The model name LiteLLM will send to the LLM API"})})]})]})};let{Title:eG,Link:eH}=C.default;var eK=e=>{let{form:l,handleOk:t,selectedProvider:a,setSelectedProvider:r,providerModels:i,setProviderModelsFn:d,getPlaceholder:u,uploadProps:h,showAdvancedSettings:x,setShowAdvancedSettings:p,teams:g,credentials:f,accessToken:j,userRole:v,premiumUser:_}=e,[y]=N.Z.useForm(),[b,Z]=(0,o.useState)("chat"),[w,M]=(0,o.useState)(!1),[F,P]=(0,o.useState)(!1),[R,O]=(0,o.useState)([]),[V,D]=(0,o.useState)({}),[q,B]=(0,o.useState)(""),{data:U,isLoading:G,error:H}=I();(0,o.useEffect)(()=>{(async()=>{try{let e=(await (0,c.getGuardrailsList)(j)).guardrails.map(e=>e.guardrail_name);O(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})()},[j]),(0,o.useEffect)(()=>{(async()=>{try{let e=await (0,c.tagListCall)(j);D(e)}catch(e){console.error("Failed to fetch tags:",e)}})()},[j]);let K=async()=>{P(!0),B("test-".concat(Date.now())),M(!0)},[J,W]=(0,o.useState)(!1),[Y,ei]=(0,o.useState)([]);(0,o.useEffect)(()=>{(async()=>{ei((await (0,c.modelAvailableCall)(j,"","",!1,null,!0,!0)).data.map(e=>e.id))})()},[j]);let en=(0,o.useMemo)(()=>U?[...U].sort((e,l)=>e.provider_display_name.localeCompare(l.provider_display_name)):[],[U]),eo=H?H instanceof Error?H.message:"Failed to load providers":null,ed=et.ZL.includes(v);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(Q.Z,{className:"w-full",children:[(0,s.jsxs)(X.Z,{className:"mb-4",children:[(0,s.jsx)($.Z,{children:"Add Model"}),(0,s.jsx)($.Z,{children:"Add Auto Router"})]}),(0,s.jsxs)(el.Z,{children:[(0,s.jsxs)(ee.Z,{children:[(0,s.jsx)(eG,{level:2,children:"Add Model"}),(0,s.jsx)(ea.Z,{children:(0,s.jsx)(N.Z,{form:l,onFinish:e=>{console.log("\uD83D\uDD25 Form onFinish triggered with values:",e),t()},onFinishFailed:e=>{console.log("\uD83D\uDCA5 Form onFinishFailed triggered:",e)},labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"E.g. OpenAI, Azure OpenAI, Anthropic, Bedrock, etc.",labelCol:{span:10},labelAlign:"left",children:(0,s.jsxs)(k.default,{showSearch:!0,loading:G,placeholder:G?"Loading providers...":"Select a provider",optionFilterProp:"data-label",onChange:e=>{r(e),d(e),l.setFieldsValue({custom_llm_provider:e}),l.setFieldsValue({model:[],model_name:void 0})},children:[eo&&0===en.length&&(0,s.jsx)(k.default.Option,{value:"",children:eo},"__error"),en.map(e=>{var l;let t=e.provider_display_name,a=e.provider,r=null!==(l=m.cd[t])&&void 0!==l?l:"";return(0,s.jsx)(k.default.Option,{value:a,"data-label":t,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r?(0,s.jsx)("img",{src:r,alt:"".concat(t," logo"),className:"w-5 h-5",onError:e=>{let l=e.currentTarget,s=l.parentElement;if(s&&s.contains(l))try{let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,l)}catch(e){console.error("Failed to replace provider logo fallback:",e)}}}):(0,s.jsx)("div",{className:"w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",children:t.charAt(0)}),(0,s.jsx)("span",{children:t})]})},a)})]})}),(0,s.jsx)(eU,{selectedProvider:a,providerModels:i,getPlaceholder:u}),(0,s.jsx)(eB,{}),(0,s.jsx)(N.Z.Item,{label:"Mode",name:"mode",className:"mb-1",children:(0,s.jsx)(k.default,{style:{width:"100%"},value:b,onChange:e=>Z(e),options:eA})}),(0,s.jsxs)(L.Z,{children:[(0,s.jsx)(T.Z,{span:10}),(0,s.jsx)(T.Z,{span:10,children:(0,s.jsxs)(n.Z,{className:"mb-5 mt-1",children:[(0,s.jsx)("strong",{children:"Optional"})," - LiteLLM endpoint to use when health checking this model"," ",(0,s.jsx)(eH,{href:"https://docs.litellm.ai/docs/proxy/health#health",target:"_blank",children:"Learn more"})]})})]}),(0,s.jsx)("div",{className:"mb-4",children:(0,s.jsx)(C.default.Text,{className:"text-sm text-gray-500 mb-2",children:"Either select existing credentials OR enter new provider credentials below"})}),(0,s.jsx)(N.Z.Item,{label:"Existing Credentials",name:"litellm_credential_name",initialValue:null,children:(0,s.jsx)(k.default,{showSearch:!0,placeholder:"Select or search for existing credentials",optionFilterProp:"children",filterOption:(e,l)=>{var t;return(null!==(t=null==l?void 0:l.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:[{value:null,label:"None"},...f.map(e=>({value:e.credential_name,label:e.credential_name}))],allowClear:!0})}),(0,s.jsx)(N.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.litellm_credential_name!==l.litellm_credential_name||e.provider!==l.provider,children:e=>{let{getFieldValue:l}=e,t=l("litellm_credential_name");return(console.log("\uD83D\uDD11 Credential Name Changed:",t),t)?null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"OR"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(0,s.jsx)(z,{selectedProvider:a,uploadProps:h})]})}}),(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"Additional Model Info Settings"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(0,s.jsx)(N.Z.Item,{label:"Team-BYOK Model",tooltip:"Only use this model + credential combination for this team. Useful when teams want to onboard their own OpenAI keys.",className:"mb-4",children:(0,s.jsx)(A.Z,{title:_?"":"This is an enterprise-only feature. Upgrade to premium to restrict model+credential combinations to a specific team.",placement:"top",children:(0,s.jsx)(es.Z,{checked:J,onChange:e=>{W(e),e||l.setFieldValue("team_id",void 0)},disabled:!_})})}),J&&(0,s.jsx)(N.Z.Item,{label:"Select Team",name:"team_id",className:"mb-4",tooltip:"Only keys for this team will be able to call this model.",rules:[{required:J&&!ed,message:"Please select a team."}],children:(0,s.jsx)(er.Z,{teams:g,disabled:!_})}),ed&&(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(N.Z.Item,{label:"Model Access Group",name:"model_access_group",className:"mb-4",tooltip:"Use model access groups to give users access to select models, and add new ones to the group over time.",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:Y.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})})}),(0,s.jsx)(eV,{showAdvancedSettings:x,setShowAdvancedSettings:p,teams:g,guardrailsList:R,tagsList:V}),(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(C.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{className:"space-x-2",children:[(0,s.jsx)(E.ZP,{onClick:K,loading:F,children:"Test Connect"}),(0,s.jsx)(E.ZP,{htmlType:"submit",children:"Add Model"})]})]})]})})})]}),(0,s.jsx)(ee.Z,{children:(0,s.jsx)(ek,{form:y,handleOk:()=>{y.validateFields().then(e=>{ex(e,j,y,t)}).catch(e=>{console.error("Validation failed:",e)})},accessToken:j,userRole:v})})]})]}),(0,s.jsx)(S.Z,{title:"Connection Test Results",open:w,onCancel:()=>{M(!1),P(!1)},footer:[(0,s.jsx)(E.ZP,{onClick:()=>{M(!1),P(!1)},children:"Close"},"close")],width:700,children:w&&(0,s.jsx)(eh,{formValues:l.getFieldsValue(),accessToken:j,testMode:b,modelName:l.getFieldValue("model_name")||l.getFieldValue("model"),onClose:()=>{M(!1),P(!1)},onTestComplete:()=>P(!1)},q)})]})},eJ=t(77331),eW=t(45589),eY=t(78489),e$=t(12514),eQ=t(49566),eX=t(96761),e0=t(30401),e1=t(78867),e2=t(59872),e4=e=>{let{isVisible:l,onCancel:t,onSuccess:a,modelData:r,accessToken:i,userRole:n}=e,[m]=N.Z.useForm(),[u,h]=(0,o.useState)(!1),[x,p]=(0,o.useState)([]),[g,f]=(0,o.useState)([]),[j,v]=(0,o.useState)(!1),[_,y]=(0,o.useState)(!1),[b,Z]=(0,o.useState)(null);(0,o.useEffect)(()=>{l&&r&&w()},[l,r]),(0,o.useEffect)(()=>{let e=async()=>{if(i)try{let e=await (0,c.modelAvailableCall)(i,"","",!1,null,!0,!0);p(e.data.map(e=>e.id))}catch(e){console.error("Error fetching model access groups:",e)}},t=async()=>{if(i)try{let e=await (0,ep.p)(i);f(e)}catch(e){console.error("Error fetching model info:",e)}};l&&(e(),t())},[l,i]);let w=()=>{try{var e,l,t,s,a,i;let n=null;(null===(e=r.litellm_params)||void 0===e?void 0:e.auto_router_config)&&(n="string"==typeof r.litellm_params.auto_router_config?JSON.parse(r.litellm_params.auto_router_config):r.litellm_params.auto_router_config),Z(n),m.setFieldsValue({auto_router_name:r.model_name,auto_router_default_model:(null===(l=r.litellm_params)||void 0===l?void 0:l.auto_router_default_model)||"",auto_router_embedding_model:(null===(t=r.litellm_params)||void 0===t?void 0:t.auto_router_embedding_model)||"",model_access_group:(null===(s=r.model_info)||void 0===s?void 0:s.access_groups)||[]});let o=new Set(g.map(e=>e.model_group));v(!o.has(null===(a=r.litellm_params)||void 0===a?void 0:a.auto_router_default_model)),y(!o.has(null===(i=r.litellm_params)||void 0===i?void 0:i.auto_router_embedding_model))}catch(e){console.error("Error parsing auto router config:",e),d.Z.fromBackend("Error loading auto router configuration")}},C=async()=>{try{h(!0);let e=await m.validateFields(),l={...r.litellm_params,auto_router_config:JSON.stringify(b),auto_router_default_model:e.auto_router_default_model,auto_router_embedding_model:e.auto_router_embedding_model||void 0},s={...r.model_info,access_groups:e.model_access_group||[]},n={model_name:e.auto_router_name,litellm_params:l,model_info:s};await (0,c.modelPatchUpdateCall)(i,n,r.model_info.id);let o={...r,model_name:e.auto_router_name,litellm_params:l,model_info:s};d.Z.success("Auto router configuration updated successfully"),a(o),t()}catch(e){console.error("Error updating auto router:",e),d.Z.fromBackend("Failed to update auto router configuration")}finally{h(!1)}},A=g.map(e=>({value:e.model_group,label:e.model_group}));return(0,s.jsx)(S.Z,{title:"Edit Auto Router Configuration",open:l,onCancel:t,footer:[(0,s.jsx)(E.ZP,{onClick:t,children:"Cancel"},"cancel"),(0,s.jsx)(E.ZP,{loading:u,onClick:C,children:"Save Changes"},"submit")],width:1e3,destroyOnClose:!0,children:(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)(P.x,{className:"text-gray-600",children:"Edit the auto router configuration including routing logic, default models, and access settings."}),(0,s.jsxs)(N.Z,{form:m,layout:"vertical",className:"space-y-4",children:[(0,s.jsx)(N.Z.Item,{label:"Auto Router Name",name:"auto_router_name",rules:[{required:!0,message:"Auto router name is required"}],children:(0,s.jsx)(P.o,{placeholder:"e.g., auto_router_1, smart_routing"})}),(0,s.jsx)("div",{className:"w-full",children:(0,s.jsx)(ew,{modelInfo:g,value:b,onChange:e=>{Z(e)}})}),(0,s.jsx)(N.Z.Item,{label:"Default Model",name:"auto_router_default_model",rules:[{required:!0,message:"Default model is required"}],children:(0,s.jsx)(k.default,{placeholder:"Select a default model",onChange:e=>{v("custom"===e)},options:[...A,{value:"custom",label:"Enter custom model name"}],showSearch:!0})}),(0,s.jsx)(N.Z.Item,{label:"Embedding Model",name:"auto_router_embedding_model",children:(0,s.jsx)(k.default,{placeholder:"Select an embedding model (optional)",onChange:e=>{y("custom"===e)},options:[...A,{value:"custom",label:"Enter custom model name"}],showSearch:!0,allowClear:!0})}),"Admin"===n&&(0,s.jsx)(N.Z.Item,{label:"Model Access Groups",name:"model_access_group",tooltip:"Control who can access this auto router",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:x.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})})]})]})})};let{Title:e5,Link:e6}=C.default;var e3=e=>{let{isVisible:l,onCancel:t,onAddCredential:a,existingCredential:r,setIsCredentialModalOpen:i}=e,[n]=N.Z.useForm();return console.log("existingCredential in add credentials tab: ".concat(JSON.stringify(r))),(0,s.jsx)(S.Z,{title:"Reuse Credentials",visible:l,onCancel:()=>{t(),n.resetFields()},footer:null,width:600,children:(0,s.jsxs)(N.Z,{form:n,onFinish:e=>{a(e),n.resetFields(),i(!1)},layout:"vertical",children:[(0,s.jsx)(N.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],initialValue:null==r?void 0:r.credential_name,children:(0,s.jsx)(w.o,{placeholder:"Enter a friendly name for these credentials"})}),Object.entries((null==r?void 0:r.credential_values)||{}).map(e=>{let[l,t]=e;return(0,s.jsx)(N.Z.Item,{label:l,name:l,initialValue:t,children:(0,s.jsx)(w.o,{placeholder:"Enter ".concat(l),disabled:!0})},l)}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(e6,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E.ZP,{onClick:()=>{t(),n.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(E.ZP,{htmlType:"submit",children:"Reuse Credentials"})]})]})]})})};function e8(e){var l,t,a,r,u,h,x,p,g,f,j,v,_,b,Z,w,C,M,I,F,P,L,T,R,O,V,D,z,q,B,U,G;let{modelId:H,onClose:K,modelData:Y,accessToken:et,userID:es,userRole:ea,editModel:er,setEditModalVisible:ei,setSelectedModel:en,onModelUpdate:eo,modelAccessGroups:ed}=e,[ec]=N.Z.useForm(),[eu,eh]=(0,o.useState)(null),[ex,ep]=(0,o.useState)(!1),[ef,ej]=(0,o.useState)(!1),[ev,e_]=(0,o.useState)(!1),[ey,eb]=(0,o.useState)(!1),[eN,eZ]=(0,o.useState)(!1),[ew,eC]=(0,o.useState)(null),[eS,ek]=(0,o.useState)(!1),[eA,eE]=(0,o.useState)({}),[eM,eI]=(0,o.useState)(!1),[eF,eL]=(0,o.useState)([]),[eO,eV]=(0,o.useState)({}),eD=("Admin"===ea||(null==Y?void 0:null===(l=Y.model_info)||void 0===l?void 0:l.created_by)===es)&&(null==Y?void 0:null===(t=Y.model_info)||void 0===t?void 0:t.db_model),ez="Admin"===ea,eq=(null==Y?void 0:null===(a=Y.litellm_params)||void 0===a?void 0:a.auto_router_config)!=null,eB=(null==Y?void 0:null===(r=Y.litellm_params)||void 0===r?void 0:r.litellm_credential_name)!=null&&(null==Y?void 0:null===(u=Y.litellm_params)||void 0===u?void 0:u.litellm_credential_name)!=void 0;console.log("usingExistingCredential, ",eB),console.log("modelData.litellm_params.litellm_credential_name, ",null==Y?void 0:null===(h=Y.litellm_params)||void 0===h?void 0:h.litellm_credential_name),console.log("tagsList, ",null===(x=Y.litellm_params)||void 0===x?void 0:x.tags),(0,o.useEffect)(()=>{let e=async()=>{var e,l,t,s,a,r,i;if(!et)return;let n=await (0,c.modelInfoV1Call)(et,H);console.log("modelInfoResponse, ",n);let o=n.data[0];o&&!o.litellm_model_name&&(o={...o,litellm_model_name:null!==(i=null!==(r=null!==(a=null==o?void 0:null===(l=o.litellm_params)||void 0===l?void 0:l.litellm_model_name)&&void 0!==a?a:null==o?void 0:null===(t=o.litellm_params)||void 0===t?void 0:t.model)&&void 0!==r?r:null==o?void 0:null===(s=o.model_info)||void 0===s?void 0:s.key)&&void 0!==i?i:null}),eh(o),(null==o?void 0:null===(e=o.litellm_params)||void 0===e?void 0:e.cache_control_injection_points)&&ek(!0)},l=async()=>{if(et)try{let e=(await (0,c.getGuardrailsList)(et)).guardrails.map(e=>e.guardrail_name);eL(e)}catch(e){console.error("Failed to fetch guardrails:",e)}},t=async()=>{if(et)try{let e=await (0,c.tagListCall)(et);eV(e)}catch(e){console.error("Failed to fetch tags:",e)}};(async()=>{if(console.log("accessToken, ",et),!et||eB)return;let e=await (0,c.credentialGetCall)(et,null,H);console.log("existingCredentialResponse, ",e),eC({credential_name:e.credential_name,credential_values:e.credential_values,credential_info:e.credential_info})})(),e(),l(),t()},[et,H]);let eU=async e=>{var l;if(console.log("values, ",e),!et)return;let t={credential_name:e.credential_name,model_id:H,credential_info:{custom_llm_provider:null===(l=eu.litellm_params)||void 0===l?void 0:l.custom_llm_provider}};d.Z.info("Storing credential.."),console.log("credentialResponse, ",await (0,c.credentialCreateCall)(et,t)),d.Z.success("Credential stored successfully")},eG=async e=>{try{var l;let t;if(!et)return;eb(!0),console.log("values.model_name, ",e.model_name);let s={};try{s=e.litellm_extra_params?JSON.parse(e.litellm_extra_params):{}}catch(e){d.Z.fromBackend("Invalid JSON in LiteLLM Params"),eb(!1);return}let a={...e.litellm_params,...s,model:e.litellm_model_name,api_base:e.api_base,custom_llm_provider:e.custom_llm_provider,organization:e.organization,tpm:e.tpm,rpm:e.rpm,max_retries:e.max_retries,timeout:e.timeout,stream_timeout:e.stream_timeout,input_cost_per_token:e.input_cost/1e6,output_cost_per_token:e.output_cost/1e6,tags:e.tags};e.guardrails&&(a.guardrails=e.guardrails),e.cache_control&&(null===(l=e.cache_control_injection_points)||void 0===l?void 0:l.length)>0?a.cache_control_injection_points=e.cache_control_injection_points:delete a.cache_control_injection_points;try{t=e.model_info?JSON.parse(e.model_info):Y.model_info,e.model_access_group&&(t={...t,access_groups:e.model_access_group})}catch(e){d.Z.fromBackend("Invalid JSON in Model Info");return}let r={model_name:e.model_name,litellm_params:a,model_info:t};await (0,c.modelPatchUpdateCall)(et,r,H);let i={...eu,model_name:e.model_name,litellm_model_name:e.litellm_model_name,litellm_params:a,model_info:t};eh(i),eo&&eo(i),d.Z.success("Model settings updated successfully"),e_(!1),eZ(!1)}catch(e){console.error("Error updating model:",e),d.Z.fromBackend("Failed to update model settings")}finally{eb(!1)}};if(!Y)return(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(eY.Z,{icon:eJ.Z,variant:"light",onClick:K,className:"mb-4",children:"Back to Models"}),(0,s.jsx)(n.Z,{children:"Model not found"})]});let eH=async()=>{if(et)try{var e,l,t;d.Z.info("Testing connection...");let s=await (0,c.testConnectionRequest)(et,{custom_llm_provider:eu.litellm_params.custom_llm_provider,litellm_credential_name:eu.litellm_params.litellm_credential_name,model:eu.litellm_model_name},{mode:null===(e=eu.model_info)||void 0===e?void 0:e.mode},null===(l=eu.model_info)||void 0===l?void 0:l.mode);if("success"===s.status)d.Z.success("Connection test successful!");else throw Error((null==s?void 0:null===(t=s.result)||void 0===t?void 0:t.error)||(null==s?void 0:s.message)||"Unknown error")}catch(e){e instanceof Error?d.Z.error("Error testing connection: "+(0,eR.aS)(e.message,100)):d.Z.error("Error testing connection: "+String(e))}},eK=async()=>{try{if(!et)return;await (0,c.modelDeleteCall)(et,H),d.Z.success("Model deleted successfully"),eo&&eo({deleted:!0,model_info:{id:H}}),K()}catch(e){console.error("Error deleting the model:",e),d.Z.fromBackend("Failed to delete model")}},e5=async(e,l)=>{await (0,e2.vQ)(e)&&(eE(e=>({...e,[l]:!0})),setTimeout(()=>{eE(e=>({...e,[l]:!1}))},2e3))};return(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(eY.Z,{icon:eJ.Z,variant:"light",onClick:K,className:"mb-4",children:"Back to Models"}),(0,s.jsxs)(eX.Z,{children:["Public Model Name: ",J(Y)]}),(0,s.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,s.jsx)(n.Z,{className:"text-gray-500 font-mono",children:Y.model_info.id}),(0,s.jsx)(E.ZP,{type:"text",size:"small",icon:eA["model-id"]?(0,s.jsx)(e0.Z,{size:12}):(0,s.jsx)(e1.Z,{size:12}),onClick:()=>e5(Y.model_info.id,"model-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eA["model-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(eY.Z,{variant:"secondary",icon:W.Z,onClick:eH,className:"flex items-center gap-2","data-testid":"test-connection-button",children:"Test Connection"}),(0,s.jsx)(eY.Z,{icon:eW.Z,variant:"secondary",onClick:()=>ej(!0),className:"flex items-center",disabled:!ez,"data-testid":"reuse-credentials-button",children:"Re-use Credentials"}),(0,s.jsx)(eY.Z,{icon:y.Z,variant:"secondary",onClick:()=>ep(!0),className:"flex items-center text-red-500 border-red-500 hover:text-red-700",disabled:!eD,"data-testid":"delete-model-button",children:"Delete Model"})]})]}),(0,s.jsxs)(Q.Z,{children:[(0,s.jsxs)(X.Z,{className:"mb-6",children:[(0,s.jsx)($.Z,{children:"Overview"}),(0,s.jsx)($.Z,{children:"Raw JSON"})]}),(0,s.jsxs)(el.Z,{children:[(0,s.jsxs)(ee.Z,{children:[(0,s.jsxs)(i.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6 mb-6",children:[(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(n.Z,{children:"Provider"}),(0,s.jsxs)("div",{className:"mt-2 flex items-center space-x-2",children:[Y.provider&&(0,s.jsx)("img",{src:(0,m.dr)(Y.provider).logo,alt:"".concat(Y.provider," logo"),className:"w-4 h-4",onError:e=>{let l=e.currentTarget,t=l.parentElement;if(t&&t.contains(l))try{var s;let e=document.createElement("div");e.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=(null===(s=Y.provider)||void 0===s?void 0:s.charAt(0))||"-",t.replaceChild(e,l)}catch(e){console.error("Failed to replace provider logo fallback:",e)}}}),(0,s.jsx)(eX.Z,{children:Y.provider||"Not Set"})]})]}),(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(n.Z,{children:"LiteLLM Model"}),(0,s.jsx)("div",{className:"mt-2 overflow-hidden",children:(0,s.jsx)(A.Z,{title:Y.litellm_model_name||"Not Set",children:(0,s.jsx)("div",{className:"break-all text-sm font-medium leading-relaxed cursor-pointer",children:Y.litellm_model_name||"Not Set"})})})]}),(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(n.Z,{children:"Pricing"}),(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsxs)(n.Z,{children:["Input: $",Y.input_cost,"/1M tokens"]}),(0,s.jsxs)(n.Z,{children:["Output: $",Y.output_cost,"/1M tokens"]})]})]})]}),(0,s.jsxs)("div",{className:"mb-6 text-sm text-gray-500 flex items-center gap-x-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-x-2",children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Created At"," ",Y.model_info.created_at?new Date(Y.model_info.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"Not Set"]}),(0,s.jsxs)("div",{className:"flex items-center gap-x-2",children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})}),"Created By ",Y.model_info.created_by||"Not Set"]})]}),(0,s.jsxs)(e$.Z,{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(eX.Z,{children:"Model Settings"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[eq&&eD&&!eN&&(0,s.jsx)(eY.Z,{onClick:()=>eI(!0),className:"flex items-center",children:"Edit Auto Router"}),eD?!eN&&(0,s.jsx)(eY.Z,{onClick:()=>eZ(!0),className:"flex items-center",children:"Edit Settings"}):(0,s.jsx)(A.Z,{title:"Only DB models can be edited. You must be an admin or the creator of the model to edit it.",children:(0,s.jsx)(em.Z,{})})]})]}),eu?(0,s.jsx)(N.Z,{form:ec,onFinish:eG,initialValues:{model_name:eu.model_name,litellm_model_name:eu.litellm_model_name,api_base:eu.litellm_params.api_base,custom_llm_provider:eu.litellm_params.custom_llm_provider,organization:eu.litellm_params.organization,tpm:eu.litellm_params.tpm,rpm:eu.litellm_params.rpm,max_retries:eu.litellm_params.max_retries,timeout:eu.litellm_params.timeout,stream_timeout:eu.litellm_params.stream_timeout,input_cost:eu.litellm_params.input_cost_per_token?1e6*eu.litellm_params.input_cost_per_token:(null===(p=eu.model_info)||void 0===p?void 0:p.input_cost_per_token)*1e6||null,output_cost:(null===(g=eu.litellm_params)||void 0===g?void 0:g.output_cost_per_token)?1e6*eu.litellm_params.output_cost_per_token:(null===(f=eu.model_info)||void 0===f?void 0:f.output_cost_per_token)*1e6||null,cache_control:null!==(j=eu.litellm_params)&&void 0!==j&&!!j.cache_control_injection_points,cache_control_injection_points:(null===(v=eu.litellm_params)||void 0===v?void 0:v.cache_control_injection_points)||[],model_access_group:Array.isArray(null===(_=eu.model_info)||void 0===_?void 0:_.access_groups)?eu.model_info.access_groups:[],guardrails:Array.isArray(null===(b=eu.litellm_params)||void 0===b?void 0:b.guardrails)?eu.litellm_params.guardrails:[],tags:Array.isArray(null===(Z=eu.litellm_params)||void 0===Z?void 0:Z.tags)?eu.litellm_params.tags:[],litellm_extra_params:JSON.stringify(eu.litellm_params||{},null,2)},layout:"vertical",onValuesChange:()=>e_(!0),children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Model Name"}),eN?(0,s.jsx)(N.Z.Item,{name:"model_name",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter model name"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:eu.model_name})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"LiteLLM Model Name"}),eN?(0,s.jsx)(N.Z.Item,{name:"litellm_model_name",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter LiteLLM model name"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:eu.litellm_model_name})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Input Cost (per 1M tokens)"}),eN?(0,s.jsx)(N.Z.Item,{name:"input_cost",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter input cost"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null==eu?void 0:null===(w=eu.litellm_params)||void 0===w?void 0:w.input_cost_per_token)?((null===(C=eu.litellm_params)||void 0===C?void 0:C.input_cost_per_token)*1e6).toFixed(4):(null==eu?void 0:null===(M=eu.model_info)||void 0===M?void 0:M.input_cost_per_token)?(1e6*eu.model_info.input_cost_per_token).toFixed(4):null})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Output Cost (per 1M tokens)"}),eN?(0,s.jsx)(N.Z.Item,{name:"output_cost",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter output cost"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null==eu?void 0:null===(I=eu.litellm_params)||void 0===I?void 0:I.output_cost_per_token)?(1e6*eu.litellm_params.output_cost_per_token).toFixed(4):(null==eu?void 0:null===(F=eu.model_info)||void 0===F?void 0:F.output_cost_per_token)?(1e6*eu.model_info.output_cost_per_token).toFixed(4):null})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"API Base"}),eN?(0,s.jsx)(N.Z.Item,{name:"api_base",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter API base"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(P=eu.litellm_params)||void 0===P?void 0:P.api_base)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Custom LLM Provider"}),eN?(0,s.jsx)(N.Z.Item,{name:"custom_llm_provider",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter custom LLM provider"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(L=eu.litellm_params)||void 0===L?void 0:L.custom_llm_provider)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Organization"}),eN?(0,s.jsx)(N.Z.Item,{name:"organization",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter organization"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(T=eu.litellm_params)||void 0===T?void 0:T.organization)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"TPM (Tokens per Minute)"}),eN?(0,s.jsx)(N.Z.Item,{name:"tpm",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter TPM"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(R=eu.litellm_params)||void 0===R?void 0:R.tpm)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"RPM (Requests per Minute)"}),eN?(0,s.jsx)(N.Z.Item,{name:"rpm",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter RPM"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(O=eu.litellm_params)||void 0===O?void 0:O.rpm)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Max Retries"}),eN?(0,s.jsx)(N.Z.Item,{name:"max_retries",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter max retries"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(V=eu.litellm_params)||void 0===V?void 0:V.max_retries)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Timeout (seconds)"}),eN?(0,s.jsx)(N.Z.Item,{name:"timeout",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter timeout"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(D=eu.litellm_params)||void 0===D?void 0:D.timeout)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Stream Timeout (seconds)"}),eN?(0,s.jsx)(N.Z.Item,{name:"stream_timeout",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter stream timeout"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(z=eu.litellm_params)||void 0===z?void 0:z.stream_timeout)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Model Access Groups"}),eN?(0,s.jsx)(N.Z.Item,{name:"model_access_group",className:"mb-0",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:null==ed?void 0:ed.map(e=>({value:e,label:e}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(q=eu.model_info)||void 0===q?void 0:q.access_groups)?Array.isArray(eu.model_info.access_groups)?eu.model_info.access_groups.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:eu.model_info.access_groups.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800",children:e},l))}):"No groups assigned":eu.model_info.access_groups:"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)(n.Z,{className:"font-medium",children:["Guardrails",(0,s.jsx)(A.Z,{title:"Apply safety guardrails to this model to filter content or enforce policies",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(em.Z,{style:{marginLeft:"4px"}})})})]}),eN?(0,s.jsx)(N.Z.Item,{name:"guardrails",className:"mb-0",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing guardrails or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:eF.map(e=>({value:e,label:e}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(B=eu.litellm_params)||void 0===B?void 0:B.guardrails)?Array.isArray(eu.litellm_params.guardrails)?eu.litellm_params.guardrails.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:eu.litellm_params.guardrails.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800",children:e},l))}):"No guardrails assigned":eu.litellm_params.guardrails:"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Tags"}),eN?(0,s.jsx)(N.Z.Item,{name:"tags",className:"mb-0",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing tags or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:Object.values(eO).map(e=>({value:e.name,label:e.name,title:e.description||e.name}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(U=eu.litellm_params)||void 0===U?void 0:U.tags)?Array.isArray(eu.litellm_params.tags)?eu.litellm_params.tags.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:eu.litellm_params.tags.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-purple-100 text-purple-800",children:e},l))}):"No tags assigned":eu.litellm_params.tags:"Not Set"})]}),eN?(0,s.jsx)(eT,{form:ec,showCacheControl:eS,onCacheControlChange:e=>ek(e)}):(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Cache Control"}),(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(G=eu.litellm_params)||void 0===G?void 0:G.cache_control_injection_points)?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{children:"Enabled"}),(0,s.jsx)("div",{className:"mt-2",children:eu.litellm_params.cache_control_injection_points.map((e,l)=>(0,s.jsxs)("div",{className:"text-sm text-gray-600 mb-1",children:["Location: ",e.location,",",e.role&&(0,s.jsxs)("span",{children:[" Role: ",e.role]}),void 0!==e.index&&(0,s.jsxs)("span",{children:[" Index: ",e.index]})]},l))})]}):"Disabled"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Model Info"}),eN?(0,s.jsx)(N.Z.Item,{name:"model_info",className:"mb-0",children:(0,s.jsx)(eg.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}',defaultValue:JSON.stringify(Y.model_info,null,2)})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(0,s.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(eu.model_info,null,2)})})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)(n.Z,{className:"font-medium",children:["LiteLLM Params",(0,s.jsx)(A.Z,{title:"Optional litellm params used for making a litellm.completion() call. Some params are automatically added by LiteLLM.",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/completion/input",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(em.Z,{style:{marginLeft:"4px"}})})})]}),eN?(0,s.jsx)(N.Z.Item,{name:"litellm_extra_params",rules:[{validator:eR.Ac}],children:(0,s.jsx)(eg.default.TextArea,{rows:4,placeholder:'{ "rpm": 100, "timeout": 0, "stream_timeout": 0 }'})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(0,s.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(eu.litellm_params,null,2)})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Team ID"}),(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:Y.model_info.team_id||"Not Set"})]})]}),eN&&(0,s.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,s.jsx)(eY.Z,{variant:"secondary",onClick:()=>{ec.resetFields(),e_(!1),eZ(!1)},disabled:ey,children:"Cancel"}),(0,s.jsx)(eY.Z,{variant:"primary",onClick:()=>ec.submit(),loading:ey,children:"Save Changes"})]})]})}):(0,s.jsx)(n.Z,{children:"Loading..."})]})]}),(0,s.jsx)(ee.Z,{children:(0,s.jsx)(e$.Z,{children:(0,s.jsx)("pre",{className:"bg-gray-100 p-4 rounded text-xs overflow-auto",children:JSON.stringify(Y,null,2)})})})]})]}),ex&&(0,s.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,s.jsxs)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,s.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,s.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,s.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:"​"}),(0,s.jsxs)("div",{className:"inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full",children:[(0,s.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,s.jsx)("div",{className:"sm:flex sm:items-start",children:(0,s.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,s.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Model"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this model?"})})]})})}),(0,s.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,s.jsx)(E.ZP,{onClick:eK,className:"ml-2",danger:!0,children:"Delete"}),(0,s.jsx)(E.ZP,{onClick:()=>ep(!1),children:"Cancel"})]})]})]})}),ef&&!eB?(0,s.jsx)(e3,{isVisible:ef,onCancel:()=>ej(!1),onAddCredential:eU,existingCredential:ew,setIsCredentialModalOpen:ej}):(0,s.jsx)(S.Z,{open:ef,onCancel:()=>ej(!1),title:"Using Existing Credential",children:(0,s.jsx)(n.Z,{children:Y.litellm_params.litellm_credential_name})}),(0,s.jsx)(e4,{isVisible:eM,onCancel:()=>eI(!1),onSuccess:e=>{eh(e),eo&&eo(e)},modelData:eu||Y,accessToken:et||"",userRole:ea||""})]})}var e7=t(33293),e9=t(11318),le=t(8048),ll=t(41649);let lt=e=>{let{provider:l,className:t="w-4 h-4"}=e,[a,r]=(0,o.useState)(!1),{logo:i}=(0,m.dr)(l);return a||!i?(0,s.jsx)("div",{className:"".concat(t," rounded-full bg-gray-200 flex items-center justify-center text-xs"),children:(null==l?void 0:l.charAt(0))||"-"}):(0,s.jsx)("img",{src:i,alt:"".concat(l," logo"),className:t,onError:()=>r(!0)})},ls=(e,l,t,a,r,i,n,o,d,c,m)=>[{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model ID"}),accessorKey:"model_info.id",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)(A.Z,{title:t.model_info.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>a(t.model_info.id),children:t.model_info.id})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model Information"}),accessorKey:"model_name",size:250,cell:e=>{let{row:l}=e,t=l.original,a=i(l.original)||"-",r=(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Provider:"})," ",t.provider||"-"]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Public Model Name:"})," ",a]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"LiteLLM Model Name:"})," ",t.litellm_model_name||"-"]})]});return(0,s.jsx)(A.Z,{title:r,children:(0,s.jsxs)("div",{className:"flex items-start space-x-2 min-w-0 w-full max-w-[250px]",children:[(0,s.jsx)("div",{className:"flex-shrink-0 mt-0.5",children:t.provider?(0,s.jsx)(lt,{provider:t.provider}):(0,s.jsx)("div",{className:"w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",children:"-"})}),(0,s.jsxs)("div",{className:"flex flex-col min-w-0 flex-1",children:[(0,s.jsx)("div",{className:"text-xs font-medium text-gray-900 truncate max-w-[210px]",children:a}),(0,s.jsx)("div",{className:"text-xs text-gray-500 truncate mt-0.5 max-w-[210px]",children:t.litellm_model_name||"-"})]})]})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Credentials"}),accessorKey:"litellm_credential_name",size:180,cell:e=>{var l;let{row:t}=e,a=null===(l=t.original.litellm_params)||void 0===l?void 0:l.litellm_credential_name;return a?(0,s.jsx)(A.Z,{title:"Credential: ".concat(a),children:(0,s.jsxs)("div",{className:"flex items-center space-x-2 max-w-[180px]",children:[(0,s.jsx)(eW.Z,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}),(0,s.jsx)("span",{className:"text-xs truncate",title:a,children:a})]})}):(0,s.jsxs)("div",{className:"flex items-center space-x-2 max-w-[180px]",children:[(0,s.jsx)(eW.Z,{className:"w-4 h-4 text-gray-300 flex-shrink-0"}),(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"No credentials"})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Created By"}),accessorKey:"model_info.created_by",sortingFn:"datetime",size:160,cell:e=>{var l;let{row:t}=e,a=t.original,r=!(null===(l=a.model_info)||void 0===l?void 0:l.db_model),i=a.model_info.created_by,n=a.model_info.created_at?new Date(a.model_info.created_at).toLocaleDateString():null;return(0,s.jsxs)("div",{className:"flex flex-col min-w-0 max-w-[160px]",children:[(0,s.jsx)("div",{className:"text-xs font-medium text-gray-900 truncate",title:r?"Defined in config":i||"Unknown",children:r?"Defined in config":i||"Unknown"}),(0,s.jsx)("div",{className:"text-xs text-gray-500 truncate mt-0.5",title:r?"Config file":n||"Unknown date",children:r?"-":n||"Unknown date"})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Updated At"}),accessorKey:"model_info.updated_at",sortingFn:"datetime",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)("span",{className:"text-xs",children:t.model_info.updated_at?new Date(t.model_info.updated_at).toLocaleDateString():"-"})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Costs"}),accessorKey:"input_cost",size:120,cell:e=>{let{row:l}=e,t=l.original,a=t.input_cost,r=t.output_cost;return a||r?(0,s.jsx)(A.Z,{title:"Cost per 1M tokens",children:(0,s.jsxs)("div",{className:"flex flex-col min-w-0 max-w-[120px]",children:[a&&(0,s.jsxs)("div",{className:"text-xs font-medium text-gray-900 truncate",children:["In: $",a]}),r&&(0,s.jsxs)("div",{className:"text-xs text-gray-500 truncate mt-0.5",children:["Out: $",r]})]})}):(0,s.jsx)("div",{className:"max-w-[120px]",children:(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"-"})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Team ID"}),accessorKey:"model_info.team_id",cell:e=>{let{row:l}=e,t=l.original;return t.model_info.team_id?(0,s.jsx)("div",{className:"overflow-hidden",children:(0,s.jsx)(A.Z,{title:t.model_info.team_id,children:(0,s.jsxs)(eY.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>r(t.model_info.team_id),children:[t.model_info.team_id.slice(0,7),"..."]})})}):"-"}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model Access Group"}),accessorKey:"model_info.model_access_group",enableSorting:!1,cell:e=>{let{row:l}=e,t=l.original,a=t.model_info.access_groups;if(!a||0===a.length)return"-";let r=t.model_info.id,i=c.has(r),n=a.length>1,o=()=>{let e=new Set(c);i?e.delete(r):e.add(r),m(e)};return(0,s.jsxs)("div",{className:"flex items-center gap-1 overflow-hidden",children:[(0,s.jsx)(ll.Z,{size:"xs",color:"blue",className:"text-xs px-1.5 py-0.5 h-5 leading-tight flex-shrink-0",children:a[0]}),(i||!n&&2===a.length)&&a.slice(1).map((e,l)=>(0,s.jsx)(ll.Z,{size:"xs",color:"blue",className:"text-xs px-1.5 py-0.5 h-5 leading-tight flex-shrink-0",children:e},l+1)),n&&(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),o()},className:"text-xs text-blue-600 hover:text-blue-800 px-1 py-0.5 rounded hover:bg-blue-50 h-5 leading-tight flex-shrink-0 whitespace-nowrap",children:i?"−":"+".concat(a.length-1)})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Status"}),accessorKey:"model_info.db_model",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)("div",{className:"\n inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium\n ".concat(t.model_info.db_model?"bg-blue-50 text-blue-600":"bg-gray-100 text-gray-600","\n "),children:t.model_info.db_model?"DB Model":"Config Model"})}},{id:"actions",header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Actions"}),cell:t=>{var r,i;let{row:n}=t,o=n.original,c="Admin"===e||(null===(r=o.model_info)||void 0===r?void 0:r.created_by)===l,m=!(null===(i=o.model_info)||void 0===i?void 0:i.db_model);return(0,s.jsx)("div",{className:"flex items-center justify-end gap-2 pr-4",children:m?(0,s.jsx)(A.Z,{title:"Config model cannot be deleted on the dashboard. Please delete it from the config file.",children:(0,s.jsx)(Y.Z,{icon:y.Z,size:"sm",className:"opacity-50 cursor-not-allowed"})}):(0,s.jsx)(A.Z,{title:"Delete model",children:(0,s.jsx)(Y.Z,{icon:y.Z,size:"sm",onClick:()=>{c&&(a(o.model_info.id),d(!1))},className:c?"cursor-pointer hover:text-red-600":"opacity-50 cursor-not-allowed"})})})}}];var la=t(27281),lr=t(43227),li=e=>{let{selectedModelGroup:l,setSelectedModelGroup:t,availableModelGroups:a,availableModelAccessGroups:r,setSelectedModelId:d,setSelectedTeamId:c,setEditModel:m,modelData:u}=e,{userId:h,userRole:x,premiumUser:p}=(0,H.Z)(),{teams:g}=(0,e9.Z)(),[f,j]=(0,o.useState)(""),[v,_]=(0,o.useState)("current_team"),[y,b]=(0,o.useState)("personal"),[N,Z]=(0,o.useState)(!1),[w,C]=(0,o.useState)(null),[S,k]=(0,o.useState)(new Set),[A,E]=(0,o.useState)({pageIndex:0,pageSize:50}),M=(0,o.useRef)(null),I=(0,o.useMemo)(()=>u&&u.data&&0!==u.data.length?u.data.filter(e=>{var t,s,a,r,i,n;let o=""===f||e.model_name.toLowerCase().includes(f.toLowerCase()),d="all"===l||e.model_name===l||!l||"wildcard"===l&&(null===(t=e.model_name)||void 0===t?void 0:t.includes("*")),c="all"===w||(null===(s=e.model_info.access_groups)||void 0===s?void 0:s.includes(w))||!w,m=!0;if("current_team"===v){if("personal"===y)m=(null===(a=e.model_info)||void 0===a?void 0:a.direct_access)===!0;else{let l=(null===(i=e.model_info)||void 0===i?void 0:null===(r=i.access_via_team_ids)||void 0===r?void 0:r.includes(y.team_id))===!0,t=(null===(n=y.models)||void 0===n?void 0:n.some(l=>{var t,s;return null===(s=e.model_info)||void 0===s?void 0:null===(t=s.access_groups)||void 0===t?void 0:t.includes(l)}))===!0;m=l||t}}return o&&d&&c&&m}):[],[u,f,l,w,y,v]),F=(0,o.useMemo)(()=>{let e=A.pageIndex*A.pageSize,l=e+A.pageSize;return I.slice(e,l)},[I,A.pageIndex,A.pageSize]);return(0,o.useEffect)(()=>{E(e=>({...e,pageIndex:0}))},[f,l,w,y,v]),(0,s.jsx)(ee.Z,{children:(0,s.jsx)(i.Z,{children:(0,s.jsx)("div",{className:"flex flex-col space-y-4",children:(0,s.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,s.jsxs)("div",{className:"border-b px-6 py-4 bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)(n.Z,{className:"text-lg font-semibold text-gray-900",children:"Current Team:"}),(0,s.jsxs)(la.Z,{className:"w-80",defaultValue:"personal",value:"personal"===y?"personal":y.team_id,onValueChange:e=>{if("personal"===e)b("personal");else{let l=null==g?void 0:g.find(l=>l.team_id===e);l&&b(l)}},children:[(0,s.jsx)(lr.Z,{value:"personal",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"Personal"})]})}),null==g?void 0:g.filter(e=>e.team_id).map(e=>(0,s.jsx)(lr.Z,{value:e.team_id,children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:e.team_alias?"".concat(e.team_alias.slice(0,30),"..."):"Team ".concat(e.team_id.slice(0,30),"...")})]})},e.team_id))]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)(n.Z,{className:"text-lg font-semibold text-gray-900",children:"View:"}),(0,s.jsxs)(la.Z,{className:"w-64",defaultValue:"current_team",value:v,onValueChange:e=>_(e),children:[(0,s.jsx)(lr.Z,{value:"current_team",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-purple-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"Current Team Models"})]})}),(0,s.jsx)(lr.Z,{value:"all",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-gray-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"All Available Models"})]})})]})]})]}),"current_team"===v&&(0,s.jsxs)("div",{className:"flex items-start gap-2 mt-3",children:[(0,s.jsx)(em.Z,{className:"text-gray-400 mt-0.5 flex-shrink-0 text-xs"}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"personal"===y?(0,s.jsxs)("span",{children:["To access these models: Create a Virtual Key without selecting a team on the"," ",(0,s.jsx)("a",{href:"/public?login=success&page=api-keys",className:"text-gray-600 hover:text-gray-800 underline",children:"Virtual Keys page"})]}):(0,s.jsxs)("span",{children:['To access these models: Create a Virtual Key and select Team as "',"string"!=typeof y?y.team_alias||y.team_id:"",'" on the'," ",(0,s.jsx)("a",{href:"/public?login=success&page=api-keys",className:"text-gray-600 hover:text-gray-800 underline",children:"Virtual Keys page"})]})})]})]}),(0,s.jsx)("div",{className:"border-b px-6 py-4",children:(0,s.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,s.jsxs)("div",{className:"relative w-64",children:[(0,s.jsx)("input",{type:"text",placeholder:"Search model names...",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:f,onChange:e=>j(e.target.value)}),(0,s.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]}),(0,s.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 ".concat(N?"bg-gray-100":""),onClick:()=>Z(!N),children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),"Filters"]}),(0,s.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",onClick:()=>{j(""),t("all"),C(null),b("personal"),_("current_team"),E({pageIndex:0,pageSize:50})},children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Reset Filters"]})]}),N&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,s.jsx)("div",{className:"w-64",children:(0,s.jsxs)(la.Z,{value:null!=l?l:"all",onValueChange:e=>t("all"===e?"all":e),placeholder:"Filter by Public Model Name",children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Models"}),(0,s.jsx)(lr.Z,{value:"wildcard",children:"Wildcard Models (*)"}),a.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,children:e},l))]})}),(0,s.jsx)("div",{className:"w-64",children:(0,s.jsxs)(la.Z,{value:null!=w?w:"all",onValueChange:e=>C("all"===e?null:e),placeholder:"Filter by Model Access Group",children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Model Access Groups"}),r.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,children:e},l))]})})]}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("span",{className:"text-sm text-gray-700",children:I.length>0?"Showing ".concat(A.pageIndex*A.pageSize+1," - ").concat(Math.min((A.pageIndex+1)*A.pageSize,I.length)," of ").concat(I.length," results"):"Showing 0 results"}),I.length>A.pageSize&&(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("button",{onClick:()=>E(e=>({...e,pageIndex:e.pageIndex-1})),disabled:0===A.pageIndex,className:"px-3 py-1 text-sm border rounded-md ".concat(0===A.pageIndex?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Previous"}),(0,s.jsx)("button",{onClick:()=>E(e=>({...e,pageIndex:e.pageIndex+1})),disabled:A.pageIndex>=Math.ceil(I.length/A.pageSize)-1,className:"px-3 py-1 text-sm border rounded-md ".concat(A.pageIndex>=Math.ceil(I.length/A.pageSize)-1?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Next"})]})]})]})}),(0,s.jsx)(le.C,{columns:ls(x,h,p,d,c,J,()=>{},()=>{},m,S,k),data:F,isLoading:!1,table:M})]})})})})},ln=t(75105),lo=t(40278),ld=t(97765),lc=t(21626),lm=t(97214),lu=t(28241),lh=t(58834),lx=t(69552),lp=t(71876),lg=t(39789),lf=t(79326),lj=t(2356),lv=t(59664),l_=e=>{let{modelMetrics:l,modelMetricsCategories:t,customTooltip:a,premiumUser:r}=e;return(0,s.jsx)(lv.Z,{title:"Time to First token (s)",className:"h-72",data:l,index:"date",showLegend:!1,categories:t,colors:["indigo","rose"],connectNulls:!0,customTooltip:a})},ly=e=>{let{setSelectedAPIKey:l,keys:t,teams:a,setSelectedCustomer:r,allEndUsers:i}=e,{premiumUser:d}=(0,H.Z)(),[c,m]=(0,o.useState)(null);return(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"mb-1",children:"Select API Key Name"}),d?(0,s.jsxs)("div",{children:[(0,s.jsxs)(la.Z,{defaultValue:"all-keys",children:[(0,s.jsx)(lr.Z,{value:"all-keys",onClick:()=>{l(null)},children:"All Keys"},"all-keys"),null==t?void 0:t.map((e,t)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,s.jsx)(lr.Z,{value:String(t),onClick:()=>{l(e)},children:e.key_alias},t):null)]}),(0,s.jsx)(n.Z,{className:"mt-1",children:"Select Customer Name"}),(0,s.jsxs)(la.Z,{defaultValue:"all-customers",children:[(0,s.jsx)(lr.Z,{value:"all-customers",onClick:()=>{r(null)},children:"All Customers"},"all-customers"),null==i?void 0:i.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,onClick:()=>{r(e)},children:e},l))]}),(0,s.jsx)(n.Z,{className:"mt-1",children:"Select Team"}),(0,s.jsxs)(la.Z,{className:"w-64 relative z-50",defaultValue:"all",value:null!=c?c:"all",onValueChange:e=>m("all"===e?null:e),children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Teams"}),null==a?void 0:a.filter(e=>e.team_id).map(e=>(0,s.jsx)(lr.Z,{value:e.team_id,children:e.team_alias?"".concat(e.team_alias," (").concat(e.team_id.slice(0,8),"...)"):"Team ".concat(e.team_id.slice(0,8),"...")},e.team_id))]})]}):(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"mt-1",children:"Select Team"}),(0,s.jsxs)(la.Z,{className:"w-64 relative z-50",defaultValue:"all",value:null!=c?c:"all",onValueChange:e=>m("all"===e?null:e),children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Teams"}),null==a?void 0:a.filter(e=>e.team_id).map(e=>(0,s.jsx)(lr.Z,{value:e.team_id,children:e.team_alias?"".concat(e.team_alias," (").concat(e.team_id.slice(0,8),"...)"):"Team ".concat(e.team_id.slice(0,8),"...")},e.team_id))]})]})]})},lb=e=>{let{dateValue:l,setDateValue:t,selectedModelGroup:a,availableModelGroups:d,setShowAdvancedFilters:m,modelMetrics:u,modelMetricsCategories:h,streamingModelMetrics:x,streamingModelMetricsCategories:p,customTooltip:g,slowResponsesData:f,modelExceptions:j,globalExceptionData:v,allExceptions:_,globalExceptionPerDeployment:y,setSelectedAPIKey:b,keys:N,setSelectedCustomer:Z,teams:w,allEndUsers:C,selectedAPIKey:S,selectedCustomer:k,selectedTeam:A,setSelectedModelGroup:E,setModelMetrics:M,setModelMetricsCategories:I,setStreamingModelMetrics:F,setStreamingModelMetricsCategories:P,setSlowResponsesData:L,setModelExceptions:T,setAllExceptions:R,setGlobalExceptionData:O,setGlobalExceptionPerDeployment:V}=e,{accessToken:D,userId:z,userRole:q,premiumUser:B}=(0,H.Z)();(0,o.useEffect)(()=>{U(a,l.from,l.to)},[S,k,A]);let U=async(e,l,t)=>{if(console.log("Updating model metrics for group:",e),!D||!z||!q||!l||!t)return;console.log("inside updateModelMetrics - startTime:",l,"endTime:",t),E(e);let s=null==S?void 0:S.token;void 0===s&&(s=null);let a=k;void 0===a&&(a=null);try{let r=await (0,c.modelMetricsCall)(D,z,q,e,l.toISOString(),t.toISOString(),s,a);console.log("Model metrics response:",r),M(r.data),I(r.all_api_bases);let i=await (0,c.streamingModelMetricsCall)(D,e,l.toISOString(),t.toISOString());F(i.data),P(i.all_api_bases);let n=await (0,c.modelExceptionsCall)(D,z,q,e,l.toISOString(),t.toISOString(),s,a);console.log("Model exceptions response:",n),T(n.data),R(n.exception_types);let o=await (0,c.modelMetricsSlowResponsesCall)(D,z,q,e,l.toISOString(),t.toISOString(),s,a);if(console.log("slowResponses:",o),L(o),e){let s=await (0,c.adminGlobalActivityExceptions)(D,null==l?void 0:l.toISOString().split("T")[0],null==t?void 0:t.toISOString().split("T")[0],e);O(s);let a=await (0,c.adminGlobalActivityExceptionsPerDeployment)(D,null==l?void 0:l.toISOString().split("T")[0],null==t?void 0:t.toISOString().split("T")[0],e);V(a)}}catch(e){console.error("Failed to fetch model metrics",e)}};return(0,s.jsxs)(ee.Z,{children:[(0,s.jsx)("div",{className:"mb-4 rounded-md border border-red-500 bg-red-50 p-4",children:(0,s.jsx)(n.Z,{className:"font-semibold text-red-700",children:"This page is deprecated and will be removed in the future. Some functionality may not work as expected."})}),(0,s.jsxs)(i.Z,{numItems:4,className:"mt-2 mb-2",children:[(0,s.jsx)(r.Z,{children:(0,s.jsx)(lg.Z,{value:l,className:"mr-2",onValueChange:e=>{t(e),U(a,e.from,e.to)}})}),(0,s.jsxs)(r.Z,{className:"ml-2",children:[(0,s.jsx)(n.Z,{children:"Select Model Group"}),(0,s.jsx)(la.Z,{defaultValue:a||d[0],value:a||d[0],children:d.map((e,t)=>(0,s.jsx)(lr.Z,{value:e,onClick:()=>U(e,l.from,l.to),children:e},t))})]}),(0,s.jsx)(r.Z,{children:(0,s.jsx)(lf.Z,{trigger:"click",content:(0,s.jsx)(ly,{allEndUsers:C,keys:N,setSelectedAPIKey:b,setSelectedCustomer:Z,teams:w}),overlayStyle:{width:"20vw"},children:(0,s.jsx)(eY.Z,{icon:lj.Z,size:"md",variant:"secondary",className:"mt-4 ml-2",style:{border:"none"},onClick:()=>m(!0)})})})]}),(0,s.jsxs)(i.Z,{numItems:2,children:[(0,s.jsx)(r.Z,{children:(0,s.jsx)(e$.Z,{className:"mr-2 max-h-[400px] min-h-[400px]",children:(0,s.jsxs)(Q.Z,{children:[(0,s.jsxs)(X.Z,{variant:"line",defaultValue:"1",children:[(0,s.jsx)($.Z,{value:"1",children:"Avg. Latency per Token"}),(0,s.jsx)($.Z,{value:"2",children:"Time to first token"})]}),(0,s.jsxs)(el.Z,{children:[(0,s.jsxs)(ee.Z,{children:[(0,s.jsx)("p",{className:"text-gray-500 italic",children:" (seconds/token)"}),(0,s.jsx)(n.Z,{className:"text-gray-500 italic mt-1 mb-1",children:"average Latency for successfull requests divided by the total tokens"}),u&&h&&(0,s.jsx)(ln.Z,{title:"Model Latency",className:"h-72",data:u,showLegend:!1,index:"date",categories:h,connectNulls:!0,customTooltip:g})]}),(0,s.jsx)(ee.Z,{children:(0,s.jsx)(l_,{modelMetrics:x,modelMetricsCategories:p,customTooltip:g,premiumUser:B})})]})]})})}),(0,s.jsx)(r.Z,{children:(0,s.jsx)(e$.Z,{className:"ml-2 max-h-[400px] min-h-[400px] overflow-y-auto",children:(0,s.jsxs)(lc.Z,{children:[(0,s.jsx)(lh.Z,{children:(0,s.jsxs)(lp.Z,{children:[(0,s.jsx)(lx.Z,{children:"Deployment"}),(0,s.jsx)(lx.Z,{children:"Success Responses"}),(0,s.jsxs)(lx.Z,{children:["Slow Responses ",(0,s.jsx)("p",{children:"Success Responses taking 600+s"})]})]})}),(0,s.jsx)(lm.Z,{children:f.map((e,l)=>(0,s.jsxs)(lp.Z,{children:[(0,s.jsx)(lu.Z,{children:e.api_base}),(0,s.jsx)(lu.Z,{children:e.total_count}),(0,s.jsx)(lu.Z,{children:e.slow_count})]},l))})]})})})]}),(0,s.jsx)(i.Z,{numItems:1,className:"gap-2 w-full mt-2",children:(0,s.jsxs)(e$.Z,{children:[(0,s.jsxs)(eX.Z,{children:["All Exceptions for ",a]}),(0,s.jsx)(lo.Z,{className:"h-60",data:j,index:"model",categories:_,stack:!0,yAxisWidth:30})]})}),(0,s.jsxs)(i.Z,{numItems:1,className:"gap-2 w-full mt-2",children:[(0,s.jsxs)(e$.Z,{children:[(0,s.jsxs)(eX.Z,{children:["All Up Rate Limit Errors (429) for ",a]}),(0,s.jsxs)(i.Z,{numItems:1,children:[(0,s.jsxs)(r.Z,{children:[(0,s.jsxs)(ld.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",v.sum_num_rate_limit_exceptions]}),(0,s.jsx)(lo.Z,{className:"h-40",data:v.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]}),(0,s.jsx)(r.Z,{})]})]}),B?(0,s.jsx)(s.Fragment,{children:y.map((e,l)=>(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(eX.Z,{children:e.api_base?e.api_base:"Unknown API Base"}),(0,s.jsx)(i.Z,{numItems:1,children:(0,s.jsxs)(r.Z,{children:[(0,s.jsxs)(ld.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors (429) ",e.sum_num_rate_limit_exceptions]}),(0,s.jsx)(lo.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]},l))}):(0,s.jsx)(s.Fragment,{children:y&&y.length>0&&y.slice(0,1).map((e,l)=>(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(eX.Z,{children:"✨ Rate Limit Errors by Deployment"}),(0,s.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to see exceptions for all deployments"}),(0,s.jsx)(eY.Z,{variant:"primary",className:"mb-2",children:(0,s.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})}),(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(eX.Z,{children:e.api_base}),(0,s.jsx)(i.Z,{numItems:1,children:(0,s.jsxs)(r.Z,{children:[(0,s.jsxs)(ld.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",e.sum_num_rate_limit_exceptions]}),(0,s.jsx)(lo.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]})]},l))})]})]})};let lN={"BadRequestError (400)":"BadRequestErrorRetries","AuthenticationError (401)":"AuthenticationErrorRetries","TimeoutError (408)":"TimeoutErrorRetries","RateLimitError (429)":"RateLimitErrorRetries","ContentPolicyViolationError (400)":"ContentPolicyViolationErrorRetries","InternalServerError (500)":"InternalServerErrorRetries"};var lZ=e=>{let{selectedModelGroup:l,setSelectedModelGroup:t,availableModelGroups:a,globalRetryPolicy:r,setGlobalRetryPolicy:i,defaultRetry:o,modelGroupRetryPolicy:d,setModelGroupRetryPolicy:c,handleSaveRetrySettings:m}=e;return(0,s.jsxs)(ee.Z,{children:[(0,s.jsx)("div",{className:"flex items-center gap-4 mb-6",children:(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(n.Z,{children:"Retry Policy Scope:"}),(0,s.jsxs)(la.Z,{className:"ml-2 w-48",defaultValue:"global",value:"global"===l?"global":l||a[0],onValueChange:e=>t(e),children:[(0,s.jsx)(lr.Z,{value:"global",children:"Global Default"}),a.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,onClick:()=>t(e),children:e},l))]})]})}),"global"===l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eX.Z,{children:"Global Retry Policy"}),(0,s.jsx)(n.Z,{className:"mb-6",children:"Default retry settings applied to all model groups unless overridden"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(eX.Z,{children:["Retry Policy for ",l]}),(0,s.jsx)(n.Z,{className:"mb-6",children:"Model-specific retry settings. Falls back to global defaults if not set."})]}),lN&&(0,s.jsx)("table",{children:(0,s.jsx)("tbody",{children:Object.entries(lN).map((e,t)=>{var a,m,u,h;let x,[p,g]=e;if("global"===l)x=null!==(a=null==r?void 0:r[g])&&void 0!==a?a:o;else{let e=null==d?void 0:null===(m=d[l])||void 0===m?void 0:m[g];x=null!=e?e:null!==(u=null==r?void 0:r[g])&&void 0!==u?u:o}return(0,s.jsxs)("tr",{className:"flex justify-between items-center mt-2",children:[(0,s.jsxs)("td",{children:[(0,s.jsx)(n.Z,{children:p}),"global"!==l&&(0,s.jsxs)(n.Z,{className:"text-xs text-gray-500 ml-2",children:["(Global: ",null!==(h=null==r?void 0:r[g])&&void 0!==h?h:o,")"]})]}),(0,s.jsx)("td",{children:(0,s.jsx)(ej.Z,{className:"ml-5",value:x,min:0,step:1,onChange:e=>{"global"===l?i(l=>null==e?l:{...null!=l?l:{},[g]:e}):c(t=>{var s;let a=null!==(s=null==t?void 0:t[l])&&void 0!==s?s:{};return{...null!=t?t:{},[l]:{...a,[g]:e}}})}})})]},t)})})}),(0,s.jsx)(eY.Z,{className:"mt-6 mr-8",onClick:m,children:"Save"})]})},lw=t(58760),lC=t(867),lS=t(3810),lk=t(89245),lA=t(5540),lE=t(8881);let{Text:lM}=C.default;var lI=e=>{let{accessToken:l,onReloadSuccess:t,buttonText:a="Reload Price Data",showIcon:r=!0,size:i="middle",type:n="primary",className:m=""}=e,[u,h]=(0,o.useState)(!1),[x,p]=(0,o.useState)(!1),[g,f]=(0,o.useState)(!1),[j,v]=(0,o.useState)(!1),[_,y]=(0,o.useState)(6),[b,N]=(0,o.useState)(null),[Z,w]=(0,o.useState)(!1);(0,o.useEffect)(()=>{C();let e=setInterval(()=>{C()},3e4);return()=>clearInterval(e)},[l]);let C=async()=>{if(l){w(!0);try{console.log("Fetching reload status...");let e=await (0,c.getModelCostMapReloadStatus)(l);console.log("Received status:",e),N(e)}catch(e){console.error("Failed to fetch reload status:",e),N({scheduled:!1,interval_hours:null,last_run:null,next_run:null})}finally{w(!1)}}},k=async()=>{if(!l){d.Z.fromBackend("No access token available");return}h(!0);try{let e=await (0,c.reloadModelCostMap)(l);"success"===e.status?(d.Z.success("Price data reloaded successfully! ".concat(e.models_count||0," models updated.")),null==t||t(),await C()):d.Z.fromBackend("Failed to reload price data")}catch(e){console.error("Error reloading price data:",e),d.Z.fromBackend("Failed to reload price data. Please try again.")}finally{h(!1)}},A=async()=>{if(!l){d.Z.fromBackend("No access token available");return}if(_<=0){d.Z.fromBackend("Hours must be greater than 0");return}p(!0);try{let e=await (0,c.scheduleModelCostMapReload)(l,_);"success"===e.status?(d.Z.success("Periodic reload scheduled for every ".concat(_," hours")),v(!1),await C()):d.Z.fromBackend("Failed to schedule periodic reload")}catch(e){console.error("Error scheduling reload:",e),d.Z.fromBackend("Failed to schedule periodic reload. Please try again.")}finally{p(!1)}},M=async()=>{if(!l){d.Z.fromBackend("No access token available");return}f(!0);try{let e=await (0,c.cancelModelCostMapReload)(l);"success"===e.status?(d.Z.success("Periodic reload cancelled successfully"),await C()):d.Z.fromBackend("Failed to cancel periodic reload")}catch(e){console.error("Error cancelling reload:",e),d.Z.fromBackend("Failed to cancel periodic reload. Please try again.")}finally{f(!1)}},I=e=>{if(!e)return"Never";try{return new Date(e).toLocaleString()}catch(l){return e}};return(0,s.jsxs)("div",{className:m,children:[(0,s.jsxs)(lw.Z,{direction:"horizontal",size:"middle",style:{marginBottom:16},children:[(0,s.jsx)(lC.Z,{title:"Hard Refresh Price Data",description:"This will immediately fetch the latest pricing information from the remote source. Continue?",onConfirm:k,okText:"Yes",cancelText:"No",okButtonProps:{style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem",transition:"all 0.2s ease-in-out"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#4f46e5"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#6366f1"}},children:(0,s.jsx)(E.ZP,{type:n,size:i,loading:u,icon:r?(0,s.jsx)(lk.Z,{}):void 0,style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem",transition:"all 0.2s ease-in-out"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#4f46e5"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#6366f1"},children:a})}),(null==b?void 0:b.scheduled)?(0,s.jsx)(E.ZP,{type:"default",size:i,danger:!0,icon:(0,s.jsx)(lE.Z,{}),loading:g,onClick:M,style:{borderColor:"#ff4d4f",color:"#ff4d4f",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem"},children:"Cancel Periodic Reload"}):(0,s.jsx)(E.ZP,{type:"default",size:i,icon:(0,s.jsx)(lA.Z,{}),onClick:()=>v(!0),style:{borderColor:"#d9d9d9",color:"#6366f1",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem"},children:"Set Up Periodic Reload"})]}),b&&(0,s.jsx)(ea.Z,{size:"small",style:{backgroundColor:"#f8f9fa",border:"1px solid #e9ecef",borderRadius:8},children:(0,s.jsxs)(lw.Z,{direction:"vertical",size:"small",style:{width:"100%"},children:[b.scheduled?(0,s.jsx)("div",{children:(0,s.jsxs)(lS.Z,{color:"green",icon:(0,s.jsx)(lA.Z,{}),children:["Scheduled every ",b.interval_hours," hours"]})}):(0,s.jsx)(lM,{type:"secondary",children:"No periodic reload scheduled"}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(lM,{type:"secondary",style:{fontSize:"12px"},children:"Last run:"}),(0,s.jsx)(lM,{style:{fontSize:"12px"},children:I(b.last_run)})]}),b.scheduled&&(0,s.jsxs)(s.Fragment,{children:[b.next_run&&(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(lM,{type:"secondary",style:{fontSize:"12px"},children:"Next run:"}),(0,s.jsx)(lM,{style:{fontSize:"12px"},children:I(b.next_run)})]}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(lM,{type:"secondary",style:{fontSize:"12px"},children:"Status:"}),(0,s.jsx)(lS.Z,{color:(null==b?void 0:b.scheduled)?b.last_run?"success":"processing":"default",children:(null==b?void 0:b.scheduled)?b.last_run?"Active":"Ready":"Not scheduled"})]})]})]})}),(0,s.jsxs)(S.Z,{title:"Set Up Periodic Reload",open:j,onOk:A,onCancel:()=>v(!1),confirmLoading:x,okText:"Schedule",cancelText:"Cancel",okButtonProps:{style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white"}},children:[(0,s.jsx)("div",{style:{marginBottom:16},children:(0,s.jsx)(lM,{children:"Set up automatic reload of price data every:"})}),(0,s.jsx)("div",{style:{marginBottom:16},children:(0,s.jsx)(ej.Z,{min:1,max:168,value:_,onChange:e=>y(e||6),addonAfter:"hours",style:{width:"100%"}})}),(0,s.jsx)("div",{children:(0,s.jsxs)(lM,{type:"secondary",children:["This will automatically fetch the latest pricing data from the remote source every ",_," hours."]})})]})]})},lF=e=>{let{setModelMap:l}=e,{accessToken:t}=(0,H.Z)();return(0,s.jsx)(ee.Z,{children:(0,s.jsxs)("div",{className:"p-6",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)(eX.Z,{children:"Price Data Management"}),(0,s.jsx)(n.Z,{className:"text-tremor-content",children:"Manage model pricing data and configure automatic reload schedules"})]}),(0,s.jsx)(lI,{accessToken:t,onReloadSuccess:()=>{(async()=>{l(await (0,c.modelCostMap)(t))})()},buttonText:"Reload Price Data",size:"middle",type:"primary",className:"w-full"})]})})},lP=t(61994),lL=t(15731),lT=t(91126);let lR=(e,l,t,a,r,i,n,o,d,c,m)=>[{header:()=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(lP.Z,{checked:t,indeterminate:l.length>0&&!t,onChange:e=>r(e.target.checked),onClick:e=>e.stopPropagation()}),(0,s.jsx)("span",{children:"Model ID"})]}),accessorKey:"model_info.id",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:t}=e,r=t.original,i=r.model_name,n=l.includes(i);return(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(lP.Z,{checked:n,onChange:e=>a(i,e.target.checked),onClick:e=>e.stopPropagation()}),(0,s.jsx)(A.Z,{title:r.model_info.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>m&&m(r.model_info.id),children:r.model_info.id})})]})}},{header:"Model Name",accessorKey:"model_name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,t=l.original,a=o(t)||t.model_name;return(0,s.jsx)("div",{className:"font-medium text-sm",children:(0,s.jsx)(A.Z,{title:a,children:(0,s.jsx)("div",{className:"truncate max-w-[200px]",children:a})})})}},{header:"Health Status",accessorKey:"health_status",enableSorting:!0,sortingFn:(e,l,t)=>{var s,a;let r=e.getValue("health_status")||"unknown",i=l.getValue("health_status")||"unknown",n={healthy:0,checking:1,unknown:2,unhealthy:3};return(null!==(s=n[r])&&void 0!==s?s:4)-(null!==(a=n[i])&&void 0!==a?a:4)},cell:l=>{var t;let{row:a}=l,r=a.original,i={status:r.health_status,loading:r.health_loading,error:r.health_error};if(i.loading)return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse"}),(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse",style:{animationDelay:"0.2s"}}),(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse",style:{animationDelay:"0.4s"}})]}),(0,s.jsx)(eb.x,{className:"text-gray-600 text-sm",children:"Checking..."})]});let o=r.model_name,d="healthy"===i.status&&(null===(t=e[o])||void 0===t?void 0:t.successResponse);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[n(i.status),d&&c&&(0,s.jsx)(A.Z,{title:"View response details",placement:"top",children:(0,s.jsx)("button",{onClick:()=>{var l;return c(o,null===(l=e[o])||void 0===l?void 0:l.successResponse)},className:"p-1 text-green-600 hover:text-green-800 hover:bg-green-50 rounded cursor-pointer transition-colors",children:(0,s.jsx)(lL.Z,{className:"h-4 w-4"})})})]})}},{header:"Error Details",accessorKey:"health_error",enableSorting:!1,cell:l=>{let{row:t}=l,a=t.original.model_name,r=e[a];if(!(null==r?void 0:r.error))return(0,s.jsx)(eb.x,{className:"text-gray-400 text-sm",children:"No errors"});let i=r.error,n=r.fullError||r.error;return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"max-w-[200px]",children:(0,s.jsx)(A.Z,{title:i,placement:"top",children:(0,s.jsx)(eb.x,{className:"text-red-600 text-sm truncate",children:i})})}),d&&n!==i&&(0,s.jsx)(A.Z,{title:"View full error details",placement:"top",children:(0,s.jsx)("button",{onClick:()=>d(a,i,n),className:"p-1 text-red-600 hover:text-red-800 hover:bg-red-50 rounded cursor-pointer transition-colors",children:(0,s.jsx)(lL.Z,{className:"h-4 w-4"})})})]})}},{header:"Last Check",accessorKey:"last_check",enableSorting:!0,sortingFn:(e,l,t)=>{let s=e.getValue("last_check")||"Never checked",a=l.getValue("last_check")||"Never checked";if("Never checked"===s&&"Never checked"===a)return 0;if("Never checked"===s)return 1;if("Never checked"===a)return -1;if("Check in progress..."===s&&"Check in progress..."===a)return 0;if("Check in progress..."===s)return -1;if("Check in progress..."===a)return 1;let r=new Date(s),i=new Date(a);return isNaN(r.getTime())&&isNaN(i.getTime())?0:isNaN(r.getTime())?1:isNaN(i.getTime())?-1:i.getTime()-r.getTime()},cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)(eb.x,{className:"text-gray-600 text-sm",children:t.health_loading?"Check in progress...":t.last_check})}},{header:"Last Success",accessorKey:"last_success",enableSorting:!0,sortingFn:(e,l,t)=>{let s=e.getValue("last_success")||"Never succeeded",a=l.getValue("last_success")||"Never succeeded";if("Never succeeded"===s&&"Never succeeded"===a)return 0;if("Never succeeded"===s)return 1;if("Never succeeded"===a)return -1;if("None"===s&&"None"===a)return 0;if("None"===s)return 1;if("None"===a)return -1;let r=new Date(s),i=new Date(a);return isNaN(r.getTime())&&isNaN(i.getTime())?0:isNaN(r.getTime())?1:isNaN(i.getTime())?-1:i.getTime()-r.getTime()},cell:l=>{let{row:t}=l,a=e[t.original.model_name],r=(null==a?void 0:a.lastSuccess)||"None";return(0,s.jsx)(eb.x,{className:"text-gray-600 text-sm",children:r})}},{header:"Actions",id:"actions",cell:e=>{let{row:l}=e,t=l.original,a=t.model_name,r=t.health_status&&"none"!==t.health_status,n=t.health_loading?"Checking...":r?"Re-run Health Check":"Run Health Check";return(0,s.jsx)(A.Z,{title:n,placement:"top",children:(0,s.jsx)("button",{className:"p-2 rounded-md transition-colors ".concat(t.health_loading?"text-gray-400 cursor-not-allowed bg-gray-100":"text-indigo-600 hover:text-indigo-700 hover:bg-indigo-50"),onClick:()=>{t.health_loading||i(a)},disabled:t.health_loading,children:t.health_loading?(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse"}),(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse",style:{animationDelay:"0.2s"}}),(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse",style:{animationDelay:"0.4s"}})]}):r?(0,s.jsx)(W.Z,{className:"h-4 w-4"}):(0,s.jsx)(lT.Z,{className:"h-4 w-4"})})})},enableSorting:!1}],lO=[{pattern:/Missing .* API Key/i,replacement:"Missing API Key"},{pattern:/Connection timeout/i,replacement:"Connection timeout"},{pattern:/Network.*not.*ok/i,replacement:"Network connection failed"},{pattern:/403.*Forbidden/i,replacement:"Access forbidden - check API key permissions"},{pattern:/401.*Unauthorized/i,replacement:"Unauthorized - invalid API key"},{pattern:/429.*rate limit/i,replacement:"Rate limit exceeded"},{pattern:/500.*Internal Server Error/i,replacement:"Provider internal server error"},{pattern:/litellm\.AuthenticationError/i,replacement:"Authentication failed"},{pattern:/litellm\.RateLimitError/i,replacement:"Rate limit exceeded"},{pattern:/litellm\.APIError/i,replacement:"API error"}];var lV=e=>{let{accessToken:l,modelData:t,all_models_on_proxy:a,getDisplayModelName:r,setSelectedModelId:i}=e,[d,m]=(0,o.useState)({}),[u,h]=(0,o.useState)([]),[x,p]=(0,o.useState)(!1),[g,f]=(0,o.useState)(!1),[j,v]=(0,o.useState)(null),[_,y]=(0,o.useState)(!1),[b,N]=(0,o.useState)(null),Z=(0,o.useRef)(null);(0,o.useEffect)(()=>{l&&(null==t?void 0:t.data)&&(async()=>{let e={};t.data.forEach(l=>{e[l.model_name]={status:"none",lastCheck:"None",lastSuccess:"None",loading:!1,error:void 0,fullError:void 0,successResponse:void 0}});try{let s=await (0,c.latestHealthChecksCall)(l);s&&s.latest_health_checks&&"object"==typeof s.latest_health_checks&&Object.entries(s.latest_health_checks).forEach(l=>{let[s,a]=l;if(!a)return;let r=null,i=t.data.find(e=>e.model_name===s);if(i)r=i.model_name;else{let e=t.data.find(e=>e.model_info&&e.model_info.id===s);if(e)r=e.model_name;else if(a.model_name){let e=t.data.find(e=>e.model_name===a.model_name);e&&(r=e.model_name)}}if(r){let l=a.error_message||void 0;e[r]={status:a.status||"unknown",lastCheck:a.checked_at?new Date(a.checked_at).toLocaleString():"None",lastSuccess:"healthy"===a.status&&a.checked_at?new Date(a.checked_at).toLocaleString():"None",loading:!1,error:l?w(l):void 0,fullError:l,successResponse:"healthy"===a.status?a:void 0}}})}catch(e){console.warn("Failed to load health check history (using default states):",e)}m(e)})()},[l,t]);let w=e=>{var l;if(!e)return"Health check failed";let t="string"==typeof e?e:JSON.stringify(e),s=t.match(/(\w+Error):\s*(\d{3})/i);if(s)return"".concat(s[1],": ").concat(s[2]);let a=t.match(/(AuthenticationError|RateLimitError|BadRequestError|InternalServerError|TimeoutError|NotFoundError|ForbiddenError|ServiceUnavailableError|BadGatewayError|ContentPolicyViolationError|\w+Error)/i),r=t.match(/\b(400|401|403|404|408|429|500|502|503|504)\b/);if(a&&r)return"".concat(a[1],": ").concat(r[1]);if(r){let e=r[1];return"".concat({400:"BadRequestError",401:"AuthenticationError",403:"ForbiddenError",404:"NotFoundError",408:"TimeoutError",429:"RateLimitError",500:"InternalServerError",502:"BadGatewayError",503:"ServiceUnavailableError",504:"GatewayTimeoutError"}[e],": ").concat(e)}if(a){let e=a[1],l={AuthenticationError:"401",RateLimitError:"429",BadRequestError:"400",InternalServerError:"500",TimeoutError:"408",NotFoundError:"404",ForbiddenError:"403",ServiceUnavailableError:"503",BadGatewayError:"502",GatewayTimeoutError:"504",ContentPolicyViolationError:"400"}[e];return l?"".concat(e,": ").concat(l):e}for(let{pattern:e,replacement:l}of lO)if(e.test(t))return l;if(/missing.*api.*key|invalid.*key|unauthorized/i.test(t))return"AuthenticationError: 401";if(/rate.*limit|too.*many.*requests/i.test(t))return"RateLimitError: 429";if(/timeout|timed.*out/i.test(t))return"TimeoutError: 408";if(/not.*found/i.test(t))return"NotFoundError: 404";if(/forbidden|access.*denied/i.test(t))return"ForbiddenError: 403";if(/internal.*server.*error/i.test(t))return"InternalServerError: 500";let i=t.replace(/[\n\r]+/g," ").replace(/\s+/g," ").trim(),n=null===(l=i.split(/[.!?]/)[0])||void 0===l?void 0:l.trim();return n&&n.length>0?n.length>100?n.substring(0,97)+"...":n:i.length>100?i.substring(0,97)+"...":i},C=async e=>{if(l){m(l=>({...l,[e]:{...l[e],loading:!0,status:"checking"}}));try{var s,a;let r=await (0,c.individualModelHealthCheckCall)(l,e),i=new Date().toLocaleString();if(r.unhealthy_count>0&&r.unhealthy_endpoints&&r.unhealthy_endpoints.length>0){let l=(null===(s=r.unhealthy_endpoints[0])||void 0===s?void 0:s.error)||"Health check failed",t=w(l);m(s=>{var a;return{...s,[e]:{status:"unhealthy",lastCheck:i,lastSuccess:(null===(a=s[e])||void 0===a?void 0:a.lastSuccess)||"None",loading:!1,error:t,fullError:l}}})}else m(l=>({...l,[e]:{status:"healthy",lastCheck:i,lastSuccess:i,loading:!1,successResponse:r}}));try{let s=await (0,c.latestHealthChecksCall)(l),r=t.data.find(l=>l.model_name===e);if(r){let l=r.model_info.id,t=null===(a=s.latest_health_checks)||void 0===a?void 0:a[l];if(t){let l=t.error_message||void 0;m(s=>{var a,r,i,n,o,d,c;return{...s,[e]:{status:t.status||(null===(a=s[e])||void 0===a?void 0:a.status)||"unknown",lastCheck:t.checked_at?new Date(t.checked_at).toLocaleString():(null===(r=s[e])||void 0===r?void 0:r.lastCheck)||"None",lastSuccess:"healthy"===t.status?t.checked_at?new Date(t.checked_at).toLocaleString():(null===(i=s[e])||void 0===i?void 0:i.lastSuccess)||"None":(null===(n=s[e])||void 0===n?void 0:n.lastSuccess)||"None",loading:!1,error:l?w(l):null===(o=s[e])||void 0===o?void 0:o.error,fullError:l||(null===(d=s[e])||void 0===d?void 0:d.fullError),successResponse:"healthy"===t.status?t:null===(c=s[e])||void 0===c?void 0:c.successResponse}}})}}}catch(e){console.debug("Could not fetch updated status from database (non-critical):",e)}}catch(a){let l=new Date().toLocaleString(),t=a instanceof Error?a.message:String(a),s=w(t);m(a=>{var r;return{...a,[e]:{status:"unhealthy",lastCheck:l,lastSuccess:(null===(r=a[e])||void 0===r?void 0:r.lastSuccess)||"None",loading:!1,error:s,fullError:t}}})}}},k=async()=>{let e=u.length>0?u:a,s=e.reduce((e,l)=>(e[l]={...d[l],loading:!0,status:"checking"},e),{});m(e=>({...e,...s}));let r={},i=e.map(async e=>{if(l)try{let s=await (0,c.individualModelHealthCheckCall)(l,e);r[e]=s;let a=new Date().toLocaleString();if(s.unhealthy_count>0&&s.unhealthy_endpoints&&s.unhealthy_endpoints.length>0){var t;let l=(null===(t=s.unhealthy_endpoints[0])||void 0===t?void 0:t.error)||"Health check failed",r=w(l);m(t=>{var s;return{...t,[e]:{status:"unhealthy",lastCheck:a,lastSuccess:(null===(s=t[e])||void 0===s?void 0:s.lastSuccess)||"None",loading:!1,error:r,fullError:l}}})}else m(l=>({...l,[e]:{status:"healthy",lastCheck:a,lastSuccess:a,loading:!1,successResponse:s}}))}catch(a){console.error("Health check failed for ".concat(e,":"),a);let l=new Date().toLocaleString(),t=a instanceof Error?a.message:String(a),s=w(t);m(a=>{var r;return{...a,[e]:{status:"unhealthy",lastCheck:l,lastSuccess:(null===(r=a[e])||void 0===r?void 0:r.lastSuccess)||"None",loading:!1,error:s,fullError:t}}})}});await Promise.allSettled(i);try{if(!l)return;let s=await (0,c.latestHealthChecksCall)(l);s.latest_health_checks&&Object.entries(s.latest_health_checks).forEach(l=>{let[s,a]=l,r=t.data.find(e=>e.model_info.id===s);if(r&&e.includes(r.model_name)&&a){let e=r.model_name,l=a.error_message||void 0;m(t=>{let s=t[e];return{...t,[e]:{status:a.status||(null==s?void 0:s.status)||"unknown",lastCheck:a.checked_at?new Date(a.checked_at).toLocaleString():(null==s?void 0:s.lastCheck)||"None",lastSuccess:"healthy"===a.status&&a.checked_at?new Date(a.checked_at).toLocaleString():(null==s?void 0:s.lastSuccess)||"None",loading:!1,error:l?w(l):null==s?void 0:s.error,fullError:l||(null==s?void 0:s.fullError),successResponse:"healthy"===a.status?a:null==s?void 0:s.successResponse}}})}})}catch(e){console.warn("Failed to fetch updated health statuses from database (non-critical):",e)}},A=e=>{p(e),e?h(a):h([])},M=()=>{f(!1),v(null)},I=()=>{y(!1),N(null)};return(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-6",children:(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(eX.Z,{children:"Model Health Status"}),(0,s.jsx)(n.Z,{className:"text-gray-600 mt-1",children:"Run health checks on individual models to verify they are working correctly"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[u.length>0&&(0,s.jsx)(eY.Z,{size:"sm",variant:"light",onClick:()=>A(!1),className:"px-3 py-1 text-sm",children:"Clear Selection"}),(0,s.jsx)(eY.Z,{size:"sm",variant:"secondary",onClick:k,disabled:Object.values(d).some(e=>e.loading),className:"px-3 py-1 text-sm",children:u.length>0&&u.length{l?h(l=>[...l,e]):(h(l=>l.filter(l=>l!==e)),p(!1))},A,C,e=>{switch(e){case"healthy":return(0,s.jsx)(ll.Z,{color:"emerald",children:"healthy"});case"unhealthy":return(0,s.jsx)(ll.Z,{color:"red",children:"unhealthy"});case"checking":return(0,s.jsx)(ll.Z,{color:"blue",children:"checking"});case"none":return(0,s.jsx)(ll.Z,{color:"gray",children:"none"});default:return(0,s.jsx)(ll.Z,{color:"gray",children:"unknown"})}},r,(e,l,t)=>{v({modelName:e,cleanedError:l,fullError:t}),f(!0)},(e,l)=>{N({modelName:e,response:l}),y(!0)},i),data:t.data.map(e=>{let l=d[e.model_name]||{status:"none",lastCheck:"None",loading:!1};return{model_name:e.model_name,model_info:e.model_info,provider:e.provider,litellm_model_name:e.litellm_model_name,health_status:l.status,last_check:l.lastCheck,last_success:l.lastSuccess||"None",health_loading:l.loading,health_error:l.error,health_full_error:l.fullError}}),isLoading:!1,table:Z})}),(0,s.jsx)(S.Z,{title:j?"Health Check Error - ".concat(j.modelName):"Error Details",open:g,onCancel:M,footer:[(0,s.jsx)(E.ZP,{onClick:M,children:"Close"},"close")],width:800,children:j&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Error:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-red-50 border border-red-200 rounded-md",children:(0,s.jsx)(n.Z,{className:"text-red-800",children:j.cleanedError})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Full Error Details:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md max-h-96 overflow-y-auto",children:(0,s.jsx)("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:j.fullError})})]})]})}),(0,s.jsx)(S.Z,{title:b?"Health Check Response - ".concat(b.modelName):"Response Details",open:_,onCancel:I,footer:[(0,s.jsx)(E.ZP,{onClick:I,children:"Close"},"close")],width:800,children:b&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Status:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-green-50 border border-green-200 rounded-md",children:(0,s.jsx)(n.Z,{className:"text-green-800",children:"Health check passed successfully"})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Response Details:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md max-h-96 overflow-y-auto",children:(0,s.jsx)("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:JSON.stringify(b.response,null,2)})})]})]})})]})},lD=t(86462),lz=t(47686),lq=t(77355),lB=t(93416),lU=t(95704),lG=e=>{let{accessToken:l,initialModelGroupAlias:t={},onAliasUpdate:a}=e,[r,i]=(0,o.useState)([]),[n,m]=(0,o.useState)({aliasName:"",targetModelGroup:""}),[u,h]=(0,o.useState)(null),[x,p]=(0,o.useState)(!0);(0,o.useEffect)(()=>{i(Object.entries(t).map((e,l)=>{var t;let[s,a]=e;return{id:"".concat(l,"-").concat(s),aliasName:s,targetModelGroup:"string"==typeof a?a:null!==(t=null==a?void 0:a.model)&&void 0!==t?t:""}}))},[t]);let g=async e=>{if(!l)return console.error("Access token is missing"),!1;try{let t={};return e.forEach(e=>{t[e.aliasName]=e.targetModelGroup}),console.log("Saving model group alias:",t),await (0,c.setCallbacksCall)(l,{router_settings:{model_group_alias:t}}),a&&a(t),!0}catch(e){return console.error("Failed to save model group alias settings:",e),d.Z.fromBackend("Failed to save model group alias settings"),!1}},f=async()=>{if(!n.aliasName||!n.targetModelGroup){d.Z.fromBackend("Please provide both alias name and target model group");return}if(r.some(e=>e.aliasName===n.aliasName)){d.Z.fromBackend("An alias with this name already exists");return}let e=[...r,{id:"".concat(Date.now(),"-").concat(n.aliasName),aliasName:n.aliasName,targetModelGroup:n.targetModelGroup}];await g(e)&&(i(e),m({aliasName:"",targetModelGroup:""}),d.Z.success("Alias added successfully"))},j=e=>{h({...e})},v=async()=>{if(!u)return;if(!u.aliasName||!u.targetModelGroup){d.Z.fromBackend("Please provide both alias name and target model group");return}if(r.some(e=>e.id!==u.id&&e.aliasName===u.aliasName)){d.Z.fromBackend("An alias with this name already exists");return}let e=r.map(e=>e.id===u.id?u:e);await g(e)&&(i(e),h(null),d.Z.success("Alias updated successfully"))},_=()=>{h(null)},b=async e=>{let l=r.filter(l=>l.id!==e);await g(l)&&(i(l),d.Z.success("Alias deleted successfully"))},N=r.reduce((e,l)=>(e[l.aliasName]=l.targetModelGroup,e),{});return(0,s.jsxs)(lU.Zb,{className:"mb-6",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>p(!x),children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)(lU.Dx,{className:"mb-0",children:"Model Group Alias Settings"}),(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Create aliases for your model groups to simplify API calls. For example, you can create an alias 'gpt-4o' that points to 'gpt-4o-mini-openai' model group."})]}),(0,s.jsx)("div",{className:"flex items-center",children:x?(0,s.jsx)(lD.Z,{className:"w-5 h-5 text-gray-500"}):(0,s.jsx)(lz.Z,{className:"w-5 h-5 text-gray-500"})})]}),x&&(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)(lU.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Alias"}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Alias Name"}),(0,s.jsx)("input",{type:"text",value:n.aliasName,onChange:e=>m({...n,aliasName:e.target.value}),placeholder:"e.g., gpt-4o",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Target Model Group"}),(0,s.jsx)("input",{type:"text",value:n.targetModelGroup,onChange:e=>m({...n,targetModelGroup:e.target.value}),placeholder:"e.g., gpt-4o-mini-openai",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,s.jsx)("div",{className:"flex items-end",children:(0,s.jsxs)("button",{onClick:f,disabled:!n.aliasName||!n.targetModelGroup,className:"flex items-center px-4 py-2 rounded-md text-sm ".concat(n.aliasName&&n.targetModelGroup?"bg-green-600 text-white hover:bg-green-700":"bg-gray-300 text-gray-500 cursor-not-allowed"),children:[(0,s.jsx)(lq.Z,{className:"w-4 h-4 mr-1"}),"Add Alias"]})})]})]}),(0,s.jsx)(lU.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Aliases"}),(0,s.jsx)("div",{className:"rounded-lg custom-border relative mb-6",children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)(lU.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,s.jsx)(lU.ss,{children:(0,s.jsxs)(lU.SC,{children:[(0,s.jsx)(lU.xs,{className:"py-1 h-8",children:"Alias Name"}),(0,s.jsx)(lU.xs,{className:"py-1 h-8",children:"Target Model Group"}),(0,s.jsx)(lU.xs,{className:"py-1 h-8",children:"Actions"})]})}),(0,s.jsxs)(lU.RM,{children:[r.map(e=>(0,s.jsx)(lU.SC,{className:"h-8",children:u&&u.id===e.id?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(lU.pj,{className:"py-0.5",children:(0,s.jsx)("input",{type:"text",value:u.aliasName,onChange:e=>h({...u,aliasName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,s.jsx)(lU.pj,{className:"py-0.5",children:(0,s.jsx)("input",{type:"text",value:u.targetModelGroup,onChange:e=>h({...u,targetModelGroup:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,s.jsx)(lU.pj,{className:"py-0.5 whitespace-nowrap",children:(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("button",{onClick:v,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,s.jsx)("button",{onClick:_,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(lU.pj,{className:"py-0.5 text-sm text-gray-900",children:e.aliasName}),(0,s.jsx)(lU.pj,{className:"py-0.5 text-sm text-gray-500",children:e.targetModelGroup}),(0,s.jsx)(lU.pj,{className:"py-0.5 whitespace-nowrap",children:(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("button",{onClick:()=>j(e),className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,s.jsx)(lB.Z,{className:"w-3 h-3"})}),(0,s.jsx)("button",{onClick:()=>b(e.id),className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,s.jsx)(y.Z,{className:"w-3 h-3"})})]})})]})},e.id)),0===r.length&&(0,s.jsx)(lU.SC,{children:(0,s.jsx)(lU.pj,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No aliases added yet. Add a new alias above."})})]})]})})}),(0,s.jsxs)(lU.Zb,{children:[(0,s.jsx)(lU.Dx,{className:"mb-4",children:"Configuration Example"}),(0,s.jsx)(lU.xv,{className:"text-gray-600 mb-4",children:"Here's how your current aliases would look in the config.yaml:"}),(0,s.jsx)("div",{className:"bg-gray-100 rounded-lg p-4 font-mono text-sm",children:(0,s.jsxs)("div",{className:"text-gray-700",children:["router_settings:",(0,s.jsx)("br",{}),"\xa0\xa0model_group_alias:",0===Object.keys(N).length?(0,s.jsxs)("span",{className:"text-gray-500",children:[(0,s.jsx)("br",{}),"\xa0\xa0\xa0\xa0# No aliases configured yet"]}):Object.entries(N).map(e=>{let[l,t]=e;return(0,s.jsxs)("span",{children:[(0,s.jsx)("br",{}),'\xa0\xa0\xa0\xa0"',l,'": "',t,'"']},l)})]})})]})]})]})},lH=t(27593),lK=e=>{let{accessToken:l,token:t,userRole:u,userID:x,modelData:p={data:[]},keys:g,setModelData:j,premiumUser:_,teams:y}=e,[b]=N.Z.useForm(),[Z,w]=(0,o.useState)(null),[S,k]=(0,o.useState)(""),[A,E]=(0,o.useState)([]),[M,I]=(0,o.useState)([]),[F,P]=(0,o.useState)(m.Cl.Anthropic),[L,T]=(0,o.useState)(!1),[R,O]=(0,o.useState)(null),[V,D]=(0,o.useState)([]),[z,q]=(0,o.useState)([]),[B,U]=(0,o.useState)(null),[G,H]=(0,o.useState)([]),[es,ea]=(0,o.useState)([]),[er,ei]=(0,o.useState)([]),[en,eo]=(0,o.useState)([]),[ed,ec]=(0,o.useState)([]),[em,eu]=(0,o.useState)([]),[eh,ex]=(0,o.useState)([]),[ep,eg]=(0,o.useState)({from:new Date(Date.now()-6048e5),to:new Date}),[ef,ej]=(0,o.useState)(null),[ev,e_]=(0,o.useState)(null),[ey,eb]=(0,o.useState)(0),[eN,eZ]=(0,o.useState)({}),[ew,eC]=(0,o.useState)([]),[eS,ek]=(0,o.useState)(!1),[eA,eE]=(0,o.useState)(null),[eM,eI]=(0,o.useState)(null),[eF,eP]=(0,o.useState)([]),[eL,eT]=(0,o.useState)({}),[eR,eO]=(0,o.useState)(!1),[eV,eD]=(0,o.useState)(null),[ez,eq]=(0,o.useState)(!1),[eB,eU]=(0,o.useState)(null),[eG,eH]=(0,o.useState)(null),[eJ,eW]=(0,o.useState)(!1),eY=(0,o.useRef)(null),[e$,eQ]=(0,o.useState)(0),eX=(0,a.NL)(),{data:e0,isLoading:e1,refetch:e2}=v(l,x,u),{data:e4}=f(l),e5=(null==e4?void 0:e4.credentials)||[];(0,o.useEffect)(()=>{let e=e=>{eY.current&&!eY.current.contains(e.target)&&eW(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let e6={name:"file",accept:".json",pastable:!1,beforeUpload:e=>{if("application/json"===e.type){let l=new FileReader;l.onload=e=>{if(e.target){let l=e.target.result;b.setFieldsValue({vertex_credentials:l})}},l.readAsText(e)}return!1},onChange(e){"done"===e.file.status?d.Z.success("".concat(e.file.name," file uploaded successfully")):"error"===e.file.status&&d.Z.fromBackend("".concat(e.file.name," file upload failed."))}},e3=()=>{k(new Date().toLocaleString()),eX.invalidateQueries({queryKey:["models","list"]}),e2()},e9=async()=>{if(l)try{let e={router_settings:{}};"global"===B?(ev&&(e.router_settings.retry_policy=ev),d.Z.success("Global retry settings saved successfully")):(ef&&(e.router_settings.model_group_retry_policy=ef),d.Z.success("Retry settings saved successfully for ".concat(B))),await (0,c.setCallbacksCall)(l,e)}catch(e){d.Z.fromBackend("Failed to save retry settings")}};if((0,o.useEffect)(()=>{if(!l||!t||!u||!x||!e0)return;let e=async()=>{try{var e,t,s,a,r,i,n,o,d,m,h,p;j(e0);let g=await (0,c.modelSettingsCall)(l);g&&I(g);let f=new Set;for(let e=0;e0&&(y=v[v.length-1]);let b=await (0,c.modelMetricsCall)(l,x,u,y,null===(e=ep.from)||void 0===e?void 0:e.toISOString(),null===(t=ep.to)||void 0===t?void 0:t.toISOString(),null==eA?void 0:eA.token,eM);H(b.data),ea(b.all_api_bases);let N=await (0,c.streamingModelMetricsCall)(l,y,null===(s=ep.from)||void 0===s?void 0:s.toISOString(),null===(a=ep.to)||void 0===a?void 0:a.toISOString());ei(N.data),eo(N.all_api_bases);let Z=await (0,c.modelExceptionsCall)(l,x,u,y,null===(r=ep.from)||void 0===r?void 0:r.toISOString(),null===(i=ep.to)||void 0===i?void 0:i.toISOString(),null==eA?void 0:eA.token,eM);ec(Z.data),eu(Z.exception_types);let w=await (0,c.modelMetricsSlowResponsesCall)(l,x,u,y,null===(n=ep.from)||void 0===n?void 0:n.toISOString(),null===(o=ep.to)||void 0===o?void 0:o.toISOString(),null==eA?void 0:eA.token,eM),C=await (0,c.adminGlobalActivityExceptions)(l,null===(d=ep.from)||void 0===d?void 0:d.toISOString().split("T")[0],null===(m=ep.to)||void 0===m?void 0:m.toISOString().split("T")[0],y);eZ(C);let S=await (0,c.adminGlobalActivityExceptionsPerDeployment)(l,null===(h=ep.from)||void 0===h?void 0:h.toISOString().split("T")[0],null===(p=ep.to)||void 0===p?void 0:p.toISOString().split("T")[0],y);eC(S),ex(w);let k=await (0,c.allEndUsersCall)(l);eP(null==k?void 0:k.map(e=>e.user_id));let A=(await (0,c.getCallbacksCall)(l,x,u)).router_settings,E=A.model_group_retry_policy,M=A.num_retries;ej(E),e_(A.retry_policy),eb(M);let F=A.model_group_alias||{};eT(F)}catch(e){console.error("Error fetching model data:",e)}};l&&t&&u&&x&&e0&&e();let s=async()=>{w(await (0,c.modelCostMap)(l))};null==Z&&s()},[l,t,u,x,e0]),!p||e1||!l||!t||!u||!x)return(0,s.jsx)("div",{children:"Loading..."});let le=[],ll=[];for(let e=0;enull!=Z&&"object"==typeof Z&&e in Z?Z[e].litellm_provider:"openai";if(t){let e=t.split("/"),l=e[0];(r=s)||(r=1===e.length?m(t):l)}else r="-";a&&(i=null==a?void 0:a.input_cost_per_token,n=null==a?void 0:a.output_cost_per_token,o=null==a?void 0:a.max_tokens,d=null==a?void 0:a.max_input_tokens),(null==l?void 0:l.litellm_params)&&(c=Object.fromEntries(Object.entries(null==l?void 0:l.litellm_params).filter(e=>{let[l]=e;return"model"!==l&&"api_base"!==l}))),p.data[e].provider=r,p.data[e].input_cost=i,p.data[e].output_cost=n,p.data[e].litellm_model_name=t,ll.push(r),p.data[e].input_cost&&(p.data[e].input_cost=(1e6*Number(p.data[e].input_cost)).toFixed(2)),p.data[e].output_cost&&(p.data[e].output_cost=(1e6*Number(p.data[e].output_cost)).toFixed(2)),p.data[e].max_tokens=o,p.data[e].max_input_tokens=d,p.data[e].api_base=null==l?void 0:null===(la=l.litellm_params)||void 0===la?void 0:la.api_base,p.data[e].cleanedLitellmParams=c,le.push(l.model_name)}if(u&&"Admin Viewer"==u){let{Title:e,Paragraph:l}=C.default;return(0,s.jsxs)("div",{children:[(0,s.jsx)(e,{level:1,children:"Access Denied"}),(0,s.jsx)(l,{children:"Ask your proxy admin for access to view all models"})]})}return(Object.keys(m.Cl).find(e=>m.Cl[e]===F),eB)?(0,s.jsx)("div",{className:"w-full h-full",children:(0,s.jsx)(e7.Z,{teamId:eB,onClose:()=>eU(null),accessToken:l,is_team_admin:"Admin"===u,is_proxy_admin:"Proxy Admin"===u,userModels:le,editTeam:!1,onUpdate:e3})}):(0,s.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,s.jsx)(i.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,s.jsxs)(r.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[(0,s.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Model Management"}),et.ZL.includes(u)?(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Add and manage models for the proxy"}):(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Add models for teams you are an admin for."})]})}),eV?(0,s.jsx)(e8,{modelId:eV,editModel:!0,onClose:()=>{eD(null),eq(!1)},modelData:p.data.find(e=>e.model_info.id===eV),accessToken:l,userID:x,userRole:u,setEditModalVisible:T,setSelectedModel:O,onModelUpdate:e=>{e.deleted?j({...p,data:p.data.filter(l=>l.model_info.id!==e.model_info.id)}):j({...p,data:p.data.map(l=>l.model_info.id===e.model_info.id?e:l)}),eX.invalidateQueries({queryKey:["models","list"]}),e3()},modelAccessGroups:z}):(0,s.jsxs)(Q.Z,{index:e$,onIndexChange:eQ,className:"gap-2 h-[75vh] w-full ",children:[(0,s.jsxs)(X.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,s.jsxs)("div",{className:"flex",children:[et.ZL.includes(u)?(0,s.jsx)($.Z,{children:"All Models"}):(0,s.jsx)($.Z,{children:"Your Models"}),(0,s.jsx)($.Z,{children:"Add Model"}),et.ZL.includes(u)&&(0,s.jsx)($.Z,{children:"LLM Credentials"}),et.ZL.includes(u)&&(0,s.jsx)($.Z,{children:"Pass-Through Endpoints"}),et.ZL.includes(u)&&(0,s.jsx)($.Z,{children:"Health Status"}),et.ZL.includes(u)&&(0,s.jsx)($.Z,{children:"Model Analytics"}),et.ZL.includes(u)&&(0,s.jsx)($.Z,{children:"Model Retry Settings"}),et.ZL.includes(u)&&(0,s.jsx)($.Z,{children:"Model Group Alias"}),et.ZL.includes(u)&&(0,s.jsx)($.Z,{children:"Price Data Reload"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[S&&(0,s.jsxs)(n.Z,{children:["Last Refreshed: ",S]}),(0,s.jsx)(Y.Z,{icon:W.Z,variant:"shadow",size:"xs",className:"self-center",onClick:e3})]})]}),(0,s.jsxs)(el.Z,{children:[(0,s.jsx)(li,{selectedModelGroup:B,setSelectedModelGroup:U,availableModelGroups:V,availableModelAccessGroups:z,setSelectedModelId:eD,setSelectedTeamId:eU,setEditModel:eq,modelData:p}),(0,s.jsx)(ee.Z,{className:"h-full",children:(0,s.jsx)(eK,{form:b,handleOk:()=>{b.validateFields().then(e=>{h(e,l,b,e3)}).catch(e=>{var l;let t=(null===(l=e.errorFields)||void 0===l?void 0:l.map(e=>"".concat(e.name.join("."),": ").concat(e.errors.join(", "))).join(" | "))||"Unknown validation error";d.Z.fromBackend("Please fill in the following required fields: ".concat(t))})},selectedProvider:F,setSelectedProvider:P,providerModels:A,setProviderModelsFn:e=>{E((0,m.bK)(e,Z))},getPlaceholder:m.ph,uploadProps:e6,showAdvancedSettings:eR,setShowAdvancedSettings:eO,teams:y,credentials:e5,accessToken:l,userRole:u,premiumUser:_})}),(0,s.jsx)(ee.Z,{children:(0,s.jsx)(K,{uploadProps:e6})}),(0,s.jsx)(ee.Z,{children:(0,s.jsx)(lH.Z,{accessToken:l,userRole:u,userID:x,modelData:p,premiumUser:_})}),(0,s.jsx)(ee.Z,{children:(0,s.jsx)(lV,{accessToken:l,modelData:p,all_models_on_proxy:le,getDisplayModelName:J,setSelectedModelId:eD})}),(0,s.jsx)(lb,{dateValue:ep,setDateValue:eg,selectedModelGroup:B,availableModelGroups:V,setShowAdvancedFilters:ek,modelMetrics:G,modelMetricsCategories:es,streamingModelMetrics:er,streamingModelMetricsCategories:en,customTooltip:e=>{var l,t;let{payload:a,active:r}=e;if(!r||!a)return null;let i=null===(t=a[0])||void 0===t?void 0:null===(l=t.payload)||void 0===l?void 0:l.date,n=a.sort((e,l)=>l.value-e.value);if(n.length>5){let e=n.length-5;(n=n.slice(0,5)).push({dataKey:"".concat(e," other deployments"),value:a.slice(5).reduce((e,l)=>e+l.value,0),color:"gray"})}return(0,s.jsxs)("div",{className:"w-150 rounded-tremor-default border border-tremor-border bg-tremor-background p-2 text-tremor-default shadow-tremor-dropdown",children:[i&&(0,s.jsxs)("p",{className:"text-tremor-content-emphasis mb-2",children:["Date: ",i]}),n.map((e,l)=>{let t=parseFloat(e.value.toFixed(5)),a=0===t&&e.value>0?"<0.00001":t.toFixed(5);return(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 mt-1 rounded-full bg-".concat(e.color,"-500")}),(0,s.jsx)("p",{className:"text-tremor-content",children:e.dataKey})]}),(0,s.jsx)("p",{className:"font-medium text-tremor-content-emphasis text-righ ml-2",children:a})]},l)})]})},slowResponsesData:eh,modelExceptions:ed,globalExceptionData:eN,allExceptions:em,globalExceptionPerDeployment:ew,allEndUsers:eF,keys:g,setSelectedAPIKey:eE,setSelectedCustomer:eI,teams:y,selectedAPIKey:eA,selectedCustomer:eM,selectedTeam:eG,setAllExceptions:eu,setGlobalExceptionData:eZ,setGlobalExceptionPerDeployment:eC,setModelExceptions:ec,setModelMetrics:H,setModelMetricsCategories:ea,setSelectedModelGroup:U,setSlowResponsesData:ex,setStreamingModelMetrics:ei,setStreamingModelMetricsCategories:eo}),(0,s.jsx)(lZ,{selectedModelGroup:B,setSelectedModelGroup:U,availableModelGroups:V,globalRetryPolicy:ev,setGlobalRetryPolicy:e_,defaultRetry:ey,modelGroupRetryPolicy:ef,setModelGroupRetryPolicy:ej,handleSaveRetrySettings:e9}),(0,s.jsx)(ee.Z,{children:(0,s.jsx)(lG,{accessToken:l,initialModelGroupAlias:eL,onAliasUpdate:eT})}),(0,s.jsx)(lF,{setModelMap:w})]})]})]})})})}},27593:function(e,l,t){t.d(l,{Z:function(){return Y}});var s=t(57437),a=t(2265),r=t(78489),i=t(47323),n=t(84264),o=t(96761),d=t(19250),c=t(99981),m=t(33866),u=t(15731),h=t(53410),x=t(74998),p=t(59341),g=t(49566),f=t(12514),j=t(97765),v=t(37592),_=t(10032),y=t(22116),b=t(51653),N=t(24199),Z=t(12660),w=t(15424),C=t(58760),S=t(5545),k=t(45246),A=t(96473),E=t(31283),M=e=>{let{value:l={},onChange:t}=e,[r,i]=(0,a.useState)(Object.entries(l)),n=e=>{let l=r.filter((l,t)=>t!==e);i(l),null==t||t(Object.fromEntries(l))},o=(e,l,s)=>{let a=[...r];a[e]=[l,s],i(a),null==t||t(Object.fromEntries(a))};return(0,s.jsxs)("div",{children:[r.map((e,l)=>{let[t,a]=e;return(0,s.jsxs)(C.Z,{style:{display:"flex",marginBottom:8},align:"center",children:[(0,s.jsx)(E.o,{placeholder:"Header Name",value:t,onChange:e=>o(l,e.target.value,a)}),(0,s.jsx)(E.o,{placeholder:"Header Value",value:a,onChange:e=>o(l,t,e.target.value)}),(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,s.jsx)(k.Z,{onClick:()=>n(l),style:{cursor:"pointer"}})})]},l)}),(0,s.jsx)(S.ZP,{type:"dashed",onClick:()=>{i([...r,["",""]])},icon:(0,s.jsx)(A.Z,{}),children:"Add Header"})]})},I=t(77565),F=e=>{let{pathValue:l,targetValue:t,includeSubpath:a}=e,r=(0,d.getProxyBaseUrl)();return l&&t?(0,s.jsxs)(f.Z,{className:"p-5",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Route Preview"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-5",children:"How your requests will be routed"}),(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-base font-semibold text-gray-900 mb-3",children:"Basic routing:"}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Your endpoint"}),(0,s.jsx)("code",{className:"font-mono text-sm text-gray-900",children:l?"".concat(r).concat(l):""})]}),(0,s.jsx)("div",{className:"text-gray-400",children:(0,s.jsx)(I.Z,{className:"text-lg"})}),(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Forwards to"}),(0,s.jsx)("code",{className:"font-mono text-sm text-gray-900",children:t})]})]})]}),a&&(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-base font-semibold text-gray-900 mb-3",children:"With subpaths:"}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Your endpoint + subpath"}),(0,s.jsxs)("code",{className:"font-mono text-sm text-gray-900",children:[l&&"".concat(r).concat(l),(0,s.jsx)("span",{className:"text-blue-600",children:"/v1/text-to-image/base/model"})]})]}),(0,s.jsx)("div",{className:"text-gray-400",children:(0,s.jsx)(I.Z,{className:"text-lg"})}),(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Forwards to"}),(0,s.jsxs)("code",{className:"font-mono text-sm text-gray-900",children:[t,(0,s.jsx)("span",{className:"text-blue-600",children:"/v1/text-to-image/base/model"})]})]})]}),(0,s.jsxs)("div",{className:"mt-3 text-sm text-gray-600",children:["Any path after ",l," will be appended to the target URL"]})]})}),!a&&(0,s.jsx)("div",{className:"mt-4 p-3 bg-blue-50 rounded-md border border-blue-200",children:(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)(w.Z,{className:"text-blue-500 mt-0.5 mr-2 flex-shrink-0"}),(0,s.jsxs)("div",{className:"text-sm text-blue-700",children:[(0,s.jsx)("span",{className:"font-medium",children:"Not seeing the routing you wanted?"})," Try enabling - Include Subpaths - above - this allows subroutes like"," ",(0,s.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded font-mono text-xs",children:"/api/v1/models"})," to be forwarded automatically."]})]})})]})]}):null},P=t(9114),L=t(63709),T=e=>{let{premiumUser:l,authEnabled:t,onAuthChange:a}=e;return(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Security"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-4",children:"When enabled, requests to this endpoint will require a valid LiteLLM Virtual Key"}),l?(0,s.jsx)(_.Z.Item,{name:"auth",valuePropName:"checked",className:"mb-0",children:(0,s.jsx)(L.Z,{checked:t,onChange:e=>{a(e)}})}):(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center mb-3",children:[(0,s.jsx)(L.Z,{disabled:!0,checked:!1,style:{outline:"2px solid #d1d5db",outlineOffset:"2px"}}),(0,s.jsx)("span",{className:"ml-2 text-sm text-gray-400",children:"Authentication (Premium)"})]}),(0,s.jsx)("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,s.jsxs)(n.Z,{className:"text-sm text-yellow-800",children:["Setting authentication for pass-through endpoints is a LiteLLM Enterprise feature. Get a trial key"," ",(0,s.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"here"}),"."]})})]})]})},R=t(67479),O=e=>{let{accessToken:l,value:t={},onChange:r,disabled:i=!1}=e,[n,d]=(0,a.useState)(Object.keys(t)),[m,u]=(0,a.useState)(t);(0,a.useEffect)(()=>{u(t),d(Object.keys(t))},[t]);let h=(e,l,t)=>{var s,a;let i=m[e]||{},n={...m,[e]:{...i,[l]:t.length>0?t:void 0}};(null===(s=n[e])||void 0===s?void 0:s.request_fields)||(null===(a=n[e])||void 0===a?void 0:a.response_fields)||(n[e]=null),u(n),r&&r(n)};return(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Guardrails"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Configure guardrails to enforce policies on requests and responses. Guardrails are opt-in for passthrough endpoints."}),(0,s.jsx)(b.Z,{message:(0,s.jsxs)("span",{children:["Field-Level Targeting"," ",(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/pass_through_guardrails#field-level-targeting",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"(Learn More)"})]}),description:(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("div",{children:"Optionally specify which fields to check. If left empty, the entire request/response is sent to the guardrail."}),(0,s.jsxs)("div",{className:"text-xs space-y-1 mt-2",children:[(0,s.jsx)("div",{className:"font-medium",children:"Common Examples:"}),(0,s.jsxs)("div",{children:["• ",(0,s.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"query"})," - Single field"]}),(0,s.jsxs)("div",{children:["• ",(0,s.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"documents[*].text"})," - All text in documents array"]}),(0,s.jsxs)("div",{children:["• ",(0,s.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"messages[*].content"})," - All message contents"]})]})]}),type:"info",showIcon:!0,className:"mb-4"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Select Guardrails",(0,s.jsx)(c.Z,{title:"Choose which guardrails should run on this endpoint. Org/team/key level guardrails will also be included.",children:(0,s.jsx)(w.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),children:(0,s.jsx)(R.Z,{accessToken:l,value:n,onChange:e=>{d(e);let l={};e.forEach(e=>{l[e]=m[e]||null}),u(l),r&&r(l)},disabled:i})}),n.length>0&&(0,s.jsxs)("div",{className:"mt-6 space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-700",children:"Field Targeting (Optional)"}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"\uD83D\uDCA1 Tip: Leave empty to check entire payload"})]}),n.map(e=>{var l,t;return(0,s.jsxs)(f.Z,{className:"p-4 bg-gray-50",children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-900 mb-3",children:e}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,s.jsxs)("label",{className:"text-xs text-gray-600 flex items-center",children:["Request Fields (pre_call)",(0,s.jsx)(c.Z,{title:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium mb-1",children:"Specify which request fields to check"}),(0,s.jsxs)("div",{className:"text-xs space-y-1",children:[(0,s.jsx)("div",{children:"Examples:"}),(0,s.jsx)("div",{children:"• query"}),(0,s.jsx)("div",{children:"• documents[*].text"}),(0,s.jsx)("div",{children:"• messages[*].content"})]})]}),children:(0,s.jsx)(w.Z,{className:"ml-1 text-gray-400"})})]}),(0,s.jsxs)("div",{className:"flex gap-1",children:[(0,s.jsx)("button",{type:"button",onClick:()=>{var l;let t=(null===(l=m[e])||void 0===l?void 0:l.request_fields)||[];h(e,"request_fields",[...t,"query"])},className:"text-xs px-2 py-1 bg-white border border-gray-300 rounded hover:bg-gray-50",disabled:i,children:"+ query"}),(0,s.jsx)("button",{type:"button",onClick:()=>{var l;let t=(null===(l=m[e])||void 0===l?void 0:l.request_fields)||[];h(e,"request_fields",[...t,"documents[*]"])},className:"text-xs px-2 py-1 bg-white border border-gray-300 rounded hover:bg-gray-50",disabled:i,children:"+ documents[*]"})]})]}),(0,s.jsx)(v.default,{mode:"tags",style:{width:"100%"},placeholder:"Type field name or use + buttons above (e.g., query, documents[*].text)",value:(null===(l=m[e])||void 0===l?void 0:l.request_fields)||[],onChange:l=>h(e,"request_fields",l),disabled:i,tokenSeparators:[","]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,s.jsxs)("label",{className:"text-xs text-gray-600 flex items-center",children:["Response Fields (post_call)",(0,s.jsx)(c.Z,{title:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium mb-1",children:"Specify which response fields to check"}),(0,s.jsxs)("div",{className:"text-xs space-y-1",children:[(0,s.jsx)("div",{children:"Examples:"}),(0,s.jsx)("div",{children:"• results[*].text"}),(0,s.jsx)("div",{children:"• choices[*].message.content"})]})]}),children:(0,s.jsx)(w.Z,{className:"ml-1 text-gray-400"})})]}),(0,s.jsx)("div",{className:"flex gap-1",children:(0,s.jsx)("button",{type:"button",onClick:()=>{var l;let t=(null===(l=m[e])||void 0===l?void 0:l.response_fields)||[];h(e,"response_fields",[...t,"results[*]"])},className:"text-xs px-2 py-1 bg-white border border-gray-300 rounded hover:bg-gray-50",disabled:i,children:"+ results[*]"})})]}),(0,s.jsx)(v.default,{mode:"tags",style:{width:"100%"},placeholder:"Type field name or use + buttons above (e.g., results[*].text)",value:(null===(t=m[e])||void 0===t?void 0:t.response_fields)||[],onChange:l=>h(e,"response_fields",l),disabled:i,tokenSeparators:[","]})]})]})]},e)})]})]})};let{Option:V}=v.default;var D=e=>{let{accessToken:l,setPassThroughItems:t,passThroughItems:i,premiumUser:n=!1}=e,[m]=_.Z.useForm(),[u,h]=(0,a.useState)(!1),[x,v]=(0,a.useState)(!1),[C,S]=(0,a.useState)(""),[k,A]=(0,a.useState)(""),[E,I]=(0,a.useState)(""),[L,R]=(0,a.useState)(!0),[V,D]=(0,a.useState)(!1),[z,q]=(0,a.useState)({}),B=()=>{m.resetFields(),A(""),I(""),R(!0),q({}),h(!1)},U=e=>{let l=e;e&&!e.startsWith("/")&&(l="/"+e),A(l),m.setFieldsValue({path:l})},G=async e=>{console.log("addPassThrough called with:",e),v(!0);try{!n&&"auth"in e&&delete e.auth,z&&Object.keys(z).length>0&&(e.guardrails=z),console.log("formValues: ".concat(JSON.stringify(e)));let s=(await (0,d.createPassThroughEndpoint)(l,e)).endpoints[0],a=[...i,s];t(a),P.Z.success("Pass-through endpoint created successfully"),m.resetFields(),A(""),I(""),R(!0),q({}),h(!1)}catch(e){P.Z.fromBackend("Error creating pass-through endpoint: "+e)}finally{v(!1)}};return(0,s.jsxs)("div",{children:[(0,s.jsx)(r.Z,{className:"mx-auto mb-4 mt-4",onClick:()=>h(!0),children:"+ Add Pass-Through Endpoint"}),(0,s.jsx)(y.Z,{title:(0,s.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[(0,s.jsx)(Z.Z,{className:"text-xl text-blue-500"}),(0,s.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add Pass-Through Endpoint"})]}),open:u,width:1e3,onCancel:B,footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,s.jsxs)("div",{className:"mt-6",children:[(0,s.jsx)(b.Z,{message:"What is a Pass-Through Endpoint?",description:"Route requests from your LiteLLM proxy to any external API. Perfect for custom models, image generation APIs, or any service you want to proxy through LiteLLM.",type:"info",showIcon:!0,className:"mb-6"}),(0,s.jsxs)(_.Z,{form:m,onFinish:G,layout:"vertical",className:"space-y-6",initialValues:{include_subpath:!0,path:k,target:E},children:[(0,s.jsxs)(f.Z,{className:"p-5",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Route Configuration"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-5",children:"Configure how requests to your domain will be forwarded to the target API"}),(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsx)(_.Z.Item,{label:(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Path Prefix"}),name:"path",rules:[{required:!0,message:"Path is required",pattern:/^\//}],extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Example: /bria, /adobe-photoshop, /elasticsearch"}),className:"mb-4",children:(0,s.jsx)("div",{className:"flex items-center",children:(0,s.jsx)(g.Z,{placeholder:"bria",value:k,onChange:e=>U(e.target.value),className:"flex-1"})})}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Target URL"}),name:"target",rules:[{required:!0,message:"Target URL is required"},{type:"url",message:"Please enter a valid URL"}],extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Example:https://engine.prod.bria-api.com"}),className:"mb-4",children:(0,s.jsx)(g.Z,{placeholder:"https://engine.prod.bria-api.com",value:E,onChange:e=>{I(e.target.value),m.setFieldsValue({target:e.target.value})}})}),(0,s.jsxs)("div",{className:"flex items-center justify-between py-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-700",children:"Include Subpaths"}),(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:"Forward all subpaths to the target API (recommended for REST APIs)"})]}),(0,s.jsx)(_.Z.Item,{name:"include_subpath",valuePropName:"checked",className:"mb-0",children:(0,s.jsx)(p.Z,{checked:L,onChange:R})})]})]})]}),(0,s.jsx)(F,{pathValue:k,targetValue:E,includeSubpath:L}),(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Headers"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Add headers that will be sent with every request to the target API"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authentication Headers",(0,s.jsx)(c.Z,{title:"Authentication and other headers to forward with requests",children:(0,s.jsx)(w.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"headers",rules:[{required:!0,message:"Please configure the headers"}],extra:(0,s.jsxs)("div",{className:"text-xs text-gray-500 mt-2",children:[(0,s.jsx)("div",{className:"font-medium mb-1",children:"Add authentication tokens and other required headers"}),(0,s.jsx)("div",{children:"Common examples: auth_token, Authorization, x-api-key"})]}),children:(0,s.jsx)(M,{})})]}),(0,s.jsx)(T,{premiumUser:n,authEnabled:V,onAuthChange:e=>{D(e),m.setFieldsValue({auth:e})}}),(0,s.jsx)(O,{accessToken:l,value:z,onChange:q}),(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Billing"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Optional cost tracking for this endpoint"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Cost Per Request (USD)",(0,s.jsx)(c.Z,{title:"Optional: Track costs for requests to this endpoint",children:(0,s.jsx)(w.Z,{className:"ml-2 text-gray-400 hover:text-gray-600"})})]}),name:"cost_per_request",extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-2",children:"The cost charged for each request through this endpoint"}),children:(0,s.jsx)(N.Z,{min:0,step:.001,precision:4,placeholder:"2.0000",size:"large"})})]}),(0,s.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:[(0,s.jsx)(r.Z,{variant:"secondary",onClick:B,children:"Cancel"}),(0,s.jsx)(r.Z,{variant:"primary",loading:x,onClick:()=>{console.log("Submit button clicked"),m.submit()},children:x?"Creating...":"Add Pass-Through Endpoint"})]})]})]})})]})},z=t(30078),q=t(4260),B=t(19015),U=t(87769),G=t(42208);let H=e=>{let{value:l}=e,[t,r]=(0,a.useState)(!1),i=JSON.stringify(l,null,2);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("pre",{className:"font-mono text-xs bg-gray-50 p-2 rounded max-w-md overflow-auto",children:t?i:"••••••••"}),(0,s.jsx)("button",{onClick:()=>r(!t),className:"p-1 hover:bg-gray-100 rounded",type:"button",children:t?(0,s.jsx)(U.Z,{className:"w-4 h-4 text-gray-500"}):(0,s.jsx)(G.Z,{className:"w-4 h-4 text-gray-500"})})]})};var K=e=>{let{endpointData:l,onClose:t,accessToken:r,isAdmin:i,premiumUser:n=!1,onEndpointUpdated:o}=e,[c,m]=(0,a.useState)(l),[u,h]=(0,a.useState)(!1),[x,p]=(0,a.useState)(!1),[g,f]=(0,a.useState)((null==l?void 0:l.auth)||!1),[j,v]=(0,a.useState)((null==l?void 0:l.guardrails)||{}),[y]=_.Z.useForm(),b=async e=>{try{if(!r||!(null==c?void 0:c.id))return;let l={};if(e.headers)try{l="string"==typeof e.headers?JSON.parse(e.headers):e.headers}catch(e){P.Z.fromBackend("Invalid JSON format for headers");return}let t={path:c.path,target:e.target,headers:l,include_subpath:e.include_subpath,cost_per_request:e.cost_per_request,auth:n?e.auth:void 0,guardrails:j&&Object.keys(j).length>0?j:void 0};await (0,d.updatePassThroughEndpoint)(r,c.id,t),m({...c,...t}),p(!1),o&&o()}catch(e){console.error("Error updating endpoint:",e),P.Z.fromBackend("Failed to update pass through endpoint")}},N=async()=>{try{if(!r||!(null==c?void 0:c.id))return;await (0,d.deletePassThroughEndpointsCall)(r,c.id),P.Z.success("Pass through endpoint deleted successfully"),t(),o&&o()}catch(e){console.error("Error deleting endpoint:",e),P.Z.fromBackend("Failed to delete pass through endpoint")}};return u?(0,s.jsx)("div",{className:"p-4",children:"Loading..."}):c?(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,s.jsxs)("div",{children:[(0,s.jsx)(S.ZP,{onClick:t,className:"mb-4",children:"← Back"}),(0,s.jsxs)(z.Dx,{children:["Pass Through Endpoint: ",c.path]}),(0,s.jsx)(z.xv,{className:"text-gray-500 font-mono",children:c.id})]})}),(0,s.jsxs)(z.v0,{children:[(0,s.jsxs)(z.td,{className:"mb-4",children:[(0,s.jsx)(z.OK,{children:"Overview"},"overview"),i?(0,s.jsx)(z.OK,{children:"Settings"},"settings"):(0,s.jsx)(s.Fragment,{})]}),(0,s.jsxs)(z.nP,{children:[(0,s.jsxs)(z.x4,{children:[(0,s.jsxs)(z.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,s.jsxs)(z.Zb,{children:[(0,s.jsx)(z.xv,{children:"Path"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(z.Dx,{className:"font-mono",children:c.path})})]}),(0,s.jsxs)(z.Zb,{children:[(0,s.jsx)(z.xv,{children:"Target"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(z.Dx,{children:c.target})})]}),(0,s.jsxs)(z.Zb,{children:[(0,s.jsx)(z.xv,{children:"Configuration"}),(0,s.jsxs)("div",{className:"mt-2 space-y-2",children:[(0,s.jsx)("div",{children:(0,s.jsx)(z.Ct,{color:c.include_subpath?"green":"gray",children:c.include_subpath?"Include Subpath":"Exact Path"})}),(0,s.jsx)("div",{children:(0,s.jsx)(z.Ct,{color:c.auth?"blue":"gray",children:c.auth?"Auth Required":"No Auth"})}),void 0!==c.cost_per_request&&(0,s.jsx)("div",{children:(0,s.jsxs)(z.xv,{children:["Cost per request: $",c.cost_per_request]})})]})]})]}),(0,s.jsx)("div",{className:"mt-6",children:(0,s.jsx)(F,{pathValue:c.path,targetValue:c.target,includeSubpath:c.include_subpath||!1})}),c.headers&&Object.keys(c.headers).length>0&&(0,s.jsxs)(z.Zb,{className:"mt-6",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Headers"}),(0,s.jsxs)(z.Ct,{color:"blue",children:[Object.keys(c.headers).length," headers configured"]})]}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(H,{value:c.headers})})]}),c.guardrails&&Object.keys(c.guardrails).length>0&&(0,s.jsxs)(z.Zb,{className:"mt-6",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Guardrails"}),(0,s.jsxs)(z.Ct,{color:"purple",children:[Object.keys(c.guardrails).length," guardrails configured"]})]}),(0,s.jsx)("div",{className:"mt-4 space-y-2",children:Object.entries(c.guardrails).map(e=>{let[l,t]=e;return(0,s.jsxs)("div",{className:"p-3 bg-gray-50 rounded",children:[(0,s.jsx)("div",{className:"font-medium text-sm",children:l}),t&&(t.request_fields||t.response_fields)&&(0,s.jsxs)("div",{className:"mt-2 text-xs text-gray-600 space-y-1",children:[t.request_fields&&(0,s.jsxs)("div",{children:["Request fields: ",t.request_fields.join(", ")]}),t.response_fields&&(0,s.jsxs)("div",{children:["Response fields: ",t.response_fields.join(", ")]})]}),!t&&(0,s.jsx)("div",{className:"text-xs text-gray-600 mt-1",children:"Uses entire payload"})]},l)})})]})]}),i&&(0,s.jsx)(z.x4,{children:(0,s.jsxs)(z.Zb,{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(z.Dx,{children:"Pass Through Endpoint Settings"}),(0,s.jsx)("div",{className:"space-x-2",children:!x&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(z.zx,{onClick:()=>p(!0),children:"Edit Settings"}),(0,s.jsx)(z.zx,{onClick:N,variant:"secondary",color:"red",children:"Delete Endpoint"})]})})]}),x?(0,s.jsxs)(_.Z,{form:y,onFinish:b,initialValues:{target:c.target,headers:c.headers?JSON.stringify(c.headers,null,2):"",include_subpath:c.include_subpath||!1,cost_per_request:c.cost_per_request,auth:c.auth||!1},layout:"vertical",children:[(0,s.jsx)(_.Z.Item,{label:"Target URL",name:"target",rules:[{required:!0,message:"Please input a target URL"}],children:(0,s.jsx)(z.oi,{placeholder:"https://api.example.com"})}),(0,s.jsx)(_.Z.Item,{label:"Headers (JSON)",name:"headers",children:(0,s.jsx)(q.default.TextArea,{rows:5,placeholder:'{"Authorization": "Bearer your-token", "Content-Type": "application/json"}'})}),(0,s.jsx)(_.Z.Item,{label:"Include Subpath",name:"include_subpath",valuePropName:"checked",children:(0,s.jsx)(L.Z,{})}),(0,s.jsx)(_.Z.Item,{label:"Cost per Request",name:"cost_per_request",children:(0,s.jsx)(B.Z,{min:0,step:.01,precision:2,placeholder:"0.00",addonBefore:"$"})}),(0,s.jsx)(T,{premiumUser:n,authEnabled:g,onAuthChange:e=>{f(e),y.setFieldsValue({auth:e})}}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(O,{accessToken:r||"",value:j,onChange:v})}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 mt-6",children:[(0,s.jsx)(S.ZP,{onClick:()=>p(!1),children:"Cancel"}),(0,s.jsx)(z.zx,{children:"Save Changes"})]})]}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Path"}),(0,s.jsx)("div",{className:"font-mono",children:c.path})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Target URL"}),(0,s.jsx)("div",{children:c.target})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Include Subpath"}),(0,s.jsx)(z.Ct,{color:c.include_subpath?"green":"gray",children:c.include_subpath?"Yes":"No"})]}),void 0!==c.cost_per_request&&(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Cost per Request"}),(0,s.jsxs)("div",{children:["$",c.cost_per_request]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Authentication Required"}),(0,s.jsx)(z.Ct,{color:c.auth?"green":"gray",children:c.auth?"Yes":"No"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Headers"}),c.headers&&Object.keys(c.headers).length>0?(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(H,{value:c.headers})}):(0,s.jsx)("div",{className:"text-gray-500",children:"No headers configured"})]})]})]})})]})]})]}):(0,s.jsx)("div",{className:"p-4",children:"Pass through endpoint not found"})},J=t(12322);let W=e=>{let{value:l}=e,[t,r]=(0,a.useState)(!1),i=JSON.stringify(l);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("span",{className:"font-mono text-xs",children:t?i:"••••••••"}),(0,s.jsx)("button",{onClick:()=>r(!t),className:"p-1 hover:bg-gray-100 rounded",type:"button",children:t?(0,s.jsx)(U.Z,{className:"w-4 h-4 text-gray-500"}):(0,s.jsx)(G.Z,{className:"w-4 h-4 text-gray-500"})})]})};var Y=e=>{let{accessToken:l,userRole:t,userID:p,modelData:g,premiumUser:f}=e,[j,v]=(0,a.useState)([]),[_,y]=(0,a.useState)(null),[b,N]=(0,a.useState)(!1),[Z,w]=(0,a.useState)(null);(0,a.useEffect)(()=>{l&&t&&p&&(0,d.getPassThroughEndpointsCall)(l).then(e=>{v(e.endpoints)})},[l,t,p]);let C=async e=>{w(e),N(!0)},S=async()=>{if(null!=Z&&l){try{await (0,d.deletePassThroughEndpointsCall)(l,Z);let e=j.filter(e=>e.id!==Z);v(e),P.Z.success("Endpoint deleted successfully.")}catch(e){console.error("Error deleting the endpoint:",e),P.Z.fromBackend("Error deleting the endpoint: "+e)}N(!1),w(null)}},k=(e,l)=>{C(e)},A=[{header:"ID",accessorKey:"id",cell:e=>(0,s.jsx)(c.Z,{title:e.row.original.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>e.row.original.id&&y(e.row.original.id),children:e.row.original.id})})},{header:"Path",accessorKey:"path"},{header:"Target",accessorKey:"target",cell:e=>(0,s.jsx)(n.Z,{children:e.getValue()})},{header:()=>(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{children:"Authentication"}),(0,s.jsx)(c.Z,{title:"LiteLLM Virtual Key required to call endpoint",children:(0,s.jsx)(u.Z,{className:"w-4 h-4 text-gray-400 cursor-help"})})]}),accessorKey:"auth",cell:e=>(0,s.jsx)(m.Z,{color:e.getValue()?"green":"gray",children:e.getValue()?"Yes":"No"})},{header:"Headers",accessorKey:"headers",cell:e=>(0,s.jsx)(W,{value:e.getValue()||{}})},{header:"Actions",id:"actions",cell:e=>{let{row:l}=e;return(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)(i.Z,{icon:h.Z,size:"sm",onClick:()=>l.original.id&&y(l.original.id),title:"Edit"}),(0,s.jsx)(i.Z,{icon:x.Z,size:"sm",onClick:()=>k(l.original.id,l.index),title:"Delete"})]})}}];if(!l)return null;if(_){console.log("selectedEndpointId",_),console.log("generalSettings",j);let e=j.find(e=>e.id===_);return e?(0,s.jsx)(K,{endpointData:e,onClose:()=>y(null),accessToken:l,isAdmin:"Admin"===t||"admin"===t,premiumUser:f,onEndpointUpdated:()=>{l&&(0,d.getPassThroughEndpointsCall)(l).then(e=>{v(e.endpoints)})}}):(0,s.jsx)("div",{children:"Endpoint not found"})}return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(o.Z,{children:"Pass Through Endpoints"}),(0,s.jsx)(n.Z,{className:"text-tremor-content",children:"Configure and manage your pass-through endpoints"})]}),(0,s.jsx)(D,{accessToken:l,setPassThroughItems:v,passThroughItems:j,premiumUser:f}),(0,s.jsx)(J.w,{data:j,columns:A,renderSubComponent:()=>(0,s.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:!1,noDataMessage:"No pass-through endpoints configured"}),b&&(0,s.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,s.jsxs)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,s.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,s.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,s.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:"​"}),(0,s.jsxs)("div",{className:"inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full",children:[(0,s.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,s.jsx)("div",{className:"sm:flex sm:items-start",children:(0,s.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,s.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Pass-Through Endpoint"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this pass-through endpoint? This action cannot be undone."})})]})})}),(0,s.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,s.jsx)(r.Z,{onClick:S,color:"red",className:"ml-2",children:"Delete"}),(0,s.jsx)(r.Z,{onClick:()=>{N(!1),w(null)},children:"Cancel"})]})]})]})})]})}},39789:function(e,l,t){t.d(l,{Z:function(){return n}});var s=t(57437),a=t(2265),r=t(88237),i=t(84264),n=e=>{let{value:l,onValueChange:t,label:n="Select Time Range",className:o="",showTimeRange:d=!0}=e,[c,m]=(0,a.useState)(!1),u=(0,a.useRef)(null),h=(0,a.useCallback)(e=>{m(!0),setTimeout(()=>m(!1),1500),t(e),requestIdleCallback(()=>{if(e.from){let l;let s={...e},a=new Date(e.from);l=new Date(e.to?e.to:e.from),a.toDateString(),l.toDateString(),a.setHours(0,0,0,0),l.setHours(23,59,59,999),s.from=a,s.to=l,t(s)}},{timeout:100})},[t]),x=(0,a.useCallback)((e,l)=>{if(!e||!l)return"";let t=e=>e.toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0,timeZoneName:"short"});if(e.toDateString()!==l.toDateString())return"".concat(t(e)," - ").concat(t(l));{let t=e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),s=e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}),a=l.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0,timeZoneName:"short"});return"".concat(t,": ").concat(s," - ").concat(a)}},[]);return(0,s.jsxs)("div",{className:o,children:[n&&(0,s.jsx)(i.Z,{className:"mb-2",children:n}),(0,s.jsxs)("div",{className:"relative w-fit",children:[(0,s.jsx)("div",{ref:u,children:(0,s.jsx)(r.Z,{enableSelect:!0,value:l,onValueChange:h,placeholder:"Select date range",enableClear:!1,style:{zIndex:100}})}),c&&(0,s.jsx)("div",{className:"absolute top-1/2 animate-pulse",style:{left:"calc(100% + 8px)",transform:"translateY(-50%)",zIndex:110},children:(0,s.jsxs)("div",{className:"flex items-center gap-1 text-green-600 text-sm font-medium bg-white px-2 py-1 rounded-full border border-green-200 shadow-sm whitespace-nowrap",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-green-500 text-white rounded-full flex items-center justify-center text-xs",children:"✓"}),(0,s.jsx)("span",{className:"text-xs",children:"Selected"})]})})]}),d&&l.from&&l.to&&(0,s.jsx)(i.Z,{className:"mt-2 text-xs text-gray-500",children:x(l.from,l.to)})]})}},12322:function(e,l,t){t.d(l,{w:function(){return o}});var s=t(57437),a=t(2265),r=t(71594),i=t(24525),n=t(19130);function o(e){let{data:l=[],columns:t,getRowCanExpand:o,renderSubComponent:d,isLoading:c=!1,loadingMessage:m="\uD83D\uDE85 Loading logs...",noDataMessage:u="No logs found"}=e,h=(0,r.b7)({data:l,columns:t,getRowCanExpand:o,getRowId:(e,l)=>{var t;return null!==(t=null==e?void 0:e.request_id)&&void 0!==t?t:String(l)},getCoreRowModel:(0,i.sC)(),getExpandedRowModel:(0,i.rV)()});return(0,s.jsx)("div",{className:"rounded-lg custom-border overflow-x-auto w-full max-w-full box-border",children:(0,s.jsxs)(n.iA,{className:"[&_td]:py-0.5 [&_th]:py-1 table-fixed w-full box-border",style:{minWidth:"400px"},children:[(0,s.jsx)(n.ss,{children:h.getHeaderGroups().map(e=>(0,s.jsx)(n.SC,{children:e.headers.map(e=>(0,s.jsx)(n.xs,{className:"py-1 h-8",children:e.isPlaceholder?null:(0,r.ie)(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,s.jsx)(n.RM,{children:c?(0,s.jsx)(n.SC,{children:(0,s.jsx)(n.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:m})})})}):h.getRowModel().rows.length>0?h.getRowModel().rows.map(e=>(0,s.jsxs)(a.Fragment,{children:[(0,s.jsx)(n.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,s.jsx)(n.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,r.ie)(e.column.columnDef.cell,e.getContext())},e.id))}),e.getIsExpanded()&&(0,s.jsx)(n.SC,{children:(0,s.jsx)(n.pj,{colSpan:e.getVisibleCells().length,className:"p-0",children:(0,s.jsx)("div",{className:"w-full max-w-full overflow-hidden box-border",children:d({row:e})})})})]},e.id)):(0,s.jsx)(n.SC,{children:(0,s.jsx)(n.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:u})})})})})]})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1301-739c2d4a8ce60896.js b/litellm/proxy/_experimental/out/_next/static/chunks/1301-c5ca003a7988f6b1.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/1301-739c2d4a8ce60896.js rename to litellm/proxy/_experimental/out/_next/static/chunks/1301-c5ca003a7988f6b1.js index 621fba93f9..d2d3d8018e 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1301-739c2d4a8ce60896.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1301-c5ca003a7988f6b1.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1301],{69993:function(e,t,r){r.d(t,{Z:function(){return s}});var n=r(1119),a=r(2265),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"robot",theme:"outlined"},o=r(55015),s=a.forwardRef(function(e,t){return a.createElement(o.Z,(0,n.Z)({},e,{ref:t,icon:i}))})},58747:function(e,t,r){r.d(t,{Z:function(){return i}});var n=r(5853),a=r(2265);let i=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.createElement("path",{d:"M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z"}))}},4537:function(e,t,r){r.d(t,{Z:function(){return i}});var n=r(5853),a=r(2265);let i=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.createElement("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 10.5858L9.17157 7.75736L7.75736 9.17157L10.5858 12L7.75736 14.8284L9.17157 16.2426L12 13.4142L14.8284 16.2426L16.2426 14.8284L13.4142 12L16.2426 9.17157L14.8284 7.75736L12 10.5858Z"}))}},47323:function(e,t,r){r.d(t,{Z:function(){return p}});var n=r(5853),a=r(2265),i=r(47187),o=r(7084),s=r(13241),l=r(1153),u=r(26898);let d={xs:{paddingX:"px-1.5",paddingY:"py-1.5"},sm:{paddingX:"px-1.5",paddingY:"py-1.5"},md:{paddingX:"px-2",paddingY:"py-2"},lg:{paddingX:"px-2",paddingY:"py-2"},xl:{paddingX:"px-2.5",paddingY:"py-2.5"}},c={xs:{height:"h-3",width:"w-3"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-7",width:"w-7"},xl:{height:"h-9",width:"w-9"}},h={simple:{rounded:"",border:"",ring:"",shadow:""},light:{rounded:"rounded-tremor-default",border:"",ring:"",shadow:""},shadow:{rounded:"rounded-tremor-default",border:"border",ring:"",shadow:"shadow-tremor-card dark:shadow-dark-tremor-card"},solid:{rounded:"rounded-tremor-default",border:"border-2",ring:"ring-1",shadow:""},outlined:{rounded:"rounded-tremor-default",border:"border",ring:"ring-2",shadow:""}},f=(e,t)=>{switch(e){case"simple":return{textColor:t?(0,l.bM)(t,u.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:t?(0,l.bM)(t,u.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,s.q)((0,l.bM)(t,u.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:t?(0,l.bM)(t,u.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,s.q)((0,l.bM)(t,u.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:"border-tremor-border dark:border-dark-tremor-border",ringColor:""};case"solid":return{textColor:t?(0,l.bM)(t,u.K.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,s.q)((0,l.bM)(t,u.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand dark:bg-dark-tremor-brand",borderColor:"border-tremor-brand-inverted dark:border-dark-tremor-brand-inverted",ringColor:"ring-tremor-ring dark:ring-dark-tremor-ring"};case"outlined":return{textColor:t?(0,l.bM)(t,u.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,s.q)((0,l.bM)(t,u.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:t?(0,l.bM)(t,u.K.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:t?(0,s.q)((0,l.bM)(t,u.K.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},m=(0,l.fn)("Icon"),p=a.forwardRef((e,t)=>{let{icon:r,variant:u="simple",tooltip:p,size:g=o.u8.SM,color:b,className:v}=e,w=(0,n._T)(e,["icon","variant","tooltip","size","color","className"]),y=f(u,b),{tooltipProps:k,getReferenceProps:C}=(0,i.l)();return a.createElement("span",Object.assign({ref:(0,l.lq)([t,k.refs.setReference]),className:(0,s.q)(m("root"),"inline-flex shrink-0 items-center justify-center",y.bgColor,y.textColor,y.borderColor,y.ringColor,h[u].rounded,h[u].border,h[u].shadow,h[u].ring,d[g].paddingX,d[g].paddingY,v)},C,w),a.createElement(i.Z,Object.assign({text:p},k)),a.createElement(r,{className:(0,s.q)(m("icon"),"shrink-0",c[g].height,c[g].width)}))});p.displayName="Icon"},27281:function(e,t,r){r.d(t,{Z:function(){return m}});var n=r(5853),a=r(58747),i=r(2265),o=r(4537),s=r(13241),l=r(1153),u=r(96398),d=r(51975),c=r(85238),h=r(44140);let f=(0,l.fn)("Select"),m=i.forwardRef((e,t)=>{let{defaultValue:r="",value:l,onValueChange:m,placeholder:p="Select...",disabled:g=!1,icon:b,enableClear:v=!1,required:w,children:y,name:k,error:C=!1,errorMessage:x,className:E,id:M}=e,q=(0,n._T)(e,["defaultValue","value","onValueChange","placeholder","disabled","icon","enableClear","required","children","name","error","errorMessage","className","id"]),O=(0,i.useRef)(null),L=i.Children.toArray(y),[N,P]=(0,h.Z)(r,l),R=(0,i.useMemo)(()=>{let e=i.Children.toArray(y).filter(i.isValidElement);return(0,u.sl)(e)},[y]);return i.createElement("div",{className:(0,s.q)("w-full min-w-[10rem] text-tremor-default",E)},i.createElement("div",{className:"relative"},i.createElement("select",{title:"select-hidden",required:w,className:(0,s.q)("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:N,onChange:e=>{e.preventDefault()},name:k,disabled:g,id:M,onFocus:()=>{let e=O.current;e&&e.focus()}},i.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},p),L.map(e=>{let t=e.props.value,r=e.props.children;return i.createElement("option",{className:"hidden",key:t,value:t},r)})),i.createElement(d.Ri,Object.assign({as:"div",ref:t,defaultValue:N,value:N,onChange:e=>{null==m||m(e),P(e)},disabled:g,id:M},q),e=>{var t;let{value:r}=e;return i.createElement(i.Fragment,null,i.createElement(d.Y4,{ref:O,className:(0,s.q)("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 border pr-8 py-2","border-tremor-border shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",b?"pl-10":"pl-3",(0,u.um)((0,u.Uh)(r),g,C))},b&&i.createElement("span",{className:(0,s.q)("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},i.createElement(b,{className:(0,s.q)(f("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),i.createElement("span",{className:"w-[90%] block truncate"},r&&null!==(t=R.get(r))&&void 0!==t?t:p),i.createElement("span",{className:(0,s.q)("absolute inset-y-0 right-0 flex items-center mr-3")},i.createElement(a.Z,{className:(0,s.q)(f("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),v&&N?i.createElement("button",{type:"button",className:(0,s.q)("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:e=>{e.preventDefault(),P(""),null==m||m("")}},i.createElement(o.Z,{className:(0,s.q)(f("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,i.createElement(c.u,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},i.createElement(d.O_,{anchor:"bottom start",className:(0,s.q)("z-10 w-[var(--button-width)] divide-y overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},y)))})),C&&x?i.createElement("p",{className:(0,s.q)("errorMessage","text-sm text-rose-500 mt-1")},x):null)});m.displayName="Select"},94789:function(e,t,r){r.d(t,{Z:function(){return u}});var n=r(5853),a=r(2265),i=r(26898),o=r(13241),s=r(1153);let l=(0,s.fn)("Callout"),u=a.forwardRef((e,t)=>{let{title:r,icon:u,color:d,className:c,children:h}=e,f=(0,n._T)(e,["title","icon","color","className","children"]);return a.createElement("div",Object.assign({ref:t,className:(0,o.q)(l("root"),"flex flex-col overflow-hidden rounded-tremor-default text-tremor-default border-l-4 py-3 pr-3 pl-4",d?(0,o.q)((0,s.bM)(d,i.K.background).bgColor,(0,s.bM)(d,i.K.darkBorder).borderColor,(0,s.bM)(d,i.K.darkText).textColor,"dark:bg-opacity-10 bg-opacity-10"):(0,o.q)("bg-tremor-brand-faint border-tremor-brand-emphasis text-tremor-brand-emphasis","dark:bg-dark-tremor-brand-muted/70 dark:border-dark-tremor-brand-emphasis dark:text-dark-tremor-brand-emphasis"),c)},f),a.createElement("div",{className:(0,o.q)(l("header"),"flex items-start")},u?a.createElement(u,{className:(0,o.q)(l("icon"),"flex-none h-5 w-5 mr-1.5")}):null,a.createElement("h4",{className:(0,o.q)(l("title"),"font-semibold")},r)),a.createElement("p",{className:(0,o.q)(l("body"),"overflow-y-auto",h?"mt-2":"")},h))});u.displayName="Callout"},44140:function(e,t,r){r.d(t,{Z:function(){return a}});var n=r(2265);let a=(e,t)=>{let r=void 0!==t,[a,i]=(0,n.useState)(e);return[r?t:a,e=>{r||i(e)}]}},32489:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},77331:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});t.Z=a},91777:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"}))});t.Z=a},47686:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"}))});t.Z=a},44633:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});t.Z=a},58710:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=a},82182:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}))});t.Z=a},79814:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"}))});t.Z=a},2356:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"}))});t.Z=a},93416:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});t.Z=a},77355:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=a},22452:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});t.Z=a},25327:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"}))});t.Z=a},49084:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});t.Z=a},3497:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"}))});t.Z=a},2894:function(e,t,r){r.d(t,{R:function(){return s},m:function(){return o}});var n=r(18238),a=r(7989),i=r(11255),o=class extends a.F{#e;#t;#r;#n;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#r=e.mutationCache,this.#t=[],this.state=e.state||s(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#r.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#a({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#n=(0,i.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#a({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#a({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});let n="pending"===this.state.status,a=!this.#n.canStart();try{if(n)t();else{this.#a({type:"pending",variables:e,isPaused:a}),await this.#r.config.onMutate?.(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#a({type:"pending",context:t,variables:e,isPaused:a})}let i=await this.#n.start();return await this.#r.config.onSuccess?.(i,e,this.state.context,this,r),await this.options.onSuccess?.(i,e,this.state.context,r),await this.#r.config.onSettled?.(i,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(i,null,e,this.state.context,r),this.#a({type:"success",data:i}),i}catch(t){try{throw await this.#r.config.onError?.(t,e,this.state.context,this,r),await this.options.onError?.(t,e,this.state.context,r),await this.#r.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(void 0,t,e,this.state.context,r),t}finally{this.#a({type:"error",error:t})}}finally{this.#r.runNext(this)}}#a(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),n.Vr.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#r.notify({mutation:this,type:"updated",action:e})})}};function s(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},21623:function(e,t,r){r.d(t,{S:function(){return p}});var n=r(45345),a=r(21733),i=r(18238),o=r(24112),s=class extends o.l{constructor(e={}){super(),this.config=e,this.#i=new Map}#i;build(e,t,r){let i=t.queryKey,o=t.queryHash??(0,n.Rm)(i,t),s=this.get(o);return s||(s=new a.A({client:e,queryKey:i,queryHash:o,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(s)),s}add(e){this.#i.has(e.queryHash)||(this.#i.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#i.get(e.queryHash);t&&(e.destroy(),t===e&&this.#i.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){i.Vr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#i.get(e)}getAll(){return[...this.#i.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n._x)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,n._x)(e,t)):t}notify(e){i.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){i.Vr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){i.Vr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},l=r(2894),u=class extends o.l{constructor(e={}){super(),this.config=e,this.#o=new Set,this.#s=new Map,this.#l=0}#o;#s;#l;build(e,t,r){let n=new l.m({client:e,mutationCache:this,mutationId:++this.#l,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#o.add(e);let t=d(e);if("string"==typeof t){let r=this.#s.get(t);r?r.push(e):this.#s.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#o.delete(e)){let t=d(e);if("string"==typeof t){let r=this.#s.get(t);if(r){if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#s.delete(t)}}}this.notify({type:"removed",mutation:e})}canRun(e){let t=d(e);if("string"!=typeof t)return!0;{let r=this.#s.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=d(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#s.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){i.Vr.batch(()=>{this.#o.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#o.clear(),this.#s.clear()})}getAll(){return Array.from(this.#o)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n.X7)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,n.X7)(e,t))}notify(e){i.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return i.Vr.batch(()=>Promise.all(e.map(e=>e.continue().catch(n.ZT))))}};function d(e){return e.options.scope?.id}var c=r(87045),h=r(57853);function f(e){return{onFetch:(t,r)=>{let a=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],s=t.state.data?.pageParams||[],l={pages:[],pageParams:[]},u=0,d=async()=>{let r=!1,d=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",()=>{r=!0}),t.signal)})},c=(0,n.cG)(t.options,t.fetchOptions),h=async(e,a,i)=>{if(r)return Promise.reject();if(null==a&&e.pages.length)return Promise.resolve(e);let o=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:a,direction:i?"backward":"forward",meta:t.options.meta};return d(e),e})(),s=await c(o),{maxPages:l}=t.options,u=i?n.Ht:n.VX;return{pages:u(e.pages,s,l),pageParams:u(e.pageParams,a,l)}};if(i&&o.length){let e="backward"===i,t={pages:o,pageParams:s},r=(e?function(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}:m)(a,t);l=await h(t,r,e)}else{let t=e??o.length;do{let e=0===u?s[0]??a.initialPageParam:m(a,l);if(u>0&&null==e)break;l=await h(l,e),u++}while(ut.options.persister?.(d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=d}}}function m(e,{pages:t,pageParams:r}){let n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}var p=class{#u;#r;#d;#c;#h;#f;#m;#p;constructor(e={}){this.#u=e.queryCache||new s,this.#r=e.mutationCache||new u,this.#d=e.defaultOptions||{},this.#c=new Map,this.#h=new Map,this.#f=0}mount(){this.#f++,1===this.#f&&(this.#m=c.j.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#u.onFocus())}),this.#p=h.N.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#u.onOnline())}))}unmount(){this.#f--,0===this.#f&&(this.#m?.(),this.#m=void 0,this.#p?.(),this.#p=void 0)}isFetching(e){return this.#u.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#r.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#u.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#u.build(this,t),a=r.state.data;return void 0===a?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime((0,n.KC)(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return this.#u.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let a=this.defaultQueryOptions({queryKey:e}),i=this.#u.get(a.queryHash),o=i?.state.data,s=(0,n.SE)(t,o);if(void 0!==s)return this.#u.build(this,a).setData(s,{...r,manual:!0})}setQueriesData(e,t,r){return i.Vr.batch(()=>this.#u.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#u.get(t.queryHash)?.state}removeQueries(e){let t=this.#u;i.Vr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#u;return i.Vr.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:!0,...t};return Promise.all(i.Vr.batch(()=>this.#u.findAll(e).map(e=>e.cancel(r)))).then(n.ZT).catch(n.ZT)}invalidateQueries(e,t={}){return i.Vr.batch(()=>(this.#u.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(i.Vr.batch(()=>this.#u.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(n.ZT)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(n.ZT)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#u.build(this,t);return r.isStaleByTime((0,n.KC)(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(n.ZT).catch(n.ZT)}fetchInfiniteQuery(e){return e.behavior=f(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(n.ZT).catch(n.ZT)}ensureInfiniteQueryData(e){return e.behavior=f(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return h.N.isOnline()?this.#r.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#u}getMutationCache(){return this.#r}getDefaultOptions(){return this.#d}setDefaultOptions(e){this.#d=e}setQueryDefaults(e,t){this.#c.set((0,n.Ym)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#c.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#h.set((0,n.Ym)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#h.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#d.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,n.Rm)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===n.CN&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#d.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#u.clear(),this.#r.clear()}}},85238:function(e,t,r){let n;r.d(t,{u:function(){return L}});var a=r(2265),i=r(59456),o=r(93980),s=r(25289),l=r(73389),u=r(43507),d=r(180),c=r(67561),h=r(98218),f=r(28294),m=r(95504),p=r(72468),g=r(38929);function b(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||(null!=(t=e.as)?t:x)!==a.Fragment||1===a.Children.count(e.children)}let v=(0,a.createContext)(null);v.displayName="TransitionContext";var w=((n=w||{}).Visible="visible",n.Hidden="hidden",n);let y=(0,a.createContext)(null);function k(e){return"children"in e?k(e.children):e.current.filter(e=>{let{el:t}=e;return null!==t.current}).filter(e=>{let{state:t}=e;return"visible"===t}).length>0}function C(e,t){let r=(0,u.E)(e),n=(0,a.useRef)([]),l=(0,s.t)(),d=(0,i.G)(),c=(0,o.z)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.l4.Hidden,a=n.current.findIndex(t=>{let{el:r}=t;return r===e});-1!==a&&((0,p.E)(t,{[g.l4.Unmount](){n.current.splice(a,1)},[g.l4.Hidden](){n.current[a].state="hidden"}}),d.microTask(()=>{var e;!k(n)&&l.current&&(null==(e=r.current)||e.call(r))}))}),h=(0,o.z)(e=>{let t=n.current.find(t=>{let{el:r}=t;return r===e});return t?"visible"!==t.state&&(t.state="visible"):n.current.push({el:e,state:"visible"}),()=>c(e,g.l4.Unmount)}),f=(0,a.useRef)([]),m=(0,a.useRef)(Promise.resolve()),b=(0,a.useRef)({enter:[],leave:[]}),v=(0,o.z)((e,r,n)=>{f.current.splice(0),t&&(t.chains.current[r]=t.chains.current[r].filter(t=>{let[r]=t;return r!==e})),null==t||t.chains.current[r].push([e,new Promise(e=>{f.current.push(e)})]),null==t||t.chains.current[r].push([e,new Promise(e=>{Promise.all(b.current[r].map(e=>{let[t,r]=e;return r})).then(()=>e())})]),"enter"===r?m.current=m.current.then(()=>null==t?void 0:t.wait.current).then(()=>n(r)):n(r)}),w=(0,o.z)((e,t,r)=>{Promise.all(b.current[t].splice(0).map(e=>{let[t,r]=e;return r})).then(()=>{var e;null==(e=f.current.shift())||e()}).then(()=>r(t))});return(0,a.useMemo)(()=>({children:n,register:h,unregister:c,onStart:v,onStop:w,wait:m,chains:b}),[h,c,n,v,w,b,m])}y.displayName="NestingContext";let x=a.Fragment,E=g.VN.RenderStrategy,M=(0,g.yV)(function(e,t){let{show:r,appear:n=!1,unmount:i=!0,...s}=e,u=(0,a.useRef)(null),h=b(e),m=(0,c.T)(...h?[u,t]:null===t?[]:[t]);(0,d.H)();let p=(0,f.oJ)();if(void 0===r&&null!==p&&(r=(p&f.ZM.Open)===f.ZM.Open),void 0===r)throw Error("A is used but it is missing a `show={true | false}` prop.");let[w,x]=(0,a.useState)(r?"visible":"hidden"),M=C(()=>{r||x("hidden")}),[O,L]=(0,a.useState)(!0),N=(0,a.useRef)([r]);(0,l.e)(()=>{!1!==O&&N.current[N.current.length-1]!==r&&(N.current.push(r),L(!1))},[N,r]);let P=(0,a.useMemo)(()=>({show:r,appear:n,initial:O}),[r,n,O]);(0,l.e)(()=>{r?x("visible"):k(M)||null===u.current||x("hidden")},[r,M]);let R={unmount:i},j=(0,o.z)(()=>{var t;O&&L(!1),null==(t=e.beforeEnter)||t.call(e)}),T=(0,o.z)(()=>{var t;O&&L(!1),null==(t=e.beforeLeave)||t.call(e)}),Z=(0,g.L6)();return a.createElement(y.Provider,{value:M},a.createElement(v.Provider,{value:P},Z({ourProps:{...R,as:a.Fragment,children:a.createElement(q,{ref:m,...R,...s,beforeEnter:j,beforeLeave:T})},theirProps:{},defaultTag:a.Fragment,features:E,visible:"visible"===w,name:"Transition"})))}),q=(0,g.yV)(function(e,t){var r,n;let{transition:i=!0,beforeEnter:s,afterEnter:u,beforeLeave:w,afterLeave:M,enter:q,enterFrom:O,enterTo:L,entered:N,leave:P,leaveFrom:R,leaveTo:j,...T}=e,[Z,D]=(0,a.useState)(null),Q=(0,a.useRef)(null),A=b(e),S=(0,c.T)(...A?[Q,t,D]:null===t?[]:[t]),V=null==(r=T.unmount)||r?g.l4.Unmount:g.l4.Hidden,{show:F,appear:z,initial:K}=function(){let e=(0,a.useContext)(v);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),[H,B]=(0,a.useState)(F?"visible":"hidden"),I=function(){let e=(0,a.useContext)(y);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),{register:_,unregister:W}=I;(0,l.e)(()=>_(Q),[_,Q]),(0,l.e)(()=>{if(V===g.l4.Hidden&&Q.current){if(F&&"visible"!==H){B("visible");return}return(0,p.E)(H,{hidden:()=>W(Q),visible:()=>_(Q)})}},[H,Q,_,W,F,V]);let Y=(0,d.H)();(0,l.e)(()=>{if(A&&Y&&"visible"===H&&null===Q.current)throw Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[Q,H,Y,A]);let X=K&&!z,G=z&&F&&K,U=(0,a.useRef)(!1),J=C(()=>{U.current||(B("hidden"),W(Q))},I),$=(0,o.z)(e=>{U.current=!0,J.onStart(Q,e?"enter":"leave",e=>{"enter"===e?null==s||s():"leave"===e&&(null==w||w())})}),ee=(0,o.z)(e=>{let t=e?"enter":"leave";U.current=!1,J.onStop(Q,t,e=>{"enter"===e?null==u||u():"leave"===e&&(null==M||M())}),"leave"!==t||k(J)||(B("hidden"),W(Q))});(0,a.useEffect)(()=>{A&&i||($(F),ee(F))},[F,A,i]);let et=!(!i||!A||!Y||X),[,er]=(0,h.Y)(et,Z,F,{start:$,end:ee}),en=(0,g.oA)({ref:S,className:(null==(n=(0,m.A)(T.className,G&&q,G&&O,er.enter&&q,er.enter&&er.closed&&O,er.enter&&!er.closed&&L,er.leave&&P,er.leave&&!er.closed&&R,er.leave&&er.closed&&j,!er.transition&&F&&N))?void 0:n.trim())||void 0,...(0,h.X)(er)}),ea=0;"visible"===H&&(ea|=f.ZM.Open),"hidden"===H&&(ea|=f.ZM.Closed),er.enter&&(ea|=f.ZM.Opening),er.leave&&(ea|=f.ZM.Closing);let ei=(0,g.L6)();return a.createElement(y.Provider,{value:J},a.createElement(f.up,{value:ea},ei({ourProps:en,theirProps:T,defaultTag:x,features:E,visible:"visible"===H,name:"Transition.Child"})))}),O=(0,g.yV)(function(e,t){let r=null!==(0,a.useContext)(v),n=null!==(0,f.oJ)();return a.createElement(a.Fragment,null,!r&&n?a.createElement(M,{ref:t,...e}):a.createElement(q,{ref:t,...e}))}),L=Object.assign(M,{Child:O,Root:M})},92668:function(e,t,r){r.d(t,{I:function(){return s}});var n=r(59121),a=r(31091),i=r(63497),o=r(99649);function s(e,t){let{years:r=0,months:s=0,weeks:l=0,days:u=0,hours:d=0,minutes:c=0,seconds:h=0}=t,f=(0,o.Q)(e),m=s||r?(0,a.z)(f,s+12*r):f,p=u||l?(0,n.E)(m,u+7*l):m;return(0,i.L)(e,p.getTime()+1e3*(h+60*(c+60*d)))}},59121:function(e,t,r){r.d(t,{E:function(){return i}});var n=r(99649),a=r(63497);function i(e,t){let r=(0,n.Q)(e);return isNaN(t)?(0,a.L)(e,NaN):(t&&r.setDate(r.getDate()+t),r)}},31091:function(e,t,r){r.d(t,{z:function(){return i}});var n=r(99649),a=r(63497);function i(e,t){let r=(0,n.Q)(e);if(isNaN(t))return(0,a.L)(e,NaN);if(!t)return r;let i=r.getDate(),o=(0,a.L)(e,r.getTime());return(o.setMonth(r.getMonth()+t+1,0),i>=o.getDate())?o:(r.setFullYear(o.getFullYear(),o.getMonth(),i),r)}},63497:function(e,t,r){r.d(t,{L:function(){return n}});function n(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}},99649:function(e,t,r){r.d(t,{Q:function(){return n}});function n(e){let t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):new Date("number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?e:NaN)}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1301],{69993:function(e,t,r){r.d(t,{Z:function(){return s}});var n=r(1119),a=r(2265),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"robot",theme:"outlined"},o=r(55015),s=a.forwardRef(function(e,t){return a.createElement(o.Z,(0,n.Z)({},e,{ref:t,icon:i}))})},58747:function(e,t,r){r.d(t,{Z:function(){return i}});var n=r(5853),a=r(2265);let i=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.createElement("path",{d:"M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z"}))}},4537:function(e,t,r){r.d(t,{Z:function(){return i}});var n=r(5853),a=r(2265);let i=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.createElement("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 10.5858L9.17157 7.75736L7.75736 9.17157L10.5858 12L7.75736 14.8284L9.17157 16.2426L12 13.4142L14.8284 16.2426L16.2426 14.8284L13.4142 12L16.2426 9.17157L14.8284 7.75736L12 10.5858Z"}))}},47323:function(e,t,r){r.d(t,{Z:function(){return p}});var n=r(5853),a=r(2265),i=r(47187),o=r(7084),s=r(13241),l=r(1153),u=r(26898);let d={xs:{paddingX:"px-1.5",paddingY:"py-1.5"},sm:{paddingX:"px-1.5",paddingY:"py-1.5"},md:{paddingX:"px-2",paddingY:"py-2"},lg:{paddingX:"px-2",paddingY:"py-2"},xl:{paddingX:"px-2.5",paddingY:"py-2.5"}},c={xs:{height:"h-3",width:"w-3"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-7",width:"w-7"},xl:{height:"h-9",width:"w-9"}},h={simple:{rounded:"",border:"",ring:"",shadow:""},light:{rounded:"rounded-tremor-default",border:"",ring:"",shadow:""},shadow:{rounded:"rounded-tremor-default",border:"border",ring:"",shadow:"shadow-tremor-card dark:shadow-dark-tremor-card"},solid:{rounded:"rounded-tremor-default",border:"border-2",ring:"ring-1",shadow:""},outlined:{rounded:"rounded-tremor-default",border:"border",ring:"ring-2",shadow:""}},f=(e,t)=>{switch(e){case"simple":return{textColor:t?(0,l.bM)(t,u.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:t?(0,l.bM)(t,u.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,s.q)((0,l.bM)(t,u.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:t?(0,l.bM)(t,u.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,s.q)((0,l.bM)(t,u.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:"border-tremor-border dark:border-dark-tremor-border",ringColor:""};case"solid":return{textColor:t?(0,l.bM)(t,u.K.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,s.q)((0,l.bM)(t,u.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand dark:bg-dark-tremor-brand",borderColor:"border-tremor-brand-inverted dark:border-dark-tremor-brand-inverted",ringColor:"ring-tremor-ring dark:ring-dark-tremor-ring"};case"outlined":return{textColor:t?(0,l.bM)(t,u.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,s.q)((0,l.bM)(t,u.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:t?(0,l.bM)(t,u.K.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:t?(0,s.q)((0,l.bM)(t,u.K.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},m=(0,l.fn)("Icon"),p=a.forwardRef((e,t)=>{let{icon:r,variant:u="simple",tooltip:p,size:g=o.u8.SM,color:b,className:v}=e,w=(0,n._T)(e,["icon","variant","tooltip","size","color","className"]),y=f(u,b),{tooltipProps:k,getReferenceProps:C}=(0,i.l)();return a.createElement("span",Object.assign({ref:(0,l.lq)([t,k.refs.setReference]),className:(0,s.q)(m("root"),"inline-flex shrink-0 items-center justify-center",y.bgColor,y.textColor,y.borderColor,y.ringColor,h[u].rounded,h[u].border,h[u].shadow,h[u].ring,d[g].paddingX,d[g].paddingY,v)},C,w),a.createElement(i.Z,Object.assign({text:p},k)),a.createElement(r,{className:(0,s.q)(m("icon"),"shrink-0",c[g].height,c[g].width)}))});p.displayName="Icon"},27281:function(e,t,r){r.d(t,{Z:function(){return m}});var n=r(5853),a=r(58747),i=r(2265),o=r(4537),s=r(13241),l=r(1153),u=r(96398),d=r(51975),c=r(85238),h=r(44140);let f=(0,l.fn)("Select"),m=i.forwardRef((e,t)=>{let{defaultValue:r="",value:l,onValueChange:m,placeholder:p="Select...",disabled:g=!1,icon:b,enableClear:v=!1,required:w,children:y,name:k,error:C=!1,errorMessage:x,className:E,id:M}=e,q=(0,n._T)(e,["defaultValue","value","onValueChange","placeholder","disabled","icon","enableClear","required","children","name","error","errorMessage","className","id"]),O=(0,i.useRef)(null),L=i.Children.toArray(y),[N,P]=(0,h.Z)(r,l),R=(0,i.useMemo)(()=>{let e=i.Children.toArray(y).filter(i.isValidElement);return(0,u.sl)(e)},[y]);return i.createElement("div",{className:(0,s.q)("w-full min-w-[10rem] text-tremor-default",E)},i.createElement("div",{className:"relative"},i.createElement("select",{title:"select-hidden",required:w,className:(0,s.q)("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:N,onChange:e=>{e.preventDefault()},name:k,disabled:g,id:M,onFocus:()=>{let e=O.current;e&&e.focus()}},i.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},p),L.map(e=>{let t=e.props.value,r=e.props.children;return i.createElement("option",{className:"hidden",key:t,value:t},r)})),i.createElement(d.Ri,Object.assign({as:"div",ref:t,defaultValue:N,value:N,onChange:e=>{null==m||m(e),P(e)},disabled:g,id:M},q),e=>{var t;let{value:r}=e;return i.createElement(i.Fragment,null,i.createElement(d.Y4,{ref:O,className:(0,s.q)("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 border pr-8 py-2","border-tremor-border shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",b?"pl-10":"pl-3",(0,u.um)((0,u.Uh)(r),g,C))},b&&i.createElement("span",{className:(0,s.q)("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},i.createElement(b,{className:(0,s.q)(f("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),i.createElement("span",{className:"w-[90%] block truncate"},r&&null!==(t=R.get(r))&&void 0!==t?t:p),i.createElement("span",{className:(0,s.q)("absolute inset-y-0 right-0 flex items-center mr-3")},i.createElement(a.Z,{className:(0,s.q)(f("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),v&&N?i.createElement("button",{type:"button",className:(0,s.q)("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:e=>{e.preventDefault(),P(""),null==m||m("")}},i.createElement(o.Z,{className:(0,s.q)(f("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,i.createElement(c.u,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},i.createElement(d.O_,{anchor:"bottom start",className:(0,s.q)("z-10 w-[var(--button-width)] divide-y overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},y)))})),C&&x?i.createElement("p",{className:(0,s.q)("errorMessage","text-sm text-rose-500 mt-1")},x):null)});m.displayName="Select"},94789:function(e,t,r){r.d(t,{Z:function(){return u}});var n=r(5853),a=r(2265),i=r(26898),o=r(13241),s=r(1153);let l=(0,s.fn)("Callout"),u=a.forwardRef((e,t)=>{let{title:r,icon:u,color:d,className:c,children:h}=e,f=(0,n._T)(e,["title","icon","color","className","children"]);return a.createElement("div",Object.assign({ref:t,className:(0,o.q)(l("root"),"flex flex-col overflow-hidden rounded-tremor-default text-tremor-default border-l-4 py-3 pr-3 pl-4",d?(0,o.q)((0,s.bM)(d,i.K.background).bgColor,(0,s.bM)(d,i.K.darkBorder).borderColor,(0,s.bM)(d,i.K.darkText).textColor,"dark:bg-opacity-10 bg-opacity-10"):(0,o.q)("bg-tremor-brand-faint border-tremor-brand-emphasis text-tremor-brand-emphasis","dark:bg-dark-tremor-brand-muted/70 dark:border-dark-tremor-brand-emphasis dark:text-dark-tremor-brand-emphasis"),c)},f),a.createElement("div",{className:(0,o.q)(l("header"),"flex items-start")},u?a.createElement(u,{className:(0,o.q)(l("icon"),"flex-none h-5 w-5 mr-1.5")}):null,a.createElement("h4",{className:(0,o.q)(l("title"),"font-semibold")},r)),a.createElement("p",{className:(0,o.q)(l("body"),"overflow-y-auto",h?"mt-2":"")},h))});u.displayName="Callout"},44140:function(e,t,r){r.d(t,{Z:function(){return a}});var n=r(2265);let a=(e,t)=>{let r=void 0!==t,[a,i]=(0,n.useState)(e);return[r?t:a,e=>{r||i(e)}]}},32489:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},10900:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});t.Z=a},91777:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"}))});t.Z=a},47686:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"}))});t.Z=a},44633:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});t.Z=a},58710:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=a},82182:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}))});t.Z=a},79814:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"}))});t.Z=a},2356:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"}))});t.Z=a},93416:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});t.Z=a},77355:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=a},22452:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});t.Z=a},25327:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"}))});t.Z=a},49084:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});t.Z=a},3497:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"}))});t.Z=a},2894:function(e,t,r){r.d(t,{R:function(){return s},m:function(){return o}});var n=r(18238),a=r(7989),i=r(11255),o=class extends a.F{#e;#t;#r;#n;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#r=e.mutationCache,this.#t=[],this.state=e.state||s(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#r.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#a({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#n=(0,i.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#a({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#a({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});let n="pending"===this.state.status,a=!this.#n.canStart();try{if(n)t();else{this.#a({type:"pending",variables:e,isPaused:a}),await this.#r.config.onMutate?.(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#a({type:"pending",context:t,variables:e,isPaused:a})}let i=await this.#n.start();return await this.#r.config.onSuccess?.(i,e,this.state.context,this,r),await this.options.onSuccess?.(i,e,this.state.context,r),await this.#r.config.onSettled?.(i,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(i,null,e,this.state.context,r),this.#a({type:"success",data:i}),i}catch(t){try{throw await this.#r.config.onError?.(t,e,this.state.context,this,r),await this.options.onError?.(t,e,this.state.context,r),await this.#r.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(void 0,t,e,this.state.context,r),t}finally{this.#a({type:"error",error:t})}}finally{this.#r.runNext(this)}}#a(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),n.Vr.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#r.notify({mutation:this,type:"updated",action:e})})}};function s(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},21623:function(e,t,r){r.d(t,{S:function(){return p}});var n=r(45345),a=r(21733),i=r(18238),o=r(24112),s=class extends o.l{constructor(e={}){super(),this.config=e,this.#i=new Map}#i;build(e,t,r){let i=t.queryKey,o=t.queryHash??(0,n.Rm)(i,t),s=this.get(o);return s||(s=new a.A({client:e,queryKey:i,queryHash:o,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(s)),s}add(e){this.#i.has(e.queryHash)||(this.#i.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#i.get(e.queryHash);t&&(e.destroy(),t===e&&this.#i.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){i.Vr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#i.get(e)}getAll(){return[...this.#i.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n._x)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,n._x)(e,t)):t}notify(e){i.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){i.Vr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){i.Vr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},l=r(2894),u=class extends o.l{constructor(e={}){super(),this.config=e,this.#o=new Set,this.#s=new Map,this.#l=0}#o;#s;#l;build(e,t,r){let n=new l.m({client:e,mutationCache:this,mutationId:++this.#l,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#o.add(e);let t=d(e);if("string"==typeof t){let r=this.#s.get(t);r?r.push(e):this.#s.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#o.delete(e)){let t=d(e);if("string"==typeof t){let r=this.#s.get(t);if(r){if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#s.delete(t)}}}this.notify({type:"removed",mutation:e})}canRun(e){let t=d(e);if("string"!=typeof t)return!0;{let r=this.#s.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=d(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#s.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){i.Vr.batch(()=>{this.#o.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#o.clear(),this.#s.clear()})}getAll(){return Array.from(this.#o)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n.X7)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,n.X7)(e,t))}notify(e){i.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return i.Vr.batch(()=>Promise.all(e.map(e=>e.continue().catch(n.ZT))))}};function d(e){return e.options.scope?.id}var c=r(87045),h=r(57853);function f(e){return{onFetch:(t,r)=>{let a=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],s=t.state.data?.pageParams||[],l={pages:[],pageParams:[]},u=0,d=async()=>{let r=!1,d=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",()=>{r=!0}),t.signal)})},c=(0,n.cG)(t.options,t.fetchOptions),h=async(e,a,i)=>{if(r)return Promise.reject();if(null==a&&e.pages.length)return Promise.resolve(e);let o=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:a,direction:i?"backward":"forward",meta:t.options.meta};return d(e),e})(),s=await c(o),{maxPages:l}=t.options,u=i?n.Ht:n.VX;return{pages:u(e.pages,s,l),pageParams:u(e.pageParams,a,l)}};if(i&&o.length){let e="backward"===i,t={pages:o,pageParams:s},r=(e?function(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}:m)(a,t);l=await h(t,r,e)}else{let t=e??o.length;do{let e=0===u?s[0]??a.initialPageParam:m(a,l);if(u>0&&null==e)break;l=await h(l,e),u++}while(ut.options.persister?.(d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=d}}}function m(e,{pages:t,pageParams:r}){let n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}var p=class{#u;#r;#d;#c;#h;#f;#m;#p;constructor(e={}){this.#u=e.queryCache||new s,this.#r=e.mutationCache||new u,this.#d=e.defaultOptions||{},this.#c=new Map,this.#h=new Map,this.#f=0}mount(){this.#f++,1===this.#f&&(this.#m=c.j.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#u.onFocus())}),this.#p=h.N.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#u.onOnline())}))}unmount(){this.#f--,0===this.#f&&(this.#m?.(),this.#m=void 0,this.#p?.(),this.#p=void 0)}isFetching(e){return this.#u.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#r.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#u.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#u.build(this,t),a=r.state.data;return void 0===a?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime((0,n.KC)(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return this.#u.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let a=this.defaultQueryOptions({queryKey:e}),i=this.#u.get(a.queryHash),o=i?.state.data,s=(0,n.SE)(t,o);if(void 0!==s)return this.#u.build(this,a).setData(s,{...r,manual:!0})}setQueriesData(e,t,r){return i.Vr.batch(()=>this.#u.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#u.get(t.queryHash)?.state}removeQueries(e){let t=this.#u;i.Vr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#u;return i.Vr.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:!0,...t};return Promise.all(i.Vr.batch(()=>this.#u.findAll(e).map(e=>e.cancel(r)))).then(n.ZT).catch(n.ZT)}invalidateQueries(e,t={}){return i.Vr.batch(()=>(this.#u.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(i.Vr.batch(()=>this.#u.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(n.ZT)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(n.ZT)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#u.build(this,t);return r.isStaleByTime((0,n.KC)(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(n.ZT).catch(n.ZT)}fetchInfiniteQuery(e){return e.behavior=f(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(n.ZT).catch(n.ZT)}ensureInfiniteQueryData(e){return e.behavior=f(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return h.N.isOnline()?this.#r.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#u}getMutationCache(){return this.#r}getDefaultOptions(){return this.#d}setDefaultOptions(e){this.#d=e}setQueryDefaults(e,t){this.#c.set((0,n.Ym)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#c.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#h.set((0,n.Ym)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#h.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#d.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,n.Rm)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===n.CN&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#d.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#u.clear(),this.#r.clear()}}},85238:function(e,t,r){let n;r.d(t,{u:function(){return L}});var a=r(2265),i=r(59456),o=r(93980),s=r(25289),l=r(73389),u=r(43507),d=r(180),c=r(67561),h=r(98218),f=r(28294),m=r(95504),p=r(72468),g=r(38929);function b(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||(null!=(t=e.as)?t:x)!==a.Fragment||1===a.Children.count(e.children)}let v=(0,a.createContext)(null);v.displayName="TransitionContext";var w=((n=w||{}).Visible="visible",n.Hidden="hidden",n);let y=(0,a.createContext)(null);function k(e){return"children"in e?k(e.children):e.current.filter(e=>{let{el:t}=e;return null!==t.current}).filter(e=>{let{state:t}=e;return"visible"===t}).length>0}function C(e,t){let r=(0,u.E)(e),n=(0,a.useRef)([]),l=(0,s.t)(),d=(0,i.G)(),c=(0,o.z)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.l4.Hidden,a=n.current.findIndex(t=>{let{el:r}=t;return r===e});-1!==a&&((0,p.E)(t,{[g.l4.Unmount](){n.current.splice(a,1)},[g.l4.Hidden](){n.current[a].state="hidden"}}),d.microTask(()=>{var e;!k(n)&&l.current&&(null==(e=r.current)||e.call(r))}))}),h=(0,o.z)(e=>{let t=n.current.find(t=>{let{el:r}=t;return r===e});return t?"visible"!==t.state&&(t.state="visible"):n.current.push({el:e,state:"visible"}),()=>c(e,g.l4.Unmount)}),f=(0,a.useRef)([]),m=(0,a.useRef)(Promise.resolve()),b=(0,a.useRef)({enter:[],leave:[]}),v=(0,o.z)((e,r,n)=>{f.current.splice(0),t&&(t.chains.current[r]=t.chains.current[r].filter(t=>{let[r]=t;return r!==e})),null==t||t.chains.current[r].push([e,new Promise(e=>{f.current.push(e)})]),null==t||t.chains.current[r].push([e,new Promise(e=>{Promise.all(b.current[r].map(e=>{let[t,r]=e;return r})).then(()=>e())})]),"enter"===r?m.current=m.current.then(()=>null==t?void 0:t.wait.current).then(()=>n(r)):n(r)}),w=(0,o.z)((e,t,r)=>{Promise.all(b.current[t].splice(0).map(e=>{let[t,r]=e;return r})).then(()=>{var e;null==(e=f.current.shift())||e()}).then(()=>r(t))});return(0,a.useMemo)(()=>({children:n,register:h,unregister:c,onStart:v,onStop:w,wait:m,chains:b}),[h,c,n,v,w,b,m])}y.displayName="NestingContext";let x=a.Fragment,E=g.VN.RenderStrategy,M=(0,g.yV)(function(e,t){let{show:r,appear:n=!1,unmount:i=!0,...s}=e,u=(0,a.useRef)(null),h=b(e),m=(0,c.T)(...h?[u,t]:null===t?[]:[t]);(0,d.H)();let p=(0,f.oJ)();if(void 0===r&&null!==p&&(r=(p&f.ZM.Open)===f.ZM.Open),void 0===r)throw Error("A is used but it is missing a `show={true | false}` prop.");let[w,x]=(0,a.useState)(r?"visible":"hidden"),M=C(()=>{r||x("hidden")}),[O,L]=(0,a.useState)(!0),N=(0,a.useRef)([r]);(0,l.e)(()=>{!1!==O&&N.current[N.current.length-1]!==r&&(N.current.push(r),L(!1))},[N,r]);let P=(0,a.useMemo)(()=>({show:r,appear:n,initial:O}),[r,n,O]);(0,l.e)(()=>{r?x("visible"):k(M)||null===u.current||x("hidden")},[r,M]);let R={unmount:i},j=(0,o.z)(()=>{var t;O&&L(!1),null==(t=e.beforeEnter)||t.call(e)}),T=(0,o.z)(()=>{var t;O&&L(!1),null==(t=e.beforeLeave)||t.call(e)}),Z=(0,g.L6)();return a.createElement(y.Provider,{value:M},a.createElement(v.Provider,{value:P},Z({ourProps:{...R,as:a.Fragment,children:a.createElement(q,{ref:m,...R,...s,beforeEnter:j,beforeLeave:T})},theirProps:{},defaultTag:a.Fragment,features:E,visible:"visible"===w,name:"Transition"})))}),q=(0,g.yV)(function(e,t){var r,n;let{transition:i=!0,beforeEnter:s,afterEnter:u,beforeLeave:w,afterLeave:M,enter:q,enterFrom:O,enterTo:L,entered:N,leave:P,leaveFrom:R,leaveTo:j,...T}=e,[Z,D]=(0,a.useState)(null),Q=(0,a.useRef)(null),A=b(e),S=(0,c.T)(...A?[Q,t,D]:null===t?[]:[t]),V=null==(r=T.unmount)||r?g.l4.Unmount:g.l4.Hidden,{show:F,appear:z,initial:K}=function(){let e=(0,a.useContext)(v);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),[H,B]=(0,a.useState)(F?"visible":"hidden"),I=function(){let e=(0,a.useContext)(y);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),{register:_,unregister:W}=I;(0,l.e)(()=>_(Q),[_,Q]),(0,l.e)(()=>{if(V===g.l4.Hidden&&Q.current){if(F&&"visible"!==H){B("visible");return}return(0,p.E)(H,{hidden:()=>W(Q),visible:()=>_(Q)})}},[H,Q,_,W,F,V]);let Y=(0,d.H)();(0,l.e)(()=>{if(A&&Y&&"visible"===H&&null===Q.current)throw Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[Q,H,Y,A]);let X=K&&!z,G=z&&F&&K,U=(0,a.useRef)(!1),J=C(()=>{U.current||(B("hidden"),W(Q))},I),$=(0,o.z)(e=>{U.current=!0,J.onStart(Q,e?"enter":"leave",e=>{"enter"===e?null==s||s():"leave"===e&&(null==w||w())})}),ee=(0,o.z)(e=>{let t=e?"enter":"leave";U.current=!1,J.onStop(Q,t,e=>{"enter"===e?null==u||u():"leave"===e&&(null==M||M())}),"leave"!==t||k(J)||(B("hidden"),W(Q))});(0,a.useEffect)(()=>{A&&i||($(F),ee(F))},[F,A,i]);let et=!(!i||!A||!Y||X),[,er]=(0,h.Y)(et,Z,F,{start:$,end:ee}),en=(0,g.oA)({ref:S,className:(null==(n=(0,m.A)(T.className,G&&q,G&&O,er.enter&&q,er.enter&&er.closed&&O,er.enter&&!er.closed&&L,er.leave&&P,er.leave&&!er.closed&&R,er.leave&&er.closed&&j,!er.transition&&F&&N))?void 0:n.trim())||void 0,...(0,h.X)(er)}),ea=0;"visible"===H&&(ea|=f.ZM.Open),"hidden"===H&&(ea|=f.ZM.Closed),er.enter&&(ea|=f.ZM.Opening),er.leave&&(ea|=f.ZM.Closing);let ei=(0,g.L6)();return a.createElement(y.Provider,{value:J},a.createElement(f.up,{value:ea},ei({ourProps:en,theirProps:T,defaultTag:x,features:E,visible:"visible"===H,name:"Transition.Child"})))}),O=(0,g.yV)(function(e,t){let r=null!==(0,a.useContext)(v),n=null!==(0,f.oJ)();return a.createElement(a.Fragment,null,!r&&n?a.createElement(M,{ref:t,...e}):a.createElement(q,{ref:t,...e}))}),L=Object.assign(M,{Child:O,Root:M})},92668:function(e,t,r){r.d(t,{I:function(){return s}});var n=r(59121),a=r(31091),i=r(63497),o=r(99649);function s(e,t){let{years:r=0,months:s=0,weeks:l=0,days:u=0,hours:d=0,minutes:c=0,seconds:h=0}=t,f=(0,o.Q)(e),m=s||r?(0,a.z)(f,s+12*r):f,p=u||l?(0,n.E)(m,u+7*l):m;return(0,i.L)(e,p.getTime()+1e3*(h+60*(c+60*d)))}},59121:function(e,t,r){r.d(t,{E:function(){return i}});var n=r(99649),a=r(63497);function i(e,t){let r=(0,n.Q)(e);return isNaN(t)?(0,a.L)(e,NaN):(t&&r.setDate(r.getDate()+t),r)}},31091:function(e,t,r){r.d(t,{z:function(){return i}});var n=r(99649),a=r(63497);function i(e,t){let r=(0,n.Q)(e);if(isNaN(t))return(0,a.L)(e,NaN);if(!t)return r;let i=r.getDate(),o=(0,a.L)(e,r.getTime());return(o.setMonth(r.getMonth()+t+1,0),i>=o.getDate())?o:(r.setFullYear(o.getFullYear(),o.getMonth(),i),r)}},63497:function(e,t,r){r.d(t,{L:function(){return n}});function n(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}},99649:function(e,t,r){r.d(t,{Q:function(){return n}});function n(e){let t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):new Date("number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?e:NaN)}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1518-3d9170796eddc9f1.js b/litellm/proxy/_experimental/out/_next/static/chunks/1518-3d9170796eddc9f1.js new file mode 100644 index 0000000000..6c15e1df5a --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1518-3d9170796eddc9f1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1518],{81518:function(e,s,a){a.r(s),a.d(s,{default:function(){return Q}});var t=a(57437),r=a(2265),n=a(75301),l=a(9114),i=a(26430),o=a(96473),d=a(50010),c=a(26349),m=a(37592),u=a(4260),x=a(99981),h=a(5545),g=a(93837),p=a(27930),v=a(66830),f=a(95459),j=a(10703),y=a(32489),b=a(98728),N=a(79862),w=a(82222),k=a(51817),A=a(62831),S=a(17906),C=a(94263),T=a(88712),L=a(94331),Z=a(38398),P=a(33152);function _(e){let{messages:s,isLoading:a}=e;if(0===s.length)return(0,t.jsx)("div",{className:"h-full"});let r=[],n=0;for(;n(0,t.jsxs)("div",{className:"whitespace-pre-wrap break-words",style:{wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",hyphens:"auto"},children:[(0,t.jsx)(T.Z,{message:e}),(0,t.jsx)(A.UG,{components:{code(e){let{node:s,inline:a,className:r,children:n,...l}=e,i=/language-(\w+)/.exec(r||"");return!a&&i?(0,t.jsx)(S.Z,{style:C.Z,language:i[1],PreTag:"div",className:"rounded-md my-2",wrapLines:!0,wrapLongLines:!0,...l,children:String(n).replace(/\n$/,"")}):(0,t.jsx)("code",{className:"".concat(r," px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono"),...l,children:n})},pre:e=>{let{node:s,...a}=e;return(0,t.jsx)("pre",{style:{overflowX:"auto",maxWidth:"100%"},...a})}},children:"string"==typeof e.content?e.content:""})]});return(0,t.jsxs)("div",{className:"flex flex-col gap-6 min-w-0 w-full p-4",children:[r.map((e,s)=>{let n=e.assistant,i=(null==n?void 0:n.model)||"Assistant";return(0,t.jsxs)("div",{className:"space-y-4",children:[e.user&&(0,t.jsxs)("div",{className:"space-y-2 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-blue-100 text-blue-600",children:(0,t.jsx)(N.Z,{size:16})}),(0,t.jsx)("div",{className:"text-sm font-semibold text-gray-700",children:"You"})]}),l(e.user)]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),n?(0,t.jsxs)("div",{className:"space-y-3 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-gray-100 text-gray-600",children:(0,t.jsx)(w.Z,{size:16})}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-semibold text-gray-700",children:i}),n.toolName&&(0,t.jsx)("span",{className:"rounded bg-gray-100 px-2 py-0.5 text-xs text-gray-600",children:n.toolName})]})]}),n.reasoningContent&&(0,t.jsx)(L.Z,{reasoningContent:n.reasoningContent}),n.searchResults&&(0,t.jsx)(P.J,{searchResults:n.searchResults}),l(n),(n.timeToFirstToken||n.totalLatency||n.usage)&&(0,t.jsx)(Z.Z,{timeToFirstToken:n.timeToFirstToken,totalLatency:n.totalLatency,usage:n.usage,toolName:n.toolName})]}):a&&s===r.length-1?(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,t.jsx)(k.Z,{size:18,className:"animate-spin"}),(0,t.jsx)("span",{children:"Generating response..."})]}):(0,t.jsx)("div",{className:"text-sm text-gray-500",children:"Waiting for a response..."})]},s)}),a&&0===r.length&&(0,t.jsxs)("div",{className:"flex items-center gap-2 text-gray-500",children:[(0,t.jsx)(k.Z,{size:18,className:"animate-spin"}),(0,t.jsx)("span",{children:"Generating response..."})]})]})}var M=a(31283);function E(e){let{value:s,onChange:a,models:n,loading:l,disabled:i}=e,[o,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(""),x=(0,r.useMemo)(()=>Array.from(new Set(n)).sort(),[n]),h=(0,r.useMemo)(()=>s&&!x.includes(s)?[s,...x]:x,[x,s]),g=o?"__custom__":s||void 0,p=()=>{let e=c.trim();if(!e){d(!1),u("");return}a(e),d(!1),u("")};return(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)(m.default,{value:g,onChange:e=>{if("__custom__"===e){d(!0),s&&!x.includes(s)?u(s):u("");return}d(!1),u(""),a(e)},disabled:i,loading:l,placeholder:l?"Loading models...":"Select a model",className:"w-full rounded-md",showSearch:!0,optionFilterProp:"children",children:[h.map(e=>(0,t.jsx)(m.default.Option,{value:e,children:e},e)),(0,t.jsx)(m.default.Option,{value:"__custom__",children:"+ Add custom model"})]}),o&&(0,t.jsx)(M.o,{className:"mt-2",placeholder:"Custom Model Name (Enter to add)",value:c,onValueChange:u,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),p())},onBlur:p,autoFocus:!0})]})}var U=a(99020),R=a(97415),I=a(67479),O=a(4156),z=a(23496),K=a(85847),D=a(79326);function B(e){let{comparison:s,onUpdate:a,onRemove:n,canRemove:l,modelOptions:i,isLoadingModels:o,apiKey:d}=e,[c,m]=(0,r.useState)(!1),u=e=>{e?a({applyAcrossModels:!0,temperature:s.temperature,maxTokens:s.maxTokens,tags:[...s.tags],vectorStores:[...s.vectorStores],guardrails:[...s.guardrails],useAdvancedParams:s.useAdvancedParams},{applyToAll:!0,keysToApply:["temperature","maxTokens","tags","vectorStores","guardrails","useAdvancedParams"]}):a({applyAcrossModels:!1})},x=e=>{a({useAdvancedParams:e},s.applyAcrossModels?{applyToAll:!0,keysToApply:["useAdvancedParams"]}:void 0)},h=(e,t)=>{a({[e]:t},s.applyAcrossModels?{applyToAll:!0,keysToApply:[e]}:void 0)},g=s.useAdvancedParams?1:.4,p=s.useAdvancedParams?"text-gray-700":"text-gray-400",v=()=>{m(e=>!e)},f=(0,t.jsxs)("div",{className:"w-[300px] max-h-[65vh] overflow-y-auto relative",children:[(0,t.jsx)("button",{onClick:()=>{m(!1)},className:"absolute top-0 right-0 p-1 hover:bg-gray-100 rounded transition-colors text-gray-500 hover:text-gray-700 z-10",children:(0,t.jsx)(y.Z,{size:14})}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(O.Z,{checked:s.applyAcrossModels,onChange:e=>u(e.target.checked),children:(0,t.jsx)("span",{className:"text-xs font-medium",children:"Sync Settings Across Models"})})}),(0,t.jsx)(z.Z,{className:"border-gray-200"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-xs font-semibold text-gray-700 mb-1.5 uppercase tracking-wide",children:"General Settings"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-600 block mb-0.5",children:"Tags"}),(0,t.jsx)(U.Z,{value:s.tags,onChange:e=>h("tags",e),accessToken:d})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-600 block mb-0.5",children:"Vector Stores"}),(0,t.jsx)(R.Z,{value:s.vectorStores,onChange:e=>h("vectorStores",e),accessToken:d})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-600 block mb-0.5",children:"Guardrails"}),(0,t.jsx)(I.Z,{value:s.guardrails,onChange:e=>h("guardrails",e),accessToken:d})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-xs font-semibold text-gray-700 mb-1.5 uppercase tracking-wide",children:"Advanced Settings"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex items-center gap-2 pb-1",children:(0,t.jsx)(O.Z,{checked:s.useAdvancedParams,onChange:e=>x(e.target.checked),children:(0,t.jsx)("span",{className:"text-sm font-medium",children:"Use Advanced Parameters"})})}),(0,t.jsxs)("div",{className:"space-y-2 transition-opacity duration-200",style:{opacity:g},children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium ".concat(p),children:"Temperature"}),(0,t.jsx)("span",{className:"text-xs ".concat(p),children:s.temperature.toFixed(2)})]}),(0,t.jsx)(K.Z,{min:0,max:2,step:.01,value:s.temperature,onChange:e=>{h("temperature",Math.min(2,Math.max(0,Number((Array.isArray(e)?e[0]:e).toFixed(2)))))},disabled:!s.useAdvancedParams})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium ".concat(p),children:"Max Tokens"}),(0,t.jsx)("span",{className:"text-xs ".concat(p),children:s.maxTokens})]}),(0,t.jsx)(K.Z,{min:1,max:32768,step:1,value:s.maxTokens,onChange:e=>{h("maxTokens",Math.min(32768,Math.max(1,Math.round(Array.isArray(e)?e[0]:e))))},disabled:!s.useAdvancedParams})]})]})]})]})]})]});return(0,t.jsxs)("div",{className:"bg-white first:border-l-0 border-l border-gray-200 flex flex-col min-h-0",children:[(0,t.jsxs)("div",{className:"border-b flex items-center justify-between gap-3 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 flex-1",children:[(0,t.jsx)(E,{value:s.model,models:i,loading:o,onChange:e=>a({model:e})}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(D.Z,{content:f,trigger:[],open:c,onOpenChange:()=>{},placement:"bottomRight",destroyTooltipOnHide:!1,children:(0,t.jsx)("button",{onClick:e=>{e.stopPropagation(),v()},className:"p-2 rounded-lg transition-colors ".concat(c?"bg-gray-200 text-gray-700":"hover:bg-gray-100 text-gray-600"),children:(0,t.jsx)(b.Z,{size:18})})})})]}),l&&(0,t.jsx)("button",{onClick:e=>{e.stopPropagation(),n()},className:"p-2 hover:bg-red-50 text-red-600 rounded-lg transition-colors",children:(0,t.jsx)(y.Z,{size:18})})]}),(0,t.jsx)("div",{className:"relative flex-1 flex flex-col min-h-0",children:(0,t.jsx)("div",{className:"flex-1 max-h-[calc(100vh-385px)] overflow-auto rounded-b-2xl",children:(0,t.jsx)(_,{messages:s.messages,isLoading:s.isLoading})})})]})}var F=a(79276);let{TextArea:W}=u.default;function G(e){let{value:s,onChange:a,onSend:r,disabled:n,hasAttachment:l,uploadComponent:i}=e,o=!n&&(s.trim().length>0||!!l);return(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsxs)("div",{className:"flex items-center flex-1 bg-white border border-gray-300 rounded-xl px-3 py-1 min-h-[44px]",children:[i&&(0,t.jsx)("div",{className:"flex-shrink-0 mr-2",children:i}),(0,t.jsx)(W,{value:s,onChange:e=>a(e.target.value),onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),o&&r())},placeholder:"Type your message... (Shift+Enter for new line)",disabled:n,className:"flex-1",autoSize:{minRows:1,maxRows:4},style:{resize:"none",border:"none",boxShadow:"none",background:"transparent",padding:"4px 0",fontSize:"14px",lineHeight:"20px"}}),(0,t.jsx)(h.ZP,{onClick:r,disabled:!o,icon:(0,t.jsx)(F.Z,{}),shape:"circle"})]})})}let V=["Can you summarize the key points?","What assumptions did you make?","What are the next steps?"],H=["Write me a poem","Explain quantum computing","Draft a polite email requesting a meeting"],X="/v1/chat/completions";function Y(e){let{accessToken:s,disabledPersonalKeyCreation:a}=e,[n,y]=(0,r.useState)([{id:"1",model:"",messages:[],isLoading:!1,tags:[],mcpTools:[],vectorStores:[],guardrails:[],temperature:1,maxTokens:2048,applyAcrossModels:!1,useAdvancedParams:!1},{id:"2",model:"",messages:[],isLoading:!1,tags:[],mcpTools:[],vectorStores:[],guardrails:[],temperature:1,maxTokens:2048,applyAcrossModels:!1,useAdvancedParams:!1}]),[b,N]=(0,r.useState)([]),[w,k]=(0,r.useState)(!1),[A,S]=(0,r.useState)(""),[C,T]=(0,r.useState)(null),[L,Z]=(0,r.useState)(null),[P,_]=(0,r.useState)(a?"custom":"session"),[M,E]=(0,r.useState)(""),[U,R]=(0,r.useState)("");(0,r.useEffect)(()=>{let e=setTimeout(()=>{R(M)},300);return()=>clearTimeout(e)},[M]),(0,r.useEffect)(()=>()=>{L&&URL.revokeObjectURL(L)},[L]);let I=(0,r.useMemo)(()=>"session"===P?s||"":U.trim(),[P,s,U]),O=(0,r.useMemo)(()=>n.length>0&&n.every(e=>!e.isLoading&&e.messages.some(e=>"assistant"===e.role)),[n]);(0,r.useEffect)(()=>{let e=!0;return(async()=>{if(!I){N([]);return}k(!0);try{let s=await (0,j.p)(I);if(!e)return;let a=Array.from(new Set(s.map(e=>e.model_group)));N(a)}catch(s){console.error("CompareUI: failed to fetch models",s),e&&N([])}finally{e&&k(!1)}})(),()=>{e=!1}},[I]),(0,r.useEffect)(()=>{0!==b.length&&y(e=>e.map((e,s)=>{var a,t,r,n,l;return{...e,temperature:null!==(a=e.temperature)&&void 0!==a?a:1,maxTokens:null!==(t=e.maxTokens)&&void 0!==t?t:2048,applyAcrossModels:null!==(r=e.applyAcrossModels)&&void 0!==r&&r,useAdvancedParams:null!==(n=e.useAdvancedParams)&&void 0!==n&&n,...e.model?{}:{model:null!==(l=b[s%b.length])&&void 0!==l?l:""}}}))},[b]);let z=e=>{n.length>1&&y(s=>s.filter(s=>s.id!==e))},K=(e,s,a)=>{y(t=>{var r;if((null==a?void 0:a.applyToAll)&&(null===(r=a.keysToApply)||void 0===r?void 0:r.length)){let r={};a.keysToApply.forEach(e=>{let a=s[e];void 0!==a&&(r[e]=Array.isArray(a)?[...a]:a)});let n=Object.keys(r).length>0;return t.map(a=>a.id===e?{...a,...s}:n?{...a,...r}:a)}return t.map(a=>a.id===e?{...a,...s}:a)})},D=()=>{L&&URL.revokeObjectURL(L),T(null),Z(null)},F=(e,s,a)=>{s&&y(t=>t.map(t=>{if(t.id!==e)return t;let r=[...t.messages],n=r[r.length-1];if(n&&"assistant"===n.role){var l;let e="string"==typeof n.content?n.content:"";r[r.length-1]={...n,content:e+s,model:null!==(l=n.model)&&void 0!==l?l:a}}else r.push({role:"assistant",content:s,model:a});return{...t,messages:r}}))},W=(e,s)=>{s&&y(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role?t[t.length-1]={...r,reasoningContent:(r.reasoningContent||"")+s}:r&&"user"===r.role&&t.push({role:"assistant",content:"",reasoningContent:s}),{...a,messages:t}}))},Y=(e,s)=>{y(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role?t[t.length-1]={...r,timeToFirstToken:s}:r&&"user"===r.role&&t.push({role:"assistant",content:"",timeToFirstToken:s}),{...a,messages:t}}))},q=(e,s)=>{y(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role?t[t.length-1]={...r,totalLatency:s}:r&&"user"===r.role&&t.push({role:"assistant",content:"",totalLatency:s}),{...a,messages:t}}))},J=(e,s,a)=>{y(t=>t.map(t=>{if(t.id!==e)return t;let r=[...t.messages],n=r[r.length-1];return n&&"assistant"===n.role&&(r[r.length-1]={...n,usage:s,toolName:a}),{...t,messages:r}}))},$=(e,s)=>{s&&y(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role&&(t[t.length-1]={...r,searchResults:s}),{...a,messages:t}}))},Q=!!s,ee=async e=>{let s=e.trim(),a=!!C;if(!s&&!a)return;if(!I){l.Z.fromBackend("Please provide a Virtual Key or select Current UI Session");return}if(0===n.length)return;if(n.some(e=>!e.model)){l.Z.fromBackend("Select a model before sending a message.");return}let t=a?await (0,v.Sn)(s,C):{role:"user",content:s},r=(0,v.Hk)(s,a,L||void 0,null==C?void 0:C.name),i=new Map;n.forEach(e=>{var s;let a=null!==(s=e.traceId)&&void 0!==s?s:(0,g.Z)(),n=[...e.messages.map(e=>{let{role:s,content:a}=e;return{role:s,content:Array.isArray(a)?a:"string"==typeof a?a:""}}),t];i.set(e.id,{id:e.id,model:e.model,traceId:a,tags:e.tags,vectorStores:e.vectorStores,guardrails:e.guardrails,temperature:e.temperature,maxTokens:e.maxTokens,displayMessages:[...e.messages,r],apiChatHistory:n})}),0!==i.size&&(y(e=>e.map(e=>{let s=i.get(e.id);return s?{...e,traceId:s.traceId,messages:s.displayMessages,isLoading:!0}:e})),S(""),D(),i.forEach(e=>{var s;let a=e.tags.length>0?e.tags:void 0,t=e.vectorStores.length>0?e.vectorStores:void 0,r=e.guardrails.length>0?e.guardrails:void 0,i=n.find(s=>s.id===e.id),o=null!==(s=null==i?void 0:i.useAdvancedParams)&&void 0!==s&&s;(0,f.n)(e.apiChatHistory,(s,a)=>F(e.id,s,a),e.model,I,a,void 0,s=>W(e.id,s),s=>Y(e.id,s),s=>J(e.id,s),e.traceId,t,r,void 0,void 0,s=>$(e.id,s),o?e.temperature:void 0,o?e.maxTokens:void 0,s=>q(e.id,s)).catch(s=>{let a=s instanceof Error?s.message:String(s);console.error("CompareUI: failed to fetch response",s),l.Z.fromBackend(a),y(s=>s.map(s=>{if(s.id!==e.id)return s;let t=[...s.messages],r=t[t.length-1],n=r&&"assistant"===r.role&&"string"==typeof r.content?r.content:"";return r&&"assistant"===r.role?t[t.length-1]={...r,content:n?"".concat(n,"\nError fetching response: ").concat(a):"Error fetching response: ".concat(a)}:t.push({role:"assistant",content:"Error fetching response: ".concat(a)}),{...s,messages:t}}))}).finally(()=>{y(s=>s.map(s=>s.id===e.id?{...s,isLoading:!1}:s))})}))},es=e=>{S(e)},ea=n.some(e=>e.messages.length>0),et=n.some(e=>e.isLoading),er=!!C,en=!!(null==C?void 0:C.name.toLowerCase().endsWith(".pdf")),el=!ea&&!et&&!er;return(0,t.jsx)("div",{className:"w-full h-full p-4 bg-white",children:(0,t.jsxs)("div",{className:"rounded-2xl border border-gray-200 bg-white shadow-sm min-h-[calc(100vh-160px)] flex flex-col",children:[(0,t.jsx)("div",{className:"border-b px-4 py-2",children:(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-600",children:"Virtual Key Source"}),(0,t.jsxs)(m.default,{value:P,onChange:e=>_(e),disabled:a,className:"w-48",children:[(0,t.jsx)(m.default.Option,{value:"session",disabled:!Q,children:"Current UI Session"}),(0,t.jsx)(m.default.Option,{value:"custom",children:"Virtual Key"})]}),"custom"===P&&(0,t.jsx)(u.default.Password,{value:M,onChange:e=>E(e.target.value),placeholder:"Enter Virtual Key",className:"w-56"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-600",children:"Endpoint"}),(0,t.jsx)(x.Z,{title:"Other endpoints will be available soon",children:(0,t.jsx)(m.default,{value:X,disabled:!0,className:"w-56",children:(0,t.jsx)(m.default.Option,{value:X,children:X})})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(h.ZP,{onClick:()=>{y(e=>e.map(e=>({...e,messages:[],traceId:void 0,isLoading:!1}))),S(""),D()},disabled:!ea,icon:(0,t.jsx)(i.Z,{}),children:"Clear All Chats"}),(0,t.jsx)(x.Z,{title:n.length>=3?"Compare up to 3 models at a time":"Add another comparison",children:(0,t.jsx)(h.ZP,{onClick:()=>{var e;if(n.length>=3)return;let s=null!==(e=b[n.length%(b.length||1)])&&void 0!==e?e:"",a={id:Date.now().toString(),model:s,messages:[],isLoading:!1,tags:[],mcpTools:[],vectorStores:[],guardrails:[],temperature:1,maxTokens:2048,applyAcrossModels:!1,useAdvancedParams:!1};y(e=>[...e,a])},disabled:n.length>=3,icon:(0,t.jsx)(o.Z,{}),children:"Add Comparison"})})]})]})}),(0,t.jsx)("div",{className:"grid flex-1 min-h-0 auto-rows-[minmax(0,1fr)]",style:{gridTemplateColumns:"repeat(".concat(n.length,", minmax(0, 1fr))")},children:n.map(e=>(0,t.jsx)(B,{comparison:e,onUpdate:(s,a)=>K(e.id,s,a),onRemove:()=>z(e.id),canRemove:n.length>1,modelOptions:b,isLoadingModels:w,apiKey:I},e.id))}),(0,t.jsx)("div",{className:"flex justify-center pb-4",children:(0,t.jsx)("div",{className:"w-full max-w-3xl px-4",children:(0,t.jsxs)("div",{className:"border border-gray-200 shadow-lg rounded-xl bg-white p-4",children:[(0,t.jsx)("div",{className:"flex items-center justify-between gap-4 mb-3 min-h-8",children:er?(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"Attachment ready to send"}):el?(0,t.jsx)("div",{className:"flex items-center gap-2 overflow-x-auto",children:H.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>es(e),className:"shrink-0 rounded-full border border-gray-200 px-3 py-1 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 cursor-pointer",children:e},e))}):O&&!er?(0,t.jsx)("div",{className:"flex items-center gap-2 overflow-x-auto",children:V.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>es(e),className:"shrink-0 rounded-full border border-gray-200 px-3 py-1 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 cursor-pointer",children:e},e))}):et?(0,t.jsxs)("span",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,t.jsx)("span",{className:"h-2 w-2 rounded-full bg-blue-500 animate-pulse","aria-hidden":!0}),"Gathering responses from all models..."]}):(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"Send a prompt to compare models"})}),C&&(0,t.jsx)("div",{className:"mb-3",children:(0,t.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,t.jsx)("div",{className:"relative inline-block",children:en?(0,t.jsx)("div",{className:"w-10 h-10 rounded-md bg-red-500 flex items-center justify-center",children:(0,t.jsx)(d.Z,{style:{fontSize:"16px",color:"white"}})}):(0,t.jsx)("img",{src:L||"",alt:"Upload preview",className:"w-10 h-10 rounded-md border border-gray-200 object-cover"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:C.name}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:en?"PDF":"Image"})]}),(0,t.jsx)("button",{className:"flex items-center justify-center w-6 h-6 text-gray-400 hover:text-gray-600 hover:bg-gray-200 rounded-full transition-colors",onClick:D,children:(0,t.jsx)(c.Z,{style:{fontSize:"12px"}})})]})}),(0,t.jsx)(G,{value:A,onChange:e=>{S(e)},onSend:()=>{ee(A)},disabled:0===n.length||n.every(e=>e.isLoading),hasAttachment:er,uploadComponent:(0,t.jsx)(p.Z,{chatUploadedImage:C,chatImagePreviewUrl:L,onImageUpload:e=>(L&&URL.revokeObjectURL(L),T(e),Z(URL.createObjectURL(e)),!1),onRemoveImage:D})})]})})})]})})}var q=a(58643),J=a(80443),$=a(91624);function Q(){let{accessToken:e,userRole:s,userId:a,disabledPersonalKeyCreation:l,token:i}=(0,J.Z)(),[o,d]=(0,r.useState)(void 0);return(0,r.useEffect)(()=>{(async()=>{if(e){let s=await (0,$.C)(e);s&&d({PROXY_BASE_URL:s.PROXY_BASE_URL,LITELLM_UI_API_DOC_BASE_URL:s.LITELLM_UI_API_DOC_BASE_URL})}})()},[e]),(0,t.jsxs)(q.v0,{className:"h-full w-full",children:[(0,t.jsxs)(q.td,{className:"mb-0",children:[(0,t.jsx)(q.OK,{children:"Chat"}),(0,t.jsx)(q.OK,{children:"Compare"})]}),(0,t.jsxs)(q.nP,{className:"h-full",children:[(0,t.jsx)(q.x4,{className:"h-full",children:(0,t.jsx)(n.Z,{accessToken:e,token:i,userRole:s,userID:a,disabledPersonalKeyCreation:l,proxySettings:o})}),(0,t.jsx)(q.x4,{className:"h-full",children:(0,t.jsx)(Y,{accessToken:e,disabledPersonalKeyCreation:l})})]})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1518-af5eabc2040f5a96.js b/litellm/proxy/_experimental/out/_next/static/chunks/1518-af5eabc2040f5a96.js deleted file mode 100644 index 1a82a757ee..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1518-af5eabc2040f5a96.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1518],{81518:function(e,s,a){a.r(s),a.d(s,{default:function(){return Y}});var t=a(57437),r=a(2265),n=a(39566),l=a(93837),i=a(37592),o=a(4260),d=a(99981),c=a(5545),m=a(26430),u=a(96473),x=a(9114),h=a(10703),p=a(95459),g=a(32489),f=a(98728),v=a(62831),j=a(17906),y=a(57365),b=a(79862),N=a(82222),k=a(51817),w=a(94331),A=a(38398),S=a(33152);function C(e){let{messages:s,isLoading:a}=e;if(0===s.length)return(0,t.jsx)("div",{className:"h-full"});let r=[],n=0;for(;n(0,t.jsx)("div",{className:"whitespace-pre-wrap break-words",style:{wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",hyphens:"auto"},children:(0,t.jsx)(v.UG,{components:{code(e){let{node:s,inline:a,className:r,children:n,...l}=e,i=/language-(\w+)/.exec(r||"");return!a&&i?(0,t.jsx)(j.Z,{style:y.Z,language:i[1],PreTag:"div",className:"rounded-md my-2",wrapLines:!0,wrapLongLines:!0,...l,children:String(n).replace(/\n$/,"")}):(0,t.jsx)("code",{className:"".concat(r," px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono"),...l,children:n})},pre:e=>{let{node:s,...a}=e;return(0,t.jsx)("pre",{style:{overflowX:"auto",maxWidth:"100%"},...a})}},children:"string"==typeof e.content?e.content:""})});return(0,t.jsxs)("div",{className:"flex flex-col gap-6 min-w-0 w-full p-4",children:[r.map((e,s)=>{let n=e.assistant,i=(null==n?void 0:n.model)||"Assistant";return(0,t.jsxs)("div",{className:"space-y-4",children:[e.user&&(0,t.jsxs)("div",{className:"space-y-2 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-blue-100 text-blue-600",children:(0,t.jsx)(b.Z,{size:16})}),(0,t.jsx)("div",{className:"text-sm font-semibold text-gray-700",children:"You"})]}),l(e.user)]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),n?(0,t.jsxs)("div",{className:"space-y-3 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-gray-100 text-gray-600",children:(0,t.jsx)(N.Z,{size:16})}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-semibold text-gray-700",children:i}),n.toolName&&(0,t.jsx)("span",{className:"rounded bg-gray-100 px-2 py-0.5 text-xs text-gray-600",children:n.toolName})]})]}),n.reasoningContent&&(0,t.jsx)(w.Z,{reasoningContent:n.reasoningContent}),n.searchResults&&(0,t.jsx)(S.J,{searchResults:n.searchResults}),l(n),(n.timeToFirstToken||n.totalLatency||n.usage)&&(0,t.jsx)(A.Z,{timeToFirstToken:n.timeToFirstToken,totalLatency:n.totalLatency,usage:n.usage,toolName:n.toolName})]}):a&&s===r.length-1?(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,t.jsx)(k.Z,{size:18,className:"animate-spin"}),(0,t.jsx)("span",{children:"Generating response..."})]}):(0,t.jsx)("div",{className:"text-sm text-gray-500",children:"Waiting for a response..."})]},s)}),a&&0===r.length&&(0,t.jsxs)("div",{className:"flex items-center gap-2 text-gray-500",children:[(0,t.jsx)(k.Z,{size:18,className:"animate-spin"}),(0,t.jsx)("span",{children:"Generating response..."})]})]})}var T=a(31283);function Z(e){let{value:s,onChange:a,models:n,loading:l,disabled:o}=e,[d,c]=(0,r.useState)(!1),[m,u]=(0,r.useState)(""),x=(0,r.useMemo)(()=>Array.from(new Set(n)).sort(),[n]),h=(0,r.useMemo)(()=>s&&!x.includes(s)?[s,...x]:x,[x,s]),p=d?"__custom__":s||void 0,g=()=>{let e=m.trim();if(!e){c(!1),u("");return}a(e),c(!1),u("")};return(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)(i.default,{value:p,onChange:e=>{if("__custom__"===e){c(!0),s&&!x.includes(s)?u(s):u("");return}c(!1),u(""),a(e)},disabled:o,loading:l,placeholder:l?"Loading models...":"Select a model",className:"w-full rounded-md",showSearch:!0,optionFilterProp:"children",children:[h.map(e=>(0,t.jsx)(i.default.Option,{value:e,children:e},e)),(0,t.jsx)(i.default.Option,{value:"__custom__",children:"+ Add custom model"})]}),d&&(0,t.jsx)(T.o,{className:"mt-2",placeholder:"Custom Model Name (Enter to add)",value:m,onValueChange:u,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),g())},onBlur:g,autoFocus:!0})]})}var P=a(99020),_=a(97415),L=a(67479),E=a(61994),M=a(23496),I=a(85847),O=a(79326);function R(e){let{comparison:s,onUpdate:a,onRemove:n,canRemove:l,modelOptions:i,isLoadingModels:o,apiKey:d}=e,[c,m]=(0,r.useState)(!1),u=e=>{e?a({applyAcrossModels:!0,temperature:s.temperature,maxTokens:s.maxTokens,tags:[...s.tags],vectorStores:[...s.vectorStores],guardrails:[...s.guardrails],useAdvancedParams:s.useAdvancedParams},{applyToAll:!0,keysToApply:["temperature","maxTokens","tags","vectorStores","guardrails","useAdvancedParams"]}):a({applyAcrossModels:!1})},x=e=>{a({useAdvancedParams:e},s.applyAcrossModels?{applyToAll:!0,keysToApply:["useAdvancedParams"]}:void 0)},h=(e,t)=>{a({[e]:t},s.applyAcrossModels?{applyToAll:!0,keysToApply:[e]}:void 0)},p=s.useAdvancedParams?1:.4,v=s.useAdvancedParams?"text-gray-700":"text-gray-400",j=()=>{m(e=>!e)},y=(0,t.jsxs)("div",{className:"w-[300px] max-h-[65vh] overflow-y-auto relative",children:[(0,t.jsx)("button",{onClick:()=>{m(!1)},className:"absolute top-0 right-0 p-1 hover:bg-gray-100 rounded transition-colors text-gray-500 hover:text-gray-700 z-10",children:(0,t.jsx)(g.Z,{size:14})}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(E.Z,{checked:s.applyAcrossModels,onChange:e=>u(e.target.checked),children:(0,t.jsx)("span",{className:"text-xs font-medium",children:"Sync Settings Across Models"})})}),(0,t.jsx)(M.Z,{className:"border-gray-200"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-xs font-semibold text-gray-700 mb-1.5 uppercase tracking-wide",children:"General Settings"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-600 block mb-0.5",children:"Tags"}),(0,t.jsx)(P.Z,{value:s.tags,onChange:e=>h("tags",e),accessToken:d})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-600 block mb-0.5",children:"Vector Stores"}),(0,t.jsx)(_.Z,{value:s.vectorStores,onChange:e=>h("vectorStores",e),accessToken:d})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-600 block mb-0.5",children:"Guardrails"}),(0,t.jsx)(L.Z,{value:s.guardrails,onChange:e=>h("guardrails",e),accessToken:d})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-xs font-semibold text-gray-700 mb-1.5 uppercase tracking-wide",children:"Advanced Settings"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex items-center gap-2 pb-1",children:(0,t.jsx)(E.Z,{checked:s.useAdvancedParams,onChange:e=>x(e.target.checked),children:(0,t.jsx)("span",{className:"text-sm font-medium",children:"Use Advanced Parameters"})})}),(0,t.jsxs)("div",{className:"space-y-2 transition-opacity duration-200",style:{opacity:p},children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium ".concat(v),children:"Temperature"}),(0,t.jsx)("span",{className:"text-xs ".concat(v),children:s.temperature.toFixed(2)})]}),(0,t.jsx)(I.Z,{min:0,max:2,step:.01,value:s.temperature,onChange:e=>{h("temperature",Math.min(2,Math.max(0,Number((Array.isArray(e)?e[0]:e).toFixed(2)))))},disabled:!s.useAdvancedParams})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium ".concat(v),children:"Max Tokens"}),(0,t.jsx)("span",{className:"text-xs ".concat(v),children:s.maxTokens})]}),(0,t.jsx)(I.Z,{min:1,max:32768,step:1,value:s.maxTokens,onChange:e=>{h("maxTokens",Math.min(32768,Math.max(1,Math.round(Array.isArray(e)?e[0]:e))))},disabled:!s.useAdvancedParams})]})]})]})]})]})]});return(0,t.jsxs)("div",{className:"bg-white first:border-l-0 border-l border-gray-200 flex flex-col min-h-0",children:[(0,t.jsxs)("div",{className:"border-b flex items-center justify-between gap-3 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 flex-1",children:[(0,t.jsx)(Z,{value:s.model,models:i,loading:o,onChange:e=>a({model:e})}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(O.Z,{content:y,trigger:[],open:c,onOpenChange:()=>{},placement:"bottomRight",destroyTooltipOnHide:!1,children:(0,t.jsx)("button",{onClick:e=>{e.stopPropagation(),j()},className:"p-2 rounded-lg transition-colors ".concat(c?"bg-gray-200 text-gray-700":"hover:bg-gray-100 text-gray-600"),children:(0,t.jsx)(f.Z,{size:18})})})})]}),l&&(0,t.jsx)("button",{onClick:e=>{e.stopPropagation(),n()},className:"p-2 hover:bg-red-50 text-red-600 rounded-lg transition-colors",children:(0,t.jsx)(g.Z,{size:18})})]}),(0,t.jsx)("div",{className:"relative flex-1 flex flex-col min-h-0",children:(0,t.jsx)("div",{className:"flex-1 max-h-[calc(100vh-385px)] overflow-auto rounded-b-2xl",children:(0,t.jsx)(C,{messages:s.messages,isLoading:s.isLoading})})})]})}var z=a(79276);let{TextArea:U}=o.default;function K(e){let{value:s,onChange:a,onSend:r,disabled:n}=e;return(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsxs)("div",{className:"flex items-center flex-1 bg-white border border-gray-300 rounded-xl px-3 py-1 min-h-[44px]",children:[(0,t.jsx)(U,{value:s,onChange:e=>a(e.target.value),onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),!n&&s.trim()&&r())},placeholder:"Type your message... (Shift+Enter for new line)",disabled:n,className:"flex-1",autoSize:{minRows:1,maxRows:4},style:{resize:"none",border:"none",boxShadow:"none",background:"transparent",padding:"4px 0",fontSize:"14px",lineHeight:"20px"}}),(0,t.jsx)(c.ZP,{onClick:r,disabled:n||!s.trim(),icon:(0,t.jsx)(z.Z,{}),shape:"circle"})]})})}let B=["Can you summarize the key points?","What assumptions did you make?","What are the next steps?"],D=["Write me a poem","Explain quantum computing","Draft a polite email requesting a meeting"],F="/v1/chat/completions";function W(e){let{accessToken:s,disabledPersonalKeyCreation:a}=e,[n,g]=(0,r.useState)([{id:"1",model:"",messages:[],isLoading:!1,tags:[],mcpTools:[],vectorStores:[],guardrails:[],temperature:1,maxTokens:2048,applyAcrossModels:!1,useAdvancedParams:!1},{id:"2",model:"",messages:[],isLoading:!1,tags:[],mcpTools:[],vectorStores:[],guardrails:[],temperature:1,maxTokens:2048,applyAcrossModels:!1,useAdvancedParams:!1}]),[f,v]=(0,r.useState)([]),[j,y]=(0,r.useState)(!1),[b,N]=(0,r.useState)(""),[k,w]=(0,r.useState)(a?"custom":"session"),[A,S]=(0,r.useState)(""),[C,T]=(0,r.useState)("");(0,r.useEffect)(()=>{let e=setTimeout(()=>{T(A)},300);return()=>clearTimeout(e)},[A]);let Z=(0,r.useMemo)(()=>"session"===k?s||"":C.trim(),[k,s,C]),P=(0,r.useMemo)(()=>n.length>0&&n.every(e=>!e.isLoading&&e.messages.some(e=>"assistant"===e.role)),[n]);(0,r.useEffect)(()=>{let e=!0;return(async()=>{if(!Z){v([]);return}y(!0);try{let s=await (0,h.p)(Z);if(!e)return;let a=Array.from(new Set(s.map(e=>e.model_group)));v(a)}catch(s){console.error("CompareUI: failed to fetch models",s),e&&v([])}finally{e&&y(!1)}})(),()=>{e=!1}},[Z]),(0,r.useEffect)(()=>{0!==f.length&&g(e=>e.map((e,s)=>{var a,t,r,n,l;return{...e,temperature:null!==(a=e.temperature)&&void 0!==a?a:1,maxTokens:null!==(t=e.maxTokens)&&void 0!==t?t:2048,applyAcrossModels:null!==(r=e.applyAcrossModels)&&void 0!==r&&r,useAdvancedParams:null!==(n=e.useAdvancedParams)&&void 0!==n&&n,...e.model?{}:{model:null!==(l=f[s%f.length])&&void 0!==l?l:""}}}))},[f]);let _=e=>{n.length>1&&g(s=>s.filter(s=>s.id!==e))},L=(e,s,a)=>{g(t=>{var r;if((null==a?void 0:a.applyToAll)&&(null===(r=a.keysToApply)||void 0===r?void 0:r.length)){let r={};a.keysToApply.forEach(e=>{let a=s[e];void 0!==a&&(r[e]=Array.isArray(a)?[...a]:a)});let n=Object.keys(r).length>0;return t.map(a=>a.id===e?{...a,...s}:n?{...a,...r}:a)}return t.map(a=>a.id===e?{...a,...s}:a)})},E=(e,s,a)=>{s&&g(t=>t.map(t=>{if(t.id!==e)return t;let r=[...t.messages],n=r[r.length-1];if(n&&"assistant"===n.role){var l;let e="string"==typeof n.content?n.content:"";r[r.length-1]={...n,content:e+s,model:null!==(l=n.model)&&void 0!==l?l:a}}else r.push({role:"assistant",content:s,model:a});return{...t,messages:r}}))},M=(e,s)=>{s&&g(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role?t[t.length-1]={...r,reasoningContent:(r.reasoningContent||"")+s}:r&&"user"===r.role&&t.push({role:"assistant",content:"",reasoningContent:s}),{...a,messages:t}}))},I=(e,s)=>{g(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role?t[t.length-1]={...r,timeToFirstToken:s}:r&&"user"===r.role&&t.push({role:"assistant",content:"",timeToFirstToken:s}),{...a,messages:t}}))},O=(e,s)=>{g(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role?t[t.length-1]={...r,totalLatency:s}:r&&"user"===r.role&&t.push({role:"assistant",content:"",totalLatency:s}),{...a,messages:t}}))},z=(e,s,a)=>{g(t=>t.map(t=>{if(t.id!==e)return t;let r=[...t.messages],n=r[r.length-1];return n&&"assistant"===n.role&&(r[r.length-1]={...n,usage:s,toolName:a}),{...t,messages:r}}))},U=(e,s)=>{s&&g(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role&&(t[t.length-1]={...r,searchResults:s}),{...a,messages:t}}))},W=!!s,G=e=>{let s=e.trim();if(!s)return;if(!Z){x.Z.fromBackend("Please provide a Virtual Key or select Current UI Session");return}if(0===n.length)return;if(n.some(e=>!e.model)){x.Z.fromBackend("Select a model before sending a message.");return}let a=new Map;n.forEach(e=>{var t;let r=null!==(t=e.traceId)&&void 0!==t?t:(0,l.Z)();a.set(e.id,{id:e.id,model:e.model,traceId:r,tags:e.tags,vectorStores:e.vectorStores,guardrails:e.guardrails,temperature:e.temperature,maxTokens:e.maxTokens,messages:[...e.messages,{role:"user",content:s}]})}),0!==a.size&&(g(e=>e.map(e=>{let s=a.get(e.id);return s?{...e,traceId:s.traceId,messages:s.messages,isLoading:!0}:e})),a.forEach(e=>{var s;let a=e.messages.map(e=>{let{role:s,content:a}=e;return{role:s,content:"string"==typeof a?a:""}}),t=e.tags.length>0?e.tags:void 0,r=e.vectorStores.length>0?e.vectorStores:void 0,l=e.guardrails.length>0?e.guardrails:void 0,i=n.find(s=>s.id===e.id),o=null!==(s=null==i?void 0:i.useAdvancedParams)&&void 0!==s&&s;(0,p.n)(a,(s,a)=>E(e.id,s,a),e.model,Z,t,void 0,s=>M(e.id,s),s=>I(e.id,s),s=>z(e.id,s),e.traceId,r,l,void 0,void 0,s=>U(e.id,s),o?e.temperature:void 0,o?e.maxTokens:void 0,s=>O(e.id,s)).catch(s=>{let a=s instanceof Error?s.message:String(s);console.error("CompareUI: failed to fetch response",s),x.Z.fromBackend(a),g(s=>s.map(s=>{if(s.id!==e.id)return s;let t=[...s.messages],r=t[t.length-1],n=r&&"assistant"===r.role&&"string"==typeof r.content?r.content:"";return r&&"assistant"===r.role?t[t.length-1]={...r,content:n?"".concat(n,"\nError fetching response: ").concat(a):"Error fetching response: ".concat(a)}:t.push({role:"assistant",content:"Error fetching response: ".concat(a)}),{...s,messages:t}}))}).finally(()=>{g(s=>s.map(s=>s.id===e.id?{...s,isLoading:!1}:s))})}))},V=e=>{N(e)},X=n.some(e=>e.messages.length>0),Y=n.some(e=>e.isLoading);return(0,t.jsx)("div",{className:"w-full h-full p-4 bg-white",children:(0,t.jsxs)("div",{className:"rounded-2xl border border-gray-200 bg-white shadow-sm min-h-[calc(100vh-140px)] flex flex-col",children:[(0,t.jsx)("div",{className:"border-b px-4 py-2",children:(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-600",children:"Virtual Key Source"}),(0,t.jsxs)(i.default,{value:k,onChange:e=>w(e),disabled:a,className:"w-48",children:[(0,t.jsx)(i.default.Option,{value:"session",disabled:!W,children:"Current UI Session"}),(0,t.jsx)(i.default.Option,{value:"custom",children:"Virtual Key"})]}),"custom"===k&&(0,t.jsx)(o.default.Password,{value:A,onChange:e=>S(e.target.value),placeholder:"Enter Virtual Key",className:"w-56"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-600",children:"Endpoint"}),(0,t.jsx)(d.Z,{title:"Other endpoints will be available soon",children:(0,t.jsx)(i.default,{value:F,disabled:!0,className:"w-56",children:(0,t.jsx)(i.default.Option,{value:F,children:F})})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(c.ZP,{onClick:()=>{g(e=>e.map(e=>({...e,messages:[],traceId:void 0,isLoading:!1}))),N("")},disabled:!X,icon:(0,t.jsx)(m.Z,{}),children:"Clear All Chats"}),(0,t.jsx)(d.Z,{title:n.length>=3?"Compare up to 3 models at a time":"Add another comparison",children:(0,t.jsx)(c.ZP,{onClick:()=>{var e;if(n.length>=3)return;let s=null!==(e=f[n.length%(f.length||1)])&&void 0!==e?e:"",a={id:Date.now().toString(),model:s,messages:[],isLoading:!1,tags:[],mcpTools:[],vectorStores:[],guardrails:[],temperature:1,maxTokens:2048,applyAcrossModels:!1,useAdvancedParams:!1};g(e=>[...e,a])},disabled:n.length>=3,icon:(0,t.jsx)(u.Z,{}),children:"Add Comparison"})})]})]})}),(0,t.jsx)("div",{className:"grid flex-1 min-h-0 auto-rows-[minmax(0,1fr)]",style:{gridTemplateColumns:"repeat(".concat(n.length,", minmax(0, 1fr))")},children:n.map(e=>(0,t.jsx)(R,{comparison:e,onUpdate:(s,a)=>L(e.id,s,a),onRemove:()=>_(e.id),canRemove:n.length>1,modelOptions:f,isLoadingModels:j,apiKey:Z},e.id))}),(0,t.jsx)("div",{className:"flex justify-center pb-4",children:(0,t.jsx)("div",{className:"w-full max-w-3xl px-4",children:(0,t.jsxs)("div",{className:"border border-gray-200 shadow-lg rounded-xl bg-white p-4",children:[(0,t.jsx)("div",{className:"flex items-center justify-between gap-4 mb-3 min-h-8",children:X||Y?P?(0,t.jsx)("div",{className:"flex items-center gap-2 overflow-x-auto",children:B.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>V(e),className:"shrink-0 rounded-full border border-gray-200 px-3 py-1 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 cursor-pointer",children:e},e))}):Y?(0,t.jsxs)("span",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,t.jsx)("span",{className:"h-2 w-2 rounded-full bg-blue-500 animate-pulse","aria-hidden":!0}),"Gathering responses from all models..."]}):(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"Send a prompt to compare models"}):(0,t.jsx)("div",{className:"flex items-center gap-2 overflow-x-auto",children:D.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>V(e),className:"shrink-0 rounded-full border border-gray-200 px-3 py-1 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 cursor-pointer",children:e},e))})}),(0,t.jsx)(K,{value:b,onChange:e=>{N(e)},onSend:()=>{G(b),N("")},disabled:0===n.length||n.every(e=>e.isLoading)})]})})})]})})}var G=a(58643),V=a(39760),X=a(91624);function Y(){let{accessToken:e,userRole:s,userId:a,disabledPersonalKeyCreation:l,token:i}=(0,V.Z)(),[o,d]=(0,r.useState)(void 0);return(0,r.useEffect)(()=>{(async()=>{if(e){let s=await (0,X.C)(e);s&&d({PROXY_BASE_URL:s.PROXY_BASE_URL,LITELLM_UI_API_DOC_BASE_URL:s.LITELLM_UI_API_DOC_BASE_URL})}})()},[e]),(0,t.jsxs)(G.v0,{className:"h-full w-full",children:[(0,t.jsxs)(G.td,{className:"mb-0",children:[(0,t.jsx)(G.OK,{children:"Chat"}),(0,t.jsx)(G.OK,{children:"Compare"})]}),(0,t.jsxs)(G.nP,{className:"h-full",children:[(0,t.jsx)(G.x4,{className:"h-full",children:(0,t.jsx)(n.Z,{accessToken:e,token:i,userRole:s,userID:a,disabledPersonalKeyCreation:l,proxySettings:o})}),(0,t.jsx)(G.x4,{className:"h-full",children:(0,t.jsx)(W,{accessToken:e,disabledPersonalKeyCreation:l})})]})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1739-1616f1e28b151332.js b/litellm/proxy/_experimental/out/_next/static/chunks/1739-a97d403afe23a96f.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/1739-1616f1e28b151332.js rename to litellm/proxy/_experimental/out/_next/static/chunks/1739-a97d403afe23a96f.js index 0a8b97880d..68196561bb 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1739-1616f1e28b151332.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1739-a97d403afe23a96f.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1739],{25512:function(e,t,l){l.d(t,{P:function(){return s.Z},Q:function(){return a.Z}});var s=l(27281),a=l(43227)},12011:function(e,t,l){l.r(t),l.d(t,{default:function(){return w}});var s=l(57437),a=l(2265),r=l(99376),n=l(78489),i=l(94789),o=l(12514),c=l(49804),d=l(67101),u=l(84264),m=l(49566),g=l(96761),x=l(84566),h=l(19250),y=l(14474),f=l(10032),p=l(5545),j=l(3914);function w(){let[e]=f.Z.useForm(),t=(0,r.useSearchParams)();(0,j.e)("token");let l=t.get("invitation_id"),w=t.get("action"),[b,v]=(0,a.useState)(null),[k,S]=(0,a.useState)(""),[_,N]=(0,a.useState)(""),[C,D]=(0,a.useState)(null),[I,Z]=(0,a.useState)(""),[K,E]=(0,a.useState)(""),[A,T]=(0,a.useState)(!0);return(0,a.useEffect)(()=>{(0,h.getUiConfig)().then(e=>{console.log("ui config in onboarding.tsx:",e),T(!1)})},[]),(0,a.useEffect)(()=>{l&&!A&&(0,h.getOnboardingCredentials)(l).then(e=>{let t=e.login_url;console.log("login_url:",t),Z(t);let l=e.token,s=(0,y.o)(l);E(l),console.log("decoded:",s),v(s.key),console.log("decoded user email:",s.user_email),N(s.user_email),D(s.user_id)})},[l,A]),(0,s.jsx)("div",{className:"mx-auto w-full max-w-md mt-10",children:(0,s.jsxs)(o.Z,{children:[(0,s.jsx)(g.Z,{className:"text-sm mb-5 text-center",children:"\uD83D\uDE85 LiteLLM"}),(0,s.jsx)(g.Z,{className:"text-xl",children:"reset_password"===w?"Reset Password":"Sign up"}),(0,s.jsx)(u.Z,{children:"reset_password"===w?"Reset your password to access Admin UI.":"Claim your user account to login to Admin UI."}),"reset_password"!==w&&(0,s.jsx)(i.Z,{className:"mt-4",title:"SSO",icon:x.GH$,color:"sky",children:(0,s.jsxs)(d.Z,{numItems:2,className:"flex justify-between items-center",children:[(0,s.jsx)(c.Z,{children:"SSO is under the Enterprise Tier."}),(0,s.jsx)(c.Z,{children:(0,s.jsx)(n.Z,{variant:"primary",className:"mb-2",children:(0,s.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})})})]})}),(0,s.jsxs)(f.Z,{className:"mt-10 mb-5 mx-auto",layout:"vertical",onFinish:e=>{console.log("in handle submit. accessToken:",b,"token:",K,"formValues:",e),b&&K&&(e.user_email=_,C&&l&&(0,h.claimOnboardingToken)(b,l,C,e.password).then(e=>{document.cookie="token="+K;let t=(0,h.getProxyBaseUrl)();console.log("proxyBaseUrl:",t);let l=t?"".concat(t,"/ui/?login=success"):"/ui/?login=success";console.log("redirecting to:",l),window.location.href=l}))},children:[(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.Z.Item,{label:"Email Address",name:"user_email",children:(0,s.jsx)(m.Z,{type:"email",disabled:!0,value:_,defaultValue:_,className:"max-w-md"})}),(0,s.jsx)(f.Z.Item,{label:"Password",name:"password",rules:[{required:!0,message:"password required to sign up"}],help:"reset_password"===w?"Enter your new password":"Create a password for your account",children:(0,s.jsx)(m.Z,{placeholder:"",type:"password",className:"max-w-md"})})]}),(0,s.jsx)("div",{className:"mt-10",children:(0,s.jsx)(p.ZP,{htmlType:"submit",children:"reset_password"===w?"Reset Password":"Sign Up"})})]})]})})}},39210:function(e,t,l){l.d(t,{Z:function(){return a}});var s=l(19250);let a=async(e,t,l,a,r)=>{let n;n="Admin"!=l&&"Admin Viewer"!=l?await (0,s.teamListCall)(e,(null==a?void 0:a.organization_id)||null,t):await (0,s.teamListCall)(e,(null==a?void 0:a.organization_id)||null),console.log("givenTeams: ".concat(n)),r(n)}},49924:function(e,t,l){var s=l(2265),a=l(19250);t.Z=e=>{let{selectedTeam:t,currentOrg:l,selectedKeyAlias:r,accessToken:n,createClicked:i}=e,[o,c]=(0,s.useState)({keys:[],total_count:0,current_page:1,total_pages:0}),[d,u]=(0,s.useState)(!0),[m,g]=(0,s.useState)(null),x=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(console.log("calling fetchKeys"),!n){console.log("accessToken",n);return}u(!0);let t="number"==typeof e.page?e.page:1,l="number"==typeof e.pageSize?e.pageSize:100,s=await (0,a.keyListCall)(n,null,null,null,null,null,t,l);console.log("data",s),c(s),g(null)}catch(e){g(e instanceof Error?e:Error("An error occurred"))}finally{u(!1)}};return(0,s.useEffect)(()=>{x(),console.log("selectedTeam",t,"currentOrg",l,"accessToken",n,"selectedKeyAlias",r)},[t,l,n,r,i]),{keys:o.keys,isLoading:d,error:m,pagination:{currentPage:o.current_page,totalPages:o.total_pages,totalCount:o.total_count},refresh:x,setKeys:e=>{c(t=>{let l="function"==typeof e?e(t.keys):e;return{...t,keys:l}})}}}},21739:function(e,t,l){l.d(t,{Z:function(){return B}});var s=l(57437),a=l(2265),r=l(19250),n=l(39210),i=l(49804),o=l(67101),c=l(30874),d=l(92668),u=l(16721),m=l(46468),g=l(10032),x=l(22116),h=l(19015),y=l(29233),f=l(49924);l(25512);var p=l(16312),j=l(94292),w=l(99981),b=l(23048),v=l(11713),k=l(30841),S=l(7310),_=l.n(S),N=l(12363),C=l(59872),D=l(71594),I=l(24525),Z=l(10178),K=l(86462),E=l(47686),A=l(44633),T=l(49084),O=l(40728);function L(e){let{keys:t,setKeys:l,isLoading:n=!1,pagination:i,onPageChange:o,pageSize:c=50,teams:d,selectedTeam:u,setSelectedTeam:g,selectedKeyAlias:x,setSelectedKeyAlias:h,accessToken:y,userID:f,userRole:S,organizations:L,setCurrentOrg:U,refresh:z,onSortChange:V,currentSort:P,premiumUser:R,setAccessToken:F}=e,[M,B]=(0,a.useState)(null),[J,W]=(0,a.useState)([]),[H,q]=a.useState(()=>P?[{id:P.sortBy,desc:"desc"===P.sortOrder}]:[{id:"created_at",desc:!0}]),[G,X]=(0,a.useState)({}),{filters:$,filteredKeys:Q,allKeyAliases:Y,allTeams:ee,allOrganizations:et,handleFilterChange:el,handleFilterReset:es}=function(e){let{keys:t,teams:l,organizations:s,accessToken:n}=e,i={"Team ID":"","Organization ID":"","Key Alias":"","User ID":"","Sort By":"created_at","Sort Order":"desc"},[o,c]=(0,a.useState)(i),[d,u]=(0,a.useState)(l||[]),[m,g]=(0,a.useState)(s||[]),[x,h]=(0,a.useState)(t),y=(0,a.useRef)(0),f=(0,a.useCallback)(_()(async e=>{if(!n)return;let t=Date.now();y.current=t;try{let l=await (0,r.keyListCall)(n,e["Organization ID"]||null,e["Team ID"]||null,e["Key Alias"]||null,e["User ID"]||null,e["Key Hash"]||null,1,N.d,e["Sort By"]||null,e["Sort Order"]||null);t===y.current&&l&&(h(l.keys),console.log("called from debouncedSearch filters:",JSON.stringify(e)),console.log("called from debouncedSearch data:",JSON.stringify(l)))}catch(e){console.error("Error searching users:",e)}},300),[n]);(0,a.useEffect)(()=>{if(!t){h([]);return}let e=[...t];o["Team ID"]&&(e=e.filter(e=>e.team_id===o["Team ID"])),o["Organization ID"]&&(e=e.filter(e=>e.organization_id===o["Organization ID"])),h(e)},[t,o]),(0,a.useEffect)(()=>{let e=async()=>{let e=await (0,k.IE)(n);e.length>0&&u(e);let t=await (0,k.cT)(n);t.length>0&&g(t)};n&&e()},[n]);let p=(0,v.a)({queryKey:["allKeys"],queryFn:async()=>{if(!n)throw Error("Access token required");return await (0,k.LO)(n)},enabled:!!n}).data||[];return(0,a.useEffect)(()=>{l&&l.length>0&&u(e=>e.length{s&&s.length>0&&g(e=>e.length{c({"Team ID":e["Team ID"]||"","Organization ID":e["Organization ID"]||"","Key Alias":e["Key Alias"]||"","User ID":e["User ID"]||"","Sort By":e["Sort By"]||"created_at","Sort Order":e["Sort Order"]||"desc"}),f({...o,...e})},handleFilterReset:()=>{c(i),f(i)}}}({keys:t,teams:d,organizations:L,accessToken:y});(0,a.useEffect)(()=>{if(y){let e=t.map(e=>e.user_id).filter(e=>null!==e);(async()=>{W((await (0,r.userListCall)(y,e,1,100)).users)})()}},[y,t]),(0,a.useEffect)(()=>{if(z){let e=()=>{z()};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}}},[z]);let ea=[{id:"expander",header:()=>null,cell:e=>{let{row:t}=e;return t.getCanExpand()?(0,s.jsx)("button",{onClick:t.getToggleExpandedHandler(),style:{cursor:"pointer"},children:t.getIsExpanded()?"▼":"▶"}):null}},{id:"token",accessorKey:"token",header:"Key ID",cell:e=>(0,s.jsx)("div",{className:"overflow-hidden",children:(0,s.jsx)(w.Z,{title:e.getValue(),children:(0,s.jsx)(p.z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>B(e.getValue()),children:e.getValue()?"".concat(e.getValue().slice(0,7),"..."):"-"})})})},{id:"key_alias",accessorKey:"key_alias",header:"Key Alias",cell:e=>{let t=e.getValue();return(0,s.jsx)(w.Z,{title:t,children:t?t.length>20?"".concat(t.slice(0,20),"..."):t:"-"})}},{id:"key_name",accessorKey:"key_name",header:"Secret Key",cell:e=>(0,s.jsx)("span",{className:"font-mono text-xs",children:e.getValue()})},{id:"team_alias",accessorKey:"team_id",header:"Team Alias",cell:e=>{let{row:t,getValue:l}=e,s=l(),a=null==d?void 0:d.find(e=>e.team_id===s);return(null==a?void 0:a.team_alias)||"Unknown"}},{id:"team_id",accessorKey:"team_id",header:"Team ID",cell:e=>(0,s.jsx)(w.Z,{title:e.getValue(),children:e.getValue()?"".concat(e.getValue().slice(0,7),"..."):"-"})},{id:"organization_id",accessorKey:"organization_id",header:"Organization ID",cell:e=>e.getValue()?e.renderValue():"-"},{id:"user_email",accessorKey:"user_id",header:"User Email",cell:e=>{let t=e.getValue(),l=J.find(e=>e.user_id===t);return(null==l?void 0:l.user_email)?(0,s.jsx)(w.Z,{title:null==l?void 0:l.user_email,children:(0,s.jsxs)("span",{children:[null==l?void 0:l.user_email.slice(0,20),"..."]})}):"-"}},{id:"user_id",accessorKey:"user_id",header:"User ID",cell:e=>{let t=e.getValue();return t&&t.length>15?(0,s.jsx)(w.Z,{title:t,children:(0,s.jsxs)("span",{children:[t.slice(0,7),"..."]})}):t||"-"}},{id:"created_at",accessorKey:"created_at",header:"Created At",cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"-"}},{id:"created_by",accessorKey:"created_by",header:"Created By",cell:e=>{let t=e.getValue();return t&&t.length>15?(0,s.jsx)(w.Z,{title:t,children:(0,s.jsxs)("span",{children:[t.slice(0,7),"..."]})}):t}},{id:"updated_at",accessorKey:"updated_at",header:"Updated At",cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"Never"}},{id:"expires",accessorKey:"expires",header:"Expires",cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"Never"}},{id:"spend",accessorKey:"spend",header:"Spend (USD)",cell:e=>(0,C.pw)(e.getValue(),4)},{id:"max_budget",accessorKey:"max_budget",header:"Budget (USD)",cell:e=>{let t=e.getValue();return null===t?"Unlimited":"$".concat((0,C.pw)(t))}},{id:"budget_reset_at",accessorKey:"budget_reset_at",header:"Budget Reset",cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleString():"Never"}},{id:"models",accessorKey:"models",header:"Models",cell:e=>{let t=e.getValue();return(0,s.jsx)("div",{className:"flex flex-col py-2",children:Array.isArray(t)?(0,s.jsx)("div",{className:"flex flex-col",children:0===t.length?(0,s.jsx)(O.C,{size:"xs",className:"mb-1",color:"red",children:(0,s.jsx)(O.x,{children:"All Proxy Models"})}):(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"flex items-start",children:[t.length>3&&(0,s.jsx)("div",{children:(0,s.jsx)(Z.JO,{icon:G[e.row.id]?K.Z:E.Z,className:"cursor-pointer",size:"xs",onClick:()=>{X(t=>({...t,[e.row.id]:!t[e.row.id]}))}})}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-1",children:[t.slice(0,3).map((e,t)=>"all-proxy-models"===e?(0,s.jsx)(O.C,{size:"xs",color:"red",children:(0,s.jsx)(O.x,{children:"All Proxy Models"})},t):(0,s.jsx)(O.C,{size:"xs",color:"blue",children:(0,s.jsx)(O.x,{children:e.length>30?"".concat((0,m.W0)(e).slice(0,30),"..."):(0,m.W0)(e)})},t)),t.length>3&&!G[e.row.id]&&(0,s.jsx)(O.C,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,s.jsxs)(O.x,{children:["+",t.length-3," ",t.length-3==1?"more model":"more models"]})}),G[e.row.id]&&(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:t.slice(3).map((e,t)=>"all-proxy-models"===e?(0,s.jsx)(O.C,{size:"xs",color:"red",children:(0,s.jsx)(O.x,{children:"All Proxy Models"})},t+3):(0,s.jsx)(O.C,{size:"xs",color:"blue",children:(0,s.jsx)(O.x,{children:e.length>30?"".concat((0,m.W0)(e).slice(0,30),"..."):(0,m.W0)(e)})},t+3))})]})]})})}):null})}},{id:"rate_limits",header:"Rate Limits",cell:e=>{let{row:t}=e,l=t.original;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{children:["TPM: ",null!==l.tpm_limit?l.tpm_limit:"Unlimited"]}),(0,s.jsxs)("div",{children:["RPM: ",null!==l.rpm_limit?l.rpm_limit:"Unlimited"]})]})}}];console.log("keys: ".concat(JSON.stringify(t)));let er=(0,D.b7)({data:Q,columns:ea.filter(e=>"expander"!==e.id),state:{sorting:H},onSortingChange:e=>{let t="function"==typeof e?e(H):e;if(console.log("newSorting: ".concat(JSON.stringify(t))),q(t),t&&t.length>0){let e=t[0],l=e.id,s=e.desc?"desc":"asc";console.log("sortBy: ".concat(l,", sortOrder: ").concat(s)),el({...$,"Sort By":l,"Sort Order":s}),null==V||V(l,s)}},getCoreRowModel:(0,I.sC)(),getSortedRowModel:(0,I.tj)(),enableSorting:!0,manualSorting:!1});return a.useEffect(()=>{P&&q([{id:P.sortBy,desc:"desc"===P.sortOrder}])},[P]),(0,s.jsx)("div",{className:"w-full h-full overflow-hidden",children:M?(0,s.jsx)(j.Z,{keyId:M,onClose:()=>B(null),keyData:Q.find(e=>e.token===M),onKeyDataUpdate:e=>{l(t=>t.map(t=>t.token===e.token?(0,C.nl)(t,e):t)),z&&z()},onDelete:()=>{l(e=>e.filter(e=>e.token!==M)),z&&z()},accessToken:y,userID:f,userRole:S,teams:ee,premiumUser:R,setAccessToken:F}):(0,s.jsxs)("div",{className:"border-b py-4 flex-1 overflow-hidden",children:[(0,s.jsx)("div",{className:"w-full mb-6",children:(0,s.jsx)(b.Z,{options:[{name:"Team ID",label:"Team ID",isSearchable:!0,searchFn:async e=>ee&&0!==ee.length?ee.filter(t=>t.team_id.toLowerCase().includes(e.toLowerCase())||t.team_alias&&t.team_alias.toLowerCase().includes(e.toLowerCase())).map(e=>({label:"".concat(e.team_alias||e.team_id," (").concat(e.team_id,")"),value:e.team_id})):[]},{name:"Organization ID",label:"Organization ID",isSearchable:!0,searchFn:async e=>et&&0!==et.length?et.filter(t=>{var l,s;return null!==(s=null===(l=t.organization_id)||void 0===l?void 0:l.toLowerCase().includes(e.toLowerCase()))&&void 0!==s&&s}).filter(e=>null!==e.organization_id&&void 0!==e.organization_id).map(e=>({label:"".concat(e.organization_id||"Unknown"," (").concat(e.organization_id,")"),value:e.organization_id})):[]},{name:"Key Alias",label:"Key Alias",isSearchable:!0,searchFn:async e=>Y.filter(t=>t.toLowerCase().includes(e.toLowerCase())).map(e=>({label:e,value:e}))},{name:"User ID",label:"User ID",isSearchable:!1},{name:"Key Hash",label:"Key Hash",isSearchable:!1}],onApplyFilters:el,initialValues:$,onResetFilters:es})}),(0,s.jsxs)("div",{className:"flex items-center justify-between w-full mb-4",children:[(0,s.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:["Showing"," ",n?"...":"".concat((i.currentPage-1)*c+1," - ").concat(Math.min(i.currentPage*c,i.totalCount))," ","of ",n?"...":i.totalCount," results"]}),(0,s.jsxs)("div",{className:"inline-flex items-center gap-2",children:[(0,s.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",n?"...":i.currentPage," of ",n?"...":i.totalPages]}),(0,s.jsx)("button",{onClick:()=>o(i.currentPage-1),disabled:n||1===i.currentPage,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,s.jsx)("button",{onClick:()=>o(i.currentPage+1),disabled:n||i.currentPage===i.totalPages,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]}),(0,s.jsx)("div",{className:"h-[75vh] overflow-auto",children:(0,s.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)(Z.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,s.jsx)(Z.ss,{children:er.getHeaderGroups().map(e=>(0,s.jsx)(Z.SC,{children:e.headers.map(e=>(0,s.jsx)(Z.xs,{className:"py-1 h-8 ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),onClick:e.column.getToggleSortingHandler(),children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,D.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,s.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,s.jsx)(A.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,s.jsx)(K.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,s.jsx)(T.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,s.jsx)(Z.RM,{children:n?(0,s.jsx)(Z.SC,{children:(0,s.jsx)(Z.pj,{colSpan:ea.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:"\uD83D\uDE85 Loading keys..."})})})}):Q.length>0?er.getRowModel().rows.map(e=>(0,s.jsx)(Z.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,s.jsx)(Z.pj,{style:{maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ".concat("models"===e.column.id&&e.getValue().length>3?"px-0":""),children:(0,D.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,s.jsx)(Z.SC,{children:(0,s.jsx)(Z.pj,{colSpan:ea.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:"No keys found"})})})})})]})})})})]})})}var U=l(9114),z=e=>{let{userID:t,userRole:l,accessToken:n,selectedTeam:i,setSelectedTeam:o,data:c,setData:p,teams:j,premiumUser:w,currentOrg:b,organizations:v,setCurrentOrg:k,selectedKeyAlias:S,setSelectedKeyAlias:_,createClicked:N,setAccessToken:C}=e,[D,I]=(0,a.useState)(!1),[Z,K]=(0,a.useState)(!1),[E,A]=(0,a.useState)(null),[T,O]=(0,a.useState)(""),[z,V]=(0,a.useState)(null),[P,R]=(0,a.useState)(null),[F,M]=(0,a.useState)((null==i?void 0:i.team_id)||"");(0,a.useEffect)(()=>{M((null==i?void 0:i.team_id)||"")},[i]);let{keys:B,isLoading:J,error:W,pagination:H,refresh:q,setKeys:G}=(0,f.Z)({selectedTeam:i||void 0,currentOrg:b,selectedKeyAlias:S,accessToken:n||"",createClicked:N}),[X,$]=(0,a.useState)(!1),[Q,Y]=(0,a.useState)(!1),[ee,et]=(0,a.useState)(null),[el,es]=(0,a.useState)([]),ea=new Set,[er,en]=(0,a.useState)(!1),[ei,eo]=(0,a.useState)(!1),[ec,ed]=(0,a.useState)(null),[eu,em]=(0,a.useState)(null),[eg]=g.Z.useForm(),[ex,eh]=(0,a.useState)(null),[ey,ef]=(0,a.useState)(ea),[ep,ej]=(0,a.useState)([]);(0,a.useEffect)(()=>{console.log("in calculateNewExpiryTime for selectedToken",ee),(null==eu?void 0:eu.duration)?eh((e=>{if(!e)return null;try{let t;let l=new Date;if(e.endsWith("s"))t=(0,d.I)(l,{seconds:parseInt(e)});else if(e.endsWith("h"))t=(0,d.I)(l,{hours:parseInt(e)});else if(e.endsWith("d"))t=(0,d.I)(l,{days:parseInt(e)});else throw Error("Invalid duration format");return t.toLocaleString("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!0})}catch(e){return null}})(eu.duration)):eh(null),console.log("calculateNewExpiryTime:",ex)},[ee,null==eu?void 0:eu.duration]),(0,a.useEffect)(()=>{(async()=>{try{if(null===t||null===l||null===n)return;let e=await (0,m.K2)(t,l,n);e&&es(e)}catch(e){U.Z.error({description:"Error fetching user models"})}})()},[n,t,l]),(0,a.useEffect)(()=>{if(j){let e=new Set;j.forEach((t,l)=>{let s=t.team_id;e.add(s)}),ef(e)}},[j]);let ew=async()=>{if(null!=E&&null!=B){try{if(!n)return;await (0,r.keyDeleteCall)(n,E);let e=B.filter(e=>e.token!==E);G(e)}catch(e){U.Z.error({description:"Error deleting the key"})}K(!1),A(null),O("")}},eb=()=>{K(!1),A(null),O("")},ev=(e,t)=>{em(l=>({...l,[e]:t}))},ek=async()=>{if(!w){U.Z.warning({description:"Regenerate Virtual Key is an Enterprise feature. Please upgrade to use this feature."});return}if(null!=ee)try{let e=await eg.validateFields();if(!n)return;let t=await (0,r.regenerateKeyCall)(n,ee.token||ee.token_id,e);if(ed(t.key),c){let l=c.map(l=>l.token===(null==ee?void 0:ee.token)?{...l,key_name:t.key_name,...e}:l);p(l)}eo(!1),eg.resetFields(),U.Z.success({description:"Virtual Key regenerated successfully"})}catch(e){console.error("Error regenerating key:",e),U.Z.error({description:"Failed to regenerate Virtual Key"})}};return(0,s.jsxs)("div",{children:[(0,s.jsx)(L,{keys:B,setKeys:G,isLoading:J,pagination:H,onPageChange:e=>{q({page:e})},pageSize:100,teams:j,selectedTeam:i,setSelectedTeam:o,accessToken:n,userID:t,userRole:l,organizations:v,setCurrentOrg:k,refresh:q,selectedKeyAlias:S,setSelectedKeyAlias:_,premiumUser:w,setAccessToken:C}),Z&&(()=>{let e=null==B?void 0:B.find(e=>e.token===E),t=(null==e?void 0:e.key_alias)||(null==e?void 0:e.token_id)||E,l=T===t;return(0,s.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,s.jsxs)("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-2xl min-h-[380px] py-6 overflow-hidden transform transition-all flex flex-col justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200",children:[(0,s.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Delete Key"}),(0,s.jsx)("button",{onClick:()=>{eb(),O("")},className:"text-gray-400 hover:text-gray-500 focus:outline-none",children:(0,s.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,s.jsxs)("div",{className:"px-6 py-4",children:[(0,s.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-red-50 border border-red-100 rounded-md mb-5",children:[(0,s.jsx)("div",{className:"text-red-500 mt-0.5",children:(0,s.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-base font-medium text-red-600",children:"Warning: You are about to delete this Virtual Key."}),(0,s.jsx)("p",{className:"text-base text-red-600 mt-2",children:"This action is irreversible and will immediately revoke access for any applications using this key."})]})]}),(0,s.jsx)("p",{className:"text-base text-gray-600 mb-5",children:"Are you sure you want to delete this Virtual Key?"}),(0,s.jsxs)("div",{className:"mb-5",children:[(0,s.jsxs)("label",{className:"block text-base font-medium text-gray-700 mb-2",children:["Type ",(0,s.jsx)("span",{className:"underline",children:t})," to confirm deletion:"]}),(0,s.jsx)("input",{type:"text",value:T,onChange:e=>O(e.target.value),placeholder:"Enter key name exactly",className:"w-full px-4 py-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-base",autoFocus:!0})]})]})]}),(0,s.jsxs)("div",{className:"px-6 py-4 bg-gray-50 flex justify-end gap-4",children:[(0,s.jsx)("button",{onClick:()=>{eb(),O("")},className:"px-5 py-3 bg-white border border-gray-300 rounded-md text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:"Cancel"}),(0,s.jsx)("button",{onClick:ew,disabled:!l,className:"px-5 py-3 rounded-md text-base font-medium text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 ".concat(l?"bg-red-600 hover:bg-red-700":"bg-red-300 cursor-not-allowed"),children:"Delete Virtual Key"})]})]})})})(),(0,s.jsx)(x.Z,{title:"Regenerate Virtual Key",visible:ei,onCancel:()=>{eo(!1),eg.resetFields()},footer:[(0,s.jsx)(u.zx,{onClick:()=>{eo(!1),eg.resetFields()},className:"mr-2",children:"Cancel"},"cancel"),(0,s.jsx)(u.zx,{onClick:ek,disabled:!w,children:w?"Regenerate":"Upgrade to Regenerate"},"regenerate")],children:w?(0,s.jsxs)(g.Z,{form:eg,layout:"vertical",onValuesChange:(e,t)=>{"duration"in e&&ev("duration",e.duration)},children:[(0,s.jsx)(g.Z.Item,{name:"key_alias",label:"Key Alias",children:(0,s.jsx)(u.oi,{disabled:!0})}),(0,s.jsx)(g.Z.Item,{name:"max_budget",label:"Max Budget (USD)",children:(0,s.jsx)(h.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,s.jsx)(g.Z.Item,{name:"tpm_limit",label:"TPM Limit",children:(0,s.jsx)(h.Z,{style:{width:"100%"}})}),(0,s.jsx)(g.Z.Item,{name:"rpm_limit",label:"RPM Limit",children:(0,s.jsx)(h.Z,{style:{width:"100%"}})}),(0,s.jsx)(g.Z.Item,{name:"duration",label:"Expire Key (eg: 30s, 30h, 30d)",className:"mt-8",children:(0,s.jsx)(u.oi,{placeholder:""})}),(0,s.jsxs)("div",{className:"mt-2 text-sm text-gray-500",children:["Current expiry:"," ",(null==ee?void 0:ee.expires)!=null?new Date(ee.expires).toLocaleString():"Never"]}),ex&&(0,s.jsxs)("div",{className:"mt-2 text-sm text-green-600",children:["New expiry: ",ex]})]}):(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to use this feature"}),(0,s.jsx)(u.zx,{variant:"primary",className:"mb-2",children:(0,s.jsx)("a",{href:"https://calendly.com/d/4mp-gd3-k5k/litellm-1-1-onboarding-chat",target:"_blank",children:"Get Free Trial"})})]})}),ec&&(0,s.jsx)(x.Z,{visible:!!ec,onCancel:()=>ed(null),footer:[(0,s.jsx)(u.zx,{onClick:()=>ed(null),children:"Close"},"close")],children:(0,s.jsxs)(u.rj,{numItems:1,className:"gap-2 w-full",children:[(0,s.jsx)(u.Dx,{children:"Regenerated Key"}),(0,s.jsx)(u.JX,{numColSpan:1,children:(0,s.jsxs)("p",{children:["Please replace your old key with the new key generated. For security reasons,"," ",(0,s.jsx)("b",{children:"you will not be able to view it again"})," through your LiteLLM account. If you lose this secret key, you will need to generate a new one."]})}),(0,s.jsxs)(u.JX,{numColSpan:1,children:[(0,s.jsx)(u.xv,{className:"mt-3",children:"Key Alias:"}),(0,s.jsx)("div",{style:{background:"#f8f8f8",padding:"10px",borderRadius:"5px",marginBottom:"10px"},children:(0,s.jsx)("pre",{style:{wordWrap:"break-word",whiteSpace:"normal"},children:(null==ee?void 0:ee.key_alias)||"No alias set"})}),(0,s.jsx)(u.xv,{className:"mt-3",children:"New Virtual Key:"}),(0,s.jsx)("div",{style:{background:"#f8f8f8",padding:"10px",borderRadius:"5px",marginBottom:"10px"},children:(0,s.jsx)("pre",{style:{wordWrap:"break-word",whiteSpace:"normal"},children:ec})}),(0,s.jsx)(y.CopyToClipboard,{text:ec,onCopy:()=>U.Z.success({description:"Virtual Key copied to clipboard"}),children:(0,s.jsx)(u.zx,{className:"mt-3",children:"Copy Virtual Key"})})]})]})})]})},V=l(12011),P=l(99376),R=l(14474),F=l(57840),M=l(3914),B=e=>{let{userID:t,userRole:l,teams:d,keys:u,setUserRole:m,userEmail:g,setUserEmail:x,setTeams:h,setKeys:y,premiumUser:f,organizations:p,addKey:j,createClicked:w}=e,[b,v]=(0,a.useState)(null),[k,S]=(0,a.useState)(null),_=(0,P.useSearchParams)(),N=function(e){console.log("COOKIES",document.cookie);let t=document.cookie.split("; ").find(t=>t.startsWith(e+"="));return t?t.split("=")[1]:null}("token"),C=_.get("invitation_id"),[D,I]=(0,a.useState)(null),[Z,K]=(0,a.useState)(null),[E,A]=(0,a.useState)([]),[T,O]=(0,a.useState)(null),[L,U]=(0,a.useState)(null),[B,J]=(0,a.useState)(null);if(window.addEventListener("beforeunload",function(){sessionStorage.clear()}),(0,a.useEffect)(()=>{if(N){let e=(0,R.o)(N);if(e){if(console.log("Decoded token:",e),console.log("Decoded key:",e.key),I(e.key),e.user_role){let t=function(e){if(!e)return"Undefined Role";switch(console.log("Received user role: ".concat(e)),e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"app_user":return"App User";case"internal_user":return"Internal User";case"internal_user_viewer":return"Internal Viewer";default:return"Unknown Role"}}(e.user_role);console.log("Decoded user_role:",t),m(t)}else console.log("User role not defined");e.user_email?x(e.user_email):console.log("User Email is not set ".concat(e))}}if(t&&D&&l&&!u&&!b){let e=sessionStorage.getItem("userModels"+t);e?A(JSON.parse(e)):(console.log("currentOrg: ".concat(JSON.stringify(k))),(async()=>{try{let e=await (0,r.getProxyUISettings)(D);O(e);let s=await (0,r.userInfoCall)(D,t,l,!1,null,null);v(s.user_info),console.log("userSpendData: ".concat(JSON.stringify(b))),(null==s?void 0:s.teams[0].keys)?y(s.keys.concat(s.teams.filter(e=>"Admin"===l||e.user_id===t).flatMap(e=>e.keys))):y(s.keys),sessionStorage.setItem("userData"+t,JSON.stringify(s.keys)),sessionStorage.setItem("userSpendData"+t,JSON.stringify(s.user_info));let a=(await (0,r.modelAvailableCall)(D,t,l)).data.map(e=>e.id);console.log("available_model_names:",a),A(a),console.log("userModels:",E),sessionStorage.setItem("userModels"+t,JSON.stringify(a))}catch(e){console.error("There was an error fetching the data",e),e.message.includes("Invalid proxy server token passed")&&W()}})(),(0,n.Z)(D,t,l,k,h))}},[t,N,D,u,l]),(0,a.useEffect)(()=>{D&&(async()=>{try{let e=await (0,r.keyInfoCall)(D,[D]);console.log("keyInfo: ",e)}catch(e){e.message.includes("Invalid proxy server token passed")&&W()}})()},[D]),(0,a.useEffect)(()=>{console.log("currentOrg: ".concat(JSON.stringify(k),", accessToken: ").concat(D,", userID: ").concat(t,", userRole: ").concat(l)),D&&(console.log("fetching teams"),(0,n.Z)(D,t,l,k,h))},[k]),(0,a.useEffect)(()=>{if(null!==u&&null!=L&&null!==L.team_id){let e=0;for(let t of(console.log("keys: ".concat(JSON.stringify(u))),u))L.hasOwnProperty("team_id")&&null!==t.team_id&&t.team_id===L.team_id&&(e+=t.spend);console.log("sum: ".concat(e)),K(e)}else if(null!==u){let e=0;for(let t of u)e+=t.spend;K(e)}},[L]),null!=C)return(0,s.jsx)(V.default,{});function W(){(0,M.b)();let e=(0,r.getProxyBaseUrl)();console.log("proxyBaseUrl:",e);let t=e?"".concat(e,"/sso/key/generate"):"/sso/key/generate";return console.log("Full URL:",t),window.location.href=t,null}if(null==N)return console.log("All cookies before redirect:",document.cookie),W(),null;try{let e=(0,R.o)(N);console.log("Decoded token:",e);let t=e.exp,l=Math.floor(Date.now()/1e3);if(t&&l>=t)return console.log("Token expired, redirecting to login"),W(),null}catch(e){return console.error("Error decoding token:",e),(0,M.b)(),W(),null}if(null==D)return null;if(null==t)return(0,s.jsx)("h1",{children:"User ID is not set"});if(null==l&&m("App Owner"),l&&"Admin Viewer"==l){let{Title:e,Paragraph:t}=F.default;return(0,s.jsxs)("div",{children:[(0,s.jsx)(e,{level:1,children:"Access Denied"}),(0,s.jsx)(t,{children:"Ask your proxy admin for access to create keys"})]})}return console.log("inside user dashboard, selected team",L),console.log("All cookies after redirect:",document.cookie),(0,s.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,s.jsx)(o.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,s.jsxs)(i.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[(0,s.jsx)(c.ZP,{userID:t,team:L,teams:d,userRole:l,accessToken:D,data:u,addKey:j,premiumUser:f},L?L.team_id:null),(0,s.jsx)(z,{userID:t,userRole:l,accessToken:D,selectedTeam:L||null,setSelectedTeam:U,selectedKeyAlias:B,setSelectedKeyAlias:J,data:u,setData:y,premiumUser:f,teams:d,currentOrg:k,setCurrentOrg:S,organizations:p,createClicked:w,setAccessToken:I})]})})})}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1739],{25512:function(e,t,l){l.d(t,{P:function(){return s.Z},Q:function(){return a.Z}});var s=l(27281),a=l(57365)},12011:function(e,t,l){l.r(t),l.d(t,{default:function(){return w}});var s=l(57437),a=l(2265),r=l(99376),n=l(78489),i=l(94789),o=l(12514),c=l(49804),d=l(67101),u=l(84264),m=l(49566),g=l(96761),x=l(84566),h=l(19250),y=l(14474),f=l(10032),p=l(5545),j=l(3914);function w(){let[e]=f.Z.useForm(),t=(0,r.useSearchParams)();(0,j.e)("token");let l=t.get("invitation_id"),w=t.get("action"),[b,v]=(0,a.useState)(null),[k,S]=(0,a.useState)(""),[_,N]=(0,a.useState)(""),[C,D]=(0,a.useState)(null),[I,Z]=(0,a.useState)(""),[K,E]=(0,a.useState)(""),[A,T]=(0,a.useState)(!0);return(0,a.useEffect)(()=>{(0,h.getUiConfig)().then(e=>{console.log("ui config in onboarding.tsx:",e),T(!1)})},[]),(0,a.useEffect)(()=>{l&&!A&&(0,h.getOnboardingCredentials)(l).then(e=>{let t=e.login_url;console.log("login_url:",t),Z(t);let l=e.token,s=(0,y.o)(l);E(l),console.log("decoded:",s),v(s.key),console.log("decoded user email:",s.user_email),N(s.user_email),D(s.user_id)})},[l,A]),(0,s.jsx)("div",{className:"mx-auto w-full max-w-md mt-10",children:(0,s.jsxs)(o.Z,{children:[(0,s.jsx)(g.Z,{className:"text-sm mb-5 text-center",children:"\uD83D\uDE85 LiteLLM"}),(0,s.jsx)(g.Z,{className:"text-xl",children:"reset_password"===w?"Reset Password":"Sign up"}),(0,s.jsx)(u.Z,{children:"reset_password"===w?"Reset your password to access Admin UI.":"Claim your user account to login to Admin UI."}),"reset_password"!==w&&(0,s.jsx)(i.Z,{className:"mt-4",title:"SSO",icon:x.GH$,color:"sky",children:(0,s.jsxs)(d.Z,{numItems:2,className:"flex justify-between items-center",children:[(0,s.jsx)(c.Z,{children:"SSO is under the Enterprise Tier."}),(0,s.jsx)(c.Z,{children:(0,s.jsx)(n.Z,{variant:"primary",className:"mb-2",children:(0,s.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})})})]})}),(0,s.jsxs)(f.Z,{className:"mt-10 mb-5 mx-auto",layout:"vertical",onFinish:e=>{console.log("in handle submit. accessToken:",b,"token:",K,"formValues:",e),b&&K&&(e.user_email=_,C&&l&&(0,h.claimOnboardingToken)(b,l,C,e.password).then(e=>{document.cookie="token="+K;let t=(0,h.getProxyBaseUrl)();console.log("proxyBaseUrl:",t);let l=t?"".concat(t,"/ui/?login=success"):"/ui/?login=success";console.log("redirecting to:",l),window.location.href=l}))},children:[(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.Z.Item,{label:"Email Address",name:"user_email",children:(0,s.jsx)(m.Z,{type:"email",disabled:!0,value:_,defaultValue:_,className:"max-w-md"})}),(0,s.jsx)(f.Z.Item,{label:"Password",name:"password",rules:[{required:!0,message:"password required to sign up"}],help:"reset_password"===w?"Enter your new password":"Create a password for your account",children:(0,s.jsx)(m.Z,{placeholder:"",type:"password",className:"max-w-md"})})]}),(0,s.jsx)("div",{className:"mt-10",children:(0,s.jsx)(p.ZP,{htmlType:"submit",children:"reset_password"===w?"Reset Password":"Sign Up"})})]})]})})}},39210:function(e,t,l){l.d(t,{Z:function(){return a}});var s=l(19250);let a=async(e,t,l,a,r)=>{let n;n="Admin"!=l&&"Admin Viewer"!=l?await (0,s.teamListCall)(e,(null==a?void 0:a.organization_id)||null,t):await (0,s.teamListCall)(e,(null==a?void 0:a.organization_id)||null),console.log("givenTeams: ".concat(n)),r(n)}},49924:function(e,t,l){var s=l(2265),a=l(19250);t.Z=e=>{let{selectedTeam:t,currentOrg:l,selectedKeyAlias:r,accessToken:n,createClicked:i}=e,[o,c]=(0,s.useState)({keys:[],total_count:0,current_page:1,total_pages:0}),[d,u]=(0,s.useState)(!0),[m,g]=(0,s.useState)(null),x=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(console.log("calling fetchKeys"),!n){console.log("accessToken",n);return}u(!0);let t="number"==typeof e.page?e.page:1,l="number"==typeof e.pageSize?e.pageSize:100,s=await (0,a.keyListCall)(n,null,null,null,null,null,t,l);console.log("data",s),c(s),g(null)}catch(e){g(e instanceof Error?e:Error("An error occurred"))}finally{u(!1)}};return(0,s.useEffect)(()=>{x(),console.log("selectedTeam",t,"currentOrg",l,"accessToken",n,"selectedKeyAlias",r)},[t,l,n,r,i]),{keys:o.keys,isLoading:d,error:m,pagination:{currentPage:o.current_page,totalPages:o.total_pages,totalCount:o.total_count},refresh:x,setKeys:e=>{c(t=>{let l="function"==typeof e?e(t.keys):e;return{...t,keys:l}})}}}},21739:function(e,t,l){l.d(t,{Z:function(){return B}});var s=l(57437),a=l(2265),r=l(19250),n=l(39210),i=l(49804),o=l(67101),c=l(30874),d=l(92668),u=l(16721),m=l(46468),g=l(10032),x=l(22116),h=l(19015),y=l(29233),f=l(49924);l(25512);var p=l(16312),j=l(94292),w=l(99981),b=l(23048),v=l(11713),k=l(30841),S=l(7310),_=l.n(S),N=l(12363),C=l(59872),D=l(71594),I=l(24525),Z=l(10178),K=l(86462),E=l(47686),A=l(44633),T=l(49084),O=l(40728);function L(e){let{keys:t,setKeys:l,isLoading:n=!1,pagination:i,onPageChange:o,pageSize:c=50,teams:d,selectedTeam:u,setSelectedTeam:g,selectedKeyAlias:x,setSelectedKeyAlias:h,accessToken:y,userID:f,userRole:S,organizations:L,setCurrentOrg:U,refresh:z,onSortChange:V,currentSort:P,premiumUser:R,setAccessToken:F}=e,[M,B]=(0,a.useState)(null),[J,W]=(0,a.useState)([]),[H,q]=a.useState(()=>P?[{id:P.sortBy,desc:"desc"===P.sortOrder}]:[{id:"created_at",desc:!0}]),[G,X]=(0,a.useState)({}),{filters:$,filteredKeys:Q,allKeyAliases:Y,allTeams:ee,allOrganizations:et,handleFilterChange:el,handleFilterReset:es}=function(e){let{keys:t,teams:l,organizations:s,accessToken:n}=e,i={"Team ID":"","Organization ID":"","Key Alias":"","User ID":"","Sort By":"created_at","Sort Order":"desc"},[o,c]=(0,a.useState)(i),[d,u]=(0,a.useState)(l||[]),[m,g]=(0,a.useState)(s||[]),[x,h]=(0,a.useState)(t),y=(0,a.useRef)(0),f=(0,a.useCallback)(_()(async e=>{if(!n)return;let t=Date.now();y.current=t;try{let l=await (0,r.keyListCall)(n,e["Organization ID"]||null,e["Team ID"]||null,e["Key Alias"]||null,e["User ID"]||null,e["Key Hash"]||null,1,N.d,e["Sort By"]||null,e["Sort Order"]||null);t===y.current&&l&&(h(l.keys),console.log("called from debouncedSearch filters:",JSON.stringify(e)),console.log("called from debouncedSearch data:",JSON.stringify(l)))}catch(e){console.error("Error searching users:",e)}},300),[n]);(0,a.useEffect)(()=>{if(!t){h([]);return}let e=[...t];o["Team ID"]&&(e=e.filter(e=>e.team_id===o["Team ID"])),o["Organization ID"]&&(e=e.filter(e=>e.organization_id===o["Organization ID"])),h(e)},[t,o]),(0,a.useEffect)(()=>{let e=async()=>{let e=await (0,k.IE)(n);e.length>0&&u(e);let t=await (0,k.cT)(n);t.length>0&&g(t)};n&&e()},[n]);let p=(0,v.a)({queryKey:["allKeys"],queryFn:async()=>{if(!n)throw Error("Access token required");return await (0,k.LO)(n)},enabled:!!n}).data||[];return(0,a.useEffect)(()=>{l&&l.length>0&&u(e=>e.length{s&&s.length>0&&g(e=>e.length{c({"Team ID":e["Team ID"]||"","Organization ID":e["Organization ID"]||"","Key Alias":e["Key Alias"]||"","User ID":e["User ID"]||"","Sort By":e["Sort By"]||"created_at","Sort Order":e["Sort Order"]||"desc"}),f({...o,...e})},handleFilterReset:()=>{c(i),f(i)}}}({keys:t,teams:d,organizations:L,accessToken:y});(0,a.useEffect)(()=>{if(y){let e=t.map(e=>e.user_id).filter(e=>null!==e);(async()=>{W((await (0,r.userListCall)(y,e,1,100)).users)})()}},[y,t]),(0,a.useEffect)(()=>{if(z){let e=()=>{z()};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}}},[z]);let ea=[{id:"expander",header:()=>null,cell:e=>{let{row:t}=e;return t.getCanExpand()?(0,s.jsx)("button",{onClick:t.getToggleExpandedHandler(),style:{cursor:"pointer"},children:t.getIsExpanded()?"▼":"▶"}):null}},{id:"token",accessorKey:"token",header:"Key ID",cell:e=>(0,s.jsx)("div",{className:"overflow-hidden",children:(0,s.jsx)(w.Z,{title:e.getValue(),children:(0,s.jsx)(p.z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>B(e.getValue()),children:e.getValue()?"".concat(e.getValue().slice(0,7),"..."):"-"})})})},{id:"key_alias",accessorKey:"key_alias",header:"Key Alias",cell:e=>{let t=e.getValue();return(0,s.jsx)(w.Z,{title:t,children:t?t.length>20?"".concat(t.slice(0,20),"..."):t:"-"})}},{id:"key_name",accessorKey:"key_name",header:"Secret Key",cell:e=>(0,s.jsx)("span",{className:"font-mono text-xs",children:e.getValue()})},{id:"team_alias",accessorKey:"team_id",header:"Team Alias",cell:e=>{let{row:t,getValue:l}=e,s=l(),a=null==d?void 0:d.find(e=>e.team_id===s);return(null==a?void 0:a.team_alias)||"Unknown"}},{id:"team_id",accessorKey:"team_id",header:"Team ID",cell:e=>(0,s.jsx)(w.Z,{title:e.getValue(),children:e.getValue()?"".concat(e.getValue().slice(0,7),"..."):"-"})},{id:"organization_id",accessorKey:"organization_id",header:"Organization ID",cell:e=>e.getValue()?e.renderValue():"-"},{id:"user_email",accessorKey:"user_id",header:"User Email",cell:e=>{let t=e.getValue(),l=J.find(e=>e.user_id===t);return(null==l?void 0:l.user_email)?(0,s.jsx)(w.Z,{title:null==l?void 0:l.user_email,children:(0,s.jsxs)("span",{children:[null==l?void 0:l.user_email.slice(0,20),"..."]})}):"-"}},{id:"user_id",accessorKey:"user_id",header:"User ID",cell:e=>{let t=e.getValue();return t&&t.length>15?(0,s.jsx)(w.Z,{title:t,children:(0,s.jsxs)("span",{children:[t.slice(0,7),"..."]})}):t||"-"}},{id:"created_at",accessorKey:"created_at",header:"Created At",cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"-"}},{id:"created_by",accessorKey:"created_by",header:"Created By",cell:e=>{let t=e.getValue();return t&&t.length>15?(0,s.jsx)(w.Z,{title:t,children:(0,s.jsxs)("span",{children:[t.slice(0,7),"..."]})}):t}},{id:"updated_at",accessorKey:"updated_at",header:"Updated At",cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"Never"}},{id:"expires",accessorKey:"expires",header:"Expires",cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"Never"}},{id:"spend",accessorKey:"spend",header:"Spend (USD)",cell:e=>(0,C.pw)(e.getValue(),4)},{id:"max_budget",accessorKey:"max_budget",header:"Budget (USD)",cell:e=>{let t=e.getValue();return null===t?"Unlimited":"$".concat((0,C.pw)(t))}},{id:"budget_reset_at",accessorKey:"budget_reset_at",header:"Budget Reset",cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleString():"Never"}},{id:"models",accessorKey:"models",header:"Models",cell:e=>{let t=e.getValue();return(0,s.jsx)("div",{className:"flex flex-col py-2",children:Array.isArray(t)?(0,s.jsx)("div",{className:"flex flex-col",children:0===t.length?(0,s.jsx)(O.C,{size:"xs",className:"mb-1",color:"red",children:(0,s.jsx)(O.x,{children:"All Proxy Models"})}):(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"flex items-start",children:[t.length>3&&(0,s.jsx)("div",{children:(0,s.jsx)(Z.JO,{icon:G[e.row.id]?K.Z:E.Z,className:"cursor-pointer",size:"xs",onClick:()=>{X(t=>({...t,[e.row.id]:!t[e.row.id]}))}})}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-1",children:[t.slice(0,3).map((e,t)=>"all-proxy-models"===e?(0,s.jsx)(O.C,{size:"xs",color:"red",children:(0,s.jsx)(O.x,{children:"All Proxy Models"})},t):(0,s.jsx)(O.C,{size:"xs",color:"blue",children:(0,s.jsx)(O.x,{children:e.length>30?"".concat((0,m.W0)(e).slice(0,30),"..."):(0,m.W0)(e)})},t)),t.length>3&&!G[e.row.id]&&(0,s.jsx)(O.C,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,s.jsxs)(O.x,{children:["+",t.length-3," ",t.length-3==1?"more model":"more models"]})}),G[e.row.id]&&(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:t.slice(3).map((e,t)=>"all-proxy-models"===e?(0,s.jsx)(O.C,{size:"xs",color:"red",children:(0,s.jsx)(O.x,{children:"All Proxy Models"})},t+3):(0,s.jsx)(O.C,{size:"xs",color:"blue",children:(0,s.jsx)(O.x,{children:e.length>30?"".concat((0,m.W0)(e).slice(0,30),"..."):(0,m.W0)(e)})},t+3))})]})]})})}):null})}},{id:"rate_limits",header:"Rate Limits",cell:e=>{let{row:t}=e,l=t.original;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{children:["TPM: ",null!==l.tpm_limit?l.tpm_limit:"Unlimited"]}),(0,s.jsxs)("div",{children:["RPM: ",null!==l.rpm_limit?l.rpm_limit:"Unlimited"]})]})}}];console.log("keys: ".concat(JSON.stringify(t)));let er=(0,D.b7)({data:Q,columns:ea.filter(e=>"expander"!==e.id),state:{sorting:H},onSortingChange:e=>{let t="function"==typeof e?e(H):e;if(console.log("newSorting: ".concat(JSON.stringify(t))),q(t),t&&t.length>0){let e=t[0],l=e.id,s=e.desc?"desc":"asc";console.log("sortBy: ".concat(l,", sortOrder: ").concat(s)),el({...$,"Sort By":l,"Sort Order":s}),null==V||V(l,s)}},getCoreRowModel:(0,I.sC)(),getSortedRowModel:(0,I.tj)(),enableSorting:!0,manualSorting:!1});return a.useEffect(()=>{P&&q([{id:P.sortBy,desc:"desc"===P.sortOrder}])},[P]),(0,s.jsx)("div",{className:"w-full h-full overflow-hidden",children:M?(0,s.jsx)(j.Z,{keyId:M,onClose:()=>B(null),keyData:Q.find(e=>e.token===M),onKeyDataUpdate:e=>{l(t=>t.map(t=>t.token===e.token?(0,C.nl)(t,e):t)),z&&z()},onDelete:()=>{l(e=>e.filter(e=>e.token!==M)),z&&z()},accessToken:y,userID:f,userRole:S,teams:ee,premiumUser:R,setAccessToken:F}):(0,s.jsxs)("div",{className:"border-b py-4 flex-1 overflow-hidden",children:[(0,s.jsx)("div",{className:"w-full mb-6",children:(0,s.jsx)(b.Z,{options:[{name:"Team ID",label:"Team ID",isSearchable:!0,searchFn:async e=>ee&&0!==ee.length?ee.filter(t=>t.team_id.toLowerCase().includes(e.toLowerCase())||t.team_alias&&t.team_alias.toLowerCase().includes(e.toLowerCase())).map(e=>({label:"".concat(e.team_alias||e.team_id," (").concat(e.team_id,")"),value:e.team_id})):[]},{name:"Organization ID",label:"Organization ID",isSearchable:!0,searchFn:async e=>et&&0!==et.length?et.filter(t=>{var l,s;return null!==(s=null===(l=t.organization_id)||void 0===l?void 0:l.toLowerCase().includes(e.toLowerCase()))&&void 0!==s&&s}).filter(e=>null!==e.organization_id&&void 0!==e.organization_id).map(e=>({label:"".concat(e.organization_id||"Unknown"," (").concat(e.organization_id,")"),value:e.organization_id})):[]},{name:"Key Alias",label:"Key Alias",isSearchable:!0,searchFn:async e=>Y.filter(t=>t.toLowerCase().includes(e.toLowerCase())).map(e=>({label:e,value:e}))},{name:"User ID",label:"User ID",isSearchable:!1},{name:"Key Hash",label:"Key Hash",isSearchable:!1}],onApplyFilters:el,initialValues:$,onResetFilters:es})}),(0,s.jsxs)("div",{className:"flex items-center justify-between w-full mb-4",children:[(0,s.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:["Showing"," ",n?"...":"".concat((i.currentPage-1)*c+1," - ").concat(Math.min(i.currentPage*c,i.totalCount))," ","of ",n?"...":i.totalCount," results"]}),(0,s.jsxs)("div",{className:"inline-flex items-center gap-2",children:[(0,s.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",n?"...":i.currentPage," of ",n?"...":i.totalPages]}),(0,s.jsx)("button",{onClick:()=>o(i.currentPage-1),disabled:n||1===i.currentPage,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,s.jsx)("button",{onClick:()=>o(i.currentPage+1),disabled:n||i.currentPage===i.totalPages,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]}),(0,s.jsx)("div",{className:"h-[75vh] overflow-auto",children:(0,s.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)(Z.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,s.jsx)(Z.ss,{children:er.getHeaderGroups().map(e=>(0,s.jsx)(Z.SC,{children:e.headers.map(e=>(0,s.jsx)(Z.xs,{className:"py-1 h-8 ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),onClick:e.column.getToggleSortingHandler(),children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,D.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,s.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,s.jsx)(A.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,s.jsx)(K.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,s.jsx)(T.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,s.jsx)(Z.RM,{children:n?(0,s.jsx)(Z.SC,{children:(0,s.jsx)(Z.pj,{colSpan:ea.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:"\uD83D\uDE85 Loading keys..."})})})}):Q.length>0?er.getRowModel().rows.map(e=>(0,s.jsx)(Z.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,s.jsx)(Z.pj,{style:{maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ".concat("models"===e.column.id&&e.getValue().length>3?"px-0":""),children:(0,D.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,s.jsx)(Z.SC,{children:(0,s.jsx)(Z.pj,{colSpan:ea.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:"No keys found"})})})})})]})})})})]})})}var U=l(9114),z=e=>{let{userID:t,userRole:l,accessToken:n,selectedTeam:i,setSelectedTeam:o,data:c,setData:p,teams:j,premiumUser:w,currentOrg:b,organizations:v,setCurrentOrg:k,selectedKeyAlias:S,setSelectedKeyAlias:_,createClicked:N,setAccessToken:C}=e,[D,I]=(0,a.useState)(!1),[Z,K]=(0,a.useState)(!1),[E,A]=(0,a.useState)(null),[T,O]=(0,a.useState)(""),[z,V]=(0,a.useState)(null),[P,R]=(0,a.useState)(null),[F,M]=(0,a.useState)((null==i?void 0:i.team_id)||"");(0,a.useEffect)(()=>{M((null==i?void 0:i.team_id)||"")},[i]);let{keys:B,isLoading:J,error:W,pagination:H,refresh:q,setKeys:G}=(0,f.Z)({selectedTeam:i||void 0,currentOrg:b,selectedKeyAlias:S,accessToken:n||"",createClicked:N}),[X,$]=(0,a.useState)(!1),[Q,Y]=(0,a.useState)(!1),[ee,et]=(0,a.useState)(null),[el,es]=(0,a.useState)([]),ea=new Set,[er,en]=(0,a.useState)(!1),[ei,eo]=(0,a.useState)(!1),[ec,ed]=(0,a.useState)(null),[eu,em]=(0,a.useState)(null),[eg]=g.Z.useForm(),[ex,eh]=(0,a.useState)(null),[ey,ef]=(0,a.useState)(ea),[ep,ej]=(0,a.useState)([]);(0,a.useEffect)(()=>{console.log("in calculateNewExpiryTime for selectedToken",ee),(null==eu?void 0:eu.duration)?eh((e=>{if(!e)return null;try{let t;let l=new Date;if(e.endsWith("s"))t=(0,d.I)(l,{seconds:parseInt(e)});else if(e.endsWith("h"))t=(0,d.I)(l,{hours:parseInt(e)});else if(e.endsWith("d"))t=(0,d.I)(l,{days:parseInt(e)});else throw Error("Invalid duration format");return t.toLocaleString("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!0})}catch(e){return null}})(eu.duration)):eh(null),console.log("calculateNewExpiryTime:",ex)},[ee,null==eu?void 0:eu.duration]),(0,a.useEffect)(()=>{(async()=>{try{if(null===t||null===l||null===n)return;let e=await (0,m.K2)(t,l,n);e&&es(e)}catch(e){U.Z.error({description:"Error fetching user models"})}})()},[n,t,l]),(0,a.useEffect)(()=>{if(j){let e=new Set;j.forEach((t,l)=>{let s=t.team_id;e.add(s)}),ef(e)}},[j]);let ew=async()=>{if(null!=E&&null!=B){try{if(!n)return;await (0,r.keyDeleteCall)(n,E);let e=B.filter(e=>e.token!==E);G(e)}catch(e){U.Z.error({description:"Error deleting the key"})}K(!1),A(null),O("")}},eb=()=>{K(!1),A(null),O("")},ev=(e,t)=>{em(l=>({...l,[e]:t}))},ek=async()=>{if(!w){U.Z.warning({description:"Regenerate Virtual Key is an Enterprise feature. Please upgrade to use this feature."});return}if(null!=ee)try{let e=await eg.validateFields();if(!n)return;let t=await (0,r.regenerateKeyCall)(n,ee.token||ee.token_id,e);if(ed(t.key),c){let l=c.map(l=>l.token===(null==ee?void 0:ee.token)?{...l,key_name:t.key_name,...e}:l);p(l)}eo(!1),eg.resetFields(),U.Z.success({description:"Virtual Key regenerated successfully"})}catch(e){console.error("Error regenerating key:",e),U.Z.error({description:"Failed to regenerate Virtual Key"})}};return(0,s.jsxs)("div",{children:[(0,s.jsx)(L,{keys:B,setKeys:G,isLoading:J,pagination:H,onPageChange:e=>{q({page:e})},pageSize:100,teams:j,selectedTeam:i,setSelectedTeam:o,accessToken:n,userID:t,userRole:l,organizations:v,setCurrentOrg:k,refresh:q,selectedKeyAlias:S,setSelectedKeyAlias:_,premiumUser:w,setAccessToken:C}),Z&&(()=>{let e=null==B?void 0:B.find(e=>e.token===E),t=(null==e?void 0:e.key_alias)||(null==e?void 0:e.token_id)||E,l=T===t;return(0,s.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,s.jsxs)("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-2xl min-h-[380px] py-6 overflow-hidden transform transition-all flex flex-col justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200",children:[(0,s.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Delete Key"}),(0,s.jsx)("button",{onClick:()=>{eb(),O("")},className:"text-gray-400 hover:text-gray-500 focus:outline-none",children:(0,s.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,s.jsxs)("div",{className:"px-6 py-4",children:[(0,s.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-red-50 border border-red-100 rounded-md mb-5",children:[(0,s.jsx)("div",{className:"text-red-500 mt-0.5",children:(0,s.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-base font-medium text-red-600",children:"Warning: You are about to delete this Virtual Key."}),(0,s.jsx)("p",{className:"text-base text-red-600 mt-2",children:"This action is irreversible and will immediately revoke access for any applications using this key."})]})]}),(0,s.jsx)("p",{className:"text-base text-gray-600 mb-5",children:"Are you sure you want to delete this Virtual Key?"}),(0,s.jsxs)("div",{className:"mb-5",children:[(0,s.jsxs)("label",{className:"block text-base font-medium text-gray-700 mb-2",children:["Type ",(0,s.jsx)("span",{className:"underline",children:t})," to confirm deletion:"]}),(0,s.jsx)("input",{type:"text",value:T,onChange:e=>O(e.target.value),placeholder:"Enter key name exactly",className:"w-full px-4 py-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-base",autoFocus:!0})]})]})]}),(0,s.jsxs)("div",{className:"px-6 py-4 bg-gray-50 flex justify-end gap-4",children:[(0,s.jsx)("button",{onClick:()=>{eb(),O("")},className:"px-5 py-3 bg-white border border-gray-300 rounded-md text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:"Cancel"}),(0,s.jsx)("button",{onClick:ew,disabled:!l,className:"px-5 py-3 rounded-md text-base font-medium text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 ".concat(l?"bg-red-600 hover:bg-red-700":"bg-red-300 cursor-not-allowed"),children:"Delete Virtual Key"})]})]})})})(),(0,s.jsx)(x.Z,{title:"Regenerate Virtual Key",visible:ei,onCancel:()=>{eo(!1),eg.resetFields()},footer:[(0,s.jsx)(u.zx,{onClick:()=>{eo(!1),eg.resetFields()},className:"mr-2",children:"Cancel"},"cancel"),(0,s.jsx)(u.zx,{onClick:ek,disabled:!w,children:w?"Regenerate":"Upgrade to Regenerate"},"regenerate")],children:w?(0,s.jsxs)(g.Z,{form:eg,layout:"vertical",onValuesChange:(e,t)=>{"duration"in e&&ev("duration",e.duration)},children:[(0,s.jsx)(g.Z.Item,{name:"key_alias",label:"Key Alias",children:(0,s.jsx)(u.oi,{disabled:!0})}),(0,s.jsx)(g.Z.Item,{name:"max_budget",label:"Max Budget (USD)",children:(0,s.jsx)(h.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,s.jsx)(g.Z.Item,{name:"tpm_limit",label:"TPM Limit",children:(0,s.jsx)(h.Z,{style:{width:"100%"}})}),(0,s.jsx)(g.Z.Item,{name:"rpm_limit",label:"RPM Limit",children:(0,s.jsx)(h.Z,{style:{width:"100%"}})}),(0,s.jsx)(g.Z.Item,{name:"duration",label:"Expire Key (eg: 30s, 30h, 30d)",className:"mt-8",children:(0,s.jsx)(u.oi,{placeholder:""})}),(0,s.jsxs)("div",{className:"mt-2 text-sm text-gray-500",children:["Current expiry:"," ",(null==ee?void 0:ee.expires)!=null?new Date(ee.expires).toLocaleString():"Never"]}),ex&&(0,s.jsxs)("div",{className:"mt-2 text-sm text-green-600",children:["New expiry: ",ex]})]}):(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to use this feature"}),(0,s.jsx)(u.zx,{variant:"primary",className:"mb-2",children:(0,s.jsx)("a",{href:"https://calendly.com/d/4mp-gd3-k5k/litellm-1-1-onboarding-chat",target:"_blank",children:"Get Free Trial"})})]})}),ec&&(0,s.jsx)(x.Z,{visible:!!ec,onCancel:()=>ed(null),footer:[(0,s.jsx)(u.zx,{onClick:()=>ed(null),children:"Close"},"close")],children:(0,s.jsxs)(u.rj,{numItems:1,className:"gap-2 w-full",children:[(0,s.jsx)(u.Dx,{children:"Regenerated Key"}),(0,s.jsx)(u.JX,{numColSpan:1,children:(0,s.jsxs)("p",{children:["Please replace your old key with the new key generated. For security reasons,"," ",(0,s.jsx)("b",{children:"you will not be able to view it again"})," through your LiteLLM account. If you lose this secret key, you will need to generate a new one."]})}),(0,s.jsxs)(u.JX,{numColSpan:1,children:[(0,s.jsx)(u.xv,{className:"mt-3",children:"Key Alias:"}),(0,s.jsx)("div",{style:{background:"#f8f8f8",padding:"10px",borderRadius:"5px",marginBottom:"10px"},children:(0,s.jsx)("pre",{style:{wordWrap:"break-word",whiteSpace:"normal"},children:(null==ee?void 0:ee.key_alias)||"No alias set"})}),(0,s.jsx)(u.xv,{className:"mt-3",children:"New Virtual Key:"}),(0,s.jsx)("div",{style:{background:"#f8f8f8",padding:"10px",borderRadius:"5px",marginBottom:"10px"},children:(0,s.jsx)("pre",{style:{wordWrap:"break-word",whiteSpace:"normal"},children:ec})}),(0,s.jsx)(y.CopyToClipboard,{text:ec,onCopy:()=>U.Z.success({description:"Virtual Key copied to clipboard"}),children:(0,s.jsx)(u.zx,{className:"mt-3",children:"Copy Virtual Key"})})]})]})})]})},V=l(12011),P=l(99376),R=l(14474),F=l(57840),M=l(3914),B=e=>{let{userID:t,userRole:l,teams:d,keys:u,setUserRole:m,userEmail:g,setUserEmail:x,setTeams:h,setKeys:y,premiumUser:f,organizations:p,addKey:j,createClicked:w}=e,[b,v]=(0,a.useState)(null),[k,S]=(0,a.useState)(null),_=(0,P.useSearchParams)(),N=function(e){console.log("COOKIES",document.cookie);let t=document.cookie.split("; ").find(t=>t.startsWith(e+"="));return t?t.split("=")[1]:null}("token"),C=_.get("invitation_id"),[D,I]=(0,a.useState)(null),[Z,K]=(0,a.useState)(null),[E,A]=(0,a.useState)([]),[T,O]=(0,a.useState)(null),[L,U]=(0,a.useState)(null),[B,J]=(0,a.useState)(null);if(window.addEventListener("beforeunload",function(){sessionStorage.clear()}),(0,a.useEffect)(()=>{if(N){let e=(0,R.o)(N);if(e){if(console.log("Decoded token:",e),console.log("Decoded key:",e.key),I(e.key),e.user_role){let t=function(e){if(!e)return"Undefined Role";switch(console.log("Received user role: ".concat(e)),e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"app_user":return"App User";case"internal_user":return"Internal User";case"internal_user_viewer":return"Internal Viewer";default:return"Unknown Role"}}(e.user_role);console.log("Decoded user_role:",t),m(t)}else console.log("User role not defined");e.user_email?x(e.user_email):console.log("User Email is not set ".concat(e))}}if(t&&D&&l&&!u&&!b){let e=sessionStorage.getItem("userModels"+t);e?A(JSON.parse(e)):(console.log("currentOrg: ".concat(JSON.stringify(k))),(async()=>{try{let e=await (0,r.getProxyUISettings)(D);O(e);let s=await (0,r.userInfoCall)(D,t,l,!1,null,null);v(s.user_info),console.log("userSpendData: ".concat(JSON.stringify(b))),(null==s?void 0:s.teams[0].keys)?y(s.keys.concat(s.teams.filter(e=>"Admin"===l||e.user_id===t).flatMap(e=>e.keys))):y(s.keys),sessionStorage.setItem("userData"+t,JSON.stringify(s.keys)),sessionStorage.setItem("userSpendData"+t,JSON.stringify(s.user_info));let a=(await (0,r.modelAvailableCall)(D,t,l)).data.map(e=>e.id);console.log("available_model_names:",a),A(a),console.log("userModels:",E),sessionStorage.setItem("userModels"+t,JSON.stringify(a))}catch(e){console.error("There was an error fetching the data",e),e.message.includes("Invalid proxy server token passed")&&W()}})(),(0,n.Z)(D,t,l,k,h))}},[t,N,D,u,l]),(0,a.useEffect)(()=>{D&&(async()=>{try{let e=await (0,r.keyInfoCall)(D,[D]);console.log("keyInfo: ",e)}catch(e){e.message.includes("Invalid proxy server token passed")&&W()}})()},[D]),(0,a.useEffect)(()=>{console.log("currentOrg: ".concat(JSON.stringify(k),", accessToken: ").concat(D,", userID: ").concat(t,", userRole: ").concat(l)),D&&(console.log("fetching teams"),(0,n.Z)(D,t,l,k,h))},[k]),(0,a.useEffect)(()=>{if(null!==u&&null!=L&&null!==L.team_id){let e=0;for(let t of(console.log("keys: ".concat(JSON.stringify(u))),u))L.hasOwnProperty("team_id")&&null!==t.team_id&&t.team_id===L.team_id&&(e+=t.spend);console.log("sum: ".concat(e)),K(e)}else if(null!==u){let e=0;for(let t of u)e+=t.spend;K(e)}},[L]),null!=C)return(0,s.jsx)(V.default,{});function W(){(0,M.b)();let e=(0,r.getProxyBaseUrl)();console.log("proxyBaseUrl:",e);let t=e?"".concat(e,"/sso/key/generate"):"/sso/key/generate";return console.log("Full URL:",t),window.location.href=t,null}if(null==N)return console.log("All cookies before redirect:",document.cookie),W(),null;try{let e=(0,R.o)(N);console.log("Decoded token:",e);let t=e.exp,l=Math.floor(Date.now()/1e3);if(t&&l>=t)return console.log("Token expired, redirecting to login"),W(),null}catch(e){return console.error("Error decoding token:",e),(0,M.b)(),W(),null}if(null==D)return null;if(null==t)return(0,s.jsx)("h1",{children:"User ID is not set"});if(null==l&&m("App Owner"),l&&"Admin Viewer"==l){let{Title:e,Paragraph:t}=F.default;return(0,s.jsxs)("div",{children:[(0,s.jsx)(e,{level:1,children:"Access Denied"}),(0,s.jsx)(t,{children:"Ask your proxy admin for access to create keys"})]})}return console.log("inside user dashboard, selected team",L),console.log("All cookies after redirect:",document.cookie),(0,s.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,s.jsx)(o.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,s.jsxs)(i.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[(0,s.jsx)(c.ZP,{userID:t,team:L,teams:d,userRole:l,accessToken:D,data:u,addKey:j,premiumUser:f},L?L.team_id:null),(0,s.jsx)(z,{userID:t,userRole:l,accessToken:D,selectedTeam:L||null,setSelectedTeam:U,selectedKeyAlias:B,setSelectedKeyAlias:J,data:u,setData:y,premiumUser:f,teams:d,currentOrg:k,setCurrentOrg:S,organizations:p,createClicked:w,setAccessToken:I})]})})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1971-00859360d0630018.js b/litellm/proxy/_experimental/out/_next/static/chunks/1971-92070b200b9aaa46.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/1971-00859360d0630018.js rename to litellm/proxy/_experimental/out/_next/static/chunks/1971-92070b200b9aaa46.js index 65bd9b529a..beb041d010 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1971-00859360d0630018.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1971-92070b200b9aaa46.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1971,5945],{58747:function(e,t,r){r.d(t,{Z:function(){return o}});var n=r(5853),a=r(2265);let o=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.createElement("path",{d:"M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z"}))}},4537:function(e,t,r){r.d(t,{Z:function(){return o}});var n=r(5853),a=r(2265);let o=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.createElement("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 10.5858L9.17157 7.75736L7.75736 9.17157L10.5858 12L7.75736 14.8284L9.17157 16.2426L12 13.4142L14.8284 16.2426L16.2426 14.8284L13.4142 12L16.2426 9.17157L14.8284 7.75736L12 10.5858Z"}))}},30150:function(e,t,r){r.d(t,{Z:function(){return h}});var n=r(5853),a=r(2265);let o=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),a.createElement("path",{d:"M12 4v16m8-8H4"}))},i=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),a.createElement("path",{d:"M20 12H4"}))};var s=r(13241),l=r(1153),c=r(69262);let u="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",d="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",h=a.forwardRef((e,t)=>{let{onSubmit:r,enableStepper:h=!0,disabled:m,onValueChange:f,onChange:p}=e,b=(0,n._T)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),g=(0,a.useRef)(null),[v,y]=a.useState(!1),w=a.useCallback(()=>{y(!0)},[]),x=a.useCallback(()=>{y(!1)},[]),[E,C]=a.useState(!1),O=a.useCallback(()=>{C(!0)},[]),k=a.useCallback(()=>{C(!1)},[]);return a.createElement(c.Z,Object.assign({type:"number",ref:(0,l.lq)([g,t]),disabled:m,makeInputClassName:(0,l.fn)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null===(t=g.current)||void 0===t?void 0:t.value;null==r||r(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&w(),"ArrowUp"===e.key&&O()},onKeyUp:e=>{"ArrowDown"===e.key&&x(),"ArrowUp"===e.key&&k()},onChange:e=>{m||(null==f||f(parseFloat(e.target.value)),null==p||p(e))},stepper:h?a.createElement("div",{className:(0,s.q)("flex justify-center align-middle")},a.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;m||(null===(e=g.current)||void 0===e||e.stepDown(),null===(t=g.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,s.q)(!m&&d,u,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},a.createElement(i,{"data-testid":"step-down",className:(v?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),a.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;m||(null===(e=g.current)||void 0===e||e.stepUp(),null===(t=g.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,s.q)(!m&&d,u,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},a.createElement(o,{"data-testid":"step-up",className:(E?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},b))});h.displayName="NumberInput"},27281:function(e,t,r){r.d(t,{Z:function(){return f}});var n=r(5853),a=r(58747),o=r(2265),i=r(4537),s=r(13241),l=r(1153),c=r(96398),u=r(51975),d=r(85238),h=r(44140);let m=(0,l.fn)("Select"),f=o.forwardRef((e,t)=>{let{defaultValue:r="",value:l,onValueChange:f,placeholder:p="Select...",disabled:b=!1,icon:g,enableClear:v=!1,required:y,children:w,name:x,error:E=!1,errorMessage:C,className:O,id:k}=e,S=(0,n._T)(e,["defaultValue","value","onValueChange","placeholder","disabled","icon","enableClear","required","children","name","error","errorMessage","className","id"]),P=(0,o.useRef)(null),N=o.Children.toArray(w),[T,q]=(0,h.Z)(r,l),M=(0,o.useMemo)(()=>{let e=o.Children.toArray(w).filter(o.isValidElement);return(0,c.sl)(e)},[w]);return o.createElement("div",{className:(0,s.q)("w-full min-w-[10rem] text-tremor-default",O)},o.createElement("div",{className:"relative"},o.createElement("select",{title:"select-hidden",required:y,className:(0,s.q)("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:T,onChange:e=>{e.preventDefault()},name:x,disabled:b,id:k,onFocus:()=>{let e=P.current;e&&e.focus()}},o.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},p),N.map(e=>{let t=e.props.value,r=e.props.children;return o.createElement("option",{className:"hidden",key:t,value:t},r)})),o.createElement(u.Ri,Object.assign({as:"div",ref:t,defaultValue:T,value:T,onChange:e=>{null==f||f(e),q(e)},disabled:b,id:k},S),e=>{var t;let{value:r}=e;return o.createElement(o.Fragment,null,o.createElement(u.Y4,{ref:P,className:(0,s.q)("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 border pr-8 py-2","border-tremor-border shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",g?"pl-10":"pl-3",(0,c.um)((0,c.Uh)(r),b,E))},g&&o.createElement("span",{className:(0,s.q)("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},o.createElement(g,{className:(0,s.q)(m("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),o.createElement("span",{className:"w-[90%] block truncate"},r&&null!==(t=M.get(r))&&void 0!==t?t:p),o.createElement("span",{className:(0,s.q)("absolute inset-y-0 right-0 flex items-center mr-3")},o.createElement(a.Z,{className:(0,s.q)(m("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),v&&T?o.createElement("button",{type:"button",className:(0,s.q)("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:e=>{e.preventDefault(),q(""),null==f||f("")}},o.createElement(i.Z,{className:(0,s.q)(m("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,o.createElement(d.u,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},o.createElement(u.O_,{anchor:"bottom start",className:(0,s.q)("z-10 w-[var(--button-width)] divide-y overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},w)))})),E&&C?o.createElement("p",{className:(0,s.q)("errorMessage","text-sm text-rose-500 mt-1")},C):null)});f.displayName="Select"},16853:function(e,t,r){r.d(t,{Z:function(){return u}});var n=r(5853),a=r(96398),o=r(44140),i=r(2265),s=r(13241),l=r(1153);let c=(0,l.fn)("Textarea"),u=i.forwardRef((e,t)=>{let{value:r,defaultValue:u="",placeholder:d="Type...",error:h=!1,errorMessage:m,disabled:f=!1,className:p,onChange:b,onValueChange:g,autoHeight:v=!1}=e,y=(0,n._T)(e,["value","defaultValue","placeholder","error","errorMessage","disabled","className","onChange","onValueChange","autoHeight"]),[w,x]=(0,o.Z)(u,r),E=(0,i.useRef)(null),C=(0,a.Uh)(w);return(0,i.useEffect)(()=>{let e=E.current;if(v&&e){e.style.height="60px";let t=e.scrollHeight;e.style.height=t+"px"}},[v,E,w]),i.createElement(i.Fragment,null,i.createElement("textarea",Object.assign({ref:(0,l.lq)([E,t]),value:w,placeholder:d,disabled:f,className:(0,s.q)(c("Textarea"),"w-full flex items-center outline-none rounded-tremor-default px-3 py-2 text-tremor-default focus:ring-2 transition duration-100 border","shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:shadow-dark-tremor-input focus:dark:border-dark-tremor-brand-subtle focus:dark:ring-dark-tremor-brand-muted",(0,a.um)(C,f,h),f?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content",p),"data-testid":"text-area",onChange:e=>{null==b||b(e),x(e.target.value),null==g||g(e.target.value)}},y)),h&&m?i.createElement("p",{className:(0,s.q)(c("errorMessage"),"text-sm text-red-500 mt-1")},m):null)});u.displayName="Textarea"},87452:function(e,t,r){r.d(t,{Z:function(){return d},r:function(){return u}});var n=r(5853),a=r(91054);r(42698),r(64016);var o=r(8710);r(33232);var i=r(13241),s=r(1153),l=r(2265);let c=(0,s.fn)("Accordion"),u=(0,l.createContext)({isOpen:!1}),d=l.forwardRef((e,t)=>{var r;let{defaultOpen:s=!1,children:d,className:h}=e,m=(0,n._T)(e,["defaultOpen","children","className"]),f=null!==(r=(0,l.useContext)(o.Z))&&void 0!==r?r:(0,i.q)("rounded-tremor-default border");return l.createElement(a.pJ,Object.assign({as:"div",ref:t,className:(0,i.q)(c("root"),"overflow-hidden","bg-tremor-background border-tremor-border","dark:bg-dark-tremor-background dark:border-dark-tremor-border",f,h),defaultOpen:s},m),e=>{let{open:t}=e;return l.createElement(u.Provider,{value:{isOpen:t}},d)})});d.displayName="Accordion"},88829:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(5853),a=r(2265),o=r(91054),i=r(13241);let s=(0,r(1153).fn)("AccordionBody"),l=a.forwardRef((e,t)=>{let{children:r,className:l}=e,c=(0,n._T)(e,["children","className"]);return a.createElement(o.pJ.Panel,Object.assign({ref:t,className:(0,i.q)(s("root"),"w-full text-tremor-default px-4 pb-3","text-tremor-content","dark:text-dark-tremor-content",l)},c),r)});l.displayName="AccordionBody"},72208:function(e,t,r){r.d(t,{Z:function(){return u}});var n=r(5853),a=r(2265),o=r(91054);let i=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.createElement("path",{d:"M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z"}))};var s=r(87452),l=r(13241);let c=(0,r(1153).fn)("AccordionHeader"),u=a.forwardRef((e,t)=>{let{children:r,className:u}=e,d=(0,n._T)(e,["children","className"]),{isOpen:h}=(0,a.useContext)(s.r);return a.createElement(o.pJ.Button,Object.assign({ref:t,className:(0,l.q)(c("root"),"w-full flex items-center justify-between px-4 py-3","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis",u)},d),a.createElement("div",{className:(0,l.q)(c("children"),"flex flex-1 text-inherit mr-4")},r),a.createElement("div",null,a.createElement(i,{className:(0,l.q)(c("arrowIcon"),"h-5 w-5 -mr-1","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle",h?"transition-all":"transition-all -rotate-180")})))});u.displayName="AccordionHeader"},67982:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(5853),a=r(13241),o=r(1153),i=r(2265);let s=(0,o.fn)("Divider"),l=i.forwardRef((e,t)=>{let{className:r,children:o}=e,l=(0,n._T)(e,["className","children"]);return i.createElement("div",Object.assign({ref:t,className:(0,a.q)(s("root"),"w-full mx-auto my-6 flex justify-between gap-3 items-center text-tremor-default","text-tremor-content","dark:text-dark-tremor-content",r)},l),o?i.createElement(i.Fragment,null,i.createElement("div",{className:(0,a.q)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}),i.createElement("div",{className:(0,a.q)("text-inherit whitespace-nowrap")},o),i.createElement("div",{className:(0,a.q)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")})):i.createElement("div",{className:(0,a.q)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}))});l.displayName="Divider"},44140:function(e,t,r){r.d(t,{Z:function(){return a}});var n=r(2265);let a=(e,t)=>{let r=void 0!==t,[a,o]=(0,n.useState)(e);return[r?t:a,e=>{r||o(e)}]}},5945:function(e,t,r){r.d(t,{Z:function(){return M}});var n=r(2265),a=r(36760),o=r.n(a),i=r(18694),s=r(71744),l=r(33759),c=r(50337),u=r(65869),d=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);at.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r},h=e=>{var{prefixCls:t,className:r,hoverable:a=!0}=e,i=d(e,["prefixCls","className","hoverable"]);let{getPrefixCls:l}=n.useContext(s.E_),c=l("card",t),u=o()("".concat(c,"-grid"),r,{["".concat(c,"-grid-hoverable")]:a});return n.createElement("div",Object.assign({},i,{className:u}))},m=r(93463),f=r(12918),p=r(99320),b=r(71140);let g=e=>{let{antCls:t,componentCls:r,headerHeight:n,headerPadding:a,tabsMarginBottom:o}=e;return Object.assign(Object.assign({display:"flex",justifyContent:"center",flexDirection:"column",minHeight:n,marginBottom:-1,padding:"0 ".concat((0,m.bf)(a)),color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.headerFontSize,background:e.headerBg,borderBottom:"".concat((0,m.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorderSecondary),borderRadius:"".concat((0,m.bf)(e.borderRadiusLG)," ").concat((0,m.bf)(e.borderRadiusLG)," 0 0")},(0,f.dF)()),{"&-wrapper":{width:"100%",display:"flex",alignItems:"center"},"&-title":Object.assign(Object.assign({display:"inline-block",flex:1},f.vS),{["\n > ".concat(r,"-typography,\n > ").concat(r,"-typography-edit-content\n ")]:{insetInlineStart:0,marginTop:0,marginBottom:0}}),["".concat(t,"-tabs-top")]:{clear:"both",marginBottom:o,color:e.colorText,fontWeight:"normal",fontSize:e.fontSize,"&-bar":{borderBottom:"".concat((0,m.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorderSecondary)}}})},v=e=>{let{cardPaddingBase:t,colorBorderSecondary:r,cardShadow:n,lineWidth:a}=e;return{width:"33.33%",padding:t,border:0,borderRadius:0,boxShadow:"\n ".concat((0,m.bf)(a)," 0 0 0 ").concat(r,",\n 0 ").concat((0,m.bf)(a)," 0 0 ").concat(r,",\n ").concat((0,m.bf)(a)," ").concat((0,m.bf)(a)," 0 0 ").concat(r,",\n ").concat((0,m.bf)(a)," 0 0 0 ").concat(r," inset,\n 0 ").concat((0,m.bf)(a)," 0 0 ").concat(r," inset;\n "),transition:"all ".concat(e.motionDurationMid),"&-hoverable:hover":{position:"relative",zIndex:1,boxShadow:n}}},y=e=>{let{componentCls:t,iconCls:r,actionsLiMargin:n,cardActionsIconSize:a,colorBorderSecondary:o,actionsBg:i}=e;return Object.assign(Object.assign({margin:0,padding:0,listStyle:"none",background:i,borderTop:"".concat((0,m.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(o),display:"flex",borderRadius:"0 0 ".concat((0,m.bf)(e.borderRadiusLG)," ").concat((0,m.bf)(e.borderRadiusLG))},(0,f.dF)()),{"& > li":{margin:n,color:e.colorTextDescription,textAlign:"center","> span":{position:"relative",display:"block",minWidth:e.calc(e.cardActionsIconSize).mul(2).equal(),fontSize:e.fontSize,lineHeight:e.lineHeight,cursor:"pointer","&:hover":{color:e.colorPrimary,transition:"color ".concat(e.motionDurationMid)},["a:not(".concat(t,"-btn), > ").concat(r)]:{display:"inline-block",width:"100%",color:e.colorIcon,lineHeight:(0,m.bf)(e.fontHeight),transition:"color ".concat(e.motionDurationMid),"&:hover":{color:e.colorPrimary}},["> ".concat(r)]:{fontSize:a,lineHeight:(0,m.bf)(e.calc(a).mul(e.lineHeight).equal())}},"&:not(:last-child)":{borderInlineEnd:"".concat((0,m.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(o)}}})},w=e=>Object.assign(Object.assign({margin:"".concat((0,m.bf)(e.calc(e.marginXXS).mul(-1).equal())," 0"),display:"flex"},(0,f.dF)()),{"&-avatar":{paddingInlineEnd:e.padding},"&-detail":{overflow:"hidden",flex:1,"> div:not(:last-child)":{marginBottom:e.marginXS}},"&-title":Object.assign({color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.fontSizeLG},f.vS),"&-description":{color:e.colorTextDescription}}),x=e=>{let{componentCls:t,colorFillAlter:r,headerPadding:n,bodyPadding:a}=e;return{["".concat(t,"-head")]:{padding:"0 ".concat((0,m.bf)(n)),background:r,"&-title":{fontSize:e.fontSize}},["".concat(t,"-body")]:{padding:"".concat((0,m.bf)(e.padding)," ").concat((0,m.bf)(a))}}},E=e=>{let{componentCls:t}=e;return{overflow:"hidden",["".concat(t,"-body")]:{userSelect:"none"}}},C=e=>{let{componentCls:t,cardShadow:r,cardHeadPadding:n,colorBorderSecondary:a,boxShadowTertiary:o,bodyPadding:i,extraColor:s}=e;return{[t]:Object.assign(Object.assign({},(0,f.Wf)(e)),{position:"relative",background:e.colorBgContainer,borderRadius:e.borderRadiusLG,["&:not(".concat(t,"-bordered)")]:{boxShadow:o},["".concat(t,"-head")]:g(e),["".concat(t,"-extra")]:{marginInlineStart:"auto",color:s,fontWeight:"normal",fontSize:e.fontSize},["".concat(t,"-body")]:{padding:i,borderRadius:"0 0 ".concat((0,m.bf)(e.borderRadiusLG)," ").concat((0,m.bf)(e.borderRadiusLG))},["".concat(t,"-grid")]:v(e),["".concat(t,"-cover")]:{"> *":{display:"block",width:"100%",borderRadius:"".concat((0,m.bf)(e.borderRadiusLG)," ").concat((0,m.bf)(e.borderRadiusLG)," 0 0")}},["".concat(t,"-actions")]:y(e),["".concat(t,"-meta")]:w(e)}),["".concat(t,"-bordered")]:{border:"".concat((0,m.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(a),["".concat(t,"-cover")]:{marginTop:-1,marginInlineStart:-1,marginInlineEnd:-1}},["".concat(t,"-hoverable")]:{cursor:"pointer",transition:"box-shadow ".concat(e.motionDurationMid,", border-color ").concat(e.motionDurationMid),"&:hover":{borderColor:"transparent",boxShadow:r}},["".concat(t,"-contain-grid")]:{borderRadius:"".concat((0,m.bf)(e.borderRadiusLG)," ").concat((0,m.bf)(e.borderRadiusLG)," 0 0 "),["".concat(t,"-body")]:{display:"flex",flexWrap:"wrap"},["&:not(".concat(t,"-loading) ").concat(t,"-body")]:{marginBlockStart:e.calc(e.lineWidth).mul(-1).equal(),marginInlineStart:e.calc(e.lineWidth).mul(-1).equal(),padding:0}},["".concat(t,"-contain-tabs")]:{["> div".concat(t,"-head")]:{minHeight:0,["".concat(t,"-head-title, ").concat(t,"-extra")]:{paddingTop:n}}},["".concat(t,"-type-inner")]:x(e),["".concat(t,"-loading")]:E(e),["".concat(t,"-rtl")]:{direction:"rtl"}}},O=e=>{let{componentCls:t,bodyPaddingSM:r,headerPaddingSM:n,headerHeightSM:a,headerFontSizeSM:o}=e;return{["".concat(t,"-small")]:{["> ".concat(t,"-head")]:{minHeight:a,padding:"0 ".concat((0,m.bf)(n)),fontSize:o,["> ".concat(t,"-head-wrapper")]:{["> ".concat(t,"-extra")]:{fontSize:e.fontSize}}},["> ".concat(t,"-body")]:{padding:r}},["".concat(t,"-small").concat(t,"-contain-tabs")]:{["> ".concat(t,"-head")]:{["".concat(t,"-head-title, ").concat(t,"-extra")]:{paddingTop:0,display:"flex",alignItems:"center"}}}}};var k=(0,p.I$)("Card",e=>{let t=(0,b.IX)(e,{cardShadow:e.boxShadowCard,cardHeadPadding:e.padding,cardPaddingBase:e.paddingLG,cardActionsIconSize:e.fontSize});return[C(t),O(t)]},e=>{var t,r;return{headerBg:"transparent",headerFontSize:e.fontSizeLG,headerFontSizeSM:e.fontSize,headerHeight:e.fontSizeLG*e.lineHeightLG+2*e.padding,headerHeightSM:e.fontSize*e.lineHeight+2*e.paddingXS,actionsBg:e.colorBgContainer,actionsLiMargin:"".concat(e.paddingSM,"px 0"),tabsMarginBottom:-e.padding-e.lineWidth,extraColor:e.colorText,bodyPaddingSM:12,headerPaddingSM:12,bodyPadding:null!==(t=e.bodyPadding)&&void 0!==t?t:e.paddingLG,headerPadding:null!==(r=e.headerPadding)&&void 0!==r?r:e.paddingLG}}),S=r(56250),P=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);at.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r};let N=e=>{let{actionClasses:t,actions:r=[],actionStyle:a}=e;return n.createElement("ul",{className:t,style:a},r.map((e,t)=>n.createElement("li",{style:{width:"".concat(100/r.length,"%")},key:"action-".concat(t)},n.createElement("span",null,e))))},T=n.forwardRef((e,t)=>{let r;let{prefixCls:a,className:d,rootClassName:m,style:f,extra:p,headStyle:b={},bodyStyle:g={},title:v,loading:y,bordered:w,variant:x,size:E,type:C,cover:O,actions:T,tabList:q,children:M,activeTabKey:j,defaultActiveTabKey:D,tabBarExtraContent:L,hoverable:R,tabProps:I={},classNames:_,styles:Z}=e,F=P(e,["prefixCls","className","rootClassName","style","extra","headStyle","bodyStyle","title","loading","bordered","variant","size","type","cover","actions","tabList","children","activeTabKey","defaultActiveTabKey","tabBarExtraContent","hoverable","tabProps","classNames","styles"]),{getPrefixCls:A,direction:z,card:H}=n.useContext(s.E_),[B]=(0,S.Z)("card",x,w),V=e=>{var t;return o()(null===(t=null==H?void 0:H.classNames)||void 0===t?void 0:t[e],null==_?void 0:_[e])},Q=e=>{var t;return Object.assign(Object.assign({},null===(t=null==H?void 0:H.styles)||void 0===t?void 0:t[e]),null==Z?void 0:Z[e])},G=n.useMemo(()=>{let e=!1;return n.Children.forEach(M,t=>{(null==t?void 0:t.type)===h&&(e=!0)}),e},[M]),K=A("card",a),[W,U,X]=k(K),J=n.createElement(c.Z,{loading:!0,active:!0,paragraph:{rows:4},title:!1},M),Y=void 0!==j,$=Object.assign(Object.assign({},I),{[Y?"activeKey":"defaultActiveKey"]:Y?j:D,tabBarExtraContent:L}),ee=(0,l.Z)(E),et=ee&&"default"!==ee?ee:"large",er=q?n.createElement(u.default,Object.assign({size:et},$,{className:"".concat(K,"-head-tabs"),onChange:t=>{var r;null===(r=e.onTabChange)||void 0===r||r.call(e,t)},items:q.map(e=>{var{tab:t}=e;return Object.assign({label:t},P(e,["tab"]))})})):null;if(v||p||er){let e=o()("".concat(K,"-head"),V("header")),t=o()("".concat(K,"-head-title"),V("title")),a=o()("".concat(K,"-extra"),V("extra")),i=Object.assign(Object.assign({},b),Q("header"));r=n.createElement("div",{className:e,style:i},n.createElement("div",{className:"".concat(K,"-head-wrapper")},v&&n.createElement("div",{className:t,style:Q("title")},v),p&&n.createElement("div",{className:a,style:Q("extra")},p)),er)}let en=o()("".concat(K,"-cover"),V("cover")),ea=O?n.createElement("div",{className:en,style:Q("cover")},O):null,eo=o()("".concat(K,"-body"),V("body")),ei=Object.assign(Object.assign({},g),Q("body")),es=n.createElement("div",{className:eo,style:ei},y?J:M),el=o()("".concat(K,"-actions"),V("actions")),ec=(null==T?void 0:T.length)?n.createElement(N,{actionClasses:el,actionStyle:Q("actions"),actions:T}):null,eu=(0,i.Z)(F,["onTabChange"]),ed=o()(K,null==H?void 0:H.className,{["".concat(K,"-loading")]:y,["".concat(K,"-bordered")]:"borderless"!==B,["".concat(K,"-hoverable")]:R,["".concat(K,"-contain-grid")]:G,["".concat(K,"-contain-tabs")]:null==q?void 0:q.length,["".concat(K,"-").concat(ee)]:ee,["".concat(K,"-type-").concat(C)]:!!C,["".concat(K,"-rtl")]:"rtl"===z},d,m,U,X),eh=Object.assign(Object.assign({},null==H?void 0:H.style),f);return W(n.createElement("div",Object.assign({ref:t},eu,{className:ed,style:eh}),r,ea,es,ec))});var q=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);at.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r};T.Grid=h,T.Meta=e=>{let{prefixCls:t,className:r,avatar:a,title:i,description:l}=e,c=q(e,["prefixCls","className","avatar","title","description"]),{getPrefixCls:u}=n.useContext(s.E_),d=u("card",t),h=o()("".concat(d,"-meta"),r),m=a?n.createElement("div",{className:"".concat(d,"-meta-avatar")},a):null,f=i?n.createElement("div",{className:"".concat(d,"-meta-title")},i):null,p=l?n.createElement("div",{className:"".concat(d,"-meta-description")},l):null,b=f||p?n.createElement("div",{className:"".concat(d,"-meta-detail")},f,p):null;return n.createElement("div",Object.assign({},c,{className:h}),m,b)};var M=T},77331:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});t.Z=a},44633:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});t.Z=a},15731:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=a},53410:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"}))});t.Z=a},23628:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"}))});t.Z=a},49084:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});t.Z=a},2894:function(e,t,r){r.d(t,{R:function(){return s},m:function(){return i}});var n=r(18238),a=r(7989),o=r(11255),i=class extends a.F{#e;#t;#r;#n;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#r=e.mutationCache,this.#t=[],this.state=e.state||s(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#r.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#a({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#n=(0,o.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#a({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#a({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});let n="pending"===this.state.status,a=!this.#n.canStart();try{if(n)t();else{this.#a({type:"pending",variables:e,isPaused:a}),await this.#r.config.onMutate?.(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#a({type:"pending",context:t,variables:e,isPaused:a})}let o=await this.#n.start();return await this.#r.config.onSuccess?.(o,e,this.state.context,this,r),await this.options.onSuccess?.(o,e,this.state.context,r),await this.#r.config.onSettled?.(o,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(o,null,e,this.state.context,r),this.#a({type:"success",data:o}),o}catch(t){try{throw await this.#r.config.onError?.(t,e,this.state.context,this,r),await this.options.onError?.(t,e,this.state.context,r),await this.#r.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(void 0,t,e,this.state.context,r),t}finally{this.#a({type:"error",error:t})}}finally{this.#r.runNext(this)}}#a(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),n.Vr.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#r.notify({mutation:this,type:"updated",action:e})})}};function s(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},21623:function(e,t,r){r.d(t,{S:function(){return p}});var n=r(45345),a=r(21733),o=r(18238),i=r(24112),s=class extends i.l{constructor(e={}){super(),this.config=e,this.#o=new Map}#o;build(e,t,r){let o=t.queryKey,i=t.queryHash??(0,n.Rm)(o,t),s=this.get(i);return s||(s=new a.A({client:e,queryKey:o,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(o)}),this.add(s)),s}add(e){this.#o.has(e.queryHash)||(this.#o.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#o.get(e.queryHash);t&&(e.destroy(),t===e&&this.#o.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){o.Vr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#o.get(e)}getAll(){return[...this.#o.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n._x)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,n._x)(e,t)):t}notify(e){o.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){o.Vr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){o.Vr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},l=r(2894),c=class extends i.l{constructor(e={}){super(),this.config=e,this.#i=new Set,this.#s=new Map,this.#l=0}#i;#s;#l;build(e,t,r){let n=new l.m({client:e,mutationCache:this,mutationId:++this.#l,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#i.add(e);let t=u(e);if("string"==typeof t){let r=this.#s.get(t);r?r.push(e):this.#s.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#i.delete(e)){let t=u(e);if("string"==typeof t){let r=this.#s.get(t);if(r){if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#s.delete(t)}}}this.notify({type:"removed",mutation:e})}canRun(e){let t=u(e);if("string"!=typeof t)return!0;{let r=this.#s.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=u(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#s.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){o.Vr.batch(()=>{this.#i.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#i.clear(),this.#s.clear()})}getAll(){return Array.from(this.#i)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n.X7)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,n.X7)(e,t))}notify(e){o.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return o.Vr.batch(()=>Promise.all(e.map(e=>e.continue().catch(n.ZT))))}};function u(e){return e.options.scope?.id}var d=r(87045),h=r(57853);function m(e){return{onFetch:(t,r)=>{let a=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],s=t.state.data?.pageParams||[],l={pages:[],pageParams:[]},c=0,u=async()=>{let r=!1,u=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",()=>{r=!0}),t.signal)})},d=(0,n.cG)(t.options,t.fetchOptions),h=async(e,a,o)=>{if(r)return Promise.reject();if(null==a&&e.pages.length)return Promise.resolve(e);let i=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:a,direction:o?"backward":"forward",meta:t.options.meta};return u(e),e})(),s=await d(i),{maxPages:l}=t.options,c=o?n.Ht:n.VX;return{pages:c(e.pages,s,l),pageParams:c(e.pageParams,a,l)}};if(o&&i.length){let e="backward"===o,t={pages:i,pageParams:s},r=(e?function(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}:f)(a,t);l=await h(t,r,e)}else{let t=e??i.length;do{let e=0===c?s[0]??a.initialPageParam:f(a,l);if(c>0&&null==e)break;l=await h(l,e),c++}while(ct.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function f(e,{pages:t,pageParams:r}){let n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}var p=class{#c;#r;#u;#d;#h;#m;#f;#p;constructor(e={}){this.#c=e.queryCache||new s,this.#r=e.mutationCache||new c,this.#u=e.defaultOptions||{},this.#d=new Map,this.#h=new Map,this.#m=0}mount(){this.#m++,1===this.#m&&(this.#f=d.j.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#c.onFocus())}),this.#p=h.N.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#c.onOnline())}))}unmount(){this.#m--,0===this.#m&&(this.#f?.(),this.#f=void 0,this.#p?.(),this.#p=void 0)}isFetching(e){return this.#c.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#r.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#c.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#c.build(this,t),a=r.state.data;return void 0===a?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime((0,n.KC)(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return this.#c.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let a=this.defaultQueryOptions({queryKey:e}),o=this.#c.get(a.queryHash),i=o?.state.data,s=(0,n.SE)(t,i);if(void 0!==s)return this.#c.build(this,a).setData(s,{...r,manual:!0})}setQueriesData(e,t,r){return o.Vr.batch(()=>this.#c.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#c.get(t.queryHash)?.state}removeQueries(e){let t=this.#c;o.Vr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#c;return o.Vr.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:!0,...t};return Promise.all(o.Vr.batch(()=>this.#c.findAll(e).map(e=>e.cancel(r)))).then(n.ZT).catch(n.ZT)}invalidateQueries(e,t={}){return o.Vr.batch(()=>(this.#c.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(o.Vr.batch(()=>this.#c.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(n.ZT)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(n.ZT)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#c.build(this,t);return r.isStaleByTime((0,n.KC)(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(n.ZT).catch(n.ZT)}fetchInfiniteQuery(e){return e.behavior=m(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(n.ZT).catch(n.ZT)}ensureInfiniteQueryData(e){return e.behavior=m(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return h.N.isOnline()?this.#r.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#c}getMutationCache(){return this.#r}getDefaultOptions(){return this.#u}setDefaultOptions(e){this.#u=e}setQueryDefaults(e,t){this.#d.set((0,n.Ym)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#d.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#h.set((0,n.Ym)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#h.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#u.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,n.Rm)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===n.CN&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#u.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#c.clear(),this.#r.clear()}}},19616:function(e,t,r){r.d(t,{G:function(){return i}});var n=r(2265);let a={enabled:!0,leading:!1,trailing:!0,wait:0,onExecute:()=>{}};class o{constructor(e,t){this.fn=e,this._canLeadingExecute=!0,this._isPending=!1,this._executionCount=0,this._options={...a,...t}}setOptions(e){return this._options={...this._options,...e},this._options.enabled||(this._isPending=!1),this._options}getOptions(){return this._options}maybeExecute(...e){this._options.leading&&this._canLeadingExecute&&(this.executeFunction(...e),this._canLeadingExecute=!1),(this._options.leading||this._options.trailing)&&(this._isPending=!0),this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=setTimeout(()=>{this._canLeadingExecute=!0,this._isPending=!1,this._options.trailing&&this.executeFunction(...e)},this._options.wait)}executeFunction(...e){this._options.enabled&&(this.fn(...e),this._executionCount++,this._options.onExecute(this))}cancel(){this._timeoutId&&(clearTimeout(this._timeoutId),this._canLeadingExecute=!0,this._isPending=!1)}getExecutionCount(){return this._executionCount}getIsPending(){return this._options.enabled&&this._isPending}}function i(e,t){let[r,a]=(0,n.useState)(e),i=function(e,t){let[r]=(0,n.useState)(()=>{var r;return Object.getOwnPropertyNames(Object.getPrototypeOf(r=new o(e,t))).filter(e=>"function"==typeof r[e]).reduce((e,t)=>{let n=r[t];return"function"==typeof n&&(e[t]=n.bind(r)),e},{})});return r.setOptions(t),r}(a,t);return[r,i.maybeExecute,i]}},91054:function(e,t,r){let n,a;r.d(t,{pJ:function(){return j}});var o,i=r(71049),s=r(11323),l=r(2265),c=r(66797),u=r(93980),d=r(65573),h=r(67561),m=r(98218),f=r(33443),p=r(28294),b=r(31370),g=r(72468),v=r(5664),y=r(38929);let w=null!=(o=l.startTransition)?o:function(e){e()};var x=r(52724),E=((n=E||{})[n.Open=0]="Open",n[n.Closed=1]="Closed",n),C=((a=C||{})[a.ToggleDisclosure=0]="ToggleDisclosure",a[a.CloseDisclosure=1]="CloseDisclosure",a[a.SetButtonId=2]="SetButtonId",a[a.SetPanelId=3]="SetPanelId",a[a.SetButtonElement=4]="SetButtonElement",a[a.SetPanelElement=5]="SetPanelElement",a);let O={0:e=>({...e,disclosureState:(0,g.E)(e.disclosureState,{0:1,1:0})}),1:e=>1===e.disclosureState?e:{...e,disclosureState:1},2:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},3:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId},4:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},5:(e,t)=>e.panelElement===t.element?e:{...e,panelElement:t.element}},k=(0,l.createContext)(null);function S(e){let t=(0,l.useContext)(k);if(null===t){let t=Error("<".concat(e," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,S),t}return t}k.displayName="DisclosureContext";let P=(0,l.createContext)(null);P.displayName="DisclosureAPIContext";let N=(0,l.createContext)(null);function T(e,t){return(0,g.E)(t.type,O,e,t)}N.displayName="DisclosurePanelContext";let q=l.Fragment,M=y.VN.RenderStrategy|y.VN.Static,j=Object.assign((0,y.yV)(function(e,t){let{defaultOpen:r=!1,...n}=e,a=(0,l.useRef)(null),o=(0,h.T)(t,(0,h.h)(e=>{a.current=e},void 0===e.as||e.as===l.Fragment)),i=(0,l.useReducer)(T,{disclosureState:r?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:s,buttonId:c},d]=i,m=(0,u.z)(e=>{d({type:1});let t=(0,v.r)(a);if(!t||!c)return;let r=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:t.getElementById(c):t.getElementById(c);null==r||r.focus()}),b=(0,l.useMemo)(()=>({close:m}),[m]),w=(0,l.useMemo)(()=>({open:0===s,close:m}),[s,m]),x=(0,y.L6)();return l.createElement(k.Provider,{value:i},l.createElement(P.Provider,{value:b},l.createElement(f.Z,{value:m},l.createElement(p.up,{value:(0,g.E)(s,{0:p.ZM.Open,1:p.ZM.Closed})},x({ourProps:{ref:o},theirProps:n,slot:w,defaultTag:q,name:"Disclosure"})))))}),{Button:(0,y.yV)(function(e,t){let r=(0,l.useId)(),{id:n="headlessui-disclosure-button-".concat(r),disabled:a=!1,autoFocus:o=!1,...m}=e,[f,p]=S("Disclosure.Button"),g=(0,l.useContext)(N),v=null!==g&&g===f.panelId,w=(0,l.useRef)(null),E=(0,h.T)(w,t,(0,u.z)(e=>{if(!v)return p({type:4,element:e})}));(0,l.useEffect)(()=>{if(!v)return p({type:2,buttonId:n}),()=>{p({type:2,buttonId:null})}},[n,p,v]);let C=(0,u.z)(e=>{var t;if(v){if(1===f.disclosureState)return;switch(e.key){case x.R.Space:case x.R.Enter:e.preventDefault(),e.stopPropagation(),p({type:0}),null==(t=f.buttonElement)||t.focus()}}else switch(e.key){case x.R.Space:case x.R.Enter:e.preventDefault(),e.stopPropagation(),p({type:0})}}),O=(0,u.z)(e=>{e.key===x.R.Space&&e.preventDefault()}),k=(0,u.z)(e=>{var t;(0,b.P)(e.currentTarget)||a||(v?(p({type:0}),null==(t=f.buttonElement)||t.focus()):p({type:0}))}),{isFocusVisible:P,focusProps:T}=(0,i.F)({autoFocus:o}),{isHovered:q,hoverProps:M}=(0,s.X)({isDisabled:a}),{pressed:j,pressProps:D}=(0,c.x)({disabled:a}),L=(0,l.useMemo)(()=>({open:0===f.disclosureState,hover:q,active:j,disabled:a,focus:P,autofocus:o}),[f,q,j,P,a,o]),R=(0,d.f)(e,f.buttonElement),I=v?(0,y.dG)({ref:E,type:R,disabled:a||void 0,autoFocus:o,onKeyDown:C,onClick:k},T,M,D):(0,y.dG)({ref:E,id:n,type:R,"aria-expanded":0===f.disclosureState,"aria-controls":f.panelElement?f.panelId:void 0,disabled:a||void 0,autoFocus:o,onKeyDown:C,onKeyUp:O,onClick:k},T,M,D);return(0,y.L6)()({ourProps:I,theirProps:m,slot:L,defaultTag:"button",name:"Disclosure.Button"})}),Panel:(0,y.yV)(function(e,t){let r=(0,l.useId)(),{id:n="headlessui-disclosure-panel-".concat(r),transition:a=!1,...o}=e,[i,s]=S("Disclosure.Panel"),{close:c}=function e(t){let r=(0,l.useContext)(P);if(null===r){let r=Error("<".concat(t," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return r}("Disclosure.Panel"),[d,f]=(0,l.useState)(null),b=(0,h.T)(t,(0,u.z)(e=>{w(()=>s({type:5,element:e}))}),f);(0,l.useEffect)(()=>(s({type:3,panelId:n}),()=>{s({type:3,panelId:null})}),[n,s]);let g=(0,p.oJ)(),[v,x]=(0,m.Y)(a,d,null!==g?(g&p.ZM.Open)===p.ZM.Open:0===i.disclosureState),E=(0,l.useMemo)(()=>({open:0===i.disclosureState,close:c}),[i.disclosureState,c]),C={ref:b,id:n,...(0,m.X)(x)},O=(0,y.L6)();return l.createElement(p.uu,null,l.createElement(N.Provider,{value:i.panelId},O({ourProps:C,theirProps:o,slot:E,defaultTag:"div",features:M,visible:v,name:"Disclosure.Panel"})))})})},85238:function(e,t,r){let n;r.d(t,{u:function(){return N}});var a=r(2265),o=r(59456),i=r(93980),s=r(25289),l=r(73389),c=r(43507),u=r(180),d=r(67561),h=r(98218),m=r(28294),f=r(95504),p=r(72468),b=r(38929);function g(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||(null!=(t=e.as)?t:C)!==a.Fragment||1===a.Children.count(e.children)}let v=(0,a.createContext)(null);v.displayName="TransitionContext";var y=((n=y||{}).Visible="visible",n.Hidden="hidden",n);let w=(0,a.createContext)(null);function x(e){return"children"in e?x(e.children):e.current.filter(e=>{let{el:t}=e;return null!==t.current}).filter(e=>{let{state:t}=e;return"visible"===t}).length>0}function E(e,t){let r=(0,c.E)(e),n=(0,a.useRef)([]),l=(0,s.t)(),u=(0,o.G)(),d=(0,i.z)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:b.l4.Hidden,a=n.current.findIndex(t=>{let{el:r}=t;return r===e});-1!==a&&((0,p.E)(t,{[b.l4.Unmount](){n.current.splice(a,1)},[b.l4.Hidden](){n.current[a].state="hidden"}}),u.microTask(()=>{var e;!x(n)&&l.current&&(null==(e=r.current)||e.call(r))}))}),h=(0,i.z)(e=>{let t=n.current.find(t=>{let{el:r}=t;return r===e});return t?"visible"!==t.state&&(t.state="visible"):n.current.push({el:e,state:"visible"}),()=>d(e,b.l4.Unmount)}),m=(0,a.useRef)([]),f=(0,a.useRef)(Promise.resolve()),g=(0,a.useRef)({enter:[],leave:[]}),v=(0,i.z)((e,r,n)=>{m.current.splice(0),t&&(t.chains.current[r]=t.chains.current[r].filter(t=>{let[r]=t;return r!==e})),null==t||t.chains.current[r].push([e,new Promise(e=>{m.current.push(e)})]),null==t||t.chains.current[r].push([e,new Promise(e=>{Promise.all(g.current[r].map(e=>{let[t,r]=e;return r})).then(()=>e())})]),"enter"===r?f.current=f.current.then(()=>null==t?void 0:t.wait.current).then(()=>n(r)):n(r)}),y=(0,i.z)((e,t,r)=>{Promise.all(g.current[t].splice(0).map(e=>{let[t,r]=e;return r})).then(()=>{var e;null==(e=m.current.shift())||e()}).then(()=>r(t))});return(0,a.useMemo)(()=>({children:n,register:h,unregister:d,onStart:v,onStop:y,wait:f,chains:g}),[h,d,n,v,y,g,f])}w.displayName="NestingContext";let C=a.Fragment,O=b.VN.RenderStrategy,k=(0,b.yV)(function(e,t){let{show:r,appear:n=!1,unmount:o=!0,...s}=e,c=(0,a.useRef)(null),h=g(e),f=(0,d.T)(...h?[c,t]:null===t?[]:[t]);(0,u.H)();let p=(0,m.oJ)();if(void 0===r&&null!==p&&(r=(p&m.ZM.Open)===m.ZM.Open),void 0===r)throw Error("A is used but it is missing a `show={true | false}` prop.");let[y,C]=(0,a.useState)(r?"visible":"hidden"),k=E(()=>{r||C("hidden")}),[P,N]=(0,a.useState)(!0),T=(0,a.useRef)([r]);(0,l.e)(()=>{!1!==P&&T.current[T.current.length-1]!==r&&(T.current.push(r),N(!1))},[T,r]);let q=(0,a.useMemo)(()=>({show:r,appear:n,initial:P}),[r,n,P]);(0,l.e)(()=>{r?C("visible"):x(k)||null===c.current||C("hidden")},[r,k]);let M={unmount:o},j=(0,i.z)(()=>{var t;P&&N(!1),null==(t=e.beforeEnter)||t.call(e)}),D=(0,i.z)(()=>{var t;P&&N(!1),null==(t=e.beforeLeave)||t.call(e)}),L=(0,b.L6)();return a.createElement(w.Provider,{value:k},a.createElement(v.Provider,{value:q},L({ourProps:{...M,as:a.Fragment,children:a.createElement(S,{ref:f,...M,...s,beforeEnter:j,beforeLeave:D})},theirProps:{},defaultTag:a.Fragment,features:O,visible:"visible"===y,name:"Transition"})))}),S=(0,b.yV)(function(e,t){var r,n;let{transition:o=!0,beforeEnter:s,afterEnter:c,beforeLeave:y,afterLeave:k,enter:S,enterFrom:P,enterTo:N,entered:T,leave:q,leaveFrom:M,leaveTo:j,...D}=e,[L,R]=(0,a.useState)(null),I=(0,a.useRef)(null),_=g(e),Z=(0,d.T)(..._?[I,t,R]:null===t?[]:[t]),F=null==(r=D.unmount)||r?b.l4.Unmount:b.l4.Hidden,{show:A,appear:z,initial:H}=function(){let e=(0,a.useContext)(v);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),[B,V]=(0,a.useState)(A?"visible":"hidden"),Q=function(){let e=(0,a.useContext)(w);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),{register:G,unregister:K}=Q;(0,l.e)(()=>G(I),[G,I]),(0,l.e)(()=>{if(F===b.l4.Hidden&&I.current){if(A&&"visible"!==B){V("visible");return}return(0,p.E)(B,{hidden:()=>K(I),visible:()=>G(I)})}},[B,I,G,K,A,F]);let W=(0,u.H)();(0,l.e)(()=>{if(_&&W&&"visible"===B&&null===I.current)throw Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[I,B,W,_]);let U=H&&!z,X=z&&A&&H,J=(0,a.useRef)(!1),Y=E(()=>{J.current||(V("hidden"),K(I))},Q),$=(0,i.z)(e=>{J.current=!0,Y.onStart(I,e?"enter":"leave",e=>{"enter"===e?null==s||s():"leave"===e&&(null==y||y())})}),ee=(0,i.z)(e=>{let t=e?"enter":"leave";J.current=!1,Y.onStop(I,t,e=>{"enter"===e?null==c||c():"leave"===e&&(null==k||k())}),"leave"!==t||x(Y)||(V("hidden"),K(I))});(0,a.useEffect)(()=>{_&&o||($(A),ee(A))},[A,_,o]);let et=!(!o||!_||!W||U),[,er]=(0,h.Y)(et,L,A,{start:$,end:ee}),en=(0,b.oA)({ref:Z,className:(null==(n=(0,f.A)(D.className,X&&S,X&&P,er.enter&&S,er.enter&&er.closed&&P,er.enter&&!er.closed&&N,er.leave&&q,er.leave&&!er.closed&&M,er.leave&&er.closed&&j,!er.transition&&A&&T))?void 0:n.trim())||void 0,...(0,h.X)(er)}),ea=0;"visible"===B&&(ea|=m.ZM.Open),"hidden"===B&&(ea|=m.ZM.Closed),er.enter&&(ea|=m.ZM.Opening),er.leave&&(ea|=m.ZM.Closing);let eo=(0,b.L6)();return a.createElement(w.Provider,{value:Y},a.createElement(m.up,{value:ea},eo({ourProps:en,theirProps:D,defaultTag:C,features:O,visible:"visible"===B,name:"Transition.Child"})))}),P=(0,b.yV)(function(e,t){let r=null!==(0,a.useContext)(v),n=null!==(0,m.oJ)();return a.createElement(a.Fragment,null,!r&&n?a.createElement(k,{ref:t,...e}):a.createElement(S,{ref:t,...e}))}),N=Object.assign(k,{Child:P,Root:k})},33443:function(e,t,r){r.d(t,{Z:function(){return o}});var n=r(2265);let a=(0,n.createContext)(()=>{});function o(e){let{value:t,children:r}=e;return n.createElement(a.Provider,{value:t},r)}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1971,5945],{58747:function(e,t,r){r.d(t,{Z:function(){return o}});var n=r(5853),a=r(2265);let o=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.createElement("path",{d:"M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z"}))}},4537:function(e,t,r){r.d(t,{Z:function(){return o}});var n=r(5853),a=r(2265);let o=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.createElement("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 10.5858L9.17157 7.75736L7.75736 9.17157L10.5858 12L7.75736 14.8284L9.17157 16.2426L12 13.4142L14.8284 16.2426L16.2426 14.8284L13.4142 12L16.2426 9.17157L14.8284 7.75736L12 10.5858Z"}))}},30150:function(e,t,r){r.d(t,{Z:function(){return h}});var n=r(5853),a=r(2265);let o=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),a.createElement("path",{d:"M12 4v16m8-8H4"}))},i=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),a.createElement("path",{d:"M20 12H4"}))};var s=r(13241),l=r(1153),c=r(69262);let u="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",d="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",h=a.forwardRef((e,t)=>{let{onSubmit:r,enableStepper:h=!0,disabled:m,onValueChange:f,onChange:p}=e,b=(0,n._T)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),g=(0,a.useRef)(null),[v,y]=a.useState(!1),w=a.useCallback(()=>{y(!0)},[]),x=a.useCallback(()=>{y(!1)},[]),[E,C]=a.useState(!1),O=a.useCallback(()=>{C(!0)},[]),k=a.useCallback(()=>{C(!1)},[]);return a.createElement(c.Z,Object.assign({type:"number",ref:(0,l.lq)([g,t]),disabled:m,makeInputClassName:(0,l.fn)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null===(t=g.current)||void 0===t?void 0:t.value;null==r||r(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&w(),"ArrowUp"===e.key&&O()},onKeyUp:e=>{"ArrowDown"===e.key&&x(),"ArrowUp"===e.key&&k()},onChange:e=>{m||(null==f||f(parseFloat(e.target.value)),null==p||p(e))},stepper:h?a.createElement("div",{className:(0,s.q)("flex justify-center align-middle")},a.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;m||(null===(e=g.current)||void 0===e||e.stepDown(),null===(t=g.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,s.q)(!m&&d,u,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},a.createElement(i,{"data-testid":"step-down",className:(v?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),a.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;m||(null===(e=g.current)||void 0===e||e.stepUp(),null===(t=g.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,s.q)(!m&&d,u,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},a.createElement(o,{"data-testid":"step-up",className:(E?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},b))});h.displayName="NumberInput"},27281:function(e,t,r){r.d(t,{Z:function(){return f}});var n=r(5853),a=r(58747),o=r(2265),i=r(4537),s=r(13241),l=r(1153),c=r(96398),u=r(51975),d=r(85238),h=r(44140);let m=(0,l.fn)("Select"),f=o.forwardRef((e,t)=>{let{defaultValue:r="",value:l,onValueChange:f,placeholder:p="Select...",disabled:b=!1,icon:g,enableClear:v=!1,required:y,children:w,name:x,error:E=!1,errorMessage:C,className:O,id:k}=e,S=(0,n._T)(e,["defaultValue","value","onValueChange","placeholder","disabled","icon","enableClear","required","children","name","error","errorMessage","className","id"]),P=(0,o.useRef)(null),N=o.Children.toArray(w),[T,q]=(0,h.Z)(r,l),M=(0,o.useMemo)(()=>{let e=o.Children.toArray(w).filter(o.isValidElement);return(0,c.sl)(e)},[w]);return o.createElement("div",{className:(0,s.q)("w-full min-w-[10rem] text-tremor-default",O)},o.createElement("div",{className:"relative"},o.createElement("select",{title:"select-hidden",required:y,className:(0,s.q)("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:T,onChange:e=>{e.preventDefault()},name:x,disabled:b,id:k,onFocus:()=>{let e=P.current;e&&e.focus()}},o.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},p),N.map(e=>{let t=e.props.value,r=e.props.children;return o.createElement("option",{className:"hidden",key:t,value:t},r)})),o.createElement(u.Ri,Object.assign({as:"div",ref:t,defaultValue:T,value:T,onChange:e=>{null==f||f(e),q(e)},disabled:b,id:k},S),e=>{var t;let{value:r}=e;return o.createElement(o.Fragment,null,o.createElement(u.Y4,{ref:P,className:(0,s.q)("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 border pr-8 py-2","border-tremor-border shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",g?"pl-10":"pl-3",(0,c.um)((0,c.Uh)(r),b,E))},g&&o.createElement("span",{className:(0,s.q)("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},o.createElement(g,{className:(0,s.q)(m("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),o.createElement("span",{className:"w-[90%] block truncate"},r&&null!==(t=M.get(r))&&void 0!==t?t:p),o.createElement("span",{className:(0,s.q)("absolute inset-y-0 right-0 flex items-center mr-3")},o.createElement(a.Z,{className:(0,s.q)(m("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),v&&T?o.createElement("button",{type:"button",className:(0,s.q)("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:e=>{e.preventDefault(),q(""),null==f||f("")}},o.createElement(i.Z,{className:(0,s.q)(m("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,o.createElement(d.u,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},o.createElement(u.O_,{anchor:"bottom start",className:(0,s.q)("z-10 w-[var(--button-width)] divide-y overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},w)))})),E&&C?o.createElement("p",{className:(0,s.q)("errorMessage","text-sm text-rose-500 mt-1")},C):null)});f.displayName="Select"},16853:function(e,t,r){r.d(t,{Z:function(){return u}});var n=r(5853),a=r(96398),o=r(44140),i=r(2265),s=r(13241),l=r(1153);let c=(0,l.fn)("Textarea"),u=i.forwardRef((e,t)=>{let{value:r,defaultValue:u="",placeholder:d="Type...",error:h=!1,errorMessage:m,disabled:f=!1,className:p,onChange:b,onValueChange:g,autoHeight:v=!1}=e,y=(0,n._T)(e,["value","defaultValue","placeholder","error","errorMessage","disabled","className","onChange","onValueChange","autoHeight"]),[w,x]=(0,o.Z)(u,r),E=(0,i.useRef)(null),C=(0,a.Uh)(w);return(0,i.useEffect)(()=>{let e=E.current;if(v&&e){e.style.height="60px";let t=e.scrollHeight;e.style.height=t+"px"}},[v,E,w]),i.createElement(i.Fragment,null,i.createElement("textarea",Object.assign({ref:(0,l.lq)([E,t]),value:w,placeholder:d,disabled:f,className:(0,s.q)(c("Textarea"),"w-full flex items-center outline-none rounded-tremor-default px-3 py-2 text-tremor-default focus:ring-2 transition duration-100 border","shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:shadow-dark-tremor-input focus:dark:border-dark-tremor-brand-subtle focus:dark:ring-dark-tremor-brand-muted",(0,a.um)(C,f,h),f?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content",p),"data-testid":"text-area",onChange:e=>{null==b||b(e),x(e.target.value),null==g||g(e.target.value)}},y)),h&&m?i.createElement("p",{className:(0,s.q)(c("errorMessage"),"text-sm text-red-500 mt-1")},m):null)});u.displayName="Textarea"},87452:function(e,t,r){r.d(t,{Z:function(){return d},r:function(){return u}});var n=r(5853),a=r(91054);r(42698),r(64016);var o=r(8710);r(33232);var i=r(13241),s=r(1153),l=r(2265);let c=(0,s.fn)("Accordion"),u=(0,l.createContext)({isOpen:!1}),d=l.forwardRef((e,t)=>{var r;let{defaultOpen:s=!1,children:d,className:h}=e,m=(0,n._T)(e,["defaultOpen","children","className"]),f=null!==(r=(0,l.useContext)(o.Z))&&void 0!==r?r:(0,i.q)("rounded-tremor-default border");return l.createElement(a.pJ,Object.assign({as:"div",ref:t,className:(0,i.q)(c("root"),"overflow-hidden","bg-tremor-background border-tremor-border","dark:bg-dark-tremor-background dark:border-dark-tremor-border",f,h),defaultOpen:s},m),e=>{let{open:t}=e;return l.createElement(u.Provider,{value:{isOpen:t}},d)})});d.displayName="Accordion"},88829:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(5853),a=r(2265),o=r(91054),i=r(13241);let s=(0,r(1153).fn)("AccordionBody"),l=a.forwardRef((e,t)=>{let{children:r,className:l}=e,c=(0,n._T)(e,["children","className"]);return a.createElement(o.pJ.Panel,Object.assign({ref:t,className:(0,i.q)(s("root"),"w-full text-tremor-default px-4 pb-3","text-tremor-content","dark:text-dark-tremor-content",l)},c),r)});l.displayName="AccordionBody"},72208:function(e,t,r){r.d(t,{Z:function(){return u}});var n=r(5853),a=r(2265),o=r(91054);let i=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.createElement("path",{d:"M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z"}))};var s=r(87452),l=r(13241);let c=(0,r(1153).fn)("AccordionHeader"),u=a.forwardRef((e,t)=>{let{children:r,className:u}=e,d=(0,n._T)(e,["children","className"]),{isOpen:h}=(0,a.useContext)(s.r);return a.createElement(o.pJ.Button,Object.assign({ref:t,className:(0,l.q)(c("root"),"w-full flex items-center justify-between px-4 py-3","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis",u)},d),a.createElement("div",{className:(0,l.q)(c("children"),"flex flex-1 text-inherit mr-4")},r),a.createElement("div",null,a.createElement(i,{className:(0,l.q)(c("arrowIcon"),"h-5 w-5 -mr-1","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle",h?"transition-all":"transition-all -rotate-180")})))});u.displayName="AccordionHeader"},67982:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(5853),a=r(13241),o=r(1153),i=r(2265);let s=(0,o.fn)("Divider"),l=i.forwardRef((e,t)=>{let{className:r,children:o}=e,l=(0,n._T)(e,["className","children"]);return i.createElement("div",Object.assign({ref:t,className:(0,a.q)(s("root"),"w-full mx-auto my-6 flex justify-between gap-3 items-center text-tremor-default","text-tremor-content","dark:text-dark-tremor-content",r)},l),o?i.createElement(i.Fragment,null,i.createElement("div",{className:(0,a.q)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}),i.createElement("div",{className:(0,a.q)("text-inherit whitespace-nowrap")},o),i.createElement("div",{className:(0,a.q)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")})):i.createElement("div",{className:(0,a.q)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}))});l.displayName="Divider"},44140:function(e,t,r){r.d(t,{Z:function(){return a}});var n=r(2265);let a=(e,t)=>{let r=void 0!==t,[a,o]=(0,n.useState)(e);return[r?t:a,e=>{r||o(e)}]}},5945:function(e,t,r){r.d(t,{Z:function(){return M}});var n=r(2265),a=r(36760),o=r.n(a),i=r(18694),s=r(71744),l=r(33759),c=r(50337),u=r(65869),d=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);at.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r},h=e=>{var{prefixCls:t,className:r,hoverable:a=!0}=e,i=d(e,["prefixCls","className","hoverable"]);let{getPrefixCls:l}=n.useContext(s.E_),c=l("card",t),u=o()("".concat(c,"-grid"),r,{["".concat(c,"-grid-hoverable")]:a});return n.createElement("div",Object.assign({},i,{className:u}))},m=r(93463),f=r(12918),p=r(99320),b=r(71140);let g=e=>{let{antCls:t,componentCls:r,headerHeight:n,headerPadding:a,tabsMarginBottom:o}=e;return Object.assign(Object.assign({display:"flex",justifyContent:"center",flexDirection:"column",minHeight:n,marginBottom:-1,padding:"0 ".concat((0,m.bf)(a)),color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.headerFontSize,background:e.headerBg,borderBottom:"".concat((0,m.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorderSecondary),borderRadius:"".concat((0,m.bf)(e.borderRadiusLG)," ").concat((0,m.bf)(e.borderRadiusLG)," 0 0")},(0,f.dF)()),{"&-wrapper":{width:"100%",display:"flex",alignItems:"center"},"&-title":Object.assign(Object.assign({display:"inline-block",flex:1},f.vS),{["\n > ".concat(r,"-typography,\n > ").concat(r,"-typography-edit-content\n ")]:{insetInlineStart:0,marginTop:0,marginBottom:0}}),["".concat(t,"-tabs-top")]:{clear:"both",marginBottom:o,color:e.colorText,fontWeight:"normal",fontSize:e.fontSize,"&-bar":{borderBottom:"".concat((0,m.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorderSecondary)}}})},v=e=>{let{cardPaddingBase:t,colorBorderSecondary:r,cardShadow:n,lineWidth:a}=e;return{width:"33.33%",padding:t,border:0,borderRadius:0,boxShadow:"\n ".concat((0,m.bf)(a)," 0 0 0 ").concat(r,",\n 0 ").concat((0,m.bf)(a)," 0 0 ").concat(r,",\n ").concat((0,m.bf)(a)," ").concat((0,m.bf)(a)," 0 0 ").concat(r,",\n ").concat((0,m.bf)(a)," 0 0 0 ").concat(r," inset,\n 0 ").concat((0,m.bf)(a)," 0 0 ").concat(r," inset;\n "),transition:"all ".concat(e.motionDurationMid),"&-hoverable:hover":{position:"relative",zIndex:1,boxShadow:n}}},y=e=>{let{componentCls:t,iconCls:r,actionsLiMargin:n,cardActionsIconSize:a,colorBorderSecondary:o,actionsBg:i}=e;return Object.assign(Object.assign({margin:0,padding:0,listStyle:"none",background:i,borderTop:"".concat((0,m.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(o),display:"flex",borderRadius:"0 0 ".concat((0,m.bf)(e.borderRadiusLG)," ").concat((0,m.bf)(e.borderRadiusLG))},(0,f.dF)()),{"& > li":{margin:n,color:e.colorTextDescription,textAlign:"center","> span":{position:"relative",display:"block",minWidth:e.calc(e.cardActionsIconSize).mul(2).equal(),fontSize:e.fontSize,lineHeight:e.lineHeight,cursor:"pointer","&:hover":{color:e.colorPrimary,transition:"color ".concat(e.motionDurationMid)},["a:not(".concat(t,"-btn), > ").concat(r)]:{display:"inline-block",width:"100%",color:e.colorIcon,lineHeight:(0,m.bf)(e.fontHeight),transition:"color ".concat(e.motionDurationMid),"&:hover":{color:e.colorPrimary}},["> ".concat(r)]:{fontSize:a,lineHeight:(0,m.bf)(e.calc(a).mul(e.lineHeight).equal())}},"&:not(:last-child)":{borderInlineEnd:"".concat((0,m.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(o)}}})},w=e=>Object.assign(Object.assign({margin:"".concat((0,m.bf)(e.calc(e.marginXXS).mul(-1).equal())," 0"),display:"flex"},(0,f.dF)()),{"&-avatar":{paddingInlineEnd:e.padding},"&-detail":{overflow:"hidden",flex:1,"> div:not(:last-child)":{marginBottom:e.marginXS}},"&-title":Object.assign({color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.fontSizeLG},f.vS),"&-description":{color:e.colorTextDescription}}),x=e=>{let{componentCls:t,colorFillAlter:r,headerPadding:n,bodyPadding:a}=e;return{["".concat(t,"-head")]:{padding:"0 ".concat((0,m.bf)(n)),background:r,"&-title":{fontSize:e.fontSize}},["".concat(t,"-body")]:{padding:"".concat((0,m.bf)(e.padding)," ").concat((0,m.bf)(a))}}},E=e=>{let{componentCls:t}=e;return{overflow:"hidden",["".concat(t,"-body")]:{userSelect:"none"}}},C=e=>{let{componentCls:t,cardShadow:r,cardHeadPadding:n,colorBorderSecondary:a,boxShadowTertiary:o,bodyPadding:i,extraColor:s}=e;return{[t]:Object.assign(Object.assign({},(0,f.Wf)(e)),{position:"relative",background:e.colorBgContainer,borderRadius:e.borderRadiusLG,["&:not(".concat(t,"-bordered)")]:{boxShadow:o},["".concat(t,"-head")]:g(e),["".concat(t,"-extra")]:{marginInlineStart:"auto",color:s,fontWeight:"normal",fontSize:e.fontSize},["".concat(t,"-body")]:{padding:i,borderRadius:"0 0 ".concat((0,m.bf)(e.borderRadiusLG)," ").concat((0,m.bf)(e.borderRadiusLG))},["".concat(t,"-grid")]:v(e),["".concat(t,"-cover")]:{"> *":{display:"block",width:"100%",borderRadius:"".concat((0,m.bf)(e.borderRadiusLG)," ").concat((0,m.bf)(e.borderRadiusLG)," 0 0")}},["".concat(t,"-actions")]:y(e),["".concat(t,"-meta")]:w(e)}),["".concat(t,"-bordered")]:{border:"".concat((0,m.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(a),["".concat(t,"-cover")]:{marginTop:-1,marginInlineStart:-1,marginInlineEnd:-1}},["".concat(t,"-hoverable")]:{cursor:"pointer",transition:"box-shadow ".concat(e.motionDurationMid,", border-color ").concat(e.motionDurationMid),"&:hover":{borderColor:"transparent",boxShadow:r}},["".concat(t,"-contain-grid")]:{borderRadius:"".concat((0,m.bf)(e.borderRadiusLG)," ").concat((0,m.bf)(e.borderRadiusLG)," 0 0 "),["".concat(t,"-body")]:{display:"flex",flexWrap:"wrap"},["&:not(".concat(t,"-loading) ").concat(t,"-body")]:{marginBlockStart:e.calc(e.lineWidth).mul(-1).equal(),marginInlineStart:e.calc(e.lineWidth).mul(-1).equal(),padding:0}},["".concat(t,"-contain-tabs")]:{["> div".concat(t,"-head")]:{minHeight:0,["".concat(t,"-head-title, ").concat(t,"-extra")]:{paddingTop:n}}},["".concat(t,"-type-inner")]:x(e),["".concat(t,"-loading")]:E(e),["".concat(t,"-rtl")]:{direction:"rtl"}}},O=e=>{let{componentCls:t,bodyPaddingSM:r,headerPaddingSM:n,headerHeightSM:a,headerFontSizeSM:o}=e;return{["".concat(t,"-small")]:{["> ".concat(t,"-head")]:{minHeight:a,padding:"0 ".concat((0,m.bf)(n)),fontSize:o,["> ".concat(t,"-head-wrapper")]:{["> ".concat(t,"-extra")]:{fontSize:e.fontSize}}},["> ".concat(t,"-body")]:{padding:r}},["".concat(t,"-small").concat(t,"-contain-tabs")]:{["> ".concat(t,"-head")]:{["".concat(t,"-head-title, ").concat(t,"-extra")]:{paddingTop:0,display:"flex",alignItems:"center"}}}}};var k=(0,p.I$)("Card",e=>{let t=(0,b.IX)(e,{cardShadow:e.boxShadowCard,cardHeadPadding:e.padding,cardPaddingBase:e.paddingLG,cardActionsIconSize:e.fontSize});return[C(t),O(t)]},e=>{var t,r;return{headerBg:"transparent",headerFontSize:e.fontSizeLG,headerFontSizeSM:e.fontSize,headerHeight:e.fontSizeLG*e.lineHeightLG+2*e.padding,headerHeightSM:e.fontSize*e.lineHeight+2*e.paddingXS,actionsBg:e.colorBgContainer,actionsLiMargin:"".concat(e.paddingSM,"px 0"),tabsMarginBottom:-e.padding-e.lineWidth,extraColor:e.colorText,bodyPaddingSM:12,headerPaddingSM:12,bodyPadding:null!==(t=e.bodyPadding)&&void 0!==t?t:e.paddingLG,headerPadding:null!==(r=e.headerPadding)&&void 0!==r?r:e.paddingLG}}),S=r(56250),P=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);at.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r};let N=e=>{let{actionClasses:t,actions:r=[],actionStyle:a}=e;return n.createElement("ul",{className:t,style:a},r.map((e,t)=>n.createElement("li",{style:{width:"".concat(100/r.length,"%")},key:"action-".concat(t)},n.createElement("span",null,e))))},T=n.forwardRef((e,t)=>{let r;let{prefixCls:a,className:d,rootClassName:m,style:f,extra:p,headStyle:b={},bodyStyle:g={},title:v,loading:y,bordered:w,variant:x,size:E,type:C,cover:O,actions:T,tabList:q,children:M,activeTabKey:j,defaultActiveTabKey:D,tabBarExtraContent:L,hoverable:R,tabProps:I={},classNames:_,styles:Z}=e,F=P(e,["prefixCls","className","rootClassName","style","extra","headStyle","bodyStyle","title","loading","bordered","variant","size","type","cover","actions","tabList","children","activeTabKey","defaultActiveTabKey","tabBarExtraContent","hoverable","tabProps","classNames","styles"]),{getPrefixCls:A,direction:z,card:H}=n.useContext(s.E_),[B]=(0,S.Z)("card",x,w),V=e=>{var t;return o()(null===(t=null==H?void 0:H.classNames)||void 0===t?void 0:t[e],null==_?void 0:_[e])},Q=e=>{var t;return Object.assign(Object.assign({},null===(t=null==H?void 0:H.styles)||void 0===t?void 0:t[e]),null==Z?void 0:Z[e])},G=n.useMemo(()=>{let e=!1;return n.Children.forEach(M,t=>{(null==t?void 0:t.type)===h&&(e=!0)}),e},[M]),K=A("card",a),[W,U,X]=k(K),J=n.createElement(c.Z,{loading:!0,active:!0,paragraph:{rows:4},title:!1},M),Y=void 0!==j,$=Object.assign(Object.assign({},I),{[Y?"activeKey":"defaultActiveKey"]:Y?j:D,tabBarExtraContent:L}),ee=(0,l.Z)(E),et=ee&&"default"!==ee?ee:"large",er=q?n.createElement(u.default,Object.assign({size:et},$,{className:"".concat(K,"-head-tabs"),onChange:t=>{var r;null===(r=e.onTabChange)||void 0===r||r.call(e,t)},items:q.map(e=>{var{tab:t}=e;return Object.assign({label:t},P(e,["tab"]))})})):null;if(v||p||er){let e=o()("".concat(K,"-head"),V("header")),t=o()("".concat(K,"-head-title"),V("title")),a=o()("".concat(K,"-extra"),V("extra")),i=Object.assign(Object.assign({},b),Q("header"));r=n.createElement("div",{className:e,style:i},n.createElement("div",{className:"".concat(K,"-head-wrapper")},v&&n.createElement("div",{className:t,style:Q("title")},v),p&&n.createElement("div",{className:a,style:Q("extra")},p)),er)}let en=o()("".concat(K,"-cover"),V("cover")),ea=O?n.createElement("div",{className:en,style:Q("cover")},O):null,eo=o()("".concat(K,"-body"),V("body")),ei=Object.assign(Object.assign({},g),Q("body")),es=n.createElement("div",{className:eo,style:ei},y?J:M),el=o()("".concat(K,"-actions"),V("actions")),ec=(null==T?void 0:T.length)?n.createElement(N,{actionClasses:el,actionStyle:Q("actions"),actions:T}):null,eu=(0,i.Z)(F,["onTabChange"]),ed=o()(K,null==H?void 0:H.className,{["".concat(K,"-loading")]:y,["".concat(K,"-bordered")]:"borderless"!==B,["".concat(K,"-hoverable")]:R,["".concat(K,"-contain-grid")]:G,["".concat(K,"-contain-tabs")]:null==q?void 0:q.length,["".concat(K,"-").concat(ee)]:ee,["".concat(K,"-type-").concat(C)]:!!C,["".concat(K,"-rtl")]:"rtl"===z},d,m,U,X),eh=Object.assign(Object.assign({},null==H?void 0:H.style),f);return W(n.createElement("div",Object.assign({ref:t},eu,{className:ed,style:eh}),r,ea,es,ec))});var q=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);at.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r};T.Grid=h,T.Meta=e=>{let{prefixCls:t,className:r,avatar:a,title:i,description:l}=e,c=q(e,["prefixCls","className","avatar","title","description"]),{getPrefixCls:u}=n.useContext(s.E_),d=u("card",t),h=o()("".concat(d,"-meta"),r),m=a?n.createElement("div",{className:"".concat(d,"-meta-avatar")},a):null,f=i?n.createElement("div",{className:"".concat(d,"-meta-title")},i):null,p=l?n.createElement("div",{className:"".concat(d,"-meta-description")},l):null,b=f||p?n.createElement("div",{className:"".concat(d,"-meta-detail")},f,p):null;return n.createElement("div",Object.assign({},c,{className:h}),m,b)};var M=T},10900:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});t.Z=a},44633:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});t.Z=a},15731:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=a},53410:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"}))});t.Z=a},23628:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"}))});t.Z=a},49084:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});t.Z=a},2894:function(e,t,r){r.d(t,{R:function(){return s},m:function(){return i}});var n=r(18238),a=r(7989),o=r(11255),i=class extends a.F{#e;#t;#r;#n;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#r=e.mutationCache,this.#t=[],this.state=e.state||s(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#r.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#a({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#n=(0,o.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#a({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#a({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});let n="pending"===this.state.status,a=!this.#n.canStart();try{if(n)t();else{this.#a({type:"pending",variables:e,isPaused:a}),await this.#r.config.onMutate?.(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#a({type:"pending",context:t,variables:e,isPaused:a})}let o=await this.#n.start();return await this.#r.config.onSuccess?.(o,e,this.state.context,this,r),await this.options.onSuccess?.(o,e,this.state.context,r),await this.#r.config.onSettled?.(o,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(o,null,e,this.state.context,r),this.#a({type:"success",data:o}),o}catch(t){try{throw await this.#r.config.onError?.(t,e,this.state.context,this,r),await this.options.onError?.(t,e,this.state.context,r),await this.#r.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(void 0,t,e,this.state.context,r),t}finally{this.#a({type:"error",error:t})}}finally{this.#r.runNext(this)}}#a(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),n.Vr.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#r.notify({mutation:this,type:"updated",action:e})})}};function s(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},21623:function(e,t,r){r.d(t,{S:function(){return p}});var n=r(45345),a=r(21733),o=r(18238),i=r(24112),s=class extends i.l{constructor(e={}){super(),this.config=e,this.#o=new Map}#o;build(e,t,r){let o=t.queryKey,i=t.queryHash??(0,n.Rm)(o,t),s=this.get(i);return s||(s=new a.A({client:e,queryKey:o,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(o)}),this.add(s)),s}add(e){this.#o.has(e.queryHash)||(this.#o.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#o.get(e.queryHash);t&&(e.destroy(),t===e&&this.#o.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){o.Vr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#o.get(e)}getAll(){return[...this.#o.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n._x)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,n._x)(e,t)):t}notify(e){o.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){o.Vr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){o.Vr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},l=r(2894),c=class extends i.l{constructor(e={}){super(),this.config=e,this.#i=new Set,this.#s=new Map,this.#l=0}#i;#s;#l;build(e,t,r){let n=new l.m({client:e,mutationCache:this,mutationId:++this.#l,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#i.add(e);let t=u(e);if("string"==typeof t){let r=this.#s.get(t);r?r.push(e):this.#s.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#i.delete(e)){let t=u(e);if("string"==typeof t){let r=this.#s.get(t);if(r){if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#s.delete(t)}}}this.notify({type:"removed",mutation:e})}canRun(e){let t=u(e);if("string"!=typeof t)return!0;{let r=this.#s.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=u(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#s.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){o.Vr.batch(()=>{this.#i.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#i.clear(),this.#s.clear()})}getAll(){return Array.from(this.#i)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n.X7)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,n.X7)(e,t))}notify(e){o.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return o.Vr.batch(()=>Promise.all(e.map(e=>e.continue().catch(n.ZT))))}};function u(e){return e.options.scope?.id}var d=r(87045),h=r(57853);function m(e){return{onFetch:(t,r)=>{let a=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],s=t.state.data?.pageParams||[],l={pages:[],pageParams:[]},c=0,u=async()=>{let r=!1,u=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",()=>{r=!0}),t.signal)})},d=(0,n.cG)(t.options,t.fetchOptions),h=async(e,a,o)=>{if(r)return Promise.reject();if(null==a&&e.pages.length)return Promise.resolve(e);let i=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:a,direction:o?"backward":"forward",meta:t.options.meta};return u(e),e})(),s=await d(i),{maxPages:l}=t.options,c=o?n.Ht:n.VX;return{pages:c(e.pages,s,l),pageParams:c(e.pageParams,a,l)}};if(o&&i.length){let e="backward"===o,t={pages:i,pageParams:s},r=(e?function(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}:f)(a,t);l=await h(t,r,e)}else{let t=e??i.length;do{let e=0===c?s[0]??a.initialPageParam:f(a,l);if(c>0&&null==e)break;l=await h(l,e),c++}while(ct.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function f(e,{pages:t,pageParams:r}){let n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}var p=class{#c;#r;#u;#d;#h;#m;#f;#p;constructor(e={}){this.#c=e.queryCache||new s,this.#r=e.mutationCache||new c,this.#u=e.defaultOptions||{},this.#d=new Map,this.#h=new Map,this.#m=0}mount(){this.#m++,1===this.#m&&(this.#f=d.j.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#c.onFocus())}),this.#p=h.N.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#c.onOnline())}))}unmount(){this.#m--,0===this.#m&&(this.#f?.(),this.#f=void 0,this.#p?.(),this.#p=void 0)}isFetching(e){return this.#c.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#r.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#c.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#c.build(this,t),a=r.state.data;return void 0===a?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime((0,n.KC)(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return this.#c.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let a=this.defaultQueryOptions({queryKey:e}),o=this.#c.get(a.queryHash),i=o?.state.data,s=(0,n.SE)(t,i);if(void 0!==s)return this.#c.build(this,a).setData(s,{...r,manual:!0})}setQueriesData(e,t,r){return o.Vr.batch(()=>this.#c.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#c.get(t.queryHash)?.state}removeQueries(e){let t=this.#c;o.Vr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#c;return o.Vr.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:!0,...t};return Promise.all(o.Vr.batch(()=>this.#c.findAll(e).map(e=>e.cancel(r)))).then(n.ZT).catch(n.ZT)}invalidateQueries(e,t={}){return o.Vr.batch(()=>(this.#c.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(o.Vr.batch(()=>this.#c.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(n.ZT)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(n.ZT)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#c.build(this,t);return r.isStaleByTime((0,n.KC)(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(n.ZT).catch(n.ZT)}fetchInfiniteQuery(e){return e.behavior=m(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(n.ZT).catch(n.ZT)}ensureInfiniteQueryData(e){return e.behavior=m(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return h.N.isOnline()?this.#r.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#c}getMutationCache(){return this.#r}getDefaultOptions(){return this.#u}setDefaultOptions(e){this.#u=e}setQueryDefaults(e,t){this.#d.set((0,n.Ym)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#d.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#h.set((0,n.Ym)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#h.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#u.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,n.Rm)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===n.CN&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#u.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#c.clear(),this.#r.clear()}}},19616:function(e,t,r){r.d(t,{G:function(){return i}});var n=r(2265);let a={enabled:!0,leading:!1,trailing:!0,wait:0,onExecute:()=>{}};class o{constructor(e,t){this.fn=e,this._canLeadingExecute=!0,this._isPending=!1,this._executionCount=0,this._options={...a,...t}}setOptions(e){return this._options={...this._options,...e},this._options.enabled||(this._isPending=!1),this._options}getOptions(){return this._options}maybeExecute(...e){this._options.leading&&this._canLeadingExecute&&(this.executeFunction(...e),this._canLeadingExecute=!1),(this._options.leading||this._options.trailing)&&(this._isPending=!0),this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=setTimeout(()=>{this._canLeadingExecute=!0,this._isPending=!1,this._options.trailing&&this.executeFunction(...e)},this._options.wait)}executeFunction(...e){this._options.enabled&&(this.fn(...e),this._executionCount++,this._options.onExecute(this))}cancel(){this._timeoutId&&(clearTimeout(this._timeoutId),this._canLeadingExecute=!0,this._isPending=!1)}getExecutionCount(){return this._executionCount}getIsPending(){return this._options.enabled&&this._isPending}}function i(e,t){let[r,a]=(0,n.useState)(e),i=function(e,t){let[r]=(0,n.useState)(()=>{var r;return Object.getOwnPropertyNames(Object.getPrototypeOf(r=new o(e,t))).filter(e=>"function"==typeof r[e]).reduce((e,t)=>{let n=r[t];return"function"==typeof n&&(e[t]=n.bind(r)),e},{})});return r.setOptions(t),r}(a,t);return[r,i.maybeExecute,i]}},91054:function(e,t,r){let n,a;r.d(t,{pJ:function(){return j}});var o,i=r(71049),s=r(11323),l=r(2265),c=r(66797),u=r(93980),d=r(65573),h=r(67561),m=r(98218),f=r(33443),p=r(28294),b=r(31370),g=r(72468),v=r(5664),y=r(38929);let w=null!=(o=l.startTransition)?o:function(e){e()};var x=r(52724),E=((n=E||{})[n.Open=0]="Open",n[n.Closed=1]="Closed",n),C=((a=C||{})[a.ToggleDisclosure=0]="ToggleDisclosure",a[a.CloseDisclosure=1]="CloseDisclosure",a[a.SetButtonId=2]="SetButtonId",a[a.SetPanelId=3]="SetPanelId",a[a.SetButtonElement=4]="SetButtonElement",a[a.SetPanelElement=5]="SetPanelElement",a);let O={0:e=>({...e,disclosureState:(0,g.E)(e.disclosureState,{0:1,1:0})}),1:e=>1===e.disclosureState?e:{...e,disclosureState:1},2:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},3:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId},4:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},5:(e,t)=>e.panelElement===t.element?e:{...e,panelElement:t.element}},k=(0,l.createContext)(null);function S(e){let t=(0,l.useContext)(k);if(null===t){let t=Error("<".concat(e," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,S),t}return t}k.displayName="DisclosureContext";let P=(0,l.createContext)(null);P.displayName="DisclosureAPIContext";let N=(0,l.createContext)(null);function T(e,t){return(0,g.E)(t.type,O,e,t)}N.displayName="DisclosurePanelContext";let q=l.Fragment,M=y.VN.RenderStrategy|y.VN.Static,j=Object.assign((0,y.yV)(function(e,t){let{defaultOpen:r=!1,...n}=e,a=(0,l.useRef)(null),o=(0,h.T)(t,(0,h.h)(e=>{a.current=e},void 0===e.as||e.as===l.Fragment)),i=(0,l.useReducer)(T,{disclosureState:r?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:s,buttonId:c},d]=i,m=(0,u.z)(e=>{d({type:1});let t=(0,v.r)(a);if(!t||!c)return;let r=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:t.getElementById(c):t.getElementById(c);null==r||r.focus()}),b=(0,l.useMemo)(()=>({close:m}),[m]),w=(0,l.useMemo)(()=>({open:0===s,close:m}),[s,m]),x=(0,y.L6)();return l.createElement(k.Provider,{value:i},l.createElement(P.Provider,{value:b},l.createElement(f.Z,{value:m},l.createElement(p.up,{value:(0,g.E)(s,{0:p.ZM.Open,1:p.ZM.Closed})},x({ourProps:{ref:o},theirProps:n,slot:w,defaultTag:q,name:"Disclosure"})))))}),{Button:(0,y.yV)(function(e,t){let r=(0,l.useId)(),{id:n="headlessui-disclosure-button-".concat(r),disabled:a=!1,autoFocus:o=!1,...m}=e,[f,p]=S("Disclosure.Button"),g=(0,l.useContext)(N),v=null!==g&&g===f.panelId,w=(0,l.useRef)(null),E=(0,h.T)(w,t,(0,u.z)(e=>{if(!v)return p({type:4,element:e})}));(0,l.useEffect)(()=>{if(!v)return p({type:2,buttonId:n}),()=>{p({type:2,buttonId:null})}},[n,p,v]);let C=(0,u.z)(e=>{var t;if(v){if(1===f.disclosureState)return;switch(e.key){case x.R.Space:case x.R.Enter:e.preventDefault(),e.stopPropagation(),p({type:0}),null==(t=f.buttonElement)||t.focus()}}else switch(e.key){case x.R.Space:case x.R.Enter:e.preventDefault(),e.stopPropagation(),p({type:0})}}),O=(0,u.z)(e=>{e.key===x.R.Space&&e.preventDefault()}),k=(0,u.z)(e=>{var t;(0,b.P)(e.currentTarget)||a||(v?(p({type:0}),null==(t=f.buttonElement)||t.focus()):p({type:0}))}),{isFocusVisible:P,focusProps:T}=(0,i.F)({autoFocus:o}),{isHovered:q,hoverProps:M}=(0,s.X)({isDisabled:a}),{pressed:j,pressProps:D}=(0,c.x)({disabled:a}),L=(0,l.useMemo)(()=>({open:0===f.disclosureState,hover:q,active:j,disabled:a,focus:P,autofocus:o}),[f,q,j,P,a,o]),R=(0,d.f)(e,f.buttonElement),I=v?(0,y.dG)({ref:E,type:R,disabled:a||void 0,autoFocus:o,onKeyDown:C,onClick:k},T,M,D):(0,y.dG)({ref:E,id:n,type:R,"aria-expanded":0===f.disclosureState,"aria-controls":f.panelElement?f.panelId:void 0,disabled:a||void 0,autoFocus:o,onKeyDown:C,onKeyUp:O,onClick:k},T,M,D);return(0,y.L6)()({ourProps:I,theirProps:m,slot:L,defaultTag:"button",name:"Disclosure.Button"})}),Panel:(0,y.yV)(function(e,t){let r=(0,l.useId)(),{id:n="headlessui-disclosure-panel-".concat(r),transition:a=!1,...o}=e,[i,s]=S("Disclosure.Panel"),{close:c}=function e(t){let r=(0,l.useContext)(P);if(null===r){let r=Error("<".concat(t," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return r}("Disclosure.Panel"),[d,f]=(0,l.useState)(null),b=(0,h.T)(t,(0,u.z)(e=>{w(()=>s({type:5,element:e}))}),f);(0,l.useEffect)(()=>(s({type:3,panelId:n}),()=>{s({type:3,panelId:null})}),[n,s]);let g=(0,p.oJ)(),[v,x]=(0,m.Y)(a,d,null!==g?(g&p.ZM.Open)===p.ZM.Open:0===i.disclosureState),E=(0,l.useMemo)(()=>({open:0===i.disclosureState,close:c}),[i.disclosureState,c]),C={ref:b,id:n,...(0,m.X)(x)},O=(0,y.L6)();return l.createElement(p.uu,null,l.createElement(N.Provider,{value:i.panelId},O({ourProps:C,theirProps:o,slot:E,defaultTag:"div",features:M,visible:v,name:"Disclosure.Panel"})))})})},85238:function(e,t,r){let n;r.d(t,{u:function(){return N}});var a=r(2265),o=r(59456),i=r(93980),s=r(25289),l=r(73389),c=r(43507),u=r(180),d=r(67561),h=r(98218),m=r(28294),f=r(95504),p=r(72468),b=r(38929);function g(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||(null!=(t=e.as)?t:C)!==a.Fragment||1===a.Children.count(e.children)}let v=(0,a.createContext)(null);v.displayName="TransitionContext";var y=((n=y||{}).Visible="visible",n.Hidden="hidden",n);let w=(0,a.createContext)(null);function x(e){return"children"in e?x(e.children):e.current.filter(e=>{let{el:t}=e;return null!==t.current}).filter(e=>{let{state:t}=e;return"visible"===t}).length>0}function E(e,t){let r=(0,c.E)(e),n=(0,a.useRef)([]),l=(0,s.t)(),u=(0,o.G)(),d=(0,i.z)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:b.l4.Hidden,a=n.current.findIndex(t=>{let{el:r}=t;return r===e});-1!==a&&((0,p.E)(t,{[b.l4.Unmount](){n.current.splice(a,1)},[b.l4.Hidden](){n.current[a].state="hidden"}}),u.microTask(()=>{var e;!x(n)&&l.current&&(null==(e=r.current)||e.call(r))}))}),h=(0,i.z)(e=>{let t=n.current.find(t=>{let{el:r}=t;return r===e});return t?"visible"!==t.state&&(t.state="visible"):n.current.push({el:e,state:"visible"}),()=>d(e,b.l4.Unmount)}),m=(0,a.useRef)([]),f=(0,a.useRef)(Promise.resolve()),g=(0,a.useRef)({enter:[],leave:[]}),v=(0,i.z)((e,r,n)=>{m.current.splice(0),t&&(t.chains.current[r]=t.chains.current[r].filter(t=>{let[r]=t;return r!==e})),null==t||t.chains.current[r].push([e,new Promise(e=>{m.current.push(e)})]),null==t||t.chains.current[r].push([e,new Promise(e=>{Promise.all(g.current[r].map(e=>{let[t,r]=e;return r})).then(()=>e())})]),"enter"===r?f.current=f.current.then(()=>null==t?void 0:t.wait.current).then(()=>n(r)):n(r)}),y=(0,i.z)((e,t,r)=>{Promise.all(g.current[t].splice(0).map(e=>{let[t,r]=e;return r})).then(()=>{var e;null==(e=m.current.shift())||e()}).then(()=>r(t))});return(0,a.useMemo)(()=>({children:n,register:h,unregister:d,onStart:v,onStop:y,wait:f,chains:g}),[h,d,n,v,y,g,f])}w.displayName="NestingContext";let C=a.Fragment,O=b.VN.RenderStrategy,k=(0,b.yV)(function(e,t){let{show:r,appear:n=!1,unmount:o=!0,...s}=e,c=(0,a.useRef)(null),h=g(e),f=(0,d.T)(...h?[c,t]:null===t?[]:[t]);(0,u.H)();let p=(0,m.oJ)();if(void 0===r&&null!==p&&(r=(p&m.ZM.Open)===m.ZM.Open),void 0===r)throw Error("A is used but it is missing a `show={true | false}` prop.");let[y,C]=(0,a.useState)(r?"visible":"hidden"),k=E(()=>{r||C("hidden")}),[P,N]=(0,a.useState)(!0),T=(0,a.useRef)([r]);(0,l.e)(()=>{!1!==P&&T.current[T.current.length-1]!==r&&(T.current.push(r),N(!1))},[T,r]);let q=(0,a.useMemo)(()=>({show:r,appear:n,initial:P}),[r,n,P]);(0,l.e)(()=>{r?C("visible"):x(k)||null===c.current||C("hidden")},[r,k]);let M={unmount:o},j=(0,i.z)(()=>{var t;P&&N(!1),null==(t=e.beforeEnter)||t.call(e)}),D=(0,i.z)(()=>{var t;P&&N(!1),null==(t=e.beforeLeave)||t.call(e)}),L=(0,b.L6)();return a.createElement(w.Provider,{value:k},a.createElement(v.Provider,{value:q},L({ourProps:{...M,as:a.Fragment,children:a.createElement(S,{ref:f,...M,...s,beforeEnter:j,beforeLeave:D})},theirProps:{},defaultTag:a.Fragment,features:O,visible:"visible"===y,name:"Transition"})))}),S=(0,b.yV)(function(e,t){var r,n;let{transition:o=!0,beforeEnter:s,afterEnter:c,beforeLeave:y,afterLeave:k,enter:S,enterFrom:P,enterTo:N,entered:T,leave:q,leaveFrom:M,leaveTo:j,...D}=e,[L,R]=(0,a.useState)(null),I=(0,a.useRef)(null),_=g(e),Z=(0,d.T)(..._?[I,t,R]:null===t?[]:[t]),F=null==(r=D.unmount)||r?b.l4.Unmount:b.l4.Hidden,{show:A,appear:z,initial:H}=function(){let e=(0,a.useContext)(v);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),[B,V]=(0,a.useState)(A?"visible":"hidden"),Q=function(){let e=(0,a.useContext)(w);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),{register:G,unregister:K}=Q;(0,l.e)(()=>G(I),[G,I]),(0,l.e)(()=>{if(F===b.l4.Hidden&&I.current){if(A&&"visible"!==B){V("visible");return}return(0,p.E)(B,{hidden:()=>K(I),visible:()=>G(I)})}},[B,I,G,K,A,F]);let W=(0,u.H)();(0,l.e)(()=>{if(_&&W&&"visible"===B&&null===I.current)throw Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[I,B,W,_]);let U=H&&!z,X=z&&A&&H,J=(0,a.useRef)(!1),Y=E(()=>{J.current||(V("hidden"),K(I))},Q),$=(0,i.z)(e=>{J.current=!0,Y.onStart(I,e?"enter":"leave",e=>{"enter"===e?null==s||s():"leave"===e&&(null==y||y())})}),ee=(0,i.z)(e=>{let t=e?"enter":"leave";J.current=!1,Y.onStop(I,t,e=>{"enter"===e?null==c||c():"leave"===e&&(null==k||k())}),"leave"!==t||x(Y)||(V("hidden"),K(I))});(0,a.useEffect)(()=>{_&&o||($(A),ee(A))},[A,_,o]);let et=!(!o||!_||!W||U),[,er]=(0,h.Y)(et,L,A,{start:$,end:ee}),en=(0,b.oA)({ref:Z,className:(null==(n=(0,f.A)(D.className,X&&S,X&&P,er.enter&&S,er.enter&&er.closed&&P,er.enter&&!er.closed&&N,er.leave&&q,er.leave&&!er.closed&&M,er.leave&&er.closed&&j,!er.transition&&A&&T))?void 0:n.trim())||void 0,...(0,h.X)(er)}),ea=0;"visible"===B&&(ea|=m.ZM.Open),"hidden"===B&&(ea|=m.ZM.Closed),er.enter&&(ea|=m.ZM.Opening),er.leave&&(ea|=m.ZM.Closing);let eo=(0,b.L6)();return a.createElement(w.Provider,{value:Y},a.createElement(m.up,{value:ea},eo({ourProps:en,theirProps:D,defaultTag:C,features:O,visible:"visible"===B,name:"Transition.Child"})))}),P=(0,b.yV)(function(e,t){let r=null!==(0,a.useContext)(v),n=null!==(0,m.oJ)();return a.createElement(a.Fragment,null,!r&&n?a.createElement(k,{ref:t,...e}):a.createElement(S,{ref:t,...e}))}),N=Object.assign(k,{Child:P,Root:k})},33443:function(e,t,r){r.d(t,{Z:function(){return o}});var n=r(2265);let a=(0,n.createContext)(()=>{});function o(e){let{value:t,children:r}=e;return n.createElement(a.Provider,{value:t},r)}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1994-6637a121c9ee1602.js b/litellm/proxy/_experimental/out/_next/static/chunks/1994-6637a121c9ee1602.js new file mode 100644 index 0000000000..90f29480d6 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1994-6637a121c9ee1602.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1994],{4156:function(e,n,t){t.d(n,{Z:function(){return O}});var o=t(2265),a=t(36760),r=t.n(a),c=t(20873),l=t(28791),i=t(6694),s=t(34709),u=t(71744),d=t(86586),b=t(64024),p=t(39109);let f=o.createContext(null);var v=t(23159),m=t(66531),h=function(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>n.indexOf(o)&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);an.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(t[o[a]]=e[o[a]]);return t};let g=o.forwardRef((e,n)=>{var t;let{prefixCls:a,className:g,rootClassName:C,children:y,indeterminate:k=!1,style:x,onMouseEnter:O,onMouseLeave:E,skipGroup:S=!1,disabled:w}=e,Z=h(e,["prefixCls","className","rootClassName","children","indeterminate","style","onMouseEnter","onMouseLeave","skipGroup","disabled"]),{getPrefixCls:P,direction:N,checkbox:j}=o.useContext(u.E_),I=o.useContext(f),{isFormItemInput:R}=o.useContext(p.aM),z=o.useContext(d.Z),B=null!==(t=(null==I?void 0:I.disabled)||w)&&void 0!==t?t:z,D=o.useRef(Z.value),M=o.useRef(null),_=(0,l.sQ)(n,M);o.useEffect(()=>{null==I||I.registerValue(Z.value)},[]),o.useEffect(()=>{if(!S)return Z.value!==D.current&&(null==I||I.cancelValue(D.current),null==I||I.registerValue(Z.value),D.current=Z.value),()=>null==I?void 0:I.cancelValue(Z.value)},[Z.value]),o.useEffect(()=>{var e;(null===(e=M.current)||void 0===e?void 0:e.input)&&(M.current.input.indeterminate=k)},[k]);let W=P("checkbox",a),q=(0,b.Z)(W),[H,T,G]=(0,v.ZP)(W,q),V=Object.assign({},Z);I&&!S&&(V.onChange=function(){for(var e=arguments.length,n=Array(e),t=0;tn.indexOf(o)&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);an.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(t[o[a]]=e[o[a]]);return t};let x=o.forwardRef((e,n)=>{let{defaultValue:t,children:a,options:c=[],prefixCls:l,className:i,rootClassName:s,style:d,onChange:p}=e,m=k(e,["defaultValue","children","options","prefixCls","className","rootClassName","style","onChange"]),{getPrefixCls:h,direction:x}=o.useContext(u.E_),[O,E]=o.useState(m.value||t||[]),[S,w]=o.useState([]);o.useEffect(()=>{"value"in m&&E(m.value||[])},[m.value]);let Z=o.useMemo(()=>c.map(e=>"string"==typeof e||"number"==typeof e?{label:e,value:e}:e),[c]),P=e=>{w(n=>n.filter(n=>n!==e))},N=e=>{w(n=>[].concat((0,C.Z)(n),[e]))},j=e=>{let n=O.indexOf(e.value),t=(0,C.Z)(O);-1===n?t.push(e.value):t.splice(n,1),"value"in m||E(t),null==p||p(t.filter(e=>S.includes(e)).sort((e,n)=>Z.findIndex(n=>n.value===e)-Z.findIndex(e=>e.value===n)))},I=h("checkbox",l),R="".concat(I,"-group"),z=(0,b.Z)(I),[B,D,M]=(0,v.ZP)(I,z),_=(0,y.Z)(m,["value","disabled"]),W=c.length?Z.map(e=>o.createElement(g,{prefixCls:I,key:e.value.toString(),disabled:"disabled"in e?e.disabled:m.disabled,value:e.value,checked:O.includes(e.value),onChange:e.onChange,className:r()("".concat(R,"-item"),e.className),style:e.style,title:e.title,id:e.id,required:e.required},e.label)):a,q=o.useMemo(()=>({toggleOption:j,value:O,disabled:m.disabled,name:m.name,registerValue:N,cancelValue:P}),[j,O,m.disabled,m.name,N,P]),H=r()(R,{["".concat(R,"-rtl")]:"rtl"===x},i,s,M,z,D);return B(o.createElement("div",Object.assign({className:H,style:d},_,{ref:n}),o.createElement(f.Provider,{value:q},W)))});g.Group=x,g.__ANT_CHECKBOX=!0;var O=g},23159:function(e,n,t){t.d(n,{C2:function(){return i}});var o=t(93463),a=t(12918),r=t(71140),c=t(99320);let l=e=>{let{checkboxCls:n}=e,t="".concat(n,"-wrapper");return[{["".concat(n,"-group")]:Object.assign(Object.assign({},(0,a.Wf)(e)),{display:"inline-flex",flexWrap:"wrap",columnGap:e.marginXS,["> ".concat(e.antCls,"-row")]:{flex:1}}),[t]:Object.assign(Object.assign({},(0,a.Wf)(e)),{display:"inline-flex",alignItems:"baseline",cursor:"pointer","&:after":{display:"inline-block",width:0,overflow:"hidden",content:"'\\a0'"},["& + ".concat(t)]:{marginInlineStart:0},["&".concat(t,"-in-form-item")]:{'input[type="checkbox"]':{width:14,height:14}}}),[n]:Object.assign(Object.assign({},(0,a.Wf)(e)),{position:"relative",whiteSpace:"nowrap",lineHeight:1,cursor:"pointer",borderRadius:e.borderRadiusSM,alignSelf:"center",["".concat(n,"-input")]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0,margin:0,["&:focus-visible + ".concat(n,"-inner")]:(0,a.oN)(e)},["".concat(n,"-inner")]:{boxSizing:"border-box",display:"block",width:e.checkboxSize,height:e.checkboxSize,direction:"ltr",backgroundColor:e.colorBgContainer,border:"".concat((0,o.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderRadius:e.borderRadiusSM,borderCollapse:"separate",transition:"all ".concat(e.motionDurationSlow),"&:after":{boxSizing:"border-box",position:"absolute",top:"50%",insetInlineStart:"25%",display:"table",width:e.calc(e.checkboxSize).div(14).mul(5).equal(),height:e.calc(e.checkboxSize).div(14).mul(8).equal(),border:"".concat((0,o.bf)(e.lineWidthBold)," solid ").concat(e.colorWhite),borderTop:0,borderInlineStart:0,transform:"rotate(45deg) scale(0) translate(-50%,-50%)",opacity:0,content:'""',transition:"all ".concat(e.motionDurationFast," ").concat(e.motionEaseInBack,", opacity ").concat(e.motionDurationFast)}},"& + span":{paddingInlineStart:e.paddingXS,paddingInlineEnd:e.paddingXS}})},{["\n ".concat(t,":not(").concat(t,"-disabled),\n ").concat(n,":not(").concat(n,"-disabled)\n ")]:{["&:hover ".concat(n,"-inner")]:{borderColor:e.colorPrimary}},["".concat(t,":not(").concat(t,"-disabled)")]:{["&:hover ".concat(n,"-checked:not(").concat(n,"-disabled) ").concat(n,"-inner")]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"},["&:hover ".concat(n,"-checked:not(").concat(n,"-disabled):after")]:{borderColor:e.colorPrimaryHover}}},{["".concat(n,"-checked")]:{["".concat(n,"-inner")]:{backgroundColor:e.colorPrimary,borderColor:e.colorPrimary,"&:after":{opacity:1,transform:"rotate(45deg) scale(1) translate(-50%,-50%)",transition:"all ".concat(e.motionDurationMid," ").concat(e.motionEaseOutBack," ").concat(e.motionDurationFast)}}},["\n ".concat(t,"-checked:not(").concat(t,"-disabled),\n ").concat(n,"-checked:not(").concat(n,"-disabled)\n ")]:{["&:hover ".concat(n,"-inner")]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"}}},{[n]:{"&-indeterminate":{"&":{["".concat(n,"-inner")]:{backgroundColor:"".concat(e.colorBgContainer),borderColor:"".concat(e.colorBorder),"&:after":{top:"50%",insetInlineStart:"50%",width:e.calc(e.fontSizeLG).div(2).equal(),height:e.calc(e.fontSizeLG).div(2).equal(),backgroundColor:e.colorPrimary,border:0,transform:"translate(-50%, -50%) scale(1)",opacity:1,content:'""'}},["&:hover ".concat(n,"-inner")]:{backgroundColor:"".concat(e.colorBgContainer),borderColor:"".concat(e.colorPrimary)}}}}},{["".concat(t,"-disabled")]:{cursor:"not-allowed"},["".concat(n,"-disabled")]:{["&, ".concat(n,"-input")]:{cursor:"not-allowed",pointerEvents:"none"},["".concat(n,"-inner")]:{background:e.colorBgContainerDisabled,borderColor:e.colorBorder,"&:after":{borderColor:e.colorTextDisabled}},"&:after":{display:"none"},"& + span":{color:e.colorTextDisabled},["&".concat(n,"-indeterminate ").concat(n,"-inner::after")]:{background:e.colorTextDisabled}}}]};function i(e,n){return l((0,r.IX)(n,{checkboxCls:".".concat(e),checkboxSize:n.controlInteractiveSize}))}n.ZP=(0,c.I$)("Checkbox",(e,n)=>{let{prefixCls:t}=n;return[i(t,e)]})},66531:function(e,n,t){t.d(n,{Z:function(){return r}});var o=t(2265),a=t(53346);function r(e){let n=o.useRef(null),t=()=>{a.Z.cancel(n.current),n.current=null};return[()=>{t(),n.current=(0,a.Z)(()=>{n.current=null})},o=>{n.current&&(o.stopPropagation(),t()),null==e||e(o)}]}},20873:function(e,n,t){var o=t(1119),a=t(31686),r=t(11993),c=t(26365),l=t(6989),i=t(36760),s=t.n(i),u=t(50506),d=t(2265),b=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],p=(0,d.forwardRef)(function(e,n){var t=e.prefixCls,i=void 0===t?"rc-checkbox":t,p=e.className,f=e.style,v=e.checked,m=e.disabled,h=e.defaultChecked,g=e.type,C=void 0===g?"checkbox":g,y=e.title,k=e.onChange,x=(0,l.Z)(e,b),O=(0,d.useRef)(null),E=(0,d.useRef)(null),S=(0,u.Z)(void 0!==h&&h,{value:v}),w=(0,c.Z)(S,2),Z=w[0],P=w[1];(0,d.useImperativeHandle)(n,function(){return{focus:function(e){var n;null===(n=O.current)||void 0===n||n.focus(e)},blur:function(){var e;null===(e=O.current)||void 0===e||e.blur()},input:O.current,nativeElement:E.current}});var N=s()(i,p,(0,r.Z)((0,r.Z)({},"".concat(i,"-checked"),Z),"".concat(i,"-disabled"),m));return d.createElement("span",{className:N,title:y,style:f,ref:E},d.createElement("input",(0,o.Z)({},x,{className:"".concat(i,"-input"),ref:O,onChange:function(n){m||("checked"in e||P(n.target.checked),null==k||k({target:(0,a.Z)((0,a.Z)({},e),{},{type:C,checked:n.target.checked}),stopPropagation:function(){n.stopPropagation()},preventDefault:function(){n.preventDefault()},nativeEvent:n.nativeEvent}))},disabled:m,checked:!!Z,type:C})),d.createElement("span",{className:"".concat(i,"-inner")}))});n.Z=p}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1994-a4d0b99849c16b62.js b/litellm/proxy/_experimental/out/_next/static/chunks/1994-a4d0b99849c16b62.js deleted file mode 100644 index 3211472683..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1994-a4d0b99849c16b62.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1994],{61994:function(e,n,t){t.d(n,{Z:function(){return O}});var o=t(2265),a=t(36760),r=t.n(a),c=t(20873),l=t(28791),i=t(6694),s=t(34709),u=t(71744),d=t(86586),b=t(64024),p=t(39109);let f=o.createContext(null);var v=t(23159),m=t(66531),h=function(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>n.indexOf(o)&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);an.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(t[o[a]]=e[o[a]]);return t};let g=o.forwardRef((e,n)=>{var t;let{prefixCls:a,className:g,rootClassName:C,children:y,indeterminate:k=!1,style:x,onMouseEnter:O,onMouseLeave:E,skipGroup:S=!1,disabled:w}=e,Z=h(e,["prefixCls","className","rootClassName","children","indeterminate","style","onMouseEnter","onMouseLeave","skipGroup","disabled"]),{getPrefixCls:P,direction:N,checkbox:j}=o.useContext(u.E_),I=o.useContext(f),{isFormItemInput:R}=o.useContext(p.aM),z=o.useContext(d.Z),B=null!==(t=(null==I?void 0:I.disabled)||w)&&void 0!==t?t:z,D=o.useRef(Z.value),M=o.useRef(null),_=(0,l.sQ)(n,M);o.useEffect(()=>{null==I||I.registerValue(Z.value)},[]),o.useEffect(()=>{if(!S)return Z.value!==D.current&&(null==I||I.cancelValue(D.current),null==I||I.registerValue(Z.value),D.current=Z.value),()=>null==I?void 0:I.cancelValue(Z.value)},[Z.value]),o.useEffect(()=>{var e;(null===(e=M.current)||void 0===e?void 0:e.input)&&(M.current.input.indeterminate=k)},[k]);let W=P("checkbox",a),q=(0,b.Z)(W),[H,T,G]=(0,v.ZP)(W,q),V=Object.assign({},Z);I&&!S&&(V.onChange=function(){for(var e=arguments.length,n=Array(e),t=0;tn.indexOf(o)&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);an.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(t[o[a]]=e[o[a]]);return t};let x=o.forwardRef((e,n)=>{let{defaultValue:t,children:a,options:c=[],prefixCls:l,className:i,rootClassName:s,style:d,onChange:p}=e,m=k(e,["defaultValue","children","options","prefixCls","className","rootClassName","style","onChange"]),{getPrefixCls:h,direction:x}=o.useContext(u.E_),[O,E]=o.useState(m.value||t||[]),[S,w]=o.useState([]);o.useEffect(()=>{"value"in m&&E(m.value||[])},[m.value]);let Z=o.useMemo(()=>c.map(e=>"string"==typeof e||"number"==typeof e?{label:e,value:e}:e),[c]),P=e=>{w(n=>n.filter(n=>n!==e))},N=e=>{w(n=>[].concat((0,C.Z)(n),[e]))},j=e=>{let n=O.indexOf(e.value),t=(0,C.Z)(O);-1===n?t.push(e.value):t.splice(n,1),"value"in m||E(t),null==p||p(t.filter(e=>S.includes(e)).sort((e,n)=>Z.findIndex(n=>n.value===e)-Z.findIndex(e=>e.value===n)))},I=h("checkbox",l),R="".concat(I,"-group"),z=(0,b.Z)(I),[B,D,M]=(0,v.ZP)(I,z),_=(0,y.Z)(m,["value","disabled"]),W=c.length?Z.map(e=>o.createElement(g,{prefixCls:I,key:e.value.toString(),disabled:"disabled"in e?e.disabled:m.disabled,value:e.value,checked:O.includes(e.value),onChange:e.onChange,className:r()("".concat(R,"-item"),e.className),style:e.style,title:e.title,id:e.id,required:e.required},e.label)):a,q=o.useMemo(()=>({toggleOption:j,value:O,disabled:m.disabled,name:m.name,registerValue:N,cancelValue:P}),[j,O,m.disabled,m.name,N,P]),H=r()(R,{["".concat(R,"-rtl")]:"rtl"===x},i,s,M,z,D);return B(o.createElement("div",Object.assign({className:H,style:d},_,{ref:n}),o.createElement(f.Provider,{value:q},W)))});g.Group=x,g.__ANT_CHECKBOX=!0;var O=g},23159:function(e,n,t){t.d(n,{C2:function(){return i}});var o=t(93463),a=t(12918),r=t(71140),c=t(99320);let l=e=>{let{checkboxCls:n}=e,t="".concat(n,"-wrapper");return[{["".concat(n,"-group")]:Object.assign(Object.assign({},(0,a.Wf)(e)),{display:"inline-flex",flexWrap:"wrap",columnGap:e.marginXS,["> ".concat(e.antCls,"-row")]:{flex:1}}),[t]:Object.assign(Object.assign({},(0,a.Wf)(e)),{display:"inline-flex",alignItems:"baseline",cursor:"pointer","&:after":{display:"inline-block",width:0,overflow:"hidden",content:"'\\a0'"},["& + ".concat(t)]:{marginInlineStart:0},["&".concat(t,"-in-form-item")]:{'input[type="checkbox"]':{width:14,height:14}}}),[n]:Object.assign(Object.assign({},(0,a.Wf)(e)),{position:"relative",whiteSpace:"nowrap",lineHeight:1,cursor:"pointer",borderRadius:e.borderRadiusSM,alignSelf:"center",["".concat(n,"-input")]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0,margin:0,["&:focus-visible + ".concat(n,"-inner")]:(0,a.oN)(e)},["".concat(n,"-inner")]:{boxSizing:"border-box",display:"block",width:e.checkboxSize,height:e.checkboxSize,direction:"ltr",backgroundColor:e.colorBgContainer,border:"".concat((0,o.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderRadius:e.borderRadiusSM,borderCollapse:"separate",transition:"all ".concat(e.motionDurationSlow),"&:after":{boxSizing:"border-box",position:"absolute",top:"50%",insetInlineStart:"25%",display:"table",width:e.calc(e.checkboxSize).div(14).mul(5).equal(),height:e.calc(e.checkboxSize).div(14).mul(8).equal(),border:"".concat((0,o.bf)(e.lineWidthBold)," solid ").concat(e.colorWhite),borderTop:0,borderInlineStart:0,transform:"rotate(45deg) scale(0) translate(-50%,-50%)",opacity:0,content:'""',transition:"all ".concat(e.motionDurationFast," ").concat(e.motionEaseInBack,", opacity ").concat(e.motionDurationFast)}},"& + span":{paddingInlineStart:e.paddingXS,paddingInlineEnd:e.paddingXS}})},{["\n ".concat(t,":not(").concat(t,"-disabled),\n ").concat(n,":not(").concat(n,"-disabled)\n ")]:{["&:hover ".concat(n,"-inner")]:{borderColor:e.colorPrimary}},["".concat(t,":not(").concat(t,"-disabled)")]:{["&:hover ".concat(n,"-checked:not(").concat(n,"-disabled) ").concat(n,"-inner")]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"},["&:hover ".concat(n,"-checked:not(").concat(n,"-disabled):after")]:{borderColor:e.colorPrimaryHover}}},{["".concat(n,"-checked")]:{["".concat(n,"-inner")]:{backgroundColor:e.colorPrimary,borderColor:e.colorPrimary,"&:after":{opacity:1,transform:"rotate(45deg) scale(1) translate(-50%,-50%)",transition:"all ".concat(e.motionDurationMid," ").concat(e.motionEaseOutBack," ").concat(e.motionDurationFast)}}},["\n ".concat(t,"-checked:not(").concat(t,"-disabled),\n ").concat(n,"-checked:not(").concat(n,"-disabled)\n ")]:{["&:hover ".concat(n,"-inner")]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"}}},{[n]:{"&-indeterminate":{"&":{["".concat(n,"-inner")]:{backgroundColor:"".concat(e.colorBgContainer),borderColor:"".concat(e.colorBorder),"&:after":{top:"50%",insetInlineStart:"50%",width:e.calc(e.fontSizeLG).div(2).equal(),height:e.calc(e.fontSizeLG).div(2).equal(),backgroundColor:e.colorPrimary,border:0,transform:"translate(-50%, -50%) scale(1)",opacity:1,content:'""'}},["&:hover ".concat(n,"-inner")]:{backgroundColor:"".concat(e.colorBgContainer),borderColor:"".concat(e.colorPrimary)}}}}},{["".concat(t,"-disabled")]:{cursor:"not-allowed"},["".concat(n,"-disabled")]:{["&, ".concat(n,"-input")]:{cursor:"not-allowed",pointerEvents:"none"},["".concat(n,"-inner")]:{background:e.colorBgContainerDisabled,borderColor:e.colorBorder,"&:after":{borderColor:e.colorTextDisabled}},"&:after":{display:"none"},"& + span":{color:e.colorTextDisabled},["&".concat(n,"-indeterminate ").concat(n,"-inner::after")]:{background:e.colorTextDisabled}}}]};function i(e,n){return l((0,r.IX)(n,{checkboxCls:".".concat(e),checkboxSize:n.controlInteractiveSize}))}n.ZP=(0,c.I$)("Checkbox",(e,n)=>{let{prefixCls:t}=n;return[i(t,e)]})},66531:function(e,n,t){t.d(n,{Z:function(){return r}});var o=t(2265),a=t(53346);function r(e){let n=o.useRef(null),t=()=>{a.Z.cancel(n.current),n.current=null};return[()=>{t(),n.current=(0,a.Z)(()=>{n.current=null})},o=>{n.current&&(o.stopPropagation(),t()),null==e||e(o)}]}},20873:function(e,n,t){var o=t(1119),a=t(31686),r=t(11993),c=t(26365),l=t(6989),i=t(36760),s=t.n(i),u=t(50506),d=t(2265),b=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],p=(0,d.forwardRef)(function(e,n){var t=e.prefixCls,i=void 0===t?"rc-checkbox":t,p=e.className,f=e.style,v=e.checked,m=e.disabled,h=e.defaultChecked,g=e.type,C=void 0===g?"checkbox":g,y=e.title,k=e.onChange,x=(0,l.Z)(e,b),O=(0,d.useRef)(null),E=(0,d.useRef)(null),S=(0,u.Z)(void 0!==h&&h,{value:v}),w=(0,c.Z)(S,2),Z=w[0],P=w[1];(0,d.useImperativeHandle)(n,function(){return{focus:function(e){var n;null===(n=O.current)||void 0===n||n.focus(e)},blur:function(){var e;null===(e=O.current)||void 0===e||e.blur()},input:O.current,nativeElement:E.current}});var N=s()(i,p,(0,r.Z)((0,r.Z)({},"".concat(i,"-checked"),Z),"".concat(i,"-disabled"),m));return d.createElement("span",{className:N,title:y,style:f,ref:E},d.createElement("input",(0,o.Z)({},x,{className:"".concat(i,"-input"),ref:O,onChange:function(n){m||("checked"in e||P(n.target.checked),null==k||k({target:(0,a.Z)((0,a.Z)({},e),{},{type:C,checked:n.target.checked}),stopPropagation:function(){n.stopPropagation()},preventDefault:function(){n.preventDefault()},nativeEvent:n.nativeEvent}))},disabled:m,checked:!!Z,type:C})),d.createElement("span",{className:"".concat(i,"-inner")}))});n.Z=p}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2004-1eb16c345c0044ae.js b/litellm/proxy/_experimental/out/_next/static/chunks/2004-e6c5ce8d6dc32432.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/2004-1eb16c345c0044ae.js rename to litellm/proxy/_experimental/out/_next/static/chunks/2004-e6c5ce8d6dc32432.js index 00fba328e8..bd898607df 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/2004-1eb16c345c0044ae.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/2004-e6c5ce8d6dc32432.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2004],{22004:function(e,l,s){s.d(l,{Z:function(){return ee},g:function(){return X}});var i=s(57437),a=s(2265),r=s(41649),t=s(78489),n=s(12514),o=s(49804),d=s(67101),c=s(47323),m=s(12485),u=s(18135),x=s(35242),h=s(29706),_=s(77991),g=s(21626),j=s(97214),p=s(28241),v=s(58834),Z=s(69552),b=s(71876),f=s(84264),w=s(24199),z=s(4260),y=s(10032),N=s(99981),C=s(22116),S=s(37592),O=s(15424),M=s(23628),k=s(86462),I=s(47686),P=s(53410),A=s(74998),T=s(31283),D=s(46468),F=s(59872),L=s(77331),R=s(49566),U=s(96761),E=s(5545),B=s(30401),V=s(78867),q=s(33860),G=s(95920),W=s(9114),$=s(19250),J=s(60131),Q=s(10901),Y=s(97415),H=e=>{var l,s,o,N,C;let{organizationId:O,onClose:M,accessToken:k,is_org_admin:I,is_proxy_admin:T,userModels:H,editOrg:K}=e,[X,ee]=(0,a.useState)(null),[el,es]=(0,a.useState)(!0),[ei]=y.Z.useForm(),[ea,er]=(0,a.useState)(!1),[et,en]=(0,a.useState)(!1),[eo,ed]=(0,a.useState)(!1),[ec,em]=(0,a.useState)(null),[eu,ex]=(0,a.useState)({}),[eh,e_]=(0,a.useState)(!1),eg=I||T,ej=async()=>{try{if(es(!0),!k)return;let e=await (0,$.organizationInfoCall)(k,O);ee(e)}catch(e){W.Z.fromBackend("Failed to load organization information"),console.error("Error fetching organization info:",e)}finally{es(!1)}};(0,a.useEffect)(()=>{ej()},[O,k]);let ep=async e=>{try{if(null==k)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role};await (0,$.organizationMemberAddCall)(k,O,l),W.Z.success("Organization member added successfully"),en(!1),ei.resetFields(),ej()}catch(e){W.Z.fromBackend("Failed to add organization member"),console.error("Error adding organization member:",e)}},ev=async e=>{try{if(!k)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role};await (0,$.organizationMemberUpdateCall)(k,O,l),W.Z.success("Organization member updated successfully"),ed(!1),ei.resetFields(),ej()}catch(e){W.Z.fromBackend("Failed to update organization member"),console.error("Error updating organization member:",e)}},eZ=async e=>{try{if(!k)return;await (0,$.organizationMemberDeleteCall)(k,O,e.user_id),W.Z.success("Organization member deleted successfully"),ed(!1),ei.resetFields(),ej()}catch(e){W.Z.fromBackend("Failed to delete organization member"),console.error("Error deleting organization member:",e)}},eb=async e=>{try{if(!k)return;e_(!0);let l={organization_id:O,organization_alias:e.organization_alias,models:e.models,litellm_budget_table:{tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit,max_budget:e.max_budget,budget_duration:e.budget_duration},metadata:e.metadata?JSON.parse(e.metadata):null};if((void 0!==e.vector_stores||void 0!==e.mcp_servers_and_groups)&&(l.object_permission={...null==X?void 0:X.object_permission,vector_stores:e.vector_stores||[]},void 0!==e.mcp_servers_and_groups)){let{servers:s,accessGroups:i}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]};s&&s.length>0&&(l.object_permission.mcp_servers=s),i&&i.length>0&&(l.object_permission.mcp_access_groups=i)}await (0,$.organizationUpdateCall)(k,l),W.Z.success("Organization settings updated successfully"),er(!1),ej()}catch(e){W.Z.fromBackend("Failed to update organization settings"),console.error("Error updating organization:",e)}finally{e_(!1)}};if(el)return(0,i.jsx)("div",{className:"p-4",children:"Loading..."});if(!X)return(0,i.jsx)("div",{className:"p-4",children:"Organization not found"});let ef=async(e,l)=>{await (0,F.vQ)(e)&&(ex(e=>({...e,[l]:!0})),setTimeout(()=>{ex(e=>({...e,[l]:!1}))},2e3))};return(0,i.jsxs)("div",{className:"w-full h-screen p-4 bg-white",children:[(0,i.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,i.jsxs)("div",{children:[(0,i.jsx)(t.Z,{icon:L.Z,onClick:M,variant:"light",className:"mb-4",children:"Back to Organizations"}),(0,i.jsx)(U.Z,{children:X.organization_alias}),(0,i.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,i.jsx)(f.Z,{className:"text-gray-500 font-mono",children:X.organization_id}),(0,i.jsx)(E.ZP,{type:"text",size:"small",icon:eu["org-id"]?(0,i.jsx)(B.Z,{size:12}):(0,i.jsx)(V.Z,{size:12}),onClick:()=>ef(X.organization_id,"org-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eu["org-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,i.jsxs)(u.Z,{defaultIndex:K?2:0,children:[(0,i.jsxs)(x.Z,{className:"mb-4",children:[(0,i.jsx)(m.Z,{children:"Overview"}),(0,i.jsx)(m.Z,{children:"Members"}),(0,i.jsx)(m.Z,{children:"Settings"})]}),(0,i.jsxs)(_.Z,{children:[(0,i.jsx)(h.Z,{children:(0,i.jsxs)(d.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,i.jsxs)(n.Z,{children:[(0,i.jsx)(f.Z,{children:"Organization Details"}),(0,i.jsxs)("div",{className:"mt-2",children:[(0,i.jsxs)(f.Z,{children:["Created: ",new Date(X.created_at).toLocaleDateString()]}),(0,i.jsxs)(f.Z,{children:["Updated: ",new Date(X.updated_at).toLocaleDateString()]}),(0,i.jsxs)(f.Z,{children:["Created By: ",X.created_by]})]})]}),(0,i.jsxs)(n.Z,{children:[(0,i.jsx)(f.Z,{children:"Budget Status"}),(0,i.jsxs)("div",{className:"mt-2",children:[(0,i.jsxs)(U.Z,{children:["$",(0,F.pw)(X.spend,4)]}),(0,i.jsxs)(f.Z,{children:["of"," ",null===X.litellm_budget_table.max_budget?"Unlimited":"$".concat((0,F.pw)(X.litellm_budget_table.max_budget,4))]}),X.litellm_budget_table.budget_duration&&(0,i.jsxs)(f.Z,{className:"text-gray-500",children:["Reset: ",X.litellm_budget_table.budget_duration]})]})]}),(0,i.jsxs)(n.Z,{children:[(0,i.jsx)(f.Z,{children:"Rate Limits"}),(0,i.jsxs)("div",{className:"mt-2",children:[(0,i.jsxs)(f.Z,{children:["TPM: ",X.litellm_budget_table.tpm_limit||"Unlimited"]}),(0,i.jsxs)(f.Z,{children:["RPM: ",X.litellm_budget_table.rpm_limit||"Unlimited"]}),X.litellm_budget_table.max_parallel_requests&&(0,i.jsxs)(f.Z,{children:["Max Parallel Requests: ",X.litellm_budget_table.max_parallel_requests]})]})]}),(0,i.jsxs)(n.Z,{children:[(0,i.jsx)(f.Z,{children:"Models"}),(0,i.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:0===X.models.length?(0,i.jsx)(r.Z,{color:"red",children:"All proxy models"}):X.models.map((e,l)=>(0,i.jsx)(r.Z,{color:"red",children:e},l))})]}),(0,i.jsxs)(n.Z,{children:[(0,i.jsx)(f.Z,{children:"Teams"}),(0,i.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:null===(l=X.teams)||void 0===l?void 0:l.map((e,l)=>(0,i.jsx)(r.Z,{color:"red",children:e.team_id},l))})]}),(0,i.jsx)(J.Z,{objectPermission:X.object_permission,variant:"card",accessToken:k})]})}),(0,i.jsx)(h.Z,{children:(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsx)(n.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[75vh]",children:(0,i.jsxs)(g.Z,{children:[(0,i.jsx)(v.Z,{children:(0,i.jsxs)(b.Z,{children:[(0,i.jsx)(Z.Z,{children:"User ID"}),(0,i.jsx)(Z.Z,{children:"Role"}),(0,i.jsx)(Z.Z,{children:"Spend"}),(0,i.jsx)(Z.Z,{children:"Created At"}),(0,i.jsx)(Z.Z,{})]})}),(0,i.jsx)(j.Z,{children:null===(s=X.members)||void 0===s?void 0:s.map((e,l)=>(0,i.jsxs)(b.Z,{children:[(0,i.jsx)(p.Z,{children:(0,i.jsx)(f.Z,{className:"font-mono",children:e.user_id})}),(0,i.jsx)(p.Z,{children:(0,i.jsx)(f.Z,{className:"font-mono",children:e.user_role})}),(0,i.jsx)(p.Z,{children:(0,i.jsxs)(f.Z,{children:["$",(0,F.pw)(e.spend,4)]})}),(0,i.jsx)(p.Z,{children:(0,i.jsx)(f.Z,{children:new Date(e.created_at).toLocaleString()})}),(0,i.jsx)(p.Z,{children:eg&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c.Z,{icon:P.Z,size:"sm",onClick:()=>{em({role:e.user_role,user_email:e.user_email,user_id:e.user_id}),ed(!0)}}),(0,i.jsx)(c.Z,{icon:A.Z,size:"sm",onClick:()=>{eZ(e)}})]})})]},l))})]})}),eg&&(0,i.jsx)(t.Z,{onClick:()=>{en(!0)},children:"Add Member"})]})}),(0,i.jsx)(h.Z,{children:(0,i.jsxs)(n.Z,{className:"overflow-y-auto max-h-[65vh]",children:[(0,i.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,i.jsx)(U.Z,{children:"Organization Settings"}),eg&&!ea&&(0,i.jsx)(t.Z,{onClick:()=>er(!0),children:"Edit Settings"})]}),ea?(0,i.jsxs)(y.Z,{form:ei,onFinish:eb,initialValues:{organization_alias:X.organization_alias,models:X.models,tpm_limit:X.litellm_budget_table.tpm_limit,rpm_limit:X.litellm_budget_table.rpm_limit,max_budget:X.litellm_budget_table.max_budget,budget_duration:X.litellm_budget_table.budget_duration,metadata:X.metadata?JSON.stringify(X.metadata,null,2):"",vector_stores:(null===(o=X.object_permission)||void 0===o?void 0:o.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(N=X.object_permission)||void 0===N?void 0:N.mcp_servers)||[],accessGroups:(null===(C=X.object_permission)||void 0===C?void 0:C.mcp_access_groups)||[]}},layout:"vertical",children:[(0,i.jsx)(y.Z.Item,{label:"Organization Name",name:"organization_alias",rules:[{required:!0,message:"Please input an organization name"}],children:(0,i.jsx)(R.Z,{})}),(0,i.jsx)(y.Z.Item,{label:"Models",name:"models",children:(0,i.jsxs)(S.default,{mode:"multiple",placeholder:"Select models",children:[(0,i.jsx)(S.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),H.map(e=>(0,i.jsx)(S.default.Option,{value:e,children:(0,D.W0)(e)},e))]})}),(0,i.jsx)(y.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,i.jsx)(w.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,i.jsx)(y.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,i.jsxs)(S.default,{placeholder:"n/a",children:[(0,i.jsx)(S.default.Option,{value:"24h",children:"daily"}),(0,i.jsx)(S.default.Option,{value:"7d",children:"weekly"}),(0,i.jsx)(S.default.Option,{value:"30d",children:"monthly"})]})}),(0,i.jsx)(y.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,i.jsx)(w.Z,{step:1,style:{width:"100%"}})}),(0,i.jsx)(y.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,i.jsx)(w.Z,{step:1,style:{width:"100%"}})}),(0,i.jsx)(y.Z.Item,{label:"Vector Stores",name:"vector_stores",children:(0,i.jsx)(Y.Z,{onChange:e=>ei.setFieldValue("vector_stores",e),value:ei.getFieldValue("vector_stores"),accessToken:k||"",placeholder:"Select vector stores"})}),(0,i.jsx)(y.Z.Item,{label:"MCP Servers & Access Groups",name:"mcp_servers_and_groups",children:(0,i.jsx)(G.Z,{onChange:e=>ei.setFieldValue("mcp_servers_and_groups",e),value:ei.getFieldValue("mcp_servers_and_groups"),accessToken:k||"",placeholder:"Select MCP servers and access groups"})}),(0,i.jsx)(y.Z.Item,{label:"Metadata",name:"metadata",children:(0,i.jsx)(z.default.TextArea,{rows:4})}),(0,i.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,i.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,i.jsx)(t.Z,{variant:"secondary",onClick:()=>er(!1),disabled:eh,children:"Cancel"}),(0,i.jsx)(t.Z,{type:"submit",loading:eh,children:"Save Changes"})]})})]}):(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Organization Name"}),(0,i.jsx)("div",{children:X.organization_alias})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Organization ID"}),(0,i.jsx)("div",{className:"font-mono",children:X.organization_id})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Created At"}),(0,i.jsx)("div",{children:new Date(X.created_at).toLocaleString()})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Models"}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:X.models.map((e,l)=>(0,i.jsx)(r.Z,{color:"red",children:e},l))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Rate Limits"}),(0,i.jsxs)("div",{children:["TPM: ",X.litellm_budget_table.tpm_limit||"Unlimited"]}),(0,i.jsxs)("div",{children:["RPM: ",X.litellm_budget_table.rpm_limit||"Unlimited"]})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Budget"}),(0,i.jsxs)("div",{children:["Max:"," ",null!==X.litellm_budget_table.max_budget?"$".concat((0,F.pw)(X.litellm_budget_table.max_budget,4)):"No Limit"]}),(0,i.jsxs)("div",{children:["Reset: ",X.litellm_budget_table.budget_duration||"Never"]})]}),(0,i.jsx)(J.Z,{objectPermission:X.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:k})]})]})})]})]}),(0,i.jsx)(q.Z,{isVisible:et,onCancel:()=>en(!1),onSubmit:ep,accessToken:k,title:"Add Organization Member",roles:[{label:"org_admin",value:"org_admin",description:"Can add and remove members, and change their roles."},{label:"internal_user",value:"internal_user",description:"Can view/create keys for themselves within organization."},{label:"internal_user_viewer",value:"internal_user_viewer",description:"Can only view their keys within organization."}],defaultRole:"internal_user"}),(0,i.jsx)(Q.Z,{visible:eo,onCancel:()=>ed(!1),onSubmit:ev,initialData:ec,mode:"edit",config:{title:"Edit Member",showEmail:!0,showUserId:!0,roleOptions:[{label:"Org Admin",value:"org_admin"},{label:"Internal User",value:"internal_user"},{label:"Internal User Viewer",value:"internal_user_viewer"}]}})]})},K=s(21609);let X=async(e,l)=>{l(await (0,$.organizationListCall)(e))};var ee=e=>{let{organizations:l,userRole:s,userModels:L,accessToken:R,lastRefreshed:U,handleRefreshClick:E,currentOrg:B,guardrailsList:V=[],setOrganizations:q,premiumUser:J}=e,[Q,ee]=(0,a.useState)(null),[el,es]=(0,a.useState)(!1),[ei,ea]=(0,a.useState)(!1),[er,et]=(0,a.useState)(null),[en,eo]=(0,a.useState)(!1),[ed,ec]=(0,a.useState)(!1),[em]=y.Z.useForm(),[eu,ex]=(0,a.useState)({});(0,a.useEffect)(()=>{R&&X(R,q)},[R]);let eh=e=>{e&&(et(e),ea(!0))},e_=async()=>{if(er&&R)try{eo(!0),await (0,$.organizationDeleteCall)(R,er),W.Z.success("Organization deleted successfully"),ea(!1),et(null),await X(R,q)}catch(e){console.error("Error deleting organization:",e)}finally{eo(!1)}},eg=async e=>{try{var l,s,i,a;if(!R)return;console.log("values in organizations new create call: ".concat(JSON.stringify(e))),(e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0||e.allowed_mcp_servers_and_groups&&((null===(l=e.allowed_mcp_servers_and_groups.servers)||void 0===l?void 0:l.length)>0||(null===(s=e.allowed_mcp_servers_and_groups.accessGroups)||void 0===s?void 0:s.length)>0))&&(e.object_permission={},e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0&&(e.object_permission.vector_stores=e.allowed_vector_store_ids,delete e.allowed_vector_store_ids),e.allowed_mcp_servers_and_groups&&((null===(i=e.allowed_mcp_servers_and_groups.servers)||void 0===i?void 0:i.length)>0&&(e.object_permission.mcp_servers=e.allowed_mcp_servers_and_groups.servers),(null===(a=e.allowed_mcp_servers_and_groups.accessGroups)||void 0===a?void 0:a.length)>0&&(e.object_permission.mcp_access_groups=e.allowed_mcp_servers_and_groups.accessGroups),delete e.allowed_mcp_servers_and_groups)),await (0,$.organizationCreateCall)(R,e),W.Z.success("Organization created successfully"),ec(!1),em.resetFields(),X(R,q)}catch(e){console.error("Error creating organization:",e)}};return J?(0,i.jsxs)("div",{className:"w-full mx-4 h-[75vh]",children:[(0,i.jsx)(d.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,i.jsxs)(o.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[("Admin"===s||"Org Admin"===s)&&(0,i.jsx)(t.Z,{className:"w-fit",onClick:()=>ec(!0),children:"+ Create New Organization"}),Q?(0,i.jsx)(H,{organizationId:Q,onClose:()=>{ee(null),es(!1)},accessToken:R,is_org_admin:!0,is_proxy_admin:"Admin"===s,userModels:L,editOrg:el}):(0,i.jsxs)(u.Z,{className:"gap-2 h-[75vh] w-full",children:[(0,i.jsxs)(x.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,i.jsx)("div",{className:"flex",children:(0,i.jsx)(m.Z,{children:"Your Organizations"})}),(0,i.jsxs)("div",{className:"flex items-center space-x-2",children:[U&&(0,i.jsxs)(f.Z,{children:["Last Refreshed: ",U]}),(0,i.jsx)(c.Z,{icon:M.Z,variant:"shadow",size:"xs",className:"self-center",onClick:E})]})]}),(0,i.jsx)(_.Z,{children:(0,i.jsxs)(h.Z,{children:[(0,i.jsx)(f.Z,{children:"Click on “Organization ID” to view organization details."}),(0,i.jsx)(d.Z,{numItems:1,className:"gap-2 pt-2 pb-2 h-[75vh] w-full mt-2",children:(0,i.jsx)(o.Z,{numColSpan:1,children:(0,i.jsx)(n.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:(0,i.jsxs)(g.Z,{children:[(0,i.jsx)(v.Z,{children:(0,i.jsxs)(b.Z,{children:[(0,i.jsx)(Z.Z,{children:"Organization ID"}),(0,i.jsx)(Z.Z,{children:"Organization Name"}),(0,i.jsx)(Z.Z,{children:"Created"}),(0,i.jsx)(Z.Z,{children:"Spend (USD)"}),(0,i.jsx)(Z.Z,{children:"Budget (USD)"}),(0,i.jsx)(Z.Z,{children:"Models"}),(0,i.jsx)(Z.Z,{children:"TPM / RPM Limits"}),(0,i.jsx)(Z.Z,{children:"Info"}),(0,i.jsx)(Z.Z,{children:"Actions"})]})}),(0,i.jsx)(j.Z,{children:l&&l.length>0?l.sort((e,l)=>new Date(l.created_at).getTime()-new Date(e.created_at).getTime()).map(e=>{var l,a,n,o,d,m,u,x,h;return(0,i.jsxs)(b.Z,{children:[(0,i.jsx)(p.Z,{children:(0,i.jsx)("div",{className:"overflow-hidden",children:(0,i.jsx)(N.Z,{title:e.organization_id,children:(0,i.jsxs)(t.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>ee(e.organization_id),children:[null===(l=e.organization_id)||void 0===l?void 0:l.slice(0,7),"..."]})})})}),(0,i.jsx)(p.Z,{children:e.organization_alias}),(0,i.jsx)(p.Z,{children:e.created_at?new Date(e.created_at).toLocaleDateString():"N/A"}),(0,i.jsx)(p.Z,{children:(0,F.pw)(e.spend,4)}),(0,i.jsx)(p.Z,{children:(null===(a=e.litellm_budget_table)||void 0===a?void 0:a.max_budget)!==null&&(null===(n=e.litellm_budget_table)||void 0===n?void 0:n.max_budget)!==void 0?null===(o=e.litellm_budget_table)||void 0===o?void 0:o.max_budget:"No limit"}),(0,i.jsx)(p.Z,{style:{maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},className:e.models.length>3?"px-0":"",children:(0,i.jsx)("div",{className:"flex flex-col",children:Array.isArray(e.models)?(0,i.jsx)("div",{className:"flex flex-col",children:0===e.models.length?(0,i.jsx)(r.Z,{size:"xs",className:"mb-1",color:"red",children:(0,i.jsx)(f.Z,{children:"All Proxy Models"})}):(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"flex items-start",children:[e.models.length>3&&(0,i.jsx)("div",{children:(0,i.jsx)(c.Z,{icon:eu[e.organization_id||""]?k.Z:I.Z,className:"cursor-pointer",size:"xs",onClick:()=>{ex(l=>({...l,[e.organization_id||""]:!l[e.organization_id||""]}))}})}),(0,i.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.models.slice(0,3).map((e,l)=>"all-proxy-models"===e?(0,i.jsx)(r.Z,{size:"xs",color:"red",children:(0,i.jsx)(f.Z,{children:"All Proxy Models"})},l):(0,i.jsx)(r.Z,{size:"xs",color:"blue",children:(0,i.jsx)(f.Z,{children:e.length>30?"".concat((0,D.W0)(e).slice(0,30),"..."):(0,D.W0)(e)})},l)),e.models.length>3&&!eu[e.organization_id||""]&&(0,i.jsx)(r.Z,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,i.jsxs)(f.Z,{children:["+",e.models.length-3," ",e.models.length-3==1?"more model":"more models"]})}),eu[e.organization_id||""]&&(0,i.jsx)("div",{className:"flex flex-wrap gap-1",children:e.models.slice(3).map((e,l)=>"all-proxy-models"===e?(0,i.jsx)(r.Z,{size:"xs",color:"red",children:(0,i.jsx)(f.Z,{children:"All Proxy Models"})},l+3):(0,i.jsx)(r.Z,{size:"xs",color:"blue",children:(0,i.jsx)(f.Z,{children:e.length>30?"".concat((0,D.W0)(e).slice(0,30),"..."):(0,D.W0)(e)})},l+3))})]})]})})}):null})}),(0,i.jsx)(p.Z,{children:(0,i.jsxs)(f.Z,{children:["TPM:"," ",(null===(d=e.litellm_budget_table)||void 0===d?void 0:d.tpm_limit)?null===(m=e.litellm_budget_table)||void 0===m?void 0:m.tpm_limit:"Unlimited",(0,i.jsx)("br",{}),"RPM:"," ",(null===(u=e.litellm_budget_table)||void 0===u?void 0:u.rpm_limit)?null===(x=e.litellm_budget_table)||void 0===x?void 0:x.rpm_limit:"Unlimited"]})}),(0,i.jsx)(p.Z,{children:(0,i.jsxs)(f.Z,{children:[(null===(h=e.members)||void 0===h?void 0:h.length)||0," Members"]})}),(0,i.jsx)(p.Z,{children:"Admin"===s&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(N.Z,{title:"Edit organization",children:[" ",(0,i.jsx)(c.Z,{icon:P.Z,size:"sm",className:"cursor-pointer hover:text-blue-600",onClick:()=>{ee(e.organization_id),es(!0)}})]}),(0,i.jsxs)(N.Z,{title:"Delete organization",children:[" ",(0,i.jsx)(c.Z,{onClick:()=>eh(e.organization_id),icon:A.Z,size:"sm",className:"cursor-pointer hover:text-red-600"})]})]})})]},e.organization_id)}):null})]})})})})]})})]})]})}),(0,i.jsx)(C.Z,{title:"Create Organization",visible:ed,width:800,footer:null,onCancel:()=>{ec(!1),em.resetFields()},children:(0,i.jsxs)(y.Z,{form:em,onFinish:eg,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,i.jsx)(y.Z.Item,{label:"Organization Name",name:"organization_alias",rules:[{required:!0,message:"Please input an organization name"}],children:(0,i.jsx)(T.o,{placeholder:""})}),(0,i.jsx)(y.Z.Item,{label:"Models",name:"models",children:(0,i.jsxs)(S.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,i.jsx)(S.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),L&&L.length>0&&L.map(e=>(0,i.jsx)(S.default.Option,{value:e,children:(0,D.W0)(e)},e))]})}),(0,i.jsx)(y.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,i.jsx)(w.Z,{step:.01,precision:2,width:200})}),(0,i.jsx)(y.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,i.jsxs)(S.default,{defaultValue:null,placeholder:"n/a",children:[(0,i.jsx)(S.default.Option,{value:"24h",children:"daily"}),(0,i.jsx)(S.default.Option,{value:"7d",children:"weekly"}),(0,i.jsx)(S.default.Option,{value:"30d",children:"monthly"})]})}),(0,i.jsx)(y.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,i.jsx)(w.Z,{step:1,width:400})}),(0,i.jsx)(y.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,i.jsx)(w.Z,{step:1,width:400})}),(0,i.jsx)(y.Z.Item,{label:(0,i.jsxs)("span",{children:["Allowed Vector Stores"," ",(0,i.jsx)(N.Z,{title:"Select which vector stores this organization can access by default. Leave empty for access to all vector stores",children:(0,i.jsx)(O.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_vector_store_ids",className:"mt-4",help:"Select vector stores this organization can access. Leave empty for access to all vector stores",children:(0,i.jsx)(Y.Z,{onChange:e=>em.setFieldValue("allowed_vector_store_ids",e),value:em.getFieldValue("allowed_vector_store_ids"),accessToken:R||"",placeholder:"Select vector stores (optional)"})}),(0,i.jsx)(y.Z.Item,{label:(0,i.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,i.jsx)(N.Z,{title:"Select which MCP servers and access groups this organization can access by default.",children:(0,i.jsx)(O.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_mcp_servers_and_groups",className:"mt-4",help:"Select MCP servers and access groups this organization can access.",children:(0,i.jsx)(G.Z,{onChange:e=>em.setFieldValue("allowed_mcp_servers_and_groups",e),value:em.getFieldValue("allowed_mcp_servers_and_groups"),accessToken:R||"",placeholder:"Select MCP servers and access groups (optional)"})}),(0,i.jsx)(y.Z.Item,{label:"Metadata",name:"metadata",children:(0,i.jsx)(z.default.TextArea,{rows:4})}),(0,i.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,i.jsx)(t.Z,{type:"submit",children:"Create Organization"})})]})}),(0,i.jsx)(K.Z,{isOpen:ei,title:"Delete Organization?",message:"Are you sure you want to delete this organization? This action cannot be undone.",resourceInformationTitle:"Organization Information",resourceInformation:[{label:"Organization ID",value:er,code:!0}],onCancel:()=>{ea(!1),et(null)},onOk:e_,confirmLoading:en})]}):(0,i.jsx)("div",{children:(0,i.jsxs)(f.Z,{children:["This is a LiteLLM Enterprise feature, and requires a valid key to use. Get a trial key"," ",(0,i.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",children:"here"}),"."]})})}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2004],{22004:function(e,l,s){s.d(l,{Z:function(){return ee},g:function(){return X}});var i=s(57437),a=s(2265),r=s(41649),t=s(78489),n=s(12514),o=s(49804),d=s(67101),c=s(47323),m=s(12485),u=s(18135),x=s(35242),h=s(29706),_=s(77991),g=s(21626),j=s(97214),p=s(28241),v=s(58834),Z=s(69552),b=s(71876),f=s(84264),w=s(24199),z=s(4260),y=s(10032),N=s(99981),C=s(22116),S=s(37592),O=s(15424),M=s(23628),k=s(86462),I=s(47686),P=s(53410),A=s(74998),T=s(31283),D=s(46468),F=s(59872),L=s(10900),R=s(49566),U=s(96761),E=s(5545),B=s(30401),V=s(78867),q=s(33860),G=s(95920),W=s(9114),$=s(19250),J=s(60131),Q=s(36894),Y=s(97415),H=e=>{var l,s,o,N,C;let{organizationId:O,onClose:M,accessToken:k,is_org_admin:I,is_proxy_admin:T,userModels:H,editOrg:K}=e,[X,ee]=(0,a.useState)(null),[el,es]=(0,a.useState)(!0),[ei]=y.Z.useForm(),[ea,er]=(0,a.useState)(!1),[et,en]=(0,a.useState)(!1),[eo,ed]=(0,a.useState)(!1),[ec,em]=(0,a.useState)(null),[eu,ex]=(0,a.useState)({}),[eh,e_]=(0,a.useState)(!1),eg=I||T,ej=async()=>{try{if(es(!0),!k)return;let e=await (0,$.organizationInfoCall)(k,O);ee(e)}catch(e){W.Z.fromBackend("Failed to load organization information"),console.error("Error fetching organization info:",e)}finally{es(!1)}};(0,a.useEffect)(()=>{ej()},[O,k]);let ep=async e=>{try{if(null==k)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role};await (0,$.organizationMemberAddCall)(k,O,l),W.Z.success("Organization member added successfully"),en(!1),ei.resetFields(),ej()}catch(e){W.Z.fromBackend("Failed to add organization member"),console.error("Error adding organization member:",e)}},ev=async e=>{try{if(!k)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role};await (0,$.organizationMemberUpdateCall)(k,O,l),W.Z.success("Organization member updated successfully"),ed(!1),ei.resetFields(),ej()}catch(e){W.Z.fromBackend("Failed to update organization member"),console.error("Error updating organization member:",e)}},eZ=async e=>{try{if(!k)return;await (0,$.organizationMemberDeleteCall)(k,O,e.user_id),W.Z.success("Organization member deleted successfully"),ed(!1),ei.resetFields(),ej()}catch(e){W.Z.fromBackend("Failed to delete organization member"),console.error("Error deleting organization member:",e)}},eb=async e=>{try{if(!k)return;e_(!0);let l={organization_id:O,organization_alias:e.organization_alias,models:e.models,litellm_budget_table:{tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit,max_budget:e.max_budget,budget_duration:e.budget_duration},metadata:e.metadata?JSON.parse(e.metadata):null};if((void 0!==e.vector_stores||void 0!==e.mcp_servers_and_groups)&&(l.object_permission={...null==X?void 0:X.object_permission,vector_stores:e.vector_stores||[]},void 0!==e.mcp_servers_and_groups)){let{servers:s,accessGroups:i}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]};s&&s.length>0&&(l.object_permission.mcp_servers=s),i&&i.length>0&&(l.object_permission.mcp_access_groups=i)}await (0,$.organizationUpdateCall)(k,l),W.Z.success("Organization settings updated successfully"),er(!1),ej()}catch(e){W.Z.fromBackend("Failed to update organization settings"),console.error("Error updating organization:",e)}finally{e_(!1)}};if(el)return(0,i.jsx)("div",{className:"p-4",children:"Loading..."});if(!X)return(0,i.jsx)("div",{className:"p-4",children:"Organization not found"});let ef=async(e,l)=>{await (0,F.vQ)(e)&&(ex(e=>({...e,[l]:!0})),setTimeout(()=>{ex(e=>({...e,[l]:!1}))},2e3))};return(0,i.jsxs)("div",{className:"w-full h-screen p-4 bg-white",children:[(0,i.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,i.jsxs)("div",{children:[(0,i.jsx)(t.Z,{icon:L.Z,onClick:M,variant:"light",className:"mb-4",children:"Back to Organizations"}),(0,i.jsx)(U.Z,{children:X.organization_alias}),(0,i.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,i.jsx)(f.Z,{className:"text-gray-500 font-mono",children:X.organization_id}),(0,i.jsx)(E.ZP,{type:"text",size:"small",icon:eu["org-id"]?(0,i.jsx)(B.Z,{size:12}):(0,i.jsx)(V.Z,{size:12}),onClick:()=>ef(X.organization_id,"org-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eu["org-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,i.jsxs)(u.Z,{defaultIndex:K?2:0,children:[(0,i.jsxs)(x.Z,{className:"mb-4",children:[(0,i.jsx)(m.Z,{children:"Overview"}),(0,i.jsx)(m.Z,{children:"Members"}),(0,i.jsx)(m.Z,{children:"Settings"})]}),(0,i.jsxs)(_.Z,{children:[(0,i.jsx)(h.Z,{children:(0,i.jsxs)(d.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,i.jsxs)(n.Z,{children:[(0,i.jsx)(f.Z,{children:"Organization Details"}),(0,i.jsxs)("div",{className:"mt-2",children:[(0,i.jsxs)(f.Z,{children:["Created: ",new Date(X.created_at).toLocaleDateString()]}),(0,i.jsxs)(f.Z,{children:["Updated: ",new Date(X.updated_at).toLocaleDateString()]}),(0,i.jsxs)(f.Z,{children:["Created By: ",X.created_by]})]})]}),(0,i.jsxs)(n.Z,{children:[(0,i.jsx)(f.Z,{children:"Budget Status"}),(0,i.jsxs)("div",{className:"mt-2",children:[(0,i.jsxs)(U.Z,{children:["$",(0,F.pw)(X.spend,4)]}),(0,i.jsxs)(f.Z,{children:["of"," ",null===X.litellm_budget_table.max_budget?"Unlimited":"$".concat((0,F.pw)(X.litellm_budget_table.max_budget,4))]}),X.litellm_budget_table.budget_duration&&(0,i.jsxs)(f.Z,{className:"text-gray-500",children:["Reset: ",X.litellm_budget_table.budget_duration]})]})]}),(0,i.jsxs)(n.Z,{children:[(0,i.jsx)(f.Z,{children:"Rate Limits"}),(0,i.jsxs)("div",{className:"mt-2",children:[(0,i.jsxs)(f.Z,{children:["TPM: ",X.litellm_budget_table.tpm_limit||"Unlimited"]}),(0,i.jsxs)(f.Z,{children:["RPM: ",X.litellm_budget_table.rpm_limit||"Unlimited"]}),X.litellm_budget_table.max_parallel_requests&&(0,i.jsxs)(f.Z,{children:["Max Parallel Requests: ",X.litellm_budget_table.max_parallel_requests]})]})]}),(0,i.jsxs)(n.Z,{children:[(0,i.jsx)(f.Z,{children:"Models"}),(0,i.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:0===X.models.length?(0,i.jsx)(r.Z,{color:"red",children:"All proxy models"}):X.models.map((e,l)=>(0,i.jsx)(r.Z,{color:"red",children:e},l))})]}),(0,i.jsxs)(n.Z,{children:[(0,i.jsx)(f.Z,{children:"Teams"}),(0,i.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:null===(l=X.teams)||void 0===l?void 0:l.map((e,l)=>(0,i.jsx)(r.Z,{color:"red",children:e.team_id},l))})]}),(0,i.jsx)(J.Z,{objectPermission:X.object_permission,variant:"card",accessToken:k})]})}),(0,i.jsx)(h.Z,{children:(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsx)(n.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[75vh]",children:(0,i.jsxs)(g.Z,{children:[(0,i.jsx)(v.Z,{children:(0,i.jsxs)(b.Z,{children:[(0,i.jsx)(Z.Z,{children:"User ID"}),(0,i.jsx)(Z.Z,{children:"Role"}),(0,i.jsx)(Z.Z,{children:"Spend"}),(0,i.jsx)(Z.Z,{children:"Created At"}),(0,i.jsx)(Z.Z,{})]})}),(0,i.jsx)(j.Z,{children:null===(s=X.members)||void 0===s?void 0:s.map((e,l)=>(0,i.jsxs)(b.Z,{children:[(0,i.jsx)(p.Z,{children:(0,i.jsx)(f.Z,{className:"font-mono",children:e.user_id})}),(0,i.jsx)(p.Z,{children:(0,i.jsx)(f.Z,{className:"font-mono",children:e.user_role})}),(0,i.jsx)(p.Z,{children:(0,i.jsxs)(f.Z,{children:["$",(0,F.pw)(e.spend,4)]})}),(0,i.jsx)(p.Z,{children:(0,i.jsx)(f.Z,{children:new Date(e.created_at).toLocaleString()})}),(0,i.jsx)(p.Z,{children:eg&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c.Z,{icon:P.Z,size:"sm",onClick:()=>{em({role:e.user_role,user_email:e.user_email,user_id:e.user_id}),ed(!0)}}),(0,i.jsx)(c.Z,{icon:A.Z,size:"sm",onClick:()=>{eZ(e)}})]})})]},l))})]})}),eg&&(0,i.jsx)(t.Z,{onClick:()=>{en(!0)},children:"Add Member"})]})}),(0,i.jsx)(h.Z,{children:(0,i.jsxs)(n.Z,{className:"overflow-y-auto max-h-[65vh]",children:[(0,i.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,i.jsx)(U.Z,{children:"Organization Settings"}),eg&&!ea&&(0,i.jsx)(t.Z,{onClick:()=>er(!0),children:"Edit Settings"})]}),ea?(0,i.jsxs)(y.Z,{form:ei,onFinish:eb,initialValues:{organization_alias:X.organization_alias,models:X.models,tpm_limit:X.litellm_budget_table.tpm_limit,rpm_limit:X.litellm_budget_table.rpm_limit,max_budget:X.litellm_budget_table.max_budget,budget_duration:X.litellm_budget_table.budget_duration,metadata:X.metadata?JSON.stringify(X.metadata,null,2):"",vector_stores:(null===(o=X.object_permission)||void 0===o?void 0:o.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(N=X.object_permission)||void 0===N?void 0:N.mcp_servers)||[],accessGroups:(null===(C=X.object_permission)||void 0===C?void 0:C.mcp_access_groups)||[]}},layout:"vertical",children:[(0,i.jsx)(y.Z.Item,{label:"Organization Name",name:"organization_alias",rules:[{required:!0,message:"Please input an organization name"}],children:(0,i.jsx)(R.Z,{})}),(0,i.jsx)(y.Z.Item,{label:"Models",name:"models",children:(0,i.jsxs)(S.default,{mode:"multiple",placeholder:"Select models",children:[(0,i.jsx)(S.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),H.map(e=>(0,i.jsx)(S.default.Option,{value:e,children:(0,D.W0)(e)},e))]})}),(0,i.jsx)(y.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,i.jsx)(w.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,i.jsx)(y.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,i.jsxs)(S.default,{placeholder:"n/a",children:[(0,i.jsx)(S.default.Option,{value:"24h",children:"daily"}),(0,i.jsx)(S.default.Option,{value:"7d",children:"weekly"}),(0,i.jsx)(S.default.Option,{value:"30d",children:"monthly"})]})}),(0,i.jsx)(y.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,i.jsx)(w.Z,{step:1,style:{width:"100%"}})}),(0,i.jsx)(y.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,i.jsx)(w.Z,{step:1,style:{width:"100%"}})}),(0,i.jsx)(y.Z.Item,{label:"Vector Stores",name:"vector_stores",children:(0,i.jsx)(Y.Z,{onChange:e=>ei.setFieldValue("vector_stores",e),value:ei.getFieldValue("vector_stores"),accessToken:k||"",placeholder:"Select vector stores"})}),(0,i.jsx)(y.Z.Item,{label:"MCP Servers & Access Groups",name:"mcp_servers_and_groups",children:(0,i.jsx)(G.Z,{onChange:e=>ei.setFieldValue("mcp_servers_and_groups",e),value:ei.getFieldValue("mcp_servers_and_groups"),accessToken:k||"",placeholder:"Select MCP servers and access groups"})}),(0,i.jsx)(y.Z.Item,{label:"Metadata",name:"metadata",children:(0,i.jsx)(z.default.TextArea,{rows:4})}),(0,i.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,i.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,i.jsx)(t.Z,{variant:"secondary",onClick:()=>er(!1),disabled:eh,children:"Cancel"}),(0,i.jsx)(t.Z,{type:"submit",loading:eh,children:"Save Changes"})]})})]}):(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Organization Name"}),(0,i.jsx)("div",{children:X.organization_alias})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Organization ID"}),(0,i.jsx)("div",{className:"font-mono",children:X.organization_id})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Created At"}),(0,i.jsx)("div",{children:new Date(X.created_at).toLocaleString()})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Models"}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:X.models.map((e,l)=>(0,i.jsx)(r.Z,{color:"red",children:e},l))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Rate Limits"}),(0,i.jsxs)("div",{children:["TPM: ",X.litellm_budget_table.tpm_limit||"Unlimited"]}),(0,i.jsxs)("div",{children:["RPM: ",X.litellm_budget_table.rpm_limit||"Unlimited"]})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Budget"}),(0,i.jsxs)("div",{children:["Max:"," ",null!==X.litellm_budget_table.max_budget?"$".concat((0,F.pw)(X.litellm_budget_table.max_budget,4)):"No Limit"]}),(0,i.jsxs)("div",{children:["Reset: ",X.litellm_budget_table.budget_duration||"Never"]})]}),(0,i.jsx)(J.Z,{objectPermission:X.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:k})]})]})})]})]}),(0,i.jsx)(q.Z,{isVisible:et,onCancel:()=>en(!1),onSubmit:ep,accessToken:k,title:"Add Organization Member",roles:[{label:"org_admin",value:"org_admin",description:"Can add and remove members, and change their roles."},{label:"internal_user",value:"internal_user",description:"Can view/create keys for themselves within organization."},{label:"internal_user_viewer",value:"internal_user_viewer",description:"Can only view their keys within organization."}],defaultRole:"internal_user"}),(0,i.jsx)(Q.Z,{visible:eo,onCancel:()=>ed(!1),onSubmit:ev,initialData:ec,mode:"edit",config:{title:"Edit Member",showEmail:!0,showUserId:!0,roleOptions:[{label:"Org Admin",value:"org_admin"},{label:"Internal User",value:"internal_user"},{label:"Internal User Viewer",value:"internal_user_viewer"}]}})]})},K=s(21609);let X=async(e,l)=>{l(await (0,$.organizationListCall)(e))};var ee=e=>{let{organizations:l,userRole:s,userModels:L,accessToken:R,lastRefreshed:U,handleRefreshClick:E,currentOrg:B,guardrailsList:V=[],setOrganizations:q,premiumUser:J}=e,[Q,ee]=(0,a.useState)(null),[el,es]=(0,a.useState)(!1),[ei,ea]=(0,a.useState)(!1),[er,et]=(0,a.useState)(null),[en,eo]=(0,a.useState)(!1),[ed,ec]=(0,a.useState)(!1),[em]=y.Z.useForm(),[eu,ex]=(0,a.useState)({});(0,a.useEffect)(()=>{R&&X(R,q)},[R]);let eh=e=>{e&&(et(e),ea(!0))},e_=async()=>{if(er&&R)try{eo(!0),await (0,$.organizationDeleteCall)(R,er),W.Z.success("Organization deleted successfully"),ea(!1),et(null),await X(R,q)}catch(e){console.error("Error deleting organization:",e)}finally{eo(!1)}},eg=async e=>{try{var l,s,i,a;if(!R)return;console.log("values in organizations new create call: ".concat(JSON.stringify(e))),(e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0||e.allowed_mcp_servers_and_groups&&((null===(l=e.allowed_mcp_servers_and_groups.servers)||void 0===l?void 0:l.length)>0||(null===(s=e.allowed_mcp_servers_and_groups.accessGroups)||void 0===s?void 0:s.length)>0))&&(e.object_permission={},e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0&&(e.object_permission.vector_stores=e.allowed_vector_store_ids,delete e.allowed_vector_store_ids),e.allowed_mcp_servers_and_groups&&((null===(i=e.allowed_mcp_servers_and_groups.servers)||void 0===i?void 0:i.length)>0&&(e.object_permission.mcp_servers=e.allowed_mcp_servers_and_groups.servers),(null===(a=e.allowed_mcp_servers_and_groups.accessGroups)||void 0===a?void 0:a.length)>0&&(e.object_permission.mcp_access_groups=e.allowed_mcp_servers_and_groups.accessGroups),delete e.allowed_mcp_servers_and_groups)),await (0,$.organizationCreateCall)(R,e),W.Z.success("Organization created successfully"),ec(!1),em.resetFields(),X(R,q)}catch(e){console.error("Error creating organization:",e)}};return J?(0,i.jsxs)("div",{className:"w-full mx-4 h-[75vh]",children:[(0,i.jsx)(d.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,i.jsxs)(o.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[("Admin"===s||"Org Admin"===s)&&(0,i.jsx)(t.Z,{className:"w-fit",onClick:()=>ec(!0),children:"+ Create New Organization"}),Q?(0,i.jsx)(H,{organizationId:Q,onClose:()=>{ee(null),es(!1)},accessToken:R,is_org_admin:!0,is_proxy_admin:"Admin"===s,userModels:L,editOrg:el}):(0,i.jsxs)(u.Z,{className:"gap-2 h-[75vh] w-full",children:[(0,i.jsxs)(x.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,i.jsx)("div",{className:"flex",children:(0,i.jsx)(m.Z,{children:"Your Organizations"})}),(0,i.jsxs)("div",{className:"flex items-center space-x-2",children:[U&&(0,i.jsxs)(f.Z,{children:["Last Refreshed: ",U]}),(0,i.jsx)(c.Z,{icon:M.Z,variant:"shadow",size:"xs",className:"self-center",onClick:E})]})]}),(0,i.jsx)(_.Z,{children:(0,i.jsxs)(h.Z,{children:[(0,i.jsx)(f.Z,{children:"Click on “Organization ID” to view organization details."}),(0,i.jsx)(d.Z,{numItems:1,className:"gap-2 pt-2 pb-2 h-[75vh] w-full mt-2",children:(0,i.jsx)(o.Z,{numColSpan:1,children:(0,i.jsx)(n.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:(0,i.jsxs)(g.Z,{children:[(0,i.jsx)(v.Z,{children:(0,i.jsxs)(b.Z,{children:[(0,i.jsx)(Z.Z,{children:"Organization ID"}),(0,i.jsx)(Z.Z,{children:"Organization Name"}),(0,i.jsx)(Z.Z,{children:"Created"}),(0,i.jsx)(Z.Z,{children:"Spend (USD)"}),(0,i.jsx)(Z.Z,{children:"Budget (USD)"}),(0,i.jsx)(Z.Z,{children:"Models"}),(0,i.jsx)(Z.Z,{children:"TPM / RPM Limits"}),(0,i.jsx)(Z.Z,{children:"Info"}),(0,i.jsx)(Z.Z,{children:"Actions"})]})}),(0,i.jsx)(j.Z,{children:l&&l.length>0?l.sort((e,l)=>new Date(l.created_at).getTime()-new Date(e.created_at).getTime()).map(e=>{var l,a,n,o,d,m,u,x,h;return(0,i.jsxs)(b.Z,{children:[(0,i.jsx)(p.Z,{children:(0,i.jsx)("div",{className:"overflow-hidden",children:(0,i.jsx)(N.Z,{title:e.organization_id,children:(0,i.jsxs)(t.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>ee(e.organization_id),children:[null===(l=e.organization_id)||void 0===l?void 0:l.slice(0,7),"..."]})})})}),(0,i.jsx)(p.Z,{children:e.organization_alias}),(0,i.jsx)(p.Z,{children:e.created_at?new Date(e.created_at).toLocaleDateString():"N/A"}),(0,i.jsx)(p.Z,{children:(0,F.pw)(e.spend,4)}),(0,i.jsx)(p.Z,{children:(null===(a=e.litellm_budget_table)||void 0===a?void 0:a.max_budget)!==null&&(null===(n=e.litellm_budget_table)||void 0===n?void 0:n.max_budget)!==void 0?null===(o=e.litellm_budget_table)||void 0===o?void 0:o.max_budget:"No limit"}),(0,i.jsx)(p.Z,{style:{maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},className:e.models.length>3?"px-0":"",children:(0,i.jsx)("div",{className:"flex flex-col",children:Array.isArray(e.models)?(0,i.jsx)("div",{className:"flex flex-col",children:0===e.models.length?(0,i.jsx)(r.Z,{size:"xs",className:"mb-1",color:"red",children:(0,i.jsx)(f.Z,{children:"All Proxy Models"})}):(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"flex items-start",children:[e.models.length>3&&(0,i.jsx)("div",{children:(0,i.jsx)(c.Z,{icon:eu[e.organization_id||""]?k.Z:I.Z,className:"cursor-pointer",size:"xs",onClick:()=>{ex(l=>({...l,[e.organization_id||""]:!l[e.organization_id||""]}))}})}),(0,i.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.models.slice(0,3).map((e,l)=>"all-proxy-models"===e?(0,i.jsx)(r.Z,{size:"xs",color:"red",children:(0,i.jsx)(f.Z,{children:"All Proxy Models"})},l):(0,i.jsx)(r.Z,{size:"xs",color:"blue",children:(0,i.jsx)(f.Z,{children:e.length>30?"".concat((0,D.W0)(e).slice(0,30),"..."):(0,D.W0)(e)})},l)),e.models.length>3&&!eu[e.organization_id||""]&&(0,i.jsx)(r.Z,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,i.jsxs)(f.Z,{children:["+",e.models.length-3," ",e.models.length-3==1?"more model":"more models"]})}),eu[e.organization_id||""]&&(0,i.jsx)("div",{className:"flex flex-wrap gap-1",children:e.models.slice(3).map((e,l)=>"all-proxy-models"===e?(0,i.jsx)(r.Z,{size:"xs",color:"red",children:(0,i.jsx)(f.Z,{children:"All Proxy Models"})},l+3):(0,i.jsx)(r.Z,{size:"xs",color:"blue",children:(0,i.jsx)(f.Z,{children:e.length>30?"".concat((0,D.W0)(e).slice(0,30),"..."):(0,D.W0)(e)})},l+3))})]})]})})}):null})}),(0,i.jsx)(p.Z,{children:(0,i.jsxs)(f.Z,{children:["TPM:"," ",(null===(d=e.litellm_budget_table)||void 0===d?void 0:d.tpm_limit)?null===(m=e.litellm_budget_table)||void 0===m?void 0:m.tpm_limit:"Unlimited",(0,i.jsx)("br",{}),"RPM:"," ",(null===(u=e.litellm_budget_table)||void 0===u?void 0:u.rpm_limit)?null===(x=e.litellm_budget_table)||void 0===x?void 0:x.rpm_limit:"Unlimited"]})}),(0,i.jsx)(p.Z,{children:(0,i.jsxs)(f.Z,{children:[(null===(h=e.members)||void 0===h?void 0:h.length)||0," Members"]})}),(0,i.jsx)(p.Z,{children:"Admin"===s&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(N.Z,{title:"Edit organization",children:[" ",(0,i.jsx)(c.Z,{icon:P.Z,size:"sm",className:"cursor-pointer hover:text-blue-600",onClick:()=>{ee(e.organization_id),es(!0)}})]}),(0,i.jsxs)(N.Z,{title:"Delete organization",children:[" ",(0,i.jsx)(c.Z,{onClick:()=>eh(e.organization_id),icon:A.Z,size:"sm",className:"cursor-pointer hover:text-red-600"})]})]})})]},e.organization_id)}):null})]})})})})]})})]})]})}),(0,i.jsx)(C.Z,{title:"Create Organization",visible:ed,width:800,footer:null,onCancel:()=>{ec(!1),em.resetFields()},children:(0,i.jsxs)(y.Z,{form:em,onFinish:eg,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,i.jsx)(y.Z.Item,{label:"Organization Name",name:"organization_alias",rules:[{required:!0,message:"Please input an organization name"}],children:(0,i.jsx)(T.o,{placeholder:""})}),(0,i.jsx)(y.Z.Item,{label:"Models",name:"models",children:(0,i.jsxs)(S.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,i.jsx)(S.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),L&&L.length>0&&L.map(e=>(0,i.jsx)(S.default.Option,{value:e,children:(0,D.W0)(e)},e))]})}),(0,i.jsx)(y.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,i.jsx)(w.Z,{step:.01,precision:2,width:200})}),(0,i.jsx)(y.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,i.jsxs)(S.default,{defaultValue:null,placeholder:"n/a",children:[(0,i.jsx)(S.default.Option,{value:"24h",children:"daily"}),(0,i.jsx)(S.default.Option,{value:"7d",children:"weekly"}),(0,i.jsx)(S.default.Option,{value:"30d",children:"monthly"})]})}),(0,i.jsx)(y.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,i.jsx)(w.Z,{step:1,width:400})}),(0,i.jsx)(y.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,i.jsx)(w.Z,{step:1,width:400})}),(0,i.jsx)(y.Z.Item,{label:(0,i.jsxs)("span",{children:["Allowed Vector Stores"," ",(0,i.jsx)(N.Z,{title:"Select which vector stores this organization can access by default. Leave empty for access to all vector stores",children:(0,i.jsx)(O.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_vector_store_ids",className:"mt-4",help:"Select vector stores this organization can access. Leave empty for access to all vector stores",children:(0,i.jsx)(Y.Z,{onChange:e=>em.setFieldValue("allowed_vector_store_ids",e),value:em.getFieldValue("allowed_vector_store_ids"),accessToken:R||"",placeholder:"Select vector stores (optional)"})}),(0,i.jsx)(y.Z.Item,{label:(0,i.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,i.jsx)(N.Z,{title:"Select which MCP servers and access groups this organization can access by default.",children:(0,i.jsx)(O.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_mcp_servers_and_groups",className:"mt-4",help:"Select MCP servers and access groups this organization can access.",children:(0,i.jsx)(G.Z,{onChange:e=>em.setFieldValue("allowed_mcp_servers_and_groups",e),value:em.getFieldValue("allowed_mcp_servers_and_groups"),accessToken:R||"",placeholder:"Select MCP servers and access groups (optional)"})}),(0,i.jsx)(y.Z.Item,{label:"Metadata",name:"metadata",children:(0,i.jsx)(z.default.TextArea,{rows:4})}),(0,i.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,i.jsx)(t.Z,{type:"submit",children:"Create Organization"})})]})}),(0,i.jsx)(K.Z,{isOpen:ei,title:"Delete Organization?",message:"Are you sure you want to delete this organization? This action cannot be undone.",resourceInformationTitle:"Organization Information",resourceInformation:[{label:"Organization ID",value:er,code:!0}],onCancel:()=>{ea(!1),et(null)},onOk:e_,confirmLoading:en})]}):(0,i.jsx)("div",{children:(0,i.jsxs)(f.Z,{children:["This is a LiteLLM Enterprise feature, and requires a valid key to use. Get a trial key"," ",(0,i.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",children:"here"}),"."]})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2012-390546d3cdd37c82.js b/litellm/proxy/_experimental/out/_next/static/chunks/2012-390546d3cdd37c82.js new file mode 100644 index 0000000000..d3f4b1af8d --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/2012-390546d3cdd37c82.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2012],{26210:function(e,l,s){s.d(l,{UQ:function(){return t.Z},X1:function(){return i.Z},_m:function(){return a.Z},oi:function(){return n.Z},xv:function(){return r.Z}});var t=s(87452),i=s(88829),a=s(72208),r=s(84264),n=s(49566)},30078:function(e,l,s){s.d(l,{Ct:function(){return t.Z},Dx:function(){return x.Z},OK:function(){return n.Z},Zb:function(){return a.Z},nP:function(){return c.Z},oi:function(){return h.Z},rj:function(){return r.Z},td:function(){return o.Z},v0:function(){return m.Z},x4:function(){return d.Z},xv:function(){return u.Z},zx:function(){return i.Z}});var t=s(41649),i=s(78489),a=s(12514),r=s(67101),n=s(12485),m=s(18135),o=s(35242),d=s(29706),c=s(77991),u=s(84264),h=s(49566),x=s(96761)},62490:function(e,l,s){s.d(l,{Ct:function(){return t.Z},RM:function(){return n.Z},SC:function(){return c.Z},Zb:function(){return a.Z},iA:function(){return r.Z},pj:function(){return m.Z},ss:function(){return o.Z},xs:function(){return d.Z},xv:function(){return u.Z},zx:function(){return i.Z}});var t=s(41649),i=s(78489),a=s(12514),r=s(21626),n=s(97214),m=s(28241),o=s(58834),d=s(69552),c=s(71876),u=s(84264)},11318:function(e,l,s){s.d(l,{Z:function(){return n}});var t=s(2265),i=s(80443),a=s(19250);let r=async(e,l,s,t)=>"Admin"!=s&&"Admin Viewer"!=s?await (0,a.teamListCall)(e,(null==t?void 0:t.organization_id)||null,l):await (0,a.teamListCall)(e,(null==t?void 0:t.organization_id)||null);var n=()=>{let[e,l]=(0,t.useState)([]),{accessToken:s,userId:a,userRole:n}=(0,i.Z)();return(0,t.useEffect)(()=>{(async()=>{l(await r(s,a,n,null))})()},[s,a,n]),{teams:e,setTeams:l}}},21609:function(e,l,s){s.d(l,{Z:function(){return d}});var t=s(57437),i=s(57840),a=s(22116),r=s(51653),n=s(76188),m=s(4260),o=s(2265);function d(e){let{isOpen:l,title:s,alertMessage:d,message:c,resourceInformationTitle:u,resourceInformation:h,onCancel:x,onOk:p,confirmLoading:g,requiredConfirmation:b}=e,{Title:_,Text:v}=i.default,[j,f]=(0,o.useState)("");return(0,o.useEffect)(()=>{l&&f("")},[l]),(0,t.jsx)(a.Z,{title:s,open:l,onOk:p,onCancel:x,confirmLoading:g,okText:g?"Deleting...":"Delete",cancelText:"Cancel",okButtonProps:{danger:!0,disabled:!!b&&j!==b||g},cancelButtonProps:{disabled:g},children:(0,t.jsxs)("div",{className:"space-y-4",children:[d&&(0,t.jsx)(r.Z,{message:d,type:"warning"}),(0,t.jsxs)("div",{className:"mt-4 p-4 bg-red-50 rounded-lg border border-red-200",children:[(0,t.jsx)(_,{level:5,className:"mb-3 text-gray-900",children:u}),(0,t.jsx)(n.Z,{column:1,size:"small",children:h&&h.map(e=>{let{label:l,value:s,...i}=e;return(0,t.jsx)(n.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:l}),children:(0,t.jsx)(v,{...i,children:null!=s?s:"-"})},l)})})]}),(0,t.jsx)("div",{children:(0,t.jsx)(v,{children:c})}),b&&(0,t.jsxs)("div",{className:"mb-6 mt-4 pt-4 border-t border-gray-200",children:[(0,t.jsxs)(v,{className:"block text-base font-medium text-gray-700 mb-2",children:[(0,t.jsx)(v,{children:"Type "}),(0,t.jsx)(v,{strong:!0,type:"danger",children:b}),(0,t.jsx)(v,{children:" to confirm deletion:"})]}),(0,t.jsx)(m.default,{value:j,onChange:e=>f(e.target.value),placeholder:b,className:"rounded-md text-base border-gray-200",autoFocus:!0})]})]})})}},33860:function(e,l,s){var t=s(57437),i=s(2265),a=s(10032),r=s(22116),n=s(37592),m=s(99981),o=s(5545),d=s(7310),c=s.n(d),u=s(19250);l.Z=e=>{let{isVisible:l,onCancel:s,onSubmit:d,accessToken:h,title:x="Add Team Member",roles:p=[{label:"admin",value:"admin",description:"Admin role. Can create team keys, add members, and manage settings."},{label:"user",value:"user",description:"User role. Can view team info, but not manage it."}],defaultRole:g="user"}=e,[b]=a.Z.useForm(),[_,v]=(0,i.useState)([]),[j,f]=(0,i.useState)(!1),[Z,y]=(0,i.useState)("user_email"),N=async(e,l)=>{if(!e){v([]);return}f(!0);try{let s=new URLSearchParams;if(s.append(l,e),null==h)return;let t=(await (0,u.userFilterUICall)(h,s)).map(e=>({label:"user_email"===l?"".concat(e.user_email):"".concat(e.user_id),value:"user_email"===l?e.user_email:e.user_id,user:e}));v(t)}catch(e){console.error("Error fetching users:",e)}finally{f(!1)}},w=(0,i.useCallback)(c()((e,l)=>N(e,l),300),[]),k=(e,l)=>{y(l),w(e,l)},M=(e,l)=>{let s=l.user;b.setFieldsValue({user_email:s.user_email,user_id:s.user_id,role:b.getFieldValue("role")})};return(0,t.jsx)(r.Z,{title:x,open:l,onCancel:()=>{b.resetFields(),v([]),s()},footer:null,width:800,children:(0,t.jsxs)(a.Z,{form:b,onFinish:d,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:g},children:[(0,t.jsx)(a.Z.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,t.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>k(e,"user_email"),onSelect:(e,l)=>M(e,l),options:"user_email"===Z?_:[],loading:j,allowClear:!0})}),(0,t.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,t.jsx)(a.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>k(e,"user_id"),onSelect:(e,l)=>M(e,l),options:"user_id"===Z?_:[],loading:j,allowClear:!0})}),(0,t.jsx)(a.Z.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,t.jsx)(n.default,{defaultValue:g,children:p.map(e=>(0,t.jsx)(n.default.Option,{value:e.value,children:(0,t.jsxs)(m.Z,{title:e.description,children:[(0,t.jsx)("span",{className:"font-medium",children:e.label}),(0,t.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,t.jsx)("div",{className:"text-right mt-4",children:(0,t.jsx)(o.ZP,{type:"default",htmlType:"submit",children:"Add Member"})})]})})}},36894:function(e,l,s){var t=s(57437),i=s(56522),a=s(10032),r=s(37592),n=s(22116),m=s(5545),o=s(2265),d=s(24199);l.Z=e=>{var l,s,c;let{visible:u,onCancel:h,onSubmit:x,initialData:p,mode:g,config:b}=e,[_]=a.Z.useForm();console.log("Initial Data:",p),(0,o.useEffect)(()=>{if(u){if("edit"===g&&p){let e={...p,role:p.role||b.defaultRole,max_budget_in_team:p.max_budget_in_team||null,tpm_limit:p.tpm_limit||null,rpm_limit:p.rpm_limit||null};console.log("Setting form values:",e),_.setFieldsValue(e)}else{var e;_.resetFields(),_.setFieldsValue({role:b.defaultRole||(null===(e=b.roleOptions[0])||void 0===e?void 0:e.value)})}}},[u,p,g,_,b.defaultRole,b.roleOptions]);let v=async e=>{try{let l=Object.entries(e).reduce((e,l)=>{let[s,t]=l;if("string"==typeof t){let l=t.trim();return""===l&&("max_budget_in_team"===s||"tpm_limit"===s||"rpm_limit"===s)?{...e,[s]:null}:{...e,[s]:l}}return{...e,[s]:t}},{});console.log("Submitting form data:",l),x(l),_.resetFields()}catch(e){console.error("Form submission error:",e)}},j=e=>{switch(e.type){case"input":return(0,t.jsx)(i.o,{placeholder:e.placeholder});case"numerical":return(0,t.jsx)(d.Z,{step:e.step||1,min:e.min||0,style:{width:"100%"},placeholder:e.placeholder||"Enter a numerical value"});case"select":var l;return(0,t.jsx)(r.default,{children:null===(l=e.options)||void 0===l?void 0:l.map(e=>(0,t.jsx)(r.default.Option,{value:e.value,children:e.label},e.value))});default:return null}};return(0,t.jsx)(n.Z,{title:b.title||("add"===g?"Add Member":"Edit Member"),open:u,width:1e3,footer:null,onCancel:h,children:(0,t.jsxs)(a.Z,{form:_,onFinish:v,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[b.showEmail&&(0,t.jsx)(a.Z.Item,{label:"Email",name:"user_email",className:"mb-4",rules:[{type:"email",message:"Please enter a valid email!"}],children:(0,t.jsx)(i.o,{placeholder:"user@example.com"})}),b.showEmail&&b.showUserId&&(0,t.jsx)("div",{className:"text-center mb-4",children:(0,t.jsx)(i.x,{children:"OR"})}),b.showUserId&&(0,t.jsx)(a.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(i.o,{placeholder:"user_123"})}),(0,t.jsx)(a.Z.Item,{label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"Role"}),"edit"===g&&p&&(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(s=p.role,(null===(c=b.roleOptions.find(e=>e.value===s))||void 0===c?void 0:c.label)||s),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,t.jsx)(r.default,{children:"edit"===g&&p?[...b.roleOptions.filter(e=>e.value===p.role),...b.roleOptions.filter(e=>e.value!==p.role)].map(e=>(0,t.jsx)(r.default.Option,{value:e.value,children:e.label},e.value)):b.roleOptions.map(e=>(0,t.jsx)(r.default.Option,{value:e.value,children:e.label},e.value))})}),null===(l=b.additionalFields)||void 0===l?void 0:l.map(e=>(0,t.jsx)(a.Z.Item,{label:e.label,name:e.name,className:"mb-4",rules:e.rules,children:j(e)},e.name)),(0,t.jsxs)("div",{className:"text-right mt-6",children:[(0,t.jsx)(m.ZP,{onClick:h,className:"mr-2",children:"Cancel"}),(0,t.jsx)(m.ZP,{type:"default",htmlType:"submit",children:"add"===g?"Add Member":"Save Changes"})]})]})})}},33293:function(e,l,s){s.d(l,{Z:function(){return et}});var t=s(57437),i=s(33860),a=s(19250),r=s(59872),n=s(33304),m=s(15424),o=s(10900),d=s(30078),c=s(10032),u=s(42264),h=s(5545),x=s(4260),p=s(37592),g=s(99981),b=s(63709),_=s(30401),v=s(78867),j=s(2265),f=s(82586),Z=s(21609),y=s(95096),N=s(46468),w=s(27799),k=s(95920),M=s(68473),C=s(9114),S=s(60131),T=s(24199),I=s(97415),P=s(21425),L=s(36894),O=s(78489),F=s(12514),E=s(21626),D=s(97214),A=s(28241),R=s(58834),z=s(69552),U=s(71876),V=s(84264),B=s(96761),G=s(4156),q=s(85180),K=s(89245),$=s(78355);let J={"/key/generate":"Member can generate a virtual key for this team","/key/service-account/generate":"Member can generate a service account key (not belonging to any user) for this team","/key/update":"Member can update a virtual key belonging to this team","/key/delete":"Member can delete a virtual key belonging to this team","/key/info":"Member can get info about a virtual key belonging to this team","/key/regenerate":"Member can regenerate a virtual key belonging to this team","/key/{key_id}/regenerate":"Member can regenerate a virtual key belonging to this team","/key/list":"Member can list virtual keys belonging to this team","/key/block":"Member can block a virtual key belonging to this team","/key/unblock":"Member can unblock a virtual key belonging to this team"},Q=e=>e.includes("/info")||e.includes("/list")?"GET":"POST",W=e=>{let l=Q(e),s=J[e];if(!s){for(let[l,t]of Object.entries(J))if(e.includes(l)){s=t;break}}return s||(s="Access ".concat(e)),{method:l,endpoint:e,description:s,route:e}};var X=e=>{let{teamId:l,accessToken:s,canEditTeam:i}=e,[r,n]=(0,j.useState)([]),[m,o]=(0,j.useState)([]),[d,c]=(0,j.useState)(!0),[u,x]=(0,j.useState)(!1),[p,g]=(0,j.useState)(!1),b=async()=>{try{if(c(!0),!s)return;let e=await (0,a.getTeamPermissionsCall)(s,l),t=e.all_available_permissions||[];n(t);let i=e.team_member_permissions||[];o(i),g(!1)}catch(e){C.Z.fromBackend("Failed to load permissions"),console.error("Error fetching permissions:",e)}finally{c(!1)}};(0,j.useEffect)(()=>{b()},[l,s]);let _=(e,l)=>{o(l?[...m,e]:m.filter(l=>l!==e)),g(!0)},v=async()=>{try{if(!s)return;x(!0),await (0,a.teamPermissionsUpdateCall)(s,l,m),C.Z.success("Permissions updated successfully"),g(!1)}catch(e){C.Z.fromBackend("Failed to update permissions"),console.error("Error updating permissions:",e)}finally{x(!1)}};if(d)return(0,t.jsx)("div",{className:"p-6 text-center",children:"Loading permissions..."});let f=r.length>0;return(0,t.jsxs)(F.Z,{className:"bg-white shadow-md rounded-md p-6",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center border-b pb-4 mb-6",children:[(0,t.jsx)(B.Z,{className:"mb-2 sm:mb-0",children:"Member Permissions"}),i&&p&&(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsx)(h.ZP,{icon:(0,t.jsx)(K.Z,{}),onClick:()=>{b()},children:"Reset"}),(0,t.jsxs)(O.Z,{onClick:v,loading:u,className:"flex items-center gap-2",children:[(0,t.jsx)($.Z,{})," Save Changes"]})]})]}),(0,t.jsx)(V.Z,{className:"mb-6 text-gray-600",children:"Control what team members can do when they are not team admins."}),f?(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(E.Z,{className:" min-w-full",children:[(0,t.jsx)(R.Z,{children:(0,t.jsxs)(U.Z,{children:[(0,t.jsx)(z.Z,{children:"Method"}),(0,t.jsx)(z.Z,{children:"Endpoint"}),(0,t.jsx)(z.Z,{children:"Description"}),(0,t.jsx)(z.Z,{className:"sticky right-0 bg-white shadow-[-4px_0_4px_-4px_rgba(0,0,0,0.1)] text-center",children:"Allow Access"})]})}),(0,t.jsx)(D.Z,{children:r.map(e=>{let l=W(e);return(0,t.jsxs)(U.Z,{className:"hover:bg-gray-50 transition-colors",children:[(0,t.jsx)(A.Z,{children:(0,t.jsx)("span",{className:"px-2 py-1 rounded text-xs font-medium ".concat("GET"===l.method?"bg-blue-100 text-blue-800":"bg-green-100 text-green-800"),children:l.method})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)("span",{className:"font-mono text-sm text-gray-800",children:l.endpoint})}),(0,t.jsx)(A.Z,{className:"text-gray-700",children:l.description}),(0,t.jsx)(A.Z,{className:"sticky right-0 bg-white shadow-[-4px_0_4px_-4px_rgba(0,0,0,0.1)] text-center",children:(0,t.jsx)(G.Z,{checked:m.includes(e),onChange:l=>_(e,l.target.checked),disabled:!i})})]},e)})})]})}):(0,t.jsx)("div",{className:"py-12",children:(0,t.jsx)(q.Z,{description:"No permissions available"})})]})},Y=s(47323),H=s(53410),ee=s(74998),el=e=>{let{teamData:l,canEditTeam:s,handleMemberDelete:i,setSelectedEditMember:a,setIsEditMemberModalVisible:n,setIsAddMemberModalVisible:o}=e,d=e=>{if(null==e)return"0";if("number"==typeof e){let l=Number(e);return l===Math.floor(l)?l.toString():(0,r.pw)(l,8).replace(/\.?0+$/,"")}return"0"},c=e=>{if(!e)return 0;let s=l.team_memberships.find(l=>l.user_id===e);return(null==s?void 0:s.spend)||0},u=e=>{var s;if(!e)return null;let t=l.team_memberships.find(l=>l.user_id===e);console.log("membership=".concat(t));let i=null==t?void 0:null===(s=t.litellm_budget_table)||void 0===s?void 0:s.max_budget;return null==i?null:d(i)},h=e=>{var s,t;if(!e)return"No Limits";let i=l.team_memberships.find(l=>l.user_id===e),a=null==i?void 0:null===(s=i.litellm_budget_table)||void 0===s?void 0:s.rpm_limit,r=null==i?void 0:null===(t=i.litellm_budget_table)||void 0===t?void 0:t.tpm_limit,n=[a?"".concat(d(a)," RPM"):null,r?"".concat(d(r)," TPM"):null].filter(Boolean);return n.length>0?n.join(" / "):"No Limits"};return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(F.Z,{className:"w-full mx-auto flex-auto overflow-auto max-h-[50vh]",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(E.Z,{className:"min-w-full",children:[(0,t.jsx)(R.Z,{children:(0,t.jsxs)(U.Z,{children:[(0,t.jsx)(z.Z,{children:"User ID"}),(0,t.jsx)(z.Z,{children:"User Email"}),(0,t.jsx)(z.Z,{children:"Role"}),(0,t.jsxs)(z.Z,{children:["Team Member Spend (USD)"," ",(0,t.jsx)(g.Z,{title:"This is the amount spent by a user in the team.",children:(0,t.jsx)(m.Z,{})})]}),(0,t.jsx)(z.Z,{children:"Team Member Budget (USD)"}),(0,t.jsxs)(z.Z,{children:["Team Member Rate Limits"," ",(0,t.jsx)(g.Z,{title:"Rate limits for this member's usage within this team.",children:(0,t.jsx)(m.Z,{})})]}),(0,t.jsx)(z.Z,{className:"sticky right-0 bg-white z-10 border-l border-gray-200",children:"Actions"})]})}),(0,t.jsx)(D.Z,{children:l.team_info.members_with_roles.map((e,m)=>(0,t.jsxs)(U.Z,{children:[(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:e.user_id})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:e.user_email?e.user_email:"No Email"})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:e.role})}),(0,t.jsx)(A.Z,{children:(0,t.jsxs)(V.Z,{className:"font-mono",children:["$",(0,r.pw)(c(e.user_id),4)]})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:u(e.user_id)?"$".concat((0,r.pw)(Number(u(e.user_id)),4)):"No Limit"})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:h(e.user_id)})}),(0,t.jsx)(A.Z,{className:"sticky right-0 bg-white z-10 border-l border-gray-200",children:s&&(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(Y.Z,{icon:H.Z,size:"sm",onClick:()=>{var s,t,i;let r=l.team_memberships.find(l=>l.user_id===e.user_id);a({...e,max_budget_in_team:(null==r?void 0:null===(s=r.litellm_budget_table)||void 0===s?void 0:s.max_budget)||null,tpm_limit:(null==r?void 0:null===(t=r.litellm_budget_table)||void 0===t?void 0:t.tpm_limit)||null,rpm_limit:(null==r?void 0:null===(i=r.litellm_budget_table)||void 0===i?void 0:i.rpm_limit)||null}),n(!0)},className:"cursor-pointer hover:text-blue-600"}),(0,t.jsx)(Y.Z,{icon:ee.Z,size:"sm",onClick:()=>i(e),className:"cursor-pointer hover:text-red-600"})]})})]},m))})]})})}),(0,t.jsx)(O.Z,{onClick:()=>o(!0),children:"Add Member"})]})};let es=(e,l)=>{let s=[];return s=e?e.models.includes("all-proxy-models")?l:e.models.length>0?e.models:l:l,(0,N.Ob)(s,l)};var et=e=>{var l,s,O,F,E,D,A,R,z,U,V,B,G,q,K,$,J,Q,W,Y,H;let ee;let{teamId:et,onClose:ei,accessToken:ea,is_team_admin:er,is_proxy_admin:en,userModels:em,editTeam:eo,premiumUser:ed=!1,onUpdate:ec}=e,[eu,eh]=(0,j.useState)(null),[ex,ep]=(0,j.useState)(!0),[eg,eb]=(0,j.useState)(!1),[e_]=c.Z.useForm(),[ev,ej]=(0,j.useState)(!1),[ef,eZ]=(0,j.useState)(null),[ey,eN]=(0,j.useState)(!1),[ew,ek]=(0,j.useState)([]),[eM,eC]=(0,j.useState)(!1),[eS,eT]=(0,j.useState)({}),[eI,eP]=(0,j.useState)([]),[eL,eO]=(0,j.useState)(null),[eF,eE]=(0,j.useState)(!1),[eD,eA]=(0,j.useState)(!1),[eR,ez]=(0,j.useState)(!1),[eU,eV]=(0,j.useState)(null);console.log("userModels in team info",em);let eB=er||en,eG=async()=>{try{if(ep(!0),!ea)return;let e=await (0,a.teamInfoCall)(ea,et);eh(e)}catch(e){C.Z.fromBackend("Failed to load team information"),console.error("Error fetching team info:",e)}finally{ep(!1)}};(0,j.useEffect)(()=>{eG()},[et,ea]),(0,j.useEffect)(()=>{(async()=>{var e;if(!ea||!(null==eu?void 0:null===(e=eu.team_info)||void 0===e?void 0:e.organization_id)){eV(null);return}try{let e=await (0,a.organizationInfoCall)(ea,eu.team_info.organization_id);eV(e)}catch(e){console.error("Error fetching organization info:",e),eV(null)}})()},[ea,null==eu?void 0:null===(l=eu.team_info)||void 0===l?void 0:l.organization_id]);let eq=(0,j.useMemo)(()=>es(eU,em),[eU,em]);(0,j.useEffect)(()=>{(async()=>{try{if(!ea)return;let e=(await (0,a.getGuardrailsList)(ea)).guardrails.map(e=>e.guardrail_name);eP(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})()},[ea]);let eK=async e=>{try{if(null==ea)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role};await (0,a.teamMemberAddCall)(ea,et,l),C.Z.success("Team member added successfully"),eb(!1),e_.resetFields();let s=await (0,a.teamInfoCall)(ea,et);eh(s),ec(s)}catch(i){var l,s,t;let e="Failed to add team member";(null==i?void 0:null===(t=i.raw)||void 0===t?void 0:null===(s=t.detail)||void 0===s?void 0:null===(l=s.error)||void 0===l?void 0:l.includes("Assigning team admins is a premium feature"))?e="Assigning admins is an enterprise-only feature. Please upgrade your LiteLLM plan to enable this.":(null==i?void 0:i.message)&&(e=i.message),C.Z.fromBackend(e),console.error("Error adding team member:",i)}},e$=async e=>{try{if(null==ea)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role,max_budget_in_team:e.max_budget_in_team,tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit};console.log("Updating member with values:",l),u.ZP.destroy(),await (0,a.teamMemberUpdateCall)(ea,et,l),C.Z.success("Team member updated successfully"),ej(!1);let s=await (0,a.teamInfoCall)(ea,et);eh(s),ec(s)}catch(t){var l,s;let e="Failed to update team member";(null==t?void 0:null===(s=t.raw)||void 0===s?void 0:null===(l=s.detail)||void 0===l?void 0:l.includes("Assigning team admins is a premium feature"))?e="Assigning admins is an enterprise-only feature. Please upgrade your LiteLLM plan to enable this.":(null==t?void 0:t.message)&&(e=t.message),ej(!1),u.ZP.destroy(),C.Z.fromBackend(e),console.error("Error updating team member:",t)}},eJ=async()=>{if(eL&&ea){eA(!0);try{await (0,a.teamMemberDeleteCall)(ea,et,eL),C.Z.success("Team member removed successfully");let e=await (0,a.teamInfoCall)(ea,et);eh(e),ec(e)}catch(e){C.Z.fromBackend("Failed to remove team member"),console.error("Error removing team member:",e)}finally{eA(!1),eE(!1),eO(null)}}},eQ=async e=>{try{if(!ea)return;ez(!0);let l={};try{l=e.metadata?JSON.parse(e.metadata):{}}catch(e){C.Z.fromBackend("Invalid JSON in metadata field");return}let s=e=>null==e||"string"==typeof e&&""===e.trim()||"number"==typeof e&&Number.isNaN(e)?null:e,t={team_id:et,team_alias:e.team_alias,models:e.models,tpm_limit:s(e.tpm_limit),rpm_limit:s(e.rpm_limit),max_budget:e.max_budget,budget_duration:e.budget_duration,metadata:{...l,guardrails:e.guardrails||[],logging:e.logging_settings||[]},organization_id:e.organization_id};t.max_budget=(0,n.C)(t.max_budget),void 0!==e.team_member_budget&&(t.team_member_budget=Number(e.team_member_budget)),void 0!==e.team_member_key_duration&&(t.team_member_key_duration=e.team_member_key_duration),(void 0!==e.team_member_tpm_limit||void 0!==e.team_member_rpm_limit)&&(t.team_member_tpm_limit=s(e.team_member_tpm_limit),t.team_member_rpm_limit=s(e.team_member_rpm_limit));let{servers:i,accessGroups:r}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]},m=new Set(i||[]),o=Object.fromEntries(Object.entries(e.mcp_tool_permissions||{}).filter(e=>{let[l]=e;return m.has(l)}));t.object_permission={},i&&(t.object_permission.mcp_servers=i),r&&(t.object_permission.mcp_access_groups=r),o&&(t.object_permission.mcp_tool_permissions=o),delete e.mcp_servers_and_groups,delete e.mcp_tool_permissions;let{agents:d,accessGroups:c}=e.agents_and_groups||{agents:[],accessGroups:[]};d&&d.length>0&&(t.object_permission.agents=d),c&&c.length>0&&(t.object_permission.agent_access_groups=c),delete e.agents_and_groups,await (0,a.teamUpdateCall)(ea,t),C.Z.success("Team settings updated successfully"),eN(!1),eG()}catch(e){console.error("Error updating team:",e)}finally{ez(!1)}};if(ex)return(0,t.jsx)("div",{className:"p-4",children:"Loading..."});if(!(null==eu?void 0:eu.team_info))return(0,t.jsx)("div",{className:"p-4",children:"Team not found"});let{team_info:eW}=eu,eX=async(e,l)=>{await (0,r.vQ)(e)&&(eT(e=>({...e,[l]:!0})),setTimeout(()=>{eT(e=>({...e,[l]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(d.zx,{icon:o.Z,variant:"light",onClick:ei,className:"mb-4",children:"Back to Teams"}),(0,t.jsx)(d.Dx,{children:eW.team_alias}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(d.xv,{className:"text-gray-500 font-mono",children:eW.team_id}),(0,t.jsx)(h.ZP,{type:"text",size:"small",icon:eS["team-id"]?(0,t.jsx)(_.Z,{size:12}):(0,t.jsx)(v.Z,{size:12}),onClick:()=>eX(eW.team_id,"team-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eS["team-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,t.jsxs)(d.v0,{defaultIndex:eo?3:0,children:[(0,t.jsx)(d.td,{className:"mb-4",children:[(0,t.jsx)(d.OK,{children:"Overview"},"overview"),...eB?[(0,t.jsx)(d.OK,{children:"Members"},"members"),(0,t.jsx)(d.OK,{children:"Member Permissions"},"member-permissions"),(0,t.jsx)(d.OK,{children:"Settings"},"settings")]:[]]}),(0,t.jsxs)(d.nP,{children:[(0,t.jsx)(d.x4,{children:(0,t.jsxs)(d.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(d.Zb,{children:[(0,t.jsx)(d.xv,{children:"Budget Status"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(d.Dx,{children:["$",(0,r.pw)(eW.spend,4)]}),(0,t.jsxs)(d.xv,{children:["of ",null===eW.max_budget?"Unlimited":"$".concat((0,r.pw)(eW.max_budget,4))]}),eW.budget_duration&&(0,t.jsxs)(d.xv,{className:"text-gray-500",children:["Reset: ",eW.budget_duration]}),(0,t.jsx)("br",{}),eW.team_member_budget_table&&(0,t.jsxs)(d.xv,{className:"text-gray-500",children:["Team Member Budget: $",(0,r.pw)(eW.team_member_budget_table.max_budget,4)]})]})]}),(0,t.jsxs)(d.Zb,{children:[(0,t.jsx)(d.xv,{children:"Rate Limits"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(d.xv,{children:["TPM: ",eW.tpm_limit||"Unlimited"]}),(0,t.jsxs)(d.xv,{children:["RPM: ",eW.rpm_limit||"Unlimited"]}),eW.max_parallel_requests&&(0,t.jsxs)(d.xv,{children:["Max Parallel Requests: ",eW.max_parallel_requests]})]})]}),(0,t.jsxs)(d.Zb,{children:[(0,t.jsx)(d.xv,{children:"Models"}),(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:0===eW.models.length?(0,t.jsx)(d.Ct,{color:"red",children:"All proxy models"}):eW.models.map((e,l)=>(0,t.jsx)(d.Ct,{color:"red",children:e},l))})]}),(0,t.jsxs)(d.Zb,{children:[(0,t.jsx)(d.xv,{className:"font-semibold text-gray-900",children:"Virtual Keys"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(d.xv,{children:["User Keys: ",eu.keys.filter(e=>e.user_id).length]}),(0,t.jsxs)(d.xv,{children:["Service Account Keys: ",eu.keys.filter(e=>!e.user_id).length]}),(0,t.jsxs)(d.xv,{className:"text-gray-500",children:["Total: ",eu.keys.length]})]})]}),(0,t.jsx)(S.Z,{objectPermission:eW.object_permission,variant:"card",accessToken:ea}),(0,t.jsx)(w.Z,{loggingConfigs:(null===(s=eW.metadata)||void 0===s?void 0:s.logging)||[],disabledCallbacks:[],variant:"card"})]})}),(0,t.jsx)(d.x4,{children:(0,t.jsx)(el,{teamData:eu,canEditTeam:eB,handleMemberDelete:e=>{eO(e),eE(!0)},setSelectedEditMember:eZ,setIsEditMemberModalVisible:ej,setIsAddMemberModalVisible:eb})}),eB&&(0,t.jsx)(d.x4,{children:(0,t.jsx)(X,{teamId:et,accessToken:ea,canEditTeam:eB})}),(0,t.jsx)(d.x4,{children:(0,t.jsxs)(d.Zb,{className:"overflow-y-auto max-h-[65vh]",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(d.Dx,{children:"Team Settings"}),eB&&!ey&&(0,t.jsx)(d.zx,{onClick:()=>eN(!0),children:"Edit Settings"})]}),ey?(0,t.jsxs)(c.Z,{form:e_,onFinish:eQ,initialValues:{...eW,team_alias:eW.team_alias,models:eW.models,tpm_limit:eW.tpm_limit,rpm_limit:eW.rpm_limit,max_budget:eW.max_budget,budget_duration:eW.budget_duration,team_member_tpm_limit:null===(O=eW.team_member_budget_table)||void 0===O?void 0:O.tpm_limit,team_member_rpm_limit:null===(F=eW.team_member_budget_table)||void 0===F?void 0:F.rpm_limit,guardrails:(null===(E=eW.metadata)||void 0===E?void 0:E.guardrails)||[],disable_global_guardrails:(null===(D=eW.metadata)||void 0===D?void 0:D.disable_global_guardrails)||!1,metadata:eW.metadata?JSON.stringify((e=>{let{logging:l,...s}=e;return s})(eW.metadata),null,2):"",logging_settings:(null===(A=eW.metadata)||void 0===A?void 0:A.logging)||[],organization_id:eW.organization_id,vector_stores:(null===(R=eW.object_permission)||void 0===R?void 0:R.vector_stores)||[],mcp_servers:(null===(z=eW.object_permission)||void 0===z?void 0:z.mcp_servers)||[],mcp_access_groups:(null===(U=eW.object_permission)||void 0===U?void 0:U.mcp_access_groups)||[],mcp_servers_and_groups:{servers:(null===(V=eW.object_permission)||void 0===V?void 0:V.mcp_servers)||[],accessGroups:(null===(B=eW.object_permission)||void 0===B?void 0:B.mcp_access_groups)||[]},mcp_tool_permissions:(null===(G=eW.object_permission)||void 0===G?void 0:G.mcp_tool_permissions)||{},agents_and_groups:{agents:(null===(q=eW.object_permission)||void 0===q?void 0:q.agents)||[],accessGroups:(null===(K=eW.object_permission)||void 0===K?void 0:K.agent_access_groups)||[]}},layout:"vertical",children:[(0,t.jsx)(c.Z.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,t.jsx)(x.default,{type:""})}),(0,t.jsx)(c.Z.Item,{label:"Models",name:"models",rules:[{required:!0,message:"Please select at least one model"}],children:(0,t.jsxs)(p.default,{mode:"multiple",placeholder:"Select models",children:[(ee=!1,eU?(0===eU.models.length||eU.models.includes("all-proxy-models"))&&(ee=!0):ee=en||em.includes("all-proxy-models"),ee?(0,t.jsx)(p.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"):null),!eU||eU.models.includes("no-default-models")?(0,t.jsx)(p.default.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"):null,Array.from(new Set(eq)).map((e,l)=>(0,t.jsx)(p.default.Option,{value:e,children:(0,N.W0)(e)},l))]})}),(0,t.jsx)(c.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(T.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:"Team Member Budget (USD)",name:"team_member_budget",tooltip:"This is the individual budget for a user in the team.",children:(0,t.jsx)(T.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:"Team Member Key Duration (eg: 1d, 1mo)",name:"team_member_key_duration",tooltip:"Set a limit to the duration of a team member's key. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days), 1mo (month)",children:(0,t.jsx)(d.oi,{placeholder:"e.g., 30d"})}),(0,t.jsx)(c.Z.Item,{label:"Team Member TPM Limit",name:"team_member_tpm_limit",tooltip:"Default tokens per minute limit for an individual team member. This limit applies to all requests the user makes within this team. Can be overridden per member.",children:(0,t.jsx)(T.Z,{step:1,style:{width:"100%"},placeholder:"e.g., 1000"})}),(0,t.jsx)(c.Z.Item,{label:"Team Member RPM Limit",name:"team_member_rpm_limit",tooltip:"Default requests per minute limit for an individual team member. This limit applies to all requests the user makes within this team. Can be overridden per member.",children:(0,t.jsx)(T.Z,{step:1,style:{width:"100%"},placeholder:"e.g., 100"})}),(0,t.jsx)(c.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)(p.default,{placeholder:"n/a",children:[(0,t.jsx)(p.default.Option,{value:"24h",children:"daily"}),(0,t.jsx)(p.default.Option,{value:"7d",children:"weekly"}),(0,t.jsx)(p.default.Option,{value:"30d",children:"monthly"})]})}),(0,t.jsx)(c.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,t.jsx)(T.Z,{step:1,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,t.jsx)(T.Z,{step:1,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:(0,t.jsxs)("span",{children:["Guardrails"," ",(0,t.jsx)(g.Z,{title:"Setup your first guardrail",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",help:"Select existing guardrails or enter new ones",children:(0,t.jsx)(p.default,{mode:"tags",placeholder:"Select or enter guardrails",options:eI.map(e=>({value:e,label:e}))})}),(0,t.jsx)(c.Z.Item,{label:(0,t.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,t.jsx)(g.Z,{title:"When enabled, this team will bypass any guardrails configured to run on every request (global guardrails)",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),name:"disable_global_guardrails",valuePropName:"checked",help:"Bypass global guardrails for this team",children:(0,t.jsx)(b.Z,{checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(c.Z.Item,{label:"Vector Stores",name:"vector_stores",children:(0,t.jsx)(I.Z,{onChange:e=>e_.setFieldValue("vector_stores",e),value:e_.getFieldValue("vector_stores"),accessToken:ea||"",placeholder:"Select vector stores"})}),(0,t.jsx)(c.Z.Item,{label:"Allowed Pass Through Routes",name:"allowed_passthrough_routes",children:(0,t.jsx)(y.Z,{onChange:e=>e_.setFieldValue("allowed_passthrough_routes",e),value:e_.getFieldValue("allowed_passthrough_routes"),accessToken:ea||"",placeholder:"Select pass through routes"})}),(0,t.jsx)(c.Z.Item,{label:"MCP Servers / Access Groups",name:"mcp_servers_and_groups",children:(0,t.jsx)(k.Z,{onChange:e=>e_.setFieldValue("mcp_servers_and_groups",e),value:e_.getFieldValue("mcp_servers_and_groups"),accessToken:ea||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(c.Z.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(x.default,{type:"hidden"})}),(0,t.jsx)(c.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.mcp_servers_and_groups!==l.mcp_servers_and_groups||e.mcp_tool_permissions!==l.mcp_tool_permissions,children:()=>{var e;return(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)(M.Z,{accessToken:ea||"",selectedServers:(null===(e=e_.getFieldValue("mcp_servers_and_groups"))||void 0===e?void 0:e.servers)||[],toolPermissions:e_.getFieldValue("mcp_tool_permissions")||{},onChange:e=>e_.setFieldsValue({mcp_tool_permissions:e})})})}}),(0,t.jsx)(c.Z.Item,{label:"Agents / Access Groups",name:"agents_and_groups",children:(0,t.jsx)(f.Z,{onChange:e=>e_.setFieldValue("agents_and_groups",e),value:e_.getFieldValue("agents_and_groups"),accessToken:ea||"",placeholder:"Select agents or access groups (optional)"})}),(0,t.jsx)(c.Z.Item,{label:"Organization ID",name:"organization_id",children:(0,t.jsx)(x.default,{type:"",disabled:!0})}),(0,t.jsx)(c.Z.Item,{label:"Logging Settings",name:"logging_settings",children:(0,t.jsx)(P.Z,{value:e_.getFieldValue("logging_settings"),onChange:e=>e_.setFieldValue("logging_settings",e)})}),(0,t.jsx)(c.Z.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(x.default.TextArea,{rows:10})}),(0,t.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,t.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,t.jsx)(d.zx,{variant:"secondary",onClick:()=>eN(!1),disabled:eR,children:"Cancel"}),(0,t.jsx)(d.zx,{type:"submit",loading:eR,children:"Save Changes"})]})})]}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Team Name"}),(0,t.jsx)("div",{children:eW.team_alias})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Team ID"}),(0,t.jsx)("div",{className:"font-mono",children:eW.team_id})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Created At"}),(0,t.jsx)("div",{children:new Date(eW.created_at).toLocaleString()})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:eW.models.map((e,l)=>(0,t.jsx)(d.Ct,{color:"red",children:e},l))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Rate Limits"}),(0,t.jsxs)("div",{children:["TPM: ",eW.tpm_limit||"Unlimited"]}),(0,t.jsxs)("div",{children:["RPM: ",eW.rpm_limit||"Unlimited"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Team Budget"}),(0,t.jsxs)("div",{children:["Max Budget:"," ",null!==eW.max_budget?"$".concat((0,r.pw)(eW.max_budget,4)):"No Limit"]}),(0,t.jsxs)("div",{children:["Budget Reset: ",eW.budget_duration||"Never"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(d.xv,{className:"font-medium",children:["Team Member Settings"," ",(0,t.jsx)(g.Z,{title:"These are limits on individual team members",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),(0,t.jsxs)("div",{children:["Max Budget: ",(null===($=eW.team_member_budget_table)||void 0===$?void 0:$.max_budget)||"No Limit"]}),(0,t.jsxs)("div",{children:["Key Duration: ",(null===(J=eW.metadata)||void 0===J?void 0:J.team_member_key_duration)||"No Limit"]}),(0,t.jsxs)("div",{children:["TPM Limit: ",(null===(Q=eW.team_member_budget_table)||void 0===Q?void 0:Q.tpm_limit)||"No Limit"]}),(0,t.jsxs)("div",{children:["RPM Limit: ",(null===(W=eW.team_member_budget_table)||void 0===W?void 0:W.rpm_limit)||"No Limit"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Organization ID"}),(0,t.jsx)("div",{children:eW.organization_id})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Status"}),(0,t.jsx)(d.Ct,{color:eW.blocked?"red":"green",children:eW.blocked?"Blocked":"Active"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Disable Global Guardrails"}),(0,t.jsx)("div",{children:(null===(Y=eW.metadata)||void 0===Y?void 0:Y.disable_global_guardrails)===!0?(0,t.jsx)(d.Ct,{color:"yellow",children:"Enabled - Global guardrails bypassed"}):(0,t.jsx)(d.Ct,{color:"green",children:"Disabled - Global guardrails active"})})]}),(0,t.jsx)(S.Z,{objectPermission:eW.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:ea}),(0,t.jsx)(w.Z,{loggingConfigs:(null===(H=eW.metadata)||void 0===H?void 0:H.logging)||[],disabledCallbacks:[],variant:"inline",className:"pt-4 border-t border-gray-200"})]})]})})]})]}),(0,t.jsx)(L.Z,{visible:ev,onCancel:()=>ej(!1),onSubmit:e$,initialData:ef,mode:"edit",config:{title:"Edit Member",showEmail:!0,showUserId:!0,roleOptions:[{label:"Admin",value:"admin"},{label:"User",value:"user"}],additionalFields:[{name:"max_budget_in_team",label:(0,t.jsxs)("span",{children:["Team Member Budget (USD)"," ",(0,t.jsx)(g.Z,{title:"Maximum amount in USD this member can spend within this team. This is separate from any global user budget limits",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:.01,min:0,placeholder:"Budget limit for this member within this team"},{name:"tpm_limit",label:(0,t.jsxs)("span",{children:["Team Member TPM Limit"," ",(0,t.jsx)(g.Z,{title:"Maximum tokens per minute this member can use within this team. This is separate from any global user TPM limit",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:1,min:0,placeholder:"Tokens per minute limit for this member in this team"},{name:"rpm_limit",label:(0,t.jsxs)("span",{children:["Team Member RPM Limit"," ",(0,t.jsx)(g.Z,{title:"Maximum requests per minute this member can make within this team. This is separate from any global user RPM limit",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:1,min:0,placeholder:"Requests per minute limit for this member in this team"}]}}),(0,t.jsx)(i.Z,{isVisible:eg,onCancel:()=>eb(!1),onSubmit:eK,accessToken:ea}),(0,t.jsx)(Z.Z,{isOpen:eF,title:"Delete Team Member",alertMessage:"Removing team members will also delete any keys created by or created for this member.",message:"Are you sure you want to remove this member from the team? This action cannot be undone.",resourceInformationTitle:"Team Member Information",resourceInformation:[{label:"User ID",value:null==eL?void 0:eL.user_id,code:!0},{label:"Email",value:null==eL?void 0:eL.user_email},{label:"Role",value:null==eL?void 0:eL.role}],onCancel:()=>{eE(!1),eO(null)},onOk:eJ,confirmLoading:eD})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2012-dcbd62e829c6106f.js b/litellm/proxy/_experimental/out/_next/static/chunks/2012-dcbd62e829c6106f.js deleted file mode 100644 index c7545f87f9..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/2012-dcbd62e829c6106f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2012],{26210:function(e,l,s){s.d(l,{UQ:function(){return t.Z},X1:function(){return i.Z},_m:function(){return a.Z},oi:function(){return n.Z},xv:function(){return r.Z}});var t=s(87452),i=s(88829),a=s(72208),r=s(84264),n=s(49566)},30078:function(e,l,s){s.d(l,{Ct:function(){return t.Z},Dx:function(){return x.Z},OK:function(){return n.Z},Zb:function(){return a.Z},nP:function(){return c.Z},oi:function(){return h.Z},rj:function(){return r.Z},td:function(){return o.Z},v0:function(){return m.Z},x4:function(){return d.Z},xv:function(){return u.Z},zx:function(){return i.Z}});var t=s(41649),i=s(78489),a=s(12514),r=s(67101),n=s(12485),m=s(18135),o=s(35242),d=s(29706),c=s(77991),u=s(84264),h=s(49566),x=s(96761)},62490:function(e,l,s){s.d(l,{Ct:function(){return t.Z},RM:function(){return n.Z},SC:function(){return c.Z},Zb:function(){return a.Z},iA:function(){return r.Z},pj:function(){return m.Z},ss:function(){return o.Z},xs:function(){return d.Z},xv:function(){return u.Z},zx:function(){return i.Z}});var t=s(41649),i=s(78489),a=s(12514),r=s(21626),n=s(97214),m=s(28241),o=s(58834),d=s(69552),c=s(71876),u=s(84264)},11318:function(e,l,s){s.d(l,{Z:function(){return n}});var t=s(2265),i=s(39760),a=s(19250);let r=async(e,l,s,t)=>"Admin"!=s&&"Admin Viewer"!=s?await (0,a.teamListCall)(e,(null==t?void 0:t.organization_id)||null,l):await (0,a.teamListCall)(e,(null==t?void 0:t.organization_id)||null);var n=()=>{let[e,l]=(0,t.useState)([]),{accessToken:s,userId:a,userRole:n}=(0,i.Z)();return(0,t.useEffect)(()=>{(async()=>{l(await r(s,a,n,null))})()},[s,a,n]),{teams:e,setTeams:l}}},21609:function(e,l,s){s.d(l,{Z:function(){return d}});var t=s(57437),i=s(57840),a=s(22116),r=s(51653),n=s(76188),m=s(4260),o=s(2265);function d(e){let{isOpen:l,title:s,alertMessage:d,message:c,resourceInformationTitle:u,resourceInformation:h,onCancel:x,onOk:p,confirmLoading:g,requiredConfirmation:b}=e,{Title:_,Text:v}=i.default,[j,f]=(0,o.useState)("");return(0,o.useEffect)(()=>{l&&f("")},[l]),(0,t.jsx)(a.Z,{title:s,open:l,onOk:p,onCancel:x,confirmLoading:g,okText:g?"Deleting...":"Delete",cancelText:"Cancel",okButtonProps:{danger:!0,disabled:!!b&&j!==b||g},cancelButtonProps:{disabled:g},children:(0,t.jsxs)("div",{className:"space-y-4",children:[d&&(0,t.jsx)(r.Z,{message:d,type:"warning"}),(0,t.jsxs)("div",{className:"mt-4 p-4 bg-red-50 rounded-lg border border-red-200",children:[(0,t.jsx)(_,{level:5,className:"mb-3 text-gray-900",children:u}),(0,t.jsx)(n.Z,{column:1,size:"small",children:h&&h.map(e=>{let{label:l,value:s,...i}=e;return(0,t.jsx)(n.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:l}),children:(0,t.jsx)(v,{...i,children:null!=s?s:"-"})},l)})})]}),(0,t.jsx)("div",{children:(0,t.jsx)(v,{children:c})}),b&&(0,t.jsxs)("div",{className:"mb-6 mt-4 pt-4 border-t border-gray-200",children:[(0,t.jsxs)(v,{className:"block text-base font-medium text-gray-700 mb-2",children:[(0,t.jsx)(v,{children:"Type "}),(0,t.jsx)(v,{strong:!0,type:"danger",children:b}),(0,t.jsx)(v,{children:" to confirm deletion:"})]}),(0,t.jsx)(m.default,{value:j,onChange:e=>f(e.target.value),placeholder:b,className:"rounded-md text-base border-gray-200",autoFocus:!0})]})]})})}},33860:function(e,l,s){var t=s(57437),i=s(2265),a=s(10032),r=s(22116),n=s(37592),m=s(99981),o=s(5545),d=s(7310),c=s.n(d),u=s(19250);l.Z=e=>{let{isVisible:l,onCancel:s,onSubmit:d,accessToken:h,title:x="Add Team Member",roles:p=[{label:"admin",value:"admin",description:"Admin role. Can create team keys, add members, and manage settings."},{label:"user",value:"user",description:"User role. Can view team info, but not manage it."}],defaultRole:g="user"}=e,[b]=a.Z.useForm(),[_,v]=(0,i.useState)([]),[j,f]=(0,i.useState)(!1),[Z,y]=(0,i.useState)("user_email"),N=async(e,l)=>{if(!e){v([]);return}f(!0);try{let s=new URLSearchParams;if(s.append(l,e),null==h)return;let t=(await (0,u.userFilterUICall)(h,s)).map(e=>({label:"user_email"===l?"".concat(e.user_email):"".concat(e.user_id),value:"user_email"===l?e.user_email:e.user_id,user:e}));v(t)}catch(e){console.error("Error fetching users:",e)}finally{f(!1)}},w=(0,i.useCallback)(c()((e,l)=>N(e,l),300),[]),k=(e,l)=>{y(l),w(e,l)},M=(e,l)=>{let s=l.user;b.setFieldsValue({user_email:s.user_email,user_id:s.user_id,role:b.getFieldValue("role")})};return(0,t.jsx)(r.Z,{title:x,open:l,onCancel:()=>{b.resetFields(),v([]),s()},footer:null,width:800,children:(0,t.jsxs)(a.Z,{form:b,onFinish:d,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:g},children:[(0,t.jsx)(a.Z.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,t.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>k(e,"user_email"),onSelect:(e,l)=>M(e,l),options:"user_email"===Z?_:[],loading:j,allowClear:!0})}),(0,t.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,t.jsx)(a.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>k(e,"user_id"),onSelect:(e,l)=>M(e,l),options:"user_id"===Z?_:[],loading:j,allowClear:!0})}),(0,t.jsx)(a.Z.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,t.jsx)(n.default,{defaultValue:g,children:p.map(e=>(0,t.jsx)(n.default.Option,{value:e.value,children:(0,t.jsxs)(m.Z,{title:e.description,children:[(0,t.jsx)("span",{className:"font-medium",children:e.label}),(0,t.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,t.jsx)("div",{className:"text-right mt-4",children:(0,t.jsx)(o.ZP,{type:"default",htmlType:"submit",children:"Add Member"})})]})})}},10901:function(e,l,s){s.d(l,{Z:function(){return h}});var t=s(57437),i=s(2265),a=s(10032),r=s(22116),n=s(5545),m=s(27281),o=s(43227),d=s(49566),c=s(92280),u=s(24199),h=e=>{var l,s,h;let{visible:x,onCancel:p,onSubmit:g,initialData:b,mode:_,config:v}=e,[j]=a.Z.useForm();console.log("Initial Data:",b),(0,i.useEffect)(()=>{if(x){if("edit"===_&&b){let e={...b,role:b.role||v.defaultRole,max_budget_in_team:b.max_budget_in_team||null,tpm_limit:b.tpm_limit||null,rpm_limit:b.rpm_limit||null};console.log("Setting form values:",e),j.setFieldsValue(e)}else{var e;j.resetFields(),j.setFieldsValue({role:v.defaultRole||(null===(e=v.roleOptions[0])||void 0===e?void 0:e.value)})}}},[x,b,_,j,v.defaultRole,v.roleOptions]);let f=async e=>{try{let l=Object.entries(e).reduce((e,l)=>{let[s,t]=l;if("string"==typeof t){let l=t.trim();return""===l&&("max_budget_in_team"===s||"tpm_limit"===s||"rpm_limit"===s)?{...e,[s]:null}:{...e,[s]:l}}return{...e,[s]:t}},{});console.log("Submitting form data:",l),g(l),j.resetFields()}catch(e){console.error("Form submission error:",e)}},Z=e=>{switch(e.type){case"input":return(0,t.jsx)(d.Z,{placeholder:e.placeholder});case"numerical":return(0,t.jsx)(u.Z,{step:e.step||1,min:e.min||0,style:{width:"100%"},placeholder:e.placeholder||"Enter a numerical value"});case"select":var l;return(0,t.jsx)(m.Z,{children:null===(l=e.options)||void 0===l?void 0:l.map(e=>(0,t.jsx)(o.Z,{value:e.value,children:e.label},e.value))});default:return null}};return(0,t.jsx)(r.Z,{title:v.title||("add"===_?"Add Member":"Edit Member"),open:x,width:1e3,footer:null,onCancel:p,children:(0,t.jsxs)(a.Z,{form:j,onFinish:f,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[v.showEmail&&(0,t.jsx)(a.Z.Item,{label:"Email",name:"user_email",className:"mb-4",rules:[{type:"email",message:"Please enter a valid email!"}],children:(0,t.jsx)(d.Z,{placeholder:"user@example.com"})}),v.showEmail&&v.showUserId&&(0,t.jsx)("div",{className:"text-center mb-4",children:(0,t.jsx)(c.x,{children:"OR"})}),v.showUserId&&(0,t.jsx)(a.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(d.Z,{placeholder:"user_123"})}),(0,t.jsx)(a.Z.Item,{label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"Role"}),"edit"===_&&b&&(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(s=b.role,(null===(h=v.roleOptions.find(e=>e.value===s))||void 0===h?void 0:h.label)||s),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,t.jsx)(m.Z,{children:"edit"===_&&b?[...v.roleOptions.filter(e=>e.value===b.role),...v.roleOptions.filter(e=>e.value!==b.role)].map(e=>(0,t.jsx)(o.Z,{value:e.value,children:e.label},e.value)):v.roleOptions.map(e=>(0,t.jsx)(o.Z,{value:e.value,children:e.label},e.value))})}),null===(l=v.additionalFields)||void 0===l?void 0:l.map(e=>(0,t.jsx)(a.Z.Item,{label:e.label,name:e.name,className:"mb-4",rules:e.rules,children:Z(e)},e.name)),(0,t.jsxs)("div",{className:"text-right mt-6",children:[(0,t.jsx)(n.ZP,{onClick:p,className:"mr-2",children:"Cancel"}),(0,t.jsx)(n.ZP,{type:"default",htmlType:"submit",children:"add"===_?"Add Member":"Save Changes"})]})]})})}},33293:function(e,l,s){s.d(l,{Z:function(){return et}});var t=s(57437),i=s(33860),a=s(19250),r=s(59872),n=s(33304),m=s(15424),o=s(77331),d=s(30078),c=s(10032),u=s(42264),h=s(5545),x=s(4260),p=s(37592),g=s(99981),b=s(63709),_=s(30401),v=s(78867),j=s(2265),f=s(21609),Z=s(95096),y=s(46468),N=s(27799),w=s(95920),k=s(68473),M=s(82586),C=s(9114),S=s(60131),T=s(24199),I=s(97415),P=s(10901),L=s(21425),F=s(78489),E=s(12514),O=s(21626),D=s(97214),A=s(28241),R=s(58834),z=s(69552),U=s(71876),V=s(84264),B=s(96761),G=s(61994),q=s(85180),K=s(89245),$=s(78355);let J={"/key/generate":"Member can generate a virtual key for this team","/key/service-account/generate":"Member can generate a service account key (not belonging to any user) for this team","/key/update":"Member can update a virtual key belonging to this team","/key/delete":"Member can delete a virtual key belonging to this team","/key/info":"Member can get info about a virtual key belonging to this team","/key/regenerate":"Member can regenerate a virtual key belonging to this team","/key/{key_id}/regenerate":"Member can regenerate a virtual key belonging to this team","/key/list":"Member can list virtual keys belonging to this team","/key/block":"Member can block a virtual key belonging to this team","/key/unblock":"Member can unblock a virtual key belonging to this team"},Q=e=>e.includes("/info")||e.includes("/list")?"GET":"POST",W=e=>{let l=Q(e),s=J[e];if(!s){for(let[l,t]of Object.entries(J))if(e.includes(l)){s=t;break}}return s||(s="Access ".concat(e)),{method:l,endpoint:e,description:s,route:e}};var X=e=>{let{teamId:l,accessToken:s,canEditTeam:i}=e,[r,n]=(0,j.useState)([]),[m,o]=(0,j.useState)([]),[d,c]=(0,j.useState)(!0),[u,x]=(0,j.useState)(!1),[p,g]=(0,j.useState)(!1),b=async()=>{try{if(c(!0),!s)return;let e=await (0,a.getTeamPermissionsCall)(s,l),t=e.all_available_permissions||[];n(t);let i=e.team_member_permissions||[];o(i),g(!1)}catch(e){C.Z.fromBackend("Failed to load permissions"),console.error("Error fetching permissions:",e)}finally{c(!1)}};(0,j.useEffect)(()=>{b()},[l,s]);let _=(e,l)=>{o(l?[...m,e]:m.filter(l=>l!==e)),g(!0)},v=async()=>{try{if(!s)return;x(!0),await (0,a.teamPermissionsUpdateCall)(s,l,m),C.Z.success("Permissions updated successfully"),g(!1)}catch(e){C.Z.fromBackend("Failed to update permissions"),console.error("Error updating permissions:",e)}finally{x(!1)}};if(d)return(0,t.jsx)("div",{className:"p-6 text-center",children:"Loading permissions..."});let f=r.length>0;return(0,t.jsxs)(E.Z,{className:"bg-white shadow-md rounded-md p-6",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center border-b pb-4 mb-6",children:[(0,t.jsx)(B.Z,{className:"mb-2 sm:mb-0",children:"Member Permissions"}),i&&p&&(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsx)(h.ZP,{icon:(0,t.jsx)(K.Z,{}),onClick:()=>{b()},children:"Reset"}),(0,t.jsxs)(F.Z,{onClick:v,loading:u,className:"flex items-center gap-2",children:[(0,t.jsx)($.Z,{})," Save Changes"]})]})]}),(0,t.jsx)(V.Z,{className:"mb-6 text-gray-600",children:"Control what team members can do when they are not team admins."}),f?(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(O.Z,{className:" min-w-full",children:[(0,t.jsx)(R.Z,{children:(0,t.jsxs)(U.Z,{children:[(0,t.jsx)(z.Z,{children:"Method"}),(0,t.jsx)(z.Z,{children:"Endpoint"}),(0,t.jsx)(z.Z,{children:"Description"}),(0,t.jsx)(z.Z,{className:"sticky right-0 bg-white shadow-[-4px_0_4px_-4px_rgba(0,0,0,0.1)] text-center",children:"Allow Access"})]})}),(0,t.jsx)(D.Z,{children:r.map(e=>{let l=W(e);return(0,t.jsxs)(U.Z,{className:"hover:bg-gray-50 transition-colors",children:[(0,t.jsx)(A.Z,{children:(0,t.jsx)("span",{className:"px-2 py-1 rounded text-xs font-medium ".concat("GET"===l.method?"bg-blue-100 text-blue-800":"bg-green-100 text-green-800"),children:l.method})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)("span",{className:"font-mono text-sm text-gray-800",children:l.endpoint})}),(0,t.jsx)(A.Z,{className:"text-gray-700",children:l.description}),(0,t.jsx)(A.Z,{className:"sticky right-0 bg-white shadow-[-4px_0_4px_-4px_rgba(0,0,0,0.1)] text-center",children:(0,t.jsx)(G.Z,{checked:m.includes(e),onChange:l=>_(e,l.target.checked),disabled:!i})})]},e)})})]})}):(0,t.jsx)("div",{className:"py-12",children:(0,t.jsx)(q.Z,{description:"No permissions available"})})]})},Y=s(47323),H=s(53410),ee=s(74998),el=e=>{let{teamData:l,canEditTeam:s,handleMemberDelete:i,setSelectedEditMember:a,setIsEditMemberModalVisible:n,setIsAddMemberModalVisible:o}=e,d=e=>{if(null==e)return"0";if("number"==typeof e){let l=Number(e);return l===Math.floor(l)?l.toString():(0,r.pw)(l,8).replace(/\.?0+$/,"")}return"0"},c=e=>{if(!e)return 0;let s=l.team_memberships.find(l=>l.user_id===e);return(null==s?void 0:s.spend)||0},u=e=>{var s;if(!e)return null;let t=l.team_memberships.find(l=>l.user_id===e);console.log("membership=".concat(t));let i=null==t?void 0:null===(s=t.litellm_budget_table)||void 0===s?void 0:s.max_budget;return null==i?null:d(i)},h=e=>{var s,t;if(!e)return"No Limits";let i=l.team_memberships.find(l=>l.user_id===e),a=null==i?void 0:null===(s=i.litellm_budget_table)||void 0===s?void 0:s.rpm_limit,r=null==i?void 0:null===(t=i.litellm_budget_table)||void 0===t?void 0:t.tpm_limit,n=[a?"".concat(d(a)," RPM"):null,r?"".concat(d(r)," TPM"):null].filter(Boolean);return n.length>0?n.join(" / "):"No Limits"};return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(E.Z,{className:"w-full mx-auto flex-auto overflow-auto max-h-[50vh]",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(O.Z,{className:"min-w-full",children:[(0,t.jsx)(R.Z,{children:(0,t.jsxs)(U.Z,{children:[(0,t.jsx)(z.Z,{children:"User ID"}),(0,t.jsx)(z.Z,{children:"User Email"}),(0,t.jsx)(z.Z,{children:"Role"}),(0,t.jsxs)(z.Z,{children:["Team Member Spend (USD)"," ",(0,t.jsx)(g.Z,{title:"This is the amount spent by a user in the team.",children:(0,t.jsx)(m.Z,{})})]}),(0,t.jsx)(z.Z,{children:"Team Member Budget (USD)"}),(0,t.jsxs)(z.Z,{children:["Team Member Rate Limits"," ",(0,t.jsx)(g.Z,{title:"Rate limits for this member's usage within this team.",children:(0,t.jsx)(m.Z,{})})]}),(0,t.jsx)(z.Z,{className:"sticky right-0 bg-white z-10 border-l border-gray-200",children:"Actions"})]})}),(0,t.jsx)(D.Z,{children:l.team_info.members_with_roles.map((e,m)=>(0,t.jsxs)(U.Z,{children:[(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:e.user_id})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:e.user_email?e.user_email:"No Email"})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:e.role})}),(0,t.jsx)(A.Z,{children:(0,t.jsxs)(V.Z,{className:"font-mono",children:["$",(0,r.pw)(c(e.user_id),4)]})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:u(e.user_id)?"$".concat((0,r.pw)(Number(u(e.user_id)),4)):"No Limit"})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:h(e.user_id)})}),(0,t.jsx)(A.Z,{className:"sticky right-0 bg-white z-10 border-l border-gray-200",children:s&&(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(Y.Z,{icon:H.Z,size:"sm",onClick:()=>{var s,t,i;let r=l.team_memberships.find(l=>l.user_id===e.user_id);a({...e,max_budget_in_team:(null==r?void 0:null===(s=r.litellm_budget_table)||void 0===s?void 0:s.max_budget)||null,tpm_limit:(null==r?void 0:null===(t=r.litellm_budget_table)||void 0===t?void 0:t.tpm_limit)||null,rpm_limit:(null==r?void 0:null===(i=r.litellm_budget_table)||void 0===i?void 0:i.rpm_limit)||null}),n(!0)},className:"cursor-pointer hover:text-blue-600"}),(0,t.jsx)(Y.Z,{icon:ee.Z,size:"sm",onClick:()=>i(e),className:"cursor-pointer hover:text-red-600"})]})})]},m))})]})})}),(0,t.jsx)(F.Z,{onClick:()=>o(!0),children:"Add Member"})]})};let es=(e,l)=>{let s=[];return s=e?e.models.includes("all-proxy-models")?l:e.models.length>0?e.models:l:l,(0,y.Ob)(s,l)};var et=e=>{var l,s,F,E,O,D,A,R,z,U,V,B,G,q,K,$,J,Q,W,Y,H;let ee;let{teamId:et,onClose:ei,accessToken:ea,is_team_admin:er,is_proxy_admin:en,userModels:em,editTeam:eo,premiumUser:ed=!1,onUpdate:ec}=e,[eu,eh]=(0,j.useState)(null),[ex,ep]=(0,j.useState)(!0),[eg,eb]=(0,j.useState)(!1),[e_]=c.Z.useForm(),[ev,ej]=(0,j.useState)(!1),[ef,eZ]=(0,j.useState)(null),[ey,eN]=(0,j.useState)(!1),[ew,ek]=(0,j.useState)([]),[eM,eC]=(0,j.useState)(!1),[eS,eT]=(0,j.useState)({}),[eI,eP]=(0,j.useState)([]),[eL,eF]=(0,j.useState)(null),[eE,eO]=(0,j.useState)(!1),[eD,eA]=(0,j.useState)(!1),[eR,ez]=(0,j.useState)(!1),[eU,eV]=(0,j.useState)(null);console.log("userModels in team info",em);let eB=er||en,eG=async()=>{try{if(ep(!0),!ea)return;let e=await (0,a.teamInfoCall)(ea,et);eh(e)}catch(e){C.Z.fromBackend("Failed to load team information"),console.error("Error fetching team info:",e)}finally{ep(!1)}};(0,j.useEffect)(()=>{eG()},[et,ea]),(0,j.useEffect)(()=>{(async()=>{var e;if(!ea||!(null==eu?void 0:null===(e=eu.team_info)||void 0===e?void 0:e.organization_id)){eV(null);return}try{let e=await (0,a.organizationInfoCall)(ea,eu.team_info.organization_id);eV(e)}catch(e){console.error("Error fetching organization info:",e),eV(null)}})()},[ea,null==eu?void 0:null===(l=eu.team_info)||void 0===l?void 0:l.organization_id]);let eq=(0,j.useMemo)(()=>es(eU,em),[eU,em]);(0,j.useEffect)(()=>{(async()=>{try{if(!ea)return;let e=(await (0,a.getGuardrailsList)(ea)).guardrails.map(e=>e.guardrail_name);eP(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})()},[ea]);let eK=async e=>{try{if(null==ea)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role};await (0,a.teamMemberAddCall)(ea,et,l),C.Z.success("Team member added successfully"),eb(!1),e_.resetFields();let s=await (0,a.teamInfoCall)(ea,et);eh(s),ec(s)}catch(i){var l,s,t;let e="Failed to add team member";(null==i?void 0:null===(t=i.raw)||void 0===t?void 0:null===(s=t.detail)||void 0===s?void 0:null===(l=s.error)||void 0===l?void 0:l.includes("Assigning team admins is a premium feature"))?e="Assigning admins is an enterprise-only feature. Please upgrade your LiteLLM plan to enable this.":(null==i?void 0:i.message)&&(e=i.message),C.Z.fromBackend(e),console.error("Error adding team member:",i)}},e$=async e=>{try{if(null==ea)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role,max_budget_in_team:e.max_budget_in_team,tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit};console.log("Updating member with values:",l),u.ZP.destroy(),await (0,a.teamMemberUpdateCall)(ea,et,l),C.Z.success("Team member updated successfully"),ej(!1);let s=await (0,a.teamInfoCall)(ea,et);eh(s),ec(s)}catch(t){var l,s;let e="Failed to update team member";(null==t?void 0:null===(s=t.raw)||void 0===s?void 0:null===(l=s.detail)||void 0===l?void 0:l.includes("Assigning team admins is a premium feature"))?e="Assigning admins is an enterprise-only feature. Please upgrade your LiteLLM plan to enable this.":(null==t?void 0:t.message)&&(e=t.message),ej(!1),u.ZP.destroy(),C.Z.fromBackend(e),console.error("Error updating team member:",t)}},eJ=async()=>{if(eL&&ea){eA(!0);try{await (0,a.teamMemberDeleteCall)(ea,et,eL),C.Z.success("Team member removed successfully");let e=await (0,a.teamInfoCall)(ea,et);eh(e),ec(e)}catch(e){C.Z.fromBackend("Failed to remove team member"),console.error("Error removing team member:",e)}finally{eA(!1),eO(!1),eF(null)}}},eQ=async e=>{try{if(!ea)return;ez(!0);let l={};try{l=e.metadata?JSON.parse(e.metadata):{}}catch(e){C.Z.fromBackend("Invalid JSON in metadata field");return}let s=e=>null==e||"string"==typeof e&&""===e.trim()||"number"==typeof e&&Number.isNaN(e)?null:e,t={team_id:et,team_alias:e.team_alias,models:e.models,tpm_limit:s(e.tpm_limit),rpm_limit:s(e.rpm_limit),max_budget:e.max_budget,budget_duration:e.budget_duration,metadata:{...l,guardrails:e.guardrails||[],logging:e.logging_settings||[]},organization_id:e.organization_id};t.max_budget=(0,n.C)(t.max_budget),void 0!==e.team_member_budget&&(t.team_member_budget=Number(e.team_member_budget)),void 0!==e.team_member_key_duration&&(t.team_member_key_duration=e.team_member_key_duration),(void 0!==e.team_member_tpm_limit||void 0!==e.team_member_rpm_limit)&&(t.team_member_tpm_limit=s(e.team_member_tpm_limit),t.team_member_rpm_limit=s(e.team_member_rpm_limit));let{servers:i,accessGroups:r}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]},m=new Set(i||[]),o=Object.fromEntries(Object.entries(e.mcp_tool_permissions||{}).filter(e=>{let[l]=e;return m.has(l)}));t.object_permission={},i&&(t.object_permission.mcp_servers=i),r&&(t.object_permission.mcp_access_groups=r),o&&(t.object_permission.mcp_tool_permissions=o),delete e.mcp_servers_and_groups,delete e.mcp_tool_permissions;let{agents:d,accessGroups:c}=e.agents_and_groups||{agents:[],accessGroups:[]};d&&d.length>0&&(t.object_permission.agents=d),c&&c.length>0&&(t.object_permission.agent_access_groups=c),delete e.agents_and_groups,await (0,a.teamUpdateCall)(ea,t),C.Z.success("Team settings updated successfully"),eN(!1),eG()}catch(e){console.error("Error updating team:",e)}finally{ez(!1)}};if(ex)return(0,t.jsx)("div",{className:"p-4",children:"Loading..."});if(!(null==eu?void 0:eu.team_info))return(0,t.jsx)("div",{className:"p-4",children:"Team not found"});let{team_info:eW}=eu,eX=async(e,l)=>{await (0,r.vQ)(e)&&(eT(e=>({...e,[l]:!0})),setTimeout(()=>{eT(e=>({...e,[l]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(d.zx,{icon:o.Z,variant:"light",onClick:ei,className:"mb-4",children:"Back to Teams"}),(0,t.jsx)(d.Dx,{children:eW.team_alias}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(d.xv,{className:"text-gray-500 font-mono",children:eW.team_id}),(0,t.jsx)(h.ZP,{type:"text",size:"small",icon:eS["team-id"]?(0,t.jsx)(_.Z,{size:12}):(0,t.jsx)(v.Z,{size:12}),onClick:()=>eX(eW.team_id,"team-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eS["team-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,t.jsxs)(d.v0,{defaultIndex:eo?3:0,children:[(0,t.jsx)(d.td,{className:"mb-4",children:[(0,t.jsx)(d.OK,{children:"Overview"},"overview"),...eB?[(0,t.jsx)(d.OK,{children:"Members"},"members"),(0,t.jsx)(d.OK,{children:"Member Permissions"},"member-permissions"),(0,t.jsx)(d.OK,{children:"Settings"},"settings")]:[]]}),(0,t.jsxs)(d.nP,{children:[(0,t.jsx)(d.x4,{children:(0,t.jsxs)(d.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(d.Zb,{children:[(0,t.jsx)(d.xv,{children:"Budget Status"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(d.Dx,{children:["$",(0,r.pw)(eW.spend,4)]}),(0,t.jsxs)(d.xv,{children:["of ",null===eW.max_budget?"Unlimited":"$".concat((0,r.pw)(eW.max_budget,4))]}),eW.budget_duration&&(0,t.jsxs)(d.xv,{className:"text-gray-500",children:["Reset: ",eW.budget_duration]}),(0,t.jsx)("br",{}),eW.team_member_budget_table&&(0,t.jsxs)(d.xv,{className:"text-gray-500",children:["Team Member Budget: $",(0,r.pw)(eW.team_member_budget_table.max_budget,4)]})]})]}),(0,t.jsxs)(d.Zb,{children:[(0,t.jsx)(d.xv,{children:"Rate Limits"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(d.xv,{children:["TPM: ",eW.tpm_limit||"Unlimited"]}),(0,t.jsxs)(d.xv,{children:["RPM: ",eW.rpm_limit||"Unlimited"]}),eW.max_parallel_requests&&(0,t.jsxs)(d.xv,{children:["Max Parallel Requests: ",eW.max_parallel_requests]})]})]}),(0,t.jsxs)(d.Zb,{children:[(0,t.jsx)(d.xv,{children:"Models"}),(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:0===eW.models.length?(0,t.jsx)(d.Ct,{color:"red",children:"All proxy models"}):eW.models.map((e,l)=>(0,t.jsx)(d.Ct,{color:"red",children:e},l))})]}),(0,t.jsxs)(d.Zb,{children:[(0,t.jsx)(d.xv,{className:"font-semibold text-gray-900",children:"Virtual Keys"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(d.xv,{children:["User Keys: ",eu.keys.filter(e=>e.user_id).length]}),(0,t.jsxs)(d.xv,{children:["Service Account Keys: ",eu.keys.filter(e=>!e.user_id).length]}),(0,t.jsxs)(d.xv,{className:"text-gray-500",children:["Total: ",eu.keys.length]})]})]}),(0,t.jsx)(S.Z,{objectPermission:eW.object_permission,variant:"card",accessToken:ea}),(0,t.jsx)(N.Z,{loggingConfigs:(null===(s=eW.metadata)||void 0===s?void 0:s.logging)||[],disabledCallbacks:[],variant:"card"})]})}),(0,t.jsx)(d.x4,{children:(0,t.jsx)(el,{teamData:eu,canEditTeam:eB,handleMemberDelete:e=>{eF(e),eO(!0)},setSelectedEditMember:eZ,setIsEditMemberModalVisible:ej,setIsAddMemberModalVisible:eb})}),eB&&(0,t.jsx)(d.x4,{children:(0,t.jsx)(X,{teamId:et,accessToken:ea,canEditTeam:eB})}),(0,t.jsx)(d.x4,{children:(0,t.jsxs)(d.Zb,{className:"overflow-y-auto max-h-[65vh]",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(d.Dx,{children:"Team Settings"}),eB&&!ey&&(0,t.jsx)(d.zx,{onClick:()=>eN(!0),children:"Edit Settings"})]}),ey?(0,t.jsxs)(c.Z,{form:e_,onFinish:eQ,initialValues:{...eW,team_alias:eW.team_alias,models:eW.models,tpm_limit:eW.tpm_limit,rpm_limit:eW.rpm_limit,max_budget:eW.max_budget,budget_duration:eW.budget_duration,team_member_tpm_limit:null===(F=eW.team_member_budget_table)||void 0===F?void 0:F.tpm_limit,team_member_rpm_limit:null===(E=eW.team_member_budget_table)||void 0===E?void 0:E.rpm_limit,guardrails:(null===(O=eW.metadata)||void 0===O?void 0:O.guardrails)||[],disable_global_guardrails:(null===(D=eW.metadata)||void 0===D?void 0:D.disable_global_guardrails)||!1,metadata:eW.metadata?JSON.stringify((e=>{let{logging:l,...s}=e;return s})(eW.metadata),null,2):"",logging_settings:(null===(A=eW.metadata)||void 0===A?void 0:A.logging)||[],organization_id:eW.organization_id,vector_stores:(null===(R=eW.object_permission)||void 0===R?void 0:R.vector_stores)||[],mcp_servers:(null===(z=eW.object_permission)||void 0===z?void 0:z.mcp_servers)||[],mcp_access_groups:(null===(U=eW.object_permission)||void 0===U?void 0:U.mcp_access_groups)||[],mcp_servers_and_groups:{servers:(null===(V=eW.object_permission)||void 0===V?void 0:V.mcp_servers)||[],accessGroups:(null===(B=eW.object_permission)||void 0===B?void 0:B.mcp_access_groups)||[]},mcp_tool_permissions:(null===(G=eW.object_permission)||void 0===G?void 0:G.mcp_tool_permissions)||{},agents_and_groups:{agents:(null===(q=eW.object_permission)||void 0===q?void 0:q.agents)||[],accessGroups:(null===(K=eW.object_permission)||void 0===K?void 0:K.agent_access_groups)||[]}},layout:"vertical",children:[(0,t.jsx)(c.Z.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,t.jsx)(x.default,{type:""})}),(0,t.jsx)(c.Z.Item,{label:"Models",name:"models",rules:[{required:!0,message:"Please select at least one model"}],children:(0,t.jsxs)(p.default,{mode:"multiple",placeholder:"Select models",children:[(ee=!1,eU?(0===eU.models.length||eU.models.includes("all-proxy-models"))&&(ee=!0):ee=en||em.includes("all-proxy-models"),ee?(0,t.jsx)(p.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"):null),!eU||eU.models.includes("no-default-models")?(0,t.jsx)(p.default.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"):null,Array.from(new Set(eq)).map((e,l)=>(0,t.jsx)(p.default.Option,{value:e,children:(0,y.W0)(e)},l))]})}),(0,t.jsx)(c.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(T.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:"Team Member Budget (USD)",name:"team_member_budget",tooltip:"This is the individual budget for a user in the team.",children:(0,t.jsx)(T.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:"Team Member Key Duration (eg: 1d, 1mo)",name:"team_member_key_duration",tooltip:"Set a limit to the duration of a team member's key. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days), 1mo (month)",children:(0,t.jsx)(d.oi,{placeholder:"e.g., 30d"})}),(0,t.jsx)(c.Z.Item,{label:"Team Member TPM Limit",name:"team_member_tpm_limit",tooltip:"Default tokens per minute limit for an individual team member. This limit applies to all requests the user makes within this team. Can be overridden per member.",children:(0,t.jsx)(T.Z,{step:1,style:{width:"100%"},placeholder:"e.g., 1000"})}),(0,t.jsx)(c.Z.Item,{label:"Team Member RPM Limit",name:"team_member_rpm_limit",tooltip:"Default requests per minute limit for an individual team member. This limit applies to all requests the user makes within this team. Can be overridden per member.",children:(0,t.jsx)(T.Z,{step:1,style:{width:"100%"},placeholder:"e.g., 100"})}),(0,t.jsx)(c.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)(p.default,{placeholder:"n/a",children:[(0,t.jsx)(p.default.Option,{value:"24h",children:"daily"}),(0,t.jsx)(p.default.Option,{value:"7d",children:"weekly"}),(0,t.jsx)(p.default.Option,{value:"30d",children:"monthly"})]})}),(0,t.jsx)(c.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,t.jsx)(T.Z,{step:1,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,t.jsx)(T.Z,{step:1,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:(0,t.jsxs)("span",{children:["Guardrails"," ",(0,t.jsx)(g.Z,{title:"Setup your first guardrail",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",help:"Select existing guardrails or enter new ones",children:(0,t.jsx)(p.default,{mode:"tags",placeholder:"Select or enter guardrails",options:eI.map(e=>({value:e,label:e}))})}),(0,t.jsx)(c.Z.Item,{label:(0,t.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,t.jsx)(g.Z,{title:"When enabled, this team will bypass any guardrails configured to run on every request (global guardrails)",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),name:"disable_global_guardrails",valuePropName:"checked",help:"Bypass global guardrails for this team",children:(0,t.jsx)(b.Z,{checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(c.Z.Item,{label:"Vector Stores",name:"vector_stores",children:(0,t.jsx)(I.Z,{onChange:e=>e_.setFieldValue("vector_stores",e),value:e_.getFieldValue("vector_stores"),accessToken:ea||"",placeholder:"Select vector stores"})}),(0,t.jsx)(c.Z.Item,{label:"Allowed Pass Through Routes",name:"allowed_passthrough_routes",children:(0,t.jsx)(Z.Z,{onChange:e=>e_.setFieldValue("allowed_passthrough_routes",e),value:e_.getFieldValue("allowed_passthrough_routes"),accessToken:ea||"",placeholder:"Select pass through routes"})}),(0,t.jsx)(c.Z.Item,{label:"MCP Servers / Access Groups",name:"mcp_servers_and_groups",children:(0,t.jsx)(w.Z,{onChange:e=>e_.setFieldValue("mcp_servers_and_groups",e),value:e_.getFieldValue("mcp_servers_and_groups"),accessToken:ea||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(c.Z.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(x.default,{type:"hidden"})}),(0,t.jsx)(c.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.mcp_servers_and_groups!==l.mcp_servers_and_groups||e.mcp_tool_permissions!==l.mcp_tool_permissions,children:()=>{var e;return(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)(k.Z,{accessToken:ea||"",selectedServers:(null===(e=e_.getFieldValue("mcp_servers_and_groups"))||void 0===e?void 0:e.servers)||[],toolPermissions:e_.getFieldValue("mcp_tool_permissions")||{},onChange:e=>e_.setFieldsValue({mcp_tool_permissions:e})})})}}),(0,t.jsx)(c.Z.Item,{label:"Agents / Access Groups",name:"agents_and_groups",children:(0,t.jsx)(M.Z,{onChange:e=>e_.setFieldValue("agents_and_groups",e),value:e_.getFieldValue("agents_and_groups"),accessToken:ea||"",placeholder:"Select agents or access groups (optional)"})}),(0,t.jsx)(c.Z.Item,{label:"Organization ID",name:"organization_id",children:(0,t.jsx)(x.default,{type:"",disabled:!0})}),(0,t.jsx)(c.Z.Item,{label:"Logging Settings",name:"logging_settings",children:(0,t.jsx)(L.Z,{value:e_.getFieldValue("logging_settings"),onChange:e=>e_.setFieldValue("logging_settings",e)})}),(0,t.jsx)(c.Z.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(x.default.TextArea,{rows:10})}),(0,t.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,t.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,t.jsx)(d.zx,{variant:"secondary",onClick:()=>eN(!1),disabled:eR,children:"Cancel"}),(0,t.jsx)(d.zx,{type:"submit",loading:eR,children:"Save Changes"})]})})]}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Team Name"}),(0,t.jsx)("div",{children:eW.team_alias})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Team ID"}),(0,t.jsx)("div",{className:"font-mono",children:eW.team_id})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Created At"}),(0,t.jsx)("div",{children:new Date(eW.created_at).toLocaleString()})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:eW.models.map((e,l)=>(0,t.jsx)(d.Ct,{color:"red",children:e},l))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Rate Limits"}),(0,t.jsxs)("div",{children:["TPM: ",eW.tpm_limit||"Unlimited"]}),(0,t.jsxs)("div",{children:["RPM: ",eW.rpm_limit||"Unlimited"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Team Budget"}),(0,t.jsxs)("div",{children:["Max Budget:"," ",null!==eW.max_budget?"$".concat((0,r.pw)(eW.max_budget,4)):"No Limit"]}),(0,t.jsxs)("div",{children:["Budget Reset: ",eW.budget_duration||"Never"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(d.xv,{className:"font-medium",children:["Team Member Settings"," ",(0,t.jsx)(g.Z,{title:"These are limits on individual team members",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),(0,t.jsxs)("div",{children:["Max Budget: ",(null===($=eW.team_member_budget_table)||void 0===$?void 0:$.max_budget)||"No Limit"]}),(0,t.jsxs)("div",{children:["Key Duration: ",(null===(J=eW.metadata)||void 0===J?void 0:J.team_member_key_duration)||"No Limit"]}),(0,t.jsxs)("div",{children:["TPM Limit: ",(null===(Q=eW.team_member_budget_table)||void 0===Q?void 0:Q.tpm_limit)||"No Limit"]}),(0,t.jsxs)("div",{children:["RPM Limit: ",(null===(W=eW.team_member_budget_table)||void 0===W?void 0:W.rpm_limit)||"No Limit"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Organization ID"}),(0,t.jsx)("div",{children:eW.organization_id})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Status"}),(0,t.jsx)(d.Ct,{color:eW.blocked?"red":"green",children:eW.blocked?"Blocked":"Active"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Disable Global Guardrails"}),(0,t.jsx)("div",{children:(null===(Y=eW.metadata)||void 0===Y?void 0:Y.disable_global_guardrails)===!0?(0,t.jsx)(d.Ct,{color:"yellow",children:"Enabled - Global guardrails bypassed"}):(0,t.jsx)(d.Ct,{color:"green",children:"Disabled - Global guardrails active"})})]}),(0,t.jsx)(S.Z,{objectPermission:eW.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:ea}),(0,t.jsx)(N.Z,{loggingConfigs:(null===(H=eW.metadata)||void 0===H?void 0:H.logging)||[],disabledCallbacks:[],variant:"inline",className:"pt-4 border-t border-gray-200"})]})]})})]})]}),(0,t.jsx)(P.Z,{visible:ev,onCancel:()=>ej(!1),onSubmit:e$,initialData:ef,mode:"edit",config:{title:"Edit Member",showEmail:!0,showUserId:!0,roleOptions:[{label:"Admin",value:"admin"},{label:"User",value:"user"}],additionalFields:[{name:"max_budget_in_team",label:(0,t.jsxs)("span",{children:["Team Member Budget (USD)"," ",(0,t.jsx)(g.Z,{title:"Maximum amount in USD this member can spend within this team. This is separate from any global user budget limits",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:.01,min:0,placeholder:"Budget limit for this member within this team"},{name:"tpm_limit",label:(0,t.jsxs)("span",{children:["Team Member TPM Limit"," ",(0,t.jsx)(g.Z,{title:"Maximum tokens per minute this member can use within this team. This is separate from any global user TPM limit",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:1,min:0,placeholder:"Tokens per minute limit for this member in this team"},{name:"rpm_limit",label:(0,t.jsxs)("span",{children:["Team Member RPM Limit"," ",(0,t.jsx)(g.Z,{title:"Maximum requests per minute this member can make within this team. This is separate from any global user RPM limit",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:1,min:0,placeholder:"Requests per minute limit for this member in this team"}]}}),(0,t.jsx)(i.Z,{isVisible:eg,onCancel:()=>eb(!1),onSubmit:eK,accessToken:ea}),(0,t.jsx)(f.Z,{isOpen:eE,title:"Delete Team Member",alertMessage:"Removing team members will also delete any keys created by or created for this member.",message:"Are you sure you want to remove this member from the team? This action cannot be undone.",resourceInformationTitle:"Team Member Information",resourceInformation:[{label:"User ID",value:null==eL?void 0:eL.user_id,code:!0},{label:"Email",value:null==eL?void 0:eL.user_email},{label:"Role",value:null==eL?void 0:eL.role}],onCancel:()=>{eO(!1),eF(null)},onOk:eJ,confirmLoading:eD})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2202-859c1cb8c2214ee1.js b/litellm/proxy/_experimental/out/_next/static/chunks/2202-721dd881f2afe3d2.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/2202-859c1cb8c2214ee1.js rename to litellm/proxy/_experimental/out/_next/static/chunks/2202-721dd881f2afe3d2.js index 2e8353debb..191e7a40b6 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/2202-859c1cb8c2214ee1.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/2202-721dd881f2afe3d2.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2202],{19431:function(e,s,t){t.d(s,{x:function(){return a.Z},z:function(){return l.Z}});var l=t(78489),a=t(84264)},65925:function(e,s,t){t.d(s,{m:function(){return i}});var l=t(57437);t(2265);var a=t(37592);let{Option:r}=a.default,i=e=>e?({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||e:"Not set";s.Z=e=>{let{value:s,onChange:t,className:i="",style:n={}}=e;return(0,l.jsxs)(a.default,{style:{width:"100%",...n},value:s||void 0,onChange:t,className:i,placeholder:"n/a",children:[(0,l.jsx)(r,{value:"24h",children:"daily"}),(0,l.jsx)(r,{value:"7d",children:"weekly"}),(0,l.jsx)(r,{value:"30d",children:"monthly"})]})}},84376:function(e,s,t){var l=t(57437);t(2265);var a=t(37592);s.Z=e=>{let{teams:s,value:t,onChange:r,disabled:i}=e;return console.log("disabled",i),(0,l.jsx)(a.default,{showSearch:!0,placeholder:"Search or select a team",value:t,onChange:r,disabled:i,filterOption:(e,t)=>{if(!t)return!1;let l=null==s?void 0:s.find(e=>e.team_id===t.key);if(!l)return!1;let a=e.toLowerCase().trim(),r=(l.team_alias||"").toLowerCase(),i=(l.team_id||"").toLowerCase();return r.includes(a)||i.includes(a)},optionFilterProp:"children",children:null==s?void 0:s.map(e=>(0,l.jsxs)(a.default.Option,{value:e.team_id,children:[(0,l.jsx)("span",{className:"font-medium",children:e.team_alias})," ",(0,l.jsxs)("span",{className:"text-gray-500",children:["(",e.team_id,")"]})]},e.team_id))})}},7765:function(e,s,t){t.d(s,{Z:function(){return K}});var l=t(57437),a=t(2265),r=t(37592),i=t(10032),n=t(4260),d=t(5545),o=t(22116),c=t(87452),m=t(88829),u=t(72208),x=t(78489),h=t(43227),f=t(84264),p=t(49566),j=t(96761),g=t(98187),v=t(19250),b=t(19431),y=t(57840),N=t(65319),w=t(56609),_=t(73879),C=t(34310),k=t(38434),S=t(26349),Z=t(35291),U=t(3632),I=t(15452),V=t.n(I),L=t(71157),P=t(44643),R=t(88532),E=t(29233),O=t(9114),T=e=>{let{accessToken:s,teams:t,possibleUIRoles:r,onUsersCreated:i}=e,[n,d]=(0,a.useState)(!1),[c,m]=(0,a.useState)([]),[u,x]=(0,a.useState)(!1),[h,f]=(0,a.useState)(null),[p,j]=(0,a.useState)(null),[g,I]=(0,a.useState)(null),[T,z]=(0,a.useState)(null),[F,B]=(0,a.useState)(null),[D,M]=(0,a.useState)("http://localhost:4000");(0,a.useEffect)(()=>{(async()=>{try{let e=await (0,v.getProxyUISettings)(s);B(e)}catch(e){console.error("Error fetching UI settings:",e)}})(),M(new URL("/",window.location.href).toString())},[s]);let A=async()=>{x(!0);let e=c.map(e=>({...e,status:"pending"}));m(e);let t=!1;for(let i=0;ie.trim()).filter(Boolean),0===e.teams.length&&delete e.teams),n.models&&"string"==typeof n.models&&""!==n.models.trim()&&(e.models=n.models.split(",").map(e=>e.trim()).filter(Boolean),0===e.models.length&&delete e.models),n.max_budget&&""!==n.max_budget.toString().trim()){let s=parseFloat(n.max_budget.toString());!isNaN(s)&&s>0&&(e.max_budget=s)}n.budget_duration&&""!==n.budget_duration.trim()&&(e.budget_duration=n.budget_duration.trim()),n.metadata&&"string"==typeof n.metadata&&""!==n.metadata.trim()&&(e.metadata=n.metadata.trim()),console.log("Sending user data:",e);let a=await (0,v.userCreateCall)(s,null,e);if(console.log("Full response:",a),a&&(a.key||a.user_id)){t=!0,console.log("Success case triggered");let e=(null===(l=a.data)||void 0===l?void 0:l.user_id)||a.user_id;try{if(null==F?void 0:F.SSO_ENABLED){let e=new URL("/ui",D).toString();m(s=>s.map((s,t)=>t===i?{...s,status:"success",key:a.key||a.user_id,invitation_link:e}:s))}else{let t=await (0,v.invitationCreateCall)(s,e),l=new URL("/ui?invitation_id=".concat(t.id),D).toString();m(e=>e.map((e,s)=>s===i?{...e,status:"success",key:a.key||a.user_id,invitation_link:l}:e))}}catch(e){console.error("Error creating invitation:",e),m(e=>e.map((e,s)=>s===i?{...e,status:"success",key:a.key||a.user_id,error:"User created but failed to generate invitation link"}:e))}}else{console.log("Error case triggered");let e=(null==a?void 0:a.error)||"Failed to create user";console.log("Error message:",e),m(s=>s.map((s,t)=>t===i?{...s,status:"failed",error:e}:s))}}catch(s){console.error("Caught error:",s);let e=(null==s?void 0:null===(r=s.response)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.error)||(null==s?void 0:s.message)||String(s);m(s=>s.map((s,t)=>t===i?{...s,status:"failed",error:e}:s))}}x(!1),t&&i&&i()};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(b.z,{className:"mb-0",onClick:()=>d(!0),children:"+ Bulk Invite Users"}),(0,l.jsx)(o.Z,{title:"Bulk Invite Users",visible:n,width:800,onCancel:()=>d(!1),bodyStyle:{maxHeight:"70vh",overflow:"auto"},footer:null,children:(0,l.jsx)("div",{className:"flex flex-col",children:0===c.length?(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"1"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:"Download and fill the template"})]}),(0,l.jsxs)("div",{className:"ml-11 mb-6",children:[(0,l.jsx)("p",{className:"mb-4",children:"Add multiple users at once by following these steps:"}),(0,l.jsxs)("ol",{className:"list-decimal list-inside space-y-2 ml-2 mb-4",children:[(0,l.jsx)("li",{children:"Download our CSV template"}),(0,l.jsx)("li",{children:"Add your users' information to the spreadsheet"}),(0,l.jsx)("li",{children:"Save the file and upload it here"}),(0,l.jsx)("li",{children:"After creation, download the results file containing the Virtual Keys for each user"})]}),(0,l.jsxs)("div",{className:"bg-gray-50 p-4 rounded-md border border-gray-200 mb-4",children:[(0,l.jsx)("h4",{className:"font-medium mb-2",children:"Template Column Names"}),(0,l.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"user_email"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:"User's email address (required)"})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"user_role"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'User\'s role (one of: "proxy_admin", "proxy_admin_viewer", "internal_user", "internal_user_viewer")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"teams"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated team IDs (e.g., "team-1,team-2")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"max_budget"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Maximum budget as a number (e.g., "100")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"budget_duration"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Budget reset period (e.g., "30d", "1mo")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"models"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated allowed models (e.g., "gpt-3.5-turbo,gpt-4")'})]})]})]})]}),(0,l.jsxs)(b.z,{onClick:()=>{let e=new Blob([V().unparse([["user_email","user_role","teams","max_budget","budget_duration","models"],["user@example.com","internal_user","team-id-1,team-id-2","100","30d","gpt-3.5-turbo,gpt-4"]])],{type:"text/csv"}),s=window.URL.createObjectURL(e),t=document.createElement("a");t.href=s,t.download="bulk_users_template.csv",document.body.appendChild(t),t.click(),document.body.removeChild(t),window.URL.revokeObjectURL(s)},size:"lg",className:"w-full md:w-auto",children:[(0,l.jsx)(_.Z,{className:"mr-2"})," Download CSV Template"]})]}),(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"2"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:"Upload your completed CSV"})]}),(0,l.jsxs)("div",{className:"ml-11",children:[T?(0,l.jsxs)("div",{className:"mb-4 p-4 rounded-md border ".concat(g?"bg-red-50 border-red-200":"bg-blue-50 border-blue-200"),children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center",children:[g?(0,l.jsx)(C.Z,{className:"text-red-500 text-xl mr-3"}):(0,l.jsx)(k.Z,{className:"text-blue-500 text-xl mr-3"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(y.default.Text,{strong:!0,className:g?"text-red-800":"text-blue-800",children:T.name}),(0,l.jsxs)(y.default.Text,{className:"block text-xs ".concat(g?"text-red-600":"text-blue-600"),children:[(T.size/1024).toFixed(1)," KB • ",new Date().toLocaleDateString()]})]})]}),(0,l.jsxs)(b.z,{size:"xs",variant:"secondary",onClick:()=>{z(null),m([]),f(null),j(null),I(null)},className:"flex items-center",children:[(0,l.jsx)(S.Z,{className:"mr-1"})," Remove"]})]}),g?(0,l.jsxs)("div",{className:"mt-3 text-red-600 text-sm flex items-start",children:[(0,l.jsx)(Z.Z,{className:"mr-2 mt-0.5"}),(0,l.jsx)("span",{children:g})]}):!p&&(0,l.jsxs)("div",{className:"mt-3 flex items-center",children:[(0,l.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-1.5",children:(0,l.jsx)("div",{className:"bg-blue-500 h-1.5 rounded-full w-full animate-pulse"})}),(0,l.jsx)("span",{className:"ml-2 text-xs text-blue-600",children:"Processing..."})]})]}):(0,l.jsx)(N.default,{beforeUpload:e=>((f(null),j(null),I(null),z(e),"text/csv"===e.type||e.name.endsWith(".csv"))?e.size>5242880?I("File is too large (".concat((e.size/1048576).toFixed(1)," MB). Please upload a CSV file smaller than 5MB.")):V().parse(e,{complete:e=>{if(!e.data||0===e.data.length){j("The CSV file appears to be empty. Please upload a file with data."),m([]);return}if(1===e.data.length){j("The CSV file only contains headers but no user data. Please add user data to your CSV."),m([]);return}let s=e.data[0];if(0===s.length||1===s.length&&""===s[0]){j("The CSV file doesn't contain any column headers. Please make sure your CSV has headers."),m([]);return}let l=["user_email","user_role"].filter(e=>!s.includes(e));if(l.length>0){j("Your CSV is missing these required columns: ".concat(l.join(", "),". Please add these columns to your CSV file.")),m([]);return}try{let l=e.data.slice(1).map((e,l)=>{var a,r,i,n,d,o;if(0===e.length||1===e.length&&""===e[0])return null;if(e.length=parseFloat(c.max_budget.toString())&&m.push("Max budget must be greater than 0")),c.budget_duration&&!c.budget_duration.match(/^\d+[dhmwy]$|^\d+mo$/)&&m.push('Invalid budget duration format "'.concat(c.budget_duration,'". Use format like "30d", "1mo", "2w", "6h"')),c.teams&&"string"==typeof c.teams&&t&&t.length>0){let e=t.map(e=>e.team_id),s=c.teams.split(",").map(e=>e.trim()).filter(s=>!e.includes(s));s.length>0&&m.push("Unknown team(s): ".concat(s.join(", ")))}return m.length>0&&(c.isValid=!1,c.error=m.join(", ")),c}).filter(Boolean),a=l.filter(e=>e.isValid);m(l),0===l.length?j("No valid data rows found in the CSV file. Please check your file format."):0===a.length?f("No valid users found in the CSV. Please check the errors below and fix your CSV file."):a.length{f("Failed to parse CSV file: ".concat(e.message)),m([])},header:!1}):(I("Invalid file type: ".concat(e.name,". Please upload a CSV file (.csv extension).")),O.Z.fromBackend("Invalid file type. Please upload a CSV file.")),!1),accept:".csv",maxCount:1,showUploadList:!1,children:(0,l.jsxs)("div",{className:"border-2 border-dashed border-gray-300 rounded-lg p-8 text-center hover:border-blue-500 transition-colors cursor-pointer",children:[(0,l.jsx)(U.Z,{className:"text-3xl text-gray-400 mb-2"}),(0,l.jsx)("p",{className:"mb-1",children:"Drag and drop your CSV file here"}),(0,l.jsx)("p",{className:"text-sm text-gray-500 mb-3",children:"or"}),(0,l.jsx)(b.z,{size:"sm",children:"Browse files"}),(0,l.jsx)("p",{className:"text-xs text-gray-500 mt-4",children:"Only CSV files (.csv) are supported"})]})}),p&&(0,l.jsx)("div",{className:"mb-4 p-4 bg-yellow-50 border border-yellow-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)(R.Z,{className:"h-5 w-5 text-yellow-500 mr-2 mt-0.5"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(y.default.Text,{strong:!0,className:"text-yellow-800",children:"CSV Structure Error"}),(0,l.jsx)(y.default.Paragraph,{className:"text-yellow-700 mt-1 mb-0",children:p}),(0,l.jsx)(y.default.Paragraph,{className:"text-yellow-700 mt-2 mb-0",children:"Please download our template and ensure your CSV follows the required format."})]})]})})]})]}):(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"3"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:c.some(e=>"success"===e.status||"failed"===e.status)?"User Creation Results":"Review and create users"})]}),h&&(0,l.jsx)("div",{className:"ml-11 mb-4 p-4 bg-red-50 border border-red-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)(Z.Z,{className:"text-red-500 mr-2 mt-1"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(b.x,{className:"text-red-600 font-medium",children:h}),c.some(e=>!e.isValid)&&(0,l.jsxs)("ul",{className:"mt-2 list-disc list-inside text-red-600 text-sm",children:[(0,l.jsx)("li",{children:"Check the table below for specific errors in each row"}),(0,l.jsx)("li",{children:"Common issues include invalid email formats, missing required fields, or incorrect role values"}),(0,l.jsx)("li",{children:"Fix these issues in your CSV file and upload again"})]})]})]})}),(0,l.jsxs)("div",{className:"ml-11",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-3",children:[(0,l.jsx)("div",{className:"flex items-center",children:c.some(e=>"success"===e.status||"failed"===e.status)?(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(b.x,{className:"text-lg font-medium mr-3",children:"Creation Summary"}),(0,l.jsxs)(b.x,{className:"text-sm bg-green-100 text-green-800 px-2 py-1 rounded mr-2",children:[c.filter(e=>"success"===e.status).length," Successful"]}),c.some(e=>"failed"===e.status)&&(0,l.jsxs)(b.x,{className:"text-sm bg-red-100 text-red-800 px-2 py-1 rounded",children:[c.filter(e=>"failed"===e.status).length," Failed"]})]}):(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(b.x,{className:"text-lg font-medium mr-3",children:"User Preview"}),(0,l.jsxs)(b.x,{className:"text-sm bg-blue-100 text-blue-800 px-2 py-1 rounded",children:[c.filter(e=>e.isValid).length," of ",c.length," users valid"]})]})}),!c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex space-x-3",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",children:"Back"}),(0,l.jsx)(b.z,{onClick:A,disabled:0===c.filter(e=>e.isValid).length||u,children:u?"Creating...":"Create ".concat(c.filter(e=>e.isValid).length," Users")})]})]}),c.some(e=>"success"===e.status)&&(0,l.jsx)("div",{className:"mb-4 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"mr-3 mt-1",children:(0,l.jsx)(P.Z,{className:"h-5 w-5 text-blue-500"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)(b.x,{className:"font-medium text-blue-800",children:"User creation complete"}),(0,l.jsxs)(b.x,{className:"block text-sm text-blue-700 mt-1",children:[(0,l.jsx)("span",{className:"font-medium",children:"Next step:"})," Download the credentials file containing Virtual Keys and invitation links. Users will need these Virtual Keys to make LLM requests through LiteLLM."]})]})]})}),(0,l.jsx)(w.Z,{dataSource:c,columns:[{title:"Row",dataIndex:"rowNumber",key:"rowNumber",width:80},{title:"Email",dataIndex:"user_email",key:"user_email"},{title:"Role",dataIndex:"user_role",key:"user_role"},{title:"Teams",dataIndex:"teams",key:"teams"},{title:"Budget",dataIndex:"max_budget",key:"max_budget"},{title:"Status",key:"status",render:(e,s)=>s.isValid?s.status&&"pending"!==s.status?"success"===s.status?(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(P.Z,{className:"h-5 w-5 text-green-500 mr-2"}),(0,l.jsx)("span",{className:"text-green-500",children:"Success"})]}),s.invitation_link&&(0,l.jsx)("div",{className:"mt-1",children:(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)("span",{className:"text-xs text-gray-500 truncate max-w-[150px]",children:s.invitation_link}),(0,l.jsx)(E.CopyToClipboard,{text:s.invitation_link,onCopy:()=>O.Z.success("Invitation link copied!"),children:(0,l.jsx)("button",{className:"ml-1 text-blue-500 text-xs hover:text-blue-700",children:"Copy"})})]})})]}):(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(L.Z,{className:"h-5 w-5 text-red-500 mr-2"}),(0,l.jsx)("span",{className:"text-red-500",children:"Failed"})]}),s.error&&(0,l.jsx)("span",{className:"text-sm text-red-500 ml-7",children:JSON.stringify(s.error)})]}):(0,l.jsx)("span",{className:"text-gray-500",children:"Pending"}):(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(L.Z,{className:"h-5 w-5 text-red-500 mr-2"}),(0,l.jsx)("span",{className:"text-red-500",children:"Invalid"})]}),s.error&&(0,l.jsx)("span",{className:"text-sm text-red-500 ml-7",children:s.error})]})}],size:"small",pagination:{pageSize:5},scroll:{y:300},rowClassName:e=>e.isValid?"":"bg-red-50"}),!c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",className:"mr-3",children:"Back"}),(0,l.jsx)(b.z,{onClick:A,disabled:0===c.filter(e=>e.isValid).length||u,children:u?"Creating...":"Create ".concat(c.filter(e=>e.isValid).length," Users")})]}),c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",className:"mr-3",children:"Start New Bulk Import"}),(0,l.jsxs)(b.z,{onClick:()=>{let e=c.map(e=>({user_email:e.user_email,user_role:e.user_role,status:e.status,key:e.key||"",invitation_link:e.invitation_link||"",error:e.error||""})),s=new Blob([V().unparse(e)],{type:"text/csv"}),t=window.URL.createObjectURL(s),l=document.createElement("a");l.href=t,l.download="bulk_users_results.csv",document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(t)},variant:"primary",className:"flex items-center",children:[(0,l.jsx)(_.Z,{className:"mr-2"})," Download User Credentials"]})]})]})]})})})]})},z=t(99981),F=t(15424),B=t(46468),D=t(29827),M=t(84376);let{Option:A}=r.default,q=()=>"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let s=16*Math.random()|0;return("x"==e?s:3&s|8).toString(16)});var K=e=>{let{userID:s,accessToken:t,teams:b,possibleUIRoles:y,onUserCreated:N,isEmbedded:w=!1}=e,_=(0,D.NL)(),[C,k]=(0,a.useState)(null),[S]=i.Z.useForm(),[Z,U]=(0,a.useState)(!1),[I,V]=(0,a.useState)(!1),[L,P]=(0,a.useState)([]),[R,E]=(0,a.useState)(!1),[A,K]=(0,a.useState)(null),[J,W]=(0,a.useState)(null);(0,a.useEffect)(()=>{let e=async()=>{try{let e=await (0,v.modelAvailableCall)(t,s,"any"),l=[];for(let s=0;s{var l,a,r;try{O.Z.info("Making API Call"),w||U(!0),e.models&&0!==e.models.length||"proxy_admin"===e.user_role||(console.log("formValues.user_role",e.user_role),e.models=["no-default-models"]),console.log("formValues in create user:",e);let a=await (0,v.userCreateCall)(t,null,e);await _.invalidateQueries({queryKey:["userList"]}),console.log("user create Response:",a),V(!0);let r=(null===(l=a.data)||void 0===l?void 0:l.user_id)||a.user_id;if(N&&w){N(r),S.resetFields();return}if(null==C?void 0:C.SSO_ENABLED){let e={id:q(),user_id:r,is_accepted:!1,accepted_at:null,expires_at:new Date(Date.now()+6048e5),created_at:new Date,created_by:s,updated_at:new Date,updated_by:s,has_user_setup_sso:!0};K(e),E(!0)}else(0,v.invitationCreateCall)(t,r).then(e=>{e.has_user_setup_sso=!1,K(e),E(!0)});O.Z.success("API user Created"),S.resetFields(),localStorage.removeItem("userData"+s)}catch(s){let e=(null===(r=s.response)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.detail)||(null==s?void 0:s.message)||"Error creating the user";O.Z.fromBackend(e),console.error("Error creating the user:",s)}};return w?(0,l.jsxs)(i.Z,{form:S,onFinish:$,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsx)(i.Z.Item,{label:"User Email",name:"user_email",children:(0,l.jsx)(p.Z,{placeholder:""})}),(0,l.jsx)(i.Z.Item,{label:"User Role",name:"user_role",children:(0,l.jsx)(r.default,{children:y&&Object.entries(y).map(e=>{let[s,{ui_label:t,description:a}]=e;return(0,l.jsx)(h.Z,{value:s,title:t,children:(0,l.jsxs)("div",{className:"flex",children:[t," ",(0,l.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,l.jsx)(i.Z.Item,{label:"Team",name:"team_id",children:(0,l.jsx)(r.default,{placeholder:"Select Team",style:{width:"100%"},children:(0,l.jsx)(M.Z,{teams:b})})}),(0,l.jsx)(i.Z.Item,{label:"Metadata",name:"metadata",children:(0,l.jsx)(n.default.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(d.ZP,{htmlType:"submit",children:"Create User"})})]}):(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(x.Z,{className:"mb-0",onClick:()=>U(!0),children:"+ Invite User"}),(0,l.jsx)(T,{accessToken:t,teams:b,possibleUIRoles:y}),(0,l.jsxs)(o.Z,{title:"Invite User",visible:Z,width:800,footer:null,onOk:()=>{U(!1),S.resetFields()},onCancel:()=>{U(!1),V(!1),S.resetFields()},children:[(0,l.jsx)(f.Z,{className:"mb-1",children:"Create a User who can own keys"}),(0,l.jsxs)(i.Z,{form:S,onFinish:$,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsx)(i.Z.Item,{label:"User Email",name:"user_email",children:(0,l.jsx)(p.Z,{placeholder:""})}),(0,l.jsx)(i.Z.Item,{label:(0,l.jsxs)("span",{children:["Global Proxy Role"," ",(0,l.jsx)(z.Z,{title:"This is the role that the user will globally on the proxy. This role is independent of any team/org specific roles.",children:(0,l.jsx)(F.Z,{})})]}),name:"user_role",children:(0,l.jsx)(r.default,{children:y&&Object.entries(y).map(e=>{let[s,{ui_label:t,description:a}]=e;return(0,l.jsx)(h.Z,{value:s,title:t,children:(0,l.jsxs)("div",{className:"flex",children:[t," ",(0,l.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,l.jsx)(i.Z.Item,{label:"Team",className:"gap-2",name:"team_id",help:"If selected, user will be added as a 'user' role to the team.",children:(0,l.jsx)(M.Z,{teams:b})}),(0,l.jsx)(i.Z.Item,{label:"Metadata",name:"metadata",children:(0,l.jsx)(n.default.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,l.jsxs)(c.Z,{children:[(0,l.jsx)(u.Z,{children:(0,l.jsx)(j.Z,{children:"Personal Key Creation"})}),(0,l.jsx)(m.Z,{children:(0,l.jsx)(i.Z.Item,{className:"gap-2",label:(0,l.jsxs)("span",{children:["Models"," ",(0,l.jsx)(z.Z,{title:"Models user has access to, outside of team scope.",children:(0,l.jsx)(F.Z,{style:{marginLeft:"4px"}})})]}),name:"models",help:"Models user has access to, outside of team scope.",children:(0,l.jsxs)(r.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,l.jsx)(r.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),(0,l.jsx)(r.default.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"),L.map(e=>(0,l.jsx)(r.default.Option,{value:e,children:(0,B.W0)(e)},e))]})})})]}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(d.ZP,{htmlType:"submit",children:"Create User"})})]})]}),I&&(0,l.jsx)(g.Z,{isInvitationLinkModalVisible:R,setIsInvitationLinkModalVisible:E,baseUrl:J||"",invitationLinkData:A})]})}},98187:function(e,s,t){t.d(s,{Z:function(){return o}});var l=t(57437);t(2265);var a=t(57840),r=t(22116),i=t(29233),n=t(19431),d=t(9114);function o(e){let{isInvitationLinkModalVisible:s,setIsInvitationLinkModalVisible:t,baseUrl:o,invitationLinkData:c,modalType:m="invitation"}=e,{Title:u,Paragraph:x}=a.default,h=()=>{if(!o)return"";let e=new URL(o).pathname,s=e&&"/"!==e?"".concat(e,"/ui"):"ui";if(null==c?void 0:c.has_user_setup_sso)return new URL(s,o).toString();let t="".concat(s,"?invitation_id=").concat(null==c?void 0:c.id);return"resetPassword"===m&&(t+="&action=reset_password"),new URL(t,o).toString()};return(0,l.jsxs)(r.Z,{title:"invitation"===m?"Invitation Link":"Reset Password Link",visible:s,width:800,footer:null,onOk:()=>{t(!1)},onCancel:()=>{t(!1)},children:[(0,l.jsx)(x,{children:"invitation"===m?"Copy and send the generated link to onboard this user to the proxy.":"Copy and send the generated link to the user to reset their password."}),(0,l.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,l.jsx)(n.x,{className:"text-base",children:"User ID"}),(0,l.jsx)(n.x,{children:null==c?void 0:c.user_id})]}),(0,l.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,l.jsx)(n.x,{children:"invitation"===m?"Invitation Link":"Reset Password Link"}),(0,l.jsx)(n.x,{children:(0,l.jsx)(n.x,{children:h()})})]}),(0,l.jsx)("div",{className:"flex justify-end mt-5",children:(0,l.jsx)(i.CopyToClipboard,{text:h(),onCopy:()=>d.Z.success("Copied!"),children:(0,l.jsx)(n.z,{variant:"primary",children:"invitation"===m?"Copy invitation link":"Copy password reset link"})})})]})}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2202],{19431:function(e,s,t){t.d(s,{x:function(){return a.Z},z:function(){return l.Z}});var l=t(78489),a=t(84264)},65925:function(e,s,t){t.d(s,{m:function(){return i}});var l=t(57437);t(2265);var a=t(37592);let{Option:r}=a.default,i=e=>e?({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||e:"Not set";s.Z=e=>{let{value:s,onChange:t,className:i="",style:n={}}=e;return(0,l.jsxs)(a.default,{style:{width:"100%",...n},value:s||void 0,onChange:t,className:i,placeholder:"n/a",children:[(0,l.jsx)(r,{value:"24h",children:"daily"}),(0,l.jsx)(r,{value:"7d",children:"weekly"}),(0,l.jsx)(r,{value:"30d",children:"monthly"})]})}},84376:function(e,s,t){var l=t(57437);t(2265);var a=t(37592);s.Z=e=>{let{teams:s,value:t,onChange:r,disabled:i}=e;return console.log("disabled",i),(0,l.jsx)(a.default,{showSearch:!0,placeholder:"Search or select a team",value:t,onChange:r,disabled:i,filterOption:(e,t)=>{if(!t)return!1;let l=null==s?void 0:s.find(e=>e.team_id===t.key);if(!l)return!1;let a=e.toLowerCase().trim(),r=(l.team_alias||"").toLowerCase(),i=(l.team_id||"").toLowerCase();return r.includes(a)||i.includes(a)},optionFilterProp:"children",children:null==s?void 0:s.map(e=>(0,l.jsxs)(a.default.Option,{value:e.team_id,children:[(0,l.jsx)("span",{className:"font-medium",children:e.team_alias})," ",(0,l.jsxs)("span",{className:"text-gray-500",children:["(",e.team_id,")"]})]},e.team_id))})}},7765:function(e,s,t){t.d(s,{Z:function(){return K}});var l=t(57437),a=t(2265),r=t(37592),i=t(10032),n=t(4260),d=t(5545),o=t(22116),c=t(87452),m=t(88829),u=t(72208),x=t(78489),h=t(57365),f=t(84264),p=t(49566),j=t(96761),g=t(98187),v=t(19250),b=t(19431),y=t(57840),N=t(65319),w=t(56609),_=t(73879),C=t(34310),k=t(38434),S=t(26349),Z=t(35291),U=t(3632),I=t(15452),V=t.n(I),L=t(71157),P=t(44643),R=t(88532),E=t(29233),O=t(9114),T=e=>{let{accessToken:s,teams:t,possibleUIRoles:r,onUsersCreated:i}=e,[n,d]=(0,a.useState)(!1),[c,m]=(0,a.useState)([]),[u,x]=(0,a.useState)(!1),[h,f]=(0,a.useState)(null),[p,j]=(0,a.useState)(null),[g,I]=(0,a.useState)(null),[T,z]=(0,a.useState)(null),[F,B]=(0,a.useState)(null),[D,M]=(0,a.useState)("http://localhost:4000");(0,a.useEffect)(()=>{(async()=>{try{let e=await (0,v.getProxyUISettings)(s);B(e)}catch(e){console.error("Error fetching UI settings:",e)}})(),M(new URL("/",window.location.href).toString())},[s]);let A=async()=>{x(!0);let e=c.map(e=>({...e,status:"pending"}));m(e);let t=!1;for(let i=0;ie.trim()).filter(Boolean),0===e.teams.length&&delete e.teams),n.models&&"string"==typeof n.models&&""!==n.models.trim()&&(e.models=n.models.split(",").map(e=>e.trim()).filter(Boolean),0===e.models.length&&delete e.models),n.max_budget&&""!==n.max_budget.toString().trim()){let s=parseFloat(n.max_budget.toString());!isNaN(s)&&s>0&&(e.max_budget=s)}n.budget_duration&&""!==n.budget_duration.trim()&&(e.budget_duration=n.budget_duration.trim()),n.metadata&&"string"==typeof n.metadata&&""!==n.metadata.trim()&&(e.metadata=n.metadata.trim()),console.log("Sending user data:",e);let a=await (0,v.userCreateCall)(s,null,e);if(console.log("Full response:",a),a&&(a.key||a.user_id)){t=!0,console.log("Success case triggered");let e=(null===(l=a.data)||void 0===l?void 0:l.user_id)||a.user_id;try{if(null==F?void 0:F.SSO_ENABLED){let e=new URL("/ui",D).toString();m(s=>s.map((s,t)=>t===i?{...s,status:"success",key:a.key||a.user_id,invitation_link:e}:s))}else{let t=await (0,v.invitationCreateCall)(s,e),l=new URL("/ui?invitation_id=".concat(t.id),D).toString();m(e=>e.map((e,s)=>s===i?{...e,status:"success",key:a.key||a.user_id,invitation_link:l}:e))}}catch(e){console.error("Error creating invitation:",e),m(e=>e.map((e,s)=>s===i?{...e,status:"success",key:a.key||a.user_id,error:"User created but failed to generate invitation link"}:e))}}else{console.log("Error case triggered");let e=(null==a?void 0:a.error)||"Failed to create user";console.log("Error message:",e),m(s=>s.map((s,t)=>t===i?{...s,status:"failed",error:e}:s))}}catch(s){console.error("Caught error:",s);let e=(null==s?void 0:null===(r=s.response)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.error)||(null==s?void 0:s.message)||String(s);m(s=>s.map((s,t)=>t===i?{...s,status:"failed",error:e}:s))}}x(!1),t&&i&&i()};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(b.z,{className:"mb-0",onClick:()=>d(!0),children:"+ Bulk Invite Users"}),(0,l.jsx)(o.Z,{title:"Bulk Invite Users",visible:n,width:800,onCancel:()=>d(!1),bodyStyle:{maxHeight:"70vh",overflow:"auto"},footer:null,children:(0,l.jsx)("div",{className:"flex flex-col",children:0===c.length?(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"1"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:"Download and fill the template"})]}),(0,l.jsxs)("div",{className:"ml-11 mb-6",children:[(0,l.jsx)("p",{className:"mb-4",children:"Add multiple users at once by following these steps:"}),(0,l.jsxs)("ol",{className:"list-decimal list-inside space-y-2 ml-2 mb-4",children:[(0,l.jsx)("li",{children:"Download our CSV template"}),(0,l.jsx)("li",{children:"Add your users' information to the spreadsheet"}),(0,l.jsx)("li",{children:"Save the file and upload it here"}),(0,l.jsx)("li",{children:"After creation, download the results file containing the Virtual Keys for each user"})]}),(0,l.jsxs)("div",{className:"bg-gray-50 p-4 rounded-md border border-gray-200 mb-4",children:[(0,l.jsx)("h4",{className:"font-medium mb-2",children:"Template Column Names"}),(0,l.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"user_email"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:"User's email address (required)"})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"user_role"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'User\'s role (one of: "proxy_admin", "proxy_admin_viewer", "internal_user", "internal_user_viewer")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"teams"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated team IDs (e.g., "team-1,team-2")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"max_budget"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Maximum budget as a number (e.g., "100")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"budget_duration"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Budget reset period (e.g., "30d", "1mo")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"models"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated allowed models (e.g., "gpt-3.5-turbo,gpt-4")'})]})]})]})]}),(0,l.jsxs)(b.z,{onClick:()=>{let e=new Blob([V().unparse([["user_email","user_role","teams","max_budget","budget_duration","models"],["user@example.com","internal_user","team-id-1,team-id-2","100","30d","gpt-3.5-turbo,gpt-4"]])],{type:"text/csv"}),s=window.URL.createObjectURL(e),t=document.createElement("a");t.href=s,t.download="bulk_users_template.csv",document.body.appendChild(t),t.click(),document.body.removeChild(t),window.URL.revokeObjectURL(s)},size:"lg",className:"w-full md:w-auto",children:[(0,l.jsx)(_.Z,{className:"mr-2"})," Download CSV Template"]})]}),(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"2"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:"Upload your completed CSV"})]}),(0,l.jsxs)("div",{className:"ml-11",children:[T?(0,l.jsxs)("div",{className:"mb-4 p-4 rounded-md border ".concat(g?"bg-red-50 border-red-200":"bg-blue-50 border-blue-200"),children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center",children:[g?(0,l.jsx)(C.Z,{className:"text-red-500 text-xl mr-3"}):(0,l.jsx)(k.Z,{className:"text-blue-500 text-xl mr-3"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(y.default.Text,{strong:!0,className:g?"text-red-800":"text-blue-800",children:T.name}),(0,l.jsxs)(y.default.Text,{className:"block text-xs ".concat(g?"text-red-600":"text-blue-600"),children:[(T.size/1024).toFixed(1)," KB • ",new Date().toLocaleDateString()]})]})]}),(0,l.jsxs)(b.z,{size:"xs",variant:"secondary",onClick:()=>{z(null),m([]),f(null),j(null),I(null)},className:"flex items-center",children:[(0,l.jsx)(S.Z,{className:"mr-1"})," Remove"]})]}),g?(0,l.jsxs)("div",{className:"mt-3 text-red-600 text-sm flex items-start",children:[(0,l.jsx)(Z.Z,{className:"mr-2 mt-0.5"}),(0,l.jsx)("span",{children:g})]}):!p&&(0,l.jsxs)("div",{className:"mt-3 flex items-center",children:[(0,l.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-1.5",children:(0,l.jsx)("div",{className:"bg-blue-500 h-1.5 rounded-full w-full animate-pulse"})}),(0,l.jsx)("span",{className:"ml-2 text-xs text-blue-600",children:"Processing..."})]})]}):(0,l.jsx)(N.default,{beforeUpload:e=>((f(null),j(null),I(null),z(e),"text/csv"===e.type||e.name.endsWith(".csv"))?e.size>5242880?I("File is too large (".concat((e.size/1048576).toFixed(1)," MB). Please upload a CSV file smaller than 5MB.")):V().parse(e,{complete:e=>{if(!e.data||0===e.data.length){j("The CSV file appears to be empty. Please upload a file with data."),m([]);return}if(1===e.data.length){j("The CSV file only contains headers but no user data. Please add user data to your CSV."),m([]);return}let s=e.data[0];if(0===s.length||1===s.length&&""===s[0]){j("The CSV file doesn't contain any column headers. Please make sure your CSV has headers."),m([]);return}let l=["user_email","user_role"].filter(e=>!s.includes(e));if(l.length>0){j("Your CSV is missing these required columns: ".concat(l.join(", "),". Please add these columns to your CSV file.")),m([]);return}try{let l=e.data.slice(1).map((e,l)=>{var a,r,i,n,d,o;if(0===e.length||1===e.length&&""===e[0])return null;if(e.length=parseFloat(c.max_budget.toString())&&m.push("Max budget must be greater than 0")),c.budget_duration&&!c.budget_duration.match(/^\d+[dhmwy]$|^\d+mo$/)&&m.push('Invalid budget duration format "'.concat(c.budget_duration,'". Use format like "30d", "1mo", "2w", "6h"')),c.teams&&"string"==typeof c.teams&&t&&t.length>0){let e=t.map(e=>e.team_id),s=c.teams.split(",").map(e=>e.trim()).filter(s=>!e.includes(s));s.length>0&&m.push("Unknown team(s): ".concat(s.join(", ")))}return m.length>0&&(c.isValid=!1,c.error=m.join(", ")),c}).filter(Boolean),a=l.filter(e=>e.isValid);m(l),0===l.length?j("No valid data rows found in the CSV file. Please check your file format."):0===a.length?f("No valid users found in the CSV. Please check the errors below and fix your CSV file."):a.length{f("Failed to parse CSV file: ".concat(e.message)),m([])},header:!1}):(I("Invalid file type: ".concat(e.name,". Please upload a CSV file (.csv extension).")),O.Z.fromBackend("Invalid file type. Please upload a CSV file.")),!1),accept:".csv",maxCount:1,showUploadList:!1,children:(0,l.jsxs)("div",{className:"border-2 border-dashed border-gray-300 rounded-lg p-8 text-center hover:border-blue-500 transition-colors cursor-pointer",children:[(0,l.jsx)(U.Z,{className:"text-3xl text-gray-400 mb-2"}),(0,l.jsx)("p",{className:"mb-1",children:"Drag and drop your CSV file here"}),(0,l.jsx)("p",{className:"text-sm text-gray-500 mb-3",children:"or"}),(0,l.jsx)(b.z,{size:"sm",children:"Browse files"}),(0,l.jsx)("p",{className:"text-xs text-gray-500 mt-4",children:"Only CSV files (.csv) are supported"})]})}),p&&(0,l.jsx)("div",{className:"mb-4 p-4 bg-yellow-50 border border-yellow-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)(R.Z,{className:"h-5 w-5 text-yellow-500 mr-2 mt-0.5"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(y.default.Text,{strong:!0,className:"text-yellow-800",children:"CSV Structure Error"}),(0,l.jsx)(y.default.Paragraph,{className:"text-yellow-700 mt-1 mb-0",children:p}),(0,l.jsx)(y.default.Paragraph,{className:"text-yellow-700 mt-2 mb-0",children:"Please download our template and ensure your CSV follows the required format."})]})]})})]})]}):(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"3"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:c.some(e=>"success"===e.status||"failed"===e.status)?"User Creation Results":"Review and create users"})]}),h&&(0,l.jsx)("div",{className:"ml-11 mb-4 p-4 bg-red-50 border border-red-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)(Z.Z,{className:"text-red-500 mr-2 mt-1"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(b.x,{className:"text-red-600 font-medium",children:h}),c.some(e=>!e.isValid)&&(0,l.jsxs)("ul",{className:"mt-2 list-disc list-inside text-red-600 text-sm",children:[(0,l.jsx)("li",{children:"Check the table below for specific errors in each row"}),(0,l.jsx)("li",{children:"Common issues include invalid email formats, missing required fields, or incorrect role values"}),(0,l.jsx)("li",{children:"Fix these issues in your CSV file and upload again"})]})]})]})}),(0,l.jsxs)("div",{className:"ml-11",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-3",children:[(0,l.jsx)("div",{className:"flex items-center",children:c.some(e=>"success"===e.status||"failed"===e.status)?(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(b.x,{className:"text-lg font-medium mr-3",children:"Creation Summary"}),(0,l.jsxs)(b.x,{className:"text-sm bg-green-100 text-green-800 px-2 py-1 rounded mr-2",children:[c.filter(e=>"success"===e.status).length," Successful"]}),c.some(e=>"failed"===e.status)&&(0,l.jsxs)(b.x,{className:"text-sm bg-red-100 text-red-800 px-2 py-1 rounded",children:[c.filter(e=>"failed"===e.status).length," Failed"]})]}):(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(b.x,{className:"text-lg font-medium mr-3",children:"User Preview"}),(0,l.jsxs)(b.x,{className:"text-sm bg-blue-100 text-blue-800 px-2 py-1 rounded",children:[c.filter(e=>e.isValid).length," of ",c.length," users valid"]})]})}),!c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex space-x-3",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",children:"Back"}),(0,l.jsx)(b.z,{onClick:A,disabled:0===c.filter(e=>e.isValid).length||u,children:u?"Creating...":"Create ".concat(c.filter(e=>e.isValid).length," Users")})]})]}),c.some(e=>"success"===e.status)&&(0,l.jsx)("div",{className:"mb-4 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"mr-3 mt-1",children:(0,l.jsx)(P.Z,{className:"h-5 w-5 text-blue-500"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)(b.x,{className:"font-medium text-blue-800",children:"User creation complete"}),(0,l.jsxs)(b.x,{className:"block text-sm text-blue-700 mt-1",children:[(0,l.jsx)("span",{className:"font-medium",children:"Next step:"})," Download the credentials file containing Virtual Keys and invitation links. Users will need these Virtual Keys to make LLM requests through LiteLLM."]})]})]})}),(0,l.jsx)(w.Z,{dataSource:c,columns:[{title:"Row",dataIndex:"rowNumber",key:"rowNumber",width:80},{title:"Email",dataIndex:"user_email",key:"user_email"},{title:"Role",dataIndex:"user_role",key:"user_role"},{title:"Teams",dataIndex:"teams",key:"teams"},{title:"Budget",dataIndex:"max_budget",key:"max_budget"},{title:"Status",key:"status",render:(e,s)=>s.isValid?s.status&&"pending"!==s.status?"success"===s.status?(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(P.Z,{className:"h-5 w-5 text-green-500 mr-2"}),(0,l.jsx)("span",{className:"text-green-500",children:"Success"})]}),s.invitation_link&&(0,l.jsx)("div",{className:"mt-1",children:(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)("span",{className:"text-xs text-gray-500 truncate max-w-[150px]",children:s.invitation_link}),(0,l.jsx)(E.CopyToClipboard,{text:s.invitation_link,onCopy:()=>O.Z.success("Invitation link copied!"),children:(0,l.jsx)("button",{className:"ml-1 text-blue-500 text-xs hover:text-blue-700",children:"Copy"})})]})})]}):(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(L.Z,{className:"h-5 w-5 text-red-500 mr-2"}),(0,l.jsx)("span",{className:"text-red-500",children:"Failed"})]}),s.error&&(0,l.jsx)("span",{className:"text-sm text-red-500 ml-7",children:JSON.stringify(s.error)})]}):(0,l.jsx)("span",{className:"text-gray-500",children:"Pending"}):(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(L.Z,{className:"h-5 w-5 text-red-500 mr-2"}),(0,l.jsx)("span",{className:"text-red-500",children:"Invalid"})]}),s.error&&(0,l.jsx)("span",{className:"text-sm text-red-500 ml-7",children:s.error})]})}],size:"small",pagination:{pageSize:5},scroll:{y:300},rowClassName:e=>e.isValid?"":"bg-red-50"}),!c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",className:"mr-3",children:"Back"}),(0,l.jsx)(b.z,{onClick:A,disabled:0===c.filter(e=>e.isValid).length||u,children:u?"Creating...":"Create ".concat(c.filter(e=>e.isValid).length," Users")})]}),c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",className:"mr-3",children:"Start New Bulk Import"}),(0,l.jsxs)(b.z,{onClick:()=>{let e=c.map(e=>({user_email:e.user_email,user_role:e.user_role,status:e.status,key:e.key||"",invitation_link:e.invitation_link||"",error:e.error||""})),s=new Blob([V().unparse(e)],{type:"text/csv"}),t=window.URL.createObjectURL(s),l=document.createElement("a");l.href=t,l.download="bulk_users_results.csv",document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(t)},variant:"primary",className:"flex items-center",children:[(0,l.jsx)(_.Z,{className:"mr-2"})," Download User Credentials"]})]})]})]})})})]})},z=t(99981),F=t(15424),B=t(46468),D=t(29827),M=t(84376);let{Option:A}=r.default,q=()=>"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let s=16*Math.random()|0;return("x"==e?s:3&s|8).toString(16)});var K=e=>{let{userID:s,accessToken:t,teams:b,possibleUIRoles:y,onUserCreated:N,isEmbedded:w=!1}=e,_=(0,D.NL)(),[C,k]=(0,a.useState)(null),[S]=i.Z.useForm(),[Z,U]=(0,a.useState)(!1),[I,V]=(0,a.useState)(!1),[L,P]=(0,a.useState)([]),[R,E]=(0,a.useState)(!1),[A,K]=(0,a.useState)(null),[J,W]=(0,a.useState)(null);(0,a.useEffect)(()=>{let e=async()=>{try{let e=await (0,v.modelAvailableCall)(t,s,"any"),l=[];for(let s=0;s{var l,a,r;try{O.Z.info("Making API Call"),w||U(!0),e.models&&0!==e.models.length||"proxy_admin"===e.user_role||(console.log("formValues.user_role",e.user_role),e.models=["no-default-models"]),console.log("formValues in create user:",e);let a=await (0,v.userCreateCall)(t,null,e);await _.invalidateQueries({queryKey:["userList"]}),console.log("user create Response:",a),V(!0);let r=(null===(l=a.data)||void 0===l?void 0:l.user_id)||a.user_id;if(N&&w){N(r),S.resetFields();return}if(null==C?void 0:C.SSO_ENABLED){let e={id:q(),user_id:r,is_accepted:!1,accepted_at:null,expires_at:new Date(Date.now()+6048e5),created_at:new Date,created_by:s,updated_at:new Date,updated_by:s,has_user_setup_sso:!0};K(e),E(!0)}else(0,v.invitationCreateCall)(t,r).then(e=>{e.has_user_setup_sso=!1,K(e),E(!0)});O.Z.success("API user Created"),S.resetFields(),localStorage.removeItem("userData"+s)}catch(s){let e=(null===(r=s.response)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.detail)||(null==s?void 0:s.message)||"Error creating the user";O.Z.fromBackend(e),console.error("Error creating the user:",s)}};return w?(0,l.jsxs)(i.Z,{form:S,onFinish:$,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsx)(i.Z.Item,{label:"User Email",name:"user_email",children:(0,l.jsx)(p.Z,{placeholder:""})}),(0,l.jsx)(i.Z.Item,{label:"User Role",name:"user_role",children:(0,l.jsx)(r.default,{children:y&&Object.entries(y).map(e=>{let[s,{ui_label:t,description:a}]=e;return(0,l.jsx)(h.Z,{value:s,title:t,children:(0,l.jsxs)("div",{className:"flex",children:[t," ",(0,l.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,l.jsx)(i.Z.Item,{label:"Team",name:"team_id",children:(0,l.jsx)(r.default,{placeholder:"Select Team",style:{width:"100%"},children:(0,l.jsx)(M.Z,{teams:b})})}),(0,l.jsx)(i.Z.Item,{label:"Metadata",name:"metadata",children:(0,l.jsx)(n.default.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(d.ZP,{htmlType:"submit",children:"Create User"})})]}):(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(x.Z,{className:"mb-0",onClick:()=>U(!0),children:"+ Invite User"}),(0,l.jsx)(T,{accessToken:t,teams:b,possibleUIRoles:y}),(0,l.jsxs)(o.Z,{title:"Invite User",visible:Z,width:800,footer:null,onOk:()=>{U(!1),S.resetFields()},onCancel:()=>{U(!1),V(!1),S.resetFields()},children:[(0,l.jsx)(f.Z,{className:"mb-1",children:"Create a User who can own keys"}),(0,l.jsxs)(i.Z,{form:S,onFinish:$,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsx)(i.Z.Item,{label:"User Email",name:"user_email",children:(0,l.jsx)(p.Z,{placeholder:""})}),(0,l.jsx)(i.Z.Item,{label:(0,l.jsxs)("span",{children:["Global Proxy Role"," ",(0,l.jsx)(z.Z,{title:"This is the role that the user will globally on the proxy. This role is independent of any team/org specific roles.",children:(0,l.jsx)(F.Z,{})})]}),name:"user_role",children:(0,l.jsx)(r.default,{children:y&&Object.entries(y).map(e=>{let[s,{ui_label:t,description:a}]=e;return(0,l.jsx)(h.Z,{value:s,title:t,children:(0,l.jsxs)("div",{className:"flex",children:[t," ",(0,l.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,l.jsx)(i.Z.Item,{label:"Team",className:"gap-2",name:"team_id",help:"If selected, user will be added as a 'user' role to the team.",children:(0,l.jsx)(M.Z,{teams:b})}),(0,l.jsx)(i.Z.Item,{label:"Metadata",name:"metadata",children:(0,l.jsx)(n.default.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,l.jsxs)(c.Z,{children:[(0,l.jsx)(u.Z,{children:(0,l.jsx)(j.Z,{children:"Personal Key Creation"})}),(0,l.jsx)(m.Z,{children:(0,l.jsx)(i.Z.Item,{className:"gap-2",label:(0,l.jsxs)("span",{children:["Models"," ",(0,l.jsx)(z.Z,{title:"Models user has access to, outside of team scope.",children:(0,l.jsx)(F.Z,{style:{marginLeft:"4px"}})})]}),name:"models",help:"Models user has access to, outside of team scope.",children:(0,l.jsxs)(r.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,l.jsx)(r.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),(0,l.jsx)(r.default.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"),L.map(e=>(0,l.jsx)(r.default.Option,{value:e,children:(0,B.W0)(e)},e))]})})})]}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(d.ZP,{htmlType:"submit",children:"Create User"})})]})]}),I&&(0,l.jsx)(g.Z,{isInvitationLinkModalVisible:R,setIsInvitationLinkModalVisible:E,baseUrl:J||"",invitationLinkData:A})]})}},98187:function(e,s,t){t.d(s,{Z:function(){return o}});var l=t(57437);t(2265);var a=t(57840),r=t(22116),i=t(29233),n=t(19431),d=t(9114);function o(e){let{isInvitationLinkModalVisible:s,setIsInvitationLinkModalVisible:t,baseUrl:o,invitationLinkData:c,modalType:m="invitation"}=e,{Title:u,Paragraph:x}=a.default,h=()=>{if(!o)return"";let e=new URL(o).pathname,s=e&&"/"!==e?"".concat(e,"/ui"):"ui";if(null==c?void 0:c.has_user_setup_sso)return new URL(s,o).toString();let t="".concat(s,"?invitation_id=").concat(null==c?void 0:c.id);return"resetPassword"===m&&(t+="&action=reset_password"),new URL(t,o).toString()};return(0,l.jsxs)(r.Z,{title:"invitation"===m?"Invitation Link":"Reset Password Link",visible:s,width:800,footer:null,onOk:()=>{t(!1)},onCancel:()=>{t(!1)},children:[(0,l.jsx)(x,{children:"invitation"===m?"Copy and send the generated link to onboard this user to the proxy.":"Copy and send the generated link to the user to reset their password."}),(0,l.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,l.jsx)(n.x,{className:"text-base",children:"User ID"}),(0,l.jsx)(n.x,{children:null==c?void 0:c.user_id})]}),(0,l.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,l.jsx)(n.x,{children:"invitation"===m?"Invitation Link":"Reset Password Link"}),(0,l.jsx)(n.x,{children:(0,l.jsx)(n.x,{children:h()})})]}),(0,l.jsx)("div",{className:"flex justify-end mt-5",children:(0,l.jsx)(i.CopyToClipboard,{text:h(),onCopy:()=>d.Z.success("Copied!"),children:(0,l.jsx)(n.z,{variant:"primary",children:"invitation"===m?"Copy invitation link":"Copy password reset link"})})})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2249-3be1a049d707c166.js b/litellm/proxy/_experimental/out/_next/static/chunks/2249-3be1a049d707c166.js deleted file mode 100644 index e255730d8c..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/2249-3be1a049d707c166.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2249],{64748:function(e,s,l){l.d(s,{Ct:function(){return a.Z},Dx:function(){return m.Z},OK:function(){return n.Z},Zb:function(){return r.Z},nP:function(){return o.Z},td:function(){return c.Z},v0:function(){return i.Z},x4:function(){return d.Z},xv:function(){return x.Z},zx:function(){return t.Z}});var a=l(41649),t=l(78489),r=l(12514),n=l(12485),i=l(18135),c=l(35242),d=l(29706),o=l(77991),x=l(84264),m=l(96761)},78801:function(e,s,l){l.d(s,{Z:function(){return a.Z},x:function(){return t.Z}});var a=l(12514),t=l(84264)},92249:function(e,s,l){l.d(s,{Z:function(){return W}});var a=l(57437),t=l(23639),r=l(64748),n=l(22116),i=l(78867),c=l(99376),d=l(2265),o=l(17906),x=l(20347),m=l(41649),h=l(78489),u=l(84264),p=l(99981),g=l(3810),j=l(15424),v=l(15690),b=l(10032),N=l(61994),f=l(5545),y=l(96761),_=l(19250),k=l(9114);let{Step:w}=v.default;var Z=e=>{let{visible:s,onClose:l,accessToken:t,agentHubData:r,onSuccess:i}=e,[c,o]=(0,d.useState)(0),[x,h]=(0,d.useState)(new Set),[p,g]=(0,d.useState)(!1),[j]=b.Z.useForm(),Z=()=>{o(0),h(new Set),j.resetFields(),l()},C=(e,s)=>{let l=new Set(x);s?l.add(e):l.delete(e),h(l)},S=e=>{e?h(new Set(r.map(e=>e.agent_id||e.name))):h(new Set)};(0,d.useEffect)(()=>{s&&r.length>0&&h(new Set(r.filter(e=>!0===e.is_public).map(e=>e.agent_id||e.name)))},[s,r]);let P=async()=>{if(0===x.size){k.Z.fromBackend("Please select at least one agent to make public");return}g(!0);try{let e=Array.from(x);await (0,_.makeAgentsPublicCall)(t,e),k.Z.success("Successfully made ".concat(e.length," agent(s) public!")),Z(),i()}catch(e){console.error("Error making agents public:",e),k.Z.fromBackend("Failed to make agents public. Please try again.")}finally{g(!1)}},M=()=>{let e=r.length>0&&r.every(e=>x.has(e.agent_id||e.name)),s=x.size>0&&!e;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(y.Z,{children:"Select Agents to Make Public"}),(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsxs)(N.Z,{checked:e,indeterminate:s,onChange:e=>S(e.target.checked),disabled:0===r.length,children:["Select All ",r.length>0&&"(".concat(r.length,")")]})})]}),(0,a.jsx)(u.Z,{className:"text-sm text-gray-600",children:"Select the agents you want to be visible on the public model hub. Users will still require a valid Virtual Key to use these agents."}),(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,a.jsx)("div",{className:"space-y-3",children:0===r.length?(0,a.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,a.jsx)(u.Z,{children:"No agents available."})}):r.map(e=>{let s=e.agent_id||e.name;return(0,a.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,a.jsx)(N.Z,{checked:x.has(s),onChange:e=>C(s,e.target.checked)}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e.name}),(0,a.jsxs)(m.Z,{color:"blue",size:"sm",children:["v",e.version]})]}),(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:e.description}),e.skills&&e.skills.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.skills.slice(0,3).map(e=>(0,a.jsx)(m.Z,{color:"purple",size:"xs",children:e.name},e.id)),e.skills.length>3&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",e.skills.length-3," more"]})]})]})]},s)})})}),x.size>0&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:[(0,a.jsx)("strong",{children:x.size})," agent",1!==x.size?"s":""," selected"]})})]})},z=()=>(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(y.Z,{children:"Confirm Making Agents Public"}),(0,a.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,a.jsxs)(u.Z,{className:"text-sm text-yellow-800",children:[(0,a.jsx)("strong",{children:"Warning:"})," Once you make these agents public, anyone who can go to the"," ",(0,a.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:"Agents to be made public:"}),(0,a.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,a.jsx)("div",{className:"space-y-2",children:Array.from(x).map(e=>{let s=r.find(s=>(s.agent_id||s.name)===e);return(0,a.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:(null==s?void 0:s.name)||e}),s&&(0,a.jsxs)(m.Z,{color:"blue",size:"xs",children:["v",s.version]})]}),(null==s?void 0:s.description)&&(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:s.description})]})},e)})})})]}),(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,a.jsx)("strong",{children:x.size})," agent",1!==x.size?"s":""," will be made public"]})})]});return(0,a.jsx)(n.Z,{title:"Make Agents Public",open:s,onCancel:Z,footer:null,width:1200,maskClosable:!1,children:(0,a.jsxs)(b.Z,{form:j,layout:"vertical",children:[(0,a.jsxs)(v.default,{current:c,className:"mb-6",children:[(0,a.jsx)(w,{title:"Select Agents"}),(0,a.jsx)(w,{title:"Confirm"})]}),(()=>{switch(c){case 0:return M();case 1:return z();default:return null}})(),(0,a.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,a.jsx)(f.ZP,{onClick:0===c?Z:()=>{1===c&&o(0)},children:0===c?"Cancel":"Previous"}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[0===c&&(0,a.jsx)(f.ZP,{onClick:()=>{if(0===c){if(0===x.size){k.Z.fromBackend("Please select at least one agent to make public");return}o(1)}},disabled:0===x.size,children:"Next"}),1===c&&(0,a.jsx)(f.ZP,{onClick:P,loading:p,children:"Make Public"})]})]})]})})};let{Step:C}=v.default;var S=e=>{let{visible:s,onClose:l,accessToken:t,mcpHubData:r,onSuccess:i}=e,[c,o]=(0,d.useState)(0),[x,h]=(0,d.useState)(new Set),[p,g]=(0,d.useState)(!1),[j]=b.Z.useForm(),w=()=>{o(0),h(new Set),j.resetFields(),l()},Z=(e,s)=>{let l=new Set(x);s?l.add(e):l.delete(e),h(l)},S=e=>{e?h(new Set(r.map(e=>e.server_id))):h(new Set)};(0,d.useEffect)(()=>{s&&r.length>0&&h(new Set(r.filter(e=>{var s;return(null===(s=e.mcp_info)||void 0===s?void 0:s.is_public)===!0}).map(e=>e.server_id)))},[s]);let P=async()=>{if(0===x.size){k.Z.fromBackend("Please select at least one MCP server to make public");return}g(!0);try{let e=Array.from(x);await (0,_.makeMCPPublicCall)(t,e),k.Z.success("Successfully made ".concat(e.length," MCP server(s) public!")),w(),i()}catch(e){console.error("Error making MCP servers public:",e),k.Z.fromBackend("Failed to make MCP servers public. Please try again.")}finally{g(!1)}},M=()=>{let e=r.length>0&&r.every(e=>x.has(e.server_id)),s=x.size>0&&!e;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(y.Z,{children:"Select MCP Servers to Make Public"}),(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsxs)(N.Z,{checked:e,indeterminate:s,onChange:e=>S(e.target.checked),disabled:0===r.length,children:["Select All ",r.length>0&&"(".concat(r.length,")")]})})]}),(0,a.jsx)(u.Z,{className:"text-sm text-gray-600",children:"Select the MCP servers you want to be visible on the public model hub. Users will still require a valid Virtual Key to use these servers."}),(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,a.jsx)("div",{className:"space-y-3",children:0===r.length?(0,a.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,a.jsx)(u.Z,{children:"No MCP servers available."})}):r.map(e=>{var s;let l=(null===(s=e.mcp_info)||void 0===s?void 0:s.is_public)===!0;return(0,a.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,a.jsx)(N.Z,{checked:x.has(e.server_id),onChange:s=>Z(e.server_id,s.target.checked)}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e.server_name}),l&&(0,a.jsx)(m.Z,{color:"emerald",size:"sm",children:"Public"}),(0,a.jsx)(m.Z,{color:"blue",size:"sm",children:e.transport}),(0,a.jsx)(m.Z,{color:"active"===e.status||"healthy"===e.status?"green":"inactive"===e.status||"unhealthy"===e.status?"red":"gray",size:"sm",children:e.status||"unknown"})]}),(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:e.description||e.url}),e.allowed_tools&&e.allowed_tools.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.allowed_tools.slice(0,3).map((e,s)=>(0,a.jsx)(m.Z,{color:"purple",size:"xs",children:e},s)),e.allowed_tools.length>3&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",e.allowed_tools.length-3," more"]})]})]})]},e.server_id)})})}),x.size>0&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:[(0,a.jsx)("strong",{children:x.size})," MCP server",1!==x.size?"s":""," selected"]})})]})},z=()=>(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(y.Z,{children:"Confirm Making MCP Servers Public"}),(0,a.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,a.jsxs)(u.Z,{className:"text-sm text-yellow-800",children:[(0,a.jsx)("strong",{children:"Warning:"})," Once you make these MCP servers public, anyone who can go to the"," ",(0,a.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:"MCP Servers to be made public:"}),(0,a.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,a.jsx)("div",{className:"space-y-2",children:Array.from(x).map(e=>{let s=r.find(s=>s.server_id===e);return(0,a.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:(null==s?void 0:s.server_name)||e}),s&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(m.Z,{color:"blue",size:"xs",children:s.transport}),(0,a.jsx)(m.Z,{color:"active"===s.status||"healthy"===s.status?"green":"inactive"===s.status||"unhealthy"===s.status?"red":"gray",size:"xs",children:s.status||"unknown"})]})]}),(null==s?void 0:s.description)&&(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:s.description}),(null==s?void 0:s.url)&&(0,a.jsx)(u.Z,{className:"text-xs text-gray-500 mt-1",children:s.url})]})},e)})})})]}),(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,a.jsx)("strong",{children:x.size})," MCP server",1!==x.size?"s":""," will be made public"]})})]});return(0,a.jsx)(n.Z,{title:"Make MCP Servers Public",open:s,onCancel:w,footer:null,width:1200,maskClosable:!1,children:(0,a.jsxs)(b.Z,{form:j,layout:"vertical",children:[(0,a.jsxs)(v.default,{current:c,className:"mb-6",children:[(0,a.jsx)(C,{title:"Select Servers"}),(0,a.jsx)(C,{title:"Confirm"})]}),(()=>{switch(c){case 0:return M();case 1:return z();default:return null}})(),(0,a.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,a.jsx)(f.ZP,{onClick:0===c?w:()=>{1===c&&o(0)},children:0===c?"Cancel":"Previous"}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[0===c&&(0,a.jsx)(f.ZP,{onClick:()=>{if(0===c){if(0===x.size){k.Z.fromBackend("Please select at least one MCP server to make public");return}o(1)}},disabled:0===x.size,children:"Next"}),1===c&&(0,a.jsx)(f.ZP,{onClick:P,loading:p,children:"Make Public"})]})]})]})})},P=l(78801),M=e=>{let{modelHubData:s,onFilteredDataChange:l,showFiltersCard:t=!0,className:r=""}=e,[n,i]=(0,d.useState)(""),[c,o]=(0,d.useState)(""),[x,m]=(0,d.useState)(""),[h,u]=(0,d.useState)(""),p=(0,d.useRef)([]),g=(0,d.useMemo)(()=>(null==s?void 0:s.filter(e=>{let s=e.model_group.toLowerCase().includes(n.toLowerCase()),l=""===c||e.providers.includes(c),a=""===x||e.mode===x,t=""===h||Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).some(e=>{let[s]=e;return s.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")===h});return s&&l&&a&&t}))||[],[s,n,c,x,h]);(0,d.useEffect)(()=>{(g.length!==p.current.length||g.some((e,s)=>{var l;return e.model_group!==(null===(l=p.current[s])||void 0===l?void 0:l.model_group)}))&&(p.current=g,l(g))},[g,l]);let j=(0,a.jsxs)("div",{className:"flex flex-wrap gap-4 items-center",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Search Models:"}),(0,a.jsx)("input",{type:"text",placeholder:"Search model names...",value:n,onChange:e=>i(e.target.value),className:"border rounded px-3 py-2 w-64 h-10 text-sm"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Provider:"}),(0,a.jsxs)("select",{value:c,onChange:e=>o(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-40 h-10",children:[(0,a.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Providers"}),s&&(e=>{let s=new Set;return e.forEach(e=>{e.providers.forEach(e=>s.add(e))}),Array.from(s)})(s).map(e=>(0,a.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Mode:"}),(0,a.jsxs)("select",{value:x,onChange:e=>m(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-32 h-10",children:[(0,a.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Modes"}),s&&(e=>{let s=new Set;return e.forEach(e=>{e.mode&&s.add(e.mode)}),Array.from(s)})(s).map(e=>(0,a.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Features:"}),(0,a.jsxs)("select",{value:h,onChange:e=>u(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-48 h-10",children:[(0,a.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Features"}),s&&(e=>{let s=new Set;return e.forEach(e=>{Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).forEach(e=>{let[l]=e,a=l.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");s.add(a)})}),Array.from(s).sort()})(s).map(e=>(0,a.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(n||c||x||h)&&(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsx)("button",{onClick:()=>{i(""),o(""),m(""),u("")},className:"text-blue-600 hover:text-blue-800 text-sm underline h-10 flex items-center",children:"Clear Filters"})})]});return t?(0,a.jsx)(P.Z,{className:"mb-6 ".concat(r),children:j}):(0,a.jsx)("div",{className:r,children:j})};let{Step:z}=v.default;var A=e=>{let{visible:s,onClose:l,accessToken:t,modelHubData:r,onSuccess:i}=e,[c,o]=(0,d.useState)(0),[x,h]=(0,d.useState)(new Set),[p,g]=(0,d.useState)([]),[j,w]=(0,d.useState)(!1),[Z]=b.Z.useForm(),C=()=>{o(0),h(new Set),g([]),Z.resetFields(),l()},S=(e,s)=>{let l=new Set(x);s?l.add(e):l.delete(e),h(l)},P=e=>{e?h(new Set(p.map(e=>e.model_group))):h(new Set)},A=(0,d.useCallback)(e=>{g(e)},[]);(0,d.useEffect)(()=>{s&&r.length>0&&(g(r),h(new Set(r.filter(e=>!0===e.is_public_model_group).map(e=>e.model_group))))},[s,r]);let F=async()=>{if(0===x.size){k.Z.fromBackend("Please select at least one model to make public");return}w(!0);try{let e=Array.from(x);await (0,_.makeModelGroupPublic)(t,e),k.Z.success("Successfully made ".concat(e.length," model group(s) public!")),C(),i()}catch(e){console.error("Error making model groups public:",e),k.Z.fromBackend("Failed to make model groups public. Please try again.")}finally{w(!1)}},L=()=>{let e=p.length>0&&p.every(e=>x.has(e.model_group)),s=x.size>0&&!e;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(y.Z,{children:"Select Models to Make Public"}),(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsxs)(N.Z,{checked:e,indeterminate:s,onChange:e=>P(e.target.checked),disabled:0===p.length,children:["Select All ",p.length>0&&"(".concat(p.length,")")]})})]}),(0,a.jsx)(u.Z,{className:"text-sm text-gray-600",children:"Select the models you want to be visible on the public model hub. Users will still require a valid Virtual Key to use these models."}),(0,a.jsx)(M,{modelHubData:r,onFilteredDataChange:A,showFiltersCard:!1,className:"border rounded-lg p-4 bg-gray-50"}),(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,a.jsx)("div",{className:"space-y-3",children:0===p.length?(0,a.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,a.jsx)(u.Z,{children:"No models match the current filters."})}):p.map(e=>(0,a.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,a.jsx)(N.Z,{checked:x.has(e.model_group),onChange:s=>S(e.model_group,s.target.checked)}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e.model_group}),e.mode&&(0,a.jsx)(m.Z,{color:"green",size:"sm",children:e.mode})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:e.providers.map(e=>(0,a.jsx)(m.Z,{color:"blue",size:"xs",children:e},e))})]})]},e.model_group))})}),x.size>0&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:[(0,a.jsx)("strong",{children:x.size})," model",1!==x.size?"s":""," selected"]})})]})},D=()=>(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(y.Z,{children:"Confirm Making Models Public"}),(0,a.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,a.jsxs)(u.Z,{className:"text-sm text-yellow-800",children:[(0,a.jsx)("strong",{children:"Warning:"})," Once you make these models public, anyone who can go to the"," ",(0,a.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:"Models to be made public:"}),(0,a.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,a.jsx)("div",{className:"space-y-2",children:Array.from(x).map(e=>{let s=r.find(s=>s.model_group===e);return(0,a.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,a.jsxs)("div",{children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e}),s&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:s.providers.map(e=>(0,a.jsx)(m.Z,{color:"blue",size:"xs",children:e},e))})]})},e)})})})]}),(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,a.jsx)("strong",{children:x.size})," model",1!==x.size?"s":""," will be made public"]})})]});return(0,a.jsx)(n.Z,{title:"Make Models Public",open:s,onCancel:C,footer:null,width:1200,maskClosable:!1,children:(0,a.jsxs)(b.Z,{form:Z,layout:"vertical",children:[(0,a.jsxs)(v.default,{current:c,className:"mb-6",children:[(0,a.jsx)(z,{title:"Select Models"}),(0,a.jsx)(z,{title:"Confirm"})]}),(()=>{switch(c){case 0:return L();case 1:return D();default:return null}})(),(0,a.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,a.jsx)(f.ZP,{onClick:0===c?C:()=>{1===c&&o(0)},children:0===c?"Cancel":"Previous"}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[0===c&&(0,a.jsx)(f.ZP,{onClick:()=>{if(0===c){if(0===x.size){k.Z.fromBackend("Please select at least one model to make public");return}o(1)}},disabled:0===x.size,children:"Next"}),1===c&&(0,a.jsx)(f.ZP,{onClick:F,loading:j,children:"Make Public"})]})]})]})})},F=l(8048);let L=e=>e.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),D=e=>Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).map(e=>{let[s]=e;return s}),O=e=>"$".concat((1e6*e).toFixed(2)),K=e=>e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toString(),U=function(e,s){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=[{header:"Public Model Name",accessorKey:"model_group",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium text-sm",children:r.model_group}),(0,a.jsx)(p.Z,{title:"Copy model name",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.model_group),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,a.jsx)("div",{className:"md:hidden",children:(0,a.jsx)(u.Z,{className:"text-xs text-gray-600",children:r.providers.join(", ")})})]})}},{header:"Provider",accessorKey:"providers",enableSorting:!0,sortingFn:(e,s)=>{let l=e.original.providers.join(", "),a=s.original.providers.join(", ");return l.localeCompare(a)},cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.providers.slice(0,2).map(e=>(0,a.jsx)(g.Z,{color:"blue",className:"text-xs",children:e},e)),l.providers.length>2&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",l.providers.length-2]})]})},meta:{className:"hidden md:table-cell"}},{header:"Mode",accessorKey:"mode",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return l.mode?(0,a.jsx)(m.Z,{color:"green",size:"sm",children:l.mode}):(0,a.jsx)(u.Z,{className:"text-gray-500",children:"-"})},meta:{className:"hidden lg:table-cell"}},{header:"Tokens",accessorKey:"max_input_tokens",enableSorting:!0,sortingFn:(e,s)=>(e.original.max_input_tokens||0)+(e.original.max_output_tokens||0)-((s.original.max_input_tokens||0)+(s.original.max_output_tokens||0)),cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)("div",{className:"space-y-1",children:(0,a.jsxs)(u.Z,{className:"text-xs",children:[l.max_input_tokens?K(l.max_input_tokens):"-"," /"," ",l.max_output_tokens?K(l.max_output_tokens):"-"]})})},meta:{className:"hidden lg:table-cell"}},{header:"Cost/1M",accessorKey:"input_cost_per_token",enableSorting:!0,sortingFn:(e,s)=>(e.original.input_cost_per_token||0)+(e.original.output_cost_per_token||0)-((s.original.input_cost_per_token||0)+(s.original.output_cost_per_token||0)),cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(u.Z,{className:"text-xs",children:l.input_cost_per_token?O(l.input_cost_per_token):"-"}),(0,a.jsx)(u.Z,{className:"text-xs text-gray-500",children:l.output_cost_per_token?O(l.output_cost_per_token):"-"})]})}},{header:"Features",accessorKey:"capabilities",enableSorting:!1,cell:e=>{let{row:s}=e,l=D(s.original),t=["green","blue","purple","orange","red","yellow"];return(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:0===l.length?(0,a.jsx)(u.Z,{className:"text-gray-500 text-xs",children:"-"}):l.map((e,s)=>(0,a.jsx)(m.Z,{color:t[s%t.length],size:"xs",children:L(e)},e))})}},{header:"Public",accessorKey:"is_public_model_group",enableSorting:!0,sortingFn:(e,s)=>(!0===e.original.is_public_model_group?1:0)-(!0===s.original.is_public_model_group?1:0),cell:e=>{let{row:s}=e;return!0===s.original.is_public_model_group?(0,a.jsx)(m.Z,{color:"green",size:"xs",children:"Yes"}):(0,a.jsx)(m.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,t=l.original;return(0,a.jsxs)(h.Z,{size:"xs",variant:"secondary",onClick:()=>e(t),icon:j.Z,children:[(0,a.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,a.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}];return l?r.filter(e=>!("accessorKey"in e)||"is_public_model_group"!==e.accessorKey):r};var E=l(87526),T=l(86462),H=l(47686),R=l(77355),B=l(93416),I=l(74998),Y=l(95704),V=e=>{let{accessToken:s,userRole:l}=e,[t,r]=(0,d.useState)([]),[i,c]=(0,d.useState)({url:"",displayName:""}),[o,m]=(0,d.useState)(null),[h,u]=(0,d.useState)(!1),[p,g]=(0,d.useState)(!0),j=async()=>{if(s)try{u(!0);let e=await (0,_.getPublicModelHubInfo)();if(e&&e.useful_links){let s=e.useful_links||{},l=Object.entries(s).map((e,s)=>{let[l,a]=e;return{id:"".concat(s,"-").concat(l),displayName:l,url:a}});r(l)}else r([])}catch(e){console.error("Error fetching useful links:",e),r([])}finally{u(!1)}};if((0,d.useEffect)(()=>{j()},[s]),!(0,x.tY)(l||""))return null;let v=async e=>{if(!s)return!1;try{let l={};return e.forEach(e=>{l[e.displayName]=e.url}),await (0,_.updateUsefulLinksCall)(s,l),n.Z.success({title:"Links Saved Successfully",content:(0,a.jsxs)("div",{className:"py-4",children:[(0,a.jsx)("p",{className:"text-gray-600 mb-4",children:"Your useful links have been saved and are now visible on the public model hub."}),(0,a.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[(0,a.jsx)("p",{className:"text-sm text-blue-800 mb-2 font-medium",children:"View your updated model hub:"}),(0,a.jsx)("a",{href:"".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table"),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-blue-600 hover:text-blue-800 underline text-sm font-medium",children:"Open Public Model Hub →"})]})]}),width:500,okText:"Close",maskClosable:!0,keyboard:!0}),!0}catch(e){return console.error("Error saving links:",e),k.Z.fromBackend("Failed to save links - ".concat(e)),!1}},b=async()=>{if(!i.url||!i.displayName)return;try{new URL(i.url)}catch(e){k.Z.fromBackend("Please enter a valid URL");return}if(t.some(e=>e.displayName===i.displayName)){k.Z.fromBackend("A link with this display name already exists");return}let e=[...t,{id:"".concat(Date.now(),"-").concat(i.displayName),displayName:i.displayName,url:i.url}];await v(e)&&(r(e),c({url:"",displayName:""}),k.Z.success("Link added successfully"))},N=e=>{m({...e})},f=async()=>{if(!o)return;try{new URL(o.url)}catch(e){k.Z.fromBackend("Please enter a valid URL");return}if(t.some(e=>e.id!==o.id&&e.displayName===o.displayName)){k.Z.fromBackend("A link with this display name already exists");return}let e=t.map(e=>e.id===o.id?o:e);await v(e)&&(r(e),m(null),k.Z.success("Link updated successfully"))},y=()=>{m(null)},w=async e=>{let s=t.filter(s=>s.id!==e);await v(s)&&(r(s),k.Z.success("Link deleted successfully"))},Z=e=>{window.open(e,"_blank")};return(0,a.jsxs)(Y.Zb,{className:"mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>g(!p),children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)(Y.Dx,{className:"mb-0",children:"Link Management"}),(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"Manage the links that are displayed under 'Useful Links' on the public model hub."})]}),(0,a.jsx)("div",{className:"flex items-center",children:p?(0,a.jsx)(T.Z,{className:"w-5 h-5 text-gray-500"}):(0,a.jsx)(H.Z,{className:"w-5 h-5 text-gray-500"})})]}),p&&(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)(Y.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Link"}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"URL"}),(0,a.jsx)("input",{type:"text",value:i.url,onChange:e=>c({...i,url:e.target.value}),placeholder:"https://example.com",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Display Name"}),(0,a.jsx)("input",{type:"text",value:i.displayName,onChange:e=>c({...i,displayName:e.target.value}),placeholder:"Friendly name",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsxs)("button",{onClick:b,disabled:!i.url||!i.displayName,className:"flex items-center px-4 py-2 rounded-md text-sm ".concat(i.url&&i.displayName?"bg-green-600 text-white hover:bg-green-700":"bg-gray-300 text-gray-500 cursor-not-allowed"),children:[(0,a.jsx)(R.Z,{className:"w-4 h-4 mr-1"}),"Add Link"]})})]})]}),(0,a.jsx)(Y.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Links"}),(0,a.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)(Y.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,a.jsx)(Y.ss,{children:(0,a.jsxs)(Y.SC,{children:[(0,a.jsx)(Y.xs,{className:"py-1 h-8",children:"Display Name"}),(0,a.jsx)(Y.xs,{className:"py-1 h-8",children:"URL"}),(0,a.jsx)(Y.xs,{className:"py-1 h-8",children:"Actions"})]})}),(0,a.jsxs)(Y.RM,{children:[t.map(e=>(0,a.jsx)(Y.SC,{className:"h-8",children:o&&o.id===e.id?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Y.pj,{className:"py-0.5",children:(0,a.jsx)("input",{type:"text",value:o.displayName,onChange:e=>m({...o,displayName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,a.jsx)(Y.pj,{className:"py-0.5",children:(0,a.jsx)("input",{type:"text",value:o.url,onChange:e=>m({...o,url:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,a.jsx)(Y.pj,{className:"py-0.5 whitespace-nowrap",children:(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:f,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,a.jsx)("button",{onClick:y,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Y.pj,{className:"py-0.5 text-sm text-gray-900",children:e.displayName}),(0,a.jsx)(Y.pj,{className:"py-0.5 text-sm text-gray-500",children:e.url}),(0,a.jsx)(Y.pj,{className:"py-0.5 whitespace-nowrap",children:(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:()=>Z(e.url),className:"text-xs bg-green-50 text-green-600 px-2 py-1 rounded hover:bg-green-100",children:"Use"}),(0,a.jsx)("button",{onClick:()=>N(e),className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,a.jsx)(B.Z,{className:"w-3 h-3"})}),(0,a.jsx)("button",{onClick:()=>w(e.id),className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,a.jsx)(I.Z,{className:"w-3 h-3"})})]})})]})},e.id)),0===t.length&&(0,a.jsx)(Y.SC,{children:(0,a.jsx)(Y.pj,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No links added yet. Add a new link above."})})]})]})})})]})]})},W=e=>{var s,l,v,b;let{accessToken:N,publicPage:f,premiumUser:y,userRole:w}=e,[C,P]=(0,d.useState)(!1),[z,L]=(0,d.useState)(null),[D,O]=(0,d.useState)(!0),[K,T]=(0,d.useState)(!1),[H,R]=(0,d.useState)(!1),[B,I]=(0,d.useState)(null),[Y,W]=(0,d.useState)([]),[q,G]=(0,d.useState)(!1),[J,$]=(0,d.useState)(null),[Q,X]=(0,d.useState)(!1),[ee,es]=(0,d.useState)(!0),[el,ea]=(0,d.useState)(null),[et,er]=(0,d.useState)(!1),[en,ei]=(0,d.useState)(null),[ec,ed]=(0,d.useState)(!0),[eo,ex]=(0,d.useState)(null),[em,eh]=(0,d.useState)(!1),[eu,ep]=(0,d.useState)(!1),eg=(0,c.useRouter)(),ej=(0,d.useRef)(null),ev=(0,d.useRef)(null),eb=(0,d.useRef)(null);(0,d.useEffect)(()=>{let e=async e=>{try{O(!0);let s=await (0,_.modelHubCall)(e);console.log("ModelHubData:",s),L(s.data),(0,_.getConfigFieldSetting)(e,"enable_public_model_hub").then(e=>{console.log("data: ".concat(JSON.stringify(e))),!0==e.field_value&&P(!0)}).catch(e=>{})}catch(e){console.error("There was an error fetching the model data",e)}finally{O(!1)}},s=async()=>{try{var e,s;O(!0),await (0,_.getUiConfig)();let l=await (0,_.modelHubPublicModelsCall)();console.log("ModelHubData:",l),console.log("First model structure:",l[0]),console.log("Model has model_group?",null===(e=l[0])||void 0===e?void 0:e.model_group),console.log("Model has providers?",null===(s=l[0])||void 0===s?void 0:s.providers),L(l),P(!0)}catch(e){console.error("There was an error fetching the public model data",e)}finally{O(!1)}};N?e(N):f&&s()},[N,f]),(0,d.useEffect)(()=>{let e=async()=>{if(N)try{es(!0);let e=await (0,_.getAgentsList)(N);console.log("AgentHubData:",e);let s=e.agents.map(e=>({agent_id:e.agent_id,...e.agent_card_params,is_public:e.litellm_params.is_public}));$(s)}catch(e){console.error("There was an error fetching the agent data",e)}finally{es(!1)}};f||e()},[f,N]),(0,d.useEffect)(()=>{let e=async()=>{if(N)try{ed(!0);let e=await (0,_.fetchMCPServers)(N);console.log("MCPHubData:",e),ei(e)}catch(e){console.error("There was an error fetching the MCP server data",e)}finally{ed(!1)}};f||e()},[f,N]);let eN=()=>{N&&G(!0)},ef=()=>{N&&X(!0)},ey=()=>{N&&ep(!0)},e_=()=>{T(!1),R(!1),I(null),er(!1),ea(null),eh(!1),ex(null)},ek=()=>{T(!1),R(!1),I(null),er(!1),ea(null),eh(!1),ex(null)},ew=e=>{navigator.clipboard.writeText(e),k.Z.success("Copied to clipboard!")},eZ=e=>e.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),eC=e=>Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).map(e=>{let[s]=e;return s}),eS=e=>"$".concat((1e6*e).toFixed(2)),eP=(0,d.useCallback)(e=>{W(e)},[]);return(console.log("publicPage: ",f),console.log("publicPageAllowed: ",C),f&&C)?(0,a.jsx)(E.Z,{accessToken:N}):(0,a.jsxs)("div",{className:"w-full mx-4 h-[75vh]",children:[!1==f?(0,a.jsxs)("div",{className:"w-full m-2 mt-2 p-8",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,a.jsxs)("div",{className:"flex flex-col items-start",children:[(0,a.jsx)(r.Dx,{className:"text-center",children:"AI Hub"}),(0,x.tY)(w||"")?(0,a.jsx)("p",{className:"text-sm text-gray-600",children:"Make models, agents, and MCP servers public for developers to know what's available."}):(0,a.jsx)("p",{className:"text-sm text-gray-600",children:"A list of all public model names personally available to you."})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,a.jsx)(r.xv,{children:"Model Hub URL:"}),(0,a.jsxs)("div",{className:"flex items-center bg-gray-200 px-2 py-1 rounded",children:[(0,a.jsx)(r.xv,{className:"mr-2",children:"".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table")}),(0,a.jsx)("button",{onClick:()=>ew("".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table")),className:"p-1 hover:bg-gray-300 rounded transition-colors",title:"Copy URL",children:(0,a.jsx)(i.Z,{size:16,className:"text-gray-600"})})]})]})]}),(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"mt-8 mb-2",children:(0,a.jsx)(V,{accessToken:N,userRole:w})}),(0,a.jsxs)(r.v0,{children:[(0,a.jsxs)(r.td,{className:"mb-4",children:[(0,a.jsx)(r.OK,{children:"Model Hub"}),(0,a.jsx)(r.OK,{children:"Agent Hub"}),(0,a.jsx)(r.OK,{children:"MCP Hub"})]}),(0,a.jsxs)(r.nP,{children:[(0,a.jsxs)(r.x4,{children:[(0,a.jsxs)(r.Zb,{children:[!1==f&&(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"flex justify-end mb-4",children:(0,a.jsx)(r.zx,{onClick:()=>eN(),children:"Select Models to Make Public"})}),(0,a.jsx)(M,{modelHubData:z||[],onFilteredDataChange:eP}),(0,a.jsx)(F.C,{columns:U(e=>{I(e),T(!0)},ew,f),data:Y,isLoading:D,table:ej,defaultSorting:[{id:"model_group",desc:!1}]})]}),(0,a.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,a.jsxs)(r.xv,{className:"text-sm text-gray-600",children:["Showing ",Y.length," of ",(null==z?void 0:z.length)||0," models"]})})]}),(0,a.jsxs)(r.x4,{children:[(0,a.jsxs)(r.Zb,{children:[!1==f&&(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"flex justify-end mb-4",children:(0,a.jsx)(r.zx,{onClick:()=>ef(),children:"Select Agents to Make Public"})}),(0,a.jsx)(F.C,{columns:function(e,s){return arguments.length>2&&void 0!==arguments[2]&&arguments[2],[{header:"Agent Name",accessorKey:"name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium text-sm",children:r.name}),(0,a.jsx)(p.Z,{title:"Copy agent name",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.name),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,a.jsx)("div",{className:"md:hidden",children:(0,a.jsx)(u.Z,{className:"text-xs text-gray-600",children:r.description})})]})}},{header:"Description",accessorKey:"description",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs line-clamp-2",children:l.description||"-"})},meta:{className:"hidden md:table-cell"}},{header:"Version",accessorKey:"version",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsxs)(m.Z,{color:"blue",size:"sm",children:["v",l.version]})},meta:{className:"hidden lg:table-cell"}},{header:"Protocol",accessorKey:"protocolVersion",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs",children:l.protocolVersion||"-"})},meta:{className:"hidden lg:table-cell"}},{header:"Skills",accessorKey:"skills",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original.skills||[];return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(u.Z,{className:"text-xs font-medium",children:[l.length," skill",1!==l.length?"s":""]}),l.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.slice(0,2).map(e=>(0,a.jsx)(g.Z,{color:"purple",className:"text-xs",children:e.name},e.id)),l.length>2&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",l.length-2]})]})]})}},{header:"Capabilities",accessorKey:"capabilities",enableSorting:!1,cell:e=>{let{row:s}=e,l=Object.entries(s.original.capabilities||{}).filter(e=>{let[s,l]=e;return!0===l}).map(e=>{let[s]=e;return s});return(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:0===l.length?(0,a.jsx)(u.Z,{className:"text-gray-500 text-xs",children:"-"}):l.map(e=>(0,a.jsx)(m.Z,{color:"green",size:"xs",children:e},e))})}},{header:"I/O Modes",accessorKey:"defaultInputModes",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original,t=l.defaultInputModes||[],r=l.defaultOutputModes||[];return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(u.Z,{className:"text-xs",children:[(0,a.jsx)("span",{className:"font-medium",children:"In:"})," ",t.join(", ")||"-"]}),(0,a.jsxs)(u.Z,{className:"text-xs",children:[(0,a.jsx)("span",{className:"font-medium",children:"Out:"})," ",r.join(", ")||"-"]})]})},meta:{className:"hidden xl:table-cell"}},{header:"Public",accessorKey:"is_public",enableSorting:!0,sortingFn:(e,s)=>(!0===e.original.is_public?1:0)-(!0===s.original.is_public?1:0),cell:e=>{let{row:s}=e;return console.log("CHECKPOINT 1: ".concat(JSON.stringify(s.original))),!0===s.original.is_public?(0,a.jsx)(m.Z,{color:"green",size:"xs",children:"Yes"}):(0,a.jsx)(m.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,t=l.original;return(0,a.jsxs)(h.Z,{size:"xs",variant:"secondary",onClick:()=>e(t),icon:j.Z,children:[(0,a.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,a.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}]}(e=>{ea(e),er(!0)},ew,f),data:J||[],isLoading:ee,table:ev,defaultSorting:[{id:"name",desc:!1}]})]}),(0,a.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,a.jsxs)(r.xv,{className:"text-sm text-gray-600",children:["Showing ",(null==J?void 0:J.length)||0," agent",(null==J?void 0:J.length)!==1?"s":""]})})]}),(0,a.jsxs)(r.x4,{children:[(0,a.jsxs)(r.Zb,{children:[!1==f&&(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"flex justify-end mb-4",children:(0,a.jsx)(r.zx,{onClick:()=>ey(),children:"Select MCP Servers to Make Public"})}),(0,a.jsx)(F.C,{columns:function(e,s){return arguments.length>2&&void 0!==arguments[2]&&arguments[2],[{header:"Server Name",accessorKey:"server_name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium text-sm",children:r.server_name}),(0,a.jsx)(p.Z,{title:"Copy server name",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.server_name),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,a.jsx)("div",{className:"md:hidden",children:(0,a.jsx)(u.Z,{className:"text-xs text-gray-600",children:r.description||"-"})})]})}},{header:"Description",accessorKey:"description",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs line-clamp-2",children:l.description||"-"})},meta:{className:"hidden md:table-cell"}},{header:"URL",accessorKey:"url",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"text-xs truncate max-w-xs",children:r.url}),(0,a.jsx)(p.Z,{title:"Copy URL",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.url),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs flex-shrink-0"})})]})},meta:{className:"hidden lg:table-cell"}},{header:"Transport",accessorKey:"transport",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(m.Z,{color:"blue",size:"sm",children:l.transport})},meta:{className:"hidden md:table-cell"}},{header:"Auth Type",accessorKey:"auth_type",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original,t="none"===l.auth_type?"gray":"green";return(0,a.jsx)(m.Z,{color:t,size:"sm",children:l.auth_type})},meta:{className:"hidden md:table-cell"}},{header:"Status",accessorKey:"status",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original,t={active:"green",inactive:"red",unknown:"gray",healthy:"green",unhealthy:"red"}[l.status]||"gray";return(0,a.jsx)(m.Z,{color:t,size:"sm",children:l.status||"unknown"})}},{header:"Tools",accessorKey:"allowed_tools",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original.allowed_tools||[];return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(u.Z,{className:"text-xs font-medium",children:l.length>0?"".concat(l.length," tool").concat(1!==l.length?"s":""):"All tools"}),l.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.slice(0,2).map((e,s)=>(0,a.jsx)(g.Z,{color:"purple",className:"text-xs",children:e},s)),l.length>2&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",l.length-2]})]})]})},meta:{className:"hidden lg:table-cell"}},{header:"Created By",accessorKey:"created_by",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs",children:l.created_by||"-"})},meta:{className:"hidden xl:table-cell"}},{header:"Public",accessorKey:"mcp_info.is_public",enableSorting:!0,sortingFn:(e,s)=>{var l,a;return((null===(l=e.original.mcp_info)||void 0===l?void 0:l.is_public)===!0?1:0)-((null===(a=s.original.mcp_info)||void 0===a?void 0:a.is_public)===!0?1:0)},cell:e=>{var s;let{row:l}=e;return(null===(s=l.original.mcp_info)||void 0===s?void 0:s.is_public)===!0?(0,a.jsx)(m.Z,{color:"green",size:"xs",children:"Yes"}):(0,a.jsx)(m.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,t=l.original;return(0,a.jsxs)(h.Z,{size:"xs",variant:"secondary",onClick:()=>e(t),icon:j.Z,children:[(0,a.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,a.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}]}(e=>{ex(e),eh(!0)},ew,f),data:en||[],isLoading:ec,table:eb,defaultSorting:[{id:"server_name",desc:!1}]})]}),(0,a.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,a.jsxs)(r.xv,{className:"text-sm text-gray-600",children:["Showing ",(null==en?void 0:en.length)||0," MCP server",(null==en?void 0:en.length)!==1?"s":""]})})]})]})]})]}):(0,a.jsxs)(r.Zb,{className:"mx-auto max-w-xl mt-10",children:[(0,a.jsx)(r.xv,{className:"text-xl text-center mb-2 text-black",children:"Public Model Hub not enabled."}),(0,a.jsx)("p",{className:"text-base text-center text-slate-800",children:"Ask your proxy admin to enable this on their Admin UI."})]}),(0,a.jsx)(n.Z,{title:"Public Model Hub",width:600,visible:H,footer:null,onOk:e_,onCancel:ek,children:(0,a.jsxs)("div",{className:"pt-5 pb-5",children:[(0,a.jsxs)("div",{className:"flex justify-between mb-4",children:[(0,a.jsx)(r.xv,{className:"text-base mr-2",children:"Shareable Link:"}),(0,a.jsx)(r.xv,{className:"max-w-sm ml-2 bg-gray-200 pr-2 pl-2 pt-1 pb-1 text-center rounded",children:"".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table")})]}),(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsx)(r.zx,{onClick:()=>{eg.replace("/model_hub_table?key=".concat(N))},children:"See Page"})})]})}),(0,a.jsx)(n.Z,{title:(null==B?void 0:B.model_group)||"Model Details",width:1e3,visible:K,footer:null,onOk:e_,onCancel:ek,children:B&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Model Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Model Group:"}),(0,a.jsx)(r.xv,{children:B.model_group})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Mode:"}),(0,a.jsx)(r.xv,{children:B.mode||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Providers:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:B.providers.map(e=>(0,a.jsx)(r.Ct,{color:"blue",children:e},e))})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Token & Cost Information"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Max Input Tokens:"}),(0,a.jsx)(r.xv,{children:(null===(s=B.max_input_tokens)||void 0===s?void 0:s.toLocaleString())||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Max Output Tokens:"}),(0,a.jsx)(r.xv,{children:(null===(l=B.max_output_tokens)||void 0===l?void 0:l.toLocaleString())||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Input Cost per 1M Tokens:"}),(0,a.jsx)(r.xv,{children:B.input_cost_per_token?eS(B.input_cost_per_token):"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Output Cost per 1M Tokens:"}),(0,a.jsx)(r.xv,{children:B.output_cost_per_token?eS(B.output_cost_per_token):"Not specified"})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Capabilities"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:(()=>{let e=eC(B),s=["green","blue","purple","orange","red","yellow"];return 0===e.length?(0,a.jsx)(r.xv,{className:"text-gray-500",children:"No special capabilities listed"}):e.map((e,l)=>(0,a.jsx)(r.Ct,{color:s[l%s.length],children:eZ(e)},e))})()})]}),(B.tpm||B.rpm)&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Rate Limits"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[B.tpm&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Tokens per Minute:"}),(0,a.jsx)(r.xv,{children:B.tpm.toLocaleString()})]}),B.rpm&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Requests per Minute:"}),(0,a.jsx)(r.xv,{children:B.rpm.toLocaleString()})]})]})]}),B.supported_openai_params&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Supported OpenAI Parameters"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:B.supported_openai_params.map(e=>(0,a.jsx)(r.Ct,{color:"green",children:e},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Usage Example"}),(0,a.jsx)(o.Z,{language:"python",className:"text-sm",children:'import openai\n\nclient = openai.OpenAI(\n api_key="your_api_key",\n base_url="http://0.0.0.0:4000" # Your LiteLLM Proxy URL\n)\n\nresponse = client.chat.completions.create(\n model="'.concat(B.model_group,'",\n messages=[\n {\n "role": "user",\n "content": "Hello, how are you?"\n }\n ]\n)\n\nprint(response.choices[0].message.content)')})]})]})}),(0,a.jsx)(n.Z,{title:(null==el?void 0:el.name)||"Agent Details",width:1e3,visible:et,footer:null,onOk:e_,onCancel:ek,children:el&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Agent Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Name:"}),(0,a.jsx)(r.xv,{children:el.name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Version:"}),(0,a.jsxs)(r.Ct,{color:"blue",children:["v",el.version]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Protocol Version:"}),(0,a.jsx)(r.xv,{children:el.protocolVersion})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"URL:"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(r.xv,{className:"truncate",children:el.url}),(0,a.jsx)(t.Z,{onClick:()=>ew(el.url),className:"cursor-pointer text-gray-500 hover:text-blue-500"})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Description:"}),(0,a.jsx)(r.xv,{className:"mt-1",children:el.description})]})]}),el.capabilities&&Object.keys(el.capabilities).length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Capabilities"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(el.capabilities).filter(e=>{let[s,l]=e;return!0===l}).map(e=>{let[s]=e;return(0,a.jsx)(r.Ct,{color:"green",children:s},s)})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Input/Output Modes"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Input Modes:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:(null===(v=el.defaultInputModes)||void 0===v?void 0:v.map(e=>(0,a.jsx)(r.Ct,{color:"blue",children:e},e)))||(0,a.jsx)(r.xv,{children:"Not specified"})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Output Modes:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:(null===(b=el.defaultOutputModes)||void 0===b?void 0:b.map(e=>(0,a.jsx)(r.Ct,{color:"purple",children:e},e)))||(0,a.jsx)(r.xv,{children:"Not specified"})})]})]})]}),el.skills&&el.skills.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Skills"}),(0,a.jsx)("div",{className:"space-y-4",children:el.skills.map(e=>(0,a.jsxs)("div",{className:"border border-gray-200 rounded p-4",children:[(0,a.jsxs)("div",{className:"flex justify-between items-start mb-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium text-base",children:e.name}),(0,a.jsxs)(r.xv,{className:"text-xs text-gray-500",children:["ID: ",e.id]})]}),e.tags&&e.tags.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:e.tags.map(e=>(0,a.jsx)(r.Ct,{color:"purple",size:"xs",children:e},e))})]}),(0,a.jsx)(r.xv,{className:"text-sm mb-2",children:e.description}),e.examples&&e.examples.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-xs font-medium text-gray-700",children:"Examples:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:e.examples.map((e,s)=>(0,a.jsx)(r.Ct,{color:"gray",size:"xs",children:e},s))})]})]},e.id))})]}),el.supportsAuthenticatedExtendedCard&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Additional Features"}),(0,a.jsx)(r.Ct,{color:"green",children:"Supports Authenticated Extended Card"})]})]})}),(0,a.jsx)(n.Z,{title:(null==eo?void 0:eo.server_name)||"MCP Server Details",width:1e3,visible:em,footer:null,onOk:e_,onCancel:ek,children:eo&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Server Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Server Name:"}),(0,a.jsx)(r.xv,{children:eo.server_name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Server ID:"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(r.xv,{className:"text-xs truncate",children:eo.server_id}),(0,a.jsx)(t.Z,{onClick:()=>ew(eo.server_id),className:"cursor-pointer text-gray-500 hover:text-blue-500"})]})]}),eo.alias&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Alias:"}),(0,a.jsx)(r.xv,{children:eo.alias})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Transport:"}),(0,a.jsx)(r.Ct,{color:"blue",children:eo.transport})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Auth Type:"}),(0,a.jsx)(r.Ct,{color:"none"===eo.auth_type?"gray":"green",children:eo.auth_type})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Status:"}),(0,a.jsx)(r.Ct,{color:"active"===eo.status||"healthy"===eo.status?"green":"inactive"===eo.status||"unhealthy"===eo.status?"red":"gray",children:eo.status||"unknown"})]})]}),eo.description&&(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Description:"}),(0,a.jsx)(r.xv,{className:"mt-1",children:eo.description})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Connection Details"}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"URL:"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2 mt-1",children:[(0,a.jsx)(r.xv,{className:"text-sm break-all bg-gray-100 p-2 rounded flex-1",children:eo.url}),(0,a.jsx)(t.Z,{onClick:()=>ew(eo.url),className:"cursor-pointer text-gray-500 hover:text-blue-500 flex-shrink-0"})]})]}),eo.command&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Command:"}),(0,a.jsx)(r.xv,{className:"text-sm bg-gray-100 p-2 rounded mt-1 font-mono",children:eo.command})]})]})]}),eo.allowed_tools&&eo.allowed_tools.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Allowed Tools"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.allowed_tools.map((e,s)=>(0,a.jsx)(r.Ct,{color:"purple",children:e},s))})]}),eo.teams&&eo.teams.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Teams"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.teams.map((e,s)=>(0,a.jsx)(r.Ct,{color:"blue",children:e},s))})]}),eo.mcp_access_groups&&eo.mcp_access_groups.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Access Groups"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.mcp_access_groups.map((e,s)=>(0,a.jsx)(r.Ct,{color:"green",children:e},s))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Metadata"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Created By:"}),(0,a.jsx)(r.xv,{children:eo.created_by})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Updated By:"}),(0,a.jsx)(r.xv,{children:eo.updated_by})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Created At:"}),(0,a.jsx)(r.xv,{className:"text-sm",children:new Date(eo.created_at).toLocaleString()})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Updated At:"}),(0,a.jsx)(r.xv,{className:"text-sm",children:new Date(eo.updated_at).toLocaleString()})]}),eo.last_health_check&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Last Health Check:"}),(0,a.jsx)(r.xv,{className:"text-sm",children:new Date(eo.last_health_check).toLocaleString()})]})]}),eo.health_check_error&&(0,a.jsxs)("div",{className:"mt-2 p-2 bg-red-50 rounded",children:[(0,a.jsx)(r.xv,{className:"font-medium text-red-700",children:"Health Check Error:"}),(0,a.jsx)(r.xv,{className:"text-sm text-red-600 mt-1",children:eo.health_check_error})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Usage Example"}),(0,a.jsx)(o.Z,{language:"python",className:"text-sm",children:'from fastmcp import Client\nimport asyncio\n\n# Standard MCP configuration\nconfig = {\n "mcpServers": {\n "'.concat(eo.server_name,'": {\n "url": "http://localhost:4000/').concat(eo.server_name,'/mcp",\n "headers": {\n "x-litellm-api-key": "Bearer sk-1234"\n }\n }\n }\n}\n\n# Create a client that connects to the server\nclient = Client(config)\n\nasync def main():\n async with client:\n # List available tools\n tools = await client.list_tools()\n print(f"Available tools: {[tool.name for tool in tools]}")\n\n # Call a tool\n response = await client.call_tool(\n name="tool_name", \n arguments={"arg": "value"}\n )\n print(f"Response: {response}")\n\nif __name__ == "__main__":\n asyncio.run(main())')})]})]})}),(0,a.jsx)(A,{visible:q,onClose:()=>G(!1),accessToken:N||"",modelHubData:z||[],onSuccess:()=>{N&&(async()=>{try{let e=await (0,_.modelHubCall)(N);L(e.data)}catch(e){console.error("Error refreshing model data:",e)}})()}}),(0,a.jsx)(Z,{visible:Q,onClose:()=>X(!1),accessToken:N||"",agentHubData:J||[],onSuccess:()=>{N&&(async()=>{try{let e=(await (0,_.getAgentsList)(N)).agents.map(e=>({agent_id:e.agent_id,...e.agent_card_params,is_public:e.is_public}));$(e)}catch(e){console.error("Error refreshing agent data:",e)}})()}}),(0,a.jsx)(S,{visible:eu,onClose:()=>ep(!1),accessToken:N||"",mcpHubData:en||[],onSuccess:()=>{N&&(async()=>{try{let e=await (0,_.fetchMCPServers)(N);ei(e)}catch(e){console.error("Error refreshing MCP server data:",e)}})()}})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2249-43e410d60ba8aea4.js b/litellm/proxy/_experimental/out/_next/static/chunks/2249-43e410d60ba8aea4.js new file mode 100644 index 0000000000..724461874e --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/2249-43e410d60ba8aea4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2249],{64748:function(e,s,l){l.d(s,{Ct:function(){return a.Z},Dx:function(){return m.Z},OK:function(){return n.Z},Zb:function(){return r.Z},nP:function(){return o.Z},td:function(){return c.Z},v0:function(){return i.Z},x4:function(){return d.Z},xv:function(){return x.Z},zx:function(){return t.Z}});var a=l(41649),t=l(78489),r=l(12514),n=l(12485),i=l(18135),c=l(35242),d=l(29706),o=l(77991),x=l(84264),m=l(96761)},78801:function(e,s,l){l.d(s,{Z:function(){return a.Z},x:function(){return t.Z}});var a=l(12514),t=l(84264)},92249:function(e,s,l){l.d(s,{Z:function(){return W}});var a=l(57437),t=l(23639),r=l(64748),n=l(22116),i=l(78867),c=l(99376),d=l(2265),o=l(17906),x=l(20347),m=l(41649),h=l(78489),u=l(84264),p=l(99981),g=l(3810),j=l(15424),v=l(15690),b=l(10032),N=l(4156),f=l(5545),y=l(96761),_=l(19250),k=l(9114);let{Step:w}=v.default;var Z=e=>{let{visible:s,onClose:l,accessToken:t,agentHubData:r,onSuccess:i}=e,[c,o]=(0,d.useState)(0),[x,h]=(0,d.useState)(new Set),[p,g]=(0,d.useState)(!1),[j]=b.Z.useForm(),Z=()=>{o(0),h(new Set),j.resetFields(),l()},C=(e,s)=>{let l=new Set(x);s?l.add(e):l.delete(e),h(l)},S=e=>{e?h(new Set(r.map(e=>e.agent_id||e.name))):h(new Set)};(0,d.useEffect)(()=>{s&&r.length>0&&h(new Set(r.filter(e=>!0===e.is_public).map(e=>e.agent_id||e.name)))},[s,r]);let P=async()=>{if(0===x.size){k.Z.fromBackend("Please select at least one agent to make public");return}g(!0);try{let e=Array.from(x);await (0,_.makeAgentsPublicCall)(t,e),k.Z.success("Successfully made ".concat(e.length," agent(s) public!")),Z(),i()}catch(e){console.error("Error making agents public:",e),k.Z.fromBackend("Failed to make agents public. Please try again.")}finally{g(!1)}},M=()=>{let e=r.length>0&&r.every(e=>x.has(e.agent_id||e.name)),s=x.size>0&&!e;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(y.Z,{children:"Select Agents to Make Public"}),(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsxs)(N.Z,{checked:e,indeterminate:s,onChange:e=>S(e.target.checked),disabled:0===r.length,children:["Select All ",r.length>0&&"(".concat(r.length,")")]})})]}),(0,a.jsx)(u.Z,{className:"text-sm text-gray-600",children:"Select the agents you want to be visible on the public model hub. Users will still require a valid Virtual Key to use these agents."}),(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,a.jsx)("div",{className:"space-y-3",children:0===r.length?(0,a.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,a.jsx)(u.Z,{children:"No agents available."})}):r.map(e=>{let s=e.agent_id||e.name;return(0,a.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,a.jsx)(N.Z,{checked:x.has(s),onChange:e=>C(s,e.target.checked)}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e.name}),(0,a.jsxs)(m.Z,{color:"blue",size:"sm",children:["v",e.version]})]}),(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:e.description}),e.skills&&e.skills.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.skills.slice(0,3).map(e=>(0,a.jsx)(m.Z,{color:"purple",size:"xs",children:e.name},e.id)),e.skills.length>3&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",e.skills.length-3," more"]})]})]})]},s)})})}),x.size>0&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:[(0,a.jsx)("strong",{children:x.size})," agent",1!==x.size?"s":""," selected"]})})]})},z=()=>(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(y.Z,{children:"Confirm Making Agents Public"}),(0,a.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,a.jsxs)(u.Z,{className:"text-sm text-yellow-800",children:[(0,a.jsx)("strong",{children:"Warning:"})," Once you make these agents public, anyone who can go to the"," ",(0,a.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:"Agents to be made public:"}),(0,a.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,a.jsx)("div",{className:"space-y-2",children:Array.from(x).map(e=>{let s=r.find(s=>(s.agent_id||s.name)===e);return(0,a.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:(null==s?void 0:s.name)||e}),s&&(0,a.jsxs)(m.Z,{color:"blue",size:"xs",children:["v",s.version]})]}),(null==s?void 0:s.description)&&(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:s.description})]})},e)})})})]}),(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,a.jsx)("strong",{children:x.size})," agent",1!==x.size?"s":""," will be made public"]})})]});return(0,a.jsx)(n.Z,{title:"Make Agents Public",open:s,onCancel:Z,footer:null,width:1200,maskClosable:!1,children:(0,a.jsxs)(b.Z,{form:j,layout:"vertical",children:[(0,a.jsxs)(v.default,{current:c,className:"mb-6",children:[(0,a.jsx)(w,{title:"Select Agents"}),(0,a.jsx)(w,{title:"Confirm"})]}),(()=>{switch(c){case 0:return M();case 1:return z();default:return null}})(),(0,a.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,a.jsx)(f.ZP,{onClick:0===c?Z:()=>{1===c&&o(0)},children:0===c?"Cancel":"Previous"}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[0===c&&(0,a.jsx)(f.ZP,{onClick:()=>{if(0===c){if(0===x.size){k.Z.fromBackend("Please select at least one agent to make public");return}o(1)}},disabled:0===x.size,children:"Next"}),1===c&&(0,a.jsx)(f.ZP,{onClick:P,loading:p,children:"Make Public"})]})]})]})})};let{Step:C}=v.default;var S=e=>{let{visible:s,onClose:l,accessToken:t,mcpHubData:r,onSuccess:i}=e,[c,o]=(0,d.useState)(0),[x,h]=(0,d.useState)(new Set),[p,g]=(0,d.useState)(!1),[j]=b.Z.useForm(),w=()=>{o(0),h(new Set),j.resetFields(),l()},Z=(e,s)=>{let l=new Set(x);s?l.add(e):l.delete(e),h(l)},S=e=>{e?h(new Set(r.map(e=>e.server_id))):h(new Set)};(0,d.useEffect)(()=>{s&&r.length>0&&h(new Set(r.filter(e=>{var s;return(null===(s=e.mcp_info)||void 0===s?void 0:s.is_public)===!0}).map(e=>e.server_id)))},[s]);let P=async()=>{if(0===x.size){k.Z.fromBackend("Please select at least one MCP server to make public");return}g(!0);try{let e=Array.from(x);await (0,_.makeMCPPublicCall)(t,e),k.Z.success("Successfully made ".concat(e.length," MCP server(s) public!")),w(),i()}catch(e){console.error("Error making MCP servers public:",e),k.Z.fromBackend("Failed to make MCP servers public. Please try again.")}finally{g(!1)}},M=()=>{let e=r.length>0&&r.every(e=>x.has(e.server_id)),s=x.size>0&&!e;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(y.Z,{children:"Select MCP Servers to Make Public"}),(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsxs)(N.Z,{checked:e,indeterminate:s,onChange:e=>S(e.target.checked),disabled:0===r.length,children:["Select All ",r.length>0&&"(".concat(r.length,")")]})})]}),(0,a.jsx)(u.Z,{className:"text-sm text-gray-600",children:"Select the MCP servers you want to be visible on the public model hub. Users will still require a valid Virtual Key to use these servers."}),(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,a.jsx)("div",{className:"space-y-3",children:0===r.length?(0,a.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,a.jsx)(u.Z,{children:"No MCP servers available."})}):r.map(e=>{var s;let l=(null===(s=e.mcp_info)||void 0===s?void 0:s.is_public)===!0;return(0,a.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,a.jsx)(N.Z,{checked:x.has(e.server_id),onChange:s=>Z(e.server_id,s.target.checked)}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e.server_name}),l&&(0,a.jsx)(m.Z,{color:"emerald",size:"sm",children:"Public"}),(0,a.jsx)(m.Z,{color:"blue",size:"sm",children:e.transport}),(0,a.jsx)(m.Z,{color:"active"===e.status||"healthy"===e.status?"green":"inactive"===e.status||"unhealthy"===e.status?"red":"gray",size:"sm",children:e.status||"unknown"})]}),(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:e.description||e.url}),e.allowed_tools&&e.allowed_tools.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.allowed_tools.slice(0,3).map((e,s)=>(0,a.jsx)(m.Z,{color:"purple",size:"xs",children:e},s)),e.allowed_tools.length>3&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",e.allowed_tools.length-3," more"]})]})]})]},e.server_id)})})}),x.size>0&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:[(0,a.jsx)("strong",{children:x.size})," MCP server",1!==x.size?"s":""," selected"]})})]})},z=()=>(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(y.Z,{children:"Confirm Making MCP Servers Public"}),(0,a.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,a.jsxs)(u.Z,{className:"text-sm text-yellow-800",children:[(0,a.jsx)("strong",{children:"Warning:"})," Once you make these MCP servers public, anyone who can go to the"," ",(0,a.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:"MCP Servers to be made public:"}),(0,a.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,a.jsx)("div",{className:"space-y-2",children:Array.from(x).map(e=>{let s=r.find(s=>s.server_id===e);return(0,a.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:(null==s?void 0:s.server_name)||e}),s&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(m.Z,{color:"blue",size:"xs",children:s.transport}),(0,a.jsx)(m.Z,{color:"active"===s.status||"healthy"===s.status?"green":"inactive"===s.status||"unhealthy"===s.status?"red":"gray",size:"xs",children:s.status||"unknown"})]})]}),(null==s?void 0:s.description)&&(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:s.description}),(null==s?void 0:s.url)&&(0,a.jsx)(u.Z,{className:"text-xs text-gray-500 mt-1",children:s.url})]})},e)})})})]}),(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,a.jsx)("strong",{children:x.size})," MCP server",1!==x.size?"s":""," will be made public"]})})]});return(0,a.jsx)(n.Z,{title:"Make MCP Servers Public",open:s,onCancel:w,footer:null,width:1200,maskClosable:!1,children:(0,a.jsxs)(b.Z,{form:j,layout:"vertical",children:[(0,a.jsxs)(v.default,{current:c,className:"mb-6",children:[(0,a.jsx)(C,{title:"Select Servers"}),(0,a.jsx)(C,{title:"Confirm"})]}),(()=>{switch(c){case 0:return M();case 1:return z();default:return null}})(),(0,a.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,a.jsx)(f.ZP,{onClick:0===c?w:()=>{1===c&&o(0)},children:0===c?"Cancel":"Previous"}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[0===c&&(0,a.jsx)(f.ZP,{onClick:()=>{if(0===c){if(0===x.size){k.Z.fromBackend("Please select at least one MCP server to make public");return}o(1)}},disabled:0===x.size,children:"Next"}),1===c&&(0,a.jsx)(f.ZP,{onClick:P,loading:p,children:"Make Public"})]})]})]})})},P=l(78801),M=e=>{let{modelHubData:s,onFilteredDataChange:l,showFiltersCard:t=!0,className:r=""}=e,[n,i]=(0,d.useState)(""),[c,o]=(0,d.useState)(""),[x,m]=(0,d.useState)(""),[h,u]=(0,d.useState)(""),p=(0,d.useRef)([]),g=(0,d.useMemo)(()=>(null==s?void 0:s.filter(e=>{let s=e.model_group.toLowerCase().includes(n.toLowerCase()),l=""===c||e.providers.includes(c),a=""===x||e.mode===x,t=""===h||Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).some(e=>{let[s]=e;return s.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")===h});return s&&l&&a&&t}))||[],[s,n,c,x,h]);(0,d.useEffect)(()=>{(g.length!==p.current.length||g.some((e,s)=>{var l;return e.model_group!==(null===(l=p.current[s])||void 0===l?void 0:l.model_group)}))&&(p.current=g,l(g))},[g,l]);let j=(0,a.jsxs)("div",{className:"flex flex-wrap gap-4 items-center",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Search Models:"}),(0,a.jsx)("input",{type:"text",placeholder:"Search model names...",value:n,onChange:e=>i(e.target.value),className:"border rounded px-3 py-2 w-64 h-10 text-sm"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Provider:"}),(0,a.jsxs)("select",{value:c,onChange:e=>o(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-40 h-10",children:[(0,a.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Providers"}),s&&(e=>{let s=new Set;return e.forEach(e=>{e.providers.forEach(e=>s.add(e))}),Array.from(s)})(s).map(e=>(0,a.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Mode:"}),(0,a.jsxs)("select",{value:x,onChange:e=>m(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-32 h-10",children:[(0,a.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Modes"}),s&&(e=>{let s=new Set;return e.forEach(e=>{e.mode&&s.add(e.mode)}),Array.from(s)})(s).map(e=>(0,a.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Features:"}),(0,a.jsxs)("select",{value:h,onChange:e=>u(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-48 h-10",children:[(0,a.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Features"}),s&&(e=>{let s=new Set;return e.forEach(e=>{Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).forEach(e=>{let[l]=e,a=l.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");s.add(a)})}),Array.from(s).sort()})(s).map(e=>(0,a.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(n||c||x||h)&&(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsx)("button",{onClick:()=>{i(""),o(""),m(""),u("")},className:"text-blue-600 hover:text-blue-800 text-sm underline h-10 flex items-center",children:"Clear Filters"})})]});return t?(0,a.jsx)(P.Z,{className:"mb-6 ".concat(r),children:j}):(0,a.jsx)("div",{className:r,children:j})};let{Step:z}=v.default;var A=e=>{let{visible:s,onClose:l,accessToken:t,modelHubData:r,onSuccess:i}=e,[c,o]=(0,d.useState)(0),[x,h]=(0,d.useState)(new Set),[p,g]=(0,d.useState)([]),[j,w]=(0,d.useState)(!1),[Z]=b.Z.useForm(),C=()=>{o(0),h(new Set),g([]),Z.resetFields(),l()},S=(e,s)=>{let l=new Set(x);s?l.add(e):l.delete(e),h(l)},P=e=>{e?h(new Set(p.map(e=>e.model_group))):h(new Set)},A=(0,d.useCallback)(e=>{g(e)},[]);(0,d.useEffect)(()=>{s&&r.length>0&&(g(r),h(new Set(r.filter(e=>!0===e.is_public_model_group).map(e=>e.model_group))))},[s,r]);let F=async()=>{if(0===x.size){k.Z.fromBackend("Please select at least one model to make public");return}w(!0);try{let e=Array.from(x);await (0,_.makeModelGroupPublic)(t,e),k.Z.success("Successfully made ".concat(e.length," model group(s) public!")),C(),i()}catch(e){console.error("Error making model groups public:",e),k.Z.fromBackend("Failed to make model groups public. Please try again.")}finally{w(!1)}},L=()=>{let e=p.length>0&&p.every(e=>x.has(e.model_group)),s=x.size>0&&!e;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(y.Z,{children:"Select Models to Make Public"}),(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsxs)(N.Z,{checked:e,indeterminate:s,onChange:e=>P(e.target.checked),disabled:0===p.length,children:["Select All ",p.length>0&&"(".concat(p.length,")")]})})]}),(0,a.jsx)(u.Z,{className:"text-sm text-gray-600",children:"Select the models you want to be visible on the public model hub. Users will still require a valid Virtual Key to use these models."}),(0,a.jsx)(M,{modelHubData:r,onFilteredDataChange:A,showFiltersCard:!1,className:"border rounded-lg p-4 bg-gray-50"}),(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,a.jsx)("div",{className:"space-y-3",children:0===p.length?(0,a.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,a.jsx)(u.Z,{children:"No models match the current filters."})}):p.map(e=>(0,a.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,a.jsx)(N.Z,{checked:x.has(e.model_group),onChange:s=>S(e.model_group,s.target.checked)}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e.model_group}),e.mode&&(0,a.jsx)(m.Z,{color:"green",size:"sm",children:e.mode})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:e.providers.map(e=>(0,a.jsx)(m.Z,{color:"blue",size:"xs",children:e},e))})]})]},e.model_group))})}),x.size>0&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:[(0,a.jsx)("strong",{children:x.size})," model",1!==x.size?"s":""," selected"]})})]})},D=()=>(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(y.Z,{children:"Confirm Making Models Public"}),(0,a.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,a.jsxs)(u.Z,{className:"text-sm text-yellow-800",children:[(0,a.jsx)("strong",{children:"Warning:"})," Once you make these models public, anyone who can go to the"," ",(0,a.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:"Models to be made public:"}),(0,a.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,a.jsx)("div",{className:"space-y-2",children:Array.from(x).map(e=>{let s=r.find(s=>s.model_group===e);return(0,a.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,a.jsxs)("div",{children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e}),s&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:s.providers.map(e=>(0,a.jsx)(m.Z,{color:"blue",size:"xs",children:e},e))})]})},e)})})})]}),(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,a.jsx)("strong",{children:x.size})," model",1!==x.size?"s":""," will be made public"]})})]});return(0,a.jsx)(n.Z,{title:"Make Models Public",open:s,onCancel:C,footer:null,width:1200,maskClosable:!1,children:(0,a.jsxs)(b.Z,{form:Z,layout:"vertical",children:[(0,a.jsxs)(v.default,{current:c,className:"mb-6",children:[(0,a.jsx)(z,{title:"Select Models"}),(0,a.jsx)(z,{title:"Confirm"})]}),(()=>{switch(c){case 0:return L();case 1:return D();default:return null}})(),(0,a.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,a.jsx)(f.ZP,{onClick:0===c?C:()=>{1===c&&o(0)},children:0===c?"Cancel":"Previous"}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[0===c&&(0,a.jsx)(f.ZP,{onClick:()=>{if(0===c){if(0===x.size){k.Z.fromBackend("Please select at least one model to make public");return}o(1)}},disabled:0===x.size,children:"Next"}),1===c&&(0,a.jsx)(f.ZP,{onClick:F,loading:j,children:"Make Public"})]})]})]})})},F=l(8048);let L=e=>e.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),D=e=>Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).map(e=>{let[s]=e;return s}),O=e=>"$".concat((1e6*e).toFixed(2)),K=e=>e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toString(),U=function(e,s){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=[{header:"Public Model Name",accessorKey:"model_group",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium text-sm",children:r.model_group}),(0,a.jsx)(p.Z,{title:"Copy model name",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.model_group),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,a.jsx)("div",{className:"md:hidden",children:(0,a.jsx)(u.Z,{className:"text-xs text-gray-600",children:r.providers.join(", ")})})]})}},{header:"Provider",accessorKey:"providers",enableSorting:!0,sortingFn:(e,s)=>{let l=e.original.providers.join(", "),a=s.original.providers.join(", ");return l.localeCompare(a)},cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.providers.slice(0,2).map(e=>(0,a.jsx)(g.Z,{color:"blue",className:"text-xs",children:e},e)),l.providers.length>2&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",l.providers.length-2]})]})},meta:{className:"hidden md:table-cell"}},{header:"Mode",accessorKey:"mode",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return l.mode?(0,a.jsx)(m.Z,{color:"green",size:"sm",children:l.mode}):(0,a.jsx)(u.Z,{className:"text-gray-500",children:"-"})},meta:{className:"hidden lg:table-cell"}},{header:"Tokens",accessorKey:"max_input_tokens",enableSorting:!0,sortingFn:(e,s)=>(e.original.max_input_tokens||0)+(e.original.max_output_tokens||0)-((s.original.max_input_tokens||0)+(s.original.max_output_tokens||0)),cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)("div",{className:"space-y-1",children:(0,a.jsxs)(u.Z,{className:"text-xs",children:[l.max_input_tokens?K(l.max_input_tokens):"-"," /"," ",l.max_output_tokens?K(l.max_output_tokens):"-"]})})},meta:{className:"hidden lg:table-cell"}},{header:"Cost/1M",accessorKey:"input_cost_per_token",enableSorting:!0,sortingFn:(e,s)=>(e.original.input_cost_per_token||0)+(e.original.output_cost_per_token||0)-((s.original.input_cost_per_token||0)+(s.original.output_cost_per_token||0)),cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(u.Z,{className:"text-xs",children:l.input_cost_per_token?O(l.input_cost_per_token):"-"}),(0,a.jsx)(u.Z,{className:"text-xs text-gray-500",children:l.output_cost_per_token?O(l.output_cost_per_token):"-"})]})}},{header:"Features",accessorKey:"capabilities",enableSorting:!1,cell:e=>{let{row:s}=e,l=D(s.original),t=["green","blue","purple","orange","red","yellow"];return(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:0===l.length?(0,a.jsx)(u.Z,{className:"text-gray-500 text-xs",children:"-"}):l.map((e,s)=>(0,a.jsx)(m.Z,{color:t[s%t.length],size:"xs",children:L(e)},e))})}},{header:"Public",accessorKey:"is_public_model_group",enableSorting:!0,sortingFn:(e,s)=>(!0===e.original.is_public_model_group?1:0)-(!0===s.original.is_public_model_group?1:0),cell:e=>{let{row:s}=e;return!0===s.original.is_public_model_group?(0,a.jsx)(m.Z,{color:"green",size:"xs",children:"Yes"}):(0,a.jsx)(m.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,t=l.original;return(0,a.jsxs)(h.Z,{size:"xs",variant:"secondary",onClick:()=>e(t),icon:j.Z,children:[(0,a.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,a.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}];return l?r.filter(e=>!("accessorKey"in e)||"is_public_model_group"!==e.accessorKey):r};var E=l(87526),T=l(86462),H=l(47686),R=l(77355),B=l(93416),I=l(74998),Y=l(95704),V=e=>{let{accessToken:s,userRole:l}=e,[t,r]=(0,d.useState)([]),[i,c]=(0,d.useState)({url:"",displayName:""}),[o,m]=(0,d.useState)(null),[h,u]=(0,d.useState)(!1),[p,g]=(0,d.useState)(!0),j=async()=>{if(s)try{u(!0);let e=await (0,_.getPublicModelHubInfo)();if(e&&e.useful_links){let s=e.useful_links||{},l=Object.entries(s).map((e,s)=>{let[l,a]=e;return{id:"".concat(s,"-").concat(l),displayName:l,url:a}});r(l)}else r([])}catch(e){console.error("Error fetching useful links:",e),r([])}finally{u(!1)}};if((0,d.useEffect)(()=>{j()},[s]),!(0,x.tY)(l||""))return null;let v=async e=>{if(!s)return!1;try{let l={};return e.forEach(e=>{l[e.displayName]=e.url}),await (0,_.updateUsefulLinksCall)(s,l),n.Z.success({title:"Links Saved Successfully",content:(0,a.jsxs)("div",{className:"py-4",children:[(0,a.jsx)("p",{className:"text-gray-600 mb-4",children:"Your useful links have been saved and are now visible on the public model hub."}),(0,a.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[(0,a.jsx)("p",{className:"text-sm text-blue-800 mb-2 font-medium",children:"View your updated model hub:"}),(0,a.jsx)("a",{href:"".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table"),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-blue-600 hover:text-blue-800 underline text-sm font-medium",children:"Open Public Model Hub →"})]})]}),width:500,okText:"Close",maskClosable:!0,keyboard:!0}),!0}catch(e){return console.error("Error saving links:",e),k.Z.fromBackend("Failed to save links - ".concat(e)),!1}},b=async()=>{if(!i.url||!i.displayName)return;try{new URL(i.url)}catch(e){k.Z.fromBackend("Please enter a valid URL");return}if(t.some(e=>e.displayName===i.displayName)){k.Z.fromBackend("A link with this display name already exists");return}let e=[...t,{id:"".concat(Date.now(),"-").concat(i.displayName),displayName:i.displayName,url:i.url}];await v(e)&&(r(e),c({url:"",displayName:""}),k.Z.success("Link added successfully"))},N=e=>{m({...e})},f=async()=>{if(!o)return;try{new URL(o.url)}catch(e){k.Z.fromBackend("Please enter a valid URL");return}if(t.some(e=>e.id!==o.id&&e.displayName===o.displayName)){k.Z.fromBackend("A link with this display name already exists");return}let e=t.map(e=>e.id===o.id?o:e);await v(e)&&(r(e),m(null),k.Z.success("Link updated successfully"))},y=()=>{m(null)},w=async e=>{let s=t.filter(s=>s.id!==e);await v(s)&&(r(s),k.Z.success("Link deleted successfully"))},Z=e=>{window.open(e,"_blank")};return(0,a.jsxs)(Y.Zb,{className:"mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>g(!p),children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)(Y.Dx,{className:"mb-0",children:"Link Management"}),(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"Manage the links that are displayed under 'Useful Links' on the public model hub."})]}),(0,a.jsx)("div",{className:"flex items-center",children:p?(0,a.jsx)(T.Z,{className:"w-5 h-5 text-gray-500"}):(0,a.jsx)(H.Z,{className:"w-5 h-5 text-gray-500"})})]}),p&&(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)(Y.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Link"}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"URL"}),(0,a.jsx)("input",{type:"text",value:i.url,onChange:e=>c({...i,url:e.target.value}),placeholder:"https://example.com",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Display Name"}),(0,a.jsx)("input",{type:"text",value:i.displayName,onChange:e=>c({...i,displayName:e.target.value}),placeholder:"Friendly name",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsxs)("button",{onClick:b,disabled:!i.url||!i.displayName,className:"flex items-center px-4 py-2 rounded-md text-sm ".concat(i.url&&i.displayName?"bg-green-600 text-white hover:bg-green-700":"bg-gray-300 text-gray-500 cursor-not-allowed"),children:[(0,a.jsx)(R.Z,{className:"w-4 h-4 mr-1"}),"Add Link"]})})]})]}),(0,a.jsx)(Y.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Links"}),(0,a.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)(Y.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,a.jsx)(Y.ss,{children:(0,a.jsxs)(Y.SC,{children:[(0,a.jsx)(Y.xs,{className:"py-1 h-8",children:"Display Name"}),(0,a.jsx)(Y.xs,{className:"py-1 h-8",children:"URL"}),(0,a.jsx)(Y.xs,{className:"py-1 h-8",children:"Actions"})]})}),(0,a.jsxs)(Y.RM,{children:[t.map(e=>(0,a.jsx)(Y.SC,{className:"h-8",children:o&&o.id===e.id?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Y.pj,{className:"py-0.5",children:(0,a.jsx)("input",{type:"text",value:o.displayName,onChange:e=>m({...o,displayName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,a.jsx)(Y.pj,{className:"py-0.5",children:(0,a.jsx)("input",{type:"text",value:o.url,onChange:e=>m({...o,url:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,a.jsx)(Y.pj,{className:"py-0.5 whitespace-nowrap",children:(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:f,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,a.jsx)("button",{onClick:y,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Y.pj,{className:"py-0.5 text-sm text-gray-900",children:e.displayName}),(0,a.jsx)(Y.pj,{className:"py-0.5 text-sm text-gray-500",children:e.url}),(0,a.jsx)(Y.pj,{className:"py-0.5 whitespace-nowrap",children:(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:()=>Z(e.url),className:"text-xs bg-green-50 text-green-600 px-2 py-1 rounded hover:bg-green-100",children:"Use"}),(0,a.jsx)("button",{onClick:()=>N(e),className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,a.jsx)(B.Z,{className:"w-3 h-3"})}),(0,a.jsx)("button",{onClick:()=>w(e.id),className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,a.jsx)(I.Z,{className:"w-3 h-3"})})]})})]})},e.id)),0===t.length&&(0,a.jsx)(Y.SC,{children:(0,a.jsx)(Y.pj,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No links added yet. Add a new link above."})})]})]})})})]})]})},W=e=>{var s,l,v,b;let{accessToken:N,publicPage:f,premiumUser:y,userRole:w}=e,[C,P]=(0,d.useState)(!1),[z,L]=(0,d.useState)(null),[D,O]=(0,d.useState)(!0),[K,T]=(0,d.useState)(!1),[H,R]=(0,d.useState)(!1),[B,I]=(0,d.useState)(null),[Y,W]=(0,d.useState)([]),[q,G]=(0,d.useState)(!1),[J,$]=(0,d.useState)(null),[Q,X]=(0,d.useState)(!1),[ee,es]=(0,d.useState)(!0),[el,ea]=(0,d.useState)(null),[et,er]=(0,d.useState)(!1),[en,ei]=(0,d.useState)(null),[ec,ed]=(0,d.useState)(!0),[eo,ex]=(0,d.useState)(null),[em,eh]=(0,d.useState)(!1),[eu,ep]=(0,d.useState)(!1),eg=(0,c.useRouter)(),ej=(0,d.useRef)(null),ev=(0,d.useRef)(null),eb=(0,d.useRef)(null);(0,d.useEffect)(()=>{let e=async e=>{try{O(!0);let s=await (0,_.modelHubCall)(e);console.log("ModelHubData:",s),L(s.data),(0,_.getConfigFieldSetting)(e,"enable_public_model_hub").then(e=>{console.log("data: ".concat(JSON.stringify(e))),!0==e.field_value&&P(!0)}).catch(e=>{})}catch(e){console.error("There was an error fetching the model data",e)}finally{O(!1)}},s=async()=>{try{var e,s;O(!0),await (0,_.getUiConfig)();let l=await (0,_.modelHubPublicModelsCall)();console.log("ModelHubData:",l),console.log("First model structure:",l[0]),console.log("Model has model_group?",null===(e=l[0])||void 0===e?void 0:e.model_group),console.log("Model has providers?",null===(s=l[0])||void 0===s?void 0:s.providers),L(l),P(!0)}catch(e){console.error("There was an error fetching the public model data",e)}finally{O(!1)}};N?e(N):f&&s()},[N,f]),(0,d.useEffect)(()=>{let e=async()=>{if(N)try{es(!0);let e=await (0,_.getAgentsList)(N);console.log("AgentHubData:",e);let s=e.agents.map(e=>({agent_id:e.agent_id,...e.agent_card_params,is_public:e.litellm_params.is_public}));$(s)}catch(e){console.error("There was an error fetching the agent data",e)}finally{es(!1)}};f||e()},[f,N]),(0,d.useEffect)(()=>{let e=async()=>{if(N)try{ed(!0);let e=await (0,_.fetchMCPServers)(N);console.log("MCPHubData:",e),ei(e)}catch(e){console.error("There was an error fetching the MCP server data",e)}finally{ed(!1)}};f||e()},[f,N]);let eN=()=>{N&&G(!0)},ef=()=>{N&&X(!0)},ey=()=>{N&&ep(!0)},e_=()=>{T(!1),R(!1),I(null),er(!1),ea(null),eh(!1),ex(null)},ek=()=>{T(!1),R(!1),I(null),er(!1),ea(null),eh(!1),ex(null)},ew=e=>{navigator.clipboard.writeText(e),k.Z.success("Copied to clipboard!")},eZ=e=>e.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),eC=e=>Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).map(e=>{let[s]=e;return s}),eS=e=>"$".concat((1e6*e).toFixed(2)),eP=(0,d.useCallback)(e=>{W(e)},[]);return(console.log("publicPage: ",f),console.log("publicPageAllowed: ",C),f&&C)?(0,a.jsx)(E.Z,{accessToken:N}):(0,a.jsxs)("div",{className:"w-full mx-4 h-[75vh]",children:[!1==f?(0,a.jsxs)("div",{className:"w-full m-2 mt-2 p-8",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,a.jsxs)("div",{className:"flex flex-col items-start",children:[(0,a.jsx)(r.Dx,{className:"text-center",children:"AI Hub"}),(0,x.tY)(w||"")?(0,a.jsx)("p",{className:"text-sm text-gray-600",children:"Make models, agents, and MCP servers public for developers to know what's available."}):(0,a.jsx)("p",{className:"text-sm text-gray-600",children:"A list of all public model names personally available to you."})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,a.jsx)(r.xv,{children:"Model Hub URL:"}),(0,a.jsxs)("div",{className:"flex items-center bg-gray-200 px-2 py-1 rounded",children:[(0,a.jsx)(r.xv,{className:"mr-2",children:"".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table")}),(0,a.jsx)("button",{onClick:()=>ew("".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table")),className:"p-1 hover:bg-gray-300 rounded transition-colors",title:"Copy URL",children:(0,a.jsx)(i.Z,{size:16,className:"text-gray-600"})})]})]})]}),(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"mt-8 mb-2",children:(0,a.jsx)(V,{accessToken:N,userRole:w})}),(0,a.jsxs)(r.v0,{children:[(0,a.jsxs)(r.td,{className:"mb-4",children:[(0,a.jsx)(r.OK,{children:"Model Hub"}),(0,a.jsx)(r.OK,{children:"Agent Hub"}),(0,a.jsx)(r.OK,{children:"MCP Hub"})]}),(0,a.jsxs)(r.nP,{children:[(0,a.jsxs)(r.x4,{children:[(0,a.jsxs)(r.Zb,{children:[!1==f&&(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"flex justify-end mb-4",children:(0,a.jsx)(r.zx,{onClick:()=>eN(),children:"Select Models to Make Public"})}),(0,a.jsx)(M,{modelHubData:z||[],onFilteredDataChange:eP}),(0,a.jsx)(F.C,{columns:U(e=>{I(e),T(!0)},ew,f),data:Y,isLoading:D,table:ej,defaultSorting:[{id:"model_group",desc:!1}]})]}),(0,a.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,a.jsxs)(r.xv,{className:"text-sm text-gray-600",children:["Showing ",Y.length," of ",(null==z?void 0:z.length)||0," models"]})})]}),(0,a.jsxs)(r.x4,{children:[(0,a.jsxs)(r.Zb,{children:[!1==f&&(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"flex justify-end mb-4",children:(0,a.jsx)(r.zx,{onClick:()=>ef(),children:"Select Agents to Make Public"})}),(0,a.jsx)(F.C,{columns:function(e,s){return arguments.length>2&&void 0!==arguments[2]&&arguments[2],[{header:"Agent Name",accessorKey:"name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium text-sm",children:r.name}),(0,a.jsx)(p.Z,{title:"Copy agent name",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.name),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,a.jsx)("div",{className:"md:hidden",children:(0,a.jsx)(u.Z,{className:"text-xs text-gray-600",children:r.description})})]})}},{header:"Description",accessorKey:"description",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs line-clamp-2",children:l.description||"-"})},meta:{className:"hidden md:table-cell"}},{header:"Version",accessorKey:"version",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsxs)(m.Z,{color:"blue",size:"sm",children:["v",l.version]})},meta:{className:"hidden lg:table-cell"}},{header:"Protocol",accessorKey:"protocolVersion",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs",children:l.protocolVersion||"-"})},meta:{className:"hidden lg:table-cell"}},{header:"Skills",accessorKey:"skills",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original.skills||[];return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(u.Z,{className:"text-xs font-medium",children:[l.length," skill",1!==l.length?"s":""]}),l.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.slice(0,2).map(e=>(0,a.jsx)(g.Z,{color:"purple",className:"text-xs",children:e.name},e.id)),l.length>2&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",l.length-2]})]})]})}},{header:"Capabilities",accessorKey:"capabilities",enableSorting:!1,cell:e=>{let{row:s}=e,l=Object.entries(s.original.capabilities||{}).filter(e=>{let[s,l]=e;return!0===l}).map(e=>{let[s]=e;return s});return(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:0===l.length?(0,a.jsx)(u.Z,{className:"text-gray-500 text-xs",children:"-"}):l.map(e=>(0,a.jsx)(m.Z,{color:"green",size:"xs",children:e},e))})}},{header:"I/O Modes",accessorKey:"defaultInputModes",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original,t=l.defaultInputModes||[],r=l.defaultOutputModes||[];return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(u.Z,{className:"text-xs",children:[(0,a.jsx)("span",{className:"font-medium",children:"In:"})," ",t.join(", ")||"-"]}),(0,a.jsxs)(u.Z,{className:"text-xs",children:[(0,a.jsx)("span",{className:"font-medium",children:"Out:"})," ",r.join(", ")||"-"]})]})},meta:{className:"hidden xl:table-cell"}},{header:"Public",accessorKey:"is_public",enableSorting:!0,sortingFn:(e,s)=>(!0===e.original.is_public?1:0)-(!0===s.original.is_public?1:0),cell:e=>{let{row:s}=e;return console.log("CHECKPOINT 1: ".concat(JSON.stringify(s.original))),!0===s.original.is_public?(0,a.jsx)(m.Z,{color:"green",size:"xs",children:"Yes"}):(0,a.jsx)(m.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,t=l.original;return(0,a.jsxs)(h.Z,{size:"xs",variant:"secondary",onClick:()=>e(t),icon:j.Z,children:[(0,a.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,a.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}]}(e=>{ea(e),er(!0)},ew,f),data:J||[],isLoading:ee,table:ev,defaultSorting:[{id:"name",desc:!1}]})]}),(0,a.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,a.jsxs)(r.xv,{className:"text-sm text-gray-600",children:["Showing ",(null==J?void 0:J.length)||0," agent",(null==J?void 0:J.length)!==1?"s":""]})})]}),(0,a.jsxs)(r.x4,{children:[(0,a.jsxs)(r.Zb,{children:[!1==f&&(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"flex justify-end mb-4",children:(0,a.jsx)(r.zx,{onClick:()=>ey(),children:"Select MCP Servers to Make Public"})}),(0,a.jsx)(F.C,{columns:function(e,s){return arguments.length>2&&void 0!==arguments[2]&&arguments[2],[{header:"Server Name",accessorKey:"server_name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium text-sm",children:r.server_name}),(0,a.jsx)(p.Z,{title:"Copy server name",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.server_name),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,a.jsx)("div",{className:"md:hidden",children:(0,a.jsx)(u.Z,{className:"text-xs text-gray-600",children:r.description||"-"})})]})}},{header:"Description",accessorKey:"description",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs line-clamp-2",children:l.description||"-"})},meta:{className:"hidden md:table-cell"}},{header:"URL",accessorKey:"url",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"text-xs truncate max-w-xs",children:r.url}),(0,a.jsx)(p.Z,{title:"Copy URL",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.url),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs flex-shrink-0"})})]})},meta:{className:"hidden lg:table-cell"}},{header:"Transport",accessorKey:"transport",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(m.Z,{color:"blue",size:"sm",children:l.transport})},meta:{className:"hidden md:table-cell"}},{header:"Auth Type",accessorKey:"auth_type",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original,t="none"===l.auth_type?"gray":"green";return(0,a.jsx)(m.Z,{color:t,size:"sm",children:l.auth_type})},meta:{className:"hidden md:table-cell"}},{header:"Status",accessorKey:"status",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original,t={active:"green",inactive:"red",unknown:"gray",healthy:"green",unhealthy:"red"}[l.status]||"gray";return(0,a.jsx)(m.Z,{color:t,size:"sm",children:l.status||"unknown"})}},{header:"Tools",accessorKey:"allowed_tools",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original.allowed_tools||[];return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(u.Z,{className:"text-xs font-medium",children:l.length>0?"".concat(l.length," tool").concat(1!==l.length?"s":""):"All tools"}),l.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.slice(0,2).map((e,s)=>(0,a.jsx)(g.Z,{color:"purple",className:"text-xs",children:e},s)),l.length>2&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",l.length-2]})]})]})},meta:{className:"hidden lg:table-cell"}},{header:"Created By",accessorKey:"created_by",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs",children:l.created_by||"-"})},meta:{className:"hidden xl:table-cell"}},{header:"Public",accessorKey:"mcp_info.is_public",enableSorting:!0,sortingFn:(e,s)=>{var l,a;return((null===(l=e.original.mcp_info)||void 0===l?void 0:l.is_public)===!0?1:0)-((null===(a=s.original.mcp_info)||void 0===a?void 0:a.is_public)===!0?1:0)},cell:e=>{var s;let{row:l}=e;return(null===(s=l.original.mcp_info)||void 0===s?void 0:s.is_public)===!0?(0,a.jsx)(m.Z,{color:"green",size:"xs",children:"Yes"}):(0,a.jsx)(m.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,t=l.original;return(0,a.jsxs)(h.Z,{size:"xs",variant:"secondary",onClick:()=>e(t),icon:j.Z,children:[(0,a.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,a.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}]}(e=>{ex(e),eh(!0)},ew,f),data:en||[],isLoading:ec,table:eb,defaultSorting:[{id:"server_name",desc:!1}]})]}),(0,a.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,a.jsxs)(r.xv,{className:"text-sm text-gray-600",children:["Showing ",(null==en?void 0:en.length)||0," MCP server",(null==en?void 0:en.length)!==1?"s":""]})})]})]})]})]}):(0,a.jsxs)(r.Zb,{className:"mx-auto max-w-xl mt-10",children:[(0,a.jsx)(r.xv,{className:"text-xl text-center mb-2 text-black",children:"Public Model Hub not enabled."}),(0,a.jsx)("p",{className:"text-base text-center text-slate-800",children:"Ask your proxy admin to enable this on their Admin UI."})]}),(0,a.jsx)(n.Z,{title:"Public Model Hub",width:600,visible:H,footer:null,onOk:e_,onCancel:ek,children:(0,a.jsxs)("div",{className:"pt-5 pb-5",children:[(0,a.jsxs)("div",{className:"flex justify-between mb-4",children:[(0,a.jsx)(r.xv,{className:"text-base mr-2",children:"Shareable Link:"}),(0,a.jsx)(r.xv,{className:"max-w-sm ml-2 bg-gray-200 pr-2 pl-2 pt-1 pb-1 text-center rounded",children:"".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table")})]}),(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsx)(r.zx,{onClick:()=>{eg.replace("/model_hub_table?key=".concat(N))},children:"See Page"})})]})}),(0,a.jsx)(n.Z,{title:(null==B?void 0:B.model_group)||"Model Details",width:1e3,visible:K,footer:null,onOk:e_,onCancel:ek,children:B&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Model Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Model Group:"}),(0,a.jsx)(r.xv,{children:B.model_group})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Mode:"}),(0,a.jsx)(r.xv,{children:B.mode||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Providers:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:B.providers.map(e=>(0,a.jsx)(r.Ct,{color:"blue",children:e},e))})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Token & Cost Information"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Max Input Tokens:"}),(0,a.jsx)(r.xv,{children:(null===(s=B.max_input_tokens)||void 0===s?void 0:s.toLocaleString())||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Max Output Tokens:"}),(0,a.jsx)(r.xv,{children:(null===(l=B.max_output_tokens)||void 0===l?void 0:l.toLocaleString())||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Input Cost per 1M Tokens:"}),(0,a.jsx)(r.xv,{children:B.input_cost_per_token?eS(B.input_cost_per_token):"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Output Cost per 1M Tokens:"}),(0,a.jsx)(r.xv,{children:B.output_cost_per_token?eS(B.output_cost_per_token):"Not specified"})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Capabilities"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:(()=>{let e=eC(B),s=["green","blue","purple","orange","red","yellow"];return 0===e.length?(0,a.jsx)(r.xv,{className:"text-gray-500",children:"No special capabilities listed"}):e.map((e,l)=>(0,a.jsx)(r.Ct,{color:s[l%s.length],children:eZ(e)},e))})()})]}),(B.tpm||B.rpm)&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Rate Limits"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[B.tpm&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Tokens per Minute:"}),(0,a.jsx)(r.xv,{children:B.tpm.toLocaleString()})]}),B.rpm&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Requests per Minute:"}),(0,a.jsx)(r.xv,{children:B.rpm.toLocaleString()})]})]})]}),B.supported_openai_params&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Supported OpenAI Parameters"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:B.supported_openai_params.map(e=>(0,a.jsx)(r.Ct,{color:"green",children:e},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Usage Example"}),(0,a.jsx)(o.Z,{language:"python",className:"text-sm",children:'import openai\n\nclient = openai.OpenAI(\n api_key="your_api_key",\n base_url="http://0.0.0.0:4000" # Your LiteLLM Proxy URL\n)\n\nresponse = client.chat.completions.create(\n model="'.concat(B.model_group,'",\n messages=[\n {\n "role": "user",\n "content": "Hello, how are you?"\n }\n ]\n)\n\nprint(response.choices[0].message.content)')})]})]})}),(0,a.jsx)(n.Z,{title:(null==el?void 0:el.name)||"Agent Details",width:1e3,visible:et,footer:null,onOk:e_,onCancel:ek,children:el&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Agent Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Name:"}),(0,a.jsx)(r.xv,{children:el.name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Version:"}),(0,a.jsxs)(r.Ct,{color:"blue",children:["v",el.version]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Protocol Version:"}),(0,a.jsx)(r.xv,{children:el.protocolVersion})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"URL:"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(r.xv,{className:"truncate",children:el.url}),(0,a.jsx)(t.Z,{onClick:()=>ew(el.url),className:"cursor-pointer text-gray-500 hover:text-blue-500"})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Description:"}),(0,a.jsx)(r.xv,{className:"mt-1",children:el.description})]})]}),el.capabilities&&Object.keys(el.capabilities).length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Capabilities"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(el.capabilities).filter(e=>{let[s,l]=e;return!0===l}).map(e=>{let[s]=e;return(0,a.jsx)(r.Ct,{color:"green",children:s},s)})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Input/Output Modes"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Input Modes:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:(null===(v=el.defaultInputModes)||void 0===v?void 0:v.map(e=>(0,a.jsx)(r.Ct,{color:"blue",children:e},e)))||(0,a.jsx)(r.xv,{children:"Not specified"})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Output Modes:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:(null===(b=el.defaultOutputModes)||void 0===b?void 0:b.map(e=>(0,a.jsx)(r.Ct,{color:"purple",children:e},e)))||(0,a.jsx)(r.xv,{children:"Not specified"})})]})]})]}),el.skills&&el.skills.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Skills"}),(0,a.jsx)("div",{className:"space-y-4",children:el.skills.map(e=>(0,a.jsxs)("div",{className:"border border-gray-200 rounded p-4",children:[(0,a.jsxs)("div",{className:"flex justify-between items-start mb-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium text-base",children:e.name}),(0,a.jsxs)(r.xv,{className:"text-xs text-gray-500",children:["ID: ",e.id]})]}),e.tags&&e.tags.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:e.tags.map(e=>(0,a.jsx)(r.Ct,{color:"purple",size:"xs",children:e},e))})]}),(0,a.jsx)(r.xv,{className:"text-sm mb-2",children:e.description}),e.examples&&e.examples.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-xs font-medium text-gray-700",children:"Examples:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:e.examples.map((e,s)=>(0,a.jsx)(r.Ct,{color:"gray",size:"xs",children:e},s))})]})]},e.id))})]}),el.supportsAuthenticatedExtendedCard&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Additional Features"}),(0,a.jsx)(r.Ct,{color:"green",children:"Supports Authenticated Extended Card"})]})]})}),(0,a.jsx)(n.Z,{title:(null==eo?void 0:eo.server_name)||"MCP Server Details",width:1e3,visible:em,footer:null,onOk:e_,onCancel:ek,children:eo&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Server Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Server Name:"}),(0,a.jsx)(r.xv,{children:eo.server_name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Server ID:"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(r.xv,{className:"text-xs truncate",children:eo.server_id}),(0,a.jsx)(t.Z,{onClick:()=>ew(eo.server_id),className:"cursor-pointer text-gray-500 hover:text-blue-500"})]})]}),eo.alias&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Alias:"}),(0,a.jsx)(r.xv,{children:eo.alias})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Transport:"}),(0,a.jsx)(r.Ct,{color:"blue",children:eo.transport})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Auth Type:"}),(0,a.jsx)(r.Ct,{color:"none"===eo.auth_type?"gray":"green",children:eo.auth_type})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Status:"}),(0,a.jsx)(r.Ct,{color:"active"===eo.status||"healthy"===eo.status?"green":"inactive"===eo.status||"unhealthy"===eo.status?"red":"gray",children:eo.status||"unknown"})]})]}),eo.description&&(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Description:"}),(0,a.jsx)(r.xv,{className:"mt-1",children:eo.description})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Connection Details"}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"URL:"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2 mt-1",children:[(0,a.jsx)(r.xv,{className:"text-sm break-all bg-gray-100 p-2 rounded flex-1",children:eo.url}),(0,a.jsx)(t.Z,{onClick:()=>ew(eo.url),className:"cursor-pointer text-gray-500 hover:text-blue-500 flex-shrink-0"})]})]}),eo.command&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Command:"}),(0,a.jsx)(r.xv,{className:"text-sm bg-gray-100 p-2 rounded mt-1 font-mono",children:eo.command})]})]})]}),eo.allowed_tools&&eo.allowed_tools.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Allowed Tools"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.allowed_tools.map((e,s)=>(0,a.jsx)(r.Ct,{color:"purple",children:e},s))})]}),eo.teams&&eo.teams.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Teams"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.teams.map((e,s)=>(0,a.jsx)(r.Ct,{color:"blue",children:e},s))})]}),eo.mcp_access_groups&&eo.mcp_access_groups.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Access Groups"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.mcp_access_groups.map((e,s)=>(0,a.jsx)(r.Ct,{color:"green",children:e},s))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Metadata"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Created By:"}),(0,a.jsx)(r.xv,{children:eo.created_by})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Updated By:"}),(0,a.jsx)(r.xv,{children:eo.updated_by})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Created At:"}),(0,a.jsx)(r.xv,{className:"text-sm",children:new Date(eo.created_at).toLocaleString()})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Updated At:"}),(0,a.jsx)(r.xv,{className:"text-sm",children:new Date(eo.updated_at).toLocaleString()})]}),eo.last_health_check&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Last Health Check:"}),(0,a.jsx)(r.xv,{className:"text-sm",children:new Date(eo.last_health_check).toLocaleString()})]})]}),eo.health_check_error&&(0,a.jsxs)("div",{className:"mt-2 p-2 bg-red-50 rounded",children:[(0,a.jsx)(r.xv,{className:"font-medium text-red-700",children:"Health Check Error:"}),(0,a.jsx)(r.xv,{className:"text-sm text-red-600 mt-1",children:eo.health_check_error})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Usage Example"}),(0,a.jsx)(o.Z,{language:"python",className:"text-sm",children:'from fastmcp import Client\nimport asyncio\n\n# Standard MCP configuration\nconfig = {\n "mcpServers": {\n "'.concat(eo.server_name,'": {\n "url": "http://localhost:4000/').concat(eo.server_name,'/mcp",\n "headers": {\n "x-litellm-api-key": "Bearer sk-1234"\n }\n }\n }\n}\n\n# Create a client that connects to the server\nclient = Client(config)\n\nasync def main():\n async with client:\n # List available tools\n tools = await client.list_tools()\n print(f"Available tools: {[tool.name for tool in tools]}")\n\n # Call a tool\n response = await client.call_tool(\n name="tool_name", \n arguments={"arg": "value"}\n )\n print(f"Response: {response}")\n\nif __name__ == "__main__":\n asyncio.run(main())')})]})]})}),(0,a.jsx)(A,{visible:q,onClose:()=>G(!1),accessToken:N||"",modelHubData:z||[],onSuccess:()=>{N&&(async()=>{try{let e=await (0,_.modelHubCall)(N);L(e.data)}catch(e){console.error("Error refreshing model data:",e)}})()}}),(0,a.jsx)(Z,{visible:Q,onClose:()=>X(!1),accessToken:N||"",agentHubData:J||[],onSuccess:()=>{N&&(async()=>{try{let e=(await (0,_.getAgentsList)(N)).agents.map(e=>({agent_id:e.agent_id,...e.agent_card_params,is_public:e.is_public}));$(e)}catch(e){console.error("Error refreshing agent data:",e)}})()}}),(0,a.jsx)(S,{visible:eu,onClose:()=>ep(!1),accessToken:N||"",mcpHubData:en||[],onSuccess:()=>{N&&(async()=>{try{let e=await (0,_.fetchMCPServers)(N);ei(e)}catch(e){console.error("Error refreshing MCP server data:",e)}})()}})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2273-c902438b7579c117.js b/litellm/proxy/_experimental/out/_next/static/chunks/2273-fdf410d28cc9d394.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/chunks/2273-c902438b7579c117.js rename to litellm/proxy/_experimental/out/_next/static/chunks/2273-fdf410d28cc9d394.js diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2409-79fdc0573d81b0e4.js b/litellm/proxy/_experimental/out/_next/static/chunks/2409-e94c05c6f11bb939.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/chunks/2409-79fdc0573d81b0e4.js rename to litellm/proxy/_experimental/out/_next/static/chunks/2409-e94c05c6f11bb939.js diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/3163-8b2c3b9e10ac4f04.js b/litellm/proxy/_experimental/out/_next/static/chunks/3163-e261e5767e016074.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/3163-8b2c3b9e10ac4f04.js rename to litellm/proxy/_experimental/out/_next/static/chunks/3163-e261e5767e016074.js index 9bfb311285..2c0cb1eb7e 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/3163-8b2c3b9e10ac4f04.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/3163-e261e5767e016074.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3163],{15327:function(e,o,r){r.d(o,{Z:function(){return a}});var n=r(1119),t=r(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},l=r(55015),a=t.forwardRef(function(e,o){return t.createElement(l.Z,(0,n.Z)({},e,{ref:o,icon:c}))})},3632:function(e,o,r){r.d(o,{Z:function(){return a}});var n=r(1119),t=r(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},l=r(55015),a=t.forwardRef(function(e,o){return t.createElement(l.Z,(0,n.Z)({},e,{ref:o,icon:c}))})},15883:function(e,o,r){r.d(o,{Z:function(){return a}});var n=r(1119),t=r(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M858.5 763.6a374 374 0 00-80.6-119.5 375.63 375.63 0 00-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 00-80.6 119.5A371.7 371.7 0 00136 901.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 008-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z"}}]},name:"user",theme:"outlined"},l=r(55015),a=t.forwardRef(function(e,o){return t.createElement(l.Z,(0,n.Z)({},e,{ref:o,icon:c}))})},67101:function(e,o,r){r.d(o,{Z:function(){return d}});var n=r(5853),t=r(13241),c=r(1153),l=r(2265),a=r(9496);let s=(0,c.fn)("Grid"),i=(e,o)=>e&&Object.keys(o).includes(String(e))?o[e]:"",d=l.forwardRef((e,o)=>{let{numItems:r=1,numItemsSm:c,numItemsMd:d,numItemsLg:u,children:g,className:m}=e,p=(0,n._T)(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),f=i(r,a._m),h=i(c,a.LH),b=i(d,a.l5),v=i(u,a.N4),k=(0,t.q)(f,h,b,v);return l.createElement("div",Object.assign({ref:o,className:(0,t.q)(s("root"),"grid",k,m)},p),g)});d.displayName="Grid"},9496:function(e,o,r){r.d(o,{LH:function(){return t},N4:function(){return l},PT:function(){return a},SP:function(){return s},VS:function(){return i},_m:function(){return n},_w:function(){return d},l5:function(){return c}});let n={0:"grid-cols-none",1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8",9:"grid-cols-9",10:"grid-cols-10",11:"grid-cols-11",12:"grid-cols-12"},t={0:"sm:grid-cols-none",1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6",7:"sm:grid-cols-7",8:"sm:grid-cols-8",9:"sm:grid-cols-9",10:"sm:grid-cols-10",11:"sm:grid-cols-11",12:"sm:grid-cols-12"},c={0:"md:grid-cols-none",1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-7",8:"md:grid-cols-8",9:"md:grid-cols-9",10:"md:grid-cols-10",11:"md:grid-cols-11",12:"md:grid-cols-12"},l={0:"lg:grid-cols-none",1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6",7:"lg:grid-cols-7",8:"lg:grid-cols-8",9:"lg:grid-cols-9",10:"lg:grid-cols-10",11:"lg:grid-cols-11",12:"lg:grid-cols-12"},a={1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12",13:"col-span-13"},s={1:"sm:col-span-1",2:"sm:col-span-2",3:"sm:col-span-3",4:"sm:col-span-4",5:"sm:col-span-5",6:"sm:col-span-6",7:"sm:col-span-7",8:"sm:col-span-8",9:"sm:col-span-9",10:"sm:col-span-10",11:"sm:col-span-11",12:"sm:col-span-12",13:"sm:col-span-13"},i={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12",13:"md:col-span-13"},d={1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12",13:"lg:col-span-13"}},3810:function(e,o,r){r.d(o,{Z:function(){return N}});var n=r(2265),t=r(36760),c=r.n(t),l=r(18694),a=r(93350),s=r(53445),i=r(19722),d=r(6694),u=r(71744),g=r(93463),m=r(54558),p=r(12918),f=r(71140),h=r(99320);let b=e=>{let{paddingXXS:o,lineWidth:r,tagPaddingHorizontal:n,componentCls:t,calc:c}=e,l=c(n).sub(r).equal(),a=c(o).sub(r).equal();return{[t]:Object.assign(Object.assign({},(0,p.Wf)(e)),{display:"inline-block",height:"auto",marginInlineEnd:e.marginXS,paddingInline:l,fontSize:e.tagFontSize,lineHeight:e.tagLineHeight,whiteSpace:"nowrap",background:e.defaultBg,border:"".concat((0,g.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderRadius:e.borderRadiusSM,opacity:1,transition:"all ".concat(e.motionDurationMid),textAlign:"start",position:"relative",["&".concat(t,"-rtl")]:{direction:"rtl"},"&, a, a:hover":{color:e.defaultColor},["".concat(t,"-close-icon")]:{marginInlineStart:a,fontSize:e.tagIconSize,color:e.colorIcon,cursor:"pointer",transition:"all ".concat(e.motionDurationMid),"&:hover":{color:e.colorTextHeading}},["&".concat(t,"-has-color")]:{borderColor:"transparent",["&, a, a:hover, ".concat(e.iconCls,"-close, ").concat(e.iconCls,"-close:hover")]:{color:e.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",["&:not(".concat(t,"-checkable-checked):hover")]:{color:e.colorPrimary,backgroundColor:e.colorFillSecondary},"&:active, &-checked":{color:e.colorTextLightSolid},"&-checked":{backgroundColor:e.colorPrimary,"&:hover":{backgroundColor:e.colorPrimaryHover}},"&:active":{backgroundColor:e.colorPrimaryActive}},"&-hidden":{display:"none"},["> ".concat(e.iconCls," + span, > span + ").concat(e.iconCls)]:{marginInlineStart:l}}),["".concat(t,"-borderless")]:{borderColor:"transparent",background:e.tagBorderlessBg}}},v=e=>{let{lineWidth:o,fontSizeIcon:r,calc:n}=e,t=e.fontSizeSM;return(0,f.IX)(e,{tagFontSize:t,tagLineHeight:(0,g.bf)(n(e.lineHeightSM).mul(t).equal()),tagIconSize:n(r).sub(n(o).mul(2)).equal(),tagPaddingHorizontal:8,tagBorderlessBg:e.defaultBg})},k=e=>({defaultBg:new m.t(e.colorFillQuaternary).onBackground(e.colorBgContainer).toHexString(),defaultColor:e.colorText});var w=(0,h.I$)("Tag",e=>b(v(e)),k),C=function(e,o){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>o.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var t=0,n=Object.getOwnPropertySymbols(e);to.indexOf(n[t])&&Object.prototype.propertyIsEnumerable.call(e,n[t])&&(r[n[t]]=e[n[t]]);return r};let y=n.forwardRef((e,o)=>{let{prefixCls:r,style:t,className:l,checked:a,children:s,icon:i,onChange:d,onClick:g}=e,m=C(e,["prefixCls","style","className","checked","children","icon","onChange","onClick"]),{getPrefixCls:p,tag:f}=n.useContext(u.E_),h=p("tag",r),[b,v,k]=w(h),y=c()(h,"".concat(h,"-checkable"),{["".concat(h,"-checkable-checked")]:a},null==f?void 0:f.className,l,v,k);return b(n.createElement("span",Object.assign({},m,{ref:o,style:Object.assign(Object.assign({},t),null==f?void 0:f.style),className:y,onClick:e=>{null==d||d(!a),null==g||g(e)}}),i,n.createElement("span",null,s)))});var x=r(18536);let E=e=>(0,x.Z)(e,(o,r)=>{let{textColor:n,lightBorderColor:t,lightColor:c,darkColor:l}=r;return{["".concat(e.componentCls).concat(e.componentCls,"-").concat(o)]:{color:n,background:c,borderColor:t,"&-inverse":{color:e.colorTextLightSolid,background:l,borderColor:l},["&".concat(e.componentCls,"-borderless")]:{borderColor:"transparent"}}}});var O=(0,h.bk)(["Tag","preset"],e=>E(v(e)),k);let S=(e,o,r)=>{let n="string"!=typeof r?r:r.charAt(0).toUpperCase()+r.slice(1);return{["".concat(e.componentCls).concat(e.componentCls,"-").concat(o)]:{color:e["color".concat(r)],background:e["color".concat(n,"Bg")],borderColor:e["color".concat(n,"Border")],["&".concat(e.componentCls,"-borderless")]:{borderColor:"transparent"}}}};var j=(0,h.bk)(["Tag","status"],e=>{let o=v(e);return[S(o,"success","Success"),S(o,"processing","Info"),S(o,"error","Error"),S(o,"warning","Warning")]},k),L=function(e,o){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>o.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var t=0,n=Object.getOwnPropertySymbols(e);to.indexOf(n[t])&&Object.prototype.propertyIsEnumerable.call(e,n[t])&&(r[n[t]]=e[n[t]]);return r};let Z=n.forwardRef((e,o)=>{let{prefixCls:r,className:t,rootClassName:g,style:m,children:p,icon:f,color:h,onClose:b,bordered:v=!0,visible:k}=e,C=L(e,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:y,direction:x,tag:E}=n.useContext(u.E_),[S,Z]=n.useState(!0),N=(0,l.Z)(C,["closeIcon","closable"]);n.useEffect(()=>{void 0!==k&&Z(k)},[k]);let B=(0,a.o2)(h),I=(0,a.yT)(h),M=B||I,R=Object.assign(Object.assign({backgroundColor:h&&!M?h:void 0},null==E?void 0:E.style),m),z=y("tag",r),[P,T,H]=w(z),W=c()(z,null==E?void 0:E.className,{["".concat(z,"-").concat(h)]:M,["".concat(z,"-has-color")]:h&&!M,["".concat(z,"-hidden")]:!S,["".concat(z,"-rtl")]:"rtl"===x,["".concat(z,"-borderless")]:!v},t,g,T,H),_=e=>{e.stopPropagation(),null==b||b(e),e.defaultPrevented||Z(!1)},[,A]=(0,s.b)((0,s.w)(e),(0,s.w)(E),{closable:!1,closeIconRender:e=>{let o=n.createElement("span",{className:"".concat(z,"-close-icon"),onClick:_},e);return(0,i.wm)(e,o,e=>({onClick:o=>{var r;null===(r=null==e?void 0:e.onClick)||void 0===r||r.call(e,o),_(o)},className:c()(null==e?void 0:e.className,"".concat(z,"-close-icon"))}))}}),V="function"==typeof C.onClick||p&&"a"===p.type,q=f||null,F=q?n.createElement(n.Fragment,null,q,p&&n.createElement("span",null,p)):p,U=n.createElement("span",Object.assign({},N,{ref:o,className:W,style:R}),F,A,B&&n.createElement(O,{key:"preset",prefixCls:z}),I&&n.createElement(j,{key:"status",prefixCls:z}));return P(V?n.createElement(d.Z,{component:"Tag"},U):U)});Z.CheckableTag=y;var N=Z},79205:function(e,o,r){r.d(o,{Z:function(){return u}});var n=r(2265);let t=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),c=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,o,r)=>r?r.toUpperCase():o.toLowerCase()),l=e=>{let o=c(e);return o.charAt(0).toUpperCase()+o.slice(1)},a=function(){for(var e=arguments.length,o=Array(e),r=0;r!!e&&""!==e.trim()&&r.indexOf(e)===o).join(" ").trim()},s=e=>{for(let o in e)if(o.startsWith("aria-")||"role"===o||"title"===o)return!0};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let d=(0,n.forwardRef)((e,o)=>{let{color:r="currentColor",size:t=24,strokeWidth:c=2,absoluteStrokeWidth:l,className:d="",children:u,iconNode:g,...m}=e;return(0,n.createElement)("svg",{ref:o,...i,width:t,height:t,stroke:r,strokeWidth:l?24*Number(c)/Number(t):c,className:a("lucide",d),...!u&&!s(m)&&{"aria-hidden":"true"},...m},[...g.map(e=>{let[o,r]=e;return(0,n.createElement)(o,r)}),...Array.isArray(u)?u:[u]])}),u=(e,o)=>{let r=(0,n.forwardRef)((r,c)=>{let{className:s,...i}=r;return(0,n.createElement)(d,{ref:c,iconNode:o,className:a("lucide-".concat(t(l(e))),"lucide-".concat(e),s),...i})});return r.displayName=l(e),r}},30401:function(e,o,r){r.d(o,{Z:function(){return n}});let n=(0,r(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},78867:function(e,o,r){r.d(o,{Z:function(){return n}});let n=(0,r(79205).Z)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},77331:function(e,o,r){var n=r(2265);let t=n.forwardRef(function(e,o){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:o},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});o.Z=t},86462:function(e,o,r){var n=r(2265);let t=n.forwardRef(function(e,o){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:o},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});o.Z=t},44633:function(e,o,r){var n=r(2265);let t=n.forwardRef(function(e,o){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:o},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});o.Z=t},93416:function(e,o,r){var n=r(2265);let t=n.forwardRef(function(e,o){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:o},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});o.Z=t},49084:function(e,o,r){var n=r(2265);let t=n.forwardRef(function(e,o){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:o},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});o.Z=t}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3163],{15327:function(e,o,r){r.d(o,{Z:function(){return a}});var n=r(1119),t=r(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},l=r(55015),a=t.forwardRef(function(e,o){return t.createElement(l.Z,(0,n.Z)({},e,{ref:o,icon:c}))})},3632:function(e,o,r){r.d(o,{Z:function(){return a}});var n=r(1119),t=r(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},l=r(55015),a=t.forwardRef(function(e,o){return t.createElement(l.Z,(0,n.Z)({},e,{ref:o,icon:c}))})},15883:function(e,o,r){r.d(o,{Z:function(){return a}});var n=r(1119),t=r(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M858.5 763.6a374 374 0 00-80.6-119.5 375.63 375.63 0 00-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 00-80.6 119.5A371.7 371.7 0 00136 901.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 008-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z"}}]},name:"user",theme:"outlined"},l=r(55015),a=t.forwardRef(function(e,o){return t.createElement(l.Z,(0,n.Z)({},e,{ref:o,icon:c}))})},67101:function(e,o,r){r.d(o,{Z:function(){return d}});var n=r(5853),t=r(13241),c=r(1153),l=r(2265),a=r(9496);let s=(0,c.fn)("Grid"),i=(e,o)=>e&&Object.keys(o).includes(String(e))?o[e]:"",d=l.forwardRef((e,o)=>{let{numItems:r=1,numItemsSm:c,numItemsMd:d,numItemsLg:u,children:g,className:m}=e,p=(0,n._T)(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),f=i(r,a._m),h=i(c,a.LH),b=i(d,a.l5),v=i(u,a.N4),k=(0,t.q)(f,h,b,v);return l.createElement("div",Object.assign({ref:o,className:(0,t.q)(s("root"),"grid",k,m)},p),g)});d.displayName="Grid"},9496:function(e,o,r){r.d(o,{LH:function(){return t},N4:function(){return l},PT:function(){return a},SP:function(){return s},VS:function(){return i},_m:function(){return n},_w:function(){return d},l5:function(){return c}});let n={0:"grid-cols-none",1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8",9:"grid-cols-9",10:"grid-cols-10",11:"grid-cols-11",12:"grid-cols-12"},t={0:"sm:grid-cols-none",1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6",7:"sm:grid-cols-7",8:"sm:grid-cols-8",9:"sm:grid-cols-9",10:"sm:grid-cols-10",11:"sm:grid-cols-11",12:"sm:grid-cols-12"},c={0:"md:grid-cols-none",1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-7",8:"md:grid-cols-8",9:"md:grid-cols-9",10:"md:grid-cols-10",11:"md:grid-cols-11",12:"md:grid-cols-12"},l={0:"lg:grid-cols-none",1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6",7:"lg:grid-cols-7",8:"lg:grid-cols-8",9:"lg:grid-cols-9",10:"lg:grid-cols-10",11:"lg:grid-cols-11",12:"lg:grid-cols-12"},a={1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12",13:"col-span-13"},s={1:"sm:col-span-1",2:"sm:col-span-2",3:"sm:col-span-3",4:"sm:col-span-4",5:"sm:col-span-5",6:"sm:col-span-6",7:"sm:col-span-7",8:"sm:col-span-8",9:"sm:col-span-9",10:"sm:col-span-10",11:"sm:col-span-11",12:"sm:col-span-12",13:"sm:col-span-13"},i={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12",13:"md:col-span-13"},d={1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12",13:"lg:col-span-13"}},3810:function(e,o,r){r.d(o,{Z:function(){return N}});var n=r(2265),t=r(36760),c=r.n(t),l=r(18694),a=r(93350),s=r(53445),i=r(19722),d=r(6694),u=r(71744),g=r(93463),m=r(54558),p=r(12918),f=r(71140),h=r(99320);let b=e=>{let{paddingXXS:o,lineWidth:r,tagPaddingHorizontal:n,componentCls:t,calc:c}=e,l=c(n).sub(r).equal(),a=c(o).sub(r).equal();return{[t]:Object.assign(Object.assign({},(0,p.Wf)(e)),{display:"inline-block",height:"auto",marginInlineEnd:e.marginXS,paddingInline:l,fontSize:e.tagFontSize,lineHeight:e.tagLineHeight,whiteSpace:"nowrap",background:e.defaultBg,border:"".concat((0,g.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderRadius:e.borderRadiusSM,opacity:1,transition:"all ".concat(e.motionDurationMid),textAlign:"start",position:"relative",["&".concat(t,"-rtl")]:{direction:"rtl"},"&, a, a:hover":{color:e.defaultColor},["".concat(t,"-close-icon")]:{marginInlineStart:a,fontSize:e.tagIconSize,color:e.colorIcon,cursor:"pointer",transition:"all ".concat(e.motionDurationMid),"&:hover":{color:e.colorTextHeading}},["&".concat(t,"-has-color")]:{borderColor:"transparent",["&, a, a:hover, ".concat(e.iconCls,"-close, ").concat(e.iconCls,"-close:hover")]:{color:e.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",["&:not(".concat(t,"-checkable-checked):hover")]:{color:e.colorPrimary,backgroundColor:e.colorFillSecondary},"&:active, &-checked":{color:e.colorTextLightSolid},"&-checked":{backgroundColor:e.colorPrimary,"&:hover":{backgroundColor:e.colorPrimaryHover}},"&:active":{backgroundColor:e.colorPrimaryActive}},"&-hidden":{display:"none"},["> ".concat(e.iconCls," + span, > span + ").concat(e.iconCls)]:{marginInlineStart:l}}),["".concat(t,"-borderless")]:{borderColor:"transparent",background:e.tagBorderlessBg}}},v=e=>{let{lineWidth:o,fontSizeIcon:r,calc:n}=e,t=e.fontSizeSM;return(0,f.IX)(e,{tagFontSize:t,tagLineHeight:(0,g.bf)(n(e.lineHeightSM).mul(t).equal()),tagIconSize:n(r).sub(n(o).mul(2)).equal(),tagPaddingHorizontal:8,tagBorderlessBg:e.defaultBg})},k=e=>({defaultBg:new m.t(e.colorFillQuaternary).onBackground(e.colorBgContainer).toHexString(),defaultColor:e.colorText});var w=(0,h.I$)("Tag",e=>b(v(e)),k),C=function(e,o){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>o.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var t=0,n=Object.getOwnPropertySymbols(e);to.indexOf(n[t])&&Object.prototype.propertyIsEnumerable.call(e,n[t])&&(r[n[t]]=e[n[t]]);return r};let y=n.forwardRef((e,o)=>{let{prefixCls:r,style:t,className:l,checked:a,children:s,icon:i,onChange:d,onClick:g}=e,m=C(e,["prefixCls","style","className","checked","children","icon","onChange","onClick"]),{getPrefixCls:p,tag:f}=n.useContext(u.E_),h=p("tag",r),[b,v,k]=w(h),y=c()(h,"".concat(h,"-checkable"),{["".concat(h,"-checkable-checked")]:a},null==f?void 0:f.className,l,v,k);return b(n.createElement("span",Object.assign({},m,{ref:o,style:Object.assign(Object.assign({},t),null==f?void 0:f.style),className:y,onClick:e=>{null==d||d(!a),null==g||g(e)}}),i,n.createElement("span",null,s)))});var x=r(18536);let E=e=>(0,x.Z)(e,(o,r)=>{let{textColor:n,lightBorderColor:t,lightColor:c,darkColor:l}=r;return{["".concat(e.componentCls).concat(e.componentCls,"-").concat(o)]:{color:n,background:c,borderColor:t,"&-inverse":{color:e.colorTextLightSolid,background:l,borderColor:l},["&".concat(e.componentCls,"-borderless")]:{borderColor:"transparent"}}}});var O=(0,h.bk)(["Tag","preset"],e=>E(v(e)),k);let S=(e,o,r)=>{let n="string"!=typeof r?r:r.charAt(0).toUpperCase()+r.slice(1);return{["".concat(e.componentCls).concat(e.componentCls,"-").concat(o)]:{color:e["color".concat(r)],background:e["color".concat(n,"Bg")],borderColor:e["color".concat(n,"Border")],["&".concat(e.componentCls,"-borderless")]:{borderColor:"transparent"}}}};var j=(0,h.bk)(["Tag","status"],e=>{let o=v(e);return[S(o,"success","Success"),S(o,"processing","Info"),S(o,"error","Error"),S(o,"warning","Warning")]},k),L=function(e,o){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>o.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var t=0,n=Object.getOwnPropertySymbols(e);to.indexOf(n[t])&&Object.prototype.propertyIsEnumerable.call(e,n[t])&&(r[n[t]]=e[n[t]]);return r};let Z=n.forwardRef((e,o)=>{let{prefixCls:r,className:t,rootClassName:g,style:m,children:p,icon:f,color:h,onClose:b,bordered:v=!0,visible:k}=e,C=L(e,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:y,direction:x,tag:E}=n.useContext(u.E_),[S,Z]=n.useState(!0),N=(0,l.Z)(C,["closeIcon","closable"]);n.useEffect(()=>{void 0!==k&&Z(k)},[k]);let B=(0,a.o2)(h),I=(0,a.yT)(h),M=B||I,R=Object.assign(Object.assign({backgroundColor:h&&!M?h:void 0},null==E?void 0:E.style),m),z=y("tag",r),[P,T,H]=w(z),W=c()(z,null==E?void 0:E.className,{["".concat(z,"-").concat(h)]:M,["".concat(z,"-has-color")]:h&&!M,["".concat(z,"-hidden")]:!S,["".concat(z,"-rtl")]:"rtl"===x,["".concat(z,"-borderless")]:!v},t,g,T,H),_=e=>{e.stopPropagation(),null==b||b(e),e.defaultPrevented||Z(!1)},[,A]=(0,s.b)((0,s.w)(e),(0,s.w)(E),{closable:!1,closeIconRender:e=>{let o=n.createElement("span",{className:"".concat(z,"-close-icon"),onClick:_},e);return(0,i.wm)(e,o,e=>({onClick:o=>{var r;null===(r=null==e?void 0:e.onClick)||void 0===r||r.call(e,o),_(o)},className:c()(null==e?void 0:e.className,"".concat(z,"-close-icon"))}))}}),V="function"==typeof C.onClick||p&&"a"===p.type,q=f||null,F=q?n.createElement(n.Fragment,null,q,p&&n.createElement("span",null,p)):p,U=n.createElement("span",Object.assign({},N,{ref:o,className:W,style:R}),F,A,B&&n.createElement(O,{key:"preset",prefixCls:z}),I&&n.createElement(j,{key:"status",prefixCls:z}));return P(V?n.createElement(d.Z,{component:"Tag"},U):U)});Z.CheckableTag=y;var N=Z},79205:function(e,o,r){r.d(o,{Z:function(){return u}});var n=r(2265);let t=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),c=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,o,r)=>r?r.toUpperCase():o.toLowerCase()),l=e=>{let o=c(e);return o.charAt(0).toUpperCase()+o.slice(1)},a=function(){for(var e=arguments.length,o=Array(e),r=0;r!!e&&""!==e.trim()&&r.indexOf(e)===o).join(" ").trim()},s=e=>{for(let o in e)if(o.startsWith("aria-")||"role"===o||"title"===o)return!0};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let d=(0,n.forwardRef)((e,o)=>{let{color:r="currentColor",size:t=24,strokeWidth:c=2,absoluteStrokeWidth:l,className:d="",children:u,iconNode:g,...m}=e;return(0,n.createElement)("svg",{ref:o,...i,width:t,height:t,stroke:r,strokeWidth:l?24*Number(c)/Number(t):c,className:a("lucide",d),...!u&&!s(m)&&{"aria-hidden":"true"},...m},[...g.map(e=>{let[o,r]=e;return(0,n.createElement)(o,r)}),...Array.isArray(u)?u:[u]])}),u=(e,o)=>{let r=(0,n.forwardRef)((r,c)=>{let{className:s,...i}=r;return(0,n.createElement)(d,{ref:c,iconNode:o,className:a("lucide-".concat(t(l(e))),"lucide-".concat(e),s),...i})});return r.displayName=l(e),r}},30401:function(e,o,r){r.d(o,{Z:function(){return n}});let n=(0,r(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},78867:function(e,o,r){r.d(o,{Z:function(){return n}});let n=(0,r(79205).Z)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},10900:function(e,o,r){var n=r(2265);let t=n.forwardRef(function(e,o){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:o},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});o.Z=t},86462:function(e,o,r){var n=r(2265);let t=n.forwardRef(function(e,o){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:o},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});o.Z=t},44633:function(e,o,r){var n=r(2265);let t=n.forwardRef(function(e,o){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:o},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});o.Z=t},93416:function(e,o,r){var n=r(2265);let t=n.forwardRef(function(e,o){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:o},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});o.Z=t},49084:function(e,o,r){var n=r(2265);let t=n.forwardRef(function(e,o){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:o},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});o.Z=t}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/3367-33bb84b3d3d247b2.js b/litellm/proxy/_experimental/out/_next/static/chunks/3367-58830187e9e5b9fa.js similarity index 98% rename from litellm/proxy/_experimental/out/_next/static/chunks/3367-33bb84b3d3d247b2.js rename to litellm/proxy/_experimental/out/_next/static/chunks/3367-58830187e9e5b9fa.js index 23daac359d..ab13c388e3 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/3367-33bb84b3d3d247b2.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/3367-58830187e9e5b9fa.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3367],{60440:function(e,n,t){t.d(n,{Z:function(){return u}});var r=t(1119),o=t(2265),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"ellipsis",theme:"outlined"},l=t(55015),u=o.forwardRef(function(e,n){return o.createElement(l.Z,(0,r.Z)({},e,{ref:n,icon:i}))})},71030:function(e,n,t){t.d(n,{Z:function(){return C}});var r=t(1119),o=t(11993),i=t(26365),l=t(6989),u=t(97821),a=t(36760),c=t.n(a),s=t(28791),f=t(2265),d=t(95814),p=t(53346),v=d.Z.ESC,m=d.Z.TAB,b=(0,f.forwardRef)(function(e,n){var t=e.overlay,r=e.arrow,o=e.prefixCls,i=(0,f.useMemo)(function(){return"function"==typeof t?t():t},[t]),l=(0,s.sQ)(n,(0,s.C4)(i));return f.createElement(f.Fragment,null,r&&f.createElement("div",{className:"".concat(o,"-arrow")}),f.cloneElement(i,{ref:(0,s.Yr)(i)?l:void 0}))}),y={adjustX:1,adjustY:1},h=[0,0],g={topLeft:{points:["bl","tl"],overflow:y,offset:[0,-4],targetOffset:h},top:{points:["bc","tc"],overflow:y,offset:[0,-4],targetOffset:h},topRight:{points:["br","tr"],overflow:y,offset:[0,-4],targetOffset:h},bottomLeft:{points:["tl","bl"],overflow:y,offset:[0,4],targetOffset:h},bottom:{points:["tc","bc"],overflow:y,offset:[0,4],targetOffset:h},bottomRight:{points:["tr","br"],overflow:y,offset:[0,4],targetOffset:h}},Z=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"],C=f.forwardRef(function(e,n){var t,a,d,y,h,C,E,w,k,M,R,x,N,P,S=e.arrow,I=void 0!==S&&S,K=e.prefixCls,O=void 0===K?"rc-dropdown":K,A=e.transitionName,T=e.animation,L=e.align,D=e.placement,_=e.placements,V=e.getPopupContainer,z=e.showAction,F=e.hideAction,j=e.overlayClassName,B=e.overlayStyle,W=e.visible,H=e.trigger,Y=void 0===H?["hover"]:H,q=e.autoFocus,X=e.overlay,G=e.children,Q=e.onVisibleChange,U=(0,l.Z)(e,Z),J=f.useState(),$=(0,i.Z)(J,2),ee=$[0],en=$[1],et="visible"in e?W:ee,er=f.useRef(null),eo=f.useRef(null),ei=f.useRef(null);f.useImperativeHandle(n,function(){return er.current});var el=function(e){en(e),null==Q||Q(e)};a=(t={visible:et,triggerRef:ei,onVisibleChange:el,autoFocus:q,overlayRef:eo}).visible,d=t.triggerRef,y=t.onVisibleChange,h=t.autoFocus,C=t.overlayRef,E=f.useRef(!1),w=function(){if(a){var e,n;null===(e=d.current)||void 0===e||null===(n=e.focus)||void 0===n||n.call(e),null==y||y(!1)}},k=function(){var e;return null!==(e=C.current)&&void 0!==e&&!!e.focus&&(C.current.focus(),E.current=!0,!0)},M=function(e){switch(e.keyCode){case v:w();break;case m:var n=!1;E.current||(n=k()),n?e.preventDefault():w()}},f.useEffect(function(){return a?(window.addEventListener("keydown",M),h&&(0,p.Z)(k,3),function(){window.removeEventListener("keydown",M),E.current=!1}):function(){E.current=!1}},[a]);var eu=function(){return f.createElement(b,{ref:eo,overlay:X,prefixCls:O,arrow:I})},ea=f.cloneElement(G,{className:c()(null===(P=G.props)||void 0===P?void 0:P.className,et&&(void 0!==(R=e.openClassName)?R:"".concat(O,"-open"))),ref:(0,s.Yr)(G)?(0,s.sQ)(ei,(0,s.C4)(G)):void 0}),ec=F;return ec||-1===Y.indexOf("contextMenu")||(ec=["click"]),f.createElement(u.Z,(0,r.Z)({builtinPlacements:void 0===_?g:_},U,{prefixCls:O,ref:er,popupClassName:c()(j,(0,o.Z)({},"".concat(O,"-show-arrow"),I)),popupStyle:B,action:Y,showAction:z,hideAction:ec,popupPlacement:void 0===D?"bottomLeft":D,popupAlign:L,popupTransitionName:A,popupAnimation:T,popupVisible:et,stretch:(x=e.minOverlayWidthMatchTrigger,N=e.alignPoint,"minOverlayWidthMatchTrigger"in e?x:!N)?"minWidth":"",popup:"function"==typeof X?eu:eu(),onPopupVisibleChange:el,onPopupClick:function(n){var t=e.onOverlayClick;en(!1),t&&t(n)},getPopupContainer:V}),ea)})},33082:function(e,n,t){t.d(n,{iz:function(){return eO},ck:function(){return ev},BW:function(){return eL},sN:function(){return ev},Wd:function(){return eI},ZP:function(){return ej},Xl:function(){return x}});var r=t(1119),o=t(11993),i=t(31686),l=t(83145),u=t(26365),a=t(6989),c=t(36760),s=t.n(c),f=t(1699),d=t(50506),p=t(16671),v=t(32559),m=t(2265),b=t(54887),y=m.createContext(null);function h(e,n){return void 0===e?null:"".concat(e,"-").concat(n)}function g(e){return h(m.useContext(y),e)}var Z=t(6397),C=["children","locked"],E=m.createContext(null);function w(e){var n=e.children,t=e.locked,r=(0,a.Z)(e,C),o=m.useContext(E),l=(0,Z.Z)(function(){var e;return e=(0,i.Z)({},o),Object.keys(r).forEach(function(n){var t=r[n];void 0!==t&&(e[n]=t)}),e},[o,r],function(e,n){return!t&&(e[0]!==n[0]||!(0,p.Z)(e[1],n[1],!0))});return m.createElement(E.Provider,{value:l},n)}var k=m.createContext(null);function M(){return m.useContext(k)}var R=m.createContext([]);function x(e){var n=m.useContext(R);return m.useMemo(function(){return void 0!==e?[].concat((0,l.Z)(n),[e]):n},[n,e])}var N=m.createContext(null),P=m.createContext({}),S=t(2857);function I(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if((0,S.Z)(e)){var t=e.nodeName.toLowerCase(),r=["input","select","textarea","button"].includes(t)||e.isContentEditable||"a"===t&&!!e.getAttribute("href"),o=e.getAttribute("tabindex"),i=Number(o),l=null;return o&&!Number.isNaN(i)?l=i:r&&null===l&&(l=0),r&&e.disabled&&(l=null),null!==l&&(l>=0||n&&l<0)}return!1}var K=t(95814),O=t(53346),A=K.Z.LEFT,T=K.Z.RIGHT,L=K.Z.UP,D=K.Z.DOWN,_=K.Z.ENTER,V=K.Z.ESC,z=K.Z.HOME,F=K.Z.END,j=[L,D,A,T];function B(e,n){return(function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=(0,l.Z)(e.querySelectorAll("*")).filter(function(e){return I(e,n)});return I(e,n)&&t.unshift(e),t})(e,!0).filter(function(e){return n.has(e)})}function W(e,n,t){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(!e)return null;var o=B(e,n),i=o.length,l=o.findIndex(function(e){return t===e});return r<0?-1===l?l=i-1:l-=1:r>0&&(l+=1),o[l=(l+i)%i]}var H=function(e,n){var t=new Set,r=new Map,o=new Map;return e.forEach(function(e){var i=document.querySelector("[data-menu-id='".concat(h(n,e),"']"));i&&(t.add(i),o.set(i,e),r.set(e,i))}),{elements:t,key2element:r,element2key:o}},Y="__RC_UTIL_PATH_SPLIT__",q=function(e){return e.join(Y)},X="rc-menu-more";function G(e){var n=m.useRef(e);n.current=e;var t=m.useCallback(function(){for(var e,t=arguments.length,r=Array(t),o=0;o1&&(k.motionAppear=!1);var M=k.onVisibleChanged;return(k.onVisibleChanged=function(e){return b.current||e||Z(!0),null==M?void 0:M(e)},g)?null:m.createElement(w,{mode:a,locked:!b.current},m.createElement(eR.ZP,(0,r.Z)({visible:C},k,{forceRender:f,removeOnLeave:!1,leavedClassName:"".concat(s,"-hidden")}),function(e){var t=e.className,r=e.style;return m.createElement(eb,{id:n,className:t,style:r},l)}))}var eN=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],eP=["active"],eS=m.forwardRef(function(e,n){var t=e.style,l=e.className,c=e.title,d=e.eventKey,p=(e.warnKey,e.disabled),v=e.internalPopupClose,b=e.children,y=e.itemIcon,h=e.expandIcon,Z=e.popupClassName,C=e.popupOffset,k=e.popupStyle,M=e.onClick,R=e.onMouseEnter,S=e.onMouseLeave,I=e.onTitleClick,K=e.onTitleMouseEnter,O=e.onTitleMouseLeave,A=(0,a.Z)(e,eN),T=g(d),L=m.useContext(E),D=L.prefixCls,_=L.mode,V=L.openKeys,z=L.disabled,F=L.overflowDisabled,j=L.activeKey,B=L.selectedKeys,W=L.itemIcon,H=L.expandIcon,Y=L.onItemClick,q=L.onOpenChange,X=L.onActive,Q=m.useContext(P)._internalRenderSubMenuItem,U=m.useContext(N).isSubPathKey,J=x(),$="".concat(D,"-submenu"),ee=z||p,en=m.useRef(),et=m.useRef(),er=null!=h?h:H,eu=V.includes(d),ec=!F&&eu,es=U(B,d),ef=eo(d,ee,K,O),ed=ef.active,ep=(0,a.Z)(ef,eP),ev=m.useState(!1),em=(0,u.Z)(ev,2),ey=em[0],eh=em[1],eg=function(e){ee||eh(e)},eZ=m.useMemo(function(){return ed||"inline"!==_&&(ey||U([j],d))},[_,ed,j,ey,d,U]),eC=ei(J.length),eE=G(function(e){null==M||M(ea(e)),Y(e)}),ew=T&&"".concat(T,"-popup"),ek=m.useMemo(function(){return m.createElement(el,{icon:"horizontal"!==_?er:void 0,props:(0,i.Z)((0,i.Z)({},e),{},{isOpen:ec,isSubMenu:!0})},m.createElement("i",{className:"".concat($,"-arrow")}))},[_,er,e,ec,$]),eR=m.createElement("div",(0,r.Z)({role:"menuitem",style:eC,className:"".concat($,"-title"),tabIndex:ee?null:-1,ref:en,title:"string"==typeof c?c:null,"data-menu-id":F&&T?null:T,"aria-expanded":ec,"aria-haspopup":!0,"aria-controls":ew,"aria-disabled":ee,onClick:function(e){ee||(null==I||I({key:d,domEvent:e}),"inline"===_&&q(d,!eu))},onFocus:function(){X(d)}},ep),c,ek),eS=m.useRef(_);if("inline"!==_&&J.length>1?eS.current="vertical":eS.current=_,!F){var eI=eS.current;eR=m.createElement(eM,{mode:eI,prefixCls:$,visible:!v&&ec&&"inline"!==_,popupClassName:Z,popupOffset:C,popupStyle:k,popup:m.createElement(w,{mode:"horizontal"===eI?"vertical":eI},m.createElement(eb,{id:ew,ref:et},b)),disabled:ee,onVisibleChange:function(e){"inline"!==_&&q(d,e)}},eR)}var eK=m.createElement(f.Z.Item,(0,r.Z)({ref:n,role:"none"},A,{component:"li",style:t,className:s()($,"".concat($,"-").concat(_),l,(0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)({},"".concat($,"-open"),ec),"".concat($,"-active"),eZ),"".concat($,"-selected"),es),"".concat($,"-disabled"),ee)),onMouseEnter:function(e){eg(!0),null==R||R({key:d,domEvent:e})},onMouseLeave:function(e){eg(!1),null==S||S({key:d,domEvent:e})}}),eR,!F&&m.createElement(ex,{id:ew,open:ec,keyPath:J},b));return Q&&(eK=Q(eK,e,{selected:es,active:eZ,open:ec,disabled:ee})),m.createElement(w,{onItemClick:eE,mode:"horizontal"===_?"vertical":_,itemIcon:null!=y?y:W,expandIcon:er},eK)}),eI=m.forwardRef(function(e,n){var t,o=e.eventKey,i=e.children,l=x(o),u=eh(i,l),a=M();return m.useEffect(function(){if(a)return a.registerPath(o,l),function(){a.unregisterPath(o,l)}},[l]),t=a?u:m.createElement(eS,(0,r.Z)({ref:n},e),u),m.createElement(R.Provider,{value:l},t)}),eK=t(41154);function eO(e){var n=e.className,t=e.style,r=m.useContext(E).prefixCls;return M()?null:m.createElement("li",{role:"separator",className:s()("".concat(r,"-item-divider"),n),style:t})}var eA=["className","title","eventKey","children"],eT=m.forwardRef(function(e,n){var t=e.className,o=e.title,i=(e.eventKey,e.children),l=(0,a.Z)(e,eA),u=m.useContext(E).prefixCls,c="".concat(u,"-item-group");return m.createElement("li",(0,r.Z)({ref:n,role:"presentation"},l,{onClick:function(e){return e.stopPropagation()},className:s()(c,t)}),m.createElement("div",{role:"presentation",className:"".concat(c,"-title"),title:"string"==typeof o?o:void 0},o),m.createElement("ul",{role:"group",className:"".concat(c,"-list")},i))}),eL=m.forwardRef(function(e,n){var t=e.eventKey,o=eh(e.children,x(t));return M()?o:m.createElement(eT,(0,r.Z)({ref:n},(0,et.Z)(e,["warnKey"])),o)}),eD=["label","children","key","type","extra"];function e_(e,n,t,o,l){var u=e,c=(0,i.Z)({divider:eO,item:ev,group:eL,submenu:eI},o);return n&&(u=function e(n,t,o){var i=t.item,l=t.group,u=t.submenu,c=t.divider;return(n||[]).map(function(n,s){if(n&&"object"===(0,eK.Z)(n)){var f=n.label,d=n.children,p=n.key,v=n.type,b=n.extra,y=(0,a.Z)(n,eD),h=null!=p?p:"tmp-".concat(s);return d||"group"===v?"group"===v?m.createElement(l,(0,r.Z)({key:h},y,{title:f}),e(d,t,o)):m.createElement(u,(0,r.Z)({key:h},y,{title:f}),e(d,t,o)):"divider"===v?m.createElement(c,(0,r.Z)({key:h},y)):m.createElement(i,(0,r.Z)({key:h},y,{extra:b}),f,(!!b||0===b)&&m.createElement("span",{className:"".concat(o,"-item-extra")},b))}return null}).filter(function(e){return e})}(n,c,l)),eh(u,t)}var eV=["prefixCls","rootClassName","style","className","tabIndex","items","children","direction","id","mode","inlineCollapsed","disabled","disabledOverflow","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","defaultOpenKeys","openKeys","activeKey","defaultActiveFirst","selectable","multiple","defaultSelectedKeys","selectedKeys","onSelect","onDeselect","inlineIndent","motion","defaultMotions","triggerSubMenuAction","builtinPlacements","itemIcon","expandIcon","overflowedIndicator","overflowedIndicatorPopupClassName","getPopupContainer","onClick","onOpenChange","onKeyDown","openAnimation","openTransitionName","_internalRenderMenuItem","_internalRenderSubMenuItem","_internalComponents"],ez=[],eF=m.forwardRef(function(e,n){var t,c,v,h,g,Z,C,E,M,R,x,S,I,K,J,$,ee,en,et,er,eo,ei,el,eu,ec,es,ef=e.prefixCls,ed=void 0===ef?"rc-menu":ef,ep=e.rootClassName,em=e.style,eb=e.className,ey=e.tabIndex,eh=e.items,eg=e.children,eZ=e.direction,eC=e.id,eE=e.mode,ew=void 0===eE?"vertical":eE,ek=e.inlineCollapsed,eM=e.disabled,eR=e.disabledOverflow,ex=e.subMenuOpenDelay,eN=e.subMenuCloseDelay,eP=e.forceSubMenuRender,eS=e.defaultOpenKeys,eK=e.openKeys,eO=e.activeKey,eA=e.defaultActiveFirst,eT=e.selectable,eL=void 0===eT||eT,eD=e.multiple,eF=void 0!==eD&&eD,ej=e.defaultSelectedKeys,eB=e.selectedKeys,eW=e.onSelect,eH=e.onDeselect,eY=e.inlineIndent,eq=e.motion,eX=e.defaultMotions,eG=e.triggerSubMenuAction,eQ=e.builtinPlacements,eU=e.itemIcon,eJ=e.expandIcon,e$=e.overflowedIndicator,e0=void 0===e$?"...":e$,e1=e.overflowedIndicatorPopupClassName,e2=e.getPopupContainer,e6=e.onClick,e5=e.onOpenChange,e9=e.onKeyDown,e4=(e.openAnimation,e.openTransitionName,e._internalRenderMenuItem),e3=e._internalRenderSubMenuItem,e8=e._internalComponents,e7=(0,a.Z)(e,eV),ne=m.useMemo(function(){return[e_(eg,eh,ez,e8,ed),e_(eg,eh,ez,{},ed)]},[eg,eh,e8]),nn=(0,u.Z)(ne,2),nt=nn[0],nr=nn[1],no=m.useState(!1),ni=(0,u.Z)(no,2),nl=ni[0],nu=ni[1],na=m.useRef(),nc=(t=(0,d.Z)(eC,{value:eC}),v=(c=(0,u.Z)(t,2))[0],h=c[1],m.useEffect(function(){U+=1;var e="".concat(Q,"-").concat(U);h("rc-menu-uuid-".concat(e))},[]),v),ns="rtl"===eZ,nf=(0,d.Z)(eS,{value:eK,postState:function(e){return e||ez}}),nd=(0,u.Z)(nf,2),np=nd[0],nv=nd[1],nm=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];function t(){nv(e),null==e5||e5(e)}n?(0,b.flushSync)(t):t()},nb=m.useState(np),ny=(0,u.Z)(nb,2),nh=ny[0],ng=ny[1],nZ=m.useRef(!1),nC=m.useMemo(function(){return("inline"===ew||"vertical"===ew)&&ek?["vertical",ek]:[ew,!1]},[ew,ek]),nE=(0,u.Z)(nC,2),nw=nE[0],nk=nE[1],nM="inline"===nw,nR=m.useState(nw),nx=(0,u.Z)(nR,2),nN=nx[0],nP=nx[1],nS=m.useState(nk),nI=(0,u.Z)(nS,2),nK=nI[0],nO=nI[1];m.useEffect(function(){nP(nw),nO(nk),nZ.current&&(nM?nv(nh):nm(ez))},[nw,nk]);var nA=m.useState(0),nT=(0,u.Z)(nA,2),nL=nT[0],nD=nT[1],n_=nL>=nt.length-1||"horizontal"!==nN||eR;m.useEffect(function(){nM&&ng(np)},[np]),m.useEffect(function(){return nZ.current=!0,function(){nZ.current=!1}},[]);var nV=(g=m.useState({}),Z=(0,u.Z)(g,2)[1],C=(0,m.useRef)(new Map),E=(0,m.useRef)(new Map),M=m.useState([]),x=(R=(0,u.Z)(M,2))[0],S=R[1],I=(0,m.useRef)(0),K=(0,m.useRef)(!1),J=function(){K.current||Z({})},$=(0,m.useCallback)(function(e,n){var t,r=q(n);E.current.set(r,e),C.current.set(e,r),I.current+=1;var o=I.current;t=function(){o===I.current&&J()},Promise.resolve().then(t)},[]),ee=(0,m.useCallback)(function(e,n){var t=q(n);E.current.delete(t),C.current.delete(e)},[]),en=(0,m.useCallback)(function(e){S(e)},[]),et=(0,m.useCallback)(function(e,n){var t=(C.current.get(e)||"").split(Y);return n&&x.includes(t[0])&&t.unshift(X),t},[x]),er=(0,m.useCallback)(function(e,n){return e.filter(function(e){return void 0!==e}).some(function(e){return et(e,!0).includes(n)})},[et]),eo=(0,m.useCallback)(function(e){var n="".concat(C.current.get(e)).concat(Y),t=new Set;return(0,l.Z)(E.current.keys()).forEach(function(e){e.startsWith(n)&&t.add(E.current.get(e))}),t},[]),m.useEffect(function(){return function(){K.current=!0}},[]),{registerPath:$,unregisterPath:ee,refreshOverflowKeys:en,isSubPathKey:er,getKeyPath:et,getKeys:function(){var e=(0,l.Z)(C.current.keys());return x.length&&e.push(X),e},getSubPathKeys:eo}),nz=nV.registerPath,nF=nV.unregisterPath,nj=nV.refreshOverflowKeys,nB=nV.isSubPathKey,nW=nV.getKeyPath,nH=nV.getKeys,nY=nV.getSubPathKeys,nq=m.useMemo(function(){return{registerPath:nz,unregisterPath:nF}},[nz,nF]),nX=m.useMemo(function(){return{isSubPathKey:nB}},[nB]);m.useEffect(function(){nj(n_?ez:nt.slice(nL+1).map(function(e){return e.key}))},[nL,n_]);var nG=(0,d.Z)(eO||eA&&(null===(es=nt[0])||void 0===es?void 0:es.key),{value:eO}),nQ=(0,u.Z)(nG,2),nU=nQ[0],nJ=nQ[1],n$=G(function(e){nJ(e)}),n0=G(function(){nJ(void 0)});(0,m.useImperativeHandle)(n,function(){return{list:na.current,focus:function(e){var n,t,r=H(nH(),nc),o=r.elements,i=r.key2element,l=r.element2key,u=B(na.current,o),a=null!=nU?nU:u[0]?l.get(u[0]):null===(n=nt.find(function(e){return!e.props.disabled}))||void 0===n?void 0:n.key,c=i.get(a);a&&c&&(null==c||null===(t=c.focus)||void 0===t||t.call(c,e))}}});var n1=(0,d.Z)(ej||[],{value:eB,postState:function(e){return Array.isArray(e)?e:null==e?ez:[e]}}),n2=(0,u.Z)(n1,2),n6=n2[0],n5=n2[1],n9=function(e){if(eL){var n,t=e.key,r=n6.includes(t);n5(n=eF?r?n6.filter(function(e){return e!==t}):[].concat((0,l.Z)(n6),[t]):[t]);var o=(0,i.Z)((0,i.Z)({},e),{},{selectedKeys:n});r?null==eH||eH(o):null==eW||eW(o)}!eF&&np.length&&"inline"!==nN&&nm(ez)},n4=G(function(e){null==e6||e6(ea(e)),n9(e)}),n3=G(function(e,n){var t=np.filter(function(n){return n!==e});if(n)t.push(e);else if("inline"!==nN){var r=nY(e);t=t.filter(function(e){return!r.has(e)})}(0,p.Z)(np,t,!0)||nm(t,!0)}),n8=(ei=function(e,n){var t=null!=n?n:!np.includes(e);n3(e,t)},el=m.useRef(),(eu=m.useRef()).current=nU,ec=function(){O.Z.cancel(el.current)},m.useEffect(function(){return function(){ec()}},[]),function(e){var n=e.which;if([].concat(j,[_,V,z,F]).includes(n)){var t=nH(),r=H(t,nc),i=r,l=i.elements,u=i.key2element,a=i.element2key,c=function(e,n){for(var t=e||document.activeElement;t;){if(n.has(t))return t;t=t.parentElement}return null}(u.get(nU),l),s=a.get(c),f=function(e,n,t,r){var i,l="prev",u="next",a="children",c="parent";if("inline"===e&&r===_)return{inlineTrigger:!0};var s=(0,o.Z)((0,o.Z)({},L,l),D,u),f=(0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)({},A,t?u:l),T,t?l:u),D,a),_,a),d=(0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)({},L,l),D,u),_,a),V,c),A,t?a:c),T,t?c:a);switch(null===(i=({inline:s,horizontal:f,vertical:d,inlineSub:s,horizontalSub:d,verticalSub:d})["".concat(e).concat(n?"":"Sub")])||void 0===i?void 0:i[r]){case l:return{offset:-1,sibling:!0};case u:return{offset:1,sibling:!0};case c:return{offset:-1,sibling:!1};case a:return{offset:1,sibling:!1};default:return null}}(nN,1===nW(s,!0).length,ns,n);if(!f&&n!==z&&n!==F)return;(j.includes(n)||[z,F].includes(n))&&e.preventDefault();var d=function(e){if(e){var n=e,t=e.querySelector("a");null!=t&&t.getAttribute("href")&&(n=t);var r=a.get(e);nJ(r),ec(),el.current=(0,O.Z)(function(){eu.current===r&&n.focus()})}};if([z,F].includes(n)||f.sibling||!c){var p,v=B(p=c&&"inline"!==nN?function(e){for(var n=e;n;){if(n.getAttribute("data-menu-list"))return n;n=n.parentElement}return null}(c):na.current,l);d(n===z?v[0]:n===F?v[v.length-1]:W(p,l,c,f.offset))}else if(f.inlineTrigger)ei(s);else if(f.offset>0)ei(s,!0),ec(),el.current=(0,O.Z)(function(){r=H(t,nc);var e=c.getAttribute("aria-controls");d(W(document.getElementById(e),r.elements))},5);else if(f.offset<0){var m=nW(s,!0),b=m[m.length-2],y=u.get(b);ei(b,!1),d(y)}}null==e9||e9(e)});m.useEffect(function(){nu(!0)},[]);var n7=m.useMemo(function(){return{_internalRenderMenuItem:e4,_internalRenderSubMenuItem:e3}},[e4,e3]),te="horizontal"!==nN||eR?nt:nt.map(function(e,n){return m.createElement(w,{key:e.key,overflowDisabled:n>nL},e)}),tn=m.createElement(f.Z,(0,r.Z)({id:eC,ref:na,prefixCls:"".concat(ed,"-overflow"),component:"ul",itemComponent:ev,className:s()(ed,"".concat(ed,"-root"),"".concat(ed,"-").concat(nN),eb,(0,o.Z)((0,o.Z)({},"".concat(ed,"-inline-collapsed"),nK),"".concat(ed,"-rtl"),ns),ep),dir:eZ,style:em,role:"menu",tabIndex:void 0===ey?0:ey,data:te,renderRawItem:function(e){return e},renderRawRest:function(e){var n=e.length,t=n?nt.slice(-n):null;return m.createElement(eI,{eventKey:X,title:e0,disabled:n_,internalPopupClose:0===n,popupClassName:e1},t)},maxCount:"horizontal"!==nN||eR?f.Z.INVALIDATE:f.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(e){nD(e)},onKeyDown:n8},e7));return m.createElement(P.Provider,{value:n7},m.createElement(y.Provider,{value:nc},m.createElement(w,{prefixCls:ed,rootClassName:ep,mode:nN,openKeys:np,rtl:ns,disabled:eM,motion:nl?eq:null,defaultMotions:nl?eX:null,activeKey:nU,onActive:n$,onInactive:n0,selectedKeys:n6,inlineIndent:void 0===eY?24:eY,subMenuOpenDelay:void 0===ex?.1:ex,subMenuCloseDelay:void 0===eN?.1:eN,forceSubMenuRender:eP,builtinPlacements:eQ,triggerSubMenuAction:void 0===eG?"hover":eG,getPopupContainer:e2,itemIcon:eU,expandIcon:eJ,onItemClick:n4,onOpenChange:n3},m.createElement(N.Provider,{value:nX},tn),m.createElement("div",{style:{display:"none"},"aria-hidden":!0},m.createElement(k.Provider,{value:nq},nr)))))});eF.Item=ev,eF.SubMenu=eI,eF.ItemGroup=eL,eF.Divider=eO;var ej=eF}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3367],{39760:function(e,n,t){t.d(n,{Z:function(){return u}});var r=t(1119),o=t(2265),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"ellipsis",theme:"outlined"},l=t(55015),u=o.forwardRef(function(e,n){return o.createElement(l.Z,(0,r.Z)({},e,{ref:n,icon:i}))})},71030:function(e,n,t){t.d(n,{Z:function(){return C}});var r=t(1119),o=t(11993),i=t(26365),l=t(6989),u=t(97821),a=t(36760),c=t.n(a),s=t(28791),f=t(2265),d=t(95814),p=t(53346),v=d.Z.ESC,m=d.Z.TAB,b=(0,f.forwardRef)(function(e,n){var t=e.overlay,r=e.arrow,o=e.prefixCls,i=(0,f.useMemo)(function(){return"function"==typeof t?t():t},[t]),l=(0,s.sQ)(n,(0,s.C4)(i));return f.createElement(f.Fragment,null,r&&f.createElement("div",{className:"".concat(o,"-arrow")}),f.cloneElement(i,{ref:(0,s.Yr)(i)?l:void 0}))}),y={adjustX:1,adjustY:1},h=[0,0],g={topLeft:{points:["bl","tl"],overflow:y,offset:[0,-4],targetOffset:h},top:{points:["bc","tc"],overflow:y,offset:[0,-4],targetOffset:h},topRight:{points:["br","tr"],overflow:y,offset:[0,-4],targetOffset:h},bottomLeft:{points:["tl","bl"],overflow:y,offset:[0,4],targetOffset:h},bottom:{points:["tc","bc"],overflow:y,offset:[0,4],targetOffset:h},bottomRight:{points:["tr","br"],overflow:y,offset:[0,4],targetOffset:h}},Z=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"],C=f.forwardRef(function(e,n){var t,a,d,y,h,C,E,w,k,M,R,x,N,P,S=e.arrow,I=void 0!==S&&S,K=e.prefixCls,O=void 0===K?"rc-dropdown":K,A=e.transitionName,T=e.animation,L=e.align,D=e.placement,_=e.placements,V=e.getPopupContainer,z=e.showAction,F=e.hideAction,j=e.overlayClassName,B=e.overlayStyle,W=e.visible,H=e.trigger,Y=void 0===H?["hover"]:H,q=e.autoFocus,X=e.overlay,G=e.children,Q=e.onVisibleChange,U=(0,l.Z)(e,Z),J=f.useState(),$=(0,i.Z)(J,2),ee=$[0],en=$[1],et="visible"in e?W:ee,er=f.useRef(null),eo=f.useRef(null),ei=f.useRef(null);f.useImperativeHandle(n,function(){return er.current});var el=function(e){en(e),null==Q||Q(e)};a=(t={visible:et,triggerRef:ei,onVisibleChange:el,autoFocus:q,overlayRef:eo}).visible,d=t.triggerRef,y=t.onVisibleChange,h=t.autoFocus,C=t.overlayRef,E=f.useRef(!1),w=function(){if(a){var e,n;null===(e=d.current)||void 0===e||null===(n=e.focus)||void 0===n||n.call(e),null==y||y(!1)}},k=function(){var e;return null!==(e=C.current)&&void 0!==e&&!!e.focus&&(C.current.focus(),E.current=!0,!0)},M=function(e){switch(e.keyCode){case v:w();break;case m:var n=!1;E.current||(n=k()),n?e.preventDefault():w()}},f.useEffect(function(){return a?(window.addEventListener("keydown",M),h&&(0,p.Z)(k,3),function(){window.removeEventListener("keydown",M),E.current=!1}):function(){E.current=!1}},[a]);var eu=function(){return f.createElement(b,{ref:eo,overlay:X,prefixCls:O,arrow:I})},ea=f.cloneElement(G,{className:c()(null===(P=G.props)||void 0===P?void 0:P.className,et&&(void 0!==(R=e.openClassName)?R:"".concat(O,"-open"))),ref:(0,s.Yr)(G)?(0,s.sQ)(ei,(0,s.C4)(G)):void 0}),ec=F;return ec||-1===Y.indexOf("contextMenu")||(ec=["click"]),f.createElement(u.Z,(0,r.Z)({builtinPlacements:void 0===_?g:_},U,{prefixCls:O,ref:er,popupClassName:c()(j,(0,o.Z)({},"".concat(O,"-show-arrow"),I)),popupStyle:B,action:Y,showAction:z,hideAction:ec,popupPlacement:void 0===D?"bottomLeft":D,popupAlign:L,popupTransitionName:A,popupAnimation:T,popupVisible:et,stretch:(x=e.minOverlayWidthMatchTrigger,N=e.alignPoint,"minOverlayWidthMatchTrigger"in e?x:!N)?"minWidth":"",popup:"function"==typeof X?eu:eu(),onPopupVisibleChange:el,onPopupClick:function(n){var t=e.onOverlayClick;en(!1),t&&t(n)},getPopupContainer:V}),ea)})},33082:function(e,n,t){t.d(n,{iz:function(){return eO},ck:function(){return ev},BW:function(){return eL},sN:function(){return ev},Wd:function(){return eI},ZP:function(){return ej},Xl:function(){return x}});var r=t(1119),o=t(11993),i=t(31686),l=t(83145),u=t(26365),a=t(6989),c=t(36760),s=t.n(c),f=t(1699),d=t(50506),p=t(16671),v=t(32559),m=t(2265),b=t(54887),y=m.createContext(null);function h(e,n){return void 0===e?null:"".concat(e,"-").concat(n)}function g(e){return h(m.useContext(y),e)}var Z=t(6397),C=["children","locked"],E=m.createContext(null);function w(e){var n=e.children,t=e.locked,r=(0,a.Z)(e,C),o=m.useContext(E),l=(0,Z.Z)(function(){var e;return e=(0,i.Z)({},o),Object.keys(r).forEach(function(n){var t=r[n];void 0!==t&&(e[n]=t)}),e},[o,r],function(e,n){return!t&&(e[0]!==n[0]||!(0,p.Z)(e[1],n[1],!0))});return m.createElement(E.Provider,{value:l},n)}var k=m.createContext(null);function M(){return m.useContext(k)}var R=m.createContext([]);function x(e){var n=m.useContext(R);return m.useMemo(function(){return void 0!==e?[].concat((0,l.Z)(n),[e]):n},[n,e])}var N=m.createContext(null),P=m.createContext({}),S=t(2857);function I(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if((0,S.Z)(e)){var t=e.nodeName.toLowerCase(),r=["input","select","textarea","button"].includes(t)||e.isContentEditable||"a"===t&&!!e.getAttribute("href"),o=e.getAttribute("tabindex"),i=Number(o),l=null;return o&&!Number.isNaN(i)?l=i:r&&null===l&&(l=0),r&&e.disabled&&(l=null),null!==l&&(l>=0||n&&l<0)}return!1}var K=t(95814),O=t(53346),A=K.Z.LEFT,T=K.Z.RIGHT,L=K.Z.UP,D=K.Z.DOWN,_=K.Z.ENTER,V=K.Z.ESC,z=K.Z.HOME,F=K.Z.END,j=[L,D,A,T];function B(e,n){return(function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=(0,l.Z)(e.querySelectorAll("*")).filter(function(e){return I(e,n)});return I(e,n)&&t.unshift(e),t})(e,!0).filter(function(e){return n.has(e)})}function W(e,n,t){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(!e)return null;var o=B(e,n),i=o.length,l=o.findIndex(function(e){return t===e});return r<0?-1===l?l=i-1:l-=1:r>0&&(l+=1),o[l=(l+i)%i]}var H=function(e,n){var t=new Set,r=new Map,o=new Map;return e.forEach(function(e){var i=document.querySelector("[data-menu-id='".concat(h(n,e),"']"));i&&(t.add(i),o.set(i,e),r.set(e,i))}),{elements:t,key2element:r,element2key:o}},Y="__RC_UTIL_PATH_SPLIT__",q=function(e){return e.join(Y)},X="rc-menu-more";function G(e){var n=m.useRef(e);n.current=e;var t=m.useCallback(function(){for(var e,t=arguments.length,r=Array(t),o=0;o1&&(k.motionAppear=!1);var M=k.onVisibleChanged;return(k.onVisibleChanged=function(e){return b.current||e||Z(!0),null==M?void 0:M(e)},g)?null:m.createElement(w,{mode:a,locked:!b.current},m.createElement(eR.ZP,(0,r.Z)({visible:C},k,{forceRender:f,removeOnLeave:!1,leavedClassName:"".concat(s,"-hidden")}),function(e){var t=e.className,r=e.style;return m.createElement(eb,{id:n,className:t,style:r},l)}))}var eN=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],eP=["active"],eS=m.forwardRef(function(e,n){var t=e.style,l=e.className,c=e.title,d=e.eventKey,p=(e.warnKey,e.disabled),v=e.internalPopupClose,b=e.children,y=e.itemIcon,h=e.expandIcon,Z=e.popupClassName,C=e.popupOffset,k=e.popupStyle,M=e.onClick,R=e.onMouseEnter,S=e.onMouseLeave,I=e.onTitleClick,K=e.onTitleMouseEnter,O=e.onTitleMouseLeave,A=(0,a.Z)(e,eN),T=g(d),L=m.useContext(E),D=L.prefixCls,_=L.mode,V=L.openKeys,z=L.disabled,F=L.overflowDisabled,j=L.activeKey,B=L.selectedKeys,W=L.itemIcon,H=L.expandIcon,Y=L.onItemClick,q=L.onOpenChange,X=L.onActive,Q=m.useContext(P)._internalRenderSubMenuItem,U=m.useContext(N).isSubPathKey,J=x(),$="".concat(D,"-submenu"),ee=z||p,en=m.useRef(),et=m.useRef(),er=null!=h?h:H,eu=V.includes(d),ec=!F&&eu,es=U(B,d),ef=eo(d,ee,K,O),ed=ef.active,ep=(0,a.Z)(ef,eP),ev=m.useState(!1),em=(0,u.Z)(ev,2),ey=em[0],eh=em[1],eg=function(e){ee||eh(e)},eZ=m.useMemo(function(){return ed||"inline"!==_&&(ey||U([j],d))},[_,ed,j,ey,d,U]),eC=ei(J.length),eE=G(function(e){null==M||M(ea(e)),Y(e)}),ew=T&&"".concat(T,"-popup"),ek=m.useMemo(function(){return m.createElement(el,{icon:"horizontal"!==_?er:void 0,props:(0,i.Z)((0,i.Z)({},e),{},{isOpen:ec,isSubMenu:!0})},m.createElement("i",{className:"".concat($,"-arrow")}))},[_,er,e,ec,$]),eR=m.createElement("div",(0,r.Z)({role:"menuitem",style:eC,className:"".concat($,"-title"),tabIndex:ee?null:-1,ref:en,title:"string"==typeof c?c:null,"data-menu-id":F&&T?null:T,"aria-expanded":ec,"aria-haspopup":!0,"aria-controls":ew,"aria-disabled":ee,onClick:function(e){ee||(null==I||I({key:d,domEvent:e}),"inline"===_&&q(d,!eu))},onFocus:function(){X(d)}},ep),c,ek),eS=m.useRef(_);if("inline"!==_&&J.length>1?eS.current="vertical":eS.current=_,!F){var eI=eS.current;eR=m.createElement(eM,{mode:eI,prefixCls:$,visible:!v&&ec&&"inline"!==_,popupClassName:Z,popupOffset:C,popupStyle:k,popup:m.createElement(w,{mode:"horizontal"===eI?"vertical":eI},m.createElement(eb,{id:ew,ref:et},b)),disabled:ee,onVisibleChange:function(e){"inline"!==_&&q(d,e)}},eR)}var eK=m.createElement(f.Z.Item,(0,r.Z)({ref:n,role:"none"},A,{component:"li",style:t,className:s()($,"".concat($,"-").concat(_),l,(0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)({},"".concat($,"-open"),ec),"".concat($,"-active"),eZ),"".concat($,"-selected"),es),"".concat($,"-disabled"),ee)),onMouseEnter:function(e){eg(!0),null==R||R({key:d,domEvent:e})},onMouseLeave:function(e){eg(!1),null==S||S({key:d,domEvent:e})}}),eR,!F&&m.createElement(ex,{id:ew,open:ec,keyPath:J},b));return Q&&(eK=Q(eK,e,{selected:es,active:eZ,open:ec,disabled:ee})),m.createElement(w,{onItemClick:eE,mode:"horizontal"===_?"vertical":_,itemIcon:null!=y?y:W,expandIcon:er},eK)}),eI=m.forwardRef(function(e,n){var t,o=e.eventKey,i=e.children,l=x(o),u=eh(i,l),a=M();return m.useEffect(function(){if(a)return a.registerPath(o,l),function(){a.unregisterPath(o,l)}},[l]),t=a?u:m.createElement(eS,(0,r.Z)({ref:n},e),u),m.createElement(R.Provider,{value:l},t)}),eK=t(41154);function eO(e){var n=e.className,t=e.style,r=m.useContext(E).prefixCls;return M()?null:m.createElement("li",{role:"separator",className:s()("".concat(r,"-item-divider"),n),style:t})}var eA=["className","title","eventKey","children"],eT=m.forwardRef(function(e,n){var t=e.className,o=e.title,i=(e.eventKey,e.children),l=(0,a.Z)(e,eA),u=m.useContext(E).prefixCls,c="".concat(u,"-item-group");return m.createElement("li",(0,r.Z)({ref:n,role:"presentation"},l,{onClick:function(e){return e.stopPropagation()},className:s()(c,t)}),m.createElement("div",{role:"presentation",className:"".concat(c,"-title"),title:"string"==typeof o?o:void 0},o),m.createElement("ul",{role:"group",className:"".concat(c,"-list")},i))}),eL=m.forwardRef(function(e,n){var t=e.eventKey,o=eh(e.children,x(t));return M()?o:m.createElement(eT,(0,r.Z)({ref:n},(0,et.Z)(e,["warnKey"])),o)}),eD=["label","children","key","type","extra"];function e_(e,n,t,o,l){var u=e,c=(0,i.Z)({divider:eO,item:ev,group:eL,submenu:eI},o);return n&&(u=function e(n,t,o){var i=t.item,l=t.group,u=t.submenu,c=t.divider;return(n||[]).map(function(n,s){if(n&&"object"===(0,eK.Z)(n)){var f=n.label,d=n.children,p=n.key,v=n.type,b=n.extra,y=(0,a.Z)(n,eD),h=null!=p?p:"tmp-".concat(s);return d||"group"===v?"group"===v?m.createElement(l,(0,r.Z)({key:h},y,{title:f}),e(d,t,o)):m.createElement(u,(0,r.Z)({key:h},y,{title:f}),e(d,t,o)):"divider"===v?m.createElement(c,(0,r.Z)({key:h},y)):m.createElement(i,(0,r.Z)({key:h},y,{extra:b}),f,(!!b||0===b)&&m.createElement("span",{className:"".concat(o,"-item-extra")},b))}return null}).filter(function(e){return e})}(n,c,l)),eh(u,t)}var eV=["prefixCls","rootClassName","style","className","tabIndex","items","children","direction","id","mode","inlineCollapsed","disabled","disabledOverflow","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","defaultOpenKeys","openKeys","activeKey","defaultActiveFirst","selectable","multiple","defaultSelectedKeys","selectedKeys","onSelect","onDeselect","inlineIndent","motion","defaultMotions","triggerSubMenuAction","builtinPlacements","itemIcon","expandIcon","overflowedIndicator","overflowedIndicatorPopupClassName","getPopupContainer","onClick","onOpenChange","onKeyDown","openAnimation","openTransitionName","_internalRenderMenuItem","_internalRenderSubMenuItem","_internalComponents"],ez=[],eF=m.forwardRef(function(e,n){var t,c,v,h,g,Z,C,E,M,R,x,S,I,K,J,$,ee,en,et,er,eo,ei,el,eu,ec,es,ef=e.prefixCls,ed=void 0===ef?"rc-menu":ef,ep=e.rootClassName,em=e.style,eb=e.className,ey=e.tabIndex,eh=e.items,eg=e.children,eZ=e.direction,eC=e.id,eE=e.mode,ew=void 0===eE?"vertical":eE,ek=e.inlineCollapsed,eM=e.disabled,eR=e.disabledOverflow,ex=e.subMenuOpenDelay,eN=e.subMenuCloseDelay,eP=e.forceSubMenuRender,eS=e.defaultOpenKeys,eK=e.openKeys,eO=e.activeKey,eA=e.defaultActiveFirst,eT=e.selectable,eL=void 0===eT||eT,eD=e.multiple,eF=void 0!==eD&&eD,ej=e.defaultSelectedKeys,eB=e.selectedKeys,eW=e.onSelect,eH=e.onDeselect,eY=e.inlineIndent,eq=e.motion,eX=e.defaultMotions,eG=e.triggerSubMenuAction,eQ=e.builtinPlacements,eU=e.itemIcon,eJ=e.expandIcon,e$=e.overflowedIndicator,e0=void 0===e$?"...":e$,e1=e.overflowedIndicatorPopupClassName,e2=e.getPopupContainer,e6=e.onClick,e5=e.onOpenChange,e9=e.onKeyDown,e3=(e.openAnimation,e.openTransitionName,e._internalRenderMenuItem),e4=e._internalRenderSubMenuItem,e8=e._internalComponents,e7=(0,a.Z)(e,eV),ne=m.useMemo(function(){return[e_(eg,eh,ez,e8,ed),e_(eg,eh,ez,{},ed)]},[eg,eh,e8]),nn=(0,u.Z)(ne,2),nt=nn[0],nr=nn[1],no=m.useState(!1),ni=(0,u.Z)(no,2),nl=ni[0],nu=ni[1],na=m.useRef(),nc=(t=(0,d.Z)(eC,{value:eC}),v=(c=(0,u.Z)(t,2))[0],h=c[1],m.useEffect(function(){U+=1;var e="".concat(Q,"-").concat(U);h("rc-menu-uuid-".concat(e))},[]),v),ns="rtl"===eZ,nf=(0,d.Z)(eS,{value:eK,postState:function(e){return e||ez}}),nd=(0,u.Z)(nf,2),np=nd[0],nv=nd[1],nm=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];function t(){nv(e),null==e5||e5(e)}n?(0,b.flushSync)(t):t()},nb=m.useState(np),ny=(0,u.Z)(nb,2),nh=ny[0],ng=ny[1],nZ=m.useRef(!1),nC=m.useMemo(function(){return("inline"===ew||"vertical"===ew)&&ek?["vertical",ek]:[ew,!1]},[ew,ek]),nE=(0,u.Z)(nC,2),nw=nE[0],nk=nE[1],nM="inline"===nw,nR=m.useState(nw),nx=(0,u.Z)(nR,2),nN=nx[0],nP=nx[1],nS=m.useState(nk),nI=(0,u.Z)(nS,2),nK=nI[0],nO=nI[1];m.useEffect(function(){nP(nw),nO(nk),nZ.current&&(nM?nv(nh):nm(ez))},[nw,nk]);var nA=m.useState(0),nT=(0,u.Z)(nA,2),nL=nT[0],nD=nT[1],n_=nL>=nt.length-1||"horizontal"!==nN||eR;m.useEffect(function(){nM&&ng(np)},[np]),m.useEffect(function(){return nZ.current=!0,function(){nZ.current=!1}},[]);var nV=(g=m.useState({}),Z=(0,u.Z)(g,2)[1],C=(0,m.useRef)(new Map),E=(0,m.useRef)(new Map),M=m.useState([]),x=(R=(0,u.Z)(M,2))[0],S=R[1],I=(0,m.useRef)(0),K=(0,m.useRef)(!1),J=function(){K.current||Z({})},$=(0,m.useCallback)(function(e,n){var t,r=q(n);E.current.set(r,e),C.current.set(e,r),I.current+=1;var o=I.current;t=function(){o===I.current&&J()},Promise.resolve().then(t)},[]),ee=(0,m.useCallback)(function(e,n){var t=q(n);E.current.delete(t),C.current.delete(e)},[]),en=(0,m.useCallback)(function(e){S(e)},[]),et=(0,m.useCallback)(function(e,n){var t=(C.current.get(e)||"").split(Y);return n&&x.includes(t[0])&&t.unshift(X),t},[x]),er=(0,m.useCallback)(function(e,n){return e.filter(function(e){return void 0!==e}).some(function(e){return et(e,!0).includes(n)})},[et]),eo=(0,m.useCallback)(function(e){var n="".concat(C.current.get(e)).concat(Y),t=new Set;return(0,l.Z)(E.current.keys()).forEach(function(e){e.startsWith(n)&&t.add(E.current.get(e))}),t},[]),m.useEffect(function(){return function(){K.current=!0}},[]),{registerPath:$,unregisterPath:ee,refreshOverflowKeys:en,isSubPathKey:er,getKeyPath:et,getKeys:function(){var e=(0,l.Z)(C.current.keys());return x.length&&e.push(X),e},getSubPathKeys:eo}),nz=nV.registerPath,nF=nV.unregisterPath,nj=nV.refreshOverflowKeys,nB=nV.isSubPathKey,nW=nV.getKeyPath,nH=nV.getKeys,nY=nV.getSubPathKeys,nq=m.useMemo(function(){return{registerPath:nz,unregisterPath:nF}},[nz,nF]),nX=m.useMemo(function(){return{isSubPathKey:nB}},[nB]);m.useEffect(function(){nj(n_?ez:nt.slice(nL+1).map(function(e){return e.key}))},[nL,n_]);var nG=(0,d.Z)(eO||eA&&(null===(es=nt[0])||void 0===es?void 0:es.key),{value:eO}),nQ=(0,u.Z)(nG,2),nU=nQ[0],nJ=nQ[1],n$=G(function(e){nJ(e)}),n0=G(function(){nJ(void 0)});(0,m.useImperativeHandle)(n,function(){return{list:na.current,focus:function(e){var n,t,r=H(nH(),nc),o=r.elements,i=r.key2element,l=r.element2key,u=B(na.current,o),a=null!=nU?nU:u[0]?l.get(u[0]):null===(n=nt.find(function(e){return!e.props.disabled}))||void 0===n?void 0:n.key,c=i.get(a);a&&c&&(null==c||null===(t=c.focus)||void 0===t||t.call(c,e))}}});var n1=(0,d.Z)(ej||[],{value:eB,postState:function(e){return Array.isArray(e)?e:null==e?ez:[e]}}),n2=(0,u.Z)(n1,2),n6=n2[0],n5=n2[1],n9=function(e){if(eL){var n,t=e.key,r=n6.includes(t);n5(n=eF?r?n6.filter(function(e){return e!==t}):[].concat((0,l.Z)(n6),[t]):[t]);var o=(0,i.Z)((0,i.Z)({},e),{},{selectedKeys:n});r?null==eH||eH(o):null==eW||eW(o)}!eF&&np.length&&"inline"!==nN&&nm(ez)},n3=G(function(e){null==e6||e6(ea(e)),n9(e)}),n4=G(function(e,n){var t=np.filter(function(n){return n!==e});if(n)t.push(e);else if("inline"!==nN){var r=nY(e);t=t.filter(function(e){return!r.has(e)})}(0,p.Z)(np,t,!0)||nm(t,!0)}),n8=(ei=function(e,n){var t=null!=n?n:!np.includes(e);n4(e,t)},el=m.useRef(),(eu=m.useRef()).current=nU,ec=function(){O.Z.cancel(el.current)},m.useEffect(function(){return function(){ec()}},[]),function(e){var n=e.which;if([].concat(j,[_,V,z,F]).includes(n)){var t=nH(),r=H(t,nc),i=r,l=i.elements,u=i.key2element,a=i.element2key,c=function(e,n){for(var t=e||document.activeElement;t;){if(n.has(t))return t;t=t.parentElement}return null}(u.get(nU),l),s=a.get(c),f=function(e,n,t,r){var i,l="prev",u="next",a="children",c="parent";if("inline"===e&&r===_)return{inlineTrigger:!0};var s=(0,o.Z)((0,o.Z)({},L,l),D,u),f=(0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)({},A,t?u:l),T,t?l:u),D,a),_,a),d=(0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)({},L,l),D,u),_,a),V,c),A,t?a:c),T,t?c:a);switch(null===(i=({inline:s,horizontal:f,vertical:d,inlineSub:s,horizontalSub:d,verticalSub:d})["".concat(e).concat(n?"":"Sub")])||void 0===i?void 0:i[r]){case l:return{offset:-1,sibling:!0};case u:return{offset:1,sibling:!0};case c:return{offset:-1,sibling:!1};case a:return{offset:1,sibling:!1};default:return null}}(nN,1===nW(s,!0).length,ns,n);if(!f&&n!==z&&n!==F)return;(j.includes(n)||[z,F].includes(n))&&e.preventDefault();var d=function(e){if(e){var n=e,t=e.querySelector("a");null!=t&&t.getAttribute("href")&&(n=t);var r=a.get(e);nJ(r),ec(),el.current=(0,O.Z)(function(){eu.current===r&&n.focus()})}};if([z,F].includes(n)||f.sibling||!c){var p,v=B(p=c&&"inline"!==nN?function(e){for(var n=e;n;){if(n.getAttribute("data-menu-list"))return n;n=n.parentElement}return null}(c):na.current,l);d(n===z?v[0]:n===F?v[v.length-1]:W(p,l,c,f.offset))}else if(f.inlineTrigger)ei(s);else if(f.offset>0)ei(s,!0),ec(),el.current=(0,O.Z)(function(){r=H(t,nc);var e=c.getAttribute("aria-controls");d(W(document.getElementById(e),r.elements))},5);else if(f.offset<0){var m=nW(s,!0),b=m[m.length-2],y=u.get(b);ei(b,!1),d(y)}}null==e9||e9(e)});m.useEffect(function(){nu(!0)},[]);var n7=m.useMemo(function(){return{_internalRenderMenuItem:e3,_internalRenderSubMenuItem:e4}},[e3,e4]),te="horizontal"!==nN||eR?nt:nt.map(function(e,n){return m.createElement(w,{key:e.key,overflowDisabled:n>nL},e)}),tn=m.createElement(f.Z,(0,r.Z)({id:eC,ref:na,prefixCls:"".concat(ed,"-overflow"),component:"ul",itemComponent:ev,className:s()(ed,"".concat(ed,"-root"),"".concat(ed,"-").concat(nN),eb,(0,o.Z)((0,o.Z)({},"".concat(ed,"-inline-collapsed"),nK),"".concat(ed,"-rtl"),ns),ep),dir:eZ,style:em,role:"menu",tabIndex:void 0===ey?0:ey,data:te,renderRawItem:function(e){return e},renderRawRest:function(e){var n=e.length,t=n?nt.slice(-n):null;return m.createElement(eI,{eventKey:X,title:e0,disabled:n_,internalPopupClose:0===n,popupClassName:e1},t)},maxCount:"horizontal"!==nN||eR?f.Z.INVALIDATE:f.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(e){nD(e)},onKeyDown:n8},e7));return m.createElement(P.Provider,{value:n7},m.createElement(y.Provider,{value:nc},m.createElement(w,{prefixCls:ed,rootClassName:ep,mode:nN,openKeys:np,rtl:ns,disabled:eM,motion:nl?eq:null,defaultMotions:nl?eX:null,activeKey:nU,onActive:n$,onInactive:n0,selectedKeys:n6,inlineIndent:void 0===eY?24:eY,subMenuOpenDelay:void 0===ex?.1:ex,subMenuCloseDelay:void 0===eN?.1:eN,forceSubMenuRender:eP,builtinPlacements:eQ,triggerSubMenuAction:void 0===eG?"hover":eG,getPopupContainer:e2,itemIcon:eU,expandIcon:eJ,onItemClick:n3,onOpenChange:n4},m.createElement(N.Provider,{value:nX},tn),m.createElement("div",{style:{display:"none"},"aria-hidden":!0},m.createElement(k.Provider,{value:nq},nr)))))});eF.Item=ev,eF.SubMenu=eI,eF.ItemGroup=eL,eF.Divider=eO;var ej=eF}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/3705-1dcdbda1985a6786.js b/litellm/proxy/_experimental/out/_next/static/chunks/3705-05649f5df18d8716.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/3705-1dcdbda1985a6786.js rename to litellm/proxy/_experimental/out/_next/static/chunks/3705-05649f5df18d8716.js index 71279395fe..7d1ccec065 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/3705-1dcdbda1985a6786.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/3705-05649f5df18d8716.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3705],{15327:function(e,t,n){n.d(t,{Z:function(){return l}});var o=n(1119),a=n(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},r=n(55015),l=a.forwardRef(function(e,t){return a.createElement(r.Z,(0,o.Z)({},e,{ref:t,icon:c}))})},73705:function(e,t,n){n.d(t,{Z:function(){return _}});var o=n(2265),a=n(15327),c=n(77565),r=n(36760),l=n.n(r),i=n(71030),d=n(58525),s=n(50506),u=n(18694),m=n(62236),p=e=>"object"!=typeof e&&"function"!=typeof e||null===e,g=n(92736),b=n(93942),f=n(19722),v=n(13613),h=n(95140),y=n(71744),I=n(64024),x=n(60985),w=n(88208),S=n(84951),C=n(93463),O=n(12918),B=n(18544),k=n(29382),j=n(691),E=n(88260),z=n(34442),N=n(99320),H=n(71140),T=e=>{let{componentCls:t,menuCls:n,colorError:o,colorTextLightSolid:a}=e,c="".concat(n,"-item");return{["".concat(t,", ").concat(t,"-menu-submenu")]:{["".concat(n," ").concat(c)]:{["&".concat(c,"-danger:not(").concat(c,"-disabled)")]:{color:o,"&:hover":{color:a,backgroundColor:o}}}}}};let P=e=>{let{componentCls:t,menuCls:n,zIndexPopup:o,dropdownArrowDistance:a,sizePopupArrow:c,antCls:r,iconCls:l,motionDurationMid:i,paddingBlock:d,fontSize:s,dropdownEdgeChildPadding:u,colorTextDisabled:m,fontSizeIcon:p,controlPaddingHorizontal:g,colorBgElevated:b}=e;return[{[t]:{position:"absolute",top:-9999,left:{_skip_check_:!0,value:-9999},zIndex:o,display:"block","&::before":{position:"absolute",insetBlock:e.calc(c).div(2).sub(a).equal(),zIndex:-9999,opacity:1e-4,content:'""'},"&-menu-vertical":{maxHeight:"100vh",overflowY:"auto"},["&-trigger".concat(r,"-btn")]:{["& > ".concat(l,"-down, & > ").concat(r,"-btn-icon > ").concat(l,"-down")]:{fontSize:p}},["".concat(t,"-wrap")]:{position:"relative",["".concat(r,"-btn > ").concat(l,"-down")]:{fontSize:p},["".concat(l,"-down::before")]:{transition:"transform ".concat(i)}},["".concat(t,"-wrap-open")]:{["".concat(l,"-down::before")]:{transform:"rotate(180deg)"}},"\n &-hidden,\n &-menu-hidden,\n &-menu-submenu-hidden\n ":{display:"none"},["&".concat(r,"-slide-down-enter").concat(r,"-slide-down-enter-active").concat(t,"-placement-bottomLeft,\n &").concat(r,"-slide-down-appear").concat(r,"-slide-down-appear-active").concat(t,"-placement-bottomLeft,\n &").concat(r,"-slide-down-enter").concat(r,"-slide-down-enter-active").concat(t,"-placement-bottom,\n &").concat(r,"-slide-down-appear").concat(r,"-slide-down-appear-active").concat(t,"-placement-bottom,\n &").concat(r,"-slide-down-enter").concat(r,"-slide-down-enter-active").concat(t,"-placement-bottomRight,\n &").concat(r,"-slide-down-appear").concat(r,"-slide-down-appear-active").concat(t,"-placement-bottomRight")]:{animationName:B.fJ},["&".concat(r,"-slide-up-enter").concat(r,"-slide-up-enter-active").concat(t,"-placement-topLeft,\n &").concat(r,"-slide-up-appear").concat(r,"-slide-up-appear-active").concat(t,"-placement-topLeft,\n &").concat(r,"-slide-up-enter").concat(r,"-slide-up-enter-active").concat(t,"-placement-top,\n &").concat(r,"-slide-up-appear").concat(r,"-slide-up-appear-active").concat(t,"-placement-top,\n &").concat(r,"-slide-up-enter").concat(r,"-slide-up-enter-active").concat(t,"-placement-topRight,\n &").concat(r,"-slide-up-appear").concat(r,"-slide-up-appear-active").concat(t,"-placement-topRight")]:{animationName:B.Qt},["&".concat(r,"-slide-down-leave").concat(r,"-slide-down-leave-active").concat(t,"-placement-bottomLeft,\n &").concat(r,"-slide-down-leave").concat(r,"-slide-down-leave-active").concat(t,"-placement-bottom,\n &").concat(r,"-slide-down-leave").concat(r,"-slide-down-leave-active").concat(t,"-placement-bottomRight")]:{animationName:B.Uw},["&".concat(r,"-slide-up-leave").concat(r,"-slide-up-leave-active").concat(t,"-placement-topLeft,\n &").concat(r,"-slide-up-leave").concat(r,"-slide-up-leave-active").concat(t,"-placement-top,\n &").concat(r,"-slide-up-leave").concat(r,"-slide-up-leave-active").concat(t,"-placement-topRight")]:{animationName:B.ly}}},(0,E.ZP)(e,b,{arrowPlacement:{top:!0,bottom:!0}}),{["".concat(t," ").concat(n)]:{position:"relative",margin:0},["".concat(n,"-submenu-popup")]:{position:"absolute",zIndex:o,background:"transparent",boxShadow:"none",transformOrigin:"0 0","ul, li":{listStyle:"none",margin:0}},["".concat(t,", ").concat(t,"-menu-submenu")]:Object.assign(Object.assign({},(0,O.Wf)(e)),{[n]:Object.assign(Object.assign({padding:u,listStyleType:"none",backgroundColor:b,backgroundClip:"padding-box",borderRadius:e.borderRadiusLG,outline:"none",boxShadow:e.boxShadowSecondary},(0,O.Qy)(e)),{"&:empty":{padding:0,boxShadow:"none"},["".concat(n,"-item-group-title")]:{padding:"".concat((0,C.bf)(d)," ").concat((0,C.bf)(g)),color:e.colorTextDescription,transition:"all ".concat(i)},["".concat(n,"-item")]:{position:"relative",display:"flex",alignItems:"center"},["".concat(n,"-item-icon")]:{minWidth:s,marginInlineEnd:e.marginXS,fontSize:e.fontSizeSM},["".concat(n,"-title-content")]:{flex:"auto","&-with-extra":{display:"inline-flex",alignItems:"center",width:"100%"},"> a":{color:"inherit",transition:"all ".concat(i),"&:hover":{color:"inherit"},"&::after":{position:"absolute",inset:0,content:'""'}},["".concat(n,"-item-extra")]:{paddingInlineStart:e.padding,marginInlineStart:"auto",fontSize:e.fontSizeSM,color:e.colorTextDescription}},["".concat(n,"-item, ").concat(n,"-submenu-title")]:Object.assign(Object.assign({display:"flex",margin:0,padding:"".concat((0,C.bf)(d)," ").concat((0,C.bf)(g)),color:e.colorText,fontWeight:"normal",fontSize:s,lineHeight:e.lineHeight,cursor:"pointer",transition:"all ".concat(i),borderRadius:e.borderRadiusSM,"&:hover, &-active":{backgroundColor:e.controlItemBgHover}},(0,O.Qy)(e)),{"&-selected":{color:e.colorPrimary,backgroundColor:e.controlItemBgActive,"&:hover, &-active":{backgroundColor:e.controlItemBgActiveHover}},"&-disabled":{color:m,cursor:"not-allowed","&:hover":{color:m,backgroundColor:b,cursor:"not-allowed"},a:{pointerEvents:"none"}},"&-divider":{height:1,margin:"".concat((0,C.bf)(e.marginXXS)," 0"),overflow:"hidden",lineHeight:0,backgroundColor:e.colorSplit},["".concat(t,"-menu-submenu-expand-icon")]:{position:"absolute",insetInlineEnd:e.paddingXS,["".concat(t,"-menu-submenu-arrow-icon")]:{marginInlineEnd:"0 !important",color:e.colorIcon,fontSize:p,fontStyle:"normal"}}}),["".concat(n,"-item-group-list")]:{margin:"0 ".concat((0,C.bf)(e.marginXS)),padding:0,listStyle:"none"},["".concat(n,"-submenu-title")]:{paddingInlineEnd:e.calc(g).add(e.fontSizeSM).equal()},["".concat(n,"-submenu-vertical")]:{position:"relative"},["".concat(n,"-submenu").concat(n,"-submenu-disabled ").concat(t,"-menu-submenu-title")]:{["&, ".concat(t,"-menu-submenu-arrow-icon")]:{color:m,backgroundColor:b,cursor:"not-allowed"}},["".concat(n,"-submenu-selected ").concat(t,"-menu-submenu-title")]:{color:e.colorPrimary}})})},[(0,B.oN)(e,"slide-up"),(0,B.oN)(e,"slide-down"),(0,k.Fm)(e,"move-up"),(0,k.Fm)(e,"move-down"),(0,j._y)(e,"zoom-big")]]};var R=(0,N.I$)("Dropdown",e=>{let{marginXXS:t,sizePopupArrow:n,paddingXXS:o,componentCls:a}=e,c=(0,H.IX)(e,{menuCls:"".concat(a,"-menu"),dropdownArrowDistance:e.calc(n).div(2).add(t).equal(),dropdownEdgeChildPadding:o});return[P(c),T(c)]},e=>Object.assign(Object.assign({zIndexPopup:e.zIndexPopupBase+50,paddingBlock:(e.controlHeight-e.fontSize*e.lineHeight)/2},(0,E.wZ)({contentRadius:e.borderRadiusLG,limitVerticalRadius:!0})),(0,z.w)(e)),{resetStyle:!1});let Z=e=>{var t;let{menu:n,arrow:r,prefixCls:b,children:C,trigger:O,disabled:B,dropdownRender:k,popupRender:j,getPopupContainer:E,overlayClassName:z,rootClassName:N,overlayStyle:H,open:T,onOpenChange:P,visible:Z,onVisibleChange:M,mouseEnterDelay:D=.15,mouseLeaveDelay:A=.1,autoAdjustOverflow:W=!0,placement:L="",overlay:G,transitionName:X,destroyOnHidden:_,destroyPopupOnHide:q}=e,{getPopupContainer:F,getPrefixCls:Y,direction:V,dropdown:$}=o.useContext(y.E_),J=j||k;(0,v.ln)("Dropdown");let Q=o.useMemo(()=>{let e=Y();return void 0!==X?X:L.includes("top")?"".concat(e,"-slide-down"):"".concat(e,"-slide-up")},[Y,L,X]),U=o.useMemo(()=>L?L.includes("Center")?L.slice(0,L.indexOf("Center")):L:"rtl"===V?"bottomRight":"bottomLeft",[L,V]),K=Y("dropdown",b),ee=(0,I.Z)(K),[et,en,eo]=R(K,ee),[,ea]=(0,S.ZP)(),ec=o.Children.only(p(C)?o.createElement("span",null,C):C),er=(0,f.Tm)(ec,{className:l()("".concat(K,"-trigger"),{["".concat(K,"-rtl")]:"rtl"===V},ec.props.className),disabled:null!==(t=ec.props.disabled)&&void 0!==t?t:B}),el=B?[]:O,ei=!!(null==el?void 0:el.includes("contextMenu")),[ed,es]=(0,s.Z)(!1,{value:null!=T?T:Z}),eu=(0,d.Z)(e=>{null==P||P(e,{source:"trigger"}),null==M||M(e),es(e)}),em=l()(z,N,en,eo,ee,null==$?void 0:$.className,{["".concat(K,"-rtl")]:"rtl"===V}),ep=(0,g.Z)({arrowPointAtCenter:"object"==typeof r&&r.pointAtCenter,autoAdjustOverflow:W,offset:ea.marginXXS,arrowWidth:r?ea.sizePopupArrow:0,borderRadius:ea.borderRadius}),eg=(0,d.Z)(()=>{null!=n&&n.selectable&&null!=n&&n.multiple||(null==P||P(!1,{source:"menu"}),es(!1))}),[eb,ef]=(0,m.Cn)("Dropdown",null==H?void 0:H.zIndex),ev=o.createElement(i.Z,Object.assign({alignPoint:ei},(0,u.Z)(e,["rootClassName"]),{mouseEnterDelay:D,mouseLeaveDelay:A,visible:ed,builtinPlacements:ep,arrow:!!r,overlayClassName:em,prefixCls:K,getPopupContainer:E||F,transitionName:Q,trigger:el,overlay:()=>{let e;return e=(null==n?void 0:n.items)?o.createElement(x.Z,Object.assign({},n)):"function"==typeof G?G():G,J&&(e=J(e)),e=o.Children.only("string"==typeof e?o.createElement("span",null,e):e),o.createElement(w.J,{prefixCls:"".concat(K,"-menu"),rootClassName:l()(eo,ee),expandIcon:o.createElement("span",{className:"".concat(K,"-menu-submenu-arrow")},"rtl"===V?o.createElement(a.Z,{className:"".concat(K,"-menu-submenu-arrow-icon")}):o.createElement(c.Z,{className:"".concat(K,"-menu-submenu-arrow-icon")})),mode:"vertical",selectable:!1,onClick:eg,validator:e=>{let{mode:t}=e}},e)},placement:U,onVisibleChange:eu,overlayStyle:Object.assign(Object.assign(Object.assign({},null==$?void 0:$.style),H),{zIndex:eb}),autoDestroy:null!=_?_:q}),er);return eb&&(ev=o.createElement(h.Z.Provider,{value:ef},ev)),et(ev)},M=(0,b.Z)(Z,"align",void 0,"dropdown",e=>e);Z._InternalPanelDoNotUseOrYouWillBeFired=e=>o.createElement(M,Object.assign({},e),o.createElement("span",null));var D=n(60440),A=n(5545),W=n(58760),L=n(77685),G=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};let X=e=>{let{getPopupContainer:t,getPrefixCls:n,direction:a}=o.useContext(y.E_),{prefixCls:c,type:r="default",danger:i,disabled:d,loading:s,onClick:u,htmlType:m,children:p,className:g,menu:b,arrow:f,autoFocus:v,overlay:h,trigger:I,align:x,open:w,onOpenChange:S,placement:C,getPopupContainer:O,href:B,icon:k=o.createElement(D.Z,null),title:j,buttonsRender:E=e=>e,mouseEnterDelay:z,mouseLeaveDelay:N,overlayClassName:H,overlayStyle:T,destroyOnHidden:P,destroyPopupOnHide:R,dropdownRender:M,popupRender:X}=e,_=G(e,["prefixCls","type","danger","disabled","loading","onClick","htmlType","children","className","menu","arrow","autoFocus","overlay","trigger","align","open","onOpenChange","placement","getPopupContainer","href","icon","title","buttonsRender","mouseEnterDelay","mouseLeaveDelay","overlayClassName","overlayStyle","destroyOnHidden","destroyPopupOnHide","dropdownRender","popupRender"]),q=n("dropdown",c),F={menu:b,arrow:f,autoFocus:v,align:x,disabled:d,trigger:d?[]:I,onOpenChange:S,getPopupContainer:O||t,mouseEnterDelay:z,mouseLeaveDelay:N,overlayClassName:H,overlayStyle:T,destroyOnHidden:P,popupRender:X||M},{compactSize:Y,compactItemClassnames:V}=(0,L.ri)(q,a),$=l()("".concat(q,"-button"),V,g);"destroyPopupOnHide"in e&&(F.destroyPopupOnHide=R),"overlay"in e&&(F.overlay=h),"open"in e&&(F.open=w),"placement"in e?F.placement=C:F.placement="rtl"===a?"bottomLeft":"bottomRight";let[J,Q]=E([o.createElement(A.ZP,{type:r,danger:i,disabled:d,loading:s,onClick:u,htmlType:m,href:B,title:j},p),o.createElement(A.ZP,{type:r,danger:i,icon:k})]);return o.createElement(W.Z.Compact,Object.assign({className:$,size:Y,block:!0},_),J,o.createElement(Z,Object.assign({},F),Q))};X.__ANT_BUTTON=!0,Z.Button=X;var _=Z},32186:function(e,t,n){let o;n.d(t,{D:function(){return S},Z:function(){return O}});var a=n(2265),c=n(1119),r={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"bars",theme:"outlined"},l=n(55015),i=a.forwardRef(function(e,t){return a.createElement(l.Z,(0,c.Z)({},e,{ref:t,icon:r}))}),d=n(15327),s=n(77565),u=n(36760),m=n.n(u),p=n(18694),g=n(16774),b=n(71744),f=n(80856),v=n(93463),h=n(25437),y=(0,n(99320).I$)(["Layout","Sider"],e=>{let{componentCls:t,siderBg:n,motionDurationMid:o,motionDurationSlow:a,antCls:c,triggerHeight:r,triggerColor:l,triggerBg:i,headerHeight:d,zeroTriggerWidth:s,zeroTriggerHeight:u,borderRadiusLG:m,lightSiderBg:p,lightTriggerColor:g,lightTriggerBg:b,bodyBg:f}=e;return{[t]:{position:"relative",minWidth:0,background:n,transition:"all ".concat(o,", background 0s"),"&-has-trigger":{paddingBottom:r},"&-right":{order:1},["".concat(t,"-children")]:{height:"100%",marginTop:-.1,paddingTop:.1,["".concat(c,"-menu").concat(c,"-menu-inline-collapsed")]:{width:"auto"}},["&-zero-width ".concat(t,"-children")]:{overflow:"hidden"},["".concat(t,"-trigger")]:{position:"fixed",bottom:0,zIndex:1,height:r,color:l,lineHeight:(0,v.bf)(r),textAlign:"center",background:i,cursor:"pointer",transition:"all ".concat(o)},["".concat(t,"-zero-width-trigger")]:{position:"absolute",top:d,insetInlineEnd:e.calc(s).mul(-1).equal(),zIndex:1,width:s,height:u,color:l,fontSize:e.fontSizeXL,display:"flex",alignItems:"center",justifyContent:"center",background:n,borderRadius:"0 ".concat((0,v.bf)(m)," ").concat((0,v.bf)(m)," 0"),cursor:"pointer",transition:"background ".concat(a," ease"),"&::after":{position:"absolute",inset:0,background:"transparent",transition:"all ".concat(a),content:'""'},"&:hover::after":{background:"rgba(255, 255, 255, 0.2)"},"&-right":{insetInlineStart:e.calc(s).mul(-1).equal(),borderRadius:"".concat((0,v.bf)(m)," 0 0 ").concat((0,v.bf)(m))}},"&-light":{background:p,["".concat(t,"-trigger")]:{color:g,background:b},["".concat(t,"-zero-width-trigger")]:{color:g,background:b,border:"1px solid ".concat(f),borderInlineStart:0}}}}},h.eh,{deprecatedTokens:h.jn}),I=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};let x={xs:"479.98px",sm:"575.98px",md:"767.98px",lg:"991.98px",xl:"1199.98px",xxl:"1599.98px"},w=e=>!Number.isNaN(Number.parseFloat(e))&&Number.isFinite(Number(e)),S=a.createContext({}),C=(o=0,function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return o+=1,"".concat(e).concat(o)});var O=a.forwardRef((e,t)=>{let{prefixCls:n,className:o,trigger:c,children:r,defaultCollapsed:l=!1,theme:u="dark",style:v={},collapsible:h=!1,reverseArrow:O=!1,width:B=200,collapsedWidth:k=80,zeroWidthTriggerStyle:j,breakpoint:E,onCollapse:z,onBreakpoint:N}=e,H=I(e,["prefixCls","className","trigger","children","defaultCollapsed","theme","style","collapsible","reverseArrow","width","collapsedWidth","zeroWidthTriggerStyle","breakpoint","onCollapse","onBreakpoint"]),{siderHook:T}=(0,a.useContext)(f.V),[P,R]=(0,a.useState)("collapsed"in e?e.collapsed:l),[Z,M]=(0,a.useState)(!1);(0,a.useEffect)(()=>{"collapsed"in e&&R(e.collapsed)},[e.collapsed]);let D=(t,n)=>{"collapsed"in e||R(t),null==z||z(t,n)},{getPrefixCls:A,direction:W}=(0,a.useContext)(b.E_),L=A("layout-sider",n),[G,X,_]=y(L),q=(0,a.useRef)(null);q.current=e=>{M(e.matches),null==N||N(e.matches),P!==e.matches&&D(e.matches,"responsive")},(0,a.useEffect)(()=>{let e;function t(e){var t;return null===(t=q.current)||void 0===t?void 0:t.call(q,e)}return void 0!==(null==window?void 0:window.matchMedia)&&E&&E in x&&(e=window.matchMedia("screen and (max-width: ".concat(x[E],")")),(0,g.x)(e,t),t(e)),()=>{(0,g.h)(e,t)}},[E]),(0,a.useEffect)(()=>{let e=C("ant-sider-");return T.addSider(e),()=>T.removeSider(e)},[]);let F=()=>{D(!P,"clickTrigger")},Y=(0,p.Z)(H,["collapsed"]),V=P?k:B,$=w(V)?"".concat(V,"px"):String(V),J=0===Number.parseFloat(String(k||0))?a.createElement("span",{onClick:F,className:m()("".concat(L,"-zero-width-trigger"),"".concat(L,"-zero-width-trigger-").concat(O?"right":"left")),style:j},c||a.createElement(i,null)):null,Q="rtl"===W==!O,U={expanded:Q?a.createElement(s.Z,null):a.createElement(d.Z,null),collapsed:Q?a.createElement(d.Z,null):a.createElement(s.Z,null)}[P?"collapsed":"expanded"],K=null!==c?J||a.createElement("div",{className:"".concat(L,"-trigger"),onClick:F,style:{width:$}},c||U):null,ee=Object.assign(Object.assign({},v),{flex:"0 0 ".concat($),maxWidth:$,minWidth:$,width:$}),et=m()(L,"".concat(L,"-").concat(u),{["".concat(L,"-collapsed")]:!!P,["".concat(L,"-has-trigger")]:h&&null!==c&&!J,["".concat(L,"-below")]:!!Z,["".concat(L,"-zero-width")]:0===Number.parseFloat($)},o,X,_),en=a.useMemo(()=>({siderCollapsed:P}),[P]);return G(a.createElement(S.Provider,{value:en},a.createElement("aside",Object.assign({className:et},Y,{style:ee,ref:t}),a.createElement("div",{className:"".concat(L,"-children")},r),h||Z&&J?K:null)))})},80856:function(e,t,n){n.d(t,{V:function(){return o}});let o=n(2265).createContext({siderHook:{addSider:()=>null,removeSider:()=>null}})},25437:function(e,t,n){n.d(t,{eh:function(){return c},jn:function(){return r}});var o=n(93463),a=n(99320);let c=e=>{let{colorBgLayout:t,controlHeight:n,controlHeightLG:o,colorText:a,controlHeightSM:c,marginXXS:r,colorTextLightSolid:l,colorBgContainer:i}=e,d=1.25*o;return{colorBgHeader:"#001529",colorBgBody:t,colorBgTrigger:"#002140",bodyBg:t,headerBg:"#001529",headerHeight:2*n,headerPadding:"0 ".concat(d,"px"),headerColor:a,footerPadding:"".concat(c,"px ").concat(d,"px"),footerBg:t,siderBg:"#001529",triggerHeight:o+2*r,triggerBg:"#002140",triggerColor:l,zeroTriggerWidth:o,zeroTriggerHeight:o,lightSiderBg:i,lightTriggerBg:i,lightTriggerColor:a}},r=[["colorBgBody","bodyBg"],["colorBgHeader","headerBg"],["colorBgTrigger","triggerBg"]];t.ZP=(0,a.I$)("Layout",e=>{let{antCls:t,componentCls:n,colorText:a,footerBg:c,headerHeight:r,headerPadding:l,headerColor:i,footerPadding:d,fontSize:s,bodyBg:u,headerBg:m}=e;return{[n]:{display:"flex",flex:"auto",flexDirection:"column",minHeight:0,background:u,"&, *":{boxSizing:"border-box"},["&".concat(n,"-has-sider")]:{flexDirection:"row",["> ".concat(n,", > ").concat(n,"-content")]:{width:0}},["".concat(n,"-header, &").concat(n,"-footer")]:{flex:"0 0 auto"},"&-rtl":{direction:"rtl"}},["".concat(n,"-header")]:{height:r,padding:l,color:i,lineHeight:(0,o.bf)(r),background:m,["".concat(t,"-menu")]:{lineHeight:"inherit"}},["".concat(n,"-footer")]:{padding:d,color:a,fontSize:s,background:c},["".concat(n,"-content")]:{flex:"auto",color:a,minHeight:0}}},c,{deprecatedTokens:r})},88208:function(e,t,n){n.d(t,{J:function(){return i}});var o=n(2265),a=n(28791),c=n(391),r=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};let l=o.createContext(null),i=o.forwardRef((e,t)=>{let{children:n}=e,i=r(e,["children"]),d=o.useContext(l),s=o.useMemo(()=>Object.assign(Object.assign({},d),i),[d,i.prefixCls,i.mode,i.selectable,i.rootClassName]),u=(0,a.t4)(n),m=(0,a.x1)(t,u?(0,a.C4)(n):null);return o.createElement(l.Provider,{value:s},o.createElement(c.Z,{space:!0},u?o.cloneElement(n,{ref:m}):n))});t.Z=l},60985:function(e,t,n){n.d(t,{Z:function(){return Y}});var o=n(2265),a=n(33082),c=n(32186),r=n(60440),l=n(36760),i=n.n(l),d=n(58525),s=n(18694),u=n(68710),m=n(19722),p=n(71744),g=n(64024);let b=(0,o.createContext)({prefixCls:"",firstLevel:!0,inlineCollapsed:!1});var f=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n},v=e=>{let{prefixCls:t,className:n,dashed:c}=e,r=f(e,["prefixCls","className","dashed"]),{getPrefixCls:l}=o.useContext(p.E_),d=l("menu",t),s=i()({["".concat(d,"-item-divider-dashed")]:!!c},n);return o.createElement(a.iz,Object.assign({className:s},r))},h=n(45287),y=n(99981),I=e=>{var t;let{className:n,children:r,icon:l,title:d,danger:u,extra:p}=e,{prefixCls:g,firstLevel:f,direction:v,disableMenuItemTitleTooltip:I,inlineCollapsed:x}=o.useContext(b),{siderCollapsed:w}=o.useContext(c.D),S=d;void 0===d?S=f?r:"":!1===d&&(S="");let C={title:S};w||x||(C.title=null,C.open=!1);let O=(0,h.Z)(r).length,B=o.createElement(a.ck,Object.assign({},(0,s.Z)(e,["title","icon","danger"]),{className:i()({["".concat(g,"-item-danger")]:u,["".concat(g,"-item-only-child")]:(l?O+1:O)===1},n),title:"string"==typeof d?d:void 0}),(0,m.Tm)(l,{className:i()(o.isValidElement(l)?null===(t=l.props)||void 0===t?void 0:t.className:void 0,"".concat(g,"-item-icon"))}),(e=>{let t=null==r?void 0:r[0],n=o.createElement("span",{className:i()("".concat(g,"-title-content"),{["".concat(g,"-title-content-with-extra")]:!!p||0===p})},r);return(!l||o.isValidElement(r)&&"span"===r.type)&&r&&e&&f&&"string"==typeof t?o.createElement("div",{className:"".concat(g,"-inline-collapsed-noicon")},t.charAt(0)):n})(x));return I||(B=o.createElement(y.Z,Object.assign({},C,{placement:"rtl"===v?"left":"right",classNames:{root:"".concat(g,"-inline-collapsed-tooltip")}}),B)),B},x=n(88208),w=n(93463),S=n(54558),C=n(12918),O=n(63074),B=n(18544),k=n(691),j=n(99320),E=n(71140),z=e=>{let{componentCls:t,motionDurationSlow:n,horizontalLineHeight:o,colorSplit:a,lineWidth:c,lineType:r,itemPaddingInline:l}=e;return{["".concat(t,"-horizontal")]:{lineHeight:o,border:0,borderBottom:"".concat((0,w.bf)(c)," ").concat(r," ").concat(a),boxShadow:"none","&::after":{display:"block",clear:"both",height:0,content:'"\\20"'},["".concat(t,"-item, ").concat(t,"-submenu")]:{position:"relative",display:"inline-block",verticalAlign:"bottom",paddingInline:l},["> ".concat(t,"-item:hover,\n > ").concat(t,"-item-active,\n > ").concat(t,"-submenu ").concat(t,"-submenu-title:hover")]:{backgroundColor:"transparent"},["".concat(t,"-item, ").concat(t,"-submenu-title")]:{transition:["border-color ".concat(n),"background ".concat(n)].join(",")},["".concat(t,"-submenu-arrow")]:{display:"none"}}}},N=e=>{let{componentCls:t,menuArrowOffset:n,calc:o}=e;return{["".concat(t,"-rtl")]:{direction:"rtl"},["".concat(t,"-submenu-rtl")]:{transformOrigin:"100% 0"},["".concat(t,"-rtl").concat(t,"-vertical,\n ").concat(t,"-submenu-rtl ").concat(t,"-vertical")]:{["".concat(t,"-submenu-arrow")]:{"&::before":{transform:"rotate(-45deg) translateY(".concat((0,w.bf)(o(n).mul(-1).equal()),")")},"&::after":{transform:"rotate(45deg) translateY(".concat((0,w.bf)(n),")")}}}}};let H=e=>(0,C.oN)(e);var T=(e,t)=>{let{componentCls:n,itemColor:o,itemSelectedColor:a,subMenuItemSelectedColor:c,groupTitleColor:r,itemBg:l,subMenuItemBg:i,itemSelectedBg:d,activeBarHeight:s,activeBarWidth:u,activeBarBorderWidth:m,motionDurationSlow:p,motionEaseInOut:g,motionEaseOut:b,itemPaddingInline:f,motionDurationMid:v,itemHoverColor:h,lineType:y,colorSplit:I,itemDisabledColor:x,dangerItemColor:S,dangerItemHoverColor:C,dangerItemSelectedColor:O,dangerItemActiveBg:B,dangerItemSelectedBg:k,popupBg:j,itemHoverBg:E,itemActiveBg:z,menuSubMenuBg:N,horizontalItemSelectedColor:T,horizontalItemSelectedBg:P,horizontalItemBorderRadius:R,horizontalItemHoverBg:Z}=e;return{["".concat(n,"-").concat(t,", ").concat(n,"-").concat(t," > ").concat(n)]:{color:o,background:l,["&".concat(n,"-root:focus-visible")]:Object.assign({},H(e)),["".concat(n,"-item")]:{"&-group-title, &-extra":{color:r}},["".concat(n,"-submenu-selected > ").concat(n,"-submenu-title")]:{color:c},["".concat(n,"-item, ").concat(n,"-submenu-title")]:{color:o,["&:not(".concat(n,"-item-disabled):focus-visible")]:Object.assign({},H(e))},["".concat(n,"-item-disabled, ").concat(n,"-submenu-disabled")]:{color:"".concat(x," !important")},["".concat(n,"-item:not(").concat(n,"-item-selected):not(").concat(n,"-submenu-selected)")]:{["&:hover, > ".concat(n,"-submenu-title:hover")]:{color:h}},["&:not(".concat(n,"-horizontal)")]:{["".concat(n,"-item:not(").concat(n,"-item-selected)")]:{"&:hover":{backgroundColor:E},"&:active":{backgroundColor:z}},["".concat(n,"-submenu-title")]:{"&:hover":{backgroundColor:E},"&:active":{backgroundColor:z}}},["".concat(n,"-item-danger")]:{color:S,["&".concat(n,"-item:hover")]:{["&:not(".concat(n,"-item-selected):not(").concat(n,"-submenu-selected)")]:{color:C}},["&".concat(n,"-item:active")]:{background:B}},["".concat(n,"-item a")]:{"&, &:hover":{color:"inherit"}},["".concat(n,"-item-selected")]:{color:a,["&".concat(n,"-item-danger")]:{color:O},"a, a:hover":{color:"inherit"}},["& ".concat(n,"-item-selected")]:{backgroundColor:d,["&".concat(n,"-item-danger")]:{backgroundColor:k}},["&".concat(n,"-submenu > ").concat(n)]:{backgroundColor:N},["&".concat(n,"-popup > ").concat(n)]:{backgroundColor:j},["&".concat(n,"-submenu-popup > ").concat(n)]:{backgroundColor:j},["&".concat(n,"-horizontal")]:Object.assign(Object.assign({},"dark"===t?{borderBottom:0}:{}),{["> ".concat(n,"-item, > ").concat(n,"-submenu")]:{top:m,marginTop:e.calc(m).mul(-1).equal(),marginBottom:0,borderRadius:R,"&::after":{position:"absolute",insetInline:f,bottom:0,borderBottom:"".concat((0,w.bf)(s)," solid transparent"),transition:"border-color ".concat(p," ").concat(g),content:'""'},"&:hover, &-active, &-open":{background:Z,"&::after":{borderBottomWidth:s,borderBottomColor:T}},"&-selected":{color:T,backgroundColor:P,"&:hover":{backgroundColor:P},"&::after":{borderBottomWidth:s,borderBottomColor:T}}}}),["&".concat(n,"-root")]:{["&".concat(n,"-inline, &").concat(n,"-vertical")]:{borderInlineEnd:"".concat((0,w.bf)(m)," ").concat(y," ").concat(I)}},["&".concat(n,"-inline")]:{["".concat(n,"-sub").concat(n,"-inline")]:{background:i},["".concat(n,"-item")]:{position:"relative","&::after":{position:"absolute",insetBlock:0,insetInlineEnd:0,borderInlineEnd:"".concat((0,w.bf)(u)," solid ").concat(a),transform:"scaleY(0.0001)",opacity:0,transition:["transform ".concat(v," ").concat(b),"opacity ".concat(v," ").concat(b)].join(","),content:'""'},["&".concat(n,"-item-danger")]:{"&::after":{borderInlineEndColor:O}}},["".concat(n,"-selected, ").concat(n,"-item-selected")]:{"&::after":{transform:"scaleY(1)",opacity:1,transition:["transform ".concat(v," ").concat(g),"opacity ".concat(v," ").concat(g)].join(",")}}}}}};let P=e=>{let{componentCls:t,itemHeight:n,itemMarginInline:o,padding:a,menuArrowSize:c,marginXS:r,itemMarginBlock:l,itemWidth:i,itemPaddingInline:d}=e,s=e.calc(c).add(a).add(r).equal();return{["".concat(t,"-item")]:{position:"relative",overflow:"hidden"},["".concat(t,"-item, ").concat(t,"-submenu-title")]:{height:n,lineHeight:(0,w.bf)(n),paddingInline:d,overflow:"hidden",textOverflow:"ellipsis",marginInline:o,marginBlock:l,width:i},["> ".concat(t,"-item,\n > ").concat(t,"-submenu > ").concat(t,"-submenu-title")]:{height:n,lineHeight:(0,w.bf)(n)},["".concat(t,"-item-group-list ").concat(t,"-submenu-title,\n ").concat(t,"-submenu-title")]:{paddingInlineEnd:s}}};var R=e=>{let{componentCls:t,iconCls:n,itemHeight:o,colorTextLightSolid:a,dropdownWidth:c,controlHeightLG:r,motionEaseOut:l,paddingXL:i,itemMarginInline:d,fontSizeLG:s,motionDurationFast:u,motionDurationSlow:m,paddingXS:p,boxShadowSecondary:g,collapsedWidth:b,collapsedIconSize:f}=e,v={height:o,lineHeight:(0,w.bf)(o),listStylePosition:"inside",listStyleType:"disc"};return[{[t]:{"&-inline, &-vertical":Object.assign({["&".concat(t,"-root")]:{boxShadow:"none"}},P(e))},["".concat(t,"-submenu-popup")]:{["".concat(t,"-vertical")]:Object.assign(Object.assign({},P(e)),{boxShadow:g})}},{["".concat(t,"-submenu-popup ").concat(t,"-vertical").concat(t,"-sub")]:{minWidth:c,maxHeight:"calc(100vh - ".concat((0,w.bf)(e.calc(r).mul(2.5).equal()),")"),padding:"0",overflow:"hidden",borderInlineEnd:0,"&:not([class*='-active'])":{overflowX:"hidden",overflowY:"auto"}}},{["".concat(t,"-inline")]:{width:"100%",["&".concat(t,"-root")]:{["".concat(t,"-item, ").concat(t,"-submenu-title")]:{display:"flex",alignItems:"center",transition:["border-color ".concat(m),"background ".concat(m),"padding ".concat(u," ").concat(l)].join(","),["> ".concat(t,"-title-content")]:{flex:"auto",minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},"> *":{flex:"none"}}},["".concat(t,"-sub").concat(t,"-inline")]:{padding:0,border:0,borderRadius:0,boxShadow:"none",["& > ".concat(t,"-submenu > ").concat(t,"-submenu-title")]:v,["& ".concat(t,"-item-group-title")]:{paddingInlineStart:i}},["".concat(t,"-item")]:v}},{["".concat(t,"-inline-collapsed")]:{width:b,["&".concat(t,"-root")]:{["".concat(t,"-item, ").concat(t,"-submenu ").concat(t,"-submenu-title")]:{["> ".concat(t,"-inline-collapsed-noicon")]:{fontSize:s,textAlign:"center"}}},["> ".concat(t,"-item,\n > ").concat(t,"-item-group > ").concat(t,"-item-group-list > ").concat(t,"-item,\n > ").concat(t,"-item-group > ").concat(t,"-item-group-list > ").concat(t,"-submenu > ").concat(t,"-submenu-title,\n > ").concat(t,"-submenu > ").concat(t,"-submenu-title")]:{insetInlineStart:0,paddingInline:"calc(50% - ".concat((0,w.bf)(e.calc(f).div(2).equal())," - ").concat((0,w.bf)(d),")"),textOverflow:"clip",["\n ".concat(t,"-submenu-arrow,\n ").concat(t,"-submenu-expand-icon\n ")]:{opacity:0},["".concat(t,"-item-icon, ").concat(n)]:{margin:0,fontSize:f,lineHeight:(0,w.bf)(o),"+ span":{display:"inline-block",opacity:0}}},["".concat(t,"-item-icon, ").concat(n)]:{display:"inline-block"},"&-tooltip":{pointerEvents:"none",["".concat(t,"-item-icon, ").concat(n)]:{display:"none"},"a, a:hover":{color:a}},["".concat(t,"-item-group-title")]:Object.assign(Object.assign({},C.vS),{paddingInline:p})}}]};let Z=e=>{let{componentCls:t,motionDurationSlow:n,motionDurationMid:o,motionEaseInOut:a,motionEaseOut:c,iconCls:r,iconSize:l,iconMarginInlineEnd:i}=e;return{["".concat(t,"-item, ").concat(t,"-submenu-title")]:{position:"relative",display:"block",margin:0,whiteSpace:"nowrap",cursor:"pointer",transition:["border-color ".concat(n),"background ".concat(n),"padding calc(".concat(n," + 0.1s) ").concat(a)].join(","),["".concat(t,"-item-icon, ").concat(r)]:{minWidth:l,fontSize:l,transition:["font-size ".concat(o," ").concat(c),"margin ".concat(n," ").concat(a),"color ".concat(n)].join(","),"+ span":{marginInlineStart:i,opacity:1,transition:["opacity ".concat(n," ").concat(a),"margin ".concat(n),"color ".concat(n)].join(",")}},["".concat(t,"-item-icon")]:Object.assign({},(0,C.Ro)()),["&".concat(t,"-item-only-child")]:{["> ".concat(r,", > ").concat(t,"-item-icon")]:{marginInlineEnd:0}}},["".concat(t,"-item-disabled, ").concat(t,"-submenu-disabled")]:{background:"none !important",cursor:"not-allowed","&::after":{borderColor:"transparent !important"},a:{color:"inherit !important",cursor:"not-allowed",pointerEvents:"none"},["> ".concat(t,"-submenu-title")]:{color:"inherit !important",cursor:"not-allowed"}}}},M=e=>{let{componentCls:t,motionDurationSlow:n,motionEaseInOut:o,borderRadius:a,menuArrowSize:c,menuArrowOffset:r}=e;return{["".concat(t,"-submenu")]:{"&-expand-icon, &-arrow":{position:"absolute",top:"50%",insetInlineEnd:e.margin,width:c,color:"currentcolor",transform:"translateY(-50%)",transition:"transform ".concat(n," ").concat(o,", opacity ").concat(n)},"&-arrow":{"&::before, &::after":{position:"absolute",width:e.calc(c).mul(.6).equal(),height:e.calc(c).mul(.15).equal(),backgroundColor:"currentcolor",borderRadius:a,transition:["background ".concat(n," ").concat(o),"transform ".concat(n," ").concat(o),"top ".concat(n," ").concat(o),"color ".concat(n," ").concat(o)].join(","),content:'""'},"&::before":{transform:"rotate(45deg) translateY(".concat((0,w.bf)(e.calc(r).mul(-1).equal()),")")},"&::after":{transform:"rotate(-45deg) translateY(".concat((0,w.bf)(r),")")}}}}},D=e=>{let{antCls:t,componentCls:n,fontSize:o,motionDurationSlow:a,motionDurationMid:c,motionEaseInOut:r,paddingXS:l,padding:i,colorSplit:d,lineWidth:s,zIndexPopup:u,borderRadiusLG:m,subMenuItemBorderRadius:p,menuArrowSize:g,menuArrowOffset:b,lineType:f,groupTitleLineHeight:v,groupTitleFontSize:h}=e;return[{"":{[n]:Object.assign(Object.assign({},(0,C.dF)()),{"&-hidden":{display:"none"}})},["".concat(n,"-submenu-hidden")]:{display:"none"}},{[n]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},(0,C.Wf)(e)),(0,C.dF)()),{marginBottom:0,paddingInlineStart:0,fontSize:o,lineHeight:0,listStyle:"none",outline:"none",transition:"width ".concat(a," cubic-bezier(0.2, 0, 0, 1) 0s"),"ul, ol":{margin:0,padding:0,listStyle:"none"},"&-overflow":{display:"flex",["".concat(n,"-item")]:{flex:"none"}},["".concat(n,"-item, ").concat(n,"-submenu, ").concat(n,"-submenu-title")]:{borderRadius:e.itemBorderRadius},["".concat(n,"-item-group-title")]:{padding:"".concat((0,w.bf)(l)," ").concat((0,w.bf)(i)),fontSize:h,lineHeight:v,transition:"all ".concat(a)},["&-horizontal ".concat(n,"-submenu")]:{transition:["border-color ".concat(a," ").concat(r),"background ".concat(a," ").concat(r)].join(",")},["".concat(n,"-submenu, ").concat(n,"-submenu-inline")]:{transition:["border-color ".concat(a," ").concat(r),"background ".concat(a," ").concat(r),"padding ".concat(c," ").concat(r)].join(",")},["".concat(n,"-submenu ").concat(n,"-sub")]:{cursor:"initial",transition:["background ".concat(a," ").concat(r),"padding ".concat(a," ").concat(r)].join(",")},["".concat(n,"-title-content")]:{transition:"color ".concat(a),"&-with-extra":{display:"inline-flex",alignItems:"center",width:"100%"},["> ".concat(t,"-typography-ellipsis-single-line")]:{display:"inline",verticalAlign:"unset"},["".concat(n,"-item-extra")]:{marginInlineStart:"auto",paddingInlineStart:e.padding}},["".concat(n,"-item a")]:{"&::before":{position:"absolute",inset:0,backgroundColor:"transparent",content:'""'}},["".concat(n,"-item-divider")]:{overflow:"hidden",lineHeight:0,borderColor:d,borderStyle:f,borderWidth:0,borderTopWidth:s,marginBlock:s,padding:0,"&-dashed":{borderStyle:"dashed"}}}),Z(e)),{["".concat(n,"-item-group")]:{["".concat(n,"-item-group-list")]:{margin:0,padding:0,["".concat(n,"-item, ").concat(n,"-submenu-title")]:{paddingInline:"".concat((0,w.bf)(e.calc(o).mul(2).equal())," ").concat((0,w.bf)(i))}}},"&-submenu":{"&-popup":{position:"absolute",zIndex:u,borderRadius:m,boxShadow:"none",transformOrigin:"0 0",["&".concat(n,"-submenu")]:{background:"transparent"},"&::before":{position:"absolute",inset:0,zIndex:-1,width:"100%",height:"100%",opacity:0,content:'""'},["> ".concat(n)]:Object.assign(Object.assign(Object.assign({borderRadius:m},Z(e)),M(e)),{["".concat(n,"-item, ").concat(n,"-submenu > ").concat(n,"-submenu-title")]:{borderRadius:p},["".concat(n,"-submenu-title::after")]:{transition:"transform ".concat(a," ").concat(r)}})},"\n &-placement-leftTop,\n &-placement-bottomRight,\n ":{transformOrigin:"100% 0"},"\n &-placement-leftBottom,\n &-placement-topRight,\n ":{transformOrigin:"100% 100%"},"\n &-placement-rightBottom,\n &-placement-topLeft,\n ":{transformOrigin:"0 100%"},"\n &-placement-bottomLeft,\n &-placement-rightTop,\n ":{transformOrigin:"0 0"},"\n &-placement-leftTop,\n &-placement-leftBottom\n ":{paddingInlineEnd:e.paddingXS},"\n &-placement-rightTop,\n &-placement-rightBottom\n ":{paddingInlineStart:e.paddingXS},"\n &-placement-topRight,\n &-placement-topLeft\n ":{paddingBottom:e.paddingXS},"\n &-placement-bottomRight,\n &-placement-bottomLeft\n ":{paddingTop:e.paddingXS}}}),M(e)),{["&-inline-collapsed ".concat(n,"-submenu-arrow,\n &-inline ").concat(n,"-submenu-arrow")]:{"&::before":{transform:"rotate(-45deg) translateX(".concat((0,w.bf)(b),")")},"&::after":{transform:"rotate(45deg) translateX(".concat((0,w.bf)(e.calc(b).mul(-1).equal()),")")}},["".concat(n,"-submenu-open").concat(n,"-submenu-inline > ").concat(n,"-submenu-title > ").concat(n,"-submenu-arrow")]:{transform:"translateY(".concat((0,w.bf)(e.calc(g).mul(.2).mul(-1).equal()),")"),"&::after":{transform:"rotate(-45deg) translateX(".concat((0,w.bf)(e.calc(b).mul(-1).equal()),")")},"&::before":{transform:"rotate(45deg) translateX(".concat((0,w.bf)(b),")")}}})},{["".concat(t,"-layout-header")]:{[n]:{lineHeight:"inherit"}}}]},A=e=>{var t,n,o;let{colorPrimary:a,colorError:c,colorTextDisabled:r,colorErrorBg:l,colorText:i,colorTextDescription:d,colorBgContainer:s,colorFillAlter:u,colorFillContent:m,lineWidth:p,lineWidthBold:g,controlItemBgActive:b,colorBgTextHover:f,controlHeightLG:v,lineHeight:h,colorBgElevated:y,marginXXS:I,padding:x,fontSize:w,controlHeightSM:C,fontSizeLG:O,colorTextLightSolid:B,colorErrorHover:k}=e,j=null!==(t=e.activeBarWidth)&&void 0!==t?t:0,E=null!==(n=e.activeBarBorderWidth)&&void 0!==n?n:p,z=null!==(o=e.itemMarginInline)&&void 0!==o?o:e.marginXXS,N=new S.t(B).setA(.65).toRgbString();return{dropdownWidth:160,zIndexPopup:e.zIndexPopupBase+50,radiusItem:e.borderRadiusLG,itemBorderRadius:e.borderRadiusLG,radiusSubMenuItem:e.borderRadiusSM,subMenuItemBorderRadius:e.borderRadiusSM,colorItemText:i,itemColor:i,colorItemTextHover:i,itemHoverColor:i,colorItemTextHoverHorizontal:a,horizontalItemHoverColor:a,colorGroupTitle:d,groupTitleColor:d,colorItemTextSelected:a,itemSelectedColor:a,subMenuItemSelectedColor:a,colorItemTextSelectedHorizontal:a,horizontalItemSelectedColor:a,colorItemBg:s,itemBg:s,colorItemBgHover:f,itemHoverBg:f,colorItemBgActive:m,itemActiveBg:b,colorSubItemBg:u,subMenuItemBg:u,colorItemBgSelected:b,itemSelectedBg:b,colorItemBgSelectedHorizontal:"transparent",horizontalItemSelectedBg:"transparent",colorActiveBarWidth:0,activeBarWidth:j,colorActiveBarHeight:g,activeBarHeight:g,colorActiveBarBorderSize:p,activeBarBorderWidth:E,colorItemTextDisabled:r,itemDisabledColor:r,colorDangerItemText:c,dangerItemColor:c,colorDangerItemTextHover:c,dangerItemHoverColor:c,colorDangerItemTextSelected:c,dangerItemSelectedColor:c,colorDangerItemBgActive:l,dangerItemActiveBg:l,colorDangerItemBgSelected:l,dangerItemSelectedBg:l,itemMarginInline:z,horizontalItemBorderRadius:0,horizontalItemHoverBg:"transparent",itemHeight:v,groupTitleLineHeight:h,collapsedWidth:2*v,popupBg:y,itemMarginBlock:I,itemPaddingInline:x,horizontalLineHeight:"".concat(1.15*v,"px"),iconSize:w,iconMarginInlineEnd:C-w,collapsedIconSize:O,groupTitleFontSize:w,darkItemDisabledColor:new S.t(B).setA(.25).toRgbString(),darkItemColor:N,darkDangerItemColor:c,darkItemBg:"#001529",darkPopupBg:"#001529",darkSubMenuItemBg:"#000c17",darkItemSelectedColor:B,darkItemSelectedBg:a,darkDangerItemSelectedBg:c,darkItemHoverBg:"transparent",darkGroupTitleColor:N,darkItemHoverColor:B,darkDangerItemHoverColor:k,darkDangerItemSelectedColor:B,darkDangerItemActiveBg:c,itemWidth:j?"calc(100% + ".concat(E,"px)"):"calc(100% - ".concat(2*z,"px)")}};var W=n(62236),L=e=>{var t;let n;let{popupClassName:c,icon:r,title:l,theme:d}=e,u=o.useContext(b),{prefixCls:p,inlineCollapsed:g,theme:f}=u,v=(0,a.Xl)();if(r){let e=o.isValidElement(l)&&"span"===l.type;n=o.createElement(o.Fragment,null,(0,m.Tm)(r,{className:i()(o.isValidElement(r)?null===(t=r.props)||void 0===t?void 0:t.className:void 0,"".concat(p,"-item-icon"))}),e?l:o.createElement("span",{className:"".concat(p,"-title-content")},l))}else n=g&&!v.length&&l&&"string"==typeof l?o.createElement("div",{className:"".concat(p,"-inline-collapsed-noicon")},l.charAt(0)):o.createElement("span",{className:"".concat(p,"-title-content")},l);let h=o.useMemo(()=>Object.assign(Object.assign({},u),{firstLevel:!1}),[u]),[y]=(0,W.Cn)("Menu");return o.createElement(b.Provider,{value:h},o.createElement(a.Wd,Object.assign({},(0,s.Z)(e,["icon"]),{title:n,popupClassName:i()(p,c,"".concat(p,"-").concat(d||f)),popupStyle:Object.assign({zIndex:y},e.popupStyle)})))},G=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};function X(e){return null===e||!1===e}let _={item:I,submenu:L,divider:v},q=(0,o.forwardRef)((e,t)=>{var n;let c=o.useContext(x.Z),l=c||{},{getPrefixCls:f,getPopupContainer:v,direction:h,menu:y}=o.useContext(p.E_),I=f(),{prefixCls:w,className:S,style:C,theme:H="light",expandIcon:P,_internalDisableMenuItemTitleTooltip:Z,inlineCollapsed:M,siderCollapsed:W,rootClassName:L,mode:q,selectable:F,onClick:Y,overflowedIndicatorPopupClassName:V}=e,$=G(e,["prefixCls","className","style","theme","expandIcon","_internalDisableMenuItemTitleTooltip","inlineCollapsed","siderCollapsed","rootClassName","mode","selectable","onClick","overflowedIndicatorPopupClassName"]),J=(0,s.Z)($,["collapsedWidth"]);null===(n=l.validator)||void 0===n||n.call(l,{mode:q});let Q=(0,d.Z)(function(){for(var e,t=arguments.length,n=Array(t),o=0;o1&&void 0!==arguments[1]?arguments[1]:e,n=!(arguments.length>2)||void 0===arguments[2]||arguments[2];return(0,j.I$)("Menu",e=>{let{colorBgElevated:t,controlHeightLG:n,fontSize:o,darkItemColor:a,darkDangerItemColor:c,darkItemBg:r,darkSubMenuItemBg:l,darkItemSelectedColor:i,darkItemSelectedBg:d,darkDangerItemSelectedBg:s,darkItemHoverBg:u,darkGroupTitleColor:m,darkItemHoverColor:p,darkItemDisabledColor:g,darkDangerItemHoverColor:b,darkDangerItemSelectedColor:f,darkDangerItemActiveBg:v,popupBg:h,darkPopupBg:y}=e,I=e.calc(o).div(7).mul(5).equal(),x=(0,E.IX)(e,{menuArrowSize:I,menuHorizontalHeight:e.calc(n).mul(1.15).equal(),menuArrowOffset:e.calc(I).mul(.25).equal(),menuSubMenuBg:t,calc:e.calc,popupBg:h}),w=(0,E.IX)(x,{itemColor:a,itemHoverColor:p,groupTitleColor:m,itemSelectedColor:i,subMenuItemSelectedColor:i,itemBg:r,popupBg:y,subMenuItemBg:l,itemActiveBg:"transparent",itemSelectedBg:d,activeBarHeight:0,activeBarBorderWidth:0,itemHoverBg:u,itemDisabledColor:g,dangerItemColor:c,dangerItemHoverColor:b,dangerItemSelectedColor:f,dangerItemActiveBg:v,dangerItemSelectedBg:s,menuSubMenuBg:l,horizontalItemSelectedColor:i,horizontalItemSelectedBg:d});return[D(x),z(x),R(x),T(x,"light"),T(w,"dark"),N(x),(0,O.Z)(x),(0,B.oN)(x,"slide-up"),(0,B.oN)(x,"slide-down"),(0,k._y)(x,"zoom-big")]},A,{deprecatedTokens:[["colorGroupTitle","groupTitleColor"],["radiusItem","itemBorderRadius"],["radiusSubMenuItem","subMenuItemBorderRadius"],["colorItemText","itemColor"],["colorItemTextHover","itemHoverColor"],["colorItemTextHoverHorizontal","horizontalItemHoverColor"],["colorItemTextSelected","itemSelectedColor"],["colorItemTextSelectedHorizontal","horizontalItemSelectedColor"],["colorItemTextDisabled","itemDisabledColor"],["colorDangerItemText","dangerItemColor"],["colorDangerItemTextHover","dangerItemHoverColor"],["colorDangerItemTextSelected","dangerItemSelectedColor"],["colorDangerItemBgActive","dangerItemActiveBg"],["colorDangerItemBgSelected","dangerItemSelectedBg"],["colorItemBg","itemBg"],["colorItemBgHover","itemHoverBg"],["colorSubItemBg","subMenuItemBg"],["colorItemBgActive","itemActiveBg"],["colorItemBgSelectedHorizontal","horizontalItemSelectedBg"],["colorActiveBarWidth","activeBarWidth"],["colorActiveBarHeight","activeBarHeight"],["colorActiveBarBorderSize","activeBarBorderWidth"],["colorItemBgSelected","itemSelectedBg"]],injectStyle:n,unitless:{groupTitleLineHeight:!0}})(e,t)}(en,eo,!c),el=i()("".concat(en,"-").concat(H),null==y?void 0:y.className,S),ei=o.useMemo(()=>{var e,t;if("function"==typeof P||X(P))return P||null;if("function"==typeof l.expandIcon||X(l.expandIcon))return l.expandIcon||null;if("function"==typeof(null==y?void 0:y.expandIcon)||X(null==y?void 0:y.expandIcon))return(null==y?void 0:y.expandIcon)||null;let n=null!==(e=null!=P?P:null==l?void 0:l.expandIcon)&&void 0!==e?e:null==y?void 0:y.expandIcon;return(0,m.Tm)(n,{className:i()("".concat(en,"-submenu-expand-icon"),o.isValidElement(n)?null===(t=n.props)||void 0===t?void 0:t.className:void 0)})},[P,null==l?void 0:l.expandIcon,null==y?void 0:y.expandIcon,en]),ed=o.useMemo(()=>({prefixCls:en,inlineCollapsed:ee||!1,direction:h,firstLevel:!0,theme:H,mode:U,disableMenuItemTitleTooltip:Z}),[en,ee,h,Z,H]);return ea(o.createElement(x.Z.Provider,{value:null},o.createElement(b.Provider,{value:ed},o.createElement(a.ZP,Object.assign({getPopupContainer:v,overflowedIndicator:o.createElement(r.Z,null),overflowedIndicatorPopupClassName:i()(en,"".concat(en,"-").concat(H),V),mode:U,selectable:K,onClick:Q},J,{inlineCollapsed:ee,style:Object.assign(Object.assign({},null==y?void 0:y.style),C),className:el,prefixCls:en,direction:h,defaultMotions:et,expandIcon:ei,ref:t,rootClassName:i()(L,ec,l.rootClassName,er,eo),_internalComponents:_})))))}),F=(0,o.forwardRef)((e,t)=>{let n=(0,o.useRef)(null),a=o.useContext(c.D);return(0,o.useImperativeHandle)(t,()=>({menu:n.current,focus:e=>{var t;null===(t=n.current)||void 0===t||t.focus(e)}})),o.createElement(q,Object.assign({ref:n},e,a))});F.Item=I,F.SubMenu=L,F.Divider=v,F.ItemGroup=a.BW;var Y=F},58760:function(e,t,n){n.d(t,{Z:function(){return B}});var o=n(2265),a=n(36760),c=n.n(a),r=n(45287);function l(e){return["small","middle","large"].includes(e)}function i(e){return!!e&&"number"==typeof e&&!Number.isNaN(e)}var d=n(71744),s=n(77685),u=n(17691),m=n(99320);let p=e=>{let{componentCls:t,borderRadius:n,paddingSM:o,colorBorder:a,paddingXS:c,fontSizeLG:r,fontSizeSM:l,borderRadiusLG:i,borderRadiusSM:d,colorBgContainerDisabled:s,lineWidth:m}=e;return{[t]:[{display:"inline-flex",alignItems:"center",gap:0,paddingInline:o,margin:0,background:s,borderWidth:m,borderStyle:"solid",borderColor:a,borderRadius:n,"&-large":{fontSize:r,borderRadius:i},"&-small":{paddingInline:c,borderRadius:d,fontSize:l},"&-compact-last-item":{borderEndStartRadius:0,borderStartStartRadius:0},"&-compact-first-item":{borderEndEndRadius:0,borderStartEndRadius:0},"&-compact-item:not(:first-child):not(:last-child)":{borderRadius:0},"&-compact-item:not(:last-child)":{borderInlineEndWidth:0}},(0,u.c)(e,{focus:!1})]}};var g=(0,m.I$)(["Space","Addon"],e=>[p(e)]),b=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};let f=o.forwardRef((e,t)=>{let{className:n,children:a,style:r,prefixCls:l}=e,i=b(e,["className","children","style","prefixCls"]),{getPrefixCls:u,direction:m}=o.useContext(d.E_),p=u("space-addon",l),[f,v,h]=g(p),{compactItemClassnames:y,compactSize:I}=(0,s.ri)(p,m),x=c()(p,v,y,h,{["".concat(p,"-").concat(I)]:I},n);return f(o.createElement("div",Object.assign({ref:t,className:x,style:r},i),a))}),v=o.createContext({latestIndex:0}),h=v.Provider;var y=e=>{let{className:t,index:n,children:a,split:c,style:r}=e,{latestIndex:l}=o.useContext(v);return null==a?null:o.createElement(o.Fragment,null,o.createElement("div",{className:t,style:r},a),n{let{componentCls:t,antCls:n}=e;return{[t]:{display:"inline-flex","&-rtl":{direction:"rtl"},"&-vertical":{flexDirection:"column"},"&-align":{flexDirection:"column","&-center":{alignItems:"center"},"&-start":{alignItems:"flex-start"},"&-end":{alignItems:"flex-end"},"&-baseline":{alignItems:"baseline"}},["".concat(t,"-item:empty")]:{display:"none"},["".concat(t,"-item > ").concat(n,"-badge-not-a-wrapper:only-child")]:{display:"block"}}}},w=e=>{let{componentCls:t}=e;return{[t]:{"&-gap-row-small":{rowGap:e.spaceGapSmallSize},"&-gap-row-middle":{rowGap:e.spaceGapMiddleSize},"&-gap-row-large":{rowGap:e.spaceGapLargeSize},"&-gap-col-small":{columnGap:e.spaceGapSmallSize},"&-gap-col-middle":{columnGap:e.spaceGapMiddleSize},"&-gap-col-large":{columnGap:e.spaceGapLargeSize}}}};var S=(0,m.I$)("Space",e=>{let t=(0,I.IX)(e,{spaceGapSmallSize:e.paddingXS,spaceGapMiddleSize:e.padding,spaceGapLargeSize:e.paddingLG});return[x(t),w(t)]},()=>({}),{resetStyle:!1}),C=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};let O=o.forwardRef((e,t)=>{var n;let{getPrefixCls:a,direction:s,size:u,className:m,style:p,classNames:g,styles:b}=(0,d.dj)("space"),{size:f=null!=u?u:"small",align:v,className:I,rootClassName:x,children:w,direction:O="horizontal",prefixCls:B,split:k,style:j,wrap:E=!1,classNames:z,styles:N}=e,H=C(e,["size","align","className","rootClassName","children","direction","prefixCls","split","style","wrap","classNames","styles"]),[T,P]=Array.isArray(f)?f:[f,f],R=l(P),Z=l(T),M=i(P),D=i(T),A=(0,r.Z)(w,{keepEmpty:!0}),W=void 0===v&&"horizontal"===O?"center":v,L=a("space",B),[G,X,_]=S(L),q=c()(L,m,X,"".concat(L,"-").concat(O),{["".concat(L,"-rtl")]:"rtl"===s,["".concat(L,"-align-").concat(W)]:W,["".concat(L,"-gap-row-").concat(P)]:R,["".concat(L,"-gap-col-").concat(T)]:Z},I,x,_),F=c()("".concat(L,"-item"),null!==(n=null==z?void 0:z.item)&&void 0!==n?n:g.item),Y=Object.assign(Object.assign({},b.item),null==N?void 0:N.item),V=A.map((e,t)=>{let n=(null==e?void 0:e.key)||"".concat(F,"-").concat(t);return o.createElement(y,{className:F,key:n,index:t,split:k,style:Y},e)}),$=o.useMemo(()=>({latestIndex:A.reduce((e,t,n)=>null!=t?n:e,0)}),[A]);if(0===A.length)return null;let J={};return E&&(J.flexWrap="wrap"),!Z&&D&&(J.columnGap=T),!R&&M&&(J.rowGap=P),G(o.createElement("div",Object.assign({ref:t,className:q,style:Object.assign(Object.assign(Object.assign({},J),p),j)},H),o.createElement(h,{value:$},V)))});O.Compact=s.ZP,O.Addon=f;var B=O}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3705],{15327:function(e,t,n){n.d(t,{Z:function(){return l}});var o=n(1119),a=n(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},r=n(55015),l=a.forwardRef(function(e,t){return a.createElement(r.Z,(0,o.Z)({},e,{ref:t,icon:c}))})},73705:function(e,t,n){n.d(t,{Z:function(){return _}});var o=n(2265),a=n(15327),c=n(77565),r=n(36760),l=n.n(r),i=n(71030),d=n(58525),s=n(50506),u=n(18694),m=n(62236),p=e=>"object"!=typeof e&&"function"!=typeof e||null===e,g=n(92736),b=n(93942),f=n(19722),v=n(13613),h=n(95140),y=n(71744),I=n(64024),x=n(60985),w=n(88208),S=n(84951),C=n(93463),O=n(12918),B=n(18544),k=n(29382),j=n(691),E=n(88260),z=n(34442),N=n(99320),H=n(71140),T=e=>{let{componentCls:t,menuCls:n,colorError:o,colorTextLightSolid:a}=e,c="".concat(n,"-item");return{["".concat(t,", ").concat(t,"-menu-submenu")]:{["".concat(n," ").concat(c)]:{["&".concat(c,"-danger:not(").concat(c,"-disabled)")]:{color:o,"&:hover":{color:a,backgroundColor:o}}}}}};let P=e=>{let{componentCls:t,menuCls:n,zIndexPopup:o,dropdownArrowDistance:a,sizePopupArrow:c,antCls:r,iconCls:l,motionDurationMid:i,paddingBlock:d,fontSize:s,dropdownEdgeChildPadding:u,colorTextDisabled:m,fontSizeIcon:p,controlPaddingHorizontal:g,colorBgElevated:b}=e;return[{[t]:{position:"absolute",top:-9999,left:{_skip_check_:!0,value:-9999},zIndex:o,display:"block","&::before":{position:"absolute",insetBlock:e.calc(c).div(2).sub(a).equal(),zIndex:-9999,opacity:1e-4,content:'""'},"&-menu-vertical":{maxHeight:"100vh",overflowY:"auto"},["&-trigger".concat(r,"-btn")]:{["& > ".concat(l,"-down, & > ").concat(r,"-btn-icon > ").concat(l,"-down")]:{fontSize:p}},["".concat(t,"-wrap")]:{position:"relative",["".concat(r,"-btn > ").concat(l,"-down")]:{fontSize:p},["".concat(l,"-down::before")]:{transition:"transform ".concat(i)}},["".concat(t,"-wrap-open")]:{["".concat(l,"-down::before")]:{transform:"rotate(180deg)"}},"\n &-hidden,\n &-menu-hidden,\n &-menu-submenu-hidden\n ":{display:"none"},["&".concat(r,"-slide-down-enter").concat(r,"-slide-down-enter-active").concat(t,"-placement-bottomLeft,\n &").concat(r,"-slide-down-appear").concat(r,"-slide-down-appear-active").concat(t,"-placement-bottomLeft,\n &").concat(r,"-slide-down-enter").concat(r,"-slide-down-enter-active").concat(t,"-placement-bottom,\n &").concat(r,"-slide-down-appear").concat(r,"-slide-down-appear-active").concat(t,"-placement-bottom,\n &").concat(r,"-slide-down-enter").concat(r,"-slide-down-enter-active").concat(t,"-placement-bottomRight,\n &").concat(r,"-slide-down-appear").concat(r,"-slide-down-appear-active").concat(t,"-placement-bottomRight")]:{animationName:B.fJ},["&".concat(r,"-slide-up-enter").concat(r,"-slide-up-enter-active").concat(t,"-placement-topLeft,\n &").concat(r,"-slide-up-appear").concat(r,"-slide-up-appear-active").concat(t,"-placement-topLeft,\n &").concat(r,"-slide-up-enter").concat(r,"-slide-up-enter-active").concat(t,"-placement-top,\n &").concat(r,"-slide-up-appear").concat(r,"-slide-up-appear-active").concat(t,"-placement-top,\n &").concat(r,"-slide-up-enter").concat(r,"-slide-up-enter-active").concat(t,"-placement-topRight,\n &").concat(r,"-slide-up-appear").concat(r,"-slide-up-appear-active").concat(t,"-placement-topRight")]:{animationName:B.Qt},["&".concat(r,"-slide-down-leave").concat(r,"-slide-down-leave-active").concat(t,"-placement-bottomLeft,\n &").concat(r,"-slide-down-leave").concat(r,"-slide-down-leave-active").concat(t,"-placement-bottom,\n &").concat(r,"-slide-down-leave").concat(r,"-slide-down-leave-active").concat(t,"-placement-bottomRight")]:{animationName:B.Uw},["&".concat(r,"-slide-up-leave").concat(r,"-slide-up-leave-active").concat(t,"-placement-topLeft,\n &").concat(r,"-slide-up-leave").concat(r,"-slide-up-leave-active").concat(t,"-placement-top,\n &").concat(r,"-slide-up-leave").concat(r,"-slide-up-leave-active").concat(t,"-placement-topRight")]:{animationName:B.ly}}},(0,E.ZP)(e,b,{arrowPlacement:{top:!0,bottom:!0}}),{["".concat(t," ").concat(n)]:{position:"relative",margin:0},["".concat(n,"-submenu-popup")]:{position:"absolute",zIndex:o,background:"transparent",boxShadow:"none",transformOrigin:"0 0","ul, li":{listStyle:"none",margin:0}},["".concat(t,", ").concat(t,"-menu-submenu")]:Object.assign(Object.assign({},(0,O.Wf)(e)),{[n]:Object.assign(Object.assign({padding:u,listStyleType:"none",backgroundColor:b,backgroundClip:"padding-box",borderRadius:e.borderRadiusLG,outline:"none",boxShadow:e.boxShadowSecondary},(0,O.Qy)(e)),{"&:empty":{padding:0,boxShadow:"none"},["".concat(n,"-item-group-title")]:{padding:"".concat((0,C.bf)(d)," ").concat((0,C.bf)(g)),color:e.colorTextDescription,transition:"all ".concat(i)},["".concat(n,"-item")]:{position:"relative",display:"flex",alignItems:"center"},["".concat(n,"-item-icon")]:{minWidth:s,marginInlineEnd:e.marginXS,fontSize:e.fontSizeSM},["".concat(n,"-title-content")]:{flex:"auto","&-with-extra":{display:"inline-flex",alignItems:"center",width:"100%"},"> a":{color:"inherit",transition:"all ".concat(i),"&:hover":{color:"inherit"},"&::after":{position:"absolute",inset:0,content:'""'}},["".concat(n,"-item-extra")]:{paddingInlineStart:e.padding,marginInlineStart:"auto",fontSize:e.fontSizeSM,color:e.colorTextDescription}},["".concat(n,"-item, ").concat(n,"-submenu-title")]:Object.assign(Object.assign({display:"flex",margin:0,padding:"".concat((0,C.bf)(d)," ").concat((0,C.bf)(g)),color:e.colorText,fontWeight:"normal",fontSize:s,lineHeight:e.lineHeight,cursor:"pointer",transition:"all ".concat(i),borderRadius:e.borderRadiusSM,"&:hover, &-active":{backgroundColor:e.controlItemBgHover}},(0,O.Qy)(e)),{"&-selected":{color:e.colorPrimary,backgroundColor:e.controlItemBgActive,"&:hover, &-active":{backgroundColor:e.controlItemBgActiveHover}},"&-disabled":{color:m,cursor:"not-allowed","&:hover":{color:m,backgroundColor:b,cursor:"not-allowed"},a:{pointerEvents:"none"}},"&-divider":{height:1,margin:"".concat((0,C.bf)(e.marginXXS)," 0"),overflow:"hidden",lineHeight:0,backgroundColor:e.colorSplit},["".concat(t,"-menu-submenu-expand-icon")]:{position:"absolute",insetInlineEnd:e.paddingXS,["".concat(t,"-menu-submenu-arrow-icon")]:{marginInlineEnd:"0 !important",color:e.colorIcon,fontSize:p,fontStyle:"normal"}}}),["".concat(n,"-item-group-list")]:{margin:"0 ".concat((0,C.bf)(e.marginXS)),padding:0,listStyle:"none"},["".concat(n,"-submenu-title")]:{paddingInlineEnd:e.calc(g).add(e.fontSizeSM).equal()},["".concat(n,"-submenu-vertical")]:{position:"relative"},["".concat(n,"-submenu").concat(n,"-submenu-disabled ").concat(t,"-menu-submenu-title")]:{["&, ".concat(t,"-menu-submenu-arrow-icon")]:{color:m,backgroundColor:b,cursor:"not-allowed"}},["".concat(n,"-submenu-selected ").concat(t,"-menu-submenu-title")]:{color:e.colorPrimary}})})},[(0,B.oN)(e,"slide-up"),(0,B.oN)(e,"slide-down"),(0,k.Fm)(e,"move-up"),(0,k.Fm)(e,"move-down"),(0,j._y)(e,"zoom-big")]]};var R=(0,N.I$)("Dropdown",e=>{let{marginXXS:t,sizePopupArrow:n,paddingXXS:o,componentCls:a}=e,c=(0,H.IX)(e,{menuCls:"".concat(a,"-menu"),dropdownArrowDistance:e.calc(n).div(2).add(t).equal(),dropdownEdgeChildPadding:o});return[P(c),T(c)]},e=>Object.assign(Object.assign({zIndexPopup:e.zIndexPopupBase+50,paddingBlock:(e.controlHeight-e.fontSize*e.lineHeight)/2},(0,E.wZ)({contentRadius:e.borderRadiusLG,limitVerticalRadius:!0})),(0,z.w)(e)),{resetStyle:!1});let Z=e=>{var t;let{menu:n,arrow:r,prefixCls:b,children:C,trigger:O,disabled:B,dropdownRender:k,popupRender:j,getPopupContainer:E,overlayClassName:z,rootClassName:N,overlayStyle:H,open:T,onOpenChange:P,visible:Z,onVisibleChange:M,mouseEnterDelay:D=.15,mouseLeaveDelay:A=.1,autoAdjustOverflow:W=!0,placement:L="",overlay:G,transitionName:X,destroyOnHidden:_,destroyPopupOnHide:q}=e,{getPopupContainer:F,getPrefixCls:Y,direction:V,dropdown:$}=o.useContext(y.E_),J=j||k;(0,v.ln)("Dropdown");let Q=o.useMemo(()=>{let e=Y();return void 0!==X?X:L.includes("top")?"".concat(e,"-slide-down"):"".concat(e,"-slide-up")},[Y,L,X]),U=o.useMemo(()=>L?L.includes("Center")?L.slice(0,L.indexOf("Center")):L:"rtl"===V?"bottomRight":"bottomLeft",[L,V]),K=Y("dropdown",b),ee=(0,I.Z)(K),[et,en,eo]=R(K,ee),[,ea]=(0,S.ZP)(),ec=o.Children.only(p(C)?o.createElement("span",null,C):C),er=(0,f.Tm)(ec,{className:l()("".concat(K,"-trigger"),{["".concat(K,"-rtl")]:"rtl"===V},ec.props.className),disabled:null!==(t=ec.props.disabled)&&void 0!==t?t:B}),el=B?[]:O,ei=!!(null==el?void 0:el.includes("contextMenu")),[ed,es]=(0,s.Z)(!1,{value:null!=T?T:Z}),eu=(0,d.Z)(e=>{null==P||P(e,{source:"trigger"}),null==M||M(e),es(e)}),em=l()(z,N,en,eo,ee,null==$?void 0:$.className,{["".concat(K,"-rtl")]:"rtl"===V}),ep=(0,g.Z)({arrowPointAtCenter:"object"==typeof r&&r.pointAtCenter,autoAdjustOverflow:W,offset:ea.marginXXS,arrowWidth:r?ea.sizePopupArrow:0,borderRadius:ea.borderRadius}),eg=(0,d.Z)(()=>{null!=n&&n.selectable&&null!=n&&n.multiple||(null==P||P(!1,{source:"menu"}),es(!1))}),[eb,ef]=(0,m.Cn)("Dropdown",null==H?void 0:H.zIndex),ev=o.createElement(i.Z,Object.assign({alignPoint:ei},(0,u.Z)(e,["rootClassName"]),{mouseEnterDelay:D,mouseLeaveDelay:A,visible:ed,builtinPlacements:ep,arrow:!!r,overlayClassName:em,prefixCls:K,getPopupContainer:E||F,transitionName:Q,trigger:el,overlay:()=>{let e;return e=(null==n?void 0:n.items)?o.createElement(x.Z,Object.assign({},n)):"function"==typeof G?G():G,J&&(e=J(e)),e=o.Children.only("string"==typeof e?o.createElement("span",null,e):e),o.createElement(w.J,{prefixCls:"".concat(K,"-menu"),rootClassName:l()(eo,ee),expandIcon:o.createElement("span",{className:"".concat(K,"-menu-submenu-arrow")},"rtl"===V?o.createElement(a.Z,{className:"".concat(K,"-menu-submenu-arrow-icon")}):o.createElement(c.Z,{className:"".concat(K,"-menu-submenu-arrow-icon")})),mode:"vertical",selectable:!1,onClick:eg,validator:e=>{let{mode:t}=e}},e)},placement:U,onVisibleChange:eu,overlayStyle:Object.assign(Object.assign(Object.assign({},null==$?void 0:$.style),H),{zIndex:eb}),autoDestroy:null!=_?_:q}),er);return eb&&(ev=o.createElement(h.Z.Provider,{value:ef},ev)),et(ev)},M=(0,b.Z)(Z,"align",void 0,"dropdown",e=>e);Z._InternalPanelDoNotUseOrYouWillBeFired=e=>o.createElement(M,Object.assign({},e),o.createElement("span",null));var D=n(39760),A=n(5545),W=n(58760),L=n(77685),G=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};let X=e=>{let{getPopupContainer:t,getPrefixCls:n,direction:a}=o.useContext(y.E_),{prefixCls:c,type:r="default",danger:i,disabled:d,loading:s,onClick:u,htmlType:m,children:p,className:g,menu:b,arrow:f,autoFocus:v,overlay:h,trigger:I,align:x,open:w,onOpenChange:S,placement:C,getPopupContainer:O,href:B,icon:k=o.createElement(D.Z,null),title:j,buttonsRender:E=e=>e,mouseEnterDelay:z,mouseLeaveDelay:N,overlayClassName:H,overlayStyle:T,destroyOnHidden:P,destroyPopupOnHide:R,dropdownRender:M,popupRender:X}=e,_=G(e,["prefixCls","type","danger","disabled","loading","onClick","htmlType","children","className","menu","arrow","autoFocus","overlay","trigger","align","open","onOpenChange","placement","getPopupContainer","href","icon","title","buttonsRender","mouseEnterDelay","mouseLeaveDelay","overlayClassName","overlayStyle","destroyOnHidden","destroyPopupOnHide","dropdownRender","popupRender"]),q=n("dropdown",c),F={menu:b,arrow:f,autoFocus:v,align:x,disabled:d,trigger:d?[]:I,onOpenChange:S,getPopupContainer:O||t,mouseEnterDelay:z,mouseLeaveDelay:N,overlayClassName:H,overlayStyle:T,destroyOnHidden:P,popupRender:X||M},{compactSize:Y,compactItemClassnames:V}=(0,L.ri)(q,a),$=l()("".concat(q,"-button"),V,g);"destroyPopupOnHide"in e&&(F.destroyPopupOnHide=R),"overlay"in e&&(F.overlay=h),"open"in e&&(F.open=w),"placement"in e?F.placement=C:F.placement="rtl"===a?"bottomLeft":"bottomRight";let[J,Q]=E([o.createElement(A.ZP,{type:r,danger:i,disabled:d,loading:s,onClick:u,htmlType:m,href:B,title:j},p),o.createElement(A.ZP,{type:r,danger:i,icon:k})]);return o.createElement(W.Z.Compact,Object.assign({className:$,size:Y,block:!0},_),J,o.createElement(Z,Object.assign({},F),Q))};X.__ANT_BUTTON=!0,Z.Button=X;var _=Z},32186:function(e,t,n){let o;n.d(t,{D:function(){return S},Z:function(){return O}});var a=n(2265),c=n(1119),r={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"bars",theme:"outlined"},l=n(55015),i=a.forwardRef(function(e,t){return a.createElement(l.Z,(0,c.Z)({},e,{ref:t,icon:r}))}),d=n(15327),s=n(77565),u=n(36760),m=n.n(u),p=n(18694),g=n(16774),b=n(71744),f=n(80856),v=n(93463),h=n(25437),y=(0,n(99320).I$)(["Layout","Sider"],e=>{let{componentCls:t,siderBg:n,motionDurationMid:o,motionDurationSlow:a,antCls:c,triggerHeight:r,triggerColor:l,triggerBg:i,headerHeight:d,zeroTriggerWidth:s,zeroTriggerHeight:u,borderRadiusLG:m,lightSiderBg:p,lightTriggerColor:g,lightTriggerBg:b,bodyBg:f}=e;return{[t]:{position:"relative",minWidth:0,background:n,transition:"all ".concat(o,", background 0s"),"&-has-trigger":{paddingBottom:r},"&-right":{order:1},["".concat(t,"-children")]:{height:"100%",marginTop:-.1,paddingTop:.1,["".concat(c,"-menu").concat(c,"-menu-inline-collapsed")]:{width:"auto"}},["&-zero-width ".concat(t,"-children")]:{overflow:"hidden"},["".concat(t,"-trigger")]:{position:"fixed",bottom:0,zIndex:1,height:r,color:l,lineHeight:(0,v.bf)(r),textAlign:"center",background:i,cursor:"pointer",transition:"all ".concat(o)},["".concat(t,"-zero-width-trigger")]:{position:"absolute",top:d,insetInlineEnd:e.calc(s).mul(-1).equal(),zIndex:1,width:s,height:u,color:l,fontSize:e.fontSizeXL,display:"flex",alignItems:"center",justifyContent:"center",background:n,borderRadius:"0 ".concat((0,v.bf)(m)," ").concat((0,v.bf)(m)," 0"),cursor:"pointer",transition:"background ".concat(a," ease"),"&::after":{position:"absolute",inset:0,background:"transparent",transition:"all ".concat(a),content:'""'},"&:hover::after":{background:"rgba(255, 255, 255, 0.2)"},"&-right":{insetInlineStart:e.calc(s).mul(-1).equal(),borderRadius:"".concat((0,v.bf)(m)," 0 0 ").concat((0,v.bf)(m))}},"&-light":{background:p,["".concat(t,"-trigger")]:{color:g,background:b},["".concat(t,"-zero-width-trigger")]:{color:g,background:b,border:"1px solid ".concat(f),borderInlineStart:0}}}}},h.eh,{deprecatedTokens:h.jn}),I=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};let x={xs:"479.98px",sm:"575.98px",md:"767.98px",lg:"991.98px",xl:"1199.98px",xxl:"1599.98px"},w=e=>!Number.isNaN(Number.parseFloat(e))&&Number.isFinite(Number(e)),S=a.createContext({}),C=(o=0,function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return o+=1,"".concat(e).concat(o)});var O=a.forwardRef((e,t)=>{let{prefixCls:n,className:o,trigger:c,children:r,defaultCollapsed:l=!1,theme:u="dark",style:v={},collapsible:h=!1,reverseArrow:O=!1,width:B=200,collapsedWidth:k=80,zeroWidthTriggerStyle:j,breakpoint:E,onCollapse:z,onBreakpoint:N}=e,H=I(e,["prefixCls","className","trigger","children","defaultCollapsed","theme","style","collapsible","reverseArrow","width","collapsedWidth","zeroWidthTriggerStyle","breakpoint","onCollapse","onBreakpoint"]),{siderHook:T}=(0,a.useContext)(f.V),[P,R]=(0,a.useState)("collapsed"in e?e.collapsed:l),[Z,M]=(0,a.useState)(!1);(0,a.useEffect)(()=>{"collapsed"in e&&R(e.collapsed)},[e.collapsed]);let D=(t,n)=>{"collapsed"in e||R(t),null==z||z(t,n)},{getPrefixCls:A,direction:W}=(0,a.useContext)(b.E_),L=A("layout-sider",n),[G,X,_]=y(L),q=(0,a.useRef)(null);q.current=e=>{M(e.matches),null==N||N(e.matches),P!==e.matches&&D(e.matches,"responsive")},(0,a.useEffect)(()=>{let e;function t(e){var t;return null===(t=q.current)||void 0===t?void 0:t.call(q,e)}return void 0!==(null==window?void 0:window.matchMedia)&&E&&E in x&&(e=window.matchMedia("screen and (max-width: ".concat(x[E],")")),(0,g.x)(e,t),t(e)),()=>{(0,g.h)(e,t)}},[E]),(0,a.useEffect)(()=>{let e=C("ant-sider-");return T.addSider(e),()=>T.removeSider(e)},[]);let F=()=>{D(!P,"clickTrigger")},Y=(0,p.Z)(H,["collapsed"]),V=P?k:B,$=w(V)?"".concat(V,"px"):String(V),J=0===Number.parseFloat(String(k||0))?a.createElement("span",{onClick:F,className:m()("".concat(L,"-zero-width-trigger"),"".concat(L,"-zero-width-trigger-").concat(O?"right":"left")),style:j},c||a.createElement(i,null)):null,Q="rtl"===W==!O,U={expanded:Q?a.createElement(s.Z,null):a.createElement(d.Z,null),collapsed:Q?a.createElement(d.Z,null):a.createElement(s.Z,null)}[P?"collapsed":"expanded"],K=null!==c?J||a.createElement("div",{className:"".concat(L,"-trigger"),onClick:F,style:{width:$}},c||U):null,ee=Object.assign(Object.assign({},v),{flex:"0 0 ".concat($),maxWidth:$,minWidth:$,width:$}),et=m()(L,"".concat(L,"-").concat(u),{["".concat(L,"-collapsed")]:!!P,["".concat(L,"-has-trigger")]:h&&null!==c&&!J,["".concat(L,"-below")]:!!Z,["".concat(L,"-zero-width")]:0===Number.parseFloat($)},o,X,_),en=a.useMemo(()=>({siderCollapsed:P}),[P]);return G(a.createElement(S.Provider,{value:en},a.createElement("aside",Object.assign({className:et},Y,{style:ee,ref:t}),a.createElement("div",{className:"".concat(L,"-children")},r),h||Z&&J?K:null)))})},80856:function(e,t,n){n.d(t,{V:function(){return o}});let o=n(2265).createContext({siderHook:{addSider:()=>null,removeSider:()=>null}})},25437:function(e,t,n){n.d(t,{eh:function(){return c},jn:function(){return r}});var o=n(93463),a=n(99320);let c=e=>{let{colorBgLayout:t,controlHeight:n,controlHeightLG:o,colorText:a,controlHeightSM:c,marginXXS:r,colorTextLightSolid:l,colorBgContainer:i}=e,d=1.25*o;return{colorBgHeader:"#001529",colorBgBody:t,colorBgTrigger:"#002140",bodyBg:t,headerBg:"#001529",headerHeight:2*n,headerPadding:"0 ".concat(d,"px"),headerColor:a,footerPadding:"".concat(c,"px ").concat(d,"px"),footerBg:t,siderBg:"#001529",triggerHeight:o+2*r,triggerBg:"#002140",triggerColor:l,zeroTriggerWidth:o,zeroTriggerHeight:o,lightSiderBg:i,lightTriggerBg:i,lightTriggerColor:a}},r=[["colorBgBody","bodyBg"],["colorBgHeader","headerBg"],["colorBgTrigger","triggerBg"]];t.ZP=(0,a.I$)("Layout",e=>{let{antCls:t,componentCls:n,colorText:a,footerBg:c,headerHeight:r,headerPadding:l,headerColor:i,footerPadding:d,fontSize:s,bodyBg:u,headerBg:m}=e;return{[n]:{display:"flex",flex:"auto",flexDirection:"column",minHeight:0,background:u,"&, *":{boxSizing:"border-box"},["&".concat(n,"-has-sider")]:{flexDirection:"row",["> ".concat(n,", > ").concat(n,"-content")]:{width:0}},["".concat(n,"-header, &").concat(n,"-footer")]:{flex:"0 0 auto"},"&-rtl":{direction:"rtl"}},["".concat(n,"-header")]:{height:r,padding:l,color:i,lineHeight:(0,o.bf)(r),background:m,["".concat(t,"-menu")]:{lineHeight:"inherit"}},["".concat(n,"-footer")]:{padding:d,color:a,fontSize:s,background:c},["".concat(n,"-content")]:{flex:"auto",color:a,minHeight:0}}},c,{deprecatedTokens:r})},88208:function(e,t,n){n.d(t,{J:function(){return i}});var o=n(2265),a=n(28791),c=n(391),r=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};let l=o.createContext(null),i=o.forwardRef((e,t)=>{let{children:n}=e,i=r(e,["children"]),d=o.useContext(l),s=o.useMemo(()=>Object.assign(Object.assign({},d),i),[d,i.prefixCls,i.mode,i.selectable,i.rootClassName]),u=(0,a.t4)(n),m=(0,a.x1)(t,u?(0,a.C4)(n):null);return o.createElement(l.Provider,{value:s},o.createElement(c.Z,{space:!0},u?o.cloneElement(n,{ref:m}):n))});t.Z=l},60985:function(e,t,n){n.d(t,{Z:function(){return Y}});var o=n(2265),a=n(33082),c=n(32186),r=n(39760),l=n(36760),i=n.n(l),d=n(58525),s=n(18694),u=n(68710),m=n(19722),p=n(71744),g=n(64024);let b=(0,o.createContext)({prefixCls:"",firstLevel:!0,inlineCollapsed:!1});var f=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n},v=e=>{let{prefixCls:t,className:n,dashed:c}=e,r=f(e,["prefixCls","className","dashed"]),{getPrefixCls:l}=o.useContext(p.E_),d=l("menu",t),s=i()({["".concat(d,"-item-divider-dashed")]:!!c},n);return o.createElement(a.iz,Object.assign({className:s},r))},h=n(45287),y=n(99981),I=e=>{var t;let{className:n,children:r,icon:l,title:d,danger:u,extra:p}=e,{prefixCls:g,firstLevel:f,direction:v,disableMenuItemTitleTooltip:I,inlineCollapsed:x}=o.useContext(b),{siderCollapsed:w}=o.useContext(c.D),S=d;void 0===d?S=f?r:"":!1===d&&(S="");let C={title:S};w||x||(C.title=null,C.open=!1);let O=(0,h.Z)(r).length,B=o.createElement(a.ck,Object.assign({},(0,s.Z)(e,["title","icon","danger"]),{className:i()({["".concat(g,"-item-danger")]:u,["".concat(g,"-item-only-child")]:(l?O+1:O)===1},n),title:"string"==typeof d?d:void 0}),(0,m.Tm)(l,{className:i()(o.isValidElement(l)?null===(t=l.props)||void 0===t?void 0:t.className:void 0,"".concat(g,"-item-icon"))}),(e=>{let t=null==r?void 0:r[0],n=o.createElement("span",{className:i()("".concat(g,"-title-content"),{["".concat(g,"-title-content-with-extra")]:!!p||0===p})},r);return(!l||o.isValidElement(r)&&"span"===r.type)&&r&&e&&f&&"string"==typeof t?o.createElement("div",{className:"".concat(g,"-inline-collapsed-noicon")},t.charAt(0)):n})(x));return I||(B=o.createElement(y.Z,Object.assign({},C,{placement:"rtl"===v?"left":"right",classNames:{root:"".concat(g,"-inline-collapsed-tooltip")}}),B)),B},x=n(88208),w=n(93463),S=n(54558),C=n(12918),O=n(63074),B=n(18544),k=n(691),j=n(99320),E=n(71140),z=e=>{let{componentCls:t,motionDurationSlow:n,horizontalLineHeight:o,colorSplit:a,lineWidth:c,lineType:r,itemPaddingInline:l}=e;return{["".concat(t,"-horizontal")]:{lineHeight:o,border:0,borderBottom:"".concat((0,w.bf)(c)," ").concat(r," ").concat(a),boxShadow:"none","&::after":{display:"block",clear:"both",height:0,content:'"\\20"'},["".concat(t,"-item, ").concat(t,"-submenu")]:{position:"relative",display:"inline-block",verticalAlign:"bottom",paddingInline:l},["> ".concat(t,"-item:hover,\n > ").concat(t,"-item-active,\n > ").concat(t,"-submenu ").concat(t,"-submenu-title:hover")]:{backgroundColor:"transparent"},["".concat(t,"-item, ").concat(t,"-submenu-title")]:{transition:["border-color ".concat(n),"background ".concat(n)].join(",")},["".concat(t,"-submenu-arrow")]:{display:"none"}}}},N=e=>{let{componentCls:t,menuArrowOffset:n,calc:o}=e;return{["".concat(t,"-rtl")]:{direction:"rtl"},["".concat(t,"-submenu-rtl")]:{transformOrigin:"100% 0"},["".concat(t,"-rtl").concat(t,"-vertical,\n ").concat(t,"-submenu-rtl ").concat(t,"-vertical")]:{["".concat(t,"-submenu-arrow")]:{"&::before":{transform:"rotate(-45deg) translateY(".concat((0,w.bf)(o(n).mul(-1).equal()),")")},"&::after":{transform:"rotate(45deg) translateY(".concat((0,w.bf)(n),")")}}}}};let H=e=>(0,C.oN)(e);var T=(e,t)=>{let{componentCls:n,itemColor:o,itemSelectedColor:a,subMenuItemSelectedColor:c,groupTitleColor:r,itemBg:l,subMenuItemBg:i,itemSelectedBg:d,activeBarHeight:s,activeBarWidth:u,activeBarBorderWidth:m,motionDurationSlow:p,motionEaseInOut:g,motionEaseOut:b,itemPaddingInline:f,motionDurationMid:v,itemHoverColor:h,lineType:y,colorSplit:I,itemDisabledColor:x,dangerItemColor:S,dangerItemHoverColor:C,dangerItemSelectedColor:O,dangerItemActiveBg:B,dangerItemSelectedBg:k,popupBg:j,itemHoverBg:E,itemActiveBg:z,menuSubMenuBg:N,horizontalItemSelectedColor:T,horizontalItemSelectedBg:P,horizontalItemBorderRadius:R,horizontalItemHoverBg:Z}=e;return{["".concat(n,"-").concat(t,", ").concat(n,"-").concat(t," > ").concat(n)]:{color:o,background:l,["&".concat(n,"-root:focus-visible")]:Object.assign({},H(e)),["".concat(n,"-item")]:{"&-group-title, &-extra":{color:r}},["".concat(n,"-submenu-selected > ").concat(n,"-submenu-title")]:{color:c},["".concat(n,"-item, ").concat(n,"-submenu-title")]:{color:o,["&:not(".concat(n,"-item-disabled):focus-visible")]:Object.assign({},H(e))},["".concat(n,"-item-disabled, ").concat(n,"-submenu-disabled")]:{color:"".concat(x," !important")},["".concat(n,"-item:not(").concat(n,"-item-selected):not(").concat(n,"-submenu-selected)")]:{["&:hover, > ".concat(n,"-submenu-title:hover")]:{color:h}},["&:not(".concat(n,"-horizontal)")]:{["".concat(n,"-item:not(").concat(n,"-item-selected)")]:{"&:hover":{backgroundColor:E},"&:active":{backgroundColor:z}},["".concat(n,"-submenu-title")]:{"&:hover":{backgroundColor:E},"&:active":{backgroundColor:z}}},["".concat(n,"-item-danger")]:{color:S,["&".concat(n,"-item:hover")]:{["&:not(".concat(n,"-item-selected):not(").concat(n,"-submenu-selected)")]:{color:C}},["&".concat(n,"-item:active")]:{background:B}},["".concat(n,"-item a")]:{"&, &:hover":{color:"inherit"}},["".concat(n,"-item-selected")]:{color:a,["&".concat(n,"-item-danger")]:{color:O},"a, a:hover":{color:"inherit"}},["& ".concat(n,"-item-selected")]:{backgroundColor:d,["&".concat(n,"-item-danger")]:{backgroundColor:k}},["&".concat(n,"-submenu > ").concat(n)]:{backgroundColor:N},["&".concat(n,"-popup > ").concat(n)]:{backgroundColor:j},["&".concat(n,"-submenu-popup > ").concat(n)]:{backgroundColor:j},["&".concat(n,"-horizontal")]:Object.assign(Object.assign({},"dark"===t?{borderBottom:0}:{}),{["> ".concat(n,"-item, > ").concat(n,"-submenu")]:{top:m,marginTop:e.calc(m).mul(-1).equal(),marginBottom:0,borderRadius:R,"&::after":{position:"absolute",insetInline:f,bottom:0,borderBottom:"".concat((0,w.bf)(s)," solid transparent"),transition:"border-color ".concat(p," ").concat(g),content:'""'},"&:hover, &-active, &-open":{background:Z,"&::after":{borderBottomWidth:s,borderBottomColor:T}},"&-selected":{color:T,backgroundColor:P,"&:hover":{backgroundColor:P},"&::after":{borderBottomWidth:s,borderBottomColor:T}}}}),["&".concat(n,"-root")]:{["&".concat(n,"-inline, &").concat(n,"-vertical")]:{borderInlineEnd:"".concat((0,w.bf)(m)," ").concat(y," ").concat(I)}},["&".concat(n,"-inline")]:{["".concat(n,"-sub").concat(n,"-inline")]:{background:i},["".concat(n,"-item")]:{position:"relative","&::after":{position:"absolute",insetBlock:0,insetInlineEnd:0,borderInlineEnd:"".concat((0,w.bf)(u)," solid ").concat(a),transform:"scaleY(0.0001)",opacity:0,transition:["transform ".concat(v," ").concat(b),"opacity ".concat(v," ").concat(b)].join(","),content:'""'},["&".concat(n,"-item-danger")]:{"&::after":{borderInlineEndColor:O}}},["".concat(n,"-selected, ").concat(n,"-item-selected")]:{"&::after":{transform:"scaleY(1)",opacity:1,transition:["transform ".concat(v," ").concat(g),"opacity ".concat(v," ").concat(g)].join(",")}}}}}};let P=e=>{let{componentCls:t,itemHeight:n,itemMarginInline:o,padding:a,menuArrowSize:c,marginXS:r,itemMarginBlock:l,itemWidth:i,itemPaddingInline:d}=e,s=e.calc(c).add(a).add(r).equal();return{["".concat(t,"-item")]:{position:"relative",overflow:"hidden"},["".concat(t,"-item, ").concat(t,"-submenu-title")]:{height:n,lineHeight:(0,w.bf)(n),paddingInline:d,overflow:"hidden",textOverflow:"ellipsis",marginInline:o,marginBlock:l,width:i},["> ".concat(t,"-item,\n > ").concat(t,"-submenu > ").concat(t,"-submenu-title")]:{height:n,lineHeight:(0,w.bf)(n)},["".concat(t,"-item-group-list ").concat(t,"-submenu-title,\n ").concat(t,"-submenu-title")]:{paddingInlineEnd:s}}};var R=e=>{let{componentCls:t,iconCls:n,itemHeight:o,colorTextLightSolid:a,dropdownWidth:c,controlHeightLG:r,motionEaseOut:l,paddingXL:i,itemMarginInline:d,fontSizeLG:s,motionDurationFast:u,motionDurationSlow:m,paddingXS:p,boxShadowSecondary:g,collapsedWidth:b,collapsedIconSize:f}=e,v={height:o,lineHeight:(0,w.bf)(o),listStylePosition:"inside",listStyleType:"disc"};return[{[t]:{"&-inline, &-vertical":Object.assign({["&".concat(t,"-root")]:{boxShadow:"none"}},P(e))},["".concat(t,"-submenu-popup")]:{["".concat(t,"-vertical")]:Object.assign(Object.assign({},P(e)),{boxShadow:g})}},{["".concat(t,"-submenu-popup ").concat(t,"-vertical").concat(t,"-sub")]:{minWidth:c,maxHeight:"calc(100vh - ".concat((0,w.bf)(e.calc(r).mul(2.5).equal()),")"),padding:"0",overflow:"hidden",borderInlineEnd:0,"&:not([class*='-active'])":{overflowX:"hidden",overflowY:"auto"}}},{["".concat(t,"-inline")]:{width:"100%",["&".concat(t,"-root")]:{["".concat(t,"-item, ").concat(t,"-submenu-title")]:{display:"flex",alignItems:"center",transition:["border-color ".concat(m),"background ".concat(m),"padding ".concat(u," ").concat(l)].join(","),["> ".concat(t,"-title-content")]:{flex:"auto",minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},"> *":{flex:"none"}}},["".concat(t,"-sub").concat(t,"-inline")]:{padding:0,border:0,borderRadius:0,boxShadow:"none",["& > ".concat(t,"-submenu > ").concat(t,"-submenu-title")]:v,["& ".concat(t,"-item-group-title")]:{paddingInlineStart:i}},["".concat(t,"-item")]:v}},{["".concat(t,"-inline-collapsed")]:{width:b,["&".concat(t,"-root")]:{["".concat(t,"-item, ").concat(t,"-submenu ").concat(t,"-submenu-title")]:{["> ".concat(t,"-inline-collapsed-noicon")]:{fontSize:s,textAlign:"center"}}},["> ".concat(t,"-item,\n > ").concat(t,"-item-group > ").concat(t,"-item-group-list > ").concat(t,"-item,\n > ").concat(t,"-item-group > ").concat(t,"-item-group-list > ").concat(t,"-submenu > ").concat(t,"-submenu-title,\n > ").concat(t,"-submenu > ").concat(t,"-submenu-title")]:{insetInlineStart:0,paddingInline:"calc(50% - ".concat((0,w.bf)(e.calc(f).div(2).equal())," - ").concat((0,w.bf)(d),")"),textOverflow:"clip",["\n ".concat(t,"-submenu-arrow,\n ").concat(t,"-submenu-expand-icon\n ")]:{opacity:0},["".concat(t,"-item-icon, ").concat(n)]:{margin:0,fontSize:f,lineHeight:(0,w.bf)(o),"+ span":{display:"inline-block",opacity:0}}},["".concat(t,"-item-icon, ").concat(n)]:{display:"inline-block"},"&-tooltip":{pointerEvents:"none",["".concat(t,"-item-icon, ").concat(n)]:{display:"none"},"a, a:hover":{color:a}},["".concat(t,"-item-group-title")]:Object.assign(Object.assign({},C.vS),{paddingInline:p})}}]};let Z=e=>{let{componentCls:t,motionDurationSlow:n,motionDurationMid:o,motionEaseInOut:a,motionEaseOut:c,iconCls:r,iconSize:l,iconMarginInlineEnd:i}=e;return{["".concat(t,"-item, ").concat(t,"-submenu-title")]:{position:"relative",display:"block",margin:0,whiteSpace:"nowrap",cursor:"pointer",transition:["border-color ".concat(n),"background ".concat(n),"padding calc(".concat(n," + 0.1s) ").concat(a)].join(","),["".concat(t,"-item-icon, ").concat(r)]:{minWidth:l,fontSize:l,transition:["font-size ".concat(o," ").concat(c),"margin ".concat(n," ").concat(a),"color ".concat(n)].join(","),"+ span":{marginInlineStart:i,opacity:1,transition:["opacity ".concat(n," ").concat(a),"margin ".concat(n),"color ".concat(n)].join(",")}},["".concat(t,"-item-icon")]:Object.assign({},(0,C.Ro)()),["&".concat(t,"-item-only-child")]:{["> ".concat(r,", > ").concat(t,"-item-icon")]:{marginInlineEnd:0}}},["".concat(t,"-item-disabled, ").concat(t,"-submenu-disabled")]:{background:"none !important",cursor:"not-allowed","&::after":{borderColor:"transparent !important"},a:{color:"inherit !important",cursor:"not-allowed",pointerEvents:"none"},["> ".concat(t,"-submenu-title")]:{color:"inherit !important",cursor:"not-allowed"}}}},M=e=>{let{componentCls:t,motionDurationSlow:n,motionEaseInOut:o,borderRadius:a,menuArrowSize:c,menuArrowOffset:r}=e;return{["".concat(t,"-submenu")]:{"&-expand-icon, &-arrow":{position:"absolute",top:"50%",insetInlineEnd:e.margin,width:c,color:"currentcolor",transform:"translateY(-50%)",transition:"transform ".concat(n," ").concat(o,", opacity ").concat(n)},"&-arrow":{"&::before, &::after":{position:"absolute",width:e.calc(c).mul(.6).equal(),height:e.calc(c).mul(.15).equal(),backgroundColor:"currentcolor",borderRadius:a,transition:["background ".concat(n," ").concat(o),"transform ".concat(n," ").concat(o),"top ".concat(n," ").concat(o),"color ".concat(n," ").concat(o)].join(","),content:'""'},"&::before":{transform:"rotate(45deg) translateY(".concat((0,w.bf)(e.calc(r).mul(-1).equal()),")")},"&::after":{transform:"rotate(-45deg) translateY(".concat((0,w.bf)(r),")")}}}}},D=e=>{let{antCls:t,componentCls:n,fontSize:o,motionDurationSlow:a,motionDurationMid:c,motionEaseInOut:r,paddingXS:l,padding:i,colorSplit:d,lineWidth:s,zIndexPopup:u,borderRadiusLG:m,subMenuItemBorderRadius:p,menuArrowSize:g,menuArrowOffset:b,lineType:f,groupTitleLineHeight:v,groupTitleFontSize:h}=e;return[{"":{[n]:Object.assign(Object.assign({},(0,C.dF)()),{"&-hidden":{display:"none"}})},["".concat(n,"-submenu-hidden")]:{display:"none"}},{[n]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},(0,C.Wf)(e)),(0,C.dF)()),{marginBottom:0,paddingInlineStart:0,fontSize:o,lineHeight:0,listStyle:"none",outline:"none",transition:"width ".concat(a," cubic-bezier(0.2, 0, 0, 1) 0s"),"ul, ol":{margin:0,padding:0,listStyle:"none"},"&-overflow":{display:"flex",["".concat(n,"-item")]:{flex:"none"}},["".concat(n,"-item, ").concat(n,"-submenu, ").concat(n,"-submenu-title")]:{borderRadius:e.itemBorderRadius},["".concat(n,"-item-group-title")]:{padding:"".concat((0,w.bf)(l)," ").concat((0,w.bf)(i)),fontSize:h,lineHeight:v,transition:"all ".concat(a)},["&-horizontal ".concat(n,"-submenu")]:{transition:["border-color ".concat(a," ").concat(r),"background ".concat(a," ").concat(r)].join(",")},["".concat(n,"-submenu, ").concat(n,"-submenu-inline")]:{transition:["border-color ".concat(a," ").concat(r),"background ".concat(a," ").concat(r),"padding ".concat(c," ").concat(r)].join(",")},["".concat(n,"-submenu ").concat(n,"-sub")]:{cursor:"initial",transition:["background ".concat(a," ").concat(r),"padding ".concat(a," ").concat(r)].join(",")},["".concat(n,"-title-content")]:{transition:"color ".concat(a),"&-with-extra":{display:"inline-flex",alignItems:"center",width:"100%"},["> ".concat(t,"-typography-ellipsis-single-line")]:{display:"inline",verticalAlign:"unset"},["".concat(n,"-item-extra")]:{marginInlineStart:"auto",paddingInlineStart:e.padding}},["".concat(n,"-item a")]:{"&::before":{position:"absolute",inset:0,backgroundColor:"transparent",content:'""'}},["".concat(n,"-item-divider")]:{overflow:"hidden",lineHeight:0,borderColor:d,borderStyle:f,borderWidth:0,borderTopWidth:s,marginBlock:s,padding:0,"&-dashed":{borderStyle:"dashed"}}}),Z(e)),{["".concat(n,"-item-group")]:{["".concat(n,"-item-group-list")]:{margin:0,padding:0,["".concat(n,"-item, ").concat(n,"-submenu-title")]:{paddingInline:"".concat((0,w.bf)(e.calc(o).mul(2).equal())," ").concat((0,w.bf)(i))}}},"&-submenu":{"&-popup":{position:"absolute",zIndex:u,borderRadius:m,boxShadow:"none",transformOrigin:"0 0",["&".concat(n,"-submenu")]:{background:"transparent"},"&::before":{position:"absolute",inset:0,zIndex:-1,width:"100%",height:"100%",opacity:0,content:'""'},["> ".concat(n)]:Object.assign(Object.assign(Object.assign({borderRadius:m},Z(e)),M(e)),{["".concat(n,"-item, ").concat(n,"-submenu > ").concat(n,"-submenu-title")]:{borderRadius:p},["".concat(n,"-submenu-title::after")]:{transition:"transform ".concat(a," ").concat(r)}})},"\n &-placement-leftTop,\n &-placement-bottomRight,\n ":{transformOrigin:"100% 0"},"\n &-placement-leftBottom,\n &-placement-topRight,\n ":{transformOrigin:"100% 100%"},"\n &-placement-rightBottom,\n &-placement-topLeft,\n ":{transformOrigin:"0 100%"},"\n &-placement-bottomLeft,\n &-placement-rightTop,\n ":{transformOrigin:"0 0"},"\n &-placement-leftTop,\n &-placement-leftBottom\n ":{paddingInlineEnd:e.paddingXS},"\n &-placement-rightTop,\n &-placement-rightBottom\n ":{paddingInlineStart:e.paddingXS},"\n &-placement-topRight,\n &-placement-topLeft\n ":{paddingBottom:e.paddingXS},"\n &-placement-bottomRight,\n &-placement-bottomLeft\n ":{paddingTop:e.paddingXS}}}),M(e)),{["&-inline-collapsed ".concat(n,"-submenu-arrow,\n &-inline ").concat(n,"-submenu-arrow")]:{"&::before":{transform:"rotate(-45deg) translateX(".concat((0,w.bf)(b),")")},"&::after":{transform:"rotate(45deg) translateX(".concat((0,w.bf)(e.calc(b).mul(-1).equal()),")")}},["".concat(n,"-submenu-open").concat(n,"-submenu-inline > ").concat(n,"-submenu-title > ").concat(n,"-submenu-arrow")]:{transform:"translateY(".concat((0,w.bf)(e.calc(g).mul(.2).mul(-1).equal()),")"),"&::after":{transform:"rotate(-45deg) translateX(".concat((0,w.bf)(e.calc(b).mul(-1).equal()),")")},"&::before":{transform:"rotate(45deg) translateX(".concat((0,w.bf)(b),")")}}})},{["".concat(t,"-layout-header")]:{[n]:{lineHeight:"inherit"}}}]},A=e=>{var t,n,o;let{colorPrimary:a,colorError:c,colorTextDisabled:r,colorErrorBg:l,colorText:i,colorTextDescription:d,colorBgContainer:s,colorFillAlter:u,colorFillContent:m,lineWidth:p,lineWidthBold:g,controlItemBgActive:b,colorBgTextHover:f,controlHeightLG:v,lineHeight:h,colorBgElevated:y,marginXXS:I,padding:x,fontSize:w,controlHeightSM:C,fontSizeLG:O,colorTextLightSolid:B,colorErrorHover:k}=e,j=null!==(t=e.activeBarWidth)&&void 0!==t?t:0,E=null!==(n=e.activeBarBorderWidth)&&void 0!==n?n:p,z=null!==(o=e.itemMarginInline)&&void 0!==o?o:e.marginXXS,N=new S.t(B).setA(.65).toRgbString();return{dropdownWidth:160,zIndexPopup:e.zIndexPopupBase+50,radiusItem:e.borderRadiusLG,itemBorderRadius:e.borderRadiusLG,radiusSubMenuItem:e.borderRadiusSM,subMenuItemBorderRadius:e.borderRadiusSM,colorItemText:i,itemColor:i,colorItemTextHover:i,itemHoverColor:i,colorItemTextHoverHorizontal:a,horizontalItemHoverColor:a,colorGroupTitle:d,groupTitleColor:d,colorItemTextSelected:a,itemSelectedColor:a,subMenuItemSelectedColor:a,colorItemTextSelectedHorizontal:a,horizontalItemSelectedColor:a,colorItemBg:s,itemBg:s,colorItemBgHover:f,itemHoverBg:f,colorItemBgActive:m,itemActiveBg:b,colorSubItemBg:u,subMenuItemBg:u,colorItemBgSelected:b,itemSelectedBg:b,colorItemBgSelectedHorizontal:"transparent",horizontalItemSelectedBg:"transparent",colorActiveBarWidth:0,activeBarWidth:j,colorActiveBarHeight:g,activeBarHeight:g,colorActiveBarBorderSize:p,activeBarBorderWidth:E,colorItemTextDisabled:r,itemDisabledColor:r,colorDangerItemText:c,dangerItemColor:c,colorDangerItemTextHover:c,dangerItemHoverColor:c,colorDangerItemTextSelected:c,dangerItemSelectedColor:c,colorDangerItemBgActive:l,dangerItemActiveBg:l,colorDangerItemBgSelected:l,dangerItemSelectedBg:l,itemMarginInline:z,horizontalItemBorderRadius:0,horizontalItemHoverBg:"transparent",itemHeight:v,groupTitleLineHeight:h,collapsedWidth:2*v,popupBg:y,itemMarginBlock:I,itemPaddingInline:x,horizontalLineHeight:"".concat(1.15*v,"px"),iconSize:w,iconMarginInlineEnd:C-w,collapsedIconSize:O,groupTitleFontSize:w,darkItemDisabledColor:new S.t(B).setA(.25).toRgbString(),darkItemColor:N,darkDangerItemColor:c,darkItemBg:"#001529",darkPopupBg:"#001529",darkSubMenuItemBg:"#000c17",darkItemSelectedColor:B,darkItemSelectedBg:a,darkDangerItemSelectedBg:c,darkItemHoverBg:"transparent",darkGroupTitleColor:N,darkItemHoverColor:B,darkDangerItemHoverColor:k,darkDangerItemSelectedColor:B,darkDangerItemActiveBg:c,itemWidth:j?"calc(100% + ".concat(E,"px)"):"calc(100% - ".concat(2*z,"px)")}};var W=n(62236),L=e=>{var t;let n;let{popupClassName:c,icon:r,title:l,theme:d}=e,u=o.useContext(b),{prefixCls:p,inlineCollapsed:g,theme:f}=u,v=(0,a.Xl)();if(r){let e=o.isValidElement(l)&&"span"===l.type;n=o.createElement(o.Fragment,null,(0,m.Tm)(r,{className:i()(o.isValidElement(r)?null===(t=r.props)||void 0===t?void 0:t.className:void 0,"".concat(p,"-item-icon"))}),e?l:o.createElement("span",{className:"".concat(p,"-title-content")},l))}else n=g&&!v.length&&l&&"string"==typeof l?o.createElement("div",{className:"".concat(p,"-inline-collapsed-noicon")},l.charAt(0)):o.createElement("span",{className:"".concat(p,"-title-content")},l);let h=o.useMemo(()=>Object.assign(Object.assign({},u),{firstLevel:!1}),[u]),[y]=(0,W.Cn)("Menu");return o.createElement(b.Provider,{value:h},o.createElement(a.Wd,Object.assign({},(0,s.Z)(e,["icon"]),{title:n,popupClassName:i()(p,c,"".concat(p,"-").concat(d||f)),popupStyle:Object.assign({zIndex:y},e.popupStyle)})))},G=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};function X(e){return null===e||!1===e}let _={item:I,submenu:L,divider:v},q=(0,o.forwardRef)((e,t)=>{var n;let c=o.useContext(x.Z),l=c||{},{getPrefixCls:f,getPopupContainer:v,direction:h,menu:y}=o.useContext(p.E_),I=f(),{prefixCls:w,className:S,style:C,theme:H="light",expandIcon:P,_internalDisableMenuItemTitleTooltip:Z,inlineCollapsed:M,siderCollapsed:W,rootClassName:L,mode:q,selectable:F,onClick:Y,overflowedIndicatorPopupClassName:V}=e,$=G(e,["prefixCls","className","style","theme","expandIcon","_internalDisableMenuItemTitleTooltip","inlineCollapsed","siderCollapsed","rootClassName","mode","selectable","onClick","overflowedIndicatorPopupClassName"]),J=(0,s.Z)($,["collapsedWidth"]);null===(n=l.validator)||void 0===n||n.call(l,{mode:q});let Q=(0,d.Z)(function(){for(var e,t=arguments.length,n=Array(t),o=0;o1&&void 0!==arguments[1]?arguments[1]:e,n=!(arguments.length>2)||void 0===arguments[2]||arguments[2];return(0,j.I$)("Menu",e=>{let{colorBgElevated:t,controlHeightLG:n,fontSize:o,darkItemColor:a,darkDangerItemColor:c,darkItemBg:r,darkSubMenuItemBg:l,darkItemSelectedColor:i,darkItemSelectedBg:d,darkDangerItemSelectedBg:s,darkItemHoverBg:u,darkGroupTitleColor:m,darkItemHoverColor:p,darkItemDisabledColor:g,darkDangerItemHoverColor:b,darkDangerItemSelectedColor:f,darkDangerItemActiveBg:v,popupBg:h,darkPopupBg:y}=e,I=e.calc(o).div(7).mul(5).equal(),x=(0,E.IX)(e,{menuArrowSize:I,menuHorizontalHeight:e.calc(n).mul(1.15).equal(),menuArrowOffset:e.calc(I).mul(.25).equal(),menuSubMenuBg:t,calc:e.calc,popupBg:h}),w=(0,E.IX)(x,{itemColor:a,itemHoverColor:p,groupTitleColor:m,itemSelectedColor:i,subMenuItemSelectedColor:i,itemBg:r,popupBg:y,subMenuItemBg:l,itemActiveBg:"transparent",itemSelectedBg:d,activeBarHeight:0,activeBarBorderWidth:0,itemHoverBg:u,itemDisabledColor:g,dangerItemColor:c,dangerItemHoverColor:b,dangerItemSelectedColor:f,dangerItemActiveBg:v,dangerItemSelectedBg:s,menuSubMenuBg:l,horizontalItemSelectedColor:i,horizontalItemSelectedBg:d});return[D(x),z(x),R(x),T(x,"light"),T(w,"dark"),N(x),(0,O.Z)(x),(0,B.oN)(x,"slide-up"),(0,B.oN)(x,"slide-down"),(0,k._y)(x,"zoom-big")]},A,{deprecatedTokens:[["colorGroupTitle","groupTitleColor"],["radiusItem","itemBorderRadius"],["radiusSubMenuItem","subMenuItemBorderRadius"],["colorItemText","itemColor"],["colorItemTextHover","itemHoverColor"],["colorItemTextHoverHorizontal","horizontalItemHoverColor"],["colorItemTextSelected","itemSelectedColor"],["colorItemTextSelectedHorizontal","horizontalItemSelectedColor"],["colorItemTextDisabled","itemDisabledColor"],["colorDangerItemText","dangerItemColor"],["colorDangerItemTextHover","dangerItemHoverColor"],["colorDangerItemTextSelected","dangerItemSelectedColor"],["colorDangerItemBgActive","dangerItemActiveBg"],["colorDangerItemBgSelected","dangerItemSelectedBg"],["colorItemBg","itemBg"],["colorItemBgHover","itemHoverBg"],["colorSubItemBg","subMenuItemBg"],["colorItemBgActive","itemActiveBg"],["colorItemBgSelectedHorizontal","horizontalItemSelectedBg"],["colorActiveBarWidth","activeBarWidth"],["colorActiveBarHeight","activeBarHeight"],["colorActiveBarBorderSize","activeBarBorderWidth"],["colorItemBgSelected","itemSelectedBg"]],injectStyle:n,unitless:{groupTitleLineHeight:!0}})(e,t)}(en,eo,!c),el=i()("".concat(en,"-").concat(H),null==y?void 0:y.className,S),ei=o.useMemo(()=>{var e,t;if("function"==typeof P||X(P))return P||null;if("function"==typeof l.expandIcon||X(l.expandIcon))return l.expandIcon||null;if("function"==typeof(null==y?void 0:y.expandIcon)||X(null==y?void 0:y.expandIcon))return(null==y?void 0:y.expandIcon)||null;let n=null!==(e=null!=P?P:null==l?void 0:l.expandIcon)&&void 0!==e?e:null==y?void 0:y.expandIcon;return(0,m.Tm)(n,{className:i()("".concat(en,"-submenu-expand-icon"),o.isValidElement(n)?null===(t=n.props)||void 0===t?void 0:t.className:void 0)})},[P,null==l?void 0:l.expandIcon,null==y?void 0:y.expandIcon,en]),ed=o.useMemo(()=>({prefixCls:en,inlineCollapsed:ee||!1,direction:h,firstLevel:!0,theme:H,mode:U,disableMenuItemTitleTooltip:Z}),[en,ee,h,Z,H]);return ea(o.createElement(x.Z.Provider,{value:null},o.createElement(b.Provider,{value:ed},o.createElement(a.ZP,Object.assign({getPopupContainer:v,overflowedIndicator:o.createElement(r.Z,null),overflowedIndicatorPopupClassName:i()(en,"".concat(en,"-").concat(H),V),mode:U,selectable:K,onClick:Q},J,{inlineCollapsed:ee,style:Object.assign(Object.assign({},null==y?void 0:y.style),C),className:el,prefixCls:en,direction:h,defaultMotions:et,expandIcon:ei,ref:t,rootClassName:i()(L,ec,l.rootClassName,er,eo),_internalComponents:_})))))}),F=(0,o.forwardRef)((e,t)=>{let n=(0,o.useRef)(null),a=o.useContext(c.D);return(0,o.useImperativeHandle)(t,()=>({menu:n.current,focus:e=>{var t;null===(t=n.current)||void 0===t||t.focus(e)}})),o.createElement(q,Object.assign({ref:n},e,a))});F.Item=I,F.SubMenu=L,F.Divider=v,F.ItemGroup=a.BW;var Y=F},58760:function(e,t,n){n.d(t,{Z:function(){return B}});var o=n(2265),a=n(36760),c=n.n(a),r=n(45287);function l(e){return["small","middle","large"].includes(e)}function i(e){return!!e&&"number"==typeof e&&!Number.isNaN(e)}var d=n(71744),s=n(77685),u=n(17691),m=n(99320);let p=e=>{let{componentCls:t,borderRadius:n,paddingSM:o,colorBorder:a,paddingXS:c,fontSizeLG:r,fontSizeSM:l,borderRadiusLG:i,borderRadiusSM:d,colorBgContainerDisabled:s,lineWidth:m}=e;return{[t]:[{display:"inline-flex",alignItems:"center",gap:0,paddingInline:o,margin:0,background:s,borderWidth:m,borderStyle:"solid",borderColor:a,borderRadius:n,"&-large":{fontSize:r,borderRadius:i},"&-small":{paddingInline:c,borderRadius:d,fontSize:l},"&-compact-last-item":{borderEndStartRadius:0,borderStartStartRadius:0},"&-compact-first-item":{borderEndEndRadius:0,borderStartEndRadius:0},"&-compact-item:not(:first-child):not(:last-child)":{borderRadius:0},"&-compact-item:not(:last-child)":{borderInlineEndWidth:0}},(0,u.c)(e,{focus:!1})]}};var g=(0,m.I$)(["Space","Addon"],e=>[p(e)]),b=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};let f=o.forwardRef((e,t)=>{let{className:n,children:a,style:r,prefixCls:l}=e,i=b(e,["className","children","style","prefixCls"]),{getPrefixCls:u,direction:m}=o.useContext(d.E_),p=u("space-addon",l),[f,v,h]=g(p),{compactItemClassnames:y,compactSize:I}=(0,s.ri)(p,m),x=c()(p,v,y,h,{["".concat(p,"-").concat(I)]:I},n);return f(o.createElement("div",Object.assign({ref:t,className:x,style:r},i),a))}),v=o.createContext({latestIndex:0}),h=v.Provider;var y=e=>{let{className:t,index:n,children:a,split:c,style:r}=e,{latestIndex:l}=o.useContext(v);return null==a?null:o.createElement(o.Fragment,null,o.createElement("div",{className:t,style:r},a),n{let{componentCls:t,antCls:n}=e;return{[t]:{display:"inline-flex","&-rtl":{direction:"rtl"},"&-vertical":{flexDirection:"column"},"&-align":{flexDirection:"column","&-center":{alignItems:"center"},"&-start":{alignItems:"flex-start"},"&-end":{alignItems:"flex-end"},"&-baseline":{alignItems:"baseline"}},["".concat(t,"-item:empty")]:{display:"none"},["".concat(t,"-item > ").concat(n,"-badge-not-a-wrapper:only-child")]:{display:"block"}}}},w=e=>{let{componentCls:t}=e;return{[t]:{"&-gap-row-small":{rowGap:e.spaceGapSmallSize},"&-gap-row-middle":{rowGap:e.spaceGapMiddleSize},"&-gap-row-large":{rowGap:e.spaceGapLargeSize},"&-gap-col-small":{columnGap:e.spaceGapSmallSize},"&-gap-col-middle":{columnGap:e.spaceGapMiddleSize},"&-gap-col-large":{columnGap:e.spaceGapLargeSize}}}};var S=(0,m.I$)("Space",e=>{let t=(0,I.IX)(e,{spaceGapSmallSize:e.paddingXS,spaceGapMiddleSize:e.padding,spaceGapLargeSize:e.paddingLG});return[x(t),w(t)]},()=>({}),{resetStyle:!1}),C=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};let O=o.forwardRef((e,t)=>{var n;let{getPrefixCls:a,direction:s,size:u,className:m,style:p,classNames:g,styles:b}=(0,d.dj)("space"),{size:f=null!=u?u:"small",align:v,className:I,rootClassName:x,children:w,direction:O="horizontal",prefixCls:B,split:k,style:j,wrap:E=!1,classNames:z,styles:N}=e,H=C(e,["size","align","className","rootClassName","children","direction","prefixCls","split","style","wrap","classNames","styles"]),[T,P]=Array.isArray(f)?f:[f,f],R=l(P),Z=l(T),M=i(P),D=i(T),A=(0,r.Z)(w,{keepEmpty:!0}),W=void 0===v&&"horizontal"===O?"center":v,L=a("space",B),[G,X,_]=S(L),q=c()(L,m,X,"".concat(L,"-").concat(O),{["".concat(L,"-rtl")]:"rtl"===s,["".concat(L,"-align-").concat(W)]:W,["".concat(L,"-gap-row-").concat(P)]:R,["".concat(L,"-gap-col-").concat(T)]:Z},I,x,_),F=c()("".concat(L,"-item"),null!==(n=null==z?void 0:z.item)&&void 0!==n?n:g.item),Y=Object.assign(Object.assign({},b.item),null==N?void 0:N.item),V=A.map((e,t)=>{let n=(null==e?void 0:e.key)||"".concat(F,"-").concat(t);return o.createElement(y,{className:F,key:n,index:t,split:k,style:Y},e)}),$=o.useMemo(()=>({latestIndex:A.reduce((e,t,n)=>null!=t?n:e,0)}),[A]);if(0===A.length)return null;let J={};return E&&(J.flexWrap="wrap"),!Z&&D&&(J.columnGap=T),!R&&M&&(J.rowGap=P),G(o.createElement("div",Object.assign({ref:t,className:q,style:Object.assign(Object.assign(Object.assign({},J),p),j)},H),o.createElement(h,{value:$},V)))});O.Compact=s.ZP,O.Addon=f;var B=O}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/3801-5abad9290d1ac527.js b/litellm/proxy/_experimental/out/_next/static/chunks/3801-3f7b66ca5919fd60.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/3801-5abad9290d1ac527.js rename to litellm/proxy/_experimental/out/_next/static/chunks/3801-3f7b66ca5919fd60.js index bd7c4e9e15..5e4ad1a6f8 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/3801-5abad9290d1ac527.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/3801-3f7b66ca5919fd60.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3801],{12363:function(e,s,a){a.d(s,{d:function(){return r},n:function(){return l}});var t=a(2265);let l=()=>{let[e,s]=(0,t.useState)("http://localhost:4000");return(0,t.useEffect)(()=>{{let{protocol:e,host:a}=window.location;s("".concat(e,"//").concat(a))}},[]),e},r=25},30841:function(e,s,a){a.d(s,{IE:function(){return r},LO:function(){return l},cT:function(){return n}});var t=a(19250);let l=async e=>{if(!e)return[];try{let{aliases:s}=await (0,t.keyAliasesCall)(e);return Array.from(new Set((s||[]).filter(Boolean)))}catch(e){return console.error("Error fetching all key aliases:",e),[]}},r=async(e,s)=>{if(!e)return[];try{let a=[],l=1,r=!0;for(;r;){let n=await (0,t.teamListCall)(e,s||null,null);a=[...a,...n],l{if(!e)return[];try{let s=[],a=1,l=!0;for(;l;){let r=await (0,t.organizationListCall)(e);s=[...s,...r],a{let{options:s,onApplyFilters:a,onResetFilters:d,initialValues:m={},buttonLabel:u="Filters"}=e,[x,h]=(0,l.useState)(!1),[g,p]=(0,l.useState)(m),[f,j]=(0,l.useState)({}),[v,b]=(0,l.useState)({}),[y,N]=(0,l.useState)({}),[w,k]=(0,l.useState)({}),_=(0,l.useCallback)(c()(async(e,s)=>{if(s.isSearchable&&s.searchFn){b(e=>({...e,[s.name]:!0}));try{let a=await s.searchFn(e);j(e=>({...e,[s.name]:a}))}catch(e){console.error("Error searching:",e),j(e=>({...e,[s.name]:[]}))}finally{b(e=>({...e,[s.name]:!1}))}}},300),[]),S=(0,l.useCallback)(async e=>{if(e.isSearchable&&e.searchFn&&!w[e.name]){b(s=>({...s,[e.name]:!0})),k(s=>({...s,[e.name]:!0}));try{let s=await e.searchFn("");j(a=>({...a,[e.name]:s}))}catch(s){console.error("Error loading initial options:",s),j(s=>({...s,[e.name]:[]}))}finally{b(s=>({...s,[e.name]:!1}))}}},[w]);(0,l.useEffect)(()=>{x&&s.forEach(e=>{e.isSearchable&&!w[e.name]&&S(e)})},[x,s,S,w]);let C=(e,s)=>{let t={...g,[e]:s};p(t),a(t)},L=(e,s)=>{e&&s.isSearchable&&!w[s.name]&&S(s)};return(0,t.jsxs)("div",{className:"w-full",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,t.jsx)(r.ZP,{icon:(0,t.jsx)(o.Z,{className:"h-4 w-4"}),onClick:()=>h(!x),className:"flex items-center gap-2",children:u}),(0,t.jsx)(r.ZP,{onClick:()=>{let e={};s.forEach(s=>{e[s.name]=""}),p(e),d()},children:"Reset Filters"})]}),x&&(0,t.jsx)("div",{className:"grid grid-cols-3 gap-x-6 gap-y-4 mb-6",children:["Team ID","Status","Organization ID","Key Alias","User ID","End User","Key Hash","Model"].map(e=>{let a=s.find(s=>s.label===e||s.name===e);return a?(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("label",{className:"text-sm text-gray-600",children:a.label||a.name}),a.isSearchable?(0,t.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search ".concat(a.label||a.name,"..."),value:g[a.name]||void 0,onChange:e=>C(a.name,e),onDropdownVisibleChange:e=>L(e,a),onSearch:e=>{N(s=>({...s,[a.name]:e})),a.searchFn&&_(e,a)},filterOption:!1,loading:v[a.name],options:f[a.name]||[],allowClear:!0,notFoundContent:v[a.name]?"Loading...":"No results found"}):a.options?(0,t.jsx)(n.default,{className:"w-full",placeholder:"Select ".concat(a.label||a.name,"..."),value:g[a.name]||void 0,onChange:e=>C(a.name,e),allowClear:!0,children:a.options.map(e=>(0,t.jsx)(n.default.Option,{value:e.value,children:e.label},e.value))}):(0,t.jsx)(i.default,{className:"w-full",placeholder:"Enter ".concat(a.label||a.name,"..."),value:g[a.name]||"",onChange:e=>C(a.name,e.target.value),allowClear:!0})]},a.name):null})})]})}},33801:function(e,s,a){a.d(s,{I:function(){return eg},Z:function(){return eh}});var t=a(57437),l=a(77398),r=a.n(l),n=a(11713),i=a(2265),o=a(29827),d=a(19250),c=a(12322),m=a(42673),u=a(99981);let x=e=>{try{return new Date(e).toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0}).replace(",","")}catch(e){return"Error converting time"}},h=e=>{let{utcTime:s}=e;return(0,t.jsx)("span",{style:{fontFamily:"monospace",width:"180px",display:"inline-block"},children:x(s)})};var g=a(41649),p=a(78489),f=a(59872);let j=(e,s)=>{var a,t;return(null===(t=e.metadata)||void 0===t?void 0:null===(a=t.mcp_tool_call_metadata)||void 0===a?void 0:a.mcp_server_logo_url)?e.metadata.mcp_tool_call_metadata.mcp_server_logo_url:s?(0,m.dr)(s).logo:""},v=[{id:"expander",header:()=>null,cell:e=>{let{row:s}=e;return(0,t.jsx)(()=>{let[e,a]=i.useState(s.getIsExpanded()),l=i.useCallback(()=>{a(e=>!e),s.getToggleExpandedHandler()()},[s]);return s.getCanExpand()?(0,t.jsx)("button",{onClick:l,style:{cursor:"pointer"},"aria-label":e?"Collapse row":"Expand row",className:"w-6 h-6 flex items-center justify-center focus:outline-none",children:(0,t.jsx)("svg",{className:"w-4 h-4 transform transition-transform duration-75 ".concat(e?"rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}):(0,t.jsx)("span",{className:"w-6 h-6 flex items-center justify-center",children:"●"})},{})}},{header:"Time",accessorKey:"startTime",cell:e=>(0,t.jsx)(h,{utcTime:e.getValue()})},{header:"Status",accessorKey:"metadata.status",cell:e=>{let s="failure"!==(e.getValue()||"Success").toLowerCase();return(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block text-center w-16 ".concat(s?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:s?"Success":"Failure"})}},{header:"Session ID",accessorKey:"session_id",cell:e=>{let s=String(e.getValue()||""),a=e.row.original.onSessionClick;return(0,t.jsx)(u.Z,{title:String(e.getValue()||""),children:(0,t.jsx)(p.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal text-xs max-w-[15ch] truncate block",onClick:()=>null==a?void 0:a(s),children:String(e.getValue()||"")})})}},{header:"Request ID",accessorKey:"request_id",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||""),children:(0,t.jsx)("span",{className:"font-mono text-xs max-w-[15ch] truncate block",children:String(e.getValue()||"")})})},{header:"Cost",accessorKey:"spend",cell:e=>(0,t.jsxs)("span",{children:["$",(0,f.pw)(e.getValue()||0,6)]})},{header:"Duration (s)",accessorKey:"duration",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Team Name",accessorKey:"metadata.user_api_key_team_alias",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Key Hash",accessorKey:"metadata.user_api_key",cell:e=>{let s=String(e.getValue()||"-"),a=e.row.original.onKeyHashClick;return(0,t.jsx)(u.Z,{title:s,children:(0,t.jsx)("span",{className:"font-mono max-w-[15ch] truncate block cursor-pointer hover:text-blue-600",onClick:()=>null==a?void 0:a(s),children:s})})}},{header:"Key Name",accessorKey:"metadata.user_api_key_alias",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Model",accessorKey:"model",cell:e=>{let s=e.row.original,a=s.custom_llm_provider,l=String(e.getValue()||"");return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,t.jsx)("img",{src:j(s,a),alt:"",className:"w-4 h-4",onError:e=>{e.target.style.display="none"}}),(0,t.jsx)(u.Z,{title:l,children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:l})})]})}},{header:"Tokens",accessorKey:"total_tokens",cell:e=>{let s=e.row.original;return(0,t.jsxs)("span",{className:"text-sm",children:[String(s.total_tokens||"0"),(0,t.jsxs)("span",{className:"text-gray-400 text-xs ml-1",children:["(",String(s.prompt_tokens||"0"),"+",String(s.completion_tokens||"0"),")"]})]})}},{header:"Internal User",accessorKey:"user",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"End User",accessorKey:"end_user",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Tags",accessorKey:"request_tags",cell:e=>{let s=e.getValue();if(!s||0===Object.keys(s).length)return"-";let a=Object.entries(s),l=a[0],r=a.slice(1);return(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:(0,t.jsx)(u.Z,{title:(0,t.jsx)("div",{className:"flex flex-col gap-1",children:a.map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{children:[s,": ",String(a)]},s)})}),children:(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded-full text-xs",children:[l[0],": ",String(l[1]),r.length>0&&" +".concat(r.length)]})})})}}],b=e=>(0,t.jsx)(g.Z,{color:"gray",className:"flex items-center gap-1",children:(0,t.jsx)("span",{className:"whitespace-nowrap text-xs",children:e})}),y=[{id:"expander",header:()=>null,cell:e=>{let{row:s}=e;return(0,t.jsx)(()=>{let[e,a]=i.useState(s.getIsExpanded()),l=i.useCallback(()=>{a(e=>!e),s.getToggleExpandedHandler()()},[s]);return s.getCanExpand()?(0,t.jsx)("button",{onClick:l,style:{cursor:"pointer"},"aria-label":e?"Collapse row":"Expand row",className:"w-6 h-6 flex items-center justify-center focus:outline-none",children:(0,t.jsx)("svg",{className:"w-4 h-4 transform transition-transform ".concat(e?"rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}):(0,t.jsx)("span",{className:"w-6 h-6 flex items-center justify-center",children:"●"})},{})}},{header:"Timestamp",accessorKey:"updated_at",cell:e=>(0,t.jsx)(h,{utcTime:e.getValue()})},{header:"Table Name",accessorKey:"table_name",cell:e=>{let s=e.getValue(),a=s;switch(s){case"LiteLLM_VerificationToken":a="Keys";break;case"LiteLLM_TeamTable":a="Teams";break;case"LiteLLM_OrganizationTable":a="Organizations";break;case"LiteLLM_UserTable":a="Users";break;case"LiteLLM_ProxyModelTable":a="Models";break;default:a=s}return(0,t.jsx)("span",{children:a})}},{header:"Action",accessorKey:"action",cell:e=>(0,t.jsx)("span",{children:b(e.getValue())})},{header:"Changed By",accessorKey:"changed_by",cell:e=>{let s=e.row.original.changed_by,a=e.row.original.changed_by_api_key;return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("div",{className:"font-medium",children:s}),a&&(0,t.jsx)(u.Z,{title:a,children:(0,t.jsxs)("div",{className:"text-xs text-muted-foreground max-w-[15ch] truncate",children:[" ",a]})})]})}},{header:"Affected Item ID",accessorKey:"object_id",cell:e=>(0,t.jsx)(()=>{let s=e.getValue(),[a,l]=(0,i.useState)(!1);if(!s)return(0,t.jsx)(t.Fragment,{children:"-"});let r=async()=>{try{await navigator.clipboard.writeText(String(s)),l(!0),setTimeout(()=>l(!1),1500)}catch(e){console.error("Failed to copy object ID: ",e)}};return(0,t.jsx)(u.Z,{title:a?"Copied!":String(s),children:(0,t.jsx)("span",{className:"max-w-[20ch] truncate block cursor-pointer hover:text-blue-600",onClick:r,children:String(s)})})},{})}],N=async(e,s,a,t)=>{console.log("prefetchLogDetails called with",e.length,"logs");let l=e.map(e=>{if(e.request_id)return console.log("Prefetching details for request_id:",e.request_id),t.prefetchQuery({queryKey:["logDetails",e.request_id,s],queryFn:async()=>{console.log("Fetching details for",e.request_id);let t=await (0,d.uiSpendLogDetailsCall)(a,e.request_id,s);return console.log("Received details for",e.request_id,":",t?"success":"failed"),t},staleTime:6e5,gcTime:6e5})});try{let e=await Promise.all(l);return console.log("All prefetch promises completed:",e.length),e}catch(e){throw console.error("Error in prefetchLogDetails:",e),e}};var w=a(9114),k=a(86669);function _(e){let{row:s,hasMessages:a,hasResponse:l,hasError:r,errorInfo:n,getRawRequest:i,formattedResponse:o}=e,d=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.focus(),s.select();let a=document.execCommand("copy");if(document.body.removeChild(s),!a)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},c=async()=>{await d(JSON.stringify(i(),null,2))?w.Z.success("Request copied to clipboard"):w.Z.fromBackend("Failed to copy request")},m=async()=>{await d(JSON.stringify(o(),null,2))?w.Z.success("Response copied to clipboard"):w.Z.fromBackend("Failed to copy response")};return(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 w-full max-w-full overflow-hidden box-border",children:[(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request"}),(0,t.jsx)("button",{onClick:c,className:"p-1 hover:bg-gray-200 rounded",title:"Copy request",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),(0,t.jsx)("div",{className:"p-4 overflow-auto max-h-96 w-full max-w-full box-border",children:(0,t.jsx)(k.gc,{data:i(),style:k.jF,clickToExpandNode:!0})})]}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsxs)("h3",{className:"text-lg font-medium",children:["Response",r&&(0,t.jsxs)("span",{className:"ml-2 text-sm text-red-600",children:["• HTTP code ",(null==n?void 0:n.error_code)||400]})]}),(0,t.jsx)("button",{onClick:m,className:"p-1 hover:bg-gray-200 rounded",title:"Copy response",disabled:!l,children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),(0,t.jsx)("div",{className:"p-4 overflow-auto max-h-96 w-full max-w-full box-border",children:l?(0,t.jsx)(k.gc,{data:o(),style:k.jF,clickToExpandNode:!0}):(0,t.jsx)("div",{className:"text-gray-500 text-sm italic text-center py-4",children:"Response data not available"})})]})]})}a(52621);let S=e=>{var s;let{errorInfo:a}=e,[l,r]=i.useState({}),[n,o]=i.useState(!1),d=e=>{r(s=>({...s,[e]:!s[e]}))},c=a.traceback&&(s=a.traceback)?Array.from(s.matchAll(/File "([^"]+)", line (\d+)/g)).map(e=>{let a=e[1],t=e[2],l=a.split("/").pop()||a,r=e.index||0,n=s.indexOf('File "',r+1),i=n>-1?s.substring(r,n).trim():s.substring(r).trim(),o=i.split("\n"),d="";return o.length>1&&(d=o[o.length-1].trim()),{filePath:a,fileName:l,lineNumber:t,code:d,inFunction:i.includes(" in ")?i.split(" in ")[1].split("\n")[0]:""}}):[];return(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"p-4 border-b",children:(0,t.jsxs)("h3",{className:"text-lg font-medium flex items-center text-red-600",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),"Error Details"]})}),(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{className:"bg-red-50 rounded-md p-4 mb-4",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"text-red-800 font-medium w-20",children:"Type:"}),(0,t.jsx)("span",{className:"text-red-700",children:a.error_class||"Unknown Error"})]}),(0,t.jsxs)("div",{className:"flex mt-2",children:[(0,t.jsx)("span",{className:"text-red-800 font-medium w-20 flex-shrink-0",children:"Message:"}),(0,t.jsx)("span",{className:"text-red-700 break-words whitespace-pre-wrap",children:a.error_message||"Unknown error occurred"})]})]}),a.traceback&&(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,t.jsx)("h4",{className:"font-medium",children:"Traceback"}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsx)("button",{onClick:()=>{let e=!n;if(o(e),c.length>0){let s={};c.forEach((a,t)=>{s[t]=e}),r(s)}},className:"text-gray-500 hover:text-gray-700 flex items-center text-sm",children:n?"Collapse All":"Expand All"}),(0,t.jsxs)("button",{onClick:()=>navigator.clipboard.writeText(a.traceback||""),className:"text-gray-500 hover:text-gray-700 flex items-center",title:"Copy traceback",children:[(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),(0,t.jsx)("span",{className:"ml-1",children:"Copy"})]})]})]}),(0,t.jsx)("div",{className:"bg-white rounded-md border border-gray-200 overflow-hidden shadow-sm",children:c.map((e,s)=>(0,t.jsxs)("div",{className:"border-b border-gray-200 last:border-b-0",children:[(0,t.jsxs)("div",{className:"px-4 py-2 flex items-center justify-between cursor-pointer hover:bg-gray-50",onClick:()=>d(s),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{className:"text-gray-400 mr-2 w-12 text-right",children:e.lineNumber}),(0,t.jsx)("span",{className:"text-gray-600 font-medium",children:e.fileName}),(0,t.jsx)("span",{className:"text-gray-500 mx-1",children:"in"}),(0,t.jsx)("span",{className:"text-indigo-600 font-medium",children:e.inFunction||e.fileName})]}),(0,t.jsx)("svg",{className:"w-5 h-5 text-gray-500 transition-transform ".concat(l[s]?"transform rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),(l[s]||!1)&&e.code&&(0,t.jsx)("div",{className:"px-12 py-2 font-mono text-sm text-gray-800 bg-gray-50 overflow-x-auto border-t border-gray-100",children:e.code})]},s))})]})]})]})};var C=a(20347);let L=e=>{let{show:s}=e;return s?(0,t.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 flex items-start",children:[(0,t.jsx)("div",{className:"text-blue-500 mr-3 flex-shrink-0 mt-0.5",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:"Request/Response Data Not Available"}),(0,t.jsxs)("p",{className:"text-sm text-blue-700 mt-1",children:["To view request and response details, enable prompt storage in your LiteLLM configuration by adding the following to your ",(0,t.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded",children:"proxy_config.yaml"})," file:"]}),(0,t.jsx)("pre",{className:"mt-2 bg-white p-3 rounded border border-blue-200 text-xs font-mono overflow-auto",children:"general_settings:\n store_model_in_db: true\n store_prompts_in_spend_logs: true"}),(0,t.jsx)("p",{className:"text-xs text-blue-700 mt-2",children:"Note: This will only affect new requests after the configuration change."})]})]}):null};var M=a(94292),T=a(12514),E=a(35829),D=a(84264),A=a(96761),I=a(77331),R=a(5545),O=a(30401),H=a(78867);let q=e=>{let{sessionId:s,logs:a,onBack:l}=e,[r,n]=(0,i.useState)(null),[o,d]=(0,i.useState)({}),m=a.reduce((e,s)=>e+(s.spend||0),0),x=a.reduce((e,s)=>e+(s.total_tokens||0),0),h=a.reduce((e,s)=>{var a,t;return e+((null===(t=s.metadata)||void 0===t?void 0:null===(a=t.additional_usage_values)||void 0===a?void 0:a.cache_read_input_tokens)||0)},0),g=a.reduce((e,s)=>{var a,t;return e+((null===(t=s.metadata)||void 0===t?void 0:null===(a=t.additional_usage_values)||void 0===a?void 0:a.cache_creation_input_tokens)||0)},0),j=x+h+g,b=a.length>0?new Date(a[0].startTime):new Date;(((a.length>0?new Date(a[a.length-1].endTime):new Date).getTime()-b.getTime())/1e3).toFixed(2),a.map(e=>({time:new Date(e.startTime).toISOString(),tokens:e.total_tokens||0,cost:e.spend||0}));let y=async(e,s)=>{await (0,f.vQ)(e)&&(d(e=>({...e,[s]:!0})),setTimeout(()=>{d(e=>({...e,[s]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)(p.Z,{icon:I.Z,variant:"light",onClick:l,className:"mb-4",children:"Back to All Logs"}),(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)("h1",{className:"text-2xl font-semibold text-gray-900",children:"Session Details"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)("p",{className:"text-sm text-gray-500 font-mono",children:s}),(0,t.jsx)(R.ZP,{type:"text",size:"small",icon:o["session-id"]?(0,t.jsx)(O.Z,{size:12}):(0,t.jsx)(H.Z,{size:12}),onClick:()=>y(s,"session-id"),className:"left-2 z-10 transition-all duration-200 ".concat(o["session-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]}),(0,t.jsxs)("a",{href:"https://docs.litellm.ai/docs/proxy/ui_logs_sessions",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:text-blue-800 flex items-center gap-1",children:["Get started with session management here",(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,t.jsxs)(T.Z,{children:[(0,t.jsx)(D.Z,{children:"Total Requests"}),(0,t.jsx)(E.Z,{children:a.length})]}),(0,t.jsxs)(T.Z,{children:[(0,t.jsx)(D.Z,{children:"Total Cost"}),(0,t.jsxs)(E.Z,{children:["$",(0,f.pw)(m,6)]})]}),(0,t.jsx)(u.Z,{title:(0,t.jsxs)("div",{className:"text-white min-w-[200px]",children:[(0,t.jsx)("div",{className:"text-lg font-medium mb-3",children:"Usage breakdown"}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-base font-medium mb-2",children:"Input usage:"}),(0,t.jsxs)("div",{className:"space-y-2 text-sm text-gray-300",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,f.pw)(a.reduce((e,s)=>e+(s.prompt_tokens||0),0))})]}),h>0&&(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input_cached_tokens:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,f.pw)(h)})]}),g>0&&(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input_cache_creation_tokens:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,f.pw)(g)})]})]})]}),(0,t.jsxs)("div",{className:"border-t border-gray-600 pt-3",children:[(0,t.jsx)("div",{className:"text-base font-medium mb-2",children:"Output usage:"}),(0,t.jsx)("div",{className:"space-y-2 text-sm text-gray-300",children:(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"output:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,f.pw)(a.reduce((e,s)=>e+(s.completion_tokens||0),0))})]})})]}),(0,t.jsx)("div",{className:"border-t border-gray-600 pt-3",children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-base font-medium",children:"Total usage:"}),(0,t.jsx)("span",{className:"text-sm text-gray-300",children:(0,f.pw)(j)})]})})]})]}),placement:"top",overlayStyle:{minWidth:"300px"},children:(0,t.jsxs)(T.Z,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(D.Z,{children:"Total Tokens"}),(0,t.jsx)("span",{className:"text-gray-400 text-sm",children:"ⓘ"})]}),(0,t.jsx)(E.Z,{children:(0,f.pw)(j)})]})})]}),(0,t.jsx)(A.Z,{children:"Session Logs"}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(c.w,{columns:v,data:a,renderSubComponent:eg,getRowCanExpand:()=>!0,loadingMessage:"Loading logs...",noDataMessage:"No logs found"})})]})};function F(e){let{data:s}=e,[a,l]=(0,i.useState)(!0),[r,n]=(0,i.useState)({});if(!s||0===s.length)return null;let o=e=>new Date(1e3*e).toLocaleString(),d=(e,s)=>"".concat(((s-e)*1e3).toFixed(2),"ms"),c=(e,s)=>{let a="".concat(e,"-").concat(s);n(e=>({...e,[a]:!e[a]}))};return(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow mb-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b cursor-pointer hover:bg-gray-50",onClick:()=>l(!a),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 text-gray-600 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Vector Store Requests"})]}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:a?"Click to collapse":"Click to expand"})]}),a&&(0,t.jsx)("div",{className:"p-4",children:s.map((e,s)=>(0,t.jsxs)("div",{className:"mb-6 last:mb-0",children:[(0,t.jsx)("div",{className:"bg-white rounded-lg border p-4 mb-4",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Query:"}),(0,t.jsx)("span",{className:"font-mono",children:e.query})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Vector Store ID:"}),(0,t.jsx)("span",{className:"font-mono",children:e.vector_store_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Provider:"}),(0,t.jsx)("span",{className:"flex items-center",children:(()=>{let{logo:s,displayName:a}=(0,m.dr)(e.custom_llm_provider);return(0,t.jsxs)(t.Fragment,{children:[s&&(0,t.jsx)("img",{src:s,alt:"".concat(a," logo"),className:"h-5 w-5 mr-2"}),a]})})()})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:o(e.start_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:o(e.end_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsx)("span",{children:d(e.start_time,e.end_time)})]})]})]})}),(0,t.jsx)("h4",{className:"font-medium mb-2",children:"Search Results"}),(0,t.jsx)("div",{className:"space-y-2",children:e.vector_store_search_response.data.map((e,a)=>{let l=r["".concat(s,"-").concat(a)]||!1;return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center p-3 bg-gray-50 cursor-pointer",onClick:()=>c(s,a),children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(l?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsxs)("span",{className:"font-medium mr-2",children:["Result ",a+1]}),(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["Score: ",(0,t.jsx)("span",{className:"font-mono",children:e.score.toFixed(4)})]})]})]}),l&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:e.content.map((e,s)=>(0,t.jsxs)("div",{className:"mb-2 last:mb-0",children:[(0,t.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:e.type}),(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all bg-gray-50 p-2 rounded",children:e.text})]},s))})]},a)})})]},s))})]})}let Y=e=>e>=.8?"text-green-600":"text-yellow-600";var K=e=>{let{entities:s}=e,[a,l]=(0,i.useState)(!0),[r,n]=(0,i.useState)({}),o=e=>{n(s=>({...s,[e]:!s[e]}))};return s&&0!==s.length?(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"flex items-center mb-2 cursor-pointer",onClick:()=>l(!a),children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h4",{className:"font-medium",children:["Detected Entities (",s.length,")"]})]}),a&&(0,t.jsx)("div",{className:"space-y-2",children:s.map((e,s)=>{let a=r[s]||!1;return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>o(s),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("span",{className:"font-medium mr-2",children:e.entity_type}),(0,t.jsxs)("span",{className:"font-mono ".concat(Y(e.score)),children:["Score: ",e.score.toFixed(2)]})]}),(0,t.jsxs)("span",{className:"text-xs text-gray-500",children:["Position: ",e.start,"-",e.end]})]}),a&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-2",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Entity Type:"}),(0,t.jsx)("span",{children:e.entity_type})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Position:"}),(0,t.jsxs)("span",{children:["Characters ",e.start,"-",e.end]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Confidence:"}),(0,t.jsx)("span",{className:Y(e.score),children:e.score.toFixed(2)})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[e.recognition_metadata&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Recognizer:"}),(0,t.jsx)("span",{children:e.recognition_metadata.recognizer_name})]}),(0,t.jsxs)("div",{className:"flex overflow-hidden",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Identifier:"}),(0,t.jsx)("span",{className:"truncate text-xs font-mono",children:e.recognition_metadata.recognizer_identifier})]})]}),e.analysis_explanation&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Explanation:"}),(0,t.jsx)("span",{children:e.analysis_explanation})]})]})]})})]},s)})})]}):null};let P=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"slate";return(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block ".concat({green:"bg-green-100 text-green-800",red:"bg-red-100 text-red-800",blue:"bg-blue-50 text-blue-700",slate:"bg-slate-100 text-slate-800",amber:"bg-amber-100 text-amber-800"}[s]),children:e})},Z=e=>e?P("detected","red"):P("not detected","slate"),U=e=>{let{title:s,count:a,defaultOpen:l=!0,right:r,children:n}=e,[o,d]=(0,i.useState)(l);return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>d(e=>!e),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(o?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h5",{className:"font-medium",children:[s," ","number"==typeof a&&(0,t.jsxs)("span",{className:"text-gray-500 font-normal",children:["(",a,")"]})]})]}),(0,t.jsx)("div",{children:r})]}),o&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:n})]})},V=e=>{let{label:s,children:a,mono:l}=e;return(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:s}),(0,t.jsx)("span",{className:l?"font-mono text-sm break-all":"",children:a})]})},B=()=>(0,t.jsx)("div",{className:"my-3 border-t"});var W=e=>{var s,a,l,r,n,i,o,d,c,m;let{response:u}=e;if(!u)return null;let x=null!==(n=null!==(r=u.outputs)&&void 0!==r?r:u.output)&&void 0!==n?n:[],h="GUARDRAIL_INTERVENED"===u.action?"red":"green",g=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(null===(s=u.guardrailCoverage)||void 0===s?void 0:s.textCharacters)&&P("text guarded ".concat(null!==(i=u.guardrailCoverage.textCharacters.guarded)&&void 0!==i?i:0,"/").concat(null!==(o=u.guardrailCoverage.textCharacters.total)&&void 0!==o?o:0),"blue"),(null===(a=u.guardrailCoverage)||void 0===a?void 0:a.images)&&P("images guarded ".concat(null!==(d=u.guardrailCoverage.images.guarded)&&void 0!==d?d:0,"/").concat(null!==(c=u.guardrailCoverage.images.total)&&void 0!==c?c:0),"blue")]}),p=u.usage&&(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(u.usage).map(e=>{let[s,a]=e;return"number"==typeof a?(0,t.jsxs)("span",{className:"px-2 py-1 bg-slate-100 text-slate-800 rounded-md text-xs font-medium",children:[s,": ",a]},s):null})});return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(V,{label:"Action:",children:P(null!==(m=u.action)&&void 0!==m?m:"N/A",h)}),u.actionReason&&(0,t.jsx)(V,{label:"Action Reason:",children:u.actionReason}),u.blockedResponse&&(0,t.jsx)(V,{label:"Blocked Response:",children:(0,t.jsx)("span",{className:"italic",children:u.blockedResponse})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(V,{label:"Coverage:",children:g}),(0,t.jsx)(V,{label:"Usage:",children:p})]})]}),x.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B,{}),(0,t.jsx)("h4",{className:"font-medium mb-2",children:"Outputs"}),(0,t.jsx)("div",{className:"space-y-2",children:x.map((e,s)=>{var a;return(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsx)("div",{className:"text-sm whitespace-pre-wrap",children:null!==(a=e.text)&&void 0!==a?a:(0,t.jsx)("em",{children:"(non-text output)"})})},s)})})]})]}),(null===(l=u.assessments)||void 0===l?void 0:l.length)?(0,t.jsx)("div",{className:"space-y-3",children:u.assessments.map((e,s)=>{var a,l,r,n,i,o,d,c,m,u,x,h,g,p,f,j,v,b,y,N,w,k,_,S;let C=(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.wordPolicy&&P("word","slate"),e.contentPolicy&&P("content","slate"),e.topicPolicy&&P("topic","slate"),e.sensitiveInformationPolicy&&P("sensitive-info","slate"),e.contextualGroundingPolicy&&P("contextual-grounding","slate"),e.automatedReasoningPolicy&&P("automated-reasoning","slate")]});return(0,t.jsxs)(U,{title:"Assessment #".concat(s+1),defaultOpen:!0,right:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(null===(a=e.invocationMetrics)||void 0===a?void 0:a.guardrailProcessingLatency)!=null&&P("".concat(e.invocationMetrics.guardrailProcessingLatency," ms"),"amber"),C]}),children:[e.wordPolicy&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Word Policy"}),(null!==(j=null===(l=e.wordPolicy.customWords)||void 0===l?void 0:l.length)&&void 0!==j?j:0)>0&&(0,t.jsx)(U,{title:"Custom Words",defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:e.wordPolicy.customWords.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-mono text-sm break-all",children:e.match})]}),Z(e.detected)]},s)})})}),(null!==(v=null===(r=e.wordPolicy.managedWordLists)||void 0===r?void 0:r.length)&&void 0!==v?v:0)>0&&(0,t.jsx)(U,{title:"Managed Word Lists",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.wordPolicy.managedWordLists.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-mono text-sm break-all",children:e.match}),e.type&&P(e.type,"slate")]}),Z(e.detected)]},s)})})})]}),(null===(i=e.contentPolicy)||void 0===i?void 0:null===(n=i.filters)||void 0===n?void 0:n.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Content Policy"}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"min-w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-gray-600",children:[(0,t.jsx)("th",{className:"py-1 pr-4",children:"Type"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Action"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Detected"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Strength"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Confidence"})]})}),(0,t.jsx)("tbody",{children:e.contentPolicy.filters.map((e,s)=>{var a,l,r,n;return(0,t.jsxs)("tr",{className:"border-t",children:[(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(a=e.type)&&void 0!==a?a:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:P(null!==(l=e.action)&&void 0!==l?l:"—",e.detected?"red":"slate")}),(0,t.jsx)("td",{className:"py-1 pr-4",children:Z(e.detected)}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(r=e.filterStrength)&&void 0!==r?r:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(n=e.confidence)&&void 0!==n?n:"—"})]},s)})})]})})]}):null,(null===(d=e.contextualGroundingPolicy)||void 0===d?void 0:null===(o=d.filters)||void 0===o?void 0:o.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Contextual Grounding"}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"min-w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-gray-600",children:[(0,t.jsx)("th",{className:"py-1 pr-4",children:"Type"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Action"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Detected"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Score"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Threshold"})]})}),(0,t.jsx)("tbody",{children:e.contextualGroundingPolicy.filters.map((e,s)=>{var a,l,r,n;return(0,t.jsxs)("tr",{className:"border-t",children:[(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(a=e.type)&&void 0!==a?a:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:P(null!==(l=e.action)&&void 0!==l?l:"—",e.detected?"red":"slate")}),(0,t.jsx)("td",{className:"py-1 pr-4",children:Z(e.detected)}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(r=e.score)&&void 0!==r?r:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(n=e.threshold)&&void 0!==n?n:"—"})]},s)})})]})})]}):null,e.sensitiveInformationPolicy&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Sensitive Information"}),(null!==(b=null===(c=e.sensitiveInformationPolicy.piiEntities)||void 0===c?void 0:c.length)&&void 0!==b?b:0)>0&&(0,t.jsx)(U,{title:"PII Entities",defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:e.sensitiveInformationPolicy.piiEntities.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),e.type&&P(e.type,"slate"),(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.match})]}),Z(e.detected)]},s)})})}),(null!==(y=null===(m=e.sensitiveInformationPolicy.regexes)||void 0===m?void 0:m.length)&&void 0!==y?y:0)>0&&(0,t.jsx)(U,{title:"Custom Regexes",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.sensitiveInformationPolicy.regexes.map((e,s)=>{var a,l;return(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-2 bg-gray-50 rounded gap-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-medium",children:null!==(l=e.name)&&void 0!==l?l:"regex"}),(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.regex})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[Z(e.detected),e.match&&(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.match})]})]},s)})})})]}),(null===(x=e.topicPolicy)||void 0===x?void 0:null===(u=x.topics)||void 0===u?void 0:u.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Topic Policy"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.topicPolicy.topics.map((e,s)=>{var a,l;return(0,t.jsx)("div",{className:"px-3 py-1.5 bg-gray-50 rounded-md text-xs",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-medium",children:null!==(l=e.name)&&void 0!==l?l:"topic"}),e.type&&P(e.type,"slate"),Z(e.detected)]})},s)})})]}):null,e.invocationMetrics&&(0,t.jsx)(U,{title:"Invocation Metrics",defaultOpen:!1,children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(V,{label:"Latency (ms)",children:null!==(N=e.invocationMetrics.guardrailProcessingLatency)&&void 0!==N?N:"—"}),(0,t.jsx)(V,{label:"Coverage:",children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(null===(h=e.invocationMetrics.guardrailCoverage)||void 0===h?void 0:h.textCharacters)&&P("text ".concat(null!==(w=e.invocationMetrics.guardrailCoverage.textCharacters.guarded)&&void 0!==w?w:0,"/").concat(null!==(k=e.invocationMetrics.guardrailCoverage.textCharacters.total)&&void 0!==k?k:0),"blue"),(null===(g=e.invocationMetrics.guardrailCoverage)||void 0===g?void 0:g.images)&&P("images ".concat(null!==(_=e.invocationMetrics.guardrailCoverage.images.guarded)&&void 0!==_?_:0,"/").concat(null!==(S=e.invocationMetrics.guardrailCoverage.images.total)&&void 0!==S?S:0),"blue")]})})]}),(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)(V,{label:"Usage:",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.invocationMetrics.usage&&Object.entries(e.invocationMetrics.usage).map(e=>{let[s,a]=e;return"number"==typeof a?(0,t.jsxs)("span",{className:"px-2 py-1 bg-slate-100 text-slate-800 rounded-md text-xs font-medium",children:[s,": ",a]},s):null})})})})]})}),(null===(f=e.automatedReasoningPolicy)||void 0===f?void 0:null===(p=f.findings)||void 0===p?void 0:p.length)?(0,t.jsx)(U,{title:"Automated Reasoning Findings",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.automatedReasoningPolicy.findings.map((e,s)=>(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-2 text-xs overflow-x-auto",children:JSON.stringify(e,null,2)},s))})}):null]},s)})}):null,(0,t.jsx)(U,{title:"Raw Bedrock Guardrail Response",defaultOpen:!1,children:(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-3 text-xs overflow-x-auto",children:JSON.stringify(u,null,2)})})]})};let z=e=>new Date(1e3*e).toLocaleString(),J=e=>{var s,a;let{entry:l,index:r,total:n}=e,i=null!==(s=l.guardrail_provider)&&void 0!==s?s:"presidio",o=null!==(a=l.guardrail_status)&&void 0!==a?a:"unknown",d="success"===o.toLowerCase(),c=l.masked_entity_count||{},m=Object.values(c).reduce((e,s)=>e+("number"==typeof s?s:0),0),x=l.guardrail_response,h=Array.isArray(x)?x:[],g="bedrock"!==i||null===x||"object"!=typeof x||Array.isArray(x)?void 0:x;return(0,t.jsxs)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[n>1&&(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("h4",{className:"text-base font-semibold",children:["Guardrail #",r+1,(0,t.jsx)("span",{className:"ml-2 font-mono text-sm text-gray-600",children:l.guardrail_name})]}),(0,t.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md text-xs capitalize",children:i})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Guardrail Name:"}),(0,t.jsx)("span",{className:"font-mono break-words",children:l.guardrail_name})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Mode:"}),(0,t.jsx)("span",{className:"font-mono break-words",children:l.guardrail_mode})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Status:"}),(0,t.jsx)(u.Z,{title:d?null:"Guardrail failed to run.",placement:"top",arrow:!0,destroyTooltipOnHide:!0,children:(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block ".concat(d?"bg-green-100 text-green-800":"bg-red-100 text-red-800 cursor-help"),children:o})})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:z(l.start_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:z(l.end_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsxs)("span",{children:[l.duration.toFixed(4),"s"]})]})]})]}),m>0&&(0,t.jsxs)("div",{className:"mt-4 pt-4 border-t",children:[(0,t.jsx)("h5",{className:"font-medium mb-2",children:"Masked Entity Summary"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(c).map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{className:"px-3 py-1.5 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[s,": ",a]},s)})})]}),"presidio"===i&&h.length>0&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(K,{entities:h})}),"bedrock"===i&&g&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(W,{response:g})})]})};var G=e=>{let{data:s}=e,a=Array.isArray(s)?s.filter(e=>!!e):s?[s]:[],[l,r]=(0,i.useState)(!0),n=1===a.length?a[0].guardrail_name:"".concat(a.length," guardrails"),o=Array.from(new Set(a.map(e=>e.guardrail_status))).every(e=>"success"===(null!=e?e:"").toLowerCase()),d=a.reduce((e,s)=>e+Object.values(s.masked_entity_count||{}).reduce((e,s)=>e+("number"==typeof s?s:0),0),0);return 0===a.length?null:(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow mb-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b cursor-pointer hover:bg-gray-50",onClick:()=>r(!l),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("svg",{className:"w-5 h-5 text-gray-600 transition-transform ".concat(l?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Guardrail Information"}),(0,t.jsx)(u.Z,{title:o?null:"Guardrail failed to run.",placement:"top",arrow:!0,destroyTooltipOnHide:!0,children:(0,t.jsx)("span",{className:"ml-2 px-2 py-1 rounded-md text-xs font-medium inline-block ".concat(o?"bg-green-100 text-green-800":"bg-red-100 text-red-800 cursor-help"),children:o?"success":"failure"})}),(0,t.jsx)("span",{className:"ml-2 font-mono text-sm text-gray-600",children:n}),d>0&&(0,t.jsxs)("span",{className:"ml-2 px-2 py-1 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[d," masked ",1===d?"entity":"entities"]})]}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:l?"Click to collapse":"Click to expand"})]}),l&&(0,t.jsx)("div",{className:"p-4 space-y-6",children:a.map((e,s)=>{var l;return(0,t.jsx)(J,{entry:e,index:s,total:a.length},"".concat(null!==(l=e.guardrail_name)&&void 0!==l?l:"guardrail","-").concat(s))})})]})},Q=a(23048),$=a(30841),X=a(7310),ee=a.n(X),es=a(12363);let ea={TEAM_ID:"Team ID",KEY_HASH:"Key Hash",REQUEST_ID:"Request ID",MODEL:"Model",USER_ID:"User ID",END_USER:"End User",STATUS:"Status",KEY_ALIAS:"Key Alias"};var et=a(59341),el=a(12485),er=a(18135),en=a(35242),ei=a(29706),eo=a(77991),ed=a(92280);let ec="".concat("../ui/assets/","audit-logs-preview.png");function em(e){let{userID:s,userRole:a,token:l,accessToken:o,isActive:m,premiumUser:u,allTeams:x}=e,[h,g]=(0,i.useState)(r()().subtract(24,"hours").format("YYYY-MM-DDTHH:mm")),p=(0,i.useRef)(null),j=(0,i.useRef)(null),[v,b]=(0,i.useState)(1),[N]=(0,i.useState)(50),[w,k]=(0,i.useState)({}),[_,S]=(0,i.useState)(""),[C,L]=(0,i.useState)(""),[M,T]=(0,i.useState)(""),[E,D]=(0,i.useState)("all"),[A,I]=(0,i.useState)("all"),[R,O]=(0,i.useState)(!1),[H,q]=(0,i.useState)(!1),F=(0,n.a)({queryKey:["all_audit_logs",o,l,a,s,h],queryFn:async()=>{if(!o||!l||!a||!s)return[];let e=r()(h).utc().format("YYYY-MM-DD HH:mm:ss"),t=r()().utc().format("YYYY-MM-DD HH:mm:ss"),n=[],i=1,c=1;do{let s=await (0,d.uiAuditLogsCall)(o,e,t,i,50);n=n.concat(s.audit_logs),c=s.total_pages,i++}while(i<=c);return n},enabled:!!o&&!!l&&!!a&&!!s&&m,refetchInterval:5e3,refetchIntervalInBackground:!0}),Y=(0,i.useCallback)(async e=>{if(o)try{let s=(await (0,d.keyListCall)(o,null,null,e,null,null,1,10)).keys.find(s=>s.key_alias===e);s?L(s.token):L("")}catch(e){console.error("Error fetching key hash for alias:",e),L("")}},[o]);(0,i.useEffect)(()=>{if(!o)return;let e=!1,s=!1;w["Team ID"]?_!==w["Team ID"]&&(S(w["Team ID"]),e=!0):""!==_&&(S(""),e=!0),w["Key Hash"]?C!==w["Key Hash"]&&(L(w["Key Hash"]),s=!0):w["Key Alias"]?Y(w["Key Alias"]):""!==C&&(L(""),s=!0),(e||s)&&b(1)},[w,o,Y,_,C]),(0,i.useEffect)(()=>{b(1)},[_,C,h,M,E,A]),(0,i.useEffect)(()=>{function e(e){p.current&&!p.current.contains(e.target)&&O(!1),j.current&&!j.current.contains(e.target)&&q(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let K=(0,i.useMemo)(()=>F.data?F.data.filter(e=>{var s,a,t,l,r,n,i;let o=!0,d=!0,c=!0,m=!0,u=!0;if(_){let r="string"==typeof e.before_value?null===(s=JSON.parse(e.before_value))||void 0===s?void 0:s.team_id:null===(a=e.before_value)||void 0===a?void 0:a.team_id,n="string"==typeof e.updated_values?null===(t=JSON.parse(e.updated_values))||void 0===t?void 0:t.team_id:null===(l=e.updated_values)||void 0===l?void 0:l.team_id;o=r===_||n===_}if(C)try{let s="string"==typeof e.before_value?JSON.parse(e.before_value):e.before_value,a="string"==typeof e.updated_values?JSON.parse(e.updated_values):e.updated_values,t=null==s?void 0:s.token,l=null==a?void 0:a.token;d="string"==typeof t&&t.includes(C)||"string"==typeof l&&l.includes(C)}catch(e){d=!1}if(M&&(c=null===(r=e.object_id)||void 0===r?void 0:r.toLowerCase().includes(M.toLowerCase())),"all"!==E&&(m=(null===(n=e.action)||void 0===n?void 0:n.toLowerCase())===E.toLowerCase()),"all"!==A){let s="";switch(A){case"keys":s="litellm_verificationtoken";break;case"teams":s="litellm_teamtable";break;case"users":s="litellm_usertable";break;default:s=A}u=(null===(i=e.table_name)||void 0===i?void 0:i.toLowerCase())===s}return o&&d&&c&&m&&u}):[],[F.data,_,C,M,E,A]),P=K.length,Z=Math.ceil(P/N)||1,U=(0,i.useMemo)(()=>{let e=(v-1)*N,s=e+N;return K.slice(e,s)},[K,v,N]),V=!F.data||0===F.data.length,B=(0,i.useCallback)(e=>{let{row:s}=e;return(0,t.jsx)(e=>{let{rowData:s}=e,{before_value:a,updated_values:l,table_name:r,action:n}=s,i=(e,s)=>{if(!e||0===Object.keys(e).length)return(0,t.jsx)(ed.x,{children:"N/A"});if(s){let s=Object.keys(e),a=["token","spend","max_budget"];if(s.every(e=>a.includes(e))&&s.length>0)return(0,t.jsxs)("div",{children:[s.includes("token")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Token:"})," ",e.token||"N/A"]}),s.includes("spend")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Spend:"})," ",void 0!==e.spend?"$".concat((0,f.pw)(e.spend,6)):"N/A"]}),s.includes("max_budget")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Max Budget:"})," ",void 0!==e.max_budget?"$".concat((0,f.pw)(e.max_budget,6)):"N/A"]})]});if(e["No differing fields detected in 'before' state"]||e["No differing fields detected in 'updated' state"]||e["No fields changed"])return(0,t.jsx)(ed.x,{children:e[Object.keys(e)[0]]})}return(0,t.jsx)("pre",{className:"p-2 bg-gray-50 border rounded text-xs overflow-auto max-h-60",children:JSON.stringify(e,null,2)})},o=a,d=l;if(("updated"===n||"rotated"===n)&&a&&l&&("LiteLLM_TeamTable"===r||"LiteLLM_UserTable"===r||"LiteLLM_VerificationToken"===r)){let e={},s={};new Set([...Object.keys(a),...Object.keys(l)]).forEach(t=>{JSON.stringify(a[t])!==JSON.stringify(l[t])&&(a.hasOwnProperty(t)&&(e[t]=a[t]),l.hasOwnProperty(t)&&(s[t]=l[t]))}),Object.keys(a).forEach(t=>{l.hasOwnProperty(t)||e.hasOwnProperty(t)||(e[t]=a[t],s[t]=void 0)}),Object.keys(l).forEach(t=>{a.hasOwnProperty(t)||s.hasOwnProperty(t)||(s[t]=l[t],e[t]=void 0)}),o=Object.keys(e).length>0?e:{"No differing fields detected in 'before' state":"N/A"},d=Object.keys(s).length>0?s:{"No differing fields detected in 'updated' state":"N/A"},0===Object.keys(e).length&&0===Object.keys(s).length&&(o={"No fields changed":"N/A"},d={"No fields changed":"N/A"})}return(0,t.jsxs)("div",{className:"-mx-4 p-4 bg-slate-100 border-y border-slate-300 grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold mb-2 text-sm text-slate-700",children:"Before Value:"}),i(o,"LiteLLM_VerificationToken"===r)]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold mb-2 text-sm text-slate-700",children:"Updated Value:"}),i(d,"LiteLLM_VerificationToken"===r)]})]})},{rowData:s.original})},[]);if(!u)return(0,t.jsxs)("div",{style:{textAlign:"center",marginTop:"20px"},children:[(0,t.jsx)("h1",{style:{display:"block",marginBottom:"10px"},children:"✨ Enterprise Feature."}),(0,t.jsx)(ed.x,{style:{display:"block",marginBottom:"10px"},children:"This is a LiteLLM Enterprise feature, and requires a valid key to use."}),(0,t.jsx)(ed.x,{style:{display:"block",marginBottom:"20px",fontStyle:"italic"},children:"Here's a preview of what Audit Logs offer:"}),(0,t.jsx)("img",{src:ec,alt:"Audit Logs Preview",style:{maxWidth:"100%",maxHeight:"700px",borderRadius:"8px",boxShadow:"0 4px 8px rgba(0,0,0,0.1)",margin:"0 auto"},onError:e=>{console.error("Failed to load audit logs preview image"),e.target.style.display="none"}})]});let W=P>0?(v-1)*N+1:0,z=Math.min(v*N,P);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4"}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsxs)("div",{className:"border-b px-6 py-4",children:[(0,t.jsx)("h1",{className:"text-xl font-semibold py-4",children:"Audit Logs"}),(0,t.jsx)(e=>{let{show:s}=e;return s?(0,t.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 flex items-start mb-6",children:[(0,t.jsx)("div",{className:"text-blue-500 mr-3 flex-shrink-0 mt-0.5",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:"Audit Logs Not Available"}),(0,t.jsx)("p",{className:"text-sm text-blue-700 mt-1",children:"To enable audit logging, add the following configuration to your LiteLLM proxy configuration file:"}),(0,t.jsx)("pre",{className:"mt-2 bg-white p-3 rounded border border-blue-200 text-xs font-mono overflow-auto",children:"litellm_settings:\n store_audit_logs: true"}),(0,t.jsx)("p",{className:"text-xs text-blue-700 mt-2",children:"Note: This will only affect new requests after the configuration change and proxy restart."})]})]}):null},{show:V}),(0,t.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between space-y-4 md:space-y-0",children:[(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsx)("input",{type:"text",placeholder:"Search by Object ID...",value:M,onChange:e=>T(e.target.value),className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})}),(0,t.jsxs)("button",{onClick:()=>{F.refetch()},className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",title:"Refresh data",children:[(0,t.jsx)("svg",{className:"w-4 h-4 ".concat(F.isFetching?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),(0,t.jsx)("span",{children:"Refresh"})]})]})}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("div",{className:"relative",ref:p,children:[(0,t.jsx)("label",{htmlFor:"actionFilterDisplay",className:"mr-2 text-sm font-medium text-gray-700 sr-only",children:"Action:"}),(0,t.jsxs)("button",{id:"actionFilterDisplay",onClick:()=>O(!R),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 bg-white w-40 text-left justify-between",children:[(0,t.jsxs)("span",{children:["all"===E&&"All Actions","created"===E&&"Created","updated"===E&&"Updated","deleted"===E&&"Deleted","rotated"===E&&"Rotated"]}),(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),R&&(0,t.jsx)("div",{className:"absolute left-0 mt-2 w-40 bg-white rounded-lg shadow-lg border p-1 z-50",children:(0,t.jsx)("div",{className:"space-y-1",children:[{label:"All Actions",value:"all"},{label:"Created",value:"created"},{label:"Updated",value:"updated"},{label:"Deleted",value:"deleted"},{label:"Rotated",value:"rotated"}].map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(E===e.value?"bg-blue-50 text-blue-600 font-medium":"font-normal"),onClick:()=>{D(e.value),O(!1)},children:e.label},e.value))})})]}),(0,t.jsxs)("div",{className:"relative",ref:j,children:[(0,t.jsx)("label",{htmlFor:"tableFilterDisplay",className:"mr-2 text-sm font-medium text-gray-700 sr-only",children:"Table:"}),(0,t.jsxs)("button",{id:"tableFilterDisplay",onClick:()=>q(!H),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 bg-white w-40 text-left justify-between",children:[(0,t.jsxs)("span",{children:["all"===A&&"All Tables","keys"===A&&"Keys","teams"===A&&"Teams","users"===A&&"Users"]}),(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),H&&(0,t.jsx)("div",{className:"absolute left-0 mt-2 w-40 bg-white rounded-lg shadow-lg border p-1 z-50",children:(0,t.jsx)("div",{className:"space-y-1",children:[{label:"All Tables",value:"all"},{label:"Keys",value:"keys"},{label:"Teams",value:"teams"},{label:"Users",value:"users"}].map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(A===e.value?"bg-blue-50 text-blue-600 font-medium":"font-normal"),onClick:()=>{I(e.value),q(!1)},children:e.label},e.value))})})]}),(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Showing ",F.isLoading?"...":W," -"," ",F.isLoading?"...":z," of"," ",F.isLoading?"...":P," results"]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",F.isLoading?"...":v," of"," ",F.isLoading?"...":Z]}),(0,t.jsx)("button",{onClick:()=>b(e=>Math.max(1,e-1)),disabled:F.isLoading||1===v,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>b(e=>Math.min(Z,e+1)),disabled:F.isLoading||v===Z,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})]}),(0,t.jsx)(c.w,{columns:y,data:U,renderSubComponent:B,getRowCanExpand:()=>!0})]})]})}let eu=(e,s,a)=>{if(e)return"".concat(r()(s).format("MMM D, h:mm A")," - ").concat(r()(a).format("MMM D, h:mm A"));let t=r()(),l=r()(s),n=t.diff(l,"minutes");if(n>=0&&n<2)return"Last 1 Minute";if(n>=2&&n<16)return"Last 15 Minutes";if(n>=16&&n<61)return"Last Hour";let i=t.diff(l,"hours");return i>=1&&i<5?"Last 4 Hours":i>=5&&i<25?"Last 24 Hours":i>=25&&i<169?"Last 7 Days":"".concat(l.format("MMM D")," - ").concat(t.format("MMM D"))};var ex=a(9309);function eh(e){var s,a,l;let{accessToken:m,token:u,userRole:x,userID:h,allTeams:g,premiumUser:p}=e,[f,j]=(0,i.useState)(""),[b,y]=(0,i.useState)(!1),[w,k]=(0,i.useState)(!1),[_,S]=(0,i.useState)(1),[L]=(0,i.useState)(50),T=(0,i.useRef)(null),E=(0,i.useRef)(null),D=(0,i.useRef)(null),[A,I]=(0,i.useState)(r()().subtract(24,"hours").format("YYYY-MM-DDTHH:mm")),[R,O]=(0,i.useState)(r()().format("YYYY-MM-DDTHH:mm")),[H,F]=(0,i.useState)(!1),[Y,K]=(0,i.useState)(!1),[P,Z]=(0,i.useState)(""),[U,V]=(0,i.useState)(""),[B,W]=(0,i.useState)(""),[z,J]=(0,i.useState)(""),[G,X]=(0,i.useState)(""),[ed,ec]=(0,i.useState)(null),[ex,eh]=(0,i.useState)(null),[ep,ef]=(0,i.useState)(""),[ej,ev]=(0,i.useState)(""),[eb,ey]=(0,i.useState)(x&&C.lo.includes(x)),[eN,ew]=(0,i.useState)("request logs"),[ek,e_]=(0,i.useState)(null),[eS,eC]=(0,i.useState)(null),eL=(0,o.NL)(),[eM,eT]=(0,i.useState)(()=>{let e=sessionStorage.getItem("isLiveTail");return null===e||JSON.parse(e)});(0,i.useEffect)(()=>{sessionStorage.setItem("isLiveTail",JSON.stringify(eM))},[eM]);let[eE,eD]=(0,i.useState)({value:24,unit:"hours"});(0,i.useEffect)(()=>{(async()=>{ex&&m&&ec({...(await (0,d.keyInfoV1Call)(m,ex)).info,token:ex,api_key:ex})})()},[ex,m]),(0,i.useEffect)(()=>{function e(e){T.current&&!T.current.contains(e.target)&&k(!1),E.current&&!E.current.contains(e.target)&&y(!1),D.current&&!D.current.contains(e.target)&&K(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,i.useEffect)(()=>{x&&C.lo.includes(x)&&ey(!0)},[x]);let eA=(0,n.a)({queryKey:["logs","table",_,L,A,R,B,z,eb?h:null,ep,G],queryFn:async()=>{if(!m||!u||!x||!h)return{data:[],total:0,page:1,page_size:L,total_pages:0};let e=r()(A).utc().format("YYYY-MM-DD HH:mm:ss"),s=H?r()(R).utc().format("YYYY-MM-DD HH:mm:ss"):r()().utc().format("YYYY-MM-DD HH:mm:ss"),a=await (0,d.uiSpendLogsCall)(m,z||void 0,B||void 0,void 0,e,s,_,L,eb?h:void 0,ej,ep,G);return await N(a.data,e,m,eL),a.data=a.data.map(s=>{let a=eL.getQueryData(["logDetails",s.request_id,e]);return(null==a?void 0:a.messages)&&(null==a?void 0:a.response)&&(s.messages=a.messages,s.response=a.response),s}),a},enabled:!!m&&!!u&&!!x&&!!h&&"request logs"===eN,refetchInterval:!!eM&&1===_&&15e3,refetchIntervalInBackground:!0}),{filters:eI,filteredLogs:eR,allTeams:eO,allKeyAliases:eH,handleFilterChange:eq,handleFilterReset:eF}=function(e){let{logs:s,accessToken:a,startTime:t,endTime:l,pageSize:o=es.d,isCustomDate:c,setCurrentPage:m,userID:u,userRole:x}=e,h=(0,i.useMemo)(()=>({[ea.TEAM_ID]:"",[ea.KEY_HASH]:"",[ea.REQUEST_ID]:"",[ea.MODEL]:"",[ea.USER_ID]:"",[ea.END_USER]:"",[ea.STATUS]:"",[ea.KEY_ALIAS]:""}),[]),[g,p]=(0,i.useState)(h),[f,j]=(0,i.useState)({data:[],total:0,page:1,page_size:50,total_pages:0}),v=(0,i.useRef)(0),b=(0,i.useCallback)(async function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!a)return;console.log("Filters being sent to API:",e);let n=Date.now();v.current=n;let i=r()(t).utc().format("YYYY-MM-DD HH:mm:ss"),m=c?r()(l).utc().format("YYYY-MM-DD HH:mm:ss"):r()().utc().format("YYYY-MM-DD HH:mm:ss");try{let t=await (0,d.uiSpendLogsCall)(a,e[ea.KEY_HASH]||void 0,e[ea.TEAM_ID]||void 0,e[ea.REQUEST_ID]||void 0,i,m,s,o,e[ea.USER_ID]||void 0,e[ea.END_USER]||void 0,e[ea.STATUS]||void 0,e[ea.MODEL]||void 0,e[ea.KEY_ALIAS]||void 0);n===v.current&&t.data&&j(t)}catch(e){console.error("Error searching users:",e)}},[a,t,l,c,o]),y=(0,i.useMemo)(()=>ee()((e,s)=>b(e,s),300),[b]);(0,i.useEffect)(()=>()=>y.cancel(),[y]);let N=(0,n.a)({queryKey:["allKeys"],queryFn:async()=>{if(!a)throw Error("Access token required");return await (0,$.LO)(a)},enabled:!!a}).data||[],w=(0,i.useMemo)(()=>!!(g[ea.KEY_ALIAS]||g[ea.KEY_HASH]||g[ea.REQUEST_ID]||g[ea.USER_ID]||g[ea.END_USER]),[g]),k=(0,i.useMemo)(()=>{if(!s||!s.data)return{data:[],total:0,page:1,page_size:50,total_pages:0};if(w)return s;let e=[...s.data];return g[ea.TEAM_ID]&&(e=e.filter(e=>e.team_id===g[ea.TEAM_ID])),g[ea.STATUS]&&(e=e.filter(e=>"success"===g[ea.STATUS]?!e.status||"success"===e.status:e.status===g[ea.STATUS])),g[ea.MODEL]&&(e=e.filter(e=>e.model===g[ea.MODEL])),g[ea.KEY_HASH]&&(e=e.filter(e=>e.api_key===g[ea.KEY_HASH])),g[ea.END_USER]&&(e=e.filter(e=>e.end_user===g[ea.END_USER])),{data:e,total:s.total,page:s.page,page_size:s.page_size,total_pages:s.total_pages}},[s,g,w]),_=(0,i.useMemo)(()=>w?f&&f.data&&f.data.length>0?f:s||{data:[],total:0,page:1,page_size:50,total_pages:0}:k,[w,f,k,s]),{data:S}=(0,n.a)({queryKey:["allTeamsForLogFilters",a],queryFn:async()=>a&&await (0,$.IE)(a)||[],enabled:!!a});return{filters:g,filteredLogs:_,allKeyAliases:N,allTeams:S,handleFilterChange:e=>{p(s=>{let a={...s,...e};for(let e of Object.keys(h))e in a||(a[e]=h[e]);return JSON.stringify(a)!==JSON.stringify(s)&&(m(1),y(a,1)),a})},handleFilterReset:()=>{p(h),j({data:[],total:0,page:1,page_size:50,total_pages:0}),y(h,1)}}}({logs:eA.data||{data:[],total:0,page:1,page_size:L||10,total_pages:1},accessToken:m,startTime:A,endTime:R,pageSize:L,isCustomDate:H,setCurrentPage:S,userID:h,userRole:x}),eY=(0,i.useCallback)(async e=>{if(m)try{let s=(await (0,d.keyListCall)(m,null,null,e,null,null,_,L)).keys.find(s=>s.key_alias===e);s&&J(s.token)}catch(e){console.error("Error fetching key hash for alias:",e)}},[m,_,L]);(0,i.useEffect)(()=>{m&&(eI["Team ID"]?W(eI["Team ID"]):W(""),ef(eI.Status||""),X(eI.Model||""),ev(eI["End User"]||""),eI["Key Hash"]?J(eI["Key Hash"]):eI["Key Alias"]?eY(eI["Key Alias"]):J(""))},[eI,m,eY]);let eK=(0,n.a)({queryKey:["sessionLogs",eS],queryFn:async()=>{if(!m||!eS)return{data:[],total:0,page:1,page_size:50,total_pages:1};let e=await (0,d.sessionSpendLogsCall)(m,eS);return{data:e.data||e||[],total:(e.data||e||[]).length,page:1,page_size:1e3,total_pages:1}},enabled:!!m&&!!eS});if((0,i.useEffect)(()=>{var e;(null===(e=eA.data)||void 0===e?void 0:e.data)&&ek&&!eA.data.data.some(e=>e.request_id===ek)&&e_(null)},[null===(s=eA.data)||void 0===s?void 0:s.data,ek]),!m||!u||!x||!h)return null;let eP=eR.data.filter(e=>!f||e.request_id.includes(f)||e.model.includes(f)||e.user&&e.user.includes(f)).map(e=>({...e,duration:(Date.parse(e.endTime)-Date.parse(e.startTime))/1e3,onKeyHashClick:e=>eh(e),onSessionClick:e=>{e&&eC(e)}}))||[],eZ=(null===(l=eK.data)||void 0===l?void 0:null===(a=l.data)||void 0===a?void 0:a.map(e=>({...e,onKeyHashClick:e=>eh(e),onSessionClick:e=>{}})))||[],eU=[{name:"Team ID",label:"Team ID",isSearchable:!0,searchFn:async e=>g&&0!==g.length?g.filter(s=>s.team_id.toLowerCase().includes(e.toLowerCase())||s.team_alias&&s.team_alias.toLowerCase().includes(e.toLowerCase())).map(e=>({label:"".concat(e.team_alias||e.team_id," (").concat(e.team_id,")"),value:e.team_id})):[]},{name:"Status",label:"Status",isSearchable:!1,options:[{label:"Success",value:"success"},{label:"Failure",value:"failure"}]},{name:"Model",label:"Model",isSearchable:!1},{name:"Key Alias",label:"Key Alias",isSearchable:!0,searchFn:async e=>m?(await (0,$.LO)(m)).filter(s=>s.toLowerCase().includes(e.toLowerCase())).map(e=>({label:e,value:e})):[]},{name:"End User",label:"End User",isSearchable:!0,searchFn:async e=>{if(!m)return[];let s=await (0,d.allEndUsersCall)(m);return((null==s?void 0:s.map(e=>e.user_id))||[]).filter(s=>s.toLowerCase().includes(e.toLowerCase())).map(e=>({label:e,value:e}))}},{name:"Key Hash",label:"Key Hash",isSearchable:!1}];if(eS&&eK.data)return(0,t.jsx)("div",{className:"w-full p-6",children:(0,t.jsx)(q,{sessionId:eS,logs:eK.data.data,onBack:()=>eC(null)})});let eV=[{label:"Last 15 Minutes",value:15,unit:"minutes"},{label:"Last Hour",value:1,unit:"hours"},{label:"Last 4 Hours",value:4,unit:"hours"},{label:"Last 24 Hours",value:24,unit:"hours"},{label:"Last 7 Days",value:7,unit:"days"}],eB=eV.find(e=>e.value===eE.value&&e.unit===eE.unit),eW=H?eu(H,A,R):null==eB?void 0:eB.label;return(0,t.jsx)("div",{className:"w-full max-w-screen p-6 overflow-x-hidden box-border",children:(0,t.jsxs)(er.Z,{defaultIndex:0,onIndexChange:e=>ew(0===e?"request logs":"audit logs"),children:[(0,t.jsxs)(en.Z,{children:[(0,t.jsx)(el.Z,{children:"Request Logs"}),(0,t.jsx)(el.Z,{children:"Audit Logs"})]}),(0,t.jsxs)(eo.Z,{children:[(0,t.jsxs)(ei.Z,{children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,t.jsx)("h1",{className:"text-xl font-semibold",children:eS?(0,t.jsxs)(t.Fragment,{children:["Session: ",(0,t.jsx)("span",{className:"font-mono",children:eS}),(0,t.jsx)("button",{className:"ml-4 px-3 py-1 text-sm border rounded hover:bg-gray-50",onClick:()=>eC(null),children:"← Back to All Logs"})]}):"Request Logs"})}),ed&&ex&&ed.api_key===ex?(0,t.jsx)(M.Z,{keyId:ex,keyData:ed,accessToken:m,userID:h,userRole:x,teams:g,onClose:()=>eh(null),premiumUser:p,backButtonText:"Back to Logs"}):eS?(0,t.jsx)("div",{className:"bg-white rounded-lg shadow",children:(0,t.jsx)(c.w,{columns:v,data:eZ,renderSubComponent:eg,getRowCanExpand:()=>!0})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Q.Z,{options:eU,onApplyFilters:eq,onResetFilters:eF}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full box-border",children:[(0,t.jsx)("div",{className:"border-b px-6 py-4 w-full max-w-full box-border",children:(0,t.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between space-y-4 md:space-y-0 w-full max-w-full box-border",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 w-full max-w-full box-border",children:[(0,t.jsxs)("div",{className:"relative w-64 min-w-0 flex-shrink-0",children:[(0,t.jsx)("input",{type:"text",placeholder:"Search by Request ID",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:f,onChange:e=>j(e.target.value)}),(0,t.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-shrink",children:[(0,t.jsxs)("div",{className:"relative z-50",ref:D,children:[(0,t.jsxs)("button",{onClick:()=>K(!Y),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",children:[(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),eW]}),Y&&(0,t.jsx)("div",{className:"absolute right-0 mt-2 w-64 bg-white rounded-lg shadow-lg border p-2 z-50",children:(0,t.jsxs)("div",{className:"space-y-1",children:[eV.map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(eW===e.label?"bg-blue-50 text-blue-600":""),onClick:()=>{O(r()().format("YYYY-MM-DDTHH:mm")),I(r()().subtract(e.value,e.unit).format("YYYY-MM-DDTHH:mm")),eD({value:e.value,unit:e.unit}),F(!1),K(!1)},children:e.label},e.label)),(0,t.jsx)("div",{className:"border-t my-2"}),(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(H?"bg-blue-50 text-blue-600":""),onClick:()=>F(!H),children:"Custom Range"})]})})]}),(0,t.jsx)(()=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900",children:"Live Tail"}),(0,t.jsx)(et.Z,{color:"green",checked:eM,defaultChecked:!0,onChange:eT})]}),{}),(0,t.jsxs)("button",{onClick:()=>{eA.refetch()},className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",title:"Refresh data",children:[(0,t.jsx)("svg",{className:"w-4 h-4 ".concat(eA.isFetching?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),(0,t.jsx)("span",{children:"Refresh"})]})]}),H&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"datetime-local",value:A,onChange:e=>{I(e.target.value),S(1)},className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})}),(0,t.jsx)("span",{className:"text-gray-500",children:"to"}),(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"datetime-local",value:R,onChange:e=>{O(e.target.value),S(1)},className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})})]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700 whitespace-nowrap",children:["Showing ",eA.isLoading?"...":eR?(_-1)*L+1:0," -"," ",eA.isLoading?"...":eR?Math.min(_*L,eR.total):0," ","of ",eA.isLoading?"...":eR?eR.total:0," results"]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700 min-w-[90px]",children:["Page ",eA.isLoading?"...":_," of"," ",eA.isLoading?"...":eR?eR.total_pages:1]}),(0,t.jsx)("button",{onClick:()=>S(e=>Math.max(1,e-1)),disabled:eA.isLoading||1===_,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>S(e=>Math.min(eR.total_pages||1,e+1)),disabled:eA.isLoading||_===(eR.total_pages||1),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})}),eM&&1===_&&(0,t.jsxs)("div",{className:"mb-4 px-4 py-2 bg-green-50 border border-greem-200 rounded-md flex items-center justify-between",children:[(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)("span",{className:"text-sm text-green-700",children:"Auto-refreshing every 15 seconds"})}),(0,t.jsx)("button",{onClick:()=>eT(!1),className:"text-sm text-green-600 hover:text-green-800",children:"Stop"})]}),(0,t.jsx)(c.w,{columns:v,data:eP,renderSubComponent:eg,getRowCanExpand:()=>!0})]})]})]}),(0,t.jsx)(ei.Z,{children:(0,t.jsx)(em,{userID:h,userRole:x,token:u,accessToken:m,isActive:"audit logs"===eN,premiumUser:p,allTeams:g})})]})]})})}function eg(e){var s,a,l,r,n,i,o,d,c,m;let{row:x}=e,h=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){}return e},g=x.original.metadata||{},p="failure"===g.status,j=p?g.error_information:null,v=x.original.messages&&(Array.isArray(x.original.messages)?x.original.messages.length>0:Object.keys(x.original.messages).length>0),b=x.original.response&&Object.keys(h(x.original.response)).length>0,y=g.vector_store_request_metadata&&Array.isArray(g.vector_store_request_metadata)&&g.vector_store_request_metadata.length>0,N=null===(s=x.original.metadata)||void 0===s?void 0:s.guardrail_information,w=Array.isArray(N)?N:N?[N]:[],k=w.length>0,C=w.reduce((e,s)=>{let a=null==s?void 0:s.masked_entity_count;return a?e+Object.values(a).reduce((e,s)=>"number"==typeof s?e+s:e,0):e},0),M=1===w.length?null!==(m=null===(a=w[0])||void 0===a?void 0:a.guardrail_name)&&void 0!==m?m:"-":w.length>1?"".concat(w.length," guardrails"):"-",T=(0,ex.aS)(x.original.request_id,64);return(0,t.jsxs)("div",{className:"p-6 bg-gray-50 space-y-6 w-full max-w-full overflow-hidden box-border",children:[(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsx)("div",{className:"p-4 border-b",children:(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request Details"})}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 p-4 w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Request ID:"}),x.original.request_id.length>64?(0,t.jsx)(u.Z,{title:x.original.request_id,children:(0,t.jsx)("span",{className:"font-mono text-sm",children:T})}):(0,t.jsx)("span",{className:"font-mono text-sm",children:x.original.request_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Model:"}),(0,t.jsx)("span",{children:x.original.model})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Model ID:"}),(0,t.jsx)("span",{children:x.original.model_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Call Type:"}),(0,t.jsx)("span",{children:x.original.call_type})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Provider:"}),(0,t.jsx)("span",{children:x.original.custom_llm_provider||"-"})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"API Base:"}),(0,t.jsx)(u.Z,{title:x.original.api_base||"-",children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:x.original.api_base||"-"})})]}),(null==x?void 0:null===(l=x.original)||void 0===l?void 0:l.requester_ip_address)&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"IP Address:"}),(0,t.jsx)("span",{children:null==x?void 0:null===(r=x.original)||void 0===r?void 0:r.requester_ip_address})]}),k&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Guardrail:"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-mono",children:M}),C>0&&(0,t.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[C," masked"]})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Tokens:"}),(0,t.jsxs)("span",{children:[x.original.total_tokens," (",x.original.prompt_tokens," prompt tokens +"," ",x.original.completion_tokens," completion tokens)"]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Read Tokens:"}),(0,t.jsx)("span",{children:(0,f.pw)((null===(i=x.original.metadata)||void 0===i?void 0:null===(n=i.additional_usage_values)||void 0===n?void 0:n.cache_read_input_tokens)||0)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Creation Tokens:"}),(0,t.jsx)("span",{children:(0,f.pw)(null===(o=x.original.metadata)||void 0===o?void 0:o.additional_usage_values.cache_creation_input_tokens)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cost:"}),(0,t.jsxs)("span",{children:["$",(0,f.pw)(x.original.spend||0,6)]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Hit:"}),(0,t.jsx)("span",{children:x.original.cache_hit})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Status:"}),(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block text-center w-16 ".concat("failure"!==((null===(d=x.original.metadata)||void 0===d?void 0:d.status)||"Success").toLowerCase()?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:"failure"!==((null===(c=x.original.metadata)||void 0===c?void 0:c.status)||"Success").toLowerCase()?"Success":"Failure"})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:x.original.startTime})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:x.original.endTime})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsxs)("span",{children:[x.original.duration," s."]})]})]})]})]}),(0,t.jsx)(L,{show:!v&&!b}),(0,t.jsx)("div",{className:"w-full max-w-full overflow-hidden",children:(0,t.jsx)(_,{row:x,hasMessages:v,hasResponse:b,hasError:p,errorInfo:j,getRawRequest:()=>{var e;return(null===(e=x.original)||void 0===e?void 0:e.proxy_server_request)?h(x.original.proxy_server_request):h(x.original.messages)},formattedResponse:()=>p&&j?{error:{message:j.error_message||"An error occurred",type:j.error_class||"error",code:j.error_code||"unknown",param:null}}:h(x.original.response)})}),k&&(0,t.jsx)(G,{data:N}),y&&(0,t.jsx)(F,{data:g.vector_store_request_metadata}),p&&j&&(0,t.jsx)(S,{errorInfo:j}),x.original.request_tags&&Object.keys(x.original.request_tags).length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"flex justify-between items-center p-4 border-b",children:(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request Tags"})}),(0,t.jsx)("div",{className:"p-4",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(x.original.request_tags).map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded-full text-xs",children:[s,": ",String(a)]},s)})})})]}),x.original.metadata&&Object.keys(x.original.metadata).length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Metadata"}),(0,t.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(JSON.stringify(x.original.metadata,null,2))},className:"p-1 hover:bg-gray-200 rounded",title:"Copy metadata",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),(0,t.jsx)("div",{className:"p-4 overflow-auto max-h-64",children:(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all",children:JSON.stringify(x.original.metadata,null,2)})})]})]})}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3801],{12363:function(e,s,a){a.d(s,{d:function(){return r},n:function(){return l}});var t=a(2265);let l=()=>{let[e,s]=(0,t.useState)("http://localhost:4000");return(0,t.useEffect)(()=>{{let{protocol:e,host:a}=window.location;s("".concat(e,"//").concat(a))}},[]),e},r=25},30841:function(e,s,a){a.d(s,{IE:function(){return r},LO:function(){return l},cT:function(){return n}});var t=a(19250);let l=async e=>{if(!e)return[];try{let{aliases:s}=await (0,t.keyAliasesCall)(e);return Array.from(new Set((s||[]).filter(Boolean)))}catch(e){return console.error("Error fetching all key aliases:",e),[]}},r=async(e,s)=>{if(!e)return[];try{let a=[],l=1,r=!0;for(;r;){let n=await (0,t.teamListCall)(e,s||null,null);a=[...a,...n],l{if(!e)return[];try{let s=[],a=1,l=!0;for(;l;){let r=await (0,t.organizationListCall)(e);s=[...s,...r],a{let{options:s,onApplyFilters:a,onResetFilters:d,initialValues:m={},buttonLabel:u="Filters"}=e,[x,h]=(0,l.useState)(!1),[g,p]=(0,l.useState)(m),[f,j]=(0,l.useState)({}),[v,b]=(0,l.useState)({}),[y,N]=(0,l.useState)({}),[w,k]=(0,l.useState)({}),_=(0,l.useCallback)(c()(async(e,s)=>{if(s.isSearchable&&s.searchFn){b(e=>({...e,[s.name]:!0}));try{let a=await s.searchFn(e);j(e=>({...e,[s.name]:a}))}catch(e){console.error("Error searching:",e),j(e=>({...e,[s.name]:[]}))}finally{b(e=>({...e,[s.name]:!1}))}}},300),[]),S=(0,l.useCallback)(async e=>{if(e.isSearchable&&e.searchFn&&!w[e.name]){b(s=>({...s,[e.name]:!0})),k(s=>({...s,[e.name]:!0}));try{let s=await e.searchFn("");j(a=>({...a,[e.name]:s}))}catch(s){console.error("Error loading initial options:",s),j(s=>({...s,[e.name]:[]}))}finally{b(s=>({...s,[e.name]:!1}))}}},[w]);(0,l.useEffect)(()=>{x&&s.forEach(e=>{e.isSearchable&&!w[e.name]&&S(e)})},[x,s,S,w]);let C=(e,s)=>{let t={...g,[e]:s};p(t),a(t)},L=(e,s)=>{e&&s.isSearchable&&!w[s.name]&&S(s)};return(0,t.jsxs)("div",{className:"w-full",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,t.jsx)(r.ZP,{icon:(0,t.jsx)(o.Z,{className:"h-4 w-4"}),onClick:()=>h(!x),className:"flex items-center gap-2",children:u}),(0,t.jsx)(r.ZP,{onClick:()=>{let e={};s.forEach(s=>{e[s.name]=""}),p(e),d()},children:"Reset Filters"})]}),x&&(0,t.jsx)("div",{className:"grid grid-cols-3 gap-x-6 gap-y-4 mb-6",children:["Team ID","Status","Organization ID","Key Alias","User ID","End User","Key Hash","Model"].map(e=>{let a=s.find(s=>s.label===e||s.name===e);return a?(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("label",{className:"text-sm text-gray-600",children:a.label||a.name}),a.isSearchable?(0,t.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search ".concat(a.label||a.name,"..."),value:g[a.name]||void 0,onChange:e=>C(a.name,e),onDropdownVisibleChange:e=>L(e,a),onSearch:e=>{N(s=>({...s,[a.name]:e})),a.searchFn&&_(e,a)},filterOption:!1,loading:v[a.name],options:f[a.name]||[],allowClear:!0,notFoundContent:v[a.name]?"Loading...":"No results found"}):a.options?(0,t.jsx)(n.default,{className:"w-full",placeholder:"Select ".concat(a.label||a.name,"..."),value:g[a.name]||void 0,onChange:e=>C(a.name,e),allowClear:!0,children:a.options.map(e=>(0,t.jsx)(n.default.Option,{value:e.value,children:e.label},e.value))}):(0,t.jsx)(i.default,{className:"w-full",placeholder:"Enter ".concat(a.label||a.name,"..."),value:g[a.name]||"",onChange:e=>C(a.name,e.target.value),allowClear:!0})]},a.name):null})})]})}},33801:function(e,s,a){a.d(s,{I:function(){return eg},Z:function(){return eh}});var t=a(57437),l=a(77398),r=a.n(l),n=a(11713),i=a(2265),o=a(29827),d=a(19250),c=a(12322),m=a(42673),u=a(99981);let x=e=>{try{return new Date(e).toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0}).replace(",","")}catch(e){return"Error converting time"}},h=e=>{let{utcTime:s}=e;return(0,t.jsx)("span",{style:{fontFamily:"monospace",width:"180px",display:"inline-block"},children:x(s)})};var g=a(41649),p=a(78489),f=a(59872);let j=(e,s)=>{var a,t;return(null===(t=e.metadata)||void 0===t?void 0:null===(a=t.mcp_tool_call_metadata)||void 0===a?void 0:a.mcp_server_logo_url)?e.metadata.mcp_tool_call_metadata.mcp_server_logo_url:s?(0,m.dr)(s).logo:""},v=[{id:"expander",header:()=>null,cell:e=>{let{row:s}=e;return(0,t.jsx)(()=>{let[e,a]=i.useState(s.getIsExpanded()),l=i.useCallback(()=>{a(e=>!e),s.getToggleExpandedHandler()()},[s]);return s.getCanExpand()?(0,t.jsx)("button",{onClick:l,style:{cursor:"pointer"},"aria-label":e?"Collapse row":"Expand row",className:"w-6 h-6 flex items-center justify-center focus:outline-none",children:(0,t.jsx)("svg",{className:"w-4 h-4 transform transition-transform duration-75 ".concat(e?"rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}):(0,t.jsx)("span",{className:"w-6 h-6 flex items-center justify-center",children:"●"})},{})}},{header:"Time",accessorKey:"startTime",cell:e=>(0,t.jsx)(h,{utcTime:e.getValue()})},{header:"Status",accessorKey:"metadata.status",cell:e=>{let s="failure"!==(e.getValue()||"Success").toLowerCase();return(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block text-center w-16 ".concat(s?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:s?"Success":"Failure"})}},{header:"Session ID",accessorKey:"session_id",cell:e=>{let s=String(e.getValue()||""),a=e.row.original.onSessionClick;return(0,t.jsx)(u.Z,{title:String(e.getValue()||""),children:(0,t.jsx)(p.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal text-xs max-w-[15ch] truncate block",onClick:()=>null==a?void 0:a(s),children:String(e.getValue()||"")})})}},{header:"Request ID",accessorKey:"request_id",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||""),children:(0,t.jsx)("span",{className:"font-mono text-xs max-w-[15ch] truncate block",children:String(e.getValue()||"")})})},{header:"Cost",accessorKey:"spend",cell:e=>(0,t.jsxs)("span",{children:["$",(0,f.pw)(e.getValue()||0,6)]})},{header:"Duration (s)",accessorKey:"duration",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Team Name",accessorKey:"metadata.user_api_key_team_alias",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Key Hash",accessorKey:"metadata.user_api_key",cell:e=>{let s=String(e.getValue()||"-"),a=e.row.original.onKeyHashClick;return(0,t.jsx)(u.Z,{title:s,children:(0,t.jsx)("span",{className:"font-mono max-w-[15ch] truncate block cursor-pointer hover:text-blue-600",onClick:()=>null==a?void 0:a(s),children:s})})}},{header:"Key Name",accessorKey:"metadata.user_api_key_alias",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Model",accessorKey:"model",cell:e=>{let s=e.row.original,a=s.custom_llm_provider,l=String(e.getValue()||"");return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,t.jsx)("img",{src:j(s,a),alt:"",className:"w-4 h-4",onError:e=>{e.target.style.display="none"}}),(0,t.jsx)(u.Z,{title:l,children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:l})})]})}},{header:"Tokens",accessorKey:"total_tokens",cell:e=>{let s=e.row.original;return(0,t.jsxs)("span",{className:"text-sm",children:[String(s.total_tokens||"0"),(0,t.jsxs)("span",{className:"text-gray-400 text-xs ml-1",children:["(",String(s.prompt_tokens||"0"),"+",String(s.completion_tokens||"0"),")"]})]})}},{header:"Internal User",accessorKey:"user",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"End User",accessorKey:"end_user",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Tags",accessorKey:"request_tags",cell:e=>{let s=e.getValue();if(!s||0===Object.keys(s).length)return"-";let a=Object.entries(s),l=a[0],r=a.slice(1);return(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:(0,t.jsx)(u.Z,{title:(0,t.jsx)("div",{className:"flex flex-col gap-1",children:a.map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{children:[s,": ",String(a)]},s)})}),children:(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded-full text-xs",children:[l[0],": ",String(l[1]),r.length>0&&" +".concat(r.length)]})})})}}],b=e=>(0,t.jsx)(g.Z,{color:"gray",className:"flex items-center gap-1",children:(0,t.jsx)("span",{className:"whitespace-nowrap text-xs",children:e})}),y=[{id:"expander",header:()=>null,cell:e=>{let{row:s}=e;return(0,t.jsx)(()=>{let[e,a]=i.useState(s.getIsExpanded()),l=i.useCallback(()=>{a(e=>!e),s.getToggleExpandedHandler()()},[s]);return s.getCanExpand()?(0,t.jsx)("button",{onClick:l,style:{cursor:"pointer"},"aria-label":e?"Collapse row":"Expand row",className:"w-6 h-6 flex items-center justify-center focus:outline-none",children:(0,t.jsx)("svg",{className:"w-4 h-4 transform transition-transform ".concat(e?"rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}):(0,t.jsx)("span",{className:"w-6 h-6 flex items-center justify-center",children:"●"})},{})}},{header:"Timestamp",accessorKey:"updated_at",cell:e=>(0,t.jsx)(h,{utcTime:e.getValue()})},{header:"Table Name",accessorKey:"table_name",cell:e=>{let s=e.getValue(),a=s;switch(s){case"LiteLLM_VerificationToken":a="Keys";break;case"LiteLLM_TeamTable":a="Teams";break;case"LiteLLM_OrganizationTable":a="Organizations";break;case"LiteLLM_UserTable":a="Users";break;case"LiteLLM_ProxyModelTable":a="Models";break;default:a=s}return(0,t.jsx)("span",{children:a})}},{header:"Action",accessorKey:"action",cell:e=>(0,t.jsx)("span",{children:b(e.getValue())})},{header:"Changed By",accessorKey:"changed_by",cell:e=>{let s=e.row.original.changed_by,a=e.row.original.changed_by_api_key;return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("div",{className:"font-medium",children:s}),a&&(0,t.jsx)(u.Z,{title:a,children:(0,t.jsxs)("div",{className:"text-xs text-muted-foreground max-w-[15ch] truncate",children:[" ",a]})})]})}},{header:"Affected Item ID",accessorKey:"object_id",cell:e=>(0,t.jsx)(()=>{let s=e.getValue(),[a,l]=(0,i.useState)(!1);if(!s)return(0,t.jsx)(t.Fragment,{children:"-"});let r=async()=>{try{await navigator.clipboard.writeText(String(s)),l(!0),setTimeout(()=>l(!1),1500)}catch(e){console.error("Failed to copy object ID: ",e)}};return(0,t.jsx)(u.Z,{title:a?"Copied!":String(s),children:(0,t.jsx)("span",{className:"max-w-[20ch] truncate block cursor-pointer hover:text-blue-600",onClick:r,children:String(s)})})},{})}],N=async(e,s,a,t)=>{console.log("prefetchLogDetails called with",e.length,"logs");let l=e.map(e=>{if(e.request_id)return console.log("Prefetching details for request_id:",e.request_id),t.prefetchQuery({queryKey:["logDetails",e.request_id,s],queryFn:async()=>{console.log("Fetching details for",e.request_id);let t=await (0,d.uiSpendLogDetailsCall)(a,e.request_id,s);return console.log("Received details for",e.request_id,":",t?"success":"failed"),t},staleTime:6e5,gcTime:6e5})});try{let e=await Promise.all(l);return console.log("All prefetch promises completed:",e.length),e}catch(e){throw console.error("Error in prefetchLogDetails:",e),e}};var w=a(9114),k=a(86669);function _(e){let{row:s,hasMessages:a,hasResponse:l,hasError:r,errorInfo:n,getRawRequest:i,formattedResponse:o}=e,d=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.focus(),s.select();let a=document.execCommand("copy");if(document.body.removeChild(s),!a)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},c=async()=>{await d(JSON.stringify(i(),null,2))?w.Z.success("Request copied to clipboard"):w.Z.fromBackend("Failed to copy request")},m=async()=>{await d(JSON.stringify(o(),null,2))?w.Z.success("Response copied to clipboard"):w.Z.fromBackend("Failed to copy response")};return(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 w-full max-w-full overflow-hidden box-border",children:[(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request"}),(0,t.jsx)("button",{onClick:c,className:"p-1 hover:bg-gray-200 rounded",title:"Copy request",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),(0,t.jsx)("div",{className:"p-4 overflow-auto max-h-96 w-full max-w-full box-border",children:(0,t.jsx)(k.gc,{data:i(),style:k.jF,clickToExpandNode:!0})})]}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsxs)("h3",{className:"text-lg font-medium",children:["Response",r&&(0,t.jsxs)("span",{className:"ml-2 text-sm text-red-600",children:["• HTTP code ",(null==n?void 0:n.error_code)||400]})]}),(0,t.jsx)("button",{onClick:m,className:"p-1 hover:bg-gray-200 rounded",title:"Copy response",disabled:!l,children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),(0,t.jsx)("div",{className:"p-4 overflow-auto max-h-96 w-full max-w-full box-border",children:l?(0,t.jsx)(k.gc,{data:o(),style:k.jF,clickToExpandNode:!0}):(0,t.jsx)("div",{className:"text-gray-500 text-sm italic text-center py-4",children:"Response data not available"})})]})]})}a(52621);let S=e=>{var s;let{errorInfo:a}=e,[l,r]=i.useState({}),[n,o]=i.useState(!1),d=e=>{r(s=>({...s,[e]:!s[e]}))},c=a.traceback&&(s=a.traceback)?Array.from(s.matchAll(/File "([^"]+)", line (\d+)/g)).map(e=>{let a=e[1],t=e[2],l=a.split("/").pop()||a,r=e.index||0,n=s.indexOf('File "',r+1),i=n>-1?s.substring(r,n).trim():s.substring(r).trim(),o=i.split("\n"),d="";return o.length>1&&(d=o[o.length-1].trim()),{filePath:a,fileName:l,lineNumber:t,code:d,inFunction:i.includes(" in ")?i.split(" in ")[1].split("\n")[0]:""}}):[];return(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"p-4 border-b",children:(0,t.jsxs)("h3",{className:"text-lg font-medium flex items-center text-red-600",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),"Error Details"]})}),(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{className:"bg-red-50 rounded-md p-4 mb-4",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"text-red-800 font-medium w-20",children:"Type:"}),(0,t.jsx)("span",{className:"text-red-700",children:a.error_class||"Unknown Error"})]}),(0,t.jsxs)("div",{className:"flex mt-2",children:[(0,t.jsx)("span",{className:"text-red-800 font-medium w-20 flex-shrink-0",children:"Message:"}),(0,t.jsx)("span",{className:"text-red-700 break-words whitespace-pre-wrap",children:a.error_message||"Unknown error occurred"})]})]}),a.traceback&&(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,t.jsx)("h4",{className:"font-medium",children:"Traceback"}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsx)("button",{onClick:()=>{let e=!n;if(o(e),c.length>0){let s={};c.forEach((a,t)=>{s[t]=e}),r(s)}},className:"text-gray-500 hover:text-gray-700 flex items-center text-sm",children:n?"Collapse All":"Expand All"}),(0,t.jsxs)("button",{onClick:()=>navigator.clipboard.writeText(a.traceback||""),className:"text-gray-500 hover:text-gray-700 flex items-center",title:"Copy traceback",children:[(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),(0,t.jsx)("span",{className:"ml-1",children:"Copy"})]})]})]}),(0,t.jsx)("div",{className:"bg-white rounded-md border border-gray-200 overflow-hidden shadow-sm",children:c.map((e,s)=>(0,t.jsxs)("div",{className:"border-b border-gray-200 last:border-b-0",children:[(0,t.jsxs)("div",{className:"px-4 py-2 flex items-center justify-between cursor-pointer hover:bg-gray-50",onClick:()=>d(s),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{className:"text-gray-400 mr-2 w-12 text-right",children:e.lineNumber}),(0,t.jsx)("span",{className:"text-gray-600 font-medium",children:e.fileName}),(0,t.jsx)("span",{className:"text-gray-500 mx-1",children:"in"}),(0,t.jsx)("span",{className:"text-indigo-600 font-medium",children:e.inFunction||e.fileName})]}),(0,t.jsx)("svg",{className:"w-5 h-5 text-gray-500 transition-transform ".concat(l[s]?"transform rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),(l[s]||!1)&&e.code&&(0,t.jsx)("div",{className:"px-12 py-2 font-mono text-sm text-gray-800 bg-gray-50 overflow-x-auto border-t border-gray-100",children:e.code})]},s))})]})]})]})};var C=a(20347);let L=e=>{let{show:s}=e;return s?(0,t.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 flex items-start",children:[(0,t.jsx)("div",{className:"text-blue-500 mr-3 flex-shrink-0 mt-0.5",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:"Request/Response Data Not Available"}),(0,t.jsxs)("p",{className:"text-sm text-blue-700 mt-1",children:["To view request and response details, enable prompt storage in your LiteLLM configuration by adding the following to your ",(0,t.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded",children:"proxy_config.yaml"})," file:"]}),(0,t.jsx)("pre",{className:"mt-2 bg-white p-3 rounded border border-blue-200 text-xs font-mono overflow-auto",children:"general_settings:\n store_model_in_db: true\n store_prompts_in_spend_logs: true"}),(0,t.jsx)("p",{className:"text-xs text-blue-700 mt-2",children:"Note: This will only affect new requests after the configuration change."})]})]}):null};var M=a(94292),T=a(12514),E=a(35829),D=a(84264),A=a(96761),I=a(10900),R=a(5545),O=a(30401),H=a(78867);let q=e=>{let{sessionId:s,logs:a,onBack:l}=e,[r,n]=(0,i.useState)(null),[o,d]=(0,i.useState)({}),m=a.reduce((e,s)=>e+(s.spend||0),0),x=a.reduce((e,s)=>e+(s.total_tokens||0),0),h=a.reduce((e,s)=>{var a,t;return e+((null===(t=s.metadata)||void 0===t?void 0:null===(a=t.additional_usage_values)||void 0===a?void 0:a.cache_read_input_tokens)||0)},0),g=a.reduce((e,s)=>{var a,t;return e+((null===(t=s.metadata)||void 0===t?void 0:null===(a=t.additional_usage_values)||void 0===a?void 0:a.cache_creation_input_tokens)||0)},0),j=x+h+g,b=a.length>0?new Date(a[0].startTime):new Date;(((a.length>0?new Date(a[a.length-1].endTime):new Date).getTime()-b.getTime())/1e3).toFixed(2),a.map(e=>({time:new Date(e.startTime).toISOString(),tokens:e.total_tokens||0,cost:e.spend||0}));let y=async(e,s)=>{await (0,f.vQ)(e)&&(d(e=>({...e,[s]:!0})),setTimeout(()=>{d(e=>({...e,[s]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)(p.Z,{icon:I.Z,variant:"light",onClick:l,className:"mb-4",children:"Back to All Logs"}),(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)("h1",{className:"text-2xl font-semibold text-gray-900",children:"Session Details"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)("p",{className:"text-sm text-gray-500 font-mono",children:s}),(0,t.jsx)(R.ZP,{type:"text",size:"small",icon:o["session-id"]?(0,t.jsx)(O.Z,{size:12}):(0,t.jsx)(H.Z,{size:12}),onClick:()=>y(s,"session-id"),className:"left-2 z-10 transition-all duration-200 ".concat(o["session-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]}),(0,t.jsxs)("a",{href:"https://docs.litellm.ai/docs/proxy/ui_logs_sessions",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:text-blue-800 flex items-center gap-1",children:["Get started with session management here",(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,t.jsxs)(T.Z,{children:[(0,t.jsx)(D.Z,{children:"Total Requests"}),(0,t.jsx)(E.Z,{children:a.length})]}),(0,t.jsxs)(T.Z,{children:[(0,t.jsx)(D.Z,{children:"Total Cost"}),(0,t.jsxs)(E.Z,{children:["$",(0,f.pw)(m,6)]})]}),(0,t.jsx)(u.Z,{title:(0,t.jsxs)("div",{className:"text-white min-w-[200px]",children:[(0,t.jsx)("div",{className:"text-lg font-medium mb-3",children:"Usage breakdown"}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-base font-medium mb-2",children:"Input usage:"}),(0,t.jsxs)("div",{className:"space-y-2 text-sm text-gray-300",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,f.pw)(a.reduce((e,s)=>e+(s.prompt_tokens||0),0))})]}),h>0&&(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input_cached_tokens:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,f.pw)(h)})]}),g>0&&(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input_cache_creation_tokens:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,f.pw)(g)})]})]})]}),(0,t.jsxs)("div",{className:"border-t border-gray-600 pt-3",children:[(0,t.jsx)("div",{className:"text-base font-medium mb-2",children:"Output usage:"}),(0,t.jsx)("div",{className:"space-y-2 text-sm text-gray-300",children:(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"output:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,f.pw)(a.reduce((e,s)=>e+(s.completion_tokens||0),0))})]})})]}),(0,t.jsx)("div",{className:"border-t border-gray-600 pt-3",children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-base font-medium",children:"Total usage:"}),(0,t.jsx)("span",{className:"text-sm text-gray-300",children:(0,f.pw)(j)})]})})]})]}),placement:"top",overlayStyle:{minWidth:"300px"},children:(0,t.jsxs)(T.Z,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(D.Z,{children:"Total Tokens"}),(0,t.jsx)("span",{className:"text-gray-400 text-sm",children:"ⓘ"})]}),(0,t.jsx)(E.Z,{children:(0,f.pw)(j)})]})})]}),(0,t.jsx)(A.Z,{children:"Session Logs"}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(c.w,{columns:v,data:a,renderSubComponent:eg,getRowCanExpand:()=>!0,loadingMessage:"Loading logs...",noDataMessage:"No logs found"})})]})};function F(e){let{data:s}=e,[a,l]=(0,i.useState)(!0),[r,n]=(0,i.useState)({});if(!s||0===s.length)return null;let o=e=>new Date(1e3*e).toLocaleString(),d=(e,s)=>"".concat(((s-e)*1e3).toFixed(2),"ms"),c=(e,s)=>{let a="".concat(e,"-").concat(s);n(e=>({...e,[a]:!e[a]}))};return(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow mb-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b cursor-pointer hover:bg-gray-50",onClick:()=>l(!a),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 text-gray-600 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Vector Store Requests"})]}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:a?"Click to collapse":"Click to expand"})]}),a&&(0,t.jsx)("div",{className:"p-4",children:s.map((e,s)=>(0,t.jsxs)("div",{className:"mb-6 last:mb-0",children:[(0,t.jsx)("div",{className:"bg-white rounded-lg border p-4 mb-4",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Query:"}),(0,t.jsx)("span",{className:"font-mono",children:e.query})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Vector Store ID:"}),(0,t.jsx)("span",{className:"font-mono",children:e.vector_store_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Provider:"}),(0,t.jsx)("span",{className:"flex items-center",children:(()=>{let{logo:s,displayName:a}=(0,m.dr)(e.custom_llm_provider);return(0,t.jsxs)(t.Fragment,{children:[s&&(0,t.jsx)("img",{src:s,alt:"".concat(a," logo"),className:"h-5 w-5 mr-2"}),a]})})()})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:o(e.start_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:o(e.end_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsx)("span",{children:d(e.start_time,e.end_time)})]})]})]})}),(0,t.jsx)("h4",{className:"font-medium mb-2",children:"Search Results"}),(0,t.jsx)("div",{className:"space-y-2",children:e.vector_store_search_response.data.map((e,a)=>{let l=r["".concat(s,"-").concat(a)]||!1;return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center p-3 bg-gray-50 cursor-pointer",onClick:()=>c(s,a),children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(l?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsxs)("span",{className:"font-medium mr-2",children:["Result ",a+1]}),(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["Score: ",(0,t.jsx)("span",{className:"font-mono",children:e.score.toFixed(4)})]})]})]}),l&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:e.content.map((e,s)=>(0,t.jsxs)("div",{className:"mb-2 last:mb-0",children:[(0,t.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:e.type}),(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all bg-gray-50 p-2 rounded",children:e.text})]},s))})]},a)})})]},s))})]})}let Y=e=>e>=.8?"text-green-600":"text-yellow-600";var K=e=>{let{entities:s}=e,[a,l]=(0,i.useState)(!0),[r,n]=(0,i.useState)({}),o=e=>{n(s=>({...s,[e]:!s[e]}))};return s&&0!==s.length?(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"flex items-center mb-2 cursor-pointer",onClick:()=>l(!a),children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h4",{className:"font-medium",children:["Detected Entities (",s.length,")"]})]}),a&&(0,t.jsx)("div",{className:"space-y-2",children:s.map((e,s)=>{let a=r[s]||!1;return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>o(s),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("span",{className:"font-medium mr-2",children:e.entity_type}),(0,t.jsxs)("span",{className:"font-mono ".concat(Y(e.score)),children:["Score: ",e.score.toFixed(2)]})]}),(0,t.jsxs)("span",{className:"text-xs text-gray-500",children:["Position: ",e.start,"-",e.end]})]}),a&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-2",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Entity Type:"}),(0,t.jsx)("span",{children:e.entity_type})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Position:"}),(0,t.jsxs)("span",{children:["Characters ",e.start,"-",e.end]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Confidence:"}),(0,t.jsx)("span",{className:Y(e.score),children:e.score.toFixed(2)})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[e.recognition_metadata&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Recognizer:"}),(0,t.jsx)("span",{children:e.recognition_metadata.recognizer_name})]}),(0,t.jsxs)("div",{className:"flex overflow-hidden",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Identifier:"}),(0,t.jsx)("span",{className:"truncate text-xs font-mono",children:e.recognition_metadata.recognizer_identifier})]})]}),e.analysis_explanation&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Explanation:"}),(0,t.jsx)("span",{children:e.analysis_explanation})]})]})]})})]},s)})})]}):null};let P=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"slate";return(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block ".concat({green:"bg-green-100 text-green-800",red:"bg-red-100 text-red-800",blue:"bg-blue-50 text-blue-700",slate:"bg-slate-100 text-slate-800",amber:"bg-amber-100 text-amber-800"}[s]),children:e})},Z=e=>e?P("detected","red"):P("not detected","slate"),U=e=>{let{title:s,count:a,defaultOpen:l=!0,right:r,children:n}=e,[o,d]=(0,i.useState)(l);return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>d(e=>!e),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(o?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h5",{className:"font-medium",children:[s," ","number"==typeof a&&(0,t.jsxs)("span",{className:"text-gray-500 font-normal",children:["(",a,")"]})]})]}),(0,t.jsx)("div",{children:r})]}),o&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:n})]})},V=e=>{let{label:s,children:a,mono:l}=e;return(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:s}),(0,t.jsx)("span",{className:l?"font-mono text-sm break-all":"",children:a})]})},B=()=>(0,t.jsx)("div",{className:"my-3 border-t"});var W=e=>{var s,a,l,r,n,i,o,d,c,m;let{response:u}=e;if(!u)return null;let x=null!==(n=null!==(r=u.outputs)&&void 0!==r?r:u.output)&&void 0!==n?n:[],h="GUARDRAIL_INTERVENED"===u.action?"red":"green",g=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(null===(s=u.guardrailCoverage)||void 0===s?void 0:s.textCharacters)&&P("text guarded ".concat(null!==(i=u.guardrailCoverage.textCharacters.guarded)&&void 0!==i?i:0,"/").concat(null!==(o=u.guardrailCoverage.textCharacters.total)&&void 0!==o?o:0),"blue"),(null===(a=u.guardrailCoverage)||void 0===a?void 0:a.images)&&P("images guarded ".concat(null!==(d=u.guardrailCoverage.images.guarded)&&void 0!==d?d:0,"/").concat(null!==(c=u.guardrailCoverage.images.total)&&void 0!==c?c:0),"blue")]}),p=u.usage&&(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(u.usage).map(e=>{let[s,a]=e;return"number"==typeof a?(0,t.jsxs)("span",{className:"px-2 py-1 bg-slate-100 text-slate-800 rounded-md text-xs font-medium",children:[s,": ",a]},s):null})});return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(V,{label:"Action:",children:P(null!==(m=u.action)&&void 0!==m?m:"N/A",h)}),u.actionReason&&(0,t.jsx)(V,{label:"Action Reason:",children:u.actionReason}),u.blockedResponse&&(0,t.jsx)(V,{label:"Blocked Response:",children:(0,t.jsx)("span",{className:"italic",children:u.blockedResponse})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(V,{label:"Coverage:",children:g}),(0,t.jsx)(V,{label:"Usage:",children:p})]})]}),x.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B,{}),(0,t.jsx)("h4",{className:"font-medium mb-2",children:"Outputs"}),(0,t.jsx)("div",{className:"space-y-2",children:x.map((e,s)=>{var a;return(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsx)("div",{className:"text-sm whitespace-pre-wrap",children:null!==(a=e.text)&&void 0!==a?a:(0,t.jsx)("em",{children:"(non-text output)"})})},s)})})]})]}),(null===(l=u.assessments)||void 0===l?void 0:l.length)?(0,t.jsx)("div",{className:"space-y-3",children:u.assessments.map((e,s)=>{var a,l,r,n,i,o,d,c,m,u,x,h,g,p,f,j,v,b,y,N,w,k,_,S;let C=(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.wordPolicy&&P("word","slate"),e.contentPolicy&&P("content","slate"),e.topicPolicy&&P("topic","slate"),e.sensitiveInformationPolicy&&P("sensitive-info","slate"),e.contextualGroundingPolicy&&P("contextual-grounding","slate"),e.automatedReasoningPolicy&&P("automated-reasoning","slate")]});return(0,t.jsxs)(U,{title:"Assessment #".concat(s+1),defaultOpen:!0,right:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(null===(a=e.invocationMetrics)||void 0===a?void 0:a.guardrailProcessingLatency)!=null&&P("".concat(e.invocationMetrics.guardrailProcessingLatency," ms"),"amber"),C]}),children:[e.wordPolicy&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Word Policy"}),(null!==(j=null===(l=e.wordPolicy.customWords)||void 0===l?void 0:l.length)&&void 0!==j?j:0)>0&&(0,t.jsx)(U,{title:"Custom Words",defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:e.wordPolicy.customWords.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-mono text-sm break-all",children:e.match})]}),Z(e.detected)]},s)})})}),(null!==(v=null===(r=e.wordPolicy.managedWordLists)||void 0===r?void 0:r.length)&&void 0!==v?v:0)>0&&(0,t.jsx)(U,{title:"Managed Word Lists",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.wordPolicy.managedWordLists.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-mono text-sm break-all",children:e.match}),e.type&&P(e.type,"slate")]}),Z(e.detected)]},s)})})})]}),(null===(i=e.contentPolicy)||void 0===i?void 0:null===(n=i.filters)||void 0===n?void 0:n.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Content Policy"}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"min-w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-gray-600",children:[(0,t.jsx)("th",{className:"py-1 pr-4",children:"Type"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Action"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Detected"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Strength"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Confidence"})]})}),(0,t.jsx)("tbody",{children:e.contentPolicy.filters.map((e,s)=>{var a,l,r,n;return(0,t.jsxs)("tr",{className:"border-t",children:[(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(a=e.type)&&void 0!==a?a:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:P(null!==(l=e.action)&&void 0!==l?l:"—",e.detected?"red":"slate")}),(0,t.jsx)("td",{className:"py-1 pr-4",children:Z(e.detected)}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(r=e.filterStrength)&&void 0!==r?r:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(n=e.confidence)&&void 0!==n?n:"—"})]},s)})})]})})]}):null,(null===(d=e.contextualGroundingPolicy)||void 0===d?void 0:null===(o=d.filters)||void 0===o?void 0:o.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Contextual Grounding"}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"min-w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-gray-600",children:[(0,t.jsx)("th",{className:"py-1 pr-4",children:"Type"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Action"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Detected"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Score"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Threshold"})]})}),(0,t.jsx)("tbody",{children:e.contextualGroundingPolicy.filters.map((e,s)=>{var a,l,r,n;return(0,t.jsxs)("tr",{className:"border-t",children:[(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(a=e.type)&&void 0!==a?a:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:P(null!==(l=e.action)&&void 0!==l?l:"—",e.detected?"red":"slate")}),(0,t.jsx)("td",{className:"py-1 pr-4",children:Z(e.detected)}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(r=e.score)&&void 0!==r?r:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(n=e.threshold)&&void 0!==n?n:"—"})]},s)})})]})})]}):null,e.sensitiveInformationPolicy&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Sensitive Information"}),(null!==(b=null===(c=e.sensitiveInformationPolicy.piiEntities)||void 0===c?void 0:c.length)&&void 0!==b?b:0)>0&&(0,t.jsx)(U,{title:"PII Entities",defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:e.sensitiveInformationPolicy.piiEntities.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),e.type&&P(e.type,"slate"),(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.match})]}),Z(e.detected)]},s)})})}),(null!==(y=null===(m=e.sensitiveInformationPolicy.regexes)||void 0===m?void 0:m.length)&&void 0!==y?y:0)>0&&(0,t.jsx)(U,{title:"Custom Regexes",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.sensitiveInformationPolicy.regexes.map((e,s)=>{var a,l;return(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-2 bg-gray-50 rounded gap-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-medium",children:null!==(l=e.name)&&void 0!==l?l:"regex"}),(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.regex})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[Z(e.detected),e.match&&(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.match})]})]},s)})})})]}),(null===(x=e.topicPolicy)||void 0===x?void 0:null===(u=x.topics)||void 0===u?void 0:u.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Topic Policy"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.topicPolicy.topics.map((e,s)=>{var a,l;return(0,t.jsx)("div",{className:"px-3 py-1.5 bg-gray-50 rounded-md text-xs",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-medium",children:null!==(l=e.name)&&void 0!==l?l:"topic"}),e.type&&P(e.type,"slate"),Z(e.detected)]})},s)})})]}):null,e.invocationMetrics&&(0,t.jsx)(U,{title:"Invocation Metrics",defaultOpen:!1,children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(V,{label:"Latency (ms)",children:null!==(N=e.invocationMetrics.guardrailProcessingLatency)&&void 0!==N?N:"—"}),(0,t.jsx)(V,{label:"Coverage:",children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(null===(h=e.invocationMetrics.guardrailCoverage)||void 0===h?void 0:h.textCharacters)&&P("text ".concat(null!==(w=e.invocationMetrics.guardrailCoverage.textCharacters.guarded)&&void 0!==w?w:0,"/").concat(null!==(k=e.invocationMetrics.guardrailCoverage.textCharacters.total)&&void 0!==k?k:0),"blue"),(null===(g=e.invocationMetrics.guardrailCoverage)||void 0===g?void 0:g.images)&&P("images ".concat(null!==(_=e.invocationMetrics.guardrailCoverage.images.guarded)&&void 0!==_?_:0,"/").concat(null!==(S=e.invocationMetrics.guardrailCoverage.images.total)&&void 0!==S?S:0),"blue")]})})]}),(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)(V,{label:"Usage:",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.invocationMetrics.usage&&Object.entries(e.invocationMetrics.usage).map(e=>{let[s,a]=e;return"number"==typeof a?(0,t.jsxs)("span",{className:"px-2 py-1 bg-slate-100 text-slate-800 rounded-md text-xs font-medium",children:[s,": ",a]},s):null})})})})]})}),(null===(f=e.automatedReasoningPolicy)||void 0===f?void 0:null===(p=f.findings)||void 0===p?void 0:p.length)?(0,t.jsx)(U,{title:"Automated Reasoning Findings",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.automatedReasoningPolicy.findings.map((e,s)=>(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-2 text-xs overflow-x-auto",children:JSON.stringify(e,null,2)},s))})}):null]},s)})}):null,(0,t.jsx)(U,{title:"Raw Bedrock Guardrail Response",defaultOpen:!1,children:(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-3 text-xs overflow-x-auto",children:JSON.stringify(u,null,2)})})]})};let z=e=>new Date(1e3*e).toLocaleString(),J=e=>{var s,a;let{entry:l,index:r,total:n}=e,i=null!==(s=l.guardrail_provider)&&void 0!==s?s:"presidio",o=null!==(a=l.guardrail_status)&&void 0!==a?a:"unknown",d="success"===o.toLowerCase(),c=l.masked_entity_count||{},m=Object.values(c).reduce((e,s)=>e+("number"==typeof s?s:0),0),x=l.guardrail_response,h=Array.isArray(x)?x:[],g="bedrock"!==i||null===x||"object"!=typeof x||Array.isArray(x)?void 0:x;return(0,t.jsxs)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[n>1&&(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("h4",{className:"text-base font-semibold",children:["Guardrail #",r+1,(0,t.jsx)("span",{className:"ml-2 font-mono text-sm text-gray-600",children:l.guardrail_name})]}),(0,t.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md text-xs capitalize",children:i})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Guardrail Name:"}),(0,t.jsx)("span",{className:"font-mono break-words",children:l.guardrail_name})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Mode:"}),(0,t.jsx)("span",{className:"font-mono break-words",children:l.guardrail_mode})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Status:"}),(0,t.jsx)(u.Z,{title:d?null:"Guardrail failed to run.",placement:"top",arrow:!0,destroyTooltipOnHide:!0,children:(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block ".concat(d?"bg-green-100 text-green-800":"bg-red-100 text-red-800 cursor-help"),children:o})})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:z(l.start_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:z(l.end_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsxs)("span",{children:[l.duration.toFixed(4),"s"]})]})]})]}),m>0&&(0,t.jsxs)("div",{className:"mt-4 pt-4 border-t",children:[(0,t.jsx)("h5",{className:"font-medium mb-2",children:"Masked Entity Summary"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(c).map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{className:"px-3 py-1.5 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[s,": ",a]},s)})})]}),"presidio"===i&&h.length>0&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(K,{entities:h})}),"bedrock"===i&&g&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(W,{response:g})})]})};var G=e=>{let{data:s}=e,a=Array.isArray(s)?s.filter(e=>!!e):s?[s]:[],[l,r]=(0,i.useState)(!0),n=1===a.length?a[0].guardrail_name:"".concat(a.length," guardrails"),o=Array.from(new Set(a.map(e=>e.guardrail_status))).every(e=>"success"===(null!=e?e:"").toLowerCase()),d=a.reduce((e,s)=>e+Object.values(s.masked_entity_count||{}).reduce((e,s)=>e+("number"==typeof s?s:0),0),0);return 0===a.length?null:(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow mb-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b cursor-pointer hover:bg-gray-50",onClick:()=>r(!l),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("svg",{className:"w-5 h-5 text-gray-600 transition-transform ".concat(l?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Guardrail Information"}),(0,t.jsx)(u.Z,{title:o?null:"Guardrail failed to run.",placement:"top",arrow:!0,destroyTooltipOnHide:!0,children:(0,t.jsx)("span",{className:"ml-2 px-2 py-1 rounded-md text-xs font-medium inline-block ".concat(o?"bg-green-100 text-green-800":"bg-red-100 text-red-800 cursor-help"),children:o?"success":"failure"})}),(0,t.jsx)("span",{className:"ml-2 font-mono text-sm text-gray-600",children:n}),d>0&&(0,t.jsxs)("span",{className:"ml-2 px-2 py-1 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[d," masked ",1===d?"entity":"entities"]})]}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:l?"Click to collapse":"Click to expand"})]}),l&&(0,t.jsx)("div",{className:"p-4 space-y-6",children:a.map((e,s)=>{var l;return(0,t.jsx)(J,{entry:e,index:s,total:a.length},"".concat(null!==(l=e.guardrail_name)&&void 0!==l?l:"guardrail","-").concat(s))})})]})},Q=a(23048),$=a(30841),X=a(7310),ee=a.n(X),es=a(12363);let ea={TEAM_ID:"Team ID",KEY_HASH:"Key Hash",REQUEST_ID:"Request ID",MODEL:"Model",USER_ID:"User ID",END_USER:"End User",STATUS:"Status",KEY_ALIAS:"Key Alias"};var et=a(59341),el=a(12485),er=a(18135),en=a(35242),ei=a(29706),eo=a(77991),ed=a(92280);let ec="".concat("../ui/assets/","audit-logs-preview.png");function em(e){let{userID:s,userRole:a,token:l,accessToken:o,isActive:m,premiumUser:u,allTeams:x}=e,[h,g]=(0,i.useState)(r()().subtract(24,"hours").format("YYYY-MM-DDTHH:mm")),p=(0,i.useRef)(null),j=(0,i.useRef)(null),[v,b]=(0,i.useState)(1),[N]=(0,i.useState)(50),[w,k]=(0,i.useState)({}),[_,S]=(0,i.useState)(""),[C,L]=(0,i.useState)(""),[M,T]=(0,i.useState)(""),[E,D]=(0,i.useState)("all"),[A,I]=(0,i.useState)("all"),[R,O]=(0,i.useState)(!1),[H,q]=(0,i.useState)(!1),F=(0,n.a)({queryKey:["all_audit_logs",o,l,a,s,h],queryFn:async()=>{if(!o||!l||!a||!s)return[];let e=r()(h).utc().format("YYYY-MM-DD HH:mm:ss"),t=r()().utc().format("YYYY-MM-DD HH:mm:ss"),n=[],i=1,c=1;do{let s=await (0,d.uiAuditLogsCall)(o,e,t,i,50);n=n.concat(s.audit_logs),c=s.total_pages,i++}while(i<=c);return n},enabled:!!o&&!!l&&!!a&&!!s&&m,refetchInterval:5e3,refetchIntervalInBackground:!0}),Y=(0,i.useCallback)(async e=>{if(o)try{let s=(await (0,d.keyListCall)(o,null,null,e,null,null,1,10)).keys.find(s=>s.key_alias===e);s?L(s.token):L("")}catch(e){console.error("Error fetching key hash for alias:",e),L("")}},[o]);(0,i.useEffect)(()=>{if(!o)return;let e=!1,s=!1;w["Team ID"]?_!==w["Team ID"]&&(S(w["Team ID"]),e=!0):""!==_&&(S(""),e=!0),w["Key Hash"]?C!==w["Key Hash"]&&(L(w["Key Hash"]),s=!0):w["Key Alias"]?Y(w["Key Alias"]):""!==C&&(L(""),s=!0),(e||s)&&b(1)},[w,o,Y,_,C]),(0,i.useEffect)(()=>{b(1)},[_,C,h,M,E,A]),(0,i.useEffect)(()=>{function e(e){p.current&&!p.current.contains(e.target)&&O(!1),j.current&&!j.current.contains(e.target)&&q(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let K=(0,i.useMemo)(()=>F.data?F.data.filter(e=>{var s,a,t,l,r,n,i;let o=!0,d=!0,c=!0,m=!0,u=!0;if(_){let r="string"==typeof e.before_value?null===(s=JSON.parse(e.before_value))||void 0===s?void 0:s.team_id:null===(a=e.before_value)||void 0===a?void 0:a.team_id,n="string"==typeof e.updated_values?null===(t=JSON.parse(e.updated_values))||void 0===t?void 0:t.team_id:null===(l=e.updated_values)||void 0===l?void 0:l.team_id;o=r===_||n===_}if(C)try{let s="string"==typeof e.before_value?JSON.parse(e.before_value):e.before_value,a="string"==typeof e.updated_values?JSON.parse(e.updated_values):e.updated_values,t=null==s?void 0:s.token,l=null==a?void 0:a.token;d="string"==typeof t&&t.includes(C)||"string"==typeof l&&l.includes(C)}catch(e){d=!1}if(M&&(c=null===(r=e.object_id)||void 0===r?void 0:r.toLowerCase().includes(M.toLowerCase())),"all"!==E&&(m=(null===(n=e.action)||void 0===n?void 0:n.toLowerCase())===E.toLowerCase()),"all"!==A){let s="";switch(A){case"keys":s="litellm_verificationtoken";break;case"teams":s="litellm_teamtable";break;case"users":s="litellm_usertable";break;default:s=A}u=(null===(i=e.table_name)||void 0===i?void 0:i.toLowerCase())===s}return o&&d&&c&&m&&u}):[],[F.data,_,C,M,E,A]),P=K.length,Z=Math.ceil(P/N)||1,U=(0,i.useMemo)(()=>{let e=(v-1)*N,s=e+N;return K.slice(e,s)},[K,v,N]),V=!F.data||0===F.data.length,B=(0,i.useCallback)(e=>{let{row:s}=e;return(0,t.jsx)(e=>{let{rowData:s}=e,{before_value:a,updated_values:l,table_name:r,action:n}=s,i=(e,s)=>{if(!e||0===Object.keys(e).length)return(0,t.jsx)(ed.x,{children:"N/A"});if(s){let s=Object.keys(e),a=["token","spend","max_budget"];if(s.every(e=>a.includes(e))&&s.length>0)return(0,t.jsxs)("div",{children:[s.includes("token")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Token:"})," ",e.token||"N/A"]}),s.includes("spend")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Spend:"})," ",void 0!==e.spend?"$".concat((0,f.pw)(e.spend,6)):"N/A"]}),s.includes("max_budget")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Max Budget:"})," ",void 0!==e.max_budget?"$".concat((0,f.pw)(e.max_budget,6)):"N/A"]})]});if(e["No differing fields detected in 'before' state"]||e["No differing fields detected in 'updated' state"]||e["No fields changed"])return(0,t.jsx)(ed.x,{children:e[Object.keys(e)[0]]})}return(0,t.jsx)("pre",{className:"p-2 bg-gray-50 border rounded text-xs overflow-auto max-h-60",children:JSON.stringify(e,null,2)})},o=a,d=l;if(("updated"===n||"rotated"===n)&&a&&l&&("LiteLLM_TeamTable"===r||"LiteLLM_UserTable"===r||"LiteLLM_VerificationToken"===r)){let e={},s={};new Set([...Object.keys(a),...Object.keys(l)]).forEach(t=>{JSON.stringify(a[t])!==JSON.stringify(l[t])&&(a.hasOwnProperty(t)&&(e[t]=a[t]),l.hasOwnProperty(t)&&(s[t]=l[t]))}),Object.keys(a).forEach(t=>{l.hasOwnProperty(t)||e.hasOwnProperty(t)||(e[t]=a[t],s[t]=void 0)}),Object.keys(l).forEach(t=>{a.hasOwnProperty(t)||s.hasOwnProperty(t)||(s[t]=l[t],e[t]=void 0)}),o=Object.keys(e).length>0?e:{"No differing fields detected in 'before' state":"N/A"},d=Object.keys(s).length>0?s:{"No differing fields detected in 'updated' state":"N/A"},0===Object.keys(e).length&&0===Object.keys(s).length&&(o={"No fields changed":"N/A"},d={"No fields changed":"N/A"})}return(0,t.jsxs)("div",{className:"-mx-4 p-4 bg-slate-100 border-y border-slate-300 grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold mb-2 text-sm text-slate-700",children:"Before Value:"}),i(o,"LiteLLM_VerificationToken"===r)]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold mb-2 text-sm text-slate-700",children:"Updated Value:"}),i(d,"LiteLLM_VerificationToken"===r)]})]})},{rowData:s.original})},[]);if(!u)return(0,t.jsxs)("div",{style:{textAlign:"center",marginTop:"20px"},children:[(0,t.jsx)("h1",{style:{display:"block",marginBottom:"10px"},children:"✨ Enterprise Feature."}),(0,t.jsx)(ed.x,{style:{display:"block",marginBottom:"10px"},children:"This is a LiteLLM Enterprise feature, and requires a valid key to use."}),(0,t.jsx)(ed.x,{style:{display:"block",marginBottom:"20px",fontStyle:"italic"},children:"Here's a preview of what Audit Logs offer:"}),(0,t.jsx)("img",{src:ec,alt:"Audit Logs Preview",style:{maxWidth:"100%",maxHeight:"700px",borderRadius:"8px",boxShadow:"0 4px 8px rgba(0,0,0,0.1)",margin:"0 auto"},onError:e=>{console.error("Failed to load audit logs preview image"),e.target.style.display="none"}})]});let W=P>0?(v-1)*N+1:0,z=Math.min(v*N,P);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4"}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsxs)("div",{className:"border-b px-6 py-4",children:[(0,t.jsx)("h1",{className:"text-xl font-semibold py-4",children:"Audit Logs"}),(0,t.jsx)(e=>{let{show:s}=e;return s?(0,t.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 flex items-start mb-6",children:[(0,t.jsx)("div",{className:"text-blue-500 mr-3 flex-shrink-0 mt-0.5",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:"Audit Logs Not Available"}),(0,t.jsx)("p",{className:"text-sm text-blue-700 mt-1",children:"To enable audit logging, add the following configuration to your LiteLLM proxy configuration file:"}),(0,t.jsx)("pre",{className:"mt-2 bg-white p-3 rounded border border-blue-200 text-xs font-mono overflow-auto",children:"litellm_settings:\n store_audit_logs: true"}),(0,t.jsx)("p",{className:"text-xs text-blue-700 mt-2",children:"Note: This will only affect new requests after the configuration change and proxy restart."})]})]}):null},{show:V}),(0,t.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between space-y-4 md:space-y-0",children:[(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsx)("input",{type:"text",placeholder:"Search by Object ID...",value:M,onChange:e=>T(e.target.value),className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})}),(0,t.jsxs)("button",{onClick:()=>{F.refetch()},className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",title:"Refresh data",children:[(0,t.jsx)("svg",{className:"w-4 h-4 ".concat(F.isFetching?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),(0,t.jsx)("span",{children:"Refresh"})]})]})}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("div",{className:"relative",ref:p,children:[(0,t.jsx)("label",{htmlFor:"actionFilterDisplay",className:"mr-2 text-sm font-medium text-gray-700 sr-only",children:"Action:"}),(0,t.jsxs)("button",{id:"actionFilterDisplay",onClick:()=>O(!R),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 bg-white w-40 text-left justify-between",children:[(0,t.jsxs)("span",{children:["all"===E&&"All Actions","created"===E&&"Created","updated"===E&&"Updated","deleted"===E&&"Deleted","rotated"===E&&"Rotated"]}),(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),R&&(0,t.jsx)("div",{className:"absolute left-0 mt-2 w-40 bg-white rounded-lg shadow-lg border p-1 z-50",children:(0,t.jsx)("div",{className:"space-y-1",children:[{label:"All Actions",value:"all"},{label:"Created",value:"created"},{label:"Updated",value:"updated"},{label:"Deleted",value:"deleted"},{label:"Rotated",value:"rotated"}].map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(E===e.value?"bg-blue-50 text-blue-600 font-medium":"font-normal"),onClick:()=>{D(e.value),O(!1)},children:e.label},e.value))})})]}),(0,t.jsxs)("div",{className:"relative",ref:j,children:[(0,t.jsx)("label",{htmlFor:"tableFilterDisplay",className:"mr-2 text-sm font-medium text-gray-700 sr-only",children:"Table:"}),(0,t.jsxs)("button",{id:"tableFilterDisplay",onClick:()=>q(!H),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 bg-white w-40 text-left justify-between",children:[(0,t.jsxs)("span",{children:["all"===A&&"All Tables","keys"===A&&"Keys","teams"===A&&"Teams","users"===A&&"Users"]}),(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),H&&(0,t.jsx)("div",{className:"absolute left-0 mt-2 w-40 bg-white rounded-lg shadow-lg border p-1 z-50",children:(0,t.jsx)("div",{className:"space-y-1",children:[{label:"All Tables",value:"all"},{label:"Keys",value:"keys"},{label:"Teams",value:"teams"},{label:"Users",value:"users"}].map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(A===e.value?"bg-blue-50 text-blue-600 font-medium":"font-normal"),onClick:()=>{I(e.value),q(!1)},children:e.label},e.value))})})]}),(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Showing ",F.isLoading?"...":W," -"," ",F.isLoading?"...":z," of"," ",F.isLoading?"...":P," results"]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",F.isLoading?"...":v," of"," ",F.isLoading?"...":Z]}),(0,t.jsx)("button",{onClick:()=>b(e=>Math.max(1,e-1)),disabled:F.isLoading||1===v,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>b(e=>Math.min(Z,e+1)),disabled:F.isLoading||v===Z,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})]}),(0,t.jsx)(c.w,{columns:y,data:U,renderSubComponent:B,getRowCanExpand:()=>!0})]})]})}let eu=(e,s,a)=>{if(e)return"".concat(r()(s).format("MMM D, h:mm A")," - ").concat(r()(a).format("MMM D, h:mm A"));let t=r()(),l=r()(s),n=t.diff(l,"minutes");if(n>=0&&n<2)return"Last 1 Minute";if(n>=2&&n<16)return"Last 15 Minutes";if(n>=16&&n<61)return"Last Hour";let i=t.diff(l,"hours");return i>=1&&i<5?"Last 4 Hours":i>=5&&i<25?"Last 24 Hours":i>=25&&i<169?"Last 7 Days":"".concat(l.format("MMM D")," - ").concat(t.format("MMM D"))};var ex=a(9309);function eh(e){var s,a,l;let{accessToken:m,token:u,userRole:x,userID:h,allTeams:g,premiumUser:p}=e,[f,j]=(0,i.useState)(""),[b,y]=(0,i.useState)(!1),[w,k]=(0,i.useState)(!1),[_,S]=(0,i.useState)(1),[L]=(0,i.useState)(50),T=(0,i.useRef)(null),E=(0,i.useRef)(null),D=(0,i.useRef)(null),[A,I]=(0,i.useState)(r()().subtract(24,"hours").format("YYYY-MM-DDTHH:mm")),[R,O]=(0,i.useState)(r()().format("YYYY-MM-DDTHH:mm")),[H,F]=(0,i.useState)(!1),[Y,K]=(0,i.useState)(!1),[P,Z]=(0,i.useState)(""),[U,V]=(0,i.useState)(""),[B,W]=(0,i.useState)(""),[z,J]=(0,i.useState)(""),[G,X]=(0,i.useState)(""),[ed,ec]=(0,i.useState)(null),[ex,eh]=(0,i.useState)(null),[ep,ef]=(0,i.useState)(""),[ej,ev]=(0,i.useState)(""),[eb,ey]=(0,i.useState)(x&&C.lo.includes(x)),[eN,ew]=(0,i.useState)("request logs"),[ek,e_]=(0,i.useState)(null),[eS,eC]=(0,i.useState)(null),eL=(0,o.NL)(),[eM,eT]=(0,i.useState)(()=>{let e=sessionStorage.getItem("isLiveTail");return null===e||JSON.parse(e)});(0,i.useEffect)(()=>{sessionStorage.setItem("isLiveTail",JSON.stringify(eM))},[eM]);let[eE,eD]=(0,i.useState)({value:24,unit:"hours"});(0,i.useEffect)(()=>{(async()=>{ex&&m&&ec({...(await (0,d.keyInfoV1Call)(m,ex)).info,token:ex,api_key:ex})})()},[ex,m]),(0,i.useEffect)(()=>{function e(e){T.current&&!T.current.contains(e.target)&&k(!1),E.current&&!E.current.contains(e.target)&&y(!1),D.current&&!D.current.contains(e.target)&&K(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,i.useEffect)(()=>{x&&C.lo.includes(x)&&ey(!0)},[x]);let eA=(0,n.a)({queryKey:["logs","table",_,L,A,R,B,z,eb?h:null,ep,G],queryFn:async()=>{if(!m||!u||!x||!h)return{data:[],total:0,page:1,page_size:L,total_pages:0};let e=r()(A).utc().format("YYYY-MM-DD HH:mm:ss"),s=H?r()(R).utc().format("YYYY-MM-DD HH:mm:ss"):r()().utc().format("YYYY-MM-DD HH:mm:ss"),a=await (0,d.uiSpendLogsCall)(m,z||void 0,B||void 0,void 0,e,s,_,L,eb?h:void 0,ej,ep,G);return await N(a.data,e,m,eL),a.data=a.data.map(s=>{let a=eL.getQueryData(["logDetails",s.request_id,e]);return(null==a?void 0:a.messages)&&(null==a?void 0:a.response)&&(s.messages=a.messages,s.response=a.response),s}),a},enabled:!!m&&!!u&&!!x&&!!h&&"request logs"===eN,refetchInterval:!!eM&&1===_&&15e3,refetchIntervalInBackground:!0}),{filters:eI,filteredLogs:eR,allTeams:eO,allKeyAliases:eH,handleFilterChange:eq,handleFilterReset:eF}=function(e){let{logs:s,accessToken:a,startTime:t,endTime:l,pageSize:o=es.d,isCustomDate:c,setCurrentPage:m,userID:u,userRole:x}=e,h=(0,i.useMemo)(()=>({[ea.TEAM_ID]:"",[ea.KEY_HASH]:"",[ea.REQUEST_ID]:"",[ea.MODEL]:"",[ea.USER_ID]:"",[ea.END_USER]:"",[ea.STATUS]:"",[ea.KEY_ALIAS]:""}),[]),[g,p]=(0,i.useState)(h),[f,j]=(0,i.useState)({data:[],total:0,page:1,page_size:50,total_pages:0}),v=(0,i.useRef)(0),b=(0,i.useCallback)(async function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!a)return;console.log("Filters being sent to API:",e);let n=Date.now();v.current=n;let i=r()(t).utc().format("YYYY-MM-DD HH:mm:ss"),m=c?r()(l).utc().format("YYYY-MM-DD HH:mm:ss"):r()().utc().format("YYYY-MM-DD HH:mm:ss");try{let t=await (0,d.uiSpendLogsCall)(a,e[ea.KEY_HASH]||void 0,e[ea.TEAM_ID]||void 0,e[ea.REQUEST_ID]||void 0,i,m,s,o,e[ea.USER_ID]||void 0,e[ea.END_USER]||void 0,e[ea.STATUS]||void 0,e[ea.MODEL]||void 0,e[ea.KEY_ALIAS]||void 0);n===v.current&&t.data&&j(t)}catch(e){console.error("Error searching users:",e)}},[a,t,l,c,o]),y=(0,i.useMemo)(()=>ee()((e,s)=>b(e,s),300),[b]);(0,i.useEffect)(()=>()=>y.cancel(),[y]);let N=(0,n.a)({queryKey:["allKeys"],queryFn:async()=>{if(!a)throw Error("Access token required");return await (0,$.LO)(a)},enabled:!!a}).data||[],w=(0,i.useMemo)(()=>!!(g[ea.KEY_ALIAS]||g[ea.KEY_HASH]||g[ea.REQUEST_ID]||g[ea.USER_ID]||g[ea.END_USER]),[g]),k=(0,i.useMemo)(()=>{if(!s||!s.data)return{data:[],total:0,page:1,page_size:50,total_pages:0};if(w)return s;let e=[...s.data];return g[ea.TEAM_ID]&&(e=e.filter(e=>e.team_id===g[ea.TEAM_ID])),g[ea.STATUS]&&(e=e.filter(e=>"success"===g[ea.STATUS]?!e.status||"success"===e.status:e.status===g[ea.STATUS])),g[ea.MODEL]&&(e=e.filter(e=>e.model===g[ea.MODEL])),g[ea.KEY_HASH]&&(e=e.filter(e=>e.api_key===g[ea.KEY_HASH])),g[ea.END_USER]&&(e=e.filter(e=>e.end_user===g[ea.END_USER])),{data:e,total:s.total,page:s.page,page_size:s.page_size,total_pages:s.total_pages}},[s,g,w]),_=(0,i.useMemo)(()=>w?f&&f.data&&f.data.length>0?f:s||{data:[],total:0,page:1,page_size:50,total_pages:0}:k,[w,f,k,s]),{data:S}=(0,n.a)({queryKey:["allTeamsForLogFilters",a],queryFn:async()=>a&&await (0,$.IE)(a)||[],enabled:!!a});return{filters:g,filteredLogs:_,allKeyAliases:N,allTeams:S,handleFilterChange:e=>{p(s=>{let a={...s,...e};for(let e of Object.keys(h))e in a||(a[e]=h[e]);return JSON.stringify(a)!==JSON.stringify(s)&&(m(1),y(a,1)),a})},handleFilterReset:()=>{p(h),j({data:[],total:0,page:1,page_size:50,total_pages:0}),y(h,1)}}}({logs:eA.data||{data:[],total:0,page:1,page_size:L||10,total_pages:1},accessToken:m,startTime:A,endTime:R,pageSize:L,isCustomDate:H,setCurrentPage:S,userID:h,userRole:x}),eY=(0,i.useCallback)(async e=>{if(m)try{let s=(await (0,d.keyListCall)(m,null,null,e,null,null,_,L)).keys.find(s=>s.key_alias===e);s&&J(s.token)}catch(e){console.error("Error fetching key hash for alias:",e)}},[m,_,L]);(0,i.useEffect)(()=>{m&&(eI["Team ID"]?W(eI["Team ID"]):W(""),ef(eI.Status||""),X(eI.Model||""),ev(eI["End User"]||""),eI["Key Hash"]?J(eI["Key Hash"]):eI["Key Alias"]?eY(eI["Key Alias"]):J(""))},[eI,m,eY]);let eK=(0,n.a)({queryKey:["sessionLogs",eS],queryFn:async()=>{if(!m||!eS)return{data:[],total:0,page:1,page_size:50,total_pages:1};let e=await (0,d.sessionSpendLogsCall)(m,eS);return{data:e.data||e||[],total:(e.data||e||[]).length,page:1,page_size:1e3,total_pages:1}},enabled:!!m&&!!eS});if((0,i.useEffect)(()=>{var e;(null===(e=eA.data)||void 0===e?void 0:e.data)&&ek&&!eA.data.data.some(e=>e.request_id===ek)&&e_(null)},[null===(s=eA.data)||void 0===s?void 0:s.data,ek]),!m||!u||!x||!h)return null;let eP=eR.data.filter(e=>!f||e.request_id.includes(f)||e.model.includes(f)||e.user&&e.user.includes(f)).map(e=>({...e,duration:(Date.parse(e.endTime)-Date.parse(e.startTime))/1e3,onKeyHashClick:e=>eh(e),onSessionClick:e=>{e&&eC(e)}}))||[],eZ=(null===(l=eK.data)||void 0===l?void 0:null===(a=l.data)||void 0===a?void 0:a.map(e=>({...e,onKeyHashClick:e=>eh(e),onSessionClick:e=>{}})))||[],eU=[{name:"Team ID",label:"Team ID",isSearchable:!0,searchFn:async e=>g&&0!==g.length?g.filter(s=>s.team_id.toLowerCase().includes(e.toLowerCase())||s.team_alias&&s.team_alias.toLowerCase().includes(e.toLowerCase())).map(e=>({label:"".concat(e.team_alias||e.team_id," (").concat(e.team_id,")"),value:e.team_id})):[]},{name:"Status",label:"Status",isSearchable:!1,options:[{label:"Success",value:"success"},{label:"Failure",value:"failure"}]},{name:"Model",label:"Model",isSearchable:!1},{name:"Key Alias",label:"Key Alias",isSearchable:!0,searchFn:async e=>m?(await (0,$.LO)(m)).filter(s=>s.toLowerCase().includes(e.toLowerCase())).map(e=>({label:e,value:e})):[]},{name:"End User",label:"End User",isSearchable:!0,searchFn:async e=>{if(!m)return[];let s=await (0,d.allEndUsersCall)(m);return((null==s?void 0:s.map(e=>e.user_id))||[]).filter(s=>s.toLowerCase().includes(e.toLowerCase())).map(e=>({label:e,value:e}))}},{name:"Key Hash",label:"Key Hash",isSearchable:!1}];if(eS&&eK.data)return(0,t.jsx)("div",{className:"w-full p-6",children:(0,t.jsx)(q,{sessionId:eS,logs:eK.data.data,onBack:()=>eC(null)})});let eV=[{label:"Last 15 Minutes",value:15,unit:"minutes"},{label:"Last Hour",value:1,unit:"hours"},{label:"Last 4 Hours",value:4,unit:"hours"},{label:"Last 24 Hours",value:24,unit:"hours"},{label:"Last 7 Days",value:7,unit:"days"}],eB=eV.find(e=>e.value===eE.value&&e.unit===eE.unit),eW=H?eu(H,A,R):null==eB?void 0:eB.label;return(0,t.jsx)("div",{className:"w-full max-w-screen p-6 overflow-x-hidden box-border",children:(0,t.jsxs)(er.Z,{defaultIndex:0,onIndexChange:e=>ew(0===e?"request logs":"audit logs"),children:[(0,t.jsxs)(en.Z,{children:[(0,t.jsx)(el.Z,{children:"Request Logs"}),(0,t.jsx)(el.Z,{children:"Audit Logs"})]}),(0,t.jsxs)(eo.Z,{children:[(0,t.jsxs)(ei.Z,{children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,t.jsx)("h1",{className:"text-xl font-semibold",children:eS?(0,t.jsxs)(t.Fragment,{children:["Session: ",(0,t.jsx)("span",{className:"font-mono",children:eS}),(0,t.jsx)("button",{className:"ml-4 px-3 py-1 text-sm border rounded hover:bg-gray-50",onClick:()=>eC(null),children:"← Back to All Logs"})]}):"Request Logs"})}),ed&&ex&&ed.api_key===ex?(0,t.jsx)(M.Z,{keyId:ex,keyData:ed,accessToken:m,userID:h,userRole:x,teams:g,onClose:()=>eh(null),premiumUser:p,backButtonText:"Back to Logs"}):eS?(0,t.jsx)("div",{className:"bg-white rounded-lg shadow",children:(0,t.jsx)(c.w,{columns:v,data:eZ,renderSubComponent:eg,getRowCanExpand:()=>!0})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Q.Z,{options:eU,onApplyFilters:eq,onResetFilters:eF}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full box-border",children:[(0,t.jsx)("div",{className:"border-b px-6 py-4 w-full max-w-full box-border",children:(0,t.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between space-y-4 md:space-y-0 w-full max-w-full box-border",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 w-full max-w-full box-border",children:[(0,t.jsxs)("div",{className:"relative w-64 min-w-0 flex-shrink-0",children:[(0,t.jsx)("input",{type:"text",placeholder:"Search by Request ID",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:f,onChange:e=>j(e.target.value)}),(0,t.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-shrink",children:[(0,t.jsxs)("div",{className:"relative z-50",ref:D,children:[(0,t.jsxs)("button",{onClick:()=>K(!Y),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",children:[(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),eW]}),Y&&(0,t.jsx)("div",{className:"absolute right-0 mt-2 w-64 bg-white rounded-lg shadow-lg border p-2 z-50",children:(0,t.jsxs)("div",{className:"space-y-1",children:[eV.map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(eW===e.label?"bg-blue-50 text-blue-600":""),onClick:()=>{O(r()().format("YYYY-MM-DDTHH:mm")),I(r()().subtract(e.value,e.unit).format("YYYY-MM-DDTHH:mm")),eD({value:e.value,unit:e.unit}),F(!1),K(!1)},children:e.label},e.label)),(0,t.jsx)("div",{className:"border-t my-2"}),(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(H?"bg-blue-50 text-blue-600":""),onClick:()=>F(!H),children:"Custom Range"})]})})]}),(0,t.jsx)(()=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900",children:"Live Tail"}),(0,t.jsx)(et.Z,{color:"green",checked:eM,defaultChecked:!0,onChange:eT})]}),{}),(0,t.jsxs)("button",{onClick:()=>{eA.refetch()},className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",title:"Refresh data",children:[(0,t.jsx)("svg",{className:"w-4 h-4 ".concat(eA.isFetching?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),(0,t.jsx)("span",{children:"Refresh"})]})]}),H&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"datetime-local",value:A,onChange:e=>{I(e.target.value),S(1)},className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})}),(0,t.jsx)("span",{className:"text-gray-500",children:"to"}),(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"datetime-local",value:R,onChange:e=>{O(e.target.value),S(1)},className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})})]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700 whitespace-nowrap",children:["Showing ",eA.isLoading?"...":eR?(_-1)*L+1:0," -"," ",eA.isLoading?"...":eR?Math.min(_*L,eR.total):0," ","of ",eA.isLoading?"...":eR?eR.total:0," results"]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700 min-w-[90px]",children:["Page ",eA.isLoading?"...":_," of"," ",eA.isLoading?"...":eR?eR.total_pages:1]}),(0,t.jsx)("button",{onClick:()=>S(e=>Math.max(1,e-1)),disabled:eA.isLoading||1===_,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>S(e=>Math.min(eR.total_pages||1,e+1)),disabled:eA.isLoading||_===(eR.total_pages||1),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})}),eM&&1===_&&(0,t.jsxs)("div",{className:"mb-4 px-4 py-2 bg-green-50 border border-greem-200 rounded-md flex items-center justify-between",children:[(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)("span",{className:"text-sm text-green-700",children:"Auto-refreshing every 15 seconds"})}),(0,t.jsx)("button",{onClick:()=>eT(!1),className:"text-sm text-green-600 hover:text-green-800",children:"Stop"})]}),(0,t.jsx)(c.w,{columns:v,data:eP,renderSubComponent:eg,getRowCanExpand:()=>!0})]})]})]}),(0,t.jsx)(ei.Z,{children:(0,t.jsx)(em,{userID:h,userRole:x,token:u,accessToken:m,isActive:"audit logs"===eN,premiumUser:p,allTeams:g})})]})]})})}function eg(e){var s,a,l,r,n,i,o,d,c,m;let{row:x}=e,h=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){}return e},g=x.original.metadata||{},p="failure"===g.status,j=p?g.error_information:null,v=x.original.messages&&(Array.isArray(x.original.messages)?x.original.messages.length>0:Object.keys(x.original.messages).length>0),b=x.original.response&&Object.keys(h(x.original.response)).length>0,y=g.vector_store_request_metadata&&Array.isArray(g.vector_store_request_metadata)&&g.vector_store_request_metadata.length>0,N=null===(s=x.original.metadata)||void 0===s?void 0:s.guardrail_information,w=Array.isArray(N)?N:N?[N]:[],k=w.length>0,C=w.reduce((e,s)=>{let a=null==s?void 0:s.masked_entity_count;return a?e+Object.values(a).reduce((e,s)=>"number"==typeof s?e+s:e,0):e},0),M=1===w.length?null!==(m=null===(a=w[0])||void 0===a?void 0:a.guardrail_name)&&void 0!==m?m:"-":w.length>1?"".concat(w.length," guardrails"):"-",T=(0,ex.aS)(x.original.request_id,64);return(0,t.jsxs)("div",{className:"p-6 bg-gray-50 space-y-6 w-full max-w-full overflow-hidden box-border",children:[(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsx)("div",{className:"p-4 border-b",children:(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request Details"})}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 p-4 w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Request ID:"}),x.original.request_id.length>64?(0,t.jsx)(u.Z,{title:x.original.request_id,children:(0,t.jsx)("span",{className:"font-mono text-sm",children:T})}):(0,t.jsx)("span",{className:"font-mono text-sm",children:x.original.request_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Model:"}),(0,t.jsx)("span",{children:x.original.model})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Model ID:"}),(0,t.jsx)("span",{children:x.original.model_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Call Type:"}),(0,t.jsx)("span",{children:x.original.call_type})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Provider:"}),(0,t.jsx)("span",{children:x.original.custom_llm_provider||"-"})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"API Base:"}),(0,t.jsx)(u.Z,{title:x.original.api_base||"-",children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:x.original.api_base||"-"})})]}),(null==x?void 0:null===(l=x.original)||void 0===l?void 0:l.requester_ip_address)&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"IP Address:"}),(0,t.jsx)("span",{children:null==x?void 0:null===(r=x.original)||void 0===r?void 0:r.requester_ip_address})]}),k&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Guardrail:"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-mono",children:M}),C>0&&(0,t.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[C," masked"]})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Tokens:"}),(0,t.jsxs)("span",{children:[x.original.total_tokens," (",x.original.prompt_tokens," prompt tokens +"," ",x.original.completion_tokens," completion tokens)"]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Read Tokens:"}),(0,t.jsx)("span",{children:(0,f.pw)((null===(i=x.original.metadata)||void 0===i?void 0:null===(n=i.additional_usage_values)||void 0===n?void 0:n.cache_read_input_tokens)||0)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Creation Tokens:"}),(0,t.jsx)("span",{children:(0,f.pw)(null===(o=x.original.metadata)||void 0===o?void 0:o.additional_usage_values.cache_creation_input_tokens)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cost:"}),(0,t.jsxs)("span",{children:["$",(0,f.pw)(x.original.spend||0,6)]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Hit:"}),(0,t.jsx)("span",{children:x.original.cache_hit})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Status:"}),(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block text-center w-16 ".concat("failure"!==((null===(d=x.original.metadata)||void 0===d?void 0:d.status)||"Success").toLowerCase()?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:"failure"!==((null===(c=x.original.metadata)||void 0===c?void 0:c.status)||"Success").toLowerCase()?"Success":"Failure"})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:x.original.startTime})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:x.original.endTime})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsxs)("span",{children:[x.original.duration," s."]})]})]})]})]}),(0,t.jsx)(L,{show:!v&&!b}),(0,t.jsx)("div",{className:"w-full max-w-full overflow-hidden",children:(0,t.jsx)(_,{row:x,hasMessages:v,hasResponse:b,hasError:p,errorInfo:j,getRawRequest:()=>{var e;return(null===(e=x.original)||void 0===e?void 0:e.proxy_server_request)?h(x.original.proxy_server_request):h(x.original.messages)},formattedResponse:()=>p&&j?{error:{message:j.error_message||"An error occurred",type:j.error_class||"error",code:j.error_code||"unknown",param:null}}:h(x.original.response)})}),k&&(0,t.jsx)(G,{data:N}),y&&(0,t.jsx)(F,{data:g.vector_store_request_metadata}),p&&j&&(0,t.jsx)(S,{errorInfo:j}),x.original.request_tags&&Object.keys(x.original.request_tags).length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"flex justify-between items-center p-4 border-b",children:(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request Tags"})}),(0,t.jsx)("div",{className:"p-4",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(x.original.request_tags).map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded-full text-xs",children:[s,": ",String(a)]},s)})})})]}),x.original.metadata&&Object.keys(x.original.metadata).length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Metadata"}),(0,t.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(JSON.stringify(x.original.metadata,null,2))},className:"p-1 hover:bg-gray-200 rounded",title:"Copy metadata",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),(0,t.jsx)("div",{className:"p-4 overflow-auto max-h-64",children:(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all",children:JSON.stringify(x.original.metadata,null,2)})})]})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4292-c551871b8fc9bf85.js b/litellm/proxy/_experimental/out/_next/static/chunks/4292-a3e9c22c4ffc7d9a.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/4292-c551871b8fc9bf85.js rename to litellm/proxy/_experimental/out/_next/static/chunks/4292-a3e9c22c4ffc7d9a.js index 2bd58db412..c7cef8a881 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/4292-c551871b8fc9bf85.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/4292-a3e9c22c4ffc7d9a.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4292],{84717:function(e,s,a){a.d(s,{Ct:function(){return t.Z},Dx:function(){return x.Z},OK:function(){return n.Z},Zb:function(){return r.Z},nP:function(){return m.Z},rj:function(){return i.Z},td:function(){return o.Z},v0:function(){return d.Z},x4:function(){return c.Z},xv:function(){return u.Z},zx:function(){return l.Z}});var t=a(41649),l=a(78489),r=a(12514),i=a(67101),n=a(12485),d=a(18135),o=a(35242),c=a(29706),m=a(77991),u=a(84264),x=a(96761)},40728:function(e,s,a){a.d(s,{C:function(){return t.Z},x:function(){return l.Z}});var t=a(41649),l=a(84264)},16721:function(e,s,a){a.d(s,{Dx:function(){return d.Z},JX:function(){return l.Z},oi:function(){return n.Z},rj:function(){return r.Z},xv:function(){return i.Z},zx:function(){return t.Z}});var t=a(78489),l=a(49804),r=a(67101),i=a(84264),n=a(49566),d=a(96761)},64504:function(e,s,a){a.d(s,{o:function(){return l.Z},z:function(){return t.Z}});var t=a(78489),l=a(49566)},67479:function(e,s,a){var t=a(57437),l=a(2265),r=a(37592),i=a(19250);s.Z=e=>{let{onChange:s,value:a,className:n,accessToken:d,disabled:o}=e,[c,m]=(0,l.useState)([]),[u,x]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{(async()=>{if(d){x(!0);try{let e=await (0,i.getGuardrailsList)(d);console.log("Guardrails response:",e),e.guardrails&&(console.log("Guardrails data:",e.guardrails),m(e.guardrails))}catch(e){console.error("Error fetching guardrails:",e)}finally{x(!1)}}})()},[d]),(0,t.jsx)("div",{children:(0,t.jsx)(r.default,{mode:"multiple",disabled:o,placeholder:o?"Setting guardrails is a premium feature.":"Select guardrails",onChange:e=>{console.log("Selected guardrails:",e),s(e)},value:a,loading:u,className:n,options:c.map(e=>(console.log("Mapping guardrail:",e),{label:"".concat(e.guardrail_name),value:e.guardrail_name})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})}},27799:function(e,s,a){var t=a(57437);a(2265);var l=a(40728),r=a(82182),i=a(91777),n=a(97434);s.Z=function(e){let{loggingConfigs:s=[],disabledCallbacks:a=[],variant:d="card",className:o=""}=e,c=e=>{var s;return(null===(s=Object.entries(n.Lo).find(s=>{let[a,t]=s;return t===e}))||void 0===s?void 0:s[0])||e},m=e=>{switch(e){case"success":return"green";case"failure":return"red";case"success_and_failure":return"blue";default:return"gray"}},u=e=>{switch(e){case"success":return"Success Only";case"failure":return"Failure Only";case"success_and_failure":return"Success & Failure";default:return e}},x=(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(r.Z,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Logging Integrations"}),(0,t.jsx)(l.C,{color:"blue",size:"xs",children:s.length})]}),s.length>0?(0,t.jsx)("div",{className:"space-y-3",children:s.map((e,s)=>{var a;let i=c(e.callback_name),d=null===(a=n.Dg[i])||void 0===a?void 0:a.logo;return(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-blue-50 border border-blue-200",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[d?(0,t.jsx)("img",{src:d,alt:i,className:"w-5 h-5 object-contain"}):(0,t.jsx)(r.Z,{className:"h-5 w-5 text-gray-400"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(l.x,{className:"font-medium text-blue-800",children:i}),(0,t.jsxs)(l.x,{className:"text-xs text-blue-600",children:[Object.keys(e.callback_vars).length," parameters configured"]})]})]}),(0,t.jsx)(l.C,{color:m(e.callback_type),size:"sm",children:u(e.callback_type)})]},s)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(r.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(l.x,{className:"text-gray-500 text-sm",children:"No logging integrations configured"})]})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(i.Z,{className:"h-4 w-4 text-red-600"}),(0,t.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Disabled Callbacks"}),(0,t.jsx)(l.C,{color:"red",size:"xs",children:a.length})]}),a.length>0?(0,t.jsx)("div",{className:"space-y-3",children:a.map((e,s)=>{var a;let r=n.RD[e]||e,d=null===(a=n.Dg[r])||void 0===a?void 0:a.logo;return(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-red-50 border border-red-200",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[d?(0,t.jsx)("img",{src:d,alt:r,className:"w-5 h-5 object-contain"}):(0,t.jsx)(i.Z,{className:"h-5 w-5 text-gray-400"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(l.x,{className:"font-medium text-red-800",children:r}),(0,t.jsx)(l.x,{className:"text-xs text-red-600",children:"Disabled for this key"})]})]}),(0,t.jsx)(l.C,{color:"red",size:"sm",children:"Disabled"})]},s)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(i.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(l.x,{className:"text-gray-500 text-sm",children:"No callbacks disabled"})]})]})]});return"card"===d?(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(o),children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Logging Settings"}),(0,t.jsx)(l.x,{className:"text-xs text-gray-500",children:"Active logging integrations and disabled callbacks for this key"})]})}),x]}):(0,t.jsxs)("div",{className:"".concat(o),children:[(0,t.jsx)(l.x,{className:"font-medium text-gray-900 mb-3",children:"Logging Settings"}),x]})}},60131:function(e,s,a){a.d(s,{Z:function(){return j}});var t=a(57437),l=a(2265),r=a(92280),i=a(40728),n=a(79814),d=a(19250),o=function(e){let{vectorStores:s,accessToken:a}=e,[r,o]=(0,l.useState)([]);(0,l.useEffect)(()=>{(async()=>{if(a&&0!==s.length)try{let e=await (0,d.vectorStoreListCall)(a);e.data&&o(e.data.map(e=>({vector_store_id:e.vector_store_id,vector_store_name:e.vector_store_name})))}catch(e){console.error("Error fetching vector stores:",e)}})()},[a,s.length]);let c=e=>{let s=r.find(s=>s.vector_store_id===e);return s?"".concat(s.vector_store_name||s.vector_store_id," (").concat(s.vector_store_id,")"):e};return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(n.Z,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(i.x,{className:"font-semibold text-gray-900",children:"Vector Stores"}),(0,t.jsx)(i.C,{color:"blue",size:"xs",children:s.length})]}),s.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map((e,s)=>(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-sm font-medium",children:c(e)},s))}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(n.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(i.x,{className:"text-gray-500 text-sm",children:"No vector stores configured"})]})]})},c=a(25327),m=a(86462),u=a(47686),x=a(99981),g=function(e){let{mcpServers:s,mcpAccessGroups:r=[],mcpToolPermissions:n={},accessToken:o}=e,[g,h]=(0,l.useState)([]),[p,j]=(0,l.useState)([]),[v,b]=(0,l.useState)(new Set),y=e=>{b(s=>{let a=new Set(s);return a.has(e)?a.delete(e):a.add(e),a})};(0,l.useEffect)(()=>{(async()=>{if(o&&s.length>0)try{let e=await (0,d.fetchMCPServers)(o);e&&Array.isArray(e)?h(e):e.data&&Array.isArray(e.data)&&h(e.data)}catch(e){console.error("Error fetching MCP servers:",e)}})()},[o,s.length]),(0,l.useEffect)(()=>{(async()=>{if(o&&r.length>0)try{let e=await Promise.resolve().then(a.bind(a,19250)).then(e=>e.fetchMCPAccessGroups(o));j(Array.isArray(e)?e:e.data||[])}catch(e){console.error("Error fetching MCP access groups:",e)}})()},[o,r.length]);let _=e=>{let s=g.find(s=>s.server_id===e);if(s){let a=e.length>7?"".concat(e.slice(0,3),"...").concat(e.slice(-4)):e;return"".concat(s.alias," (").concat(a,")")}return e},f=e=>e,N=[...s.map(e=>({type:"server",value:e})),...r.map(e=>({type:"accessGroup",value:e}))],k=N.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(c.Z,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(i.x,{className:"font-semibold text-gray-900",children:"MCP Servers"}),(0,t.jsx)(i.C,{color:"blue",size:"xs",children:k})]}),k>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:N.map((e,s)=>{let a="server"===e.type?n[e.value]:void 0,l=a&&a.length>0,r=v.has(e.value);return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{onClick:()=>l&&y(e.value),className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 transition-all ".concat(l?"cursor-pointer hover:bg-gray-50 hover:border-gray-300":"bg-white"),children:[(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"server"===e.type?(0,t.jsx)(x.Z,{title:"Full ID: ".concat(e.value),placement:"top",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-blue-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:_(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:f(e.value)}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})}),l&&(0,t.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 whitespace-nowrap",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-600",children:a.length}),(0,t.jsx)("span",{className:"text-xs text-gray-500",children:1===a.length?"tool":"tools"}),r?(0,t.jsx)(m.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"}):(0,t.jsx)(u.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"})]})]}),l&&r&&(0,t.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-blue-200 pb-1",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.map((e,s)=>(0,t.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-xs font-medium",children:e},s))})})]},s)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(c.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(i.x,{className:"text-gray-500 text-sm",children:"No MCP servers or access groups configured"})]})]})},h=a(3497),p=function(e){let{agents:s,agentAccessGroups:a=[],accessToken:r}=e,[n,o]=(0,l.useState)([]);(0,l.useEffect)(()=>{(async()=>{if(r&&s.length>0)try{let e=await (0,d.getAgentsList)(r);e&&e.agents&&Array.isArray(e.agents)&&o(e.agents)}catch(e){console.error("Error fetching agents:",e)}})()},[r,s.length]);let c=e=>{let s=n.find(s=>s.agent_id===e);if(s){let a=e.length>7?"".concat(e.slice(0,3),"...").concat(e.slice(-4)):e;return"".concat(s.agent_name," (").concat(a,")")}return e},m=[...s.map(e=>({type:"agent",value:e})),...a.map(e=>({type:"accessGroup",value:e}))],u=m.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(h.Z,{className:"h-4 w-4 text-purple-600"}),(0,t.jsx)(i.x,{className:"font-semibold text-gray-900",children:"Agents"}),(0,t.jsx)(i.C,{color:"purple",size:"xs",children:u})]}),u>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:m.map((e,s)=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 bg-white",children:(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"agent"===e.type?(0,t.jsx)(x.Z,{title:"Full ID: ".concat(e.value),placement:"top",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-purple-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:c(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.value}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})})})},s))}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(h.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(i.x,{className:"text-gray-500 text-sm",children:"No agents or access groups configured"})]})]})},j=function(e){let{objectPermission:s,variant:a="card",className:l="",accessToken:i}=e,n=(null==s?void 0:s.vector_stores)||[],d=(null==s?void 0:s.mcp_servers)||[],c=(null==s?void 0:s.mcp_access_groups)||[],m=(null==s?void 0:s.mcp_tool_permissions)||{},u=(null==s?void 0:s.agents)||[],x=(null==s?void 0:s.agent_access_groups)||[],h=(0,t.jsxs)("div",{className:"card"===a?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6":"space-y-4",children:[(0,t.jsx)(o,{vectorStores:n,accessToken:i}),(0,t.jsx)(g,{mcpServers:d,mcpAccessGroups:c,mcpToolPermissions:m,accessToken:i}),(0,t.jsx)(p,{agents:u,agentAccessGroups:x,accessToken:i})]});return"card"===a?(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(l),children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(r.x,{className:"font-semibold text-gray-900",children:"Object Permissions"}),(0,t.jsx)(r.x,{className:"text-xs text-gray-500",children:"Access control for Vector Stores and MCP Servers"})]})}),h]}):(0,t.jsxs)("div",{className:"".concat(l),children:[(0,t.jsx)(r.x,{className:"font-medium text-gray-900 mb-3",children:"Object Permissions"}),h]})}},21425:function(e,s,a){var t=a(57437);a(2265);var l=a(54507);s.Z=e=>{let{value:s,onChange:a,disabledCallbacks:r=[],onDisabledCallbacksChange:i}=e;return(0,t.jsx)(l.Z,{value:s,onChange:a,disabledCallbacks:r,onDisabledCallbacksChange:i})}},94292:function(e,s,a){a.d(s,{Z:function(){return es}});var t=a(57437),l=a(59872),r=a(33304),i=a(77331),n=a(23628),d=a(74998),o=a(84717),c=a(10032),m=a(5545),u=a(99981),x=a(30401),g=a(78867),h=a(2265),p=a(20347),j=a(97434),v=a(40728),b=a(58710),y=e=>{let{autoRotate:s=!1,rotationInterval:a,lastRotationAt:l,keyRotationAt:r,nextRotationAt:i,variant:d="card",className:o=""}=e,c=e=>{let s=new Date(e),a=s.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),t=s.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return"".concat(a," at ").concat(t)},m=(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)("div",{className:"space-y-3",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(n.Z,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(v.x,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,t.jsx)(v.C,{color:s?"green":"gray",size:"xs",children:s?"Enabled":"Disabled"}),s&&a&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(v.x,{className:"text-gray-400",children:"•"}),(0,t.jsxs)(v.x,{className:"text-sm text-gray-600",children:["Every ",a]})]})]})}),(s||l||r||i)&&(0,t.jsxs)("div",{className:"space-y-3",children:[l&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-200 rounded-md",children:[(0,t.jsx)(b.Z,{className:"w-4 h-4 text-gray-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(v.x,{className:"font-medium text-gray-700",children:"Last Rotation"}),(0,t.jsx)(v.x,{className:"text-sm text-gray-600",children:c(l)})]})]}),(r||i)&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-200 rounded-md",children:[(0,t.jsx)(b.Z,{className:"w-4 h-4 text-gray-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(v.x,{className:"font-medium text-gray-700",children:"Next Scheduled Rotation"}),(0,t.jsx)(v.x,{className:"text-sm text-gray-600",children:c(i||r||"")})]})]}),s&&!l&&!r&&!i&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-100 rounded-md",children:[(0,t.jsx)(b.Z,{className:"w-4 h-4 text-gray-500"}),(0,t.jsx)(v.x,{className:"text-gray-600",children:"No rotation history available"})]})]}),!s&&!l&&!r&&!i&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-100 rounded-md",children:[(0,t.jsx)(n.Z,{className:"w-4 h-4 text-gray-400"}),(0,t.jsx)(v.x,{className:"text-gray-600",children:"Auto-rotation is not enabled for this key"})]})]});return"card"===d?(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(o),children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(v.x,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,t.jsx)(v.x,{className:"text-xs text-gray-500",children:"Automatic key rotation settings and status for this key"})]})}),m]}):(0,t.jsxs)("div",{className:"".concat(o),children:[(0,t.jsx)(v.x,{className:"font-medium text-gray-900 mb-3",children:"Auto-Rotation"}),m]})};let _=["logging"],f=e=>e&&"object"==typeof e?Object.fromEntries(Object.entries(e).filter(e=>{let[s]=e;return!_.includes(s)})):{},N=e=>e&&"object"==typeof e&&Array.isArray(e.logging)?e.logging:[],k=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return JSON.stringify(f(e),null,s)},w=e=>{if(!e||"object"!=typeof e)return e;let{tags:s,...a}=e;return a};var Z=a(27799),S=a(9114),C=a(19250),A=a(60131),I=a(16721),L=a(22116),P=a(19015),M=a(92668),D=a(29233);function T(e){let{selectedToken:s,visible:a,onClose:l,accessToken:r,premiumUser:i,setAccessToken:n,onKeyUpdate:d}=e,[o]=c.Z.useForm(),[m,u]=(0,h.useState)(null),[x,g]=(0,h.useState)(null),[p,j]=(0,h.useState)(null),[v,b]=(0,h.useState)(!1),[y,_]=(0,h.useState)(!1),[f,N]=(0,h.useState)(null);(0,h.useEffect)(()=>{a&&s&&r&&(o.setFieldsValue({key_alias:s.key_alias,max_budget:s.max_budget,tpm_limit:s.tpm_limit,rpm_limit:s.rpm_limit,duration:s.duration||""}),N(r),_(s.key_name===r))},[a,s,o,r]),(0,h.useEffect)(()=>{a||(u(null),b(!1),_(!1),N(null),o.resetFields())},[a,o]);let k=e=>{if(!e)return null;try{let s;let a=new Date;if(e.endsWith("s"))s=(0,M.I)(a,{seconds:parseInt(e)});else if(e.endsWith("h"))s=(0,M.I)(a,{hours:parseInt(e)});else if(e.endsWith("d"))s=(0,M.I)(a,{days:parseInt(e)});else throw Error("Invalid duration format");return s.toLocaleString()}catch(e){return null}};(0,h.useEffect)(()=>{(null==x?void 0:x.duration)?j(k(x.duration)):j(null)},[null==x?void 0:x.duration]);let w=async()=>{if(s&&f){b(!0);try{let e=await o.validateFields(),a=await (0,C.regenerateKeyCall)(f,s.token||s.token_id,e);u(a.key),S.Z.success("Virtual Key regenerated successfully"),console.log("Full regenerate response:",a);let t={token:a.token||a.key_id||s.token,key_name:a.key,max_budget:e.max_budget,tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit,expires:e.duration?k(e.duration):s.expires,...a};console.log("Updated key data with new token:",t),y&&(N(a.key),n&&n(a.key)),d&&d(t),b(!1)}catch(e){console.error("Error regenerating key:",e),S.Z.fromBackend(e),b(!1)}}},Z=()=>{u(null),b(!1),_(!1),N(null),o.resetFields(),l()};return(0,t.jsx)(L.Z,{title:"Regenerate Virtual Key",open:a,onCancel:Z,footer:m?[(0,t.jsx)(I.zx,{onClick:Z,children:"Close"},"close")]:[(0,t.jsx)(I.zx,{onClick:Z,className:"mr-2",children:"Cancel"},"cancel"),(0,t.jsx)(I.zx,{onClick:w,disabled:v,children:v?"Regenerating...":"Regenerate"},"regenerate")],children:m?(0,t.jsxs)(I.rj,{numItems:1,className:"gap-2 w-full",children:[(0,t.jsx)(I.Dx,{children:"Regenerated Key"}),(0,t.jsx)(I.JX,{numColSpan:1,children:(0,t.jsxs)("p",{children:["Please replace your old key with the new key generated. For security reasons,"," ",(0,t.jsx)("b",{children:"you will not be able to view it again"})," through your LiteLLM account. If you lose this secret key, you will need to generate a new one."]})}),(0,t.jsxs)(I.JX,{numColSpan:1,children:[(0,t.jsx)(I.xv,{className:"mt-3",children:"Key Alias:"}),(0,t.jsx)("div",{className:"bg-gray-100 p-2 rounded mb-2",children:(0,t.jsx)("pre",{className:"break-words whitespace-normal",children:(null==s?void 0:s.key_alias)||"No alias set"})}),(0,t.jsx)(I.xv,{className:"mt-3",children:"New Virtual Key:"}),(0,t.jsx)("div",{className:"bg-gray-100 p-2 rounded mb-2",children:(0,t.jsx)("pre",{className:"break-words whitespace-normal",children:m})}),(0,t.jsx)(D.CopyToClipboard,{text:m,onCopy:()=>S.Z.success("Virtual Key copied to clipboard"),children:(0,t.jsx)(I.zx,{className:"mt-3",children:"Copy Virtual Key"})})]})]}):(0,t.jsxs)(c.Z,{form:o,layout:"vertical",onValuesChange:e=>{"duration"in e&&g(s=>({...s,duration:e.duration}))},children:[(0,t.jsx)(c.Z.Item,{name:"key_alias",label:"Key Alias",children:(0,t.jsx)(I.oi,{disabled:!0})}),(0,t.jsx)(c.Z.Item,{name:"max_budget",label:"Max Budget (USD)",children:(0,t.jsx)(P.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{name:"tpm_limit",label:"TPM Limit",children:(0,t.jsx)(P.Z,{style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{name:"rpm_limit",label:"RPM Limit",children:(0,t.jsx)(P.Z,{style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{name:"duration",label:"Expire Key (eg: 30s, 30h, 30d)",className:"mt-8",children:(0,t.jsx)(I.oi,{placeholder:""})}),(0,t.jsxs)("div",{className:"mt-2 text-sm text-gray-500",children:["Current expiry: ",(null==s?void 0:s.expires)?new Date(s.expires).toLocaleString():"Never"]}),p&&(0,t.jsxs)("div",{className:"mt-2 text-sm text-green-600",children:["New expiry: ",p]})]})})}var E=a(85968),R=a(67479),F=a(64504),z=a(37592),V=a(4260),K=a(63709),O=a(62099),U=a(95096),G=a(65895),B=a(95920),W=a(68473),q=a(82586),J=a(30874),$=a(24199),Q=a(21425),X=a(97415),Y=a(15424);let H=e=>e&&0!==e.length?e.includes("llm_api_routes")?"llm_api":e.includes("management_routes")?"management":e.includes("info_routes")?"read_only":"default":"default";function ee(e){var s,a,l,r,i,n,d,o,m,x,g,p,v,b;let{keyData:y,onCancel:_,onSubmit:f,teams:Z,accessToken:A,userID:I,userRole:L,premiumUser:P=!1}=e,[M]=c.Z.useForm(),[D,T]=(0,h.useState)([]),[E,ee]=(0,h.useState)([]),[es,ea]=(0,h.useState)({}),et=null==Z?void 0:Z.find(e=>e.team_id===y.team_id),[el,er]=(0,h.useState)([]),[ei,en]=(0,h.useState)([]),[ed,eo]=(0,h.useState)(!1),[ec,em]=(0,h.useState)(Array.isArray(null===(s=y.metadata)||void 0===s?void 0:s.litellm_disabled_callbacks)?(0,j.PA)(y.metadata.litellm_disabled_callbacks):[]),[eu,ex]=(0,h.useState)(y.auto_rotate||!1),[eg,eh]=(0,h.useState)(y.rotation_interval||""),[ep,ej]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let e=async()=>{if(I&&L&&A)try{if(null===y.team_id){let e=(await (0,C.modelAvailableCall)(A,I,L)).data.map(e=>e.id);er(e)}else if(null==et?void 0:et.team_id){let e=await (0,J.wk)(I,L,A,et.team_id);er(Array.from(new Set([...et.models,...e])))}}catch(e){console.error("Error fetching models:",e)}};(async()=>{if(A)try{let e=await (0,C.getPromptsList)(A);ee(e.prompts.map(e=>e.prompt_id))}catch(e){console.error("Failed to fetch prompts:",e)}})(),e()},[I,L,A,et,y.team_id]),(0,h.useEffect)(()=>{M.setFieldValue("disabled_callbacks",ec)},[M,ec]);let ev=e=>e&&({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||null,eb={...y,token:y.token||y.token_id,budget_duration:ev(y.budget_duration),metadata:k(w(y.metadata)),guardrails:null===(a=y.metadata)||void 0===a?void 0:a.guardrails,disable_global_guardrails:(null===(l=y.metadata)||void 0===l?void 0:l.disable_global_guardrails)||!1,prompts:null===(r=y.metadata)||void 0===r?void 0:r.prompts,tags:null===(i=y.metadata)||void 0===i?void 0:i.tags,vector_stores:(null===(n=y.object_permission)||void 0===n?void 0:n.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(d=y.object_permission)||void 0===d?void 0:d.mcp_servers)||[],accessGroups:(null===(o=y.object_permission)||void 0===o?void 0:o.mcp_access_groups)||[]},mcp_tool_permissions:(null===(m=y.object_permission)||void 0===m?void 0:m.mcp_tool_permissions)||{},agents_and_groups:{agents:(null===(x=y.object_permission)||void 0===x?void 0:x.agents)||[],accessGroups:(null===(g=y.object_permission)||void 0===g?void 0:g.agent_access_groups)||[]},logging_settings:N(y.metadata),disabled_callbacks:Array.isArray(null===(p=y.metadata)||void 0===p?void 0:p.litellm_disabled_callbacks)?(0,j.PA)(y.metadata.litellm_disabled_callbacks):[],auto_rotate:y.auto_rotate||!1,...y.rotation_interval&&{rotation_interval:y.rotation_interval},allowed_routes:y.allowed_routes};(0,h.useEffect)(()=>{var e,s,a,t,l,r,i,n,d;M.setFieldsValue({...y,token:y.token||y.token_id,budget_duration:ev(y.budget_duration),metadata:k(w(y.metadata)),guardrails:null===(e=y.metadata)||void 0===e?void 0:e.guardrails,disable_global_guardrails:(null===(s=y.metadata)||void 0===s?void 0:s.disable_global_guardrails)||!1,prompts:null===(a=y.metadata)||void 0===a?void 0:a.prompts,tags:null===(t=y.metadata)||void 0===t?void 0:t.tags,vector_stores:(null===(l=y.object_permission)||void 0===l?void 0:l.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(r=y.object_permission)||void 0===r?void 0:r.mcp_servers)||[],accessGroups:(null===(i=y.object_permission)||void 0===i?void 0:i.mcp_access_groups)||[]},mcp_tool_permissions:(null===(n=y.object_permission)||void 0===n?void 0:n.mcp_tool_permissions)||{},logging_settings:N(y.metadata),disabled_callbacks:Array.isArray(null===(d=y.metadata)||void 0===d?void 0:d.litellm_disabled_callbacks)?(0,j.PA)(y.metadata.litellm_disabled_callbacks):[],auto_rotate:y.auto_rotate||!1,...y.rotation_interval&&{rotation_interval:y.rotation_interval},allowed_routes:y.allowed_routes})},[y,M]),(0,h.useEffect)(()=>{M.setFieldValue("auto_rotate",eu)},[eu,M]),(0,h.useEffect)(()=>{eg&&M.setFieldValue("rotation_interval",eg)},[eg,M]),(0,h.useEffect)(()=>{(async()=>{if(A)try{let e=await (0,C.tagListCall)(A);ea(e)}catch(e){S.Z.fromBackend("Error fetching tags: "+e)}})()},[A]),console.log("premiumUser:",P);let ey=async e=>{try{ej(!0),await f(e)}finally{ej(!1)}};return(0,t.jsxs)(c.Z,{form:M,onFinish:ey,initialValues:eb,layout:"vertical",children:[(0,t.jsx)(c.Z.Item,{label:"Key Alias",name:"key_alias",children:(0,t.jsx)(F.o,{})}),(0,t.jsx)(c.Z.Item,{label:"Models",name:"models",children:(0,t.jsx)(c.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.allowed_routes!==s.allowed_routes||e.models!==s.models,children:e=>{let{getFieldValue:s,setFieldValue:a}=e,l=s("allowed_routes")||[],r=l.includes("management_routes")||l.includes("info_routes"),i=s("models")||[];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(z.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:r,value:r?[]:i,onChange:e=>a("models",e),children:[el.length>0&&(0,t.jsx)(z.default.Option,{value:"all-team-models",children:"All Team Models"}),el.map(e=>(0,t.jsx)(z.default.Option,{value:e,children:e},e))]}),r&&(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Models field is disabled for this key type"})]})}})}),(0,t.jsx)(c.Z.Item,{label:"Key Type",children:(0,t.jsx)(c.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.allowed_routes!==s.allowed_routes,children:e=>{let{getFieldValue:s,setFieldValue:a}=e,l=H(s("allowed_routes"));return(0,t.jsxs)(z.default,{placeholder:"Select key type",style:{width:"100%"},optionLabelProp:"label",value:l,onChange:e=>{switch(e){case"default":a("allowed_routes",[]);break;case"llm_api":a("allowed_routes",["llm_api_routes"]);break;case"management":a("allowed_routes",["management_routes"]),a("models",[])}},children:[(0,t.jsx)(z.default.Option,{value:"default",label:"Default",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Default"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call LLM API + Management routes"})]})}),(0,t.jsx)(z.default.Option,{value:"llm_api",label:"LLM API",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"LLM API"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only LLM API routes (chat/completions, embeddings, etc.)"})]})}),(0,t.jsx)(z.default.Option,{value:"management",label:"Management",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Management"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only management routes (user/team/key management)"})]})})]})}})}),(0,t.jsx)(c.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)($.Z,{step:.01,style:{width:"100%"},placeholder:"Enter a numerical value"})}),(0,t.jsx)(c.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)(z.default,{placeholder:"n/a",children:[(0,t.jsx)(z.default.Option,{value:"daily",children:"Daily"}),(0,t.jsx)(z.default.Option,{value:"weekly",children:"Weekly"}),(0,t.jsx)(z.default.Option,{value:"monthly",children:"Monthly"})]})}),(0,t.jsx)(c.Z.Item,{label:"TPM Limit",name:"tpm_limit",children:(0,t.jsx)($.Z,{min:0})}),(0,t.jsx)(G.Z,{type:"tpm",name:"tpm_limit_type",showDetailedDescriptions:!1}),(0,t.jsx)(c.Z.Item,{label:"RPM Limit",name:"rpm_limit",children:(0,t.jsx)($.Z,{min:0})}),(0,t.jsx)(G.Z,{type:"rpm",name:"rpm_limit_type",showDetailedDescriptions:!1}),(0,t.jsx)(c.Z.Item,{label:"Max Parallel Requests",name:"max_parallel_requests",children:(0,t.jsx)($.Z,{min:0})}),(0,t.jsx)(c.Z.Item,{label:"Model TPM Limit",name:"model_tpm_limit",children:(0,t.jsx)(V.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,t.jsx)(c.Z.Item,{label:"Model RPM Limit",name:"model_rpm_limit",children:(0,t.jsx)(V.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,t.jsx)(c.Z.Item,{label:"Guardrails",name:"guardrails",children:A&&(0,t.jsx)(R.Z,{onChange:e=>{M.setFieldValue("guardrails",e)},accessToken:A,disabled:!P})}),(0,t.jsx)(c.Z.Item,{label:(0,t.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,t.jsx)(u.Z,{title:"When enabled, this key will bypass any guardrails configured to run on every request (global guardrails)",children:(0,t.jsx)(Y.Z,{style:{marginLeft:"4px"}})})]}),name:"disable_global_guardrails",valuePropName:"checked",children:(0,t.jsx)(K.Z,{disabled:!P,checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(c.Z.Item,{label:"Tags",name:"tags",children:(0,t.jsx)(z.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter tags",options:Object.values(es).map(e=>({value:e.name,label:e.name,title:e.description||e.name}))})}),(0,t.jsx)(c.Z.Item,{label:"Prompts",name:"prompts",children:(0,t.jsx)(u.Z,{title:P?"":"Setting prompts by key is a premium feature",placement:"top",children:(0,t.jsx)(z.default,{mode:"tags",style:{width:"100%"},disabled:!P,placeholder:P?Array.isArray(null===(v=y.metadata)||void 0===v?void 0:v.prompts)&&y.metadata.prompts.length>0?"Current: ".concat(y.metadata.prompts.join(", ")):"Select or enter prompts":"Premium feature - Upgrade to set prompts by key",options:E.map(e=>({value:e,label:e}))})})}),(0,t.jsx)(c.Z.Item,{label:"Allowed Pass Through Routes",name:"allowed_passthrough_routes",children:(0,t.jsx)(u.Z,{title:P?"":"Setting allowed pass through routes by key is a premium feature",placement:"top",children:(0,t.jsx)(U.Z,{onChange:e=>M.setFieldValue("allowed_passthrough_routes",e),value:M.getFieldValue("allowed_passthrough_routes"),accessToken:A||"",placeholder:P?Array.isArray(null===(b=y.metadata)||void 0===b?void 0:b.allowed_passthrough_routes)&&y.metadata.allowed_passthrough_routes.length>0?"Current: ".concat(y.metadata.allowed_passthrough_routes.join(", ")):"Select or enter allowed pass through routes":"Premium feature - Upgrade to set allowed pass through routes by key",disabled:!P})})}),(0,t.jsx)(c.Z.Item,{label:"Vector Stores",name:"vector_stores",children:(0,t.jsx)(X.Z,{onChange:e=>M.setFieldValue("vector_stores",e),value:M.getFieldValue("vector_stores"),accessToken:A||"",placeholder:"Select vector stores"})}),(0,t.jsx)(c.Z.Item,{label:"MCP Servers / Access Groups",name:"mcp_servers_and_groups",children:(0,t.jsx)(B.Z,{onChange:e=>M.setFieldValue("mcp_servers_and_groups",e),value:M.getFieldValue("mcp_servers_and_groups"),accessToken:A||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(c.Z.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(V.default,{type:"hidden"})}),(0,t.jsx)(c.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.mcp_servers_and_groups!==s.mcp_servers_and_groups||e.mcp_tool_permissions!==s.mcp_tool_permissions,children:()=>{var e;return(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)(W.Z,{accessToken:A||"",selectedServers:(null===(e=M.getFieldValue("mcp_servers_and_groups"))||void 0===e?void 0:e.servers)||[],toolPermissions:M.getFieldValue("mcp_tool_permissions")||{},onChange:e=>M.setFieldsValue({mcp_tool_permissions:e})})})}}),(0,t.jsx)(c.Z.Item,{label:"Agents / Access Groups",name:"agents_and_groups",children:(0,t.jsx)(q.Z,{onChange:e=>M.setFieldValue("agents_and_groups",e),value:M.getFieldValue("agents_and_groups"),accessToken:A||"",placeholder:"Select agents or access groups (optional)"})}),(0,t.jsx)(c.Z.Item,{label:"Team ID",name:"team_id",children:(0,t.jsx)(z.default,{placeholder:"Select team",style:{width:"100%"},children:null==Z?void 0:Z.map(e=>(0,t.jsx)(z.default.Option,{value:e.team_id,children:"".concat(e.team_alias," (").concat(e.team_id,")")},e.team_id))})}),(0,t.jsx)(c.Z.Item,{label:"Logging Settings",name:"logging_settings",children:(0,t.jsx)(Q.Z,{value:M.getFieldValue("logging_settings"),onChange:e=>M.setFieldValue("logging_settings",e),disabledCallbacks:ec,onDisabledCallbacksChange:e=>{em((0,j.PA)(e)),M.setFieldValue("disabled_callbacks",e)}})}),(0,t.jsx)(c.Z.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(V.default.TextArea,{rows:10})}),(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(O.Z,{form:M,autoRotationEnabled:eu,onAutoRotationChange:ex,rotationInterval:eg,onRotationIntervalChange:eh}),(0,t.jsx)(c.Z.Item,{name:"duration",hidden:!0,initialValue:"",children:(0,t.jsx)(V.default,{})})]}),(0,t.jsx)(c.Z.Item,{name:"token",hidden:!0,children:(0,t.jsx)(V.default,{})}),(0,t.jsx)(c.Z.Item,{name:"allowed_routes",hidden:!0,children:(0,t.jsx)(V.default,{})}),(0,t.jsx)(c.Z.Item,{name:"disabled_callbacks",hidden:!0,children:(0,t.jsx)(V.default,{})}),(0,t.jsx)(c.Z.Item,{name:"auto_rotate",hidden:!0,children:(0,t.jsx)(V.default,{})}),(0,t.jsx)(c.Z.Item,{name:"rotation_interval",hidden:!0,children:(0,t.jsx)(V.default,{})}),(0,t.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,t.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,t.jsx)(F.z,{variant:"secondary",onClick:_,disabled:ep,children:"Cancel"}),(0,t.jsx)(F.z,{type:"submit",loading:ep,children:"Save Changes"})]})})]})}function es(e){var s,a,v,b,_,f,I,L;let{keyId:P,onClose:M,keyData:D,accessToken:R,userID:F,userRole:z,teams:V,onKeyDataUpdate:K,onDelete:O,premiumUser:U,setAccessToken:G,backButtonText:B="Back to Keys"}=e,[W,q]=(0,h.useState)(!1),[J]=c.Z.useForm(),[$,Q]=(0,h.useState)(!1),[X,Y]=(0,h.useState)(""),[H,es]=(0,h.useState)(!1),[ea,et]=(0,h.useState)({}),[el,er]=(0,h.useState)(D),[ei,en]=(0,h.useState)(null),[ed,eo]=(0,h.useState)(!1);if((0,h.useEffect)(()=>{D&&er(D)},[D]),(0,h.useEffect)(()=>{if(ed){let e=setTimeout(()=>{eo(!1)},5e3);return()=>clearTimeout(e)}},[ed]),!el)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(o.zx,{icon:i.Z,variant:"light",onClick:M,className:"mb-4",children:B}),(0,t.jsx)(o.xv,{children:"Key not found"})]});let ec=async e=>{try{var s,a,t,l;if(!R)return;let i=e.token;if(e.key=i,U||(delete e.guardrails,delete e.prompts),e.max_budget=(0,r.C)(e.max_budget),void 0!==e.vector_stores&&(e.object_permission={...el.object_permission,vector_stores:e.vector_stores||[]},delete e.vector_stores),void 0!==e.mcp_servers_and_groups){let{servers:s,accessGroups:a}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]};e.object_permission={...el.object_permission,mcp_servers:s||[],mcp_access_groups:a||[]},delete e.mcp_servers_and_groups}if(void 0!==e.mcp_tool_permissions){let s=e.mcp_tool_permissions||{};Object.keys(s).length>0&&(e.object_permission={...e.object_permission,mcp_tool_permissions:s}),delete e.mcp_tool_permissions}if(void 0!==e.agents_and_groups){let{agents:s,accessGroups:a}=e.agents_and_groups||{agents:[],accessGroups:[]};e.object_permission={...e.object_permission,agents:s||[],agent_access_groups:a||[]},delete e.agents_and_groups}if(e.max_budget=(0,r.C)(e.max_budget),e.tpm_limit=(0,r.C)(e.tpm_limit),e.rpm_limit=(0,r.C)(e.rpm_limit),e.max_parallel_requests=(0,r.C)(e.max_parallel_requests),e.metadata&&"string"==typeof e.metadata)try{let t=JSON.parse(e.metadata);"tags"in t&&delete t.tags,e.metadata={...t,...Array.isArray(e.tags)&&e.tags.length>0?{tags:e.tags}:{},...(null===(s=e.guardrails)||void 0===s?void 0:s.length)>0?{guardrails:e.guardrails}:{},...e.logging_settings?{logging:e.logging_settings}:{},...(null===(a=e.disabled_callbacks)||void 0===a?void 0:a.length)>0?{litellm_disabled_callbacks:(0,j.Z3)(e.disabled_callbacks)}:{}}}catch(e){console.error("Error parsing metadata JSON:",e),S.Z.error("Invalid metadata JSON");return}else{let{tags:s,...a}=e.metadata||{};e.metadata={...a,...Array.isArray(e.tags)&&e.tags.length>0?{tags:e.tags}:{},...(null===(t=e.guardrails)||void 0===t?void 0:t.length)>0?{guardrails:e.guardrails}:{},...e.logging_settings?{logging:e.logging_settings}:{},...(null===(l=e.disabled_callbacks)||void 0===l?void 0:l.length)>0?{litellm_disabled_callbacks:(0,j.Z3)(e.disabled_callbacks)}:{}}}"tags"in e&&delete e.tags,delete e.logging_settings,e.budget_duration&&(e.budget_duration=({daily:"24h",weekly:"7d",monthly:"30d"})[e.budget_duration]);let n=await (0,C.keyUpdateCall)(R,e);er(e=>e?{...e,...n}:void 0),K&&K(n),S.Z.success("Key updated successfully"),q(!1)}catch(e){S.Z.fromBackend((0,E.O)(e)),console.error("Error updating key:",e)}},em=async()=>{try{if(!R)return;await (0,C.keyDeleteCall)(R,el.token||el.token_id),S.Z.success("Key deleted successfully"),O&&O(),M()}catch(e){console.error("Error deleting the key:",e),S.Z.fromBackend(e)}Y("")},eu=async(e,s)=>{await (0,l.vQ)(e)&&(et(e=>({...e,[s]:!0})),setTimeout(()=>{et(e=>({...e,[s]:!1}))},2e3))},ex=e=>{let s=new Date(e),a=s.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),t=s.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return"".concat(a," at ").concat(t)};return(0,t.jsxs)("div",{className:"w-full h-screen p-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(o.zx,{icon:i.Z,variant:"light",onClick:M,className:"mb-4",children:B}),(0,t.jsx)(o.Dx,{children:el.key_alias||"Virtual Key"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer mb-2 space-y-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"text-xs text-gray-400 uppercase tracking-wide mt-2",children:"Key ID"}),(0,t.jsx)(o.xv,{className:"text-gray-500 font-mono text-sm",children:el.token_id||el.token})]}),(0,t.jsx)(m.ZP,{type:"text",size:"small",icon:ea["key-id"]?(0,t.jsx)(x.Z,{size:12}):(0,t.jsx)(g.Z,{size:12}),onClick:()=>eu(el.token_id||el.token,"key-id"),className:"ml-2 transition-all duration-200".concat(ea["key-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,t.jsx)(o.xv,{className:"text-sm text-gray-500",children:el.updated_at&&el.updated_at!==el.created_at?"Updated: ".concat(ex(el.updated_at)):"Created: ".concat(ex(el.created_at))}),ed&&(0,t.jsx)(o.Ct,{color:"green",size:"xs",className:"animate-pulse",children:"Recently Regenerated"}),ei&&(0,t.jsx)(o.Ct,{color:"blue",size:"xs",children:"Regenerated"})]})]}),z&&p.LQ.includes(z)&&(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(u.Z,{title:U?"":"This is a LiteLLM Enterprise feature, and requires a valid key to use.",children:(0,t.jsx)("span",{className:"inline-block",children:(0,t.jsx)(o.zx,{icon:n.Z,variant:"secondary",onClick:()=>es(!0),className:"flex items-center",disabled:!U,children:"Regenerate Key"})})}),(0,t.jsx)(o.zx,{icon:d.Z,variant:"secondary",onClick:()=>Q(!0),className:"flex items-center text-red-500 border-red-500 hover:text-red-700",children:"Delete Key"})]})]}),(0,t.jsx)(T,{selectedToken:el,visible:H,onClose:()=>es(!1),accessToken:R,premiumUser:U,setAccessToken:G,onKeyUpdate:e=>{er(s=>{if(s)return{...s,...e,created_at:new Date().toLocaleString()}}),en(new Date),eo(!0),K&&K({...e,created_at:new Date().toLocaleString()})}}),$&&(()=>{let e=(null==el?void 0:el.key_alias)||(null==el?void 0:el.token_id)||"Virtual Key",s=X===e;return(0,t.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-2xl min-h-[380px] py-6 overflow-hidden transform transition-all flex flex-col justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200",children:[(0,t.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Delete Key"}),(0,t.jsx)("button",{onClick:()=>{Q(!1),Y("")},className:"text-gray-400 hover:text-gray-500 focus:outline-none",children:(0,t.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,t.jsxs)("div",{className:"px-6 py-4",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-red-50 border border-red-100 rounded-md mb-5",children:[(0,t.jsx)("div",{className:"text-red-500 mt-0.5",children:(0,t.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-base font-medium text-red-600",children:"Warning: You are about to delete this Virtual Key."}),(0,t.jsx)("p",{className:"text-base text-red-600 mt-2",children:"This action is irreversible and will immediately revoke access for any applications using this key."})]})]}),(0,t.jsx)("p",{className:"text-base text-gray-600 mb-5",children:"Are you sure you want to delete this Virtual Key?"}),(0,t.jsxs)("div",{className:"mb-5",children:[(0,t.jsxs)("label",{className:"block text-base font-medium text-gray-700 mb-2",children:["Type ",(0,t.jsx)("span",{className:"underline",children:e})," to confirm deletion:"]}),(0,t.jsx)("input",{type:"text",value:X,onChange:e=>Y(e.target.value),placeholder:"Enter key name exactly",className:"w-full px-4 py-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-base",autoFocus:!0})]})]})]}),(0,t.jsxs)("div",{className:"px-6 py-4 bg-gray-50 flex justify-end gap-4",children:[(0,t.jsx)("button",{onClick:()=>{Q(!1),Y("")},className:"px-5 py-3 bg-white border border-gray-300 rounded-md text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:"Cancel"}),(0,t.jsx)("button",{onClick:em,disabled:!s,className:"px-5 py-3 rounded-md text-base font-medium text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 ".concat(s?"bg-red-600 hover:bg-red-700":"bg-red-300 cursor-not-allowed"),children:"Delete Key"})]})]})})})(),(0,t.jsxs)(o.v0,{children:[(0,t.jsxs)(o.td,{className:"mb-4",children:[(0,t.jsx)(o.OK,{children:"Overview"}),(0,t.jsx)(o.OK,{children:"Settings"})]}),(0,t.jsxs)(o.nP,{children:[(0,t.jsx)(o.x4,{children:(0,t.jsxs)(o.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(o.Zb,{children:[(0,t.jsx)(o.xv,{children:"Spend"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(o.Dx,{children:["$",(0,l.pw)(el.spend,4)]}),(0,t.jsxs)(o.xv,{children:["of"," ",null!==el.max_budget?"$".concat((0,l.pw)(el.max_budget)):"Unlimited"]})]})]}),(0,t.jsxs)(o.Zb,{children:[(0,t.jsx)(o.xv,{children:"Rate Limits"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(o.xv,{children:["TPM: ",null!==el.tpm_limit?el.tpm_limit:"Unlimited"]}),(0,t.jsxs)(o.xv,{children:["RPM: ",null!==el.rpm_limit?el.rpm_limit:"Unlimited"]})]})]}),(0,t.jsxs)(o.Zb,{children:[(0,t.jsx)(o.xv,{children:"Models"}),(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:el.models&&el.models.length>0?el.models.map((e,s)=>(0,t.jsx)(o.Ct,{color:"red",children:e},s)):(0,t.jsx)(o.xv,{children:"No models specified"})})]}),(0,t.jsx)(o.Zb,{children:(0,t.jsx)(A.Z,{objectPermission:el.object_permission,variant:"inline",accessToken:R})}),(0,t.jsx)(Z.Z,{loggingConfigs:N(el.metadata),disabledCallbacks:Array.isArray(null===(s=el.metadata)||void 0===s?void 0:s.litellm_disabled_callbacks)?(0,j.PA)(el.metadata.litellm_disabled_callbacks):[],variant:"card"}),(0,t.jsx)(y,{autoRotate:el.auto_rotate,rotationInterval:el.rotation_interval,lastRotationAt:el.last_rotation_at,keyRotationAt:el.key_rotation_at,nextRotationAt:el.next_rotation_at,variant:"card"})]})}),(0,t.jsx)(o.x4,{children:(0,t.jsxs)(o.Zb,{className:"overflow-y-auto max-h-[65vh]",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(o.Dx,{children:"Key Settings"}),!W&&z&&p.LQ.includes(z)&&(0,t.jsx)(o.zx,{onClick:()=>q(!0),children:"Edit Settings"})]}),W?(0,t.jsx)(ee,{keyData:el,onCancel:()=>q(!1),onSubmit:ec,teams:V,accessToken:R,userID:F,userRole:z,premiumUser:U}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Key ID"}),(0,t.jsx)(o.xv,{className:"font-mono",children:el.token_id||el.token})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Key Alias"}),(0,t.jsx)(o.xv,{children:el.key_alias||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Secret Key"}),(0,t.jsx)(o.xv,{className:"font-mono",children:el.key_name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Team ID"}),(0,t.jsx)(o.xv,{children:el.team_id||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Organization"}),(0,t.jsx)(o.xv,{children:el.organization_id||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Created"}),(0,t.jsx)(o.xv,{children:ex(el.created_at)})]}),ei&&(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Last Regenerated"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(o.xv,{children:ex(ei)}),(0,t.jsx)(o.Ct,{color:"green",size:"xs",children:"Recent"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Expires"}),(0,t.jsx)(o.xv,{children:el.expires?ex(el.expires):"Never"})]}),(0,t.jsx)(y,{autoRotate:el.auto_rotate,rotationInterval:el.rotation_interval,lastRotationAt:el.last_rotation_at,keyRotationAt:el.key_rotation_at,nextRotationAt:el.next_rotation_at,variant:"inline",className:"pt-4 border-t border-gray-200"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Spend"}),(0,t.jsxs)(o.xv,{children:["$",(0,l.pw)(el.spend,4)," USD"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Budget"}),(0,t.jsx)(o.xv,{children:null!==el.max_budget?"$".concat((0,l.pw)(el.max_budget,2)):"Unlimited"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Tags"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:Array.isArray(null===(a=el.metadata)||void 0===a?void 0:a.tags)&&el.metadata.tags.length>0?el.metadata.tags.map((e,s)=>(0,t.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No tags specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Prompts"}),(0,t.jsx)(o.xv,{children:Array.isArray(null===(v=el.metadata)||void 0===v?void 0:v.prompts)&&el.metadata.prompts.length>0?el.metadata.prompts.map((e,s)=>(0,t.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No prompts specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Allowed Pass Through Routes"}),(0,t.jsx)(o.xv,{children:Array.isArray(null===(b=el.metadata)||void 0===b?void 0:b.allowed_passthrough_routes)&&el.metadata.allowed_passthrough_routes.length>0?el.metadata.allowed_passthrough_routes.map((e,s)=>(0,t.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No pass through routes specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Disable Global Guardrails"}),(0,t.jsx)(o.xv,{children:(null===(_=el.metadata)||void 0===_?void 0:_.disable_global_guardrails)===!0?(0,t.jsx)(o.Ct,{color:"yellow",children:"Enabled - Global guardrails bypassed"}):(0,t.jsx)(o.Ct,{color:"green",children:"Disabled - Global guardrails active"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:el.models&&el.models.length>0?el.models.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):(0,t.jsx)(o.xv,{children:"No models specified"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Rate Limits"}),(0,t.jsxs)(o.xv,{children:["TPM: ",null!==el.tpm_limit?el.tpm_limit:"Unlimited"]}),(0,t.jsxs)(o.xv,{children:["RPM: ",null!==el.rpm_limit?el.rpm_limit:"Unlimited"]}),(0,t.jsxs)(o.xv,{children:["Max Parallel Requests:"," ",null!==el.max_parallel_requests?el.max_parallel_requests:"Unlimited"]}),(0,t.jsxs)(o.xv,{children:["Model TPM Limits:"," ",(null===(f=el.metadata)||void 0===f?void 0:f.model_tpm_limit)?JSON.stringify(el.metadata.model_tpm_limit):"Unlimited"]}),(0,t.jsxs)(o.xv,{children:["Model RPM Limits:"," ",(null===(I=el.metadata)||void 0===I?void 0:I.model_rpm_limit)?JSON.stringify(el.metadata.model_rpm_limit):"Unlimited"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Metadata"}),(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:k(w(el.metadata))})]}),(0,t.jsx)(A.Z,{objectPermission:el.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:R}),(0,t.jsx)(Z.Z,{loggingConfigs:N(el.metadata),disabledCallbacks:Array.isArray(null===(L=el.metadata)||void 0===L?void 0:L.litellm_disabled_callbacks)?(0,j.PA)(el.metadata.litellm_disabled_callbacks):[],variant:"inline",className:"pt-4 border-t border-gray-200"})]})]})})]})]})]})}},33304:function(e,s,a){a.d(s,{C:function(){return t}});function t(e){return""===e?null:e}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4292],{84717:function(e,s,a){a.d(s,{Ct:function(){return t.Z},Dx:function(){return x.Z},OK:function(){return n.Z},Zb:function(){return r.Z},nP:function(){return m.Z},rj:function(){return i.Z},td:function(){return o.Z},v0:function(){return d.Z},x4:function(){return c.Z},xv:function(){return u.Z},zx:function(){return l.Z}});var t=a(41649),l=a(78489),r=a(12514),i=a(67101),n=a(12485),d=a(18135),o=a(35242),c=a(29706),m=a(77991),u=a(84264),x=a(96761)},40728:function(e,s,a){a.d(s,{C:function(){return t.Z},x:function(){return l.Z}});var t=a(41649),l=a(84264)},16721:function(e,s,a){a.d(s,{Dx:function(){return d.Z},JX:function(){return l.Z},oi:function(){return n.Z},rj:function(){return r.Z},xv:function(){return i.Z},zx:function(){return t.Z}});var t=a(78489),l=a(49804),r=a(67101),i=a(84264),n=a(49566),d=a(96761)},64504:function(e,s,a){a.d(s,{o:function(){return l.Z},z:function(){return t.Z}});var t=a(78489),l=a(49566)},67479:function(e,s,a){var t=a(57437),l=a(2265),r=a(37592),i=a(19250);s.Z=e=>{let{onChange:s,value:a,className:n,accessToken:d,disabled:o}=e,[c,m]=(0,l.useState)([]),[u,x]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{(async()=>{if(d){x(!0);try{let e=await (0,i.getGuardrailsList)(d);console.log("Guardrails response:",e),e.guardrails&&(console.log("Guardrails data:",e.guardrails),m(e.guardrails))}catch(e){console.error("Error fetching guardrails:",e)}finally{x(!1)}}})()},[d]),(0,t.jsx)("div",{children:(0,t.jsx)(r.default,{mode:"multiple",disabled:o,placeholder:o?"Setting guardrails is a premium feature.":"Select guardrails",onChange:e=>{console.log("Selected guardrails:",e),s(e)},value:a,loading:u,className:n,options:c.map(e=>(console.log("Mapping guardrail:",e),{label:"".concat(e.guardrail_name),value:e.guardrail_name})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})}},27799:function(e,s,a){var t=a(57437);a(2265);var l=a(40728),r=a(82182),i=a(91777),n=a(97434);s.Z=function(e){let{loggingConfigs:s=[],disabledCallbacks:a=[],variant:d="card",className:o=""}=e,c=e=>{var s;return(null===(s=Object.entries(n.Lo).find(s=>{let[a,t]=s;return t===e}))||void 0===s?void 0:s[0])||e},m=e=>{switch(e){case"success":return"green";case"failure":return"red";case"success_and_failure":return"blue";default:return"gray"}},u=e=>{switch(e){case"success":return"Success Only";case"failure":return"Failure Only";case"success_and_failure":return"Success & Failure";default:return e}},x=(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(r.Z,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Logging Integrations"}),(0,t.jsx)(l.C,{color:"blue",size:"xs",children:s.length})]}),s.length>0?(0,t.jsx)("div",{className:"space-y-3",children:s.map((e,s)=>{var a;let i=c(e.callback_name),d=null===(a=n.Dg[i])||void 0===a?void 0:a.logo;return(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-blue-50 border border-blue-200",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[d?(0,t.jsx)("img",{src:d,alt:i,className:"w-5 h-5 object-contain"}):(0,t.jsx)(r.Z,{className:"h-5 w-5 text-gray-400"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(l.x,{className:"font-medium text-blue-800",children:i}),(0,t.jsxs)(l.x,{className:"text-xs text-blue-600",children:[Object.keys(e.callback_vars).length," parameters configured"]})]})]}),(0,t.jsx)(l.C,{color:m(e.callback_type),size:"sm",children:u(e.callback_type)})]},s)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(r.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(l.x,{className:"text-gray-500 text-sm",children:"No logging integrations configured"})]})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(i.Z,{className:"h-4 w-4 text-red-600"}),(0,t.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Disabled Callbacks"}),(0,t.jsx)(l.C,{color:"red",size:"xs",children:a.length})]}),a.length>0?(0,t.jsx)("div",{className:"space-y-3",children:a.map((e,s)=>{var a;let r=n.RD[e]||e,d=null===(a=n.Dg[r])||void 0===a?void 0:a.logo;return(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-red-50 border border-red-200",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[d?(0,t.jsx)("img",{src:d,alt:r,className:"w-5 h-5 object-contain"}):(0,t.jsx)(i.Z,{className:"h-5 w-5 text-gray-400"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(l.x,{className:"font-medium text-red-800",children:r}),(0,t.jsx)(l.x,{className:"text-xs text-red-600",children:"Disabled for this key"})]})]}),(0,t.jsx)(l.C,{color:"red",size:"sm",children:"Disabled"})]},s)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(i.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(l.x,{className:"text-gray-500 text-sm",children:"No callbacks disabled"})]})]})]});return"card"===d?(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(o),children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Logging Settings"}),(0,t.jsx)(l.x,{className:"text-xs text-gray-500",children:"Active logging integrations and disabled callbacks for this key"})]})}),x]}):(0,t.jsxs)("div",{className:"".concat(o),children:[(0,t.jsx)(l.x,{className:"font-medium text-gray-900 mb-3",children:"Logging Settings"}),x]})}},60131:function(e,s,a){a.d(s,{Z:function(){return j}});var t=a(57437),l=a(2265),r=a(92280),i=a(40728),n=a(79814),d=a(19250),o=function(e){let{vectorStores:s,accessToken:a}=e,[r,o]=(0,l.useState)([]);(0,l.useEffect)(()=>{(async()=>{if(a&&0!==s.length)try{let e=await (0,d.vectorStoreListCall)(a);e.data&&o(e.data.map(e=>({vector_store_id:e.vector_store_id,vector_store_name:e.vector_store_name})))}catch(e){console.error("Error fetching vector stores:",e)}})()},[a,s.length]);let c=e=>{let s=r.find(s=>s.vector_store_id===e);return s?"".concat(s.vector_store_name||s.vector_store_id," (").concat(s.vector_store_id,")"):e};return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(n.Z,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(i.x,{className:"font-semibold text-gray-900",children:"Vector Stores"}),(0,t.jsx)(i.C,{color:"blue",size:"xs",children:s.length})]}),s.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map((e,s)=>(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-sm font-medium",children:c(e)},s))}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(n.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(i.x,{className:"text-gray-500 text-sm",children:"No vector stores configured"})]})]})},c=a(25327),m=a(86462),u=a(47686),x=a(99981),g=function(e){let{mcpServers:s,mcpAccessGroups:r=[],mcpToolPermissions:n={},accessToken:o}=e,[g,h]=(0,l.useState)([]),[p,j]=(0,l.useState)([]),[v,b]=(0,l.useState)(new Set),y=e=>{b(s=>{let a=new Set(s);return a.has(e)?a.delete(e):a.add(e),a})};(0,l.useEffect)(()=>{(async()=>{if(o&&s.length>0)try{let e=await (0,d.fetchMCPServers)(o);e&&Array.isArray(e)?h(e):e.data&&Array.isArray(e.data)&&h(e.data)}catch(e){console.error("Error fetching MCP servers:",e)}})()},[o,s.length]),(0,l.useEffect)(()=>{(async()=>{if(o&&r.length>0)try{let e=await Promise.resolve().then(a.bind(a,19250)).then(e=>e.fetchMCPAccessGroups(o));j(Array.isArray(e)?e:e.data||[])}catch(e){console.error("Error fetching MCP access groups:",e)}})()},[o,r.length]);let _=e=>{let s=g.find(s=>s.server_id===e);if(s){let a=e.length>7?"".concat(e.slice(0,3),"...").concat(e.slice(-4)):e;return"".concat(s.alias," (").concat(a,")")}return e},f=e=>e,N=[...s.map(e=>({type:"server",value:e})),...r.map(e=>({type:"accessGroup",value:e}))],k=N.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(c.Z,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(i.x,{className:"font-semibold text-gray-900",children:"MCP Servers"}),(0,t.jsx)(i.C,{color:"blue",size:"xs",children:k})]}),k>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:N.map((e,s)=>{let a="server"===e.type?n[e.value]:void 0,l=a&&a.length>0,r=v.has(e.value);return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{onClick:()=>l&&y(e.value),className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 transition-all ".concat(l?"cursor-pointer hover:bg-gray-50 hover:border-gray-300":"bg-white"),children:[(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"server"===e.type?(0,t.jsx)(x.Z,{title:"Full ID: ".concat(e.value),placement:"top",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-blue-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:_(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:f(e.value)}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})}),l&&(0,t.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 whitespace-nowrap",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-600",children:a.length}),(0,t.jsx)("span",{className:"text-xs text-gray-500",children:1===a.length?"tool":"tools"}),r?(0,t.jsx)(m.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"}):(0,t.jsx)(u.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"})]})]}),l&&r&&(0,t.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-blue-200 pb-1",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.map((e,s)=>(0,t.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-xs font-medium",children:e},s))})})]},s)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(c.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(i.x,{className:"text-gray-500 text-sm",children:"No MCP servers or access groups configured"})]})]})},h=a(3497),p=function(e){let{agents:s,agentAccessGroups:a=[],accessToken:r}=e,[n,o]=(0,l.useState)([]);(0,l.useEffect)(()=>{(async()=>{if(r&&s.length>0)try{let e=await (0,d.getAgentsList)(r);e&&e.agents&&Array.isArray(e.agents)&&o(e.agents)}catch(e){console.error("Error fetching agents:",e)}})()},[r,s.length]);let c=e=>{let s=n.find(s=>s.agent_id===e);if(s){let a=e.length>7?"".concat(e.slice(0,3),"...").concat(e.slice(-4)):e;return"".concat(s.agent_name," (").concat(a,")")}return e},m=[...s.map(e=>({type:"agent",value:e})),...a.map(e=>({type:"accessGroup",value:e}))],u=m.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(h.Z,{className:"h-4 w-4 text-purple-600"}),(0,t.jsx)(i.x,{className:"font-semibold text-gray-900",children:"Agents"}),(0,t.jsx)(i.C,{color:"purple",size:"xs",children:u})]}),u>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:m.map((e,s)=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 bg-white",children:(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"agent"===e.type?(0,t.jsx)(x.Z,{title:"Full ID: ".concat(e.value),placement:"top",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-purple-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:c(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.value}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})})})},s))}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(h.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(i.x,{className:"text-gray-500 text-sm",children:"No agents or access groups configured"})]})]})},j=function(e){let{objectPermission:s,variant:a="card",className:l="",accessToken:i}=e,n=(null==s?void 0:s.vector_stores)||[],d=(null==s?void 0:s.mcp_servers)||[],c=(null==s?void 0:s.mcp_access_groups)||[],m=(null==s?void 0:s.mcp_tool_permissions)||{},u=(null==s?void 0:s.agents)||[],x=(null==s?void 0:s.agent_access_groups)||[],h=(0,t.jsxs)("div",{className:"card"===a?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6":"space-y-4",children:[(0,t.jsx)(o,{vectorStores:n,accessToken:i}),(0,t.jsx)(g,{mcpServers:d,mcpAccessGroups:c,mcpToolPermissions:m,accessToken:i}),(0,t.jsx)(p,{agents:u,agentAccessGroups:x,accessToken:i})]});return"card"===a?(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(l),children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(r.x,{className:"font-semibold text-gray-900",children:"Object Permissions"}),(0,t.jsx)(r.x,{className:"text-xs text-gray-500",children:"Access control for Vector Stores and MCP Servers"})]})}),h]}):(0,t.jsxs)("div",{className:"".concat(l),children:[(0,t.jsx)(r.x,{className:"font-medium text-gray-900 mb-3",children:"Object Permissions"}),h]})}},21425:function(e,s,a){var t=a(57437);a(2265);var l=a(54507);s.Z=e=>{let{value:s,onChange:a,disabledCallbacks:r=[],onDisabledCallbacksChange:i}=e;return(0,t.jsx)(l.Z,{value:s,onChange:a,disabledCallbacks:r,onDisabledCallbacksChange:i})}},94292:function(e,s,a){a.d(s,{Z:function(){return es}});var t=a(57437),l=a(59872),r=a(33304),i=a(10900),n=a(23628),d=a(74998),o=a(84717),c=a(10032),m=a(5545),u=a(99981),x=a(30401),g=a(78867),h=a(2265),p=a(20347),j=a(97434),v=a(40728),b=a(58710),y=e=>{let{autoRotate:s=!1,rotationInterval:a,lastRotationAt:l,keyRotationAt:r,nextRotationAt:i,variant:d="card",className:o=""}=e,c=e=>{let s=new Date(e),a=s.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),t=s.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return"".concat(a," at ").concat(t)},m=(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)("div",{className:"space-y-3",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(n.Z,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(v.x,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,t.jsx)(v.C,{color:s?"green":"gray",size:"xs",children:s?"Enabled":"Disabled"}),s&&a&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(v.x,{className:"text-gray-400",children:"•"}),(0,t.jsxs)(v.x,{className:"text-sm text-gray-600",children:["Every ",a]})]})]})}),(s||l||r||i)&&(0,t.jsxs)("div",{className:"space-y-3",children:[l&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-200 rounded-md",children:[(0,t.jsx)(b.Z,{className:"w-4 h-4 text-gray-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(v.x,{className:"font-medium text-gray-700",children:"Last Rotation"}),(0,t.jsx)(v.x,{className:"text-sm text-gray-600",children:c(l)})]})]}),(r||i)&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-200 rounded-md",children:[(0,t.jsx)(b.Z,{className:"w-4 h-4 text-gray-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(v.x,{className:"font-medium text-gray-700",children:"Next Scheduled Rotation"}),(0,t.jsx)(v.x,{className:"text-sm text-gray-600",children:c(i||r||"")})]})]}),s&&!l&&!r&&!i&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-100 rounded-md",children:[(0,t.jsx)(b.Z,{className:"w-4 h-4 text-gray-500"}),(0,t.jsx)(v.x,{className:"text-gray-600",children:"No rotation history available"})]})]}),!s&&!l&&!r&&!i&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-100 rounded-md",children:[(0,t.jsx)(n.Z,{className:"w-4 h-4 text-gray-400"}),(0,t.jsx)(v.x,{className:"text-gray-600",children:"Auto-rotation is not enabled for this key"})]})]});return"card"===d?(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(o),children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(v.x,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,t.jsx)(v.x,{className:"text-xs text-gray-500",children:"Automatic key rotation settings and status for this key"})]})}),m]}):(0,t.jsxs)("div",{className:"".concat(o),children:[(0,t.jsx)(v.x,{className:"font-medium text-gray-900 mb-3",children:"Auto-Rotation"}),m]})};let _=["logging"],f=e=>e&&"object"==typeof e?Object.fromEntries(Object.entries(e).filter(e=>{let[s]=e;return!_.includes(s)})):{},N=e=>e&&"object"==typeof e&&Array.isArray(e.logging)?e.logging:[],k=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return JSON.stringify(f(e),null,s)},w=e=>{if(!e||"object"!=typeof e)return e;let{tags:s,...a}=e;return a};var Z=a(27799),S=a(9114),C=a(19250),A=a(60131),I=a(16721),L=a(22116),P=a(19015),M=a(92668),D=a(29233);function T(e){let{selectedToken:s,visible:a,onClose:l,accessToken:r,premiumUser:i,setAccessToken:n,onKeyUpdate:d}=e,[o]=c.Z.useForm(),[m,u]=(0,h.useState)(null),[x,g]=(0,h.useState)(null),[p,j]=(0,h.useState)(null),[v,b]=(0,h.useState)(!1),[y,_]=(0,h.useState)(!1),[f,N]=(0,h.useState)(null);(0,h.useEffect)(()=>{a&&s&&r&&(o.setFieldsValue({key_alias:s.key_alias,max_budget:s.max_budget,tpm_limit:s.tpm_limit,rpm_limit:s.rpm_limit,duration:s.duration||""}),N(r),_(s.key_name===r))},[a,s,o,r]),(0,h.useEffect)(()=>{a||(u(null),b(!1),_(!1),N(null),o.resetFields())},[a,o]);let k=e=>{if(!e)return null;try{let s;let a=new Date;if(e.endsWith("s"))s=(0,M.I)(a,{seconds:parseInt(e)});else if(e.endsWith("h"))s=(0,M.I)(a,{hours:parseInt(e)});else if(e.endsWith("d"))s=(0,M.I)(a,{days:parseInt(e)});else throw Error("Invalid duration format");return s.toLocaleString()}catch(e){return null}};(0,h.useEffect)(()=>{(null==x?void 0:x.duration)?j(k(x.duration)):j(null)},[null==x?void 0:x.duration]);let w=async()=>{if(s&&f){b(!0);try{let e=await o.validateFields(),a=await (0,C.regenerateKeyCall)(f,s.token||s.token_id,e);u(a.key),S.Z.success("Virtual Key regenerated successfully"),console.log("Full regenerate response:",a);let t={token:a.token||a.key_id||s.token,key_name:a.key,max_budget:e.max_budget,tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit,expires:e.duration?k(e.duration):s.expires,...a};console.log("Updated key data with new token:",t),y&&(N(a.key),n&&n(a.key)),d&&d(t),b(!1)}catch(e){console.error("Error regenerating key:",e),S.Z.fromBackend(e),b(!1)}}},Z=()=>{u(null),b(!1),_(!1),N(null),o.resetFields(),l()};return(0,t.jsx)(L.Z,{title:"Regenerate Virtual Key",open:a,onCancel:Z,footer:m?[(0,t.jsx)(I.zx,{onClick:Z,children:"Close"},"close")]:[(0,t.jsx)(I.zx,{onClick:Z,className:"mr-2",children:"Cancel"},"cancel"),(0,t.jsx)(I.zx,{onClick:w,disabled:v,children:v?"Regenerating...":"Regenerate"},"regenerate")],children:m?(0,t.jsxs)(I.rj,{numItems:1,className:"gap-2 w-full",children:[(0,t.jsx)(I.Dx,{children:"Regenerated Key"}),(0,t.jsx)(I.JX,{numColSpan:1,children:(0,t.jsxs)("p",{children:["Please replace your old key with the new key generated. For security reasons,"," ",(0,t.jsx)("b",{children:"you will not be able to view it again"})," through your LiteLLM account. If you lose this secret key, you will need to generate a new one."]})}),(0,t.jsxs)(I.JX,{numColSpan:1,children:[(0,t.jsx)(I.xv,{className:"mt-3",children:"Key Alias:"}),(0,t.jsx)("div",{className:"bg-gray-100 p-2 rounded mb-2",children:(0,t.jsx)("pre",{className:"break-words whitespace-normal",children:(null==s?void 0:s.key_alias)||"No alias set"})}),(0,t.jsx)(I.xv,{className:"mt-3",children:"New Virtual Key:"}),(0,t.jsx)("div",{className:"bg-gray-100 p-2 rounded mb-2",children:(0,t.jsx)("pre",{className:"break-words whitespace-normal",children:m})}),(0,t.jsx)(D.CopyToClipboard,{text:m,onCopy:()=>S.Z.success("Virtual Key copied to clipboard"),children:(0,t.jsx)(I.zx,{className:"mt-3",children:"Copy Virtual Key"})})]})]}):(0,t.jsxs)(c.Z,{form:o,layout:"vertical",onValuesChange:e=>{"duration"in e&&g(s=>({...s,duration:e.duration}))},children:[(0,t.jsx)(c.Z.Item,{name:"key_alias",label:"Key Alias",children:(0,t.jsx)(I.oi,{disabled:!0})}),(0,t.jsx)(c.Z.Item,{name:"max_budget",label:"Max Budget (USD)",children:(0,t.jsx)(P.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{name:"tpm_limit",label:"TPM Limit",children:(0,t.jsx)(P.Z,{style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{name:"rpm_limit",label:"RPM Limit",children:(0,t.jsx)(P.Z,{style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{name:"duration",label:"Expire Key (eg: 30s, 30h, 30d)",className:"mt-8",children:(0,t.jsx)(I.oi,{placeholder:""})}),(0,t.jsxs)("div",{className:"mt-2 text-sm text-gray-500",children:["Current expiry: ",(null==s?void 0:s.expires)?new Date(s.expires).toLocaleString():"Never"]}),p&&(0,t.jsxs)("div",{className:"mt-2 text-sm text-green-600",children:["New expiry: ",p]})]})})}var E=a(85968),R=a(67479),F=a(64504),z=a(37592),V=a(4260),K=a(63709),O=a(62099),U=a(95096),G=a(65895),B=a(95920),W=a(68473),q=a(82586),J=a(30874),$=a(24199),Q=a(21425),X=a(97415),Y=a(15424);let H=e=>e&&0!==e.length?e.includes("llm_api_routes")?"llm_api":e.includes("management_routes")?"management":e.includes("info_routes")?"read_only":"default":"default";function ee(e){var s,a,l,r,i,n,d,o,m,x,g,p,v,b;let{keyData:y,onCancel:_,onSubmit:f,teams:Z,accessToken:A,userID:I,userRole:L,premiumUser:P=!1}=e,[M]=c.Z.useForm(),[D,T]=(0,h.useState)([]),[E,ee]=(0,h.useState)([]),[es,ea]=(0,h.useState)({}),et=null==Z?void 0:Z.find(e=>e.team_id===y.team_id),[el,er]=(0,h.useState)([]),[ei,en]=(0,h.useState)([]),[ed,eo]=(0,h.useState)(!1),[ec,em]=(0,h.useState)(Array.isArray(null===(s=y.metadata)||void 0===s?void 0:s.litellm_disabled_callbacks)?(0,j.PA)(y.metadata.litellm_disabled_callbacks):[]),[eu,ex]=(0,h.useState)(y.auto_rotate||!1),[eg,eh]=(0,h.useState)(y.rotation_interval||""),[ep,ej]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let e=async()=>{if(I&&L&&A)try{if(null===y.team_id){let e=(await (0,C.modelAvailableCall)(A,I,L)).data.map(e=>e.id);er(e)}else if(null==et?void 0:et.team_id){let e=await (0,J.wk)(I,L,A,et.team_id);er(Array.from(new Set([...et.models,...e])))}}catch(e){console.error("Error fetching models:",e)}};(async()=>{if(A)try{let e=await (0,C.getPromptsList)(A);ee(e.prompts.map(e=>e.prompt_id))}catch(e){console.error("Failed to fetch prompts:",e)}})(),e()},[I,L,A,et,y.team_id]),(0,h.useEffect)(()=>{M.setFieldValue("disabled_callbacks",ec)},[M,ec]);let ev=e=>e&&({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||null,eb={...y,token:y.token||y.token_id,budget_duration:ev(y.budget_duration),metadata:k(w(y.metadata)),guardrails:null===(a=y.metadata)||void 0===a?void 0:a.guardrails,disable_global_guardrails:(null===(l=y.metadata)||void 0===l?void 0:l.disable_global_guardrails)||!1,prompts:null===(r=y.metadata)||void 0===r?void 0:r.prompts,tags:null===(i=y.metadata)||void 0===i?void 0:i.tags,vector_stores:(null===(n=y.object_permission)||void 0===n?void 0:n.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(d=y.object_permission)||void 0===d?void 0:d.mcp_servers)||[],accessGroups:(null===(o=y.object_permission)||void 0===o?void 0:o.mcp_access_groups)||[]},mcp_tool_permissions:(null===(m=y.object_permission)||void 0===m?void 0:m.mcp_tool_permissions)||{},agents_and_groups:{agents:(null===(x=y.object_permission)||void 0===x?void 0:x.agents)||[],accessGroups:(null===(g=y.object_permission)||void 0===g?void 0:g.agent_access_groups)||[]},logging_settings:N(y.metadata),disabled_callbacks:Array.isArray(null===(p=y.metadata)||void 0===p?void 0:p.litellm_disabled_callbacks)?(0,j.PA)(y.metadata.litellm_disabled_callbacks):[],auto_rotate:y.auto_rotate||!1,...y.rotation_interval&&{rotation_interval:y.rotation_interval},allowed_routes:y.allowed_routes};(0,h.useEffect)(()=>{var e,s,a,t,l,r,i,n,d;M.setFieldsValue({...y,token:y.token||y.token_id,budget_duration:ev(y.budget_duration),metadata:k(w(y.metadata)),guardrails:null===(e=y.metadata)||void 0===e?void 0:e.guardrails,disable_global_guardrails:(null===(s=y.metadata)||void 0===s?void 0:s.disable_global_guardrails)||!1,prompts:null===(a=y.metadata)||void 0===a?void 0:a.prompts,tags:null===(t=y.metadata)||void 0===t?void 0:t.tags,vector_stores:(null===(l=y.object_permission)||void 0===l?void 0:l.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(r=y.object_permission)||void 0===r?void 0:r.mcp_servers)||[],accessGroups:(null===(i=y.object_permission)||void 0===i?void 0:i.mcp_access_groups)||[]},mcp_tool_permissions:(null===(n=y.object_permission)||void 0===n?void 0:n.mcp_tool_permissions)||{},logging_settings:N(y.metadata),disabled_callbacks:Array.isArray(null===(d=y.metadata)||void 0===d?void 0:d.litellm_disabled_callbacks)?(0,j.PA)(y.metadata.litellm_disabled_callbacks):[],auto_rotate:y.auto_rotate||!1,...y.rotation_interval&&{rotation_interval:y.rotation_interval},allowed_routes:y.allowed_routes})},[y,M]),(0,h.useEffect)(()=>{M.setFieldValue("auto_rotate",eu)},[eu,M]),(0,h.useEffect)(()=>{eg&&M.setFieldValue("rotation_interval",eg)},[eg,M]),(0,h.useEffect)(()=>{(async()=>{if(A)try{let e=await (0,C.tagListCall)(A);ea(e)}catch(e){S.Z.fromBackend("Error fetching tags: "+e)}})()},[A]),console.log("premiumUser:",P);let ey=async e=>{try{ej(!0),await f(e)}finally{ej(!1)}};return(0,t.jsxs)(c.Z,{form:M,onFinish:ey,initialValues:eb,layout:"vertical",children:[(0,t.jsx)(c.Z.Item,{label:"Key Alias",name:"key_alias",children:(0,t.jsx)(F.o,{})}),(0,t.jsx)(c.Z.Item,{label:"Models",name:"models",children:(0,t.jsx)(c.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.allowed_routes!==s.allowed_routes||e.models!==s.models,children:e=>{let{getFieldValue:s,setFieldValue:a}=e,l=s("allowed_routes")||[],r=l.includes("management_routes")||l.includes("info_routes"),i=s("models")||[];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(z.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:r,value:r?[]:i,onChange:e=>a("models",e),children:[el.length>0&&(0,t.jsx)(z.default.Option,{value:"all-team-models",children:"All Team Models"}),el.map(e=>(0,t.jsx)(z.default.Option,{value:e,children:e},e))]}),r&&(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Models field is disabled for this key type"})]})}})}),(0,t.jsx)(c.Z.Item,{label:"Key Type",children:(0,t.jsx)(c.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.allowed_routes!==s.allowed_routes,children:e=>{let{getFieldValue:s,setFieldValue:a}=e,l=H(s("allowed_routes"));return(0,t.jsxs)(z.default,{placeholder:"Select key type",style:{width:"100%"},optionLabelProp:"label",value:l,onChange:e=>{switch(e){case"default":a("allowed_routes",[]);break;case"llm_api":a("allowed_routes",["llm_api_routes"]);break;case"management":a("allowed_routes",["management_routes"]),a("models",[])}},children:[(0,t.jsx)(z.default.Option,{value:"default",label:"Default",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Default"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call LLM API + Management routes"})]})}),(0,t.jsx)(z.default.Option,{value:"llm_api",label:"LLM API",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"LLM API"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only LLM API routes (chat/completions, embeddings, etc.)"})]})}),(0,t.jsx)(z.default.Option,{value:"management",label:"Management",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Management"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only management routes (user/team/key management)"})]})})]})}})}),(0,t.jsx)(c.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)($.Z,{step:.01,style:{width:"100%"},placeholder:"Enter a numerical value"})}),(0,t.jsx)(c.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)(z.default,{placeholder:"n/a",children:[(0,t.jsx)(z.default.Option,{value:"daily",children:"Daily"}),(0,t.jsx)(z.default.Option,{value:"weekly",children:"Weekly"}),(0,t.jsx)(z.default.Option,{value:"monthly",children:"Monthly"})]})}),(0,t.jsx)(c.Z.Item,{label:"TPM Limit",name:"tpm_limit",children:(0,t.jsx)($.Z,{min:0})}),(0,t.jsx)(G.Z,{type:"tpm",name:"tpm_limit_type",showDetailedDescriptions:!1}),(0,t.jsx)(c.Z.Item,{label:"RPM Limit",name:"rpm_limit",children:(0,t.jsx)($.Z,{min:0})}),(0,t.jsx)(G.Z,{type:"rpm",name:"rpm_limit_type",showDetailedDescriptions:!1}),(0,t.jsx)(c.Z.Item,{label:"Max Parallel Requests",name:"max_parallel_requests",children:(0,t.jsx)($.Z,{min:0})}),(0,t.jsx)(c.Z.Item,{label:"Model TPM Limit",name:"model_tpm_limit",children:(0,t.jsx)(V.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,t.jsx)(c.Z.Item,{label:"Model RPM Limit",name:"model_rpm_limit",children:(0,t.jsx)(V.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,t.jsx)(c.Z.Item,{label:"Guardrails",name:"guardrails",children:A&&(0,t.jsx)(R.Z,{onChange:e=>{M.setFieldValue("guardrails",e)},accessToken:A,disabled:!P})}),(0,t.jsx)(c.Z.Item,{label:(0,t.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,t.jsx)(u.Z,{title:"When enabled, this key will bypass any guardrails configured to run on every request (global guardrails)",children:(0,t.jsx)(Y.Z,{style:{marginLeft:"4px"}})})]}),name:"disable_global_guardrails",valuePropName:"checked",children:(0,t.jsx)(K.Z,{disabled:!P,checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(c.Z.Item,{label:"Tags",name:"tags",children:(0,t.jsx)(z.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter tags",options:Object.values(es).map(e=>({value:e.name,label:e.name,title:e.description||e.name}))})}),(0,t.jsx)(c.Z.Item,{label:"Prompts",name:"prompts",children:(0,t.jsx)(u.Z,{title:P?"":"Setting prompts by key is a premium feature",placement:"top",children:(0,t.jsx)(z.default,{mode:"tags",style:{width:"100%"},disabled:!P,placeholder:P?Array.isArray(null===(v=y.metadata)||void 0===v?void 0:v.prompts)&&y.metadata.prompts.length>0?"Current: ".concat(y.metadata.prompts.join(", ")):"Select or enter prompts":"Premium feature - Upgrade to set prompts by key",options:E.map(e=>({value:e,label:e}))})})}),(0,t.jsx)(c.Z.Item,{label:"Allowed Pass Through Routes",name:"allowed_passthrough_routes",children:(0,t.jsx)(u.Z,{title:P?"":"Setting allowed pass through routes by key is a premium feature",placement:"top",children:(0,t.jsx)(U.Z,{onChange:e=>M.setFieldValue("allowed_passthrough_routes",e),value:M.getFieldValue("allowed_passthrough_routes"),accessToken:A||"",placeholder:P?Array.isArray(null===(b=y.metadata)||void 0===b?void 0:b.allowed_passthrough_routes)&&y.metadata.allowed_passthrough_routes.length>0?"Current: ".concat(y.metadata.allowed_passthrough_routes.join(", ")):"Select or enter allowed pass through routes":"Premium feature - Upgrade to set allowed pass through routes by key",disabled:!P})})}),(0,t.jsx)(c.Z.Item,{label:"Vector Stores",name:"vector_stores",children:(0,t.jsx)(X.Z,{onChange:e=>M.setFieldValue("vector_stores",e),value:M.getFieldValue("vector_stores"),accessToken:A||"",placeholder:"Select vector stores"})}),(0,t.jsx)(c.Z.Item,{label:"MCP Servers / Access Groups",name:"mcp_servers_and_groups",children:(0,t.jsx)(B.Z,{onChange:e=>M.setFieldValue("mcp_servers_and_groups",e),value:M.getFieldValue("mcp_servers_and_groups"),accessToken:A||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(c.Z.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(V.default,{type:"hidden"})}),(0,t.jsx)(c.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.mcp_servers_and_groups!==s.mcp_servers_and_groups||e.mcp_tool_permissions!==s.mcp_tool_permissions,children:()=>{var e;return(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)(W.Z,{accessToken:A||"",selectedServers:(null===(e=M.getFieldValue("mcp_servers_and_groups"))||void 0===e?void 0:e.servers)||[],toolPermissions:M.getFieldValue("mcp_tool_permissions")||{},onChange:e=>M.setFieldsValue({mcp_tool_permissions:e})})})}}),(0,t.jsx)(c.Z.Item,{label:"Agents / Access Groups",name:"agents_and_groups",children:(0,t.jsx)(q.Z,{onChange:e=>M.setFieldValue("agents_and_groups",e),value:M.getFieldValue("agents_and_groups"),accessToken:A||"",placeholder:"Select agents or access groups (optional)"})}),(0,t.jsx)(c.Z.Item,{label:"Team ID",name:"team_id",children:(0,t.jsx)(z.default,{placeholder:"Select team",style:{width:"100%"},children:null==Z?void 0:Z.map(e=>(0,t.jsx)(z.default.Option,{value:e.team_id,children:"".concat(e.team_alias," (").concat(e.team_id,")")},e.team_id))})}),(0,t.jsx)(c.Z.Item,{label:"Logging Settings",name:"logging_settings",children:(0,t.jsx)(Q.Z,{value:M.getFieldValue("logging_settings"),onChange:e=>M.setFieldValue("logging_settings",e),disabledCallbacks:ec,onDisabledCallbacksChange:e=>{em((0,j.PA)(e)),M.setFieldValue("disabled_callbacks",e)}})}),(0,t.jsx)(c.Z.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(V.default.TextArea,{rows:10})}),(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(O.Z,{form:M,autoRotationEnabled:eu,onAutoRotationChange:ex,rotationInterval:eg,onRotationIntervalChange:eh}),(0,t.jsx)(c.Z.Item,{name:"duration",hidden:!0,initialValue:"",children:(0,t.jsx)(V.default,{})})]}),(0,t.jsx)(c.Z.Item,{name:"token",hidden:!0,children:(0,t.jsx)(V.default,{})}),(0,t.jsx)(c.Z.Item,{name:"allowed_routes",hidden:!0,children:(0,t.jsx)(V.default,{})}),(0,t.jsx)(c.Z.Item,{name:"disabled_callbacks",hidden:!0,children:(0,t.jsx)(V.default,{})}),(0,t.jsx)(c.Z.Item,{name:"auto_rotate",hidden:!0,children:(0,t.jsx)(V.default,{})}),(0,t.jsx)(c.Z.Item,{name:"rotation_interval",hidden:!0,children:(0,t.jsx)(V.default,{})}),(0,t.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,t.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,t.jsx)(F.z,{variant:"secondary",onClick:_,disabled:ep,children:"Cancel"}),(0,t.jsx)(F.z,{type:"submit",loading:ep,children:"Save Changes"})]})})]})}function es(e){var s,a,v,b,_,f,I,L;let{keyId:P,onClose:M,keyData:D,accessToken:R,userID:F,userRole:z,teams:V,onKeyDataUpdate:K,onDelete:O,premiumUser:U,setAccessToken:G,backButtonText:B="Back to Keys"}=e,[W,q]=(0,h.useState)(!1),[J]=c.Z.useForm(),[$,Q]=(0,h.useState)(!1),[X,Y]=(0,h.useState)(""),[H,es]=(0,h.useState)(!1),[ea,et]=(0,h.useState)({}),[el,er]=(0,h.useState)(D),[ei,en]=(0,h.useState)(null),[ed,eo]=(0,h.useState)(!1);if((0,h.useEffect)(()=>{D&&er(D)},[D]),(0,h.useEffect)(()=>{if(ed){let e=setTimeout(()=>{eo(!1)},5e3);return()=>clearTimeout(e)}},[ed]),!el)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(o.zx,{icon:i.Z,variant:"light",onClick:M,className:"mb-4",children:B}),(0,t.jsx)(o.xv,{children:"Key not found"})]});let ec=async e=>{try{var s,a,t,l;if(!R)return;let i=e.token;if(e.key=i,U||(delete e.guardrails,delete e.prompts),e.max_budget=(0,r.C)(e.max_budget),void 0!==e.vector_stores&&(e.object_permission={...el.object_permission,vector_stores:e.vector_stores||[]},delete e.vector_stores),void 0!==e.mcp_servers_and_groups){let{servers:s,accessGroups:a}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]};e.object_permission={...el.object_permission,mcp_servers:s||[],mcp_access_groups:a||[]},delete e.mcp_servers_and_groups}if(void 0!==e.mcp_tool_permissions){let s=e.mcp_tool_permissions||{};Object.keys(s).length>0&&(e.object_permission={...e.object_permission,mcp_tool_permissions:s}),delete e.mcp_tool_permissions}if(void 0!==e.agents_and_groups){let{agents:s,accessGroups:a}=e.agents_and_groups||{agents:[],accessGroups:[]};e.object_permission={...e.object_permission,agents:s||[],agent_access_groups:a||[]},delete e.agents_and_groups}if(e.max_budget=(0,r.C)(e.max_budget),e.tpm_limit=(0,r.C)(e.tpm_limit),e.rpm_limit=(0,r.C)(e.rpm_limit),e.max_parallel_requests=(0,r.C)(e.max_parallel_requests),e.metadata&&"string"==typeof e.metadata)try{let t=JSON.parse(e.metadata);"tags"in t&&delete t.tags,e.metadata={...t,...Array.isArray(e.tags)&&e.tags.length>0?{tags:e.tags}:{},...(null===(s=e.guardrails)||void 0===s?void 0:s.length)>0?{guardrails:e.guardrails}:{},...e.logging_settings?{logging:e.logging_settings}:{},...(null===(a=e.disabled_callbacks)||void 0===a?void 0:a.length)>0?{litellm_disabled_callbacks:(0,j.Z3)(e.disabled_callbacks)}:{}}}catch(e){console.error("Error parsing metadata JSON:",e),S.Z.error("Invalid metadata JSON");return}else{let{tags:s,...a}=e.metadata||{};e.metadata={...a,...Array.isArray(e.tags)&&e.tags.length>0?{tags:e.tags}:{},...(null===(t=e.guardrails)||void 0===t?void 0:t.length)>0?{guardrails:e.guardrails}:{},...e.logging_settings?{logging:e.logging_settings}:{},...(null===(l=e.disabled_callbacks)||void 0===l?void 0:l.length)>0?{litellm_disabled_callbacks:(0,j.Z3)(e.disabled_callbacks)}:{}}}"tags"in e&&delete e.tags,delete e.logging_settings,e.budget_duration&&(e.budget_duration=({daily:"24h",weekly:"7d",monthly:"30d"})[e.budget_duration]);let n=await (0,C.keyUpdateCall)(R,e);er(e=>e?{...e,...n}:void 0),K&&K(n),S.Z.success("Key updated successfully"),q(!1)}catch(e){S.Z.fromBackend((0,E.O)(e)),console.error("Error updating key:",e)}},em=async()=>{try{if(!R)return;await (0,C.keyDeleteCall)(R,el.token||el.token_id),S.Z.success("Key deleted successfully"),O&&O(),M()}catch(e){console.error("Error deleting the key:",e),S.Z.fromBackend(e)}Y("")},eu=async(e,s)=>{await (0,l.vQ)(e)&&(et(e=>({...e,[s]:!0})),setTimeout(()=>{et(e=>({...e,[s]:!1}))},2e3))},ex=e=>{let s=new Date(e),a=s.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),t=s.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return"".concat(a," at ").concat(t)};return(0,t.jsxs)("div",{className:"w-full h-screen p-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(o.zx,{icon:i.Z,variant:"light",onClick:M,className:"mb-4",children:B}),(0,t.jsx)(o.Dx,{children:el.key_alias||"Virtual Key"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer mb-2 space-y-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"text-xs text-gray-400 uppercase tracking-wide mt-2",children:"Key ID"}),(0,t.jsx)(o.xv,{className:"text-gray-500 font-mono text-sm",children:el.token_id||el.token})]}),(0,t.jsx)(m.ZP,{type:"text",size:"small",icon:ea["key-id"]?(0,t.jsx)(x.Z,{size:12}):(0,t.jsx)(g.Z,{size:12}),onClick:()=>eu(el.token_id||el.token,"key-id"),className:"ml-2 transition-all duration-200".concat(ea["key-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,t.jsx)(o.xv,{className:"text-sm text-gray-500",children:el.updated_at&&el.updated_at!==el.created_at?"Updated: ".concat(ex(el.updated_at)):"Created: ".concat(ex(el.created_at))}),ed&&(0,t.jsx)(o.Ct,{color:"green",size:"xs",className:"animate-pulse",children:"Recently Regenerated"}),ei&&(0,t.jsx)(o.Ct,{color:"blue",size:"xs",children:"Regenerated"})]})]}),z&&p.LQ.includes(z)&&(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(u.Z,{title:U?"":"This is a LiteLLM Enterprise feature, and requires a valid key to use.",children:(0,t.jsx)("span",{className:"inline-block",children:(0,t.jsx)(o.zx,{icon:n.Z,variant:"secondary",onClick:()=>es(!0),className:"flex items-center",disabled:!U,children:"Regenerate Key"})})}),(0,t.jsx)(o.zx,{icon:d.Z,variant:"secondary",onClick:()=>Q(!0),className:"flex items-center text-red-500 border-red-500 hover:text-red-700",children:"Delete Key"})]})]}),(0,t.jsx)(T,{selectedToken:el,visible:H,onClose:()=>es(!1),accessToken:R,premiumUser:U,setAccessToken:G,onKeyUpdate:e=>{er(s=>{if(s)return{...s,...e,created_at:new Date().toLocaleString()}}),en(new Date),eo(!0),K&&K({...e,created_at:new Date().toLocaleString()})}}),$&&(()=>{let e=(null==el?void 0:el.key_alias)||(null==el?void 0:el.token_id)||"Virtual Key",s=X===e;return(0,t.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-2xl min-h-[380px] py-6 overflow-hidden transform transition-all flex flex-col justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200",children:[(0,t.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Delete Key"}),(0,t.jsx)("button",{onClick:()=>{Q(!1),Y("")},className:"text-gray-400 hover:text-gray-500 focus:outline-none",children:(0,t.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,t.jsxs)("div",{className:"px-6 py-4",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-red-50 border border-red-100 rounded-md mb-5",children:[(0,t.jsx)("div",{className:"text-red-500 mt-0.5",children:(0,t.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-base font-medium text-red-600",children:"Warning: You are about to delete this Virtual Key."}),(0,t.jsx)("p",{className:"text-base text-red-600 mt-2",children:"This action is irreversible and will immediately revoke access for any applications using this key."})]})]}),(0,t.jsx)("p",{className:"text-base text-gray-600 mb-5",children:"Are you sure you want to delete this Virtual Key?"}),(0,t.jsxs)("div",{className:"mb-5",children:[(0,t.jsxs)("label",{className:"block text-base font-medium text-gray-700 mb-2",children:["Type ",(0,t.jsx)("span",{className:"underline",children:e})," to confirm deletion:"]}),(0,t.jsx)("input",{type:"text",value:X,onChange:e=>Y(e.target.value),placeholder:"Enter key name exactly",className:"w-full px-4 py-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-base",autoFocus:!0})]})]})]}),(0,t.jsxs)("div",{className:"px-6 py-4 bg-gray-50 flex justify-end gap-4",children:[(0,t.jsx)("button",{onClick:()=>{Q(!1),Y("")},className:"px-5 py-3 bg-white border border-gray-300 rounded-md text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:"Cancel"}),(0,t.jsx)("button",{onClick:em,disabled:!s,className:"px-5 py-3 rounded-md text-base font-medium text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 ".concat(s?"bg-red-600 hover:bg-red-700":"bg-red-300 cursor-not-allowed"),children:"Delete Key"})]})]})})})(),(0,t.jsxs)(o.v0,{children:[(0,t.jsxs)(o.td,{className:"mb-4",children:[(0,t.jsx)(o.OK,{children:"Overview"}),(0,t.jsx)(o.OK,{children:"Settings"})]}),(0,t.jsxs)(o.nP,{children:[(0,t.jsx)(o.x4,{children:(0,t.jsxs)(o.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(o.Zb,{children:[(0,t.jsx)(o.xv,{children:"Spend"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(o.Dx,{children:["$",(0,l.pw)(el.spend,4)]}),(0,t.jsxs)(o.xv,{children:["of"," ",null!==el.max_budget?"$".concat((0,l.pw)(el.max_budget)):"Unlimited"]})]})]}),(0,t.jsxs)(o.Zb,{children:[(0,t.jsx)(o.xv,{children:"Rate Limits"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(o.xv,{children:["TPM: ",null!==el.tpm_limit?el.tpm_limit:"Unlimited"]}),(0,t.jsxs)(o.xv,{children:["RPM: ",null!==el.rpm_limit?el.rpm_limit:"Unlimited"]})]})]}),(0,t.jsxs)(o.Zb,{children:[(0,t.jsx)(o.xv,{children:"Models"}),(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:el.models&&el.models.length>0?el.models.map((e,s)=>(0,t.jsx)(o.Ct,{color:"red",children:e},s)):(0,t.jsx)(o.xv,{children:"No models specified"})})]}),(0,t.jsx)(o.Zb,{children:(0,t.jsx)(A.Z,{objectPermission:el.object_permission,variant:"inline",accessToken:R})}),(0,t.jsx)(Z.Z,{loggingConfigs:N(el.metadata),disabledCallbacks:Array.isArray(null===(s=el.metadata)||void 0===s?void 0:s.litellm_disabled_callbacks)?(0,j.PA)(el.metadata.litellm_disabled_callbacks):[],variant:"card"}),(0,t.jsx)(y,{autoRotate:el.auto_rotate,rotationInterval:el.rotation_interval,lastRotationAt:el.last_rotation_at,keyRotationAt:el.key_rotation_at,nextRotationAt:el.next_rotation_at,variant:"card"})]})}),(0,t.jsx)(o.x4,{children:(0,t.jsxs)(o.Zb,{className:"overflow-y-auto max-h-[65vh]",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(o.Dx,{children:"Key Settings"}),!W&&z&&p.LQ.includes(z)&&(0,t.jsx)(o.zx,{onClick:()=>q(!0),children:"Edit Settings"})]}),W?(0,t.jsx)(ee,{keyData:el,onCancel:()=>q(!1),onSubmit:ec,teams:V,accessToken:R,userID:F,userRole:z,premiumUser:U}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Key ID"}),(0,t.jsx)(o.xv,{className:"font-mono",children:el.token_id||el.token})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Key Alias"}),(0,t.jsx)(o.xv,{children:el.key_alias||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Secret Key"}),(0,t.jsx)(o.xv,{className:"font-mono",children:el.key_name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Team ID"}),(0,t.jsx)(o.xv,{children:el.team_id||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Organization"}),(0,t.jsx)(o.xv,{children:el.organization_id||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Created"}),(0,t.jsx)(o.xv,{children:ex(el.created_at)})]}),ei&&(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Last Regenerated"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(o.xv,{children:ex(ei)}),(0,t.jsx)(o.Ct,{color:"green",size:"xs",children:"Recent"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Expires"}),(0,t.jsx)(o.xv,{children:el.expires?ex(el.expires):"Never"})]}),(0,t.jsx)(y,{autoRotate:el.auto_rotate,rotationInterval:el.rotation_interval,lastRotationAt:el.last_rotation_at,keyRotationAt:el.key_rotation_at,nextRotationAt:el.next_rotation_at,variant:"inline",className:"pt-4 border-t border-gray-200"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Spend"}),(0,t.jsxs)(o.xv,{children:["$",(0,l.pw)(el.spend,4)," USD"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Budget"}),(0,t.jsx)(o.xv,{children:null!==el.max_budget?"$".concat((0,l.pw)(el.max_budget,2)):"Unlimited"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Tags"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:Array.isArray(null===(a=el.metadata)||void 0===a?void 0:a.tags)&&el.metadata.tags.length>0?el.metadata.tags.map((e,s)=>(0,t.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No tags specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Prompts"}),(0,t.jsx)(o.xv,{children:Array.isArray(null===(v=el.metadata)||void 0===v?void 0:v.prompts)&&el.metadata.prompts.length>0?el.metadata.prompts.map((e,s)=>(0,t.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No prompts specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Allowed Pass Through Routes"}),(0,t.jsx)(o.xv,{children:Array.isArray(null===(b=el.metadata)||void 0===b?void 0:b.allowed_passthrough_routes)&&el.metadata.allowed_passthrough_routes.length>0?el.metadata.allowed_passthrough_routes.map((e,s)=>(0,t.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No pass through routes specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Disable Global Guardrails"}),(0,t.jsx)(o.xv,{children:(null===(_=el.metadata)||void 0===_?void 0:_.disable_global_guardrails)===!0?(0,t.jsx)(o.Ct,{color:"yellow",children:"Enabled - Global guardrails bypassed"}):(0,t.jsx)(o.Ct,{color:"green",children:"Disabled - Global guardrails active"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:el.models&&el.models.length>0?el.models.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):(0,t.jsx)(o.xv,{children:"No models specified"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Rate Limits"}),(0,t.jsxs)(o.xv,{children:["TPM: ",null!==el.tpm_limit?el.tpm_limit:"Unlimited"]}),(0,t.jsxs)(o.xv,{children:["RPM: ",null!==el.rpm_limit?el.rpm_limit:"Unlimited"]}),(0,t.jsxs)(o.xv,{children:["Max Parallel Requests:"," ",null!==el.max_parallel_requests?el.max_parallel_requests:"Unlimited"]}),(0,t.jsxs)(o.xv,{children:["Model TPM Limits:"," ",(null===(f=el.metadata)||void 0===f?void 0:f.model_tpm_limit)?JSON.stringify(el.metadata.model_tpm_limit):"Unlimited"]}),(0,t.jsxs)(o.xv,{children:["Model RPM Limits:"," ",(null===(I=el.metadata)||void 0===I?void 0:I.model_rpm_limit)?JSON.stringify(el.metadata.model_rpm_limit):"Unlimited"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Metadata"}),(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:k(w(el.metadata))})]}),(0,t.jsx)(A.Z,{objectPermission:el.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:R}),(0,t.jsx)(Z.Z,{loggingConfigs:N(el.metadata),disabledCallbacks:Array.isArray(null===(L=el.metadata)||void 0===L?void 0:L.litellm_disabled_callbacks)?(0,j.PA)(el.metadata.litellm_disabled_callbacks):[],variant:"inline",className:"pt-4 border-t border-gray-200"})]})]})})]})]})]})}},33304:function(e,s,a){a.d(s,{C:function(){return t}});function t(e){return""===e?null:e}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4679-12d9b222cdd9a545.js b/litellm/proxy/_experimental/out/_next/static/chunks/4679-215ebca3cb2114ee.js similarity index 57% rename from litellm/proxy/_experimental/out/_next/static/chunks/4679-12d9b222cdd9a545.js rename to litellm/proxy/_experimental/out/_next/static/chunks/4679-215ebca3cb2114ee.js index c1f5234455..527a20e2fc 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/4679-12d9b222cdd9a545.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/4679-215ebca3cb2114ee.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4679],{95704:function(e,t,a){a.d(t,{Dx:function(){return u.Z},RM:function(){return l.Z},SC:function(){return o.Z},Zb:function(){return s.Z},iA:function(){return r.Z},pj:function(){return n.Z},ss:function(){return i.Z},xs:function(){return c.Z},xv:function(){return d.Z}});var s=a(12514),r=a(21626),l=a(97214),n=a(28241),i=a(58834),c=a(69552),o=a(71876),d=a(84264),u=a(96761)},92280:function(e,t,a){a.d(t,{x:function(){return s.Z}});var s=a(84264)},56522:function(e,t,a){a.d(t,{o:function(){return r.Z},x:function(){return s.Z}});var s=a(84264),r=a(49566)},39760:function(e,t,a){var s=a(2265),r=a(99376),l=a(14474),n=a(3914);t.Z=()=>{var e,t,a,i,c,o;let d=(0,r.useRouter)(),u="undefined"!=typeof document?(0,n.e)("token"):null;(0,s.useEffect)(()=>{u||d.replace("/sso/key/generate")},[u,d]);let m=(0,s.useMemo)(()=>{if(!u)return null;try{return(0,l.o)(u)}catch(e){return(0,n.b)(),d.replace("/sso/key/generate"),null}},[u,d]);return{token:u,accessToken:null!==(e=null==m?void 0:m.key)&&void 0!==e?e:null,userId:null!==(t=null==m?void 0:m.user_id)&&void 0!==t?t:null,userEmail:null!==(a=null==m?void 0:m.user_email)&&void 0!==a?a:null,userRole:function(e){if(!e)return"Undefined Role";switch(e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(null!==(i=null==m?void 0:m.user_role)&&void 0!==i?i:null),premiumUser:null!==(c=null==m?void 0:m.premium_user)&&void 0!==c?c:null,disabledPersonalKeyCreation:null!==(o=null==m?void 0:m.disabled_non_admin_personal_key_creation)&&void 0!==o?o:null,showSSOBanner:(null==m?void 0:m.login_method)==="username_password"}}},82586:function(e,t,a){var s=a(57437),r=a(2265),l=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:c,placeholder:o="Select agents",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[p,g]=(0,r.useState)([]),[x,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{if(c){h(!0);try{let e=await (0,n.getAgentsList)(c),t=(null==e?void 0:e.agents)||[];m(t);let a=new Set;t.forEach(e=>{let t=e.agent_access_groups;t&&Array.isArray(t)&&t.forEach(e=>a.add(e))}),g(Array.from(a))}catch(e){console.error("Error fetching agents:",e)}finally{h(!1)}}})()},[c]);let f=[...p.map(e=>({label:e,value:"group:".concat(e),isAccessGroup:!0,searchText:"".concat(e," Access Group")})),...u.map(e=>({label:"".concat(e.agent_name||e.agent_id),value:e.agent_id,isAccessGroup:!1,searchText:"".concat(e.agent_name||e.agent_id," ").concat(e.agent_id," Agent")}))],v=[...(null==a?void 0:a.agents)||[],...((null==a?void 0:a.accessGroups)||[]).map(e=>"group:".concat(e))];return(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:o,onChange:e=>{t({agents:e.filter(e=>!e.startsWith("group:")),accessGroups:e.filter(e=>e.startsWith("group:")).map(e=>e.replace("group:",""))})},value:v,loading:x,className:i,showSearch:!0,style:{width:"100%"},disabled:d,filterOption:(e,t)=>{var a;return((null===(a=f.find(e=>e.value===(null==t?void 0:t.value)))||void 0===a?void 0:a.searchText)||"").toLowerCase().includes(e.toLowerCase())},children:f.map(e=>(0,s.jsx)(l.default.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#722ed1",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#722ed1",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"Agent"})]})},e.value))})})}},97434:function(e,t,a){a.d(t,{Dg:function(){return l},Lo:function(){return n},PA:function(){return o},RD:function(){return i},Z3:function(){return c}});let s="../ui/assets/logos/",r=[{id:"arize",displayName:"Arize",logo:"".concat(s,"arize.png"),supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_id:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:"".concat(s,"braintrust.png"),supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:"".concat(s,"custom.svg"),supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:"".concat(s,"datadog.png"),supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:"".concat(s,"lago.svg"),supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:"".concat(s,"langsmith.png"),supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:"".concat(s,"openmeter.png"),supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:"".concat(s,"otel.png"),supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:"".concat(s,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"},{id:"SQS",displayName:"SQS",logo:"".concat(s,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{sqs_queue_url:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"SQS Queue (AWS) Logging Integration"}],l=r.reduce((e,t)=>(e[t.displayName]=t,e),{}),n=r.reduce((e,t)=>(e[t.displayName]=t.id,e),{}),i=r.reduce((e,t)=>(e[t.id]=t.displayName,e),{}),c=e=>e.map(e=>n[e]||e),o=e=>e.map(e=>i[e]||e)},95096:function(e,t,a){var s=a(57437),r=a(2265),l=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:c,placeholder:o="Select pass through routes",disabled:d=!1,teamId:u}=e,[m,p]=(0,r.useState)([]),[g,x]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(c){x(!0);try{let e=await (0,n.getPassThroughEndpointsCall)(c,u);if(e.endpoints){let t=e.endpoints.map(e=>e.path);p(t)}}catch(e){console.error("Error fetching pass through routes:",e)}finally{x(!1)}}})()},[c,u]),(0,s.jsx)(l.default,{mode:"tags",placeholder:o,onChange:t,value:a,loading:g,className:i,options:m.map(e=>({label:e,value:e})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})}},46468:function(e,t,a){a.d(t,{K2:function(){return r},Ob:function(){return n},W0:function(){return l}});var s=a(19250);let r=async(e,t,a)=>{try{if(null===e||null===t)return;if(null!==a){let r=(await (0,s.modelAvailableCall)(a,e,t,!0,null,!0)).data.map(e=>e.id),l=[],n=[];return r.forEach(e=>{e.endsWith("/*")?l.push(e):n.push(e)}),[...l,...n]}}catch(e){console.error("Error fetching user models:",e)}},l=e=>{if(e.endsWith("/*")){let t=e.replace("/*","");return"All ".concat(t," models")}return e},n=(e,t)=>{let a=[],s=[];return console.log("teamModels",e),console.log("allModels",t),e.forEach(e=>{if(e.endsWith("/*")){let r=e.replace("/*",""),l=t.filter(e=>e.startsWith(r+"/"));s.push(...l),a.push(e)}else s.push(e)}),[...a,...s].filter((e,t,a)=>a.indexOf(e)===t)}},95920:function(e,t,a){var s=a(57437),r=a(2265),l=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:c,placeholder:o="Select MCP servers",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[p,g]=(0,r.useState)([]),[x,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{if(c){h(!0);try{let[e,t]=await Promise.all([(0,n.fetchMCPServers)(c),(0,n.fetchMCPAccessGroups)(c)]),a=Array.isArray(e)?e:e.data||[],s=Array.isArray(t)?t:t.data||[];m(a),g(s)}catch(e){console.error("Error fetching MCP servers or access groups:",e)}finally{h(!1)}}})()},[c]);let f=[...p.map(e=>({label:e,value:e,isAccessGroup:!0,searchText:"".concat(e," Access Group")})),...u.map(e=>({label:"".concat(e.server_name||e.server_id," (").concat(e.server_id,")"),value:e.server_id,isAccessGroup:!1,searchText:"".concat(e.server_name||e.server_id," ").concat(e.server_id," MCP Server")}))],v=[...(null==a?void 0:a.servers)||[],...(null==a?void 0:a.accessGroups)||[]];return(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:o,onChange:e=>{t({servers:e.filter(e=>!p.includes(e)),accessGroups:e.filter(e=>p.includes(e))})},value:v,loading:x,className:i,showSearch:!0,style:{width:"100%"},disabled:d,filterOption:(e,t)=>{var a;return((null===(a=f.find(e=>e.value===(null==t?void 0:t.value)))||void 0===a?void 0:a.searchText)||"").toLowerCase().includes(e.toLowerCase())},children:f.map(e=>(0,s.jsx)(l.default.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#1890ff",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#1890ff",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"MCP Server"})]})},e.value))})})}},68473:function(e,t,a){var s=a(57437),r=a(2265),l=a(19250),n=a(92280),i=a(10353),c=a(61994),o=a(32489);t.Z=e=>{let{accessToken:t,selectedServers:a,toolPermissions:d,onChange:u,disabled:m=!1}=e,[p,g]=(0,r.useState)([]),[x,h]=(0,r.useState)({}),[f,v]=(0,r.useState)({}),[_,y]=(0,r.useState)({});(0,r.useEffect)(()=>{(async()=>{if(0===a.length){g([]);return}try{let e=await (0,l.fetchMCPServers)(t),s=(Array.isArray(e)?e:e.data||[]).filter(e=>a.includes(e.server_id));g(s)}catch(e){console.error("Error fetching MCP servers:",e),g([])}})()},[a,t]);let b=async e=>{v(t=>({...t,[e]:!0})),y(t=>({...t,[e]:""}));try{let a=await (0,l.listMCPTools)(t,e);a.error?(y(t=>({...t,[e]:a.message||"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))):h(t=>({...t,[e]:a.tools||[]}))}catch(t){console.error("Error fetching tools for server ".concat(e,":"),t),y(t=>({...t,[e]:"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))}finally{v(t=>({...t,[e]:!1}))}};(0,r.useEffect)(()=>{p.forEach(e=>{x[e.server_id]||f[e.server_id]||b(e.server_id)})},[p]);let j=(e,t)=>{let a=d[e]||[],s=a.includes(t)?a.filter(e=>e!==t):[...a,t];u({...d,[e]:s})},N=e=>{let t=x[e]||[];u({...d,[e]:t.map(e=>e.name)})},w=e=>{u({...d,[e]:[]})};return 0===a.length?null:(0,s.jsx)("div",{className:"space-y-4",children:p.map(e=>{let t=e.server_name||e.alias||e.server_id,a=x[e.server_id]||[],r=d[e.server_id]||[],l=f[e.server_id],u=_[e.server_id];return(0,s.jsxs)("div",{className:"border rounded-lg bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border-b bg-white rounded-t-lg",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.x,{className:"font-semibold text-gray-900",children:t}),e.description&&(0,s.jsx)(n.x,{className:"text-sm text-gray-500",children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>N(e.server_id),disabled:m||l,children:"Select All"}),(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>w(e.server_id),disabled:m||l,children:"Deselect All"}),(0,s.jsx)("button",{className:"text-gray-400 hover:text-gray-600",onClick:()=>{},children:(0,s.jsx)(o.Z,{className:"w-4 h-4"})})]})]}),(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(n.x,{className:"text-sm font-medium text-gray-700 mb-3",children:"Available Tools"}),l&&(0,s.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,s.jsx)(i.Z,{size:"large"}),(0,s.jsx)(n.x,{className:"ml-3 text-gray-500",children:"Loading tools..."})]}),u&&!l&&(0,s.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-center",children:[(0,s.jsx)(n.x,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,s.jsx)(n.x,{className:"text-sm text-red-500 mt-1",children:u})]}),!l&&!u&&a.length>0&&(0,s.jsx)("div",{className:"space-y-2",children:a.map(t=>{let a=r.includes(t.name);return(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(c.Z,{checked:a,onChange:()=>j(e.server_id,t.name),disabled:m}),(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(n.x,{className:"font-medium text-gray-900",children:t.name}),(0,s.jsxs)(n.x,{className:"text-sm text-gray-500",children:["- ",t.description||"No description"]})]})})]},t.name)})}),!l&&!u&&0===a.length&&(0,s.jsx)("div",{className:"text-center py-6",children:(0,s.jsx)(n.x,{className:"text-gray-500",children:"No tools available"})})]})]},e.server_id)})})}},10703:function(e,t,a){a.d(t,{p:function(){return r}});var s=a(19250);let r=async e=>{try{let t=await (0,s.modelHubCall)(e);if(console.log("model_info:",t),(null==t?void 0:t.data.length)>0){let e=t.data.map(e=>({model_group:e.model_group,mode:null==e?void 0:e.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}}},24199:function(e,t,a){a.d(t,{Z:function(){return l}});var s=a(57437);a(2265);var r=a(30150),l=e=>{let{step:t=.01,style:a={width:"100%"},placeholder:l="Enter a numerical value",min:n,max:i,onChange:c,...o}=e;return(0,s.jsx)(r.Z,{onWheel:e=>e.currentTarget.blur(),step:t,style:a,placeholder:l,min:n,max:i,onChange:c,...o})}},54507:function(e,t,a){a.d(t,{Z:function(){return v}});var s=a(57437);a(2265);var r=a(37592),l=a(99981),n=a(23496),i=a(15424),c=a(78489),o=a(12514),d=a(49566),u=a(91777),m=a(82182),p=a(22452),g=a(74998),x=a(97434),h=a(24199);let{Option:f}=r.default;var v=e=>{let{value:t=[],onChange:a,disabledCallbacks:v=[],onDisabledCallbacksChange:_}=e,y=Object.entries(x.Dg).filter(e=>{let[t,a]=e;return a.supports_key_team_logging}).map(e=>{let[t,a]=e;return t}),b=Object.keys(x.Dg),j=e=>{null==a||a(e)},N=e=>{j(t.filter((t,a)=>a!==e))},w=(e,a,s)=>{let r=[...t];if("callback_name"===a){let t=x.Lo[s]||s;r[e]={...r[e],[a]:t,callback_vars:{}}}else r[e]={...r[e],[a]:s};j(r)},k=(e,a,s)=>{let r=[...t];r[e]={...r[e],callback_vars:{...r[e].callback_vars,[a]:s}},j(r)},C=(e,t)=>{var a,r;if(!e.callback_name)return null;let n=null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0];if(!n)return null;let c=(null===(r=x.Dg[n])||void 0===r?void 0:r.dynamic_params)||{};return 0===Object.keys(c).length?null:(0,s.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2 mb-4",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-blue-100 rounded-full flex items-center justify-center",children:(0,s.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full"})}),(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Integration Parameters"})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(c).map(a=>{let[r,n]=a;return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"text-sm font-medium text-gray-700 capitalize flex items-center space-x-1",children:[(0,s.jsx)("span",{children:r.replace(/_/g," ")}),(0,s.jsx)(l.Z,{title:"Environment variable reference recommended: os.environ/".concat(r.toUpperCase()),children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help text-xs"})}),"password"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Sensitive"}),"number"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Number"})]}),"number"===n&&(0,s.jsx)("span",{className:"text-xs text-gray-500",children:"Value must be between 0 and 1"}),"number"===n?(0,s.jsx)(h.Z,{step:.01,width:400,placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)}):(0,s.jsx)(d.Z,{type:"password"===n?"password":"text",placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)})]},r)})})]})};return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(u.Z,{className:"w-5 h-5 text-red-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Disabled Callbacks"}),(0,s.jsx)(l.Z,{title:"Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Disabled Callbacks"}),(0,s.jsx)(r.default,{mode:"multiple",placeholder:"Select callbacks to disable",value:v,onChange:e=>{let t=(0,x.Z3)(e);null==_||_(t)},style:{width:"100%"},optionLabelProp:"label",children:b.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"Select callbacks that should be disabled for this key. These callbacks will not receive any logging data."})]})]}),(0,s.jsx)(n.Z,{}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(m.Z,{className:"w-5 h-5 text-blue-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Logging Integrations"}),(0,s.jsx)(l.Z,{title:"Configure callback logging integrations for this team.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsx)(c.Z,{variant:"secondary",onClick:()=>{j([...t,{callback_name:"",callback_type:"success",callback_vars:{}}])},icon:p.Z,size:"sm",className:"hover:border-blue-400 hover:text-blue-500",type:"button",children:"Add Integration"})]}),(0,s.jsx)("div",{className:"space-y-4",children:t.map((e,t)=>{var a,n;let i=e.callback_name?null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0]:void 0,d=i?null===(n=x.Dg[i])||void 0===n?void 0:n.logo:null;return(0,s.jsxs)(o.Z,{className:"border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200",decoration:"top",decorationColor:"blue",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[d&&(0,s.jsx)("img",{src:d,alt:i,className:"w-5 h-5 object-contain"}),(0,s.jsxs)("span",{className:"text-sm font-medium",children:[i||"New Integration"," Configuration"]})]}),(0,s.jsx)(c.Z,{variant:"light",onClick:()=>N(t),icon:g.Z,size:"xs",color:"red",className:"hover:bg-red-50",type:"button",children:"Remove"})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Integration Type"}),(0,s.jsx)(r.default,{value:i,placeholder:"Select integration",onChange:e=>w(t,"callback_name",e),className:"w-full",optionLabelProp:"label",children:y.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Event Type"}),(0,s.jsxs)(r.default,{value:e.callback_type,onChange:e=>w(t,"callback_type",e),className:"w-full",children:[(0,s.jsx)(f,{value:"success",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{children:"Success Only"})]})}),(0,s.jsx)(f,{value:"failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),(0,s.jsx)("span",{children:"Failure Only"})]})}),(0,s.jsx)(f,{value:"success_and_failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{children:"Success & Failure"})]})})]})]})]}),C(e,t)]})]},t)})}),0===t.length&&(0,s.jsxs)("div",{className:"text-center py-12 text-gray-500 border-2 border-dashed border-gray-200 rounded-lg bg-gray-50/50",children:[(0,s.jsx)(m.Z,{className:"w-12 h-12 text-gray-300 mb-3 mx-auto"}),(0,s.jsx)("div",{className:"text-base font-medium mb-1",children:"No logging integrations configured"}),(0,s.jsx)("div",{className:"text-sm text-gray-400",children:'Click "Add Integration" to configure logging for this team'})]})]})}},97415:function(e,t,a){var s=a(57437),r=a(2265),l=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:c,placeholder:o="Select vector stores",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[p,g]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(c){g(!0);try{let e=await (0,n.vectorStoreListCall)(c);e.data&&m(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{g(!1)}}})()},[c]),(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:o,onChange:t,value:a,loading:p,className:i,options:u.map(e=>({label:"".concat(e.vector_store_name||e.vector_store_id," (").concat(e.vector_store_id,")"),value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})})}},59872:function(e,t,a){a.d(t,{nl:function(){return r},pw:function(){return l},vQ:function(){return n}});var s=a(9114);function r(e,t){let a=structuredClone(e);for(let[e,s]of Object.entries(t))e in a&&(a[e]=s);return a}let l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(null==e||!Number.isFinite(e))return"-";let s={minimumFractionDigits:t,maximumFractionDigits:t};if(!a)return e.toLocaleString("en-US",s);let r=Math.abs(e),l=r,n="";return r>=1e6?(l=r/1e6,n="M"):r>=1e3&&(l=r/1e3,n="K"),"".concat(e<0?"-":"").concat(l.toLocaleString("en-US",s)).concat(n)},n=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Copied to clipboard";if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return i(e,t);try{return await navigator.clipboard.writeText(e),s.Z.success(t),!0}catch(a){return console.error("Clipboard API failed: ",a),i(e,t)}},i=(e,t)=>{try{let a=document.createElement("textarea");a.value=e,a.style.position="fixed",a.style.left="-999999px",a.style.top="-999999px",a.setAttribute("readonly",""),document.body.appendChild(a),a.focus(),a.select();let r=document.execCommand("copy");if(document.body.removeChild(a),r)return s.Z.success(t),!0;throw Error("execCommand failed")}catch(e){return s.Z.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}}},20347:function(e,t,a){a.d(t,{LQ:function(){return l},P4:function(){return i},ZL:function(){return s},lo:function(){return r},tY:function(){return n}});let s=["Admin","Admin Viewer","proxy_admin","proxy_admin_viewer","org_admin"],r=["Internal User","Internal Viewer"],l=["Internal User","Admin","proxy_admin"],n=e=>s.includes(e),i=e=>"proxy_admin"===e||"Admin"===e}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4679],{95704:function(e,t,a){a.d(t,{Dx:function(){return u.Z},RM:function(){return l.Z},SC:function(){return o.Z},Zb:function(){return s.Z},iA:function(){return r.Z},pj:function(){return n.Z},ss:function(){return i.Z},xs:function(){return c.Z},xv:function(){return d.Z}});var s=a(12514),r=a(21626),l=a(97214),n=a(28241),i=a(58834),c=a(69552),o=a(71876),d=a(84264),u=a(96761)},92280:function(e,t,a){a.d(t,{x:function(){return s.Z}});var s=a(84264)},56522:function(e,t,a){a.d(t,{o:function(){return r.Z},x:function(){return s.Z}});var s=a(84264),r=a(49566)},80443:function(e,t,a){var s=a(2265),r=a(99376),l=a(14474),n=a(3914),i=a(19250);t.Z=()=>{var e,t,a,c,o,d;let u=(0,r.useRouter)(),m="undefined"!=typeof document?(0,n.e)("token"):null;(0,s.useEffect)(()=>{m||u.replace("".concat((0,i.getProxyBaseUrl)(),"/ui/login"))},[m,u]);let g=(0,s.useMemo)(()=>{if(!m)return null;try{return(0,l.o)(m)}catch(e){return(0,n.b)(),u.replace("".concat((0,i.getProxyBaseUrl)(),"/ui/login")),null}},[m,u]);return{token:m,accessToken:null!==(e=null==g?void 0:g.key)&&void 0!==e?e:null,userId:null!==(t=null==g?void 0:g.user_id)&&void 0!==t?t:null,userEmail:null!==(a=null==g?void 0:g.user_email)&&void 0!==a?a:null,userRole:function(e){if(!e)return"Undefined Role";switch(e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(null!==(c=null==g?void 0:g.user_role)&&void 0!==c?c:null),premiumUser:null!==(o=null==g?void 0:g.premium_user)&&void 0!==o?o:null,disabledPersonalKeyCreation:null!==(d=null==g?void 0:g.disabled_non_admin_personal_key_creation)&&void 0!==d?d:null,showSSOBanner:(null==g?void 0:g.login_method)==="username_password"}}},82586:function(e,t,a){var s=a(57437),r=a(2265),l=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:c,placeholder:o="Select agents",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[g,p]=(0,r.useState)([]),[x,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{if(c){h(!0);try{let e=await (0,n.getAgentsList)(c),t=(null==e?void 0:e.agents)||[];m(t);let a=new Set;t.forEach(e=>{let t=e.agent_access_groups;t&&Array.isArray(t)&&t.forEach(e=>a.add(e))}),p(Array.from(a))}catch(e){console.error("Error fetching agents:",e)}finally{h(!1)}}})()},[c]);let f=[...g.map(e=>({label:e,value:"group:".concat(e),isAccessGroup:!0,searchText:"".concat(e," Access Group")})),...u.map(e=>({label:"".concat(e.agent_name||e.agent_id),value:e.agent_id,isAccessGroup:!1,searchText:"".concat(e.agent_name||e.agent_id," ").concat(e.agent_id," Agent")}))],v=[...(null==a?void 0:a.agents)||[],...((null==a?void 0:a.accessGroups)||[]).map(e=>"group:".concat(e))];return(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:o,onChange:e=>{t({agents:e.filter(e=>!e.startsWith("group:")),accessGroups:e.filter(e=>e.startsWith("group:")).map(e=>e.replace("group:",""))})},value:v,loading:x,className:i,showSearch:!0,style:{width:"100%"},disabled:d,filterOption:(e,t)=>{var a;return((null===(a=f.find(e=>e.value===(null==t?void 0:t.value)))||void 0===a?void 0:a.searchText)||"").toLowerCase().includes(e.toLowerCase())},children:f.map(e=>(0,s.jsx)(l.default.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#722ed1",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#722ed1",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"Agent"})]})},e.value))})})}},97434:function(e,t,a){a.d(t,{Dg:function(){return l},Lo:function(){return n},PA:function(){return o},RD:function(){return i},Z3:function(){return c}});let s="../ui/assets/logos/",r=[{id:"arize",displayName:"Arize",logo:"".concat(s,"arize.png"),supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_id:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:"".concat(s,"braintrust.png"),supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:"".concat(s,"custom.svg"),supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:"".concat(s,"datadog.png"),supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:"".concat(s,"lago.svg"),supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:"".concat(s,"langsmith.png"),supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:"".concat(s,"openmeter.png"),supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:"".concat(s,"otel.png"),supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:"".concat(s,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"},{id:"SQS",displayName:"SQS",logo:"".concat(s,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{sqs_queue_url:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"SQS Queue (AWS) Logging Integration"}],l=r.reduce((e,t)=>(e[t.displayName]=t,e),{}),n=r.reduce((e,t)=>(e[t.displayName]=t.id,e),{}),i=r.reduce((e,t)=>(e[t.id]=t.displayName,e),{}),c=e=>e.map(e=>n[e]||e),o=e=>e.map(e=>i[e]||e)},95096:function(e,t,a){var s=a(57437),r=a(2265),l=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:c,placeholder:o="Select pass through routes",disabled:d=!1,teamId:u}=e,[m,g]=(0,r.useState)([]),[p,x]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(c){x(!0);try{let e=await (0,n.getPassThroughEndpointsCall)(c,u);if(e.endpoints){let t=e.endpoints.map(e=>e.path);g(t)}}catch(e){console.error("Error fetching pass through routes:",e)}finally{x(!1)}}})()},[c,u]),(0,s.jsx)(l.default,{mode:"tags",placeholder:o,onChange:t,value:a,loading:p,className:i,options:m.map(e=>({label:e,value:e})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})}},46468:function(e,t,a){a.d(t,{K2:function(){return r},Ob:function(){return n},W0:function(){return l}});var s=a(19250);let r=async(e,t,a)=>{try{if(null===e||null===t)return;if(null!==a){let r=(await (0,s.modelAvailableCall)(a,e,t,!0,null,!0)).data.map(e=>e.id),l=[],n=[];return r.forEach(e=>{e.endsWith("/*")?l.push(e):n.push(e)}),[...l,...n]}}catch(e){console.error("Error fetching user models:",e)}},l=e=>{if(e.endsWith("/*")){let t=e.replace("/*","");return"All ".concat(t," models")}return e},n=(e,t)=>{let a=[],s=[];return console.log("teamModels",e),console.log("allModels",t),e.forEach(e=>{if(e.endsWith("/*")){let r=e.replace("/*",""),l=t.filter(e=>e.startsWith(r+"/"));s.push(...l),a.push(e)}else s.push(e)}),[...a,...s].filter((e,t,a)=>a.indexOf(e)===t)}},95920:function(e,t,a){var s=a(57437),r=a(2265),l=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:c,placeholder:o="Select MCP servers",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[g,p]=(0,r.useState)([]),[x,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{if(c){h(!0);try{let[e,t]=await Promise.all([(0,n.fetchMCPServers)(c),(0,n.fetchMCPAccessGroups)(c)]),a=Array.isArray(e)?e:e.data||[],s=Array.isArray(t)?t:t.data||[];m(a),p(s)}catch(e){console.error("Error fetching MCP servers or access groups:",e)}finally{h(!1)}}})()},[c]);let f=[...g.map(e=>({label:e,value:e,isAccessGroup:!0,searchText:"".concat(e," Access Group")})),...u.map(e=>({label:"".concat(e.server_name||e.server_id," (").concat(e.server_id,")"),value:e.server_id,isAccessGroup:!1,searchText:"".concat(e.server_name||e.server_id," ").concat(e.server_id," MCP Server")}))],v=[...(null==a?void 0:a.servers)||[],...(null==a?void 0:a.accessGroups)||[]];return(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:o,onChange:e=>{t({servers:e.filter(e=>!g.includes(e)),accessGroups:e.filter(e=>g.includes(e))})},value:v,loading:x,className:i,showSearch:!0,style:{width:"100%"},disabled:d,filterOption:(e,t)=>{var a;return((null===(a=f.find(e=>e.value===(null==t?void 0:t.value)))||void 0===a?void 0:a.searchText)||"").toLowerCase().includes(e.toLowerCase())},children:f.map(e=>(0,s.jsx)(l.default.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#1890ff",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#1890ff",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"MCP Server"})]})},e.value))})})}},68473:function(e,t,a){var s=a(57437),r=a(2265),l=a(19250),n=a(92280),i=a(10353),c=a(4156),o=a(32489);t.Z=e=>{let{accessToken:t,selectedServers:a,toolPermissions:d,onChange:u,disabled:m=!1}=e,[g,p]=(0,r.useState)([]),[x,h]=(0,r.useState)({}),[f,v]=(0,r.useState)({}),[_,y]=(0,r.useState)({});(0,r.useEffect)(()=>{(async()=>{if(0===a.length){p([]);return}try{let e=await (0,l.fetchMCPServers)(t),s=(Array.isArray(e)?e:e.data||[]).filter(e=>a.includes(e.server_id));p(s)}catch(e){console.error("Error fetching MCP servers:",e),p([])}})()},[a,t]);let b=async e=>{v(t=>({...t,[e]:!0})),y(t=>({...t,[e]:""}));try{let a=await (0,l.listMCPTools)(t,e);a.error?(y(t=>({...t,[e]:a.message||"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))):h(t=>({...t,[e]:a.tools||[]}))}catch(t){console.error("Error fetching tools for server ".concat(e,":"),t),y(t=>({...t,[e]:"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))}finally{v(t=>({...t,[e]:!1}))}};(0,r.useEffect)(()=>{g.forEach(e=>{x[e.server_id]||f[e.server_id]||b(e.server_id)})},[g]);let j=(e,t)=>{let a=d[e]||[],s=a.includes(t)?a.filter(e=>e!==t):[...a,t];u({...d,[e]:s})},N=e=>{let t=x[e]||[];u({...d,[e]:t.map(e=>e.name)})},w=e=>{u({...d,[e]:[]})};return 0===a.length?null:(0,s.jsx)("div",{className:"space-y-4",children:g.map(e=>{let t=e.server_name||e.alias||e.server_id,a=x[e.server_id]||[],r=d[e.server_id]||[],l=f[e.server_id],u=_[e.server_id];return(0,s.jsxs)("div",{className:"border rounded-lg bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border-b bg-white rounded-t-lg",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.x,{className:"font-semibold text-gray-900",children:t}),e.description&&(0,s.jsx)(n.x,{className:"text-sm text-gray-500",children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>N(e.server_id),disabled:m||l,children:"Select All"}),(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>w(e.server_id),disabled:m||l,children:"Deselect All"}),(0,s.jsx)("button",{className:"text-gray-400 hover:text-gray-600",onClick:()=>{},children:(0,s.jsx)(o.Z,{className:"w-4 h-4"})})]})]}),(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(n.x,{className:"text-sm font-medium text-gray-700 mb-3",children:"Available Tools"}),l&&(0,s.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,s.jsx)(i.Z,{size:"large"}),(0,s.jsx)(n.x,{className:"ml-3 text-gray-500",children:"Loading tools..."})]}),u&&!l&&(0,s.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-center",children:[(0,s.jsx)(n.x,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,s.jsx)(n.x,{className:"text-sm text-red-500 mt-1",children:u})]}),!l&&!u&&a.length>0&&(0,s.jsx)("div",{className:"space-y-2",children:a.map(t=>{let a=r.includes(t.name);return(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(c.Z,{checked:a,onChange:()=>j(e.server_id,t.name),disabled:m}),(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(n.x,{className:"font-medium text-gray-900",children:t.name}),(0,s.jsxs)(n.x,{className:"text-sm text-gray-500",children:["- ",t.description||"No description"]})]})})]},t.name)})}),!l&&!u&&0===a.length&&(0,s.jsx)("div",{className:"text-center py-6",children:(0,s.jsx)(n.x,{className:"text-gray-500",children:"No tools available"})})]})]},e.server_id)})})}},10703:function(e,t,a){a.d(t,{p:function(){return r}});var s=a(19250);let r=async e=>{try{let t=await (0,s.modelHubCall)(e);if(console.log("model_info:",t),(null==t?void 0:t.data.length)>0){let e=t.data.map(e=>({model_group:e.model_group,mode:null==e?void 0:e.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}}},24199:function(e,t,a){a.d(t,{Z:function(){return l}});var s=a(57437);a(2265);var r=a(30150),l=e=>{let{step:t=.01,style:a={width:"100%"},placeholder:l="Enter a numerical value",min:n,max:i,onChange:c,...o}=e;return(0,s.jsx)(r.Z,{onWheel:e=>e.currentTarget.blur(),step:t,style:a,placeholder:l,min:n,max:i,onChange:c,...o})}},54507:function(e,t,a){a.d(t,{Z:function(){return v}});var s=a(57437);a(2265);var r=a(37592),l=a(99981),n=a(23496),i=a(15424),c=a(78489),o=a(12514),d=a(49566),u=a(91777),m=a(82182),g=a(22452),p=a(74998),x=a(97434),h=a(24199);let{Option:f}=r.default;var v=e=>{let{value:t=[],onChange:a,disabledCallbacks:v=[],onDisabledCallbacksChange:_}=e,y=Object.entries(x.Dg).filter(e=>{let[t,a]=e;return a.supports_key_team_logging}).map(e=>{let[t,a]=e;return t}),b=Object.keys(x.Dg),j=e=>{null==a||a(e)},N=e=>{j(t.filter((t,a)=>a!==e))},w=(e,a,s)=>{let r=[...t];if("callback_name"===a){let t=x.Lo[s]||s;r[e]={...r[e],[a]:t,callback_vars:{}}}else r[e]={...r[e],[a]:s};j(r)},k=(e,a,s)=>{let r=[...t];r[e]={...r[e],callback_vars:{...r[e].callback_vars,[a]:s}},j(r)},C=(e,t)=>{var a,r;if(!e.callback_name)return null;let n=null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0];if(!n)return null;let c=(null===(r=x.Dg[n])||void 0===r?void 0:r.dynamic_params)||{};return 0===Object.keys(c).length?null:(0,s.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2 mb-4",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-blue-100 rounded-full flex items-center justify-center",children:(0,s.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full"})}),(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Integration Parameters"})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(c).map(a=>{let[r,n]=a;return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"text-sm font-medium text-gray-700 capitalize flex items-center space-x-1",children:[(0,s.jsx)("span",{children:r.replace(/_/g," ")}),(0,s.jsx)(l.Z,{title:"Environment variable reference recommended: os.environ/".concat(r.toUpperCase()),children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help text-xs"})}),"password"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Sensitive"}),"number"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Number"})]}),"number"===n&&(0,s.jsx)("span",{className:"text-xs text-gray-500",children:"Value must be between 0 and 1"}),"number"===n?(0,s.jsx)(h.Z,{step:.01,width:400,placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)}):(0,s.jsx)(d.Z,{type:"password"===n?"password":"text",placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)})]},r)})})]})};return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(u.Z,{className:"w-5 h-5 text-red-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Disabled Callbacks"}),(0,s.jsx)(l.Z,{title:"Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Disabled Callbacks"}),(0,s.jsx)(r.default,{mode:"multiple",placeholder:"Select callbacks to disable",value:v,onChange:e=>{let t=(0,x.Z3)(e);null==_||_(t)},style:{width:"100%"},optionLabelProp:"label",children:b.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"Select callbacks that should be disabled for this key. These callbacks will not receive any logging data."})]})]}),(0,s.jsx)(n.Z,{}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(m.Z,{className:"w-5 h-5 text-blue-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Logging Integrations"}),(0,s.jsx)(l.Z,{title:"Configure callback logging integrations for this team.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsx)(c.Z,{variant:"secondary",onClick:()=>{j([...t,{callback_name:"",callback_type:"success",callback_vars:{}}])},icon:g.Z,size:"sm",className:"hover:border-blue-400 hover:text-blue-500",type:"button",children:"Add Integration"})]}),(0,s.jsx)("div",{className:"space-y-4",children:t.map((e,t)=>{var a,n;let i=e.callback_name?null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0]:void 0,d=i?null===(n=x.Dg[i])||void 0===n?void 0:n.logo:null;return(0,s.jsxs)(o.Z,{className:"border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200",decoration:"top",decorationColor:"blue",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[d&&(0,s.jsx)("img",{src:d,alt:i,className:"w-5 h-5 object-contain"}),(0,s.jsxs)("span",{className:"text-sm font-medium",children:[i||"New Integration"," Configuration"]})]}),(0,s.jsx)(c.Z,{variant:"light",onClick:()=>N(t),icon:p.Z,size:"xs",color:"red",className:"hover:bg-red-50",type:"button",children:"Remove"})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Integration Type"}),(0,s.jsx)(r.default,{value:i,placeholder:"Select integration",onChange:e=>w(t,"callback_name",e),className:"w-full",optionLabelProp:"label",children:y.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Event Type"}),(0,s.jsxs)(r.default,{value:e.callback_type,onChange:e=>w(t,"callback_type",e),className:"w-full",children:[(0,s.jsx)(f,{value:"success",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{children:"Success Only"})]})}),(0,s.jsx)(f,{value:"failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),(0,s.jsx)("span",{children:"Failure Only"})]})}),(0,s.jsx)(f,{value:"success_and_failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{children:"Success & Failure"})]})})]})]})]}),C(e,t)]})]},t)})}),0===t.length&&(0,s.jsxs)("div",{className:"text-center py-12 text-gray-500 border-2 border-dashed border-gray-200 rounded-lg bg-gray-50/50",children:[(0,s.jsx)(m.Z,{className:"w-12 h-12 text-gray-300 mb-3 mx-auto"}),(0,s.jsx)("div",{className:"text-base font-medium mb-1",children:"No logging integrations configured"}),(0,s.jsx)("div",{className:"text-sm text-gray-400",children:'Click "Add Integration" to configure logging for this team'})]})]})}},97415:function(e,t,a){var s=a(57437),r=a(2265),l=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:c,placeholder:o="Select vector stores",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[g,p]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(c){p(!0);try{let e=await (0,n.vectorStoreListCall)(c);e.data&&m(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{p(!1)}}})()},[c]),(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:o,onChange:t,value:a,loading:g,className:i,options:u.map(e=>({label:"".concat(e.vector_store_name||e.vector_store_id," (").concat(e.vector_store_id,")"),value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})})}},59872:function(e,t,a){a.d(t,{nl:function(){return r},pw:function(){return l},vQ:function(){return n}});var s=a(9114);function r(e,t){let a=structuredClone(e);for(let[e,s]of Object.entries(t))e in a&&(a[e]=s);return a}let l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(null==e||!Number.isFinite(e))return"-";let s={minimumFractionDigits:t,maximumFractionDigits:t};if(!a)return e.toLocaleString("en-US",s);let r=Math.abs(e),l=r,n="";return r>=1e6?(l=r/1e6,n="M"):r>=1e3&&(l=r/1e3,n="K"),"".concat(e<0?"-":"").concat(l.toLocaleString("en-US",s)).concat(n)},n=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Copied to clipboard";if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return i(e,t);try{return await navigator.clipboard.writeText(e),s.Z.success(t),!0}catch(a){return console.error("Clipboard API failed: ",a),i(e,t)}},i=(e,t)=>{try{let a=document.createElement("textarea");a.value=e,a.style.position="fixed",a.style.left="-999999px",a.style.top="-999999px",a.setAttribute("readonly",""),document.body.appendChild(a),a.focus(),a.select();let r=document.execCommand("copy");if(document.body.removeChild(a),r)return s.Z.success(t),!0;throw Error("execCommand failed")}catch(e){return s.Z.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}}},20347:function(e,t,a){a.d(t,{LQ:function(){return l},P4:function(){return i},ZL:function(){return s},lo:function(){return r},tY:function(){return n}});let s=["Admin","Admin Viewer","proxy_admin","proxy_admin_viewer","org_admin"],r=["Internal User","Internal Viewer"],l=["Internal User","Admin","proxy_admin"],n=e=>s.includes(e),i=e=>"proxy_admin"===e||"Admin"===e}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/5301-dc3323e921fbd17f.js b/litellm/proxy/_experimental/out/_next/static/chunks/5301-dc3323e921fbd17f.js new file mode 100644 index 0000000000..1043835561 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/5301-dc3323e921fbd17f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5301],{19046:function(e,t,s){s.d(t,{Dx:function(){return l.Z},Zb:function(){return o.Z},oi:function(){return n.Z},xv:function(){return r.Z},zx:function(){return a.Z}});var a=s(78489),o=s(12514),r=s(84264),n=s(49566),l=s(96761)},88712:function(e,t,s){var a=s(57437);s(2265);var o=s(33145),r=s(66830),n=s(50010);t.Z=e=>{let{message:t}=e;if(!(0,r.br)(t))return null;let s="string"==typeof t.content&&t.content.includes("[PDF attached]");return(0,a.jsx)("div",{className:"mb-2",children:s?(0,a.jsx)("div",{className:"w-64 h-32 rounded-md border border-gray-200 bg-red-50 flex items-center justify-center",children:(0,a.jsx)(n.Z,{style:{fontSize:"48px",color:"#dc2626"}})}):(0,a.jsx)(o.default,{src:t.imagePreviewUrl||"",alt:"User uploaded image",width:256,height:200,className:"max-w-64 rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"200px",width:"auto",height:"auto"}})})}},27930:function(e,t,s){var a=s(57437);s(2265);var o=s(65319),r=s(99981),n=s(53508);let{Dragger:l}=o.default;t.Z=e=>{let{chatUploadedImage:t,chatImagePreviewUrl:s,onImageUpload:o,onRemoveImage:i}=e;return(0,a.jsx)(a.Fragment,{children:!t&&(0,a.jsx)(l,{beforeUpload:o,accept:"image/*,.pdf",showUploadList:!1,className:"inline-block",style:{padding:0,border:"none",background:"none"},children:(0,a.jsx)(r.Z,{title:"Attach image or PDF",children:(0,a.jsx)("button",{type:"button",className:"flex items-center justify-center w-8 h-8 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-md transition-colors",children:(0,a.jsx)(n.Z,{style:{fontSize:"16px"}})})})})})}},66830:function(e,t,s){s.d(t,{Hk:function(){return r},Sn:function(){return o},br:function(){return n}});let a=e=>new Promise((t,s)=>{let a=new FileReader;a.onload=()=>{t(a.result)},a.onerror=s,a.readAsDataURL(e)}),o=async(e,t)=>({role:"user",content:[{type:"text",text:e},{type:"image_url",image_url:{url:await a(t)}}]}),r=(e,t,s,a)=>{let o="";t&&a&&(o=a.toLowerCase().endsWith(".pdf")?"[PDF attached]":"[Image attached]");let r={role:"user",content:t?"".concat(e," ").concat(o):e};return t&&s&&(r.imagePreviewUrl=s),r},n=e=>"user"===e.role&&"string"==typeof e.content&&(e.content.includes("[Image attached]")||e.content.includes("[PDF attached]"))&&!!e.imagePreviewUrl},75301:function(e,t,s){s.d(t,{Z:function(){return e0}});var a=s(57437),o=s(61935),r=s(92403),n=s(12660),l=s(25980),i=s(69993),c=s(55322),d=s(71891),m=s(58630),u=s(15424),x=s(44625),g=s(57400),p=s(26430),h=s(11894),f=s(15883),v=s(99890),b=s(26349),y=s(50010),j=s(79276),N=s(19046),w=s(4260),S=s(65319),k=s(57840),P=s(37592),A=s(79326),C=s(5545),Z=s(99981),T=s(10353),_=s(22116),E=s(2265),I=s(62831),R=s(17906),M=s(94263),L=s(93837),O=s(9309),K=s(67479),U=s(9114),D=s(99020),z=s(97415),F=s(92280),B=s(4156),H=s(19015),G=s(85847),q=e=>{let{temperature:t=1,maxTokens:s=2048,useAdvancedParams:o,onTemperatureChange:r,onMaxTokensChange:n,onUseAdvancedParamsChange:l}=e,[i,c]=(0,E.useState)(!1),d=void 0!==o?o:i,[m,x]=(0,E.useState)(t),[g,p]=(0,E.useState)(s);(0,E.useEffect)(()=>{x(t)},[t]),(0,E.useEffect)(()=>{p(s)},[s]);let h=e=>{let t=null!=e?e:1;x(t),null==r||r(t)},f=e=>{let t=null!=e?e:1e3;p(t),null==n||n(t)},v=d?"text-gray-700":"text-gray-400",b=e=>{l?l(e):c(e)};return(0,a.jsxs)("div",{className:"space-y-4 p-4 w-80",children:[(0,a.jsx)(B.Z,{checked:d,onChange:e=>b(e.target.checked),children:(0,a.jsx)("span",{className:"font-medium",children:"Use Advanced Parameters"})}),(0,a.jsxs)("div",{className:"space-y-4 transition-opacity duration-200",style:{opacity:d?1:.4},children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(F.x,{className:"text-sm ".concat(v),children:"Temperature"}),(0,a.jsx)(Z.Z,{title:"Controls randomness. Lower values make output more deterministic, higher values more creative.",children:(0,a.jsx)(u.Z,{className:"text-xs ".concat(v," cursor-help")})})]}),(0,a.jsx)(H.Z,{min:0,max:2,step:.1,value:m,onChange:h,disabled:!d,precision:1,className:"w-20"})]}),(0,a.jsx)(G.Z,{min:0,max:2,step:.1,value:m,onChange:h,disabled:!d,marks:{0:"0",1:"1.0",2:"2.0"}})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(F.x,{className:"text-sm ".concat(v),children:"Max Tokens"}),(0,a.jsx)(Z.Z,{title:"Maximum number of tokens to generate in the response.",children:(0,a.jsx)(u.Z,{className:"text-xs ".concat(v," cursor-help")})})]}),(0,a.jsx)(H.Z,{min:1,max:32768,step:1,value:g,onChange:f,disabled:!d})]}),(0,a.jsx)(G.Z,{min:1,max:32768,step:1,value:g,onChange:f,disabled:!d,marks:{1:"1",32768:"32768"}})]})]})]})},J=e=>{let{message:t}=e;return t.isAudio&&"string"==typeof t.content?(0,a.jsx)("div",{className:"mb-2",children:(0,a.jsx)("audio",{controls:!0,src:t.content,className:"max-w-full",style:{maxWidth:"500px"},children:"Your browser does not support the audio element."})}):null},V=s(8443);let W={ALLOY:"Alloy - Professional and confident",ASH:"Ash - Casual and relaxed",BALAD:"Ballad - Smooth and melodic",CORAL:"Coral - Warm and engaging",ECHO:"Echo - Friendly and conversational",FABLE:"Fable - Wise and measured",NOVA:"Nova - Friendly and conversational",ONYX:"Onyx - Deep and authoritative",SAGE:"Sage - Wise and measured",SHIMMER:"Shimmer - Bright and cheerful"},Y=Object.entries({ALLOY:"alloy",ASH:"ash",BALAD:"ballad",CORAL:"coral",ECHO:"echo",FABLE:"fable",NOVA:"nova",ONYX:"onyx",SAGE:"sage",SHIMMER:"shimmer"}).map(e=>{let[t,s]=e;return{value:s,label:W[t]}}),X=[{value:V.KP.CHAT,label:"/v1/chat/completions"},{value:V.KP.RESPONSES,label:"/v1/responses"},{value:V.KP.ANTHROPIC_MESSAGES,label:"/v1/messages"},{value:V.KP.IMAGE,label:"/v1/images/generations"},{value:V.KP.IMAGE_EDITS,label:"/v1/images/edits"},{value:V.KP.EMBEDDINGS,label:"/v1/embeddings"},{value:V.KP.SPEECH,label:"/v1/audio/speech"},{value:V.KP.TRANSCRIPTION,label:"/v1/audio/transcriptions"},{value:V.KP.A2A_AGENTS,label:"/v1/a2a/message/send"}];var $=s(88712),Q=s(27930),ee=s(66830),et=s(82971),es=e=>{let{endpointType:t,onEndpointChange:s,className:o}=e;return(0,a.jsx)("div",{className:o,children:(0,a.jsx)(P.default,{showSearch:!0,value:t,style:{width:"100%"},onChange:s,options:X,className:"rounded-md"})})},ea=s(85498),eo=s(19250);async function er(e,t,s,a){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5?arguments[5]:void 0,n=arguments.length>6?arguments[6]:void 0,l=arguments.length>7?arguments[7]:void 0,i=arguments.length>8?arguments[8]:void 0,c=arguments.length>9?arguments[9]:void 0,d=arguments.length>10?arguments[10]:void 0,m=arguments.length>11?arguments[11]:void 0,u=arguments.length>12?arguments[12]:void 0;if(!a)throw Error("Virtual Key is required");console.log=function(){};let x=(0,eo.getProxyBaseUrl)(),g={};o&&o.length>0&&(g["x-litellm-tags"]=o.join(","));let p=new ea.ZP({apiKey:a,baseURL:x,dangerouslyAllowBrowser:!0,defaultHeaders:g});try{let o=Date.now(),g=!1,h=u&&u.length>0?[{type:"mcp",server_label:"litellm",server_url:"".concat(x,"/mcp"),require_approval:"never",allowed_tools:u,headers:{"x-litellm-api-key":"Bearer ".concat(a)}}]:void 0,f={model:s,messages:e.map(e=>({role:e.role,content:e.content})),stream:!0,max_tokens:1024,litellm_trace_id:c};for await(let e of(d&&(f.vector_store_ids=d),m&&(f.guardrails=m),h&&(f.tools=h,f.tool_choice="auto"),p.messages.stream(f,{signal:r}))){if(console.log("Stream event:",e),"content_block_delta"===e.type){let a=e.delta;if(!g){g=!0;let e=Date.now()-o;console.log("First token received! Time:",e,"ms"),l&&l(e)}"text_delta"===a.type?t("assistant",a.text,s):"reasoning_delta"===a.type&&n&&n(a.text)}if("message_delta"===e.type&&e.usage&&i){let t=e.usage;console.log("Usage data found:",t);let s={completionTokens:t.output_tokens,promptTokens:t.input_tokens,totalTokens:t.input_tokens+t.output_tokens};i(s)}}}catch(e){throw(null==r?void 0:r.aborted)?console.log("Anthropic messages request was cancelled"):U.Z.fromBackend("Error occurred while generating model response. Please try again. Error: ".concat(e)),e}}var en=s(7271);async function el(e,t,s,a,o,r,n,l,i){console.log=function(){},console.log("isLocal:",!1);let c=(0,eo.getProxyBaseUrl)(),d=new en.ZP.OpenAI({apiKey:o,baseURL:c,dangerouslyAllowBrowser:!0,defaultHeaders:r&&r.length>0?{"x-litellm-tags":r.join(",")}:void 0});try{let o=await d.audio.speech.create({model:a,input:e,voice:t,...l?{response_format:l}:{},...i?{speed:i}:{}},{signal:n}),r=await o.blob(),c=URL.createObjectURL(r);s(c,a)}catch(e){throw(null==n?void 0:n.aborted)?console.log("Audio speech request was cancelled"):U.Z.fromBackend("Error occurred while generating speech. Please try again. Error: ".concat(e)),e}}async function ei(e,t,s,a,o,r,n,l,i,c){console.log=function(){},console.log("isLocal:",!1);let d=(0,eo.getProxyBaseUrl)(),m=new en.ZP.OpenAI({apiKey:a,baseURL:d,dangerouslyAllowBrowser:!0,defaultHeaders:o&&o.length>0?{"x-litellm-tags":o.join(",")}:void 0});try{console.log("Processing audio file for transcription:",e.name);let a=await m.audio.transcriptions.create({model:s,file:e,...n?{language:n}:{},...l?{prompt:l}:{},...i?{response_format:i}:{},...void 0!==c?{temperature:c}:{}},{signal:r});if(console.log("Transcription response:",a),a&&a.text)t(a.text,s),U.Z.success("Audio transcribed successfully");else throw Error("No transcription text in response")}catch(e){if(console.error("Error making audio transcription request:",e),null==r?void 0:r.aborted)console.log("Audio transcription request was cancelled");else{var u;let t="Failed to transcribe audio";(null==e?void 0:null===(u=e.error)||void 0===u?void 0:u.message)?t=e.error.message:(null==e?void 0:e.message)&&(t=e.message),U.Z.fromBackend("Audio transcription failed: ".concat(t))}throw e}}var ec=s(95459);async function ed(e,t,s,a,o){if(!a)throw Error("Virtual Key is required");console.log=function(){};let r=(0,eo.getProxyBaseUrl)(),n={};o&&o.length>0&&(n["x-litellm-tags"]=o.join(","));try{var l,i,c;let o=r.endsWith("/")?r.slice(0,-1):r,d=await fetch("".concat(o,"/embeddings"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(a),...n},body:JSON.stringify({model:s,input:e})});if(!d.ok){let e=await d.text();throw Error(e||"Request failed with status ".concat(d.status))}let m=await d.json(),u=null==m?void 0:null===(i=m.data)||void 0===i?void 0:null===(l=i[0])||void 0===l?void 0:l.embedding;if(!u)throw Error("No embedding returned from server");t(JSON.stringify(u),null!==(c=null==m?void 0:m.model)&&void 0!==c?c:s)}catch(e){throw U.Z.fromBackend("Error occurred while making embeddings request. Please try again. Error: ".concat(e)),e}}async function em(e){try{return(await (0,eo.mcpToolsCall)(e)).tools||[]}catch(e){return console.error("Error fetching MCP tools:",e),[]}}var eu=s(10703);async function ex(e,t,s,a,o,r,n){console.log=function(){},console.log("isLocal:",!1);let l=(0,eo.getProxyBaseUrl)(),i=new en.ZP.OpenAI({apiKey:o,baseURL:l,dangerouslyAllowBrowser:!0,defaultHeaders:r&&r.length>0?{"x-litellm-tags":r.join(",")}:void 0});try{let o=Array.isArray(e)?e:[e],r=[];for(let e=0;e1&&U.Z.success("Successfully processed ".concat(r.length," images"))}catch(e){if(console.error("Error making image edit request:",e),null==n?void 0:n.aborted)console.log("Image edits request was cancelled");else{var c;let t="Failed to edit image(s)";(null==e?void 0:null===(c=e.error)||void 0===c?void 0:c.message)?t=e.error.message:(null==e?void 0:e.message)&&(t=e.message),U.Z.fromBackend("Image edit failed: ".concat(t))}throw e}}async function eg(e,t,s,a,o,r){console.log=function(){},console.log("isLocal:",!1);let n=(0,eo.getProxyBaseUrl)(),l=new en.ZP.OpenAI({apiKey:a,baseURL:n,dangerouslyAllowBrowser:!0,defaultHeaders:o&&o.length>0?{"x-litellm-tags":o.join(",")}:void 0});try{let a=await l.images.generate({model:s,prompt:e},{signal:r});if(console.log(a.data),a.data&&a.data[0]){if(a.data[0].url)t(a.data[0].url,s);else if(a.data[0].b64_json){let e=a.data[0].b64_json;t("data:image/png;base64,".concat(e),s)}else throw Error("No image data found in response")}else throw Error("Invalid response format")}catch(e){throw(null==r?void 0:r.aborted)?console.log("Image generation request was cancelled"):U.Z.fromBackend("Error occurred while generating image. Please try again. Error: ".concat(e)),e}}async function ep(e,t,s,a){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5?arguments[5]:void 0,n=arguments.length>6?arguments[6]:void 0,l=arguments.length>7?arguments[7]:void 0,i=arguments.length>8?arguments[8]:void 0,c=arguments.length>9?arguments[9]:void 0,d=arguments.length>10?arguments[10]:void 0,m=arguments.length>11?arguments[11]:void 0,u=arguments.length>12?arguments[12]:void 0,x=arguments.length>13?arguments[13]:void 0,g=arguments.length>14?arguments[14]:void 0,p=arguments.length>15?arguments[15]:void 0;if(!a)throw Error("Virtual Key is required");console.log=function(){};let h=(0,eo.getProxyBaseUrl)(),f={};o&&o.length>0&&(f["x-litellm-tags"]=o.join(","));let v=new en.ZP.OpenAI({apiKey:a,baseURL:h,dangerouslyAllowBrowser:!0,defaultHeaders:f});try{let a=Date.now(),o=!1,h=e.map(e=>(Array.isArray(e.content),{role:e.role,content:e.content,type:"message"})),f=u&&u.length>0?[{type:"mcp",server_label:"litellm",server_url:"litellm_proxy/mcp",require_approval:"never",allowed_tools:u}]:void 0,P=await v.responses.create({model:s,input:h,stream:!0,litellm_trace_id:c,...x?{previous_response_id:x}:{},...d?{vector_store_ids:d}:{},...m?{guardrails:m}:{},...f?{tools:f,tool_choice:"required"}:{}},{signal:r}),A="";for await(let e of P)if(console.log("Response event:",e),"object"==typeof e&&null!==e){var b,y,j,N,w,S,k;if(((null===(b=e.type)||void 0===b?void 0:b.startsWith("response.mcp_"))||"response.output_item.done"===e.type&&((null===(y=e.item)||void 0===y?void 0:y.type)==="mcp_list_tools"||(null===(j=e.item)||void 0===j?void 0:j.type)==="mcp_call"))&&(console.log("MCP event received:",e),p)){let t={type:e.type,sequence_number:e.sequence_number,output_index:e.output_index,item_id:e.item_id||(null===(S=e.item)||void 0===S?void 0:S.id),item:e.item,delta:e.delta,arguments:e.arguments,timestamp:Date.now()};p(t)}if("response.output_item.done"===e.type&&(null===(N=e.item)||void 0===N?void 0:N.type)==="mcp_call"&&(null===(w=e.item)||void 0===w?void 0:w.name)&&(A=e.item.name,console.log("MCP tool used:",A)),"response.role.delta"===e.type)continue;if("response.output_text.delta"===e.type&&"string"==typeof e.delta){let r=e.delta;if(console.log("Text delta",r),r.trim().length>0&&(t("assistant",r,s),!o)){o=!0;let e=Date.now()-a;console.log("First token received! Time:",e,"ms"),l&&l(e)}}if("response.reasoning.delta"===e.type&&"delta"in e){let t=e.delta;"string"==typeof t&&n&&n(t)}if("response.completed"===e.type&&"response"in e){let t=e.response,s=t.usage;if(console.log("Usage data:",s),console.log("Response completed event:",t),t.id&&g&&(console.log("Response ID for session management:",t.id),g(t.id)),s&&i){console.log("Usage data:",s);let e={completionTokens:s.output_tokens,promptTokens:s.input_tokens,totalTokens:s.total_tokens};(null===(k=s.completion_tokens_details)||void 0===k?void 0:k.reasoning_tokens)&&(e.reasoningTokens=s.completion_tokens_details.reasoning_tokens),i(e,A)}}}return P}catch(e){throw(null==r?void 0:r.aborted)?console.log("Responses API request was cancelled"):U.Z.fromBackend("Error occurred while generating model response. Please try again. Error: ".concat(e)),e}}let eh=async e=>{try{let t=(0,eo.getProxyBaseUrl)(),s=await fetch(t?"".concat(t,"/v1/agents"):"/v1/agents",{method:"GET",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}});if(!s.ok){let e=await s.json();throw Error(e.detail||"Failed to fetch agents")}let a=await s.json();return console.log("Fetched agents:",a),a.sort((e,t)=>{let s=e.agent_name||e.agent_id,a=t.agent_name||t.agent_id;return s.localeCompare(a)}),a}catch(e){throw console.error("Error fetching agents:",e),e}},ef=e=>{if(!e)return;let t={};if(e.id&&(t.taskId=e.id),e.contextId&&(t.contextId=e.contextId),e.status){var s;if(t.status={state:e.status.state,timestamp:e.status.timestamp},null===(s=e.status.message)||void 0===s?void 0:s.parts){let s=e.status.message.parts.filter(e=>"text"===e.kind&&e.text).map(e=>e.text).join(" ");s&&(t.status.message=s)}}return e.metadata&&"object"==typeof e.metadata&&(t.metadata=e.metadata),Object.keys(t).length>0?t:void 0},ev=async(e,t,s,a,o,r,n,l)=>{let i;let c=(0,eo.getProxyBaseUrl)(),d=c?"".concat(c,"/a2a/").concat(e):"/a2a/".concat(e),m=(0,L.Z)(),u=(0,L.Z)().replace(/-/g,""),x=performance.now(),g=!1,p="";try{var h,f,v,b;let c=await fetch(d,{method:"POST",headers:{Authorization:"Bearer ".concat(a),"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:m,method:"message/stream",params:{message:{kind:"message",messageId:u,role:"user",parts:[{kind:"text",text:t}]}}}),signal:o});if(!c.ok){let e=await c.json();throw Error((null===(f=e.error)||void 0===f?void 0:f.message)||e.detail||"HTTP ".concat(c.status))}let y=null===(h=c.body)||void 0===h?void 0:h.getReader();if(!y)throw Error("No response body");let j=new TextDecoder,N="",w=!1;for(;!w;){let t=await y.read();w=t.done;let a=t.value;if(w)break;let o=(N+=j.decode(a,{stream:!0})).split("\n");for(let t of(N=o.pop()||"",o))if(t.trim())try{let a=JSON.parse(t);if(!g){g=!0;let e=performance.now()-x;r&&r(e)}let o=a.result;if(o){let t=ef(o);t&&(i={...i,...t});let a=o.kind;if("artifact-update"===a&&o.artifact){let t=o.artifact;if(t.parts&&Array.isArray(t.parts))for(let a of t.parts)"text"===a.kind&&a.text&&(p+=a.text,s(p,"a2a_agent/".concat(e)))}else if(o.artifacts&&Array.isArray(o.artifacts)){for(let t of o.artifacts)if(t.parts&&Array.isArray(t.parts))for(let a of t.parts)"text"===a.kind&&a.text&&(p+=a.text,s(p,"a2a_agent/".concat(e)))}else if("status-update"===a&&(null===(b=o.status)||void 0===b?void 0:null===(v=b.message)||void 0===v?void 0:v.parts)){if(!p)for(let t of o.status.message.parts)"text"===t.kind&&t.text&&s(t.text,"a2a_agent/".concat(e))}else if(o.parts&&Array.isArray(o.parts))for(let t of o.parts)"text"===t.kind&&t.text&&(p+=t.text,s(p,"a2a_agent/".concat(e)))}if(a.error)throw Error(a.error.message)}catch(e){t.trim().length>0&&console.warn("Failed to parse A2A streaming chunk:",t,e)}}let S=performance.now()-x;n&&n(S),i&&l&&l(i)}catch(e){if(null==o?void 0:o.aborted){console.log("A2A streaming request was cancelled");return}throw console.error("A2A stream message error:",e),e}};var eb=s(83669),ey=s(29271),ej=s(5540),eN=s(38434),ew=s(23639),eS=s(62272),ek=s(70464),eP=s(77565);let eA=e=>{switch(e){case"completed":return(0,a.jsx)(eb.Z,{className:"text-green-500"});case"working":case"submitted":return(0,a.jsx)(o.Z,{className:"text-blue-500"});case"failed":case"canceled":return(0,a.jsx)(ey.Z,{className:"text-red-500"});default:return(0,a.jsx)(ej.Z,{className:"text-gray-500"})}},eC=e=>{switch(e){case"completed":return"bg-green-100 text-green-700";case"working":case"submitted":return"bg-blue-100 text-blue-700";case"failed":case"canceled":return"bg-red-100 text-red-700";default:return"bg-gray-100 text-gray-700"}},eZ=e=>{if(!e)return null;try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch(t){return e}},eT=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e?e.length>t?"".concat(e.substring(0,t),"…"):e:null},e_=e=>{navigator.clipboard.writeText(e)};var eE=e=>{let{a2aMetadata:t,timeToFirstToken:s,totalLatency:o}=e,[r,n]=(0,E.useState)(!1);if(!t&&!s&&!o)return null;let{taskId:l,contextId:c,status:d,metadata:m}=t||{},u=eZ(null==d?void 0:d.timestamp);return(0,a.jsxs)("div",{className:"a2a-metrics mt-3 pt-2 border-t border-gray-200 text-xs",children:[(0,a.jsxs)("div",{className:"flex items-center mb-2 text-gray-600",children:[(0,a.jsx)(i.Z,{className:"mr-1.5 text-blue-500"}),(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"A2A Metadata"})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-gray-500 ml-4",children:[(null==d?void 0:d.state)&&(0,a.jsxs)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ".concat(eC(d.state)),children:[eA(d.state),(0,a.jsx)("span",{className:"ml-1 capitalize",children:d.state})]}),u&&(0,a.jsx)(Z.Z,{title:null==d?void 0:d.timestamp,children:(0,a.jsxs)("span",{className:"flex items-center",children:[(0,a.jsx)(ej.Z,{className:"mr-1"}),u]})}),void 0!==o&&(0,a.jsx)(Z.Z,{title:"Total latency",children:(0,a.jsxs)("span",{className:"flex items-center text-blue-600",children:[(0,a.jsx)(ej.Z,{className:"mr-1"}),(o/1e3).toFixed(2),"s"]})}),void 0!==s&&(0,a.jsx)(Z.Z,{title:"Time to first token",children:(0,a.jsxs)("span",{className:"flex items-center text-green-600",children:["TTFT: ",(s/1e3).toFixed(2),"s"]})})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-gray-500 ml-4 mt-1.5",children:[l&&(0,a.jsx)(Z.Z,{title:"Click to copy: ".concat(l),children:(0,a.jsxs)("span",{className:"flex items-center cursor-pointer hover:text-gray-700",onClick:()=>e_(l),children:[(0,a.jsx)(eN.Z,{className:"mr-1"}),"Task: ",eT(l),(0,a.jsx)(ew.Z,{className:"ml-1 text-gray-400 hover:text-gray-600"})]})}),c&&(0,a.jsx)(Z.Z,{title:"Click to copy: ".concat(c),children:(0,a.jsxs)("span",{className:"flex items-center cursor-pointer hover:text-gray-700",onClick:()=>e_(c),children:[(0,a.jsx)(eS.Z,{className:"mr-1"}),"Session: ",eT(c),(0,a.jsx)(ew.Z,{className:"ml-1 text-gray-400 hover:text-gray-600"})]})}),(m||(null==d?void 0:d.message))&&(0,a.jsxs)(C.ZP,{type:"text",size:"small",className:"text-xs text-blue-500 hover:text-blue-700 p-0 h-auto",onClick:()=>n(!r),children:[r?(0,a.jsx)(ek.Z,{}):(0,a.jsx)(eP.Z,{}),(0,a.jsx)("span",{className:"ml-1",children:"Details"})]})]}),r&&(0,a.jsxs)("div",{className:"mt-2 ml-4 p-3 bg-gray-50 rounded-md text-gray-600 border border-gray-200",children:[(null==d?void 0:d.message)&&(0,a.jsxs)("div",{className:"mb-2",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Status Message:"}),(0,a.jsx)("span",{className:"ml-2",children:d.message})]}),l&&(0,a.jsxs)("div",{className:"mb-1.5 flex items-center",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700 w-24",children:"Task ID:"}),(0,a.jsx)("code",{className:"ml-2 px-2 py-1 bg-white border border-gray-200 rounded text-xs font-mono",children:l}),(0,a.jsx)(ew.Z,{className:"ml-2 cursor-pointer text-gray-400 hover:text-blue-500",onClick:()=>e_(l)})]}),c&&(0,a.jsxs)("div",{className:"mb-1.5 flex items-center",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700 w-24",children:"Session ID:"}),(0,a.jsx)("code",{className:"ml-2 px-2 py-1 bg-white border border-gray-200 rounded text-xs font-mono",children:c}),(0,a.jsx)(ew.Z,{className:"ml-2 cursor-pointer text-gray-400 hover:text-blue-500",onClick:()=>e_(c)})]}),m&&Object.keys(m).length>0&&(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Custom Metadata:"}),(0,a.jsx)("pre",{className:"mt-1.5 p-2 bg-white border border-gray-200 rounded text-xs font-mono overflow-x-auto whitespace-pre-wrap",children:JSON.stringify(m,null,2)})]})]})]})},eI=s(29),eR=s.n(eI),eM=s(44851);let{Text:eL}=k.default,{Panel:eO}=eM.default;var eK=e=>{var t,s;let{events:o,className:r}=e;if(console.log("MCPEventsDisplay: Received events:",o),!o||0===o.length)return console.log("MCPEventsDisplay: No events, returning null"),null;let n=o.find(e=>{var t;return"response.output_item.done"===e.type&&(null===(t=e.item)||void 0===t?void 0:t.type)==="mcp_list_tools"&&e.item.tools&&e.item.tools.length>0}),l=o.filter(e=>{var t;return"response.output_item.done"===e.type&&(null===(t=e.item)||void 0===t?void 0:t.type)==="mcp_call"});return(console.log("MCPEventsDisplay: toolsEvent:",n),console.log("MCPEventsDisplay: mcpCallEvents:",l),n||0!==l.length)?(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac "+"mcp-events-display ".concat(r||""),children:[(0,a.jsx)(eR(),{id:"32b14b04f420f3ac",children:'.openai-mcp-tools.jsx-32b14b04f420f3ac{position:relative;margin:0;padding:0}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse.jsx-32b14b04f420f3ac{background:transparent!important;border:none!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-item.jsx-32b14b04f420f3ac{border:none!important;background:transparent!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-header.jsx-32b14b04f420f3ac{padding:0 0 0 20px!important;background:transparent!important;border:none!important;font-size:14px!important;color:#9ca3af!important;font-weight:400!important;line-height:20px!important;min-height:20px!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-header.jsx-32b14b04f420f3ac:hover{background:transparent!important;color:#6b7280!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-content.jsx-32b14b04f420f3ac{border:none!important;background:transparent!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-content-box.jsx-32b14b04f420f3ac{padding:4px 0 0 20px!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-expand-icon.jsx-32b14b04f420f3ac{position:absolute!important;left:2px!important;top:2px!important;color:#9ca3af!important;font-size:10px!important;width:16px!important;height:16px!important;display:-webkit-box!important;display:-webkit-flex!important;display:-moz-box!important;display:-ms-flexbox!important;display:flex!important;-webkit-box-align:center!important;-webkit-align-items:center!important;-moz-box-align:center!important;-ms-flex-align:center!important;align-items:center!important;-webkit-box-pack:center!important;-webkit-justify-content:center!important;-moz-box-pack:center!important;-ms-flex-pack:center!important;justify-content:center!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-expand-icon.jsx-32b14b04f420f3ac:hover{color:#6b7280!important}.openai-vertical-line.jsx-32b14b04f420f3ac{position:absolute;left:9px;top:18px;bottom:0;width:.5px;background-color:#f3f4f6;opacity:.8}.tool-item.jsx-32b14b04f420f3ac{font-family:ui-monospace,SFMono-Regular,"SF Mono",Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:13px;color:#4b5563;line-height:18px;padding:0;margin:0;background:white;position:relative;z-index:1}.mcp-section.jsx-32b14b04f420f3ac{margin-bottom:12px;background:white;position:relative;z-index:1}.mcp-section.jsx-32b14b04f420f3ac:last-child{margin-bottom:0}.mcp-section-header.jsx-32b14b04f420f3ac{font-size:13px;color:#6b7280;font-weight:500;margin-bottom:4px}.mcp-code-block.jsx-32b14b04f420f3ac{background:#f9fafb;border:1px solid#f3f4f6;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;padding:8px;font-size:12px}.mcp-json.jsx-32b14b04f420f3ac{font-family:ui-monospace,SFMono-Regular,"SF Mono",Monaco,Consolas,"Liberation Mono","Courier New",monospace;color:#374151;margin:0;white-space:pre-wrap;word-wrap:break-word}.mcp-approved.jsx-32b14b04f420f3ac{display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;font-size:13px;color:#6b7280}.mcp-checkmark.jsx-32b14b04f420f3ac{color:#10b981;margin-right:6px;font-weight:bold}.mcp-response-content.jsx-32b14b04f420f3ac{font-size:13px;color:#374151;line-height:1.5;white-space:pre-wrap;font-family:ui-monospace,SFMono-Regular,"SF Mono",Monaco,Consolas,"Liberation Mono","Courier New",monospace}'}),(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac openai-mcp-tools",children:[(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac openai-vertical-line"}),(0,a.jsxs)(eM.default,{ghost:!0,size:"small",expandIconPosition:"start",defaultActiveKey:n?["list-tools"]:l.map((e,t)=>"mcp-call-".concat(t)),children:[n&&(0,a.jsx)(eO,{header:"List tools",children:(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac",children:null===(s=n.item)||void 0===s?void 0:null===(t=s.tools)||void 0===t?void 0:t.map((e,t)=>(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac tool-item",children:e.name},t))})},"list-tools"),l.map((e,t)=>{var s,o,r;return(0,a.jsx)(eO,{header:(null===(s=e.item)||void 0===s?void 0:s.name)||"Tool call",children:(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac",children:[(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:[(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section-header",children:"Request"}),(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-code-block",children:(null===(o=e.item)||void 0===o?void 0:o.arguments)&&(0,a.jsx)("pre",{className:"jsx-32b14b04f420f3ac mcp-json",children:(()=>{try{return JSON.stringify(JSON.parse(e.item.arguments),null,2)}catch(t){return e.item.arguments}})()})})]}),(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-approved",children:[(0,a.jsx)("span",{className:"jsx-32b14b04f420f3ac mcp-checkmark",children:"✓"})," Approved"]})}),(null===(r=e.item)||void 0===r?void 0:r.output)&&(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:[(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section-header",children:"Response"}),(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-response-content",children:e.item.output})]})]})},"mcp-call-".concat(t))})]})]})]}):(console.log("MCPEventsDisplay: No valid events found, returning null"),null)},eU=s(94331),eD=s(38398);let ez=e=>new Promise((t,s)=>{let a=new FileReader;a.onload=()=>{t(a.result.split(",")[1])},a.onerror=s,a.readAsDataURL(e)}),eF=async(e,t)=>{let s=await ez(t),a=t.type||(t.name.toLowerCase().endsWith(".pdf")?"application/pdf":"image/jpeg");return{role:"user",content:[{type:"input_text",text:e},{type:"input_image",image_url:"data:".concat(a,";base64,").concat(s)}]}},eB=(e,t,s,a)=>{let o="";t&&a&&(o=a.toLowerCase().endsWith(".pdf")?"[PDF attached]":"[Image attached]");let r={role:"user",content:t?"".concat(e," ").concat(o):e};return t&&s&&(r.imagePreviewUrl=s),r},eH=e=>"user"===e.role&&"string"==typeof e.content&&(e.content.includes("[Image attached]")||e.content.includes("[PDF attached]"))&&!!e.imagePreviewUrl;var eG=e=>{let{message:t}=e;if(!eH(t))return null;let s="string"==typeof t.content&&t.content.includes("[PDF attached]");return(0,a.jsx)("div",{className:"mb-2",children:s?(0,a.jsx)("div",{className:"w-64 h-32 rounded-md border border-gray-200 bg-red-50 flex items-center justify-center",children:(0,a.jsx)(y.Z,{style:{fontSize:"48px",color:"#dc2626"}})}):(0,a.jsx)("img",{src:t.imagePreviewUrl,alt:"User uploaded image",className:"max-w-64 rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"200px"}})})},eq=s(53508);let{Dragger:eJ}=S.default;var eV=e=>{let{responsesUploadedImage:t,responsesImagePreviewUrl:s,onImageUpload:o,onRemoveImage:r}=e;return(0,a.jsx)(a.Fragment,{children:!t&&(0,a.jsx)(eJ,{beforeUpload:o,accept:"image/*,.pdf",showUploadList:!1,className:"inline-block",style:{padding:0,border:"none",background:"none"},children:(0,a.jsx)(Z.Z,{title:"Attach image or PDF",children:(0,a.jsx)("button",{type:"button",className:"flex items-center justify-center w-8 h-8 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-md transition-colors",children:(0,a.jsx)(eq.Z,{style:{fontSize:"16px"}})})})})})},eW=s(33152),eY=s(63709),eX=e=>{let{endpointType:t,responsesSessionId:s,useApiSessionManagement:o,onToggleSessionManagement:r}=e;return t!==V.KP.RESPONSES?null:(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Session Management"}),(0,a.jsx)(Z.Z,{title:"Choose between LiteLLM API session management (using previous_response_id) or UI-based session management (using chat history)",children:(0,a.jsx)(u.Z,{className:"text-gray-400",style:{fontSize:"12px"}})})]}),(0,a.jsx)(eY.Z,{checked:o,onChange:r,checkedChildren:"API",unCheckedChildren:"UI",size:"small"})]}),(0,a.jsxs)("div",{className:"text-xs p-2 rounded-md ".concat(s?"bg-green-50 text-green-700 border border-green-200":"bg-blue-50 text-blue-700 border border-blue-200"),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(u.Z,{style:{fontSize:"12px"}}),(()=>{if(!s)return o?"API Session: Ready":"UI Session: Ready";let e=o?"Response ID":"UI Session",t=s.slice(0,10);return"".concat(e,": ").concat(t,"...")})()]}),s&&(0,a.jsx)(Z.Z,{title:(0,a.jsxs)("div",{className:"text-xs",children:[(0,a.jsx)("div",{className:"mb-1",children:"Copy response ID to continue session:"}),(0,a.jsx)("div",{className:"bg-gray-800 text-gray-100 p-2 rounded font-mono text-xs whitespace-pre-wrap",children:'curl -X POST "your-proxy-url/v1/responses" \\\n -H "Authorization: Bearer your-api-key" \\\n -H "Content-Type: application/json" \\\n -d \'{\n "model": "your-model",\n "input": [{"role": "user", "content": "your message", "type": "message"}],\n "previous_response_id": "'.concat(s,'",\n "stream": true\n }\'')})]}),overlayStyle:{maxWidth:"500px"},children:(0,a.jsx)("button",{onClick:()=>{s&&(navigator.clipboard.writeText(s),U.Z.success("Response ID copied to clipboard!"))},className:"ml-2 p-1 hover:bg-green-100 rounded transition-colors",children:(0,a.jsx)(ew.Z,{style:{fontSize:"12px"}})})})]}),(0,a.jsx)("div",{className:"text-xs opacity-75 mt-1",children:s?o?"LiteLLM API session active - context maintained server-side":"UI session active - context maintained client-side":o?"LiteLLM will manage session using previous_response_id":"UI will manage session using chat history"})]})]})};let{TextArea:e$}=w.default,{Dragger:eQ}=S.default;var e0=e=>{let{accessToken:t,token:s,userRole:w,userID:S,disabledPersonalKeyCreation:F,proxySettings:B}=e,[H,G]=(0,E.useState)(!1),[W,X]=(0,E.useState)([]),[ea,eo]=(0,E.useState)(()=>{let e=sessionStorage.getItem("selectedMCPTools");try{let t=e?JSON.parse(e):[];return Array.isArray(t)?t:t?[t]:[]}catch(e){return console.error("Error parsing selectedMCPTools from sessionStorage",e),[]}}),[en,ef]=(0,E.useState)(!1),[eb,ey]=(0,E.useState)(()=>{let e=sessionStorage.getItem("apiKeySource");if(e)try{return JSON.parse(e)}catch(e){console.error("Error parsing apiKeySource from sessionStorage",e)}return F?"custom":"session"}),[ej,eN]=(0,E.useState)(()=>sessionStorage.getItem("apiKey")||""),[ew,eS]=(0,E.useState)(""),[ek,eP]=(0,E.useState)(()=>{try{let e=sessionStorage.getItem("chatHistory");return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing chatHistory from sessionStorage",e),[]}}),[eA,eC]=(0,E.useState)(void 0),[eZ,eT]=(0,E.useState)(!1),[e_,eI]=(0,E.useState)([]),[eR,eM]=(0,E.useState)([]),[eL,eO]=(0,E.useState)(void 0),ez=(0,E.useRef)(null),[eH,eq]=(0,E.useState)(()=>sessionStorage.getItem("endpointType")||V.KP.CHAT),[eJ,eY]=(0,E.useState)(!1),e0=(0,E.useRef)(null),[e1,e2]=(0,E.useState)(()=>{let e=sessionStorage.getItem("selectedTags");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedTags from sessionStorage",e),[]}}),[e4,e3]=(0,E.useState)(()=>{let e=sessionStorage.getItem("selectedVoice");if(!e)return"alloy";try{return JSON.parse(e)}catch(t){return e}}),[e5,e6]=(0,E.useState)(()=>{let e=sessionStorage.getItem("selectedVectorStores");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedVectorStores from sessionStorage",e),[]}}),[e7,e8]=(0,E.useState)(()=>{let e=sessionStorage.getItem("selectedGuardrails");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedGuardrails from sessionStorage",e),[]}}),[e9,te]=(0,E.useState)(()=>sessionStorage.getItem("messageTraceId")||null),[tt,ts]=(0,E.useState)(()=>sessionStorage.getItem("responsesSessionId")||null),[ta,to]=(0,E.useState)(()=>{let e=sessionStorage.getItem("useApiSessionManagement");return!e||JSON.parse(e)}),[tr,tn]=(0,E.useState)([]),[tl,ti]=(0,E.useState)([]),[tc,td]=(0,E.useState)(null),[tm,tu]=(0,E.useState)(null),[tx,tg]=(0,E.useState)(null),[tp,th]=(0,E.useState)(null),[tf,tv]=(0,E.useState)(null),[tb,ty]=(0,E.useState)(!1),[tj,tN]=(0,E.useState)(""),[tw,tS]=(0,E.useState)("openai"),[tk,tP]=(0,E.useState)([]),[tA,tC]=(0,E.useState)(1),[tZ,tT]=(0,E.useState)(2048),[t_,tE]=(0,E.useState)(!1),tI=(0,E.useRef)(null),tR=async()=>{let e="session"===eb?t:ej;if(e){ef(!0);try{let t=await em(e);X(t)}catch(e){console.error("Error fetching MCP tools:",e)}finally{ef(!1)}}};(0,E.useEffect)(()=>{H&&tR()},[H,t,ej,eb]),(0,E.useEffect)(()=>{tb&&tN((0,et.L)({apiKeySource:eb,accessToken:t,apiKey:ej,inputMessage:ew,chatHistory:ek,selectedTags:e1,selectedVectorStores:e5,selectedGuardrails:e7,selectedMCPTools:ea,endpointType:eH,selectedModel:eA,selectedSdk:tw,selectedVoice:e4,proxySettings:B}))},[tb,tw,eb,t,ej,ew,ek,e1,e5,e7,ea,eH,eA,B]),(0,E.useEffect)(()=>{let e=setTimeout(()=>{sessionStorage.setItem("chatHistory",JSON.stringify(ek))},500);return()=>{clearTimeout(e)}},[ek]),(0,E.useEffect)(()=>{sessionStorage.setItem("apiKeySource",JSON.stringify(eb)),sessionStorage.setItem("apiKey",ej),sessionStorage.setItem("endpointType",eH),sessionStorage.setItem("selectedTags",JSON.stringify(e1)),sessionStorage.setItem("selectedVectorStores",JSON.stringify(e5)),sessionStorage.setItem("selectedGuardrails",JSON.stringify(e7)),sessionStorage.setItem("selectedMCPTools",JSON.stringify(ea)),sessionStorage.setItem("selectedVoice",e4),eA?sessionStorage.setItem("selectedModel",eA):sessionStorage.removeItem("selectedModel"),e9?sessionStorage.setItem("messageTraceId",e9):sessionStorage.removeItem("messageTraceId"),tt?sessionStorage.setItem("responsesSessionId",tt):sessionStorage.removeItem("responsesSessionId"),sessionStorage.setItem("useApiSessionManagement",JSON.stringify(ta))},[eb,ej,eA,eH,e1,e5,e7,e9,tt,ta,ea,e4]),(0,E.useEffect)(()=>{let e="session"===eb?t:ej;if(!e||!s||!w||!S){console.log("userApiKey or token or userRole or userID is missing = ",e,s,w,S);return}(async()=>{try{if(!e){console.log("userApiKey is missing");return}let t=await (0,eu.p)(e);console.log("Fetched models:",t),eI(t);let s=t.some(e=>e.model_group===eA);t.length&&s||eC(void 0)}catch(e){console.error("Error fetching model info:",e)}})(),tR()},[t,S,w,eb,ej,s]),(0,E.useEffect)(()=>{let e="session"===eb?t:ej;e&&eH===V.KP.A2A_AGENTS&&(async()=>{try{let t=await eh(e);eM(t),eL&&!t.some(e=>e.agent_name===eL)&&eO(void 0)}catch(e){console.error("Error fetching agents:",e)}})()},[t,eb,ej,eH]),(0,E.useEffect)(()=>{tI.current&&setTimeout(()=>{var e;null===(e=tI.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"end"})},100)},[ek]);let tM=(e,t,s)=>{console.log("updateTextUI called with:",e,t,s),eP(a=>{let o=a[a.length-1];if(!o||o.role!==e||o.isImage||o.isAudio)return[...a,{role:e,content:t,model:s}];{var r;let e={...o,content:o.content+t,model:null!==(r=o.model)&&void 0!==r?r:s};return[...a.slice(0,-1),e]}})},tL=e=>{eP(t=>{let s=t[t.length-1];return!s||"assistant"!==s.role||s.isImage||s.isAudio?t.length>0&&"user"===t[t.length-1].role?[...t,{role:"assistant",content:"",reasoningContent:e}]:t:[...t.slice(0,t.length-1),{...s,reasoningContent:(s.reasoningContent||"")+e}]})},tO=e=>{console.log("updateTimingData called with:",e),eP(t=>{let s=t[t.length-1];if(console.log("Current last message:",s),s&&"assistant"===s.role){console.log("Updating assistant message with timeToFirstToken:",e);let a=[...t.slice(0,t.length-1),{...s,timeToFirstToken:e}];return console.log("Updated chat history:",a),a}return s&&"user"===s.role?(console.log("Creating new assistant message with timeToFirstToken:",e),[...t,{role:"assistant",content:"",timeToFirstToken:e}]):(console.log("No appropriate message found to update timing"),t)})},tK=(e,t)=>{console.log("Received usage data:",e),eP(s=>{let a=s[s.length-1];if(a&&"assistant"===a.role){console.log("Updating message with usage data:",e);let o={...a,usage:e,toolName:t};return console.log("Updated message:",o),[...s.slice(0,s.length-1),o]}return s})},tU=e=>{console.log("Received A2A metadata:",e),eP(t=>{let s=t[t.length-1];if(s&&"assistant"===s.role){let a={...s,a2aMetadata:e};return[...t.slice(0,t.length-1),a]}return t})},tD=e=>{eP(t=>{let s=t[t.length-1];return s&&"assistant"===s.role?[...t.slice(0,t.length-1),{...s,totalLatency:e}]:t})},tz=e=>{console.log("Received search results:",e),eP(t=>{let s=t[t.length-1];if(s&&"assistant"===s.role){console.log("Updating message with search results");let a={...s,searchResults:e};return[...t.slice(0,t.length-1),a]}return t})},tF=e=>{console.log("Received response ID for session management:",e),ta&&ts(e)},tB=e=>{console.log("ChatUI: Received MCP event:",e),tP(t=>{if(t.some(t=>t.item_id===e.item_id&&t.type===e.type&&t.sequence_number===e.sequence_number))return console.log("ChatUI: Duplicate MCP event, skipping"),t;let s=[...t,e];return console.log("ChatUI: Updated MCP events:",s),s})},tH=(e,t)=>{eP(s=>[...s,{role:"assistant",content:e,model:t,isImage:!0}])},tG=(e,t)=>{eP(s=>[...s,{role:"assistant",content:(0,O.aS)(e,100),model:t,isEmbeddings:!0}])},tq=(e,t)=>{eP(s=>[...s,{role:"assistant",content:e,model:t,isAudio:!0}])},tJ=(e,t)=>{eP(s=>{let a=s[s.length-1];if(!a||"assistant"!==a.role||a.isImage||a.isAudio)return[...s,{role:"assistant",content:"",model:t,image:{url:e,detail:"auto"}}];{var o;let r={...a,image:{url:e,detail:"auto"},model:null!==(o=a.model)&&void 0!==o?o:t};return[...s.slice(0,-1),r]}})},tV=e=>{tn(t=>[...t,e]);let t=URL.createObjectURL(e);return ti(e=>[...e,t]),!1},tW=e=>{tl[e]&&URL.revokeObjectURL(tl[e]),tn(t=>t.filter((t,s)=>s!==e)),ti(t=>t.filter((t,s)=>s!==e))},tY=()=>{tl.forEach(e=>{URL.revokeObjectURL(e)}),tn([]),ti([])},tX=()=>{tm&&URL.revokeObjectURL(tm),td(null),tu(null)},t$=()=>{tp&&URL.revokeObjectURL(tp),tg(null),th(null)},tQ=()=>{tv(null)},t0=async()=>{let e;if(""===ew.trim()&&eH!==V.KP.TRANSCRIPTION)return;if(eH===V.KP.IMAGE_EDITS&&0===tr.length){U.Z.fromBackend("Please upload at least one image for editing");return}if(eH===V.KP.TRANSCRIPTION&&!tf){U.Z.fromBackend("Please upload an audio file for transcription");return}if(eH===V.KP.A2A_AGENTS&&!eL){U.Z.fromBackend("Please select an agent to send a message");return}if(!s||!w||!S)return;let a="session"===eb?t:ej;if(!a){U.Z.fromBackend("Please provide a Virtual Key or select Current UI Session");return}e0.current=new AbortController;let o=e0.current.signal;if(eH===V.KP.RESPONSES&&tc)try{e=await eF(ew,tc)}catch(e){U.Z.fromBackend("Failed to process image. Please try again.");return}else if(eH===V.KP.CHAT&&tx)try{e=await (0,ee.Sn)(ew,tx)}catch(e){U.Z.fromBackend("Failed to process image. Please try again.");return}else e={role:"user",content:ew};let r=e9||(0,L.Z)();e9||te(r),eP([...ek,eH===V.KP.RESPONSES&&tc?eB(ew,!0,tm||void 0,tc.name):eH===V.KP.CHAT&&tx?(0,ee.Hk)(ew,!0,tp||void 0,tx.name):eH===V.KP.TRANSCRIPTION&&tf?eB(ew?"\uD83C\uDFB5 Audio file: ".concat(tf.name,"\nPrompt: ").concat(ew):"\uD83C\uDFB5 Audio file: ".concat(tf.name),!1):eB(ew,!1)]),tP([]),eY(!0);try{if(eA){if(eH===V.KP.CHAT){let t=[...ek.filter(e=>!e.isImage&&!e.isAudio).map(e=>{let{role:t,content:s}=e;return{role:t,content:"string"==typeof s?s:""}}),e];await (0,ec.n)(t,(e,t)=>tM("assistant",e,t),eA,a,e1,o,tL,tO,tK,r,e5.length>0?e5:void 0,e7.length>0?e7:void 0,ea,tJ,tz,t_?tA:void 0,t_?tZ:void 0,tD)}else if(eH===V.KP.IMAGE)await eg(ew,(e,t)=>tH(e,t),eA,a,e1,o);else if(eH===V.KP.SPEECH)await el(ew,e4,(e,t)=>tq(e,t),eA||"",a,e1,o);else if(eH===V.KP.IMAGE_EDITS)tr.length>0&&await ex(1===tr.length?tr[0]:tr,ew,(e,t)=>tH(e,t),eA,a,e1,o);else if(eH===V.KP.RESPONSES){let t;t=ta&&tt?[e]:[...ek.filter(e=>!e.isImage&&!e.isAudio).map(e=>{let{role:t,content:s}=e;return{role:t,content:s}}),e],await ep(t,(e,t,s)=>tM(e,t,s),eA,a,e1,o,tL,tO,tK,r,e5.length>0?e5:void 0,e7.length>0?e7:void 0,ea,ta?tt:null,tF,tB)}else if(eH===V.KP.ANTHROPIC_MESSAGES){let t=[...ek.filter(e=>!e.isImage&&!e.isAudio).map(e=>{let{role:t,content:s}=e;return{role:t,content:s}}),e];await er(t,(e,t,s)=>tM(e,t,s),eA,a,e1,o,tL,tO,tK,r,e5.length>0?e5:void 0,e7.length>0?e7:void 0,ea)}else eH===V.KP.EMBEDDINGS?await ed(ew,(e,t)=>tG(e,t),eA,a,e1):eH===V.KP.TRANSCRIPTION&&tf&&await ei(tf,(e,t)=>tM("assistant",e,t),eA,a,e1,o)}eH===V.KP.A2A_AGENTS&&eL&&await ev(eL,ew,(e,t)=>tM("assistant",e,t),a,o,tO,tD,tU)}catch(e){o.aborted?console.log("Request was cancelled"):(console.error("Error fetching response",e),tM("assistant","Error fetching response:"+e))}finally{eY(!1),e0.current=null,eH===V.KP.IMAGE_EDITS&&tY(),eH===V.KP.RESPONSES&&tc&&tX(),eH===V.KP.CHAT&&tx&&t$(),eH===V.KP.TRANSCRIPTION&&tf&&tQ()}eS("")};if(w&&"Admin Viewer"===w){let{Title:e,Paragraph:t}=k.default;return(0,a.jsxs)("div",{children:[(0,a.jsx)(e,{level:1,children:"Access Denied"}),(0,a.jsx)(t,{children:"Ask your proxy admin for access to test models"})]})}let t1=(0,a.jsx)(o.Z,{style:{fontSize:24},spin:!0});return(0,a.jsxs)("div",{className:"w-full p-4 pb-0 bg-white",children:[(0,a.jsx)(N.Zb,{className:"w-full rounded-xl shadow-md overflow-hidden",children:(0,a.jsxs)("div",{className:"flex h-[80vh] w-full gap-4",children:[(0,a.jsxs)("div",{className:"w-1/4 p-4 bg-gray-50 overflow-y-auto",children:[(0,a.jsx)(N.Dx,{className:"text-xl font-semibold mb-6 mt-2",children:"Configurations"}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(r.Z,{className:"mr-2"})," Virtual Key Source"]}),(0,a.jsx)(P.default,{disabled:F,value:eb,style:{width:"100%"},onChange:e=>{ey(e)},options:[{value:"session",label:"Current UI Session"},{value:"custom",label:"Virtual Key"}],className:"rounded-md"}),"custom"===eb&&(0,a.jsx)(N.oi,{className:"mt-2",placeholder:"Enter custom Virtual Key",type:"password",onValueChange:eN,value:ej,icon:r.Z})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(n.Z,{className:"mr-2"})," Endpoint Type"]}),(0,a.jsx)(es,{endpointType:eH,onEndpointChange:e=>{eq(e),eC(void 0),eO(void 0),eT(!1);try{sessionStorage.removeItem("selectedModel"),sessionStorage.removeItem("selectedAgent")}catch(e){}},className:"mb-4"}),eH===V.KP.SPEECH&&(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(l.Z,{className:"mr-2"}),"Voice"]}),(0,a.jsx)(P.default,{value:e4,onChange:e=>{e3(e),sessionStorage.setItem("selectedVoice",e)},style:{width:"100%"},className:"rounded-md",options:Y})]}),(0,a.jsx)(eX,{endpointType:eH,responsesSessionId:tt,useApiSessionManagement:ta,onToggleSessionManagement:e=>{to(e),e||ts(null)}})]}),eH!==V.KP.A2A_AGENTS&&(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center justify-between",children:[(0,a.jsxs)("span",{className:"flex items-center",children:[(0,a.jsx)(i.Z,{className:"mr-2"})," Select Model"]}),(()=>{if(!eA||"custom"===eA)return!1;let e=e_.find(e=>e.model_group===eA);return!!e&&(!e.mode||"chat"===e.mode)})()?(0,a.jsx)(A.Z,{content:(0,a.jsx)(q,{temperature:tA,maxTokens:tZ,useAdvancedParams:t_,onTemperatureChange:tC,onMaxTokensChange:tT,onUseAdvancedParamsChange:tE}),title:"Model Settings",trigger:"click",placement:"right",children:(0,a.jsx)(C.ZP,{type:"text",size:"small",icon:(0,a.jsx)(c.Z,{}),className:"text-gray-500 hover:text-gray-700"})}):(0,a.jsx)(Z.Z,{title:"Advanced parameters are only supported for chat models currently",children:(0,a.jsx)(C.ZP,{type:"text",size:"small",icon:(0,a.jsx)(c.Z,{}),className:"text-gray-300 cursor-not-allowed",disabled:!0})})]}),(0,a.jsx)(P.default,{value:eA,placeholder:"Select a Model",onChange:e=>{console.log("selected ".concat(e)),eC(e),eT("custom"===e)},options:[...Array.from(new Set(e_.filter(e=>{if(!e.mode)return!0;let t=(0,V.vf)(e.mode);return eH===V.KP.RESPONSES||eH===V.KP.ANTHROPIC_MESSAGES?t===eH||t===V.KP.CHAT:eH===V.KP.IMAGE_EDITS?t===eH||t===V.KP.IMAGE:t===eH}).map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%"},showSearch:!0,className:"rounded-md"}),eZ&&(0,a.jsx)(N.oi,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{ez.current&&clearTimeout(ez.current),ez.current=setTimeout(()=>{eC(e)},500)}})]}),eH===V.KP.A2A_AGENTS&&(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(i.Z,{className:"mr-2"})," Select Agent"]}),(0,a.jsx)(P.default,{value:eL,placeholder:"Select an Agent",onChange:e=>eO(e),options:eR.map(e=>({value:e.agent_name,label:e.agent_name||e.agent_id,key:e.agent_id})),style:{width:"100%"},showSearch:!0,className:"rounded-md",optionLabelProp:"label",children:eR.map(e=>{var t;return(0,a.jsx)(P.default.Option,{value:e.agent_name,label:e.agent_name||e.agent_id,children:(0,a.jsxs)("div",{className:"flex flex-col py-1",children:[(0,a.jsx)("span",{className:"font-medium",children:e.agent_name||e.agent_id}),(null===(t=e.agent_card_params)||void 0===t?void 0:t.description)&&(0,a.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:e.agent_card_params.description})]})},e.agent_id)})}),0===eR.length&&(0,a.jsx)(N.xv,{className:"text-xs text-gray-500 mt-2 block",children:"No agents found. Create agents via /v1/agents endpoint."})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(d.Z,{className:"mr-2"})," Tags"]}),(0,a.jsx)(D.Z,{value:e1,onChange:e2,className:"mb-4",accessToken:t||""})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(m.Z,{className:"mr-2"})," MCP Tool",(0,a.jsx)(Z.Z,{className:"ml-1",title:"Select MCP tools to use in your conversation, only available for /v1/responses endpoint",children:(0,a.jsx)(u.Z,{})})]}),(0,a.jsx)(P.default,{mode:"multiple",style:{width:"100%"},placeholder:"Select MCP tools",value:ea,onChange:e=>eo(e),loading:en,className:"mb-4",allowClear:!0,optionLabelProp:"label",disabled:eH!==V.KP.RESPONSES,maxTagCount:"responsive",children:Array.isArray(W)&&W.map(e=>(0,a.jsx)(P.default.Option,{value:e.name,label:(0,a.jsx)("div",{className:"font-medium",children:e.name}),children:(0,a.jsxs)("div",{className:"flex flex-col py-1",children:[(0,a.jsx)("span",{className:"font-medium",children:e.name}),(0,a.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:e.description})]})},e.name))})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(x.Z,{className:"mr-2"})," Vector Store",(0,a.jsx)(Z.Z,{className:"ml-1",title:(0,a.jsxs)("span",{children:["Select vector store(s) to use for this LLM API call. You can set up your vector store"," ",(0,a.jsx)("a",{href:"?page=vector-stores",style:{color:"#1890ff"},children:"here"}),"."]}),children:(0,a.jsx)(u.Z,{})})]}),(0,a.jsx)(z.Z,{value:e5,onChange:e6,className:"mb-4",accessToken:t||""})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(g.Z,{className:"mr-2"})," Guardrails",(0,a.jsx)(Z.Z,{className:"ml-1",title:(0,a.jsxs)("span",{children:["Select guardrail(s) to use for this LLM API call. You can set up your guardrails"," ",(0,a.jsx)("a",{href:"?page=guardrails",style:{color:"#1890ff"},children:"here"}),"."]}),children:(0,a.jsx)(u.Z,{})})]}),(0,a.jsx)(K.Z,{value:e7,onChange:e8,className:"mb-4",accessToken:t||""})]})]})]}),(0,a.jsxs)("div",{className:"w-3/4 flex flex-col bg-white",children:[(0,a.jsxs)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:[(0,a.jsx)(N.Dx,{className:"text-xl font-semibold mb-0",children:"Test Key"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(N.zx,{onClick:()=>{ek.forEach(e=>{e.isAudio&&"string"==typeof e.content&&URL.revokeObjectURL(e.content)}),eP([]),te(null),ts(null),tP([]),tY(),tX(),t$(),tQ(),sessionStorage.removeItem("chatHistory"),sessionStorage.removeItem("messageTraceId"),sessionStorage.removeItem("responsesSessionId"),U.Z.success("Chat history cleared.")},className:"bg-gray-100 hover:bg-gray-200 text-gray-700 border-gray-300",icon:p.Z,children:"Clear Chat"}),(0,a.jsx)(N.zx,{onClick:()=>ty(!0),className:"bg-gray-100 hover:bg-gray-200 text-gray-700 border-gray-300",icon:h.Z,children:"Get Code"})]})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-auto p-4 pb-0",children:[0===ek.length&&(0,a.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,a.jsx)(i.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,a.jsx)(N.xv,{children:"Start a conversation, generate an image, or handle audio"})]}),ek.map((e,t)=>(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"mb-4 ".concat("user"===e.role?"text-right":"text-left"),children:(0,a.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3.5 px-4",style:{backgroundColor:"user"===e.role?"#f0f8ff":"#ffffff",border:"user"===e.role?"1px solid #e6f0fa":"1px solid #f0f0f0",textAlign:"left"},children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded-full mr-1",style:{backgroundColor:"user"===e.role?"#e6f0fa":"#f5f5f5"},children:"user"===e.role?(0,a.jsx)(f.Z,{style:{fontSize:"12px",color:"#2563eb"}}):(0,a.jsx)(i.Z,{style:{fontSize:"12px",color:"#4b5563"}})}),(0,a.jsx)("strong",{className:"text-sm capitalize",children:e.role}),"assistant"===e.role&&e.model&&(0,a.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-gray-100 text-gray-600 font-normal",children:e.model})]}),e.reasoningContent&&(0,a.jsx)(eU.Z,{reasoningContent:e.reasoningContent}),"assistant"===e.role&&t===ek.length-1&&tk.length>0&&eH===V.KP.RESPONSES&&(0,a.jsx)("div",{className:"mb-3",children:(0,a.jsx)(eK,{events:tk})}),"assistant"===e.role&&e.searchResults&&(0,a.jsx)(eW.J,{searchResults:e.searchResults}),(0,a.jsxs)("div",{className:"whitespace-pre-wrap break-words max-w-full message-content",style:{wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",hyphens:"auto"},children:[e.isImage?(0,a.jsx)("img",{src:"string"==typeof e.content?e.content:"",alt:"Generated image",className:"max-w-full rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"500px"}}):e.isAudio?(0,a.jsx)(J,{message:e}):(0,a.jsxs)(a.Fragment,{children:[eH===V.KP.RESPONSES&&(0,a.jsx)(eG,{message:e}),eH===V.KP.CHAT&&(0,a.jsx)($.Z,{message:e}),(0,a.jsx)(I.UG,{components:{code(e){let{node:t,inline:s,className:o,children:r,...n}=e,l=/language-(\w+)/.exec(o||"");return!s&&l?(0,a.jsx)(R.Z,{style:M.Z,language:l[1],PreTag:"div",className:"rounded-md my-2",wrapLines:!0,wrapLongLines:!0,...n,children:String(r).replace(/\n$/,"")}):(0,a.jsx)("code",{className:"".concat(o," px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono"),style:{wordBreak:"break-word"},...n,children:r})},pre:e=>{let{node:t,...s}=e;return(0,a.jsx)("pre",{style:{overflowX:"auto",maxWidth:"100%"},...s})}},children:"string"==typeof e.content?e.content:""}),e.image&&(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsx)("img",{src:e.image.url,alt:"Generated image",className:"max-w-full rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"500px"}})})]}),"assistant"===e.role&&(e.timeToFirstToken||e.totalLatency||e.usage)&&!e.a2aMetadata&&(0,a.jsx)(eD.Z,{timeToFirstToken:e.timeToFirstToken,totalLatency:e.totalLatency,usage:e.usage,toolName:e.toolName}),"assistant"===e.role&&e.a2aMetadata&&(0,a.jsx)(eE,{a2aMetadata:e.a2aMetadata,timeToFirstToken:e.timeToFirstToken,totalLatency:e.totalLatency})]})]})})},t)),eJ&&tk.length>0&&eH===V.KP.RESPONSES&&ek.length>0&&"user"===ek[ek.length-1].role&&(0,a.jsx)("div",{className:"text-left mb-4",children:(0,a.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3.5 px-4",style:{backgroundColor:"#ffffff",border:"1px solid #f0f0f0",textAlign:"left"},children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded-full mr-1",style:{backgroundColor:"#f5f5f5"},children:(0,a.jsx)(i.Z,{style:{fontSize:"12px",color:"#4b5563"}})}),(0,a.jsx)("strong",{className:"text-sm capitalize",children:"Assistant"})]}),(0,a.jsx)(eK,{events:tk})]})}),eJ&&(0,a.jsx)("div",{className:"flex justify-center items-center my-4",children:(0,a.jsx)(T.Z,{indicator:t1})}),(0,a.jsx)("div",{ref:tI,style:{height:"1px"}})]}),(0,a.jsxs)("div",{className:"p-4 border-t border-gray-200 bg-white",children:[eH===V.KP.IMAGE_EDITS&&(0,a.jsx)("div",{className:"mb-4",children:0===tr.length?(0,a.jsxs)(eQ,{beforeUpload:tV,accept:"image/*",showUploadList:!1,children:[(0,a.jsx)("p",{className:"ant-upload-drag-icon",children:(0,a.jsx)(v.Z,{style:{fontSize:"24px",color:"#666"}})}),(0,a.jsx)("p",{className:"ant-upload-text text-sm",children:"Click or drag images to upload"}),(0,a.jsx)("p",{className:"ant-upload-hint text-xs text-gray-500",children:"Support for PNG, JPG, JPEG formats. Multiple images supported."})]}):(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[tr.map((e,t)=>(0,a.jsxs)("div",{className:"relative inline-block",children:[(0,a.jsx)("img",{src:tl[t]||"",alt:"Upload preview ".concat(t+1),className:"max-w-32 max-h-32 rounded-md border border-gray-200 object-cover"}),(0,a.jsx)("button",{className:"absolute top-1 right-1 bg-white shadow-sm border border-gray-200 rounded px-1 py-1 text-red-500 hover:bg-red-50 text-xs",onClick:()=>tW(t),children:(0,a.jsx)(b.Z,{})})]},t)),(0,a.jsxs)("div",{className:"flex items-center justify-center w-32 h-32 border-2 border-dashed border-gray-300 rounded-md hover:border-gray-400 cursor-pointer",onClick:()=>{var e;return null===(e=document.getElementById("additional-image-upload"))||void 0===e?void 0:e.click()},children:[(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)(v.Z,{style:{fontSize:"24px",color:"#666"}}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Add more"})]}),(0,a.jsx)("input",{id:"additional-image-upload",type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:e=>{Array.from(e.target.files||[]).forEach(e=>tV(e))}})]})]})}),eH===V.KP.TRANSCRIPTION&&(0,a.jsx)("div",{className:"mb-4",children:tf?(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-1",children:[(0,a.jsx)(l.Z,{style:{fontSize:"20px",color:"#666"}}),(0,a.jsx)("span",{className:"text-sm font-medium",children:tf.name}),(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:["(",(tf.size/1024/1024).toFixed(2)," MB)"]})]}),(0,a.jsxs)("button",{className:"bg-white shadow-sm border border-gray-200 rounded px-2 py-1 text-red-500 hover:bg-red-50 text-xs",onClick:tQ,children:[(0,a.jsx)(b.Z,{})," Remove"]})]}):(0,a.jsxs)(eQ,{beforeUpload:e=>(tv(e),!1),accept:"audio/*,.mp3,.mp4,.mpeg,.mpga,.m4a,.wav,.webm",showUploadList:!1,children:[(0,a.jsx)("p",{className:"ant-upload-drag-icon",children:(0,a.jsx)(l.Z,{style:{fontSize:"24px",color:"#666"}})}),(0,a.jsx)("p",{className:"ant-upload-text text-sm",children:"Click or drag audio file to upload"}),(0,a.jsx)("p",{className:"ant-upload-hint text-xs text-gray-500",children:"Support for MP3, MP4, MPEG, MPGA, M4A, WAV, WEBM formats. Max file size: 25 MB."})]})}),eH===V.KP.RESPONSES&&tc&&(0,a.jsx)("div",{className:"mb-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,a.jsx)("div",{className:"relative inline-block",children:tc.name.toLowerCase().endsWith(".pdf")?(0,a.jsx)("div",{className:"w-10 h-10 rounded-md bg-red-500 flex items-center justify-center",children:(0,a.jsx)(y.Z,{style:{fontSize:"16px",color:"white"}})}):(0,a.jsx)("img",{src:tm||"",alt:"Upload preview",className:"w-10 h-10 rounded-md border border-gray-200 object-cover"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:tc.name}),(0,a.jsx)("div",{className:"text-xs text-gray-500",children:tc.name.toLowerCase().endsWith(".pdf")?"PDF":"Image"})]}),(0,a.jsx)("button",{className:"flex items-center justify-center w-6 h-6 text-gray-400 hover:text-gray-600 hover:bg-gray-200 rounded-full transition-colors",onClick:tX,children:(0,a.jsx)(b.Z,{style:{fontSize:"12px"}})})]})}),eH===V.KP.CHAT&&tx&&(0,a.jsx)("div",{className:"mb-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,a.jsx)("div",{className:"relative inline-block",children:tx.name.toLowerCase().endsWith(".pdf")?(0,a.jsx)("div",{className:"w-10 h-10 rounded-md bg-red-500 flex items-center justify-center",children:(0,a.jsx)(y.Z,{style:{fontSize:"16px",color:"white"}})}):(0,a.jsx)("img",{src:tp||"",alt:"Upload preview",className:"w-10 h-10 rounded-md border border-gray-200 object-cover"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:tx.name}),(0,a.jsx)("div",{className:"text-xs text-gray-500",children:tx.name.toLowerCase().endsWith(".pdf")?"PDF":"Image"})]}),(0,a.jsx)("button",{className:"flex items-center justify-center w-6 h-6 text-gray-400 hover:text-gray-600 hover:bg-gray-200 rounded-full transition-colors",onClick:t$,children:(0,a.jsx)(b.Z,{style:{fontSize:"12px"}})})]})}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center flex-1 bg-white border border-gray-300 rounded-xl px-3 py-1 min-h-[44px]",children:[(0,a.jsxs)("div",{className:"flex-shrink-0 mr-2",children:[eH===V.KP.RESPONSES&&!tc&&(0,a.jsx)(eV,{responsesUploadedImage:tc,responsesImagePreviewUrl:tm,onImageUpload:e=>(td(e),tu(URL.createObjectURL(e)),!1),onRemoveImage:tX}),eH===V.KP.CHAT&&!tx&&(0,a.jsx)(Q.Z,{chatUploadedImage:tx,chatImagePreviewUrl:tp,onImageUpload:e=>(tg(e),th(URL.createObjectURL(e)),!1),onRemoveImage:t$})]}),(0,a.jsx)(e$,{value:ew,onChange:e=>eS(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),t0())},placeholder:eH===V.KP.CHAT||eH===V.KP.EMBEDDINGS||eH===V.KP.RESPONSES||eH===V.KP.ANTHROPIC_MESSAGES?"Type your message... (Shift+Enter for new line)":eH===V.KP.A2A_AGENTS?"Send a message to the A2A agent...":eH===V.KP.IMAGE_EDITS?"Describe how you want to edit the image...":eH===V.KP.SPEECH?"Enter text to convert to speech...":eH===V.KP.TRANSCRIPTION?"Optional: Add context or prompt for transcription...":"Describe the image you want to generate...",disabled:eJ,className:"flex-1",autoSize:{minRows:1,maxRows:4},style:{resize:"none",border:"none",boxShadow:"none",background:"transparent",padding:"4px 0",fontSize:"14px",lineHeight:"20px"}}),(0,a.jsx)(N.zx,{onClick:t0,disabled:eJ||(eH===V.KP.TRANSCRIPTION?!tf:!ew.trim()),className:"flex-shrink-0 ml-2 !w-8 !h-8 !min-w-8 !p-0 !rounded-full !bg-blue-600 hover:!bg-blue-700 disabled:!bg-gray-300 !border-none !text-white disabled:!text-gray-500 !flex !items-center !justify-center",children:(0,a.jsx)(j.Z,{style:{fontSize:"14px"}})})]}),eJ&&(0,a.jsx)(N.zx,{onClick:()=>{e0.current&&(e0.current.abort(),e0.current=null,eY(!1),U.Z.info("Request cancelled"))},className:"bg-red-50 hover:bg-red-100 text-red-600 border-red-200",icon:b.Z,children:"Cancel"})]})]})]})]})}),(0,a.jsxs)(_.Z,{title:"Generated Code",visible:tb,onCancel:()=>ty(!1),footer:null,width:800,children:[(0,a.jsxs)("div",{className:"flex justify-between items-end my-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(N.xv,{className:"font-medium block mb-1 text-gray-700",children:"SDK Type"}),(0,a.jsx)(P.default,{value:tw,onChange:e=>tS(e),style:{width:150},options:[{value:"openai",label:"OpenAI SDK"},{value:"azure",label:"Azure SDK"}]})]}),(0,a.jsx)(C.ZP,{onClick:()=>{navigator.clipboard.writeText(tj),U.Z.success("Copied to clipboard!")},children:"Copy to Clipboard"})]}),(0,a.jsx)(R.Z,{language:"python",style:M.Z,wrapLines:!0,wrapLongLines:!0,className:"rounded-md",customStyle:{maxHeight:"60vh",overflowY:"auto"},children:tj})]}),"custom"===eb&&(0,a.jsx)(_.Z,{title:"Select MCP Tool",visible:H,onCancel:()=>G(!1),onOk:()=>{G(!1),U.Z.success("MCP tool selection updated")},width:800,children:en?(0,a.jsx)("div",{className:"flex justify-center items-center py-8",children:(0,a.jsx)(T.Z,{indicator:(0,a.jsx)(o.Z,{style:{fontSize:24},spin:!0})})}):(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(N.xv,{className:"text-gray-600 block mb-4",children:"Select the MCP tools you want to use in your conversation."}),(0,a.jsx)(P.default,{mode:"multiple",style:{width:"100%"},placeholder:"Select MCP tools",value:ea,onChange:e=>eo(e),optionLabelProp:"label",allowClear:!0,maxTagCount:"responsive",children:W.map(e=>(0,a.jsx)(P.default.Option,{value:e.name,label:(0,a.jsx)("div",{className:"font-medium",children:e.name}),children:(0,a.jsxs)("div",{className:"flex flex-col py-1",children:[(0,a.jsx)("span",{className:"font-medium",children:e.name}),(0,a.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:e.description})]})},e.name))})]})})]})}},94331:function(e,t,s){var a=s(57437),o=s(2265),r=s(5545),n=s(62831),l=s(17906),i=s(94263),c=s(83322),d=s(70464),m=s(77565);t.Z=e=>{let{reasoningContent:t}=e,[s,u]=(0,o.useState)(!0);return t?(0,a.jsxs)("div",{className:"reasoning-content mt-1 mb-2",children:[(0,a.jsxs)(r.ZP,{type:"text",className:"flex items-center text-xs text-gray-500 hover:text-gray-700",onClick:()=>u(!s),icon:(0,a.jsx)(c.Z,{}),children:[s?"Hide reasoning":"Show reasoning",s?(0,a.jsx)(d.Z,{className:"ml-1"}):(0,a.jsx)(m.Z,{className:"ml-1"})]}),s&&(0,a.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md text-sm text-gray-700",children:(0,a.jsx)(n.UG,{components:{code(e){let{node:t,inline:s,className:o,children:r,...n}=e,c=/language-(\w+)/.exec(o||"");return!s&&c?(0,a.jsx)(l.Z,{style:i.Z,language:c[1],PreTag:"div",className:"rounded-md my-2",...n,children:String(r).replace(/\n$/,"")}):(0,a.jsx)("code",{className:"".concat(o," px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono"),...n,children:r})}},children:t})})]}):null}},38398:function(e,t,s){var a=s(57437);s(2265);var o=s(99981),r=s(5540),n=s(71282),l=s(11741),i=s(83322),c=s(16601),d=s(62670),m=s(58630);t.Z=e=>{let{timeToFirstToken:t,totalLatency:s,usage:u,toolName:x}=e;return t||s||u?(0,a.jsxs)("div",{className:"response-metrics mt-2 pt-2 border-t border-gray-100 text-xs text-gray-500 flex flex-wrap gap-3",children:[void 0!==t&&(0,a.jsx)(o.Z,{title:"Time to first token",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(r.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["TTFT: ",(t/1e3).toFixed(2),"s"]})]})}),void 0!==s&&(0,a.jsx)(o.Z,{title:"Total latency",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(r.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Total Latency: ",(s/1e3).toFixed(2),"s"]})]})}),(null==u?void 0:u.promptTokens)!==void 0&&(0,a.jsx)(o.Z,{title:"Prompt tokens",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(n.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["In: ",u.promptTokens]})]})}),(null==u?void 0:u.completionTokens)!==void 0&&(0,a.jsx)(o.Z,{title:"Completion tokens",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(l.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Out: ",u.completionTokens]})]})}),(null==u?void 0:u.reasoningTokens)!==void 0&&(0,a.jsx)(o.Z,{title:"Reasoning tokens",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(i.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Reasoning: ",u.reasoningTokens]})]})}),(null==u?void 0:u.totalTokens)!==void 0&&(0,a.jsx)(o.Z,{title:"Total tokens",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(c.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Total: ",u.totalTokens]})]})}),(null==u?void 0:u.cost)!==void 0&&(0,a.jsx)(o.Z,{title:"Cost",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(d.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["$",u.cost.toFixed(6)]})]})}),x&&(0,a.jsx)(o.Z,{title:"Tool used",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(m.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Tool: ",x]})]})})]}):null}},33152:function(e,t,s){s.d(t,{J:function(){return d}});var a=s(57437),o=s(2265),r=s(5545),n=s(44625),l=s(70464),i=s(77565),c=s(38434);function d(e){let{searchResults:t}=e,[s,d]=(0,o.useState)(!0),[m,u]=(0,o.useState)({});if(!t||0===t.length)return null;let x=(e,t)=>{let s="".concat(e,"-").concat(t);u(e=>({...e,[s]:!e[s]}))},g=t.reduce((e,t)=>e+t.data.length,0);return(0,a.jsxs)("div",{className:"search-results-content mt-1 mb-2",children:[(0,a.jsxs)(r.ZP,{type:"text",className:"flex items-center text-xs text-gray-500 hover:text-gray-700",onClick:()=>d(!s),icon:(0,a.jsx)(n.Z,{}),children:[s?"Hide sources":"Show sources (".concat(g,")"),s?(0,a.jsx)(l.Z,{className:"ml-1"}):(0,a.jsx)(i.Z,{className:"ml-1"})]}),s&&(0,a.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md text-sm",children:(0,a.jsx)("div",{className:"space-y-3",children:t.map((e,t)=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"text-xs text-gray-600 mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"font-medium",children:"Query:"}),(0,a.jsxs)("span",{className:"italic",children:['"',e.search_query,'"']}),(0,a.jsx)("span",{className:"text-gray-400",children:"•"}),(0,a.jsxs)("span",{className:"text-gray-500",children:[e.data.length," result",1!==e.data.length?"s":""]})]}),(0,a.jsx)("div",{className:"space-y-2",children:e.data.map((e,s)=>{let o=m["".concat(t,"-").concat(s)]||!1;return(0,a.jsxs)("div",{className:"border border-gray-200 rounded-md overflow-hidden bg-white",children:[(0,a.jsx)("div",{className:"flex items-center justify-between p-2 cursor-pointer hover:bg-gray-50 transition-colors",onClick:()=>x(t,s),children:(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,a.jsx)("svg",{className:"w-4 h-4 text-gray-400 transition-transform flex-shrink-0 ".concat(o?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,a.jsx)(c.Z,{className:"text-gray-400 flex-shrink-0",style:{fontSize:"12px"}}),(0,a.jsx)("span",{className:"text-xs font-medium text-gray-700 truncate",children:e.filename||e.file_id||"Result ".concat(s+1)}),(0,a.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-blue-100 text-blue-700 font-mono flex-shrink-0",children:e.score.toFixed(3)})]})}),o&&(0,a.jsx)("div",{className:"border-t border-gray-200 bg-white",children:(0,a.jsxs)("div",{className:"p-3 space-y-2",children:[e.content.map((e,t)=>(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"text-xs font-mono bg-gray-50 p-2 rounded text-gray-800 whitespace-pre-wrap break-words",children:e.text})},t)),e.attributes&&Object.keys(e.attributes).length>0&&(0,a.jsxs)("div",{className:"mt-2 pt-2 border-t border-gray-100",children:[(0,a.jsx)("div",{className:"text-xs text-gray-500 mb-1 font-medium",children:"Metadata:"}),(0,a.jsx)("div",{className:"space-y-1",children:Object.entries(e.attributes).map(e=>{let[t,s]=e;return(0,a.jsxs)("div",{className:"text-xs flex gap-2",children:[(0,a.jsxs)("span",{className:"text-gray-500 font-medium",children:[t,":"]}),(0,a.jsx)("span",{className:"text-gray-700 font-mono break-all",children:String(s)})]},t)})})]})]})})]},s)})})]},t))})})]})}},95459:function(e,t,s){s.d(t,{n:function(){return r}});var a=s(7271),o=s(19250);async function r(e,t,s,r,n,l,i,c,d,m,u,x,g,p,h,f,v,b){console.log=function(){},console.log("isLocal:",!1);let y=(0,o.getProxyBaseUrl)(),j={};n&&n.length>0&&(j["x-litellm-tags"]=n.join(","));let N=new a.ZP.OpenAI({apiKey:r,baseURL:y,dangerouslyAllowBrowser:!0,defaultHeaders:j});try{let a;let o=Date.now(),n=!1,j=g&&g.length>0?[{type:"mcp",server_label:"litellm",server_url:"".concat(y,"/mcp"),require_approval:"never",allowed_tools:g,headers:{"x-litellm-api-key":"Bearer ".concat(r)}}]:void 0;for await(let r of(await N.chat.completions.create({model:s,stream:!0,stream_options:{include_usage:!0},litellm_trace_id:m,messages:e,...u?{vector_store_ids:u}:{},...x?{guardrails:x}:{},...j?{tools:j,tool_choice:"auto"}:{},...void 0!==f?{temperature:f}:{},...void 0!==v?{max_tokens:v}:{}},{signal:l}))){var w,S,k,P,A,C,Z,T,_;console.log("Stream chunk:",r);let e=null===(w=r.choices[0])||void 0===w?void 0:w.delta;if(console.log("Delta content:",null===(k=r.choices[0])||void 0===k?void 0:null===(S=k.delta)||void 0===S?void 0:S.content),console.log("Delta reasoning content:",null==e?void 0:e.reasoning_content),!n&&((null===(A=r.choices[0])||void 0===A?void 0:null===(P=A.delta)||void 0===P?void 0:P.content)||e&&e.reasoning_content)&&(n=!0,a=Date.now()-o,console.log("First token received! Time:",a,"ms"),c?(console.log("Calling onTimingData with:",a),c(a)):console.log("onTimingData callback is not defined!")),null===(Z=r.choices[0])||void 0===Z?void 0:null===(C=Z.delta)||void 0===C?void 0:C.content){let e=r.choices[0].delta.content;t(e,r.model)}if(e&&e.image&&p&&(console.log("Image generated:",e.image),p(e.image.url,r.model)),e&&e.reasoning_content){let t=e.reasoning_content;i&&i(t)}if(e&&(null===(T=e.provider_specific_fields)||void 0===T?void 0:T.search_results)&&h&&(console.log("Search results found:",e.provider_specific_fields.search_results),h(e.provider_specific_fields.search_results)),r.usage&&d){console.log("Usage data found:",r.usage);let e={completionTokens:r.usage.completion_tokens,promptTokens:r.usage.prompt_tokens,totalTokens:r.usage.total_tokens};(null===(_=r.usage.completion_tokens_details)||void 0===_?void 0:_.reasoning_tokens)&&(e.reasoningTokens=r.usage.completion_tokens_details.reasoning_tokens),void 0!==r.usage.cost&&null!==r.usage.cost&&(e.cost=parseFloat(r.usage.cost)),d(e)}}let E=Date.now();b&&b(E-o)}catch(e){throw(null==l?void 0:l.aborted)&&console.log("Chat completion request was cancelled"),e}}},99020:function(e,t,s){var a=s(57437),o=s(2265),r=s(37592),n=s(19250);t.Z=e=>{let{onChange:t,value:s,className:l,accessToken:i}=e,[c,d]=(0,o.useState)([]),[m,u]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{(async()=>{if(i)try{let e=await (0,n.tagListCall)(i);console.log("List tags response:",e),d(Object.values(e))}catch(e){console.error("Error fetching tags:",e)}finally{u(!1)}})()},[i]),(0,a.jsx)(r.default,{mode:"tags",showSearch:!0,placeholder:"Select or create tags",onChange:t,value:s,loading:m,className:l,options:c.map(e=>({label:e.name,value:e.name,title:e.description||e.name})),optionFilterProp:"label",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"}})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/5333-1540faf81c7d7006.js b/litellm/proxy/_experimental/out/_next/static/chunks/5333-e9bc197d1822e3ad.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/5333-1540faf81c7d7006.js rename to litellm/proxy/_experimental/out/_next/static/chunks/5333-e9bc197d1822e3ad.js index 2a03ddfa5f..5e4051ca90 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/5333-1540faf81c7d7006.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/5333-e9bc197d1822e3ad.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5333],{43227:function(e,t,n){n.d(t,{Z:function(){return a}});var r=n(5853),o=n(2265),l=n(51975),i=n(13241);let u=(0,n(1153).fn)("SelectItem"),a=o.forwardRef((e,t)=>{let{value:n,icon:a,className:s,children:c}=e,d=(0,r._T)(e,["value","icon","className","children"]);return o.createElement(l.wt,Object.assign({className:(0,i.q)(u("root"),"flex justify-start items-center cursor-default text-tremor-default px-2.5 py-2.5","data-[focus]:bg-tremor-background-muted data-[focus]:text-tremor-content-strong data-[selected]:text-tremor-content-strong data-[selected]:bg-tremor-background-muted text-tremor-content-emphasis","dark:data-[focus]:bg-dark-tremor-background-muted dark:data-[focus]:text-dark-tremor-content-strong dark:data-[selected]:text-dark-tremor-content-strong dark:data-[selected]:bg-dark-tremor-background-muted dark:text-dark-tremor-content-emphasis",s),ref:t,key:n,value:n},d),a&&o.createElement(a,{className:(0,i.q)(u("icon"),"flex-none w-5 h-5 mr-1.5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}),o.createElement("span",{className:"whitespace-nowrap truncate"},null!=c?c:n))});a.displayName="SelectItem"},67101:function(e,t,n){n.d(t,{Z:function(){return c}});var r=n(5853),o=n(13241),l=n(1153),i=n(2265),u=n(9496);let a=(0,l.fn)("Grid"),s=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"",c=i.forwardRef((e,t)=>{let{numItems:n=1,numItemsSm:l,numItemsMd:c,numItemsLg:d,children:f,className:p}=e,m=(0,r._T)(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),g=s(n,u._m),v=s(l,u.LH),h=s(c,u.l5),b=s(d,u.N4),x=(0,o.q)(g,v,h,b);return i.createElement("div",Object.assign({ref:t,className:(0,o.q)(a("root"),"grid",x,p)},m),f)});c.displayName="Grid"},9496:function(e,t,n){n.d(t,{LH:function(){return o},N4:function(){return i},PT:function(){return u},SP:function(){return a},VS:function(){return s},_m:function(){return r},_w:function(){return c},l5:function(){return l}});let r={0:"grid-cols-none",1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8",9:"grid-cols-9",10:"grid-cols-10",11:"grid-cols-11",12:"grid-cols-12"},o={0:"sm:grid-cols-none",1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6",7:"sm:grid-cols-7",8:"sm:grid-cols-8",9:"sm:grid-cols-9",10:"sm:grid-cols-10",11:"sm:grid-cols-11",12:"sm:grid-cols-12"},l={0:"md:grid-cols-none",1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-7",8:"md:grid-cols-8",9:"md:grid-cols-9",10:"md:grid-cols-10",11:"md:grid-cols-11",12:"md:grid-cols-12"},i={0:"lg:grid-cols-none",1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6",7:"lg:grid-cols-7",8:"lg:grid-cols-8",9:"lg:grid-cols-9",10:"lg:grid-cols-10",11:"lg:grid-cols-11",12:"lg:grid-cols-12"},u={1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12",13:"col-span-13"},a={1:"sm:col-span-1",2:"sm:col-span-2",3:"sm:col-span-3",4:"sm:col-span-4",5:"sm:col-span-5",6:"sm:col-span-6",7:"sm:col-span-7",8:"sm:col-span-8",9:"sm:col-span-9",10:"sm:col-span-10",11:"sm:col-span-11",12:"sm:col-span-12",13:"sm:col-span-13"},s={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12",13:"md:col-span-13"},c={1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12",13:"lg:col-span-13"}},64803:function(e,t,n){n.d(t,{RR:function(){return m},YF:function(){return d},cv:function(){return f},dp:function(){return g},uY:function(){return p}});var r=n(51050),o=n(2265),l=n(54887),i="undefined"!=typeof document?o.useLayoutEffect:function(){};function u(e,t){let n,r,o;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((n=e.length)!==t.length)return!1;for(r=n;0!=r--;)if(!u(e[r],t[r]))return!1;return!0}if((n=(o=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!({}).hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){let n=o[r];if(("_owner"!==n||!e.$$typeof)&&!u(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function a(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function s(e,t){let n=a(e);return Math.round(t*n)/n}function c(e){let t=o.useRef(e);return i(()=>{t.current=e}),t}function d(e){void 0===e&&(e={});let{placement:t="bottom",strategy:n="absolute",middleware:d=[],platform:f,elements:{reference:p,floating:m}={},transform:g=!0,whileElementsMounted:v,open:h}=e,[b,x]=o.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[E,y]=o.useState(d);u(E,d)||y(d);let[S,O]=o.useState(null),[R,w]=o.useState(null),C=o.useCallback(e=>{e!==M.current&&(M.current=e,O(e))},[]),P=o.useCallback(e=>{e!==k.current&&(k.current=e,w(e))},[]),L=p||S,T=m||R,M=o.useRef(null),k=o.useRef(null),I=o.useRef(b),F=null!=v,A=c(v),N=c(f),D=c(h),z=o.useCallback(()=>{if(!M.current||!k.current)return;let e={placement:t,strategy:n,middleware:E};N.current&&(e.platform=N.current),(0,r.oo)(M.current,k.current,e).then(e=>{let t={...e,isPositioned:!1!==D.current};H.current&&!u(I.current,t)&&(I.current=t,l.flushSync(()=>{x(t)}))})},[E,t,n,N,D]);i(()=>{!1===h&&I.current.isPositioned&&(I.current.isPositioned=!1,x(e=>({...e,isPositioned:!1})))},[h]);let H=o.useRef(!1);i(()=>(H.current=!0,()=>{H.current=!1}),[]),i(()=>{if(L&&(M.current=L),T&&(k.current=T),L&&T){if(A.current)return A.current(L,T,z);z()}},[L,T,z,A,F]);let _=o.useMemo(()=>({reference:M,floating:k,setReference:C,setFloating:P}),[C,P]),V=o.useMemo(()=>({reference:L,floating:T}),[L,T]),B=o.useMemo(()=>{let e={position:n,left:0,top:0};if(!V.floating)return e;let t=s(V.floating,b.x),r=s(V.floating,b.y);return g?{...e,transform:"translate("+t+"px, "+r+"px)",...a(V.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,g,V.floating,b.x,b.y]);return o.useMemo(()=>({...b,update:z,refs:_,elements:V,floatingStyles:B}),[b,z,_,V,B])}let f=(e,t)=>({...(0,r.cv)(e),options:[e,t]}),p=(e,t)=>({...(0,r.uY)(e),options:[e,t]}),m=(e,t)=>({...(0,r.RR)(e),options:[e,t]}),g=(e,t)=>({...(0,r.dp)(e),options:[e,t]})},52307:function(e,t,n){n.d(t,{dk:function(){return f},fw:function(){return d},zH:function(){return c}});var r=n(2265),o=n(93980),l=n(73389),i=n(67561),u=n(87550),a=n(38929);let s=(0,r.createContext)(null);function c(){var e,t;return null!=(t=null==(e=(0,r.useContext)(s))?void 0:e.value)?t:void 0}function d(){let[e,t]=(0,r.useState)([]);return[e.length>0?e.join(" "):void 0,(0,r.useMemo)(()=>function(e){let n=(0,o.z)(e=>(t(t=>[...t,e]),()=>t(t=>{let n=t.slice(),r=n.indexOf(e);return -1!==r&&n.splice(r,1),n}))),l=(0,r.useMemo)(()=>({register:n,slot:e.slot,name:e.name,props:e.props,value:e.value}),[n,e.slot,e.name,e.props,e.value]);return r.createElement(s.Provider,{value:l},e.children)},[t])]}s.displayName="DescriptionContext";let f=Object.assign((0,a.yV)(function(e,t){let n=(0,r.useId)(),o=(0,u.B)(),{id:c="headlessui-description-".concat(n),...d}=e,f=function e(){let t=(0,r.useContext)(s);if(null===t){let t=Error("You used a component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,e),t}return t}(),p=(0,i.T)(t);(0,l.e)(()=>f.register(c),[c,f.register]);let m=o||!1,g=(0,r.useMemo)(()=>({...f.slot,disabled:m}),[f.slot,m]),v={ref:p,...f.props,id:c};return(0,a.L6)()({ourProps:v,theirProps:d,slot:g,defaultTag:"p",name:f.name||"Description"})}),{})},7935:function(e,t,n){n.d(t,{__:function(){return p},bE:function(){return f},wp:function(){return d}});var r=n(2265),o=n(93980),l=n(73389),i=n(67561),u=n(87550),a=n(80281),s=n(38929);let c=(0,r.createContext)(null);function d(e){var t,n,o;let l=null!=(n=null==(t=(0,r.useContext)(c))?void 0:t.value)?n:void 0;return(null!=(o=null==e?void 0:e.length)?o:0)>0?[l,...e].filter(Boolean).join(" "):l}function f(){let{inherit:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=d(),[n,l]=(0,r.useState)([]),i=e?[t,...n].filter(Boolean):n;return[i.length>0?i.join(" "):void 0,(0,r.useMemo)(()=>function(e){let t=(0,o.z)(e=>(l(t=>[...t,e]),()=>l(t=>{let n=t.slice(),r=n.indexOf(e);return -1!==r&&n.splice(r,1),n}))),n=(0,r.useMemo)(()=>({register:t,slot:e.slot,name:e.name,props:e.props,value:e.value}),[t,e.slot,e.name,e.props,e.value]);return r.createElement(c.Provider,{value:n},e.children)},[l])]}c.displayName="LabelContext";let p=Object.assign((0,s.yV)(function(e,t){var n;let d=(0,r.useId)(),f=function e(){let t=(0,r.useContext)(c);if(null===t){let t=Error("You used a