@marimo-team/frontend 0.25.3-dev4 → 0.25.3-dev5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/assets/{CellStatus-BP2mavAq.js → CellStatus-nZpuDkm7.js} +1 -1
  2. package/dist/assets/{ErrorBoundary-Gl5nCA8C.js → ErrorBoundary-B4n9EnHB.js} +2 -2
  3. package/dist/assets/JsonOutput-d-k8v_17.js +11 -0
  4. package/dist/assets/MarimoErrorOutput-CLYUxiKW.js +10 -0
  5. package/dist/assets/{RenderHTML-BbOqmHy3.js → RenderHTML-9bMgbYmo.js} +1 -1
  6. package/dist/assets/{RunButton-CK3LhnP5.js → RunButton-CFQUNN5c.js} +1 -1
  7. package/dist/assets/{add-cell-with-ai-8UBC0xwR.js → add-cell-with-ai-C_SruRWS.js} +9 -9
  8. package/dist/assets/{add-connection-dialog-DXQnd6eB.js → add-connection-dialog-CoE_PhuD.js} +1 -1
  9. package/dist/assets/{agent-panel-DdkVL-Kx.js → agent-panel-0b3k4QzJ.js} +5 -5
  10. package/dist/assets/ai-model-dropdown-C6GHHEdR.js +5 -0
  11. package/dist/assets/{app-config-button-BKEG4x9u.js → app-config-button-iXdCWvfC.js} +1 -1
  12. package/dist/assets/{blob-D5nfNHOo.js → blob-iOBwGaP9.js} +1 -1
  13. package/dist/assets/{cell-editor-32lVhib7.js → cell-editor-CR-tZNnc.js} +9 -9
  14. package/dist/assets/{cell-link-LSth_8hT.js → cell-link-1CynTVGQ.js} +1 -1
  15. package/dist/assets/{cells-BRkCaSsh.js → cells-rA_jsZCj.js} +1 -1
  16. package/dist/assets/{chat-display-Dnagy4Nv.js → chat-display-luF7psRA.js} +1 -1
  17. package/dist/assets/{chat-panel-DN9vsbgS.js → chat-panel-DDDTnLvB.js} +2 -2
  18. package/dist/assets/{chat-ui-Df8Vcj6n.js → chat-ui-nV_m4Btr.js} +1 -1
  19. package/dist/assets/{column-preview-CHK_DNrs.js → column-preview-uosAAL4X.js} +1 -1
  20. package/dist/assets/{command-palette-Cf7WX-nr.js → command-palette-BZ13RKDJ.js} +1 -1
  21. package/dist/assets/{common-Cu6CDbuw.js → common-lisZ0l6a.js} +1 -1
  22. package/dist/assets/{components-CGw16R_N.js → components-S7ZwOrvO.js} +1 -1
  23. package/dist/assets/config-FzDtjF1-.js +1 -0
  24. package/dist/assets/{datasource-Cq6x_5ML.js → datasource-V0-52XOh.js} +1 -1
  25. package/dist/assets/{dependency-graph-panel--Kgtktcw.js → dependency-graph-panel-B0uP-_id.js} +1 -1
  26. package/dist/assets/{documentation-panel-BHmbeznw.js → documentation-panel-DVl_ebWy.js} +1 -1
  27. package/dist/assets/{download-DCJXy66H.js → download-Bx55LMki.js} +1 -1
  28. package/dist/assets/{edit-page-BT74CF4G.js → edit-page-CGyjT-CQ.js} +6 -6
  29. package/dist/assets/{error-entries-Dk3VZ-OK.js → error-entries-DOWpdGvI.js} +1 -1
  30. package/dist/assets/{error-panel-BPRYmC5J.js → error-panel-C-uxLOHF.js} +1 -1
  31. package/dist/assets/{feedback-button-Bik2-e33.js → feedback-button-B99ThNJW.js} +1 -1
  32. package/dist/assets/feedback-button-DlqZkJwz.js +1 -0
  33. package/dist/assets/{file-explorer-panel-BmekFu7T.js → file-explorer-panel-D3CphidS.js} +1 -1
  34. package/dist/assets/{file-name-input-Cdc-TVqO.js → file-name-input-ChnBsDE_.js} +1 -1
  35. package/dist/assets/{floating-outline-XD9FAV-f.js → floating-outline-MYqQW4Vp.js} +1 -1
  36. package/dist/assets/{gallery-page-Dm6mGwBi.js → gallery-page-DSL0J4md.js} +1 -1
  37. package/dist/assets/{glide-data-editor-J9CAb70d.js → glide-data-editor-B1MWlKeM.js} +1 -1
  38. package/dist/assets/{home-page-s3LUizSn.js → home-page-B1M3X9Yf.js} +1 -1
  39. package/dist/assets/{hooks-RnjuFmEx.js → hooks-Bj0C0zrZ.js} +1 -1
  40. package/dist/assets/index-CXIE-QEG.css +2 -0
  41. package/dist/assets/{index-D-kY3FU1.js → index-DnIgeCyQ.js} +7 -7
  42. package/dist/assets/{layout-B_GMOySr.js → layout-DBuMeWh0.js} +3 -3
  43. package/dist/assets/{logs-panel-ABM16htT.js → logs-panel-y0XnfulJ.js} +1 -1
  44. package/dist/assets/{markdown-renderer-BG3sp2rs.js → markdown-renderer-Q5AhbRU3.js} +1 -1
  45. package/dist/assets/{name-cell-input-BgEBmqyL.js → name-cell-input-BNOnF6-0.js} +1 -1
  46. package/dist/assets/{outline-panel-DCXQ3_F6.js → outline-panel-Be7stWwv.js} +1 -1
  47. package/dist/assets/{packages-panel-BMGOmZkR.js → packages-panel-9Qs1npCZ.js} +1 -1
  48. package/dist/assets/{panel-accordion-state-C1sdPp0m.js → panel-accordion-state-GeMEdCPw.js} +1 -1
  49. package/dist/assets/panels-B9x935By.js +4 -0
  50. package/dist/assets/{process-output-D0KGq04R.js → process-output-DNFKMODr.js} +1 -1
  51. package/dist/assets/{readonly-code-display-Do50PHI8.js → readonly-code-display-YULOXf4h.js} +1 -1
  52. package/dist/assets/{readonly-python-code-DCSMIsTX.js → readonly-python-code-CadgXgRu.js} +1 -1
  53. package/dist/assets/{reveal-component-CLE6vB1Z.js → reveal-component-B9FLjTg_.js} +1 -1
  54. package/dist/assets/{run-page-Depd6lEE.js → run-page-CjdGaic3.js} +1 -1
  55. package/dist/assets/{runtime-details-state-CSPobEdR.js → runtime-details-state-DuChzsA6.js} +1 -1
  56. package/dist/assets/{scratchpad-panel-lc6jmpjv.js → scratchpad-panel-DtB0A8xj.js} +1 -1
  57. package/dist/assets/session-panel-B6tA28BD.js +1 -0
  58. package/dist/assets/{snippets-panel-Bh1oTw4m.js → snippets-panel-CQ1dn3lA.js} +1 -1
  59. package/dist/assets/state-BUsmcyaT.js +3 -0
  60. package/dist/assets/{state-XsPO8hNi.js → state-Bfh_2SLl.js} +1 -1
  61. package/dist/assets/{tracing-Di6pUmX8.js → tracing-BARlJ_Dk.js} +1 -1
  62. package/dist/assets/{tracing-panel-PeRXHD8_.js → tracing-panel-dgnr2fIN.js} +2 -2
  63. package/dist/assets/{tree-actions-GM5E_bUs.js → tree-actions-DAd80MbP.js} +1 -1
  64. package/dist/assets/{useAddCell-GR7eEQrT.js → useAddCell-DGstJK0S.js} +1 -1
  65. package/dist/assets/{useCellActionButton-B-9eG5z_.js → useCellActionButton-DY9RlJTb.js} +1 -1
  66. package/dist/assets/{useDeleteCell-2_bMClHd.js → useDeleteCell-DFBGlSQk.js} +1 -1
  67. package/dist/assets/{useDependencyPanelTab-k3C3M18S.js → useDependencyPanelTab-DydxsE5d.js} +1 -1
  68. package/dist/assets/{useNotebookActions-DIc4xTzY.js → useNotebookActions-CupIPSlg.js} +1 -1
  69. package/dist/assets/{useRunCells-B2vUhREg.js → useRunCells-BFjFX3hz.js} +1 -1
  70. package/dist/assets/{useSplitCell-DEb03htp.js → useSplitCell-Tqv5pPtL.js} +1 -1
  71. package/dist/index.html +23 -24
  72. package/package.json +1 -1
  73. package/src/components/editor/Output.tsx +5 -2
  74. package/src/components/editor/chrome/panels/error-panel.tsx +1 -0
  75. package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +167 -0
  76. package/src/components/editor/chrome/wrapper/footer-item.tsx +32 -24
  77. package/src/components/editor/chrome/wrapper/footer-items/attachment-status.tsx +82 -0
  78. package/src/components/editor/chrome/wrapper/footer.tsx +2 -0
  79. package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +434 -0
  80. package/src/components/editor/errors/send-error-report-button.tsx +66 -0
  81. package/src/components/editor/output/MarimoErrorOutput.tsx +21 -5
  82. package/src/components/editor/output/MarimoTracebackOutput.tsx +9 -0
  83. package/src/components/editor/output/__tests__/ansi-reduce.test.ts +18 -0
  84. package/src/components/editor/output/ansi-reduce.ts +6 -0
  85. package/src/core/attachments/state.ts +21 -0
  86. package/src/core/cells/__tests__/cells.test.ts +52 -0
  87. package/src/core/cells/__tests__/error-report.test.ts +89 -0
  88. package/src/core/cells/__tests__/session.test.ts +34 -0
  89. package/src/core/cells/error-report.ts +55 -0
  90. package/src/core/cells/session.ts +9 -0
  91. package/src/core/islands/__tests__/bootstrap.test.ts +26 -0
  92. package/src/core/islands/bootstrap.ts +1 -0
  93. package/src/core/websocket/__tests__/useMarimoKernelConnection.hook.test.tsx +193 -0
  94. package/src/core/websocket/useMarimoKernelConnection.tsx +9 -0
  95. package/dist/assets/JsonOutput-DxHKOpPG.js +0 -11
  96. package/dist/assets/MarimoErrorOutput-D60XkCny.js +0 -6
  97. package/dist/assets/ai-model-dropdown-B0z6-zhp.js +0 -5
  98. package/dist/assets/api-BeC_VSGv.js +0 -1
  99. package/dist/assets/config-BOKzA3tF.js +0 -1
  100. package/dist/assets/feedback-button-B2gKC5cn.js +0 -1
  101. package/dist/assets/index-Bcdzex-3.css +0 -2
  102. package/dist/assets/pair-CaQyK6En.js +0 -1
  103. package/dist/assets/panels-Dn59o8ay.js +0 -4
  104. package/dist/assets/session-panel-BxS5hiG2.js +0 -1
  105. package/dist/assets/state-_Qai_QyX.js +0 -3
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r}from"./useEvent-Dfcbgjhg.js";import{t as i}from"./react-DVplv7_D.js";import{D as a,La as o,g as s,oo as c,x as l}from"./cells-BRkCaSsh.js";import{t as u}from"./compiler-runtime-BrajqUja.js";import{C as d}from"./config-VPSq73n8.js";import{r as f}from"./utils-B4K466FK.js";import{t as p}from"./session-DqoWmb7X.js";import{_ as m,l as h,p as g,w as _}from"./config-DX8Y2WbJ.js";import{t as v}from"./cn-ldLVeaqm.js";import{t as y}from"./jsx-runtime-B74pBk57.js";import{a as b,c as x,i as S,l as C,n as w,s as T,t as E}from"./alert-dialog-BaPGzeOK.js";import{I as D,It as ee}from"./JsonOutput-DxHKOpPG.js";import{n as te}from"./download-DCJXy66H.js";import{i as O,n as k,r as ne,t as re}from"./tabs-BuQlZFbt.js";import{n as A,t as j}from"./button-COI-NGrx.js";import{n as ie}from"./paths-bkIFVj8h.js";import{t as M}from"./arrow-left-BaPN-xbg.js";import{t as N}from"./copy-Djr5m5ac.js";import{a as P,i as F,n as I,o as L,r as R,t as ae}from"./panels-Dn59o8ay.js";import{t as oe}from"./house-CpsMWsLL.js";import{t as z}from"./spinner-DyNE-o8o.js";import{l as B,s as V}from"./readonly-python-code-DCSMIsTX.js";import{Jt as H,Qt as U,Xt as W,Yt as G,nn as K,tn as q}from"./input-BoBxR50a.js";import{n as J}from"./copy-D8O_CYCG.js";import{t as Y}from"./use-toast-Wu434mLr.js";import{r as se}from"./requests-lt0JK8Jt.js";import{t as ce}from"./shell-Fj8a65ii.js";import{t as le}from"./share-BZW3tzEX.js";import{a as ue}from"./cell-link-LSth_8hT.js";import{n as de,t as fe}from"./react-resizable-panels.browser.esm-Dbe0MrFr.js";import{n as pe}from"./code-visibility-B-_GvwR5.js";import{n as me,t as he}from"./marimo-icons-CqliHyTr.js";import{t as ge}from"./state-DxQnC_1I.js";var _e=e(i(),1),X=u(),Z=y(),ve=()=>{let e=(0,X.c)(25),[n,r]=t(ge);if(n===null)return null;let i;e[0]===n?i=e[1]:(i=async()=>{try{await navigator.clipboard.writeText(n),Y({title:`Copied to clipboard`,description:`Error details have been copied to your clipboard.`})}catch{Y({title:`Failed to copy`,description:`Could not copy to clipboard.`,variant:`danger`})}},e[0]=n,e[1]=i);let a=i,o;e[2]===r?o=e[3]:(o=()=>{r(null)},e[2]=r,e[3]=o);let s=o,l=ye,u;e[4]===s?u=e[5]:(u=e=>!e&&s(),e[4]=s,e[5]=u);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(x,{children:[(0,Z.jsxs)(C,{className:`flex items-center gap-2 text-destructive`,children:[(0,Z.jsx)(c,{className:`h-5 w-5`}),`Kernel Startup Failed`]}),(0,Z.jsx)(b,{children:`The kernel failed to start. This usually happens when the package manager can't install your notebook's dependencies.`})]}),e[6]=d):d=e[6];let f;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`span`,{className:`text-sm font-medium text-muted-foreground`,children:`Error Details`}),e[7]=f):f=e[7];let p;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(N,{className:`h-3 w-3`}),e[8]=p):p=e[8];let m;e[9]===a?m=e[10]:(m=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[f,(0,Z.jsxs)(j,{variant:`outline`,size:`xs`,onClick:a,className:`flex items-center gap-1`,children:[p,`Copy`]})]}),e[9]=a,e[10]=m);let h;e[11]===n?h=e[12]:(h=(0,Z.jsx)(`pre`,{className:`bg-muted p-4 rounded-md text-sm font-mono overflow-auto max-h-80`,children:n}),e[11]=n,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`my-4 overflow-hidden`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsxs)(j,{variant:`outline`,onClick:l,className:`flex items-center gap-2`,children:[(0,Z.jsx)(oe,{className:`h-4 w-4`}),`Return to Home`]}),e[16]=_):_=e[16];let v;e[17]===s?v=e[18]:(v=(0,Z.jsxs)(T,{children:[_,(0,Z.jsx)(w,{onClick:s,children:`Dismiss`})]}),e[17]=s,e[18]=v);let y;e[19]!==v||e[20]!==g?(y=(0,Z.jsxs)(S,{className:`max-w-2xl`,children:[d,g,v]}),e[19]=v,e[20]=g,e[21]=y):y=e[21];let D;return e[22]!==y||e[23]!==u?(D=(0,Z.jsx)(E,{open:!0,onOpenChange:u,children:y}),e[22]=y,e[23]=u,e[24]=D):D=e[24],D};function ye(){let e=document.baseURI.split(`?`)[0];window.open(e,`_self`)}var be=e=>{let t=(0,X.c)(2),{reason:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`font-mono text-center text-base text-(--red-11)`,children:(0,Z.jsx)(`p`,{children:n})}),t[0]=n,t[1]=r),r},xe=e=>{let t=(0,X.c)(7),{connection:n,className:r,children:i}=e,a;t[0]!==n.reason||t[1]!==n.state?(a=n.state===_.CLOSED&&(0,Z.jsx)(be,{reason:n.reason}),t[0]=n.reason,t[1]=n.state,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==r||t[5]!==a?(o=(0,Z.jsxs)(`div`,{className:r,children:[i,a]}),t[3]=i,t[4]=r,t[5]=a,t[6]=o):o=t[6],o},Q=n(e=>e(s)||!g(e(m).state)),Se=e=>{let t=(0,X.c)(22),{appConfig:n,hideHeader:i}=e,{setCells:o}=a(),{sendComponentValues:s}=se(),c;t[0]===s?c=t[1]:(c=()=>(R.INSTANCE.start(s),Ce),t[0]=s,t[1]=c);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[2]=u):u=t[2],(0,_e.useEffect)(c,u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=p(),t[3]=d):d=t[3];let f;t[4]===o?f=t[5]:(f={autoInstantiate:!0,setCells:o,sessionId:d},t[4]=o,t[5]=f);let{connection:m,reconnect:h}=I(f),g=r(l),_;if(t[6]===Symbol.for(`react.memo_cache_sentinel`)){bb0:{if(typeof window>`u`){_=null;break bb0}let e=new URL(window.location.href);if(!e.searchParams.has(`file`)){_=null;break bb0}e.searchParams.delete(`file`);let t=e.searchParams.toString();_=t?`${e.pathname}?${t}`:e.pathname}t[6]=_}else _=t[6];let y=_,b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(ve,{}),t[7]=b):b=t[7];let x=i?`hidden`:`sm:pt-8`,S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=y&&(0,Z.jsx)(`div`,{className:`flex items-center px-6 pt-4 sm:-mt-8`,children:(0,Z.jsxs)(`a`,{href:y,"aria-label":`Back to gallery`,className:v(A({variant:`text`,size:`sm`}),`gap-2 px-0 text-muted-foreground hover:text-foreground`),children:[(0,Z.jsx)(M,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:`Back`})]})}),t[8]=S):S=t[8];let C;t[9]!==m||t[10]!==x?(C=(0,Z.jsx)(xe,{connection:m,className:x,children:S}),t[9]=m,t[10]=x,t[11]=C):C=t[11];let w;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z,{className:`mx-auto`}),(0,Z.jsx)(`p`,{className:`text-center text-sm text-muted-foreground mt-2`,children:`Connecting...`})]}),t[12]=w):w=t[12];let T;t[13]===n?T=t[14]:(T=(0,Z.jsx)(L,{requires:Q,delay:2e3,fallback:w,children:(0,Z.jsx)(F,{appConfig:n,mode:`read`})}),t[13]=n,t[14]=T);let E;return t[15]!==n.width||t[16]!==m||t[17]!==g||t[18]!==h||t[19]!==T||t[20]!==C?(E=(0,Z.jsxs)(P,{connection:m,isRunning:g,width:n.width,onReconnect:h,children:[b,C,T]}),t[15]=n.width,t[16]=m,t[17]=g,t[18]=h,t[19]=T,t[20]=C,t[21]=E):E=t[21],E};function Ce(){R.INSTANCE.stop()}var we=()=>{let e=(0,X.c)(3),t=r(o);if(!h()||!t)return null;let n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`span`,{children:[`Static`,` `,(0,Z.jsx)(`a`,{href:f.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-(--sky-11) font-medium underline`,children:`marimo`}),` `,`notebook - Run or edit for full interactivity`]}),e[0]=n):n=e[0];let i;return e[1]===t?i=e[2]:(i=(0,Z.jsxs)(`div`,{className:`px-4 py-2 bg-(--sky-2) border-b border-(--sky-7) text-(--sky-11) flex justify-between items-center gap-4 print:hidden text-sm`,"data-testid":`static-notebook-banner`,children:[n,(0,Z.jsx)(`span`,{className:`shrink-0`,children:(0,Z.jsx)(Te,{code:t})})]}),e[1]=t,e[2]=i),i},Te=e=>{let t=(0,X.c)(44),{code:n}=e,r=ie.basename(ue()||`notebook.py`),[i]=d(),a=i.sharing?.molab??!0,o=Ee(window.location.href,r),s=o!==r,c=ce(o),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(K,{asChild:!0,children:(0,Z.jsx)(j,{"data-testid":`static-notebook-dialog-trigger`,variant:`outline`,size:`xs`,children:`Run or Edit`})}),t[0]=l):l=t[0];let u;t[1]===r?u=t[2]:(u=(0,Z.jsx)(q,{children:r}),t[1]=r,t[2]=u);let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`a`,{href:f.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-(--sky-11) hover:underline font-medium`,children:`marimo`}),t[3]=p):p=t[3];let m=s?`Run it`:`Download it, then run it`,h;t[4]===m?h=t[5]:(h=(0,Z.jsxs)(`p`,{children:[`This is a static`,` `,p,` `,`notebook. `,m,` `,`locally for full interactivity.`]}),t[4]=m,t[5]=h);let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(ne,{"aria-label":`Package manager`,children:[(0,Z.jsx)(O,{value:`uv`,children:`uv`}),(0,Z.jsx)(O,{value:`pip`,children:`pip`}),(0,Z.jsx)(O,{value:`conda`,children:`conda`})]}),t[6]=g):g=t[6];let _=`uvx marimo edit --sandbox ${c}`,v;t[7]===_?v=t[8]:(v=(0,Z.jsx)(k,{value:`uv`,children:(0,Z.jsx)($,{command:_})}),t[7]=_,t[8]=v);let y=`pip install marimo\nmarimo edit ${c}`,b;t[9]===y?b=t[10]:(b=(0,Z.jsx)(k,{value:`pip`,children:(0,Z.jsx)($,{command:y})}),t[9]=y,t[10]=b);let x=`conda install -c conda-forge marimo\nmarimo edit ${c}`,S;t[11]===x?S=t[12]:(S=(0,Z.jsx)(k,{value:`conda`,children:(0,Z.jsx)($,{command:x})}),t[11]=x,t[12]=S);let C;t[13]!==b||t[14]!==S||t[15]!==v?(C=(0,Z.jsxs)(re,{defaultValue:`uv`,children:[g,v,b,S]}),t[13]=b,t[14]=S,t[15]=v,t[16]=C):C=t[16];let w;t[17]!==n||t[18]!==a?(w=a&&(0,Z.jsx)(De,{code:n}),t[17]=n,t[18]=a,t[19]=w):w=t[19];let T;t[20]!==C||t[21]!==w||t[22]!==h?(T=(0,Z.jsx)(W,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`pt-3 text-left space-y-3`,children:[h,C,w]})}),t[20]=C,t[21]=w,t[22]=h,t[23]=T):T=t[23];let E;t[24]!==T||t[25]!==u?(E=(0,Z.jsxs)(U,{children:[u,T]}),t[24]=T,t[25]=u,t[26]=E):E=t[26];let D;t[27]===n?D=t[28]:(D=async()=>{await J(n),Y({title:`Copied to clipboard`})},t[27]=n,t[28]=D);let A;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(N,{className:`w-3 h-3 mr-2`}),t[29]=A):A=t[29];let M;t[30]===D?M=t[31]:(M=(0,Z.jsxs)(j,{"data-testid":`copy-static-notebook-dialog-button`,variant:`outline`,size:`sm`,onClick:D,children:[A,`Copy code`]}),t[30]=D,t[31]=M);let P;t[32]!==n||t[33]!==r?(P=()=>{te(new Blob([n],{type:`text/plain`}),r)},t[32]=n,t[33]=r,t[34]=P):P=t[34];let F;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(ee,{className:`w-3 h-3 mr-2`}),t[35]=F):F=t[35];let I;t[36]===P?I=t[37]:(I=(0,Z.jsxs)(j,{"data-testid":`download-static-notebook-dialog-button`,variant:`outline`,size:`sm`,onClick:P,children:[F,`Download`]}),t[36]=P,t[37]=I);let L;t[38]!==M||t[39]!==I?(L=(0,Z.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[M,I]}),t[38]=M,t[39]=I,t[40]=L):L=t[40];let R;return t[41]!==E||t[42]!==L?(R=(0,Z.jsxs)(H,{children:[l,(0,Z.jsxs)(G,{children:[E,L]})]}),t[41]=E,t[42]=L,t[43]=R):R=t[43],R};function Ee(e,t){let n=new URL(e);if(n.protocol!==`http:`&&n.protocol!==`https:`)return t;let r=n.pathname.endsWith(`.html`)&&n.search===``,i=n.protocol===`https:`&&(n.hostname===`marimo.app`||n.hostname===`links.marimo.app`||n.hostname===`static.marimo.app`&&n.pathname.startsWith(`/static`)||n.pathname.includes(`/notebooks/nb`));return!r&&!i?t:(n.hash=``,n.href)}var $=e=>{let t=(0,X.c)(10),{command:n}=e,r;t[0]===n?r=t[1]:(r=(0,Z.jsx)(`pre`,{className:`p-3 pr-10 font-mono text-(--sky-11) leading-relaxed whitespace-pre-wrap break-all`,children:n}),t[0]=n,t[1]=r);let i;t[2]===n?i=t[3]:(i=async()=>{await J(n),Y({title:`Command copied to clipboard`})},t[2]=n,t[3]=i);let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(N,{className:`w-3.5 h-3.5`}),t[4]=a):a=t[4];let o;t[5]===i?o=t[6]:(o=(0,Z.jsx)(j,{"aria-label":`Copy command`,className:`absolute right-2 top-2`,variant:`ghost`,size:`icon`,onClick:i,children:a}),t[5]=i,t[6]=o);let s;return t[7]!==r||t[8]!==o?(s=(0,Z.jsxs)(`div`,{className:`relative rounded-lg border bg-(--sky-2) border-(--sky-7)`,children:[r,o]}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s},De=e=>{let t=(0,X.c)(8),{code:n}=e,r;t[0]===n?r=t[1]:(r=le({code:n,baseUrl:`${f.molab}/new`}),t[0]=n,t[1]=r);let i=r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(me,{size:12,strokeWidth:1.5,className:`mr-1.5 mt-px text-(--grass-11)`}),t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,Z.jsx)(j,{asChild:!0,variant:`outline`,size:`xs`,className:`shrink-0`,children:(0,Z.jsxs)(`a`,{href:i,target:`_blank`,rel:`noopener noreferrer`,children:[a,`Open in molab`]})}),t[3]=i,t[4]=o);let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsxs)(`p`,{className:`text-sm text-(--sky-12)`,children:[`Run this notebook in `,(0,Z.jsx)(`span`,{className:`font-semibold`,children:`molab`}),`, marimo's cloud-hosted notebook platform.`]}),t[5]=s):s=t[5];let c;return t[6]===o?c=t[7]:(c=(0,Z.jsxs)(`div`,{className:`pt-3 border-t flex gap-2 items-center`,children:[o,s]}),t[6]=o,t[7]=c),c},Oe=e=>{let t=(0,X.c)(17),n=r(pe).kind,i=n===`static`||n===`wasm`,{selectedLayout:a}=B(),o;t[0]===a?o=t[1]:(o=V({selectedLayout:a,isReading:!0,searchParams:new URLSearchParams(window.location.search)}),t[0]=a,t[1]=o);let s=i&&o===`slides`,c;t[2]===s?c=t[3]:(c=!s&&(0,Z.jsx)(we,{}),t[2]=s,t[3]=c);let l;t[4]!==s||t[5]!==e.appConfig?(l=(0,Z.jsx)(Se,{appConfig:e.appConfig,hideHeader:s}),t[4]=s,t[5]=e.appConfig,t[6]=l):l=t[6];let u;t[7]!==i||t[8]!==s?(u=i&&!s&&(0,Z.jsx)(ke,{}),t[7]=i,t[8]=s,t[9]=u):u=t[9];let d;t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,Z.jsxs)(fe,{children:[c,l,u]}),t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(D,{}),t[14]=f):f=t[14];let p;return t[15]===d?p=t[16]:(p=(0,Z.jsx)(ae,{children:(0,Z.jsxs)(de,{direction:`horizontal`,autoSaveId:`marimo:chrome:v1:run1`,children:[d,f]})}),t[15]=d,t[16]=p),p},ke=()=>{let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:`fixed bottom-0 right-0 z-50 print:hidden`,"data-testid":`watermark`,children:(0,Z.jsxs)(`a`,{href:f.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-sm text-(--grass-11) font-bold tracking-wide transition-colors bg-(--grass-4) hover:bg-(--grass-5) border-t border-l border-(--grass-8) px-3 py-1 rounded-tl-md flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{children:`made with marimo`}),(0,Z.jsx)(he,{className:`h-4 w-auto`})]})}),e[0]=t):t=e[0],t};export{Oe as default};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r}from"./useEvent-Dfcbgjhg.js";import{t as i}from"./react-DVplv7_D.js";import{D as a,La as o,g as s,oo as c,x as l}from"./cells-rA_jsZCj.js";import{t as u}from"./compiler-runtime-BrajqUja.js";import{C as d}from"./config-VPSq73n8.js";import{r as f}from"./utils-B4K466FK.js";import{t as p}from"./session-DqoWmb7X.js";import{_ as m,l as h,p as g,w as _}from"./config-DX8Y2WbJ.js";import{t as v}from"./cn-ldLVeaqm.js";import{t as y}from"./jsx-runtime-B74pBk57.js";import{a as b,c as x,i as S,l as C,n as w,s as T,t as E}from"./alert-dialog-BaPGzeOK.js";import{I as D,It as ee}from"./JsonOutput-d-k8v_17.js";import{n as te}from"./download-Bx55LMki.js";import{i as O,n as k,r as ne,t as re}from"./tabs-BuQlZFbt.js";import{n as A,t as j}from"./button-COI-NGrx.js";import{n as ie}from"./paths-bkIFVj8h.js";import{t as M}from"./arrow-left-BaPN-xbg.js";import{t as N}from"./copy-Djr5m5ac.js";import{a as P,i as F,n as I,o as L,r as R,t as ae}from"./panels-B9x935By.js";import{t as oe}from"./house-CpsMWsLL.js";import{t as z}from"./spinner-DyNE-o8o.js";import{l as B,s as V}from"./readonly-python-code-CadgXgRu.js";import{Jt as H,Qt as U,Xt as W,Yt as G,nn as K,tn as q}from"./input-BoBxR50a.js";import{n as J}from"./copy-D8O_CYCG.js";import{t as Y}from"./use-toast-Wu434mLr.js";import{r as se}from"./requests-lt0JK8Jt.js";import{t as ce}from"./shell-Fj8a65ii.js";import{t as le}from"./share-BZW3tzEX.js";import{a as ue}from"./cell-link-1CynTVGQ.js";import{n as de,t as fe}from"./react-resizable-panels.browser.esm-Dbe0MrFr.js";import{n as pe}from"./code-visibility-B-_GvwR5.js";import{n as me,t as he}from"./marimo-icons-CqliHyTr.js";import{t as ge}from"./state-DxQnC_1I.js";var _e=e(i(),1),X=u(),Z=y(),ve=()=>{let e=(0,X.c)(25),[n,r]=t(ge);if(n===null)return null;let i;e[0]===n?i=e[1]:(i=async()=>{try{await navigator.clipboard.writeText(n),Y({title:`Copied to clipboard`,description:`Error details have been copied to your clipboard.`})}catch{Y({title:`Failed to copy`,description:`Could not copy to clipboard.`,variant:`danger`})}},e[0]=n,e[1]=i);let a=i,o;e[2]===r?o=e[3]:(o=()=>{r(null)},e[2]=r,e[3]=o);let s=o,l=ye,u;e[4]===s?u=e[5]:(u=e=>!e&&s(),e[4]=s,e[5]=u);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(x,{children:[(0,Z.jsxs)(C,{className:`flex items-center gap-2 text-destructive`,children:[(0,Z.jsx)(c,{className:`h-5 w-5`}),`Kernel Startup Failed`]}),(0,Z.jsx)(b,{children:`The kernel failed to start. This usually happens when the package manager can't install your notebook's dependencies.`})]}),e[6]=d):d=e[6];let f;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`span`,{className:`text-sm font-medium text-muted-foreground`,children:`Error Details`}),e[7]=f):f=e[7];let p;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(N,{className:`h-3 w-3`}),e[8]=p):p=e[8];let m;e[9]===a?m=e[10]:(m=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[f,(0,Z.jsxs)(j,{variant:`outline`,size:`xs`,onClick:a,className:`flex items-center gap-1`,children:[p,`Copy`]})]}),e[9]=a,e[10]=m);let h;e[11]===n?h=e[12]:(h=(0,Z.jsx)(`pre`,{className:`bg-muted p-4 rounded-md text-sm font-mono overflow-auto max-h-80`,children:n}),e[11]=n,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`my-4 overflow-hidden`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsxs)(j,{variant:`outline`,onClick:l,className:`flex items-center gap-2`,children:[(0,Z.jsx)(oe,{className:`h-4 w-4`}),`Return to Home`]}),e[16]=_):_=e[16];let v;e[17]===s?v=e[18]:(v=(0,Z.jsxs)(T,{children:[_,(0,Z.jsx)(w,{onClick:s,children:`Dismiss`})]}),e[17]=s,e[18]=v);let y;e[19]!==v||e[20]!==g?(y=(0,Z.jsxs)(S,{className:`max-w-2xl`,children:[d,g,v]}),e[19]=v,e[20]=g,e[21]=y):y=e[21];let D;return e[22]!==y||e[23]!==u?(D=(0,Z.jsx)(E,{open:!0,onOpenChange:u,children:y}),e[22]=y,e[23]=u,e[24]=D):D=e[24],D};function ye(){let e=document.baseURI.split(`?`)[0];window.open(e,`_self`)}var be=e=>{let t=(0,X.c)(2),{reason:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`font-mono text-center text-base text-(--red-11)`,children:(0,Z.jsx)(`p`,{children:n})}),t[0]=n,t[1]=r),r},xe=e=>{let t=(0,X.c)(7),{connection:n,className:r,children:i}=e,a;t[0]!==n.reason||t[1]!==n.state?(a=n.state===_.CLOSED&&(0,Z.jsx)(be,{reason:n.reason}),t[0]=n.reason,t[1]=n.state,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==r||t[5]!==a?(o=(0,Z.jsxs)(`div`,{className:r,children:[i,a]}),t[3]=i,t[4]=r,t[5]=a,t[6]=o):o=t[6],o},Q=n(e=>e(s)||!g(e(m).state)),Se=e=>{let t=(0,X.c)(22),{appConfig:n,hideHeader:i}=e,{setCells:o}=a(),{sendComponentValues:s}=se(),c;t[0]===s?c=t[1]:(c=()=>(R.INSTANCE.start(s),Ce),t[0]=s,t[1]=c);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[2]=u):u=t[2],(0,_e.useEffect)(c,u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=p(),t[3]=d):d=t[3];let f;t[4]===o?f=t[5]:(f={autoInstantiate:!0,setCells:o,sessionId:d},t[4]=o,t[5]=f);let{connection:m,reconnect:h}=I(f),g=r(l),_;if(t[6]===Symbol.for(`react.memo_cache_sentinel`)){bb0:{if(typeof window>`u`){_=null;break bb0}let e=new URL(window.location.href);if(!e.searchParams.has(`file`)){_=null;break bb0}e.searchParams.delete(`file`);let t=e.searchParams.toString();_=t?`${e.pathname}?${t}`:e.pathname}t[6]=_}else _=t[6];let y=_,b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(ve,{}),t[7]=b):b=t[7];let x=i?`hidden`:`sm:pt-8`,S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=y&&(0,Z.jsx)(`div`,{className:`flex items-center px-6 pt-4 sm:-mt-8`,children:(0,Z.jsxs)(`a`,{href:y,"aria-label":`Back to gallery`,className:v(A({variant:`text`,size:`sm`}),`gap-2 px-0 text-muted-foreground hover:text-foreground`),children:[(0,Z.jsx)(M,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:`Back`})]})}),t[8]=S):S=t[8];let C;t[9]!==m||t[10]!==x?(C=(0,Z.jsx)(xe,{connection:m,className:x,children:S}),t[9]=m,t[10]=x,t[11]=C):C=t[11];let w;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z,{className:`mx-auto`}),(0,Z.jsx)(`p`,{className:`text-center text-sm text-muted-foreground mt-2`,children:`Connecting...`})]}),t[12]=w):w=t[12];let T;t[13]===n?T=t[14]:(T=(0,Z.jsx)(L,{requires:Q,delay:2e3,fallback:w,children:(0,Z.jsx)(F,{appConfig:n,mode:`read`})}),t[13]=n,t[14]=T);let E;return t[15]!==n.width||t[16]!==m||t[17]!==g||t[18]!==h||t[19]!==T||t[20]!==C?(E=(0,Z.jsxs)(P,{connection:m,isRunning:g,width:n.width,onReconnect:h,children:[b,C,T]}),t[15]=n.width,t[16]=m,t[17]=g,t[18]=h,t[19]=T,t[20]=C,t[21]=E):E=t[21],E};function Ce(){R.INSTANCE.stop()}var we=()=>{let e=(0,X.c)(3),t=r(o);if(!h()||!t)return null;let n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`span`,{children:[`Static`,` `,(0,Z.jsx)(`a`,{href:f.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-(--sky-11) font-medium underline`,children:`marimo`}),` `,`notebook - Run or edit for full interactivity`]}),e[0]=n):n=e[0];let i;return e[1]===t?i=e[2]:(i=(0,Z.jsxs)(`div`,{className:`px-4 py-2 bg-(--sky-2) border-b border-(--sky-7) text-(--sky-11) flex justify-between items-center gap-4 print:hidden text-sm`,"data-testid":`static-notebook-banner`,children:[n,(0,Z.jsx)(`span`,{className:`shrink-0`,children:(0,Z.jsx)(Te,{code:t})})]}),e[1]=t,e[2]=i),i},Te=e=>{let t=(0,X.c)(44),{code:n}=e,r=ie.basename(ue()||`notebook.py`),[i]=d(),a=i.sharing?.molab??!0,o=Ee(window.location.href,r),s=o!==r,c=ce(o),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(K,{asChild:!0,children:(0,Z.jsx)(j,{"data-testid":`static-notebook-dialog-trigger`,variant:`outline`,size:`xs`,children:`Run or Edit`})}),t[0]=l):l=t[0];let u;t[1]===r?u=t[2]:(u=(0,Z.jsx)(q,{children:r}),t[1]=r,t[2]=u);let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`a`,{href:f.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-(--sky-11) hover:underline font-medium`,children:`marimo`}),t[3]=p):p=t[3];let m=s?`Run it`:`Download it, then run it`,h;t[4]===m?h=t[5]:(h=(0,Z.jsxs)(`p`,{children:[`This is a static`,` `,p,` `,`notebook. `,m,` `,`locally for full interactivity.`]}),t[4]=m,t[5]=h);let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(ne,{"aria-label":`Package manager`,children:[(0,Z.jsx)(O,{value:`uv`,children:`uv`}),(0,Z.jsx)(O,{value:`pip`,children:`pip`}),(0,Z.jsx)(O,{value:`conda`,children:`conda`})]}),t[6]=g):g=t[6];let _=`uvx marimo edit --sandbox ${c}`,v;t[7]===_?v=t[8]:(v=(0,Z.jsx)(k,{value:`uv`,children:(0,Z.jsx)($,{command:_})}),t[7]=_,t[8]=v);let y=`pip install marimo\nmarimo edit ${c}`,b;t[9]===y?b=t[10]:(b=(0,Z.jsx)(k,{value:`pip`,children:(0,Z.jsx)($,{command:y})}),t[9]=y,t[10]=b);let x=`conda install -c conda-forge marimo\nmarimo edit ${c}`,S;t[11]===x?S=t[12]:(S=(0,Z.jsx)(k,{value:`conda`,children:(0,Z.jsx)($,{command:x})}),t[11]=x,t[12]=S);let C;t[13]!==b||t[14]!==S||t[15]!==v?(C=(0,Z.jsxs)(re,{defaultValue:`uv`,children:[g,v,b,S]}),t[13]=b,t[14]=S,t[15]=v,t[16]=C):C=t[16];let w;t[17]!==n||t[18]!==a?(w=a&&(0,Z.jsx)(De,{code:n}),t[17]=n,t[18]=a,t[19]=w):w=t[19];let T;t[20]!==C||t[21]!==w||t[22]!==h?(T=(0,Z.jsx)(W,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`pt-3 text-left space-y-3`,children:[h,C,w]})}),t[20]=C,t[21]=w,t[22]=h,t[23]=T):T=t[23];let E;t[24]!==T||t[25]!==u?(E=(0,Z.jsxs)(U,{children:[u,T]}),t[24]=T,t[25]=u,t[26]=E):E=t[26];let D;t[27]===n?D=t[28]:(D=async()=>{await J(n),Y({title:`Copied to clipboard`})},t[27]=n,t[28]=D);let A;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(N,{className:`w-3 h-3 mr-2`}),t[29]=A):A=t[29];let M;t[30]===D?M=t[31]:(M=(0,Z.jsxs)(j,{"data-testid":`copy-static-notebook-dialog-button`,variant:`outline`,size:`sm`,onClick:D,children:[A,`Copy code`]}),t[30]=D,t[31]=M);let P;t[32]!==n||t[33]!==r?(P=()=>{te(new Blob([n],{type:`text/plain`}),r)},t[32]=n,t[33]=r,t[34]=P):P=t[34];let F;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(ee,{className:`w-3 h-3 mr-2`}),t[35]=F):F=t[35];let I;t[36]===P?I=t[37]:(I=(0,Z.jsxs)(j,{"data-testid":`download-static-notebook-dialog-button`,variant:`outline`,size:`sm`,onClick:P,children:[F,`Download`]}),t[36]=P,t[37]=I);let L;t[38]!==M||t[39]!==I?(L=(0,Z.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[M,I]}),t[38]=M,t[39]=I,t[40]=L):L=t[40];let R;return t[41]!==E||t[42]!==L?(R=(0,Z.jsxs)(H,{children:[l,(0,Z.jsxs)(G,{children:[E,L]})]}),t[41]=E,t[42]=L,t[43]=R):R=t[43],R};function Ee(e,t){let n=new URL(e);if(n.protocol!==`http:`&&n.protocol!==`https:`)return t;let r=n.pathname.endsWith(`.html`)&&n.search===``,i=n.protocol===`https:`&&(n.hostname===`marimo.app`||n.hostname===`links.marimo.app`||n.hostname===`static.marimo.app`&&n.pathname.startsWith(`/static`)||n.pathname.includes(`/notebooks/nb`));return!r&&!i?t:(n.hash=``,n.href)}var $=e=>{let t=(0,X.c)(10),{command:n}=e,r;t[0]===n?r=t[1]:(r=(0,Z.jsx)(`pre`,{className:`p-3 pr-10 font-mono text-(--sky-11) leading-relaxed whitespace-pre-wrap break-all`,children:n}),t[0]=n,t[1]=r);let i;t[2]===n?i=t[3]:(i=async()=>{await J(n),Y({title:`Command copied to clipboard`})},t[2]=n,t[3]=i);let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(N,{className:`w-3.5 h-3.5`}),t[4]=a):a=t[4];let o;t[5]===i?o=t[6]:(o=(0,Z.jsx)(j,{"aria-label":`Copy command`,className:`absolute right-2 top-2`,variant:`ghost`,size:`icon`,onClick:i,children:a}),t[5]=i,t[6]=o);let s;return t[7]!==r||t[8]!==o?(s=(0,Z.jsxs)(`div`,{className:`relative rounded-lg border bg-(--sky-2) border-(--sky-7)`,children:[r,o]}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s},De=e=>{let t=(0,X.c)(8),{code:n}=e,r;t[0]===n?r=t[1]:(r=le({code:n,baseUrl:`${f.molab}/new`}),t[0]=n,t[1]=r);let i=r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(me,{size:12,strokeWidth:1.5,className:`mr-1.5 mt-px text-(--grass-11)`}),t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,Z.jsx)(j,{asChild:!0,variant:`outline`,size:`xs`,className:`shrink-0`,children:(0,Z.jsxs)(`a`,{href:i,target:`_blank`,rel:`noopener noreferrer`,children:[a,`Open in molab`]})}),t[3]=i,t[4]=o);let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsxs)(`p`,{className:`text-sm text-(--sky-12)`,children:[`Run this notebook in `,(0,Z.jsx)(`span`,{className:`font-semibold`,children:`molab`}),`, marimo's cloud-hosted notebook platform.`]}),t[5]=s):s=t[5];let c;return t[6]===o?c=t[7]:(c=(0,Z.jsxs)(`div`,{className:`pt-3 border-t flex gap-2 items-center`,children:[o,s]}),t[6]=o,t[7]=c),c},Oe=e=>{let t=(0,X.c)(17),n=r(pe).kind,i=n===`static`||n===`wasm`,{selectedLayout:a}=B(),o;t[0]===a?o=t[1]:(o=V({selectedLayout:a,isReading:!0,searchParams:new URLSearchParams(window.location.search)}),t[0]=a,t[1]=o);let s=i&&o===`slides`,c;t[2]===s?c=t[3]:(c=!s&&(0,Z.jsx)(we,{}),t[2]=s,t[3]=c);let l;t[4]!==s||t[5]!==e.appConfig?(l=(0,Z.jsx)(Se,{appConfig:e.appConfig,hideHeader:s}),t[4]=s,t[5]=e.appConfig,t[6]=l):l=t[6];let u;t[7]!==i||t[8]!==s?(u=i&&!s&&(0,Z.jsx)(ke,{}),t[7]=i,t[8]=s,t[9]=u):u=t[9];let d;t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,Z.jsxs)(fe,{children:[c,l,u]}),t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(D,{}),t[14]=f):f=t[14];let p;return t[15]===d?p=t[16]:(p=(0,Z.jsx)(ae,{children:(0,Z.jsxs)(de,{direction:`horizontal`,autoSaveId:`marimo:chrome:v1:run1`,children:[d,f]})}),t[15]=d,t[16]=p),p},ke=()=>{let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:`fixed bottom-0 right-0 z-50 print:hidden`,"data-testid":`watermark`,children:(0,Z.jsxs)(`a`,{href:f.githubPage,target:`_blank`,rel:`noreferrer`,className:`text-sm text-(--grass-11) font-bold tracking-wide transition-colors bg-(--grass-4) hover:bg-(--grass-5) border-t border-l border-(--grass-8) px-3 py-1 rounded-tl-md flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{children:`made with marimo`}),(0,Z.jsx)(he,{className:`h-4 w-auto`})]})}),e[0]=t):t=e[0],t};export{Oe as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,l as n}from"./useEvent-Dfcbgjhg.js";import{t as r}from"./react-DVplv7_D.js";import{co as i}from"./cells-BRkCaSsh.js";import{t as a}from"./compiler-runtime-BrajqUja.js";import{t as o}from"./useEventListener-D9cftcHj.js";import{T as s,_ as c,w as l,x as u}from"./config-DX8Y2WbJ.js";import{t as d}from"./cn-ldLVeaqm.js";import{t as f}from"./jsx-runtime-B74pBk57.js";import{t as p}from"./circle-DXf-VWZG.js";import{t as m}from"./arrow-down-C9Bslqr3.js";import{t as h}from"./check-BQNapYaf.js";import{i as g}from"./useNumberFormatter-D7O_26UI.js";import{t as _}from"./spinner-DyNE-o8o.js";import{t as v}from"./copy-icon-BIiRXh_3.js";import{i as y,t as b}from"./state-DxQnC_1I.js";var x=a(),S=f(),C=t(null),w=t(e=>e(y).environments.kernel.operations.findLast(e=>e.action===`prepare`)),T=t(e=>{let t=e(y).environments.kernel.operations;return t.findLast(e=>e.action===`sync`&&e.status.kind===`running`)??t.findLast(e=>e.action===`sync`)}),E=t(null),D=t(e=>{let t=e(T),n=e(E),r=n&&n.operation===t&&t?.status.kind!==`running`?n.state:t?.status??{kind:`idle`};return e(y).environments.kernel.restart_required&&(r.kind===`idle`||r.kind===`succeeded`)?{kind:`restart-required`,reason:`Dependency changes are saved; restart the kernel to apply them.`}:r},(e,t,n)=>{t(E,{state:n,operation:e(T)})}),O=t(null),k=e(r(),1),A=t(e=>{let t=e(c),n=!!e(C)?.backend,r=e(D),i=r.kind===`running`,a=r.kind===`restart-required`,o=r.kind===`failed`?r.error:r.kind===`cancelled`?`Sandbox sync was interrupted.`:a?r.reason:null;if(n&&(i||o!==null)&&t.state===l.OPEN)return{kind:`sync`,sandbox:n,title:i?`Syncing sandbox…`:a?`Sandbox restart required`:`Sandbox sync failed`,description:i?`Applying the saved manifest to this notebook’s environment.`:a?`Restart the kernel to use the updated environment.`:`Review the error details, then try again.`,pending:i,error:o};if(t.state===l.CONNECTING)return{kind:t.phase===`reconnecting`?`connection`:`startup`,phase:t.phase,sandbox:n,...t.phase?{"preparing-environment":{title:`Preparing environment…`,description:`Getting this notebook’s Python environment ready. The first start can take a few minutes.`},"starting-kernel":{title:`Starting kernel…`,description:`The environment is prepared. Waiting for the Python kernel to connect to this notebook.`},reconnecting:{title:`Reconnecting…`,description:`The connection was interrupted. Your notebook and existing outputs stay visible while the kernel reconnects.`}}[t.phase]:{title:`Connecting…`,description:`Waiting for the notebook’s kernel to connect.`},pending:!0,error:null};if(t.state===l.CLOSED){let r=t.code===s.KERNEL_STARTUP_ERROR,i=n&&r&&t.phase===`preparing-environment`;return{kind:r?`startup`:`connection`,phase:t.phase,sandbox:n,title:i?`Sandbox setup failed`:r?`Kernel failed to start`:t.reason,description:i?`The notebook can’t run yet.`:r?`The Python kernel could not start. Check the error details, then try again.`:`The connection to the notebook’s kernel was lost.`,pending:!1,error:r?e(b)??t.reason:null}}return null});function j(e){let t=e.ownerDocument.getSelection();return t&&!t.isCollapsed&&t.containsNode(e,!0)}function M(e){let t=(0,x.c)(44),{logs:n,label:r,state:i}=e,a=i===void 0?`running`:i,[s,c]=(0,k.useState)(!1),[l,u]=(0,k.useState)(!0),f=(0,k.useRef)(null),p=(0,k.useRef)(null),h=(0,k.useId)(),_=n.trimEnd().split(/\r?\n/),y=a===`failed`?`text-foreground`:a===`running`?`last:text-foreground`:void 0,b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e.key===`Escape`&&(e.preventDefault(),c(!1),p.current?.focus())},t[0]=b):b=t[0],o(f,`keydown`,b);let C;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{f.current&&j(f.current)&&u(!1)},t[1]=C):C=t[1],o(document,`selectionchange`,C);let w,T;if(t[2]!==s||t[3]!==l||t[4]!==n?(w=()=>{let e=f.current;if(!e)return;let t=e.textContent??``;n.startsWith(t)?n.length>t.length&&e.append(document.createTextNode(n.slice(t.length))):e.textContent=n,s&&l&&!j(e)&&(e.scrollTop=e.scrollHeight)},T=[n,s,l],t[2]=s,t[3]=l,t[4]=n,t[5]=w,t[6]=T):(w=t[5],T=t[6]),(0,k.useLayoutEffect)(w,T),!n.trim())return null;let E=s?`bg-muted/40`:`hover:bg-muted/40`,D;t[7]===E?D=t[8]:(D=d(`relative mt-2.5 min-w-0 contain-inline-size rounded text-muted-foreground`,E),t[7]=E,t[8]=D);let O=s&&`flex items-center pr-1`,A;t[9]===O?A=t[10]:(A=d(O),t[9]=O,t[10]=A);let M=`${s?`Collapse`:`Expand`} ${r}`,N=s?`Collapse output`:`Expand output`,P=s&&`items-center justify-between gap-2 text-xs hover:text-foreground`,F;t[11]===P?F=t[12]:(F=d(`flex w-full min-w-0 rounded px-2.5 py-1 text-left focus-visible:outline-2 focus-visible:outline-ring`,P),t[11]=P,t[12]=F);let I;t[13]===s?I=t[14]:(I=()=>{c(!s),u(!0)},t[13]=s,t[14]=I);let L=s?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`leading-5`,children:`Logs`}),(0,S.jsx)(g,{className:`size-3.5 shrink-0`,"aria-hidden":!0})]}):(0,S.jsx)(`span`,{className:d(`min-w-0 flex-1 font-mono text-[11px] leading-5`,_.length>1&&`[mask-image:linear-gradient(to_bottom,transparent,#000_70%)]`),"aria-hidden":!0,children:_.slice(-3).map((e,t)=>(0,S.jsx)(`span`,{className:d(`block truncate`,y),children:e||`\xA0`},t))}),R;t[15]!==s||t[16]!==h||t[17]!==M||t[18]!==N||t[19]!==F||t[20]!==I||t[21]!==L?(R=(0,S.jsx)(`button`,{ref:p,type:`button`,"aria-label":M,"aria-expanded":s,"aria-controls":h,title:N,className:F,onClick:I,children:L}),t[15]=s,t[16]=h,t[17]=M,t[18]=N,t[19]=F,t[20]=I,t[21]=L,t[22]=R):R=t[22];let z;t[23]!==s||t[24]!==r||t[25]!==n?(z=s&&(0,S.jsx)(v,{value:n,ariaLabel:`Copy ${r}`,tooltip:`Copy output`,className:`size-3.5`,buttonClassName:`size-6 shrink-0 flex items-center justify-center rounded hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring`}),t[23]=s,t[24]=r,t[25]=n,t[26]=z):z=t[26];let B;t[27]!==R||t[28]!==z||t[29]!==A?(B=(0,S.jsxs)(`div`,{className:A,children:[R,z]}),t[27]=R,t[28]=z,t[29]=A,t[30]=B):B=t[30];let V=!s,H;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{let t=e.currentTarget;u(!j(t)&&t.scrollHeight-t.scrollTop-t.clientHeight<12)},t[31]=H):H=t[31];let U;t[32]!==r||t[33]!==h||t[34]!==V?(U=(0,S.jsx)(`pre`,{id:h,ref:f,hidden:V,tabIndex:0,"aria-label":r,className:`max-h-48 overflow-auto overscroll-contain whitespace-pre px-2.5 pb-2.5 font-mono text-[11px] leading-5 scrollbar-thin focus-visible:outline-2 focus-visible:outline-ring`,onScroll:H}),t[32]=r,t[33]=h,t[34]=V,t[35]=U):U=t[35];let W;t[36]!==s||t[37]!==l?(W=s&&!l&&(0,S.jsxs)(`button`,{type:`button`,className:`absolute bottom-2 left-1/2 -translate-x-1/2 flex items-center gap-1 whitespace-nowrap rounded-full border bg-background px-2 py-1 text-xs shadow-xs hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,onClick:()=>{let e=f.current;e&&(j(e)&&e.ownerDocument.getSelection()?.removeAllRanges(),e.focus({preventScroll:!0})),u(!0)},children:[(0,S.jsx)(m,{className:`size-3`,"aria-hidden":!0}),`Jump to latest`]}),t[36]=s,t[37]=l,t[38]=W):W=t[38];let G;return t[39]!==B||t[40]!==U||t[41]!==W||t[42]!==D?(G=(0,S.jsxs)(`div`,{className:D,children:[B,U,W]}),t[39]=B,t[40]=U,t[41]=W,t[42]=D,t[43]=G):G=t[43],G}function N(e){let t=(0,x.c)(10),{state:n,variant:r}=e;if((r===void 0?`icon`:r)===`dot`){let e;t[0]===n?e=t[1]:(e=d(`size-1.5 shrink-0 rounded-full`,{waiting:`bg-muted-foreground`,running:`bg-muted-foreground motion-safe:animate-pulse`,succeeded:`bg-(--grass-9)`,failed:`bg-(--red-9)`}[n]),t[0]=n,t[1]=e);let r;return t[2]===e?r=t[3]:(r=(0,S.jsx)(`span`,{"aria-hidden":!0,className:e}),t[2]=e,t[3]=r),r}let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a={waiting:p,running:_,succeeded:h,failed:i},t[4]=a):a=t[4];let o=a[n],s;t[5]===n?s=t[6]:(s=d(`size-4 shrink-0`,{waiting:`text-muted-foreground/50`,running:`motion-reduce:animate-none`,succeeded:`text-(--grass-11)`,failed:`text-(--red-11)`}[n]),t[5]=n,t[6]=s);let c;return t[7]!==o||t[8]!==s?(c=(0,S.jsx)(o,{"aria-hidden":!0,className:s}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function P(e){let t=(0,x.c)(10),{stages:n,label:r,className:i}=e,a;t[0]===i?a=t[1]:(a=d(`space-y-6`,i),t[0]=i,t[1]=a);let o;if(t[2]!==n){let e;t[4]===n.length?e=t[5]:(e=(e,t)=>(0,S.jsxs)(`li`,{"aria-current":e.state===`running`||e.state===`failed`?`step`:void 0,className:`relative flex items-start gap-3`,children:[t<n.length-1&&(0,S.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-2 top-4.5 -bottom-6.5 border-l border-border`}),(0,S.jsx)(`span`,{className:`mt-0.5 text-muted-foreground`,children:(0,S.jsx)(N,{state:e.state})}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`div`,{className:d(`text-sm`,e.state===`failed`?`text-(--red-11)`:e.state===`waiting`?`text-muted-foreground`:`text-foreground`),children:e.title}),(0,S.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e.description}),e.details]})]},e.id),t[4]=n.length,t[5]=e),o=n.map(e),t[2]=n,t[3]=o}else o=t[3];let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,S.jsx)(`ol`,{"aria-label":r,className:a,children:o}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}var F=[{phase:`preparing-environment`,titles:{succeeded:`Environment prepared`,failed:`Environment setup failed`,running:`Preparing environment`,waiting:`Prepare environment`},descriptions:{succeeded:`Python and dependencies are available.`,failed:`Setup could not finish.`,running:`Set up Python and dependencies.`,waiting:`Set up Python and dependencies.`}},{phase:`starting-kernel`,titles:{succeeded:`Kernel started`,failed:`Kernel failed to start`,running:`Starting kernel`,waiting:`Start kernel`},descriptions:{succeeded:`The notebook is ready to run.`,failed:`The kernel could not connect.`,running:`Connecting to this notebook.`,waiting:`After the environment is ready.`}}];function I(e){return e.kind===`startup`&&(!e.sandbox||e.ready||e.phase===`preparing-environment`||e.phase===`starting-kernel`)}function L(e){let t=(0,x.c)(10),{notice:n}=e,r;t[0]===n.title?r=t[1]:(r=(0,S.jsx)(`output`,{className:`sr-only`,children:n.title}),t[0]=n.title,t[1]=r);let i=n.ready?`Your notebook is ready`:`Getting your notebook ready`,a;t[2]===i?a=t[3]:(a=(0,S.jsx)(`h2`,{className:`text-foreground font-heading text-2xl leading-8 tracking-tight font-normal`,children:i}),t[2]=i,t[3]=a);let o=n.ready?n.sandbox?`Your environment and kernel are ready.`:`Your kernel is ready.`:n.pending?n.sandbox?`Preparing Python and dependencies for this notebook.`:`Connecting to this notebook’s Python kernel.`:`Review the setup details below to continue.`,s;t[4]===o?s=t[5]:(s=(0,S.jsx)(`p`,{className:`text-muted-foreground mt-3 text-sm leading-6`,children:o}),t[4]=o,t[5]=s);let c;return t[6]!==r||t[7]!==a||t[8]!==s?(c=(0,S.jsxs)(`header`,{children:[r,a,s]}),t[6]=r,t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function R(e){let t=(0,x.c)(2),{notice:n}=e,r=n.ready?`succeeded`:n.pending?`running`:`failed`,i;return t[0]===r?i=t[1]:(i=(0,S.jsx)(N,{state:r}),t[0]=r,t[1]=i),i}function z(e){let t=(0,x.c)(28),{notice:r,surface:i}=e,a=n(w),o=n(u),s=r.sandbox?r.phase:`starting-kernel`,c;if(t[0]!==s||t[1]!==r.pending||t[2]!==r.ready||t[3]!==r.sandbox||t[4]!==a?.logs||t[5]!==a?.operation_id||t[6]!==o||t[7]!==i){let e;t[9]===r.sandbox?e=t[10]:(e=e=>r.sandbox||e.phase===`starting-kernel`,t[9]=r.sandbox,t[10]=e);let n;t[11]!==s||t[12]!==r.pending||t[13]!==r.ready||t[14]!==a?.logs||t[15]!==a?.operation_id||t[16]!==o||t[17]!==i?(n=e=>{let{phase:t,titles:n,descriptions:c}=e,l=t===`preparing-environment`,u=r.ready||l&&s===`starting-kernel`?`succeeded`:s===t?r.pending?`running`:`failed`:`waiting`,d=l?a?.logs.environment??``:o?.phase===t?o.logs:``;return{id:t,state:u,title:n[u],description:c[u],details:i===`sidebar`&&(0,S.jsx)(M,{logs:d,state:u===`waiting`?`succeeded`:u,label:l?`environment preparation output`:`kernel startup output`},a?.operation_id)}},t[11]=s,t[12]=r.pending,t[13]=r.ready,t[14]=a?.logs,t[15]=a?.operation_id,t[16]=o,t[17]=i,t[18]=n):n=t[18],c=F.filter(e).map(n),t[0]=s,t[1]=r.pending,t[2]=r.ready,t[3]=r.sandbox,t[4]=a?.logs,t[5]=a?.operation_id,t[6]=o,t[7]=i,t[8]=c}else c=t[8];let l=c,d;t[19]!==r||t[20]!==i?(d=i===`notebook`&&(0,S.jsx)(L,{notice:r}),t[19]=r,t[20]=i,t[21]=d):d=t[21];let f=i===`notebook`?`mt-8`:void 0,p;t[22]!==l||t[23]!==f?(p=(0,S.jsx)(P,{stages:l,label:`Notebook startup stages`,className:f}),t[22]=l,t[23]=f,t[24]=p):p=t[24];let m;return t[25]!==d||t[26]!==p?(m=(0,S.jsxs)(S.Fragment,{children:[d,p]}),t[25]=d,t[26]=p,t[27]=m):m=t[27],m}function B(e){let t=(0,x.c)(2),{error:n}=e,r;return t[0]===n?r=t[1]:(r=(0,S.jsx)(`pre`,{tabIndex:0,"aria-label":`Error details`,className:`mt-3 p-3 rounded border bg-muted/30 text-xs text-muted-foreground whitespace-pre min-w-0 max-w-full max-h-52 overflow-auto`,children:n}),t[0]=n,t[1]=r),r}function V(e){let t=(0,x.c)(21),{notice:n,surface:r,children:i}=e,a=r===void 0?`sidebar`:r,o;t[0]===n?o=t[1]:(o=I(n),t[0]=n,t[1]=o);let s=o,c=!n.pending&&!n.ready,l;t[2]!==c||t[3]!==n||t[4]!==s||t[5]!==a?(l=s?(0,S.jsx)(z,{notice:n,surface:a}):(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,role:`status`,children:[(0,S.jsx)(R,{notice:n}),(0,S.jsx)(`h2`,{className:d(a===`notebook`&&`text-base`,c?`font-medium text-(--red-11)`:`text-foreground`),children:n.title})]}),t[2]=c,t[3]=n,t[4]=s,t[5]=a,t[6]=l):l=t[6];let u;t[7]!==c||t[8]!==n.description||t[9]!==s||t[10]!==a?(u=(c||!s&&a===`notebook`)&&(0,S.jsx)(`p`,{className:d(`mt-2`,c&&`text-foreground`),children:n.description}),t[7]=c,t[8]=n.description,t[9]=s,t[10]=a,t[11]=u):u=t[11];let f;t[12]!==n.error||t[13]!==n.sandbox||t[14]!==a?(f=n.error&&(a===`sidebar`||!n.sandbox)&&(0,S.jsx)(B,{error:n.error}),t[12]=n.error,t[13]=n.sandbox,t[14]=a,t[15]=f):f=t[15];let p;return t[16]!==i||t[17]!==l||t[18]!==u||t[19]!==f?(p=(0,S.jsxs)(`div`,{className:`min-w-0 text-sm`,children:[l,u,f,i]}),t[16]=i,t[17]=l,t[18]=u,t[19]=f,t[20]=p):p=t[20],p}var H=t(null),U=t(e=>{let t=e(A);return{preparationId:e(w)?.operation_id,error:t&&!t.pending?t.error??t.title:null}}),W=t(e=>{let t=e(U),n=e(H);return n&&n.preparationId===t.preparationId&&n.error===t.error?n.expanded:e(A)!==null},(e,t,n)=>{t(H,{...e(U),expanded:n})});export{I as a,A as c,C as d,D as f,R as i,w as l,V as n,N as o,T as p,B as r,M as s,W as t,O as u};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,l as n}from"./useEvent-Dfcbgjhg.js";import{t as r}from"./react-DVplv7_D.js";import{co as i}from"./cells-rA_jsZCj.js";import{t as a}from"./compiler-runtime-BrajqUja.js";import{t as o}from"./useEventListener-D9cftcHj.js";import{T as s,_ as c,w as l,x as u}from"./config-DX8Y2WbJ.js";import{t as d}from"./cn-ldLVeaqm.js";import{t as f}from"./jsx-runtime-B74pBk57.js";import{t as p}from"./circle-DXf-VWZG.js";import{t as m}from"./arrow-down-C9Bslqr3.js";import{t as h}from"./check-BQNapYaf.js";import{i as g}from"./useNumberFormatter-D7O_26UI.js";import{t as _}from"./spinner-DyNE-o8o.js";import{t as v}from"./copy-icon-BIiRXh_3.js";import{i as y,t as b}from"./state-DxQnC_1I.js";var x=a(),S=f(),C=t(null),w=t(e=>e(y).environments.kernel.operations.findLast(e=>e.action===`prepare`)),T=t(e=>{let t=e(y).environments.kernel.operations;return t.findLast(e=>e.action===`sync`&&e.status.kind===`running`)??t.findLast(e=>e.action===`sync`)}),E=t(null),D=t(e=>{let t=e(T),n=e(E),r=n&&n.operation===t&&t?.status.kind!==`running`?n.state:t?.status??{kind:`idle`};return e(y).environments.kernel.restart_required&&(r.kind===`idle`||r.kind===`succeeded`)?{kind:`restart-required`,reason:`Dependency changes are saved; restart the kernel to apply them.`}:r},(e,t,n)=>{t(E,{state:n,operation:e(T)})}),O=t(null),k=e(r(),1),A=t(e=>{let t=e(c),n=!!e(C)?.backend,r=e(D),i=r.kind===`running`,a=r.kind===`restart-required`,o=r.kind===`failed`?r.error:r.kind===`cancelled`?`Sandbox sync was interrupted.`:a?r.reason:null;if(n&&(i||o!==null)&&t.state===l.OPEN)return{kind:`sync`,sandbox:n,title:i?`Syncing sandbox…`:a?`Sandbox restart required`:`Sandbox sync failed`,description:i?`Applying the saved manifest to this notebook’s environment.`:a?`Restart the kernel to use the updated environment.`:`Review the error details, then try again.`,pending:i,error:o};if(t.state===l.CONNECTING)return{kind:t.phase===`reconnecting`?`connection`:`startup`,phase:t.phase,sandbox:n,...t.phase?{"preparing-environment":{title:`Preparing environment…`,description:`Getting this notebook’s Python environment ready. The first start can take a few minutes.`},"starting-kernel":{title:`Starting kernel…`,description:`The environment is prepared. Waiting for the Python kernel to connect to this notebook.`},reconnecting:{title:`Reconnecting…`,description:`The connection was interrupted. Your notebook and existing outputs stay visible while the kernel reconnects.`}}[t.phase]:{title:`Connecting…`,description:`Waiting for the notebook’s kernel to connect.`},pending:!0,error:null};if(t.state===l.CLOSED){let r=t.code===s.KERNEL_STARTUP_ERROR,i=n&&r&&t.phase===`preparing-environment`;return{kind:r?`startup`:`connection`,phase:t.phase,sandbox:n,title:i?`Sandbox setup failed`:r?`Kernel failed to start`:t.reason,description:i?`The notebook can’t run yet.`:r?`The Python kernel could not start. Check the error details, then try again.`:`The connection to the notebook’s kernel was lost.`,pending:!1,error:r?e(b)??t.reason:null}}return null});function j(e){let t=e.ownerDocument.getSelection();return t&&!t.isCollapsed&&t.containsNode(e,!0)}function M(e){let t=(0,x.c)(44),{logs:n,label:r,state:i}=e,a=i===void 0?`running`:i,[s,c]=(0,k.useState)(!1),[l,u]=(0,k.useState)(!0),f=(0,k.useRef)(null),p=(0,k.useRef)(null),h=(0,k.useId)(),_=n.trimEnd().split(/\r?\n/),y=a===`failed`?`text-foreground`:a===`running`?`last:text-foreground`:void 0,b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e.key===`Escape`&&(e.preventDefault(),c(!1),p.current?.focus())},t[0]=b):b=t[0],o(f,`keydown`,b);let C;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{f.current&&j(f.current)&&u(!1)},t[1]=C):C=t[1],o(document,`selectionchange`,C);let w,T;if(t[2]!==s||t[3]!==l||t[4]!==n?(w=()=>{let e=f.current;if(!e)return;let t=e.textContent??``;n.startsWith(t)?n.length>t.length&&e.append(document.createTextNode(n.slice(t.length))):e.textContent=n,s&&l&&!j(e)&&(e.scrollTop=e.scrollHeight)},T=[n,s,l],t[2]=s,t[3]=l,t[4]=n,t[5]=w,t[6]=T):(w=t[5],T=t[6]),(0,k.useLayoutEffect)(w,T),!n.trim())return null;let E=s?`bg-muted/40`:`hover:bg-muted/40`,D;t[7]===E?D=t[8]:(D=d(`relative mt-2.5 min-w-0 contain-inline-size rounded text-muted-foreground`,E),t[7]=E,t[8]=D);let O=s&&`flex items-center pr-1`,A;t[9]===O?A=t[10]:(A=d(O),t[9]=O,t[10]=A);let M=`${s?`Collapse`:`Expand`} ${r}`,N=s?`Collapse output`:`Expand output`,P=s&&`items-center justify-between gap-2 text-xs hover:text-foreground`,F;t[11]===P?F=t[12]:(F=d(`flex w-full min-w-0 rounded px-2.5 py-1 text-left focus-visible:outline-2 focus-visible:outline-ring`,P),t[11]=P,t[12]=F);let I;t[13]===s?I=t[14]:(I=()=>{c(!s),u(!0)},t[13]=s,t[14]=I);let L=s?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`leading-5`,children:`Logs`}),(0,S.jsx)(g,{className:`size-3.5 shrink-0`,"aria-hidden":!0})]}):(0,S.jsx)(`span`,{className:d(`min-w-0 flex-1 font-mono text-[11px] leading-5`,_.length>1&&`[mask-image:linear-gradient(to_bottom,transparent,#000_70%)]`),"aria-hidden":!0,children:_.slice(-3).map((e,t)=>(0,S.jsx)(`span`,{className:d(`block truncate`,y),children:e||`\xA0`},t))}),R;t[15]!==s||t[16]!==h||t[17]!==M||t[18]!==N||t[19]!==F||t[20]!==I||t[21]!==L?(R=(0,S.jsx)(`button`,{ref:p,type:`button`,"aria-label":M,"aria-expanded":s,"aria-controls":h,title:N,className:F,onClick:I,children:L}),t[15]=s,t[16]=h,t[17]=M,t[18]=N,t[19]=F,t[20]=I,t[21]=L,t[22]=R):R=t[22];let z;t[23]!==s||t[24]!==r||t[25]!==n?(z=s&&(0,S.jsx)(v,{value:n,ariaLabel:`Copy ${r}`,tooltip:`Copy output`,className:`size-3.5`,buttonClassName:`size-6 shrink-0 flex items-center justify-center rounded hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring`}),t[23]=s,t[24]=r,t[25]=n,t[26]=z):z=t[26];let B;t[27]!==R||t[28]!==z||t[29]!==A?(B=(0,S.jsxs)(`div`,{className:A,children:[R,z]}),t[27]=R,t[28]=z,t[29]=A,t[30]=B):B=t[30];let V=!s,H;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{let t=e.currentTarget;u(!j(t)&&t.scrollHeight-t.scrollTop-t.clientHeight<12)},t[31]=H):H=t[31];let U;t[32]!==r||t[33]!==h||t[34]!==V?(U=(0,S.jsx)(`pre`,{id:h,ref:f,hidden:V,tabIndex:0,"aria-label":r,className:`max-h-48 overflow-auto overscroll-contain whitespace-pre px-2.5 pb-2.5 font-mono text-[11px] leading-5 scrollbar-thin focus-visible:outline-2 focus-visible:outline-ring`,onScroll:H}),t[32]=r,t[33]=h,t[34]=V,t[35]=U):U=t[35];let W;t[36]!==s||t[37]!==l?(W=s&&!l&&(0,S.jsxs)(`button`,{type:`button`,className:`absolute bottom-2 left-1/2 -translate-x-1/2 flex items-center gap-1 whitespace-nowrap rounded-full border bg-background px-2 py-1 text-xs shadow-xs hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,onClick:()=>{let e=f.current;e&&(j(e)&&e.ownerDocument.getSelection()?.removeAllRanges(),e.focus({preventScroll:!0})),u(!0)},children:[(0,S.jsx)(m,{className:`size-3`,"aria-hidden":!0}),`Jump to latest`]}),t[36]=s,t[37]=l,t[38]=W):W=t[38];let G;return t[39]!==B||t[40]!==U||t[41]!==W||t[42]!==D?(G=(0,S.jsxs)(`div`,{className:D,children:[B,U,W]}),t[39]=B,t[40]=U,t[41]=W,t[42]=D,t[43]=G):G=t[43],G}function N(e){let t=(0,x.c)(10),{state:n,variant:r}=e;if((r===void 0?`icon`:r)===`dot`){let e;t[0]===n?e=t[1]:(e=d(`size-1.5 shrink-0 rounded-full`,{waiting:`bg-muted-foreground`,running:`bg-muted-foreground motion-safe:animate-pulse`,succeeded:`bg-(--grass-9)`,failed:`bg-(--red-9)`}[n]),t[0]=n,t[1]=e);let r;return t[2]===e?r=t[3]:(r=(0,S.jsx)(`span`,{"aria-hidden":!0,className:e}),t[2]=e,t[3]=r),r}let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a={waiting:p,running:_,succeeded:h,failed:i},t[4]=a):a=t[4];let o=a[n],s;t[5]===n?s=t[6]:(s=d(`size-4 shrink-0`,{waiting:`text-muted-foreground/50`,running:`motion-reduce:animate-none`,succeeded:`text-(--grass-11)`,failed:`text-(--red-11)`}[n]),t[5]=n,t[6]=s);let c;return t[7]!==o||t[8]!==s?(c=(0,S.jsx)(o,{"aria-hidden":!0,className:s}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function P(e){let t=(0,x.c)(10),{stages:n,label:r,className:i}=e,a;t[0]===i?a=t[1]:(a=d(`space-y-6`,i),t[0]=i,t[1]=a);let o;if(t[2]!==n){let e;t[4]===n.length?e=t[5]:(e=(e,t)=>(0,S.jsxs)(`li`,{"aria-current":e.state===`running`||e.state===`failed`?`step`:void 0,className:`relative flex items-start gap-3`,children:[t<n.length-1&&(0,S.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-2 top-4.5 -bottom-6.5 border-l border-border`}),(0,S.jsx)(`span`,{className:`mt-0.5 text-muted-foreground`,children:(0,S.jsx)(N,{state:e.state})}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`div`,{className:d(`text-sm`,e.state===`failed`?`text-(--red-11)`:e.state===`waiting`?`text-muted-foreground`:`text-foreground`),children:e.title}),(0,S.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e.description}),e.details]})]},e.id),t[4]=n.length,t[5]=e),o=n.map(e),t[2]=n,t[3]=o}else o=t[3];let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,S.jsx)(`ol`,{"aria-label":r,className:a,children:o}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}var F=[{phase:`preparing-environment`,titles:{succeeded:`Environment prepared`,failed:`Environment setup failed`,running:`Preparing environment`,waiting:`Prepare environment`},descriptions:{succeeded:`Python and dependencies are available.`,failed:`Setup could not finish.`,running:`Set up Python and dependencies.`,waiting:`Set up Python and dependencies.`}},{phase:`starting-kernel`,titles:{succeeded:`Kernel started`,failed:`Kernel failed to start`,running:`Starting kernel`,waiting:`Start kernel`},descriptions:{succeeded:`The notebook is ready to run.`,failed:`The kernel could not connect.`,running:`Connecting to this notebook.`,waiting:`After the environment is ready.`}}];function I(e){return e.kind===`startup`&&(!e.sandbox||e.ready||e.phase===`preparing-environment`||e.phase===`starting-kernel`)}function L(e){let t=(0,x.c)(10),{notice:n}=e,r;t[0]===n.title?r=t[1]:(r=(0,S.jsx)(`output`,{className:`sr-only`,children:n.title}),t[0]=n.title,t[1]=r);let i=n.ready?`Your notebook is ready`:`Getting your notebook ready`,a;t[2]===i?a=t[3]:(a=(0,S.jsx)(`h2`,{className:`text-foreground font-heading text-2xl leading-8 tracking-tight font-normal`,children:i}),t[2]=i,t[3]=a);let o=n.ready?n.sandbox?`Your environment and kernel are ready.`:`Your kernel is ready.`:n.pending?n.sandbox?`Preparing Python and dependencies for this notebook.`:`Connecting to this notebook’s Python kernel.`:`Review the setup details below to continue.`,s;t[4]===o?s=t[5]:(s=(0,S.jsx)(`p`,{className:`text-muted-foreground mt-3 text-sm leading-6`,children:o}),t[4]=o,t[5]=s);let c;return t[6]!==r||t[7]!==a||t[8]!==s?(c=(0,S.jsxs)(`header`,{children:[r,a,s]}),t[6]=r,t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function R(e){let t=(0,x.c)(2),{notice:n}=e,r=n.ready?`succeeded`:n.pending?`running`:`failed`,i;return t[0]===r?i=t[1]:(i=(0,S.jsx)(N,{state:r}),t[0]=r,t[1]=i),i}function z(e){let t=(0,x.c)(28),{notice:r,surface:i}=e,a=n(w),o=n(u),s=r.sandbox?r.phase:`starting-kernel`,c;if(t[0]!==s||t[1]!==r.pending||t[2]!==r.ready||t[3]!==r.sandbox||t[4]!==a?.logs||t[5]!==a?.operation_id||t[6]!==o||t[7]!==i){let e;t[9]===r.sandbox?e=t[10]:(e=e=>r.sandbox||e.phase===`starting-kernel`,t[9]=r.sandbox,t[10]=e);let n;t[11]!==s||t[12]!==r.pending||t[13]!==r.ready||t[14]!==a?.logs||t[15]!==a?.operation_id||t[16]!==o||t[17]!==i?(n=e=>{let{phase:t,titles:n,descriptions:c}=e,l=t===`preparing-environment`,u=r.ready||l&&s===`starting-kernel`?`succeeded`:s===t?r.pending?`running`:`failed`:`waiting`,d=l?a?.logs.environment??``:o?.phase===t?o.logs:``;return{id:t,state:u,title:n[u],description:c[u],details:i===`sidebar`&&(0,S.jsx)(M,{logs:d,state:u===`waiting`?`succeeded`:u,label:l?`environment preparation output`:`kernel startup output`},a?.operation_id)}},t[11]=s,t[12]=r.pending,t[13]=r.ready,t[14]=a?.logs,t[15]=a?.operation_id,t[16]=o,t[17]=i,t[18]=n):n=t[18],c=F.filter(e).map(n),t[0]=s,t[1]=r.pending,t[2]=r.ready,t[3]=r.sandbox,t[4]=a?.logs,t[5]=a?.operation_id,t[6]=o,t[7]=i,t[8]=c}else c=t[8];let l=c,d;t[19]!==r||t[20]!==i?(d=i===`notebook`&&(0,S.jsx)(L,{notice:r}),t[19]=r,t[20]=i,t[21]=d):d=t[21];let f=i===`notebook`?`mt-8`:void 0,p;t[22]!==l||t[23]!==f?(p=(0,S.jsx)(P,{stages:l,label:`Notebook startup stages`,className:f}),t[22]=l,t[23]=f,t[24]=p):p=t[24];let m;return t[25]!==d||t[26]!==p?(m=(0,S.jsxs)(S.Fragment,{children:[d,p]}),t[25]=d,t[26]=p,t[27]=m):m=t[27],m}function B(e){let t=(0,x.c)(2),{error:n}=e,r;return t[0]===n?r=t[1]:(r=(0,S.jsx)(`pre`,{tabIndex:0,"aria-label":`Error details`,className:`mt-3 p-3 rounded border bg-muted/30 text-xs text-muted-foreground whitespace-pre min-w-0 max-w-full max-h-52 overflow-auto`,children:n}),t[0]=n,t[1]=r),r}function V(e){let t=(0,x.c)(21),{notice:n,surface:r,children:i}=e,a=r===void 0?`sidebar`:r,o;t[0]===n?o=t[1]:(o=I(n),t[0]=n,t[1]=o);let s=o,c=!n.pending&&!n.ready,l;t[2]!==c||t[3]!==n||t[4]!==s||t[5]!==a?(l=s?(0,S.jsx)(z,{notice:n,surface:a}):(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,role:`status`,children:[(0,S.jsx)(R,{notice:n}),(0,S.jsx)(`h2`,{className:d(a===`notebook`&&`text-base`,c?`font-medium text-(--red-11)`:`text-foreground`),children:n.title})]}),t[2]=c,t[3]=n,t[4]=s,t[5]=a,t[6]=l):l=t[6];let u;t[7]!==c||t[8]!==n.description||t[9]!==s||t[10]!==a?(u=(c||!s&&a===`notebook`)&&(0,S.jsx)(`p`,{className:d(`mt-2`,c&&`text-foreground`),children:n.description}),t[7]=c,t[8]=n.description,t[9]=s,t[10]=a,t[11]=u):u=t[11];let f;t[12]!==n.error||t[13]!==n.sandbox||t[14]!==a?(f=n.error&&(a===`sidebar`||!n.sandbox)&&(0,S.jsx)(B,{error:n.error}),t[12]=n.error,t[13]=n.sandbox,t[14]=a,t[15]=f):f=t[15];let p;return t[16]!==i||t[17]!==l||t[18]!==u||t[19]!==f?(p=(0,S.jsxs)(`div`,{className:`min-w-0 text-sm`,children:[l,u,f,i]}),t[16]=i,t[17]=l,t[18]=u,t[19]=f,t[20]=p):p=t[20],p}var H=t(null),U=t(e=>{let t=e(A);return{preparationId:e(w)?.operation_id,error:t&&!t.pending?t.error??t.title:null}}),W=t(e=>{let t=e(U),n=e(H);return n&&n.preparationId===t.preparationId&&n.error===t.error?n.expanded:e(A)!==null},(e,t,n)=>{t(H,{...e(U),expanded:n})});export{I as a,A as c,C as d,D as f,R as i,w as l,V as n,N as o,T as p,B as r,M as s,W as t,O as u};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as ee,t as r,u as te}from"./useEvent-Dfcbgjhg.js";import{t as i}from"./react-DVplv7_D.js";import{D as ne,I as re,Qr as a,Rt as ie,So as o,xo as ae}from"./cells-BRkCaSsh.js";import{t as s}from"./compiler-runtime-BrajqUja.js";import{C as oe}from"./config-VPSq73n8.js";import{_ as se}from"./useEventListener-D9cftcHj.js";import{n as ce}from"./utils-B4K466FK.js";import{O as c}from"./config-DX8Y2WbJ.js";import{t as le}from"./cn-ldLVeaqm.js";import{t as l}from"./jsx-runtime-B74pBk57.js";import{n as ue}from"./JsonOutput-DxHKOpPG.js";import{t as u}from"./tooltip-C9TuY18o.js";import{t as d}from"./button-COI-NGrx.js";import{t as f}from"./createLucideIcon-DfJ2oMlA.js";import{l as de}from"./layout-B_GMOySr.js";import{n as fe,t as pe}from"./LazyAnyLanguageCodeMirror-CKcCbG2G.js";import{s as me}from"./toDate-DOj9Q6uC.js";import{t as he}from"./cell-editor-32lVhib7.js";import{t as ge}from"./spinner-DyNE-o8o.js";import{i as _e}from"./useDeleteCell-2_bMClHd.js";import{r as ve}from"./requests-lt0JK8Jt.js";import{r as ye}from"./useTheme-COhSHkCj.js";import{n as be,r as xe,t as Se}from"./react-resizable-panels.browser.esm-Dbe0MrFr.js";import{a as Ce}from"./renderShortcut-BkVJQ_Zh.js";import{n as we,r as Te}from"./panel-context-C2QXpKfx.js";import{t as Ee}from"./kiosk-mode-BZECfg9k.js";var De=f(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),Oe=f(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),p=e(i(),1),ke=s(),m=15,h=c(`marimo:scratchpadHistory:v1`,[],a),Ae=n(!1),je=n(null,(e,t,n)=>{if(n=n.trim(),!n)return;let ee=e(h);t(h,[n,...ee.filter(e=>e!==n)].slice(0,m))}),g=l(),Me={hide_code:!1,disabled:!1},_=()=>{let e=(0,ke.c)(60),n=re(),[i]=oe(),{theme:a}=ye(),s=(0,p.useRef)(null),c=ie(),{createNewCell:l,updateCellCode:f}=ne(),{sendRunScratchpad:m}=ve(),_=we(),v=Te(),y=n.cellRuntime[o],b=y?.output,x=y?.status,S=y?.consoleOutputs,C=n.cellData.__scratch__?.code??``,w=te(je),[T,E]=t(Ae),D=ee(h),O;e[0]!==w||e[1]!==C||e[2]!==m?(O=()=>{m({code:C}),w(C)},e[0]=w,e[1]=C,e[2]=m,e[3]=O):O=e[3];let k=r(O),A;e[4]!==C||e[5]!==l||e[6]!==c?(A=()=>{C.trim()&&l({code:C,before:!1,cellId:c??`__end__`})},e[4]=C,e[5]=l,e[6]=c,e[7]=A):A=e[7];let j=r(A),M;e[8]!==m||e[9]!==f?(M=()=>{f({cellId:o,code:``,formattingChange:!1}),m({code:``});let e=s.current;e&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:``}})},e[8]=m,e[9]=f,e[10]=M):M=e[10];let N=r(M),P;e[11]!==E||e[12]!==f?(P=e=>{E(!1),f({cellId:o,code:e,formattingChange:!1});let t=s.current;t&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},e[11]=E,e[12]=f,e[13]=P):P=e[13];let F=r(P),[I,Ne]=(0,p.useState)(),L;e[14]!==F||e[15]!==D||e[16]!==T||e[17]!==a?(L=()=>T?(0,g.jsx)(`div`,{className:`absolute inset-0 z-100 bg-background p-3 border-none overflow-auto`,children:(0,g.jsx)(`div`,{className:`overflow-auto flex flex-col gap-3`,children:D.map((e,t)=>(0,g.jsx)(`div`,{className:`border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden`,onClick:()=>F(e),children:(0,g.jsx)(p.Suspense,{children:(0,g.jsx)(pe,{language:`python`,theme:a,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:e.trim(),editable:!1,readOnly:!0})})},t))})}):null,e[14]=F,e[15]=D,e[16]=T,e[17]=a,e[18]=L):L=e[18];let R=L,z;e[19]!==N||e[20]!==j||e[21]!==k||e[22]!==D.length||e[23]!==T||e[24]!==E||e[25]!==x?(z=()=>(0,g.jsxs)(`div`,{className:`flex items-center shrink-0 border-b`,children:[(0,g.jsx)(u,{content:Ce(`cell.run`),children:(0,g.jsx)(d,{"data-testid":`scratchpad-run-button`,onClick:k,disabled:T,variant:`text`,size:`xs`,children:(0,g.jsx)(_e,{color:`var(--grass-11)`,size:16})})}),(0,g.jsx)(u,{content:`Clear code and outputs`,children:(0,g.jsx)(d,{disabled:T,size:`xs`,variant:`text`,onClick:N,children:(0,g.jsx)(De,{size:16})})}),(0,g.jsx)(Ee,{children:(0,g.jsx)(u,{content:`Insert code`,children:(0,g.jsx)(d,{disabled:T,size:`xs`,variant:`text`,onClick:j,children:(0,g.jsx)(fe,{size:16})})})}),(x===`running`||x===`queued`)&&(0,g.jsx)(ge,{className:`inline`,size:`small`}),(0,g.jsx)(`div`,{className:`flex-1`}),(0,g.jsx)(u,{content:`Toggle history`,children:(0,g.jsx)(d,{size:`xs`,variant:`text`,className:le(T&&`bg-(--sky-3) rounded-none`),onClick:()=>E(!T),disabled:D.length===0,children:(0,g.jsx)(Oe,{size:16})})}),(0,g.jsx)(u,{content:(0,g.jsx)(`span`,{className:`block max-w-prose`,children:`Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file.`}),children:(0,g.jsx)(d,{size:`xs`,variant:`text`,children:(0,g.jsx)(me,{size:16})})})]}),e[19]=N,e[20]=j,e[21]=k,e[22]=D.length,e[23]=T,e[24]=E,e[25]=x,e[26]=z):z=e[26];let B=z,Pe=_===`vertical`,V;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(V=ae.create(o),e[27]=V):V=e[27];let H;e[28]===B?H=e[29]:(H=B(),e[28]=B,e[29]=H);let U;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>{s.current=e},e[30]=U):U=e[30];let W;e[31]!==C||e[32]!==k||e[33]!==I||e[34]!==a||e[35]!==i?(W=(0,g.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,g.jsx)(he,{theme:a,showPlaceholder:!1,id:o,code:C,config:Me,status:`idle`,serializedEditorState:null,runCell:k,userConfig:i,editorViewRef:s,setEditorView:U,hidden:!1,showHiddenCode:se.NOOP,languageAdapter:I,setLanguageAdapter:Ne})}),e[31]=C,e[32]=k,e[33]=I,e[34]=a,e[35]=i,e[36]=W):W=e[36];let G;e[37]===R?G=e[38]:(G=R(),e[37]=R,e[38]=G);let K;e[39]!==G||e[40]!==H||e[41]!==W?(K=(0,g.jsx)(Se,{defaultSize:40,minSize:20,maxSize:70,children:(0,g.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden relative`,children:[H,W,G]})}),e[39]=G,e[40]=H,e[41]=W,e[42]=K):K=e[42];let q=Pe?`h-1`:`w-1`,J;e[43]===q?J=e[44]:(J=le(`bg-border hover:bg-primary/50 transition-colors`,q),e[43]=q,e[44]=J);let Y;e[45]===J?Y=e[46]:(Y=(0,g.jsx)(xe,{className:J}),e[45]=J,e[46]=Y);let X;e[47]===b?X=e[48]:(X=(0,g.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,g.jsx)(ue,{allowExpand:!1,output:b,className:ce.outputArea,cellId:o,stale:!1,loading:!1})}),e[47]=b,e[48]=X);let Z;e[49]===S?Z=e[50]:(Z=(0,g.jsx)(`div`,{className:`overflow-auto shrink-0 max-h-[50%]`,children:(0,g.jsx)(de,{consoleOutputs:S,className:`overflow-auto`,stale:!1,interrupted:!1,cellName:`_`,onSubmitDebugger:se.NOOP,cellId:o,debuggerActive:!1})}),e[49]=S,e[50]=Z);let Q;e[51]!==X||e[52]!==Z?(Q=(0,g.jsx)(Se,{defaultSize:60,minSize:20,children:(0,g.jsxs)(`div`,{className:`h-full flex flex-col divide-y overflow-hidden`,children:[X,Z]})}),e[51]=X,e[52]=Z,e[53]=Q):Q=e[53];let $;return e[54]!==_||e[55]!==v||e[56]!==K||e[57]!==Y||e[58]!==Q?($=(0,g.jsx)(`div`,{className:`flex flex-col h-full overflow-hidden`,id:V,children:(0,g.jsxs)(be,{direction:_,className:`h-full`,children:[K,Y,Q]},v)}),e[54]=_,e[55]=v,e[56]=K,e[57]=Y,e[58]=Q,e[59]=$):$=e[59],$},v=()=>{let e=(0,ke.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,g.jsx)(_,{}),e[0]=t):t=e[0],t};export{v as default};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as ee,t as r,u as te}from"./useEvent-Dfcbgjhg.js";import{t as i}from"./react-DVplv7_D.js";import{D as ne,I as re,Qr as a,Rt as ie,So as o,xo as ae}from"./cells-rA_jsZCj.js";import{t as s}from"./compiler-runtime-BrajqUja.js";import{C as oe}from"./config-VPSq73n8.js";import{_ as se}from"./useEventListener-D9cftcHj.js";import{n as ce}from"./utils-B4K466FK.js";import{O as c}from"./config-DX8Y2WbJ.js";import{t as le}from"./cn-ldLVeaqm.js";import{t as l}from"./jsx-runtime-B74pBk57.js";import{n as ue}from"./JsonOutput-d-k8v_17.js";import{t as u}from"./tooltip-C9TuY18o.js";import{t as d}from"./button-COI-NGrx.js";import{t as f}from"./createLucideIcon-DfJ2oMlA.js";import{l as de}from"./layout-DBuMeWh0.js";import{n as fe,t as pe}from"./LazyAnyLanguageCodeMirror-CKcCbG2G.js";import{s as me}from"./toDate-DOj9Q6uC.js";import{t as he}from"./cell-editor-CR-tZNnc.js";import{t as ge}from"./spinner-DyNE-o8o.js";import{i as _e}from"./useDeleteCell-DFBGlSQk.js";import{r as ve}from"./requests-lt0JK8Jt.js";import{r as ye}from"./useTheme-COhSHkCj.js";import{n as be,r as xe,t as Se}from"./react-resizable-panels.browser.esm-Dbe0MrFr.js";import{a as Ce}from"./renderShortcut-BkVJQ_Zh.js";import{n as we,r as Te}from"./panel-context-C2QXpKfx.js";import{t as Ee}from"./kiosk-mode-BZECfg9k.js";var De=f(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),Oe=f(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),p=e(i(),1),ke=s(),m=15,h=c(`marimo:scratchpadHistory:v1`,[],a),Ae=n(!1),je=n(null,(e,t,n)=>{if(n=n.trim(),!n)return;let ee=e(h);t(h,[n,...ee.filter(e=>e!==n)].slice(0,m))}),g=l(),Me={hide_code:!1,disabled:!1},_=()=>{let e=(0,ke.c)(60),n=re(),[i]=oe(),{theme:a}=ye(),s=(0,p.useRef)(null),c=ie(),{createNewCell:l,updateCellCode:f}=ne(),{sendRunScratchpad:m}=ve(),_=we(),v=Te(),y=n.cellRuntime[o],b=y?.output,x=y?.status,S=y?.consoleOutputs,C=n.cellData.__scratch__?.code??``,w=te(je),[T,E]=t(Ae),D=ee(h),O;e[0]!==w||e[1]!==C||e[2]!==m?(O=()=>{m({code:C}),w(C)},e[0]=w,e[1]=C,e[2]=m,e[3]=O):O=e[3];let k=r(O),A;e[4]!==C||e[5]!==l||e[6]!==c?(A=()=>{C.trim()&&l({code:C,before:!1,cellId:c??`__end__`})},e[4]=C,e[5]=l,e[6]=c,e[7]=A):A=e[7];let j=r(A),M;e[8]!==m||e[9]!==f?(M=()=>{f({cellId:o,code:``,formattingChange:!1}),m({code:``});let e=s.current;e&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:``}})},e[8]=m,e[9]=f,e[10]=M):M=e[10];let N=r(M),P;e[11]!==E||e[12]!==f?(P=e=>{E(!1),f({cellId:o,code:e,formattingChange:!1});let t=s.current;t&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},e[11]=E,e[12]=f,e[13]=P):P=e[13];let F=r(P),[I,Ne]=(0,p.useState)(),L;e[14]!==F||e[15]!==D||e[16]!==T||e[17]!==a?(L=()=>T?(0,g.jsx)(`div`,{className:`absolute inset-0 z-100 bg-background p-3 border-none overflow-auto`,children:(0,g.jsx)(`div`,{className:`overflow-auto flex flex-col gap-3`,children:D.map((e,t)=>(0,g.jsx)(`div`,{className:`border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden`,onClick:()=>F(e),children:(0,g.jsx)(p.Suspense,{children:(0,g.jsx)(pe,{language:`python`,theme:a,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:e.trim(),editable:!1,readOnly:!0})})},t))})}):null,e[14]=F,e[15]=D,e[16]=T,e[17]=a,e[18]=L):L=e[18];let R=L,z;e[19]!==N||e[20]!==j||e[21]!==k||e[22]!==D.length||e[23]!==T||e[24]!==E||e[25]!==x?(z=()=>(0,g.jsxs)(`div`,{className:`flex items-center shrink-0 border-b`,children:[(0,g.jsx)(u,{content:Ce(`cell.run`),children:(0,g.jsx)(d,{"data-testid":`scratchpad-run-button`,onClick:k,disabled:T,variant:`text`,size:`xs`,children:(0,g.jsx)(_e,{color:`var(--grass-11)`,size:16})})}),(0,g.jsx)(u,{content:`Clear code and outputs`,children:(0,g.jsx)(d,{disabled:T,size:`xs`,variant:`text`,onClick:N,children:(0,g.jsx)(De,{size:16})})}),(0,g.jsx)(Ee,{children:(0,g.jsx)(u,{content:`Insert code`,children:(0,g.jsx)(d,{disabled:T,size:`xs`,variant:`text`,onClick:j,children:(0,g.jsx)(fe,{size:16})})})}),(x===`running`||x===`queued`)&&(0,g.jsx)(ge,{className:`inline`,size:`small`}),(0,g.jsx)(`div`,{className:`flex-1`}),(0,g.jsx)(u,{content:`Toggle history`,children:(0,g.jsx)(d,{size:`xs`,variant:`text`,className:le(T&&`bg-(--sky-3) rounded-none`),onClick:()=>E(!T),disabled:D.length===0,children:(0,g.jsx)(Oe,{size:16})})}),(0,g.jsx)(u,{content:(0,g.jsx)(`span`,{className:`block max-w-prose`,children:`Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file.`}),children:(0,g.jsx)(d,{size:`xs`,variant:`text`,children:(0,g.jsx)(me,{size:16})})})]}),e[19]=N,e[20]=j,e[21]=k,e[22]=D.length,e[23]=T,e[24]=E,e[25]=x,e[26]=z):z=e[26];let B=z,Pe=_===`vertical`,V;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(V=ae.create(o),e[27]=V):V=e[27];let H;e[28]===B?H=e[29]:(H=B(),e[28]=B,e[29]=H);let U;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>{s.current=e},e[30]=U):U=e[30];let W;e[31]!==C||e[32]!==k||e[33]!==I||e[34]!==a||e[35]!==i?(W=(0,g.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,g.jsx)(he,{theme:a,showPlaceholder:!1,id:o,code:C,config:Me,status:`idle`,serializedEditorState:null,runCell:k,userConfig:i,editorViewRef:s,setEditorView:U,hidden:!1,showHiddenCode:se.NOOP,languageAdapter:I,setLanguageAdapter:Ne})}),e[31]=C,e[32]=k,e[33]=I,e[34]=a,e[35]=i,e[36]=W):W=e[36];let G;e[37]===R?G=e[38]:(G=R(),e[37]=R,e[38]=G);let K;e[39]!==G||e[40]!==H||e[41]!==W?(K=(0,g.jsx)(Se,{defaultSize:40,minSize:20,maxSize:70,children:(0,g.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden relative`,children:[H,W,G]})}),e[39]=G,e[40]=H,e[41]=W,e[42]=K):K=e[42];let q=Pe?`h-1`:`w-1`,J;e[43]===q?J=e[44]:(J=le(`bg-border hover:bg-primary/50 transition-colors`,q),e[43]=q,e[44]=J);let Y;e[45]===J?Y=e[46]:(Y=(0,g.jsx)(xe,{className:J}),e[45]=J,e[46]=Y);let X;e[47]===b?X=e[48]:(X=(0,g.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,g.jsx)(ue,{allowExpand:!1,output:b,className:ce.outputArea,cellId:o,stale:!1,loading:!1})}),e[47]=b,e[48]=X);let Z;e[49]===S?Z=e[50]:(Z=(0,g.jsx)(`div`,{className:`overflow-auto shrink-0 max-h-[50%]`,children:(0,g.jsx)(de,{consoleOutputs:S,className:`overflow-auto`,stale:!1,interrupted:!1,cellName:`_`,onSubmitDebugger:se.NOOP,cellId:o,debuggerActive:!1})}),e[49]=S,e[50]=Z);let Q;e[51]!==X||e[52]!==Z?(Q=(0,g.jsx)(Se,{defaultSize:60,minSize:20,children:(0,g.jsxs)(`div`,{className:`h-full flex flex-col divide-y overflow-hidden`,children:[X,Z]})}),e[51]=X,e[52]=Z,e[53]=Q):Q=e[53];let $;return e[54]!==_||e[55]!==v||e[56]!==K||e[57]!==Y||e[58]!==Q?($=(0,g.jsx)(`div`,{className:`flex flex-col h-full overflow-hidden`,id:V,children:(0,g.jsxs)(be,{direction:_,className:`h-full`,children:[K,Y,Q]},v)}),e[54]=_,e[55]=v,e[56]=K,e[57]=Y,e[58]=Q,e[59]=$):$=e[59],$},v=()=>{let e=(0,ke.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,g.jsx)(_,{}),e[0]=t):t=e[0],t};export{v as default};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,u as i}from"./useEvent-Dfcbgjhg.js";import{t as a}from"./react-DVplv7_D.js";import{$r as o,Ai as s,Bi as c,Bt as l,Cn as u,D as d,Gn as f,Ha as p,Hi as m,Ii as h,Ji as g,Ki as _,Kn as v,Li as y,M as b,Mi as x,P as S,Qr as C,Ri as w,Rn as T,Rt as E,Ui as D,Wa as O,Wi as k,Xi as A,Yi as j,Zi as M,_n as ee,c as N,fn as P,gn as F,i as I,jn as L,qi as R,qn as z,ro as te,ti as ne,to as B,yr as V,yt as H,zi as U}from"./cells-rA_jsZCj.js";import{t as re}from"./compiler-runtime-BrajqUja.js";import{s as ie}from"./config-VPSq73n8.js";import{r as ae}from"./config-FzDtjF1-.js";import{O as W}from"./config-DX8Y2WbJ.js";import{t as G}from"./ErrorBoundary-B4n9EnHB.js";import{t as oe}from"./cn-ldLVeaqm.js";import{t as se}from"./jsx-runtime-B74pBk57.js";import{_ as ce,at as K,f as q,g as le,h as ue,it as J,m as de,nt as fe,ot as pe,rt as me,tt as he,v as ge}from"./JsonOutput-d-k8v_17.js";import{t as _e}from"./tooltip-C9TuY18o.js";import{r as ve,t as ye}from"./button-COI-NGrx.js";import{t as be}from"./createLucideIcon-DfJ2oMlA.js";import{i as xe}from"./paths-bkIFVj8h.js";import{r as Se}from"./useNumberFormatter-D7O_26UI.js";import{a as Ce,r as we}from"./tree-actions-DAd80MbP.js";import{a as Te}from"./input-BoBxR50a.js";import{n as Ee,o as De}from"./column-preview-uosAAL4X.js";import{t as Oe}from"./workflow-cw-0b9g5.js";import{t as ke}from"./copy-icon-BIiRXh_3.js";import{l as Ae}from"./arrays-BqUx5USx.js";import{i as je}from"./strings-B2vv-ENv.js";import{r as Me}from"./requests-lt0JK8Jt.js";import{t as Ne}from"./I18nProvider-Cg2I_s1_.js";import{n as Pe}from"./useAsyncData-C7aJJz0Y.js";import{t as Fe}from"./cell-link-1CynTVGQ.js";import{a as Ie,i as Le,n as Re,o as ze,r as Be,t as Ve}from"./table-vrvqpuKJ.js";import{n as He}from"./icons-CiZ_8zS-.js";import{t as Ue}from"./useDeepCompareMemoize-DFIVN9dn.js";import{t as We}from"./useAddCell-DGstJK0S.js";import{t as Ge}from"./empty-state-BaCKb7o3.js";import{n as Ke,t as qe}from"./common-lisZ0l6a.js";import{a as Je,i as Ye,n as Xe,o as Ze,r as Qe,s as $e,t as et}from"./components-S7ZwOrvO.js";import{r as tt}from"./panel-accordion-state-GeMEdCPw.js";var nt=be(`square-equal`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 10h10`,key:`1101jm`}],[`path`,{d:`M7 14h10`,key:`1mhdw3`}]]),Y=re(),X=e(a(),1),Z=se(),rt=1;function it(e){return 1.75+e*rt}function at(e){return 3+e*rt}function ot(e){return 3.25+e*rt}var Q={engineEmpty:.75,engine:.75,database:1,tableLoading:2.75,tableSchemaless:2,columnLocal:1.25,columnPreview:2.5};function $(e){return{paddingLeft:`${e}rem`}}var st=n(e=>{let t=e(w),n=e(ne),r=e(I);return Ae(t,e=>{if(!e.variable_name)return-1;let t=Object.values(n).find(t=>t.name===e.variable_name);if(!t)return 0;let i=r.inOrderIds.indexOf(t.declaredBy[0]);return i===-1?0:i})}),ct=W(`marimo:datasources:hideEmpty`,!1,C,{getOnInit:!0});function lt(e){let t=!1,n=[];for(let r of e){if(!k(r)||!m(r)){n.push(r);continue}let e=r.child_schemas??[],i=lt(e);if(r.tables.length===0&&i.length===0){t=!0;continue}if(i===e){n.push(r);continue}t=!0,n.push({...r,child_schemas:i})}return t?n:e}function ut(e){let t=!1,n=[];for(let r of e){if(D(r)&&r.schemas.length===0){t=!0;continue}if(r.schemas.length===0){n.push(r);continue}let e=lt(r.schemas);if(e.length===0){t=!0;continue}if(e===r.schemas){n.push(r);continue}t=!0,n.push({...r,schemas:e})}return t?n:e}var dt=()=>{let e=(0,Y.c)(42),[n,a]=X.useState(``),[o,s]=t(ct),c=i(y),l=r(st),d=r(x),f;bb0:{if(!o){f=d;break bb0}let t,n;e[0]===d?(t=e[1],n=e[2]):(t=!1,n=d.map(e=>{let n=ut(e.databases);return n===e.databases?e:(t=!0,{...e,databases:n})}),e[0]=d,e[1]=t,e[2]=n),f=t?n:d}let p=f;if(l.length===0&&p.length===0){let t;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Ge,{title:`No tables found`,description:`Any datasets/dataframes in the global scope will be shown here.`,action:(0,Z.jsx)(Ze,{group:`database`,label:`Add database or catalog`,variant:`outline`,size:`sm`}),icon:(0,Z.jsx)(xe,{})}),e[3]=t):t=e[3],t}let m;e[4]===n?m=e[5]:(m=n.trim(),e[4]=n,e[5]=m);let h=!!m,g;e[6]===c?g=e[7]:(g=e=>{c(e.length>0),a(e)},e[6]=c,e[7]=g);let _;e[8]!==n||e[9]!==g?(_=(0,Z.jsx)(F,{placeholder:`Search tables...`,className:`h-6 m-1`,value:n,onValueChange:g,rootClassName:`flex-1 border-r border-b-0`}),e[8]=n,e[9]=g,e[10]=_):_=e[10];let v;e[11]===h?v=e[12]:(v=h&&(0,Z.jsx)(`button`,{type:`button`,className:`float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground`,onClick:()=>a(``),children:(0,Z.jsx)(Se,{className:`h-4 w-4`})}),e[11]=h,e[12]=v);let b=!o,S;e[13]!==o||e[14]!==s?(S=()=>s(!o),e[13]=o,e[14]=s,e[15]=S):S=e[15];let C;e[16]!==b||e[17]!==S?(C=(0,Z.jsx)(Ce,{"data-testid":`datasources-hide-empty-button`,isVisible:b,onToggle:S,showTooltip:`Show empty schemas and databases`,hideTooltip:`Hide empty schemas and databases`,size:`sm`,className:`px-2 rounded-none focus-visible:outline-hidden`}),e[16]=b,e[17]=S,e[18]=C):C=e[18];let w;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Ze,{group:`database`,label:`Add database or catalog`,compact:!0,variant:`ghost`,size:`sm`,className:`px-2 rounded-none focus-visible:outline-hidden`}),e[19]=w):w=e[19];let T;e[20]!==_||e[21]!==v||e[22]!==C?(T=(0,Z.jsxs)(`div`,{className:`flex items-center w-full border-b`,children:[_,v,C,w]}),e[20]=_,e[21]=v,e[22]=C,e[23]=T):T=e[23];let E;if(e[24]!==p||e[25]!==n){let t;e[27]===n?t=e[28]:(t=e=>(0,Z.jsx)(ft,{connection:e,hasChildren:e.databases.length>0,children:e.databases.map(t=>(0,Z.jsx)(gt,{connection:e,database:t,searchValue:n},t.name))},e.name),e[27]=n,e[28]=t),E=p.map(t),e[24]=p,e[25]=n,e[26]=E}else E=e[26];let D;e[29]!==p.length||e[30]!==l.length?(D=p.length>0&&l.length>0&&(0,Z.jsxs)(de,{className:`pr-2`,style:$(Q.engine),children:[(0,Z.jsx)(He,{className:`h-4 w-4 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`text-xs`,children:`Python`})]}),e[29]=p.length,e[30]=l.length,e[31]=D):D=e[31];let O;e[32]!==n||e[33]!==l?(O=l.length>0&&(0,Z.jsx)(bt,{tables:l,searchValue:n}),e[32]=n,e[33]=l,e[34]=O):O=e[34];let k;e[35]!==E||e[36]!==D||e[37]!==O?(k=(0,Z.jsxs)(u,{className:`flex flex-col`,children:[E,D,O]}),e[35]=E,e[36]=D,e[37]=O,e[38]=k):k=e[38];let A;return e[39]!==k||e[40]!==T?(A=(0,Z.jsxs)(P,{className:`border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden`,shouldFilter:!1,children:[T,k]}),e[39]=k,e[40]=T,e[41]=A):A=e[41],A},ft=e=>{let t=(0,Y.c)(26),{connection:n,children:r,hasChildren:i}=e,a=n.name===M,o=a?`In-Memory`:n.name,{previewDataSourceConnection:c}=Me(),l;t[0]!==n.name||t[1]!==c?(l=async()=>{await c({engine:n.name})},t[0]=n.name,t[1]=c,t[2]=l):l=t[2];let u=l,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=$(Q.engine),t[3]=d):d=t[3];let f;t[4]===n.dialect?f=t[5]:(f=(0,Z.jsx)(L,{className:`h-4 w-4 text-muted-foreground`,name:n.dialect}),t[4]=n.dialect,t[5]=f);let p;t[6]===n.dialect?p=t[7]:(p=s(n.dialect),t[6]=n.dialect,t[7]=p);let m;t[8]===p?m=t[9]:(m=(0,Z.jsx)(`span`,{className:`text-xs`,children:p}),t[8]=p,t[9]=m);let h=o,g;t[10]===h?g=t[11]:(g=(0,Z.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,(0,Z.jsx)($e,{variableName:h}),`)`]}),t[10]=h,t[11]=g);let _;t[12]!==u||t[13]!==a?(_=!a&&(0,Z.jsx)(we,{onClick:u,tooltip:`Refresh connection`,className:`ml-auto h-4 p-0`,iconClassName:`h-3.5 w-3.5`}),t[12]=u,t[13]=a,t[14]=_):_=t[14];let v;t[15]!==f||t[16]!==m||t[17]!==g||t[18]!==_?(v=(0,Z.jsxs)(de,{className:`pr-2`,style:d,children:[f,m,g,_]}),t[15]=f,t[16]=m,t[17]=g,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==r||t[21]!==i?(y=i?r:(0,Z.jsx)(ue,{content:`No databases available`,style:$(Q.engineEmpty)}),t[20]=r,t[21]=i,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==v?(b=(0,Z.jsxs)(Z.Fragment,{children:[v,y]}),t[23]=y,t[24]=v,t[25]=b):b=t[25],b},pt=X.createContext(null);function mt(){let e=X.useContext(pt);if(e==null)throw Error(`useDataSourceTree must be used within a DataSourceTreeContext.Provider`);return e}function ht(e,{schema:t,schemaPath:n}){return{engine:e.engineName,database:e.databaseName,schema:t,schemaPath:n,defaultSchema:e.defaultSchema,defaultDatabase:e.defaultDatabase,dialect:e.dialect}}var gt=e=>{let t=(0,Y.c)(21),{connection:n,database:r,searchValue:i}=e,a;t[0]!==n.default_database||t[1]!==n.default_schema||t[2]!==n.dialect||t[3]!==n.name||t[4]!==r.name||t[5]!==i?(a={engineName:n.name,databaseName:r.name,dialect:n.dialect,defaultSchema:n.default_schema,defaultDatabase:n.default_database,searchValue:i},t[0]=n.default_database,t[1]=n.default_schema,t[2]=n.dialect,t[3]=n.name,t[4]=r.name,t[5]=i,t[6]=a):a=t[6];let o=a,s=n.name,c=r.schemas,l;t[7]===r?l=t[8]:(l=D(r),t[7]=r,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[9]=u):u=t[9];let d;t[10]!==r.schemas||t[11]!==l?(d=(0,Z.jsx)(vt,{schemas:c,schemasResolved:l,schemaPath:u,depth:0}),t[10]=r.schemas,t[11]=l,t[12]=d):d=t[12];let f;t[13]!==d||t[14]!==o?(f=(0,Z.jsx)(pt.Provider,{value:o,children:d}),t[13]=d,t[14]=o,t[15]=f):f=t[15];let p;return t[16]!==n.name||t[17]!==r||t[18]!==i||t[19]!==f?(p=(0,Z.jsx)(_t,{engineName:s,database:r,searchValue:i,children:f}),t[16]=n.name,t[17]=r,t[18]=i,t[19]=f,t[20]=p):p=t[20],p},_t=e=>{let t=(0,Y.c)(29),{searchValue:n,engineName:r,database:i,children:a}=e,o;t[0]!==i||t[1]!==n?(o=g(i,n),t[0]=i,t[1]=n,t[2]=o):o=t[2];let s=o,[c,l]=X.useState(s),[u,d]=X.useState(!1),[f,p]=X.useState(n),[m,h]=X.useState(s);(f!==n||m!==s)&&(p(n),h(s),l(s));let _;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=$(Q.database),t[3]=_):_=t[3];let v;t[4]!==c||t[5]!==u?(v=()=>{l(!c),d(!u)},t[4]=c,t[5]=u,t[6]=v):v=t[6];let y=`${r}:${i.name}`,b;t[7]===c?b=t[8]:(b=(0,Z.jsx)(ge,{isExpanded:c}),t[7]=c,t[8]=b);let x=u&&c?`text-foreground`:`text-muted-foreground`,S;t[9]===x?S=t[10]:(S=oe(`h-4 w-4`,x),t[9]=x,t[10]=S);let C;t[11]===S?C=t[12]:(C=(0,Z.jsx)(xe,{className:S}),t[11]=S,t[12]=C);let w=u&&c&&`font-semibold`,T;t[13]===w?T=t[14]:(T=oe(w),t[13]=w,t[14]=T);let E;t[15]===i.name?E=t[16]:(E=i.name===``?(0,Z.jsx)(`i`,{children:`Not connected`}):i.name,t[15]=i.name,t[16]=E);let D;t[17]!==T||t[18]!==E?(D=(0,Z.jsx)(`span`,{className:T,children:E}),t[17]=T,t[18]=E,t[19]=D):D=t[19];let O;t[20]!==D||t[21]!==v||t[22]!==y||t[23]!==b||t[24]!==C?(O=(0,Z.jsxs)(ee,{className:`text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none`,style:_,onSelect:v,value:y,children:[b,C,D]}),t[20]=D,t[21]=v,t[22]=y,t[23]=b,t[24]=C,t[25]=O):O=t[25];let k=c&&a,A;return t[26]!==O||t[27]!==k?(A=(0,Z.jsxs)(Z.Fragment,{children:[O,k]}),t[26]=O,t[27]=k,t[28]=A):A=t[28],A},vt=e=>{let{schemas:t,schemasResolved:n,depth:r}=e,i=mt(),{engineName:a,databaseName:o,searchValue:s}=i,{addSchemaList:c}=h(),l=Ue(e.schemaPath),[u,d]=X.useState(!1),{isPending:p,error:m}=Pe(async()=>{if(!n&&a){d(!0);try{let e=await f.request({engine:a,database:o,schemaPath:l});c({schemas:e.schemas??[],sqlSchemaContext:{engine:a,database:o,schemaPath:l}})}finally{d(!1)}}},[n,a,o,l]),g=$(it(r));return p||u?(0,Z.jsx)(ce,{message:`Loading schemas...`,style:g}):m?(0,Z.jsx)(le,{error:m,style:g}):t.length===0?(0,Z.jsx)(ue,{content:`No schemas available`,style:g}):(0,Z.jsx)(Z.Fragment,{children:t.map(e=>_(e.name)?(0,Z.jsx)(bt,{tables:e.tables,tablesResolved:k(e),searchValue:s,sqlTableContext:ht(i,{schema:e.name,schemaPath:l})},e.name):(0,Z.jsx)(yt,{schema:e,schemaPath:[...l,e.name],depth:r},e.name))})},yt=e=>{let t=(0,Y.c)(41),{schema:n,schemaPath:r,depth:i}=e,a=mt(),{databaseName:o,searchValue:s}=a,c;t[0]!==n||t[1]!==s?(c=R(n,s),t[0]=n,t[1]=s,t[2]=c):c=t[2];let l=c,[u,d]=X.useState(l),[f,p]=X.useState(!1),[h,g]=X.useState(s),[_,v]=X.useState(l),y;t[3]===r?y=t[4]:(y=r.join(`.`),t[3]=r,t[4]=y);let b=`${o}:${y}`,x;t[5]===n.child_schemas?x=t[6]:(x=n.child_schemas??[],t[5]=n.child_schemas,t[6]=x);let S=x;(h!==s||_!==l)&&(g(s),v(l),d(l));let C;t[7]===i?C=t[8]:(C=$(it(i)),t[7]=i,t[8]=C);let w;t[9]!==u||t[10]!==f?(w=()=>{d(!u),p(!f)},t[9]=u,t[10]=f,t[11]=w):w=t[11];let T;t[12]===u?T=t[13]:(T=(0,Z.jsx)(ge,{isExpanded:u}),t[12]=u,t[13]=T);let E=f&&u&&`text-foreground`,D;t[14]===E?D=t[15]:(D=oe(`h-4 w-4 text-muted-foreground`,E),t[14]=E,t[15]=D);let O;t[16]===D?O=t[17]:(O=(0,Z.jsx)(B,{className:D}),t[16]=D,t[17]=O);let A=f&&u&&`font-semibold`,j;t[18]===A?j=t[19]:(j=oe(A),t[18]=A,t[19]=j);let M;t[20]!==n.name||t[21]!==j?(M=(0,Z.jsx)(`span`,{className:j,children:n.name}),t[20]=n.name,t[21]=j,t[22]=M):M=t[22];let N;t[23]!==M||t[24]!==C||t[25]!==w||t[26]!==T||t[27]!==O||t[28]!==b?(N=(0,Z.jsxs)(ee,{className:`text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none`,style:C,onSelect:w,value:b,children:[T,O,M]}),t[23]=M,t[24]=C,t[25]=w,t[26]=T,t[27]=O,t[28]=b,t[29]=N):N=t[29];let P;t[30]!==S||t[31]!==i||t[32]!==u||t[33]!==n||t[34]!==r||t[35]!==s||t[36]!==a?(P=u&&(0,Z.jsxs)(Z.Fragment,{children:[(S.length>0||!m(n))&&(0,Z.jsx)(vt,{schemas:S,schemasResolved:m(n),schemaPath:r,depth:i+1}),(0,Z.jsx)(bt,{tables:n.tables,tablesResolved:k(n),searchValue:s,tableIndentRem:at(i),columnIndentRem:ot(i),sqlTableContext:ht(a,{schema:n.name,schemaPath:r})})]}),t[30]=S,t[31]=i,t[32]=u,t[33]=n,t[34]=r,t[35]=s,t[36]=a,t[37]=P):P=t[37];let F;return t[38]!==N||t[39]!==P?(F=(0,Z.jsxs)(Z.Fragment,{children:[N,P]}),t[38]=N,t[39]=P,t[40]=F):F=t[40],F},bt=e=>{let t=(0,Y.c)(31),{tables:n,sqlTableContext:r,searchValue:i,tablesResolved:a,tableIndentRem:o,columnIndentRem:s}=e,c=a===void 0||a,{addTableList:l}=h(),[u,d]=X.useState(!1),f;t[0]!==l||t[1]!==r||t[2]!==c?(f=async()=>{if(!c&&r){d(!0);let{engine:e,database:t,schema:n,schemaPath:i}=r,a=await z.request({engine:e,database:t,schema:n,schemaPath:i??[]});if(!a?.tables)throw d(!1),Error(`No tables available`);l({tables:a.tables,sqlTableContext:r}),d(!1)}},t[0]=l,t[1]=r,t[2]=c,t[3]=f):f=t[3];let p;t[4]!==r||t[5]!==c?(p=[c,r],t[4]=r,t[5]=c,t[6]=p):p=t[6];let{isPending:m,error:g}=Pe(f,p),_=o??Q.tableLoading,v;t[7]===_?v=t[8]:(v=$(_),t[7]=_,t[8]=v);let y=v;if(m||u){let e;return t[9]===y?e=t[10]:(e=(0,Z.jsx)(ce,{message:`Loading tables...`,style:y}),t[9]=y,t[10]=e),e}if(g){let e;return t[11]!==g||t[12]!==y?(e=(0,Z.jsx)(le,{error:g,style:y}),t[11]=g,t[12]=y,t[13]=e):e=t[13],e}if(n.length===0){let e;return t[14]===y?e=t[15]:(e=(0,Z.jsx)(ue,{content:`No tables found`,style:y}),t[14]=y,t[15]=e),e}let b;if(t[16]!==s||t[17]!==i||t[18]!==r||t[19]!==o||t[20]!==n){let e;t[22]===i?e=t[23]:(e=e=>!i||e.name.toLowerCase().includes(i.toLowerCase()),t[22]=i,t[23]=e);let a=n.filter(e),c;t[24]!==s||t[25]!==i||t[26]!==r||t[27]!==o?(c=e=>(0,Z.jsx)(xt,{table:e,sqlTableContext:r,isSearching:!!i,tableIndentRem:o,columnIndentRem:s},e.name),t[24]=s,t[25]=i,t[26]=r,t[27]=o,t[28]=c):c=t[28],b=a.map(c),t[16]=s,t[17]=i,t[18]=r,t[19]=o,t[20]=n,t[21]=b}else b=t[21];let x;return t[29]===b?x=t[30]:(x=(0,Z.jsx)(Z.Fragment,{children:b}),t[29]=b,t[30]=x),x},xt=e=>{let t=(0,Y.c)(69),{table:n,sqlTableContext:i,isSearching:a,tableIndentRem:o,columnIndentRem:s}=e,{addTable:c}=h(),[u,f]=X.useState(!1),p=n.columns.length>0,m;t[0]!==c||t[1]!==u||t[2]!==i||t[3]!==n.name||t[4]!==p?(m=async()=>{if(u&&!p&&i){let{engine:e,database:t,schema:r,schemaPath:a}=i,o=await v.request({engine:e,database:t,schema:r,tableName:n.name,schemaPath:a??[]});if(!o?.table)throw Error(`No table details available`);c({table:o.table,sqlTableContext:i})}},t[0]=c,t[1]=u,t[2]=i,t[3]=n.name,t[4]=p,t[5]=m):m=t[5];let g;t[6]!==u||t[7]!==p?(g=[u,p],t[6]=u,t[7]=p,t[8]=g):g=t[8];let{isFetching:_,isPending:y,error:b}=Pe(m,g),x=r(ie),S=E(),{createNewCell:C}=d(),w=We(),T;t[9]!==w||t[10]!==x||t[11]!==C||t[12]!==S||t[13]!==i||t[14]!==n?(T=()=>{l({autoInstantiate:x,createNewCell:C,fromCellId:S}),w((()=>{if(n.source_type===`catalog`){let e=i?.database?[i.database,...i.schemaPath??[],n.name].join(`.`):n.name;return`${n.engine}.load_table("${e}")`}if(i)return j({table:n,columnName:`*`,sqlTableContext:i});switch(n.source_type){case`local`:return`mo.ui.table(${n.name})`;case`duckdb`:case`connection`:return j({table:n,columnName:`*`,sqlTableContext:i});default:return je(n.source_type),``}})())},t[9]=w,t[10]=x,t[11]=C,t[12]=S,t[13]=i,t[14]=n,t[15]=T):T=t[15];let D=T,k;t[16]!==n.num_columns||t[17]!==n.num_rows?(k=()=>{let e=[];return n.num_rows!=null&&e.push(`${n.num_rows} rows`),n.num_columns!=null&&e.push(`${n.num_columns} columns`),e.length===0?null:(0,Z.jsx)(`div`,{className:`flex flex-row gap-2 items-center pl-6 group-hover:hidden`,children:(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.join(`, `)})})},t[16]=n.num_columns,t[17]=n.num_rows,t[18]=k):k=t[18];let M=k,N;t[19]!==s||t[20]!==b||t[21]!==_||t[22]!==y||t[23]!==i||t[24]!==n?(N=()=>{let e=$(s??Q.tableLoading);if(y||_)return(0,Z.jsx)(ce,{message:`Loading columns...`,style:e});if(b)return(0,Z.jsx)(le,{error:b,style:e});let t=n.columns;return t.length===0?(0,Z.jsx)(ue,{content:`No columns found`,style:e}):t.map(e=>(0,Z.jsx)(St,{table:n,column:e,sqlTableContext:i,columnIndentRem:s},e.name))},t[19]=s,t[20]=b,t[21]=_,t[22]=y,t[23]=i,t[24]=n,t[25]=N):N=t[25];let P=N,F;t[26]!==u||t[27]!==a||t[28]!==n.source_type||t[29]!==n.type?(F=()=>{if(n.source_type===`local`)return;let e=n.type===`table`?O:te;return(0,Z.jsx)(e,{className:`h-3 w-3`,strokeWidth:u||a?2.5:void 0})},t[26]=u,t[27]=a,t[28]=n.source_type,t[29]=n.type,t[30]=F):F=t[30];let I=F,L;t[31]!==i||t[32]!==n.name?(L=A(i,n.name),t[31]=i,t[32]=n.name,t[33]=L):L=t[33];let R=L,z=o??(i?Q.tableSchemaless:0),ne=(u||a)&&`font-semibold`,B;t[34]===ne?B=t[35]:(B=oe(`rounded-none group h-8 cursor-pointer`,ne),t[34]=ne,t[35]=B);let V;t[36]===z?V=t[37]:(V=$(z),t[36]=z,t[37]=V);let H;t[38]===u?H=t[39]:(H=()=>f(!u),t[38]=u,t[39]=H);let U;t[40]===I?U=t[41]:(U=I(),t[40]=I,t[41]=U);let re;t[42]===n.name?re=t[43]:(re=(0,Z.jsx)(`span`,{className:`text-sm`,children:n.name}),t[42]=n.name,t[43]=re);let ae;t[44]!==U||t[45]!==re?(ae=(0,Z.jsxs)(`div`,{className:`flex gap-2 items-center flex-1 pl-1`,children:[U,re]}),t[44]=U,t[45]=re,t[46]=ae):ae=t[46];let W;t[47]===M?W=t[48]:(W=M(),t[47]=M,t[48]=W);let G;t[49]===D?G=t[50]:(G=ve.stopPropagation(()=>D()),t[49]=D,t[50]=G);let se;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(De,{className:`h-3 w-3`}),t[51]=se):se=t[51];let K;t[52]===G?K=t[53]:(K=(0,Z.jsx)(_e,{content:`Add table to notebook`,delayDuration:400,children:(0,Z.jsx)(ye,{className:`group-hover:inline-flex hidden`,variant:`text`,size:`icon`,onClick:G,children:se})}),t[52]=G,t[53]=K);let q;t[54]!==u||t[55]!==V||t[56]!==H||t[57]!==ae||t[58]!==W||t[59]!==K||t[60]!==B||t[61]!==R?(q=(0,Z.jsxs)(ee,{className:B,style:V,value:R,"aria-selected":u,forceMount:!0,onSelect:H,children:[ae,W,K]}),t[54]=u,t[55]=V,t[56]=H,t[57]=ae,t[58]=W,t[59]=K,t[60]=B,t[61]=R,t[62]=q):q=t[62];let J;t[63]!==u||t[64]!==P?(J=u&&P(),t[63]=u,t[64]=P,t[65]=J):J=t[65];let de;return t[66]!==q||t[67]!==J?(de=(0,Z.jsxs)(Z.Fragment,{children:[q,J]}),t[66]=q,t[67]=J,t[68]=de):de=t[68],de},St=e=>{let t=(0,Y.c)(51),{table:n,column:a,sqlTableContext:o,columnIndentRem:s}=e,[l,u]=X.useState(!1),d=r(y),f=i(U);d&&l&&u(!1),f(l?e=>new Set([...e,`${n.name}:${a.name}`]):e=>(e.delete(`${n.name}:${a.name}`),new Set(e)));let p=We(),{columnsPreviews:m}=c(),h;t[0]!==a.name||t[1]!==n.primary_keys?(h=n.primary_keys?.includes(a.name)||!1,t[0]=a.name,t[1]=n.primary_keys,t[2]=h):h=t[2];let g=h,_;t[3]!==a.name||t[4]!==n.indexes?(_=n.indexes?.includes(a.name)||!1,t[3]=a.name,t[4]=n.indexes,t[5]=_):_=t[5];let v=_,b;t[6]===p?b=t[7]:(b=e=>{p(e)},t[6]=p,t[7]=b);let x=b,S=Ct,C=l?`font-semibold`:``,w;t[8]!==a.name||t[9]!==C?(w=(0,Z.jsx)(`span`,{className:C,children:a.name}),t[8]=a.name,t[9]=C,t[10]=w):w=t[10];let T=w,E=`${n.name}.${a.name}`,D=`${n.name}.${a.name}`,O;t[11]===l?O=t[12]:(O=()=>u(!l),t[11]=l,t[12]=O);let k;t[13]!==s||t[14]!==o?(k=s??(o?ot(0):Q.columnLocal),t[13]=s,t[14]=o,t[15]=k):k=t[15];let A;t[16]===k?A=t[17]:(A=$(k),t[16]=k,t[17]=A);let j;t[18]!==a.type||t[19]!==T?(j=(0,Z.jsx)(q,{columnName:T,dataType:a.type}),t[18]=a.type,t[19]=T,t[20]=j):j=t[20];let M;t[21]===g?M=t[22]:(M=g&&S({tooltipContent:`Primary key`,content:`PK`}),t[21]=g,t[22]=M);let N;t[23]===v?N=t[24]:(N=v&&S({tooltipContent:`Indexed`,content:`IDX`}),t[23]=v,t[24]=N);let P;t[25]!==A||t[26]!==j||t[27]!==M||t[28]!==N?(P=(0,Z.jsxs)(`div`,{className:`flex flex-row gap-2 items-center flex-1`,style:A,children:[j,M,N]}),t[25]=A,t[26]=j,t[27]=M,t[28]=N,t[29]=P):P=t[29];let F;t[30]===a.name?F=t[31]:(F=(0,Z.jsx)(_e,{content:`Copy column name`,delayDuration:400,children:(0,Z.jsx)(ye,{variant:`text`,size:`icon`,className:`group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(ke,{tooltip:!1,value:a.name,className:`h-3 w-3`})})}),t[30]=a.name,t[31]=F);let I;t[32]===a.external_type?I=t[33]:(I=(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a.external_type}),t[32]=a.external_type,t[33]=I);let L;t[34]!==P||t[35]!==F||t[36]!==I||t[37]!==E||t[38]!==D||t[39]!==O?(L=(0,Z.jsxs)(ee,{className:`rounded-none py-1 group cursor-pointer`,value:D,onSelect:O,children:[P,F,I]},E),t[34]=P,t[35]=F,t[36]=I,t[37]=E,t[38]=D,t[39]=O,t[40]=L):L=t[40];let R;t[41]!==a||t[42]!==m||t[43]!==x||t[44]!==l||t[45]!==o||t[46]!==n?(R=l&&(0,Z.jsx)(`div`,{className:`pr-2 py-2 bg-(--slate-1) shadow-inner border-b`,style:$(Q.columnPreview),children:(0,Z.jsx)(G,{children:(0,Z.jsx)(Ee,{table:n,column:a,onAddColumnChart:x,preview:m.get(o?`${o.database}.${o.schema}.${n.name}:${a.name}`:`${n.name}:${a.name}`),sqlTableContext:o})})}),t[41]=a,t[42]=m,t[43]=x,t[44]=l,t[45]=o,t[46]=n,t[47]=R):R=t[47];let z;return t[48]!==L||t[49]!==R?(z=(0,Z.jsxs)(Z.Fragment,{children:[L,R]}),t[48]=L,t[49]=R,t[50]=z):z=t[50],z};function Ct(e){let{tooltipContent:t,content:n}=e;return(0,Z.jsx)(_e,{content:t,delayDuration:100,children:(0,Z.jsx)(`span`,{className:`text-xs text-black bg-gray-100 dark:invert rounded px-1`,children:n})})}function wt(e){return e}var Tt={name:`name`,type:`type-value`,defs:`defs-refs`},Et=[wt({id:Tt.name,accessorFn:e=>[e.name,e.declaredBy],enableSorting:!0,sortingFn:`alphanumeric`,header:({column:e})=>(0,Z.jsx)(he,{header:`Name`,column:e}),cell:({getValue:e})=>{let[t,n]=e();return(0,Z.jsx)(qe,{name:t,declaredBy:n})}}),wt({id:Tt.type,accessorFn:e=>[e.dataType,e.value],enableSorting:!0,sortingFn:`alphanumeric`,header:({column:e})=>(0,Z.jsx)(he,{header:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{children:`Type`}),(0,Z.jsx)(`span`,{children:`Value`})]}),column:e}),cell:({getValue:e})=>{let[t,n]=e();return(0,Z.jsxs)(`div`,{className:`max-w-[150px]`,children:[(0,Z.jsx)(`div`,{className:`text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs`,children:t}),(0,Z.jsx)(`div`,{className:`text-ellipsis overflow-hidden whitespace-nowrap`,title:n??``,children:n})]})}}),wt({id:Tt.defs,accessorFn:e=>[e.declaredBy,e.usedBy,e.name,e.declaredByNames,e.usedByNames],enableSorting:!0,sortingFn:`basic`,header:({column:e})=>(0,Z.jsx)(he,{header:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{children:`Declared By`}),(0,Z.jsx)(`span`,{children:`Used By`})]}),column:e}),cell:({getValue:e})=>{let[t,n,r]=e(),i=e=>{let t=N(e);t&&V(t,r)};return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 py-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-row overflow-auto gap-2 items-center`,children:[(0,Z.jsx)(`span`,{title:`Declared by`,children:(0,Z.jsx)(nt,{className:`w-3.5 h-3.5 text-muted-foreground`})}),t.length===1?(0,Z.jsx)(Fe,{variant:`focus`,cellId:t[0],skipScroll:!0,onClick:()=>i(t[0])}):(0,Z.jsx)(`div`,{className:`text-destructive flex flex-row gap-2`,children:t.slice(0,3).map((e,n)=>(0,Z.jsxs)(`span`,{className:`flex`,children:[(0,Z.jsx)(Fe,{variant:`focus`,cellId:e,skipScroll:!0,className:`whitespace-nowrap text-destructive`,onClick:()=>i(e)},e),n<t.length-1&&`, `]},e))})]}),(0,Z.jsxs)(`div`,{className:`flex flex-row overflow-auto gap-2 items-baseline`,children:[(0,Z.jsx)(`span`,{title:`Used by`,children:(0,Z.jsx)(Oe,{className:`w-3.5 h-3.5 text-muted-foreground`})}),(0,Z.jsx)(Ke,{maxCount:3,cellIds:n,skipScroll:!0,onClick:i})]})]})}})];function Dt({variables:e,sort:t,cellIdToIndex:n}){t||={id:Tt.defs,desc:!1};let r=[];switch(t.id){case Tt.name:r=Ae(e,e=>e.name);break;case Tt.type:r=Ae(e,e=>e.dataType);break;case Tt.defs:r=Ae(e,e=>n.get(e.declaredBy[0]))}return t.desc?r.toReversed():r}var Ot=(0,X.memo)(({className:e,cellIds:t,variables:n})=>{let[r,i]=X.useState([]),[a,o]=X.useState(``),s=S(),{locale:c}=Ne(),l=(0,X.useMemo)(()=>{let e=e=>{let n=s[e];return T(n)?`cell-${t.indexOf(e)}`:n??`cell-${t.indexOf(e)}`};return Object.values(n).map(t=>({...t,declaredByNames:t.declaredBy.map(e),usedByNames:t.usedBy.map(e)}))},[n,s,t]),u=(0,X.useMemo)(()=>{let e=new Map;return t.forEach((t,n)=>e.set(t,n)),Dt({variables:l,sort:r[0],cellIdToIndex:e})},[l,r,t]),d=me({data:u,columns:Et,getCoreRowModel:J(),onGlobalFilterChange:o,getFilteredRowModel:K(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter(e){return e.columnDef.enableGlobalFilter??!0},globalFilterFn:`auto`,manualSorting:!0,locale:c,onSortingChange:i,getSortedRowModel:pe(),state:{sorting:r,globalFilter:a}});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Te,{className:`w-full`,placeholder:`Search`,value:a,onChange:e=>o(e.target.value)}),(0,Z.jsxs)(Ve,{className:oe(`w-full text-sm flex-1 border-separate border-spacing-0`,e),children:[(0,Z.jsx)(Ie,{children:(0,Z.jsx)(ze,{className:`whitespace-nowrap text-xs`,children:d.getFlatHeaders().map(e=>(0,Z.jsx)(Le,{className:`sticky top-0 bg-background border-b`,children:fe(e.column.columnDef.header,e.getContext())},e.id))})}),(0,Z.jsx)(Re,{children:d.getRowModel().rows.map(e=>(0,Z.jsx)(ze,{className:`hover:bg-accent`,children:e.getVisibleCells().map(e=>(0,Z.jsx)(Be,{className:`border-b`,children:fe(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]})]})});Ot.displayName=`VariableTable`;var kt=()=>{let e=(0,Y.c)(30),n=o(),i=b(),a=r(w),s=r(x),c=H(`database`),[l,u]=t(tt),d=a.length+s.length,f;e[0]!==d||e[1]!==l.hasUserInteracted||e[2]!==l.openSections?(f=!l.hasUserInteracted&&d>0?[...new Set([...l.openSections,`datasources`])]:l.openSections,e[0]=d,e[1]=l.hasUserInteracted,e[2]=l.openSections,e[3]=f):f=e[3];let m=f,h;e[4]===u?h=e[5]:(h=e=>{u({openSections:e,hasUserInteracted:!0})},e[4]=u,e[5]=h);let g=h,_;e[6]===m?_=e[7]:(_=m.includes(`datasources`),e[6]=m,e[7]=_);let v=!_&&d>0,y=c.length>0,S;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(xe,{className:`w-4 h-4`}),e[8]=S):S=e[8];let C;e[9]!==d||e[10]!==v?(C=v&&(0,Z.jsx)(Je,{children:d}),e[9]=d,e[10]=v,e[11]=C):C=e[11];let T;e[12]!==c.length||e[13]!==y?(T=y&&(0,Z.jsx)(et,{count:c.length,type:`database`}),e[12]=c.length,e[13]=y,e[14]=T):T=e[14];let E;e[15]!==C||e[16]!==T?(E=(0,Z.jsxs)(Ye,{children:[S,`Data sources`,C,T]}),e[15]=C,e[16]=T,e[17]=E):E=e[17];let D;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(Xe,{children:(0,Z.jsx)(dt,{})}),e[18]=D):D=e[18];let O;e[19]===E?O=e[20]:(O=(0,Z.jsxs)(Qe,{value:`datasources`,children:[E,D]}),e[19]=E,e[20]=O);let k;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsxs)(Ye,{children:[(0,Z.jsx)(p,{className:`w-4 h-4`}),`Variables`]}),e[21]=k):k=e[21];let A;e[22]!==i||e[23]!==n?(A=(0,Z.jsxs)(Qe,{value:`variables`,lastItem:!0,children:[k,(0,Z.jsx)(Xe,{children:Object.keys(n).length===0?(0,Z.jsx)(`div`,{className:`px-3 py-4 text-sm text-muted-foreground`,children:`No variables defined`}):(0,Z.jsx)(Ot,{cellIds:i.inOrderIds,variables:n})})]}),e[22]=i,e[23]=n,e[24]=A):A=e[24];let j;return e[25]!==g||e[26]!==m||e[27]!==A||e[28]!==O?(j=(0,Z.jsxs)(ae,{type:`multiple`,value:m,onValueChange:g,className:`flex flex-col h-full overflow-auto`,children:[O,A]}),e[25]=g,e[26]=m,e[27]=A,e[28]=O,e[29]=j):j=e[29],j};export{kt as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-DVplv7_D.js";import{Cn as n,D as r,Rt as i,_n as a,fn as o,gn as s,mn as c}from"./cells-BRkCaSsh.js";import{t as l}from"./compiler-runtime-BrajqUja.js";import{n as u}from"./useEventListener-D9cftcHj.js";import{r as d}from"./utils-B4K466FK.js";import{t as f}from"./cn-ldLVeaqm.js";import{t as p}from"./jsx-runtime-B74pBk57.js";import{t as m}from"./tooltip-C9TuY18o.js";import{t as h}from"./button-COI-NGrx.js";import{n as g,t as _}from"./LazyAnyLanguageCodeMirror-CKcCbG2G.js";import{r as v}from"./useNumberFormatter-D7O_26UI.js";import{b as y}from"./write-secret-modal-DzKAInL2.js";import{t as b}from"./spinner-DyNE-o8o.js";import{t as x}from"./plus-C5silF6g.js";import{Qt as S,Xt as C,Yt as w,Zt as T,tn as E}from"./input-BoBxR50a.js";import{st as D}from"./dist-Cny7_yZb.js";import{r as O}from"./requests-lt0JK8Jt.js";import{r as k}from"./useTheme-COhSHkCj.js";import{n as A}from"./useAsyncData-C7aJJz0Y.js";import{t as j}from"./RenderHTML-BbOqmHy3.js";import{n as M}from"./error-banner-Cd69vvyX.js";import{n as N,r as P,t as F}from"./react-resizable-panels.browser.esm-Dbe0MrFr.js";import{t as I}from"./empty-state-BaCKb7o3.js";import{n as L,r as R}from"./panel-context-C2QXpKfx.js";import{t as z}from"./readonly-code-display-Do50PHI8.js";import{t as B}from"./kiosk-mode-BZECfg9k.js";var V=e(t(),1),H=l(),U=p(),W=u,G=e=>{let t=(0,H.c)(6),{children:n}=e,{openModal:r,closeModal:i}=y(),a;t[0]!==i||t[1]!==r?(a=()=>r((0,U.jsx)(K,{onClose:i})),t[0]=i,t[1]=r,t[2]=a):a=t[2];let o;return t[3]!==n||t[4]!==a?(o=(0,U.jsx)(W,{onClick:a,children:n}),t[3]=n,t[4]=a,t[5]=o):o=t[5],o},K=e=>{let t=(0,H.c)(4),{onClose:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,U.jsx)(E,{children:`Contribute a Snippet`}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,U.jsxs)(S,{children:[r,(0,U.jsxs)(C,{children:[`Have a useful snippet you want to share with the community? Make a pull request`,` `,(0,U.jsx)(`a`,{href:d.githubPage,target:`_blank`,rel:`noreferrer`,className:`underline`,children:`on GitHub`}),`.`]})]}),t[1]=i):i=t[1];let a;return t[2]===n?a=t[3]:(a=(0,U.jsxs)(w,{className:`max-w-md`,children:[i,(0,U.jsx)(T,{children:(0,U.jsx)(h,{"data-testid":`snippet-close-button`,variant:`default`,onClick:n,children:`Close`})})]}),t[2]=n,t[3]=a),a},q=[D.lineWrapping],J=()=>{let e=(0,H.c)(24),{readSnippets:t}=O(),[n,r]=V.useState(),i=L(),a=R(),l;e[0]===t?l=e[1]:(l=()=>t(),e[0]=t,e[1]=l);let u;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],e[2]=u):u=e[2];let{data:d,error:p,isPending:m}=A(l,u);if(p){let t;return e[3]===p?t=e[4]:(t=(0,U.jsx)(M,{error:p}),e[3]=p,e[4]=t),t}if(m||!d){let t;return e[5]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,U.jsx)(b,{size:`medium`,centered:!0}),e[5]=t):t=e[5],t}let h=i===`vertical`,g;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,U.jsx)(s,{placeholder:`Search snippets...`,className:`h-6 m-1`,rootClassName:`flex-1 border-r`}),e[6]=g):g=e[6];let _,v;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,U.jsxs)(`div`,{className:`flex items-center w-full border-b`,children:[g,(0,U.jsx)(G,{children:(0,U.jsx)(`button`,{className:`float-right px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground`,children:(0,U.jsx)(x,{className:`h-4 w-4`})})})]}),v=(0,U.jsx)(c,{children:`No results`}),e[7]=_,e[8]=v):(_=e[7],v=e[8]);let y;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>r(e),e[9]=y):y=e[9];let S;e[10]===d.snippets?S=e[11]:(S=(0,U.jsx)(F,{defaultSize:40,minSize:20,maxSize:70,children:(0,U.jsxs)(o,{className:`h-full rounded-none`,children:[_,v,(0,U.jsx)(X,{onSelect:y,snippets:d.snippets})]})}),e[10]=d.snippets,e[11]=S);let C=h?`h-1`:`w-1`,w;e[12]===C?w=e[13]:(w=f(`bg-border hover:bg-primary/50 transition-colors`,C),e[12]=C,e[13]=w);let T;e[14]===w?T=e[15]:(T=(0,U.jsx)(P,{className:w}),e[14]=w,e[15]=T);let E;e[16]===n?E=e[17]:(E=(0,U.jsx)(F,{defaultSize:60,minSize:20,children:(0,U.jsx)(V.Suspense,{children:(0,U.jsx)(`div`,{className:`h-full snippet-viewer flex flex-col overflow-hidden`,children:n?(0,U.jsx)(Y,{snippet:n,onClose:()=>r(void 0)},n.title):(0,U.jsx)(I,{title:``,description:`Click on a snippet to view its content.`})})})}),e[16]=n,e[17]=E);let D;return e[18]!==i||e[19]!==a||e[20]!==E||e[21]!==S||e[22]!==T?(D=(0,U.jsx)(`div`,{className:`flex-1 overflow-hidden h-full`,children:(0,U.jsxs)(N,{direction:i,className:`h-full`,children:[S,T,E]},a)}),e[18]=i,e[19]=a,e[20]=E,e[21]=S,e[22]=T,e[23]=D):D=e[23],D},Y=e=>{let t=(0,H.c)(33),{snippet:n,onClose:a}=e,{theme:o}=k(),{createNewCell:s}=r(),c=i(),l;t[0]!==s||t[1]!==c||t[2]!==n.sections?(l=()=>{for(let e of n.sections.toReversed())e.code&&s({code:e.code,before:!1,cellId:c??`__end__`,skipIfCodeExists:!0})},t[0]=s,t[1]=c,t[2]=n.sections,t[3]=l):l=t[3];let u=l,d;t[4]!==s||t[5]!==c?(d=e=>{s({code:e,before:!1,cellId:c??`__end__`})},t[4]=s,t[5]=c,t[6]=d):d=t[6];let f=d,p;t[7]===n.title?p=t[8]:(p=(0,U.jsx)(`span`,{children:n.title}),t[7]=n.title,t[8]=p);let y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,U.jsx)(v,{className:`h-4 w-4`}),t[9]=y):y=t[9];let b;t[10]===a?b=t[11]:(b=(0,U.jsx)(h,{size:`sm`,variant:`ghost`,onClick:a,className:`h-6 w-6 p-0 hover:bg-muted-foreground/10`,children:y}),t[10]=a,t[11]=b);let x;t[12]!==p||t[13]!==b?(x=(0,U.jsxs)(`div`,{className:`text-sm font-semibold bg-muted border-y px-2 py-1 flex justify-between items-center`,children:[p,b]}),t[12]=p,t[13]=b,t[14]=x):x=t[14];let S;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,U.jsx)(g,{className:`ml-2 h-4 w-4`}),t[15]=S):S=t[15];let C;t[16]===u?C=t[17]:(C=(0,U.jsx)(`div`,{className:`flex justify-end`,children:(0,U.jsx)(B,{children:(0,U.jsxs)(h,{className:`float-right`,size:`xs`,variant:`outline`,onClick:u,children:[`Insert snippet`,S]})})}),t[16]=u,t[17]=C);let w;if(t[18]!==f||t[19]!==n.sections||t[20]!==n.title||t[21]!==o){let e;t[23]!==f||t[24]!==n.title||t[25]!==o?(e=e=>{let{code:t,html:r,id:i}=e;if(r)return(0,U.jsx)(`div`,{children:j({html:r})},`${n.title}-${i}`);if(!t)return null;let{language:a,code:s}=z(t);return(0,U.jsxs)(`div`,{className:`relative hover-actions-parent pr-2`,children:[(0,U.jsx)(B,{children:(0,U.jsx)(m,{content:`Insert snippet`,children:(0,U.jsx)(h,{className:`absolute -top-2 -right-1 z-10 hover-action px-2 bg-background`,size:`sm`,variant:`outline`,onClick:()=>{f(t)},children:(0,U.jsx)(g,{className:`h-5 w-5`})})})}),(0,U.jsx)(V.Suspense,{children:(0,U.jsx)(_,{theme:o===`dark`?`dark`:`light`,language:a,className:`cm border rounded overflow-hidden`,extensions:q,value:s,readOnly:!0},`${n.title}-${i}`)})]},`${n.title}-${i}`)},t[23]=f,t[24]=n.title,t[25]=o,t[26]=e):e=t[26],w=n.sections.map(e),t[18]=f,t[19]=n.sections,t[20]=n.title,t[21]=o,t[22]=w}else w=t[22];let T;t[27]!==C||t[28]!==w?(T=(0,U.jsxs)(`div`,{className:`px-2 py-2 space-y-4 overflow-auto flex-1`,children:[C,w]}),t[27]=C,t[28]=w,t[29]=T):T=t[29];let E;return t[30]!==T||t[31]!==x?(E=(0,U.jsxs)(U.Fragment,{children:[x,T]}),t[30]=T,t[31]=x,t[32]=E):E=t[32],E},X=e=>{let t=(0,H.c)(7),{snippets:r,onSelect:i}=e,o;if(t[0]!==i||t[1]!==r){let e;t[3]===i?e=t[4]:(e=e=>(0,U.jsx)(a,{className:`rounded-none`,onSelect:()=>i(e),children:(0,U.jsx)(`div`,{className:`flex flex-row gap-2 items-center`,children:(0,U.jsx)(`span`,{className:`mt-1 text-accent-foreground`,children:e.title})})},e.title),t[3]=i,t[4]=e),o=r.map(e),t[0]=i,t[1]=r,t[2]=o}else o=t[2];let s;return t[5]===o?s=t[6]:(s=(0,U.jsx)(n,{className:`flex flex-col overflow-auto`,children:o}),t[5]=o,t[6]=s),s};export{J as default};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-DVplv7_D.js";import{Cn as n,D as r,Rt as i,_n as a,fn as o,gn as s,mn as c}from"./cells-rA_jsZCj.js";import{t as l}from"./compiler-runtime-BrajqUja.js";import{n as u}from"./useEventListener-D9cftcHj.js";import{r as d}from"./utils-B4K466FK.js";import{t as f}from"./cn-ldLVeaqm.js";import{t as p}from"./jsx-runtime-B74pBk57.js";import{t as m}from"./tooltip-C9TuY18o.js";import{t as h}from"./button-COI-NGrx.js";import{n as g,t as _}from"./LazyAnyLanguageCodeMirror-CKcCbG2G.js";import{r as v}from"./useNumberFormatter-D7O_26UI.js";import{b as y}from"./write-secret-modal-DzKAInL2.js";import{t as b}from"./spinner-DyNE-o8o.js";import{t as x}from"./plus-C5silF6g.js";import{Qt as S,Xt as C,Yt as w,Zt as T,tn as E}from"./input-BoBxR50a.js";import{st as D}from"./dist-Cny7_yZb.js";import{r as O}from"./requests-lt0JK8Jt.js";import{r as k}from"./useTheme-COhSHkCj.js";import{n as A}from"./useAsyncData-C7aJJz0Y.js";import{t as j}from"./RenderHTML-9bMgbYmo.js";import{n as M}from"./error-banner-Cd69vvyX.js";import{n as N,r as P,t as F}from"./react-resizable-panels.browser.esm-Dbe0MrFr.js";import{t as I}from"./empty-state-BaCKb7o3.js";import{n as L,r as R}from"./panel-context-C2QXpKfx.js";import{t as z}from"./readonly-code-display-YULOXf4h.js";import{t as B}from"./kiosk-mode-BZECfg9k.js";var V=e(t(),1),H=l(),U=p(),W=u,G=e=>{let t=(0,H.c)(6),{children:n}=e,{openModal:r,closeModal:i}=y(),a;t[0]!==i||t[1]!==r?(a=()=>r((0,U.jsx)(K,{onClose:i})),t[0]=i,t[1]=r,t[2]=a):a=t[2];let o;return t[3]!==n||t[4]!==a?(o=(0,U.jsx)(W,{onClick:a,children:n}),t[3]=n,t[4]=a,t[5]=o):o=t[5],o},K=e=>{let t=(0,H.c)(4),{onClose:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,U.jsx)(E,{children:`Contribute a Snippet`}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,U.jsxs)(S,{children:[r,(0,U.jsxs)(C,{children:[`Have a useful snippet you want to share with the community? Make a pull request`,` `,(0,U.jsx)(`a`,{href:d.githubPage,target:`_blank`,rel:`noreferrer`,className:`underline`,children:`on GitHub`}),`.`]})]}),t[1]=i):i=t[1];let a;return t[2]===n?a=t[3]:(a=(0,U.jsxs)(w,{className:`max-w-md`,children:[i,(0,U.jsx)(T,{children:(0,U.jsx)(h,{"data-testid":`snippet-close-button`,variant:`default`,onClick:n,children:`Close`})})]}),t[2]=n,t[3]=a),a},q=[D.lineWrapping],J=()=>{let e=(0,H.c)(24),{readSnippets:t}=O(),[n,r]=V.useState(),i=L(),a=R(),l;e[0]===t?l=e[1]:(l=()=>t(),e[0]=t,e[1]=l);let u;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],e[2]=u):u=e[2];let{data:d,error:p,isPending:m}=A(l,u);if(p){let t;return e[3]===p?t=e[4]:(t=(0,U.jsx)(M,{error:p}),e[3]=p,e[4]=t),t}if(m||!d){let t;return e[5]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,U.jsx)(b,{size:`medium`,centered:!0}),e[5]=t):t=e[5],t}let h=i===`vertical`,g;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,U.jsx)(s,{placeholder:`Search snippets...`,className:`h-6 m-1`,rootClassName:`flex-1 border-r`}),e[6]=g):g=e[6];let _,v;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,U.jsxs)(`div`,{className:`flex items-center w-full border-b`,children:[g,(0,U.jsx)(G,{children:(0,U.jsx)(`button`,{className:`float-right px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground`,children:(0,U.jsx)(x,{className:`h-4 w-4`})})})]}),v=(0,U.jsx)(c,{children:`No results`}),e[7]=_,e[8]=v):(_=e[7],v=e[8]);let y;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>r(e),e[9]=y):y=e[9];let S;e[10]===d.snippets?S=e[11]:(S=(0,U.jsx)(F,{defaultSize:40,minSize:20,maxSize:70,children:(0,U.jsxs)(o,{className:`h-full rounded-none`,children:[_,v,(0,U.jsx)(X,{onSelect:y,snippets:d.snippets})]})}),e[10]=d.snippets,e[11]=S);let C=h?`h-1`:`w-1`,w;e[12]===C?w=e[13]:(w=f(`bg-border hover:bg-primary/50 transition-colors`,C),e[12]=C,e[13]=w);let T;e[14]===w?T=e[15]:(T=(0,U.jsx)(P,{className:w}),e[14]=w,e[15]=T);let E;e[16]===n?E=e[17]:(E=(0,U.jsx)(F,{defaultSize:60,minSize:20,children:(0,U.jsx)(V.Suspense,{children:(0,U.jsx)(`div`,{className:`h-full snippet-viewer flex flex-col overflow-hidden`,children:n?(0,U.jsx)(Y,{snippet:n,onClose:()=>r(void 0)},n.title):(0,U.jsx)(I,{title:``,description:`Click on a snippet to view its content.`})})})}),e[16]=n,e[17]=E);let D;return e[18]!==i||e[19]!==a||e[20]!==E||e[21]!==S||e[22]!==T?(D=(0,U.jsx)(`div`,{className:`flex-1 overflow-hidden h-full`,children:(0,U.jsxs)(N,{direction:i,className:`h-full`,children:[S,T,E]},a)}),e[18]=i,e[19]=a,e[20]=E,e[21]=S,e[22]=T,e[23]=D):D=e[23],D},Y=e=>{let t=(0,H.c)(33),{snippet:n,onClose:a}=e,{theme:o}=k(),{createNewCell:s}=r(),c=i(),l;t[0]!==s||t[1]!==c||t[2]!==n.sections?(l=()=>{for(let e of n.sections.toReversed())e.code&&s({code:e.code,before:!1,cellId:c??`__end__`,skipIfCodeExists:!0})},t[0]=s,t[1]=c,t[2]=n.sections,t[3]=l):l=t[3];let u=l,d;t[4]!==s||t[5]!==c?(d=e=>{s({code:e,before:!1,cellId:c??`__end__`})},t[4]=s,t[5]=c,t[6]=d):d=t[6];let f=d,p;t[7]===n.title?p=t[8]:(p=(0,U.jsx)(`span`,{children:n.title}),t[7]=n.title,t[8]=p);let y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,U.jsx)(v,{className:`h-4 w-4`}),t[9]=y):y=t[9];let b;t[10]===a?b=t[11]:(b=(0,U.jsx)(h,{size:`sm`,variant:`ghost`,onClick:a,className:`h-6 w-6 p-0 hover:bg-muted-foreground/10`,children:y}),t[10]=a,t[11]=b);let x;t[12]!==p||t[13]!==b?(x=(0,U.jsxs)(`div`,{className:`text-sm font-semibold bg-muted border-y px-2 py-1 flex justify-between items-center`,children:[p,b]}),t[12]=p,t[13]=b,t[14]=x):x=t[14];let S;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,U.jsx)(g,{className:`ml-2 h-4 w-4`}),t[15]=S):S=t[15];let C;t[16]===u?C=t[17]:(C=(0,U.jsx)(`div`,{className:`flex justify-end`,children:(0,U.jsx)(B,{children:(0,U.jsxs)(h,{className:`float-right`,size:`xs`,variant:`outline`,onClick:u,children:[`Insert snippet`,S]})})}),t[16]=u,t[17]=C);let w;if(t[18]!==f||t[19]!==n.sections||t[20]!==n.title||t[21]!==o){let e;t[23]!==f||t[24]!==n.title||t[25]!==o?(e=e=>{let{code:t,html:r,id:i}=e;if(r)return(0,U.jsx)(`div`,{children:j({html:r})},`${n.title}-${i}`);if(!t)return null;let{language:a,code:s}=z(t);return(0,U.jsxs)(`div`,{className:`relative hover-actions-parent pr-2`,children:[(0,U.jsx)(B,{children:(0,U.jsx)(m,{content:`Insert snippet`,children:(0,U.jsx)(h,{className:`absolute -top-2 -right-1 z-10 hover-action px-2 bg-background`,size:`sm`,variant:`outline`,onClick:()=>{f(t)},children:(0,U.jsx)(g,{className:`h-5 w-5`})})})}),(0,U.jsx)(V.Suspense,{children:(0,U.jsx)(_,{theme:o===`dark`?`dark`:`light`,language:a,className:`cm border rounded overflow-hidden`,extensions:q,value:s,readOnly:!0},`${n.title}-${i}`)})]},`${n.title}-${i}`)},t[23]=f,t[24]=n.title,t[25]=o,t[26]=e):e=t[26],w=n.sections.map(e),t[18]=f,t[19]=n.sections,t[20]=n.title,t[21]=o,t[22]=w}else w=t[22];let T;t[27]!==C||t[28]!==w?(T=(0,U.jsxs)(`div`,{className:`px-2 py-2 space-y-4 overflow-auto flex-1`,children:[C,w]}),t[27]=C,t[28]=w,t[29]=T):T=t[29];let E;return t[30]!==T||t[31]!==x?(E=(0,U.jsxs)(U.Fragment,{children:[x,T]}),t[30]=T,t[31]=x,t[32]=E):E=t[32],E},X=e=>{let t=(0,H.c)(7),{snippets:r,onSelect:i}=e,o;if(t[0]!==i||t[1]!==r){let e;t[3]===i?e=t[4]:(e=e=>(0,U.jsx)(a,{className:`rounded-none`,onSelect:()=>i(e),children:(0,U.jsx)(`div`,{className:`flex flex-row gap-2 items-center`,children:(0,U.jsx)(`span`,{className:`mt-1 text-accent-foreground`,children:e.title})})},e.title),t[3]=i,t[4]=e),o=r.map(e),t[0]=i,t[1]=r,t[2]=o}else o=t[2];let s;return t[5]===o?s=t[6]:(s=(0,U.jsx)(n,{className:`flex flex-col overflow-auto`,children:o}),t[5]=o,t[6]=s),s};export{J as default};
@@ -0,0 +1,3 @@
1
+ import{r as e}from"./useEvent-Dfcbgjhg.js";import{$n as t,La as n,Pa as r,Qn as i,_o as a,oi as o,vo as s,x as c,za as l}from"./cells-rA_jsZCj.js";import{t as u}from"./get-DjNf4SIX.js";import{t as d}from"./debounce-aFmHgJZY.js";import{E as f}from"./config-VPSq73n8.js";import{t as p}from"./_baseSet-Bpdo9AvU.js";import{g as m,v as h}from"./useEventListener-D9cftcHj.js";import{t as g}from"./invariant-Ci2dTZ72.js";import{s as _}from"./config-FzDtjF1-.js";import{d as v,v as y}from"./session-DqoWmb7X.js";import{D as ee,M as b,c as x,l as S,n as te}from"./config-DX8Y2WbJ.js";import{c as ne,o as C}from"./state-C3oDoyFe.js";import{c as w,o as re}from"./markdown-renderer-Q5AhbRU3.js";import{w as ie}from"./write-secret-modal-DzKAInL2.js";import{t as ae}from"./use-toast-Wu434mLr.js";import{t as oe}from"./preload-helper-uBIymjUX.js";import{r as se}from"./strings-B2vv-ENv.js";import{t as T}from"./requests-lt0JK8Jt.js";import{t as ce}from"./Deferred-CrTnjj37.js";import{t as le}from"./uuid-k9DpjH68.js";import{n as ue}from"./RenderHTML-9bMgbYmo.js";import{t as de}from"./useRunCells-BFjFX3hz.js";import{r as fe,t as pe}from"./blob-iOBwGaP9.js";import{f as me}from"./useInstallPackage-iX1eufdl.js";import{n as he,t as ge}from"./share-BZW3tzEX.js";import{i as E,r as _e,t as ve}from"./events-CbeVJ6OD.js";function D(e,t,n){return e==null?e:p(e,t,n)}function O(e,t){if(e.origin===globalThis.origin)return new Worker(e.href,{...t,type:`module`});let n=`import ${JSON.stringify(e.href)}`,r=globalThis.origin===`null`?`data:application/javascript,${encodeURIComponent(n)}`:URL.createObjectURL(new Blob([n],{type:`application/javascript`}));try{return new Worker(r,{...t,type:`module`})}finally{r.startsWith(`blob:`)&&URL.revokeObjectURL(r)}}function k(e){return e.assetUrl,e}var A=class{subscriptions=new Map;addSubscription(e,t){this.subscriptions.has(e)||this.subscriptions.set(e,new Set),this.subscriptions.get(e)?.add(t)}removeSubscription(e,t){this.subscriptions.get(e)?.delete(t)}notify(e,t){for(let n of this.subscriptions.get(e)??[])n(t)}},j=class e{subscriptions=new A;producer;static withProducerCallback(t){return new e(t)}static empty(){return new e}constructor(e){this.producer=e}startProducer(){this.producer&&this.producer(e=>{this.subscriptions.notify(`message`,e)})}connect(){return new Promise(e=>setTimeout(e,0)).then(()=>{this.subscriptions.notify(`open`,new Event(`open`))})}get readyState(){return WebSocket.OPEN}reconnect(e,t){this.close(),this.connect()}close(){this.subscriptions.notify(`close`,new Event(`close`))}send(e){return this.subscriptions.notify(`message`,new MessageEvent(`message`,{data:e})),Promise.resolve()}addEventListener(e,t){this.subscriptions.addSubscription(e,t),e===`open`&&t(new Event(`open`)),e===`message`&&this.startProducer()}removeEventListener(e,t){this.subscriptions.removeSubscription(e,t)}},ye=1e10,be=1e3;function M(e,t){let n=e.map(e=>`"${e}"`).join(`, `);return Error(`This RPC instance cannot ${t} because the transport did not provide one or more of these methods: ${n}`)}function xe(e={}){let t={};function n(e){t=e}let r={};function i(e){r.unregisterHandler&&r.unregisterHandler(),r=e,r.registerHandler?.(x)}let a;function o(e){if(typeof e==`function`){a=e;return}a=(t,n)=>{let r=e[t];if(r)return r(n);let i=e._;if(!i)throw Error(`The requested method has no handler: ${t}`);return i(t,n)}}let{maxRequestTime:s=be}=e;e.transport&&i(e.transport),e.requestHandler&&o(e.requestHandler),e._debugHooks&&n(e._debugHooks);let c=0;function l(){return c<=ye?++c:c=0}let u=new Map,d=new Map;function f(e,...n){let i=n[0];return new Promise((n,a)=>{if(!r.send)throw M([`send`],`make requests`);let o=l(),c={type:`request`,id:o,method:e,params:i};u.set(o,{resolve:n,reject:a}),s!==1/0&&d.set(o,setTimeout(()=>{d.delete(o),a(Error(`RPC request timed out.`))},s)),t.onSend?.(c),r.send(c)})}let p=new Proxy(f,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>f(t,e)}),m=p;function h(e,...n){let i=n[0];if(!r.send)throw M([`send`],`send messages`);let a={type:`message`,id:e,payload:i};t.onSend?.(a),r.send(a)}let g=new Proxy(h,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>h(t,e)}),_=g,v=new Map,y=new Set;function ee(e,t){if(!r.registerHandler)throw M([`registerHandler`],`register message listeners`);if(e===`*`){y.add(t);return}v.has(e)||v.set(e,new Set),v.get(e)?.add(t)}function b(e,t){if(e===`*`){y.delete(t);return}v.get(e)?.delete(t),v.get(e)?.size===0&&v.delete(e)}async function x(e){if(t.onReceive?.(e),!(`type`in e))throw Error(`Message does not contain a type.`);if(e.type===`request`){if(!r.send||!a)throw M([`send`,`requestHandler`],`handle requests`);let{id:n,method:i,params:o}=e,s;try{s={type:`response`,id:n,success:!0,payload:await a(i,o)}}catch(e){if(!(e instanceof Error))throw e;s={type:`response`,id:n,success:!1,error:e.message}}t.onSend?.(s),r.send(s);return}if(e.type===`response`){let t=d.get(e.id);t!=null&&clearTimeout(t);let{resolve:n,reject:r}=u.get(e.id)??{};e.success?n?.(e.payload):r?.(Error(e.error));return}if(e.type===`message`){for(let t of y)t(e.id,e.payload);let t=v.get(e.id);if(!t)return;for(let n of t)n(e.payload);return}throw Error(`Unexpected RPC message type: ${e.type}`)}return{setTransport:i,setRequestHandler:o,request:p,requestProxy:m,send:g,sendProxy:_,addMessageListener:ee,removeMessageListener:b,proxy:{send:_,request:m},_setDebugHooks:n}}function Se(e){return xe(e)}var N=`[transport-id]`;function Ce(e,t){let{transportId:n}=t;return n==null?e:{[N]:n,data:e}}function we(e,t){let{transportId:n,filter:r}=t,i=r?.();if(n!=null&&i!=null)throw Error("Cannot use both `transportId` and `filter` at the same time");let a=e;if(n){if(e[N]!==n)return[!0];a=e.data}return i===!1?[!0]:[!1,a]}function Te(e,t={}){let{transportId:n,filter:r,remotePort:i}=t,a=e,o=i??e,s;return{send(e){o.postMessage(Ce(e,{transportId:n}))},registerHandler(e){s=t=>{let i=t.data,[a,o]=we(i,{transportId:n,filter:()=>r?.(t)});a||e(o)},a.addEventListener(`message`,s)},unregisterHandler(){s&&a.removeEventListener(`message`,s)}}}function Ee(e,t){return Te(e,t)}var De=`::controller`,Oe=`marimo-transport`;function P(e){return Se({transport:Ee(e,{transportId:Oe}),maxRequestTime:2e4,_debugHooks:{onSend:e=>{m.debug(`[rpc] Parent -> Worker`,e)},onReceive:e=>{m.debug(`[rpc] Worker -> Parent`,e)}}})}function F(){let e=document.querySelector(`marimo-wasm`),t=e=>{try{return e?new URL(e,document.baseURI).href:void 0}catch{return}};return{version:ne(),pyodideIndexUrl:t(e?.dataset.pyodideIndexUrl),pyodideLockfileUrl:t(e?.dataset.pyodideLockfileUrl),pypiIndexUrl:t(e?.dataset.pypiIndexUrl)?.replaceAll(`%7Bpackage_name%7D`,`{package_name}`)}}var I=he(),L=`marimo:file`,R=new r(null),ke={saveFile(e){R.set(L,e)},readFile(){return R.get(L)}},Ae={saveFile(e){s.setCodeForHash((0,I.compressToEncodedURIComponent)(e))},readFile(){let e=s.getCodeFromHash()||s.getCodeFromSearchParam();return e?(0,I.decompressFromEncodedURIComponent)(e):null}},je={saveFile(e){},readFile(){let e=document.querySelector(`marimo-code`);return e?decodeURIComponent(e.textContent||``).trim():null}},Me={saveFile(e){},readFile(){if(window.location.hostname!==`marimo.app`)return null;let e=new URL(`export_demos/wasm-intro.py`,document.baseURI);return fetch(e.toString()).then(e=>e.ok?e.text():null).catch(()=>null)}},Ne={saveFile(e){},readFile(){return e.get(n)??null}},Pe={saveFile(e){},readFile(){return[`import marimo`,`app = marimo.App()`,``,`@app.cell`,`def __():`,` return`,``,`if __name__ == "__main__":`,` app.run()`].join(`
2
+ `)}},z=class{stores;constructor(e){this.stores=e}insert(e,t){this.stores.splice(e,0,t)}saveFile(e){this.stores.forEach(t=>t.saveFile(e))}readFile(){for(let e of this.stores){let t=e.readFile();if(t)return t}return null}},B=new z([Ne,je,Ae]),V=new z([ke,Me,Pe]),Fe=new URL(`save-worker-BbUSwZRG.js`,import.meta.url).href,Ie=new URL(`worker-DTQ7oH2A.js`,import.meta.url).href,H=class t{static get INSTANCE(){let e=`_marimo_private_PyodideBridge`;return window[e]||(window[e]=new t),window[e]}rpc;saveRpc;pendingSessionSave=Promise.resolve();interruptBuffer;messageConsumer;initialized=new ce;getSaveWorker(){if(v()===`read`)return m.debug(`Using partially disabled SaveWorker in read-mode`),{readFile:h,readNotebook:async()=>await B.readFile()??``,saveNotebook:h};let e=F(),t=P(O(new URL(Fe,import.meta.url),{name:Re()}));return t.send.bootstrap(e),t.proxy.request}constructor(){if(!b())return;let t=F(),n=O(new URL(Ie,import.meta.url),{name:Re()});this.rpc=P(n),this.rpc.send.bootstrap(t),this.rpc.addMessageListener(`ready`,()=>{this.startSession()}),this.rpc.addMessageListener(`initialized`,()=>{this.saveRpc=this.getSaveWorker(),this.setInterruptBuffer(),e.set(C,{kind:`ready`}),this.initialized.resolve()}),this.rpc.addMessageListener(`initializingMessage`,({message:t})=>{e.get(C).kind===`loading`&&e.set(C,{kind:`loading`,message:t})}),this.rpc.addMessageListener(`initializedError`,({error:t})=>{if(this.initialized.status===`resolved`){m.error(t),ae({title:`Error initializing`,description:t,variant:`danger`});return}e.set(C,{kind:`error`,message:t}),this.initialized.reject(Error(t))}),this.rpc.addMessageListener(`kernelMessage`,({message:e})=>{this.messageConsumer?.(new MessageEvent(`message`,{data:e}))})}async startSession(){let t=await B.readFile(),n=await V.readFile(),r=e.get(l)??s.getFilename(),i=e.get(f),a={},o=new URLSearchParams(window.location.search);for(let e of o.keys()){let t=o.getAll(e);a[e]=t.length===1?t[0]:t}await this.rpc.proxy.request.startSession({queryParameters:a,code:t||n||``,filename:r,userConfig:{...i,runtime:{...i.runtime,auto_instantiate:v()===`read`||i.runtime.auto_instantiate}}})}setInterruptBuffer(){crossOriginIsolated?(this.interruptBuffer=new Uint8Array(new SharedArrayBuffer(1)),this.rpc.proxy.request.setInterruptBuffer(this.interruptBuffer)):m.warn(`Not running in a secure context; interrupts are not available.`)}attachMessageConsumer(e){this.messageConsumer=e,this.rpc.proxy.send.consumerReady({})}sendRename=async({filename:e})=>e===null?null:(s.setFilename(e),await this.rpc.proxy.request.bridge({functionName:`rename_file`,payload:e}),null);sendSave=async e=>{if(!this.saveRpc)return m.warn(`Save RPC not initialized`),null;let t=this.saveRpc.saveNotebook(e);this.pendingSessionSave=this.pendingSessionSave.catch(()=>void 0).then(async()=>{await t,await this.rpc.proxy.request.saveNotebook(e)}),this.pendingSessionSave.catch(e=>{m.error(e)}),await t;let n=await this.readCode();return n.contents&&(B.saveFile(n.contents),V.saveFile(n.contents)),null};sendCopy=async()=>{h()};sendStdin=async e=>(await this.rpc.proxy.request.bridge({functionName:`put_input`,payload:e.text}),null);sendPdb=async()=>{h()};sendSetBreakpoints=async()=>{h()};sendRun=async e=>(await this.rpc.proxy.request.loadPackages(e.codes.join(`
3
+ `)),await this.putControlRequest({type:`execute-cells`,...e}),null);sendRunScratchpad=async e=>(await this.rpc.proxy.request.loadPackages(e.code),await this.putControlRequest({type:`execute-scratchpad`,...e}),null);sendInterrupt=async()=>(this.interruptBuffer!==void 0&&(this.interruptBuffer[0]=2),null);sendShutdown=async()=>(window.close(),null);sendFormat=async e=>await this.rpc.proxy.request.bridge({functionName:`format`,payload:e});sendDeleteCell=async e=>(await this.putControlRequest({type:`delete-cell`,...e}),null);sendInstallMissingPackages=async e=>(this.putControlRequest({type:`install-packages`,...e}),null);sendCodeCompletionRequest=async t=>(e.get(c)||await this.rpc.proxy.request.bridge({functionName:`code_complete`,payload:t}),null);saveUserConfig=async e=>(await this.rpc.proxy.request.bridge({functionName:`save_user_config`,payload:e}),_.post(`/kernel/save_user_config`,e,{baseUrl:`/`}).catch(e=>(m.error(e),null)));saveAppConfig=async e=>(await this.rpc.proxy.request.bridge({functionName:`save_app_config`,payload:e}),null);saveCellConfig=async e=>(await this.putControlRequest({type:`update-cell-config`,...e}),null);sendRestart=async()=>{let e=await this.readCode();return e.contents&&(B.saveFile(e.contents),V.saveFile(e.contents)),me(),null};readCode=async()=>this.saveRpc?{contents:await this.saveRpc.readNotebook()}:(m.warn(`Save RPC not initialized`),{contents:``});readSnippets=async()=>await this.rpc.proxy.request.bridge({functionName:`read_snippets`,payload:void 0});openFile=async({path:e})=>{let t=ge({code:null,baseUrl:window.location.origin});return window.open(t,`_blank`),null};sendListFiles=async e=>await this.rpc.proxy.request.bridge({functionName:`list_files`,payload:e});getFileRoots=async()=>await this.rpc.proxy.request.bridge({functionName:`file_roots`,payload:void 0});sendSearchFiles=async e=>await this.rpc.proxy.request.bridge({functionName:`search_files`,payload:e});sendComponentValues=async e=>(await this.putControlRequest({type:`update-ui-element`,...e,token:le()}),null);sendInstantiate=async e=>null;sendFunctionRequest=async e=>(await this.putControlRequest({type:`invoke-function`,...e}),null);sendCreateFileOrFolder=async e=>{let t=null;return e.file&&(t=(await fe(e.file)).split(`,`)[1]??``),await this.rpc.proxy.request.bridge({functionName:`create_file_or_directory`,payload:{path:e.path,type:e.type,name:e.name,contents:t}})};sendDeleteFileOrFolder=async e=>await this.rpc.proxy.request.bridge({functionName:`delete_file_or_directory`,payload:e});sendCopyFileOrFolder=async e=>await this.rpc.proxy.request.bridge({functionName:`copy_file_or_directory`,payload:e});sendRenameFileOrFolder=async e=>await this.rpc.proxy.request.bridge({functionName:`move_file_or_directory`,payload:e});sendUpdateFile=async e=>await this.rpc.proxy.request.bridge({functionName:`update_file`,payload:e});sendFileDetails=async e=>await this.rpc.proxy.request.bridge({functionName:`file_details`,payload:e});exportAsHTML=async e=>(await this.pendingSessionSave,await this.rpc.proxy.request.bridge({functionName:`export_html`,payload:k(e)}));exportAsMarkdown=async e=>(await this.pendingSessionSave,await this.rpc.proxy.request.bridge({functionName:`export_markdown`,payload:e}));exportAsScript=async e=>(await this.pendingSessionSave,await this.rpc.proxy.request.bridge({functionName:`export_script`,payload:e}));previewDatasetColumn=async e=>(await this.putControlRequest({type:`preview-dataset-column`,...e}),null);previewSQLTable=async e=>(await this.putControlRequest({type:`preview-sql-table`,...e}),null);previewSQLTableList=async e=>(await this.putControlRequest({type:`list-sql-tables`,...e}),null);previewSQLSchemaList=async e=>(await this.putControlRequest({type:`list-sql-schemas`,...e}),null);previewDataSourceConnection=async e=>(await this.putControlRequest({type:`list-data-source-connection`,...e}),null);validateSQL=async e=>(await this.putControlRequest({type:`validate-sql`,...e}),null);sendModelValue=async e=>(await this.putControlRequest({type:`model`,...e}),null);sendDocumentTransaction=()=>Promise.resolve(null);addPackage=async e=>this.rpc.proxy.request.addPackage(e);removePackage=async e=>this.rpc.proxy.request.removePackage(e);getPackageList=async()=>await this.rpc.proxy.request.listPackages();getSandbox=async()=>({backend:null,manifest:null,filename:null});updateManifest=async()=>{throw Error(`Sandboxes are not supported in WebAssembly`)};syncSandbox=async()=>{throw Error(`Sandboxes are not supported in WebAssembly`)};getDependencyTree=async()=>({tree:{dependencies:[],name:``,tags:[],version:null},context:{kind:`package-manager`,name:`micropip`}});listSecretKeys=async e=>(await this.putControlRequest({type:`list-secret-keys`,...e}),null);discoverDataSources=async e=>(await this.putControlRequest({type:`discover-data-sources`,...e}),null);getUsageStats=h;getEnvironmentInfo=async()=>await this.rpc.proxy.request.bridge({functionName:`get_environment_info`,payload:void 0});openTutorial=h;getRecentFiles=h;getWorkspaceFiles=h;getRunningNotebooks=h;shutdownSession=h;getExportAvailability=h;installExportRequirements=h;exportAsIPYNB=h;exportAsPDF=h;autoExportAsHTML=h;autoExportAsMarkdown=h;autoExportAsIPYNB=h;updateCellOutputs=h;writeSecret=h;invokeAiTool=h;clearCache=h;getCacheInfo=h;listStorageEntries=h;downloadStorage=h;async putControlRequest(e){await this.rpc.proxy.request.bridge({functionName:`put_control_request`,payload:e})}};function Le(){return j.withProducerCallback(e=>{H.INSTANCE.attachMessageConsumer(e)})}function Re(){return`marimo${typeof window<`u`&&window.__MARIMO_HAS_WASM_CONTROLLER__===!0?De:``}`}function ze(e=x()){let t=window.fetch;return window.fetch=async(n,r)=>{let i=n instanceof Request?n.url:n.toString();if(i.startsWith(`data:`))return t(n,r);try{let a=W(i,e);if(a){let e=await(await t(a)).arrayBuffer();return new Response(e,{headers:{"Content-Type":Be(i)}})}return t(n,r)}catch(e){return m.error(`Error parsing URL`,e),t(n,r)}},()=>{window.fetch=t}}function Be(e){return e.endsWith(`.csv`)?`text/csv`:e.endsWith(`.json`)?`application/json`:e.endsWith(`.txt`)?`text/plain`:`application/octet-stream`}function Ve(e,t=x()){let n=e.http.bind(e),r=e.load.bind(e);return e.http=async e=>{let r=W(e,t);if(r)return await window.fetch(r).then(e=>e.text());try{return await n(e)}catch(t){if(e.startsWith(`data:`))return await window.fetch(e).then(e=>e.text());throw t}},e.load=async e=>{let n=W(e,t);if(n)return await window.fetch(n).then(e=>e.text());try{return await r(e)}catch(t){if(e.startsWith(`data:`))return await window.fetch(e).then(e=>e.text());throw t}},()=>{e.http=n,e.load=r}}function U(e){return e.startsWith(`.`)?e.slice(1):e}function He(e,t=x()){let n=W(e,t);if(!n)return e;let r=pe(n);return URL.createObjectURL(r)}function W(e,t){let n=document.baseURI;n.startsWith(`blob:`)&&(n=n.replace(`blob:`,``));let r=new URL(e,n).pathname,i=Ue(e),a=Ue(r);return t[e]||t[U(e)]||t[r]||t[U(r)]||i&&t[i]||a&&t[a]}function Ue(e){let t=e.indexOf(`/@file/`);return t===-1?null:e.slice(t)}function G(e,t){return{get(t){return e.get(t)},set(t,n){e.set(t,n)},save_changes(){e.save_changes()},send:e.send.bind(e),on(n,r){t.aborted||(e.on(n,r),t.addEventListener(`abort`,()=>e.off(n,r),{once:!0}))},off(t,n){e.off(t??null,n??null)},widget_manager:{async get_model(n){return G(await e.widget_manager.get_model(n),t)}}}}function K(e){return typeof e==`string`&&e.length>0}function We(e){if(typeof e==`string`&&e.startsWith(`anywidget:`)){let t=e.slice(10);if(K(t))return t}throw Error(`[anywidget] Invalid widget reference: ${JSON.stringify(e)}`)}function Ge(e,t){return{async getModel(n){let r=We(n);return G(await e.getModel(r),t)},async getWidget(n){let r=We(n),i=await e.getWidget(r);return{exports:i.exports,async render({el:e,signal:n}){await i.render({el:e,signal:n??t})}}}}}var Ke=Symbol(`marimo`);function q(e){return e[Ke]}var qe=class e{#e=`change`;#t;#n;#r;#i={};static _modelManager;constructor(e,t,n){this.#n=e,this.#r=t,this.#t=new Set,n&&n.addEventListener(`abort`,()=>{m.debug(`[Model] Signal aborted, clearing all listeners`),this.#i={}})}[Ke]={updateAndEmitDiffs:e=>this.#o(e),emitCustomMessage:(e,t)=>this.#s(e,t)};off(e,t){if(!e){this.#i={};return}if(!t){this.#i[e]=new Set;return}this.#i[e]?.delete(t)}send(e,t,n){let r=(n??[]).map(e=>e instanceof ArrayBuffer?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength));return this.#r.sendCustomMessage(e,r).then(()=>t?.())}widget_manager={async get_model(t){let n=await e._modelManager.getModel(t);if(!n)throw Error(`Model not found with id: ${t}. This is likely because the model was not registered.`);return n}};get(e){return this.#n[e]}set(e,t){this.#n={...this.#n,[e]:t},this.#t.add(e),this.#a(`change:${e}`,t),this.#c()}save_changes(){if(this.#t.size===0)return;let e=Object.fromEntries([...this.#t].map(e=>[e,this.#n[e]]));this.#t.clear(),this.#r.sendUpdate(e)}on(e,t,n){let r=n?.signal;r?.aborted||(this.#i[e]||(this.#i[e]=new Set),this.#i[e].add(t),r?.addEventListener(`abort`,()=>this.off(e,t),{once:!0}))}#a(e,t){let n=this.#i[e];if(n)for(let e of[...n])try{e(t)}catch(e){m.error(`Error emitting event`,e)}}#o(e){e!=null&&Object.keys(e).forEach(t=>{let n=t;this.#t.delete(n),this.#n[n]!==e[n]&&(this.#n={...this.#n,[n]:e[n]},this.#a(`change:${n}`,e[n]),this.#c())})}#s(e,t=[]){let n=this.#i[`msg:custom`];if(n)for(let r of[...n])try{r(e.content,t)}catch(e){m.error(`Error emitting event`,e)}}#c=d(()=>{let e=this.#i[this.#e];if(e)for(let t of[...e])try{t()}catch(e){m.error(`Error emitting event`,e)}},0)};function Je(e){return typeof e==`function`}function Ye(e){return typeof e==`function`}function Xe(e){return t(e)&&(Je(e.render)||Ye(e.initialize))}function Ze(e){return typeof e==`function`||Xe(e)}function Qe(e){return t(e)&&Ze(e.default)}var $e=new Set,et=new WeakMap;function tt(e,n){if(Qe(e))return e.default;if(!t(e)||e.default!==void 0)return null;let r=Je(e.render)?e.render:void 0,i=Ye(e.initialize)?e.initialize:void 0;if(r===void 0&&i===void 0)return null;let a=et.get(e);if(a)return a;$e.has(n)||($e.add(n),m.warn(`Anywidget module at ${n} uses deprecated top-level named exports (\`render\`/\`initialize\`). Per the AFM spec, use a default export instead: \`export default { render }\`. See https://anywidget.dev/en/afm/`));let o={render:r,initialize:i};return et.set(e,o),o}function nt(e,n){let r=`https://anywidget.dev/en/afm/`,a=t(e)&&i(e,`render`),o=t(e)&&i(e,`initialize`);if(t(e)&&e.default!==void 0)return Error(`Anywidget module at ${n} has an invalid default export. Expected a factory function or an object with \`render\` or \`initialize\`. See ${r}`);if(a||o){let e=[a?"`render`":null,o?"`initialize`":null].filter(Boolean).join(` and `),t=[a?`render`:null,o?`initialize`:null].filter(e=>e!==null),i=`export default { ${t.join(`, `)} }`,s=t.length===1?`export function ${t[0]}`:`named export function ...`;return Error(`Anywidget module at ${n} uses named exports (${e}). Per the AFM spec, use a default export instead: \`${i}\` (not \`${s}\`). See ${r}`)}return Error(`Anywidget module at ${n} is missing a default export. Per the AFM spec, use \`export default { render }\` or \`export default async () => ({ render })\`. See ${r}`)}function rt(e){return typeof e!=`string`||e.length===0?!1:!!(/^(\.?\/)?@file\/[^?#]+$/.test(e)||at(e))}function it(){return e.get(de)||ue()}function at(e){return e.startsWith(`data:text/javascript;base64,`)||e.startsWith(`data:application/javascript;base64,`)||e.startsWith(`data:text/css;base64,`)?it():!1}var ot={invoke:async()=>{let e=`anywidget.invoke not supported in marimo. Please file an issue at https://github.com/marimo-team/marimo/issues`;throw m.warn(e),Error(e)}};function st(e){if(typeof AbortSignal.any==`function`)return AbortSignal.any(e);let t=new AbortController;for(let n of e){if(n.aborted)return t.abort(n.reason),t.signal;n.addEventListener(`abort`,()=>t.abort(n.reason),{once:!0})}return t.signal}var ct=class{#e=new Map;getModule(e){let{jsUrl:t,jsHash:n,kernelAuthored:r=!1}=e,i=this.#e.get(n);if(i)return i;let a=this.#t(t,{kernelAuthored:r}).catch(e=>{throw this.#e.delete(n),e});return this.#e.set(n,a),a}invalidate(e){this.#e.delete(e)}async#t(e,t={}){if(!(rt(e)||t.kernelAuthored===!0&&/^(https?:|data:)/.test(e)))throw Error(`Refusing to load anywidget module from untrusted URL: ${String(e)}`);let n=te(e).toString();return S()&&(n=He(n)),oe(()=>import(n),[],import.meta.url)}};function J(e){return typeof e==`function`}async function Y(e,t){try{await e()}catch(e){m.warn(`[WidgetBinding] ${t} cleanup failed`,e)}}var lt=class e{#e;#t;#n;#r;#i;#a=new Set;#o=new Set;constructor(e){this.#t=e.widget,this.#n=e.model,this.#r=e.exports,this.#e=e.controller,this.#i=e.createHost}static async create({widgetDef:t,model:n,createHost:r,controller:i=new AbortController}){let a=i.signal,o=typeof t==`function`?await t():t,s=Promise.resolve(o.initialize?.({model:G(n,a),experimental:ot,signal:a}));s.then(async e=>{a.aborted&&J(e)&&await Y(e,`late initialize`)}).catch(()=>void 0);let c=await Promise.race([s,new Promise((e,t)=>{let n=()=>t(Error(`[anywidget] binding destroyed`));if(a.aborted){n();return}a.addEventListener(`abort`,n,{once:!0})})]);if(a.aborted)throw Error(`[anywidget] binding destroyed`);let l,u;J(c)?(u=c,l=void 0):l=typeof c==`object`&&c?c:void 0;let d=new e({widget:o,model:n,exports:l,controller:i,createHost:r});return u&&a.addEventListener(`abort`,()=>void d.#c(u,`initialize`),{once:!0}),d}get exports(){return this.#r}async createView(e,t){let n=this.#s(e,t);this.#o.add(n);try{await n}finally{this.#o.delete(n)}}async#s(e,t){let n=this.#t;if(!n.render)return;let r=st([t.signal,this.#e.signal]);if(r.aborted)return;e.el.innerHTML=``;let i=this.#i(r),a=await n.render({model:G(this.#n,r),el:e.el,experimental:ot,signal:r,host:i});if(J(a)){let e=()=>{let e=t.signal.aborted?`view unmount`:`binding destroyed`;return m.debug(`[WidgetBinding] Render cleanup triggered (reason: ${e})`),this.#c(a,`render`)};if(r.aborted){await e();return}r.addEventListener(`abort`,()=>void e(),{once:!0})}}#c(e,t){let n=Y(e,t);return this.#a.add(n),n.finally(()=>this.#a.delete(n)),n}async destroy(){for(m.debug(`[WidgetBinding] Destroying binding generation`),this.#e.abort(),await Promise.allSettled(this.#o);this.#a.size>0;)await Promise.all(this.#a)}},ut=new ct,dt=class{#e;#t;#n;#r;#i;#a=new AbortController;#o=new ce;#s=new Set;#c=new Map;#l;#u;#d;#f=Promise.resolve();#p=``;constructor(e,t){this.#e=e,this.#t=t.timeout,this.#n=t.isEditMode,this.#r=t.createHost,this.#i=t.onModelTimeout}getModel(){return this.#o.status===`pending`&&!this.#l&&(this.#l=setTimeout(()=>{this.#o.status===`pending`&&(this.#l=void 0,this.#o.reject(Error(`Model not found for key: ${this.#e}`)),this.#i())},this.#t)),this.#o.promise}getModelSync(){return this.#o.status===`resolved`?this.#o.value:void 0}createModel(e){this.#o.status===`pending`&&this.#m(e(this.#a.signal))}setModel(e){this.#o.status===`pending`&&this.#m(e)}#m(e){this.#l&&=(clearTimeout(this.#l),void 0),this.#o.resolve(e);let t=e.get(`_css`);this.#p=typeof t==`string`?t:``,e.on(`change:_css`,e=>{this.#p=typeof e==`string`?e:``;for(let e of this.#c.values())e.update(this.#p)},{signal:this.#a.signal})}setSpec(e){if(!this.#u){this.#u=e;return}this.#n()&&(this.#u=e,this.#d&&this.#d.hash!==e.hash&&this.#v(e))}async getWidget(){return{exports:(await this.#h()).exports,render:async({el:e,signal:t})=>{await this.createView({el:e,signal:t??this.#a.signal})}}}async createView(e){if(e.signal.aborted||this.#a.signal.aborted)return;let t={el:e.el,signal:e.signal};this.#s.add(t),this.#x(t),e.signal.addEventListener(`abort`,()=>this.#s.delete(t),{once:!0}),await this.#b(t)}async#h(){for(;!this.#a.signal.aborted;){let e=await this.getModel(),t=this.#d;if(!t){let n=this.#u;if(!n)throw Error(`[anywidget] No ESM spec for model ${this.#e}: nothing ever provided this widget's code`);t=this.#_(n,e)}try{let e=await t.promise;if(t===this.#d)return e}catch(e){if(!this.#d||t===this.#d)throw e}}throw Error(`[anywidget] widget runtime destroyed`)}async#g(e){let{spec:t,model:n,controller:r}=e,i=await ut.getModule({jsUrl:t.url,jsHash:t.hash,kernelAuthored:!0}),a=tt(i,t.url);if(!a)throw ut.invalidate(t.hash),nt(i,t.url);return lt.create({widgetDef:a,model:n,createHost:this.#r,controller:r})}#_(e,t){let n=new AbortController,r={hash:e.hash,controller:n,promise:this.#g({spec:e,model:t,controller:n})};return r.promise.catch(()=>{this.#d===r&&(this.#d=void 0)}),this.#d=r,r}#v(e){let t=this.#d;if(!t)return;m.debug(`[WidgetRuntime] Hot-swapping generation for model=${this.#e}`);let n=this.#y(t),r=this.getModelSync();if(!r)return;let i=this.#_(e,r);for(let e of this.#s)e.generation=void 0,n.then(()=>this.#b(e,i)).catch(e=>{m.error(`[WidgetRuntime] Error replacing widget view`,e)})}#y(e){e.controller.abort();let t=this.#f.then(async()=>{try{await(await e.promise).destroy()}catch{}});return this.#f=t,t}async#b(e,t){if(e.signal.aborted||this.#a.signal.aborted)return;let n=t??this.#d,r=n?await n.promise:await this.#h(),i=this.#d;if(!(!i||i!==(n??i))&&e.generation!==i){e.generation=i;try{await r.createView({el:e.el},{signal:e.signal})}catch(t){if(i!==this.#d){e.generation=void 0;return}throw t}}}#x(e){let t=e.el.getRootNode();if(!X(t)&&!ft(t))return;let n=this.#c.get(t);n||(n=pt(t,this.#p),this.#c.set(t,n)),n.references+=1;let r=!1;e.signal.addEventListener(`abort`,()=>{if(r)return;r=!0;let e=this.#c.get(t);e&&(--e.references,e.references===0&&(e.dispose(),this.#c.delete(t)))},{once:!0})}dispose(){if(!this.#a.signal.aborted){m.debug(`[WidgetRuntime] Disposing model=${this.#e}`),this.#l&&=(clearTimeout(this.#l),void 0),this.#o.status===`pending`&&(this.#o.promise.catch(()=>void 0),this.#o.reject(Error(`[anywidget] widget runtime destroyed`))),this.#d&&this.#y(this.#d),this.#a.abort(),this.#s.clear();for(let e of this.#c.values())e.dispose();this.#c.clear()}}};function X(e){return e.nodeType===Node.DOCUMENT_NODE}function ft(e){return e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&`host`in e}function pt(e,t){let n=X(e)?e:e.ownerDocument??document,r=n.defaultView??window;if(`adoptedStyleSheets`in e&&r.CSSStyleSheet!==void 0&&typeof r.CSSStyleSheet.prototype.replaceSync==`function`)try{let n=new r.CSSStyleSheet;return n.replaceSync(t),e.adoptedStyleSheets=[...e.adoptedStyleSheets,n],{references:0,update(e){n.replaceSync(e)},dispose(){e.adoptedStyleSheets=e.adoptedStyleSheets.filter(e=>e!==n)}}}catch{}let i=n.createElement(`style`);return i.textContent=t,X(e)?n.head.append(i):e.append(i),{references:0,update(e){i.textContent=e},dispose(){i.remove()}}}function Z(e,t=[]){let n=[];if(e instanceof DataView)n.push(t);else if(Array.isArray(e))for(let[r,i]of e.entries())n.push(...Z(i,[...t,r]));else if(typeof e==`object`&&e)for(let[r,i]of Object.entries(e))n.push(...Z(i,[...t,r]));return n}function mt(e){let t=Z(e);if(t.length===0)return{state:e,buffers:[],bufferPaths:[]};let n=structuredClone(e),r=[],i=[];for(let a of t){let t=u(e,a);if(t instanceof DataView){let e=w(t);r.push(e),i.push(a),D(n,a,e)}}return{state:n,buffers:r,bufferPaths:i}}function ht(e){let{state:t,bufferPaths:n,buffers:r}=e;if(!n||n.length===0)return t;r&&g(r.length===n.length,`Buffers and buffer paths not the same length`);let i=t;for(let[e,t]of n.entries()){let n=r?.[e];if(n==null){m.warn(`[anywidget] Could not find buffer at path`,t);continue}typeof n==`string`?D(i,t,re(n)):D(i,t,n)}return i}function gt(){let t=e.get(y).mode;return t===`edit`||t===`present`}var Q=new class{#e=new Map;#t;#n;constructor(e=1e4,t=gt){this.#t=e,this.#n=t}#r(e){let t=this.#e.get(e);if(!t){let n=new dt(e,{timeout:this.#t,isEditMode:this.#n,createHost:e=>Ge(this,e),onModelTimeout:()=>{this.#e.get(e)===n&&(n.dispose(),this.#e.delete(e))}});t=n,this.#e.set(e,t)}return t}getModel(e){return this.#r(e).getModel()}getModelSync(e){return this.#e.get(e)?.getModelSync()}createModel(e,t){this.#r(e).createModel(t)}setModel(e,t){this.#r(e).setModel(t)}setSpec(e,t){this.#r(e).setSpec(t)}getWidget(e){return this.#r(e).getWidget()}createView(e){return this.#r(e.modelId).createView(e)}delete(e){let t=this.#e.get(e);t&&(t.dispose(),this.#e.delete(e))}};qe._modelManager=Q;async function _t(e,t){let n=t.model_id;if(!K(n))throw Error(`[anywidget] Invalid model id: ${String(n)}`);let r=t.message,i=(`buffers`in r?r.buffers:[]).map(re);switch(r.method){case`open`:{let{state:t,buffer_paths:a=[]}=r;r.esm_spec&&e.setSpec(n,r.esm_spec);let o=ht({state:t,bufferPaths:a,buffers:i}),s=e.getModelSync(n);if(s){q(s).updateAndEmitDiffs(o);return}e.createModel(n,e=>{let t=S()?{sendUpdate:async()=>void 0,sendCustomMessage:async()=>void 0}:{async sendUpdate(t){if(e.aborted){m.debug(`[Model] sendUpdate suppressed for model=${n} (signal aborted)`);return}let{state:r,buffers:i,bufferPaths:a}=mt(t);await T().sendModelValue({modelId:n,message:{method:`update`,state:r,bufferPaths:a},buffers:i})},async sendCustomMessage(t,r){if(e.aborted){m.debug(`[Model] sendCustomMessage suppressed for model=${n} (signal aborted)`);return}await T().sendModelValue({modelId:n,message:{method:`custom`,content:t},buffers:r.map(w)})}};return new qe(o,t,e)});return}case`custom`:q(await e.getModel(n)).emitCustomMessage({method:`custom`,content:r.content},i);return;case`close`:e.delete(n);return;case`update`:{let{state:t,buffer_paths:a=[]}=r;r.esm_spec&&e.setSpec(n,r.esm_spec);let o=ht({state:t,bufferPaths:a,buffers:i});q(await e.getModel(n)).updateAndEmitDiffs(o);return}default:se(r)}}o(Q,`WIDGET_REGISTRY`);function vt(e){return typeof e!=`object`||!e?!1:`type`in e&&e.type===`marimo-ui-value-update`}var $=class e{entries;static get INSTANCE(){let t=`_marimo_private_UIElementRegistry`;return window[t]||(window[t]=new e),window[t]}constructor(){this.entries=new Map}has(e){return this.entries.has(e)}set(e,t){this.entries.has(e)&&m.debug(`UIElementRegistry overwriting entry for objectId.`,e),this.entries.set(e,{objectId:e,value:t,elements:new Set})}registerInstance(e,t){let n=this.entries.get(e);n===void 0?this.entries.set(e,{objectId:e,value:a(t,this),elements:new Set([t])}):n.elements.add(t)}removeInstance(e,t){let n=this.entries.get(e);n?.elements.has(t)&&n.elements.delete(t)}removeElementsByCell(e){[...this.entries.keys()].filter(t=>t.startsWith(`${e}-`)).forEach(e=>{this.entries.delete(e)})}lookupValue(e){let t=this.entries.get(e);return t===void 0?void 0:t.value}broadcastMessage(e,t,n){let r=this.entries.get(e);if(r===void 0){m.warn(`UIElementRegistry missing entry`,e);return}if(vt(t)){r.value=t.value,r.elements.forEach(e=>{e.dispatchEvent(E.create({bubbles:!1,composed:!0,detail:{value:t.value,element:e}}))});return}r.elements.forEach(r=>{r.dispatchEvent(ve.create({bubbles:!1,composed:!0,detail:{objectId:e,message:t,buffers:n}}))})}broadcastValueUpdate(e,t,n){let r=this.entries.get(t);r===void 0?m.warn(`UIElementRegistry missing entry`,t):(r.value=n,r.elements.forEach(t=>{t!==e&&t.dispatchEvent(E.create({bubbles:!1,composed:!0,detail:{value:n,element:t}}))}),document.dispatchEvent(_e.create({bubbles:!0,composed:!0,detail:{objectId:t}})))}},yt=$.INSTANCE,bt=new ie(`function-call-result`,async(e,t)=>{await T().sendFunctionRequest({functionCallId:e,...t})}),xt=`68px`,St=`288px`,Ct=e=>e?/^\d+$/.test(e)?`${e}px`:e:St,wt=ee({isOpen:!0},(e,t)=>{if(!t)return e;switch(t.type){case`toggle`:return{...e,isOpen:t.isOpen??e.isOpen};case`setWidth`:return{...e,width:t.width};default:return e}});export{A as _,$ as a,_t as c,ze as d,Ve as f,j as g,B as h,bt as i,rt as l,Le as m,Ct as n,yt as o,H as p,wt as r,Q as s,xt as t,K as u,k as v,D as y};
@@ -1 +1 @@
1
- import{f as e}from"./useEvent-Dfcbgjhg.js";import{Qr as t,Zr as n}from"./cells-BRkCaSsh.js";import{g as r}from"./useEventListener-D9cftcHj.js";import{O as i}from"./config-DX8Y2WbJ.js";import{t as a}from"./use-toast-Wu434mLr.js";import{d as o}from"./arrays-BqUx5USx.js";var s=`marimo:ai:chatState:v5`,c=e(null),l=e(null),u=i(`marimo:ai:chatOptions`,{webSearch:!1},t),d=i(`marimo:ai:includeOtherCells`,!0,t);function f(e){let t=new Map;for(let[n,r]of e.entries()){if(r.messages.length===0)continue;let e=o(r.messages,e=>e.id);t.set(n,{...r,messages:e})}return t}var p=n({toSerializable:e=>({chats:[...f(e.chats).entries()],activeChatId:e.activeChatId}),fromSerializable:e=>({chats:new Map(e.chats),activeChatId:e.activeChatId})}),m=i(s,{chats:new Map,activeChatId:null},{...p,setItem:(e,t)=>{try{f(t.chats).size===0?p.removeItem(e):p.setItem(e,t)}catch(e){r.warn(`Could not save chat history`,e),a({id:`chat-storage-error`,once:!0,title:`Chat history couldn't be saved`,description:`Try deleting old chats. New messages may be lost when you reload.`,variant:`danger`})}}}),h=e(e=>{let t=e(m);return t.activeChatId?t.chats.get(t.activeChatId):null},(e,t,n)=>{t(m,e=>({...e,activeChatId:n}))});export{d as a,m as i,c as n,l as o,u as r,h as t};
1
+ import{f as e}from"./useEvent-Dfcbgjhg.js";import{Qr as t,Zr as n}from"./cells-rA_jsZCj.js";import{g as r}from"./useEventListener-D9cftcHj.js";import{O as i}from"./config-DX8Y2WbJ.js";import{t as a}from"./use-toast-Wu434mLr.js";import{d as o}from"./arrays-BqUx5USx.js";var s=`marimo:ai:chatState:v5`,c=e(null),l=e(null),u=i(`marimo:ai:chatOptions`,{webSearch:!1},t),d=i(`marimo:ai:includeOtherCells`,!0,t);function f(e){let t=new Map;for(let[n,r]of e.entries()){if(r.messages.length===0)continue;let e=o(r.messages,e=>e.id);t.set(n,{...r,messages:e})}return t}var p=n({toSerializable:e=>({chats:[...f(e.chats).entries()],activeChatId:e.activeChatId}),fromSerializable:e=>({chats:new Map(e.chats),activeChatId:e.activeChatId})}),m=i(s,{chats:new Map,activeChatId:null},{...p,setItem:(e,t)=>{try{f(t.chats).size===0?p.removeItem(e):p.setItem(e,t)}catch(e){r.warn(`Could not save chat history`,e),a({id:`chat-storage-error`,once:!0,title:`Chat history couldn't be saved`,description:`Try deleting old chats. New messages may be lost when you reload.`,variant:`danger`})}}}),h=e(e=>{let t=e(m);return t.activeChatId?t.chats.get(t.activeChatId):null},(e,t,n)=>{t(m,e=>({...e,activeChatId:n}))});export{d as a,m as i,c as n,l as o,u as r,h as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,l as n,u as r}from"./useEvent-Dfcbgjhg.js";import{t as i}from"./react-DVplv7_D.js";import{M as a,dr as o,oo as s,q as c}from"./cells-BRkCaSsh.js";import{t as l}from"./compiler-runtime-BrajqUja.js";import{t as u}from"./cn-ldLVeaqm.js";import{t as d}from"./jsx-runtime-B74pBk57.js";import{t as f}from"./tooltip-C9TuY18o.js";import{t as p}from"./createLucideIcon-DfJ2oMlA.js";import{o as m}from"./paths-bkIFVj8h.js";import{a as h}from"./useNumberFormatter-D7O_26UI.js";import{t as g}from"./chevron-right-eAtVhbNZ.js";import{t as _}from"./circle-check-BCurAHEb.js";import{t as v}from"./circle-play-CYIb0qT6.js";import{r as y}from"./useTheme-COhSHkCj.js";import{n as b}from"./CellStatus-BP2mavAq.js";import{r as x,t as S}from"./react-vega-C3rYGtP6.js";import{t as C}from"./cell-link-LSth_8hT.js";import{n as w,r as T,t as E}from"./react-resizable-panels.browser.esm-Dbe0MrFr.js";import{t as D}from"./bundle.esm-D3tw5rqW.js";import{t as O}from"./empty-state-BaCKb7o3.js";import{r as k}from"./panel-context-C2QXpKfx.js";import{t as A}from"./clear-button-p6YcvzLy.js";import{n as j,t as M}from"./runs-BLp5jezv.js";var N=p(`circle-ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M17 12h.01`,key:`1m0b6t`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M7 12h.01`,key:`eqddd0`}]]),P=e(i(),1),F=l(),I=`hoveredCellId`,L=`cellHover`,R=`cellNum`,z=`cell`,B=`startTimestamp`,V=`endTimestamp`,H=`status`;function U(e,t,n,r){let i=`hoursminutessecondsmilliseconds`;return{$schema:`https://vega.github.io/schema/vega-lite/v6.json`,background:r===`dark`?`black`:void 0,mark:{type:`bar`,cornerRadius:2},params:[{name:I,bind:{element:`#${t}`}},{name:L,select:{type:`point`,on:`mouseover`,fields:[z],clear:`mouseout`}}],height:{step:n===`sideBySide`?26:21},encoding:{y:{field:R,scale:{paddingInner:.2},sort:{field:`sortPriority`},title:`cell`,axis:n===`sideBySide`?null:void 0},x:{field:B,type:`temporal`,axis:{orient:`top`,title:null}},x2:{field:V,type:`temporal`},tooltip:[{field:B,type:`temporal`,timeUnit:i,title:`Start`},{field:V,type:`temporal`,timeUnit:i,title:`End`}],size:{value:{expr:`${I} == toString(datum.${z}) ? 19.5 : 18`}},color:{field:H,scale:{domain:[`success`,`error`],range:[`#37BE5F`,`red`]},legend:null}},data:{values:e},transform:[{calculate:`datum.${H} === 'queued' ? 9999999999999 : datum.${B}`,as:`sortPriority`}],config:{view:{stroke:`transparent`}}}}function W(e){try{let t=new Date(e*1e3);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}.${String(t.getMilliseconds()).padStart(3,`0`)}`}catch{return``}}var G=d(),K=t(new Map),q=()=>{let e=(0,F.c)(34),{runIds:t,runMap:r}=n(M),i=n(K),{clearRuns:a}=j(),{theme:o}=y(),[s,c]=(0,P.useState)(`above`),l=k(),u;e[0]===s?u=e[1]:(u=()=>{c(s===`above`?`sideBySide`:`above`)},e[0]=s,e[1]=u);let d=u;if(t.length===0){let t;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(O,{title:`No traces`,description:(0,G.jsx)(`span`,{children:`Cells that have ran will appear here.`}),icon:(0,G.jsx)(m,{})}),e[2]=t):t=e[2],t}let f;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,G.jsx)(`label`,{htmlFor:`chartPosition`,className:`text-xs`,children:`Inline chart`}),e[3]=f):f=e[3];let p=s===`sideBySide`,h;e[4]!==p||e[5]!==d?(h=(0,G.jsxs)(`div`,{className:`flex flex-row gap-1 items-center`,children:[f,(0,G.jsx)(`input`,{type:`checkbox`,name:`chartPosition`,"data-testid":`chartPosition`,onClick:d,defaultChecked:p,className:`h-3 cursor-pointer`})]}),e[4]=p,e[5]=d,e[6]=h):h=e[6];let g;e[7]===a?g=e[8]:(g=(0,G.jsx)(A,{dataTestId:`clear-traces-button`,onClick:a}),e[7]=a,e[8]=g);let _;e[9]!==h||e[10]!==g?(_=(0,G.jsxs)(`div`,{className:`flex flex-row justify-start gap-3`,children:[h,g]}),e[9]=h,e[10]=g,e[11]=_):_=e[11];let v;if(e[12]!==s||e[13]!==i||e[14]!==t||e[15]!==r||e[16]!==o){let n;e[18]!==s||e[19]!==i||e[20]!==r||e[21]!==o?(n=(e,t)=>{let n=r.get(e);return n?(0,G.jsx)(J,{run:n,isExpanded:i.get(n.runId),isMostRecentRun:t===0,chartPosition:s,theme:o},n.runId):null},e[18]=s,e[19]=i,e[20]=r,e[21]=o,e[22]=n):n=e[22],v=t.map(n),e[12]=s,e[13]=i,e[14]=t,e[15]=r,e[16]=o,e[17]=v}else v=e[17];let b;e[23]===v?b=e[24]:(b=(0,G.jsx)(`div`,{className:`flex flex-col gap-3`,children:v}),e[23]=v,e[24]=b);let x;e[25]!==_||e[26]!==b?(x=(0,G.jsxs)(`div`,{className:`py-1 px-2 overflow-y-scroll h-full`,children:[_,b]}),e[25]=_,e[26]=b,e[27]=x):x=e[27];let S=x;if(l===`sidebar`)return S;let C;e[28]===S?C=e[29]:(C=(0,G.jsx)(E,{defaultSize:50,minSize:30,maxSize:80,children:S}),e[28]=S,e[29]=C);let D;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,G.jsx)(T,{className:`w-1 bg-border hover:bg-primary/50 transition-colors`}),e[30]=D):D=e[30];let N;e[31]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,G.jsx)(E,{defaultSize:50,children:(0,G.jsx)(`div`,{})}),e[31]=N):N=e[31];let I;return e[32]===C?I=e[33]:(I=(0,G.jsxs)(w,{direction:`horizontal`,className:`h-full`,children:[C,D,N]}),e[32]=C,e[33]=I),I},J=e=>{let t=(0,F.c)(22),{run:n,isMostRecentRun:i,chartPosition:a,isExpanded:o,theme:s}=e,l=o,u=r(K);l??=i;let d;t[0]!==l||t[1]!==n.runId||t[2]!==u?(d=()=>{u(e=>{let t=new Map(e);return t.set(n.runId,!l),t})},t[0]=l,t[1]=n.runId,t[2]=u,t[3]=d):d=t[3];let f=d,p=l?h:g,m;t[4]===p?m=t[5]:(m=(0,G.jsx)(p,{height:16,className:`inline`}),t[4]=p,t[5]=m);let _=m,v;t[6]===n.runStartTime?v=t[7]:(v=c(n.runStartTime),t[6]=n.runStartTime,t[7]=v);let y;t[8]!==_||t[9]!==f||t[10]!==v?(y=(0,G.jsxs)(`span`,{className:`text-sm cursor-pointer`,onClick:f,children:[`Run - `,v,_]}),t[8]=_,t[9]=f,t[10]=v,t[11]=y):y=t[11];let b=y;if(!l){let e;t[12]===b?e=t[13]:(e=(0,G.jsx)(`pre`,{className:`font-mono font-semibold`,children:b}),t[12]=b,t[13]=e);let r;return t[14]!==n.runId||t[15]!==e?(r=(0,G.jsx)(`div`,{className:`flex flex-col`,children:e},n.runId),t[14]=n.runId,t[15]=e,t[16]=r):r=t[16],r}let x;return t[17]!==a||t[18]!==n||t[19]!==s||t[20]!==b?(x=(0,G.jsx)(Y,{run:n,chartPosition:a,theme:s,title:b},n.runId),t[17]=a,t[18]=n,t[19]=s,t[20]=b,t[21]=x):x=t[21],x},Y=e=>{let t=(0,F.c)(40),{run:n,chartPosition:r,theme:i,title:s}=e,[c,l]=(0,P.useState)(),u=(0,P.useRef)(null),{ref:d,width:f}=D(),p=f===void 0?300:f,m=a(),h,g;if(t[0]!==m||t[1]!==r||t[2]!==n.cellRuns||t[3]!==n.runId||t[4]!==i){let e=[...n.cellRuns.values()].map(e=>{let t=e.elapsedTime??0;return{cell:e.cellId,cellNum:m.inOrderIds.indexOf(e.cellId),startTimestamp:W(e.startTime),endTimestamp:W(e.startTime+t),elapsedTime:o(t*1e3),status:e.status}});h=`hiddenInputElement-${n.runId}`,g=x(U(e,h,r,i)),t[0]=m,t[1]=r,t[2]=n.cellRuns,t[3]=n.runId,t[4]=i,t[5]=h,t[6]=g}else h=t[5],g=t[6];let _=g.spec,v=i===`dark`?`dark`:void 0,y=p-50,b=r===`above`?120:100,C;t[7]!==v||t[8]!==y||t[9]!==b?(C={theme:v,width:y,height:b,actions:!1,mode:`vega`,renderer:`canvas`},t[7]=v,t[8]=y,t[9]=b,t[10]=C):C=t[10];let w;t[11]!==C||t[12]!==_?(w={ref:u,spec:_,options:C},t[11]=C,t[12]=_,t[13]=w):w=t[13];let T=S(w),E;t[14]===T?.view?E=t[15]:(E=()=>{let e=[{signalName:L,handler:(e,t)=>{let n=t.cell?.[0]??void 0;l(n??null)}}];return e.forEach(e=>{let{signalName:t,handler:n}=e;T?.view.addSignalListener(t,n)}),()=>{e.forEach(e=>{let{signalName:t,handler:n}=e;T?.view.removeSignalListener(t,n)})}},t[14]=T?.view,t[15]=E);let O;t[16]===T?O=t[17]:(O=[T],t[16]=T,t[17]=O),(0,P.useEffect)(E,O);let k;t[18]!==h||t[19]!==c||t[20]!==n?(k=(0,G.jsx)(X,{run:n,hoveredCellId:c,hiddenInputElementId:h}),t[18]=h,t[19]=c,t[20]=n,t[21]=k):k=t[21];let A=k,j=r===`sideBySide`?`-mt-0.5 flex-1`:``,M;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,G.jsx)(P.Suspense,{children:(0,G.jsx)(`div`,{ref:u})}),t[22]=M):M=t[22];let N;t[23]!==d||t[24]!==j?(N=(0,G.jsx)(`div`,{className:j,ref:d,children:M}),t[23]=d,t[24]=j,t[25]=N):N=t[25];let I=N;if(r===`above`){let e;t[26]!==I||t[27]!==s||t[28]!==A?(e=(0,G.jsxs)(`pre`,{className:`font-mono font-semibold`,children:[s,I,A]}),t[26]=I,t[27]=s,t[28]=A,t[29]=e):e=t[29];let r;return t[30]!==n.runId||t[31]!==e?(r=(0,G.jsx)(`div`,{className:`flex flex-col`,children:e},n.runId),t[30]=n.runId,t[31]=e,t[32]=r):r=t[32],r}let R;t[33]!==s||t[34]!==A?(R=(0,G.jsxs)(`pre`,{className:`font-mono font-semibold`,children:[s,A]}),t[33]=s,t[34]=A,t[35]=R):R=t[35];let z;return t[36]!==I||t[37]!==n.runId||t[38]!==R?(z=(0,G.jsxs)(`div`,{className:`flex flex-row`,children:[R,I]},n.runId),t[36]=I,t[37]=n.runId,t[38]=R,t[39]=z):z=t[39],z},X=e=>{let t=(0,F.c)(12),{run:n,hoveredCellId:r,hiddenInputElementId:i}=e,a=(0,P.useRef)(null),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{a.current&&(a.current.value=String(e),a.current.dispatchEvent(new Event(`input`,{bubbles:!0})))},t[0]=o):o=t[0];let s=o,c=r||``,l;t[1]!==i||t[2]!==c?(l=(0,G.jsx)(`input`,{type:`text`,id:i,defaultValue:c,hidden:!0,ref:a}),t[1]=i,t[2]=c,t[3]=l):l=t[3];let u;t[4]===n.cellRuns?u=t[5]:(u=[...n.cellRuns.values()],t[4]=n.cellRuns,t[5]=u);let d;t[6]!==r||t[7]!==u?(d=u.map(e=>(0,G.jsx)(Q,{cellRun:e,hovered:e.cellId===r,dispatchHoverEvent:s},e.cellId)),t[6]=r,t[7]=u,t[8]=d):d=t[8];let f;return t[9]!==l||t[10]!==d?(f=(0,G.jsxs)(`div`,{className:`text-xs mt-0.5 ml-3 flex flex-col gap-0.5`,children:[l,d]}),t[9]=l,t[10]=d,t[11]=f):f=t[11],f},Z={success:(0,G.jsx)(_,{color:`green`,size:14}),running:(0,G.jsx)(v,{color:`var(--blue-10)`,size:14}),error:(0,G.jsx)(s,{color:`red`,size:14}),queued:(0,G.jsx)(N,{color:`grey`,size:14})},Q=e=>{let t=(0,F.c)(39),{cellRun:n,hovered:r,dispatchHoverEvent:i}=e,a;t[0]===n.elapsedTime?a=t[1]:(a=n.elapsedTime?o(n.elapsedTime*1e3):`-`,t[0]=n.elapsedTime,t[1]=a);let s=a,l;t[2]!==n.elapsedTime||t[3]!==s?(l=n.elapsedTime?(0,G.jsxs)(`span`,{children:[`This cell took `,(0,G.jsx)(b,{elapsedTime:s}),` to run`]}):(0,G.jsx)(`span`,{children:`This cell has not been run`}),t[2]=n.elapsedTime,t[3]=s,t[4]=l):l=t[4];let d=l,p;t[5]!==n.cellId||t[6]!==i?(p=()=>{i(n.cellId)},t[5]=n.cellId,t[6]=i,t[7]=p):p=t[7];let m=p,h;t[8]===i?h=t[9]:(h=()=>{i(null)},t[8]=i,t[9]=h);let g=h,_=r&&`bg-(--gray-3) opacity-100`,v;t[10]===_?v=t[11]:(v=u(`flex flex-row gap-2 py-1 px-1 opacity-70 hover:bg-(--gray-3) hover:opacity-100`,_),t[10]=_,t[11]=v);let y;t[12]===n.startTime?y=t[13]:(y=c(n.startTime),t[12]=n.startTime,t[13]=y);let x;t[14]===y?x=t[15]:(x=(0,G.jsxs)(`span`,{className:`text-(--gray-10) dark:text-(--gray-11)`,children:[`[`,y,`]`]}),t[14]=y,t[15]=x);let S;t[16]===n.cellId?S=t[17]:(S=(0,G.jsxs)(`span`,{className:`text-(--gray-10) w-16 overflow-hidden`,children:[`(`,(0,G.jsx)(C,{cellId:n.cellId}),`)`]}),t[16]=n.cellId,t[17]=S);let w;t[18]===n.code?w=t[19]:(w=(0,G.jsx)(`span`,{className:`w-40 truncate -ml-1`,children:n.code}),t[18]=n.code,t[19]=w);let T;t[20]===s?T=t[21]:(T=(0,G.jsx)(`span`,{className:`text-(--gray-10) dark:text-(--gray-11)`,children:s}),t[20]=s,t[21]=T);let E;t[22]!==d||t[23]!==T?(E=(0,G.jsx)(f,{content:d,children:T}),t[22]=d,t[23]=T,t[24]=E):E=t[24];let D=Z[n.status],O;t[25]!==n.status||t[26]!==D?(O=(0,G.jsx)(f,{content:n.status,children:D}),t[25]=n.status,t[26]=D,t[27]=O):O=t[27];let k;t[28]!==E||t[29]!==O?(k=(0,G.jsxs)(`div`,{className:`flex flex-row gap-1 w-16 justify-end -ml-2`,children:[E,O]}),t[28]=E,t[29]=O,t[30]=k):k=t[30];let A;return t[31]!==m||t[32]!==g||t[33]!==w||t[34]!==k||t[35]!==v||t[36]!==x||t[37]!==S?(A=(0,G.jsxs)(`div`,{className:v,onMouseEnter:m,onMouseLeave:g,children:[x,S,w,k]}),t[31]=m,t[32]=g,t[33]=w,t[34]=k,t[35]=v,t[36]=x,t[37]=S,t[38]=A):A=t[38],A};export{q as Tracing};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,l as n,u as r}from"./useEvent-Dfcbgjhg.js";import{t as i}from"./react-DVplv7_D.js";import{M as a,dr as o,oo as s,q as c}from"./cells-rA_jsZCj.js";import{t as l}from"./compiler-runtime-BrajqUja.js";import{t as u}from"./cn-ldLVeaqm.js";import{t as d}from"./jsx-runtime-B74pBk57.js";import{t as f}from"./tooltip-C9TuY18o.js";import{t as p}from"./createLucideIcon-DfJ2oMlA.js";import{o as m}from"./paths-bkIFVj8h.js";import{a as h}from"./useNumberFormatter-D7O_26UI.js";import{t as g}from"./chevron-right-eAtVhbNZ.js";import{t as _}from"./circle-check-BCurAHEb.js";import{t as v}from"./circle-play-CYIb0qT6.js";import{r as y}from"./useTheme-COhSHkCj.js";import{n as b}from"./CellStatus-nZpuDkm7.js";import{r as x,t as S}from"./react-vega-C3rYGtP6.js";import{t as C}from"./cell-link-1CynTVGQ.js";import{n as w,r as T,t as E}from"./react-resizable-panels.browser.esm-Dbe0MrFr.js";import{t as D}from"./bundle.esm-D3tw5rqW.js";import{t as O}from"./empty-state-BaCKb7o3.js";import{r as k}from"./panel-context-C2QXpKfx.js";import{t as A}from"./clear-button-p6YcvzLy.js";import{n as j,t as M}from"./runs-BLp5jezv.js";var N=p(`circle-ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M17 12h.01`,key:`1m0b6t`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M7 12h.01`,key:`eqddd0`}]]),P=e(i(),1),F=l(),I=`hoveredCellId`,L=`cellHover`,R=`cellNum`,z=`cell`,B=`startTimestamp`,V=`endTimestamp`,H=`status`;function U(e,t,n,r){let i=`hoursminutessecondsmilliseconds`;return{$schema:`https://vega.github.io/schema/vega-lite/v6.json`,background:r===`dark`?`black`:void 0,mark:{type:`bar`,cornerRadius:2},params:[{name:I,bind:{element:`#${t}`}},{name:L,select:{type:`point`,on:`mouseover`,fields:[z],clear:`mouseout`}}],height:{step:n===`sideBySide`?26:21},encoding:{y:{field:R,scale:{paddingInner:.2},sort:{field:`sortPriority`},title:`cell`,axis:n===`sideBySide`?null:void 0},x:{field:B,type:`temporal`,axis:{orient:`top`,title:null}},x2:{field:V,type:`temporal`},tooltip:[{field:B,type:`temporal`,timeUnit:i,title:`Start`},{field:V,type:`temporal`,timeUnit:i,title:`End`}],size:{value:{expr:`${I} == toString(datum.${z}) ? 19.5 : 18`}},color:{field:H,scale:{domain:[`success`,`error`],range:[`#37BE5F`,`red`]},legend:null}},data:{values:e},transform:[{calculate:`datum.${H} === 'queued' ? 9999999999999 : datum.${B}`,as:`sortPriority`}],config:{view:{stroke:`transparent`}}}}function W(e){try{let t=new Date(e*1e3);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}.${String(t.getMilliseconds()).padStart(3,`0`)}`}catch{return``}}var G=d(),K=t(new Map),q=()=>{let e=(0,F.c)(34),{runIds:t,runMap:r}=n(M),i=n(K),{clearRuns:a}=j(),{theme:o}=y(),[s,c]=(0,P.useState)(`above`),l=k(),u;e[0]===s?u=e[1]:(u=()=>{c(s===`above`?`sideBySide`:`above`)},e[0]=s,e[1]=u);let d=u;if(t.length===0){let t;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(O,{title:`No traces`,description:(0,G.jsx)(`span`,{children:`Cells that have ran will appear here.`}),icon:(0,G.jsx)(m,{})}),e[2]=t):t=e[2],t}let f;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,G.jsx)(`label`,{htmlFor:`chartPosition`,className:`text-xs`,children:`Inline chart`}),e[3]=f):f=e[3];let p=s===`sideBySide`,h;e[4]!==p||e[5]!==d?(h=(0,G.jsxs)(`div`,{className:`flex flex-row gap-1 items-center`,children:[f,(0,G.jsx)(`input`,{type:`checkbox`,name:`chartPosition`,"data-testid":`chartPosition`,onClick:d,defaultChecked:p,className:`h-3 cursor-pointer`})]}),e[4]=p,e[5]=d,e[6]=h):h=e[6];let g;e[7]===a?g=e[8]:(g=(0,G.jsx)(A,{dataTestId:`clear-traces-button`,onClick:a}),e[7]=a,e[8]=g);let _;e[9]!==h||e[10]!==g?(_=(0,G.jsxs)(`div`,{className:`flex flex-row justify-start gap-3`,children:[h,g]}),e[9]=h,e[10]=g,e[11]=_):_=e[11];let v;if(e[12]!==s||e[13]!==i||e[14]!==t||e[15]!==r||e[16]!==o){let n;e[18]!==s||e[19]!==i||e[20]!==r||e[21]!==o?(n=(e,t)=>{let n=r.get(e);return n?(0,G.jsx)(J,{run:n,isExpanded:i.get(n.runId),isMostRecentRun:t===0,chartPosition:s,theme:o},n.runId):null},e[18]=s,e[19]=i,e[20]=r,e[21]=o,e[22]=n):n=e[22],v=t.map(n),e[12]=s,e[13]=i,e[14]=t,e[15]=r,e[16]=o,e[17]=v}else v=e[17];let b;e[23]===v?b=e[24]:(b=(0,G.jsx)(`div`,{className:`flex flex-col gap-3`,children:v}),e[23]=v,e[24]=b);let x;e[25]!==_||e[26]!==b?(x=(0,G.jsxs)(`div`,{className:`py-1 px-2 overflow-y-scroll h-full`,children:[_,b]}),e[25]=_,e[26]=b,e[27]=x):x=e[27];let S=x;if(l===`sidebar`)return S;let C;e[28]===S?C=e[29]:(C=(0,G.jsx)(E,{defaultSize:50,minSize:30,maxSize:80,children:S}),e[28]=S,e[29]=C);let D;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,G.jsx)(T,{className:`w-1 bg-border hover:bg-primary/50 transition-colors`}),e[30]=D):D=e[30];let N;e[31]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,G.jsx)(E,{defaultSize:50,children:(0,G.jsx)(`div`,{})}),e[31]=N):N=e[31];let I;return e[32]===C?I=e[33]:(I=(0,G.jsxs)(w,{direction:`horizontal`,className:`h-full`,children:[C,D,N]}),e[32]=C,e[33]=I),I},J=e=>{let t=(0,F.c)(22),{run:n,isMostRecentRun:i,chartPosition:a,isExpanded:o,theme:s}=e,l=o,u=r(K);l??=i;let d;t[0]!==l||t[1]!==n.runId||t[2]!==u?(d=()=>{u(e=>{let t=new Map(e);return t.set(n.runId,!l),t})},t[0]=l,t[1]=n.runId,t[2]=u,t[3]=d):d=t[3];let f=d,p=l?h:g,m;t[4]===p?m=t[5]:(m=(0,G.jsx)(p,{height:16,className:`inline`}),t[4]=p,t[5]=m);let _=m,v;t[6]===n.runStartTime?v=t[7]:(v=c(n.runStartTime),t[6]=n.runStartTime,t[7]=v);let y;t[8]!==_||t[9]!==f||t[10]!==v?(y=(0,G.jsxs)(`span`,{className:`text-sm cursor-pointer`,onClick:f,children:[`Run - `,v,_]}),t[8]=_,t[9]=f,t[10]=v,t[11]=y):y=t[11];let b=y;if(!l){let e;t[12]===b?e=t[13]:(e=(0,G.jsx)(`pre`,{className:`font-mono font-semibold`,children:b}),t[12]=b,t[13]=e);let r;return t[14]!==n.runId||t[15]!==e?(r=(0,G.jsx)(`div`,{className:`flex flex-col`,children:e},n.runId),t[14]=n.runId,t[15]=e,t[16]=r):r=t[16],r}let x;return t[17]!==a||t[18]!==n||t[19]!==s||t[20]!==b?(x=(0,G.jsx)(Y,{run:n,chartPosition:a,theme:s,title:b},n.runId),t[17]=a,t[18]=n,t[19]=s,t[20]=b,t[21]=x):x=t[21],x},Y=e=>{let t=(0,F.c)(40),{run:n,chartPosition:r,theme:i,title:s}=e,[c,l]=(0,P.useState)(),u=(0,P.useRef)(null),{ref:d,width:f}=D(),p=f===void 0?300:f,m=a(),h,g;if(t[0]!==m||t[1]!==r||t[2]!==n.cellRuns||t[3]!==n.runId||t[4]!==i){let e=[...n.cellRuns.values()].map(e=>{let t=e.elapsedTime??0;return{cell:e.cellId,cellNum:m.inOrderIds.indexOf(e.cellId),startTimestamp:W(e.startTime),endTimestamp:W(e.startTime+t),elapsedTime:o(t*1e3),status:e.status}});h=`hiddenInputElement-${n.runId}`,g=x(U(e,h,r,i)),t[0]=m,t[1]=r,t[2]=n.cellRuns,t[3]=n.runId,t[4]=i,t[5]=h,t[6]=g}else h=t[5],g=t[6];let _=g.spec,v=i===`dark`?`dark`:void 0,y=p-50,b=r===`above`?120:100,C;t[7]!==v||t[8]!==y||t[9]!==b?(C={theme:v,width:y,height:b,actions:!1,mode:`vega`,renderer:`canvas`},t[7]=v,t[8]=y,t[9]=b,t[10]=C):C=t[10];let w;t[11]!==C||t[12]!==_?(w={ref:u,spec:_,options:C},t[11]=C,t[12]=_,t[13]=w):w=t[13];let T=S(w),E;t[14]===T?.view?E=t[15]:(E=()=>{let e=[{signalName:L,handler:(e,t)=>{let n=t.cell?.[0]??void 0;l(n??null)}}];return e.forEach(e=>{let{signalName:t,handler:n}=e;T?.view.addSignalListener(t,n)}),()=>{e.forEach(e=>{let{signalName:t,handler:n}=e;T?.view.removeSignalListener(t,n)})}},t[14]=T?.view,t[15]=E);let O;t[16]===T?O=t[17]:(O=[T],t[16]=T,t[17]=O),(0,P.useEffect)(E,O);let k;t[18]!==h||t[19]!==c||t[20]!==n?(k=(0,G.jsx)(X,{run:n,hoveredCellId:c,hiddenInputElementId:h}),t[18]=h,t[19]=c,t[20]=n,t[21]=k):k=t[21];let A=k,j=r===`sideBySide`?`-mt-0.5 flex-1`:``,M;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,G.jsx)(P.Suspense,{children:(0,G.jsx)(`div`,{ref:u})}),t[22]=M):M=t[22];let N;t[23]!==d||t[24]!==j?(N=(0,G.jsx)(`div`,{className:j,ref:d,children:M}),t[23]=d,t[24]=j,t[25]=N):N=t[25];let I=N;if(r===`above`){let e;t[26]!==I||t[27]!==s||t[28]!==A?(e=(0,G.jsxs)(`pre`,{className:`font-mono font-semibold`,children:[s,I,A]}),t[26]=I,t[27]=s,t[28]=A,t[29]=e):e=t[29];let r;return t[30]!==n.runId||t[31]!==e?(r=(0,G.jsx)(`div`,{className:`flex flex-col`,children:e},n.runId),t[30]=n.runId,t[31]=e,t[32]=r):r=t[32],r}let R;t[33]!==s||t[34]!==A?(R=(0,G.jsxs)(`pre`,{className:`font-mono font-semibold`,children:[s,A]}),t[33]=s,t[34]=A,t[35]=R):R=t[35];let z;return t[36]!==I||t[37]!==n.runId||t[38]!==R?(z=(0,G.jsxs)(`div`,{className:`flex flex-row`,children:[R,I]},n.runId),t[36]=I,t[37]=n.runId,t[38]=R,t[39]=z):z=t[39],z},X=e=>{let t=(0,F.c)(12),{run:n,hoveredCellId:r,hiddenInputElementId:i}=e,a=(0,P.useRef)(null),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{a.current&&(a.current.value=String(e),a.current.dispatchEvent(new Event(`input`,{bubbles:!0})))},t[0]=o):o=t[0];let s=o,c=r||``,l;t[1]!==i||t[2]!==c?(l=(0,G.jsx)(`input`,{type:`text`,id:i,defaultValue:c,hidden:!0,ref:a}),t[1]=i,t[2]=c,t[3]=l):l=t[3];let u;t[4]===n.cellRuns?u=t[5]:(u=[...n.cellRuns.values()],t[4]=n.cellRuns,t[5]=u);let d;t[6]!==r||t[7]!==u?(d=u.map(e=>(0,G.jsx)(Q,{cellRun:e,hovered:e.cellId===r,dispatchHoverEvent:s},e.cellId)),t[6]=r,t[7]=u,t[8]=d):d=t[8];let f;return t[9]!==l||t[10]!==d?(f=(0,G.jsxs)(`div`,{className:`text-xs mt-0.5 ml-3 flex flex-col gap-0.5`,children:[l,d]}),t[9]=l,t[10]=d,t[11]=f):f=t[11],f},Z={success:(0,G.jsx)(_,{color:`green`,size:14}),running:(0,G.jsx)(v,{color:`var(--blue-10)`,size:14}),error:(0,G.jsx)(s,{color:`red`,size:14}),queued:(0,G.jsx)(N,{color:`grey`,size:14})},Q=e=>{let t=(0,F.c)(39),{cellRun:n,hovered:r,dispatchHoverEvent:i}=e,a;t[0]===n.elapsedTime?a=t[1]:(a=n.elapsedTime?o(n.elapsedTime*1e3):`-`,t[0]=n.elapsedTime,t[1]=a);let s=a,l;t[2]!==n.elapsedTime||t[3]!==s?(l=n.elapsedTime?(0,G.jsxs)(`span`,{children:[`This cell took `,(0,G.jsx)(b,{elapsedTime:s}),` to run`]}):(0,G.jsx)(`span`,{children:`This cell has not been run`}),t[2]=n.elapsedTime,t[3]=s,t[4]=l):l=t[4];let d=l,p;t[5]!==n.cellId||t[6]!==i?(p=()=>{i(n.cellId)},t[5]=n.cellId,t[6]=i,t[7]=p):p=t[7];let m=p,h;t[8]===i?h=t[9]:(h=()=>{i(null)},t[8]=i,t[9]=h);let g=h,_=r&&`bg-(--gray-3) opacity-100`,v;t[10]===_?v=t[11]:(v=u(`flex flex-row gap-2 py-1 px-1 opacity-70 hover:bg-(--gray-3) hover:opacity-100`,_),t[10]=_,t[11]=v);let y;t[12]===n.startTime?y=t[13]:(y=c(n.startTime),t[12]=n.startTime,t[13]=y);let x;t[14]===y?x=t[15]:(x=(0,G.jsxs)(`span`,{className:`text-(--gray-10) dark:text-(--gray-11)`,children:[`[`,y,`]`]}),t[14]=y,t[15]=x);let S;t[16]===n.cellId?S=t[17]:(S=(0,G.jsxs)(`span`,{className:`text-(--gray-10) w-16 overflow-hidden`,children:[`(`,(0,G.jsx)(C,{cellId:n.cellId}),`)`]}),t[16]=n.cellId,t[17]=S);let w;t[18]===n.code?w=t[19]:(w=(0,G.jsx)(`span`,{className:`w-40 truncate -ml-1`,children:n.code}),t[18]=n.code,t[19]=w);let T;t[20]===s?T=t[21]:(T=(0,G.jsx)(`span`,{className:`text-(--gray-10) dark:text-(--gray-11)`,children:s}),t[20]=s,t[21]=T);let E;t[22]!==d||t[23]!==T?(E=(0,G.jsx)(f,{content:d,children:T}),t[22]=d,t[23]=T,t[24]=E):E=t[24];let D=Z[n.status],O;t[25]!==n.status||t[26]!==D?(O=(0,G.jsx)(f,{content:n.status,children:D}),t[25]=n.status,t[26]=D,t[27]=O):O=t[27];let k;t[28]!==E||t[29]!==O?(k=(0,G.jsxs)(`div`,{className:`flex flex-row gap-1 w-16 justify-end -ml-2`,children:[E,O]}),t[28]=E,t[29]=O,t[30]=k):k=t[30];let A;return t[31]!==m||t[32]!==g||t[33]!==w||t[34]!==k||t[35]!==v||t[36]!==x||t[37]!==S?(A=(0,G.jsxs)(`div`,{className:v,onMouseEnter:m,onMouseLeave:g,children:[x,S,w,k]}),t[31]=m,t[32]=g,t[33]=w,t[34]=k,t[35]=v,t[36]=x,t[37]=S,t[38]=A):A=t[38],A};export{q as Tracing};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-Di6pUmX8.js","./rolldown-runtime-B0Z9INg1.js","./useEvent-Dfcbgjhg.js","./react-DVplv7_D.js","./compiler-runtime-BrajqUja.js","./cells-BRkCaSsh.js","./react-dom-_LrxgvjW.js","./schemas-Dv42wLFq.js","./debounce-aFmHgJZY.js","./isObject-BCaOs5rp.js","./now-Cmx0b_zA.js","./isSymbol-oX0TOjjx.js","./config-VPSq73n8.js","./_baseMerge-CQpUq7ep.js","./isArrayLikeObject-DnwgSs_Z.js","./useEventListener-D9cftcHj.js","./objects-snlMn4yk.js","./invariant-Ci2dTZ72.js","./utils-B4K466FK.js","./session-DqoWmb7X.js","./config-DX8Y2WbJ.js","./Deferred-CrTnjj37.js","./cn-ldLVeaqm.js","./clsx-DB0hHKMi.js","./jsx-runtime-B74pBk57.js","./fullscreen-B9tHcfpV.js","./dist-iaThVDkA.js","./menu-items-BrwnTgyK.js","./use-restore-focus-BxEGwIbk.js","./circle-DXf-VWZG.js","./createLucideIcon-DfJ2oMlA.js","./select-DTBn5eTb.js","./button-COI-NGrx.js","./check-BQNapYaf.js","./useNumberFormatter-D7O_26UI.js","./I18nProvider-Cg2I_s1_.js","./toast-BGzLGnvw.js","./tooltip-C9TuY18o.js","./paths-bkIFVj8h.js","./useLifecycle-Mq4gc5kS.js","./toDate-DOj9Q6uC.js","./database-zap-B_PMVg8T.js","./write-secret-modal-DzKAInL2.js","./alert-dialog-BaPGzeOK.js","./input-BoBxR50a.js","./numbers-Mk3-CcoU.js","./once-Haz_uxEL.js","./arrays-BqUx5USx.js","./useDebounce-B_ccBZTp.js","./use-toast-Wu434mLr.js","./requests-lt0JK8Jt.js","./uuid-k9DpjH68.js","./plus-C5silF6g.js","./trash-2-DcgaW8fn.js","./preload-helper-uBIymjUX.js","./dist-Cny7_yZb.js","./dist-DBMV4gqt.js","./capabilities-BJvf-MD4.js","./cjs-C49f7GXV.js","./createReducer-DgRODTW6.js","./dist-qhAY4L2r.js","./marked.esm-B_3iMIUq.js","./strings-B2vv-ENv.js","./dist-BOfh4hMd.js","./badge-crT3E0Rm.js","./dist-LSsCJjA3.js","./dist-1tmpVXyz.js","./dist-DtH-7lot.js","./dist-BmExfiwX.js","./dist-DusFODSa.js","./stex-Dc5bKD4z.js","./useTheme-COhSHkCj.js","./useAsyncData-C7aJJz0Y.js","./purify.es--06brOip.js","./cells-0PFKL3SH.css","./chevron-right-eAtVhbNZ.js","./circle-check-BCurAHEb.js","./circle-play-CYIb0qT6.js","./CellStatus-BP2mavAq.js","./ban-YzvUro5I.js","./ellipsis-63DyBLHQ.js","./refresh-cw-Qw1f8Jhy.js","./workflow-cw-0b9g5.js","./useDateFormatter-DA-62E-Y.js","./en-US-Buu61juQ.js","./multi-icon-DL465pPF.js","./multi-icon-D129IBvu.css","./CellStatus-2Psjnl5F.css","./react-vega-C3rYGtP6.js","./vega-loader.browser-CLRkNgm7.js","./precisionRound-Bq_nmf5u.js","./defaultLocale-CNPGWpMu.js","./defaultLocale-D5bOh7g6.js","./linear-0eij_aAG.js","./init-ZlXS9mIS.js","./cubic-DELhj3Tx.js","./ordinal-BdBDtYTt.js","./time-MgToa8VM.js","./range-EplFIxc7.js","./path-BCdg30Y0.js","./math-Bi_r_ZWc.js","./arc-Yxk2k_uq.js","./array-BifhSqXX.js","./step-CqgdNM3U.js","./line-io_go0HI.js","./colors-Cg5Vh3br.js","./treemap-BfjIY-m6.js","./cell-link-LSth_8hT.js","./react-resizable-panels.browser.esm-Dbe0MrFr.js","./bundle.esm-D3tw5rqW.js","./empty-state-BaCKb7o3.js","./panel-context-C2QXpKfx.js","./clear-button-p6YcvzLy.js","./runs-BLp5jezv.js"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-DVplv7_D.js";import{t as n}from"./compiler-runtime-BrajqUja.js";import{t as r}from"./jsx-runtime-B74pBk57.js";import{t as i}from"./spinner-DyNE-o8o.js";import{t as a}from"./preload-helper-uBIymjUX.js";var o=n(),s=e(t(),1),c=r(),l=s.lazy(()=>a(()=>import(`./tracing-Di6pUmX8.js`).then(e=>({default:e.Tracing})),__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]),import.meta.url)),u=()=>{let e=(0,o.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,c.jsx)(s.Suspense,{fallback:(0,c.jsx)(d,{}),children:(0,c.jsx)(l,{})}),e[0]=t):t=e[0],t},d=()=>{let e=(0,o.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,c.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full`,children:(0,c.jsx)(i,{})}),e[0]=t):t=e[0],t};export{u as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-BARlJ_Dk.js","./rolldown-runtime-B0Z9INg1.js","./useEvent-Dfcbgjhg.js","./react-DVplv7_D.js","./compiler-runtime-BrajqUja.js","./cells-rA_jsZCj.js","./react-dom-_LrxgvjW.js","./schemas-Dv42wLFq.js","./debounce-aFmHgJZY.js","./isObject-BCaOs5rp.js","./now-Cmx0b_zA.js","./isSymbol-oX0TOjjx.js","./config-VPSq73n8.js","./_baseMerge-CQpUq7ep.js","./isArrayLikeObject-DnwgSs_Z.js","./useEventListener-D9cftcHj.js","./objects-snlMn4yk.js","./invariant-Ci2dTZ72.js","./utils-B4K466FK.js","./session-DqoWmb7X.js","./config-DX8Y2WbJ.js","./Deferred-CrTnjj37.js","./cn-ldLVeaqm.js","./clsx-DB0hHKMi.js","./jsx-runtime-B74pBk57.js","./fullscreen-B9tHcfpV.js","./dist-iaThVDkA.js","./menu-items-BrwnTgyK.js","./use-restore-focus-BxEGwIbk.js","./circle-DXf-VWZG.js","./createLucideIcon-DfJ2oMlA.js","./select-DTBn5eTb.js","./button-COI-NGrx.js","./check-BQNapYaf.js","./useNumberFormatter-D7O_26UI.js","./I18nProvider-Cg2I_s1_.js","./toast-BGzLGnvw.js","./tooltip-C9TuY18o.js","./paths-bkIFVj8h.js","./useLifecycle-Mq4gc5kS.js","./toDate-DOj9Q6uC.js","./database-zap-B_PMVg8T.js","./write-secret-modal-DzKAInL2.js","./alert-dialog-BaPGzeOK.js","./input-BoBxR50a.js","./numbers-Mk3-CcoU.js","./once-Haz_uxEL.js","./arrays-BqUx5USx.js","./useDebounce-B_ccBZTp.js","./use-toast-Wu434mLr.js","./requests-lt0JK8Jt.js","./uuid-k9DpjH68.js","./plus-C5silF6g.js","./trash-2-DcgaW8fn.js","./preload-helper-uBIymjUX.js","./dist-Cny7_yZb.js","./dist-DBMV4gqt.js","./capabilities-BJvf-MD4.js","./cjs-C49f7GXV.js","./createReducer-DgRODTW6.js","./dist-qhAY4L2r.js","./marked.esm-B_3iMIUq.js","./strings-B2vv-ENv.js","./dist-BOfh4hMd.js","./badge-crT3E0Rm.js","./dist-LSsCJjA3.js","./dist-1tmpVXyz.js","./dist-DtH-7lot.js","./dist-BmExfiwX.js","./dist-DusFODSa.js","./stex-Dc5bKD4z.js","./useTheme-COhSHkCj.js","./useAsyncData-C7aJJz0Y.js","./purify.es--06brOip.js","./cells-0PFKL3SH.css","./chevron-right-eAtVhbNZ.js","./circle-check-BCurAHEb.js","./circle-play-CYIb0qT6.js","./CellStatus-nZpuDkm7.js","./ban-YzvUro5I.js","./ellipsis-63DyBLHQ.js","./refresh-cw-Qw1f8Jhy.js","./workflow-cw-0b9g5.js","./useDateFormatter-DA-62E-Y.js","./en-US-Buu61juQ.js","./multi-icon-DL465pPF.js","./multi-icon-D129IBvu.css","./CellStatus-2Psjnl5F.css","./react-vega-C3rYGtP6.js","./vega-loader.browser-CLRkNgm7.js","./precisionRound-Bq_nmf5u.js","./defaultLocale-CNPGWpMu.js","./defaultLocale-D5bOh7g6.js","./linear-0eij_aAG.js","./init-ZlXS9mIS.js","./cubic-DELhj3Tx.js","./ordinal-BdBDtYTt.js","./time-MgToa8VM.js","./range-EplFIxc7.js","./path-BCdg30Y0.js","./math-Bi_r_ZWc.js","./arc-Yxk2k_uq.js","./array-BifhSqXX.js","./step-CqgdNM3U.js","./line-io_go0HI.js","./colors-Cg5Vh3br.js","./treemap-BfjIY-m6.js","./cell-link-1CynTVGQ.js","./react-resizable-panels.browser.esm-Dbe0MrFr.js","./bundle.esm-D3tw5rqW.js","./empty-state-BaCKb7o3.js","./panel-context-C2QXpKfx.js","./clear-button-p6YcvzLy.js","./runs-BLp5jezv.js"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-DVplv7_D.js";import{t as n}from"./compiler-runtime-BrajqUja.js";import{t as r}from"./jsx-runtime-B74pBk57.js";import{t as i}from"./spinner-DyNE-o8o.js";import{t as a}from"./preload-helper-uBIymjUX.js";var o=n(),s=e(t(),1),c=r(),l=s.lazy(()=>a(()=>import(`./tracing-BARlJ_Dk.js`).then(e=>({default:e.Tracing})),__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]),import.meta.url)),u=()=>{let e=(0,o.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,c.jsx)(s.Suspense,{fallback:(0,c.jsx)(d,{}),children:(0,c.jsx)(l,{})}),e[0]=t):t=e[0],t},d=()=>{let e=(0,o.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,c.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full`,children:(0,c.jsx)(i,{})}),e[0]=t):t=e[0],t};export{u as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-DVplv7_D.js";import{ro as n}from"./cells-BRkCaSsh.js";import{t as r}from"./compiler-runtime-BrajqUja.js";import{g as i}from"./useEventListener-D9cftcHj.js";import{t as a}from"./cn-ldLVeaqm.js";import{t as o}from"./jsx-runtime-B74pBk57.js";import{t as s}from"./tooltip-C9TuY18o.js";import{t as c}from"./button-COI-NGrx.js";import{t as l}from"./createLucideIcon-DfJ2oMlA.js";import{t as u}from"./chevron-right-eAtVhbNZ.js";import{n as d,t as f}from"./eye-off-CxVozGAC.js";import{t as p}from"./refresh-cw-Qw1f8Jhy.js";var m=l(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),h={keyBy(e,t){let n=new Map,r=new Set;for(let i of e){let e=t(i);n.has(e)&&r.add(e),n.set(e,i)}return r.size>0&&i.trace(`Duplicate keys: ${[...r].join(`, `)}`),n},collect(e,t,n){return h.mapValues(h.keyBy(e,t),n)},filterMap(e,t){let n=new Map;for(let[r,i]of e)t(i,r)&&n.set(r,i);return n},mapValues(e,t){let n=new Map;for(let[r,i]of e)n.set(r,t(i,r));return n}},g=r(),_=e(t(),1),v=o(),y=e=>{let t=(0,g.c)(5),{isExpanded:n,className:r}=e,i=n&&`rotate-90`,o;t[0]!==r||t[1]!==i?(o=a(`shrink-0 transition-transform`,i,r),t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;return t[3]===o?s=t[4]:(s=(0,v.jsx)(u,{className:o}),t[3]=o,t[4]=s),s},b=({onClick:e,tooltip:t=`Refresh`,className:n,iconClassName:r})=>{let[i,o]=(0,_.useState)(!1),l=(0,v.jsx)(c,{variant:`text`,size:`xs`,className:n,onClick:async t=>{o(!0);let n=new Promise(e=>setTimeout(e,500));try{await Promise.all([e(t),n])}finally{o(!1)}},children:(0,v.jsx)(p,{className:a(`h-4 w-4`,r,i&&`animate-[spin_0.5s]`)})});return(0,v.jsx)(s,{content:t,children:l})},x=e=>{let t=(0,g.c)(15),{isVisible:r,onToggle:i,showTooltip:o,hideTooltip:l,size:u,className:d,iconClassName:p,"data-testid":m}=e,h=u===void 0?`xs`:u,_=r?n:f,y=r?l:o,b=r&&`text-primary`,x;t[0]!==p||t[1]!==b?(x=a(`h-4 w-4`,b,p),t[0]=p,t[1]=b,t[2]=x):x=t[2];let S;t[3]!==_||t[4]!==x?(S=(0,v.jsx)(_,{className:x}),t[3]=_,t[4]=x,t[5]=S):S=t[5];let C;t[6]!==d||t[7]!==m||t[8]!==i||t[9]!==h||t[10]!==S?(C=(0,v.jsx)(c,{"data-testid":m,variant:`text`,size:h,className:d,onClick:i,children:S}),t[6]=d,t[7]=m,t[8]=i,t[9]=h,t[10]=S,t[11]=C):C=t[11];let w;return t[12]!==y||t[13]!==C?(w=(0,v.jsx)(s,{content:y,children:C}),t[12]=y,t[13]=C,t[14]=w):w=t[14],w},S=_.forwardRef((e,t)=>{let n=(0,g.c)(15),r,i,o;n[0]===e?(r=n[1],i=n[2],o=n[3]):({className:r,iconClassName:i,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=o);let s;n[4]===r?s=n[5]:(s=a(`mb-0 opacity-0 group-hover:opacity-100 transition-opacity`,r),n[4]=r,n[5]=s);let l;n[6]===i?l=n[7]:(l=a(`w-4 h-4`,i),n[6]=i,n[7]=l);let u;n[8]===l?u=n[9]:(u=(0,v.jsx)(d,{className:l}),n[8]=l,n[9]=u);let f;return n[10]!==o||n[11]!==t||n[12]!==s||n[13]!==u?(f=(0,v.jsx)(c,{ref:t,variant:`text`,tabIndex:-1,size:`xs`,className:s,"aria-label":`More options`,...o,children:u}),n[10]=o,n[11]=t,n[12]=s,n[13]=u,n[14]=f):f=n[14],f});S.displayName=`MoreActionsButton`;var C=`h-3.5 w-3.5 mr-2`;export{x as a,y as i,S as n,h as o,b as r,m as s,C as t};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-DVplv7_D.js";import{ro as n}from"./cells-rA_jsZCj.js";import{t as r}from"./compiler-runtime-BrajqUja.js";import{g as i}from"./useEventListener-D9cftcHj.js";import{t as a}from"./cn-ldLVeaqm.js";import{t as o}from"./jsx-runtime-B74pBk57.js";import{t as s}from"./tooltip-C9TuY18o.js";import{t as c}from"./button-COI-NGrx.js";import{t as l}from"./createLucideIcon-DfJ2oMlA.js";import{t as u}from"./chevron-right-eAtVhbNZ.js";import{n as d,t as f}from"./eye-off-CxVozGAC.js";import{t as p}from"./refresh-cw-Qw1f8Jhy.js";var m=l(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),h={keyBy(e,t){let n=new Map,r=new Set;for(let i of e){let e=t(i);n.has(e)&&r.add(e),n.set(e,i)}return r.size>0&&i.trace(`Duplicate keys: ${[...r].join(`, `)}`),n},collect(e,t,n){return h.mapValues(h.keyBy(e,t),n)},filterMap(e,t){let n=new Map;for(let[r,i]of e)t(i,r)&&n.set(r,i);return n},mapValues(e,t){let n=new Map;for(let[r,i]of e)n.set(r,t(i,r));return n}},g=r(),_=e(t(),1),v=o(),y=e=>{let t=(0,g.c)(5),{isExpanded:n,className:r}=e,i=n&&`rotate-90`,o;t[0]!==r||t[1]!==i?(o=a(`shrink-0 transition-transform`,i,r),t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;return t[3]===o?s=t[4]:(s=(0,v.jsx)(u,{className:o}),t[3]=o,t[4]=s),s},b=({onClick:e,tooltip:t=`Refresh`,className:n,iconClassName:r})=>{let[i,o]=(0,_.useState)(!1),l=(0,v.jsx)(c,{variant:`text`,size:`xs`,className:n,onClick:async t=>{o(!0);let n=new Promise(e=>setTimeout(e,500));try{await Promise.all([e(t),n])}finally{o(!1)}},children:(0,v.jsx)(p,{className:a(`h-4 w-4`,r,i&&`animate-[spin_0.5s]`)})});return(0,v.jsx)(s,{content:t,children:l})},x=e=>{let t=(0,g.c)(15),{isVisible:r,onToggle:i,showTooltip:o,hideTooltip:l,size:u,className:d,iconClassName:p,"data-testid":m}=e,h=u===void 0?`xs`:u,_=r?n:f,y=r?l:o,b=r&&`text-primary`,x;t[0]!==p||t[1]!==b?(x=a(`h-4 w-4`,b,p),t[0]=p,t[1]=b,t[2]=x):x=t[2];let S;t[3]!==_||t[4]!==x?(S=(0,v.jsx)(_,{className:x}),t[3]=_,t[4]=x,t[5]=S):S=t[5];let C;t[6]!==d||t[7]!==m||t[8]!==i||t[9]!==h||t[10]!==S?(C=(0,v.jsx)(c,{"data-testid":m,variant:`text`,size:h,className:d,onClick:i,children:S}),t[6]=d,t[7]=m,t[8]=i,t[9]=h,t[10]=S,t[11]=C):C=t[11];let w;return t[12]!==y||t[13]!==C?(w=(0,v.jsx)(s,{content:y,children:C}),t[12]=y,t[13]=C,t[14]=w):w=t[14],w},S=_.forwardRef((e,t)=>{let n=(0,g.c)(15),r,i,o;n[0]===e?(r=n[1],i=n[2],o=n[3]):({className:r,iconClassName:i,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=o);let s;n[4]===r?s=n[5]:(s=a(`mb-0 opacity-0 group-hover:opacity-100 transition-opacity`,r),n[4]=r,n[5]=s);let l;n[6]===i?l=n[7]:(l=a(`w-4 h-4`,i),n[6]=i,n[7]=l);let u;n[8]===l?u=n[9]:(u=(0,v.jsx)(d,{className:l}),n[8]=l,n[9]=u);let f;return n[10]!==o||n[11]!==t||n[12]!==s||n[13]!==u?(f=(0,v.jsx)(c,{ref:t,variant:`text`,tabIndex:-1,size:`xs`,className:s,"aria-label":`More options`,...o,children:u}),n[10]=o,n[11]=t,n[12]=s,n[13]=u,n[14]=f):f=n[14],f});S.displayName=`MoreActionsButton`;var C=`h-3.5 w-3.5 mr-2`;export{x as a,y as i,S as n,h as o,b as r,m as s,C as t};
@@ -1 +1 @@
1
- import{l as e}from"./useEvent-Dfcbgjhg.js";import{D as t,Rt as n,zt as r}from"./cells-BRkCaSsh.js";import{t as i}from"./compiler-runtime-BrajqUja.js";import{s as a}from"./config-VPSq73n8.js";var o=i();function s(){let i=(0,o.c)(4),s=e(a),c=n(),{createNewCell:l}=t(),u;return i[0]!==s||i[1]!==l||i[2]!==c?(u=e=>{e.includes(`alt`)&&r({autoInstantiate:s,createNewCell:l,fromCellId:c}),l({code:e,before:!1,cellId:c??`__end__`})},i[0]=s,i[1]=l,i[2]=c,i[3]=u):u=i[3],u}export{s as t};
1
+ import{l as e}from"./useEvent-Dfcbgjhg.js";import{D as t,Rt as n,zt as r}from"./cells-rA_jsZCj.js";import{t as i}from"./compiler-runtime-BrajqUja.js";import{s as a}from"./config-VPSq73n8.js";var o=i();function s(){let i=(0,o.c)(4),s=e(a),c=n(),{createNewCell:l}=t(),u;return i[0]!==s||i[1]!==l||i[2]!==c?(u=e=>{e.includes(`alt`)&&r({autoInstantiate:s,createNewCell:l,fromCellId:c}),l({code:e,before:!1,cellId:c??`__end__`})},i[0]=s,i[1]=l,i[2]=c,i[3]=u):u=i[3],u}export{s as t};
@@ -1 +1 @@
1
- import{l as e,u as t}from"./useEvent-Dfcbgjhg.js";import{Bt as n,Co as ee,D as te,ii as ne,io as re,oo as ie,qa as ae,ri as oe,ro as se,so as r,v as ce,vi as le,vt as i}from"./cells-BRkCaSsh.js";import{t as a}from"./compiler-runtime-BrajqUja.js";import{o as ue,r as de,s as fe}from"./config-VPSq73n8.js";import{m as pe}from"./session-DqoWmb7X.js";import{t as o}from"./jsx-runtime-B74pBk57.js";import{d as me}from"./select-DTBn5eTb.js";import{i as he,p as ge}from"./download-DCJXy66H.js";import{t as s}from"./createLucideIcon-DfJ2oMlA.js";import{i as _e}from"./paths-bkIFVj8h.js";import{a as ve,i as c}from"./useNumberFormatter-D7O_26UI.js";import{t as ye}from"./chevron-right-eAtVhbNZ.js";import{t as be}from"./code-xml-SQaZqvcO.js";import{t as xe}from"./eye-off-CxVozGAC.js";import{t as Se}from"./image-wZvTj8WY.js";import{b as Ce}from"./write-secret-modal-DzKAInL2.js";import{t as we}from"./link-NuFVR7G9.js";import{i as Te,t as Ee}from"./useDeleteCell-2_bMClHd.js";import{Qt as De,Yt as Oe,tn as ke}from"./input-BoBxR50a.js";import{t as Ae}from"./trash-2-DcgaW8fn.js";import{n as je}from"./copy-D8O_CYCG.js";import{t as Me}from"./use-toast-Wu434mLr.js";import{r as Ne}from"./requests-lt0JK8Jt.js";import{i as Pe}from"./useRunCells-B2vUhREg.js";import{n as Fe}from"./state-XsPO8hNi.js";import{n as Ie,t as Le}from"./icons-CiZ_8zS-.js";import{n as l}from"./name-cell-input-BgEBmqyL.js";import{t as u}from"./multi-icon-DL465pPF.js";import{t as Re}from"./useSplitCell-DEb03htp.js";var d=s(`chevrons-down`,[[`path`,{d:`m7 6 5 5 5-5`,key:`1lc07p`}],[`path`,{d:`m7 13 5 5 5-5`,key:`1d48rs`}]]),f=s(`chevrons-up`,[[`path`,{d:`m17 11-5-5-5 5`,key:`e8nh98`}],[`path`,{d:`m17 18-5-5-5 5`,key:`2avn1x`}]]),p=s(`scissors`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M8.12 8.12 12 12`,key:`1alkpv`}],[`path`,{d:`M20 4 8.12 15.88`,key:`xgtan2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M14.8 14.8 20 20`,key:`ptml3r`}]]),ze=s(`text-cursor-input`,[[`path`,{d:`M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6`,key:`1528k5`}],[`path`,{d:`M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7`,key:`13ksps`}],[`path`,{d:`M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1`,key:`1n9rhb`}],[`path`,{d:`M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1`,key:`1mj8rg`}],[`path`,{d:`M9 6v12`,key:`velyjx`}]]),m=s(`zap-off`,[[`path`,{d:`M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317`,key:`193nxd`}],[`path`,{d:`M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773`,key:`27a7lr`}],[`path`,{d:`M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643`,key:`1e0qe9`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),h=s(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),Be=a();function Ve(e){let t=new URL(window.location.href);return t.hash=`scrollTo=${encodeURIComponent(e)}`,t.toString()}function g(e){let t=e.match(/scrollTo=([^&]+)/)?.[1];return t?decodeURIComponent(t.split(`&`)[0]):null}function _(e){return e!==`_`&&!!(e&&e.trim().length>0)}var v=o();function y(a){let o=(0,Be.c)(47),{cell:s,closePopover:g}=a,{createNewCell:y,updateCellConfig:b,updateCellName:x,moveCell:S,sendToTop:C,sendToBottom:w,addColumnBreakpoint:T,clearCellOutput:E,markUntouched:D}=te(),O=Re(),k=Pe(s?.cellId),A=!e(ce),j=Ee(),{openModal:M}=Ce(),N=t(Fe),P=e(de),F=e(fe),Ge=e(pe),I=e(ue),{saveCellConfig:L}=Ne();if(!s||Ge){let e;return o[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],o[0]=e):e=o[0],e}let{cellId:R,config:z,getEditorView:B,name:V,hasOutput:H,hasConsoleOutput:U,status:W}=s,G;o[1]!==R||o[2]!==z.disabled||o[3]!==L||o[4]!==b?(G=async()=>{let e={disabled:!z.disabled};await L({configs:{[R]:e}}),b({cellId:R,config:e})},o[1]=R,o[2]=z.disabled,o[3]=L,o[4]=b,o[5]=G):G=o[5];let K=G,q;o[6]!==R||o[7]!==z.hide_code||o[8]!==B||o[9]!==L||o[10]!==b?(q=async()=>{let e={hide_code:!z.hide_code};await L({configs:{[R]:e}}),b({cellId:R,config:e});let t=B();t&&(e.hide_code?t.contentDOM.blur():t.focus())},o[6]=R,o[7]=z.hide_code,o[8]=B,o[9]=L,o[10]=b,o[11]=q):q=o[11];let J=q,Y=R===ee,X;o[12]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,v.jsx)(Te,{size:13,strokeWidth:1.5}),o[12]=X):X=o[12];let Z=W===`running`||W===`queued`||W===`disabled-transitively`||z.disabled,Q;o[13]===k?Q=o[14]:(Q=()=>k(),o[13]=k,o[14]=Q);let $;return o[15]!==T||o[16]!==P||o[17]!==I||o[18]!==F||o[19]!==A||o[20]!==R||o[21]!==E||o[22]!==g||o[23]!==z.disabled||o[24]!==z.hide_code||o[25]!==y||o[26]!==j||o[27]!==B||o[28]!==U||o[29]!==H||o[30]!==Y||o[31]!==D||o[32]!==S||o[33]!==V||o[34]!==M||o[35]!==L||o[36]!==w||o[37]!==C||o[38]!==N||o[39]!==O||o[40]!==Z||o[41]!==Q||o[42]!==K||o[43]!==J||o[44]!==b||o[45]!==x?($=[[{icon:X,label:`Run cell`,hotkey:`cell.run`,hidden:Z,redundant:!0,handle:Q},{icon:(0,v.jsx)(ae,{size:13,strokeWidth:1.5}),label:`Refactor with AI`,hidden:!P,handle:()=>{N(e=>e?.cellId===R?null:{cellId:R})},hotkey:`cell.aiCompletion`},{icon:(0,v.jsx)(p,{size:13,strokeWidth:1.5}),label:`Split`,hotkey:`cell.splitCell`,handle:()=>O({cellId:R})},{icon:(0,v.jsx)(be,{size:13,strokeWidth:1.5}),label:`Format`,hotkey:`cell.format`,handle:()=>{let e=B();e&&le({[R]:e})}},{icon:z.hide_code?(0,v.jsx)(se,{size:13,strokeWidth:1.5}):(0,v.jsx)(xe,{size:13,strokeWidth:1.5}),label:z.hide_code?`Show code`:`Hide code`,handle:J,hotkey:`cell.hideCode`},{icon:z.disabled?(0,v.jsx)(m,{size:13,strokeWidth:1.5}):(0,v.jsx)(h,{size:13,strokeWidth:1.5}),label:z.disabled?`Enable execution`:`Disable execution`,handle:K,hidden:Y}],[{icon:(0,v.jsx)(Le,{}),label:`Convert to Markdown`,hotkey:`cell.viewAsMarkdown`,handle:async()=>{let e=B();e&&(n({autoInstantiate:F,createNewCell:y}),i(e,{language:`markdown`,keepCodeAsIs:!1}),z.hide_code||(await L({configs:{[R]:{hide_code:!0}}}),b({cellId:R,config:{hide_code:!0}}),D({cellId:R})))},hidden:Y},oe(B())===`sql`?{icon:(0,v.jsx)(Ie,{}),label:`View as Python`,hotkey:`cell.viewAsSQL`,handle:()=>{let e=B();e&&ne(e,`python`,{force:!0})},hidden:Y}:{icon:(0,v.jsx)(_e,{size:13,strokeWidth:1.5}),label:`Convert to SQL`,hotkey:`cell.viewAsSQL`,handle:()=>{let e=B();e&&(n({autoInstantiate:F,createNewCell:y}),i(e,{language:`sql`,keepCodeAsIs:!1}))},hidden:Y}],[{icon:(0,v.jsxs)(u,{children:[(0,v.jsx)(r,{size:13,strokeWidth:1.5}),(0,v.jsx)(c,{size:8,strokeWidth:2})]}),label:`Create cell above`,hotkey:`cell.createAbove`,handle:()=>y({cellId:R,before:!0}),hidden:Y,redundant:!0},{icon:(0,v.jsxs)(u,{children:[(0,v.jsx)(r,{size:13,strokeWidth:1.5}),(0,v.jsx)(ve,{size:8,strokeWidth:2})]}),label:`Create cell below`,hotkey:`cell.createBelow`,handle:()=>y({cellId:R,before:!1}),redundant:!0},{icon:(0,v.jsx)(c,{size:13,strokeWidth:1.5}),label:`Move cell up`,hotkey:`cell.moveUp`,handle:()=>S({cellId:R,before:!0}),hidden:Y},{icon:(0,v.jsx)(ve,{size:13,strokeWidth:1.5}),label:`Move cell down`,hotkey:`cell.moveDown`,handle:()=>S({cellId:R,before:!1}),hidden:Y},{icon:(0,v.jsx)(ge,{size:13,strokeWidth:1.5}),label:`Move cell left`,hotkey:`cell.moveLeft`,handle:()=>S({cellId:R,direction:`left`}),hidden:I!==`columns`||Y},{icon:(0,v.jsx)(ye,{size:13,strokeWidth:1.5}),label:`Move cell right`,hotkey:`cell.moveRight`,handle:()=>S({cellId:R,direction:`right`}),hidden:I!==`columns`||Y},{icon:(0,v.jsx)(f,{size:13,strokeWidth:1.5}),label:`Send to top`,hotkey:`cell.sendToTop`,handle:()=>C({cellId:R,scroll:!1}),hidden:Y},{icon:(0,v.jsx)(d,{size:13,strokeWidth:1.5}),label:`Send to bottom`,hotkey:`cell.sendToBottom`,handle:()=>w({cellId:R,scroll:!1}),hidden:Y},{icon:(0,v.jsx)(re,{size:13,strokeWidth:1.5}),label:`Break into new column`,hotkey:`cell.addColumnBreakpoint`,handle:()=>T({cellId:R}),hidden:I!==`columns`||Y}],[{icon:(0,v.jsx)(Se,{size:13,strokeWidth:1.5}),label:`Export output as PNG`,hidden:!H,handle:()=>he(R,`result`)},{icon:(0,v.jsx)(ie,{size:13,strokeWidth:1.5}),label:`Clear output`,hidden:!(H||U),handle:()=>{E({cellId:R})}}],[{icon:(0,v.jsx)(ze,{size:13,strokeWidth:1.5}),label:`Name`,disableClick:!0,handle:We,handleHeadless:()=>{M((0,v.jsxs)(Oe,{children:[(0,v.jsx)(De,{children:(0,v.jsx)(ke,{children:`Rename cell`})}),(0,v.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,v.jsx)(me,{htmlFor:`cell-name`,children:`Cell name`}),(0,v.jsx)(l,{placeholder:`cell name`,value:V,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),M(null))},onChange:e=>x({cellId:R,name:e})})]})]}))},rightElement:(0,v.jsx)(l,{placeholder:`cell name`,value:V,onChange:e=>x({cellId:R,name:e}),onEnterKey:()=>g?.()}),hidden:Y},{icon:(0,v.jsx)(we,{size:13,strokeWidth:1.5}),label:`Copy link to cell`,disabled:!_(V),tooltip:_(V)?void 0:`Only named cells can be linked to`,handle:async()=>{await je(Ve(V)),Me({description:`Link copied to clipboard`})}}],[{label:`Delete`,hidden:!A,variant:`danger`,icon:(0,v.jsx)(Ae,{size:13,strokeWidth:1.5}),handle:()=>{j({cellId:R})}}]].map(Ue).filter(He),o[15]=T,o[16]=P,o[17]=I,o[18]=F,o[19]=A,o[20]=R,o[21]=E,o[22]=g,o[23]=z.disabled,o[24]=z.hide_code,o[25]=y,o[26]=j,o[27]=B,o[28]=U,o[29]=H,o[30]=Y,o[31]=D,o[32]=S,o[33]=V,o[34]=M,o[35]=L,o[36]=w,o[37]=C,o[38]=N,o[39]=O,o[40]=Z,o[41]=Q,o[42]=K,o[43]=J,o[44]=b,o[45]=x,o[46]=$):$=o[46],$}function He(e){return e.length>0}function Ue(e){return e.filter(b)}function b(e){return!e.hidden}function We(e){e?.stopPropagation(),e?.preventDefault()}export{p as a,m as i,g as n,f as o,h as r,d as s,y as t};
1
+ import{l as e,u as t}from"./useEvent-Dfcbgjhg.js";import{Bt as n,Co as ee,D as te,ii as ne,io as re,oo as ie,qa as ae,ri as oe,ro as se,so as r,v as ce,vi as le,vt as i}from"./cells-rA_jsZCj.js";import{t as a}from"./compiler-runtime-BrajqUja.js";import{o as ue,r as de,s as fe}from"./config-VPSq73n8.js";import{m as pe}from"./session-DqoWmb7X.js";import{t as o}from"./jsx-runtime-B74pBk57.js";import{d as me}from"./select-DTBn5eTb.js";import{i as he,p as ge}from"./download-Bx55LMki.js";import{t as s}from"./createLucideIcon-DfJ2oMlA.js";import{i as _e}from"./paths-bkIFVj8h.js";import{a as ve,i as c}from"./useNumberFormatter-D7O_26UI.js";import{t as ye}from"./chevron-right-eAtVhbNZ.js";import{t as be}from"./code-xml-SQaZqvcO.js";import{t as xe}from"./eye-off-CxVozGAC.js";import{t as Se}from"./image-wZvTj8WY.js";import{b as Ce}from"./write-secret-modal-DzKAInL2.js";import{t as we}from"./link-NuFVR7G9.js";import{i as Te,t as Ee}from"./useDeleteCell-DFBGlSQk.js";import{Qt as De,Yt as Oe,tn as ke}from"./input-BoBxR50a.js";import{t as Ae}from"./trash-2-DcgaW8fn.js";import{n as je}from"./copy-D8O_CYCG.js";import{t as Me}from"./use-toast-Wu434mLr.js";import{r as Ne}from"./requests-lt0JK8Jt.js";import{i as Pe}from"./useRunCells-BFjFX3hz.js";import{n as Fe}from"./state-Bfh_2SLl.js";import{n as Ie,t as Le}from"./icons-CiZ_8zS-.js";import{n as l}from"./name-cell-input-BNOnF6-0.js";import{t as u}from"./multi-icon-DL465pPF.js";import{t as Re}from"./useSplitCell-Tqv5pPtL.js";var d=s(`chevrons-down`,[[`path`,{d:`m7 6 5 5 5-5`,key:`1lc07p`}],[`path`,{d:`m7 13 5 5 5-5`,key:`1d48rs`}]]),f=s(`chevrons-up`,[[`path`,{d:`m17 11-5-5-5 5`,key:`e8nh98`}],[`path`,{d:`m17 18-5-5-5 5`,key:`2avn1x`}]]),p=s(`scissors`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M8.12 8.12 12 12`,key:`1alkpv`}],[`path`,{d:`M20 4 8.12 15.88`,key:`xgtan2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M14.8 14.8 20 20`,key:`ptml3r`}]]),ze=s(`text-cursor-input`,[[`path`,{d:`M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6`,key:`1528k5`}],[`path`,{d:`M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7`,key:`13ksps`}],[`path`,{d:`M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1`,key:`1n9rhb`}],[`path`,{d:`M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1`,key:`1mj8rg`}],[`path`,{d:`M9 6v12`,key:`velyjx`}]]),m=s(`zap-off`,[[`path`,{d:`M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317`,key:`193nxd`}],[`path`,{d:`M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773`,key:`27a7lr`}],[`path`,{d:`M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643`,key:`1e0qe9`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),h=s(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),Be=a();function Ve(e){let t=new URL(window.location.href);return t.hash=`scrollTo=${encodeURIComponent(e)}`,t.toString()}function g(e){let t=e.match(/scrollTo=([^&]+)/)?.[1];return t?decodeURIComponent(t.split(`&`)[0]):null}function _(e){return e!==`_`&&!!(e&&e.trim().length>0)}var v=o();function y(a){let o=(0,Be.c)(47),{cell:s,closePopover:g}=a,{createNewCell:y,updateCellConfig:b,updateCellName:x,moveCell:S,sendToTop:C,sendToBottom:w,addColumnBreakpoint:T,clearCellOutput:E,markUntouched:D}=te(),O=Re(),k=Pe(s?.cellId),A=!e(ce),j=Ee(),{openModal:M}=Ce(),N=t(Fe),P=e(de),F=e(fe),Ge=e(pe),I=e(ue),{saveCellConfig:L}=Ne();if(!s||Ge){let e;return o[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],o[0]=e):e=o[0],e}let{cellId:R,config:z,getEditorView:B,name:V,hasOutput:H,hasConsoleOutput:U,status:W}=s,G;o[1]!==R||o[2]!==z.disabled||o[3]!==L||o[4]!==b?(G=async()=>{let e={disabled:!z.disabled};await L({configs:{[R]:e}}),b({cellId:R,config:e})},o[1]=R,o[2]=z.disabled,o[3]=L,o[4]=b,o[5]=G):G=o[5];let K=G,q;o[6]!==R||o[7]!==z.hide_code||o[8]!==B||o[9]!==L||o[10]!==b?(q=async()=>{let e={hide_code:!z.hide_code};await L({configs:{[R]:e}}),b({cellId:R,config:e});let t=B();t&&(e.hide_code?t.contentDOM.blur():t.focus())},o[6]=R,o[7]=z.hide_code,o[8]=B,o[9]=L,o[10]=b,o[11]=q):q=o[11];let J=q,Y=R===ee,X;o[12]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,v.jsx)(Te,{size:13,strokeWidth:1.5}),o[12]=X):X=o[12];let Z=W===`running`||W===`queued`||W===`disabled-transitively`||z.disabled,Q;o[13]===k?Q=o[14]:(Q=()=>k(),o[13]=k,o[14]=Q);let $;return o[15]!==T||o[16]!==P||o[17]!==I||o[18]!==F||o[19]!==A||o[20]!==R||o[21]!==E||o[22]!==g||o[23]!==z.disabled||o[24]!==z.hide_code||o[25]!==y||o[26]!==j||o[27]!==B||o[28]!==U||o[29]!==H||o[30]!==Y||o[31]!==D||o[32]!==S||o[33]!==V||o[34]!==M||o[35]!==L||o[36]!==w||o[37]!==C||o[38]!==N||o[39]!==O||o[40]!==Z||o[41]!==Q||o[42]!==K||o[43]!==J||o[44]!==b||o[45]!==x?($=[[{icon:X,label:`Run cell`,hotkey:`cell.run`,hidden:Z,redundant:!0,handle:Q},{icon:(0,v.jsx)(ae,{size:13,strokeWidth:1.5}),label:`Refactor with AI`,hidden:!P,handle:()=>{N(e=>e?.cellId===R?null:{cellId:R})},hotkey:`cell.aiCompletion`},{icon:(0,v.jsx)(p,{size:13,strokeWidth:1.5}),label:`Split`,hotkey:`cell.splitCell`,handle:()=>O({cellId:R})},{icon:(0,v.jsx)(be,{size:13,strokeWidth:1.5}),label:`Format`,hotkey:`cell.format`,handle:()=>{let e=B();e&&le({[R]:e})}},{icon:z.hide_code?(0,v.jsx)(se,{size:13,strokeWidth:1.5}):(0,v.jsx)(xe,{size:13,strokeWidth:1.5}),label:z.hide_code?`Show code`:`Hide code`,handle:J,hotkey:`cell.hideCode`},{icon:z.disabled?(0,v.jsx)(m,{size:13,strokeWidth:1.5}):(0,v.jsx)(h,{size:13,strokeWidth:1.5}),label:z.disabled?`Enable execution`:`Disable execution`,handle:K,hidden:Y}],[{icon:(0,v.jsx)(Le,{}),label:`Convert to Markdown`,hotkey:`cell.viewAsMarkdown`,handle:async()=>{let e=B();e&&(n({autoInstantiate:F,createNewCell:y}),i(e,{language:`markdown`,keepCodeAsIs:!1}),z.hide_code||(await L({configs:{[R]:{hide_code:!0}}}),b({cellId:R,config:{hide_code:!0}}),D({cellId:R})))},hidden:Y},oe(B())===`sql`?{icon:(0,v.jsx)(Ie,{}),label:`View as Python`,hotkey:`cell.viewAsSQL`,handle:()=>{let e=B();e&&ne(e,`python`,{force:!0})},hidden:Y}:{icon:(0,v.jsx)(_e,{size:13,strokeWidth:1.5}),label:`Convert to SQL`,hotkey:`cell.viewAsSQL`,handle:()=>{let e=B();e&&(n({autoInstantiate:F,createNewCell:y}),i(e,{language:`sql`,keepCodeAsIs:!1}))},hidden:Y}],[{icon:(0,v.jsxs)(u,{children:[(0,v.jsx)(r,{size:13,strokeWidth:1.5}),(0,v.jsx)(c,{size:8,strokeWidth:2})]}),label:`Create cell above`,hotkey:`cell.createAbove`,handle:()=>y({cellId:R,before:!0}),hidden:Y,redundant:!0},{icon:(0,v.jsxs)(u,{children:[(0,v.jsx)(r,{size:13,strokeWidth:1.5}),(0,v.jsx)(ve,{size:8,strokeWidth:2})]}),label:`Create cell below`,hotkey:`cell.createBelow`,handle:()=>y({cellId:R,before:!1}),redundant:!0},{icon:(0,v.jsx)(c,{size:13,strokeWidth:1.5}),label:`Move cell up`,hotkey:`cell.moveUp`,handle:()=>S({cellId:R,before:!0}),hidden:Y},{icon:(0,v.jsx)(ve,{size:13,strokeWidth:1.5}),label:`Move cell down`,hotkey:`cell.moveDown`,handle:()=>S({cellId:R,before:!1}),hidden:Y},{icon:(0,v.jsx)(ge,{size:13,strokeWidth:1.5}),label:`Move cell left`,hotkey:`cell.moveLeft`,handle:()=>S({cellId:R,direction:`left`}),hidden:I!==`columns`||Y},{icon:(0,v.jsx)(ye,{size:13,strokeWidth:1.5}),label:`Move cell right`,hotkey:`cell.moveRight`,handle:()=>S({cellId:R,direction:`right`}),hidden:I!==`columns`||Y},{icon:(0,v.jsx)(f,{size:13,strokeWidth:1.5}),label:`Send to top`,hotkey:`cell.sendToTop`,handle:()=>C({cellId:R,scroll:!1}),hidden:Y},{icon:(0,v.jsx)(d,{size:13,strokeWidth:1.5}),label:`Send to bottom`,hotkey:`cell.sendToBottom`,handle:()=>w({cellId:R,scroll:!1}),hidden:Y},{icon:(0,v.jsx)(re,{size:13,strokeWidth:1.5}),label:`Break into new column`,hotkey:`cell.addColumnBreakpoint`,handle:()=>T({cellId:R}),hidden:I!==`columns`||Y}],[{icon:(0,v.jsx)(Se,{size:13,strokeWidth:1.5}),label:`Export output as PNG`,hidden:!H,handle:()=>he(R,`result`)},{icon:(0,v.jsx)(ie,{size:13,strokeWidth:1.5}),label:`Clear output`,hidden:!(H||U),handle:()=>{E({cellId:R})}}],[{icon:(0,v.jsx)(ze,{size:13,strokeWidth:1.5}),label:`Name`,disableClick:!0,handle:We,handleHeadless:()=>{M((0,v.jsxs)(Oe,{children:[(0,v.jsx)(De,{children:(0,v.jsx)(ke,{children:`Rename cell`})}),(0,v.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,v.jsx)(me,{htmlFor:`cell-name`,children:`Cell name`}),(0,v.jsx)(l,{placeholder:`cell name`,value:V,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),M(null))},onChange:e=>x({cellId:R,name:e})})]})]}))},rightElement:(0,v.jsx)(l,{placeholder:`cell name`,value:V,onChange:e=>x({cellId:R,name:e}),onEnterKey:()=>g?.()}),hidden:Y},{icon:(0,v.jsx)(we,{size:13,strokeWidth:1.5}),label:`Copy link to cell`,disabled:!_(V),tooltip:_(V)?void 0:`Only named cells can be linked to`,handle:async()=>{await je(Ve(V)),Me({description:`Link copied to clipboard`})}}],[{label:`Delete`,hidden:!A,variant:`danger`,icon:(0,v.jsx)(Ae,{size:13,strokeWidth:1.5}),handle:()=>{j({cellId:R})}}]].map(Ue).filter(He),o[15]=T,o[16]=P,o[17]=I,o[18]=F,o[19]=A,o[20]=R,o[21]=E,o[22]=g,o[23]=z.disabled,o[24]=z.hide_code,o[25]=y,o[26]=j,o[27]=B,o[28]=U,o[29]=H,o[30]=Y,o[31]=D,o[32]=S,o[33]=V,o[34]=M,o[35]=L,o[36]=w,o[37]=C,o[38]=N,o[39]=O,o[40]=Z,o[41]=Q,o[42]=K,o[43]=J,o[44]=b,o[45]=x,o[46]=$):$=o[46],$}function He(e){return e.length>0}function Ue(e){return e.filter(b)}function b(e){return!e.hidden}function We(e){e?.stopPropagation(),e?.preventDefault()}export{p as a,m as i,g as n,f as o,h as r,d as s,y as t};
@@ -1 +1 @@
1
- import{r as e,t}from"./useEvent-Dfcbgjhg.js";import{D as n,b as r,v as i}from"./cells-BRkCaSsh.js";import{t as a}from"./compiler-runtime-BrajqUja.js";import{t as o}from"./useEventListener-D9cftcHj.js";import{t as s}from"./jsx-runtime-B74pBk57.js";import{t as c}from"./button-COI-NGrx.js";import{t as l}from"./createLucideIcon-DfJ2oMlA.js";import{t as u}from"./use-toast-Wu434mLr.js";import{r as d}from"./requests-lt0JK8Jt.js";import{n as f}from"./renderShortcut-BkVJQ_Zh.js";var p=l(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),m=a(),h=s(),g=e=>{let t=(0,m.c)(7),n;t[0]===e?n=t[1]:(n=t=>{(t.ctrlKey||t.metaKey)&&t.key===`z`&&(t.preventDefault(),t.stopPropagation(),e.onClick?.(t))},t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={capture:!0},t[2]=r):r=t[2],o(window,`keydown`,n,r);let i=e.children??`Undo`,a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,h.jsx)(f,{className:`ml-2`,shortcut:`cmd-z`}),t[3]=a):a=t[3];let s;return t[4]!==i||t[5]!==e?(s=(0,h.jsxs)(c,{"data-testid":`undo-button`,size:`sm`,variant:`outline`,...e,children:[i,` `,a]}),t[4]=i,t[5]=e,t[6]=s):s=t[6],s};function _(){let a=(0,m.c)(4),{deleteCell:o,undoDeleteCell:s}=n(),{sendDeleteCell:c}=d(),l;return a[0]!==o||a[1]!==c||a[2]!==s?(l=t=>{if(e.get(i))return;let{cellId:n}=t,a=(e.get(r).cellData[n]?.code??``).trim()===``;if(o({cellId:n}),c({cellId:n}).catch(()=>{s()}),!a){let{dismiss:e}=u({title:`Cell deleted`,description:`You can bring it back by clicking undo or through the command palette.`,action:(0,h.jsx)(g,{"data-testid":`undo-delete-button`,onClick:()=>{s(),t()}})}),t=e}},a[0]=o,a[1]=c,a[2]=s,a[3]=l):l=a[3],t(l)}function v(){let r=(0,m.c)(4),{deleteCell:a,undoDeleteCell:o}=n(),{sendDeleteCell:s}=d(),c;return r[0]!==a||r[1]!==s||r[2]!==o?(c=async t=>{if(e.get(i))return;let{cellIds:n}=t;for(let e of n)await s({cellId:e}).then(()=>{a({cellId:e})});let{dismiss:r}=u({title:`Cells deleted`,action:(0,h.jsx)(g,{"data-testid":`undo-delete-button`,onClick:()=>{for(let e of n)o();c()}})}),c=r},r[0]=a,r[1]=s,r[2]=o,r[3]=c):c=r[3],t(c)}export{p as i,v as n,g as r,_ as t};
1
+ import{r as e,t}from"./useEvent-Dfcbgjhg.js";import{D as n,b as r,v as i}from"./cells-rA_jsZCj.js";import{t as a}from"./compiler-runtime-BrajqUja.js";import{t as o}from"./useEventListener-D9cftcHj.js";import{t as s}from"./jsx-runtime-B74pBk57.js";import{t as c}from"./button-COI-NGrx.js";import{t as l}from"./createLucideIcon-DfJ2oMlA.js";import{t as u}from"./use-toast-Wu434mLr.js";import{r as d}from"./requests-lt0JK8Jt.js";import{n as f}from"./renderShortcut-BkVJQ_Zh.js";var p=l(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),m=a(),h=s(),g=e=>{let t=(0,m.c)(7),n;t[0]===e?n=t[1]:(n=t=>{(t.ctrlKey||t.metaKey)&&t.key===`z`&&(t.preventDefault(),t.stopPropagation(),e.onClick?.(t))},t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={capture:!0},t[2]=r):r=t[2],o(window,`keydown`,n,r);let i=e.children??`Undo`,a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,h.jsx)(f,{className:`ml-2`,shortcut:`cmd-z`}),t[3]=a):a=t[3];let s;return t[4]!==i||t[5]!==e?(s=(0,h.jsxs)(c,{"data-testid":`undo-button`,size:`sm`,variant:`outline`,...e,children:[i,` `,a]}),t[4]=i,t[5]=e,t[6]=s):s=t[6],s};function _(){let a=(0,m.c)(4),{deleteCell:o,undoDeleteCell:s}=n(),{sendDeleteCell:c}=d(),l;return a[0]!==o||a[1]!==c||a[2]!==s?(l=t=>{if(e.get(i))return;let{cellId:n}=t,a=(e.get(r).cellData[n]?.code??``).trim()===``;if(o({cellId:n}),c({cellId:n}).catch(()=>{s()}),!a){let{dismiss:e}=u({title:`Cell deleted`,description:`You can bring it back by clicking undo or through the command palette.`,action:(0,h.jsx)(g,{"data-testid":`undo-delete-button`,onClick:()=>{s(),t()}})}),t=e}},a[0]=o,a[1]=c,a[2]=s,a[3]=l):l=a[3],t(l)}function v(){let r=(0,m.c)(4),{deleteCell:a,undoDeleteCell:o}=n(),{sendDeleteCell:s}=d(),c;return r[0]!==a||r[1]!==s||r[2]!==o?(c=async t=>{if(e.get(i))return;let{cellIds:n}=t;for(let e of n)await s({cellId:e}).then(()=>{a({cellId:e})});let{dismiss:r}=u({title:`Cells deleted`,action:(0,h.jsx)(g,{"data-testid":`undo-delete-button`,onClick:()=>{for(let e of n)o();c()}})}),c=r},r[0]=a,r[1]=s,r[2]=o,r[3]=c):c=r[3],t(c)}export{p as i,v as n,g as r,_ as t};