@marimo-team/frontend 0.24.1-dev123 → 0.24.1-dev124

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/dist/assets/{JsonOutput-Bgxc9G7d.js → JsonOutput-CzIGPEZQ.js} +1 -1
  2. package/dist/assets/{agent-panel-B03P2qSx.js → agent-panel-Cgt_K0tD.js} +1 -1
  3. package/dist/assets/{cell-editor-QmA8u1Ay.js → cell-editor-Dw09J9yD.js} +1 -1
  4. package/dist/assets/{column-preview-DHe0-7z4.js → column-preview-riSXbYe_.js} +1 -1
  5. package/dist/assets/{command-palette-D-kPO0tm.js → command-palette-CCVzJcyf.js} +1 -1
  6. package/dist/assets/{edit-page-CdCPUPqZ.js → edit-page-Vqd9NedM.js} +4 -4
  7. package/dist/assets/{file-explorer-panel-DMKcHVIX.js → file-explorer-panel-6HvNfCrJ.js} +1 -1
  8. package/dist/assets/home-page-BLd6rnbk.js +4 -0
  9. package/dist/assets/{index-ClZGC-u9.js → index-62Kfuyhr.js} +3 -3
  10. package/dist/assets/{layout-CC2AHMrW.js → layout-DWnrxIo2.js} +3 -3
  11. package/dist/assets/{panels-BsXw4GTa.js → panels-CWn0Yh1D.js} +1 -1
  12. package/dist/assets/{reveal-component-BuI7t0JO.js → reveal-component-nZIAapoD.js} +1 -1
  13. package/dist/assets/{run-page-DZNsqz9H.js → run-page-9pl8qhQR.js} +1 -1
  14. package/dist/assets/{scratchpad-panel-CARmXIqQ.js → scratchpad-panel-BleGt2KM.js} +1 -1
  15. package/dist/assets/{session-panel-CB5EvmZs.js → session-panel-DRGPlL5J.js} +1 -1
  16. package/dist/assets/{skeleton-idYPIMw_.js → skeleton-BKeh8hf3.js} +1 -1
  17. package/dist/assets/{useNotebookActions-Br4AVVRg.js → useNotebookActions-CQtbk9CB.js} +1 -1
  18. package/dist/index.html +3 -3
  19. package/package.json +1 -1
  20. package/src/components/data-table/renderers.tsx +2 -2
  21. package/src/components/home/components.tsx +1 -0
  22. package/src/plugins/impl/MatrixPlugin.tsx +1 -1
  23. package/dist/assets/home-page-Cir7n_EF.js +0 -4
@@ -1,4 +1,4 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,r as i,u as a}from"./useEvent-xfs0Sn4r.js";import{t as o}from"./react-CBDbhulC.js";import{$n as s,A as c,B as l,D as u,Fo as d,I as f,Jr as p,Mt as m,Nt as h,Ot as g,Pt as ee,Qn as te,R as _,Rr as ne,T as v,Vo as re,Xn as ie,Zn as ae,at as oe,b as y,br as se,er as ce,g as b,ga as le,h as ue,l as de,oi as fe,xa as pe,yr as me}from"./cells-Cp-G34Rz.js";import{t as he}from"./compiler-runtime-CYIjoINj.js";import{O as ge,T as _e,f as ve}from"./utils-D5Ywm7-q.js";import{_ as x,b as ye,c as be,g as xe,i as Se,m as S,n as C,o as w,p as Ce,r as T,s as we,t as Te,v as Ee}from"./state-Di9TbuV9.js";import{g as E,t as De}from"./useEventListener-92uWqz-P.js";import{t as Oe}from"./objects-snlMn4yk.js";import{r as D}from"./constants-BDbGiS7O.js";import{D as ke,M as O,N as Ae,O as je,T as k,d as Me,l as Ne,o as Pe,v as Fe,w as A}from"./config-BlNM0caL.js";import{o as j}from"./switch-DjXr9Y9D.js";import{h as M,l as N,m as Ie,o as Le,p as Re,s as ze}from"./readonly-python-code-DpIyjHqY.js";import{n as Be}from"./ErrorBoundary-CDVGFYfr.js";import{n as P,t as F}from"./cn-ldLVeaqm.js";import{t as I}from"./jsx-runtime-B74pBk57.js";import{i as L,s as R}from"./fullscreen-BH2jz-F4.js";import{_ as z,f as B,g as Ve,h as He,m as V,p as H,v as U,y as W}from"./alert-dialog-CA-2mBs3.js";import{Ct as G,Ot as K,kt as q}from"./JsonOutput-Bgxc9G7d.js";import{h as J}from"./download-DMxOzI7b.js";import{t as Y}from"./tooltip-BUtPzKB4.js";import{t as Ue}from"./button-Dh8EwhsF.js";import{t as We}from"./createReducer-B_XmHROl.js";import{i as Ge}from"./strings-CReV1AYG.js";import{t as Ke}from"./requests-C6_IaFh7.js";import{t as qe}from"./createLucideIcon-B7HeEoG2.js";import{I as Je,a as Ye,c as Xe,i as Ze,n as Qe}from"./layout-CC2AHMrW.js";import{d as $e,n as et}from"./markdown-renderer-BZKlbm2Q.js";import{v as tt}from"./write-secret-modal-D6zoZgLY.js";import{n as nt}from"./spinner-Ck-Hgfvj.js";import{t as rt}from"./uuid-k9DpjH68.js";import{t as it}from"./use-toast-DpWHUGuF.js";import{i as at}from"./session-Sz5nSFku.js";import{n as ot}from"./useAsyncData-Buhk-UgR.js";import{t as st}from"./RenderHTML-DwhMAd9l.js";import{r as ct}from"./share-CPtBiNgr.js";import{a as lt}from"./errors-DzO-nXy-.js";import{s as ut}from"./react-icons.esm-hr79-MCS.js";import{r as dt}from"./events-CbeVJ6OD.js";import{i as ft}from"./cell-link-6burT2XF.js";import{t as pt}from"./requests-S_7PqcSt.js";import{t as mt}from"./ws-DLVysDhS.js";import{n as ht}from"./runs-euHSzlw_.js";var gt=qe(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),_t=qe(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),vt=qe(`unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),X=e(o(),1),Z=he(),Q=I(),yt=e=>{let t=(0,Z.c)(2),{reason:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`font-mono text-center text-base text-(--red-11)`,children:(0,Q.jsx)(`p`,{children:n})}),t[0]=n,t[1]=r),r},bt=e=>{let t=(0,Z.c)(7),{connection:n,className:r,children:i}=e,a;t[0]!==n.reason||t[1]!==n.state?(a=n.state===k.CLOSED&&(0,Q.jsx)(yt,{reason:n.reason}),t[0]=n.reason,t[1]=n.state,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==r||t[5]!==a?(o=(0,Q.jsxs)(`div`,{className:r,children:[i,a]}),t[3]=i,t[4]=r,t[5]=a,t[6]=o):o=t[6],o};function xt(e){let t=(0,Z.c)(3),[n,r]=(0,X.useState)(e<=0),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(e<=0){r(!0);return}r(!1);let t=setTimeout(()=>r(!0),e);return()=>clearTimeout(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,X.useLayoutEffect)(i,a),n}var St=e=>{let{requires:t,fallback:n,delay:i,children:a}=e,o=n===void 0?null:n,s=i===void 0?0:i,c=r(t),l=xt(c?0:s);return c?a:l?o:null},Ct=e=>{let t=(0,Z.c)(10),{title:n}=e,[r,i]=(0,X.useState)(n),[a,o]=(0,X.useState)(!0),s,c;t[0]!==r||t[1]!==n?(s=()=>{if(n!==r){o(!1);let e=setTimeout(()=>{i(n),o(!0)},300);return()=>clearTimeout(e)}},c=[n,r],t[0]=r,t[1]=n,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,X.useEffect)(s,c);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(nt,{className:`size-20 animate-spin text-primary`,"data-testid":`large-spinner`,strokeWidth:1}),t[4]=l):l=t[4];let u=a?`opacity-100`:`opacity-0`,d;t[5]===u?d=t[6]:(d=F(`mt-2 text-muted-foreground font-semibold text-lg transition-opacity duration-300`,u),t[5]=u,t[6]=d);let f;return t[7]!==r||t[8]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex flex-col h-full flex-1 items-center justify-center p-4`,children:[l,(0,Q.jsx)(`div`,{className:d,children:r})]}),t[7]=r,t[8]=d,t[9]=f):f=t[9],f};function wt(e,t){return e===`edit`||e===`home`||e===`gallery`?!0:e===`present`||at(D.includeCode,`false`)||at(D.showCode,`false`)?!1:at(D.showCode,`true`)?!0:t}function Tt(e){let t=wt(e.mode,e.showAppCode),n=e.hasCells&&e.hasCachedOutputs;return{showCode:t,showCachedOutputs:n,canPaint:e.hasCells&&(t||n||e.allCellsIdle)}}var Et=n(e=>{let t=!1,n=!0;for(let r of Object.values(e(y).cellRuntime))et(r.output)||(t=!0),r.status!==`idle`&&(n=!1);return{hasCachedOutputs:t,allCellsIdle:n}}),Dt=n(e=>e(Et).hasCachedOutputs),Ot=n(e=>e(Et).allCellsIdle),kt=n(e=>Tt({mode:e(ke),showAppCode:e(j),hasCells:e(b),hasCachedOutputs:e(Dt),allCellsIdle:e(Ot)})),At=n(e=>e(kt).canPaint),jt=e=>{let t=(0,Z.c)(2),{children:n}=e;if(!Ae())return n;let r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(Mt,{children:n}),t[0]=n,t[1]=r),r},Mt=e=>{let t=(0,Z.c)(8),{children:n}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let{error:a}=ot(Pt,i),o=r(At),s=(0,X.useRef)(!1),c,l;if(t[1]!==o||t[2]!==a?(c=()=>{a&&o&&!s.current&&(s.current=!0,E.error(`Pyodide failed to initialize`,a),it({title:`Failed to start the notebook runtime`,description:lt(a),variant:`danger`}))},l=[a,o],t[1]=o,t[2]=a,t[3]=c,t[4]=l):(c=t[3],l=t[4]),(0,X.useEffect)(c,l),a&&!o)throw a;let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(Nt,{}),t[5]=u):u=t[5];let d;return t[6]===n?d=t[7]:(d=(0,Q.jsx)(St,{requires:At,fallback:u,children:n}),t[6]=n,t[7]=d),d},Nt=()=>{let e=(0,Z.c)(2),t=r(N),n=t.kind===`loading`?t.message:`Loading…`,i;return e[0]===n?i=e[1]:(i=(0,Q.jsx)(Ct,{title:n}),e[0]=n,e[1]=i),i};async function Pt(){return await Ce.INSTANCE.initialized.promise,!0}var Ft={idle:`./favicon.ico`,success:`data:image/x-icon;base64,AAABAAEAMDAAAAEACACoDgAAFgAAACgAAAAwAAAAYAAAAAEACAAAAAAAAAkAAAAAAAAAAAAAAAEAAAABAAAAAAAAXXQAAFd3AwBWeAQAVngEAFd4AwBXeAQAVnkEAFh3AwBXdwQAVXcGAFd4BQBXeAQAWHgEAFd6AwBXeAMAVnkEAFZ5AwBXdwQAV3cFAFd4BABYeAQAV3gEAFh4BABXeAQA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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.visibilityState===`visible`)return;let t=async()=>{e===0?new Notification(`Execution completed`,{body:`Your notebook run completed successfully.`,icon:await $(`success`)}):new Notification(`Execution failed`,{body:`Your notebook run encountered ${e} error(s).`,icon:await $(`error`)})};!(`Notification`in window)||Notification.permission===`denied`||(Notification.permission===`granted`?t():Notification.permission==="default"&&Notification.requestPermission().then(e=>{e===`granted`&&t()}))}var Lt=e=>{let{isRunning:t}=e,n=c(),r=document.querySelector(`link[rel~='icon']`);r||(r=document.createElement(`link`),r.rel=`icon`,document.getElementsByTagName(`head`)[0].append(r)),(0,X.useEffect)(()=>{!t&&r.href.includes(`favicon`)||(async()=>{let e;if(e=t?`running`:n.length===0?`success`:`error`,r.href=await $(e),!document.hasFocus())return;let i=setTimeout(async()=>{r.href=await $(`idle`)},3e3);return()=>clearTimeout(i)})()},[t,n,r]);let i=Je(t)??t;return(0,X.useEffect)(()=>{i&&!t&&It(n.length)},[n,i,t]),De(window,`focus`,async e=>{t||(r.href=await $(`idle`))}),null};function Rt(){let{cellIds:e,cellRuntime:t}=i.get(y),n=e.inOrderIds.find(e=>t[e]?.status===`running`);n&&ft(n,`focus`)}var zt=e=>{let t=(0,Z.c)(18),{connection:n,isRunning:i,onReconnect:a}=e,{mode:o}=r(O),s=n.state===k.CLOSED,c=n.state===k.OPEN,l=s&&n.code===A.KERNEL_DISCONNECTED,u;t[0]===s?u=t[1]:(u=s&&(0,Q.jsx)(Ut,{}),t[0]=s,t[1]=u);let d=o===`read`?`fixed`:`absolute`,f;t[2]===d?f=t[3]:(f=F(`z-50 top-4 left-4`,d),t[2]=d,t[3]=f);let p;t[4]!==c||t[5]!==i?(p=c&&i&&(0,Q.jsx)(Ht,{}),t[4]=c,t[5]=i,t[6]=p):p=t[6];let m;t[7]!==l||t[8]!==s||t[9]!==a?(m=s&&(0,Q.jsx)(Vt,{onReconnect:l?a:void 0}),t[7]=l,t[8]=s,t[9]=a,t[10]=m):m=t[10];let h;t[11]!==f||t[12]!==p||t[13]!==m?(h=(0,Q.jsxs)(`div`,{className:f,children:[p,m]}),t[11]=f,t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;return t[15]!==u||t[16]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[u,h]}),t[15]=u,t[16]=h,t[17]=g):g=t[17],g},Bt=`print:hidden pointer-events-auto hover:cursor-pointer`,Vt=e=>{let t=(0,Z.c)(12),{onReconnect:n}=e,r=!n,i=r?`App disconnected`:`App disconnected — click to reconnect`,a=r?0:-1,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=F(Bt,`bg-transparent border-0 p-0`),t[0]=o):o=t[0];let s=r?`App disconnected`:`Reconnect to app`,c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(vt,{className:`w-[25px] h-[25px] text-(--red-11)`}),t[1]=c):c=t[1];let l;t[2]!==r||t[3]!==n||t[4]!==s?(l=(0,Q.jsx)(`button`,{type:`button`,className:o,"aria-label":s,"data-testid":`disconnected-indicator`,onClick:n,disabled:r,children:c}),t[2]=r,t[3]=n,t[4]=s,t[5]=l):l=t[5];let u;t[6]!==a||t[7]!==l?(u=(0,Q.jsx)(`span`,{tabIndex:a,children:l}),t[6]=a,t[7]=l,t[8]=u):u=t[8];let d;return t[9]!==i||t[10]!==u?(d=(0,Q.jsx)(Y,{content:i,children:u}),t[9]=i,t[10]=u,t[11]=d):d=t[11],d},Ht=()=>{let e=(0,Z.c)(6),t=r(v),n=t?`Scratchpad is running`:`Jump to running cell`,i=t?void 0:Rt,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(gt,{className:`running-app-icon`,size:30,strokeWidth:1}),e[0]=a):a=e[0];let o;e[1]===i?o=e[2]:(o=(0,Q.jsx)(`div`,{className:Bt,"data-testid":`loading-indicator`,onClick:i,children:a}),e[1]=i,e[2]=o);let s;return e[3]!==o||e[4]!==n?(s=(0,Q.jsx)(Y,{content:n,side:`right`,children:o}),e[3]=o,e[4]=n,e[5]=s):s=e[5],s},Ut=()=>{let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`noise`}),(0,Q.jsx)(`div`,{className:`disconnected-gradient`})]}),e[0]=t):t=e[0],t},Wt=z,Gt=W,Kt=L(Ve),qt=X.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=F(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,Q.jsx)(He,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});qt.displayName=He.displayName;var Jt=P(`fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,{variants:{side:{top:`inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,bottom:`inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,left:`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,right:`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`}},defaultVariants:{side:`right`}}),Yt=X.forwardRef((e,t)=>{let n=(0,Z.c)(15),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({side:o,className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s=o===void 0?`right`:o,c;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(qt,{}),n[5]=c):c=n[5];let l;n[6]!==i||n[7]!==s?(l=F(Jt({side:s}),i),n[6]=i,n[7]=s,n[8]=l):l=n[8];let u;n[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsxs)(B,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,Q.jsx)(ut,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),n[9]=u):u=n[9];let d;return n[10]!==r||n[11]!==a||n[12]!==t||n[13]!==l?(d=(0,Q.jsx)(Kt,{children:(0,Q.jsxs)(R,{children:[c,(0,Q.jsxs)(H,{ref:t,className:l,...a,children:[r,u]})]})}),n[10]=r,n[11]=a,n[12]=t,n[13]=l,n[14]=d):d=n[14],d});Yt.displayName=H.displayName;var Xt=X.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=F(`text-lg font-semibold text-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,Q.jsx)(U,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Xt.displayName=U.displayName;var Zt=X.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=F(`text-sm text-muted-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,Q.jsx)(V,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Zt.displayName=V.displayName;var Qt=(0,X.memo)(()=>{let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(K,{name:G.SIDEBAR}),e[0]=t):t=e[0],t});Qt.displayName=`SidebarSlot`;var $t=e=>{let t=(0,Z.c)(6),{openWidth:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(Gt,{className:`lg:hidden`,asChild:!0,children:(0,Q.jsx)(Ue,{variant:`ghost`,className:`bg-background`,children:(0,Q.jsx)(_t,{className:`w-5 h-5`})})}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i={maxWidth:n},t[1]=n,t[2]=i);let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(Qt,{}),t[3]=a):a=t[3];let o;return t[4]===i?o=t[5]:(o=(0,Q.jsxs)(Wt,{children:[r,(0,Q.jsx)(Yt,{className:`w-full px-3 h-full flex flex-col overflow-y-auto`,style:i,side:`left`,children:a})]}),t[4]=i,t[5]=o),o},en=e=>{let t=(0,Z.c)(7),{isOpen:n,toggle:r}=e,i=n?`rotate-0`:`rotate-180`,a;t[0]===i?a=t[1]:(a=F(`h-5 w-5 transition-transform ease-in-out duration-700`,i),t[0]=i,t[1]=a);let o;t[2]===a?o=t[3]:(o=(0,Q.jsx)(J,{className:a}),t[2]=a,t[3]=o);let s;return t[4]!==o||t[5]!==r?(s=(0,Q.jsx)(`div`,{className:`invisible lg:visible absolute top-[12px] right-[16px] z-20`,children:(0,Q.jsx)(Ue,{onClick:r,className:`w-10 h-8`,variant:`ghost`,size:`icon`,children:o})}),t[4]=o,t[5]=r,t[6]=s):s=t[6],s},tn=e=>{let t=(0,Z.c)(11),{isOpen:n,toggle:r,width:i}=e,a=n?i:Te,o;t[0]===a?o=t[1]:(o={width:a},t[0]=a,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=F(`app-sidebar auto-collapse-nav`,`top-0 left-0 z-20 h-full hidden lg:block relative transition-[width] ease-in-out duration-300`),t[2]=s):s=t[2];let c;t[3]!==n||t[4]!==r?(c=(0,Q.jsx)(en,{isOpen:n,toggle:r}),t[3]=n,t[4]=r,t[5]=c):c=t[5];let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(`div`,{className:`relative h-full flex flex-col px-3 pb-16 pt-14 overflow-y-auto shadow-sm border-l`,children:(0,Q.jsx)(Qt,{})}),t[6]=l):l=t[6];let u;return t[7]!==n||t[8]!==o||t[9]!==c?(u=(0,Q.jsxs)(`aside`,{"data-expanded":n,style:o,className:s,children:[c,l]}),t[7]=n,t[8]=o,t[9]=c,t[10]=u):u=t[10],u},nn=e=>{let n=(0,Z.c)(15),{children:r}=e,[i,a]=t(T),{isOpen:o,width:s}=i;if(q(G.SIDEBAR).length===0)return r;let c;n[0]===s?c=n[1]:(c=C(s),n[0]=s,n[1]=c);let l=c,u;n[2]!==a||n[3]!==o?(u=()=>a({type:`toggle`,isOpen:!o}),n[2]=a,n[3]=o,n[4]=u):u=n[4];let d;n[5]!==o||n[6]!==l||n[7]!==u?(d=(0,Q.jsx)(tn,{isOpen:o,width:l,toggle:u}),n[5]=o,n[6]=l,n[7]=u,n[8]=d):d=n[8];let f;n[9]===l?f=n[10]:(f=(0,Q.jsx)(`div`,{className:`absolute top-3 left-4 flex items-center z-50`,children:(0,Q.jsx)($t,{openWidth:l})}),n[9]=l,n[10]=f);let p;return n[11]!==r||n[12]!==d||n[13]!==f?(p=(0,Q.jsxs)(`div`,{className:`inset-0 absolute flex`,children:[d,f,r]}),n[11]=r,n[12]=d,n[13]=f,n[14]=p):p=n[14],p},rn=e=>{let t=(0,Z.c)(18),{width:n,connection:r,isRunning:i,children:a,onReconnect:o}=e,s=r.state,c;t[0]===i?c=t[1]:(c=(0,Q.jsx)(Lt,{isRunning:i}),t[0]=i,t[1]=c);let l;t[2]!==r||t[3]!==i||t[4]!==o?(l=(0,Q.jsx)(zt,{connection:r,isRunning:i,onReconnect:o}),t[2]=r,t[3]=i,t[4]=o,t[5]=l):l=t[5];let u;t[6]!==s||t[7]!==n?(u=F(`mathjax_ignore`,Me(s)&&`disconnected`,`bg-background w-full h-full text-textColor`,`flex flex-col overflow-y-auto`,n===`full`&&`config-width-full`,n===`columns`?`overflow-x-auto`:`overflow-x-auto sm:overflow-x-hidden`,`print:height-fit`),t[6]=s,t[7]=n,t[8]=u):u=t[8];let d;t[9]!==a||t[10]!==s||t[11]!==u||t[12]!==n?(d=(0,Q.jsx)(jt,{children:(0,Q.jsx)(nn,{children:(0,Q.jsx)(`div`,{id:`App`,"data-config-width":n,"data-connection-state":s,className:u,children:a})})}),t[9]=a,t[10]=s,t[11]=u,t[12]=n,t[13]=d):d=t[13];let f;return t[14]!==c||t[15]!==l||t[16]!==d?(f=(0,Q.jsxs)(Q.Fragment,{children:[c,l,d]}),t[14]=c,t[15]=l,t[16]=d,t[17]=f):f=t[17],f};function an(e){return e.kind===`missing`}function on(e){return e.kind===`installing`}var{valueAtom:sn,useActions:cn}=We(()=>({packageAlert:null,startupLogsAlert:null,packageLogs:{}}),{addPackageAlert:(e,t)=>{let n={...e.packageLogs};if(on(t)&&t.logs&&t.log_status)for(let[e,r]of Object.entries(t.logs))switch(t.log_status){case`start`:n[e]=r;break;case`append`:n[e]=(n[e]||``)+r;break;case`done`:n[e]=(n[e]||``)+r}let r=e.packageAlert?.id||rt();return{...e,packageAlert:{id:r,...t},packageLogs:n}},clearPackageAlert:(e,t)=>e.packageAlert!==null&&e.packageAlert.id===t?{...e,packageAlert:null,packageLogs:{}}:e,addStartupLog:(e,t)=>{let n=e.startupLogsAlert?.content||``;return{...e,startupLogsAlert:{...e.startupLogsAlert,content:n+t.content,status:t.status}}},clearStartupLogsAlert:e=>({...e,startupLogsAlert:null})}),ln=()=>r(sn);function un(){return cn()}var dn=(0,X.memo)(e=>{let t=(0,Z.c)(9),{appConfig:n,mode:i,children:a}=e,{selectedLayout:o}=M();if(!r(je)&&(i===`edit`||i===`present`&&o===`vertical`))return a;let s=i===`read`,c;t[0]!==o||t[1]!==s?(c=Re({selectedLayout:o,isReading:s,searchParams:new URLSearchParams(window.location.search)}),t[0]=o,t[1]=s,t[2]=c):c=t[2];let l=c,u;t[3]===l?u=t[4]:(u=Ye.find(e=>e.type===l),t[3]=l,t[4]=u);let d=u;if(!d)return a;let f;return t[5]!==n||t[6]!==i||t[7]!==d?(f=(0,Q.jsx)(fn,{appConfig:n,mode:i,plugin:d}),t[5]=n,t[6]=i,t[7]=d,t[8]=f):f=t[8],f});dn.displayName=`CellsRenderer`;var fn=e=>{let t=(0,Z.c)(12),{appConfig:n,mode:r,plugin:i}=e,a=M(),o=f(),{setCurrentLayoutData:s}=Ie(),c,l;t[0]!==a||t[1]!==o||t[2]!==i?(c=de(o),l=Ze({state:a,plugin:i,cells:c}),t[0]=a,t[1]=o,t[2]=i,t[3]=c,t[4]=l):(c=t[3],l=t[4]);let u=l,d=i.Component,p;return t[5]!==d||t[6]!==n||t[7]!==c||t[8]!==u||t[9]!==r||t[10]!==s?(p=(0,Q.jsx)(d,{appConfig:n,mode:r,cells:c,layout:u,setLayout:s}),t[5]=d,t[6]=n,t[7]=c,t[8]=u,t[9]=r,t[10]=s,t[11]=p):p=t[11],p},pn=class e{hasStarted=!1;static get INSTANCE(){let t=`_marimo_private_RuntimeState`;return window[t]||(window[t]=new e(w)),window[t]}_sendComponentValues;uiElementRegistry;constructor(e){this.uiElementRegistry=e}get sendComponentValues(){if(!this._sendComponentValues)throw Error(`sendComponentValues is not set`);return this._sendComponentValues}start(e){if(this.hasStarted){E.warn(`RuntimeState already started`);return}this._sendComponentValues=e,document.addEventListener(dt.TYPE,this.handleReadyEvent),this.hasStarted=!0}stop(){if(!this.hasStarted){E.warn(`RuntimeState already stopped`);return}document.removeEventListener(dt.TYPE,this.handleReadyEvent),this.hasStarted=!1}handleReadyEvent=e=>{let t=e.detail.objectId;if(!this.uiElementRegistry.has(t))return;let n=this.uiElementRegistry.lookupValue(t);n!==void 0&&this.sendComponentValues({objectIds:[t],values:[n]}).catch(e=>{E.warn(e)})}},mn=`MARIMO_TRANSPORT_EXHAUSTED`,hn=class{inner;closeWrappers=new WeakMap;constructor(e){this.inner=new mt(e,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4})}get readyState(){return this.inner.readyState}reconnect(e,t){this.inner.reconnect(e,t)}close(){this.inner.close()}send(e){this.inner.send(e)}addEventListener(e,t){if(e===`close`){let e=t;if(this.closeWrappers.has(e))return;let n=t=>{this.inner.retryCount>=10?e(new CloseEvent(`close`,{code:t.code,reason:mn,wasClean:t.wasClean})):e(t)};this.closeWrappers.set(e,n),this.inner.addEventListener(`close`,n);return}this.inner.addEventListener(e,t)}removeEventListener(e,t){if(e===`close`){let e=t,n=this.closeWrappers.get(e);n&&(this.closeWrappers.delete(e),this.inner.removeEventListener(`close`,n));return}this.inner.removeEventListener(e,t)}},gn=1e4,_n=1e3,vn=1e4,yn=1.3,bn=1006,xn=class{subscriptions=new x;urlProvider;headersProvider;abortController=null;retryTimer=null;retryCount=0;userClosed=!1;state=WebSocket.CLOSED;constructor(e,t=()=>({})){this.urlProvider=e,this.headersProvider=t}get readyState(){return this.state}reconnect(e,t){this.userClosed=!1,this.retryCount=0,this.clearRetryTimer(),this.abortController?.abort(),this.connect()}close(){this.userClosed=!0,this.clearRetryTimer(),this.state=WebSocket.CLOSED,this.abortController?.abort(),this.abortController=null}send(e){E.warn(`SseTransport does not support send(); dropping message`)}addEventListener(e,t){this.subscriptions.addSubscription(e,t)}removeEventListener(e,t){this.subscriptions.removeSubscription(e,t)}connect(){this.state=WebSocket.CONNECTING,this.run()}async run(){let e=new AbortController;this.abortController=e;let t=setTimeout(()=>e.abort(),gn),n=null;try{let r=await fetch(this.urlProvider(),{headers:{...this.headersProvider(),Accept:`text/event-stream`},signal:e.signal});if(clearTimeout(t),!r.ok||r.body===null)throw Error(`Unexpected SSE response: ${r.status}`);this.state=WebSocket.OPEN,this.subscriptions.notify(`open`,new Event(`open`)),n=await this.readEvents(r.body)}catch(n){if(clearTimeout(t),this.isSuperseded(e))return;E.warn(`SSE connection failed`,n),this.subscriptions.notify(`error`,new Event(`error`))}if(this.isSuperseded(e))return;e.abort(),this.state=WebSocket.CLOSED,this.retryCount+=1;let r=this.retryCount>=10;this.subscriptions.notify(`close`,new CloseEvent(`close`,{code:n?.code??bn,reason:r?mn:n?.reason??``,wasClean:n!==null})),!(r||this.isSuperseded(e))&&this.scheduleRetry()}isSuperseded(e){return this.userClosed||this.abortController!==e}scheduleRetry(){this.clearRetryTimer(),this.state=WebSocket.CONNECTING;let e=Math.min(_n*yn**this.retryCount,vn);this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.connect()},e)}clearRetryTimer(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null)}async readEvents(e){let t=e.getReader(),n=new TextDecoder,r=``,i=null,a=[],o=()=>{if(a.length===0)return i=null,null;let e=a.join(`
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,r as i,u as a}from"./useEvent-xfs0Sn4r.js";import{t as o}from"./react-CBDbhulC.js";import{$n as s,A as c,B as l,D as u,Fo as d,I as f,Jr as p,Mt as m,Nt as h,Ot as g,Pt as ee,Qn as te,R as _,Rr as ne,T as v,Vo as re,Xn as ie,Zn as ae,at as oe,b as y,br as se,er as ce,g as b,ga as le,h as ue,l as de,oi as fe,xa as pe,yr as me}from"./cells-Cp-G34Rz.js";import{t as he}from"./compiler-runtime-CYIjoINj.js";import{O as ge,T as _e,f as ve}from"./utils-D5Ywm7-q.js";import{_ as x,b as ye,c as be,g as xe,i as Se,m as S,n as C,o as w,p as Ce,r as T,s as we,t as Te,v as Ee}from"./state-Di9TbuV9.js";import{g as E,t as De}from"./useEventListener-92uWqz-P.js";import{t as Oe}from"./objects-snlMn4yk.js";import{r as D}from"./constants-BDbGiS7O.js";import{D as ke,M as O,N as Ae,O as je,T as k,d as Me,l as Ne,o as Pe,v as Fe,w as A}from"./config-BlNM0caL.js";import{o as j}from"./switch-DjXr9Y9D.js";import{h as M,l as N,m as Ie,o as Le,p as Re,s as ze}from"./readonly-python-code-DpIyjHqY.js";import{n as Be}from"./ErrorBoundary-CDVGFYfr.js";import{n as P,t as F}from"./cn-ldLVeaqm.js";import{t as I}from"./jsx-runtime-B74pBk57.js";import{i as L,s as R}from"./fullscreen-BH2jz-F4.js";import{_ as z,f as B,g as Ve,h as He,m as V,p as H,v as U,y as W}from"./alert-dialog-CA-2mBs3.js";import{Ct as G,Ot as K,kt as q}from"./JsonOutput-CzIGPEZQ.js";import{h as J}from"./download-DMxOzI7b.js";import{t as Y}from"./tooltip-BUtPzKB4.js";import{t as Ue}from"./button-Dh8EwhsF.js";import{t as We}from"./createReducer-B_XmHROl.js";import{i as Ge}from"./strings-CReV1AYG.js";import{t as Ke}from"./requests-C6_IaFh7.js";import{t as qe}from"./createLucideIcon-B7HeEoG2.js";import{I as Je,a as Ye,c as Xe,i as Ze,n as Qe}from"./layout-DWnrxIo2.js";import{d as $e,n as et}from"./markdown-renderer-BZKlbm2Q.js";import{v as tt}from"./write-secret-modal-D6zoZgLY.js";import{n as nt}from"./spinner-Ck-Hgfvj.js";import{t as rt}from"./uuid-k9DpjH68.js";import{t as it}from"./use-toast-DpWHUGuF.js";import{i as at}from"./session-Sz5nSFku.js";import{n as ot}from"./useAsyncData-Buhk-UgR.js";import{t as st}from"./RenderHTML-DwhMAd9l.js";import{r as ct}from"./share-CPtBiNgr.js";import{a as lt}from"./errors-DzO-nXy-.js";import{s as ut}from"./react-icons.esm-hr79-MCS.js";import{r as dt}from"./events-CbeVJ6OD.js";import{i as ft}from"./cell-link-6burT2XF.js";import{t as pt}from"./requests-S_7PqcSt.js";import{t as mt}from"./ws-DLVysDhS.js";import{n as ht}from"./runs-euHSzlw_.js";var gt=qe(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),_t=qe(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),vt=qe(`unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),X=e(o(),1),Z=he(),Q=I(),yt=e=>{let t=(0,Z.c)(2),{reason:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`font-mono text-center text-base text-(--red-11)`,children:(0,Q.jsx)(`p`,{children:n})}),t[0]=n,t[1]=r),r},bt=e=>{let t=(0,Z.c)(7),{connection:n,className:r,children:i}=e,a;t[0]!==n.reason||t[1]!==n.state?(a=n.state===k.CLOSED&&(0,Q.jsx)(yt,{reason:n.reason}),t[0]=n.reason,t[1]=n.state,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==r||t[5]!==a?(o=(0,Q.jsxs)(`div`,{className:r,children:[i,a]}),t[3]=i,t[4]=r,t[5]=a,t[6]=o):o=t[6],o};function xt(e){let t=(0,Z.c)(3),[n,r]=(0,X.useState)(e<=0),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(e<=0){r(!0);return}r(!1);let t=setTimeout(()=>r(!0),e);return()=>clearTimeout(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,X.useLayoutEffect)(i,a),n}var St=e=>{let{requires:t,fallback:n,delay:i,children:a}=e,o=n===void 0?null:n,s=i===void 0?0:i,c=r(t),l=xt(c?0:s);return c?a:l?o:null},Ct=e=>{let t=(0,Z.c)(10),{title:n}=e,[r,i]=(0,X.useState)(n),[a,o]=(0,X.useState)(!0),s,c;t[0]!==r||t[1]!==n?(s=()=>{if(n!==r){o(!1);let e=setTimeout(()=>{i(n),o(!0)},300);return()=>clearTimeout(e)}},c=[n,r],t[0]=r,t[1]=n,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,X.useEffect)(s,c);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(nt,{className:`size-20 animate-spin text-primary`,"data-testid":`large-spinner`,strokeWidth:1}),t[4]=l):l=t[4];let u=a?`opacity-100`:`opacity-0`,d;t[5]===u?d=t[6]:(d=F(`mt-2 text-muted-foreground font-semibold text-lg transition-opacity duration-300`,u),t[5]=u,t[6]=d);let f;return t[7]!==r||t[8]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex flex-col h-full flex-1 items-center justify-center p-4`,children:[l,(0,Q.jsx)(`div`,{className:d,children:r})]}),t[7]=r,t[8]=d,t[9]=f):f=t[9],f};function wt(e,t){return e===`edit`||e===`home`||e===`gallery`?!0:e===`present`||at(D.includeCode,`false`)||at(D.showCode,`false`)?!1:at(D.showCode,`true`)?!0:t}function Tt(e){let t=wt(e.mode,e.showAppCode),n=e.hasCells&&e.hasCachedOutputs;return{showCode:t,showCachedOutputs:n,canPaint:e.hasCells&&(t||n||e.allCellsIdle)}}var Et=n(e=>{let t=!1,n=!0;for(let r of Object.values(e(y).cellRuntime))et(r.output)||(t=!0),r.status!==`idle`&&(n=!1);return{hasCachedOutputs:t,allCellsIdle:n}}),Dt=n(e=>e(Et).hasCachedOutputs),Ot=n(e=>e(Et).allCellsIdle),kt=n(e=>Tt({mode:e(ke),showAppCode:e(j),hasCells:e(b),hasCachedOutputs:e(Dt),allCellsIdle:e(Ot)})),At=n(e=>e(kt).canPaint),jt=e=>{let t=(0,Z.c)(2),{children:n}=e;if(!Ae())return n;let r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(Mt,{children:n}),t[0]=n,t[1]=r),r},Mt=e=>{let t=(0,Z.c)(8),{children:n}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let{error:a}=ot(Pt,i),o=r(At),s=(0,X.useRef)(!1),c,l;if(t[1]!==o||t[2]!==a?(c=()=>{a&&o&&!s.current&&(s.current=!0,E.error(`Pyodide failed to initialize`,a),it({title:`Failed to start the notebook runtime`,description:lt(a),variant:`danger`}))},l=[a,o],t[1]=o,t[2]=a,t[3]=c,t[4]=l):(c=t[3],l=t[4]),(0,X.useEffect)(c,l),a&&!o)throw a;let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(Nt,{}),t[5]=u):u=t[5];let d;return t[6]===n?d=t[7]:(d=(0,Q.jsx)(St,{requires:At,fallback:u,children:n}),t[6]=n,t[7]=d),d},Nt=()=>{let e=(0,Z.c)(2),t=r(N),n=t.kind===`loading`?t.message:`Loading…`,i;return e[0]===n?i=e[1]:(i=(0,Q.jsx)(Ct,{title:n}),e[0]=n,e[1]=i),i};async function Pt(){return await Ce.INSTANCE.initialized.promise,!0}var Ft={idle:`./favicon.ico`,success:`data:image/x-icon;base64,AAABAAEAMDAAAAEACACoDgAAFgAAACgAAAAwAAAAYAAAAAEACAAAAAAAAAkAAAAAAAAAAAAAAAEAAAABAAAAAAAAXXQAAFd3AwBWeAQAVngEAFd4AwBXeAQAVnkEAFh3AwBXdwQAVXcGAFd4BQBXeAQAWHgEAFd6Aw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wAA/gAAAAB/AAD8AAAAAD8AAPgAAAAAHwAA+AAAAAAfAADwAAAAAA8AAPAAAAAADwAA4AAAAAAHAADgAAAAAAcAAMAAAAAAAwAAwAAAAAADAADAAAAAAAMAAMAAAAAAAwAAwAAAAAADAADAAAAAAAMAAMAAAAAAAwAAwAAAAAADAADAAAAAAAMAAMAAAAAAAwAAwAAAAAADAADAAAAAAAMAAMAAAAAAAwAAwAAAAAADAADgAAAAAAcAAOAAAAAABwAA8AAAAAAPAADwAAAAAA8AAPgAAAAAHwAA+AAAAAAfAAD8AAAAAD8AAP4AAAAAfwAA/wAAAAD/AAD/gAAAAf8AAP/AAAAD/wAA/+AAAAf/AAD/+AAAH/8AAP/+AAB//wAA//+AAf//AAD///////8AAP///////wAA`};async function $(e){return Ft[e]}function It(e){if(document.visibilityState===`visible`)return;let t=async()=>{e===0?new Notification(`Execution completed`,{body:`Your notebook run completed successfully.`,icon:await $(`success`)}):new Notification(`Execution failed`,{body:`Your notebook run encountered ${e} error(s).`,icon:await $(`error`)})};!(`Notification`in window)||Notification.permission===`denied`||(Notification.permission===`granted`?t():Notification.permission==="default"&&Notification.requestPermission().then(e=>{e===`granted`&&t()}))}var Lt=e=>{let{isRunning:t}=e,n=c(),r=document.querySelector(`link[rel~='icon']`);r||(r=document.createElement(`link`),r.rel=`icon`,document.getElementsByTagName(`head`)[0].append(r)),(0,X.useEffect)(()=>{!t&&r.href.includes(`favicon`)||(async()=>{let e;if(e=t?`running`:n.length===0?`success`:`error`,r.href=await $(e),!document.hasFocus())return;let i=setTimeout(async()=>{r.href=await $(`idle`)},3e3);return()=>clearTimeout(i)})()},[t,n,r]);let i=Je(t)??t;return(0,X.useEffect)(()=>{i&&!t&&It(n.length)},[n,i,t]),De(window,`focus`,async e=>{t||(r.href=await $(`idle`))}),null};function Rt(){let{cellIds:e,cellRuntime:t}=i.get(y),n=e.inOrderIds.find(e=>t[e]?.status===`running`);n&&ft(n,`focus`)}var zt=e=>{let t=(0,Z.c)(18),{connection:n,isRunning:i,onReconnect:a}=e,{mode:o}=r(O),s=n.state===k.CLOSED,c=n.state===k.OPEN,l=s&&n.code===A.KERNEL_DISCONNECTED,u;t[0]===s?u=t[1]:(u=s&&(0,Q.jsx)(Ut,{}),t[0]=s,t[1]=u);let d=o===`read`?`fixed`:`absolute`,f;t[2]===d?f=t[3]:(f=F(`z-50 top-4 left-4`,d),t[2]=d,t[3]=f);let p;t[4]!==c||t[5]!==i?(p=c&&i&&(0,Q.jsx)(Ht,{}),t[4]=c,t[5]=i,t[6]=p):p=t[6];let m;t[7]!==l||t[8]!==s||t[9]!==a?(m=s&&(0,Q.jsx)(Vt,{onReconnect:l?a:void 0}),t[7]=l,t[8]=s,t[9]=a,t[10]=m):m=t[10];let h;t[11]!==f||t[12]!==p||t[13]!==m?(h=(0,Q.jsxs)(`div`,{className:f,children:[p,m]}),t[11]=f,t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;return t[15]!==u||t[16]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[u,h]}),t[15]=u,t[16]=h,t[17]=g):g=t[17],g},Bt=`print:hidden pointer-events-auto hover:cursor-pointer`,Vt=e=>{let t=(0,Z.c)(12),{onReconnect:n}=e,r=!n,i=r?`App disconnected`:`App disconnected — click to reconnect`,a=r?0:-1,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=F(Bt,`bg-transparent border-0 p-0`),t[0]=o):o=t[0];let s=r?`App disconnected`:`Reconnect to app`,c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(vt,{className:`w-[25px] h-[25px] text-(--red-11)`}),t[1]=c):c=t[1];let l;t[2]!==r||t[3]!==n||t[4]!==s?(l=(0,Q.jsx)(`button`,{type:`button`,className:o,"aria-label":s,"data-testid":`disconnected-indicator`,onClick:n,disabled:r,children:c}),t[2]=r,t[3]=n,t[4]=s,t[5]=l):l=t[5];let u;t[6]!==a||t[7]!==l?(u=(0,Q.jsx)(`span`,{tabIndex:a,children:l}),t[6]=a,t[7]=l,t[8]=u):u=t[8];let d;return t[9]!==i||t[10]!==u?(d=(0,Q.jsx)(Y,{content:i,children:u}),t[9]=i,t[10]=u,t[11]=d):d=t[11],d},Ht=()=>{let e=(0,Z.c)(6),t=r(v),n=t?`Scratchpad is running`:`Jump to running cell`,i=t?void 0:Rt,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(gt,{className:`running-app-icon`,size:30,strokeWidth:1}),e[0]=a):a=e[0];let o;e[1]===i?o=e[2]:(o=(0,Q.jsx)(`div`,{className:Bt,"data-testid":`loading-indicator`,onClick:i,children:a}),e[1]=i,e[2]=o);let s;return e[3]!==o||e[4]!==n?(s=(0,Q.jsx)(Y,{content:n,side:`right`,children:o}),e[3]=o,e[4]=n,e[5]=s):s=e[5],s},Ut=()=>{let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`noise`}),(0,Q.jsx)(`div`,{className:`disconnected-gradient`})]}),e[0]=t):t=e[0],t},Wt=z,Gt=W,Kt=L(Ve),qt=X.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=F(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,Q.jsx)(He,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});qt.displayName=He.displayName;var Jt=P(`fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,{variants:{side:{top:`inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,bottom:`inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,left:`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,right:`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`}},defaultVariants:{side:`right`}}),Yt=X.forwardRef((e,t)=>{let n=(0,Z.c)(15),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({side:o,className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s=o===void 0?`right`:o,c;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(qt,{}),n[5]=c):c=n[5];let l;n[6]!==i||n[7]!==s?(l=F(Jt({side:s}),i),n[6]=i,n[7]=s,n[8]=l):l=n[8];let u;n[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsxs)(B,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,Q.jsx)(ut,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),n[9]=u):u=n[9];let d;return n[10]!==r||n[11]!==a||n[12]!==t||n[13]!==l?(d=(0,Q.jsx)(Kt,{children:(0,Q.jsxs)(R,{children:[c,(0,Q.jsxs)(H,{ref:t,className:l,...a,children:[r,u]})]})}),n[10]=r,n[11]=a,n[12]=t,n[13]=l,n[14]=d):d=n[14],d});Yt.displayName=H.displayName;var Xt=X.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=F(`text-lg font-semibold text-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,Q.jsx)(U,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Xt.displayName=U.displayName;var Zt=X.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=F(`text-sm text-muted-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,Q.jsx)(V,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Zt.displayName=V.displayName;var Qt=(0,X.memo)(()=>{let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(K,{name:G.SIDEBAR}),e[0]=t):t=e[0],t});Qt.displayName=`SidebarSlot`;var $t=e=>{let t=(0,Z.c)(6),{openWidth:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(Gt,{className:`lg:hidden`,asChild:!0,children:(0,Q.jsx)(Ue,{variant:`ghost`,className:`bg-background`,children:(0,Q.jsx)(_t,{className:`w-5 h-5`})})}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i={maxWidth:n},t[1]=n,t[2]=i);let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(Qt,{}),t[3]=a):a=t[3];let o;return t[4]===i?o=t[5]:(o=(0,Q.jsxs)(Wt,{children:[r,(0,Q.jsx)(Yt,{className:`w-full px-3 h-full flex flex-col overflow-y-auto`,style:i,side:`left`,children:a})]}),t[4]=i,t[5]=o),o},en=e=>{let t=(0,Z.c)(7),{isOpen:n,toggle:r}=e,i=n?`rotate-0`:`rotate-180`,a;t[0]===i?a=t[1]:(a=F(`h-5 w-5 transition-transform ease-in-out duration-700`,i),t[0]=i,t[1]=a);let o;t[2]===a?o=t[3]:(o=(0,Q.jsx)(J,{className:a}),t[2]=a,t[3]=o);let s;return t[4]!==o||t[5]!==r?(s=(0,Q.jsx)(`div`,{className:`invisible lg:visible absolute top-[12px] right-[16px] z-20`,children:(0,Q.jsx)(Ue,{onClick:r,className:`w-10 h-8`,variant:`ghost`,size:`icon`,children:o})}),t[4]=o,t[5]=r,t[6]=s):s=t[6],s},tn=e=>{let t=(0,Z.c)(11),{isOpen:n,toggle:r,width:i}=e,a=n?i:Te,o;t[0]===a?o=t[1]:(o={width:a},t[0]=a,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=F(`app-sidebar auto-collapse-nav`,`top-0 left-0 z-20 h-full hidden lg:block relative transition-[width] ease-in-out duration-300`),t[2]=s):s=t[2];let c;t[3]!==n||t[4]!==r?(c=(0,Q.jsx)(en,{isOpen:n,toggle:r}),t[3]=n,t[4]=r,t[5]=c):c=t[5];let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(`div`,{className:`relative h-full flex flex-col px-3 pb-16 pt-14 overflow-y-auto shadow-sm border-l`,children:(0,Q.jsx)(Qt,{})}),t[6]=l):l=t[6];let u;return t[7]!==n||t[8]!==o||t[9]!==c?(u=(0,Q.jsxs)(`aside`,{"data-expanded":n,style:o,className:s,children:[c,l]}),t[7]=n,t[8]=o,t[9]=c,t[10]=u):u=t[10],u},nn=e=>{let n=(0,Z.c)(15),{children:r}=e,[i,a]=t(T),{isOpen:o,width:s}=i;if(q(G.SIDEBAR).length===0)return r;let c;n[0]===s?c=n[1]:(c=C(s),n[0]=s,n[1]=c);let l=c,u;n[2]!==a||n[3]!==o?(u=()=>a({type:`toggle`,isOpen:!o}),n[2]=a,n[3]=o,n[4]=u):u=n[4];let d;n[5]!==o||n[6]!==l||n[7]!==u?(d=(0,Q.jsx)(tn,{isOpen:o,width:l,toggle:u}),n[5]=o,n[6]=l,n[7]=u,n[8]=d):d=n[8];let f;n[9]===l?f=n[10]:(f=(0,Q.jsx)(`div`,{className:`absolute top-3 left-4 flex items-center z-50`,children:(0,Q.jsx)($t,{openWidth:l})}),n[9]=l,n[10]=f);let p;return n[11]!==r||n[12]!==d||n[13]!==f?(p=(0,Q.jsxs)(`div`,{className:`inset-0 absolute flex`,children:[d,f,r]}),n[11]=r,n[12]=d,n[13]=f,n[14]=p):p=n[14],p},rn=e=>{let t=(0,Z.c)(18),{width:n,connection:r,isRunning:i,children:a,onReconnect:o}=e,s=r.state,c;t[0]===i?c=t[1]:(c=(0,Q.jsx)(Lt,{isRunning:i}),t[0]=i,t[1]=c);let l;t[2]!==r||t[3]!==i||t[4]!==o?(l=(0,Q.jsx)(zt,{connection:r,isRunning:i,onReconnect:o}),t[2]=r,t[3]=i,t[4]=o,t[5]=l):l=t[5];let u;t[6]!==s||t[7]!==n?(u=F(`mathjax_ignore`,Me(s)&&`disconnected`,`bg-background w-full h-full text-textColor`,`flex flex-col overflow-y-auto`,n===`full`&&`config-width-full`,n===`columns`?`overflow-x-auto`:`overflow-x-auto sm:overflow-x-hidden`,`print:height-fit`),t[6]=s,t[7]=n,t[8]=u):u=t[8];let d;t[9]!==a||t[10]!==s||t[11]!==u||t[12]!==n?(d=(0,Q.jsx)(jt,{children:(0,Q.jsx)(nn,{children:(0,Q.jsx)(`div`,{id:`App`,"data-config-width":n,"data-connection-state":s,className:u,children:a})})}),t[9]=a,t[10]=s,t[11]=u,t[12]=n,t[13]=d):d=t[13];let f;return t[14]!==c||t[15]!==l||t[16]!==d?(f=(0,Q.jsxs)(Q.Fragment,{children:[c,l,d]}),t[14]=c,t[15]=l,t[16]=d,t[17]=f):f=t[17],f};function an(e){return e.kind===`missing`}function on(e){return e.kind===`installing`}var{valueAtom:sn,useActions:cn}=We(()=>({packageAlert:null,startupLogsAlert:null,packageLogs:{}}),{addPackageAlert:(e,t)=>{let n={...e.packageLogs};if(on(t)&&t.logs&&t.log_status)for(let[e,r]of Object.entries(t.logs))switch(t.log_status){case`start`:n[e]=r;break;case`append`:n[e]=(n[e]||``)+r;break;case`done`:n[e]=(n[e]||``)+r}let r=e.packageAlert?.id||rt();return{...e,packageAlert:{id:r,...t},packageLogs:n}},clearPackageAlert:(e,t)=>e.packageAlert!==null&&e.packageAlert.id===t?{...e,packageAlert:null,packageLogs:{}}:e,addStartupLog:(e,t)=>{let n=e.startupLogsAlert?.content||``;return{...e,startupLogsAlert:{...e.startupLogsAlert,content:n+t.content,status:t.status}}},clearStartupLogsAlert:e=>({...e,startupLogsAlert:null})}),ln=()=>r(sn);function un(){return cn()}var dn=(0,X.memo)(e=>{let t=(0,Z.c)(9),{appConfig:n,mode:i,children:a}=e,{selectedLayout:o}=M();if(!r(je)&&(i===`edit`||i===`present`&&o===`vertical`))return a;let s=i===`read`,c;t[0]!==o||t[1]!==s?(c=Re({selectedLayout:o,isReading:s,searchParams:new URLSearchParams(window.location.search)}),t[0]=o,t[1]=s,t[2]=c):c=t[2];let l=c,u;t[3]===l?u=t[4]:(u=Ye.find(e=>e.type===l),t[3]=l,t[4]=u);let d=u;if(!d)return a;let f;return t[5]!==n||t[6]!==i||t[7]!==d?(f=(0,Q.jsx)(fn,{appConfig:n,mode:i,plugin:d}),t[5]=n,t[6]=i,t[7]=d,t[8]=f):f=t[8],f});dn.displayName=`CellsRenderer`;var fn=e=>{let t=(0,Z.c)(12),{appConfig:n,mode:r,plugin:i}=e,a=M(),o=f(),{setCurrentLayoutData:s}=Ie(),c,l;t[0]!==a||t[1]!==o||t[2]!==i?(c=de(o),l=Ze({state:a,plugin:i,cells:c}),t[0]=a,t[1]=o,t[2]=i,t[3]=c,t[4]=l):(c=t[3],l=t[4]);let u=l,d=i.Component,p;return t[5]!==d||t[6]!==n||t[7]!==c||t[8]!==u||t[9]!==r||t[10]!==s?(p=(0,Q.jsx)(d,{appConfig:n,mode:r,cells:c,layout:u,setLayout:s}),t[5]=d,t[6]=n,t[7]=c,t[8]=u,t[9]=r,t[10]=s,t[11]=p):p=t[11],p},pn=class e{hasStarted=!1;static get INSTANCE(){let t=`_marimo_private_RuntimeState`;return window[t]||(window[t]=new e(w)),window[t]}_sendComponentValues;uiElementRegistry;constructor(e){this.uiElementRegistry=e}get sendComponentValues(){if(!this._sendComponentValues)throw Error(`sendComponentValues is not set`);return this._sendComponentValues}start(e){if(this.hasStarted){E.warn(`RuntimeState already started`);return}this._sendComponentValues=e,document.addEventListener(dt.TYPE,this.handleReadyEvent),this.hasStarted=!0}stop(){if(!this.hasStarted){E.warn(`RuntimeState already stopped`);return}document.removeEventListener(dt.TYPE,this.handleReadyEvent),this.hasStarted=!1}handleReadyEvent=e=>{let t=e.detail.objectId;if(!this.uiElementRegistry.has(t))return;let n=this.uiElementRegistry.lookupValue(t);n!==void 0&&this.sendComponentValues({objectIds:[t],values:[n]}).catch(e=>{E.warn(e)})}},mn=`MARIMO_TRANSPORT_EXHAUSTED`,hn=class{inner;closeWrappers=new WeakMap;constructor(e){this.inner=new mt(e,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4})}get readyState(){return this.inner.readyState}reconnect(e,t){this.inner.reconnect(e,t)}close(){this.inner.close()}send(e){this.inner.send(e)}addEventListener(e,t){if(e===`close`){let e=t;if(this.closeWrappers.has(e))return;let n=t=>{this.inner.retryCount>=10?e(new CloseEvent(`close`,{code:t.code,reason:mn,wasClean:t.wasClean})):e(t)};this.closeWrappers.set(e,n),this.inner.addEventListener(`close`,n);return}this.inner.addEventListener(e,t)}removeEventListener(e,t){if(e===`close`){let e=t,n=this.closeWrappers.get(e);n&&(this.closeWrappers.delete(e),this.inner.removeEventListener(`close`,n));return}this.inner.removeEventListener(e,t)}},gn=1e4,_n=1e3,vn=1e4,yn=1.3,bn=1006,xn=class{subscriptions=new x;urlProvider;headersProvider;abortController=null;retryTimer=null;retryCount=0;userClosed=!1;state=WebSocket.CLOSED;constructor(e,t=()=>({})){this.urlProvider=e,this.headersProvider=t}get readyState(){return this.state}reconnect(e,t){this.userClosed=!1,this.retryCount=0,this.clearRetryTimer(),this.abortController?.abort(),this.connect()}close(){this.userClosed=!0,this.clearRetryTimer(),this.state=WebSocket.CLOSED,this.abortController?.abort(),this.abortController=null}send(e){E.warn(`SseTransport does not support send(); dropping message`)}addEventListener(e,t){this.subscriptions.addSubscription(e,t)}removeEventListener(e,t){this.subscriptions.removeSubscription(e,t)}connect(){this.state=WebSocket.CONNECTING,this.run()}async run(){let e=new AbortController;this.abortController=e;let t=setTimeout(()=>e.abort(),gn),n=null;try{let r=await fetch(this.urlProvider(),{headers:{...this.headersProvider(),Accept:`text/event-stream`},signal:e.signal});if(clearTimeout(t),!r.ok||r.body===null)throw Error(`Unexpected SSE response: ${r.status}`);this.state=WebSocket.OPEN,this.subscriptions.notify(`open`,new Event(`open`)),n=await this.readEvents(r.body)}catch(n){if(clearTimeout(t),this.isSuperseded(e))return;E.warn(`SSE connection failed`,n),this.subscriptions.notify(`error`,new Event(`error`))}if(this.isSuperseded(e))return;e.abort(),this.state=WebSocket.CLOSED,this.retryCount+=1;let r=this.retryCount>=10;this.subscriptions.notify(`close`,new CloseEvent(`close`,{code:n?.code??bn,reason:r?mn:n?.reason??``,wasClean:n!==null})),!(r||this.isSuperseded(e))&&this.scheduleRetry()}isSuperseded(e){return this.userClosed||this.abortController!==e}scheduleRetry(){this.clearRetryTimer(),this.state=WebSocket.CONNECTING;let e=Math.min(_n*yn**this.retryCount,vn);this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.connect()},e)}clearRetryTimer(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null)}async readEvents(e){let t=e.getReader(),n=new TextDecoder,r=``,i=null,a=[],o=()=>{if(a.length===0)return i=null,null;let e=a.join(`
2
2
  `),t=i;return i=null,a=[],t===`close`?Sn(e):(this.retryCount=0,this.subscriptions.notify(`message`,new MessageEvent(`message`,{data:e})),null)};for(;;){let{done:e,value:s}=await t.read();if(e)return null;r+=n.decode(s,{stream:!0});let c=0,l=r.indexOf(`
3
3
  `,c);for(;l!==-1;){let e=r.slice(c,l);if(c=l+1,l=r.indexOf(`
4
4
  `,c),e.endsWith(`\r`)&&(e=e.slice(0,-1)),e===``){let e=o();if(e!==null)return e;continue}if(e.startsWith(`:`))continue;let t=e.indexOf(`:`),n=t===-1?e:e.slice(0,t),s=t===-1?``:e.slice(t+1);s.startsWith(` `)&&(s=s.slice(1)),n===`data`?a.push(s):n===`event`&&(i=s)}c>0&&(r=r.slice(c))}}};function Sn(e){try{let t=JSON.parse(e);return{code:typeof t.code==`number`?t.code:1e3,reason:typeof t.reason==`string`?t.reason:``}}catch{return E.warn(`Failed to parse SSE close event`,e),{code:1e3,reason:``}}}function Cn(e){return e.static?xe.empty():Ae()?S():e.transportType===`sse`?new xn(e.url,e.headers):new hn(e.url)}function wn(e){let{onOpen:t,onMessage:n,onClose:r,onError:i,waitToConnect:a}=e,[o]=(0,X.useState)(()=>{let a=Cn(e);return a.addEventListener(`open`,t),a.addEventListener(`close`,r),a.addEventListener(`error`,i),a.addEventListener(`message`,n),a});return(0,X.useEffect)(()=>(o.readyState===WebSocket.CLOSED&&a().then(()=>o.reconnect()).catch(e=>{E.error(`Healthy connection never made`,e),o.close()}),()=>{E.warn(`useConnectionTransport is unmounting. This likely means there is a bug.`),o.close(),o.removeEventListener(`open`,t),o.removeEventListener(`close`,r),o.removeEventListener(`error`,i),o.removeEventListener(`message`,n)}),[o]),o}function Tn(e){let{codes:t,names:n,configs:r,cell_ids:i,last_executed_code:a,last_execution_time:o}=e,s=a||{},c=o||{};return t.map((e,t)=>{let a=i[t],o=s[a];return _({id:a,code:e,edited:o?o!==e:!1,name:n[t],lastCodeRun:s[a]??null,lastExecutionTime:c[a]??null,config:r[t]})})}function En(e,t,n){let{layout:r}=e,i=Qe(r,t);return r&&r.type===i.selectedLayout&&n({layoutView:i.selectedLayout,data:i.layoutData[i.selectedLayout]}),i}function Dn(){let e=[],t=[];return w.entries.forEach((n,r)=>{e.push(r),t.push(n.value)}),{objectIds:e,values:t}}function On(e,t){let{existingCells:n,autoInstantiate:r,setCells:i,setLayoutData:a,setAppConfig:o,setCapabilities:s,setKernelState:c,onError:l}=t,{resumed:u,ui_values:d,app_config:f,capabilities:p,auto_instantiated:m}=e,h=n&&n.length>0,g=h&&!u?n:Tn(e);i(g,En(e,g,a));let ee=ge.safeParse(f);if(ee.success?o(ee.data):E.error(`Failed to parse app config`,ee.error),s(p),m)return;if(u){for(let[e,t]of Oe.entries(d||{})){let n=e;w.set(n,t)}return}let{objectIds:te,values:_}=Dn(),ne=h?Object.fromEntries(n.map(e=>[e.id,e.code])):void 0;Ke().sendInstantiate({objectIds:te,values:_,autoRun:r,codes:ne}).then(()=>{c({isInstantiated:!0,error:null})}).catch(e=>{c({isInstantiated:!1,error:e}),l(Error(`Failed to instantiate`,{cause:e}))})}function kn(e){let t=e.cell_id;w.removeElementsByCell(t),Xe.INSTANCE.removeForCellId(t)}function An(e,t){t(e),Xe.INSTANCE.track(e)}var jn={append:e=>{let t=new URL(window.location.href);t.searchParams.append(e.key,e.value),window.history.pushState({},``,`${t.pathname}${t.search}`)},set:e=>{let t=new URL(window.location.href);Array.isArray(e.value)?(t.searchParams.delete(e.key),e.value.forEach(n=>t.searchParams.append(e.key,n))):t.searchParams.set(e.key,e.value),window.history.pushState({},``,`${t.pathname}${t.search}`)},delete:e=>{let t=new URL(window.location.href);e.value==null?t.searchParams.delete(e.key):t.searchParams.delete(e.key,e.value),window.history.pushState({},``,`${t.pathname}${t.search}`)},clear:()=>{let e=new URL(window.location.href);e.search=``,window.history.pushState({},``,`${e.pathname}${e.search}`)}};function Mn(e){switch(e.reason){case mn:return{kind:`gave-up`,status:{state:k.CLOSED,code:A.KERNEL_DISCONNECTED,reason:`kernel not found`}};case`MARIMO_NO_FILE_KEY`:case`MARIMO_NO_SESSION_ID`:case`MARIMO_NO_SESSION`:case`MARIMO_SHUTDOWN`:return{kind:`terminal`,status:{state:k.CLOSED,code:A.KERNEL_DISCONNECTED,reason:`kernel not found`},closeTransport:!0};case`MARIMO_UNAUTHORIZED`:return{kind:`terminal`,status:{state:k.CLOSED,code:A.KERNEL_DISCONNECTED,reason:`not authorized`},closeTransport:!0};case`MARIMO_KIOSK_NOT_ALLOWED`:return{kind:`terminal`,status:{state:k.CLOSED,code:A.KERNEL_DISCONNECTED,reason:`kiosk mode is not available for this session`},closeTransport:!0};case`MARIMO_KERNEL_STARTUP_ERROR`:return{kind:`terminal`,status:{state:k.CLOSED,code:A.KERNEL_STARTUP_ERROR,reason:`Failed to start kernel sandbox`},closeTransport:!0};default:e.reason&&Ge(e.reason)}return{kind:`retry`,status:{state:k.CONNECTING}}}function Nn(){return Object.values(ue().cellData).filter(e=>e.id!==d)}function Pn(e){let n=(0,Z.c)(46),i=(0,X.useRef)(!0),{autoInstantiate:o,sessionId:c,setCells:d}=e,{showBoundary:f}=Be(),{handleCellMessage:_}=u(),v;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(v={skipMiddleware:!0},n[0]=v):v=n[0];let y=u(v),b;n[1]===y?b=n[2]:(b=e=>{oe(e.changes,y,zn)},n[1]=y,n[2]=b);let de=b,{addCellNotification:he}=ht(),ge=a(ze),x=a(Le),xe=_e(),{setVariables:S,setMetadata:C}=fe(),{addColumnPreview:Ce}=pe(),{addDatasets:T,filterDatasetsFromVariables:Te}=pe(),{addDataSourceConnection:De,filterDataSourcesFromVariables:Oe}=le(),{setLayoutData:D}=Ie(),[ke,O]=t(Fe),{addBanner:Me}=ye(),{addPackageAlert:j,addStartupLog:M}=un(),N=a(je),Re=a(p),P=Pe(),F=r(ve),I=a(pt),L=a(Ee),{setNamespaces:R,filterFromVariables:z}=g(),B;n[3]!==Me||n[4]!==he||n[5]!==Ce||n[6]!==De||n[7]!==T||n[8]!==j||n[9]!==M||n[10]!==o||n[11]!==Oe||n[12]!==Te||n[13]!==z||n[14]!==_||n[15]!==de||n[16]!==xe||n[17]!==I||n[18]!==Re||n[19]!==d||n[20]!==x||n[21]!==L||n[22]!==ge||n[23]!==N||n[24]!==D||n[25]!==C||n[26]!==R||n[27]!==S||n[28]!==f?(B=e=>{let t=re(e.data);switch(t.data.op){case`reload`:ct();return;case`kernel-ready`:{x(!!(t.data.resumed||t.data.auto_instantiated));let e=Nn();On(t.data,{autoInstantiate:o,setCells:d,setLayoutData:D,setAppConfig:xe,setCapabilities:Re,setKernelState:ge,onError:f,existingCells:e}),t.data.resumed||ee(),N(t.data.kiosk),se(null),me();return}case`completed-run`:x(!0);return;case`interrupted`:return;case`kernel-startup-error`:L(t.data.error);return;case`send-ui-element-message`:{let e=t.data.ui_element;if(e){let n=$e(t.data);w.broadcastMessage(e,t.data.message,n)}return}case`model-lifecycle`:be(we,t.data);return;case`remove-ui-elements`:kn(t.data);return;case`completion-result`:ne.resolve(t.data.completion_id,t.data);return;case`function-call-result`:Se.resolve(t.data.function_call_id,t.data);return;case`cell-op`:{An(t.data,_);let e=ue().cellData[t.data.cell_id];if(!e)return;he({cellNotification:t.data,code:e.code});return}case`variables`:{let e=t.data.variables.map(Rn);S(t.data.variables.map(Ln)),Te(e),Oe(e),z(e);return}case`variable-values`:C(t.data.variables.map(In));return;case`alert`:it({title:t.data.title,description:st({html:t.data.description}),variant:t.data.variant});return;case`banner`:Me(t.data);return;case`missing-package-alert`:j({...t.data,kind:`missing`});return;case`installing-package-alert`:j({...t.data,kind:`installing`});return;case`startup-logs`:M({content:t.data.content,status:t.data.status});return;case`query-params-append`:jn.append(t.data);return;case`query-params-set`:jn.set(t.data);return;case`query-params-delete`:jn.delete(t.data);return;case`query-params-clear`:jn.clear();return;case`datasets`:T(t.data);return;case`data-column-preview`:Ce(t.data);return;case`sql-table-preview`:te.resolve(t.data.request_id,t.data);return;case`sql-table-list-preview`:s.resolve(t.data.request_id,t.data);return;case`sql-schema-list-preview`:ae.resolve(t.data.request_id,t.data);return;case`validate-sql-result`:ce.resolve(t.data.request_id,t.data);return;case`data-source-discovery-result`:ie.resolve(t.data.request_id,t.data);return;case`secret-keys-result`:tt.resolve(t.data.request_id,t.data);return;case`cache-info`:I(t.data);return;case`cache-cleared`:return;case`data-source-connections`:De({connections:t.data.connections.map(Fn)});return;case`storage-namespaces`:R(t.data);return;case`storage-entries`:h.resolve(t.data.request_id,t.data);return;case`storage-download-ready`:m.resolve(t.data.request_id,t.data);return;case`reconnected`:return;case`focus-cell`:l(t.data.cell_id);return;case`active-line`:se(t.data.line==null?null:{cellId:t.data.cell_id,line:t.data.line});return;case`notebook-document-transaction`:de(t.data.transaction);return;case`consumer-capabilities`:N(!t.data.consumer_capabilities.edit);return;default:Ge(t.data)}},n[3]=Me,n[4]=he,n[5]=Ce,n[6]=De,n[7]=T,n[8]=j,n[9]=M,n[10]=o,n[11]=Oe,n[12]=Te,n[13]=z,n[14]=_,n[15]=de,n[16]=xe,n[17]=I,n[18]=Re,n[19]=d,n[20]=x,n[21]=L,n[22]=ge,n[23]=N,n[24]=D,n[25]=C,n[26]=R,n[27]=S,n[28]=f,n[29]=B):B=n[29];let Ve=B,He=(e,t)=>{i.current&&(i.current=!1,J.reconnect(e,t))},V=async()=>{if(J.readyState!==WebSocket.OPEN&&J.readyState!==WebSocket.CONNECTING){if(i.current=!0,O({state:k.CONNECTING}),!await P.reconcileFromHealth()){i.current=!1,O({state:k.CLOSED,code:A.KERNEL_DISCONNECTED,reason:`kernel not found`});return}J.reconnect()}},H;n[30]===Symbol.for(`react.memo_cache_sentinel`)?(H=Ne(),n[30]=H):H=n[30];let U;n[31]!==P||n[32]!==c||n[33]!==F?(U=()=>F===`sse`?P.getSseURL(c).toString():P.getWsURL(c).toString(),n[31]=P,n[32]=c,n[33]=F,n[34]=U):U=n[34];let W;n[35]===P?W=n[36]:(W=()=>P.headers(),n[35]=P,n[36]=W);let G;n[37]===O?G=n[38]:(G=async()=>{i.current=!0,O({state:k.OPEN})},n[37]=O,n[38]=G);let K;n[39]===P?K=n[40]:(K=async()=>{Ne()||Ae()||P.isSameOrigin||await P.waitForHealthy()},n[39]=P,n[40]=K);let q;n[41]===Ve?q=n[42]:(q=e=>{try{Ve(e)}catch(t){let n=t;E.error(`Failed to handle message`,e.data,n),it({title:`Failed to handle message`,description:lt(n),variant:`danger`})}},n[41]=Ve,n[42]=q);let J=wn({static:H,transportType:F,url:U,headers:W,onOpen:G,waitToConnect:K,onMessage:q,onClose:e=>{E.warn(`WebSocket closed`,e.code,e.reason);let t=Mn(e);if(O(t.status),t.kind===`terminal`&&t.closeTransport){J.close();return}t.kind===`retry`&&He(e.code,e.reason)},onError:e=>{E.warn(`WebSocket error`,e),O({state:k.CLOSED,code:A.KERNEL_DISCONNECTED,reason:`kernel not found`}),He()}}),Y;return n[43]!==ke||n[44]!==V?(Y={connection:ke,reconnect:V},n[43]=ke,n[44]=V,n[45]=Y):Y=n[45],Y}function Fn(e){return{...e,name:e.name}}function In(e){return{name:e.name,dataType:e.datatype,value:e.value}}function Ln(e){return{name:e.name,declaredBy:e.declared_by,usedBy:e.used_by}}function Rn(e){return e.name}function zn(){return ue().cellIds.inOrderIds}var Bn=e=>{let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{"data-testid":`chrome-wrapper`,className:`flex flex-col flex-1 overflow-hidden absolute inset-0 print:relative`,children:n}),t[0]=n,t[1]=r),r};export{on as a,ln as c,bt as d,_t as f,dn as i,rn as l,Pn as n,an as o,pn as r,un as s,Bn as t,St as u};
@@ -1,4 +1,4 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t,t as n}from"./useEvent-xfs0Sn4r.js";import{t as r}from"./react-CBDbhulC.js";import{Ba as i,D as a,Fa as o,Ia as s,Kt as c,lt as l}from"./cells-Cp-G34Rz.js";import{t as u}from"./compiler-runtime-CYIjoINj.js";import{E as d,c as f,t as p}from"./utils-D5Ywm7-q.js";import{g as m,t as h}from"./useEventListener-92uWqz-P.js";import{O as g,v as _}from"./config-BlNM0caL.js";import{o as v,t as y}from"./readonly-python-code-DpIyjHqY.js";import{t as b}from"./cn-ldLVeaqm.js";import{t as x}from"./jsx-runtime-B74pBk57.js";import{n as S}from"./fullscreen-BH2jz-F4.js";import{It as C}from"./JsonOutput-Bgxc9G7d.js";import{t as w}from"./tooltip-BUtPzKB4.js";import{r as T,t as E}from"./button-Dh8EwhsF.js";import{t as D}from"./createLucideIcon-B7HeEoG2.js";import{f as O,l as k,m as A,p as j,s as M,u as ee,v as te,y as N}from"./layout-CC2AHMrW.js";import{a as P}from"./useNumberFormatter-DHJ9s6Vk.js";import{t as ne}from"./code-CF0HKE9K.js";import{t as re}from"./eye-off-CFuPxa9F.js";import{n as ie,t as ae}from"./cell-editor-QmA8u1Ay.js";import{n as oe,t as se}from"./RunButton-BlpbweyH.js";import{r as ce}from"./useTheme-C-ri8BtY.js";import{r as le}from"./useDebounce-DgpSQhrP.js";import{t as ue}from"./CellStatus-LoTwk7fR.js";import{i as de}from"./useRunCells-CX7oW5zy.js";import{n as fe,r as pe,t as me}from"./react-resizable-panels.browser.esm-BSRAHC4P.js";import{t as he}from"./readonly-code-display--S2daDa6.js";/* empty css */var ge=D(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),F=e(r(),1),I=u(),_e=Object.defineProperty,ve=Object.defineProperties,ye=Object.getOwnPropertyDescriptors,be=Object.getOwnPropertySymbols,xe=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable,R=(e,t,n)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,z=(e,t)=>{for(var n in t||={})xe.call(t,n)&&R(e,n,t[n]);if(be)for(var n of be(t))L.call(t,n)&&R(e,n,t[n]);return e},Se=(e,t)=>ve(e,ye(t)),Ce=(e,t,n)=>R(e,typeof t==`symbol`?t:t+``,n),we=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),Te=(e,t)=>{for(let n in t)e[n]=t[n];return e},B=(e,t)=>Array.from(e.querySelectorAll(t)),V=(e,t,n)=>{n?e.classList.add(t):e.classList.remove(t)},Ee=e=>{if(typeof e==`string`){if(e===`null`)return null;if(e===`true`)return!0;if(e===`false`)return!1;if(e.match(/^-?[\d\.]+$/))return parseFloat(e)}return e},H=(e,t)=>{e.style.transform=t},U=(e,t)=>{let n=e.matches||e.matchesSelector||e.msMatchesSelector;return!!(n&&n.call(e,t))},W=(e,t)=>{if(e&&typeof e.closest==`function`)return e.closest(t);for(;e;){if(U(e,t))return e;e=e.parentElement}return null},De=e=>{e||=document.documentElement;let t=e.requestFullscreen||e.webkitRequestFullscreen||e.webkitRequestFullScreen||e.mozRequestFullScreen||e.msRequestFullscreen;t&&t.apply(e)},Oe=(e,t,n,r=``)=>{let i=e.querySelectorAll(`.`+n);for(let t=0;t<i.length;t++){let n=i[t];if(n.parentNode===e)return n}let a=document.createElement(t);return a.className=n,a.innerHTML=r,e.appendChild(a),a},ke=e=>{let t=document.createElement(`style`);return e&&e.length>0&&t.appendChild(document.createTextNode(e)),document.head.appendChild(t),t},Ae=()=>{let e={};location.search.replace(/[A-Z0-9]+?=([\w\.%-]*)/gi,t=>{let n=t.split(`=`).shift(),r=t.split(`=`).pop();return n&&r!==void 0&&(e[n]=r),t});for(let t in e){let n=e[t];e[t]=Ee(unescape(n))}return e.dependencies!==void 0&&delete e.dependencies,e},je=(e,t=0)=>{if(e){let n,r=e.style.height;return e.style.height=`0px`,e.parentElement&&(e.parentElement.style.height=`auto`),n=t-(e.parentElement?.offsetHeight||0),e.style.height=r+`px`,e.parentElement&&e.parentElement.style.removeProperty(`height`),n}return t},Me={mp4:`video/mp4`,m4a:`video/mp4`,ogv:`video/ogg`,mpeg:`video/mpeg`,webm:`video/webm`},Ne=(e=``)=>{let t=e.split(`.`).pop();return t?Me[t]:void 0},Pe=(e=``)=>encodeURI(e).replace(/%5B/g,`[`).replace(/%5D/g,`]`).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Fe=navigator.userAgent,G=/(iphone|ipod|ipad|android)/gi.test(Fe)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,Ie=/android/gi.test(Fe),Le=(function(e){if(e){var t=function(e){return[].slice.call(e)},n=0,r=1,i=2,a=3,o=[],s=null,c=`requestAnimationFrame`in e?function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{sync:!1};e.cancelAnimationFrame(s);var n=function(){return u(o.filter((function(e){return e.dirty&&e.active})))};if(t.sync)return n();s=e.requestAnimationFrame(n)}:function(){},l=function(e){return function(t){o.forEach((function(t){return t.dirty=e})),c(t)}},u=function(e){e.filter((function(e){return!e.styleComputed})).forEach((function(e){e.styleComputed=m(e)})),e.filter(h).forEach(g);var t=e.filter(p);t.forEach(f),t.forEach((function(e){g(e),d(e)})),t.forEach(_)},d=function(e){return e.dirty=n},f=function(e){e.availableWidth=e.element.parentNode.clientWidth,e.currentWidth=e.element.scrollWidth,e.previousFontSize=e.currentFontSize,e.currentFontSize=Math.min(Math.max(e.minSize,e.availableWidth/e.currentWidth*e.previousFontSize),e.maxSize),e.whiteSpace=e.multiLine&&e.currentFontSize===e.minSize?`normal`:`nowrap`},p=function(e){return e.dirty!==i||e.dirty===i&&e.element.parentNode.clientWidth!==e.availableWidth},m=function(t){var n=e.getComputedStyle(t.element,null);return t.currentFontSize=parseFloat(n.getPropertyValue(`font-size`)),t.display=n.getPropertyValue(`display`),t.whiteSpace=n.getPropertyValue(`white-space`),!0},h=function(e){var t=!1;return!e.preStyleTestCompleted&&(/inline-/.test(e.display)||(t=!0,e.display=`inline-block`),e.whiteSpace!==`nowrap`&&(t=!0,e.whiteSpace=`nowrap`),e.preStyleTestCompleted=!0,t)},g=function(e){e.element.style.whiteSpace=e.whiteSpace,e.element.style.display=e.display,e.element.style.fontSize=e.currentFontSize+`px`},_=function(e){e.element.dispatchEvent(new CustomEvent(`fit`,{detail:{oldValue:e.previousFontSize,newValue:e.currentFontSize,scaleFactor:e.currentFontSize/e.previousFontSize}}))},v=function(e,t){return function(n){e.dirty=t,e.active&&c(n)}},y=function(e){return function(){o=o.filter((function(t){return t.element!==e.element})),e.observeMutations&&e.observer.disconnect(),e.element.style.whiteSpace=e.originalStyle.whiteSpace,e.element.style.display=e.originalStyle.display,e.element.style.fontSize=e.originalStyle.fontSize}},b=function(e){return function(){e.active||(e.active=!0,c())}},x=function(e){return function(){return e.active=!1}},S=function(e){e.observeMutations&&(e.observer=new MutationObserver(v(e,r)),e.observer.observe(e.element,e.observeMutations))},C={minSize:16,maxSize:512,multiLine:!0,observeMutations:`MutationObserver`in e&&{subtree:!0,childList:!0,characterData:!0}},w=null,T=function(){e.clearTimeout(w),w=e.setTimeout(l(i),O.observeWindowDelay)},E=[`resize`,`orientationchange`];return Object.defineProperty(O,"observeWindow",{set:function(t){var n=`${t?`add`:`remove`}EventListener`;E.forEach((function(t){e[n](t,T)}))}}),O.observeWindow=!0,O.observeWindowDelay=100,O.fitAll=l(a),O}function D(e,t){var n=Object.assign({},C,t),r=e.map((function(e){var t=Object.assign({},n,{element:e,active:!0});return(function(e){e.originalStyle={whiteSpace:e.element.style.whiteSpace,display:e.element.style.display,fontSize:e.element.style.fontSize},S(e),e.newbie=!0,e.dirty=!0,o.push(e)})(t),{element:e,fit:v(t,a),unfreeze:b(t),freeze:x(t),unsubscribe:y(t)}}));return c(),r}function O(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return typeof e==`string`?D(t(document.querySelectorAll(e)),n):D([e],n)[0]}})(typeof window>`u`?null:window),Re=class{constructor(e){Ce(this,`allowedToPlayAudio`,null),this.Reveal=e,this.startEmbeddedMedia=this.startEmbeddedMedia.bind(this),this.startEmbeddedIframe=this.startEmbeddedIframe.bind(this),this.preventIframeAutoFocus=this.preventIframeAutoFocus.bind(this),this.ensureMobileMediaPlaying=this.ensureMobileMediaPlaying.bind(this),this.failedAudioPlaybackTargets=new Set,this.failedVideoPlaybackTargets=new Set,this.failedMutedVideoPlaybackTargets=new Set,this.renderMediaPlayButton()}renderMediaPlayButton(){this.mediaPlayButton=document.createElement(`button`),this.mediaPlayButton.className=`r-overlay-button r-media-play-button`,this.mediaPlayButton.addEventListener(`click`,()=>{this.resetTemporarilyMutedMedia(),new Set([...this.failedAudioPlaybackTargets,...this.failedVideoPlaybackTargets,...this.failedMutedVideoPlaybackTargets]).forEach(e=>{this.startEmbeddedMedia({target:e})}),this.clearMediaPlaybackErrors()})}shouldPreload(e){if(this.Reveal.isScrollView())return!0;let t=this.Reveal.getConfig().preloadIframes;return typeof t!=`boolean`&&(t=e.hasAttribute(`data-preload`)),t}load(e,t={}){let n=this.Reveal.getConfig().display;if(n.includes(`!important`)){let t=n.replace(/\s*!important\s*$/,``).trim();e.style.setProperty(`display`,t,`important`)}else e.style.display=n;B(e,`img[data-src], video[data-src], audio[data-src], iframe[data-src]`).forEach(e=>{let t=e.tagName===`IFRAME`;(!t||this.shouldPreload(e))&&(e.setAttribute(`src`,e.getAttribute(`data-src`)),e.setAttribute(`data-lazy-loaded`,``),e.removeAttribute(`data-src`),t&&e.addEventListener(`load`,this.preventIframeAutoFocus))}),B(e,`video, audio`).forEach(e=>{let t=0;B(e,`source[data-src]`).forEach(e=>{e.setAttribute(`src`,e.getAttribute(`data-src`)),e.removeAttribute(`data-src`),e.setAttribute(`data-lazy-loaded`,``),t+=1}),G&&e.tagName===`VIDEO`&&e.setAttribute(`playsinline`,``),t>0&&e.load()});let r=e.slideBackgroundElement;if(r){r.style.display=`block`;let n=e.slideBackgroundContentElement,i=e.getAttribute(`data-background-iframe`);if(r.hasAttribute(`data-loaded`)===!1){r.setAttribute(`data-loaded`,`true`);let a=e.getAttribute(`data-background-image`),o=e.getAttribute(`data-background-video`),s=e.hasAttribute(`data-background-video-loop`),c=e.hasAttribute(`data-background-video-muted`);if(a)/^data:/.test(a.trim())?n.style.backgroundImage=`url(${a.trim()})`:n.style.backgroundImage=a.split(`,`).map(e=>`url(${Pe(decodeURI(e.trim()))})`).join(`,`);else if(o){let e=document.createElement(`video`);s&&e.setAttribute(`loop`,``),(c||this.Reveal.isSpeakerNotes())&&(e.muted=!0),G&&e.setAttribute(`playsinline`,``),o.split(`,`).forEach(t=>{let n=document.createElement(`source`);n.setAttribute(`src`,t);let r=Ne(t);r&&n.setAttribute(`type`,r),e.appendChild(n)}),n.appendChild(e)}else if(i&&t.excludeIframes!==!0){let e=document.createElement(`iframe`);e.setAttribute(`allowfullscreen`,``),e.setAttribute(`mozallowfullscreen`,``),e.setAttribute(`webkitallowfullscreen`,``),e.setAttribute(`allow`,`autoplay`),e.setAttribute(`data-src`,i),e.style.width=`100%`,e.style.height=`100%`,e.style.maxHeight=`100%`,e.style.maxWidth=`100%`,n.appendChild(e)}}let a=n.querySelector(`iframe[data-src]`);a&&this.shouldPreload(r)&&!/autoplay=(1|true|yes)/gi.test(i)&&a.getAttribute(`src`)!==i&&a.setAttribute(`src`,i)}this.layout(e)}layout(e){Array.from(e.querySelectorAll(`.r-fit-text`)).forEach(e=>{Le(e,{minSize:24,maxSize:this.Reveal.getConfig().height*.8,observeMutations:!1,observeWindow:!1})})}unload(e){e.style.display=`none`;let t=this.Reveal.getSlideBackground(e);t&&(t.style.display=`none`,B(t,`iframe[src]`).forEach(e=>{e.removeAttribute(`src`)})),B(e,`video[data-lazy-loaded][src], audio[data-lazy-loaded][src], iframe[data-lazy-loaded][src]`).forEach(e=>{e.setAttribute(`data-src`,e.getAttribute(`src`)),e.removeAttribute(`src`)}),B(e,`video[data-lazy-loaded] source[src], audio source[src]`).forEach(e=>{e.setAttribute(`data-src`,e.getAttribute(`src`)),e.removeAttribute(`src`)})}formatEmbeddedContent(){let e=(e,t,n)=>{B(this.Reveal.getSlidesElement(),`iframe[`+e+`*="`+t+`"]`).forEach(t=>{let r=t.getAttribute(e);r&&r.indexOf(n)===-1&&t.setAttribute(e,r+(/\?/.test(r)?`&`:`?`)+n)})};e(`src`,`youtube.com/embed/`,`enablejsapi=1`),e(`data-src`,`youtube.com/embed/`,`enablejsapi=1`),e(`src`,`player.vimeo.com/`,`api=1`),e(`data-src`,`player.vimeo.com/`,`api=1`)}startEmbeddedContent(e){if(e){let t=this.Reveal.isSpeakerNotes();B(e,`img[src$=".gif"]`).forEach(e=>{e.setAttribute(`src`,e.getAttribute(`src`))}),B(e,`video, audio`).forEach(e=>{if(W(e,`.fragment`)&&!W(e,`.fragment.visible`))return;let n=this.Reveal.getConfig().autoPlayMedia;if(typeof n!=`boolean`&&(n=e.hasAttribute(`data-autoplay`)||!!W(e,`.slide-background`)),n&&typeof e.play==`function`){if(t&&!e.muted)return;e.readyState>1?this.startEmbeddedMedia({target:e}):G?(e.addEventListener(`canplay`,this.ensureMobileMediaPlaying),this.playMediaElement(e)):(e.removeEventListener(`loadeddata`,this.startEmbeddedMedia),e.addEventListener(`loadeddata`,this.startEmbeddedMedia))}}),t||(B(e,`iframe[src]`).forEach(e=>{W(e,`.fragment`)&&!W(e,`.fragment.visible`)||this.startEmbeddedIframe({target:e})}),B(e,`iframe[data-src]`).forEach(e=>{W(e,`.fragment`)&&!W(e,`.fragment.visible`)||e.getAttribute(`src`)!==e.getAttribute(`data-src`)&&(e.removeEventListener(`load`,this.startEmbeddedIframe),e.addEventListener(`load`,this.startEmbeddedIframe),e.setAttribute(`src`,e.getAttribute(`data-src`)))}))}}ensureMobileMediaPlaying(e){let t=e.target;typeof t.getVideoPlaybackQuality==`function`&&setTimeout(()=>{let e=t.paused===!1,n=t.getVideoPlaybackQuality().totalVideoFrames;e&&n===0&&(t.load(),t.play())},1e3)}startEmbeddedMedia(e){let t=!!W(e.target,`html`),n=!!W(e.target,`.present`);t&&n&&(e.target.paused||e.target.ended)&&(e.target.currentTime=0,this.playMediaElement(e.target)),e.target.removeEventListener(`loadeddata`,this.startEmbeddedMedia)}playMediaElement(e){let t=e.play();t&&typeof t.catch==`function`&&t.then(()=>{e.muted||(this.allowedToPlayAudio=!0)}).catch(t=>{if(t.name===`NotAllowedError`){if(this.allowedToPlayAudio=!1,e.tagName===`VIDEO`){this.onVideoPlaybackNotAllowed(e);let t=!!W(e,`html`),n=!!W(e,`.present`),r=e.muted;t&&n&&!r&&(e.setAttribute(`data-muted-by-reveal`,`true`),e.muted=!0,e.play().catch(()=>{this.onMutedVideoPlaybackNotAllowed(e)}))}else e.tagName===`AUDIO`&&this.onAudioPlaybackNotAllowed(e)}})}startEmbeddedIframe(e){let t=e.target;if(this.preventIframeAutoFocus(e),t&&t.contentWindow){let n=!!W(e.target,`html`),r=!!W(e.target,`.present`);if(n&&r){let e=this.Reveal.getConfig().autoPlayMedia;typeof e!=`boolean`&&(e=t.hasAttribute(`data-autoplay`)||!!W(t,`.slide-background`)),/youtube\.com\/embed\//.test(t.getAttribute(`src`))&&e?t.contentWindow.postMessage(`{"event":"command","func":"playVideo","args":""}`,`*`):/player\.vimeo\.com\//.test(t.getAttribute(`src`))&&e?t.contentWindow.postMessage(`{"method":"play"}`,`*`):t.contentWindow.postMessage(`slide:start`,`*`)}}}stopEmbeddedContent(e,t={}){t=Te({unloadIframes:!0},t),e&&e.parentNode&&(B(e,`video, audio`).forEach(e=>{!e.hasAttribute(`data-ignore`)&&typeof e.pause==`function`&&(e.setAttribute(`data-paused-by-reveal`,``),e.pause(),G&&e.removeEventListener(`canplay`,this.ensureMobileMediaPlaying))}),B(e,`iframe`).forEach(e=>{e.contentWindow&&e.contentWindow.postMessage(`slide:stop`,`*`),e.removeEventListener(`load`,this.preventIframeAutoFocus),e.removeEventListener(`load`,this.startEmbeddedIframe)}),B(e,`iframe[src*="youtube.com/embed/"]`).forEach(e=>{!e.hasAttribute(`data-ignore`)&&e.contentWindow&&typeof e.contentWindow.postMessage==`function`&&e.contentWindow.postMessage(`{"event":"command","func":"pauseVideo","args":""}`,`*`)}),B(e,`iframe[src*="player.vimeo.com/"]`).forEach(e=>{!e.hasAttribute(`data-ignore`)&&e.contentWindow&&typeof e.contentWindow.postMessage==`function`&&e.contentWindow.postMessage(`{"method":"pause"}`,`*`)}),t.unloadIframes===!0&&B(e,`iframe[data-src]`).forEach(e=>{e.setAttribute(`src`,`about:blank`),e.removeAttribute(`src`)}))}isAllowedToPlayAudio(){return this.allowedToPlayAudio}showPlayOrUnmuteButton(){let e=this.failedAudioPlaybackTargets.size,t=this.failedVideoPlaybackTargets.size,n=this.failedMutedVideoPlaybackTargets.size,r=`Play media`;n>0?r=`Play video`:t>0?r=`Unmute video`:e>0&&(r=`Play audio`),this.mediaPlayButton.textContent=r,this.Reveal.getRevealElement().appendChild(this.mediaPlayButton)}onAudioPlaybackNotAllowed(e){this.failedAudioPlaybackTargets.add(e),this.showPlayOrUnmuteButton(e)}onVideoPlaybackNotAllowed(e){this.failedVideoPlaybackTargets.add(e),this.showPlayOrUnmuteButton()}onMutedVideoPlaybackNotAllowed(e){this.failedMutedVideoPlaybackTargets.add(e),this.showPlayOrUnmuteButton()}resetTemporarilyMutedMedia(){new Set([...this.failedAudioPlaybackTargets,...this.failedVideoPlaybackTargets,...this.failedMutedVideoPlaybackTargets]).forEach(e=>{e.hasAttribute(`data-muted-by-reveal`)&&(e.muted=!1,e.removeAttribute(`data-muted-by-reveal`))})}clearMediaPlaybackErrors(){this.resetTemporarilyMutedMedia(),this.failedAudioPlaybackTargets.clear(),this.failedVideoPlaybackTargets.clear(),this.failedMutedVideoPlaybackTargets.clear(),this.mediaPlayButton.remove()}preventIframeAutoFocus(e){let t=e.target;if(t&&this.Reveal.getConfig().preventIframeAutoFocus){let e=0,n=()=>{document.activeElement===t?document.activeElement.blur():e<1e3&&(e+=100,setTimeout(n,100))};setTimeout(n,100)}}afterSlideChanged(){this.clearMediaPlaybackErrors()}},ze=`.slides section`,Be=`.slides>section`,Ve=`.slides>section.present>section`,He=`.backgrounds>.slide-background`,Ue=/registerPlugin|registerKeyboardShortcut|addKeyBinding|addEventListener|showPreview/,We=`h.v`,Ge=`h/v`,Ke=`c`,qe=`c/t`,Je=class{constructor(e){this.Reveal=e}render(){this.element=document.createElement(`div`),this.element.className=`slide-number`,this.Reveal.getRevealElement().appendChild(this.element)}configure(e,t){let n=`none`;e.slideNumber&&!this.Reveal.isPrintView()&&(e.showSlideNumber===`all`||e.showSlideNumber===`speaker`&&this.Reveal.isSpeakerNotes())&&(n=`block`),this.element.style.display=n}update(){this.Reveal.getConfig().slideNumber&&this.element&&(this.element.innerHTML=this.getSlideNumber())}getSlideNumber(e=this.Reveal.getCurrentSlide()){let t=this.Reveal.getConfig(),n,r=We;if(typeof t.slideNumber==`function`)n=t.slideNumber(e);else{typeof t.slideNumber==`string`&&(r=t.slideNumber),!/c/.test(r)&&this.Reveal.getHorizontalSlides().length===1&&(r=Ke);let i=e&&e.dataset.visibility===`uncounted`?0:1;switch(n=[],r){case Ke:n.push(this.Reveal.getSlidePastCount(e)+i);break;case qe:n.push(this.Reveal.getSlidePastCount(e)+i,`/`,this.Reveal.getTotalSlides());break;default:let t=this.Reveal.getIndices(e);n.push(t.h+i);let a=r===Ge?`/`:`.`;this.Reveal.isVerticalSlide(e)&&n.push(a,t.v+1)}}let i=`#`+this.Reveal.location.getHash(e);return this.formatNumber(n[0],n[1],n[2],i)}formatNumber(e,t,n,r=`#`+this.Reveal.location.getHash()){return typeof n==`number`&&!isNaN(n)?`<a href="${r}">
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t,t as n}from"./useEvent-xfs0Sn4r.js";import{t as r}from"./react-CBDbhulC.js";import{Ba as i,D as a,Fa as o,Ia as s,Kt as c,lt as l}from"./cells-Cp-G34Rz.js";import{t as u}from"./compiler-runtime-CYIjoINj.js";import{E as d,c as f,t as p}from"./utils-D5Ywm7-q.js";import{g as m,t as h}from"./useEventListener-92uWqz-P.js";import{O as g,v as _}from"./config-BlNM0caL.js";import{o as v,t as y}from"./readonly-python-code-DpIyjHqY.js";import{t as b}from"./cn-ldLVeaqm.js";import{t as x}from"./jsx-runtime-B74pBk57.js";import{n as S}from"./fullscreen-BH2jz-F4.js";import{It as C}from"./JsonOutput-CzIGPEZQ.js";import{t as w}from"./tooltip-BUtPzKB4.js";import{r as T,t as E}from"./button-Dh8EwhsF.js";import{t as D}from"./createLucideIcon-B7HeEoG2.js";import{f as O,l as k,m as A,p as j,s as M,u as ee,v as te,y as N}from"./layout-DWnrxIo2.js";import{a as P}from"./useNumberFormatter-DHJ9s6Vk.js";import{t as ne}from"./code-CF0HKE9K.js";import{t as re}from"./eye-off-CFuPxa9F.js";import{n as ie,t as ae}from"./cell-editor-Dw09J9yD.js";import{n as oe,t as se}from"./RunButton-BlpbweyH.js";import{r as ce}from"./useTheme-C-ri8BtY.js";import{r as le}from"./useDebounce-DgpSQhrP.js";import{t as ue}from"./CellStatus-LoTwk7fR.js";import{i as de}from"./useRunCells-CX7oW5zy.js";import{n as fe,r as pe,t as me}from"./react-resizable-panels.browser.esm-BSRAHC4P.js";import{t as he}from"./readonly-code-display--S2daDa6.js";/* empty css */var ge=D(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),F=e(r(),1),I=u(),_e=Object.defineProperty,ve=Object.defineProperties,ye=Object.getOwnPropertyDescriptors,be=Object.getOwnPropertySymbols,xe=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable,R=(e,t,n)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,z=(e,t)=>{for(var n in t||={})xe.call(t,n)&&R(e,n,t[n]);if(be)for(var n of be(t))L.call(t,n)&&R(e,n,t[n]);return e},Se=(e,t)=>ve(e,ye(t)),Ce=(e,t,n)=>R(e,typeof t==`symbol`?t:t+``,n),we=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),Te=(e,t)=>{for(let n in t)e[n]=t[n];return e},B=(e,t)=>Array.from(e.querySelectorAll(t)),V=(e,t,n)=>{n?e.classList.add(t):e.classList.remove(t)},Ee=e=>{if(typeof e==`string`){if(e===`null`)return null;if(e===`true`)return!0;if(e===`false`)return!1;if(e.match(/^-?[\d\.]+$/))return parseFloat(e)}return e},H=(e,t)=>{e.style.transform=t},U=(e,t)=>{let n=e.matches||e.matchesSelector||e.msMatchesSelector;return!!(n&&n.call(e,t))},W=(e,t)=>{if(e&&typeof e.closest==`function`)return e.closest(t);for(;e;){if(U(e,t))return e;e=e.parentElement}return null},De=e=>{e||=document.documentElement;let t=e.requestFullscreen||e.webkitRequestFullscreen||e.webkitRequestFullScreen||e.mozRequestFullScreen||e.msRequestFullscreen;t&&t.apply(e)},Oe=(e,t,n,r=``)=>{let i=e.querySelectorAll(`.`+n);for(let t=0;t<i.length;t++){let n=i[t];if(n.parentNode===e)return n}let a=document.createElement(t);return a.className=n,a.innerHTML=r,e.appendChild(a),a},ke=e=>{let t=document.createElement(`style`);return e&&e.length>0&&t.appendChild(document.createTextNode(e)),document.head.appendChild(t),t},Ae=()=>{let e={};location.search.replace(/[A-Z0-9]+?=([\w\.%-]*)/gi,t=>{let n=t.split(`=`).shift(),r=t.split(`=`).pop();return n&&r!==void 0&&(e[n]=r),t});for(let t in e){let n=e[t];e[t]=Ee(unescape(n))}return e.dependencies!==void 0&&delete e.dependencies,e},je=(e,t=0)=>{if(e){let n,r=e.style.height;return e.style.height=`0px`,e.parentElement&&(e.parentElement.style.height=`auto`),n=t-(e.parentElement?.offsetHeight||0),e.style.height=r+`px`,e.parentElement&&e.parentElement.style.removeProperty(`height`),n}return t},Me={mp4:`video/mp4`,m4a:`video/mp4`,ogv:`video/ogg`,mpeg:`video/mpeg`,webm:`video/webm`},Ne=(e=``)=>{let t=e.split(`.`).pop();return t?Me[t]:void 0},Pe=(e=``)=>encodeURI(e).replace(/%5B/g,`[`).replace(/%5D/g,`]`).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Fe=navigator.userAgent,G=/(iphone|ipod|ipad|android)/gi.test(Fe)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,Ie=/android/gi.test(Fe),Le=(function(e){if(e){var t=function(e){return[].slice.call(e)},n=0,r=1,i=2,a=3,o=[],s=null,c=`requestAnimationFrame`in e?function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{sync:!1};e.cancelAnimationFrame(s);var n=function(){return u(o.filter((function(e){return e.dirty&&e.active})))};if(t.sync)return n();s=e.requestAnimationFrame(n)}:function(){},l=function(e){return function(t){o.forEach((function(t){return t.dirty=e})),c(t)}},u=function(e){e.filter((function(e){return!e.styleComputed})).forEach((function(e){e.styleComputed=m(e)})),e.filter(h).forEach(g);var t=e.filter(p);t.forEach(f),t.forEach((function(e){g(e),d(e)})),t.forEach(_)},d=function(e){return e.dirty=n},f=function(e){e.availableWidth=e.element.parentNode.clientWidth,e.currentWidth=e.element.scrollWidth,e.previousFontSize=e.currentFontSize,e.currentFontSize=Math.min(Math.max(e.minSize,e.availableWidth/e.currentWidth*e.previousFontSize),e.maxSize),e.whiteSpace=e.multiLine&&e.currentFontSize===e.minSize?`normal`:`nowrap`},p=function(e){return e.dirty!==i||e.dirty===i&&e.element.parentNode.clientWidth!==e.availableWidth},m=function(t){var n=e.getComputedStyle(t.element,null);return t.currentFontSize=parseFloat(n.getPropertyValue(`font-size`)),t.display=n.getPropertyValue(`display`),t.whiteSpace=n.getPropertyValue(`white-space`),!0},h=function(e){var t=!1;return!e.preStyleTestCompleted&&(/inline-/.test(e.display)||(t=!0,e.display=`inline-block`),e.whiteSpace!==`nowrap`&&(t=!0,e.whiteSpace=`nowrap`),e.preStyleTestCompleted=!0,t)},g=function(e){e.element.style.whiteSpace=e.whiteSpace,e.element.style.display=e.display,e.element.style.fontSize=e.currentFontSize+`px`},_=function(e){e.element.dispatchEvent(new CustomEvent(`fit`,{detail:{oldValue:e.previousFontSize,newValue:e.currentFontSize,scaleFactor:e.currentFontSize/e.previousFontSize}}))},v=function(e,t){return function(n){e.dirty=t,e.active&&c(n)}},y=function(e){return function(){o=o.filter((function(t){return t.element!==e.element})),e.observeMutations&&e.observer.disconnect(),e.element.style.whiteSpace=e.originalStyle.whiteSpace,e.element.style.display=e.originalStyle.display,e.element.style.fontSize=e.originalStyle.fontSize}},b=function(e){return function(){e.active||(e.active=!0,c())}},x=function(e){return function(){return e.active=!1}},S=function(e){e.observeMutations&&(e.observer=new MutationObserver(v(e,r)),e.observer.observe(e.element,e.observeMutations))},C={minSize:16,maxSize:512,multiLine:!0,observeMutations:`MutationObserver`in e&&{subtree:!0,childList:!0,characterData:!0}},w=null,T=function(){e.clearTimeout(w),w=e.setTimeout(l(i),O.observeWindowDelay)},E=[`resize`,`orientationchange`];return Object.defineProperty(O,"observeWindow",{set:function(t){var n=`${t?`add`:`remove`}EventListener`;E.forEach((function(t){e[n](t,T)}))}}),O.observeWindow=!0,O.observeWindowDelay=100,O.fitAll=l(a),O}function D(e,t){var n=Object.assign({},C,t),r=e.map((function(e){var t=Object.assign({},n,{element:e,active:!0});return(function(e){e.originalStyle={whiteSpace:e.element.style.whiteSpace,display:e.element.style.display,fontSize:e.element.style.fontSize},S(e),e.newbie=!0,e.dirty=!0,o.push(e)})(t),{element:e,fit:v(t,a),unfreeze:b(t),freeze:x(t),unsubscribe:y(t)}}));return c(),r}function O(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return typeof e==`string`?D(t(document.querySelectorAll(e)),n):D([e],n)[0]}})(typeof window>`u`?null:window),Re=class{constructor(e){Ce(this,`allowedToPlayAudio`,null),this.Reveal=e,this.startEmbeddedMedia=this.startEmbeddedMedia.bind(this),this.startEmbeddedIframe=this.startEmbeddedIframe.bind(this),this.preventIframeAutoFocus=this.preventIframeAutoFocus.bind(this),this.ensureMobileMediaPlaying=this.ensureMobileMediaPlaying.bind(this),this.failedAudioPlaybackTargets=new Set,this.failedVideoPlaybackTargets=new Set,this.failedMutedVideoPlaybackTargets=new Set,this.renderMediaPlayButton()}renderMediaPlayButton(){this.mediaPlayButton=document.createElement(`button`),this.mediaPlayButton.className=`r-overlay-button r-media-play-button`,this.mediaPlayButton.addEventListener(`click`,()=>{this.resetTemporarilyMutedMedia(),new Set([...this.failedAudioPlaybackTargets,...this.failedVideoPlaybackTargets,...this.failedMutedVideoPlaybackTargets]).forEach(e=>{this.startEmbeddedMedia({target:e})}),this.clearMediaPlaybackErrors()})}shouldPreload(e){if(this.Reveal.isScrollView())return!0;let t=this.Reveal.getConfig().preloadIframes;return typeof t!=`boolean`&&(t=e.hasAttribute(`data-preload`)),t}load(e,t={}){let n=this.Reveal.getConfig().display;if(n.includes(`!important`)){let t=n.replace(/\s*!important\s*$/,``).trim();e.style.setProperty(`display`,t,`important`)}else e.style.display=n;B(e,`img[data-src], video[data-src], audio[data-src], iframe[data-src]`).forEach(e=>{let t=e.tagName===`IFRAME`;(!t||this.shouldPreload(e))&&(e.setAttribute(`src`,e.getAttribute(`data-src`)),e.setAttribute(`data-lazy-loaded`,``),e.removeAttribute(`data-src`),t&&e.addEventListener(`load`,this.preventIframeAutoFocus))}),B(e,`video, audio`).forEach(e=>{let t=0;B(e,`source[data-src]`).forEach(e=>{e.setAttribute(`src`,e.getAttribute(`data-src`)),e.removeAttribute(`data-src`),e.setAttribute(`data-lazy-loaded`,``),t+=1}),G&&e.tagName===`VIDEO`&&e.setAttribute(`playsinline`,``),t>0&&e.load()});let r=e.slideBackgroundElement;if(r){r.style.display=`block`;let n=e.slideBackgroundContentElement,i=e.getAttribute(`data-background-iframe`);if(r.hasAttribute(`data-loaded`)===!1){r.setAttribute(`data-loaded`,`true`);let a=e.getAttribute(`data-background-image`),o=e.getAttribute(`data-background-video`),s=e.hasAttribute(`data-background-video-loop`),c=e.hasAttribute(`data-background-video-muted`);if(a)/^data:/.test(a.trim())?n.style.backgroundImage=`url(${a.trim()})`:n.style.backgroundImage=a.split(`,`).map(e=>`url(${Pe(decodeURI(e.trim()))})`).join(`,`);else if(o){let e=document.createElement(`video`);s&&e.setAttribute(`loop`,``),(c||this.Reveal.isSpeakerNotes())&&(e.muted=!0),G&&e.setAttribute(`playsinline`,``),o.split(`,`).forEach(t=>{let n=document.createElement(`source`);n.setAttribute(`src`,t);let r=Ne(t);r&&n.setAttribute(`type`,r),e.appendChild(n)}),n.appendChild(e)}else if(i&&t.excludeIframes!==!0){let e=document.createElement(`iframe`);e.setAttribute(`allowfullscreen`,``),e.setAttribute(`mozallowfullscreen`,``),e.setAttribute(`webkitallowfullscreen`,``),e.setAttribute(`allow`,`autoplay`),e.setAttribute(`data-src`,i),e.style.width=`100%`,e.style.height=`100%`,e.style.maxHeight=`100%`,e.style.maxWidth=`100%`,n.appendChild(e)}}let a=n.querySelector(`iframe[data-src]`);a&&this.shouldPreload(r)&&!/autoplay=(1|true|yes)/gi.test(i)&&a.getAttribute(`src`)!==i&&a.setAttribute(`src`,i)}this.layout(e)}layout(e){Array.from(e.querySelectorAll(`.r-fit-text`)).forEach(e=>{Le(e,{minSize:24,maxSize:this.Reveal.getConfig().height*.8,observeMutations:!1,observeWindow:!1})})}unload(e){e.style.display=`none`;let t=this.Reveal.getSlideBackground(e);t&&(t.style.display=`none`,B(t,`iframe[src]`).forEach(e=>{e.removeAttribute(`src`)})),B(e,`video[data-lazy-loaded][src], audio[data-lazy-loaded][src], iframe[data-lazy-loaded][src]`).forEach(e=>{e.setAttribute(`data-src`,e.getAttribute(`src`)),e.removeAttribute(`src`)}),B(e,`video[data-lazy-loaded] source[src], audio source[src]`).forEach(e=>{e.setAttribute(`data-src`,e.getAttribute(`src`)),e.removeAttribute(`src`)})}formatEmbeddedContent(){let e=(e,t,n)=>{B(this.Reveal.getSlidesElement(),`iframe[`+e+`*="`+t+`"]`).forEach(t=>{let r=t.getAttribute(e);r&&r.indexOf(n)===-1&&t.setAttribute(e,r+(/\?/.test(r)?`&`:`?`)+n)})};e(`src`,`youtube.com/embed/`,`enablejsapi=1`),e(`data-src`,`youtube.com/embed/`,`enablejsapi=1`),e(`src`,`player.vimeo.com/`,`api=1`),e(`data-src`,`player.vimeo.com/`,`api=1`)}startEmbeddedContent(e){if(e){let t=this.Reveal.isSpeakerNotes();B(e,`img[src$=".gif"]`).forEach(e=>{e.setAttribute(`src`,e.getAttribute(`src`))}),B(e,`video, audio`).forEach(e=>{if(W(e,`.fragment`)&&!W(e,`.fragment.visible`))return;let n=this.Reveal.getConfig().autoPlayMedia;if(typeof n!=`boolean`&&(n=e.hasAttribute(`data-autoplay`)||!!W(e,`.slide-background`)),n&&typeof e.play==`function`){if(t&&!e.muted)return;e.readyState>1?this.startEmbeddedMedia({target:e}):G?(e.addEventListener(`canplay`,this.ensureMobileMediaPlaying),this.playMediaElement(e)):(e.removeEventListener(`loadeddata`,this.startEmbeddedMedia),e.addEventListener(`loadeddata`,this.startEmbeddedMedia))}}),t||(B(e,`iframe[src]`).forEach(e=>{W(e,`.fragment`)&&!W(e,`.fragment.visible`)||this.startEmbeddedIframe({target:e})}),B(e,`iframe[data-src]`).forEach(e=>{W(e,`.fragment`)&&!W(e,`.fragment.visible`)||e.getAttribute(`src`)!==e.getAttribute(`data-src`)&&(e.removeEventListener(`load`,this.startEmbeddedIframe),e.addEventListener(`load`,this.startEmbeddedIframe),e.setAttribute(`src`,e.getAttribute(`data-src`)))}))}}ensureMobileMediaPlaying(e){let t=e.target;typeof t.getVideoPlaybackQuality==`function`&&setTimeout(()=>{let e=t.paused===!1,n=t.getVideoPlaybackQuality().totalVideoFrames;e&&n===0&&(t.load(),t.play())},1e3)}startEmbeddedMedia(e){let t=!!W(e.target,`html`),n=!!W(e.target,`.present`);t&&n&&(e.target.paused||e.target.ended)&&(e.target.currentTime=0,this.playMediaElement(e.target)),e.target.removeEventListener(`loadeddata`,this.startEmbeddedMedia)}playMediaElement(e){let t=e.play();t&&typeof t.catch==`function`&&t.then(()=>{e.muted||(this.allowedToPlayAudio=!0)}).catch(t=>{if(t.name===`NotAllowedError`){if(this.allowedToPlayAudio=!1,e.tagName===`VIDEO`){this.onVideoPlaybackNotAllowed(e);let t=!!W(e,`html`),n=!!W(e,`.present`),r=e.muted;t&&n&&!r&&(e.setAttribute(`data-muted-by-reveal`,`true`),e.muted=!0,e.play().catch(()=>{this.onMutedVideoPlaybackNotAllowed(e)}))}else e.tagName===`AUDIO`&&this.onAudioPlaybackNotAllowed(e)}})}startEmbeddedIframe(e){let t=e.target;if(this.preventIframeAutoFocus(e),t&&t.contentWindow){let n=!!W(e.target,`html`),r=!!W(e.target,`.present`);if(n&&r){let e=this.Reveal.getConfig().autoPlayMedia;typeof e!=`boolean`&&(e=t.hasAttribute(`data-autoplay`)||!!W(t,`.slide-background`)),/youtube\.com\/embed\//.test(t.getAttribute(`src`))&&e?t.contentWindow.postMessage(`{"event":"command","func":"playVideo","args":""}`,`*`):/player\.vimeo\.com\//.test(t.getAttribute(`src`))&&e?t.contentWindow.postMessage(`{"method":"play"}`,`*`):t.contentWindow.postMessage(`slide:start`,`*`)}}}stopEmbeddedContent(e,t={}){t=Te({unloadIframes:!0},t),e&&e.parentNode&&(B(e,`video, audio`).forEach(e=>{!e.hasAttribute(`data-ignore`)&&typeof e.pause==`function`&&(e.setAttribute(`data-paused-by-reveal`,``),e.pause(),G&&e.removeEventListener(`canplay`,this.ensureMobileMediaPlaying))}),B(e,`iframe`).forEach(e=>{e.contentWindow&&e.contentWindow.postMessage(`slide:stop`,`*`),e.removeEventListener(`load`,this.preventIframeAutoFocus),e.removeEventListener(`load`,this.startEmbeddedIframe)}),B(e,`iframe[src*="youtube.com/embed/"]`).forEach(e=>{!e.hasAttribute(`data-ignore`)&&e.contentWindow&&typeof e.contentWindow.postMessage==`function`&&e.contentWindow.postMessage(`{"event":"command","func":"pauseVideo","args":""}`,`*`)}),B(e,`iframe[src*="player.vimeo.com/"]`).forEach(e=>{!e.hasAttribute(`data-ignore`)&&e.contentWindow&&typeof e.contentWindow.postMessage==`function`&&e.contentWindow.postMessage(`{"method":"pause"}`,`*`)}),t.unloadIframes===!0&&B(e,`iframe[data-src]`).forEach(e=>{e.setAttribute(`src`,`about:blank`),e.removeAttribute(`src`)}))}isAllowedToPlayAudio(){return this.allowedToPlayAudio}showPlayOrUnmuteButton(){let e=this.failedAudioPlaybackTargets.size,t=this.failedVideoPlaybackTargets.size,n=this.failedMutedVideoPlaybackTargets.size,r=`Play media`;n>0?r=`Play video`:t>0?r=`Unmute video`:e>0&&(r=`Play audio`),this.mediaPlayButton.textContent=r,this.Reveal.getRevealElement().appendChild(this.mediaPlayButton)}onAudioPlaybackNotAllowed(e){this.failedAudioPlaybackTargets.add(e),this.showPlayOrUnmuteButton(e)}onVideoPlaybackNotAllowed(e){this.failedVideoPlaybackTargets.add(e),this.showPlayOrUnmuteButton()}onMutedVideoPlaybackNotAllowed(e){this.failedMutedVideoPlaybackTargets.add(e),this.showPlayOrUnmuteButton()}resetTemporarilyMutedMedia(){new Set([...this.failedAudioPlaybackTargets,...this.failedVideoPlaybackTargets,...this.failedMutedVideoPlaybackTargets]).forEach(e=>{e.hasAttribute(`data-muted-by-reveal`)&&(e.muted=!1,e.removeAttribute(`data-muted-by-reveal`))})}clearMediaPlaybackErrors(){this.resetTemporarilyMutedMedia(),this.failedAudioPlaybackTargets.clear(),this.failedVideoPlaybackTargets.clear(),this.failedMutedVideoPlaybackTargets.clear(),this.mediaPlayButton.remove()}preventIframeAutoFocus(e){let t=e.target;if(t&&this.Reveal.getConfig().preventIframeAutoFocus){let e=0,n=()=>{document.activeElement===t?document.activeElement.blur():e<1e3&&(e+=100,setTimeout(n,100))};setTimeout(n,100)}}afterSlideChanged(){this.clearMediaPlaybackErrors()}},ze=`.slides section`,Be=`.slides>section`,Ve=`.slides>section.present>section`,He=`.backgrounds>.slide-background`,Ue=/registerPlugin|registerKeyboardShortcut|addKeyBinding|addEventListener|showPreview/,We=`h.v`,Ge=`h/v`,Ke=`c`,qe=`c/t`,Je=class{constructor(e){this.Reveal=e}render(){this.element=document.createElement(`div`),this.element.className=`slide-number`,this.Reveal.getRevealElement().appendChild(this.element)}configure(e,t){let n=`none`;e.slideNumber&&!this.Reveal.isPrintView()&&(e.showSlideNumber===`all`||e.showSlideNumber===`speaker`&&this.Reveal.isSpeakerNotes())&&(n=`block`),this.element.style.display=n}update(){this.Reveal.getConfig().slideNumber&&this.element&&(this.element.innerHTML=this.getSlideNumber())}getSlideNumber(e=this.Reveal.getCurrentSlide()){let t=this.Reveal.getConfig(),n,r=We;if(typeof t.slideNumber==`function`)n=t.slideNumber(e);else{typeof t.slideNumber==`string`&&(r=t.slideNumber),!/c/.test(r)&&this.Reveal.getHorizontalSlides().length===1&&(r=Ke);let i=e&&e.dataset.visibility===`uncounted`?0:1;switch(n=[],r){case Ke:n.push(this.Reveal.getSlidePastCount(e)+i);break;case qe:n.push(this.Reveal.getSlidePastCount(e)+i,`/`,this.Reveal.getTotalSlides());break;default:let t=this.Reveal.getIndices(e);n.push(t.h+i);let a=r===Ge?`/`:`.`;this.Reveal.isVerticalSlide(e)&&n.push(a,t.v+1)}}let i=`#`+this.Reveal.location.getHash(e);return this.formatNumber(n[0],n[1],n[2],i)}formatNumber(e,t,n,r=`#`+this.Reveal.location.getHash()){return typeof n==`number`&&!isNaN(n)?`<a href="${r}">
2
2
  <span class="slide-number-a">${e}</span>
3
3
  <span class="slide-number-delimiter">${t}</span>
4
4
  <span class="slide-number-b">${n}</span>
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,l as n}from"./useEvent-xfs0Sn4r.js";import{t as r}from"./react-CBDbhulC.js";import{D as i,_o as a,g as o,x as s}from"./cells-Cp-G34Rz.js";import{t as c}from"./compiler-runtime-CYIjoINj.js";import{w as l}from"./utils-D5Ywm7-q.js";import{n as u}from"./constants-BDbGiS7O.js";import{l as d,m as f,v as p}from"./config-BlNM0caL.js";import{h as m,p as h}from"./readonly-python-code-DpIyjHqY.js";import{t as g}from"./cn-ldLVeaqm.js";import{t as _}from"./jsx-runtime-B74pBk57.js";import{i as v,n as y,r as b,t as x}from"./tabs-Cy1qXLzH.js";import{I as S,Lt as C}from"./JsonOutput-Bgxc9G7d.js";import{n as w}from"./download-DMxOzI7b.js";import{n as T,t as E}from"./button-Dh8EwhsF.js";import{r as D}from"./requests-C6_IaFh7.js";import{u as O}from"./layout-CC2AHMrW.js";import{t as k}from"./arrow-left-DrqK6gPp.js";import{t as A}from"./copy-BMXKNElG.js";import{d as j,i as M,l as N,n as P,r as F,t as I,u as L}from"./panels-BsXw4GTa.js";import{E as R,M as z,O as B,T as ee,j as te,w as V}from"./write-secret-modal-D6zoZgLY.js";import{t as H}from"./spinner-Ck-Hgfvj.js";import{t as U}from"./use-toast-DpWHUGuF.js";import{n as W}from"./paths-zcL04qUW.js";import{t as G}from"./session-Sz5nSFku.js";import{n as K}from"./copy-DlEomWzI.js";import{t as q}from"./share-CPtBiNgr.js";import{a as J}from"./cell-link-6burT2XF.js";import{n as Y,t as X}from"./react-resizable-panels.browser.esm-BSRAHC4P.js";import{t as ne}from"./shell-DLpUCctE.js";import{n as re,t as ie}from"./marimo-icons-C3KxMV9A.js";var Z=c(),ae=e(r(),1),Q=_(),oe=t(e=>e(o)||!f(e(p).state)),se=e=>{let t=(0,Z.c)(21),{appConfig:r,hideHeader:a}=e,{setCells:o}=i(),{sendComponentValues:c}=D(),l;t[0]===c?l=t[1]:(l=()=>(F.INSTANCE.start(c),ce),t[0]=c,t[1]=l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[2]=u):u=t[2],(0,ae.useEffect)(l,u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=G(),t[3]=d):d=t[3];let f;t[4]===o?f=t[5]:(f={autoInstantiate:!0,setCells:o,sessionId:d},t[4]=o,t[5]=f);let{connection:p,reconnect:m}=P(f),h=n(s),_;if(t[6]===Symbol.for(`react.memo_cache_sentinel`)){bb0:{if(typeof window>`u`){_=null;break bb0}let e=new URL(window.location.href);if(!e.searchParams.has(`file`)){_=null;break bb0}e.searchParams.delete(`file`);let t=e.searchParams.toString();_=t?`${e.pathname}?${t}`:e.pathname}t[6]=_}else _=t[6];let v=_,y=a?`hidden`:`sm:pt-8`,b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=v&&(0,Q.jsx)(`div`,{className:`flex items-center px-6 pt-4 sm:-mt-8`,children:(0,Q.jsxs)(`a`,{href:v,"aria-label":`Back to gallery`,className:g(T({variant:`text`,size:`sm`}),`gap-2 px-0 text-muted-foreground hover:text-foreground`),children:[(0,Q.jsx)(k,{className:`size-4`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:`Back`})]})}),t[7]=b):b=t[7];let x;t[8]!==p||t[9]!==y?(x=(0,Q.jsx)(j,{connection:p,className:y,children:b}),t[8]=p,t[9]=y,t[10]=x):x=t[10];let S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(H,{className:`mx-auto`}),(0,Q.jsx)(`p`,{className:`text-center text-sm text-muted-foreground mt-2`,children:`Connecting...`})]}),t[11]=S):S=t[11];let C;t[12]===r?C=t[13]:(C=(0,Q.jsx)(L,{requires:oe,delay:2e3,fallback:S,children:(0,Q.jsx)(M,{appConfig:r,mode:`read`})}),t[12]=r,t[13]=C);let w;return t[14]!==r.width||t[15]!==p||t[16]!==h||t[17]!==m||t[18]!==C||t[19]!==x?(w=(0,Q.jsxs)(N,{connection:p,isRunning:h,width:r.width,onReconnect:m,children:[x,C]}),t[14]=r.width,t[15]=p,t[16]=h,t[17]=m,t[18]=C,t[19]=x,t[20]=w):w=t[20],w};function ce(){F.INSTANCE.stop()}var le=()=>{let e=(0,Z.c)(3),t=n(a);if(!d()||!t)return null;let r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsxs)(`span`,{children:[`Static`,` `,(0,Q.jsx)(`a`,{href:u.githubPage,target:`_blank`,className:`text-(--sky-11) font-medium underline`,children:`marimo`}),` `,`notebook - Run or edit for full interactivity`]}),e[0]=r):r=e[0];let i;return e[1]===t?i=e[2]:(i=(0,Q.jsxs)(`div`,{className:`px-4 py-2 bg-(--sky-2) border-b border-(--sky-7) text-(--sky-11) flex justify-between items-center gap-4 print:hidden text-sm`,"data-testid":`static-notebook-banner`,children:[r,(0,Q.jsx)(`span`,{className:`shrink-0`,children:(0,Q.jsx)(ue,{code:t})})]}),e[1]=t,e[2]=i),i},ue=e=>{let t=(0,Z.c)(44),{code:n}=e,r=W.basename(J()||`notebook.py`),[i]=l(),a=i.sharing?.molab??!0,o=de(window.location.href,r),s=o!==r,c=ne(o),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(z,{asChild:!0,children:(0,Q.jsx)(E,{"data-testid":`static-notebook-dialog-trigger`,variant:`outline`,size:`xs`,children:`Run or Edit`})}),t[0]=d):d=t[0];let f;t[1]===r?f=t[2]:(f=(0,Q.jsx)(te,{children:r}),t[1]=r,t[2]=f);let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`a`,{href:u.githubPage,target:`_blank`,className:`text-(--sky-11) hover:underline font-medium`,children:`marimo`}),t[3]=p):p=t[3];let m=s?`Run it`:`Download it, then run it`,h;t[4]===m?h=t[5]:(h=(0,Q.jsxs)(`p`,{children:[`This is a static`,` `,p,` `,`notebook. `,m,` `,`locally for full interactivity.`]}),t[4]=m,t[5]=h);let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsxs)(b,{"aria-label":`Package manager`,children:[(0,Q.jsx)(v,{value:`uv`,children:`uv`}),(0,Q.jsx)(v,{value:`pip`,children:`pip`}),(0,Q.jsx)(v,{value:`conda`,children:`conda`})]}),t[6]=g):g=t[6];let _=`uvx marimo edit --sandbox ${c}`,S;t[7]===_?S=t[8]:(S=(0,Q.jsx)(y,{value:`uv`,children:(0,Q.jsx)($,{command:_})}),t[7]=_,t[8]=S);let T=`pip install marimo\nmarimo edit ${c}`,D;t[9]===T?D=t[10]:(D=(0,Q.jsx)(y,{value:`pip`,children:(0,Q.jsx)($,{command:T})}),t[9]=T,t[10]=D);let O=`conda install -c conda-forge marimo\nmarimo edit ${c}`,k;t[11]===O?k=t[12]:(k=(0,Q.jsx)(y,{value:`conda`,children:(0,Q.jsx)($,{command:O})}),t[11]=O,t[12]=k);let j;t[13]!==D||t[14]!==k||t[15]!==S?(j=(0,Q.jsxs)(x,{defaultValue:`uv`,children:[g,S,D,k]}),t[13]=D,t[14]=k,t[15]=S,t[16]=j):j=t[16];let M;t[17]!==n||t[18]!==a?(M=a&&(0,Q.jsx)(fe,{code:n}),t[17]=n,t[18]=a,t[19]=M):M=t[19];let N;t[20]!==j||t[21]!==M||t[22]!==h?(N=(0,Q.jsx)(R,{asChild:!0,children:(0,Q.jsxs)(`div`,{className:`pt-3 text-left space-y-3`,children:[h,j,M]})}),t[20]=j,t[21]=M,t[22]=h,t[23]=N):N=t[23];let P;t[24]!==N||t[25]!==f?(P=(0,Q.jsxs)(B,{children:[f,N]}),t[24]=N,t[25]=f,t[26]=P):P=t[26];let F;t[27]===n?F=t[28]:(F=async()=>{await K(n),U({title:`Copied to clipboard`})},t[27]=n,t[28]=F);let I;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(A,{className:`w-3 h-3 mr-2`}),t[29]=I):I=t[29];let L;t[30]===F?L=t[31]:(L=(0,Q.jsxs)(E,{"data-testid":`copy-static-notebook-dialog-button`,variant:`outline`,size:`sm`,onClick:F,children:[I,`Copy code`]}),t[30]=F,t[31]=L);let H;t[32]!==n||t[33]!==r?(H=()=>{w(new Blob([n],{type:`text/plain`}),r)},t[32]=n,t[33]=r,t[34]=H):H=t[34];let G;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Q.jsx)(C,{className:`w-3 h-3 mr-2`}),t[35]=G):G=t[35];let q;t[36]===H?q=t[37]:(q=(0,Q.jsxs)(E,{"data-testid":`download-static-notebook-dialog-button`,variant:`outline`,size:`sm`,onClick:H,children:[G,`Download`]}),t[36]=H,t[37]=q);let Y;t[38]!==L||t[39]!==q?(Y=(0,Q.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[L,q]}),t[38]=L,t[39]=q,t[40]=Y):Y=t[40];let X;return t[41]!==P||t[42]!==Y?(X=(0,Q.jsxs)(V,{children:[d,(0,Q.jsxs)(ee,{children:[P,Y]})]}),t[41]=P,t[42]=Y,t[43]=X):X=t[43],X};function de(e,t){let n=new URL(e);if(n.protocol!==`http:`&&n.protocol!==`https:`)return t;let r=n.pathname.endsWith(`.html`)&&n.search===``,i=n.protocol===`https:`&&(n.hostname===`marimo.app`||n.hostname===`links.marimo.app`||n.hostname===`static.marimo.app`&&n.pathname.startsWith(`/static`)||n.pathname.includes(`/notebooks/nb`));return!r&&!i?t:(n.hash=``,n.href)}var $=e=>{let t=(0,Z.c)(10),{command:n}=e,r;t[0]===n?r=t[1]:(r=(0,Q.jsx)(`pre`,{className:`p-3 pr-10 font-mono text-(--sky-11) leading-relaxed whitespace-pre-wrap break-all`,children:n}),t[0]=n,t[1]=r);let i;t[2]===n?i=t[3]:(i=async()=>{await K(n),U({title:`Command copied to clipboard`})},t[2]=n,t[3]=i);let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(A,{className:`w-3.5 h-3.5`}),t[4]=a):a=t[4];let o;t[5]===i?o=t[6]:(o=(0,Q.jsx)(E,{"aria-label":`Copy command`,className:`absolute right-2 top-2`,variant:`ghost`,size:`icon`,onClick:i,children:a}),t[5]=i,t[6]=o);let s;return t[7]!==r||t[8]!==o?(s=(0,Q.jsxs)(`div`,{className:`relative rounded-lg border bg-(--sky-2) border-(--sky-7)`,children:[r,o]}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s},fe=e=>{let t=(0,Z.c)(8),{code:n}=e,r;t[0]===n?r=t[1]:(r=q({code:n,baseUrl:`${u.molab}/new`}),t[0]=n,t[1]=r);let i=r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(re,{size:12,strokeWidth:1.5,className:`mr-1.5 mt-px text-(--grass-11)`}),t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,Q.jsx)(E,{asChild:!0,variant:`outline`,size:`xs`,className:`shrink-0`,children:(0,Q.jsxs)(`a`,{href:i,target:`_blank`,rel:`noopener noreferrer`,children:[a,`Open in molab`]})}),t[3]=i,t[4]=o);let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsxs)(`p`,{className:`text-sm text-(--sky-12)`,children:[`Run this notebook in `,(0,Q.jsx)(`span`,{className:`font-semibold`,children:`molab`}),`, marimo's cloud-hosted notebook platform.`]}),t[5]=s):s=t[5];let c;return t[6]===o?c=t[7]:(c=(0,Q.jsxs)(`div`,{className:`pt-3 border-t flex gap-2 items-center`,children:[o,s]}),t[6]=o,t[7]=c),c},pe=e=>{let t=(0,Z.c)(17),r=n(O).kind,i=r===`static`||r===`wasm`,{selectedLayout:a}=m(),o;t[0]===a?o=t[1]:(o=h({selectedLayout:a,isReading:!0,searchParams:new URLSearchParams(window.location.search)}),t[0]=a,t[1]=o);let s=i&&o===`slides`,c;t[2]===s?c=t[3]:(c=!s&&(0,Q.jsx)(le,{}),t[2]=s,t[3]=c);let l;t[4]!==s||t[5]!==e.appConfig?(l=(0,Q.jsx)(se,{appConfig:e.appConfig,hideHeader:s}),t[4]=s,t[5]=e.appConfig,t[6]=l):l=t[6];let u;t[7]!==i||t[8]!==s?(u=i&&!s&&(0,Q.jsx)(me,{}),t[7]=i,t[8]=s,t[9]=u):u=t[9];let d;t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,Q.jsxs)(X,{children:[c,l,u]}),t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(S,{}),t[14]=f):f=t[14];let p;return t[15]===d?p=t[16]:(p=(0,Q.jsx)(I,{children:(0,Q.jsxs)(Y,{direction:`horizontal`,autoSaveId:`marimo:chrome:v1:run1`,children:[d,f]})}),t[15]=d,t[16]=p),p},me=()=>{let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:`fixed bottom-0 right-0 z-50 print:hidden`,"data-testid":`watermark`,children:(0,Q.jsxs)(`a`,{href:u.githubPage,target:`_blank`,className:`text-sm text-(--grass-11) font-bold tracking-wide transition-colors bg-(--grass-4) hover:bg-(--grass-5) border-t border-l border-(--grass-8) px-3 py-1 rounded-tl-md flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{children:`made with marimo`}),(0,Q.jsx)(ie,{className:`h-4 w-auto`})]})}),e[0]=t):t=e[0],t};export{pe as default};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,l as n}from"./useEvent-xfs0Sn4r.js";import{t as r}from"./react-CBDbhulC.js";import{D as i,_o as a,g as o,x as s}from"./cells-Cp-G34Rz.js";import{t as c}from"./compiler-runtime-CYIjoINj.js";import{w as l}from"./utils-D5Ywm7-q.js";import{n as u}from"./constants-BDbGiS7O.js";import{l as d,m as f,v as p}from"./config-BlNM0caL.js";import{h as m,p as h}from"./readonly-python-code-DpIyjHqY.js";import{t as g}from"./cn-ldLVeaqm.js";import{t as _}from"./jsx-runtime-B74pBk57.js";import{i as v,n as y,r as b,t as x}from"./tabs-Cy1qXLzH.js";import{I as S,Lt as C}from"./JsonOutput-CzIGPEZQ.js";import{n as w}from"./download-DMxOzI7b.js";import{n as T,t as E}from"./button-Dh8EwhsF.js";import{r as D}from"./requests-C6_IaFh7.js";import{u as O}from"./layout-DWnrxIo2.js";import{t as k}from"./arrow-left-DrqK6gPp.js";import{t as A}from"./copy-BMXKNElG.js";import{d as j,i as M,l as N,n as P,r as F,t as I,u as L}from"./panels-CWn0Yh1D.js";import{E as R,M as z,O as B,T as ee,j as te,w as V}from"./write-secret-modal-D6zoZgLY.js";import{t as H}from"./spinner-Ck-Hgfvj.js";import{t as U}from"./use-toast-DpWHUGuF.js";import{n as W}from"./paths-zcL04qUW.js";import{t as G}from"./session-Sz5nSFku.js";import{n as K}from"./copy-DlEomWzI.js";import{t as q}from"./share-CPtBiNgr.js";import{a as J}from"./cell-link-6burT2XF.js";import{n as Y,t as X}from"./react-resizable-panels.browser.esm-BSRAHC4P.js";import{t as ne}from"./shell-DLpUCctE.js";import{n as re,t as ie}from"./marimo-icons-C3KxMV9A.js";var Z=c(),ae=e(r(),1),Q=_(),oe=t(e=>e(o)||!f(e(p).state)),se=e=>{let t=(0,Z.c)(21),{appConfig:r,hideHeader:a}=e,{setCells:o}=i(),{sendComponentValues:c}=D(),l;t[0]===c?l=t[1]:(l=()=>(F.INSTANCE.start(c),ce),t[0]=c,t[1]=l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[2]=u):u=t[2],(0,ae.useEffect)(l,u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=G(),t[3]=d):d=t[3];let f;t[4]===o?f=t[5]:(f={autoInstantiate:!0,setCells:o,sessionId:d},t[4]=o,t[5]=f);let{connection:p,reconnect:m}=P(f),h=n(s),_;if(t[6]===Symbol.for(`react.memo_cache_sentinel`)){bb0:{if(typeof window>`u`){_=null;break bb0}let e=new URL(window.location.href);if(!e.searchParams.has(`file`)){_=null;break bb0}e.searchParams.delete(`file`);let t=e.searchParams.toString();_=t?`${e.pathname}?${t}`:e.pathname}t[6]=_}else _=t[6];let v=_,y=a?`hidden`:`sm:pt-8`,b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=v&&(0,Q.jsx)(`div`,{className:`flex items-center px-6 pt-4 sm:-mt-8`,children:(0,Q.jsxs)(`a`,{href:v,"aria-label":`Back to gallery`,className:g(T({variant:`text`,size:`sm`}),`gap-2 px-0 text-muted-foreground hover:text-foreground`),children:[(0,Q.jsx)(k,{className:`size-4`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:`Back`})]})}),t[7]=b):b=t[7];let x;t[8]!==p||t[9]!==y?(x=(0,Q.jsx)(j,{connection:p,className:y,children:b}),t[8]=p,t[9]=y,t[10]=x):x=t[10];let S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(H,{className:`mx-auto`}),(0,Q.jsx)(`p`,{className:`text-center text-sm text-muted-foreground mt-2`,children:`Connecting...`})]}),t[11]=S):S=t[11];let C;t[12]===r?C=t[13]:(C=(0,Q.jsx)(L,{requires:oe,delay:2e3,fallback:S,children:(0,Q.jsx)(M,{appConfig:r,mode:`read`})}),t[12]=r,t[13]=C);let w;return t[14]!==r.width||t[15]!==p||t[16]!==h||t[17]!==m||t[18]!==C||t[19]!==x?(w=(0,Q.jsxs)(N,{connection:p,isRunning:h,width:r.width,onReconnect:m,children:[x,C]}),t[14]=r.width,t[15]=p,t[16]=h,t[17]=m,t[18]=C,t[19]=x,t[20]=w):w=t[20],w};function ce(){F.INSTANCE.stop()}var le=()=>{let e=(0,Z.c)(3),t=n(a);if(!d()||!t)return null;let r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsxs)(`span`,{children:[`Static`,` `,(0,Q.jsx)(`a`,{href:u.githubPage,target:`_blank`,className:`text-(--sky-11) font-medium underline`,children:`marimo`}),` `,`notebook - Run or edit for full interactivity`]}),e[0]=r):r=e[0];let i;return e[1]===t?i=e[2]:(i=(0,Q.jsxs)(`div`,{className:`px-4 py-2 bg-(--sky-2) border-b border-(--sky-7) text-(--sky-11) flex justify-between items-center gap-4 print:hidden text-sm`,"data-testid":`static-notebook-banner`,children:[r,(0,Q.jsx)(`span`,{className:`shrink-0`,children:(0,Q.jsx)(ue,{code:t})})]}),e[1]=t,e[2]=i),i},ue=e=>{let t=(0,Z.c)(44),{code:n}=e,r=W.basename(J()||`notebook.py`),[i]=l(),a=i.sharing?.molab??!0,o=de(window.location.href,r),s=o!==r,c=ne(o),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(z,{asChild:!0,children:(0,Q.jsx)(E,{"data-testid":`static-notebook-dialog-trigger`,variant:`outline`,size:`xs`,children:`Run or Edit`})}),t[0]=d):d=t[0];let f;t[1]===r?f=t[2]:(f=(0,Q.jsx)(te,{children:r}),t[1]=r,t[2]=f);let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`a`,{href:u.githubPage,target:`_blank`,className:`text-(--sky-11) hover:underline font-medium`,children:`marimo`}),t[3]=p):p=t[3];let m=s?`Run it`:`Download it, then run it`,h;t[4]===m?h=t[5]:(h=(0,Q.jsxs)(`p`,{children:[`This is a static`,` `,p,` `,`notebook. `,m,` `,`locally for full interactivity.`]}),t[4]=m,t[5]=h);let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsxs)(b,{"aria-label":`Package manager`,children:[(0,Q.jsx)(v,{value:`uv`,children:`uv`}),(0,Q.jsx)(v,{value:`pip`,children:`pip`}),(0,Q.jsx)(v,{value:`conda`,children:`conda`})]}),t[6]=g):g=t[6];let _=`uvx marimo edit --sandbox ${c}`,S;t[7]===_?S=t[8]:(S=(0,Q.jsx)(y,{value:`uv`,children:(0,Q.jsx)($,{command:_})}),t[7]=_,t[8]=S);let T=`pip install marimo\nmarimo edit ${c}`,D;t[9]===T?D=t[10]:(D=(0,Q.jsx)(y,{value:`pip`,children:(0,Q.jsx)($,{command:T})}),t[9]=T,t[10]=D);let O=`conda install -c conda-forge marimo\nmarimo edit ${c}`,k;t[11]===O?k=t[12]:(k=(0,Q.jsx)(y,{value:`conda`,children:(0,Q.jsx)($,{command:O})}),t[11]=O,t[12]=k);let j;t[13]!==D||t[14]!==k||t[15]!==S?(j=(0,Q.jsxs)(x,{defaultValue:`uv`,children:[g,S,D,k]}),t[13]=D,t[14]=k,t[15]=S,t[16]=j):j=t[16];let M;t[17]!==n||t[18]!==a?(M=a&&(0,Q.jsx)(fe,{code:n}),t[17]=n,t[18]=a,t[19]=M):M=t[19];let N;t[20]!==j||t[21]!==M||t[22]!==h?(N=(0,Q.jsx)(R,{asChild:!0,children:(0,Q.jsxs)(`div`,{className:`pt-3 text-left space-y-3`,children:[h,j,M]})}),t[20]=j,t[21]=M,t[22]=h,t[23]=N):N=t[23];let P;t[24]!==N||t[25]!==f?(P=(0,Q.jsxs)(B,{children:[f,N]}),t[24]=N,t[25]=f,t[26]=P):P=t[26];let F;t[27]===n?F=t[28]:(F=async()=>{await K(n),U({title:`Copied to clipboard`})},t[27]=n,t[28]=F);let I;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(A,{className:`w-3 h-3 mr-2`}),t[29]=I):I=t[29];let L;t[30]===F?L=t[31]:(L=(0,Q.jsxs)(E,{"data-testid":`copy-static-notebook-dialog-button`,variant:`outline`,size:`sm`,onClick:F,children:[I,`Copy code`]}),t[30]=F,t[31]=L);let H;t[32]!==n||t[33]!==r?(H=()=>{w(new Blob([n],{type:`text/plain`}),r)},t[32]=n,t[33]=r,t[34]=H):H=t[34];let G;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Q.jsx)(C,{className:`w-3 h-3 mr-2`}),t[35]=G):G=t[35];let q;t[36]===H?q=t[37]:(q=(0,Q.jsxs)(E,{"data-testid":`download-static-notebook-dialog-button`,variant:`outline`,size:`sm`,onClick:H,children:[G,`Download`]}),t[36]=H,t[37]=q);let Y;t[38]!==L||t[39]!==q?(Y=(0,Q.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[L,q]}),t[38]=L,t[39]=q,t[40]=Y):Y=t[40];let X;return t[41]!==P||t[42]!==Y?(X=(0,Q.jsxs)(V,{children:[d,(0,Q.jsxs)(ee,{children:[P,Y]})]}),t[41]=P,t[42]=Y,t[43]=X):X=t[43],X};function de(e,t){let n=new URL(e);if(n.protocol!==`http:`&&n.protocol!==`https:`)return t;let r=n.pathname.endsWith(`.html`)&&n.search===``,i=n.protocol===`https:`&&(n.hostname===`marimo.app`||n.hostname===`links.marimo.app`||n.hostname===`static.marimo.app`&&n.pathname.startsWith(`/static`)||n.pathname.includes(`/notebooks/nb`));return!r&&!i?t:(n.hash=``,n.href)}var $=e=>{let t=(0,Z.c)(10),{command:n}=e,r;t[0]===n?r=t[1]:(r=(0,Q.jsx)(`pre`,{className:`p-3 pr-10 font-mono text-(--sky-11) leading-relaxed whitespace-pre-wrap break-all`,children:n}),t[0]=n,t[1]=r);let i;t[2]===n?i=t[3]:(i=async()=>{await K(n),U({title:`Command copied to clipboard`})},t[2]=n,t[3]=i);let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(A,{className:`w-3.5 h-3.5`}),t[4]=a):a=t[4];let o;t[5]===i?o=t[6]:(o=(0,Q.jsx)(E,{"aria-label":`Copy command`,className:`absolute right-2 top-2`,variant:`ghost`,size:`icon`,onClick:i,children:a}),t[5]=i,t[6]=o);let s;return t[7]!==r||t[8]!==o?(s=(0,Q.jsxs)(`div`,{className:`relative rounded-lg border bg-(--sky-2) border-(--sky-7)`,children:[r,o]}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s},fe=e=>{let t=(0,Z.c)(8),{code:n}=e,r;t[0]===n?r=t[1]:(r=q({code:n,baseUrl:`${u.molab}/new`}),t[0]=n,t[1]=r);let i=r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(re,{size:12,strokeWidth:1.5,className:`mr-1.5 mt-px text-(--grass-11)`}),t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,Q.jsx)(E,{asChild:!0,variant:`outline`,size:`xs`,className:`shrink-0`,children:(0,Q.jsxs)(`a`,{href:i,target:`_blank`,rel:`noopener noreferrer`,children:[a,`Open in molab`]})}),t[3]=i,t[4]=o);let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsxs)(`p`,{className:`text-sm text-(--sky-12)`,children:[`Run this notebook in `,(0,Q.jsx)(`span`,{className:`font-semibold`,children:`molab`}),`, marimo's cloud-hosted notebook platform.`]}),t[5]=s):s=t[5];let c;return t[6]===o?c=t[7]:(c=(0,Q.jsxs)(`div`,{className:`pt-3 border-t flex gap-2 items-center`,children:[o,s]}),t[6]=o,t[7]=c),c},pe=e=>{let t=(0,Z.c)(17),r=n(O).kind,i=r===`static`||r===`wasm`,{selectedLayout:a}=m(),o;t[0]===a?o=t[1]:(o=h({selectedLayout:a,isReading:!0,searchParams:new URLSearchParams(window.location.search)}),t[0]=a,t[1]=o);let s=i&&o===`slides`,c;t[2]===s?c=t[3]:(c=!s&&(0,Q.jsx)(le,{}),t[2]=s,t[3]=c);let l;t[4]!==s||t[5]!==e.appConfig?(l=(0,Q.jsx)(se,{appConfig:e.appConfig,hideHeader:s}),t[4]=s,t[5]=e.appConfig,t[6]=l):l=t[6];let u;t[7]!==i||t[8]!==s?(u=i&&!s&&(0,Q.jsx)(me,{}),t[7]=i,t[8]=s,t[9]=u):u=t[9];let d;t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,Q.jsxs)(X,{children:[c,l,u]}),t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(S,{}),t[14]=f):f=t[14];let p;return t[15]===d?p=t[16]:(p=(0,Q.jsx)(I,{children:(0,Q.jsxs)(Y,{direction:`horizontal`,autoSaveId:`marimo:chrome:v1:run1`,children:[d,f]})}),t[15]=d,t[16]=p),p},me=()=>{let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:`fixed bottom-0 right-0 z-50 print:hidden`,"data-testid":`watermark`,children:(0,Q.jsxs)(`a`,{href:u.githubPage,target:`_blank`,className:`text-sm text-(--grass-11) font-bold tracking-wide transition-colors bg-(--grass-4) hover:bg-(--grass-5) border-t border-l border-(--grass-8) px-3 py-1 rounded-tl-md flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{children:`made with marimo`}),(0,Q.jsx)(ie,{className:`h-4 w-auto`})]})}),e[0]=t):t=e[0],t};export{pe as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as ee,t as r,u as te}from"./useEvent-xfs0Sn4r.js";import{t as i}from"./react-CBDbhulC.js";import{Co as a,D as ne,Fo as o,I as re,Po as ie,Wt as ae,ii as s}from"./cells-Cp-G34Rz.js";import{t as c}from"./compiler-runtime-CYIjoINj.js";import{w as oe}from"./utils-D5Ywm7-q.js";import{_ as se}from"./useEventListener-92uWqz-P.js";import{t as ce}from"./constants-BDbGiS7O.js";import{t as le}from"./cn-ldLVeaqm.js";import{t as l}from"./jsx-runtime-B74pBk57.js";import{n as ue}from"./JsonOutput-Bgxc9G7d.js";import{t as u}from"./tooltip-BUtPzKB4.js";import{t as d}from"./button-Dh8EwhsF.js";import{r as de}from"./requests-C6_IaFh7.js";import{t as f}from"./createLucideIcon-B7HeEoG2.js";import{d as fe}from"./layout-CC2AHMrW.js";import{n as pe,t as me}from"./LazyAnyLanguageCodeMirror-LboTfNDv.js";import{u as he}from"./toDate-hGYJX0Ha.js";import{t as ge}from"./cell-editor-QmA8u1Ay.js";import{t as _e}from"./spinner-Ck-Hgfvj.js";import{i as ve}from"./useDeleteCell-Bz49_cFj.js";import{r as ye}from"./useTheme-C-ri8BtY.js";import{n as be,r as xe,t as Se}from"./react-resizable-panels.browser.esm-BSRAHC4P.js";import{a as Ce}from"./renderShortcut-X-CJUSM8.js";import{n as we,r as Te}from"./panel-context-CiVjnt80.js";import{t as Ee}from"./kiosk-mode-mxgb5lWf.js";var De=f(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),Oe=f(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),p=e(i(),1),ke=c(),m=15,h=a(`marimo:scratchpadHistory:v1`,[],s),Ae=n(!1),je=n(null,(e,t,n)=>{if(n=n.trim(),!n)return;let ee=e(h);t(h,[n,...ee.filter(e=>e!==n)].slice(0,m))}),g=l(),Me={hide_code:!1,disabled:!1},_=()=>{let e=(0,ke.c)(60),n=re(),[i]=oe(),{theme:a}=ye(),s=(0,p.useRef)(null),c=ae(),{createNewCell:l,updateCellCode:f}=ne(),{sendRunScratchpad:m}=de(),_=we(),v=Te(),y=n.cellRuntime[o],b=y?.output,x=y?.status,S=y?.consoleOutputs,C=n.cellData.__scratch__?.code??``,w=te(je),[T,E]=t(Ae),D=ee(h),O;e[0]!==w||e[1]!==C||e[2]!==m?(O=()=>{m({code:C}),w(C)},e[0]=w,e[1]=C,e[2]=m,e[3]=O):O=e[3];let k=r(O),A;e[4]!==C||e[5]!==l||e[6]!==c?(A=()=>{C.trim()&&l({code:C,before:!1,cellId:c??`__end__`})},e[4]=C,e[5]=l,e[6]=c,e[7]=A):A=e[7];let j=r(A),M;e[8]!==m||e[9]!==f?(M=()=>{f({cellId:o,code:``,formattingChange:!1}),m({code:``});let e=s.current;e&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:``}})},e[8]=m,e[9]=f,e[10]=M):M=e[10];let N=r(M),P;e[11]!==E||e[12]!==f?(P=e=>{E(!1),f({cellId:o,code:e,formattingChange:!1});let t=s.current;t&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},e[11]=E,e[12]=f,e[13]=P):P=e[13];let F=r(P),[I,Ne]=(0,p.useState)(),L;e[14]!==F||e[15]!==D||e[16]!==T||e[17]!==a?(L=()=>T?(0,g.jsx)(`div`,{className:`absolute inset-0 z-100 bg-background p-3 border-none overflow-auto`,children:(0,g.jsx)(`div`,{className:`overflow-auto flex flex-col gap-3`,children:D.map((e,t)=>(0,g.jsx)(`div`,{className:`border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden`,onClick:()=>F(e),children:(0,g.jsx)(p.Suspense,{children:(0,g.jsx)(me,{language:`python`,theme:a,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:e.trim(),editable:!1,readOnly:!0})})},t))})}):null,e[14]=F,e[15]=D,e[16]=T,e[17]=a,e[18]=L):L=e[18];let R=L,z;e[19]!==N||e[20]!==j||e[21]!==k||e[22]!==D.length||e[23]!==T||e[24]!==E||e[25]!==x?(z=()=>(0,g.jsxs)(`div`,{className:`flex items-center shrink-0 border-b`,children:[(0,g.jsx)(u,{content:Ce(`cell.run`),children:(0,g.jsx)(d,{"data-testid":`scratchpad-run-button`,onClick:k,disabled:T,variant:`text`,size:`xs`,children:(0,g.jsx)(ve,{color:`var(--grass-11)`,size:16})})}),(0,g.jsx)(u,{content:`Clear code and outputs`,children:(0,g.jsx)(d,{disabled:T,size:`xs`,variant:`text`,onClick:N,children:(0,g.jsx)(De,{size:16})})}),(0,g.jsx)(Ee,{children:(0,g.jsx)(u,{content:`Insert code`,children:(0,g.jsx)(d,{disabled:T,size:`xs`,variant:`text`,onClick:j,children:(0,g.jsx)(pe,{size:16})})})}),(x===`running`||x===`queued`)&&(0,g.jsx)(_e,{className:`inline`,size:`small`}),(0,g.jsx)(`div`,{className:`flex-1`}),(0,g.jsx)(u,{content:`Toggle history`,children:(0,g.jsx)(d,{size:`xs`,variant:`text`,className:le(T&&`bg-(--sky-3) rounded-none`),onClick:()=>E(!T),disabled:D.length===0,children:(0,g.jsx)(Oe,{size:16})})}),(0,g.jsx)(u,{content:(0,g.jsx)(`span`,{className:`block max-w-prose`,children:`Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file.`}),children:(0,g.jsx)(d,{size:`xs`,variant:`text`,children:(0,g.jsx)(he,{size:16})})})]}),e[19]=N,e[20]=j,e[21]=k,e[22]=D.length,e[23]=T,e[24]=E,e[25]=x,e[26]=z):z=e[26];let B=z,Pe=_===`vertical`,V;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(V=ie.create(o),e[27]=V):V=e[27];let H;e[28]===B?H=e[29]:(H=B(),e[28]=B,e[29]=H);let U;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>{s.current=e},e[30]=U):U=e[30];let W;e[31]!==C||e[32]!==k||e[33]!==I||e[34]!==a||e[35]!==i?(W=(0,g.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,g.jsx)(ge,{theme:a,showPlaceholder:!1,id:o,code:C,config:Me,status:`idle`,serializedEditorState:null,runCell:k,userConfig:i,editorViewRef:s,setEditorView:U,hidden:!1,showHiddenCode:se.NOOP,languageAdapter:I,setLanguageAdapter:Ne})}),e[31]=C,e[32]=k,e[33]=I,e[34]=a,e[35]=i,e[36]=W):W=e[36];let G;e[37]===R?G=e[38]:(G=R(),e[37]=R,e[38]=G);let K;e[39]!==G||e[40]!==H||e[41]!==W?(K=(0,g.jsx)(Se,{defaultSize:40,minSize:20,maxSize:70,children:(0,g.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden relative`,children:[H,W,G]})}),e[39]=G,e[40]=H,e[41]=W,e[42]=K):K=e[42];let q=Pe?`h-1`:`w-1`,J;e[43]===q?J=e[44]:(J=le(`bg-border hover:bg-primary/50 transition-colors`,q),e[43]=q,e[44]=J);let Y;e[45]===J?Y=e[46]:(Y=(0,g.jsx)(xe,{className:J}),e[45]=J,e[46]=Y);let X;e[47]===b?X=e[48]:(X=(0,g.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,g.jsx)(ue,{allowExpand:!1,output:b,className:ce.outputArea,cellId:o,stale:!1,loading:!1})}),e[47]=b,e[48]=X);let Z;e[49]===S?Z=e[50]:(Z=(0,g.jsx)(`div`,{className:`overflow-auto shrink-0 max-h-[50%]`,children:(0,g.jsx)(fe,{consoleOutputs:S,className:`overflow-auto`,stale:!1,interrupted:!1,cellName:`_`,onSubmitDebugger:se.NOOP,cellId:o,debuggerActive:!1})}),e[49]=S,e[50]=Z);let Q;e[51]!==X||e[52]!==Z?(Q=(0,g.jsx)(Se,{defaultSize:60,minSize:20,children:(0,g.jsxs)(`div`,{className:`h-full flex flex-col divide-y overflow-hidden`,children:[X,Z]})}),e[51]=X,e[52]=Z,e[53]=Q):Q=e[53];let $;return e[54]!==_||e[55]!==v||e[56]!==K||e[57]!==Y||e[58]!==Q?($=(0,g.jsx)(`div`,{className:`flex flex-col h-full overflow-hidden`,id:V,children:(0,g.jsxs)(be,{direction:_,className:`h-full`,children:[K,Y,Q]},v)}),e[54]=_,e[55]=v,e[56]=K,e[57]=Y,e[58]=Q,e[59]=$):$=e[59],$},v=()=>{let e=(0,ke.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,g.jsx)(_,{}),e[0]=t):t=e[0],t};export{v as default};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as ee,t as r,u as te}from"./useEvent-xfs0Sn4r.js";import{t as i}from"./react-CBDbhulC.js";import{Co as a,D as ne,Fo as o,I as re,Po as ie,Wt as ae,ii as s}from"./cells-Cp-G34Rz.js";import{t as c}from"./compiler-runtime-CYIjoINj.js";import{w as oe}from"./utils-D5Ywm7-q.js";import{_ as se}from"./useEventListener-92uWqz-P.js";import{t as ce}from"./constants-BDbGiS7O.js";import{t as le}from"./cn-ldLVeaqm.js";import{t as l}from"./jsx-runtime-B74pBk57.js";import{n as ue}from"./JsonOutput-CzIGPEZQ.js";import{t as u}from"./tooltip-BUtPzKB4.js";import{t as d}from"./button-Dh8EwhsF.js";import{r as de}from"./requests-C6_IaFh7.js";import{t as f}from"./createLucideIcon-B7HeEoG2.js";import{d as fe}from"./layout-DWnrxIo2.js";import{n as pe,t as me}from"./LazyAnyLanguageCodeMirror-LboTfNDv.js";import{u as he}from"./toDate-hGYJX0Ha.js";import{t as ge}from"./cell-editor-Dw09J9yD.js";import{t as _e}from"./spinner-Ck-Hgfvj.js";import{i as ve}from"./useDeleteCell-Bz49_cFj.js";import{r as ye}from"./useTheme-C-ri8BtY.js";import{n as be,r as xe,t as Se}from"./react-resizable-panels.browser.esm-BSRAHC4P.js";import{a as Ce}from"./renderShortcut-X-CJUSM8.js";import{n as we,r as Te}from"./panel-context-CiVjnt80.js";import{t as Ee}from"./kiosk-mode-mxgb5lWf.js";var De=f(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),Oe=f(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),p=e(i(),1),ke=c(),m=15,h=a(`marimo:scratchpadHistory:v1`,[],s),Ae=n(!1),je=n(null,(e,t,n)=>{if(n=n.trim(),!n)return;let ee=e(h);t(h,[n,...ee.filter(e=>e!==n)].slice(0,m))}),g=l(),Me={hide_code:!1,disabled:!1},_=()=>{let e=(0,ke.c)(60),n=re(),[i]=oe(),{theme:a}=ye(),s=(0,p.useRef)(null),c=ae(),{createNewCell:l,updateCellCode:f}=ne(),{sendRunScratchpad:m}=de(),_=we(),v=Te(),y=n.cellRuntime[o],b=y?.output,x=y?.status,S=y?.consoleOutputs,C=n.cellData.__scratch__?.code??``,w=te(je),[T,E]=t(Ae),D=ee(h),O;e[0]!==w||e[1]!==C||e[2]!==m?(O=()=>{m({code:C}),w(C)},e[0]=w,e[1]=C,e[2]=m,e[3]=O):O=e[3];let k=r(O),A;e[4]!==C||e[5]!==l||e[6]!==c?(A=()=>{C.trim()&&l({code:C,before:!1,cellId:c??`__end__`})},e[4]=C,e[5]=l,e[6]=c,e[7]=A):A=e[7];let j=r(A),M;e[8]!==m||e[9]!==f?(M=()=>{f({cellId:o,code:``,formattingChange:!1}),m({code:``});let e=s.current;e&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:``}})},e[8]=m,e[9]=f,e[10]=M):M=e[10];let N=r(M),P;e[11]!==E||e[12]!==f?(P=e=>{E(!1),f({cellId:o,code:e,formattingChange:!1});let t=s.current;t&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},e[11]=E,e[12]=f,e[13]=P):P=e[13];let F=r(P),[I,Ne]=(0,p.useState)(),L;e[14]!==F||e[15]!==D||e[16]!==T||e[17]!==a?(L=()=>T?(0,g.jsx)(`div`,{className:`absolute inset-0 z-100 bg-background p-3 border-none overflow-auto`,children:(0,g.jsx)(`div`,{className:`overflow-auto flex flex-col gap-3`,children:D.map((e,t)=>(0,g.jsx)(`div`,{className:`border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden`,onClick:()=>F(e),children:(0,g.jsx)(p.Suspense,{children:(0,g.jsx)(me,{language:`python`,theme:a,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:e.trim(),editable:!1,readOnly:!0})})},t))})}):null,e[14]=F,e[15]=D,e[16]=T,e[17]=a,e[18]=L):L=e[18];let R=L,z;e[19]!==N||e[20]!==j||e[21]!==k||e[22]!==D.length||e[23]!==T||e[24]!==E||e[25]!==x?(z=()=>(0,g.jsxs)(`div`,{className:`flex items-center shrink-0 border-b`,children:[(0,g.jsx)(u,{content:Ce(`cell.run`),children:(0,g.jsx)(d,{"data-testid":`scratchpad-run-button`,onClick:k,disabled:T,variant:`text`,size:`xs`,children:(0,g.jsx)(ve,{color:`var(--grass-11)`,size:16})})}),(0,g.jsx)(u,{content:`Clear code and outputs`,children:(0,g.jsx)(d,{disabled:T,size:`xs`,variant:`text`,onClick:N,children:(0,g.jsx)(De,{size:16})})}),(0,g.jsx)(Ee,{children:(0,g.jsx)(u,{content:`Insert code`,children:(0,g.jsx)(d,{disabled:T,size:`xs`,variant:`text`,onClick:j,children:(0,g.jsx)(pe,{size:16})})})}),(x===`running`||x===`queued`)&&(0,g.jsx)(_e,{className:`inline`,size:`small`}),(0,g.jsx)(`div`,{className:`flex-1`}),(0,g.jsx)(u,{content:`Toggle history`,children:(0,g.jsx)(d,{size:`xs`,variant:`text`,className:le(T&&`bg-(--sky-3) rounded-none`),onClick:()=>E(!T),disabled:D.length===0,children:(0,g.jsx)(Oe,{size:16})})}),(0,g.jsx)(u,{content:(0,g.jsx)(`span`,{className:`block max-w-prose`,children:`Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file.`}),children:(0,g.jsx)(d,{size:`xs`,variant:`text`,children:(0,g.jsx)(he,{size:16})})})]}),e[19]=N,e[20]=j,e[21]=k,e[22]=D.length,e[23]=T,e[24]=E,e[25]=x,e[26]=z):z=e[26];let B=z,Pe=_===`vertical`,V;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(V=ie.create(o),e[27]=V):V=e[27];let H;e[28]===B?H=e[29]:(H=B(),e[28]=B,e[29]=H);let U;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>{s.current=e},e[30]=U):U=e[30];let W;e[31]!==C||e[32]!==k||e[33]!==I||e[34]!==a||e[35]!==i?(W=(0,g.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,g.jsx)(ge,{theme:a,showPlaceholder:!1,id:o,code:C,config:Me,status:`idle`,serializedEditorState:null,runCell:k,userConfig:i,editorViewRef:s,setEditorView:U,hidden:!1,showHiddenCode:se.NOOP,languageAdapter:I,setLanguageAdapter:Ne})}),e[31]=C,e[32]=k,e[33]=I,e[34]=a,e[35]=i,e[36]=W):W=e[36];let G;e[37]===R?G=e[38]:(G=R(),e[37]=R,e[38]=G);let K;e[39]!==G||e[40]!==H||e[41]!==W?(K=(0,g.jsx)(Se,{defaultSize:40,minSize:20,maxSize:70,children:(0,g.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden relative`,children:[H,W,G]})}),e[39]=G,e[40]=H,e[41]=W,e[42]=K):K=e[42];let q=Pe?`h-1`:`w-1`,J;e[43]===q?J=e[44]:(J=le(`bg-border hover:bg-primary/50 transition-colors`,q),e[43]=q,e[44]=J);let Y;e[45]===J?Y=e[46]:(Y=(0,g.jsx)(xe,{className:J}),e[45]=J,e[46]=Y);let X;e[47]===b?X=e[48]:(X=(0,g.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,g.jsx)(ue,{allowExpand:!1,output:b,className:ce.outputArea,cellId:o,stale:!1,loading:!1})}),e[47]=b,e[48]=X);let Z;e[49]===S?Z=e[50]:(Z=(0,g.jsx)(`div`,{className:`overflow-auto shrink-0 max-h-[50%]`,children:(0,g.jsx)(fe,{consoleOutputs:S,className:`overflow-auto`,stale:!1,interrupted:!1,cellName:`_`,onSubmitDebugger:se.NOOP,cellId:o,debuggerActive:!1})}),e[49]=S,e[50]=Z);let Q;e[51]!==X||e[52]!==Z?(Q=(0,g.jsx)(Se,{defaultSize:60,minSize:20,children:(0,g.jsxs)(`div`,{className:`h-full flex flex-col divide-y overflow-hidden`,children:[X,Z]})}),e[51]=X,e[52]=Z,e[53]=Q):Q=e[53];let $;return e[54]!==_||e[55]!==v||e[56]!==K||e[57]!==Y||e[58]!==Q?($=(0,g.jsx)(`div`,{className:`flex flex-col h-full overflow-hidden`,id:V,children:(0,g.jsxs)(be,{direction:_,className:`h-full`,children:[K,Y,Q]},v)}),e[54]=_,e[55]=v,e[56]=K,e[57]=Y,e[58]=Q,e[59]=$):$=e[59],$},v=()=>{let e=(0,ke.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,g.jsx)(_,{}),e[0]=t):t=e[0],t};export{v as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,u as i}from"./useEvent-xfs0Sn4r.js";import{t as a}from"./react-CBDbhulC.js";import{$i as o,$n as s,Aa as c,Ca as l,Cn as u,Co as d,D as f,Da as p,Ea as m,Ii as h,Kt as g,Li as _,Ln as v,M as y,Oa as b,P as x,Qn as S,Sa as C,Sn as w,Tr as T,Tt as E,Wn as D,Wt as O,Xi as k,Zn as A,_a as j,ai as M,ba as N,c as P,ea as F,fa as I,ga as L,i as R,ii as z,ja as B,ka as ee,kn as V,si as te,va as H,vn as U,wa as W,ya as ne,zi as re}from"./cells-Cp-G34Rz.js";import{t as ie}from"./compiler-runtime-CYIjoINj.js";import{c as ae}from"./utils-D5Ywm7-q.js";import{t as G}from"./ErrorBoundary-CDVGFYfr.js";import{t as oe}from"./cn-ldLVeaqm.js";import{t as se}from"./jsx-runtime-B74pBk57.js";import{r as K}from"./config-B-r81uZ6.js";import{_ as ce,at as q,f as J,g as le,h as ue,it as de,m as fe,nt as pe,ot as me,rt as he,tt as ge,v as _e}from"./JsonOutput-Bgxc9G7d.js";import{t as ve}from"./tooltip-BUtPzKB4.js";import{r as ye,t as be}from"./button-Dh8EwhsF.js";import{l as xe}from"./arrays-BqUx5USx.js";import{i as Se}from"./strings-CReV1AYG.js";import{r as Ce}from"./requests-C6_IaFh7.js";import{t as we}from"./createLucideIcon-B7HeEoG2.js";import{r as Te}from"./useNumberFormatter-DHJ9s6Vk.js";import{a as Ee,r as De}from"./tree-actions-CG5g7aUQ.js";import{a as Oe}from"./input-DEbY281O.js";import{n as ke,o as Ae}from"./column-preview-DHe0-7z4.js";import{t as je}from"./workflow-SJ9KZapt.js";import{t as Me}from"./context-Do8M9TDF.js";import{n as Ne}from"./useAsyncData-Buhk-UgR.js";import{t as Pe}from"./copy-icon-z8fuTE3w.js";import{t as Fe}from"./cell-link-6burT2XF.js";import{a as Ie,i as Le,n as Re,o as ze,r as Be,t as Ve}from"./table-DmqOOjfe.js";import{n as He}from"./icons-CjLa9BiH.js";import{t as Ue}from"./useAddCell-DdB_uBif.js";import{t as We}from"./useDeepCompareMemoize-CLytDdMl.js";import{t as Ge}from"./empty-state-kWyb5dCS.js";import{n as Ke,t as qe}from"./common-CHR7w7aQ.js";import{a as Je,i as Ye,n as Xe,o as Ze,r as Qe,s as $e,t as et}from"./components-C7mWrmXr.js";import{r as tt}from"./panel-accordion-state-DjUTN7i5.js";var nt=we(`square-equal`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 10h10`,key:`1101jm`}],[`path`,{d:`M7 14h10`,key:`1mhdw3`}]]),Y=ie(),X=e(a(),1),Z=se(),rt=1;function it(e){return 1.75+e*rt}function at(e){return 3+e*rt}function ot(e){return 3.25+e*rt}var Q={engineEmpty:.75,engine:.75,database:1,tableLoading:2.75,tableSchemaless:2,columnLocal:1.25,columnPreview:2.5};function $(e){return{paddingLeft:`${e}rem`}}var st=n(e=>{let t=e(H),n=e(te),r=e(R);return xe(t,e=>{if(!e.variable_name)return-1;let t=Object.values(n).find(t=>t.name===e.variable_name);if(!t)return 0;let i=r.inOrderIds.indexOf(t.declaredBy[0]);return i===-1?0:i})}),ct=d(`marimo:datasources:hideEmpty`,!1,z,{getOnInit:!0});function lt(e){let t=!1,n=[];for(let r of e){if(!W(r)||!C(r)){n.push(r);continue}let e=r.child_schemas??[],i=lt(e);if(r.tables.length===0&&i.length===0){t=!0;continue}if(i===e){n.push(r);continue}t=!0,n.push({...r,child_schemas:i})}return t?n:e}function ut(e){let t=!1,n=[];for(let r of e){if(l(r)&&r.schemas.length===0){t=!0;continue}if(r.schemas.length===0){n.push(r);continue}let e=lt(r.schemas);if(e.length===0){t=!0;continue}if(e===r.schemas){n.push(r);continue}t=!0,n.push({...r,schemas:e})}return t?n:e}var dt=()=>{let e=(0,Y.c)(42),[n,a]=X.useState(``),[o,s]=t(ct),c=i(j),l=r(st),u=r(I),d;bb0:{if(!o){d=u;break bb0}let t,n;e[0]===u?(t=e[1],n=e[2]):(t=!1,n=u.map(e=>{let n=ut(e.databases);return n===e.databases?e:(t=!0,{...e,databases:n})}),e[0]=u,e[1]=t,e[2]=n),d=t?n:u}let f=d;if(l.length===0&&f.length===0){let t;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Ge,{title:`No tables found`,description:`Any datasets/dataframes in the global scope will be shown here.`,action:(0,Z.jsx)(Ze,{group:`database`,label:`Add database or catalog`,variant:`outline`,size:`sm`}),icon:(0,Z.jsx)(F,{})}),e[3]=t):t=e[3],t}let p;e[4]===n?p=e[5]:(p=n.trim(),e[4]=n,e[5]=p);let m=!!p,h;e[6]===c?h=e[7]:(h=e=>{c(e.length>0),a(e)},e[6]=c,e[7]=h);let g;e[8]!==n||e[9]!==h?(g=(0,Z.jsx)(w,{placeholder:`Search tables...`,className:`h-6 m-1`,value:n,onValueChange:h,rootClassName:`flex-1 border-r border-b-0`}),e[8]=n,e[9]=h,e[10]=g):g=e[10];let _;e[11]===m?_=e[12]:(_=m&&(0,Z.jsx)(`button`,{type:`button`,className:`float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground`,onClick:()=>a(``),children:(0,Z.jsx)(Te,{className:`h-4 w-4`})}),e[11]=m,e[12]=_);let v=!o,y;e[13]!==o||e[14]!==s?(y=()=>s(!o),e[13]=o,e[14]=s,e[15]=y):y=e[15];let b;e[16]!==v||e[17]!==y?(b=(0,Z.jsx)(Ee,{"data-testid":`datasources-hide-empty-button`,isVisible:v,onToggle:y,showTooltip:`Show empty schemas and databases`,hideTooltip:`Hide empty schemas and databases`,size:`sm`,className:`px-2 rounded-none focus-visible:outline-hidden`}),e[16]=v,e[17]=y,e[18]=b):b=e[18];let x;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(Ze,{group:`database`,label:`Add database or catalog`,compact:!0,variant:`ghost`,size:`sm`,className:`px-2 rounded-none focus-visible:outline-hidden`}),e[19]=x):x=e[19];let S;e[20]!==g||e[21]!==_||e[22]!==b?(S=(0,Z.jsxs)(`div`,{className:`flex items-center w-full border-b`,children:[g,_,b,x]}),e[20]=g,e[21]=_,e[22]=b,e[23]=S):S=e[23];let C;if(e[24]!==f||e[25]!==n){let t;e[27]===n?t=e[28]:(t=e=>(0,Z.jsx)(ft,{connection:e,hasChildren:e.databases.length>0,children:e.databases.map(t=>(0,Z.jsx)(gt,{connection:e,database:t,searchValue:n},t.name))},e.name),e[27]=n,e[28]=t),C=f.map(t),e[24]=f,e[25]=n,e[26]=C}else C=e[26];let T;e[29]!==f.length||e[30]!==l.length?(T=f.length>0&&l.length>0&&(0,Z.jsxs)(fe,{className:`pr-2`,style:$(Q.engine),children:[(0,Z.jsx)(He,{className:`h-4 w-4 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`text-xs`,children:`Python`})]}),e[29]=f.length,e[30]=l.length,e[31]=T):T=e[31];let E;e[32]!==n||e[33]!==l?(E=l.length>0&&(0,Z.jsx)(bt,{tables:l,searchValue:n}),e[32]=n,e[33]=l,e[34]=E):E=e[34];let D;e[35]!==C||e[36]!==T||e[37]!==E?(D=(0,Z.jsxs)(V,{className:`flex flex-col`,children:[C,T,E]}),e[35]=C,e[36]=T,e[37]=E,e[38]=D):D=e[38];let O;return e[39]!==D||e[40]!==S?(O=(0,Z.jsxs)(U,{className:`border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden`,shouldFilter:!1,children:[S,D]}),e[39]=D,e[40]=S,e[41]=O):O=e[41],O},ft=e=>{let t=(0,Y.c)(26),{connection:n,children:r,hasChildren:i}=e,a=n.name===B,o=a?`In-Memory`:n.name,{previewDataSourceConnection:s}=Ce(),c;t[0]!==n.name||t[1]!==s?(c=async()=>{await s({engine:n.name})},t[0]=n.name,t[1]=s,t[2]=c):c=t[2];let l=c,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=$(Q.engine),t[3]=u):u=t[3];let d;t[4]===n.dialect?d=t[5]:(d=(0,Z.jsx)(v,{className:`h-4 w-4 text-muted-foreground`,name:n.dialect}),t[4]=n.dialect,t[5]=d);let f;t[6]===n.dialect?f=t[7]:(f=h(n.dialect),t[6]=n.dialect,t[7]=f);let p;t[8]===f?p=t[9]:(p=(0,Z.jsx)(`span`,{className:`text-xs`,children:f}),t[8]=f,t[9]=p);let m=o,g;t[10]===m?g=t[11]:(g=(0,Z.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,(0,Z.jsx)($e,{variableName:m}),`)`]}),t[10]=m,t[11]=g);let _;t[12]!==l||t[13]!==a?(_=!a&&(0,Z.jsx)(De,{onClick:l,tooltip:`Refresh connection`,className:`ml-auto h-4 p-0`,iconClassName:`h-3.5 w-3.5`}),t[12]=l,t[13]=a,t[14]=_):_=t[14];let y;t[15]!==d||t[16]!==p||t[17]!==g||t[18]!==_?(y=(0,Z.jsxs)(fe,{className:`pr-2`,style:u,children:[d,p,g,_]}),t[15]=d,t[16]=p,t[17]=g,t[18]=_,t[19]=y):y=t[19];let b;t[20]!==r||t[21]!==i?(b=i?r:(0,Z.jsx)(ue,{content:`No databases available`,style:$(Q.engineEmpty)}),t[20]=r,t[21]=i,t[22]=b):b=t[22];let x;return t[23]!==b||t[24]!==y?(x=(0,Z.jsxs)(Z.Fragment,{children:[y,b]}),t[23]=b,t[24]=y,t[25]=x):x=t[25],x},pt=X.createContext(null);function mt(){let e=X.useContext(pt);if(e==null)throw Error(`useDataSourceTree must be used within a DataSourceTreeContext.Provider`);return e}function ht(e,{schema:t,schemaPath:n}){return{engine:e.engineName,database:e.databaseName,schema:t,schemaPath:n,defaultSchema:e.defaultSchema,defaultDatabase:e.defaultDatabase,dialect:e.dialect}}var gt=e=>{let t=(0,Y.c)(21),{connection:n,database:r,searchValue:i}=e,a;t[0]!==n.default_database||t[1]!==n.default_schema||t[2]!==n.dialect||t[3]!==n.name||t[4]!==r.name||t[5]!==i?(a={engineName:n.name,databaseName:r.name,dialect:n.dialect,defaultSchema:n.default_schema,defaultDatabase:n.default_database,searchValue:i},t[0]=n.default_database,t[1]=n.default_schema,t[2]=n.dialect,t[3]=n.name,t[4]=r.name,t[5]=i,t[6]=a):a=t[6];let o=a,s=n.name,c=r.schemas,u;t[7]===r?u=t[8]:(u=l(r),t[7]=r,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],t[9]=d):d=t[9];let f;t[10]!==r.schemas||t[11]!==u?(f=(0,Z.jsx)(vt,{schemas:c,schemasResolved:u,schemaPath:d,depth:0}),t[10]=r.schemas,t[11]=u,t[12]=f):f=t[12];let p;t[13]!==f||t[14]!==o?(p=(0,Z.jsx)(pt.Provider,{value:o,children:f}),t[13]=f,t[14]=o,t[15]=p):p=t[15];let m;return t[16]!==n.name||t[17]!==r||t[18]!==i||t[19]!==p?(m=(0,Z.jsx)(_t,{engineName:s,database:r,searchValue:i,children:p}),t[16]=n.name,t[17]=r,t[18]=i,t[19]=p,t[20]=m):m=t[20],m},_t=e=>{let t=(0,Y.c)(29),{searchValue:n,engineName:r,database:i,children:a}=e,o;t[0]!==i||t[1]!==n?(o=b(i,n),t[0]=i,t[1]=n,t[2]=o):o=t[2];let s=o,[c,l]=X.useState(s),[d,f]=X.useState(!1),[p,m]=X.useState(n),[h,g]=X.useState(s);(p!==n||h!==s)&&(m(n),g(s),l(s));let _;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=$(Q.database),t[3]=_):_=t[3];let v;t[4]!==c||t[5]!==d?(v=()=>{l(!c),f(!d)},t[4]=c,t[5]=d,t[6]=v):v=t[6];let y=`${r}:${i.name}`,x;t[7]===c?x=t[8]:(x=(0,Z.jsx)(_e,{isExpanded:c}),t[7]=c,t[8]=x);let S=d&&c?`text-foreground`:`text-muted-foreground`,C;t[9]===S?C=t[10]:(C=oe(`h-4 w-4`,S),t[9]=S,t[10]=C);let w;t[11]===C?w=t[12]:(w=(0,Z.jsx)(F,{className:C}),t[11]=C,t[12]=w);let T=d&&c&&`font-semibold`,E;t[13]===T?E=t[14]:(E=oe(T),t[13]=T,t[14]=E);let D;t[15]===i.name?D=t[16]:(D=i.name===``?(0,Z.jsx)(`i`,{children:`Not connected`}):i.name,t[15]=i.name,t[16]=D);let O;t[17]!==E||t[18]!==D?(O=(0,Z.jsx)(`span`,{className:E,children:D}),t[17]=E,t[18]=D,t[19]=O):O=t[19];let k;t[20]!==O||t[21]!==v||t[22]!==y||t[23]!==x||t[24]!==w?(k=(0,Z.jsxs)(u,{className:`text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none`,style:_,onSelect:v,value:y,children:[x,w,O]}),t[20]=O,t[21]=v,t[22]=y,t[23]=x,t[24]=w,t[25]=k):k=t[25];let A=c&&a,j;return t[26]!==k||t[27]!==A?(j=(0,Z.jsxs)(Z.Fragment,{children:[k,A]}),t[26]=k,t[27]=A,t[28]=j):j=t[28],j},vt=e=>{let{schemas:t,schemasResolved:n,depth:r}=e,i=mt(),{engineName:a,databaseName:o,searchValue:s}=i,{addSchemaList:c}=L(),l=We(e.schemaPath),[u,d]=X.useState(!1),{isPending:f,error:p}=Ne(async()=>{if(!n&&a){d(!0);try{let e=await A.request({engine:a,database:o,schemaPath:l});c({schemas:e.schemas??[],sqlSchemaContext:{engine:a,database:o,schemaPath:l}})}finally{d(!1)}}},[n,a,o,l]),h=$(it(r));return f||u?(0,Z.jsx)(ce,{message:`Loading schemas...`,style:h}):p?(0,Z.jsx)(le,{error:p,style:h}):t.length===0?(0,Z.jsx)(ue,{content:`No schemas available`,style:h}):(0,Z.jsx)(Z.Fragment,{children:t.map(e=>m(e.name)?(0,Z.jsx)(bt,{tables:e.tables,tablesResolved:W(e),searchValue:s,sqlTableContext:ht(i,{schema:e.name,schemaPath:l})},e.name):(0,Z.jsx)(yt,{schema:e,schemaPath:[...l,e.name],depth:r},e.name))})},yt=e=>{let t=(0,Y.c)(41),{schema:n,schemaPath:r,depth:i}=e,a=mt(),{databaseName:o,searchValue:s}=a,c;t[0]!==n||t[1]!==s?(c=p(n,s),t[0]=n,t[1]=s,t[2]=c):c=t[2];let l=c,[d,f]=X.useState(l),[m,h]=X.useState(!1),[g,_]=X.useState(s),[v,y]=X.useState(l),b;t[3]===r?b=t[4]:(b=r.join(`.`),t[3]=r,t[4]=b);let x=`${o}:${b}`,S;t[5]===n.child_schemas?S=t[6]:(S=n.child_schemas??[],t[5]=n.child_schemas,t[6]=S);let w=S;(g!==s||v!==l)&&(_(s),y(l),f(l));let T;t[7]===i?T=t[8]:(T=$(it(i)),t[7]=i,t[8]=T);let E;t[9]!==d||t[10]!==m?(E=()=>{f(!d),h(!m)},t[9]=d,t[10]=m,t[11]=E):E=t[11];let D;t[12]===d?D=t[13]:(D=(0,Z.jsx)(_e,{isExpanded:d}),t[12]=d,t[13]=D);let O=m&&d&&`text-foreground`,A;t[14]===O?A=t[15]:(A=oe(`h-4 w-4 text-muted-foreground`,O),t[14]=O,t[15]=A);let j;t[16]===A?j=t[17]:(j=(0,Z.jsx)(k,{className:A}),t[16]=A,t[17]=j);let M=m&&d&&`font-semibold`,N;t[18]===M?N=t[19]:(N=oe(M),t[18]=M,t[19]=N);let P;t[20]!==n.name||t[21]!==N?(P=(0,Z.jsx)(`span`,{className:N,children:n.name}),t[20]=n.name,t[21]=N,t[22]=P):P=t[22];let F;t[23]!==P||t[24]!==T||t[25]!==E||t[26]!==D||t[27]!==j||t[28]!==x?(F=(0,Z.jsxs)(u,{className:`text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none`,style:T,onSelect:E,value:x,children:[D,j,P]}),t[23]=P,t[24]=T,t[25]=E,t[26]=D,t[27]=j,t[28]=x,t[29]=F):F=t[29];let I;t[30]!==w||t[31]!==i||t[32]!==d||t[33]!==n||t[34]!==r||t[35]!==s||t[36]!==a?(I=d&&(0,Z.jsxs)(Z.Fragment,{children:[(w.length>0||!C(n))&&(0,Z.jsx)(vt,{schemas:w,schemasResolved:C(n),schemaPath:r,depth:i+1}),(0,Z.jsx)(bt,{tables:n.tables,tablesResolved:W(n),searchValue:s,tableIndentRem:at(i),columnIndentRem:ot(i),sqlTableContext:ht(a,{schema:n.name,schemaPath:r})})]}),t[30]=w,t[31]=i,t[32]=d,t[33]=n,t[34]=r,t[35]=s,t[36]=a,t[37]=I):I=t[37];let L;return t[38]!==F||t[39]!==I?(L=(0,Z.jsxs)(Z.Fragment,{children:[F,I]}),t[38]=F,t[39]=I,t[40]=L):L=t[40],L},bt=e=>{let t=(0,Y.c)(31),{tables:n,sqlTableContext:r,searchValue:i,tablesResolved:a,tableIndentRem:o,columnIndentRem:c}=e,l=a===void 0||a,{addTableList:u}=L(),[d,f]=X.useState(!1),p;t[0]!==u||t[1]!==r||t[2]!==l?(p=async()=>{if(!l&&r){f(!0);let{engine:e,database:t,schema:n,schemaPath:i}=r,a=await s.request({engine:e,database:t,schema:n,schemaPath:i??[]});if(!a?.tables)throw f(!1),Error(`No tables available`);u({tables:a.tables,sqlTableContext:r}),f(!1)}},t[0]=u,t[1]=r,t[2]=l,t[3]=p):p=t[3];let m;t[4]!==r||t[5]!==l?(m=[l,r],t[4]=r,t[5]=l,t[6]=m):m=t[6];let{isPending:h,error:g}=Ne(p,m),_=o??Q.tableLoading,v;t[7]===_?v=t[8]:(v=$(_),t[7]=_,t[8]=v);let y=v;if(h||d){let e;return t[9]===y?e=t[10]:(e=(0,Z.jsx)(ce,{message:`Loading tables...`,style:y}),t[9]=y,t[10]=e),e}if(g){let e;return t[11]!==g||t[12]!==y?(e=(0,Z.jsx)(le,{error:g,style:y}),t[11]=g,t[12]=y,t[13]=e):e=t[13],e}if(n.length===0){let e;return t[14]===y?e=t[15]:(e=(0,Z.jsx)(ue,{content:`No tables found`,style:y}),t[14]=y,t[15]=e),e}let b;if(t[16]!==c||t[17]!==i||t[18]!==r||t[19]!==o||t[20]!==n){let e;t[22]===i?e=t[23]:(e=e=>!i||e.name.toLowerCase().includes(i.toLowerCase()),t[22]=i,t[23]=e);let a=n.filter(e),s;t[24]!==c||t[25]!==i||t[26]!==r||t[27]!==o?(s=e=>(0,Z.jsx)(xt,{table:e,sqlTableContext:r,isSearching:!!i,tableIndentRem:o,columnIndentRem:c},e.name),t[24]=c,t[25]=i,t[26]=r,t[27]=o,t[28]=s):s=t[28],b=a.map(s),t[16]=c,t[17]=i,t[18]=r,t[19]=o,t[20]=n,t[21]=b}else b=t[21];let x;return t[29]===b?x=t[30]:(x=(0,Z.jsx)(Z.Fragment,{children:b}),t[29]=b,t[30]=x),x},xt=e=>{let t=(0,Y.c)(69),{table:n,sqlTableContext:i,isSearching:a,tableIndentRem:s,columnIndentRem:l}=e,{addTable:d}=L(),[p,m]=X.useState(!1),h=n.columns.length>0,_;t[0]!==d||t[1]!==p||t[2]!==i||t[3]!==n.name||t[4]!==h?(_=async()=>{if(p&&!h&&i){let{engine:e,database:t,schema:r,schemaPath:a}=i,o=await S.request({engine:e,database:t,schema:r,tableName:n.name,schemaPath:a??[]});if(!o?.table)throw Error(`No table details available`);d({table:o.table,sqlTableContext:i})}},t[0]=d,t[1]=p,t[2]=i,t[3]=n.name,t[4]=h,t[5]=_):_=t[5];let v;t[6]!==p||t[7]!==h?(v=[p,h],t[6]=p,t[7]=h,t[8]=v):v=t[8];let{isFetching:y,isPending:b,error:x}=Ne(_,v),C=r(ae),w=O(),{createNewCell:T}=f(),E=Ue(),D;t[9]!==E||t[10]!==C||t[11]!==T||t[12]!==w||t[13]!==i||t[14]!==n?(D=()=>{g({autoInstantiate:C,createNewCell:T,fromCellId:w}),E((()=>{if(n.source_type===`catalog`){let e=i?.database?[i.database,...i.schemaPath??[],n.name].join(`.`):n.name;return`${n.engine}.load_table("${e}")`}if(i)return ee({table:n,columnName:`*`,sqlTableContext:i});switch(n.source_type){case`local`:return`mo.ui.table(${n.name})`;case`duckdb`:case`connection`:return ee({table:n,columnName:`*`,sqlTableContext:i});default:return Se(n.source_type),``}})())},t[9]=E,t[10]=C,t[11]=T,t[12]=w,t[13]=i,t[14]=n,t[15]=D):D=t[15];let k=D,A;t[16]!==n.num_columns||t[17]!==n.num_rows?(A=()=>{let e=[];return n.num_rows!=null&&e.push(`${n.num_rows} rows`),n.num_columns!=null&&e.push(`${n.num_columns} columns`),e.length===0?null:(0,Z.jsx)(`div`,{className:`flex flex-row gap-2 items-center pl-6 group-hover:hidden`,children:(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.join(`, `)})})},t[16]=n.num_columns,t[17]=n.num_rows,t[18]=A):A=t[18];let j=A,M;t[19]!==l||t[20]!==x||t[21]!==y||t[22]!==b||t[23]!==i||t[24]!==n?(M=()=>{let e=$(l??Q.tableLoading);if(b||y)return(0,Z.jsx)(ce,{message:`Loading columns...`,style:e});if(x)return(0,Z.jsx)(le,{error:x,style:e});let t=n.columns;return t.length===0?(0,Z.jsx)(ue,{content:`No columns found`,style:e}):t.map(e=>(0,Z.jsx)(St,{table:n,column:e,sqlTableContext:i,columnIndentRem:l},e.name))},t[19]=l,t[20]=x,t[21]=y,t[22]=b,t[23]=i,t[24]=n,t[25]=M):M=t[25];let N=M,P;t[26]!==p||t[27]!==a||t[28]!==n.source_type||t[29]!==n.type?(P=()=>{if(n.source_type===`local`)return;let e=n.type===`table`?re:o;return(0,Z.jsx)(e,{className:`h-3 w-3`,strokeWidth:p||a?2.5:void 0})},t[26]=p,t[27]=a,t[28]=n.source_type,t[29]=n.type,t[30]=P):P=t[30];let F=P,I;t[31]!==i||t[32]!==n.name?(I=c(i,n.name),t[31]=i,t[32]=n.name,t[33]=I):I=t[33];let R=I,z=s??(i?Q.tableSchemaless:0),B=(p||a)&&`font-semibold`,V;t[34]===B?V=t[35]:(V=oe(`rounded-none group h-8 cursor-pointer`,B),t[34]=B,t[35]=V);let te;t[36]===z?te=t[37]:(te=$(z),t[36]=z,t[37]=te);let H;t[38]===p?H=t[39]:(H=()=>m(!p),t[38]=p,t[39]=H);let U;t[40]===F?U=t[41]:(U=F(),t[40]=F,t[41]=U);let W;t[42]===n.name?W=t[43]:(W=(0,Z.jsx)(`span`,{className:`text-sm`,children:n.name}),t[42]=n.name,t[43]=W);let ne;t[44]!==U||t[45]!==W?(ne=(0,Z.jsxs)(`div`,{className:`flex gap-2 items-center flex-1 pl-1`,children:[U,W]}),t[44]=U,t[45]=W,t[46]=ne):ne=t[46];let ie;t[47]===j?ie=t[48]:(ie=j(),t[47]=j,t[48]=ie);let G;t[49]===k?G=t[50]:(G=ye.stopPropagation(()=>k()),t[49]=k,t[50]=G);let se;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(Ae,{className:`h-3 w-3`}),t[51]=se):se=t[51];let K;t[52]===G?K=t[53]:(K=(0,Z.jsx)(ve,{content:`Add table to notebook`,delayDuration:400,children:(0,Z.jsx)(be,{className:`group-hover:inline-flex hidden`,variant:`text`,size:`icon`,onClick:G,children:se})}),t[52]=G,t[53]=K);let q;t[54]!==p||t[55]!==te||t[56]!==H||t[57]!==ne||t[58]!==ie||t[59]!==K||t[60]!==V||t[61]!==R?(q=(0,Z.jsxs)(u,{className:V,style:te,value:R,"aria-selected":p,forceMount:!0,onSelect:H,children:[ne,ie,K]}),t[54]=p,t[55]=te,t[56]=H,t[57]=ne,t[58]=ie,t[59]=K,t[60]=V,t[61]=R,t[62]=q):q=t[62];let J;t[63]!==p||t[64]!==N?(J=p&&N(),t[63]=p,t[64]=N,t[65]=J):J=t[65];let de;return t[66]!==q||t[67]!==J?(de=(0,Z.jsxs)(Z.Fragment,{children:[q,J]}),t[66]=q,t[67]=J,t[68]=de):de=t[68],de},St=e=>{let t=(0,Y.c)(51),{table:n,column:a,sqlTableContext:o,columnIndentRem:s}=e,[c,l]=X.useState(!1),d=r(j),f=i(ne);d&&c&&l(!1),f(c?e=>new Set([...e,`${n.name}:${a.name}`]):e=>(e.delete(`${n.name}:${a.name}`),new Set(e)));let p=Ue(),{columnsPreviews:m}=N(),h;t[0]!==a.name||t[1]!==n.primary_keys?(h=n.primary_keys?.includes(a.name)||!1,t[0]=a.name,t[1]=n.primary_keys,t[2]=h):h=t[2];let g=h,_;t[3]!==a.name||t[4]!==n.indexes?(_=n.indexes?.includes(a.name)||!1,t[3]=a.name,t[4]=n.indexes,t[5]=_):_=t[5];let v=_,y;t[6]===p?y=t[7]:(y=e=>{p(e)},t[6]=p,t[7]=y);let b=y,x=Ct,S=c?`font-semibold`:``,C;t[8]!==a.name||t[9]!==S?(C=(0,Z.jsx)(`span`,{className:S,children:a.name}),t[8]=a.name,t[9]=S,t[10]=C):C=t[10];let w=C,T=`${n.name}.${a.name}`,E=`${n.name}.${a.name}`,D;t[11]===c?D=t[12]:(D=()=>l(!c),t[11]=c,t[12]=D);let O;t[13]!==s||t[14]!==o?(O=s??(o?ot(0):Q.columnLocal),t[13]=s,t[14]=o,t[15]=O):O=t[15];let k;t[16]===O?k=t[17]:(k=$(O),t[16]=O,t[17]=k);let A;t[18]!==a.type||t[19]!==w?(A=(0,Z.jsx)(J,{columnName:w,dataType:a.type}),t[18]=a.type,t[19]=w,t[20]=A):A=t[20];let M;t[21]===g?M=t[22]:(M=g&&x({tooltipContent:`Primary key`,content:`PK`}),t[21]=g,t[22]=M);let P;t[23]===v?P=t[24]:(P=v&&x({tooltipContent:`Indexed`,content:`IDX`}),t[23]=v,t[24]=P);let F;t[25]!==k||t[26]!==A||t[27]!==M||t[28]!==P?(F=(0,Z.jsxs)(`div`,{className:`flex flex-row gap-2 items-center flex-1`,style:k,children:[A,M,P]}),t[25]=k,t[26]=A,t[27]=M,t[28]=P,t[29]=F):F=t[29];let I;t[30]===a.name?I=t[31]:(I=(0,Z.jsx)(ve,{content:`Copy column name`,delayDuration:400,children:(0,Z.jsx)(be,{variant:`text`,size:`icon`,className:`group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(Pe,{tooltip:!1,value:a.name,className:`h-3 w-3`})})}),t[30]=a.name,t[31]=I);let L;t[32]===a.external_type?L=t[33]:(L=(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a.external_type}),t[32]=a.external_type,t[33]=L);let R;t[34]!==F||t[35]!==I||t[36]!==L||t[37]!==T||t[38]!==E||t[39]!==D?(R=(0,Z.jsxs)(u,{className:`rounded-none py-1 group cursor-pointer`,value:E,onSelect:D,children:[F,I,L]},T),t[34]=F,t[35]=I,t[36]=L,t[37]=T,t[38]=E,t[39]=D,t[40]=R):R=t[40];let z;t[41]!==a||t[42]!==m||t[43]!==b||t[44]!==c||t[45]!==o||t[46]!==n?(z=c&&(0,Z.jsx)(`div`,{className:`pr-2 py-2 bg-(--slate-1) shadow-inner border-b`,style:$(Q.columnPreview),children:(0,Z.jsx)(G,{children:(0,Z.jsx)(ke,{table:n,column:a,onAddColumnChart:b,preview:m.get(o?`${o.database}.${o.schema}.${n.name}:${a.name}`:`${n.name}:${a.name}`),sqlTableContext:o})})}),t[41]=a,t[42]=m,t[43]=b,t[44]=c,t[45]=o,t[46]=n,t[47]=z):z=t[47];let B;return t[48]!==R||t[49]!==z?(B=(0,Z.jsxs)(Z.Fragment,{children:[R,z]}),t[48]=R,t[49]=z,t[50]=B):B=t[50],B};function Ct(e){let{tooltipContent:t,content:n}=e;return(0,Z.jsx)(ve,{content:t,delayDuration:100,children:(0,Z.jsx)(`span`,{className:`text-xs text-black bg-gray-100 dark:invert rounded px-1`,children:n})})}function wt(e){return e}var Tt={name:`name`,type:`type-value`,defs:`defs-refs`},Et=[wt({id:Tt.name,accessorFn:e=>[e.name,e.declaredBy],enableSorting:!0,sortingFn:`alphanumeric`,header:({column:e})=>(0,Z.jsx)(ge,{header:`Name`,column:e}),cell:({getValue:e})=>{let[t,n]=e();return(0,Z.jsx)(qe,{name:t,declaredBy:n})}}),wt({id:Tt.type,accessorFn:e=>[e.dataType,e.value],enableSorting:!0,sortingFn:`alphanumeric`,header:({column:e})=>(0,Z.jsx)(ge,{header:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{children:`Type`}),(0,Z.jsx)(`span`,{children:`Value`})]}),column:e}),cell:({getValue:e})=>{let[t,n]=e();return(0,Z.jsxs)(`div`,{className:`max-w-[150px]`,children:[(0,Z.jsx)(`div`,{className:`text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs`,children:t}),(0,Z.jsx)(`div`,{className:`text-ellipsis overflow-hidden whitespace-nowrap`,title:n??``,children:n})]})}}),wt({id:Tt.defs,accessorFn:e=>[e.declaredBy,e.usedBy,e.name,e.declaredByNames,e.usedByNames],enableSorting:!0,sortingFn:`basic`,header:({column:e})=>(0,Z.jsx)(ge,{header:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{children:`Declared By`}),(0,Z.jsx)(`span`,{children:`Used By`})]}),column:e}),cell:({getValue:e})=>{let[t,n,r]=e(),i=e=>{let t=P(e);t&&T(t,r)};return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 py-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-row overflow-auto gap-2 items-center`,children:[(0,Z.jsx)(`span`,{title:`Declared by`,children:(0,Z.jsx)(nt,{className:`w-3.5 h-3.5 text-muted-foreground`})}),t.length===1?(0,Z.jsx)(Fe,{variant:`focus`,cellId:t[0],skipScroll:!0,onClick:()=>i(t[0])}):(0,Z.jsx)(`div`,{className:`text-destructive flex flex-row gap-2`,children:t.slice(0,3).map((e,n)=>(0,Z.jsxs)(`span`,{className:`flex`,children:[(0,Z.jsx)(Fe,{variant:`focus`,cellId:e,skipScroll:!0,className:`whitespace-nowrap text-destructive`,onClick:()=>i(e)},e),n<t.length-1&&`, `]},e))})]}),(0,Z.jsxs)(`div`,{className:`flex flex-row overflow-auto gap-2 items-baseline`,children:[(0,Z.jsx)(`span`,{title:`Used by`,children:(0,Z.jsx)(je,{className:`w-3.5 h-3.5 text-muted-foreground`})}),(0,Z.jsx)(Ke,{maxCount:3,cellIds:n,skipScroll:!0,onClick:i})]})]})}})];function Dt({variables:e,sort:t,cellIdToIndex:n}){t||={id:Tt.defs,desc:!1};let r=[];switch(t.id){case Tt.name:r=xe(e,e=>e.name);break;case Tt.type:r=xe(e,e=>e.dataType);break;case Tt.defs:r=xe(e,e=>n.get(e.declaredBy[0]))}return t.desc?r.toReversed():r}var Ot=(0,X.memo)(({className:e,cellIds:t,variables:n})=>{let[r,i]=X.useState([]),[a,o]=X.useState(``),s=x(),{locale:c}=Me(),l=(0,X.useMemo)(()=>{let e=e=>{let n=s[e];return D(n)?`cell-${t.indexOf(e)}`:n??`cell-${t.indexOf(e)}`};return Object.values(n).map(t=>({...t,declaredByNames:t.declaredBy.map(e),usedByNames:t.usedBy.map(e)}))},[n,s,t]),u=(0,X.useMemo)(()=>{let e=new Map;return t.forEach((t,n)=>e.set(t,n)),Dt({variables:l,sort:r[0],cellIdToIndex:e})},[l,r,t]),d=he({data:u,columns:Et,getCoreRowModel:de(),onGlobalFilterChange:o,getFilteredRowModel:q(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter(e){return e.columnDef.enableGlobalFilter??!0},globalFilterFn:`auto`,manualSorting:!0,locale:c,onSortingChange:i,getSortedRowModel:me(),state:{sorting:r,globalFilter:a}});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Oe,{className:`w-full`,placeholder:`Search`,value:a,onChange:e=>o(e.target.value)}),(0,Z.jsxs)(Ve,{className:oe(`w-full text-sm flex-1 border-separate border-spacing-0`,e),children:[(0,Z.jsx)(Ie,{children:(0,Z.jsx)(ze,{className:`whitespace-nowrap text-xs`,children:d.getFlatHeaders().map(e=>(0,Z.jsx)(Le,{className:`sticky top-0 bg-background border-b`,children:pe(e.column.columnDef.header,e.getContext())},e.id))})}),(0,Z.jsx)(Re,{children:d.getRowModel().rows.map(e=>(0,Z.jsx)(ze,{className:`hover:bg-accent`,children:e.getVisibleCells().map(e=>(0,Z.jsx)(Be,{className:`border-b`,children:pe(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]})]})});Ot.displayName=`VariableTable`;var kt=()=>{let e=(0,Y.c)(30),n=M(),i=y(),a=r(H),o=r(I),s=E(`database`),[c,l]=t(tt),u=a.length+o.length,d;e[0]!==u||e[1]!==c.hasUserInteracted||e[2]!==c.openSections?(d=!c.hasUserInteracted&&u>0?[...new Set([...c.openSections,`datasources`])]:c.openSections,e[0]=u,e[1]=c.hasUserInteracted,e[2]=c.openSections,e[3]=d):d=e[3];let f=d,p;e[4]===l?p=e[5]:(p=e=>{l({openSections:e,hasUserInteracted:!0})},e[4]=l,e[5]=p);let m=p,h;e[6]===f?h=e[7]:(h=f.includes(`datasources`),e[6]=f,e[7]=h);let g=!h&&u>0,v=s.length>0,b;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(F,{className:`w-4 h-4`}),e[8]=b):b=e[8];let x;e[9]!==u||e[10]!==g?(x=g&&(0,Z.jsx)(Je,{children:u}),e[9]=u,e[10]=g,e[11]=x):x=e[11];let S;e[12]!==s.length||e[13]!==v?(S=v&&(0,Z.jsx)(et,{count:s.length,type:`database`}),e[12]=s.length,e[13]=v,e[14]=S):S=e[14];let C;e[15]!==x||e[16]!==S?(C=(0,Z.jsxs)(Ye,{children:[b,`Data sources`,x,S]}),e[15]=x,e[16]=S,e[17]=C):C=e[17];let w;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Xe,{children:(0,Z.jsx)(dt,{})}),e[18]=w):w=e[18];let T;e[19]===C?T=e[20]:(T=(0,Z.jsxs)(Qe,{value:`datasources`,children:[C,w]}),e[19]=C,e[20]=T);let D;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsxs)(Ye,{children:[(0,Z.jsx)(_,{className:`w-4 h-4`}),`Variables`]}),e[21]=D):D=e[21];let O;e[22]!==i||e[23]!==n?(O=(0,Z.jsxs)(Qe,{value:`variables`,lastItem:!0,children:[D,(0,Z.jsx)(Xe,{children:Object.keys(n).length===0?(0,Z.jsx)(`div`,{className:`px-3 py-4 text-sm text-muted-foreground`,children:`No variables defined`}):(0,Z.jsx)(Ot,{cellIds:i.inOrderIds,variables:n})})]}),e[22]=i,e[23]=n,e[24]=O):O=e[24];let k;return e[25]!==m||e[26]!==f||e[27]!==O||e[28]!==T?(k=(0,Z.jsxs)(K,{type:`multiple`,value:f,onValueChange:m,className:`flex flex-col h-full overflow-auto`,children:[T,O]}),e[25]=m,e[26]=f,e[27]=O,e[28]=T,e[29]=k):k=e[29],k};export{kt as default};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,u as i}from"./useEvent-xfs0Sn4r.js";import{t as a}from"./react-CBDbhulC.js";import{$i as o,$n as s,Aa as c,Ca as l,Cn as u,Co as d,D as f,Da as p,Ea as m,Ii as h,Kt as g,Li as _,Ln as v,M as y,Oa as b,P as x,Qn as S,Sa as C,Sn as w,Tr as T,Tt as E,Wn as D,Wt as O,Xi as k,Zn as A,_a as j,ai as M,ba as N,c as P,ea as F,fa as I,ga as L,i as R,ii as z,ja as B,ka as ee,kn as V,si as te,va as H,vn as U,wa as W,ya as ne,zi as re}from"./cells-Cp-G34Rz.js";import{t as ie}from"./compiler-runtime-CYIjoINj.js";import{c as ae}from"./utils-D5Ywm7-q.js";import{t as G}from"./ErrorBoundary-CDVGFYfr.js";import{t as oe}from"./cn-ldLVeaqm.js";import{t as se}from"./jsx-runtime-B74pBk57.js";import{r as K}from"./config-B-r81uZ6.js";import{_ as ce,at as q,f as J,g as le,h as ue,it as de,m as fe,nt as pe,ot as me,rt as he,tt as ge,v as _e}from"./JsonOutput-CzIGPEZQ.js";import{t as ve}from"./tooltip-BUtPzKB4.js";import{r as ye,t as be}from"./button-Dh8EwhsF.js";import{l as xe}from"./arrays-BqUx5USx.js";import{i as Se}from"./strings-CReV1AYG.js";import{r as Ce}from"./requests-C6_IaFh7.js";import{t as we}from"./createLucideIcon-B7HeEoG2.js";import{r as Te}from"./useNumberFormatter-DHJ9s6Vk.js";import{a as Ee,r as De}from"./tree-actions-CG5g7aUQ.js";import{a as Oe}from"./input-DEbY281O.js";import{n as ke,o as Ae}from"./column-preview-riSXbYe_.js";import{t as je}from"./workflow-SJ9KZapt.js";import{t as Me}from"./context-Do8M9TDF.js";import{n as Ne}from"./useAsyncData-Buhk-UgR.js";import{t as Pe}from"./copy-icon-z8fuTE3w.js";import{t as Fe}from"./cell-link-6burT2XF.js";import{a as Ie,i as Le,n as Re,o as ze,r as Be,t as Ve}from"./table-DmqOOjfe.js";import{n as He}from"./icons-CjLa9BiH.js";import{t as Ue}from"./useAddCell-DdB_uBif.js";import{t as We}from"./useDeepCompareMemoize-CLytDdMl.js";import{t as Ge}from"./empty-state-kWyb5dCS.js";import{n as Ke,t as qe}from"./common-CHR7w7aQ.js";import{a as Je,i as Ye,n as Xe,o as Ze,r as Qe,s as $e,t as et}from"./components-C7mWrmXr.js";import{r as tt}from"./panel-accordion-state-DjUTN7i5.js";var nt=we(`square-equal`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 10h10`,key:`1101jm`}],[`path`,{d:`M7 14h10`,key:`1mhdw3`}]]),Y=ie(),X=e(a(),1),Z=se(),rt=1;function it(e){return 1.75+e*rt}function at(e){return 3+e*rt}function ot(e){return 3.25+e*rt}var Q={engineEmpty:.75,engine:.75,database:1,tableLoading:2.75,tableSchemaless:2,columnLocal:1.25,columnPreview:2.5};function $(e){return{paddingLeft:`${e}rem`}}var st=n(e=>{let t=e(H),n=e(te),r=e(R);return xe(t,e=>{if(!e.variable_name)return-1;let t=Object.values(n).find(t=>t.name===e.variable_name);if(!t)return 0;let i=r.inOrderIds.indexOf(t.declaredBy[0]);return i===-1?0:i})}),ct=d(`marimo:datasources:hideEmpty`,!1,z,{getOnInit:!0});function lt(e){let t=!1,n=[];for(let r of e){if(!W(r)||!C(r)){n.push(r);continue}let e=r.child_schemas??[],i=lt(e);if(r.tables.length===0&&i.length===0){t=!0;continue}if(i===e){n.push(r);continue}t=!0,n.push({...r,child_schemas:i})}return t?n:e}function ut(e){let t=!1,n=[];for(let r of e){if(l(r)&&r.schemas.length===0){t=!0;continue}if(r.schemas.length===0){n.push(r);continue}let e=lt(r.schemas);if(e.length===0){t=!0;continue}if(e===r.schemas){n.push(r);continue}t=!0,n.push({...r,schemas:e})}return t?n:e}var dt=()=>{let e=(0,Y.c)(42),[n,a]=X.useState(``),[o,s]=t(ct),c=i(j),l=r(st),u=r(I),d;bb0:{if(!o){d=u;break bb0}let t,n;e[0]===u?(t=e[1],n=e[2]):(t=!1,n=u.map(e=>{let n=ut(e.databases);return n===e.databases?e:(t=!0,{...e,databases:n})}),e[0]=u,e[1]=t,e[2]=n),d=t?n:u}let f=d;if(l.length===0&&f.length===0){let t;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Ge,{title:`No tables found`,description:`Any datasets/dataframes in the global scope will be shown here.`,action:(0,Z.jsx)(Ze,{group:`database`,label:`Add database or catalog`,variant:`outline`,size:`sm`}),icon:(0,Z.jsx)(F,{})}),e[3]=t):t=e[3],t}let p;e[4]===n?p=e[5]:(p=n.trim(),e[4]=n,e[5]=p);let m=!!p,h;e[6]===c?h=e[7]:(h=e=>{c(e.length>0),a(e)},e[6]=c,e[7]=h);let g;e[8]!==n||e[9]!==h?(g=(0,Z.jsx)(w,{placeholder:`Search tables...`,className:`h-6 m-1`,value:n,onValueChange:h,rootClassName:`flex-1 border-r border-b-0`}),e[8]=n,e[9]=h,e[10]=g):g=e[10];let _;e[11]===m?_=e[12]:(_=m&&(0,Z.jsx)(`button`,{type:`button`,className:`float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground`,onClick:()=>a(``),children:(0,Z.jsx)(Te,{className:`h-4 w-4`})}),e[11]=m,e[12]=_);let v=!o,y;e[13]!==o||e[14]!==s?(y=()=>s(!o),e[13]=o,e[14]=s,e[15]=y):y=e[15];let b;e[16]!==v||e[17]!==y?(b=(0,Z.jsx)(Ee,{"data-testid":`datasources-hide-empty-button`,isVisible:v,onToggle:y,showTooltip:`Show empty schemas and databases`,hideTooltip:`Hide empty schemas and databases`,size:`sm`,className:`px-2 rounded-none focus-visible:outline-hidden`}),e[16]=v,e[17]=y,e[18]=b):b=e[18];let x;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(Ze,{group:`database`,label:`Add database or catalog`,compact:!0,variant:`ghost`,size:`sm`,className:`px-2 rounded-none focus-visible:outline-hidden`}),e[19]=x):x=e[19];let S;e[20]!==g||e[21]!==_||e[22]!==b?(S=(0,Z.jsxs)(`div`,{className:`flex items-center w-full border-b`,children:[g,_,b,x]}),e[20]=g,e[21]=_,e[22]=b,e[23]=S):S=e[23];let C;if(e[24]!==f||e[25]!==n){let t;e[27]===n?t=e[28]:(t=e=>(0,Z.jsx)(ft,{connection:e,hasChildren:e.databases.length>0,children:e.databases.map(t=>(0,Z.jsx)(gt,{connection:e,database:t,searchValue:n},t.name))},e.name),e[27]=n,e[28]=t),C=f.map(t),e[24]=f,e[25]=n,e[26]=C}else C=e[26];let T;e[29]!==f.length||e[30]!==l.length?(T=f.length>0&&l.length>0&&(0,Z.jsxs)(fe,{className:`pr-2`,style:$(Q.engine),children:[(0,Z.jsx)(He,{className:`h-4 w-4 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`text-xs`,children:`Python`})]}),e[29]=f.length,e[30]=l.length,e[31]=T):T=e[31];let E;e[32]!==n||e[33]!==l?(E=l.length>0&&(0,Z.jsx)(bt,{tables:l,searchValue:n}),e[32]=n,e[33]=l,e[34]=E):E=e[34];let D;e[35]!==C||e[36]!==T||e[37]!==E?(D=(0,Z.jsxs)(V,{className:`flex flex-col`,children:[C,T,E]}),e[35]=C,e[36]=T,e[37]=E,e[38]=D):D=e[38];let O;return e[39]!==D||e[40]!==S?(O=(0,Z.jsxs)(U,{className:`border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden`,shouldFilter:!1,children:[S,D]}),e[39]=D,e[40]=S,e[41]=O):O=e[41],O},ft=e=>{let t=(0,Y.c)(26),{connection:n,children:r,hasChildren:i}=e,a=n.name===B,o=a?`In-Memory`:n.name,{previewDataSourceConnection:s}=Ce(),c;t[0]!==n.name||t[1]!==s?(c=async()=>{await s({engine:n.name})},t[0]=n.name,t[1]=s,t[2]=c):c=t[2];let l=c,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=$(Q.engine),t[3]=u):u=t[3];let d;t[4]===n.dialect?d=t[5]:(d=(0,Z.jsx)(v,{className:`h-4 w-4 text-muted-foreground`,name:n.dialect}),t[4]=n.dialect,t[5]=d);let f;t[6]===n.dialect?f=t[7]:(f=h(n.dialect),t[6]=n.dialect,t[7]=f);let p;t[8]===f?p=t[9]:(p=(0,Z.jsx)(`span`,{className:`text-xs`,children:f}),t[8]=f,t[9]=p);let m=o,g;t[10]===m?g=t[11]:(g=(0,Z.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,(0,Z.jsx)($e,{variableName:m}),`)`]}),t[10]=m,t[11]=g);let _;t[12]!==l||t[13]!==a?(_=!a&&(0,Z.jsx)(De,{onClick:l,tooltip:`Refresh connection`,className:`ml-auto h-4 p-0`,iconClassName:`h-3.5 w-3.5`}),t[12]=l,t[13]=a,t[14]=_):_=t[14];let y;t[15]!==d||t[16]!==p||t[17]!==g||t[18]!==_?(y=(0,Z.jsxs)(fe,{className:`pr-2`,style:u,children:[d,p,g,_]}),t[15]=d,t[16]=p,t[17]=g,t[18]=_,t[19]=y):y=t[19];let b;t[20]!==r||t[21]!==i?(b=i?r:(0,Z.jsx)(ue,{content:`No databases available`,style:$(Q.engineEmpty)}),t[20]=r,t[21]=i,t[22]=b):b=t[22];let x;return t[23]!==b||t[24]!==y?(x=(0,Z.jsxs)(Z.Fragment,{children:[y,b]}),t[23]=b,t[24]=y,t[25]=x):x=t[25],x},pt=X.createContext(null);function mt(){let e=X.useContext(pt);if(e==null)throw Error(`useDataSourceTree must be used within a DataSourceTreeContext.Provider`);return e}function ht(e,{schema:t,schemaPath:n}){return{engine:e.engineName,database:e.databaseName,schema:t,schemaPath:n,defaultSchema:e.defaultSchema,defaultDatabase:e.defaultDatabase,dialect:e.dialect}}var gt=e=>{let t=(0,Y.c)(21),{connection:n,database:r,searchValue:i}=e,a;t[0]!==n.default_database||t[1]!==n.default_schema||t[2]!==n.dialect||t[3]!==n.name||t[4]!==r.name||t[5]!==i?(a={engineName:n.name,databaseName:r.name,dialect:n.dialect,defaultSchema:n.default_schema,defaultDatabase:n.default_database,searchValue:i},t[0]=n.default_database,t[1]=n.default_schema,t[2]=n.dialect,t[3]=n.name,t[4]=r.name,t[5]=i,t[6]=a):a=t[6];let o=a,s=n.name,c=r.schemas,u;t[7]===r?u=t[8]:(u=l(r),t[7]=r,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],t[9]=d):d=t[9];let f;t[10]!==r.schemas||t[11]!==u?(f=(0,Z.jsx)(vt,{schemas:c,schemasResolved:u,schemaPath:d,depth:0}),t[10]=r.schemas,t[11]=u,t[12]=f):f=t[12];let p;t[13]!==f||t[14]!==o?(p=(0,Z.jsx)(pt.Provider,{value:o,children:f}),t[13]=f,t[14]=o,t[15]=p):p=t[15];let m;return t[16]!==n.name||t[17]!==r||t[18]!==i||t[19]!==p?(m=(0,Z.jsx)(_t,{engineName:s,database:r,searchValue:i,children:p}),t[16]=n.name,t[17]=r,t[18]=i,t[19]=p,t[20]=m):m=t[20],m},_t=e=>{let t=(0,Y.c)(29),{searchValue:n,engineName:r,database:i,children:a}=e,o;t[0]!==i||t[1]!==n?(o=b(i,n),t[0]=i,t[1]=n,t[2]=o):o=t[2];let s=o,[c,l]=X.useState(s),[d,f]=X.useState(!1),[p,m]=X.useState(n),[h,g]=X.useState(s);(p!==n||h!==s)&&(m(n),g(s),l(s));let _;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=$(Q.database),t[3]=_):_=t[3];let v;t[4]!==c||t[5]!==d?(v=()=>{l(!c),f(!d)},t[4]=c,t[5]=d,t[6]=v):v=t[6];let y=`${r}:${i.name}`,x;t[7]===c?x=t[8]:(x=(0,Z.jsx)(_e,{isExpanded:c}),t[7]=c,t[8]=x);let S=d&&c?`text-foreground`:`text-muted-foreground`,C;t[9]===S?C=t[10]:(C=oe(`h-4 w-4`,S),t[9]=S,t[10]=C);let w;t[11]===C?w=t[12]:(w=(0,Z.jsx)(F,{className:C}),t[11]=C,t[12]=w);let T=d&&c&&`font-semibold`,E;t[13]===T?E=t[14]:(E=oe(T),t[13]=T,t[14]=E);let D;t[15]===i.name?D=t[16]:(D=i.name===``?(0,Z.jsx)(`i`,{children:`Not connected`}):i.name,t[15]=i.name,t[16]=D);let O;t[17]!==E||t[18]!==D?(O=(0,Z.jsx)(`span`,{className:E,children:D}),t[17]=E,t[18]=D,t[19]=O):O=t[19];let k;t[20]!==O||t[21]!==v||t[22]!==y||t[23]!==x||t[24]!==w?(k=(0,Z.jsxs)(u,{className:`text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none`,style:_,onSelect:v,value:y,children:[x,w,O]}),t[20]=O,t[21]=v,t[22]=y,t[23]=x,t[24]=w,t[25]=k):k=t[25];let A=c&&a,j;return t[26]!==k||t[27]!==A?(j=(0,Z.jsxs)(Z.Fragment,{children:[k,A]}),t[26]=k,t[27]=A,t[28]=j):j=t[28],j},vt=e=>{let{schemas:t,schemasResolved:n,depth:r}=e,i=mt(),{engineName:a,databaseName:o,searchValue:s}=i,{addSchemaList:c}=L(),l=We(e.schemaPath),[u,d]=X.useState(!1),{isPending:f,error:p}=Ne(async()=>{if(!n&&a){d(!0);try{let e=await A.request({engine:a,database:o,schemaPath:l});c({schemas:e.schemas??[],sqlSchemaContext:{engine:a,database:o,schemaPath:l}})}finally{d(!1)}}},[n,a,o,l]),h=$(it(r));return f||u?(0,Z.jsx)(ce,{message:`Loading schemas...`,style:h}):p?(0,Z.jsx)(le,{error:p,style:h}):t.length===0?(0,Z.jsx)(ue,{content:`No schemas available`,style:h}):(0,Z.jsx)(Z.Fragment,{children:t.map(e=>m(e.name)?(0,Z.jsx)(bt,{tables:e.tables,tablesResolved:W(e),searchValue:s,sqlTableContext:ht(i,{schema:e.name,schemaPath:l})},e.name):(0,Z.jsx)(yt,{schema:e,schemaPath:[...l,e.name],depth:r},e.name))})},yt=e=>{let t=(0,Y.c)(41),{schema:n,schemaPath:r,depth:i}=e,a=mt(),{databaseName:o,searchValue:s}=a,c;t[0]!==n||t[1]!==s?(c=p(n,s),t[0]=n,t[1]=s,t[2]=c):c=t[2];let l=c,[d,f]=X.useState(l),[m,h]=X.useState(!1),[g,_]=X.useState(s),[v,y]=X.useState(l),b;t[3]===r?b=t[4]:(b=r.join(`.`),t[3]=r,t[4]=b);let x=`${o}:${b}`,S;t[5]===n.child_schemas?S=t[6]:(S=n.child_schemas??[],t[5]=n.child_schemas,t[6]=S);let w=S;(g!==s||v!==l)&&(_(s),y(l),f(l));let T;t[7]===i?T=t[8]:(T=$(it(i)),t[7]=i,t[8]=T);let E;t[9]!==d||t[10]!==m?(E=()=>{f(!d),h(!m)},t[9]=d,t[10]=m,t[11]=E):E=t[11];let D;t[12]===d?D=t[13]:(D=(0,Z.jsx)(_e,{isExpanded:d}),t[12]=d,t[13]=D);let O=m&&d&&`text-foreground`,A;t[14]===O?A=t[15]:(A=oe(`h-4 w-4 text-muted-foreground`,O),t[14]=O,t[15]=A);let j;t[16]===A?j=t[17]:(j=(0,Z.jsx)(k,{className:A}),t[16]=A,t[17]=j);let M=m&&d&&`font-semibold`,N;t[18]===M?N=t[19]:(N=oe(M),t[18]=M,t[19]=N);let P;t[20]!==n.name||t[21]!==N?(P=(0,Z.jsx)(`span`,{className:N,children:n.name}),t[20]=n.name,t[21]=N,t[22]=P):P=t[22];let F;t[23]!==P||t[24]!==T||t[25]!==E||t[26]!==D||t[27]!==j||t[28]!==x?(F=(0,Z.jsxs)(u,{className:`text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none`,style:T,onSelect:E,value:x,children:[D,j,P]}),t[23]=P,t[24]=T,t[25]=E,t[26]=D,t[27]=j,t[28]=x,t[29]=F):F=t[29];let I;t[30]!==w||t[31]!==i||t[32]!==d||t[33]!==n||t[34]!==r||t[35]!==s||t[36]!==a?(I=d&&(0,Z.jsxs)(Z.Fragment,{children:[(w.length>0||!C(n))&&(0,Z.jsx)(vt,{schemas:w,schemasResolved:C(n),schemaPath:r,depth:i+1}),(0,Z.jsx)(bt,{tables:n.tables,tablesResolved:W(n),searchValue:s,tableIndentRem:at(i),columnIndentRem:ot(i),sqlTableContext:ht(a,{schema:n.name,schemaPath:r})})]}),t[30]=w,t[31]=i,t[32]=d,t[33]=n,t[34]=r,t[35]=s,t[36]=a,t[37]=I):I=t[37];let L;return t[38]!==F||t[39]!==I?(L=(0,Z.jsxs)(Z.Fragment,{children:[F,I]}),t[38]=F,t[39]=I,t[40]=L):L=t[40],L},bt=e=>{let t=(0,Y.c)(31),{tables:n,sqlTableContext:r,searchValue:i,tablesResolved:a,tableIndentRem:o,columnIndentRem:c}=e,l=a===void 0||a,{addTableList:u}=L(),[d,f]=X.useState(!1),p;t[0]!==u||t[1]!==r||t[2]!==l?(p=async()=>{if(!l&&r){f(!0);let{engine:e,database:t,schema:n,schemaPath:i}=r,a=await s.request({engine:e,database:t,schema:n,schemaPath:i??[]});if(!a?.tables)throw f(!1),Error(`No tables available`);u({tables:a.tables,sqlTableContext:r}),f(!1)}},t[0]=u,t[1]=r,t[2]=l,t[3]=p):p=t[3];let m;t[4]!==r||t[5]!==l?(m=[l,r],t[4]=r,t[5]=l,t[6]=m):m=t[6];let{isPending:h,error:g}=Ne(p,m),_=o??Q.tableLoading,v;t[7]===_?v=t[8]:(v=$(_),t[7]=_,t[8]=v);let y=v;if(h||d){let e;return t[9]===y?e=t[10]:(e=(0,Z.jsx)(ce,{message:`Loading tables...`,style:y}),t[9]=y,t[10]=e),e}if(g){let e;return t[11]!==g||t[12]!==y?(e=(0,Z.jsx)(le,{error:g,style:y}),t[11]=g,t[12]=y,t[13]=e):e=t[13],e}if(n.length===0){let e;return t[14]===y?e=t[15]:(e=(0,Z.jsx)(ue,{content:`No tables found`,style:y}),t[14]=y,t[15]=e),e}let b;if(t[16]!==c||t[17]!==i||t[18]!==r||t[19]!==o||t[20]!==n){let e;t[22]===i?e=t[23]:(e=e=>!i||e.name.toLowerCase().includes(i.toLowerCase()),t[22]=i,t[23]=e);let a=n.filter(e),s;t[24]!==c||t[25]!==i||t[26]!==r||t[27]!==o?(s=e=>(0,Z.jsx)(xt,{table:e,sqlTableContext:r,isSearching:!!i,tableIndentRem:o,columnIndentRem:c},e.name),t[24]=c,t[25]=i,t[26]=r,t[27]=o,t[28]=s):s=t[28],b=a.map(s),t[16]=c,t[17]=i,t[18]=r,t[19]=o,t[20]=n,t[21]=b}else b=t[21];let x;return t[29]===b?x=t[30]:(x=(0,Z.jsx)(Z.Fragment,{children:b}),t[29]=b,t[30]=x),x},xt=e=>{let t=(0,Y.c)(69),{table:n,sqlTableContext:i,isSearching:a,tableIndentRem:s,columnIndentRem:l}=e,{addTable:d}=L(),[p,m]=X.useState(!1),h=n.columns.length>0,_;t[0]!==d||t[1]!==p||t[2]!==i||t[3]!==n.name||t[4]!==h?(_=async()=>{if(p&&!h&&i){let{engine:e,database:t,schema:r,schemaPath:a}=i,o=await S.request({engine:e,database:t,schema:r,tableName:n.name,schemaPath:a??[]});if(!o?.table)throw Error(`No table details available`);d({table:o.table,sqlTableContext:i})}},t[0]=d,t[1]=p,t[2]=i,t[3]=n.name,t[4]=h,t[5]=_):_=t[5];let v;t[6]!==p||t[7]!==h?(v=[p,h],t[6]=p,t[7]=h,t[8]=v):v=t[8];let{isFetching:y,isPending:b,error:x}=Ne(_,v),C=r(ae),w=O(),{createNewCell:T}=f(),E=Ue(),D;t[9]!==E||t[10]!==C||t[11]!==T||t[12]!==w||t[13]!==i||t[14]!==n?(D=()=>{g({autoInstantiate:C,createNewCell:T,fromCellId:w}),E((()=>{if(n.source_type===`catalog`){let e=i?.database?[i.database,...i.schemaPath??[],n.name].join(`.`):n.name;return`${n.engine}.load_table("${e}")`}if(i)return ee({table:n,columnName:`*`,sqlTableContext:i});switch(n.source_type){case`local`:return`mo.ui.table(${n.name})`;case`duckdb`:case`connection`:return ee({table:n,columnName:`*`,sqlTableContext:i});default:return Se(n.source_type),``}})())},t[9]=E,t[10]=C,t[11]=T,t[12]=w,t[13]=i,t[14]=n,t[15]=D):D=t[15];let k=D,A;t[16]!==n.num_columns||t[17]!==n.num_rows?(A=()=>{let e=[];return n.num_rows!=null&&e.push(`${n.num_rows} rows`),n.num_columns!=null&&e.push(`${n.num_columns} columns`),e.length===0?null:(0,Z.jsx)(`div`,{className:`flex flex-row gap-2 items-center pl-6 group-hover:hidden`,children:(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.join(`, `)})})},t[16]=n.num_columns,t[17]=n.num_rows,t[18]=A):A=t[18];let j=A,M;t[19]!==l||t[20]!==x||t[21]!==y||t[22]!==b||t[23]!==i||t[24]!==n?(M=()=>{let e=$(l??Q.tableLoading);if(b||y)return(0,Z.jsx)(ce,{message:`Loading columns...`,style:e});if(x)return(0,Z.jsx)(le,{error:x,style:e});let t=n.columns;return t.length===0?(0,Z.jsx)(ue,{content:`No columns found`,style:e}):t.map(e=>(0,Z.jsx)(St,{table:n,column:e,sqlTableContext:i,columnIndentRem:l},e.name))},t[19]=l,t[20]=x,t[21]=y,t[22]=b,t[23]=i,t[24]=n,t[25]=M):M=t[25];let N=M,P;t[26]!==p||t[27]!==a||t[28]!==n.source_type||t[29]!==n.type?(P=()=>{if(n.source_type===`local`)return;let e=n.type===`table`?re:o;return(0,Z.jsx)(e,{className:`h-3 w-3`,strokeWidth:p||a?2.5:void 0})},t[26]=p,t[27]=a,t[28]=n.source_type,t[29]=n.type,t[30]=P):P=t[30];let F=P,I;t[31]!==i||t[32]!==n.name?(I=c(i,n.name),t[31]=i,t[32]=n.name,t[33]=I):I=t[33];let R=I,z=s??(i?Q.tableSchemaless:0),B=(p||a)&&`font-semibold`,V;t[34]===B?V=t[35]:(V=oe(`rounded-none group h-8 cursor-pointer`,B),t[34]=B,t[35]=V);let te;t[36]===z?te=t[37]:(te=$(z),t[36]=z,t[37]=te);let H;t[38]===p?H=t[39]:(H=()=>m(!p),t[38]=p,t[39]=H);let U;t[40]===F?U=t[41]:(U=F(),t[40]=F,t[41]=U);let W;t[42]===n.name?W=t[43]:(W=(0,Z.jsx)(`span`,{className:`text-sm`,children:n.name}),t[42]=n.name,t[43]=W);let ne;t[44]!==U||t[45]!==W?(ne=(0,Z.jsxs)(`div`,{className:`flex gap-2 items-center flex-1 pl-1`,children:[U,W]}),t[44]=U,t[45]=W,t[46]=ne):ne=t[46];let ie;t[47]===j?ie=t[48]:(ie=j(),t[47]=j,t[48]=ie);let G;t[49]===k?G=t[50]:(G=ye.stopPropagation(()=>k()),t[49]=k,t[50]=G);let se;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(Ae,{className:`h-3 w-3`}),t[51]=se):se=t[51];let K;t[52]===G?K=t[53]:(K=(0,Z.jsx)(ve,{content:`Add table to notebook`,delayDuration:400,children:(0,Z.jsx)(be,{className:`group-hover:inline-flex hidden`,variant:`text`,size:`icon`,onClick:G,children:se})}),t[52]=G,t[53]=K);let q;t[54]!==p||t[55]!==te||t[56]!==H||t[57]!==ne||t[58]!==ie||t[59]!==K||t[60]!==V||t[61]!==R?(q=(0,Z.jsxs)(u,{className:V,style:te,value:R,"aria-selected":p,forceMount:!0,onSelect:H,children:[ne,ie,K]}),t[54]=p,t[55]=te,t[56]=H,t[57]=ne,t[58]=ie,t[59]=K,t[60]=V,t[61]=R,t[62]=q):q=t[62];let J;t[63]!==p||t[64]!==N?(J=p&&N(),t[63]=p,t[64]=N,t[65]=J):J=t[65];let de;return t[66]!==q||t[67]!==J?(de=(0,Z.jsxs)(Z.Fragment,{children:[q,J]}),t[66]=q,t[67]=J,t[68]=de):de=t[68],de},St=e=>{let t=(0,Y.c)(51),{table:n,column:a,sqlTableContext:o,columnIndentRem:s}=e,[c,l]=X.useState(!1),d=r(j),f=i(ne);d&&c&&l(!1),f(c?e=>new Set([...e,`${n.name}:${a.name}`]):e=>(e.delete(`${n.name}:${a.name}`),new Set(e)));let p=Ue(),{columnsPreviews:m}=N(),h;t[0]!==a.name||t[1]!==n.primary_keys?(h=n.primary_keys?.includes(a.name)||!1,t[0]=a.name,t[1]=n.primary_keys,t[2]=h):h=t[2];let g=h,_;t[3]!==a.name||t[4]!==n.indexes?(_=n.indexes?.includes(a.name)||!1,t[3]=a.name,t[4]=n.indexes,t[5]=_):_=t[5];let v=_,y;t[6]===p?y=t[7]:(y=e=>{p(e)},t[6]=p,t[7]=y);let b=y,x=Ct,S=c?`font-semibold`:``,C;t[8]!==a.name||t[9]!==S?(C=(0,Z.jsx)(`span`,{className:S,children:a.name}),t[8]=a.name,t[9]=S,t[10]=C):C=t[10];let w=C,T=`${n.name}.${a.name}`,E=`${n.name}.${a.name}`,D;t[11]===c?D=t[12]:(D=()=>l(!c),t[11]=c,t[12]=D);let O;t[13]!==s||t[14]!==o?(O=s??(o?ot(0):Q.columnLocal),t[13]=s,t[14]=o,t[15]=O):O=t[15];let k;t[16]===O?k=t[17]:(k=$(O),t[16]=O,t[17]=k);let A;t[18]!==a.type||t[19]!==w?(A=(0,Z.jsx)(J,{columnName:w,dataType:a.type}),t[18]=a.type,t[19]=w,t[20]=A):A=t[20];let M;t[21]===g?M=t[22]:(M=g&&x({tooltipContent:`Primary key`,content:`PK`}),t[21]=g,t[22]=M);let P;t[23]===v?P=t[24]:(P=v&&x({tooltipContent:`Indexed`,content:`IDX`}),t[23]=v,t[24]=P);let F;t[25]!==k||t[26]!==A||t[27]!==M||t[28]!==P?(F=(0,Z.jsxs)(`div`,{className:`flex flex-row gap-2 items-center flex-1`,style:k,children:[A,M,P]}),t[25]=k,t[26]=A,t[27]=M,t[28]=P,t[29]=F):F=t[29];let I;t[30]===a.name?I=t[31]:(I=(0,Z.jsx)(ve,{content:`Copy column name`,delayDuration:400,children:(0,Z.jsx)(be,{variant:`text`,size:`icon`,className:`group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(Pe,{tooltip:!1,value:a.name,className:`h-3 w-3`})})}),t[30]=a.name,t[31]=I);let L;t[32]===a.external_type?L=t[33]:(L=(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a.external_type}),t[32]=a.external_type,t[33]=L);let R;t[34]!==F||t[35]!==I||t[36]!==L||t[37]!==T||t[38]!==E||t[39]!==D?(R=(0,Z.jsxs)(u,{className:`rounded-none py-1 group cursor-pointer`,value:E,onSelect:D,children:[F,I,L]},T),t[34]=F,t[35]=I,t[36]=L,t[37]=T,t[38]=E,t[39]=D,t[40]=R):R=t[40];let z;t[41]!==a||t[42]!==m||t[43]!==b||t[44]!==c||t[45]!==o||t[46]!==n?(z=c&&(0,Z.jsx)(`div`,{className:`pr-2 py-2 bg-(--slate-1) shadow-inner border-b`,style:$(Q.columnPreview),children:(0,Z.jsx)(G,{children:(0,Z.jsx)(ke,{table:n,column:a,onAddColumnChart:b,preview:m.get(o?`${o.database}.${o.schema}.${n.name}:${a.name}`:`${n.name}:${a.name}`),sqlTableContext:o})})}),t[41]=a,t[42]=m,t[43]=b,t[44]=c,t[45]=o,t[46]=n,t[47]=z):z=t[47];let B;return t[48]!==R||t[49]!==z?(B=(0,Z.jsxs)(Z.Fragment,{children:[R,z]}),t[48]=R,t[49]=z,t[50]=B):B=t[50],B};function Ct(e){let{tooltipContent:t,content:n}=e;return(0,Z.jsx)(ve,{content:t,delayDuration:100,children:(0,Z.jsx)(`span`,{className:`text-xs text-black bg-gray-100 dark:invert rounded px-1`,children:n})})}function wt(e){return e}var Tt={name:`name`,type:`type-value`,defs:`defs-refs`},Et=[wt({id:Tt.name,accessorFn:e=>[e.name,e.declaredBy],enableSorting:!0,sortingFn:`alphanumeric`,header:({column:e})=>(0,Z.jsx)(ge,{header:`Name`,column:e}),cell:({getValue:e})=>{let[t,n]=e();return(0,Z.jsx)(qe,{name:t,declaredBy:n})}}),wt({id:Tt.type,accessorFn:e=>[e.dataType,e.value],enableSorting:!0,sortingFn:`alphanumeric`,header:({column:e})=>(0,Z.jsx)(ge,{header:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{children:`Type`}),(0,Z.jsx)(`span`,{children:`Value`})]}),column:e}),cell:({getValue:e})=>{let[t,n]=e();return(0,Z.jsxs)(`div`,{className:`max-w-[150px]`,children:[(0,Z.jsx)(`div`,{className:`text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs`,children:t}),(0,Z.jsx)(`div`,{className:`text-ellipsis overflow-hidden whitespace-nowrap`,title:n??``,children:n})]})}}),wt({id:Tt.defs,accessorFn:e=>[e.declaredBy,e.usedBy,e.name,e.declaredByNames,e.usedByNames],enableSorting:!0,sortingFn:`basic`,header:({column:e})=>(0,Z.jsx)(ge,{header:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{children:`Declared By`}),(0,Z.jsx)(`span`,{children:`Used By`})]}),column:e}),cell:({getValue:e})=>{let[t,n,r]=e(),i=e=>{let t=P(e);t&&T(t,r)};return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 py-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-row overflow-auto gap-2 items-center`,children:[(0,Z.jsx)(`span`,{title:`Declared by`,children:(0,Z.jsx)(nt,{className:`w-3.5 h-3.5 text-muted-foreground`})}),t.length===1?(0,Z.jsx)(Fe,{variant:`focus`,cellId:t[0],skipScroll:!0,onClick:()=>i(t[0])}):(0,Z.jsx)(`div`,{className:`text-destructive flex flex-row gap-2`,children:t.slice(0,3).map((e,n)=>(0,Z.jsxs)(`span`,{className:`flex`,children:[(0,Z.jsx)(Fe,{variant:`focus`,cellId:e,skipScroll:!0,className:`whitespace-nowrap text-destructive`,onClick:()=>i(e)},e),n<t.length-1&&`, `]},e))})]}),(0,Z.jsxs)(`div`,{className:`flex flex-row overflow-auto gap-2 items-baseline`,children:[(0,Z.jsx)(`span`,{title:`Used by`,children:(0,Z.jsx)(je,{className:`w-3.5 h-3.5 text-muted-foreground`})}),(0,Z.jsx)(Ke,{maxCount:3,cellIds:n,skipScroll:!0,onClick:i})]})]})}})];function Dt({variables:e,sort:t,cellIdToIndex:n}){t||={id:Tt.defs,desc:!1};let r=[];switch(t.id){case Tt.name:r=xe(e,e=>e.name);break;case Tt.type:r=xe(e,e=>e.dataType);break;case Tt.defs:r=xe(e,e=>n.get(e.declaredBy[0]))}return t.desc?r.toReversed():r}var Ot=(0,X.memo)(({className:e,cellIds:t,variables:n})=>{let[r,i]=X.useState([]),[a,o]=X.useState(``),s=x(),{locale:c}=Me(),l=(0,X.useMemo)(()=>{let e=e=>{let n=s[e];return D(n)?`cell-${t.indexOf(e)}`:n??`cell-${t.indexOf(e)}`};return Object.values(n).map(t=>({...t,declaredByNames:t.declaredBy.map(e),usedByNames:t.usedBy.map(e)}))},[n,s,t]),u=(0,X.useMemo)(()=>{let e=new Map;return t.forEach((t,n)=>e.set(t,n)),Dt({variables:l,sort:r[0],cellIdToIndex:e})},[l,r,t]),d=he({data:u,columns:Et,getCoreRowModel:de(),onGlobalFilterChange:o,getFilteredRowModel:q(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter(e){return e.columnDef.enableGlobalFilter??!0},globalFilterFn:`auto`,manualSorting:!0,locale:c,onSortingChange:i,getSortedRowModel:me(),state:{sorting:r,globalFilter:a}});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Oe,{className:`w-full`,placeholder:`Search`,value:a,onChange:e=>o(e.target.value)}),(0,Z.jsxs)(Ve,{className:oe(`w-full text-sm flex-1 border-separate border-spacing-0`,e),children:[(0,Z.jsx)(Ie,{children:(0,Z.jsx)(ze,{className:`whitespace-nowrap text-xs`,children:d.getFlatHeaders().map(e=>(0,Z.jsx)(Le,{className:`sticky top-0 bg-background border-b`,children:pe(e.column.columnDef.header,e.getContext())},e.id))})}),(0,Z.jsx)(Re,{children:d.getRowModel().rows.map(e=>(0,Z.jsx)(ze,{className:`hover:bg-accent`,children:e.getVisibleCells().map(e=>(0,Z.jsx)(Be,{className:`border-b`,children:pe(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]})]})});Ot.displayName=`VariableTable`;var kt=()=>{let e=(0,Y.c)(30),n=M(),i=y(),a=r(H),o=r(I),s=E(`database`),[c,l]=t(tt),u=a.length+o.length,d;e[0]!==u||e[1]!==c.hasUserInteracted||e[2]!==c.openSections?(d=!c.hasUserInteracted&&u>0?[...new Set([...c.openSections,`datasources`])]:c.openSections,e[0]=u,e[1]=c.hasUserInteracted,e[2]=c.openSections,e[3]=d):d=e[3];let f=d,p;e[4]===l?p=e[5]:(p=e=>{l({openSections:e,hasUserInteracted:!0})},e[4]=l,e[5]=p);let m=p,h;e[6]===f?h=e[7]:(h=f.includes(`datasources`),e[6]=f,e[7]=h);let g=!h&&u>0,v=s.length>0,b;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(F,{className:`w-4 h-4`}),e[8]=b):b=e[8];let x;e[9]!==u||e[10]!==g?(x=g&&(0,Z.jsx)(Je,{children:u}),e[9]=u,e[10]=g,e[11]=x):x=e[11];let S;e[12]!==s.length||e[13]!==v?(S=v&&(0,Z.jsx)(et,{count:s.length,type:`database`}),e[12]=s.length,e[13]=v,e[14]=S):S=e[14];let C;e[15]!==x||e[16]!==S?(C=(0,Z.jsxs)(Ye,{children:[b,`Data sources`,x,S]}),e[15]=x,e[16]=S,e[17]=C):C=e[17];let w;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Xe,{children:(0,Z.jsx)(dt,{})}),e[18]=w):w=e[18];let T;e[19]===C?T=e[20]:(T=(0,Z.jsxs)(Qe,{value:`datasources`,children:[C,w]}),e[19]=C,e[20]=T);let D;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsxs)(Ye,{children:[(0,Z.jsx)(_,{className:`w-4 h-4`}),`Variables`]}),e[21]=D):D=e[21];let O;e[22]!==i||e[23]!==n?(O=(0,Z.jsxs)(Qe,{value:`variables`,lastItem:!0,children:[D,(0,Z.jsx)(Xe,{children:Object.keys(n).length===0?(0,Z.jsx)(`div`,{className:`px-3 py-4 text-sm text-muted-foreground`,children:`No variables defined`}):(0,Z.jsx)(Ot,{cellIds:i.inOrderIds,variables:n})})]}),e[22]=i,e[23]=n,e[24]=O):O=e[24];let k;return e[25]!==m||e[26]!==f||e[27]!==O||e[28]!==T?(k=(0,Z.jsxs)(K,{type:`multiple`,value:f,onValueChange:m,className:`flex flex-col h-full overflow-auto`,children:[T,O]}),e[25]=m,e[26]=f,e[27]=O,e[28]=T,e[29]=k):k=e[29],k};export{kt as default};
@@ -1 +1 @@
1
- import{l as e}from"./useEvent-xfs0Sn4r.js";import{a as t}from"./cells-Cp-G34Rz.js";import{t as n}from"./compiler-runtime-CYIjoINj.js";import{o as r}from"./utils-D5Ywm7-q.js";import{g as i}from"./useEventListener-92uWqz-P.js";import{t as a}from"./objects-snlMn4yk.js";import{T as o,v as s}from"./config-BlNM0caL.js";import{t as c}from"./cn-ldLVeaqm.js";import{t as l}from"./jsx-runtime-B74pBk57.js";import{s as u,u as d}from"./download-DMxOzI7b.js";import{r as f}from"./requests-C6_IaFh7.js";import{c as p,t as m}from"./layout-CC2AHMrW.js";import{t as h}from"./Deferred-CrTnjj37.js";import{t as g}from"./use-toast-DpWHUGuF.js";import{t as _}from"./useInterval-B4v7_zd0.js";var v=n(),y=class{capturedInputs=new Map;inFlight=new Map;cancelEntry(e){e.controller.abort(),e.deferred.status===`pending`&&e.deferred.resolve(void 0)}needsCapture(e,t){if(this.capturedInputs.get(e)===t)return!1;let n=this.inFlight.get(e);return!(n&&n.inputValue===t)}waitForInFlight(e,t){let n=this.inFlight.get(e);return n&&n.inputValue===t?n.deferred.promise:null}startCapture(e,t){let n=this.inFlight.get(e);n&&this.cancelEntry(n);let r=new AbortController,i=new h,a={controller:r,inputValue:t,deferred:i};return this.inFlight.set(e,a),{signal:r.signal,markCaptured:n=>{this.inFlight.get(e)===a&&(i.resolve(n),this.capturedInputs.set(e,t),this.inFlight.delete(e))},markFailed:()=>{this.inFlight.get(e)===a&&(i.resolve(void 0),this.inFlight.delete(e))}}}prune(e){for(let t of this.capturedInputs.keys())e.has(t)||this.capturedInputs.delete(t);for(let[t,n]of this.inFlight)e.has(t)||(this.cancelEntry(n),this.inFlight.delete(t))}get isCapturing(){return this.inFlight.size>0}abort(){for(let e of this.inFlight.values())this.cancelEntry(e);this.inFlight.clear()}reset(){this.abort(),this.capturedInputs.clear()}},b=5e3;function x(){let t=(0,v.c)(20),n=e(r),{state:i}=e(s),a;t[0]===n.auto_download?a=t[1]:(a=n.auto_download.includes(`markdown`),t[0]=n.auto_download,t[1]=a);let c=a,l;t[2]===n.auto_download?l=t[3]:(l=n.auto_download.includes(`html`),t[2]=n.auto_download,t[3]=l);let u=l,h;t[4]===n.auto_download?h=t[5]:(h=n.auto_download.includes(`ipynb`),t[4]=n.auto_download,t[5]=h);let g=h,y=i===o.OPEN,x=!c||!y,S=!u||!y,C=!g||!y,{autoExportAsHTML:E,autoExportAsIPYNB:D,autoExportAsMarkdown:O,updateCellOutputs:k}=f(),A=w(),j;t[6]===O?j=t[7]:(j=async()=>{await O({download:!1})},t[6]=O,t[7]=j);let M;t[8]===x?M=t[9]:(M={delayMs:b,whenVisible:!0,disabled:x},t[8]=x,t[9]=M),_(j,M);let N;t[10]===E?N=t[11]:(N=async()=>{await E({download:!1,includeCode:!0,files:p.INSTANCE.filenames(),layout:await m()})},t[10]=E,t[11]=N);let P;t[12]===S?P=t[13]:(P={delayMs:b,whenVisible:!0,disabled:S},t[12]=S,t[13]=P),_(N,P);let F;t[14]!==D||t[15]!==A||t[16]!==k?(F=async()=>{await T({takeScreenshots:()=>A({progress:d.indeterminate()}),updateCellOutputs:k}),await D({download:!1})},t[14]=D,t[15]=A,t[16]=k,t[17]=F):F=t[17];let I;t[18]===C?I=t[19]:(I={delayMs:b,whenVisible:!0,disabled:C,skipIfRunning:!0},t[18]=C,t[19]=I),_(F,I)}var S=new Set([`text/html`,`application/vnd.vegalite.v5+json`,`application/vnd.vega.v5+json`,`application/vnd.vegalite.v6+json`,`application/vnd.vega.v6+json`]),C=new y;function w(){let n=e(t);return async e=>{let{progress:t}=e,r=new Set(a.keys(n));C.prune(r);let o=[],s=[];for(let[e,t]of a.entries(n)){let n=t.output?.data;if(t.output?.mimetype&&S.has(t.output.mimetype)&&n){if(C.needsCapture(e,n))o.push([e,n]);else{let t=C.waitForInFlight(e,n);t&&s.push({cellId:e,promise:t})}}}if(o.length===0&&s.length===0)return{};o.length>0&&t.addTotal(o.length);let c={};for(let[e,n]of o){let r=C.startCapture(e,n);try{let t=await u(e);if(r.signal.aborted)continue;if(!t){i.error(`Failed to capture screenshot for cell ${e}`),r.markFailed();continue}let n=[`image/png`,t];c[e]=n,r.markCaptured(n)}catch(t){i.error(`Error screenshotting cell ${e}:`,t),r.markFailed()}finally{t.increment(1)}}let l=await Promise.allSettled(s.map(({promise:e})=>e));for(let[e,{cellId:t}]of s.entries()){let n=l[e];n.status===`fulfilled`&&n.value&&(c[t]=n.value)}return c}}async function T(e){let{takeScreenshots:t,updateCellOutputs:n}=e;try{let e=await t();a.size(e)>0&&await n({cellIdsToOutput:e})}catch(e){i.error(`Error updating cell outputs with screenshots:`,e),g({title:`Failed to capture cell outputs`,description:`Some outputs may be missing from the export. Continuing.`,variant:`danger`})}}var E=l(),D=e=>{let t=(0,v.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=c(`animate-pulse rounded-md bg-muted`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,E.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};export{w as i,T as n,x as r,D as t};
1
+ import{l as e}from"./useEvent-xfs0Sn4r.js";import{a as t}from"./cells-Cp-G34Rz.js";import{t as n}from"./compiler-runtime-CYIjoINj.js";import{o as r}from"./utils-D5Ywm7-q.js";import{g as i}from"./useEventListener-92uWqz-P.js";import{t as a}from"./objects-snlMn4yk.js";import{T as o,v as s}from"./config-BlNM0caL.js";import{t as c}from"./cn-ldLVeaqm.js";import{t as l}from"./jsx-runtime-B74pBk57.js";import{s as u,u as d}from"./download-DMxOzI7b.js";import{r as f}from"./requests-C6_IaFh7.js";import{c as p,t as m}from"./layout-DWnrxIo2.js";import{t as h}from"./Deferred-CrTnjj37.js";import{t as g}from"./use-toast-DpWHUGuF.js";import{t as _}from"./useInterval-B4v7_zd0.js";var v=n(),y=class{capturedInputs=new Map;inFlight=new Map;cancelEntry(e){e.controller.abort(),e.deferred.status===`pending`&&e.deferred.resolve(void 0)}needsCapture(e,t){if(this.capturedInputs.get(e)===t)return!1;let n=this.inFlight.get(e);return!(n&&n.inputValue===t)}waitForInFlight(e,t){let n=this.inFlight.get(e);return n&&n.inputValue===t?n.deferred.promise:null}startCapture(e,t){let n=this.inFlight.get(e);n&&this.cancelEntry(n);let r=new AbortController,i=new h,a={controller:r,inputValue:t,deferred:i};return this.inFlight.set(e,a),{signal:r.signal,markCaptured:n=>{this.inFlight.get(e)===a&&(i.resolve(n),this.capturedInputs.set(e,t),this.inFlight.delete(e))},markFailed:()=>{this.inFlight.get(e)===a&&(i.resolve(void 0),this.inFlight.delete(e))}}}prune(e){for(let t of this.capturedInputs.keys())e.has(t)||this.capturedInputs.delete(t);for(let[t,n]of this.inFlight)e.has(t)||(this.cancelEntry(n),this.inFlight.delete(t))}get isCapturing(){return this.inFlight.size>0}abort(){for(let e of this.inFlight.values())this.cancelEntry(e);this.inFlight.clear()}reset(){this.abort(),this.capturedInputs.clear()}},b=5e3;function x(){let t=(0,v.c)(20),n=e(r),{state:i}=e(s),a;t[0]===n.auto_download?a=t[1]:(a=n.auto_download.includes(`markdown`),t[0]=n.auto_download,t[1]=a);let c=a,l;t[2]===n.auto_download?l=t[3]:(l=n.auto_download.includes(`html`),t[2]=n.auto_download,t[3]=l);let u=l,h;t[4]===n.auto_download?h=t[5]:(h=n.auto_download.includes(`ipynb`),t[4]=n.auto_download,t[5]=h);let g=h,y=i===o.OPEN,x=!c||!y,S=!u||!y,C=!g||!y,{autoExportAsHTML:E,autoExportAsIPYNB:D,autoExportAsMarkdown:O,updateCellOutputs:k}=f(),A=w(),j;t[6]===O?j=t[7]:(j=async()=>{await O({download:!1})},t[6]=O,t[7]=j);let M;t[8]===x?M=t[9]:(M={delayMs:b,whenVisible:!0,disabled:x},t[8]=x,t[9]=M),_(j,M);let N;t[10]===E?N=t[11]:(N=async()=>{await E({download:!1,includeCode:!0,files:p.INSTANCE.filenames(),layout:await m()})},t[10]=E,t[11]=N);let P;t[12]===S?P=t[13]:(P={delayMs:b,whenVisible:!0,disabled:S},t[12]=S,t[13]=P),_(N,P);let F;t[14]!==D||t[15]!==A||t[16]!==k?(F=async()=>{await T({takeScreenshots:()=>A({progress:d.indeterminate()}),updateCellOutputs:k}),await D({download:!1})},t[14]=D,t[15]=A,t[16]=k,t[17]=F):F=t[17];let I;t[18]===C?I=t[19]:(I={delayMs:b,whenVisible:!0,disabled:C,skipIfRunning:!0},t[18]=C,t[19]=I),_(F,I)}var S=new Set([`text/html`,`application/vnd.vegalite.v5+json`,`application/vnd.vega.v5+json`,`application/vnd.vegalite.v6+json`,`application/vnd.vega.v6+json`]),C=new y;function w(){let n=e(t);return async e=>{let{progress:t}=e,r=new Set(a.keys(n));C.prune(r);let o=[],s=[];for(let[e,t]of a.entries(n)){let n=t.output?.data;if(t.output?.mimetype&&S.has(t.output.mimetype)&&n){if(C.needsCapture(e,n))o.push([e,n]);else{let t=C.waitForInFlight(e,n);t&&s.push({cellId:e,promise:t})}}}if(o.length===0&&s.length===0)return{};o.length>0&&t.addTotal(o.length);let c={};for(let[e,n]of o){let r=C.startCapture(e,n);try{let t=await u(e);if(r.signal.aborted)continue;if(!t){i.error(`Failed to capture screenshot for cell ${e}`),r.markFailed();continue}let n=[`image/png`,t];c[e]=n,r.markCaptured(n)}catch(t){i.error(`Error screenshotting cell ${e}:`,t),r.markFailed()}finally{t.increment(1)}}let l=await Promise.allSettled(s.map(({promise:e})=>e));for(let[e,{cellId:t}]of s.entries()){let n=l[e];n.status===`fulfilled`&&n.value&&(c[t]=n.value)}return c}}async function T(e){let{takeScreenshots:t,updateCellOutputs:n}=e;try{let e=await t();a.size(e)>0&&await n({cellIdsToOutput:e})}catch(e){i.error(`Error updating cell outputs with screenshots:`,e),g({title:`Failed to capture cell outputs`,description:`Some outputs may be missing from the export. Continuing.`,variant:`danger`})}}var E=l(),D=e=>{let t=(0,v.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=c(`animate-pulse rounded-md bg-muted`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,E.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};export{w as i,T as n,x as r,D as t};