@marimo-team/frontend 0.23.10-dev37 → 0.23.10-dev41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ImperativeModal-CDPfRIx5.js → ImperativeModal-BW1dmntO.js} +1 -1
- package/dist/assets/{JsonOutput-BemZ015x.js → JsonOutput-DXzjDImT.js} +2 -2
- package/dist/assets/{MarimoErrorOutput-BQyzDTet.js → MarimoErrorOutput-DIx3jD4Z.js} +1 -1
- package/dist/assets/{RSPContexts-QoVyPvhN.js → RSPContexts-C3vBe8nL.js} +1 -1
- package/dist/assets/{RunButton-ACHY83op.js → RunButton-DLMH3KLF.js} +1 -1
- package/dist/assets/{add-cell-with-ai-C1gPcb_Q.js → add-cell-with-ai-CeYsuinK.js} +1 -1
- package/dist/assets/{add-connection-dialog-ZjsgZSOV.js → add-connection-dialog-CTTPp4DA.js} +1 -1
- package/dist/assets/{agent-panel-CEJFK1Jm.js → agent-panel-CQcFMptO.js} +1 -1
- package/dist/assets/{ai-model-dropdown-BhCUiMlB.js → ai-model-dropdown-CXNYq3J_.js} +1 -1
- package/dist/assets/{app-config-button-CJlCOCbq.js → app-config-button-BI_m1lzO.js} +1 -1
- package/dist/assets/{cache-panel-Cs308ish.js → cache-panel-C2wbL8-g.js} +1 -1
- package/dist/assets/{cell-editor-DbvkP4j5.js → cell-editor-CdlAPM5y.js} +1 -1
- package/dist/assets/{cell-link-BFEa98Sc.js → cell-link-spbX-mlL.js} +1 -1
- package/dist/assets/{chat-display-3RqKe-PZ.js → chat-display-CiAnYN2V.js} +1 -1
- package/dist/assets/{chat-panel-ChWIPBm1.js → chat-panel-CWJ3edyp.js} +1 -1
- package/dist/assets/{chat-ui-BX8NORpM.js → chat-ui-BrpoAGED.js} +1 -1
- package/dist/assets/{column-preview-DYVirisk.js → column-preview-cHpj1JI3.js} +1 -1
- package/dist/assets/{command-BkXWJLBP.js → command-BmOGG6-2.js} +1 -1
- package/dist/assets/{command-palette-Vkj8jbRj.js → command-palette-BF3Tp6Qs.js} +1 -1
- package/dist/assets/{common-C9lH0PD9.js → common-Zqa_rd3u.js} +1 -1
- package/dist/assets/{dependency-graph-panel-gmv5dXTu.js → dependency-graph-panel-1c-_VkGM.js} +1 -1
- package/dist/assets/{edit-page-BrUsc_AX.js → edit-page-CWYAjQfm.js} +4 -4
- package/dist/assets/{error-panel-lbt2yT6e.js → error-panel-DmfYCEYR.js} +1 -1
- package/dist/assets/{field-BWxnw0_c.js → field-DCdxnSKm.js} +1 -1
- package/dist/assets/{file-explorer-panel-CgALaLLS.js → file-explorer-panel-CITmIApE.js} +1 -1
- package/dist/assets/{file-name-input-B-pk2GlG.js → file-name-input-D-E8LtaP.js} +1 -1
- package/dist/assets/{form-BWJXHKy1.js → form-BUVEy6A8.js} +1 -1
- package/dist/assets/formatting-DuH2AQgo.js +1 -0
- package/dist/assets/{gallery-page-L--A5Tic.js → gallery-page-iZXf43Df.js} +1 -1
- package/dist/assets/{glide-data-editor-C_ammsJR.js → glide-data-editor-BbI6JGpY.js} +1 -1
- package/dist/assets/{home-page-VA-VAYME.js → home-page-CVKp7bjJ.js} +1 -1
- package/dist/assets/{hooks-ClbTcW-s.js → hooks-B4MwgGVt.js} +1 -1
- package/dist/assets/index-DB64hzBp.css +2 -0
- package/dist/assets/index-DukQCuHG.js +38 -0
- package/dist/assets/input-DA8xlX70.js +1 -0
- package/dist/assets/{layout-Di_1u3yT.js → layout-By2E0DxG.js} +3 -3
- package/dist/assets/{logs-panel-c4pWZhi-.js → logs-panel-KFtLFK9O.js} +1 -1
- package/dist/assets/{name-cell-input-mVvyyh5P.js → name-cell-input-DyUkpM9d.js} +1 -1
- package/dist/assets/numbers-DGxQfQ-A.js +1 -0
- package/dist/assets/{packages-panel-BspJRth2.js → packages-panel-Bt88BnuF.js} +1 -1
- package/dist/assets/{panels-C2Lu-9Am.js → panels-BMVwv9bb.js} +1 -1
- package/dist/assets/{reveal-component-D69mChLl.js → reveal-component-UAqGa1wV.js} +1 -1
- package/dist/assets/{run-page-sD-tVkQP.js → run-page-Cmzv9g5Z.js} +1 -1
- package/dist/assets/{scratchpad-panel-C-uK6ogD.js → scratchpad-panel-C5mnecjj.js} +1 -1
- package/dist/assets/{secrets-panel-BMKccJMu.js → secrets-panel-BJEb16JJ.js} +1 -1
- package/dist/assets/{session-panel-DqF_iSx7.js → session-panel-DJxyhD5Y.js} +1 -1
- package/dist/assets/{snippets-panel-CCXy7OX0.js → snippets-panel-BGtSLFha.js} +1 -1
- package/dist/assets/{tracing-DhjGEWqy.js → tracing-DNuuRjp_.js} +1 -1
- package/dist/assets/{tracing-panel-Dyt4cvQF.js → tracing-panel-CnlPrcNd.js} +2 -2
- package/dist/assets/{useCellActionButton-DH4naKvY.js → useCellActionButton-DNDYDKvS.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-DI6IO_9Y.js → useDependencyPanelTab-Bu76tcmV.js} +1 -1
- package/dist/assets/{useNotebookActions-DNIvhWif.js → useNotebookActions-CMYQ5bMR.js} +1 -1
- package/dist/assets/{write-secret-modal-CwsDn7jz.js → write-secret-modal-DM7t6LNp.js} +1 -1
- package/dist/index.html +13 -13
- package/package.json +1 -1
- package/src/components/ui/number-field.tsx +5 -1
- package/src/plugins/impl/SliderPlugin.tsx +132 -18
- package/src/plugins/impl/__tests__/SliderPlugin.test.tsx +278 -8
- package/src/utils/__tests__/numbers.test.ts +20 -0
- package/src/utils/numbers.ts +27 -0
- package/dist/assets/formatting-30FX-rC-.js +0 -1
- package/dist/assets/index-BEUIgFV-.js +0 -38
- package/dist/assets/index-Ct3LgsQ8.css +0 -2
- package/dist/assets/input-DckzEovC.js +0 -1
- package/dist/assets/numbers-C3BAdHZE.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as ae}from"./chunk-LvLJmgfZ.js";import{d as be,l as ye,n as V,p as oe,u as we}from"./useEvent-D91BmmQi.js";import{t as Ne}from"./react-Bj1aDYRI.js";import{D as ke,Fn as ze,I as Ce,Ii as Se,Li as m,Oi as Oe,__tla as Ie}from"./cells-k7Js5h2t.js";import"./react-dom-CSu739Rf.js";import{t as se}from"./compiler-runtime-B3qBwwSJ.js";import{v as ie}from"./useEventListener-DvoEXWke.js";import{x as Ae}from"./utils-CvI-39U6.js";import{t as Le}from"./constants-DMpttj8Q.js";import{t as le}from"./cn-DCUzRj2J.js";import{t as Me}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-DFky0PAA.js";import"./popover-CNCYAwbC.js";import{n as Pe,__tla as De}from"./JsonOutput-
|
|
1
|
+
import{s as ae}from"./chunk-LvLJmgfZ.js";import{d as be,l as ye,n as V,p as oe,u as we}from"./useEvent-D91BmmQi.js";import{t as Ne}from"./react-Bj1aDYRI.js";import{D as ke,Fn as ze,I as Ce,Ii as Se,Li as m,Oi as Oe,__tla as Ie}from"./cells-k7Js5h2t.js";import"./react-dom-CSu739Rf.js";import{t as se}from"./compiler-runtime-B3qBwwSJ.js";import{v as ie}from"./useEventListener-DvoEXWke.js";import{x as Ae}from"./utils-CvI-39U6.js";import{t as Le}from"./constants-DMpttj8Q.js";import{t as le}from"./cn-DCUzRj2J.js";import{t as Me}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-DFky0PAA.js";import"./popover-CNCYAwbC.js";import{n as Pe,__tla as De}from"./JsonOutput-DXzjDImT.js";import"./download-BS31LU22.js";import{t as z}from"./tooltip-B_PkSKN3.js";import{t as C}from"./button-BbCh-29a.js";import"./dist-D0HyMpgV.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{r as Ee}from"./requests-DIwGYs0l.js";import{t as ne}from"./createLucideIcon-D5guW7EU.js";import{f as Re,__tla as He}from"./layout-By2E0DxG.js";import{n as Ve,t as qe,__tla as Fe}from"./LazyAnyLanguageCodeMirror-C7ALwTI_.js";import{__tla as Te}from"./markdown-renderer-BwjWZESf.js";import{u as Ge}from"./toDate-B5A0DFEz.js";import{t as Ue,__tla as Be}from"./cell-editor-CdlAPM5y.js";import{t as Je}from"./spinner-Bhir8k53.js";import{i as Ke}from"./useDeleteCell-cucOoAuB.js";import"./dist-HyCgERnW.js";import"./dist-BwnT-_gD.js";import"./dist-rBRbke5D.js";import"./dist-RMRSa-Mj.js";import"./dist-BURue7-e.js";import"./session-0B5NBztP.js";import{r as Qe}from"./useTheme-CI2eq4XN.js";import"./purify.es-B9KxLTTS.js";import"./dates-CTxr0EqQ.js";import"./utils-DCL4n9wx.js";import"./vega-loader.browser-C8wT63Va.js";import"./defaultLocale-BLUna9fQ.js";import"./defaultLocale-DzliDDTm.js";import{__tla as We}from"./chunk-5FQGJX7Z-Bp9g5nD2.js";import"./html-to-image-rLeQGF-G.js";import{o as Xe}from"./focus-CRI5ilWC.js";import{n as Ye,r as Ze,t as me}from"./react-resizable-panels.browser.esm-CV8-hvjx.js";import{a as $e}from"./renderShortcut--ku7VECI.js";import"./esm-xaw4Vy8N.js";import"./name-cell-input-DyUkpM9d.js";import{n as et,r as tt}from"./panel-context-D7Ggu8Nw.js";import{__tla as rt}from"./loro_wasm_bg-DYsTic7p.js";import"./ws-K6nioC-Z.js";import"./Inputs-CdyQ7nLC.js";import"./dist-QqcJxlfK.js";import"./dist-2FedModH.js";import"./dist-DCzr8T5W.js";import"./dist-DxlQcmyw.js";import"./dist-flL-WW8v.js";import"./dist-BieDRQs9.js";import"./dist-BcvGVYKl.js";import"./dist-DU8NrdIh.js";import"./dist-BscEQwf7.js";import"./esm-DgI-7XOj.js";import{t as at}from"./kiosk-mode-DhNcHA04.js";let ce,ot=Promise.all([(()=>{try{return Ie}catch{}})(),(()=>{try{return De}catch{}})(),(()=>{try{return He}catch{}})(),(()=>{try{return Fe}catch{}})(),(()=>{try{return Te}catch{}})(),(()=>{try{return Be}catch{}})(),(()=>{try{return We}catch{}})(),(()=>{try{return rt}catch{}})()]).then(async()=>{var de=ne("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),he=ne("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),pe=se(),q=ae(Ne(),1),ue=15;const F=Oe("marimo:scratchpadHistory:v1",[],ze),fe=oe(!1),xe=oe(null,(e,s,i)=>{if(i=i.trim(),!i)return;let n=e(F);s(F,[i,...n.filter(c=>c!==i)].slice(0,ue))});var t=ae(Me(),1),_e={hide_code:!1,disabled:!1};const ve=()=>{var re;let e=(0,pe.c)(60),s=Ce(),[i]=Ae(),{theme:n}=Qe(),c=(0,q.useRef)(null),T=Xe(),{createNewCell:G,updateCellCode:d}=ke(),{sendRunScratchpad:h}=Ee(),S=et(),U=tt(),l=s.cellRuntime[m],B=l==null?void 0:l.output,O=l==null?void 0:l.status,J=l==null?void 0:l.consoleOutputs,r=((re=s.cellData.__scratch__)==null?void 0:re.code)??"",K=be(xe),[o,p]=ye(fe),u=we(F),I;e[0]!==K||e[1]!==r||e[2]!==h?(I=()=>{h({code:r}),K(r)},e[0]=K,e[1]=r,e[2]=h,e[3]=I):I=e[3];let f=V(I),A;e[4]!==r||e[5]!==G||e[6]!==T?(A=()=>{r.trim()&&G({code:r,before:!1,cellId:T??"__end__"})},e[4]=r,e[5]=G,e[6]=T,e[7]=A):A=e[7];let Q=V(A),L;e[8]!==h||e[9]!==d?(L=()=>{d({cellId:m,code:"",formattingChange:!1}),h({code:""});let a=c.current;a&&a.dispatch({changes:{from:0,to:a.state.doc.length,insert:""}})},e[8]=h,e[9]=d,e[10]=L):L=e[10];let W=V(L),M;e[11]!==p||e[12]!==d?(M=a=>{p(!1),d({cellId:m,code:a,formattingChange:!1});let k=c.current;k&&k.dispatch({changes:{from:0,to:k.state.doc.length,insert:a}})},e[11]=p,e[12]=d,e[13]=M):M=e[13];let X=V(M),[Y,ge]=(0,q.useState)(),P;e[14]!==X||e[15]!==u||e[16]!==o||e[17]!==n?(P=()=>o?(0,t.jsx)("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:(0,t.jsx)("div",{className:"overflow-auto flex flex-col gap-3",children:u.map((a,k)=>(0,t.jsx)("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>X(a),children:(0,t.jsx)(q.Suspense,{children:(0,t.jsx)(qe,{language:"python",theme:n,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:a.trim(),editable:!1,readOnly:!0})})},k))})}):null,e[14]=X,e[15]=u,e[16]=o,e[17]=n,e[18]=P):P=e[18];let Z=P,D;e[19]!==W||e[20]!==Q||e[21]!==f||e[22]!==u.length||e[23]!==o||e[24]!==p||e[25]!==O?(D=()=>(0,t.jsxs)("div",{className:"flex items-center shrink-0 border-b",children:[(0,t.jsx)(z,{content:$e("cell.run"),children:(0,t.jsx)(C,{"data-testid":"scratchpad-run-button",onClick:f,disabled:o,variant:"text",size:"xs",children:(0,t.jsx)(Ke,{color:"var(--grass-11)",size:16})})}),(0,t.jsx)(z,{content:"Clear code and outputs",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:W,children:(0,t.jsx)(de,{size:16})})}),(0,t.jsx)(at,{children:(0,t.jsx)(z,{content:"Insert code",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:Q,children:(0,t.jsx)(Ve,{size:16})})})}),(O==="running"||O==="queued")&&(0,t.jsx)(Je,{className:"inline",size:"small"}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsx)(z,{content:"Toggle history",children:(0,t.jsx)(C,{size:"xs",variant:"text",className:le(o&&"bg-(--sky-3) rounded-none"),onClick:()=>p(!o),disabled:u.length===0,children:(0,t.jsx)(he,{size:16})})}),(0,t.jsx)(z,{content:(0,t.jsx)("span",{className:"block max-w-prose",children:"Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file."}),children:(0,t.jsx)(C,{size:"xs",variant:"text",children:(0,t.jsx)(Ge,{size:16})})})]}),e[19]=W,e[20]=Q,e[21]=f,e[22]=u.length,e[23]=o,e[24]=p,e[25]=O,e[26]=D):D=e[26];let $=D,je=S==="vertical",E;e[27]===Symbol.for("react.memo_cache_sentinel")?(E=Se.create(m),e[27]=E):E=e[27];let x;e[28]===$?x=e[29]:(x=$(),e[28]=$,e[29]=x);let R;e[30]===Symbol.for("react.memo_cache_sentinel")?(R=a=>{c.current=a},e[30]=R):R=e[30];let _;e[31]!==r||e[32]!==f||e[33]!==Y||e[34]!==n||e[35]!==i?(_=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Ue,{theme:n,showPlaceholder:!1,id:m,code:r,config:_e,status:"idle",serializedEditorState:null,runCell:f,userConfig:i,editorViewRef:c,setEditorView:R,hidden:!1,showHiddenCode:ie.NOOP,languageAdapter:Y,setLanguageAdapter:ge})}),e[31]=r,e[32]=f,e[33]=Y,e[34]=n,e[35]=i,e[36]=_):_=e[36];let v;e[37]===Z?v=e[38]:(v=Z(),e[37]=Z,e[38]=v);let g;e[39]!==v||e[40]!==x||e[41]!==_?(g=(0,t.jsx)(me,{defaultSize:40,minSize:20,maxSize:70,children:(0,t.jsxs)("div",{className:"h-full flex flex-col overflow-hidden relative",children:[x,_,v]})}),e[39]=v,e[40]=x,e[41]=_,e[42]=g):g=e[42];let ee=je?"h-1":"w-1",j;e[43]===ee?j=e[44]:(j=le("bg-border hover:bg-primary/50 transition-colors",ee),e[43]=ee,e[44]=j);let b;e[45]===j?b=e[46]:(b=(0,t.jsx)(Ze,{className:j}),e[45]=j,e[46]=b);let y;e[47]===B?y=e[48]:(y=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Pe,{allowExpand:!1,output:B,className:Le.outputArea,cellId:m,stale:!1,loading:!1})}),e[47]=B,e[48]=y);let w;e[49]===J?w=e[50]:(w=(0,t.jsx)("div",{className:"overflow-auto shrink-0 max-h-[50%]",children:(0,t.jsx)(Re,{consoleOutputs:J,className:"overflow-auto",stale:!1,interrupted:!1,cellName:"_",onSubmitDebugger:ie.NOOP,cellId:m,debuggerActive:!1})}),e[49]=J,e[50]=w);let N;e[51]!==y||e[52]!==w?(N=(0,t.jsx)(me,{defaultSize:60,minSize:20,children:(0,t.jsxs)("div",{className:"h-full flex flex-col divide-y overflow-hidden",children:[y,w]})}),e[51]=y,e[52]=w,e[53]=N):N=e[53];let H;return e[54]!==S||e[55]!==U||e[56]!==g||e[57]!==b||e[58]!==N?(H=(0,t.jsx)("div",{className:"flex flex-col h-full overflow-hidden",id:E,children:(0,t.jsxs)(Ye,{direction:S,className:"h-full",children:[g,b,N]},U)}),e[54]=S,e[55]=U,e[56]=g,e[57]=b,e[58]=N,e[59]=H):H=e[59],H};let te;te=se(),ce=()=>{let e=(0,te.c)(1),s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(ve,{}),e[0]=s):s=e[0],s}});export{ot as __tla,ce as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as g}from"./chunk-LvLJmgfZ.js";import"./useEvent-D91BmmQi.js";import{t as k}from"./react-Bj1aDYRI.js";import"./react-dom-CSu739Rf.js";import{t as $}from"./compiler-runtime-B3qBwwSJ.js";import{t as M}from"./cn-DCUzRj2J.js";import{t as E}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-DFky0PAA.js";import{t as L}from"./check-BH35Ndha.js";import{t as A}from"./copy-BwrPA9zQ.js";import{n as D}from"./DeferredRequestRegistry-CNldVcrP.js";import{t as P}from"./spinner-Bhir8k53.js";import{t as T}from"./plus-BgB18UzY.js";import{t as V}from"./badge-j3NGjqhR.js";import{t as q}from"./use-toast-CJ1Tj2eC.js";import{n as B}from"./copy-LK56fFow.js";import{n as F}from"./ImperativeModal-
|
|
1
|
+
import{s as g}from"./chunk-LvLJmgfZ.js";import"./useEvent-D91BmmQi.js";import{t as k}from"./react-Bj1aDYRI.js";import"./react-dom-CSu739Rf.js";import{t as $}from"./compiler-runtime-B3qBwwSJ.js";import{t as M}from"./cn-DCUzRj2J.js";import{t as E}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-DFky0PAA.js";import{t as L}from"./check-BH35Ndha.js";import{t as A}from"./copy-BwrPA9zQ.js";import{n as D}from"./DeferredRequestRegistry-CNldVcrP.js";import{t as P}from"./spinner-Bhir8k53.js";import{t as T}from"./plus-BgB18UzY.js";import{t as V}from"./badge-j3NGjqhR.js";import{t as q}from"./use-toast-CJ1Tj2eC.js";import{n as B}from"./copy-LK56fFow.js";import{n as F}from"./ImperativeModal-BW1dmntO.js";import{n as I}from"./error-banner-D0xvrLog.js";import{n as O}from"./useAsyncData-bgszE9F0.js";import{a as R,i as S,n as G,o as w,r as _,t as H}from"./table-BGPSHfig.js";import{n as J,r as K,t as C}from"./react-resizable-panels.browser.esm-CV8-hvjx.js";import{t as Q}from"./empty-state-vCWg-_A9.js";import{t as U}from"./request-registry-BmtPM40k.js";import{n as W,t as X}from"./write-secret-modal-DM7t6LNp.js";var z=$(),Y=g(k(),1),r=g(E(),1),Z=()=>{let e=(0,z.c)(27),{openModal:t,closeModal:n}=F(),l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=[],e[0]=l):l=e[0];let{data:s,isPending:x,error:f,refetch:m}=O(re,l);if(x){let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsx)(P,{size:"medium",centered:!0}),e[1]=o):o=e[1],o}if(f){let o;return e[2]===f?o=e[3]:(o=(0,r.jsx)(I,{error:f}),e[2]=f,e[3]=o),o}let c;e[4]===s?c=e[5]:(c=s.filter(te).map(oe),e[4]=s,e[5]=c);let i=c;if(s.length===0){let o;return e[6]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsx)(Q,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:(0,r.jsx)(D,{})}),e[6]=o):o=e[6],o}let a;e[7]!==n||e[8]!==t||e[9]!==i||e[10]!==m?(a=()=>t((0,r.jsx)(X,{providerNames:i,onSuccess:()=>{m(),n()},onClose:n})),e[7]=n,e[8]=t,e[9]=i,e[10]=m,e[11]=a):a=e[11];let b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=(0,r.jsx)(T,{className:"h-4 w-4"}),e[12]=b):b=e[12];let d;e[13]===a?d=e[14]:(d=(0,r.jsx)("div",{className:"flex justify-start h-8 border-b",children:(0,r.jsx)("button",{type:"button",className:"border-r px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:a,children:b})}),e[13]=a,e[14]=d);let j;e[15]===Symbol.for("react.memo_cache_sentinel")?(j=(0,r.jsx)(R,{children:(0,r.jsxs)(w,{children:[(0,r.jsx)(S,{children:"Environment Variable"}),(0,r.jsx)(S,{children:"Source"}),(0,r.jsx)(S,{})]})}),e[15]=j):j=e[15];let p;e[16]===s?p=e[17]:(p=s.map(se),e[16]=s,e[17]=p);let h;e[18]===p?h=e[19]:(h=(0,r.jsxs)(H,{className:"overflow-auto flex-1 mb-16",children:[j,(0,r.jsx)(G,{children:p})]}),e[18]=p,e[19]=h);let u;e[20]!==d||e[21]!==h?(u=(0,r.jsx)(C,{defaultSize:50,minSize:30,maxSize:80,children:(0,r.jsxs)("div",{className:"flex flex-col h-full",children:[d,h]})}),e[20]=d,e[21]=h,e[22]=u):u=e[22];let v;e[23]===Symbol.for("react.memo_cache_sentinel")?(v=(0,r.jsx)(K,{className:"w-1 bg-border hover:bg-primary/50 transition-colors"}),e[23]=v):v=e[23];let y;e[24]===Symbol.for("react.memo_cache_sentinel")?(y=(0,r.jsx)(C,{defaultSize:50,children:(0,r.jsx)("div",{})}),e[24]=y):y=e[24];let N;return e[25]===u?N=e[26]:(N=(0,r.jsxs)(J,{direction:"horizontal",className:"h-full",children:[u,v,y]}),e[25]=u,e[26]=N),N},ee=e=>{let t=(0,z.c)(9),{className:n,ariaLabel:l,onCopy:s}=e,[x,f]=Y.useState(!1),m;t[0]===s?m=t[1]:(m=()=>{s(),f(!0),setTimeout(()=>f(!1),1e3)},t[0]=s,t[1]=m);let c=m,i;t[2]===x?i=t[3]:(i=x?(0,r.jsx)(L,{className:"w-3 h-3 text-green-700 rounded"}):(0,r.jsx)(A,{className:"w-3 h-3 hover:bg-muted rounded"}),t[2]=x,t[3]=i);let a;return t[4]!==l||t[5]!==n||t[6]!==c||t[7]!==i?(a=(0,r.jsx)("button",{type:"button",className:n,onClick:c,"aria-label":l,children:i}),t[4]=l,t[5]=n,t[6]=c,t[7]=i,t[8]=a):a=t[8],a};async function re(){return W((await U.request({})).secrets)}function te(e){return e.provider!=="env"}function oe(e){return e.name}function se(e){return e.keys.map(t=>(0,r.jsxs)(w,{className:"group",children:[(0,r.jsx)(_,{children:t}),(0,r.jsx)(_,{children:e.provider!=="env"&&(0,r.jsx)(V,{variant:"outline",className:"select-none",children:e.name})}),(0,r.jsx)(_,{children:(0,r.jsx)(ee,{ariaLabel:`Copy ${t}`,onCopy:async()=>{await B(`os.environ["${t}"]`),q({title:"Copied to clipboard",description:`os.environ["${t}"] has been copied to your clipboard.`})},className:M("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${e.name}-${t}`))}export{Z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as ie}from"./chunk-LvLJmgfZ.js";import{d as de,l as he,p as ue,u as K}from"./useEvent-D91BmmQi.js";import{t as Pe}from"./react-Bj1aDYRI.js";import{Ar as Me,At as Ee,Br as xe,D as Oe,Fn as pe,Fr as fe,Gt as Re,In as Ue,Ir as Ae,Kt as ze,Lr as Ge,M as We,Nr as se,Oi as be,P as He,Pr as ge,Rn as Ke,Rt as Je,Ur as Qe,Vr as je,Wr as Ne,Wt as Xe,_n as Ye,a as Ze,ar as ea,cr as aa,f as ta,hr as sa,or as la,vr as na,yr as le}from"./cells-k7Js5h2t.js";import"./react-dom-CSu739Rf.js";import{t as ye}from"./compiler-runtime-B3qBwwSJ.js";import{c as ra}from"./utils-CvI-39U6.js";import{t as oa}from"./ErrorBoundary-DyYDV0HI.js";import{t as O}from"./cn-DCUzRj2J.js";import{t as ca}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-DFky0PAA.js";import{n as ma}from"./multi-map-C4OANz8X.js";import"./popover-CNCYAwbC.js";import{$ as ve,Q as ne,et as ia,f as we,g as Se,h as re,m as oe,nt as da,p as ee,rt as ha,tt as ua,u as xa}from"./JsonOutput-BemZ015x.js";import"./download-BS31LU22.js";import{r as Ce}from"./radio-group-DS_mmqHJ.js";import{t as ce}from"./tooltip-B_PkSKN3.js";import{r as pa,t as ae}from"./button-BbCh-29a.js";import"./dist-D0HyMpgV.js";import{u as J}from"./arrays-DYDL-3-i.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{i as fa}from"./strings-wdPMRf6Z.js";import{r as ba}from"./requests-DIwGYs0l.js";import{t as ga}from"./createLucideIcon-D5guW7EU.js";import{t as ja}from"./x-C-6liIBr.js";import{a as Na,r as ya}from"./tree-actions-XvgFV23w.js";import"./markdown-renderer-BwjWZESf.js";import{t as _e}from"./add-connection-dialog-ZjsgZSOV.js";import{t as ke}from"./plus-BgB18UzY.js";import{a as va}from"./input-DckzEovC.js";import{n as wa,o as Sa}from"./column-preview-DYVirisk.js";import{t as Ca}from"./workflow-Bm8qF7yj.js";import"./dist-HyCgERnW.js";import"./dist-BwnT-_gD.js";import"./dist-rBRbke5D.js";import"./dist-RMRSa-Mj.js";import"./dist-BURue7-e.js";import"./session-0B5NBztP.js";import"./purify.es-B9KxLTTS.js";import"./dates-CTxr0EqQ.js";import{t as _a}from"./copy-icon-BuRdHNPA.js";import{t as ka}from"./context-QkTujrKn.js";import"./utils-DCL4n9wx.js";import"./vega-loader.browser-C8wT63Va.js";import"./defaultLocale-BLUna9fQ.js";import"./defaultLocale-DzliDDTm.js";import{t as $e}from"./cell-link-BFEa98Sc.js";import"./chunk-5FQGJX7Z-Bp9g5nD2.js";import{r as $a}from"./html-to-image-rLeQGF-G.js";import{o as Fa}from"./focus-CRI5ilWC.js";import{n as me}from"./useAsyncData-bgszE9F0.js";import{a as Ta,i as Ia,n as La,o as Fe,r as qa,t as Da}from"./table-BGPSHfig.js";import"./react-resizable-panels.browser.esm-CV8-hvjx.js";import{a as Va,f as Ba,o as te,t as Pa}from"./command-BkXWJLBP.js";import{n as Ma}from"./icons-Ol38nIbL.js";import{t as Ea}from"./empty-state-vCWg-_A9.js";import{n as Oa,t as Ra}from"./common-C9lH0PD9.js";import{a as Ua,i as Aa,n as Te,r as Ie,t as Le}from"./components-CXG-2UWv.js";var za=ga("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"}]]),A=ye(),F=ie(Pe(),1),t=ie(ca(),1),$={engineEmpty:"pl-3",engine:"pl-3 pr-2",database:"pl-4",schemaEmpty:"pl-8",schema:"pl-7",schemaLoading:"pl-8",tableLoading:"pl-11",tableSchemaless:"pl-8",tableWithSchema:"pl-12",columnLocal:"pl-5",columnSql:"pl-13",columnPreview:"pl-10"},Ga=ue(a=>{let e=a(fe),s=a(Ke),l=a(Ze);return J(e,r=>{if(!r.variable_name)return-1;let c=Object.values(s).find(g=>g.name===r.variable_name);if(!c)return 0;let n=l.inOrderIds.indexOf(c.declaredBy[0]);return n===-1?0:n})});const Wa=be("marimo:datasources:hideEmpty",!1,pe,{getOnInit:!0});function Ha(a){return a.tables_resolved!==!1&&a.tables.length===0}function Ka(a){let e=!1,s=[];for(let l of a){if(l.schemas_resolved!==!1&&l.schemas.length===0){e=!0;continue}if(l.schemas.length===0){s.push(l);continue}let r=l.schemas.filter(c=>!Ha(c));if(r.length===0){e=!0;continue}if(r.length===l.schemas.length){s.push(l);continue}e=!0,s.push({...l,schemas:r})}return e?s:a}const qe=ue(a=>{let e=new Map(a(Me));for(let s of Ne){let l=e.get(s);l&&(l.databases.length===0&&e.delete(s),l.databases.length===1&&l.databases[0].name==="memory"&&l.databases[0].schemas.length===0&&e.delete(s))}return J([...e.values()],s=>Ne.has(s.name)?1:0)}),Ja=()=>{let a=(0,A.c)(42),[e,s]=F.useState(""),[l,r]=he(Wa),c=de(ge),n=K(Ga),g=K(qe),j;e:{if(!l){j=g;break e}let v,w;a[0]===g?(v=a[1],w=a[2]):(v=!1,w=g.map(k=>{let T=Ka(k.databases);return T===k.databases?k:(v=!0,{...k,databases:T})}),a[0]=g,a[1]=v,a[2]=w),j=v?w:g}let N=j;if(n.length===0&&N.length===0){let v;return a[3]===Symbol.for("react.memo_cache_sentinel")?(v=(0,t.jsx)(Ea,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:(0,t.jsx)(_e,{children:(0,t.jsxs)(ae,{variant:"outline",size:"sm",children:["Add database or catalog",(0,t.jsx)(ke,{className:"h-4 w-4 ml-2"})]})}),icon:(0,t.jsx)(le,{})}),a[3]=v):v=a[3],v}let u=!!e.trim(),m;a[4]===c?m=a[5]:(m=v=>{c(v.length>0),s(v)},a[4]=c,a[5]=m);let i;a[6]!==e||a[7]!==m?(i=(0,t.jsx)(Va,{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]=i):i=a[8];let h;a[9]===u?h=a[10]:(h=u&&(0,t.jsx)("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>s(""),children:(0,t.jsx)(ja,{className:"h-4 w-4"})}),a[9]=u,a[10]=h);let p=!l,d;a[11]!==l||a[12]!==r?(d=()=>r(!l),a[11]=l,a[12]=r,a[13]=d):d=a[13];let o;a[14]!==p||a[15]!==d?(o=(0,t.jsx)(Na,{"data-testid":"datasources-hide-empty-button",isVisible:p,onToggle:d,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]=p,a[15]=d,a[16]=o):o=a[16];let b;a[17]===Symbol.for("react.memo_cache_sentinel")?(b=(0,t.jsx)(_e,{children:(0,t.jsx)(ae,{variant:"ghost",size:"sm",className:"px-2 rounded-none focus-visible:outline-hidden",children:(0,t.jsx)(ke,{className:"h-4 w-4"})})}),a[17]=b):b=a[17];let x;a[18]!==i||a[19]!==h||a[20]!==o?(x=(0,t.jsxs)("div",{className:"flex items-center w-full border-b",children:[i,h,o,b]}),a[18]=i,a[19]=h,a[20]=o,a[21]=x):x=a[21];let f;if(a[22]!==N||a[23]!==u||a[24]!==e){let v;a[26]!==u||a[27]!==e?(v=w=>(0,t.jsx)(Qa,{connection:w,hasChildren:w.databases.length>0,children:w.databases.map(k=>(0,t.jsx)(Xa,{engineName:w.name,database:k,hasSearch:u,children:(0,t.jsx)(Ya,{schemas:k.schemas,defaultSchema:w.default_schema,defaultDatabase:w.default_database,engineName:w.name,databaseName:k.name,hasSearch:u,searchValue:e,dialect:w.dialect})},k.name))},w.name),a[26]=u,a[27]=e,a[28]=v):v=a[28],f=N.map(v),a[22]=N,a[23]=u,a[24]=e,a[25]=f}else f=a[25];let y;a[29]!==N.length||a[30]!==n.length?(y=N.length>0&&n.length>0&&(0,t.jsxs)(we,{className:$.engine,children:[(0,t.jsx)(Ma,{className:"h-4 w-4 text-muted-foreground"}),(0,t.jsx)("span",{className:"text-xs",children:"Python"})]}),a[29]=N.length,a[30]=n.length,a[31]=y):y=a[31];let S;a[32]!==e||a[33]!==n?(S=n.length>0&&(0,t.jsx)(De,{tables:n,searchValue:e}),a[32]=e,a[33]=n,a[34]=S):S=a[34];let C;a[35]!==y||a[36]!==S||a[37]!==f?(C=(0,t.jsxs)(Ba,{className:"flex flex-col",children:[f,y,S]}),a[35]=y,a[36]=S,a[37]=f,a[38]=C):C=a[38];let _;return a[39]!==C||a[40]!==x?(_=(0,t.jsxs)(Pa,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden",shouldFilter:!1,children:[x,C]}),a[39]=C,a[40]=x,a[41]=_):_=a[41],_};var Qa=a=>{let e=(0,A.c)(25),{connection:s,children:l,hasChildren:r}=a,c=s.name===Qe,n=c?"In-Memory":s.name,{previewDataSourceConnection:g}=ba(),j;e[0]!==s.name||e[1]!==g?(j=async()=>{await g({engine:s.name})},e[0]=s.name,e[1]=g,e[2]=j):j=e[2];let N=j,u;e[3]===s.dialect?u=e[4]:(u=(0,t.jsx)(Ee,{className:"h-4 w-4 text-muted-foreground",name:s.dialect}),e[3]=s.dialect,e[4]=u);let m;e[5]===s.dialect?m=e[6]:(m=ea(s.dialect),e[5]=s.dialect,e[6]=m);let i;e[7]===m?i=e[8]:(i=(0,t.jsx)("span",{className:"text-xs",children:m}),e[7]=m,e[8]=i);let h=n,p;e[9]===h?p=e[10]:(p=(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",(0,t.jsx)(Ua,{variableName:h}),")"]}),e[9]=h,e[10]=p);let d;e[11]!==N||e[12]!==c?(d=!c&&(0,t.jsx)(ya,{onClick:N,tooltip:"Refresh connection",className:"ml-auto h-4 p-0",iconClassName:"h-3.5 w-3.5"}),e[11]=N,e[12]=c,e[13]=d):d=e[13];let o;e[14]!==u||e[15]!==i||e[16]!==p||e[17]!==d?(o=(0,t.jsxs)(we,{className:$.engine,children:[u,i,p,d]}),e[14]=u,e[15]=i,e[16]=p,e[17]=d,e[18]=o):o=e[18];let b;e[19]!==l||e[20]!==r?(b=r?l:(0,t.jsx)(ee,{content:"No databases available",className:$.engineEmpty}),e[19]=l,e[20]=r,e[21]=b):b=e[21];let x;return e[22]!==o||e[23]!==b?(x=(0,t.jsxs)(t.Fragment,{children:[o,b]}),e[22]=o,e[23]=b,e[24]=x):x=e[24],x},Xa=a=>{let e=(0,A.c)(26),{hasSearch:s,engineName:l,database:r,children:c}=a,[n,g]=F.useState(!1),[j,N]=F.useState(!1),[u,m]=F.useState(s);u!==s&&(m(s),g(s));let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=O("text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",$.database),e[0]=i):i=e[0];let h;e[1]!==n||e[2]!==j?(h=()=>{g(!n),N(!j)},e[1]=n,e[2]=j,e[3]=h):h=e[3];let p=`${l}:${r.name}`,d;e[4]===n?d=e[5]:(d=(0,t.jsx)(Se,{isExpanded:n}),e[4]=n,e[5]=d);let o=j&&n?"text-foreground":"text-muted-foreground",b;e[6]===o?b=e[7]:(b=O("h-4 w-4",o),e[6]=o,e[7]=b);let x;e[8]===b?x=e[9]:(x=(0,t.jsx)(le,{className:b}),e[8]=b,e[9]=x);let f=j&&n&&"font-semibold",y;e[10]===f?y=e[11]:(y=O(f),e[10]=f,e[11]=y);let S;e[12]===r.name?S=e[13]:(S=r.name===""?(0,t.jsx)("i",{children:"Not connected"}):r.name,e[12]=r.name,e[13]=S);let C;e[14]!==S||e[15]!==y?(C=(0,t.jsx)("span",{className:y,children:S}),e[14]=S,e[15]=y,e[16]=C):C=e[16];let _;e[17]!==C||e[18]!==h||e[19]!==p||e[20]!==d||e[21]!==x?(_=(0,t.jsxs)(te,{className:i,onSelect:h,value:p,children:[d,x,C]}),e[17]=C,e[18]=h,e[19]=p,e[20]=d,e[21]=x,e[22]=_):_=e[22];let v=n&&c,w;return e[23]!==_||e[24]!==v?(w=(0,t.jsxs)(t.Fragment,{children:[_,v]}),e[23]=_,e[24]=v,e[25]=w):w=e[25],w},Ya=({schemas:a,defaultSchema:e,defaultDatabase:s,dialect:l,engineName:r,databaseName:c,hasSearch:n,searchValue:g})=>{let{addSchemaList:j}=se(),[N,u]=F.useState(!1),[m,i]=F.useState(!1),{isPending:h,error:p}=me(async()=>{if(a.length===0&&r&&!N){u(!0),i(!0);try{j({schemas:(await Xe.request({engine:r,database:c})).schemas??[],sqlSchemaContext:{engine:r,database:c}})}finally{i(!1)}}},[a.length,r,c,N]);return h||m?(0,t.jsx)(re,{message:"Loading schemas...",className:$.schemaLoading}):p?(0,t.jsx)(oe,{error:p,className:$.schemaLoading}):a.length===0?(0,t.jsx)(ee,{content:"No schemas available",className:$.schemaEmpty}):(0,t.jsx)(t.Fragment,{children:a.filter(d=>g?d.tables.some(o=>o.name.toLowerCase().includes(g.toLowerCase())):!0).map(d=>(0,t.jsx)(Za,{databaseName:c,schema:d,hasSearch:n,children:(0,t.jsx)(De,{tables:d.tables,searchValue:g,sqlTableContext:{engine:r,database:c,schema:d.name,defaultSchema:e,defaultDatabase:s,dialect:l}})},d.name))})},Za=a=>{let e=(0,A.c)(24),{databaseName:s,schema:l,children:r,hasSearch:c}=a,[n,g]=F.useState(c),[j,N]=F.useState(!1),u=`${s}:${l.name}`;if(xe(l.name))return r;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=O("text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",$.schema),e[0]=m):m=e[0];let i;e[1]!==n||e[2]!==j?(i=()=>{g(!n),N(!j)},e[1]=n,e[2]=j,e[3]=i):i=e[3];let h;e[4]===n?h=e[5]:(h=(0,t.jsx)(Se,{isExpanded:n}),e[4]=n,e[5]=h);let p=j&&n&&"text-foreground",d;e[6]===p?d=e[7]:(d=O("h-4 w-4 text-muted-foreground",p),e[6]=p,e[7]=d);let o;e[8]===d?o=e[9]:(o=(0,t.jsx)(sa,{className:d}),e[8]=d,e[9]=o);let b=j&&n&&"font-semibold",x;e[10]===b?x=e[11]:(x=O(b),e[10]=b,e[11]=x);let f;e[12]!==l.name||e[13]!==x?(f=(0,t.jsx)("span",{className:x,children:l.name}),e[12]=l.name,e[13]=x,e[14]=f):f=e[14];let y;e[15]!==i||e[16]!==h||e[17]!==o||e[18]!==f||e[19]!==u?(y=(0,t.jsxs)(te,{className:m,onSelect:i,value:u,children:[h,o,f]}),e[15]=i,e[16]=h,e[17]=o,e[18]=f,e[19]=u,e[20]=y):y=e[20];let S=n&&r,C;return e[21]!==y||e[22]!==S?(C=(0,t.jsxs)(t.Fragment,{children:[y,S]}),e[21]=y,e[22]=S,e[23]=C):C=e[23],C},De=a=>{let e=(0,A.c)(24),{tables:s,sqlTableContext:l,searchValue:r}=a,{addTableList:c}=se(),[n,g]=F.useState(!1),[j,N]=F.useState(!1),u;e[0]!==c||e[1]!==l||e[2]!==s.length||e[3]!==n?(u=async()=>{if(s.length===0&&l&&!n){g(!0),N(!0);let{engine:o,database:b,schema:x}=l,f=await ze.request({engine:o,database:b,schema:x});if(!(f!=null&&f.tables))throw N(!1),Error("No tables available");c({tables:f.tables,sqlTableContext:l}),N(!1)}},e[0]=c,e[1]=l,e[2]=s.length,e[3]=n,e[4]=u):u=e[4];let m;e[5]!==l||e[6]!==s.length||e[7]!==n?(m=[s.length,l,n],e[5]=l,e[6]=s.length,e[7]=n,e[8]=m):m=e[8];let{isPending:i,error:h}=me(u,m);if(i||j){let o;return e[9]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(re,{message:"Loading tables...",className:$.tableLoading}),e[9]=o):o=e[9],o}if(h){let o;return e[10]===h?o=e[11]:(o=(0,t.jsx)(oe,{error:h,className:$.tableLoading}),e[10]=h,e[11]=o),o}if(s.length===0){let o;return e[12]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(ee,{content:"No tables found",className:$.tableLoading}),e[12]=o):o=e[12],o}let p;if(e[13]!==r||e[14]!==l||e[15]!==s){let o;e[17]===r?o=e[18]:(o=f=>r?f.name.toLowerCase().includes(r.toLowerCase()):!0,e[17]=r,e[18]=o);let b=s.filter(o),x;e[19]!==r||e[20]!==l?(x=f=>(0,t.jsx)(et,{table:f,sqlTableContext:l,isSearching:!!r},f.name),e[19]=r,e[20]=l,e[21]=x):x=e[21],p=b.map(x),e[13]=r,e[14]=l,e[15]=s,e[16]=p}else p=e[16];let d;return e[22]===p?d=e[23]:(d=(0,t.jsx)(t.Fragment,{children:p}),e[22]=p,e[23]=d),d},et=a=>{let e=(0,A.c)(64),{table:s,sqlTableContext:l,isSearching:r}=a,{addTable:c}=se(),[n,g]=F.useState(!1),[j,N]=F.useState(!1),u=s.columns.length>0,m;e[0]!==c||e[1]!==n||e[2]!==l||e[3]!==s.name||e[4]!==u||e[5]!==j?(m=async()=>{if(n&&!u&&l&&!j){N(!0);let{engine:B,database:Y,schema:Be}=l,Z=await Re.request({engine:B,database:Y,schema:Be,tableName:s.name});if(!(Z!=null&&Z.table))throw Error("No table details available");c({table:Z.table,sqlTableContext:l})}},e[0]=c,e[1]=n,e[2]=l,e[3]=s.name,e[4]=u,e[5]=j,e[6]=m):m=e[6];let i;e[7]!==n||e[8]!==u?(i=[n,u],e[7]=n,e[8]=u,e[9]=i):i=e[9];let{isFetching:h,isPending:p,error:d}=me(m,i),o=K(ra),b=Fa(),{createNewCell:x}=Oe(),f=Ce(),y;e[10]!==f||e[11]!==o||e[12]!==x||e[13]!==b||e[14]!==l||e[15]!==s?(y=()=>{$a({autoInstantiate:o,createNewCell:x,fromCellId:b}),f((()=>{if(s.source_type==="catalog"){let B=l!=null&&l.database?`${l.database}.${s.name}`:s.name;return`${s.engine}.load_table("${B}")`}if(l)return je({table:s,columnName:"*",sqlTableContext:l});switch(s.source_type){case"local":return`mo.ui.table(${s.name})`;case"duckdb":case"connection":return je({table:s,columnName:"*",sqlTableContext:l});default:return fa(s.source_type),""}})())},e[10]=f,e[11]=o,e[12]=x,e[13]=b,e[14]=l,e[15]=s,e[16]=y):y=e[16];let S=y,C;e[17]!==s.num_columns||e[18]!==s.num_rows?(C=()=>{let B=[];return s.num_rows!=null&&B.push(`${s.num_rows} rows`),s.num_columns!=null&&B.push(`${s.num_columns} columns`),B.length===0?null:(0,t.jsx)("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:B.join(", ")})})},e[17]=s.num_columns,e[18]=s.num_rows,e[19]=C):C=e[19];let _=C,v;e[20]!==d||e[21]!==h||e[22]!==p||e[23]!==l||e[24]!==s?(v=()=>{if(p||h)return(0,t.jsx)(re,{message:"Loading columns...",className:$.tableLoading});if(d)return(0,t.jsx)(oe,{error:d,className:$.tableLoading});let B=s.columns;return B.length===0?(0,t.jsx)(ee,{content:"No columns found",className:$.tableLoading}):B.map(Y=>(0,t.jsx)(at,{table:s,column:Y,sqlTableContext:l},Y.name))},e[20]=d,e[21]=h,e[22]=p,e[23]=l,e[24]=s,e[25]=v):v=e[25];let w=v,k;e[26]!==n||e[27]!==r||e[28]!==s.source_type||e[29]!==s.type?(k=()=>{if(s.source_type!=="local")return(0,t.jsx)(s.type==="table"?aa:na,{className:"h-3 w-3",strokeWidth:n||r?2.5:void 0})},e[26]=n,e[27]=r,e[28]=s.source_type,e[29]=s.type,e[30]=k):k=e[30];let T=k,P=l?`${l.database}.${l.schema}.${s.name}`:s.name,M=l&&(xe(l.schema)?$.tableSchemaless:$.tableWithSchema),E=(n||r)&&"font-semibold",I;e[31]!==M||e[32]!==E?(I=O("rounded-none group h-8 cursor-pointer",M,E),e[31]=M,e[32]=E,e[33]=I):I=e[33];let L;e[34]===n?L=e[35]:(L=()=>g(!n),e[34]=n,e[35]=L);let q;e[36]===T?q=e[37]:(q=T(),e[36]=T,e[37]=q);let V;e[38]===s.name?V=e[39]:(V=(0,t.jsx)("span",{className:"text-sm",children:s.name}),e[38]=s.name,e[39]=V);let R;e[40]!==q||e[41]!==V?(R=(0,t.jsxs)("div",{className:"flex gap-2 items-center flex-1 pl-1",children:[q,V]}),e[40]=q,e[41]=V,e[42]=R):R=e[42];let U;e[43]===_?U=e[44]:(U=_(),e[43]=_,e[44]=U);let D;e[45]===S?D=e[46]:(D=pa.stopPropagation(()=>S()),e[45]=S,e[46]=D);let Q;e[47]===Symbol.for("react.memo_cache_sentinel")?(Q=(0,t.jsx)(Sa,{className:"h-3 w-3"}),e[47]=Q):Q=e[47];let G;e[48]===D?G=e[49]:(G=(0,t.jsx)(ce,{content:"Add table to notebook",delayDuration:400,children:(0,t.jsx)(ae,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:D,children:Q})}),e[48]=D,e[49]=G);let W;e[50]!==n||e[51]!==L||e[52]!==R||e[53]!==U||e[54]!==G||e[55]!==I||e[56]!==P?(W=(0,t.jsxs)(te,{className:I,value:P,"aria-selected":n,forceMount:!0,onSelect:L,children:[R,U,G]}),e[50]=n,e[51]=L,e[52]=R,e[53]=U,e[54]=G,e[55]=I,e[56]=P,e[57]=W):W=e[57];let H;e[58]!==n||e[59]!==w?(H=n&&w(),e[58]=n,e[59]=w,e[60]=H):H=e[60];let X;return e[61]!==W||e[62]!==H?(X=(0,t.jsxs)(t.Fragment,{children:[W,H]}),e[61]=W,e[62]=H,e[63]=X):X=e[63],X},at=a=>{var R,U;let e=(0,A.c)(48),{table:s,column:l,sqlTableContext:r}=a,[c,n]=F.useState(!1),g=K(ge),j=de(Ae);g&&c&&n(!1),j(c?D=>new Set([...D,`${s.name}:${l.name}`]):D=>(D.delete(`${s.name}:${l.name}`),new Set(D)));let N=Ce(),{columnsPreviews:u}=Ge(),m;e[0]!==l.name||e[1]!==s.primary_keys?(m=((R=s.primary_keys)==null?void 0:R.includes(l.name))||!1,e[0]=l.name,e[1]=s.primary_keys,e[2]=m):m=e[2];let i=m,h;e[3]!==l.name||e[4]!==s.indexes?(h=((U=s.indexes)==null?void 0:U.includes(l.name))||!1,e[3]=l.name,e[4]=s.indexes,e[5]=h):h=e[5];let p=h,d;e[6]===N?d=e[7]:(d=D=>{N(D)},e[6]=N,e[7]=d);let o=d,b=tt,x=c?"font-semibold":"",f;e[8]!==l.name||e[9]!==x?(f=(0,t.jsx)("span",{className:x,children:l.name}),e[8]=l.name,e[9]=x,e[10]=f):f=e[10];let y=f,S=`${s.name}.${l.name}`,C=`${s.name}.${l.name}`,_;e[11]===c?_=e[12]:(_=()=>n(!c),e[11]=c,e[12]=_);let v=r?$.columnSql:$.columnLocal,w;e[13]===v?w=e[14]:(w=O("flex flex-row gap-2 items-center flex-1",v),e[13]=v,e[14]=w);let k;e[15]!==l.type||e[16]!==y?(k=(0,t.jsx)(xa,{columnName:y,dataType:l.type}),e[15]=l.type,e[16]=y,e[17]=k):k=e[17];let T;e[18]===i?T=e[19]:(T=i&&b({tooltipContent:"Primary key",content:"PK"}),e[18]=i,e[19]=T);let P;e[20]===p?P=e[21]:(P=p&&b({tooltipContent:"Indexed",content:"IDX"}),e[20]=p,e[21]=P);let M;e[22]!==w||e[23]!==k||e[24]!==T||e[25]!==P?(M=(0,t.jsxs)("div",{className:w,children:[k,T,P]}),e[22]=w,e[23]=k,e[24]=T,e[25]=P,e[26]=M):M=e[26];let E;e[27]===l.name?E=e[28]:(E=(0,t.jsx)(ce,{content:"Copy column name",delayDuration:400,children:(0,t.jsx)(ae,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:(0,t.jsx)(_a,{tooltip:!1,value:l.name,className:"h-3 w-3"})})}),e[27]=l.name,e[28]=E);let I;e[29]===l.external_type?I=e[30]:(I=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:l.external_type}),e[29]=l.external_type,e[30]=I);let L;e[31]!==M||e[32]!==E||e[33]!==I||e[34]!==S||e[35]!==C||e[36]!==_?(L=(0,t.jsxs)(te,{className:"rounded-none py-1 group cursor-pointer",value:C,onSelect:_,children:[M,E,I]},S),e[31]=M,e[32]=E,e[33]=I,e[34]=S,e[35]=C,e[36]=_,e[37]=L):L=e[37];let q;e[38]!==l||e[39]!==u||e[40]!==o||e[41]!==c||e[42]!==r||e[43]!==s?(q=c&&(0,t.jsx)("div",{className:O($.columnPreview,"pr-2 py-2 bg-(--slate-1) shadow-inner border-b"),children:(0,t.jsx)(oa,{children:(0,t.jsx)(wa,{table:s,column:l,onAddColumnChart:o,preview:u.get(r?`${r.database}.${r.schema}.${s.name}:${l.name}`:`${s.name}:${l.name}`),sqlTableContext:r})})}),e[38]=l,e[39]=u,e[40]=o,e[41]=c,e[42]=r,e[43]=s,e[44]=q):q=e[44];let V;return e[45]!==L||e[46]!==q?(V=(0,t.jsxs)(t.Fragment,{children:[L,q]}),e[45]=L,e[46]=q,e[47]=V):V=e[47],V};function tt(a){let{tooltipContent:e,content:s}=a;return(0,t.jsx)(ce,{content:e,delayDuration:100,children:(0,t.jsx)("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:s})})}function ps(a){return a}var z={name:"name",type:"type-value",defs:"defs-refs"},st=[{id:z.name,accessorFn:a=>[a.name,a.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:a})=>(0,t.jsx)(ne,{header:"Name",column:a}),cell:({getValue:a})=>{let[e,s]=a();return(0,t.jsx)(Ra,{name:e,declaredBy:s})}},{id:z.type,accessorFn:a=>[a.dataType,a.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:a})=>(0,t.jsx)(ne,{header:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("span",{children:"Type"}),(0,t.jsx)("span",{children:"Value"})]}),column:a}),cell:({getValue:a})=>{let[e,s]=a();return(0,t.jsxs)("div",{className:"max-w-[150px]",children:[(0,t.jsx)("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),(0,t.jsx)("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:s??"",children:s})]})}},{id:z.defs,accessorFn:a=>[a.declaredBy,a.usedBy,a.name,a.declaredByNames,a.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:a})=>(0,t.jsx)(ne,{header:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("span",{children:"Declared By"}),(0,t.jsx)("span",{children:"Used By"})]}),column:a}),cell:({getValue:a})=>{let[e,s,l]=a(),r=c=>{let n=ta(c);n&&Ye(n,l)};return(0,t.jsxs)("div",{className:"flex flex-col gap-1 py-1",children:[(0,t.jsxs)("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[(0,t.jsx)("span",{title:"Declared by",children:(0,t.jsx)(za,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?(0,t.jsx)($e,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):(0,t.jsx)("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((c,n)=>(0,t.jsxs)("span",{className:"flex",children:[(0,t.jsx)($e,{variant:"focus",cellId:c,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(c)},c),n<e.length-1&&", "]},c))})]}),(0,t.jsxs)("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[(0,t.jsx)("span",{title:"Used by",children:(0,t.jsx)(Ca,{className:"w-3.5 h-3.5 text-muted-foreground"})}),(0,t.jsx)(Oa,{maxCount:3,cellIds:s,skipScroll:!0,onClick:r})]})]})}}];function lt({variables:a,sort:e,cellIdToIndex:s}){e||(e={id:z.defs,desc:!1});let l=[];switch(e.id){case z.name:l=J(a,r=>r.name);break;case z.type:l=J(a,r=>r.dataType);break;case z.defs:l=J(a,r=>s.get(r.declaredBy[0]));break}return e.desc?l.toReversed():l}const Ve=(0,F.memo)(({className:a,cellIds:e,variables:s})=>{let[l,r]=F.useState([]),[c,n]=F.useState(""),g=He(),{locale:j}=ka(),N=(0,F.useMemo)(()=>{let m=i=>{let h=g[i];return Je(h)?`cell-${e.indexOf(i)}`:h??`cell-${e.indexOf(i)}`};return Object.values(s).map(i=>({...i,declaredByNames:i.declaredBy.map(m),usedByNames:i.usedBy.map(m)}))},[s,g,e]),u=ia({data:(0,F.useMemo)(()=>{let m=new Map;return e.forEach((i,h)=>m.set(i,h)),lt({variables:N,sort:l[0],cellIdToIndex:m})},[N,l,e]),columns:st,getCoreRowModel:ua(),onGlobalFilterChange:n,getFilteredRowModel:da(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter(m){return m.columnDef.enableGlobalFilter??!0},globalFilterFn:"auto",manualSorting:!0,locale:j,onSortingChange:r,getSortedRowModel:ha(),state:{sorting:l,globalFilter:c}});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(va,{className:"w-full",placeholder:"Search",value:c,onChange:m=>n(m.target.value)}),(0,t.jsxs)(Da,{className:O("w-full text-sm flex-1 border-separate border-spacing-0",a),children:[(0,t.jsx)(Ta,{children:(0,t.jsx)(Fe,{className:"whitespace-nowrap text-xs",children:u.getFlatHeaders().map(m=>(0,t.jsx)(Ia,{className:"sticky top-0 bg-background border-b",children:ve(m.column.columnDef.header,m.getContext())},m.id))})}),(0,t.jsx)(La,{children:u.getRowModel().rows.map(m=>(0,t.jsx)(Fe,{className:"hover:bg-accent",children:m.getVisibleCells().map(i=>(0,t.jsx)(qa,{className:"border-b",children:ve(i.column.columnDef.cell,i.getContext())},i.id))},m.id))})]})]})});Ve.displayName="VariableTable";var nt=ye(),rt=be("marimo:session-panel:state",{openSections:["variables"],hasUserInteracted:!1},pe),ot=()=>{let a=(0,nt.c)(24),e=Ue(),s=We(),l=K(fe),r=K(qe),[c,n]=he(rt),g=l.length+r.length,j;a[0]!==g||a[1]!==c.hasUserInteracted||a[2]!==c.openSections?(j=!c.hasUserInteracted&&g>0?[...new Set([...c.openSections,"datasources"])]:c.openSections,a[0]=g,a[1]=c.hasUserInteracted,a[2]=c.openSections,a[3]=j):j=a[3];let N=j,u;a[4]===n?u=a[5]:(u=S=>{n({openSections:S,hasUserInteracted:!0})},a[4]=n,a[5]=u);let m=u,i=!N.includes("datasources")&&g>0,h;a[6]===Symbol.for("react.memo_cache_sentinel")?(h=(0,t.jsx)(le,{className:"w-4 h-4"}),a[6]=h):h=a[6];let p;a[7]!==g||a[8]!==i?(p=i&&(0,t.jsx)(Aa,{children:g}),a[7]=g,a[8]=i,a[9]=p):p=a[9];let d;a[10]===p?d=a[11]:(d=(0,t.jsxs)(Ie,{children:[h,"Data sources",p]}),a[10]=p,a[11]=d);let o;a[12]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(Le,{children:(0,t.jsx)(Ja,{})}),a[12]=o):o=a[12];let b;a[13]===d?b=a[14]:(b=(0,t.jsxs)(Te,{value:"datasources",children:[d,o]}),a[13]=d,a[14]=b);let x;a[15]===Symbol.for("react.memo_cache_sentinel")?(x=(0,t.jsxs)(Ie,{children:[(0,t.jsx)(la,{className:"w-4 h-4"}),"Variables"]}),a[15]=x):x=a[15];let f;a[16]!==s||a[17]!==e?(f=(0,t.jsxs)(Te,{value:"variables",lastItem:!0,children:[x,(0,t.jsx)(Le,{children:Object.keys(e).length===0?(0,t.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground",children:"No variables defined"}):(0,t.jsx)(Ve,{cellIds:s.inOrderIds,variables:e})})]}),a[16]=s,a[17]=e,a[18]=f):f=a[18];let y;return a[19]!==m||a[20]!==N||a[21]!==b||a[22]!==f?(y=(0,t.jsxs)(ma,{type:"multiple",value:N,onValueChange:m,className:"flex flex-col h-full overflow-auto",children:[b,f]}),a[19]=m,a[20]=N,a[21]=b,a[22]=f,a[23]=y):y=a[23],y};export{ot as default};
|
|
1
|
+
import{s as ie}from"./chunk-LvLJmgfZ.js";import{d as de,l as he,p as ue,u as K}from"./useEvent-D91BmmQi.js";import{t as Pe}from"./react-Bj1aDYRI.js";import{Ar as Me,At as Ee,Br as xe,D as Oe,Fn as pe,Fr as fe,Gt as Re,In as Ue,Ir as Ae,Kt as ze,Lr as Ge,M as We,Nr as se,Oi as be,P as He,Pr as ge,Rn as Ke,Rt as Je,Ur as Qe,Vr as je,Wr as Ne,Wt as Xe,_n as Ye,a as Ze,ar as ea,cr as aa,f as ta,hr as sa,or as la,vr as na,yr as le}from"./cells-k7Js5h2t.js";import"./react-dom-CSu739Rf.js";import{t as ye}from"./compiler-runtime-B3qBwwSJ.js";import{c as ra}from"./utils-CvI-39U6.js";import{t as oa}from"./ErrorBoundary-DyYDV0HI.js";import{t as O}from"./cn-DCUzRj2J.js";import{t as ca}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-DFky0PAA.js";import{n as ma}from"./multi-map-C4OANz8X.js";import"./popover-CNCYAwbC.js";import{$ as ve,Q as ne,et as ia,f as we,g as Se,h as re,m as oe,nt as da,p as ee,rt as ha,tt as ua,u as xa}from"./JsonOutput-DXzjDImT.js";import"./download-BS31LU22.js";import{r as Ce}from"./radio-group-DS_mmqHJ.js";import{t as ce}from"./tooltip-B_PkSKN3.js";import{r as pa,t as ae}from"./button-BbCh-29a.js";import"./dist-D0HyMpgV.js";import{u as J}from"./arrays-DYDL-3-i.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{i as fa}from"./strings-wdPMRf6Z.js";import{r as ba}from"./requests-DIwGYs0l.js";import{t as ga}from"./createLucideIcon-D5guW7EU.js";import{t as ja}from"./x-C-6liIBr.js";import{a as Na,r as ya}from"./tree-actions-XvgFV23w.js";import"./markdown-renderer-BwjWZESf.js";import{t as _e}from"./add-connection-dialog-CTTPp4DA.js";import{t as ke}from"./plus-BgB18UzY.js";import{a as va}from"./input-DA8xlX70.js";import{n as wa,o as Sa}from"./column-preview-cHpj1JI3.js";import{t as Ca}from"./workflow-Bm8qF7yj.js";import"./dist-HyCgERnW.js";import"./dist-BwnT-_gD.js";import"./dist-rBRbke5D.js";import"./dist-RMRSa-Mj.js";import"./dist-BURue7-e.js";import"./session-0B5NBztP.js";import"./purify.es-B9KxLTTS.js";import"./dates-CTxr0EqQ.js";import{t as _a}from"./copy-icon-BuRdHNPA.js";import{t as ka}from"./context-QkTujrKn.js";import"./utils-DCL4n9wx.js";import"./vega-loader.browser-C8wT63Va.js";import"./defaultLocale-BLUna9fQ.js";import"./defaultLocale-DzliDDTm.js";import{t as $e}from"./cell-link-spbX-mlL.js";import"./chunk-5FQGJX7Z-Bp9g5nD2.js";import{r as $a}from"./html-to-image-rLeQGF-G.js";import{o as Fa}from"./focus-CRI5ilWC.js";import{n as me}from"./useAsyncData-bgszE9F0.js";import{a as Ta,i as Ia,n as La,o as Fe,r as qa,t as Da}from"./table-BGPSHfig.js";import"./react-resizable-panels.browser.esm-CV8-hvjx.js";import{a as Va,f as Ba,o as te,t as Pa}from"./command-BmOGG6-2.js";import{n as Ma}from"./icons-Ol38nIbL.js";import{t as Ea}from"./empty-state-vCWg-_A9.js";import{n as Oa,t as Ra}from"./common-Zqa_rd3u.js";import{a as Ua,i as Aa,n as Te,r as Ie,t as Le}from"./components-CXG-2UWv.js";var za=ga("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"}]]),A=ye(),F=ie(Pe(),1),t=ie(ca(),1),$={engineEmpty:"pl-3",engine:"pl-3 pr-2",database:"pl-4",schemaEmpty:"pl-8",schema:"pl-7",schemaLoading:"pl-8",tableLoading:"pl-11",tableSchemaless:"pl-8",tableWithSchema:"pl-12",columnLocal:"pl-5",columnSql:"pl-13",columnPreview:"pl-10"},Ga=ue(a=>{let e=a(fe),s=a(Ke),l=a(Ze);return J(e,r=>{if(!r.variable_name)return-1;let c=Object.values(s).find(g=>g.name===r.variable_name);if(!c)return 0;let n=l.inOrderIds.indexOf(c.declaredBy[0]);return n===-1?0:n})});const Wa=be("marimo:datasources:hideEmpty",!1,pe,{getOnInit:!0});function Ha(a){return a.tables_resolved!==!1&&a.tables.length===0}function Ka(a){let e=!1,s=[];for(let l of a){if(l.schemas_resolved!==!1&&l.schemas.length===0){e=!0;continue}if(l.schemas.length===0){s.push(l);continue}let r=l.schemas.filter(c=>!Ha(c));if(r.length===0){e=!0;continue}if(r.length===l.schemas.length){s.push(l);continue}e=!0,s.push({...l,schemas:r})}return e?s:a}const qe=ue(a=>{let e=new Map(a(Me));for(let s of Ne){let l=e.get(s);l&&(l.databases.length===0&&e.delete(s),l.databases.length===1&&l.databases[0].name==="memory"&&l.databases[0].schemas.length===0&&e.delete(s))}return J([...e.values()],s=>Ne.has(s.name)?1:0)}),Ja=()=>{let a=(0,A.c)(42),[e,s]=F.useState(""),[l,r]=he(Wa),c=de(ge),n=K(Ga),g=K(qe),j;e:{if(!l){j=g;break e}let v,w;a[0]===g?(v=a[1],w=a[2]):(v=!1,w=g.map(k=>{let T=Ka(k.databases);return T===k.databases?k:(v=!0,{...k,databases:T})}),a[0]=g,a[1]=v,a[2]=w),j=v?w:g}let N=j;if(n.length===0&&N.length===0){let v;return a[3]===Symbol.for("react.memo_cache_sentinel")?(v=(0,t.jsx)(Ea,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:(0,t.jsx)(_e,{children:(0,t.jsxs)(ae,{variant:"outline",size:"sm",children:["Add database or catalog",(0,t.jsx)(ke,{className:"h-4 w-4 ml-2"})]})}),icon:(0,t.jsx)(le,{})}),a[3]=v):v=a[3],v}let u=!!e.trim(),m;a[4]===c?m=a[5]:(m=v=>{c(v.length>0),s(v)},a[4]=c,a[5]=m);let i;a[6]!==e||a[7]!==m?(i=(0,t.jsx)(Va,{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]=i):i=a[8];let h;a[9]===u?h=a[10]:(h=u&&(0,t.jsx)("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>s(""),children:(0,t.jsx)(ja,{className:"h-4 w-4"})}),a[9]=u,a[10]=h);let p=!l,d;a[11]!==l||a[12]!==r?(d=()=>r(!l),a[11]=l,a[12]=r,a[13]=d):d=a[13];let o;a[14]!==p||a[15]!==d?(o=(0,t.jsx)(Na,{"data-testid":"datasources-hide-empty-button",isVisible:p,onToggle:d,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]=p,a[15]=d,a[16]=o):o=a[16];let b;a[17]===Symbol.for("react.memo_cache_sentinel")?(b=(0,t.jsx)(_e,{children:(0,t.jsx)(ae,{variant:"ghost",size:"sm",className:"px-2 rounded-none focus-visible:outline-hidden",children:(0,t.jsx)(ke,{className:"h-4 w-4"})})}),a[17]=b):b=a[17];let x;a[18]!==i||a[19]!==h||a[20]!==o?(x=(0,t.jsxs)("div",{className:"flex items-center w-full border-b",children:[i,h,o,b]}),a[18]=i,a[19]=h,a[20]=o,a[21]=x):x=a[21];let f;if(a[22]!==N||a[23]!==u||a[24]!==e){let v;a[26]!==u||a[27]!==e?(v=w=>(0,t.jsx)(Qa,{connection:w,hasChildren:w.databases.length>0,children:w.databases.map(k=>(0,t.jsx)(Xa,{engineName:w.name,database:k,hasSearch:u,children:(0,t.jsx)(Ya,{schemas:k.schemas,defaultSchema:w.default_schema,defaultDatabase:w.default_database,engineName:w.name,databaseName:k.name,hasSearch:u,searchValue:e,dialect:w.dialect})},k.name))},w.name),a[26]=u,a[27]=e,a[28]=v):v=a[28],f=N.map(v),a[22]=N,a[23]=u,a[24]=e,a[25]=f}else f=a[25];let y;a[29]!==N.length||a[30]!==n.length?(y=N.length>0&&n.length>0&&(0,t.jsxs)(we,{className:$.engine,children:[(0,t.jsx)(Ma,{className:"h-4 w-4 text-muted-foreground"}),(0,t.jsx)("span",{className:"text-xs",children:"Python"})]}),a[29]=N.length,a[30]=n.length,a[31]=y):y=a[31];let S;a[32]!==e||a[33]!==n?(S=n.length>0&&(0,t.jsx)(De,{tables:n,searchValue:e}),a[32]=e,a[33]=n,a[34]=S):S=a[34];let C;a[35]!==y||a[36]!==S||a[37]!==f?(C=(0,t.jsxs)(Ba,{className:"flex flex-col",children:[f,y,S]}),a[35]=y,a[36]=S,a[37]=f,a[38]=C):C=a[38];let _;return a[39]!==C||a[40]!==x?(_=(0,t.jsxs)(Pa,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden",shouldFilter:!1,children:[x,C]}),a[39]=C,a[40]=x,a[41]=_):_=a[41],_};var Qa=a=>{let e=(0,A.c)(25),{connection:s,children:l,hasChildren:r}=a,c=s.name===Qe,n=c?"In-Memory":s.name,{previewDataSourceConnection:g}=ba(),j;e[0]!==s.name||e[1]!==g?(j=async()=>{await g({engine:s.name})},e[0]=s.name,e[1]=g,e[2]=j):j=e[2];let N=j,u;e[3]===s.dialect?u=e[4]:(u=(0,t.jsx)(Ee,{className:"h-4 w-4 text-muted-foreground",name:s.dialect}),e[3]=s.dialect,e[4]=u);let m;e[5]===s.dialect?m=e[6]:(m=ea(s.dialect),e[5]=s.dialect,e[6]=m);let i;e[7]===m?i=e[8]:(i=(0,t.jsx)("span",{className:"text-xs",children:m}),e[7]=m,e[8]=i);let h=n,p;e[9]===h?p=e[10]:(p=(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",(0,t.jsx)(Ua,{variableName:h}),")"]}),e[9]=h,e[10]=p);let d;e[11]!==N||e[12]!==c?(d=!c&&(0,t.jsx)(ya,{onClick:N,tooltip:"Refresh connection",className:"ml-auto h-4 p-0",iconClassName:"h-3.5 w-3.5"}),e[11]=N,e[12]=c,e[13]=d):d=e[13];let o;e[14]!==u||e[15]!==i||e[16]!==p||e[17]!==d?(o=(0,t.jsxs)(we,{className:$.engine,children:[u,i,p,d]}),e[14]=u,e[15]=i,e[16]=p,e[17]=d,e[18]=o):o=e[18];let b;e[19]!==l||e[20]!==r?(b=r?l:(0,t.jsx)(ee,{content:"No databases available",className:$.engineEmpty}),e[19]=l,e[20]=r,e[21]=b):b=e[21];let x;return e[22]!==o||e[23]!==b?(x=(0,t.jsxs)(t.Fragment,{children:[o,b]}),e[22]=o,e[23]=b,e[24]=x):x=e[24],x},Xa=a=>{let e=(0,A.c)(26),{hasSearch:s,engineName:l,database:r,children:c}=a,[n,g]=F.useState(!1),[j,N]=F.useState(!1),[u,m]=F.useState(s);u!==s&&(m(s),g(s));let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=O("text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",$.database),e[0]=i):i=e[0];let h;e[1]!==n||e[2]!==j?(h=()=>{g(!n),N(!j)},e[1]=n,e[2]=j,e[3]=h):h=e[3];let p=`${l}:${r.name}`,d;e[4]===n?d=e[5]:(d=(0,t.jsx)(Se,{isExpanded:n}),e[4]=n,e[5]=d);let o=j&&n?"text-foreground":"text-muted-foreground",b;e[6]===o?b=e[7]:(b=O("h-4 w-4",o),e[6]=o,e[7]=b);let x;e[8]===b?x=e[9]:(x=(0,t.jsx)(le,{className:b}),e[8]=b,e[9]=x);let f=j&&n&&"font-semibold",y;e[10]===f?y=e[11]:(y=O(f),e[10]=f,e[11]=y);let S;e[12]===r.name?S=e[13]:(S=r.name===""?(0,t.jsx)("i",{children:"Not connected"}):r.name,e[12]=r.name,e[13]=S);let C;e[14]!==S||e[15]!==y?(C=(0,t.jsx)("span",{className:y,children:S}),e[14]=S,e[15]=y,e[16]=C):C=e[16];let _;e[17]!==C||e[18]!==h||e[19]!==p||e[20]!==d||e[21]!==x?(_=(0,t.jsxs)(te,{className:i,onSelect:h,value:p,children:[d,x,C]}),e[17]=C,e[18]=h,e[19]=p,e[20]=d,e[21]=x,e[22]=_):_=e[22];let v=n&&c,w;return e[23]!==_||e[24]!==v?(w=(0,t.jsxs)(t.Fragment,{children:[_,v]}),e[23]=_,e[24]=v,e[25]=w):w=e[25],w},Ya=({schemas:a,defaultSchema:e,defaultDatabase:s,dialect:l,engineName:r,databaseName:c,hasSearch:n,searchValue:g})=>{let{addSchemaList:j}=se(),[N,u]=F.useState(!1),[m,i]=F.useState(!1),{isPending:h,error:p}=me(async()=>{if(a.length===0&&r&&!N){u(!0),i(!0);try{j({schemas:(await Xe.request({engine:r,database:c})).schemas??[],sqlSchemaContext:{engine:r,database:c}})}finally{i(!1)}}},[a.length,r,c,N]);return h||m?(0,t.jsx)(re,{message:"Loading schemas...",className:$.schemaLoading}):p?(0,t.jsx)(oe,{error:p,className:$.schemaLoading}):a.length===0?(0,t.jsx)(ee,{content:"No schemas available",className:$.schemaEmpty}):(0,t.jsx)(t.Fragment,{children:a.filter(d=>g?d.tables.some(o=>o.name.toLowerCase().includes(g.toLowerCase())):!0).map(d=>(0,t.jsx)(Za,{databaseName:c,schema:d,hasSearch:n,children:(0,t.jsx)(De,{tables:d.tables,searchValue:g,sqlTableContext:{engine:r,database:c,schema:d.name,defaultSchema:e,defaultDatabase:s,dialect:l}})},d.name))})},Za=a=>{let e=(0,A.c)(24),{databaseName:s,schema:l,children:r,hasSearch:c}=a,[n,g]=F.useState(c),[j,N]=F.useState(!1),u=`${s}:${l.name}`;if(xe(l.name))return r;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=O("text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",$.schema),e[0]=m):m=e[0];let i;e[1]!==n||e[2]!==j?(i=()=>{g(!n),N(!j)},e[1]=n,e[2]=j,e[3]=i):i=e[3];let h;e[4]===n?h=e[5]:(h=(0,t.jsx)(Se,{isExpanded:n}),e[4]=n,e[5]=h);let p=j&&n&&"text-foreground",d;e[6]===p?d=e[7]:(d=O("h-4 w-4 text-muted-foreground",p),e[6]=p,e[7]=d);let o;e[8]===d?o=e[9]:(o=(0,t.jsx)(sa,{className:d}),e[8]=d,e[9]=o);let b=j&&n&&"font-semibold",x;e[10]===b?x=e[11]:(x=O(b),e[10]=b,e[11]=x);let f;e[12]!==l.name||e[13]!==x?(f=(0,t.jsx)("span",{className:x,children:l.name}),e[12]=l.name,e[13]=x,e[14]=f):f=e[14];let y;e[15]!==i||e[16]!==h||e[17]!==o||e[18]!==f||e[19]!==u?(y=(0,t.jsxs)(te,{className:m,onSelect:i,value:u,children:[h,o,f]}),e[15]=i,e[16]=h,e[17]=o,e[18]=f,e[19]=u,e[20]=y):y=e[20];let S=n&&r,C;return e[21]!==y||e[22]!==S?(C=(0,t.jsxs)(t.Fragment,{children:[y,S]}),e[21]=y,e[22]=S,e[23]=C):C=e[23],C},De=a=>{let e=(0,A.c)(24),{tables:s,sqlTableContext:l,searchValue:r}=a,{addTableList:c}=se(),[n,g]=F.useState(!1),[j,N]=F.useState(!1),u;e[0]!==c||e[1]!==l||e[2]!==s.length||e[3]!==n?(u=async()=>{if(s.length===0&&l&&!n){g(!0),N(!0);let{engine:o,database:b,schema:x}=l,f=await ze.request({engine:o,database:b,schema:x});if(!(f!=null&&f.tables))throw N(!1),Error("No tables available");c({tables:f.tables,sqlTableContext:l}),N(!1)}},e[0]=c,e[1]=l,e[2]=s.length,e[3]=n,e[4]=u):u=e[4];let m;e[5]!==l||e[6]!==s.length||e[7]!==n?(m=[s.length,l,n],e[5]=l,e[6]=s.length,e[7]=n,e[8]=m):m=e[8];let{isPending:i,error:h}=me(u,m);if(i||j){let o;return e[9]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(re,{message:"Loading tables...",className:$.tableLoading}),e[9]=o):o=e[9],o}if(h){let o;return e[10]===h?o=e[11]:(o=(0,t.jsx)(oe,{error:h,className:$.tableLoading}),e[10]=h,e[11]=o),o}if(s.length===0){let o;return e[12]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(ee,{content:"No tables found",className:$.tableLoading}),e[12]=o):o=e[12],o}let p;if(e[13]!==r||e[14]!==l||e[15]!==s){let o;e[17]===r?o=e[18]:(o=f=>r?f.name.toLowerCase().includes(r.toLowerCase()):!0,e[17]=r,e[18]=o);let b=s.filter(o),x;e[19]!==r||e[20]!==l?(x=f=>(0,t.jsx)(et,{table:f,sqlTableContext:l,isSearching:!!r},f.name),e[19]=r,e[20]=l,e[21]=x):x=e[21],p=b.map(x),e[13]=r,e[14]=l,e[15]=s,e[16]=p}else p=e[16];let d;return e[22]===p?d=e[23]:(d=(0,t.jsx)(t.Fragment,{children:p}),e[22]=p,e[23]=d),d},et=a=>{let e=(0,A.c)(64),{table:s,sqlTableContext:l,isSearching:r}=a,{addTable:c}=se(),[n,g]=F.useState(!1),[j,N]=F.useState(!1),u=s.columns.length>0,m;e[0]!==c||e[1]!==n||e[2]!==l||e[3]!==s.name||e[4]!==u||e[5]!==j?(m=async()=>{if(n&&!u&&l&&!j){N(!0);let{engine:B,database:Y,schema:Be}=l,Z=await Re.request({engine:B,database:Y,schema:Be,tableName:s.name});if(!(Z!=null&&Z.table))throw Error("No table details available");c({table:Z.table,sqlTableContext:l})}},e[0]=c,e[1]=n,e[2]=l,e[3]=s.name,e[4]=u,e[5]=j,e[6]=m):m=e[6];let i;e[7]!==n||e[8]!==u?(i=[n,u],e[7]=n,e[8]=u,e[9]=i):i=e[9];let{isFetching:h,isPending:p,error:d}=me(m,i),o=K(ra),b=Fa(),{createNewCell:x}=Oe(),f=Ce(),y;e[10]!==f||e[11]!==o||e[12]!==x||e[13]!==b||e[14]!==l||e[15]!==s?(y=()=>{$a({autoInstantiate:o,createNewCell:x,fromCellId:b}),f((()=>{if(s.source_type==="catalog"){let B=l!=null&&l.database?`${l.database}.${s.name}`:s.name;return`${s.engine}.load_table("${B}")`}if(l)return je({table:s,columnName:"*",sqlTableContext:l});switch(s.source_type){case"local":return`mo.ui.table(${s.name})`;case"duckdb":case"connection":return je({table:s,columnName:"*",sqlTableContext:l});default:return fa(s.source_type),""}})())},e[10]=f,e[11]=o,e[12]=x,e[13]=b,e[14]=l,e[15]=s,e[16]=y):y=e[16];let S=y,C;e[17]!==s.num_columns||e[18]!==s.num_rows?(C=()=>{let B=[];return s.num_rows!=null&&B.push(`${s.num_rows} rows`),s.num_columns!=null&&B.push(`${s.num_columns} columns`),B.length===0?null:(0,t.jsx)("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:B.join(", ")})})},e[17]=s.num_columns,e[18]=s.num_rows,e[19]=C):C=e[19];let _=C,v;e[20]!==d||e[21]!==h||e[22]!==p||e[23]!==l||e[24]!==s?(v=()=>{if(p||h)return(0,t.jsx)(re,{message:"Loading columns...",className:$.tableLoading});if(d)return(0,t.jsx)(oe,{error:d,className:$.tableLoading});let B=s.columns;return B.length===0?(0,t.jsx)(ee,{content:"No columns found",className:$.tableLoading}):B.map(Y=>(0,t.jsx)(at,{table:s,column:Y,sqlTableContext:l},Y.name))},e[20]=d,e[21]=h,e[22]=p,e[23]=l,e[24]=s,e[25]=v):v=e[25];let w=v,k;e[26]!==n||e[27]!==r||e[28]!==s.source_type||e[29]!==s.type?(k=()=>{if(s.source_type!=="local")return(0,t.jsx)(s.type==="table"?aa:na,{className:"h-3 w-3",strokeWidth:n||r?2.5:void 0})},e[26]=n,e[27]=r,e[28]=s.source_type,e[29]=s.type,e[30]=k):k=e[30];let T=k,P=l?`${l.database}.${l.schema}.${s.name}`:s.name,M=l&&(xe(l.schema)?$.tableSchemaless:$.tableWithSchema),E=(n||r)&&"font-semibold",I;e[31]!==M||e[32]!==E?(I=O("rounded-none group h-8 cursor-pointer",M,E),e[31]=M,e[32]=E,e[33]=I):I=e[33];let L;e[34]===n?L=e[35]:(L=()=>g(!n),e[34]=n,e[35]=L);let q;e[36]===T?q=e[37]:(q=T(),e[36]=T,e[37]=q);let V;e[38]===s.name?V=e[39]:(V=(0,t.jsx)("span",{className:"text-sm",children:s.name}),e[38]=s.name,e[39]=V);let R;e[40]!==q||e[41]!==V?(R=(0,t.jsxs)("div",{className:"flex gap-2 items-center flex-1 pl-1",children:[q,V]}),e[40]=q,e[41]=V,e[42]=R):R=e[42];let U;e[43]===_?U=e[44]:(U=_(),e[43]=_,e[44]=U);let D;e[45]===S?D=e[46]:(D=pa.stopPropagation(()=>S()),e[45]=S,e[46]=D);let Q;e[47]===Symbol.for("react.memo_cache_sentinel")?(Q=(0,t.jsx)(Sa,{className:"h-3 w-3"}),e[47]=Q):Q=e[47];let G;e[48]===D?G=e[49]:(G=(0,t.jsx)(ce,{content:"Add table to notebook",delayDuration:400,children:(0,t.jsx)(ae,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:D,children:Q})}),e[48]=D,e[49]=G);let W;e[50]!==n||e[51]!==L||e[52]!==R||e[53]!==U||e[54]!==G||e[55]!==I||e[56]!==P?(W=(0,t.jsxs)(te,{className:I,value:P,"aria-selected":n,forceMount:!0,onSelect:L,children:[R,U,G]}),e[50]=n,e[51]=L,e[52]=R,e[53]=U,e[54]=G,e[55]=I,e[56]=P,e[57]=W):W=e[57];let H;e[58]!==n||e[59]!==w?(H=n&&w(),e[58]=n,e[59]=w,e[60]=H):H=e[60];let X;return e[61]!==W||e[62]!==H?(X=(0,t.jsxs)(t.Fragment,{children:[W,H]}),e[61]=W,e[62]=H,e[63]=X):X=e[63],X},at=a=>{var R,U;let e=(0,A.c)(48),{table:s,column:l,sqlTableContext:r}=a,[c,n]=F.useState(!1),g=K(ge),j=de(Ae);g&&c&&n(!1),j(c?D=>new Set([...D,`${s.name}:${l.name}`]):D=>(D.delete(`${s.name}:${l.name}`),new Set(D)));let N=Ce(),{columnsPreviews:u}=Ge(),m;e[0]!==l.name||e[1]!==s.primary_keys?(m=((R=s.primary_keys)==null?void 0:R.includes(l.name))||!1,e[0]=l.name,e[1]=s.primary_keys,e[2]=m):m=e[2];let i=m,h;e[3]!==l.name||e[4]!==s.indexes?(h=((U=s.indexes)==null?void 0:U.includes(l.name))||!1,e[3]=l.name,e[4]=s.indexes,e[5]=h):h=e[5];let p=h,d;e[6]===N?d=e[7]:(d=D=>{N(D)},e[6]=N,e[7]=d);let o=d,b=tt,x=c?"font-semibold":"",f;e[8]!==l.name||e[9]!==x?(f=(0,t.jsx)("span",{className:x,children:l.name}),e[8]=l.name,e[9]=x,e[10]=f):f=e[10];let y=f,S=`${s.name}.${l.name}`,C=`${s.name}.${l.name}`,_;e[11]===c?_=e[12]:(_=()=>n(!c),e[11]=c,e[12]=_);let v=r?$.columnSql:$.columnLocal,w;e[13]===v?w=e[14]:(w=O("flex flex-row gap-2 items-center flex-1",v),e[13]=v,e[14]=w);let k;e[15]!==l.type||e[16]!==y?(k=(0,t.jsx)(xa,{columnName:y,dataType:l.type}),e[15]=l.type,e[16]=y,e[17]=k):k=e[17];let T;e[18]===i?T=e[19]:(T=i&&b({tooltipContent:"Primary key",content:"PK"}),e[18]=i,e[19]=T);let P;e[20]===p?P=e[21]:(P=p&&b({tooltipContent:"Indexed",content:"IDX"}),e[20]=p,e[21]=P);let M;e[22]!==w||e[23]!==k||e[24]!==T||e[25]!==P?(M=(0,t.jsxs)("div",{className:w,children:[k,T,P]}),e[22]=w,e[23]=k,e[24]=T,e[25]=P,e[26]=M):M=e[26];let E;e[27]===l.name?E=e[28]:(E=(0,t.jsx)(ce,{content:"Copy column name",delayDuration:400,children:(0,t.jsx)(ae,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:(0,t.jsx)(_a,{tooltip:!1,value:l.name,className:"h-3 w-3"})})}),e[27]=l.name,e[28]=E);let I;e[29]===l.external_type?I=e[30]:(I=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:l.external_type}),e[29]=l.external_type,e[30]=I);let L;e[31]!==M||e[32]!==E||e[33]!==I||e[34]!==S||e[35]!==C||e[36]!==_?(L=(0,t.jsxs)(te,{className:"rounded-none py-1 group cursor-pointer",value:C,onSelect:_,children:[M,E,I]},S),e[31]=M,e[32]=E,e[33]=I,e[34]=S,e[35]=C,e[36]=_,e[37]=L):L=e[37];let q;e[38]!==l||e[39]!==u||e[40]!==o||e[41]!==c||e[42]!==r||e[43]!==s?(q=c&&(0,t.jsx)("div",{className:O($.columnPreview,"pr-2 py-2 bg-(--slate-1) shadow-inner border-b"),children:(0,t.jsx)(oa,{children:(0,t.jsx)(wa,{table:s,column:l,onAddColumnChart:o,preview:u.get(r?`${r.database}.${r.schema}.${s.name}:${l.name}`:`${s.name}:${l.name}`),sqlTableContext:r})})}),e[38]=l,e[39]=u,e[40]=o,e[41]=c,e[42]=r,e[43]=s,e[44]=q):q=e[44];let V;return e[45]!==L||e[46]!==q?(V=(0,t.jsxs)(t.Fragment,{children:[L,q]}),e[45]=L,e[46]=q,e[47]=V):V=e[47],V};function tt(a){let{tooltipContent:e,content:s}=a;return(0,t.jsx)(ce,{content:e,delayDuration:100,children:(0,t.jsx)("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:s})})}function ps(a){return a}var z={name:"name",type:"type-value",defs:"defs-refs"},st=[{id:z.name,accessorFn:a=>[a.name,a.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:a})=>(0,t.jsx)(ne,{header:"Name",column:a}),cell:({getValue:a})=>{let[e,s]=a();return(0,t.jsx)(Ra,{name:e,declaredBy:s})}},{id:z.type,accessorFn:a=>[a.dataType,a.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:a})=>(0,t.jsx)(ne,{header:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("span",{children:"Type"}),(0,t.jsx)("span",{children:"Value"})]}),column:a}),cell:({getValue:a})=>{let[e,s]=a();return(0,t.jsxs)("div",{className:"max-w-[150px]",children:[(0,t.jsx)("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),(0,t.jsx)("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:s??"",children:s})]})}},{id:z.defs,accessorFn:a=>[a.declaredBy,a.usedBy,a.name,a.declaredByNames,a.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:a})=>(0,t.jsx)(ne,{header:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("span",{children:"Declared By"}),(0,t.jsx)("span",{children:"Used By"})]}),column:a}),cell:({getValue:a})=>{let[e,s,l]=a(),r=c=>{let n=ta(c);n&&Ye(n,l)};return(0,t.jsxs)("div",{className:"flex flex-col gap-1 py-1",children:[(0,t.jsxs)("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[(0,t.jsx)("span",{title:"Declared by",children:(0,t.jsx)(za,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?(0,t.jsx)($e,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):(0,t.jsx)("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((c,n)=>(0,t.jsxs)("span",{className:"flex",children:[(0,t.jsx)($e,{variant:"focus",cellId:c,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(c)},c),n<e.length-1&&", "]},c))})]}),(0,t.jsxs)("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[(0,t.jsx)("span",{title:"Used by",children:(0,t.jsx)(Ca,{className:"w-3.5 h-3.5 text-muted-foreground"})}),(0,t.jsx)(Oa,{maxCount:3,cellIds:s,skipScroll:!0,onClick:r})]})]})}}];function lt({variables:a,sort:e,cellIdToIndex:s}){e||(e={id:z.defs,desc:!1});let l=[];switch(e.id){case z.name:l=J(a,r=>r.name);break;case z.type:l=J(a,r=>r.dataType);break;case z.defs:l=J(a,r=>s.get(r.declaredBy[0]));break}return e.desc?l.toReversed():l}const Ve=(0,F.memo)(({className:a,cellIds:e,variables:s})=>{let[l,r]=F.useState([]),[c,n]=F.useState(""),g=He(),{locale:j}=ka(),N=(0,F.useMemo)(()=>{let m=i=>{let h=g[i];return Je(h)?`cell-${e.indexOf(i)}`:h??`cell-${e.indexOf(i)}`};return Object.values(s).map(i=>({...i,declaredByNames:i.declaredBy.map(m),usedByNames:i.usedBy.map(m)}))},[s,g,e]),u=ia({data:(0,F.useMemo)(()=>{let m=new Map;return e.forEach((i,h)=>m.set(i,h)),lt({variables:N,sort:l[0],cellIdToIndex:m})},[N,l,e]),columns:st,getCoreRowModel:ua(),onGlobalFilterChange:n,getFilteredRowModel:da(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter(m){return m.columnDef.enableGlobalFilter??!0},globalFilterFn:"auto",manualSorting:!0,locale:j,onSortingChange:r,getSortedRowModel:ha(),state:{sorting:l,globalFilter:c}});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(va,{className:"w-full",placeholder:"Search",value:c,onChange:m=>n(m.target.value)}),(0,t.jsxs)(Da,{className:O("w-full text-sm flex-1 border-separate border-spacing-0",a),children:[(0,t.jsx)(Ta,{children:(0,t.jsx)(Fe,{className:"whitespace-nowrap text-xs",children:u.getFlatHeaders().map(m=>(0,t.jsx)(Ia,{className:"sticky top-0 bg-background border-b",children:ve(m.column.columnDef.header,m.getContext())},m.id))})}),(0,t.jsx)(La,{children:u.getRowModel().rows.map(m=>(0,t.jsx)(Fe,{className:"hover:bg-accent",children:m.getVisibleCells().map(i=>(0,t.jsx)(qa,{className:"border-b",children:ve(i.column.columnDef.cell,i.getContext())},i.id))},m.id))})]})]})});Ve.displayName="VariableTable";var nt=ye(),rt=be("marimo:session-panel:state",{openSections:["variables"],hasUserInteracted:!1},pe),ot=()=>{let a=(0,nt.c)(24),e=Ue(),s=We(),l=K(fe),r=K(qe),[c,n]=he(rt),g=l.length+r.length,j;a[0]!==g||a[1]!==c.hasUserInteracted||a[2]!==c.openSections?(j=!c.hasUserInteracted&&g>0?[...new Set([...c.openSections,"datasources"])]:c.openSections,a[0]=g,a[1]=c.hasUserInteracted,a[2]=c.openSections,a[3]=j):j=a[3];let N=j,u;a[4]===n?u=a[5]:(u=S=>{n({openSections:S,hasUserInteracted:!0})},a[4]=n,a[5]=u);let m=u,i=!N.includes("datasources")&&g>0,h;a[6]===Symbol.for("react.memo_cache_sentinel")?(h=(0,t.jsx)(le,{className:"w-4 h-4"}),a[6]=h):h=a[6];let p;a[7]!==g||a[8]!==i?(p=i&&(0,t.jsx)(Aa,{children:g}),a[7]=g,a[8]=i,a[9]=p):p=a[9];let d;a[10]===p?d=a[11]:(d=(0,t.jsxs)(Ie,{children:[h,"Data sources",p]}),a[10]=p,a[11]=d);let o;a[12]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(Le,{children:(0,t.jsx)(Ja,{})}),a[12]=o):o=a[12];let b;a[13]===d?b=a[14]:(b=(0,t.jsxs)(Te,{value:"datasources",children:[d,o]}),a[13]=d,a[14]=b);let x;a[15]===Symbol.for("react.memo_cache_sentinel")?(x=(0,t.jsxs)(Ie,{children:[(0,t.jsx)(la,{className:"w-4 h-4"}),"Variables"]}),a[15]=x):x=a[15];let f;a[16]!==s||a[17]!==e?(f=(0,t.jsxs)(Te,{value:"variables",lastItem:!0,children:[x,(0,t.jsx)(Le,{children:Object.keys(e).length===0?(0,t.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground",children:"No variables defined"}):(0,t.jsx)(Ve,{cellIds:s.inOrderIds,variables:e})})]}),a[16]=s,a[17]=e,a[18]=f):f=a[18];let y;return a[19]!==m||a[20]!==N||a[21]!==b||a[22]!==f?(y=(0,t.jsxs)(ma,{type:"multiple",value:N,onValueChange:m,className:"flex flex-col h-full overflow-auto",children:[b,f]}),a[19]=m,a[20]=N,a[21]=b,a[22]=f,a[23]=y):y=a[23],y};export{ot as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as I}from"./chunk-LvLJmgfZ.js";import"./useEvent-D91BmmQi.js";import{t as O}from"./react-Bj1aDYRI.js";import{D as P}from"./cells-k7Js5h2t.js";import"./react-dom-CSu739Rf.js";import{t as $}from"./compiler-runtime-B3qBwwSJ.js";import{n as q}from"./useEventListener-DvoEXWke.js";import{n as F}from"./constants-DMpttj8Q.js";import{t as G}from"./cn-DCUzRj2J.js";import{t as R}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-DFky0PAA.js";import{t as T}from"./tooltip-B_PkSKN3.js";import{t as w}from"./button-BbCh-29a.js";import{st as W}from"./dist-D0HyMpgV.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{r as A}from"./requests-DIwGYs0l.js";import{n as M,t as B}from"./LazyAnyLanguageCodeMirror-C7ALwTI_.js";import{t as J}from"./x-C-6liIBr.js";import{t as K}from"./spinner-Bhir8k53.js";import{t as L}from"./plus-BgB18UzY.js";import"./dist-HyCgERnW.js";import"./dist-BwnT-_gD.js";import"./dist-rBRbke5D.js";import"./dist-RMRSa-Mj.js";import"./dist-BURue7-e.js";import"./session-0B5NBztP.js";import{r as U}from"./useTheme-CI2eq4XN.js";import"./purify.es-B9KxLTTS.js";import{t as V}from"./RenderHTML-B5i6Qdbh.js";import{a as X,c as Y,i as Q,n as Z,r as ee}from"./dialog-DRnNAWYl.js";import{n as te}from"./ImperativeModal-
|
|
1
|
+
import{s as I}from"./chunk-LvLJmgfZ.js";import"./useEvent-D91BmmQi.js";import{t as O}from"./react-Bj1aDYRI.js";import{D as P}from"./cells-k7Js5h2t.js";import"./react-dom-CSu739Rf.js";import{t as $}from"./compiler-runtime-B3qBwwSJ.js";import{n as q}from"./useEventListener-DvoEXWke.js";import{n as F}from"./constants-DMpttj8Q.js";import{t as G}from"./cn-DCUzRj2J.js";import{t as R}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-DFky0PAA.js";import{t as T}from"./tooltip-B_PkSKN3.js";import{t as w}from"./button-BbCh-29a.js";import{st as W}from"./dist-D0HyMpgV.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{r as A}from"./requests-DIwGYs0l.js";import{n as M,t as B}from"./LazyAnyLanguageCodeMirror-C7ALwTI_.js";import{t as J}from"./x-C-6liIBr.js";import{t as K}from"./spinner-Bhir8k53.js";import{t as L}from"./plus-BgB18UzY.js";import"./dist-HyCgERnW.js";import"./dist-BwnT-_gD.js";import"./dist-rBRbke5D.js";import"./dist-RMRSa-Mj.js";import"./dist-BURue7-e.js";import"./session-0B5NBztP.js";import{r as U}from"./useTheme-CI2eq4XN.js";import"./purify.es-B9KxLTTS.js";import{t as V}from"./RenderHTML-B5i6Qdbh.js";import{a as X,c as Y,i as Q,n as Z,r as ee}from"./dialog-DRnNAWYl.js";import{n as te}from"./ImperativeModal-BW1dmntO.js";import{n as se}from"./error-banner-D0xvrLog.js";import{o as re}from"./focus-CRI5ilWC.js";import{n as le}from"./useAsyncData-bgszE9F0.js";import{n as oe,r as ie,t as D}from"./react-resizable-panels.browser.esm-CV8-hvjx.js";import{a as ae,f as ne,o as me,r as ce,t as de}from"./command-BmOGG6-2.js";import{t as pe}from"./empty-state-vCWg-_A9.js";import{n as he,r as fe}from"./panel-context-D7Ggu8Nw.js";import{t as E}from"./kiosk-mode-DhNcHA04.js";var H=$(),C=I(O(),1),s=I(R(),1),xe=q;const ue=t=>{let e=(0,H.c)(6),{children:r}=t,{openModal:i,closeModal:o}=te(),l;e[0]!==o||e[1]!==i?(l=()=>i((0,s.jsx)(je,{onClose:o})),e[0]=o,e[1]=i,e[2]=l):l=e[2];let a;return e[3]!==r||e[4]!==l?(a=(0,s.jsx)(xe,{onClick:l,children:r}),e[3]=r,e[4]=l,e[5]=a):a=e[5],a};var je=t=>{let e=(0,H.c)(4),{onClose:r}=t,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.jsx)(Y,{children:"Contribute a Snippet"}),e[0]=i):i=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=(0,s.jsxs)(X,{children:[i,(0,s.jsxs)(ee,{children:["Have a useful snippet you want to share with the community? Make a pull request"," ",(0,s.jsx)("a",{href:F.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[1]=o):o=e[1];let l;return e[2]===r?l=e[3]:(l=(0,s.jsxs)(Z,{className:"max-w-md",children:[o,(0,s.jsx)(Q,{children:(0,s.jsx)(w,{"data-testid":"snippet-close-button",variant:"default",onClick:r,children:"Close"})})]}),e[2]=r,e[3]=l),l},k=$(),be=[W.lineWrapping],ve=()=>{let t=(0,k.c)(24),{readSnippets:e}=A(),[r,i]=C.useState(),o=he(),l=fe(),a;t[0]===e?a=t[1]:(a=()=>e(),t[0]=e,t[1]=a);let c;t[2]===Symbol.for("react.memo_cache_sentinel")?(c=[],t[2]=c):c=t[2];let{data:N,error:j,isPending:g}=le(a,c);if(j){let m;return t[3]===j?m=t[4]:(m=(0,s.jsx)(se,{error:j}),t[3]=j,t[4]=m),m}if(g||!N){let m;return t[5]===Symbol.for("react.memo_cache_sentinel")?(m=(0,s.jsx)(K,{size:"medium",centered:!0}),t[5]=m):m=t[5],m}let _=o==="vertical",b;t[6]===Symbol.for("react.memo_cache_sentinel")?(b=(0,s.jsx)(ae,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=b):b=t[6];let h,f;t[7]===Symbol.for("react.memo_cache_sentinel")?(h=(0,s.jsxs)("div",{className:"flex items-center w-full border-b",children:[b,(0,s.jsx)(ue,{children:(0,s.jsx)("button",{className:"float-right px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:(0,s.jsx)(L,{className:"h-4 w-4"})})})]}),f=(0,s.jsx)(ce,{children:"No results"}),t[7]=h,t[8]=f):(h=t[7],f=t[8]);let v;t[9]===Symbol.for("react.memo_cache_sentinel")?(v=m=>i(m),t[9]=v):v=t[9];let d;t[10]===N.snippets?d=t[11]:(d=(0,s.jsx)(D,{defaultSize:40,minSize:20,maxSize:70,children:(0,s.jsxs)(de,{className:"h-full rounded-none",children:[h,f,(0,s.jsx)(_e,{onSelect:v,snippets:N.snippets})]})}),t[10]=N.snippets,t[11]=d);let u=_?"h-1":"w-1",p;t[12]===u?p=t[13]:(p=G("bg-border hover:bg-primary/50 transition-colors",u),t[12]=u,t[13]=p);let x;t[14]===p?x=t[15]:(x=(0,s.jsx)(ie,{className:p}),t[14]=p,t[15]=x);let n;t[16]===r?n=t[17]:(n=(0,s.jsx)(D,{defaultSize:60,minSize:20,children:(0,s.jsx)(C.Suspense,{children:(0,s.jsx)("div",{className:"h-full snippet-viewer flex flex-col overflow-hidden",children:r?(0,s.jsx)(Ne,{snippet:r,onClose:()=>i(void 0)},r.title):(0,s.jsx)(pe,{title:"",description:"Click on a snippet to view its content."})})})}),t[16]=r,t[17]=n);let S;return t[18]!==o||t[19]!==l||t[20]!==n||t[21]!==d||t[22]!==x?(S=(0,s.jsx)("div",{className:"flex-1 overflow-hidden h-full",children:(0,s.jsxs)(oe,{direction:o,className:"h-full",children:[d,x,n]},l)}),t[18]=o,t[19]=l,t[20]=n,t[21]=d,t[22]=x,t[23]=S):S=t[23],S},Ne=t=>{let e=(0,k.c)(33),{snippet:r,onClose:i}=t,{theme:o}=U(),{createNewCell:l}=P(),a=re(),c;e[0]!==l||e[1]!==a||e[2]!==r.sections?(c=()=>{for(let n of r.sections.toReversed())n.code&&l({code:n.code,before:!1,cellId:a??"__end__",skipIfCodeExists:!0})},e[0]=l,e[1]=a,e[2]=r.sections,e[3]=c):c=e[3];let N=c,j;e[4]!==l||e[5]!==a?(j=n=>{l({code:n,before:!1,cellId:a??"__end__"})},e[4]=l,e[5]=a,e[6]=j):j=e[6];let g=j,_;e[7]===r.title?_=e[8]:(_=(0,s.jsx)("span",{children:r.title}),e[7]=r.title,e[8]=_);let b;e[9]===Symbol.for("react.memo_cache_sentinel")?(b=(0,s.jsx)(J,{className:"h-4 w-4"}),e[9]=b):b=e[9];let h;e[10]===i?h=e[11]:(h=(0,s.jsx)(w,{size:"sm",variant:"ghost",onClick:i,className:"h-6 w-6 p-0 hover:bg-muted-foreground/10",children:b}),e[10]=i,e[11]=h);let f;e[12]!==_||e[13]!==h?(f=(0,s.jsxs)("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1 flex justify-between items-center",children:[_,h]}),e[12]=_,e[13]=h,e[14]=f):f=e[14];let v;e[15]===Symbol.for("react.memo_cache_sentinel")?(v=(0,s.jsx)(M,{className:"ml-2 h-4 w-4"}),e[15]=v):v=e[15];let d;e[16]===N?d=e[17]:(d=(0,s.jsx)("div",{className:"flex justify-end",children:(0,s.jsx)(E,{children:(0,s.jsxs)(w,{className:"float-right",size:"xs",variant:"outline",onClick:N,children:["Insert snippet",v]})})}),e[16]=N,e[17]=d);let u;if(e[18]!==g||e[19]!==r.sections||e[20]!==r.title||e[21]!==o){let n;e[23]!==g||e[24]!==r.title||e[25]!==o?(n=S=>{let{code:m,html:z,id:y}=S;return z?(0,s.jsx)("div",{children:V({html:z})},`${r.title}-${y}`):m?(0,s.jsxs)("div",{className:"relative hover-actions-parent pr-2",children:[(0,s.jsx)(E,{children:(0,s.jsx)(T,{content:"Insert snippet",children:(0,s.jsx)(w,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{g(m)},children:(0,s.jsx)(M,{className:"h-5 w-5"})})})}),(0,s.jsx)(C.Suspense,{children:(0,s.jsx)(B,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:be,value:m,readOnly:!0},`${r.title}-${y}`)})]},`${r.title}-${y}`):null},e[23]=g,e[24]=r.title,e[25]=o,e[26]=n):n=e[26],u=r.sections.map(n),e[18]=g,e[19]=r.sections,e[20]=r.title,e[21]=o,e[22]=u}else u=e[22];let p;e[27]!==d||e[28]!==u?(p=(0,s.jsxs)("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[d,u]}),e[27]=d,e[28]=u,e[29]=p):p=e[29];let x;return e[30]!==p||e[31]!==f?(x=(0,s.jsxs)(s.Fragment,{children:[f,p]}),e[30]=p,e[31]=f,e[32]=x):x=e[32],x},_e=t=>{let e=(0,k.c)(7),{snippets:r,onSelect:i}=t,o;if(e[0]!==i||e[1]!==r){let a;e[3]===i?a=e[4]:(a=c=>(0,s.jsx)(me,{className:"rounded-none",onSelect:()=>i(c),children:(0,s.jsx)("div",{className:"flex flex-row gap-2 items-center",children:(0,s.jsx)("span",{className:"mt-1 text-accent-foreground",children:c.title})})},c.title),e[3]=i,e[4]=a),o=r.map(a),e[0]=i,e[1]=r,e[2]=o}else o=e[2];let l;return e[5]===o?l=e[6]:(l=(0,s.jsx)(ne,{className:"flex flex-col overflow-auto",children:o}),e[5]=o,e[6]=l),l};export{ve as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as H}from"./chunk-LvLJmgfZ.js";import{d as Z,p as ee,u as F}from"./useEvent-D91BmmQi.js";import{t as te}from"./react-Bj1aDYRI.js";import{M as re,Or as le,Sr as se,q as L}from"./cells-k7Js5h2t.js";import"./react-dom-CSu739Rf.js";import{t as ae}from"./compiler-runtime-B3qBwwSJ.js";import{t as ie}from"./cn-DCUzRj2J.js";import{t as ne}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-DFky0PAA.js";import{t as A}from"./tooltip-B_PkSKN3.js";import"./dist-D0HyMpgV.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{t as oe}from"./createLucideIcon-D5guW7EU.js";import{r as de}from"./x-C-6liIBr.js";import{t as ce}from"./chevron-right-CG5QYXYk.js";import{t as me}from"./circle-check-C17zXg7L.js";import{t as pe}from"./circle-play-CYXX2xu3.js";import"./dist-HyCgERnW.js";import"./dist-BwnT-_gD.js";import"./dist-rBRbke5D.js";import"./dist-RMRSa-Mj.js";import"./dist-BURue7-e.js";import"./session-0B5NBztP.js";import{r as ue}from"./useTheme-CI2eq4XN.js";import"./purify.es-B9KxLTTS.js";import{n as he,r as U}from"./CellStatus-BKK6G_iZ.js";import"./vega-loader.browser-C8wT63Va.js";import{r as fe,t as xe}from"./react-vega-DiXzyRNd.js";import"./defaultLocale-BLUna9fQ.js";import"./defaultLocale-DzliDDTm.js";import{t as ve}from"./cell-link-BFEa98Sc.js";import{n as ge,r as je,t as V}from"./react-resizable-panels.browser.esm-CV8-hvjx.js";import{t as ye}from"./bundle.esm-DjhGJy4I.js";import{t as Ie}from"./empty-state-vCWg-_A9.js";import"./multi-icon-BvuxcR2m.js";import{r as Se}from"./panel-context-D7Ggu8Nw.js";import{t as be}from"./clear-button-UYLFbizO.js";import{n as Ne,t as we}from"./runs-DSnhrBgK.js";var ke=oe("circle-ellipsis",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]),q=ae(),C=H(te(),1);const Y="hoveredCellId",G="cellHover";var Re="cellNum",J="cell",D="startTimestamp",K="endTimestamp",Q="status";function Te(t,e,r,a){let i="hoursminutessecondsmilliseconds";return{$schema:"https://vega.github.io/schema/vega-lite/v6.json",background:a==="dark"?"black":void 0,mark:{type:"bar",cornerRadius:2},params:[{name:Y,bind:{element:`#${e}`}},{name:G,select:{type:"point",on:"mouseover",fields:[J],clear:"mouseout"}}],height:{step:r==="sideBySide"?26:21},encoding:{y:{field:Re,scale:{paddingInner:.2},sort:{field:"sortPriority"},title:"cell",axis:r==="sideBySide"?null:void 0},x:{field:D,type:"temporal",axis:{orient:"top",title:null}},x2:{field:K,type:"temporal"},tooltip:[{field:D,type:"temporal",timeUnit:i,title:"Start"},{field:K,type:"temporal",timeUnit:i,title:"End"}],size:{value:{expr:`${Y} == toString(datum.${J}) ? 19.5 : 18`}},color:{field:Q,scale:{domain:["success","error"],range:["#37BE5F","red"]},legend:null}},data:{values:t},transform:[{calculate:`datum.${Q} === 'queued' ? 9999999999999 : datum.${D}`,as:"sortPriority"}],config:{view:{stroke:"transparent"}}}}function W(t){try{let e=new Date(t*1e3);return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")} ${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}.${String(e.getMilliseconds()).padStart(3,"0")}`}catch{return""}}var l=H(ne(),1),X=ee(new Map);const Ee=()=>{let t=(0,q.c)(34),{runIds:e,runMap:r}=F(we),a=F(X),{clearRuns:i}=Ne(),{theme:n}=ue(),[s,k]=(0,C.useState)("above"),N=Se(),c;t[0]===s?c=t[1]:(c=()=>{k(s==="above"?"sideBySide":"above")},t[0]=s,t[1]=c);let m=c;if(e.length===0){let p;return t[2]===Symbol.for("react.memo_cache_sentinel")?(p=(0,l.jsx)(Ie,{title:"No traces",description:(0,l.jsx)("span",{children:"Cells that have ran will appear here."}),icon:(0,l.jsx)(le,{})}),t[2]=p):p=t[2],p}let u;t[3]===Symbol.for("react.memo_cache_sentinel")?(u=(0,l.jsx)("label",{htmlFor:"chartPosition",className:"text-xs",children:"Inline chart"}),t[3]=u):u=t[3];let y=s==="sideBySide",o;t[4]!==y||t[5]!==m?(o=(0,l.jsxs)("div",{className:"flex flex-row gap-1 items-center",children:[u,(0,l.jsx)("input",{type:"checkbox",name:"chartPosition","data-testid":"chartPosition",onClick:m,defaultChecked:y,className:"h-3 cursor-pointer"})]}),t[4]=y,t[5]=m,t[6]=o):o=t[6];let h;t[7]===i?h=t[8]:(h=(0,l.jsx)(be,{dataTestId:"clear-traces-button",onClick:i}),t[7]=i,t[8]=h);let v;t[9]!==o||t[10]!==h?(v=(0,l.jsxs)("div",{className:"flex flex-row justify-start gap-3",children:[o,h]}),t[9]=o,t[10]=h,t[11]=v):v=t[11];let g;if(t[12]!==s||t[13]!==a||t[14]!==e||t[15]!==r||t[16]!==n){let p;t[18]!==s||t[19]!==a||t[20]!==r||t[21]!==n?(p=(E,P)=>{let T=r.get(E);return T?(0,l.jsx)(Me,{run:T,isExpanded:a.get(T.runId),isMostRecentRun:P===0,chartPosition:s,theme:n},T.runId):null},t[18]=s,t[19]=a,t[20]=r,t[21]=n,t[22]=p):p=t[22],g=e.map(p),t[12]=s,t[13]=a,t[14]=e,t[15]=r,t[16]=n,t[17]=g}else g=t[17];let j;t[23]===g?j=t[24]:(j=(0,l.jsx)("div",{className:"flex flex-col gap-3",children:g}),t[23]=g,t[24]=j);let w;t[25]!==v||t[26]!==j?(w=(0,l.jsxs)("div",{className:"py-1 px-2 overflow-y-scroll h-full",children:[v,j]}),t[25]=v,t[26]=j,t[27]=w):w=t[27];let f=w;if(N==="sidebar")return f;let x;t[28]===f?x=t[29]:(x=(0,l.jsx)(V,{defaultSize:50,minSize:30,maxSize:80,children:f}),t[28]=f,t[29]=x);let d;t[30]===Symbol.for("react.memo_cache_sentinel")?(d=(0,l.jsx)(je,{className:"w-1 bg-border hover:bg-primary/50 transition-colors"}),t[30]=d):d=t[30];let I;t[31]===Symbol.for("react.memo_cache_sentinel")?(I=(0,l.jsx)(V,{defaultSize:50,children:(0,l.jsx)("div",{})}),t[31]=I):I=t[31];let S;return t[32]===x?S=t[33]:(S=(0,l.jsxs)(ge,{direction:"horizontal",className:"h-full",children:[x,d,I]}),t[32]=x,t[33]=S),S};var Me=({run:t,isMostRecentRun:e,chartPosition:r,isExpanded:a,theme:i})=>{let n=Z(X);a??(a=e);let s=()=>{n(c=>{let m=new Map(c);return m.set(t.runId,!a),m})},k=(0,l.jsx)(a?de:ce,{height:16,className:"inline"}),N=(0,l.jsxs)("span",{className:"text-sm cursor-pointer",onClick:s,children:["Run - ",L(t.runStartTime),k]});return a?(0,l.jsx)(_e,{run:t,chartPosition:r,theme:i,title:N},t.runId):(0,l.jsx)("div",{className:"flex flex-col",children:(0,l.jsx)("pre",{className:"font-mono font-semibold",children:N})},t.runId)},_e=t=>{let e=(0,q.c)(40),{run:r,chartPosition:a,theme:i,title:n}=t,[s,k]=(0,C.useState)(),N=(0,C.useRef)(null),{ref:c,width:m}=ye(),u=m===void 0?300:m,y=re(),o,h;if(e[0]!==y||e[1]!==a||e[2]!==r.cellRuns||e[3]!==r.runId||e[4]!==i){let R=[...r.cellRuns.values()].map(b=>{let M=b.elapsedTime??0;return{cell:b.cellId,cellNum:y.inOrderIds.indexOf(b.cellId),startTimestamp:W(b.startTime),endTimestamp:W(b.startTime+M),elapsedTime:U(M*1e3),status:b.status}});o=`hiddenInputElement-${r.runId}`,h=fe(Te(R,o,a,i)),e[0]=y,e[1]=a,e[2]=r.cellRuns,e[3]=r.runId,e[4]=i,e[5]=o,e[6]=h}else o=e[5],h=e[6];let v=h.spec,g=i==="dark"?"dark":void 0,j=u-50,w=a==="above"?120:100,f;e[7]!==g||e[8]!==j||e[9]!==w?(f={theme:g,width:j,height:w,actions:!1,mode:"vega",renderer:"canvas"},e[7]=g,e[8]=j,e[9]=w,e[10]=f):f=e[10];let x;e[11]!==f||e[12]!==v?(x={ref:N,spec:v,options:f},e[11]=f,e[12]=v,e[13]=x):x=e[13];let d=xe(x),I;e[14]===(d==null?void 0:d.view)?I=e[15]:(I=()=>{let R=[{signalName:G,handler:(b,M)=>{var z;k(((z=M.cell)==null?void 0:z[0])??void 0??null)}}];return R.forEach(b=>{let{signalName:M,handler:z}=b;d==null||d.view.addSignalListener(M,z)}),()=>{R.forEach(b=>{let{signalName:M,handler:z}=b;d==null||d.view.removeSignalListener(M,z)})}},e[14]=d==null?void 0:d.view,e[15]=I);let S;e[16]===d?S=e[17]:(S=[d],e[16]=d,e[17]=S),(0,C.useEffect)(I,S);let p;e[18]!==o||e[19]!==s||e[20]!==r?(p=(0,l.jsx)($e,{run:r,hoveredCellId:s,hiddenInputElementId:o}),e[18]=o,e[19]=s,e[20]=r,e[21]=p):p=e[21];let E=p,P=a==="sideBySide"?"-mt-0.5 flex-1":"",T;e[22]===Symbol.for("react.memo_cache_sentinel")?(T=(0,l.jsx)(C.Suspense,{children:(0,l.jsx)("div",{ref:N})}),e[22]=T):T=e[22];let B;e[23]!==c||e[24]!==P?(B=(0,l.jsx)("div",{className:P,ref:c,children:T}),e[23]=c,e[24]=P,e[25]=B):B=e[25];let _=B;if(a==="above"){let R;e[26]!==_||e[27]!==n||e[28]!==E?(R=(0,l.jsxs)("pre",{className:"font-mono font-semibold",children:[n,_,E]}),e[26]=_,e[27]=n,e[28]=E,e[29]=R):R=e[29];let b;return e[30]!==r.runId||e[31]!==R?(b=(0,l.jsx)("div",{className:"flex flex-col",children:R},r.runId),e[30]=r.runId,e[31]=R,e[32]=b):b=e[32],b}let $;e[33]!==n||e[34]!==E?($=(0,l.jsxs)("pre",{className:"font-mono font-semibold",children:[n,E]}),e[33]=n,e[34]=E,e[35]=$):$=e[35];let O;return e[36]!==_||e[37]!==r.runId||e[38]!==$?(O=(0,l.jsxs)("div",{className:"flex flex-row",children:[$,_]},r.runId),e[36]=_,e[37]=r.runId,e[38]=$,e[39]=O):O=e[39],O},$e=t=>{let e=(0,q.c)(12),{run:r,hoveredCellId:a,hiddenInputElementId:i}=t,n=(0,C.useRef)(null),s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o=>{n.current&&(n.current.value=String(o),n.current.dispatchEvent(new Event("input",{bubbles:!0})))},e[0]=s):s=e[0];let k=s,N=a||"",c;e[1]!==i||e[2]!==N?(c=(0,l.jsx)("input",{type:"text",id:i,defaultValue:N,hidden:!0,ref:n}),e[1]=i,e[2]=N,e[3]=c):c=e[3];let m;e[4]===r.cellRuns?m=e[5]:(m=[...r.cellRuns.values()],e[4]=r.cellRuns,e[5]=m);let u;e[6]!==a||e[7]!==m?(u=m.map(o=>(0,l.jsx)(Ce,{cellRun:o,hovered:o.cellId===a,dispatchHoverEvent:k},o.cellId)),e[6]=a,e[7]=m,e[8]=u):u=e[8];let y;return e[9]!==c||e[10]!==u?(y=(0,l.jsxs)("div",{className:"text-xs mt-0.5 ml-3 flex flex-col gap-0.5",children:[c,u]}),e[9]=c,e[10]=u,e[11]=y):y=e[11],y},ze={success:(0,l.jsx)(me,{color:"green",size:14}),running:(0,l.jsx)(pe,{color:"var(--blue-10)",size:14}),error:(0,l.jsx)(se,{color:"red",size:14}),queued:(0,l.jsx)(ke,{color:"grey",size:14})},Ce=t=>{let e=(0,q.c)(39),{cellRun:r,hovered:a,dispatchHoverEvent:i}=t,n;e[0]===r.elapsedTime?n=e[1]:(n=r.elapsedTime?U(r.elapsedTime*1e3):"-",e[0]=r.elapsedTime,e[1]=n);let s=n,k;e[2]!==r.elapsedTime||e[3]!==s?(k=r.elapsedTime?(0,l.jsxs)("span",{children:["This cell took ",(0,l.jsx)(he,{elapsedTime:s})," to run"]}):(0,l.jsx)("span",{children:"This cell has not been run"}),e[2]=r.elapsedTime,e[3]=s,e[4]=k):k=e[4];let N=k,c;e[5]!==r.cellId||e[6]!==i?(c=()=>{i(r.cellId)},e[5]=r.cellId,e[6]=i,e[7]=c):c=e[7];let m=c,u;e[8]===i?u=e[9]:(u=()=>{i(null)},e[8]=i,e[9]=u);let y=u,o=a&&"bg-(--gray-3) opacity-100",h;e[10]===o?h=e[11]:(h=ie("flex flex-row gap-2 py-1 px-1 opacity-70 hover:bg-(--gray-3) hover:opacity-100",o),e[10]=o,e[11]=h);let v;e[12]===r.startTime?v=e[13]:(v=L(r.startTime),e[12]=r.startTime,e[13]=v);let g;e[14]===v?g=e[15]:(g=(0,l.jsxs)("span",{className:"text-(--gray-10) dark:text-(--gray-11)",children:["[",v,"]"]}),e[14]=v,e[15]=g);let j;e[16]===r.cellId?j=e[17]:(j=(0,l.jsxs)("span",{className:"text-(--gray-10) w-16 overflow-hidden",children:["(",(0,l.jsx)(ve,{cellId:r.cellId}),")"]}),e[16]=r.cellId,e[17]=j);let w;e[18]===r.code?w=e[19]:(w=(0,l.jsx)("span",{className:"w-40 truncate -ml-1",children:r.code}),e[18]=r.code,e[19]=w);let f;e[20]===s?f=e[21]:(f=(0,l.jsx)("span",{className:"text-(--gray-10) dark:text-(--gray-11)",children:s}),e[20]=s,e[21]=f);let x;e[22]!==N||e[23]!==f?(x=(0,l.jsx)(A,{content:N,children:f}),e[22]=N,e[23]=f,e[24]=x):x=e[24];let d=ze[r.status],I;e[25]!==r.status||e[26]!==d?(I=(0,l.jsx)(A,{content:r.status,children:d}),e[25]=r.status,e[26]=d,e[27]=I):I=e[27];let S;e[28]!==x||e[29]!==I?(S=(0,l.jsxs)("div",{className:"flex flex-row gap-1 w-16 justify-end -ml-2",children:[x,I]}),e[28]=x,e[29]=I,e[30]=S):S=e[30];let p;return e[31]!==m||e[32]!==y||e[33]!==w||e[34]!==S||e[35]!==h||e[36]!==g||e[37]!==j?(p=(0,l.jsxs)("div",{className:h,onMouseEnter:m,onMouseLeave:y,children:[g,j,w,S]}),e[31]=m,e[32]=y,e[33]=w,e[34]=S,e[35]=h,e[36]=g,e[37]=j,e[38]=p):p=e[38],p};export{Ee as Tracing};
|
|
1
|
+
import{s as H}from"./chunk-LvLJmgfZ.js";import{d as Z,p as ee,u as F}from"./useEvent-D91BmmQi.js";import{t as te}from"./react-Bj1aDYRI.js";import{M as re,Or as le,Sr as se,q as L}from"./cells-k7Js5h2t.js";import"./react-dom-CSu739Rf.js";import{t as ae}from"./compiler-runtime-B3qBwwSJ.js";import{t as ie}from"./cn-DCUzRj2J.js";import{t as ne}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-DFky0PAA.js";import{t as A}from"./tooltip-B_PkSKN3.js";import"./dist-D0HyMpgV.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{t as oe}from"./createLucideIcon-D5guW7EU.js";import{r as de}from"./x-C-6liIBr.js";import{t as ce}from"./chevron-right-CG5QYXYk.js";import{t as me}from"./circle-check-C17zXg7L.js";import{t as pe}from"./circle-play-CYXX2xu3.js";import"./dist-HyCgERnW.js";import"./dist-BwnT-_gD.js";import"./dist-rBRbke5D.js";import"./dist-RMRSa-Mj.js";import"./dist-BURue7-e.js";import"./session-0B5NBztP.js";import{r as ue}from"./useTheme-CI2eq4XN.js";import"./purify.es-B9KxLTTS.js";import{n as he,r as U}from"./CellStatus-BKK6G_iZ.js";import"./vega-loader.browser-C8wT63Va.js";import{r as fe,t as xe}from"./react-vega-DiXzyRNd.js";import"./defaultLocale-BLUna9fQ.js";import"./defaultLocale-DzliDDTm.js";import{t as ve}from"./cell-link-spbX-mlL.js";import{n as ge,r as je,t as V}from"./react-resizable-panels.browser.esm-CV8-hvjx.js";import{t as ye}from"./bundle.esm-DjhGJy4I.js";import{t as Ie}from"./empty-state-vCWg-_A9.js";import"./multi-icon-BvuxcR2m.js";import{r as Se}from"./panel-context-D7Ggu8Nw.js";import{t as be}from"./clear-button-UYLFbizO.js";import{n as Ne,t as we}from"./runs-DSnhrBgK.js";var ke=oe("circle-ellipsis",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]),q=ae(),C=H(te(),1);const Y="hoveredCellId",G="cellHover";var Re="cellNum",J="cell",D="startTimestamp",K="endTimestamp",Q="status";function Te(t,e,r,a){let i="hoursminutessecondsmilliseconds";return{$schema:"https://vega.github.io/schema/vega-lite/v6.json",background:a==="dark"?"black":void 0,mark:{type:"bar",cornerRadius:2},params:[{name:Y,bind:{element:`#${e}`}},{name:G,select:{type:"point",on:"mouseover",fields:[J],clear:"mouseout"}}],height:{step:r==="sideBySide"?26:21},encoding:{y:{field:Re,scale:{paddingInner:.2},sort:{field:"sortPriority"},title:"cell",axis:r==="sideBySide"?null:void 0},x:{field:D,type:"temporal",axis:{orient:"top",title:null}},x2:{field:K,type:"temporal"},tooltip:[{field:D,type:"temporal",timeUnit:i,title:"Start"},{field:K,type:"temporal",timeUnit:i,title:"End"}],size:{value:{expr:`${Y} == toString(datum.${J}) ? 19.5 : 18`}},color:{field:Q,scale:{domain:["success","error"],range:["#37BE5F","red"]},legend:null}},data:{values:t},transform:[{calculate:`datum.${Q} === 'queued' ? 9999999999999 : datum.${D}`,as:"sortPriority"}],config:{view:{stroke:"transparent"}}}}function W(t){try{let e=new Date(t*1e3);return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")} ${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}.${String(e.getMilliseconds()).padStart(3,"0")}`}catch{return""}}var l=H(ne(),1),X=ee(new Map);const Ee=()=>{let t=(0,q.c)(34),{runIds:e,runMap:r}=F(we),a=F(X),{clearRuns:i}=Ne(),{theme:n}=ue(),[s,k]=(0,C.useState)("above"),N=Se(),c;t[0]===s?c=t[1]:(c=()=>{k(s==="above"?"sideBySide":"above")},t[0]=s,t[1]=c);let m=c;if(e.length===0){let p;return t[2]===Symbol.for("react.memo_cache_sentinel")?(p=(0,l.jsx)(Ie,{title:"No traces",description:(0,l.jsx)("span",{children:"Cells that have ran will appear here."}),icon:(0,l.jsx)(le,{})}),t[2]=p):p=t[2],p}let u;t[3]===Symbol.for("react.memo_cache_sentinel")?(u=(0,l.jsx)("label",{htmlFor:"chartPosition",className:"text-xs",children:"Inline chart"}),t[3]=u):u=t[3];let y=s==="sideBySide",o;t[4]!==y||t[5]!==m?(o=(0,l.jsxs)("div",{className:"flex flex-row gap-1 items-center",children:[u,(0,l.jsx)("input",{type:"checkbox",name:"chartPosition","data-testid":"chartPosition",onClick:m,defaultChecked:y,className:"h-3 cursor-pointer"})]}),t[4]=y,t[5]=m,t[6]=o):o=t[6];let h;t[7]===i?h=t[8]:(h=(0,l.jsx)(be,{dataTestId:"clear-traces-button",onClick:i}),t[7]=i,t[8]=h);let v;t[9]!==o||t[10]!==h?(v=(0,l.jsxs)("div",{className:"flex flex-row justify-start gap-3",children:[o,h]}),t[9]=o,t[10]=h,t[11]=v):v=t[11];let g;if(t[12]!==s||t[13]!==a||t[14]!==e||t[15]!==r||t[16]!==n){let p;t[18]!==s||t[19]!==a||t[20]!==r||t[21]!==n?(p=(E,P)=>{let T=r.get(E);return T?(0,l.jsx)(Me,{run:T,isExpanded:a.get(T.runId),isMostRecentRun:P===0,chartPosition:s,theme:n},T.runId):null},t[18]=s,t[19]=a,t[20]=r,t[21]=n,t[22]=p):p=t[22],g=e.map(p),t[12]=s,t[13]=a,t[14]=e,t[15]=r,t[16]=n,t[17]=g}else g=t[17];let j;t[23]===g?j=t[24]:(j=(0,l.jsx)("div",{className:"flex flex-col gap-3",children:g}),t[23]=g,t[24]=j);let w;t[25]!==v||t[26]!==j?(w=(0,l.jsxs)("div",{className:"py-1 px-2 overflow-y-scroll h-full",children:[v,j]}),t[25]=v,t[26]=j,t[27]=w):w=t[27];let f=w;if(N==="sidebar")return f;let x;t[28]===f?x=t[29]:(x=(0,l.jsx)(V,{defaultSize:50,minSize:30,maxSize:80,children:f}),t[28]=f,t[29]=x);let d;t[30]===Symbol.for("react.memo_cache_sentinel")?(d=(0,l.jsx)(je,{className:"w-1 bg-border hover:bg-primary/50 transition-colors"}),t[30]=d):d=t[30];let I;t[31]===Symbol.for("react.memo_cache_sentinel")?(I=(0,l.jsx)(V,{defaultSize:50,children:(0,l.jsx)("div",{})}),t[31]=I):I=t[31];let S;return t[32]===x?S=t[33]:(S=(0,l.jsxs)(ge,{direction:"horizontal",className:"h-full",children:[x,d,I]}),t[32]=x,t[33]=S),S};var Me=({run:t,isMostRecentRun:e,chartPosition:r,isExpanded:a,theme:i})=>{let n=Z(X);a??(a=e);let s=()=>{n(c=>{let m=new Map(c);return m.set(t.runId,!a),m})},k=(0,l.jsx)(a?de:ce,{height:16,className:"inline"}),N=(0,l.jsxs)("span",{className:"text-sm cursor-pointer",onClick:s,children:["Run - ",L(t.runStartTime),k]});return a?(0,l.jsx)(_e,{run:t,chartPosition:r,theme:i,title:N},t.runId):(0,l.jsx)("div",{className:"flex flex-col",children:(0,l.jsx)("pre",{className:"font-mono font-semibold",children:N})},t.runId)},_e=t=>{let e=(0,q.c)(40),{run:r,chartPosition:a,theme:i,title:n}=t,[s,k]=(0,C.useState)(),N=(0,C.useRef)(null),{ref:c,width:m}=ye(),u=m===void 0?300:m,y=re(),o,h;if(e[0]!==y||e[1]!==a||e[2]!==r.cellRuns||e[3]!==r.runId||e[4]!==i){let R=[...r.cellRuns.values()].map(b=>{let M=b.elapsedTime??0;return{cell:b.cellId,cellNum:y.inOrderIds.indexOf(b.cellId),startTimestamp:W(b.startTime),endTimestamp:W(b.startTime+M),elapsedTime:U(M*1e3),status:b.status}});o=`hiddenInputElement-${r.runId}`,h=fe(Te(R,o,a,i)),e[0]=y,e[1]=a,e[2]=r.cellRuns,e[3]=r.runId,e[4]=i,e[5]=o,e[6]=h}else o=e[5],h=e[6];let v=h.spec,g=i==="dark"?"dark":void 0,j=u-50,w=a==="above"?120:100,f;e[7]!==g||e[8]!==j||e[9]!==w?(f={theme:g,width:j,height:w,actions:!1,mode:"vega",renderer:"canvas"},e[7]=g,e[8]=j,e[9]=w,e[10]=f):f=e[10];let x;e[11]!==f||e[12]!==v?(x={ref:N,spec:v,options:f},e[11]=f,e[12]=v,e[13]=x):x=e[13];let d=xe(x),I;e[14]===(d==null?void 0:d.view)?I=e[15]:(I=()=>{let R=[{signalName:G,handler:(b,M)=>{var z;k(((z=M.cell)==null?void 0:z[0])??void 0??null)}}];return R.forEach(b=>{let{signalName:M,handler:z}=b;d==null||d.view.addSignalListener(M,z)}),()=>{R.forEach(b=>{let{signalName:M,handler:z}=b;d==null||d.view.removeSignalListener(M,z)})}},e[14]=d==null?void 0:d.view,e[15]=I);let S;e[16]===d?S=e[17]:(S=[d],e[16]=d,e[17]=S),(0,C.useEffect)(I,S);let p;e[18]!==o||e[19]!==s||e[20]!==r?(p=(0,l.jsx)($e,{run:r,hoveredCellId:s,hiddenInputElementId:o}),e[18]=o,e[19]=s,e[20]=r,e[21]=p):p=e[21];let E=p,P=a==="sideBySide"?"-mt-0.5 flex-1":"",T;e[22]===Symbol.for("react.memo_cache_sentinel")?(T=(0,l.jsx)(C.Suspense,{children:(0,l.jsx)("div",{ref:N})}),e[22]=T):T=e[22];let B;e[23]!==c||e[24]!==P?(B=(0,l.jsx)("div",{className:P,ref:c,children:T}),e[23]=c,e[24]=P,e[25]=B):B=e[25];let _=B;if(a==="above"){let R;e[26]!==_||e[27]!==n||e[28]!==E?(R=(0,l.jsxs)("pre",{className:"font-mono font-semibold",children:[n,_,E]}),e[26]=_,e[27]=n,e[28]=E,e[29]=R):R=e[29];let b;return e[30]!==r.runId||e[31]!==R?(b=(0,l.jsx)("div",{className:"flex flex-col",children:R},r.runId),e[30]=r.runId,e[31]=R,e[32]=b):b=e[32],b}let $;e[33]!==n||e[34]!==E?($=(0,l.jsxs)("pre",{className:"font-mono font-semibold",children:[n,E]}),e[33]=n,e[34]=E,e[35]=$):$=e[35];let O;return e[36]!==_||e[37]!==r.runId||e[38]!==$?(O=(0,l.jsxs)("div",{className:"flex flex-row",children:[$,_]},r.runId),e[36]=_,e[37]=r.runId,e[38]=$,e[39]=O):O=e[39],O},$e=t=>{let e=(0,q.c)(12),{run:r,hoveredCellId:a,hiddenInputElementId:i}=t,n=(0,C.useRef)(null),s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o=>{n.current&&(n.current.value=String(o),n.current.dispatchEvent(new Event("input",{bubbles:!0})))},e[0]=s):s=e[0];let k=s,N=a||"",c;e[1]!==i||e[2]!==N?(c=(0,l.jsx)("input",{type:"text",id:i,defaultValue:N,hidden:!0,ref:n}),e[1]=i,e[2]=N,e[3]=c):c=e[3];let m;e[4]===r.cellRuns?m=e[5]:(m=[...r.cellRuns.values()],e[4]=r.cellRuns,e[5]=m);let u;e[6]!==a||e[7]!==m?(u=m.map(o=>(0,l.jsx)(Ce,{cellRun:o,hovered:o.cellId===a,dispatchHoverEvent:k},o.cellId)),e[6]=a,e[7]=m,e[8]=u):u=e[8];let y;return e[9]!==c||e[10]!==u?(y=(0,l.jsxs)("div",{className:"text-xs mt-0.5 ml-3 flex flex-col gap-0.5",children:[c,u]}),e[9]=c,e[10]=u,e[11]=y):y=e[11],y},ze={success:(0,l.jsx)(me,{color:"green",size:14}),running:(0,l.jsx)(pe,{color:"var(--blue-10)",size:14}),error:(0,l.jsx)(se,{color:"red",size:14}),queued:(0,l.jsx)(ke,{color:"grey",size:14})},Ce=t=>{let e=(0,q.c)(39),{cellRun:r,hovered:a,dispatchHoverEvent:i}=t,n;e[0]===r.elapsedTime?n=e[1]:(n=r.elapsedTime?U(r.elapsedTime*1e3):"-",e[0]=r.elapsedTime,e[1]=n);let s=n,k;e[2]!==r.elapsedTime||e[3]!==s?(k=r.elapsedTime?(0,l.jsxs)("span",{children:["This cell took ",(0,l.jsx)(he,{elapsedTime:s})," to run"]}):(0,l.jsx)("span",{children:"This cell has not been run"}),e[2]=r.elapsedTime,e[3]=s,e[4]=k):k=e[4];let N=k,c;e[5]!==r.cellId||e[6]!==i?(c=()=>{i(r.cellId)},e[5]=r.cellId,e[6]=i,e[7]=c):c=e[7];let m=c,u;e[8]===i?u=e[9]:(u=()=>{i(null)},e[8]=i,e[9]=u);let y=u,o=a&&"bg-(--gray-3) opacity-100",h;e[10]===o?h=e[11]:(h=ie("flex flex-row gap-2 py-1 px-1 opacity-70 hover:bg-(--gray-3) hover:opacity-100",o),e[10]=o,e[11]=h);let v;e[12]===r.startTime?v=e[13]:(v=L(r.startTime),e[12]=r.startTime,e[13]=v);let g;e[14]===v?g=e[15]:(g=(0,l.jsxs)("span",{className:"text-(--gray-10) dark:text-(--gray-11)",children:["[",v,"]"]}),e[14]=v,e[15]=g);let j;e[16]===r.cellId?j=e[17]:(j=(0,l.jsxs)("span",{className:"text-(--gray-10) w-16 overflow-hidden",children:["(",(0,l.jsx)(ve,{cellId:r.cellId}),")"]}),e[16]=r.cellId,e[17]=j);let w;e[18]===r.code?w=e[19]:(w=(0,l.jsx)("span",{className:"w-40 truncate -ml-1",children:r.code}),e[18]=r.code,e[19]=w);let f;e[20]===s?f=e[21]:(f=(0,l.jsx)("span",{className:"text-(--gray-10) dark:text-(--gray-11)",children:s}),e[20]=s,e[21]=f);let x;e[22]!==N||e[23]!==f?(x=(0,l.jsx)(A,{content:N,children:f}),e[22]=N,e[23]=f,e[24]=x):x=e[24];let d=ze[r.status],I;e[25]!==r.status||e[26]!==d?(I=(0,l.jsx)(A,{content:r.status,children:d}),e[25]=r.status,e[26]=d,e[27]=I):I=e[27];let S;e[28]!==x||e[29]!==I?(S=(0,l.jsxs)("div",{className:"flex flex-row gap-1 w-16 justify-end -ml-2",children:[x,I]}),e[28]=x,e[29]=I,e[30]=S):S=e[30];let p;return e[31]!==m||e[32]!==y||e[33]!==w||e[34]!==S||e[35]!==h||e[36]!==g||e[37]!==j?(p=(0,l.jsxs)("div",{className:h,onMouseEnter:m,onMouseLeave:y,children:[g,j,w,S]}),e[31]=m,e[32]=y,e[33]=w,e[34]=S,e[35]=h,e[36]=g,e[37]=j,e[38]=p):p=e[38],p};export{Ee as Tracing};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-
|
|
2
|
-
import{s as m}from"./chunk-LvLJmgfZ.js";import{t as i}from"./react-Bj1aDYRI.js";import{t as n}from"./compiler-runtime-B3qBwwSJ.js";import{t as f}from"./jsx-runtime-BqBOg78p.js";import{t as _}from"./spinner-Bhir8k53.js";import{t as p}from"./preload-helper-BPPi7vOr.js";let c,u=(async()=>{let a,l,r,o,s;a=n(),l=m(i(),1),r=m(f(),1),o=l.lazy(()=>p(()=>import("./tracing-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-DNuuRjp_.js","./clear-button-UYLFbizO.js","./cn-DCUzRj2J.js","./clsx-Dz_KRrWq.js","./compiler-runtime-B3qBwwSJ.js","./react-Bj1aDYRI.js","./chunk-LvLJmgfZ.js","./jsx-runtime-BqBOg78p.js","./cells-k7Js5h2t.js","./preload-helper-BPPi7vOr.js","./badge-j3NGjqhR.js","./button-BbCh-29a.js","./useEventListener-DvoEXWke.js","./fullscreen-DFky0PAA.js","./react-dom-CSu739Rf.js","./menu-items-BP7Ju9ww.js","./select-6suE6YM2.js","./dist-CWMKC7yO.js","./check-BH35Ndha.js","./createLucideIcon-D5guW7EU.js","./x-C-6liIBr.js","./tooltip-B_PkSKN3.js","./use-toast-CJ1Tj2eC.js","./utils-CvI-39U6.js","./useEvent-D91BmmQi.js","./invariant-BUdrueMv.js","./merge-_9WLTEyt.js","./_baseFor-DKD1r8uL.js","./isObject-DvLSfCY5.js","./zod-H_cgTO0M.js","./DeferredRequestRegistry-CNldVcrP.js","./Deferred-CP7vq682.js","./uuid-e9lSomwA.js","./config-ClMcu_sV.js","./constants-DMpttj8Q.js","./session-0B5NBztP.js","./requests-DIwGYs0l.js","./useLifecycle-DieWOfXE.js","./useNonce-DfoVjkkH.js","./useTheme-CI2eq4XN.js","./arrays-DYDL-3-i.js","./strings-wdPMRf6Z.js","./capabilities-A_KhFcGV.js","./once-DRroIaBz.js","./createReducer-CI9qeK_X.js","./paths-D5zczhUD.js","./dist-Bo13cFwO.js","./dist-D0HyMpgV.js","./dist-DVkC-Qmw.js","./dist-HyCgERnW.js","./dist-BwnT-_gD.js","./dist-rBRbke5D.js","./dist-RMRSa-Mj.js","./dist-BURue7-e.js","./dist-YEXtMjTi.js","./stex-BGrE-q7N.js","./toDate-B5A0DFEz.js","./purify.es-B9KxLTTS.js","./cjs-BRGiG41H.js","./debounce-DhnxH9Rh.js","./now-CsYTPAhW.js","./isSymbol-BT6B8Bon.js","./database-zap-kIkTfzTX.js","./main-B0OX4z33.js","./cells-pu5xzE_v.css","./CellStatus-BKK6G_iZ.js","./multi-icon-BvuxcR2m.js","./multi-icon-pwGWVz3d.css","./useDateFormatter-ICIDGgHf.js","./context-QkTujrKn.js","./SSRProvider-CkFAAHXw.js","./en-US-Cb8rIK52.js","./ban-0fKnt00i.js","./ellipsis-KAhMaCIV.js","./refresh-cw-DHwG4Mac.js","./workflow-Bm8qF7yj.js","./CellStatus-2Psjnl5F.css","./empty-state-vCWg-_A9.js","./panel-context-D7Ggu8Nw.js","./cell-link-spbX-mlL.js","./ImperativeModal-BW1dmntO.js","./alert-dialog-5BGIfskO.js","./dialog-DRnNAWYl.js","./input-DA8xlX70.js","./useDebounce-7xZwVnnu.js","./numbers-DGxQfQ-A.js","./useNumberFormatter-ByUv-u9o.js","./usePress-DQ_tAz5W.js","./runs-DSnhrBgK.js","./react-vega-DiXzyRNd.js","./precisionRound-Cl9k9ZmS.js","./defaultLocale-BLUna9fQ.js","./linear-BrLBJGJq.js","./timer-ffBO1paY.js","./init-DZpk0tdu.js","./time-BCqVDrZA.js","./defaultLocale-DzliDDTm.js","./range-gMGfxVwZ.js","./vega-loader.browser-C8wT63Va.js","./treemap-8bMgVaTX.js","./path-dqkZlAhR.js","./colors-CUF0x3zZ.js","./ordinal-DgI3JO68.js","./arc-xh3ZebK_.js","./math-PgJy15ir.js","./array-BKCdRGCR.js","./step-DGkZosD0.js","./line-VKarCWVL.js","./chevron-right-CG5QYXYk.js","./circle-check-C17zXg7L.js","./circle-play-CYXX2xu3.js","./react-resizable-panels.browser.esm-CV8-hvjx.js","./bundle.esm-DjhGJy4I.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{s as m}from"./chunk-LvLJmgfZ.js";import{t as i}from"./react-Bj1aDYRI.js";import{t as n}from"./compiler-runtime-B3qBwwSJ.js";import{t as f}from"./jsx-runtime-BqBOg78p.js";import{t as _}from"./spinner-Bhir8k53.js";import{t as p}from"./preload-helper-BPPi7vOr.js";let c,u=(async()=>{let a,l,r,o,s;a=n(),l=m(i(),1),r=m(f(),1),o=l.lazy(()=>p(()=>import("./tracing-DNuuRjp_.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112]),import.meta.url).then(t=>({default:t.Tracing}))),c=()=>{let t=(0,a.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(l.Suspense,{fallback:(0,r.jsx)(s,{}),children:(0,r.jsx)(o,{})}),t[0]=e):e=t[0],e},s=()=>{let t=(0,a.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("div",{className:"flex flex-col items-center justify-center h-full",children:(0,r.jsx)(_,{})}),t[0]=e):e=t[0],e}})();export{u as __tla,c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as ae}from"./chunk-LvLJmgfZ.js";import{d as ie,u as b}from"./useEvent-D91BmmQi.js";import{$n as de,Bn as ne,D as se,Ri as re,Sr as ce,Vn as he,br as me,kt as F,st as pe,v as ke,vr as fe,yr as ue}from"./cells-k7Js5h2t.js";import{t as ye}from"./compiler-runtime-B3qBwwSJ.js";import{c as be,i as xe,s as je}from"./utils-CvI-39U6.js";import{t as ve}from"./jsx-runtime-BqBOg78p.js";import{t as Ce}from"./label-C2_YQRio.js";import{a as we,h as ge}from"./download-BS31LU22.js";import{r as Ie}from"./requests-DIwGYs0l.js";import{t as f}from"./createLucideIcon-D5guW7EU.js";import{n as V,r as Q}from"./x-C-6liIBr.js";import{t as ze}from"./chevron-right-CG5QYXYk.js";import{t as G}from"./circle-plus-BdiiIXu5.js";import{t as We}from"./code-xml-CZN6vNxu.js";import{t as Me}from"./eye-off-Cm6DdkeR.js";import{t as _e}from"./image-DQHXdEQn.js";import{t as Se}from"./link-CfEtM3Rl.js";import{i as Ae,t as De}from"./useDeleteCell-cucOoAuB.js";import{t as Re}from"./sparkles-lWUAsPhp.js";import{t as Te}from"./trash-2-rVklqqFF.js";import{t as Be}from"./use-toast-CJ1Tj2eC.js";import{n as Ne}from"./copy-LK56fFow.js";import{i as Ee}from"./useRunCells-CVd2QKS9.js";import{a as He,c as Le,n as qe}from"./dialog-DRnNAWYl.js";import{n as Oe}from"./ImperativeModal-
|
|
1
|
+
import{s as ae}from"./chunk-LvLJmgfZ.js";import{d as ie,u as b}from"./useEvent-D91BmmQi.js";import{$n as de,Bn as ne,D as se,Ri as re,Sr as ce,Vn as he,br as me,kt as F,st as pe,v as ke,vr as fe,yr as ue}from"./cells-k7Js5h2t.js";import{t as ye}from"./compiler-runtime-B3qBwwSJ.js";import{c as be,i as xe,s as je}from"./utils-CvI-39U6.js";import{t as ve}from"./jsx-runtime-BqBOg78p.js";import{t as Ce}from"./label-C2_YQRio.js";import{a as we,h as ge}from"./download-BS31LU22.js";import{r as Ie}from"./requests-DIwGYs0l.js";import{t as f}from"./createLucideIcon-D5guW7EU.js";import{n as V,r as Q}from"./x-C-6liIBr.js";import{t as ze}from"./chevron-right-CG5QYXYk.js";import{t as G}from"./circle-plus-BdiiIXu5.js";import{t as We}from"./code-xml-CZN6vNxu.js";import{t as Me}from"./eye-off-Cm6DdkeR.js";import{t as _e}from"./image-DQHXdEQn.js";import{t as Se}from"./link-CfEtM3Rl.js";import{i as Ae,t as De}from"./useDeleteCell-cucOoAuB.js";import{t as Re}from"./sparkles-lWUAsPhp.js";import{t as Te}from"./trash-2-rVklqqFF.js";import{t as Be}from"./use-toast-CJ1Tj2eC.js";import{n as Ne}from"./copy-LK56fFow.js";import{i as Ee}from"./useRunCells-CVd2QKS9.js";import{a as He,c as Le,n as qe}from"./dialog-DRnNAWYl.js";import{n as Oe}from"./ImperativeModal-BW1dmntO.js";import{n as Pe}from"./state-C9ggN1rs.js";import{r as K}from"./html-to-image-rLeQGF-G.js";import{n as Ue,t as Fe}from"./icons-Ol38nIbL.js";import{n as $}from"./name-cell-input-DyUkpM9d.js";import{t as X}from"./multi-icon-BvuxcR2m.js";import{t as Ve}from"./useSplitCell-D1KubWSa.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"}]]),Y=f("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Z=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"}]]),Qe=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 $e=ye(),l=ae(ve(),1);function Xe(a){let e=(0,$e.c)(47),{cell:c,closePopover:u}=a,{createNewCell:m,updateCellConfig:s,updateCellName:x,moveCell:p,sendToTop:W,sendToBottom:M,addColumnBreakpoint:_,clearCellOutput:S,markUntouched:A}=se(),D=Ve(),R=Ee(c==null?void 0:c.cellId),T=!b(ke),B=De(),{openModal:j}=Oe(),N=ie(Pe),E=b(xe),v=b(be),oe=b(pe),y=b(je),{saveCellConfig:r}=Ie();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:H,status:L}=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 q=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 O=g,d=o===re,I;e[12]===Symbol.for("react.memo_cache_sentinel")?(I=(0,l.jsx)(Ae,{size:13,strokeWidth:1.5}),e[12]=I):I=e[12];let P=L==="running"||L==="queued"||L==="disabled-transitively"||i.disabled,k;e[13]===R?k=e[14]:(k=()=>R(),e[13]=R,e[14]=k);let z;return e[15]!==_||e[16]!==E||e[17]!==y||e[18]!==v||e[19]!==T||e[20]!==o||e[21]!==S||e[22]!==u||e[23]!==i.disabled||e[24]!==i.hide_code||e[25]!==m||e[26]!==B||e[27]!==n||e[28]!==H||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]!==N||e[39]!==D||e[40]!==P||e[41]!==k||e[42]!==q||e[43]!==O||e[44]!==s||e[45]!==x?(z=[[{icon:I,label:"Run cell",hotkey:"cell.run",hidden:P,redundant:!0,handle:k},{icon:(0,l.jsx)(Re,{size:13,strokeWidth:1.5}),label:"Refactor with AI",hidden:!E,handle:()=>{N(t=>(t==null?void 0:t.cellId)===o?null:{cellId:o})},hotkey:"cell.aiCompletion"},{icon:(0,l.jsx)(Z,{size:13,strokeWidth:1.5}),label:"Split",hotkey:"cell.splitCell",handle:()=>D({cellId:o})},{icon:(0,l.jsx)(We,{size:13,strokeWidth:1.5}),label:"Format",hotkey:"cell.format",handle:()=>{let t=n();t&&de({[o]:t})}},{icon:i.hide_code?(0,l.jsx)(fe,{size:13,strokeWidth:1.5}):(0,l.jsx)(Me,{size:13,strokeWidth:1.5}),label:i.hide_code?"Show code":"Hide code",handle:O,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:q,hidden:d}],[{icon:(0,l.jsx)(Fe,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:async()=>{let t=n();t&&(K({autoInstantiate:v,createNewCell:m}),F(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},ne(n())==="sql"?{icon:(0,l.jsx)(Ue,{}),label:"View as Python",hotkey:"cell.viewAsSQL",handle:()=>{let t=n();t&&he(t,"python",{force:!0})},hidden:d}:{icon:(0,l.jsx)(ue,{size:13,strokeWidth:1.5}),label:"Convert to SQL",hotkey:"cell.viewAsSQL",handle:()=>{let t=n();t&&(K({autoInstantiate:v,createNewCell:m}),F(t,{language:"sql",keepCodeAsIs:!1}))},hidden:d}],[{icon:(0,l.jsxs)(X,{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)(X,{children:[(0,l.jsx)(G,{size:13,strokeWidth:1.5}),(0,l.jsx)(Q,{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)(Q,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>p({cellId:o,before:!1}),hidden:d},{icon:(0,l.jsx)(ge,{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)(ze,{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)(Y,{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)(me,{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:()=>we(o,"result")},{icon:(0,l.jsx)(ce,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(C||H),handle:()=>{S({cellId:o})}}],[{icon:(0,l.jsx)(Qe,{size:13,strokeWidth:1.5}),label:"Name",disableClick:!0,handle:el,handleHeadless:()=>{j((0,l.jsxs)(qe,{children:[(0,l.jsx)(He,{children:(0,l.jsx)(Le,{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)($,{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)($,{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 Ne(Ge(h)),Be({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!T,variant:"danger",icon:(0,l.jsx)(Te,{size:13,strokeWidth:1.5}),handle:()=>{B({cellId:o})}}]].map(Ye).filter(Je),e[15]=_,e[16]=E,e[17]=y,e[18]=v,e[19]=T,e[20]=o,e[21]=S,e[22]=u,e[23]=i.disabled,e[24]=i.hide_code,e[25]=m,e[26]=B,e[27]=n,e[28]=H,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]=N,e[39]=D,e[40]=P,e[41]=k,e[42]=q,e[43]=O,e[44]=s,e[45]=x,e[46]=z):z=e[46],z}function Je(a){return a.length>0}function Ye(a){return a.filter(Ze)}function Ze(a){return!a.hidden}function el(a){a==null||a.stopPropagation(),a==null||a.preventDefault()}export{Z as a,ee as i,Ke as n,Y as o,le as r,J as s,Xe 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{K as te,Pt as re}from"./cells-k7Js5h2t.js";import{t as z}from"./compiler-runtime-B3qBwwSJ.js";import{t as le}from"./cn-DCUzRj2J.js";import{t as ne}from"./jsx-runtime-BqBOg78p.js";import{d as se}from"./alert-dialog-5BGIfskO.js";import{i as B,r as ae,t as G}from"./popover-CNCYAwbC.js";import{a as oe,n as ie,o as ce,t as me}from"./tooltip-B_PkSKN3.js";import{t as de}from"./useCellActionButton-
|
|
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{K as te,Pt as re}from"./cells-k7Js5h2t.js";import{t as z}from"./compiler-runtime-B3qBwwSJ.js";import{t as le}from"./cn-DCUzRj2J.js";import{t as ne}from"./jsx-runtime-BqBOg78p.js";import{d as se}from"./alert-dialog-5BGIfskO.js";import{i as B,r as ae,t as G}from"./popover-CNCYAwbC.js";import{a as oe,n as ie,o as ce,t as me}from"./tooltip-B_PkSKN3.js";import{t as de}from"./useCellActionButton-DNDYDKvS.js";import{n as he}from"./focus-CRI5ilWC.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-BmOGG6-2.js";import{a as ye,i as Ne}from"./renderShortcut--ku7VECI.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,D]=(0,h.useState)(!1),N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N=()=>D(!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),P=se(),g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{te(()=>{I.current&&I.current.scrollIntoView({behavior:"auto",block:"nearest"})})},e[1]=g):g=e[1];let T=q(g),w;e[2]===T?w=e[3]:(w=a=>{D(o=>{let l=typeof a=="function"?a(o):a;return l&&T(),l})},e[2]=T,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=re(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(),D(!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]!==P||e[19]!==j?(C=(0,t.jsx)(A,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...P,children:j}),e[17]=A,e[18]=P,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 k;return e[34]!==b||e[35]!==i||e[36]!==d||e[37]!==y?(k=(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]=k):k=e[38],k})),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 ke(){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 De(){return X(U)}export{Q as i,De as n,L as r,ke as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as ve}from"./chunk-LvLJmgfZ.js";import{d as L,l as at,p as ot,u as Z}from"./useEvent-D91BmmQi.js";import{t as nt}from"./react-Bj1aDYRI.js";import{D as Ce,Dn as it,Dr as st,E as lt,Ii as me,Mn as rt,On as dt,Sr as ct,Yr as ht,Zt as pt,_ as mt,_r as ut,ct as ft,h as ze,kn as bt,st as yt,t as kt,ut as We,yr as xt}from"./cells-k7Js5h2t.js";import{t as P}from"./compiler-runtime-B3qBwwSJ.js";import{n as wt,x as gt}from"./ai-model-dropdown-BhCUiMlB.js";import{_ as T,d as Me}from"./useEventListener-DvoEXWke.js";import{x as jt}from"./utils-CvI-39U6.js";import{n as C,t as De}from"./constants-DMpttj8Q.js";import{T as Q,v as vt,w as Ct}from"./config-ClMcu_sV.js";import{t as zt}from"./jsx-runtime-BqBOg78p.js";import{o as Wt}from"./alert-dialog-5BGIfskO.js";import{a as Mt,c as Dt,i as _t,n as St,r as At,s as Pt,t as Nt}from"./select-6suE6YM2.js";import{Nt as It}from"./JsonOutput-BemZ015x.js";import{c as _e,d as ue,n as Et,o as Lt,r as fe,t as Tt}from"./download-BS31LU22.js";import{t as Ht}from"./tooltip-B_PkSKN3.js";import{r as Rt,t as be}from"./button-BbCh-29a.js";import{i as Ft,t as Se}from"./strings-wdPMRf6Z.js";import{r as H}from"./requests-DIwGYs0l.js";import{t as h}from"./createLucideIcon-D5guW7EU.js";import{F as Ot,I as qt,L as Ae,P as Yt,R as Bt,a as Pe,i as Ne,u as Ie}from"./layout-Di_1u3yT.js";import{t as Ee}from"./check-BH35Ndha.js";import{r as Vt}from"./useCellActionButton-DH4naKvY.js";import{t as $t}from"./copy-BwrPA9zQ.js";import{t as Kt}from"./eye-off-Cm6DdkeR.js";import{t as Ut}from"./external-link-BTNxSavU.js";import{t as X}from"./file-BrdxGLRX.js";import{t as Gt}from"./github-BKS_2Qwn.js";import{u as Jt}from"./form-BWJXHKy1.js";import{n as Zt,r as Qt,t as Xt}from"./youtube-CbdpN8oL.js";import{i as ea,n as Le}from"./add-connection-dialog-ZjsgZSOV.js";import{t as ta}from"./house-mGK3v0Mm.js";import{t as aa}from"./image-DQHXdEQn.js";import{t as oa}from"./link-CfEtM3Rl.js";import{r as na}from"./input-DckzEovC.js";import{t as ia}from"./settings-DfFe0dWD.js";import{t as sa}from"./sparkles-lWUAsPhp.js";import{y as la}from"./textarea-BfDUjd9c.js";import{t as ra}from"./square-B5xWCt0a.js";import{t as z}from"./use-toast-CJ1Tj2eC.js";import{n as Te,t as da}from"./paths-D5zczhUD.js";import{o as ca}from"./session-0B5NBztP.js";import{n as ee}from"./copy-LK56fFow.js";import{r as ha}from"./useRunCells-CVd2QKS9.js";import{a as pa,c as ma,i as ua,n as fa,r as ba}from"./dialog-DRnNAWYl.js";import{n as ye}from"./ImperativeModal-CDPfRIx5.js";import{r as ya,t as He}from"./share-mSf5FZIP.js";import{a as ka}from"./cell-link-BFEa98Sc.js";import{a as xa}from"./renderShortcut--ku7VECI.js";import{t as wa}from"./icons-Ol38nIbL.js";import{t as ga}from"./pair-with-agent-modal-_SlYEcmZ.js";import{n as Re}from"./marimo-icons-CLbC-oB3.js";import{t as ja}from"./links-DoPgJNku.js";import{r as va,t as Fe}from"./hooks-ClbTcW-s.js";import{t as Oe}from"./types-Cpe-qFT-.js";var Ca=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),za=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),qe=h("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"}]]),Ye=h("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"}]]),Be=h("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"}]]),Wa=h("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"}]]),Ma=h("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"}]]),Da=h("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"}]]),_a=h("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"}]]),Sa=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Ve=h("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"}]]),Aa=h("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"}]]),Pa=h("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"}]]),$e=h("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"}]]),Ke=P(),ke=ve(nt(),1),a=ve(zt(),1),te="https://static.marimo.app";const Na=e=>{let t=(0,Ke.c)(25),{onClose:n}=e,[o,s]=(0,ke.useState)(""),{exportAsHTML:r}=H(),l=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${te}/static/${l}`,d;t[0]!==r||t[1]!==n||t[2]!==l?(d=async v=>{v.preventDefault(),n();let I=await r({download:!1,includeCode:!0,files:Yt.INSTANCE.filenames()}),W=z({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${te}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:I,path:l})}).catch(()=>{W.dismiss(),z({title:"Error uploading static page",description:(0,a.jsxs)("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",(0,a.jsx)("a",{href:C.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),W.dismiss(),z({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},t[0]=r,t[1]=n,t[2]=l,t[3]=d):d=t[3];let m;t[4]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(ma,{children:"Share static notebook"}),t[4]=m):m=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(pa,{children:[m,(0,a.jsxs)(ba,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",(0,a.jsx)("a",{href:te,target:"_blank",children:te}),"."]})]}),t[5]=w):w=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{s(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let u;t[7]===o?u=t[8]:(u=(0,a.jsx)(na,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=u);let f;t[9]===i?f=t[10]:(f=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(Ia,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),t[9]=i,t[10]=f);let b;t[11]!==u||t[12]!==f?(b=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[u,f]}),t[11]=u,t[12]=f,t[13]=b):b=t[13];let y;t[14]===n?y=t[15]:(y=(0,a.jsx)(be,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=y);let k;t[16]===i?k=t[17]:(k=(0,a.jsx)(be,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await ee(i)},children:"Create"}),t[16]=i,t[17]=k);let x;t[18]!==y||t[19]!==k?(x=(0,a.jsxs)(ua,{children:[y,k]}),t[18]=y,t[19]=k,t[20]=x):x=t[20];let j;return t[21]!==d||t[22]!==x||t[23]!==b?(j=(0,a.jsx)(fa,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[w,b,x]})}),t[21]=d,t[22]=x,t[23]=b,t[24]=j):j=t[24],j};var Ia=e=>{let t=(0,Ke.c)(8),[n,o]=ke.useState(!1),s;t[0]===e.text?s=t[1]:(s=Rt.stopPropagation(async m=>{m.preventDefault(),await ee(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=s);let r=s,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)($t,{size:14,strokeWidth:1.5}),t[2]=l):l=t[2];let i;t[3]===r?i=t[4]:(i=(0,a.jsx)(be,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:l}),t[3]=r,t[4]=i);let d;return t[5]!==n||t[6]!==i?(d=(0,a.jsx)(Ht,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=d):d=t[7],d},Ea=P();function La(){let e=document.getElementsByClassName(De.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=me.findElement(t);if(!o){T.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:me.parse(o.id)}}}return T.warn("No visible output area found for scroll anchor"),null}function Ta(e){if(!e){T.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(me.create(e.cellId));if(!t){T.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${De.outputArea}`)){T.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ue(){let e=(0,Ea.c)(2),t=L(We),n;return e[0]===t?n=e[1]:(n=()=>{let o=La();t(s=>({mode:ft(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Ta(o)})})},e[0]=t,e[1]=n),n}const Ge=ot(!1);var Ha=P();const Ra=()=>{let e=(0,Ha.c)(7),{selectedLayout:t}=Pe(),{setLayoutView:n}=Ne();if(Q()&&!rt("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=i=>n(i),e[0]=n,e[1]=o);let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Pt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Dt,{placeholder:"Select a view"})}),e[2]=s):s=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(St,{children:(0,a.jsxs)(At,{children:[(0,a.jsx)(Mt,{children:"View as"}),Oe.map(Oa)]})}),e[3]=r):r=e[3];let l;return e[4]!==t||e[5]!==o?(l=(0,a.jsxs)(Nt,{"data-testid":"layout-select",value:t,onValueChange:o,children:[s,r]}),e[4]=t,e[5]=o,e[6]=l):l=e[6],l};function Fa(e){return(0,a.jsx)(Je(e),{className:"h-4 w-4"})}function Je(e){switch(e){case"vertical":return Da;case"grid":return Qt;case"slides":return Ve;default:return Ft(e),ra}}function Ze(e){return Se.startCase(e)}function Oa(e){return(0,a.jsx)(_t,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Fa(e),(0,a.jsx)("span",{children:Ze(e)})]})},e)}async function qa(e){let{filename:t,preset:n,downloadPDF:o}=e;await o({filename:t,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var Ya=P();function Ba(e){let t=(0,Ya.c)(5),{openPrompt:n,closeModal:o}=ye(),{sendCopy:s}=H(),r;return t[0]!==o||t[1]!==n||t[2]!==s||t[3]!==e?(r=()=>{if(!e)return null;let l=da.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Te.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=l.join(Te.dirname(e),i);s({source:e,destination:d}).then(()=>{o(),z({title:"Notebook copied",description:"A copy of the notebook has been created."}),ja(d)})}})},t[0]=o,t[1]=n,t[2]=s,t[3]=e,t[4]=r):r=t[4],r}const Va=()=>{let{updateCellConfig:e}=Ce(),{saveCellConfig:t}=H();return(0,ke.useCallback)(async()=>{let n=new pt,o=ze(),s=o.cellIds.inOrderIds,r={};for(let i of s){if(o.cellData[i]===void 0)continue;let{code:d,config:m}=o.cellData[i];m.hide_code||n.isSupported(d)&&(r[i]={hide_code:!0})}let l=Me.entries(r);if(l.length!==0){await t({configs:r});for(let[i,d]of l)e({cellId:i,config:d})}},[e])};var $a=P();function Qe(){let e=(0,$a.c)(4),{openConfirm:t}=ye(),n=L(vt),{sendRestart:o}=H(),s;return e[0]!==t||e[1]!==o||e[2]!==n?(s=()=>{t({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(Wt,{onClick:async()=>{n({state:Ct.CLOSING}),await o(),ya()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=s):s=e[3],s}var Ka=P(),N=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Ua(){var we,ge,je;let e=(0,Ka.c)(53),t=ka(),{openModal:n,closeModal:o}=ye(),{toggleApplication:s}=it(),{selectedPanel:r}=dt(),[l]=at(We),i=Z(yt),d=Va(),[m]=jt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:u,addSetupCellIfDoesntExist:f,collapseAllCells:b,expandAllCells:y}=Ce(),k=Qe(),x=ha(),j=Ba(t),v=L(Ge),I=L(wt),W=L(gt),{exportAsIPYNB:oe,exportAsMarkdown:ne,readCode:M,saveCellConfig:ie,updateCellOutputs:D}=H(),_=va(),se=Z(mt),le=Z(kt),re=Z(lt),{selectedLayout:R}=Pe(),{setLayoutView:de}=Ne(),F=Ue(),O=((we=m.sharing)==null?void 0:we.html)??!0,q=((ge=m.sharing)==null?void 0:ge.wasm)??!0,Y=((je=m.sharing)==null?void 0:je.molab)??!0,xe=!Q(),ce=R==="slides",Xe=mo,et=po,B;e[0]!==t||e[1]!==_||e[2]!==D?(B=async c=>{let{preset:p,title:E}=c;if(!t){ae();return}await _e(E,async pe=>{await Fe({takeScreenshots:()=>_({progress:pe}),updateCellOutputs:D}),await qa({filename:t,preset:p,downloadPDF:Et})})},e[0]=t,e[1]=_,e[2]=D,e[3]=B):B=e[3];let S=B,V;e[4]===S?V=e[5]:(V=async()=>{if(xe){await S({preset:"document",title:"Downloading Document PDF..."});return}let c=new Event("export-beforeprint"),p=new Event("export-afterprint");window.dispatchEvent(c),setTimeout(ho,0),setTimeout(()=>window.dispatchEvent(p),0)},e[4]=S,e[5]=V);let $=V,K;e[6]!==oe||e[7]!==t||e[8]!==_||e[9]!==D?(K=async()=>{if(!t){ae();return}await _e("Downloading IPYNB...",async c=>{await Fe({takeScreenshots:()=>_({progress:c}),updateCellOutputs:D});let p=await oe({download:!1});fe(new Blob([p],{type:"application/x-ipynb+json"}),ue.toIPYNB(document.title))})},e[6]=oe,e[7]=t,e[8]=_,e[9]=D,e[10]=K):K=e[10];let he=K,U;e[11]===Symbol.for("react.memo_cache_sentinel")?(U=(0,a.jsx)(It,{size:14,strokeWidth:1.5}),e[11]=U):U=e[11];let G;e[12]===Symbol.for("react.memo_cache_sentinel")?(G=(0,a.jsx)(Ae,{size:14,strokeWidth:1.5}),e[12]=G):G=e[12];let A;e[13]===t?A=e[14]:(A=async()=>{if(!t){ae();return}await Ie({filename:t,includeCode:!0})},e[13]=t,e[14]=A);let J;return e[15]!==f||e[16]!==le||e[17]!==u||e[18]!==o||e[19]!==b||e[20]!==j||e[21]!==S||e[22]!==y||e[23]!==ne||e[24]!==t||e[25]!==$||e[26]!==he||e[27]!==se||e[28]!==d||e[29]!==ce||e[30]!==i||e[31]!==n||e[32]!==M||e[33]!==k||e[34]!==x||e[35]!==ie||e[36]!==R||e[37]!==r||e[38]!==v||e[39]!==W||e[40]!==de||e[41]!==I||e[42]!==O||e[43]!==Y||e[44]!==q||e[45]!==A||e[46]!==s||e[47]!==F||e[48]!==g||e[49]!==re||e[50]!==w||e[51]!==l.mode?(J=[{icon:U,label:"Download",handle:N,dropdown:[{icon:G,label:"Download as HTML",handle:A},{icon:(0,a.jsx)(Ae,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){ae();return}await Ie({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(wa,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await ne({download:!1});fe(new Blob([c],{type:"text/plain"}),ue.toMarkdown(document.title))}},{icon:(0,a.jsx)(_a,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:he},{icon:(0,a.jsx)(Bt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await M();fe(new Blob([c.contents],{type:"text/plain"}),ue.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(aa,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:l.mode!=="present",tooltip:l.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",xa("global.hideCode",!1)]}),handle:co},ce?{divider:!0,icon:(0,a.jsx)(X,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:N,dropdown:[{icon:(0,a.jsx)(X,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:$},{icon:(0,a.jsx)(X,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:et(!0),hidden:!xe,handle:async()=>{await S({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(X,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:$}]},{icon:(0,a.jsx)(sa,{size:14,strokeWidth:1.5}),label:"Pair with an agent",hidden:Q(),handle:async()=>{n((0,a.jsx)(ga,{onClose:o}))}},{icon:(0,a.jsx)(Aa,{size:14,strokeWidth:1.5}),label:"Share",handle:N,hidden:!O&&!q&&!Y,dropdown:[{icon:(0,a.jsx)(Jt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!O,handle:async()=>{n((0,a.jsx)(Na,{onClose:o}))}},{icon:(0,a.jsx)(oa,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!q,handle:async()=>{await ee(He({code:(await M()).contents})),z({title:"Copied",description:"Link copied to clipboard."})}},{icon:(0,a.jsx)(Re,{size:14,strokeWidth:1.5}),label:"Create molab notebook",hidden:!Y,handle:async()=>{let c=He({code:(await M()).contents,baseUrl:`${C.molab}/new`});window.open(c,"_blank")}}]},{icon:(0,a.jsx)(Sa,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:N,dropdown:bt.flatMap(c=>{let{type:p,Icon:E,hidden:pe,additionalKeywords:tt}=c;return pe?[]:{label:Se.startCase(p),rightElement:Xe(r===p),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),handle:()=>s(p),additionalKeywords:tt}})},{icon:(0,a.jsx)(Ve,{size:14,strokeWidth:1.5}),label:"Present as",handle:N,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(la,{size:14,strokeWidth:1.5}):(0,a.jsx)(Ot,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{F()}},...Oe.map((c,p)=>{let E=Je(c);return{divider:p===0,label:Ze(c),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:R===c&&(0,a.jsx)(Ee,{size:14})}),handle:()=>{de(c),l.mode==="edit"&&F()}}})]},{icon:(0,a.jsx)(Ma,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||Q(),handle:j},{icon:(0,a.jsx)(qe,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await ee((await M()).contents),z({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(Vt,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!se||i,handle:async()=>{let c=ht(ze());await ie({configs:Me.fromEntries(c.map(ro))});for(let p of c)w({cellId:p,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Be,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{f({})}},{icon:(0,a.jsx)(xt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(Le,{onClose:o}))}},{icon:(0,a.jsx)(ea,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(Le,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)($e,{size:14,strokeWidth:1.5}),label:re,hidden:!le||i,handle:()=>{g()}},{icon:(0,a.jsx)(Pa,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:k,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Wa,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{x()}},{icon:(0,a.jsx)(ct,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{u()}},{icon:(0,a.jsx)(Kt,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(za,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:b,redundant:!0},{icon:(0,a.jsx)(Ca,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:y,redundant:!0},{divider:!0,icon:(0,a.jsx)(Ye,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(lo)},{icon:(0,a.jsx)(qt,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>W(so)},{icon:(0,a.jsx)(ia,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>I(io),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(Ut,{size:14,strokeWidth:1.5}),label:"Resources",handle:N,dropdown:[{icon:(0,a.jsx)(st,{size:14,strokeWidth:1.5}),label:"Documentation",handle:no},{icon:(0,a.jsx)(Gt,{size:14,strokeWidth:1.5}),label:"GitHub",handle:oo},{icon:(0,a.jsx)(Zt,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:ao},{icon:(0,a.jsx)(Xt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:to},{icon:(0,a.jsx)(ut,{size:14,strokeWidth:1.5}),label:"Changelog",handle:eo}]},{divider:!0,icon:(0,a.jsx)(ta,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Xa},{icon:(0,a.jsx)(Re,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Qa}].filter(Za).map(Ga),e[15]=f,e[16]=le,e[17]=u,e[18]=o,e[19]=b,e[20]=j,e[21]=S,e[22]=y,e[23]=ne,e[24]=t,e[25]=$,e[26]=he,e[27]=se,e[28]=d,e[29]=ce,e[30]=i,e[31]=n,e[32]=M,e[33]=k,e[34]=x,e[35]=ie,e[36]=R,e[37]=r,e[38]=v,e[39]=W,e[40]=de,e[41]=I,e[42]=O,e[43]=Y,e[44]=q,e[45]=A,e[46]=s,e[47]=F,e[48]=g,e[49]=re,e[50]=w,e[51]=l.mode,e[52]=J):J=e[52],J}function Ga(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Ja)}:e}function Ja(e){return!e.hidden}function Za(e){return!e.hidden}function Qa(){let e=ca();window.open(e,"_blank")}function Xa(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function eo(){window.open(C.releasesPage,"_blank")}function to(){window.open(C.youtube,"_blank")}function ao(){window.open(C.discordLink,"_blank")}function oo(){window.open(C.githubPage,"_blank")}function no(){window.open(C.docsPage,"_blank")}function io(e){return!e}function so(e){return!e}function lo(e){return!e}function ro(e){return[e,{disabled:!1}]}async function co(){let e=document.getElementById("App");e&&await Lt({element:e,filename:document.title,prepare:Tt})}function ho(){return window.print()}function po(e){return e?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function mo(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(Ee,{size:14})})}function ae(){z({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{Ue as a,Ye as c,Ge as i,qe as l,Qe as n,$e as o,Ra as r,Be as s,Ua as t};
|
|
1
|
+
import{s as ve}from"./chunk-LvLJmgfZ.js";import{d as L,l as at,p as ot,u as Z}from"./useEvent-D91BmmQi.js";import{t as nt}from"./react-Bj1aDYRI.js";import{D as Ce,Dn as it,Dr as st,E as lt,Ii as me,Mn as rt,On as dt,Sr as ct,Yr as ht,Zt as pt,_ as mt,_r as ut,ct as ft,h as ze,kn as bt,st as yt,t as kt,ut as We,yr as xt}from"./cells-k7Js5h2t.js";import{t as P}from"./compiler-runtime-B3qBwwSJ.js";import{n as wt,x as gt}from"./ai-model-dropdown-CXNYq3J_.js";import{_ as T,d as Me}from"./useEventListener-DvoEXWke.js";import{x as jt}from"./utils-CvI-39U6.js";import{n as C,t as De}from"./constants-DMpttj8Q.js";import{T as Q,v as vt,w as Ct}from"./config-ClMcu_sV.js";import{t as zt}from"./jsx-runtime-BqBOg78p.js";import{o as Wt}from"./alert-dialog-5BGIfskO.js";import{a as Mt,c as Dt,i as _t,n as St,r as At,s as Pt,t as Nt}from"./select-6suE6YM2.js";import{Nt as It}from"./JsonOutput-DXzjDImT.js";import{c as _e,d as ue,n as Et,o as Lt,r as fe,t as Tt}from"./download-BS31LU22.js";import{t as Ht}from"./tooltip-B_PkSKN3.js";import{r as Rt,t as be}from"./button-BbCh-29a.js";import{i as Ft,t as Se}from"./strings-wdPMRf6Z.js";import{r as H}from"./requests-DIwGYs0l.js";import{t as h}from"./createLucideIcon-D5guW7EU.js";import{F as Ot,I as qt,L as Ae,P as Yt,R as Bt,a as Pe,i as Ne,u as Ie}from"./layout-By2E0DxG.js";import{t as Ee}from"./check-BH35Ndha.js";import{r as Vt}from"./useCellActionButton-DNDYDKvS.js";import{t as $t}from"./copy-BwrPA9zQ.js";import{t as Kt}from"./eye-off-Cm6DdkeR.js";import{t as Ut}from"./external-link-BTNxSavU.js";import{t as X}from"./file-BrdxGLRX.js";import{t as Gt}from"./github-BKS_2Qwn.js";import{u as Jt}from"./form-BUVEy6A8.js";import{n as Zt,r as Qt,t as Xt}from"./youtube-CbdpN8oL.js";import{i as ea,n as Le}from"./add-connection-dialog-CTTPp4DA.js";import{t as ta}from"./house-mGK3v0Mm.js";import{t as aa}from"./image-DQHXdEQn.js";import{t as oa}from"./link-CfEtM3Rl.js";import{r as na}from"./input-DA8xlX70.js";import{t as ia}from"./settings-DfFe0dWD.js";import{t as sa}from"./sparkles-lWUAsPhp.js";import{y as la}from"./textarea-BfDUjd9c.js";import{t as ra}from"./square-B5xWCt0a.js";import{t as z}from"./use-toast-CJ1Tj2eC.js";import{n as Te,t as da}from"./paths-D5zczhUD.js";import{o as ca}from"./session-0B5NBztP.js";import{n as ee}from"./copy-LK56fFow.js";import{r as ha}from"./useRunCells-CVd2QKS9.js";import{a as pa,c as ma,i as ua,n as fa,r as ba}from"./dialog-DRnNAWYl.js";import{n as ye}from"./ImperativeModal-BW1dmntO.js";import{r as ya,t as He}from"./share-mSf5FZIP.js";import{a as ka}from"./cell-link-spbX-mlL.js";import{a as xa}from"./renderShortcut--ku7VECI.js";import{t as wa}from"./icons-Ol38nIbL.js";import{t as ga}from"./pair-with-agent-modal-_SlYEcmZ.js";import{n as Re}from"./marimo-icons-CLbC-oB3.js";import{t as ja}from"./links-DoPgJNku.js";import{r as va,t as Fe}from"./hooks-B4MwgGVt.js";import{t as Oe}from"./types-Cpe-qFT-.js";var Ca=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),za=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),qe=h("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"}]]),Ye=h("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"}]]),Be=h("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"}]]),Wa=h("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"}]]),Ma=h("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"}]]),Da=h("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"}]]),_a=h("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"}]]),Sa=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Ve=h("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"}]]),Aa=h("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"}]]),Pa=h("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"}]]),$e=h("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"}]]),Ke=P(),ke=ve(nt(),1),a=ve(zt(),1),te="https://static.marimo.app";const Na=e=>{let t=(0,Ke.c)(25),{onClose:n}=e,[o,s]=(0,ke.useState)(""),{exportAsHTML:r}=H(),l=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${te}/static/${l}`,d;t[0]!==r||t[1]!==n||t[2]!==l?(d=async v=>{v.preventDefault(),n();let I=await r({download:!1,includeCode:!0,files:Yt.INSTANCE.filenames()}),W=z({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${te}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:I,path:l})}).catch(()=>{W.dismiss(),z({title:"Error uploading static page",description:(0,a.jsxs)("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",(0,a.jsx)("a",{href:C.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),W.dismiss(),z({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},t[0]=r,t[1]=n,t[2]=l,t[3]=d):d=t[3];let m;t[4]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(ma,{children:"Share static notebook"}),t[4]=m):m=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(pa,{children:[m,(0,a.jsxs)(ba,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",(0,a.jsx)("a",{href:te,target:"_blank",children:te}),"."]})]}),t[5]=w):w=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{s(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let u;t[7]===o?u=t[8]:(u=(0,a.jsx)(na,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=u);let f;t[9]===i?f=t[10]:(f=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(Ia,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),t[9]=i,t[10]=f);let b;t[11]!==u||t[12]!==f?(b=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[u,f]}),t[11]=u,t[12]=f,t[13]=b):b=t[13];let y;t[14]===n?y=t[15]:(y=(0,a.jsx)(be,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=y);let k;t[16]===i?k=t[17]:(k=(0,a.jsx)(be,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await ee(i)},children:"Create"}),t[16]=i,t[17]=k);let x;t[18]!==y||t[19]!==k?(x=(0,a.jsxs)(ua,{children:[y,k]}),t[18]=y,t[19]=k,t[20]=x):x=t[20];let j;return t[21]!==d||t[22]!==x||t[23]!==b?(j=(0,a.jsx)(fa,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[w,b,x]})}),t[21]=d,t[22]=x,t[23]=b,t[24]=j):j=t[24],j};var Ia=e=>{let t=(0,Ke.c)(8),[n,o]=ke.useState(!1),s;t[0]===e.text?s=t[1]:(s=Rt.stopPropagation(async m=>{m.preventDefault(),await ee(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=s);let r=s,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)($t,{size:14,strokeWidth:1.5}),t[2]=l):l=t[2];let i;t[3]===r?i=t[4]:(i=(0,a.jsx)(be,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:l}),t[3]=r,t[4]=i);let d;return t[5]!==n||t[6]!==i?(d=(0,a.jsx)(Ht,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=d):d=t[7],d},Ea=P();function La(){let e=document.getElementsByClassName(De.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=me.findElement(t);if(!o){T.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:me.parse(o.id)}}}return T.warn("No visible output area found for scroll anchor"),null}function Ta(e){if(!e){T.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(me.create(e.cellId));if(!t){T.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${De.outputArea}`)){T.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ue(){let e=(0,Ea.c)(2),t=L(We),n;return e[0]===t?n=e[1]:(n=()=>{let o=La();t(s=>({mode:ft(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Ta(o)})})},e[0]=t,e[1]=n),n}const Ge=ot(!1);var Ha=P();const Ra=()=>{let e=(0,Ha.c)(7),{selectedLayout:t}=Pe(),{setLayoutView:n}=Ne();if(Q()&&!rt("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=i=>n(i),e[0]=n,e[1]=o);let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Pt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Dt,{placeholder:"Select a view"})}),e[2]=s):s=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(St,{children:(0,a.jsxs)(At,{children:[(0,a.jsx)(Mt,{children:"View as"}),Oe.map(Oa)]})}),e[3]=r):r=e[3];let l;return e[4]!==t||e[5]!==o?(l=(0,a.jsxs)(Nt,{"data-testid":"layout-select",value:t,onValueChange:o,children:[s,r]}),e[4]=t,e[5]=o,e[6]=l):l=e[6],l};function Fa(e){return(0,a.jsx)(Je(e),{className:"h-4 w-4"})}function Je(e){switch(e){case"vertical":return Da;case"grid":return Qt;case"slides":return Ve;default:return Ft(e),ra}}function Ze(e){return Se.startCase(e)}function Oa(e){return(0,a.jsx)(_t,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Fa(e),(0,a.jsx)("span",{children:Ze(e)})]})},e)}async function qa(e){let{filename:t,preset:n,downloadPDF:o}=e;await o({filename:t,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var Ya=P();function Ba(e){let t=(0,Ya.c)(5),{openPrompt:n,closeModal:o}=ye(),{sendCopy:s}=H(),r;return t[0]!==o||t[1]!==n||t[2]!==s||t[3]!==e?(r=()=>{if(!e)return null;let l=da.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Te.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=l.join(Te.dirname(e),i);s({source:e,destination:d}).then(()=>{o(),z({title:"Notebook copied",description:"A copy of the notebook has been created."}),ja(d)})}})},t[0]=o,t[1]=n,t[2]=s,t[3]=e,t[4]=r):r=t[4],r}const Va=()=>{let{updateCellConfig:e}=Ce(),{saveCellConfig:t}=H();return(0,ke.useCallback)(async()=>{let n=new pt,o=ze(),s=o.cellIds.inOrderIds,r={};for(let i of s){if(o.cellData[i]===void 0)continue;let{code:d,config:m}=o.cellData[i];m.hide_code||n.isSupported(d)&&(r[i]={hide_code:!0})}let l=Me.entries(r);if(l.length!==0){await t({configs:r});for(let[i,d]of l)e({cellId:i,config:d})}},[e])};var $a=P();function Qe(){let e=(0,$a.c)(4),{openConfirm:t}=ye(),n=L(vt),{sendRestart:o}=H(),s;return e[0]!==t||e[1]!==o||e[2]!==n?(s=()=>{t({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(Wt,{onClick:async()=>{n({state:Ct.CLOSING}),await o(),ya()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=s):s=e[3],s}var Ka=P(),N=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Ua(){var we,ge,je;let e=(0,Ka.c)(53),t=ka(),{openModal:n,closeModal:o}=ye(),{toggleApplication:s}=it(),{selectedPanel:r}=dt(),[l]=at(We),i=Z(yt),d=Va(),[m]=jt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:u,addSetupCellIfDoesntExist:f,collapseAllCells:b,expandAllCells:y}=Ce(),k=Qe(),x=ha(),j=Ba(t),v=L(Ge),I=L(wt),W=L(gt),{exportAsIPYNB:oe,exportAsMarkdown:ne,readCode:M,saveCellConfig:ie,updateCellOutputs:D}=H(),_=va(),se=Z(mt),le=Z(kt),re=Z(lt),{selectedLayout:R}=Pe(),{setLayoutView:de}=Ne(),F=Ue(),O=((we=m.sharing)==null?void 0:we.html)??!0,q=((ge=m.sharing)==null?void 0:ge.wasm)??!0,Y=((je=m.sharing)==null?void 0:je.molab)??!0,xe=!Q(),ce=R==="slides",Xe=mo,et=po,B;e[0]!==t||e[1]!==_||e[2]!==D?(B=async c=>{let{preset:p,title:E}=c;if(!t){ae();return}await _e(E,async pe=>{await Fe({takeScreenshots:()=>_({progress:pe}),updateCellOutputs:D}),await qa({filename:t,preset:p,downloadPDF:Et})})},e[0]=t,e[1]=_,e[2]=D,e[3]=B):B=e[3];let S=B,V;e[4]===S?V=e[5]:(V=async()=>{if(xe){await S({preset:"document",title:"Downloading Document PDF..."});return}let c=new Event("export-beforeprint"),p=new Event("export-afterprint");window.dispatchEvent(c),setTimeout(ho,0),setTimeout(()=>window.dispatchEvent(p),0)},e[4]=S,e[5]=V);let $=V,K;e[6]!==oe||e[7]!==t||e[8]!==_||e[9]!==D?(K=async()=>{if(!t){ae();return}await _e("Downloading IPYNB...",async c=>{await Fe({takeScreenshots:()=>_({progress:c}),updateCellOutputs:D});let p=await oe({download:!1});fe(new Blob([p],{type:"application/x-ipynb+json"}),ue.toIPYNB(document.title))})},e[6]=oe,e[7]=t,e[8]=_,e[9]=D,e[10]=K):K=e[10];let he=K,U;e[11]===Symbol.for("react.memo_cache_sentinel")?(U=(0,a.jsx)(It,{size:14,strokeWidth:1.5}),e[11]=U):U=e[11];let G;e[12]===Symbol.for("react.memo_cache_sentinel")?(G=(0,a.jsx)(Ae,{size:14,strokeWidth:1.5}),e[12]=G):G=e[12];let A;e[13]===t?A=e[14]:(A=async()=>{if(!t){ae();return}await Ie({filename:t,includeCode:!0})},e[13]=t,e[14]=A);let J;return e[15]!==f||e[16]!==le||e[17]!==u||e[18]!==o||e[19]!==b||e[20]!==j||e[21]!==S||e[22]!==y||e[23]!==ne||e[24]!==t||e[25]!==$||e[26]!==he||e[27]!==se||e[28]!==d||e[29]!==ce||e[30]!==i||e[31]!==n||e[32]!==M||e[33]!==k||e[34]!==x||e[35]!==ie||e[36]!==R||e[37]!==r||e[38]!==v||e[39]!==W||e[40]!==de||e[41]!==I||e[42]!==O||e[43]!==Y||e[44]!==q||e[45]!==A||e[46]!==s||e[47]!==F||e[48]!==g||e[49]!==re||e[50]!==w||e[51]!==l.mode?(J=[{icon:U,label:"Download",handle:N,dropdown:[{icon:G,label:"Download as HTML",handle:A},{icon:(0,a.jsx)(Ae,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){ae();return}await Ie({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(wa,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await ne({download:!1});fe(new Blob([c],{type:"text/plain"}),ue.toMarkdown(document.title))}},{icon:(0,a.jsx)(_a,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:he},{icon:(0,a.jsx)(Bt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await M();fe(new Blob([c.contents],{type:"text/plain"}),ue.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(aa,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:l.mode!=="present",tooltip:l.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",xa("global.hideCode",!1)]}),handle:co},ce?{divider:!0,icon:(0,a.jsx)(X,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:N,dropdown:[{icon:(0,a.jsx)(X,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:$},{icon:(0,a.jsx)(X,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:et(!0),hidden:!xe,handle:async()=>{await S({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(X,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:$}]},{icon:(0,a.jsx)(sa,{size:14,strokeWidth:1.5}),label:"Pair with an agent",hidden:Q(),handle:async()=>{n((0,a.jsx)(ga,{onClose:o}))}},{icon:(0,a.jsx)(Aa,{size:14,strokeWidth:1.5}),label:"Share",handle:N,hidden:!O&&!q&&!Y,dropdown:[{icon:(0,a.jsx)(Jt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!O,handle:async()=>{n((0,a.jsx)(Na,{onClose:o}))}},{icon:(0,a.jsx)(oa,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!q,handle:async()=>{await ee(He({code:(await M()).contents})),z({title:"Copied",description:"Link copied to clipboard."})}},{icon:(0,a.jsx)(Re,{size:14,strokeWidth:1.5}),label:"Create molab notebook",hidden:!Y,handle:async()=>{let c=He({code:(await M()).contents,baseUrl:`${C.molab}/new`});window.open(c,"_blank")}}]},{icon:(0,a.jsx)(Sa,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:N,dropdown:bt.flatMap(c=>{let{type:p,Icon:E,hidden:pe,additionalKeywords:tt}=c;return pe?[]:{label:Se.startCase(p),rightElement:Xe(r===p),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),handle:()=>s(p),additionalKeywords:tt}})},{icon:(0,a.jsx)(Ve,{size:14,strokeWidth:1.5}),label:"Present as",handle:N,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(la,{size:14,strokeWidth:1.5}):(0,a.jsx)(Ot,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{F()}},...Oe.map((c,p)=>{let E=Je(c);return{divider:p===0,label:Ze(c),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:R===c&&(0,a.jsx)(Ee,{size:14})}),handle:()=>{de(c),l.mode==="edit"&&F()}}})]},{icon:(0,a.jsx)(Ma,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||Q(),handle:j},{icon:(0,a.jsx)(qe,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await ee((await M()).contents),z({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(Vt,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!se||i,handle:async()=>{let c=ht(ze());await ie({configs:Me.fromEntries(c.map(ro))});for(let p of c)w({cellId:p,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Be,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{f({})}},{icon:(0,a.jsx)(xt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(Le,{onClose:o}))}},{icon:(0,a.jsx)(ea,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(Le,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)($e,{size:14,strokeWidth:1.5}),label:re,hidden:!le||i,handle:()=>{g()}},{icon:(0,a.jsx)(Pa,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:k,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Wa,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{x()}},{icon:(0,a.jsx)(ct,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{u()}},{icon:(0,a.jsx)(Kt,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(za,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:b,redundant:!0},{icon:(0,a.jsx)(Ca,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:y,redundant:!0},{divider:!0,icon:(0,a.jsx)(Ye,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(lo)},{icon:(0,a.jsx)(qt,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>W(so)},{icon:(0,a.jsx)(ia,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>I(io),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(Ut,{size:14,strokeWidth:1.5}),label:"Resources",handle:N,dropdown:[{icon:(0,a.jsx)(st,{size:14,strokeWidth:1.5}),label:"Documentation",handle:no},{icon:(0,a.jsx)(Gt,{size:14,strokeWidth:1.5}),label:"GitHub",handle:oo},{icon:(0,a.jsx)(Zt,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:ao},{icon:(0,a.jsx)(Xt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:to},{icon:(0,a.jsx)(ut,{size:14,strokeWidth:1.5}),label:"Changelog",handle:eo}]},{divider:!0,icon:(0,a.jsx)(ta,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Xa},{icon:(0,a.jsx)(Re,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Qa}].filter(Za).map(Ga),e[15]=f,e[16]=le,e[17]=u,e[18]=o,e[19]=b,e[20]=j,e[21]=S,e[22]=y,e[23]=ne,e[24]=t,e[25]=$,e[26]=he,e[27]=se,e[28]=d,e[29]=ce,e[30]=i,e[31]=n,e[32]=M,e[33]=k,e[34]=x,e[35]=ie,e[36]=R,e[37]=r,e[38]=v,e[39]=W,e[40]=de,e[41]=I,e[42]=O,e[43]=Y,e[44]=q,e[45]=A,e[46]=s,e[47]=F,e[48]=g,e[49]=re,e[50]=w,e[51]=l.mode,e[52]=J):J=e[52],J}function Ga(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Ja)}:e}function Ja(e){return!e.hidden}function Za(e){return!e.hidden}function Qa(){let e=ca();window.open(e,"_blank")}function Xa(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function eo(){window.open(C.releasesPage,"_blank")}function to(){window.open(C.youtube,"_blank")}function ao(){window.open(C.discordLink,"_blank")}function oo(){window.open(C.githubPage,"_blank")}function no(){window.open(C.docsPage,"_blank")}function io(e){return!e}function so(e){return!e}function lo(e){return!e}function ro(e){return[e,{disabled:!1}]}async function co(){let e=document.getElementById("App");e&&await Lt({element:e,filename:document.title,prepare:Tt})}function ho(){return window.print()}function po(e){return e?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function mo(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(Ee,{size:14})})}function ae(){z({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{Ue as a,Ye as c,Ge as i,qe as l,Qe as n,$e as o,Ra as r,Be as s,Ua as t};
|