@marimo-team/frontend 0.19.8-dev38 → 0.19.8-dev39

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.
@@ -1 +1 @@
1
- import{s as H}from"./chunk-LvLJmgfZ.js";import{d as ae,u as oe}from"./useEvent-BhXAndur.js";import{t as le}from"./react-Bj1aDYRI.js";import{Yn as V}from"./cells-B0XKj2oa.js";import"./react-dom-CSu739Rf.js";import{t as ie}from"./compiler-runtime-B3qBwwSJ.js";import{r as ce}from"./ai-model-dropdown-BHE9fW6D.js";import{y as de}from"./utils-YqBXNpsM.js";import{S as me}from"./config-D2-Bw6QC.js";import{t as xe}from"./jsx-runtime-ZmTK25f3.js";import{r as pe}from"./button-CZ3Cs4qb.js";import{t as K}from"./cn-BKtXLv3a.js";import"./dist-DBwNzi3C.js";import"./cjs-CH5Rj0g8.js";import"./main-U5Goe76G.js";import"./useNonce-CS26E0hA.js";import{r as W}from"./requests-B4FYHTZl.js";import{r as ue}from"./x-ZP5cObgf.js";import{t as fe}from"./chevron-right--18M_6o9.js";import{u as ge}from"./toDate-DETS9bBd.js";import{t as R}from"./spinner-DA8-7wQv.js";import{a as he}from"./input-DHHmNa19.js";import"./dist-Cayq-K1c.js";import"./dist-TiFCI16_.js";import"./dist-BIKFl48f.js";import"./dist-B0VqT_4z.js";import"./dist-BYyu59D8.js";import{t as ve}from"./use-toast-T0_cQDma.js";import"./session-fBtIbMpB.js";import"./Combination-izwufzWe.js";import{t as J}from"./tooltip-C_WgOOcZ.js";import"./popover-B-131r4d.js";import{t as je}from"./copy-BaRrAFL-.js";import{i as be,n as Y,r as F,s as Q,t as ke}from"./useInstallPackage-Co79H1lQ.js";import{n as X}from"./error-banner-w4pz2qUB.js";import{n as ye}from"./useAsyncData-CgmD3hjw.js";import{a as Ne,i as q,n as we,o as Z,r as B,t as Se}from"./table-BOsFCeLh.js";import{t as ee}from"./empty-state-DrmGF88A.js";var G=ie(),I=H(le(),1);function _e(t){let e=t.trim();for(let s of["pip install","pip3 install","uv add","uv pip install","poetry add","conda install","pipenv install"])if(e.toLowerCase().startsWith(s.toLowerCase()))return e.slice(s.length).trim();return e}var r=H(xe(),1),te=t=>{let e=(0,G.c)(9),{onClick:s,loading:n,children:l,className:x}=t;if(n){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,r.jsx)(R,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=c):c=e[0],c}let d;e[1]===x?d=e[2]:(d=K("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",x),e[1]=x,e[2]=d);let a;e[3]===s?a=e[4]:(a=pe.stopPropagation(s),e[3]=s,e[4]=a);let o;return e[5]!==l||e[6]!==d||e[7]!==a?(o=(0,r.jsx)("button",{type:"button",className:d,onClick:a,children:l}),e[5]=l,e[6]=d,e[7]=a,e[8]=o):o=e[8],o},Ce=()=>{var w,S;let t=(0,G.c)(30),[e]=de(),s=e.package_management.manager,{getDependencyTree:n,getPackageList:l}=W(),[x,d]=I.useState(null),a;t[0]!==n||t[1]!==l?(a=async()=>{let[u,C]=await Promise.all([l(),n()]);return{list:u.packages,tree:C.tree}},t[0]=n,t[1]=l,t[2]=a):a=t[2];let o;t[3]===s?o=t[4]:(o=[s],t[3]=s,t[4]=o);let{data:c,error:m,refetch:j,isPending:g}=ye(a,o);if(g){let u;return t[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,r.jsx)(R,{size:"medium",centered:!0}),t[5]=u):u=t[5],u}if(m){let u;return t[6]===m?u=t[7]:(u=(0,r.jsx)(X,{error:m}),t[6]=m,t[7]=u),u}let h=c.tree!=null,i;t[8]!==h||t[9]!==x?(i=De(x,h),t[8]=h,t[9]=x,t[10]=i):i=t[10];let f=i,p=(w=c.tree)==null?void 0:w.name,P=(S=c==null?void 0:c.tree)==null?void 0:S.version,y=p==="<root>",k;t[11]!==s||t[12]!==j?(k=(0,r.jsx)(Pe,{packageManager:s,onSuccess:j}),t[11]=s,t[12]=j,t[13]=k):k=t[13];let b;t[14]!==y||t[15]!==h||t[16]!==p||t[17]!==P||t[18]!==f?(b=h&&(0,r.jsxs)("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[(0,r.jsxs)("div",{className:"flex gap-1",children:[(0,r.jsx)("button",{type:"button",className:K("px-2 py-1 text-xs rounded",f==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>d("list"),children:"List"}),(0,r.jsx)("button",{type:"button",className:K("px-2 py-1 text-xs rounded",f==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>d("tree"),children:"Tree"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium",title:y?"sandbox":"project",children:y?"sandbox":"project"}),p&&!y&&(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[p,P&&` v${P}`]})]})]}),t[14]=y,t[15]=h,t[16]=p,t[17]=P,t[18]=f,t[19]=b):b=t[19];let v;t[20]!==c.list||t[21]!==c.tree||t[22]!==m||t[23]!==j||t[24]!==f?(v=f==="list"?(0,r.jsx)(Ee,{packages:c.list,onSuccess:j}):(0,r.jsx)($e,{tree:c.tree,error:m,onSuccess:j}),t[20]=c.list,t[21]=c.tree,t[22]=m,t[23]=j,t[24]=f,t[25]=v):v=t[25];let _;return t[26]!==k||t[27]!==b||t[28]!==v?(_=(0,r.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[k,b,v]}),t[26]=k,t[27]=b,t[28]=v,t[29]=_):_=t[29],_},Pe=t=>{let e=(0,G.c)(40),{onSuccess:s,packageManager:n}=t,[l,x]=I.useState(""),{handleClick:d}=ce(),a=oe(Q),o=ae(Q),c,m;e[0]!==a||e[1]!==o?(c=()=>{a&&(x(a),o(null))},m=[a,o],e[0]=a,e[1]=o,e[2]=c,e[3]=m):(c=e[2],m=e[3]),I.useEffect(c,m);let{loading:j,handleInstallPackages:g}=ke(),h;e[4]===s?h=e[5]:(h=()=>{s(),x("")},e[4]=s,e[5]=h);let i=h,f;e[6]!==g||e[7]!==l||e[8]!==i?(f=()=>{g([_e(l)],i)},e[6]=g,e[7]=l,e[8]=i,e[9]=f):f=e[9];let p=f,P=`Install packages with ${n}...`,y;e[10]!==j||e[11]!==d?(y=j?(0,r.jsx)(R,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):(0,r.jsx)(J,{content:"Change package manager",children:(0,r.jsx)(V,{onClick:()=>d("packageManagementAndData"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=j,e[11]=d,e[12]=y):y=e[12];let k;e[13]===p?k=e[14]:(k=U=>{U.key==="Enter"&&(U.preventDefault(),p())},e[13]=p,e[14]=k);let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=U=>x(U.target.value),e[15]=b):b=e[15];let v;e[16]!==l||e[17]!==P||e[18]!==y||e[19]!==k?(v=(0,r.jsx)(he,{placeholder:P,id:be,icon:y,rootClassName:"flex-1 border-none",value:l,onKeyDown:k,onChange:b}),e[16]=l,e[17]=P,e[18]=y,e[19]=k,e[20]=v):v=e[20];let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=_):_=e[21];let w,S;e[22]===Symbol.for("react.memo_cache_sentinel")?(w=(0,r.jsxs)("div",{children:[_," A package name; this will install the latest version.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),S=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=w,e[23]=S):(w=e[22],S=e[23]);let u,C;e[24]===Symbol.for("react.memo_cache_sentinel")?(u=(0,r.jsxs)("div",{children:[S," ","A package with a specific version or version range.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),C=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=u,e[25]=C):(u=e[24],C=e[25]);let E,$;e[26]===Symbol.for("react.memo_cache_sentinel")?(E=(0,r.jsxs)("div",{children:[C," A Git repository",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),$=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=E,e[27]=$):(E=e[26],$=e[27]);let D,T;e[28]===Symbol.for("react.memo_cache_sentinel")?(D=(0,r.jsxs)("div",{children:[$," A remote wheel or source distribution.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),T=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=D,e[29]=T):(D=e[28],T=e[29]);let A;e[30]===Symbol.for("react.memo_cache_sentinel")?(A=(0,r.jsx)(J,{delayDuration:300,side:"left",align:"start",content:(0,r.jsxs)("div",{className:"text-sm flex flex-col w-full max-w-[360px]",children:["Packages are installed using the package manager specified in your user configuration. Depending on your package manager, you can install packages with various formats:",(0,r.jsxs)("div",{className:"flex flex-col gap-2 mt-2",children:[w,u,E,D,(0,r.jsxs)("div",{children:[T," A local wheel, source distribution, or project directory.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:(0,r.jsx)(ge,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=A):A=e[30];let L=l&&"bg-accent text-accent-foreground",N;e[31]===L?N=e[32]:(N=K("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",L,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=L,e[32]=N);let z=!l,M;e[33]!==p||e[34]!==N||e[35]!==z?(M=(0,r.jsx)("button",{type:"button",className:N,onClick:p,disabled:z,children:"Add"}),e[33]=p,e[34]=N,e[35]=z,e[36]=M):M=e[36];let O;return e[37]!==M||e[38]!==v?(O=(0,r.jsxs)("div",{className:"flex items-center w-full border-b",children:[v,A,M]}),e[37]=M,e[38]=v,e[39]=O):O=e[39],O},Ee=t=>{let e=(0,G.c)(9),{onSuccess:s,packages:n}=t;if(n.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,r.jsx)(ee,{title:"No packages",description:"No packages are installed in this environment.",icon:(0,r.jsx)(V,{})}),e[0]=a):a=e[0],a}let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=(0,r.jsx)(Ne,{children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(q,{children:"Name"}),(0,r.jsx)(q,{children:"Version"}),(0,r.jsx)(q,{})]})}),e[1]=l):l=e[1];let x;if(e[2]!==s||e[3]!==n){let a;e[5]===s?a=e[6]:(a=o=>(0,r.jsxs)(Z,{className:"group",onClick:async()=>{await je(`${o.name}==${o.version}`),ve({title:"Copied to clipboard"})},children:[(0,r.jsx)(B,{children:o.name}),(0,r.jsx)(B,{children:o.version}),(0,r.jsxs)(B,{className:"flex justify-end",children:[(0,r.jsx)(re,{packageName:o.name,onSuccess:s}),(0,r.jsx)(se,{packageName:o.name,onSuccess:s})]})]},o.name),e[5]=s,e[6]=a),x=n.map(a),e[2]=s,e[3]=n,e[4]=x}else x=e[4];let d;return e[7]===x?d=e[8]:(d=(0,r.jsxs)(Se,{className:"overflow-auto flex-1",children:[l,(0,r.jsx)(we,{children:x})]}),e[7]=x,e[8]=d),d},re=({packageName:t,onSuccess:e})=>{let[s,n]=I.useState(!1),{addPackage:l}=W();return me()?null:(0,r.jsx)(te,{onClick:async()=>{try{n(!0);let x=await l({package:t,upgrade:!0});x.success?(e(),F(t)):F(t,x.error)}finally{n(!1)}},loading:s,children:"Upgrade"})},se=({packageName:t,tags:e,onSuccess:s})=>{let[n,l]=I.useState(!1),{removePackage:x}=W();return(0,r.jsx)(te,{onClick:async()=>{try{l(!0);let d=e==null?void 0:e.some(o=>o.kind==="group"&&o.value==="dev"),a=await x({package:t,dev:d});a.success?(s(),Y(t)):Y(t,a.error)}finally{l(!1)}},loading:n,children:"Remove"})},$e=t=>{let e=(0,G.c)(18),{tree:s,error:n,onSuccess:l}=t,x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=new Set,e[0]=x):x=e[0];let[d,a]=I.useState(x),o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a(new Set)},e[1]=o):o=e[1];let c;if(e[2]===s?c=e[3]:(c=[s],e[2]=s,e[3]=c),I.useEffect(o,c),n){let i;return e[4]===n?i=e[5]:(i=(0,r.jsx)(X,{error:n}),e[4]=n,e[5]=i),i}if(!s){let i;return e[6]===Symbol.for("react.memo_cache_sentinel")?(i=(0,r.jsx)(R,{size:"medium",centered:!0}),e[6]=i):i=e[6],i}if(s.dependencies.length===0){let i;return e[7]===Symbol.for("react.memo_cache_sentinel")?(i=(0,r.jsx)(ee,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:(0,r.jsx)(V,{})}),e[7]=i):i=e[7],i}let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=i=>{a(f=>{let p=new Set(f);return p.has(i)?p.delete(i):p.add(i),p})},e[8]=m):m=e[8];let j=m,g;if(e[9]!==d||e[10]!==l||e[11]!==s.dependencies){let i;e[13]!==d||e[14]!==l?(i=(f,p)=>(0,r.jsx)("div",{className:"border-b",children:(0,r.jsx)(ne,{nodeId:`root-${p}`,node:f,level:0,isTopLevel:!0,expandedNodes:d,onToggle:j,onSuccess:l})},`${f.name}-${p}`),e[13]=d,e[14]=l,e[15]=i):i=e[15],g=s.dependencies.map(i),e[9]=d,e[10]=l,e[11]=s.dependencies,e[12]=g}else g=e[12];let h;return e[16]===g?h=e[17]:(h=(0,r.jsx)("div",{className:"flex-1 overflow-auto",children:(0,r.jsx)("div",{children:g})}),e[16]=g,e[17]=h),h},ne=t=>{let e=(0,G.c)(58),{nodeId:s,node:n,level:l,isTopLevel:x,expandedNodes:d,onToggle:a,onSuccess:o}=t,c=x===void 0?!1:x,m=n.dependencies.length>0,j;e[0]!==d||e[1]!==s?(j=d.has(s),e[0]=d,e[1]=s,e[2]=j):j=e[2];let g=j,h=c?0:16+l*16,i;e[3]!==m||e[4]!==s||e[5]!==a?(i=N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),m&&a(s))},e[3]=m,e[4]=s,e[5]=a,e[6]=i):i=e[6];let f=i,p;e[7]!==m||e[8]!==s||e[9]!==a?(p=N=>{N.stopPropagation(),m&&a(s)},e[7]=m,e[8]=s,e[9]=a,e[10]=p):p=e[10];let P=p,y=m&&"select-none",k=c?"px-2 py-0.5":"",b;e[11]!==y||e[12]!==k?(b=K("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-(--slate-2) focus:bg-(--slate-2) focus:outline-hidden",y,k),e[11]=y,e[12]=k,e[13]=b):b=e[13];let v;e[14]!==h||e[15]!==c?(v=c?{}:{paddingLeft:`${h}px`},e[14]=h,e[15]=c,e[16]=v):v=e[16];let _=m?g:void 0,w;e[17]!==m||e[18]!==g?(w=m?g?(0,r.jsx)(ue,{className:"w-4 h-4 mr-2 shrink-0"}):(0,r.jsx)(fe,{className:"w-4 h-4 mr-2 shrink-0"}):(0,r.jsx)("div",{className:"w-4 mr-2 shrink-0"}),e[17]=m,e[18]=g,e[19]=w):w=e[19];let S;e[20]===n.name?S=e[21]:(S=(0,r.jsx)("span",{className:"font-medium truncate",children:n.name}),e[20]=n.name,e[21]=S);let u;e[22]===n.version?u=e[23]:(u=n.version&&(0,r.jsxs)("span",{className:"text-muted-foreground text-xs",children:["v",n.version]}),e[22]=n.version,e[23]=u);let C;e[24]!==S||e[25]!==u?(C=(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[S,u]}),e[24]=S,e[25]=u,e[26]=C):C=e[26];let E;e[27]===n.tags?E=e[28]:(E=n.tags.map(Te),e[27]=n.tags,e[28]=E);let $;e[29]===E?$=e[30]:($=(0,r.jsx)("div",{className:"flex items-center gap-1 ml-2",children:E}),e[29]=E,e[30]=$);let D;e[31]!==c||e[32]!==n.name||e[33]!==n.tags||e[34]!==o?(D=c&&(0,r.jsxs)("div",{className:"flex gap-1 invisible group-hover:visible",children:[(0,r.jsx)(re,{packageName:n.name,onSuccess:o}),(0,r.jsx)(se,{packageName:n.name,tags:n.tags,onSuccess:o})]}),e[31]=c,e[32]=n.name,e[33]=n.tags,e[34]=o,e[35]=D):D=e[35];let T;e[36]!==P||e[37]!==f||e[38]!==w||e[39]!==C||e[40]!==$||e[41]!==D||e[42]!==b||e[43]!==v||e[44]!==_?(T=(0,r.jsxs)("div",{className:b,style:v,onClick:P,onKeyDown:f,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":_,children:[w,C,$,D]}),e[36]=P,e[37]=f,e[38]=w,e[39]=C,e[40]=$,e[41]=D,e[42]=b,e[43]=v,e[44]=_,e[45]=T):T=e[45];let A;e[46]!==d||e[47]!==m||e[48]!==g||e[49]!==l||e[50]!==n.dependencies||e[51]!==s||e[52]!==o||e[53]!==a?(A=m&&g&&(0,r.jsx)("div",{role:"group",children:n.dependencies.map((N,z)=>(0,r.jsx)(ne,{nodeId:`${s}-${z}`,node:N,level:l+1,isTopLevel:!1,expandedNodes:d,onToggle:a,onSuccess:o},`${N.name}-${z}`))}),e[46]=d,e[47]=m,e[48]=g,e[49]=l,e[50]=n.dependencies,e[51]=s,e[52]=o,e[53]=a,e[54]=A):A=e[54];let L;return e[55]!==T||e[56]!==A?(L=(0,r.jsxs)("div",{children:[T,A]}),e[55]=T,e[56]=A,e[57]=L):L=e[57],L};function De(t,e){return t==="list"?"list":e?t||"tree":"list"}function Te(t,e){return t.kind==="cycle"?(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300",title:"cycle",children:"cycle"},e):t.kind==="extra"?(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300",title:t.value,children:t.value},e):t.kind==="group"?(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-green-300 dark:border-green-700 text-green-700 dark:text-green-300",title:t.value,children:t.value},e):null}export{Ce as default};
1
+ import{s as H}from"./chunk-LvLJmgfZ.js";import{d as ae,u as oe}from"./useEvent-BhXAndur.js";import{t as le}from"./react-Bj1aDYRI.js";import{Yn as V}from"./cells-B0XKj2oa.js";import"./react-dom-CSu739Rf.js";import{t as ie}from"./compiler-runtime-B3qBwwSJ.js";import{r as ce}from"./ai-model-dropdown-Cugcw6NV.js";import{y as de}from"./utils-YqBXNpsM.js";import{S as me}from"./config-D2-Bw6QC.js";import{t as xe}from"./jsx-runtime-ZmTK25f3.js";import{r as pe}from"./button-CZ3Cs4qb.js";import{t as K}from"./cn-BKtXLv3a.js";import"./dist-DBwNzi3C.js";import"./cjs-CH5Rj0g8.js";import"./main-U5Goe76G.js";import"./useNonce-CS26E0hA.js";import{r as W}from"./requests-B4FYHTZl.js";import{r as ue}from"./x-ZP5cObgf.js";import{t as fe}from"./chevron-right--18M_6o9.js";import{u as ge}from"./toDate-DETS9bBd.js";import{t as R}from"./spinner-DA8-7wQv.js";import{a as he}from"./input-DHHmNa19.js";import"./dist-Cayq-K1c.js";import"./dist-TiFCI16_.js";import"./dist-BIKFl48f.js";import"./dist-B0VqT_4z.js";import"./dist-BYyu59D8.js";import{t as ve}from"./use-toast-T0_cQDma.js";import"./session-fBtIbMpB.js";import"./Combination-izwufzWe.js";import{t as J}from"./tooltip-C_WgOOcZ.js";import"./popover-B-131r4d.js";import{t as je}from"./copy-BaRrAFL-.js";import{i as be,n as Y,r as F,s as Q,t as ke}from"./useInstallPackage-Co79H1lQ.js";import{n as X}from"./error-banner-w4pz2qUB.js";import{n as ye}from"./useAsyncData-CgmD3hjw.js";import{a as Ne,i as q,n as we,o as Z,r as B,t as Se}from"./table-BOsFCeLh.js";import{t as ee}from"./empty-state-DrmGF88A.js";var G=ie(),I=H(le(),1);function _e(t){let e=t.trim();for(let s of["pip install","pip3 install","uv add","uv pip install","poetry add","conda install","pipenv install"])if(e.toLowerCase().startsWith(s.toLowerCase()))return e.slice(s.length).trim();return e}var r=H(xe(),1),te=t=>{let e=(0,G.c)(9),{onClick:s,loading:n,children:l,className:x}=t;if(n){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,r.jsx)(R,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=c):c=e[0],c}let d;e[1]===x?d=e[2]:(d=K("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",x),e[1]=x,e[2]=d);let a;e[3]===s?a=e[4]:(a=pe.stopPropagation(s),e[3]=s,e[4]=a);let o;return e[5]!==l||e[6]!==d||e[7]!==a?(o=(0,r.jsx)("button",{type:"button",className:d,onClick:a,children:l}),e[5]=l,e[6]=d,e[7]=a,e[8]=o):o=e[8],o},Ce=()=>{var w,S;let t=(0,G.c)(30),[e]=de(),s=e.package_management.manager,{getDependencyTree:n,getPackageList:l}=W(),[x,d]=I.useState(null),a;t[0]!==n||t[1]!==l?(a=async()=>{let[u,C]=await Promise.all([l(),n()]);return{list:u.packages,tree:C.tree}},t[0]=n,t[1]=l,t[2]=a):a=t[2];let o;t[3]===s?o=t[4]:(o=[s],t[3]=s,t[4]=o);let{data:c,error:m,refetch:j,isPending:g}=ye(a,o);if(g){let u;return t[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,r.jsx)(R,{size:"medium",centered:!0}),t[5]=u):u=t[5],u}if(m){let u;return t[6]===m?u=t[7]:(u=(0,r.jsx)(X,{error:m}),t[6]=m,t[7]=u),u}let h=c.tree!=null,i;t[8]!==h||t[9]!==x?(i=De(x,h),t[8]=h,t[9]=x,t[10]=i):i=t[10];let f=i,p=(w=c.tree)==null?void 0:w.name,P=(S=c==null?void 0:c.tree)==null?void 0:S.version,y=p==="<root>",k;t[11]!==s||t[12]!==j?(k=(0,r.jsx)(Pe,{packageManager:s,onSuccess:j}),t[11]=s,t[12]=j,t[13]=k):k=t[13];let b;t[14]!==y||t[15]!==h||t[16]!==p||t[17]!==P||t[18]!==f?(b=h&&(0,r.jsxs)("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[(0,r.jsxs)("div",{className:"flex gap-1",children:[(0,r.jsx)("button",{type:"button",className:K("px-2 py-1 text-xs rounded",f==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>d("list"),children:"List"}),(0,r.jsx)("button",{type:"button",className:K("px-2 py-1 text-xs rounded",f==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>d("tree"),children:"Tree"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium",title:y?"sandbox":"project",children:y?"sandbox":"project"}),p&&!y&&(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[p,P&&` v${P}`]})]})]}),t[14]=y,t[15]=h,t[16]=p,t[17]=P,t[18]=f,t[19]=b):b=t[19];let v;t[20]!==c.list||t[21]!==c.tree||t[22]!==m||t[23]!==j||t[24]!==f?(v=f==="list"?(0,r.jsx)(Ee,{packages:c.list,onSuccess:j}):(0,r.jsx)($e,{tree:c.tree,error:m,onSuccess:j}),t[20]=c.list,t[21]=c.tree,t[22]=m,t[23]=j,t[24]=f,t[25]=v):v=t[25];let _;return t[26]!==k||t[27]!==b||t[28]!==v?(_=(0,r.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[k,b,v]}),t[26]=k,t[27]=b,t[28]=v,t[29]=_):_=t[29],_},Pe=t=>{let e=(0,G.c)(40),{onSuccess:s,packageManager:n}=t,[l,x]=I.useState(""),{handleClick:d}=ce(),a=oe(Q),o=ae(Q),c,m;e[0]!==a||e[1]!==o?(c=()=>{a&&(x(a),o(null))},m=[a,o],e[0]=a,e[1]=o,e[2]=c,e[3]=m):(c=e[2],m=e[3]),I.useEffect(c,m);let{loading:j,handleInstallPackages:g}=ke(),h;e[4]===s?h=e[5]:(h=()=>{s(),x("")},e[4]=s,e[5]=h);let i=h,f;e[6]!==g||e[7]!==l||e[8]!==i?(f=()=>{g([_e(l)],i)},e[6]=g,e[7]=l,e[8]=i,e[9]=f):f=e[9];let p=f,P=`Install packages with ${n}...`,y;e[10]!==j||e[11]!==d?(y=j?(0,r.jsx)(R,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):(0,r.jsx)(J,{content:"Change package manager",children:(0,r.jsx)(V,{onClick:()=>d("packageManagementAndData"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=j,e[11]=d,e[12]=y):y=e[12];let k;e[13]===p?k=e[14]:(k=U=>{U.key==="Enter"&&(U.preventDefault(),p())},e[13]=p,e[14]=k);let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=U=>x(U.target.value),e[15]=b):b=e[15];let v;e[16]!==l||e[17]!==P||e[18]!==y||e[19]!==k?(v=(0,r.jsx)(he,{placeholder:P,id:be,icon:y,rootClassName:"flex-1 border-none",value:l,onKeyDown:k,onChange:b}),e[16]=l,e[17]=P,e[18]=y,e[19]=k,e[20]=v):v=e[20];let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=_):_=e[21];let w,S;e[22]===Symbol.for("react.memo_cache_sentinel")?(w=(0,r.jsxs)("div",{children:[_," A package name; this will install the latest version.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),S=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=w,e[23]=S):(w=e[22],S=e[23]);let u,C;e[24]===Symbol.for("react.memo_cache_sentinel")?(u=(0,r.jsxs)("div",{children:[S," ","A package with a specific version or version range.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),C=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=u,e[25]=C):(u=e[24],C=e[25]);let E,$;e[26]===Symbol.for("react.memo_cache_sentinel")?(E=(0,r.jsxs)("div",{children:[C," A Git repository",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),$=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=E,e[27]=$):(E=e[26],$=e[27]);let D,T;e[28]===Symbol.for("react.memo_cache_sentinel")?(D=(0,r.jsxs)("div",{children:[$," A remote wheel or source distribution.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),T=(0,r.jsx)("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=D,e[29]=T):(D=e[28],T=e[29]);let A;e[30]===Symbol.for("react.memo_cache_sentinel")?(A=(0,r.jsx)(J,{delayDuration:300,side:"left",align:"start",content:(0,r.jsxs)("div",{className:"text-sm flex flex-col w-full max-w-[360px]",children:["Packages are installed using the package manager specified in your user configuration. Depending on your package manager, you can install packages with various formats:",(0,r.jsxs)("div",{className:"flex flex-col gap-2 mt-2",children:[w,u,E,D,(0,r.jsxs)("div",{children:[T," A local wheel, source distribution, or project directory.",(0,r.jsx)("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:(0,r.jsx)(ge,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=A):A=e[30];let L=l&&"bg-accent text-accent-foreground",N;e[31]===L?N=e[32]:(N=K("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",L,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=L,e[32]=N);let z=!l,M;e[33]!==p||e[34]!==N||e[35]!==z?(M=(0,r.jsx)("button",{type:"button",className:N,onClick:p,disabled:z,children:"Add"}),e[33]=p,e[34]=N,e[35]=z,e[36]=M):M=e[36];let O;return e[37]!==M||e[38]!==v?(O=(0,r.jsxs)("div",{className:"flex items-center w-full border-b",children:[v,A,M]}),e[37]=M,e[38]=v,e[39]=O):O=e[39],O},Ee=t=>{let e=(0,G.c)(9),{onSuccess:s,packages:n}=t;if(n.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,r.jsx)(ee,{title:"No packages",description:"No packages are installed in this environment.",icon:(0,r.jsx)(V,{})}),e[0]=a):a=e[0],a}let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=(0,r.jsx)(Ne,{children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(q,{children:"Name"}),(0,r.jsx)(q,{children:"Version"}),(0,r.jsx)(q,{})]})}),e[1]=l):l=e[1];let x;if(e[2]!==s||e[3]!==n){let a;e[5]===s?a=e[6]:(a=o=>(0,r.jsxs)(Z,{className:"group",onClick:async()=>{await je(`${o.name}==${o.version}`),ve({title:"Copied to clipboard"})},children:[(0,r.jsx)(B,{children:o.name}),(0,r.jsx)(B,{children:o.version}),(0,r.jsxs)(B,{className:"flex justify-end",children:[(0,r.jsx)(re,{packageName:o.name,onSuccess:s}),(0,r.jsx)(se,{packageName:o.name,onSuccess:s})]})]},o.name),e[5]=s,e[6]=a),x=n.map(a),e[2]=s,e[3]=n,e[4]=x}else x=e[4];let d;return e[7]===x?d=e[8]:(d=(0,r.jsxs)(Se,{className:"overflow-auto flex-1",children:[l,(0,r.jsx)(we,{children:x})]}),e[7]=x,e[8]=d),d},re=({packageName:t,onSuccess:e})=>{let[s,n]=I.useState(!1),{addPackage:l}=W();return me()?null:(0,r.jsx)(te,{onClick:async()=>{try{n(!0);let x=await l({package:t,upgrade:!0});x.success?(e(),F(t)):F(t,x.error)}finally{n(!1)}},loading:s,children:"Upgrade"})},se=({packageName:t,tags:e,onSuccess:s})=>{let[n,l]=I.useState(!1),{removePackage:x}=W();return(0,r.jsx)(te,{onClick:async()=>{try{l(!0);let d=e==null?void 0:e.some(o=>o.kind==="group"&&o.value==="dev"),a=await x({package:t,dev:d});a.success?(s(),Y(t)):Y(t,a.error)}finally{l(!1)}},loading:n,children:"Remove"})},$e=t=>{let e=(0,G.c)(18),{tree:s,error:n,onSuccess:l}=t,x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=new Set,e[0]=x):x=e[0];let[d,a]=I.useState(x),o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a(new Set)},e[1]=o):o=e[1];let c;if(e[2]===s?c=e[3]:(c=[s],e[2]=s,e[3]=c),I.useEffect(o,c),n){let i;return e[4]===n?i=e[5]:(i=(0,r.jsx)(X,{error:n}),e[4]=n,e[5]=i),i}if(!s){let i;return e[6]===Symbol.for("react.memo_cache_sentinel")?(i=(0,r.jsx)(R,{size:"medium",centered:!0}),e[6]=i):i=e[6],i}if(s.dependencies.length===0){let i;return e[7]===Symbol.for("react.memo_cache_sentinel")?(i=(0,r.jsx)(ee,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:(0,r.jsx)(V,{})}),e[7]=i):i=e[7],i}let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=i=>{a(f=>{let p=new Set(f);return p.has(i)?p.delete(i):p.add(i),p})},e[8]=m):m=e[8];let j=m,g;if(e[9]!==d||e[10]!==l||e[11]!==s.dependencies){let i;e[13]!==d||e[14]!==l?(i=(f,p)=>(0,r.jsx)("div",{className:"border-b",children:(0,r.jsx)(ne,{nodeId:`root-${p}`,node:f,level:0,isTopLevel:!0,expandedNodes:d,onToggle:j,onSuccess:l})},`${f.name}-${p}`),e[13]=d,e[14]=l,e[15]=i):i=e[15],g=s.dependencies.map(i),e[9]=d,e[10]=l,e[11]=s.dependencies,e[12]=g}else g=e[12];let h;return e[16]===g?h=e[17]:(h=(0,r.jsx)("div",{className:"flex-1 overflow-auto",children:(0,r.jsx)("div",{children:g})}),e[16]=g,e[17]=h),h},ne=t=>{let e=(0,G.c)(58),{nodeId:s,node:n,level:l,isTopLevel:x,expandedNodes:d,onToggle:a,onSuccess:o}=t,c=x===void 0?!1:x,m=n.dependencies.length>0,j;e[0]!==d||e[1]!==s?(j=d.has(s),e[0]=d,e[1]=s,e[2]=j):j=e[2];let g=j,h=c?0:16+l*16,i;e[3]!==m||e[4]!==s||e[5]!==a?(i=N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),m&&a(s))},e[3]=m,e[4]=s,e[5]=a,e[6]=i):i=e[6];let f=i,p;e[7]!==m||e[8]!==s||e[9]!==a?(p=N=>{N.stopPropagation(),m&&a(s)},e[7]=m,e[8]=s,e[9]=a,e[10]=p):p=e[10];let P=p,y=m&&"select-none",k=c?"px-2 py-0.5":"",b;e[11]!==y||e[12]!==k?(b=K("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-(--slate-2) focus:bg-(--slate-2) focus:outline-hidden",y,k),e[11]=y,e[12]=k,e[13]=b):b=e[13];let v;e[14]!==h||e[15]!==c?(v=c?{}:{paddingLeft:`${h}px`},e[14]=h,e[15]=c,e[16]=v):v=e[16];let _=m?g:void 0,w;e[17]!==m||e[18]!==g?(w=m?g?(0,r.jsx)(ue,{className:"w-4 h-4 mr-2 shrink-0"}):(0,r.jsx)(fe,{className:"w-4 h-4 mr-2 shrink-0"}):(0,r.jsx)("div",{className:"w-4 mr-2 shrink-0"}),e[17]=m,e[18]=g,e[19]=w):w=e[19];let S;e[20]===n.name?S=e[21]:(S=(0,r.jsx)("span",{className:"font-medium truncate",children:n.name}),e[20]=n.name,e[21]=S);let u;e[22]===n.version?u=e[23]:(u=n.version&&(0,r.jsxs)("span",{className:"text-muted-foreground text-xs",children:["v",n.version]}),e[22]=n.version,e[23]=u);let C;e[24]!==S||e[25]!==u?(C=(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[S,u]}),e[24]=S,e[25]=u,e[26]=C):C=e[26];let E;e[27]===n.tags?E=e[28]:(E=n.tags.map(Te),e[27]=n.tags,e[28]=E);let $;e[29]===E?$=e[30]:($=(0,r.jsx)("div",{className:"flex items-center gap-1 ml-2",children:E}),e[29]=E,e[30]=$);let D;e[31]!==c||e[32]!==n.name||e[33]!==n.tags||e[34]!==o?(D=c&&(0,r.jsxs)("div",{className:"flex gap-1 invisible group-hover:visible",children:[(0,r.jsx)(re,{packageName:n.name,onSuccess:o}),(0,r.jsx)(se,{packageName:n.name,tags:n.tags,onSuccess:o})]}),e[31]=c,e[32]=n.name,e[33]=n.tags,e[34]=o,e[35]=D):D=e[35];let T;e[36]!==P||e[37]!==f||e[38]!==w||e[39]!==C||e[40]!==$||e[41]!==D||e[42]!==b||e[43]!==v||e[44]!==_?(T=(0,r.jsxs)("div",{className:b,style:v,onClick:P,onKeyDown:f,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":_,children:[w,C,$,D]}),e[36]=P,e[37]=f,e[38]=w,e[39]=C,e[40]=$,e[41]=D,e[42]=b,e[43]=v,e[44]=_,e[45]=T):T=e[45];let A;e[46]!==d||e[47]!==m||e[48]!==g||e[49]!==l||e[50]!==n.dependencies||e[51]!==s||e[52]!==o||e[53]!==a?(A=m&&g&&(0,r.jsx)("div",{role:"group",children:n.dependencies.map((N,z)=>(0,r.jsx)(ne,{nodeId:`${s}-${z}`,node:N,level:l+1,isTopLevel:!1,expandedNodes:d,onToggle:a,onSuccess:o},`${N.name}-${z}`))}),e[46]=d,e[47]=m,e[48]=g,e[49]=l,e[50]=n.dependencies,e[51]=s,e[52]=o,e[53]=a,e[54]=A):A=e[54];let L;return e[55]!==T||e[56]!==A?(L=(0,r.jsxs)("div",{children:[T,A]}),e[55]=T,e[56]=A,e[57]=L):L=e[57],L};function De(t,e){return t==="list"?"list":e?t||"tree":"list"}function Te(t,e){return t.kind==="cycle"?(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300",title:"cycle",children:"cycle"},e):t.kind==="extra"?(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300",title:t.value,children:t.value},e):t.kind==="group"?(0,r.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-green-300 dark:border-green-700 text-green-700 dark:text-green-300",title:t.value,children:t.value},e):null}export{Ce as default};
@@ -1 +1 @@
1
- import{s as oe}from"./chunk-LvLJmgfZ.js";import{d as be,l as ye,n as V,p as ae,u as we}from"./useEvent-BhXAndur.js";import{t as Ne}from"./react-Bj1aDYRI.js";import{N as ke,Yr as ze,hn as Ce,ii as n,ri as Se,w as Oe,__tla as Ae}from"./cells-B0XKj2oa.js";import"./react-dom-CSu739Rf.js";import{t as se}from"./compiler-runtime-B3qBwwSJ.js";import"./tooltip-DqsDDLgU.js";import{f as ie}from"./hotkeys-BHHWjLlp.js";import{y as Ie}from"./utils-YqBXNpsM.js";import{t as Le}from"./constants-B6Cb__3x.js";import{t as Me}from"./jsx-runtime-ZmTK25f3.js";import{t as z}from"./button-CZ3Cs4qb.js";import{t as le}from"./cn-BKtXLv3a.js";import"./dist-DBwNzi3C.js";import{n as Pe,__tla as Ee}from"./JsonOutput-CU0ad2LH.js";import"./cjs-CH5Rj0g8.js";import"./main-U5Goe76G.js";import"./useNonce-CS26E0hA.js";import{r as Re}from"./requests-B4FYHTZl.js";import{t as me}from"./createLucideIcon-BCdY6lG5.js";import{d as De,__tla as He}from"./layout-BRVYycwo.js";import{n as Ve,t as qe,__tla as Te}from"./LazyAnyLanguageCodeMirror-BqosdyZU.js";import"./download-CxmzcjnR.js";import"./markdown-renderer-Y3WEBmX7.js";import{u as Ge}from"./toDate-DETS9bBd.js";import{t as Ue,__tla as Ye}from"./cell-editor-DuDivBWf.js";import{t as Be}from"./play-GLWQQs7F.js";import{t as Fe}from"./spinner-DA8-7wQv.js";import"./dist-Cayq-K1c.js";import"./dist-TiFCI16_.js";import"./dist-BIKFl48f.js";import"./dist-B0VqT_4z.js";import"./dist-BYyu59D8.js";import"./session-fBtIbMpB.js";import{r as Je}from"./useTheme-CTORu22_.js";import"./Combination-izwufzWe.js";import{t as C}from"./tooltip-C_WgOOcZ.js";import"./dates-CT5PUuFo.js";import"./popover-B-131r4d.js";import"./vega-loader.browser-BegSZk0G.js";import"./defaultLocale-YteS-k_t.js";import"./defaultLocale-B6z1Qyqt.js";import"./purify.es-B-nzWya6.js";import{__tla as Ke}from"./chunk-5FQGJX7Z-T2jyw7ZD.js";import"./katex-CbllUrnh.js";import"./html-to-image-Cc7t14sm.js";import{o as Qe}from"./focus-CZLCQiuh.js";import{a as We}from"./renderShortcut-Xr6z-RjZ.js";import"./esm-BK6tLEHQ.js";import{n as Xe,r as Ze,t as ne}from"./react-resizable-panels.browser.esm-Mq45xjWt.js";import"./name-cell-input-Bmq-KdJ-.js";import{n as $e,r as et}from"./panel-context-2mVKaSYm.js";import"./Inputs-CbenuziM.js";import{__tla as tt}from"./loro_wasm_bg-CdafknAX.js";import"./ws-DQY2KwIl.js";import"./dist-BZe-2kC9.js";import"./dist-Bpsss9Eu.js";import"./dist-qIIHXwC_.js";import"./dist-OZngTf6n.js";import"./dist-DGPkGdD2.js";import"./dist-DLCy1STk.js";import"./dist-CNknMFYG.js";import"./dist-DsxhNXOv.js";import"./dist-rT8uZk_k.js";import"./esm-BmQh-C2G.js";import{t as rt}from"./kiosk-mode-S90PbrZr.js";let ce,ot=Promise.all([(()=>{try{return Ae}catch{}})(),(()=>{try{return Ee}catch{}})(),(()=>{try{return He}catch{}})(),(()=>{try{return Te}catch{}})(),(()=>{try{return Ye}catch{}})(),(()=>{try{return Ke}catch{}})(),(()=>{try{return tt}catch{}})()]).then(async()=>{var de=me("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"}]]),pe=me("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"}]]),he=se(),q=oe(Ne(),1),ue=15;const T=ze("marimo:scratchpadHistory:v1",[],Ce),fe=ae(!1),xe=ae(null,(e,s,i)=>{if(i=i.trim(),!i)return;let m=e(T);s(T,[i,...m.filter(c=>c!==i)].slice(0,ue))});var t=oe(Me(),1),_e={hide_code:!1,disabled:!1};const ve=()=>{var re;let e=(0,he.c)(60),s=ke(),[i]=Ie(),{theme:m}=Je(),c=(0,q.useRef)(null),G=Qe(),{createNewCell:U,updateCellCode:d}=Oe(),{sendRunScratchpad:p}=Re(),S=$e(),Y=et(),l=s.cellRuntime[n],B=l==null?void 0:l.output,O=l==null?void 0:l.status,F=l==null?void 0:l.consoleOutputs,r=((re=s.cellData.__scratch__)==null?void 0:re.code)??"",J=be(xe),[a,h]=ye(fe),u=we(T),A;e[0]!==J||e[1]!==r||e[2]!==p?(A=()=>{p({code:r}),J(r)},e[0]=J,e[1]=r,e[2]=p,e[3]=A):A=e[3];let f=V(A),I;e[4]!==r||e[5]!==U||e[6]!==G?(I=()=>{r.trim()&&U({code:r,before:!1,cellId:G??"__end__"})},e[4]=r,e[5]=U,e[6]=G,e[7]=I):I=e[7];let K=V(I),L;e[8]!==p||e[9]!==d?(L=()=>{d({cellId:n,code:"",formattingChange:!1}),p({code:""});let o=c.current;o&&o.dispatch({changes:{from:0,to:o.state.doc.length,insert:""}})},e[8]=p,e[9]=d,e[10]=L):L=e[10];let Q=V(L),M;e[11]!==h||e[12]!==d?(M=o=>{h(!1),d({cellId:n,code:o,formattingChange:!1});let k=c.current;k&&k.dispatch({changes:{from:0,to:k.state.doc.length,insert:o}})},e[11]=h,e[12]=d,e[13]=M):M=e[13];let W=V(M),[X,ge]=(0,q.useState)(),P;e[14]!==W||e[15]!==u||e[16]!==a||e[17]!==m?(P=()=>a?(0,t.jsx)("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:(0,t.jsx)("div",{className:"overflow-auto flex flex-col gap-3",children:u.map((o,k)=>(0,t.jsx)("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>W(o),children:(0,t.jsx)(q.Suspense,{children:(0,t.jsx)(qe,{language:"python",theme:m,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:o.trim(),editable:!1,readOnly:!0})})},k))})}):null,e[14]=W,e[15]=u,e[16]=a,e[17]=m,e[18]=P):P=e[18];let Z=P,E;e[19]!==Q||e[20]!==K||e[21]!==f||e[22]!==u.length||e[23]!==a||e[24]!==h||e[25]!==O?(E=()=>(0,t.jsxs)("div",{className:"flex items-center shrink-0 border-b",children:[(0,t.jsx)(C,{content:We("cell.run"),children:(0,t.jsx)(z,{"data-testid":"scratchpad-run-button",onClick:f,disabled:a,variant:"text",size:"xs",children:(0,t.jsx)(Be,{color:"var(--grass-11)",size:16})})}),(0,t.jsx)(C,{content:"Clear code and outputs",children:(0,t.jsx)(z,{disabled:a,size:"xs",variant:"text",onClick:Q,children:(0,t.jsx)(de,{size:16})})}),(0,t.jsx)(rt,{children:(0,t.jsx)(C,{content:"Insert code",children:(0,t.jsx)(z,{disabled:a,size:"xs",variant:"text",onClick:K,children:(0,t.jsx)(Ve,{size:16})})})}),(O==="running"||O==="queued")&&(0,t.jsx)(Fe,{className:"inline",size:"small"}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsx)(C,{content:"Toggle history",children:(0,t.jsx)(z,{size:"xs",variant:"text",className:le(a&&"bg-(--sky-3) rounded-none"),onClick:()=>h(!a),disabled:u.length===0,children:(0,t.jsx)(pe,{size:16})})}),(0,t.jsx)(C,{content:(0,t.jsx)("span",{className:"block max-w-prose",children:"Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file."}),children:(0,t.jsx)(z,{size:"xs",variant:"text",children:(0,t.jsx)(Ge,{size:16})})})]}),e[19]=Q,e[20]=K,e[21]=f,e[22]=u.length,e[23]=a,e[24]=h,e[25]=O,e[26]=E):E=e[26];let $=E,je=S==="vertical",R;e[27]===Symbol.for("react.memo_cache_sentinel")?(R=Se.create(n),e[27]=R):R=e[27];let x;e[28]===$?x=e[29]:(x=$(),e[28]=$,e[29]=x);let D;e[30]===Symbol.for("react.memo_cache_sentinel")?(D=o=>{c.current=o},e[30]=D):D=e[30];let _;e[31]!==r||e[32]!==f||e[33]!==X||e[34]!==m||e[35]!==i?(_=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Ue,{theme:m,showPlaceholder:!1,id:n,code:r,config:_e,status:"idle",serializedEditorState:null,runCell:f,userConfig:i,editorViewRef:c,setEditorView:D,hidden:!1,showHiddenCode:ie.NOOP,languageAdapter:X,setLanguageAdapter:ge})}),e[31]=r,e[32]=f,e[33]=X,e[34]=m,e[35]=i,e[36]=_):_=e[36];let v;e[37]===Z?v=e[38]:(v=Z(),e[37]=Z,e[38]=v);let g;e[39]!==v||e[40]!==x||e[41]!==_?(g=(0,t.jsx)(ne,{defaultSize:40,minSize:20,maxSize:70,children:(0,t.jsxs)("div",{className:"h-full flex flex-col overflow-hidden relative",children:[x,_,v]})}),e[39]=v,e[40]=x,e[41]=_,e[42]=g):g=e[42];let ee=je?"h-1":"w-1",j;e[43]===ee?j=e[44]:(j=le("bg-border hover:bg-primary/50 transition-colors",ee),e[43]=ee,e[44]=j);let b;e[45]===j?b=e[46]:(b=(0,t.jsx)(Ze,{className:j}),e[45]=j,e[46]=b);let y;e[47]===B?y=e[48]:(y=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Pe,{allowExpand:!1,output:B,className:Le.outputArea,cellId:n,stale:!1,loading:!1})}),e[47]=B,e[48]=y);let w;e[49]===F?w=e[50]:(w=(0,t.jsx)("div",{className:"overflow-auto shrink-0 max-h-[50%]",children:(0,t.jsx)(De,{consoleOutputs:F,className:"overflow-auto",stale:!1,cellName:"_",onSubmitDebugger:ie.NOOP,cellId:n,debuggerActive:!1})}),e[49]=F,e[50]=w);let N;e[51]!==y||e[52]!==w?(N=(0,t.jsx)(ne,{defaultSize:60,minSize:20,children:(0,t.jsxs)("div",{className:"h-full flex flex-col divide-y overflow-hidden",children:[y,w]})}),e[51]=y,e[52]=w,e[53]=N):N=e[53];let H;return e[54]!==S||e[55]!==Y||e[56]!==g||e[57]!==b||e[58]!==N?(H=(0,t.jsx)("div",{className:"flex flex-col h-full overflow-hidden",id:R,children:(0,t.jsxs)(Xe,{direction:S,className:"h-full",children:[g,b,N]},Y)}),e[54]=S,e[55]=Y,e[56]=g,e[57]=b,e[58]=N,e[59]=H):H=e[59],H};let te;te=se(),ce=()=>{let e=(0,te.c)(1),s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(ve,{}),e[0]=s):s=e[0],s}});export{ot as __tla,ce as default};
1
+ import{s as oe}from"./chunk-LvLJmgfZ.js";import{d as be,l as ye,n as V,p as ae,u as we}from"./useEvent-BhXAndur.js";import{t as Ne}from"./react-Bj1aDYRI.js";import{N as ke,Yr as ze,hn as Ce,ii as n,ri as Se,w as Oe,__tla as Ae}from"./cells-B0XKj2oa.js";import"./react-dom-CSu739Rf.js";import{t as se}from"./compiler-runtime-B3qBwwSJ.js";import"./tooltip-DqsDDLgU.js";import{f as ie}from"./hotkeys-BHHWjLlp.js";import{y as Ie}from"./utils-YqBXNpsM.js";import{t as Le}from"./constants-B6Cb__3x.js";import{t as Me}from"./jsx-runtime-ZmTK25f3.js";import{t as z}from"./button-CZ3Cs4qb.js";import{t as le}from"./cn-BKtXLv3a.js";import"./dist-DBwNzi3C.js";import{n as Pe,__tla as Ee}from"./JsonOutput-CU0ad2LH.js";import"./cjs-CH5Rj0g8.js";import"./main-U5Goe76G.js";import"./useNonce-CS26E0hA.js";import{r as Re}from"./requests-B4FYHTZl.js";import{t as me}from"./createLucideIcon-BCdY6lG5.js";import{d as De,__tla as He}from"./layout-BRVYycwo.js";import{n as Ve,t as qe,__tla as Te}from"./LazyAnyLanguageCodeMirror-BqosdyZU.js";import"./download-CxmzcjnR.js";import"./markdown-renderer-Y3WEBmX7.js";import{u as Ge}from"./toDate-DETS9bBd.js";import{t as Ue,__tla as Ye}from"./cell-editor-DZgQrVMs.js";import{t as Be}from"./play-GLWQQs7F.js";import{t as Fe}from"./spinner-DA8-7wQv.js";import"./dist-Cayq-K1c.js";import"./dist-TiFCI16_.js";import"./dist-BIKFl48f.js";import"./dist-B0VqT_4z.js";import"./dist-BYyu59D8.js";import"./session-fBtIbMpB.js";import{r as Je}from"./useTheme-CTORu22_.js";import"./Combination-izwufzWe.js";import{t as C}from"./tooltip-C_WgOOcZ.js";import"./dates-CT5PUuFo.js";import"./popover-B-131r4d.js";import"./vega-loader.browser-BegSZk0G.js";import"./defaultLocale-YteS-k_t.js";import"./defaultLocale-B6z1Qyqt.js";import"./purify.es-B-nzWya6.js";import{__tla as Ke}from"./chunk-5FQGJX7Z-T2jyw7ZD.js";import"./katex-CbllUrnh.js";import"./html-to-image-Cc7t14sm.js";import{o as Qe}from"./focus-CZLCQiuh.js";import{a as We}from"./renderShortcut-Xr6z-RjZ.js";import"./esm-BK6tLEHQ.js";import{n as Xe,r as Ze,t as ne}from"./react-resizable-panels.browser.esm-Mq45xjWt.js";import"./name-cell-input-Bmq-KdJ-.js";import{n as $e,r as et}from"./panel-context-2mVKaSYm.js";import"./Inputs-CbenuziM.js";import{__tla as tt}from"./loro_wasm_bg-CdafknAX.js";import"./ws-DQY2KwIl.js";import"./dist-BZe-2kC9.js";import"./dist-Bpsss9Eu.js";import"./dist-qIIHXwC_.js";import"./dist-OZngTf6n.js";import"./dist-DGPkGdD2.js";import"./dist-DLCy1STk.js";import"./dist-CNknMFYG.js";import"./dist-DsxhNXOv.js";import"./dist-rT8uZk_k.js";import"./esm-BmQh-C2G.js";import{t as rt}from"./kiosk-mode-S90PbrZr.js";let ce,ot=Promise.all([(()=>{try{return Ae}catch{}})(),(()=>{try{return Ee}catch{}})(),(()=>{try{return He}catch{}})(),(()=>{try{return Te}catch{}})(),(()=>{try{return Ye}catch{}})(),(()=>{try{return Ke}catch{}})(),(()=>{try{return tt}catch{}})()]).then(async()=>{var de=me("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"}]]),pe=me("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"}]]),he=se(),q=oe(Ne(),1),ue=15;const T=ze("marimo:scratchpadHistory:v1",[],Ce),fe=ae(!1),xe=ae(null,(e,s,i)=>{if(i=i.trim(),!i)return;let m=e(T);s(T,[i,...m.filter(c=>c!==i)].slice(0,ue))});var t=oe(Me(),1),_e={hide_code:!1,disabled:!1};const ve=()=>{var re;let e=(0,he.c)(60),s=ke(),[i]=Ie(),{theme:m}=Je(),c=(0,q.useRef)(null),G=Qe(),{createNewCell:U,updateCellCode:d}=Oe(),{sendRunScratchpad:p}=Re(),S=$e(),Y=et(),l=s.cellRuntime[n],B=l==null?void 0:l.output,O=l==null?void 0:l.status,F=l==null?void 0:l.consoleOutputs,r=((re=s.cellData.__scratch__)==null?void 0:re.code)??"",J=be(xe),[a,h]=ye(fe),u=we(T),A;e[0]!==J||e[1]!==r||e[2]!==p?(A=()=>{p({code:r}),J(r)},e[0]=J,e[1]=r,e[2]=p,e[3]=A):A=e[3];let f=V(A),I;e[4]!==r||e[5]!==U||e[6]!==G?(I=()=>{r.trim()&&U({code:r,before:!1,cellId:G??"__end__"})},e[4]=r,e[5]=U,e[6]=G,e[7]=I):I=e[7];let K=V(I),L;e[8]!==p||e[9]!==d?(L=()=>{d({cellId:n,code:"",formattingChange:!1}),p({code:""});let o=c.current;o&&o.dispatch({changes:{from:0,to:o.state.doc.length,insert:""}})},e[8]=p,e[9]=d,e[10]=L):L=e[10];let Q=V(L),M;e[11]!==h||e[12]!==d?(M=o=>{h(!1),d({cellId:n,code:o,formattingChange:!1});let k=c.current;k&&k.dispatch({changes:{from:0,to:k.state.doc.length,insert:o}})},e[11]=h,e[12]=d,e[13]=M):M=e[13];let W=V(M),[X,ge]=(0,q.useState)(),P;e[14]!==W||e[15]!==u||e[16]!==a||e[17]!==m?(P=()=>a?(0,t.jsx)("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:(0,t.jsx)("div",{className:"overflow-auto flex flex-col gap-3",children:u.map((o,k)=>(0,t.jsx)("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>W(o),children:(0,t.jsx)(q.Suspense,{children:(0,t.jsx)(qe,{language:"python",theme:m,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:o.trim(),editable:!1,readOnly:!0})})},k))})}):null,e[14]=W,e[15]=u,e[16]=a,e[17]=m,e[18]=P):P=e[18];let Z=P,E;e[19]!==Q||e[20]!==K||e[21]!==f||e[22]!==u.length||e[23]!==a||e[24]!==h||e[25]!==O?(E=()=>(0,t.jsxs)("div",{className:"flex items-center shrink-0 border-b",children:[(0,t.jsx)(C,{content:We("cell.run"),children:(0,t.jsx)(z,{"data-testid":"scratchpad-run-button",onClick:f,disabled:a,variant:"text",size:"xs",children:(0,t.jsx)(Be,{color:"var(--grass-11)",size:16})})}),(0,t.jsx)(C,{content:"Clear code and outputs",children:(0,t.jsx)(z,{disabled:a,size:"xs",variant:"text",onClick:Q,children:(0,t.jsx)(de,{size:16})})}),(0,t.jsx)(rt,{children:(0,t.jsx)(C,{content:"Insert code",children:(0,t.jsx)(z,{disabled:a,size:"xs",variant:"text",onClick:K,children:(0,t.jsx)(Ve,{size:16})})})}),(O==="running"||O==="queued")&&(0,t.jsx)(Fe,{className:"inline",size:"small"}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsx)(C,{content:"Toggle history",children:(0,t.jsx)(z,{size:"xs",variant:"text",className:le(a&&"bg-(--sky-3) rounded-none"),onClick:()=>h(!a),disabled:u.length===0,children:(0,t.jsx)(pe,{size:16})})}),(0,t.jsx)(C,{content:(0,t.jsx)("span",{className:"block max-w-prose",children:"Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file."}),children:(0,t.jsx)(z,{size:"xs",variant:"text",children:(0,t.jsx)(Ge,{size:16})})})]}),e[19]=Q,e[20]=K,e[21]=f,e[22]=u.length,e[23]=a,e[24]=h,e[25]=O,e[26]=E):E=e[26];let $=E,je=S==="vertical",R;e[27]===Symbol.for("react.memo_cache_sentinel")?(R=Se.create(n),e[27]=R):R=e[27];let x;e[28]===$?x=e[29]:(x=$(),e[28]=$,e[29]=x);let D;e[30]===Symbol.for("react.memo_cache_sentinel")?(D=o=>{c.current=o},e[30]=D):D=e[30];let _;e[31]!==r||e[32]!==f||e[33]!==X||e[34]!==m||e[35]!==i?(_=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Ue,{theme:m,showPlaceholder:!1,id:n,code:r,config:_e,status:"idle",serializedEditorState:null,runCell:f,userConfig:i,editorViewRef:c,setEditorView:D,hidden:!1,showHiddenCode:ie.NOOP,languageAdapter:X,setLanguageAdapter:ge})}),e[31]=r,e[32]=f,e[33]=X,e[34]=m,e[35]=i,e[36]=_):_=e[36];let v;e[37]===Z?v=e[38]:(v=Z(),e[37]=Z,e[38]=v);let g;e[39]!==v||e[40]!==x||e[41]!==_?(g=(0,t.jsx)(ne,{defaultSize:40,minSize:20,maxSize:70,children:(0,t.jsxs)("div",{className:"h-full flex flex-col overflow-hidden relative",children:[x,_,v]})}),e[39]=v,e[40]=x,e[41]=_,e[42]=g):g=e[42];let ee=je?"h-1":"w-1",j;e[43]===ee?j=e[44]:(j=le("bg-border hover:bg-primary/50 transition-colors",ee),e[43]=ee,e[44]=j);let b;e[45]===j?b=e[46]:(b=(0,t.jsx)(Ze,{className:j}),e[45]=j,e[46]=b);let y;e[47]===B?y=e[48]:(y=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Pe,{allowExpand:!1,output:B,className:Le.outputArea,cellId:n,stale:!1,loading:!1})}),e[47]=B,e[48]=y);let w;e[49]===F?w=e[50]:(w=(0,t.jsx)("div",{className:"overflow-auto shrink-0 max-h-[50%]",children:(0,t.jsx)(De,{consoleOutputs:F,className:"overflow-auto",stale:!1,cellName:"_",onSubmitDebugger:ie.NOOP,cellId:n,debuggerActive:!1})}),e[49]=F,e[50]=w);let N;e[51]!==y||e[52]!==w?(N=(0,t.jsx)(ne,{defaultSize:60,minSize:20,children:(0,t.jsxs)("div",{className:"h-full flex flex-col divide-y overflow-hidden",children:[y,w]})}),e[51]=y,e[52]=w,e[53]=N):N=e[53];let H;return e[54]!==S||e[55]!==Y||e[56]!==g||e[57]!==b||e[58]!==N?(H=(0,t.jsx)("div",{className:"flex flex-col h-full overflow-hidden",id:R,children:(0,t.jsxs)(Xe,{direction:S,className:"h-full",children:[g,b,N]},Y)}),e[54]=S,e[55]=Y,e[56]=g,e[57]=b,e[58]=N,e[59]=H):H=e[59],H};let te;te=se(),ce=()=>{let e=(0,te.c)(1),s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(ve,{}),e[0]=s):s=e[0],s}});export{ot as __tla,ce as default};
@@ -1 +1 @@
1
- import{s as de}from"./chunk-LvLJmgfZ.js";import{d as D,l as Oe,p as Be,u as ee}from"./useEvent-BhXAndur.js";import{t as Ue}from"./react-Bj1aDYRI.js";import{Kn as Ye,Mt as $e,Un as Fe,Vn as Ge,Zn as Ke,_r as Je,cn as Ze,g as Xe,ln as Qe,m as ce,pn as he,ri as te,t as et,un as tt,w as pe}from"./cells-B0XKj2oa.js";import{t as W}from"./compiler-runtime-B3qBwwSJ.js";import{n as at}from"./assertNever-CBU83Y6o.js";import{s as me}from"./useLifecycle-ClI_npeg.js";import{n as ot}from"./add-database-form-BnEY6X5s.js";import{n as nt,x as it}from"./ai-model-dropdown-BHE9fW6D.js";import{a as ue,d as I}from"./hotkeys-BHHWjLlp.js";import{y as lt}from"./utils-YqBXNpsM.js";import{n as _,t as fe}from"./constants-B6Cb__3x.js";import{S as ye,h as st,x as rt}from"./config-D2-Bw6QC.js";import{t as dt}from"./jsx-runtime-ZmTK25f3.js";import{r as ct,t as ae}from"./button-CZ3Cs4qb.js";import{r as P}from"./requests-B4FYHTZl.js";import{t as h}from"./createLucideIcon-BCdY6lG5.js";import{a as be,f as ht,i as ke,m as pt,p as xe,u as we}from"./layout-BRVYycwo.js";import{t as ge}from"./check-Dr3SxUsb.js";import{c as mt,d as je,n as ut,o as ft,r as ve,t as yt}from"./download-CxmzcjnR.js";import{f as bt}from"./maps-D2_Mq1pZ.js";import{r as kt}from"./useCellActionButton-Du-bZZ06.js";import{t as xt}from"./copy-D-8y6iMN.js";import{t as wt}from"./download-Dg7clfkc.js";import{t as gt}from"./eye-off-AK_9uodG.js";import{t as jt}from"./file-plus-corner-CvAy4H5W.js";import{t as vt}from"./file-Ch78NKWp.js";import{i as Ct,n as zt,r as Mt,t as Wt}from"./youtube--tNPNRy6.js";import{n as _t,t as St}from"./house-BI81AWSn.js";import{n as At}from"./play-GLWQQs7F.js";import{t as Nt}from"./link-DxicfMbs.js";import{r as Dt}from"./input-DHHmNa19.js";import{t as It}from"./settings-OBbrbhij.js";import{y as Pt}from"./textarea-UfsPtSW1.js";import{t as Et}from"./square-DPZjfUaq.js";import{t as C}from"./use-toast-T0_cQDma.js";import{n as Ce,t as Tt}from"./paths-Dfii2bN8.js";import{o as Ht}from"./session-fBtIbMpB.js";import{a as Lt,c as qt,i as Rt,n as Vt,r as Ot,s as Bt,t as Ut}from"./select-B7bfltkI.js";import{t as Yt}from"./tooltip-C_WgOOcZ.js";import{a as ze,i as $t,r as Ft}from"./mode-CTf4rB7H.js";import{o as Gt}from"./alert-dialog-Ctz24SMn.js";import{a as Kt,c as Jt,i as Zt,n as Xt,r as Qt}from"./dialog-tQELcltn.js";import{n as oe}from"./ImperativeModal-DZr52ffu.js";import{r as ea,t as ta}from"./share-rXkgGlhr.js";import{t as U}from"./copy-BaRrAFL-.js";import{r as aa}from"./useRunCells-DaW_oMnr.js";import{a as oa}from"./cell-link-B37i0WNz.js";import{a as Me}from"./renderShortcut-Xr6z-RjZ.js";import{t as na}from"./icons-DjR3qLG_.js";import{t as ia}from"./links-DgZx-VxW.js";import{r as la,t as sa}from"./hooks-B2h7NTXb.js";import{t as We}from"./types-DZmRsGZN.js";var ra=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),da=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),_e=h("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),Se=h("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),Ae=h("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),ca=h("fast-forward",[["path",{d:"M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z",key:"b19h5q"}],["path",{d:"M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z",key:"h7h5ge"}]]),ha=h("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]),pa=h("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),Ne=h("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),ma=h("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),ua=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),De=h("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),fa=h("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),ya=h("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Ie=h("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),Pe=W(),ne=de(Ue(),1),a=de(dt(),1),Y="https://static.marimo.app";const ba=e=>{let t=(0,Pe.c)(25),{onClose:n}=e,[o,l]=(0,ne.useState)(""),{exportAsHTML:r}=P(),s=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${Y}/static/${s}`,d;t[0]!==r||t[1]!==n||t[2]!==s?(d=async v=>{v.preventDefault(),n();let S=await r({download:!1,includeCode:!0,files:ht.INSTANCE.filenames()}),z=C({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Y}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:S,path:s})}).catch(()=>{z.dismiss(),C({title:"Error uploading static page",description:(0,a.jsxs)("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",(0,a.jsx)("a",{href:_.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),z.dismiss(),C({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},t[0]=r,t[1]=n,t[2]=s,t[3]=d):d=t[3];let p;t[4]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(Jt,{children:"Share static notebook"}),t[4]=p):p=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(Kt,{children:[p,(0,a.jsxs)(Qt,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",(0,a.jsx)("a",{href:Y,target:"_blank",children:Y}),"."]})]}),t[5]=w):w=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{l(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let m;t[7]===o?m=t[8]:(m=(0,a.jsx)(Dt,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=m);let u;t[9]===i?u=t[10]:(u=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(ka,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),t[9]=i,t[10]=u);let f;t[11]!==m||t[12]!==u?(f=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[m,u]}),t[11]=m,t[12]=u,t[13]=f):f=t[13];let y;t[14]===n?y=t[15]:(y=(0,a.jsx)(ae,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=y);let b;t[16]===i?b=t[17]:(b=(0,a.jsx)(ae,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await U(i)},children:"Create"}),t[16]=i,t[17]=b);let k;t[18]!==y||t[19]!==b?(k=(0,a.jsxs)(Zt,{children:[y,b]}),t[18]=y,t[19]=b,t[20]=k):k=t[20];let j;return t[21]!==d||t[22]!==k||t[23]!==f?(j=(0,a.jsx)(Xt,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[w,f,k]})}),t[21]=d,t[22]=k,t[23]=f,t[24]=j):j=t[24],j};var ka=e=>{let t=(0,Pe.c)(8),[n,o]=ne.useState(!1),l;t[0]===e.text?l=t[1]:(l=ct.stopPropagation(async p=>{p.preventDefault(),await U(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=l);let r=l,s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(xt,{size:14,strokeWidth:1.5}),t[2]=s):s=t[2];let i;t[3]===r?i=t[4]:(i=(0,a.jsx)(ae,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:s}),t[3]=r,t[4]=i);let d;return t[5]!==n||t[6]!==i?(d=(0,a.jsx)(Yt,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=d):d=t[7],d},xa=W();function wa(){let e=document.getElementsByClassName(fe.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=te.findElement(t);if(!o){I.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:te.parse(o.id)}}}return I.warn("No visible output area found for scroll anchor"),null}function ga(e){if(!e){I.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(te.create(e.cellId));if(!t){I.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${fe.outputArea}`)){I.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ee(){let e=(0,xa.c)(2),t=D(ze),n;return e[0]===t?n=e[1]:(n=()=>{let o=wa();t(l=>({mode:$t(l.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{ga(o)})})},e[0]=t,e[1]=n),n}const Te=Be(!1);var ja=W();const va=()=>{let e=(0,ja.c)(7),{selectedLayout:t}=be(),{setLayoutView:n}=ke();if(ye()&&!he("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=i=>n(i),e[0]=n,e[1]=o);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(Bt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(qt,{placeholder:"Select a view"})}),e[2]=l):l=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Vt,{children:(0,a.jsxs)(Ot,{children:[(0,a.jsx)(Lt,{children:"View as"}),We.map(za)]})}),e[3]=r):r=e[3];let s;return e[4]!==t||e[5]!==o?(s=(0,a.jsxs)(Ut,{"data-testid":"layout-select",value:t,onValueChange:o,children:[l,r]}),e[4]=t,e[5]=o,e[6]=s):s=e[6],s};function Ca(e){return(0,a.jsx)(He(e),{className:"h-4 w-4"})}function He(e){switch(e){case"vertical":return ma;case"grid":return Mt;case"slides":return De;default:return at(e),Et}}function Le(e){return me(e)}function za(e){return(0,a.jsx)(Rt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Ca(e),(0,a.jsx)("span",{children:Le(e)})]})},e)}var Ma=W();function Wa(e){let t=(0,Ma.c)(5),{openPrompt:n,closeModal:o}=oe(),{sendCopy:l}=P(),r;return t[0]!==o||t[1]!==n||t[2]!==l||t[3]!==e?(r=()=>{if(!e)return null;let s=Tt.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Ce.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=s.join(Ce.dirname(e),i);l({source:e,destination:d}).then(()=>{o(),C({title:"Notebook copied",description:"A copy of the notebook has been created."}),ia(d)})}})},t[0]=o,t[1]=n,t[2]=l,t[3]=e,t[4]=r):r=t[4],r}const _a=()=>{let{updateCellConfig:e}=pe(),{saveCellConfig:t}=P();return(0,ne.useCallback)(async()=>{let n=new $e,o=ce(),l=o.cellIds.inOrderIds,r={};for(let i of l){if(o.cellData[i]===void 0)continue;let{code:d,config:p}=o.cellData[i];p.hide_code||n.isSupported(d)&&(r[i]={hide_code:!0})}let s=ue.entries(r);if(s.length!==0){await t({configs:r});for(let[i,d]of s)e({cellId:i,config:d})}},[e])};var Sa=W();function qe(){let e=(0,Sa.c)(4),{openConfirm:t}=oe(),n=D(st),{sendRestart:o}=P(),l;return e[0]!==t||e[1]!==o||e[2]!==n?(l=()=>{t({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(Gt,{onClick:async()=>{n({state:rt.CLOSING}),await o(),ea()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=l):l=e[3],l}var Aa=W(),E=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Na(){var se,re;let e=(0,Aa.c)(40),t=oa(),{openModal:n,closeModal:o}=oe(),{toggleApplication:l}=Ze(),{selectedPanel:r}=Qe(),[s]=Oe(ze),i=ee(Ft),d=_a(),[p]=lt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:m,addSetupCellIfDoesntExist:u,collapseAllCells:f,expandAllCells:y}=pe(),b=qe(),k=aa(),j=Wa(t),v=D(Te),S=D(nt),z=D(it),{exportAsMarkdown:$,readCode:A,saveCellConfig:F,updateCellOutputs:G}=P(),K=ee(Xe),J=ee(et),{selectedLayout:Z}=be(),{setLayoutView:X}=ke(),T=Ee(),Q=la(),H=((se=p.sharing)==null?void 0:se.html)??!0,L=((re=p.sharing)==null?void 0:re.wasm)??!0,q;e[0]===Symbol.for("react.memo_cache_sentinel")?(q=he("server_side_pdf_export"),e[0]=q):q=e[0];let le=q,R=le||s.mode==="present",Re=Ga,V;e[1]===Symbol.for("react.memo_cache_sentinel")?(V=(0,a.jsx)(wt,{size:14,strokeWidth:1.5}),e[1]=V):V=e[1];let O;e[2]===Symbol.for("react.memo_cache_sentinel")?(O=(0,a.jsx)(xe,{size:14,strokeWidth:1.5}),e[2]=O):O=e[2];let M;e[3]===t?M=e[4]:(M=async()=>{if(!t){ie();return}await we({filename:t,includeCode:!0})},e[3]=t,e[4]=M);let B;return e[5]!==u||e[6]!==J||e[7]!==m||e[8]!==o||e[9]!==f||e[10]!==j||e[11]!==y||e[12]!==$||e[13]!==t||e[14]!==K||e[15]!==d||e[16]!==i||e[17]!==n||e[18]!==R||e[19]!==A||e[20]!==b||e[21]!==k||e[22]!==F||e[23]!==Z||e[24]!==r||e[25]!==v||e[26]!==z||e[27]!==X||e[28]!==S||e[29]!==H||e[30]!==L||e[31]!==M||e[32]!==Q||e[33]!==l||e[34]!==T||e[35]!==g||e[36]!==w||e[37]!==G||e[38]!==s.mode?(B=[{icon:V,label:"Download",handle:E,dropdown:[{icon:O,label:"Download as HTML",handle:M},{icon:(0,a.jsx)(xe,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){ie();return}await we({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(na,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await $({download:!1});ve(new Blob([c],{type:"text/plain"}),je.toMarkdown(document.title))}},{icon:(0,a.jsx)(pt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await A();ve(new Blob([c.contents],{type:"text/plain"}),je.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:s.mode!=="present",tooltip:s.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Me("global.hideCode",!1)]}),handle:Fa},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Download as PDF",disabled:!R,tooltip:R?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Me("global.hideCode",!1)]}),handle:async()=>{if(le){if(!t){ie();return}await mt("Downloading PDF...",async N=>{await sa({takeScreenshots:()=>Q({progress:N}),updateCellOutputs:G}),await ut({filename:t,webpdf:!1})});return}let c=new Event("export-beforeprint"),x=new Event("export-afterprint");(function(){window.dispatchEvent(c),setTimeout($a,0),setTimeout(()=>window.dispatchEvent(x),0)})()}}]},{icon:(0,a.jsx)(fa,{size:14,strokeWidth:1.5}),label:"Share",handle:E,hidden:!H&&!L,dropdown:[{icon:(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!H,handle:async()=>{n((0,a.jsx)(ba,{onClose:o}))}},{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!L,handle:async()=>{await U(ta({code:(await A()).contents})),C({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:E,dropdown:tt.flatMap(c=>{let{type:x,Icon:N,hidden:Ve}=c;return Ve?[]:{label:me(x),rightElement:Re(r===x),icon:(0,a.jsx)(N,{size:14,strokeWidth:1.5}),handle:()=>l(x)}})},{icon:(0,a.jsx)(De,{size:14,strokeWidth:1.5}),label:"Present as",handle:E,dropdown:[{icon:s.mode==="present"?(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}):(0,a.jsx)(Ne,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{T()}},...We.map((c,x)=>{let N=He(c);return{divider:x===0,label:Le(c),icon:(0,a.jsx)(N,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:Z===c&&(0,a.jsx)(ge,{size:14})}),handle:()=>{X(c),s.mode==="edit"&&T()}}})]},{icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||ye(),handle:j},{icon:(0,a.jsx)(_e,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await U((await A()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(kt,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!K||i,handle:async()=>{let c=Je(ce());await F({configs:ue.fromEntries(c.map(Ya))});for(let x of c)w({cellId:x,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Ae,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{u({})}},{icon:(0,a.jsx)(Fe,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(ot,{onClose:o}))}},{icon:(0,a.jsx)(Ie,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!J||i,handle:()=>{g()}},{icon:(0,a.jsx)(ya,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:b},{icon:(0,a.jsx)(ca,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{k()}},{icon:(0,a.jsx)(Ye,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{m()}},{icon:(0,a.jsx)(gt,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:f,redundant:!0},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:y,redundant:!0},{divider:!0,icon:(0,a.jsx)(Se,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(Ua)},{icon:(0,a.jsx)(pa,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(Ba)},{icon:(0,a.jsx)(It,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>S(Oa),redundant:!0},{icon:(0,a.jsx)(bt,{size:14,strokeWidth:1.5}),label:"Resources",handle:E,dropdown:[{icon:(0,a.jsx)(Ke,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Va},{icon:(0,a.jsx)(Ct,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Ra},{icon:(0,a.jsx)(zt,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:qa},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:La},{icon:(0,a.jsx)(Ge,{size:14,strokeWidth:1.5}),label:"Changelog",handle:Ha}]},{divider:!0,icon:(0,a.jsx)(St,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Ta},{icon:(0,a.jsx)(jt,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Ea}].filter(Pa).map(Da),e[5]=u,e[6]=J,e[7]=m,e[8]=o,e[9]=f,e[10]=j,e[11]=y,e[12]=$,e[13]=t,e[14]=K,e[15]=d,e[16]=i,e[17]=n,e[18]=R,e[19]=A,e[20]=b,e[21]=k,e[22]=F,e[23]=Z,e[24]=r,e[25]=v,e[26]=z,e[27]=X,e[28]=S,e[29]=H,e[30]=L,e[31]=M,e[32]=Q,e[33]=l,e[34]=T,e[35]=g,e[36]=w,e[37]=G,e[38]=s.mode,e[39]=B):B=e[39],B}function Da(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Ia)}:e}function Ia(e){return!e.hidden}function Pa(e){return!e.hidden}function Ea(){let e=Ht();window.open(e,"_blank")}function Ta(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function Ha(){window.open(_.releasesPage,"_blank")}function La(){window.open(_.youtube,"_blank")}function qa(){window.open(_.discordLink,"_blank")}function Ra(){window.open(_.githubPage,"_blank")}function Va(){window.open(_.docsPage,"_blank")}function Oa(e){return!e}function Ba(e){return!e}function Ua(e){return!e}function Ya(e){return[e,{disabled:!1}]}function $a(){return window.print()}async function Fa(){let e=document.getElementById("App");e&&await ft({element:e,filename:document.title,prepare:yt})}function Ga(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(ge,{size:14})})}function ie(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{Ee as a,Ae as c,Te as i,Se as l,qe as n,Ie as o,va as r,Ne as s,Na as t,_e as u};
1
+ import{s as de}from"./chunk-LvLJmgfZ.js";import{d as D,l as Oe,p as Be,u as ee}from"./useEvent-BhXAndur.js";import{t as Ue}from"./react-Bj1aDYRI.js";import{Kn as Ye,Mt as $e,Un as Fe,Vn as Ge,Zn as Ke,_r as Je,cn as Ze,g as Xe,ln as Qe,m as ce,pn as he,ri as te,t as et,un as tt,w as pe}from"./cells-B0XKj2oa.js";import{t as W}from"./compiler-runtime-B3qBwwSJ.js";import{n as at}from"./assertNever-CBU83Y6o.js";import{s as me}from"./useLifecycle-ClI_npeg.js";import{n as ot}from"./add-database-form-BnEY6X5s.js";import{n as nt,x as it}from"./ai-model-dropdown-Cugcw6NV.js";import{a as ue,d as I}from"./hotkeys-BHHWjLlp.js";import{y as lt}from"./utils-YqBXNpsM.js";import{n as _,t as fe}from"./constants-B6Cb__3x.js";import{S as ye,h as st,x as rt}from"./config-D2-Bw6QC.js";import{t as dt}from"./jsx-runtime-ZmTK25f3.js";import{r as ct,t as ae}from"./button-CZ3Cs4qb.js";import{r as P}from"./requests-B4FYHTZl.js";import{t as h}from"./createLucideIcon-BCdY6lG5.js";import{a as be,f as ht,i as ke,m as pt,p as xe,u as we}from"./layout-BRVYycwo.js";import{t as ge}from"./check-Dr3SxUsb.js";import{c as mt,d as je,n as ut,o as ft,r as ve,t as yt}from"./download-CxmzcjnR.js";import{f as bt}from"./maps-D2_Mq1pZ.js";import{r as kt}from"./useCellActionButton-Du-bZZ06.js";import{t as xt}from"./copy-D-8y6iMN.js";import{t as wt}from"./download-Dg7clfkc.js";import{t as gt}from"./eye-off-AK_9uodG.js";import{t as jt}from"./file-plus-corner-CvAy4H5W.js";import{t as vt}from"./file-Ch78NKWp.js";import{i as Ct,n as zt,r as Mt,t as Wt}from"./youtube--tNPNRy6.js";import{n as _t,t as St}from"./house-BI81AWSn.js";import{n as At}from"./play-GLWQQs7F.js";import{t as Nt}from"./link-DxicfMbs.js";import{r as Dt}from"./input-DHHmNa19.js";import{t as It}from"./settings-OBbrbhij.js";import{y as Pt}from"./textarea-UfsPtSW1.js";import{t as Et}from"./square-DPZjfUaq.js";import{t as C}from"./use-toast-T0_cQDma.js";import{n as Ce,t as Tt}from"./paths-Dfii2bN8.js";import{o as Ht}from"./session-fBtIbMpB.js";import{a as Lt,c as qt,i as Rt,n as Vt,r as Ot,s as Bt,t as Ut}from"./select-B7bfltkI.js";import{t as Yt}from"./tooltip-C_WgOOcZ.js";import{a as ze,i as $t,r as Ft}from"./mode-CTf4rB7H.js";import{o as Gt}from"./alert-dialog-Ctz24SMn.js";import{a as Kt,c as Jt,i as Zt,n as Xt,r as Qt}from"./dialog-tQELcltn.js";import{n as oe}from"./ImperativeModal-DZr52ffu.js";import{r as ea,t as ta}from"./share-rXkgGlhr.js";import{t as U}from"./copy-BaRrAFL-.js";import{r as aa}from"./useRunCells-DaW_oMnr.js";import{a as oa}from"./cell-link-B37i0WNz.js";import{a as Me}from"./renderShortcut-Xr6z-RjZ.js";import{t as na}from"./icons-DjR3qLG_.js";import{t as ia}from"./links-DgZx-VxW.js";import{r as la,t as sa}from"./hooks-B2h7NTXb.js";import{t as We}from"./types-DZmRsGZN.js";var ra=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),da=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),_e=h("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),Se=h("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),Ae=h("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),ca=h("fast-forward",[["path",{d:"M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z",key:"b19h5q"}],["path",{d:"M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z",key:"h7h5ge"}]]),ha=h("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]),pa=h("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),Ne=h("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),ma=h("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),ua=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),De=h("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),fa=h("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),ya=h("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Ie=h("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),Pe=W(),ne=de(Ue(),1),a=de(dt(),1),Y="https://static.marimo.app";const ba=e=>{let t=(0,Pe.c)(25),{onClose:n}=e,[o,l]=(0,ne.useState)(""),{exportAsHTML:r}=P(),s=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${Y}/static/${s}`,d;t[0]!==r||t[1]!==n||t[2]!==s?(d=async v=>{v.preventDefault(),n();let S=await r({download:!1,includeCode:!0,files:ht.INSTANCE.filenames()}),z=C({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Y}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:S,path:s})}).catch(()=>{z.dismiss(),C({title:"Error uploading static page",description:(0,a.jsxs)("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",(0,a.jsx)("a",{href:_.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),z.dismiss(),C({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},t[0]=r,t[1]=n,t[2]=s,t[3]=d):d=t[3];let p;t[4]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(Jt,{children:"Share static notebook"}),t[4]=p):p=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(Kt,{children:[p,(0,a.jsxs)(Qt,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",(0,a.jsx)("a",{href:Y,target:"_blank",children:Y}),"."]})]}),t[5]=w):w=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{l(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let m;t[7]===o?m=t[8]:(m=(0,a.jsx)(Dt,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=m);let u;t[9]===i?u=t[10]:(u=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(ka,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),t[9]=i,t[10]=u);let f;t[11]!==m||t[12]!==u?(f=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[m,u]}),t[11]=m,t[12]=u,t[13]=f):f=t[13];let y;t[14]===n?y=t[15]:(y=(0,a.jsx)(ae,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=y);let b;t[16]===i?b=t[17]:(b=(0,a.jsx)(ae,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await U(i)},children:"Create"}),t[16]=i,t[17]=b);let k;t[18]!==y||t[19]!==b?(k=(0,a.jsxs)(Zt,{children:[y,b]}),t[18]=y,t[19]=b,t[20]=k):k=t[20];let j;return t[21]!==d||t[22]!==k||t[23]!==f?(j=(0,a.jsx)(Xt,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[w,f,k]})}),t[21]=d,t[22]=k,t[23]=f,t[24]=j):j=t[24],j};var ka=e=>{let t=(0,Pe.c)(8),[n,o]=ne.useState(!1),l;t[0]===e.text?l=t[1]:(l=ct.stopPropagation(async p=>{p.preventDefault(),await U(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=l);let r=l,s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(xt,{size:14,strokeWidth:1.5}),t[2]=s):s=t[2];let i;t[3]===r?i=t[4]:(i=(0,a.jsx)(ae,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:s}),t[3]=r,t[4]=i);let d;return t[5]!==n||t[6]!==i?(d=(0,a.jsx)(Yt,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=d):d=t[7],d},xa=W();function wa(){let e=document.getElementsByClassName(fe.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=te.findElement(t);if(!o){I.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:te.parse(o.id)}}}return I.warn("No visible output area found for scroll anchor"),null}function ga(e){if(!e){I.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(te.create(e.cellId));if(!t){I.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${fe.outputArea}`)){I.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ee(){let e=(0,xa.c)(2),t=D(ze),n;return e[0]===t?n=e[1]:(n=()=>{let o=wa();t(l=>({mode:$t(l.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{ga(o)})})},e[0]=t,e[1]=n),n}const Te=Be(!1);var ja=W();const va=()=>{let e=(0,ja.c)(7),{selectedLayout:t}=be(),{setLayoutView:n}=ke();if(ye()&&!he("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=i=>n(i),e[0]=n,e[1]=o);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(Bt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(qt,{placeholder:"Select a view"})}),e[2]=l):l=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Vt,{children:(0,a.jsxs)(Ot,{children:[(0,a.jsx)(Lt,{children:"View as"}),We.map(za)]})}),e[3]=r):r=e[3];let s;return e[4]!==t||e[5]!==o?(s=(0,a.jsxs)(Ut,{"data-testid":"layout-select",value:t,onValueChange:o,children:[l,r]}),e[4]=t,e[5]=o,e[6]=s):s=e[6],s};function Ca(e){return(0,a.jsx)(He(e),{className:"h-4 w-4"})}function He(e){switch(e){case"vertical":return ma;case"grid":return Mt;case"slides":return De;default:return at(e),Et}}function Le(e){return me(e)}function za(e){return(0,a.jsx)(Rt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Ca(e),(0,a.jsx)("span",{children:Le(e)})]})},e)}var Ma=W();function Wa(e){let t=(0,Ma.c)(5),{openPrompt:n,closeModal:o}=oe(),{sendCopy:l}=P(),r;return t[0]!==o||t[1]!==n||t[2]!==l||t[3]!==e?(r=()=>{if(!e)return null;let s=Tt.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Ce.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=s.join(Ce.dirname(e),i);l({source:e,destination:d}).then(()=>{o(),C({title:"Notebook copied",description:"A copy of the notebook has been created."}),ia(d)})}})},t[0]=o,t[1]=n,t[2]=l,t[3]=e,t[4]=r):r=t[4],r}const _a=()=>{let{updateCellConfig:e}=pe(),{saveCellConfig:t}=P();return(0,ne.useCallback)(async()=>{let n=new $e,o=ce(),l=o.cellIds.inOrderIds,r={};for(let i of l){if(o.cellData[i]===void 0)continue;let{code:d,config:p}=o.cellData[i];p.hide_code||n.isSupported(d)&&(r[i]={hide_code:!0})}let s=ue.entries(r);if(s.length!==0){await t({configs:r});for(let[i,d]of s)e({cellId:i,config:d})}},[e])};var Sa=W();function qe(){let e=(0,Sa.c)(4),{openConfirm:t}=oe(),n=D(st),{sendRestart:o}=P(),l;return e[0]!==t||e[1]!==o||e[2]!==n?(l=()=>{t({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(Gt,{onClick:async()=>{n({state:rt.CLOSING}),await o(),ea()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=l):l=e[3],l}var Aa=W(),E=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Na(){var se,re;let e=(0,Aa.c)(40),t=oa(),{openModal:n,closeModal:o}=oe(),{toggleApplication:l}=Ze(),{selectedPanel:r}=Qe(),[s]=Oe(ze),i=ee(Ft),d=_a(),[p]=lt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:m,addSetupCellIfDoesntExist:u,collapseAllCells:f,expandAllCells:y}=pe(),b=qe(),k=aa(),j=Wa(t),v=D(Te),S=D(nt),z=D(it),{exportAsMarkdown:$,readCode:A,saveCellConfig:F,updateCellOutputs:G}=P(),K=ee(Xe),J=ee(et),{selectedLayout:Z}=be(),{setLayoutView:X}=ke(),T=Ee(),Q=la(),H=((se=p.sharing)==null?void 0:se.html)??!0,L=((re=p.sharing)==null?void 0:re.wasm)??!0,q;e[0]===Symbol.for("react.memo_cache_sentinel")?(q=he("server_side_pdf_export"),e[0]=q):q=e[0];let le=q,R=le||s.mode==="present",Re=Ga,V;e[1]===Symbol.for("react.memo_cache_sentinel")?(V=(0,a.jsx)(wt,{size:14,strokeWidth:1.5}),e[1]=V):V=e[1];let O;e[2]===Symbol.for("react.memo_cache_sentinel")?(O=(0,a.jsx)(xe,{size:14,strokeWidth:1.5}),e[2]=O):O=e[2];let M;e[3]===t?M=e[4]:(M=async()=>{if(!t){ie();return}await we({filename:t,includeCode:!0})},e[3]=t,e[4]=M);let B;return e[5]!==u||e[6]!==J||e[7]!==m||e[8]!==o||e[9]!==f||e[10]!==j||e[11]!==y||e[12]!==$||e[13]!==t||e[14]!==K||e[15]!==d||e[16]!==i||e[17]!==n||e[18]!==R||e[19]!==A||e[20]!==b||e[21]!==k||e[22]!==F||e[23]!==Z||e[24]!==r||e[25]!==v||e[26]!==z||e[27]!==X||e[28]!==S||e[29]!==H||e[30]!==L||e[31]!==M||e[32]!==Q||e[33]!==l||e[34]!==T||e[35]!==g||e[36]!==w||e[37]!==G||e[38]!==s.mode?(B=[{icon:V,label:"Download",handle:E,dropdown:[{icon:O,label:"Download as HTML",handle:M},{icon:(0,a.jsx)(xe,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){ie();return}await we({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(na,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await $({download:!1});ve(new Blob([c],{type:"text/plain"}),je.toMarkdown(document.title))}},{icon:(0,a.jsx)(pt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await A();ve(new Blob([c.contents],{type:"text/plain"}),je.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:s.mode!=="present",tooltip:s.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Me("global.hideCode",!1)]}),handle:Fa},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Download as PDF",disabled:!R,tooltip:R?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Me("global.hideCode",!1)]}),handle:async()=>{if(le){if(!t){ie();return}await mt("Downloading PDF...",async N=>{await sa({takeScreenshots:()=>Q({progress:N}),updateCellOutputs:G}),await ut({filename:t,webpdf:!1})});return}let c=new Event("export-beforeprint"),x=new Event("export-afterprint");(function(){window.dispatchEvent(c),setTimeout($a,0),setTimeout(()=>window.dispatchEvent(x),0)})()}}]},{icon:(0,a.jsx)(fa,{size:14,strokeWidth:1.5}),label:"Share",handle:E,hidden:!H&&!L,dropdown:[{icon:(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!H,handle:async()=>{n((0,a.jsx)(ba,{onClose:o}))}},{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!L,handle:async()=>{await U(ta({code:(await A()).contents})),C({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:E,dropdown:tt.flatMap(c=>{let{type:x,Icon:N,hidden:Ve}=c;return Ve?[]:{label:me(x),rightElement:Re(r===x),icon:(0,a.jsx)(N,{size:14,strokeWidth:1.5}),handle:()=>l(x)}})},{icon:(0,a.jsx)(De,{size:14,strokeWidth:1.5}),label:"Present as",handle:E,dropdown:[{icon:s.mode==="present"?(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}):(0,a.jsx)(Ne,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{T()}},...We.map((c,x)=>{let N=He(c);return{divider:x===0,label:Le(c),icon:(0,a.jsx)(N,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:Z===c&&(0,a.jsx)(ge,{size:14})}),handle:()=>{X(c),s.mode==="edit"&&T()}}})]},{icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||ye(),handle:j},{icon:(0,a.jsx)(_e,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await U((await A()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(kt,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!K||i,handle:async()=>{let c=Je(ce());await F({configs:ue.fromEntries(c.map(Ya))});for(let x of c)w({cellId:x,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Ae,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{u({})}},{icon:(0,a.jsx)(Fe,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(ot,{onClose:o}))}},{icon:(0,a.jsx)(Ie,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!J||i,handle:()=>{g()}},{icon:(0,a.jsx)(ya,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:b},{icon:(0,a.jsx)(ca,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{k()}},{icon:(0,a.jsx)(Ye,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{m()}},{icon:(0,a.jsx)(gt,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:f,redundant:!0},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:y,redundant:!0},{divider:!0,icon:(0,a.jsx)(Se,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(Ua)},{icon:(0,a.jsx)(pa,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(Ba)},{icon:(0,a.jsx)(It,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>S(Oa),redundant:!0},{icon:(0,a.jsx)(bt,{size:14,strokeWidth:1.5}),label:"Resources",handle:E,dropdown:[{icon:(0,a.jsx)(Ke,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Va},{icon:(0,a.jsx)(Ct,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Ra},{icon:(0,a.jsx)(zt,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:qa},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:La},{icon:(0,a.jsx)(Ge,{size:14,strokeWidth:1.5}),label:"Changelog",handle:Ha}]},{divider:!0,icon:(0,a.jsx)(St,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Ta},{icon:(0,a.jsx)(jt,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Ea}].filter(Pa).map(Da),e[5]=u,e[6]=J,e[7]=m,e[8]=o,e[9]=f,e[10]=j,e[11]=y,e[12]=$,e[13]=t,e[14]=K,e[15]=d,e[16]=i,e[17]=n,e[18]=R,e[19]=A,e[20]=b,e[21]=k,e[22]=F,e[23]=Z,e[24]=r,e[25]=v,e[26]=z,e[27]=X,e[28]=S,e[29]=H,e[30]=L,e[31]=M,e[32]=Q,e[33]=l,e[34]=T,e[35]=g,e[36]=w,e[37]=G,e[38]=s.mode,e[39]=B):B=e[39],B}function Da(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Ia)}:e}function Ia(e){return!e.hidden}function Pa(e){return!e.hidden}function Ea(){let e=Ht();window.open(e,"_blank")}function Ta(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function Ha(){window.open(_.releasesPage,"_blank")}function La(){window.open(_.youtube,"_blank")}function qa(){window.open(_.discordLink,"_blank")}function Ra(){window.open(_.githubPage,"_blank")}function Va(){window.open(_.docsPage,"_blank")}function Oa(e){return!e}function Ba(e){return!e}function Ua(e){return!e}function Ya(e){return[e,{disabled:!1}]}function $a(){return window.print()}async function Fa(){let e=document.getElementById("App");e&&await ft({element:e,filename:document.title,prepare:yt})}function Ga(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(ge,{size:14})})}function ie(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{Ee as a,Ae as c,Te as i,Se as l,qe as n,Ie as o,va as r,Ne as s,Na as t,_e as u};
package/dist/index.html CHANGED
@@ -66,7 +66,7 @@
66
66
  <marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
67
67
  <!-- /TODO -->
68
68
  <title>{{ title }}</title>
69
- <script type="module" crossorigin src="./assets/index-9tYTLI2E.js"></script>
69
+ <script type="module" crossorigin src="./assets/index-BSNJ0Y0E.js"></script>
70
70
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-DItdS47A.js">
71
71
  <link rel="modulepreload" crossorigin href="./assets/clsx-D8GwTfvk.js">
72
72
  <link rel="modulepreload" crossorigin href="./assets/cn-BKtXLv3a.js">
@@ -171,7 +171,7 @@
171
171
  <link rel="modulepreload" crossorigin href="./assets/refresh-cw-Dx8TEWFP.js">
172
172
  <link rel="modulepreload" crossorigin href="./assets/trash-2-B8SQYdQq.js">
173
173
  <link rel="modulepreload" crossorigin href="./assets/triangle-alert-U93NZYDl.js">
174
- <link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-BHE9fW6D.js">
174
+ <link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-Cugcw6NV.js">
175
175
  <link rel="modulepreload" crossorigin href="./assets/defaultLocale-YteS-k_t.js">
176
176
  <link rel="modulepreload" crossorigin href="./assets/precisionRound-C3fmBb6j.js">
177
177
  <link rel="modulepreload" crossorigin href="./assets/defaultLocale-B6z1Qyqt.js">
@@ -212,14 +212,14 @@
212
212
  <link rel="modulepreload" crossorigin href="./assets/play-GLWQQs7F.js">
213
213
  <link rel="modulepreload" crossorigin href="./assets/chat-components-BNjAKvAv.js">
214
214
  <link rel="modulepreload" crossorigin href="./assets/isEmpty-CgX_-6Mt.js">
215
- <link rel="modulepreload" crossorigin href="./assets/chat-display-C-NTnBZ7.js">
215
+ <link rel="modulepreload" crossorigin href="./assets/chat-display-q9RdcWB-.js">
216
216
  <link rel="modulepreload" crossorigin href="./assets/useDeleteCell-D0DAGwMP.js">
217
217
  <link rel="modulepreload" crossorigin href="./assets/icons-DjR3qLG_.js">
218
218
  <link rel="modulepreload" crossorigin href="./assets/process-output-CdIpMer6.js">
219
219
  <link rel="modulepreload" crossorigin href="./assets/blob-Bgnx1kuY.js">
220
220
  <link rel="modulepreload" crossorigin href="./assets/objectWithoutPropertiesLoose-DoKw85w0.js">
221
221
  <link rel="modulepreload" crossorigin href="./assets/esm-BK6tLEHQ.js">
222
- <link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-C_zccHSx.js">
222
+ <link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-B07D0AiE.js">
223
223
  <link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-qvVRjhv1.js">
224
224
  <link rel="modulepreload" crossorigin href="./assets/square-function-B6mgCeFJ.js">
225
225
  <link rel="modulepreload" crossorigin href="./assets/spec-Ch0xnJY4.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.19.8-dev38",
3
+ "version": "0.19.8-dev39",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",