import{r as N,j as e,F as v,e as F,f as n,S,B as w,L as M,o as j,t as I,k as O,h as B}from"./main-few-lands-burn.js";import{a as _,N as h}from"./useflows-BpG3C9m1.js";import{N as D}from"./appheade-BErcWjPn.js";import{L as R,o as q,n as A,v as E,a as P,C as G,E as H}from"./index-Vx_YZd5N.js";import{c as g}from"./mutative-C6xjlr6O.js";import{M as L}from"./mixinput-CX5xeb4d.js";import{S as T}from"./index-BcDJZYeX.js";import{F as J}from"./index-wzUEm29P.js";import{R as K,C as k,T as b}from"./index-ubWv-fhI.js";import"./lodash-YpNkAOPN.js";import"./utilscss-IoKwGUy7.js";import"./index-DAhFlZRY.js";import"./index-XyHDR-91.js";import"./index-Cj8-kItB.js";import"./index-CB2KTxNj.js";import"./useclosa-m-cf8k_D.js";import"./context-Ba3TiTex.js";import"./flowstat-BxuW8LT8.js";import"./index-CyNIBchZ.js";import"./usedebou-9GKFiQAC.js";import"./tabpanel-DvU0ks7q.js";import"./index-28_Ul1Wv.js";import"./usebreak-DJkppNCB.js";import"./index-CTlEl9RP.js";import"./useflows-BbAh-zeS.js";import"./index-btcdg7gz.js";import"./import-Cn4VUyaV.js";import"./paginati-DuhDnQhP.js";import"./index-DkD03DCM.js";import"./index-DLjoOpJs.js";import"./index-Budcgb8A.js";import"./isobject-D8hieKPs.js";var Q={name:"19hpbzq",styles:"margin:6px 0 !important"},U={name:"1dftezk",styles:"max-width:150px;min-width:150px"},V={name:"ozd7xs",styles:"flex-shrink:0"},W={name:"6dhm9o",styles:"visibility:hidden"};function X({conditionId:s,nodeId:d}){const[f,a]=_(d),u=()=>{const t=f?.states?.conditions?.find(o=>o.id===s);return!t||t.type===h.defaultConditionLogic?[]:t.condition},C=N.useMemo(u,[f,s]),l=(t,o,i)=>{a(r=>g(r,c=>{const x=c.states?.conditions?.find(z=>z.id===s);if(!x||x.type===h.defaultConditionLogic)return;const m=x.condition[o];m.type==="logical-operator"?m.value=t:i==="leftExp"?m.leftExp=t:i==="operator"?m.operator=t:i==="rightExp"&&(m.rightExp=t)}))},p=t=>()=>{a(o=>g(o,i=>{const r=i.states?.conditions?.find(c=>c.id===s);!r||r.type===h.defaultConditionLogic||r.condition.splice(t+1,0,{id:E(),...A},{id:E(),...P})}))},y=t=>()=>{a(o=>g(o,i=>{const r=i.states?.conditions?.find(c=>c.id===s);!r||r.type===h.defaultConditionLogic||r.condition.splice(t-1,2)}))};return s?e(v,{children:C.map((t,o)=>n("div",{children:[t.type==="logical-operator"&&e(T,{css:Q,onChange:i=>l(i,o,"logicalOperator"),options:R,value:t.value}),t.type==="logic"&&n(J,{align:"middle",gap:6,children:[e(L,{onChange:i=>l(i,o,"leftExp"),value:t.leftExp,wrapperClassName:"w-100"}),e(T,{css:U,dropdownStyle:{width:300},onChange:i=>l(i,o,"operator"),options:q,showSearch:!0,value:t.operator}),e(L,{onChange:i=>l(i,o,"rightExp"),value:t.rightExp,wrapperClassName:"w-100"}),n(S,{css:V,size:6,children:[e(w,{icon:e(M,{}),onClick:p(o),shape:"circle"}),o===0?e(w,{css:W}):e(w,{danger:!0,icon:e(j,{}),onClick:y(o),shape:"circle"})]})]})]},t.id))}):e(v,{children:F("Condition ID Missing")})}const zt=N.memo(Y);function Y({conditionId:s,nodeId:d}){const{token:f}=I.useToken(),[a,u]=_(d),C=N.useMemo(()=>a?.states?.conditions?.find(p=>p.id===s)||{},[s,a?.states?.conditions]),l=p=>{u(y=>g(y,t=>{const o=t.states?.conditions?.find(i=>i.id===s);o&&(o.title=p)}))};return n(v,{children:[n("div",{className:"mb-4",children:[e(D,{}),n(K,{align:"middle",gutter:15,children:[e(k,{flex:"none",children:e("div",{className:O(["flex size-12 items-center justify-center rounded-md bg-slate-200 dark:bg-gray-900"]),children:e(G,{size:"2.5rem",stroke:1})})}),n(k,{flex:"auto",children:[e(b.Title,{className:"mb-0",editable:{icon:e(H,{css:B({color:f.colorText},"","")}),onChange:l,triggerType:["icon","text"]},level:5,children:C?.title}),e(b.Text,{type:"secondary",children:F("Conditional Logic")})]})]})]}),e(X,{conditionId:s,nodeId:d})]})}export{zt as default};
