@marimo-team/frontend 0.23.9-dev45 → 0.23.9-dev46
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.
- package/dist/assets/{cell-editor-nGYckExu.js → cell-editor-BCFCsP_w.js} +1 -1
- package/dist/assets/{command-palette-DMoSE_z1.js → command-palette-B-Gmv6bI.js} +1 -1
- package/dist/assets/{edit-page-ByHt9KCi.js → edit-page-DxrKx70k.js} +3 -3
- package/dist/assets/{hooks-BfsdgkfD.js → hooks-Cj0_VSui.js} +1 -1
- package/dist/assets/{index-BT6rKXr9.js → index-gYS1m_ap.js} +2 -2
- package/dist/assets/layout-B15A69L1.js +9 -0
- package/dist/assets/{panels-ZYkk-m0X.js → panels-CHMV9kca.js} +1 -1
- package/dist/assets/reveal-component-BUEHXSjS.js +1069 -0
- package/dist/assets/{run-page-BtP-TTb3.js → run-page-B9bMWajI.js} +1 -1
- package/dist/assets/{scratchpad-panel-shvLtU2N.js → scratchpad-panel-BCWZfK4f.js} +1 -1
- package/dist/assets/{useNotebookActions-1Xqto4ts.js → useNotebookActions-gBMzsDzE.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/components/editor/renderers/slides-layout/__tests__/compute-slide-cells.test.ts +30 -17
- package/src/components/editor/renderers/slides-layout/compute-slide-cells.ts +17 -8
- package/src/components/editor/renderers/slides-layout/slides-layout.tsx +9 -11
- package/src/components/slides/minimap.tsx +45 -9
- package/src/components/slides/reveal-component.tsx +79 -34
- package/dist/assets/layout-KNg4OZ4V.js +0 -9
- package/dist/assets/reveal-component-yjuk64m1.js +0 -1069
|
@@ -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-
|
|
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-B15A69L1.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-CHMV9kca.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-
|
|
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-B15A69L1.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-BCFCsP_w.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-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};
|
|
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-B15A69L1.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-Cj0_VSui.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-
|
|
69
|
+
<script type="module" crossorigin src="./assets/index-gYS1m_ap.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
|
@@ -26,8 +26,9 @@ const layoutOf = (entries: Array<[string, SlideConfig]>): SlidesLayout => ({
|
|
|
26
26
|
describe("computeSlideCellsInfo", () => {
|
|
27
27
|
it("returns empty results for empty input", () => {
|
|
28
28
|
const result = computeSlideCellsInfo([], layoutOf([]));
|
|
29
|
-
expect(result.
|
|
29
|
+
expect(result.slideCells).toEqual([]);
|
|
30
30
|
expect(result.skippedIds.size).toBe(0);
|
|
31
|
+
expect(result.noOutputIds.size).toBe(0);
|
|
31
32
|
expect(result.slideTypes.size).toBe(0);
|
|
32
33
|
expect(result.startCellIndex).toBe(0);
|
|
33
34
|
});
|
|
@@ -62,22 +63,26 @@ describe("computeSlideCellsInfo", () => {
|
|
|
62
63
|
expect(result.startCellIndex).toBe(0);
|
|
63
64
|
});
|
|
64
65
|
|
|
65
|
-
it("
|
|
66
|
+
it("keeps cells with no output for the minimap", () => {
|
|
66
67
|
const result = computeSlideCellsInfo(
|
|
67
68
|
[cell("a"), cell("b", null), cell("c")],
|
|
68
69
|
layoutOf([]),
|
|
69
70
|
);
|
|
70
|
-
expect(result.
|
|
71
|
+
expect(result.slideCells.map((c) => c.id)).toEqual(["a", "b", "c"]);
|
|
72
|
+
expect([...result.noOutputIds]).toEqual(["b"]);
|
|
73
|
+
expect([...result.skippedIds]).toEqual(["b"]);
|
|
71
74
|
});
|
|
72
75
|
|
|
73
|
-
it("
|
|
76
|
+
it("keeps cells whose output data is empty string for the minimap", () => {
|
|
74
77
|
// Mirrors the editor contract: an explicit empty-string payload means the
|
|
75
|
-
// cell rendered nothing, so it should not occupy a slide.
|
|
78
|
+
// cell rendered nothing, so it should not occupy a reveal slide.
|
|
76
79
|
const result = computeSlideCellsInfo(
|
|
77
80
|
[cell("a"), cell("b", { data: "" }), cell("c")],
|
|
78
81
|
layoutOf([]),
|
|
79
82
|
);
|
|
80
|
-
expect(result.
|
|
83
|
+
expect(result.slideCells.map((c) => c.id)).toEqual(["a", "b", "c"]);
|
|
84
|
+
expect([...result.noOutputIds]).toEqual(["b"]);
|
|
85
|
+
expect([...result.skippedIds]).toEqual(["b"]);
|
|
81
86
|
});
|
|
82
87
|
|
|
83
88
|
it("keeps cells whose output data is a non-empty value (including falsy ones)", () => {
|
|
@@ -91,7 +96,8 @@ describe("computeSlideCellsInfo", () => {
|
|
|
91
96
|
],
|
|
92
97
|
layoutOf([]),
|
|
93
98
|
);
|
|
94
|
-
expect(result.
|
|
99
|
+
expect(result.slideCells.map((c) => c.id)).toEqual(["a", "b", "c"]);
|
|
100
|
+
expect(result.noOutputIds.size).toBe(0);
|
|
95
101
|
});
|
|
96
102
|
|
|
97
103
|
it("populates slideTypes only for cells with an explicit type", () => {
|
|
@@ -121,14 +127,12 @@ describe("computeSlideCellsInfo", () => {
|
|
|
121
127
|
expect([...result.skippedIds]).toEqual(["b", "c"]);
|
|
122
128
|
// Skipped cells are still "visible" deck cells — they just aren't rendered
|
|
123
129
|
// in reveal. The minimap relies on the full list plus skippedIds.
|
|
124
|
-
expect(result.
|
|
130
|
+
expect(result.slideCells.map((c) => c.id)).toEqual(["a", "b", "c"]);
|
|
125
131
|
expect(result.slideTypes.get(cellId("b"))).toBe("skip");
|
|
126
132
|
});
|
|
127
133
|
|
|
128
|
-
it("
|
|
129
|
-
//
|
|
130
|
-
// the user deleted its code), it should drop out of both maps — otherwise
|
|
131
|
-
// the skip set would reference ghosts.
|
|
134
|
+
it("preserves configured slide types for cells that have no output", () => {
|
|
135
|
+
// The missing output is transient runtime state, not persisted slide config.
|
|
132
136
|
const result = computeSlideCellsInfo(
|
|
133
137
|
[cell("a"), cell("b", null)],
|
|
134
138
|
layoutOf([
|
|
@@ -136,16 +140,25 @@ describe("computeSlideCellsInfo", () => {
|
|
|
136
140
|
["b", { type: "skip" }],
|
|
137
141
|
]),
|
|
138
142
|
);
|
|
139
|
-
expect(result.
|
|
140
|
-
expect(result.
|
|
141
|
-
expect(result.
|
|
143
|
+
expect(result.slideCells.map((c) => c.id)).toEqual(["a", "b"]);
|
|
144
|
+
expect([...result.noOutputIds]).toEqual(["b"]);
|
|
145
|
+
expect([...result.skippedIds]).toEqual(["b"]);
|
|
146
|
+
expect(result.slideTypes.get(cellId("b"))).toBe("skip");
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it("skips no-output cells when computing the starting cell", () => {
|
|
150
|
+
const result = computeSlideCellsInfo(
|
|
151
|
+
[cell("a", null), cell("b", { data: "" }), cell("c")],
|
|
152
|
+
layoutOf([]),
|
|
153
|
+
);
|
|
154
|
+
expect(result.startCellIndex).toBe(2);
|
|
142
155
|
});
|
|
143
156
|
|
|
144
|
-
it("preserves the input order of cells in
|
|
157
|
+
it("preserves the input order of cells in slideCells", () => {
|
|
145
158
|
const result = computeSlideCellsInfo(
|
|
146
159
|
[cell("c"), cell("a"), cell("b")],
|
|
147
160
|
layoutOf([]),
|
|
148
161
|
);
|
|
149
|
-
expect(result.
|
|
162
|
+
expect(result.slideCells.map((c) => c.id)).toEqual(["c", "a", "b"]);
|
|
150
163
|
});
|
|
151
164
|
});
|
|
@@ -9,32 +9,40 @@ export interface SlideCellLike {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export interface SlideCellsInfo<T extends SlideCellLike> {
|
|
12
|
-
|
|
12
|
+
slideCells: T[];
|
|
13
13
|
skippedIds: Set<CellId>;
|
|
14
|
+
noOutputIds: Set<CellId>;
|
|
14
15
|
slideTypes: Map<CellId, SlideType>;
|
|
15
|
-
// Index of the first cell in `
|
|
16
|
+
// Index of the first cell in `slideCells` that is not effectively skipped.
|
|
16
17
|
startCellIndex: number;
|
|
17
18
|
}
|
|
18
19
|
|
|
20
|
+
export function hasRenderableOutput(cell: SlideCellLike): boolean {
|
|
21
|
+
return cell.output != null && cell.output.data !== "";
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
export function computeSlideCellsInfo<T extends SlideCellLike>(
|
|
20
25
|
cells: readonly T[],
|
|
21
26
|
layout: Pick<SlidesLayout, "cells">,
|
|
22
27
|
): SlideCellsInfo<T> {
|
|
23
|
-
const
|
|
24
|
-
(cell) => cell.output != null && cell.output.data !== "",
|
|
25
|
-
);
|
|
28
|
+
const slideCells = [...cells];
|
|
26
29
|
const skippedIds = new Set<CellId>();
|
|
30
|
+
const noOutputIds = new Set<CellId>();
|
|
27
31
|
const slideTypes = new Map<CellId, SlideType>();
|
|
28
32
|
|
|
29
33
|
let startCell: T | null = null;
|
|
30
34
|
let startCellIndex = 0;
|
|
31
35
|
|
|
32
|
-
for (const [index, cell] of
|
|
36
|
+
for (const [index, cell] of slideCells.entries()) {
|
|
33
37
|
const type = layout.cells.get(cell.id)?.type;
|
|
38
|
+
const hasOutput = hasRenderableOutput(cell);
|
|
34
39
|
if (type) {
|
|
35
40
|
slideTypes.set(cell.id, type);
|
|
36
41
|
}
|
|
37
|
-
if (
|
|
42
|
+
if (!hasOutput) {
|
|
43
|
+
noOutputIds.add(cell.id);
|
|
44
|
+
}
|
|
45
|
+
if (type === "skip" || !hasOutput) {
|
|
38
46
|
skippedIds.add(cell.id);
|
|
39
47
|
} else if (startCell === null) {
|
|
40
48
|
startCell = cell;
|
|
@@ -42,8 +50,9 @@ export function computeSlideCellsInfo<T extends SlideCellLike>(
|
|
|
42
50
|
}
|
|
43
51
|
}
|
|
44
52
|
return {
|
|
45
|
-
|
|
53
|
+
slideCells,
|
|
46
54
|
skippedIds,
|
|
55
|
+
noOutputIds,
|
|
47
56
|
slideTypes,
|
|
48
57
|
startCellIndex,
|
|
49
58
|
};
|
|
@@ -30,19 +30,17 @@ export const SlidesLayoutRenderer: React.FC<Props> = ({
|
|
|
30
30
|
const isMultiColumn = numColumns > 1;
|
|
31
31
|
const [activeCellId, setActiveCellId] = useState<CellId | null>(null);
|
|
32
32
|
|
|
33
|
-
const {
|
|
34
|
-
() => computeSlideCellsInfo(cells, layout),
|
|
35
|
-
[cells, layout],
|
|
36
|
-
);
|
|
33
|
+
const { slideCells, skippedIds, noOutputIds, slideTypes, startCellIndex } =
|
|
34
|
+
useMemo(() => computeSlideCellsInfo(cells, layout), [cells, layout]);
|
|
37
35
|
|
|
38
36
|
const activeSlideIndex = activeCellId
|
|
39
|
-
?
|
|
37
|
+
? slideCells.findIndex((c) => c.id === activeCellId)
|
|
40
38
|
: startCellIndex;
|
|
41
39
|
const resolvedIndex =
|
|
42
40
|
activeSlideIndex === -1 ? startCellIndex : activeSlideIndex;
|
|
43
41
|
|
|
44
42
|
const handleSlideChange = useEvent((index: number) => {
|
|
45
|
-
const cell =
|
|
43
|
+
const cell = slideCells[index];
|
|
46
44
|
if (cell) {
|
|
47
45
|
setActiveCellId(cell.id);
|
|
48
46
|
}
|
|
@@ -50,9 +48,10 @@ export const SlidesLayoutRenderer: React.FC<Props> = ({
|
|
|
50
48
|
|
|
51
49
|
const slides = (
|
|
52
50
|
<LazySlidesComponent
|
|
53
|
-
|
|
51
|
+
slideCells={slideCells}
|
|
54
52
|
layout={layout}
|
|
55
53
|
setLayout={setLayout}
|
|
54
|
+
noOutputIds={noOutputIds}
|
|
56
55
|
activeIndex={resolvedIndex}
|
|
57
56
|
onSlideChange={handleSlideChange}
|
|
58
57
|
configWidth={280}
|
|
@@ -85,13 +84,12 @@ export const SlidesLayoutRenderer: React.FC<Props> = ({
|
|
|
85
84
|
return (
|
|
86
85
|
<div className="flex-1 pr-18 pb-2 flex flex-row gap-2 min-h-0">
|
|
87
86
|
<SlidesMinimap
|
|
88
|
-
cells={
|
|
87
|
+
cells={slideCells}
|
|
89
88
|
thumbnailWidth={220}
|
|
90
89
|
canReorder={!isMultiColumn}
|
|
91
|
-
activeCellId={
|
|
92
|
-
activeCellId ?? cellsWithOutput[startCellIndex]?.id ?? null
|
|
93
|
-
}
|
|
90
|
+
activeCellId={activeCellId ?? slideCells[startCellIndex]?.id ?? null}
|
|
94
91
|
skippedIds={skippedIds}
|
|
92
|
+
noOutputIds={noOutputIds}
|
|
95
93
|
slideTypes={slideTypes}
|
|
96
94
|
onSlideClick={handleSlideChange}
|
|
97
95
|
/>
|