import{e as t,B as s,A as e,z as o,f as n,s as a,x as r,a as i,P as l}from"./flowdrop-execution-logs.js?v=1.0.0";import{C as g,D as p,F as d,E as u,G as f,I,H as m,J as c,M as S,c as w,d as P,T as C,K as E,L as h,g as T,h as y,i as M,j as v,k as A,N as L,O as _,Q as b,R as x,U as k,l as j,m as U,n as F,o as N,p as B,q as O,r as R,t as q,V as D,W as H,X as z,u as G,Y as V,v as W,w as J,Z as K,_ as Q,$ as X,a0 as Y,a1 as Z,a2 as $,y as tt,a3 as st}from"./flowdrop-execution-logs.js?v=1.0.0";import{bF as et,c3 as ot,c5 as nt}from"./flowdrop.es.js?v=1.0.0";import{d4 as at,d5 as rt,d6 as it,b6 as lt,bG as gt,d7 as pt,d8 as dt,d9 as ut,da as ft}from"./flowdrop.es.js?v=1.0.0";import{setEndpointConfig as It}from"./flowdrop-api.js?v=1.0.0";async function mt(g,p){const{workflowId:d,workflow:u,mode:f="standalone",initialSessionId:I,endpointConfig:m,config:c={},height:S="100%",width:w="100%",onClose:P,onSessionStatusChange:C}=p;if(!d)throw new Error("workflowId is required for mountPlayground()");if(!g)throw new Error("container element is required for mountPlayground()");if("modal"===f&&!P)throw new Error("onClose callback is required for modal mode");let E;if(m){const{defaultEndpointConfig:t}=await et(async()=>{const{defaultEndpointConfig:t}=await import("./flowdrop.es.js?v=1.0.0").then(t=>t.dx);return{defaultEndpointConfig:t}},[]);E={...t,...m,endpoints:{...t.endpoints,...m.endpoints}},It(E)}let h,T=g;"modal"===f?T=document.body:(g.style.height=S,g.style.width=w),h="modal"===f?ot(i,{target:T,props:{isOpen:!0,workflowId:d,workflow:u,initialSessionId:I,endpointConfig:E,config:c,onClose:()=>{P&&P()}}}):ot(l,{target:T,props:{workflowId:d,workflow:u,mode:f,initialSessionId:I,endpointConfig:E,config:c,onClose:P}});const y={svelteApp:h},M=t(c.isTerminalStatus),v=c.pollingInterval??1500;let A;C&&(A=s(C));return{destroy:()=>{A?.(),e.stopPolling(),o.reset(),nt(y.svelteApp)},getCurrentSession:()=>n(),getSessions:()=>r(),getMessageCount:()=>a().length,isExecuting:()=>e.isPolling(),stopPolling:()=>{e.stopPolling()},startPolling:()=>{const t=n();t&&e.startPolling(t.id,M,v,c.shouldStopPolling)},pushMessages:t=>{M(t)},reset:()=>{e.stopPolling(),o.reset()}}}function ct(t){t&&"function"==typeof t.destroy&&t.destroy()}export{at as CHAT_INPUT_PATTERNS,g as ChatPanel,p as ChoicePrompt,d as ConfirmationPrompt,rt as DEFAULT_STOP_POLLING_STATUSES,it as DEFAULT_TERMINAL_STATUSES,u as ExecutionLogs,f as FormPrompt,I as InputCollector,m as InterruptBubble,c as InterruptService,S as MessageBubble,l as Playground,i as PlaygroundModal,w as PlaygroundService,P as SessionManager,C as TextInputPrompt,lt as buildEndpointUrl,gt as createEndpointConfig,t as createPollingCallback,pt as defaultEndpointConfig,E as defaultInterruptPollingConfig,dt as defaultIsTerminalStatus,ut as defaultShouldStopPolling,h as extractInterruptMetadata,T as getChatMessages,n as getCurrentSession,y as getCurrentSessionId,M as getCurrentWorkflow,v as getHasChatInput,A as getInputFields,L as getInterrupt,_ as getInterruptByMessageId,b as getInterruptError,x as getInterruptsMap,k as getIsAnySubmitting,j as getIsExecuting,U as getIsLoading,F as getLastPollTimestamp,N as getLatestMessage,B as getLatestMessageTimestamp,O as getLogMessages,R as getMessageCount,a as getMessages,q as getMessagesSnapshot,D as getPendingInterruptCount,H as getPendingInterruptIds,z as getPendingInterrupts,G as getPlaygroundError,V as getResolvedInterrupts,W as getSessionCount,J as getSessionStatus,r as getSessions,K as interruptActions,Q as interruptHasError,X as interruptService,ft as isChatInputNode,Y as isInterruptMetadata,Z as isInterruptPending,$ as isInterruptSubmitting,tt as isSessionSelected,st as metadataToInterrupt,mt as mountPlayground,o as playgroundActions,e as playgroundService,s as subscribeToSessionStatus,ct as unmountPlayground};
//# sourceMappingURL=flowdrop-playground.js.map
