import{d as e,s as t,t as n,y as r}from"./hooks.module-5xe-uC6c.js";import{s as i}from"./options-CDt8ZGCW.js";import{p as a,t as o}from"./compat.module-PCbCX7TU.js";import{t as s}from"./jsxRuntime.module--xb8gfv5.js";import{t as c}from"./Modal-Dk3Wl80T.js";import{t as l}from"./FormGroup--CU8SFQh.js";import{t as u}from"./FormTextBox-oE57I0qB.js";import{t as d}from"./FormSelect-dkyyg2QS.js";a(),e();var f=[{id:`anthropic`,name:`Anthropic`},{id:`openai`,name:`OpenAI`},{id:`google`,name:`Google Gemini`}];function p({show:e,onHidden:a,onSave:p}){let[m,h]=t(f[0].id),[g,_]=t(``),v=n(null);function y(){if(!g.trim())return;let e=f.find(e=>e.id===m);p({id:`${m}_${Date.now()}`,name:e?.name||m,provider:m,apiKey:g.trim()}),b(),a()}function b(){h(f[0].id),_(``)}function x(){b(),a()}return o(s(c,{show:e,onHidden:x,onSubmit:y,formRef:v,title:i(`llm.add_provider_title`),className:`add-provider-modal`,size:`md`,footer:s(r,{children:[s(`button`,{type:`button`,className:`btn btn-secondary`,onClick:x,children:i(`llm.cancel`)}),s(`button`,{type:`submit`,className:`btn btn-primary`,disabled:!g.trim(),children:i(`llm.add_provider`)})]}),children:[s(l,{name:`provider-type`,label:i(`llm.provider_type`),children:s(d,{values:f,keyProperty:`id`,titleProperty:`name`,currentValue:m,onChange:h})}),s(l,{name:`api-key`,label:i(`llm.api_key`),children:s(u,{type:`password`,currentValue:g,onChange:_,placeholder:i(`llm.api_key_placeholder`),autoFocus:!0})})]}),document.body)}export{f as n,p as t};