import{d as f,a as d,e as u,i as h,k as _,j as l,A as p,_ as g,c as b,O as y,P as m}from"./tailwind-D5NWkpcg.js";import{l as i,b as c,f as w,o as v,i as x,h as P,j as A}from"./ext-utils-BLHv4ziY.js";const N="/icons/icon128.png",$={class:"relative w-full"},T=["value"],B=f({inheritAttrs:!1,__name:"Select",props:{modelValue:{}},emits:["update:modelValue","change"],setup(n,{emit:r}){const a=n,s=r;function o(e){const t=e.target;s("update:modelValue",(t==null?void 0:t.value)??""),s("change",(t==null?void 0:t.value)??"")}return(e,t)=>(u(),d("div",$,[h("select",p({class:"h-9 w-full appearance-none rounded-md border border-slate-200 bg-white px-3 py-2 pr-9 text-sm text-slate-900 shadow-sm transition focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:cursor-not-allowed disabled:opacity-50",value:a.modelValue??""},e.$attrs,{onChange:o}),[l(e.$slots,"default")],16,T),_(g,{name:"chevron-down",class:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 opacity-60"})]))}}),k="inline-flex items-center justify-center gap-2",D=f({__name:"Button",props:{variant:{default:"default"},size:{default:"default"}},setup(n){const r=n,a={default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",primary:"bg-primary text-primary-foreground shadow hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},s={default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-6",icon:"h-9 w-9","icon-sm":"h-6 w-6"},o=b(()=>y(k,a[r.variant],s[r.size]));return(e,t)=>(u(),d("button",p({class:["inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",o.value]},e.$attrs),[l(e.$slots,"default")],16))}}),E={},I={class:"rounded-xl border border-slate-200 bg-white p-5 shadow-sm mt-0"};function j(n,r){return u(),d("div",I,[l(n.$slots,"default")])}const K=m(E,[["render",j]]),C=["value"],z=f({inheritAttrs:!1,__name:"Input",props:{modelValue:{}},emits:["update:modelValue"],setup(n,{emit:r}){const a=n,s=r;function o(e){const t=e.target;s("update:modelValue",(t==null?void 0:t.value)??"")}return(e,t)=>(u(),d("input",p({class:"w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm text-slate-900 placeholder:text-slate-400 shadow-sm transition focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30",value:a.modelValue??""},e.$attrs,{onInput:o}),null,16,C))}}),S={},V={class:"text-sm font-semibold text-slate-700"};function F(n,r){return u(),d("label",V,[l(n.$slots,"default")])}const M=m(S,[["render",F]]);function G(){async function n(){const s=await i(),o=c(s,x);if(!o)return[];const e=await fetch(o);if(!e.ok)return[];const t=await e.json();return Array.isArray(t.data)?t.data:[]}async function r(){const s=await i(),o=c(s,v);if(!o)return[];const e=await fetch(o);if(!e.ok)return[];const t=await e.json();return Array.isArray(t.data)?t.data:[]}async function a(s){const o=await i(),e=c(o,w);if(!e)return{ok:!1,error:"API 端点配置错误"};const t=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return t.ok?t.json():{ok:!1,error:await t.text().catch(()=>"")||`HTTP ${t.status}`}}return{getFileFolders:n,getFiles:r,createFile:a}}function J(){async function n(){const a=await i(),s=c(a,A);if(!s)return[];const o=await fetch(s);if(!o.ok)return[];const e=await o.json();return Array.isArray(e.data)?e.data:[]}async function r(a){const s=await i(),o=c(s,P);if(!o)return{ok:!1,error:"API 端点配置错误"};const e=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});return console.log("[createKnowledgeDocument]",e,a),e.ok?e.json():{ok:!1,error:await e.text().catch(()=>"")||`HTTP ${e.status}`}}return{getKnowledgeBases:n,createKnowledgeDocument:r}}export{K as C,M as L,B as _,N as a,z as b,D as c,G as d,J as u};
