import{j as r}from"./react-vendor-MPLM8hiW.js";import{a as x,C as p,L as i,a6 as d,V as m,Y as u,I as h}from"./index-saDuzM6I.js";function l(s){if(s==null)return"";if(typeof s=="string")return s;if(typeof s=="number"||typeof s=="boolean")return String(s);try{return JSON.stringify(s,null,2)}catch{return String(s)}}function j(s,e,t){if(e.sensitive)return"";const n=t==null?void 0:t[s];return n!==void 0?n:e.default??""}function b({fieldKey:s,field:e,value:t}){const{t:n}=x();if(e.type==="boolean")return r.jsx("div",{className:"space-y-2",children:r.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-border px-4 py-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(i,{htmlFor:s,children:e.label}),e.description&&r.jsx("p",{className:"text-sm text-text-secondary",children:e.description})]}),r.jsx(d,{id:s,name:s,checked:!!t,disabled:!0})]})});if(e.type==="select")return r.jsxs("div",{className:"space-y-2",children:[r.jsx(i,{htmlFor:s,children:e.label}),r.jsx(m,{id:s,name:s,value:t==null?"":String(t),options:(e.options??[]).map(a=>({value:String(a.value),label:a.label})),placeholder:e.label,disabled:!0}),e.description&&r.jsx("p",{className:"text-sm text-text-secondary",children:e.description})]});if(e.type==="json")return r.jsxs("div",{className:"space-y-2",children:[r.jsx(i,{htmlFor:s,children:e.label}),r.jsx(u,{id:s,name:s,value:l(t),rows:5,disabled:!0}),e.description&&r.jsx("p",{className:"text-sm text-text-secondary",children:e.description})]});const c=e.type==="password"?"password":e.type==="number"?"number":"text";return r.jsxs("div",{className:"space-y-2",children:[r.jsx(i,{htmlFor:s,children:e.label}),r.jsx(h,{id:s,name:s,type:c,value:e.sensitive?"":l(t),placeholder:e.sensitive?n("pluginUi.configuredInProjectConfig"):e.label,disabled:!0}),e.description&&r.jsx("p",{className:"text-sm text-text-secondary",children:e.description})]})}function y({configSchema:s,config:e,pluginDisplayName:t}){const{t:n}=x(),c=Object.entries(s??{});return c.length===0?r.jsx(p,{className:"p-6",children:r.jsxs("p",{className:"text-text-secondary",children:[n("pluginUi.noConfigSchema")," ",t,"."]})}):r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"rounded-lg border border-border bg-surface-hover/60 px-4 py-3 text-sm text-text-secondary",children:n("pluginUi.configReferenceNotice")}),r.jsx(p,{className:"p-6",children:r.jsx("div",{className:"space-y-5",children:c.map(([a,o])=>r.jsx(b,{fieldKey:a,field:o,value:j(a,o,e)},a))})})]})}export{y as P};
