@marimo-team/frontend 0.23.9-dev43 → 0.23.9-dev45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{s as B}from"./chunk-LvLJmgfZ.js";import{u as I}from"./useEvent-D91BmmQi.js";import{t as L}from"./react-Bj1aDYRI.js";import{D as U,Si as $,g as W,x as F}from"./cells-CFd8A4_A.js";import"./react-dom-CSu739Rf.js";import{t as P}from"./compiler-runtime-B3qBwwSJ.js";import{x as H}from"./utils-CvI-39U6.js";import{n as z}from"./constants-DMpttj8Q.js";import{T as M,l as E,m as V}from"./config-DdDKNgb1.js";import{t as q}from"./cn-DCUzRj2J.js";import{t as G}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-eipL3i3Y.js";import"./popover-Bz_0Vkyf.js";import{B as J,w as K,wt as Q}from"./JsonOutput-B2v_Stn9.js";import{r as X}from"./download-BaGnGHOq.js";import{n as Y,t as R}from"./button-BbCh-29a.js";import"./dist-BrR4M-k3.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{r as Z}from"./requests-DIwGYs0l.js";import"./layout-CfRdiox1.js";import{c as ee}from"./state-DTislnZA.js";import"./markdown-renderer-B1eFOa7V.js";import{t as te}from"./copy-BwrPA9zQ.js";import{i as re,l as se,n as oe,r as O,t as ae,u as ie}from"./panels-CwtNk2-W.js";import{t as ne}from"./spinner-Bhir8k53.js";import"./dist-CBSMxaO_.js";import"./dist-CpTFpfm_.js";import"./dist-B1U1kGCR.js";import"./dist-ChF5Ln9c.js";import"./dist-CPczQFlJ.js";import{t as le}from"./use-toast-IPAtJGea.js";import{t as me}from"./session-0B5NBztP.js";import"./purify.es-B9KxLTTS.js";import"./dates-CTxr0EqQ.js";import{n as ce}from"./copy-LK56fFow.js";import{a as de,c as pe,l as he,n as xe,r as fe,t as be}from"./dialog-DzC_QCtT.js";import{t as je}from"./share-DMwTZOTH.js";import"./utils-DCL4n9wx.js";import"./vega-loader.browser-C8wT63Va.js";import"./defaultLocale-BLUna9fQ.js";import"./defaultLocale-DzliDDTm.js";import{a as ue}from"./cell-link-CW22jH60.js";import"./chunk-5FQGJX7Z-D9iBG0F7.js";import"./html-to-image-CJxTFjQz.js";import{n as ge,t as ye}from"./react-resizable-panels.browser.esm-CV8-hvjx.js";import"./esm-CqWdmSnV.js";import"./name-cell-input-DdwASAQy.js";import{n as ke,t as _e}from"./marimo-icons-CiwvnnsT.js";import"./ws-BnE9sl8z.js";import"./dist-BQeNY9Zl.js";import"./dist-CXBpwk_w.js";import"./dist-DUHHizRG.js";import"./dist-D70Tz1Kr.js";import"./dist-BF6UNR6V.js";import"./dist-CsvFAFh9.js";import"./dist-DqVEVg0c.js";import"./dist-BlOtCkpT.js";import"./dist-C78V1LRz.js";import"./esm-DeiyaVAJ.js";var Ne=P(),we=B(L(),1),t=B(G(),1);const ve=o=>{let e=(0,Ne.c)(27),{appConfig:s}=o,{setCells:r}=U(),{sendComponentValues:p}=Z(),i;e[0]===p?i=e[1]:(i=()=>(O.INSTANCE.start(p),Se),e[0]=p,e[1]=i);let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=[],e[2]=n):n=e[2],(0,we.useEffect)(i,n);let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=me(),e[3]=h):h=e[3];let u;e[4]===r?u=e[5]:(u={autoInstantiate:!0,setCells:r,sessionId:h},e[4]=r,e[5]=u);let{connection:l,reconnect:w}=oe(u),f=I(F),g;e[6]===l.state?g=e[7]:(g=V(l.state),e[6]=l.state,e[7]=g);let v=g,b=I(W),y;e[8]!==s||e[9]!==b||e[10]!==v?(y=()=>v&&!b?(0,t.jsxs)(J,{milliseconds:2e3,fallback:null,children:[(0,t.jsx)(ne,{className:"mx-auto"}),(0,t.jsx)("p",{className:"text-center text-sm text-muted-foreground mt-2",children:"Connecting..."})]}):(0,t.jsx)(re,{appConfig:s,mode:"read"}),e[8]=s,e[9]=b,e[10]=v,e[11]=y):y=e[11];let j=y,m;e:{if(typeof window>"u"){m=null;break e}let x,a;if(e[12]===Symbol.for("react.memo_cache_sentinel")){if(a=new URL(window.location.href),!a.searchParams.has("file")){m=null;break e}a.searchParams.delete("file"),x=a.searchParams.toString(),e[12]=x,e[13]=a,e[14]=m}else x=e[12],a=e[13],m=e[14];let C=x;m=C?`${a.pathname}?${C}`:a.pathname}let k=m,S=s.width,_;e[15]===Symbol.for("react.memo_cache_sentinel")?(_=k&&(0,t.jsx)("div",{className:"flex items-center px-6 pt-4 sm:-mt-8",children:(0,t.jsxs)("a",{href:k,"aria-label":"Back to gallery",className:q(Y({variant:"text",size:"sm"}),"gap-2 px-0 text-muted-foreground hover:text-foreground"),children:[(0,t.jsx)(ee,{className:"size-4","aria-hidden":!0}),(0,t.jsx)("span",{children:"Back"})]})}),e[15]=_):_=e[15];let c;e[16]===l?c=e[17]:(c=(0,t.jsx)(ie,{connection:l,className:"sm:pt-8",children:_}),e[16]=l,e[17]=c);let d;e[18]===j?d=e[19]:(d=j(),e[18]=j,e[19]=d);let N;return e[20]!==s.width||e[21]!==l||e[22]!==f||e[23]!==w||e[24]!==c||e[25]!==d?(N=(0,t.jsxs)(se,{connection:l,isRunning:f,width:S,onReconnect:w,children:[c,d]}),e[20]=s.width,e[21]=l,e[22]=f,e[23]=w,e[24]=c,e[25]=d,e[26]=N):N=e[26],N};function Se(){O.INSTANCE.stop()}var A=P();const Ce=()=>{let o=(0,A.c)(3),e=I($);if(!E()||!e)return null;let s;o[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsxs)("span",{children:["Static"," ",(0,t.jsx)("a",{href:z.githubPage,target:"_blank",className:"text-(--sky-11) font-medium underline",children:"marimo"})," ","notebook - Run or edit for full interactivity"]}),o[0]=s):s=o[0];let r;return o[1]===e?r=o[2]:(r=(0,t.jsxs)("div",{className:"px-4 py-2 bg-(--sky-2) border-b border-(--sky-7) text-(--sky-11) flex justify-between items-center gap-4 print:hidden text-sm","data-testid":"static-notebook-banner",children:[s,(0,t.jsx)("span",{className:"shrink-0",children:(0,t.jsx)(ze,{code:e})})]}),o[1]=e,o[2]=r),r};var ze=o=>{var T;let e=(0,A.c)(36),{code:s}=o,r=ue()||"notebook.py",p=r.lastIndexOf("/");p!==-1&&(r=r.slice(p+1));let[i]=H(),n=((T=i.sharing)==null?void 0:T.molab)!==!1,h=window.location.href,u;e[0]===s?u=e[1]:(u=je({code:s,baseUrl:`${z.molab}/new`}),e[0]=s,e[1]=u);let l=u,w;e[2]===Symbol.for("react.memo_cache_sentinel")?(w=(0,t.jsx)(he,{asChild:!0,children:(0,t.jsx)(R,{"data-testid":"static-notebook-dialog-trigger",variant:"outline",size:"xs",children:"Run or Edit"})}),e[2]=w):w=e[2];let f;e[3]===r?f=e[4]:(f=(0,t.jsx)(pe,{children:r}),e[3]=r,e[4]=f);let g;e[5]===Symbol.for("react.memo_cache_sentinel")?(g=(0,t.jsxs)("p",{children:["This is a static"," ",(0,t.jsx)("a",{href:z.githubPage,target:"_blank",className:"text-(--sky-11) hover:underline font-medium",children:"marimo"})," ","notebook. To run interactively:"]}),e[5]=g):g=e[5];let v;e[6]===Symbol.for("react.memo_cache_sentinel")?(v=(0,t.jsx)("br",{}),e[6]=v):v=e[6];let b;e[7]===r?b=e[8]:(b=(0,t.jsx)("div",{className:"rounded-lg p-3 border bg-(--sky-2) border-(--sky-7)",children:(0,t.jsxs)("div",{className:"font-mono text-(--sky-11) leading-relaxed",children:["pip install marimo",v,"marimo edit ",r]})}),e[7]=r,e[8]=b);let y;e[9]===Symbol.for("react.memo_cache_sentinel")?(y=!h.endsWith(".html")&&(0,t.jsxs)("div",{className:"rounded-lg p-3 border bg-(--sky-2) border-(--sky-7)",children:[(0,t.jsx)("div",{className:"text-sm text-(--sky-12) mb-1",children:"Or run directly from URL:"}),(0,t.jsxs)("div",{className:"font-mono text-(--sky-11) break-all",children:["marimo edit ",window.location.href]})]}),e[9]=y):y=e[9];let j;e[10]!==n||e[11]!==l?(j=n&&(0,t.jsxs)("div",{className:"pt-3 border-t flex gap-2 items-center",children:[(0,t.jsx)(R,{asChild:!0,variant:"outline",size:"xs",className:"shrink-0",children:(0,t.jsxs)("a",{href:l,target:"_blank",rel:"noopener noreferrer",children:[(0,t.jsx)(ke,{size:12,strokeWidth:1.5,className:"mr-1.5 mt-px text-(--grass-11)"}),"Open in molab"]})}),(0,t.jsxs)("p",{className:"text-sm text-(--sky-12)",children:["Run this notebook in"," ",(0,t.jsx)("span",{className:"font-semibold",children:"molab"}),", marimo's cloud-hosted notebook platform."]})]}),e[10]=n,e[11]=l,e[12]=j):j=e[12];let m;e[13]!==b||e[14]!==j?(m=(0,t.jsxs)(fe,{className:"pt-3 text-left space-y-3",children:[g,b,y,j]}),e[13]=b,e[14]=j,e[15]=m):m=e[15];let k;e[16]!==f||e[17]!==m?(k=(0,t.jsxs)(de,{children:[f,m]}),e[16]=f,e[17]=m,e[18]=k):k=e[18];let S;e[19]===s?S=e[20]:(S=async()=>{await ce(s),le({title:"Copied to clipboard"})},e[19]=s,e[20]=S);let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=(0,t.jsx)(te,{className:"w-3 h-3 mr-2"}),e[21]=_):_=e[21];let c;e[22]===S?c=e[23]:(c=(0,t.jsxs)(R,{"data-testid":"copy-static-notebook-dialog-button",variant:"outline",size:"sm",onClick:S,children:[_,"Copy code"]}),e[22]=S,e[23]=c);let d;e[24]!==s||e[25]!==r?(d=()=>{X(new Blob([s],{type:"text/plain"}),r)},e[24]=s,e[25]=r,e[26]=d):d=e[26];let N;e[27]===Symbol.for("react.memo_cache_sentinel")?(N=(0,t.jsx)(Q,{className:"w-3 h-3 mr-2"}),e[27]=N):N=e[27];let x;e[28]===d?x=e[29]:(x=(0,t.jsxs)(R,{"data-testid":"download-static-notebook-dialog-button",variant:"outline",size:"sm",onClick:d,children:[N,"Download"]}),e[28]=d,e[29]=x);let a;e[30]!==c||e[31]!==x?(a=(0,t.jsxs)("div",{className:"flex gap-3 pt-2",children:[c,x]}),e[30]=c,e[31]=x,e[32]=a):a=e[32];let C;return e[33]!==k||e[34]!==a?(C=(0,t.jsxs)(be,{children:[w,(0,t.jsxs)(xe,{children:[k,a]})]}),e[33]=k,e[34]=a,e[35]=C):C=e[35],C},D=P(),Re=M()||E(),Ie=o=>{let e=(0,D.c)(9),s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(Ce,{}),e[0]=s):s=e[0];let r;e[1]===o.appConfig?r=e[2]:(r=(0,t.jsx)(ve,{appConfig:o.appConfig}),e[1]=o.appConfig,e[2]=r);let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p=Re&&(0,t.jsx)(Pe,{}),e[3]=p):p=e[3];let i;e[4]===r?i=e[5]:(i=(0,t.jsxs)(ye,{children:[s,r,p]}),e[4]=r,e[5]=i);let n;e[6]===Symbol.for("react.memo_cache_sentinel")?(n=(0,t.jsx)(K,{}),e[6]=n):n=e[6];let h;return e[7]===i?h=e[8]:(h=(0,t.jsx)(ae,{children:(0,t.jsxs)(ge,{direction:"horizontal",autoSaveId:"marimo:chrome:v1:run1",children:[i,n]})}),e[7]=i,e[8]=h),h},Pe=()=>{let o=(0,D.c)(1),e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("div",{className:"fixed bottom-0 right-0 z-50 print:hidden","data-testid":"watermark",children:(0,t.jsxs)("a",{href:z.githubPage,target:"_blank",className:"text-sm text-(--grass-11) font-bold tracking-wide transition-colors bg-(--grass-4) hover:bg-(--grass-5) border-t border-l border-(--grass-8) px-3 py-1 rounded-tl-md flex items-center gap-2",children:[(0,t.jsx)("span",{children:"made with marimo"}),(0,t.jsx)(_e,{className:"h-4 w-auto"})]})}),o[0]=e):e=o[0],e},Te=Ie;export{Te as default};
1
+ import{s as B}from"./chunk-LvLJmgfZ.js";import{u as I}from"./useEvent-D91BmmQi.js";import{t as L}from"./react-Bj1aDYRI.js";import{D as U,Si as $,g as W,x as F}from"./cells-CFd8A4_A.js";import"./react-dom-CSu739Rf.js";import{t as P}from"./compiler-runtime-B3qBwwSJ.js";import{x as H}from"./utils-CvI-39U6.js";import{n as z}from"./constants-DMpttj8Q.js";import{T as M,l as E,m as V}from"./config-DdDKNgb1.js";import{t as q}from"./cn-DCUzRj2J.js";import{t as G}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-eipL3i3Y.js";import"./popover-Bz_0Vkyf.js";import{B as J,w as K,wt as Q}from"./JsonOutput-B2v_Stn9.js";import{r as X}from"./download-BaGnGHOq.js";import{n as Y,t as R}from"./button-BbCh-29a.js";import"./dist-BrR4M-k3.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{r as Z}from"./requests-DIwGYs0l.js";import"./layout-KNg4OZ4V.js";import{c as ee}from"./state-DTislnZA.js";import"./markdown-renderer-B1eFOa7V.js";import{t as te}from"./copy-BwrPA9zQ.js";import{i as re,l as se,n as oe,r as O,t as ae,u as ie}from"./panels-ZYkk-m0X.js";import{t as ne}from"./spinner-Bhir8k53.js";import"./dist-CBSMxaO_.js";import"./dist-CpTFpfm_.js";import"./dist-B1U1kGCR.js";import"./dist-ChF5Ln9c.js";import"./dist-CPczQFlJ.js";import{t as le}from"./use-toast-IPAtJGea.js";import{t as me}from"./session-0B5NBztP.js";import"./purify.es-B9KxLTTS.js";import"./dates-CTxr0EqQ.js";import{n as ce}from"./copy-LK56fFow.js";import{a as de,c as pe,l as he,n as xe,r as fe,t as be}from"./dialog-DzC_QCtT.js";import{t as je}from"./share-DMwTZOTH.js";import"./utils-DCL4n9wx.js";import"./vega-loader.browser-C8wT63Va.js";import"./defaultLocale-BLUna9fQ.js";import"./defaultLocale-DzliDDTm.js";import{a as ue}from"./cell-link-CW22jH60.js";import"./chunk-5FQGJX7Z-D9iBG0F7.js";import"./html-to-image-CJxTFjQz.js";import{n as ge,t as ye}from"./react-resizable-panels.browser.esm-CV8-hvjx.js";import"./esm-CqWdmSnV.js";import"./name-cell-input-DdwASAQy.js";import{n as ke,t as _e}from"./marimo-icons-CiwvnnsT.js";import"./ws-BnE9sl8z.js";import"./dist-BQeNY9Zl.js";import"./dist-CXBpwk_w.js";import"./dist-DUHHizRG.js";import"./dist-D70Tz1Kr.js";import"./dist-BF6UNR6V.js";import"./dist-CsvFAFh9.js";import"./dist-DqVEVg0c.js";import"./dist-BlOtCkpT.js";import"./dist-C78V1LRz.js";import"./esm-DeiyaVAJ.js";var Ne=P(),we=B(L(),1),t=B(G(),1);const ve=o=>{let e=(0,Ne.c)(27),{appConfig:s}=o,{setCells:r}=U(),{sendComponentValues:p}=Z(),i;e[0]===p?i=e[1]:(i=()=>(O.INSTANCE.start(p),Se),e[0]=p,e[1]=i);let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=[],e[2]=n):n=e[2],(0,we.useEffect)(i,n);let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=me(),e[3]=h):h=e[3];let u;e[4]===r?u=e[5]:(u={autoInstantiate:!0,setCells:r,sessionId:h},e[4]=r,e[5]=u);let{connection:l,reconnect:w}=oe(u),f=I(F),g;e[6]===l.state?g=e[7]:(g=V(l.state),e[6]=l.state,e[7]=g);let v=g,b=I(W),y;e[8]!==s||e[9]!==b||e[10]!==v?(y=()=>v&&!b?(0,t.jsxs)(J,{milliseconds:2e3,fallback:null,children:[(0,t.jsx)(ne,{className:"mx-auto"}),(0,t.jsx)("p",{className:"text-center text-sm text-muted-foreground mt-2",children:"Connecting..."})]}):(0,t.jsx)(re,{appConfig:s,mode:"read"}),e[8]=s,e[9]=b,e[10]=v,e[11]=y):y=e[11];let j=y,m;e:{if(typeof window>"u"){m=null;break e}let x,a;if(e[12]===Symbol.for("react.memo_cache_sentinel")){if(a=new URL(window.location.href),!a.searchParams.has("file")){m=null;break e}a.searchParams.delete("file"),x=a.searchParams.toString(),e[12]=x,e[13]=a,e[14]=m}else x=e[12],a=e[13],m=e[14];let C=x;m=C?`${a.pathname}?${C}`:a.pathname}let k=m,S=s.width,_;e[15]===Symbol.for("react.memo_cache_sentinel")?(_=k&&(0,t.jsx)("div",{className:"flex items-center px-6 pt-4 sm:-mt-8",children:(0,t.jsxs)("a",{href:k,"aria-label":"Back to gallery",className:q(Y({variant:"text",size:"sm"}),"gap-2 px-0 text-muted-foreground hover:text-foreground"),children:[(0,t.jsx)(ee,{className:"size-4","aria-hidden":!0}),(0,t.jsx)("span",{children:"Back"})]})}),e[15]=_):_=e[15];let c;e[16]===l?c=e[17]:(c=(0,t.jsx)(ie,{connection:l,className:"sm:pt-8",children:_}),e[16]=l,e[17]=c);let d;e[18]===j?d=e[19]:(d=j(),e[18]=j,e[19]=d);let N;return e[20]!==s.width||e[21]!==l||e[22]!==f||e[23]!==w||e[24]!==c||e[25]!==d?(N=(0,t.jsxs)(se,{connection:l,isRunning:f,width:S,onReconnect:w,children:[c,d]}),e[20]=s.width,e[21]=l,e[22]=f,e[23]=w,e[24]=c,e[25]=d,e[26]=N):N=e[26],N};function Se(){O.INSTANCE.stop()}var A=P();const Ce=()=>{let o=(0,A.c)(3),e=I($);if(!E()||!e)return null;let s;o[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsxs)("span",{children:["Static"," ",(0,t.jsx)("a",{href:z.githubPage,target:"_blank",className:"text-(--sky-11) font-medium underline",children:"marimo"})," ","notebook - Run or edit for full interactivity"]}),o[0]=s):s=o[0];let r;return o[1]===e?r=o[2]:(r=(0,t.jsxs)("div",{className:"px-4 py-2 bg-(--sky-2) border-b border-(--sky-7) text-(--sky-11) flex justify-between items-center gap-4 print:hidden text-sm","data-testid":"static-notebook-banner",children:[s,(0,t.jsx)("span",{className:"shrink-0",children:(0,t.jsx)(ze,{code:e})})]}),o[1]=e,o[2]=r),r};var ze=o=>{var T;let e=(0,A.c)(36),{code:s}=o,r=ue()||"notebook.py",p=r.lastIndexOf("/");p!==-1&&(r=r.slice(p+1));let[i]=H(),n=((T=i.sharing)==null?void 0:T.molab)!==!1,h=window.location.href,u;e[0]===s?u=e[1]:(u=je({code:s,baseUrl:`${z.molab}/new`}),e[0]=s,e[1]=u);let l=u,w;e[2]===Symbol.for("react.memo_cache_sentinel")?(w=(0,t.jsx)(he,{asChild:!0,children:(0,t.jsx)(R,{"data-testid":"static-notebook-dialog-trigger",variant:"outline",size:"xs",children:"Run or Edit"})}),e[2]=w):w=e[2];let f;e[3]===r?f=e[4]:(f=(0,t.jsx)(pe,{children:r}),e[3]=r,e[4]=f);let g;e[5]===Symbol.for("react.memo_cache_sentinel")?(g=(0,t.jsxs)("p",{children:["This is a static"," ",(0,t.jsx)("a",{href:z.githubPage,target:"_blank",className:"text-(--sky-11) hover:underline font-medium",children:"marimo"})," ","notebook. To run interactively:"]}),e[5]=g):g=e[5];let v;e[6]===Symbol.for("react.memo_cache_sentinel")?(v=(0,t.jsx)("br",{}),e[6]=v):v=e[6];let b;e[7]===r?b=e[8]:(b=(0,t.jsx)("div",{className:"rounded-lg p-3 border bg-(--sky-2) border-(--sky-7)",children:(0,t.jsxs)("div",{className:"font-mono text-(--sky-11) leading-relaxed",children:["pip install marimo",v,"marimo edit ",r]})}),e[7]=r,e[8]=b);let y;e[9]===Symbol.for("react.memo_cache_sentinel")?(y=!h.endsWith(".html")&&(0,t.jsxs)("div",{className:"rounded-lg p-3 border bg-(--sky-2) border-(--sky-7)",children:[(0,t.jsx)("div",{className:"text-sm text-(--sky-12) mb-1",children:"Or run directly from URL:"}),(0,t.jsxs)("div",{className:"font-mono text-(--sky-11) break-all",children:["marimo edit ",window.location.href]})]}),e[9]=y):y=e[9];let j;e[10]!==n||e[11]!==l?(j=n&&(0,t.jsxs)("div",{className:"pt-3 border-t flex gap-2 items-center",children:[(0,t.jsx)(R,{asChild:!0,variant:"outline",size:"xs",className:"shrink-0",children:(0,t.jsxs)("a",{href:l,target:"_blank",rel:"noopener noreferrer",children:[(0,t.jsx)(ke,{size:12,strokeWidth:1.5,className:"mr-1.5 mt-px text-(--grass-11)"}),"Open in molab"]})}),(0,t.jsxs)("p",{className:"text-sm text-(--sky-12)",children:["Run this notebook in"," ",(0,t.jsx)("span",{className:"font-semibold",children:"molab"}),", marimo's cloud-hosted notebook platform."]})]}),e[10]=n,e[11]=l,e[12]=j):j=e[12];let m;e[13]!==b||e[14]!==j?(m=(0,t.jsxs)(fe,{className:"pt-3 text-left space-y-3",children:[g,b,y,j]}),e[13]=b,e[14]=j,e[15]=m):m=e[15];let k;e[16]!==f||e[17]!==m?(k=(0,t.jsxs)(de,{children:[f,m]}),e[16]=f,e[17]=m,e[18]=k):k=e[18];let S;e[19]===s?S=e[20]:(S=async()=>{await ce(s),le({title:"Copied to clipboard"})},e[19]=s,e[20]=S);let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=(0,t.jsx)(te,{className:"w-3 h-3 mr-2"}),e[21]=_):_=e[21];let c;e[22]===S?c=e[23]:(c=(0,t.jsxs)(R,{"data-testid":"copy-static-notebook-dialog-button",variant:"outline",size:"sm",onClick:S,children:[_,"Copy code"]}),e[22]=S,e[23]=c);let d;e[24]!==s||e[25]!==r?(d=()=>{X(new Blob([s],{type:"text/plain"}),r)},e[24]=s,e[25]=r,e[26]=d):d=e[26];let N;e[27]===Symbol.for("react.memo_cache_sentinel")?(N=(0,t.jsx)(Q,{className:"w-3 h-3 mr-2"}),e[27]=N):N=e[27];let x;e[28]===d?x=e[29]:(x=(0,t.jsxs)(R,{"data-testid":"download-static-notebook-dialog-button",variant:"outline",size:"sm",onClick:d,children:[N,"Download"]}),e[28]=d,e[29]=x);let a;e[30]!==c||e[31]!==x?(a=(0,t.jsxs)("div",{className:"flex gap-3 pt-2",children:[c,x]}),e[30]=c,e[31]=x,e[32]=a):a=e[32];let C;return e[33]!==k||e[34]!==a?(C=(0,t.jsxs)(be,{children:[w,(0,t.jsxs)(xe,{children:[k,a]})]}),e[33]=k,e[34]=a,e[35]=C):C=e[35],C},D=P(),Re=M()||E(),Ie=o=>{let e=(0,D.c)(9),s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(Ce,{}),e[0]=s):s=e[0];let r;e[1]===o.appConfig?r=e[2]:(r=(0,t.jsx)(ve,{appConfig:o.appConfig}),e[1]=o.appConfig,e[2]=r);let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p=Re&&(0,t.jsx)(Pe,{}),e[3]=p):p=e[3];let i;e[4]===r?i=e[5]:(i=(0,t.jsxs)(ye,{children:[s,r,p]}),e[4]=r,e[5]=i);let n;e[6]===Symbol.for("react.memo_cache_sentinel")?(n=(0,t.jsx)(K,{}),e[6]=n):n=e[6];let h;return e[7]===i?h=e[8]:(h=(0,t.jsx)(ae,{children:(0,t.jsxs)(ge,{direction:"horizontal",autoSaveId:"marimo:chrome:v1:run1",children:[i,n]})}),e[7]=i,e[8]=h),h},Pe=()=>{let o=(0,D.c)(1),e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("div",{className:"fixed bottom-0 right-0 z-50 print:hidden","data-testid":"watermark",children:(0,t.jsxs)("a",{href:z.githubPage,target:"_blank",className:"text-sm text-(--grass-11) font-bold tracking-wide transition-colors bg-(--grass-4) hover:bg-(--grass-5) border-t border-l border-(--grass-8) px-3 py-1 rounded-tl-md flex items-center gap-2",children:[(0,t.jsx)("span",{children:"made with marimo"}),(0,t.jsx)(_e,{className:"h-4 w-auto"})]})}),o[0]=e):e=o[0],e},Te=Ie;export{Te as default};
@@ -1 +1 @@
1
- import{s as ae}from"./chunk-LvLJmgfZ.js";import{d as be,l as ye,n as V,p as oe,u as we}from"./useEvent-D91BmmQi.js";import{t as Ne}from"./react-Bj1aDYRI.js";import{D as ke,Fn as ze,I as Ce,Ii as Se,Li as m,Oi as Oe,__tla as Ie}from"./cells-CFd8A4_A.js";import"./react-dom-CSu739Rf.js";import{t as se}from"./compiler-runtime-B3qBwwSJ.js";import{v as ie}from"./useEventListener-DvoEXWke.js";import{x as Ae}from"./utils-CvI-39U6.js";import{t as Le}from"./constants-DMpttj8Q.js";import{t as le}from"./cn-DCUzRj2J.js";import{t as Me}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-eipL3i3Y.js";import"./popover-Bz_0Vkyf.js";import{n as Pe,__tla as De}from"./JsonOutput-B2v_Stn9.js";import"./download-BaGnGHOq.js";import{t as z}from"./tooltip-DTV9tlSr.js";import{t as C}from"./button-BbCh-29a.js";import"./dist-BrR4M-k3.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{r as Ee}from"./requests-DIwGYs0l.js";import{t as ne}from"./createLucideIcon-D5guW7EU.js";import{f as Re,__tla as He}from"./layout-CfRdiox1.js";import{n as Ve,t as qe,__tla as Fe}from"./LazyAnyLanguageCodeMirror-BEvXb3VX.js";import{__tla as Te}from"./markdown-renderer-B1eFOa7V.js";import{u as Ge}from"./toDate-B5A0DFEz.js";import{t as Ue,__tla as Be}from"./cell-editor-BQRxBkmz.js";import{t as Je}from"./spinner-Bhir8k53.js";import{t as Ke}from"./play-C7DcCsoO.js";import"./dist-CBSMxaO_.js";import"./dist-CpTFpfm_.js";import"./dist-B1U1kGCR.js";import"./dist-ChF5Ln9c.js";import"./dist-CPczQFlJ.js";import"./session-0B5NBztP.js";import{r as Qe}from"./useTheme-CI2eq4XN.js";import"./purify.es-B9KxLTTS.js";import"./dates-CTxr0EqQ.js";import"./utils-DCL4n9wx.js";import"./vega-loader.browser-C8wT63Va.js";import"./defaultLocale-BLUna9fQ.js";import"./defaultLocale-DzliDDTm.js";import{__tla as We}from"./chunk-5FQGJX7Z-D9iBG0F7.js";import"./html-to-image-CJxTFjQz.js";import{o as Xe}from"./focus-DjmSWsDI.js";import{n as Ye,r as Ze,t as me}from"./react-resizable-panels.browser.esm-CV8-hvjx.js";import{a as $e}from"./renderShortcut-CcFk3m01.js";import"./esm-CqWdmSnV.js";import"./name-cell-input-DdwASAQy.js";import{n as et,r as tt}from"./panel-context-BJbBGfoL.js";import{__tla as rt}from"./loro_wasm_bg-CXnd80ne.js";import"./ws-BnE9sl8z.js";import"./Inputs-C6ftxLAJ.js";import"./dist-BQeNY9Zl.js";import"./dist-CXBpwk_w.js";import"./dist-DUHHizRG.js";import"./dist-D70Tz1Kr.js";import"./dist-BF6UNR6V.js";import"./dist-CsvFAFh9.js";import"./dist-DqVEVg0c.js";import"./dist-BlOtCkpT.js";import"./dist-C78V1LRz.js";import"./esm-DeiyaVAJ.js";import{t as at}from"./kiosk-mode-CtlXE_Xv.js";let ce,ot=Promise.all([(()=>{try{return Ie}catch{}})(),(()=>{try{return De}catch{}})(),(()=>{try{return He}catch{}})(),(()=>{try{return Fe}catch{}})(),(()=>{try{return Te}catch{}})(),(()=>{try{return Be}catch{}})(),(()=>{try{return We}catch{}})(),(()=>{try{return rt}catch{}})()]).then(async()=>{var de=ne("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),he=ne("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),pe=se(),q=ae(Ne(),1),ue=15;const F=Oe("marimo:scratchpadHistory:v1",[],ze),fe=oe(!1),xe=oe(null,(e,s,i)=>{if(i=i.trim(),!i)return;let n=e(F);s(F,[i,...n.filter(c=>c!==i)].slice(0,ue))});var t=ae(Me(),1),_e={hide_code:!1,disabled:!1};const ve=()=>{var re;let e=(0,pe.c)(60),s=Ce(),[i]=Ae(),{theme:n}=Qe(),c=(0,q.useRef)(null),T=Xe(),{createNewCell:G,updateCellCode:d}=ke(),{sendRunScratchpad:h}=Ee(),S=et(),U=tt(),l=s.cellRuntime[m],B=l==null?void 0:l.output,O=l==null?void 0:l.status,J=l==null?void 0:l.consoleOutputs,r=((re=s.cellData.__scratch__)==null?void 0:re.code)??"",K=be(xe),[o,p]=ye(fe),u=we(F),I;e[0]!==K||e[1]!==r||e[2]!==h?(I=()=>{h({code:r}),K(r)},e[0]=K,e[1]=r,e[2]=h,e[3]=I):I=e[3];let f=V(I),A;e[4]!==r||e[5]!==G||e[6]!==T?(A=()=>{r.trim()&&G({code:r,before:!1,cellId:T??"__end__"})},e[4]=r,e[5]=G,e[6]=T,e[7]=A):A=e[7];let Q=V(A),L;e[8]!==h||e[9]!==d?(L=()=>{d({cellId:m,code:"",formattingChange:!1}),h({code:""});let a=c.current;a&&a.dispatch({changes:{from:0,to:a.state.doc.length,insert:""}})},e[8]=h,e[9]=d,e[10]=L):L=e[10];let W=V(L),M;e[11]!==p||e[12]!==d?(M=a=>{p(!1),d({cellId:m,code:a,formattingChange:!1});let k=c.current;k&&k.dispatch({changes:{from:0,to:k.state.doc.length,insert:a}})},e[11]=p,e[12]=d,e[13]=M):M=e[13];let X=V(M),[Y,ge]=(0,q.useState)(),P;e[14]!==X||e[15]!==u||e[16]!==o||e[17]!==n?(P=()=>o?(0,t.jsx)("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:(0,t.jsx)("div",{className:"overflow-auto flex flex-col gap-3",children:u.map((a,k)=>(0,t.jsx)("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>X(a),children:(0,t.jsx)(q.Suspense,{children:(0,t.jsx)(qe,{language:"python",theme:n,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:a.trim(),editable:!1,readOnly:!0})})},k))})}):null,e[14]=X,e[15]=u,e[16]=o,e[17]=n,e[18]=P):P=e[18];let Z=P,D;e[19]!==W||e[20]!==Q||e[21]!==f||e[22]!==u.length||e[23]!==o||e[24]!==p||e[25]!==O?(D=()=>(0,t.jsxs)("div",{className:"flex items-center shrink-0 border-b",children:[(0,t.jsx)(z,{content:$e("cell.run"),children:(0,t.jsx)(C,{"data-testid":"scratchpad-run-button",onClick:f,disabled:o,variant:"text",size:"xs",children:(0,t.jsx)(Ke,{color:"var(--grass-11)",size:16})})}),(0,t.jsx)(z,{content:"Clear code and outputs",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:W,children:(0,t.jsx)(de,{size:16})})}),(0,t.jsx)(at,{children:(0,t.jsx)(z,{content:"Insert code",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:Q,children:(0,t.jsx)(Ve,{size:16})})})}),(O==="running"||O==="queued")&&(0,t.jsx)(Je,{className:"inline",size:"small"}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsx)(z,{content:"Toggle history",children:(0,t.jsx)(C,{size:"xs",variant:"text",className:le(o&&"bg-(--sky-3) rounded-none"),onClick:()=>p(!o),disabled:u.length===0,children:(0,t.jsx)(he,{size:16})})}),(0,t.jsx)(z,{content:(0,t.jsx)("span",{className:"block max-w-prose",children:"Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file."}),children:(0,t.jsx)(C,{size:"xs",variant:"text",children:(0,t.jsx)(Ge,{size:16})})})]}),e[19]=W,e[20]=Q,e[21]=f,e[22]=u.length,e[23]=o,e[24]=p,e[25]=O,e[26]=D):D=e[26];let $=D,je=S==="vertical",E;e[27]===Symbol.for("react.memo_cache_sentinel")?(E=Se.create(m),e[27]=E):E=e[27];let x;e[28]===$?x=e[29]:(x=$(),e[28]=$,e[29]=x);let R;e[30]===Symbol.for("react.memo_cache_sentinel")?(R=a=>{c.current=a},e[30]=R):R=e[30];let _;e[31]!==r||e[32]!==f||e[33]!==Y||e[34]!==n||e[35]!==i?(_=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Ue,{theme:n,showPlaceholder:!1,id:m,code:r,config:_e,status:"idle",serializedEditorState:null,runCell:f,userConfig:i,editorViewRef:c,setEditorView:R,hidden:!1,showHiddenCode:ie.NOOP,languageAdapter:Y,setLanguageAdapter:ge})}),e[31]=r,e[32]=f,e[33]=Y,e[34]=n,e[35]=i,e[36]=_):_=e[36];let v;e[37]===Z?v=e[38]:(v=Z(),e[37]=Z,e[38]=v);let g;e[39]!==v||e[40]!==x||e[41]!==_?(g=(0,t.jsx)(me,{defaultSize:40,minSize:20,maxSize:70,children:(0,t.jsxs)("div",{className:"h-full flex flex-col overflow-hidden relative",children:[x,_,v]})}),e[39]=v,e[40]=x,e[41]=_,e[42]=g):g=e[42];let ee=je?"h-1":"w-1",j;e[43]===ee?j=e[44]:(j=le("bg-border hover:bg-primary/50 transition-colors",ee),e[43]=ee,e[44]=j);let b;e[45]===j?b=e[46]:(b=(0,t.jsx)(Ze,{className:j}),e[45]=j,e[46]=b);let y;e[47]===B?y=e[48]:(y=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Pe,{allowExpand:!1,output:B,className:Le.outputArea,cellId:m,stale:!1,loading:!1})}),e[47]=B,e[48]=y);let w;e[49]===J?w=e[50]:(w=(0,t.jsx)("div",{className:"overflow-auto shrink-0 max-h-[50%]",children:(0,t.jsx)(Re,{consoleOutputs:J,className:"overflow-auto",stale:!1,interrupted:!1,cellName:"_",onSubmitDebugger:ie.NOOP,cellId:m,debuggerActive:!1})}),e[49]=J,e[50]=w);let N;e[51]!==y||e[52]!==w?(N=(0,t.jsx)(me,{defaultSize:60,minSize:20,children:(0,t.jsxs)("div",{className:"h-full flex flex-col divide-y overflow-hidden",children:[y,w]})}),e[51]=y,e[52]=w,e[53]=N):N=e[53];let H;return e[54]!==S||e[55]!==U||e[56]!==g||e[57]!==b||e[58]!==N?(H=(0,t.jsx)("div",{className:"flex flex-col h-full overflow-hidden",id:E,children:(0,t.jsxs)(Ye,{direction:S,className:"h-full",children:[g,b,N]},U)}),e[54]=S,e[55]=U,e[56]=g,e[57]=b,e[58]=N,e[59]=H):H=e[59],H};let te;te=se(),ce=()=>{let e=(0,te.c)(1),s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(ve,{}),e[0]=s):s=e[0],s}});export{ot as __tla,ce as default};
1
+ import{s as ae}from"./chunk-LvLJmgfZ.js";import{d as be,l as ye,n as V,p as oe,u as we}from"./useEvent-D91BmmQi.js";import{t as Ne}from"./react-Bj1aDYRI.js";import{D as ke,Fn as ze,I as Ce,Ii as Se,Li as m,Oi as Oe,__tla as Ie}from"./cells-CFd8A4_A.js";import"./react-dom-CSu739Rf.js";import{t as se}from"./compiler-runtime-B3qBwwSJ.js";import{v as ie}from"./useEventListener-DvoEXWke.js";import{x as Ae}from"./utils-CvI-39U6.js";import{t as Le}from"./constants-DMpttj8Q.js";import{t as le}from"./cn-DCUzRj2J.js";import{t as Me}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-eipL3i3Y.js";import"./popover-Bz_0Vkyf.js";import{n as Pe,__tla as De}from"./JsonOutput-B2v_Stn9.js";import"./download-BaGnGHOq.js";import{t as z}from"./tooltip-DTV9tlSr.js";import{t as C}from"./button-BbCh-29a.js";import"./dist-BrR4M-k3.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{r as Ee}from"./requests-DIwGYs0l.js";import{t as ne}from"./createLucideIcon-D5guW7EU.js";import{f as Re,__tla as He}from"./layout-KNg4OZ4V.js";import{n as Ve,t as qe,__tla as Fe}from"./LazyAnyLanguageCodeMirror-BEvXb3VX.js";import{__tla as Te}from"./markdown-renderer-B1eFOa7V.js";import{u as Ge}from"./toDate-B5A0DFEz.js";import{t as Ue,__tla as Be}from"./cell-editor-nGYckExu.js";import{t as Je}from"./spinner-Bhir8k53.js";import{t as Ke}from"./play-C7DcCsoO.js";import"./dist-CBSMxaO_.js";import"./dist-CpTFpfm_.js";import"./dist-B1U1kGCR.js";import"./dist-ChF5Ln9c.js";import"./dist-CPczQFlJ.js";import"./session-0B5NBztP.js";import{r as Qe}from"./useTheme-CI2eq4XN.js";import"./purify.es-B9KxLTTS.js";import"./dates-CTxr0EqQ.js";import"./utils-DCL4n9wx.js";import"./vega-loader.browser-C8wT63Va.js";import"./defaultLocale-BLUna9fQ.js";import"./defaultLocale-DzliDDTm.js";import{__tla as We}from"./chunk-5FQGJX7Z-D9iBG0F7.js";import"./html-to-image-CJxTFjQz.js";import{o as Xe}from"./focus-DjmSWsDI.js";import{n as Ye,r as Ze,t as me}from"./react-resizable-panels.browser.esm-CV8-hvjx.js";import{a as $e}from"./renderShortcut-CcFk3m01.js";import"./esm-CqWdmSnV.js";import"./name-cell-input-DdwASAQy.js";import{n as et,r as tt}from"./panel-context-BJbBGfoL.js";import{__tla as rt}from"./loro_wasm_bg-CXnd80ne.js";import"./ws-BnE9sl8z.js";import"./Inputs-C6ftxLAJ.js";import"./dist-BQeNY9Zl.js";import"./dist-CXBpwk_w.js";import"./dist-DUHHizRG.js";import"./dist-D70Tz1Kr.js";import"./dist-BF6UNR6V.js";import"./dist-CsvFAFh9.js";import"./dist-DqVEVg0c.js";import"./dist-BlOtCkpT.js";import"./dist-C78V1LRz.js";import"./esm-DeiyaVAJ.js";import{t as at}from"./kiosk-mode-CtlXE_Xv.js";let ce,ot=Promise.all([(()=>{try{return Ie}catch{}})(),(()=>{try{return De}catch{}})(),(()=>{try{return He}catch{}})(),(()=>{try{return Fe}catch{}})(),(()=>{try{return Te}catch{}})(),(()=>{try{return Be}catch{}})(),(()=>{try{return We}catch{}})(),(()=>{try{return rt}catch{}})()]).then(async()=>{var de=ne("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),he=ne("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),pe=se(),q=ae(Ne(),1),ue=15;const F=Oe("marimo:scratchpadHistory:v1",[],ze),fe=oe(!1),xe=oe(null,(e,s,i)=>{if(i=i.trim(),!i)return;let n=e(F);s(F,[i,...n.filter(c=>c!==i)].slice(0,ue))});var t=ae(Me(),1),_e={hide_code:!1,disabled:!1};const ve=()=>{var re;let e=(0,pe.c)(60),s=Ce(),[i]=Ae(),{theme:n}=Qe(),c=(0,q.useRef)(null),T=Xe(),{createNewCell:G,updateCellCode:d}=ke(),{sendRunScratchpad:h}=Ee(),S=et(),U=tt(),l=s.cellRuntime[m],B=l==null?void 0:l.output,O=l==null?void 0:l.status,J=l==null?void 0:l.consoleOutputs,r=((re=s.cellData.__scratch__)==null?void 0:re.code)??"",K=be(xe),[o,p]=ye(fe),u=we(F),I;e[0]!==K||e[1]!==r||e[2]!==h?(I=()=>{h({code:r}),K(r)},e[0]=K,e[1]=r,e[2]=h,e[3]=I):I=e[3];let f=V(I),A;e[4]!==r||e[5]!==G||e[6]!==T?(A=()=>{r.trim()&&G({code:r,before:!1,cellId:T??"__end__"})},e[4]=r,e[5]=G,e[6]=T,e[7]=A):A=e[7];let Q=V(A),L;e[8]!==h||e[9]!==d?(L=()=>{d({cellId:m,code:"",formattingChange:!1}),h({code:""});let a=c.current;a&&a.dispatch({changes:{from:0,to:a.state.doc.length,insert:""}})},e[8]=h,e[9]=d,e[10]=L):L=e[10];let W=V(L),M;e[11]!==p||e[12]!==d?(M=a=>{p(!1),d({cellId:m,code:a,formattingChange:!1});let k=c.current;k&&k.dispatch({changes:{from:0,to:k.state.doc.length,insert:a}})},e[11]=p,e[12]=d,e[13]=M):M=e[13];let X=V(M),[Y,ge]=(0,q.useState)(),P;e[14]!==X||e[15]!==u||e[16]!==o||e[17]!==n?(P=()=>o?(0,t.jsx)("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:(0,t.jsx)("div",{className:"overflow-auto flex flex-col gap-3",children:u.map((a,k)=>(0,t.jsx)("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>X(a),children:(0,t.jsx)(q.Suspense,{children:(0,t.jsx)(qe,{language:"python",theme:n,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:a.trim(),editable:!1,readOnly:!0})})},k))})}):null,e[14]=X,e[15]=u,e[16]=o,e[17]=n,e[18]=P):P=e[18];let Z=P,D;e[19]!==W||e[20]!==Q||e[21]!==f||e[22]!==u.length||e[23]!==o||e[24]!==p||e[25]!==O?(D=()=>(0,t.jsxs)("div",{className:"flex items-center shrink-0 border-b",children:[(0,t.jsx)(z,{content:$e("cell.run"),children:(0,t.jsx)(C,{"data-testid":"scratchpad-run-button",onClick:f,disabled:o,variant:"text",size:"xs",children:(0,t.jsx)(Ke,{color:"var(--grass-11)",size:16})})}),(0,t.jsx)(z,{content:"Clear code and outputs",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:W,children:(0,t.jsx)(de,{size:16})})}),(0,t.jsx)(at,{children:(0,t.jsx)(z,{content:"Insert code",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:Q,children:(0,t.jsx)(Ve,{size:16})})})}),(O==="running"||O==="queued")&&(0,t.jsx)(Je,{className:"inline",size:"small"}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsx)(z,{content:"Toggle history",children:(0,t.jsx)(C,{size:"xs",variant:"text",className:le(o&&"bg-(--sky-3) rounded-none"),onClick:()=>p(!o),disabled:u.length===0,children:(0,t.jsx)(he,{size:16})})}),(0,t.jsx)(z,{content:(0,t.jsx)("span",{className:"block max-w-prose",children:"Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file."}),children:(0,t.jsx)(C,{size:"xs",variant:"text",children:(0,t.jsx)(Ge,{size:16})})})]}),e[19]=W,e[20]=Q,e[21]=f,e[22]=u.length,e[23]=o,e[24]=p,e[25]=O,e[26]=D):D=e[26];let $=D,je=S==="vertical",E;e[27]===Symbol.for("react.memo_cache_sentinel")?(E=Se.create(m),e[27]=E):E=e[27];let x;e[28]===$?x=e[29]:(x=$(),e[28]=$,e[29]=x);let R;e[30]===Symbol.for("react.memo_cache_sentinel")?(R=a=>{c.current=a},e[30]=R):R=e[30];let _;e[31]!==r||e[32]!==f||e[33]!==Y||e[34]!==n||e[35]!==i?(_=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Ue,{theme:n,showPlaceholder:!1,id:m,code:r,config:_e,status:"idle",serializedEditorState:null,runCell:f,userConfig:i,editorViewRef:c,setEditorView:R,hidden:!1,showHiddenCode:ie.NOOP,languageAdapter:Y,setLanguageAdapter:ge})}),e[31]=r,e[32]=f,e[33]=Y,e[34]=n,e[35]=i,e[36]=_):_=e[36];let v;e[37]===Z?v=e[38]:(v=Z(),e[37]=Z,e[38]=v);let g;e[39]!==v||e[40]!==x||e[41]!==_?(g=(0,t.jsx)(me,{defaultSize:40,minSize:20,maxSize:70,children:(0,t.jsxs)("div",{className:"h-full flex flex-col overflow-hidden relative",children:[x,_,v]})}),e[39]=v,e[40]=x,e[41]=_,e[42]=g):g=e[42];let ee=je?"h-1":"w-1",j;e[43]===ee?j=e[44]:(j=le("bg-border hover:bg-primary/50 transition-colors",ee),e[43]=ee,e[44]=j);let b;e[45]===j?b=e[46]:(b=(0,t.jsx)(Ze,{className:j}),e[45]=j,e[46]=b);let y;e[47]===B?y=e[48]:(y=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Pe,{allowExpand:!1,output:B,className:Le.outputArea,cellId:m,stale:!1,loading:!1})}),e[47]=B,e[48]=y);let w;e[49]===J?w=e[50]:(w=(0,t.jsx)("div",{className:"overflow-auto shrink-0 max-h-[50%]",children:(0,t.jsx)(Re,{consoleOutputs:J,className:"overflow-auto",stale:!1,interrupted:!1,cellName:"_",onSubmitDebugger:ie.NOOP,cellId:m,debuggerActive:!1})}),e[49]=J,e[50]=w);let N;e[51]!==y||e[52]!==w?(N=(0,t.jsx)(me,{defaultSize:60,minSize:20,children:(0,t.jsxs)("div",{className:"h-full flex flex-col divide-y overflow-hidden",children:[y,w]})}),e[51]=y,e[52]=w,e[53]=N):N=e[53];let H;return e[54]!==S||e[55]!==U||e[56]!==g||e[57]!==b||e[58]!==N?(H=(0,t.jsx)("div",{className:"flex flex-col h-full overflow-hidden",id:E,children:(0,t.jsxs)(Ye,{direction:S,className:"h-full",children:[g,b,N]},U)}),e[54]=S,e[55]=U,e[56]=g,e[57]=b,e[58]=N,e[59]=H):H=e[59],H};let te;te=se(),ce=()=>{let e=(0,te.c)(1),s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(ve,{}),e[0]=s):s=e[0],s}});export{ot as __tla,ce as default};
@@ -1 +1 @@
1
- import{s as ve}from"./chunk-LvLJmgfZ.js";import{d as L,l as at,p as ot,u as Z}from"./useEvent-D91BmmQi.js";import{t as nt}from"./react-Bj1aDYRI.js";import{D as Ce,Dn as it,Dr as st,E as lt,Ii as me,Mn as rt,On as dt,Sr as ct,Yr as ht,Zt as pt,_ as mt,_r as ut,ct as ft,h as ze,kn as bt,st as yt,t as kt,ut as We,yr as xt}from"./cells-CFd8A4_A.js";import{t as P}from"./compiler-runtime-B3qBwwSJ.js";import{n as wt,x as gt}from"./ai-model-dropdown-BToySVta.js";import{_ as T,d as Me}from"./useEventListener-DvoEXWke.js";import{x as jt}from"./utils-CvI-39U6.js";import{n as C,t as De}from"./constants-DMpttj8Q.js";import{T as Q,v as vt,w as Ct}from"./config-DdDKNgb1.js";import{t as zt}from"./jsx-runtime-BqBOg78p.js";import{o as Wt}from"./alert-dialog-BqFLkbUc.js";import{a as Mt,c as Dt,i as _t,n as St,r as At,s as Pt,t as Nt}from"./select-DZcFyKFQ.js";import{wt as It}from"./JsonOutput-B2v_Stn9.js";import{c as _e,d as ue,h as Et,n as Lt,o as Tt,r as fe,t as Ht}from"./download-BaGnGHOq.js";import{t as Rt}from"./tooltip-DTV9tlSr.js";import{r as qt,t as be}from"./button-BbCh-29a.js";import{i as Ft,t as Se}from"./strings-wdPMRf6Z.js";import{r as H}from"./requests-DIwGYs0l.js";import{t as h}from"./createLucideIcon-D5guW7EU.js";import{F as Ot,I as Yt,L as Ae,P as Bt,R as Vt,a as Pe,i as Ne,u as Ie}from"./layout-CfRdiox1.js";import{t as Ee}from"./check-BH35Ndha.js";import{r as $t}from"./useCellActionButton-CXkISThQ.js";import{t as Kt}from"./copy-BwrPA9zQ.js";import{t as Ut}from"./external-link-BTNxSavU.js";import{t as X}from"./file-BrdxGLRX.js";import{t as Gt}from"./github-BKS_2Qwn.js";import{u as Jt}from"./form-PMq9H-I_.js";import{n as Zt,r as Qt,t as Xt}from"./youtube-CbdpN8oL.js";import{i as ea,n as Le}from"./add-connection-dialog-C6y-WHQz.js";import{t as ta}from"./house-mGK3v0Mm.js";import{t as aa}from"./image-DQHXdEQn.js";import{t as oa}from"./link-CfEtM3Rl.js";import{r as na}from"./input-C3Hrdlqq.js";import{t as ia}from"./settings-DfFe0dWD.js";import{t as sa}from"./sparkles-lWUAsPhp.js";import{y as la}from"./textarea-DQ0XiNGe.js";import{t as ra}from"./square-B5xWCt0a.js";import{t as z}from"./use-toast-IPAtJGea.js";import{n as Te,t as da}from"./paths-D5zczhUD.js";import{o as ca}from"./session-0B5NBztP.js";import{n as ee}from"./copy-LK56fFow.js";import{r as ha}from"./useRunCells-DQDFDt2R.js";import{a as pa,c as ma,i as ua,n as fa,r as ba}from"./dialog-DzC_QCtT.js";import{n as ye}from"./ImperativeModal-B3Th7k4R.js";import{r as ya,t as He}from"./share-DMwTZOTH.js";import{a as ka}from"./cell-link-CW22jH60.js";import{a as xa}from"./renderShortcut-CcFk3m01.js";import{t as wa}from"./icons-Ol38nIbL.js";import{t as ga}from"./pair-with-agent-modal-D8eOWIWE.js";import{n as Re}from"./marimo-icons-CiwvnnsT.js";import{t as ja}from"./links-1rtF1-eC.js";import{r as va,t as qe}from"./hooks-h3Z7JHnR.js";import{t as Fe}from"./types-a-yURniQ.js";var Ca=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),za=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Oe=h("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),Ye=h("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),Be=h("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),Wa=h("fast-forward",[["path",{d:"M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z",key:"b19h5q"}],["path",{d:"M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z",key:"h7h5ge"}]]),Ma=h("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]),Da=h("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),_a=h("notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]),Sa=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Ve=h("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),Aa=h("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),Pa=h("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),$e=h("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),Ke=P(),ke=ve(nt(),1),a=ve(zt(),1),te="https://static.marimo.app";const Na=e=>{let t=(0,Ke.c)(25),{onClose:n}=e,[o,s]=(0,ke.useState)(""),{exportAsHTML:r}=H(),l=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${te}/static/${l}`,d;t[0]!==r||t[1]!==n||t[2]!==l?(d=async v=>{v.preventDefault(),n();let I=await r({download:!1,includeCode:!0,files:Bt.INSTANCE.filenames()}),W=z({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${te}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:I,path:l})}).catch(()=>{W.dismiss(),z({title:"Error uploading static page",description:(0,a.jsxs)("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",(0,a.jsx)("a",{href:C.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),W.dismiss(),z({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},t[0]=r,t[1]=n,t[2]=l,t[3]=d):d=t[3];let m;t[4]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(ma,{children:"Share static notebook"}),t[4]=m):m=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(pa,{children:[m,(0,a.jsxs)(ba,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",(0,a.jsx)("a",{href:te,target:"_blank",children:te}),"."]})]}),t[5]=w):w=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{s(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let u;t[7]===o?u=t[8]:(u=(0,a.jsx)(na,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=u);let f;t[9]===i?f=t[10]:(f=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(Ia,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),t[9]=i,t[10]=f);let b;t[11]!==u||t[12]!==f?(b=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[u,f]}),t[11]=u,t[12]=f,t[13]=b):b=t[13];let y;t[14]===n?y=t[15]:(y=(0,a.jsx)(be,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=y);let k;t[16]===i?k=t[17]:(k=(0,a.jsx)(be,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await ee(i)},children:"Create"}),t[16]=i,t[17]=k);let x;t[18]!==y||t[19]!==k?(x=(0,a.jsxs)(ua,{children:[y,k]}),t[18]=y,t[19]=k,t[20]=x):x=t[20];let j;return t[21]!==d||t[22]!==x||t[23]!==b?(j=(0,a.jsx)(fa,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[w,b,x]})}),t[21]=d,t[22]=x,t[23]=b,t[24]=j):j=t[24],j};var Ia=e=>{let t=(0,Ke.c)(8),[n,o]=ke.useState(!1),s;t[0]===e.text?s=t[1]:(s=qt.stopPropagation(async m=>{m.preventDefault(),await ee(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=s);let r=s,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(Kt,{size:14,strokeWidth:1.5}),t[2]=l):l=t[2];let i;t[3]===r?i=t[4]:(i=(0,a.jsx)(be,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:l}),t[3]=r,t[4]=i);let d;return t[5]!==n||t[6]!==i?(d=(0,a.jsx)(Rt,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=d):d=t[7],d},Ea=P();function La(){let e=document.getElementsByClassName(De.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=me.findElement(t);if(!o){T.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:me.parse(o.id)}}}return T.warn("No visible output area found for scroll anchor"),null}function Ta(e){if(!e){T.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(me.create(e.cellId));if(!t){T.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${De.outputArea}`)){T.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ue(){let e=(0,Ea.c)(2),t=L(We),n;return e[0]===t?n=e[1]:(n=()=>{let o=La();t(s=>({mode:ft(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Ta(o)})})},e[0]=t,e[1]=n),n}const Ge=ot(!1);var Ha=P();const Ra=()=>{let e=(0,Ha.c)(7),{selectedLayout:t}=Pe(),{setLayoutView:n}=Ne();if(Q()&&!rt("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=i=>n(i),e[0]=n,e[1]=o);let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Pt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Dt,{placeholder:"Select a view"})}),e[2]=s):s=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(St,{children:(0,a.jsxs)(At,{children:[(0,a.jsx)(Mt,{children:"View as"}),Fe.map(Fa)]})}),e[3]=r):r=e[3];let l;return e[4]!==t||e[5]!==o?(l=(0,a.jsxs)(Nt,{"data-testid":"layout-select",value:t,onValueChange:o,children:[s,r]}),e[4]=t,e[5]=o,e[6]=l):l=e[6],l};function qa(e){return(0,a.jsx)(Je(e),{className:"h-4 w-4"})}function Je(e){switch(e){case"vertical":return Da;case"grid":return Qt;case"slides":return Ve;default:return Ft(e),ra}}function Ze(e){return Se.startCase(e)}function Fa(e){return(0,a.jsx)(_t,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[qa(e),(0,a.jsx)("span",{children:Ze(e)})]})},e)}async function Oa(e){let{filename:t,preset:n,downloadPDF:o}=e;await o({filename:t,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var Ya=P();function Ba(e){let t=(0,Ya.c)(5),{openPrompt:n,closeModal:o}=ye(),{sendCopy:s}=H(),r;return t[0]!==o||t[1]!==n||t[2]!==s||t[3]!==e?(r=()=>{if(!e)return null;let l=da.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Te.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=l.join(Te.dirname(e),i);s({source:e,destination:d}).then(()=>{o(),z({title:"Notebook copied",description:"A copy of the notebook has been created."}),ja(d)})}})},t[0]=o,t[1]=n,t[2]=s,t[3]=e,t[4]=r):r=t[4],r}const Va=()=>{let{updateCellConfig:e}=Ce(),{saveCellConfig:t}=H();return(0,ke.useCallback)(async()=>{let n=new pt,o=ze(),s=o.cellIds.inOrderIds,r={};for(let i of s){if(o.cellData[i]===void 0)continue;let{code:d,config:m}=o.cellData[i];m.hide_code||n.isSupported(d)&&(r[i]={hide_code:!0})}let l=Me.entries(r);if(l.length!==0){await t({configs:r});for(let[i,d]of l)e({cellId:i,config:d})}},[e])};var $a=P();function Qe(){let e=(0,$a.c)(4),{openConfirm:t}=ye(),n=L(vt),{sendRestart:o}=H(),s;return e[0]!==t||e[1]!==o||e[2]!==n?(s=()=>{t({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(Wt,{onClick:async()=>{n({state:Ct.CLOSING}),await o(),ya()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=s):s=e[3],s}var Ka=P(),N=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Ua(){var we,ge,je;let e=(0,Ka.c)(53),t=ka(),{openModal:n,closeModal:o}=ye(),{toggleApplication:s}=it(),{selectedPanel:r}=dt(),[l]=at(We),i=Z(yt),d=Va(),[m]=jt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:u,addSetupCellIfDoesntExist:f,collapseAllCells:b,expandAllCells:y}=Ce(),k=Qe(),x=ha(),j=Ba(t),v=L(Ge),I=L(wt),W=L(gt),{exportAsIPYNB:oe,exportAsMarkdown:ne,readCode:M,saveCellConfig:ie,updateCellOutputs:D}=H(),_=va(),se=Z(mt),le=Z(kt),re=Z(lt),{selectedLayout:R}=Pe(),{setLayoutView:de}=Ne(),q=Ue(),F=((we=m.sharing)==null?void 0:we.html)??!0,O=((ge=m.sharing)==null?void 0:ge.wasm)??!0,Y=((je=m.sharing)==null?void 0:je.molab)??!0,xe=!Q(),ce=R==="slides",Xe=mo,et=po,B;e[0]!==t||e[1]!==_||e[2]!==D?(B=async c=>{let{preset:p,title:E}=c;if(!t){ae();return}await _e(E,async pe=>{await qe({takeScreenshots:()=>_({progress:pe}),updateCellOutputs:D}),await Oa({filename:t,preset:p,downloadPDF:Lt})})},e[0]=t,e[1]=_,e[2]=D,e[3]=B):B=e[3];let S=B,V;e[4]===S?V=e[5]:(V=async()=>{if(xe){await S({preset:"document",title:"Downloading Document PDF..."});return}let c=new Event("export-beforeprint"),p=new Event("export-afterprint");window.dispatchEvent(c),setTimeout(ho,0),setTimeout(()=>window.dispatchEvent(p),0)},e[4]=S,e[5]=V);let $=V,K;e[6]!==oe||e[7]!==t||e[8]!==_||e[9]!==D?(K=async()=>{if(!t){ae();return}await _e("Downloading IPYNB...",async c=>{await qe({takeScreenshots:()=>_({progress:c}),updateCellOutputs:D});let p=await oe({download:!1});fe(new Blob([p],{type:"application/x-ipynb+json"}),ue.toIPYNB(document.title))})},e[6]=oe,e[7]=t,e[8]=_,e[9]=D,e[10]=K):K=e[10];let he=K,U;e[11]===Symbol.for("react.memo_cache_sentinel")?(U=(0,a.jsx)(It,{size:14,strokeWidth:1.5}),e[11]=U):U=e[11];let G;e[12]===Symbol.for("react.memo_cache_sentinel")?(G=(0,a.jsx)(Ae,{size:14,strokeWidth:1.5}),e[12]=G):G=e[12];let A;e[13]===t?A=e[14]:(A=async()=>{if(!t){ae();return}await Ie({filename:t,includeCode:!0})},e[13]=t,e[14]=A);let J;return e[15]!==f||e[16]!==le||e[17]!==u||e[18]!==o||e[19]!==b||e[20]!==j||e[21]!==S||e[22]!==y||e[23]!==ne||e[24]!==t||e[25]!==$||e[26]!==he||e[27]!==se||e[28]!==d||e[29]!==ce||e[30]!==i||e[31]!==n||e[32]!==M||e[33]!==k||e[34]!==x||e[35]!==ie||e[36]!==R||e[37]!==r||e[38]!==v||e[39]!==W||e[40]!==de||e[41]!==I||e[42]!==F||e[43]!==Y||e[44]!==O||e[45]!==A||e[46]!==s||e[47]!==q||e[48]!==g||e[49]!==re||e[50]!==w||e[51]!==l.mode?(J=[{icon:U,label:"Download",handle:N,dropdown:[{icon:G,label:"Download as HTML",handle:A},{icon:(0,a.jsx)(Ae,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){ae();return}await Ie({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(wa,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await ne({download:!1});fe(new Blob([c],{type:"text/plain"}),ue.toMarkdown(document.title))}},{icon:(0,a.jsx)(_a,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:he},{icon:(0,a.jsx)(Vt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await M();fe(new Blob([c.contents],{type:"text/plain"}),ue.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(aa,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:l.mode!=="present",tooltip:l.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",xa("global.hideCode",!1)]}),handle:co},ce?{divider:!0,icon:(0,a.jsx)(X,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:N,dropdown:[{icon:(0,a.jsx)(X,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:$},{icon:(0,a.jsx)(X,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:et(!0),hidden:!xe,handle:async()=>{await S({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(X,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:$}]},{icon:(0,a.jsx)(sa,{size:14,strokeWidth:1.5}),label:"Pair with an agent",hidden:Q(),handle:async()=>{n((0,a.jsx)(ga,{onClose:o}))}},{icon:(0,a.jsx)(Aa,{size:14,strokeWidth:1.5}),label:"Share",handle:N,hidden:!F&&!O&&!Y,dropdown:[{icon:(0,a.jsx)(Jt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!F,handle:async()=>{n((0,a.jsx)(Na,{onClose:o}))}},{icon:(0,a.jsx)(oa,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!O,handle:async()=>{await ee(He({code:(await M()).contents})),z({title:"Copied",description:"Link copied to clipboard."})}},{icon:(0,a.jsx)(Re,{size:14,strokeWidth:1.5}),label:"Create molab notebook",hidden:!Y,handle:async()=>{let c=He({code:(await M()).contents,baseUrl:`${C.molab}/new`});window.open(c,"_blank")}}]},{icon:(0,a.jsx)(Sa,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:N,dropdown:bt.flatMap(c=>{let{type:p,Icon:E,hidden:pe,additionalKeywords:tt}=c;return pe?[]:{label:Se.startCase(p),rightElement:Xe(r===p),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),handle:()=>s(p),additionalKeywords:tt}})},{icon:(0,a.jsx)(Ve,{size:14,strokeWidth:1.5}),label:"Present as",handle:N,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(la,{size:14,strokeWidth:1.5}):(0,a.jsx)(Ot,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{q()}},...Fe.map((c,p)=>{let E=Je(c);return{divider:p===0,label:Ze(c),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:R===c&&(0,a.jsx)(Ee,{size:14})}),handle:()=>{de(c),l.mode==="edit"&&q()}}})]},{icon:(0,a.jsx)(Ma,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||Q(),handle:j},{icon:(0,a.jsx)(Oe,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await ee((await M()).contents),z({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)($t,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!se||i,handle:async()=>{let c=ht(ze());await ie({configs:Me.fromEntries(c.map(ro))});for(let p of c)w({cellId:p,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Be,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{f({})}},{icon:(0,a.jsx)(xt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(Le,{onClose:o}))}},{icon:(0,a.jsx)(ea,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(Le,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)($e,{size:14,strokeWidth:1.5}),label:re,hidden:!le||i,handle:()=>{g()}},{icon:(0,a.jsx)(Pa,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:k,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Wa,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{x()}},{icon:(0,a.jsx)(ct,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{u()}},{icon:(0,a.jsx)(Et,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(za,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:b,redundant:!0},{icon:(0,a.jsx)(Ca,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:y,redundant:!0},{divider:!0,icon:(0,a.jsx)(Ye,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(lo)},{icon:(0,a.jsx)(Yt,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>W(so)},{icon:(0,a.jsx)(ia,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>I(io),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(Ut,{size:14,strokeWidth:1.5}),label:"Resources",handle:N,dropdown:[{icon:(0,a.jsx)(st,{size:14,strokeWidth:1.5}),label:"Documentation",handle:no},{icon:(0,a.jsx)(Gt,{size:14,strokeWidth:1.5}),label:"GitHub",handle:oo},{icon:(0,a.jsx)(Zt,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:ao},{icon:(0,a.jsx)(Xt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:to},{icon:(0,a.jsx)(ut,{size:14,strokeWidth:1.5}),label:"Changelog",handle:eo}]},{divider:!0,icon:(0,a.jsx)(ta,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Xa},{icon:(0,a.jsx)(Re,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Qa}].filter(Za).map(Ga),e[15]=f,e[16]=le,e[17]=u,e[18]=o,e[19]=b,e[20]=j,e[21]=S,e[22]=y,e[23]=ne,e[24]=t,e[25]=$,e[26]=he,e[27]=se,e[28]=d,e[29]=ce,e[30]=i,e[31]=n,e[32]=M,e[33]=k,e[34]=x,e[35]=ie,e[36]=R,e[37]=r,e[38]=v,e[39]=W,e[40]=de,e[41]=I,e[42]=F,e[43]=Y,e[44]=O,e[45]=A,e[46]=s,e[47]=q,e[48]=g,e[49]=re,e[50]=w,e[51]=l.mode,e[52]=J):J=e[52],J}function Ga(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Ja)}:e}function Ja(e){return!e.hidden}function Za(e){return!e.hidden}function Qa(){let e=ca();window.open(e,"_blank")}function Xa(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function eo(){window.open(C.releasesPage,"_blank")}function to(){window.open(C.youtube,"_blank")}function ao(){window.open(C.discordLink,"_blank")}function oo(){window.open(C.githubPage,"_blank")}function no(){window.open(C.docsPage,"_blank")}function io(e){return!e}function so(e){return!e}function lo(e){return!e}function ro(e){return[e,{disabled:!1}]}async function co(){let e=document.getElementById("App");e&&await Tt({element:e,filename:document.title,prepare:Ht})}function ho(){return window.print()}function po(e){return e?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function mo(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(Ee,{size:14})})}function ae(){z({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{Ue as a,Ye as c,Ge as i,Oe as l,Qe as n,$e as o,Ra as r,Be as s,Ua as t};
1
+ import{s as ve}from"./chunk-LvLJmgfZ.js";import{d as L,l as at,p as ot,u as Z}from"./useEvent-D91BmmQi.js";import{t as nt}from"./react-Bj1aDYRI.js";import{D as Ce,Dn as it,Dr as st,E as lt,Ii as me,Mn as rt,On as dt,Sr as ct,Yr as ht,Zt as pt,_ as mt,_r as ut,ct as ft,h as ze,kn as bt,st as yt,t as kt,ut as We,yr as xt}from"./cells-CFd8A4_A.js";import{t as P}from"./compiler-runtime-B3qBwwSJ.js";import{n as wt,x as gt}from"./ai-model-dropdown-BToySVta.js";import{_ as T,d as Me}from"./useEventListener-DvoEXWke.js";import{x as jt}from"./utils-CvI-39U6.js";import{n as C,t as De}from"./constants-DMpttj8Q.js";import{T as Q,v as vt,w as Ct}from"./config-DdDKNgb1.js";import{t as zt}from"./jsx-runtime-BqBOg78p.js";import{o as Wt}from"./alert-dialog-BqFLkbUc.js";import{a as Mt,c as Dt,i as _t,n as St,r as At,s as Pt,t as Nt}from"./select-DZcFyKFQ.js";import{wt as It}from"./JsonOutput-B2v_Stn9.js";import{c as _e,d as ue,h as Et,n as Lt,o as Tt,r as fe,t as Ht}from"./download-BaGnGHOq.js";import{t as Rt}from"./tooltip-DTV9tlSr.js";import{r as qt,t as be}from"./button-BbCh-29a.js";import{i as Ft,t as Se}from"./strings-wdPMRf6Z.js";import{r as H}from"./requests-DIwGYs0l.js";import{t as h}from"./createLucideIcon-D5guW7EU.js";import{F as Ot,I as Yt,L as Ae,P as Bt,R as Vt,a as Pe,i as Ne,u as Ie}from"./layout-KNg4OZ4V.js";import{t as Ee}from"./check-BH35Ndha.js";import{r as $t}from"./useCellActionButton-CXkISThQ.js";import{t as Kt}from"./copy-BwrPA9zQ.js";import{t as Ut}from"./external-link-BTNxSavU.js";import{t as X}from"./file-BrdxGLRX.js";import{t as Gt}from"./github-BKS_2Qwn.js";import{u as Jt}from"./form-PMq9H-I_.js";import{n as Zt,r as Qt,t as Xt}from"./youtube-CbdpN8oL.js";import{i as ea,n as Le}from"./add-connection-dialog-C6y-WHQz.js";import{t as ta}from"./house-mGK3v0Mm.js";import{t as aa}from"./image-DQHXdEQn.js";import{t as oa}from"./link-CfEtM3Rl.js";import{r as na}from"./input-C3Hrdlqq.js";import{t as ia}from"./settings-DfFe0dWD.js";import{t as sa}from"./sparkles-lWUAsPhp.js";import{y as la}from"./textarea-DQ0XiNGe.js";import{t as ra}from"./square-B5xWCt0a.js";import{t as z}from"./use-toast-IPAtJGea.js";import{n as Te,t as da}from"./paths-D5zczhUD.js";import{o as ca}from"./session-0B5NBztP.js";import{n as ee}from"./copy-LK56fFow.js";import{r as ha}from"./useRunCells-DQDFDt2R.js";import{a as pa,c as ma,i as ua,n as fa,r as ba}from"./dialog-DzC_QCtT.js";import{n as ye}from"./ImperativeModal-B3Th7k4R.js";import{r as ya,t as He}from"./share-DMwTZOTH.js";import{a as ka}from"./cell-link-CW22jH60.js";import{a as xa}from"./renderShortcut-CcFk3m01.js";import{t as wa}from"./icons-Ol38nIbL.js";import{t as ga}from"./pair-with-agent-modal-D8eOWIWE.js";import{n as Re}from"./marimo-icons-CiwvnnsT.js";import{t as ja}from"./links-1rtF1-eC.js";import{r as va,t as qe}from"./hooks-BfsdgkfD.js";import{t as Fe}from"./types-a-yURniQ.js";var Ca=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),za=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Oe=h("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),Ye=h("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),Be=h("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),Wa=h("fast-forward",[["path",{d:"M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z",key:"b19h5q"}],["path",{d:"M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z",key:"h7h5ge"}]]),Ma=h("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]),Da=h("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),_a=h("notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]),Sa=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Ve=h("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),Aa=h("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),Pa=h("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),$e=h("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),Ke=P(),ke=ve(nt(),1),a=ve(zt(),1),te="https://static.marimo.app";const Na=e=>{let t=(0,Ke.c)(25),{onClose:n}=e,[o,s]=(0,ke.useState)(""),{exportAsHTML:r}=H(),l=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${te}/static/${l}`,d;t[0]!==r||t[1]!==n||t[2]!==l?(d=async v=>{v.preventDefault(),n();let I=await r({download:!1,includeCode:!0,files:Bt.INSTANCE.filenames()}),W=z({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${te}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:I,path:l})}).catch(()=>{W.dismiss(),z({title:"Error uploading static page",description:(0,a.jsxs)("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",(0,a.jsx)("a",{href:C.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),W.dismiss(),z({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},t[0]=r,t[1]=n,t[2]=l,t[3]=d):d=t[3];let m;t[4]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(ma,{children:"Share static notebook"}),t[4]=m):m=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(pa,{children:[m,(0,a.jsxs)(ba,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",(0,a.jsx)("a",{href:te,target:"_blank",children:te}),"."]})]}),t[5]=w):w=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{s(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let u;t[7]===o?u=t[8]:(u=(0,a.jsx)(na,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=u);let f;t[9]===i?f=t[10]:(f=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(Ia,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),t[9]=i,t[10]=f);let b;t[11]!==u||t[12]!==f?(b=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[u,f]}),t[11]=u,t[12]=f,t[13]=b):b=t[13];let y;t[14]===n?y=t[15]:(y=(0,a.jsx)(be,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=y);let k;t[16]===i?k=t[17]:(k=(0,a.jsx)(be,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await ee(i)},children:"Create"}),t[16]=i,t[17]=k);let x;t[18]!==y||t[19]!==k?(x=(0,a.jsxs)(ua,{children:[y,k]}),t[18]=y,t[19]=k,t[20]=x):x=t[20];let j;return t[21]!==d||t[22]!==x||t[23]!==b?(j=(0,a.jsx)(fa,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[w,b,x]})}),t[21]=d,t[22]=x,t[23]=b,t[24]=j):j=t[24],j};var Ia=e=>{let t=(0,Ke.c)(8),[n,o]=ke.useState(!1),s;t[0]===e.text?s=t[1]:(s=qt.stopPropagation(async m=>{m.preventDefault(),await ee(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=s);let r=s,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(Kt,{size:14,strokeWidth:1.5}),t[2]=l):l=t[2];let i;t[3]===r?i=t[4]:(i=(0,a.jsx)(be,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:l}),t[3]=r,t[4]=i);let d;return t[5]!==n||t[6]!==i?(d=(0,a.jsx)(Rt,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=d):d=t[7],d},Ea=P();function La(){let e=document.getElementsByClassName(De.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=me.findElement(t);if(!o){T.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:me.parse(o.id)}}}return T.warn("No visible output area found for scroll anchor"),null}function Ta(e){if(!e){T.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(me.create(e.cellId));if(!t){T.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${De.outputArea}`)){T.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ue(){let e=(0,Ea.c)(2),t=L(We),n;return e[0]===t?n=e[1]:(n=()=>{let o=La();t(s=>({mode:ft(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Ta(o)})})},e[0]=t,e[1]=n),n}const Ge=ot(!1);var Ha=P();const Ra=()=>{let e=(0,Ha.c)(7),{selectedLayout:t}=Pe(),{setLayoutView:n}=Ne();if(Q()&&!rt("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=i=>n(i),e[0]=n,e[1]=o);let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Pt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Dt,{placeholder:"Select a view"})}),e[2]=s):s=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(St,{children:(0,a.jsxs)(At,{children:[(0,a.jsx)(Mt,{children:"View as"}),Fe.map(Fa)]})}),e[3]=r):r=e[3];let l;return e[4]!==t||e[5]!==o?(l=(0,a.jsxs)(Nt,{"data-testid":"layout-select",value:t,onValueChange:o,children:[s,r]}),e[4]=t,e[5]=o,e[6]=l):l=e[6],l};function qa(e){return(0,a.jsx)(Je(e),{className:"h-4 w-4"})}function Je(e){switch(e){case"vertical":return Da;case"grid":return Qt;case"slides":return Ve;default:return Ft(e),ra}}function Ze(e){return Se.startCase(e)}function Fa(e){return(0,a.jsx)(_t,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[qa(e),(0,a.jsx)("span",{children:Ze(e)})]})},e)}async function Oa(e){let{filename:t,preset:n,downloadPDF:o}=e;await o({filename:t,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var Ya=P();function Ba(e){let t=(0,Ya.c)(5),{openPrompt:n,closeModal:o}=ye(),{sendCopy:s}=H(),r;return t[0]!==o||t[1]!==n||t[2]!==s||t[3]!==e?(r=()=>{if(!e)return null;let l=da.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Te.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=l.join(Te.dirname(e),i);s({source:e,destination:d}).then(()=>{o(),z({title:"Notebook copied",description:"A copy of the notebook has been created."}),ja(d)})}})},t[0]=o,t[1]=n,t[2]=s,t[3]=e,t[4]=r):r=t[4],r}const Va=()=>{let{updateCellConfig:e}=Ce(),{saveCellConfig:t}=H();return(0,ke.useCallback)(async()=>{let n=new pt,o=ze(),s=o.cellIds.inOrderIds,r={};for(let i of s){if(o.cellData[i]===void 0)continue;let{code:d,config:m}=o.cellData[i];m.hide_code||n.isSupported(d)&&(r[i]={hide_code:!0})}let l=Me.entries(r);if(l.length!==0){await t({configs:r});for(let[i,d]of l)e({cellId:i,config:d})}},[e])};var $a=P();function Qe(){let e=(0,$a.c)(4),{openConfirm:t}=ye(),n=L(vt),{sendRestart:o}=H(),s;return e[0]!==t||e[1]!==o||e[2]!==n?(s=()=>{t({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(Wt,{onClick:async()=>{n({state:Ct.CLOSING}),await o(),ya()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=s):s=e[3],s}var Ka=P(),N=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Ua(){var we,ge,je;let e=(0,Ka.c)(53),t=ka(),{openModal:n,closeModal:o}=ye(),{toggleApplication:s}=it(),{selectedPanel:r}=dt(),[l]=at(We),i=Z(yt),d=Va(),[m]=jt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:u,addSetupCellIfDoesntExist:f,collapseAllCells:b,expandAllCells:y}=Ce(),k=Qe(),x=ha(),j=Ba(t),v=L(Ge),I=L(wt),W=L(gt),{exportAsIPYNB:oe,exportAsMarkdown:ne,readCode:M,saveCellConfig:ie,updateCellOutputs:D}=H(),_=va(),se=Z(mt),le=Z(kt),re=Z(lt),{selectedLayout:R}=Pe(),{setLayoutView:de}=Ne(),q=Ue(),F=((we=m.sharing)==null?void 0:we.html)??!0,O=((ge=m.sharing)==null?void 0:ge.wasm)??!0,Y=((je=m.sharing)==null?void 0:je.molab)??!0,xe=!Q(),ce=R==="slides",Xe=mo,et=po,B;e[0]!==t||e[1]!==_||e[2]!==D?(B=async c=>{let{preset:p,title:E}=c;if(!t){ae();return}await _e(E,async pe=>{await qe({takeScreenshots:()=>_({progress:pe}),updateCellOutputs:D}),await Oa({filename:t,preset:p,downloadPDF:Lt})})},e[0]=t,e[1]=_,e[2]=D,e[3]=B):B=e[3];let S=B,V;e[4]===S?V=e[5]:(V=async()=>{if(xe){await S({preset:"document",title:"Downloading Document PDF..."});return}let c=new Event("export-beforeprint"),p=new Event("export-afterprint");window.dispatchEvent(c),setTimeout(ho,0),setTimeout(()=>window.dispatchEvent(p),0)},e[4]=S,e[5]=V);let $=V,K;e[6]!==oe||e[7]!==t||e[8]!==_||e[9]!==D?(K=async()=>{if(!t){ae();return}await _e("Downloading IPYNB...",async c=>{await qe({takeScreenshots:()=>_({progress:c}),updateCellOutputs:D});let p=await oe({download:!1});fe(new Blob([p],{type:"application/x-ipynb+json"}),ue.toIPYNB(document.title))})},e[6]=oe,e[7]=t,e[8]=_,e[9]=D,e[10]=K):K=e[10];let he=K,U;e[11]===Symbol.for("react.memo_cache_sentinel")?(U=(0,a.jsx)(It,{size:14,strokeWidth:1.5}),e[11]=U):U=e[11];let G;e[12]===Symbol.for("react.memo_cache_sentinel")?(G=(0,a.jsx)(Ae,{size:14,strokeWidth:1.5}),e[12]=G):G=e[12];let A;e[13]===t?A=e[14]:(A=async()=>{if(!t){ae();return}await Ie({filename:t,includeCode:!0})},e[13]=t,e[14]=A);let J;return e[15]!==f||e[16]!==le||e[17]!==u||e[18]!==o||e[19]!==b||e[20]!==j||e[21]!==S||e[22]!==y||e[23]!==ne||e[24]!==t||e[25]!==$||e[26]!==he||e[27]!==se||e[28]!==d||e[29]!==ce||e[30]!==i||e[31]!==n||e[32]!==M||e[33]!==k||e[34]!==x||e[35]!==ie||e[36]!==R||e[37]!==r||e[38]!==v||e[39]!==W||e[40]!==de||e[41]!==I||e[42]!==F||e[43]!==Y||e[44]!==O||e[45]!==A||e[46]!==s||e[47]!==q||e[48]!==g||e[49]!==re||e[50]!==w||e[51]!==l.mode?(J=[{icon:U,label:"Download",handle:N,dropdown:[{icon:G,label:"Download as HTML",handle:A},{icon:(0,a.jsx)(Ae,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){ae();return}await Ie({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(wa,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await ne({download:!1});fe(new Blob([c],{type:"text/plain"}),ue.toMarkdown(document.title))}},{icon:(0,a.jsx)(_a,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:he},{icon:(0,a.jsx)(Vt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await M();fe(new Blob([c.contents],{type:"text/plain"}),ue.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(aa,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:l.mode!=="present",tooltip:l.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",xa("global.hideCode",!1)]}),handle:co},ce?{divider:!0,icon:(0,a.jsx)(X,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:N,dropdown:[{icon:(0,a.jsx)(X,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:$},{icon:(0,a.jsx)(X,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:et(!0),hidden:!xe,handle:async()=>{await S({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(X,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:$}]},{icon:(0,a.jsx)(sa,{size:14,strokeWidth:1.5}),label:"Pair with an agent",hidden:Q(),handle:async()=>{n((0,a.jsx)(ga,{onClose:o}))}},{icon:(0,a.jsx)(Aa,{size:14,strokeWidth:1.5}),label:"Share",handle:N,hidden:!F&&!O&&!Y,dropdown:[{icon:(0,a.jsx)(Jt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!F,handle:async()=>{n((0,a.jsx)(Na,{onClose:o}))}},{icon:(0,a.jsx)(oa,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!O,handle:async()=>{await ee(He({code:(await M()).contents})),z({title:"Copied",description:"Link copied to clipboard."})}},{icon:(0,a.jsx)(Re,{size:14,strokeWidth:1.5}),label:"Create molab notebook",hidden:!Y,handle:async()=>{let c=He({code:(await M()).contents,baseUrl:`${C.molab}/new`});window.open(c,"_blank")}}]},{icon:(0,a.jsx)(Sa,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:N,dropdown:bt.flatMap(c=>{let{type:p,Icon:E,hidden:pe,additionalKeywords:tt}=c;return pe?[]:{label:Se.startCase(p),rightElement:Xe(r===p),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),handle:()=>s(p),additionalKeywords:tt}})},{icon:(0,a.jsx)(Ve,{size:14,strokeWidth:1.5}),label:"Present as",handle:N,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(la,{size:14,strokeWidth:1.5}):(0,a.jsx)(Ot,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{q()}},...Fe.map((c,p)=>{let E=Je(c);return{divider:p===0,label:Ze(c),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:R===c&&(0,a.jsx)(Ee,{size:14})}),handle:()=>{de(c),l.mode==="edit"&&q()}}})]},{icon:(0,a.jsx)(Ma,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||Q(),handle:j},{icon:(0,a.jsx)(Oe,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await ee((await M()).contents),z({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)($t,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!se||i,handle:async()=>{let c=ht(ze());await ie({configs:Me.fromEntries(c.map(ro))});for(let p of c)w({cellId:p,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Be,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{f({})}},{icon:(0,a.jsx)(xt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(Le,{onClose:o}))}},{icon:(0,a.jsx)(ea,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(Le,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)($e,{size:14,strokeWidth:1.5}),label:re,hidden:!le||i,handle:()=>{g()}},{icon:(0,a.jsx)(Pa,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:k,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Wa,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{x()}},{icon:(0,a.jsx)(ct,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{u()}},{icon:(0,a.jsx)(Et,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(za,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:b,redundant:!0},{icon:(0,a.jsx)(Ca,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:y,redundant:!0},{divider:!0,icon:(0,a.jsx)(Ye,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(lo)},{icon:(0,a.jsx)(Yt,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>W(so)},{icon:(0,a.jsx)(ia,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>I(io),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(Ut,{size:14,strokeWidth:1.5}),label:"Resources",handle:N,dropdown:[{icon:(0,a.jsx)(st,{size:14,strokeWidth:1.5}),label:"Documentation",handle:no},{icon:(0,a.jsx)(Gt,{size:14,strokeWidth:1.5}),label:"GitHub",handle:oo},{icon:(0,a.jsx)(Zt,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:ao},{icon:(0,a.jsx)(Xt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:to},{icon:(0,a.jsx)(ut,{size:14,strokeWidth:1.5}),label:"Changelog",handle:eo}]},{divider:!0,icon:(0,a.jsx)(ta,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Xa},{icon:(0,a.jsx)(Re,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Qa}].filter(Za).map(Ga),e[15]=f,e[16]=le,e[17]=u,e[18]=o,e[19]=b,e[20]=j,e[21]=S,e[22]=y,e[23]=ne,e[24]=t,e[25]=$,e[26]=he,e[27]=se,e[28]=d,e[29]=ce,e[30]=i,e[31]=n,e[32]=M,e[33]=k,e[34]=x,e[35]=ie,e[36]=R,e[37]=r,e[38]=v,e[39]=W,e[40]=de,e[41]=I,e[42]=F,e[43]=Y,e[44]=O,e[45]=A,e[46]=s,e[47]=q,e[48]=g,e[49]=re,e[50]=w,e[51]=l.mode,e[52]=J):J=e[52],J}function Ga(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Ja)}:e}function Ja(e){return!e.hidden}function Za(e){return!e.hidden}function Qa(){let e=ca();window.open(e,"_blank")}function Xa(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function eo(){window.open(C.releasesPage,"_blank")}function to(){window.open(C.youtube,"_blank")}function ao(){window.open(C.discordLink,"_blank")}function oo(){window.open(C.githubPage,"_blank")}function no(){window.open(C.docsPage,"_blank")}function io(e){return!e}function so(e){return!e}function lo(e){return!e}function ro(e){return[e,{disabled:!1}]}async function co(){let e=document.getElementById("App");e&&await Tt({element:e,filename:document.title,prepare:Ht})}function ho(){return window.print()}function po(e){return e?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function mo(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(Ee,{size:14})})}function ae(){z({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{Ue as a,Ye as c,Ge as i,Oe as l,Qe as n,$e as o,Ra as r,Be as s,Ua as t};
package/dist/index.html CHANGED
@@ -66,7 +66,7 @@
66
66
  <marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
67
67
  <!-- /TODO -->
68
68
  <title>{{ title }}</title>
69
- <script type="module" crossorigin src="./assets/index-CG_ckx5R.js"></script>
69
+ <script type="module" crossorigin src="./assets/index-BT6rKXr9.js"></script>
70
70
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-BPPi7vOr.js">
71
71
  <link rel="modulepreload" crossorigin href="./assets/chunk-LvLJmgfZ.js">
72
72
  <link rel="modulepreload" crossorigin href="./assets/react-Bj1aDYRI.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.23.9-dev43",
3
+ "version": "0.23.9-dev45",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -65,6 +65,11 @@ export interface CellEditorProps
65
65
  hasOutput?: boolean;
66
66
  languageAdapter: LanguageAdapterType | undefined;
67
67
  showLanguageToggles?: boolean;
68
+ /**
69
+ * Override for the inline "Edit with AI" tooltip. Defaults to the user's
70
+ * `ai.inline_tooltip` config. Set to `false` to force-disable it.
71
+ */
72
+ inlineAiTooltip?: boolean;
68
73
  setLanguageAdapter: React.Dispatch<
69
74
  React.SetStateAction<LanguageAdapterType | undefined>
70
75
  >;
@@ -73,6 +78,12 @@ export interface CellEditorProps
73
78
  editorViewParentRef?: React.RefObject<HTMLDivElement | null>;
74
79
  showHiddenCode: (opts?: { focus?: boolean }) => void;
75
80
  outputArea?: "above" | "below";
81
+ /**
82
+ * CSS selector for the element that editor tooltips (completions, hover,
83
+ * signature help) are appended to. Useful for fullscreen/dialog containers;
84
+ * defaults to `#App`.
85
+ */
86
+ tooltipParentSelector?: string;
76
87
  }
77
88
 
78
89
  const CellEditorInternal = ({
@@ -94,7 +105,9 @@ const CellEditorInternal = ({
94
105
  languageAdapter,
95
106
  setLanguageAdapter,
96
107
  showLanguageToggles = true,
108
+ inlineAiTooltip,
97
109
  outputArea,
110
+ tooltipParentSelector,
98
111
  }: CellEditorProps) => {
99
112
  const [aiCompletionCell, setAiCompletionCell] = useAtom(aiCompletionCellAtom);
100
113
  const deleteCell = useDeleteCellCallback();
@@ -224,7 +237,9 @@ const CellEditorInternal = ({
224
237
  hotkeys: new OverridingHotkeyProvider(userConfig.keymap.overrides ?? {}),
225
238
  diagnosticsConfig: userConfig.diagnostics,
226
239
  displayConfig: userConfig.display,
227
- inlineAiTooltip: userConfig.ai?.inline_tooltip ?? false,
240
+ inlineAiTooltip:
241
+ inlineAiTooltip ?? userConfig.ai?.inline_tooltip ?? false,
242
+ tooltipParentSelector,
228
243
  });
229
244
 
230
245
  extensions.push(
@@ -274,6 +289,8 @@ const CellEditorInternal = ({
274
289
  userConfig.display,
275
290
  userConfig.diagnostics,
276
291
  userConfig.ai?.inline_tooltip,
292
+ inlineAiTooltip,
293
+ tooltipParentSelector,
277
294
  aiFeaturesEnabled,
278
295
  theme,
279
296
  showPlaceholder,
@@ -3,6 +3,7 @@
3
3
  import { useMemo, useRef, useState } from "react";
4
4
  import type { EditorView } from "@codemirror/view";
5
5
  import { useAtomValue } from "jotai";
6
+ import { cellDomProps } from "@/components/editor/common";
6
7
  import { CellEditor } from "@/components/editor/cell/code/cell-editor";
7
8
  import { CellStatusComponent } from "@/components/editor/cell/CellStatus";
8
9
  import { RunButton } from "@/components/editor/cell/RunButton";
@@ -111,7 +112,10 @@ export const SlideCellView = ({ cell }: { cell: RuntimeCell }) => {
111
112
  );
112
113
 
113
114
  const editor = (
114
- <div className={editorWrapperClassName}>
115
+ <div
116
+ className={editorWrapperClassName}
117
+ {...cellDomProps(cell.id, cell.name)}
118
+ >
115
119
  <CellEditor
116
120
  theme={theme}
117
121
  showPlaceholder={false}
@@ -134,7 +138,14 @@ export const SlideCellView = ({ cell }: { cell: RuntimeCell }) => {
134
138
  languageAdapter={languageAdapter}
135
139
  setLanguageAdapter={setLanguageAdapter}
136
140
  showLanguageToggles={false}
141
+ // The reveal.js transforms in slides view break the inline AI
142
+ // tooltip's fixed positioning, so disable it here.
143
+ inlineAiTooltip={false}
137
144
  outputArea={cellOutputPosition}
145
+ // Parent tooltips (completions, hover, signature help) to the Reveal
146
+ // viewport so they stay visible when presenting fullscreen; `#App` sits
147
+ // outside the fullscreened subtree and would never paint.
148
+ tooltipParentSelector=".reveal-viewport"
138
149
  />
139
150
  {toolbar}
140
151
  </div>
@@ -83,6 +83,11 @@ export interface CodeMirrorSetupOpts {
83
83
  diagnosticsConfig: DiagnosticsConfig;
84
84
  displayConfig: Pick<DisplayConfig, "reference_highlighting">;
85
85
  inlineAiTooltip: boolean;
86
+ /**
87
+ * CSS selector for the element that CodeMirror tooltips (completions, hover,
88
+ * signature help) should be appended to. Defaults to `#App`.
89
+ */
90
+ tooltipParentSelector?: string;
86
91
  }
87
92
 
88
93
  function getPlaceholderType(opts: CodeMirrorSetupOpts) {
@@ -90,6 +95,46 @@ function getPlaceholderType(opts: CodeMirrorSetupOpts) {
90
95
  return showPlaceholder ? "marimo-import" : enableAI ? "ai" : "none";
91
96
  }
92
97
 
98
+ const CODEMIRROR_TOOLTIP_PORTAL_CLASS = "cm-tooltip-portal";
99
+
100
+ /**
101
+ * Resolve the element that editor tooltips (completions, hover, signature help)
102
+ * should be appended to.
103
+ *
104
+ * The default `#App` parent is returned directly. Custom parents are useful
105
+ * when editors live inside a fullscreen subtree, dialog, or scoped typography
106
+ * region. In those cases we append tooltips to a dedicated `not-prose` portal
107
+ * inside the requested parent, reusing it across cells so surrounding typography
108
+ * styles don't leak into editor popups.
109
+ */
110
+ function resolveCodeMirrorTooltipParent(
111
+ selector: string | undefined,
112
+ ): HTMLElement | undefined {
113
+ if (selector == null) {
114
+ return document.querySelector<HTMLElement>("#App") ?? undefined;
115
+ }
116
+
117
+ const host = document.querySelector<HTMLElement>(selector);
118
+ if (host == null) {
119
+ return undefined;
120
+ }
121
+
122
+ const existing = host.querySelector<HTMLElement>(
123
+ `:scope > .${CODEMIRROR_TOOLTIP_PORTAL_CLASS}`,
124
+ );
125
+ if (existing != null) {
126
+ return existing;
127
+ }
128
+
129
+ const portal = document.createElement("div");
130
+ // `not-prose` escapes scoped typography; `contents` keeps the wrapper
131
+ // layout-neutral. Tooltips are `position: fixed`, so the wrapper having no
132
+ // box doesn't affect positioning.
133
+ portal.className = `${CODEMIRROR_TOOLTIP_PORTAL_CLASS} not-prose contents`;
134
+ host.append(portal);
135
+ return portal;
136
+ }
137
+
93
138
  /**
94
139
  * Setup CodeMirror for a cell
95
140
  */
@@ -180,6 +225,7 @@ export const basicBundle = (opts: CodeMirrorSetupOpts): Extension[] => {
180
225
  cellId,
181
226
  lspConfig,
182
227
  diagnosticsConfig,
228
+ tooltipParentSelector,
183
229
  } = opts;
184
230
  const placeholderType = getPlaceholderType(opts);
185
231
  const autoClosePairs = completionConfig.auto_close_pairs !== false;
@@ -200,7 +246,7 @@ export const basicBundle = (opts: CodeMirrorSetupOpts): Extension[] => {
200
246
  position: "fixed",
201
247
  // This the z-index multiple tooltips being stacked
202
248
  // For example, if we have a hover tooltip and a completion tooltip
203
- parent: document.querySelector<HTMLElement>("#App") ?? undefined,
249
+ parent: resolveCodeMirrorTooltipParent(tooltipParentSelector),
204
250
  }),
205
251
  scrollActiveLineIntoViewExtension(),
206
252
  theme === "dark" ? darkTheme : lightTheme,