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.8.1";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,R as P,d as C,T as E,K as h,L as T,g as y,h as M,i as v,j as A,k as L,N as _,O as b,Q as k,U as x,V as j,l as U,m as B,n as N,o as O,p as R,q as D,r as F,t as q,W as H,X as z,Y as G,u as V,Z as W,v as J,w as K,_ as Q,$ as X,a0 as Y,a1 as Z,a2 as $,a3 as tt,y as st,a4 as et}from"./flowdrop-execution-logs.js?v=1.8.1";import{bO as ot,cB as nt,cD as at}from"./flowdrop.es.js?v=1.8.1";import{dF as rt,dG as it,dH as lt,b7 as gt,bP as pt,dI as dt,dJ as ut,dK as ft,dL as It}from"./flowdrop.es.js?v=1.8.1";import{setEndpointConfig as mt}from"./flowdrop-api.js?v=1.8.1";async function ct(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 ot(async()=>{const{defaultEndpointConfig:t}=await import("./flowdrop.es.js?v=1.8.1").then(t=>t.ea);return{defaultEndpointConfig:t}},[]);E={...t,...m,endpoints:{...t.endpoints,...m.endpoints}},mt(E)}let h,T=g;"modal"===f?T=document.body:(g.style.height=S,g.style.width=w),h="modal"===f?nt(i,{target:T,props:{isOpen:!0,workflowId:d,workflow:u,initialSessionId:I,endpointConfig:E,config:c,onClose:()=>{P&&P()}}}):nt(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(),at(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 St(t){t&&"function"==typeof t.destroy&&t.destroy()}export{rt as CHAT_INPUT_PATTERNS,g as ChatPanel,p as ChoicePrompt,d as ConfirmationPrompt,it as DEFAULT_STOP_POLLING_STATUSES,lt 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 ReviewPrompt,C as SessionManager,E as TextInputPrompt,gt as buildEndpointUrl,pt as createEndpointConfig,t as createPollingCallback,dt as defaultEndpointConfig,h as defaultInterruptPollingConfig,ut as defaultIsTerminalStatus,ft as defaultShouldStopPolling,T as extractInterruptMetadata,y as getChatMessages,n as getCurrentSession,M as getCurrentSessionId,v as getCurrentWorkflow,A as getHasChatInput,L as getInputFields,_ as getInterrupt,b as getInterruptByMessageId,k as getInterruptError,x as getInterruptsMap,j as getIsAnySubmitting,U as getIsExecuting,B as getIsLoading,N as getLastPollTimestamp,O as getLatestMessage,R as getLatestMessageTimestamp,D as getLogMessages,F as getMessageCount,a as getMessages,q as getMessagesSnapshot,H as getPendingInterruptCount,z as getPendingInterruptIds,G as getPendingInterrupts,V as getPlaygroundError,W as getResolvedInterrupts,J as getSessionCount,K as getSessionStatus,r as getSessions,Q as interruptActions,X as interruptHasError,Y as interruptService,It as isChatInputNode,Z as isInterruptMetadata,$ as isInterruptPending,tt as isInterruptSubmitting,st as isSessionSelected,et as metadataToInterrupt,ct as mountPlayground,o as playgroundActions,e as playgroundService,s as subscribeToSessionStatus,St as unmountPlayground};
//# sourceMappingURL=flowdrop-playground.js.map
