@marimo-team/frontend 0.20.3-dev96 → 0.20.3-dev98

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.
Files changed (68) hide show
  1. package/dist/assets/{CellStatus-CofFdpAe.js → CellStatus-BNvq_G7v.js} +1 -1
  2. package/dist/assets/{JsonOutput-DKjq8WkX.js → JsonOutput-COYZxr-s.js} +4 -4
  3. package/dist/assets/{MarimoErrorOutput-DDEWmSYt.js → MarimoErrorOutput-CkWg573B.js} +1 -1
  4. package/dist/assets/{RenderHTML-BKdgJWBR.js → RenderHTML-D0riQ7d5.js} +1 -1
  5. package/dist/assets/{add-cell-with-ai--93MrwWW.js → add-cell-with-ai-D7RcfIFT.js} +7 -7
  6. package/dist/assets/{add-connection-dialog-DwmwDRdR.js → add-connection-dialog-a1w-tlmr.js} +1 -1
  7. package/dist/assets/agent-panel-CFECcwTK.js +287 -0
  8. package/dist/assets/{ai-model-dropdown-DQy6lXPg.js → ai-model-dropdown-CS9BLOLl.js} +3 -3
  9. package/dist/assets/{app-config-button-C_j4LbLr.js → app-config-button-Cp9XkpLD.js} +1 -1
  10. package/dist/assets/{azure-BOn6W9-m.js → azure-D5yXrO2H.js} +1 -1
  11. package/dist/assets/{cell-editor-B9yTITVj.js → cell-editor-DRiVkblX.js} +9 -9
  12. package/dist/assets/{cell-link-CZP6Kzmf.js → cell-link-B5vG68jv.js} +1 -1
  13. package/dist/assets/{cells-CigkzIKH.js → cells-BusUaZSh.js} +39 -39
  14. package/dist/assets/{chat-display-C1J9G6Cr.js → chat-display-BrI8TsyH.js} +1 -1
  15. package/dist/assets/{chat-panel-CFDW5ZSi.js → chat-panel-BvHZJKww.js} +1 -1
  16. package/dist/assets/{column-preview-BHAQ5EN7.js → column-preview-CMuWC26D.js} +1 -1
  17. package/dist/assets/{command-C8WcXqB5.js → command-B5q5uni4.js} +1 -1
  18. package/dist/assets/{command-palette-DzEDXP8h.js → command-palette-DH_Lzfkd.js} +1 -1
  19. package/dist/assets/{common-BsEiWPTg.js → common-DQqSG88k.js} +1 -1
  20. package/dist/assets/{components-Bis36Fco.js → components-Cx6Hou1_.js} +1 -1
  21. package/dist/assets/{components-C_r2KU__.js → components-DlLxmdlj.js} +1 -1
  22. package/dist/assets/{context-aware-panel-CdVqO_AM.js → context-aware-panel-BGlzp-FM.js} +2 -2
  23. package/dist/assets/{datasource-B3MFUEL6.js → datasource-DpXRY8fO.js} +2 -2
  24. package/dist/assets/{dependency-graph-panel-D4bT9In2.js → dependency-graph-panel-RR4NgUZ9.js} +1 -1
  25. package/dist/assets/{documentation-panel-BMnKc5yI.js → documentation-panel-Cnv1jm5X.js} +1 -1
  26. package/dist/assets/{download-C35SWaj3.js → download-BUXzyjEd.js} +4 -4
  27. package/dist/assets/{edit-page-BeR5IEJ-.js → edit-page-D9uU9771.js} +7 -7
  28. package/dist/assets/{error-panel-jpJowHuz.js → error-panel-CVb1eCf6.js} +1 -1
  29. package/dist/assets/{file-explorer-panel-BHVDv16o.js → file-explorer-panel-UXRdRpc0.js} +1 -1
  30. package/dist/assets/{floating-outline-BxQvjarL.js → floating-outline-CmXM2v38.js} +1 -1
  31. package/dist/assets/{focus-Bci_MkMH.js → focus-ByrD76nS.js} +1 -1
  32. package/dist/assets/{form-DmsYuKMH.js → form-DOjZnkdK.js} +1 -1
  33. package/dist/assets/{globals-BIlQtd9Z.js → globals-B_lwS1Rg.js} +1 -1
  34. package/dist/assets/{home-page-Dw1bl_Le.js → home-page-DkSd1V6c.js} +2 -2
  35. package/dist/assets/{html-to-image-DkwDXZ7Q.js → html-to-image-DjFNZcCI.js} +1 -1
  36. package/dist/assets/{index-D0SHqLyU.js → index-CXRGI-CB.js} +10 -10
  37. package/dist/assets/{kiosk-mode-BXfU4SPi.js → kiosk-mode-CTnBBAQi.js} +1 -1
  38. package/dist/assets/{layout-Cn07VnUl.js → layout-CMmACzb7.js} +3 -3
  39. package/dist/assets/{logs-panel-CNI5XQZv.js → logs-panel-H4W0OnaU.js} +1 -1
  40. package/dist/assets/{markdown-renderer-DHgbXKHX.js → markdown-renderer-B4k8WEFz.js} +1 -1
  41. package/dist/assets/{name-cell-input-BVNjrC55.js → name-cell-input-BUcQnShp.js} +1 -1
  42. package/dist/assets/{outline-panel-DDzSswIl.js → outline-panel-By3ZqBZ9.js} +1 -1
  43. package/dist/assets/{packages-panel-oV7XPDLu.js → packages-panel-Cu_ODGWE.js} +1 -1
  44. package/dist/assets/{panels-OYOPaJTw.js → panels-o_H3ZmT-.js} +1 -1
  45. package/dist/assets/{process-output-B27UYd5L.js → process-output-C6uLELXv.js} +1 -1
  46. package/dist/assets/{readonly-python-code-CyraFlMm.js → readonly-python-code-vSIWAIcL.js} +1 -1
  47. package/dist/assets/{run-page-DDaD2g7X.js → run-page-DhyDG7Rk.js} +1 -1
  48. package/dist/assets/{scratchpad-panel-Bj7X2Na5.js → scratchpad-panel-4t4-HW40.js} +1 -1
  49. package/dist/assets/{session-panel-BCymMoxC.js → session-panel-DIXH9TH9.js} +1 -1
  50. package/dist/assets/{snippets-panel-CSczB-sT.js → snippets-panel-CODg30J-.js} +1 -1
  51. package/dist/assets/{state-LFRjhpk7.js → state-BqcLH_kp.js} +1 -1
  52. package/dist/assets/{switch-Cp5eQmZx.js → switch-E6p3DgBh.js} +1 -1
  53. package/dist/assets/{tracing-DVa-Q9aK.js → tracing-Dl2nQ80-.js} +1 -1
  54. package/dist/assets/{tracing-panel-DFqVXy46.js → tracing-panel-DhGOBk1Q.js} +2 -2
  55. package/dist/assets/{types-B737EDbu.js → types-Cg2HXEUi.js} +1 -1
  56. package/dist/assets/{useAddCell-CZ1y3fpl.js → useAddCell-CsMGD6qQ.js} +1 -1
  57. package/dist/assets/{useCellActionButton-CGxzkJch.js → useCellActionButton-pIt4Gh5R.js} +1 -1
  58. package/dist/assets/{useDeleteCell-Dok0-XOi.js → useDeleteCell-DFKNGNeg.js} +1 -1
  59. package/dist/assets/{useDependencyPanelTab-CYOtvc7A.js → useDependencyPanelTab-vEb9Zdsr.js} +1 -1
  60. package/dist/assets/{useNotebookActions-C8fdJ-I2.js → useNotebookActions-B9ocYS2_.js} +1 -1
  61. package/dist/assets/{useSplitCell-CEPcLfYT.js → useSplitCell-B4bOrJRI.js} +1 -1
  62. package/dist/index.html +29 -29
  63. package/package.json +1 -1
  64. package/src/components/chat/acp/agent-panel.tsx +29 -8
  65. package/src/core/saving/file-state.ts +7 -0
  66. package/src/mount.tsx +6 -1
  67. package/src/plugins/layout/TexPlugin.tsx +4 -1
  68. package/dist/assets/agent-panel-C8ZeX_CD.js +0 -287
@@ -1 +1 @@
1
- import{s as pe}from"./chunk-LvLJmgfZ.js";import{d as I,l as Ue,p as Ye,u as ae}from"./useEvent-WUlsM6MC.js";import{t as $e}from"./react-Bj1aDYRI.js";import{Cn as Ke,En as me,Gt as Je,Nr as Xe,Sn as Ze,T as ue,_ as Qe,_i as oe,ar as et,cr as tt,dt as fe,h as ye,lt as at,pr as ot,pt as nt,rr as it,t as lt,ut as st,xn as rt}from"./cells-CigkzIKH.js";import{t as W}from"./compiler-runtime-B3qBwwSJ.js";import{n as dt}from"./assertNever-Dw9aFN4h.js";import{s as be}from"./useLifecycle-BDXC6oVR.js";import{a as ct,n as xe}from"./add-connection-dialog-DwmwDRdR.js";import{n as ht,x as pt}from"./ai-model-dropdown-DQy6lXPg.js";import{c as ke,m as T}from"./useEventListener-CjXriKgk.js";import{y as mt}from"./utils-CORJ8yYa.js";import{n as _,t as we}from"./constants-CdR60lKM.js";import{S as ge,h as ut,x as ft}from"./config-D9X9QKiL.js";import{t as yt}from"./jsx-runtime-CP2fAiZX.js";import{r as bt,t as ne}from"./button-BmOH9agK.js";import{r as L}from"./requests-DZy_SQ_v.js";import{t as h}from"./createLucideIcon-BvP5LBIs.js";import{a as je,f as xt,i as ve,m as kt,p as Ce,u as ze}from"./layout-Cn07VnUl.js";import{t as Me}from"./check-BnZGcuDh.js";import{c as wt,d as We,n as gt,o as jt,r as _e,t as vt}from"./download-C35SWaj3.js";import{f as Ct}from"./maps-8VTEe-0T.js";import{r as zt}from"./useCellActionButton-CGxzkJch.js";import{t as Mt}from"./copy-CAR4dOiD.js";import{t as Wt}from"./download-BG-iMGgV.js";import{t as _t}from"./eye-off-DgTL09j7.js";import{t as St}from"./file-plus-corner-BRwJx0yp.js";import{t as ie}from"./file-DVwc11C3.js";import{t as At}from"./github-BrsjF9dp.js";import{m as Dt}from"./form-DmsYuKMH.js";import{n as Nt,r as Pt,t as Et}from"./youtube-fKFch587.js";import{n as It,t as Tt}from"./square-oV8Csj8Y.js";import{i as Lt}from"./html-to-image-DkwDXZ7Q.js";import{t as Ht}from"./link-Cpo6yhBB.js";import{r as qt}from"./input-BPldEXfy.js";import{t as Rt}from"./settings-DD8FJvQ_.js";import{x as Ft}from"./azure-BOn6W9-m.js";import{t as C}from"./use-toast-BhMe50aT.js";import{n as Se,t as Vt}from"./paths-bMgYkaP2.js";import{o as Ot}from"./session-DnMOyddG.js";import{a as Bt,c as Gt,i as Ut,n as Yt,r as $t,s as Kt,t as Jt}from"./select-DygbgNTD.js";import{t as Xt}from"./tooltip-DOQlecCr.js";import{o as Zt}from"./alert-dialog-DsNfSYaw.js";import{a as Qt,c as ea,i as ta,n as aa,r as oa}from"./dialog-BXzvlof-.js";import{n as le}from"./ImperativeModal-CRNJOvqT.js";import{r as na,t as ia}from"./share-sD4fbzpH.js";import{t as K}from"./copy-DMCkK2TI.js";import{a as la}from"./cell-link-CZP6Kzmf.js";import{a as Ae}from"./renderShortcut-BJEd-iA7.js";import{t as sa}from"./icons-B9sHgc9n.js";import{t as ra}from"./links-syPBpTLO.js";import{t as De}from"./types-D4wsSrXa.js";var da=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),ca=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Ne=h("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),Pe=h("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),Ee=h("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),ha=h("fast-forward",[["path",{d:"M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z",key:"b19h5q"}],["path",{d:"M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z",key:"h7h5ge"}]]),pa=h("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]),ma=h("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),Ie=h("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),ua=h("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),fa=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Te=h("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),ya=h("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),ba=h("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Le=h("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),He=W(),se=pe($e(),1),a=pe(yt(),1),J="https://static.marimo.app";const xa=e=>{let t=(0,He.c)(25),{onClose:n}=e,[o,l]=(0,se.useState)(""),{exportAsHTML:r}=L(),s=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${J}/static/${s}`,d;t[0]!==r||t[1]!==n||t[2]!==s?(d=async v=>{v.preventDefault(),n();let A=await r({download:!1,includeCode:!0,files:xt.INSTANCE.filenames()}),z=C({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${J}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:A,path:s})}).catch(()=>{z.dismiss(),C({title:"Error uploading static page",description:(0,a.jsxs)("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",(0,a.jsx)("a",{href:_.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),z.dismiss(),C({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},t[0]=r,t[1]=n,t[2]=s,t[3]=d):d=t[3];let p;t[4]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(ea,{children:"Share static notebook"}),t[4]=p):p=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(Qt,{children:[p,(0,a.jsxs)(oa,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",(0,a.jsx)("a",{href:J,target:"_blank",children:J}),"."]})]}),t[5]=w):w=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{l(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let u;t[7]===o?u=t[8]:(u=(0,a.jsx)(qt,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=u);let f;t[9]===i?f=t[10]:(f=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(ka,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),t[9]=i,t[10]=f);let y;t[11]!==u||t[12]!==f?(y=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[u,f]}),t[11]=u,t[12]=f,t[13]=y):y=t[13];let b;t[14]===n?b=t[15]:(b=(0,a.jsx)(ne,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=b);let x;t[16]===i?x=t[17]:(x=(0,a.jsx)(ne,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await K(i)},children:"Create"}),t[16]=i,t[17]=x);let k;t[18]!==b||t[19]!==x?(k=(0,a.jsxs)(ta,{children:[b,x]}),t[18]=b,t[19]=x,t[20]=k):k=t[20];let j;return t[21]!==d||t[22]!==k||t[23]!==y?(j=(0,a.jsx)(aa,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[w,y,k]})}),t[21]=d,t[22]=k,t[23]=y,t[24]=j):j=t[24],j};var ka=e=>{let t=(0,He.c)(8),[n,o]=se.useState(!1),l;t[0]===e.text?l=t[1]:(l=bt.stopPropagation(async p=>{p.preventDefault(),await K(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=l);let r=l,s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Mt,{size:14,strokeWidth:1.5}),t[2]=s):s=t[2];let i;t[3]===r?i=t[4]:(i=(0,a.jsx)(ne,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:s}),t[3]=r,t[4]=i);let d;return t[5]!==n||t[6]!==i?(d=(0,a.jsx)(Xt,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=d):d=t[7],d},wa=W();function ga(){let e=document.getElementsByClassName(we.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=oe.findElement(t);if(!o){T.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:oe.parse(o.id)}}}return T.warn("No visible output area found for scroll anchor"),null}function ja(e){if(!e){T.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(oe.create(e.cellId));if(!t){T.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${we.outputArea}`)){T.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function qe(){let e=(0,wa.c)(2),t=I(fe),n;return e[0]===t?n=e[1]:(n=()=>{let o=ga();t(l=>({mode:st(l.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{ja(o)})})},e[0]=t,e[1]=n),n}const Re=Ye(!1);var va=W();const Ca=()=>{let e=(0,va.c)(7),{selectedLayout:t}=je(),{setLayoutView:n}=ve();if(ge()&&!me("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=i=>n(i),e[0]=n,e[1]=o);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(Kt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Gt,{placeholder:"Select a view"})}),e[2]=l):l=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Yt,{children:(0,a.jsxs)($t,{children:[(0,a.jsx)(Bt,{children:"View as"}),De.map(Ma)]})}),e[3]=r):r=e[3];let s;return e[4]!==t||e[5]!==o?(s=(0,a.jsxs)(Jt,{"data-testid":"layout-select",value:t,onValueChange:o,children:[l,r]}),e[4]=t,e[5]=o,e[6]=s):s=e[6],s};function za(e){return(0,a.jsx)(Fe(e),{className:"h-4 w-4"})}function Fe(e){switch(e){case"vertical":return ua;case"grid":return Pt;case"slides":return Te;default:return dt(e),Tt}}function Ve(e){return be(e)}function Ma(e){return(0,a.jsx)(Ut,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[za(e),(0,a.jsx)("span",{children:Ve(e)})]})},e)}async function Wa(e){let{filename:t,preset:n,downloadPDF:o}=e;await o({filename:t,webpdf:!0,preset:n,includeInputs:!1,rasterServer:"live"})}var _a=W();function Sa(e){let t=(0,_a.c)(5),{openPrompt:n,closeModal:o}=le(),{sendCopy:l}=L(),r;return t[0]!==o||t[1]!==n||t[2]!==l||t[3]!==e?(r=()=>{if(!e)return null;let s=Vt.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Se.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=s.join(Se.dirname(e),i);l({source:e,destination:d}).then(()=>{o(),C({title:"Notebook copied",description:"A copy of the notebook has been created."}),ra(d)})}})},t[0]=o,t[1]=n,t[2]=l,t[3]=e,t[4]=r):r=t[4],r}const Aa=()=>{let{updateCellConfig:e}=ue(),{saveCellConfig:t}=L();return(0,se.useCallback)(async()=>{let n=new Je,o=ye(),l=o.cellIds.inOrderIds,r={};for(let i of l){if(o.cellData[i]===void 0)continue;let{code:d,config:p}=o.cellData[i];p.hide_code||n.isSupported(d)&&(r[i]={hide_code:!0})}let s=ke.entries(r);if(s.length!==0){await t({configs:r});for(let[i,d]of s)e({cellId:i,config:d})}},[e])};var Da=W();function Oe(){let e=(0,Da.c)(4),{openConfirm:t}=le(),n=I(ut),{sendRestart:o}=L(),l;return e[0]!==t||e[1]!==o||e[2]!==n?(l=()=>{t({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(Zt,{onClick:async()=>{n({state:ft.CLOSING}),await o(),na()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=l):l=e[3],l}var Na=W(),S=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Pa(){var ce,he;let e=(0,Na.c)(42),t=la(),{openModal:n,closeModal:o}=le(),{toggleApplication:l}=rt(),{selectedPanel:r}=Ze(),[s]=Ue(fe),i=ae(at),d=Aa(),[p]=mt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:u,addSetupCellIfDoesntExist:f,collapseAllCells:y,expandAllCells:b}=ue(),x=Oe(),k=nt(),j=Sa(t),v=I(Re),A=I(ht),z=I(pt),{exportAsMarkdown:X,readCode:D,saveCellConfig:Z}=L(),Q=ae(Qe),ee=ae(lt),{selectedLayout:H}=je(),{setLayoutView:te}=ve(),q=qe(),R=((ce=p.sharing)==null?void 0:ce.html)??!0,F=((he=p.sharing)==null?void 0:he.wasm)??!0,V;e[0]===Symbol.for("react.memo_cache_sentinel")?(V=me("server_side_pdf_export"),e[0]=V):V=e[0];let N=V,P=N||s.mode==="present",O=H==="slides",Be=Xa,de=Ja,B;e[1]===t?B=e[2]:(B=async c=>{let{preset:m,title:E}=c;if(!t){re();return}await wt(E,async()=>{await Wa({filename:t,preset:m,downloadPDF:gt})})},e[1]=t,e[2]=B);let G=B,U;e[3]===Symbol.for("react.memo_cache_sentinel")?(U=(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),e[3]=U):U=e[3];let Y;e[4]===Symbol.for("react.memo_cache_sentinel")?(Y=(0,a.jsx)(Ce,{size:14,strokeWidth:1.5}),e[4]=Y):Y=e[4];let M;e[5]===t?M=e[6]:(M=async()=>{if(!t){re();return}await ze({filename:t,includeCode:!0})},e[5]=t,e[6]=M);let $;return e[7]!==f||e[8]!==ee||e[9]!==u||e[10]!==o||e[11]!==y||e[12]!==j||e[13]!==G||e[14]!==b||e[15]!==X||e[16]!==t||e[17]!==Q||e[18]!==d||e[19]!==O||e[20]!==i||e[21]!==n||e[22]!==P||e[23]!==D||e[24]!==x||e[25]!==k||e[26]!==Z||e[27]!==H||e[28]!==r||e[29]!==v||e[30]!==z||e[31]!==te||e[32]!==A||e[33]!==R||e[34]!==F||e[35]!==M||e[36]!==l||e[37]!==q||e[38]!==g||e[39]!==w||e[40]!==s.mode?($=[{icon:U,label:"Download",handle:S,dropdown:[{icon:Y,label:"Download as HTML",handle:M},{icon:(0,a.jsx)(Ce,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){re();return}await ze({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(sa,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await X({download:!1});_e(new Blob([c],{type:"text/plain"}),We.toMarkdown(document.title))}},{icon:(0,a.jsx)(kt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await D();_e(new Blob([c.contents],{type:"text/plain"}),We.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(Lt,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:s.mode!=="present",tooltip:s.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Ae("global.hideCode",!1)]}),handle:Ka},{divider:!0,icon:(0,a.jsx)(ie,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:S,disabled:!P&&!N,dropdown:[{icon:(0,a.jsx)(ie,{size:14,strokeWidth:1.5}),label:"Document Layout",rightElement:de(!O),disabled:!P,tooltip:P?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Ae("global.hideCode",!1)]}),handle:async()=>{if(N){await G({preset:"document",title:"Downloading Document PDF..."});return}let c=new Event("export-beforeprint"),m=new Event("export-afterprint");(function(){window.dispatchEvent(c),setTimeout($a,0),setTimeout(()=>window.dispatchEvent(m),0)})()}},{icon:(0,a.jsx)(ie,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:de(O),disabled:!N,tooltip:N?void 0:(0,a.jsx)("span",{children:"Requires Better PDF Export in Settings > Experimental."}),handle:async()=>{await G({preset:"slides",title:"Downloading Slides PDF..."})}}]}]},{icon:(0,a.jsx)(ya,{size:14,strokeWidth:1.5}),label:"Share",handle:S,hidden:!R&&!F,dropdown:[{icon:(0,a.jsx)(Dt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!R,handle:async()=>{n((0,a.jsx)(xa,{onClose:o}))}},{icon:(0,a.jsx)(Ht,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!F,handle:async()=>{await K(ia({code:(await D()).contents})),C({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(fa,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:S,dropdown:Ke.flatMap(c=>{let{type:m,Icon:E,hidden:Ge}=c;return Ge?[]:{label:be(m),rightElement:Be(r===m),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),handle:()=>l(m)}})},{icon:(0,a.jsx)(Te,{size:14,strokeWidth:1.5}),label:"Present as",handle:S,dropdown:[{icon:s.mode==="present"?(0,a.jsx)(Ft,{size:14,strokeWidth:1.5}):(0,a.jsx)(Ie,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{q()}},...De.map((c,m)=>{let E=Fe(c);return{divider:m===0,label:Ve(c),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:H===c&&(0,a.jsx)(Me,{size:14})}),handle:()=>{te(c),s.mode==="edit"&&q()}}})]},{icon:(0,a.jsx)(pa,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||ge(),handle:j},{icon:(0,a.jsx)(Ne,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await K((await D()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(zt,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!Q||i,handle:async()=>{let c=Xe(ye());await Z({configs:ke.fromEntries(c.map(Ya))});for(let m of c)w({cellId:m,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Ee,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{f({})}},{icon:(0,a.jsx)(et,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(xe,{onClose:o}))}},{icon:(0,a.jsx)(ct,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(xe,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(Le,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!ee||i,handle:()=>{g()}},{icon:(0,a.jsx)(ba,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:x},{icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{k()}},{icon:(0,a.jsx)(tt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{u()}},{icon:(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(ca,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:y,redundant:!0},{icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:b,redundant:!0},{divider:!0,icon:(0,a.jsx)(Pe,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(Ua)},{icon:(0,a.jsx)(ma,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(Ga)},{icon:(0,a.jsx)(Rt,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>A(Ba),redundant:!0},{icon:(0,a.jsx)(Ct,{size:14,strokeWidth:1.5}),label:"Resources",handle:S,dropdown:[{icon:(0,a.jsx)(ot,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Oa},{icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Va},{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:Fa},{icon:(0,a.jsx)(Et,{size:14,strokeWidth:1.5}),label:"YouTube",handle:Ra},{icon:(0,a.jsx)(it,{size:14,strokeWidth:1.5}),label:"Changelog",handle:qa}]},{divider:!0,icon:(0,a.jsx)(It,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Ha},{icon:(0,a.jsx)(St,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:La}].filter(Ta).map(Ea),e[7]=f,e[8]=ee,e[9]=u,e[10]=o,e[11]=y,e[12]=j,e[13]=G,e[14]=b,e[15]=X,e[16]=t,e[17]=Q,e[18]=d,e[19]=O,e[20]=i,e[21]=n,e[22]=P,e[23]=D,e[24]=x,e[25]=k,e[26]=Z,e[27]=H,e[28]=r,e[29]=v,e[30]=z,e[31]=te,e[32]=A,e[33]=R,e[34]=F,e[35]=M,e[36]=l,e[37]=q,e[38]=g,e[39]=w,e[40]=s.mode,e[41]=$):$=e[41],$}function Ea(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Ia)}:e}function Ia(e){return!e.hidden}function Ta(e){return!e.hidden}function La(){let e=Ot();window.open(e,"_blank")}function Ha(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function qa(){window.open(_.releasesPage,"_blank")}function Ra(){window.open(_.youtube,"_blank")}function Fa(){window.open(_.discordLink,"_blank")}function Va(){window.open(_.githubPage,"_blank")}function Oa(){window.open(_.docsPage,"_blank")}function Ba(e){return!e}function Ga(e){return!e}function Ua(e){return!e}function Ya(e){return[e,{disabled:!1}]}function $a(){return window.print()}async function Ka(){let e=document.getElementById("App");e&&await jt({element:e,filename:document.title,prepare:vt})}function Ja(e){return e?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function Xa(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(Me,{size:14})})}function re(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{qe as a,Ee as c,Re as i,Pe as l,Oe as n,Le as o,Ca as r,Ie as s,Pa as t,Ne as u};
1
+ import{s as pe}from"./chunk-LvLJmgfZ.js";import{d as I,l as Ue,p as Ye,u as ae}from"./useEvent-WUlsM6MC.js";import{t as $e}from"./react-Bj1aDYRI.js";import{Cn as Ke,En as me,Gt as Je,Nr as Xe,Sn as Ze,T as ue,_ as Qe,ar as et,cr as tt,dt as fe,h as ye,lt as at,pr as ot,pt as nt,rr as it,t as lt,ut as st,vi as oe,xn as rt}from"./cells-BusUaZSh.js";import{t as W}from"./compiler-runtime-B3qBwwSJ.js";import{n as dt}from"./assertNever-Dw9aFN4h.js";import{s as be}from"./useLifecycle-BDXC6oVR.js";import{a as ct,n as xe}from"./add-connection-dialog-a1w-tlmr.js";import{n as ht,x as pt}from"./ai-model-dropdown-CS9BLOLl.js";import{c as ke,m as T}from"./useEventListener-CjXriKgk.js";import{y as mt}from"./utils-CORJ8yYa.js";import{n as _,t as we}from"./constants-CdR60lKM.js";import{S as ge,h as ut,x as ft}from"./config-D9X9QKiL.js";import{t as yt}from"./jsx-runtime-CP2fAiZX.js";import{r as bt,t as ne}from"./button-BmOH9agK.js";import{r as L}from"./requests-DZy_SQ_v.js";import{t as h}from"./createLucideIcon-BvP5LBIs.js";import{a as je,f as xt,i as ve,m as kt,p as Ce,u as ze}from"./layout-CMmACzb7.js";import{t as Me}from"./check-BnZGcuDh.js";import{c as wt,d as We,n as gt,o as jt,r as _e,t as vt}from"./download-BUXzyjEd.js";import{f as Ct}from"./maps-8VTEe-0T.js";import{r as zt}from"./useCellActionButton-pIt4Gh5R.js";import{t as Mt}from"./copy-CAR4dOiD.js";import{t as Wt}from"./download-BG-iMGgV.js";import{t as _t}from"./eye-off-DgTL09j7.js";import{t as St}from"./file-plus-corner-BRwJx0yp.js";import{t as ie}from"./file-DVwc11C3.js";import{t as At}from"./github-BrsjF9dp.js";import{m as Dt}from"./form-DOjZnkdK.js";import{n as Nt,r as Pt,t as Et}from"./youtube-fKFch587.js";import{n as It,t as Tt}from"./square-oV8Csj8Y.js";import{i as Lt}from"./html-to-image-DjFNZcCI.js";import{t as Ht}from"./link-Cpo6yhBB.js";import{r as qt}from"./input-BPldEXfy.js";import{t as Rt}from"./settings-DD8FJvQ_.js";import{x as Ft}from"./azure-D5yXrO2H.js";import{t as C}from"./use-toast-BhMe50aT.js";import{n as Se,t as Vt}from"./paths-bMgYkaP2.js";import{o as Ot}from"./session-DnMOyddG.js";import{a as Bt,c as Gt,i as Ut,n as Yt,r as $t,s as Kt,t as Jt}from"./select-DygbgNTD.js";import{t as Xt}from"./tooltip-DOQlecCr.js";import{o as Zt}from"./alert-dialog-DsNfSYaw.js";import{a as Qt,c as ea,i as ta,n as aa,r as oa}from"./dialog-BXzvlof-.js";import{n as le}from"./ImperativeModal-CRNJOvqT.js";import{r as na,t as ia}from"./share-sD4fbzpH.js";import{t as K}from"./copy-DMCkK2TI.js";import{a as la}from"./cell-link-B5vG68jv.js";import{a as Ae}from"./renderShortcut-BJEd-iA7.js";import{t as sa}from"./icons-B9sHgc9n.js";import{t as ra}from"./links-syPBpTLO.js";import{t as De}from"./types-D4wsSrXa.js";var da=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),ca=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Ne=h("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),Pe=h("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),Ee=h("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),ha=h("fast-forward",[["path",{d:"M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z",key:"b19h5q"}],["path",{d:"M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z",key:"h7h5ge"}]]),pa=h("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]),ma=h("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),Ie=h("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),ua=h("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),fa=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Te=h("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),ya=h("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),ba=h("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Le=h("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),He=W(),se=pe($e(),1),a=pe(yt(),1),J="https://static.marimo.app";const xa=e=>{let t=(0,He.c)(25),{onClose:n}=e,[o,l]=(0,se.useState)(""),{exportAsHTML:r}=L(),s=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${J}/static/${s}`,d;t[0]!==r||t[1]!==n||t[2]!==s?(d=async v=>{v.preventDefault(),n();let A=await r({download:!1,includeCode:!0,files:xt.INSTANCE.filenames()}),z=C({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${J}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:A,path:s})}).catch(()=>{z.dismiss(),C({title:"Error uploading static page",description:(0,a.jsxs)("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",(0,a.jsx)("a",{href:_.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),z.dismiss(),C({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},t[0]=r,t[1]=n,t[2]=s,t[3]=d):d=t[3];let p;t[4]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(ea,{children:"Share static notebook"}),t[4]=p):p=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(Qt,{children:[p,(0,a.jsxs)(oa,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",(0,a.jsx)("a",{href:J,target:"_blank",children:J}),"."]})]}),t[5]=w):w=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{l(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let u;t[7]===o?u=t[8]:(u=(0,a.jsx)(qt,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=u);let f;t[9]===i?f=t[10]:(f=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(ka,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),t[9]=i,t[10]=f);let y;t[11]!==u||t[12]!==f?(y=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[u,f]}),t[11]=u,t[12]=f,t[13]=y):y=t[13];let b;t[14]===n?b=t[15]:(b=(0,a.jsx)(ne,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=b);let x;t[16]===i?x=t[17]:(x=(0,a.jsx)(ne,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await K(i)},children:"Create"}),t[16]=i,t[17]=x);let k;t[18]!==b||t[19]!==x?(k=(0,a.jsxs)(ta,{children:[b,x]}),t[18]=b,t[19]=x,t[20]=k):k=t[20];let j;return t[21]!==d||t[22]!==k||t[23]!==y?(j=(0,a.jsx)(aa,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[w,y,k]})}),t[21]=d,t[22]=k,t[23]=y,t[24]=j):j=t[24],j};var ka=e=>{let t=(0,He.c)(8),[n,o]=se.useState(!1),l;t[0]===e.text?l=t[1]:(l=bt.stopPropagation(async p=>{p.preventDefault(),await K(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=l);let r=l,s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Mt,{size:14,strokeWidth:1.5}),t[2]=s):s=t[2];let i;t[3]===r?i=t[4]:(i=(0,a.jsx)(ne,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:s}),t[3]=r,t[4]=i);let d;return t[5]!==n||t[6]!==i?(d=(0,a.jsx)(Xt,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=d):d=t[7],d},wa=W();function ga(){let e=document.getElementsByClassName(we.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=oe.findElement(t);if(!o){T.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:oe.parse(o.id)}}}return T.warn("No visible output area found for scroll anchor"),null}function ja(e){if(!e){T.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(oe.create(e.cellId));if(!t){T.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${we.outputArea}`)){T.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function qe(){let e=(0,wa.c)(2),t=I(fe),n;return e[0]===t?n=e[1]:(n=()=>{let o=ga();t(l=>({mode:st(l.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{ja(o)})})},e[0]=t,e[1]=n),n}const Re=Ye(!1);var va=W();const Ca=()=>{let e=(0,va.c)(7),{selectedLayout:t}=je(),{setLayoutView:n}=ve();if(ge()&&!me("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=i=>n(i),e[0]=n,e[1]=o);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(Kt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Gt,{placeholder:"Select a view"})}),e[2]=l):l=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Yt,{children:(0,a.jsxs)($t,{children:[(0,a.jsx)(Bt,{children:"View as"}),De.map(Ma)]})}),e[3]=r):r=e[3];let s;return e[4]!==t||e[5]!==o?(s=(0,a.jsxs)(Jt,{"data-testid":"layout-select",value:t,onValueChange:o,children:[l,r]}),e[4]=t,e[5]=o,e[6]=s):s=e[6],s};function za(e){return(0,a.jsx)(Fe(e),{className:"h-4 w-4"})}function Fe(e){switch(e){case"vertical":return ua;case"grid":return Pt;case"slides":return Te;default:return dt(e),Tt}}function Ve(e){return be(e)}function Ma(e){return(0,a.jsx)(Ut,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[za(e),(0,a.jsx)("span",{children:Ve(e)})]})},e)}async function Wa(e){let{filename:t,preset:n,downloadPDF:o}=e;await o({filename:t,webpdf:!0,preset:n,includeInputs:!1,rasterServer:"live"})}var _a=W();function Sa(e){let t=(0,_a.c)(5),{openPrompt:n,closeModal:o}=le(),{sendCopy:l}=L(),r;return t[0]!==o||t[1]!==n||t[2]!==l||t[3]!==e?(r=()=>{if(!e)return null;let s=Vt.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Se.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=s.join(Se.dirname(e),i);l({source:e,destination:d}).then(()=>{o(),C({title:"Notebook copied",description:"A copy of the notebook has been created."}),ra(d)})}})},t[0]=o,t[1]=n,t[2]=l,t[3]=e,t[4]=r):r=t[4],r}const Aa=()=>{let{updateCellConfig:e}=ue(),{saveCellConfig:t}=L();return(0,se.useCallback)(async()=>{let n=new Je,o=ye(),l=o.cellIds.inOrderIds,r={};for(let i of l){if(o.cellData[i]===void 0)continue;let{code:d,config:p}=o.cellData[i];p.hide_code||n.isSupported(d)&&(r[i]={hide_code:!0})}let s=ke.entries(r);if(s.length!==0){await t({configs:r});for(let[i,d]of s)e({cellId:i,config:d})}},[e])};var Da=W();function Oe(){let e=(0,Da.c)(4),{openConfirm:t}=le(),n=I(ut),{sendRestart:o}=L(),l;return e[0]!==t||e[1]!==o||e[2]!==n?(l=()=>{t({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(Zt,{onClick:async()=>{n({state:ft.CLOSING}),await o(),na()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=l):l=e[3],l}var Na=W(),S=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Pa(){var ce,he;let e=(0,Na.c)(42),t=la(),{openModal:n,closeModal:o}=le(),{toggleApplication:l}=rt(),{selectedPanel:r}=Ze(),[s]=Ue(fe),i=ae(at),d=Aa(),[p]=mt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:u,addSetupCellIfDoesntExist:f,collapseAllCells:y,expandAllCells:b}=ue(),x=Oe(),k=nt(),j=Sa(t),v=I(Re),A=I(ht),z=I(pt),{exportAsMarkdown:X,readCode:D,saveCellConfig:Z}=L(),Q=ae(Qe),ee=ae(lt),{selectedLayout:H}=je(),{setLayoutView:te}=ve(),q=qe(),R=((ce=p.sharing)==null?void 0:ce.html)??!0,F=((he=p.sharing)==null?void 0:he.wasm)??!0,V;e[0]===Symbol.for("react.memo_cache_sentinel")?(V=me("server_side_pdf_export"),e[0]=V):V=e[0];let N=V,P=N||s.mode==="present",O=H==="slides",Be=Xa,de=Ja,B;e[1]===t?B=e[2]:(B=async c=>{let{preset:m,title:E}=c;if(!t){re();return}await wt(E,async()=>{await Wa({filename:t,preset:m,downloadPDF:gt})})},e[1]=t,e[2]=B);let G=B,U;e[3]===Symbol.for("react.memo_cache_sentinel")?(U=(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),e[3]=U):U=e[3];let Y;e[4]===Symbol.for("react.memo_cache_sentinel")?(Y=(0,a.jsx)(Ce,{size:14,strokeWidth:1.5}),e[4]=Y):Y=e[4];let M;e[5]===t?M=e[6]:(M=async()=>{if(!t){re();return}await ze({filename:t,includeCode:!0})},e[5]=t,e[6]=M);let $;return e[7]!==f||e[8]!==ee||e[9]!==u||e[10]!==o||e[11]!==y||e[12]!==j||e[13]!==G||e[14]!==b||e[15]!==X||e[16]!==t||e[17]!==Q||e[18]!==d||e[19]!==O||e[20]!==i||e[21]!==n||e[22]!==P||e[23]!==D||e[24]!==x||e[25]!==k||e[26]!==Z||e[27]!==H||e[28]!==r||e[29]!==v||e[30]!==z||e[31]!==te||e[32]!==A||e[33]!==R||e[34]!==F||e[35]!==M||e[36]!==l||e[37]!==q||e[38]!==g||e[39]!==w||e[40]!==s.mode?($=[{icon:U,label:"Download",handle:S,dropdown:[{icon:Y,label:"Download as HTML",handle:M},{icon:(0,a.jsx)(Ce,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){re();return}await ze({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(sa,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await X({download:!1});_e(new Blob([c],{type:"text/plain"}),We.toMarkdown(document.title))}},{icon:(0,a.jsx)(kt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await D();_e(new Blob([c.contents],{type:"text/plain"}),We.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(Lt,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:s.mode!=="present",tooltip:s.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Ae("global.hideCode",!1)]}),handle:Ka},{divider:!0,icon:(0,a.jsx)(ie,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:S,disabled:!P&&!N,dropdown:[{icon:(0,a.jsx)(ie,{size:14,strokeWidth:1.5}),label:"Document Layout",rightElement:de(!O),disabled:!P,tooltip:P?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Ae("global.hideCode",!1)]}),handle:async()=>{if(N){await G({preset:"document",title:"Downloading Document PDF..."});return}let c=new Event("export-beforeprint"),m=new Event("export-afterprint");(function(){window.dispatchEvent(c),setTimeout($a,0),setTimeout(()=>window.dispatchEvent(m),0)})()}},{icon:(0,a.jsx)(ie,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:de(O),disabled:!N,tooltip:N?void 0:(0,a.jsx)("span",{children:"Requires Better PDF Export in Settings > Experimental."}),handle:async()=>{await G({preset:"slides",title:"Downloading Slides PDF..."})}}]}]},{icon:(0,a.jsx)(ya,{size:14,strokeWidth:1.5}),label:"Share",handle:S,hidden:!R&&!F,dropdown:[{icon:(0,a.jsx)(Dt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!R,handle:async()=>{n((0,a.jsx)(xa,{onClose:o}))}},{icon:(0,a.jsx)(Ht,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!F,handle:async()=>{await K(ia({code:(await D()).contents})),C({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(fa,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:S,dropdown:Ke.flatMap(c=>{let{type:m,Icon:E,hidden:Ge}=c;return Ge?[]:{label:be(m),rightElement:Be(r===m),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),handle:()=>l(m)}})},{icon:(0,a.jsx)(Te,{size:14,strokeWidth:1.5}),label:"Present as",handle:S,dropdown:[{icon:s.mode==="present"?(0,a.jsx)(Ft,{size:14,strokeWidth:1.5}):(0,a.jsx)(Ie,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{q()}},...De.map((c,m)=>{let E=Fe(c);return{divider:m===0,label:Ve(c),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:H===c&&(0,a.jsx)(Me,{size:14})}),handle:()=>{te(c),s.mode==="edit"&&q()}}})]},{icon:(0,a.jsx)(pa,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||ge(),handle:j},{icon:(0,a.jsx)(Ne,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await K((await D()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(zt,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!Q||i,handle:async()=>{let c=Xe(ye());await Z({configs:ke.fromEntries(c.map(Ya))});for(let m of c)w({cellId:m,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Ee,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{f({})}},{icon:(0,a.jsx)(et,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(xe,{onClose:o}))}},{icon:(0,a.jsx)(ct,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(xe,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(Le,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!ee||i,handle:()=>{g()}},{icon:(0,a.jsx)(ba,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:x},{icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{k()}},{icon:(0,a.jsx)(tt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{u()}},{icon:(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(ca,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:y,redundant:!0},{icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:b,redundant:!0},{divider:!0,icon:(0,a.jsx)(Pe,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(Ua)},{icon:(0,a.jsx)(ma,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(Ga)},{icon:(0,a.jsx)(Rt,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>A(Ba),redundant:!0},{icon:(0,a.jsx)(Ct,{size:14,strokeWidth:1.5}),label:"Resources",handle:S,dropdown:[{icon:(0,a.jsx)(ot,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Oa},{icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Va},{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:Fa},{icon:(0,a.jsx)(Et,{size:14,strokeWidth:1.5}),label:"YouTube",handle:Ra},{icon:(0,a.jsx)(it,{size:14,strokeWidth:1.5}),label:"Changelog",handle:qa}]},{divider:!0,icon:(0,a.jsx)(It,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Ha},{icon:(0,a.jsx)(St,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:La}].filter(Ta).map(Ea),e[7]=f,e[8]=ee,e[9]=u,e[10]=o,e[11]=y,e[12]=j,e[13]=G,e[14]=b,e[15]=X,e[16]=t,e[17]=Q,e[18]=d,e[19]=O,e[20]=i,e[21]=n,e[22]=P,e[23]=D,e[24]=x,e[25]=k,e[26]=Z,e[27]=H,e[28]=r,e[29]=v,e[30]=z,e[31]=te,e[32]=A,e[33]=R,e[34]=F,e[35]=M,e[36]=l,e[37]=q,e[38]=g,e[39]=w,e[40]=s.mode,e[41]=$):$=e[41],$}function Ea(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Ia)}:e}function Ia(e){return!e.hidden}function Ta(e){return!e.hidden}function La(){let e=Ot();window.open(e,"_blank")}function Ha(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function qa(){window.open(_.releasesPage,"_blank")}function Ra(){window.open(_.youtube,"_blank")}function Fa(){window.open(_.discordLink,"_blank")}function Va(){window.open(_.githubPage,"_blank")}function Oa(){window.open(_.docsPage,"_blank")}function Ba(e){return!e}function Ga(e){return!e}function Ua(e){return!e}function Ya(e){return[e,{disabled:!1}]}function $a(){return window.print()}async function Ka(){let e=document.getElementById("App");e&&await jt({element:e,filename:document.title,prepare:vt})}function Ja(e){return e?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function Xa(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(Me,{size:14})})}function re(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{qe as a,Ee as c,Re as i,Pe as l,Oe as n,Le as o,Ca as r,Ie as s,Pa as t,Ne as u};
@@ -1 +1 @@
1
- import{s as m}from"./chunk-LvLJmgfZ.js";import{n as p}from"./useEvent-WUlsM6MC.js";import{T as d,_t as f,f as u}from"./cells-CigkzIKH.js";import{t as c}from"./compiler-runtime-B3qBwwSJ.js";import{t as C}from"./jsx-runtime-CP2fAiZX.js";import{t as h}from"./use-toast-BhMe50aT.js";import{r as v}from"./useDeleteCell-Dok0-XOi.js";var x=c(),b=m(C(),1);function j(){let t=(0,x.c)(3),{splitCell:i,undoSplitCell:r}=d(),o;return t[0]!==i||t[1]!==r?(o=s=>{let l=u(s.cellId);if(!l)return;let a=f(l);i(s);let{dismiss:n}=h({title:"Cell split",action:(0,b.jsx)(v,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{r({...s,snapshot:a}),e()},children:"Undo"})}),e=n},t[0]=i,t[1]=r,t[2]=o):o=t[2],p(o)}export{j as t};
1
+ import{s as m}from"./chunk-LvLJmgfZ.js";import{n as p}from"./useEvent-WUlsM6MC.js";import{T as d,_t as f,f as u}from"./cells-BusUaZSh.js";import{t as c}from"./compiler-runtime-B3qBwwSJ.js";import{t as C}from"./jsx-runtime-CP2fAiZX.js";import{t as h}from"./use-toast-BhMe50aT.js";import{r as v}from"./useDeleteCell-DFKNGNeg.js";var x=c(),b=m(C(),1);function j(){let t=(0,x.c)(3),{splitCell:i,undoSplitCell:r}=d(),o;return t[0]!==i||t[1]!==r?(o=s=>{let l=u(s.cellId);if(!l)return;let a=f(l);i(s);let{dismiss:n}=h({title:"Cell split",action:(0,b.jsx)(v,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{r({...s,snapshot:a}),e()},children:"Undo"})}),e=n},t[0]=i,t[1]=r,t[2]=o):o=t[2],p(o)}export{j as t};
package/dist/index.html CHANGED
@@ -66,7 +66,7 @@
66
66
  <marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
67
67
  <!-- /TODO -->
68
68
  <title>{{ title }}</title>
69
- <script type="module" crossorigin src="./assets/index-D0SHqLyU.js"></script>
69
+ <script type="module" crossorigin src="./assets/index-CXRGI-CB.js"></script>
70
70
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-TXkS1QI3.js">
71
71
  <link rel="modulepreload" crossorigin href="./assets/clsx-A78R3nYl.js">
72
72
  <link rel="modulepreload" crossorigin href="./assets/cn-d_A4rA-x.js">
@@ -135,7 +135,7 @@
135
135
  <link rel="modulepreload" crossorigin href="./assets/toInteger-Cl1doThW.js">
136
136
  <link rel="modulepreload" crossorigin href="./assets/database-zap-B3efE3T2.js">
137
137
  <link rel="modulepreload" crossorigin href="./assets/main-Cmx6WhDY.js">
138
- <link rel="modulepreload" crossorigin href="./assets/cells-CigkzIKH.js">
138
+ <link rel="modulepreload" crossorigin href="./assets/cells-BusUaZSh.js">
139
139
  <link rel="modulepreload" crossorigin href="./assets/spinner-DCSoZZhh.js">
140
140
  <link rel="modulepreload" crossorigin href="./assets/chevron-right-_z3dkNFy.js">
141
141
  <link rel="modulepreload" crossorigin href="./assets/dropdown-menu-CKhrfxsx.js">
@@ -149,7 +149,7 @@
149
149
  <link rel="modulepreload" crossorigin href="./assets/dist-BTEPE6IB.js">
150
150
  <link rel="modulepreload" crossorigin href="./assets/label-DmqkEXI4.js">
151
151
  <link rel="modulepreload" crossorigin href="./assets/useDebounce-BUC67G8E.js">
152
- <link rel="modulepreload" crossorigin href="./assets/azure-BOn6W9-m.js">
152
+ <link rel="modulepreload" crossorigin href="./assets/azure-D5yXrO2H.js">
153
153
  <link rel="modulepreload" crossorigin href="./assets/numbers-44Cj1Me-.js">
154
154
  <link rel="modulepreload" crossorigin href="./assets/SSRProvider-DC7ElCZZ.js">
155
155
  <link rel="modulepreload" crossorigin href="./assets/context-B1_BdDTF.js">
@@ -158,7 +158,7 @@
158
158
  <link rel="modulepreload" crossorigin href="./assets/input-BPldEXfy.js">
159
159
  <link rel="modulepreload" crossorigin href="./assets/links-BKV6zi_7.js">
160
160
  <link rel="modulepreload" crossorigin href="./assets/popover-Cvl9xY6R.js">
161
- <link rel="modulepreload" crossorigin href="./assets/switch-Cp5eQmZx.js">
161
+ <link rel="modulepreload" crossorigin href="./assets/switch-E6p3DgBh.js">
162
162
  <link rel="modulepreload" crossorigin href="./assets/table-FXVKPW36.js">
163
163
  <link rel="modulepreload" crossorigin href="./assets/useAsyncData-DVm0BCFt.js">
164
164
  <link rel="modulepreload" crossorigin href="./assets/errors-Bfogio62.js">
@@ -172,7 +172,7 @@
172
172
  <link rel="modulepreload" crossorigin href="./assets/refresh-cw-DeCFDX1B.js">
173
173
  <link rel="modulepreload" crossorigin href="./assets/trash-2-DtQaB9NM.js">
174
174
  <link rel="modulepreload" crossorigin href="./assets/triangle-alert-n1-FF7zs.js">
175
- <link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-DQy6lXPg.js">
175
+ <link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-CS9BLOLl.js">
176
176
  <link rel="modulepreload" crossorigin href="./assets/defaultLocale-OkOxlkkM.js">
177
177
  <link rel="modulepreload" crossorigin href="./assets/precisionRound-BOmLQIKI.js">
178
178
  <link rel="modulepreload" crossorigin href="./assets/defaultLocale-DK1MWd7f.js">
@@ -181,20 +181,20 @@
181
181
  <link rel="modulepreload" crossorigin href="./assets/ErrorBoundary-dVj6GVNE.js">
182
182
  <link rel="modulepreload" crossorigin href="./assets/useInstallPackage-jGxNsOWc.js">
183
183
  <link rel="modulepreload" crossorigin href="./assets/ImperativeModal-CRNJOvqT.js">
184
- <link rel="modulepreload" crossorigin href="./assets/cell-link-CZP6Kzmf.js">
185
- <link rel="modulepreload" crossorigin href="./assets/datasource-B3MFUEL6.js">
186
- <link rel="modulepreload" crossorigin href="./assets/state-LFRjhpk7.js">
187
- <link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-DDEWmSYt.js">
184
+ <link rel="modulepreload" crossorigin href="./assets/cell-link-B5vG68jv.js">
185
+ <link rel="modulepreload" crossorigin href="./assets/datasource-DpXRY8fO.js">
186
+ <link rel="modulepreload" crossorigin href="./assets/state-BqcLH_kp.js">
187
+ <link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-CkWg573B.js">
188
188
  <link rel="modulepreload" crossorigin href="./assets/copy-icon-6RnnFDPt.js">
189
- <link rel="modulepreload" crossorigin href="./assets/html-to-image-DkwDXZ7Q.js">
190
- <link rel="modulepreload" crossorigin href="./assets/focus-Bci_MkMH.js">
189
+ <link rel="modulepreload" crossorigin href="./assets/html-to-image-DjFNZcCI.js">
190
+ <link rel="modulepreload" crossorigin href="./assets/focus-ByrD76nS.js">
191
191
  <link rel="modulepreload" crossorigin href="./assets/LazyAnyLanguageCodeMirror-D8Y5EdeE.js">
192
192
  <link rel="modulepreload" crossorigin href="./assets/chunk-5FQGJX7Z-XpIxSaxK.js">
193
193
  <link rel="modulepreload" crossorigin href="./assets/katex-rvFxOCU-.js">
194
- <link rel="modulepreload" crossorigin href="./assets/markdown-renderer-DHgbXKHX.js">
195
- <link rel="modulepreload" crossorigin href="./assets/command-C8WcXqB5.js">
196
- <link rel="modulepreload" crossorigin href="./assets/download-C35SWaj3.js">
197
- <link rel="modulepreload" crossorigin href="./assets/RenderHTML-BKdgJWBR.js">
194
+ <link rel="modulepreload" crossorigin href="./assets/markdown-renderer-B4k8WEFz.js">
195
+ <link rel="modulepreload" crossorigin href="./assets/command-B5q5uni4.js">
196
+ <link rel="modulepreload" crossorigin href="./assets/download-BUXzyjEd.js">
197
+ <link rel="modulepreload" crossorigin href="./assets/RenderHTML-D0riQ7d5.js">
198
198
  <link rel="modulepreload" crossorigin href="./assets/useIframeCapabilities-T3alJPda.js">
199
199
  <link rel="modulepreload" crossorigin href="./assets/formats-C3K3rlAZ.js">
200
200
  <link rel="modulepreload" crossorigin href="./assets/en-US-DBqDb4Nb.js">
@@ -206,39 +206,39 @@
206
206
  <link rel="modulepreload" crossorigin href="./assets/useDateFormatter-CmtFqjqu.js">
207
207
  <link rel="modulepreload" crossorigin href="./assets/range-BGa3qZre.js">
208
208
  <link rel="modulepreload" crossorigin href="./assets/table-CeILsq6V.js">
209
- <link rel="modulepreload" crossorigin href="./assets/JsonOutput-DKjq8WkX.js">
210
- <link rel="modulepreload" crossorigin href="./assets/useDeleteCell-Dok0-XOi.js">
209
+ <link rel="modulepreload" crossorigin href="./assets/JsonOutput-COYZxr-s.js">
210
+ <link rel="modulepreload" crossorigin href="./assets/useDeleteCell-DFKNGNeg.js">
211
211
  <link rel="modulepreload" crossorigin href="./assets/icons-B9sHgc9n.js">
212
- <link rel="modulepreload" crossorigin href="./assets/process-output-B27UYd5L.js">
212
+ <link rel="modulepreload" crossorigin href="./assets/process-output-C6uLELXv.js">
213
213
  <link rel="modulepreload" crossorigin href="./assets/blob-CObhN-9g.js">
214
214
  <link rel="modulepreload" crossorigin href="./assets/objectWithoutPropertiesLoose-Dxmp_Bd_.js">
215
215
  <link rel="modulepreload" crossorigin href="./assets/esm-BQUzYly2.js">
216
216
  <link rel="modulepreload" crossorigin href="./assets/file-DVwc11C3.js">
217
217
  <link rel="modulepreload" crossorigin href="./assets/play-D4Tdvkms.js">
218
- <link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai--93MrwWW.js">
218
+ <link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-D7RcfIFT.js">
219
219
  <link rel="modulepreload" crossorigin href="./assets/isEmpty-9KlyX4nB.js">
220
220
  <link rel="modulepreload" crossorigin href="./assets/bot-message-square-BzawfL5p.js">
221
- <link rel="modulepreload" crossorigin href="./assets/chat-display-C1J9G6Cr.js">
221
+ <link rel="modulepreload" crossorigin href="./assets/chat-display-BrI8TsyH.js">
222
222
  <link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-F2DZENgf.js">
223
223
  <link rel="modulepreload" crossorigin href="./assets/square-function-4zY5Dv0P.js">
224
224
  <link rel="modulepreload" crossorigin href="./assets/spec-Be-iRLAY.js">
225
- <link rel="modulepreload" crossorigin href="./assets/components-Bis36Fco.js">
226
- <link rel="modulepreload" crossorigin href="./assets/column-preview-BHAQ5EN7.js">
225
+ <link rel="modulepreload" crossorigin href="./assets/components-Cx6Hou1_.js">
226
+ <link rel="modulepreload" crossorigin href="./assets/column-preview-CMuWC26D.js">
227
227
  <link rel="modulepreload" crossorigin href="./assets/toggle-BhEcsHTu.js">
228
- <link rel="modulepreload" crossorigin href="./assets/globals-BIlQtd9Z.js">
228
+ <link rel="modulepreload" crossorigin href="./assets/globals-B_lwS1Rg.js">
229
229
  <link rel="modulepreload" crossorigin href="./assets/share-sD4fbzpH.js">
230
230
  <link rel="modulepreload" crossorigin href="./assets/_baseSet-BEHvSeoM.js">
231
231
  <link rel="modulepreload" crossorigin href="./assets/react-resizable-panels.browser.esm-RgA6v8U3.js">
232
- <link rel="modulepreload" crossorigin href="./assets/context-aware-panel-CdVqO_AM.js">
233
- <link rel="modulepreload" crossorigin href="./assets/floating-outline-BxQvjarL.js">
234
- <link rel="modulepreload" crossorigin href="./assets/useAddCell-CZ1y3fpl.js">
232
+ <link rel="modulepreload" crossorigin href="./assets/context-aware-panel-BGlzp-FM.js">
233
+ <link rel="modulepreload" crossorigin href="./assets/floating-outline-CmXM2v38.js">
234
+ <link rel="modulepreload" crossorigin href="./assets/useAddCell-CsMGD6qQ.js">
235
235
  <link rel="modulepreload" crossorigin href="./assets/eye-off-DgTL09j7.js">
236
- <link rel="modulepreload" crossorigin href="./assets/readonly-python-code-CyraFlMm.js">
236
+ <link rel="modulepreload" crossorigin href="./assets/readonly-python-code-vSIWAIcL.js">
237
237
  <link rel="modulepreload" crossorigin href="./assets/file-video-camera-Fa5c_iPb.js">
238
238
  <link rel="modulepreload" crossorigin href="./assets/file-code-D9wtWSiR.js">
239
- <link rel="modulepreload" crossorigin href="./assets/types-B737EDbu.js">
239
+ <link rel="modulepreload" crossorigin href="./assets/types-Cg2HXEUi.js">
240
240
  <link rel="modulepreload" crossorigin href="./assets/refresh-ccw-BOzRCrXK.js">
241
- <link rel="modulepreload" crossorigin href="./assets/form-DmsYuKMH.js">
241
+ <link rel="modulepreload" crossorigin href="./assets/form-DOjZnkdK.js">
242
242
  <link rel="modulepreload" crossorigin href="./assets/field-DGtw6Lae.js">
243
243
  <link rel="modulepreload" crossorigin href="./assets/useBoolean-eWwLICkT.js">
244
244
  <link rel="modulepreload" crossorigin href="./assets/useDeepCompareMemoize-D1hTncYV.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.20.3-dev96",
3
+ "version": "0.20.3-dev98",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -60,11 +60,11 @@ import {
60
60
  import { toast } from "@/components/ui/use-toast";
61
61
  import { DelayMount } from "@/components/utils/delay-mount";
62
62
  import { useRequestClient } from "@/core/network/requests";
63
- import { filenameAtom } from "@/core/saving/file-state";
63
+ import { cwdAtom, filenameAtom } from "@/core/saving/file-state";
64
64
  import { store } from "@/core/state/jotai";
65
65
  import { ErrorBanner } from "@/plugins/impl/common/error-banner";
66
66
  import { Functions } from "@/utils/functions";
67
- import { Paths } from "@/utils/paths";
67
+ import { PathBuilder, Paths } from "@/utils/paths";
68
68
  import {
69
69
  AddContextButton,
70
70
  AttachFileButton,
@@ -614,7 +614,11 @@ ChatContent.displayName = "ChatContent";
614
614
 
615
615
  const NO_WS_SET = "_skip_auto_connect_";
616
616
 
617
- function getCwd() {
617
+ function getCwd(): string {
618
+ const cwd = store.get(cwdAtom);
619
+ if (cwd) {
620
+ return cwd;
621
+ }
618
622
  const filename = store.get(filenameAtom);
619
623
  if (!filename) {
620
624
  throw new Error(
@@ -624,6 +628,21 @@ function getCwd() {
624
628
  return Paths.dirname(filename);
625
629
  }
626
630
 
631
+ function getAbsoluteFilename(): string {
632
+ const filename = store.get(filenameAtom);
633
+ if (!filename) {
634
+ throw new Error(
635
+ "Please save the notebook and refresh the browser to use the agent",
636
+ );
637
+ }
638
+ const cwd = store.get(cwdAtom);
639
+ if (cwd) {
640
+ const builder = PathBuilder.guessDeliminator(cwd);
641
+ return builder.join(cwd, String(Paths.basename(filename)));
642
+ }
643
+ return filename;
644
+ }
645
+
627
646
  const AgentPanel: React.FC = () => {
628
647
  const [isLoading, setIsLoading] = useState(false);
629
648
  const [error, setError] = useState<Error | string | null>(null);
@@ -862,8 +881,10 @@ const AgentPanel: React.FC = () => {
862
881
  setSessionState((prev) => updateSessionTitle(prev, prompt));
863
882
  }
864
883
 
865
- const filename = store.get(filenameAtom);
866
- if (!filename) {
884
+ let absoluteFilename: string;
885
+ try {
886
+ absoluteFilename = getAbsoluteFilename();
887
+ } catch {
867
888
  toast({
868
889
  title: "Notebook must be named",
869
890
  description: "Please name the notebook to use the agent",
@@ -894,16 +915,16 @@ const AgentPanel: React.FC = () => {
894
915
  promptBlocks.push(
895
916
  {
896
917
  type: "resource_link",
897
- uri: filename,
918
+ uri: absoluteFilename,
898
919
  mimeType: "text/x-python",
899
- name: filename,
920
+ name: absoluteFilename,
900
921
  },
901
922
  {
902
923
  type: "resource",
903
924
  resource: {
904
925
  uri: "marimo_rules.md",
905
926
  mimeType: "text/plain",
906
- text: getAgentPrompt(filename),
927
+ text: getAgentPrompt(absoluteFilename),
907
928
  },
908
929
  },
909
930
  );
@@ -9,6 +9,13 @@ import { getFilenameFromDOM } from "../dom/htmlUtils";
9
9
  */
10
10
  export const filenameAtom = atom<string | null>(getFilenameFromDOM());
11
11
 
12
+ /**
13
+ * Atom for storing the notebook's working directory (absolute path).
14
+ * In directory mode, filenameAtom may be a relative display path;
15
+ * this atom holds the absolute directory containing the notebook.
16
+ */
17
+ export const cwdAtom = atom<string | null>(null);
18
+
12
19
  /**
13
20
  * Set for static notebooks.
14
21
  */
package/src/mount.tsx CHANGED
@@ -36,7 +36,7 @@ import {
36
36
  DEFAULT_RUNTIME_CONFIG,
37
37
  runtimeConfigAtom,
38
38
  } from "./core/runtime/config";
39
- import { codeAtom, filenameAtom } from "./core/saving/file-state";
39
+ import { codeAtom, cwdAtom, filenameAtom } from "./core/saving/file-state";
40
40
  import { store } from "./core/state/jotai";
41
41
  import { patchFetch, patchVegaLoader } from "./core/static/files";
42
42
  import {
@@ -146,6 +146,10 @@ const mountOptionsSchema = z.object({
146
146
  Logger.warn("No filename provided, using fallback");
147
147
  return getFilenameFromDOM();
148
148
  }),
149
+ /**
150
+ * absolute working directory of the notebook
151
+ */
152
+ cwd: z.string().nullish().default(null),
149
153
  /**
150
154
  * notebook code
151
155
  */
@@ -282,6 +286,7 @@ function initStore(options: unknown) {
282
286
 
283
287
  // Files
284
288
  store.set(filenameAtom, parsedOptions.data.filename);
289
+ store.set(cwdAtom, parsedOptions.data.cwd ?? null);
285
290
  store.set(codeAtom, parsedOptions.data.code);
286
291
  store.set(initialModeAtom, mode);
287
292
 
@@ -39,7 +39,10 @@ const importMhChem = once(async () => {
39
39
  });
40
40
 
41
41
  // Required, even if empty. (see https://github.com/KaTeX/KaTeX/issues/2513)
42
- const macros = {};
42
+ const macros = {
43
+ // KaTeX doesn't support \mbox; map it to the equivalent \text
44
+ "\\mbox": "\\text{#1}",
45
+ };
43
46
 
44
47
  async function renderLatex(mount: HTMLElement, tex: string): Promise<void> {
45
48
  const [katex] = await Promise.all([importKatex(), importMhChem()]);