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