@marimo-team/frontend 0.24.1-dev10 → 0.24.1-dev11
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/{add-cell-with-ai-Bg0VJ1RI.js → add-cell-with-ai-C5JH9LS2.js} +1 -1
- package/dist/assets/{agent-panel-E3KZlygO.js → agent-panel-D7DLUBam.js} +1 -1
- package/dist/assets/{ai-model-dropdown-g49r1wqa.js → ai-model-dropdown-DWDm50eM.js} +4 -4
- package/dist/assets/{app-config-button-CKy0e-KL.js → app-config-button-DhZke6rt.js} +1 -1
- package/dist/assets/{cell-editor-1OeZIuhU.js → cell-editor-B1XuGiJU.js} +5 -5
- package/dist/assets/{chat-display-mkz-zuZI.js → chat-display-CR9X_gwB.js} +1 -1
- package/dist/assets/{chat-panel-T7HagF03.js → chat-panel-DnGBFlLk.js} +1 -1
- package/dist/assets/{chat-ui-LLM6wWNd.js → chat-ui-BVFULpKr.js} +1 -1
- package/dist/assets/{command-palette-CrL7qYTw.js → command-palette-BmVRprpP.js} +1 -1
- package/dist/assets/{edit-page-CZXyH2lw.js → edit-page-COptmWLK.js} +6 -6
- package/dist/assets/{home-page-BkL-m7rQ.js → home-page-Dwl_Carc.js} +1 -1
- package/dist/assets/{index-h_pKEkiy.js → index-CvqoLM43.js} +3 -3
- package/dist/assets/{layout-CFJK8lGt.js → layout-CsRkTidf.js} +2 -2
- package/dist/assets/{packages-panel-CBntOYOs.js → packages-panel-ItQn6qH4.js} +1 -1
- package/dist/assets/{panels-Cmq_7QuQ.js → panels-DnBAh8y9.js} +1 -1
- package/dist/assets/{reveal-component-CvKpfAMl.js → reveal-component-DgFIj2TQ.js} +1 -1
- package/dist/assets/{run-page-DSI-PP21.js → run-page-CCZKEWid.js} +1 -1
- package/dist/assets/{scratchpad-panel-DUKOmuWE.js → scratchpad-panel-DXuBKn4N.js} +1 -1
- package/dist/assets/{skeleton-Clf6EBLu.js → skeleton-DapNw_f4.js} +1 -1
- package/dist/assets/{useNotebookActions-CZaPneWs.js → useNotebookActions-Dd3eLoIZ.js} +2 -2
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/components/app-config/optional-features.test.ts +78 -0
- package/src/components/app-config/optional-features.tsx +33 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as Ke}from"./chunk-C4rtOYze.js";import{d as ce,i as ma,l as _e,p as pa,u as ee}from"./useEvent-GCVIknuR.js";import{t as ha}from"./react-C60yClUi.js";import{$n as fa,Bn as ba,E as Ye,Gn as Je,Hn as xa,Hr as Xe,In as ya,Ir as Qe,Jt as ka,Kr as ga,Lr as Ze,Nt as et,Rr as va,T as wa,Vn as ja,Vr as Na,Wn as Ca,Yi as Sa,bi as za,ea as Ia,fa as Le,g as Ma,ia as tt,m as at,t as Oa,y as _a}from"./cells-BvgwUKB9.js";import{P as st,T as he,b as je}from"./zod-BIDX-mZr.js";import{t as W}from"./compiler-runtime-DnimoHo0.js";import{
|
|
1
|
+
import{o as Ke}from"./chunk-C4rtOYze.js";import{d as ce,i as ma,l as _e,p as pa,u as ee}from"./useEvent-GCVIknuR.js";import{t as ha}from"./react-C60yClUi.js";import{$n as fa,Bn as ba,E as Ye,Gn as Je,Hn as xa,Hr as Xe,In as ya,Ir as Qe,Jt as ka,Kr as ga,Lr as Ze,Nt as et,Rr as va,T as wa,Vn as ja,Vr as Na,Wn as Ca,Yi as Sa,bi as za,ea as Ia,fa as Le,g as Ma,ia as tt,m as at,t as Oa,y as _a}from"./cells-BvgwUKB9.js";import{P as st,T as he,b as je}from"./zod-BIDX-mZr.js";import{t as W}from"./compiler-runtime-DnimoHo0.js";import{C as La,n as Fa,r as Pa}from"./ai-model-dropdown-DWDm50eM.js";import{g as ue,n as Wa}from"./useEventListener-DpNnLPuE.js";import{t as nt}from"./objects-CrbstYTV.js";import{C as Ea,r as Aa}from"./utils-C8Yt16Y7.js";import{n as B,t as ot}from"./constants-DifUxsbZ.js";import{A as qa,M as rt,N as fe,O as Da,T as it,j as Ra,k as Ta,v as lt}from"./config-DFK5eCC3.js";import{t as $a}from"./switch-ulnbZFaI.js";import{c as Ha}from"./readonly-python-code-BCOkadQf.js";import{t as be}from"./cn-DCUzRj2J.js";import{t as Va}from"./jsx-runtime-3wZU7vFS.js";import{o as Ba}from"./alert-dialog-D_kB5FIu.js";import{a as Ua,c as Ga,o as Ka,s as Ya}from"./popover-B96fOqfH.js";import{a as Ja,c as dt,i as ct,n as ut,r as Xa,s as mt,t as pt}from"./select-CPo-KTTe.js";import{$ as Qa,Lt as ht}from"./JsonOutput-C5g_bqiZ.js";import{a as Za,c as es,o as ts,p as me,t as as}from"./download-B8NwKEtr.js";import{n as ss,t as ns}from"./radio-group-CSwRGU0A.js";import{t as os}from"./tooltip-C9LWGQ7Y.js";import{n as rs,r as is,t as oe}from"./button-W__YVea9.js";import{i as ls,r as ft,t as Fe}from"./strings-DmKKoXrM.js";import{r as re}from"./requests-B9zEd_sW.js";import{t as _}from"./createLucideIcon-B8oVfJNp.js";import{F as ds,I as cs,L as bt,P as xt,a as yt,i as kt,u as us}from"./layout-CsRkTidf.js";import{t as gt}from"./check-CyyJPf_5.js";import{r as ms}from"./useCellActionButton-D8qyXNKv.js";import{t as Pe}from"./code-DzY0vbKf.js";import{t as ps}from"./copy-DlR5UiIE.js";import{t as vt}from"./eye-off-DfXRjba3.js";import{t as wt}from"./external-link-C8y9rFms.js";import{t as xe}from"./file-BjlLTeSV.js";import{t as jt}from"./globe-C2tUp3NL.js";import{n as hs,r as fs,t as bs}from"./youtube-Bm-0BwCx.js";import{n as xs}from"./components-CozWCL5N.js";import{i as ys,n as ks,r as gs}from"./markdown-export-D-ZHIs71.js";import{t as Nt}from"./image-Dvcyi0uu.js";import{t as vs}from"./link-DCLOj_aN.js";import{t as Ne}from"./spinner-Cj3eM5bt.js";import{r as ws}from"./input-BN98e517.js";import{t as js}from"./settings-IZvUqDP4.js";import{t as Ns}from"./sparkles-DwqcWrJl.js";import{g as Cs}from"./form-BvzcNsxB.js";import{t as Ss}from"./square-DVd8Y612.js";import{t as Ct}from"./triangle-alert-DGiOSARf.js";import{t as de}from"./use-toast-DjpWVza6.js";import{n as We,t as zs}from"./paths-D5zczhUD.js";import{o as Is}from"./session-D-SddyN0.js";import{n as Ce}from"./copy-HCSOwOwk.js";import{t as Ee}from"./copy-icon-Cn8LzPNx.js";import{r as Ms}from"./useRunCells-DjQN3XYP.js";import{a as Ae,c as qe,i as Os,n as De,r as Re}from"./dialog-WU4x2UpK.js";import{n as Se}from"./ImperativeModal-Dxj31V4A.js";import{r as _s,t as St}from"./share-c5Zh8BM8.js";import{n as zt,t as It}from"./alert-CHWQT4zh.js";import{a as Mt}from"./cell-link-WDIIwzUn.js";import{n as Te}from"./useAsyncData-BcvSvTUt.js";import{t as Ls}from"./icons-BwSNDWAP.js";import{i as Fs,n as Ot}from"./error-entries-yYB8PZoo.js";import{n as _t,t as Ps}from"./pair-with-agent-modal-DiDLAjxV.js";import{n as Lt}from"./add-connection-dialog-DHyonb9T.js";import{t as Ws}from"./github-6F3RzPv3.js";import{n as Ft}from"./marimo-icons-CW8-Txe-.js";import{t as Es}from"./links-STGde2qx.js";import{i as As,n as qs,t as $e}from"./skeleton-DapNw_f4.js";import{t as Pt}from"./types-C7hjolXC.js";var Ds=_("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Rs=_("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Wt=_("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"}]]),Et=_("cloud-download",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]]),At=_("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"}]]),qt=_("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"}]]),Ts=_("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"}]]),$s=_("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"}]]),Hs=_("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"}]]),Dt=_("message-circle-question-mark",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Rt=_("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"}]]),Vs=_("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Tt=_("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"}]]),Bs=_("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"}]]),Us=_("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"}]]),$t=_("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"}]]),Gs=W(),L=Ke(ha(),1);function He(t,e){let s=(0,Gs.c)(11),n;s[0]===e?n=s[1]:(n=new Sa(e),s[0]=e,s[1]=n);let i=n,l;s[2]!==t||s[3]!==i?(l=()=>i.get(t),s[2]=t,s[3]=i,s[4]=l):l=s[4];let[o,r]=(0,L.useState)(l),d;s[5]!==t||s[6]!==i?(d=m=>{r(m),i.set(t,m)},s[5]=t,s[6]=i,s[7]=d):d=s[7];let c=d,u;return s[8]!==c||s[9]!==o?(u=[o,c],s[8]=c,s[9]=o,s[10]=u):u=s[10],u}function Ks(t,e){return{...t,Binaries:{...t.Binaries,Browser:e}}}function Ys(t,e,s,n){return{marimo:t,Locale:s||void 0,Binaries:{Browser:e},"Environment Collection Error":n}}function Ve(t,e){let s=Math.max(2,...Array.from(e.matchAll(/`+/g),i=>i[0].length)),n="`".repeat(s+1);return`${n}${t}
|
|
2
2
|
${e}
|
|
3
3
|
${n}`}function Js(t,e){let s=t.includes("?")?"&":"?",n=[],i=t,l=0;for(let[o,r]of Object.entries(e)){if(r.length===0)continue;let d=`${o}=${encodeURIComponent(r)}`,c=`${i}${l===0?s:"&"}${d}`;if(c.length>6e3){n.push(o);continue}i=c,l+=1}return{url:i,omitted:n}}function Be(t,e){return["<details>",`<summary>${Fe.htmlEscape(t)??""}</summary>`,"",e,"","</details>"].join(`
|
|
4
4
|
`)}function Xs(t){return Be("Environment",Ve("json",JSON.stringify(t,null,2)))}function Ht(t){return Be("Errors",Ve("text",t.map(Ot).join(`
|
|
@@ -9,4 +9,4 @@ ${n}`}function Js(t,e){let s=t.includes("?")?"&":"?",n=[],i=t,l=0;for(let[o,r]of
|
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
`)})]}),f&&i.length===0&&(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:"No errors detected."}),(0,a.jsx)("div",{className:"border-t pt-3",children:(0,a.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Other feedback? Take our"," ",(0,a.jsx)("a",{href:B.feedbackForm,target:"_blank",rel:"noreferrer",className:"underline",children:"two-minute survey"})," ","or chat with us on"," ",(0,a.jsx)("a",{href:B.discordLink,target:"_blank",rel:"noreferrer",className:"underline",children:"Discord"}),"."]})})]})]})};function tn(t){return!t}var Gt=W(),ze="https://static.marimo.app";const an=t=>{let e=(0,Gt.c)(25),{onClose:s}=t,[n,i]=(0,L.useState)(""),{exportAsHTML:l}=re(),o=`${n}-${Math.random().toString(36).slice(2,6)}`,r=`${ze}/static/${o}`,d;e[0]!==l||e[1]!==s||e[2]!==o?(d=async x=>{x.preventDefault(),s();let{contents:w}=await l({download:!1,includeCode:!0,files:xt.INSTANCE.filenames()}),v=de({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${ze}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:w,path:o})}).catch(()=>{v.dismiss(),de({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:B.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),v.dismiss(),de({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."]})})},e[0]=l,e[1]=s,e[2]=o,e[3]=d):d=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.jsx)(qe,{children:"Share static notebook"}),e[4]=c):c=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsxs)(Ae,{children:[c,(0,a.jsxs)(Re,{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:ze,target:"_blank",children:ze}),"."]})]}),e[5]=u):u=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=x=>{i(x.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},e[6]=m):m=e[6];let h;e[7]===n?h=e[8]:(h=(0,a.jsx)(ws,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:n,placeholder:"Notebook slug",onChange:m,required:!0,autoComplete:"off"}),e[7]=n,e[8]=h);let b;e[9]===r?b=e[10]:(b=(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)(sn,{text:r}),(0,a.jsx)("span",{className:"text-primary",children:r})]})]}),e[9]=r,e[10]=b);let f;e[11]!==h||e[12]!==b?(f=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[h,b]}),e[11]=h,e[12]=b,e[13]=f):f=e[13];let p;e[14]===s?p=e[15]:(p=(0,a.jsx)(oe,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:s,children:"Cancel"}),e[14]=s,e[15]=p);let k;e[16]===r?k=e[17]:(k=(0,a.jsx)(oe,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await Ce(r)},children:"Create"}),e[16]=r,e[17]=k);let y;e[18]!==p||e[19]!==k?(y=(0,a.jsxs)(Os,{children:[p,k]}),e[18]=p,e[19]=k,e[20]=y):y=e[20];let g;return e[21]!==d||e[22]!==y||e[23]!==f?(g=(0,a.jsx)(De,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[u,f,y]})}),e[21]=d,e[22]=y,e[23]=f,e[24]=g):g=e[24],g};var sn=t=>{let e=(0,Gt.c)(8),[s,n]=L.useState(!1),i;e[0]===t.text?i=e[1]:(i=is.stopPropagation(async c=>{c.preventDefault(),await Ce(t.text),n(!0),setTimeout(()=>n(!1),2e3)}),e[0]=t.text,e[1]=i);let l=i,o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=(0,a.jsx)(ps,{size:14,strokeWidth:1.5}),e[2]=o):o=e[2];let r;e[3]===l?r=e[4]:(r=(0,a.jsx)(oe,{"data-testid":"copy-static-notebook-url-button",onClick:l,size:"xs",variant:"secondary",children:o}),e[3]=l,e[4]=r);let d;return e[5]!==s||e[6]!==r?(d=(0,a.jsx)(os,{content:"Copied!",open:s,children:r}),e[5]=s,e[6]=r,e[7]=d):d=e[7],d},nn=W();function on(){let t=document.getElementsByClassName(ot.outputArea);for(let e of t){let s=e.getBoundingClientRect();if(s.bottom>0&&s.top<window.innerHeight){let n=Le.findElement(e);if(!n){ue.warn("Could not find HTMLCellId for visible output area",e);continue}return{cellId:Le.parse(n.id)}}}return ue.warn("No visible output area found for scroll anchor"),null}function rn(t){if(!t){ue.warn("No scroll anchor provided to restore scroll position");return}let e=document.getElementById(Le.create(t.cellId));if(!e){ue.warn("Could not find cell element to restore scroll position",t.cellId);return}if(!e.querySelector(`.${ot.outputArea}`)){ue.warn("Could not find output area to restore scroll position",t.cellId);return}e.scrollIntoView({block:"start",behavior:"auto"})}function Kt(){let t=(0,nn.c)(2),e=ce(rt),s;return t[0]===e?s=t[1]:(s=()=>{let n=on();e(i=>({mode:qa(i.mode),cellAnchor:(n==null?void 0:n.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{rn(n)})})},t[0]=e,t[1]=s),s}const Yt=pa(!1);var ln=W();const dn=()=>{let t=(0,ln.c)(7),{selectedLayout:e}=yt(),{setLayoutView:s}=kt();if(fe()&&!fa("wasm_layouts"))return null;let n;t[0]===s?n=t[1]:(n=r=>s(r),t[0]=s,t[1]=n);let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)(mt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(dt,{placeholder:"Select a view"})}),t[2]=i):i=t[2];let l;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(ut,{children:(0,a.jsxs)(Xa,{children:[(0,a.jsx)(Ja,{children:"View as"}),Pt.map(un)]})}),t[3]=l):l=t[3];let o;return t[4]!==e||t[5]!==n?(o=(0,a.jsxs)(pt,{"data-testid":"layout-select",value:e,onValueChange:n,children:[i,l]}),t[4]=e,t[5]=n,t[6]=o):o=t[6],o};function cn(t){return(0,a.jsx)(Jt(t),{className:"h-4 w-4"})}function Jt(t){switch(t){case"vertical":return Hs;case"grid":return fs;case"slides":return Tt;default:return ls(t),Ss}}function Xt(t){return Fe.startCase(t)}function un(t){return(0,a.jsx)(ct,{value:t,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[cn(t),(0,a.jsx)("span",{children:Xt(t)})]})},t)}const Qt=["html","markdown","ipynb","pdf","script","png"],Zt=["pymdown","qmd","mystmd","mdx"],ea=["topological","top-down"],ta=["document","slides"],aa=["source","flat"];function sa(t){return typeof t=="string"&&Qt.some(e=>e===t)}const U={html:{includeCode:!0},markdown:{flavor:null},ipynb:{sortMode:"topological",includeOutputs:!1},pdf:{preset:"document",includeInputs:!0,includeOutputs:!0,webpdf:!0},script:{type:"source"}};function te(t,e){return t.default(e).catch(e)}function ye(t){return st(t).optional().catch(void 0)}var mn=st({html:ye({includeCode:te(he(),U.html.includeCode)}),markdown:ye({flavor:te(je(Zt).nullable(),U.markdown.flavor)}),ipynb:ye({sortMode:te(je(ea),U.ipynb.sortMode),includeOutputs:te(he(),U.ipynb.includeOutputs)}),pdf:ye({preset:te(je(ta),U.pdf.preset),includeInputs:te(he(),U.pdf.includeInputs),includeOutputs:te(he(),U.pdf.includeOutputs),webpdf:te(he(),U.pdf.webpdf)}),script:ye({type:te(je(aa),U.script.type)})}).catch({});function na(t,e){let s={...t},n=i=>{s[i]={...t[i],...e[i]}};for(let i of Object.keys(e))n(i);return s}function pn(t){return na(U,mn.parse(t))}const oa=tt("marimo:export:options:v1",U,Je({toSerializable:t=>t,fromSerializable:pn}),{getOnInit:!0}),hn=tt("marimo:export:last-format:v1","html",Je({toSerializable:t=>t,fromSerializable:t=>sa(t)?t:"html"}),{getOnInit:!0});var ra={html:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!1,checksServerAvailability:!1},markdown:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!1,checksServerAvailability:!1},ipynb:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!0,checksServerAvailability:!0},pdf:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!0,checksServerAvailability:!0},script:{requiresNamedNotebookOnServer:!1,requiresServerRuntime:!1,checksServerAvailability:!1},png:{requiresNamedNotebookOnServer:!1,requiresServerRuntime:!1,checksServerAvailability:!1}};function ia(t,e){return t==="wasm"&&e==="pdf"}function fn({format:t,options:e,runtime:s,filename:n,availability:i}){let l=t==="script"&&e.script.type==="source"?{...ra.script,requiresNamedNotebookOnServer:!0}:ra[t],o=ia(s,t);if(s==="wasm"&&l.requiresServerRuntime)return{available:o,reason:{type:"wasm-runtime"}};if(s==="server"&&l.requiresNamedNotebookOnServer&&!n)return{available:!1,reason:{type:"notebook-must-be-named"}};if(s==="wasm"||!l.checksServerAvailability)return{available:!0};if(i.status==="pending")return{available:!1,reason:{type:"checking-requirements"}};if(i.status==="error"||!i.data)return{available:!0,availabilityCheckFailed:!0};let r=i.data.formats.find(d=>d.format===t);return r?r.dependenciesAvailable?{available:!0}:r.missingPackages.length>0?{available:!1,reason:{type:"missing-packages",packages:r.missingPackages}}:r.missingSetup.length>0?{available:!1,reason:{type:"missing-setup",requirements:r.missingSetup}}:{available:!0,availabilityCheckFailed:!0}:{available:!0,availabilityCheckFailed:!0}}var X=W();function ke(t,e){return t.map(s=>({value:s,...e[s]}))}var bn=ke(["automatic",...Zt],{automatic:{label:"Automatic",description:"Chooses a format from the notebook filename. Defaults to Markdown (.md)."},pymdown:{label:"Markdown (.md)",description:"Creates a .md file with Python code blocks."},qmd:{label:"Quarto (.qmd)",description:"Creates a .qmd file for Quarto."},mystmd:{label:"MyST (.myst.md)",description:"Creates a .myst.md file for MyST."},mdx:{label:"MDX (.mdx)",description:"Creates a .mdx file for MDX."}}),xn=ke(ea,{"top-down":{label:"Top to bottom",description:"Keeps cells in the same order as this notebook."},topological:{label:"Dependency order",description:"Reorders cells so each cell appears after the cells it depends on."}}),yn=ke(ta,{document:{label:"Document",description:"Creates pages for reading or printing."},slides:{label:"Slides",description:"Creates presentation slides from the notebook."}}),kn=ke(["browser","latex"],{browser:{label:"Browser",description:"Uses browser rendering to preserve the notebook's visual output."},latex:{label:"LaTeX first",description:"Uses Pandoc and TeX when available, then falls back to browser rendering."}}),gn=ke(aa,{source:{label:"Notebook source",description:"Downloads the saved notebook source for continued editing in marimo."},flat:{label:"Flat script",description:"Reorders cells so the Python script runs from top to bottom."}});const Ue={html:{label:"HTML",actionLabel:"Export HTML",description:"Save the current notebook as an HTML page.",Icon:jt,Options:vn},markdown:{label:"Markdown",actionLabel:"Export Markdown",description:"Save code and text in a Markdown-based file. Cell outputs are not included.",Icon:Qe,Options:wn},ipynb:{label:"Jupyter",actionLabel:"Export Jupyter notebook",description:"Open the notebook in Jupyter and other compatible tools.",Icon:Rt,Options:jn},pdf:{label:"PDF",actionLabel:"Export PDF",description:"Save the notebook as a PDF for printing or sharing.",Icon:xe,Options:Nn},script:{label:"Python",actionLabel:"Export flat script",description:"Save the notebook as a Python file.",Icon:Pe,Options:Cn},png:{label:"PNG",actionLabel:"Export PNG",description:"Capture the current app view as an image.",Icon:Nt,Options:Sn}};function vn(t){let e=(0,X.c)(7),{options:s,updateOptions:n,disabled:i}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={checked:"Includes code cells in the webpage.",unchecked:"Leaves code cells out of the webpage."},e[0]=l):l=e[0];let o;e[1]===n?o=e[2]:(o=d=>n("html",{includeCode:d}),e[1]=n,e[2]=o);let r;return e[3]!==i||e[4]!==s.html.includeCode||e[5]!==o?(r=(0,a.jsx)(ge,{children:(0,a.jsx)(Ie,{label:"Include code",descriptions:l,checked:s.html.includeCode,disabled:i,onCheckedChange:o})}),e[3]=i,e[4]=s.html.includeCode,e[5]=o,e[6]=r):r=e[6],r}function wn(t){let e=(0,X.c)(6),{options:s,updateOptions:n,disabled:i}=t,l=s.markdown.flavor??"automatic",o;e[0]===n?o=e[1]:(o=d=>n("markdown",{flavor:d==="automatic"?null:d}),e[0]=n,e[1]=o);let r;return e[2]!==i||e[3]!==l||e[4]!==o?(r=(0,a.jsx)(ge,{children:(0,a.jsx)(In,{label:"Format",value:l,disabled:i,onValueChange:o,options:bn})}),e[2]=i,e[3]=l,e[4]=o,e[5]=r):r=e[5],r}function jn(t){let e=(0,X.c)(16),{options:s,updateOptions:n,disabled:i}=t,l;e[0]===n?l=e[1]:(l=m=>n("ipynb",{sortMode:m}),e[0]=n,e[1]=l);let o;e[2]!==i||e[3]!==s.ipynb.sortMode||e[4]!==l?(o=(0,a.jsx)(Me,{label:"Cell order",value:s.ipynb.sortMode,disabled:i,onValueChange:l,options:xn}),e[2]=i,e[3]=s.ipynb.sortMode,e[4]=l,e[5]=o):o=e[5];let r;e[6]===Symbol.for("react.memo_cache_sentinel")?(r={checked:"Keeps the outputs currently shown in the notebook.",unchecked:"Leaves cell outputs out of the Jupyter notebook."},e[6]=r):r=e[6];let d;e[7]===n?d=e[8]:(d=m=>n("ipynb",{includeOutputs:m}),e[7]=n,e[8]=d);let c;e[9]!==i||e[10]!==s.ipynb.includeOutputs||e[11]!==d?(c=(0,a.jsx)(Ie,{label:"Include outputs",descriptions:r,checked:s.ipynb.includeOutputs,disabled:i,onCheckedChange:d}),e[9]=i,e[10]=s.ipynb.includeOutputs,e[11]=d,e[12]=c):c=e[12];let u;return e[13]!==o||e[14]!==c?(u=(0,a.jsxs)(ge,{children:[o,c]}),e[13]=o,e[14]=c,e[15]=u):u=e[15],u}function Nn(t){let e=(0,X.c)(30),{options:s,updateOptions:n,disabled:i}=t,l;e[0]===n?l=e[1]:(l=p=>n("pdf",{preset:p}),e[0]=n,e[1]=l);let o;e[2]!==i||e[3]!==s.pdf.preset||e[4]!==l?(o=(0,a.jsx)(Me,{label:"Layout",value:s.pdf.preset,disabled:i,onValueChange:l,options:yn}),e[2]=i,e[3]=s.pdf.preset,e[4]=l,e[5]=o):o=e[5];let r;e[6]===Symbol.for("react.memo_cache_sentinel")?(r={checked:"Includes code cells in the PDF.",unchecked:"Leaves code cells out of the PDF."},e[6]=r):r=e[6];let d;e[7]===n?d=e[8]:(d=p=>n("pdf",{includeInputs:p}),e[7]=n,e[8]=d);let c;e[9]!==i||e[10]!==s.pdf.includeInputs||e[11]!==d?(c=(0,a.jsx)(Ie,{label:"Include code",descriptions:r,checked:s.pdf.includeInputs,disabled:i,onCheckedChange:d}),e[9]=i,e[10]=s.pdf.includeInputs,e[11]=d,e[12]=c):c=e[12];let u;e[13]===Symbol.for("react.memo_cache_sentinel")?(u={checked:"Keeps the outputs currently shown in the notebook.",unchecked:"Leaves cell outputs out of the PDF."},e[13]=u):u=e[13];let m;e[14]===n?m=e[15]:(m=p=>n("pdf",{includeOutputs:p}),e[14]=n,e[15]=m);let h;e[16]!==i||e[17]!==s.pdf.includeOutputs||e[18]!==m?(h=(0,a.jsx)(Ie,{label:"Include outputs",descriptions:u,checked:s.pdf.includeOutputs,disabled:i,onCheckedChange:m}),e[16]=i,e[17]=s.pdf.includeOutputs,e[18]=m,e[19]=h):h=e[19];let b;e[20]!==i||e[21]!==s.pdf.preset||e[22]!==s.pdf.webpdf||e[23]!==n?(b=s.pdf.preset==="document"?(0,a.jsx)(Me,{label:"Method",value:s.pdf.webpdf?"browser":"latex",disabled:i,onValueChange:p=>n("pdf",{webpdf:p==="browser"}),options:kn}):null,e[20]=i,e[21]=s.pdf.preset,e[22]=s.pdf.webpdf,e[23]=n,e[24]=b):b=e[24];let f;return e[25]!==o||e[26]!==c||e[27]!==h||e[28]!==b?(f=(0,a.jsxs)(ge,{children:[o,c,h,b]}),e[25]=o,e[26]=c,e[27]=h,e[28]=b,e[29]=f):f=e[29],f}function Cn(t){let e=(0,X.c)(6),{options:s,updateOptions:n,disabled:i}=t,l;e[0]===n?l=e[1]:(l=r=>n("script",{type:r}),e[0]=n,e[1]=l);let o;return e[2]!==i||e[3]!==s.script.type||e[4]!==l?(o=(0,a.jsx)(ge,{children:(0,a.jsx)(Me,{label:"Format",value:s.script.type,disabled:i,onValueChange:l,options:gn})}),e[2]=i,e[3]=s.script.type,e[4]=l,e[5]=o):o=e[5],o}function Sn(){return null}function ge(t){let e=(0,X.c)(2),{children:s}=t,n;return e[0]===s?n=e[1]:(n=(0,a.jsx)("div",{className:"divide-y rounded-md border",children:s}),e[0]=s,e[1]=n),n}function Ie(t){let e=(0,X.c)(26),{label:s,descriptions:n,descriptionOverride:i,checked:l,disabled:o,onCheckedChange:r}=t,d=(0,L.useId)(),c=`${d}-description`,u=i??(l?n.checked:n.unchecked),m;e[0]===i?m=e[1]:(m=i?[i]:[],e[0]=i,e[1]=m);let h;e[2]!==n.checked||e[3]!==n.unchecked||e[4]!==m?(h=[n.checked,n.unchecked,...m],e[2]=n.checked,e[3]=n.unchecked,e[4]=m,e[5]=h):h=e[5];let b=h,f;e[6]!==d||e[7]!==s?(f=(0,a.jsx)("label",{htmlFor:d,className:"text-sm font-medium leading-5",children:s}),e[6]=d,e[7]=s,e[8]=f):f=e[8];let p;e[9]!==u||e[10]!==c||e[11]!==b?(p=(0,a.jsx)(Ge,{id:c,description:u,possibleDescriptions:b}),e[9]=u,e[10]=c,e[11]=b,e[12]=p):p=e[12];let k;e[13]!==f||e[14]!==p?(k=(0,a.jsxs)("div",{className:"min-w-0",children:[f,p]}),e[13]=f,e[14]=p,e[15]=k):k=e[15];let y;e[16]!==l||e[17]!==c||e[18]!==o||e[19]!==d||e[20]!==s||e[21]!==r?(y=(0,a.jsx)($a,{id:d,size:"sm",checked:l,disabled:o,onCheckedChange:r,"aria-label":s,"aria-describedby":c}),e[16]=l,e[17]=c,e[18]=o,e[19]=d,e[20]=s,e[21]=r,e[22]=y):y=e[22];let g;return e[23]!==k||e[24]!==y?(g=(0,a.jsxs)("div",{className:"flex min-h-14 items-center justify-between gap-4 px-3 py-2",children:[k,y]}),e[23]=k,e[24]=y,e[25]=g):g=e[25],g}function Me(t){var w;let e=(0,X.c)(31),{label:s,value:n,disabled:i,onValueChange:l,options:o}=t,r=(0,L.useId)(),d=`${r}-description`,c;e[0]!==o||e[1]!==n?(c=(w=o.find(v=>v.value===n))==null?void 0:w.description,e[0]=o,e[1]=n,e[2]=c):c=e[2];let u=c,m;e[3]===s?m=e[4]:(m=(0,a.jsx)("div",{className:"text-sm font-medium leading-5",children:s}),e[3]=s,e[4]=m);let h=u??"",b;e[5]===o?b=e[6]:(b=o.map(zn),e[5]=o,e[6]=b);let f;e[7]!==d||e[8]!==h||e[9]!==b?(f=(0,a.jsx)(Ge,{id:d,description:h,possibleDescriptions:b}),e[7]=d,e[8]=h,e[9]=b,e[10]=f):f=e[10];let p;e[11]!==m||e[12]!==f?(p=(0,a.jsxs)("div",{className:"min-w-0",children:[m,f]}),e[11]=m,e[12]=f,e[13]=p):p=e[13];let k;e[14]===l?k=e[15]:(k=v=>l(v),e[14]=l,e[15]=k);let y;if(e[16]!==r||e[17]!==o){let v;e[19]===r?v=e[20]:(v=(O,z)=>{let C=`${r}-${z}`;return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(ss,{id:C,value:O.value}),(0,a.jsx)("label",{htmlFor:C,className:"text-sm",children:O.label})]},O.value)},e[19]=r,e[20]=v),y=o.map(v),e[16]=r,e[17]=o,e[18]=y}else y=e[18];let g;e[21]!==d||e[22]!==i||e[23]!==s||e[24]!==k||e[25]!==y||e[26]!==n?(g=(0,a.jsx)(ns,{value:n,onValueChange:k,className:"flex shrink-0 flex-wrap gap-x-5 gap-y-2 sm:justify-end","aria-label":s,"aria-describedby":d,disabled:i,children:y}),e[21]=d,e[22]=i,e[23]=s,e[24]=k,e[25]=y,e[26]=n,e[27]=g):g=e[27];let x;return e[28]!==p||e[29]!==g?(x=(0,a.jsxs)("div",{className:"flex min-h-14 flex-col items-stretch gap-2 px-3 py-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4",children:[p,g]}),e[28]=p,e[29]=g,e[30]=x):x=e[30],x}function zn(t){return t.description}function In(t){var z;let e=(0,X.c)(34),{label:s,value:n,disabled:i,onValueChange:l,options:o}=t,r=(0,L.useId)(),d=`${r}-description`,c;e[0]!==o||e[1]!==n?(c=(z=o.find(C=>C.value===n))==null?void 0:z.description,e[0]=o,e[1]=n,e[2]=c):c=e[2];let u=c,m;e[3]!==r||e[4]!==s?(m=(0,a.jsx)("label",{htmlFor:r,className:"text-sm font-medium leading-5",children:s}),e[3]=r,e[4]=s,e[5]=m):m=e[5];let h=u??"",b;e[6]===o?b=e[7]:(b=o.map(On),e[6]=o,e[7]=b);let f;e[8]!==d||e[9]!==h||e[10]!==b?(f=(0,a.jsx)(Ge,{id:d,description:h,possibleDescriptions:b}),e[8]=d,e[9]=h,e[10]=b,e[11]=f):f=e[11];let p;e[12]!==m||e[13]!==f?(p=(0,a.jsxs)("div",{className:"min-w-0",children:[m,f]}),e[12]=m,e[13]=f,e[14]=p):p=e[14];let k;e[15]===l?k=e[16]:(k=C=>l(C),e[15]=l,e[16]=k);let y;e[17]===Symbol.for("react.memo_cache_sentinel")?(y=(0,a.jsx)(dt,{}),e[17]=y):y=e[17];let g;e[18]!==d||e[19]!==r?(g=(0,a.jsx)(mt,{id:r,"aria-describedby":d,className:"h-8 w-full shrink-0 sm:w-44",children:y}),e[18]=d,e[19]=r,e[20]=g):g=e[20];let x;e[21]===o?x=e[22]:(x=o.map(Mn),e[21]=o,e[22]=x);let w;e[23]===x?w=e[24]:(w=(0,a.jsx)(ut,{children:x}),e[23]=x,e[24]=w);let v;e[25]!==i||e[26]!==w||e[27]!==k||e[28]!==g||e[29]!==n?(v=(0,a.jsxs)(pt,{value:n,disabled:i,onValueChange:k,children:[g,w]}),e[25]=i,e[26]=w,e[27]=k,e[28]=g,e[29]=n,e[30]=v):v=e[30];let O;return e[31]!==v||e[32]!==p?(O=(0,a.jsxs)("div",{className:"flex min-h-14 flex-col items-stretch gap-2 px-3 py-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4",children:[p,v]}),e[31]=v,e[32]=p,e[33]=O):O=e[33],O}function Mn(t){return(0,a.jsx)(ct,{value:t.value,children:t.label},t.value)}function On(t){return t.description}function Ge(t){let e=(0,X.c)(15),{id:s,description:n,possibleDescriptions:i}=t,l;e[0]===i?l=e[1]:(l=new Set(i),e[0]=i,e[1]=l);let o;e[2]===l?o=e[3]:(o=[...l],e[2]=l,e[3]=o);let r;e[4]!==n||e[5]!==o?(r=o.filter(h=>h!==n),e[4]=n,e[5]=o,e[6]=r):r=e[6];let d=r,c;e[7]!==n||e[8]!==s?(c=(0,a.jsx)("p",{id:s,"aria-live":"polite",className:"col-start-1 row-start-1",children:n}),e[7]=n,e[8]=s,e[9]=c):c=e[9];let u;e[10]===d?u=e[11]:(u=d.map(_n),e[10]=d,e[11]=u);let m;return e[12]!==c||e[13]!==u?(m=(0,a.jsxs)("div",{className:"mt-0.5 grid text-xs leading-4 text-muted-foreground",children:[c,u]}),e[12]=c,e[13]=u,e[14]=m):m=e[14],m}function _n(t){return(0,a.jsx)("p",{"aria-hidden":!0,className:"invisible col-start-1 row-start-1",children:t},t)}var Oe=W(),la={"playwright-chromium":{description:"PDF export requires Playwright Chromium."}};function Ln(t){var c;let e=(0,Oe.c)(10),{status:s}=t;if(s.available&&!s.availabilityCheckFailed)return null;if(((c=s.reason)==null?void 0:c.type)==="checking-requirements"){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsxs)("span",{className:"ml-auto flex shrink-0",children:[(0,a.jsx)(Ne,{size:"small",className:"size-3"}),(0,a.jsx)("span",{className:"sr-only",children:"Checking requirements"})]}),e[0]=u):u=e[0],u}let n=s.availabilityCheckFailed?"Requirements unknown":"Unavailable",i=s.availabilityCheckFailed?"text-muted-foreground":"text-(--yellow-11)",l;e[1]===i?l=e[2]:(l=be("size-3",i),e[1]=i,e[2]=l);let o;e[3]===l?o=e[4]:(o=(0,a.jsx)(Xe,{className:l}),e[3]=l,e[4]=o);let r;e[5]===n?r=e[6]:(r=(0,a.jsx)("span",{className:"sr-only",children:n}),e[5]=n,e[6]=r);let d;return e[7]!==o||e[8]!==r?(d=(0,a.jsxs)("span",{className:"ml-auto flex shrink-0",children:[o,r]}),e[7]=o,e[8]=r,e[9]=d):d=e[9],d}function Fn(t){let e=(0,Oe.c)(7),{format:s,formatLabel:n,status:i,onInstall:l,isInstalling:o}=t,r=o===void 0?!1:o;if(i.availabilityCheckFailed){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.jsx)("div",{className:"mb-2.5",children:(0,a.jsx)(ve,{children:"Couldn't check whether this export is available. You can still try it."})}),e[0]=c):c=e[0],c}if(!i.reason)return null;let d;return e[1]!==s||e[2]!==n||e[3]!==r||e[4]!==l||e[5]!==i.reason?(d=(0,a.jsx)("div",{className:"mb-2.5",children:(0,a.jsx)(Pn,{format:s,formatLabel:n,reason:i.reason,onInstall:l,isInstalling:r})}),e[1]=s,e[2]=n,e[3]=r,e[4]=l,e[5]=i.reason,e[6]=d):d=e[6],d}function ve(t){let e=(0,Oe.c)(9),{children:s,onInstall:n,isInstalling:i}=t,l=i===void 0?!1:i,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,a.jsx)(Xe,{className:"size-4 shrink-0"}),e[0]=o):o=e[0];let r;e[1]===s?r=e[2]:(r=(0,a.jsx)("span",{className:"min-w-0 flex-1",children:s}),e[1]=s,e[2]=r);let d;e[3]!==l||e[4]!==n?(d=n?(0,a.jsxs)(oe,{type:"button",variant:"outline",size:"xs",className:"shrink-0 border-input bg-background text-foreground hover:border-input hover:bg-muted hover:text-foreground",disabled:l,"aria-busy":l,onClick:n,children:[l?(0,a.jsx)(Ne,{size:"small",className:"mr-1.5 size-3.5"}):(0,a.jsx)(Et,{className:"mr-1.5 size-3.5"}),"Install"]}):null,e[3]=l,e[4]=n,e[5]=d):d=e[5];let c;return e[6]!==r||e[7]!==d?(c=(0,a.jsxs)(It,{variant:"warning",className:"flex items-center gap-2.5 px-3 py-2 text-(--yellow-12) has-[svg]:pl-3 [&>svg]:static [&>svg+div]:translate-y-0",children:[o,(0,a.jsxs)(zt,{className:"flex min-w-0 flex-1 items-center gap-3 text-sm leading-5",children:[r,d]})]}),e[6]=r,e[7]=d,e[8]=c):c=e[8],c}function Pn(t){let e=(0,Oe.c)(22),{format:s,formatLabel:n,reason:i,onInstall:l,isInstalling:o}=t;switch(i.type){case"checking-requirements":{let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Ne,{className:"size-4 shrink-0",size:"small"}),e[0]=r):r=e[0];let d;return e[1]===n?d=e[2]:(d=(0,a.jsxs)(It,{role:"status",variant:"info",className:"flex items-center gap-2.5 p-3 has-[svg]:pl-3 [&>svg]:static [&>svg+div]:translate-y-0",children:[r,(0,a.jsxs)(zt,{className:"min-w-0 flex-1 text-sm leading-5",children:["Checking ",n," requirements\u2026"]})]}),e[1]=n,e[2]=d),d}case"notebook-must-be-named":{let r;return e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(ve,{children:"Name and save this notebook before exporting."}),e[3]=r):r=e[3],r}case"missing-packages":{let r;e[4]===i.packages?r=e[5]:(r=i.packages.join(", "),e[4]=i.packages,e[5]=r);let d;e[6]===r?d=e[7]:(d=(0,a.jsx)("code",{className:"break-words font-mono",children:r}),e[6]=r,e[7]=d);let c;return e[8]!==n||e[9]!==o||e[10]!==l||e[11]!==d?(c=(0,a.jsxs)(ve,{onInstall:l,isInstalling:o,children:[n," export requires"," ",d,"."]}),e[8]=n,e[9]=o,e[10]=l,e[11]=d,e[12]=c):c=e[12],c}case"missing-setup":{let r;e[13]!==l||e[14]!==i.requirements?(r=l?i.requirements.map(En).join(" "):(0,a.jsx)("span",{className:"block min-w-0",children:i.requirements.map(Wn)}),e[13]=l,e[14]=i.requirements,e[15]=r):r=e[15];let d;return e[16]!==o||e[17]!==l||e[18]!==r?(d=(0,a.jsx)(ve,{onInstall:l,isInstalling:o,children:r}),e[16]=o,e[17]=l,e[18]=r,e[19]=d):d=e[19],d}case"wasm-runtime":{let r=s==="pdf"?"Use your browser's print dialog to save the current app view as a PDF.":"Open this notebook in a local marimo session to use this export.",d;return e[20]===r?d=e[21]:(d=(0,a.jsx)(ve,{children:r}),e[20]=r,e[21]=d),d}default:ft(i)}}function Wn(t){let e=la[t.name];return(0,a.jsxs)("span",{className:"block",children:[e.description,(0,a.jsx)("code",{className:"mt-1 block break-all font-mono",children:t.command})]},t.name)}function En(t){return la[t.name].description}function An(t){return t.endsWith(".myst.md")?"mystmd":t.endsWith(".qmd")?"qmd":t.endsWith(".mdx")?"mdx":"pymdown"}function qn(t,e){let s=ks[e??An(t)],n=gs.find(o=>t.endsWith(o)),i=me.withoutExtension(t);n&&(i=t.slice(0,-n.length));let l=`${i}.${s}`;return l===t?`${t.slice(0,-(s.length+1))}.export.${s}`:l}function Dn(t){return Object.entries(t).flatMap(([e,s])=>s===null?[]:s===!0?[`--${e}`]:s===!1?[`--no-${e}`]:[`--${e}=${s}`])}function Rn(t){return t.preset==="document"?t.webpdf:null}var Tn={html:{subcommand:"html",flags:({html:t})=>({"include-code":t.includeCode}),outputFilename:t=>me.toHTML(t)},markdown:{subcommand:"md",flags:({markdown:t})=>({flavor:t.flavor}),outputFilename:(t,{markdown:e})=>qn(t,e.flavor)},ipynb:{subcommand:"ipynb",flags:({ipynb:t})=>({sort:t.sortMode,"include-outputs":t.includeOutputs}),outputFilename:t=>me.toIPYNB(t)},pdf:{subcommand:"pdf",flags:({pdf:t})=>({as:t.preset,"include-inputs":t.includeInputs,"include-outputs":t.includeOutputs,webpdf:Rn(t)}),outputFilename:t=>me.toPDF(t)},script:{subcommand:"script",flags:()=>({}),outputFilename:t=>`${me.withoutExtension(t)}.script.py`}};function $n({format:t,filename:e,options:s}){if(t==="png"||t==="script"&&s.script.type==="source"||!e)return null;let n=Tn[t];return["marimo","export",n.subcommand,_t(e),...Dn(n.flags(s)),"-o",_t(n.outputFilename(e,s))].join(" ")}async function Hn(t){let{exportOptions:e,captureOutputs:s,downloadPDF:n}=t;e.includeOutputs&&await s(),await n(e)}async function Vn({format:t,options:e,requests:s,sourceFilename:n,htmlFiles:i,captureOutputs:l,capturePNG:o,downloadFile:r}){switch(t){case"html":r(await s.exportAsHTML({download:!1,files:i,includeCode:e.html.includeCode}));return;case"markdown":r(await s.exportAsMarkdown({download:!1,flavor:e.markdown.flavor}));return;case"ipynb":e.ipynb.includeOutputs&&await l(),r(await s.exportAsIPYNB({download:!1,sortMode:e.ipynb.sortMode,includeOutputs:e.ipynb.includeOutputs}));return;case"pdf":await Hn({exportOptions:e.pdf,captureOutputs:l,downloadPDF:async d=>{r(await s.exportAsPDF(d))}});return;case"script":if(e.script.type==="source"){r({contents:(await s.readCode()).contents,filename:n,mediaType:"text/plain"});return}r(await s.exportAsScript({download:!1}));return;case"png":await o();return;default:ft(t)}}var Bn=W(),Un={source:{actionLabel:"Export notebook source",progressLabel:"notebook source"},flat:{actionLabel:"Export flat script",progressLabel:"flat script"}};function Gn(t,e){if(t==="wasm")return{status:"success",data:null};switch(e.status){case"pending":case"loading":return{status:"pending"};case"error":return{status:"error"};case"success":return{status:"success",data:e.data}}}function Kn(t,e){return t==="server"&&e?We.basename(e):me.toPY(document.title)}function Yn({usesBrowserPrint:t,hasCommand:e,format:s,isNotebookSource:n}){return t?"Uses the browser's print settings for page size and filename.":e?"Uses the current session state. The copied command exports the saved notebook.":s!=="png"&&!n?"Save the notebook to copy an equivalent shell command.":null}function Jn(t){var E,q;let e=Mt(),[s,n]=_e(oa),[i,l]=_e(hn),[o,r]=(0,L.useState)(t??i),d=fe()?"wasm":"server",c=re(),u=Ra(),[m,h]=(0,L.useState)(!1),b=Te(async()=>d==="wasm"?null:c.getExportAvailability(),[d,c]),f=Gn(d,b),p=N=>fn({format:N,options:s,runtime:d,filename:e,availability:f}),k=p(o),y=u&&(((E=k.reason)==null?void 0:E.type)==="missing-packages"||((q=k.reason)==null?void 0:q.type)==="missing-setup"),g=Qt.map(N=>({format:N,status:p(N)})),x=ia(d,o),w=Ue[o],v=o==="script"&&s.script.type==="source",{actionLabel:O,progressLabel:z}=o==="script"?Un[s.script.type]:{actionLabel:w.actionLabel,progressLabel:w.label},C=x?null:$n({format:o,filename:e,options:s}),S=Yn({usesBrowserPrint:x,hasCommand:!!C,format:o,isNotebookSource:v});return(0,L.useEffect)(()=>{t&&l(t)},[t,l]),{formats:g,options:s,selected:{format:o,status:k,usesBrowserPrint:x,actionLabel:O,command:C,footerDescription:S},exportRequest:{format:o,options:s,sourceFilename:Kn(d,e),available:k.available,usesBrowserPrint:x,progressLabel:z},selectFormat:N=>{sa(N)&&(r(N),l(N))},updateOptions:(N,A)=>{n(G=>{let P={...G};return P[N]={...G[N],...A},P})},canInstall:y,isInstalling:m,installRequirements:async()=>{if(!(!y||m||o==="png")){h(!0);try{let N=await c.installExportRequirements({format:o});b.setData(N)}catch{}finally{h(!1)}}}}}async function Xn(t){let e=document.getElementById("App");if(!e){let i="The current app view could not be captured.";throw de({title:"Failed to download as PNG",description:i,variant:"danger"}),Error(i)}let s=t==null?void 0:t.style.visibility,n=t==null?void 0:t.classList.contains("print:hidden");if(!await ts({element:e,filename:document.title,prepare:()=>{let i=as();return t&&(t.classList.add("print:hidden"),t.style.visibility="hidden"),()=>{i(),t&&(n||t.classList.remove("print:hidden"),t.style.visibility=s??"")}}}))throw Error("Failed to capture the current app view.")}function Qn(t){t(),requestAnimationFrame(()=>{setTimeout(()=>{window.print()},0)})}function Zn({format:t,options:e,sourceFilename:s,available:n,usesBrowserPrint:i,progressLabel:l,onClose:o}){let r=re(),d=As(),[c,u]=(0,L.useState)(!1),m=(0,L.useRef)(null),h=(0,L.useRef)(!0);(0,L.useEffect)(()=>(h.current=!0,()=>{h.current=!1}),[]);let b=async p=>{await qs({takeScreenshots:()=>d({progress:p}),updateCellOutputs:r.updateCellOutputs})},f=async()=>{await Ta(()=>{var p;return Xn(((p=m.current)==null?void 0:p.parentElement)??null)})};return{dialogRef:m,isExporting:c,submit:async()=>{if(!(!n||c)){if(i){Qn(o);return}u(!0);try{await es(`Exporting ${l}\u2026`,async p=>{await Vn({format:t,options:e,requests:r,sourceFilename:s,htmlFiles:xt.INSTANCE.filenames(),captureOutputs:()=>b(p),capturePNG:f,downloadFile:Za})}),h.current&&o()}catch(p){ue.error("Export failed",p)}finally{h.current&&u(!1)}}}}}function eo(t){let e=(0,Bn.c)(15),{initialFormat:s,onClose:n}=t,i=Jn(s),l,o,r;e[0]===i?(l=e[1],o=e[2],r=e[3]):({exportRequest:l,selectFormat:o,...r}=i,e[0]=i,e[1]=l,e[2]=o,e[3]=r);let d;e[4]!==l||e[5]!==n?(d={...l,onClose:n},e[4]=l,e[5]=n,e[6]=d):d=e[6];let c=Zn(d),u;e[7]!==c||e[8]!==o||e[9]!==r?(u=h=>{!c.isExporting&&!r.isInstalling&&o(h)},e[7]=c,e[8]=o,e[9]=r,e[10]=u):u=e[10];let m;return e[11]!==c||e[12]!==r||e[13]!==u?(m={...r,...c,selectFormat:u},e[11]=c,e[12]=r,e[13]=u,e[14]=m):m=e[14],m}var to=W(),ao="(min-width: 640px)";const so=t=>{let e=(0,to.c)(75),{initialFormat:s,onClose:n,returnFocusRef:i}=t,l;e[0]!==s||e[1]!==n?(l={initialFormat:s,onClose:n},e[0]=s,e[1]=n,e[2]=l):l=e[2];let{dialogRef:o,isExporting:r,isInstalling:d,canInstall:c,formats:u,options:m,selected:h,selectFormat:b,updateOptions:f,installRequirements:p,submit:k}=eo(l),y=r||d,g=Qa(ao),{format:x,status:w,usesBrowserPrint:v,actionLabel:O,command:z,footerDescription:C}=h,S=Ue[x],E=S.Options,q;e[3]===i?q=e[4]:(q=i?{onCloseAutoFocus:F=>{var j;F.preventDefault(),(j=i.current)==null||j.focus()}}:{},e[3]=i,e[4]=q);let N=q,A;e[5]===Symbol.for("react.memo_cache_sentinel")?(A=(0,a.jsxs)(Ae,{className:"border-b px-5 py-4 pr-12",children:[(0,a.jsx)(qe,{children:"Export notebook"}),(0,a.jsx)(Re,{children:"Choose a format and adjust its options."})]}),e[5]=A):A=e[5];let G=g?"vertical":"horizontal",P;if(e[6]!==u||e[7]!==y){let F;e[9]===y?F=e[10]:(F=j=>{let{format:M,status:Z}=j,we=Ue[M];return(0,a.jsxs)(Ga,{value:M,disabled:y,className:"min-w-0 justify-start gap-2 px-2.5 py-2 text-xs data-[state=active]:shadow-xs sm:w-full sm:text-sm","data-testid":`export-format-${M}`,children:[(0,a.jsx)(we.Icon,{className:"size-3.5 shrink-0",strokeWidth:1.5}),(0,a.jsx)("span",{className:"truncate",children:we.label}),(0,a.jsx)(Ln,{status:Z})]},M)},e[9]=y,e[10]=F),P=u.map(F),e[6]=u,e[7]=y,e[8]=P}else P=e[8];let K;e[11]===P?K=e[12]:(K=(0,a.jsx)(Ya,{"aria-label":"Export format",className:"grid max-h-none shrink-0 grid-cols-2 items-stretch justify-start gap-1 overflow-auto rounded-none border-b bg-muted/20 p-2 min-[360px]:grid-cols-3 sm:flex sm:h-full sm:flex-col sm:border-b-0 sm:border-r",children:P}),e[11]=P,e[12]=K);let Y;if(e[13]!==E||e[14]!==c||e[15]!==S.description||e[16]!==S.label||e[17]!==x||e[18]!==u||e[19]!==p||e[20]!==y||e[21]!==d||e[22]!==m||e[23]!==w||e[24]!==f||e[25]!==v){let F;e[27]!==E||e[28]!==c||e[29]!==S.description||e[30]!==S.label||e[31]!==x||e[32]!==p||e[33]!==y||e[34]!==d||e[35]!==m||e[36]!==w||e[37]!==f||e[38]!==v?(F=j=>{let{format:M}=j;return(0,a.jsxs)(Ka,{value:M,className:"mt-0 min-h-0 min-w-0 overflow-y-auto px-4 py-3",children:[(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsx)("h3",{className:"text-base font-semibold",children:S.label}),(0,a.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:S.description})]}),(0,a.jsx)(Fn,{format:x,formatLabel:S.label,status:w,onInstall:c?p:void 0,isInstalling:d}),v?null:(0,a.jsx)(E,{options:m,updateOptions:f,disabled:y})]},M)},e[27]=E,e[28]=c,e[29]=S.description,e[30]=S.label,e[31]=x,e[32]=p,e[33]=y,e[34]=d,e[35]=m,e[36]=w,e[37]=f,e[38]=v,e[39]=F):F=e[39],Y=u.map(F),e[13]=E,e[14]=c,e[15]=S.description,e[16]=S.label,e[17]=x,e[18]=u,e[19]=p,e[20]=y,e[21]=d,e[22]=m,e[23]=w,e[24]=f,e[25]=v,e[26]=Y}else Y=e[26];let D;e[40]!==x||e[41]!==b||e[42]!==G||e[43]!==K||e[44]!==Y?(D=(0,a.jsxs)(Ua,{value:x,onValueChange:b,orientation:G,className:"flex min-h-0 min-w-0 flex-col overflow-hidden sm:grid sm:grid-cols-[168px_minmax(0,1fr)]",children:[K,Y]}),e[40]=x,e[41]=b,e[42]=G,e[43]=K,e[44]=Y,e[45]=D):D=e[45];let J;e[46]===z?J=e[47]:(J=z?(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-2 rounded-md border bg-background px-2.5 py-2 font-mono text-xs",children:[(0,a.jsx)("span",{className:"select-none text-muted-foreground","aria-hidden":!0,children:"$"}),(0,a.jsx)("code",{className:"min-w-0 flex-1 overflow-x-auto whitespace-nowrap","data-testid":"export-cli-command","aria-label":"Equivalent POSIX shell command",children:z}),(0,a.jsx)(Ee,{value:z,className:"size-3.5",buttonClassName:be(rs({variant:"ghost",size:"icon"}),"shrink-0"),tooltip:"Copy POSIX shell command",ariaLabel:"Copy POSIX shell command",toastTitle:"Command copied"})]}):null,e[46]=z,e[47]=J);let ae=z&&"mt-3",R;e[48]===ae?R=e[49]:(R=be("flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",ae),e[48]=ae,e[49]=R);let T;e[50]===C?T=e[51]:(T=C?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:C}):null,e[50]=C,e[51]=T);let se=!w.available||y,ie=!C&&"sm:ml-auto",ne;e[52]===ie?ne=e[53]:(ne=be("border-(--blue-11) bg-(--blue-11) hover:border-(--blue-12) hover:bg-(--blue-12) sm:min-w-36 dark:border-(--blue-7) dark:bg-(--blue-5) dark:text-(--blue-12) dark:hover:border-(--blue-8) dark:hover:bg-(--blue-6)",ie),e[52]=ie,e[53]=ne);let $;e[54]===r?$=e[55]:($=r&&(0,a.jsx)(Ne,{size:"small",className:"mr-2","aria-hidden":!0}),e[54]=r,e[55]=$);let I=v?"Print to PDF":O,H;e[56]!==r||e[57]!==k||e[58]!==se||e[59]!==ne||e[60]!==$||e[61]!==I?(H=(0,a.jsxs)(oe,{type:"button",disabled:se,"aria-busy":r,onClick:k,className:ne,"data-testid":"export-submit",children:[$,I]}),e[56]=r,e[57]=k,e[58]=se,e[59]=ne,e[60]=$,e[61]=I,e[62]=H):H=e[62];let V;e[63]!==R||e[64]!==T||e[65]!==H?(V=(0,a.jsxs)("div",{className:R,children:[T,H]}),e[63]=R,e[64]=T,e[65]=H,e[66]=V):V=e[66];let Q;e[67]!==V||e[68]!==J?(Q=(0,a.jsxs)("footer",{className:"min-w-0 border-t bg-muted/20 px-4 py-3",children:[J,V]}),e[67]=V,e[68]=J,e[69]=Q):Q=e[69];let le;return e[70]!==o||e[71]!==N||e[72]!==Q||e[73]!==D?(le=(0,a.jsxs)(De,{ref:o,className:"grid h-dvh max-h-[760px] min-w-0 w-[calc(100vw-2rem)] grid-rows-[auto_minmax(0,1fr)_auto] gap-0 overflow-hidden p-0 sm:top-[5vh] sm:h-[90vh] sm:max-h-[640px] sm:max-w-3xl","data-testid":"export-dialog",...N,children:[A,D,Q]}),e[70]=o,e[71]=N,e[72]=Q,e[73]=D,e[74]=le):le=e[74],le};var no=W();function oo(t){let e=(0,no.c)(5),{openPrompt:s,closeModal:n}=Se(),{sendCopy:i}=re(),l;return e[0]!==n||e[1]!==s||e[2]!==i||e[3]!==t?(l=()=>{if(!t)return null;let o=zs.guessDeliminator(t);s({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${We.basename(t)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:r=>{let d=o.join(We.dirname(t),r);i({source:t,destination:d}).then(()=>{n(),de({title:"Notebook copied",description:"A copy of the notebook has been created."}),Es(d)})}})},e[0]=n,e[1]=s,e[2]=i,e[3]=t,e[4]=l):l=e[4],l}var ro=W();function da(){let t=(0,ro.c)(4),{openConfirm:e}=Se(),s=ce(lt),{sendRestart:n}=re(),i;return t[0]!==e||t[1]!==n||t[2]!==s?(i=()=>{e({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)(Ba,{onClick:async()=>{s({state:it.CLOSING}),await n(),_s()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=n,t[2]=s,t[3]=i):i=t[3],i}var io=W(),lo=new ka,co=t=>lo.isSupported(t)?"markdown":"code";const ca=()=>{let t=(0,io.c)(3),{updateCellConfig:e}=Ye(),{saveCellConfig:s}=re(),n;return t[0]!==s||t[1]!==e?(n=async(i,l)=>{let o=at(),r={};for(let c of o.cellIds.inOrderIds){let u=o.cellData[c];u===void 0||u.config.hide_code===i||co(u.code)===l&&(r[c]={hide_code:i})}let d=nt.entries(r);if(d.length!==0){await s({configs:r});for(let[c,u]of d)e({cellId:c,config:u})}},t[0]=s,t[1]=e,t[2]=n):n=t[2],n};var uo=W(),pe=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function mo(t){var Q,le,F;let e=(0,uo.c)(45),s;e[0]===t?s=e[1]:(s=t===void 0?{}:t,e[0]=t,e[1]=s);let{exportDialogReturnFocusRef:n}=s,i=Mt(),{openModal:l,closeModal:o}=Se(),{toggleApplication:r}=ba(),{selectedPanel:d}=ja(),[c]=_e(rt),u=ee(Da),m=ca(),[h]=Ea(),b=ee(ya),f=ee(Aa),{updateCellConfig:p,undoDeleteCell:k,clearAllCellOutputs:y,addSetupCellIfDoesntExist:g,collapseAllCells:x,expandAllCells:w}=Ye(),v=da(),O=Ms(),z=oo(i),C=ce(Yt),S=ce(La),{handleClick:E}=Fa(),q=ce(Pa),N=ce(oa),{readCode:A,saveCellConfig:G}=re(),P=ee(Ma),K=ee(Oa),Y=ee(wa),{selectedLayout:D}=yt(),{setLayoutView:J}=kt(),ae=Kt(),R=((Q=h.sharing)==null?void 0:Q.html)??!0,T=((le=h.sharing)==null?void 0:le.wasm)??!0,se=((F=h.sharing)==null?void 0:F.molab)??!0,ie=D==="slides",ne=zo,$;e[2]!==o||e[3]!==n||e[4]!==l||e[5]!==N?($=(j,M)=>{M&&N(Z=>na(Z,M)),l((0,a.jsx)(so,{initialFormat:j,onClose:o,returnFocusRef:n}))},e[2]=o,e[3]=n,e[4]=l,e[5]=N,e[6]=$):$=e[6];let I=$,H;e[7]===Symbol.for("react.memo_cache_sentinel")?(H=(0,a.jsx)(ht,{size:14,strokeWidth:1.5}),e[7]=H):H=e[7];let V;return e[8]!==g||e[9]!==f||e[10]!==K||e[11]!==b||e[12]!==y||e[13]!==o||e[14]!==x||e[15]!==z||e[16]!==w||e[17]!==i||e[18]!==P||e[19]!==ie||e[20]!==u||e[21]!==I||e[22]!==l||e[23]!==E||e[24]!==A||e[25]!==v||e[26]!==O||e[27]!==G||e[28]!==D||e[29]!==d||e[30]!==m||e[31]!==C||e[32]!==q||e[33]!==J||e[34]!==S||e[35]!==R||e[36]!==se||e[37]!==T||e[38]!==r||e[39]!==ae||e[40]!==k||e[41]!==Y||e[42]!==p||e[43]!==c.mode?(V=[{icon:H,label:"Export\u2026",additionalKeywords:["download","html","markdown","ipynb","pdf","script","png"],handle:()=>I()},{icon:(0,a.jsx)(ht,{size:14,strokeWidth:1.5}),label:"Download",handle:pe,dropdown:[{icon:(0,a.jsx)(bt,{size:14,strokeWidth:1.5}),label:"Download as HTML",handle:()=>I("html",{html:{includeCode:!0}})},{icon:(0,a.jsx)(bt,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:()=>I("html",{html:{includeCode:!1}})},{icon:(0,a.jsx)(Ls,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:()=>I("markdown")},{icon:(0,a.jsx)(Rt,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:()=>I("ipynb")},{icon:(0,a.jsx)(Pe,{size:14,strokeWidth:1.5}),label:"Download notebook source",handle:()=>I("script",{script:{type:"source"}})},{icon:(0,a.jsx)(Pe,{size:14,strokeWidth:1.5}),label:"Download flat script",handle:()=>I("script",{script:{type:"flat"}})},{divider:!0,icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"Download as PNG",handle:()=>I("png")},ie?{divider:!0,icon:(0,a.jsx)(xe,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:pe,dropdown:[{icon:(0,a.jsx)(xe,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:()=>I("pdf",{pdf:{preset:"document"}})},{icon:(0,a.jsx)(xe,{size:14,strokeWidth:1.5}),label:"Slides Layout",hidden:fe(),rightElement:(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"}),handle:()=>I("pdf",{pdf:{preset:"slides"}})}]}:{divider:!0,icon:(0,a.jsx)(xe,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:()=>I("pdf",{pdf:{preset:"document"}})}]},{icon:(0,a.jsx)(Ns,{size:14,strokeWidth:1.5}),label:"Pair with an agent",hidden:fe(),handle:async()=>{l((0,a.jsx)(Ps,{onClose:o}))}},{icon:(0,a.jsx)(Bs,{size:14,strokeWidth:1.5}),label:"Share",handle:pe,hidden:!R&&!T&&!se,dropdown:[{icon:(0,a.jsx)(jt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!R,handle:async()=>{l((0,a.jsx)(an,{onClose:o}))}},{icon:(0,a.jsx)(vs,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!T,handle:async()=>{await Ce(St({code:(await A()).contents})),de({title:"Copied",description:"Link copied to clipboard."})}},{icon:(0,a.jsx)(Ft,{size:14,strokeWidth:1.5}),label:"Create molab notebook",hidden:!se,handle:async()=>{let j=St({code:(await A()).contents,baseUrl:`${B.molab}/new`});window.open(j,"_blank")}}]},{icon:(0,a.jsx)(Vs,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:pe,dropdown:xa.flatMap(j=>{let M=j.type==="ai"&&!f;if(Ca({panel:j,capabilities:b,aiEnabled:f})&&!M)return[];let{type:Z,Icon:we,additionalKeywords:ua}=j;return{label:Fe.startCase(Z),rightElement:ne(d===Z),icon:(0,a.jsx)(we,{size:14,strokeWidth:1.5}),handle:()=>{if(M){E("ai","ai-features");return}r(Z)},additionalKeywords:ua}})},{icon:(0,a.jsx)(Tt,{size:14,strokeWidth:1.5}),label:"Present as",handle:pe,dropdown:[{icon:c.mode==="present"?(0,a.jsx)(Cs,{size:14,strokeWidth:1.5}):(0,a.jsx)(ds,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{ae()}},...Pt.map((j,M)=>{let Z=Jt(j);return{divider:M===0,label:Xt(j),icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:D===j&&(0,a.jsx)(gt,{size:14})}),handle:()=>{J(j),c.mode==="edit"&&ae()}}})]},{icon:(0,a.jsx)($s,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!i||fe(),handle:z},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!i,handle:async()=>{await Ce((await A()).contents),de({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(ms,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!P||u,handle:async()=>{let j=za(at());await G({configs:nt.fromEntries(j.map(So))});for(let M of j)p({cellId:M,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(qt,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{g({})}},{icon:(0,a.jsx)(va,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{l((0,a.jsx)(Lt,{onClose:o}))}},{icon:(0,a.jsx)(xs,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{l((0,a.jsx)(Lt,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)($t,{size:14,strokeWidth:1.5}),label:Y,hidden:!K||u,handle:()=>{k()}},{icon:(0,a.jsx)(Us,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:v,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Ts,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{O()}},{icon:(0,a.jsx)(Na,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{y()}},{icon:(0,a.jsx)(Ze,{size:14,strokeWidth:1.5}),label:"Show all code",hotkey:"global.showAllCode",handle:()=>m(!1,"code"),redundant:!0},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Hide all code",hotkey:"global.hideAllCode",handle:()=>m(!0,"code"),redundant:!0},{icon:(0,a.jsx)(Ze,{size:14,strokeWidth:1.5}),label:"Show all markdown code",hotkey:"global.showAllMarkdownCode",handle:()=>m(!1,"markdown"),redundant:!0},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",hotkey:"global.hideAllMarkdownCode",handle:()=>m(!0,"markdown"),redundant:!0},{icon:(0,a.jsx)(Rs,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:x,redundant:!0},{icon:(0,a.jsx)(Ds,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:w,redundant:!0},{divider:!0,icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>C(Co)},{icon:(0,a.jsx)(cs,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>q(No)},{icon:(0,a.jsx)(js,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>S(jo),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(Dt,{size:14,strokeWidth:1.5}),label:"Report an issue",additionalKeywords:["feedback","bug","issue","report","diagnostics"],handle:()=>l((0,a.jsx)(Ut,{onClose:o}))},{icon:(0,a.jsx)(wt,{size:14,strokeWidth:1.5}),label:"Resources",handle:pe,dropdown:[{icon:(0,a.jsx)(ga,{size:14,strokeWidth:1.5}),label:"Documentation",handle:wo},{icon:(0,a.jsx)(Ws,{className:"h-3.5 w-3.5"}),label:"GitHub",handle:vo},{icon:(0,a.jsx)(hs,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:go},{icon:(0,a.jsx)(bs,{className:"h-3.5 w-3.5"}),label:"YouTube",handle:ko},{icon:(0,a.jsx)(Qe,{size:14,strokeWidth:1.5}),label:"Changelog",handle:yo}]},{divider:!0,icon:(0,a.jsx)(ys,{size:14,strokeWidth:1.5}),label:"Open home",hidden:!location.search.includes("file"),handle:xo},{icon:(0,a.jsx)(Ft,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:bo}].filter(fo).map(po),e[8]=g,e[9]=f,e[10]=K,e[11]=b,e[12]=y,e[13]=o,e[14]=x,e[15]=z,e[16]=w,e[17]=i,e[18]=P,e[19]=ie,e[20]=u,e[21]=I,e[22]=l,e[23]=E,e[24]=A,e[25]=v,e[26]=O,e[27]=G,e[28]=D,e[29]=d,e[30]=m,e[31]=C,e[32]=q,e[33]=J,e[34]=S,e[35]=R,e[36]=se,e[37]=T,e[38]=r,e[39]=ae,e[40]=k,e[41]=Y,e[42]=p,e[43]=c.mode,e[44]=V):V=e[44],V}function po(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(ho)}:t}function ho(t){return!t.hidden}function fo(t){return!t.hidden}function bo(){let t=Is();window.open(t,"_blank")}function xo(){let t=document.baseURI.split("?")[0];window.open(t,"_blank","noopener")}function yo(){window.open(B.releasesPage,"_blank")}function ko(){window.open(B.youtube,"_blank")}function go(){window.open(B.discordLink,"_blank")}function vo(){window.open(B.githubPage,"_blank")}function wo(){window.open(B.docsPage,"_blank")}function jo(t){return!t}function No(t){return!t}function Co(t){return!t}function So(t){return[t,{disabled:!1}]}function zo(t){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:t&&(0,a.jsx)(gt,{size:14})})}export{Yt as a,He as c,qt as d,At as f,dn as i,$t as l,Wt as m,ca as n,Kt as o,Et as p,da as r,en as s,mo as t,Dt as u};
|
|
12
|
+
`)})]}),f&&i.length===0&&(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:"No errors detected."}),(0,a.jsx)("div",{className:"border-t pt-3",children:(0,a.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Other feedback? Take our"," ",(0,a.jsx)("a",{href:B.feedbackForm,target:"_blank",rel:"noreferrer",className:"underline",children:"two-minute survey"})," ","or chat with us on"," ",(0,a.jsx)("a",{href:B.discordLink,target:"_blank",rel:"noreferrer",className:"underline",children:"Discord"}),"."]})})]})]})};function tn(t){return!t}var Gt=W(),ze="https://static.marimo.app";const an=t=>{let e=(0,Gt.c)(25),{onClose:s}=t,[n,i]=(0,L.useState)(""),{exportAsHTML:l}=re(),o=`${n}-${Math.random().toString(36).slice(2,6)}`,r=`${ze}/static/${o}`,d;e[0]!==l||e[1]!==s||e[2]!==o?(d=async x=>{x.preventDefault(),s();let{contents:w}=await l({download:!1,includeCode:!0,files:xt.INSTANCE.filenames()}),v=de({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${ze}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:w,path:o})}).catch(()=>{v.dismiss(),de({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:B.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),v.dismiss(),de({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."]})})},e[0]=l,e[1]=s,e[2]=o,e[3]=d):d=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.jsx)(qe,{children:"Share static notebook"}),e[4]=c):c=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsxs)(Ae,{children:[c,(0,a.jsxs)(Re,{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:ze,target:"_blank",children:ze}),"."]})]}),e[5]=u):u=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=x=>{i(x.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},e[6]=m):m=e[6];let h;e[7]===n?h=e[8]:(h=(0,a.jsx)(ws,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:n,placeholder:"Notebook slug",onChange:m,required:!0,autoComplete:"off"}),e[7]=n,e[8]=h);let b;e[9]===r?b=e[10]:(b=(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)(sn,{text:r}),(0,a.jsx)("span",{className:"text-primary",children:r})]})]}),e[9]=r,e[10]=b);let f;e[11]!==h||e[12]!==b?(f=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[h,b]}),e[11]=h,e[12]=b,e[13]=f):f=e[13];let p;e[14]===s?p=e[15]:(p=(0,a.jsx)(oe,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:s,children:"Cancel"}),e[14]=s,e[15]=p);let k;e[16]===r?k=e[17]:(k=(0,a.jsx)(oe,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await Ce(r)},children:"Create"}),e[16]=r,e[17]=k);let y;e[18]!==p||e[19]!==k?(y=(0,a.jsxs)(Os,{children:[p,k]}),e[18]=p,e[19]=k,e[20]=y):y=e[20];let g;return e[21]!==d||e[22]!==y||e[23]!==f?(g=(0,a.jsx)(De,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[u,f,y]})}),e[21]=d,e[22]=y,e[23]=f,e[24]=g):g=e[24],g};var sn=t=>{let e=(0,Gt.c)(8),[s,n]=L.useState(!1),i;e[0]===t.text?i=e[1]:(i=is.stopPropagation(async c=>{c.preventDefault(),await Ce(t.text),n(!0),setTimeout(()=>n(!1),2e3)}),e[0]=t.text,e[1]=i);let l=i,o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=(0,a.jsx)(ps,{size:14,strokeWidth:1.5}),e[2]=o):o=e[2];let r;e[3]===l?r=e[4]:(r=(0,a.jsx)(oe,{"data-testid":"copy-static-notebook-url-button",onClick:l,size:"xs",variant:"secondary",children:o}),e[3]=l,e[4]=r);let d;return e[5]!==s||e[6]!==r?(d=(0,a.jsx)(os,{content:"Copied!",open:s,children:r}),e[5]=s,e[6]=r,e[7]=d):d=e[7],d},nn=W();function on(){let t=document.getElementsByClassName(ot.outputArea);for(let e of t){let s=e.getBoundingClientRect();if(s.bottom>0&&s.top<window.innerHeight){let n=Le.findElement(e);if(!n){ue.warn("Could not find HTMLCellId for visible output area",e);continue}return{cellId:Le.parse(n.id)}}}return ue.warn("No visible output area found for scroll anchor"),null}function rn(t){if(!t){ue.warn("No scroll anchor provided to restore scroll position");return}let e=document.getElementById(Le.create(t.cellId));if(!e){ue.warn("Could not find cell element to restore scroll position",t.cellId);return}if(!e.querySelector(`.${ot.outputArea}`)){ue.warn("Could not find output area to restore scroll position",t.cellId);return}e.scrollIntoView({block:"start",behavior:"auto"})}function Kt(){let t=(0,nn.c)(2),e=ce(rt),s;return t[0]===e?s=t[1]:(s=()=>{let n=on();e(i=>({mode:qa(i.mode),cellAnchor:(n==null?void 0:n.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{rn(n)})})},t[0]=e,t[1]=s),s}const Yt=pa(!1);var ln=W();const dn=()=>{let t=(0,ln.c)(7),{selectedLayout:e}=yt(),{setLayoutView:s}=kt();if(fe()&&!fa("wasm_layouts"))return null;let n;t[0]===s?n=t[1]:(n=r=>s(r),t[0]=s,t[1]=n);let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)(mt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(dt,{placeholder:"Select a view"})}),t[2]=i):i=t[2];let l;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(ut,{children:(0,a.jsxs)(Xa,{children:[(0,a.jsx)(Ja,{children:"View as"}),Pt.map(un)]})}),t[3]=l):l=t[3];let o;return t[4]!==e||t[5]!==n?(o=(0,a.jsxs)(pt,{"data-testid":"layout-select",value:e,onValueChange:n,children:[i,l]}),t[4]=e,t[5]=n,t[6]=o):o=t[6],o};function cn(t){return(0,a.jsx)(Jt(t),{className:"h-4 w-4"})}function Jt(t){switch(t){case"vertical":return Hs;case"grid":return fs;case"slides":return Tt;default:return ls(t),Ss}}function Xt(t){return Fe.startCase(t)}function un(t){return(0,a.jsx)(ct,{value:t,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[cn(t),(0,a.jsx)("span",{children:Xt(t)})]})},t)}const Qt=["html","markdown","ipynb","pdf","script","png"],Zt=["pymdown","qmd","mystmd","mdx"],ea=["topological","top-down"],ta=["document","slides"],aa=["source","flat"];function sa(t){return typeof t=="string"&&Qt.some(e=>e===t)}const U={html:{includeCode:!0},markdown:{flavor:null},ipynb:{sortMode:"topological",includeOutputs:!1},pdf:{preset:"document",includeInputs:!0,includeOutputs:!0,webpdf:!0},script:{type:"source"}};function te(t,e){return t.default(e).catch(e)}function ye(t){return st(t).optional().catch(void 0)}var mn=st({html:ye({includeCode:te(he(),U.html.includeCode)}),markdown:ye({flavor:te(je(Zt).nullable(),U.markdown.flavor)}),ipynb:ye({sortMode:te(je(ea),U.ipynb.sortMode),includeOutputs:te(he(),U.ipynb.includeOutputs)}),pdf:ye({preset:te(je(ta),U.pdf.preset),includeInputs:te(he(),U.pdf.includeInputs),includeOutputs:te(he(),U.pdf.includeOutputs),webpdf:te(he(),U.pdf.webpdf)}),script:ye({type:te(je(aa),U.script.type)})}).catch({});function na(t,e){let s={...t},n=i=>{s[i]={...t[i],...e[i]}};for(let i of Object.keys(e))n(i);return s}function pn(t){return na(U,mn.parse(t))}const oa=tt("marimo:export:options:v1",U,Je({toSerializable:t=>t,fromSerializable:pn}),{getOnInit:!0}),hn=tt("marimo:export:last-format:v1","html",Je({toSerializable:t=>t,fromSerializable:t=>sa(t)?t:"html"}),{getOnInit:!0});var ra={html:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!1,checksServerAvailability:!1},markdown:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!1,checksServerAvailability:!1},ipynb:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!0,checksServerAvailability:!0},pdf:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!0,checksServerAvailability:!0},script:{requiresNamedNotebookOnServer:!1,requiresServerRuntime:!1,checksServerAvailability:!1},png:{requiresNamedNotebookOnServer:!1,requiresServerRuntime:!1,checksServerAvailability:!1}};function ia(t,e){return t==="wasm"&&e==="pdf"}function fn({format:t,options:e,runtime:s,filename:n,availability:i}){let l=t==="script"&&e.script.type==="source"?{...ra.script,requiresNamedNotebookOnServer:!0}:ra[t],o=ia(s,t);if(s==="wasm"&&l.requiresServerRuntime)return{available:o,reason:{type:"wasm-runtime"}};if(s==="server"&&l.requiresNamedNotebookOnServer&&!n)return{available:!1,reason:{type:"notebook-must-be-named"}};if(s==="wasm"||!l.checksServerAvailability)return{available:!0};if(i.status==="pending")return{available:!1,reason:{type:"checking-requirements"}};if(i.status==="error"||!i.data)return{available:!0,availabilityCheckFailed:!0};let r=i.data.formats.find(d=>d.format===t);return r?r.dependenciesAvailable?{available:!0}:r.missingPackages.length>0?{available:!1,reason:{type:"missing-packages",packages:r.missingPackages}}:r.missingSetup.length>0?{available:!1,reason:{type:"missing-setup",requirements:r.missingSetup}}:{available:!0,availabilityCheckFailed:!0}:{available:!0,availabilityCheckFailed:!0}}var X=W();function ke(t,e){return t.map(s=>({value:s,...e[s]}))}var bn=ke(["automatic",...Zt],{automatic:{label:"Automatic",description:"Chooses a format from the notebook filename. Defaults to Markdown (.md)."},pymdown:{label:"Markdown (.md)",description:"Creates a .md file with Python code blocks."},qmd:{label:"Quarto (.qmd)",description:"Creates a .qmd file for Quarto."},mystmd:{label:"MyST (.myst.md)",description:"Creates a .myst.md file for MyST."},mdx:{label:"MDX (.mdx)",description:"Creates a .mdx file for MDX."}}),xn=ke(ea,{"top-down":{label:"Top to bottom",description:"Keeps cells in the same order as this notebook."},topological:{label:"Dependency order",description:"Reorders cells so each cell appears after the cells it depends on."}}),yn=ke(ta,{document:{label:"Document",description:"Creates pages for reading or printing."},slides:{label:"Slides",description:"Creates presentation slides from the notebook."}}),kn=ke(["browser","latex"],{browser:{label:"Browser",description:"Uses browser rendering to preserve the notebook's visual output."},latex:{label:"LaTeX first",description:"Uses Pandoc and TeX when available, then falls back to browser rendering."}}),gn=ke(aa,{source:{label:"Notebook source",description:"Downloads the saved notebook source for continued editing in marimo."},flat:{label:"Flat script",description:"Reorders cells so the Python script runs from top to bottom."}});const Ue={html:{label:"HTML",actionLabel:"Export HTML",description:"Save the current notebook as an HTML page.",Icon:jt,Options:vn},markdown:{label:"Markdown",actionLabel:"Export Markdown",description:"Save code and text in a Markdown-based file. Cell outputs are not included.",Icon:Qe,Options:wn},ipynb:{label:"Jupyter",actionLabel:"Export Jupyter notebook",description:"Open the notebook in Jupyter and other compatible tools.",Icon:Rt,Options:jn},pdf:{label:"PDF",actionLabel:"Export PDF",description:"Save the notebook as a PDF for printing or sharing.",Icon:xe,Options:Nn},script:{label:"Python",actionLabel:"Export flat script",description:"Save the notebook as a Python file.",Icon:Pe,Options:Cn},png:{label:"PNG",actionLabel:"Export PNG",description:"Capture the current app view as an image.",Icon:Nt,Options:Sn}};function vn(t){let e=(0,X.c)(7),{options:s,updateOptions:n,disabled:i}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={checked:"Includes code cells in the webpage.",unchecked:"Leaves code cells out of the webpage."},e[0]=l):l=e[0];let o;e[1]===n?o=e[2]:(o=d=>n("html",{includeCode:d}),e[1]=n,e[2]=o);let r;return e[3]!==i||e[4]!==s.html.includeCode||e[5]!==o?(r=(0,a.jsx)(ge,{children:(0,a.jsx)(Ie,{label:"Include code",descriptions:l,checked:s.html.includeCode,disabled:i,onCheckedChange:o})}),e[3]=i,e[4]=s.html.includeCode,e[5]=o,e[6]=r):r=e[6],r}function wn(t){let e=(0,X.c)(6),{options:s,updateOptions:n,disabled:i}=t,l=s.markdown.flavor??"automatic",o;e[0]===n?o=e[1]:(o=d=>n("markdown",{flavor:d==="automatic"?null:d}),e[0]=n,e[1]=o);let r;return e[2]!==i||e[3]!==l||e[4]!==o?(r=(0,a.jsx)(ge,{children:(0,a.jsx)(In,{label:"Format",value:l,disabled:i,onValueChange:o,options:bn})}),e[2]=i,e[3]=l,e[4]=o,e[5]=r):r=e[5],r}function jn(t){let e=(0,X.c)(16),{options:s,updateOptions:n,disabled:i}=t,l;e[0]===n?l=e[1]:(l=m=>n("ipynb",{sortMode:m}),e[0]=n,e[1]=l);let o;e[2]!==i||e[3]!==s.ipynb.sortMode||e[4]!==l?(o=(0,a.jsx)(Me,{label:"Cell order",value:s.ipynb.sortMode,disabled:i,onValueChange:l,options:xn}),e[2]=i,e[3]=s.ipynb.sortMode,e[4]=l,e[5]=o):o=e[5];let r;e[6]===Symbol.for("react.memo_cache_sentinel")?(r={checked:"Keeps the outputs currently shown in the notebook.",unchecked:"Leaves cell outputs out of the Jupyter notebook."},e[6]=r):r=e[6];let d;e[7]===n?d=e[8]:(d=m=>n("ipynb",{includeOutputs:m}),e[7]=n,e[8]=d);let c;e[9]!==i||e[10]!==s.ipynb.includeOutputs||e[11]!==d?(c=(0,a.jsx)(Ie,{label:"Include outputs",descriptions:r,checked:s.ipynb.includeOutputs,disabled:i,onCheckedChange:d}),e[9]=i,e[10]=s.ipynb.includeOutputs,e[11]=d,e[12]=c):c=e[12];let u;return e[13]!==o||e[14]!==c?(u=(0,a.jsxs)(ge,{children:[o,c]}),e[13]=o,e[14]=c,e[15]=u):u=e[15],u}function Nn(t){let e=(0,X.c)(30),{options:s,updateOptions:n,disabled:i}=t,l;e[0]===n?l=e[1]:(l=p=>n("pdf",{preset:p}),e[0]=n,e[1]=l);let o;e[2]!==i||e[3]!==s.pdf.preset||e[4]!==l?(o=(0,a.jsx)(Me,{label:"Layout",value:s.pdf.preset,disabled:i,onValueChange:l,options:yn}),e[2]=i,e[3]=s.pdf.preset,e[4]=l,e[5]=o):o=e[5];let r;e[6]===Symbol.for("react.memo_cache_sentinel")?(r={checked:"Includes code cells in the PDF.",unchecked:"Leaves code cells out of the PDF."},e[6]=r):r=e[6];let d;e[7]===n?d=e[8]:(d=p=>n("pdf",{includeInputs:p}),e[7]=n,e[8]=d);let c;e[9]!==i||e[10]!==s.pdf.includeInputs||e[11]!==d?(c=(0,a.jsx)(Ie,{label:"Include code",descriptions:r,checked:s.pdf.includeInputs,disabled:i,onCheckedChange:d}),e[9]=i,e[10]=s.pdf.includeInputs,e[11]=d,e[12]=c):c=e[12];let u;e[13]===Symbol.for("react.memo_cache_sentinel")?(u={checked:"Keeps the outputs currently shown in the notebook.",unchecked:"Leaves cell outputs out of the PDF."},e[13]=u):u=e[13];let m;e[14]===n?m=e[15]:(m=p=>n("pdf",{includeOutputs:p}),e[14]=n,e[15]=m);let h;e[16]!==i||e[17]!==s.pdf.includeOutputs||e[18]!==m?(h=(0,a.jsx)(Ie,{label:"Include outputs",descriptions:u,checked:s.pdf.includeOutputs,disabled:i,onCheckedChange:m}),e[16]=i,e[17]=s.pdf.includeOutputs,e[18]=m,e[19]=h):h=e[19];let b;e[20]!==i||e[21]!==s.pdf.preset||e[22]!==s.pdf.webpdf||e[23]!==n?(b=s.pdf.preset==="document"?(0,a.jsx)(Me,{label:"Method",value:s.pdf.webpdf?"browser":"latex",disabled:i,onValueChange:p=>n("pdf",{webpdf:p==="browser"}),options:kn}):null,e[20]=i,e[21]=s.pdf.preset,e[22]=s.pdf.webpdf,e[23]=n,e[24]=b):b=e[24];let f;return e[25]!==o||e[26]!==c||e[27]!==h||e[28]!==b?(f=(0,a.jsxs)(ge,{children:[o,c,h,b]}),e[25]=o,e[26]=c,e[27]=h,e[28]=b,e[29]=f):f=e[29],f}function Cn(t){let e=(0,X.c)(6),{options:s,updateOptions:n,disabled:i}=t,l;e[0]===n?l=e[1]:(l=r=>n("script",{type:r}),e[0]=n,e[1]=l);let o;return e[2]!==i||e[3]!==s.script.type||e[4]!==l?(o=(0,a.jsx)(ge,{children:(0,a.jsx)(Me,{label:"Format",value:s.script.type,disabled:i,onValueChange:l,options:gn})}),e[2]=i,e[3]=s.script.type,e[4]=l,e[5]=o):o=e[5],o}function Sn(){return null}function ge(t){let e=(0,X.c)(2),{children:s}=t,n;return e[0]===s?n=e[1]:(n=(0,a.jsx)("div",{className:"divide-y rounded-md border",children:s}),e[0]=s,e[1]=n),n}function Ie(t){let e=(0,X.c)(26),{label:s,descriptions:n,descriptionOverride:i,checked:l,disabled:o,onCheckedChange:r}=t,d=(0,L.useId)(),c=`${d}-description`,u=i??(l?n.checked:n.unchecked),m;e[0]===i?m=e[1]:(m=i?[i]:[],e[0]=i,e[1]=m);let h;e[2]!==n.checked||e[3]!==n.unchecked||e[4]!==m?(h=[n.checked,n.unchecked,...m],e[2]=n.checked,e[3]=n.unchecked,e[4]=m,e[5]=h):h=e[5];let b=h,f;e[6]!==d||e[7]!==s?(f=(0,a.jsx)("label",{htmlFor:d,className:"text-sm font-medium leading-5",children:s}),e[6]=d,e[7]=s,e[8]=f):f=e[8];let p;e[9]!==u||e[10]!==c||e[11]!==b?(p=(0,a.jsx)(Ge,{id:c,description:u,possibleDescriptions:b}),e[9]=u,e[10]=c,e[11]=b,e[12]=p):p=e[12];let k;e[13]!==f||e[14]!==p?(k=(0,a.jsxs)("div",{className:"min-w-0",children:[f,p]}),e[13]=f,e[14]=p,e[15]=k):k=e[15];let y;e[16]!==l||e[17]!==c||e[18]!==o||e[19]!==d||e[20]!==s||e[21]!==r?(y=(0,a.jsx)($a,{id:d,size:"sm",checked:l,disabled:o,onCheckedChange:r,"aria-label":s,"aria-describedby":c}),e[16]=l,e[17]=c,e[18]=o,e[19]=d,e[20]=s,e[21]=r,e[22]=y):y=e[22];let g;return e[23]!==k||e[24]!==y?(g=(0,a.jsxs)("div",{className:"flex min-h-14 items-center justify-between gap-4 px-3 py-2",children:[k,y]}),e[23]=k,e[24]=y,e[25]=g):g=e[25],g}function Me(t){var w;let e=(0,X.c)(31),{label:s,value:n,disabled:i,onValueChange:l,options:o}=t,r=(0,L.useId)(),d=`${r}-description`,c;e[0]!==o||e[1]!==n?(c=(w=o.find(v=>v.value===n))==null?void 0:w.description,e[0]=o,e[1]=n,e[2]=c):c=e[2];let u=c,m;e[3]===s?m=e[4]:(m=(0,a.jsx)("div",{className:"text-sm font-medium leading-5",children:s}),e[3]=s,e[4]=m);let h=u??"",b;e[5]===o?b=e[6]:(b=o.map(zn),e[5]=o,e[6]=b);let f;e[7]!==d||e[8]!==h||e[9]!==b?(f=(0,a.jsx)(Ge,{id:d,description:h,possibleDescriptions:b}),e[7]=d,e[8]=h,e[9]=b,e[10]=f):f=e[10];let p;e[11]!==m||e[12]!==f?(p=(0,a.jsxs)("div",{className:"min-w-0",children:[m,f]}),e[11]=m,e[12]=f,e[13]=p):p=e[13];let k;e[14]===l?k=e[15]:(k=v=>l(v),e[14]=l,e[15]=k);let y;if(e[16]!==r||e[17]!==o){let v;e[19]===r?v=e[20]:(v=(O,z)=>{let C=`${r}-${z}`;return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(ss,{id:C,value:O.value}),(0,a.jsx)("label",{htmlFor:C,className:"text-sm",children:O.label})]},O.value)},e[19]=r,e[20]=v),y=o.map(v),e[16]=r,e[17]=o,e[18]=y}else y=e[18];let g;e[21]!==d||e[22]!==i||e[23]!==s||e[24]!==k||e[25]!==y||e[26]!==n?(g=(0,a.jsx)(ns,{value:n,onValueChange:k,className:"flex shrink-0 flex-wrap gap-x-5 gap-y-2 sm:justify-end","aria-label":s,"aria-describedby":d,disabled:i,children:y}),e[21]=d,e[22]=i,e[23]=s,e[24]=k,e[25]=y,e[26]=n,e[27]=g):g=e[27];let x;return e[28]!==p||e[29]!==g?(x=(0,a.jsxs)("div",{className:"flex min-h-14 flex-col items-stretch gap-2 px-3 py-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4",children:[p,g]}),e[28]=p,e[29]=g,e[30]=x):x=e[30],x}function zn(t){return t.description}function In(t){var z;let e=(0,X.c)(34),{label:s,value:n,disabled:i,onValueChange:l,options:o}=t,r=(0,L.useId)(),d=`${r}-description`,c;e[0]!==o||e[1]!==n?(c=(z=o.find(C=>C.value===n))==null?void 0:z.description,e[0]=o,e[1]=n,e[2]=c):c=e[2];let u=c,m;e[3]!==r||e[4]!==s?(m=(0,a.jsx)("label",{htmlFor:r,className:"text-sm font-medium leading-5",children:s}),e[3]=r,e[4]=s,e[5]=m):m=e[5];let h=u??"",b;e[6]===o?b=e[7]:(b=o.map(On),e[6]=o,e[7]=b);let f;e[8]!==d||e[9]!==h||e[10]!==b?(f=(0,a.jsx)(Ge,{id:d,description:h,possibleDescriptions:b}),e[8]=d,e[9]=h,e[10]=b,e[11]=f):f=e[11];let p;e[12]!==m||e[13]!==f?(p=(0,a.jsxs)("div",{className:"min-w-0",children:[m,f]}),e[12]=m,e[13]=f,e[14]=p):p=e[14];let k;e[15]===l?k=e[16]:(k=C=>l(C),e[15]=l,e[16]=k);let y;e[17]===Symbol.for("react.memo_cache_sentinel")?(y=(0,a.jsx)(dt,{}),e[17]=y):y=e[17];let g;e[18]!==d||e[19]!==r?(g=(0,a.jsx)(mt,{id:r,"aria-describedby":d,className:"h-8 w-full shrink-0 sm:w-44",children:y}),e[18]=d,e[19]=r,e[20]=g):g=e[20];let x;e[21]===o?x=e[22]:(x=o.map(Mn),e[21]=o,e[22]=x);let w;e[23]===x?w=e[24]:(w=(0,a.jsx)(ut,{children:x}),e[23]=x,e[24]=w);let v;e[25]!==i||e[26]!==w||e[27]!==k||e[28]!==g||e[29]!==n?(v=(0,a.jsxs)(pt,{value:n,disabled:i,onValueChange:k,children:[g,w]}),e[25]=i,e[26]=w,e[27]=k,e[28]=g,e[29]=n,e[30]=v):v=e[30];let O;return e[31]!==v||e[32]!==p?(O=(0,a.jsxs)("div",{className:"flex min-h-14 flex-col items-stretch gap-2 px-3 py-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4",children:[p,v]}),e[31]=v,e[32]=p,e[33]=O):O=e[33],O}function Mn(t){return(0,a.jsx)(ct,{value:t.value,children:t.label},t.value)}function On(t){return t.description}function Ge(t){let e=(0,X.c)(15),{id:s,description:n,possibleDescriptions:i}=t,l;e[0]===i?l=e[1]:(l=new Set(i),e[0]=i,e[1]=l);let o;e[2]===l?o=e[3]:(o=[...l],e[2]=l,e[3]=o);let r;e[4]!==n||e[5]!==o?(r=o.filter(h=>h!==n),e[4]=n,e[5]=o,e[6]=r):r=e[6];let d=r,c;e[7]!==n||e[8]!==s?(c=(0,a.jsx)("p",{id:s,"aria-live":"polite",className:"col-start-1 row-start-1",children:n}),e[7]=n,e[8]=s,e[9]=c):c=e[9];let u;e[10]===d?u=e[11]:(u=d.map(_n),e[10]=d,e[11]=u);let m;return e[12]!==c||e[13]!==u?(m=(0,a.jsxs)("div",{className:"mt-0.5 grid text-xs leading-4 text-muted-foreground",children:[c,u]}),e[12]=c,e[13]=u,e[14]=m):m=e[14],m}function _n(t){return(0,a.jsx)("p",{"aria-hidden":!0,className:"invisible col-start-1 row-start-1",children:t},t)}var Oe=W(),la={"playwright-chromium":{description:"PDF export requires Playwright Chromium."}};function Ln(t){var c;let e=(0,Oe.c)(10),{status:s}=t;if(s.available&&!s.availabilityCheckFailed)return null;if(((c=s.reason)==null?void 0:c.type)==="checking-requirements"){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsxs)("span",{className:"ml-auto flex shrink-0",children:[(0,a.jsx)(Ne,{size:"small",className:"size-3"}),(0,a.jsx)("span",{className:"sr-only",children:"Checking requirements"})]}),e[0]=u):u=e[0],u}let n=s.availabilityCheckFailed?"Requirements unknown":"Unavailable",i=s.availabilityCheckFailed?"text-muted-foreground":"text-(--yellow-11)",l;e[1]===i?l=e[2]:(l=be("size-3",i),e[1]=i,e[2]=l);let o;e[3]===l?o=e[4]:(o=(0,a.jsx)(Xe,{className:l}),e[3]=l,e[4]=o);let r;e[5]===n?r=e[6]:(r=(0,a.jsx)("span",{className:"sr-only",children:n}),e[5]=n,e[6]=r);let d;return e[7]!==o||e[8]!==r?(d=(0,a.jsxs)("span",{className:"ml-auto flex shrink-0",children:[o,r]}),e[7]=o,e[8]=r,e[9]=d):d=e[9],d}function Fn(t){let e=(0,Oe.c)(7),{format:s,formatLabel:n,status:i,onInstall:l,isInstalling:o}=t,r=o===void 0?!1:o;if(i.availabilityCheckFailed){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.jsx)("div",{className:"mb-2.5",children:(0,a.jsx)(ve,{children:"Couldn't check whether this export is available. You can still try it."})}),e[0]=c):c=e[0],c}if(!i.reason)return null;let d;return e[1]!==s||e[2]!==n||e[3]!==r||e[4]!==l||e[5]!==i.reason?(d=(0,a.jsx)("div",{className:"mb-2.5",children:(0,a.jsx)(Pn,{format:s,formatLabel:n,reason:i.reason,onInstall:l,isInstalling:r})}),e[1]=s,e[2]=n,e[3]=r,e[4]=l,e[5]=i.reason,e[6]=d):d=e[6],d}function ve(t){let e=(0,Oe.c)(9),{children:s,onInstall:n,isInstalling:i}=t,l=i===void 0?!1:i,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,a.jsx)(Xe,{className:"size-4 shrink-0"}),e[0]=o):o=e[0];let r;e[1]===s?r=e[2]:(r=(0,a.jsx)("span",{className:"min-w-0 flex-1",children:s}),e[1]=s,e[2]=r);let d;e[3]!==l||e[4]!==n?(d=n?(0,a.jsxs)(oe,{type:"button",variant:"outline",size:"xs",className:"shrink-0 border-input bg-background text-foreground hover:border-input hover:bg-muted hover:text-foreground",disabled:l,"aria-busy":l,onClick:n,children:[l?(0,a.jsx)(Ne,{size:"small",className:"mr-1.5 size-3.5"}):(0,a.jsx)(Et,{className:"mr-1.5 size-3.5"}),"Install"]}):null,e[3]=l,e[4]=n,e[5]=d):d=e[5];let c;return e[6]!==r||e[7]!==d?(c=(0,a.jsxs)(It,{variant:"warning",className:"flex items-center gap-2.5 px-3 py-2 text-(--yellow-12) has-[svg]:pl-3 [&>svg]:static [&>svg+div]:translate-y-0",children:[o,(0,a.jsxs)(zt,{className:"flex min-w-0 flex-1 items-center gap-3 text-sm leading-5",children:[r,d]})]}),e[6]=r,e[7]=d,e[8]=c):c=e[8],c}function Pn(t){let e=(0,Oe.c)(22),{format:s,formatLabel:n,reason:i,onInstall:l,isInstalling:o}=t;switch(i.type){case"checking-requirements":{let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Ne,{className:"size-4 shrink-0",size:"small"}),e[0]=r):r=e[0];let d;return e[1]===n?d=e[2]:(d=(0,a.jsxs)(It,{role:"status",variant:"info",className:"flex items-center gap-2.5 p-3 has-[svg]:pl-3 [&>svg]:static [&>svg+div]:translate-y-0",children:[r,(0,a.jsxs)(zt,{className:"min-w-0 flex-1 text-sm leading-5",children:["Checking ",n," requirements\u2026"]})]}),e[1]=n,e[2]=d),d}case"notebook-must-be-named":{let r;return e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(ve,{children:"Name and save this notebook before exporting."}),e[3]=r):r=e[3],r}case"missing-packages":{let r;e[4]===i.packages?r=e[5]:(r=i.packages.join(", "),e[4]=i.packages,e[5]=r);let d;e[6]===r?d=e[7]:(d=(0,a.jsx)("code",{className:"break-words font-mono",children:r}),e[6]=r,e[7]=d);let c;return e[8]!==n||e[9]!==o||e[10]!==l||e[11]!==d?(c=(0,a.jsxs)(ve,{onInstall:l,isInstalling:o,children:[n," export requires"," ",d,"."]}),e[8]=n,e[9]=o,e[10]=l,e[11]=d,e[12]=c):c=e[12],c}case"missing-setup":{let r;e[13]!==l||e[14]!==i.requirements?(r=l?i.requirements.map(En).join(" "):(0,a.jsx)("span",{className:"block min-w-0",children:i.requirements.map(Wn)}),e[13]=l,e[14]=i.requirements,e[15]=r):r=e[15];let d;return e[16]!==o||e[17]!==l||e[18]!==r?(d=(0,a.jsx)(ve,{onInstall:l,isInstalling:o,children:r}),e[16]=o,e[17]=l,e[18]=r,e[19]=d):d=e[19],d}case"wasm-runtime":{let r=s==="pdf"?"Use your browser's print dialog to save the current app view as a PDF.":"Open this notebook in a local marimo session to use this export.",d;return e[20]===r?d=e[21]:(d=(0,a.jsx)(ve,{children:r}),e[20]=r,e[21]=d),d}default:ft(i)}}function Wn(t){let e=la[t.name];return(0,a.jsxs)("span",{className:"block",children:[e.description,(0,a.jsx)("code",{className:"mt-1 block break-all font-mono",children:t.command})]},t.name)}function En(t){return la[t.name].description}function An(t){return t.endsWith(".myst.md")?"mystmd":t.endsWith(".qmd")?"qmd":t.endsWith(".mdx")?"mdx":"pymdown"}function qn(t,e){let s=ks[e??An(t)],n=gs.find(o=>t.endsWith(o)),i=me.withoutExtension(t);n&&(i=t.slice(0,-n.length));let l=`${i}.${s}`;return l===t?`${t.slice(0,-(s.length+1))}.export.${s}`:l}function Dn(t){return Object.entries(t).flatMap(([e,s])=>s===null?[]:s===!0?[`--${e}`]:s===!1?[`--no-${e}`]:[`--${e}=${s}`])}function Rn(t){return t.preset==="document"?t.webpdf:null}var Tn={html:{subcommand:"html",flags:({html:t})=>({"include-code":t.includeCode}),outputFilename:t=>me.toHTML(t)},markdown:{subcommand:"md",flags:({markdown:t})=>({flavor:t.flavor}),outputFilename:(t,{markdown:e})=>qn(t,e.flavor)},ipynb:{subcommand:"ipynb",flags:({ipynb:t})=>({sort:t.sortMode,"include-outputs":t.includeOutputs}),outputFilename:t=>me.toIPYNB(t)},pdf:{subcommand:"pdf",flags:({pdf:t})=>({as:t.preset,"include-inputs":t.includeInputs,"include-outputs":t.includeOutputs,webpdf:Rn(t)}),outputFilename:t=>me.toPDF(t)},script:{subcommand:"script",flags:()=>({}),outputFilename:t=>`${me.withoutExtension(t)}.script.py`}};function $n({format:t,filename:e,options:s}){if(t==="png"||t==="script"&&s.script.type==="source"||!e)return null;let n=Tn[t];return["marimo","export",n.subcommand,_t(e),...Dn(n.flags(s)),"-o",_t(n.outputFilename(e,s))].join(" ")}async function Hn(t){let{exportOptions:e,captureOutputs:s,downloadPDF:n}=t;e.includeOutputs&&await s(),await n(e)}async function Vn({format:t,options:e,requests:s,sourceFilename:n,htmlFiles:i,captureOutputs:l,capturePNG:o,downloadFile:r}){switch(t){case"html":r(await s.exportAsHTML({download:!1,files:i,includeCode:e.html.includeCode}));return;case"markdown":r(await s.exportAsMarkdown({download:!1,flavor:e.markdown.flavor}));return;case"ipynb":e.ipynb.includeOutputs&&await l(),r(await s.exportAsIPYNB({download:!1,sortMode:e.ipynb.sortMode,includeOutputs:e.ipynb.includeOutputs}));return;case"pdf":await Hn({exportOptions:e.pdf,captureOutputs:l,downloadPDF:async d=>{r(await s.exportAsPDF(d))}});return;case"script":if(e.script.type==="source"){r({contents:(await s.readCode()).contents,filename:n,mediaType:"text/plain"});return}r(await s.exportAsScript({download:!1}));return;case"png":await o();return;default:ft(t)}}var Bn=W(),Un={source:{actionLabel:"Export notebook source",progressLabel:"notebook source"},flat:{actionLabel:"Export flat script",progressLabel:"flat script"}};function Gn(t,e){if(t==="wasm")return{status:"success",data:null};switch(e.status){case"pending":case"loading":return{status:"pending"};case"error":return{status:"error"};case"success":return{status:"success",data:e.data}}}function Kn(t,e){return t==="server"&&e?We.basename(e):me.toPY(document.title)}function Yn({usesBrowserPrint:t,hasCommand:e,format:s,isNotebookSource:n}){return t?"Uses the browser's print settings for page size and filename.":e?"Uses the current session state. The copied command exports the saved notebook.":s!=="png"&&!n?"Save the notebook to copy an equivalent shell command.":null}function Jn(t){var E,q;let e=Mt(),[s,n]=_e(oa),[i,l]=_e(hn),[o,r]=(0,L.useState)(t??i),d=fe()?"wasm":"server",c=re(),u=Ra(),[m,h]=(0,L.useState)(!1),b=Te(async()=>d==="wasm"?null:c.getExportAvailability(),[d,c]),f=Gn(d,b),p=N=>fn({format:N,options:s,runtime:d,filename:e,availability:f}),k=p(o),y=u&&(((E=k.reason)==null?void 0:E.type)==="missing-packages"||((q=k.reason)==null?void 0:q.type)==="missing-setup"),g=Qt.map(N=>({format:N,status:p(N)})),x=ia(d,o),w=Ue[o],v=o==="script"&&s.script.type==="source",{actionLabel:O,progressLabel:z}=o==="script"?Un[s.script.type]:{actionLabel:w.actionLabel,progressLabel:w.label},C=x?null:$n({format:o,filename:e,options:s}),S=Yn({usesBrowserPrint:x,hasCommand:!!C,format:o,isNotebookSource:v});return(0,L.useEffect)(()=>{t&&l(t)},[t,l]),{formats:g,options:s,selected:{format:o,status:k,usesBrowserPrint:x,actionLabel:O,command:C,footerDescription:S},exportRequest:{format:o,options:s,sourceFilename:Kn(d,e),available:k.available,usesBrowserPrint:x,progressLabel:z},selectFormat:N=>{sa(N)&&(r(N),l(N))},updateOptions:(N,A)=>{n(G=>{let P={...G};return P[N]={...G[N],...A},P})},canInstall:y,isInstalling:m,installRequirements:async()=>{if(!(!y||m||o==="png")){h(!0);try{let N=await c.installExportRequirements({format:o});b.setData(N)}catch{}finally{h(!1)}}}}}async function Xn(t){let e=document.getElementById("App");if(!e){let i="The current app view could not be captured.";throw de({title:"Failed to download as PNG",description:i,variant:"danger"}),Error(i)}let s=t==null?void 0:t.style.visibility,n=t==null?void 0:t.classList.contains("print:hidden");if(!await ts({element:e,filename:document.title,prepare:()=>{let i=as();return t&&(t.classList.add("print:hidden"),t.style.visibility="hidden"),()=>{i(),t&&(n||t.classList.remove("print:hidden"),t.style.visibility=s??"")}}}))throw Error("Failed to capture the current app view.")}function Qn(t){t(),requestAnimationFrame(()=>{setTimeout(()=>{window.print()},0)})}function Zn({format:t,options:e,sourceFilename:s,available:n,usesBrowserPrint:i,progressLabel:l,onClose:o}){let r=re(),d=As(),[c,u]=(0,L.useState)(!1),m=(0,L.useRef)(null),h=(0,L.useRef)(!0);(0,L.useEffect)(()=>(h.current=!0,()=>{h.current=!1}),[]);let b=async p=>{await qs({takeScreenshots:()=>d({progress:p}),updateCellOutputs:r.updateCellOutputs})},f=async()=>{await Ta(()=>{var p;return Xn(((p=m.current)==null?void 0:p.parentElement)??null)})};return{dialogRef:m,isExporting:c,submit:async()=>{if(!(!n||c)){if(i){Qn(o);return}u(!0);try{await es(`Exporting ${l}\u2026`,async p=>{await Vn({format:t,options:e,requests:r,sourceFilename:s,htmlFiles:xt.INSTANCE.filenames(),captureOutputs:()=>b(p),capturePNG:f,downloadFile:Za})}),h.current&&o()}catch(p){ue.error("Export failed",p)}finally{h.current&&u(!1)}}}}}function eo(t){let e=(0,Bn.c)(15),{initialFormat:s,onClose:n}=t,i=Jn(s),l,o,r;e[0]===i?(l=e[1],o=e[2],r=e[3]):({exportRequest:l,selectFormat:o,...r}=i,e[0]=i,e[1]=l,e[2]=o,e[3]=r);let d;e[4]!==l||e[5]!==n?(d={...l,onClose:n},e[4]=l,e[5]=n,e[6]=d):d=e[6];let c=Zn(d),u;e[7]!==c||e[8]!==o||e[9]!==r?(u=h=>{!c.isExporting&&!r.isInstalling&&o(h)},e[7]=c,e[8]=o,e[9]=r,e[10]=u):u=e[10];let m;return e[11]!==c||e[12]!==r||e[13]!==u?(m={...r,...c,selectFormat:u},e[11]=c,e[12]=r,e[13]=u,e[14]=m):m=e[14],m}var to=W(),ao="(min-width: 640px)";const so=t=>{let e=(0,to.c)(75),{initialFormat:s,onClose:n,returnFocusRef:i}=t,l;e[0]!==s||e[1]!==n?(l={initialFormat:s,onClose:n},e[0]=s,e[1]=n,e[2]=l):l=e[2];let{dialogRef:o,isExporting:r,isInstalling:d,canInstall:c,formats:u,options:m,selected:h,selectFormat:b,updateOptions:f,installRequirements:p,submit:k}=eo(l),y=r||d,g=Qa(ao),{format:x,status:w,usesBrowserPrint:v,actionLabel:O,command:z,footerDescription:C}=h,S=Ue[x],E=S.Options,q;e[3]===i?q=e[4]:(q=i?{onCloseAutoFocus:F=>{var j;F.preventDefault(),(j=i.current)==null||j.focus()}}:{},e[3]=i,e[4]=q);let N=q,A;e[5]===Symbol.for("react.memo_cache_sentinel")?(A=(0,a.jsxs)(Ae,{className:"border-b px-5 py-4 pr-12",children:[(0,a.jsx)(qe,{children:"Export notebook"}),(0,a.jsx)(Re,{children:"Choose a format and adjust its options."})]}),e[5]=A):A=e[5];let G=g?"vertical":"horizontal",P;if(e[6]!==u||e[7]!==y){let F;e[9]===y?F=e[10]:(F=j=>{let{format:M,status:Z}=j,we=Ue[M];return(0,a.jsxs)(Ga,{value:M,disabled:y,className:"min-w-0 justify-start gap-2 px-2.5 py-2 text-xs data-[state=active]:shadow-xs sm:w-full sm:text-sm","data-testid":`export-format-${M}`,children:[(0,a.jsx)(we.Icon,{className:"size-3.5 shrink-0",strokeWidth:1.5}),(0,a.jsx)("span",{className:"truncate",children:we.label}),(0,a.jsx)(Ln,{status:Z})]},M)},e[9]=y,e[10]=F),P=u.map(F),e[6]=u,e[7]=y,e[8]=P}else P=e[8];let K;e[11]===P?K=e[12]:(K=(0,a.jsx)(Ya,{"aria-label":"Export format",className:"grid max-h-none shrink-0 grid-cols-2 items-stretch justify-start gap-1 overflow-auto rounded-none border-b bg-muted/20 p-2 min-[360px]:grid-cols-3 sm:flex sm:h-full sm:flex-col sm:border-b-0 sm:border-r",children:P}),e[11]=P,e[12]=K);let Y;if(e[13]!==E||e[14]!==c||e[15]!==S.description||e[16]!==S.label||e[17]!==x||e[18]!==u||e[19]!==p||e[20]!==y||e[21]!==d||e[22]!==m||e[23]!==w||e[24]!==f||e[25]!==v){let F;e[27]!==E||e[28]!==c||e[29]!==S.description||e[30]!==S.label||e[31]!==x||e[32]!==p||e[33]!==y||e[34]!==d||e[35]!==m||e[36]!==w||e[37]!==f||e[38]!==v?(F=j=>{let{format:M}=j;return(0,a.jsxs)(Ka,{value:M,className:"mt-0 min-h-0 min-w-0 overflow-y-auto px-4 py-3",children:[(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsx)("h3",{className:"text-base font-semibold",children:S.label}),(0,a.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:S.description})]}),(0,a.jsx)(Fn,{format:x,formatLabel:S.label,status:w,onInstall:c?p:void 0,isInstalling:d}),v?null:(0,a.jsx)(E,{options:m,updateOptions:f,disabled:y})]},M)},e[27]=E,e[28]=c,e[29]=S.description,e[30]=S.label,e[31]=x,e[32]=p,e[33]=y,e[34]=d,e[35]=m,e[36]=w,e[37]=f,e[38]=v,e[39]=F):F=e[39],Y=u.map(F),e[13]=E,e[14]=c,e[15]=S.description,e[16]=S.label,e[17]=x,e[18]=u,e[19]=p,e[20]=y,e[21]=d,e[22]=m,e[23]=w,e[24]=f,e[25]=v,e[26]=Y}else Y=e[26];let D;e[40]!==x||e[41]!==b||e[42]!==G||e[43]!==K||e[44]!==Y?(D=(0,a.jsxs)(Ua,{value:x,onValueChange:b,orientation:G,className:"flex min-h-0 min-w-0 flex-col overflow-hidden sm:grid sm:grid-cols-[168px_minmax(0,1fr)]",children:[K,Y]}),e[40]=x,e[41]=b,e[42]=G,e[43]=K,e[44]=Y,e[45]=D):D=e[45];let J;e[46]===z?J=e[47]:(J=z?(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-2 rounded-md border bg-background px-2.5 py-2 font-mono text-xs",children:[(0,a.jsx)("span",{className:"select-none text-muted-foreground","aria-hidden":!0,children:"$"}),(0,a.jsx)("code",{className:"min-w-0 flex-1 overflow-x-auto whitespace-nowrap","data-testid":"export-cli-command","aria-label":"Equivalent POSIX shell command",children:z}),(0,a.jsx)(Ee,{value:z,className:"size-3.5",buttonClassName:be(rs({variant:"ghost",size:"icon"}),"shrink-0"),tooltip:"Copy POSIX shell command",ariaLabel:"Copy POSIX shell command",toastTitle:"Command copied"})]}):null,e[46]=z,e[47]=J);let ae=z&&"mt-3",R;e[48]===ae?R=e[49]:(R=be("flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",ae),e[48]=ae,e[49]=R);let T;e[50]===C?T=e[51]:(T=C?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:C}):null,e[50]=C,e[51]=T);let se=!w.available||y,ie=!C&&"sm:ml-auto",ne;e[52]===ie?ne=e[53]:(ne=be("border-(--blue-11) bg-(--blue-11) hover:border-(--blue-12) hover:bg-(--blue-12) sm:min-w-36 dark:border-(--blue-7) dark:bg-(--blue-5) dark:text-(--blue-12) dark:hover:border-(--blue-8) dark:hover:bg-(--blue-6)",ie),e[52]=ie,e[53]=ne);let $;e[54]===r?$=e[55]:($=r&&(0,a.jsx)(Ne,{size:"small",className:"mr-2","aria-hidden":!0}),e[54]=r,e[55]=$);let I=v?"Print to PDF":O,H;e[56]!==r||e[57]!==k||e[58]!==se||e[59]!==ne||e[60]!==$||e[61]!==I?(H=(0,a.jsxs)(oe,{type:"button",disabled:se,"aria-busy":r,onClick:k,className:ne,"data-testid":"export-submit",children:[$,I]}),e[56]=r,e[57]=k,e[58]=se,e[59]=ne,e[60]=$,e[61]=I,e[62]=H):H=e[62];let V;e[63]!==R||e[64]!==T||e[65]!==H?(V=(0,a.jsxs)("div",{className:R,children:[T,H]}),e[63]=R,e[64]=T,e[65]=H,e[66]=V):V=e[66];let Q;e[67]!==V||e[68]!==J?(Q=(0,a.jsxs)("footer",{className:"min-w-0 border-t bg-muted/20 px-4 py-3",children:[J,V]}),e[67]=V,e[68]=J,e[69]=Q):Q=e[69];let le;return e[70]!==o||e[71]!==N||e[72]!==Q||e[73]!==D?(le=(0,a.jsxs)(De,{ref:o,className:"grid h-dvh max-h-[760px] min-w-0 w-[calc(100vw-2rem)] grid-rows-[auto_minmax(0,1fr)_auto] gap-0 overflow-hidden p-0 sm:top-[5vh] sm:h-[90vh] sm:max-h-[640px] sm:max-w-3xl","data-testid":"export-dialog",...N,children:[A,D,Q]}),e[70]=o,e[71]=N,e[72]=Q,e[73]=D,e[74]=le):le=e[74],le};var no=W();function oo(t){let e=(0,no.c)(5),{openPrompt:s,closeModal:n}=Se(),{sendCopy:i}=re(),l;return e[0]!==n||e[1]!==s||e[2]!==i||e[3]!==t?(l=()=>{if(!t)return null;let o=zs.guessDeliminator(t);s({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${We.basename(t)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:r=>{let d=o.join(We.dirname(t),r);i({source:t,destination:d}).then(()=>{n(),de({title:"Notebook copied",description:"A copy of the notebook has been created."}),Es(d)})}})},e[0]=n,e[1]=s,e[2]=i,e[3]=t,e[4]=l):l=e[4],l}var ro=W();function da(){let t=(0,ro.c)(4),{openConfirm:e}=Se(),s=ce(lt),{sendRestart:n}=re(),i;return t[0]!==e||t[1]!==n||t[2]!==s?(i=()=>{e({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)(Ba,{onClick:async()=>{s({state:it.CLOSING}),await n(),_s()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=n,t[2]=s,t[3]=i):i=t[3],i}var io=W(),lo=new ka,co=t=>lo.isSupported(t)?"markdown":"code";const ca=()=>{let t=(0,io.c)(3),{updateCellConfig:e}=Ye(),{saveCellConfig:s}=re(),n;return t[0]!==s||t[1]!==e?(n=async(i,l)=>{let o=at(),r={};for(let c of o.cellIds.inOrderIds){let u=o.cellData[c];u===void 0||u.config.hide_code===i||co(u.code)===l&&(r[c]={hide_code:i})}let d=nt.entries(r);if(d.length!==0){await s({configs:r});for(let[c,u]of d)e({cellId:c,config:u})}},t[0]=s,t[1]=e,t[2]=n):n=t[2],n};var uo=W(),pe=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function mo(t){var Q,le,F;let e=(0,uo.c)(45),s;e[0]===t?s=e[1]:(s=t===void 0?{}:t,e[0]=t,e[1]=s);let{exportDialogReturnFocusRef:n}=s,i=Mt(),{openModal:l,closeModal:o}=Se(),{toggleApplication:r}=ba(),{selectedPanel:d}=ja(),[c]=_e(rt),u=ee(Da),m=ca(),[h]=Ea(),b=ee(ya),f=ee(Aa),{updateCellConfig:p,undoDeleteCell:k,clearAllCellOutputs:y,addSetupCellIfDoesntExist:g,collapseAllCells:x,expandAllCells:w}=Ye(),v=da(),O=Ms(),z=oo(i),C=ce(Yt),S=ce(Fa),{handleClick:E}=Pa(),q=ce(La),N=ce(oa),{readCode:A,saveCellConfig:G}=re(),P=ee(Ma),K=ee(Oa),Y=ee(wa),{selectedLayout:D}=yt(),{setLayoutView:J}=kt(),ae=Kt(),R=((Q=h.sharing)==null?void 0:Q.html)??!0,T=((le=h.sharing)==null?void 0:le.wasm)??!0,se=((F=h.sharing)==null?void 0:F.molab)??!0,ie=D==="slides",ne=zo,$;e[2]!==o||e[3]!==n||e[4]!==l||e[5]!==N?($=(j,M)=>{M&&N(Z=>na(Z,M)),l((0,a.jsx)(so,{initialFormat:j,onClose:o,returnFocusRef:n}))},e[2]=o,e[3]=n,e[4]=l,e[5]=N,e[6]=$):$=e[6];let I=$,H;e[7]===Symbol.for("react.memo_cache_sentinel")?(H=(0,a.jsx)(ht,{size:14,strokeWidth:1.5}),e[7]=H):H=e[7];let V;return e[8]!==g||e[9]!==f||e[10]!==K||e[11]!==b||e[12]!==y||e[13]!==o||e[14]!==x||e[15]!==z||e[16]!==w||e[17]!==i||e[18]!==P||e[19]!==ie||e[20]!==u||e[21]!==I||e[22]!==l||e[23]!==E||e[24]!==A||e[25]!==v||e[26]!==O||e[27]!==G||e[28]!==D||e[29]!==d||e[30]!==m||e[31]!==C||e[32]!==q||e[33]!==J||e[34]!==S||e[35]!==R||e[36]!==se||e[37]!==T||e[38]!==r||e[39]!==ae||e[40]!==k||e[41]!==Y||e[42]!==p||e[43]!==c.mode?(V=[{icon:H,label:"Export\u2026",additionalKeywords:["download","html","markdown","ipynb","pdf","script","png"],handle:()=>I()},{icon:(0,a.jsx)(ht,{size:14,strokeWidth:1.5}),label:"Download",handle:pe,dropdown:[{icon:(0,a.jsx)(bt,{size:14,strokeWidth:1.5}),label:"Download as HTML",handle:()=>I("html",{html:{includeCode:!0}})},{icon:(0,a.jsx)(bt,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:()=>I("html",{html:{includeCode:!1}})},{icon:(0,a.jsx)(Ls,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:()=>I("markdown")},{icon:(0,a.jsx)(Rt,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:()=>I("ipynb")},{icon:(0,a.jsx)(Pe,{size:14,strokeWidth:1.5}),label:"Download notebook source",handle:()=>I("script",{script:{type:"source"}})},{icon:(0,a.jsx)(Pe,{size:14,strokeWidth:1.5}),label:"Download flat script",handle:()=>I("script",{script:{type:"flat"}})},{divider:!0,icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"Download as PNG",handle:()=>I("png")},ie?{divider:!0,icon:(0,a.jsx)(xe,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:pe,dropdown:[{icon:(0,a.jsx)(xe,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:()=>I("pdf",{pdf:{preset:"document"}})},{icon:(0,a.jsx)(xe,{size:14,strokeWidth:1.5}),label:"Slides Layout",hidden:fe(),rightElement:(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"}),handle:()=>I("pdf",{pdf:{preset:"slides"}})}]}:{divider:!0,icon:(0,a.jsx)(xe,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:()=>I("pdf",{pdf:{preset:"document"}})}]},{icon:(0,a.jsx)(Ns,{size:14,strokeWidth:1.5}),label:"Pair with an agent",hidden:fe(),handle:async()=>{l((0,a.jsx)(Ps,{onClose:o}))}},{icon:(0,a.jsx)(Bs,{size:14,strokeWidth:1.5}),label:"Share",handle:pe,hidden:!R&&!T&&!se,dropdown:[{icon:(0,a.jsx)(jt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!R,handle:async()=>{l((0,a.jsx)(an,{onClose:o}))}},{icon:(0,a.jsx)(vs,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!T,handle:async()=>{await Ce(St({code:(await A()).contents})),de({title:"Copied",description:"Link copied to clipboard."})}},{icon:(0,a.jsx)(Ft,{size:14,strokeWidth:1.5}),label:"Create molab notebook",hidden:!se,handle:async()=>{let j=St({code:(await A()).contents,baseUrl:`${B.molab}/new`});window.open(j,"_blank")}}]},{icon:(0,a.jsx)(Vs,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:pe,dropdown:xa.flatMap(j=>{let M=j.type==="ai"&&!f;if(Ca({panel:j,capabilities:b,aiEnabled:f})&&!M)return[];let{type:Z,Icon:we,additionalKeywords:ua}=j;return{label:Fe.startCase(Z),rightElement:ne(d===Z),icon:(0,a.jsx)(we,{size:14,strokeWidth:1.5}),handle:()=>{if(M){E("ai","ai-features");return}r(Z)},additionalKeywords:ua}})},{icon:(0,a.jsx)(Tt,{size:14,strokeWidth:1.5}),label:"Present as",handle:pe,dropdown:[{icon:c.mode==="present"?(0,a.jsx)(Cs,{size:14,strokeWidth:1.5}):(0,a.jsx)(ds,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{ae()}},...Pt.map((j,M)=>{let Z=Jt(j);return{divider:M===0,label:Xt(j),icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:D===j&&(0,a.jsx)(gt,{size:14})}),handle:()=>{J(j),c.mode==="edit"&&ae()}}})]},{icon:(0,a.jsx)($s,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!i||fe(),handle:z},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!i,handle:async()=>{await Ce((await A()).contents),de({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(ms,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!P||u,handle:async()=>{let j=za(at());await G({configs:nt.fromEntries(j.map(So))});for(let M of j)p({cellId:M,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(qt,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{g({})}},{icon:(0,a.jsx)(va,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{l((0,a.jsx)(Lt,{onClose:o}))}},{icon:(0,a.jsx)(xs,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{l((0,a.jsx)(Lt,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)($t,{size:14,strokeWidth:1.5}),label:Y,hidden:!K||u,handle:()=>{k()}},{icon:(0,a.jsx)(Us,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:v,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Ts,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{O()}},{icon:(0,a.jsx)(Na,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{y()}},{icon:(0,a.jsx)(Ze,{size:14,strokeWidth:1.5}),label:"Show all code",hotkey:"global.showAllCode",handle:()=>m(!1,"code"),redundant:!0},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Hide all code",hotkey:"global.hideAllCode",handle:()=>m(!0,"code"),redundant:!0},{icon:(0,a.jsx)(Ze,{size:14,strokeWidth:1.5}),label:"Show all markdown code",hotkey:"global.showAllMarkdownCode",handle:()=>m(!1,"markdown"),redundant:!0},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",hotkey:"global.hideAllMarkdownCode",handle:()=>m(!0,"markdown"),redundant:!0},{icon:(0,a.jsx)(Rs,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:x,redundant:!0},{icon:(0,a.jsx)(Ds,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:w,redundant:!0},{divider:!0,icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>C(Co)},{icon:(0,a.jsx)(cs,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>q(No)},{icon:(0,a.jsx)(js,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>S(jo),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(Dt,{size:14,strokeWidth:1.5}),label:"Report an issue",additionalKeywords:["feedback","bug","issue","report","diagnostics"],handle:()=>l((0,a.jsx)(Ut,{onClose:o}))},{icon:(0,a.jsx)(wt,{size:14,strokeWidth:1.5}),label:"Resources",handle:pe,dropdown:[{icon:(0,a.jsx)(ga,{size:14,strokeWidth:1.5}),label:"Documentation",handle:wo},{icon:(0,a.jsx)(Ws,{className:"h-3.5 w-3.5"}),label:"GitHub",handle:vo},{icon:(0,a.jsx)(hs,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:go},{icon:(0,a.jsx)(bs,{className:"h-3.5 w-3.5"}),label:"YouTube",handle:ko},{icon:(0,a.jsx)(Qe,{size:14,strokeWidth:1.5}),label:"Changelog",handle:yo}]},{divider:!0,icon:(0,a.jsx)(ys,{size:14,strokeWidth:1.5}),label:"Open home",hidden:!location.search.includes("file"),handle:xo},{icon:(0,a.jsx)(Ft,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:bo}].filter(fo).map(po),e[8]=g,e[9]=f,e[10]=K,e[11]=b,e[12]=y,e[13]=o,e[14]=x,e[15]=z,e[16]=w,e[17]=i,e[18]=P,e[19]=ie,e[20]=u,e[21]=I,e[22]=l,e[23]=E,e[24]=A,e[25]=v,e[26]=O,e[27]=G,e[28]=D,e[29]=d,e[30]=m,e[31]=C,e[32]=q,e[33]=J,e[34]=S,e[35]=R,e[36]=se,e[37]=T,e[38]=r,e[39]=ae,e[40]=k,e[41]=Y,e[42]=p,e[43]=c.mode,e[44]=V):V=e[44],V}function po(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(ho)}:t}function ho(t){return!t.hidden}function fo(t){return!t.hidden}function bo(){let t=Is();window.open(t,"_blank")}function xo(){let t=document.baseURI.split("?")[0];window.open(t,"_blank","noopener")}function yo(){window.open(B.releasesPage,"_blank")}function ko(){window.open(B.youtube,"_blank")}function go(){window.open(B.discordLink,"_blank")}function vo(){window.open(B.githubPage,"_blank")}function wo(){window.open(B.docsPage,"_blank")}function jo(t){return!t}function No(t){return!t}function Co(t){return!t}function So(t){return[t,{disabled:!1}]}function zo(t){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:t&&(0,a.jsx)(gt,{size:14})})}export{Yt as a,He as c,qt as d,At as f,dn as i,$t as l,Wt as m,ca as n,Kt as o,Et as p,da as r,en as s,mo as t,Dt as u};
|
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-CvqoLM43.js"></script>
|
|
70
70
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-BPPi7vOr.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="./assets/objects-CrbstYTV.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/chunk-C4rtOYze.js">
|
package/package.json
CHANGED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { describe, expect, it } from "vitest";
|
|
4
|
+
import { isPackageRequirementInstalled } from "./optional-features";
|
|
5
|
+
|
|
6
|
+
describe("isPackageRequirementInstalled", () => {
|
|
7
|
+
const installedPackages = [
|
|
8
|
+
{ name: "mcp", version: "2.0.0" },
|
|
9
|
+
{ name: "polars", version: "1.8.2" },
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
it("requires the package to be installed", () => {
|
|
13
|
+
expect(
|
|
14
|
+
isPackageRequirementInstalled({ name: "missing" }, installedPackages),
|
|
15
|
+
).toBe(false);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("accepts an installed package without a minimum version", () => {
|
|
19
|
+
expect(
|
|
20
|
+
isPackageRequirementInstalled({ name: "polars" }, installedPackages),
|
|
21
|
+
).toBe(true);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("rejects an installed package below the minimum version", () => {
|
|
25
|
+
expect(
|
|
26
|
+
isPackageRequirementInstalled(
|
|
27
|
+
{ name: "mcp", minVersion: "2.1.0" },
|
|
28
|
+
installedPackages,
|
|
29
|
+
),
|
|
30
|
+
).toBe(false);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it.each(["2.0.0rc1", "2.0.0.dev1", "2.0.0-beta1"])(
|
|
34
|
+
"rejects the prerelease version %s",
|
|
35
|
+
(version) => {
|
|
36
|
+
expect(
|
|
37
|
+
isPackageRequirementInstalled({ name: "mcp", minVersion: "2.0.0" }, [
|
|
38
|
+
{ name: "mcp", version },
|
|
39
|
+
]),
|
|
40
|
+
).toBe(false);
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
it.each(["2.1.0rc1", "3.0.0rc1"])(
|
|
45
|
+
"accepts the later prerelease version %s",
|
|
46
|
+
(version) => {
|
|
47
|
+
expect(
|
|
48
|
+
isPackageRequirementInstalled({ name: "mcp", minVersion: "2.0.0" }, [
|
|
49
|
+
{ name: "mcp", version },
|
|
50
|
+
]),
|
|
51
|
+
).toBe(true);
|
|
52
|
+
},
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
it("accepts an installed package at or above the minimum version", () => {
|
|
56
|
+
expect(
|
|
57
|
+
isPackageRequirementInstalled(
|
|
58
|
+
{ name: "mcp", minVersion: "2.0.0" },
|
|
59
|
+
installedPackages,
|
|
60
|
+
),
|
|
61
|
+
).toBe(true);
|
|
62
|
+
expect(
|
|
63
|
+
isPackageRequirementInstalled(
|
|
64
|
+
{ name: "mcp", minVersion: "1.9.0" },
|
|
65
|
+
installedPackages,
|
|
66
|
+
),
|
|
67
|
+
).toBe(true);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("normalizes extras in the requirement name", () => {
|
|
71
|
+
expect(
|
|
72
|
+
isPackageRequirementInstalled(
|
|
73
|
+
{ name: "polars[pyarrow]" },
|
|
74
|
+
installedPackages,
|
|
75
|
+
),
|
|
76
|
+
).toBe(true);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
@@ -20,6 +20,7 @@ import { isWasm } from "@/core/wasm/utils";
|
|
|
20
20
|
import { useAsyncData } from "@/hooks/useAsyncData";
|
|
21
21
|
import { ErrorBanner } from "@/plugins/impl/common/error-banner";
|
|
22
22
|
import { cn } from "@/utils/cn";
|
|
23
|
+
import { semverSort } from "@/utils/versions";
|
|
23
24
|
import { SettingSubtitle } from "./common";
|
|
24
25
|
|
|
25
26
|
interface Package {
|
|
@@ -27,6 +28,35 @@ interface Package {
|
|
|
27
28
|
minVersion?: string;
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
interface InstalledPackage {
|
|
32
|
+
name: string;
|
|
33
|
+
version: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const PEP_440_PRERELEASE =
|
|
37
|
+
/^((?:\d+!)?\d+(?:\.\d+)*)(?:[-_.]?(?:a|b|c|rc|alpha|beta|pre|preview|dev)\d*)/i;
|
|
38
|
+
|
|
39
|
+
export function isPackageRequirementInstalled(
|
|
40
|
+
requirement: Package,
|
|
41
|
+
installedPackages: InstalledPackage[],
|
|
42
|
+
): boolean {
|
|
43
|
+
const packageName = requirement.name.split("[")[0];
|
|
44
|
+
const installedPackage = installedPackages.find(
|
|
45
|
+
(pkg) => pkg.name === packageName,
|
|
46
|
+
);
|
|
47
|
+
if (!installedPackage) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
if (!requirement.minVersion) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
const prerelease = installedPackage.version.match(PEP_440_PRERELEASE);
|
|
54
|
+
if (prerelease) {
|
|
55
|
+
return semverSort(prerelease[1], requirement.minVersion) > 0;
|
|
56
|
+
}
|
|
57
|
+
return semverSort(installedPackage.version, requirement.minVersion) >= 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
30
60
|
interface OptionalFeature {
|
|
31
61
|
id: string;
|
|
32
62
|
/**
|
|
@@ -77,8 +107,8 @@ const OPTIONAL_DEPENDENCIES: OptionalFeature[] = [
|
|
|
77
107
|
},
|
|
78
108
|
{
|
|
79
109
|
id: "mcp",
|
|
80
|
-
packagesRequired: [{ name: "mcp", minVersion: "
|
|
81
|
-
additionalPackageInstalls: [
|
|
110
|
+
packagesRequired: [{ name: "mcp", minVersion: "2.0.0" }],
|
|
111
|
+
additionalPackageInstalls: [],
|
|
82
112
|
description: "Connect to MCP servers",
|
|
83
113
|
},
|
|
84
114
|
{
|
|
@@ -123,9 +153,6 @@ export const OptionalFeatures: React.FC = () => {
|
|
|
123
153
|
}
|
|
124
154
|
|
|
125
155
|
const installedPackages = data?.packages || [];
|
|
126
|
-
const installedPackageNames = new Set(
|
|
127
|
-
installedPackages.map((pkg) => pkg.name),
|
|
128
|
-
);
|
|
129
156
|
|
|
130
157
|
return (
|
|
131
158
|
<div className="flex-1 flex flex-col overflow-hidden gap-2">
|
|
@@ -149,7 +176,7 @@ export const OptionalFeatures: React.FC = () => {
|
|
|
149
176
|
<TableBody>
|
|
150
177
|
{OPTIONAL_DEPENDENCIES.map((dep) => {
|
|
151
178
|
const isInstalled = dep.packagesRequired.every((pkg) =>
|
|
152
|
-
|
|
179
|
+
isPackageRequirementInstalled(pkg, installedPackages),
|
|
153
180
|
);
|
|
154
181
|
const packageSpec = dep.packagesRequired
|
|
155
182
|
.map((pkg) => pkg.name)
|