1import{k,r as l,j as e}from"./chunk-MgzAPU_h.js";import{u as C,q as T,p as A,ab as E,bW as x,B as h,bX as K,c as b,A as S}from"./chunk-B7SqmayI.js";import{u as P}from"./chunk-BfnMJahN.js";import{D as _}from"./chunk-DQd0IZ5F.js";import"./chunk-C-FOi6w0.js";import"./chunk-VdPWeNMn.js";import"./chunk-D7HrI6pR.js";/* empty css *//* empty css */import"./chunk-Cz8Z6ok6.js";import"./chunk-7QJKSbP6.js";import"./chunk-CJCzTxpB.js";import"./chunk-7Dv3us39.js";import"./chunk-Bh9hvlty.js";import"./chunk-CLSgpsDt.js";import"./chunk-CJhbq5IJ.js";import"./chunk-BUhBtEOv.js";import"./chunk-D_K4G5Zh.js";import"./chunk-fEjImhbo.js";import"./chunk-UoRJJJzm.js";import"./chunk-CV_T2JqX.js";import"./chunk-Yi0qw1cX.js";import"./chunk-DC_G2g_C.js";const L=[{labelKey:"agents.agents.new.blueprint.digital_course",icon:"ð",intent:"Cria um agente para vender meu curso digital"},{labelKey:"agents.agents.new.blueprint.physical_product",icon:"ð¦",intent:"Cria um agente para vender meu produto fÃsico"},{labelKey:"agents.agents.new.blueprint.hourly_service",icon:"ð
",intent:"Cria um agente para agendamento de serviços"},{labelKey:"agents.agents.new.blueprint.infoproduct",icon:"ð",intent:"Cria um agente para vender meu ebook ou infoproduto"},{labelKey:"agents.agents.new.blueprint.mentoring",icon:"ð¤",intent:"Cria um agente para captar alunos de mentoria"}];function ae(){const f=C(),n=t=>f.formatMessage({id:t}),{store:i}=T(),w=k(),{getToken:c}=P(),{toast:v}=A(),[a,g]=l.useState(""),[m,d]=l.useState(!1),[r,u]=l.useState(null);function p(t,s){v({title:n(t),description:s instanceof S?s.message:void 0,variant:"destructive"})}async function y(){if(!(!i||!a.trim())){d(!0);try{const t=await c(),s=await b(`/stores/${i.slug}/dm-agents/generate`,{method:"POST",body:{intent:a},token:t??void 0});u(s)}catch(t){p("agents.agents.new.generate.error",t)}finally{d(!1)}}}async function j(t,s){if(i)try{const o=await c(),N=await b(`/stores/${i.slug}/dm-agents`,{method:"POST",body:{name:s,config:t,isActive:!0,generatedBy:"pita"},token:o??void 0});w(`/dashboard/agents/${N.id}`)}catch(o){p("agents.agents.new.publish.error",o)}}return e.jsx(_,{title:n("agents.agents.new.title"),children:e.jsxs("div",{className:"p-6 max-w-xl mx-auto space-y-6",children:[e.jsx("h1",{className:"text-xl font-semibold",children:n("agents.agents.new.title")}),!r&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase text-muted-foreground mb-3",children:n("agents.agents.new.blueprint.label")}),e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:L.map(t=>e.jsxs("button",{type:"button",onClick:()=>g(t.intent),className:"rounded-xl border bg-card p-3 text-left hover:bg-accent transition-colors","aria-pressed":a===t.intent,children:[e.jsx("span",{className:"text-lg",children:t.icon}),e.jsx("p",{className:"text-xs font-medium mt-1",children:n(t.labelKey)})]},t.labelKey))})]}),e.jsxs("div",{children:[e.jsx(E,{value:a,onChange:t=>g(t.target.value),placeholder:n("agents.agents.new.chat.placeholder"),rows:3,maxLength:x,"aria-describedby":"intent-counter"}),e.jsxs("p",{id:"intent-counter",className:"mt-1 text-right text-xs text-muted-foreground",children:[a.length,"/",x]})]}),e.jsx(h,{onClick:y,disabled:m||!a.trim(),className:"w-full",children:m?n("agents.agents.new.generate.loading"):`⦠${n("agents.agents.new.generate.label")}`})]}),r&&e.jsxs(e.Fragment,{children:[e.jsx(K,{config:r.config,agentName:r.agentName,simulations:r.simulations,onPublish:j}),e.jsxs(h,{variant:"ghost",className:"w-full",onClick:()=>u(null),children:["â ",n("agents.agents.new.back")]})]})]})})}export{ae 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.