@marimo-team/frontend 0.25.3-dev96 → 0.25.3-dev98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{CellStatus-Dc8AR1al.js → CellStatus-fK4n2NPc.js} +1 -1
- package/dist/assets/{ErrorBoundary-DBQW23V4.js → ErrorBoundary-CAEGdoFW.js} +2 -2
- package/dist/assets/{JsonOutput-nLzWQ-0V.js → JsonOutput-CyAKmZDD.js} +1 -1
- package/dist/assets/{MarimoErrorOutput-DAFgeK_G.js → MarimoErrorOutput-CgZvP0p0.js} +1 -1
- package/dist/assets/{RenderHTML-DwolbpuI.js → RenderHTML-DQvxDDNS.js} +1 -1
- package/dist/assets/{RunButton-BN3_mnoU.js → RunButton-BBDnDL6G.js} +1 -1
- package/dist/assets/{add-cell-with-ai-CRbG5cTT.js → add-cell-with-ai-Clg5FELx.js} +1 -1
- package/dist/assets/{add-connection-dialog-CzCmVM_b.js → add-connection-dialog-BqdWmD-7.js} +1 -1
- package/dist/assets/{agent-panel-zpTxANfi.js → agent-panel-5RxG5Y82.js} +3 -3
- package/dist/assets/{ai-model-dropdown-DL56ImUU.js → ai-model-dropdown-Bvl1ktQq.js} +1 -1
- package/dist/assets/{app-config-button-BRBtaFi_.js → app-config-button-0QTeQ2Mv.js} +1 -1
- package/dist/assets/{blob-CuL-H1JC.js → blob-5VcB8K_t.js} +1 -1
- package/dist/assets/{cell-editor-C6QIY1Q-.js → cell-editor-Byw5y-oI.js} +1 -1
- package/dist/assets/{cell-link-C9tkvy6x.js → cell-link-C5yYyzuF.js} +1 -1
- package/dist/assets/{cells-B23_t5uX.js → cells-D_11MjVB.js} +13 -13
- package/dist/assets/{chat-display-DSezZ1qo.js → chat-display-BCR_ySiV.js} +1 -1
- package/dist/assets/{chat-panel-CocbwA2Q.js → chat-panel-RPRvBsaU.js} +1 -1
- package/dist/assets/{chat-ui-DXvDBccG.js → chat-ui-CGviVaRA.js} +2 -2
- package/dist/assets/{column-preview-BUQ_YMaE.js → column-preview-xe533-Cn.js} +1 -1
- package/dist/assets/{command-palette-HbIlNTLD.js → command-palette-BB9bWdWp.js} +1 -1
- package/dist/assets/{common-XXWicvmo.js → common-CaeItbcI.js} +1 -1
- package/dist/assets/{components-D1a5GeNf.js → components-G6frbw0c.js} +1 -1
- package/dist/assets/{datasource-Qo_t5PqI.js → datasource-deuXnlU-.js} +1 -1
- package/dist/assets/{dependency-graph-panel-DHrm4LUL.js → dependency-graph-panel-CIykLnJe.js} +1 -1
- package/dist/assets/{documentation-panel-BoNI3vXT.js → documentation-panel-2PQ8kQLa.js} +1 -1
- package/dist/assets/{download-Cm3InGht.js → download-dK52bLxZ.js} +1 -1
- package/dist/assets/{edit-page-BVkC2MyU.js → edit-page-C2phWLKH.js} +5 -5
- package/dist/assets/{error-entries-DEkB-8EY.js → error-entries-3GVk2KjS.js} +1 -1
- package/dist/assets/{error-panel-D7GInT--.js → error-panel-CzDRGPeC.js} +1 -1
- package/dist/assets/{feedback-button-sC38i-D1.js → feedback-button-C5NgWpFg.js} +1 -1
- package/dist/assets/feedback-button-CONwLFpw.js +1 -0
- package/dist/assets/{file-explorer-panel-2XFMubVM.js → file-explorer-panel-B50xDnTZ.js} +1 -1
- package/dist/assets/{file-name-input-DPs3KKM-.js → file-name-input-DqwMSgGU.js} +1 -1
- package/dist/assets/{floating-outline-C7MSAu6q.js → floating-outline-ChmAuvxz.js} +1 -1
- package/dist/assets/{gallery-page-B3fJlerH.js → gallery-page-CiL8aMS1.js} +1 -1
- package/dist/assets/{glide-data-editor-DrhzXms_.js → glide-data-editor-CqRclBkp.js} +1 -1
- package/dist/assets/{home-page-CajAhF9Q.js → home-page-BgZVl4dP.js} +1 -1
- package/dist/assets/{hooks-DteA-neM.js → hooks-DM5n7Osw.js} +1 -1
- package/dist/assets/{index-YQHSwyF3.js → index-vCxv6WVQ.js} +18 -18
- package/dist/assets/{layout-DEFRD3k3.js → layout-BpP8nTjb.js} +4 -4
- package/dist/assets/{logs-panel-BpM3pLdf.js → logs-panel-B5eVAZtH.js} +1 -1
- package/dist/assets/{markdown-renderer-C5aIPuRT.js → markdown-renderer-BWUzqkJM.js} +1 -1
- package/dist/assets/{name-cell-input-Dd8oSXnd.js → name-cell-input-DXW68gRW.js} +1 -1
- package/dist/assets/{outline-panel-kFr3Fo2d.js → outline-panel-DPxJhJ_A.js} +1 -1
- package/dist/assets/{packages-panel-Ce_wBuIJ.js → packages-panel-gBE2FWQr.js} +1 -1
- package/dist/assets/{panel-accordion-state-BO2rN4A5.js → panel-accordion-state-CCF5Gxnc.js} +1 -1
- package/dist/assets/{panels-Cy18qaTN.js → panels-BQYMF6p_.js} +1 -1
- package/dist/assets/{process-output-CDhnnF3f.js → process-output-Cw9IDcKQ.js} +1 -1
- package/dist/assets/{readonly-code-display-ChOK6mhE.js → readonly-code-display-DYcZQ28T.js} +1 -1
- package/dist/assets/{readonly-python-code-CVwB1OHZ.js → readonly-python-code-RFuQP50v.js} +1 -1
- package/dist/assets/{reveal-component-DE-4w0ik.js → reveal-component-yRrDmCQz.js} +2 -2
- package/dist/assets/{run-page-C6qwGqj6.js → run-page-CY65WUOu.js} +1 -1
- package/dist/assets/{runtime-details-state-BRSVs8um.js → runtime-details-state-pobtu6TO.js} +1 -1
- package/dist/assets/scratchpad-panel-H44_pvb_.js +1 -0
- package/dist/assets/{session-panel-B0CkZ3wl.js → session-panel-Bnd1iXkO.js} +1 -1
- package/dist/assets/{snippets-panel-CN-U1niV.js → snippets-panel-DKApxKx9.js} +1 -1
- package/dist/assets/{state-BRL89qqy.js → state-Bl9BiY_s.js} +1 -1
- package/dist/assets/{state-BoRCcWOg.js → state-Dv059B3A.js} +1 -1
- package/dist/assets/{tracing-CqxmObxN.js → tracing-Clwy4SlW.js} +1 -1
- package/dist/assets/{tracing-panel-Bn8xJSPi.js → tracing-panel-BwjLG_aC.js} +2 -2
- package/dist/assets/{tree-actions-DoPCJTpj.js → tree-actions-BZNTQ12N.js} +1 -1
- package/dist/assets/{useAddCell-DKb7o70l.js → useAddCell-Cjuqk2YR.js} +1 -1
- package/dist/assets/{useCellActionButton-CSNFulkR.js → useCellActionButton-MoWLvuGe.js} +1 -1
- package/dist/assets/{useDeleteCell-BPQ6Xcbj.js → useDeleteCell-BC-MW7d1.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-4SMlwjEg.js → useDependencyPanelTab-CZU7i-B3.js} +1 -1
- package/dist/assets/{useNotebookActions-B4kq9-P4.js → useNotebookActions-wFxVdRXQ.js} +1 -1
- package/dist/assets/{useRunCells-BV6nl_Ok.js → useRunCells-ByaWxoIt.js} +1 -1
- package/dist/assets/{useSplitCell-Ca364Rrx.js → useSplitCell-YJIystwv.js} +1 -1
- package/dist/index.html +20 -20
- package/package.json +1 -1
- package/src/components/chat/acp/blocks.tsx +2 -2
- package/src/components/data-table/charts/__tests__/chart-panel.test.tsx +74 -1
- package/src/components/data-table/charts/__tests__/storage.test.ts +4 -1
- package/src/components/data-table/charts/charts.tsx +21 -6
- package/src/components/data-table/charts/storage.ts +16 -5
- package/src/components/editor/output/ansi-reduce.ts +6 -0
- package/src/components/editor/output/console/ConsoleOutput.tsx +11 -7
- package/src/components/editor/package-alert.tsx +4 -4
- package/src/components/scratchpad/scratchpad.tsx +2 -2
- package/src/components/slides/reveal-component.tsx +4 -2
- package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +4 -0
- package/src/core/cells/__tests__/cell.test.ts +39 -0
- package/src/core/cells/__tests__/cells.test.ts +3 -1
- package/src/core/cells/__tests__/collapseConsoleOutputs.test.ts +54 -0
- package/src/core/cells/cell.ts +14 -3
- package/src/core/cells/cells.ts +1 -0
- package/src/core/cells/types.ts +10 -1
- package/src/plugins/impl/chat/chat-ui.tsx +1 -1
- package/dist/assets/feedback-button-Cz9BdS49.js +0 -1
- package/dist/assets/scratchpad-panel--SxH2dnk.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t}from"./useEvent-BDjgaBtz.js";import{t as n}from"./react-DVplv7_D.js";import{$t as r,Bn as i,En as a,On as o,Xt as s,Yt as c,Zt as l,cn as u,dn as d,en as f,nn as p,tn as m,un as h}from"./cells-B23_t5uX.js";import{t as g}from"./compiler-runtime-BrajqUja.js";import{D as _,O as v,S as y}from"./config-DpY86_Yq.js";import{M as b}from"./config-CD1IuZFJ.js";import{t as x}from"./jsx-runtime-B74pBk57.js";import{o as S}from"./alert-dialog-C-sWmKva.js";import{l as C}from"./select-3CVGlYrC.js";import{c as w}from"./switch-DYjBfpNJ.js";import{t as T}from"./tooltip-CkGm8X7m.js";import{t as E}from"./button-D8gVKwe-.js";import{t as D}from"./createLucideIcon-DfJ2oMlA.js";import{d as O,f as k,i as A,k as j,n as M,u as N}from"./ai-model-dropdown-DL56ImUU.js";import{r as P}from"./useNumberFormatter-D7O_26UI.js";import{b as F,p as I}from"./write-secret-modal-BEx-EUlh.js";import{Jt as L,Yt as R,nn as ee,r as z,tn as B}from"./input-DmHMEZGh.js";import{t as V}from"./settings-BpdQZRgT.js";import{t as te}from"./use-toast-Wu434mLr.js";import{s as H}from"./arrays-0R2reF2y.js";import{r as U}from"./requests-BIFR-h4M.js";import{r as ne}from"./useDebounce-DwTQ_1Pu.js";import{t as W}from"./kbd-pdKBv96t.js";import{t as G}from"./Inputs-BsQm29hD.js";var K=D(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),q=g(),J=x(),Y=e=>{let t=(0,q.c)(15),{description:n,disabled:r,tooltip:i}=e,a=r!==void 0&&r,o=i===void 0?`Shutdown`:i,{openConfirm:s,closeModal:c}=F(),{sendShutdown:l}=U(),u;t[0]===l?u=t[1]:(u=()=>{l(),setTimeout(X,200)},t[0]=l,t[1]=u);let d=u;if(b())return null;let f=a?`disabled`:`red`,p;t[2]!==c||t[3]!==n||t[4]!==d||t[5]!==s?(p=e=>{e.stopPropagation(),s({title:`Shutdown`,description:n,variant:`destructive`,confirmAction:(0,J.jsx)(S,{onClick:()=>{d(),c()},"aria-label":`Confirm Shutdown`,children:`Shutdown`})})},t[2]=c,t[3]=n,t[4]=d,t[5]=s,t[6]=p):p=t[6];let m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,J.jsx)(P,{strokeWidth:1}),t[7]=m):m=t[7];let h;t[8]!==a||t[9]!==f||t[10]!==p?(h=(0,J.jsx)(G,{"aria-label":`Shutdown`,"data-testid":`shutdown-button`,shape:`circle`,size:`small`,color:f,className:`h-[27px] w-[27px]`,disabled:a,onClick:p,children:m}),t[8]=a,t[9]=f,t[10]=p,t[11]=h):h=t[11];let g;return t[12]!==h||t[13]!==o?(g=(0,J.jsx)(T,{content:o,children:h}),t[12]=h,t[13]=o,t[14]=g):g=t[14],g};function X(){window.close()}var Z=e(n(),1),re=100,ie=()=>{let e=(0,q.c)(37),[t,n]=y(),{saveAppConfig:u}=U(),d=(0,Z.useId)(),h=(0,Z.useId)(),g;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=a(_),e[0]=g):g=e[0];let v;e[1]===t?v=e[2]:(v={resolver:g,defaultValues:t},e[1]=t,e[2]=v);let b=o(v),x;e[3]!==u||e[4]!==n?(x=async e=>{await u({config:e}).then(()=>{n(e)}).catch(()=>{n(e)})},e[3]=u,e[4]=n,e[5]=x):x=e[5];let S=x,C;e[6]===S?C=e[7]:(C=e=>{S(e)},e[6]=S,e[7]=C);let w=ne(C,re),T;e[8]===t.width?T=e[9]:(T=[t.width],e[8]=t.width,e[9]=T),(0,Z.useEffect)(ae,T);let E;e[10]!==w||e[11]!==b?(E=b.handleSubmit(w),e[10]=w,e[11]=b,e[12]=E):E=e[12];let D;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,J.jsxs)(`div`,{children:[(0,J.jsx)(k,{children:`Notebook Settings`}),(0,J.jsx)(O,{children:`Configure how your notebook or application looks and behaves.`})]}),e[13]=D):D=e[13];let A;e[14]===b.control?A=e[15]:(A=(0,J.jsxs)(Q,{title:`Display`,children:[(0,J.jsx)(r,{control:b.control,name:`width`,render:se}),(0,J.jsx)(r,{control:b.control,name:`app_title`,render:$})]}),e[14]=b.control,e[15]=A);let j;e[16]===b.control?j=e[17]:(j=(0,J.jsxs)(Q,{title:`Custom Files`,children:[(0,J.jsx)(r,{control:b.control,name:`css_file`,render:ce}),(0,J.jsx)(r,{control:b.control,name:`html_head_file`,render:le})]}),e[16]=b.control,e[17]=j);let M;e[18]===b.control?M=e[19]:(M=(0,J.jsx)(Q,{title:`Data`,children:(0,J.jsx)(r,{control:b.control,name:`sql_output`,render:de})}),e[18]=b.control,e[19]=M);let N;e[20]!==d||e[21]!==h?(N=e=>{let{field:t}=e;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-y-1`,children:[(0,J.jsxs)(f,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(s,{children:(0,J.jsxs)(`div`,{className:`flex gap-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,J.jsx)(i,{id:d,"data-testid":`html-checkbox`,checked:t.value.includes(`html`),onCheckedChange:()=>{t.onChange(H(t.value,`html`))}}),(0,J.jsx)(m,{htmlFor:d,children:`HTML`})]}),(0,J.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,J.jsx)(i,{id:h,"data-testid":`ipynb-checkbox`,checked:t.value.includes(`ipynb`),onCheckedChange:()=>{t.onChange(H(t.value,`ipynb`))}}),(0,J.jsx)(m,{htmlFor:h,children:`IPYNB`})]})]})}),(0,J.jsx)(p,{})]}),(0,J.jsxs)(l,{children:[`When enabled, marimo will periodically save this notebook in your selected formats (HTML, IPYNB) to a folder named`,` `,(0,J.jsx)(W,{className:`inline`,children:`__marimo__`}),` next to your notebook file.`]})]})},e[20]=d,e[21]=h,e[22]=N):N=e[22];let P;e[23]!==b.control||e[24]!==N?(P=(0,J.jsx)(Q,{title:`Exporting outputs`,children:(0,J.jsx)(r,{control:b.control,name:`auto_download`,render:N})}),e[23]=b.control,e[24]=N,e[25]=P):P=e[25];let F;e[26]!==P||e[27]!==A||e[28]!==j||e[29]!==M?(F=(0,J.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-8 gap-y-4`,children:[A,j,M,P]}),e[26]=P,e[27]=A,e[28]=j,e[29]=M,e[30]=F):F=e[30];let I;e[31]!==F||e[32]!==E?(I=(0,J.jsxs)(`form`,{onChange:E,className:`flex flex-col gap-6`,children:[D,F]}),e[31]=F,e[32]=E,e[33]=I):I=e[33];let L;return e[34]!==b||e[35]!==I?(L=(0,J.jsx)(c,{...b,children:I}),e[34]=b,e[35]=I,e[36]=L):L=e[36],L},Q=e=>{let t=(0,q.c)(5),{title:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,J.jsx)(`h3`,{className:`text-base font-semibold mb-1`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,J.jsxs)(`div`,{className:`flex flex-col gap-y-2`,children:[i,r]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a};function ae(){window.dispatchEvent(new Event(`resize`))}function oe(e){return(0,J.jsx)(`option`,{value:e,children:e},e)}function se(e){let{field:t}=e;return(0,J.jsxs)(f,{className:`flex flex-row items-center space-x-1 space-y-0`,children:[(0,J.jsx)(m,{children:`Width`}),(0,J.jsx)(s,{children:(0,J.jsx)(C,{"data-testid":`app-width-select`,onChange:e=>t.onChange(e.target.value),value:t.value,disabled:t.disabled,className:`inline-flex mr-2`,children:j().map(oe)})}),(0,J.jsx)(p,{})]})}function $(e){let{field:t}=e;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-y-1`,children:[(0,J.jsxs)(f,{className:`flex flex-row items-center space-x-1 space-y-0`,children:[(0,J.jsx)(m,{children:`App title`}),(0,J.jsx)(s,{children:(0,J.jsx)(z,{...t,value:t.value??``,onChange:e=>{t.onChange(e.target.value),v.safeParse(e.target.value).success&&(document.title=e.target.value)}})}),(0,J.jsx)(p,{})]}),(0,J.jsx)(l,{children:`The application title is put in the title tag in the HTML code and typically displayed in the title bar of the browser window.`})]})}function ce(e){let{field:t}=e;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-y-1`,children:[(0,J.jsxs)(f,{className:`flex flex-row items-center space-x-1 space-y-0`,children:[(0,J.jsx)(m,{className:`shrink-0`,children:`Custom CSS`}),(0,J.jsx)(s,{children:(0,J.jsx)(z,{...t,value:t.value??``,placeholder:`custom.css`,onChange:e=>{t.onChange(e.target.value),v.safeParse(e.target.value).success&&(document.title=e.target.value)}})}),(0,J.jsx)(p,{})]}),(0,J.jsx)(l,{children:`A filepath to a custom css file to be injected into the notebook.`})]})}function le(e){let{field:t}=e;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-y-1`,children:[(0,J.jsxs)(f,{className:`flex flex-row items-center space-x-1 space-y-0`,children:[(0,J.jsx)(m,{className:`shrink-0`,children:`HTML Head`}),(0,J.jsx)(s,{children:(0,J.jsx)(z,{...t,value:t.value??``,placeholder:`head.html`,onChange:e=>{t.onChange(e.target.value)}})}),(0,J.jsx)(p,{})]}),(0,J.jsxs)(l,{children:[`A filepath to an HTML file to be injected into the`,` `,(0,J.jsx)(W,{className:`inline`,children:`<head/>`}),` section of the notebook. Use this to add analytics, custom fonts, meta tags, or external scripts.`]})]})}function ue(e){return(0,J.jsx)(`option`,{value:e.value,children:e.label},e.value)}function de(e){let{field:t}=e;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-y-1`,children:[(0,J.jsxs)(f,{className:`flex flex-row items-center space-x-1 space-y-0`,children:[(0,J.jsx)(m,{children:`SQL Output Type`}),(0,J.jsx)(s,{children:(0,J.jsx)(C,{"data-testid":`sql-output-select`,onChange:e=>{t.onChange(e.target.value),te({title:`Kernel Restart Required`,description:`This change requires a kernel restart to take effect.`})},value:t.value,disabled:t.disabled,className:`inline-flex mr-2`,children:N.map(ue)})}),(0,J.jsx)(p,{})]}),(0,J.jsxs)(l,{children:[`The Python type returned by a SQL cell. For best performance with large datasets, we recommend using`,` `,(0,J.jsx)(W,{className:`inline`,children:`native`}),`. See the`,` `,(0,J.jsx)(I,{href:`https://docs.marimo.io/guides/working_with_data/sql`,children:`SQL guide`}),` `,`for more information.`]})]})}var fe=e=>{let n=(0,q.c)(32),{showAppConfig:r,disabled:i,tooltip:a}=e,o=r===void 0||r,s=i!==void 0&&i,c=a===void 0?`Settings`:a,[l,f]=t(M),p=s?`disabled`:`hint-green`,m;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,J.jsx)(V,{strokeWidth:1.8}),n[0]=m):m=n[0];let g;n[1]===c?g=n[2]:(g=(0,J.jsx)(T,{content:c,children:m}),n[1]=c,n[2]=g);let _;n[3]!==s||n[4]!==p||n[5]!==g?(_=(0,J.jsx)(G,{"aria-label":`Config`,"data-testid":`app-config-button`,shape:`circle`,size:`small`,className:`h-[27px] w-[27px]`,disabled:s,color:p,children:g}),n[3]=s,n[4]=p,n[5]=g,n[6]=_):_=n[6];let v=_,y;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,J.jsxs)(R,{className:`w-[90vw] h-[90vh] overflow-hidden sm:max-w-5xl top-[5vh] p-0`,children:[(0,J.jsx)(w,{children:(0,J.jsx)(B,{children:`User settings`})}),(0,J.jsx)(A,{})]}),n[7]=y):y=n[7];let b=y;if(!o){let e;n[8]===v?e=n[9]:(e=(0,J.jsx)(ee,{children:v}),n[8]=v,n[9]=e);let t;return n[10]!==f||n[11]!==l||n[12]!==e?(t=(0,J.jsxs)(L,{open:l,onOpenChange:f,children:[e,b]}),n[10]=f,n[11]=l,n[12]=e,n[13]=t):t=n[13],t}let x;n[14]===v?x=n[15]:(x=(0,J.jsx)(d,{asChild:!0,children:v}),n[14]=v,n[15]=x);let S,C;n[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,J.jsx)(ie,{}),C=(0,J.jsx)(`div`,{className:`h-px bg-border my-2`}),n[16]=S,n[17]=C):(S=n[16],C=n[17]);let D;n[18]===f?D=n[19]:(D=()=>f(!0),n[18]=f,n[19]=D);let O;n[20]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,J.jsx)(V,{strokeWidth:1.8,className:`w-4 h-4 mr-2`}),n[20]=O):O=n[20];let k;n[21]===D?k=n[22]:(k=(0,J.jsxs)(h,{className:`w-[650px] overflow-auto max-h-[80vh] max-w-[80vw]`,align:`end`,side:`bottom`,onFocusOutside:pe,children:[S,C,(0,J.jsxs)(E,{onClick:D,variant:`link`,className:`px-0`,children:[O,`User settings`]})]}),n[21]=D,n[22]=k);let j;n[23]!==k||n[24]!==x?(j=(0,J.jsxs)(u,{children:[x,k]}),n[23]=k,n[24]=x,n[25]=j):j=n[25];let N;n[26]!==f||n[27]!==l?(N=(0,J.jsx)(L,{open:l,onOpenChange:f,children:b}),n[26]=f,n[27]=l,n[28]=N):N=n[28];let P;return n[29]!==j||n[30]!==N?(P=(0,J.jsxs)(J.Fragment,{children:[j,N]}),n[29]=j,n[30]=N,n[31]=P):P=n[31],P};function pe(e){return e.preventDefault()}export{Y as n,K as r,fe as t};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t}from"./useEvent-BDjgaBtz.js";import{t as n}from"./react-DVplv7_D.js";import{$t as r,Bn as i,En as a,On as o,Xt as s,Yt as c,Zt as l,cn as u,dn as d,en as f,nn as p,tn as m,un as h}from"./cells-D_11MjVB.js";import{t as g}from"./compiler-runtime-BrajqUja.js";import{D as _,O as v,S as y}from"./config-DpY86_Yq.js";import{M as b}from"./config-CD1IuZFJ.js";import{t as x}from"./jsx-runtime-B74pBk57.js";import{o as S}from"./alert-dialog-C-sWmKva.js";import{l as C}from"./select-3CVGlYrC.js";import{c as w}from"./switch-DYjBfpNJ.js";import{t as T}from"./tooltip-CkGm8X7m.js";import{t as E}from"./button-D8gVKwe-.js";import{t as D}from"./createLucideIcon-DfJ2oMlA.js";import{d as O,f as k,i as A,k as j,n as M,u as N}from"./ai-model-dropdown-Bvl1ktQq.js";import{r as P}from"./useNumberFormatter-D7O_26UI.js";import{b as F,p as I}from"./write-secret-modal-BEx-EUlh.js";import{Jt as L,Yt as R,nn as ee,r as z,tn as B}from"./input-DmHMEZGh.js";import{t as V}from"./settings-BpdQZRgT.js";import{t as te}from"./use-toast-Wu434mLr.js";import{s as H}from"./arrays-0R2reF2y.js";import{r as U}from"./requests-BIFR-h4M.js";import{r as ne}from"./useDebounce-DwTQ_1Pu.js";import{t as W}from"./kbd-pdKBv96t.js";import{t as G}from"./Inputs-BsQm29hD.js";var K=D(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),q=g(),J=x(),Y=e=>{let t=(0,q.c)(15),{description:n,disabled:r,tooltip:i}=e,a=r!==void 0&&r,o=i===void 0?`Shutdown`:i,{openConfirm:s,closeModal:c}=F(),{sendShutdown:l}=U(),u;t[0]===l?u=t[1]:(u=()=>{l(),setTimeout(X,200)},t[0]=l,t[1]=u);let d=u;if(b())return null;let f=a?`disabled`:`red`,p;t[2]!==c||t[3]!==n||t[4]!==d||t[5]!==s?(p=e=>{e.stopPropagation(),s({title:`Shutdown`,description:n,variant:`destructive`,confirmAction:(0,J.jsx)(S,{onClick:()=>{d(),c()},"aria-label":`Confirm Shutdown`,children:`Shutdown`})})},t[2]=c,t[3]=n,t[4]=d,t[5]=s,t[6]=p):p=t[6];let m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,J.jsx)(P,{strokeWidth:1}),t[7]=m):m=t[7];let h;t[8]!==a||t[9]!==f||t[10]!==p?(h=(0,J.jsx)(G,{"aria-label":`Shutdown`,"data-testid":`shutdown-button`,shape:`circle`,size:`small`,color:f,className:`h-[27px] w-[27px]`,disabled:a,onClick:p,children:m}),t[8]=a,t[9]=f,t[10]=p,t[11]=h):h=t[11];let g;return t[12]!==h||t[13]!==o?(g=(0,J.jsx)(T,{content:o,children:h}),t[12]=h,t[13]=o,t[14]=g):g=t[14],g};function X(){window.close()}var Z=e(n(),1),re=100,ie=()=>{let e=(0,q.c)(37),[t,n]=y(),{saveAppConfig:u}=U(),d=(0,Z.useId)(),h=(0,Z.useId)(),g;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=a(_),e[0]=g):g=e[0];let v;e[1]===t?v=e[2]:(v={resolver:g,defaultValues:t},e[1]=t,e[2]=v);let b=o(v),x;e[3]!==u||e[4]!==n?(x=async e=>{await u({config:e}).then(()=>{n(e)}).catch(()=>{n(e)})},e[3]=u,e[4]=n,e[5]=x):x=e[5];let S=x,C;e[6]===S?C=e[7]:(C=e=>{S(e)},e[6]=S,e[7]=C);let w=ne(C,re),T;e[8]===t.width?T=e[9]:(T=[t.width],e[8]=t.width,e[9]=T),(0,Z.useEffect)(ae,T);let E;e[10]!==w||e[11]!==b?(E=b.handleSubmit(w),e[10]=w,e[11]=b,e[12]=E):E=e[12];let D;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,J.jsxs)(`div`,{children:[(0,J.jsx)(k,{children:`Notebook Settings`}),(0,J.jsx)(O,{children:`Configure how your notebook or application looks and behaves.`})]}),e[13]=D):D=e[13];let A;e[14]===b.control?A=e[15]:(A=(0,J.jsxs)(Q,{title:`Display`,children:[(0,J.jsx)(r,{control:b.control,name:`width`,render:se}),(0,J.jsx)(r,{control:b.control,name:`app_title`,render:$})]}),e[14]=b.control,e[15]=A);let j;e[16]===b.control?j=e[17]:(j=(0,J.jsxs)(Q,{title:`Custom Files`,children:[(0,J.jsx)(r,{control:b.control,name:`css_file`,render:ce}),(0,J.jsx)(r,{control:b.control,name:`html_head_file`,render:le})]}),e[16]=b.control,e[17]=j);let M;e[18]===b.control?M=e[19]:(M=(0,J.jsx)(Q,{title:`Data`,children:(0,J.jsx)(r,{control:b.control,name:`sql_output`,render:de})}),e[18]=b.control,e[19]=M);let N;e[20]!==d||e[21]!==h?(N=e=>{let{field:t}=e;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-y-1`,children:[(0,J.jsxs)(f,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(s,{children:(0,J.jsxs)(`div`,{className:`flex gap-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,J.jsx)(i,{id:d,"data-testid":`html-checkbox`,checked:t.value.includes(`html`),onCheckedChange:()=>{t.onChange(H(t.value,`html`))}}),(0,J.jsx)(m,{htmlFor:d,children:`HTML`})]}),(0,J.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,J.jsx)(i,{id:h,"data-testid":`ipynb-checkbox`,checked:t.value.includes(`ipynb`),onCheckedChange:()=>{t.onChange(H(t.value,`ipynb`))}}),(0,J.jsx)(m,{htmlFor:h,children:`IPYNB`})]})]})}),(0,J.jsx)(p,{})]}),(0,J.jsxs)(l,{children:[`When enabled, marimo will periodically save this notebook in your selected formats (HTML, IPYNB) to a folder named`,` `,(0,J.jsx)(W,{className:`inline`,children:`__marimo__`}),` next to your notebook file.`]})]})},e[20]=d,e[21]=h,e[22]=N):N=e[22];let P;e[23]!==b.control||e[24]!==N?(P=(0,J.jsx)(Q,{title:`Exporting outputs`,children:(0,J.jsx)(r,{control:b.control,name:`auto_download`,render:N})}),e[23]=b.control,e[24]=N,e[25]=P):P=e[25];let F;e[26]!==P||e[27]!==A||e[28]!==j||e[29]!==M?(F=(0,J.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-8 gap-y-4`,children:[A,j,M,P]}),e[26]=P,e[27]=A,e[28]=j,e[29]=M,e[30]=F):F=e[30];let I;e[31]!==F||e[32]!==E?(I=(0,J.jsxs)(`form`,{onChange:E,className:`flex flex-col gap-6`,children:[D,F]}),e[31]=F,e[32]=E,e[33]=I):I=e[33];let L;return e[34]!==b||e[35]!==I?(L=(0,J.jsx)(c,{...b,children:I}),e[34]=b,e[35]=I,e[36]=L):L=e[36],L},Q=e=>{let t=(0,q.c)(5),{title:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,J.jsx)(`h3`,{className:`text-base font-semibold mb-1`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,J.jsxs)(`div`,{className:`flex flex-col gap-y-2`,children:[i,r]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a};function ae(){window.dispatchEvent(new Event(`resize`))}function oe(e){return(0,J.jsx)(`option`,{value:e,children:e},e)}function se(e){let{field:t}=e;return(0,J.jsxs)(f,{className:`flex flex-row items-center space-x-1 space-y-0`,children:[(0,J.jsx)(m,{children:`Width`}),(0,J.jsx)(s,{children:(0,J.jsx)(C,{"data-testid":`app-width-select`,onChange:e=>t.onChange(e.target.value),value:t.value,disabled:t.disabled,className:`inline-flex mr-2`,children:j().map(oe)})}),(0,J.jsx)(p,{})]})}function $(e){let{field:t}=e;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-y-1`,children:[(0,J.jsxs)(f,{className:`flex flex-row items-center space-x-1 space-y-0`,children:[(0,J.jsx)(m,{children:`App title`}),(0,J.jsx)(s,{children:(0,J.jsx)(z,{...t,value:t.value??``,onChange:e=>{t.onChange(e.target.value),v.safeParse(e.target.value).success&&(document.title=e.target.value)}})}),(0,J.jsx)(p,{})]}),(0,J.jsx)(l,{children:`The application title is put in the title tag in the HTML code and typically displayed in the title bar of the browser window.`})]})}function ce(e){let{field:t}=e;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-y-1`,children:[(0,J.jsxs)(f,{className:`flex flex-row items-center space-x-1 space-y-0`,children:[(0,J.jsx)(m,{className:`shrink-0`,children:`Custom CSS`}),(0,J.jsx)(s,{children:(0,J.jsx)(z,{...t,value:t.value??``,placeholder:`custom.css`,onChange:e=>{t.onChange(e.target.value),v.safeParse(e.target.value).success&&(document.title=e.target.value)}})}),(0,J.jsx)(p,{})]}),(0,J.jsx)(l,{children:`A filepath to a custom css file to be injected into the notebook.`})]})}function le(e){let{field:t}=e;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-y-1`,children:[(0,J.jsxs)(f,{className:`flex flex-row items-center space-x-1 space-y-0`,children:[(0,J.jsx)(m,{className:`shrink-0`,children:`HTML Head`}),(0,J.jsx)(s,{children:(0,J.jsx)(z,{...t,value:t.value??``,placeholder:`head.html`,onChange:e=>{t.onChange(e.target.value)}})}),(0,J.jsx)(p,{})]}),(0,J.jsxs)(l,{children:[`A filepath to an HTML file to be injected into the`,` `,(0,J.jsx)(W,{className:`inline`,children:`<head/>`}),` section of the notebook. Use this to add analytics, custom fonts, meta tags, or external scripts.`]})]})}function ue(e){return(0,J.jsx)(`option`,{value:e.value,children:e.label},e.value)}function de(e){let{field:t}=e;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-y-1`,children:[(0,J.jsxs)(f,{className:`flex flex-row items-center space-x-1 space-y-0`,children:[(0,J.jsx)(m,{children:`SQL Output Type`}),(0,J.jsx)(s,{children:(0,J.jsx)(C,{"data-testid":`sql-output-select`,onChange:e=>{t.onChange(e.target.value),te({title:`Kernel Restart Required`,description:`This change requires a kernel restart to take effect.`})},value:t.value,disabled:t.disabled,className:`inline-flex mr-2`,children:N.map(ue)})}),(0,J.jsx)(p,{})]}),(0,J.jsxs)(l,{children:[`The Python type returned by a SQL cell. For best performance with large datasets, we recommend using`,` `,(0,J.jsx)(W,{className:`inline`,children:`native`}),`. See the`,` `,(0,J.jsx)(I,{href:`https://docs.marimo.io/guides/working_with_data/sql`,children:`SQL guide`}),` `,`for more information.`]})]})}var fe=e=>{let n=(0,q.c)(32),{showAppConfig:r,disabled:i,tooltip:a}=e,o=r===void 0||r,s=i!==void 0&&i,c=a===void 0?`Settings`:a,[l,f]=t(M),p=s?`disabled`:`hint-green`,m;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,J.jsx)(V,{strokeWidth:1.8}),n[0]=m):m=n[0];let g;n[1]===c?g=n[2]:(g=(0,J.jsx)(T,{content:c,children:m}),n[1]=c,n[2]=g);let _;n[3]!==s||n[4]!==p||n[5]!==g?(_=(0,J.jsx)(G,{"aria-label":`Config`,"data-testid":`app-config-button`,shape:`circle`,size:`small`,className:`h-[27px] w-[27px]`,disabled:s,color:p,children:g}),n[3]=s,n[4]=p,n[5]=g,n[6]=_):_=n[6];let v=_,y;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,J.jsxs)(R,{className:`w-[90vw] h-[90vh] overflow-hidden sm:max-w-5xl top-[5vh] p-0`,children:[(0,J.jsx)(w,{children:(0,J.jsx)(B,{children:`User settings`})}),(0,J.jsx)(A,{})]}),n[7]=y):y=n[7];let b=y;if(!o){let e;n[8]===v?e=n[9]:(e=(0,J.jsx)(ee,{children:v}),n[8]=v,n[9]=e);let t;return n[10]!==f||n[11]!==l||n[12]!==e?(t=(0,J.jsxs)(L,{open:l,onOpenChange:f,children:[e,b]}),n[10]=f,n[11]=l,n[12]=e,n[13]=t):t=n[13],t}let x;n[14]===v?x=n[15]:(x=(0,J.jsx)(d,{asChild:!0,children:v}),n[14]=v,n[15]=x);let S,C;n[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,J.jsx)(ie,{}),C=(0,J.jsx)(`div`,{className:`h-px bg-border my-2`}),n[16]=S,n[17]=C):(S=n[16],C=n[17]);let D;n[18]===f?D=n[19]:(D=()=>f(!0),n[18]=f,n[19]=D);let O;n[20]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,J.jsx)(V,{strokeWidth:1.8,className:`w-4 h-4 mr-2`}),n[20]=O):O=n[20];let k;n[21]===D?k=n[22]:(k=(0,J.jsxs)(h,{className:`w-[650px] overflow-auto max-h-[80vh] max-w-[80vw]`,align:`end`,side:`bottom`,onFocusOutside:pe,children:[S,C,(0,J.jsxs)(E,{onClick:D,variant:`link`,className:`px-0`,children:[O,`User settings`]})]}),n[21]=D,n[22]=k);let j;n[23]!==k||n[24]!==x?(j=(0,J.jsxs)(u,{children:[x,k]}),n[23]=k,n[24]=x,n[25]=j):j=n[25];let N;n[26]!==f||n[27]!==l?(N=(0,J.jsx)(L,{open:l,onOpenChange:f,children:b}),n[26]=f,n[27]=l,n[28]=N):N=n[28];let P;return n[29]!==j||n[30]!==N?(P=(0,J.jsxs)(J.Fragment,{children:[j,N]}),n[29]=j,n[30]=N,n[31]=P):P=n[31],P};function pe(e){return e.preventDefault()}export{Y as n,K as r,fe as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./markdown-renderer-
|
|
1
|
+
import{a as e}from"./markdown-renderer-BWUzqkJM.js";function t(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=e=>{t(e.target?.result)},r.onerror=e=>{n(Error(`Failed to read blob: ${e.type}`))},r.readAsDataURL(e)})}function n(e){let[t,n]=e.split(`,`,2),r=/^data:(.+);base64$/.exec(t)?.[1],i=atob(n),a=i.length,o=new Uint8Array(a);for(let e=0;e<a;e++)o[e]=i.charCodeAt(e);return new Blob([o],{type:r})}function r({contents:t,mimeType:r,isBase64:i}){return i?n(e(t,r)):new Blob([t],{type:r})}export{r as n,t as r,n as t};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./loro_wasm_bg-C2Fqi8D-.js","./loro_wasm_bg-Ctp2cNI9.js","./rolldown-runtime-B0Z9INg1.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,d as n,f as r,l as i,o as a,r as o,s,t as c,u as l}from"./useEvent-BDjgaBtz.js";import{t as u}from"./react-DVplv7_D.js";import{$i as d,Bn as f,Br as p,Bt as m,Ca as h,Ci as g,Co as _,Cr as v,D as y,Dr as b,Fr as x,H as S,I as C,Ir as w,K as T,Lr as E,Lt as D,Ni as O,Nn as ee,Nr as k,Pr as te,Qi as ne,Ri as re,Rr as A,Si as j,U as ie,Ur as M,V as N,Vn as P,W as ae,Wr as oe,Yn as se,Zn as ce,_i as le,_n as ue,_t as de,ai as fe,ar as pe,at as me,b as he,ba as ge,bi as _e,bt as ve,ca as ye,ci as be,cn as xe,cr as Se,d as Ce,dt as we,fi as Te,fn as Ee,fo as De,ft as Oe,ga as ke,gn as Ae,gt as je,h as Me,ha as Ne,ht as Pe,i as Fe,it as Ie,jo as Le,jr as Re,li as ze,lr as Be,mn as Ve,mt as He,ni as Ue,nr as We,or as Ge,ot as Ke,pi as qe,pt as Je,qa as Ye,ri as Xe,rr as Ze,sa as Qe,si as $e,sr as et,ti as tt,tr as nt,tt as rt,u as it,ui as at,un as ot,vn as st,vr as ct,vt as lt,wa as ut,wi as dt,xa as ft,xi as pt,xo as mt,yi as ht,za as gt,zr as F}from"./cells-
|
|
2
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,d as n,f as r,l as i,o as a,r as o,s,t as c,u as l}from"./useEvent-BDjgaBtz.js";import{t as u}from"./react-DVplv7_D.js";import{$i as d,Bn as f,Br as p,Bt as m,Ca as h,Ci as g,Co as _,Cr as v,D as y,Dr as b,Fr as x,H as S,I as C,Ir as w,K as T,Lr as E,Lt as D,Ni as O,Nn as ee,Nr as k,Pr as te,Qi as ne,Ri as re,Rr as A,Si as j,U as ie,Ur as M,V as N,Vn as P,W as ae,Wr as oe,Yn as se,Zn as ce,_i as le,_n as ue,_t as de,ai as fe,ar as pe,at as me,b as he,ba as ge,bi as _e,bt as ve,ca as ye,ci as be,cn as xe,cr as Se,d as Ce,dt as we,fi as Te,fn as Ee,fo as De,ft as Oe,ga as ke,gn as Ae,gt as je,h as Me,ha as Ne,ht as Pe,i as Fe,it as Ie,jo as Le,jr as Re,li as ze,lr as Be,mn as Ve,mt as He,ni as Ue,nr as We,or as Ge,ot as Ke,pi as qe,pt as Je,qa as Ye,ri as Xe,rr as Ze,sa as Qe,si as $e,sr as et,ti as tt,tr as nt,tt as rt,u as it,ui as at,un as ot,vn as st,vr as ct,vt as lt,wa as ut,wi as dt,xa as ft,xi as pt,xo as mt,yi as ht,za as gt,zr as F}from"./cells-D_11MjVB.js";import{t as _t}from"./react-dom-_LrxgvjW.js";import{C as vt,I as yt,M as bt,N as xt,O as St,R as Ct,S as wt,b as Tt}from"./schemas-ChRqMOTL.js";import{t as Et}from"./compiler-runtime-BrajqUja.js";import{t as Dt}from"./debounce-aFmHgJZY.js";import{E as Ot,_ as kt,c as At,g as jt,h as Mt,s as Nt}from"./config-DpY86_Yq.js";import{_ as Pt,c as Ft,g as It,m as Lt,t as Rt}from"./useEventListener-CjDeLqFC.js";import{t as zt}from"./invariant-Ci2dTZ72.js";import{s as Bt}from"./config-DMz7oN0r.js";import{d as Vt,m as Ht,t as Ut}from"./session-CMLIzZKw.js";import{D as Wt,M as Gt,S as Kt,T as qt,_ as Jt,o as Yt,p as Xt,r as Zt}from"./config-CD1IuZFJ.js";import{c as Qt}from"./state-C5WAeuTu.js";import{t as $t}from"./ErrorBoundary-CAEGdoFW.js";import{t as en}from"./cn-ldLVeaqm.js";import{t as tn}from"./jsx-runtime-B74pBk57.js";import{X as nn,Z as rn}from"./JsonOutput-CyAKmZDD.js";import{d as an}from"./select-3CVGlYrC.js";import{n as on}from"./download-dK52bLxZ.js";import{t as sn}from"./switch-DYjBfpNJ.js";import{t as cn}from"./tooltip-CkGm8X7m.js";import{r as ln,t as un}from"./button-D8gVKwe-.js";import{t as dn}from"./createLucideIcon-DfJ2oMlA.js";import{i as fn,n as pn}from"./paths-bkIFVj8h.js";import{r as mn}from"./layout-BpP8nTjb.js";import{A as hn,C as gn,D as _n,_ as vn,j as yn,t as bn,v as xn,y as Sn}from"./ai-model-dropdown-Bvl1ktQq.js";import{r as Cn}from"./useNumberFormatter-D7O_26UI.js";import{t as wn}from"./circle-check-BCurAHEb.js";import{B as Tn,F as En,G as Dn,I as On,L as kn,M as An,R as jn,T as Mn,V as Nn,W as Pn,c as Fn,f as In,i as Ln,n as Rn,o as zn,r as Bn,s as Vn,w as Hn,z as Un}from"./add-cell-with-ai-Clg5FELx.js";import{t as Wn}from"./database-zap-B_PMVg8T.js";import{r as Gn,t as Kn}from"./file-icons-CdJgUy-I.js";import{t as qn}from"./components-DCo7mAWO.js";import{b as Jn}from"./write-secret-modal-BEx-EUlh.js";import{n as Yn}from"./spinner-DyNE-o8o.js";import{n as Xn,o as Zn,r as Qn}from"./readonly-python-code-RFuQP50v.js";import{n as $n,t as er}from"./useDeleteCell-BC-MW7d1.js";import{t as tr}from"./save-Dgoim6QF.js";import{G as nr,I as rr,Ut as ir,Xt as ar,Yt as or,Zt as sr,tn as cr}from"./input-DmHMEZGh.js";import{n as lr}from"./copy-KlhazlhB.js";import{t as ur}from"./use-toast-Wu434mLr.js";import{t as dr}from"./preload-helper-uBIymjUX.js";import{$t as fr,Ct as pr,Dt as mr,E as hr,Et as gr,Ft as _r,Gt as vr,H as yr,I as br,It as xr,Jt as Sr,Kt as Cr,Ot as wr,P as Tr,Qt as I,St as Er,Ut as Dr,V as Or,Vt as kr,Wt as Ar,Xt as jr,_ as Mr,at as L,dt as Nr,gt as Pr,ht as Fr,in as Ir,jt as Lr,lt as Rr,m as zr,ot as Br,st as R,tn as Vr,ut as Hr,w as Ur,wt as Wr,zt as Gr}from"./dist-Cny7_yZb.js";import{C as Kr,E as qr,I as Jr,O as Yr,S as Xr,a as Zr,c as Qr,n as $r,r as ei,w as ti}from"./dist-DBMV4gqt.js";import{o as ni}from"./arrays-0R2reF2y.js";import{n as ri}from"./once-6KNTRW0u.js";import{t as ii}from"./createReducer-CaI_Oa0v.js";import{a as ai,c as oi,f as si,h as ci,i as li,l as ui,n as di,o as fi,t as pi}from"./dist-qhAY4L2r.js";import{r as mi}from"./strings-C25fhMR_.js";import{r as hi,t as gi}from"./requests-BIFR-h4M.js";import{t as _i}from"./badge-crT3E0Rm.js";import{a as vi}from"./dist-DusFODSa.js";import{r as yi}from"./useTheme-BAA27lh7.js";import{t as bi}from"./I18nProvider-Cg2I_s1_.js";import{i as xi}from"./numbers-CsZVw3Dc.js";import{n as Si}from"./useAsyncData-qvoPYHtx.js";import{a as Ci}from"./useRunCells-ByaWxoIt.js";import{l as wi}from"./useInstallPackage-wcDq9hYT.js";import{a as Ti}from"./errors-CNsgAw6m.js";import{t as z}from"./extends-CvVTau-c.js";import{t as Ei}from"./objectWithoutPropertiesLoose-Do6ywDBO.js";import{t as Di}from"./kbd-pdKBv96t.js";import{a as Oi,n as ki}from"./state-Dv059B3A.js";import{a as Ai,o as ji}from"./cell-link-C5yYyzuF.js";import{a as Mi}from"./renderShortcut-rUwGqKgC.js";import{n as Ni,t as Pi}from"./icons-CiZ_8zS-.js";import{n as Fi}from"./esm-CI_o7NhW.js";import{t as Ii}from"./dist-AelfNxj6.js";import{t as Li}from"./skeleton-Cqh4O9g1.js";import{t as Ri}from"./requests-DuLJN9Tf.js";import{n as zi}from"./formatting-uom1es4b.js";import{t as Bi}from"./useSplitCell-YJIystwv.js";import{n as Vi,r as Hi,t as Ui}from"./panel-accordion-state-CCF5Gxnc.js";import{Bo as Wi,Fo as Gi,Ho as Ki,Io as qi,Lo as Ji,No as Yi,Po as Xi,Ro as Zi,Uo as Qi,Vo as $i,ut as ea,zo as ta}from"./loro_wasm_bg-Ctp2cNI9.js";import{t as na}from"./Inputs-BsQm29hD.js";import{n as ra}from"./hooks-DM5n7Osw.js";var ia=dn(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),aa={showInput:`Mod-l`,acceptEdit:`Mod-y`,rejectEdit:`Mod-u`},oa=300,sa=Cr.define({combine:e=>Ir(e,{onError:console.error,inputDebounceTime:oa,keymaps:aa},{onError:(e,t)=>e&&t,inputDebounceTime:(e,t)=>e&&t,keymaps:(e,t)=>e&&t})}),ca=I.define(),la=fr.define({create(){return{show:!1,lineFrom:0,lineTo:0}},update(e,t){for(let e of t.effects)if(e.is(ca))return e.value;return e}}),ua=I.define(),da=I.define(),fa=fr.define({create(){return{shouldFocus:!1,inputValue:``}},update(e,t){let n=e;for(let e of t.effects)e.is(ua)&&(n={...n,inputValue:e.value}),e.is(da)&&(n={...n,shouldFocus:e.value});return n}}),pa=I.define(),ma=fr.define({create(){return null},update(e,t){for(let e of t.effects)if(e.is(pa))return e.value;return e}}),ha=I.define(),ga=fr.define({create(){return!1},update(e,t){for(let e of t.effects)if(e.is(ha))return e.value;return e}}),_a=1,va=e=>{let{state:t}=e,n=t.selection.main;if(n.empty)return!1;let r=t.doc,i=r.lineAt(n.from),a=r.lineAt(n.to);if(t.sliceDoc(i.from,a.to).trim().length<_a)return!1;let o=Math.max(1,Math.min(i.number,r.lines)),s=Math.max(1,Math.min(a.number,r.lines));return e.dispatch({effects:[ca.of({show:!0,lineFrom:o,lineTo:s}),da.of(!0),ua.of(``)],selection:Ar.cursor(i.from)}),!0},ya=e=>e.state.field(ma)?(e.dispatch({effects:[pa.of(null),ca.of({show:!1,lineFrom:0,lineTo:0}),da.of(!1),ua.of(``),ha.of(!1)]}),!0):!1,ba=e=>{let t=e.state.field(ma);return t?(e.dispatch({changes:{from:t.from,to:t.to,insert:t.oldCode},effects:[pa.of(null),ca.of({show:!1,lineFrom:0,lineTo:0}),da.of(!1),ua.of(``),ha.of(!1)]}),!0):!1},xa=fr.define({create(){return{suggestion:null}},update(e,t){let n=t.effects.find(e=>e.is(Sa));if(!t.docChanged&&!n&&!t.selection)return e;if(n&&t.state.doc===n.value.doc&&t.state.selection.main.head===n.value.pos)return{suggestion:n.value.text};if(e.suggestion&&t.docChanged&&t.startState.selection.ranges.length===1&&t.startState.selection.main.empty&&t.state.selection.ranges.length===1&&t.state.selection.main.empty){let n=t.startState.selection.main.head,r=``,i=0,a=!0;if(t.changes.iterChanges((e,t,o,s,c)=>{i++,a&&=e===n&&t===n,r=c.toString()}),a&&i===1&&r&&e.suggestion.startsWith(r)&&t.state.selection.main.head===n+r.length)return{suggestion:e.suggestion.slice(r.length)||null}}return{suggestion:null}}}),Sa=I.define();function Ca(e,t){let n=e.state.selection.main.head,r=[],i=L.widget({widget:new wa(t),side:1});return r.push(i.range(n)),L.set(r)}var wa=class extends Nr{suggestion;constructor(e){super(),this.suggestion=e}toDOM(){let e=document.createElement(`span`);return e.style.opacity=`0.4`,e.className=`cm-inline-suggestion`,e.textContent=this.suggestion,e.setAttribute(`role`,`suggestion`),e.setAttribute(`aria-label`,`Suggestion: ${this.suggestion}`),e}get lineBreaks(){return this.suggestion.split(`
|
|
3
3
|
`).length-1}},Ta=class{cache=new Map;timeout;constructor(e){this.timeout=e}get(e){let t=this.cache.get(e);return t?Date.now()-t.timestamp>this.timeout?(this.cache.delete(e),null):t.result:null}set(e,t){if(t){for(let[e,t]of this.cache)Date.now()-t.timestamp>this.timeout&&this.cache.delete(e);if(this.cache.delete(e),this.cache.set(e,{result:t,timestamp:Date.now()}),this.cache.size>20){let e=this.cache.keys().next().value;e!==void 0&&this.cache.delete(e)}}}},Ea=(e,t)=>Hr.fromClass(class{abortController=null;timer=null;cache;constructor(){this.cache=new Ta(t.cacheTimeout??1e3)}cancel(){this.timer!==null&&clearTimeout(this.timer),this.timer=null,this.abortController?.abort(),this.abortController=null}update(n){let r=n.transactions.some(e=>e.effects.some(e=>e.is(Sa)&&e.value.text===null));if(!n.docChanged&&!n.selectionSet&&!r&&!(n.focusChanged&&!n.view.hasFocus)||(this.cancel(),!n.docChanged||n.state.field(xa).suggestion||!n.state.selection.main.empty||n.state.selection.ranges.length!==1||t.events?.beforeSuggestionFetch?.(n.view)===!1))return;let i=new AbortController;this.abortController=i;let a=n.state.doc,o=n.state.selection.main.head,s=JSON.stringify([a.toString(),o]),c=this.cache.get(s),l=async()=>{if(!i.signal.aborted)try{let r=c??await e(n.state,i.signal,n.view);if(i.signal.aborted||n.view.state.doc!==a||n.view.state.selection.main.head!==o||t.events?.shouldShowSuggestion?.(n.view,r)===!1)return;this.cache.set(s,r),n.view.dispatch({effects:Sa.of({text:r,doc:a,pos:o})})}catch(e){!i.signal.aborted&&e instanceof Error&&e.name!==`AbortError`&&console.error(`Suggestion fetch error:`,e)}};this.timer=setTimeout(l,c?0:t.delay??500)}destroy(){this.cancel()}}),Da=Hr.fromClass(class{decorations;constructor(){this.decorations=L.none}update(e){let t=e.state.field(xa)?.suggestion;if(!t){this.decorations=L.none;return}this.decorations=Ca(e.view,t)}},{decorations:e=>e.decorations});function Oa(e,t,n,r){return{...e.changeByRange(i=>{if(i===e.selection.main)return{changes:{from:n,to:r,insert:t},range:Ar.cursor(n+t.length)};let a=r-n;return!i.empty||a&&e.sliceDoc(i.from-a,i.from)!==e.sliceDoc(n,r)?{range:i}:{changes:{from:i.from-a,to:i.from,insert:t},range:Ar.cursor(i.from-a+t.length)}}),userEvent:`input.complete`}}var ka=e=>{let t=e.state.field(xa)?.suggestion;if(!t)return!1;let n=e.state.facet(Ma);return e.dispatch({...Oa(e.state,t,e.state.selection.main.head,e.state.selection.main.head)}),n.events?.onSuggestionAccepted?.(e,t),!0},Aa=e=>{let t=e.state.field(xa)?.suggestion;if(!t)return!1;let n=e.state.facet(Ma);return e.dispatch({effects:Sa.of({text:null,doc:e.state.doc,pos:e.state.selection.main.head})}),n.events?.onSuggestionRejected?.(e,t),!0},ja=gr.of([{key:`Tab`,run:ka},{key:`Escape`,run:Aa}]),Ma=Cr.define({combine:e=>e.at(-1)});function Na(e){let{includeKeymap:t=!0}=e;return[xa,Ma.of(e),Ea(e.fetchFn,e),Da,t?ja:[]]}var Pa=R.baseTheme({".cm-ai-input-container":{display:`flex`,flexDirection:`column`,gap:`4px`,width:`min(calc(100% + 7px), 500px)`,padding:`5px 5px`,margin:`0 -6px`,backgroundColor:`light-dark(rgb(241, 243, 245), rgb(40, 40, 40))`},".cm-ai-input":{display:`block`,width:`100%`,padding:`3px 8px`,border:`2px solid rgb(51, 154, 240)`,borderRadius:`5px`,fontSize:`12px`},".cm-ai-help-info-button":{fontSize:`10px`,paddingLeft:`10px`,height:`18px`,color:`light-dark(rgb(109, 117, 125), rgb(170, 170, 170))`,display:`block`,marginRight:`auto`},".cm-ai-help-info-button:hover":{color:`light-dark(rgb(89, 97, 105), rgb(190, 190, 190))`},".cm-ai-generate-button":{background:`#0E639C`,border:`none`,padding:`2px 6px`,color:`#ffffff`,cursor:`pointer`,font:`inherit`,borderRadius:`4px`,"&:hover":{backgroundColor:`#1177bb`}},".cm-line.cm-ai-selection, .cm-line.cm-ai-selection.cm-active-line":{backgroundColor:`light-dark(color-mix(in srgb, rgb(223, 227, 232) 50%, transparent), color-mix(in srgb, rgb(50, 50, 50) 50%, transparent)) !important`},".cm-line:has(.cm-new-code-line)":{backgroundColor:`light-dark(color-mix(in srgb, rgb(183, 235, 143) 50%, transparent), color-mix(in srgb, rgb(40, 100, 40) 50%, transparent)) !important`},".cm-old-code-container":{backgroundColor:`light-dark(rgb(255, 205, 205), rgb(100, 40, 40))`,position:`relative`,display:`flex`,paddingTop:`0`,width:`100%`,alignItems:`center`},".cm-code-button":{position:`absolute`,right:`5px`,top:`50%`,transform:`translateY(-50%)`,background:`none`,border:`none`,cursor:`pointer`,fontSize:`16px`},".cm-floating-buttons":{fontFamily:`sans-serif`,position:`absolute`,top:`-20px`,left:`5px`,display:`flex`},".cm-floating-button":{fontFamily:`sans-serif`,padding:`2px 5px`,fontSize:`10px`,cursor:`pointer`,fontWeight:`700`},".cm-floating-accept":{backgroundColor:`light-dark(rgb(55, 125, 34), rgb(40, 80, 25))`,borderTopLeftRadius:`5px`,borderBottomLeftRadius:`5px`,color:`white`,filter:`brightness(90%)`,"&:hover":{filter:`brightness(100%)`}},".cm-floating-reject":{backgroundColor:`light-dark(rgb(220, 53, 69), rgb(180, 40, 50))`,color:`white`,borderTopRightRadius:`5px`,borderBottomRightRadius:`5px`,filter:`brightness(90%)`,"&:hover":{filter:`brightness(100%)`}},".hotkey":{display:`inline-block`,padding:`0 4px`,borderRadius:`3px`,backgroundColor:`rgba(255, 255, 255, 0.1)`,fontSize:`90%`},".cm-ai-loading-indicator":{fontStyle:`italic`,fontSize:`10px`,paddingLeft:`12px`,color:`light-dark(rgb(109, 117, 125), rgb(170, 170, 170))`,opacity:`0`,transition:`opacity 0.3s ease-in-out`,"&::after":{content:`""`,display:`inline-block`,animation:`ellipsis-pulse 1.5s steps(4, end) infinite`},"&:not(:empty)":{opacity:`1`}},".cm-ai-input:disabled":{opacity:`0.5`},"@keyframes ellipsis-pulse":{"0%":{content:`'.'`},"25%":{content:`'..'`},"50%":{content:`'...'`},"75%":{content:`''`}},".cm-ai-loading-container":{display:`flex`,alignItems:`center`,padding:`0 8px`},".cm-ai-cancel-button":{padding:`2px 8px`,fontSize:`10px`,borderRadius:`4px`,color:`light-dark(rgb(109, 117, 125), rgb(170, 170, 170))`,cursor:`pointer`,"&:hover":{background:`light-dark(rgb(223, 227, 232), rgb(50, 50, 50))`}},".hidden":{display:`none`}}),Fa={mac:`⌘`,windows:`Ctrl`,default:`Ctrl`};function Ia(){return navigator.platform.startsWith(`Mac`)?Fa.mac:navigator.platform.startsWith(`Win`)?Fa.windows:Fa.default}function La(e){return e.replace(`Mod`,Ia()).replace(`-`,` `).toUpperCase()}function B(e,t){let n=document.createElement(e);return n.className=t,n}function Ra(e){let t=e.state.facet(sa),n={...aa,...t.keymaps},r=e.state.facet(za),i=B(`div`,`cm-ai-tooltip`).appendChild(B(`div`,`cm-ai-tooltip-button`)),a=i.appendChild(document.createElement(`span`));a.textContent=`${r.label} `;let o=a.appendChild(document.createElement(`span`));return o.className=`hotkey`,o.textContent=La(n.showInput),i.querySelector(`span`)?.addEventListener(`mousedown`,e=>{e.stopPropagation(),e.button===0&&e.preventDefault()}),i.querySelector(`span`)?.addEventListener(`click`,t=>{t.preventDefault(),va(e)}),i}var za=Cr.define({combine(e){return Ir(e,{render:Ra,hideOnBlur:!1,label:`Edit with AI`})}}),Ba=Hr.fromClass(class{view;suppress;dom;mousedown=()=>{this.suppress=!0};mouseup=()=>{this.suppress=!1,this.display(this.view)};scroll=()=>{this.display(this.view)};windowScroll=()=>{this.display(this.view)};constructor(e){this.view=e;let t=e.state.facet(za);this.suppress=!1,document.addEventListener(`mousedown`,this.mousedown),document.addEventListener(`mouseup`,this.mouseup),e.scrollDOM.addEventListener(`scroll`,this.scroll),window.addEventListener(`scroll`,this.windowScroll,!0);let n=t.render(e);e.dom.appendChild(n),this.dom=n}update(e){this.display(e.view)}docViewUpdate(e){this.display(e)}display(e){if(e.state.field(la).show){this.dom.style.display=`none`;return}if(e.state.facet(za).hideOnBlur&&!e.hasFocus){this.dom.style.display=`none`,this.dom.setAttribute(`aria-hidden`,`true`);return}e.requestMeasure({read:this.#e})}#e=e=>{let t=e.state.selection.ranges.find(e=>!e.empty);if(t&&!this.suppress){let n=e.coordsAtPos(t.from),r=e.coordsAtPos(t.to);if(!n||!r)return;let i=e.dom.getBoundingClientRect(),a=e.dom.parentElement?.getBoundingClientRect(),o=e=>e.top>=i.top&&e.top<=i.bottom&&e.left>=i.left&&e.left<=i.right,s=e=>!a||e.top>=a.top&&e.top<=a.bottom&&e.left>=a.left&&e.left<=a.right,c=o(n)||o(r),l=s(n)||s(r);if(!c||!l){this.dom.style.display=`none`,this.dom.setAttribute(`aria-hidden`,`true`);return}this.dom.style.display=`flex`,this.dom.setAttribute(`aria-hidden`,`false`);let u=this.dom.getBoundingClientRect(),d=o(n)?n:r,f=i.right-u.width,p=Math.min(d.left,f),m=d.top-u.height,h=a?a.y:-1/0;m<h&&(m=r.bottom),this.dom.style.left=`${p}px`,this.dom.style.top=`${m}px`,requestAnimationFrame(()=>{this.dom&&this.dom.setAttribute(`aria-hidden`,`false`)})}else this.dom.style.display=`none`,this.dom.setAttribute(`aria-hidden`,`true`)};destroy(){document.removeEventListener(`mousedown`,this.mousedown),document.removeEventListener(`mouseup`,this.mouseup),this.view.scrollDOM.removeEventListener(`scroll`,this.scroll),window.removeEventListener(`scroll`,this.windowScroll,!0),this.dom.remove()}}),Va=R.baseTheme({".cm-ai-tooltip-button":{userSelect:`none`,fontFamily:`system-ui, -apple-system, sans-serif`,position:`fixed`,display:`flex`,boxSizing:`border-box`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`,backgroundColor:`#0E639C`,color:`#ffffff`,border:`1px solid transparent`,boxShadow:`0 2px 4px rgba(0,0,0,0.1)`,zIndex:`999`,transition:`opacity 0.5s`,"&[aria-hidden='true']":{opacity:`0`},"&[aria-hidden='false']":{opacity:`1`},"& > span":{pointerEvents:`auto`,cursor:`pointer`,display:`inline-block`,padding:`2px`},"&:hover":{backgroundColor:`#1177bb`}}});function Ha(){return[Ba,Va]}var Ua=class extends Nr{oldCode;constructor(e){super(),this.oldCode=e}toDOM(e){let t=B(`div`,`cm-old-code-container`);t.setAttribute(`role`,`region`),t.setAttribute(`aria-label`,`Previous code version`);let n=B(`div`,`cm-old-code cm-line`);n.textContent=this.oldCode;let r=B(`div`,`cm-floating-buttons`),i=e.state.facet(sa),a={...aa,...i.keymaps},o=B(`button`,`cm-floating-button cm-floating-accept`);o.innerHTML=`<span class="hotkey">${La(a.acceptEdit)}</span> Accept`,o.setAttribute(`aria-label`,`Accept changes`),o.addEventListener(`click`,t=>{t.preventDefault(),t.stopPropagation(),e.focus(),ya(e)});let s=B(`button`,`cm-floating-button cm-floating-reject`);return s.innerHTML=`<span class="hotkey">${La(a.rejectEdit)}</span> Reject`,s.setAttribute(`aria-label`,`Reject changes`),s.addEventListener(`click`,t=>{t.preventDefault(),t.stopPropagation(),e.focus(),ba(e)}),r.append(o,s),t.append(n,r),t}updateDOM(e,t){return!0}},Wa=class extends Nr{complete;abortController=null;dom=null;input=null;loadingContainer=null;helpInfo=null;inputContainer=null;form=null;view=null;constructor(e){super(),this.complete=e}toDOM(e){if(this.dom)return this.dom;this.view=e;let t=e.state.field(fa),n=e.state.field(ga),r=B(`div`,`cm-ai-input-container`);this.inputContainer=r,this.dom=r;let i=B(`form`,`cm-ai-input-form`);this.form=i,i.setAttribute(`role`,`search`),i.setAttribute(`aria-label`,`AI editing instructions`),i.addEventListener(`submit`,e=>e.preventDefault());let a=B(`input`,`cm-ai-input`);this.input=a,i.append(a),a.placeholder=`Editing instructions...`,a.setAttribute(`aria-label`,`AI editing instructions`),a.setAttribute(`autocomplete`,`off`),a.setAttribute(`spellcheck`,`true`),a.value=t.inputValue;let o=B(`div`,`cm-ai-loading-container`);this.loadingContainer=o;let s=B(`div`,`cm-ai-loading-indicator`);s.setAttribute(`role`,`status`),s.setAttribute(`aria-live`,`polite`),s.textContent=`Generating`;let c=B(`button`,`cm-ai-cancel-button`);c.textContent=`Cancel`,c.setAttribute(`aria-label`,`Cancel code generation`),c.addEventListener(`click`,this.onCancel),o.append(c,s);let l=B(`div`,`cm-ai-help-info`);this.helpInfo=l;let u=l.appendChild(document.createElement(`button`));u.className=`cm-ai-help-info-button`,u.textContent=`Esc to close`,u.addEventListener(`click`,this.onCancel);let d=B(`button`,`cm-ai-generate-button`);d.textContent=`⏎ Generate`,d.setAttribute(`aria-label`,`Generate code`),d.addEventListener(`click`,this.handleSubmit),this.toggleLoading(n),t.shouldFocus&&requestAnimationFrame(()=>{a.value=t.inputValue,a.focus(),e.dispatch({effects:da.of(!1)})}),f(a.value),a.addEventListener(`input`,m),a.addEventListener(`keydown`,this.onKeyDown);function f(e){l.replaceChildren(e?d:u)}let p=``;function m(){e.dispatch({effects:ua.of(a.value)});let t=a.value.trim();t!==p&&(p=t,f(t))}return r}toggleLoading(e){this.inputContainer&&this.form&&this.loadingContainer&&this.helpInfo&&this.inputContainer?.replaceChildren(this.form,e?this.loadingContainer:this.helpInfo)}onKeyDown=async e=>{e.key===`Enter`&&!e.shiftKey?(e.preventDefault(),await this.handleSubmit()):e.key===`Escape`&&this.onCancel()};onCancel=()=>{this.cleanup();let e=this.view;e&&(e.dispatch({effects:[ca.of({show:!1,lineFrom:0,lineTo:0}),ha.of(!1)]}),e.focus())};handleSubmit=async e=>{let t=this.view;if(!t)return;let n=t.state.facet(sa);e?.stopPropagation();let r=t.state.field(la),{input:i}=this;if(!i)return;let a=i.value.trim();if(!r.show||!a)return;let o=t.state.doc.line(r.lineFrom),s=t.state.doc.line(r.lineTo),c=o.from,l=s.to,u=t.state.sliceDoc(c,l),d=t.state.sliceDoc(0,c),f=t.state.sliceDoc(l);this.abortController=new AbortController,t.dispatch({effects:ha.of(!0)}),this.toggleLoading(!0);try{let e=await this.complete({prompt:a,selection:u,codeBefore:d,codeAfter:f,editorView:t,signal:this.abortController.signal});if(!t.state.field(la).show)return;if(!e||typeof e!=`string`)throw Error(`Invalid completion result`);t.dispatch({changes:{from:c,to:l,insert:e},effects:[ca.of({show:!1,lineFrom:0,lineTo:0}),pa.of({from:c,to:c+e.length,oldCode:u,newCode:e}),ha.of(!1)]})}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;n.onError?.(e)}finally{this.cleanup(),this.toggleLoading(!1),t.focus()}};updateDOM(e,t){return this.dom=e,this.input=e.querySelector(`.cm-ai-input`),!0}cleanup(){this.abortController?.abort(),this.abortController=null,this.dom?.remove(),this.input?.remove(),this.dom=null,this.input=null}destroy(){this.cleanup()}};function Ga(e){if(!e.prompt)throw Error(`prompt function is required`);let t={...aa,...e.keymaps};return[sa.of(e),la,fa,ma,ga,Ha(),Pa,gr.of([{key:t.showInput,run:va}]),Sr.highest([gr.of([{key:t.acceptEdit,run:ya},{key:t.rejectEdit,run:ba}])]),Ka,qa,Ja,Ya]}var Ka=R.updateListener.of(e=>{let t=e.state.field(la);if(!t.show||!e.docChanged)return;let{lineFrom:n,lineTo:r}=t,i=!1;e.changes.iterChanges((t,a,o,s)=>{let c=e.state.doc.lineAt(t).number;if(c<n){let t=e.state.doc.lineAt(s).number-e.state.doc.lineAt(o).number;n+=t,r+=t,i=!0}else if(c<=r){let t=e.state.doc.lineAt(s).number-e.state.doc.lineAt(o).number;r+=t,i=!0}}),i&&e.view.dispatch({effects:[ca.of({show:!0,lineFrom:n,lineTo:r})]})}),qa=R.decorations.of(e=>{let t=e.state.field(ma);return t?L.set([L.mark({class:`cm-new-code-line`}).range(t.from,t.to)]):L.none}),Ja=R.decorations.compute([la],e=>{let t=e.field(la),n=e.facet(sa),r=[];if(t.show){let i=t.lineFrom,a=t.lineTo;for(let t=i;t<=a;t++){let a=e.doc.line(t).from;r.push(L.line({class:`cm-ai-selection`}).range(a)),t===i&&r.push(L.widget({widget:new Wa(n.prompt),side:-1}).range(a))}}return L.set(r)}),Ya=fr.define({create(e){return L.none},update(e,t){let n=t.state.field(ma);return n?L.set([L.widget({widget:new Ua(n.oldCode),block:!0}).range(n.from)]):L.none},provide:e=>R.decorations.from(e)}),V=e(u(),1),H=Et(),Xa=()=>({entries:new Map}),{valueAtom:Za,useActions:Qa}=ii(Xa,{submit:(e,t)=>{let{cellIds:n,deleteCell:r,deleteManyCells:i,store:a}=t,o=a.get(he),s=a.get(tt),c=new Set(o.cellIds.inOrderIds.filter(e=>o.cellData[e].code.trim()===``)),l=new Map;for(let e of n){if(c.has(e)){l.set(e,{cellId:e,type:`simple`});continue}let t=o.cellRuntime[e],n=new Map;for(let t of Object.values(s)){let r=t.declaredBy.includes(e),i=t.usedBy.some(e=>!c.has(e));r&&i&&n.set(t.name,t.usedBy)}let r;t?.runElapsedTimeMs&&t.runElapsedTimeMs>2e3&&(r=t.runElapsedTimeMs),n.size===0&&r===void 0?l.set(e,{cellId:e,type:`simple`}):l.set(e,{cellId:e,type:`expensive`,executionDurationMs:r,defs:n})}let u=[...l.values()].every(e=>e.type===`simple`);return l.size>0&&u?(l.size===1?r({cellId:[...l.values()][0].cellId}):i({cellIds:[...l.values()].map(e=>e.cellId)}),Xa()):{...e,entries:l}},clear:()=>Xa()});function $a(){let e=(0,H.c)(10),t=n(),{submit:r,clear:a}=Qa(),{entries:o}=i(Za),s=er(),c=$n(),l;e[0]!==s||e[1]!==c||e[2]!==t||e[3]!==r?(l=e=>{r({cellIds:e,deleteCell:s,deleteManyCells:c,store:t})},e[0]=s,e[1]=c,e[2]=t,e[3]=r,e[4]=l):l=e[4];let u=o.size===0,d=o.size>1,f;return e[5]!==a||e[6]!==l||e[7]!==u||e[8]!==d?(f={submit:l,clear:a,idle:u,shouldConfirmDelete:d},e[5]=a,e[6]=l,e[7]=u,e[8]=d,e[9]=f):f=e[9],f}function eo(e){let t=(0,H.c)(16),n=i(Za),r=Qa(),a=$n(),o;t[0]!==e||t[1]!==n.entries?(o=n.entries.get(e),t[0]=e,t[1]=n.entries,t[2]=o):o=t[2];let s=o;if(!s){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e={isPending:!1},t[3]=e):e=t[3],e}if(n.entries.size!==1){let e;return t[4]===s?e=t[5]:(e={isPending:!0,shouldConfirmDelete:!1,...s},t[4]=s,t[5]=e),e}let c;t[6]!==r||t[7]!==a||t[8]!==n.entries?(c=()=>{a({cellIds:[...n.entries.values()].map(to)}),r.clear()},t[6]=r,t[7]=a,t[8]=n.entries,t[9]=c):c=t[9];let l;t[10]===r?l=t[11]:(l=()=>r.clear(),t[10]=r,t[11]=l);let u;return t[12]!==s||t[13]!==c||t[14]!==l?(u={isPending:!0,...s,shouldConfirmDelete:!0,confirm:c,cancel:l},t[12]=s,t[13]=c,t[14]=l,t[15]=u):u=t[15],u}function to(e){return e.cellId}async function no(e){if(!e.ok)throw Error(await e.text());if(!e.body)throw Error(`Failed to get response body`);let t=null,n=!1;if(await Nn({stream:Dn({stream:e.body,schema:Pn}).pipeThrough(new TransformStream({transform(e){if(!e.success)throw e.error;let r=e.value;if(kn(r)&&r.type===En)t=On.parse(r.data).code;else if(r.type===`error`)throw Error(r.errorText);else r.type===`finish`&&(n=r.finishReason===`stop`)}})),onError:e=>{throw e}}),!n)throw Error(`AI completion ended before final validation`);if(t===null)throw Error(`AI completion returned no cell code`);return t}async function ro(e){let t=`
|
|
4
4
|
${e.codeBefore}
|
|
5
5
|
<rewrite_this>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,l as t,t as n,u as r}from"./useEvent-BDjgaBtz.js";import{D as i,In as a,M as o,P as s,gr as c,xo as l,za as u}from"./cells-
|
|
1
|
+
import{c as e,l as t,t as n,u as r}from"./useEvent-BDjgaBtz.js";import{D as i,In as a,M as o,P as s,gr as c,xo as l,za as u}from"./cells-D_11MjVB.js";import{t as d}from"./compiler-runtime-BrajqUja.js";import{p as f}from"./config-DpY86_Yq.js";import{g as p}from"./useEventListener-CjDeLqFC.js";import{i as m}from"./utils-B4K466FK.js";import{c as h}from"./session-CMLIzZKw.js";import{T as g,_}from"./config-CD1IuZFJ.js";import{t as v}from"./cn-ldLVeaqm.js";import{t as y}from"./jsx-runtime-B74pBk57.js";import{n as b}from"./paths-bkIFVj8h.js";import{b as x}from"./write-secret-modal-BEx-EUlh.js";import{r as S}from"./requests-BIFR-h4M.js";var C=d();function w(){return t(u)}function T(){let t=(0,C.c)(5),[i]=e(_),a=r(u),{openAlert:o}=x(),{sendRename:s}=S(),c;return t[0]!==i.state||t[1]!==o||t[2]!==s||t[3]!==a?(c=async e=>{let t=f();return i.state===g.OPEN?(h(t=>{e===null?t.delete(m.filePath):t.set(m.filePath,e)}),s({filename:e}).then(()=>(a(e),document.title=t.app_title||b.basename(e)||`Untitled Notebook`,e)).catch(e=>(o(e.message),null))):(o(`Failed to save notebook: not connected to a kernel.`),null)},t[0]=i.state,t[1]=o,t[2]=s,t[3]=a,t[4]=c):c=t[4],n(c)}var E=y(),D=e=>{let t=(0,C.c)(12),{className:n,cellId:r,variant:c,onClick:l,formatCellName:u,skipScroll:d}=e,f=s()[r]??``,p=o().inOrderIds.indexOf(r),{showCellIfHidden:m}=i(),h=u??j,g;t[0]===n?g=t[1]:(g=v(`inline-block cursor-pointer text-link hover:underline`,n),t[0]=n,t[1]=g);let _;t[2]!==r||t[3]!==l||t[4]!==m||t[5]!==d||t[6]!==c?(_=e=>{if(r===`__scratch__`)return!1;m({cellId:r}),e.stopPropagation(),e.preventDefault(),requestAnimationFrame(()=>{A(r,c,d)&&l?.()})},t[2]=r,t[3]=l,t[4]=m,t[5]=d,t[6]=c,t[7]=_):_=t[7];let y=h(a(f,p)),b;return t[8]!==g||t[9]!==_||t[10]!==y?(b=(0,E.jsx)(`div`,{className:g,role:`link`,tabIndex:-1,onClick:_,children:y}),t[8]=g,t[9]=_,t[10]=y,t[11]=b):b=t[11],b},O=e=>{let t=(0,C.c)(2),n;return t[0]===e?n=t[1]:(n=(0,E.jsx)(D,{...e,variant:`destructive`}),t[0]=e,t[1]=n),n},k=e=>{let t=(0,C.c)(10),{cellId:n,lineNumber:r}=e,i=w(),a;t[0]!==n||t[1]!==r?(a=()=>c(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;t[3]!==n||t[4]!==i?(o=e=>n===`__scratch__`?`scratch`:`marimo://${i||`untitled`}#cell=${e}`,t[3]=n,t[4]=i,t[5]=o):o=t[5];let s;return t[6]!==n||t[7]!==a||t[8]!==o?(s=(0,E.jsx)(D,{cellId:n,onClick:a,skipScroll:!0,variant:`destructive`,className:`traceback-cell-link`,formatCellName:o}),t[6]=n,t[7]=a,t[8]=o,t[9]=s):s=t[9],s};function A(e,t,n){let r=l.create(e),i=document.getElementById(r),a=i?.classList.contains(`has-error`);return i===null?(p.error(`Cell ${r} not found on page.`),!1):(n||i.scrollIntoView({behavior:`smooth`,block:`center`}),(t===`destructive`||a&&t===void 0)&&(i.classList.add(`error-outline`),setTimeout(()=>{i.classList.remove(`error-outline`)},2e3)),(t===`focus`||!a&&t===void 0)&&(i.classList.add(`focus-outline`),setTimeout(()=>{i.classList.remove(`focus-outline`)},2e3)),!0)}function j(e){return e}export{w as a,A as i,O as n,T as o,k as r,D as t};
|