@marimo-team/frontend 0.23.10-dev25 → 0.23.10-dev26

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-vjZ69d-u.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-DH1Le_e1.js";import{t as q}from"./cn-DCUzRj2J.js";import{t as G}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-DFky0PAA.js";import"./popover-CNCYAwbC.js";import{B as J,w as K,wt as Q}from"./JsonOutput-BYEhZqb8.js";import{r as X}from"./download-DyF92TRH.js";import{n as Y,t as R}from"./button-BbCh-29a.js";import"./dist-D0HyMpgV.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{r as Z}from"./requests-DIwGYs0l.js";import"./layout-BI8kBq9L.js";import{c as ee}from"./state-CcAGAozT.js";import"./markdown-renderer-DTD6g-4R.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-BaGwQI8n.js";import{t as ne}from"./spinner-UuZAUjoP.js";import"./dist-CMvFIVSA.js";import"./dist-cJl5Fok5.js";import"./dist-BFCmbzWi.js";import"./dist-CS6moqWs.js";import"./dist-DTNIEaQR.js";import{t as le}from"./use-toast-9t59MOqR.js";import{t as me}from"./session-DGdfs0bJ.js";import"./purify.es-DvRMX74T.js";import"./dates-DS_7IZoI.js";import{n as ce}from"./copy-Ch48HVPK.js";import{a as de,c as pe,l as he,n as xe,r as fe,t as be}from"./dialog-QgtiqcL7.js";import{t as je}from"./share-DQLjaPiK.js";import"./utils-DQRuLEof.js";import"./vega-loader.browser-xq8miGHn.js";import"./defaultLocale-DPBdGRrH.js";import"./defaultLocale-Lfi0pexn.js";import{a as ue}from"./cell-link-CgOvnjYt.js";import"./chunk-5FQGJX7Z-CfK7VoEZ.js";import"./html-to-image-2JVKRW1b.js";import{n as ge,t as ye}from"./react-resizable-panels.browser.esm-BdtIs0E-.js";import"./esm-ChQLuryJ.js";import"./name-cell-input-Cwis179U.js";import{n as ke,t as _e}from"./marimo-icons-CiwvnnsT.js";import"./ws-BnE9sl8z.js";import"./dist-CH3UDWFp.js";import"./dist-DlCkNQAM.js";import"./dist-DtK0zh8h.js";import"./dist-Bmk2jyet.js";import"./dist-Sbt478Wh.js";import"./dist-C_EhQKG7.js";import"./dist-CAeBZ0Nq.js";import"./dist-BPey9y-W.js";import"./dist-CWGKeV6c.js";import"./esm-B2f-WXoG.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-vjZ69d-u.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-DH1Le_e1.js";import{t as q}from"./cn-DCUzRj2J.js";import{t as G}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-DFky0PAA.js";import"./popover-CNCYAwbC.js";import{B as J,w as K,wt as Q}from"./JsonOutput-BYEhZqb8.js";import{r as X}from"./download-DyF92TRH.js";import{n as Y,t as R}from"./button-BbCh-29a.js";import"./dist-D0HyMpgV.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{r as Z}from"./requests-DIwGYs0l.js";import"./layout-BT7gl970.js";import{c as ee}from"./state-CcAGAozT.js";import"./markdown-renderer-DTD6g-4R.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-KoIpjmfi.js";import{t as ne}from"./spinner-UuZAUjoP.js";import"./dist-CMvFIVSA.js";import"./dist-cJl5Fok5.js";import"./dist-BFCmbzWi.js";import"./dist-CS6moqWs.js";import"./dist-DTNIEaQR.js";import{t as le}from"./use-toast-9t59MOqR.js";import{t as me}from"./session-DGdfs0bJ.js";import"./purify.es-DvRMX74T.js";import"./dates-DS_7IZoI.js";import{n as ce}from"./copy-Ch48HVPK.js";import{a as de,c as pe,l as he,n as xe,r as fe,t as be}from"./dialog-QgtiqcL7.js";import{t as je}from"./share-DQLjaPiK.js";import"./utils-DQRuLEof.js";import"./vega-loader.browser-xq8miGHn.js";import"./defaultLocale-DPBdGRrH.js";import"./defaultLocale-Lfi0pexn.js";import{a as ue}from"./cell-link-CgOvnjYt.js";import"./chunk-5FQGJX7Z-CfK7VoEZ.js";import"./html-to-image-2JVKRW1b.js";import{n as ge,t as ye}from"./react-resizable-panels.browser.esm-BdtIs0E-.js";import"./esm-ChQLuryJ.js";import"./name-cell-input-Cwis179U.js";import{n as ke,t as _e}from"./marimo-icons-CiwvnnsT.js";import"./ws-BnE9sl8z.js";import"./dist-CH3UDWFp.js";import"./dist-DlCkNQAM.js";import"./dist-DtK0zh8h.js";import"./dist-Bmk2jyet.js";import"./dist-Sbt478Wh.js";import"./dist-C_EhQKG7.js";import"./dist-CAeBZ0Nq.js";import"./dist-BPey9y-W.js";import"./dist-CWGKeV6c.js";import"./esm-B2f-WXoG.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-vjZ69d-u.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-DFky0PAA.js";import"./popover-CNCYAwbC.js";import{n as Pe,__tla as De}from"./JsonOutput-BYEhZqb8.js";import"./download-DyF92TRH.js";import{t as z}from"./tooltip-B_PkSKN3.js";import{t as C}from"./button-BbCh-29a.js";import"./dist-D0HyMpgV.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-BI8kBq9L.js";import{n as Ve,t as qe,__tla as Fe}from"./LazyAnyLanguageCodeMirror-DGz0wXbE.js";import{__tla as Te}from"./markdown-renderer-DTD6g-4R.js";import{u as Ge}from"./toDate-B5A0DFEz.js";import{t as Ue,__tla as Be}from"./cell-editor-DS-GvQu7.js";import{t as Je}from"./spinner-UuZAUjoP.js";import{i as Ke}from"./useDeleteCell-ChnARMDw.js";import"./dist-CMvFIVSA.js";import"./dist-cJl5Fok5.js";import"./dist-BFCmbzWi.js";import"./dist-CS6moqWs.js";import"./dist-DTNIEaQR.js";import"./session-DGdfs0bJ.js";import{r as Qe}from"./useTheme-BrivXfaa.js";import"./purify.es-DvRMX74T.js";import"./dates-DS_7IZoI.js";import"./utils-DQRuLEof.js";import"./vega-loader.browser-xq8miGHn.js";import"./defaultLocale-DPBdGRrH.js";import"./defaultLocale-Lfi0pexn.js";import{__tla as We}from"./chunk-5FQGJX7Z-CfK7VoEZ.js";import"./html-to-image-2JVKRW1b.js";import{o as Xe}from"./focus-D3l6p56g.js";import{n as Ye,r as Ze,t as me}from"./react-resizable-panels.browser.esm-BdtIs0E-.js";import{a as $e}from"./renderShortcut-DbyG33_r.js";import"./esm-ChQLuryJ.js";import"./name-cell-input-Cwis179U.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-CH3UDWFp.js";import"./dist-DlCkNQAM.js";import"./dist-DtK0zh8h.js";import"./dist-Bmk2jyet.js";import"./dist-Sbt478Wh.js";import"./dist-C_EhQKG7.js";import"./dist-CAeBZ0Nq.js";import"./dist-BPey9y-W.js";import"./dist-CWGKeV6c.js";import"./esm-B2f-WXoG.js";import{t as at}from"./kiosk-mode-D6Pog-b5.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-vjZ69d-u.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-DFky0PAA.js";import"./popover-CNCYAwbC.js";import{n as Pe,__tla as De}from"./JsonOutput-BYEhZqb8.js";import"./download-DyF92TRH.js";import{t as z}from"./tooltip-B_PkSKN3.js";import{t as C}from"./button-BbCh-29a.js";import"./dist-D0HyMpgV.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-BT7gl970.js";import{n as Ve,t as qe,__tla as Fe}from"./LazyAnyLanguageCodeMirror-DGz0wXbE.js";import{__tla as Te}from"./markdown-renderer-DTD6g-4R.js";import{u as Ge}from"./toDate-B5A0DFEz.js";import{t as Ue,__tla as Be}from"./cell-editor-B3mTCRIX.js";import{t as Je}from"./spinner-UuZAUjoP.js";import{i as Ke}from"./useDeleteCell-ChnARMDw.js";import"./dist-CMvFIVSA.js";import"./dist-cJl5Fok5.js";import"./dist-BFCmbzWi.js";import"./dist-CS6moqWs.js";import"./dist-DTNIEaQR.js";import"./session-DGdfs0bJ.js";import{r as Qe}from"./useTheme-BrivXfaa.js";import"./purify.es-DvRMX74T.js";import"./dates-DS_7IZoI.js";import"./utils-DQRuLEof.js";import"./vega-loader.browser-xq8miGHn.js";import"./defaultLocale-DPBdGRrH.js";import"./defaultLocale-Lfi0pexn.js";import{__tla as We}from"./chunk-5FQGJX7Z-CfK7VoEZ.js";import"./html-to-image-2JVKRW1b.js";import{o as Xe}from"./focus-D3l6p56g.js";import{n as Ye,r as Ze,t as me}from"./react-resizable-panels.browser.esm-BdtIs0E-.js";import{a as $e}from"./renderShortcut-DbyG33_r.js";import"./esm-ChQLuryJ.js";import"./name-cell-input-Cwis179U.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-CH3UDWFp.js";import"./dist-DlCkNQAM.js";import"./dist-DtK0zh8h.js";import"./dist-Bmk2jyet.js";import"./dist-Sbt478Wh.js";import"./dist-C_EhQKG7.js";import"./dist-CAeBZ0Nq.js";import"./dist-BPey9y-W.js";import"./dist-CWGKeV6c.js";import"./esm-B2f-WXoG.js";import{t as at}from"./kiosk-mode-D6Pog-b5.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-vjZ69d-u.js";import{t as P}from"./compiler-runtime-B3qBwwSJ.js";import{n as wt,x as gt}from"./ai-model-dropdown-B0cy2CXL.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-DH1Le_e1.js";import{t as zt}from"./jsx-runtime-BqBOg78p.js";import{o as Wt}from"./alert-dialog-5BGIfskO.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-6suE6YM2.js";import{wt as It}from"./JsonOutput-BYEhZqb8.js";import{c as _e,d as ue,n as Et,o as Lt,r as fe,t as Tt}from"./download-DyF92TRH.js";import{t as Ht}from"./tooltip-B_PkSKN3.js";import{r as Rt,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 qt,L as Ae,P as Yt,R as Bt,a as Pe,i as Ne,u as Ie}from"./layout-BI8kBq9L.js";import{t as Ee}from"./check-BH35Ndha.js";import{r as Vt}from"./useCellActionButton-CpShaxQ-.js";import{t as $t}from"./copy-BwrPA9zQ.js";import{t as Kt}from"./external-link-BTNxSavU.js";import{t as Ut}from"./eye-off-BT-KOYV5.js";import{t as X}from"./file-HTLbeC2b.js";import{t as Gt}from"./github-raQvpeuZ.js";import{u as Jt}from"./form-B_6lxOn3.js";import{n as Zt,r as Qt,t as Xt}from"./youtube-3lRHw8NU.js";import{i as ea,n as Le}from"./add-connection-dialog-BGaI0GCh.js";import{t as ta}from"./house-D2ldnAB9.js";import{t as aa}from"./image-BIibSXT6.js";import{t as oa}from"./link-CoJxTwWE.js";import{r as na}from"./input-Dvl7sgNQ.js";import{t as ia}from"./settings-SnYErNWQ.js";import{t as sa}from"./sparkles-CC9Bko6a.js";import{y as la}from"./textarea-ibvi1Qnd.js";import{t as ra}from"./square-rACnnz-q.js";import{t as z}from"./use-toast-9t59MOqR.js";import{n as Te,t as da}from"./paths-SFhaqGlE.js";import{o as ca}from"./session-DGdfs0bJ.js";import{n as ee}from"./copy-Ch48HVPK.js";import{r as ha}from"./useRunCells-DELfNFG_.js";import{a as pa,c as ma,i as ua,n as fa,r as ba}from"./dialog-QgtiqcL7.js";import{n as ye}from"./ImperativeModal-CYpBrCHJ.js";import{r as ya,t as He}from"./share-DQLjaPiK.js";import{a as ka}from"./cell-link-CgOvnjYt.js";import{a as xa}from"./renderShortcut-DbyG33_r.js";import{t as wa}from"./icons-8tfAri2V.js";import{t as ga}from"./pair-with-agent-modal-DQuvaMjY.js";import{n as Re}from"./marimo-icons-CiwvnnsT.js";import{t as ja}from"./links-C6riF5tE.js";import{r as va,t as Fe}from"./hooks-L9VY624Y.js";import{t as Oe}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"}]]),qe=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:Yt.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=Rt.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)($t,{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)(Ht,{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"}),Oe.map(Oa)]})}),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 Fa(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 Oa(e){return(0,a.jsx)(_t,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Fa(e),(0,a.jsx)("span",{children:Ze(e)})]})},e)}async function qa(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(),F=Ue(),O=((we=m.sharing)==null?void 0:we.html)??!0,q=((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 Fe({takeScreenshots:()=>_({progress:pe}),updateCellOutputs:D}),await qa({filename:t,preset:p,downloadPDF:Et})})},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 Fe({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]!==O||e[43]!==Y||e[44]!==q||e[45]!==A||e[46]!==s||e[47]!==F||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)(Bt,{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:!O&&!q&&!Y,dropdown:[{icon:(0,a.jsx)(Jt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!O,handle:async()=>{n((0,a.jsx)(Na,{onClose:o}))}},{icon:(0,a.jsx)(oa,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!q,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:()=>{F()}},...Oe.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"&&F()}}})]},{icon:(0,a.jsx)(Ma,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||Q(),handle:j},{icon:(0,a.jsx)(qe,{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)(Vt,{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)(Ut,{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)(qt,{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)(Kt,{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]=O,e[43]=Y,e[44]=q,e[45]=A,e[46]=s,e[47]=F,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 Lt({element:e,filename:document.title,prepare:Tt})}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,qe 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-vjZ69d-u.js";import{t as P}from"./compiler-runtime-B3qBwwSJ.js";import{n as wt,x as gt}from"./ai-model-dropdown-B0cy2CXL.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-DH1Le_e1.js";import{t as zt}from"./jsx-runtime-BqBOg78p.js";import{o as Wt}from"./alert-dialog-5BGIfskO.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-6suE6YM2.js";import{wt as It}from"./JsonOutput-BYEhZqb8.js";import{c as _e,d as ue,n as Et,o as Lt,r as fe,t as Tt}from"./download-DyF92TRH.js";import{t as Ht}from"./tooltip-B_PkSKN3.js";import{r as Rt,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 qt,L as Ae,P as Yt,R as Bt,a as Pe,i as Ne,u as Ie}from"./layout-BT7gl970.js";import{t as Ee}from"./check-BH35Ndha.js";import{r as Vt}from"./useCellActionButton-CpShaxQ-.js";import{t as $t}from"./copy-BwrPA9zQ.js";import{t as Kt}from"./external-link-BTNxSavU.js";import{t as Ut}from"./eye-off-BT-KOYV5.js";import{t as X}from"./file-HTLbeC2b.js";import{t as Gt}from"./github-raQvpeuZ.js";import{u as Jt}from"./form-B_6lxOn3.js";import{n as Zt,r as Qt,t as Xt}from"./youtube-3lRHw8NU.js";import{i as ea,n as Le}from"./add-connection-dialog-BGaI0GCh.js";import{t as ta}from"./house-D2ldnAB9.js";import{t as aa}from"./image-BIibSXT6.js";import{t as oa}from"./link-CoJxTwWE.js";import{r as na}from"./input-Dvl7sgNQ.js";import{t as ia}from"./settings-SnYErNWQ.js";import{t as sa}from"./sparkles-CC9Bko6a.js";import{y as la}from"./textarea-ibvi1Qnd.js";import{t as ra}from"./square-rACnnz-q.js";import{t as z}from"./use-toast-9t59MOqR.js";import{n as Te,t as da}from"./paths-SFhaqGlE.js";import{o as ca}from"./session-DGdfs0bJ.js";import{n as ee}from"./copy-Ch48HVPK.js";import{r as ha}from"./useRunCells-DELfNFG_.js";import{a as pa,c as ma,i as ua,n as fa,r as ba}from"./dialog-QgtiqcL7.js";import{n as ye}from"./ImperativeModal-CYpBrCHJ.js";import{r as ya,t as He}from"./share-DQLjaPiK.js";import{a as ka}from"./cell-link-CgOvnjYt.js";import{a as xa}from"./renderShortcut-DbyG33_r.js";import{t as wa}from"./icons-8tfAri2V.js";import{t as ga}from"./pair-with-agent-modal-DQuvaMjY.js";import{n as Re}from"./marimo-icons-CiwvnnsT.js";import{t as ja}from"./links-C6riF5tE.js";import{r as va,t as Fe}from"./hooks-BVRBF3gQ.js";import{t as Oe}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"}]]),qe=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:Yt.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=Rt.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)($t,{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)(Ht,{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"}),Oe.map(Oa)]})}),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 Fa(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 Oa(e){return(0,a.jsx)(_t,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Fa(e),(0,a.jsx)("span",{children:Ze(e)})]})},e)}async function qa(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(),F=Ue(),O=((we=m.sharing)==null?void 0:we.html)??!0,q=((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 Fe({takeScreenshots:()=>_({progress:pe}),updateCellOutputs:D}),await qa({filename:t,preset:p,downloadPDF:Et})})},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 Fe({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]!==O||e[43]!==Y||e[44]!==q||e[45]!==A||e[46]!==s||e[47]!==F||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)(Bt,{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:!O&&!q&&!Y,dropdown:[{icon:(0,a.jsx)(Jt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!O,handle:async()=>{n((0,a.jsx)(Na,{onClose:o}))}},{icon:(0,a.jsx)(oa,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!q,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:()=>{F()}},...Oe.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"&&F()}}})]},{icon:(0,a.jsx)(Ma,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||Q(),handle:j},{icon:(0,a.jsx)(qe,{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)(Vt,{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)(Ut,{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)(qt,{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)(Kt,{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]=O,e[43]=Y,e[44]=q,e[45]=A,e[46]=s,e[47]=F,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 Lt({element:e,filename:document.title,prepare:Tt})}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,qe 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-gFLNrEY2.js"></script>
69
+ <script type="module" crossorigin src="./assets/index-BIqgYS3N.js"></script>
70
70
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-DdZsAcJe.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.10-dev25",
3
+ "version": "0.23.10-dev26",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -17,6 +17,11 @@ interface LanguageTogglesProps {
17
17
  code: string;
18
18
  currentLanguageAdapter: LanguageAdapter["type"] | undefined;
19
19
  onAfterToggle: () => void;
20
+ /**
21
+ * Classes for the wrapper element. Defaults to the absolutely-positioned,
22
+ * hover-revealed placement used inside the notebook cell editor.
23
+ */
24
+ className?: string;
20
25
  }
21
26
 
22
27
  export const LanguageToggles: React.FC<LanguageTogglesProps> = ({
@@ -24,6 +29,7 @@ export const LanguageToggles: React.FC<LanguageTogglesProps> = ({
24
29
  code,
25
30
  currentLanguageAdapter,
26
31
  onAfterToggle,
32
+ className = "absolute right-3 top-2 z-20 flex hover-action gap-1",
27
33
  }) => {
28
34
  const canUseMarkdown = useMemo(
29
35
  () => LanguageAdapters.markdown.isSupported(code) || code.trim() === "",
@@ -35,7 +41,7 @@ export const LanguageToggles: React.FC<LanguageTogglesProps> = ({
35
41
  );
36
42
 
37
43
  return (
38
- <div className="absolute right-3 top-2 z-20 flex hover-action gap-1">
44
+ <div className={className}>
39
45
  <LanguageToggle
40
46
  editorView={editorView}
41
47
  currentLanguageAdapter={currentLanguageAdapter}
@@ -248,6 +248,26 @@ const BACKWARDS_COMPAT_SNAPSHOTS: BackwardsCompatCase[] = [
248
248
  ],
249
249
  },
250
250
  },
251
+ {
252
+ // `showCode` was added to SlideConfig. The validator must know about it (so
253
+ // it isn't silently stripped), the deserializer must carry it through, and
254
+ // serialize → deserialize must round-trip both values.
255
+ label: "showCode round-trips through validate + (de)serialize",
256
+ input: {
257
+ cells: [
258
+ { type: "slide", showCode: true },
259
+ { type: "fragment", showCode: false },
260
+ ],
261
+ },
262
+ expected: {
263
+ deck: {},
264
+ cellIds: ["a", "b"],
265
+ cellEntries: [
266
+ ["a", { type: "slide", showCode: true }],
267
+ ["b", { type: "fragment", showCode: false }],
268
+ ],
269
+ },
270
+ },
251
271
  ];
252
272
 
253
273
  describe("SlidesLayoutPlugin backwards compatibility", () => {
@@ -9,6 +9,7 @@ export type SlideType = z.infer<typeof SlideTypeSchema>;
9
9
  const SlideConfigSchema = z.looseObject({
10
10
  type: SlideTypeSchema.optional(),
11
11
  speakerNotes: z.string().optional(),
12
+ showCode: z.boolean().optional(),
12
13
  });
13
14
  export type SlideConfig = z.infer<typeof SlideConfigSchema>;
14
15