@marimo-team/frontend 0.22.5-dev2 → 0.22.5-dev21
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-HZQ0Twqj.js → CellStatus-CP1jrQ3A.js} +1 -1
- package/dist/assets/{ConnectedDataExplorerComponent-C9jSHm_Y.js → ConnectedDataExplorerComponent-CfU-ThkK.js} +1 -1
- package/dist/assets/{ImperativeModal-Ka_MU6gk.js → ImperativeModal-DoGv2BXV.js} +1 -1
- package/dist/assets/JsonOutput-Bk2by9qo.js +49 -0
- package/dist/assets/{LazyAnyLanguageCodeMirror-Bb2dITRz.js → LazyAnyLanguageCodeMirror-CoYqQxHb.js} +2 -2
- package/dist/assets/MarimoErrorOutput-Cyd8ikG3.js +7 -0
- package/dist/assets/RSPContexts-LWFBF00h.js +1 -0
- package/dist/assets/{RenderHTML-Cyj8OBbz.js → RenderHTML-BOW_1WUn.js} +1 -1
- package/dist/assets/{add-cell-with-ai-BccDsMLb.js → add-cell-with-ai-DUq7Y523.js} +9 -9
- package/dist/assets/{add-connection-dialog-BO_nxLQi.js → add-connection-dialog-20N0EHLl.js} +1 -1
- package/dist/assets/{agent-panel-BMTl3Cgd.js → agent-panel-DEza5aFa.js} +3 -3
- package/dist/assets/{ai-model-dropdown-CS5ryevV.js → ai-model-dropdown-B-sbS07W.js} +4 -4
- package/dist/assets/{any-language-editor-BKxF_o5k.js → any-language-editor-DYgTL8eG.js} +1 -1
- package/dist/assets/app-config-button-CJFpYJ_2.js +1 -0
- package/dist/assets/{cache-panel-PA0cVzei.js → cache-panel-8E_Y5OSb.js} +1 -1
- package/dist/assets/{cell-editor-qLPKK49y.js → cell-editor-DLL6kX__.js} +11 -11
- package/dist/assets/{cell-link-CY7i_e4O.js → cell-link-Dtonmtv_.js} +1 -1
- package/dist/assets/{cells-CuaAKcwV.js → cells-BVG4a-Qn.js} +42 -42
- package/dist/assets/{chat-display-BLYrUQhO.js → chat-display-DsIGz-Wy.js} +1 -1
- package/dist/assets/{chat-panel-w9jaKRAD.js → chat-panel-aXOgktdv.js} +2 -2
- package/dist/assets/{chat-ui-BqpUGrwS.js → chat-ui-C--RApyx.js} +4 -4
- package/dist/assets/{column-preview-Dk6-wUK-.js → column-preview-CB_HZPdz.js} +1 -1
- package/dist/assets/{command-DkwDd6Ey.js → command-DvF_4mQa.js} +1 -1
- package/dist/assets/{command-palette-C0hZrhup.js → command-palette-DLKNdcX_.js} +1 -1
- package/dist/assets/{common-CL1iSwod.js → common-CLVI2BhO.js} +1 -1
- package/dist/assets/{components-CBihADZo.js → components-CGwwQ0Y4.js} +1 -1
- package/dist/assets/{components-CtOW1DR4.js → components-DiALLQRt.js} +1 -1
- package/dist/assets/{copy-icon-n6r2uyq3.js → copy-icon-BGs1Pbai.js} +1 -1
- package/dist/assets/{datasource-DwmhT5-D.js → datasource-BzTPyEw3.js} +1 -1
- package/dist/assets/{dependency-graph-panel-3AdEtWPZ.js → dependency-graph-panel-Pxmnzmd4.js} +1 -1
- package/dist/assets/{diagram-PSM6KHXK-D6nw8Fvd.js → diagram-PSM6KHXK-UdiW7QQb.js} +1 -1
- package/dist/assets/{documentation-panel-CVIUk8ga.js → documentation-panel-bgaPBvan.js} +1 -1
- package/dist/assets/{download-pkTDt-sj.js → download-QIfZjflb.js} +3 -3
- package/dist/assets/{edit-page-6Fpl3Fez.js → edit-page-DB_go-vo.js} +7 -7
- package/dist/assets/{error-banner-Bfe6BopK.js → error-banner-bXc_9BBZ.js} +1 -1
- package/dist/assets/{error-panel-Cy3_isDL.js → error-panel-DfHzC7q-.js} +1 -1
- package/dist/assets/{field-CXDGiU3T.js → field-DTzXkFLZ.js} +1 -1
- package/dist/assets/{file-explorer-panel-qM-Iflzm.js → file-explorer-panel-CEd-m832.js} +3 -3
- package/dist/assets/{file-icons-DaGma7HH.js → file-icons-ma7AC7Pi.js} +1 -1
- package/dist/assets/{floating-outline-oPCmn9_F.js → floating-outline-BluCz3vD.js} +1 -1
- package/dist/assets/{focus-B524Cy57.js → focus-BHXzPxK_.js} +1 -1
- package/dist/assets/{form-IHIhviLb.js → form-C0W8wa3f.js} +1 -1
- package/dist/assets/{formats-DC_7w22O.js → formats-BQHP_yQk.js} +1 -1
- package/dist/assets/{formatting-Dw_0ktP1.js → formatting-BCAZDWQ0.js} +1 -1
- package/dist/assets/{gallery-page-DCkpFwYi.js → gallery-page-XSrY7bw_.js} +1 -1
- package/dist/assets/{ganttDiagram-JELNMOA3-BC4H0xrj.js → ganttDiagram-JELNMOA3-KWj06bYC.js} +1 -1
- package/dist/assets/{glide-data-editor-BkvzN8Tk.js → glide-data-editor-Bd4FOxvW.js} +1 -1
- package/dist/assets/{home-page-bB7oHRxE.js → home-page-nNrKA7jH.js} +2 -2
- package/dist/assets/{hooks-DmeHnl8J.js → hooks-C7qnb_ft.js} +1 -1
- package/dist/assets/{html-to-image-C-c-Hfuw.js → html-to-image-B3VySJ1_.js} +1 -1
- package/dist/assets/index-CLnKZIHZ.js +42 -0
- package/dist/assets/index-DBs2il8a.css +2 -0
- package/dist/assets/input-Bg12i6qY.js +1 -0
- package/dist/assets/{kiosk-mode-CnJjuo6B.js → kiosk-mode-BSY8y4kL.js} +1 -1
- package/dist/assets/{layout-Ce-vzLs_.js → layout-V4eTNc4M.js} +3 -3
- package/dist/assets/{linear-bY7qDnP9.js → linear-BICTUQLW.js} +1 -1
- package/dist/assets/{logs-panel-CzlMq5La.js → logs-panel-B1AysC8S.js} +1 -1
- package/dist/assets/{markdown-renderer-B4-BiMy9.js → markdown-renderer-BiKTlki_.js} +1 -1
- package/dist/assets/{mermaid-DDNZ06H7.js → mermaid-BJFSZcG6.js} +3 -3
- package/dist/assets/{name-cell-input-CUG9-cgv.js → name-cell-input-BA5B0KJl.js} +1 -1
- package/dist/assets/{outline-panel-BXefyCJ4.js → outline-panel-BfGPA_Sj.js} +1 -1
- package/dist/assets/{packages-panel-Bc42thuF.js → packages-panel-BgoT3rrV.js} +1 -1
- package/dist/assets/{panels-xqtEg2DV.js → panels-BeW4RaML.js} +1 -1
- package/dist/assets/{pieDiagram-ADFJNKIX-BeLuFsHa.js → pieDiagram-ADFJNKIX-ixj1Ihpk.js} +1 -1
- package/dist/assets/{precisionRound-D8yxZYIF.js → precisionRound-CU2C3Vxx.js} +1 -1
- package/dist/assets/{process-output-C-VBRULx.js → process-output-MnxG8jwi.js} +1 -1
- package/dist/assets/{quadrantDiagram-AYHSOK5B-7-MiutmN.js → quadrantDiagram-AYHSOK5B-DAgQxEHI.js} +1 -1
- package/dist/assets/{react-vega-LNfJwi6n.js → react-vega-BVBnH7ue.js} +1 -1
- package/dist/assets/react-vega-BfEZWy9T.js +1 -0
- package/dist/assets/{readonly-python-code-DinZuT8P.js → readonly-python-code-DuH_nOq_.js} +1 -1
- package/dist/assets/{run-page-GmVLTzzU.js → run-page-kI3bwb2R.js} +1 -1
- package/dist/assets/{sankeyDiagram-TZEHDZUN-DuPJkvrj.js → sankeyDiagram-TZEHDZUN-DAWWzAvZ.js} +1 -1
- package/dist/assets/{scratchpad-panel-CnzHN40A.js → scratchpad-panel-617FvSKA.js} +1 -1
- package/dist/assets/{secrets-panel-DxBoNgTM.js → secrets-panel-C6X5jB8Q.js} +1 -1
- package/dist/assets/{session-panel-CpeJADG_.js → session-panel-D6Sf5vhq.js} +1 -1
- package/dist/assets/snippets-panel-DfWq0wh2.js +1 -0
- package/dist/assets/{state-9-n7I_Bo.js → state-BgrGQPFs.js} +1 -1
- package/dist/assets/{state-DuVk71Dw.js → state-Blw6taKi.js} +1 -1
- package/dist/assets/{state-oW8A8maF.js → state-urfwd716.js} +2 -2
- package/dist/assets/{terminal-bXHNLBHU.js → terminal-BBTjIXBz.js} +3 -3
- package/dist/assets/{textarea-CI3yaazO.js → textarea-B5p9_myy.js} +1 -1
- package/dist/assets/{time-BdrzW2P6.js → time-DLcLlk0u.js} +1 -1
- package/dist/assets/{tracing-BRo4IXxX.js → tracing-CazNvlp4.js} +1 -1
- package/dist/assets/{tracing-panel-7QrwywKQ.js → tracing-panel-Bj0Bx8ZJ.js} +2 -2
- package/dist/assets/{useAddCell-BMYemCZ-.js → useAddCell-g3zSMJKs.js} +1 -1
- package/dist/assets/{useAsyncData-CaAFMbY9.js → useAsyncData-aCoWDe-l.js} +1 -1
- package/dist/assets/useBoolean-ugd5JdXd.js +1 -0
- package/dist/assets/{useCellActionButton-DMySRby1.js → useCellActionButton-DdsVswP2.js} +1 -1
- package/dist/assets/{useDateFormatter-BBQkEV05.js → useDateFormatter-BEz9SEXo.js} +1 -1
- package/dist/assets/{useDeleteCell-6SLN_jZa.js → useDeleteCell-CIdiI4Pk.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-DRoK7Mvg.js → useDependencyPanelTab-DhXqfAqL.js} +1 -1
- package/dist/assets/{useNotebookActions-SGiWvk1I.js → useNotebookActions-ULfiGMMl.js} +1 -1
- package/dist/assets/{useNumberFormatter-DIM21HH4.js → useNumberFormatter-wQU1z0W_.js} +1 -1
- package/dist/assets/{usePress-CLNv4Iws.js → usePress-BXMIcLWP.js} +3 -3
- package/dist/assets/{useRunCells-a5YC9YVQ.js → useRunCells-q5CA-QoL.js} +1 -1
- package/dist/assets/{useSplitCell-Dn4N4Evl.js → useSplitCell-B0jDwUEM.js} +1 -1
- package/dist/assets/{utils-BaSt_0sN.js → utils-BZwMGX81.js} +1 -1
- package/dist/assets/{vega-component-B_GT243z.js → vega-component-B2_J2GQq.js} +1 -1
- package/dist/assets/{vega-loader.browser-DLukqq1q.js → vega-loader.browser-DXARUlxo.js} +1 -1
- package/dist/assets/{write-secret-modal-C87c9nwO.js → write-secret-modal-CHfFN0H8.js} +1 -1
- package/dist/assets/{xychartDiagram-PRI3JC2R-BRVF_pwk.js → xychartDiagram-PRI3JC2R-DgjhbmH4.js} +1 -1
- package/dist/index.html +52 -51
- package/package.json +2 -2
- package/src/components/data-table/__tests__/columns.test.tsx +92 -13
- package/src/components/data-table/column-header.tsx +81 -56
- package/src/components/data-table/columns.tsx +25 -32
- package/src/components/data-table/data-table.tsx +8 -1
- package/src/components/data-table/renderers.tsx +19 -6
- package/src/components/data-table/types.ts +4 -0
- package/src/components/editor/errors/traceback-modal.tsx +6 -5
- package/src/components/editor/output/MarimoErrorOutput.tsx +7 -14
- package/src/components/editor/output/MarimoTracebackOutput.tsx +4 -3
- package/src/core/cells/document-changes.ts +12 -0
- package/src/core/saving/file-state.ts +16 -0
- package/src/hooks/useAsyncData.ts +1 -1
- package/src/mount.tsx +17 -1
- package/src/plugins/impl/DataTablePlugin.tsx +1 -1
- package/src/plugins/impl/plotly/__tests__/selection.test.ts +22 -0
- package/src/plugins/impl/plotly/selection.ts +1 -0
- package/dist/assets/JsonOutput-C0_rp6zm.js +0 -49
- package/dist/assets/MarimoErrorOutput-C3-dwG-M.js +0 -7
- package/dist/assets/VisuallyHidden-CuyBIaeU.js +0 -1
- package/dist/assets/app-config-button-2bbgrHC2.js +0 -1
- package/dist/assets/index-B2hkIK4p.js +0 -42
- package/dist/assets/index-BNN_F0CC.css +0 -2
- package/dist/assets/input-DfDSaPYh.js +0 -1
- package/dist/assets/react-vega-Bpff0f7C.js +0 -1
- package/dist/assets/snippets-panel-Z3fr4trp.js +0 -1
- package/dist/assets/useBoolean-Dsw5twOt.js +0 -1
- /package/dist/assets/{blob-Brr8JjWU.js → blob-CTort_or.js} +0 -0
- /package/dist/assets/{context-BoP98Msj.js → context-DGqo1TbK.js} +0 -0
- /package/dist/assets/{copy-Acb9G8ns.js → copy-Bizk-4hH.js} +0 -0
- /package/dist/assets/{defaultLocale-B8Omxjnr.js → defaultLocale-BLne0bXb.js} +0 -0
- /package/dist/assets/{defaultLocale-Cyhs3Xd2.js → defaultLocale-JieDVWC_.js} +0 -0
- /package/dist/assets/{dialog-Do1NuJPs.js → dialog-BYjetQgE.js} +0 -0
- /package/dist/assets/{errors-Dn17Z1-5.js → errors-CZb6hI2x.js} +0 -0
- /package/dist/assets/{numbers--q6KLqqK.js → numbers--nDjbAPa.js} +0 -0
- /package/dist/assets/{ordinal-CN_bk_zt.js → ordinal-DuTuuUgV.js} +0 -0
- /package/dist/assets/{range-BmYMHsC2.js → range-1DwpgXvM.js} +0 -0
- /package/dist/assets/{react-icons.esm-3sYgjjif.js → react-icons.esm-BUYTQ32a.js} +0 -0
- /package/dist/assets/{share-CkOka71S.js → share-0LPgOyiW.js} +0 -0
- /package/dist/assets/{useHotkey-CX3-tpiy.js → useHotkey-DALUNe8I.js} +0 -0
package/dist/assets/{LazyAnyLanguageCodeMirror-Bb2dITRz.js → LazyAnyLanguageCodeMirror-CoYqQxHb.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./any-language-editor-
|
|
2
|
-
import{s as e}from"./chunk-LvLJmgfZ.js";import{t as i}from"./react-Bj1aDYRI.js";import{t as o}from"./createLucideIcon-w-Qo9n0R.js";import{t as m}from"./preload-helper-D2MJg03u.js";let r,a,s=(async()=>{r=o("between-horizontal-start",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]),a=(0,e(i(),1).lazy)(()=>m(()=>import("./any-language-editor-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./any-language-editor-DYgTL8eG.js","./copy-icon-BGs1Pbai.js","./button-BKVLeSTX.js","./useEventListener-DGjKht0c.js","./compiler-runtime-B3qBwwSJ.js","./react-Bj1aDYRI.js","./chunk-LvLJmgfZ.js","./jsx-runtime-Blw4afVn.js","./cn-DYvqRARy.js","./clsx-XrBBnd7s.js","./tooltip-DmqhBBs6.js","./fullscreen-k58KVlT-.js","./react-dom-CSu739Rf.js","./dist-sZgjGm4S.js","./use-toast-BDYuj3zG.js","./copy-Bizk-4hH.js","./check-B-sKate2.js","./createLucideIcon-w-Qo9n0R.js","./copy-DFMsQ6MJ.js","./error-banner-bXc_9BBZ.js","./alert-dialog-CXspBRlP.js","./errors-CZb6hI2x.js","./zod-H_cgTO0M.js","./dist-DDiNOVwA.js","./dist-VwkX7yeV.js","./dist-CxquLoAZ.js","./dist-ByWFdhfz.js","./dist-BNTOYRCs.js","./dist-4lB-oR9j.js","./dist-Dnlw22ji.js","./dist-CHgkfE72.js","./dist-BYHplnRv.js","./dist-BvlMLwcr.js","./dist-04hxiWlB.js","./dist-CgYlATe-.js","./dist-B1XdVflW.js","./dist-Gx6Yy96j.js","./dist-Yk16cgLk.js","./dist-umvL589W.js","./esm-BqofWdD5.js","./extends-Co37_JfG.js","./objectWithoutPropertiesLoose-smPWkHxB.js","./dist-DZJfxwLb.js","./esm-D1fwWXHg.js","./dist-D281cBMB.js","./dist-CaQ_ONVt.js","./dist-BrR2nUId.js","./dist-BPkOpnKv.js","./dist-Dl90TzK0.js","./dist-bOlBcn5A.js","./apl-CArdF_Ee.js","./asciiarmor-rf6n_8YZ.js","./asn1-Bl4vlAxN.js","./brainfuck-CWRjg_-2.js","./clike-B4xEkWXN.js","./clojure-04C6o-hL.js","./cmake-Dh64a3j4.js","./cobol-B24ofC4q.js","./coffeescript-B0i0O-b-.js","./commonlisp-NXg-Bye5.js","./crystal-BOjNTZjx.js","./css-C_vknI7E.js","./cypher-DwQoZmH9.js","./d-xedQGhmO.js","./diff-ChFnp8JW.js","./dtd-KbDPyUs4.js","./dylan-0KH4Nowk.js","./ecl-B5iM_b7s.js","./eiffel-sVM1STl5.js","./elm-BlNENVB6.js","./erlang-C0uOSFok.js","./factor-B-0VZGQP.js","./simple-mode-DxeVZov3.js","./forth-Dkvgp5v0.js","./fortran-DWGt9NN5.js","./gas-ucVnXY28.js","./gherkin-BRjIORXo.js","./groovy-BwyAyRPC.js","./haskell-Cs-Andhs.js","./haxe-BW46cyaq.js","./idl-BGiQ18ct.js","./javascript-I9_Q-6Fg.js","./julia-Wfay9brY.js","./livescript-J6EnSQWw.js","./lua-BO_knq_Q.js","./mathematica-DU8ikXHk.js","./mbox-Dzzw6MxI.js","./mirc-82uLLidC.js","./mllike-WTbu2PGL.js","./modelica-w4uKZrXu.js","./mscgen-Bf7m7BDT.js","./mumps-Bicgf-gh.js","./nsis-DGDbP9K4.js","./ntriples-CyotCBD4.js","./octave-BP7UuRZ-.js","./oz-C9dsRBsA.js","./pascal-Do-HizJs.js","./perl-DkWjygEp.js","./pig-C5cO5Lzu.js","./powershell-B7iMkhi7.js","./properties-BojS2wNP.js","./protobuf-C3jQLUT4.js","./pug-5wW7Sn9S.js","./puppet-BIu7yw7Q.js","./python-BvK-LeGt.js","./q-DxTFD_3l.js","./r-D9kMb9Pl.js","./rpm-DMBmptJ_.js","./ruby-Bi66LQBu.js","./sas-DDMCLlZz.js","./scheme-MngEI34z.js","./shell-BSVgrHzY.js","./sieve-DvUWNrPv.js","./smalltalk-CeZ66qpG.js","./sparql-oFx_t7AO.js","./stex-jWatZkll.js","./stylus-KE-9LQSK.js","./swift-A-ZhZWU8.js","./tcl-CREXWwrr.js","./textile-Cj8L4qVJ.js","./toml-BwSlV2Pt.js","./troff-DWonWT6V.js","./ttcn-cfg-Cei3Mnk3.js","./ttcn--CHQduBW.js","./turtle-BaGuNPTf.js","./vb-DQgwufRi.js","./vbscript-B66XhQhu.js","./velocity-D7CxwqhZ.js","./verilog-SCT9zECa.js","./vhdl-Bz6d75os.js","./webidl-B7LbwCfy.js","./xquery-BOMK2ySj.js","./yacas-Yk74VuuD.js","./z80-BQKQ7DhX.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{s as e}from"./chunk-LvLJmgfZ.js";import{t as i}from"./react-Bj1aDYRI.js";import{t as o}from"./createLucideIcon-w-Qo9n0R.js";import{t as m}from"./preload-helper-D2MJg03u.js";let r,a,s=(async()=>{r=o("between-horizontal-start",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]),a=(0,e(i(),1).lazy)(()=>m(()=>import("./any-language-editor-DYgTL8eG.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133]),import.meta.url))})();export{s as __tla,r as n,a as t};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{s as J}from"./chunk-LvLJmgfZ.js";import{d as ve,f as Ne,l as be,u as ke}from"./useEvent-D91BmmQi.js";import{t as we}from"./react-Bj1aDYRI.js";import{E as Ie,Mn as $e,_i as _e,b as Fe,ii as K,ir as Ae,nt as Te,ri as Ce,wn as Me}from"./cells-BVG4a-Qn.js";import{t as q}from"./compiler-runtime-B3qBwwSJ.js";import{t as Se}from"./invariant-CkiqGLcK.js";import{r as ze}from"./utils-8btzWeZg.js";import{t as X}from"./cn-DYvqRARy.js";import{t as Ee}from"./jsx-runtime-Blw4afVn.js";import{a as qe,i as Pe,n as Le,r as We}from"./multi-map-MSuUqmbC.js";import{a as Ve,p as Be,r as Qe,t as De}from"./dropdown-menu-DrHAuMTb.js";import{t as Y}from"./tooltip-DmqhBBs6.js";import{r as Z,t as $}from"./button-BKVLeSTX.js";import{t as H}from"./createLucideIcon-w-Qo9n0R.js";import{r as Oe}from"./x-Bv2rCglF.js";import{t as He}from"./sparkles-B79Qf6ma.js";import{c as ee,n as Ue}from"./datasource-BzTPyEw3.js";import{a as Re}from"./dist-CgYlATe-.js";import{t as te}from"./RenderHTML-BOW_1WUn.js";import{t as re}from"./kbd-BUtlbGdu.js";import{t as A}from"./links-DOybeRem.js";import{r as Ge,t as Je}from"./alert-DF3HbVtk.js";import{o as Ke,t as Xe}from"./useInstallPackage-CeM6oPsT.js";import{n as Ye}from"./state-Blw6taKi.js";import{n as b}from"./cell-link-Dtonmtv_.js";var Ze=H("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]),T=H("square-arrow-out-up-right",[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]]),se=H("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);function et(t){let e=null,s=t.cursor();do s.name==="ExpressionStatement"&&(e=s.node);while(s.next());return e}function tt(t){let e=t.split(`
|
|
2
|
+
`),s=" ",n=et(Re.parse(t));if(!n)return["def _():",...U(e,s),`${s}return`,"","","_()"].join(`
|
|
3
|
+
`);let i=t.slice(0,n.from).trim(),l=t.slice(n.from).trim(),a=i.split(`
|
|
4
|
+
`),c=l.split(`
|
|
5
|
+
`);return["def _():",...U(a,s),`${s}return ${c[0]}`,...U(c.slice(1),s),"","","_()"].join(`
|
|
6
|
+
`)}function U(t,e){if(t.length===1&&t[0]==="")return[];let s=[];for(let n of t)n===""?s.push(""):s.push(e+n);return s}function rt(t,e){var s;if(t.type==="multiple-defs")return[{title:"Fix: Wrap in a function",description:"Make this cell's variables local by wrapping the cell in a function.",fixType:"manual",onFix:async n=>{Se(n.editor,"Editor is null");let i=tt(n.editor.state.doc.toString());n.editor.dispatch({changes:{from:0,to:n.editor.state.doc.length,insert:i}})}}];if(t.type==="exception"&&t.exception_type==="NameError"){let n=(s=t.msg.match(/name '(.+)' is not defined/))==null?void 0:s[1];if(!n||!(n in ne))return[];let i=st(n);return[{title:`Fix: Add '${i}'`,description:"Add a new cell for the missing import",fixType:"manual",onFix:async l=>{l.addCodeBelow(i)}}]}return t.type==="sql-error"&&e.aiEnabled?[{title:"Fix with AI",description:"Fix the SQL statement",fixType:"ai",onFix:async n=>{var a;let i=Ue(n.cellId),l=`Fix the SQL statement: ${t.msg}.`;i&&(l+=`
|
|
7
|
+
Database schema: ${i}`),(a=n.aiFix)==null||a.setAiCompletionCell({cellId:n.cellId,initialPrompt:l,triggerImmediately:n.aiFix.triggerFix})}}]:[]}function st(t){let e=ne[t];return e===t?`import ${e}`:`import ${e} as ${t}`}var ne={mo:"marimo",alt:"altair",bokeh:"bokeh",dask:"dask",np:"numpy",pd:"pandas",pl:"polars",plotly:"plotly",plt:"matplotlib.pyplot",px:"plotly.express",scipy:"scipy",sk:"sklearn",sns:"seaborn",stats:"scipy.stats",tf:"tensorflow",torch:"torch",xr:"xarray",dt:"datetime",json:"json",math:"math",os:"os",re:"re",sys:"sys"},nt=q(),lt=_e("marimo:ai-autofix-mode","autofix",$e);function it(){let t=(0,nt.c)(3),[e,s]=be(lt),n;return t[0]!==e||t[1]!==s?(n={fixMode:e,setFixMode:s},t[0]=e,t[1]=s,t[2]=n):n=t[2],n}var R=q(),r=J(Ee(),1);const N=t=>{let e=(0,R.c)(21),{errors:s,cellId:n,className:i}=t,l=Ne(),{createNewCell:a}=Ie(),c=ke(ze),o;if(e[0]!==c||e[1]!==s){let x;e[3]===c?x=e[4]:(x=y=>rt(y,{aiEnabled:c}),e[3]=c,e[4]=x),o=s.flatMap(x),e[0]=c,e[1]=s,e[2]=o}else o=e[2];let m=o,p=ve(Ye);if(m.length===0)return null;let d=m[0],f;e[5]!==n||e[6]!==a||e[7]!==d||e[8]!==p||e[9]!==l?(f=x=>{var k;let y=(k=l.get(Fe).cellHandles[n].current)==null?void 0:k.editorView;d.onFix({addCodeBelow:_=>{a({cellId:n,autoFocus:!1,before:!1,code:_})},editor:y,cellId:n,aiFix:{setAiCompletionCell:p,triggerFix:x}}),y==null||y.focus()},e[5]=n,e[6]=a,e[7]=d,e[8]=p,e[9]=l,e[10]=f):f=e[10];let u=f,j;e[11]===i?j=e[12]:(j=X("my-2",i),e[11]=i,e[12]=j);let h;e[13]!==d.description||e[14]!==d.fixType||e[15]!==d.title||e[16]!==u?(h=d.fixType==="ai"?(0,r.jsx)(ce,{tooltip:d.description,openPrompt:()=>u(!1),applyAutofix:()=>u(!0)}):(0,r.jsx)(Y,{content:d.description,align:"start",children:(0,r.jsxs)($,{size:"xs",variant:"outline",className:"font-normal",onClick:()=>u(!1),children:[(0,r.jsx)(ee,{className:"h-3 w-3 mr-2"}),d.title]})}),e[13]=d.description,e[14]=d.fixType,e[15]=d.title,e[16]=u,e[17]=h):h=e[17];let g;return e[18]!==j||e[19]!==h?(g=(0,r.jsx)("div",{className:j,children:h}),e[18]=j,e[19]=h,e[20]=g):g=e[20],g};var le=He,ie=ee,ae="Suggest a prompt",oe="Fix with AI";const ce=t=>{let e=(0,R.c)(21),{tooltip:s,openPrompt:n,applyAutofix:i}=t,{fixMode:l,setFixMode:a}=it(),c=l==="prompt"?n:i,o;e[0]===l?o=e[1]:(o=l==="prompt"?(0,r.jsx)(le,{className:"h-3 w-3 mr-2 mb-0.5"}):(0,r.jsx)(ie,{className:"h-3 w-3 mr-2 mb-0.5"}),e[0]=l,e[1]=o);let m=l==="prompt"?ae:oe,p;e[2]!==c||e[3]!==o||e[4]!==m?(p=(0,r.jsxs)($,{size:"xs",variant:"outline",className:"font-normal rounded-r-none border-r-0",onClick:c,children:[o,m]}),e[2]=c,e[3]=o,e[4]=m,e[5]=p):p=e[5];let d;e[6]!==p||e[7]!==s?(d=(0,r.jsx)(Y,{content:s,align:"start",children:p}),e[6]=p,e[7]=s,e[8]=d):d=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=(0,r.jsx)(Be,{asChild:!0,children:(0,r.jsx)($,{size:"xs",variant:"outline",className:"rounded-l-none px-2","aria-label":"Fix options",children:(0,r.jsx)(Oe,{className:"h-3 w-3"})})}),e[9]=f):f=e[9];let u;e[10]!==l||e[11]!==a?(u=()=>{a(l==="prompt"?"autofix":"prompt")},e[10]=l,e[11]=a,e[12]=u):u=e[12];let j=l==="prompt"?"autofix":"prompt",h;e[13]===j?h=e[14]:(h=(0,r.jsx)(at,{mode:j}),e[13]=j,e[14]=h);let g;e[15]!==u||e[16]!==h?(g=(0,r.jsxs)(De,{children:[f,(0,r.jsx)(Qe,{align:"end",className:"w-56",children:(0,r.jsx)(Ve,{className:"flex items-center gap-2",onClick:u,children:h})})]}),e[15]=u,e[16]=h,e[17]=g):g=e[17];let x;return e[18]!==g||e[19]!==d?(x=(0,r.jsxs)("div",{className:"flex",children:[d,g]}),e[18]=g,e[19]=d,e[20]=x):x=e[20],x};var at=t=>{let e=(0,R.c)(12),{mode:s}=t,n;e[0]===s?n=e[1]:(n=s==="prompt"?(0,r.jsx)(le,{className:"h-4 w-4"}):(0,r.jsx)(ie,{className:"h-4 w-4"}),e[0]=s,e[1]=n);let i=n,l=s==="prompt"?ae:oe,a=s==="prompt"?"Edit the prompt before applying":"Apply AI fixes automatically",c;e[2]===l?c=e[3]:(c=(0,r.jsx)("span",{className:"font-medium",children:l}),e[2]=l,e[3]=c);let o;e[4]===a?o=e[5]:(o=(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:a}),e[4]=a,e[5]=o);let m;e[6]!==c||e[7]!==o?(m=(0,r.jsxs)("div",{className:"flex flex-col",children:[c,o]}),e[6]=c,e[7]=o,e[8]=m):m=e[8];let p;return e[9]!==i||e[10]!==m?(p=(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[i,m]}),e[9]=i,e[10]=m,e[11]=p):p=e[11],p},de=/(https?:\/\/\S+)/,ot=/\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i,me=/^data:image\//i,ct=["avatars.githubusercontent.com"];function pe(t){return me.test(t)?[{type:"image",url:t}]:t.split(de).filter(e=>e!=="").map(e=>de.test(e)?ot.test(e)||me.test(e)||ct.some(s=>e.includes(s))?{type:"image",url:e}:{type:"url",url:e}:{type:"text",value:e})}var ue=q(),P=J(we(),1),dt=new Te;const G=t=>{let e=RegExp("\x1B\\[[0-9;]*m","g");return t.replaceAll(e,"")};var he=/(pip\s+install|uv\s+add|uv\s+pip\s+install)\s+/gi;function mt(t){he.lastIndex=0;let e=he.exec(t);if(!e)return null;let s=e.index+e[0].length,n=t.slice(s).split(/\s+/),i="",l=0;for(let c of n){let o=c.trim();if(!o)continue;if(o.startsWith("-")){l+=o.length+1;continue}let m=o.match(/^[\w,.[\]-]+/);if(m){i=m[0];break}break}if(!i)return null;let a=s+l+i.length;return{package:i,endIndex:a}}function w(t,e=""){if(!t)return null;if(!/https?:\/\//.test(t))return t;let s=pe(t);return s.length===1&&s[0].type==="text"?t:(0,r.jsx)(r.Fragment,{children:s.map((n,i)=>{let l=e?`${e}-${i}`:i;if(n.type==="url"){let a=G(n.url);return(0,r.jsx)("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:Z.stopPropagation(),className:"text-link hover:underline",children:a},l)}if(n.type==="image"){let a=G(n.url);return(0,r.jsx)("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:Z.stopPropagation(),className:"text-link hover:underline",children:a},l)}return(0,r.jsx)(P.Fragment,{children:n.value},l)})})}var pt=t=>{let e=(0,ue.c)(6),{packages:s,children:n}=t,{handleInstallPackages:i}=Xe(),l;e[0]!==i||e[1]!==s?(l=c=>{i(s),c.preventDefault()},e[0]=i,e[1]=s,e[2]=l):l=e[2];let a;return e[3]!==n||e[4]!==l?(a=(0,r.jsx)("button",{onClick:l,className:"text-link hover:underline",type:"button",children:n}),e[3]=n,e[4]=l,e[5]=a):a=e[5],a};const ut=t=>{if(!(t instanceof K.Text))return;let e=G(t.data);if(!/(pip\s+install|uv\s+add|uv\s+pip\s+install)/i.test(e))return;let s=[],n=/(pip\s+install|uv\s+add|uv\s+pip\s+install)\s+/gi,i;for(;(i=n.exec(e))!==null;){let c=i.index,o=mt(e.slice(c));o&&s.push({match:i,result:o})}if(s.length===0)return;let l=[],a=0;if(s.forEach((c,o)=>{let{match:m,result:p}=c,d=m.index,f=d+p.endIndex;if(a<d){let j=e.slice(a,d);l.push((0,r.jsx)(P.Fragment,{children:w(j,`before-${o}`)},`before-${o}`))}let u=e.slice(d,f);l.push((0,r.jsx)(pt,{packages:[p.package],children:u},`install-${o}`)),a=f}),a<e.length){let c=e.slice(a);l.push((0,r.jsx)(P.Fragment,{children:w(c,"after")},"after"))}return(0,r.jsx)(r.Fragment,{children:l})},ht=t=>{if(!(t instanceof K.Text))return;let e=t.data;if(!/https?:\/\//.test(e))return;let s=w(e);if(typeof s!="string")return(0,r.jsx)(r.Fragment,{children:s})},xt=(...t)=>e=>{for(let s of t){let n=s(e);if(n!==void 0)return n}},ft=(t,e)=>(0,r.jsx)("span",{children:Ce(dt.ansi_to_html(t),{replace:s=>e(s)})}),jt=t=>{let e=(0,ue.c)(4),{text:s}=t,n;e[0]===s?n=e[1]:(n=ft(s,xt(ut,ht)),e[0]=s,e[1]=n);let i=n,l;return e[2]===i?l=e[3]:(l=(0,r.jsx)(r.Fragment,{children:i}),e[2]=i,e[3]=l),l};var xe=q(),I=t=>{let e=(0,xe.c)(10),s=t.title??"Tip",n;e[0]===s?n=e[1]:(n=(0,r.jsx)(qe,{className:"pt-2 pb-2 font-normal",children:s}),e[0]=s,e[1]=n);let i;e[2]===t.children?i=e[3]:(i=(0,r.jsx)(We,{className:"mr-24 text-[0.84375rem]",children:t.children}),e[2]=t.children,e[3]=i);let l;e[4]!==n||e[5]!==i?(l=(0,r.jsxs)(Pe,{value:"item-1",className:"text-muted-foreground",children:[n,i]}),e[4]=n,e[5]=i,e[6]=l):l=e[6];let a;return e[7]!==t.className||e[8]!==l?(a=(0,r.jsx)(Le,{type:"single",collapsible:!0,className:t.className,children:l}),e[7]=t.className,e[8]=l,e[9]=a):a=e[9],a};const gt=t=>{let e=(0,xe.c)(31),{errors:s,cellId:n,className:i}=t,l=Me(),a="This cell wasn't run because it has errors",c="destructive",o="text-error";if(s.some(yt))a="Interrupted";else if(s.some(vt))a="An internal error occurred";else if(s.some(Nt))a="Ancestor prevented from running",c="default",o="text-secondary-foreground";else if(s.some(bt))a="Ancestor stopped",c="default",o="text-secondary-foreground";else if(s.some(kt))a="SQL error";else{let x;e[0]===s?x=e[1]:(x=s.find(wt),e[0]=s,e[1]=x);let y=x;y&&"exception_type"in y&&(a=y.exception_type)}let m,p,d,f,u,j;if(e[2]!==c||e[3]!==n||e[4]!==l||e[5]!==i||e[6]!==s||e[7]!==o||e[8]!==a){let x=s.filter(It),y=s.filter($t),k=s.filter(_t),_=s.filter(Ft),L=s.filter(At),C=s.filter(Tt),M=s.filter(Ct),W=s.filter(Mt),V=s.filter(St),B=s.filter(zt),F=s.filter(Et),Q=s.filter(qt),D=s.filter(Pt),S;e[15]===l?S=e[16]:(S=()=>{l.openApplication("scratchpad")},e[15]=l,e[16]=S);let fe=S,je=()=>{let v=[];if(F.length>0||Q.length>0){let E=F.some(Lt),ye=!E&&F.some(Wt);v.push((0,r.jsxs)("div",{children:[F.map(Vt),Q.map(Bt),E&&(0,r.jsxs)($,{size:"xs",variant:"outline",className:"mt-2 font-normal",onClick:()=>Ke(l),children:[(0,r.jsx)(Ze,{className:"h-3.5 w-3.5 mr-1.5 mb-0.5"}),(0,r.jsx)("span",{children:"Open package manager"})]}),ye&&(0,r.jsxs)($,{size:"xs",variant:"outline",className:"mt-2 font-normal",onClick:()=>l.openApplication("terminal"),children:[(0,r.jsx)(se,{className:"h-3.5 w-3.5 mr-1.5"}),(0,r.jsx)("span",{children:"Open terminal"})]}),n&&(0,r.jsx)(N,{errors:[...F,...Q],cellId:n})]},"syntax-unknown"))}if(x.length>0&&v.push((0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-muted-foreground font-medium",children:"The setup cell cannot be run because it has references."}),(0,r.jsx)("ul",{className:"list-disc",children:x.flatMap(Qt)}),n&&(0,r.jsx)(N,{errors:x,cellId:n}),(0,r.jsxs)(I,{title:"Why can't the setup cell have references?",className:"mb-2",children:[(0,r.jsx)("p",{className:"pb-2",children:"The setup cell contains logic that must be run before any other cell runs, including top-level imports used by top-level functions. For this reason, it can't refer to other cells' variables."}),(0,r.jsx)("p",{className:"py-2",children:"Try simplifying the setup cell to only contain only necessary variables."}),(0,r.jsxs)("p",{className:"py-2",children:[(0,r.jsxs)(A,{href:"https://links.marimo.app/errors-setup",children:["Learn more at our docs"," ",(0,r.jsx)(T,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"setup-refs")),y.length>0&&v.push((0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-muted-foreground font-medium",children:"This cell is in a cycle."}),(0,r.jsx)("ul",{className:"list-disc",children:y.flatMap(Dt)}),n&&(0,r.jsx)(N,{errors:y,cellId:n}),(0,r.jsxs)(I,{title:"What are cycles and how do I resolve them?",className:"mb-2",children:[(0,r.jsx)("p",{className:"pb-2",children:"An example of a cycle is if one cell declares a variable 'a' and reads 'b', and another cell declares 'b' and and reads 'a'. Cycles like this make it impossible for marimo to know how to run your cells, and generally suggest that your code has a bug."}),(0,r.jsx)("p",{className:"py-2",children:"Try merging these cells into a single cell to eliminate the cycle."}),(0,r.jsxs)("p",{className:"py-2",children:[(0,r.jsxs)(A,{href:"https://links.marimo.app/errors-cycles",children:["Learn more at our docs"," ",(0,r.jsx)(T,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"cycle")),k.length>0){let E=k[0].name;v.push((0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-muted-foreground font-medium",children:"This cell redefines variables from other cells."}),k.map(Ht),n&&(0,r.jsx)(N,{errors:k,cellId:n}),(0,r.jsxs)(I,{title:"Why can't I redefine variables?",children:[(0,r.jsx)("p",{className:"pb-2",children:"marimo requires that each variable is defined in just one cell. This constraint enables reactive and reproducible execution, arbitrary cell reordering, seamless UI elements, execution as a script, and more."}),(0,r.jsxs)("p",{className:"py-2",children:["Try merging this cell with the mentioned cells or wrapping it in a function. Alternatively, prefix variables with an underscore (e.g., ",(0,r.jsxs)(re,{className:"inline",children:["_",E]}),"). to make them private to this cell."]}),(0,r.jsxs)("p",{className:"py-2",children:[(0,r.jsxs)(A,{href:"https://links.marimo.app/errors-multiple-definitions",children:["Learn more at our docs"," ",(0,r.jsx)(T,{size:"0.75rem",className:"inline"})]}),"."]})]}),(0,r.jsx)(I,{title:"Need a scratchpad?",children:(0,r.jsxs)("div",{className:"flex flex-row gap-2 items-center",children:[(0,r.jsxs)($,{size:"xs",variant:"link",className:"my-2 font-normal mx-0 px-0",onClick:fe,children:[(0,r.jsx)(Ae,{className:"h-3"}),(0,r.jsx)("span",{children:"Try the scratchpad"})]}),(0,r.jsx)("span",{children:"to experiment without restrictions on variable names."})]})})]},"multiple-defs"))}return _.length>0&&v.push((0,r.jsxs)("div",{children:[_.map(Ut),n&&(0,r.jsx)(N,{errors:_,cellId:n}),(0,r.jsxs)(I,{title:"Why can't I use `import *`?",children:[(0,r.jsx)("p",{className:"pb-2",children:"Star imports are incompatible with marimo's git-friendly file format and reproducible reactive execution."}),(0,r.jsx)("p",{className:"py-2",children:"marimo's Python file format stores code in functions, so notebooks can be imported as regular Python modules without executing all their code. But Python disallows `import *` everywhere except at the top-level of a module."}),(0,r.jsx)("p",{className:"py-2",children:"Star imports would also silently add names to globals, which would be incompatible with reactive execution."}),(0,r.jsxs)("p",{className:"py-2",children:[(0,r.jsxs)(A,{href:"https://links.marimo.app/errors-import-star",children:["Learn more at our docs"," ",(0,r.jsx)(T,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"import-star")),L.length>0&&v.push((0,r.jsxs)("div",{children:[L.map(Rt),n&&(0,r.jsx)(N,{errors:L,cellId:n})]},"interruption")),C.length>0&&v.push((0,r.jsxs)("ul",{children:[C.map(Gt),C.some(Jt)&&(0,r.jsx)(I,{children:"Fix the error in the mentioned cells, or handle the exceptions with try/except blocks."}),n&&(0,r.jsx)(N,{errors:C,cellId:n})]},"exception")),M.length>0&&v.push((0,r.jsxs)("ul",{children:[M.map(Kt),n&&(0,r.jsx)(N,{errors:M,cellId:n}),(0,r.jsx)(I,{children:M.some(Xt)?"Ensure that the referenced cells define the required variables, or turn off strict execution.":"Something is wrong with your declarations. Fix any discrepancies, or turn off strict execution."})]},"strict-exception")),W.length>0&&v.push((0,r.jsxs)("div",{children:[W.map(Yt),n&&(0,r.jsx)(N,{errors:W,cellId:n})]},"internal")),V.length>0&&v.push((0,r.jsxs)("div",{children:[V.map(Zt),n&&(0,r.jsx)(N,{errors:V,cellId:n})]},"ancestor-prevented")),B.length>0&&v.push((0,r.jsxs)("div",{children:[B.map(er),n&&(0,r.jsx)(N,{errors:B,cellId:n})]},"ancestor-stopped")),D.length>0&&v.push((0,r.jsxs)("div",{children:[D.map(tr),n&&(0,r.jsx)(N,{errors:D,cellId:n,className:"mt-2.5"})]},"sql-errors")),v},O=`font-code font-medium tracking-wide ${o}`,z;e[17]!==O||e[18]!==a?(z=(0,r.jsx)(Ge,{className:O,children:a}),e[17]=O,e[18]=a,e[19]=z):z=e[19];let ge=z;m=Je,f=c,e[20]===i?u=e[21]:(u=X("border-none font-code text-sm text-[0.84375rem] px-0 text-muted-foreground normal [&:has(svg)]:pl-0 space-y-4",i),e[20]=i,e[21]=u),j=ge,p="flex flex-col gap-8",d=je(),e[2]=c,e[3]=n,e[4]=l,e[5]=i,e[6]=s,e[7]=o,e[8]=a,e[9]=m,e[10]=p,e[11]=d,e[12]=f,e[13]=u,e[14]=j}else m=e[9],p=e[10],d=e[11],f=e[12],u=e[13],j=e[14];let h;e[22]!==p||e[23]!==d?(h=(0,r.jsx)("div",{children:(0,r.jsx)("div",{className:p,children:d})}),e[22]=p,e[23]=d,e[24]=h):h=e[24];let g;return e[25]!==m||e[26]!==f||e[27]!==u||e[28]!==j||e[29]!==h?(g=(0,r.jsxs)(m,{variant:f,className:u,children:[j,h]}),e[25]=m,e[26]=f,e[27]=u,e[28]=j,e[29]=h,e[30]=g):g=e[30],g};function yt(t){return t.type==="interruption"}function vt(t){return t.type==="internal"}function Nt(t){return t.type==="ancestor-prevented"}function bt(t){return t.type==="ancestor-stopped"}function kt(t){return t.type==="sql-error"}function wt(t){return t.type==="exception"}function It(t){return t.type==="setup-refs"}function $t(t){return t.type==="cycle"}function _t(t){return t.type==="multiple-defs"}function Ft(t){return t.type==="import-star"}function At(t){return t.type==="interruption"}function Tt(t){return t.type==="exception"}function Ct(t){return t.type==="strict-exception"}function Mt(t){return t.type==="internal"}function St(t){return t.type==="ancestor-prevented"}function zt(t){return t.type==="ancestor-stopped"}function Et(t){return t.type==="syntax"}function qt(t){return t.type==="unknown"}function Pt(t){return t.type==="sql-error"}function Lt(t){return t.msg.includes("!pip")}function Wt(t){return t.msg.includes("use os.subprocess")}function Vt(t,e){return(0,r.jsx)("pre",{children:w(t.msg,`syntax-${e}`)},`syntax-${e}`)}function Bt(t,e){return(0,r.jsx)("pre",{children:w(t.msg,`unknown-${e}`)},`unknown-${e}`)}function Qt(t,e){return t.edges_with_vars.map((s,n)=>(0,r.jsxs)("li",{className:"my-0.5 ml-8 text-muted-foreground/40",children:[(0,r.jsx)(b,{cellId:s[0]}),(0,r.jsxs)("span",{className:"text-muted-foreground",children:[": "," ",s[1].length===1?s[1][0]:s[1].join(", ")]})]},`setup-refs-${e}-${n}`))}function Dt(t,e){return t.edges_with_vars.map((s,n)=>(0,r.jsxs)("li",{className:"my-0.5 ml-8 text-muted-foreground/40",children:[(0,r.jsx)(b,{cellId:s[0]}),(0,r.jsxs)("span",{className:"text-muted-foreground",children:[" -> ",s[1].length===1?s[1][0]:s[1].join(", ")," -> "]}),(0,r.jsx)(b,{cellId:s[2]})]},`cycle-${e}-${n}`))}function Ot(t,e){return(0,r.jsx)("li",{className:"my-0.5 ml-8 text-muted-foreground/40",children:(0,r.jsx)(b,{cellId:t})},`cell-${e}`)}function Ht(t,e){return(0,r.jsxs)(P.Fragment,{children:[(0,r.jsx)("p",{className:"text-muted-foreground mt-2",children:`'${t.name}' was also defined by:`}),(0,r.jsx)("ul",{className:"list-disc",children:t.cells.map(Ot)})]},`multiple-defs-${e}`)}function Ut(t,e){return(0,r.jsx)("p",{className:"text-muted-foreground",children:t.msg},`import-star-${e}`)}function Rt(t,e){return(0,r.jsx)("p",{children:"This cell was interrupted and needs to be re-run."},`interruption-${e}`)}function Gt(t,e){return t.exception_type==="NameError"&&t.msg.startsWith("name 'mo'")?(0,r.jsx)("li",{className:"my-2",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-muted-foreground",children:"name 'mo' is not defined."}),(0,r.jsxs)("p",{className:"text-muted-foreground mt-2",children:["The marimo module (imported as"," ",(0,r.jsx)(re,{className:"inline",children:"mo"}),") is required for Markdown, SQL, and UI elements."]})]})},`exception-${e}`):t.exception_type==="NameError"&&t.msg.startsWith("name '_")?(0,r.jsx)("li",{className:"my-2",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-muted-foreground",children:t.msg}),(0,r.jsxs)("p",{className:"text-muted-foreground mt-2",children:["Variables prefixed with an underscore are local to a cell"," ","(",(0,r.jsxs)(A,{href:"https://links.marimo.app/local-variables",children:["docs"," ",(0,r.jsx)(T,{size:"0.75rem",className:"inline"})]}),")."]}),(0,r.jsx)("div",{className:"text-muted-foreground mt-2",children:"See the console area for a traceback."})]})},`exception-${e}`):(0,r.jsx)("li",{className:"my-2",children:t.raising_cell==null?(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-muted-foreground",children:w(t.msg,`exception-${e}`)}),"traceback"in t&&t.traceback?(0,r.jsx)("div",{className:"font-code text-sm mt-2 p-3 bg-muted rounded border overflow-auto max-h-[50vh] cursor-text select-text",children:te({html:t.traceback})}):(0,r.jsx)("div",{className:"text-muted-foreground mt-2",children:"See the console area for a traceback."})]}):(0,r.jsxs)("div",{children:[w(t.msg,`exception-${e}`),(0,r.jsx)(b,{cellId:t.raising_cell}),"traceback"in t&&t.traceback&&(0,r.jsx)("div",{className:"font-code text-sm mt-2 p-3 bg-muted rounded border overflow-auto max-h-[50vh] cursor-text select-text",children:te({html:t.traceback})})]})},`exception-${e}`)}function Jt(t){return t.raising_cell!=null}function Kt(t,e){return(0,r.jsx)("li",{className:"my-2",children:t.blamed_cell==null?(0,r.jsx)("p",{children:t.msg}):(0,r.jsxs)("div",{children:[t.msg,(0,r.jsx)(b,{cellId:t.blamed_cell})]})},`strict-exception-${e}`)}function Xt(t){return t.blamed_cell!=null}function Yt(t,e){return(0,r.jsx)("p",{children:t.msg},`internal-${e}`)}function Zt(t,e){return(0,r.jsxs)("div",{children:[t.msg,t.blamed_cell==null?(0,r.jsxs)("span",{children:["(",(0,r.jsx)(b,{cellId:t.raising_cell}),")"]}):(0,r.jsxs)("span",{children:["(",(0,r.jsx)(b,{cellId:t.raising_cell}),"\xA0blames\xA0",(0,r.jsx)(b,{cellId:t.blamed_cell}),")"]})]},`ancestor-prevented-${e}`)}function er(t,e){return(0,r.jsxs)("div",{children:[t.msg,(0,r.jsx)(b,{cellId:t.raising_cell})]},`ancestor-stopped-${e}`)}function tr(t,e){return(0,r.jsx)("div",{className:"space-y-2 mt-2",children:(0,r.jsx)("p",{className:"text-muted-foreground whitespace-pre-wrap",children:t.msg})},`sql-error-${e}`)}export{se as a,ce as i,jt as n,pe as r,gt as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as Ce}from"./chunk-LvLJmgfZ.js";import{t as ye}from"./react-Bj1aDYRI.js";import{$ as Se,Y as ke,et as _e}from"./input-Bg12i6qY.js";import{D as Le,F as xe,I as v,L as Me,N as w,P as S,T as Fe,V as R,c as Ie,j as k,k as Pe,l as We,p as Ae,w as Ke,x as ne}from"./usePress-BXMIcLWP.js";import{t as He}from"./context-DGqo1TbK.js";var Be=class{get currentNode(){return this._currentNode}set currentNode(e){if(!k(this.root,e))throw Error("Cannot set currentNode to a node that is not contained by the root node.");let t=[],r=e,n=e;for(this._currentNode=e;r&&r!==this.root;)if(r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let i=r,l=this._doc.createTreeWalker(i,this.whatToShow,{acceptNode:this._acceptNode});t.push(l),l.currentNode=n,this._currentSetFor.add(l),r=n=i.host}else r=r.parentNode;let o=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});t.push(o),o.currentNode=n,this._currentSetFor.add(o),this._walkerStack=t}get doc(){return this._doc}firstChild(){let e=this.currentNode,t=this.nextNode();return k(e,t)?(t&&(this.currentNode=t),t):(this.currentNode=e,null)}lastChild(){let e=this._walkerStack[0].lastChild();return e&&(this.currentNode=e),e}nextNode(){var t;let e=this._walkerStack[0].nextNode();if(e){if(e.shadowRoot){let r;if(typeof this.filter=="function"?r=this.filter(e):(t=this.filter)!=null&&t.acceptNode&&(r=this.filter.acceptNode(e)),r===NodeFilter.FILTER_ACCEPT)return this.currentNode=e,e;let n=this.nextNode();return n&&(this.currentNode=n),n}return e&&(this.currentNode=e),e}else if(this._walkerStack.length>1){this._walkerStack.shift();let r=this.nextNode();return r&&(this.currentNode=r),r}else return null}previousNode(){var r;let e=this._walkerStack[0];if(e.currentNode===e.root){if(this._currentSetFor.has(e))if(this._currentSetFor.delete(e),this._walkerStack.length>1){this._walkerStack.shift();let n=this.previousNode();return n&&(this.currentNode=n),n}else return null;return null}let t=e.previousNode();if(t){if(t.shadowRoot){let n;if(typeof this.filter=="function"?n=this.filter(t):(r=this.filter)!=null&&r.acceptNode&&(n=this.filter.acceptNode(t)),n===NodeFilter.FILTER_ACCEPT)return t&&(this.currentNode=t),t;let o=this.lastChild();return o&&(this.currentNode=o),o}return t&&(this.currentNode=t),t}else if(this._walkerStack.length>1){this._walkerStack.shift();let n=this.previousNode();return n&&(this.currentNode=n),n}else return null}nextSibling(){return null}previousSibling(){return null}parentNode(){return null}constructor(e,t,r,n){this._walkerStack=[],this._currentSetFor=new Set,this._acceptNode=i=>{var l;if(i.nodeType===Node.ELEMENT_NODE){let a=i.shadowRoot;if(a){let d=this._doc.createTreeWalker(a,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(d),NodeFilter.FILTER_ACCEPT}else{if(typeof this.filter=="function")return this.filter(i);if((l=this.filter)!=null&&l.acceptNode)return this.filter.acceptNode(i);if(this.filter===null)return NodeFilter.FILTER_ACCEPT}}return NodeFilter.FILTER_SKIP},this._doc=e,this.root=t,this.filter=n??null,this.whatToShow=r??NodeFilter.SHOW_ALL,this._currentNode=t,this._walkerStack.unshift(e.createTreeWalker(t,r,this._acceptNode));let o=t.shadowRoot;if(o){let i=this._doc.createTreeWalker(o,this.whatToShow,{acceptNode:this._acceptNode});this._walkerStack.unshift(i)}}};function oe(e,t,r,n){return xe()?new Be(e,t,r,n):e.createTreeWalker(t,r,n)}var h=Ce(ye(),1);function De(e,t){let r=(0,h.useRef)(!0),n=(0,h.useRef)(null),o=Ae(e);(0,h.useEffect)(()=>(r.current=!0,()=>{r.current=!1}),[]),(0,h.useEffect)(()=>{let i=n.current;r.current?r.current=!1:(!i||t.some((l,a)=>!Object.is(l,i[a])))&&o(),n.current=t},t)}function z(e,t){if(!e)return!1;let r=window.getComputedStyle(e),n=document.scrollingElement||document.documentElement,o=/(auto|scroll)/.test(r.overflow+r.overflowX+r.overflowY);return e===n&&r.overflow!=="hidden"&&(o=!0),o&&t&&(o=e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth),o}function Oe(e,t){let r=e;for(z(r,t)&&(r=r.parentElement);r&&!z(r,t);)r=r.parentElement;return r||document.scrollingElement||document.documentElement}function ie(e,t){let r=[],n=document.scrollingElement||document.documentElement;do z(e,t)&&r.push(e),e=e.parentElement;while(e&&e!==n);return r}function je(e){return Ke()?e.metaKey:e.ctrlKey}var ze=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Ve(e){return e instanceof HTMLInputElement&&!ze.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}var qe=0,q=new Map;function Ue(e){let[t,r]=(0,h.useState)();return R(()=>{if(!e)return;let n=q.get(e);if(n)r(n.element.id);else{let o=`react-aria-description-${qe++}`;r(o);let i=document.createElement("div");i.id=o,i.style.display="none",i.textContent=e,document.body.appendChild(i),n={refCount:0,element:i},q.set(e,n)}return n.refCount++,()=>{n&&--n.refCount===0&&(n.element.remove(),q.delete(e))}},[e]),{"aria-describedby":e?t:void 0}}function U(e,t,r={}){let{block:n="nearest",inline:o="nearest"}=r;if(e===t)return;let i=e.scrollTop,l=e.scrollLeft,a=t.getBoundingClientRect(),d=e.getBoundingClientRect(),c=window.getComputedStyle(t),s=window.getComputedStyle(e),f=document.scrollingElement||document.documentElement,u=e===f?0:d.top,N=e===f?e.clientHeight:d.bottom,b=e===f?0:d.left,P=e===f?e.clientWidth:d.right,_=parseInt(c.scrollMarginTop,10)||0,pe=parseInt(c.scrollMarginBottom,10)||0,Ne=parseInt(c.scrollMarginLeft,10)||0,me=parseInt(c.scrollMarginRight,10)||0,be=parseInt(s.scrollPaddingTop,10)||0,ve=parseInt(s.scrollPaddingBottom,10)||0,Ee=parseInt(s.scrollPaddingLeft,10)||0,ge=parseInt(s.scrollPaddingRight,10)||0,Q=parseInt(s.borderTopWidth,10)||0,Z=parseInt(s.borderBottomWidth,10)||0,ee=parseInt(s.borderLeftWidth,10)||0,te=parseInt(s.borderRightWidth,10)||0,W=a.top-_,A=a.bottom+pe,K=a.left-Ne,H=a.right+me,Te=e===f?0:ee+te,we=e===f?0:Q+Z,re=e.offsetWidth-e.clientWidth-Te,Re=e.offsetHeight-e.clientHeight-we,B=u+Q+be,D=N-Z-ve-Re,L=b+ee+Ee,x=P-te-ge;s.direction==="rtl"&&!Le()?L+=re:x-=re;let O=W<B||A>D,j=K<L||H>x;if(O&&n==="start")i+=W-B;else if(O&&n==="center")i+=(W+A)/2-(B+D)/2;else if(O&&n==="end")i+=A-D;else if(O&&n==="nearest"){let M=W-B,F=A-D;i+=Math.abs(M)<=Math.abs(F)?M:F}if(j&&o==="start")l+=K-L;else if(j&&o==="center")l+=(K+H)/2-(L+x)/2;else if(j&&o==="end")l+=H-x;else if(j&&o==="nearest"){let M=K-L,F=H-x;l+=Math.abs(M)<=Math.abs(F)?M:F}e.scrollTo({left:l,top:i})}function $e(e,t={}){let{containingElement:r}=t;if(e&&e.isConnected){let l=document.scrollingElement||document.documentElement;if(window.getComputedStyle(l).overflow!=="hidden"&&!ne()){var n;let{left:a,top:d}=e.getBoundingClientRect();e==null||(n=e.scrollIntoView)==null||n.call(e,{block:"nearest"});let{left:c,top:s}=e.getBoundingClientRect();if(Math.abs(a-c)>1||Math.abs(d-s)>1){var o,i;r==null||(o=r.scrollIntoView)==null||o.call(r,{block:"center",inline:"center"}),(i=e.scrollIntoView)==null||i.call(e,{block:"nearest"})}}else{let{left:a,top:d}=e.getBoundingClientRect(),c=ie(e,!0);for(let u of c)U(u,e);let{left:s,top:f}=e.getBoundingClientRect();if(Math.abs(a-s)>1||Math.abs(d-f)>1){c=r?ie(r,!0):[];for(let u of c)U(u,r,{block:"center",inline:"center"})}}}}var $=new Map;function Ye(e){let{locale:t}=He(),r=t+(e?Object.entries(e).sort((o,i)=>o[0]<i[0]?-1:1).join():"");if($.has(r))return $.get(r);let n=new Intl.Collator(t,e);return $.set(r,n),n}var le=h.createContext(null),Y="react-aria-focus-scope-restore",p=null;function Ge(e){let{children:t,contain:r,restoreFocus:n,autoFocus:o}=e,i=(0,h.useRef)(null),l=(0,h.useRef)(null),a=(0,h.useRef)([]),{parentNode:d}=(0,h.useContext)(le)||{},c=(0,h.useMemo)(()=>new X({scopeRef:a}),[a]);R(()=>{let u=d||m.root;if(m.getTreeNode(u.scopeRef)&&p&&!V(p,u.scopeRef)){let N=m.getTreeNode(p);N&&(u=N)}u.addChild(c),m.addNode(c)},[c,d]),R(()=>{let u=m.getTreeNode(a);u&&(u.contain=!!r)},[r]),R(()=>{var P;let u=(P=i.current)==null?void 0:P.nextSibling,N=[],b=_=>_.stopPropagation();for(;u&&u!==l.current;)N.push(u),u.addEventListener(Y,b),u=u.nextSibling;return a.current=N,()=>{for(let _ of N)_.removeEventListener(Y,b)}},[t]),rt(a,n,r),Ze(a,r),nt(a,n,r),tt(a,o),(0,h.useEffect)(()=>{let u=w(v(a.current?a.current[0]:void 0)),N=null;if(T(u,a.current)){for(let b of m.traverse())b.scopeRef&&T(u,b.scopeRef.current)&&(N=b);N===m.getTreeNode(a)&&(p=N.scopeRef)}},[a]),R(()=>()=>{var N,b;let u=((b=(N=m.getTreeNode(a))==null?void 0:N.parent)==null?void 0:b.scopeRef)??null;(a===p||V(a,p))&&(!u||m.getTreeNode(u))&&(p=u),m.removeTreeNode(a)},[a]);let s=(0,h.useMemo)(()=>Je(a),[]),f=(0,h.useMemo)(()=>({focusManager:s,parentNode:c}),[c,s]);return h.createElement(le.Provider,{value:f},h.createElement("span",{"data-focus-scope-start":!0,hidden:!0,ref:i}),t,h.createElement("span",{"data-focus-scope-end":!0,hidden:!0,ref:l}))}function Je(e){return{focusNext(t={}){let r=e.current,{from:n,tabbable:o,wrap:i,accept:l}=t,a=n||w(v(r[0]??void 0)),d=r[0].previousElementSibling,c=g(y(r),{tabbable:o,accept:l},r);c.currentNode=T(a,r)?a:d;let s=c.nextNode();return!s&&i&&(c.currentNode=d,s=c.nextNode()),s&&E(s,!0),s},focusPrevious(t={}){let r=e.current,{from:n,tabbable:o,wrap:i,accept:l}=t,a=n||w(v(r[0]??void 0)),d=r[r.length-1].nextElementSibling,c=g(y(r),{tabbable:o,accept:l},r);c.currentNode=T(a,r)?a:d;let s=c.previousNode();return!s&&i&&(c.currentNode=d,s=c.previousNode()),s&&E(s,!0),s},focusFirst(t={}){let r=e.current,{tabbable:n,accept:o}=t,i=g(y(r),{tabbable:n,accept:o},r);i.currentNode=r[0].previousElementSibling;let l=i.nextNode();return l&&E(l,!0),l},focusLast(t={}){let r=e.current,{tabbable:n,accept:o}=t,i=g(y(r),{tabbable:n,accept:o},r);i.currentNode=r[r.length-1].nextElementSibling;let l=i.previousNode();return l&&E(l,!0),l}}}function y(e){return e[0].parentElement}function I(e){let t=m.getTreeNode(p);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function Xe(e){if(!e.form)return Array.from(v(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter(n=>!n.form);let t=e.form.elements.namedItem(e.name),r=Me(e);return t instanceof r.RadioNodeList?Array.from(t).filter(n=>n instanceof r.HTMLInputElement):t instanceof r.HTMLInputElement?[t]:[]}function Qe(e){if(e.checked)return!0;let t=Xe(e);return t.length>0&&!t.some(r=>r.checked)}function Ze(e,t){let r=(0,h.useRef)(void 0),n=(0,h.useRef)(void 0);R(()=>{let o=e.current;if(!t){n.current&&(n.current=(cancelAnimationFrame(n.current),void 0));return}let i=v(o?o[0]:void 0),l=c=>{if(c.key!=="Tab"||c.altKey||c.ctrlKey||c.metaKey||!I(e)||c.isComposing)return;let s=w(i),f=e.current;if(!f||!T(s,f))return;let u=g(y(f),{tabbable:!0},f);if(!s)return;u.currentNode=s;let N=c.shiftKey?u.previousNode():u.nextNode();N||(N=(u.currentNode=c.shiftKey?f[f.length-1].nextElementSibling:f[0].previousElementSibling,c.shiftKey?u.previousNode():u.nextNode())),c.preventDefault(),N&&E(N,!0)},a=c=>{(!p||V(p,e))&&T(S(c),e.current)?(p=e,r.current=S(c)):I(e)&&!C(S(c),e)?r.current?r.current.focus():p&&p.current&&G(p.current):I(e)&&(r.current=S(c))},d=c=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>{let s=_e(),f=(s==="virtual"||s===null)&&Fe()&&ne(),u=w(i);if(!f&&u&&I(e)&&!C(u,e)){p=e;let b=S(c);if(b&&b.isConnected){var N;r.current=b,(N=r.current)==null||N.focus()}else p.current&&G(p.current)}})};return i.addEventListener("keydown",l,!1),i.addEventListener("focusin",a,!1),o==null||o.forEach(c=>c.addEventListener("focusin",a,!1)),o==null||o.forEach(c=>c.addEventListener("focusout",d,!1)),()=>{i.removeEventListener("keydown",l,!1),i.removeEventListener("focusin",a,!1),o==null||o.forEach(c=>c.removeEventListener("focusin",a,!1)),o==null||o.forEach(c=>c.removeEventListener("focusout",d,!1))}},[e,t]),R(()=>()=>{n.current&&cancelAnimationFrame(n.current)},[n])}function ce(e){return C(e)}function T(e,t){return!e||!t?!1:t.some(r=>k(r,e))}function C(e,t=null){if(e instanceof Element&&e.closest("[data-react-aria-top-layer]"))return!0;for(let{scopeRef:r}of m.traverse(m.getTreeNode(t)))if(r&&T(e,r.current))return!0;return!1}function et(e){return C(e,p)}function V(e,t){var n;let r=(n=m.getTreeNode(t))==null?void 0:n.parent;for(;r;){if(r.scopeRef===e)return!0;r=r.parent}return!1}function E(e,t=!1){if(e!=null&&!t)try{Se(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function se(e,t=!0){let r=e[0].previousElementSibling,n=y(e),o=g(n,{tabbable:t},e);o.currentNode=r;let i=o.nextNode();return t&&!i&&(n=y(e),o=g(n,{tabbable:!1},e),o.currentNode=r,i=o.nextNode()),i}function G(e,t=!0){E(se(e,t))}function tt(e,t){let r=h.useRef(t);(0,h.useEffect)(()=>{r.current&&(p=e,!T(w(v(e.current?e.current[0]:void 0)),p.current)&&e.current&&G(e.current)),r.current=!1},[e])}function rt(e,t,r){R(()=>{if(t||r)return;let n=e.current,o=v(n?n[0]:void 0),i=l=>{let a=S(l);T(a,e.current)?p=e:ce(a)||(p=null)};return o.addEventListener("focusin",i,!1),n==null||n.forEach(l=>l.addEventListener("focusin",i,!1)),()=>{o.removeEventListener("focusin",i,!1),n==null||n.forEach(l=>l.removeEventListener("focusin",i,!1))}},[e,t,r])}function ae(e){let t=m.getTreeNode(p);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return(t==null?void 0:t.scopeRef)===e}function nt(e,t,r){let n=(0,h.useRef)(typeof document<"u"?w(v(e.current?e.current[0]:void 0)):null);R(()=>{let o=e.current,i=v(o?o[0]:void 0);if(!t||r)return;let l=()=>{(!p||V(p,e))&&T(w(i),e.current)&&(p=e)};return i.addEventListener("focusin",l,!1),o==null||o.forEach(a=>a.addEventListener("focusin",l,!1)),()=>{i.removeEventListener("focusin",l,!1),o==null||o.forEach(a=>a.removeEventListener("focusin",l,!1))}},[e,r]),R(()=>{let o=v(e.current?e.current[0]:void 0);if(!t)return;let i=l=>{if(l.key!=="Tab"||l.altKey||l.ctrlKey||l.metaKey||!I(e)||l.isComposing)return;let a=o.activeElement;if(!C(a,e)||!ae(e))return;let d=m.getTreeNode(e);if(!d)return;let c=d.nodeToRestore,s=g(o.body,{tabbable:!0});s.currentNode=a;let f=l.shiftKey?s.previousNode():s.nextNode();if((!c||!c.isConnected||c===o.body)&&(c=void 0,d.nodeToRestore=void 0),(!f||!C(f,e))&&c){s.currentNode=c;do f=l.shiftKey?s.previousNode():s.nextNode();while(C(f,e));l.preventDefault(),l.stopPropagation(),f?E(f,!0):ce(c)?E(c,!0):a.blur()}};return r||o.addEventListener("keydown",i,!0),()=>{r||o.removeEventListener("keydown",i,!0)}},[e,t,r]),R(()=>{let o=v(e.current?e.current[0]:void 0);if(!t)return;let i=m.getTreeNode(e);if(i)return i.nodeToRestore=n.current??void 0,()=>{let l=m.getTreeNode(e);if(!l)return;let a=l.nodeToRestore,d=w(o);if(t&&a&&(d&&C(d,e)||d===o.body&&ae(e))){let c=m.clone();requestAnimationFrame(()=>{if(o.activeElement===o.body){let s=c.getTreeNode(e);for(;s;){if(s.nodeToRestore&&s.nodeToRestore.isConnected){ue(s.nodeToRestore);return}s=s.parent}for(s=c.getTreeNode(e);s;){if(s.scopeRef&&s.scopeRef.current&&m.getTreeNode(s.scopeRef)){ue(se(s.scopeRef.current,!0));return}s=s.parent}}})}}},[e,t])}function ue(e){e.dispatchEvent(new CustomEvent(Y,{bubbles:!0,cancelable:!0}))&&E(e)}function g(e,t,r){let n=t!=null&&t.tabbable?We:Ie,o=v((e==null?void 0:e.nodeType)===Node.ELEMENT_NODE?e:null),i=oe(o,e||o,NodeFilter.SHOW_ELEMENT,{acceptNode(l){return k(t==null?void 0:t.from,l)||t!=null&&t.tabbable&&l.tagName==="INPUT"&&l.getAttribute("type")==="radio"&&(!Qe(l)||i.currentNode.tagName==="INPUT"&&i.currentNode.type==="radio"&&i.currentNode.name===l.name)?NodeFilter.FILTER_REJECT:n(l)&&(!r||T(l,r))&&(!(t!=null&&t.accept)||t.accept(l))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t!=null&&t.from&&(i.currentNode=t.from),i}function ot(e,t={}){return{focusNext(r={}){let n=e.current;if(!n)return null;let{from:o,tabbable:i=t.tabbable,wrap:l=t.wrap,accept:a=t.accept}=r,d=o||w(v(n)),c=g(n,{tabbable:i,accept:a});k(n,d)&&(c.currentNode=d);let s=c.nextNode();return!s&&l&&(c.currentNode=n,s=c.nextNode()),s&&E(s,!0),s},focusPrevious(r=t){let n=e.current;if(!n)return null;let{from:o,tabbable:i=t.tabbable,wrap:l=t.wrap,accept:a=t.accept}=r,d=o||w(v(n)),c=g(n,{tabbable:i,accept:a});if(k(n,d))c.currentNode=d;else{let f=J(c);return f&&E(f,!0),f??null}let s=c.previousNode();if(!s&&l){c.currentNode=n;let f=J(c);if(!f)return null;s=f}return s&&E(s,!0),s??null},focusFirst(r=t){let n=e.current;if(!n)return null;let{tabbable:o=t.tabbable,accept:i=t.accept}=r,l=g(n,{tabbable:o,accept:i}).nextNode();return l&&E(l,!0),l},focusLast(r=t){let n=e.current;if(!n)return null;let{tabbable:o=t.tabbable,accept:i=t.accept}=r,l=J(g(n,{tabbable:o,accept:i}));return l&&E(l,!0),l??null}}}function J(e){let t,r;do r=e.lastChild(),r&&(t=r);while(r);return t}var it=class he{get size(){return this.fastMap.size}getTreeNode(t){return this.fastMap.get(t)}addTreeNode(t,r,n){let o=this.fastMap.get(r??null);if(!o)return;let i=new X({scopeRef:t});o.addChild(i),i.parent=o,this.fastMap.set(t,i),n&&(i.nodeToRestore=n)}addNode(t){this.fastMap.set(t.scopeRef,t)}removeTreeNode(t){if(t===null)return;let r=this.fastMap.get(t);if(!r)return;let n=r.parent;for(let i of this.traverse())i!==r&&r.nodeToRestore&&i.nodeToRestore&&r.scopeRef&&r.scopeRef.current&&T(i.nodeToRestore,r.scopeRef.current)&&(i.nodeToRestore=r.nodeToRestore);let o=r.children;n&&(n.removeChild(r),o.size>0&&o.forEach(i=>n&&n.addChild(i))),this.fastMap.delete(r.scopeRef)}*traverse(t=this.root){if(t.scopeRef!=null&&(yield t),t.children.size>0)for(let r of t.children)yield*this.traverse(r)}clone(){var r;let t=new he;for(let n of this.traverse())t.addTreeNode(n.scopeRef,((r=n.parent)==null?void 0:r.scopeRef)??null,n.nodeToRestore);return t}constructor(){this.fastMap=new Map,this.root=new X({scopeRef:null}),this.fastMap.set(null,this.root)}},X=class{addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}},m=new it,de={border:0,clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"};function fe(e={}){let{style:t,isFocusable:r}=e,[n,o]=(0,h.useState)(!1),{focusWithinProps:i}=ke({isDisabled:!r,onFocusWithinChange:a=>o(a)}),l=(0,h.useMemo)(()=>n?t:t?{...de,...t}:de,[n]);return{visuallyHiddenProps:{...i,style:l}}}function lt(e){let{children:t,elementType:r="div",isFocusable:n,style:o,...i}=e,{visuallyHiddenProps:l}=fe(e);return h.createElement(r,Pe(i,l),t)}var ct=(0,h.createContext)(null);(0,h.createContext)(null),(0,h.createContext)(null),(0,h.createContext)(null),(0,h.createContext)(null);var st=(0,h.createContext)({}),at=(0,h.createContext)(null);(0,h.createContext)(null);export{z as _,fe as a,g as c,U as d,$e as f,Oe as g,Ve as h,lt as i,ot as l,je as m,at as n,et as o,Ue as p,st as r,Ge as s,ct as t,Ye as u,De as v,oe as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as v}from"./chunk-LvLJmgfZ.js";import{i as j,p as y,u as w}from"./useEvent-D91BmmQi.js";import{t as R}from"./react-Bj1aDYRI.js";import{bn as S,gn as _,ii as c,it as H,m as I,ri as M,vt as N}from"./cells-
|
|
1
|
+
import{s as v}from"./chunk-LvLJmgfZ.js";import{i as j,p as y,u as w}from"./useEvent-D91BmmQi.js";import{t as R}from"./react-Bj1aDYRI.js";import{bn as S,gn as _,ii as c,it as H,m as I,ri as M,vt as N}from"./cells-BVG4a-Qn.js";import{t as E}from"./compiler-runtime-B3qBwwSJ.js";import{_ as T}from"./useEventListener-DGjKht0c.js";import{o as z}from"./utils-8btzWeZg.js";import{t as C}from"./jsx-runtime-Blw4afVn.js";import{t as F}from"./tooltip-DmqhBBs6.js";import{t as L}from"./copy-icon-BGs1Pbai.js";import{t as V}from"./usePress-BXMIcLWP.js";import{n as k}from"./useDebounce-LVL1r3-M.js";import{t as q}from"./useRunCells-q5CA-QoL.js";var W=E(),m=v(R(),1),o=v(C(),1);const A=r=>{let t=(0,W.c)(16),e,n,i;t[0]===r?(e=t[1],n=t[2],i=t[3]):({href:n,children:e,...i}=r,t[0]=r,t[1]=e,t[2]=n,t[3]=i);let a=(0,m.useRef)(null),s;t[4]===n?s=t[5]:(s=()=>{let u=new URL(globalThis.location.href);u.hash=n,globalThis.history.pushState({},"",u.toString()),globalThis.dispatchEvent(new HashChangeEvent("hashchange"));let x=n.slice(1),g=document.getElementById(x);g&&g.scrollIntoView({behavior:"smooth",block:"start"})},t[4]=n,t[5]=s);let l=s,f;t[6]===l?f=t[7]:(f={onPress:()=>{l()}},t[6]=l,t[7]=f);let{pressProps:h}=V(f),d;t[8]===l?d=t[9]:(d=u=>{u.preventDefault(),l()},t[8]=l,t[9]=d);let b=d,p;return t[10]!==e||t[11]!==b||t[12]!==n||t[13]!==h||t[14]!==i?(p=(0,o.jsx)("a",{ref:a,href:n,...h,onClick:b,...i,children:e}),t[10]=e,t[11]=b,t[12]=n,t[13]=h,t[14]=i,t[15]=p):p=t[15],p};async function D(r){let t=I().inOrderIds.at(0);if(t)try{let e=await _.request({document:r,cellId:t});if(!e||e.options.length===0)return;let n=r.split(".").pop()??r,i=e.options[0],a=e.options.find(s=>s.name===n)??i;a!=null&&a.completion_info&&j.set(S,{documentation:a.completion_info})}catch(e){T.debug(`Doc lookup failed for "${r}"`,e)}}var O=E();const P=r=>{let t=(0,O.c)(8),{qualifiedName:e,children:n}=r,i;t[0]===e?i=t[1]:(i=()=>{D(e)},t[0]=e,t[1]=i);let a=k(i,100),s;t[2]===a?s=t[3]:(s=()=>a.cancel(),t[2]=a,t[3]=s);let l;return t[4]!==n||t[5]!==a||t[6]!==s?(l=(0,o.jsx)("span",{onMouseEnter:a,onMouseLeave:s,children:n}),t[4]=n,t[5]=a,t[6]=s,t[7]=l):l=t[7],l};var $=y(r=>{let t=r(q),e=r(z);if(t||e)return!1;let n=!0;try{n=H()==="read"}catch{return!0}return!n});function B(){return w($)}var U=E(),Z=r=>{if(r instanceof c.Element&&!/^[A-Za-z][\w-]*$/.test(r.name))return m.createElement(m.Fragment)},G=(r,t)=>{if(t instanceof c.Element&&t.name==="body"){if((0,m.isValidElement)(r)&&"props"in r){let e=r.props.children;return(0,o.jsx)(o.Fragment,{children:e})}return}},J=(r,t)=>{if(t instanceof c.Element&&t.name==="html"){if((0,m.isValidElement)(r)&&"props"in r){let e=r.props.children;return(0,o.jsx)(o.Fragment,{children:e})}return}},K=r=>{if(r instanceof c.Element&&r.attribs&&r.name==="iframe"){let t=document.createElement("iframe");return Object.entries(r.attribs).forEach(([e,n])=>{e.startsWith('"')&&e.endsWith('"')&&(e=e.slice(1,-1)),t.setAttribute(e,n)}),(0,o.jsx)("div",{dangerouslySetInnerHTML:{__html:t.outerHTML}})}},Q=r=>{if(r instanceof c.Element&&r.name==="script"){let t=r.attribs.src;if(!t)return;if(!document.querySelector(`script[src="${t}"]`)){let e=document.createElement("script");e.src=t,document.head.append(e)}return(0,o.jsx)(o.Fragment,{})}},X=(r,t)=>{if(t instanceof c.Element&&t.name==="a"){let e=t.attribs.href;if(e!=null&&e.startsWith("#")&&!e.startsWith("#code/")){let n=null;return(0,m.isValidElement)(r)&&"props"in r&&(n=r.props.children),(0,o.jsx)(A,{href:e,...t.attribs,children:n})}}},Y=(r,t,e)=>{var n,i;if(t instanceof c.Element&&t.name==="div"&&((i=(n=t.attribs)==null?void 0:n.class)!=null&&i.includes("codehilite")))return(0,o.jsx)(rt,{children:r},e)},tt=(r,t)=>{var e;if(t instanceof c.Element&&((e=t.attribs)!=null&&e["data-marimo-doc"])){let n=t.attribs["data-marimo-doc"];return(0,o.jsx)(P,{qualifiedName:n,children:r})}},et=(r,t)=>{var e;if(t instanceof c.Element&&((e=t.attribs)!=null&&e["data-tooltip"])){let n=t.attribs["data-tooltip"];return(0,o.jsx)(F,{content:n,children:r})}},rt=r=>{let t=(0,U.c)(3),{children:e}=r,n=(0,m.useRef)(null),i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,o.jsx)("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,o.jsx)(L,{tooltip:!1,className:"p-1",value:()=>{var l;let s=(l=n.current)==null?void 0:l.firstChild;return s&&s.textContent||""}})}),t[0]=i):i=t[0];let a;return t[1]===e?a=t[2]:(a=(0,o.jsxs)("div",{className:"relative group codehilite-wrapper",ref:n,children:[e,i]}),t[1]=e,t[2]=a),a};const nt=({html:r,additionalReplacements:t=[],alwaysSanitizeHtml:e=!0})=>(0,o.jsx)(it,{html:r,alwaysSanitizeHtml:e,additionalReplacements:t});var it=({html:r,additionalReplacements:t=[],alwaysSanitizeHtml:e})=>{let n=B();return at({html:(0,m.useMemo)(()=>e||n?N(r):r,[r,e,n]),additionalReplacements:t})};function at({html:r,additionalReplacements:t=[]}){let e=[Z,K,Q,...t],n=[Y,X,tt,et,G,J];return M(r,{replace:(i,a)=>{for(let s of e){let l=s(i,a);if(l)return l}return i},transform:(i,a,s)=>{for(let l of n){let f=l(i,a,s);if(f)return f}return i}})}export{nt as t};
|