@marimo-team/frontend 0.25.3-dev26 → 0.25.3-dev27

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 (79) hide show
  1. package/dist/assets/{CellStatus-O0rU3_5j.js → CellStatus-CfD06qo-.js} +1 -1
  2. package/dist/assets/{ErrorBoundary-BkSCfv3B.js → ErrorBoundary-CnJNKrcX.js} +2 -2
  3. package/dist/assets/{JsonOutput-Dq6MGIMV.js → JsonOutput-BCPSUbOq.js} +1 -1
  4. package/dist/assets/{MarimoErrorOutput-BLtCVffa.js → MarimoErrorOutput-ClUcRTow.js} +1 -1
  5. package/dist/assets/{RenderHTML-PtQ99V0D.js → RenderHTML-D-cBOIod.js} +1 -1
  6. package/dist/assets/{RunButton-B8KRdPZ-.js → RunButton-DshU7w3x.js} +1 -1
  7. package/dist/assets/{add-cell-with-ai-BOBZjUxI.js → add-cell-with-ai-C7D8CWOd.js} +1 -1
  8. package/dist/assets/{add-connection-dialog-DP62zXw2.js → add-connection-dialog-DWzd_jMJ.js} +1 -1
  9. package/dist/assets/{agent-panel-BFul7UiF.js → agent-panel-7Uwq4KQ4.js} +1 -1
  10. package/dist/assets/{ai-model-dropdown-sTKkdrbX.js → ai-model-dropdown-BHfJ-Lss.js} +1 -1
  11. package/dist/assets/{app-config-button-Bp44UZdD.js → app-config-button-DlGrZ2Ni.js} +1 -1
  12. package/dist/assets/{blob-ykpU69Lk.js → blob-CyjiNaHn.js} +1 -1
  13. package/dist/assets/{cell-editor-B7YlotyH.js → cell-editor-C9lnOiSZ.js} +1 -1
  14. package/dist/assets/{cell-link-CmO9D2a2.js → cell-link-CF9EP0SZ.js} +1 -1
  15. package/dist/assets/{cells-BMs-CYDt.js → cells-CDwPlSdp.js} +1 -1
  16. package/dist/assets/{chat-display-Dw8HQAAY.js → chat-display-7HpKaid1.js} +1 -1
  17. package/dist/assets/{chat-panel-DPDZrfoJ.js → chat-panel-BNZZnlZ9.js} +1 -1
  18. package/dist/assets/{chat-ui-BxnFw9Za.js → chat-ui-DP_BiBUt.js} +1 -1
  19. package/dist/assets/{code-visibility-CGVmpSdE.js → code-visibility-BwDOkyau.js} +1 -1
  20. package/dist/assets/{column-preview-BQ4k86Lv.js → column-preview-BKGZT0YR.js} +1 -1
  21. package/dist/assets/{command-palette-BfxYnBUD.js → command-palette-9lUxAHuv.js} +1 -1
  22. package/dist/assets/{common-CzWTWhcY.js → common-py6DRg3V.js} +1 -1
  23. package/dist/assets/{components-C-p2nJ78.js → components-Bfaspyl-.js} +1 -1
  24. package/dist/assets/{config-BtRLgrlt.js → config-BHq_PhD6.js} +1 -1
  25. package/dist/assets/{config-CMUeR8Wr.js → config-D-dRq5S4.js} +1 -1
  26. package/dist/assets/{datasource-CEDUN47W.js → datasource-pmZZLcSP.js} +1 -1
  27. package/dist/assets/{dependency-graph-panel-KWuUrABU.js → dependency-graph-panel-Dyz3xfjn.js} +1 -1
  28. package/dist/assets/{documentation-panel-T1wYs9YS.js → documentation-panel-C7kvIGCE.js} +1 -1
  29. package/dist/assets/{download-Bt4rM2gS.js → download-D_fcZeOz.js} +1 -1
  30. package/dist/assets/{edit-page-DIxL37jf.js → edit-page-APqEwRZV.js} +4 -4
  31. package/dist/assets/{error-entries-CQTemuon.js → error-entries-DsT8TWWD.js} +1 -1
  32. package/dist/assets/{error-panel-BmlN965r.js → error-panel-L-k_BipK.js} +1 -1
  33. package/dist/assets/{feedback-button-CO89l9HJ.js → feedback-button-Df_o0zuW.js} +1 -1
  34. package/dist/assets/feedback-button-TiBA_epa.js +1 -0
  35. package/dist/assets/{file-explorer-panel-Bs25Xwng.js → file-explorer-panel-Cc92lLYU.js} +1 -1
  36. package/dist/assets/{file-name-input-DgR3ynbz.js → file-name-input-yNGA-94L.js} +1 -1
  37. package/dist/assets/{floating-outline-kOJ_XOxZ.js → floating-outline-CPpTadCY.js} +1 -1
  38. package/dist/assets/{gallery-page--AiS7R2S.js → gallery-page-OIIqN4HS.js} +1 -1
  39. package/dist/assets/{glide-data-editor-FopeFe04.js → glide-data-editor-DcMt5kAn.js} +1 -1
  40. package/dist/assets/{home-page-DEUEDKZQ.js → home-page-DK_tEqpx.js} +1 -1
  41. package/dist/assets/{hooks-CsCHI0xl.js → hooks-g-0IObKK.js} +1 -1
  42. package/dist/assets/{index-BXheV3uz.js → index-CoUUYFMX.js} +5 -5
  43. package/dist/assets/{layout-CcQIAduN.js → layout-C9Q0z3mP.js} +3 -3
  44. package/dist/assets/{logs-panel-Cj-mRfbP.js → logs-panel-GbibvoIL.js} +1 -1
  45. package/dist/assets/{markdown-renderer-Dg2Tj8xg.js → markdown-renderer-DVpG4g2Y.js} +1 -1
  46. package/dist/assets/{name-cell-input-DhWcLBL9.js → name-cell-input-DCDJfAiP.js} +1 -1
  47. package/dist/assets/{outline-panel-DCCN7CCz.js → outline-panel-B23tzehc.js} +1 -1
  48. package/dist/assets/{packages-panel-cI3VRnI0.js → packages-panel-CrmQCics.js} +1 -1
  49. package/dist/assets/{panel-accordion-state-CrUAB8rV.js → panel-accordion-state-D-jVlW4Q.js} +1 -1
  50. package/dist/assets/{panels-DeK2CjCU.js → panels-DwaA89uh.js} +1 -1
  51. package/dist/assets/{process-output-C0AVlTcL.js → process-output-DhdIYvyI.js} +1 -1
  52. package/dist/assets/{readonly-code-display-CEGKPKlf.js → readonly-code-display-D2gaiZLE.js} +1 -1
  53. package/dist/assets/{readonly-python-code-kOLuuvuL.js → readonly-python-code-CsSJ2wTV.js} +1 -1
  54. package/dist/assets/{reveal-component-m_Q_Dhsa.js → reveal-component-BTRgLtDz.js} +1 -1
  55. package/dist/assets/{run-page-ZPnT0tT8.js → run-page-DjRPCSj2.js} +1 -1
  56. package/dist/assets/{runtime-details-state-DRpKx1d7.js → runtime-details-state-CeS_Nzjx.js} +1 -1
  57. package/dist/assets/{scratchpad-panel-4r5I7_4T.js → scratchpad-panel-CZpqXmy8.js} +1 -1
  58. package/dist/assets/{session-panel-B-fUHivk.js → session-panel-BMWyoCFi.js} +1 -1
  59. package/dist/assets/{snippets-panel-QqliOy2l.js → snippets-panel-B_CKVhYM.js} +1 -1
  60. package/dist/assets/{state-BAKG3nB6.js → state-BW2aGLUH.js} +1 -1
  61. package/dist/assets/{state-BiuybHTd.js → state-Payxmcji.js} +1 -1
  62. package/dist/assets/{terminal-CP30at9D.js → terminal-Mpb1tujO.js} +1 -1
  63. package/dist/assets/{tracing-Cg6nJ9oa.js → tracing-CLhGBNZ1.js} +1 -1
  64. package/dist/assets/{tracing-panel-_OkwL3ST.js → tracing-panel-CK9sn60_.js} +2 -2
  65. package/dist/assets/{tree-actions-D5U7Yym8.js → tree-actions-Bi2wp_hj.js} +1 -1
  66. package/dist/assets/{useAddCell-C3jdhSc9.js → useAddCell-D5SZ9USq.js} +1 -1
  67. package/dist/assets/{useBoolean-BHCcNH_F.js → useBoolean-Dd06vW7f.js} +1 -1
  68. package/dist/assets/{useCellActionButton-Db-2kvJ0.js → useCellActionButton-DP91E5bD.js} +1 -1
  69. package/dist/assets/{useDeleteCell-D0dwhgwH.js → useDeleteCell-Bo9Jw4f-.js} +1 -1
  70. package/dist/assets/{useDependencyPanelTab-BjQVPzm0.js → useDependencyPanelTab-Dw75bZEs.js} +1 -1
  71. package/dist/assets/{useInstallPackage-B-krIeGp.js → useInstallPackage-EM5qIaUh.js} +1 -1
  72. package/dist/assets/{useNotebookActions-CY_gTNzg.js → useNotebookActions-Cu_nBy5g.js} +1 -1
  73. package/dist/assets/{useRunCells-Dyf_vzJl.js → useRunCells-y87fM1aq.js} +1 -1
  74. package/dist/assets/{useSplitCell-DA8ujlOv.js → useSplitCell-CT6wuo-t.js} +1 -1
  75. package/dist/assets/{vega-component-CaZvZfgt.js → vega-component-Db2GDrK_.js} +1 -1
  76. package/dist/index.html +24 -24
  77. package/package.json +1 -1
  78. package/src/core/host/protocol.ts +3 -1
  79. package/dist/assets/feedback-button-QWfd9e1X.js +0 -1
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t}from"./useEvent-Dfcbgjhg.js";import{t as n}from"./react-DVplv7_D.js";import{D as r,Gi as i,Rt as a,Xi as o,Yi as s,zt as c}from"./cells-BMs-CYDt.js";import{t as l}from"./compiler-runtime-BrajqUja.js";import{s as u}from"./config-CA1V-wjh.js";import{t as d}from"./jsx-runtime-B74pBk57.js";import{l as f,p,yt as m}from"./JsonOutput-Dq6MGIMV.js";import{t as h}from"./tooltip-C9TuY18o.js";import{r as g,t as _}from"./button-COI-NGrx.js";import{t as v}from"./createLucideIcon-DfJ2oMlA.js";import{t as y}from"./useLifecycle-Mq4gc5kS.js";import{t as b}from"./spinner-DyNE-o8o.js";import{t as x}from"./copy-icon-BIiRXh_3.js";import{r as S}from"./requests-lt0JK8Jt.js";import{r as C}from"./useTheme-n8Dj1zH7.js";import{t as w}from"./I18nProvider-Cg2I_s1_.js";import{i as T}from"./numbers-Mk3-CcoU.js";var E=v(`square-plus`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),D=l(),O=e(n(),1),k=d(),A=e=>{let t=(0,D.c)(53),{table:n,column:r,preview:i,onAddColumnChart:a,sqlTableContext:c}=e,{theme:l}=C(),{previewDatasetColumn:u}=S(),{locale:d}=w(),f;t[0]!==r.name||t[1]!==u||t[2]!==c||t[3]!==n.name||t[4]!==n.source||t[5]!==n.source_type?(f=()=>{u({source:n.source,tableName:n.name,columnName:r.name,sourceType:n.source_type,fullyQualifiedTableName:o(c,n.name)})},t[0]=r.name,t[1]=u,t[2]=c,t[3]=n.name,t[4]=n.source,t[5]=n.source_type,t[6]=f):f=t[6];let m=f,v;if(t[7]!==i||t[8]!==m||t[9]!==n.source_type?(v=()=>{i||n.source_type!==`connection`&&n.source_type!==`catalog`&&m()},t[7]=i,t[8]=m,t[9]=n.source_type,t[10]=v):v=t[10],y(v),n.source_type===`connection`){let e=r.name,i=r.external_type,o;t[11]!==r.name||t[12]!==a||t[13]!==c||t[14]!==n?(o=g.stopPropagation(()=>{a(s({table:n,columnName:r.name,sqlTableContext:c}))}),t[11]=r.name,t[12]=a,t[13]=c,t[14]=n,t[15]=o):o=t[15];let l;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,k.jsx)(E,{className:`h-3 w-3 mr-1`}),t[16]=l):l=t[16];let u;t[17]===o?u=t[18]:(u=(0,k.jsxs)(_,{variant:`outline`,size:`xs`,onClick:o,children:[l,` Add SQL cell`]}),t[17]=o,t[18]=u);let d;return t[19]!==r.external_type||t[20]!==r.name||t[21]!==u?(d=(0,k.jsxs)(`span`,{className:`text-xs text-muted-foreground gap-2 flex items-center justify-between pl-7`,children:[e,` (`,i,`)`,u]}),t[19]=r.external_type,t[20]=r.name,t[21]=u,t[22]=d):d=t[22],d}if(n.source_type===`catalog`){let e;return t[23]!==r.external_type||t[24]!==r.name?(e=(0,k.jsxs)(`span`,{className:`text-xs text-muted-foreground gap-2 flex items-center justify-between pl-7`,children:[r.name,` (`,r.external_type,`)`]}),t[23]=r.external_type,t[24]=r.name,t[25]=e):e=t[25],e}if(!i){let e;return t[26]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,k.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Loading...`}),t[26]=e):e=t[26],e}let b;t[27]!==i.error||t[28]!==i.missing_packages||t[29]!==m?(b=i.error&&j({error:i.error,missingPackages:i.missing_packages,refetchPreview:m}),t[27]=i.error,t[28]=i.missing_packages,t[29]=m,t[30]=b):b=t[30];let x=b,T;t[31]!==r.type||t[32]!==d||t[33]!==i.stats?(T=i.stats&&M({stats:i.stats,dataType:r.type,locale:d}),t[31]=r.type,t[32]=d,t[33]=i.stats,t[34]=T):T=t[34];let O=T,A;t[35]!==i.chart_spec||t[36]!==l?(A=i.chart_spec&&P(i.chart_spec,l),t[35]=i.chart_spec,t[36]=l,t[37]=A):A=t[37];let N=A,I;t[38]!==i.chart_code||t[39]!==n.source_type?(I=i.chart_code&&n.source_type===`local`&&(0,k.jsx)(F,{chartCode:i.chart_code}),t[38]=i.chart_code,t[39]=n.source_type,t[40]=I):I=t[40];let L=I,R;t[41]!==r.name||t[42]!==a||t[43]!==c||t[44]!==n?(R=n.source_type===`duckdb`&&(0,k.jsx)(h,{content:`Add SQL cell`,delayDuration:400,children:(0,k.jsx)(_,{variant:`outline`,size:`icon`,className:`z-10 bg-background absolute right-1 -top-1`,onClick:g.stopPropagation(()=>{a(s({table:n,columnName:r.name,sqlTableContext:c}))}),children:(0,k.jsx)(E,{className:`h-3 w-3`})})}),t[41]=r.name,t[42]=a,t[43]=c,t[44]=n,t[45]=R):R=t[45];let z=R;if(!x&&!O&&!N){let e;return t[46]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,k.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`No data`}),t[46]=e):e=t[46],e}let B;return t[47]!==L||t[48]!==z||t[49]!==N||t[50]!==x||t[51]!==O?(B=(0,k.jsxs)(p,{children:[x,L,z,N,O]}),t[47]=L,t[48]=z,t[49]=N,t[50]=x,t[51]=O,t[52]=B):B=t[52],B};function j({error:e,missingPackages:t,refetchPreview:n}){return(0,k.jsxs)(`div`,{className:`text-xs text-muted-foreground p-2 border border-border rounded flex items-center justify-between`,children:[(0,k.jsx)(`span`,{children:e}),t&&(0,k.jsx)(f,{packages:t,showMaxPackages:1,className:`w-32`,onInstall:n})]})}function M({stats:e,dataType:t,locale:n}){return(0,k.jsx)(`div`,{className:`gap-x-16 gap-y-1 grid grid-cols-2-fit border rounded p-2 empty:hidden`,children:Object.entries(e).map(([e,r])=>r==null?null:(0,k.jsxs)(`div`,{className:`flex items-center gap-1 group`,children:[(0,k.jsx)(`span`,{className:`text-xs min-w-[60px] capitalize`,children:i(e,t)}),(0,k.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground tracking-wide`,children:T(r,n)}),(0,k.jsx)(x,{className:`h-3 w-3 invisible group-hover:visible`,value:String(r)})]},e))})}var N=(0,k.jsx)(`div`,{className:`flex justify-center`,children:(0,k.jsx)(b,{className:`size-4`})});function P(e,t){return(0,k.jsx)(O.Suspense,{fallback:N,children:(0,k.jsx)(m,{"data-container-width":`container`,spec:(e=>({...e,background:`transparent`,config:{...e.config,background:`transparent`}}))(JSON.parse(e)),options:{theme:t===`dark`?`dark`:`vox`,height:100,width:`container`,actions:!1,renderer:`canvas`}})})}var F=e=>{let n=(0,D.c)(10),{chartCode:i}=e,o=t(u),s=a(),{createNewCell:l}=r(),d;n[0]!==o||n[1]!==l||n[2]!==s?(d=e=>{e.includes(`alt`)&&c({autoInstantiate:o,createNewCell:l,fromCellId:s}),l({code:e,before:!1,cellId:s??`__end__`})},n[0]=o,n[1]=l,n[2]=s,n[3]=d):d=n[3];let f=d,p;n[4]!==i||n[5]!==f?(p=g.stopPropagation(()=>f(i)),n[4]=i,n[5]=f,n[6]=p):p=n[6];let m;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,k.jsx)(E,{className:`h-3 w-3`}),n[7]=m):m=n[7];let v;return n[8]===p?v=n[9]:(v=(0,k.jsx)(h,{content:`Add chart to notebook`,delayDuration:400,children:(0,k.jsx)(_,{variant:`outline`,size:`icon`,className:`z-10 bg-background absolute right-1 -top-0.5`,onClick:p,children:m})}),n[8]=p,n[9]=v),v};export{M as a,j as i,A as n,E as o,P as r,F as t};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t}from"./useEvent-Dfcbgjhg.js";import{t as n}from"./react-DVplv7_D.js";import{D as r,Gi as i,Rt as a,Xi as o,Yi as s,zt as c}from"./cells-CDwPlSdp.js";import{t as l}from"./compiler-runtime-BrajqUja.js";import{s as u}from"./config-CA1V-wjh.js";import{t as d}from"./jsx-runtime-B74pBk57.js";import{l as f,p,yt as m}from"./JsonOutput-BCPSUbOq.js";import{t as h}from"./tooltip-C9TuY18o.js";import{r as g,t as _}from"./button-COI-NGrx.js";import{t as v}from"./createLucideIcon-DfJ2oMlA.js";import{t as y}from"./useLifecycle-Mq4gc5kS.js";import{t as b}from"./spinner-DyNE-o8o.js";import{t as x}from"./copy-icon-BIiRXh_3.js";import{r as S}from"./requests-lt0JK8Jt.js";import{r as C}from"./useTheme-n8Dj1zH7.js";import{t as w}from"./I18nProvider-Cg2I_s1_.js";import{i as T}from"./numbers-Mk3-CcoU.js";var E=v(`square-plus`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),D=l(),O=e(n(),1),k=d(),A=e=>{let t=(0,D.c)(53),{table:n,column:r,preview:i,onAddColumnChart:a,sqlTableContext:c}=e,{theme:l}=C(),{previewDatasetColumn:u}=S(),{locale:d}=w(),f;t[0]!==r.name||t[1]!==u||t[2]!==c||t[3]!==n.name||t[4]!==n.source||t[5]!==n.source_type?(f=()=>{u({source:n.source,tableName:n.name,columnName:r.name,sourceType:n.source_type,fullyQualifiedTableName:o(c,n.name)})},t[0]=r.name,t[1]=u,t[2]=c,t[3]=n.name,t[4]=n.source,t[5]=n.source_type,t[6]=f):f=t[6];let m=f,v;if(t[7]!==i||t[8]!==m||t[9]!==n.source_type?(v=()=>{i||n.source_type!==`connection`&&n.source_type!==`catalog`&&m()},t[7]=i,t[8]=m,t[9]=n.source_type,t[10]=v):v=t[10],y(v),n.source_type===`connection`){let e=r.name,i=r.external_type,o;t[11]!==r.name||t[12]!==a||t[13]!==c||t[14]!==n?(o=g.stopPropagation(()=>{a(s({table:n,columnName:r.name,sqlTableContext:c}))}),t[11]=r.name,t[12]=a,t[13]=c,t[14]=n,t[15]=o):o=t[15];let l;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,k.jsx)(E,{className:`h-3 w-3 mr-1`}),t[16]=l):l=t[16];let u;t[17]===o?u=t[18]:(u=(0,k.jsxs)(_,{variant:`outline`,size:`xs`,onClick:o,children:[l,` Add SQL cell`]}),t[17]=o,t[18]=u);let d;return t[19]!==r.external_type||t[20]!==r.name||t[21]!==u?(d=(0,k.jsxs)(`span`,{className:`text-xs text-muted-foreground gap-2 flex items-center justify-between pl-7`,children:[e,` (`,i,`)`,u]}),t[19]=r.external_type,t[20]=r.name,t[21]=u,t[22]=d):d=t[22],d}if(n.source_type===`catalog`){let e;return t[23]!==r.external_type||t[24]!==r.name?(e=(0,k.jsxs)(`span`,{className:`text-xs text-muted-foreground gap-2 flex items-center justify-between pl-7`,children:[r.name,` (`,r.external_type,`)`]}),t[23]=r.external_type,t[24]=r.name,t[25]=e):e=t[25],e}if(!i){let e;return t[26]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,k.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Loading...`}),t[26]=e):e=t[26],e}let b;t[27]!==i.error||t[28]!==i.missing_packages||t[29]!==m?(b=i.error&&j({error:i.error,missingPackages:i.missing_packages,refetchPreview:m}),t[27]=i.error,t[28]=i.missing_packages,t[29]=m,t[30]=b):b=t[30];let x=b,T;t[31]!==r.type||t[32]!==d||t[33]!==i.stats?(T=i.stats&&M({stats:i.stats,dataType:r.type,locale:d}),t[31]=r.type,t[32]=d,t[33]=i.stats,t[34]=T):T=t[34];let O=T,A;t[35]!==i.chart_spec||t[36]!==l?(A=i.chart_spec&&P(i.chart_spec,l),t[35]=i.chart_spec,t[36]=l,t[37]=A):A=t[37];let N=A,I;t[38]!==i.chart_code||t[39]!==n.source_type?(I=i.chart_code&&n.source_type===`local`&&(0,k.jsx)(F,{chartCode:i.chart_code}),t[38]=i.chart_code,t[39]=n.source_type,t[40]=I):I=t[40];let L=I,R;t[41]!==r.name||t[42]!==a||t[43]!==c||t[44]!==n?(R=n.source_type===`duckdb`&&(0,k.jsx)(h,{content:`Add SQL cell`,delayDuration:400,children:(0,k.jsx)(_,{variant:`outline`,size:`icon`,className:`z-10 bg-background absolute right-1 -top-1`,onClick:g.stopPropagation(()=>{a(s({table:n,columnName:r.name,sqlTableContext:c}))}),children:(0,k.jsx)(E,{className:`h-3 w-3`})})}),t[41]=r.name,t[42]=a,t[43]=c,t[44]=n,t[45]=R):R=t[45];let z=R;if(!x&&!O&&!N){let e;return t[46]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,k.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`No data`}),t[46]=e):e=t[46],e}let B;return t[47]!==L||t[48]!==z||t[49]!==N||t[50]!==x||t[51]!==O?(B=(0,k.jsxs)(p,{children:[x,L,z,N,O]}),t[47]=L,t[48]=z,t[49]=N,t[50]=x,t[51]=O,t[52]=B):B=t[52],B};function j({error:e,missingPackages:t,refetchPreview:n}){return(0,k.jsxs)(`div`,{className:`text-xs text-muted-foreground p-2 border border-border rounded flex items-center justify-between`,children:[(0,k.jsx)(`span`,{children:e}),t&&(0,k.jsx)(f,{packages:t,showMaxPackages:1,className:`w-32`,onInstall:n})]})}function M({stats:e,dataType:t,locale:n}){return(0,k.jsx)(`div`,{className:`gap-x-16 gap-y-1 grid grid-cols-2-fit border rounded p-2 empty:hidden`,children:Object.entries(e).map(([e,r])=>r==null?null:(0,k.jsxs)(`div`,{className:`flex items-center gap-1 group`,children:[(0,k.jsx)(`span`,{className:`text-xs min-w-[60px] capitalize`,children:i(e,t)}),(0,k.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground tracking-wide`,children:T(r,n)}),(0,k.jsx)(x,{className:`h-3 w-3 invisible group-hover:visible`,value:String(r)})]},e))})}var N=(0,k.jsx)(`div`,{className:`flex justify-center`,children:(0,k.jsx)(b,{className:`size-4`})});function P(e,t){return(0,k.jsx)(O.Suspense,{fallback:N,children:(0,k.jsx)(m,{"data-container-width":`container`,spec:(e=>({...e,background:`transparent`,config:{...e.config,background:`transparent`}}))(JSON.parse(e)),options:{theme:t===`dark`?`dark`:`vox`,height:100,width:`container`,actions:!1,renderer:`canvas`}})})}var F=e=>{let n=(0,D.c)(10),{chartCode:i}=e,o=t(u),s=a(),{createNewCell:l}=r(),d;n[0]!==o||n[1]!==l||n[2]!==s?(d=e=>{e.includes(`alt`)&&c({autoInstantiate:o,createNewCell:l,fromCellId:s}),l({code:e,before:!1,cellId:s??`__end__`})},n[0]=o,n[1]=l,n[2]=s,n[3]=d):d=n[3];let f=d,p;n[4]!==i||n[5]!==f?(p=g.stopPropagation(()=>f(i)),n[4]=i,n[5]=f,n[6]=p):p=n[6];let m;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,k.jsx)(E,{className:`h-3 w-3`}),n[7]=m):m=n[7];let v;return n[8]===p?v=n[9]:(v=(0,k.jsx)(h,{content:`Add chart to notebook`,delayDuration:400,children:(0,k.jsx)(_,{variant:`outline`,size:`icon`,className:`z-10 bg-background absolute right-1 -top-0.5`,onClick:p,children:m})}),n[8]=p,n[9]=v),v};export{M as a,j as i,A as n,E as o,P as r,F as t};
@@ -1 +1 @@
1
- import{c as e,l as t}from"./useEvent-Dfcbgjhg.js";import{Ft as n,_n as r,bn as i,gn as a,hn as o,mn as s,pn as c,vn as l,yn as u}from"./cells-BMs-CYDt.js";import{t as d}from"./compiler-runtime-BrajqUja.js";import{C as f,S as p,h as m}from"./config-CA1V-wjh.js";import{m as h,t as g,u as _}from"./useEventListener-D9cftcHj.js";import{t as v}from"./objects-snlMn4yk.js";import{t as y}from"./jsx-runtime-B74pBk57.js";import{O as b,k as x}from"./ai-model-dropdown-sTKkdrbX.js";import{t as S}from"./useCellActionButton-Db-2kvJ0.js";import{a as C,t as w}from"./useNotebookActions-CY_gTNzg.js";import{r as T}from"./requests-lt0JK8Jt.js";import{t as E}from"./renderShortcut-C1JwYcqW.js";import{r as D}from"./feedback-button-CO89l9HJ.js";var O=d(),k=3;function A(){let e=(0,O.c)(7),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=D(`marimo:commands`,t),i;e[1]!==n||e[2]!==r?(i=e=>{let t=j([e,...n]);r(t.slice(0,k))},e[1]=n,e[2]=r,e[3]=i):i=e[3];let a;return e[4]!==n||e[5]!==i?(a={recentCommands:n,addRecentCommand:i},e[4]=n,e[5]=i,e[6]=a):a=e[6],a}function j(e){return[...new Set(e)]}function M(e){return e.dropdown!==void 0}function N(e,t=``){return e.flatMap(e=>!e.label||e.hidden?[]:M(e)?N(e.dropdown,`${t+e.label} > `):{...e,label:t+e.label,additionalKeywords:e.additionalKeywords})}function P(){let e=(0,O.c)(87),[t,n]=f(),[r,i]=p(),{saveAppConfig:a,saveUserConfig:o}=T(),s;e[0]!==o||e[1]!==n?(s=async e=>{await o({config:e}).then(()=>{n(t=>({...t,...e}))})},e[0]=o,e[1]=n,e[2]=s):s=e[2];let c=s,l;e[3]!==a||e[4]!==i?(l=async e=>{await a({config:e}).then(()=>{i(e)})},e[3]=a,e[4]=i,e[5]=l):l=e[5];let u=l,d;if(e[6]!==r||e[7]!==t.completion||e[8]!==t.display||e[9]!==t.keymap||e[10]!==u||e[11]!==c){let n;e[13]===r?n=e[14]:(n=e=>e!==r.width,e[13]=r,e[14]=n);let i;e[15]!==r||e[16]!==u?(i=e=>({label:`App config > Set width=${e}`,handle:()=>{u({...r,width:e})}}),e[15]=r,e[16]=u,e[17]=i):i=e[17];let a;e[18]!==t.display||e[19]!==c?(a={label:`Config > Set theme: dark`,handle:()=>{c({display:{...t.display,theme:`dark`}})}},e[18]=t.display,e[19]=c,e[20]=a):a=e[20];let o;e[21]!==t.display||e[22]!==c?(o={label:`Config > Set theme: light`,handle:()=>{c({display:{...t.display,theme:`light`}})}},e[21]=t.display,e[22]=c,e[23]=o):o=e[23];let s;e[24]!==t.display||e[25]!==c?(s={label:`Config > Set theme: system`,handle:()=>{c({display:{...t.display,theme:`system`}})}},e[24]=t.display,e[25]=c,e[26]=s):s=e[26];let l=t.keymap.preset===`vim`,f;e[27]!==t.keymap||e[28]!==c?(f=()=>{c({keymap:{...t.keymap,preset:`vim`}})},e[27]=t.keymap,e[28]=c,e[29]=f):f=e[29];let p;e[30]!==l||e[31]!==f?(p={label:`Config > Switch keymap to VIM`,hidden:l,handle:f},e[30]=l,e[31]=f,e[32]=p):p=e[32];let m=t.keymap.preset==="default",h;e[33]!==t.keymap||e[34]!==c?(h=()=>{c({keymap:{...t.keymap,preset:`default`}})},e[33]=t.keymap,e[34]=c,e[35]=h):h=e[35];let g;e[36]!==m||e[37]!==h?(g={label:`Config > Switch keymap to default (current: VIM)`,hidden:m,handle:h},e[36]=m,e[37]=h,e[38]=g):g=e[38];let _;e[39]!==t.completion||e[40]!==c?(_=()=>{c({completion:{...t.completion,copilot:!1}})},e[39]=t.completion,e[40]=c,e[41]=_):_=e[41];let v=t.completion.copilot!==`github`,y;e[42]!==_||e[43]!==v?(y={label:`Config > Disable GitHub Copilot`,handle:_,hidden:v},e[42]=_,e[43]=v,e[44]=y):y=e[44];let b;e[45]!==t.completion||e[46]!==c?(b=()=>{c({completion:{...t.completion,copilot:`github`}})},e[45]=t.completion,e[46]=c,e[47]=b):b=e[47];let S=t.completion.copilot===`github`,C;e[48]!==b||e[49]!==S?(C={label:`Config > Enable GitHub Copilot`,handle:b,hidden:S},e[48]=b,e[49]=S,e[50]=C):C=e[50];let w=!t.display.reference_highlighting,T;e[51]!==t.display||e[52]!==c?(T=()=>{c({display:{...t.display,reference_highlighting:!1}})},e[51]=t.display,e[52]=c,e[53]=T):T=e[53];let E;e[54]!==w||e[55]!==T?(E={label:`Config > Disable reference highlighting`,hidden:w,handle:T},e[54]=w,e[55]=T,e[56]=E):E=e[56];let D;e[57]!==t.display||e[58]!==c?(D=()=>{c({display:{...t.display,reference_highlighting:!0}})},e[57]=t.display,e[58]=c,e[59]=D):D=e[59];let O;e[60]!==t.display.reference_highlighting||e[61]!==D?(O={label:`Config > Enable reference highlighting`,hidden:t.display.reference_highlighting,handle:D},e[60]=t.display.reference_highlighting,e[61]=D,e[62]=O):O=e[62];let k=!(t.display.code_lens??!0),A;e[63]!==t.display||e[64]!==c?(A=()=>{c({display:{...t.display,code_lens:!1}})},e[63]=t.display,e[64]=c,e[65]=A):A=e[65];let j;e[66]!==k||e[67]!==A?(j={label:`Config > Disable code lens`,hidden:k,handle:A},e[66]=k,e[67]=A,e[68]=j):j=e[68];let M=t.display.code_lens??!0,N;e[69]!==t.display||e[70]!==c?(N=()=>{c({display:{...t.display,code_lens:!0}})},e[69]=t.display,e[70]=c,e[71]=N):N=e[71];let P;e[72]!==M||e[73]!==N?(P={label:`Config > Enable code lens`,hidden:M,handle:N},e[72]=M,e[73]=N,e[74]=P):P=e[74];let F=t.display.cell_output===`above`,I;e[75]!==t.display||e[76]!==c?(I=()=>{c({display:{...t.display,cell_output:`above`}})},e[75]=t.display,e[76]=c,e[77]=I):I=e[77];let L;e[78]!==F||e[79]!==I?(L={label:`Config > Set cell output area: above`,hidden:F,handle:I},e[78]=F,e[79]=I,e[80]=L):L=e[80];let R=t.display.cell_output===`below`,z;e[81]!==t.display||e[82]!==c?(z=()=>{c({display:{...t.display,cell_output:`below`}})},e[81]=t.display,e[82]=c,e[83]=z):z=e[83];let B;e[84]!==R||e[85]!==z?(B={label:`Config > Set cell output area: below`,hidden:R,handle:z},e[84]=R,e[85]=z,e[86]=B):B=e[86],d=[...x().filter(n).map(i),a,o,s,p,g,y,C,E,O,j,P,L,B].filter(ee),e[6]=r,e[7]=t.completion,e[8]=t.display,e[9]=t.keymap,e[10]=u,e[11]=c,e[12]=d}else d=e[12];return d}function ee(e){return!e.hidden}var F=y(),I=()=>{let d=(0,O.c)(37),[f,p]=e(C),y=b(),x=t(n),T=t(m),D;d[0]===x?D=d[1]:(D={cell:x},d[0]=x,d[1]=D);let k=S(D).flat();k=N(k);let j=P(),ee=w();ee=[...N(ee),...N(j)];let I=ee.filter(L),B=v.keyBy(I,R),{recentCommands:V,addRecentCommand:H}=A(),U;d[2]===V?U=d[3]:(U=new Set(V),d[2]=V,d[3]=U);let W=U,G;d[4]!==T||d[5]!==p?(G=e=>{h(T.getHotkey(`global.commandPalette`).key)(e)&&(e.preventDefault(),p(z))},d[4]=T,d[5]=p,d[6]=G):G=d[6],g(document,`keydown`,G);let K;d[7]!==H||d[8]!==T||d[9]!==y||d[10]!==p?(K=(e,t)=>{let n=y[e];if(!n)return null;let a=T.getHotkey(e);return(0,F.jsxs)(r,{disabled:t.disabled,keywords:a.additionalKeywords,onSelect:()=>{H(e),p(!1),requestAnimationFrame(()=>{n()})},value:a.name,children:[(0,F.jsxs)(`span`,{children:[a.name,t.tooltip&&(0,F.jsx)(`span`,{className:`ml-2`,children:t.tooltip})]}),(0,F.jsx)(i,{children:(0,F.jsx)(E,{shortcut:a.key})})]},e)},d[7]=H,d[8]=T,d[9]=y,d[10]=p,d[11]=K):K=d[11];let te=K,q;d[12]!==H||d[13]!==T||d[14]!==p?(q=e=>{let{label:t,handle:n,props:a,hotkey:o,additionalKeywords:s}=e,c=a===void 0?{}:a;return(0,F.jsxs)(r,{disabled:c.disabled,keywords:s,onSelect:()=>{H(t),p(!1),requestAnimationFrame(()=>{n()})},value:t,children:[(0,F.jsxs)(`span`,{children:[t,c.tooltip&&(0,F.jsxs)(`span`,{className:`ml-2`,children:[`(`,c.tooltip,`)`]})]}),o&&(0,F.jsx)(i,{children:(0,F.jsx)(E,{shortcut:T.getHotkey(o).key})})]},t)},d[12]=H,d[13]=T,d[14]=p,d[15]=q):q=d[15];let J=q,ne=c,Y;d[16]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,F.jsx)(a,{placeholder:`Type to search...`}),d[16]=Y):Y=d[16];let re=l,X;d[17]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,F.jsx)(s,{children:`No results found.`}),d[17]=X):X=d[17];let ie=V.length>0&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(o,{heading:`Recently Used`,children:V.map(e=>{let t=B[e];return _(e)?te(e,{disabled:t?.disabled,tooltip:t?.tooltip}):t&&!M(t)?J({label:t.label,handle:t.handleHeadless||t.handle,props:{disabled:t.disabled,tooltip:t.tooltip},additionalKeywords:t.additionalKeywords}):null})}),(0,F.jsx)(u,{})]}),ae=o,oe=T.iterate().map(e=>{if(W.has(e))return null;let t=B[e];return te(e,{disabled:t?.disabled,tooltip:t?.tooltip})}),se=I.map(e=>W.has(e.label)?null:J({label:e.label,handle:e.handleHeadless||e.handle,props:{disabled:e.disabled,tooltip:e.tooltip},additionalKeywords:e.additionalKeywords})),Z;d[18]!==W||d[19]!==J?(Z=e=>W.has(e.label)?null:J({label:`Cell > ${e.label}`,handle:e.handleHeadless||e.handle,props:{disabled:e.disabled,tooltip:e.tooltip},additionalKeywords:e.additionalKeywords}),d[18]=W,d[19]=J,d[20]=Z):Z=d[20];let ce=k.map(Z),Q;d[21]!==ae||d[22]!==se||d[23]!==ce||d[24]!==oe?(Q=(0,F.jsxs)(ae,{heading:`Commands`,children:[oe,se,ce]}),d[21]=ae,d[22]=se,d[23]=ce,d[24]=oe,d[25]=Q):Q=d[25];let $;d[26]!==re||d[27]!==Q||d[28]!==X||d[29]!==ie?($=(0,F.jsxs)(re,{children:[X,ie,Q]}),d[26]=re,d[27]=Q,d[28]=X,d[29]=ie,d[30]=$):$=d[30];let le;return d[31]!==ne||d[32]!==f||d[33]!==p||d[34]!==$||d[35]!==Y?(le=(0,F.jsxs)(ne,{open:f,onOpenChange:p,children:[Y,$]}),d[31]=ne,d[32]=f,d[33]=p,d[34]=$,d[35]=Y,d[36]=le):le=d[36],le};function L(e){return!e.hotkey}function R(e){return e.label}function z(e){return!e}export{I as default};
1
+ import{c as e,l as t}from"./useEvent-Dfcbgjhg.js";import{Ft as n,_n as r,bn as i,gn as a,hn as o,mn as s,pn as c,vn as l,yn as u}from"./cells-CDwPlSdp.js";import{t as d}from"./compiler-runtime-BrajqUja.js";import{C as f,S as p,h as m}from"./config-CA1V-wjh.js";import{m as h,t as g,u as _}from"./useEventListener-D9cftcHj.js";import{t as v}from"./objects-snlMn4yk.js";import{t as y}from"./jsx-runtime-B74pBk57.js";import{O as b,k as x}from"./ai-model-dropdown-BHfJ-Lss.js";import{t as S}from"./useCellActionButton-DP91E5bD.js";import{a as C,t as w}from"./useNotebookActions-Cu_nBy5g.js";import{r as T}from"./requests-lt0JK8Jt.js";import{t as E}from"./renderShortcut-C1JwYcqW.js";import{r as D}from"./feedback-button-Df_o0zuW.js";var O=d(),k=3;function A(){let e=(0,O.c)(7),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=D(`marimo:commands`,t),i;e[1]!==n||e[2]!==r?(i=e=>{let t=j([e,...n]);r(t.slice(0,k))},e[1]=n,e[2]=r,e[3]=i):i=e[3];let a;return e[4]!==n||e[5]!==i?(a={recentCommands:n,addRecentCommand:i},e[4]=n,e[5]=i,e[6]=a):a=e[6],a}function j(e){return[...new Set(e)]}function M(e){return e.dropdown!==void 0}function N(e,t=``){return e.flatMap(e=>!e.label||e.hidden?[]:M(e)?N(e.dropdown,`${t+e.label} > `):{...e,label:t+e.label,additionalKeywords:e.additionalKeywords})}function P(){let e=(0,O.c)(87),[t,n]=f(),[r,i]=p(),{saveAppConfig:a,saveUserConfig:o}=T(),s;e[0]!==o||e[1]!==n?(s=async e=>{await o({config:e}).then(()=>{n(t=>({...t,...e}))})},e[0]=o,e[1]=n,e[2]=s):s=e[2];let c=s,l;e[3]!==a||e[4]!==i?(l=async e=>{await a({config:e}).then(()=>{i(e)})},e[3]=a,e[4]=i,e[5]=l):l=e[5];let u=l,d;if(e[6]!==r||e[7]!==t.completion||e[8]!==t.display||e[9]!==t.keymap||e[10]!==u||e[11]!==c){let n;e[13]===r?n=e[14]:(n=e=>e!==r.width,e[13]=r,e[14]=n);let i;e[15]!==r||e[16]!==u?(i=e=>({label:`App config > Set width=${e}`,handle:()=>{u({...r,width:e})}}),e[15]=r,e[16]=u,e[17]=i):i=e[17];let a;e[18]!==t.display||e[19]!==c?(a={label:`Config > Set theme: dark`,handle:()=>{c({display:{...t.display,theme:`dark`}})}},e[18]=t.display,e[19]=c,e[20]=a):a=e[20];let o;e[21]!==t.display||e[22]!==c?(o={label:`Config > Set theme: light`,handle:()=>{c({display:{...t.display,theme:`light`}})}},e[21]=t.display,e[22]=c,e[23]=o):o=e[23];let s;e[24]!==t.display||e[25]!==c?(s={label:`Config > Set theme: system`,handle:()=>{c({display:{...t.display,theme:`system`}})}},e[24]=t.display,e[25]=c,e[26]=s):s=e[26];let l=t.keymap.preset===`vim`,f;e[27]!==t.keymap||e[28]!==c?(f=()=>{c({keymap:{...t.keymap,preset:`vim`}})},e[27]=t.keymap,e[28]=c,e[29]=f):f=e[29];let p;e[30]!==l||e[31]!==f?(p={label:`Config > Switch keymap to VIM`,hidden:l,handle:f},e[30]=l,e[31]=f,e[32]=p):p=e[32];let m=t.keymap.preset==="default",h;e[33]!==t.keymap||e[34]!==c?(h=()=>{c({keymap:{...t.keymap,preset:`default`}})},e[33]=t.keymap,e[34]=c,e[35]=h):h=e[35];let g;e[36]!==m||e[37]!==h?(g={label:`Config > Switch keymap to default (current: VIM)`,hidden:m,handle:h},e[36]=m,e[37]=h,e[38]=g):g=e[38];let _;e[39]!==t.completion||e[40]!==c?(_=()=>{c({completion:{...t.completion,copilot:!1}})},e[39]=t.completion,e[40]=c,e[41]=_):_=e[41];let v=t.completion.copilot!==`github`,y;e[42]!==_||e[43]!==v?(y={label:`Config > Disable GitHub Copilot`,handle:_,hidden:v},e[42]=_,e[43]=v,e[44]=y):y=e[44];let b;e[45]!==t.completion||e[46]!==c?(b=()=>{c({completion:{...t.completion,copilot:`github`}})},e[45]=t.completion,e[46]=c,e[47]=b):b=e[47];let S=t.completion.copilot===`github`,C;e[48]!==b||e[49]!==S?(C={label:`Config > Enable GitHub Copilot`,handle:b,hidden:S},e[48]=b,e[49]=S,e[50]=C):C=e[50];let w=!t.display.reference_highlighting,T;e[51]!==t.display||e[52]!==c?(T=()=>{c({display:{...t.display,reference_highlighting:!1}})},e[51]=t.display,e[52]=c,e[53]=T):T=e[53];let E;e[54]!==w||e[55]!==T?(E={label:`Config > Disable reference highlighting`,hidden:w,handle:T},e[54]=w,e[55]=T,e[56]=E):E=e[56];let D;e[57]!==t.display||e[58]!==c?(D=()=>{c({display:{...t.display,reference_highlighting:!0}})},e[57]=t.display,e[58]=c,e[59]=D):D=e[59];let O;e[60]!==t.display.reference_highlighting||e[61]!==D?(O={label:`Config > Enable reference highlighting`,hidden:t.display.reference_highlighting,handle:D},e[60]=t.display.reference_highlighting,e[61]=D,e[62]=O):O=e[62];let k=!(t.display.code_lens??!0),A;e[63]!==t.display||e[64]!==c?(A=()=>{c({display:{...t.display,code_lens:!1}})},e[63]=t.display,e[64]=c,e[65]=A):A=e[65];let j;e[66]!==k||e[67]!==A?(j={label:`Config > Disable code lens`,hidden:k,handle:A},e[66]=k,e[67]=A,e[68]=j):j=e[68];let M=t.display.code_lens??!0,N;e[69]!==t.display||e[70]!==c?(N=()=>{c({display:{...t.display,code_lens:!0}})},e[69]=t.display,e[70]=c,e[71]=N):N=e[71];let P;e[72]!==M||e[73]!==N?(P={label:`Config > Enable code lens`,hidden:M,handle:N},e[72]=M,e[73]=N,e[74]=P):P=e[74];let F=t.display.cell_output===`above`,I;e[75]!==t.display||e[76]!==c?(I=()=>{c({display:{...t.display,cell_output:`above`}})},e[75]=t.display,e[76]=c,e[77]=I):I=e[77];let L;e[78]!==F||e[79]!==I?(L={label:`Config > Set cell output area: above`,hidden:F,handle:I},e[78]=F,e[79]=I,e[80]=L):L=e[80];let R=t.display.cell_output===`below`,z;e[81]!==t.display||e[82]!==c?(z=()=>{c({display:{...t.display,cell_output:`below`}})},e[81]=t.display,e[82]=c,e[83]=z):z=e[83];let B;e[84]!==R||e[85]!==z?(B={label:`Config > Set cell output area: below`,hidden:R,handle:z},e[84]=R,e[85]=z,e[86]=B):B=e[86],d=[...x().filter(n).map(i),a,o,s,p,g,y,C,E,O,j,P,L,B].filter(ee),e[6]=r,e[7]=t.completion,e[8]=t.display,e[9]=t.keymap,e[10]=u,e[11]=c,e[12]=d}else d=e[12];return d}function ee(e){return!e.hidden}var F=y(),I=()=>{let d=(0,O.c)(37),[f,p]=e(C),y=b(),x=t(n),T=t(m),D;d[0]===x?D=d[1]:(D={cell:x},d[0]=x,d[1]=D);let k=S(D).flat();k=N(k);let j=P(),ee=w();ee=[...N(ee),...N(j)];let I=ee.filter(L),B=v.keyBy(I,R),{recentCommands:V,addRecentCommand:H}=A(),U;d[2]===V?U=d[3]:(U=new Set(V),d[2]=V,d[3]=U);let W=U,G;d[4]!==T||d[5]!==p?(G=e=>{h(T.getHotkey(`global.commandPalette`).key)(e)&&(e.preventDefault(),p(z))},d[4]=T,d[5]=p,d[6]=G):G=d[6],g(document,`keydown`,G);let K;d[7]!==H||d[8]!==T||d[9]!==y||d[10]!==p?(K=(e,t)=>{let n=y[e];if(!n)return null;let a=T.getHotkey(e);return(0,F.jsxs)(r,{disabled:t.disabled,keywords:a.additionalKeywords,onSelect:()=>{H(e),p(!1),requestAnimationFrame(()=>{n()})},value:a.name,children:[(0,F.jsxs)(`span`,{children:[a.name,t.tooltip&&(0,F.jsx)(`span`,{className:`ml-2`,children:t.tooltip})]}),(0,F.jsx)(i,{children:(0,F.jsx)(E,{shortcut:a.key})})]},e)},d[7]=H,d[8]=T,d[9]=y,d[10]=p,d[11]=K):K=d[11];let te=K,q;d[12]!==H||d[13]!==T||d[14]!==p?(q=e=>{let{label:t,handle:n,props:a,hotkey:o,additionalKeywords:s}=e,c=a===void 0?{}:a;return(0,F.jsxs)(r,{disabled:c.disabled,keywords:s,onSelect:()=>{H(t),p(!1),requestAnimationFrame(()=>{n()})},value:t,children:[(0,F.jsxs)(`span`,{children:[t,c.tooltip&&(0,F.jsxs)(`span`,{className:`ml-2`,children:[`(`,c.tooltip,`)`]})]}),o&&(0,F.jsx)(i,{children:(0,F.jsx)(E,{shortcut:T.getHotkey(o).key})})]},t)},d[12]=H,d[13]=T,d[14]=p,d[15]=q):q=d[15];let J=q,ne=c,Y;d[16]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,F.jsx)(a,{placeholder:`Type to search...`}),d[16]=Y):Y=d[16];let re=l,X;d[17]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,F.jsx)(s,{children:`No results found.`}),d[17]=X):X=d[17];let ie=V.length>0&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(o,{heading:`Recently Used`,children:V.map(e=>{let t=B[e];return _(e)?te(e,{disabled:t?.disabled,tooltip:t?.tooltip}):t&&!M(t)?J({label:t.label,handle:t.handleHeadless||t.handle,props:{disabled:t.disabled,tooltip:t.tooltip},additionalKeywords:t.additionalKeywords}):null})}),(0,F.jsx)(u,{})]}),ae=o,oe=T.iterate().map(e=>{if(W.has(e))return null;let t=B[e];return te(e,{disabled:t?.disabled,tooltip:t?.tooltip})}),se=I.map(e=>W.has(e.label)?null:J({label:e.label,handle:e.handleHeadless||e.handle,props:{disabled:e.disabled,tooltip:e.tooltip},additionalKeywords:e.additionalKeywords})),Z;d[18]!==W||d[19]!==J?(Z=e=>W.has(e.label)?null:J({label:`Cell > ${e.label}`,handle:e.handleHeadless||e.handle,props:{disabled:e.disabled,tooltip:e.tooltip},additionalKeywords:e.additionalKeywords}),d[18]=W,d[19]=J,d[20]=Z):Z=d[20];let ce=k.map(Z),Q;d[21]!==ae||d[22]!==se||d[23]!==ce||d[24]!==oe?(Q=(0,F.jsxs)(ae,{heading:`Commands`,children:[oe,se,ce]}),d[21]=ae,d[22]=se,d[23]=ce,d[24]=oe,d[25]=Q):Q=d[25];let $;d[26]!==re||d[27]!==Q||d[28]!==X||d[29]!==ie?($=(0,F.jsxs)(re,{children:[X,ie,Q]}),d[26]=re,d[27]=Q,d[28]=X,d[29]=ie,d[30]=$):$=d[30];let le;return d[31]!==ne||d[32]!==f||d[33]!==p||d[34]!==$||d[35]!==Y?(le=(0,F.jsxs)(ne,{open:f,onOpenChange:p,children:[Y,$]}),d[31]=ne,d[32]=f,d[33]=p,d[34]=$,d[35]=Y,d[36]=le):le=d[36],le};function L(e){return!e.hotkey}function R(e){return e.label}function z(e){return!e}export{I as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime-B0Z9INg1.js";import{t as e}from"./react-DVplv7_D.js";import{M as t,cn as n,dn as r,un as i}from"./cells-BMs-CYDt.js";import{t as a}from"./compiler-runtime-BrajqUja.js";import{t as o}from"./jsx-runtime-B74pBk57.js";import{n as s}from"./copy-D8O_CYCG.js";import{t as c}from"./use-toast-Wu434mLr.js";import{t as l}from"./badge-crT3E0Rm.js";import{t as u}from"./cell-link-CmO9D2a2.js";var d=a(),f=o(),p=e=>{let a=(0,d.c)(18),{maxCount:o,cellIds:s,onClick:c,skipScroll:l}=e,p=t(),m,h,g;if(a[0]!==s||a[1]!==p||a[2]!==o||a[3]!==c||a[4]!==l){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e;a[8]===p?e=a[9]:(e=(e,t)=>p.inOrderIds.indexOf(e)-p.inOrderIds.indexOf(t),a[8]=p,a[9]=e);let t=s.toSorted(e);if(s.length===0){let e;a[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,f.jsx)(`div`,{className:`text-muted-foreground`,children:`--`}),a[10]=e):e=a[10],g=e;break bb0}let d;a[11]!==s.length||a[12]!==c||a[13]!==l?(d=(e,t)=>(0,f.jsxs)(`span`,{className:`truncate`,children:[(0,f.jsx)(u,{variant:`focus`,cellId:e,skipScroll:l,className:`whitespace-nowrap`,onClick:c?()=>c(e):void 0},e),t<s.length-1&&`, `]},e),a[11]=s.length,a[12]=c,a[13]=l,a[14]=d):d=a[14],m=t.slice(0,o).map(d),h=s.length>o&&(0,f.jsxs)(n,{children:[(0,f.jsx)(r,{asChild:!0,children:(0,f.jsxs)(`span`,{className:`whitespace-nowrap text-muted-foreground text-xs hover:underline cursor-pointer`,children:[`+`,s.length-o,` more`]})}),(0,f.jsx)(i,{className:`w-auto`,children:(0,f.jsx)(`div`,{className:`flex flex-col gap-1 py-1`,children:t.slice(o).map(e=>(0,f.jsx)(u,{variant:`focus`,cellId:e,className:`whitespace-nowrap`,onClick:c?()=>c(e):void 0},e))})})]})}a[0]=s,a[1]=p,a[2]=o,a[3]=c,a[4]=l,a[5]=m,a[6]=h,a[7]=g}else m=a[5],h=a[6],g=a[7];if(g!==Symbol.for(`react.early_return_sentinel`))return g;let _;return a[15]!==m||a[16]!==h?(_=(0,f.jsxs)(f.Fragment,{children:[m,h]}),a[15]=m,a[16]=h,a[17]=_):_=a[17],_};e();var m=e=>{let t=(0,d.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({name:r,declaredBy:n,onClick:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=n.length>1?`destructive`:`outline`,u;t[5]!==r||t[6]!==i?(u=async e=>{if(i){i(e);return}await s(r),c({title:`Copied to clipboard`})},t[5]=r,t[6]=i,t[7]=u):u=t[7];let p;t[8]!==r||t[9]!==o||t[10]!==u?(p=(0,f.jsx)(l,{title:r,variant:o,className:`rounded-sm text-ellipsis block overflow-hidden max-w-fit cursor-pointer font-medium`,onClick:u,children:r}),t[8]=r,t[9]=o,t[10]=u,t[11]=p):p=t[11];let m;return t[12]!==a||t[13]!==p?(m=(0,f.jsx)(`div`,{className:`max-w-[130px]`,...a,children:p}),t[12]=a,t[13]=p,t[14]=m):m=t[14],m};export{p as n,m as t};
1
+ import"./rolldown-runtime-B0Z9INg1.js";import{t as e}from"./react-DVplv7_D.js";import{M as t,cn as n,dn as r,un as i}from"./cells-CDwPlSdp.js";import{t as a}from"./compiler-runtime-BrajqUja.js";import{t as o}from"./jsx-runtime-B74pBk57.js";import{n as s}from"./copy-D8O_CYCG.js";import{t as c}from"./use-toast-Wu434mLr.js";import{t as l}from"./badge-crT3E0Rm.js";import{t as u}from"./cell-link-CF9EP0SZ.js";var d=a(),f=o(),p=e=>{let a=(0,d.c)(18),{maxCount:o,cellIds:s,onClick:c,skipScroll:l}=e,p=t(),m,h,g;if(a[0]!==s||a[1]!==p||a[2]!==o||a[3]!==c||a[4]!==l){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e;a[8]===p?e=a[9]:(e=(e,t)=>p.inOrderIds.indexOf(e)-p.inOrderIds.indexOf(t),a[8]=p,a[9]=e);let t=s.toSorted(e);if(s.length===0){let e;a[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,f.jsx)(`div`,{className:`text-muted-foreground`,children:`--`}),a[10]=e):e=a[10],g=e;break bb0}let d;a[11]!==s.length||a[12]!==c||a[13]!==l?(d=(e,t)=>(0,f.jsxs)(`span`,{className:`truncate`,children:[(0,f.jsx)(u,{variant:`focus`,cellId:e,skipScroll:l,className:`whitespace-nowrap`,onClick:c?()=>c(e):void 0},e),t<s.length-1&&`, `]},e),a[11]=s.length,a[12]=c,a[13]=l,a[14]=d):d=a[14],m=t.slice(0,o).map(d),h=s.length>o&&(0,f.jsxs)(n,{children:[(0,f.jsx)(r,{asChild:!0,children:(0,f.jsxs)(`span`,{className:`whitespace-nowrap text-muted-foreground text-xs hover:underline cursor-pointer`,children:[`+`,s.length-o,` more`]})}),(0,f.jsx)(i,{className:`w-auto`,children:(0,f.jsx)(`div`,{className:`flex flex-col gap-1 py-1`,children:t.slice(o).map(e=>(0,f.jsx)(u,{variant:`focus`,cellId:e,className:`whitespace-nowrap`,onClick:c?()=>c(e):void 0},e))})})]})}a[0]=s,a[1]=p,a[2]=o,a[3]=c,a[4]=l,a[5]=m,a[6]=h,a[7]=g}else m=a[5],h=a[6],g=a[7];if(g!==Symbol.for(`react.early_return_sentinel`))return g;let _;return a[15]!==m||a[16]!==h?(_=(0,f.jsxs)(f.Fragment,{children:[m,h]}),a[15]=m,a[16]=h,a[17]=_):_=a[17],_};e();var m=e=>{let t=(0,d.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({name:r,declaredBy:n,onClick:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=n.length>1?`destructive`:`outline`,u;t[5]!==r||t[6]!==i?(u=async e=>{if(i){i(e);return}await s(r),c({title:`Copied to clipboard`})},t[5]=r,t[6]=i,t[7]=u):u=t[7];let p;t[8]!==r||t[9]!==o||t[10]!==u?(p=(0,f.jsx)(l,{title:r,variant:o,className:`rounded-sm text-ellipsis block overflow-hidden max-w-fit cursor-pointer font-medium`,onClick:u,children:r}),t[8]=r,t[9]=o,t[10]=u,t[11]=p):p=t[11];let m;return t[12]!==a||t[13]!==p?(m=(0,f.jsx)(`div`,{className:`max-w-[130px]`,...a,children:p}),t[12]=a,t[13]=p,t[14]=m):m=t[14],m};export{p as n,m as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{r as t}from"./useEvent-Dfcbgjhg.js";import{t as n}from"./react-DVplv7_D.js";import{Mt as r,f as i,qa as a,ti as o,yr as s,yt as c}from"./cells-BMs-CYDt.js";import{t as l}from"./compiler-runtime-BrajqUja.js";import{a as u,i as d,o as f}from"./config-CMUeR8Wr.js";import{t as p}from"./cn-ldLVeaqm.js";import{t as m}from"./jsx-runtime-B74pBk57.js";import{a as h,c as g,p as ee,r as te,t as ne}from"./dropdown-menu-C1rnl-0o.js";import{t as _}from"./tooltip-C9TuY18o.js";import{t as v}from"./button-COI-NGrx.js";import{i as re}from"./paths-bkIFVj8h.js";import{n as ie}from"./components-CskjK6xZ.js";import{b as ae}from"./write-secret-modal-DzKAInL2.js";import{t as oe}from"./plus-C5silF6g.js";import{t as y}from"./badge-crT3E0Rm.js";import{n as se,t as b}from"./add-connection-dialog-DP62zXw2.js";var x=l(),S=m(),C=e=>{let t=(0,x.c)(8),{variableName:n,className:r}=e,a;t[0]===n?a=t[1]:(a=e=>{e.stopPropagation();let t=w(n);if(!t)return;let r=i(t);r&&s(r,n)},t[0]=n,t[1]=a);let o=a,c;t[2]===r?c=t[3]:(c=p(`text-link opacity-80 hover:opacity-100 hover:underline`,r),t[2]=r,t[3]=c);let l;return t[4]!==o||t[5]!==c||t[6]!==n?(l=(0,S.jsx)(`button`,{type:`button`,onClick:o,className:c,children:n}),t[4]=o,t[5]=c,t[6]=n,t[7]=l):l=t[7],l};function w(e){let n=t.get(o)[e];if(n)return n.declaredBy[0]}var T=e=>{let t=(0,x.c)(58),n,i,o,s,l;t[0]===e?(n=t[1],i=t[2],o=t[3],s=t[4],l=t[5]):({group:o,label:s,compact:l,className:i,...n}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=o,t[4]=s,t[5]=l);let u=l!==void 0&&l,d=c(o),f=r(),{openModal:m,closeModal:y}=ae(),C=d.length>0,w=o===`storage`?`storage`:`databases`,T=C&&!u&&`rounded-r-none`,E;t[6]!==i||t[7]!==T?(E=p(i,T),t[6]=i,t[7]=T,t[8]=E):E=t[8];let D=u?s:n[`aria-label`],O=!u&&s,k=!u&&`ml-2`,A;t[9]===k?A=t[10]:(A=p(`h-4 w-4`,k),t[9]=k,t[10]=A);let j;t[11]===A?j=t[12]:(j=(0,S.jsx)(oe,{className:A}),t[11]=A,t[12]=j);let M;t[13]!==n||t[14]!==E||t[15]!==D||t[16]!==O||t[17]!==j?(M=(0,S.jsxs)(v,{...n,className:E,"aria-label":D,children:[O,j]}),t[13]=n,t[14]=E,t[15]=D,t[16]=O,t[17]=j,t[18]=M):M=t[18];let N=M,P;t[19]!==w||t[20]!==N?(P=(0,S.jsx)(b,{defaultTab:w,children:N}),t[19]=w,t[20]=N,t[21]=P):P=t[21];let F=P;if(!C)return F;let I=o===`storage`?ie:re,L=o===`storage`?`View detected remote storage connections`:`View detected database connections`,R=n.variant,z=n.size,B=n.disabled,V=u&&`rounded-none`,H;t[22]===V?H=t[23]:(H=p(`rounded-l-none border-l-0 px-2 text-(--blue-10) hover:bg-(--blue-3)`,V),t[22]=V,t[23]=H);let U;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,S.jsx)(a,{className:`h-4 w-4`}),t[24]=U):U=t[24];let W;t[25]!==n.disabled||t[26]!==n.size||t[27]!==n.variant||t[28]!==L||t[29]!==H?(W=(0,S.jsx)(`span`,{className:`inline-flex`,children:(0,S.jsx)(ee,{asChild:!0,children:(0,S.jsx)(v,{variant:R,size:z,disabled:B,className:H,"aria-label":L,children:U})})}),t[25]=n.disabled,t[26]=n.size,t[27]=n.variant,t[28]=L,t[29]=H,t[30]=W):W=t[30];let G;t[31]!==L||t[32]!==W?(G=(0,S.jsx)(_,{content:L,children:W}),t[31]=L,t[32]=W,t[33]=G):G=t[33];let K;if(t[34]!==f||t[35]!==d){let e;t[37]===f?e=t[38]:(e=e=>(0,S.jsxs)(h,{onSelect:()=>f(e),children:[(0,S.jsx)(a,{className:`mr-2 h-4 w-4 text-(--blue-9)`}),`Add `,e.displayName]},e.id),t[37]=f,t[38]=e),K=d.map(e),t[34]=f,t[35]=d,t[36]=K}else K=t[36];let q;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,S.jsx)(g,{}),t[39]=q):q=t[39];let J;t[40]!==y||t[41]!==w||t[42]!==m?(J=()=>m((0,S.jsx)(se,{defaultTab:w,onClose:y})),t[40]=y,t[41]=w,t[42]=m,t[43]=J):J=t[43];let Y;t[44]===I?Y=t[45]:(Y=(0,S.jsx)(I,{className:`mr-2 h-4 w-4`}),t[44]=I,t[45]=Y);let X;t[46]!==J||t[47]!==Y?(X=(0,S.jsxs)(h,{onSelect:J,children:[Y,`Browse all connections`]}),t[46]=J,t[47]=Y,t[48]=X):X=t[48];let Z;t[49]!==K||t[50]!==X?(Z=(0,S.jsxs)(te,{align:`end`,children:[K,q,X]}),t[49]=K,t[50]=X,t[51]=Z):Z=t[51];let Q;t[52]!==G||t[53]!==Z?(Q=(0,S.jsxs)(ne,{children:[G,Z]}),t[52]=G,t[53]=Z,t[54]=Q):Q=t[54];let $;return t[55]!==F||t[56]!==Q?($=(0,S.jsxs)(`div`,{className:`inline-flex`,children:[F,Q]}),t[55]=F,t[56]=Q,t[57]=$):$=t[57],$},E=e(n(),1),D=E.forwardRef((e,t)=>{let n=(0,x.c)(11),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,lastItem:i,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=i&&`border-b-0`,s;n[4]!==r||n[5]!==o?(s=p(o,r),n[4]=r,n[5]=o,n[6]=s):s=n[6];let c;return n[7]!==a||n[8]!==t||n[9]!==s?(c=(0,S.jsx)(u,{ref:t,className:s,...a}),n[7]=a,n[8]=t,n[9]=s,n[10]=c):c=n[10],c});D.displayName=`PanelAccordionItem`;var O=E.forwardRef((e,t)=>{let n=(0,x.c)(13),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=p(`px-3 py-2 text-xs font-semibold uppercase tracking-wide hover:no-underline`,i),n[4]=i,n[5]=o);let s;n[6]===r?s=n[7]:(s=(0,S.jsx)(`span`,{className:`flex items-center gap-2`,children:r}),n[6]=r,n[7]=s);let c;return n[8]!==a||n[9]!==t||n[10]!==o||n[11]!==s?(c=(0,S.jsx)(f,{ref:t,className:o,...a,children:s}),n[8]=a,n[9]=t,n[10]=o,n[11]=s,n[12]=c):c=n[12],c});O.displayName=`PanelAccordionTrigger`;var k=E.forwardRef((e,t)=>{let n=(0,x.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({wrapperClassName:i,...r}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===i?a=n[4]:(a=p(`p-0`,i),n[3]=i,n[4]=a);let o;return n[5]!==r||n[6]!==t||n[7]!==a?(o=(0,S.jsx)(d,{ref:t,wrapperClassName:a,...r}),n[5]=r,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});k.displayName=`PanelAccordionContent`;var A=e=>{let t=(0,x.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=p(`py-0 px-1.5 text-[10px]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,S.jsx)(y,{variant:`secondary`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};A.displayName=`PanelBadge`;var j=e=>{let t=(0,x.c)(6),{count:n,type:r}=e;if(n===0)return null;let i;i=r===`database`?n===1?`database`:`databases`:n===1?`remote storage`:`remote storages`;let o=`${n} ${i} detected in your environment, ready to quick-add`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,S.jsx)(a,{className:`h-2.5 w-2.5`}),t[0]=s):s=t[0];let c;t[1]===n?c=t[2]:(c=(0,S.jsx)(`span`,{children:(0,S.jsxs)(A,{className:`gap-0.5 border-(--blue-6) bg-(--blue-3) text-(--blue-11) hover:bg-(--blue-4) dark:border-(--blue-8) dark:bg-(--blue-3) dark:hover:bg-(--blue-4)`,children:[s,n]})}),t[1]=n,t[2]=c);let l;return t[3]!==o||t[4]!==c?(l=(0,S.jsx)(_,{content:o,children:c}),t[3]=o,t[4]=c,t[5]=l):l=t[5],l};export{A as a,O as i,k as n,T as o,D as r,C as s,j as t};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{r as t}from"./useEvent-Dfcbgjhg.js";import{t as n}from"./react-DVplv7_D.js";import{Mt as r,f as i,qa as a,ti as o,yr as s,yt as c}from"./cells-CDwPlSdp.js";import{t as l}from"./compiler-runtime-BrajqUja.js";import{a as u,i as d,o as f}from"./config-D-dRq5S4.js";import{t as p}from"./cn-ldLVeaqm.js";import{t as m}from"./jsx-runtime-B74pBk57.js";import{a as h,c as g,p as ee,r as te,t as ne}from"./dropdown-menu-C1rnl-0o.js";import{t as _}from"./tooltip-C9TuY18o.js";import{t as v}from"./button-COI-NGrx.js";import{i as re}from"./paths-bkIFVj8h.js";import{n as ie}from"./components-CskjK6xZ.js";import{b as ae}from"./write-secret-modal-DzKAInL2.js";import{t as oe}from"./plus-C5silF6g.js";import{t as y}from"./badge-crT3E0Rm.js";import{n as se,t as b}from"./add-connection-dialog-DWzd_jMJ.js";var x=l(),S=m(),C=e=>{let t=(0,x.c)(8),{variableName:n,className:r}=e,a;t[0]===n?a=t[1]:(a=e=>{e.stopPropagation();let t=w(n);if(!t)return;let r=i(t);r&&s(r,n)},t[0]=n,t[1]=a);let o=a,c;t[2]===r?c=t[3]:(c=p(`text-link opacity-80 hover:opacity-100 hover:underline`,r),t[2]=r,t[3]=c);let l;return t[4]!==o||t[5]!==c||t[6]!==n?(l=(0,S.jsx)(`button`,{type:`button`,onClick:o,className:c,children:n}),t[4]=o,t[5]=c,t[6]=n,t[7]=l):l=t[7],l};function w(e){let n=t.get(o)[e];if(n)return n.declaredBy[0]}var T=e=>{let t=(0,x.c)(58),n,i,o,s,l;t[0]===e?(n=t[1],i=t[2],o=t[3],s=t[4],l=t[5]):({group:o,label:s,compact:l,className:i,...n}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=o,t[4]=s,t[5]=l);let u=l!==void 0&&l,d=c(o),f=r(),{openModal:m,closeModal:y}=ae(),C=d.length>0,w=o===`storage`?`storage`:`databases`,T=C&&!u&&`rounded-r-none`,E;t[6]!==i||t[7]!==T?(E=p(i,T),t[6]=i,t[7]=T,t[8]=E):E=t[8];let D=u?s:n[`aria-label`],O=!u&&s,k=!u&&`ml-2`,A;t[9]===k?A=t[10]:(A=p(`h-4 w-4`,k),t[9]=k,t[10]=A);let j;t[11]===A?j=t[12]:(j=(0,S.jsx)(oe,{className:A}),t[11]=A,t[12]=j);let M;t[13]!==n||t[14]!==E||t[15]!==D||t[16]!==O||t[17]!==j?(M=(0,S.jsxs)(v,{...n,className:E,"aria-label":D,children:[O,j]}),t[13]=n,t[14]=E,t[15]=D,t[16]=O,t[17]=j,t[18]=M):M=t[18];let N=M,P;t[19]!==w||t[20]!==N?(P=(0,S.jsx)(b,{defaultTab:w,children:N}),t[19]=w,t[20]=N,t[21]=P):P=t[21];let F=P;if(!C)return F;let I=o===`storage`?ie:re,L=o===`storage`?`View detected remote storage connections`:`View detected database connections`,R=n.variant,z=n.size,B=n.disabled,V=u&&`rounded-none`,H;t[22]===V?H=t[23]:(H=p(`rounded-l-none border-l-0 px-2 text-(--blue-10) hover:bg-(--blue-3)`,V),t[22]=V,t[23]=H);let U;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,S.jsx)(a,{className:`h-4 w-4`}),t[24]=U):U=t[24];let W;t[25]!==n.disabled||t[26]!==n.size||t[27]!==n.variant||t[28]!==L||t[29]!==H?(W=(0,S.jsx)(`span`,{className:`inline-flex`,children:(0,S.jsx)(ee,{asChild:!0,children:(0,S.jsx)(v,{variant:R,size:z,disabled:B,className:H,"aria-label":L,children:U})})}),t[25]=n.disabled,t[26]=n.size,t[27]=n.variant,t[28]=L,t[29]=H,t[30]=W):W=t[30];let G;t[31]!==L||t[32]!==W?(G=(0,S.jsx)(_,{content:L,children:W}),t[31]=L,t[32]=W,t[33]=G):G=t[33];let K;if(t[34]!==f||t[35]!==d){let e;t[37]===f?e=t[38]:(e=e=>(0,S.jsxs)(h,{onSelect:()=>f(e),children:[(0,S.jsx)(a,{className:`mr-2 h-4 w-4 text-(--blue-9)`}),`Add `,e.displayName]},e.id),t[37]=f,t[38]=e),K=d.map(e),t[34]=f,t[35]=d,t[36]=K}else K=t[36];let q;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,S.jsx)(g,{}),t[39]=q):q=t[39];let J;t[40]!==y||t[41]!==w||t[42]!==m?(J=()=>m((0,S.jsx)(se,{defaultTab:w,onClose:y})),t[40]=y,t[41]=w,t[42]=m,t[43]=J):J=t[43];let Y;t[44]===I?Y=t[45]:(Y=(0,S.jsx)(I,{className:`mr-2 h-4 w-4`}),t[44]=I,t[45]=Y);let X;t[46]!==J||t[47]!==Y?(X=(0,S.jsxs)(h,{onSelect:J,children:[Y,`Browse all connections`]}),t[46]=J,t[47]=Y,t[48]=X):X=t[48];let Z;t[49]!==K||t[50]!==X?(Z=(0,S.jsxs)(te,{align:`end`,children:[K,q,X]}),t[49]=K,t[50]=X,t[51]=Z):Z=t[51];let Q;t[52]!==G||t[53]!==Z?(Q=(0,S.jsxs)(ne,{children:[G,Z]}),t[52]=G,t[53]=Z,t[54]=Q):Q=t[54];let $;return t[55]!==F||t[56]!==Q?($=(0,S.jsxs)(`div`,{className:`inline-flex`,children:[F,Q]}),t[55]=F,t[56]=Q,t[57]=$):$=t[57],$},E=e(n(),1),D=E.forwardRef((e,t)=>{let n=(0,x.c)(11),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,lastItem:i,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=i&&`border-b-0`,s;n[4]!==r||n[5]!==o?(s=p(o,r),n[4]=r,n[5]=o,n[6]=s):s=n[6];let c;return n[7]!==a||n[8]!==t||n[9]!==s?(c=(0,S.jsx)(u,{ref:t,className:s,...a}),n[7]=a,n[8]=t,n[9]=s,n[10]=c):c=n[10],c});D.displayName=`PanelAccordionItem`;var O=E.forwardRef((e,t)=>{let n=(0,x.c)(13),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=p(`px-3 py-2 text-xs font-semibold uppercase tracking-wide hover:no-underline`,i),n[4]=i,n[5]=o);let s;n[6]===r?s=n[7]:(s=(0,S.jsx)(`span`,{className:`flex items-center gap-2`,children:r}),n[6]=r,n[7]=s);let c;return n[8]!==a||n[9]!==t||n[10]!==o||n[11]!==s?(c=(0,S.jsx)(f,{ref:t,className:o,...a,children:s}),n[8]=a,n[9]=t,n[10]=o,n[11]=s,n[12]=c):c=n[12],c});O.displayName=`PanelAccordionTrigger`;var k=E.forwardRef((e,t)=>{let n=(0,x.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({wrapperClassName:i,...r}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===i?a=n[4]:(a=p(`p-0`,i),n[3]=i,n[4]=a);let o;return n[5]!==r||n[6]!==t||n[7]!==a?(o=(0,S.jsx)(d,{ref:t,wrapperClassName:a,...r}),n[5]=r,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});k.displayName=`PanelAccordionContent`;var A=e=>{let t=(0,x.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=p(`py-0 px-1.5 text-[10px]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,S.jsx)(y,{variant:`secondary`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};A.displayName=`PanelBadge`;var j=e=>{let t=(0,x.c)(6),{count:n,type:r}=e;if(n===0)return null;let i;i=r===`database`?n===1?`database`:`databases`:n===1?`remote storage`:`remote storages`;let o=`${n} ${i} detected in your environment, ready to quick-add`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,S.jsx)(a,{className:`h-2.5 w-2.5`}),t[0]=s):s=t[0];let c;t[1]===n?c=t[2]:(c=(0,S.jsx)(`span`,{children:(0,S.jsxs)(A,{className:`gap-0.5 border-(--blue-6) bg-(--blue-3) text-(--blue-11) hover:bg-(--blue-4) dark:border-(--blue-8) dark:bg-(--blue-3) dark:hover:bg-(--blue-4)`,children:[s,n]})}),t[1]=n,t[2]=c);let l;return t[3]!==o||t[4]!==c?(l=(0,S.jsx)(_,{content:o,children:c}),t[3]=o,t[4]=c,t[5]=l):l=t[5],l};export{A as a,O as i,k as n,T as o,D as r,C as s,j as t};
@@ -101,4 +101,4 @@ with an edit to the other, or with edits to cells.
101
101
  The data is decoded JSON. Snapshot records and reset events omit
102
102
  the cursor; ready and live events carry it. Unknown event names
103
103
  belong to later versions or host extensions.
104
- `),Gt=d({id:l().describe(`Identifies this answer.`),label:l().describe(`Text to show a person.`)}).describe(`One possible answer to a decision.`),Kt=d({id:l().describe(`Identifies the question when the client answers it.`),prompt:l().describe(`The question, worded for a person.`),options:m(Gt).describe(`The possible answers.`)}).describe("A question the host needs answered before it can carry out a\nrequest. The client answers by repeating the request with\n`decisions` in the body, mapping this `id` to the `id` of an\noption.\n"),qt=d({change:s().min(0).describe("The index of the stale change in the request's `changes`, or of the stale cell in a run's `cells`. `0` for a save with a stale `If-Match`."),cell:p([q,h()]).describe(`The cell the change named, as it now is. Null when the document does not have it, or when the change named the order.`),document:J}).describe(`The first stale change of an edit or run, and the state the host holds.`);d({type:l().describe("What kind of problem this is, as a URI. The kinds this\nprotocol defines all start with `tag:marimo.io,2026:host/` and\nend with one of `invalid-request` (400), `unauthorized` (401),\n`forbidden` (403), `not-found` (404), `method-not-allowed`\n(405), `not-acceptable` (406), `conflict` (409), `no-runtime`\n(409), `decision-required` (409), `internal` (500), or\n`unsupported-operation` (501). A client that sees a kind it\ndoes not recognize falls back to `status`.\n"),title:l().describe(`A short, human-readable name for the kind of problem.`),status:s().min(400).max(599).describe(`The HTTP status code of the response.`),detail:l().optional().describe(`A human-readable explanation of what went wrong this time.`),decisions:m(Kt).optional().describe("The choices the client has to make before the host can carry out the request. Only present for `decision-required`."),edit:qt.optional().describe("Which change was stale and what the host holds instead. Only present for a `conflict` answering an edit, a save, or a run of cells.")}).describe("An error. Every error response has this one shape, following RFC\n9457, and is served as `application/problem+json`. `status`\nrepeats the HTTP status, and `type` says more precisely what went\nwrong. `decisions` appears only when `type` is\n`tag:marimo.io,2026:host/decision-required`. A client ignores\nmembers it does not recognize. An error never contains a token.\n"),d({project_id:N,path:l().optional().describe(`Where to put the file, relative to the project root and written the way the host's operating system writes paths.`),name:l().optional().describe(`A label to show people. In a project with a root it defaults to the filename.`)}).describe("The notebook's own fields, minus what the host assigns. A project with a root requires `path`; one without requires `name`."),d({path:l().optional().describe(`The new location, relative to the project root and written the way the host's operating system writes paths.`),name:l().optional().describe(`The new label to show people.`)}).describe(`The fields to change. At least one is present.`),d({url:l().describe(`The URL the host used to show the notebook. It never contains the host's token.`)}),d({decisions:c(l(),l()).optional().describe("Answers to the questions in a `decision-required` problem.\nEach key is a decision's `id` and each value is the `id` of\nthe chosen option. A client that already knows its choices can\nsend them the first time.\n")});var Jt=d({column:s().nullish().default(null),disabled:o().default(!1),hide_code:o().default(!1),expand_output:o().default(!1)}).describe(`A cell's settings as a client writes them. A field left out takes its default.`),Yt=d({id:z.describe(`The cell's id. A client chooses the id of a cell it creates.`),code:l().describe(`The cell's source code.`),name:l().default(`_`).describe("The cell's name. `_` for an anonymous cell."),config:Jt.optional()}).describe(`A cell as a client writes it. The host derives the etags and the analysis.`),Xt=d({kind:g([`put_cell`]),base_etag:l().nullable().describe("The cell's etag as last read, `*` to skip the check, or null to create the cell. Null when the cell exists, or an etag when it does not, is a `conflict`."),cell:Yt,after:z.optional().describe(`The cell a created cell goes after. Ignored for an existing cell.`),before:z.optional().describe("The cell a created cell goes before. Ignored for an existing cell. With neither `after` nor `before`, a created cell goes at the end.")}).describe(`Replaces a whole cell, or creates one.`),Zt=d({kind:g([`delete_cell`]),id:z.describe(`The cell to remove.`),base_etag:l().describe("The cell's etag as last read, or `*`.")}).describe(`Removes a cell.`),Qt=d({kind:g([`set_order`]),base_etag:l().describe("The document's `order_etag` as last read, or `*`."),order:m(z).describe(`Every cell id exactly once, in the new order, counting cells this edit creates and leaving out cells it deletes.`)}).describe(`Replaces the cell order.`),$t=p([Xt,Zt,Qt]).describe("One change to the document, tagged on `kind`.");d({changes:m($t).describe(`The changes, applied in order as one unit.`)});var en=d({etag:K,code_hash:K,version:s().min(1).describe(`The cell's version after the edit.`)}).describe(`A cell's etags and version after an edit.`);d({document:J,cells:c(l(),p([en,h()])).describe(`The version of each cell the request created or changed, by id, and null for each cell it deleted.`)}).describe(`The document after an edit or a save, and the cells it touched.`),d({decisions:c(l(),l()).optional().describe("Answers to the questions in a `decision-required` problem, as for `runtime.start`.")}).describe("What a save needs from the client, which is nothing until the host asks a question. `{}` is the usual body.");var tn=d({id:z,code_hash:K.optional().describe("The cell's `code_hash` as last read. A cell whose code differs is a `conflict`. Absent, the cell runs as it is.")});d({code:l().optional().describe(`Python code to run as scratch code.`),cells:m(tn).min(1).optional().describe(`Cells of the document to run, in no particular order. The runtime's execution configuration determines whether dependent cells run too.`)}).describe("What to run, exactly one of `code` and `cells`.");var nn=[`notebook`,`document`,`cell`,`attachment`,`marimo`],rn=d({event:l().min(1),data:_(),id:l().min(1).optional()}),an=new Set(Z.options.flatMap(e=>e.shape.event.options)),on=d({data:X});function sn(e){if(typeof e==`object`&&e&&!(`event`in e))return{event:`marimo`,data:{marimo:on.parse(e).data}};let t=rn.parse(e);return an.has(t.event)?Z.parse(t):{event:`unknown`,name:t.event,id:t.id}}function cn(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;for(let t of Object.values(e))if(typeof t!=`string`)return!1;return!0}function ln(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e;return!(!cn(t.files)||t.modelNotifications!==void 0&&!Array.isArray(t.modelNotifications))}function Q(){let e=typeof window>`u`?void 0:window.__MARIMO_STATIC__;return ln(e)?e:void 0}function $(){return Q()!==void 0}function un(){let e=Q();return ne(e!==void 0,`Not a static notebook`),e.files}function dn(){return Q()?.modelNotifications}var fn=class{initialHealthyCheck=new ae;config;lazy;constructor(e,t=!1){this.config=e,this.lazy=t;try{new URL(this.config.url)}catch(e){throw Error(`Invalid runtime URL: ${this.config.url}. ${e instanceof Error?e.message:`Unknown error`}`,{cause:e})}this.lazy||this.init()}get isLazy(){return this.lazy}get httpURL(){return new URL(this.config.url)}get isSameOrigin(){return this.httpURL.origin===window.location.origin}get isServerless(){return S()||re()||$()}formatHttpURL({path:e=``,searchParams:t,restrictToKnownQueryParams:n=!0}){let r=this.httpURL,i=new URLSearchParams(window.location.search);if(t)for(let[e,n]of t.entries())r.searchParams.set(e,n);for(let[e,t]of i.entries())n&&!Object.values(y).includes(e)||r.searchParams.set(e,t);return r.pathname=`${r.pathname.replace(/\/$/,``)}/${e.replace(/^\//,``)}`,r.hash=``,r}appendCrossOriginAuth(e){return!this.isSameOrigin&&this.config.authToken&&e.searchParams.set(y.accessToken,this.config.authToken),e}formatNavigableHttpURL(e,t){let n=this.formatHttpURL({path:e,searchParams:t});return n.searchParams.delete(y.accessToken),this.appendCrossOriginAuth(n)}formatWsURL(e,t){let n=this.formatHttpURL({path:e,searchParams:t,restrictToKnownQueryParams:!1});return pn(this.appendCrossOriginAuth(n).toString())}getSessionSearchParams(e){let t=new URL(this.config.url),n=new URLSearchParams(t.search);return new URLSearchParams(window.location.search).forEach((e,t)=>{n.has(t)||n.set(t,e)}),n.set(y.sessionId,e),n}getWsURL(e){let t=this.getSessionSearchParams(e),n=this.config.notebookId,r=n?`/api/marimo/v1/notebooks/${encodeURIComponent(n)}/events/ws`:`/ws`,i=this.formatWsURL(r,t);return n&&i.searchParams.set(`types`,nn.join(`,`)),i}getSseURL(e){let t=this.formatHttpURL({path:`/sse`,searchParams:this.getSessionSearchParams(e),restrictToKnownQueryParams:!1});return t.searchParams.delete(y.accessToken),t}getWsSyncURL(e){return this.formatWsURL(`/ws_sync`,this.getSessionSearchParams(e))}getTerminalWsURL(e){let t=this.formatWsURL(`/terminal/ws`);return e&&(t.searchParams.set(`rows`,String(e.rows)),t.searchParams.set(`cols`,String(e.cols))),t}getLSPURL(e){if(e===`copilot`){let t=this.formatWsURL(`/lsp/${e}`),n=t.searchParams.get(y.accessToken);return t.search=``,n&&t.searchParams.set(y.accessToken,n),t}return this.formatWsURL(`/lsp/${e}`)}getAiURL(e){return this.formatHttpURL({path:`/api/ai/${e}`})}healthURL(){return this.formatHttpURL({path:`/health`})}async fetchHealth(){try{return await fetch(this.healthURL().toString())}catch(e){return v.error(`Failed to check health: ${e instanceof Error?e.message:`Unknown error`}`,{cause:e}),null}}async reconcileFromHealth(){if(this.isServerless)return!0;let e=await this.fetchHealth();if(!e)return!1;if(e.redirected){v.debug(`Runtime redirected to ${e.url}`);let t=new URL(e.url);t.pathname=t.pathname.replace(/\/health$/,``),this.config.url=t.toString()}return e.ok&&this.setDOMBaseUri(this.config.url),e.ok}async probeHealth(){return this.isServerless?!0:(await this.fetchHealth())?.ok??!1}setDOMBaseUri(e){e=e.split(`?`,1)[0],e.endsWith(`/`)||(e+=`/`);let t=document.querySelector(`base`);t?t.setAttribute(`href`,e):(t=document.createElement(`base`),t.setAttribute(`href`,e),document.head.append(t))}async init(e){v.debug(`Initializing runtime...`);let t=0;for(;!await this.reconcileFromHealth();){if(t>=25){v.error(`Failed to connect after 25 retries`),this.initialHealthyCheck.reject(Error(`Failed to connect after 25 retries`));return}if(!e?.disableRetryDelay){let e=Math.min(100*1.2**t,2e3);await new Promise(t=>setTimeout(t,e))}t++}v.debug(`Runtime is healthy`),this.initialHealthyCheck.resolve()}async waitForHealthy(){return this.initialHealthyCheck.promise}headers(){let e={"Marimo-Session-Id":b(),"Marimo-Server-Token":this.config.serverToken??``,"x-runtime-url":this.httpURL.toString()};return this.config.authToken&&(e.Authorization=`Bearer ${this.config.authToken}`),e}sessionHeaders(){return{"Marimo-Session-Id":b()}}};function pn(e){if(!e.startsWith(`http`)){v.warn(`URL must start with http: ${e}`);let t=new URL(e);return t.protocol=`ws`,t}return new URL(e.replace(/^http/,`ws`))}function mn(){let e=new URL(document.baseURI);return e.search=``,e.hash=``,e.toString()}var hn={lazy:!0,url:mn()},gn=n(hn),_n=n(e=>{let t=e(gn);return new fn(t,t.lazy)});function vn(){return r(_n)}function yn(){let e=(0,oe.c)(4),n=vn(),[r,i]=t(A),o;return e[0]!==r.state||e[1]!==n||e[2]!==i?(o=async()=>{M(r.state)?(i({state:k.CONNECTING}),await n.init()):v.log(`Runtime already started or starting...`)},e[0]=r.state,e[1]=n,e[2]=i,e[3]=o):o=e[3],a(o)}function bn(){return i.get(_n)}function xn(e){if(e.startsWith(`http`))return new URL(e);let t=bn().httpURL.toString();return t.startsWith(`blob:`)&&(t=t.replace(`blob:`,``)),new URL(e,t)}export{ve as A,j as C,be as D,k as E,de as M,ge as N,ce as O,S as P,xe as S,ye as T,Te as _,yn as a,Ce as b,un as c,je as d,ke as f,M as g,Ae as h,gn as i,O as j,C as k,$ as l,De as m,xn as n,vn as o,Oe as p,bn as r,dn as s,hn as t,sn as u,A as v,Se as w,Ee as x,we as y};
104
+ `),Gt=d({id:l().describe(`Identifies this answer.`),label:l().describe(`Text to show a person.`)}).describe(`One possible answer to a decision.`),Kt=d({id:l().describe(`Identifies the question when the client answers it.`),prompt:l().describe(`The question, worded for a person.`),options:m(Gt).describe(`The possible answers.`)}).describe("A question the host needs answered before it can carry out a\nrequest. The client answers by repeating the request with\n`decisions` in the body, mapping this `id` to the `id` of an\noption.\n"),qt=d({change:s().min(0).describe("The index of the stale change in the request's `changes`, or of the stale cell in a run's `cells`. `0` for a save with a stale `If-Match`."),cell:p([q,h()]).describe(`The cell the change named, as it now is. Null when the document does not have it, or when the change named the order.`),document:J}).describe(`The first stale change of an edit or run, and the state the host holds.`);d({type:l().describe("What kind of problem this is, as a URI. The kinds this\nprotocol defines all start with `tag:marimo.io,2026:host/` and\nend with one of `invalid-request` (400), `unauthorized` (401),\n`forbidden` (403), `not-found` (404), `method-not-allowed`\n(405), `not-acceptable` (406), `conflict` (409), `no-runtime`\n(409), `decision-required` (409), `internal` (500), or\n`unsupported-operation` (501). A client that sees a kind it\ndoes not recognize falls back to `status`.\n"),title:l().describe(`A short, human-readable name for the kind of problem.`),status:s().min(400).max(599).describe(`The HTTP status code of the response.`),detail:l().optional().describe(`A human-readable explanation of what went wrong this time.`),decisions:m(Kt).optional().describe("The choices the client has to make before the host can carry out the request. Only present for `decision-required`."),edit:qt.optional().describe("Which change was stale and what the host holds instead. Only present for a `conflict` answering an edit, a save, or a run of cells.")}).describe("An error. Every error response has this one shape, following RFC\n9457, and is served as `application/problem+json`. `status`\nrepeats the HTTP status, and `type` says more precisely what went\nwrong. `decisions` appears only when `type` is\n`tag:marimo.io,2026:host/decision-required`. A client ignores\nmembers it does not recognize. An error never contains a token.\n"),d({project_id:N,path:l().optional().describe(`Where to put the file, relative to the project root and written the way the host's operating system writes paths.`),name:l().optional().describe(`A label to show people. In a project with a root it defaults to the filename.`)}).describe("The notebook's own fields, minus what the host assigns. A project with a root requires `path`; one without requires `name`."),d({path:l().optional().describe(`The new location, relative to the project root and written the way the host's operating system writes paths.`),name:l().optional().describe(`The new label to show people.`)}).describe(`The fields to change. At least one is present.`),d({url:l().describe(`The URL the host used to show the notebook. It never contains the host's token.`)}),d({decisions:c(l(),l()).optional().describe("Answers to the questions in a `decision-required` problem.\nEach key is a decision's `id` and each value is the `id` of\nthe chosen option. A client that already knows its choices can\nsend them the first time.\n")});var Jt=d({column:s().nullish().default(null),disabled:o().default(!1),hide_code:o().default(!1),expand_output:o().default(!1)}).describe(`A cell's settings as a client writes them. A field left out takes its default.`),Yt=d({id:z.describe(`The cell's id. A client chooses the id of a cell it creates.`),code:l().describe(`The cell's source code.`),name:l().default(`_`).describe("The cell's name. `_` for an anonymous cell."),config:Jt.optional()}).describe(`A cell as a client writes it. The host derives the etags and the analysis.`),Xt=d({kind:g([`put_cell`]),base_etag:l().nullable().describe("The cell's etag as last read, `*` to skip the check, or null to create the cell. Null when the cell exists, or an etag when it does not, is a `conflict`."),cell:Yt,after:z.optional().describe(`The cell a created cell goes after. Ignored for an existing cell.`),before:z.optional().describe("The cell a created cell goes before. Ignored for an existing cell. With neither `after` nor `before`, a created cell goes at the end.")}).describe(`Replaces a whole cell, or creates one.`),Zt=d({kind:g([`delete_cell`]),id:z.describe(`The cell to remove.`),base_etag:l().describe("The cell's etag as last read, or `*`.")}).describe(`Removes a cell.`),Qt=d({kind:g([`set_order`]),base_etag:l().describe("The document's `order_etag` as last read, or `*`."),order:m(z).describe(`Every cell id exactly once, in the new order, counting cells this edit creates and leaving out cells it deletes.`)}).describe(`Replaces the cell order.`),$t=p([Xt,Zt,Qt]).describe("One change to the document, tagged on `kind`.");d({changes:m($t).describe(`The changes, applied in order as one unit.`)});var en=d({etag:K,code_hash:K,version:s().min(1).describe(`The cell's version after the edit.`)}).describe(`A cell's etags and version after an edit.`);d({document:J,cells:c(l(),p([en,h()])).describe(`The version of each cell the request created or changed, by id, and null for each cell it deleted.`)}).describe(`The document as an edit or save left it, or at a later revision, and the cells it touched.`),d({decisions:c(l(),l()).optional().describe("Answers to the questions in a `decision-required` problem, as for `runtime.start`.")}).describe("What a save needs from the client, which is nothing until the host asks a question. `{}` is the usual body.");var tn=d({id:z,code_hash:K.optional().describe("The cell's `code_hash` as last read. A cell whose code differs is a `conflict`. Absent, the cell runs as it is.")});d({code:l().optional().describe(`Python code to run as scratch code.`),cells:m(tn).min(1).optional().describe(`Cells of the document to run, in no particular order. The runtime's execution configuration determines whether dependent cells run too.`)}).describe("What to run, exactly one of `code` and `cells`.");var nn=[`notebook`,`document`,`cell`,`attachment`,`marimo`],rn=d({event:l().min(1),data:_(),id:l().min(1).optional()}),an=new Set(Z.options.flatMap(e=>e.shape.event.options)),on=d({data:X});function sn(e){if(typeof e==`object`&&e&&!(`event`in e))return{event:`marimo`,data:{marimo:on.parse(e).data}};let t=rn.parse(e);return an.has(t.event)?Z.parse(t):{event:`unknown`,name:t.event,id:t.id}}function cn(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;for(let t of Object.values(e))if(typeof t!=`string`)return!1;return!0}function ln(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e;return!(!cn(t.files)||t.modelNotifications!==void 0&&!Array.isArray(t.modelNotifications))}function Q(){let e=typeof window>`u`?void 0:window.__MARIMO_STATIC__;return ln(e)?e:void 0}function $(){return Q()!==void 0}function un(){let e=Q();return ne(e!==void 0,`Not a static notebook`),e.files}function dn(){return Q()?.modelNotifications}var fn=class{initialHealthyCheck=new ae;config;lazy;constructor(e,t=!1){this.config=e,this.lazy=t;try{new URL(this.config.url)}catch(e){throw Error(`Invalid runtime URL: ${this.config.url}. ${e instanceof Error?e.message:`Unknown error`}`,{cause:e})}this.lazy||this.init()}get isLazy(){return this.lazy}get httpURL(){return new URL(this.config.url)}get isSameOrigin(){return this.httpURL.origin===window.location.origin}get isServerless(){return S()||re()||$()}formatHttpURL({path:e=``,searchParams:t,restrictToKnownQueryParams:n=!0}){let r=this.httpURL,i=new URLSearchParams(window.location.search);if(t)for(let[e,n]of t.entries())r.searchParams.set(e,n);for(let[e,t]of i.entries())n&&!Object.values(y).includes(e)||r.searchParams.set(e,t);return r.pathname=`${r.pathname.replace(/\/$/,``)}/${e.replace(/^\//,``)}`,r.hash=``,r}appendCrossOriginAuth(e){return!this.isSameOrigin&&this.config.authToken&&e.searchParams.set(y.accessToken,this.config.authToken),e}formatNavigableHttpURL(e,t){let n=this.formatHttpURL({path:e,searchParams:t});return n.searchParams.delete(y.accessToken),this.appendCrossOriginAuth(n)}formatWsURL(e,t){let n=this.formatHttpURL({path:e,searchParams:t,restrictToKnownQueryParams:!1});return pn(this.appendCrossOriginAuth(n).toString())}getSessionSearchParams(e){let t=new URL(this.config.url),n=new URLSearchParams(t.search);return new URLSearchParams(window.location.search).forEach((e,t)=>{n.has(t)||n.set(t,e)}),n.set(y.sessionId,e),n}getWsURL(e){let t=this.getSessionSearchParams(e),n=this.config.notebookId,r=n?`/api/marimo/v1/notebooks/${encodeURIComponent(n)}/events/ws`:`/ws`,i=this.formatWsURL(r,t);return n&&i.searchParams.set(`types`,nn.join(`,`)),i}getSseURL(e){let t=this.formatHttpURL({path:`/sse`,searchParams:this.getSessionSearchParams(e),restrictToKnownQueryParams:!1});return t.searchParams.delete(y.accessToken),t}getWsSyncURL(e){return this.formatWsURL(`/ws_sync`,this.getSessionSearchParams(e))}getTerminalWsURL(e){let t=this.formatWsURL(`/terminal/ws`);return e&&(t.searchParams.set(`rows`,String(e.rows)),t.searchParams.set(`cols`,String(e.cols))),t}getLSPURL(e){if(e===`copilot`){let t=this.formatWsURL(`/lsp/${e}`),n=t.searchParams.get(y.accessToken);return t.search=``,n&&t.searchParams.set(y.accessToken,n),t}return this.formatWsURL(`/lsp/${e}`)}getAiURL(e){return this.formatHttpURL({path:`/api/ai/${e}`})}healthURL(){return this.formatHttpURL({path:`/health`})}async fetchHealth(){try{return await fetch(this.healthURL().toString())}catch(e){return v.error(`Failed to check health: ${e instanceof Error?e.message:`Unknown error`}`,{cause:e}),null}}async reconcileFromHealth(){if(this.isServerless)return!0;let e=await this.fetchHealth();if(!e)return!1;if(e.redirected){v.debug(`Runtime redirected to ${e.url}`);let t=new URL(e.url);t.pathname=t.pathname.replace(/\/health$/,``),this.config.url=t.toString()}return e.ok&&this.setDOMBaseUri(this.config.url),e.ok}async probeHealth(){return this.isServerless?!0:(await this.fetchHealth())?.ok??!1}setDOMBaseUri(e){e=e.split(`?`,1)[0],e.endsWith(`/`)||(e+=`/`);let t=document.querySelector(`base`);t?t.setAttribute(`href`,e):(t=document.createElement(`base`),t.setAttribute(`href`,e),document.head.append(t))}async init(e){v.debug(`Initializing runtime...`);let t=0;for(;!await this.reconcileFromHealth();){if(t>=25){v.error(`Failed to connect after 25 retries`),this.initialHealthyCheck.reject(Error(`Failed to connect after 25 retries`));return}if(!e?.disableRetryDelay){let e=Math.min(100*1.2**t,2e3);await new Promise(t=>setTimeout(t,e))}t++}v.debug(`Runtime is healthy`),this.initialHealthyCheck.resolve()}async waitForHealthy(){return this.initialHealthyCheck.promise}headers(){let e={"Marimo-Session-Id":b(),"Marimo-Server-Token":this.config.serverToken??``,"x-runtime-url":this.httpURL.toString()};return this.config.authToken&&(e.Authorization=`Bearer ${this.config.authToken}`),e}sessionHeaders(){return{"Marimo-Session-Id":b()}}};function pn(e){if(!e.startsWith(`http`)){v.warn(`URL must start with http: ${e}`);let t=new URL(e);return t.protocol=`ws`,t}return new URL(e.replace(/^http/,`ws`))}function mn(){let e=new URL(document.baseURI);return e.search=``,e.hash=``,e.toString()}var hn={lazy:!0,url:mn()},gn=n(hn),_n=n(e=>{let t=e(gn);return new fn(t,t.lazy)});function vn(){return r(_n)}function yn(){let e=(0,oe.c)(4),n=vn(),[r,i]=t(A),o;return e[0]!==r.state||e[1]!==n||e[2]!==i?(o=async()=>{M(r.state)?(i({state:k.CONNECTING}),await n.init()):v.log(`Runtime already started or starting...`)},e[0]=r.state,e[1]=n,e[2]=i,e[3]=o):o=e[3],a(o)}function bn(){return i.get(_n)}function xn(e){if(e.startsWith(`http`))return new URL(e);let t=bn().httpURL.toString();return t.startsWith(`blob:`)&&(t=t.replace(`blob:`,``)),new URL(e,t)}export{ve as A,j as C,be as D,k as E,de as M,ge as N,ce as O,S as P,xe as S,ye as T,Te as _,yn as a,Ce as b,un as c,je as d,ke as f,M as g,Ae as h,gn as i,O as j,C as k,$ as l,De as m,xn as n,vn as o,Oe as p,bn as r,dn as s,hn as t,sn as u,A as v,Se as w,Ee as x,we as y};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,u as n}from"./useEvent-Dfcbgjhg.js";import{t as r}from"./react-DVplv7_D.js";import{C as i,I as a,N as o}from"./schemas-ChRqMOTL.js";import{r as s}from"./config-BtRLgrlt.js";import{t as c}from"./compiler-runtime-BrajqUja.js";import{E as l,y as u}from"./config-CA1V-wjh.js";import{g as d,o as f}from"./useEventListener-D9cftcHj.js";import{t as p}from"./cn-ldLVeaqm.js";import{t as m}from"./jsx-runtime-B74pBk57.js";import{C as h,S as g,T as _,b as v,w as y,x as b,y as x}from"./fullscreen-B9tHcfpV.js";import{d as ee,u as te}from"./menu-items-BrwnTgyK.js";import{a as ne}from"./useNumberFormatter-D7O_26UI.js";import{t as S}from"./strings-B2vv-ENv.js";import{r as re}from"./requests-lt0JK8Jt.js";import{r as C}from"./errors-CNsgAw6m.js";var ie=o({command:a(),hostEnabled:i().default(!1),templates:o({prompt:a(),notebook:a(),session:a(),token_file:a(),token:a()})}),ae=t(void 0),w=e(r(),1),T=m(),oe=Object.defineProperty,E=(e,t)=>oe(e,`name`,{value:t,configurable:!0}),D=`Collapsible`,[se,O]=y(D),[ce,k]=se(D),le=w.forwardRef(E(function(e,t){let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=b({prop:r,defaultProp:i??!1,onChange:o,caller:D});return(0,T.jsx)(ce,{scope:n,disabled:a,contentId:x(),open:c,onOpenToggle:w.useCallback(()=>l(e=>!e),[l]),children:(0,T.jsx)(_.div,{"data-state":A(c),"data-disabled":a?``:void 0,...s,ref:t})})},`Collapsible`)),ue=`CollapsibleTrigger`,de=w.forwardRef(E(function(e,t){let{__scopeCollapsible:n,...r}=e,i=k(ue,n);return(0,T.jsx)(_.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":A(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:h(e.onClick,i.onOpenToggle)})},`CollapsibleTrigger`)),fe=`CollapsibleContent`,pe=w.forwardRef(E(function(e,t){let{forceMount:n,...r}=e,i=k(fe,e.__scopeCollapsible);return(0,T.jsx)(v,{present:n||i.open,children:({present:e})=>(0,T.jsx)(me,{...r,ref:t,present:e})})},`CollapsibleContent`)),me=w.forwardRef(E(function(e,t){let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=k(fe,n),[s,c]=w.useState(r),l=w.useRef(null),u=f(t,l),d=w.useRef(0),p=d.current,m=w.useRef(0),h=m.current,v=o.open||s,y=w.useRef(v),b=w.useRef(void 0);return w.useEffect(()=>{let e=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(e)},[]),g(()=>{let e=l.current;if(e){b.current=b.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,m.current=t.width,y.current||(e.style.transitionDuration=b.current.transitionDuration,e.style.animationName=b.current.animationName),c(r)}},[o.open,r]),(0,T.jsx)(_.div,{"data-state":A(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!v,...a,ref:u,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...e.style},children:v&&i})},`CollapsibleContentImpl`));function A(e){return e?`open`:`closed`}E(A,`getState`);var he=le,ge=de,_e=pe,ve=Object.defineProperty,j=(e,t)=>ve(e,`name`,{value:t,configurable:!0}),M=`Accordion`,ye=[`Home`,`End`,`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`],[N,be,xe]=ee(M),[P,Se]=y(M,[xe,O]),F=O(),Ce=w.forwardRef(j(function(e,t){let{type:n,...r}=e,i=r,a=r;return(0,T.jsx)(N.Provider,{scope:e.__scopeAccordion,children:n===`multiple`?(0,T.jsx)(De,{...a,ref:t}):(0,T.jsx)(Ee,{...i,ref:t})})},`Accordion`)),[I,we]=P(M),[L,Te]=P(M,{collapsible:!1}),Ee=w.forwardRef(j(function(e,t){let{value:n,defaultValue:r,onValueChange:i=j(()=>{},`onValueChange`),collapsible:a=!1,...o}=e,[s,c]=b({prop:n,defaultProp:r??``,onChange:i,caller:M});return(0,T.jsx)(I,{scope:e.__scopeAccordion,value:w.useMemo(()=>s?[s]:[],[s]),onItemOpen:c,onItemClose:w.useCallback(()=>a&&c(``),[a,c]),children:(0,T.jsx)(L,{scope:e.__scopeAccordion,collapsible:a,children:(0,T.jsx)(z,{...o,ref:t})})})},`AccordionImplSingle`)),De=w.forwardRef(j(function(e,t){let{value:n,defaultValue:r,onValueChange:i=j(()=>{},`onValueChange`),...a}=e,[o,s]=b({prop:n,defaultProp:r??[],onChange:i,caller:M}),c=w.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=w.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,T.jsx)(I,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:l,children:(0,T.jsx)(L,{scope:e.__scopeAccordion,collapsible:!0,children:(0,T.jsx)(z,{...a,ref:t})})})},`AccordionImplMultiple`)),[Oe,R]=P(M),z=w.forwardRef(j(function(e,t){let{__scopeAccordion:n,disabled:r,dir:i,orientation:a=`vertical`,...o}=e,s=w.useRef(null),c=f(s,t),l=be(n),u=te(i)===`ltr`,d=h(e.onKeyDown,e=>{if(!ye.includes(e.key))return;let t=e.target,n=l().filter(e=>!e.ref.current?.disabled),r=n.findIndex(e=>e.ref.current===t),i=n.length;if(r===-1)return;e.preventDefault();let o=r,s=i-1,c=j(()=>{o=r+1,o>s&&(o=0)},`moveNext`),d=j(()=>{o=r-1,o<0&&(o=s)},`movePrev`);switch(e.key){case`Home`:o=0;break;case`End`:o=s;break;case`ArrowRight`:a===`horizontal`&&(u?c():d());break;case`ArrowDown`:a===`vertical`&&c();break;case`ArrowLeft`:a===`horizontal`&&(u?d():c());break;case`ArrowUp`:a===`vertical`&&d()}n[o%i].ref.current?.focus()});return(0,T.jsx)(Oe,{scope:n,disabled:r,direction:i,orientation:a,children:(0,T.jsx)(N.Slot,{scope:n,children:(0,T.jsx)(_.div,{...o,"data-orientation":a,ref:c,onKeyDown:r?void 0:d})})})},`AccordionImpl`)),B=`AccordionItem`,[ke,V]=P(B),Ae=w.forwardRef(j(function(e,t){let{__scopeAccordion:n,value:r,...i}=e,a=R(B,n),o=we(B,n),s=F(n),c=x(),l=r&&o.value.includes(r)||!1,u=a.disabled||e.disabled;return(0,T.jsx)(ke,{scope:n,open:l,disabled:u,triggerId:c,children:(0,T.jsx)(he,{"data-orientation":a.orientation,"data-state":U(l),...s,...i,ref:t,disabled:u,open:l,onOpenChange:e=>{e?o.onItemOpen(r):o.onItemClose(r)}})})},`AccordionItem`)),je=`AccordionHeader`,Me=w.forwardRef(j(function(e,t){let{__scopeAccordion:n,...r}=e,i=R(M,n),a=V(je,n);return(0,T.jsx)(_.h3,{"data-orientation":i.orientation,"data-state":U(a.open),"data-disabled":a.disabled?``:void 0,...r,ref:t})},`AccordionHeader`)),H=`AccordionTrigger`,Ne=w.forwardRef(j(function(e,t){let{__scopeAccordion:n,...r}=e,i=R(M,n),a=V(H,n),o=Te(H,n),s=F(n);return(0,T.jsx)(N.ItemSlot,{scope:n,children:(0,T.jsx)(ge,{"aria-disabled":a.open&&!o.collapsible||void 0,"data-orientation":i.orientation,id:a.triggerId,...s,...r,ref:t})})},`AccordionTrigger`)),Pe=`AccordionContent`,Fe=w.forwardRef(j(function(e,t){let{__scopeAccordion:n,...r}=e,i=R(M,n),a=V(Pe,n),o=F(n);return(0,T.jsx)(_e,{role:`region`,"aria-labelledby":a.triggerId,"data-orientation":i.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":`var(--radix-collapsible-content-height)`,"--radix-accordion-content-width":`var(--radix-collapsible-content-width)`,...e.style}})},`AccordionContent`));function U(e){return e?`open`:`closed`}j(U,`getState`);var W=Ce,G=Ae,Ie=Me,K=Ne,q=Fe,Le={"Content-Type":`application/json`},Re=/\{[^{}]+\}/g,ze=class extends Request{constructor(e,t){super(e,t);for(let e in t)e in this||(this[e]=t[e])}};function Be(e){let{baseUrl:t=``,fetch:n=globalThis.fetch,querySerializer:r,bodySerializer:i,headers:a,...o}={...e};t.endsWith(`/`)&&(t=t.substring(0,t.length-1)),a=Ge(Le,a);let s=[];async function c(e,c){let{fetch:l=n,headers:u,params:d={},parseAs:f=`json`,querySerializer:p,bodySerializer:m=i??Ue,...h}=c||{},g=typeof r==`function`?r:Ve(r);p&&(g=typeof p==`function`?p:Ve({...typeof r==`object`?r:{},...p}));let _={redirect:`follow`,...o,...h,headers:Ge(a,u,d.header)};_.body&&=m(_.body),_.body instanceof FormData&&_.headers.delete(`Content-Type`);let v=new ze(We(e,{baseUrl:t,params:d,querySerializer:g}),_),y={baseUrl:t,fetch:l,parseAs:f,querySerializer:g,bodySerializer:m};for(let t of s)if(t&&typeof t==`object`&&typeof t.onRequest==`function`){v.schemaPath=e,v.params=d;let n=await t.onRequest(v,y);if(n){if(!(n instanceof Request))throw Error(`Middleware must return new Request() when modifying the request`);v=n}}let b=await l(v);for(let e=s.length-1;e>=0;e--){let t=s[e];if(t&&typeof t==`object`&&typeof t.onResponse==`function`){let e=await t.onResponse(b,y);if(e){if(!(e instanceof Response))throw Error(`Middleware must return new Response() when modifying the response`);b=e}}}if(b.status===204||b.headers.get(`Content-Length`)===`0`)return b.ok?{data:{},response:b}:{error:{},response:b};if(b.ok)return f===`stream`?{data:b.body,response:b}:{data:await b[f](),response:b};let x=await b.text();try{x=JSON.parse(x)}catch{}return{error:x,response:b}}return{async GET(e,t){return c(e,{...t,method:`GET`})},async PUT(e,t){return c(e,{...t,method:`PUT`})},async POST(e,t){return c(e,{...t,method:`POST`})},async DELETE(e,t){return c(e,{...t,method:`DELETE`})},async OPTIONS(e,t){return c(e,{...t,method:`OPTIONS`})},async HEAD(e,t){return c(e,{...t,method:`HEAD`})},async PATCH(e,t){return c(e,{...t,method:`PATCH`})},async TRACE(e,t){return c(e,{...t,method:`TRACE`})},use(...e){for(let t of e)if(t){if(typeof t!=`object`||!(`onRequest`in t||`onResponse`in t))throw Error("Middleware must be an object with one of `onRequest()` or `onResponse()`");s.push(t)}},eject(...e){for(let t of e){let e=s.indexOf(t);e!==-1&&s.splice(e,1)}}}}function J(e,t,n){if(t==null)return``;if(typeof t==`object`)throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${e}=${n?.allowReserved===!0?t:encodeURIComponent(t)}`}function Y(e,t,n){if(!t||typeof t!=`object`)return``;let r=[],i={simple:`,`,label:`.`,matrix:`;`}[n.style]||`&`;if(n.style!==`deepObject`&&n.explode===!1){for(let e in t)r.push(e,n.allowReserved===!0?t[e]:encodeURIComponent(t[e]));let i=r.join(`,`);switch(n.style){case`form`:return`${e}=${i}`;case`label`:return`.${i}`;case`matrix`:return`;${e}=${i}`;default:return i}}for(let i in t){let a=n.style===`deepObject`?`${e}[${i}]`:i;r.push(J(a,t[i],n))}let a=r.join(i);return n.style===`label`||n.style===`matrix`?`${i}${a}`:a}function X(e,t,n){if(!Array.isArray(t))return``;if(n.explode===!1){let r={form:`,`,spaceDelimited:`%20`,pipeDelimited:`|`}[n.style]||`,`,i=(n.allowReserved===!0?t:t.map(e=>encodeURIComponent(e))).join(r);switch(n.style){case`simple`:return i;case`label`:return`.${i}`;case`matrix`:return`;${e}=${i}`;default:return`${e}=${i}`}}let r={simple:`,`,label:`.`,matrix:`;`}[n.style]||`&`,i=[];for(let r of t)n.style===`simple`||n.style===`label`?i.push(n.allowReserved===!0?r:encodeURIComponent(r)):i.push(J(e,r,n));return n.style===`label`||n.style===`matrix`?`${r}${i.join(r)}`:i.join(r)}function Ve(e){return function(t){let n=[];if(t&&typeof t==`object`)for(let r in t){let i=t[r];if(i!=null){if(Array.isArray(i)){n.push(X(r,i,{style:`form`,explode:!0,...e?.array,allowReserved:e?.allowReserved||!1}));continue}if(typeof i==`object`){n.push(Y(r,i,{style:`deepObject`,explode:!0,...e?.object,allowReserved:e?.allowReserved||!1}));continue}n.push(J(r,i,e))}}return n.join(`&`)}}function He(e,t){let n=e;for(let r of e.match(Re)??[]){let e=r.substring(1,r.length-1),i=!1,a=`simple`;if(e.endsWith(`*`)&&(i=!0,e=e.substring(0,e.length-1)),e.startsWith(`.`)?(a=`label`,e=e.substring(1)):e.startsWith(`;`)&&(a=`matrix`,e=e.substring(1)),!t||t[e]===void 0||t[e]===null)continue;let o=t[e];if(Array.isArray(o)){n=n.replace(r,X(e,o,{style:a,explode:i}));continue}if(typeof o==`object`){n=n.replace(r,Y(e,o,{style:a,explode:i}));continue}if(a===`matrix`){n=n.replace(r,`;${J(e,o)}`);continue}n=n.replace(r,a===`label`?`.${o}`:o)}return n}function Ue(e){return JSON.stringify(e)}function We(e,t){let n=`${t.baseUrl}${e}`;t.params?.path&&(n=He(n,t.params.path));let r=t.querySerializer(t.params.query??{});return r.startsWith(`?`)&&(r=r.substring(1)),r&&(n+=`?${r}`),n}function Ge(...e){let t=new Headers;for(let n of e){if(!n||typeof n!=`object`)continue;let e=n instanceof Headers?n.entries():Object.entries(n);for(let[n,r]of e)if(r===null)t.delete(n);else if(Array.isArray(r))for(let e of r)t.append(n,e);else r!==void 0&&t.set(n,r)}return t}function Ke(e){return Be(e)}function qe(){let e=s().httpURL;return e.search=``,e.hash=``,e.toString()}function Je(e){if(!e)return;let t=e.match(/filename\*=UTF-8''([^;]+)/i);if(t)try{return decodeURIComponent(t[1])}catch{return}let n=e.match(/filename="([^"]+)"/i);if(n)return n[1];let r=e.match(/filename=([^;]+)/i);if(r)return r[1].trim()}function Ye(e){let t=Je(e.headers.get(`Content-Disposition`));return t||d.warn(`Export response is missing a readable Content-Disposition filename`),t}var Z={post(e,t,n={}){let r=`${S.withTrailingSlash(n.baseUrl??qe())}api${e}`;return fetch(r,{method:`POST`,headers:{"Content-Type":`application/json`,...Z.headers(),...n.headers},body:JSON.stringify(t),signal:n.signal}).then(async e=>{let t=e.headers.get(`Content-Type`)?.startsWith(`application/json`);if(!e.ok){let n=t?await e.json():await e.text();throw new C(e.status,e.statusText,n)}return t?e.json():e.text()}).catch(e=>{throw e?.name!==`AbortError`&&d.error(`Error requesting ${r}`,e),e})},get(e,t={}){let n=`${S.withTrailingSlash(t.baseUrl??qe())}api${e}`;return fetch(n,{method:`GET`,headers:{...Z.headers(),...t.headers}}).then(e=>{if(!e.ok)throw new C(e.status,e.statusText);return e.headers.get(`Content-Type`)?.startsWith(`application/json`)?e.json():null}).catch(e=>{throw d.error(`Error requesting ${n}`,e),e})},headers(){return s().headers()},handleResponse:e=>e.error?Promise.reject(new C(e.response.status,e.response.statusText,e.error)):Promise.resolve(e.data),handleExportResponse:async(e,t)=>{let n=await Z.handleResponse(e),r=e.response.headers.get(`Content-Type`);if(!r)throw Error(`Export response is missing a media type`);return{contents:n,filename:Ye(e.response)??t.defaultFilename,mediaType:r}},handleResponseReturnNull:e=>e.error?Promise.reject(new C(e.response.status,e.response.statusText,e.error)):Promise.resolve(null)};function Xe(e){let t=Ke({baseUrl:e.httpURL.toString()});return t.use({onRequest:t=>{let n=e.headers();for(let[e,r]of Object.entries(n))t.headers.set(e,r);return t}}),t}var Q=c(),Ze=W,Qe=w.forwardRef((e,t)=>{let n=(0,Q.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=p(`border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,T.jsx)(G,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Qe.displayName=`AccordionItem`;var $e=w.forwardRef((e,t)=>{let n=(0,Q.c)(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=p(`flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180 text-start`,i),n[4]=i,n[5]=o);let s;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,T.jsx)(ne,{className:`h-4 w-4 transition-transform duration-200`}),n[6]=s):s=n[6];let c;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==o?(c=(0,T.jsx)(Ie,{className:`flex`,children:(0,T.jsxs)(K,{ref:t,className:o,...a,children:[r,s]})}),n[7]=r,n[8]=a,n[9]=t,n[10]=o,n[11]=c):c=n[11],c});$e.displayName=K.displayName;var $=w.forwardRef((e,t)=>{let n=(0,Q.c)(17),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:i,children:r,wrapperClassName:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s;n[5]===i?s=n[6]:(s=p(`overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down`,i),n[5]=i,n[6]=s);let c;n[7]===o?c=n[8]:(c=p(`pb-4 pt-0`,o),n[7]=o,n[8]=c);let l;n[9]!==r||n[10]!==c?(l=(0,T.jsx)(`div`,{className:c,children:r}),n[9]=r,n[10]=c,n[11]=l):l=n[11];let u;return n[12]!==a||n[13]!==t||n[14]!==s||n[15]!==l?(u=(0,T.jsx)(q,{ref:t,className:s,...a,children:l}),n[12]=a,n[13]=t,n[14]=s,n[15]=l,n[16]=u):u=n[16],u});$.displayName=q.displayName;var et=class{map=new Map;get(e){return this.map.get(e)??[]}set(e,t){this.map.set(e,t)}add(e,t){this.map.has(e)?this.map.get(e).push(t):this.map.set(e,[t])}has(e){return this.map.has(e)}delete(e){return this.map.delete(e)}clear(){this.map.clear()}keys(){return this.map.keys()}values(){return this.map.values()}entries(){return this.map.entries()}forEach(e){this.map.forEach(e)}flatValues(){let e=[];for(let t of this.map.values())e.push(...t);return e}get size(){return this.map.size}},tt=e=>{switch(e){case`chat`:return`chat_model`;case`autocomplete`:return`autocomplete_model`;case`edit`:return`edit_model`}},nt=()=>{let e=(0,Q.c)(10),t=n(l),{saveUserConfig:r}=re(),i;e[0]!==r||e[1]!==t?(i=async e=>{let n={ai:e};await r({config:n}).then(()=>{t(e=>u(e,n))})},e[0]=r,e[1]=t,e[2]=i):i=e[2];let a=i,o;e[3]===a?o=e[4]:(o=async(e,t)=>{let n=tt(t);n&&await a({models:{[n]:e}})},e[3]=a,e[4]=o);let s=o,c;e[5]===a?c=e[6]:(c=async e=>{await a({mode:e})},e[5]=a,e[6]=c);let d=c,f;return e[7]!==d||e[8]!==s?(f={saveModelChange:s,saveModeChange:d},e[7]=d,e[8]=s,e[9]=f):f=e[9],f};export{Qe as a,Xe as c,W as d,K as f,$ as i,q as l,ie as m,et as n,$e as o,ae as p,Ze as r,Z as s,nt as t,G as u};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,u as n}from"./useEvent-Dfcbgjhg.js";import{t as r}from"./react-DVplv7_D.js";import{C as i,I as a,N as o}from"./schemas-ChRqMOTL.js";import{r as s}from"./config-BHq_PhD6.js";import{t as c}from"./compiler-runtime-BrajqUja.js";import{E as l,y as u}from"./config-CA1V-wjh.js";import{g as d,o as f}from"./useEventListener-D9cftcHj.js";import{t as p}from"./cn-ldLVeaqm.js";import{t as m}from"./jsx-runtime-B74pBk57.js";import{C as h,S as g,T as _,b as v,w as y,x as b,y as x}from"./fullscreen-B9tHcfpV.js";import{d as ee,u as te}from"./menu-items-BrwnTgyK.js";import{a as ne}from"./useNumberFormatter-D7O_26UI.js";import{t as S}from"./strings-B2vv-ENv.js";import{r as re}from"./requests-lt0JK8Jt.js";import{r as C}from"./errors-CNsgAw6m.js";var ie=o({command:a(),hostEnabled:i().default(!1),templates:o({prompt:a(),notebook:a(),session:a(),token_file:a(),token:a()})}),ae=t(void 0),w=e(r(),1),T=m(),oe=Object.defineProperty,E=(e,t)=>oe(e,`name`,{value:t,configurable:!0}),D=`Collapsible`,[se,O]=y(D),[ce,k]=se(D),le=w.forwardRef(E(function(e,t){let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=b({prop:r,defaultProp:i??!1,onChange:o,caller:D});return(0,T.jsx)(ce,{scope:n,disabled:a,contentId:x(),open:c,onOpenToggle:w.useCallback(()=>l(e=>!e),[l]),children:(0,T.jsx)(_.div,{"data-state":A(c),"data-disabled":a?``:void 0,...s,ref:t})})},`Collapsible`)),ue=`CollapsibleTrigger`,de=w.forwardRef(E(function(e,t){let{__scopeCollapsible:n,...r}=e,i=k(ue,n);return(0,T.jsx)(_.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":A(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:h(e.onClick,i.onOpenToggle)})},`CollapsibleTrigger`)),fe=`CollapsibleContent`,pe=w.forwardRef(E(function(e,t){let{forceMount:n,...r}=e,i=k(fe,e.__scopeCollapsible);return(0,T.jsx)(v,{present:n||i.open,children:({present:e})=>(0,T.jsx)(me,{...r,ref:t,present:e})})},`CollapsibleContent`)),me=w.forwardRef(E(function(e,t){let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=k(fe,n),[s,c]=w.useState(r),l=w.useRef(null),u=f(t,l),d=w.useRef(0),p=d.current,m=w.useRef(0),h=m.current,v=o.open||s,y=w.useRef(v),b=w.useRef(void 0);return w.useEffect(()=>{let e=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(e)},[]),g(()=>{let e=l.current;if(e){b.current=b.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,m.current=t.width,y.current||(e.style.transitionDuration=b.current.transitionDuration,e.style.animationName=b.current.animationName),c(r)}},[o.open,r]),(0,T.jsx)(_.div,{"data-state":A(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!v,...a,ref:u,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...e.style},children:v&&i})},`CollapsibleContentImpl`));function A(e){return e?`open`:`closed`}E(A,`getState`);var he=le,ge=de,_e=pe,ve=Object.defineProperty,j=(e,t)=>ve(e,`name`,{value:t,configurable:!0}),M=`Accordion`,ye=[`Home`,`End`,`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`],[N,be,xe]=ee(M),[P,Se]=y(M,[xe,O]),F=O(),Ce=w.forwardRef(j(function(e,t){let{type:n,...r}=e,i=r,a=r;return(0,T.jsx)(N.Provider,{scope:e.__scopeAccordion,children:n===`multiple`?(0,T.jsx)(De,{...a,ref:t}):(0,T.jsx)(Ee,{...i,ref:t})})},`Accordion`)),[I,we]=P(M),[L,Te]=P(M,{collapsible:!1}),Ee=w.forwardRef(j(function(e,t){let{value:n,defaultValue:r,onValueChange:i=j(()=>{},`onValueChange`),collapsible:a=!1,...o}=e,[s,c]=b({prop:n,defaultProp:r??``,onChange:i,caller:M});return(0,T.jsx)(I,{scope:e.__scopeAccordion,value:w.useMemo(()=>s?[s]:[],[s]),onItemOpen:c,onItemClose:w.useCallback(()=>a&&c(``),[a,c]),children:(0,T.jsx)(L,{scope:e.__scopeAccordion,collapsible:a,children:(0,T.jsx)(z,{...o,ref:t})})})},`AccordionImplSingle`)),De=w.forwardRef(j(function(e,t){let{value:n,defaultValue:r,onValueChange:i=j(()=>{},`onValueChange`),...a}=e,[o,s]=b({prop:n,defaultProp:r??[],onChange:i,caller:M}),c=w.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=w.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,T.jsx)(I,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:l,children:(0,T.jsx)(L,{scope:e.__scopeAccordion,collapsible:!0,children:(0,T.jsx)(z,{...a,ref:t})})})},`AccordionImplMultiple`)),[Oe,R]=P(M),z=w.forwardRef(j(function(e,t){let{__scopeAccordion:n,disabled:r,dir:i,orientation:a=`vertical`,...o}=e,s=w.useRef(null),c=f(s,t),l=be(n),u=te(i)===`ltr`,d=h(e.onKeyDown,e=>{if(!ye.includes(e.key))return;let t=e.target,n=l().filter(e=>!e.ref.current?.disabled),r=n.findIndex(e=>e.ref.current===t),i=n.length;if(r===-1)return;e.preventDefault();let o=r,s=i-1,c=j(()=>{o=r+1,o>s&&(o=0)},`moveNext`),d=j(()=>{o=r-1,o<0&&(o=s)},`movePrev`);switch(e.key){case`Home`:o=0;break;case`End`:o=s;break;case`ArrowRight`:a===`horizontal`&&(u?c():d());break;case`ArrowDown`:a===`vertical`&&c();break;case`ArrowLeft`:a===`horizontal`&&(u?d():c());break;case`ArrowUp`:a===`vertical`&&d()}n[o%i].ref.current?.focus()});return(0,T.jsx)(Oe,{scope:n,disabled:r,direction:i,orientation:a,children:(0,T.jsx)(N.Slot,{scope:n,children:(0,T.jsx)(_.div,{...o,"data-orientation":a,ref:c,onKeyDown:r?void 0:d})})})},`AccordionImpl`)),B=`AccordionItem`,[ke,V]=P(B),Ae=w.forwardRef(j(function(e,t){let{__scopeAccordion:n,value:r,...i}=e,a=R(B,n),o=we(B,n),s=F(n),c=x(),l=r&&o.value.includes(r)||!1,u=a.disabled||e.disabled;return(0,T.jsx)(ke,{scope:n,open:l,disabled:u,triggerId:c,children:(0,T.jsx)(he,{"data-orientation":a.orientation,"data-state":U(l),...s,...i,ref:t,disabled:u,open:l,onOpenChange:e=>{e?o.onItemOpen(r):o.onItemClose(r)}})})},`AccordionItem`)),je=`AccordionHeader`,Me=w.forwardRef(j(function(e,t){let{__scopeAccordion:n,...r}=e,i=R(M,n),a=V(je,n);return(0,T.jsx)(_.h3,{"data-orientation":i.orientation,"data-state":U(a.open),"data-disabled":a.disabled?``:void 0,...r,ref:t})},`AccordionHeader`)),H=`AccordionTrigger`,Ne=w.forwardRef(j(function(e,t){let{__scopeAccordion:n,...r}=e,i=R(M,n),a=V(H,n),o=Te(H,n),s=F(n);return(0,T.jsx)(N.ItemSlot,{scope:n,children:(0,T.jsx)(ge,{"aria-disabled":a.open&&!o.collapsible||void 0,"data-orientation":i.orientation,id:a.triggerId,...s,...r,ref:t})})},`AccordionTrigger`)),Pe=`AccordionContent`,Fe=w.forwardRef(j(function(e,t){let{__scopeAccordion:n,...r}=e,i=R(M,n),a=V(Pe,n),o=F(n);return(0,T.jsx)(_e,{role:`region`,"aria-labelledby":a.triggerId,"data-orientation":i.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":`var(--radix-collapsible-content-height)`,"--radix-accordion-content-width":`var(--radix-collapsible-content-width)`,...e.style}})},`AccordionContent`));function U(e){return e?`open`:`closed`}j(U,`getState`);var W=Ce,G=Ae,Ie=Me,K=Ne,q=Fe,Le={"Content-Type":`application/json`},Re=/\{[^{}]+\}/g,ze=class extends Request{constructor(e,t){super(e,t);for(let e in t)e in this||(this[e]=t[e])}};function Be(e){let{baseUrl:t=``,fetch:n=globalThis.fetch,querySerializer:r,bodySerializer:i,headers:a,...o}={...e};t.endsWith(`/`)&&(t=t.substring(0,t.length-1)),a=Ge(Le,a);let s=[];async function c(e,c){let{fetch:l=n,headers:u,params:d={},parseAs:f=`json`,querySerializer:p,bodySerializer:m=i??Ue,...h}=c||{},g=typeof r==`function`?r:Ve(r);p&&(g=typeof p==`function`?p:Ve({...typeof r==`object`?r:{},...p}));let _={redirect:`follow`,...o,...h,headers:Ge(a,u,d.header)};_.body&&=m(_.body),_.body instanceof FormData&&_.headers.delete(`Content-Type`);let v=new ze(We(e,{baseUrl:t,params:d,querySerializer:g}),_),y={baseUrl:t,fetch:l,parseAs:f,querySerializer:g,bodySerializer:m};for(let t of s)if(t&&typeof t==`object`&&typeof t.onRequest==`function`){v.schemaPath=e,v.params=d;let n=await t.onRequest(v,y);if(n){if(!(n instanceof Request))throw Error(`Middleware must return new Request() when modifying the request`);v=n}}let b=await l(v);for(let e=s.length-1;e>=0;e--){let t=s[e];if(t&&typeof t==`object`&&typeof t.onResponse==`function`){let e=await t.onResponse(b,y);if(e){if(!(e instanceof Response))throw Error(`Middleware must return new Response() when modifying the response`);b=e}}}if(b.status===204||b.headers.get(`Content-Length`)===`0`)return b.ok?{data:{},response:b}:{error:{},response:b};if(b.ok)return f===`stream`?{data:b.body,response:b}:{data:await b[f](),response:b};let x=await b.text();try{x=JSON.parse(x)}catch{}return{error:x,response:b}}return{async GET(e,t){return c(e,{...t,method:`GET`})},async PUT(e,t){return c(e,{...t,method:`PUT`})},async POST(e,t){return c(e,{...t,method:`POST`})},async DELETE(e,t){return c(e,{...t,method:`DELETE`})},async OPTIONS(e,t){return c(e,{...t,method:`OPTIONS`})},async HEAD(e,t){return c(e,{...t,method:`HEAD`})},async PATCH(e,t){return c(e,{...t,method:`PATCH`})},async TRACE(e,t){return c(e,{...t,method:`TRACE`})},use(...e){for(let t of e)if(t){if(typeof t!=`object`||!(`onRequest`in t||`onResponse`in t))throw Error("Middleware must be an object with one of `onRequest()` or `onResponse()`");s.push(t)}},eject(...e){for(let t of e){let e=s.indexOf(t);e!==-1&&s.splice(e,1)}}}}function J(e,t,n){if(t==null)return``;if(typeof t==`object`)throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${e}=${n?.allowReserved===!0?t:encodeURIComponent(t)}`}function Y(e,t,n){if(!t||typeof t!=`object`)return``;let r=[],i={simple:`,`,label:`.`,matrix:`;`}[n.style]||`&`;if(n.style!==`deepObject`&&n.explode===!1){for(let e in t)r.push(e,n.allowReserved===!0?t[e]:encodeURIComponent(t[e]));let i=r.join(`,`);switch(n.style){case`form`:return`${e}=${i}`;case`label`:return`.${i}`;case`matrix`:return`;${e}=${i}`;default:return i}}for(let i in t){let a=n.style===`deepObject`?`${e}[${i}]`:i;r.push(J(a,t[i],n))}let a=r.join(i);return n.style===`label`||n.style===`matrix`?`${i}${a}`:a}function X(e,t,n){if(!Array.isArray(t))return``;if(n.explode===!1){let r={form:`,`,spaceDelimited:`%20`,pipeDelimited:`|`}[n.style]||`,`,i=(n.allowReserved===!0?t:t.map(e=>encodeURIComponent(e))).join(r);switch(n.style){case`simple`:return i;case`label`:return`.${i}`;case`matrix`:return`;${e}=${i}`;default:return`${e}=${i}`}}let r={simple:`,`,label:`.`,matrix:`;`}[n.style]||`&`,i=[];for(let r of t)n.style===`simple`||n.style===`label`?i.push(n.allowReserved===!0?r:encodeURIComponent(r)):i.push(J(e,r,n));return n.style===`label`||n.style===`matrix`?`${r}${i.join(r)}`:i.join(r)}function Ve(e){return function(t){let n=[];if(t&&typeof t==`object`)for(let r in t){let i=t[r];if(i!=null){if(Array.isArray(i)){n.push(X(r,i,{style:`form`,explode:!0,...e?.array,allowReserved:e?.allowReserved||!1}));continue}if(typeof i==`object`){n.push(Y(r,i,{style:`deepObject`,explode:!0,...e?.object,allowReserved:e?.allowReserved||!1}));continue}n.push(J(r,i,e))}}return n.join(`&`)}}function He(e,t){let n=e;for(let r of e.match(Re)??[]){let e=r.substring(1,r.length-1),i=!1,a=`simple`;if(e.endsWith(`*`)&&(i=!0,e=e.substring(0,e.length-1)),e.startsWith(`.`)?(a=`label`,e=e.substring(1)):e.startsWith(`;`)&&(a=`matrix`,e=e.substring(1)),!t||t[e]===void 0||t[e]===null)continue;let o=t[e];if(Array.isArray(o)){n=n.replace(r,X(e,o,{style:a,explode:i}));continue}if(typeof o==`object`){n=n.replace(r,Y(e,o,{style:a,explode:i}));continue}if(a===`matrix`){n=n.replace(r,`;${J(e,o)}`);continue}n=n.replace(r,a===`label`?`.${o}`:o)}return n}function Ue(e){return JSON.stringify(e)}function We(e,t){let n=`${t.baseUrl}${e}`;t.params?.path&&(n=He(n,t.params.path));let r=t.querySerializer(t.params.query??{});return r.startsWith(`?`)&&(r=r.substring(1)),r&&(n+=`?${r}`),n}function Ge(...e){let t=new Headers;for(let n of e){if(!n||typeof n!=`object`)continue;let e=n instanceof Headers?n.entries():Object.entries(n);for(let[n,r]of e)if(r===null)t.delete(n);else if(Array.isArray(r))for(let e of r)t.append(n,e);else r!==void 0&&t.set(n,r)}return t}function Ke(e){return Be(e)}function qe(){let e=s().httpURL;return e.search=``,e.hash=``,e.toString()}function Je(e){if(!e)return;let t=e.match(/filename\*=UTF-8''([^;]+)/i);if(t)try{return decodeURIComponent(t[1])}catch{return}let n=e.match(/filename="([^"]+)"/i);if(n)return n[1];let r=e.match(/filename=([^;]+)/i);if(r)return r[1].trim()}function Ye(e){let t=Je(e.headers.get(`Content-Disposition`));return t||d.warn(`Export response is missing a readable Content-Disposition filename`),t}var Z={post(e,t,n={}){let r=`${S.withTrailingSlash(n.baseUrl??qe())}api${e}`;return fetch(r,{method:`POST`,headers:{"Content-Type":`application/json`,...Z.headers(),...n.headers},body:JSON.stringify(t),signal:n.signal}).then(async e=>{let t=e.headers.get(`Content-Type`)?.startsWith(`application/json`);if(!e.ok){let n=t?await e.json():await e.text();throw new C(e.status,e.statusText,n)}return t?e.json():e.text()}).catch(e=>{throw e?.name!==`AbortError`&&d.error(`Error requesting ${r}`,e),e})},get(e,t={}){let n=`${S.withTrailingSlash(t.baseUrl??qe())}api${e}`;return fetch(n,{method:`GET`,headers:{...Z.headers(),...t.headers}}).then(e=>{if(!e.ok)throw new C(e.status,e.statusText);return e.headers.get(`Content-Type`)?.startsWith(`application/json`)?e.json():null}).catch(e=>{throw d.error(`Error requesting ${n}`,e),e})},headers(){return s().headers()},handleResponse:e=>e.error?Promise.reject(new C(e.response.status,e.response.statusText,e.error)):Promise.resolve(e.data),handleExportResponse:async(e,t)=>{let n=await Z.handleResponse(e),r=e.response.headers.get(`Content-Type`);if(!r)throw Error(`Export response is missing a media type`);return{contents:n,filename:Ye(e.response)??t.defaultFilename,mediaType:r}},handleResponseReturnNull:e=>e.error?Promise.reject(new C(e.response.status,e.response.statusText,e.error)):Promise.resolve(null)};function Xe(e){let t=Ke({baseUrl:e.httpURL.toString()});return t.use({onRequest:t=>{let n=e.headers();for(let[e,r]of Object.entries(n))t.headers.set(e,r);return t}}),t}var Q=c(),Ze=W,Qe=w.forwardRef((e,t)=>{let n=(0,Q.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=p(`border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,T.jsx)(G,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Qe.displayName=`AccordionItem`;var $e=w.forwardRef((e,t)=>{let n=(0,Q.c)(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=p(`flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180 text-start`,i),n[4]=i,n[5]=o);let s;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,T.jsx)(ne,{className:`h-4 w-4 transition-transform duration-200`}),n[6]=s):s=n[6];let c;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==o?(c=(0,T.jsx)(Ie,{className:`flex`,children:(0,T.jsxs)(K,{ref:t,className:o,...a,children:[r,s]})}),n[7]=r,n[8]=a,n[9]=t,n[10]=o,n[11]=c):c=n[11],c});$e.displayName=K.displayName;var $=w.forwardRef((e,t)=>{let n=(0,Q.c)(17),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:i,children:r,wrapperClassName:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s;n[5]===i?s=n[6]:(s=p(`overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down`,i),n[5]=i,n[6]=s);let c;n[7]===o?c=n[8]:(c=p(`pb-4 pt-0`,o),n[7]=o,n[8]=c);let l;n[9]!==r||n[10]!==c?(l=(0,T.jsx)(`div`,{className:c,children:r}),n[9]=r,n[10]=c,n[11]=l):l=n[11];let u;return n[12]!==a||n[13]!==t||n[14]!==s||n[15]!==l?(u=(0,T.jsx)(q,{ref:t,className:s,...a,children:l}),n[12]=a,n[13]=t,n[14]=s,n[15]=l,n[16]=u):u=n[16],u});$.displayName=q.displayName;var et=class{map=new Map;get(e){return this.map.get(e)??[]}set(e,t){this.map.set(e,t)}add(e,t){this.map.has(e)?this.map.get(e).push(t):this.map.set(e,[t])}has(e){return this.map.has(e)}delete(e){return this.map.delete(e)}clear(){this.map.clear()}keys(){return this.map.keys()}values(){return this.map.values()}entries(){return this.map.entries()}forEach(e){this.map.forEach(e)}flatValues(){let e=[];for(let t of this.map.values())e.push(...t);return e}get size(){return this.map.size}},tt=e=>{switch(e){case`chat`:return`chat_model`;case`autocomplete`:return`autocomplete_model`;case`edit`:return`edit_model`}},nt=()=>{let e=(0,Q.c)(10),t=n(l),{saveUserConfig:r}=re(),i;e[0]!==r||e[1]!==t?(i=async e=>{let n={ai:e};await r({config:n}).then(()=>{t(e=>u(e,n))})},e[0]=r,e[1]=t,e[2]=i):i=e[2];let a=i,o;e[3]===a?o=e[4]:(o=async(e,t)=>{let n=tt(t);n&&await a({models:{[n]:e}})},e[3]=a,e[4]=o);let s=o,c;e[5]===a?c=e[6]:(c=async e=>{await a({mode:e})},e[5]=a,e[6]=c);let d=c,f;return e[7]!==d||e[8]!==s?(f={saveModelChange:s,saveModeChange:d},e[7]=d,e[8]=s,e[9]=f):f=e[9],f};export{Qe as a,Xe as c,W as d,K as f,$ as i,q as l,ie as m,et as n,$e as o,ae as p,Ze as r,Z as s,nt as t,G as u};
@@ -1,3 +1,3 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{Ai as t,Fi as n,Pi as r,Qi as i,Si as a,Va as o,Vn as s,ja as c,ji as l,jo as u,n as d}from"./cells-BMs-CYDt.js";import{g as f}from"./useEventListener-D9cftcHj.js";import{n as p}from"./config-CMUeR8Wr.js";import{t as m}from"./createLucideIcon-DfJ2oMlA.js";var h=m(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),g=e(u(),1);function _(e){let t=e.indexOf(`://`);if(t!==-1)return e.slice(0,t)}var v=class{async getAttachments(e){return[]}asURI(e){return`${this.contextType}://${e}`}parseContextIds(e){let t=RegExp(`${this.mentionPrefix}([\\w-]+):\\/\\/([\\w./-]+)`,`g`),n=[...e.matchAll(t)],r=e=>e.slice(1),i=n.filter(([,e])=>e===this.contextType).map(([e])=>r(e));return[...new Set(i)]}createBasicCompletion(e,t){return{label:`${this.mentionPrefix}${e.uri.split(`://`)[1]}`,displayLabel:e.name,detail:t?.detail||e.description,boost:t?.boost||1,type:t?.type||this.contextType,apply:`${this.mentionPrefix}${e.uri}`,section:t?.section||this.title}}},y=class{providers=new Set;register(e){return this.providers.add(e),this}getProviders(){return this.providers}getProvider(e){return[...this.providers].find(t=>t.contextType===e)}getAllItems(){return[...this.providers].flatMap(e=>e.getItems())}parseAllContextIds(e){return[...this.providers].flatMap(t=>t.parseContextIds(e))}findProviderForUri(e){let t=_(e);if(t)return[...this.providers].find(n=>n.contextType===t&&n.getItems().some(t=>t.uri===e))}resolveItems(e){if(e.length===0)return[];let t=new p;for(let n of e){let e=_(n);e&&t.add(e,n)}let n=new Map;for(let[e,r]of t.entries()){let t=[...this.providers].filter(t=>t.contextType===e);for(let e of t){let t=new Map(e.getItems().map(e=>[e.uri,e]));for(let e of r){let r=t.get(e);r&&n.set(e,r)}}}let r=[];for(let t of e){let e=n.get(t);e&&r.push(e)}return r}getContextInfo(e){return this.resolveItems(e)}formatContextForAI(e){let t=this.resolveItems(e);return t.length===0?``:t.map(e=>this.findProviderForUri(e.uri)?.formatContext(e)||``).join(`
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{Ai as t,Fi as n,Pi as r,Qi as i,Si as a,Va as o,Vn as s,ja as c,ji as l,jo as u,n as d}from"./cells-CDwPlSdp.js";import{g as f}from"./useEventListener-D9cftcHj.js";import{n as p}from"./config-D-dRq5S4.js";import{t as m}from"./createLucideIcon-DfJ2oMlA.js";var h=m(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),g=e(u(),1);function _(e){let t=e.indexOf(`://`);if(t!==-1)return e.slice(0,t)}var v=class{async getAttachments(e){return[]}asURI(e){return`${this.contextType}://${e}`}parseContextIds(e){let t=RegExp(`${this.mentionPrefix}([\\w-]+):\\/\\/([\\w./-]+)`,`g`),n=[...e.matchAll(t)],r=e=>e.slice(1),i=n.filter(([,e])=>e===this.contextType).map(([e])=>r(e));return[...new Set(i)]}createBasicCompletion(e,t){return{label:`${this.mentionPrefix}${e.uri.split(`://`)[1]}`,displayLabel:e.name,detail:t?.detail||e.description,boost:t?.boost||1,type:t?.type||this.contextType,apply:`${this.mentionPrefix}${e.uri}`,section:t?.section||this.title}}},y=class{providers=new Set;register(e){return this.providers.add(e),this}getProviders(){return this.providers}getProvider(e){return[...this.providers].find(t=>t.contextType===e)}getAllItems(){return[...this.providers].flatMap(e=>e.getItems())}parseAllContextIds(e){return[...this.providers].flatMap(t=>t.parseContextIds(e))}findProviderForUri(e){let t=_(e);if(t)return[...this.providers].find(n=>n.contextType===t&&n.getItems().some(t=>t.uri===e))}resolveItems(e){if(e.length===0)return[];let t=new p;for(let n of e){let e=_(n);e&&t.add(e,n)}let n=new Map;for(let[e,r]of t.entries()){let t=[...this.providers].filter(t=>t.contextType===e);for(let e of t){let t=new Map(e.getItems().map(e=>[e.uri,e]));for(let e of r){let r=t.get(e);r&&n.set(e,r)}}}let r=[];for(let t of e){let e=n.get(t);e&&r.push(e)}return r}getContextInfo(e){return this.resolveItems(e)}formatContextForAI(e){let t=this.resolveItems(e);return t.length===0?``:t.map(e=>this.findProviderForUri(e.uri)?.formatContext(e)||``).join(`
2
2
 
3
3
  `)}async getAttachmentsForContext(e){let t=this.resolveItems(e);if(t.length===0)return[];let n=new p;for(let e of t){let t=this.findProviderForUri(e.uri);t&&n.add(t,e)}let r=[...n.entries()].map(async([e,t])=>{try{return await e.getAttachments(t)}catch(e){return f.error(`Error getting attachments from provider`,e),[]}});return(await Promise.all(r)).flat()}};c([o()],y.prototype,`getAllItems`,null);function b(e){return e.replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`)}function x(e){let{type:t,data:n,details:r}=e,i=`<${t}`;for(let[e,t]of Object.entries(n))if(t!==void 0){let n=b(typeof t==`object`&&t?JSON.stringify(t):String(t));i+=` ${e}="${n}"`}return i+=`>`,r&&(i+=b(r)),i+=`</${t}>`,i}var S={LOCAL_TABLE:7,REMOTE_TABLE:5,HIGH:4,MEDIUM:3,CELL_OUTPUT:2,LOW:2},C={ERROR:{name:`Error`,rank:1},TABLE:{name:`Table`,rank:2},DATA_SOURCES:{name:`Data Sources`,rank:3},VARIABLE:{name:`Variable`,rank:4},CELL_OUTPUT:{name:`Cell Output`,rank:5},FILE:{name:`File`,rank:6}},w=`datasource`,T=class extends v{title=`Datasource`;mentionPrefix=`@`;contextType=w;connectionsMap;dataframes;constructor(e,t){super(),this.connectionsMap=e,this.dataframes=[...t.values()].filter(e=>n(e)===`dataframe`)}getItems(){return[...this.connectionsMap.values()].map(e=>{let t=`Database schema.`,n={connection:e};return i.has(e.name)&&(n.tables=this.dataframes,t=`Database schema and the dataframes that can be queried`),e.databases.length===0&&(n.tables?.length??0)===0?null:{uri:this.asURI(e.name),name:e.name,description:t,type:this.contextType,data:n}}).filter(Boolean)}formatContext(e){let t=e.data,{name:n,display_name:r,source:a,...o}=t.connection,s=o;return i.has(n)||(s={...o,engine_name:n}),x({type:this.contextType,data:{connection:s,tables:t.tables}})}formatCompletion(e){let n=e.data,r=n.connection,o=n.tables,s=r.name;return i.has(r.name)&&(s=`In-Memory`),{label:`@${s}`,displayLabel:s,detail:t(r.dialect),boost:S.MEDIUM,type:this.contextType,section:C.DATA_SOURCES,info:()=>{let e=document.createElement(`div`);return e.classList.add(`mo-cm-tooltip`,`docs-documentation`),(0,g.createRoot)(e).render(a(r,o)),e}}}};function E(e,t){let n=t.get(d(e))?.code;if(!n||n.trim()===``)return null;let[i,a,o]=s.sql.transformIn(n),c=t.get(r).connectionsMap.get(o.engine);return c?`@${w}://${c.name}`:null}function D(e,t){let n=E(e,t);if(!n)return null;let i=t.get(r).connectionsMap,a=new T(i,t.get(l)),o=n.slice(1),s=a.getItems().find(e=>e.uri===o);return s?a.formatContext(s):null}export{C as a,y as c,S as i,h as l,D as n,x as o,E as r,v as s,T as t};