import{r as e,t}from"./jsx-runtime-BbTa8W_M-1776590214964.js";import{a as n,n as r,t as i}from"./app-CXDQ5oEH-1776590214964.js";import{t as a}from"./createLucideIcon-D477Pc8e-1776590214964.js";import{t as o}from"./AdminLayout-gmPnZHB9-1776590214964.js";import{t as s}from"./loader-circle-BF-wgoyu-1776590214964.js";import{t as c}from"./save-DLvESXbJ-1776590214964.js";import{t as l}from"./settings-2-C39olOm--1776590214964.js";import{t as u}from"./shield-check-BHIMgi8g-1776590214964.js";import{t as d}from"./sparkles-D16i4Qsy-1776590214964.js";import{t as f}from"./button-WiAFyHfP-1776590214964.js";import{t as p}from"./label-DwYxovYB-1776590214964.js";import{t as m}from"./switch-Cb0OQpvv-1776590214964.js";import{a as h,i as g,n as _,o as v,t as y}from"./card-Cby8flFO-1776590214964.js";import{t as b}from"./textarea-DoC3T7xj-1776590214964.js";var x=a(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]);e();var S=t();function C({features:e}){let t={};e.forEach(e=>{t[e.id]=e.is_enabled,e.prompt!==void 0&&(t[`${e.id}_prompt`]=e.prompt)});let{data:a,setData:C,post:w,processing:T}=n(t);return(0,S.jsxs)(o,{children:[(0,S.jsx)(r,{title:`AI Features & Rules`}),(0,S.jsxs)(`div`,{className:`max-w-5xl mx-auto space-y-6 pb-12`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3 mb-6`,children:[(0,S.jsx)(d,{className:`w-8 h-8 text-primary`}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h2`,{className:`text-2xl font-bold tracking-tight`,children:`AI Capabilities & Rules`}),(0,S.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage active modules and their system instructions.`})]})]}),(0,S.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),w(route(`cp.settings.ai_features.update`),{preserveScroll:!0,onSuccess:()=>i.success(`AI capabilities updated successfully.`)})},children:(0,S.jsxs)(y,{className:`shadow-sm border-border/50`,children:[(0,S.jsx)(h,{className:`bg-muted/10 border-b pb-4`,children:(0,S.jsxs)(v,{className:`flex items-center gap-2`,children:[(0,S.jsx)(l,{className:`w-5 h-5 text-primary`}),` Global Feature Toggles`]})}),(0,S.jsx)(_,{className:`p-0 divide-y divide-border`,children:e.map(e=>(0,S.jsxs)(`div`,{className:`p-6 flex flex-col gap-4 transition-colors ${a[e.id]?`bg-primary/5`:`bg-card`}`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-4`,children:[(0,S.jsxs)(`div`,{className:`flex-1 space-y-1`,children:[(0,S.jsx)(p,{htmlFor:e.id,className:`text-base font-bold cursor-pointer`,children:e.name}),(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed max-w-2xl`,children:e.description})]}),(0,S.jsx)(`div`,{className:`shrink-0`,children:(0,S.jsx)(m,{id:e.id,checked:a[e.id],onCheckedChange:t=>C(e.id,t)})})]}),e.id.includes(`_assistant`)&&a[e.id]&&(0,S.jsxs)(`div`,{className:`mt-2 pt-4 border-t border-border/40 animate-in fade-in slide-in-from-top-2`,children:[(0,S.jsxs)(p,{className:`flex items-center gap-2 font-bold mb-2 text-primary text-xs uppercase tracking-wider`,children:[(0,S.jsx)(x,{className:`w-3.5 h-3.5`}),` System Prompt`]}),(0,S.jsx)(b,{value:a[`${e.id}_prompt`],onChange:t=>C(`${e.id}_prompt`,t.target.value),className:`min-h-[100px] font-mono text-sm bg-background`,placeholder:`Enter system instructions...`})]})]},e.id))}),(0,S.jsxs)(g,{className:`p-6 border-t bg-muted/10 flex justify-between items-center`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-green-600`,children:[(0,S.jsx)(u,{className:`w-4 h-4`}),(0,S.jsx)(`span`,{children:`Changes apply instantly.`})]}),(0,S.jsxs)(f,{type:`submit`,disabled:T,children:[T?(0,S.jsx)(s,{className:`w-4 h-4 mr-2 animate-spin`}):(0,S.jsx)(c,{className:`w-4 h-4 mr-2`}),`Save Config`]})]})]})})]})]})}export{C as default};