1import{r as o,e as h,t as p,j as e,h as g,V as Y}from"./edge-BOITG1XR.js";import{L as j}from"./mod-DxqX0N6D.js";import{B as N}from"./mod-D5xxkeD6.js";import{M as E}from"./mod-CKTOf4qU.js";import{S as C}from"./mod-C9xhOiHj.js";import{I as $}from"./mod-CIBNvfiF.js";import{T as Z}from"./mod-DlSXWp2B.js";import{I as J}from"./mod-ClnwnFZu.js";import{E as ee}from"./mod-DlaYEcom.js";import{C as te}from"./mod-CdBQyGbT.js";import{C as se}from"./mod-BelLWb3f.js";import{E as R}from"./mod-B_npTkgx.js";import{S as G}from"./mod-D5o00wMq.js";import{C as le}from"./mod-DKJSxncj.js";import{X as ae}from"./mod-C3kaoPgB.js";const oe=[{id:"openai",label:"OpenAI",flag:"ðºð¸",badge:"Best Quality",badgeColor:"bg-emerald-100 text-emerald-700",desc:"GPT-4o, GPT-4o-mini â industry standard",models:["gpt-4o","gpt-4o-mini","gpt-4-turbo","gpt-3.5-turbo"],fields:[{key:"openai_api_key",label:"API Key",type:"password",placeholder:"sk-..."},{key:"openai_base_url",label:"Base URL (optional)",type:"text",placeholder:"https://api.openai.com/v1"},{key:"text_model",label:"Model",type:"select",options:["gpt-4o","gpt-4o-mini","gpt-4-turbo","gpt-3.5-turbo"]}],docsUrl:"https://platform.openai.com"},{id:"claude",label:"Claude (Anthropic)",flag:"ðºð¸",badge:"Best Reasoning",badgeColor:"bg-violet-100 text-violet-700",desc:"Claude Haiku, Sonnet â best for long content",fields:[{key:"claude_api_key",label:"API Key",type:"password",placeholder:"sk-ant-..."},{key:"claude_model",label:"Model",type:"select",options:["claude-haiku-4-5-20251001","claude-sonnet-4-6","claude-opus-4-6"]}],docsUrl:"https://console.anthropic.com"},{id:"gemini",label:"Google Gemini",flag:"ðºð¸",badge:"Free Tier",badgeColor:"bg-blue-100 text-blue-700",desc:"Gemini Flash (fast + free), Pro (powerful)",fields:[{key:"gemini_api_key",label:"API Key",type:"password",placeholder:"AIza..."},{key:"gemini_model",label:"Model",type:"select",options:["gemini-2.0-flash","gemini-1.5-pro","gemini-1.5-flash"]}],docsUrl:"https://aistudio.google.com"},{id:"deepseek",label:"DeepSeek",flag:"ð¨ð³",badge:"Cheapest",badgeColor:"bg-orange-100 text-orange-700",desc:"V3 & R1 â ~$0.001/1K tokens, GPT-4 level",fields:[{key:"deepseek_api_key",label:"API Key",type:"password",placeholder:"sk-..."},{key:"deepseek_model",label:"Model",type:"select",options:["deepseek-chat","deepseek-reasoner"]}],docsUrl:"https://platform.deepseek.com"},{id:"qwen",label:"Qwen (Alibaba)",flag:"ð¨ð³",badge:"Fast + Cheap",badgeColor:"bg-amber-100 text-amber-700",desc:"Qwen-Turbo, Plus, Max â Alibaba Cloud",fields:[{key:"qwen_api_key",label:"API Key (DashScope)",type:"password",placeholder:"sk-..."},{key:"qwen_model",label:"Model",type:"select",options:["qwen-turbo","qwen-plus","qwen-max","qwen-long"]}],docsUrl:"https://dashscope.aliyuncs.com"},{id:"yi",label:"Yi (01.ai)",flag:"ð¨ð³",badge:"Budget",badgeColor:"bg-sky-100 text-sky-700",desc:"Yi-Lightning â ultra cheap, fast",fields:[{key:"yi_api_key",label:"API Key",type:"password",placeholder:"sk-..."},{key:"yi_model",label:"Model",type:"select",options:["yi-lightning","yi-large","yi-medium"]}],docsUrl:"https://platform.lingyiwanwu.com"},{id:"moonshot",label:"Moonshot (Kimi)",flag:"ð¨ð³",badge:"200K Context",badgeColor:"bg-indigo-100 text-indigo-700",desc:"Massive context window â great for documents",fields:[{key:"moonshot_api_key",label:"API Key",type:"password",placeholder:"sk-..."},{key:"moonshot_model",label:"Model",type:"select",options:["moonshot-v1-8k","moonshot-v1-32k","moonshot-v1-128k"]}],docsUrl:"https://platform.moonshot.cn"},{id:"zhipu",label:"Zhipu / GLM",flag:"ð¨ð³",badge:"Free Flash",badgeColor:"bg-cyan-100 text-cyan-700",desc:"GLM-4-Flash free tier, CogView for images",fields:[{key:"zhipu_api_key",label:"API Key",type:"password",placeholder:"your-key..."},{key:"zhipu_text_model",label:"Model",type:"select",options:["glm-4-flash","glm-4","glm-4-plus","glm-4-air"]}],docsUrl:"https://open.bigmodel.cn"},{id:"ernie",label:"Baidu ERNIE",flag:"ð¨ð³",badge:"China Only",badgeColor:"bg-red-100 text-red-700",desc:"ERNIE 4.0 â best for Chinese language",fields:[{key:"ernie_api_key",label:"API Key (Client ID)",type:"password",placeholder:"your-api-key"},{key:"ernie_secret_key",label:"Secret Key",type:"password",placeholder:"your-secret-key"},{key:"ernie_model",label:"Model",type:"select",options:["ernie-4.0-turbo-8k","ernie-3.5-128k","ernie-speed-128k"]}],docsUrl:"https://cloud.baidu.com/product/wenxinworkshop"},{id:"custom",label:"Custom AI",flag:"âï¸",badge:"Any Provider",badgeColor:"bg-slate-100 text-slate-600",desc:"Any OpenAI-compatible endpoint (local Ollama, etc.)",fields:[{key:"custom_text_endpoint",label:"Endpoint URL",type:"text",placeholder:"http://localhost:11434/v1/chat/completions"},{key:"custom_text_api_key",label:"API Key (optional)",type:"password",placeholder:"leave blank if not needed"},{key:"custom_text_model",label:"Model Name",type:"text",placeholder:"llama3, mistral, etc."},{key:"custom_text_headers",label:"Extra Headers (JSON)",type:"text",placeholder:'{"X-Custom": "value"}'}
1],docsUrl:null}],ie=[{id:"bfl",label:"Black Forest Labs (FLUX)",flag:"ð²",badge:"Official FLUX API",badgeColor:"bg-violet-100 text-violet-700",desc:"Official BFL FLUX.1 Pro â highest quality product images, photorealistic",fields:[{key:"bfl_api_key",label:"API Key",type:"password",placeholder:"bfl_..."},{key:"bfl_model",label:"Model",type:"select",options:["flux-pro-1.1","flux-pro-1.1-ultra","flux-pro","flux-dev","flux-schnell"]}],docsUrl:"https://dashboard.bfl.ai"},{id:"together",label:"Together AI (Flux)",flag:"ðºð¸",badge:"FREE Tier",badgeColor:"bg-emerald-100 text-emerald-700",desc:"FLUX.1-schnell-Free â completely free, fast",fields:[{key:"together_api_key",label:"API Key",type:"password",placeholder:"your-key..."},{key:"together_image_model",label:"Model",type:"select",options:["black-forest-labs/FLUX.1-schnell-Free","black-forest-labs/FLUX.1-schnell","black-forest-labs/FLUX.1-dev"]}],docsUrl:"https://together.ai"},{id:"dalle",label:"DALL-E 3 (OpenAI)",flag:"ðºð¸",badge:"Best Quality",badgeColor:"bg-violet-100 text-violet-700",desc:"Highest quality, prompt-following. Uses OpenAI key.",fields:[{key:"dalle_api_key",label:"API Key",type:"password",placeholder:"sk-... (same as OpenAI)"},{key:"dalle_model",label:"Model",type:"select",options:["dall-e-3","dall-e-2"]}],docsUrl:"https://platform.openai.com"},{id:"stability",label:"Stability AI",flag:"ðºð¸",badge:"SDXL",badgeColor:"bg-blue-100 text-blue-700",desc:"Stable Diffusion XL â great for products",fields:[{key:"stability_api_key",label:"API Key",type:"password",placeholder:"sk-..."}],docsUrl:"https://stability.ai"},{id:"fal",label:"Fal.ai",flag:"ðºð¸",badge:"Fast",badgeColor:"bg-orange-100 text-orange-700",desc:"Flux & SDXL models, fast generation",fields:[{key:"fal_api_key",label:"API Key",type:"password",placeholder:"your-key:..."}],docsUrl:"https://fal.ai"},{id:"cogview",label:"CogView-3 (Zhipu)",flag:"ð¨ð³",badge:"Chinese",badgeColor:"bg-cyan-100 text-cyan-700",desc:"CogView-3-Plus â good Chinese text in images",fields:[{key:"cogview_api_key",label:"API Key",type:"password",placeholder:"your-key..."},{key:"cogview_model",label:"Model",type:"select",options:["cogview-3-plus","cogview-3"]}],docsUrl:"https://open.bigmodel.cn"},{id:"replicate",label:"Replicate",flag:"ðºð¸",badge:"Most Models",badgeColor:"bg-slate-100 text-slate-600",desc:"Access thousands of open-source models",fields:[{key:"replicate_api_key",label:"API Key",type:"password",placeholder:"r8_..."}],docsUrl:"https://replicate.com"},{id:"custom",label:"Custom Image AI",flag:"âï¸",badge:"Any",badgeColor:"bg-slate-100 text-slate-600",desc:"Any image generation API endpoint",fields:[{key:"custom_image_endpoint",label:"Endpoint URL",type:"text",placeholder:"https://..."},{key:"custom_image_api_key",label:"API Key",type:"password",placeholder:""}],docsUrl:null}],K=({provider:s,selected:f,settings:b,onChange:m,onSelect:r})=>{const n=f===s.id;return e.jsxs("div",{className:g("rounded-2xl border-2 p-4 transition cursor-pointer",n?"border-violet-400 bg-violet-50/40 shadow-md":"border-slate-200 bg-white hover:border-slate-300"),children:[e.jsxs("div",{className:"flex items-start gap-3",onClick:r,children:[e.jsx("div",{className:g("mt-0.5 h-5 w-5 rounded-full border-2 flex items-center justify-center flex-shrink-0",n?"border-violet-500":"border-slate-300"),children:n&&e.jsx("div",{className:"h-2.5 w-2.5 rounded-full bg-violet-500"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-base",children:s.flag}),e.jsx("span",{className:"font-bold text-slate-900 text-sm",children:s.label}),e.jsx("span",{className:g("rounded-full px-2 py-0.5 text-[10px] font-bold",s.badgeColor),children:s.badge})]}),e.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:s.desc})]}),s.docsUrl&&e.jsx("a",{href:s.docsUrl,target:"_blank",rel:"noreferrer",onClick:a=>a.stopPropagation(),className:"text-slate-400 hover:text-violet-500 flex-shrink-0",children:e.jsx(R,{className:"h-3.5 w-3.5"})})]}),n&&e.jsx("div",{className:"mt-4 space-y-3 pl-8",children:s.fields.map(a=>e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-700 mb-1",children:a.label}),a.type==="select"?e.jsx("select",{value:b[a.key]??"",onChange:i=>m(a.key,i.target.value),className:"w-full rounded-xl border border-slate-200 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-violet-100 focus:border-violet-400",children:a.options.map(i=>e.jsx("option",{value:i,children:i},i))}):e.jsx("input",{type:a.type,value:b[a.key]??"",onChange:i=>m(a.key,i.target.value),placeholder:a.placeholder,className:"w-full rounded-xl border border-slate-200 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-violet-100 focus:border-violet-400"})]},a.key))})]})},re=({open:s,onClose:f})=>{const[b,m]=o.useState([{role:"assistant",content:"Hi! I'm your Global AI Assistant. I can help you manage products, write SEO content, generate descriptions, and configure your store. What would you like to do?"}]),[r,n]=o.useState(""),[a,i]=o.useState(!1),u=o.useRef(null);o.useEffect(()=>{u.current?.scrollIntoView({behavior:"smooth"})},[b]);const k=async()=>
1{if(!r.trim()||a)return;const l=r.trim();n(""),m(c=>[...c,{role:"user",content:l}]),i(!0);try{const c=b.slice(-10).map(x=>({role:x.role,content:x.content})),y=await h.post("/admin/global-ai/chat",{message:l,history:c});m(x=>[...x,{role:"assistant",content:y.data.reply??"No response."}])}catch(c){const y=c.response?.data?.error??"Failed to get AI response. Check your API key in AI settings.";m(x=>[...x,{role:"assistant",content:`Error: ${y}`}])}finally{i(!1)}};return s?e.jsx("div",{className:"fixed inset-0 z-50 flex items-end justify-end p-4 pointer-events-none",children:e.jsxs("div",{className:"pointer-events-auto w-full max-w-md bg-white rounded-2xl shadow-2xl border border-slate-200 flex flex-col",style:{height:"520px"},children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-slate-100 bg-gradient-to-r from-violet-600 to-purple-600 rounded-t-2xl",children:[e.jsx("div",{className:"h-8 w-8 rounded-full bg-white/20 flex items-center justify-center",children:e.jsx(N,{className:"h-4 w-4 text-white"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-bold text-white text-sm",children:"Global AI Assistant"}),e.jsx("p",{className:"text-[10px] text-violet-200",children:"Powered by your configured AI provider"})]}),e.jsx("button",{onClick:f,className:"ml-auto text-white/70 hover:text-white",children:e.jsx(ae,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:[b.map((l,c)=>e.jsx("div",{className:g("flex",l.role==="user"?"justify-end":"justify-start"),children:e.jsx("div",{className:g("max-w-[85%] rounded-2xl px-3.5 py-2.5 text-sm whitespace-pre-wrap",l.role==="user"?"bg-violet-600 text-white rounded-tr-sm":"bg-slate-100 text-slate-800 rounded-tl-sm"),children:l.content})},c)),a&&e.jsx("div",{className:"flex justify-start",children:e.jsx("div",{className:"bg-slate-100 rounded-2xl rounded-tl-sm px-3.5 py-2.5 flex gap-1",children:[0,1,2].map(l=>e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400 animate-bounce",style:{animationDelay:`${l*.15}s`}},l))})}),e.jsx("div",{ref:u})]}),e.jsxs("div",{className:"border-t border-slate-100 p-3 flex gap-2",children:[e.jsx("input",{value:r,onChange:l=>n(l.target.value),onKeyDown:l=>l.key==="Enter"&&!l.shiftKey&&k(),placeholder:"Ask about products, SEO, descriptions...",className:"flex-1 rounded-xl border border-slate-200 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-violet-100 focus:border-violet-400"}),e.jsx("button",{onClick:k,disabled:a||!r.trim(),className:"flex h-9 w-9 items-center justify-center rounded-xl bg-violet-600 text-white hover:bg-violet-700 disabled:opacity-50 transition",children:e.jsx(G,{className:"h-4 w-4"})})]})]})}):null},Ne=()=>{const[s,f]=o.useState({}),[b,m]=o.useState(!0),[r,n]=o.useState(!1),[a,i]=o.useState(!1),[u,k]=o.useState("text"),[l,c]=o.useState({telegram_bot_token:"",telegram_admin_chat_id:""}),[y,x]=o.useState(!1),[I,A]=o.useState(!1),[S,P]=o.useState(!1),[O,B]=o.useState({}),[U,T]=o.useState(!1),F=`${window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1",window.location.origin}/api/telegram/webhook`,L=o.useCallback(async()=>{m(!0);try{const[t,v]=await Promise.allSettled([h.get("/admin/global-ai/settings"),h.get("/admin/telegram/settings")]);t.status==="fulfilled"&&f(t.value.data??{}),v.status==="fulfilled"&&c(v.value.data??{})}catch{p.error("Failed to load AI settings")}finally{m(!1)}},[]);o.useEffect(()=>{L()},[L]);const d=(t,v)=>f(_=>({..._,[t]:v})),M=async()=>{n(!0);try{await h.put("/admin/global-ai/settings",s),p.success("Global AI settings saved!")}catch{p.error("Failed to save settings")}finally{n(!1)}},X=async()=>{x(!0);try{await h.put("/admin/telegram/settings",l),p.success("Telegram settings saved")}catch{p.error("Failed to save Telegram settings")}finally{x(!1)}},D=async()=>{A(!0);try{await h.post("/admin/telegram/test"),p.success("Test message sent! Check your Telegram.")}catch(t){p.error(t.response?.data?.message||"Test failed â check Bot Token and Chat ID")}finally{A(!1)}},W=async()=>{P(!0);try{const t=await h.post("/admin/telegram/set-webhook");p.success(t.data?.message||"Webhook registered")}catch(t){p.error(t.response?.data?.message||"Failed to set webhook")}finally{P(!1)}},q=()=>{navigator.clipboard.writeText(F),T(!0),setTimeout(()=>T(!1),2e3)};if(b)return e.jsx("div",{className:"flex items-center justify-center py-24",children:e.jsx(j,{className:"h-8 w-8 animate-spin text-violet-500"})});const V=s.text_provider??"openai",H=s.image_provider??"together";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-slate-900 flex items-center gap-2",children:[e.jsx(N,{className:"h-6 w-6 text-violet-600"})," Global AI Settings"]}),e.jsx("p",{className:"text-sm text-slate-500 mt-0.5",children:"Configure AI providers for all modules. Sub-modules fall back to these settings automatically."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>i(!0),className:"flex items-center gap-2 rounded-xl border border-violet-200 bg-vi
1olet-50 px-4 py-2 text-sm font-bold text-violet-700 hover:bg-violet-100 transition",children:[e.jsx(E,{className:"h-4 w-4"})," Chat with AI"]}),e.jsxs("button",{onClick:M,disabled:r,className:"flex items-center gap-2 rounded-xl bg-violet-600 px-4 py-2 text-sm font-bold text-white hover:bg-violet-700 disabled:opacity-60 transition",children:[r?e.jsx(j,{className:"h-4 w-4 animate-spin"}):e.jsx(C,{className:"h-4 w-4"}),"Save Settings"]})]})]}),e.jsxs("div",{className:"flex items-start gap-3 rounded-2xl bg-blue-50 border border-blue-200 px-4 py-3",children:[e.jsx($,{className:"h-4 w-4 text-blue-500 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-blue-800",children:"Global Fallback Active"}),e.jsx("p",{className:"text-xs text-blue-600 mt-0.5",children:"When any sub-module (Product AI, SEO AI, Blog AI, Image AI) has no API key configured, it automatically uses the provider set here. No need to duplicate keys."})]}),e.jsxs("label",{className:"ml-auto flex items-center gap-2 flex-shrink-0",children:[e.jsx("span",{className:"text-xs font-semibold text-blue-700",children:"Fallback"}),e.jsx("button",{type:"button",onClick:()=>d("fallback_enabled",s.fallback_enabled==="1"?"0":"1"),className:g("relative h-5 w-9 rounded-full transition-colors",s.fallback_enabled!=="0"?"bg-blue-500":"bg-slate-300"),children:e.jsx("span",{className:g("absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-white shadow transition-transform",s.fallback_enabled!=="0"?"translate-x-4":"")})})]})]}),e.jsx("div",{className:"flex border-b border-slate-200",children:[{id:"text",label:"Text AI",icon:Z},{id:"image",label:"Image AI",icon:J},{id:"telegram",label:"Telegram Bot",icon:N},{id:"advanced",label:"Advanced",icon:Y}].map(t=>e.jsxs("button",{onClick:()=>k(t.id),className:g("flex items-center gap-2 px-5 py-3 text-sm font-semibold border-b-2 -mb-px transition",u===t.id?"border-violet-500 text-violet-700":"border-transparent text-slate-500 hover:text-slate-700"),children:[e.jsx(t.icon,{className:"h-4 w-4"})," ",t.label]},t.id))}),u==="text"&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-slate-600",children:"Select your global text generation provider. All product descriptions, SEO content, and blog posts will use this."}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:oe.map(t=>e.jsx(K,{provider:t,selected:V,settings:s,onChange:d,onSelect:()=>d("text_provider",t.id)},t.id))})]}),u==="image"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-slate-600",children:"Select your global image generation provider. Used by Media Manager and Product AI image generation."}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:ie.map(t=>e.jsx(K,{provider:t,selected:H,settings:s,onChange:d,onSelect:()=>d("image_provider",t.id)},t.id))})]}),e.jsxs("div",{className:"rounded-2xl border border-slate-100 bg-white p-5 shadow-sm space-y-3",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"font-bold text-slate-900 text-sm flex items-center gap-2",children:[e.jsx("span",{className:"text-base",children:"âï¸"})," Background Removal (remove.bg)"]}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Used by the Telegram pipeline to remove product backgrounds before FLUX enhancement. Without this key, products will use the original photo (no BG removal)."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-700 mb-1",children:"remove.bg API Key"}),e.jsx("input",{type:"password",value:s.remove_bg_api_key??"",onChange:t=>d("remove_bg_api_key",t.target.value),placeholder:"Paste your remove.bg API key...",className:"w-full rounded-xl border border-slate-200 px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-violet-100 focus:border-violet-400"}),e.jsxs("p",{className:"text-xs text-slate-400 mt-1",children:["Get a free key (50 images/month) at ",e.jsx("span",{className:"font-mono",children:"remove.bg/dashboard"})]})]})]}),e.jsxs("div",{className:"rounded-2xl border border-violet-100 bg-violet-50/40 p-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-slate-900 text-sm",children:"FLUX Product Photo Editing"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Used by the Telegram pipeline to generate 2â3 professional product shots per upload. Keeps the exact same product â only background and lighting are changed."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-700 mb-1",children:"Editing Model"}),e.jsxs("select",{value:s.bfl_editing_model??"flux-kontext-pro",onChange:t=>d("bfl_editing_model",t.target.value),className:"w-full rounded-xl border border-slate-200 px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-violet-100 focus:border-violet-400 bg-white",children:[e.jsx("option",{value:"flux-kontext-pro",children:"flux-kontext-pro â Fast, great quality (recommended)"}),e.jsx("option",{value:"flux-2-pro-preview",children:"flux-2-pro-preview â FLUX.2 Pro, best multi-angle quality"}),e.jsx("option",{value:"flux-2-max",children:"flux-2-max â FLUX.2 Max, highe
1st precision (slower)"}),e.jsx("option",{value:"flux-2-flex",children:"flux-2-flex â FLUX.2 Flex, adjustable steps + guidance"}),e.jsx("option",{value:"flux-2-klein-4b",children:"flux-2-klein-4b â FLUX.2 Klein, fastest / cheapest"})]}),e.jsx("p",{className:"text-xs text-slate-400 mt-1",children:"Requires a BFL API key configured above. FLUX.2 models support up to 8 reference images."})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2 text-xs text-slate-600",children:[e.jsxs("div",{className:"rounded-xl border border-slate-200 bg-white p-3 text-center",children:[e.jsx("div",{className:"font-bold text-slate-800",children:"Clothing"}),e.jsx("div",{className:"text-slate-400 mt-0.5",children:"White · Lifestyle · Back"})]}),e.jsxs("div",{className:"rounded-xl border border-slate-200 bg-white p-3 text-center",children:[e.jsx("div",{className:"font-bold text-slate-800",children:"Electronics"}),e.jsx("div",{className:"text-slate-400 mt-0.5",children:"White · Desk lifestyle"})]}),e.jsxs("div",{className:"rounded-xl border border-slate-200 bg-white p-3 text-center",children:[e.jsx("div",{className:"font-bold text-slate-800",children:"All others"}),e.jsx("div",{className:"text-slate-400 mt-0.5",children:"White · Contextual BG"})]})]}),e.jsxs("div",{className:"pt-3 border-t border-violet-100",children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-700 mb-1",children:"Default Model Reference Image"}),e.jsx("p",{className:"text-xs text-slate-400 mb-2",children:'URL of a fashion model photo. Used in "On Model" mode in the AI Image Studio when no specific model is selected. Clothing products in the Telegram pipeline will also use this to generate a "model wearing the product" shot.'}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"text",value:s.default_model_image??"",onChange:t=>d("default_model_image",t.target.value),placeholder:"https://... full body model photo URL",className:"flex-1 rounded-xl border border-slate-200 px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-violet-100 focus:border-violet-400"}),s.default_model_image&&e.jsx("img",{src:s.default_model_image,alt:"Model reference",className:"h-12 w-12 rounded-xl object-cover border border-slate-200 flex-shrink-0",onError:t=>t.target.style.display="none"})]})]})]})]}),u==="telegram"&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"rounded-2xl border border-blue-100 bg-blue-50 p-4",children:[e.jsx("p",{className:"text-sm font-semibold text-blue-800 mb-1",children:"How it works"}),e.jsx("p",{className:"text-xs text-blue-700",children:'Configure your Telegram bot below, click "Set Webhook", then send product photos to your bot. AI will automatically create product drafts for review.'})]}),e.jsxs("div",{className:"rounded-2xl border border-slate-100 bg-white p-5 shadow-sm space-y-4",children:[e.jsxs("h3",{className:"font-bold text-slate-900 text-sm flex items-center gap-2",children:[e.jsx(N,{className:"h-4 w-4 text-blue-500"})," Bot Configuration"]}),[{key:"telegram_bot_token",label:"Bot Token",placeholder:"1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef",hint:"Get from @BotFather on Telegram"},{key:"telegram_admin_chat_id",label:"Admin Chat ID",placeholder:"123456789",hint:"Your Telegram chat ID â send /start to @userinfobot"}].map(({key:t,label:v,placeholder:_,hint:z})=>e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-700 mb-1",children:v}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:O[t]?"text":"password",value:l[t]||"",onChange:w=>c(Q=>({...Q,[t]:w.target.value})),placeholder:_,className:"w-full rounded-xl border border-slate-200 px-3 py-2.5 pr-10 text-sm focus:outline-none focus:ring-2 focus:ring-violet-100 focus:border-violet-400"}),e.jsx("button",{onClick:()=>B(w=>({...w,[t]:!w[t]})),className:"absolute right-3 top-2.5 text-slate-400 hover:text-slate-600",children:e.jsx(ee,{className:"h-4 w-4"})})]}),e.jsx("p",{className:"text-xs text-slate-400 mt-1",children:z})]},t)),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-700 mb-1",children:"Webhook URL"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{readOnly:!0,value:F,className:"flex-1 rounded-xl border border-slate-100 bg-slate-50 px-3 py-2.5 text-xs text-slate-500"}),e.jsxs("button",{onClick:q,className:"flex items-center gap-1.5 rounded-xl border border-slate-200 px-3 py-2 text-xs font-semibold text-slate-600 hover:bg-slate-50 transition",children:[U?e.jsx(te,{className:"h-3.5 w-3.5 text-emerald-500"}):e.jsx(se,{className:"h-3.5 w-3.5"}),U?"Copied!":"Copy"]})]})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsxs("button",{onClick:X,disabled:y,className:"flex-1 flex items-center justify-center gap-2 rounded-xl bg-violet-600 py-2.5 text-sm font-bold text-white hover:bg-violet-700 disabled:opacity-60 transition",children:[y?e.jsx(j,{className:"h-4 w-4 animate-spin"}):e.jsx(C,{className:"h-4 w-4"}),"Save"]}),e.jsxs("button",{onClick:W,disabled:S||!l.telegram_bot_token,className:"flex items-center gap-2 rounded-xl border border-violet-200 bg-vi
1olet-50 px-4 py-2.5 text-sm font-bold text-violet-700 hover:bg-violet-100 disabled:opacity-60 transition",children:[S?e.jsx(j,{className:"h-4 w-4 animate-spin"}):e.jsx(R,{className:"h-4 w-4"}),"Set Webhook"]}),e.jsxs("button",{onClick:D,disabled:I||!l.telegram_bot_token,className:"flex items-center gap-2 rounded-xl border border-slate-200 px-3 py-2.5 text-sm font-semibold text-slate-600 hover:bg-slate-50 disabled:opacity-60 transition",children:[I?e.jsx(j,{className:"h-4 w-4 animate-spin"}):e.jsx(G,{className:"h-4 w-4"}),"Test"]})]})]})]}),u==="advanced"&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"rounded-2xl border border-slate-100 bg-white p-5 shadow-sm space-y-4",children:[e.jsxs("h3",{className:"font-bold text-slate-900 text-sm flex items-center gap-2",children:[e.jsx(le,{className:"h-4 w-4 text-violet-500"})," Generation Parameters"]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-700 mb-1",children:"Max Tokens"}),e.jsx("input",{type:"number",min:"256",max:"8192",value:s.max_tokens??1024,onChange:t=>d("max_tokens",t.target.value),className:"w-full rounded-xl border border-slate-200 px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-violet-100 focus:border-violet-400"}),e.jsx("p",{className:"text-xs text-slate-400 mt-1",children:"Max output length (256â8192)"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-700 mb-1",children:"Temperature"}),e.jsx("input",{type:"number",min:"0",max:"2",step:"0.1",value:s.temperature??.7,onChange:t=>d("temperature",t.target.value),className:"w-full rounded-xl border border-slate-200 px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-violet-100 focus:border-violet-400"}),e.jsx("p",{className:"text-xs text-slate-400 mt-1",children:"Creativity: 0 = precise, 1 = creative"})]})]})]}),e.jsxs("div",{className:"rounded-2xl border border-slate-100 bg-white p-5 shadow-sm space-y-4",children:[e.jsxs("h3",{className:"font-bold text-slate-900 text-sm flex items-center gap-2",children:[e.jsx(E,{className:"h-4 w-4 text-violet-500"})," Global Chat System Prompt"]}),e.jsx("textarea",{rows:5,value:s.chat_system_prompt??"",onChange:t=>d("chat_system_prompt",t.target.value),placeholder:"You are AIKart DigiLicense AI assistant...",className:"w-full rounded-xl border border-slate-200 px-3 py-2.5 text-sm resize-none focus:outline-none focus:ring-2 focus:ring-violet-100 focus:border-violet-400"}),e.jsx("p",{className:"text-xs text-slate-400",children:"This system prompt is used by the Global AI Chat and as a fallback for all sub-module AI prompts."})]})]}),e.jsx("div",{className:"flex justify-end pt-2",children:e.jsxs("button",{onClick:M,disabled:r,className:"flex items-center gap-2 rounded-xl bg-violet-600 px-6 py-2.5 text-sm font-bold text-white hover:bg-violet-700 disabled:opacity-60 transition",children:[r?e.jsx(j,{className:"h-4 w-4 animate-spin"}):e.jsx(C,{className:"h-4 w-4"}),"Save All Settings"]})}),e.jsx(re,{open:a,onClose:()=>i(!1)})]})};export{Ne as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.