@marimo-team/frontend 0.23.17-dev43 → 0.23.17-dev45

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 (51) hide show
  1. package/dist/assets/{JsonOutput-CWfu9qbN.js → JsonOutput-W3f6H6VQ.js} +1 -1
  2. package/dist/assets/{MarimoErrorOutput-B9QSRg6T.js → MarimoErrorOutput-COZo8cfk.js} +3 -3
  3. package/dist/assets/{add-cell-with-ai-GZi9Icll.js → add-cell-with-ai-CuLILhtV.js} +1 -1
  4. package/dist/assets/{add-connection-dialog-D2WiF1f8.js → add-connection-dialog-Dld_PDdZ.js} +1 -1
  5. package/dist/assets/{agent-panel-BWIkm6ln.js → agent-panel-3Ta5EPgw.js} +1 -1
  6. package/dist/assets/{ai-model-dropdown-BmcXWjub.js → ai-model-dropdown-CIqhiHxf.js} +1 -1
  7. package/dist/assets/{app-config-button-QHaORuxs.js → app-config-button-EyzXs1Nt.js} +1 -1
  8. package/dist/assets/{cell-editor-Cwor7oUx.js → cell-editor-C5qD14SG.js} +1 -1
  9. package/dist/assets/{chat-display-CH-dFAC3.js → chat-display-CBpsXLHT.js} +1 -1
  10. package/dist/assets/chat-panel-VAvLxFDw.js +4 -0
  11. package/dist/assets/{chat-ui-DDkwFM3p.js → chat-ui-BcI4PAQ1.js} +1 -1
  12. package/dist/assets/{column-preview-Dw1ASLnm.js → column-preview-Dxxs9Brz.js} +1 -1
  13. package/dist/assets/{command-palette--Mo9OaH2.js → command-palette-B1EO8oVR.js} +1 -1
  14. package/dist/assets/{components-BQ3c1B_F.js → components-RV25kGIW.js} +1 -1
  15. package/dist/assets/config-BVfo0E1-.js +1 -0
  16. package/dist/assets/{datasource-DfQvKiJ1.js → datasource-D0eBPOXe.js} +1 -1
  17. package/dist/assets/{dependency-graph-panel-gbgUGtYS.js → dependency-graph-panel-BKWUzXHX.js} +1 -1
  18. package/dist/assets/{edit-page-DhZPSJ6P.js → edit-page-GtsW1Yeh.js} +4 -4
  19. package/dist/assets/{error-panel-Upmm4kG5.js → error-panel-v0YdlA0h.js} +1 -1
  20. package/dist/assets/{file-explorer-panel-BulU96v_.js → file-explorer-panel-DSZY0Q7h.js} +1 -1
  21. package/dist/assets/{form-D-Bo8F9Q.js → form-BGoLLcgk.js} +1 -1
  22. package/dist/assets/{home-page-Dvm2dFdU.js → home-page-DLeE6pH_.js} +1 -1
  23. package/dist/assets/{index-BPwg3EAk.js → index-C_pCjmat.js} +3 -3
  24. package/dist/assets/index-WoaGtlKd.css +2 -0
  25. package/dist/assets/{layout-D7Yzn4XY.js → layout-QkEddeXT.js} +3 -3
  26. package/dist/assets/{packages-panel-IN-yS3e2.js → packages-panel-CiKYP9Ij.js} +1 -1
  27. package/dist/assets/{panels-C5PIEySE.js → panels-Swk0l08v.js} +1 -1
  28. package/dist/assets/{reveal-component-BPaqYFXU.js → reveal-component-De_cjq3p.js} +1 -1
  29. package/dist/assets/{run-page-kWVbQ6KV.js → run-page-DmXT_-MQ.js} +1 -1
  30. package/dist/assets/{scratchpad-panel-l1iGto9s.js → scratchpad-panel-BtGHIRdJ.js} +1 -1
  31. package/dist/assets/{session-panel-CBmLYzFL.js → session-panel-kBLydN0h.js} +1 -1
  32. package/dist/assets/{skeleton-DhhF_mJP.js → skeleton-CJymG2v3.js} +1 -1
  33. package/dist/assets/state-DDimGh2o.js +1 -0
  34. package/dist/assets/{useCellActionButton-CrFbi8en.js → useCellActionButton-n2-2xb-5.js} +1 -1
  35. package/dist/assets/{useDependencyPanelTab-OeFV2bye.js → useDependencyPanelTab-DQZmbkd-.js} +1 -1
  36. package/dist/assets/{useNotebookActions-CylmZilh.js → useNotebookActions-BUQta3nX.js} +1 -1
  37. package/dist/index.html +9 -9
  38. package/package.json +1 -1
  39. package/src/components/ai/ai-model-dropdown.tsx +2 -2
  40. package/src/components/chat/__tests__/capabilities-popover.test.tsx +38 -0
  41. package/src/components/chat/capabilities-popover.tsx +68 -0
  42. package/src/components/chat/chat-panel.tsx +17 -12
  43. package/src/components/editor/chrome/wrapper/useOpenAiAssistant.ts +2 -2
  44. package/src/core/ai/__tests__/config.test.tsx +96 -0
  45. package/src/core/ai/config.ts +16 -22
  46. package/src/core/ai/state.ts +10 -0
  47. package/src/core/network/types.ts +1 -0
  48. package/dist/assets/chat-panel-DLgorYjE.js +0 -4
  49. package/dist/assets/config-Cbkt6Rb1.js +0 -1
  50. package/dist/assets/index-Dttsymhw.css +0 -2
  51. package/dist/assets/state-COqqdiUM.js +0 -1
@@ -1 +1 @@
1
- import{s as ge}from"./chunk-LvLJmgfZ.js";import{d as je,l as ye,p as ve,u as J}from"./useEvent-D91BmmQi.js";import{t as Ye}from"./react-Bj1aDYRI.js";import{$r as Ne,Bt as Je,Ct as Qe,Dr as Xe,E as Ze,Kn as ea,Lr as aa,N as ta,Pr as sa,Qr as oe,Rr as ce,Rt as la,Tr as na,Yn as ra,Yr as oa,ai as we,ci as ca,d as ma,di as Se,ei as _e,fi as ia,hi as Ce,i as da,ii as me,j as ha,jt as ua,li as xa,mi as pa,ni as fa,oi as ie,pn as ba,qn as ga,ra as ja,ti as ya,ui as va,wr as Na,zt as wa}from"./cells-DxL32Atg.js";import"./react-dom-CSu739Rf.js";import{t as Ie}from"./compiler-runtime-B3qBwwSJ.js";import{c as Sa}from"./utils-C5VWChv9.js";import{t as _a}from"./ErrorBoundary-BfMsWVQU.js";import{t as Q}from"./cn-DYvqRARy.js";import{t as Ca}from"./jsx-runtime-Blw4afVn.js";import"./fullscreen-B51geQ_6.js";import{r as Ia}from"./config-Cbkt6Rb1.js";import"./popover-DHbixh3D.js";import{_ as ke,at as ka,d as Ta,g as de,h as he,it as Pa,m as le,nt as Te,ot as Fa,p as Pe,rt as $a,tt as ue}from"./JsonOutput-CWfu9qbN.js";import"./download-Tklnz6pn.js";import{r as Fe}from"./radio-group-ByLzIKjm.js";import{t as xe}from"./tooltip-BcgbFR7q.js";import{r as Ra,t as ne}from"./button-BB1AV4Rb.js";import"./dist-gUHullA_.js";import{l as X}from"./arrays-DbOq36rN.js";import"./cjs-D5tzp-Y6.js";import"./main-BNL5rxQw.js";import"./useNonce-CbdaHKzX.js";import{i as Da}from"./strings-DMKwTex-.js";import{r as Va}from"./requests-9-v2bhoi.js";import{t as qa}from"./createLucideIcon-w-Qo9n0R.js";import{t as Ba}from"./x-C-Eq0ag8.js";import{a as La,r as Ea}from"./tree-actions-o2iyMmKN.js";import"./markdown-renderer-DpskAUxO.js";import{t as $e}from"./plus-AgXtozBz.js";import{a as Ma}from"./input-_AaMXWgD.js";import{n as Oa,o as Aa}from"./column-preview-Dw1ASLnm.js";import{t as za}from"./workflow-e-XGaKyY.js";import"./dist-Jbd9zUbK.js";import"./dist-BWXIz8tq.js";import"./dist-DX04AOlt.js";import"./dist-D5nYeU7Q.js";import"./dist-6qzebh8f.js";import"./session-BtBr2zr3.js";import"./purify.es-CWmnYhGI.js";import"./dates-BzOh4kS_.js";import{t as Ua}from"./copy-icon-DWG8Y-xW.js";import{t as Ga}from"./context-BFPaAUK_.js";import"./tooltip-BMi4WFDl.js";import"./vega-loader.browser-CAfmqKEc.js";import"./defaultLocale-t77eoiwF.js";import"./defaultLocale-BUCH2FMc.js";import{t as Re}from"./cell-link-uPmFMRTh.js";import"./chunk-5FQGJX7Z-CYQpNADu.js";import{r as Ha}from"./html-to-image-ChNWEUlR.js";import{o as Ka}from"./focus-BBiJct2G.js";import{n as pe}from"./useAsyncData-Bg5iAViP.js";import{a as Wa,i as Ya,n as Ja,o as De,r as Qa,t as Xa}from"./table-CH2plyy9.js";import"./react-resizable-panels.browser.esm-Z-MD3n3J.js";import{a as Za,f as et,o as re,t as at}from"./command-CPFHYoYk.js";import{n as tt}from"./icons-NFYKylj6.js";import{t as st}from"./useDeepCompareMemoize-BLRnan2Y.js";import{t as lt}from"./empty-state-JOk_hLQe.js";import{n as nt,t as rt}from"./common-aHaDUD0-.js";import{a as ot,i as ct,n as Ve,r as qe,t as Be}from"./components-BQ3c1B_F.js";import{t as Le}from"./add-connection-dialog-D2WiF1f8.js";import{r as mt}from"./panel-accordion-state-BkWYwckU.js";var it=qa("square-equal",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]),U=Ie(),F=ge(Ye(),1),s=ge(Ca(),1),fe=1;function Ee(a){return 1.75+a*fe}function dt(a){return 3+a*fe}function Me(a){return 3.25+a*fe}var z={engineEmpty:.75,engine:.75,database:1,tableLoading:2.75,tableSchemaless:2,columnLocal:1.25,columnPreview:2.5};function M(a){return{paddingLeft:`${a}rem`}}var ht=ve(a=>{let e=a(_e),t=a(ra),l=a(da);return X(e,n=>{if(!n.variable_name)return-1;let i=Object.values(t).find(d=>d.name===n.variable_name);if(!i)return 0;let c=l.inOrderIds.indexOf(i.declaredBy[0]);return c===-1?0:c})});const ut=ja("marimo:datasources:hideEmpty",!1,ea,{getOnInit:!0});function Oe(a){let e=!1,t=[];for(let l of a){if(!ie(l)||!me(l)){t.push(l);continue}let n=l.child_schemas??[],i=Oe(n);if(l.tables.length===0&&i.length===0){e=!0;continue}if(i===n){t.push(l);continue}e=!0,t.push({...l,child_schemas:i})}return e?t:a}function xt(a){let e=!1,t=[];for(let l of a){if(we(l)&&l.schemas.length===0){e=!0;continue}if(l.schemas.length===0){t.push(l);continue}let n=Oe(l.schemas);if(n.length===0){e=!0;continue}if(n===l.schemas){t.push(l);continue}e=!0,t.push({...l,schemas:n})}return e?t:a}const Ae=ve(a=>{let e=new Map(a(oa));for(let t of Ce){let l=e.get(t);l&&(l.databases.length===0&&e.delete(t),l.databases.length===1&&l.databases[0].name==="memory"&&l.databases[0].schemas.length===0&&e.delete(t))}return X([...e.values()],t=>Ce.has(t.name)?1:0)}),pt=()=>{let a=(0,U.c)(40),[e,t]=F.useState(""),[l,n]=ye(ut),i=je(Ne),c=J(ht),d=J(Ae),r;e:{if(!l){r=d;break e}let f,v;a[0]===d?(f=a[1],v=a[2]):(f=!1,v=d.map(C=>{let k=xt(C.databases);return k===C.databases?C:(f=!0,{...C,databases:k})}),a[0]=d,a[1]=f,a[2]=v),r=f?v:d}let x=r;if(c.length===0&&x.length===0){let f;return a[3]===Symbol.for("react.memo_cache_sentinel")?(f=(0,s.jsx)(lt,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:(0,s.jsx)(Le,{children:(0,s.jsxs)(ne,{variant:"outline",size:"sm",children:["Add database or catalog",(0,s.jsx)($e,{className:"h-4 w-4 ml-2"})]})}),icon:(0,s.jsx)(ce,{})}),a[3]=f):f=a[3],f}let h=!!e.trim(),m;a[4]===i?m=a[5]:(m=f=>{i(f.length>0),t(f)},a[4]=i,a[5]=m);let o;a[6]!==e||a[7]!==m?(o=(0,s.jsx)(Za,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:m,rootClassName:"flex-1 border-r border-b-0"}),a[6]=e,a[7]=m,a[8]=o):o=a[8];let p;a[9]===h?p=a[10]:(p=h&&(0,s.jsx)("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>t(""),children:(0,s.jsx)(Ba,{className:"h-4 w-4"})}),a[9]=h,a[10]=p);let S=!l,b;a[11]!==l||a[12]!==n?(b=()=>n(!l),a[11]=l,a[12]=n,a[13]=b):b=a[13];let N;a[14]!==S||a[15]!==b?(N=(0,s.jsx)(La,{"data-testid":"datasources-hide-empty-button",isVisible:S,onToggle:b,showTooltip:"Show empty schemas and databases",hideTooltip:"Hide empty schemas and databases",size:"sm",className:"px-2 rounded-none focus-visible:outline-hidden"}),a[14]=S,a[15]=b,a[16]=N):N=a[16];let y;a[17]===Symbol.for("react.memo_cache_sentinel")?(y=(0,s.jsx)(Le,{children:(0,s.jsx)(ne,{variant:"ghost",size:"sm",className:"px-2 rounded-none focus-visible:outline-hidden",children:(0,s.jsx)($e,{className:"h-4 w-4"})})}),a[17]=y):y=a[17];let j;a[18]!==o||a[19]!==p||a[20]!==N?(j=(0,s.jsxs)("div",{className:"flex items-center w-full border-b",children:[o,p,N,y]}),a[18]=o,a[19]=p,a[20]=N,a[21]=j):j=a[21];let g;if(a[22]!==x||a[23]!==e){let f;a[25]===e?f=a[26]:(f=v=>(0,s.jsx)(ft,{connection:v,hasChildren:v.databases.length>0,children:v.databases.map(C=>(0,s.jsx)(bt,{connection:v,database:C,searchValue:e},C.name))},v.name),a[25]=e,a[26]=f),g=x.map(f),a[22]=x,a[23]=e,a[24]=g}else g=a[24];let w;a[27]!==x.length||a[28]!==c.length?(w=x.length>0&&c.length>0&&(0,s.jsxs)(Pe,{className:"pr-2",style:M(z.engine),children:[(0,s.jsx)(tt,{className:"h-4 w-4 text-muted-foreground"}),(0,s.jsx)("span",{className:"text-xs",children:"Python"})]}),a[27]=x.length,a[28]=c.length,a[29]=w):w=a[29];let u;a[30]!==e||a[31]!==c?(u=c.length>0&&(0,s.jsx)(be,{tables:c,searchValue:e}),a[30]=e,a[31]=c,a[32]=u):u=a[32];let _;a[33]!==w||a[34]!==u||a[35]!==g?(_=(0,s.jsxs)(et,{className:"flex flex-col",children:[g,w,u]}),a[33]=w,a[34]=u,a[35]=g,a[36]=_):_=a[36];let I;return a[37]!==_||a[38]!==j?(I=(0,s.jsxs)(at,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden",shouldFilter:!1,children:[j,_]}),a[37]=_,a[38]=j,a[39]=I):I=a[39],I};var ft=a=>{let e=(0,U.c)(26),{connection:t,children:l,hasChildren:n}=a,i=t.name===pa,c=i?"In-Memory":t.name,{previewDataSourceConnection:d}=Va(),r;e[0]!==t.name||e[1]!==d?(r=async()=>{await d({engine:t.name})},e[0]=t.name,e[1]=d,e[2]=r):r=e[2];let x=r,h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=M(z.engine),e[3]=h):h=e[3];let m;e[4]===t.dialect?m=e[5]:(m=(0,s.jsx)(Qe,{className:"h-4 w-4 text-muted-foreground",name:t.dialect}),e[4]=t.dialect,e[5]=m);let o;e[6]===t.dialect?o=e[7]:(o=Na(t.dialect),e[6]=t.dialect,e[7]=o);let p;e[8]===o?p=e[9]:(p=(0,s.jsx)("span",{className:"text-xs",children:o}),e[8]=o,e[9]=p);let S=c,b;e[10]===S?b=e[11]:(b=(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",(0,s.jsx)(ot,{variableName:S}),")"]}),e[10]=S,e[11]=b);let N;e[12]!==x||e[13]!==i?(N=!i&&(0,s.jsx)(Ea,{onClick:x,tooltip:"Refresh connection",className:"ml-auto h-4 p-0",iconClassName:"h-3.5 w-3.5"}),e[12]=x,e[13]=i,e[14]=N):N=e[14];let y;e[15]!==m||e[16]!==p||e[17]!==b||e[18]!==N?(y=(0,s.jsxs)(Pe,{className:"pr-2",style:h,children:[m,p,b,N]}),e[15]=m,e[16]=p,e[17]=b,e[18]=N,e[19]=y):y=e[19];let j;e[20]!==l||e[21]!==n?(j=n?l:(0,s.jsx)(le,{content:"No databases available",style:M(z.engineEmpty)}),e[20]=l,e[21]=n,e[22]=j):j=e[22];let g;return e[23]!==j||e[24]!==y?(g=(0,s.jsxs)(s.Fragment,{children:[y,j]}),e[23]=j,e[24]=y,e[25]=g):g=e[25],g},ze=F.createContext(null);function Ue(){let a=F.useContext(ze);if(a==null)throw Error("useDataSourceTree must be used within a DataSourceTreeContext.Provider");return a}function Ge(a,{schema:e,schemaPath:t}){return{engine:a.engineName,database:a.databaseName,schema:e,schemaPath:t,defaultSchema:a.defaultSchema,defaultDatabase:a.defaultDatabase,dialect:a.dialect}}var bt=a=>{let e=(0,U.c)(21),{connection:t,database:l,searchValue:n}=a,i;e[0]!==t.default_database||e[1]!==t.default_schema||e[2]!==t.dialect||e[3]!==t.name||e[4]!==l.name||e[5]!==n?(i={engineName:t.name,databaseName:l.name,dialect:t.dialect,defaultSchema:t.default_schema,defaultDatabase:t.default_database,searchValue:n},e[0]=t.default_database,e[1]=t.default_schema,e[2]=t.dialect,e[3]=t.name,e[4]=l.name,e[5]=n,e[6]=i):i=e[6];let c=i,d=t.name,r=l.schemas,x;e[7]===l?x=e[8]:(x=we(l),e[7]=l,e[8]=x);let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[9]=h):h=e[9];let m;e[10]!==l.schemas||e[11]!==x?(m=(0,s.jsx)(He,{schemas:r,schemasResolved:x,schemaPath:h,depth:0}),e[10]=l.schemas,e[11]=x,e[12]=m):m=e[12];let o;e[13]!==m||e[14]!==c?(o=(0,s.jsx)(ze.Provider,{value:c,children:m}),e[13]=m,e[14]=c,e[15]=o):o=e[15];let p;return e[16]!==t.name||e[17]!==l||e[18]!==n||e[19]!==o?(p=(0,s.jsx)(gt,{engineName:d,database:l,searchValue:n,children:o}),e[16]=t.name,e[17]=l,e[18]=n,e[19]=o,e[20]=p):p=e[20],p},gt=a=>{let e=(0,U.c)(29),{searchValue:t,engineName:l,database:n,children:i}=a,c;e[0]!==n||e[1]!==t?(c=va(n,t),e[0]=n,e[1]=t,e[2]=c):c=e[2];let d=c,[r,x]=F.useState(d),[h,m]=F.useState(!1),[o,p]=F.useState(t),[S,b]=F.useState(d);(o!==t||S!==d)&&(p(t),b(d),x(d));let N;e[3]===Symbol.for("react.memo_cache_sentinel")?(N=M(z.database),e[3]=N):N=e[3];let y;e[4]!==r||e[5]!==h?(y=()=>{x(!r),m(!h)},e[4]=r,e[5]=h,e[6]=y):y=e[6];let j=`${l}:${n.name}`,g;e[7]===r?g=e[8]:(g=(0,s.jsx)(ke,{isExpanded:r}),e[7]=r,e[8]=g);let w=h&&r?"text-foreground":"text-muted-foreground",u;e[9]===w?u=e[10]:(u=Q("h-4 w-4",w),e[9]=w,e[10]=u);let _;e[11]===u?_=e[12]:(_=(0,s.jsx)(ce,{className:u}),e[11]=u,e[12]=_);let I=h&&r&&"font-semibold",f;e[13]===I?f=e[14]:(f=Q(I),e[13]=I,e[14]=f);let v;e[15]===n.name?v=e[16]:(v=n.name===""?(0,s.jsx)("i",{children:"Not connected"}):n.name,e[15]=n.name,e[16]=v);let C;e[17]!==f||e[18]!==v?(C=(0,s.jsx)("span",{className:f,children:v}),e[17]=f,e[18]=v,e[19]=C):C=e[19];let k;e[20]!==C||e[21]!==y||e[22]!==j||e[23]!==g||e[24]!==_?(k=(0,s.jsxs)(re,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",style:N,onSelect:y,value:j,children:[g,_,C]}),e[20]=C,e[21]=y,e[22]=j,e[23]=g,e[24]=_,e[25]=k):k=e[25];let T=r&&i,P;return e[26]!==k||e[27]!==T?(P=(0,s.jsxs)(s.Fragment,{children:[k,T]}),e[26]=k,e[27]=T,e[28]=P):P=e[28],P},He=a=>{let{schemas:e,schemasResolved:t,depth:l}=a,n=Ue(),{engineName:i,databaseName:c,searchValue:d}=n,{addSchemaList:r}=oe(),x=st(a.schemaPath),[h,m]=F.useState(!1),{isPending:o,error:p}=pe(async()=>{if(!t&&i){m(!0);try{r({schemas:(await la.request({engine:i,database:c,schemaPath:x})).schemas??[],sqlSchemaContext:{engine:i,database:c,schemaPath:x}})}finally{m(!1)}}},[t,i,c,x]),S=M(Ee(l));return o||h?(0,s.jsx)(de,{message:"Loading schemas...",style:S}):p?(0,s.jsx)(he,{error:p,style:S}):e.length===0?(0,s.jsx)(le,{content:"No schemas available",style:S}):(0,s.jsx)(s.Fragment,{children:e.map(b=>ca(b.name)?(0,s.jsx)(be,{tables:b.tables,tablesResolved:ie(b),searchValue:d,sqlTableContext:Ge(n,{schema:b.name,schemaPath:x})},b.name):(0,s.jsx)(jt,{schema:b,schemaPath:[...x,b.name],depth:l},b.name))})},jt=a=>{let e=(0,U.c)(39),{schema:t,schemaPath:l,depth:n}=a,i=Ue(),{databaseName:c,searchValue:d}=i,r;e[0]!==t||e[1]!==d?(r=xa(t,d),e[0]=t,e[1]=d,e[2]=r):r=e[2];let x=r,[h,m]=F.useState(x),[o,p]=F.useState(!1),[S,b]=F.useState(d),[N,y]=F.useState(x),j=`${c}:${l.join(".")}`,g;e[3]===t.child_schemas?g=e[4]:(g=t.child_schemas??[],e[3]=t.child_schemas,e[4]=g);let w=g;(S!==d||N!==x)&&(b(d),y(x),m(x));let u;e[5]===n?u=e[6]:(u=M(Ee(n)),e[5]=n,e[6]=u);let _;e[7]!==h||e[8]!==o?(_=()=>{m(!h),p(!o)},e[7]=h,e[8]=o,e[9]=_):_=e[9];let I;e[10]===h?I=e[11]:(I=(0,s.jsx)(ke,{isExpanded:h}),e[10]=h,e[11]=I);let f=o&&h&&"text-foreground",v;e[12]===f?v=e[13]:(v=Q("h-4 w-4 text-muted-foreground",f),e[12]=f,e[13]=v);let C;e[14]===v?C=e[15]:(C=(0,s.jsx)(sa,{className:v}),e[14]=v,e[15]=C);let k=o&&h&&"font-semibold",T;e[16]===k?T=e[17]:(T=Q(k),e[16]=k,e[17]=T);let P;e[18]!==t.name||e[19]!==T?(P=(0,s.jsx)("span",{className:T,children:t.name}),e[18]=t.name,e[19]=T,e[20]=P):P=e[20];let R;e[21]!==P||e[22]!==u||e[23]!==_||e[24]!==I||e[25]!==C||e[26]!==j?(R=(0,s.jsxs)(re,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",style:u,onSelect:_,value:j,children:[I,C,P]}),e[21]=P,e[22]=u,e[23]=_,e[24]=I,e[25]=C,e[26]=j,e[27]=R):R=e[27];let D;e[28]!==w||e[29]!==n||e[30]!==h||e[31]!==t||e[32]!==l||e[33]!==d||e[34]!==i?(D=h&&(0,s.jsxs)(s.Fragment,{children:[(w.length>0||!me(t))&&(0,s.jsx)(He,{schemas:w,schemasResolved:me(t),schemaPath:l,depth:n+1}),(0,s.jsx)(be,{tables:t.tables,tablesResolved:ie(t),searchValue:d,tableIndentRem:dt(n),columnIndentRem:Me(n),sqlTableContext:Ge(i,{schema:t.name,schemaPath:l})})]}),e[28]=w,e[29]=n,e[30]=h,e[31]=t,e[32]=l,e[33]=d,e[34]=i,e[35]=D):D=e[35];let $;return e[36]!==R||e[37]!==D?($=(0,s.jsxs)(s.Fragment,{children:[R,D]}),e[36]=R,e[37]=D,e[38]=$):$=e[38],$},be=a=>{let e=(0,U.c)(31),{tables:t,sqlTableContext:l,searchValue:n,tablesResolved:i,tableIndentRem:c,columnIndentRem:d}=a,r=i===void 0?!0:i,{addTableList:x}=oe(),[h,m]=F.useState(!1),o;e[0]!==x||e[1]!==l||e[2]!==r?(o=async()=>{if(!r&&l){m(!0);let{engine:u,database:_,schema:I,schemaPath:f}=l,v=await Je.request({engine:u,database:_,schema:I,schemaPath:f??[]});if(!(v!=null&&v.tables))throw m(!1),Error("No tables available");x({tables:v.tables,sqlTableContext:l}),m(!1)}},e[0]=x,e[1]=l,e[2]=r,e[3]=o):o=e[3];let p;e[4]!==l||e[5]!==r?(p=[r,l],e[4]=l,e[5]=r,e[6]=p):p=e[6];let{isPending:S,error:b}=pe(o,p),N=c??z.tableLoading,y;e[7]===N?y=e[8]:(y=M(N),e[7]=N,e[8]=y);let j=y;if(S||h){let u;return e[9]===j?u=e[10]:(u=(0,s.jsx)(de,{message:"Loading tables...",style:j}),e[9]=j,e[10]=u),u}if(b){let u;return e[11]!==b||e[12]!==j?(u=(0,s.jsx)(he,{error:b,style:j}),e[11]=b,e[12]=j,e[13]=u):u=e[13],u}if(t.length===0){let u;return e[14]===j?u=e[15]:(u=(0,s.jsx)(le,{content:"No tables found",style:j}),e[14]=j,e[15]=u),u}let g;if(e[16]!==d||e[17]!==n||e[18]!==l||e[19]!==c||e[20]!==t){let u;e[22]===n?u=e[23]:(u=f=>n?f.name.toLowerCase().includes(n.toLowerCase()):!0,e[22]=n,e[23]=u);let _=t.filter(u),I;e[24]!==d||e[25]!==n||e[26]!==l||e[27]!==c?(I=f=>(0,s.jsx)(yt,{table:f,sqlTableContext:l,isSearching:!!n,tableIndentRem:c,columnIndentRem:d},f.name),e[24]=d,e[25]=n,e[26]=l,e[27]=c,e[28]=I):I=e[28],g=_.map(I),e[16]=d,e[17]=n,e[18]=l,e[19]=c,e[20]=t,e[21]=g}else g=e[21];let w;return e[29]===g?w=e[30]:(w=(0,s.jsx)(s.Fragment,{children:g}),e[29]=g,e[30]=w),w},yt=a=>{let e=(0,U.c)(69),{table:t,sqlTableContext:l,isSearching:n,tableIndentRem:i,columnIndentRem:c}=a,{addTable:d}=oe(),[r,x]=F.useState(!1),h=t.columns.length>0,m;e[0]!==d||e[1]!==r||e[2]!==l||e[3]!==t.name||e[4]!==h?(m=async()=>{if(r&&!h&&l){let{engine:L,database:ae,schema:te,schemaPath:We}=l,se=await wa.request({engine:L,database:ae,schema:te,tableName:t.name,schemaPath:We??[]});if(!(se!=null&&se.table))throw Error("No table details available");d({table:se.table,sqlTableContext:l})}},e[0]=d,e[1]=r,e[2]=l,e[3]=t.name,e[4]=h,e[5]=m):m=e[5];let o;e[6]!==r||e[7]!==h?(o=[r,h],e[6]=r,e[7]=h,e[8]=o):o=e[8];let{isFetching:p,isPending:S,error:b}=pe(m,o),N=J(Sa),y=Ka(),{createNewCell:j}=Ze(),g=Fe(),w;e[9]!==g||e[10]!==N||e[11]!==j||e[12]!==y||e[13]!==l||e[14]!==t?(w=()=>{Ha({autoInstantiate:N,createNewCell:j,fromCellId:y}),g((()=>{if(t.source_type==="catalog"){let L=l!=null&&l.database?[l.database,...l.schemaPath??[],t.name].join("."):t.name;return`${t.engine}.load_table("${L}")`}if(l)return Se({table:t,columnName:"*",sqlTableContext:l});switch(t.source_type){case"local":return`mo.ui.table(${t.name})`;case"duckdb":case"connection":return Se({table:t,columnName:"*",sqlTableContext:l});default:return Da(t.source_type),""}})())},e[9]=g,e[10]=N,e[11]=j,e[12]=y,e[13]=l,e[14]=t,e[15]=w):w=e[15];let u=w,_;e[16]!==t.num_columns||e[17]!==t.num_rows?(_=()=>{let L=[];return t.num_rows!=null&&L.push(`${t.num_rows} rows`),t.num_columns!=null&&L.push(`${t.num_columns} columns`),L.length===0?null:(0,s.jsx)("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:L.join(", ")})})},e[16]=t.num_columns,e[17]=t.num_rows,e[18]=_):_=e[18];let I=_,f;e[19]!==c||e[20]!==b||e[21]!==p||e[22]!==S||e[23]!==l||e[24]!==t?(f=()=>{let L=M(c??z.tableLoading);if(S||p)return(0,s.jsx)(de,{message:"Loading columns...",style:L});if(b)return(0,s.jsx)(he,{error:b,style:L});let ae=t.columns;return ae.length===0?(0,s.jsx)(le,{content:"No columns found",style:L}):ae.map(te=>(0,s.jsx)(vt,{table:t,column:te,sqlTableContext:l,columnIndentRem:c},te.name))},e[19]=c,e[20]=b,e[21]=p,e[22]=S,e[23]=l,e[24]=t,e[25]=f):f=e[25];let v=f,C;e[26]!==r||e[27]!==n||e[28]!==t.source_type||e[29]!==t.type?(C=()=>{if(t.source_type!=="local")return(0,s.jsx)(t.type==="table"?Xe:aa,{className:"h-3 w-3",strokeWidth:r||n?2.5:void 0})},e[26]=r,e[27]=n,e[28]=t.source_type,e[29]=t.type,e[30]=C):C=e[30];let k=C,T;e[31]!==l||e[32]!==t.name?(T=ia(l,t.name),e[31]=l,e[32]=t.name,e[33]=T):T=e[33];let P=T,R=i??(l?z.tableSchemaless:0),D=(r||n)&&"font-semibold",$;e[34]===D?$=e[35]:($=Q("rounded-none group h-8 cursor-pointer",D),e[34]=D,e[35]=$);let V;e[36]===R?V=e[37]:(V=M(R),e[36]=R,e[37]=V);let q;e[38]===r?q=e[39]:(q=()=>x(!r),e[38]=r,e[39]=q);let E;e[40]===k?E=e[41]:(E=k(),e[40]=k,e[41]=E);let O;e[42]===t.name?O=e[43]:(O=(0,s.jsx)("span",{className:"text-sm",children:t.name}),e[42]=t.name,e[43]=O);let A;e[44]!==E||e[45]!==O?(A=(0,s.jsxs)("div",{className:"flex gap-2 items-center flex-1 pl-1",children:[E,O]}),e[44]=E,e[45]=O,e[46]=A):A=e[46];let B;e[47]===I?B=e[48]:(B=I(),e[47]=I,e[48]=B);let H;e[49]===u?H=e[50]:(H=Ra.stopPropagation(()=>u()),e[49]=u,e[50]=H);let Z;e[51]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,s.jsx)(Aa,{className:"h-3 w-3"}),e[51]=Z):Z=e[51];let K;e[52]===H?K=e[53]:(K=(0,s.jsx)(xe,{content:"Add table to notebook",delayDuration:400,children:(0,s.jsx)(ne,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:H,children:Z})}),e[52]=H,e[53]=K);let W;e[54]!==r||e[55]!==V||e[56]!==q||e[57]!==A||e[58]!==B||e[59]!==K||e[60]!==$||e[61]!==P?(W=(0,s.jsxs)(re,{className:$,style:V,value:P,"aria-selected":r,forceMount:!0,onSelect:q,children:[A,B,K]}),e[54]=r,e[55]=V,e[56]=q,e[57]=A,e[58]=B,e[59]=K,e[60]=$,e[61]=P,e[62]=W):W=e[62];let Y;e[63]!==r||e[64]!==v?(Y=r&&v(),e[63]=r,e[64]=v,e[65]=Y):Y=e[65];let ee;return e[66]!==W||e[67]!==Y?(ee=(0,s.jsxs)(s.Fragment,{children:[W,Y]}),e[66]=W,e[67]=Y,e[68]=ee):ee=e[68],ee},vt=a=>{var O,A;let e=(0,U.c)(51),{table:t,column:l,sqlTableContext:n,columnIndentRem:i}=a,[c,d]=F.useState(!1),r=J(Ne),x=je(ya);r&&c&&d(!1),x(c?B=>new Set([...B,`${t.name}:${l.name}`]):B=>(B.delete(`${t.name}:${l.name}`),new Set(B)));let h=Fe(),{columnsPreviews:m}=fa(),o;e[0]!==l.name||e[1]!==t.primary_keys?(o=((O=t.primary_keys)==null?void 0:O.includes(l.name))||!1,e[0]=l.name,e[1]=t.primary_keys,e[2]=o):o=e[2];let p=o,S;e[3]!==l.name||e[4]!==t.indexes?(S=((A=t.indexes)==null?void 0:A.includes(l.name))||!1,e[3]=l.name,e[4]=t.indexes,e[5]=S):S=e[5];let b=S,N;e[6]===h?N=e[7]:(N=B=>{h(B)},e[6]=h,e[7]=N);let y=N,j=Nt,g=c?"font-semibold":"",w;e[8]!==l.name||e[9]!==g?(w=(0,s.jsx)("span",{className:g,children:l.name}),e[8]=l.name,e[9]=g,e[10]=w):w=e[10];let u=w,_=`${t.name}.${l.name}`,I=`${t.name}.${l.name}`,f;e[11]===c?f=e[12]:(f=()=>d(!c),e[11]=c,e[12]=f);let v;e[13]!==i||e[14]!==n?(v=i??(n?Me(0):z.columnLocal),e[13]=i,e[14]=n,e[15]=v):v=e[15];let C;e[16]===v?C=e[17]:(C=M(v),e[16]=v,e[17]=C);let k;e[18]!==l.type||e[19]!==u?(k=(0,s.jsx)(Ta,{columnName:u,dataType:l.type}),e[18]=l.type,e[19]=u,e[20]=k):k=e[20];let T;e[21]===p?T=e[22]:(T=p&&j({tooltipContent:"Primary key",content:"PK"}),e[21]=p,e[22]=T);let P;e[23]===b?P=e[24]:(P=b&&j({tooltipContent:"Indexed",content:"IDX"}),e[23]=b,e[24]=P);let R;e[25]!==C||e[26]!==k||e[27]!==T||e[28]!==P?(R=(0,s.jsxs)("div",{className:"flex flex-row gap-2 items-center flex-1",style:C,children:[k,T,P]}),e[25]=C,e[26]=k,e[27]=T,e[28]=P,e[29]=R):R=e[29];let D;e[30]===l.name?D=e[31]:(D=(0,s.jsx)(xe,{content:"Copy column name",delayDuration:400,children:(0,s.jsx)(ne,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:(0,s.jsx)(Ua,{tooltip:!1,value:l.name,className:"h-3 w-3"})})}),e[30]=l.name,e[31]=D);let $;e[32]===l.external_type?$=e[33]:($=(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:l.external_type}),e[32]=l.external_type,e[33]=$);let V;e[34]!==R||e[35]!==D||e[36]!==$||e[37]!==_||e[38]!==I||e[39]!==f?(V=(0,s.jsxs)(re,{className:"rounded-none py-1 group cursor-pointer",value:I,onSelect:f,children:[R,D,$]},_),e[34]=R,e[35]=D,e[36]=$,e[37]=_,e[38]=I,e[39]=f,e[40]=V):V=e[40];let q;e[41]!==l||e[42]!==m||e[43]!==y||e[44]!==c||e[45]!==n||e[46]!==t?(q=c&&(0,s.jsx)("div",{className:"pr-2 py-2 bg-(--slate-1) shadow-inner border-b",style:M(z.columnPreview),children:(0,s.jsx)(_a,{children:(0,s.jsx)(Oa,{table:t,column:l,onAddColumnChart:y,preview:m.get(n?`${n.database}.${n.schema}.${t.name}:${l.name}`:`${t.name}:${l.name}`),sqlTableContext:n})})}),e[41]=l,e[42]=m,e[43]=y,e[44]=c,e[45]=n,e[46]=t,e[47]=q):q=e[47];let E;return e[48]!==V||e[49]!==q?(E=(0,s.jsxs)(s.Fragment,{children:[V,q]}),e[48]=V,e[49]=q,e[50]=E):E=e[50],E};function Nt(a){let{tooltipContent:e,content:t}=a;return(0,s.jsx)(xe,{content:e,delayDuration:100,children:(0,s.jsx)("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:t})})}function qs(a){return a}var G={name:"name",type:"type-value",defs:"defs-refs"},wt=[{id:G.name,accessorFn:a=>[a.name,a.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:a})=>(0,s.jsx)(ue,{header:"Name",column:a}),cell:({getValue:a})=>{let[e,t]=a();return(0,s.jsx)(rt,{name:e,declaredBy:t})}},{id:G.type,accessorFn:a=>[a.dataType,a.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:a})=>(0,s.jsx)(ue,{header:(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("span",{children:"Type"}),(0,s.jsx)("span",{children:"Value"})]}),column:a}),cell:({getValue:a})=>{let[e,t]=a();return(0,s.jsxs)("div",{className:"max-w-[150px]",children:[(0,s.jsx)("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),(0,s.jsx)("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:t??"",children:t})]})}},{id:G.defs,accessorFn:a=>[a.declaredBy,a.usedBy,a.name,a.declaredByNames,a.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:a})=>(0,s.jsx)(ue,{header:(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("span",{children:"Declared By"}),(0,s.jsx)("span",{children:"Used By"})]}),column:a}),cell:({getValue:a})=>{let[e,t,l]=a(),n=i=>{let c=ma(i);c&&ba(c,l)};return(0,s.jsxs)("div",{className:"flex flex-col gap-1 py-1",children:[(0,s.jsxs)("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[(0,s.jsx)("span",{title:"Declared by",children:(0,s.jsx)(it,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?(0,s.jsx)(Re,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>n(e[0])}):(0,s.jsx)("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((i,c)=>(0,s.jsxs)("span",{className:"flex",children:[(0,s.jsx)(Re,{variant:"focus",cellId:i,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>n(i)},i),c<e.length-1&&", "]},i))})]}),(0,s.jsxs)("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[(0,s.jsx)("span",{title:"Used by",children:(0,s.jsx)(za,{className:"w-3.5 h-3.5 text-muted-foreground"})}),(0,s.jsx)(nt,{maxCount:3,cellIds:t,skipScroll:!0,onClick:n})]})]})}}];function St({variables:a,sort:e,cellIdToIndex:t}){e||(e={id:G.defs,desc:!1});let l=[];switch(e.id){case G.name:l=X(a,n=>n.name);break;case G.type:l=X(a,n=>n.dataType);break;case G.defs:l=X(a,n=>t.get(n.declaredBy[0]));break}return e.desc?l.toReversed():l}const Ke=(0,F.memo)(({className:a,cellIds:e,variables:t})=>{let[l,n]=F.useState([]),[i,c]=F.useState(""),d=ta(),{locale:r}=Ga(),x=(0,F.useMemo)(()=>{let m=o=>{let p=d[o];return ua(p)?`cell-${e.indexOf(o)}`:p??`cell-${e.indexOf(o)}`};return Object.values(t).map(o=>({...o,declaredByNames:o.declaredBy.map(m),usedByNames:o.usedBy.map(m)}))},[t,d,e]),h=$a({data:(0,F.useMemo)(()=>{let m=new Map;return e.forEach((o,p)=>m.set(o,p)),St({variables:x,sort:l[0],cellIdToIndex:m})},[x,l,e]),columns:wt,getCoreRowModel:Pa(),onGlobalFilterChange:c,getFilteredRowModel:ka(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter(m){return m.columnDef.enableGlobalFilter??!0},globalFilterFn:"auto",manualSorting:!0,locale:r,onSortingChange:n,getSortedRowModel:Fa(),state:{sorting:l,globalFilter:i}});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Ma,{className:"w-full",placeholder:"Search",value:i,onChange:m=>c(m.target.value)}),(0,s.jsxs)(Xa,{className:Q("w-full text-sm flex-1 border-separate border-spacing-0",a),children:[(0,s.jsx)(Wa,{children:(0,s.jsx)(De,{className:"whitespace-nowrap text-xs",children:h.getFlatHeaders().map(m=>(0,s.jsx)(Ya,{className:"sticky top-0 bg-background border-b",children:Te(m.column.columnDef.header,m.getContext())},m.id))})}),(0,s.jsx)(Ja,{children:h.getRowModel().rows.map(m=>(0,s.jsx)(De,{className:"hover:bg-accent",children:m.getVisibleCells().map(o=>(0,s.jsx)(Qa,{className:"border-b",children:Te(o.column.columnDef.cell,o.getContext())},o.id))},m.id))})]})]})});Ke.displayName="VariableTable";var _t=Ie(),Ct=()=>{let a=(0,_t.c)(24),e=ga(),t=ha(),l=J(_e),n=J(Ae),[i,c]=ye(mt),d=l.length+n.length,r;a[0]!==d||a[1]!==i.hasUserInteracted||a[2]!==i.openSections?(r=!i.hasUserInteracted&&d>0?[...new Set([...i.openSections,"datasources"])]:i.openSections,a[0]=d,a[1]=i.hasUserInteracted,a[2]=i.openSections,a[3]=r):r=a[3];let x=r,h;a[4]===c?h=a[5]:(h=u=>{c({openSections:u,hasUserInteracted:!0})},a[4]=c,a[5]=h);let m=h,o=!x.includes("datasources")&&d>0,p;a[6]===Symbol.for("react.memo_cache_sentinel")?(p=(0,s.jsx)(ce,{className:"w-4 h-4"}),a[6]=p):p=a[6];let S;a[7]!==d||a[8]!==o?(S=o&&(0,s.jsx)(ct,{children:d}),a[7]=d,a[8]=o,a[9]=S):S=a[9];let b;a[10]===S?b=a[11]:(b=(0,s.jsxs)(qe,{children:[p,"Data sources",S]}),a[10]=S,a[11]=b);let N;a[12]===Symbol.for("react.memo_cache_sentinel")?(N=(0,s.jsx)(Be,{children:(0,s.jsx)(pt,{})}),a[12]=N):N=a[12];let y;a[13]===b?y=a[14]:(y=(0,s.jsxs)(Ve,{value:"datasources",children:[b,N]}),a[13]=b,a[14]=y);let j;a[15]===Symbol.for("react.memo_cache_sentinel")?(j=(0,s.jsxs)(qe,{children:[(0,s.jsx)(na,{className:"w-4 h-4"}),"Variables"]}),a[15]=j):j=a[15];let g;a[16]!==t||a[17]!==e?(g=(0,s.jsxs)(Ve,{value:"variables",lastItem:!0,children:[j,(0,s.jsx)(Be,{children:Object.keys(e).length===0?(0,s.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground",children:"No variables defined"}):(0,s.jsx)(Ke,{cellIds:t.inOrderIds,variables:e})})]}),a[16]=t,a[17]=e,a[18]=g):g=a[18];let w;return a[19]!==m||a[20]!==x||a[21]!==y||a[22]!==g?(w=(0,s.jsxs)(Ia,{type:"multiple",value:x,onValueChange:m,className:"flex flex-col h-full overflow-auto",children:[y,g]}),a[19]=m,a[20]=x,a[21]=y,a[22]=g,a[23]=w):w=a[23],w};export{Ct as default};
1
+ import{s as ge}from"./chunk-LvLJmgfZ.js";import{d as je,l as ye,p as ve,u as J}from"./useEvent-D91BmmQi.js";import{t as Ye}from"./react-Bj1aDYRI.js";import{$r as Ne,Bt as Je,Ct as Qe,Dr as Xe,E as Ze,Kn as ea,Lr as aa,N as ta,Pr as sa,Qr as oe,Rr as ce,Rt as la,Tr as na,Yn as ra,Yr as oa,ai as we,ci as ca,d as ma,di as Se,ei as _e,fi as ia,hi as Ce,i as da,ii as me,j as ha,jt as ua,li as xa,mi as pa,ni as fa,oi as ie,pn as ba,qn as ga,ra as ja,ti as ya,ui as va,wr as Na,zt as wa}from"./cells-DxL32Atg.js";import"./react-dom-CSu739Rf.js";import{t as Ie}from"./compiler-runtime-B3qBwwSJ.js";import{c as Sa}from"./utils-C5VWChv9.js";import{t as _a}from"./ErrorBoundary-BfMsWVQU.js";import{t as Q}from"./cn-DYvqRARy.js";import{t as Ca}from"./jsx-runtime-Blw4afVn.js";import"./fullscreen-B51geQ_6.js";import{r as Ia}from"./config-BVfo0E1-.js";import"./popover-DHbixh3D.js";import{_ as ke,at as ka,d as Ta,g as de,h as he,it as Pa,m as le,nt as Te,ot as Fa,p as Pe,rt as $a,tt as ue}from"./JsonOutput-W3f6H6VQ.js";import"./download-Tklnz6pn.js";import{r as Fe}from"./radio-group-ByLzIKjm.js";import{t as xe}from"./tooltip-BcgbFR7q.js";import{r as Ra,t as ne}from"./button-BB1AV4Rb.js";import"./dist-gUHullA_.js";import{l as X}from"./arrays-DbOq36rN.js";import"./cjs-D5tzp-Y6.js";import"./main-BNL5rxQw.js";import"./useNonce-CbdaHKzX.js";import{i as Da}from"./strings-DMKwTex-.js";import{r as Va}from"./requests-9-v2bhoi.js";import{t as qa}from"./createLucideIcon-w-Qo9n0R.js";import{t as Ba}from"./x-C-Eq0ag8.js";import{a as La,r as Ea}from"./tree-actions-o2iyMmKN.js";import"./markdown-renderer-DpskAUxO.js";import{t as $e}from"./plus-AgXtozBz.js";import{a as Ma}from"./input-_AaMXWgD.js";import{n as Oa,o as Aa}from"./column-preview-Dxxs9Brz.js";import{t as za}from"./workflow-e-XGaKyY.js";import"./dist-Jbd9zUbK.js";import"./dist-BWXIz8tq.js";import"./dist-DX04AOlt.js";import"./dist-D5nYeU7Q.js";import"./dist-6qzebh8f.js";import"./session-BtBr2zr3.js";import"./purify.es-CWmnYhGI.js";import"./dates-BzOh4kS_.js";import{t as Ua}from"./copy-icon-DWG8Y-xW.js";import{t as Ga}from"./context-BFPaAUK_.js";import"./tooltip-BMi4WFDl.js";import"./vega-loader.browser-CAfmqKEc.js";import"./defaultLocale-t77eoiwF.js";import"./defaultLocale-BUCH2FMc.js";import{t as Re}from"./cell-link-uPmFMRTh.js";import"./chunk-5FQGJX7Z-CYQpNADu.js";import{r as Ha}from"./html-to-image-ChNWEUlR.js";import{o as Ka}from"./focus-BBiJct2G.js";import{n as pe}from"./useAsyncData-Bg5iAViP.js";import{a as Wa,i as Ya,n as Ja,o as De,r as Qa,t as Xa}from"./table-CH2plyy9.js";import"./react-resizable-panels.browser.esm-Z-MD3n3J.js";import{a as Za,f as et,o as re,t as at}from"./command-CPFHYoYk.js";import{n as tt}from"./icons-NFYKylj6.js";import{t as st}from"./useDeepCompareMemoize-BLRnan2Y.js";import{t as lt}from"./empty-state-JOk_hLQe.js";import{n as nt,t as rt}from"./common-aHaDUD0-.js";import{a as ot,i as ct,n as Ve,r as qe,t as Be}from"./components-RV25kGIW.js";import{t as Le}from"./add-connection-dialog-Dld_PDdZ.js";import{r as mt}from"./panel-accordion-state-BkWYwckU.js";var it=qa("square-equal",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]),U=Ie(),F=ge(Ye(),1),s=ge(Ca(),1),fe=1;function Ee(a){return 1.75+a*fe}function dt(a){return 3+a*fe}function Me(a){return 3.25+a*fe}var z={engineEmpty:.75,engine:.75,database:1,tableLoading:2.75,tableSchemaless:2,columnLocal:1.25,columnPreview:2.5};function M(a){return{paddingLeft:`${a}rem`}}var ht=ve(a=>{let e=a(_e),t=a(ra),l=a(da);return X(e,n=>{if(!n.variable_name)return-1;let i=Object.values(t).find(d=>d.name===n.variable_name);if(!i)return 0;let c=l.inOrderIds.indexOf(i.declaredBy[0]);return c===-1?0:c})});const ut=ja("marimo:datasources:hideEmpty",!1,ea,{getOnInit:!0});function Oe(a){let e=!1,t=[];for(let l of a){if(!ie(l)||!me(l)){t.push(l);continue}let n=l.child_schemas??[],i=Oe(n);if(l.tables.length===0&&i.length===0){e=!0;continue}if(i===n){t.push(l);continue}e=!0,t.push({...l,child_schemas:i})}return e?t:a}function xt(a){let e=!1,t=[];for(let l of a){if(we(l)&&l.schemas.length===0){e=!0;continue}if(l.schemas.length===0){t.push(l);continue}let n=Oe(l.schemas);if(n.length===0){e=!0;continue}if(n===l.schemas){t.push(l);continue}e=!0,t.push({...l,schemas:n})}return e?t:a}const Ae=ve(a=>{let e=new Map(a(oa));for(let t of Ce){let l=e.get(t);l&&(l.databases.length===0&&e.delete(t),l.databases.length===1&&l.databases[0].name==="memory"&&l.databases[0].schemas.length===0&&e.delete(t))}return X([...e.values()],t=>Ce.has(t.name)?1:0)}),pt=()=>{let a=(0,U.c)(40),[e,t]=F.useState(""),[l,n]=ye(ut),i=je(Ne),c=J(ht),d=J(Ae),r;e:{if(!l){r=d;break e}let f,v;a[0]===d?(f=a[1],v=a[2]):(f=!1,v=d.map(C=>{let k=xt(C.databases);return k===C.databases?C:(f=!0,{...C,databases:k})}),a[0]=d,a[1]=f,a[2]=v),r=f?v:d}let x=r;if(c.length===0&&x.length===0){let f;return a[3]===Symbol.for("react.memo_cache_sentinel")?(f=(0,s.jsx)(lt,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:(0,s.jsx)(Le,{children:(0,s.jsxs)(ne,{variant:"outline",size:"sm",children:["Add database or catalog",(0,s.jsx)($e,{className:"h-4 w-4 ml-2"})]})}),icon:(0,s.jsx)(ce,{})}),a[3]=f):f=a[3],f}let h=!!e.trim(),m;a[4]===i?m=a[5]:(m=f=>{i(f.length>0),t(f)},a[4]=i,a[5]=m);let o;a[6]!==e||a[7]!==m?(o=(0,s.jsx)(Za,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:m,rootClassName:"flex-1 border-r border-b-0"}),a[6]=e,a[7]=m,a[8]=o):o=a[8];let p;a[9]===h?p=a[10]:(p=h&&(0,s.jsx)("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>t(""),children:(0,s.jsx)(Ba,{className:"h-4 w-4"})}),a[9]=h,a[10]=p);let S=!l,b;a[11]!==l||a[12]!==n?(b=()=>n(!l),a[11]=l,a[12]=n,a[13]=b):b=a[13];let N;a[14]!==S||a[15]!==b?(N=(0,s.jsx)(La,{"data-testid":"datasources-hide-empty-button",isVisible:S,onToggle:b,showTooltip:"Show empty schemas and databases",hideTooltip:"Hide empty schemas and databases",size:"sm",className:"px-2 rounded-none focus-visible:outline-hidden"}),a[14]=S,a[15]=b,a[16]=N):N=a[16];let y;a[17]===Symbol.for("react.memo_cache_sentinel")?(y=(0,s.jsx)(Le,{children:(0,s.jsx)(ne,{variant:"ghost",size:"sm",className:"px-2 rounded-none focus-visible:outline-hidden",children:(0,s.jsx)($e,{className:"h-4 w-4"})})}),a[17]=y):y=a[17];let j;a[18]!==o||a[19]!==p||a[20]!==N?(j=(0,s.jsxs)("div",{className:"flex items-center w-full border-b",children:[o,p,N,y]}),a[18]=o,a[19]=p,a[20]=N,a[21]=j):j=a[21];let g;if(a[22]!==x||a[23]!==e){let f;a[25]===e?f=a[26]:(f=v=>(0,s.jsx)(ft,{connection:v,hasChildren:v.databases.length>0,children:v.databases.map(C=>(0,s.jsx)(bt,{connection:v,database:C,searchValue:e},C.name))},v.name),a[25]=e,a[26]=f),g=x.map(f),a[22]=x,a[23]=e,a[24]=g}else g=a[24];let w;a[27]!==x.length||a[28]!==c.length?(w=x.length>0&&c.length>0&&(0,s.jsxs)(Pe,{className:"pr-2",style:M(z.engine),children:[(0,s.jsx)(tt,{className:"h-4 w-4 text-muted-foreground"}),(0,s.jsx)("span",{className:"text-xs",children:"Python"})]}),a[27]=x.length,a[28]=c.length,a[29]=w):w=a[29];let u;a[30]!==e||a[31]!==c?(u=c.length>0&&(0,s.jsx)(be,{tables:c,searchValue:e}),a[30]=e,a[31]=c,a[32]=u):u=a[32];let _;a[33]!==w||a[34]!==u||a[35]!==g?(_=(0,s.jsxs)(et,{className:"flex flex-col",children:[g,w,u]}),a[33]=w,a[34]=u,a[35]=g,a[36]=_):_=a[36];let I;return a[37]!==_||a[38]!==j?(I=(0,s.jsxs)(at,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden",shouldFilter:!1,children:[j,_]}),a[37]=_,a[38]=j,a[39]=I):I=a[39],I};var ft=a=>{let e=(0,U.c)(26),{connection:t,children:l,hasChildren:n}=a,i=t.name===pa,c=i?"In-Memory":t.name,{previewDataSourceConnection:d}=Va(),r;e[0]!==t.name||e[1]!==d?(r=async()=>{await d({engine:t.name})},e[0]=t.name,e[1]=d,e[2]=r):r=e[2];let x=r,h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=M(z.engine),e[3]=h):h=e[3];let m;e[4]===t.dialect?m=e[5]:(m=(0,s.jsx)(Qe,{className:"h-4 w-4 text-muted-foreground",name:t.dialect}),e[4]=t.dialect,e[5]=m);let o;e[6]===t.dialect?o=e[7]:(o=Na(t.dialect),e[6]=t.dialect,e[7]=o);let p;e[8]===o?p=e[9]:(p=(0,s.jsx)("span",{className:"text-xs",children:o}),e[8]=o,e[9]=p);let S=c,b;e[10]===S?b=e[11]:(b=(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",(0,s.jsx)(ot,{variableName:S}),")"]}),e[10]=S,e[11]=b);let N;e[12]!==x||e[13]!==i?(N=!i&&(0,s.jsx)(Ea,{onClick:x,tooltip:"Refresh connection",className:"ml-auto h-4 p-0",iconClassName:"h-3.5 w-3.5"}),e[12]=x,e[13]=i,e[14]=N):N=e[14];let y;e[15]!==m||e[16]!==p||e[17]!==b||e[18]!==N?(y=(0,s.jsxs)(Pe,{className:"pr-2",style:h,children:[m,p,b,N]}),e[15]=m,e[16]=p,e[17]=b,e[18]=N,e[19]=y):y=e[19];let j;e[20]!==l||e[21]!==n?(j=n?l:(0,s.jsx)(le,{content:"No databases available",style:M(z.engineEmpty)}),e[20]=l,e[21]=n,e[22]=j):j=e[22];let g;return e[23]!==j||e[24]!==y?(g=(0,s.jsxs)(s.Fragment,{children:[y,j]}),e[23]=j,e[24]=y,e[25]=g):g=e[25],g},ze=F.createContext(null);function Ue(){let a=F.useContext(ze);if(a==null)throw Error("useDataSourceTree must be used within a DataSourceTreeContext.Provider");return a}function Ge(a,{schema:e,schemaPath:t}){return{engine:a.engineName,database:a.databaseName,schema:e,schemaPath:t,defaultSchema:a.defaultSchema,defaultDatabase:a.defaultDatabase,dialect:a.dialect}}var bt=a=>{let e=(0,U.c)(21),{connection:t,database:l,searchValue:n}=a,i;e[0]!==t.default_database||e[1]!==t.default_schema||e[2]!==t.dialect||e[3]!==t.name||e[4]!==l.name||e[5]!==n?(i={engineName:t.name,databaseName:l.name,dialect:t.dialect,defaultSchema:t.default_schema,defaultDatabase:t.default_database,searchValue:n},e[0]=t.default_database,e[1]=t.default_schema,e[2]=t.dialect,e[3]=t.name,e[4]=l.name,e[5]=n,e[6]=i):i=e[6];let c=i,d=t.name,r=l.schemas,x;e[7]===l?x=e[8]:(x=we(l),e[7]=l,e[8]=x);let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[9]=h):h=e[9];let m;e[10]!==l.schemas||e[11]!==x?(m=(0,s.jsx)(He,{schemas:r,schemasResolved:x,schemaPath:h,depth:0}),e[10]=l.schemas,e[11]=x,e[12]=m):m=e[12];let o;e[13]!==m||e[14]!==c?(o=(0,s.jsx)(ze.Provider,{value:c,children:m}),e[13]=m,e[14]=c,e[15]=o):o=e[15];let p;return e[16]!==t.name||e[17]!==l||e[18]!==n||e[19]!==o?(p=(0,s.jsx)(gt,{engineName:d,database:l,searchValue:n,children:o}),e[16]=t.name,e[17]=l,e[18]=n,e[19]=o,e[20]=p):p=e[20],p},gt=a=>{let e=(0,U.c)(29),{searchValue:t,engineName:l,database:n,children:i}=a,c;e[0]!==n||e[1]!==t?(c=va(n,t),e[0]=n,e[1]=t,e[2]=c):c=e[2];let d=c,[r,x]=F.useState(d),[h,m]=F.useState(!1),[o,p]=F.useState(t),[S,b]=F.useState(d);(o!==t||S!==d)&&(p(t),b(d),x(d));let N;e[3]===Symbol.for("react.memo_cache_sentinel")?(N=M(z.database),e[3]=N):N=e[3];let y;e[4]!==r||e[5]!==h?(y=()=>{x(!r),m(!h)},e[4]=r,e[5]=h,e[6]=y):y=e[6];let j=`${l}:${n.name}`,g;e[7]===r?g=e[8]:(g=(0,s.jsx)(ke,{isExpanded:r}),e[7]=r,e[8]=g);let w=h&&r?"text-foreground":"text-muted-foreground",u;e[9]===w?u=e[10]:(u=Q("h-4 w-4",w),e[9]=w,e[10]=u);let _;e[11]===u?_=e[12]:(_=(0,s.jsx)(ce,{className:u}),e[11]=u,e[12]=_);let I=h&&r&&"font-semibold",f;e[13]===I?f=e[14]:(f=Q(I),e[13]=I,e[14]=f);let v;e[15]===n.name?v=e[16]:(v=n.name===""?(0,s.jsx)("i",{children:"Not connected"}):n.name,e[15]=n.name,e[16]=v);let C;e[17]!==f||e[18]!==v?(C=(0,s.jsx)("span",{className:f,children:v}),e[17]=f,e[18]=v,e[19]=C):C=e[19];let k;e[20]!==C||e[21]!==y||e[22]!==j||e[23]!==g||e[24]!==_?(k=(0,s.jsxs)(re,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",style:N,onSelect:y,value:j,children:[g,_,C]}),e[20]=C,e[21]=y,e[22]=j,e[23]=g,e[24]=_,e[25]=k):k=e[25];let T=r&&i,P;return e[26]!==k||e[27]!==T?(P=(0,s.jsxs)(s.Fragment,{children:[k,T]}),e[26]=k,e[27]=T,e[28]=P):P=e[28],P},He=a=>{let{schemas:e,schemasResolved:t,depth:l}=a,n=Ue(),{engineName:i,databaseName:c,searchValue:d}=n,{addSchemaList:r}=oe(),x=st(a.schemaPath),[h,m]=F.useState(!1),{isPending:o,error:p}=pe(async()=>{if(!t&&i){m(!0);try{r({schemas:(await la.request({engine:i,database:c,schemaPath:x})).schemas??[],sqlSchemaContext:{engine:i,database:c,schemaPath:x}})}finally{m(!1)}}},[t,i,c,x]),S=M(Ee(l));return o||h?(0,s.jsx)(de,{message:"Loading schemas...",style:S}):p?(0,s.jsx)(he,{error:p,style:S}):e.length===0?(0,s.jsx)(le,{content:"No schemas available",style:S}):(0,s.jsx)(s.Fragment,{children:e.map(b=>ca(b.name)?(0,s.jsx)(be,{tables:b.tables,tablesResolved:ie(b),searchValue:d,sqlTableContext:Ge(n,{schema:b.name,schemaPath:x})},b.name):(0,s.jsx)(jt,{schema:b,schemaPath:[...x,b.name],depth:l},b.name))})},jt=a=>{let e=(0,U.c)(39),{schema:t,schemaPath:l,depth:n}=a,i=Ue(),{databaseName:c,searchValue:d}=i,r;e[0]!==t||e[1]!==d?(r=xa(t,d),e[0]=t,e[1]=d,e[2]=r):r=e[2];let x=r,[h,m]=F.useState(x),[o,p]=F.useState(!1),[S,b]=F.useState(d),[N,y]=F.useState(x),j=`${c}:${l.join(".")}`,g;e[3]===t.child_schemas?g=e[4]:(g=t.child_schemas??[],e[3]=t.child_schemas,e[4]=g);let w=g;(S!==d||N!==x)&&(b(d),y(x),m(x));let u;e[5]===n?u=e[6]:(u=M(Ee(n)),e[5]=n,e[6]=u);let _;e[7]!==h||e[8]!==o?(_=()=>{m(!h),p(!o)},e[7]=h,e[8]=o,e[9]=_):_=e[9];let I;e[10]===h?I=e[11]:(I=(0,s.jsx)(ke,{isExpanded:h}),e[10]=h,e[11]=I);let f=o&&h&&"text-foreground",v;e[12]===f?v=e[13]:(v=Q("h-4 w-4 text-muted-foreground",f),e[12]=f,e[13]=v);let C;e[14]===v?C=e[15]:(C=(0,s.jsx)(sa,{className:v}),e[14]=v,e[15]=C);let k=o&&h&&"font-semibold",T;e[16]===k?T=e[17]:(T=Q(k),e[16]=k,e[17]=T);let P;e[18]!==t.name||e[19]!==T?(P=(0,s.jsx)("span",{className:T,children:t.name}),e[18]=t.name,e[19]=T,e[20]=P):P=e[20];let R;e[21]!==P||e[22]!==u||e[23]!==_||e[24]!==I||e[25]!==C||e[26]!==j?(R=(0,s.jsxs)(re,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",style:u,onSelect:_,value:j,children:[I,C,P]}),e[21]=P,e[22]=u,e[23]=_,e[24]=I,e[25]=C,e[26]=j,e[27]=R):R=e[27];let D;e[28]!==w||e[29]!==n||e[30]!==h||e[31]!==t||e[32]!==l||e[33]!==d||e[34]!==i?(D=h&&(0,s.jsxs)(s.Fragment,{children:[(w.length>0||!me(t))&&(0,s.jsx)(He,{schemas:w,schemasResolved:me(t),schemaPath:l,depth:n+1}),(0,s.jsx)(be,{tables:t.tables,tablesResolved:ie(t),searchValue:d,tableIndentRem:dt(n),columnIndentRem:Me(n),sqlTableContext:Ge(i,{schema:t.name,schemaPath:l})})]}),e[28]=w,e[29]=n,e[30]=h,e[31]=t,e[32]=l,e[33]=d,e[34]=i,e[35]=D):D=e[35];let $;return e[36]!==R||e[37]!==D?($=(0,s.jsxs)(s.Fragment,{children:[R,D]}),e[36]=R,e[37]=D,e[38]=$):$=e[38],$},be=a=>{let e=(0,U.c)(31),{tables:t,sqlTableContext:l,searchValue:n,tablesResolved:i,tableIndentRem:c,columnIndentRem:d}=a,r=i===void 0?!0:i,{addTableList:x}=oe(),[h,m]=F.useState(!1),o;e[0]!==x||e[1]!==l||e[2]!==r?(o=async()=>{if(!r&&l){m(!0);let{engine:u,database:_,schema:I,schemaPath:f}=l,v=await Je.request({engine:u,database:_,schema:I,schemaPath:f??[]});if(!(v!=null&&v.tables))throw m(!1),Error("No tables available");x({tables:v.tables,sqlTableContext:l}),m(!1)}},e[0]=x,e[1]=l,e[2]=r,e[3]=o):o=e[3];let p;e[4]!==l||e[5]!==r?(p=[r,l],e[4]=l,e[5]=r,e[6]=p):p=e[6];let{isPending:S,error:b}=pe(o,p),N=c??z.tableLoading,y;e[7]===N?y=e[8]:(y=M(N),e[7]=N,e[8]=y);let j=y;if(S||h){let u;return e[9]===j?u=e[10]:(u=(0,s.jsx)(de,{message:"Loading tables...",style:j}),e[9]=j,e[10]=u),u}if(b){let u;return e[11]!==b||e[12]!==j?(u=(0,s.jsx)(he,{error:b,style:j}),e[11]=b,e[12]=j,e[13]=u):u=e[13],u}if(t.length===0){let u;return e[14]===j?u=e[15]:(u=(0,s.jsx)(le,{content:"No tables found",style:j}),e[14]=j,e[15]=u),u}let g;if(e[16]!==d||e[17]!==n||e[18]!==l||e[19]!==c||e[20]!==t){let u;e[22]===n?u=e[23]:(u=f=>n?f.name.toLowerCase().includes(n.toLowerCase()):!0,e[22]=n,e[23]=u);let _=t.filter(u),I;e[24]!==d||e[25]!==n||e[26]!==l||e[27]!==c?(I=f=>(0,s.jsx)(yt,{table:f,sqlTableContext:l,isSearching:!!n,tableIndentRem:c,columnIndentRem:d},f.name),e[24]=d,e[25]=n,e[26]=l,e[27]=c,e[28]=I):I=e[28],g=_.map(I),e[16]=d,e[17]=n,e[18]=l,e[19]=c,e[20]=t,e[21]=g}else g=e[21];let w;return e[29]===g?w=e[30]:(w=(0,s.jsx)(s.Fragment,{children:g}),e[29]=g,e[30]=w),w},yt=a=>{let e=(0,U.c)(69),{table:t,sqlTableContext:l,isSearching:n,tableIndentRem:i,columnIndentRem:c}=a,{addTable:d}=oe(),[r,x]=F.useState(!1),h=t.columns.length>0,m;e[0]!==d||e[1]!==r||e[2]!==l||e[3]!==t.name||e[4]!==h?(m=async()=>{if(r&&!h&&l){let{engine:L,database:ae,schema:te,schemaPath:We}=l,se=await wa.request({engine:L,database:ae,schema:te,tableName:t.name,schemaPath:We??[]});if(!(se!=null&&se.table))throw Error("No table details available");d({table:se.table,sqlTableContext:l})}},e[0]=d,e[1]=r,e[2]=l,e[3]=t.name,e[4]=h,e[5]=m):m=e[5];let o;e[6]!==r||e[7]!==h?(o=[r,h],e[6]=r,e[7]=h,e[8]=o):o=e[8];let{isFetching:p,isPending:S,error:b}=pe(m,o),N=J(Sa),y=Ka(),{createNewCell:j}=Ze(),g=Fe(),w;e[9]!==g||e[10]!==N||e[11]!==j||e[12]!==y||e[13]!==l||e[14]!==t?(w=()=>{Ha({autoInstantiate:N,createNewCell:j,fromCellId:y}),g((()=>{if(t.source_type==="catalog"){let L=l!=null&&l.database?[l.database,...l.schemaPath??[],t.name].join("."):t.name;return`${t.engine}.load_table("${L}")`}if(l)return Se({table:t,columnName:"*",sqlTableContext:l});switch(t.source_type){case"local":return`mo.ui.table(${t.name})`;case"duckdb":case"connection":return Se({table:t,columnName:"*",sqlTableContext:l});default:return Da(t.source_type),""}})())},e[9]=g,e[10]=N,e[11]=j,e[12]=y,e[13]=l,e[14]=t,e[15]=w):w=e[15];let u=w,_;e[16]!==t.num_columns||e[17]!==t.num_rows?(_=()=>{let L=[];return t.num_rows!=null&&L.push(`${t.num_rows} rows`),t.num_columns!=null&&L.push(`${t.num_columns} columns`),L.length===0?null:(0,s.jsx)("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:L.join(", ")})})},e[16]=t.num_columns,e[17]=t.num_rows,e[18]=_):_=e[18];let I=_,f;e[19]!==c||e[20]!==b||e[21]!==p||e[22]!==S||e[23]!==l||e[24]!==t?(f=()=>{let L=M(c??z.tableLoading);if(S||p)return(0,s.jsx)(de,{message:"Loading columns...",style:L});if(b)return(0,s.jsx)(he,{error:b,style:L});let ae=t.columns;return ae.length===0?(0,s.jsx)(le,{content:"No columns found",style:L}):ae.map(te=>(0,s.jsx)(vt,{table:t,column:te,sqlTableContext:l,columnIndentRem:c},te.name))},e[19]=c,e[20]=b,e[21]=p,e[22]=S,e[23]=l,e[24]=t,e[25]=f):f=e[25];let v=f,C;e[26]!==r||e[27]!==n||e[28]!==t.source_type||e[29]!==t.type?(C=()=>{if(t.source_type!=="local")return(0,s.jsx)(t.type==="table"?Xe:aa,{className:"h-3 w-3",strokeWidth:r||n?2.5:void 0})},e[26]=r,e[27]=n,e[28]=t.source_type,e[29]=t.type,e[30]=C):C=e[30];let k=C,T;e[31]!==l||e[32]!==t.name?(T=ia(l,t.name),e[31]=l,e[32]=t.name,e[33]=T):T=e[33];let P=T,R=i??(l?z.tableSchemaless:0),D=(r||n)&&"font-semibold",$;e[34]===D?$=e[35]:($=Q("rounded-none group h-8 cursor-pointer",D),e[34]=D,e[35]=$);let V;e[36]===R?V=e[37]:(V=M(R),e[36]=R,e[37]=V);let q;e[38]===r?q=e[39]:(q=()=>x(!r),e[38]=r,e[39]=q);let E;e[40]===k?E=e[41]:(E=k(),e[40]=k,e[41]=E);let O;e[42]===t.name?O=e[43]:(O=(0,s.jsx)("span",{className:"text-sm",children:t.name}),e[42]=t.name,e[43]=O);let A;e[44]!==E||e[45]!==O?(A=(0,s.jsxs)("div",{className:"flex gap-2 items-center flex-1 pl-1",children:[E,O]}),e[44]=E,e[45]=O,e[46]=A):A=e[46];let B;e[47]===I?B=e[48]:(B=I(),e[47]=I,e[48]=B);let H;e[49]===u?H=e[50]:(H=Ra.stopPropagation(()=>u()),e[49]=u,e[50]=H);let Z;e[51]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,s.jsx)(Aa,{className:"h-3 w-3"}),e[51]=Z):Z=e[51];let K;e[52]===H?K=e[53]:(K=(0,s.jsx)(xe,{content:"Add table to notebook",delayDuration:400,children:(0,s.jsx)(ne,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:H,children:Z})}),e[52]=H,e[53]=K);let W;e[54]!==r||e[55]!==V||e[56]!==q||e[57]!==A||e[58]!==B||e[59]!==K||e[60]!==$||e[61]!==P?(W=(0,s.jsxs)(re,{className:$,style:V,value:P,"aria-selected":r,forceMount:!0,onSelect:q,children:[A,B,K]}),e[54]=r,e[55]=V,e[56]=q,e[57]=A,e[58]=B,e[59]=K,e[60]=$,e[61]=P,e[62]=W):W=e[62];let Y;e[63]!==r||e[64]!==v?(Y=r&&v(),e[63]=r,e[64]=v,e[65]=Y):Y=e[65];let ee;return e[66]!==W||e[67]!==Y?(ee=(0,s.jsxs)(s.Fragment,{children:[W,Y]}),e[66]=W,e[67]=Y,e[68]=ee):ee=e[68],ee},vt=a=>{var O,A;let e=(0,U.c)(51),{table:t,column:l,sqlTableContext:n,columnIndentRem:i}=a,[c,d]=F.useState(!1),r=J(Ne),x=je(ya);r&&c&&d(!1),x(c?B=>new Set([...B,`${t.name}:${l.name}`]):B=>(B.delete(`${t.name}:${l.name}`),new Set(B)));let h=Fe(),{columnsPreviews:m}=fa(),o;e[0]!==l.name||e[1]!==t.primary_keys?(o=((O=t.primary_keys)==null?void 0:O.includes(l.name))||!1,e[0]=l.name,e[1]=t.primary_keys,e[2]=o):o=e[2];let p=o,S;e[3]!==l.name||e[4]!==t.indexes?(S=((A=t.indexes)==null?void 0:A.includes(l.name))||!1,e[3]=l.name,e[4]=t.indexes,e[5]=S):S=e[5];let b=S,N;e[6]===h?N=e[7]:(N=B=>{h(B)},e[6]=h,e[7]=N);let y=N,j=Nt,g=c?"font-semibold":"",w;e[8]!==l.name||e[9]!==g?(w=(0,s.jsx)("span",{className:g,children:l.name}),e[8]=l.name,e[9]=g,e[10]=w):w=e[10];let u=w,_=`${t.name}.${l.name}`,I=`${t.name}.${l.name}`,f;e[11]===c?f=e[12]:(f=()=>d(!c),e[11]=c,e[12]=f);let v;e[13]!==i||e[14]!==n?(v=i??(n?Me(0):z.columnLocal),e[13]=i,e[14]=n,e[15]=v):v=e[15];let C;e[16]===v?C=e[17]:(C=M(v),e[16]=v,e[17]=C);let k;e[18]!==l.type||e[19]!==u?(k=(0,s.jsx)(Ta,{columnName:u,dataType:l.type}),e[18]=l.type,e[19]=u,e[20]=k):k=e[20];let T;e[21]===p?T=e[22]:(T=p&&j({tooltipContent:"Primary key",content:"PK"}),e[21]=p,e[22]=T);let P;e[23]===b?P=e[24]:(P=b&&j({tooltipContent:"Indexed",content:"IDX"}),e[23]=b,e[24]=P);let R;e[25]!==C||e[26]!==k||e[27]!==T||e[28]!==P?(R=(0,s.jsxs)("div",{className:"flex flex-row gap-2 items-center flex-1",style:C,children:[k,T,P]}),e[25]=C,e[26]=k,e[27]=T,e[28]=P,e[29]=R):R=e[29];let D;e[30]===l.name?D=e[31]:(D=(0,s.jsx)(xe,{content:"Copy column name",delayDuration:400,children:(0,s.jsx)(ne,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:(0,s.jsx)(Ua,{tooltip:!1,value:l.name,className:"h-3 w-3"})})}),e[30]=l.name,e[31]=D);let $;e[32]===l.external_type?$=e[33]:($=(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:l.external_type}),e[32]=l.external_type,e[33]=$);let V;e[34]!==R||e[35]!==D||e[36]!==$||e[37]!==_||e[38]!==I||e[39]!==f?(V=(0,s.jsxs)(re,{className:"rounded-none py-1 group cursor-pointer",value:I,onSelect:f,children:[R,D,$]},_),e[34]=R,e[35]=D,e[36]=$,e[37]=_,e[38]=I,e[39]=f,e[40]=V):V=e[40];let q;e[41]!==l||e[42]!==m||e[43]!==y||e[44]!==c||e[45]!==n||e[46]!==t?(q=c&&(0,s.jsx)("div",{className:"pr-2 py-2 bg-(--slate-1) shadow-inner border-b",style:M(z.columnPreview),children:(0,s.jsx)(_a,{children:(0,s.jsx)(Oa,{table:t,column:l,onAddColumnChart:y,preview:m.get(n?`${n.database}.${n.schema}.${t.name}:${l.name}`:`${t.name}:${l.name}`),sqlTableContext:n})})}),e[41]=l,e[42]=m,e[43]=y,e[44]=c,e[45]=n,e[46]=t,e[47]=q):q=e[47];let E;return e[48]!==V||e[49]!==q?(E=(0,s.jsxs)(s.Fragment,{children:[V,q]}),e[48]=V,e[49]=q,e[50]=E):E=e[50],E};function Nt(a){let{tooltipContent:e,content:t}=a;return(0,s.jsx)(xe,{content:e,delayDuration:100,children:(0,s.jsx)("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:t})})}function qs(a){return a}var G={name:"name",type:"type-value",defs:"defs-refs"},wt=[{id:G.name,accessorFn:a=>[a.name,a.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:a})=>(0,s.jsx)(ue,{header:"Name",column:a}),cell:({getValue:a})=>{let[e,t]=a();return(0,s.jsx)(rt,{name:e,declaredBy:t})}},{id:G.type,accessorFn:a=>[a.dataType,a.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:a})=>(0,s.jsx)(ue,{header:(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("span",{children:"Type"}),(0,s.jsx)("span",{children:"Value"})]}),column:a}),cell:({getValue:a})=>{let[e,t]=a();return(0,s.jsxs)("div",{className:"max-w-[150px]",children:[(0,s.jsx)("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),(0,s.jsx)("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:t??"",children:t})]})}},{id:G.defs,accessorFn:a=>[a.declaredBy,a.usedBy,a.name,a.declaredByNames,a.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:a})=>(0,s.jsx)(ue,{header:(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("span",{children:"Declared By"}),(0,s.jsx)("span",{children:"Used By"})]}),column:a}),cell:({getValue:a})=>{let[e,t,l]=a(),n=i=>{let c=ma(i);c&&ba(c,l)};return(0,s.jsxs)("div",{className:"flex flex-col gap-1 py-1",children:[(0,s.jsxs)("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[(0,s.jsx)("span",{title:"Declared by",children:(0,s.jsx)(it,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?(0,s.jsx)(Re,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>n(e[0])}):(0,s.jsx)("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((i,c)=>(0,s.jsxs)("span",{className:"flex",children:[(0,s.jsx)(Re,{variant:"focus",cellId:i,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>n(i)},i),c<e.length-1&&", "]},i))})]}),(0,s.jsxs)("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[(0,s.jsx)("span",{title:"Used by",children:(0,s.jsx)(za,{className:"w-3.5 h-3.5 text-muted-foreground"})}),(0,s.jsx)(nt,{maxCount:3,cellIds:t,skipScroll:!0,onClick:n})]})]})}}];function St({variables:a,sort:e,cellIdToIndex:t}){e||(e={id:G.defs,desc:!1});let l=[];switch(e.id){case G.name:l=X(a,n=>n.name);break;case G.type:l=X(a,n=>n.dataType);break;case G.defs:l=X(a,n=>t.get(n.declaredBy[0]));break}return e.desc?l.toReversed():l}const Ke=(0,F.memo)(({className:a,cellIds:e,variables:t})=>{let[l,n]=F.useState([]),[i,c]=F.useState(""),d=ta(),{locale:r}=Ga(),x=(0,F.useMemo)(()=>{let m=o=>{let p=d[o];return ua(p)?`cell-${e.indexOf(o)}`:p??`cell-${e.indexOf(o)}`};return Object.values(t).map(o=>({...o,declaredByNames:o.declaredBy.map(m),usedByNames:o.usedBy.map(m)}))},[t,d,e]),h=$a({data:(0,F.useMemo)(()=>{let m=new Map;return e.forEach((o,p)=>m.set(o,p)),St({variables:x,sort:l[0],cellIdToIndex:m})},[x,l,e]),columns:wt,getCoreRowModel:Pa(),onGlobalFilterChange:c,getFilteredRowModel:ka(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter(m){return m.columnDef.enableGlobalFilter??!0},globalFilterFn:"auto",manualSorting:!0,locale:r,onSortingChange:n,getSortedRowModel:Fa(),state:{sorting:l,globalFilter:i}});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Ma,{className:"w-full",placeholder:"Search",value:i,onChange:m=>c(m.target.value)}),(0,s.jsxs)(Xa,{className:Q("w-full text-sm flex-1 border-separate border-spacing-0",a),children:[(0,s.jsx)(Wa,{children:(0,s.jsx)(De,{className:"whitespace-nowrap text-xs",children:h.getFlatHeaders().map(m=>(0,s.jsx)(Ya,{className:"sticky top-0 bg-background border-b",children:Te(m.column.columnDef.header,m.getContext())},m.id))})}),(0,s.jsx)(Ja,{children:h.getRowModel().rows.map(m=>(0,s.jsx)(De,{className:"hover:bg-accent",children:m.getVisibleCells().map(o=>(0,s.jsx)(Qa,{className:"border-b",children:Te(o.column.columnDef.cell,o.getContext())},o.id))},m.id))})]})]})});Ke.displayName="VariableTable";var _t=Ie(),Ct=()=>{let a=(0,_t.c)(24),e=ga(),t=ha(),l=J(_e),n=J(Ae),[i,c]=ye(mt),d=l.length+n.length,r;a[0]!==d||a[1]!==i.hasUserInteracted||a[2]!==i.openSections?(r=!i.hasUserInteracted&&d>0?[...new Set([...i.openSections,"datasources"])]:i.openSections,a[0]=d,a[1]=i.hasUserInteracted,a[2]=i.openSections,a[3]=r):r=a[3];let x=r,h;a[4]===c?h=a[5]:(h=u=>{c({openSections:u,hasUserInteracted:!0})},a[4]=c,a[5]=h);let m=h,o=!x.includes("datasources")&&d>0,p;a[6]===Symbol.for("react.memo_cache_sentinel")?(p=(0,s.jsx)(ce,{className:"w-4 h-4"}),a[6]=p):p=a[6];let S;a[7]!==d||a[8]!==o?(S=o&&(0,s.jsx)(ct,{children:d}),a[7]=d,a[8]=o,a[9]=S):S=a[9];let b;a[10]===S?b=a[11]:(b=(0,s.jsxs)(qe,{children:[p,"Data sources",S]}),a[10]=S,a[11]=b);let N;a[12]===Symbol.for("react.memo_cache_sentinel")?(N=(0,s.jsx)(Be,{children:(0,s.jsx)(pt,{})}),a[12]=N):N=a[12];let y;a[13]===b?y=a[14]:(y=(0,s.jsxs)(Ve,{value:"datasources",children:[b,N]}),a[13]=b,a[14]=y);let j;a[15]===Symbol.for("react.memo_cache_sentinel")?(j=(0,s.jsxs)(qe,{children:[(0,s.jsx)(na,{className:"w-4 h-4"}),"Variables"]}),a[15]=j):j=a[15];let g;a[16]!==t||a[17]!==e?(g=(0,s.jsxs)(Ve,{value:"variables",lastItem:!0,children:[j,(0,s.jsx)(Be,{children:Object.keys(e).length===0?(0,s.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground",children:"No variables defined"}):(0,s.jsx)(Ke,{cellIds:t.inOrderIds,variables:e})})]}),a[16]=t,a[17]=e,a[18]=g):g=a[18];let w;return a[19]!==m||a[20]!==x||a[21]!==y||a[22]!==g?(w=(0,s.jsxs)(Ia,{type:"multiple",value:x,onValueChange:m,className:"flex flex-col h-full overflow-auto",children:[y,g]}),a[19]=m,a[20]=x,a[21]=y,a[22]=g,a[23]=w):w=a[23],w};export{Ct as default};
@@ -1 +1 @@
1
- var A=Object.defineProperty;var N=(t,e,r)=>e in t?A(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var b=(t,e,r)=>N(t,typeof e!="symbol"?e+"":e,r);import{s as T}from"./chunk-LvLJmgfZ.js";import{u as I}from"./useEvent-D91BmmQi.js";import{a as V}from"./cells-DxL32Atg.js";import{t as M}from"./compiler-runtime-B3qBwwSJ.js";import{g as k}from"./useEventListener-B_wSLgFR.js";import{t as E}from"./objects-BlG0ZrO0.js";import{o as P}from"./utils-C5VWChv9.js";import{T as _,v as z}from"./config-Bm5B9wGP.js";import{t as D}from"./cn-DYvqRARy.js";import{t as $}from"./jsx-runtime-Blw4afVn.js";import{s as B,u as H}from"./download-Tklnz6pn.js";import{r as L}from"./requests-9-v2bhoi.js";import{P as R}from"./layout-D7Yzn4XY.js";import{t as Y}from"./Deferred-D2igisxY.js";import{t as q}from"./use-toast-BwJoaaDM.js";import{t as x}from"./useInterval-CjGsg4ie.js";var G=class{constructor(){b(this,"capturedInputs",new Map);b(this,"inFlight",new Map)}cancelEntry(t){t.controller.abort(),t.deferred.status==="pending"&&t.deferred.resolve(void 0)}needsCapture(t,e){if(this.capturedInputs.get(t)===e)return!1;let r=this.inFlight.get(t);return!(r&&r.inputValue===e)}waitForInFlight(t,e){let r=this.inFlight.get(t);return r&&r.inputValue===e?r.deferred.promise:null}startCapture(t,e){let r=this.inFlight.get(t);r&&this.cancelEntry(r);let a=new AbortController,i=new Y,s={controller:a,inputValue:e,deferred:i};return this.inFlight.set(t,s),{signal:a.signal,markCaptured:p=>{this.inFlight.get(t)===s&&(i.resolve(p),this.capturedInputs.set(t,e),this.inFlight.delete(t))},markFailed:()=>{this.inFlight.get(t)===s&&(i.resolve(void 0),this.inFlight.delete(t))}}}prune(t){for(let e of this.capturedInputs.keys())t.has(e)||this.capturedInputs.delete(e);for(let[e,r]of this.inFlight)t.has(e)||(this.cancelEntry(r),this.inFlight.delete(e))}get isCapturing(){return this.inFlight.size>0}abort(){for(let t of this.inFlight.values())this.cancelEntry(t);this.inFlight.clear()}reset(){this.abort(),this.capturedInputs.clear()}},J=M(),S=5e3;function K(){let t=(0,J.c)(14),e=I(P),{state:r}=I(z),a=e.auto_download.includes("markdown"),i=e.auto_download.includes("html"),s=e.auto_download.includes("ipynb"),p=r===_.OPEN,m=!a||!p,d=!i||!p,c=!s||!p,{autoExportAsHTML:l,autoExportAsIPYNB:o,autoExportAsMarkdown:n,updateCellOutputs:u}=L(),h=O(),f;t[0]===n?f=t[1]:(f=async()=>{await n({download:!1})},t[0]=n,t[1]=f);let g;t[2]===m?g=t[3]:(g={delayMs:S,whenVisible:!0,disabled:m},t[2]=m,t[3]=g),x(f,g);let w;t[4]===l?w=t[5]:(w=async()=>{await l({download:!1,includeCode:!0,files:R.INSTANCE.filenames()})},t[4]=l,t[5]=w);let v;t[6]===d?v=t[7]:(v={delayMs:S,whenVisible:!0,disabled:d},t[6]=d,t[7]=v),x(w,v);let F;t[8]!==o||t[9]!==h||t[10]!==u?(F=async()=>{await j({takeScreenshots:()=>h({progress:H.indeterminate()}),updateCellOutputs:u}),await o({download:!1})},t[8]=o,t[9]=h,t[10]=u,t[11]=F):F=t[11];let y;t[12]===c?y=t[13]:(y={delayMs:S,whenVisible:!0,disabled:c,skipIfRunning:!0},t[12]=c,t[13]=y),x(F,y)}var Q=new Set(["text/html","application/vnd.vegalite.v5+json","application/vnd.vega.v5+json","application/vnd.vegalite.v6+json","application/vnd.vega.v6+json"]);const C=new G;function O(){let t=I(V);return async e=>{var d,c;let{progress:r}=e,a=new Set(E.keys(t));C.prune(a);let i=[],s=[];for(let[l,o]of E.entries(t)){let n=(d=o.output)==null?void 0:d.data;if((c=o.output)!=null&&c.mimetype&&Q.has(o.output.mimetype)&&n)if(C.needsCapture(l,n))i.push([l,n]);else{let u=C.waitForInFlight(l,n);u&&s.push({cellId:l,promise:u})}}if(i.length===0&&s.length===0)return{};i.length>0&&r.addTotal(i.length);let p={};for(let[l,o]of i){let n=C.startCapture(l,o);try{let u=await B(l);if(n.signal.aborted)continue;if(!u){k.error(`Failed to capture screenshot for cell ${l}`),n.markFailed();continue}let h=["image/png",u];p[l]=h,n.markCaptured(h)}catch(u){k.error(`Error screenshotting cell ${l}:`,u),n.markFailed()}finally{r.increment(1)}}let m=await Promise.allSettled(s.map(({promise:l})=>l));for(let[l,{cellId:o}]of s.entries()){let n=m[l];n.status==="fulfilled"&&n.value&&(p[o]=n.value)}return p}}async function j(t){let{takeScreenshots:e,updateCellOutputs:r}=t;try{let a=await e();E.size(a)>0&&await r({cellIdsToOutput:a})}catch(a){k.error("Error updating cell outputs with screenshots:",a),q({title:"Failed to capture cell outputs",description:"Some outputs may be missing from the export. Continuing.",variant:"danger"})}}var U=M(),W=T($(),1),X=t=>{let e=(0,U.c)(8),r,a;e[0]===t?(r=e[1],a=e[2]):({className:r,...a}=t,e[0]=t,e[1]=r,e[2]=a);let i;e[3]===r?i=e[4]:(i=D("animate-pulse rounded-md bg-muted",r),e[3]=r,e[4]=i);let s;return e[5]!==a||e[6]!==i?(s=(0,W.jsx)("div",{className:i,...a}),e[5]=a,e[6]=i,e[7]=s):s=e[7],s};export{O as i,j as n,K as r,X as t};
1
+ var A=Object.defineProperty;var N=(t,e,r)=>e in t?A(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var b=(t,e,r)=>N(t,typeof e!="symbol"?e+"":e,r);import{s as T}from"./chunk-LvLJmgfZ.js";import{u as I}from"./useEvent-D91BmmQi.js";import{a as V}from"./cells-DxL32Atg.js";import{t as M}from"./compiler-runtime-B3qBwwSJ.js";import{g as k}from"./useEventListener-B_wSLgFR.js";import{t as E}from"./objects-BlG0ZrO0.js";import{o as P}from"./utils-C5VWChv9.js";import{T as _,v as z}from"./config-Bm5B9wGP.js";import{t as D}from"./cn-DYvqRARy.js";import{t as $}from"./jsx-runtime-Blw4afVn.js";import{s as B,u as H}from"./download-Tklnz6pn.js";import{r as L}from"./requests-9-v2bhoi.js";import{P as R}from"./layout-QkEddeXT.js";import{t as Y}from"./Deferred-D2igisxY.js";import{t as q}from"./use-toast-BwJoaaDM.js";import{t as x}from"./useInterval-CjGsg4ie.js";var G=class{constructor(){b(this,"capturedInputs",new Map);b(this,"inFlight",new Map)}cancelEntry(t){t.controller.abort(),t.deferred.status==="pending"&&t.deferred.resolve(void 0)}needsCapture(t,e){if(this.capturedInputs.get(t)===e)return!1;let r=this.inFlight.get(t);return!(r&&r.inputValue===e)}waitForInFlight(t,e){let r=this.inFlight.get(t);return r&&r.inputValue===e?r.deferred.promise:null}startCapture(t,e){let r=this.inFlight.get(t);r&&this.cancelEntry(r);let a=new AbortController,i=new Y,s={controller:a,inputValue:e,deferred:i};return this.inFlight.set(t,s),{signal:a.signal,markCaptured:p=>{this.inFlight.get(t)===s&&(i.resolve(p),this.capturedInputs.set(t,e),this.inFlight.delete(t))},markFailed:()=>{this.inFlight.get(t)===s&&(i.resolve(void 0),this.inFlight.delete(t))}}}prune(t){for(let e of this.capturedInputs.keys())t.has(e)||this.capturedInputs.delete(e);for(let[e,r]of this.inFlight)t.has(e)||(this.cancelEntry(r),this.inFlight.delete(e))}get isCapturing(){return this.inFlight.size>0}abort(){for(let t of this.inFlight.values())this.cancelEntry(t);this.inFlight.clear()}reset(){this.abort(),this.capturedInputs.clear()}},J=M(),S=5e3;function K(){let t=(0,J.c)(14),e=I(P),{state:r}=I(z),a=e.auto_download.includes("markdown"),i=e.auto_download.includes("html"),s=e.auto_download.includes("ipynb"),p=r===_.OPEN,m=!a||!p,d=!i||!p,c=!s||!p,{autoExportAsHTML:l,autoExportAsIPYNB:o,autoExportAsMarkdown:n,updateCellOutputs:u}=L(),h=O(),f;t[0]===n?f=t[1]:(f=async()=>{await n({download:!1})},t[0]=n,t[1]=f);let g;t[2]===m?g=t[3]:(g={delayMs:S,whenVisible:!0,disabled:m},t[2]=m,t[3]=g),x(f,g);let w;t[4]===l?w=t[5]:(w=async()=>{await l({download:!1,includeCode:!0,files:R.INSTANCE.filenames()})},t[4]=l,t[5]=w);let v;t[6]===d?v=t[7]:(v={delayMs:S,whenVisible:!0,disabled:d},t[6]=d,t[7]=v),x(w,v);let F;t[8]!==o||t[9]!==h||t[10]!==u?(F=async()=>{await j({takeScreenshots:()=>h({progress:H.indeterminate()}),updateCellOutputs:u}),await o({download:!1})},t[8]=o,t[9]=h,t[10]=u,t[11]=F):F=t[11];let y;t[12]===c?y=t[13]:(y={delayMs:S,whenVisible:!0,disabled:c,skipIfRunning:!0},t[12]=c,t[13]=y),x(F,y)}var Q=new Set(["text/html","application/vnd.vegalite.v5+json","application/vnd.vega.v5+json","application/vnd.vegalite.v6+json","application/vnd.vega.v6+json"]);const C=new G;function O(){let t=I(V);return async e=>{var d,c;let{progress:r}=e,a=new Set(E.keys(t));C.prune(a);let i=[],s=[];for(let[l,o]of E.entries(t)){let n=(d=o.output)==null?void 0:d.data;if((c=o.output)!=null&&c.mimetype&&Q.has(o.output.mimetype)&&n)if(C.needsCapture(l,n))i.push([l,n]);else{let u=C.waitForInFlight(l,n);u&&s.push({cellId:l,promise:u})}}if(i.length===0&&s.length===0)return{};i.length>0&&r.addTotal(i.length);let p={};for(let[l,o]of i){let n=C.startCapture(l,o);try{let u=await B(l);if(n.signal.aborted)continue;if(!u){k.error(`Failed to capture screenshot for cell ${l}`),n.markFailed();continue}let h=["image/png",u];p[l]=h,n.markCaptured(h)}catch(u){k.error(`Error screenshotting cell ${l}:`,u),n.markFailed()}finally{r.increment(1)}}let m=await Promise.allSettled(s.map(({promise:l})=>l));for(let[l,{cellId:o}]of s.entries()){let n=m[l];n.status==="fulfilled"&&n.value&&(p[o]=n.value)}return p}}async function j(t){let{takeScreenshots:e,updateCellOutputs:r}=t;try{let a=await e();E.size(a)>0&&await r({cellIdsToOutput:a})}catch(a){k.error("Error updating cell outputs with screenshots:",a),q({title:"Failed to capture cell outputs",description:"Some outputs may be missing from the export. Continuing.",variant:"danger"})}}var U=M(),W=T($(),1),X=t=>{let e=(0,U.c)(8),r,a;e[0]===t?(r=e[1],a=e[2]):({className:r,...a}=t,e[0]=t,e[1]=r,e[2]=a);let i;e[3]===r?i=e[4]:(i=D("animate-pulse rounded-md bg-muted",r),e[3]=r,e[4]=i);let s;return e[5]!==a||e[6]!==i?(s=(0,W.jsx)("div",{className:i,...a}),e[5]=a,e[6]=i,e[7]=s):s=e[7],s};export{O as i,j as n,K as r,X as t};
@@ -0,0 +1 @@
1
+ import{p as i}from"./useEvent-D91BmmQi.js";import{Gn as h,Kn as c,ra as r}from"./cells-DxL32Atg.js";import{d as m}from"./arrays-DbOq36rN.js";var d="marimo:ai:chatState:v5";const u=i(null),v=i(null),f=r("marimo:ai:chatOptions",{webSearch:!1},c),p=r("marimo:ai:includeOtherCells",!0,c);function C(a){let t=new Map;for(let[s,e]of a.entries()){if(e.messages.length===0)continue;let l=m(e.messages,o=>o.id);t.set(s,{...e,messages:l})}return t}const n=r(d,{chats:new Map,activeChatId:null},h({toSerializable:a=>({chats:[...C(a.chats).entries()],activeChatId:a.activeChatId}),fromSerializable:a=>({chats:new Map(a.chats),activeChatId:a.activeChatId})})),I=i(a=>{let t=a(n);return t.activeChatId?t.chats.get(t.activeChatId):null},(a,t,s)=>{t(n,e=>({...e,activeChatId:s}))});export{p as a,n as i,u as n,v as o,f as r,I as t};
@@ -1 +1 @@
1
- import{s as ae}from"./chunk-LvLJmgfZ.js";import{d as ie,u as b}from"./useEvent-D91BmmQi.js";import{E as de,Lr as ne,Qn as se,Rr as re,St as Q,Vr as ce,Zn as he,_ as me,fr as pe,pa as ke,zr as fe}from"./cells-DxL32Atg.js";import{t as ue}from"./compiler-runtime-B3qBwwSJ.js";import{c as ye,i as be,s as xe}from"./utils-C5VWChv9.js";import{O as je}from"./config-Bm5B9wGP.js";import{t as ve}from"./jsx-runtime-Blw4afVn.js";import{t as Ce}from"./label-DUD3SZnk.js";import{h as we,i as ge}from"./download-Tklnz6pn.js";import{r as ze}from"./requests-9-v2bhoi.js";import{t as f}from"./createLucideIcon-w-Qo9n0R.js";import{n as V,r as F}from"./x-C-Eq0ag8.js";import{t as Ie}from"./chevron-right-BS_NcSch.js";import{t as G}from"./circle-plus-BluydVNx.js";import{t as We}from"./code-xml-aSiY8T7C.js";import{t as Me}from"./eye-off-BOZA7gbn.js";import{t as _e}from"./image-5XI2VU-q.js";import{t as Se}from"./link-CHdiBDr5.js";import{i as Ae,t as Re}from"./useDeleteCell-DH0weyin.js";import{t as Te}from"./sparkles-DUCpRFlS.js";import{t as De}from"./trash-2-72W0TZ3L.js";import{t as Ee}from"./use-toast-BwJoaaDM.js";import{n as Le}from"./copy-B-LLR1Yy.js";import{i as Ne}from"./useRunCells-8xYRh7wH.js";import{a as Oe,c as qe,n as Be}from"./dialog-88bLE398.js";import{n as He}from"./ImperativeModal-Ci0icDPt.js";import{n as Pe}from"./state-COqqdiUM.js";import{r as K}from"./html-to-image-ChNWEUlR.js";import{n as Ue,t as Qe}from"./icons-NFYKylj6.js";import{n as Z}from"./name-cell-input-DoxL2EXI.js";import{t as $}from"./multi-icon-DVD1luis.js";import{t as Ve}from"./useSplitCell-BvgvIZaz.js";var J=f("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),X=f("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Y=f("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]),Fe=f("text-cursor-input",[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]]),ee=f("zap-off",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),le=f("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function Ge(a){let e=new URL(window.location.href);return e.hash=`scrollTo=${encodeURIComponent(a)}`,e.toString()}function Ke(a){var c;let e=(c=a.match(/scrollTo=([^&]+)/))==null?void 0:c[1];return e?decodeURIComponent(e.split("&")[0]):null}function te(a){return a==="_"?!1:!!(a&&a.trim().length>0)}var Ze=ue(),l=ae(ve(),1);function $e(a){let e=(0,Ze.c)(47),{cell:c,closePopover:u}=a,{createNewCell:m,updateCellConfig:s,updateCellName:x,moveCell:p,sendToTop:W,sendToBottom:M,addColumnBreakpoint:_,clearCellOutput:S,markUntouched:A}=de(),R=Ve(),T=Ne(c==null?void 0:c.cellId),D=!b(me),E=Re(),{openModal:j}=He(),L=ie(Pe),N=b(be),v=b(ye),oe=b(je),y=b(xe),{saveCellConfig:r}=ze();if(!c||oe){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0],t}let{cellId:o,config:i,getEditorView:n,name:h,hasOutput:C,hasConsoleOutput:O,status:q}=c,w;e[1]!==o||e[2]!==i.disabled||e[3]!==r||e[4]!==s?(w=async()=>{let t={disabled:!i.disabled};await r({configs:{[o]:t}}),s({cellId:o,config:t})},e[1]=o,e[2]=i.disabled,e[3]=r,e[4]=s,e[5]=w):w=e[5];let B=w,g;e[6]!==o||e[7]!==i.hide_code||e[8]!==n||e[9]!==r||e[10]!==s?(g=async()=>{let t={hide_code:!i.hide_code};await r({configs:{[o]:t}}),s({cellId:o,config:t});let U=n();U&&(t.hide_code?U.contentDOM.blur():U.focus())},e[6]=o,e[7]=i.hide_code,e[8]=n,e[9]=r,e[10]=s,e[11]=g):g=e[11];let H=g,d=o===ke,z;e[12]===Symbol.for("react.memo_cache_sentinel")?(z=(0,l.jsx)(Ae,{size:13,strokeWidth:1.5}),e[12]=z):z=e[12];let P=q==="running"||q==="queued"||q==="disabled-transitively"||i.disabled,k;e[13]===T?k=e[14]:(k=()=>T(),e[13]=T,e[14]=k);let I;return e[15]!==_||e[16]!==N||e[17]!==y||e[18]!==v||e[19]!==D||e[20]!==o||e[21]!==S||e[22]!==u||e[23]!==i.disabled||e[24]!==i.hide_code||e[25]!==m||e[26]!==E||e[27]!==n||e[28]!==O||e[29]!==C||e[30]!==d||e[31]!==A||e[32]!==p||e[33]!==h||e[34]!==j||e[35]!==r||e[36]!==M||e[37]!==W||e[38]!==L||e[39]!==R||e[40]!==P||e[41]!==k||e[42]!==B||e[43]!==H||e[44]!==s||e[45]!==x?(I=[[{icon:z,label:"Run cell",hotkey:"cell.run",hidden:P,redundant:!0,handle:k},{icon:(0,l.jsx)(Te,{size:13,strokeWidth:1.5}),label:"Refactor with AI",hidden:!N,handle:()=>{L(t=>(t==null?void 0:t.cellId)===o?null:{cellId:o})},hotkey:"cell.aiCompletion"},{icon:(0,l.jsx)(Y,{size:13,strokeWidth:1.5}),label:"Split",hotkey:"cell.splitCell",handle:()=>R({cellId:o})},{icon:(0,l.jsx)(We,{size:13,strokeWidth:1.5}),label:"Format",hotkey:"cell.format",handle:()=>{let t=n();t&&pe({[o]:t})}},{icon:i.hide_code?(0,l.jsx)(ne,{size:13,strokeWidth:1.5}):(0,l.jsx)(Me,{size:13,strokeWidth:1.5}),label:i.hide_code?"Show code":"Hide code",handle:H,hotkey:"cell.hideCode"},{icon:i.disabled?(0,l.jsx)(ee,{size:13,strokeWidth:1.5}):(0,l.jsx)(le,{size:13,strokeWidth:1.5}),label:i.disabled?"Enable execution":"Disable execution",handle:B,hidden:d}],[{icon:(0,l.jsx)(Qe,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:async()=>{let t=n();t&&(K({autoInstantiate:v,createNewCell:m}),Q(t,{language:"markdown",keepCodeAsIs:!1}),i.hide_code||(await r({configs:{[o]:{hide_code:!0}}}),s({cellId:o,config:{hide_code:!0}}),A({cellId:o})))},hidden:d},he(n())==="sql"?{icon:(0,l.jsx)(Ue,{}),label:"View as Python",hotkey:"cell.viewAsSQL",handle:()=>{let t=n();t&&se(t,"python",{force:!0})},hidden:d}:{icon:(0,l.jsx)(re,{size:13,strokeWidth:1.5}),label:"Convert to SQL",hotkey:"cell.viewAsSQL",handle:()=>{let t=n();t&&(K({autoInstantiate:v,createNewCell:m}),Q(t,{language:"sql",keepCodeAsIs:!1}))},hidden:d}],[{icon:(0,l.jsxs)($,{children:[(0,l.jsx)(G,{size:13,strokeWidth:1.5}),(0,l.jsx)(V,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>m({cellId:o,before:!0}),hidden:d,redundant:!0},{icon:(0,l.jsxs)($,{children:[(0,l.jsx)(G,{size:13,strokeWidth:1.5}),(0,l.jsx)(F,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>m({cellId:o,before:!1}),redundant:!0},{icon:(0,l.jsx)(V,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>p({cellId:o,before:!0}),hidden:d},{icon:(0,l.jsx)(F,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>p({cellId:o,before:!1}),hidden:d},{icon:(0,l.jsx)(we,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>p({cellId:o,direction:"left"}),hidden:y!=="columns"||d},{icon:(0,l.jsx)(Ie,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>p({cellId:o,direction:"right"}),hidden:y!=="columns"||d},{icon:(0,l.jsx)(X,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>W({cellId:o,scroll:!1}),hidden:d},{icon:(0,l.jsx)(J,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>M({cellId:o,scroll:!1}),hidden:d},{icon:(0,l.jsx)(fe,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",handle:()=>_({cellId:o}),hidden:y!=="columns"||d}],[{icon:(0,l.jsx)(_e,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!C,handle:()=>ge(o,"result")},{icon:(0,l.jsx)(ce,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(C||O),handle:()=>{S({cellId:o})}}],[{icon:(0,l.jsx)(Fe,{size:13,strokeWidth:1.5}),label:"Name",disableClick:!0,handle:el,handleHeadless:()=>{j((0,l.jsxs)(Be,{children:[(0,l.jsx)(Oe,{children:(0,l.jsx)(qe,{children:"Rename cell"})}),(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)(Ce,{htmlFor:"cell-name",children:"Cell name"}),(0,l.jsx)(Z,{placeholder:"cell name",value:h,onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),t.stopPropagation(),j(null))},onChange:t=>x({cellId:o,name:t})})]})]}))},rightElement:(0,l.jsx)(Z,{placeholder:"cell name",value:h,onChange:t=>x({cellId:o,name:t}),onEnterKey:()=>u==null?void 0:u()}),hidden:d},{icon:(0,l.jsx)(Se,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!te(h),tooltip:te(h)?void 0:"Only named cells can be linked to",handle:async()=>{await Le(Ge(h)),Ee({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!D,variant:"danger",icon:(0,l.jsx)(De,{size:13,strokeWidth:1.5}),handle:()=>{E({cellId:o})}}]].map(Xe).filter(Je),e[15]=_,e[16]=N,e[17]=y,e[18]=v,e[19]=D,e[20]=o,e[21]=S,e[22]=u,e[23]=i.disabled,e[24]=i.hide_code,e[25]=m,e[26]=E,e[27]=n,e[28]=O,e[29]=C,e[30]=d,e[31]=A,e[32]=p,e[33]=h,e[34]=j,e[35]=r,e[36]=M,e[37]=W,e[38]=L,e[39]=R,e[40]=P,e[41]=k,e[42]=B,e[43]=H,e[44]=s,e[45]=x,e[46]=I):I=e[46],I}function Je(a){return a.length>0}function Xe(a){return a.filter(Ye)}function Ye(a){return!a.hidden}function el(a){a==null||a.stopPropagation(),a==null||a.preventDefault()}export{Y as a,ee as i,Ke as n,X as o,le as r,J as s,$e as t};
1
+ import{s as ae}from"./chunk-LvLJmgfZ.js";import{d as ie,u as b}from"./useEvent-D91BmmQi.js";import{E as de,Lr as ne,Qn as se,Rr as re,St as Q,Vr as ce,Zn as he,_ as me,fr as pe,pa as ke,zr as fe}from"./cells-DxL32Atg.js";import{t as ue}from"./compiler-runtime-B3qBwwSJ.js";import{c as ye,i as be,s as xe}from"./utils-C5VWChv9.js";import{O as je}from"./config-Bm5B9wGP.js";import{t as ve}from"./jsx-runtime-Blw4afVn.js";import{t as Ce}from"./label-DUD3SZnk.js";import{h as we,i as ge}from"./download-Tklnz6pn.js";import{r as ze}from"./requests-9-v2bhoi.js";import{t as f}from"./createLucideIcon-w-Qo9n0R.js";import{n as V,r as F}from"./x-C-Eq0ag8.js";import{t as Ie}from"./chevron-right-BS_NcSch.js";import{t as G}from"./circle-plus-BluydVNx.js";import{t as We}from"./code-xml-aSiY8T7C.js";import{t as Me}from"./eye-off-BOZA7gbn.js";import{t as _e}from"./image-5XI2VU-q.js";import{t as Se}from"./link-CHdiBDr5.js";import{i as Ae,t as Re}from"./useDeleteCell-DH0weyin.js";import{t as Te}from"./sparkles-DUCpRFlS.js";import{t as De}from"./trash-2-72W0TZ3L.js";import{t as Ee}from"./use-toast-BwJoaaDM.js";import{n as Le}from"./copy-B-LLR1Yy.js";import{i as Ne}from"./useRunCells-8xYRh7wH.js";import{a as Oe,c as qe,n as Be}from"./dialog-88bLE398.js";import{n as He}from"./ImperativeModal-Ci0icDPt.js";import{n as Pe}from"./state-DDimGh2o.js";import{r as K}from"./html-to-image-ChNWEUlR.js";import{n as Ue,t as Qe}from"./icons-NFYKylj6.js";import{n as Z}from"./name-cell-input-DoxL2EXI.js";import{t as $}from"./multi-icon-DVD1luis.js";import{t as Ve}from"./useSplitCell-BvgvIZaz.js";var J=f("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),X=f("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Y=f("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]),Fe=f("text-cursor-input",[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]]),ee=f("zap-off",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),le=f("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function Ge(a){let e=new URL(window.location.href);return e.hash=`scrollTo=${encodeURIComponent(a)}`,e.toString()}function Ke(a){var c;let e=(c=a.match(/scrollTo=([^&]+)/))==null?void 0:c[1];return e?decodeURIComponent(e.split("&")[0]):null}function te(a){return a==="_"?!1:!!(a&&a.trim().length>0)}var Ze=ue(),l=ae(ve(),1);function $e(a){let e=(0,Ze.c)(47),{cell:c,closePopover:u}=a,{createNewCell:m,updateCellConfig:s,updateCellName:x,moveCell:p,sendToTop:W,sendToBottom:M,addColumnBreakpoint:_,clearCellOutput:S,markUntouched:A}=de(),R=Ve(),T=Ne(c==null?void 0:c.cellId),D=!b(me),E=Re(),{openModal:j}=He(),L=ie(Pe),N=b(be),v=b(ye),oe=b(je),y=b(xe),{saveCellConfig:r}=ze();if(!c||oe){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0],t}let{cellId:o,config:i,getEditorView:n,name:h,hasOutput:C,hasConsoleOutput:O,status:q}=c,w;e[1]!==o||e[2]!==i.disabled||e[3]!==r||e[4]!==s?(w=async()=>{let t={disabled:!i.disabled};await r({configs:{[o]:t}}),s({cellId:o,config:t})},e[1]=o,e[2]=i.disabled,e[3]=r,e[4]=s,e[5]=w):w=e[5];let B=w,g;e[6]!==o||e[7]!==i.hide_code||e[8]!==n||e[9]!==r||e[10]!==s?(g=async()=>{let t={hide_code:!i.hide_code};await r({configs:{[o]:t}}),s({cellId:o,config:t});let U=n();U&&(t.hide_code?U.contentDOM.blur():U.focus())},e[6]=o,e[7]=i.hide_code,e[8]=n,e[9]=r,e[10]=s,e[11]=g):g=e[11];let H=g,d=o===ke,z;e[12]===Symbol.for("react.memo_cache_sentinel")?(z=(0,l.jsx)(Ae,{size:13,strokeWidth:1.5}),e[12]=z):z=e[12];let P=q==="running"||q==="queued"||q==="disabled-transitively"||i.disabled,k;e[13]===T?k=e[14]:(k=()=>T(),e[13]=T,e[14]=k);let I;return e[15]!==_||e[16]!==N||e[17]!==y||e[18]!==v||e[19]!==D||e[20]!==o||e[21]!==S||e[22]!==u||e[23]!==i.disabled||e[24]!==i.hide_code||e[25]!==m||e[26]!==E||e[27]!==n||e[28]!==O||e[29]!==C||e[30]!==d||e[31]!==A||e[32]!==p||e[33]!==h||e[34]!==j||e[35]!==r||e[36]!==M||e[37]!==W||e[38]!==L||e[39]!==R||e[40]!==P||e[41]!==k||e[42]!==B||e[43]!==H||e[44]!==s||e[45]!==x?(I=[[{icon:z,label:"Run cell",hotkey:"cell.run",hidden:P,redundant:!0,handle:k},{icon:(0,l.jsx)(Te,{size:13,strokeWidth:1.5}),label:"Refactor with AI",hidden:!N,handle:()=>{L(t=>(t==null?void 0:t.cellId)===o?null:{cellId:o})},hotkey:"cell.aiCompletion"},{icon:(0,l.jsx)(Y,{size:13,strokeWidth:1.5}),label:"Split",hotkey:"cell.splitCell",handle:()=>R({cellId:o})},{icon:(0,l.jsx)(We,{size:13,strokeWidth:1.5}),label:"Format",hotkey:"cell.format",handle:()=>{let t=n();t&&pe({[o]:t})}},{icon:i.hide_code?(0,l.jsx)(ne,{size:13,strokeWidth:1.5}):(0,l.jsx)(Me,{size:13,strokeWidth:1.5}),label:i.hide_code?"Show code":"Hide code",handle:H,hotkey:"cell.hideCode"},{icon:i.disabled?(0,l.jsx)(ee,{size:13,strokeWidth:1.5}):(0,l.jsx)(le,{size:13,strokeWidth:1.5}),label:i.disabled?"Enable execution":"Disable execution",handle:B,hidden:d}],[{icon:(0,l.jsx)(Qe,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:async()=>{let t=n();t&&(K({autoInstantiate:v,createNewCell:m}),Q(t,{language:"markdown",keepCodeAsIs:!1}),i.hide_code||(await r({configs:{[o]:{hide_code:!0}}}),s({cellId:o,config:{hide_code:!0}}),A({cellId:o})))},hidden:d},he(n())==="sql"?{icon:(0,l.jsx)(Ue,{}),label:"View as Python",hotkey:"cell.viewAsSQL",handle:()=>{let t=n();t&&se(t,"python",{force:!0})},hidden:d}:{icon:(0,l.jsx)(re,{size:13,strokeWidth:1.5}),label:"Convert to SQL",hotkey:"cell.viewAsSQL",handle:()=>{let t=n();t&&(K({autoInstantiate:v,createNewCell:m}),Q(t,{language:"sql",keepCodeAsIs:!1}))},hidden:d}],[{icon:(0,l.jsxs)($,{children:[(0,l.jsx)(G,{size:13,strokeWidth:1.5}),(0,l.jsx)(V,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>m({cellId:o,before:!0}),hidden:d,redundant:!0},{icon:(0,l.jsxs)($,{children:[(0,l.jsx)(G,{size:13,strokeWidth:1.5}),(0,l.jsx)(F,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>m({cellId:o,before:!1}),redundant:!0},{icon:(0,l.jsx)(V,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>p({cellId:o,before:!0}),hidden:d},{icon:(0,l.jsx)(F,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>p({cellId:o,before:!1}),hidden:d},{icon:(0,l.jsx)(we,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>p({cellId:o,direction:"left"}),hidden:y!=="columns"||d},{icon:(0,l.jsx)(Ie,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>p({cellId:o,direction:"right"}),hidden:y!=="columns"||d},{icon:(0,l.jsx)(X,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>W({cellId:o,scroll:!1}),hidden:d},{icon:(0,l.jsx)(J,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>M({cellId:o,scroll:!1}),hidden:d},{icon:(0,l.jsx)(fe,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",handle:()=>_({cellId:o}),hidden:y!=="columns"||d}],[{icon:(0,l.jsx)(_e,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!C,handle:()=>ge(o,"result")},{icon:(0,l.jsx)(ce,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(C||O),handle:()=>{S({cellId:o})}}],[{icon:(0,l.jsx)(Fe,{size:13,strokeWidth:1.5}),label:"Name",disableClick:!0,handle:el,handleHeadless:()=>{j((0,l.jsxs)(Be,{children:[(0,l.jsx)(Oe,{children:(0,l.jsx)(qe,{children:"Rename cell"})}),(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)(Ce,{htmlFor:"cell-name",children:"Cell name"}),(0,l.jsx)(Z,{placeholder:"cell name",value:h,onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),t.stopPropagation(),j(null))},onChange:t=>x({cellId:o,name:t})})]})]}))},rightElement:(0,l.jsx)(Z,{placeholder:"cell name",value:h,onChange:t=>x({cellId:o,name:t}),onEnterKey:()=>u==null?void 0:u()}),hidden:d},{icon:(0,l.jsx)(Se,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!te(h),tooltip:te(h)?void 0:"Only named cells can be linked to",handle:async()=>{await Le(Ge(h)),Ee({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!D,variant:"danger",icon:(0,l.jsx)(De,{size:13,strokeWidth:1.5}),handle:()=>{E({cellId:o})}}]].map(Xe).filter(Je),e[15]=_,e[16]=N,e[17]=y,e[18]=v,e[19]=D,e[20]=o,e[21]=S,e[22]=u,e[23]=i.disabled,e[24]=i.hide_code,e[25]=m,e[26]=E,e[27]=n,e[28]=O,e[29]=C,e[30]=d,e[31]=A,e[32]=p,e[33]=h,e[34]=j,e[35]=r,e[36]=M,e[37]=W,e[38]=L,e[39]=R,e[40]=P,e[41]=k,e[42]=B,e[43]=H,e[44]=s,e[45]=x,e[46]=I):I=e[46],I}function Je(a){return a.length>0}function Xe(a){return a.filter(Ye)}function Ye(a){return!a.hidden}function el(a){a==null||a.stopPropagation(),a==null||a.preventDefault()}export{Y as a,ee as i,Ke as n,X as o,le as r,J as s,$e as t};
@@ -1 +1 @@
1
- import{s as V}from"./chunk-LvLJmgfZ.js";import{d as X,l as Y,n as q,p as Z,u as $}from"./useEvent-D91BmmQi.js";import{t as ee}from"./react-Bj1aDYRI.js";import{Dt as te,K as re}from"./cells-DxL32Atg.js";import{t as z}from"./compiler-runtime-B3qBwwSJ.js";import{t as le}from"./cn-DYvqRARy.js";import{t as ne}from"./jsx-runtime-Blw4afVn.js";import{d as se}from"./alert-dialog-DMh8_LWc.js";import{i as B,r as ae,t as G}from"./popover-DHbixh3D.js";import{a as oe,n as ie,o as ce,t as me}from"./tooltip-BcgbFR7q.js";import{t as de}from"./useCellActionButton-CrFbi8en.js";import{n as he}from"./focus-BBiJct2G.js";import{a as fe,c as pe,f as ue,i as xe,o as je,r as be,t as ve}from"./command-CPFHYoYk.js";import{a as ye,i as Ne}from"./renderShortcut-DnqsU4zj.js";var J=z(),h=V(ee(),1),t=V(ne(),1);const L=h.memo(h.forwardRef((r,n)=>{let e=(0,J.c)(39),{children:s,showTooltip:c,...m}=r,f=c===void 0?!0:c,[d,k]=(0,h.useState)(!1),N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N=()=>k(!1),e[0]=N):N=e[0];let W=N,I=(0,h.useRef)(null),M=de({cell:m,closePopover:W}).map(we).filter(_e),T=se(),g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{re(()=>{I.current&&I.current.scrollIntoView({behavior:"auto",block:"nearest"})})},e[1]=g):g=e[1];let P=q(g),w;e[2]===P?w=e[3]:(w=a=>{k(o=>{let l=typeof a=="function"?a(o):a;return l&&P(),l})},e[2]=P,e[3]=w);let i=q(w),_;e[4]===i?_=e[5]:(_=()=>({toggle:()=>i(Ce)}),e[4]=i,e[5]=_),(0,h.useImperativeHandle)(n,_);let A=ae,E=ve,H=te(m.cellId),p;e[6]===H?p=e[7]:(p=(0,t.jsx)(fe,{placeholder:"Search actions...",className:"h-6 m-1",...H}),e[6]=H,e[7]=p);let O=ue,u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)(be,{children:"No results"}),e[8]=u):u=e[8];let R=M.map((a,o)=>(0,t.jsxs)(h.Fragment,{children:[(0,t.jsx)(xe,{children:a.map(l=>{let K=(0,t.jsxs)("div",{className:"flex items-center flex-1",children:[l.icon&&(0,t.jsx)("div",{className:"mr-2 w-5 text-muted-foreground",children:l.icon}),(0,t.jsx)("div",{className:"flex-1",children:l.label}),(0,t.jsxs)("div",{className:"shrink-0 text-sm",children:[l.hotkey&&Ne(l.hotkey),l.rightElement]})]});return l.tooltip&&(K=(0,t.jsx)(me,{content:l.tooltip,delayDuration:100,children:K})),(0,t.jsx)(je,{className:le(l.disabled&&"opacity-50!"),onSelect:()=>{l.disableClick||l.disabled||(l.handle(),k(!1))},variant:l.variant,children:K},l.label)})},o),o<M.length-1&&(0,t.jsx)(pe,{})]},o)),x;e[9]!==O||e[10]!==u||e[11]!==R?(x=(0,t.jsxs)(O,{children:[u,R]}),e[9]=O,e[10]=u,e[11]=R,e[12]=x):x=e[12];let j;e[13]!==E||e[14]!==x||e[15]!==p?(j=(0,t.jsxs)(E,{children:[p,x]}),e[13]=E,e[14]=x,e[15]=p,e[16]=j):j=e[16];let C;e[17]!==A||e[18]!==T||e[19]!==j?(C=(0,t.jsx)(A,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...T,children:j}),e[17]=A,e[18]=T,e[19]=j,e[20]=C):C=e[20];let b=C;if(!f){let a;e[21]===s?a=e[22]:(a=(0,t.jsx)(B,{asChild:!0,children:s}),e[21]=s,e[22]=a);let o;return e[23]!==b||e[24]!==i||e[25]!==d||e[26]!==a?(o=(0,t.jsxs)(G,{open:d,onOpenChange:i,children:[a,b]}),e[23]=b,e[24]=i,e[25]=d,e[26]=a,e[27]=o):o=e[27],o}let S;e[28]===Symbol.for("react.memo_cache_sentinel")?(S=(0,t.jsx)(ie,{tabIndex:-1,children:ye("cell.cellActions")}),e[28]=S):S=e[28];let F=!d&&S,v;e[29]===s?v=e[30]:(v=(0,t.jsx)(ce,{ref:I,children:(0,t.jsx)(B,{className:"flex",children:s})}),e[29]=s,e[30]=v);let y;e[31]!==F||e[32]!==v?(y=(0,t.jsxs)(oe,{delayDuration:200,disableHoverableContent:!0,children:[F,v]}),e[31]=F,e[32]=v,e[33]=y):y=e[33];let D;return e[34]!==b||e[35]!==i||e[36]!==d||e[37]!==y?(D=(0,t.jsxs)(G,{open:d,onOpenChange:i,children:[y,b]}),e[34]=b,e[35]=i,e[36]=d,e[37]=y,e[38]=D):D=e[38],D})),Q=h.memo(r=>{let n=(0,J.c)(5),{children:e,cellId:s}=r,c;n[0]===s?c=n[1]:(c=he(s),n[0]=s,n[1]=c);let m=$(c);if(!m)return null;let f;return n[2]!==e||n[3]!==m?(f=(0,t.jsx)(L,{showTooltip:!1,...m,children:e}),n[2]=e,n[3]=m,n[4]=f):f=n[4],f});Q.displayName="ConnectionCellActionsDropdown";function ge(r){return!r.redundant}function we(r){return r.filter(ge)}function _e(r){return r.length>0}function Ce(r){return!r}var Se=z();const U=Z("minimap");function De(){let r=(0,Se.c)(3),[n,e]=Y(U),s;return r[0]!==n||r[1]!==e?(s={dependencyPanelTab:n,setDependencyPanelTab:e},r[0]=n,r[1]=e,r[2]=s):s=r[2],s}function ke(){return X(U)}export{Q as i,ke as n,L as r,De as t};
1
+ import{s as V}from"./chunk-LvLJmgfZ.js";import{d as X,l as Y,n as q,p as Z,u as $}from"./useEvent-D91BmmQi.js";import{t as ee}from"./react-Bj1aDYRI.js";import{Dt as te,K as re}from"./cells-DxL32Atg.js";import{t as z}from"./compiler-runtime-B3qBwwSJ.js";import{t as le}from"./cn-DYvqRARy.js";import{t as ne}from"./jsx-runtime-Blw4afVn.js";import{d as se}from"./alert-dialog-DMh8_LWc.js";import{i as B,r as ae,t as G}from"./popover-DHbixh3D.js";import{a as oe,n as ie,o as ce,t as me}from"./tooltip-BcgbFR7q.js";import{t as de}from"./useCellActionButton-n2-2xb-5.js";import{n as he}from"./focus-BBiJct2G.js";import{a as fe,c as pe,f as ue,i as xe,o as je,r as be,t as ve}from"./command-CPFHYoYk.js";import{a as ye,i as Ne}from"./renderShortcut-DnqsU4zj.js";var J=z(),h=V(ee(),1),t=V(ne(),1);const L=h.memo(h.forwardRef((r,n)=>{let e=(0,J.c)(39),{children:s,showTooltip:c,...m}=r,f=c===void 0?!0:c,[d,k]=(0,h.useState)(!1),N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N=()=>k(!1),e[0]=N):N=e[0];let W=N,I=(0,h.useRef)(null),M=de({cell:m,closePopover:W}).map(we).filter(_e),T=se(),g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{re(()=>{I.current&&I.current.scrollIntoView({behavior:"auto",block:"nearest"})})},e[1]=g):g=e[1];let P=q(g),w;e[2]===P?w=e[3]:(w=a=>{k(o=>{let l=typeof a=="function"?a(o):a;return l&&P(),l})},e[2]=P,e[3]=w);let i=q(w),_;e[4]===i?_=e[5]:(_=()=>({toggle:()=>i(Ce)}),e[4]=i,e[5]=_),(0,h.useImperativeHandle)(n,_);let A=ae,E=ve,H=te(m.cellId),p;e[6]===H?p=e[7]:(p=(0,t.jsx)(fe,{placeholder:"Search actions...",className:"h-6 m-1",...H}),e[6]=H,e[7]=p);let O=ue,u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)(be,{children:"No results"}),e[8]=u):u=e[8];let R=M.map((a,o)=>(0,t.jsxs)(h.Fragment,{children:[(0,t.jsx)(xe,{children:a.map(l=>{let K=(0,t.jsxs)("div",{className:"flex items-center flex-1",children:[l.icon&&(0,t.jsx)("div",{className:"mr-2 w-5 text-muted-foreground",children:l.icon}),(0,t.jsx)("div",{className:"flex-1",children:l.label}),(0,t.jsxs)("div",{className:"shrink-0 text-sm",children:[l.hotkey&&Ne(l.hotkey),l.rightElement]})]});return l.tooltip&&(K=(0,t.jsx)(me,{content:l.tooltip,delayDuration:100,children:K})),(0,t.jsx)(je,{className:le(l.disabled&&"opacity-50!"),onSelect:()=>{l.disableClick||l.disabled||(l.handle(),k(!1))},variant:l.variant,children:K},l.label)})},o),o<M.length-1&&(0,t.jsx)(pe,{})]},o)),x;e[9]!==O||e[10]!==u||e[11]!==R?(x=(0,t.jsxs)(O,{children:[u,R]}),e[9]=O,e[10]=u,e[11]=R,e[12]=x):x=e[12];let j;e[13]!==E||e[14]!==x||e[15]!==p?(j=(0,t.jsxs)(E,{children:[p,x]}),e[13]=E,e[14]=x,e[15]=p,e[16]=j):j=e[16];let C;e[17]!==A||e[18]!==T||e[19]!==j?(C=(0,t.jsx)(A,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...T,children:j}),e[17]=A,e[18]=T,e[19]=j,e[20]=C):C=e[20];let b=C;if(!f){let a;e[21]===s?a=e[22]:(a=(0,t.jsx)(B,{asChild:!0,children:s}),e[21]=s,e[22]=a);let o;return e[23]!==b||e[24]!==i||e[25]!==d||e[26]!==a?(o=(0,t.jsxs)(G,{open:d,onOpenChange:i,children:[a,b]}),e[23]=b,e[24]=i,e[25]=d,e[26]=a,e[27]=o):o=e[27],o}let S;e[28]===Symbol.for("react.memo_cache_sentinel")?(S=(0,t.jsx)(ie,{tabIndex:-1,children:ye("cell.cellActions")}),e[28]=S):S=e[28];let F=!d&&S,v;e[29]===s?v=e[30]:(v=(0,t.jsx)(ce,{ref:I,children:(0,t.jsx)(B,{className:"flex",children:s})}),e[29]=s,e[30]=v);let y;e[31]!==F||e[32]!==v?(y=(0,t.jsxs)(oe,{delayDuration:200,disableHoverableContent:!0,children:[F,v]}),e[31]=F,e[32]=v,e[33]=y):y=e[33];let D;return e[34]!==b||e[35]!==i||e[36]!==d||e[37]!==y?(D=(0,t.jsxs)(G,{open:d,onOpenChange:i,children:[y,b]}),e[34]=b,e[35]=i,e[36]=d,e[37]=y,e[38]=D):D=e[38],D})),Q=h.memo(r=>{let n=(0,J.c)(5),{children:e,cellId:s}=r,c;n[0]===s?c=n[1]:(c=he(s),n[0]=s,n[1]=c);let m=$(c);if(!m)return null;let f;return n[2]!==e||n[3]!==m?(f=(0,t.jsx)(L,{showTooltip:!1,...m,children:e}),n[2]=e,n[3]=m,n[4]=f):f=n[4],f});Q.displayName="ConnectionCellActionsDropdown";function ge(r){return!r.redundant}function we(r){return r.filter(ge)}function _e(r){return r.length>0}function Ce(r){return!r}var Se=z();const U=Z("minimap");function De(){let r=(0,Se.c)(3),[n,e]=Y(U),s;return r[0]!==n||r[1]!==e?(s={dependencyPanelTab:n,setDependencyPanelTab:e},r[0]=n,r[1]=e,r[2]=s):s=r[2],s}function ke(){return X(U)}export{Q as i,ke as n,L as r,De as t};
@@ -1,4 +1,4 @@
1
- import{s as Ge}from"./chunk-LvLJmgfZ.js";import{d as le,i as ua,l as Oe,p as ma,u as ee}from"./useEvent-D91BmmQi.js";import{t as pa}from"./react-Bj1aDYRI.js";import{$i as ha,$n as fa,Bn as ba,E as Ke,Gn as Je,Hn as xa,Hr as Ye,In as ya,Ir as Xe,Ji as ka,Jt as ga,Kr as va,Lr as Qe,Nt as Ze,Rr as wa,T as ja,Vn as Na,Vr as Ca,Wn as Sa,bi as za,da as _e,g as Ma,m as et,ra as tt,t as Oa,y as _a}from"./cells-DxL32Atg.js";import{P as at,T as pe,b as we}from"./zod-CIOjj3iA.js";import{t as R}from"./compiler-runtime-B3qBwwSJ.js";import{n as Fa,r as Ia,x as La}from"./ai-model-dropdown-BmcXWjub.js";import{g as de,n as Pa}from"./useEventListener-B_wSLgFR.js";import{t as st}from"./objects-BlG0ZrO0.js";import{C as Wa,r as Aa}from"./utils-C5VWChv9.js";import{n as K,t as nt}from"./constants-CDyU_g2F.js";import{A as Da,M as rt,N as he,O as Ea,T as ot,k as qa,v as it}from"./config-Bm5B9wGP.js";import{t as Ra}from"./switch-8FxRs-OU.js";import{c as Ta}from"./readonly-python-code-C4GeGU7O.js";import{t as fe}from"./cn-DYvqRARy.js";import{t as $a}from"./jsx-runtime-Blw4afVn.js";import{o as Ha}from"./alert-dialog-DMh8_LWc.js";import{a as Va,c as Ba,o as Ua,s as Ga}from"./popover-DHbixh3D.js";import{a as Ka,c as lt,i as dt,n as ct,r as Ja,s as ut,t as mt}from"./select-Clmc8Hw2.js";import{$ as Ya,Lt as pt}from"./JsonOutput-CWfu9qbN.js";import{a as Xa,c as Qa,o as Za,p as ce,t as es}from"./download-Tklnz6pn.js";import{n as ts,t as as}from"./radio-group-ByLzIKjm.js";import{t as ss}from"./tooltip-BcgbFR7q.js";import{n as ns,r as rs,t as oe}from"./button-BB1AV4Rb.js";import{i as os,r as ht,t as Fe}from"./strings-DMKwTex-.js";import{r as ne}from"./requests-9-v2bhoi.js";import{t as A}from"./createLucideIcon-w-Qo9n0R.js";import{F as is,I as ls,L as ft,P as bt,a as xt,i as yt,u as ds}from"./layout-D7Yzn4XY.js";import{t as kt}from"./check-rzLRd0j9.js";import{r as cs}from"./useCellActionButton-CrFbi8en.js";import{t as Ie}from"./code-B2aKtXoe.js";import{t as us}from"./copy-3iHFdt22.js";import{t as gt}from"./eye-off-BOZA7gbn.js";import{t as vt}from"./external-link-BOlXZUla.js";import{t as be}from"./file-CJH9JNGH.js";import{t as wt}from"./globe-Dwo3iXzC.js";import{n as ms,r as ps,t as hs}from"./youtube-OwaksuQt.js";import{n as fs}from"./components-Bm1d4vm9.js";import{i as bs,n as xs,r as ys}from"./markdown-export-CNu5ZTPR.js";import{t as jt}from"./image-5XI2VU-q.js";import{t as ks}from"./link-CHdiBDr5.js";import{t as Le}from"./spinner-D-V4psAa.js";import{r as gs}from"./input-_AaMXWgD.js";import{t as vs}from"./settings-D_PiwXwo.js";import{t as ws}from"./sparkles-DUCpRFlS.js";import{g as js}from"./form-BIUQB1NI.js";import{t as Ns}from"./square-DFICx2Qv.js";import{t as Nt}from"./triangle-alert-BL4YVsPy.js";import{t as ie}from"./use-toast-BwJoaaDM.js";import{n as Pe,t as Cs}from"./paths-BKO-pHK6.js";import{o as Ss}from"./session-BtBr2zr3.js";import{n as je}from"./copy-B-LLR1Yy.js";import{t as We}from"./copy-icon-DWG8Y-xW.js";import{r as zs}from"./useRunCells-8xYRh7wH.js";import{a as Ae,c as De,i as Ms,n as Ee,r as qe}from"./dialog-88bLE398.js";import{n as Ne}from"./ImperativeModal-Ci0icDPt.js";import{r as Os,t as Ct}from"./share-DSOv_SvY.js";import{n as St,t as zt}from"./alert-jlwhGxSb.js";import{a as Mt}from"./cell-link-uPmFMRTh.js";import{n as Re}from"./useAsyncData-Bg5iAViP.js";import{t as _s}from"./icons-NFYKylj6.js";import{i as Fs,n as Ot}from"./error-entries-BvUR_22-.js";import{n as _t,t as Is}from"./pair-with-agent-modal-1b5Eh8Xo.js";import{n as Ft}from"./add-connection-dialog-D2WiF1f8.js";import{t as Ls}from"./github-A_zUd4Uj.js";import{n as It}from"./marimo-icons-yD_pAOm9.js";import{t as Ps}from"./links-DBc28bsl.js";import{i as Ws,n as As,t as Te}from"./skeleton-DhhF_mJP.js";import{t as Lt}from"./types-Bn-E0Dh-.js";var Ds=A("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Es=A("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Pt=A("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),Wt=A("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),At=A("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),qs=A("fast-forward",[["path",{d:"M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z",key:"b19h5q"}],["path",{d:"M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z",key:"h7h5ge"}]]),Rs=A("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]),Ts=A("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),Dt=A("message-circle-question-mark",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Et=A("notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]),$s=A("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),qt=A("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),Hs=A("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),Vs=A("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Rt=A("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),Bs=R(),D=Ge(pa(),1);function $e(t,e){let s=(0,Bs.c)(11),n;s[0]===e?n=s[1]:(n=new ka(e),s[0]=e,s[1]=n);let o=n,i;s[2]!==t||s[3]!==o?(i=()=>o.get(t),s[2]=t,s[3]=o,s[4]=i):i=s[4];let[r,l]=(0,D.useState)(i),d;s[5]!==t||s[6]!==o?(d=m=>{l(m),o.set(t,m)},s[5]=t,s[6]=o,s[7]=d):d=s[7];let c=d,u;return s[8]!==c||s[9]!==r?(u=[r,c],s[8]=c,s[9]=r,s[10]=u):u=s[10],u}function Us(t,e){return{...t,Binaries:{...t.Binaries,Browser:e}}}function Gs(t,e,s,n){return{marimo:t,Locale:s||void 0,Binaries:{Browser:e},"Environment Collection Error":n}}function He(t,e){let s=Math.max(2,...Array.from(e.matchAll(/`+/g),o=>o[0].length)),n="`".repeat(s+1);return`${n}${t}
1
+ import{s as Ge}from"./chunk-LvLJmgfZ.js";import{d as le,i as ua,l as Oe,p as ma,u as ee}from"./useEvent-D91BmmQi.js";import{t as pa}from"./react-Bj1aDYRI.js";import{$i as ha,$n as fa,Bn as ba,E as Ke,Gn as Je,Hn as xa,Hr as Ye,In as ya,Ir as Xe,Ji as ka,Jt as ga,Kr as va,Lr as Qe,Nt as Ze,Rr as wa,T as ja,Vn as Na,Vr as Ca,Wn as Sa,bi as za,da as _e,g as Ma,m as et,ra as tt,t as Oa,y as _a}from"./cells-DxL32Atg.js";import{P as at,T as pe,b as we}from"./zod-CIOjj3iA.js";import{t as R}from"./compiler-runtime-B3qBwwSJ.js";import{n as Fa,r as Ia,x as La}from"./ai-model-dropdown-CIqhiHxf.js";import{g as de,n as Pa}from"./useEventListener-B_wSLgFR.js";import{t as st}from"./objects-BlG0ZrO0.js";import{C as Wa,r as Aa}from"./utils-C5VWChv9.js";import{n as K,t as nt}from"./constants-CDyU_g2F.js";import{A as Da,M as rt,N as he,O as Ea,T as ot,k as qa,v as it}from"./config-Bm5B9wGP.js";import{t as Ra}from"./switch-8FxRs-OU.js";import{c as Ta}from"./readonly-python-code-C4GeGU7O.js";import{t as fe}from"./cn-DYvqRARy.js";import{t as $a}from"./jsx-runtime-Blw4afVn.js";import{o as Ha}from"./alert-dialog-DMh8_LWc.js";import{a as Va,c as Ba,o as Ua,s as Ga}from"./popover-DHbixh3D.js";import{a as Ka,c as lt,i as dt,n as ct,r as Ja,s as ut,t as mt}from"./select-Clmc8Hw2.js";import{$ as Ya,Lt as pt}from"./JsonOutput-W3f6H6VQ.js";import{a as Xa,c as Qa,o as Za,p as ce,t as es}from"./download-Tklnz6pn.js";import{n as ts,t as as}from"./radio-group-ByLzIKjm.js";import{t as ss}from"./tooltip-BcgbFR7q.js";import{n as ns,r as rs,t as oe}from"./button-BB1AV4Rb.js";import{i as os,r as ht,t as Fe}from"./strings-DMKwTex-.js";import{r as ne}from"./requests-9-v2bhoi.js";import{t as A}from"./createLucideIcon-w-Qo9n0R.js";import{F as is,I as ls,L as ft,P as bt,a as xt,i as yt,u as ds}from"./layout-QkEddeXT.js";import{t as kt}from"./check-rzLRd0j9.js";import{r as cs}from"./useCellActionButton-n2-2xb-5.js";import{t as Ie}from"./code-B2aKtXoe.js";import{t as us}from"./copy-3iHFdt22.js";import{t as gt}from"./eye-off-BOZA7gbn.js";import{t as vt}from"./external-link-BOlXZUla.js";import{t as be}from"./file-CJH9JNGH.js";import{t as wt}from"./globe-Dwo3iXzC.js";import{n as ms,r as ps,t as hs}from"./youtube-OwaksuQt.js";import{n as fs}from"./components-Bm1d4vm9.js";import{i as bs,n as xs,r as ys}from"./markdown-export-CNu5ZTPR.js";import{t as jt}from"./image-5XI2VU-q.js";import{t as ks}from"./link-CHdiBDr5.js";import{t as Le}from"./spinner-D-V4psAa.js";import{r as gs}from"./input-_AaMXWgD.js";import{t as vs}from"./settings-D_PiwXwo.js";import{t as ws}from"./sparkles-DUCpRFlS.js";import{g as js}from"./form-BIUQB1NI.js";import{t as Ns}from"./square-DFICx2Qv.js";import{t as Nt}from"./triangle-alert-BL4YVsPy.js";import{t as ie}from"./use-toast-BwJoaaDM.js";import{n as Pe,t as Cs}from"./paths-BKO-pHK6.js";import{o as Ss}from"./session-BtBr2zr3.js";import{n as je}from"./copy-B-LLR1Yy.js";import{t as We}from"./copy-icon-DWG8Y-xW.js";import{r as zs}from"./useRunCells-8xYRh7wH.js";import{a as Ae,c as De,i as Ms,n as Ee,r as qe}from"./dialog-88bLE398.js";import{n as Ne}from"./ImperativeModal-Ci0icDPt.js";import{r as Os,t as Ct}from"./share-DSOv_SvY.js";import{n as St,t as zt}from"./alert-jlwhGxSb.js";import{a as Mt}from"./cell-link-uPmFMRTh.js";import{n as Re}from"./useAsyncData-Bg5iAViP.js";import{t as _s}from"./icons-NFYKylj6.js";import{i as Fs,n as Ot}from"./error-entries-BvUR_22-.js";import{n as _t,t as Is}from"./pair-with-agent-modal-1b5Eh8Xo.js";import{n as Ft}from"./add-connection-dialog-Dld_PDdZ.js";import{t as Ls}from"./github-A_zUd4Uj.js";import{n as It}from"./marimo-icons-yD_pAOm9.js";import{t as Ps}from"./links-DBc28bsl.js";import{i as Ws,n as As,t as Te}from"./skeleton-CJymG2v3.js";import{t as Lt}from"./types-Bn-E0Dh-.js";var Ds=A("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Es=A("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Pt=A("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),Wt=A("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),At=A("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),qs=A("fast-forward",[["path",{d:"M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z",key:"b19h5q"}],["path",{d:"M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z",key:"h7h5ge"}]]),Rs=A("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]),Ts=A("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),Dt=A("message-circle-question-mark",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Et=A("notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]),$s=A("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),qt=A("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),Hs=A("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),Vs=A("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Rt=A("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),Bs=R(),D=Ge(pa(),1);function $e(t,e){let s=(0,Bs.c)(11),n;s[0]===e?n=s[1]:(n=new ka(e),s[0]=e,s[1]=n);let o=n,i;s[2]!==t||s[3]!==o?(i=()=>o.get(t),s[2]=t,s[3]=o,s[4]=i):i=s[4];let[r,l]=(0,D.useState)(i),d;s[5]!==t||s[6]!==o?(d=m=>{l(m),o.set(t,m)},s[5]=t,s[6]=o,s[7]=d):d=s[7];let c=d,u;return s[8]!==c||s[9]!==r?(u=[r,c],s[8]=c,s[9]=r,s[10]=u):u=s[10],u}function Us(t,e){return{...t,Binaries:{...t.Binaries,Browser:e}}}function Gs(t,e,s,n){return{marimo:t,Locale:s||void 0,Binaries:{Browser:e},"Environment Collection Error":n}}function He(t,e){let s=Math.max(2,...Array.from(e.matchAll(/`+/g),o=>o[0].length)),n="`".repeat(s+1);return`${n}${t}
2
2
  ${e}
3
3
  ${n}`}function Ks(t,e){let s=t.includes("?")?"&":"?",n=[],o=t,i=0;for(let[r,l]of Object.entries(e)){if(l.length===0)continue;let d=`${r}=${encodeURIComponent(l)}`,c=`${o}${i===0?s:"&"}${d}`;if(c.length>6e3){n.push(r);continue}o=c,i+=1}return{url:o,omitted:n}}function Ve(t,e){return["<details>",`<summary>${Fe.htmlEscape(t)??""}</summary>`,"",e,"","</details>"].join(`
4
4
  `)}function Js(t){return Ve("Environment",He("json",JSON.stringify(t,null,2)))}function Tt(t){return Ve("Errors",He("text",t.map(Ot).join(`
package/dist/index.html CHANGED
@@ -66,7 +66,7 @@
66
66
  <marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
67
67
  <!-- /TODO -->
68
68
  <title>{{ title }}</title>
69
- <script type="module" crossorigin src="./assets/index-BPwg3EAk.js"></script>
69
+ <script type="module" crossorigin src="./assets/index-C_pCjmat.js"></script>
70
70
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-TXkS1QI3.js">
71
71
  <link rel="modulepreload" crossorigin href="./assets/objects-BlG0ZrO0.js">
72
72
  <link rel="modulepreload" crossorigin href="./assets/chunk-LvLJmgfZ.js">
@@ -148,7 +148,7 @@
148
148
  <link rel="modulepreload" crossorigin href="./assets/input-_AaMXWgD.js">
149
149
  <link rel="modulepreload" crossorigin href="./assets/ImperativeModal-Ci0icDPt.js">
150
150
  <link rel="modulepreload" crossorigin href="./assets/cell-link-uPmFMRTh.js">
151
- <link rel="modulepreload" crossorigin href="./assets/config-Cbkt6Rb1.js">
151
+ <link rel="modulepreload" crossorigin href="./assets/config-BVfo0E1-.js">
152
152
  <link rel="modulepreload" crossorigin href="./assets/alert-jlwhGxSb.js">
153
153
  <link rel="modulepreload" crossorigin href="./assets/chevron-right-BS_NcSch.js">
154
154
  <link rel="modulepreload" crossorigin href="./assets/dropdown-menu-BGBlPKNz.js">
@@ -158,12 +158,12 @@
158
158
  <link rel="modulepreload" crossorigin href="./assets/copy-3iHFdt22.js">
159
159
  <link rel="modulepreload" crossorigin href="./assets/copy-icon-DWG8Y-xW.js">
160
160
  <link rel="modulepreload" crossorigin href="./assets/RenderHTML-CQC8I348.js">
161
- <link rel="modulepreload" crossorigin href="./assets/datasource-DfQvKiJ1.js">
162
- <link rel="modulepreload" crossorigin href="./assets/state-COqqdiUM.js">
161
+ <link rel="modulepreload" crossorigin href="./assets/datasource-D0eBPOXe.js">
162
+ <link rel="modulepreload" crossorigin href="./assets/state-DDimGh2o.js">
163
163
  <link rel="modulepreload" crossorigin href="./assets/hat-glasses-BttHlyvs.js">
164
164
  <link rel="modulepreload" crossorigin href="./assets/package-Bxz_8e44.js">
165
165
  <link rel="modulepreload" crossorigin href="./assets/sparkles-DUCpRFlS.js">
166
- <link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-B9QSRg6T.js">
166
+ <link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-COZo8cfk.js">
167
167
  <link rel="modulepreload" crossorigin href="./assets/ErrorBoundary-BfMsWVQU.js">
168
168
  <link rel="modulepreload" crossorigin href="./assets/eye-off-BOZA7gbn.js">
169
169
  <link rel="modulepreload" crossorigin href="./assets/refresh-cw-CYq4mK5a.js">
@@ -201,11 +201,11 @@
201
201
  <link rel="modulepreload" crossorigin href="./assets/plus-AgXtozBz.js">
202
202
  <link rel="modulepreload" crossorigin href="./assets/trash-2-72W0TZ3L.js">
203
203
  <link rel="modulepreload" crossorigin href="./assets/react-resizable-panels.browser.esm-Z-MD3n3J.js">
204
- <link rel="modulepreload" crossorigin href="./assets/JsonOutput-CWfu9qbN.js">
204
+ <link rel="modulepreload" crossorigin href="./assets/JsonOutput-W3f6H6VQ.js">
205
205
  <link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-iDRxid4h.js">
206
206
  <link rel="modulepreload" crossorigin href="./assets/square-function-DNNRTPQJ.js">
207
207
  <link rel="modulepreload" crossorigin href="./assets/spec-CdDzA5ef.js">
208
- <link rel="modulepreload" crossorigin href="./assets/column-preview-Dw1ASLnm.js">
208
+ <link rel="modulepreload" crossorigin href="./assets/column-preview-Dxxs9Brz.js">
209
209
  <link rel="modulepreload" crossorigin href="./assets/icons-NFYKylj6.js">
210
210
  <link rel="modulepreload" crossorigin href="./assets/radio-group-ByLzIKjm.js">
211
211
  <link rel="modulepreload" crossorigin href="./assets/floating-outline-BHmregl1.js">
@@ -228,7 +228,7 @@
228
228
  <link rel="modulepreload" crossorigin href="./assets/form-BIUQB1NI.js">
229
229
  <link rel="modulepreload" crossorigin href="./assets/textarea-BzWvGIrJ.js">
230
230
  <link rel="modulepreload" crossorigin href="./assets/refresh-ccw-sLaKP2vj.js">
231
- <link rel="modulepreload" crossorigin href="./assets/form-D-Bo8F9Q.js">
231
+ <link rel="modulepreload" crossorigin href="./assets/form-BGoLLcgk.js">
232
232
  <link rel="modulepreload" crossorigin href="./assets/renderShortcut-DnqsU4zj.js">
233
233
  <link rel="modulepreload" crossorigin href="./assets/useBoolean-sASJEpGA.js">
234
234
  <link rel="modulepreload" crossorigin href="./assets/markdown-export-CNu5ZTPR.js">
@@ -251,7 +251,7 @@
251
251
  <link rel="stylesheet" crossorigin href="./assets/cells-BE1kpmPF.css">
252
252
  <link rel="stylesheet" crossorigin href="./assets/markdown-renderer-DdDKmWlR.css">
253
253
  <link rel="stylesheet" crossorigin href="./assets/JsonOutput-BQtz7-np.css">
254
- <link rel="stylesheet" crossorigin href="./assets/index-Dttsymhw.css">
254
+ <link rel="stylesheet" crossorigin href="./assets/index-WoaGtlKd.css">
255
255
  </head>
256
256
  <body>
257
257
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.23.17-dev43",
3
+ "version": "0.23.17-dev45",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -9,7 +9,7 @@ import {
9
9
  CircleHelpIcon,
10
10
  } from "lucide-react";
11
11
  import React from "react";
12
- import { type SupportedRole, useModelChange } from "@/core/ai/config";
12
+ import { type SupportedRole, useAIConfigActions } from "@/core/ai/config";
13
13
  import {
14
14
  AiModelId,
15
15
  isKnownAIProvider,
@@ -64,7 +64,7 @@ export const AIModelDropdown = ({
64
64
 
65
65
  const ai = useAtomValue(aiAtom);
66
66
  const completion = useAtomValue(completionAtom);
67
- const { saveModelChange } = useModelChange();
67
+ const { saveModelChange } = useAIConfigActions();
68
68
  const { handleClick } = useOpenSettingsToTab();
69
69
 
70
70
  // Only include autocompleteModel if copilot is set to "custom"
@@ -0,0 +1,38 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import { fireEvent, render, screen } from "@testing-library/react";
4
+ import { createStore, Provider } from "jotai";
5
+ import { describe, expect, it } from "vitest";
6
+ import { chatOptionsAtom } from "@/core/ai/state";
7
+ import { CapabilitiesPopover } from "../capabilities-popover";
8
+
9
+ describe("CapabilitiesPopover", () => {
10
+ it("updates ephemeral chat options", () => {
11
+ const store = createStore();
12
+
13
+ render(
14
+ <Provider store={store}>
15
+ <CapabilitiesPopover />
16
+ </Provider>,
17
+ );
18
+
19
+ const trigger = screen.getByRole("button", { name: "Capabilities" });
20
+ expect(trigger).not.toHaveAttribute("data-active");
21
+
22
+ fireEvent.click(trigger);
23
+ const webSearch = screen.getByRole("switch", { name: "Web search" });
24
+ expect(webSearch).not.toBeChecked();
25
+
26
+ fireEvent.click(webSearch);
27
+
28
+ expect(webSearch).toBeChecked();
29
+ expect(trigger).toHaveAttribute("data-active", "true");
30
+ expect(trigger).toHaveClass("bg-primary/15", "text-primary", "ring-1");
31
+ expect(trigger).toHaveAttribute(
32
+ "title",
33
+ "Capabilities (web search enabled)",
34
+ );
35
+ expect(store.get(chatOptionsAtom)).toEqual({ webSearch: true });
36
+ expect(createStore().get(chatOptionsAtom)).toEqual({ webSearch: false });
37
+ });
38
+ });
@@ -0,0 +1,68 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import { useAtom } from "jotai";
4
+ import { SlidersHorizontalIcon } from "lucide-react";
5
+ import type React from "react";
6
+ import { Button } from "@/components/ui/button";
7
+ import {
8
+ Popover,
9
+ PopoverContent,
10
+ PopoverTrigger,
11
+ } from "@/components/ui/popover";
12
+ import { ExternalLink } from "@/components/ui/links";
13
+ import { Switch } from "@/components/ui/switch";
14
+ import { chatOptionsAtom } from "@/core/ai/state";
15
+ import { cn } from "@/utils/cn";
16
+
17
+ export const CapabilitiesPopover: React.FC = () => {
18
+ const [chatOptions, setChatOptions] = useAtom(chatOptionsAtom);
19
+ const webSearchOn = chatOptions.webSearch;
20
+
21
+ return (
22
+ <Popover>
23
+ <PopoverTrigger asChild={true}>
24
+ <Button
25
+ aria-label="Capabilities"
26
+ title={
27
+ webSearchOn ? "Capabilities (web search enabled)" : "Capabilities"
28
+ }
29
+ data-active={webSearchOn || undefined}
30
+ variant="text"
31
+ size="icon"
32
+ className={cn(
33
+ "h-6 w-6 shrink-0 bg-muted hover:bg-muted/30",
34
+ webSearchOn &&
35
+ "bg-primary/15 text-primary ring-1 ring-primary/30 opacity-100 hover:bg-primary/20",
36
+ )}
37
+ >
38
+ <SlidersHorizontalIcon className="h-3.5 w-3.5" />
39
+ </Button>
40
+ </PopoverTrigger>
41
+ <PopoverContent className="w-76 p-3" align="start" side="top">
42
+ <label
43
+ htmlFor="web-search-toggle"
44
+ className="flex items-start justify-between gap-3 cursor-pointer"
45
+ >
46
+ <div className="flex flex-col gap-0.5">
47
+ <span className="text-sm font-semibold">Web search</span>
48
+ <span className="text-xs text-muted-foreground">
49
+ Search the web when the model supports it.{" "}
50
+ <ExternalLink href="https://docs.marimo.io/guides/editor_features/tools#web-search-and-fetch">
51
+ Learn more
52
+ </ExternalLink>
53
+ </span>
54
+ </div>
55
+ <Switch
56
+ id="web-search-toggle"
57
+ aria-label="Web search"
58
+ size="sm"
59
+ checked={webSearchOn}
60
+ onCheckedChange={(webSearch) =>
61
+ setChatOptions((options) => ({ ...options, webSearch }))
62
+ }
63
+ />
64
+ </label>
65
+ </PopoverContent>
66
+ </Popover>
67
+ );
68
+ };