1import{u as D,j as e,H as S,L as x,r as F}from"./app-ByQch4I5.js";import{b as h}from"./vendor-charts-BKAt7cDO.js";import{A as T}from"./AuthenticatedLayout-CJ_-9G1k.js";import{C as k,a as I,b as L,d as M,c as H,e as E}from"./card-BuV06XZb.js";import{I as u}from"./input-oWbSJjZA.js";import{B as a}from"./button-CO2CfBCy.js";import{S as B,a as O,b as P,c as q,e as A,d as Q}from"./select-CpwNcpia.js";import{D as R,f as V,a as Z,b as z,c as G,d as J}from"./dialog-EiObWKOB.js";import{B as c}from"./badge-hIqUqezW.js";import{D as K,a as U,b as W,e as X,c as f,d as Y}from"./dropdown-menu-LpFfuLO0.js";import{u as $}from"./utils-CUI6UMdp.js";import{S as ee}from"./search-dj5XOZjc.js";import{P as j}from"./plus-8bpxxhG9.js";import{c as se}from"./createLucideIcon-DK2HYjz_.js";import{Z as te}from"./zap-CUU-61yw.js";import{E as ae}from"./ellipsis-DIT280dS.js";import"./IntercomProvider-YCDMJfYS.js";import"./IntegrationLogos-Z8S5Bw8D.js";import"./x-B4BqlaU8.js";import"./plug-B2gyJ7AY.js";import"./check-Drz9NtyC.js";import"./sparkles-CU073Ka0.js";import"./message-circle-Ox8NpyAr.js";import"./bot-DzPro7Ls.js";import"./workflow-DHTzOaUG.js";import"./users-CqxZ7oGj.js";import"./triangle-alert-DqaUqV91.js";import"./index-CqaWym_s.js";import"./index-B55C8FZP.js";import"./index-C6kCe8uY.js";import"./Combination-DeVoTXCW.js";import"./index-wp-dmnFN.js";import"./index-iTC7Zblw.js";import"./index-sZSOPfrQ.js";import"./index-BYnlm6xS.js";import"./circle-D0o7WlQ4.js";const re=[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]],le=se("route",re);function Re({flows:g=[],templates:w=[]}){const{t}=$(),[r,N]=h.useState(""),[v,o]=h.useState(!1),{data:l,setData:d,post:b,processing:m,errors:i,reset:y}=D({name:"",trigger_template_id:""}),C=s=>{s.preventDefault(),b(route("flows.store"),{preserveScroll:!0,onSuccess:()=>{y({name:"",trigger_template_id:""}),o(!1)}})},_=s=>{window.confirm(t("flows.confirmDelete"))&&F.delete(route("flows.destroy",s),{preserveScroll:!0})},n=w.filter(s=>s.has_quick_replies),p=g.filter(s=>s.name.toLowerCase().includes(r.toLowerCase()));return e.jsxs(T,{title:t("flows.title"),description:t("flows.description"),children:[e.jsx(S,{title:t("flows.title")}),e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"relative max-w-sm flex-1",children:[e.jsx(ee,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(u,{type:"search",placeholder:t("flows.searchPlaceholder"),className:"pl-9",value:r,onChange:s=>N(s.target.value)})]}),e.jsxs(R,{open:v,onOpenChange:o,children:[e.jsx(V,{asChild:!0,children:e.jsxs(a,{children:[e.jsx(j,{className:"mr-2 h-4 w-4"})," ",t("flows.createFlow")]})}),e.jsxs(Z,{children:[e.jsxs(z,{children:[e.jsx(G,{children:t("flows.createTitle")}),e.jsx(J,{children:t("flows.createDesc")})]}),e.jsxs("form",{onSubmit:C,className:"space-y-4 pt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:t("flows.name")}),e.jsx(u,{value:l.name,onChange:s=>d("name",s.target.value),placeholder:t("flows.namePlaceholder")}),i.name&&e.jsx("p",{className:"text-sm text-red-500",children:i.name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:t("flows.entryTemplate")}),e.jsxs(B,{value:l.trigger_template_id,onValueChange:s=>d("trigger_template_id",s),children:[e.jsx(O,{children:e.jsx(P,{placeholder:n.length?t("flows.selectTemplate"):t("flows.noTemplates")})}),e.jsx(q,{children:e.jsx(A,{children:n.map(s=>e.jsx(Q,{value:s.id,children:s.name},s.id))})})]}),i.trigger_template_id&&e.jsx("p",{className:"text-sm text-red-500",children:i.trigger_template_id}),!n.length&&e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:t("flows.createTemplateFirst")})]}),e.jsx("div",{className:"flex justify-end pt-2",children:e.jsx(a,{type:"submit",disabled:m||!l.name||!l.trigger_template_id,children:t(m?"actions.saving":"flows.createFlow")})})]})]})]})]}),p.length===0?e.jsxs("div",{className:"flex h-[400px] flex-col items-center justify-center rounded-lg border border-dashed text-center",children:[e.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:e.jsx(le,{className:"h-6 w-6 text-muted-foreground"})}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:t("flows.noFlows")}),e.jsx("p",{className:"mb-4 mt-2 text-sm text-muted-foreground max-w-sm",children:t(r?"flows.adjustSearch":"flows.noFlowsHelp")}),!r&&e.jsxs(a,{onClick:()=>o(!0),children:[e.jsx(j,{className:"mr-2 h-4 w-4"})," ",t("flows.createFlow")]})]}):e.jsx("div",{className:"grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:p.map(s=>e.jsxs(k,{className:"flex flex-col transition-all hover:border-primary/50",children:[e.jsx(I,{className:"pb-3",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"rounded-md bg-primary/10 p-2 text-primary",children:e.jsx(te,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx(L,{className:"text-base line-clamp-1",title:s.name,children:s.name}),e.jsx(M,{className:"text-xs mt-1",children:t("flows.interactiveJourney")})]})]}),e.jsxs(K,{children:[e.jsx(U,{asChild:!0,children:e.jsxs(a,{variant:"ghost",size:"icon",className:"-mr-2 h-8 w-8",children:[e.jsx(ae,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Open menu"})]})}),e.jsxs(W,{align:"end",children:[e.jsx(X,{children:t("actions.edit")}),e.jsx(f,{asChild:!0,children:e.jsx(x,{href:route("flows.show",
1s.id),children:t("flows.editFlow")})}),e.jsx(Y,{}),e.jsx(f,{className:"text-red-600 focus:bg-red-50 focus:text-red-600 dark:focus:bg-red-900/10",onClick:()=>_(s.id),children:t("actions.delete")})]})]})]})}),e.jsx(H,{className:"flex-1 pb-3",children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(c,{variant:s.status==="published"?"default":"secondary",className:"text-[10px] uppercase",children:s.status}),e.jsxs(c,{variant:"outline",className:"text-[10px]",children:[s.nodes_count," ",t("flows.nodes")]}),s.trigger_template&&e.jsx(c,{variant:"secondary",className:"text-[10px] line-clamp-1 max-w-[150px]",children:s.trigger_template.name})]})}),e.jsx(E,{className:"pt-0",children:e.jsx(a,{asChild:!0,className:"w-full",variant:"secondary",children:e.jsx(x,{href:route("flows.show",s.id),children:t("flows.openEditor")})})})]},s.id))})]})]})}export{Re 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.