@marimo-team/frontend 0.24.1-dev48 → 0.24.1-dev49
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/command-palette-DkGgAhyM.js +1 -0
- package/dist/assets/{edit-page-DxMQN491.js → edit-page-Bpqbjwkb.js} +3 -3
- package/dist/assets/{index-DUJeB0WY.js → index-CRLe8Sox.js} +2 -2
- package/dist/assets/{useNotebookActions-ClT4GmnB.js → useNotebookActions-DpphIKt5.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/components/editor/actions/types.ts +1 -2
- package/src/components/editor/actions/useNotebookActions.tsx +1 -0
- package/src/components/editor/controls/__tests__/notebook-menu-dropdown.test.tsx +41 -32
- package/dist/assets/command-palette-DtZy0Am-.js +0 -1
|
@@ -7,4 +7,4 @@ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,r
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
`)})]}),e[71]=C,e[72]=le);let de;e[73]===C?de=e[74]:(de=C&&u.length===0&&(0,X.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`No errors detected.`}),e[73]=C,e[74]=de);let fe;e[75]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,X.jsx)(`a`,{href:W.feedbackForm,target:`_blank`,rel:`noreferrer`,className:`underline`,children:`two-minute survey`}),e[75]=fe):fe=e[75];let me;e[76]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,X.jsx)(`div`,{className:`border-t pt-3`,children:(0,X.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Other feedback? Take our`,` `,fe,` `,`or chat with us on`,` `,(0,X.jsx)(`a`,{href:W.discordLink,target:`_blank`,rel:`noreferrer`,className:`underline`,children:`Discord`}),`.`]})}),e[76]=me):me=e[76];let q;return e[77]!==G||e[78]!==se||e[79]!==ce||e[80]!==K||e[81]!==le||e[82]!==de?(q=(0,X.jsxs)(ht,{className:`w-[540px] max-w-[90vw]`,children:[j,(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 max-h-[60vh] overflow-y-auto`,children:[G,se,ce,K,le,de,me]})]}),e[77]=G,e[78]=se,e[79]=ce,e[80]=K,e[81]=le,e[82]=de,e[83]=q):q=e[83],q};function En(e){return!e}function Dn(e){return e===`bug-description`?`errors`:e===`reproduction-code`?`code`:e}var On=`https://static.marimo.app`,kn=e=>{let t=(0,Z.c)(26),{onClose:n}=e,[r,i]=(0,Q.useState)(``),{exportAsHTML:a}=He(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=Math.random().toString(36).slice(2,6),t[0]=o):o=t[0];let s=`${r}-${o}`,c=`${On}/static/${s}`,l;t[1]!==a||t[2]!==n||t[3]!==s?(l=async e=>{e.preventDefault(),n();let{contents:t}=await a({download:!1,includeCode:!0,files:Ke.INSTANCE.filenames()}),r=wt({title:`Uploading static notebook...`,description:`Please wait.`});await fetch(`${On}/api/static`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({html:t,path:s})}).catch(()=>{r.dismiss(),wt({title:`Error uploading static page`,description:(0,X.jsxs)(`div`,{children:[`Please try again later. If the problem persists, please file a bug report on`,` `,(0,X.jsx)(`a`,{href:W.issuesPage,target:`_blank`,className:`underline`,children:`GitHub`}),`.`]})})}),r.dismiss(),wt({title:`Static page uploaded!`,description:(0,X.jsxs)(`div`,{children:[`The URL has been copied to your clipboard.`,(0,X.jsx)(`br`,{}),`You can share it with anyone.`]})})},t[1]=a,t[2]=n,t[3]=s,t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(_t,{children:`Share static notebook`}),t[5]=u):u=t[5];let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsxs)(mt,{children:[u,(0,X.jsxs)(pt,{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,X.jsx)(`a`,{href:On,target:`_blank`,children:On}),`.`]})]}),t[6]=d):d=t[6];let f;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{let t=e.target.value.toLowerCase().replaceAll(/\s/g,`-`).replaceAll(/[^\da-z-]/g,``);i(t)},t[7]=f):f=t[7];let p;t[8]===r?p=t[9]:(p=(0,X.jsx)(bt,{"data-testid":`slug-input`,id:`slug`,autoFocus:!0,value:r,placeholder:`Notebook slug`,onChange:f,required:!0,autoComplete:`off`}),t[8]=r,t[9]=p);let m;t[10]===c?m=t[11]:(m=(0,X.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,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(An,{text:c}),(0,X.jsx)(`span`,{className:`text-primary`,children:c})]})]}),t[10]=c,t[11]=m);let h;t[12]!==p||t[13]!==m?(h=(0,X.jsxs)(`div`,{className:`flex flex-col gap-6 py-4`,children:[p,m]}),t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;t[15]===n?g=t[16]:(g=(0,X.jsx)(Re,{"data-testid":`cancel-share-static-notebook-button`,variant:`secondary`,onClick:n,children:`Cancel`}),t[15]=n,t[16]=g);let _;t[17]===c?_=t[18]:(_=(0,X.jsx)(Re,{"data-testid":`share-static-notebook-button`,"aria-label":`Save`,variant:`default`,type:`submit`,onClick:async()=>{await kt(c)},children:`Create`}),t[17]=c,t[18]=_);let v;t[19]!==_||t[20]!==g?(v=(0,X.jsxs)(ft,{children:[g,_]}),t[19]=_,t[20]=g,t[21]=v):v=t[21];let y;return t[22]!==v||t[23]!==l||t[24]!==h?(y=(0,X.jsx)(ht,{className:`w-fit`,children:(0,X.jsxs)(`form`,{onSubmit:l,children:[d,h,v]})}),t[22]=v,t[23]=l,t[24]=h,t[25]=y):y=t[25],y},An=e=>{let t=(0,Z.c)(8),[n,r]=Q.useState(!1),i;t[0]===e.text?i=t[1]:(i=Le.stopPropagation(async t=>{t.preventDefault(),await kt(e.text),r(!0),setTimeout(()=>r(!1),2e3)}),t[0]=e.text,t[1]=i);let a=i,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)($e,{size:14,strokeWidth:1.5}),t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=(0,X.jsx)(Re,{"data-testid":`copy-static-notebook-url-button`,onClick:a,size:`xs`,variant:`secondary`,children:o}),t[3]=a,t[4]=s);let c;return t[5]!==n||t[6]!==s?(c=(0,X.jsx)(Fe,{content:`Copied!`,open:n,children:s}),t[5]=n,t[6]=s,t[7]=c):c=t[7],c};function jn(){let e=document.getElementsByClassName(G.outputArea);for(let t of e){let e=t.getBoundingClientRect();if(e.bottom>0&&e.top<window.innerHeight){let e=s.findElement(t);if(!e){H.warn(`Could not find HTMLCellId for visible output area`,t);continue}return{cellId:s.parse(e.id)}}}return H.warn(`No visible output area found for scroll anchor`),null}function Mn(e){if(!e){H.warn(`No scroll anchor provided to restore scroll position`);return}let t=document.getElementById(s.create(e.cellId));if(!t){H.warn(`Could not find cell element to restore scroll position`,e.cellId);return}if(!t.querySelector(`.${G.outputArea}`)){H.warn(`Could not find output area to restore scroll position`,e.cellId);return}t.scrollIntoView({block:`start`,behavior:`auto`})}function Nn(){let e=(0,Z.c)(2),t=a(ce),n;return e[0]===t?n=e[1]:(n=()=>{let e=jn();t(t=>({mode:se(t.mode),cellAnchor:e?.cellId??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Mn(e)})})},e[0]=t,e[1]=n),n}var Pn=n(!1),Fn=()=>{let e=(0,Z.c)(7),{selectedLayout:t}=qe(),{setLayoutView:n}=Je();if(K()&&!O(`wasm_layouts`))return null;let r;e[0]===n?r=e[1]:(r=e=>n(e),e[0]=n,e[1]=r);let i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(De,{className:`min-w-[110px] border-border bg-background`,"data-testid":`layout-select`,children:(0,X.jsx)(Ce,{placeholder:`Select a view`})}),e[2]=i):i=e[2];let a;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Te,{children:(0,X.jsxs)(Ee,{children:[(0,X.jsx)(Se,{children:`View as`}),Yt.map(zn)]})}),e[3]=a):a=e[3];let o;return e[4]!==t||e[5]!==r?(o=(0,X.jsxs)(Oe,{"data-testid":`layout-select`,value:t,onValueChange:r,children:[i,a]}),e[4]=t,e[5]=r,e[6]=o):o=e[6],o};function In(e){let t=Ln(e);return(0,X.jsx)(t,{className:`h-4 w-4`})}function Ln(e){switch(e){case`vertical`:return an;case`grid`:return at;case`slides`:return ln;default:return ze(e),St}}function Rn(e){return Ve.startCase(e)}function zn(e){return(0,X.jsx)(we,{value:e,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 leading-5`,children:[In(e),(0,X.jsx)(`span`,{children:Rn(e)})]})},e)}var Bn=[`html`,`markdown`,`ipynb`,`pdf`,`script`,`png`],Vn=[`pymdown`,`qmd`,`mystmd`,`mdx`],Hn=[`topological`,`top-down`],Un=[`document`,`slides`],Wn=[`source`,`flat`];function Gn(e){return typeof e==`string`&&Bn.some(t=>t===e)}var $={html:{includeCode:!0},markdown:{flavor:null},ipynb:{sortMode:`topological`,includeOutputs:!1},pdf:{preset:`document`,includeInputs:!0,includeOutputs:!0,webpdf:!0},script:{type:`source`}};function Kn(e,t){return e.default(t).catch(t)}function qn(e){return I(e).optional().catch(void 0)}var Jn=I({html:qn({includeCode:Kn(L(),$.html.includeCode)}),markdown:qn({flavor:Kn(R(Vn).nullable(),$.markdown.flavor)}),ipynb:qn({sortMode:Kn(R(Hn),$.ipynb.sortMode),includeOutputs:Kn(L(),$.ipynb.includeOutputs)}),pdf:qn({preset:Kn(R(Un),$.pdf.preset),includeInputs:Kn(L(),$.pdf.includeInputs),includeOutputs:Kn(L(),$.pdf.includeOutputs),webpdf:Kn(L(),$.pdf.webpdf)}),script:qn({type:Kn(R(Wn),$.script.type)})}).catch({});function Yn(e,t){let n={...e},r=r=>{n[r]={...e[r],...t[r]}};for(let e of Object.keys(t))r(e);return n}function Xn(e){return Yn($,Jn.parse(e))}var Zn=P({toSerializable:e=>e,fromSerializable:Xn}),Qn=S(`marimo:export:options:v1`,$,Zn,{getOnInit:!0}),$n=S(`marimo:export:last-format:v1`,`html`,P({toSerializable:e=>e,fromSerializable:e=>Gn(e)?e:`html`}),{getOnInit:!0}),er={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 tr(e,t){return e===`wasm`&&t===`pdf`}function nr({format:e,options:t,runtime:n,filename:r,availability:i}){let a=e===`script`&&t.script.type===`source`?{...er.script,requiresNamedNotebookOnServer:!0}:er[e],o=tr(n,e);if(n===`wasm`&&a.requiresServerRuntime)return{available:o,reason:{type:`wasm-runtime`}};if(n===`server`&&a.requiresNamedNotebookOnServer&&!r)return{available:!1,reason:{type:`notebook-must-be-named`}};if(n===`wasm`||!a.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 s=i.data.formats.find(t=>t.format===e);return s?s.dependenciesAvailable?{available:!0}:s.missingPackages.length>0?{available:!1,reason:{type:`missing-packages`,packages:s.missingPackages}}:s.missingSetup.length>0?{available:!1,reason:{type:`missing-setup`,requirements:s.missingSetup}}:{available:!0,availabilityCheckFailed:!0}:{available:!0,availabilityCheckFailed:!0}}function rr(e,t){return e.map(e=>({value:e,...t[e]}))}var ir=rr([`automatic`,...Vn],{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.`}}),ar=rr(Hn,{"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.`}}),or=rr(Un,{document:{label:`Document`,description:`Creates pages for reading or printing.`},slides:{label:`Slides`,description:`Creates presentation slides from the notebook.`}}),sr=rr([`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.`}}),cr=rr(Wn,{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.`}}),lr={html:{label:`HTML`,actionLabel:`Export HTML`,description:`Save the current notebook as an HTML page.`,Icon:rt,Options:ur},markdown:{label:`Markdown`,actionLabel:`Export Markdown`,description:`Save code and text in a Markdown-based file. Cell outputs are not included.`,Icon:v,Options:dr},ipynb:{label:`Jupyter`,actionLabel:`Export Jupyter notebook`,description:`Open the notebook in Jupyter and other compatible tools.`,Icon:sn,Options:fr},pdf:{label:`PDF`,actionLabel:`Export PDF`,description:`Save the notebook as a PDF for printing or sharing.`,Icon:nt,Options:pr},script:{label:`Python`,actionLabel:`Export flat script`,description:`Save the notebook as a Python file.`,Icon:Qe,Options:mr},png:{label:`PNG`,actionLabel:`Export PNG`,description:`Capture the current app view as an image.`,Icon:dt,Options:hr}};function ur(e){let t=(0,Z.c)(7),{options:n,updateOptions:r,disabled:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={checked:`Includes code cells in the webpage.`,unchecked:`Leaves code cells out of the webpage.`},t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=e=>r(`html`,{includeCode:e}),t[1]=r,t[2]=o);let s;return t[3]!==i||t[4]!==n.html.includeCode||t[5]!==o?(s=(0,X.jsx)(gr,{children:(0,X.jsx)(_r,{label:`Include code`,descriptions:a,checked:n.html.includeCode,disabled:i,onCheckedChange:o})}),t[3]=i,t[4]=n.html.includeCode,t[5]=o,t[6]=s):s=t[6],s}function dr(e){let t=(0,Z.c)(6),{options:n,updateOptions:r,disabled:i}=e,a=n.markdown.flavor??`automatic`,o;t[0]===r?o=t[1]:(o=e=>r(`markdown`,{flavor:e===`automatic`?null:e}),t[0]=r,t[1]=o);let s;return t[2]!==i||t[3]!==a||t[4]!==o?(s=(0,X.jsx)(gr,{children:(0,X.jsx)(br,{label:`Format`,value:a,disabled:i,onValueChange:o,options:ir})}),t[2]=i,t[3]=a,t[4]=o,t[5]=s):s=t[5],s}function fr(e){let t=(0,Z.c)(16),{options:n,updateOptions:r,disabled:i}=e,a;t[0]===r?a=t[1]:(a=e=>r(`ipynb`,{sortMode:e}),t[0]=r,t[1]=a);let o;t[2]!==i||t[3]!==n.ipynb.sortMode||t[4]!==a?(o=(0,X.jsx)(vr,{label:`Cell order`,value:n.ipynb.sortMode,disabled:i,onValueChange:a,options:ar}),t[2]=i,t[3]=n.ipynb.sortMode,t[4]=a,t[5]=o):o=t[5];let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s={checked:`Keeps the outputs currently shown in the notebook.`,unchecked:`Leaves cell outputs out of the Jupyter notebook.`},t[6]=s):s=t[6];let c;t[7]===r?c=t[8]:(c=e=>r(`ipynb`,{includeOutputs:e}),t[7]=r,t[8]=c);let l;t[9]!==i||t[10]!==n.ipynb.includeOutputs||t[11]!==c?(l=(0,X.jsx)(_r,{label:`Include outputs`,descriptions:s,checked:n.ipynb.includeOutputs,disabled:i,onCheckedChange:c}),t[9]=i,t[10]=n.ipynb.includeOutputs,t[11]=c,t[12]=l):l=t[12];let u;return t[13]!==o||t[14]!==l?(u=(0,X.jsxs)(gr,{children:[o,l]}),t[13]=o,t[14]=l,t[15]=u):u=t[15],u}function pr(e){let t=(0,Z.c)(30),{options:n,updateOptions:r,disabled:i}=e,a;t[0]===r?a=t[1]:(a=e=>r(`pdf`,{preset:e}),t[0]=r,t[1]=a);let o;t[2]!==i||t[3]!==n.pdf.preset||t[4]!==a?(o=(0,X.jsx)(vr,{label:`Layout`,value:n.pdf.preset,disabled:i,onValueChange:a,options:or}),t[2]=i,t[3]=n.pdf.preset,t[4]=a,t[5]=o):o=t[5];let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s={checked:`Includes code cells in the PDF.`,unchecked:`Leaves code cells out of the PDF.`},t[6]=s):s=t[6];let c;t[7]===r?c=t[8]:(c=e=>r(`pdf`,{includeInputs:e}),t[7]=r,t[8]=c);let l;t[9]!==i||t[10]!==n.pdf.includeInputs||t[11]!==c?(l=(0,X.jsx)(_r,{label:`Include code`,descriptions:s,checked:n.pdf.includeInputs,disabled:i,onCheckedChange:c}),t[9]=i,t[10]=n.pdf.includeInputs,t[11]=c,t[12]=l):l=t[12];let u;t[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.`},t[13]=u):u=t[13];let d;t[14]===r?d=t[15]:(d=e=>r(`pdf`,{includeOutputs:e}),t[14]=r,t[15]=d);let f;t[16]!==i||t[17]!==n.pdf.includeOutputs||t[18]!==d?(f=(0,X.jsx)(_r,{label:`Include outputs`,descriptions:u,checked:n.pdf.includeOutputs,disabled:i,onCheckedChange:d}),t[16]=i,t[17]=n.pdf.includeOutputs,t[18]=d,t[19]=f):f=t[19];let p;t[20]!==i||t[21]!==n.pdf.preset||t[22]!==n.pdf.webpdf||t[23]!==r?(p=n.pdf.preset===`document`?(0,X.jsx)(vr,{label:`Method`,value:n.pdf.webpdf?`browser`:`latex`,disabled:i,onValueChange:e=>r(`pdf`,{webpdf:e===`browser`}),options:sr}):null,t[20]=i,t[21]=n.pdf.preset,t[22]=n.pdf.webpdf,t[23]=r,t[24]=p):p=t[24];let m;return t[25]!==o||t[26]!==l||t[27]!==f||t[28]!==p?(m=(0,X.jsxs)(gr,{children:[o,l,f,p]}),t[25]=o,t[26]=l,t[27]=f,t[28]=p,t[29]=m):m=t[29],m}function mr(e){let t=(0,Z.c)(6),{options:n,updateOptions:r,disabled:i}=e,a;t[0]===r?a=t[1]:(a=e=>r(`script`,{type:e}),t[0]=r,t[1]=a);let o;return t[2]!==i||t[3]!==n.script.type||t[4]!==a?(o=(0,X.jsx)(gr,{children:(0,X.jsx)(vr,{label:`Format`,value:n.script.type,disabled:i,onValueChange:a,options:cr})}),t[2]=i,t[3]=n.script.type,t[4]=a,t[5]=o):o=t[5],o}function hr(){return null}function gr(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(`div`,{className:`divide-y rounded-md border`,children:n}),t[0]=n,t[1]=r),r}function _r(e){let t=(0,Z.c)(26),{label:n,descriptions:r,descriptionOverride:i,checked:a,disabled:o,onCheckedChange:s}=e,c=(0,Q.useId)(),l=`${c}-description`,u=i??(a?r.checked:r.unchecked),d;t[0]===i?d=t[1]:(d=i?[i]:[],t[0]=i,t[1]=d);let f;t[2]!==r.checked||t[3]!==r.unchecked||t[4]!==d?(f=[r.checked,r.unchecked,...d],t[2]=r.checked,t[3]=r.unchecked,t[4]=d,t[5]=f):f=t[5];let p=f,m;t[6]!==c||t[7]!==n?(m=(0,X.jsx)(`label`,{htmlFor:c,className:`text-sm font-medium leading-5`,children:n}),t[6]=c,t[7]=n,t[8]=m):m=t[8];let h;t[9]!==u||t[10]!==l||t[11]!==p?(h=(0,X.jsx)(Cr,{id:l,description:u,possibleDescriptions:p}),t[9]=u,t[10]=l,t[11]=p,t[12]=h):h=t[12];let g;t[13]!==m||t[14]!==h?(g=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;t[16]!==a||t[17]!==l||t[18]!==o||t[19]!==c||t[20]!==n||t[21]!==s?(_=(0,X.jsx)(me,{id:c,size:`sm`,checked:a,disabled:o,onCheckedChange:s,"aria-label":n,"aria-describedby":l}),t[16]=a,t[17]=l,t[18]=o,t[19]=c,t[20]=n,t[21]=s,t[22]=_):_=t[22];let v;return t[23]!==g||t[24]!==_?(v=(0,X.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between gap-4 px-3 py-2`,children:[g,_]}),t[23]=g,t[24]=_,t[25]=v):v=t[25],v}function vr(e){let t=(0,Z.c)(31),{label:n,value:r,disabled:i,onValueChange:a,options:o}=e,s=(0,Q.useId)(),c=`${s}-description`,l;t[0]!==o||t[1]!==r?(l=o.find(e=>e.value===r)?.description,t[0]=o,t[1]=r,t[2]=l):l=t[2];let u=l,d;t[3]===n?d=t[4]:(d=(0,X.jsx)(`div`,{className:`text-sm font-medium leading-5`,children:n}),t[3]=n,t[4]=d);let f=u??``,p;t[5]===o?p=t[6]:(p=o.map(yr),t[5]=o,t[6]=p);let m;t[7]!==c||t[8]!==f||t[9]!==p?(m=(0,X.jsx)(Cr,{id:c,description:f,possibleDescriptions:p}),t[7]=c,t[8]=f,t[9]=p,t[10]=m):m=t[10];let h;t[11]!==d||t[12]!==m?(h=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[d,m]}),t[11]=d,t[12]=m,t[13]=h):h=t[13];let g;t[14]===a?g=t[15]:(g=e=>a(e),t[14]=a,t[15]=g);let _;if(t[16]!==s||t[17]!==o){let e;t[19]===s?e=t[20]:(e=(e,t)=>{let n=`${s}-${t}`;return(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(te,{id:n,value:e.value}),(0,X.jsx)(`label`,{htmlFor:n,className:`text-sm`,children:e.label})]},e.value)},t[19]=s,t[20]=e),_=o.map(e),t[16]=s,t[17]=o,t[18]=_}else _=t[18];let v;t[21]!==c||t[22]!==i||t[23]!==n||t[24]!==g||t[25]!==_||t[26]!==r?(v=(0,X.jsx)(C,{value:r,onValueChange:g,className:`flex shrink-0 flex-wrap gap-x-5 gap-y-2 sm:justify-end`,"aria-label":n,"aria-describedby":c,disabled:i,children:_}),t[21]=c,t[22]=i,t[23]=n,t[24]=g,t[25]=_,t[26]=r,t[27]=v):v=t[27];let y;return t[28]!==h||t[29]!==v?(y=(0,X.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:[h,v]}),t[28]=h,t[29]=v,t[30]=y):y=t[30],y}function yr(e){return e.description}function br(e){let t=(0,Z.c)(34),{label:n,value:r,disabled:i,onValueChange:a,options:o}=e,s=(0,Q.useId)(),c=`${s}-description`,l;t[0]!==o||t[1]!==r?(l=o.find(e=>e.value===r)?.description,t[0]=o,t[1]=r,t[2]=l):l=t[2];let u=l,d;t[3]!==s||t[4]!==n?(d=(0,X.jsx)(`label`,{htmlFor:s,className:`text-sm font-medium leading-5`,children:n}),t[3]=s,t[4]=n,t[5]=d):d=t[5];let f=u??``,p;t[6]===o?p=t[7]:(p=o.map(Sr),t[6]=o,t[7]=p);let m;t[8]!==c||t[9]!==f||t[10]!==p?(m=(0,X.jsx)(Cr,{id:c,description:f,possibleDescriptions:p}),t[8]=c,t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]!==d||t[13]!==m?(h=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[d,m]}),t[12]=d,t[13]=m,t[14]=h):h=t[14];let g;t[15]===a?g=t[16]:(g=e=>a(e),t[15]=a,t[16]=g);let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(Ce,{}),t[17]=_):_=t[17];let v;t[18]!==c||t[19]!==s?(v=(0,X.jsx)(De,{id:s,"aria-describedby":c,className:`h-8 w-full shrink-0 sm:w-44`,children:_}),t[18]=c,t[19]=s,t[20]=v):v=t[20];let y;t[21]===o?y=t[22]:(y=o.map(xr),t[21]=o,t[22]=y);let b;t[23]===y?b=t[24]:(b=(0,X.jsx)(Te,{children:y}),t[23]=y,t[24]=b);let x;t[25]!==i||t[26]!==b||t[27]!==g||t[28]!==v||t[29]!==r?(x=(0,X.jsxs)(Oe,{value:r,disabled:i,onValueChange:g,children:[v,b]}),t[25]=i,t[26]=b,t[27]=g,t[28]=v,t[29]=r,t[30]=x):x=t[30];let S;return t[31]!==x||t[32]!==h?(S=(0,X.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:[h,x]}),t[31]=x,t[32]=h,t[33]=S):S=t[33],S}function xr(e){return(0,X.jsx)(we,{value:e.value,children:e.label},e.value)}function Sr(e){return e.description}function Cr(e){let t=(0,Z.c)(15),{id:n,description:r,possibleDescriptions:i}=e,a;t[0]===i?a=t[1]:(a=new Set(i),t[0]=i,t[1]=a);let o;t[2]===a?o=t[3]:(o=[...a],t[2]=a,t[3]=o);let s;t[4]!==r||t[5]!==o?(s=o.filter(e=>e!==r),t[4]=r,t[5]=o,t[6]=s):s=t[6];let c=s,l;t[7]!==r||t[8]!==n?(l=(0,X.jsx)(`p`,{id:n,"aria-live":`polite`,className:`col-start-1 row-start-1`,children:r}),t[7]=r,t[8]=n,t[9]=l):l=t[9];let u;t[10]===c?u=t[11]:(u=c.map(wr),t[10]=c,t[11]=u);let d;return t[12]!==l||t[13]!==u?(d=(0,X.jsxs)(`div`,{className:`mt-0.5 grid text-xs leading-4 text-muted-foreground`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function wr(e){return(0,X.jsx)(`p`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:e},e)}var Tr={"playwright-chromium":{description:`PDF export requires Playwright Chromium.`}};function Er(e){let t=(0,Z.c)(10),{status:n}=e;if(n.available&&!n.availabilityCheckFailed)return null;if(n.reason?.type===`checking-requirements`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0`,children:[(0,X.jsx)(yt,{size:`small`,className:`size-3`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Checking requirements`})]}),t[0]=e):e=t[0],e}let r=n.availabilityCheckFailed?`Requirements unknown`:`Unavailable`,i=n.availabilityCheckFailed?`text-muted-foreground`:`text-(--yellow-11)`,a;t[1]===i?a=t[2]:(a=q(`size-3`,i),t[1]=i,t[2]=a);let o;t[3]===a?o=t[4]:(o=(0,X.jsx)(A,{className:a}),t[3]=a,t[4]=o);let s;t[5]===r?s=t[6]:(s=(0,X.jsx)(`span`,{className:`sr-only`,children:r}),t[5]=r,t[6]=s);let c;return t[7]!==o||t[8]!==s?(c=(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function Dr(e){let t=(0,Z.c)(7),{format:n,formatLabel:r,status:i,onInstall:a,isInstalling:o}=e,s=o!==void 0&&o;if(i.availabilityCheckFailed){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`div`,{className:`mb-2.5`,children:(0,X.jsx)(Or,{children:`Couldn't check whether this export is available. You can still try it.`})}),t[0]=e):e=t[0],e}if(!i.reason)return null;let c;return t[1]!==n||t[2]!==r||t[3]!==s||t[4]!==a||t[5]!==i.reason?(c=(0,X.jsx)(`div`,{className:`mb-2.5`,children:(0,X.jsx)(kr,{format:n,formatLabel:r,reason:i.reason,onInstall:a,isInstalling:s})}),t[1]=n,t[2]=r,t[3]=s,t[4]=a,t[5]=i.reason,t[6]=c):c=t[6],c}function Or(e){let t=(0,Z.c)(9),{children:n,onInstall:r,isInstalling:i}=e,a=i!==void 0&&i,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(A,{className:`size-4 shrink-0`}),t[0]=o):o=t[0];let s;t[1]===n?s=t[2]:(s=(0,X.jsx)(`span`,{className:`min-w-0 flex-1`,children:n}),t[1]=n,t[2]=s);let c;t[3]!==a||t[4]!==r?(c=r?(0,X.jsxs)(Re,{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:a,"aria-busy":a,onClick:r,children:[a?(0,X.jsx)(yt,{size:`small`,className:`mr-1.5 size-3.5`}):(0,X.jsx)($t,{className:`mr-1.5 size-3.5`}),`Install`]}):null,t[3]=a,t[4]=r,t[5]=c):c=t[5];let l;return t[6]!==s||t[7]!==c?(l=(0,X.jsxs)(Ft,{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,X.jsxs)(Pt,{className:`flex min-w-0 flex-1 items-center gap-3 text-sm leading-5`,children:[s,c]})]}),t[6]=s,t[7]=c,t[8]=l):l=t[8],l}function kr(e){let t=(0,Z.c)(22),{format:n,formatLabel:r,reason:i,onInstall:a,isInstalling:o}=e;switch(i.type){case`checking-requirements`:{let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(yt,{className:`size-4 shrink-0`,size:`small`}),t[0]=e):e=t[0];let n;return t[1]===r?n=t[2]:(n=(0,X.jsxs)(Ft,{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:[e,(0,X.jsxs)(Pt,{className:`min-w-0 flex-1 text-sm leading-5`,children:[`Checking `,r,` requirements…`]})]}),t[1]=r,t[2]=n),n}case`notebook-must-be-named`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(Or,{children:`Name and save this notebook before exporting.`}),t[3]=e):e=t[3],e}case`missing-packages`:{let e;t[4]===i.packages?e=t[5]:(e=i.packages.join(`, `),t[4]=i.packages,t[5]=e);let n;t[6]===e?n=t[7]:(n=(0,X.jsx)(`code`,{className:`break-words font-mono`,children:e}),t[6]=e,t[7]=n);let s;return t[8]!==r||t[9]!==o||t[10]!==a||t[11]!==n?(s=(0,X.jsxs)(Or,{onInstall:a,isInstalling:o,children:[r,` export requires`,` `,n,`.`]}),t[8]=r,t[9]=o,t[10]=a,t[11]=n,t[12]=s):s=t[12],s}case`missing-setup`:{let e;t[13]!==a||t[14]!==i.requirements?(e=a?i.requirements.map(jr).join(` `):(0,X.jsx)(`span`,{className:`block min-w-0`,children:i.requirements.map(Ar)}),t[13]=a,t[14]=i.requirements,t[15]=e):e=t[15];let n;return t[16]!==o||t[17]!==a||t[18]!==e?(n=(0,X.jsx)(Or,{onInstall:a,isInstalling:o,children:e}),t[16]=o,t[17]=a,t[18]=e,t[19]=n):n=t[19],n}case`wasm-runtime`:{let e=n===`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.`,r;return t[20]===e?r=t[21]:(r=(0,X.jsx)(Or,{children:e}),t[20]=e,t[21]=r),r}default:Be(i)}}function Ar(e){let t=Tr[e.name];return(0,X.jsxs)(`span`,{className:`block`,children:[t.description,(0,X.jsx)(`code`,{className:`mt-1 block break-all font-mono`,children:e.command})]},e.name)}function jr(e){return Tr[e.name].description}function Mr(e){return e.endsWith(`.myst.md`)?`mystmd`:e.endsWith(`.qmd`)?`qmd`:e.endsWith(`.mdx`)?`mdx`:`pymdown`}function Nr(e,t){let n=t??Mr(e),r=lt[n],i=ut.find(t=>e.endsWith(t)),a=Ne.withoutExtension(e);i&&(a=e.slice(0,-i.length));let o=`${a}.${r}`;return o===e?`${e.slice(0,-(r.length+1))}.export.${r}`:o}function Pr(e){return Object.entries(e).flatMap(([e,t])=>t===null?[]:t===!0?[`--${e}`]:t===!1?[`--no-${e}`]:[`--${e}=${t}`])}function Fr(e){return e.preset===`document`?e.webpdf:null}var Ir={html:{subcommand:`html`,flags:({html:e})=>({"include-code":e.includeCode}),outputFilename:e=>Ne.toHTML(e)},markdown:{subcommand:`md`,flags:({markdown:e})=>({flavor:e.flavor}),outputFilename:(e,{markdown:t})=>Nr(e,t.flavor)},ipynb:{subcommand:`ipynb`,flags:({ipynb:e})=>({sort:e.sortMode,"include-outputs":e.includeOutputs}),outputFilename:e=>Ne.toIPYNB(e)},pdf:{subcommand:`pdf`,flags:({pdf:e})=>({as:e.preset,"include-inputs":e.includeInputs,"include-outputs":e.includeOutputs,webpdf:Fr(e)}),outputFilename:e=>Ne.toPDF(e)},script:{subcommand:`script`,flags:()=>({}),outputFilename:e=>`${Ne.withoutExtension(e)}.script.py`}};function Lr({format:e,filename:t,options:n}){if(e===`png`||e===`script`&&n.script.type===`source`||!t)return null;let r=Ir[e];return[`marimo`,`export`,r.subcommand,Bt(t),...Pr(r.flags(n)),`-o`,Bt(r.outputFilename(t,n))].join(` `)}async function Rr(e){let{exportOptions:t,captureOutputs:n,downloadPDF:r}=e;t.includeOutputs&&await n(),await r(t)}async function zr({format:e,options:t,requests:n,sourceFilename:r,htmlFiles:i,captureOutputs:a,capturePNG:o,downloadFile:s}){switch(e){case`html`:s(await n.exportAsHTML({download:!1,files:i,includeCode:t.html.includeCode}));return;case`markdown`:s(await n.exportAsMarkdown({download:!1,flavor:t.markdown.flavor}));return;case`ipynb`:t.ipynb.includeOutputs&&await a(),s(await n.exportAsIPYNB({download:!1,sortMode:t.ipynb.sortMode,includeOutputs:t.ipynb.includeOutputs}));return;case`pdf`:await Rr({exportOptions:t.pdf,captureOutputs:a,downloadPDF:async e=>{s(await n.exportAsPDF(e))}});return;case`script`:if(t.script.type===`source`){s({contents:(await n.readCode()).contents,filename:r,mediaType:`text/plain`});return}s(await n.exportAsScript({download:!1}));return;case`png`:await o();return;default:Be(e)}}var Br={source:{actionLabel:`Export notebook source`,progressLabel:`notebook source`},flat:{actionLabel:`Export flat script`,progressLabel:`flat script`}};function Vr(e,t){if(e===`wasm`)return{status:`success`,data:null};switch(t.status){case`pending`:case`loading`:return{status:`pending`};case`error`:return{status:`error`};case`success`:return{status:`success`,data:t.data}}}function Hr(e,t){return e===`server`&&t?Tt.basename(t):Ne.toPY(document.title)}function Ur({usesBrowserPrint:e,hasCommand:t,format:n,isNotebookSource:r}){return e?`Uses the browser's print settings for page size and filename.`:t?`Uses the current session state. The copied command exports the saved notebook.`:n!==`png`&&!r?`Save the notebook to copy an equivalent shell command.`:null}function Wr(e){let n=It(),[r,i]=t(Qn),[a,o]=t($n),[s,c]=(0,Q.useState)(e??a),l=K()?`wasm`:`server`,u=He(),d=de(),[f,p]=(0,Q.useState)(!1),m=Ot(async()=>l===`wasm`?null:u.getExportAvailability(),[l,u]),h=Vr(l,m),g=e=>nr({format:e,options:r,runtime:l,filename:n,availability:h}),_=g(s),v=d&&(_.reason?.type===`missing-packages`||_.reason?.type===`missing-setup`),y=Bn.map(e=>({format:e,status:g(e)})),b=tr(l,s),x=lr[s],S=s===`script`&&r.script.type===`source`,{actionLabel:C,progressLabel:w}=s===`script`?Br[r.script.type]:{actionLabel:x.actionLabel,progressLabel:x.label},T=b?null:Lr({format:s,filename:n,options:r}),E=Ur({usesBrowserPrint:b,hasCommand:!!T,format:s,isNotebookSource:S});return(0,Q.useEffect)(()=>{e&&o(e)},[e,o]),{formats:y,options:r,selected:{format:s,status:_,usesBrowserPrint:b,actionLabel:C,command:T,footerDescription:E},exportRequest:{format:s,options:r,sourceFilename:Hr(l,n),available:_.available,usesBrowserPrint:b,progressLabel:w},selectFormat:e=>{Gn(e)&&(c(e),o(e))},updateOptions:(e,t)=>{i(n=>{let r={...n};return r[e]={...n[e],...t},r})},canInstall:v,isInstalling:f,installRequirements:async()=>{if(!(!v||f||s===`png`)){p(!0);try{let e=await u.installExportRequirements({format:s});m.setData(e)}catch{}finally{p(!1)}}}}}async function Gr(e){let t=document.getElementById(`App`);if(!t){let e=`The current app view could not be captured.`;throw wt({title:`Failed to download as PNG`,description:e,variant:`danger`}),Error(e)}let n=e?.style.visibility,r=e?.classList.contains(`print:hidden`);if(!await Me({element:t,filename:document.title,prepare:()=>{let t=Pe();return e&&(e.classList.add(`print:hidden`),e.style.visibility=`hidden`),()=>{t(),e&&(r||e.classList.remove(`print:hidden`),e.style.visibility=n??``)}}}))throw Error(`Failed to capture the current app view.`)}function Kr(e){e(),requestAnimationFrame(()=>{setTimeout(()=>{window.print()},0)})}function qr({format:e,options:t,sourceFilename:n,available:r,usesBrowserPrint:i,progressLabel:a,onClose:o}){let s=He(),c=Kt(),[l,u]=(0,Q.useState)(!1),d=(0,Q.useRef)(null),f=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(f.current=!0,()=>{f.current=!1}),[]);let p=async e=>{await qt({takeScreenshots:()=>c({progress:e}),updateCellOutputs:s.updateCellOutputs})},m=async()=>{await fe(()=>Gr(d.current?.parentElement??null))};return{dialogRef:d,isExporting:l,submit:async()=>{if(!(!r||l)){if(i){Kr(o);return}u(!0);try{await J(`Exporting ${a}…`,async r=>{await zr({format:e,options:t,requests:s,sourceFilename:n,htmlFiles:Ke.INSTANCE.filenames(),captureOutputs:()=>p(r),capturePNG:m,downloadFile:je})}),f.current&&o()}catch(e){H.error(`Export failed`,e)}finally{f.current&&u(!1)}}}}}function Jr(e){let t=(0,Z.c)(15),{initialFormat:n,onClose:r}=e,i=Wr(n),a,o,s;t[0]===i?(a=t[1],o=t[2],s=t[3]):({exportRequest:a,selectFormat:o,...s}=i,t[0]=i,t[1]=a,t[2]=o,t[3]=s);let c;t[4]!==a||t[5]!==r?(c={...a,onClose:r},t[4]=a,t[5]=r,t[6]=c):c=t[6];let l=qr(c),u;t[7]!==l||t[8]!==o||t[9]!==s?(u=e=>{!l.isExporting&&!s.isInstalling&&o(e)},t[7]=l,t[8]=o,t[9]=s,t[10]=u):u=t[10];let d;return t[11]!==l||t[12]!==s||t[13]!==u?(d={...s,...l,selectFormat:u},t[11]=l,t[12]=s,t[13]=u,t[14]=d):d=t[14],d}var Yr=`(min-width: 640px)`,Xr=e=>{let t=(0,Z.c)(75),{initialFormat:n,onClose:r,returnFocusRef:i}=e,a;t[0]!==n||t[1]!==r?(a={initialFormat:n,onClose:r},t[0]=n,t[1]=r,t[2]=a):a=t[2];let{dialogRef:o,isExporting:s,isInstalling:c,canInstall:l,formats:u,options:d,selected:f,selectFormat:p,updateOptions:m,installRequirements:h,submit:g}=Jr(a),_=s||c,v=Ae(Yr),{format:y,status:b,usesBrowserPrint:x,actionLabel:S,command:C,footerDescription:w}=f,T=lr[y],E=T.Options,ee;t[3]===i?ee=t[4]:(ee=i?{onCloseAutoFocus:e=>{e.preventDefault(),i.current?.focus()}}:{},t[3]=i,t[4]=ee);let D=ee,O;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,X.jsxs)(mt,{className:`border-b px-5 py-4 pr-12`,children:[(0,X.jsx)(_t,{children:`Export notebook`}),(0,X.jsx)(pt,{children:`Choose a format and adjust its options.`})]}),t[5]=O):O=t[5];let te=v?`vertical`:`horizontal`,k;if(t[6]!==u||t[7]!==_){let e;t[9]===_?e=t[10]:(e=e=>{let{format:t,status:n}=e,r=lr[t];return(0,X.jsxs)(ve,{value:t,disabled:_,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-${t}`,children:[(0,X.jsx)(r.Icon,{className:`size-3.5 shrink-0`,strokeWidth:1.5}),(0,X.jsx)(`span`,{className:`truncate`,children:r.label}),(0,X.jsx)(Er,{status:n})]},t)},t[9]=_,t[10]=e),k=u.map(e),t[6]=u,t[7]=_,t[8]=k}else k=t[8];let A;t[11]===k?A=t[12]:(A=(0,X.jsx)(be,{"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:k}),t[11]=k,t[12]=A);let j;if(t[13]!==E||t[14]!==l||t[15]!==T.description||t[16]!==T.label||t[17]!==y||t[18]!==u||t[19]!==h||t[20]!==_||t[21]!==c||t[22]!==d||t[23]!==b||t[24]!==m||t[25]!==x){let e;t[27]!==E||t[28]!==l||t[29]!==T.description||t[30]!==T.label||t[31]!==y||t[32]!==h||t[33]!==_||t[34]!==c||t[35]!==d||t[36]!==b||t[37]!==m||t[38]!==x?(e=e=>{let{format:t}=e;return(0,X.jsxs)(ye,{value:t,className:`mt-0 min-h-0 min-w-0 overflow-y-auto px-4 py-3`,children:[(0,X.jsxs)(`div`,{className:`mb-3`,children:[(0,X.jsx)(`h3`,{className:`text-base font-semibold`,children:T.label}),(0,X.jsx)(`p`,{className:`mt-0.5 text-sm text-muted-foreground`,children:T.description})]}),(0,X.jsx)(Dr,{format:y,formatLabel:T.label,status:b,onInstall:l?h:void 0,isInstalling:c}),x?null:(0,X.jsx)(E,{options:d,updateOptions:m,disabled:_})]},t)},t[27]=E,t[28]=l,t[29]=T.description,t[30]=T.label,t[31]=y,t[32]=h,t[33]=_,t[34]=c,t[35]=d,t[36]=b,t[37]=m,t[38]=x,t[39]=e):e=t[39],j=u.map(e),t[13]=E,t[14]=l,t[15]=T.description,t[16]=T.label,t[17]=y,t[18]=u,t[19]=h,t[20]=_,t[21]=c,t[22]=d,t[23]=b,t[24]=m,t[25]=x,t[26]=j}else j=t[26];let M;t[40]!==y||t[41]!==p||t[42]!==te||t[43]!==A||t[44]!==j?(M=(0,X.jsxs)(xe,{value:y,onValueChange:p,orientation:te,className:`flex min-h-0 min-w-0 flex-col overflow-hidden sm:grid sm:grid-cols-[168px_minmax(0,1fr)]`,children:[A,j]}),t[40]=y,t[41]=p,t[42]=te,t[43]=A,t[44]=j,t[45]=M):M=t[45];let N;t[46]===C?N=t[47]:(N=C?(0,X.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,X.jsx)(`span`,{className:`select-none text-muted-foreground`,"aria-hidden":!0,children:`$`}),(0,X.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:C}),(0,X.jsx)(At,{value:C,className:`size-3.5`,buttonClassName:q(Ie({variant:`ghost`,size:`icon`}),`shrink-0`),tooltip:`Copy POSIX shell command`,ariaLabel:`Copy POSIX shell command`,toastTitle:`Command copied`})]}):null,t[46]=C,t[47]=N);let P=C&&`mt-3`,ne;t[48]===P?ne=t[49]:(ne=q(`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,P),t[48]=P,t[49]=ne);let F;t[50]===w?F=t[51]:(F=w?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:w}):null,t[50]=w,t[51]=F);let I=!b.available||_,L=!w&&`sm:ml-auto`,R;t[52]===L?R=t[53]:(R=q(`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)`,L),t[52]=L,t[53]=R);let z;t[54]===s?z=t[55]:(z=s&&(0,X.jsx)(yt,{size:`small`,className:`mr-2`,"aria-hidden":!0}),t[54]=s,t[55]=z);let re=x?`Print to PDF`:S,B;t[56]!==s||t[57]!==g||t[58]!==I||t[59]!==R||t[60]!==z||t[61]!==re?(B=(0,X.jsxs)(Re,{type:`button`,disabled:I,"aria-busy":s,onClick:g,className:R,"data-testid":`export-submit`,children:[z,re]}),t[56]=s,t[57]=g,t[58]=I,t[59]=R,t[60]=z,t[61]=re,t[62]=B):B=t[62];let V;t[63]!==ne||t[64]!==F||t[65]!==B?(V=(0,X.jsxs)(`div`,{className:ne,children:[F,B]}),t[63]=ne,t[64]=F,t[65]=B,t[66]=V):V=t[66];let H;t[67]!==V||t[68]!==N?(H=(0,X.jsxs)(`footer`,{className:`min-w-0 border-t bg-muted/20 px-4 py-3`,children:[N,V]}),t[67]=V,t[68]=N,t[69]=H):H=t[69];let U;return t[70]!==o||t[71]!==D||t[72]!==H||t[73]!==M?(U=(0,X.jsxs)(ht,{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`,...D,children:[O,M,H]}),t[70]=o,t[71]=D,t[72]=H,t[73]=M,t[74]=U):U=t[74],U};function Zr(e){let t=(0,Z.c)(5),{openPrompt:n,closeModal:r}=gt(),{sendCopy:i}=He(),a;return t[0]!==r||t[1]!==n||t[2]!==i||t[3]!==e?(a=()=>{if(!e)return null;let t=Et.guessDeliminator(e),a=Tt.basename(e);n({title:`Copy notebook`,description:`Enter a new filename for the notebook copy.`,defaultValue:`_${a}`,confirmText:`Copy notebook`,spellCheck:!1,onConfirm:n=>{let a=t.join(Tt.dirname(e),n);i({source:e,destination:a}).then(()=>{r(),wt({title:`Notebook copied`,description:`A copy of the notebook has been created.`}),Gt(a)})}})},t[0]=r,t[1]=n,t[2]=i,t[3]=e,t[4]=a):a=t[4],a}function Qr(){let e=(0,Z.c)(4),{openConfirm:t}=gt(),n=a(pe),{sendRestart:r}=He(),i;return e[0]!==t||e[1]!==r||e[2]!==n?(i=()=>{t({title:`Restart Kernel`,description:`This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.`,variant:`destructive`,confirmAction:(0,X.jsx)(_e,{onClick:async()=>{n({state:ue.CLOSING}),await r(),Mt()},"aria-label":`Confirm Restart`,children:`Restart`})})},e[0]=t,e[1]=r,e[2]=n,e[3]=i):i=e[3],i}var $r=new D,ei=e=>$r.isSupported(e)?`markdown`:`code`,ti=()=>{let e=(0,Z.c)(3),{updateCellConfig:t}=u(),{saveCellConfig:n}=He(),r;return e[0]!==n||e[1]!==t?(r=async(e,r)=>{let i=k(),a={};for(let t of i.cellIds.inOrderIds){let n=i.cellData[t];n!==void 0&&n.config.hide_code!==e&&ei(n.code)===r&&(a[t]={hide_code:e})}let o=ie.entries(a);if(o.length!==0){await n({configs:a});for(let[e,n]of o)t({cellId:e,config:n})}},e[0]=n,e[1]=t,e[2]=r):r=e[2],r},ni=e=>{e?.preventDefault(),e?.stopPropagation()};function ri(e){let n=(0,Z.c)(48),i;n[0]===e?i=n[1]:(i=e===void 0?{}:e,n[0]=e,n[1]=i);let{exportDialogReturnFocusRef:o}=i,s=It(),{openModal:_,closeModal:S}=gt(),{toggleApplication:C}=y(),{selectedPanel:w}=x(),[ee]=t(ce),D=r(le),O=ti(),[te]=ae(),A=r(p),P=r(oe),{updateCellConfig:ne,undoDeleteCell:I,clearAllCellOutputs:L,addSetupCellIfDoesntExist:R,collapseAllCells:z,expandAllCells:H}=u(),U=Qr(),G=jt(),se=Zr(s),ue=a(Pn),de=a(B),{handleClick:fe}=V(),pe=a(re),me=a(Qn),{readCode:he,saveCellConfig:q}=He(),ge=l(`database`),_e=l(`storage`),ve=f(),ye=r(E),be=r(M),xe=r(g),{selectedLayout:Se}=qe(),{setLayoutView:Ce}=Je(),we=Nn(),Te=te.sharing?.html??!0,Ee=te.sharing?.wasm??!0,De=te.sharing?.molab??!0,Oe=Se===`slides`,Ae=vi,je;n[2]!==S||n[3]!==o||n[4]!==_||n[5]!==me?(je=(e,t)=>{t&&me(e=>Yn(e,t)),_((0,X.jsx)(Xr,{initialFormat:e,onClose:S,returnFocusRef:o}))},n[2]=S,n[3]=o,n[4]=_,n[5]=me,n[6]=je):je=n[6];let J=je,Me;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,X.jsx)(ke,{size:14,strokeWidth:1.5}),n[7]=Me):Me=n[7];let Ne;return n[8]!==ve||n[9]!==R||n[10]!==P||n[11]!==be||n[12]!==A||n[13]!==L||n[14]!==S||n[15]!==z||n[16]!==se||n[17]!==ge||n[18]!==_e||n[19]!==H||n[20]!==s||n[21]!==ye||n[22]!==Oe||n[23]!==D||n[24]!==J||n[25]!==_||n[26]!==fe||n[27]!==he||n[28]!==U||n[29]!==G||n[30]!==q||n[31]!==Se||n[32]!==w||n[33]!==O||n[34]!==ue||n[35]!==pe||n[36]!==Ce||n[37]!==de||n[38]!==Te||n[39]!==De||n[40]!==Ee||n[41]!==C||n[42]!==we||n[43]!==I||n[44]!==xe||n[45]!==ne||n[46]!==ee.mode?(Ne=[{icon:Me,label:`Export…`,additionalKeywords:[`download`,`html`,`markdown`,`ipynb`,`pdf`,`script`,`png`],handle:()=>J()},{icon:(0,X.jsx)(ke,{size:14,strokeWidth:1.5}),label:`Download`,handle:ni,dropdown:[{icon:(0,X.jsx)(Ge,{size:14,strokeWidth:1.5}),label:`Download as HTML`,handle:()=>J(`html`,{html:{includeCode:!0}})},{icon:(0,X.jsx)(Ge,{size:14,strokeWidth:1.5}),label:`Download as HTML (exclude code)`,handle:()=>J(`html`,{html:{includeCode:!1}})},{icon:(0,X.jsx)(Lt,{strokeWidth:1.5,style:{width:14,height:14}}),label:`Download as Markdown`,handle:()=>J(`markdown`)},{icon:(0,X.jsx)(sn,{size:14,strokeWidth:1.5}),label:`Download as ipynb`,handle:()=>J(`ipynb`)},{icon:(0,X.jsx)(Qe,{size:14,strokeWidth:1.5}),label:`Download notebook source`,handle:()=>J(`script`,{script:{type:`source`}})},{icon:(0,X.jsx)(Qe,{size:14,strokeWidth:1.5}),label:`Download flat script`,handle:()=>J(`script`,{script:{type:`flat`}})},{divider:!0,icon:(0,X.jsx)(dt,{size:14,strokeWidth:1.5}),label:`Download as PNG`,handle:()=>J(`png`)},Oe?{divider:!0,icon:(0,X.jsx)(nt,{size:14,strokeWidth:1.5}),label:`Download as PDF`,handle:ni,dropdown:[{icon:(0,X.jsx)(nt,{size:14,strokeWidth:1.5}),label:`Document Layout`,handle:()=>J(`pdf`,{pdf:{preset:`document`}})},{icon:(0,X.jsx)(nt,{size:14,strokeWidth:1.5}),label:`Slides Layout`,hidden:K(),rightElement:(0,X.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:()=>J(`pdf`,{pdf:{preset:`slides`}})}]}:{divider:!0,icon:(0,X.jsx)(nt,{size:14,strokeWidth:1.5}),label:`Download as PDF`,handle:()=>J(`pdf`,{pdf:{preset:`document`}})}]},{icon:(0,X.jsx)(c,{size:14,strokeWidth:1.5}),label:`Pair with an agent`,hidden:K(),handle:async()=>{_((0,X.jsx)(Vt,{onClose:S}))}},{icon:(0,X.jsx)(un,{size:14,strokeWidth:1.5}),label:`Share`,handle:ni,hidden:!Te&&!Ee&&!De,dropdown:[{icon:(0,X.jsx)(rt,{size:14,strokeWidth:1.5}),label:`Publish HTML to web`,hidden:!Te,handle:async()=>{_((0,X.jsx)(kn,{onClose:S}))}},{icon:(0,X.jsx)(vt,{size:14,strokeWidth:1.5}),label:`Create WebAssembly link`,hidden:!Ee,handle:async()=>{let e=await he(),t=Nt({code:e.contents});await kt(t),wt({title:`Copied`,description:`Link copied to clipboard.`})}},{icon:(0,X.jsx)(Wt,{size:14,strokeWidth:1.5}),label:`Create molab notebook`,hidden:!De,handle:async()=>{let e=await he(),t=Nt({code:e.contents,baseUrl:`${W.molab}/new`});window.open(t,`_blank`)}}]},{icon:(0,X.jsx)(cn,{size:14,strokeWidth:1.5}),label:`Helper panel`,redundant:!0,handle:ni,dropdown:h.flatMap(e=>{let t=e.type===`ai`&&!P;if(T({panel:e,capabilities:A,aiEnabled:P})&&!t)return[];let{type:n,Icon:r,additionalKeywords:i}=e;return{label:Ve.startCase(n),rightElement:Ae(w===n),icon:(0,X.jsx)(r,{size:14,strokeWidth:1.5}),handle:()=>{if(t){fe(`ai`,`ai-features`);return}C(n)},additionalKeywords:i}})},{icon:(0,X.jsx)(ln,{size:14,strokeWidth:1.5}),label:`Present as`,handle:ni,dropdown:[{icon:ee.mode===`present`?(0,X.jsx)(F,{size:14,strokeWidth:1.5}):(0,X.jsx)(Ue,{size:14,strokeWidth:1.5}),label:`Toggle app view`,hotkey:`global.hideCode`,handle:()=>{we()}},...Yt.map((e,t)=>{let n=Ln(e);return{divider:t===0,label:Rn(e),icon:(0,X.jsx)(n,{size:14,strokeWidth:1.5}),rightElement:(0,X.jsx)(`div`,{className:`w-8 flex justify-end`,children:Se===e&&(0,X.jsx)(Xe,{size:14})}),handle:()=>{Ce(e),ee.mode===`edit`&&we()}}})]},{icon:(0,X.jsx)(rn,{size:14,strokeWidth:1.5}),label:`Duplicate notebook`,hidden:!s||K(),handle:se},{icon:(0,X.jsx)(Qt,{size:14,strokeWidth:1.5}),label:`Copy code to clipboard`,hidden:!s,handle:async()=>{let e=await he();await kt(e.contents),wt({title:`Copied`,description:`Code copied to clipboard.`})}},{icon:(0,X.jsx)(Ze,{size:14,strokeWidth:1.5}),label:`Enable all cells`,hidden:!ye||D,handle:async()=>{let e=k(),t=d(e),n=ie.fromEntries(t.map(_i));await q({configs:n});for(let e of t)ne({cellId:e,config:{disabled:!1}})}},{divider:!0,icon:(0,X.jsx)(tn,{size:14,strokeWidth:1.5}),label:`Add setup cell`,handle:()=>{R({})}},{icon:(0,X.jsx)(m,{size:14,strokeWidth:1.5}),label:`Add database connection`,handle:()=>{_((0,X.jsx)(Ht,{onClose:S}))},dropdown:ge.length===0?void 0:[...ge.map(e=>({icon:(0,X.jsx)(c,{size:14,strokeWidth:1.5}),label:`Add ${e.displayName}`,description:`Detected in your environment`,handle:()=>ve(e)})),{divider:!0,icon:(0,X.jsx)(m,{size:14,strokeWidth:1.5}),label:`Browse all connections`,handle:()=>{_((0,X.jsx)(Ht,{onClose:S}))}}]},{icon:(0,X.jsx)(st,{size:14,strokeWidth:1.5}),label:`Add remote storage`,handle:()=>{_((0,X.jsx)(Ht,{defaultTab:`storage`,onClose:S}))},dropdown:_e.length===0?void 0:[..._e.map(e=>({icon:(0,X.jsx)(c,{size:14,strokeWidth:1.5}),label:`Add ${e.displayName}`,description:`Detected in your environment`,handle:()=>ve(e)})),{divider:!0,icon:(0,X.jsx)(st,{size:14,strokeWidth:1.5}),label:`Browse all connections`,handle:()=>{_((0,X.jsx)(Ht,{defaultTab:`storage`,onClose:S}))}}]},{icon:(0,X.jsx)(fn,{size:14,strokeWidth:1.5}),label:xe,hidden:!be||D,handle:()=>{I()}},{icon:(0,X.jsx)(dn,{size:14,strokeWidth:1.5}),label:`Restart kernel`,variant:`danger`,handle:U,additionalKeywords:[`reset`,`reload`,`restart`]},{icon:(0,X.jsx)(nn,{size:14,strokeWidth:1.5}),label:`Re-run all cells`,redundant:!0,hotkey:`global.runAll`,handle:async()=>{G()}},{icon:(0,X.jsx)(N,{size:14,strokeWidth:1.5}),label:`Clear all outputs`,redundant:!0,handle:()=>{L()}},{icon:(0,X.jsx)(b,{size:14,strokeWidth:1.5}),label:`Show all code`,hotkey:`global.showAllCode`,handle:()=>O(!1,`code`),redundant:!0},{icon:(0,X.jsx)(et,{size:14,strokeWidth:1.5}),label:`Hide all code`,hotkey:`global.hideAllCode`,handle:()=>O(!0,`code`),redundant:!0},{icon:(0,X.jsx)(b,{size:14,strokeWidth:1.5}),label:`Show all markdown code`,hotkey:`global.showAllMarkdownCode`,handle:()=>O(!1,`markdown`),redundant:!0},{icon:(0,X.jsx)(et,{size:14,strokeWidth:1.5}),label:`Hide all markdown code`,hotkey:`global.hideAllMarkdownCode`,handle:()=>O(!0,`markdown`),redundant:!0},{icon:(0,X.jsx)(Zt,{size:14,strokeWidth:1.5}),label:`Collapse all sections`,hotkey:`global.collapseAllSections`,handle:z,redundant:!0},{icon:(0,X.jsx)(Xt,{size:14,strokeWidth:1.5}),label:`Expand all sections`,hotkey:`global.expandAllSections`,handle:H,redundant:!0},{divider:!0,icon:(0,X.jsx)(en,{size:14,strokeWidth:1.5}),label:`Command palette`,hotkey:`global.commandPalette`,handle:()=>ue(gi)},{icon:(0,X.jsx)(We,{size:14,strokeWidth:1.5}),label:`Keyboard shortcuts`,hotkey:`global.showHelp`,handle:()=>pe(hi)},{icon:(0,X.jsx)(xt,{size:14,strokeWidth:1.5}),label:`User settings`,handle:()=>de(mi),redundant:!0,additionalKeywords:[`preferences`,`options`,`configuration`]},{icon:(0,X.jsx)(on,{size:14,strokeWidth:1.5}),label:`Report an issue`,additionalKeywords:[`feedback`,`bug`,`issue`,`report`,`diagnostics`],handle:()=>_((0,X.jsx)(Tn,{onClose:S}))},{icon:(0,X.jsx)(tt,{size:14,strokeWidth:1.5}),label:`Resources`,handle:ni,dropdown:[{icon:(0,X.jsx)(j,{size:14,strokeWidth:1.5}),label:`Documentation`,handle:pi},{icon:(0,X.jsx)(Ut,{className:`h-3.5 w-3.5`}),label:`GitHub`,handle:fi},{icon:(0,X.jsx)(it,{size:14,strokeWidth:1.5}),label:`Discord Community`,handle:di},{icon:(0,X.jsx)(ot,{className:`h-3.5 w-3.5`}),label:`YouTube`,handle:ui},{icon:(0,X.jsx)(v,{size:14,strokeWidth:1.5}),label:`Changelog`,handle:li}]},{divider:!0,icon:(0,X.jsx)(ct,{size:14,strokeWidth:1.5}),label:`Open home`,hidden:!location.search.includes(`file`),handle:ci},{icon:(0,X.jsx)(Wt,{size:14,strokeWidth:1.5}),label:`New notebook`,hidden:!location.search.includes(`file`),handle:si}].filter(oi).map(ii),n[8]=ve,n[9]=R,n[10]=P,n[11]=be,n[12]=A,n[13]=L,n[14]=S,n[15]=z,n[16]=se,n[17]=ge,n[18]=_e,n[19]=H,n[20]=s,n[21]=ye,n[22]=Oe,n[23]=D,n[24]=J,n[25]=_,n[26]=fe,n[27]=he,n[28]=U,n[29]=G,n[30]=q,n[31]=Se,n[32]=w,n[33]=O,n[34]=ue,n[35]=pe,n[36]=Ce,n[37]=de,n[38]=Te,n[39]=De,n[40]=Ee,n[41]=C,n[42]=we,n[43]=I,n[44]=xe,n[45]=ne,n[46]=ee.mode,n[47]=Ne):Ne=n[47],Ne}function ii(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(ai)}:e}function ai(e){return!e.hidden}function oi(e){return!e.hidden}function si(){let e=Dt();window.open(e,`_blank`)}function ci(){let e=document.baseURI.split(`?`)[0];window.open(e,`_blank`,`noopener`)}function li(){window.open(W.releasesPage,`_blank`)}function ui(){window.open(W.youtube,`_blank`)}function di(){window.open(W.discordLink,`_blank`)}function fi(){window.open(W.githubPage,`_blank`)}function pi(){window.open(W.docsPage,`_blank`)}function mi(e){return!e}function hi(e){return!e}function gi(e){return!e}function _i(e){return[e,{disabled:!1}]}function vi(e){return(0,X.jsx)(`div`,{className:`w-8 flex justify-end`,children:e&&(0,X.jsx)(Xe,{size:14})})}export{Pn as a,pn as c,tn as d,en as f,Fn as i,fn as l,Qt as m,ti as n,Nn as o,$t as p,Qr as r,wn as s,ri as t,on as u};
|
|
10
|
+
`)})]}),e[71]=C,e[72]=le);let de;e[73]===C?de=e[74]:(de=C&&u.length===0&&(0,X.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`No errors detected.`}),e[73]=C,e[74]=de);let fe;e[75]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,X.jsx)(`a`,{href:W.feedbackForm,target:`_blank`,rel:`noreferrer`,className:`underline`,children:`two-minute survey`}),e[75]=fe):fe=e[75];let me;e[76]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,X.jsx)(`div`,{className:`border-t pt-3`,children:(0,X.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Other feedback? Take our`,` `,fe,` `,`or chat with us on`,` `,(0,X.jsx)(`a`,{href:W.discordLink,target:`_blank`,rel:`noreferrer`,className:`underline`,children:`Discord`}),`.`]})}),e[76]=me):me=e[76];let q;return e[77]!==G||e[78]!==se||e[79]!==ce||e[80]!==K||e[81]!==le||e[82]!==de?(q=(0,X.jsxs)(ht,{className:`w-[540px] max-w-[90vw]`,children:[j,(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 max-h-[60vh] overflow-y-auto`,children:[G,se,ce,K,le,de,me]})]}),e[77]=G,e[78]=se,e[79]=ce,e[80]=K,e[81]=le,e[82]=de,e[83]=q):q=e[83],q};function En(e){return!e}function Dn(e){return e===`bug-description`?`errors`:e===`reproduction-code`?`code`:e}var On=`https://static.marimo.app`,kn=e=>{let t=(0,Z.c)(26),{onClose:n}=e,[r,i]=(0,Q.useState)(``),{exportAsHTML:a}=He(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=Math.random().toString(36).slice(2,6),t[0]=o):o=t[0];let s=`${r}-${o}`,c=`${On}/static/${s}`,l;t[1]!==a||t[2]!==n||t[3]!==s?(l=async e=>{e.preventDefault(),n();let{contents:t}=await a({download:!1,includeCode:!0,files:Ke.INSTANCE.filenames()}),r=wt({title:`Uploading static notebook...`,description:`Please wait.`});await fetch(`${On}/api/static`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({html:t,path:s})}).catch(()=>{r.dismiss(),wt({title:`Error uploading static page`,description:(0,X.jsxs)(`div`,{children:[`Please try again later. If the problem persists, please file a bug report on`,` `,(0,X.jsx)(`a`,{href:W.issuesPage,target:`_blank`,className:`underline`,children:`GitHub`}),`.`]})})}),r.dismiss(),wt({title:`Static page uploaded!`,description:(0,X.jsxs)(`div`,{children:[`The URL has been copied to your clipboard.`,(0,X.jsx)(`br`,{}),`You can share it with anyone.`]})})},t[1]=a,t[2]=n,t[3]=s,t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(_t,{children:`Share static notebook`}),t[5]=u):u=t[5];let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsxs)(mt,{children:[u,(0,X.jsxs)(pt,{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,X.jsx)(`a`,{href:On,target:`_blank`,children:On}),`.`]})]}),t[6]=d):d=t[6];let f;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{let t=e.target.value.toLowerCase().replaceAll(/\s/g,`-`).replaceAll(/[^\da-z-]/g,``);i(t)},t[7]=f):f=t[7];let p;t[8]===r?p=t[9]:(p=(0,X.jsx)(bt,{"data-testid":`slug-input`,id:`slug`,autoFocus:!0,value:r,placeholder:`Notebook slug`,onChange:f,required:!0,autoComplete:`off`}),t[8]=r,t[9]=p);let m;t[10]===c?m=t[11]:(m=(0,X.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,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(An,{text:c}),(0,X.jsx)(`span`,{className:`text-primary`,children:c})]})]}),t[10]=c,t[11]=m);let h;t[12]!==p||t[13]!==m?(h=(0,X.jsxs)(`div`,{className:`flex flex-col gap-6 py-4`,children:[p,m]}),t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;t[15]===n?g=t[16]:(g=(0,X.jsx)(Re,{"data-testid":`cancel-share-static-notebook-button`,variant:`secondary`,onClick:n,children:`Cancel`}),t[15]=n,t[16]=g);let _;t[17]===c?_=t[18]:(_=(0,X.jsx)(Re,{"data-testid":`share-static-notebook-button`,"aria-label":`Save`,variant:`default`,type:`submit`,onClick:async()=>{await kt(c)},children:`Create`}),t[17]=c,t[18]=_);let v;t[19]!==_||t[20]!==g?(v=(0,X.jsxs)(ft,{children:[g,_]}),t[19]=_,t[20]=g,t[21]=v):v=t[21];let y;return t[22]!==v||t[23]!==l||t[24]!==h?(y=(0,X.jsx)(ht,{className:`w-fit`,children:(0,X.jsxs)(`form`,{onSubmit:l,children:[d,h,v]})}),t[22]=v,t[23]=l,t[24]=h,t[25]=y):y=t[25],y},An=e=>{let t=(0,Z.c)(8),[n,r]=Q.useState(!1),i;t[0]===e.text?i=t[1]:(i=Le.stopPropagation(async t=>{t.preventDefault(),await kt(e.text),r(!0),setTimeout(()=>r(!1),2e3)}),t[0]=e.text,t[1]=i);let a=i,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)($e,{size:14,strokeWidth:1.5}),t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=(0,X.jsx)(Re,{"data-testid":`copy-static-notebook-url-button`,onClick:a,size:`xs`,variant:`secondary`,children:o}),t[3]=a,t[4]=s);let c;return t[5]!==n||t[6]!==s?(c=(0,X.jsx)(Fe,{content:`Copied!`,open:n,children:s}),t[5]=n,t[6]=s,t[7]=c):c=t[7],c};function jn(){let e=document.getElementsByClassName(G.outputArea);for(let t of e){let e=t.getBoundingClientRect();if(e.bottom>0&&e.top<window.innerHeight){let e=s.findElement(t);if(!e){H.warn(`Could not find HTMLCellId for visible output area`,t);continue}return{cellId:s.parse(e.id)}}}return H.warn(`No visible output area found for scroll anchor`),null}function Mn(e){if(!e){H.warn(`No scroll anchor provided to restore scroll position`);return}let t=document.getElementById(s.create(e.cellId));if(!t){H.warn(`Could not find cell element to restore scroll position`,e.cellId);return}if(!t.querySelector(`.${G.outputArea}`)){H.warn(`Could not find output area to restore scroll position`,e.cellId);return}t.scrollIntoView({block:`start`,behavior:`auto`})}function Nn(){let e=(0,Z.c)(2),t=a(ce),n;return e[0]===t?n=e[1]:(n=()=>{let e=jn();t(t=>({mode:se(t.mode),cellAnchor:e?.cellId??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Mn(e)})})},e[0]=t,e[1]=n),n}var Pn=n(!1),Fn=()=>{let e=(0,Z.c)(7),{selectedLayout:t}=qe(),{setLayoutView:n}=Je();if(K()&&!O(`wasm_layouts`))return null;let r;e[0]===n?r=e[1]:(r=e=>n(e),e[0]=n,e[1]=r);let i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(De,{className:`min-w-[110px] border-border bg-background`,"data-testid":`layout-select`,children:(0,X.jsx)(Ce,{placeholder:`Select a view`})}),e[2]=i):i=e[2];let a;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Te,{children:(0,X.jsxs)(Ee,{children:[(0,X.jsx)(Se,{children:`View as`}),Yt.map(zn)]})}),e[3]=a):a=e[3];let o;return e[4]!==t||e[5]!==r?(o=(0,X.jsxs)(Oe,{"data-testid":`layout-select`,value:t,onValueChange:r,children:[i,a]}),e[4]=t,e[5]=r,e[6]=o):o=e[6],o};function In(e){let t=Ln(e);return(0,X.jsx)(t,{className:`h-4 w-4`})}function Ln(e){switch(e){case`vertical`:return an;case`grid`:return at;case`slides`:return ln;default:return ze(e),St}}function Rn(e){return Ve.startCase(e)}function zn(e){return(0,X.jsx)(we,{value:e,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 leading-5`,children:[In(e),(0,X.jsx)(`span`,{children:Rn(e)})]})},e)}var Bn=[`html`,`markdown`,`ipynb`,`pdf`,`script`,`png`],Vn=[`pymdown`,`qmd`,`mystmd`,`mdx`],Hn=[`topological`,`top-down`],Un=[`document`,`slides`],Wn=[`source`,`flat`];function Gn(e){return typeof e==`string`&&Bn.some(t=>t===e)}var $={html:{includeCode:!0},markdown:{flavor:null},ipynb:{sortMode:`topological`,includeOutputs:!1},pdf:{preset:`document`,includeInputs:!0,includeOutputs:!0,webpdf:!0},script:{type:`source`}};function Kn(e,t){return e.default(t).catch(t)}function qn(e){return I(e).optional().catch(void 0)}var Jn=I({html:qn({includeCode:Kn(L(),$.html.includeCode)}),markdown:qn({flavor:Kn(R(Vn).nullable(),$.markdown.flavor)}),ipynb:qn({sortMode:Kn(R(Hn),$.ipynb.sortMode),includeOutputs:Kn(L(),$.ipynb.includeOutputs)}),pdf:qn({preset:Kn(R(Un),$.pdf.preset),includeInputs:Kn(L(),$.pdf.includeInputs),includeOutputs:Kn(L(),$.pdf.includeOutputs),webpdf:Kn(L(),$.pdf.webpdf)}),script:qn({type:Kn(R(Wn),$.script.type)})}).catch({});function Yn(e,t){let n={...e},r=r=>{n[r]={...e[r],...t[r]}};for(let e of Object.keys(t))r(e);return n}function Xn(e){return Yn($,Jn.parse(e))}var Zn=P({toSerializable:e=>e,fromSerializable:Xn}),Qn=S(`marimo:export:options:v1`,$,Zn,{getOnInit:!0}),$n=S(`marimo:export:last-format:v1`,`html`,P({toSerializable:e=>e,fromSerializable:e=>Gn(e)?e:`html`}),{getOnInit:!0}),er={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 tr(e,t){return e===`wasm`&&t===`pdf`}function nr({format:e,options:t,runtime:n,filename:r,availability:i}){let a=e===`script`&&t.script.type===`source`?{...er.script,requiresNamedNotebookOnServer:!0}:er[e],o=tr(n,e);if(n===`wasm`&&a.requiresServerRuntime)return{available:o,reason:{type:`wasm-runtime`}};if(n===`server`&&a.requiresNamedNotebookOnServer&&!r)return{available:!1,reason:{type:`notebook-must-be-named`}};if(n===`wasm`||!a.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 s=i.data.formats.find(t=>t.format===e);return s?s.dependenciesAvailable?{available:!0}:s.missingPackages.length>0?{available:!1,reason:{type:`missing-packages`,packages:s.missingPackages}}:s.missingSetup.length>0?{available:!1,reason:{type:`missing-setup`,requirements:s.missingSetup}}:{available:!0,availabilityCheckFailed:!0}:{available:!0,availabilityCheckFailed:!0}}function rr(e,t){return e.map(e=>({value:e,...t[e]}))}var ir=rr([`automatic`,...Vn],{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.`}}),ar=rr(Hn,{"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.`}}),or=rr(Un,{document:{label:`Document`,description:`Creates pages for reading or printing.`},slides:{label:`Slides`,description:`Creates presentation slides from the notebook.`}}),sr=rr([`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.`}}),cr=rr(Wn,{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.`}}),lr={html:{label:`HTML`,actionLabel:`Export HTML`,description:`Save the current notebook as an HTML page.`,Icon:rt,Options:ur},markdown:{label:`Markdown`,actionLabel:`Export Markdown`,description:`Save code and text in a Markdown-based file. Cell outputs are not included.`,Icon:v,Options:dr},ipynb:{label:`Jupyter`,actionLabel:`Export Jupyter notebook`,description:`Open the notebook in Jupyter and other compatible tools.`,Icon:sn,Options:fr},pdf:{label:`PDF`,actionLabel:`Export PDF`,description:`Save the notebook as a PDF for printing or sharing.`,Icon:nt,Options:pr},script:{label:`Python`,actionLabel:`Export flat script`,description:`Save the notebook as a Python file.`,Icon:Qe,Options:mr},png:{label:`PNG`,actionLabel:`Export PNG`,description:`Capture the current app view as an image.`,Icon:dt,Options:hr}};function ur(e){let t=(0,Z.c)(7),{options:n,updateOptions:r,disabled:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={checked:`Includes code cells in the webpage.`,unchecked:`Leaves code cells out of the webpage.`},t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=e=>r(`html`,{includeCode:e}),t[1]=r,t[2]=o);let s;return t[3]!==i||t[4]!==n.html.includeCode||t[5]!==o?(s=(0,X.jsx)(gr,{children:(0,X.jsx)(_r,{label:`Include code`,descriptions:a,checked:n.html.includeCode,disabled:i,onCheckedChange:o})}),t[3]=i,t[4]=n.html.includeCode,t[5]=o,t[6]=s):s=t[6],s}function dr(e){let t=(0,Z.c)(6),{options:n,updateOptions:r,disabled:i}=e,a=n.markdown.flavor??`automatic`,o;t[0]===r?o=t[1]:(o=e=>r(`markdown`,{flavor:e===`automatic`?null:e}),t[0]=r,t[1]=o);let s;return t[2]!==i||t[3]!==a||t[4]!==o?(s=(0,X.jsx)(gr,{children:(0,X.jsx)(br,{label:`Format`,value:a,disabled:i,onValueChange:o,options:ir})}),t[2]=i,t[3]=a,t[4]=o,t[5]=s):s=t[5],s}function fr(e){let t=(0,Z.c)(16),{options:n,updateOptions:r,disabled:i}=e,a;t[0]===r?a=t[1]:(a=e=>r(`ipynb`,{sortMode:e}),t[0]=r,t[1]=a);let o;t[2]!==i||t[3]!==n.ipynb.sortMode||t[4]!==a?(o=(0,X.jsx)(vr,{label:`Cell order`,value:n.ipynb.sortMode,disabled:i,onValueChange:a,options:ar}),t[2]=i,t[3]=n.ipynb.sortMode,t[4]=a,t[5]=o):o=t[5];let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s={checked:`Keeps the outputs currently shown in the notebook.`,unchecked:`Leaves cell outputs out of the Jupyter notebook.`},t[6]=s):s=t[6];let c;t[7]===r?c=t[8]:(c=e=>r(`ipynb`,{includeOutputs:e}),t[7]=r,t[8]=c);let l;t[9]!==i||t[10]!==n.ipynb.includeOutputs||t[11]!==c?(l=(0,X.jsx)(_r,{label:`Include outputs`,descriptions:s,checked:n.ipynb.includeOutputs,disabled:i,onCheckedChange:c}),t[9]=i,t[10]=n.ipynb.includeOutputs,t[11]=c,t[12]=l):l=t[12];let u;return t[13]!==o||t[14]!==l?(u=(0,X.jsxs)(gr,{children:[o,l]}),t[13]=o,t[14]=l,t[15]=u):u=t[15],u}function pr(e){let t=(0,Z.c)(30),{options:n,updateOptions:r,disabled:i}=e,a;t[0]===r?a=t[1]:(a=e=>r(`pdf`,{preset:e}),t[0]=r,t[1]=a);let o;t[2]!==i||t[3]!==n.pdf.preset||t[4]!==a?(o=(0,X.jsx)(vr,{label:`Layout`,value:n.pdf.preset,disabled:i,onValueChange:a,options:or}),t[2]=i,t[3]=n.pdf.preset,t[4]=a,t[5]=o):o=t[5];let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s={checked:`Includes code cells in the PDF.`,unchecked:`Leaves code cells out of the PDF.`},t[6]=s):s=t[6];let c;t[7]===r?c=t[8]:(c=e=>r(`pdf`,{includeInputs:e}),t[7]=r,t[8]=c);let l;t[9]!==i||t[10]!==n.pdf.includeInputs||t[11]!==c?(l=(0,X.jsx)(_r,{label:`Include code`,descriptions:s,checked:n.pdf.includeInputs,disabled:i,onCheckedChange:c}),t[9]=i,t[10]=n.pdf.includeInputs,t[11]=c,t[12]=l):l=t[12];let u;t[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.`},t[13]=u):u=t[13];let d;t[14]===r?d=t[15]:(d=e=>r(`pdf`,{includeOutputs:e}),t[14]=r,t[15]=d);let f;t[16]!==i||t[17]!==n.pdf.includeOutputs||t[18]!==d?(f=(0,X.jsx)(_r,{label:`Include outputs`,descriptions:u,checked:n.pdf.includeOutputs,disabled:i,onCheckedChange:d}),t[16]=i,t[17]=n.pdf.includeOutputs,t[18]=d,t[19]=f):f=t[19];let p;t[20]!==i||t[21]!==n.pdf.preset||t[22]!==n.pdf.webpdf||t[23]!==r?(p=n.pdf.preset===`document`?(0,X.jsx)(vr,{label:`Method`,value:n.pdf.webpdf?`browser`:`latex`,disabled:i,onValueChange:e=>r(`pdf`,{webpdf:e===`browser`}),options:sr}):null,t[20]=i,t[21]=n.pdf.preset,t[22]=n.pdf.webpdf,t[23]=r,t[24]=p):p=t[24];let m;return t[25]!==o||t[26]!==l||t[27]!==f||t[28]!==p?(m=(0,X.jsxs)(gr,{children:[o,l,f,p]}),t[25]=o,t[26]=l,t[27]=f,t[28]=p,t[29]=m):m=t[29],m}function mr(e){let t=(0,Z.c)(6),{options:n,updateOptions:r,disabled:i}=e,a;t[0]===r?a=t[1]:(a=e=>r(`script`,{type:e}),t[0]=r,t[1]=a);let o;return t[2]!==i||t[3]!==n.script.type||t[4]!==a?(o=(0,X.jsx)(gr,{children:(0,X.jsx)(vr,{label:`Format`,value:n.script.type,disabled:i,onValueChange:a,options:cr})}),t[2]=i,t[3]=n.script.type,t[4]=a,t[5]=o):o=t[5],o}function hr(){return null}function gr(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(`div`,{className:`divide-y rounded-md border`,children:n}),t[0]=n,t[1]=r),r}function _r(e){let t=(0,Z.c)(26),{label:n,descriptions:r,descriptionOverride:i,checked:a,disabled:o,onCheckedChange:s}=e,c=(0,Q.useId)(),l=`${c}-description`,u=i??(a?r.checked:r.unchecked),d;t[0]===i?d=t[1]:(d=i?[i]:[],t[0]=i,t[1]=d);let f;t[2]!==r.checked||t[3]!==r.unchecked||t[4]!==d?(f=[r.checked,r.unchecked,...d],t[2]=r.checked,t[3]=r.unchecked,t[4]=d,t[5]=f):f=t[5];let p=f,m;t[6]!==c||t[7]!==n?(m=(0,X.jsx)(`label`,{htmlFor:c,className:`text-sm font-medium leading-5`,children:n}),t[6]=c,t[7]=n,t[8]=m):m=t[8];let h;t[9]!==u||t[10]!==l||t[11]!==p?(h=(0,X.jsx)(Cr,{id:l,description:u,possibleDescriptions:p}),t[9]=u,t[10]=l,t[11]=p,t[12]=h):h=t[12];let g;t[13]!==m||t[14]!==h?(g=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;t[16]!==a||t[17]!==l||t[18]!==o||t[19]!==c||t[20]!==n||t[21]!==s?(_=(0,X.jsx)(me,{id:c,size:`sm`,checked:a,disabled:o,onCheckedChange:s,"aria-label":n,"aria-describedby":l}),t[16]=a,t[17]=l,t[18]=o,t[19]=c,t[20]=n,t[21]=s,t[22]=_):_=t[22];let v;return t[23]!==g||t[24]!==_?(v=(0,X.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between gap-4 px-3 py-2`,children:[g,_]}),t[23]=g,t[24]=_,t[25]=v):v=t[25],v}function vr(e){let t=(0,Z.c)(31),{label:n,value:r,disabled:i,onValueChange:a,options:o}=e,s=(0,Q.useId)(),c=`${s}-description`,l;t[0]!==o||t[1]!==r?(l=o.find(e=>e.value===r)?.description,t[0]=o,t[1]=r,t[2]=l):l=t[2];let u=l,d;t[3]===n?d=t[4]:(d=(0,X.jsx)(`div`,{className:`text-sm font-medium leading-5`,children:n}),t[3]=n,t[4]=d);let f=u??``,p;t[5]===o?p=t[6]:(p=o.map(yr),t[5]=o,t[6]=p);let m;t[7]!==c||t[8]!==f||t[9]!==p?(m=(0,X.jsx)(Cr,{id:c,description:f,possibleDescriptions:p}),t[7]=c,t[8]=f,t[9]=p,t[10]=m):m=t[10];let h;t[11]!==d||t[12]!==m?(h=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[d,m]}),t[11]=d,t[12]=m,t[13]=h):h=t[13];let g;t[14]===a?g=t[15]:(g=e=>a(e),t[14]=a,t[15]=g);let _;if(t[16]!==s||t[17]!==o){let e;t[19]===s?e=t[20]:(e=(e,t)=>{let n=`${s}-${t}`;return(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(te,{id:n,value:e.value}),(0,X.jsx)(`label`,{htmlFor:n,className:`text-sm`,children:e.label})]},e.value)},t[19]=s,t[20]=e),_=o.map(e),t[16]=s,t[17]=o,t[18]=_}else _=t[18];let v;t[21]!==c||t[22]!==i||t[23]!==n||t[24]!==g||t[25]!==_||t[26]!==r?(v=(0,X.jsx)(C,{value:r,onValueChange:g,className:`flex shrink-0 flex-wrap gap-x-5 gap-y-2 sm:justify-end`,"aria-label":n,"aria-describedby":c,disabled:i,children:_}),t[21]=c,t[22]=i,t[23]=n,t[24]=g,t[25]=_,t[26]=r,t[27]=v):v=t[27];let y;return t[28]!==h||t[29]!==v?(y=(0,X.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:[h,v]}),t[28]=h,t[29]=v,t[30]=y):y=t[30],y}function yr(e){return e.description}function br(e){let t=(0,Z.c)(34),{label:n,value:r,disabled:i,onValueChange:a,options:o}=e,s=(0,Q.useId)(),c=`${s}-description`,l;t[0]!==o||t[1]!==r?(l=o.find(e=>e.value===r)?.description,t[0]=o,t[1]=r,t[2]=l):l=t[2];let u=l,d;t[3]!==s||t[4]!==n?(d=(0,X.jsx)(`label`,{htmlFor:s,className:`text-sm font-medium leading-5`,children:n}),t[3]=s,t[4]=n,t[5]=d):d=t[5];let f=u??``,p;t[6]===o?p=t[7]:(p=o.map(Sr),t[6]=o,t[7]=p);let m;t[8]!==c||t[9]!==f||t[10]!==p?(m=(0,X.jsx)(Cr,{id:c,description:f,possibleDescriptions:p}),t[8]=c,t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]!==d||t[13]!==m?(h=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[d,m]}),t[12]=d,t[13]=m,t[14]=h):h=t[14];let g;t[15]===a?g=t[16]:(g=e=>a(e),t[15]=a,t[16]=g);let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(Ce,{}),t[17]=_):_=t[17];let v;t[18]!==c||t[19]!==s?(v=(0,X.jsx)(De,{id:s,"aria-describedby":c,className:`h-8 w-full shrink-0 sm:w-44`,children:_}),t[18]=c,t[19]=s,t[20]=v):v=t[20];let y;t[21]===o?y=t[22]:(y=o.map(xr),t[21]=o,t[22]=y);let b;t[23]===y?b=t[24]:(b=(0,X.jsx)(Te,{children:y}),t[23]=y,t[24]=b);let x;t[25]!==i||t[26]!==b||t[27]!==g||t[28]!==v||t[29]!==r?(x=(0,X.jsxs)(Oe,{value:r,disabled:i,onValueChange:g,children:[v,b]}),t[25]=i,t[26]=b,t[27]=g,t[28]=v,t[29]=r,t[30]=x):x=t[30];let S;return t[31]!==x||t[32]!==h?(S=(0,X.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:[h,x]}),t[31]=x,t[32]=h,t[33]=S):S=t[33],S}function xr(e){return(0,X.jsx)(we,{value:e.value,children:e.label},e.value)}function Sr(e){return e.description}function Cr(e){let t=(0,Z.c)(15),{id:n,description:r,possibleDescriptions:i}=e,a;t[0]===i?a=t[1]:(a=new Set(i),t[0]=i,t[1]=a);let o;t[2]===a?o=t[3]:(o=[...a],t[2]=a,t[3]=o);let s;t[4]!==r||t[5]!==o?(s=o.filter(e=>e!==r),t[4]=r,t[5]=o,t[6]=s):s=t[6];let c=s,l;t[7]!==r||t[8]!==n?(l=(0,X.jsx)(`p`,{id:n,"aria-live":`polite`,className:`col-start-1 row-start-1`,children:r}),t[7]=r,t[8]=n,t[9]=l):l=t[9];let u;t[10]===c?u=t[11]:(u=c.map(wr),t[10]=c,t[11]=u);let d;return t[12]!==l||t[13]!==u?(d=(0,X.jsxs)(`div`,{className:`mt-0.5 grid text-xs leading-4 text-muted-foreground`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function wr(e){return(0,X.jsx)(`p`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:e},e)}var Tr={"playwright-chromium":{description:`PDF export requires Playwright Chromium.`}};function Er(e){let t=(0,Z.c)(10),{status:n}=e;if(n.available&&!n.availabilityCheckFailed)return null;if(n.reason?.type===`checking-requirements`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0`,children:[(0,X.jsx)(yt,{size:`small`,className:`size-3`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Checking requirements`})]}),t[0]=e):e=t[0],e}let r=n.availabilityCheckFailed?`Requirements unknown`:`Unavailable`,i=n.availabilityCheckFailed?`text-muted-foreground`:`text-(--yellow-11)`,a;t[1]===i?a=t[2]:(a=q(`size-3`,i),t[1]=i,t[2]=a);let o;t[3]===a?o=t[4]:(o=(0,X.jsx)(A,{className:a}),t[3]=a,t[4]=o);let s;t[5]===r?s=t[6]:(s=(0,X.jsx)(`span`,{className:`sr-only`,children:r}),t[5]=r,t[6]=s);let c;return t[7]!==o||t[8]!==s?(c=(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function Dr(e){let t=(0,Z.c)(7),{format:n,formatLabel:r,status:i,onInstall:a,isInstalling:o}=e,s=o!==void 0&&o;if(i.availabilityCheckFailed){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`div`,{className:`mb-2.5`,children:(0,X.jsx)(Or,{children:`Couldn't check whether this export is available. You can still try it.`})}),t[0]=e):e=t[0],e}if(!i.reason)return null;let c;return t[1]!==n||t[2]!==r||t[3]!==s||t[4]!==a||t[5]!==i.reason?(c=(0,X.jsx)(`div`,{className:`mb-2.5`,children:(0,X.jsx)(kr,{format:n,formatLabel:r,reason:i.reason,onInstall:a,isInstalling:s})}),t[1]=n,t[2]=r,t[3]=s,t[4]=a,t[5]=i.reason,t[6]=c):c=t[6],c}function Or(e){let t=(0,Z.c)(9),{children:n,onInstall:r,isInstalling:i}=e,a=i!==void 0&&i,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(A,{className:`size-4 shrink-0`}),t[0]=o):o=t[0];let s;t[1]===n?s=t[2]:(s=(0,X.jsx)(`span`,{className:`min-w-0 flex-1`,children:n}),t[1]=n,t[2]=s);let c;t[3]!==a||t[4]!==r?(c=r?(0,X.jsxs)(Re,{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:a,"aria-busy":a,onClick:r,children:[a?(0,X.jsx)(yt,{size:`small`,className:`mr-1.5 size-3.5`}):(0,X.jsx)($t,{className:`mr-1.5 size-3.5`}),`Install`]}):null,t[3]=a,t[4]=r,t[5]=c):c=t[5];let l;return t[6]!==s||t[7]!==c?(l=(0,X.jsxs)(Ft,{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,X.jsxs)(Pt,{className:`flex min-w-0 flex-1 items-center gap-3 text-sm leading-5`,children:[s,c]})]}),t[6]=s,t[7]=c,t[8]=l):l=t[8],l}function kr(e){let t=(0,Z.c)(22),{format:n,formatLabel:r,reason:i,onInstall:a,isInstalling:o}=e;switch(i.type){case`checking-requirements`:{let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(yt,{className:`size-4 shrink-0`,size:`small`}),t[0]=e):e=t[0];let n;return t[1]===r?n=t[2]:(n=(0,X.jsxs)(Ft,{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:[e,(0,X.jsxs)(Pt,{className:`min-w-0 flex-1 text-sm leading-5`,children:[`Checking `,r,` requirements…`]})]}),t[1]=r,t[2]=n),n}case`notebook-must-be-named`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(Or,{children:`Name and save this notebook before exporting.`}),t[3]=e):e=t[3],e}case`missing-packages`:{let e;t[4]===i.packages?e=t[5]:(e=i.packages.join(`, `),t[4]=i.packages,t[5]=e);let n;t[6]===e?n=t[7]:(n=(0,X.jsx)(`code`,{className:`break-words font-mono`,children:e}),t[6]=e,t[7]=n);let s;return t[8]!==r||t[9]!==o||t[10]!==a||t[11]!==n?(s=(0,X.jsxs)(Or,{onInstall:a,isInstalling:o,children:[r,` export requires`,` `,n,`.`]}),t[8]=r,t[9]=o,t[10]=a,t[11]=n,t[12]=s):s=t[12],s}case`missing-setup`:{let e;t[13]!==a||t[14]!==i.requirements?(e=a?i.requirements.map(jr).join(` `):(0,X.jsx)(`span`,{className:`block min-w-0`,children:i.requirements.map(Ar)}),t[13]=a,t[14]=i.requirements,t[15]=e):e=t[15];let n;return t[16]!==o||t[17]!==a||t[18]!==e?(n=(0,X.jsx)(Or,{onInstall:a,isInstalling:o,children:e}),t[16]=o,t[17]=a,t[18]=e,t[19]=n):n=t[19],n}case`wasm-runtime`:{let e=n===`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.`,r;return t[20]===e?r=t[21]:(r=(0,X.jsx)(Or,{children:e}),t[20]=e,t[21]=r),r}default:Be(i)}}function Ar(e){let t=Tr[e.name];return(0,X.jsxs)(`span`,{className:`block`,children:[t.description,(0,X.jsx)(`code`,{className:`mt-1 block break-all font-mono`,children:e.command})]},e.name)}function jr(e){return Tr[e.name].description}function Mr(e){return e.endsWith(`.myst.md`)?`mystmd`:e.endsWith(`.qmd`)?`qmd`:e.endsWith(`.mdx`)?`mdx`:`pymdown`}function Nr(e,t){let n=t??Mr(e),r=lt[n],i=ut.find(t=>e.endsWith(t)),a=Ne.withoutExtension(e);i&&(a=e.slice(0,-i.length));let o=`${a}.${r}`;return o===e?`${e.slice(0,-(r.length+1))}.export.${r}`:o}function Pr(e){return Object.entries(e).flatMap(([e,t])=>t===null?[]:t===!0?[`--${e}`]:t===!1?[`--no-${e}`]:[`--${e}=${t}`])}function Fr(e){return e.preset===`document`?e.webpdf:null}var Ir={html:{subcommand:`html`,flags:({html:e})=>({"include-code":e.includeCode}),outputFilename:e=>Ne.toHTML(e)},markdown:{subcommand:`md`,flags:({markdown:e})=>({flavor:e.flavor}),outputFilename:(e,{markdown:t})=>Nr(e,t.flavor)},ipynb:{subcommand:`ipynb`,flags:({ipynb:e})=>({sort:e.sortMode,"include-outputs":e.includeOutputs}),outputFilename:e=>Ne.toIPYNB(e)},pdf:{subcommand:`pdf`,flags:({pdf:e})=>({as:e.preset,"include-inputs":e.includeInputs,"include-outputs":e.includeOutputs,webpdf:Fr(e)}),outputFilename:e=>Ne.toPDF(e)},script:{subcommand:`script`,flags:()=>({}),outputFilename:e=>`${Ne.withoutExtension(e)}.script.py`}};function Lr({format:e,filename:t,options:n}){if(e===`png`||e===`script`&&n.script.type===`source`||!t)return null;let r=Ir[e];return[`marimo`,`export`,r.subcommand,Bt(t),...Pr(r.flags(n)),`-o`,Bt(r.outputFilename(t,n))].join(` `)}async function Rr(e){let{exportOptions:t,captureOutputs:n,downloadPDF:r}=e;t.includeOutputs&&await n(),await r(t)}async function zr({format:e,options:t,requests:n,sourceFilename:r,htmlFiles:i,captureOutputs:a,capturePNG:o,downloadFile:s}){switch(e){case`html`:s(await n.exportAsHTML({download:!1,files:i,includeCode:t.html.includeCode}));return;case`markdown`:s(await n.exportAsMarkdown({download:!1,flavor:t.markdown.flavor}));return;case`ipynb`:t.ipynb.includeOutputs&&await a(),s(await n.exportAsIPYNB({download:!1,sortMode:t.ipynb.sortMode,includeOutputs:t.ipynb.includeOutputs}));return;case`pdf`:await Rr({exportOptions:t.pdf,captureOutputs:a,downloadPDF:async e=>{s(await n.exportAsPDF(e))}});return;case`script`:if(t.script.type===`source`){s({contents:(await n.readCode()).contents,filename:r,mediaType:`text/plain`});return}s(await n.exportAsScript({download:!1}));return;case`png`:await o();return;default:Be(e)}}var Br={source:{actionLabel:`Export notebook source`,progressLabel:`notebook source`},flat:{actionLabel:`Export flat script`,progressLabel:`flat script`}};function Vr(e,t){if(e===`wasm`)return{status:`success`,data:null};switch(t.status){case`pending`:case`loading`:return{status:`pending`};case`error`:return{status:`error`};case`success`:return{status:`success`,data:t.data}}}function Hr(e,t){return e===`server`&&t?Tt.basename(t):Ne.toPY(document.title)}function Ur({usesBrowserPrint:e,hasCommand:t,format:n,isNotebookSource:r}){return e?`Uses the browser's print settings for page size and filename.`:t?`Uses the current session state. The copied command exports the saved notebook.`:n!==`png`&&!r?`Save the notebook to copy an equivalent shell command.`:null}function Wr(e){let n=It(),[r,i]=t(Qn),[a,o]=t($n),[s,c]=(0,Q.useState)(e??a),l=K()?`wasm`:`server`,u=He(),d=de(),[f,p]=(0,Q.useState)(!1),m=Ot(async()=>l===`wasm`?null:u.getExportAvailability(),[l,u]),h=Vr(l,m),g=e=>nr({format:e,options:r,runtime:l,filename:n,availability:h}),_=g(s),v=d&&(_.reason?.type===`missing-packages`||_.reason?.type===`missing-setup`),y=Bn.map(e=>({format:e,status:g(e)})),b=tr(l,s),x=lr[s],S=s===`script`&&r.script.type===`source`,{actionLabel:C,progressLabel:w}=s===`script`?Br[r.script.type]:{actionLabel:x.actionLabel,progressLabel:x.label},T=b?null:Lr({format:s,filename:n,options:r}),E=Ur({usesBrowserPrint:b,hasCommand:!!T,format:s,isNotebookSource:S});return(0,Q.useEffect)(()=>{e&&o(e)},[e,o]),{formats:y,options:r,selected:{format:s,status:_,usesBrowserPrint:b,actionLabel:C,command:T,footerDescription:E},exportRequest:{format:s,options:r,sourceFilename:Hr(l,n),available:_.available,usesBrowserPrint:b,progressLabel:w},selectFormat:e=>{Gn(e)&&(c(e),o(e))},updateOptions:(e,t)=>{i(n=>{let r={...n};return r[e]={...n[e],...t},r})},canInstall:v,isInstalling:f,installRequirements:async()=>{if(!(!v||f||s===`png`)){p(!0);try{let e=await u.installExportRequirements({format:s});m.setData(e)}catch{}finally{p(!1)}}}}}async function Gr(e){let t=document.getElementById(`App`);if(!t){let e=`The current app view could not be captured.`;throw wt({title:`Failed to download as PNG`,description:e,variant:`danger`}),Error(e)}let n=e?.style.visibility,r=e?.classList.contains(`print:hidden`);if(!await Me({element:t,filename:document.title,prepare:()=>{let t=Pe();return e&&(e.classList.add(`print:hidden`),e.style.visibility=`hidden`),()=>{t(),e&&(r||e.classList.remove(`print:hidden`),e.style.visibility=n??``)}}}))throw Error(`Failed to capture the current app view.`)}function Kr(e){e(),requestAnimationFrame(()=>{setTimeout(()=>{window.print()},0)})}function qr({format:e,options:t,sourceFilename:n,available:r,usesBrowserPrint:i,progressLabel:a,onClose:o}){let s=He(),c=Kt(),[l,u]=(0,Q.useState)(!1),d=(0,Q.useRef)(null),f=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(f.current=!0,()=>{f.current=!1}),[]);let p=async e=>{await qt({takeScreenshots:()=>c({progress:e}),updateCellOutputs:s.updateCellOutputs})},m=async()=>{await fe(()=>Gr(d.current?.parentElement??null))};return{dialogRef:d,isExporting:l,submit:async()=>{if(!(!r||l)){if(i){Kr(o);return}u(!0);try{await J(`Exporting ${a}…`,async r=>{await zr({format:e,options:t,requests:s,sourceFilename:n,htmlFiles:Ke.INSTANCE.filenames(),captureOutputs:()=>p(r),capturePNG:m,downloadFile:je})}),f.current&&o()}catch(e){H.error(`Export failed`,e)}finally{f.current&&u(!1)}}}}}function Jr(e){let t=(0,Z.c)(15),{initialFormat:n,onClose:r}=e,i=Wr(n),a,o,s;t[0]===i?(a=t[1],o=t[2],s=t[3]):({exportRequest:a,selectFormat:o,...s}=i,t[0]=i,t[1]=a,t[2]=o,t[3]=s);let c;t[4]!==a||t[5]!==r?(c={...a,onClose:r},t[4]=a,t[5]=r,t[6]=c):c=t[6];let l=qr(c),u;t[7]!==l||t[8]!==o||t[9]!==s?(u=e=>{!l.isExporting&&!s.isInstalling&&o(e)},t[7]=l,t[8]=o,t[9]=s,t[10]=u):u=t[10];let d;return t[11]!==l||t[12]!==s||t[13]!==u?(d={...s,...l,selectFormat:u},t[11]=l,t[12]=s,t[13]=u,t[14]=d):d=t[14],d}var Yr=`(min-width: 640px)`,Xr=e=>{let t=(0,Z.c)(75),{initialFormat:n,onClose:r,returnFocusRef:i}=e,a;t[0]!==n||t[1]!==r?(a={initialFormat:n,onClose:r},t[0]=n,t[1]=r,t[2]=a):a=t[2];let{dialogRef:o,isExporting:s,isInstalling:c,canInstall:l,formats:u,options:d,selected:f,selectFormat:p,updateOptions:m,installRequirements:h,submit:g}=Jr(a),_=s||c,v=Ae(Yr),{format:y,status:b,usesBrowserPrint:x,actionLabel:S,command:C,footerDescription:w}=f,T=lr[y],E=T.Options,ee;t[3]===i?ee=t[4]:(ee=i?{onCloseAutoFocus:e=>{e.preventDefault(),i.current?.focus()}}:{},t[3]=i,t[4]=ee);let D=ee,O;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,X.jsxs)(mt,{className:`border-b px-5 py-4 pr-12`,children:[(0,X.jsx)(_t,{children:`Export notebook`}),(0,X.jsx)(pt,{children:`Choose a format and adjust its options.`})]}),t[5]=O):O=t[5];let te=v?`vertical`:`horizontal`,k;if(t[6]!==u||t[7]!==_){let e;t[9]===_?e=t[10]:(e=e=>{let{format:t,status:n}=e,r=lr[t];return(0,X.jsxs)(ve,{value:t,disabled:_,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-${t}`,children:[(0,X.jsx)(r.Icon,{className:`size-3.5 shrink-0`,strokeWidth:1.5}),(0,X.jsx)(`span`,{className:`truncate`,children:r.label}),(0,X.jsx)(Er,{status:n})]},t)},t[9]=_,t[10]=e),k=u.map(e),t[6]=u,t[7]=_,t[8]=k}else k=t[8];let A;t[11]===k?A=t[12]:(A=(0,X.jsx)(be,{"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:k}),t[11]=k,t[12]=A);let j;if(t[13]!==E||t[14]!==l||t[15]!==T.description||t[16]!==T.label||t[17]!==y||t[18]!==u||t[19]!==h||t[20]!==_||t[21]!==c||t[22]!==d||t[23]!==b||t[24]!==m||t[25]!==x){let e;t[27]!==E||t[28]!==l||t[29]!==T.description||t[30]!==T.label||t[31]!==y||t[32]!==h||t[33]!==_||t[34]!==c||t[35]!==d||t[36]!==b||t[37]!==m||t[38]!==x?(e=e=>{let{format:t}=e;return(0,X.jsxs)(ye,{value:t,className:`mt-0 min-h-0 min-w-0 overflow-y-auto px-4 py-3`,children:[(0,X.jsxs)(`div`,{className:`mb-3`,children:[(0,X.jsx)(`h3`,{className:`text-base font-semibold`,children:T.label}),(0,X.jsx)(`p`,{className:`mt-0.5 text-sm text-muted-foreground`,children:T.description})]}),(0,X.jsx)(Dr,{format:y,formatLabel:T.label,status:b,onInstall:l?h:void 0,isInstalling:c}),x?null:(0,X.jsx)(E,{options:d,updateOptions:m,disabled:_})]},t)},t[27]=E,t[28]=l,t[29]=T.description,t[30]=T.label,t[31]=y,t[32]=h,t[33]=_,t[34]=c,t[35]=d,t[36]=b,t[37]=m,t[38]=x,t[39]=e):e=t[39],j=u.map(e),t[13]=E,t[14]=l,t[15]=T.description,t[16]=T.label,t[17]=y,t[18]=u,t[19]=h,t[20]=_,t[21]=c,t[22]=d,t[23]=b,t[24]=m,t[25]=x,t[26]=j}else j=t[26];let M;t[40]!==y||t[41]!==p||t[42]!==te||t[43]!==A||t[44]!==j?(M=(0,X.jsxs)(xe,{value:y,onValueChange:p,orientation:te,className:`flex min-h-0 min-w-0 flex-col overflow-hidden sm:grid sm:grid-cols-[168px_minmax(0,1fr)]`,children:[A,j]}),t[40]=y,t[41]=p,t[42]=te,t[43]=A,t[44]=j,t[45]=M):M=t[45];let N;t[46]===C?N=t[47]:(N=C?(0,X.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,X.jsx)(`span`,{className:`select-none text-muted-foreground`,"aria-hidden":!0,children:`$`}),(0,X.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:C}),(0,X.jsx)(At,{value:C,className:`size-3.5`,buttonClassName:q(Ie({variant:`ghost`,size:`icon`}),`shrink-0`),tooltip:`Copy POSIX shell command`,ariaLabel:`Copy POSIX shell command`,toastTitle:`Command copied`})]}):null,t[46]=C,t[47]=N);let P=C&&`mt-3`,ne;t[48]===P?ne=t[49]:(ne=q(`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,P),t[48]=P,t[49]=ne);let F;t[50]===w?F=t[51]:(F=w?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:w}):null,t[50]=w,t[51]=F);let I=!b.available||_,L=!w&&`sm:ml-auto`,R;t[52]===L?R=t[53]:(R=q(`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)`,L),t[52]=L,t[53]=R);let z;t[54]===s?z=t[55]:(z=s&&(0,X.jsx)(yt,{size:`small`,className:`mr-2`,"aria-hidden":!0}),t[54]=s,t[55]=z);let re=x?`Print to PDF`:S,B;t[56]!==s||t[57]!==g||t[58]!==I||t[59]!==R||t[60]!==z||t[61]!==re?(B=(0,X.jsxs)(Re,{type:`button`,disabled:I,"aria-busy":s,onClick:g,className:R,"data-testid":`export-submit`,children:[z,re]}),t[56]=s,t[57]=g,t[58]=I,t[59]=R,t[60]=z,t[61]=re,t[62]=B):B=t[62];let V;t[63]!==ne||t[64]!==F||t[65]!==B?(V=(0,X.jsxs)(`div`,{className:ne,children:[F,B]}),t[63]=ne,t[64]=F,t[65]=B,t[66]=V):V=t[66];let H;t[67]!==V||t[68]!==N?(H=(0,X.jsxs)(`footer`,{className:`min-w-0 border-t bg-muted/20 px-4 py-3`,children:[N,V]}),t[67]=V,t[68]=N,t[69]=H):H=t[69];let U;return t[70]!==o||t[71]!==D||t[72]!==H||t[73]!==M?(U=(0,X.jsxs)(ht,{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`,...D,children:[O,M,H]}),t[70]=o,t[71]=D,t[72]=H,t[73]=M,t[74]=U):U=t[74],U};function Zr(e){let t=(0,Z.c)(5),{openPrompt:n,closeModal:r}=gt(),{sendCopy:i}=He(),a;return t[0]!==r||t[1]!==n||t[2]!==i||t[3]!==e?(a=()=>{if(!e)return null;let t=Et.guessDeliminator(e),a=Tt.basename(e);n({title:`Copy notebook`,description:`Enter a new filename for the notebook copy.`,defaultValue:`_${a}`,confirmText:`Copy notebook`,spellCheck:!1,onConfirm:n=>{let a=t.join(Tt.dirname(e),n);i({source:e,destination:a}).then(()=>{r(),wt({title:`Notebook copied`,description:`A copy of the notebook has been created.`}),Gt(a)})}})},t[0]=r,t[1]=n,t[2]=i,t[3]=e,t[4]=a):a=t[4],a}function Qr(){let e=(0,Z.c)(4),{openConfirm:t}=gt(),n=a(pe),{sendRestart:r}=He(),i;return e[0]!==t||e[1]!==r||e[2]!==n?(i=()=>{t({title:`Restart Kernel`,description:`This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.`,variant:`destructive`,confirmAction:(0,X.jsx)(_e,{onClick:async()=>{n({state:ue.CLOSING}),await r(),Mt()},"aria-label":`Confirm Restart`,children:`Restart`})})},e[0]=t,e[1]=r,e[2]=n,e[3]=i):i=e[3],i}var $r=new D,ei=e=>$r.isSupported(e)?`markdown`:`code`,ti=()=>{let e=(0,Z.c)(3),{updateCellConfig:t}=u(),{saveCellConfig:n}=He(),r;return e[0]!==n||e[1]!==t?(r=async(e,r)=>{let i=k(),a={};for(let t of i.cellIds.inOrderIds){let n=i.cellData[t];n!==void 0&&n.config.hide_code!==e&&ei(n.code)===r&&(a[t]={hide_code:e})}let o=ie.entries(a);if(o.length!==0){await n({configs:a});for(let[e,n]of o)t({cellId:e,config:n})}},e[0]=n,e[1]=t,e[2]=r):r=e[2],r},ni=e=>{e?.preventDefault(),e?.stopPropagation()};function ri(e){let n=(0,Z.c)(48),i;n[0]===e?i=n[1]:(i=e===void 0?{}:e,n[0]=e,n[1]=i);let{exportDialogReturnFocusRef:o}=i,s=It(),{openModal:_,closeModal:S}=gt(),{toggleApplication:C}=y(),{selectedPanel:w}=x(),[ee]=t(ce),D=r(le),O=ti(),[te]=ae(),A=r(p),P=r(oe),{updateCellConfig:ne,undoDeleteCell:I,clearAllCellOutputs:L,addSetupCellIfDoesntExist:R,collapseAllCells:z,expandAllCells:H}=u(),U=Qr(),G=jt(),se=Zr(s),ue=a(Pn),de=a(B),{handleClick:fe}=V(),pe=a(re),me=a(Qn),{readCode:he,saveCellConfig:q}=He(),ge=l(`database`),_e=l(`storage`),ve=f(),ye=r(E),be=r(M),xe=r(g),{selectedLayout:Se}=qe(),{setLayoutView:Ce}=Je(),we=Nn(),Te=te.sharing?.html??!0,Ee=te.sharing?.wasm??!0,De=te.sharing?.molab??!0,Oe=Se===`slides`,Ae=vi,je;n[2]!==S||n[3]!==o||n[4]!==_||n[5]!==me?(je=(e,t)=>{t&&me(e=>Yn(e,t)),_((0,X.jsx)(Xr,{initialFormat:e,onClose:S,returnFocusRef:o}))},n[2]=S,n[3]=o,n[4]=_,n[5]=me,n[6]=je):je=n[6];let J=je,Me;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,X.jsx)(ke,{size:14,strokeWidth:1.5}),n[7]=Me):Me=n[7];let Ne;return n[8]!==ve||n[9]!==R||n[10]!==P||n[11]!==be||n[12]!==A||n[13]!==L||n[14]!==S||n[15]!==z||n[16]!==se||n[17]!==ge||n[18]!==_e||n[19]!==H||n[20]!==s||n[21]!==ye||n[22]!==Oe||n[23]!==D||n[24]!==J||n[25]!==_||n[26]!==fe||n[27]!==he||n[28]!==U||n[29]!==G||n[30]!==q||n[31]!==Se||n[32]!==w||n[33]!==O||n[34]!==ue||n[35]!==pe||n[36]!==Ce||n[37]!==de||n[38]!==Te||n[39]!==De||n[40]!==Ee||n[41]!==C||n[42]!==we||n[43]!==I||n[44]!==xe||n[45]!==ne||n[46]!==ee.mode?(Ne=[{icon:Me,label:`Export…`,additionalKeywords:[`download`,`html`,`markdown`,`ipynb`,`pdf`,`script`,`png`],handle:()=>J()},{icon:(0,X.jsx)(ke,{size:14,strokeWidth:1.5}),label:`Download`,redundant:!0,handle:ni,dropdown:[{icon:(0,X.jsx)(Ge,{size:14,strokeWidth:1.5}),label:`Download as HTML`,handle:()=>J(`html`,{html:{includeCode:!0}})},{icon:(0,X.jsx)(Ge,{size:14,strokeWidth:1.5}),label:`Download as HTML (exclude code)`,handle:()=>J(`html`,{html:{includeCode:!1}})},{icon:(0,X.jsx)(Lt,{strokeWidth:1.5,style:{width:14,height:14}}),label:`Download as Markdown`,handle:()=>J(`markdown`)},{icon:(0,X.jsx)(sn,{size:14,strokeWidth:1.5}),label:`Download as ipynb`,handle:()=>J(`ipynb`)},{icon:(0,X.jsx)(Qe,{size:14,strokeWidth:1.5}),label:`Download notebook source`,handle:()=>J(`script`,{script:{type:`source`}})},{icon:(0,X.jsx)(Qe,{size:14,strokeWidth:1.5}),label:`Download flat script`,handle:()=>J(`script`,{script:{type:`flat`}})},{divider:!0,icon:(0,X.jsx)(dt,{size:14,strokeWidth:1.5}),label:`Download as PNG`,handle:()=>J(`png`)},Oe?{divider:!0,icon:(0,X.jsx)(nt,{size:14,strokeWidth:1.5}),label:`Download as PDF`,handle:ni,dropdown:[{icon:(0,X.jsx)(nt,{size:14,strokeWidth:1.5}),label:`Document Layout`,handle:()=>J(`pdf`,{pdf:{preset:`document`}})},{icon:(0,X.jsx)(nt,{size:14,strokeWidth:1.5}),label:`Slides Layout`,hidden:K(),rightElement:(0,X.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:()=>J(`pdf`,{pdf:{preset:`slides`}})}]}:{divider:!0,icon:(0,X.jsx)(nt,{size:14,strokeWidth:1.5}),label:`Download as PDF`,handle:()=>J(`pdf`,{pdf:{preset:`document`}})}]},{icon:(0,X.jsx)(c,{size:14,strokeWidth:1.5}),label:`Pair with an agent`,hidden:K(),handle:async()=>{_((0,X.jsx)(Vt,{onClose:S}))}},{icon:(0,X.jsx)(un,{size:14,strokeWidth:1.5}),label:`Share`,handle:ni,hidden:!Te&&!Ee&&!De,dropdown:[{icon:(0,X.jsx)(rt,{size:14,strokeWidth:1.5}),label:`Publish HTML to web`,hidden:!Te,handle:async()=>{_((0,X.jsx)(kn,{onClose:S}))}},{icon:(0,X.jsx)(vt,{size:14,strokeWidth:1.5}),label:`Create WebAssembly link`,hidden:!Ee,handle:async()=>{let e=await he(),t=Nt({code:e.contents});await kt(t),wt({title:`Copied`,description:`Link copied to clipboard.`})}},{icon:(0,X.jsx)(Wt,{size:14,strokeWidth:1.5}),label:`Create molab notebook`,hidden:!De,handle:async()=>{let e=await he(),t=Nt({code:e.contents,baseUrl:`${W.molab}/new`});window.open(t,`_blank`)}}]},{icon:(0,X.jsx)(cn,{size:14,strokeWidth:1.5}),label:`Helper panel`,redundant:!0,handle:ni,dropdown:h.flatMap(e=>{let t=e.type===`ai`&&!P;if(T({panel:e,capabilities:A,aiEnabled:P})&&!t)return[];let{type:n,Icon:r,additionalKeywords:i}=e;return{label:Ve.startCase(n),rightElement:Ae(w===n),icon:(0,X.jsx)(r,{size:14,strokeWidth:1.5}),handle:()=>{if(t){fe(`ai`,`ai-features`);return}C(n)},additionalKeywords:i}})},{icon:(0,X.jsx)(ln,{size:14,strokeWidth:1.5}),label:`Present as`,handle:ni,dropdown:[{icon:ee.mode===`present`?(0,X.jsx)(F,{size:14,strokeWidth:1.5}):(0,X.jsx)(Ue,{size:14,strokeWidth:1.5}),label:`Toggle app view`,hotkey:`global.hideCode`,handle:()=>{we()}},...Yt.map((e,t)=>{let n=Ln(e);return{divider:t===0,label:Rn(e),icon:(0,X.jsx)(n,{size:14,strokeWidth:1.5}),rightElement:(0,X.jsx)(`div`,{className:`w-8 flex justify-end`,children:Se===e&&(0,X.jsx)(Xe,{size:14})}),handle:()=>{Ce(e),ee.mode===`edit`&&we()}}})]},{icon:(0,X.jsx)(rn,{size:14,strokeWidth:1.5}),label:`Duplicate notebook`,hidden:!s||K(),handle:se},{icon:(0,X.jsx)(Qt,{size:14,strokeWidth:1.5}),label:`Copy code to clipboard`,hidden:!s,handle:async()=>{let e=await he();await kt(e.contents),wt({title:`Copied`,description:`Code copied to clipboard.`})}},{icon:(0,X.jsx)(Ze,{size:14,strokeWidth:1.5}),label:`Enable all cells`,hidden:!ye||D,handle:async()=>{let e=k(),t=d(e),n=ie.fromEntries(t.map(_i));await q({configs:n});for(let e of t)ne({cellId:e,config:{disabled:!1}})}},{divider:!0,icon:(0,X.jsx)(tn,{size:14,strokeWidth:1.5}),label:`Add setup cell`,handle:()=>{R({})}},{icon:(0,X.jsx)(m,{size:14,strokeWidth:1.5}),label:`Add database connection`,handle:()=>{_((0,X.jsx)(Ht,{onClose:S}))},dropdown:ge.length===0?void 0:[...ge.map(e=>({icon:(0,X.jsx)(c,{size:14,strokeWidth:1.5}),label:`Add ${e.displayName}`,description:`Detected in your environment`,handle:()=>ve(e)})),{divider:!0,icon:(0,X.jsx)(m,{size:14,strokeWidth:1.5}),label:`Browse all connections`,handle:()=>{_((0,X.jsx)(Ht,{onClose:S}))}}]},{icon:(0,X.jsx)(st,{size:14,strokeWidth:1.5}),label:`Add remote storage`,handle:()=>{_((0,X.jsx)(Ht,{defaultTab:`storage`,onClose:S}))},dropdown:_e.length===0?void 0:[..._e.map(e=>({icon:(0,X.jsx)(c,{size:14,strokeWidth:1.5}),label:`Add ${e.displayName}`,description:`Detected in your environment`,handle:()=>ve(e)})),{divider:!0,icon:(0,X.jsx)(st,{size:14,strokeWidth:1.5}),label:`Browse all connections`,handle:()=>{_((0,X.jsx)(Ht,{defaultTab:`storage`,onClose:S}))}}]},{icon:(0,X.jsx)(fn,{size:14,strokeWidth:1.5}),label:xe,hidden:!be||D,handle:()=>{I()}},{icon:(0,X.jsx)(dn,{size:14,strokeWidth:1.5}),label:`Restart kernel`,variant:`danger`,handle:U,additionalKeywords:[`reset`,`reload`,`restart`]},{icon:(0,X.jsx)(nn,{size:14,strokeWidth:1.5}),label:`Re-run all cells`,redundant:!0,hotkey:`global.runAll`,handle:async()=>{G()}},{icon:(0,X.jsx)(N,{size:14,strokeWidth:1.5}),label:`Clear all outputs`,redundant:!0,handle:()=>{L()}},{icon:(0,X.jsx)(b,{size:14,strokeWidth:1.5}),label:`Show all code`,hotkey:`global.showAllCode`,handle:()=>O(!1,`code`),redundant:!0},{icon:(0,X.jsx)(et,{size:14,strokeWidth:1.5}),label:`Hide all code`,hotkey:`global.hideAllCode`,handle:()=>O(!0,`code`),redundant:!0},{icon:(0,X.jsx)(b,{size:14,strokeWidth:1.5}),label:`Show all markdown code`,hotkey:`global.showAllMarkdownCode`,handle:()=>O(!1,`markdown`),redundant:!0},{icon:(0,X.jsx)(et,{size:14,strokeWidth:1.5}),label:`Hide all markdown code`,hotkey:`global.hideAllMarkdownCode`,handle:()=>O(!0,`markdown`),redundant:!0},{icon:(0,X.jsx)(Zt,{size:14,strokeWidth:1.5}),label:`Collapse all sections`,hotkey:`global.collapseAllSections`,handle:z,redundant:!0},{icon:(0,X.jsx)(Xt,{size:14,strokeWidth:1.5}),label:`Expand all sections`,hotkey:`global.expandAllSections`,handle:H,redundant:!0},{divider:!0,icon:(0,X.jsx)(en,{size:14,strokeWidth:1.5}),label:`Command palette`,hotkey:`global.commandPalette`,handle:()=>ue(gi)},{icon:(0,X.jsx)(We,{size:14,strokeWidth:1.5}),label:`Keyboard shortcuts`,hotkey:`global.showHelp`,handle:()=>pe(hi)},{icon:(0,X.jsx)(xt,{size:14,strokeWidth:1.5}),label:`User settings`,handle:()=>de(mi),redundant:!0,additionalKeywords:[`preferences`,`options`,`configuration`]},{icon:(0,X.jsx)(on,{size:14,strokeWidth:1.5}),label:`Report an issue`,additionalKeywords:[`feedback`,`bug`,`issue`,`report`,`diagnostics`],handle:()=>_((0,X.jsx)(Tn,{onClose:S}))},{icon:(0,X.jsx)(tt,{size:14,strokeWidth:1.5}),label:`Resources`,handle:ni,dropdown:[{icon:(0,X.jsx)(j,{size:14,strokeWidth:1.5}),label:`Documentation`,handle:pi},{icon:(0,X.jsx)(Ut,{className:`h-3.5 w-3.5`}),label:`GitHub`,handle:fi},{icon:(0,X.jsx)(it,{size:14,strokeWidth:1.5}),label:`Discord Community`,handle:di},{icon:(0,X.jsx)(ot,{className:`h-3.5 w-3.5`}),label:`YouTube`,handle:ui},{icon:(0,X.jsx)(v,{size:14,strokeWidth:1.5}),label:`Changelog`,handle:li}]},{divider:!0,icon:(0,X.jsx)(ct,{size:14,strokeWidth:1.5}),label:`Open home`,hidden:!location.search.includes(`file`),handle:ci},{icon:(0,X.jsx)(Wt,{size:14,strokeWidth:1.5}),label:`New notebook`,hidden:!location.search.includes(`file`),handle:si}].filter(oi).map(ii),n[8]=ve,n[9]=R,n[10]=P,n[11]=be,n[12]=A,n[13]=L,n[14]=S,n[15]=z,n[16]=se,n[17]=ge,n[18]=_e,n[19]=H,n[20]=s,n[21]=ye,n[22]=Oe,n[23]=D,n[24]=J,n[25]=_,n[26]=fe,n[27]=he,n[28]=U,n[29]=G,n[30]=q,n[31]=Se,n[32]=w,n[33]=O,n[34]=ue,n[35]=pe,n[36]=Ce,n[37]=de,n[38]=Te,n[39]=De,n[40]=Ee,n[41]=C,n[42]=we,n[43]=I,n[44]=xe,n[45]=ne,n[46]=ee.mode,n[47]=Ne):Ne=n[47],Ne}function ii(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(ai)}:e}function ai(e){return!e.hidden}function oi(e){return!e.hidden}function si(){let e=Dt();window.open(e,`_blank`)}function ci(){let e=document.baseURI.split(`?`)[0];window.open(e,`_blank`,`noopener`)}function li(){window.open(W.releasesPage,`_blank`)}function ui(){window.open(W.youtube,`_blank`)}function di(){window.open(W.discordLink,`_blank`)}function fi(){window.open(W.githubPage,`_blank`)}function pi(){window.open(W.docsPage,`_blank`)}function mi(e){return!e}function hi(e){return!e}function gi(e){return!e}function _i(e){return[e,{disabled:!1}]}function vi(e){return(0,X.jsx)(`div`,{className:`w-8 flex justify-end`,children:e&&(0,X.jsx)(Xe,{size:14})})}export{Pn as a,pn as c,tn as d,en as f,Fn as i,fn as l,Qt as m,ti as n,Nn as o,$t as p,Qr as r,wn as s,ri as t,on 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-CRLe8Sox.js"></script>
|
|
70
70
|
<link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-B0Z9INg1.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="./assets/react-CBDbhulC.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/compiler-runtime-CYIjoINj.js">
|
package/package.json
CHANGED
|
@@ -45,8 +45,7 @@ export function flattenActions(
|
|
|
45
45
|
prevLabel = "",
|
|
46
46
|
): ActionButton[] {
|
|
47
47
|
return actions.flatMap((action) => {
|
|
48
|
-
|
|
49
|
-
if (!action.label) {
|
|
48
|
+
if (!action.label || action.hidden) {
|
|
50
49
|
return [];
|
|
51
50
|
}
|
|
52
51
|
if (isParentAction(action)) {
|
|
@@ -31,7 +31,9 @@ import {
|
|
|
31
31
|
exportOptionsAtom,
|
|
32
32
|
lastExportFormatAtom,
|
|
33
33
|
} from "../../actions/export-dialog/state";
|
|
34
|
+
import CommandPalette from "../command-palette";
|
|
34
35
|
import { NotebookMenuDropdown } from "../notebook-menu-dropdown";
|
|
36
|
+
import { commandPaletteAtom } from "../state";
|
|
35
37
|
|
|
36
38
|
const POSTGRES_SOURCE: DetectedDataSource = {
|
|
37
39
|
id: "postgres-libpq-environment",
|
|
@@ -66,6 +68,10 @@ vi.mock("@/core/wasm/utils", async (importOriginal) => {
|
|
|
66
68
|
return { ...actual, isWasm: vi.fn(() => false) };
|
|
67
69
|
});
|
|
68
70
|
|
|
71
|
+
global.HTMLElement.prototype.scrollIntoView = () => {
|
|
72
|
+
// jsdom does not implement scrollIntoView; cmdk calls it on selection.
|
|
73
|
+
};
|
|
74
|
+
|
|
69
75
|
function wrapper({ children }: { children: React.ReactNode }) {
|
|
70
76
|
return (
|
|
71
77
|
<Provider store={store}>
|
|
@@ -83,14 +89,19 @@ function openNotebookMenu() {
|
|
|
83
89
|
});
|
|
84
90
|
}
|
|
85
91
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
function renderNotebookControls() {
|
|
93
|
+
return render(
|
|
94
|
+
<>
|
|
95
|
+
<NotebookMenuDropdown />
|
|
96
|
+
<CommandPalette />
|
|
97
|
+
</>,
|
|
98
|
+
{ wrapper },
|
|
99
|
+
);
|
|
89
100
|
}
|
|
90
101
|
|
|
91
|
-
async function
|
|
92
|
-
|
|
93
|
-
fireEvent.click(await screen.
|
|
102
|
+
async function selectDownloadCommand(name: string) {
|
|
103
|
+
act(() => store.set(commandPaletteAtom, true));
|
|
104
|
+
fireEvent.click(await screen.findByText(`Download > ${name}`));
|
|
94
105
|
}
|
|
95
106
|
|
|
96
107
|
describe("NotebookMenuDropdown", () => {
|
|
@@ -108,6 +119,7 @@ describe("NotebookMenuDropdown", () => {
|
|
|
108
119
|
});
|
|
109
120
|
store.set(exportOptionsAtom, DEFAULT_EXPORT_OPTIONS);
|
|
110
121
|
store.set(lastExportFormatAtom, "html");
|
|
122
|
+
store.set(commandPaletteAtom, false);
|
|
111
123
|
vi.mocked(isWasm).mockReturnValue(false);
|
|
112
124
|
vi.stubGlobal("PointerEvent", MouseEvent);
|
|
113
125
|
vi.stubGlobal("matchMedia", () => ({
|
|
@@ -203,10 +215,22 @@ describe("NotebookMenuDropdown", () => {
|
|
|
203
215
|
await waitFor(() => expect(menuButton).toHaveFocus());
|
|
204
216
|
});
|
|
205
217
|
|
|
218
|
+
it("hides the download menu but keeps its command palette actions", async () => {
|
|
219
|
+
renderNotebookControls();
|
|
220
|
+
|
|
221
|
+
openNotebookMenu();
|
|
222
|
+
expect(
|
|
223
|
+
screen.queryByRole("menuitem", { name: "Download" }),
|
|
224
|
+
).not.toBeInTheDocument();
|
|
225
|
+
|
|
226
|
+
act(() => store.set(commandPaletteAtom, true));
|
|
227
|
+
expect(await screen.findByText("Download > Download as PNG")).toBeVisible();
|
|
228
|
+
});
|
|
229
|
+
|
|
206
230
|
it("opens the HTML shortcut with code excluded", async () => {
|
|
207
|
-
|
|
231
|
+
renderNotebookControls();
|
|
208
232
|
|
|
209
|
-
await
|
|
233
|
+
await selectDownloadCommand("Download as HTML (exclude code)");
|
|
210
234
|
|
|
211
235
|
expect(await screen.findByTestId("export-dialog")).toBeVisible();
|
|
212
236
|
expect(screen.getByTestId("export-format-html")).toHaveAttribute(
|
|
@@ -223,19 +247,9 @@ describe("NotebookMenuDropdown", () => {
|
|
|
223
247
|
selectedLayout: "slides",
|
|
224
248
|
layoutData: {},
|
|
225
249
|
});
|
|
226
|
-
|
|
250
|
+
renderNotebookControls();
|
|
227
251
|
|
|
228
|
-
await
|
|
229
|
-
fireEvent.click(
|
|
230
|
-
await screen.findByRole("menuitem", {
|
|
231
|
-
name: "Download as PDF",
|
|
232
|
-
}),
|
|
233
|
-
);
|
|
234
|
-
fireEvent.click(
|
|
235
|
-
await screen.findByRole("menuitem", {
|
|
236
|
-
name: /Slides Layout/,
|
|
237
|
-
}),
|
|
238
|
-
);
|
|
252
|
+
await selectDownloadCommand("Download as PDF > Slides Layout");
|
|
239
253
|
|
|
240
254
|
expect(await screen.findByTestId("export-dialog")).toBeVisible();
|
|
241
255
|
expect(screen.getByTestId("export-format-pdf")).toHaveAttribute(
|
|
@@ -251,27 +265,22 @@ describe("NotebookMenuDropdown", () => {
|
|
|
251
265
|
selectedLayout: "slides",
|
|
252
266
|
layoutData: {},
|
|
253
267
|
});
|
|
254
|
-
|
|
268
|
+
renderNotebookControls();
|
|
255
269
|
|
|
256
|
-
|
|
257
|
-
fireEvent.click(
|
|
258
|
-
await screen.findByRole("menuitem", {
|
|
259
|
-
name: "Download as PDF",
|
|
260
|
-
}),
|
|
261
|
-
);
|
|
270
|
+
act(() => store.set(commandPaletteAtom, true));
|
|
262
271
|
|
|
263
272
|
expect(
|
|
264
|
-
screen.
|
|
273
|
+
await screen.findByText("Download > Download as PDF > Document Layout"),
|
|
265
274
|
).toBeVisible();
|
|
266
275
|
expect(
|
|
267
|
-
screen.
|
|
276
|
+
screen.queryByText("Download > Download as PDF > Slides Layout"),
|
|
268
277
|
).not.toBeInTheDocument();
|
|
269
278
|
});
|
|
270
279
|
|
|
271
280
|
it("preselects each Python format from its download shortcut", async () => {
|
|
272
|
-
|
|
281
|
+
renderNotebookControls();
|
|
273
282
|
|
|
274
|
-
await
|
|
283
|
+
await selectDownloadCommand("Download notebook source");
|
|
275
284
|
|
|
276
285
|
expect(await screen.findByTestId("export-dialog")).toBeVisible();
|
|
277
286
|
expect(screen.getByTestId("export-format-script")).toHaveAttribute(
|
|
@@ -287,7 +296,7 @@ describe("NotebookMenuDropdown", () => {
|
|
|
287
296
|
expect(screen.queryByTestId("export-dialog")).not.toBeInTheDocument(),
|
|
288
297
|
);
|
|
289
298
|
|
|
290
|
-
await
|
|
299
|
+
await selectDownloadCommand("Download flat script");
|
|
291
300
|
|
|
292
301
|
expect(await screen.findByTestId("export-dialog")).toBeVisible();
|
|
293
302
|
expect(screen.getByRole("radio", { name: "Flat script" })).toBeChecked();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,l as t}from"./useEvent-xfs0Sn4r.js";import{Cn as n,Sn as r,_n as i,bn as a,vn as o,wn as s,xn as c,yn as l,zt as u}from"./cells-B1S_6FG3.js";import{t as d}from"./compiler-runtime-CYIjoINj.js";import{E as f,T as p}from"./ai-model-dropdown-DjQy2bo-.js";import{m,t as h,u as g}from"./useEventListener-D27Dii_l.js";import{t as _}from"./objects-snlMn4yk.js";import{C as v,S as y,g as b}from"./utils-R_pHe-RB.js";import{t as x}from"./jsx-runtime-B74pBk57.js";import{r as S}from"./requests-C6_IaFh7.js";import{t as C}from"./useCellActionButton-DXyUqFdJ.js";import{a as w,c as T,t as E}from"./useNotebookActions-ClT4GmnB.js";import{t as D}from"./renderShortcut-D9XYVNe3.js";var O=d(),k=3;function A(){let e=(0,O.c)(7),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=T(`marimo:commands`,t),i;e[1]!==n||e[2]!==r?(i=e=>{let t=j([e,...n]);r(t.slice(0,k))},e[1]=n,e[2]=r,e[3]=i):i=e[3];let a;return e[4]!==n||e[5]!==i?(a={recentCommands:n,addRecentCommand:i},e[4]=n,e[5]=i,e[6]=a):a=e[6],a}function j(e){return[...new Set(e)]}function M(e){return e.dropdown!==void 0}function N(e,t=``){return e.flatMap(e=>e.label?M(e)?N(e.dropdown,`${t+e.label} > `):{...e,label:t+e.label,additionalKeywords:e.additionalKeywords}:[])}function P(){let e=(0,O.c)(87),[t,n]=v(),[r,i]=y(),{saveAppConfig:a,saveUserConfig:o}=S(),s;e[0]!==o||e[1]!==n?(s=async e=>{await o({config:e}).then(()=>{n(t=>({...t,...e}))})},e[0]=o,e[1]=n,e[2]=s):s=e[2];let c=s,l;e[3]!==a||e[4]!==i?(l=async e=>{await a({config:e}).then(()=>{i(e)})},e[3]=a,e[4]=i,e[5]=l):l=e[5];let u=l,d;if(e[6]!==r||e[7]!==t.completion||e[8]!==t.display||e[9]!==t.keymap||e[10]!==u||e[11]!==c){let n;e[13]===r?n=e[14]:(n=e=>e!==r.width,e[13]=r,e[14]=n);let i;e[15]!==r||e[16]!==u?(i=e=>({label:`App config > Set width=${e}`,handle:()=>{u({...r,width:e})}}),e[15]=r,e[16]=u,e[17]=i):i=e[17];let a;e[18]!==t.display||e[19]!==c?(a={label:`Config > Set theme: dark`,handle:()=>{c({display:{...t.display,theme:`dark`}})}},e[18]=t.display,e[19]=c,e[20]=a):a=e[20];let o;e[21]!==t.display||e[22]!==c?(o={label:`Config > Set theme: light`,handle:()=>{c({display:{...t.display,theme:`light`}})}},e[21]=t.display,e[22]=c,e[23]=o):o=e[23];let s;e[24]!==t.display||e[25]!==c?(s={label:`Config > Set theme: system`,handle:()=>{c({display:{...t.display,theme:`system`}})}},e[24]=t.display,e[25]=c,e[26]=s):s=e[26];let l=t.keymap.preset===`vim`,p;e[27]!==t.keymap||e[28]!==c?(p=()=>{c({keymap:{...t.keymap,preset:`vim`}})},e[27]=t.keymap,e[28]=c,e[29]=p):p=e[29];let m;e[30]!==l||e[31]!==p?(m={label:`Config > Switch keymap to VIM`,hidden:l,handle:p},e[30]=l,e[31]=p,e[32]=m):m=e[32];let h=t.keymap.preset==="default",g;e[33]!==t.keymap||e[34]!==c?(g=()=>{c({keymap:{...t.keymap,preset:`default`}})},e[33]=t.keymap,e[34]=c,e[35]=g):g=e[35];let _;e[36]!==h||e[37]!==g?(_={label:`Config > Switch keymap to default (current: VIM)`,hidden:h,handle:g},e[36]=h,e[37]=g,e[38]=_):_=e[38];let v;e[39]!==t.completion||e[40]!==c?(v=()=>{c({completion:{...t.completion,copilot:!1}})},e[39]=t.completion,e[40]=c,e[41]=v):v=e[41];let y=t.completion.copilot!==`github`,b;e[42]!==v||e[43]!==y?(b={label:`Config > Disable GitHub Copilot`,handle:v,hidden:y},e[42]=v,e[43]=y,e[44]=b):b=e[44];let x;e[45]!==t.completion||e[46]!==c?(x=()=>{c({completion:{...t.completion,copilot:`github`}})},e[45]=t.completion,e[46]=c,e[47]=x):x=e[47];let S=t.completion.copilot===`github`,C;e[48]!==x||e[49]!==S?(C={label:`Config > Enable GitHub Copilot`,handle:x,hidden:S},e[48]=x,e[49]=S,e[50]=C):C=e[50];let w=!t.display.reference_highlighting,T;e[51]!==t.display||e[52]!==c?(T=()=>{c({display:{...t.display,reference_highlighting:!1}})},e[51]=t.display,e[52]=c,e[53]=T):T=e[53];let E;e[54]!==w||e[55]!==T?(E={label:`Config > Disable reference highlighting`,hidden:w,handle:T},e[54]=w,e[55]=T,e[56]=E):E=e[56];let D;e[57]!==t.display||e[58]!==c?(D=()=>{c({display:{...t.display,reference_highlighting:!0}})},e[57]=t.display,e[58]=c,e[59]=D):D=e[59];let O;e[60]!==t.display.reference_highlighting||e[61]!==D?(O={label:`Config > Enable reference highlighting`,hidden:t.display.reference_highlighting,handle:D},e[60]=t.display.reference_highlighting,e[61]=D,e[62]=O):O=e[62];let k=!(t.display.code_lens??!0),A;e[63]!==t.display||e[64]!==c?(A=()=>{c({display:{...t.display,code_lens:!1}})},e[63]=t.display,e[64]=c,e[65]=A):A=e[65];let j;e[66]!==k||e[67]!==A?(j={label:`Config > Disable code lens`,hidden:k,handle:A},e[66]=k,e[67]=A,e[68]=j):j=e[68];let M=t.display.code_lens??!0,N;e[69]!==t.display||e[70]!==c?(N=()=>{c({display:{...t.display,code_lens:!0}})},e[69]=t.display,e[70]=c,e[71]=N):N=e[71];let P;e[72]!==M||e[73]!==N?(P={label:`Config > Enable code lens`,hidden:M,handle:N},e[72]=M,e[73]=N,e[74]=P):P=e[74];let I=t.display.cell_output===`above`,L;e[75]!==t.display||e[76]!==c?(L=()=>{c({display:{...t.display,cell_output:`above`}})},e[75]=t.display,e[76]=c,e[77]=L):L=e[77];let R;e[78]!==I||e[79]!==L?(R={label:`Config > Set cell output area: above`,hidden:I,handle:L},e[78]=I,e[79]=L,e[80]=R):R=e[80];let z=t.display.cell_output===`below`,B;e[81]!==t.display||e[82]!==c?(B=()=>{c({display:{...t.display,cell_output:`below`}})},e[81]=t.display,e[82]=c,e[83]=B):B=e[83];let V;e[84]!==z||e[85]!==B?(V={label:`Config > Set cell output area: below`,hidden:z,handle:B},e[84]=z,e[85]=B,e[86]=V):V=e[86],d=[...f().filter(n).map(i),a,o,s,m,_,b,C,E,O,j,P,R,V].filter(F),e[6]=r,e[7]=t.completion,e[8]=t.display,e[9]=t.keymap,e[10]=u,e[11]=c,e[12]=d}else d=e[12];return d}function F(e){return!e.hidden}var I=x(),L=()=>{let d=(0,O.c)(37),[f,v]=e(w),y=p(),x=t(u),S=t(b),T;d[0]===x?T=d[1]:(T={cell:x},d[0]=x,d[1]=T);let k=C(T).flat();k=N(k);let j=P(),F=E();F=[...N(F),...N(j)];let L=F.filter(R),V=_.keyBy(L,z),{recentCommands:H,addRecentCommand:U}=A(),W;d[2]===H?W=d[3]:(W=new Set(H),d[2]=H,d[3]=W);let G=W,K;d[4]!==S||d[5]!==v?(K=e=>{m(S.getHotkey(`global.commandPalette`).key)(e)&&(e.preventDefault(),v(B))},d[4]=S,d[5]=v,d[6]=K):K=d[6],h(document,`keydown`,K);let q;d[7]!==U||d[8]!==S||d[9]!==y||d[10]!==v?(q=(e,t)=>{let n=y[e];if(!n)return null;let r=S.getHotkey(e);return(0,I.jsxs)(c,{disabled:t.disabled,keywords:r.additionalKeywords,onSelect:()=>{U(e),v(!1),requestAnimationFrame(()=>{n()})},value:r.name,children:[(0,I.jsxs)(`span`,{children:[r.name,t.tooltip&&(0,I.jsx)(`span`,{className:`ml-2`,children:t.tooltip})]}),(0,I.jsx)(s,{children:(0,I.jsx)(D,{shortcut:r.key})})]},e)},d[7]=U,d[8]=S,d[9]=y,d[10]=v,d[11]=q):q=d[11];let ee=q,J;d[12]!==U||d[13]!==S||d[14]!==v?(J=e=>{let{label:t,handle:n,props:r,hotkey:i,additionalKeywords:a}=e,o=r===void 0?{}:r;return(0,I.jsxs)(c,{disabled:o.disabled,keywords:a,onSelect:()=>{U(t),v(!1),requestAnimationFrame(()=>{n()})},value:t,children:[(0,I.jsxs)(`span`,{children:[t,o.tooltip&&(0,I.jsxs)(`span`,{className:`ml-2`,children:[`(`,o.tooltip,`)`]})]}),i&&(0,I.jsx)(s,{children:(0,I.jsx)(D,{shortcut:S.getHotkey(i).key})})]},t)},d[12]=U,d[13]=S,d[14]=v,d[15]=J):J=d[15];let Y=J,te=i,X;d[16]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,I.jsx)(a,{placeholder:`Type to search...`}),d[16]=X):X=d[16];let ne=r,Z;d[17]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,I.jsx)(o,{children:`No results found.`}),d[17]=Z):Z=d[17];let re=H.length>0&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(l,{heading:`Recently Used`,children:H.map(e=>{let t=V[e];return g(e)?ee(e,{disabled:t?.disabled,tooltip:t?.tooltip}):t&&!M(t)?Y({label:t.label,handle:t.handleHeadless||t.handle,props:{disabled:t.disabled,tooltip:t.tooltip},additionalKeywords:t.additionalKeywords}):null})}),(0,I.jsx)(n,{})]}),ie=l,ae=S.iterate().map(e=>{if(G.has(e))return null;let t=V[e];return ee(e,{disabled:t?.disabled,tooltip:t?.tooltip})}),oe=L.map(e=>G.has(e.label)?null:Y({label:e.label,handle:e.handleHeadless||e.handle,props:{disabled:e.disabled,tooltip:e.tooltip},additionalKeywords:e.additionalKeywords})),se;d[18]!==G||d[19]!==Y?(se=e=>G.has(e.label)?null:Y({label:`Cell > ${e.label}`,handle:e.handleHeadless||e.handle,props:{disabled:e.disabled,tooltip:e.tooltip},additionalKeywords:e.additionalKeywords}),d[18]=G,d[19]=Y,d[20]=se):se=d[20];let ce=k.map(se),Q;d[21]!==ie||d[22]!==oe||d[23]!==ce||d[24]!==ae?(Q=(0,I.jsxs)(ie,{heading:`Commands`,children:[ae,oe,ce]}),d[21]=ie,d[22]=oe,d[23]=ce,d[24]=ae,d[25]=Q):Q=d[25];let $;d[26]!==ne||d[27]!==Q||d[28]!==Z||d[29]!==re?($=(0,I.jsxs)(ne,{children:[Z,re,Q]}),d[26]=ne,d[27]=Q,d[28]=Z,d[29]=re,d[30]=$):$=d[30];let le;return d[31]!==te||d[32]!==f||d[33]!==v||d[34]!==$||d[35]!==X?(le=(0,I.jsxs)(te,{open:f,onOpenChange:v,children:[X,$]}),d[31]=te,d[32]=f,d[33]=v,d[34]=$,d[35]=X,d[36]=le):le=d[36],le};function R(e){return!e.hotkey}function z(e){return e.label}function B(e){return!e}export{L as default};
|