1import{u as X,j as e,a as c}from"./index-C6tslygu.js";import{h as Y,u as Z,b as s,L as J}from"./react-vendor-CJBNYb8e.js";const k=[{id:"chatgpt-web",label:"GPT-5.3",tier:"economy"},{id:"claude-haiku",label:"Claude Haiku 4.5",tier:"economy"},{id:"gemini-web",label:"Gemini 3 Flash",tier:"economy"},{id:"perplexity-web",label:"Sonar",tier:"economy"},{id:"grok-web",label:"Grok 3",tier:"economy"},{id:"mistral-web",label:"Mistral Medium 3",tier:"economy"},{id:"qwen-flash",label:"Qwen Flash",tier:"economy"},{id:"deepseek-chat",label:"DeepSeek V3",tier:"economy"},{id:"kimi-k2.5",label:"Kimi K2.5",tier:"economy"},{id:"claude-sonnet",label:"Claude Sonnet 4.6",tier:"flagship"},{id:"qwen-max",label:"Qwen Max",tier:"flagship"}],ee={Free:2,Starter:4,Pro:5,Business:12,Admin:1/0},re={Free:5,Starter:5,Pro:10,Business:30,Admin:1/0};function se(){var $,B,F;const{id:n}=Y(),T=Z(),{user:h}=X(),m=(h==null?void 0:h.tier)||"Free",o=ee[m]||2,g=re[m]||5,V=Number.isFinite(o)?o:"â",W=Number.isFinite(g)?g:"â",[a,_]=s.useState(null),[z,I]=s.useState(!0),[f,l]=s.useState(""),[N,u]=s.useState(""),[y,w]=s.useState(""),[G,v]=s.useState(!1),[i,S]=s.useState([]),[M,P]=s.useState(!1),[H,x]=s.useState(!1),[L,C]=s.useState(!1),[j,b]=s.useState(""),[A,D]=s.useState(!1),[O,R]=s.useState(!1),p=async()=>{try{const r=await c.getProject(n);_(r.project),S(r.project.models||[])}catch(r){l(r.message)}finally{I(!1)}};s.useEffect(()=>{p()},[n]);const q=async r=>{if(r.preventDefault(),!!y.trim()){v(!0);try{await c.addPrompt(n,{text:y.trim()}),w(""),u("Prompt added"),x(!0),p()}catch(t){l(t.message)}finally{v(!1)}}},K=async r=>{try{await c.deletePrompt(n,r),u("Prompt deleted"),x(!0),p()}catch(t){l(t.message)}},E=r=>{S(t=>t.includes(r)?t.filter(d=>d!==r):t.length>=o?t:[...t,r])},Q=async()=>{if(i.length===0)return l("Select at least one model");P(!0);try{await c.updateMethodology(n,{models:i}),u("Models updated"),x(!0),p()}catch(r){l(r.message)}finally{P(!1)}},U=async()=>{D(!0);try{await c.deleteProject(n),T("/projects")}catch(r){l(r.message),D(!1)}};return z?e.jsx("div",{id:"projsettings-loading",className:"animate-pulse h-64 bg-gray-200 dark:bg-gray-700 rounded-lg"}):e.jsxs("div",{id:"projsettings-page",className:"max-w-2xl mx-auto",children:[e.jsxs("div",{id:"projsettings-header",className:"flex items-center gap-3 mb-6",children:[e.jsx(J,{id:"projsettings-back-link",to:`/projects/${n}/dashboard`,className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",children:"â Dashboard"}),e.jsx("h1",{id:"projsettings-heading",className:"text-xl font-bold text-gray-900 dark:text-gray-100",children:"Project Settings"})]}),f&&e.jsx("div",{id:"projsettings-error",className:"text-sm text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/30 rounded-lg p-3 mb-4",children:f}),N&&e.jsx("div",{id:"projsettings-success-msg",className:"text-sm text-green-600 dark:text-green-400 bg-green-50 dark:bg-green-900/30 rounded-lg p-3 mb-4",children:N}),a&&e.jsxs("div",{id:"projsettings-entity-card",className:"border-b border-gray-200 dark:border-gray-800 pb-6 mb-6",children:[e.jsx("h2",{id:"projsettings-entity-name",className:"font-semibold text-gray-900 dark:text-gray-100 mb-1",children:($=a.entity)==null?void 0:$.value}),e.jsx("p",{id:"projsettings-entity-type",className:"text-sm text-gray-500 dark:text-gray-400",children:(B=a.entity)==null?void 0:B.type})]}),e.jsxs("div",{id:"projsettings-prompts-section",className:"border-b border-gray-200 dark:border-gray-800 pb-6 mb-6",children:[e.jsxs("h2",{id:"projsettings-prompts-heading",className:"text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-4",children:["Prompts ",e.jsxs("span",{className:"normal-case tracking-normal font-normal",children:["(",((a==null?void 0:a.prompts)||[]).length,"/",W,")"]})]}),((a==null?void 0:a.prompts)||[]).length>=g&&e.jsxs("p",{className:"text-xs text-amber-600 mb-3",children:[m," plan allows ",g," prompts per project. ",e.jsx("a",{href:"/pricing",className:"underline hover:text-amber-700",children:"Upgrade"})," to add more."]}),(F=a==null?void 0:a.prompts)==null?void 0:F.map(r=>e.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-gray-100 dark:border-gray-800 last:border-0",children:[e.jsx("span",{className:"text-sm text-gray-800 dark:text-gray-200",children:r.text}),e.jsx("button",{id:`projsettings-delete-prompt-${r.id}`,onClick:()=>K(r.id),className:"text-xs text-red-500 hover:text-red-700",children:"Delete"})]},r.id)),((a==null?void 0:a.prompts)||[]).length<g?e.jsxs("form",{id:"projsettings-add-prompt-form",onSubmit:q,className:"mt-3 flex gap-2",children:[e.jsx("input",{id:"projsettings-new-prompt-input",type:"text",value:y,onChange:r=>w(r.target.value),placeholder:"Add a new prompt...",className:"flex-1 px-3 py-2 border border-gray-300 dark:border-gray-700 rounded-lg text-sm bg-white dark:bg-[#1a1a1e] dark:text-gray-100 focus:ring-2 focus:ring-brand-500 outline-none"}),e.jsx("button",{id:"projsettings-add-prompt-btn",type:"submit",disabled:G,className:"px-4 py-2 bg-brand-600 text-white text-sm rounded-lg hover:bg-brand-700 disabled:opacity-50",children:"Add"})]}):null]}),e.jsxs("div",{id:"projsettings-models-section",className:"border-b border-gray-200 dark:border-gray-800 pb-6 mb-6",children:[e.jsxs("h2",{id:"projsettings-models-heading",className:"text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-4",children:["AI Models ",e.jsxs("span",{className:"normal-case tracking-normal font-normal",children:["(",i.length,"/",V,")"]})]}),i.length>=o&&o<k.length&&e.jsxs("p",{className:"text-xs text-amber-600 mb-3",children:[m," plan allows ",o," models. ",e.jsx("a",{href:"/pricing",className:"underline hover:text-amber-700",children:"Upgrade"})," to monitor more."]}),e.jsxs("div",{id:"projsettings-models-grid",className:"mb-4",children:[e.jsx("p",{className:"text-xs font-medium text-gray-400 dark:text-gray-500 uppercase tracking-wider mb-2 mt-1",children:"Economy"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:k.filter(r=>r.tier==="economy").map(r=>{const t=i.includes(r.id),d=!t&&i.length>=o;return e.jsxs("label",{id:`projsettings-model-${r.id}`,className:`flex items-center gap-2 p-3 rounded-lg border text-sm transition ${d?"border-gray-100 dark:border-gray-800 bg-gray-50 dark:bg-gray-800 text-gray-400 cursor-not-allowed":t?"border-brand-500 bg-brand-50 dark:bg-brand-900/20 text-brand-700 dark:text-brand-400 cursor-pointer":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 text-gray-900 dark:text-gray-100 cursor-pointer"}`,children:[e.jsx("input",{type:"checkbox",checked:t,onChange:()=>E(r.id),disabled:d,className:"sr-only"}),e.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${t?"bg-brand-600 border-brand-600":"border-gray-300 dark:border-gray-600"}
1`,children:t&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),r.label,d&&e.jsx("svg",{className:"w-3.5 h-3.5 ml-auto text-gray-300 dark:text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 10.5V6.75a4.5 4.5 0 10-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 002.25-2.25v-6.75a2.25 2.25 0 00-2.25-2.25H6.75a2.25 2.25 0 00-2.25 2.25v6.75a2.25 2.25 0 002.25 2.25z"})})]},r.id)})}),e.jsx("p",{className:"text-xs font-medium text-gray-400 dark:text-gray-500 uppercase tracking-wider mb-2 mt-4",children:"Flagship"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:k.filter(r=>r.tier==="flagship").map(r=>{const t=i.includes(r.id),d=!t&&i.length>=o;return e.jsxs("label",{id:`projsettings-model-${r.id}`,className:`flex items-center gap-2 p-3 rounded-lg border text-sm transition ${d?"border-gray-100 dark:border-gray-800 bg-gray-50 dark:bg-gray-800 text-gray-400 cursor-not-allowed":t?"border-brand-500 bg-brand-50 dark:bg-brand-900/20 text-brand-700 dark:text-brand-400 cursor-pointer":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 text-gray-900 dark:text-gray-100 cursor-pointer"}`,children:[e.jsx("input",{type:"checkbox",checked:t,onChange:()=>E(r.id),disabled:d,className:"sr-only"}),e.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${t?"bg-brand-500 border-brand-500":"border-gray-300 dark:border-gray-600"}`,children:t&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),r.label,d&&e.jsx("svg",{className:"w-3.5 h-3.5 ml-auto text-gray-300 dark:text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 10.5V6.75a4.5 4.5 0 10-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 002.25-2.25v-6.75a2.25 2.25 0 00-2.25-2.25H6.75a2.25 2.25 0 00-2.25 2.25v6.75a2.25 2.25 0 002.25 2.25z"})})]},r.id)})})]}),e.jsx("button",{id:"projsettings-save-models-btn",onClick:Q,disabled:M,className:"px-4 py-2 bg-brand-600 text-white text-sm rounded-lg hover:bg-brand-700 disabled:opacity-50",children:M?"Saving...":"Save Models"})]}),H&&e.jsxs("div",{className:"border border-brand-200 dark:border-brand-700 bg-brand-50 dark:bg-brand-900/20 rounded-lg p-4 mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-brand-700 dark:text-brand-300",children:"Configuration changed"}),e.jsx("p",{className:"text-xs text-brand-600 dark:text-brand-400 mt-0.5",children:"Run now to see the impact of your changes immediately."})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[j&&e.jsx("span",{className:`text-xs ${j==="Run started!"?"text-green-600 dark:text-green-400":"text-red-500 dark:text-red-400"}`,children:j}),e.jsxs("button",{onClick:async()=>{C(!0),b("");try{await c.manualRun(n),b("Run started!"),setTimeout(()=>{x(!1),b("")},5e3)}catch(r){b(r.message)}C(!1)},disabled:L,className:"inline-flex items-center gap-1.5 px-4 py-2 text-sm font-medium text-white bg-brand-600 hover:bg-brand-700 rounded-lg transition disabled:opacity-50",children:[L?e.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l14 9-14 9V3z"})}),"Run Now"]})]})]}),e.jsxs("div",{id:"projsettings-danger-zone",className:"border-t border-red-200 dark:border-red-800 pt-6 mt-8",children:[e.jsx("h2",{id:"projsettings-danger-heading",className:"text-sm font-medium text-red-600 dark:text-red-400 uppercase tracking-wider mb-4",children:"Danger Zone"}),O?e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Are you sure? This cannot be undone."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{id:"projsettings-confirm-delete-btn",onClick:U,disabled:A,className:"px-4 py-2 bg-red-600 text-white text-sm rounded-lg hover:bg-red-700 disabled:opacity-50",children:A?"Deleting...":"Yes, delete project"}),e.jsx("button",{id:"projsettings-cancel-delete-btn",onClick:()=>R(!1),className:"px-4 py-2 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 text-sm rounded-lg",children:"Cancel"})]})]}):e.jsx("button",{id:"projsettings-delete-btn",onClick:()=>R(!0),className:"px-4 py-2 border border-red-300 dark:border-red-700 text-red-600 dark:text-red-400 text-sm rounded-lg hover:bg-red-50 dark:hover:bg-red-900/20",children:"Delete this project"})]})]})}export{se 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.