import{d as k,n as i,p as v}from"./useEvent-D91BmmQi.js";import{Bn as w,D as y,Xr as F,ei as b,h as d,xt as x}from"./cells-BsaJrRWi.js";import{t as D}from"./compiler-runtime-B3qBwwSJ.js";import{_}from"./useEventListener-DvoEXWke.js";import{o as B}from"./dist-HlsDto3K.js";import{r as H}from"./requests-DIwGYs0l.js";var u=D();const I=v(!1);function V(){let r=(0,u.c)(2),n=f(),t;return r[0]===n?t=r[1]:(t=()=>n(b(d())),r[0]=n,r[1]=t),i(t)}function X(r){let n=(0,u.c)(3),t=f(),e;return n[0]!==r||n[1]!==t?(e=()=>{r!==void 0&&t([r])},n[0]=r,n[1]=t,n[2]=e):e=n[2],i(e)}function j(){let r=(0,u.c)(2),n=f(),t;return r[0]===n?t=r[1]:(t=()=>n(F(d())),r[0]=n,r[1]=t),i(t)}function f(){let r=(0,u.c)(4),{prepareForRun:n}=y(),{sendRun:t}=H(),e=k(I),o;return r[0]!==n||r[1]!==t||r[2]!==e?(o=async s=>{if(s.length===0)return;let c=d();return e(!0),g({cellIds:s,sendRun:t,prepareForRun:n,notebook:c})},r[0]=n,r[1]=t,r[2]=e,r[3]=o):o=r[3],i(o)}async function g({cellIds:r,sendRun:n,prepareForRun:t,notebook:e}){var m,h,R;if(r.length===0)return;let{cellHandles:o,cellData:s}=e,c=[];for(let a of r){let l=(h=(m=o[a])==null?void 0:m.current)==null?void 0:h.editorView,p;l?(w(l)!=="markdown"&&B(l),p=x(l)):p=((R=s[a])==null?void 0:R.code)||"",c.push(p),t({cellId:a})}await n({cellIds:r,codes:c}).catch(a=>{_.error(a)})}export{f as a,X as i,g as n,V as o,j as r,I as t};
