import{d as b,n as l,p as k}from"./useEvent-D91BmmQi.js";import{Di as v,E as w,Zn as y,bi as F,ht as D,m as d}from"./cells-CJLUCcQg.js";import{t as x}from"./compiler-runtime-B3qBwwSJ.js";import{g as E}from"./useEventListener-C0195JsF.js";import{o as H}from"./dist-DYEuVkEX.js";import{r as V}from"./requests-9-v2bhoi.js";var u=x();const g=k(!1);function Z(){let r=(0,u.c)(2),n=f(),t;return r[0]===n?t=r[1]:(t=()=>n(v(d())),r[0]=n,r[1]=t),l(t)}function _(r){let n=(0,u.c)(3),t=f(),o;return n[0]!==r||n[1]!==t?(o=()=>{r!==void 0&&t([r])},n[0]=r,n[1]=t,n[2]=o):o=n[2],l(o)}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),l(t)}function f(){let r=(0,u.c)(4),{prepareForRun:n}=w(),{sendRun:t}=V(),o=b(g),e;return r[0]!==n||r[1]!==t||r[2]!==o?(e=async s=>{if(s.length===0)return;let c=d();return o(!0),I({cellIds:s,sendRun:t,prepareForRun:n,notebook:c})},r[0]=n,r[1]=t,r[2]=o,r[3]=e):e=r[3],l(e)}async function I({cellIds:r,sendRun:n,prepareForRun:t,notebook:o}){var m,h,R;if(r.length===0)return;let{cellHandles:e,cellData:s}=o,c=[];for(let a of r){let i=(h=(m=e[a])==null?void 0:m.current)==null?void 0:h.editorView,p;i?(y(i)!=="markdown"&&H(i),p=D(i)):p=((R=s[a])==null?void 0:R.code)||"",c.push(p),t({cellId:a})}await n({cellIds:r,codes:c}).catch(a=>{E.error(a)})}export{f as a,_ as i,I as n,Z as o,j as r,g as t};
