@marimo-team/frontend 0.20.3-dev92 → 0.20.3-dev94
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/{CellStatus-8UvWjtiZ.js → CellStatus-DT32GPB2.js} +1 -1
- package/dist/assets/{JsonOutput-OHVAIP6T.js → JsonOutput-uf7OFaDU.js} +1 -1
- package/dist/assets/{MarimoErrorOutput-Bxrta8VX.js → MarimoErrorOutput-BJkHPKWK.js} +1 -1
- package/dist/assets/{RenderHTML-DIhjo_ta.js → RenderHTML-CjCJ1DT4.js} +1 -1
- package/dist/assets/{add-cell-with-ai-aX3jE5eE.js → add-cell-with-ai-DJ9tuL4g.js} +1 -1
- package/dist/assets/{add-database-form-BzZFhGKo.js → add-database-form-D06OUuSg.js} +1 -1
- package/dist/assets/{agent-panel-DpdJCgZV.js → agent-panel-DYFbOZ0f.js} +1 -1
- package/dist/assets/{ai-model-dropdown-ZWTWzd6H.js → ai-model-dropdown-BnQGs6GF.js} +1 -1
- package/dist/assets/{app-config-button-CntHQatu.js → app-config-button-Btys3Cin.js} +1 -1
- package/dist/assets/{cell-editor-CWvqoFib.js → cell-editor-BDJGt0PK.js} +1 -1
- package/dist/assets/{cell-link-Cqbep4Gr.js → cell-link-CiQrWiPA.js} +1 -1
- package/dist/assets/{cells-BLMrU2yT.js → cells-DD42bsu7.js} +39 -39
- package/dist/assets/{chat-display-jn1HDvEj.js → chat-display-DN0dzai8.js} +1 -1
- package/dist/assets/{chat-panel-NWyFQMlG.js → chat-panel--gsbOxYb.js} +1 -1
- package/dist/assets/{column-preview-C7tGDCpE.js → column-preview-BtKDi4j6.js} +1 -1
- package/dist/assets/{command-CwoFdrUt.js → command-2Li9iWG_.js} +1 -1
- package/dist/assets/{command-palette-DJxtiC8i.js → command-palette-Ce_7Eh4G.js} +1 -1
- package/dist/assets/{common-e99VdZde.js → common-BOraucV9.js} +1 -1
- package/dist/assets/{components-BiaTYPej.js → components-Bl0CtJtz.js} +1 -1
- package/dist/assets/{components-DLasuGcf.js → components-Dv0WjPQ-.js} +1 -1
- package/dist/assets/{context-aware-panel-B5mdLqFs.js → context-aware-panel-DMHGbB_b.js} +1 -1
- package/dist/assets/{datasource-Du0TuMEa.js → datasource-Cturxb4x.js} +1 -1
- package/dist/assets/{dependency-graph-panel-0r5Y3wCY.js → dependency-graph-panel-B8UpJDl-.js} +1 -1
- package/dist/assets/{documentation-panel-CKkbFSOa.js → documentation-panel-BuGA-sMW.js} +1 -1
- package/dist/assets/{download-BcxPm3qL.js → download-CmObLKP6.js} +1 -1
- package/dist/assets/{edit-page-CV9biTVQ.js → edit-page-BNA8A6Ux.js} +3 -3
- package/dist/assets/{error-panel-CQaNFEL1.js → error-panel-CK2L5ciF.js} +1 -1
- package/dist/assets/{file-explorer-panel-3TyNnGfS.js → file-explorer-panel-BeOWee6Z.js} +1 -1
- package/dist/assets/{floating-outline-lhpY7gel.js → floating-outline-BPv4P2vV.js} +1 -1
- package/dist/assets/{focus-DRLi18rJ.js → focus-DiPb_hn6.js} +1 -1
- package/dist/assets/{form-B6Dm4BQQ.js → form-ibH0eKd-.js} +1 -1
- package/dist/assets/{globals-C_25sJic.js → globals-Dk7VGE85.js} +1 -1
- package/dist/assets/{home-page-CjvlAi7I.js → home-page-Bs5_UsFC.js} +1 -1
- package/dist/assets/{html-to-image-CuwoSczP.js → html-to-image-CojwvW9z.js} +1 -1
- package/dist/assets/{index-BmiOJWBi.js → index-B-ghuCiq.js} +3 -3
- package/dist/assets/{kiosk-mode-CgrQnR3c.js → kiosk-mode-hbpM_a-j.js} +1 -1
- package/dist/assets/{layout-Dhkk-WXJ.js → layout-D1VtP7GQ.js} +1 -1
- package/dist/assets/{logs-panel-BuKFFIBf.js → logs-panel-CDBBW9DI.js} +1 -1
- package/dist/assets/{markdown-renderer-CFEhjnW8.js → markdown-renderer-YOedNAkc.js} +1 -1
- package/dist/assets/{name-cell-input-DW2lMrC3.js → name-cell-input-HEC8dShQ.js} +1 -1
- package/dist/assets/{outline-panel-5sWCspyw.js → outline-panel-DzWl_avL.js} +1 -1
- package/dist/assets/{packages-panel-BsgpzBV8.js → packages-panel-cSLWScXy.js} +1 -1
- package/dist/assets/{panels-Cgqc_xy4.js → panels-903Vandk.js} +1 -1
- package/dist/assets/{process-output-t4jYlRH7.js → process-output-B2WHFsM0.js} +1 -1
- package/dist/assets/{readonly-python-code-C4iitUlH.js → readonly-python-code-XphqxCq8.js} +1 -1
- package/dist/assets/{run-page-DCXZJWt4.js → run-page-DzsjMR6O.js} +1 -1
- package/dist/assets/{scratchpad-panel-DD3uTz94.js → scratchpad-panel-DA77C7Q0.js} +1 -1
- package/dist/assets/{session-panel-CN_GIT4Z.js → session-panel-DwTnfeqw.js} +1 -1
- package/dist/assets/{snippets-panel-8wuPZ5qp.js → snippets-panel-CLQT_rb9.js} +1 -1
- package/dist/assets/{state-wf63reZP.js → state-DRCtQIWh.js} +1 -1
- package/dist/assets/{switch-BPm2Fg9n.js → switch-CA8la81g.js} +1 -1
- package/dist/assets/{textarea-BNIM0Vlg.js → textarea-noyX_YEw.js} +1 -1
- package/dist/assets/{tracing-Bsx36NDe.js → tracing-Bdx3rdWM.js} +1 -1
- package/dist/assets/{tracing-panel-C-pXxaHo.js → tracing-panel-BNSSHFIf.js} +2 -2
- package/dist/assets/{types-p9kR1pnI.js → types-DYD6UxTH.js} +1 -1
- package/dist/assets/{useAddCell-BcEy-yRX.js → useAddCell-DVMY6vkv.js} +1 -1
- package/dist/assets/{useCellActionButton-BxsLH3DI.js → useCellActionButton-HNTLhSrv.js} +1 -1
- package/dist/assets/{useDeleteCell-_MCU13nP.js → useDeleteCell-CrSQfQw4.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-DmYsxKsG.js → useDependencyPanelTab-BqqmAAW7.js} +1 -1
- package/dist/assets/{useNotebookActions-BDm1_7O6.js → useNotebookActions-Bzt5O8Yy.js} +1 -1
- package/dist/assets/{useSplitCell-wKfedpRZ.js → useSplitCell-BL-Sir7Y.js} +1 -1
- package/dist/index.html +29 -29
- package/package.json +1 -1
- package/src/core/cells/__tests__/session.test.ts +1 -1
- package/src/plugins/core/__test__/sanitize.test.ts +47 -2
- package/src/plugins/core/sanitize.ts +4 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as ae}from"./chunk-LvLJmgfZ.js";import{d as ie,u as x}from"./useEvent-WUlsM6MC.js";import{Bn as de,Fn as ne,T as se,ar as re,cr as ce,ir as he,lt as me,mt as pe,or as ke,v as fe,wt as K,yi as ue}from"./cells-
|
|
1
|
+
import{s as ae}from"./chunk-LvLJmgfZ.js";import{d as ie,u as x}from"./useEvent-WUlsM6MC.js";import{Bn as de,Fn as ne,T as se,ar as re,cr as ce,ir as he,lt as me,mt as pe,or as ke,v as fe,wt as K,yi as ue}from"./cells-DD42bsu7.js";import{t as ye}from"./compiler-runtime-B3qBwwSJ.js";import{a as be,o as xe,r as je}from"./utils-CORJ8yYa.js";import{t as ve}from"./jsx-runtime-CP2fAiZX.js";import{r as Ce}from"./requests-DZy_SQ_v.js";import{t as f}from"./createLucideIcon-BvP5LBIs.js";import{n as V,r as G}from"./x-yqLqiq5Q.js";import{a as ge,h as Ie}from"./download-CmObLKP6.js";import{t as we}from"./chevron-right-_z3dkNFy.js";import{t as Q}from"./circle-plus-DfyUnSPr.js";import{t as ze}from"./code-xml-BMv1Dtd2.js";import{t as We}from"./eye-off-DgTL09j7.js";import{t as Me}from"./image-CBwHq93J.js";import{t as _e}from"./link-BmtFffTv.js";import{t as Te}from"./play-CkqWG85-.js";import{a as Ae,n as Se}from"./state-DRCtQIWh.js";import{t as Ne}from"./trash-2-CrA4LwJ2.js";import{t as Be}from"./use-toast-Hc8CXlvz.js";import{a as De,c as Re,n as Ee}from"./dialog-D_1x0b57.js";import{n as He}from"./ImperativeModal-MjC9Owmv.js";import{t as Oe}from"./copy-CgddLxfF.js";import{r as F}from"./html-to-image-CojwvW9z.js";import{t as Pe}from"./label-OL3StKg2.js";import{t as Ue}from"./useDeleteCell-CrSQfQw4.js";import{n as qe,t as Le}from"./icons-B9sHgc9n.js";import{n as $}from"./name-cell-input-HEC8dShQ.js";import{t as J}from"./multi-icon-BFa-He80.js";import{t as Fe}from"./useSplitCell-BL-Sir7Y.js";var X=f("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),Y=f("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Z=f("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]),Ke=f("text-cursor-input",[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]]),ee=f("zap-off",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),le=f("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function Ve(a){let e=new URL(window.location.href);return e.hash=`scrollTo=${encodeURIComponent(a)}`,e.toString()}function Ge(a){var c;let e=(c=a.match(/scrollTo=([^&]+)/))==null?void 0:c[1];return e?decodeURIComponent(e.split("&")[0]):null}function te(a){return a==="_"?!1:!!(a&&a.trim().length>0)}var Qe=ye(),l=ae(ve(),1);function $e(a){let e=(0,Qe.c)(47),{cell:c,closePopover:u}=a,{createNewCell:h,updateCellConfig:n,updateCellName:j,moveCell:p,sendToTop:W,sendToBottom:M,addColumnBreakpoint:_,clearCellOutput:T,markUntouched:A}=se(),S=Fe(),N=pe(c==null?void 0:c.cellId),B=!x(fe),D=Ue(),{openModal:v}=He(),R=ie(Se),E=x(je),y=x(xe),oe=x(me),b=x(be),{saveCellConfig:s}=Ce();if(!c||oe){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0],t}let{cellId:o,config:i,getEditorView:r,name:m,hasOutput:C,hasConsoleOutput:H,status:O}=c,g;e[1]!==o||e[2]!==i.disabled||e[3]!==s||e[4]!==n?(g=async()=>{let t={disabled:!i.disabled};await s({configs:{[o]:t}}),n({cellId:o,config:t})},e[1]=o,e[2]=i.disabled,e[3]=s,e[4]=n,e[5]=g):g=e[5];let P=g,I;e[6]!==o||e[7]!==i.hide_code||e[8]!==r||e[9]!==s||e[10]!==n?(I=async()=>{let t={hide_code:!i.hide_code};await s({configs:{[o]:t}}),n({cellId:o,config:t});let L=r();L&&(t.hide_code?L.contentDOM.blur():L.focus())},e[6]=o,e[7]=i.hide_code,e[8]=r,e[9]=s,e[10]=n,e[11]=I):I=e[11];let U=I,d=o===ue,w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=(0,l.jsx)(Te,{size:13,strokeWidth:1.5}),e[12]=w):w=e[12];let q=O==="running"||O==="queued"||O==="disabled-transitively"||i.disabled,k;e[13]===N?k=e[14]:(k=()=>N(),e[13]=N,e[14]=k);let z;return e[15]!==_||e[16]!==E||e[17]!==b||e[18]!==y||e[19]!==B||e[20]!==o||e[21]!==T||e[22]!==u||e[23]!==i.disabled||e[24]!==i.hide_code||e[25]!==h||e[26]!==D||e[27]!==r||e[28]!==H||e[29]!==C||e[30]!==d||e[31]!==A||e[32]!==p||e[33]!==m||e[34]!==v||e[35]!==s||e[36]!==M||e[37]!==W||e[38]!==R||e[39]!==S||e[40]!==q||e[41]!==k||e[42]!==P||e[43]!==U||e[44]!==n||e[45]!==j?(z=[[{icon:w,label:"Run cell",hotkey:"cell.run",hidden:q,redundant:!0,handle:k},{icon:(0,l.jsx)(Ae,{size:13,strokeWidth:1.5}),label:"Refactor with AI",hidden:!E,handle:()=>{R(t=>(t==null?void 0:t.cellId)===o?null:{cellId:o})},hotkey:"cell.aiCompletion"},{icon:(0,l.jsx)(Z,{size:13,strokeWidth:1.5}),label:"Split",hotkey:"cell.splitCell",handle:()=>S({cellId:o})},{icon:(0,l.jsx)(ze,{size:13,strokeWidth:1.5}),label:"Format",hotkey:"cell.format",handle:()=>{let t=r();t&&de({[o]:t})}},{icon:i.hide_code?(0,l.jsx)(he,{size:13,strokeWidth:1.5}):(0,l.jsx)(We,{size:13,strokeWidth:1.5}),label:i.hide_code?"Show code":"Hide code",handle:U,hotkey:"cell.hideCode"},{icon:i.disabled?(0,l.jsx)(ee,{size:13,strokeWidth:1.5}):(0,l.jsx)(le,{size:13,strokeWidth:1.5}),label:i.disabled?"Enable execution":"Disable execution",handle:P,hidden:d}],[{icon:(0,l.jsx)(Le,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:async()=>{let t=r();t&&(F({autoInstantiate:y,createNewCell:h}),K(t,{language:"markdown",keepCodeAsIs:!1}),i.hide_code||(await s({configs:{[o]:{hide_code:!0}}}),n({cellId:o,config:{hide_code:!0}}),A({cellId:o})))},hidden:d},{icon:(0,l.jsx)(re,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{let t=r();t&&(F({autoInstantiate:y,createNewCell:h}),K(t,{language:"sql",keepCodeAsIs:!1}))},hidden:d},{icon:(0,l.jsx)(qe,{}),label:"Toggle as Python",handle:()=>{let t=r();t&&(F({autoInstantiate:y,createNewCell:h}),ne(t,"python",{force:!0}))},hidden:d}],[{icon:(0,l.jsxs)(J,{children:[(0,l.jsx)(Q,{size:13,strokeWidth:1.5}),(0,l.jsx)(V,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>h({cellId:o,before:!0}),hidden:d,redundant:!0},{icon:(0,l.jsxs)(J,{children:[(0,l.jsx)(Q,{size:13,strokeWidth:1.5}),(0,l.jsx)(G,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>h({cellId:o,before:!1}),redundant:!0},{icon:(0,l.jsx)(V,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>p({cellId:o,before:!0}),hidden:d},{icon:(0,l.jsx)(G,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>p({cellId:o,before:!1}),hidden:d},{icon:(0,l.jsx)(Ie,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>p({cellId:o,direction:"left"}),hidden:b!=="columns"||d},{icon:(0,l.jsx)(we,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>p({cellId:o,direction:"right"}),hidden:b!=="columns"||d},{icon:(0,l.jsx)(Y,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>W({cellId:o,scroll:!1}),hidden:d},{icon:(0,l.jsx)(X,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>M({cellId:o,scroll:!1}),hidden:d},{icon:(0,l.jsx)(ke,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",handle:()=>_({cellId:o}),hidden:b!=="columns"||d}],[{icon:(0,l.jsx)(Me,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!C,handle:()=>ge(o,"result")},{icon:(0,l.jsx)(ce,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(C||H),handle:()=>{T({cellId:o})}}],[{icon:(0,l.jsx)(Ke,{size:13,strokeWidth:1.5}),label:"Name",disableClick:!0,handle:Ze,handleHeadless:()=>{v((0,l.jsxs)(Ee,{children:[(0,l.jsx)(De,{children:(0,l.jsx)(Re,{children:"Rename cell"})}),(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)(Pe,{htmlFor:"cell-name",children:"Cell name"}),(0,l.jsx)($,{placeholder:"cell name",value:m,onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),t.stopPropagation(),v(null))},onChange:t=>j({cellId:o,name:t})})]})]}))},rightElement:(0,l.jsx)($,{placeholder:"cell name",value:m,onChange:t=>j({cellId:o,name:t}),onEnterKey:()=>u==null?void 0:u()}),hidden:d},{icon:(0,l.jsx)(_e,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!te(m),tooltip:te(m)?void 0:"Only named cells can be linked to",handle:async()=>{await Oe(Ve(m)),Be({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!B,variant:"danger",icon:(0,l.jsx)(Ne,{size:13,strokeWidth:1.5}),handle:()=>{D({cellId:o})}}]].map(Xe).filter(Je),e[15]=_,e[16]=E,e[17]=b,e[18]=y,e[19]=B,e[20]=o,e[21]=T,e[22]=u,e[23]=i.disabled,e[24]=i.hide_code,e[25]=h,e[26]=D,e[27]=r,e[28]=H,e[29]=C,e[30]=d,e[31]=A,e[32]=p,e[33]=m,e[34]=v,e[35]=s,e[36]=M,e[37]=W,e[38]=R,e[39]=S,e[40]=q,e[41]=k,e[42]=P,e[43]=U,e[44]=n,e[45]=j,e[46]=z):z=e[46],z}function Je(a){return a.length>0}function Xe(a){return a.filter(Ye)}function Ye(a){return!a.hidden}function Ze(a){a==null||a.stopPropagation(),a==null||a.preventDefault()}export{Z as a,ee as i,Ge as n,Y as o,le as r,X as s,$e as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as v}from"./chunk-LvLJmgfZ.js";import{i as m,n as u}from"./useEvent-WUlsM6MC.js";import{T as p,b as D,v as h}from"./cells-
|
|
1
|
+
import{s as v}from"./chunk-LvLJmgfZ.js";import{i as m,n as u}from"./useEvent-WUlsM6MC.js";import{T as p,b as D,v as h}from"./cells-DD42bsu7.js";import{t as C}from"./compiler-runtime-B3qBwwSJ.js";import{t as I}from"./useEventListener-CjXriKgk.js";import{t as x}from"./jsx-runtime-CP2fAiZX.js";import{t as _}from"./button-BmOH9agK.js";import{r as b}from"./requests-DZy_SQ_v.js";import{t as g}from"./use-toast-Hc8CXlvz.js";import{n as j}from"./renderShortcut-_nl5_jRy.js";var w=C(),d=v(x(),1);const f=e=>{let t=(0,w.c)(7),l;t[0]===e?l=t[1]:(l=a=>{var s;(a.ctrlKey||a.metaKey)&&a.key==="z"&&(a.preventDefault(),a.stopPropagation(),(s=e.onClick)==null||s.call(e,a))},t[0]=e,t[1]=l);let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r={capture:!0},t[2]=r):r=t[2],I(window,"keydown",l,r);let o=e.children??"Undo",i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,d.jsx)(j,{className:"ml-2",shortcut:"cmd-z"}),t[3]=i):i=t[3];let n;return t[4]!==o||t[5]!==e?(n=(0,d.jsxs)(_,{"data-testid":"undo-button",size:"sm",variant:"outline",...e,children:[o," ",i]}),t[4]=o,t[5]=e,t[6]=n):n=t[6],n};var y=C();function z(){let e=(0,y.c)(4),{deleteCell:t,undoDeleteCell:l}=p(),{sendDeleteCell:r}=b(),o;return e[0]!==t||e[1]!==r||e[2]!==l?(o=i=>{var s;if(m.get(h))return;let{cellId:n}=i,a=(((s=m.get(D).cellData[n])==null?void 0:s.code)??"").trim()==="";if(t({cellId:n}),r({cellId:n}).catch(()=>{l()}),!a){let{dismiss:c}=g({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:(0,d.jsx)(f,{"data-testid":"undo-delete-button",onClick:()=>{l(),k()}})}),k=c}},e[0]=t,e[1]=r,e[2]=l,e[3]=o):o=e[3],u(o)}function K(){let e=(0,y.c)(4),{deleteCell:t,undoDeleteCell:l}=p(),{sendDeleteCell:r}=b(),o;return e[0]!==t||e[1]!==r||e[2]!==l?(o=async i=>{if(m.get(h))return;let{cellIds:n}=i;for(let c of n)await r({cellId:c}).then(()=>{t({cellId:c})});let{dismiss:a}=g({title:"Cells deleted",action:(0,d.jsx)(f,{"data-testid":"undo-delete-button",onClick:()=>{for(let c of n)l();s()}})}),s=a},e[0]=t,e[1]=r,e[2]=l,e[3]=o):o=e[3],u(o)}export{K as n,f as r,z as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as M}from"./chunk-LvLJmgfZ.js";import{d as X,l as Y,n as V,p as Z,u as $}from"./useEvent-WUlsM6MC.js";import{t as ee}from"./react-Bj1aDYRI.js";import{W as te,kt as re}from"./cells-
|
|
1
|
+
import{s as M}from"./chunk-LvLJmgfZ.js";import{d as X,l as Y,n as V,p as Z,u as $}from"./useEvent-WUlsM6MC.js";import{t as ee}from"./react-Bj1aDYRI.js";import{W as te,kt as re}from"./cells-DD42bsu7.js";import{t as W}from"./compiler-runtime-B3qBwwSJ.js";import{t as le}from"./jsx-runtime-CP2fAiZX.js";import{t as ae}from"./cn-d_A4rA-x.js";import{t as ne}from"./createLucideIcon-BvP5LBIs.js";import{t as se}from"./useCellActionButton-HNTLhSrv.js";import{a as oe,n as ie,o as ce,t as me}from"./tooltip-oM-h2ZN1.js";import{d as de}from"./alert-dialog-DEeW2awP.js";import{i as B,r as he,t as G}from"./popover-C7N9RyXk.js";import{a as pe,c as fe,i as ue,o as xe,r as je,t as be,u as ye}from"./command-2Li9iWG_.js";import{n as ve}from"./focus-DiPb_hn6.js";import{a as Ne,i as ge}from"./renderShortcut-_nl5_jRy.js";var ke=ne("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),J=W(),h=M(ee(),1),t=M(le(),1);const K=h.memo(h.forwardRef((r,a)=>{let e=(0,J.c)(39),{children:n,showTooltip:c,...m}=r,p=c===void 0?!0:c,[d,I]=(0,h.useState)(!1),N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N=()=>I(!1),e[0]=N):N=e[0];let U=N,D=(0,h.useRef)(null),E=se({cell:m,closePopover:U}).map(Ce).filter(_e),P=de(),g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{te(()=>{D.current&&D.current.scrollIntoView({behavior:"auto",block:"nearest"})})},e[1]=g):g=e[1];let T=V(g),k;e[2]===T?k=e[3]:(k=s=>{I(o=>{let l=typeof s=="function"?s(o):s;return l&&T(),l})},e[2]=T,e[3]=k);let i=V(k),w;e[4]===i?w=e[5]:(w=()=>({toggle:()=>i(Se)}),e[4]=i,e[5]=w),(0,h.useImperativeHandle)(a,w);let O=he,A=be,F=re(m.cellId),f;e[6]===F?f=e[7]:(f=(0,t.jsx)(pe,{placeholder:"Search actions...",className:"h-6 m-1",...F}),e[6]=F,e[7]=f);let H=ye,u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)(je,{children:"No results"}),e[8]=u):u=e[8];let R=E.map((s,o)=>(0,t.jsxs)(h.Fragment,{children:[(0,t.jsx)(ue,{children:s.map(l=>{let z=(0,t.jsxs)("div",{className:"flex items-center flex-1",children:[l.icon&&(0,t.jsx)("div",{className:"mr-2 w-5 text-muted-foreground",children:l.icon}),(0,t.jsx)("div",{className:"flex-1",children:l.label}),(0,t.jsxs)("div",{className:"shrink-0 text-sm",children:[l.hotkey&&ge(l.hotkey),l.rightElement]})]});return l.tooltip&&(z=(0,t.jsx)(me,{content:l.tooltip,delayDuration:100,children:z})),(0,t.jsx)(xe,{className:ae(l.disabled&&"opacity-50!"),onSelect:()=>{l.disableClick||l.disabled||(l.handle(),I(!1))},variant:l.variant,children:z},l.label)})},o),o<E.length-1&&(0,t.jsx)(fe,{})]},o)),x;e[9]!==H||e[10]!==u||e[11]!==R?(x=(0,t.jsxs)(H,{children:[u,R]}),e[9]=H,e[10]=u,e[11]=R,e[12]=x):x=e[12];let j;e[13]!==A||e[14]!==x||e[15]!==f?(j=(0,t.jsxs)(A,{children:[f,x]}),e[13]=A,e[14]=x,e[15]=f,e[16]=j):j=e[16];let C;e[17]!==O||e[18]!==P||e[19]!==j?(C=(0,t.jsx)(O,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...P,children:j}),e[17]=O,e[18]=P,e[19]=j,e[20]=C):C=e[20];let b=C;if(!p){let s;e[21]===n?s=e[22]:(s=(0,t.jsx)(B,{asChild:!0,children:n}),e[21]=n,e[22]=s);let o;return e[23]!==b||e[24]!==i||e[25]!==d||e[26]!==s?(o=(0,t.jsxs)(G,{open:d,onOpenChange:i,children:[s,b]}),e[23]=b,e[24]=i,e[25]=d,e[26]=s,e[27]=o):o=e[27],o}let _;e[28]===Symbol.for("react.memo_cache_sentinel")?(_=(0,t.jsx)(ie,{tabIndex:-1,children:Ne("cell.cellActions")}),e[28]=_):_=e[28];let q=!d&&_,y;e[29]===n?y=e[30]:(y=(0,t.jsx)(ce,{ref:D,children:(0,t.jsx)(B,{className:"flex",children:n})}),e[29]=n,e[30]=y);let v;e[31]!==q||e[32]!==y?(v=(0,t.jsxs)(oe,{delayDuration:200,disableHoverableContent:!0,children:[q,y]}),e[31]=q,e[32]=y,e[33]=v):v=e[33];let S;return e[34]!==b||e[35]!==i||e[36]!==d||e[37]!==v?(S=(0,t.jsxs)(G,{open:d,onOpenChange:i,children:[v,b]}),e[34]=b,e[35]=i,e[36]=d,e[37]=v,e[38]=S):S=e[38],S})),L=h.memo(r=>{let a=(0,J.c)(5),{children:e,cellId:n}=r,c;a[0]===n?c=a[1]:(c=ve(n),a[0]=n,a[1]=c);let m=$(c);if(!m)return null;let p;return a[2]!==e||a[3]!==m?(p=(0,t.jsx)(K,{showTooltip:!1,...m,children:e}),a[2]=e,a[3]=m,a[4]=p):p=a[4],p});L.displayName="ConnectionCellActionsDropdown";function we(r){return!r.redundant}function Ce(r){return r.filter(we)}function _e(r){return r.length>0}function Se(r){return!r}var Ie=W();const Q=Z("minimap");function De(){let r=(0,Ie.c)(3),[a,e]=Y(Q),n;return r[0]!==a||r[1]!==e?(n={dependencyPanelTab:a,setDependencyPanelTab:e},r[0]=a,r[1]=e,r[2]=n):n=r[2],n}function Pe(){return X(Q)}export{ke as a,L as i,Pe as n,K as r,De as t};
|
|
@@ -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 Ge,En as me,Gt as Ke,Nr as Je,Sn as Xe,T as ue,_ as Ze,_i as oe,ar as Qe,cr as et,dt as fe,h as ye,lt as tt,pr as at,pt as ot,rr as nt,t as it,ut as lt,xn as st}from"./cells-BLMrU2yT.js";import{t as W}from"./compiler-runtime-B3qBwwSJ.js";import{n as rt}from"./assertNever-Dw9aFN4h.js";import{s as be}from"./useLifecycle-BDXC6oVR.js";import{n as dt}from"./add-database-form-BzZFhGKo.js";import{n as ct,x as ht}from"./ai-model-dropdown-ZWTWzd6H.js";import{c as xe,m as T}from"./useEventListener-CjXriKgk.js";import{y as pt}from"./utils-CORJ8yYa.js";import{n as _,t as ke}from"./constants-CdR60lKM.js";import{S as we,h as mt,x as ut}from"./config-CBwelk8k.js";import{t as ft}from"./jsx-runtime-CP2fAiZX.js";import{r as yt,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 ge,f as bt,i as je,m as xt,p as ve,u as Ce}from"./layout-Dhkk-WXJ.js";import{t as ze}from"./check-BnZGcuDh.js";import{c as kt,d as Me,n as wt,o as gt,r as We,t as jt}from"./download-BcxPm3qL.js";import{f as vt}from"./maps-8VTEe-0T.js";import{r as Ct}from"./useCellActionButton-BxsLH3DI.js";import{t as zt}from"./copy-CAR4dOiD.js";import{t as Mt}from"./download-BG-iMGgV.js";import{t as Wt}from"./eye-off-DgTL09j7.js";import{t as _t}from"./file-plus-corner-BRwJx0yp.js";import{t as ie}from"./file-DVwc11C3.js";import{n as St,t as Dt}from"./links-cVjWsr05.js";import{t as At}from"./globe-B68kre4p.js";import{n as Nt,r as Et,t as Pt}from"./youtube-DfMgNU9-.js";import{n as It,t as Tt}from"./square-DZpWT_hp.js";import{t as Lt}from"./image-CBwHq93J.js";import{t as Ht}from"./link-BmtFffTv.js";import{r as qt}from"./input-B49Srsl9.js";import{t as Rt}from"./settings-DRfuuLRT.js";import{y as Ft}from"./textarea-BNIM0Vlg.js";import{t as C}from"./use-toast-Hc8CXlvz.js";import{n as _e,t as Vt}from"./paths-D2lG83Oh.js";import{o as Bt}from"./session-Deuv0Lgh.js";import{a as Ot,c as Ut,i as Yt,n as $t,r as Gt,s as Kt,t as Jt}from"./select-BRK_BOoG.js";import{t as Xt}from"./tooltip-oM-h2ZN1.js";import{o as Zt}from"./alert-dialog-DEeW2awP.js";import{a as Qt,c as ea,i as ta,n as aa,r as oa}from"./dialog-D_1x0b57.js";import{n as le}from"./ImperativeModal-MjC9Owmv.js";import{r as na,t as ia}from"./share-BpyH3qLa.js";import{t as K}from"./copy-CgddLxfF.js";import{a as la}from"./cell-link-Cqbep4Gr.js";import{a as Se}from"./renderShortcut-_nl5_jRy.js";import{t as sa}from"./icons-B9sHgc9n.js";import{t as De}from"./types-D4wsSrXa.js";var ra=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),da=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Ae=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"}]]),Ne=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"}]]),ca=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"}]]),ha=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"}]]),pa=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"}]]),Pe=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"}]]),ma=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"}]]),ua=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Ie=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"}]]),fa=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"}]]),ya=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"}]]),Te=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"}]]),Le=W(),se=pe($e(),1),a=pe(ft(),1),J="https://static.marimo.app";const ba=e=>{let t=(0,Le.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 D=await r({download:!1,includeCode:!0,files:bt.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:D,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)(xa,{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 xa=e=>{let t=(0,Le.c)(8),[n,o]=se.useState(!1),l;t[0]===e.text?l=t[1]:(l=yt.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)(zt,{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},ka=W();function wa(){let e=document.getElementsByClassName(ke.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 ga(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(`.${ke.outputArea}`)){T.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function He(){let e=(0,ka.c)(2),t=I(fe),n;return e[0]===t?n=e[1]:(n=()=>{let o=wa();t(l=>({mode:lt(l.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{ga(o)})})},e[0]=t,e[1]=n),n}const qe=Ye(!1);var ja=W();const va=()=>{let e=(0,ja.c)(7),{selectedLayout:t}=ge(),{setLayoutView:n}=je();if(we()&&!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)(Ut,{placeholder:"Select a view"})}),e[2]=l):l=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)($t,{children:(0,a.jsxs)(Gt,{children:[(0,a.jsx)(Ot,{children:"View as"}),De.map(za)]})}),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 Ca(e){return(0,a.jsx)(Re(e),{className:"h-4 w-4"})}function Re(e){switch(e){case"vertical":return ma;case"grid":return Et;case"slides":return Ie;default:return rt(e),Tt}}function Fe(e){return be(e)}function za(e){return(0,a.jsx)(Yt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Ca(e),(0,a.jsx)("span",{children:Fe(e)})]})},e)}async function Ma(e){let{filename:t,preset:n,downloadPDF:o}=e;await o({filename:t,webpdf:!0,preset:n,includeInputs:!1,rasterServer:"live"})}var Wa=W();function _a(e){let t=(0,Wa.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:`_${_e.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=s.join(_e.dirname(e),i);l({source:e,destination:d}).then(()=>{o(),C({title:"Notebook copied",description:"A copy of the notebook has been created."}),Dt(d)})}})},t[0]=o,t[1]=n,t[2]=l,t[3]=e,t[4]=r):r=t[4],r}const Sa=()=>{let{updateCellConfig:e}=ue(),{saveCellConfig:t}=L();return(0,se.useCallback)(async()=>{let n=new Ke,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=xe.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 Ve(){let e=(0,Da.c)(4),{openConfirm:t}=le(),n=I(mt),{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:ut.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 Aa=W(),S=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Na(){var ce,he;let e=(0,Aa.c)(42),t=la(),{openModal:n,closeModal:o}=le(),{toggleApplication:l}=st(),{selectedPanel:r}=Xe(),[s]=Ue(fe),i=ae(tt),d=Sa(),[p]=pt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:u,addSetupCellIfDoesntExist:f,collapseAllCells:y,expandAllCells:b}=ue(),x=Ve(),k=ot(),j=_a(t),v=I(qe),D=I(ct),z=I(ht),{exportAsMarkdown:X,readCode:A,saveCellConfig:Z}=L(),Q=ae(Ze),ee=ae(it),{selectedLayout:H}=ge(),{setLayoutView:te}=je(),q=He(),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,E=N||s.mode==="present",B=H==="slides",Be=Ja,de=Ka,O;e[1]===t?O=e[2]:(O=async c=>{let{preset:m,title:P}=c;if(!t){re();return}await kt(P,async()=>{await Ma({filename:t,preset:m,downloadPDF:wt})})},e[1]=t,e[2]=O);let U=O,Y;e[3]===Symbol.for("react.memo_cache_sentinel")?(Y=(0,a.jsx)(Mt,{size:14,strokeWidth:1.5}),e[3]=Y):Y=e[3];let $;e[4]===Symbol.for("react.memo_cache_sentinel")?($=(0,a.jsx)(ve,{size:14,strokeWidth:1.5}),e[4]=$):$=e[4];let M;e[5]===t?M=e[6]:(M=async()=>{if(!t){re();return}await Ce({filename:t,includeCode:!0})},e[5]=t,e[6]=M);let G;return e[7]!==f||e[8]!==ee||e[9]!==u||e[10]!==o||e[11]!==y||e[12]!==j||e[13]!==U||e[14]!==b||e[15]!==X||e[16]!==t||e[17]!==Q||e[18]!==d||e[19]!==B||e[20]!==i||e[21]!==n||e[22]!==E||e[23]!==A||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]!==D||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?(G=[{icon:Y,label:"Download",handle:S,dropdown:[{icon:$,label:"Download as HTML",handle:M},{icon:(0,a.jsx)(ve,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){re();return}await Ce({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});We(new Blob([c],{type:"text/plain"}),Me.toMarkdown(document.title))}},{icon:(0,a.jsx)(xt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await A();We(new Blob([c.contents],{type:"text/plain"}),Me.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: ",Se("global.hideCode",!1)]}),handle:Ga},{divider:!0,icon:(0,a.jsx)(ie,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:S,disabled:!E&&!N,dropdown:[{icon:(0,a.jsx)(ie,{size:14,strokeWidth:1.5}),label:"Document Layout",rightElement:de(!B),disabled:!E,tooltip:E?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Se("global.hideCode",!1)]}),handle:async()=>{if(N){await U({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(B),disabled:!N,tooltip:N?void 0:(0,a.jsx)("span",{children:"Requires Better PDF Export in Settings > Experimental."}),handle:async()=>{await U({preset:"slides",title:"Downloading Slides PDF..."})}}]}]},{icon:(0,a.jsx)(fa,{size:14,strokeWidth:1.5}),label:"Share",handle:S,hidden:!R&&!F,dropdown:[{icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!R,handle:async()=>{n((0,a.jsx)(ba,{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 A()).contents})),C({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:S,dropdown:Ge.flatMap(c=>{let{type:m,Icon:P,hidden:Oe}=c;return Oe?[]:{label:be(m),rightElement:Be(r===m),icon:(0,a.jsx)(P,{size:14,strokeWidth:1.5}),handle:()=>l(m)}})},{icon:(0,a.jsx)(Ie,{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)(Pe,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{q()}},...De.map((c,m)=>{let P=Re(c);return{divider:m===0,label:Fe(c),icon:(0,a.jsx)(P,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:H===c&&(0,a.jsx)(ze,{size:14})}),handle:()=>{te(c),s.mode==="edit"&&q()}}})]},{icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||we(),handle:j},{icon:(0,a.jsx)(Ae,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await K((await A()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(Ct,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!Q||i,handle:async()=>{let c=Je(ye());await Z({configs:xe.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)(Qe,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(dt,{onClose:o}))}},{icon:(0,a.jsx)(Te,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!ee||i,handle:()=>{g()}},{icon:(0,a.jsx)(ya,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:x},{icon:(0,a.jsx)(ca,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{k()}},{icon:(0,a.jsx)(et,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{u()}},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:y,redundant:!0},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:b,redundant:!0},{divider:!0,icon:(0,a.jsx)(Ne,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(Ua)},{icon:(0,a.jsx)(pa,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(Oa)},{icon:(0,a.jsx)(Rt,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>D(Ba),redundant:!0},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Resources",handle:S,dropdown:[{icon:(0,a.jsx)(at,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Va},{icon:(0,a.jsx)(St,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Fa},{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:Ra},{icon:(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:qa},{icon:(0,a.jsx)(nt,{size:14,strokeWidth:1.5}),label:"Changelog",handle:Ha}]},{divider:!0,icon:(0,a.jsx)(It,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:La},{icon:(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Ta}].filter(Ia).map(Ea),e[7]=f,e[8]=ee,e[9]=u,e[10]=o,e[11]=y,e[12]=j,e[13]=U,e[14]=b,e[15]=X,e[16]=t,e[17]=Q,e[18]=d,e[19]=B,e[20]=i,e[21]=n,e[22]=E,e[23]=A,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]=D,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]=G):G=e[41],G}function Ea(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Pa)}:e}function Pa(e){return!e.hidden}function Ia(e){return!e.hidden}function Ta(){let e=Bt();window.open(e,"_blank")}function La(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function Ha(){window.open(_.releasesPage,"_blank")}function qa(){window.open(_.youtube,"_blank")}function Ra(){window.open(_.discordLink,"_blank")}function Fa(){window.open(_.githubPage,"_blank")}function Va(){window.open(_.docsPage,"_blank")}function Ba(e){return!e}function Oa(e){return!e}function Ua(e){return!e}function Ya(e){return[e,{disabled:!1}]}function $a(){return window.print()}async function Ga(){let e=document.getElementById("App");e&&await gt({element:e,filename:document.title,prepare:jt})}function Ka(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 Ja(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(ze,{size:14})})}function re(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{He as a,Ee as c,qe as i,Ne as l,Ve as n,Te as o,va as r,Pe as s,Na as t,Ae 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 Ge,En as me,Gt as Ke,Nr as Je,Sn as Xe,T as ue,_ as Ze,_i as oe,ar as Qe,cr as et,dt as fe,h as ye,lt as tt,pr as at,pt as ot,rr as nt,t as it,ut as lt,xn as st}from"./cells-DD42bsu7.js";import{t as W}from"./compiler-runtime-B3qBwwSJ.js";import{n as rt}from"./assertNever-Dw9aFN4h.js";import{s as be}from"./useLifecycle-BDXC6oVR.js";import{n as dt}from"./add-database-form-D06OUuSg.js";import{n as ct,x as ht}from"./ai-model-dropdown-BnQGs6GF.js";import{c as xe,m as T}from"./useEventListener-CjXriKgk.js";import{y as pt}from"./utils-CORJ8yYa.js";import{n as _,t as ke}from"./constants-CdR60lKM.js";import{S as we,h as mt,x as ut}from"./config-CBwelk8k.js";import{t as ft}from"./jsx-runtime-CP2fAiZX.js";import{r as yt,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 ge,f as bt,i as je,m as xt,p as ve,u as Ce}from"./layout-D1VtP7GQ.js";import{t as ze}from"./check-BnZGcuDh.js";import{c as kt,d as Me,n as wt,o as gt,r as We,t as jt}from"./download-CmObLKP6.js";import{f as vt}from"./maps-8VTEe-0T.js";import{r as Ct}from"./useCellActionButton-HNTLhSrv.js";import{t as zt}from"./copy-CAR4dOiD.js";import{t as Mt}from"./download-BG-iMGgV.js";import{t as Wt}from"./eye-off-DgTL09j7.js";import{t as _t}from"./file-plus-corner-BRwJx0yp.js";import{t as ie}from"./file-DVwc11C3.js";import{n as St,t as Dt}from"./links-cVjWsr05.js";import{t as At}from"./globe-B68kre4p.js";import{n as Nt,r as Et,t as Pt}from"./youtube-DfMgNU9-.js";import{n as It,t as Tt}from"./square-DZpWT_hp.js";import{t as Lt}from"./image-CBwHq93J.js";import{t as Ht}from"./link-BmtFffTv.js";import{r as qt}from"./input-B49Srsl9.js";import{t as Rt}from"./settings-DRfuuLRT.js";import{y as Ft}from"./textarea-noyX_YEw.js";import{t as C}from"./use-toast-Hc8CXlvz.js";import{n as _e,t as Vt}from"./paths-D2lG83Oh.js";import{o as Bt}from"./session-Deuv0Lgh.js";import{a as Ot,c as Ut,i as Yt,n as $t,r as Gt,s as Kt,t as Jt}from"./select-BRK_BOoG.js";import{t as Xt}from"./tooltip-oM-h2ZN1.js";import{o as Zt}from"./alert-dialog-DEeW2awP.js";import{a as Qt,c as ea,i as ta,n as aa,r as oa}from"./dialog-D_1x0b57.js";import{n as le}from"./ImperativeModal-MjC9Owmv.js";import{r as na,t as ia}from"./share-BpyH3qLa.js";import{t as K}from"./copy-CgddLxfF.js";import{a as la}from"./cell-link-CiQrWiPA.js";import{a as Se}from"./renderShortcut-_nl5_jRy.js";import{t as sa}from"./icons-B9sHgc9n.js";import{t as De}from"./types-D4wsSrXa.js";var ra=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),da=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Ae=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"}]]),Ne=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"}]]),ca=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"}]]),ha=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"}]]),pa=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"}]]),Pe=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"}]]),ma=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"}]]),ua=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Ie=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"}]]),fa=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"}]]),ya=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"}]]),Te=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"}]]),Le=W(),se=pe($e(),1),a=pe(ft(),1),J="https://static.marimo.app";const ba=e=>{let t=(0,Le.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 D=await r({download:!1,includeCode:!0,files:bt.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:D,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)(xa,{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 xa=e=>{let t=(0,Le.c)(8),[n,o]=se.useState(!1),l;t[0]===e.text?l=t[1]:(l=yt.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)(zt,{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},ka=W();function wa(){let e=document.getElementsByClassName(ke.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 ga(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(`.${ke.outputArea}`)){T.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function He(){let e=(0,ka.c)(2),t=I(fe),n;return e[0]===t?n=e[1]:(n=()=>{let o=wa();t(l=>({mode:lt(l.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{ga(o)})})},e[0]=t,e[1]=n),n}const qe=Ye(!1);var ja=W();const va=()=>{let e=(0,ja.c)(7),{selectedLayout:t}=ge(),{setLayoutView:n}=je();if(we()&&!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)(Ut,{placeholder:"Select a view"})}),e[2]=l):l=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)($t,{children:(0,a.jsxs)(Gt,{children:[(0,a.jsx)(Ot,{children:"View as"}),De.map(za)]})}),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 Ca(e){return(0,a.jsx)(Re(e),{className:"h-4 w-4"})}function Re(e){switch(e){case"vertical":return ma;case"grid":return Et;case"slides":return Ie;default:return rt(e),Tt}}function Fe(e){return be(e)}function za(e){return(0,a.jsx)(Yt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Ca(e),(0,a.jsx)("span",{children:Fe(e)})]})},e)}async function Ma(e){let{filename:t,preset:n,downloadPDF:o}=e;await o({filename:t,webpdf:!0,preset:n,includeInputs:!1,rasterServer:"live"})}var Wa=W();function _a(e){let t=(0,Wa.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:`_${_e.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=s.join(_e.dirname(e),i);l({source:e,destination:d}).then(()=>{o(),C({title:"Notebook copied",description:"A copy of the notebook has been created."}),Dt(d)})}})},t[0]=o,t[1]=n,t[2]=l,t[3]=e,t[4]=r):r=t[4],r}const Sa=()=>{let{updateCellConfig:e}=ue(),{saveCellConfig:t}=L();return(0,se.useCallback)(async()=>{let n=new Ke,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=xe.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 Ve(){let e=(0,Da.c)(4),{openConfirm:t}=le(),n=I(mt),{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:ut.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 Aa=W(),S=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Na(){var ce,he;let e=(0,Aa.c)(42),t=la(),{openModal:n,closeModal:o}=le(),{toggleApplication:l}=st(),{selectedPanel:r}=Xe(),[s]=Ue(fe),i=ae(tt),d=Sa(),[p]=pt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:u,addSetupCellIfDoesntExist:f,collapseAllCells:y,expandAllCells:b}=ue(),x=Ve(),k=ot(),j=_a(t),v=I(qe),D=I(ct),z=I(ht),{exportAsMarkdown:X,readCode:A,saveCellConfig:Z}=L(),Q=ae(Ze),ee=ae(it),{selectedLayout:H}=ge(),{setLayoutView:te}=je(),q=He(),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,E=N||s.mode==="present",B=H==="slides",Be=Ja,de=Ka,O;e[1]===t?O=e[2]:(O=async c=>{let{preset:m,title:P}=c;if(!t){re();return}await kt(P,async()=>{await Ma({filename:t,preset:m,downloadPDF:wt})})},e[1]=t,e[2]=O);let U=O,Y;e[3]===Symbol.for("react.memo_cache_sentinel")?(Y=(0,a.jsx)(Mt,{size:14,strokeWidth:1.5}),e[3]=Y):Y=e[3];let $;e[4]===Symbol.for("react.memo_cache_sentinel")?($=(0,a.jsx)(ve,{size:14,strokeWidth:1.5}),e[4]=$):$=e[4];let M;e[5]===t?M=e[6]:(M=async()=>{if(!t){re();return}await Ce({filename:t,includeCode:!0})},e[5]=t,e[6]=M);let G;return e[7]!==f||e[8]!==ee||e[9]!==u||e[10]!==o||e[11]!==y||e[12]!==j||e[13]!==U||e[14]!==b||e[15]!==X||e[16]!==t||e[17]!==Q||e[18]!==d||e[19]!==B||e[20]!==i||e[21]!==n||e[22]!==E||e[23]!==A||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]!==D||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?(G=[{icon:Y,label:"Download",handle:S,dropdown:[{icon:$,label:"Download as HTML",handle:M},{icon:(0,a.jsx)(ve,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){re();return}await Ce({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});We(new Blob([c],{type:"text/plain"}),Me.toMarkdown(document.title))}},{icon:(0,a.jsx)(xt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await A();We(new Blob([c.contents],{type:"text/plain"}),Me.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: ",Se("global.hideCode",!1)]}),handle:Ga},{divider:!0,icon:(0,a.jsx)(ie,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:S,disabled:!E&&!N,dropdown:[{icon:(0,a.jsx)(ie,{size:14,strokeWidth:1.5}),label:"Document Layout",rightElement:de(!B),disabled:!E,tooltip:E?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Se("global.hideCode",!1)]}),handle:async()=>{if(N){await U({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(B),disabled:!N,tooltip:N?void 0:(0,a.jsx)("span",{children:"Requires Better PDF Export in Settings > Experimental."}),handle:async()=>{await U({preset:"slides",title:"Downloading Slides PDF..."})}}]}]},{icon:(0,a.jsx)(fa,{size:14,strokeWidth:1.5}),label:"Share",handle:S,hidden:!R&&!F,dropdown:[{icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!R,handle:async()=>{n((0,a.jsx)(ba,{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 A()).contents})),C({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:S,dropdown:Ge.flatMap(c=>{let{type:m,Icon:P,hidden:Oe}=c;return Oe?[]:{label:be(m),rightElement:Be(r===m),icon:(0,a.jsx)(P,{size:14,strokeWidth:1.5}),handle:()=>l(m)}})},{icon:(0,a.jsx)(Ie,{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)(Pe,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{q()}},...De.map((c,m)=>{let P=Re(c);return{divider:m===0,label:Fe(c),icon:(0,a.jsx)(P,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:H===c&&(0,a.jsx)(ze,{size:14})}),handle:()=>{te(c),s.mode==="edit"&&q()}}})]},{icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||we(),handle:j},{icon:(0,a.jsx)(Ae,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await K((await A()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(Ct,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!Q||i,handle:async()=>{let c=Je(ye());await Z({configs:xe.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)(Qe,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(dt,{onClose:o}))}},{icon:(0,a.jsx)(Te,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!ee||i,handle:()=>{g()}},{icon:(0,a.jsx)(ya,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:x},{icon:(0,a.jsx)(ca,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{k()}},{icon:(0,a.jsx)(et,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{u()}},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:y,redundant:!0},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:b,redundant:!0},{divider:!0,icon:(0,a.jsx)(Ne,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(Ua)},{icon:(0,a.jsx)(pa,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(Oa)},{icon:(0,a.jsx)(Rt,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>D(Ba),redundant:!0},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Resources",handle:S,dropdown:[{icon:(0,a.jsx)(at,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Va},{icon:(0,a.jsx)(St,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Fa},{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:Ra},{icon:(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:qa},{icon:(0,a.jsx)(nt,{size:14,strokeWidth:1.5}),label:"Changelog",handle:Ha}]},{divider:!0,icon:(0,a.jsx)(It,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:La},{icon:(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Ta}].filter(Ia).map(Ea),e[7]=f,e[8]=ee,e[9]=u,e[10]=o,e[11]=y,e[12]=j,e[13]=U,e[14]=b,e[15]=X,e[16]=t,e[17]=Q,e[18]=d,e[19]=B,e[20]=i,e[21]=n,e[22]=E,e[23]=A,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]=D,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]=G):G=e[41],G}function Ea(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Pa)}:e}function Pa(e){return!e.hidden}function Ia(e){return!e.hidden}function Ta(){let e=Bt();window.open(e,"_blank")}function La(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function Ha(){window.open(_.releasesPage,"_blank")}function qa(){window.open(_.youtube,"_blank")}function Ra(){window.open(_.discordLink,"_blank")}function Fa(){window.open(_.githubPage,"_blank")}function Va(){window.open(_.docsPage,"_blank")}function Ba(e){return!e}function Oa(e){return!e}function Ua(e){return!e}function Ya(e){return[e,{disabled:!1}]}function $a(){return window.print()}async function Ga(){let e=document.getElementById("App");e&&await gt({element:e,filename:document.title,prepare:jt})}function Ka(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 Ja(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(ze,{size:14})})}function re(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{He as a,Ee as c,qe as i,Ne as l,Ve as n,Te as o,va as r,Pe as s,Na as t,Ae 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-
|
|
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-DD42bsu7.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-Hc8CXlvz.js";import{r as v}from"./useDeleteCell-CrSQfQw4.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-
|
|
69
|
+
<script type="module" crossorigin src="./assets/index-B-ghuCiq.js"></script>
|
|
70
70
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-BW0IMuFq.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-
|
|
138
|
+
<link rel="modulepreload" crossorigin href="./assets/cells-DD42bsu7.js">
|
|
139
139
|
<link rel="modulepreload" crossorigin href="./assets/spinner-Dt4SmUsI.js">
|
|
140
140
|
<link rel="modulepreload" crossorigin href="./assets/chevron-right-_z3dkNFy.js">
|
|
141
141
|
<link rel="modulepreload" crossorigin href="./assets/dropdown-menu-D9u7_h0R.js">
|
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
<link rel="modulepreload" crossorigin href="./assets/dist-jtXWG2b1.js">
|
|
150
150
|
<link rel="modulepreload" crossorigin href="./assets/label-OL3StKg2.js">
|
|
151
151
|
<link rel="modulepreload" crossorigin href="./assets/useDebounce-S9zaMzrr.js">
|
|
152
|
-
<link rel="modulepreload" crossorigin href="./assets/textarea-
|
|
152
|
+
<link rel="modulepreload" crossorigin href="./assets/textarea-noyX_YEw.js">
|
|
153
153
|
<link rel="modulepreload" crossorigin href="./assets/numbers-CPeFd6mm.js">
|
|
154
154
|
<link rel="modulepreload" crossorigin href="./assets/SSRProvider-CwqN9FWV.js">
|
|
155
155
|
<link rel="modulepreload" crossorigin href="./assets/context-CRApIvpB.js">
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
<link rel="modulepreload" crossorigin href="./assets/input-B49Srsl9.js">
|
|
159
159
|
<link rel="modulepreload" crossorigin href="./assets/links-MkDbmF2p.js">
|
|
160
160
|
<link rel="modulepreload" crossorigin href="./assets/popover-C7N9RyXk.js">
|
|
161
|
-
<link rel="modulepreload" crossorigin href="./assets/switch-
|
|
161
|
+
<link rel="modulepreload" crossorigin href="./assets/switch-CA8la81g.js">
|
|
162
162
|
<link rel="modulepreload" crossorigin href="./assets/table-FXVKPW36.js">
|
|
163
163
|
<link rel="modulepreload" crossorigin href="./assets/useAsyncData-CI3ntihq.js">
|
|
164
164
|
<link rel="modulepreload" crossorigin href="./assets/errors-0IrrdfSG.js">
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
<link rel="modulepreload" crossorigin href="./assets/refresh-cw-fLeDriQe.js">
|
|
173
173
|
<link rel="modulepreload" crossorigin href="./assets/trash-2-CrA4LwJ2.js">
|
|
174
174
|
<link rel="modulepreload" crossorigin href="./assets/azure-B7oWrJc_.js">
|
|
175
|
-
<link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-
|
|
175
|
+
<link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-BnQGs6GF.js">
|
|
176
176
|
<link rel="modulepreload" crossorigin href="./assets/defaultLocale-CuYNS33t.js">
|
|
177
177
|
<link rel="modulepreload" crossorigin href="./assets/precisionRound-CCOoIlcP.js">
|
|
178
178
|
<link rel="modulepreload" crossorigin href="./assets/defaultLocale-CGfP-Ye3.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-chfmZzat.js">
|
|
183
183
|
<link rel="modulepreload" crossorigin href="./assets/ImperativeModal-MjC9Owmv.js">
|
|
184
|
-
<link rel="modulepreload" crossorigin href="./assets/cell-link-
|
|
185
|
-
<link rel="modulepreload" crossorigin href="./assets/datasource-
|
|
186
|
-
<link rel="modulepreload" crossorigin href="./assets/state-
|
|
187
|
-
<link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-
|
|
184
|
+
<link rel="modulepreload" crossorigin href="./assets/cell-link-CiQrWiPA.js">
|
|
185
|
+
<link rel="modulepreload" crossorigin href="./assets/datasource-Cturxb4x.js">
|
|
186
|
+
<link rel="modulepreload" crossorigin href="./assets/state-DRCtQIWh.js">
|
|
187
|
+
<link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-BJkHPKWK.js">
|
|
188
188
|
<link rel="modulepreload" crossorigin href="./assets/copy-icon-HFU_6E8O.js">
|
|
189
|
-
<link rel="modulepreload" crossorigin href="./assets/html-to-image-
|
|
190
|
-
<link rel="modulepreload" crossorigin href="./assets/focus-
|
|
189
|
+
<link rel="modulepreload" crossorigin href="./assets/html-to-image-CojwvW9z.js">
|
|
190
|
+
<link rel="modulepreload" crossorigin href="./assets/focus-DiPb_hn6.js">
|
|
191
191
|
<link rel="modulepreload" crossorigin href="./assets/LazyAnyLanguageCodeMirror-DIzh1FyL.js">
|
|
192
192
|
<link rel="modulepreload" crossorigin href="./assets/chunk-5FQGJX7Z-CKJM3d7z.js">
|
|
193
193
|
<link rel="modulepreload" crossorigin href="./assets/katex-FSdXOW5Y.js">
|
|
194
|
-
<link rel="modulepreload" crossorigin href="./assets/markdown-renderer-
|
|
195
|
-
<link rel="modulepreload" crossorigin href="./assets/command-
|
|
196
|
-
<link rel="modulepreload" crossorigin href="./assets/download-
|
|
197
|
-
<link rel="modulepreload" crossorigin href="./assets/RenderHTML-
|
|
194
|
+
<link rel="modulepreload" crossorigin href="./assets/markdown-renderer-YOedNAkc.js">
|
|
195
|
+
<link rel="modulepreload" crossorigin href="./assets/command-2Li9iWG_.js">
|
|
196
|
+
<link rel="modulepreload" crossorigin href="./assets/download-CmObLKP6.js">
|
|
197
|
+
<link rel="modulepreload" crossorigin href="./assets/RenderHTML-CjCJ1DT4.js">
|
|
198
198
|
<link rel="modulepreload" crossorigin href="./assets/useIframeCapabilities-Ba0L-TQN.js">
|
|
199
199
|
<link rel="modulepreload" crossorigin href="./assets/formats-B4v3ZpGs.js">
|
|
200
200
|
<link rel="modulepreload" crossorigin href="./assets/en-US-k6sS5Nab.js">
|
|
@@ -206,39 +206,39 @@
|
|
|
206
206
|
<link rel="modulepreload" crossorigin href="./assets/useDateFormatter-DfEfyPT1.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-
|
|
210
|
-
<link rel="modulepreload" crossorigin href="./assets/useDeleteCell-
|
|
209
|
+
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-uf7OFaDU.js">
|
|
210
|
+
<link rel="modulepreload" crossorigin href="./assets/useDeleteCell-CrSQfQw4.js">
|
|
211
211
|
<link rel="modulepreload" crossorigin href="./assets/icons-B9sHgc9n.js">
|
|
212
|
-
<link rel="modulepreload" crossorigin href="./assets/process-output-
|
|
212
|
+
<link rel="modulepreload" crossorigin href="./assets/process-output-B2WHFsM0.js">
|
|
213
213
|
<link rel="modulepreload" crossorigin href="./assets/blob-DgooIGjS.js">
|
|
214
214
|
<link rel="modulepreload" crossorigin href="./assets/objectWithoutPropertiesLoose-CboCOq4o.js">
|
|
215
215
|
<link rel="modulepreload" crossorigin href="./assets/esm-Dm5bJp7V.js">
|
|
216
216
|
<link rel="modulepreload" crossorigin href="./assets/file-DVwc11C3.js">
|
|
217
217
|
<link rel="modulepreload" crossorigin href="./assets/image-CBwHq93J.js">
|
|
218
218
|
<link rel="modulepreload" crossorigin href="./assets/play-CkqWG85-.js">
|
|
219
|
-
<link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-
|
|
219
|
+
<link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-DJ9tuL4g.js">
|
|
220
220
|
<link rel="modulepreload" crossorigin href="./assets/isEmpty-9KlyX4nB.js">
|
|
221
221
|
<link rel="modulepreload" crossorigin href="./assets/bot-message-square-BzawfL5p.js">
|
|
222
|
-
<link rel="modulepreload" crossorigin href="./assets/chat-display-
|
|
222
|
+
<link rel="modulepreload" crossorigin href="./assets/chat-display-DN0dzai8.js">
|
|
223
223
|
<link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-F2DZENgf.js">
|
|
224
224
|
<link rel="modulepreload" crossorigin href="./assets/square-function-DEp1ozoA.js">
|
|
225
225
|
<link rel="modulepreload" crossorigin href="./assets/spec-CcvA_Vlj.js">
|
|
226
|
-
<link rel="modulepreload" crossorigin href="./assets/components-
|
|
227
|
-
<link rel="modulepreload" crossorigin href="./assets/column-preview-
|
|
226
|
+
<link rel="modulepreload" crossorigin href="./assets/components-Bl0CtJtz.js">
|
|
227
|
+
<link rel="modulepreload" crossorigin href="./assets/column-preview-BtKDi4j6.js">
|
|
228
228
|
<link rel="modulepreload" crossorigin href="./assets/toggle-MO7vjfkt.js">
|
|
229
|
-
<link rel="modulepreload" crossorigin href="./assets/globals-
|
|
229
|
+
<link rel="modulepreload" crossorigin href="./assets/globals-Dk7VGE85.js">
|
|
230
230
|
<link rel="modulepreload" crossorigin href="./assets/share-BpyH3qLa.js">
|
|
231
231
|
<link rel="modulepreload" crossorigin href="./assets/_baseSet-BEHvSeoM.js">
|
|
232
232
|
<link rel="modulepreload" crossorigin href="./assets/react-resizable-panels.browser.esm-DDRqG5ui.js">
|
|
233
|
-
<link rel="modulepreload" crossorigin href="./assets/context-aware-panel-
|
|
234
|
-
<link rel="modulepreload" crossorigin href="./assets/floating-outline-
|
|
235
|
-
<link rel="modulepreload" crossorigin href="./assets/useAddCell-
|
|
233
|
+
<link rel="modulepreload" crossorigin href="./assets/context-aware-panel-DMHGbB_b.js">
|
|
234
|
+
<link rel="modulepreload" crossorigin href="./assets/floating-outline-BPv4P2vV.js">
|
|
235
|
+
<link rel="modulepreload" crossorigin href="./assets/useAddCell-DVMY6vkv.js">
|
|
236
236
|
<link rel="modulepreload" crossorigin href="./assets/eye-off-DgTL09j7.js">
|
|
237
|
-
<link rel="modulepreload" crossorigin href="./assets/readonly-python-code-
|
|
237
|
+
<link rel="modulepreload" crossorigin href="./assets/readonly-python-code-XphqxCq8.js">
|
|
238
238
|
<link rel="modulepreload" crossorigin href="./assets/file-video-camera-Fa5c_iPb.js">
|
|
239
|
-
<link rel="modulepreload" crossorigin href="./assets/types-
|
|
239
|
+
<link rel="modulepreload" crossorigin href="./assets/types-DYD6UxTH.js">
|
|
240
240
|
<link rel="modulepreload" crossorigin href="./assets/refresh-ccw-B3lGEyQm.js">
|
|
241
|
-
<link rel="modulepreload" crossorigin href="./assets/form-
|
|
241
|
+
<link rel="modulepreload" crossorigin href="./assets/form-ibH0eKd-.js">
|
|
242
242
|
<link rel="modulepreload" crossorigin href="./assets/field-Cgpys-pp.js">
|
|
243
243
|
<link rel="modulepreload" crossorigin href="./assets/useBoolean-Den0ZqeZ.js">
|
|
244
244
|
<link rel="modulepreload" crossorigin href="./assets/useDeepCompareMemoize-yyiB9aJX.js">
|
package/package.json
CHANGED
|
@@ -288,9 +288,54 @@ describe("sanitizeHtml", () => {
|
|
|
288
288
|
expect(sanitizeHtml(html)).toMatchInlineSnapshot(`"<div>Text</div>"`);
|
|
289
289
|
});
|
|
290
290
|
|
|
291
|
-
test("
|
|
291
|
+
test("preserves use element in SVG", () => {
|
|
292
292
|
const html = '<svg><use xlink:href="#icon"></use></svg>';
|
|
293
|
-
expect(sanitizeHtml(html)).toMatchInlineSnapshot(
|
|
293
|
+
expect(sanitizeHtml(html)).toMatchInlineSnapshot(
|
|
294
|
+
`"<svg><use xlink:href="#icon"></use></svg>"`,
|
|
295
|
+
);
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
test("preserves SVG defs and use pattern", () => {
|
|
299
|
+
const html = [
|
|
300
|
+
'<svg width="60" height="60">',
|
|
301
|
+
'<circle cx="30" cy="30" r="30" fill="orange"></circle>',
|
|
302
|
+
'<defs><circle id="myCircle" cx="0" cy="0" r="10" fill="green"></circle></defs>',
|
|
303
|
+
'<use href="#myCircle" x="20" y="20"></use>',
|
|
304
|
+
"</svg>",
|
|
305
|
+
].join("");
|
|
306
|
+
expect(sanitizeHtml(html)).toMatchInlineSnapshot(
|
|
307
|
+
`"<svg width="60" height="60"><circle cx="30" cy="30" r="30" fill="orange"></circle><defs><circle id="myCircle" cx="0" cy="0" r="10" fill="green"></circle></defs><use href="#myCircle" x="20" y="20"></use></svg>"`,
|
|
308
|
+
);
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
test("strips javascript: href from SVG use element", () => {
|
|
312
|
+
const html = '<svg><use href="javascript:alert(1)"></use></svg>';
|
|
313
|
+
expect(sanitizeHtml(html)).toMatchInlineSnapshot(
|
|
314
|
+
`"<svg><use></use></svg>"`,
|
|
315
|
+
);
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
test("strips javascript: xlink:href from SVG use element", () => {
|
|
319
|
+
const html = '<svg><use xlink:href="javascript:alert(1)"></use></svg>';
|
|
320
|
+
expect(sanitizeHtml(html)).toMatchInlineSnapshot(
|
|
321
|
+
`"<svg><use></use></svg>"`,
|
|
322
|
+
);
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
test("preserves external href on SVG use element", () => {
|
|
326
|
+
const html =
|
|
327
|
+
'<svg><use href="https://example.com/sprite.svg#icon"></use></svg>';
|
|
328
|
+
expect(sanitizeHtml(html)).toMatchInlineSnapshot(
|
|
329
|
+
`"<svg><use href="https://example.com/sprite.svg#icon"></use></svg>"`,
|
|
330
|
+
);
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
test("preserves external xlink:href on SVG use element", () => {
|
|
334
|
+
const html =
|
|
335
|
+
'<svg><use xlink:href="https://example.com/sprite.svg#icon"></use></svg>';
|
|
336
|
+
expect(sanitizeHtml(html)).toMatchInlineSnapshot(
|
|
337
|
+
`"<svg><use xlink:href="https://example.com/sprite.svg#icon"></use></svg>"`,
|
|
338
|
+
);
|
|
294
339
|
});
|
|
295
340
|
|
|
296
341
|
test("removes javascript in SVG href", () => {
|
|
@@ -74,6 +74,10 @@ export function sanitizeHtml(html: string) {
|
|
|
74
74
|
const sanitizationOptions: Config = {
|
|
75
75
|
// Default to permit HTML, SVG and MathML, this limits to HTML only
|
|
76
76
|
USE_PROFILES: { html: true, svg: true, mathMl: true },
|
|
77
|
+
// Allow SVG <use> elements and their href attributes, which are needed
|
|
78
|
+
// for SVGs that reference <defs> (e.g., Matplotlib SVG output).
|
|
79
|
+
ADD_TAGS: ["use"],
|
|
80
|
+
ADD_ATTR: ["href", "xlink:href"],
|
|
77
81
|
// glue elements like style, script or others to document.body and prevent unintuitive browser behavior in several edge-cases
|
|
78
82
|
FORCE_BODY: true,
|
|
79
83
|
CUSTOM_ELEMENT_HANDLING: {
|