@marimo-team/frontend 0.23.3-dev28 → 0.23.3-dev29

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-D91BmmQi.js";import{t as le}from"./react-Bj1aDYRI.js";import{_r as V}from"./cells-_QgKZKXb.js";import"./react-dom-CSu739Rf.js";import{t as ie}from"./compiler-runtime-B3qBwwSJ.js";import{r as ce}from"./ai-model-dropdown-BizqKH6Q.js";import{y as de}from"./utils-DIGrmLDO.js";import{S as me}from"./config-BwY7xK-l.js";import{t as K}from"./cn-DCUzRj2J.js";import{t as pe}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-BDxedMYP.js";import"./popover-UExmgBsf.js";import{t as J}from"./tooltip-Gcwqb_SK.js";import{r as xe}from"./button-D9nb17Rw.js";import"./dist-BrR4M-k3.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{r as W}from"./requests-DIwGYs0l.js";import{r as ue}from"./x-C-6liIBr.js";import{t as fe}from"./chevron-right-CG5QYXYk.js";import{u as ge}from"./toDate-B5A0DFEz.js";import{t as R}from"./spinner-jEqwgi_c.js";import{a as he}from"./input-gOeJx-hY.js";import"./dist-Bd6jkjtM.js";import"./dist-CZoX3_w7.js";import"./dist-D80LaxlS.js";import"./dist-B4jGC5bx.js";import"./dist-BNScjj64.js";import{t as ve}from"./use-toast-DZOInYtM.js";import"./session-DI1agD5_.js";import"./purify.es-Lm0LKKB_.js";import{n as je}from"./copy-MpDsCBB6.js";import{i as be,n as F,r as Q,s as X,t as ke}from"./useInstallPackage-DQBOxUeJ.js";import{n as Y}from"./error-banner-B6M4W7BS.js";import{n as ye}from"./useAsyncData-BRNkjHs1.js";import{a as Ne,i as q,n as we,o as Z,r as B,t as Se}from"./table-CZ3rujd6.js";import{t as ee}from"./empty-state-CPvr0RGL.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(pe(),1),te=t=>{let e=(0,G.c)(9),{onClick:s,loading:n,children:i,className:p}=t;if(n){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=(0,r.jsx)(R,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=l):l=e[0],l}let c;e[1]===p?c=e[2]:(c=K("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",p),e[1]=p,e[2]=c);let a;e[3]===s?a=e[4]:(a=xe.stopPropagation(s),e[3]=s,e[4]=a);let o;return e[5]!==i||e[6]!==c||e[7]!==a?(o=(0,r.jsx)("button",{type:"button",className:c,onClick:a,children:i}),e[5]=i,e[6]=c,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:i}=W(),[p,c]=I.useState(null),a;t[0]!==n||t[1]!==i?(a=async()=>{let[u,C]=await Promise.all([i(),n()]);return{list:u.packages,tree:C.tree}},t[0]=n,t[1]=i,t[2]=a):a=t[2];let o;t[3]===s?o=t[4]:(o=[s],t[3]=s,t[4]=o);let{data:l,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)(Y,{error:m}),t[6]=m,t[7]=u),u}let h=l.tree!=null,d;t[8]!==h||t[9]!==p?(d=De(p,h),t[8]=h,t[9]=p,t[10]=d):d=t[10];let f=d,x=(w=l.tree)==null?void 0:w.name,P=(S=l==null?void 0:l.tree)==null?void 0:S.version,y=x==="<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]!==x||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:()=>c("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:()=>c("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"}),x&&!y&&(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[x,P&&` v${P}`]})]})]}),t[14]=y,t[15]=h,t[16]=x,t[17]=P,t[18]=f,t[19]=b):b=t[19];let v;t[20]!==l.list||t[21]!==l.tree||t[22]!==m||t[23]!==j||t[24]!==f?(v=f==="list"?(0,r.jsx)(Ee,{packages:l.list,onSuccess:j}):(0,r.jsx)($e,{tree:l.tree,error:m,onSuccess:j}),t[20]=l.list,t[21]=l.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,[i,p]=I.useState(""),{handleClick:c}=ce(),a=oe(X),o=ae(X),l,m;e[0]!==a||e[1]!==o?(l=()=>{a&&(p(a),o(null))},m=[a,o],e[0]=a,e[1]=o,e[2]=l,e[3]=m):(l=e[2],m=e[3]),I.useEffect(l,m);let{loading:j,handleInstallPackages:g}=ke(),h;e[4]===s?h=e[5]:(h=()=>{s(),p("")},e[4]=s,e[5]=h);let d=h,f;e[6]!==g||e[7]!==i||e[8]!==d?(f=()=>{g([_e(i)],d)},e[6]=g,e[7]=i,e[8]=d,e[9]=f):f=e[9];let x=f,P=`Install packages with ${n}...`,y;e[10]!==j||e[11]!==c?(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:()=>c("packageManagementAndData"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=j,e[11]=c,e[12]=y):y=e[12];let k;e[13]===x?k=e[14]:(k=U=>{U.key==="Enter"&&(U.preventDefault(),x())},e[13]=x,e[14]=k);let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=U=>p(U.target.value),e[15]=b):b=e[15];let v;e[16]!==i||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:i,onKeyDown:k,onChange:b}),e[16]=i,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=i&&"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=!i,M;e[33]!==x||e[34]!==N||e[35]!==z?(M=(0,r.jsx)("button",{type:"button",className:N,onClick:x,disabled:z,children:"Add"}),e[33]=x,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 i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=(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]=i):i=e[1];let p;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),p=n.map(a),e[2]=s,e[3]=n,e[4]=p}else p=e[4];let c;return e[7]===p?c=e[8]:(c=(0,r.jsxs)(Se,{className:"overflow-auto flex-1",children:[i,(0,r.jsx)(we,{children:p})]}),e[7]=p,e[8]=c),c},re=({packageName:t,tags:e,onSuccess:s})=>{let[n,i]=I.useState(!1),{addPackage:p}=W();return me()?null:(0,r.jsx)(te,{onClick:async()=>{var c;try{i(!0);let a=(c=e==null?void 0:e.find(l=>l.kind==="group"))==null?void 0:c.value,o=await p({package:t,upgrade:!0,group:a});o.success?(s(),Q(t)):Q(t,o.error)}finally{i(!1)}},loading:n,children:"Upgrade"})},se=({packageName:t,tags:e,onSuccess:s})=>{let[n,i]=I.useState(!1),{removePackage:p}=W();return(0,r.jsx)(te,{onClick:async()=>{var c;try{i(!0);let a=(c=e==null?void 0:e.find(l=>l.kind==="group"))==null?void 0:c.value,o=await p({package:t,group:a});o.success?(s(),F(t)):F(t,o.error)}finally{i(!1)}},loading:n,children:"Remove"})},$e=t=>{let e=(0,G.c)(18),{tree:s,error:n,onSuccess:i}=t,p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=new Set,e[0]=p):p=e[0];let[c,a]=I.useState(p),o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a(new Set)},e[1]=o):o=e[1];let l;if(e[2]===s?l=e[3]:(l=[s],e[2]=s,e[3]=l),I.useEffect(o,l),n){let d;return e[4]===n?d=e[5]:(d=(0,r.jsx)(Y,{error:n}),e[4]=n,e[5]=d),d}if(!s){let d;return e[6]===Symbol.for("react.memo_cache_sentinel")?(d=(0,r.jsx)(R,{size:"medium",centered:!0}),e[6]=d):d=e[6],d}if(s.dependencies.length===0){let d;return e[7]===Symbol.for("react.memo_cache_sentinel")?(d=(0,r.jsx)(ee,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:(0,r.jsx)(V,{})}),e[7]=d):d=e[7],d}let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=d=>{a(f=>{let x=new Set(f);return x.has(d)?x.delete(d):x.add(d),x})},e[8]=m):m=e[8];let j=m,g;if(e[9]!==c||e[10]!==i||e[11]!==s.dependencies){let d;e[13]!==c||e[14]!==i?(d=(f,x)=>(0,r.jsx)("div",{className:"border-b",children:(0,r.jsx)(ne,{nodeId:`root-${x}`,node:f,level:0,isTopLevel:!0,expandedNodes:c,onToggle:j,onSuccess:i})},`${f.name}-${x}`),e[13]=c,e[14]=i,e[15]=d):d=e[15],g=s.dependencies.map(d),e[9]=c,e[10]=i,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:i,isTopLevel:p,expandedNodes:c,onToggle:a,onSuccess:o}=t,l=p===void 0?!1:p,m=n.dependencies.length>0,j;e[0]!==c||e[1]!==s?(j=c.has(s),e[0]=c,e[1]=s,e[2]=j):j=e[2];let g=j,h=l?0:16+i*16,d;e[3]!==m||e[4]!==s||e[5]!==a?(d=N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),m&&a(s))},e[3]=m,e[4]=s,e[5]=a,e[6]=d):d=e[6];let f=d,x;e[7]!==m||e[8]!==s||e[9]!==a?(x=N=>{N.stopPropagation(),m&&a(s)},e[7]=m,e[8]=s,e[9]=a,e[10]=x):x=e[10];let P=x,y=m&&"select-none",k=l?"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]!==l?(v=l?{}:{paddingLeft:`${h}px`},e[14]=h,e[15]=l,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]!==l||e[32]!==n.name||e[33]!==n.tags||e[34]!==o?(D=l&&(0,r.jsxs)("div",{className:"flex gap-1 invisible group-hover:visible",children:[(0,r.jsx)(re,{packageName:n.name,tags:n.tags,onSuccess:o}),(0,r.jsx)(se,{packageName:n.name,tags:n.tags,onSuccess:o})]}),e[31]=l,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]!==c||e[47]!==m||e[48]!==g||e[49]!==i||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:i+1,isTopLevel:!1,expandedNodes:c,onToggle:a,onSuccess:o},`${N.name}-${z}`))}),e[46]=c,e[47]=m,e[48]=g,e[49]=i,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-D91BmmQi.js";import{t as le}from"./react-Bj1aDYRI.js";import{_r as V}from"./cells-_QgKZKXb.js";import"./react-dom-CSu739Rf.js";import{t as ie}from"./compiler-runtime-B3qBwwSJ.js";import{r as ce}from"./ai-model-dropdown-Cq8Bx0V5.js";import{y as de}from"./utils-DIGrmLDO.js";import{S as me}from"./config-BwY7xK-l.js";import{t as K}from"./cn-DCUzRj2J.js";import{t as pe}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-BDxedMYP.js";import"./popover-UExmgBsf.js";import{t as J}from"./tooltip-Gcwqb_SK.js";import{r as xe}from"./button-D9nb17Rw.js";import"./dist-BrR4M-k3.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{r as W}from"./requests-DIwGYs0l.js";import{r as ue}from"./x-C-6liIBr.js";import{t as fe}from"./chevron-right-CG5QYXYk.js";import{u as ge}from"./toDate-B5A0DFEz.js";import{t as R}from"./spinner-jEqwgi_c.js";import{a as he}from"./input-gOeJx-hY.js";import"./dist-Bd6jkjtM.js";import"./dist-CZoX3_w7.js";import"./dist-D80LaxlS.js";import"./dist-B4jGC5bx.js";import"./dist-BNScjj64.js";import{t as ve}from"./use-toast-DZOInYtM.js";import"./session-DI1agD5_.js";import"./purify.es-Lm0LKKB_.js";import{n as je}from"./copy-MpDsCBB6.js";import{i as be,n as F,r as Q,s as X,t as ke}from"./useInstallPackage-DQBOxUeJ.js";import{n as Y}from"./error-banner-B6M4W7BS.js";import{n as ye}from"./useAsyncData-BRNkjHs1.js";import{a as Ne,i as q,n as we,o as Z,r as B,t as Se}from"./table-CZ3rujd6.js";import{t as ee}from"./empty-state-CPvr0RGL.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(pe(),1),te=t=>{let e=(0,G.c)(9),{onClick:s,loading:n,children:i,className:p}=t;if(n){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=(0,r.jsx)(R,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=l):l=e[0],l}let c;e[1]===p?c=e[2]:(c=K("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",p),e[1]=p,e[2]=c);let a;e[3]===s?a=e[4]:(a=xe.stopPropagation(s),e[3]=s,e[4]=a);let o;return e[5]!==i||e[6]!==c||e[7]!==a?(o=(0,r.jsx)("button",{type:"button",className:c,onClick:a,children:i}),e[5]=i,e[6]=c,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:i}=W(),[p,c]=I.useState(null),a;t[0]!==n||t[1]!==i?(a=async()=>{let[u,C]=await Promise.all([i(),n()]);return{list:u.packages,tree:C.tree}},t[0]=n,t[1]=i,t[2]=a):a=t[2];let o;t[3]===s?o=t[4]:(o=[s],t[3]=s,t[4]=o);let{data:l,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)(Y,{error:m}),t[6]=m,t[7]=u),u}let h=l.tree!=null,d;t[8]!==h||t[9]!==p?(d=De(p,h),t[8]=h,t[9]=p,t[10]=d):d=t[10];let f=d,x=(w=l.tree)==null?void 0:w.name,P=(S=l==null?void 0:l.tree)==null?void 0:S.version,y=x==="<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]!==x||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:()=>c("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:()=>c("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"}),x&&!y&&(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[x,P&&` v${P}`]})]})]}),t[14]=y,t[15]=h,t[16]=x,t[17]=P,t[18]=f,t[19]=b):b=t[19];let v;t[20]!==l.list||t[21]!==l.tree||t[22]!==m||t[23]!==j||t[24]!==f?(v=f==="list"?(0,r.jsx)(Ee,{packages:l.list,onSuccess:j}):(0,r.jsx)($e,{tree:l.tree,error:m,onSuccess:j}),t[20]=l.list,t[21]=l.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,[i,p]=I.useState(""),{handleClick:c}=ce(),a=oe(X),o=ae(X),l,m;e[0]!==a||e[1]!==o?(l=()=>{a&&(p(a),o(null))},m=[a,o],e[0]=a,e[1]=o,e[2]=l,e[3]=m):(l=e[2],m=e[3]),I.useEffect(l,m);let{loading:j,handleInstallPackages:g}=ke(),h;e[4]===s?h=e[5]:(h=()=>{s(),p("")},e[4]=s,e[5]=h);let d=h,f;e[6]!==g||e[7]!==i||e[8]!==d?(f=()=>{g([_e(i)],d)},e[6]=g,e[7]=i,e[8]=d,e[9]=f):f=e[9];let x=f,P=`Install packages with ${n}...`,y;e[10]!==j||e[11]!==c?(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:()=>c("packageManagementAndData"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=j,e[11]=c,e[12]=y):y=e[12];let k;e[13]===x?k=e[14]:(k=U=>{U.key==="Enter"&&(U.preventDefault(),x())},e[13]=x,e[14]=k);let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=U=>p(U.target.value),e[15]=b):b=e[15];let v;e[16]!==i||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:i,onKeyDown:k,onChange:b}),e[16]=i,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=i&&"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=!i,M;e[33]!==x||e[34]!==N||e[35]!==z?(M=(0,r.jsx)("button",{type:"button",className:N,onClick:x,disabled:z,children:"Add"}),e[33]=x,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 i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=(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]=i):i=e[1];let p;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),p=n.map(a),e[2]=s,e[3]=n,e[4]=p}else p=e[4];let c;return e[7]===p?c=e[8]:(c=(0,r.jsxs)(Se,{className:"overflow-auto flex-1",children:[i,(0,r.jsx)(we,{children:p})]}),e[7]=p,e[8]=c),c},re=({packageName:t,tags:e,onSuccess:s})=>{let[n,i]=I.useState(!1),{addPackage:p}=W();return me()?null:(0,r.jsx)(te,{onClick:async()=>{var c;try{i(!0);let a=(c=e==null?void 0:e.find(l=>l.kind==="group"))==null?void 0:c.value,o=await p({package:t,upgrade:!0,group:a});o.success?(s(),Q(t)):Q(t,o.error)}finally{i(!1)}},loading:n,children:"Upgrade"})},se=({packageName:t,tags:e,onSuccess:s})=>{let[n,i]=I.useState(!1),{removePackage:p}=W();return(0,r.jsx)(te,{onClick:async()=>{var c;try{i(!0);let a=(c=e==null?void 0:e.find(l=>l.kind==="group"))==null?void 0:c.value,o=await p({package:t,group:a});o.success?(s(),F(t)):F(t,o.error)}finally{i(!1)}},loading:n,children:"Remove"})},$e=t=>{let e=(0,G.c)(18),{tree:s,error:n,onSuccess:i}=t,p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=new Set,e[0]=p):p=e[0];let[c,a]=I.useState(p),o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a(new Set)},e[1]=o):o=e[1];let l;if(e[2]===s?l=e[3]:(l=[s],e[2]=s,e[3]=l),I.useEffect(o,l),n){let d;return e[4]===n?d=e[5]:(d=(0,r.jsx)(Y,{error:n}),e[4]=n,e[5]=d),d}if(!s){let d;return e[6]===Symbol.for("react.memo_cache_sentinel")?(d=(0,r.jsx)(R,{size:"medium",centered:!0}),e[6]=d):d=e[6],d}if(s.dependencies.length===0){let d;return e[7]===Symbol.for("react.memo_cache_sentinel")?(d=(0,r.jsx)(ee,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:(0,r.jsx)(V,{})}),e[7]=d):d=e[7],d}let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=d=>{a(f=>{let x=new Set(f);return x.has(d)?x.delete(d):x.add(d),x})},e[8]=m):m=e[8];let j=m,g;if(e[9]!==c||e[10]!==i||e[11]!==s.dependencies){let d;e[13]!==c||e[14]!==i?(d=(f,x)=>(0,r.jsx)("div",{className:"border-b",children:(0,r.jsx)(ne,{nodeId:`root-${x}`,node:f,level:0,isTopLevel:!0,expandedNodes:c,onToggle:j,onSuccess:i})},`${f.name}-${x}`),e[13]=c,e[14]=i,e[15]=d):d=e[15],g=s.dependencies.map(d),e[9]=c,e[10]=i,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:i,isTopLevel:p,expandedNodes:c,onToggle:a,onSuccess:o}=t,l=p===void 0?!1:p,m=n.dependencies.length>0,j;e[0]!==c||e[1]!==s?(j=c.has(s),e[0]=c,e[1]=s,e[2]=j):j=e[2];let g=j,h=l?0:16+i*16,d;e[3]!==m||e[4]!==s||e[5]!==a?(d=N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),m&&a(s))},e[3]=m,e[4]=s,e[5]=a,e[6]=d):d=e[6];let f=d,x;e[7]!==m||e[8]!==s||e[9]!==a?(x=N=>{N.stopPropagation(),m&&a(s)},e[7]=m,e[8]=s,e[9]=a,e[10]=x):x=e[10];let P=x,y=m&&"select-none",k=l?"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]!==l?(v=l?{}:{paddingLeft:`${h}px`},e[14]=h,e[15]=l,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]!==l||e[32]!==n.name||e[33]!==n.tags||e[34]!==o?(D=l&&(0,r.jsxs)("div",{className:"flex gap-1 invisible group-hover:visible",children:[(0,r.jsx)(re,{packageName:n.name,tags:n.tags,onSuccess:o}),(0,r.jsx)(se,{packageName:n.name,tags:n.tags,onSuccess:o})]}),e[31]=l,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]!==c||e[47]!==m||e[48]!==g||e[49]!==i||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:i+1,isTopLevel:!1,expandedNodes:c,onToggle:a,onSuccess:o},`${N.name}-${z}`))}),e[46]=c,e[47]=m,e[48]=g,e[49]=i,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 ae}from"./chunk-LvLJmgfZ.js";import{d as ye,l as be,n as V,p as oe,u as Ne}from"./useEvent-D91BmmQi.js";import{t as we}from"./react-Bj1aDYRI.js";import{Di as n,E as ke,Ei as ze,F as Ce,Nn as Se,vi as Oe,__tla as Ae}from"./cells-_QgKZKXb.js";import"./react-dom-CSu739Rf.js";import{t as se}from"./compiler-runtime-B3qBwwSJ.js";import{v as ie}from"./useEventListener-BR0C1MaI.js";import{y as Ee}from"./utils-DIGrmLDO.js";import{t as Ie}from"./constants-DMpttj8Q.js";import{t as le}from"./cn-DCUzRj2J.js";import{t as Le}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-BDxedMYP.js";import"./popover-UExmgBsf.js";import{n as Me,__tla as Pe}from"./JsonOutput-BLiYwyAC.js";import"./download-Bc8oaRxn.js";import{t as z}from"./tooltip-Gcwqb_SK.js";import{t as C}from"./button-D9nb17Rw.js";import"./dist-BrR4M-k3.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{r as De}from"./requests-DIwGYs0l.js";import{t as me}from"./createLucideIcon-D5guW7EU.js";import{d as Re,__tla as He}from"./layout-B31_eP6P.js";import{n as Ve,t as qe,__tla as Te}from"./LazyAnyLanguageCodeMirror-B4dqgtrW.js";import{__tla as Fe}from"./markdown-renderer-Cown6yO8.js";import{u as Ge}from"./toDate-B5A0DFEz.js";import{t as Ue,__tla as Be}from"./cell-editor-B1SaikL0.js";import{t as Je}from"./spinner-jEqwgi_c.js";import{t as Ke}from"./play-DSUm4sBu.js";import"./dist-Bd6jkjtM.js";import"./dist-CZoX3_w7.js";import"./dist-D80LaxlS.js";import"./dist-B4jGC5bx.js";import"./dist-BNScjj64.js";import"./session-DI1agD5_.js";import{r as Qe}from"./useTheme-DhrO1NvC.js";import"./purify.es-Lm0LKKB_.js";import"./dates-C-8zX5--.js";import"./utils-B_ZkX8f0.js";import"./vega-loader.browser-BlkwfOz9.js";import"./defaultLocale-CIhzTQNN.js";import"./defaultLocale-CUv_V9gw.js";import{__tla as We}from"./chunk-5FQGJX7Z-CQS0x34U.js";import"./html-to-image-s8Gi2a0d.js";import{o as Xe}from"./focus-Ci7q4lAK.js";import{n as Ye,r as Ze,t as ne}from"./react-resizable-panels.browser.esm-xQHRvEag.js";import{a as $e}from"./renderShortcut-B-72v1dC.js";import"./esm-B4U2RMiA.js";import"./name-cell-input-o3llo2cQ.js";import{n as et,r as tt}from"./panel-context-S-AFWBnz.js";import{__tla as rt}from"./loro_wasm_bg-BAHdi7Mz.js";import"./ws-Bim0WMvW.js";import"./Inputs-BJt-xWQ4.js";import"./dist-Cqk8HSav.js";import"./dist-fKKpzSr2.js";import"./dist-FpqIkji6.js";import"./dist-ByJngTCJ.js";import"./dist-BfwIwU8S.js";import"./dist-SITbEFUx.js";import"./dist-EeiXxq6X.js";import"./dist-R9N_YrBH.js";import"./dist-wsxxqJfJ.js";import"./esm-BGvvz4bU.js";import{t as at}from"./kiosk-mode-PchJOoW7.js";let ce,ot=Promise.all([(()=>{try{return Ae}catch{}})(),(()=>{try{return Pe}catch{}})(),(()=>{try{return He}catch{}})(),(()=>{try{return Te}catch{}})(),(()=>{try{return Fe}catch{}})(),(()=>{try{return Be}catch{}})(),(()=>{try{return We}catch{}})(),(()=>{try{return rt}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"}]]),he=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"}]]),pe=se(),q=ae(we(),1),ue=15;const T=Oe("marimo:scratchpadHistory:v1",[],Se),fe=oe(!1),xe=oe(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=ae(Le(),1),_e={hide_code:!1,disabled:!1};const ve=()=>{var re;let e=(0,pe.c)(60),s=Ce(),[i]=Ee(),{theme:m}=Qe(),c=(0,q.useRef)(null),F=Xe(),{createNewCell:G,updateCellCode:d}=ke(),{sendRunScratchpad:h}=De(),S=et(),U=tt(),l=s.cellRuntime[n],B=l==null?void 0:l.output,O=l==null?void 0:l.status,J=l==null?void 0:l.consoleOutputs,r=((re=s.cellData.__scratch__)==null?void 0:re.code)??"",K=ye(xe),[o,p]=be(fe),u=Ne(T),A;e[0]!==K||e[1]!==r||e[2]!==h?(A=()=>{h({code:r}),K(r)},e[0]=K,e[1]=r,e[2]=h,e[3]=A):A=e[3];let f=V(A),E;e[4]!==r||e[5]!==G||e[6]!==F?(E=()=>{r.trim()&&G({code:r,before:!1,cellId:F??"__end__"})},e[4]=r,e[5]=G,e[6]=F,e[7]=E):E=e[7];let Q=V(E),I;e[8]!==h||e[9]!==d?(I=()=>{d({cellId:n,code:"",formattingChange:!1}),h({code:""});let a=c.current;a&&a.dispatch({changes:{from:0,to:a.state.doc.length,insert:""}})},e[8]=h,e[9]=d,e[10]=I):I=e[10];let W=V(I),L;e[11]!==p||e[12]!==d?(L=a=>{p(!1),d({cellId:n,code:a,formattingChange:!1});let k=c.current;k&&k.dispatch({changes:{from:0,to:k.state.doc.length,insert:a}})},e[11]=p,e[12]=d,e[13]=L):L=e[13];let X=V(L),[Y,ge]=(0,q.useState)(),M;e[14]!==X||e[15]!==u||e[16]!==o||e[17]!==m?(M=()=>o?(0,t.jsx)("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:(0,t.jsx)("div",{className:"overflow-auto flex flex-col gap-3",children:u.map((a,k)=>(0,t.jsx)("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>X(a),children:(0,t.jsx)(q.Suspense,{children:(0,t.jsx)(qe,{language:"python",theme:m,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:a.trim(),editable:!1,readOnly:!0})})},k))})}):null,e[14]=X,e[15]=u,e[16]=o,e[17]=m,e[18]=M):M=e[18];let Z=M,P;e[19]!==W||e[20]!==Q||e[21]!==f||e[22]!==u.length||e[23]!==o||e[24]!==p||e[25]!==O?(P=()=>(0,t.jsxs)("div",{className:"flex items-center shrink-0 border-b",children:[(0,t.jsx)(z,{content:$e("cell.run"),children:(0,t.jsx)(C,{"data-testid":"scratchpad-run-button",onClick:f,disabled:o,variant:"text",size:"xs",children:(0,t.jsx)(Ke,{color:"var(--grass-11)",size:16})})}),(0,t.jsx)(z,{content:"Clear code and outputs",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:W,children:(0,t.jsx)(de,{size:16})})}),(0,t.jsx)(at,{children:(0,t.jsx)(z,{content:"Insert code",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:Q,children:(0,t.jsx)(Ve,{size:16})})})}),(O==="running"||O==="queued")&&(0,t.jsx)(Je,{className:"inline",size:"small"}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsx)(z,{content:"Toggle history",children:(0,t.jsx)(C,{size:"xs",variant:"text",className:le(o&&"bg-(--sky-3) rounded-none"),onClick:()=>p(!o),disabled:u.length===0,children:(0,t.jsx)(he,{size:16})})}),(0,t.jsx)(z,{content:(0,t.jsx)("span",{className:"block max-w-prose",children:"Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file."}),children:(0,t.jsx)(C,{size:"xs",variant:"text",children:(0,t.jsx)(Ge,{size:16})})})]}),e[19]=W,e[20]=Q,e[21]=f,e[22]=u.length,e[23]=o,e[24]=p,e[25]=O,e[26]=P):P=e[26];let $=P,je=S==="vertical",D;e[27]===Symbol.for("react.memo_cache_sentinel")?(D=ze.create(n),e[27]=D):D=e[27];let x;e[28]===$?x=e[29]:(x=$(),e[28]=$,e[29]=x);let R;e[30]===Symbol.for("react.memo_cache_sentinel")?(R=a=>{c.current=a},e[30]=R):R=e[30];let _;e[31]!==r||e[32]!==f||e[33]!==Y||e[34]!==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:R,hidden:!1,showHiddenCode:ie.NOOP,languageAdapter:Y,setLanguageAdapter:ge})}),e[31]=r,e[32]=f,e[33]=Y,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 y;e[45]===j?y=e[46]:(y=(0,t.jsx)(Ze,{className:j}),e[45]=j,e[46]=y);let b;e[47]===B?b=e[48]:(b=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Me,{allowExpand:!1,output:B,className:Ie.outputArea,cellId:n,stale:!1,loading:!1})}),e[47]=B,e[48]=b);let N;e[49]===J?N=e[50]:(N=(0,t.jsx)("div",{className:"overflow-auto shrink-0 max-h-[50%]",children:(0,t.jsx)(Re,{consoleOutputs:J,className:"overflow-auto",stale:!1,cellName:"_",onSubmitDebugger:ie.NOOP,cellId:n,debuggerActive:!1})}),e[49]=J,e[50]=N);let w;e[51]!==b||e[52]!==N?(w=(0,t.jsx)(ne,{defaultSize:60,minSize:20,children:(0,t.jsxs)("div",{className:"h-full flex flex-col divide-y overflow-hidden",children:[b,N]})}),e[51]=b,e[52]=N,e[53]=w):w=e[53];let H;return e[54]!==S||e[55]!==U||e[56]!==g||e[57]!==y||e[58]!==w?(H=(0,t.jsx)("div",{className:"flex flex-col h-full overflow-hidden",id:D,children:(0,t.jsxs)(Ye,{direction:S,className:"h-full",children:[g,y,w]},U)}),e[54]=S,e[55]=U,e[56]=g,e[57]=y,e[58]=w,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 ae}from"./chunk-LvLJmgfZ.js";import{d as ye,l as be,n as V,p as oe,u as Ne}from"./useEvent-D91BmmQi.js";import{t as we}from"./react-Bj1aDYRI.js";import{Di as n,E as ke,Ei as ze,F as Ce,Nn as Se,vi as Oe,__tla as Ae}from"./cells-_QgKZKXb.js";import"./react-dom-CSu739Rf.js";import{t as se}from"./compiler-runtime-B3qBwwSJ.js";import{v as ie}from"./useEventListener-BR0C1MaI.js";import{y as Ee}from"./utils-DIGrmLDO.js";import{t as Ie}from"./constants-DMpttj8Q.js";import{t as le}from"./cn-DCUzRj2J.js";import{t as Le}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-BDxedMYP.js";import"./popover-UExmgBsf.js";import{n as Me,__tla as Pe}from"./JsonOutput-BLiYwyAC.js";import"./download-Bc8oaRxn.js";import{t as z}from"./tooltip-Gcwqb_SK.js";import{t as C}from"./button-D9nb17Rw.js";import"./dist-BrR4M-k3.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{r as De}from"./requests-DIwGYs0l.js";import{t as me}from"./createLucideIcon-D5guW7EU.js";import{d as Re,__tla as He}from"./layout-B31_eP6P.js";import{n as Ve,t as qe,__tla as Te}from"./LazyAnyLanguageCodeMirror-B4dqgtrW.js";import{__tla as Fe}from"./markdown-renderer-Cown6yO8.js";import{u as Ge}from"./toDate-B5A0DFEz.js";import{t as Ue,__tla as Be}from"./cell-editor-DL4womh8.js";import{t as Je}from"./spinner-jEqwgi_c.js";import{t as Ke}from"./play-DSUm4sBu.js";import"./dist-Bd6jkjtM.js";import"./dist-CZoX3_w7.js";import"./dist-D80LaxlS.js";import"./dist-B4jGC5bx.js";import"./dist-BNScjj64.js";import"./session-DI1agD5_.js";import{r as Qe}from"./useTheme-DhrO1NvC.js";import"./purify.es-Lm0LKKB_.js";import"./dates-C-8zX5--.js";import"./utils-B_ZkX8f0.js";import"./vega-loader.browser-BlkwfOz9.js";import"./defaultLocale-CIhzTQNN.js";import"./defaultLocale-CUv_V9gw.js";import{__tla as We}from"./chunk-5FQGJX7Z-CQS0x34U.js";import"./html-to-image-s8Gi2a0d.js";import{o as Xe}from"./focus-Ci7q4lAK.js";import{n as Ye,r as Ze,t as ne}from"./react-resizable-panels.browser.esm-xQHRvEag.js";import{a as $e}from"./renderShortcut-B-72v1dC.js";import"./esm-B4U2RMiA.js";import"./name-cell-input-o3llo2cQ.js";import{n as et,r as tt}from"./panel-context-S-AFWBnz.js";import{__tla as rt}from"./loro_wasm_bg-BAHdi7Mz.js";import"./ws-Bim0WMvW.js";import"./Inputs-BJt-xWQ4.js";import"./dist-Cqk8HSav.js";import"./dist-fKKpzSr2.js";import"./dist-FpqIkji6.js";import"./dist-ByJngTCJ.js";import"./dist-BfwIwU8S.js";import"./dist-SITbEFUx.js";import"./dist-EeiXxq6X.js";import"./dist-R9N_YrBH.js";import"./dist-wsxxqJfJ.js";import"./esm-BGvvz4bU.js";import{t as at}from"./kiosk-mode-PchJOoW7.js";let ce,ot=Promise.all([(()=>{try{return Ae}catch{}})(),(()=>{try{return Pe}catch{}})(),(()=>{try{return He}catch{}})(),(()=>{try{return Te}catch{}})(),(()=>{try{return Fe}catch{}})(),(()=>{try{return Be}catch{}})(),(()=>{try{return We}catch{}})(),(()=>{try{return rt}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"}]]),he=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"}]]),pe=se(),q=ae(we(),1),ue=15;const T=Oe("marimo:scratchpadHistory:v1",[],Se),fe=oe(!1),xe=oe(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=ae(Le(),1),_e={hide_code:!1,disabled:!1};const ve=()=>{var re;let e=(0,pe.c)(60),s=Ce(),[i]=Ee(),{theme:m}=Qe(),c=(0,q.useRef)(null),F=Xe(),{createNewCell:G,updateCellCode:d}=ke(),{sendRunScratchpad:h}=De(),S=et(),U=tt(),l=s.cellRuntime[n],B=l==null?void 0:l.output,O=l==null?void 0:l.status,J=l==null?void 0:l.consoleOutputs,r=((re=s.cellData.__scratch__)==null?void 0:re.code)??"",K=ye(xe),[o,p]=be(fe),u=Ne(T),A;e[0]!==K||e[1]!==r||e[2]!==h?(A=()=>{h({code:r}),K(r)},e[0]=K,e[1]=r,e[2]=h,e[3]=A):A=e[3];let f=V(A),E;e[4]!==r||e[5]!==G||e[6]!==F?(E=()=>{r.trim()&&G({code:r,before:!1,cellId:F??"__end__"})},e[4]=r,e[5]=G,e[6]=F,e[7]=E):E=e[7];let Q=V(E),I;e[8]!==h||e[9]!==d?(I=()=>{d({cellId:n,code:"",formattingChange:!1}),h({code:""});let a=c.current;a&&a.dispatch({changes:{from:0,to:a.state.doc.length,insert:""}})},e[8]=h,e[9]=d,e[10]=I):I=e[10];let W=V(I),L;e[11]!==p||e[12]!==d?(L=a=>{p(!1),d({cellId:n,code:a,formattingChange:!1});let k=c.current;k&&k.dispatch({changes:{from:0,to:k.state.doc.length,insert:a}})},e[11]=p,e[12]=d,e[13]=L):L=e[13];let X=V(L),[Y,ge]=(0,q.useState)(),M;e[14]!==X||e[15]!==u||e[16]!==o||e[17]!==m?(M=()=>o?(0,t.jsx)("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:(0,t.jsx)("div",{className:"overflow-auto flex flex-col gap-3",children:u.map((a,k)=>(0,t.jsx)("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>X(a),children:(0,t.jsx)(q.Suspense,{children:(0,t.jsx)(qe,{language:"python",theme:m,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:a.trim(),editable:!1,readOnly:!0})})},k))})}):null,e[14]=X,e[15]=u,e[16]=o,e[17]=m,e[18]=M):M=e[18];let Z=M,P;e[19]!==W||e[20]!==Q||e[21]!==f||e[22]!==u.length||e[23]!==o||e[24]!==p||e[25]!==O?(P=()=>(0,t.jsxs)("div",{className:"flex items-center shrink-0 border-b",children:[(0,t.jsx)(z,{content:$e("cell.run"),children:(0,t.jsx)(C,{"data-testid":"scratchpad-run-button",onClick:f,disabled:o,variant:"text",size:"xs",children:(0,t.jsx)(Ke,{color:"var(--grass-11)",size:16})})}),(0,t.jsx)(z,{content:"Clear code and outputs",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:W,children:(0,t.jsx)(de,{size:16})})}),(0,t.jsx)(at,{children:(0,t.jsx)(z,{content:"Insert code",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:Q,children:(0,t.jsx)(Ve,{size:16})})})}),(O==="running"||O==="queued")&&(0,t.jsx)(Je,{className:"inline",size:"small"}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsx)(z,{content:"Toggle history",children:(0,t.jsx)(C,{size:"xs",variant:"text",className:le(o&&"bg-(--sky-3) rounded-none"),onClick:()=>p(!o),disabled:u.length===0,children:(0,t.jsx)(he,{size:16})})}),(0,t.jsx)(z,{content:(0,t.jsx)("span",{className:"block max-w-prose",children:"Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file."}),children:(0,t.jsx)(C,{size:"xs",variant:"text",children:(0,t.jsx)(Ge,{size:16})})})]}),e[19]=W,e[20]=Q,e[21]=f,e[22]=u.length,e[23]=o,e[24]=p,e[25]=O,e[26]=P):P=e[26];let $=P,je=S==="vertical",D;e[27]===Symbol.for("react.memo_cache_sentinel")?(D=ze.create(n),e[27]=D):D=e[27];let x;e[28]===$?x=e[29]:(x=$(),e[28]=$,e[29]=x);let R;e[30]===Symbol.for("react.memo_cache_sentinel")?(R=a=>{c.current=a},e[30]=R):R=e[30];let _;e[31]!==r||e[32]!==f||e[33]!==Y||e[34]!==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:R,hidden:!1,showHiddenCode:ie.NOOP,languageAdapter:Y,setLanguageAdapter:ge})}),e[31]=r,e[32]=f,e[33]=Y,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 y;e[45]===j?y=e[46]:(y=(0,t.jsx)(Ze,{className:j}),e[45]=j,e[46]=y);let b;e[47]===B?b=e[48]:(b=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Me,{allowExpand:!1,output:B,className:Ie.outputArea,cellId:n,stale:!1,loading:!1})}),e[47]=B,e[48]=b);let N;e[49]===J?N=e[50]:(N=(0,t.jsx)("div",{className:"overflow-auto shrink-0 max-h-[50%]",children:(0,t.jsx)(Re,{consoleOutputs:J,className:"overflow-auto",stale:!1,cellName:"_",onSubmitDebugger:ie.NOOP,cellId:n,debuggerActive:!1})}),e[49]=J,e[50]=N);let w;e[51]!==b||e[52]!==N?(w=(0,t.jsx)(ne,{defaultSize:60,minSize:20,children:(0,t.jsxs)("div",{className:"h-full flex flex-col divide-y overflow-hidden",children:[b,N]})}),e[51]=b,e[52]=N,e[53]=w):w=e[53];let H;return e[54]!==S||e[55]!==U||e[56]!==g||e[57]!==y||e[58]!==w?(H=(0,t.jsx)("div",{className:"flex flex-col h-full overflow-hidden",id:D,children:(0,t.jsxs)(Ye,{direction:S,className:"h-full",children:[g,y,w]},U)}),e[54]=S,e[55]=U,e[56]=g,e[57]=y,e[58]=w,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 ze}from"./chunk-LvLJmgfZ.js";import{d as $,l as mt,p as pt,u as me}from"./useEvent-D91BmmQi.js";import{t as ut}from"./react-Bj1aDYRI.js";import{An as ft,Dn as xt,E as Me,Ei as pe,En as yt,Tn as kt,Yt as bt,_ as wt,dr as jt,h as We,lr as gt,lt as _e,mr as vt,ot as Ct,st as zt,t as Mt,yr as Wt,zr as _t}from"./cells-_QgKZKXb.js";import{t as N}from"./compiler-runtime-B3qBwwSJ.js";import{n as Nt,x as St}from"./ai-model-dropdown-BizqKH6Q.js";import{_ as H,d as Ne}from"./useEventListener-BR0C1MaI.js";import{y as Dt}from"./utils-DIGrmLDO.js";import{n as S,t as Se}from"./constants-DMpttj8Q.js";import{S as ue,h as At,n as Pt,o as Et,x as It}from"./config-BwY7xK-l.js";import{n as Lt}from"./switch-QpkpQKr6.js";import{t as Tt}from"./jsx-runtime-BqBOg78p.js";import{o as Rt}from"./alert-dialog-BGBdrcqJ.js";import{a as $t,c as fe,o as xe,s as Ht}from"./popover-UExmgBsf.js";import{a as qt,c as Ut,i as Ot,n as Vt,r as Yt,s as Bt,t as Ft}from"./select-5i7URBEn.js";import{vt as Kt}from"./JsonOutput-BLiYwyAC.js";import{c as De,d as ye,n as Gt,o as Jt,r as ke,t as Qt}from"./download-Bc8oaRxn.js";import{m as Xt}from"./form-BON4sAdY.js";import{t as Ae}from"./tooltip-Gcwqb_SK.js";import{r as Pe,t as q}from"./button-D9nb17Rw.js";import{i as Zt,r as ea,t as Ee}from"./strings-md4mFbOQ.js";import{r as U}from"./requests-DIwGYs0l.js";import{t as b}from"./createLucideIcon-D5guW7EU.js";import{A as Ie,a as Le,i as Te,j as ta,k as aa,u as Re}from"./layout-B31_eP6P.js";import{t as be}from"./check-BH35Ndha.js";import{n as oa}from"./maps-C48Oksn0.js";import{r as na}from"./useCellActionButton-DLUN-oPD.js";import{t as $e}from"./copy-BwrPA9zQ.js";import{t as sa}from"./eye-off-n1Li95bE.js";import{t as ae}from"./file-BrdxGLRX.js";import{t as la}from"./github-BKS_2Qwn.js";import{n as ia,r as ra,t as da}from"./youtube-CXGBiuia.js";import{i as ca,n as He}from"./add-connection-dialog-C1aIq9FP.js";import{n as ha,t as ma}from"./square-k2WwJdZy.js";import{t as pa}from"./image-HpSc22eh.js";import{t as ua}from"./link-DlqtQzll.js";import{r as fa}from"./input-gOeJx-hY.js";import{t as xa}from"./settings-DDffqDzb.js";import{t as ya}from"./sparkles-C9V_hOqY.js";import{y as ka}from"./textarea-DLywVJ2b.js";import{t as D}from"./use-toast-DZOInYtM.js";import{n as qe,t as ba}from"./paths-2eb7kMpE.js";import{o as wa}from"./session-DI1agD5_.js";import{n as O}from"./copy-MpDsCBB6.js";import{r as ja}from"./useRunCells-Ce0N_5Wc.js";import{a as Ue,c as Oe,i as Ve,n as Ye,r as Be}from"./dialog-BEgS5oXa.js";import{n as we}from"./ImperativeModal-QWJWbLVR.js";import{r as ga,t as Fe}from"./share-C7-yIyYZ.js";import{a as va}from"./cell-link-DiZacqDz.js";import{a as Ca}from"./renderShortcut-B-72v1dC.js";import{t as za}from"./icons-C66kZH_4.js";import{n as Ke}from"./marimo-icons-ifBE8yqY.js";import{t as Ma}from"./links-DJCEkOLM.js";import{r as Wa,t as Ge}from"./hooks-CLXoEljg.js";import{t as Je}from"./types-DOdUT9LT.js";var _a=b("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Na=b("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Qe=b("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"}]]),Xe=b("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"}]]),Ze=b("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"}]]),Sa=b("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"}]]),Da=b("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"}]]),Aa=b("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"}]]),et=b("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"}]]),Pa=b("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"}]]),Ea=b("notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]),Ia=b("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),tt=b("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"}]]),La=b("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"}]]),Ta=b("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"}]]),at=b("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"}]]),je=N(),A=ze(ut(),1),a=ze(Tt(),1);function Ra(){return"uvx marimo@latest"}function $a(t,e,n){let o=n?" --with-token":"",s=`${Ra()} pair prompt --url '${e}'${o}`;switch(t){case"claude":return`claude "$(${s} --claude)"`;case"codex":return`codex "$(${s} --codex)"`;case"opencode":return`opencode "$(${s} --opencode)"`;default:ea(t)}}function Ha(t){return t.length<=4?"****":`${"*".repeat(Math.min(t.length-4,8))}${t.slice(-4)}`}var qa="npx skills add marimo-team/marimo-pair";function Ua(){let t=(0,je.c)(2),[e,n]=(0,A.useState)(null),o,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{fetch(Pt("/auth/token").href,{headers:Lt.headers()}).then(Oa).then(r=>n((r==null?void 0:r.token)??null)).catch(()=>n(null))},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,A.useEffect)(o,s),e}function Oa(t){return t.ok?t.json():null}const Va=t=>{let e=(0,je.c)(32),{onClose:n}=t,[o,s]=(0,A.useState)("claude"),r=Et(),i=Ua(),l=!!i,d;e[0]!==o||e[1]!==l||e[2]!==r.httpURL?(d=$a(o,r.httpURL.toString(),l),e[0]=o,e[1]=l,e[2]=r.httpURL,e[3]=d):d=e[3];let c=d,p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(Oe,{children:"Pair with an agent"}),e[4]=p):p=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsxs)(Ue,{children:[p,(0,a.jsxs)(Be,{children:["Use an AI coding agent to pair-program on this notebook."," ",(0,a.jsx)("a",{href:"https://links.marimo.app/marimo-pair",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Learn more"}),"."]})]}),e[5]=u):u=e[5];let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"1. Install the skill"}),(0,a.jsx)(V,{command:qa})]}),e[6]=h):h=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=(0,a.jsx)("span",{className:"text-sm font-medium",children:"2. Run in your terminal"}),e[7]=f):f=e[7];let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=_=>s(_),e[8]=x):x=e[8];let w;e[9]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(Ht,{className:"w-full",children:[(0,a.jsx)(fe,{value:"claude",className:"flex-1",children:"Claude"}),(0,a.jsx)(fe,{value:"codex",className:"flex-1",children:"Codex"}),(0,a.jsx)(fe,{value:"opencode",className:"flex-1",children:"OpenCode"})]}),e[9]=w):w=e[9];let y;e[10]===c?y=e[11]:(y=(0,a.jsx)(xe,{value:"claude",className:"mt-3",children:(0,a.jsx)(V,{command:c})}),e[10]=c,e[11]=y);let k;e[12]===c?k=e[13]:(k=(0,a.jsx)(xe,{value:"codex",className:"mt-3",children:(0,a.jsx)(V,{command:c})}),e[12]=c,e[13]=k);let j;e[14]===c?j=e[15]:(j=(0,a.jsx)(xe,{value:"opencode",className:"mt-3",children:(0,a.jsx)(V,{command:c})}),e[14]=c,e[15]=j);let g;e[16]!==o||e[17]!==j||e[18]!==y||e[19]!==k?(g=(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[f,(0,a.jsxs)($t,{value:o,onValueChange:x,children:[w,y,k,j]})]}),e[16]=o,e[17]=j,e[18]=y,e[19]=k,e[20]=g):g=e[20];let z;e[21]!==i||e[22]!==l?(z=l&&i&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"3. Paste when prompted for token"}),(0,a.jsx)(V,{command:i,display:Ha(i)})]}),e[21]=i,e[22]=l,e[23]=z):z=e[23];let v;e[24]!==g||e[25]!==z?(v=(0,a.jsxs)("div",{className:"flex flex-col gap-4 py-2",children:[h,g,z]}),e[24]=g,e[25]=z,e[26]=v):v=e[26];let M;e[27]===n?M=e[28]:(M=(0,a.jsx)(Ve,{children:(0,a.jsx)(q,{variant:"secondary",onClick:n,children:"Close"})}),e[27]=n,e[28]=M);let W;return e[29]!==v||e[30]!==M?(W=(0,a.jsxs)(Ye,{className:"sm:max-w-lg",children:[u,v,M]}),e[29]=v,e[30]=M,e[31]=W):W=e[31],W};var V=t=>{let e=(0,je.c)(15),{command:n,display:o}=t,[s,r]=(0,A.useState)(!1),i;e[0]===n?i=e[1]:(i=Pe.stopPropagation(async x=>{x.preventDefault(),await O(n),r(!0),setTimeout(()=>r(!1),2e3)}),e[0]=n,e[1]=i);let l=i,d=o??n,c;e[2]===d?c=e[3]:(c=(0,a.jsx)("code",{className:"flex-1 select-all break-words",children:d}),e[2]=d,e[3]=c);let p;e[4]===s?p=e[5]:(p=s?(0,a.jsx)(be,{size:14,strokeWidth:1.5}):(0,a.jsx)($e,{size:14,strokeWidth:1.5}),e[4]=s,e[5]=p);let u;e[6]!==l||e[7]!==p?(u=(0,a.jsx)(q,{onClick:l,size:"xs",variant:"ghost",children:p}),e[6]=l,e[7]=p,e[8]=u):u=e[8];let h;e[9]!==s||e[10]!==u?(h=(0,a.jsx)(Ae,{content:"Copied!",open:s,children:u}),e[9]=s,e[10]=u,e[11]=h):h=e[11];let f;return e[12]!==c||e[13]!==h?(f=(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-xs",children:[c,h]}),e[12]=c,e[13]=h,e[14]=f):f=e[14],f},ot=N(),oe="https://static.marimo.app";const Ya=t=>{let e=(0,ot.c)(25),{onClose:n}=t,[o,s]=(0,A.useState)(""),{exportAsHTML:r}=U(),i=`${o}-${Math.random().toString(36).slice(2,6)}`,l=`${oe}/static/${i}`,d;e[0]!==r||e[1]!==n||e[2]!==i?(d=async g=>{g.preventDefault(),n();let z=await r({download:!1,includeCode:!0,files:aa.INSTANCE.filenames()}),v=D({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${oe}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:z,path:i})}).catch(()=>{v.dismiss(),D({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:S.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),v.dismiss(),D({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."]})})},e[0]=r,e[1]=n,e[2]=i,e[3]=d):d=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.jsx)(Oe,{children:"Share static notebook"}),e[4]=c):c=e[4];let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsxs)(Ue,{children:[c,(0,a.jsxs)(Be,{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:oe,target:"_blank",children:oe}),"."]})]}),e[5]=p):p=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=g=>{s(g.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},e[6]=u):u=e[6];let h;e[7]===o?h=e[8]:(h=(0,a.jsx)(fa,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:u,required:!0,autoComplete:"off"}),e[7]=o,e[8]=h);let f;e[9]===l?f=e[10]:(f=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(Ba,{text:l}),(0,a.jsx)("span",{className:"text-primary",children:l})]})]}),e[9]=l,e[10]=f);let x;e[11]!==h||e[12]!==f?(x=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[h,f]}),e[11]=h,e[12]=f,e[13]=x):x=e[13];let w;e[14]===n?w=e[15]:(w=(0,a.jsx)(q,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=w);let y;e[16]===l?y=e[17]:(y=(0,a.jsx)(q,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await O(l)},children:"Create"}),e[16]=l,e[17]=y);let k;e[18]!==w||e[19]!==y?(k=(0,a.jsxs)(Ve,{children:[w,y]}),e[18]=w,e[19]=y,e[20]=k):k=e[20];let j;return e[21]!==d||e[22]!==k||e[23]!==x?(j=(0,a.jsx)(Ye,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[p,x,k]})}),e[21]=d,e[22]=k,e[23]=x,e[24]=j):j=e[24],j};var Ba=t=>{let e=(0,ot.c)(8),[n,o]=A.useState(!1),s;e[0]===t.text?s=e[1]:(s=Pe.stopPropagation(async c=>{c.preventDefault(),await O(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=s);let r=s,i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)($e,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2];let l;e[3]===r?l=e[4]:(l=(0,a.jsx)(q,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:i}),e[3]=r,e[4]=l);let d;return e[5]!==n||e[6]!==l?(d=(0,a.jsx)(Ae,{content:"Copied!",open:n,children:l}),e[5]=n,e[6]=l,e[7]=d):d=e[7],d},Fa=N();function Ka(){let t=document.getElementsByClassName(Se.outputArea);for(let e of t){let n=e.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=pe.findElement(e);if(!o){H.warn("Could not find HTMLCellId for visible output area",e);continue}return{cellId:pe.parse(o.id)}}}return H.warn("No visible output area found for scroll anchor"),null}function Ga(t){if(!t){H.warn("No scroll anchor provided to restore scroll position");return}let e=document.getElementById(pe.create(t.cellId));if(!e){H.warn("Could not find cell element to restore scroll position",t.cellId);return}if(!e.querySelector(`.${Se.outputArea}`)){H.warn("Could not find output area to restore scroll position",t.cellId);return}e.scrollIntoView({block:"start",behavior:"auto"})}function nt(){let t=(0,Fa.c)(2),e=$(_e),n;return t[0]===e?n=t[1]:(n=()=>{let o=Ka();e(s=>({mode:zt(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Ga(o)})})},t[0]=e,t[1]=n),n}const st=pt(!1);var Ja=N();const Qa=()=>{let t=(0,Ja.c)(7),{selectedLayout:e}=Le(),{setLayoutView:n}=Te();if(ue()&&!ft("wasm_layouts"))return null;let o;t[0]===n?o=t[1]:(o=l=>n(l),t[0]=n,t[1]=o);let s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Bt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Ut,{placeholder:"Select a view"})}),t[2]=s):s=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Vt,{children:(0,a.jsxs)(Yt,{children:[(0,a.jsx)(qt,{children:"View as"}),Je.map(Za)]})}),t[3]=r):r=t[3];let i;return t[4]!==e||t[5]!==o?(i=(0,a.jsxs)(Ft,{"data-testid":"layout-select",value:e,onValueChange:o,children:[s,r]}),t[4]=e,t[5]=o,t[6]=i):i=t[6],i};function Xa(t){return(0,a.jsx)(lt(t),{className:"h-4 w-4"})}function lt(t){switch(t){case"vertical":return Pa;case"grid":return ra;case"slides":return tt;default:return Zt(t),ma}}function it(t){return Ee.startCase(t)}function Za(t){return(0,a.jsx)(Ot,{value:t,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Xa(t),(0,a.jsx)("span",{children:it(t)})]})},t)}async function eo(t){let{filename:e,preset:n,downloadPDF:o}=t;await o({filename:e,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var to=N();function ao(t){let e=(0,to.c)(5),{openPrompt:n,closeModal:o}=we(),{sendCopy:s}=U(),r;return e[0]!==o||e[1]!==n||e[2]!==s||e[3]!==t?(r=()=>{if(!t)return null;let i=ba.guessDeliminator(t);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${qe.basename(t)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:l=>{let d=i.join(qe.dirname(t),l);s({source:t,destination:d}).then(()=>{o(),D({title:"Notebook copied",description:"A copy of the notebook has been created."}),Ma(d)})}})},e[0]=o,e[1]=n,e[2]=s,e[3]=t,e[4]=r):r=e[4],r}const oo=()=>{let{updateCellConfig:t}=Me(),{saveCellConfig:e}=U();return(0,A.useCallback)(async()=>{let n=new bt,o=We(),s=o.cellIds.inOrderIds,r={};for(let l of s){if(o.cellData[l]===void 0)continue;let{code:d,config:c}=o.cellData[l];c.hide_code||n.isSupported(d)&&(r[l]={hide_code:!0})}let i=Ne.entries(r);if(i.length!==0){await e({configs:r});for(let[l,d]of i)t({cellId:l,config:d})}},[t])};var no=N();function rt(){let t=(0,no.c)(4),{openConfirm:e}=we(),n=$(At),{sendRestart:o}=U(),s;return t[0]!==e||t[1]!==o||t[2]!==n?(s=()=>{e({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)(Rt,{onClick:async()=>{n({state:It.CLOSING}),await o(),ga()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=o,t[2]=n,t[3]=s):s=t[3],s}var so=N(),T=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function lo(){var ve,Ce;let t=(0,so.c)(51),e=va(),{openModal:n,closeModal:o}=we(),{toggleApplication:s}=kt(),{selectedPanel:r}=yt(),[i]=mt(_e),l=me(Ct),d=oo(),[c]=Dt(),{updateCellConfig:p,undoDeleteCell:u,clearAllCellOutputs:h,addSetupCellIfDoesntExist:f,collapseAllCells:x,expandAllCells:w}=Me(),y=rt(),k=ja(),j=ao(e),g=$(st),z=$(Nt),v=$(St),{exportAsIPYNB:M,exportAsMarkdown:W,readCode:_,saveCellConfig:se,updateCellOutputs:P}=U(),E=Wa(),le=me(wt),ie=me(Mt),{selectedLayout:Y}=Le(),{setLayoutView:re}=Te(),B=nt(),F=((ve=c.sharing)==null?void 0:ve.html)??!0,K=((Ce=c.sharing)==null?void 0:Ce.wasm)??!0,ge=!ue(),de=Y==="slides",dt=zo,ct=Co,G;t[0]!==e||t[1]!==E||t[2]!==P?(G=async m=>{let{preset:C,title:R}=m;if(!e){ne();return}await De(R,async he=>{await Ge({takeScreenshots:()=>E({progress:he}),updateCellOutputs:P}),await eo({filename:e,preset:C,downloadPDF:Gt})})},t[0]=e,t[1]=E,t[2]=P,t[3]=G):G=t[3];let I=G,J;t[4]===I?J=t[5]:(J=async()=>{if(ge){await I({preset:"document",title:"Downloading Document PDF..."});return}let m=new Event("export-beforeprint"),C=new Event("export-afterprint");window.dispatchEvent(m),setTimeout(vo,0),setTimeout(()=>window.dispatchEvent(C),0)},t[4]=I,t[5]=J);let Q=J,X;t[6]!==M||t[7]!==e||t[8]!==E||t[9]!==P?(X=async()=>{if(!e){ne();return}await De("Downloading IPYNB...",async m=>{await Ge({takeScreenshots:()=>E({progress:m}),updateCellOutputs:P});let C=await M({download:!1});ke(new Blob([C],{type:"application/x-ipynb+json"}),ye.toIPYNB(document.title))})},t[6]=M,t[7]=e,t[8]=E,t[9]=P,t[10]=X):X=t[10];let ce=X,Z;t[11]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,a.jsx)(Kt,{size:14,strokeWidth:1.5}),t[11]=Z):Z=t[11];let ee;t[12]===Symbol.for("react.memo_cache_sentinel")?(ee=(0,a.jsx)(Ie,{size:14,strokeWidth:1.5}),t[12]=ee):ee=t[12];let L;t[13]===e?L=t[14]:(L=async()=>{if(!e){ne();return}await Re({filename:e,includeCode:!0})},t[13]=e,t[14]=L);let te;return t[15]!==f||t[16]!==ie||t[17]!==h||t[18]!==o||t[19]!==x||t[20]!==j||t[21]!==I||t[22]!==w||t[23]!==W||t[24]!==e||t[25]!==Q||t[26]!==ce||t[27]!==le||t[28]!==d||t[29]!==de||t[30]!==l||t[31]!==n||t[32]!==_||t[33]!==y||t[34]!==k||t[35]!==se||t[36]!==Y||t[37]!==r||t[38]!==g||t[39]!==v||t[40]!==re||t[41]!==z||t[42]!==F||t[43]!==K||t[44]!==L||t[45]!==s||t[46]!==B||t[47]!==u||t[48]!==p||t[49]!==i.mode?(te=[{icon:Z,label:"Download",handle:T,dropdown:[{icon:ee,label:"Download as HTML",handle:L},{icon:(0,a.jsx)(Ie,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!e){ne();return}await Re({filename:e,includeCode:!1})}},{icon:(0,a.jsx)(za,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let m=await W({download:!1});ke(new Blob([m],{type:"text/plain"}),ye.toMarkdown(document.title))}},{icon:(0,a.jsx)(Ea,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:ce},{icon:(0,a.jsx)(ta,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let m=await _();ke(new Blob([m.contents],{type:"text/plain"}),ye.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(pa,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:i.mode!=="present",tooltip:i.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Ca("global.hideCode",!1)]}),handle:go},de?{divider:!0,icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:T,dropdown:[{icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:Q},{icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:ct(!0),hidden:!ge,handle:async()=>{await I({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:Q}]},{icon:(0,a.jsx)(ya,{size:14,strokeWidth:1.5}),label:"Pair with an agent",handle:async()=>{n((0,a.jsx)(Va,{onClose:o}))}},{icon:(0,a.jsx)(La,{size:14,strokeWidth:1.5}),label:"Share",handle:T,hidden:!F&&!K,dropdown:[{icon:(0,a.jsx)(Xt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!F,handle:async()=>{n((0,a.jsx)(Ya,{onClose:o}))}},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!K,handle:async()=>{await O(Fe({code:(await _()).contents})),D({title:"Copied",description:"Link copied to clipboard."})}},{icon:(0,a.jsx)(Ke,{size:14,strokeWidth:1.5}),label:"Create molab notebook",handle:async()=>{let m=Fe({code:(await _()).contents,baseUrl:`${S.molab}/new`});window.open(m,"_blank")}}]},{icon:(0,a.jsx)(Ia,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:T,dropdown:xt.flatMap(m=>{let{type:C,Icon:R,hidden:he,additionalKeywords:ht}=m;return he?[]:{label:Ee.startCase(C),rightElement:dt(r===C),icon:(0,a.jsx)(R,{size:14,strokeWidth:1.5}),handle:()=>s(C),additionalKeywords:ht}})},{icon:(0,a.jsx)(tt,{size:14,strokeWidth:1.5}),label:"Present as",handle:T,dropdown:[{icon:i.mode==="present"?(0,a.jsx)(ka,{size:14,strokeWidth:1.5}):(0,a.jsx)(et,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{B()}},...Je.map((m,C)=>{let R=lt(m);return{divider:C===0,label:it(m),icon:(0,a.jsx)(R,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:Y===m&&(0,a.jsx)(be,{size:14})}),handle:()=>{re(m),i.mode==="edit"&&B()}}})]},{icon:(0,a.jsx)(Da,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!e||ue(),handle:j},{icon:(0,a.jsx)(Qe,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:async()=>{await O((await _()).contents),D({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(na,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!le||l,handle:async()=>{let m=_t(We());await se({configs:Ne.fromEntries(m.map(jo))});for(let C of m)p({cellId:C,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Ze,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{f({})}},{icon:(0,a.jsx)(jt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(He,{onClose:o}))}},{icon:(0,a.jsx)(ca,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(He,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(at,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!ie||l,handle:()=>{u()}},{icon:(0,a.jsx)(Ta,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:y,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Sa,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{k()}},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{h()}},{icon:(0,a.jsx)(sa,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(Na,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:x,redundant:!0},{icon:(0,a.jsx)(_a,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:w,redundant:!0},{divider:!0,icon:(0,a.jsx)(Xe,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>g(wo)},{icon:(0,a.jsx)(Aa,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>v(bo)},{icon:(0,a.jsx)(xa,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>z(ko),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(oa,{size:14,strokeWidth:1.5}),label:"Resources",handle:T,dropdown:[{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"Documentation",handle:yo},{icon:(0,a.jsx)(la,{size:14,strokeWidth:1.5}),label:"GitHub",handle:xo},{icon:(0,a.jsx)(ia,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:fo},{icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"YouTube",handle:uo},{icon:(0,a.jsx)(gt,{size:14,strokeWidth:1.5}),label:"Changelog",handle:po}]},{divider:!0,icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:mo},{icon:(0,a.jsx)(Ke,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:ho}].filter(co).map(io),t[15]=f,t[16]=ie,t[17]=h,t[18]=o,t[19]=x,t[20]=j,t[21]=I,t[22]=w,t[23]=W,t[24]=e,t[25]=Q,t[26]=ce,t[27]=le,t[28]=d,t[29]=de,t[30]=l,t[31]=n,t[32]=_,t[33]=y,t[34]=k,t[35]=se,t[36]=Y,t[37]=r,t[38]=g,t[39]=v,t[40]=re,t[41]=z,t[42]=F,t[43]=K,t[44]=L,t[45]=s,t[46]=B,t[47]=u,t[48]=p,t[49]=i.mode,t[50]=te):te=t[50],te}function io(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(ro)}:t}function ro(t){return!t.hidden}function co(t){return!t.hidden}function ho(){let t=wa();window.open(t,"_blank")}function mo(){let t=document.baseURI.split("?")[0];window.open(t,"_self")}function po(){window.open(S.releasesPage,"_blank")}function uo(){window.open(S.youtube,"_blank")}function fo(){window.open(S.discordLink,"_blank")}function xo(){window.open(S.githubPage,"_blank")}function yo(){window.open(S.docsPage,"_blank")}function ko(t){return!t}function bo(t){return!t}function wo(t){return!t}function jo(t){return[t,{disabled:!1}]}async function go(){let t=document.getElementById("App");t&&await Jt({element:t,filename:document.title,prepare:Qt})}function vo(){return window.print()}function Co(t){return t?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function zo(t){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:t&&(0,a.jsx)(be,{size:14})})}function ne(){D({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{nt as a,Ze as c,st as i,Xe as l,rt as n,at as o,Qa as r,et as s,lo as t,Qe as u};
1
+ import{s as ze}from"./chunk-LvLJmgfZ.js";import{d as $,l as mt,p as pt,u as me}from"./useEvent-D91BmmQi.js";import{t as ut}from"./react-Bj1aDYRI.js";import{An as ft,Dn as xt,E as Me,Ei as pe,En as yt,Tn as kt,Yt as bt,_ as wt,dr as jt,h as We,lr as gt,lt as _e,mr as vt,ot as Ct,st as zt,t as Mt,yr as Wt,zr as _t}from"./cells-_QgKZKXb.js";import{t as N}from"./compiler-runtime-B3qBwwSJ.js";import{n as Nt,x as St}from"./ai-model-dropdown-Cq8Bx0V5.js";import{_ as H,d as Ne}from"./useEventListener-BR0C1MaI.js";import{y as Dt}from"./utils-DIGrmLDO.js";import{n as S,t as Se}from"./constants-DMpttj8Q.js";import{S as ue,h as At,n as Pt,o as Et,x as It}from"./config-BwY7xK-l.js";import{n as Lt}from"./switch-QpkpQKr6.js";import{t as Tt}from"./jsx-runtime-BqBOg78p.js";import{o as Rt}from"./alert-dialog-BGBdrcqJ.js";import{a as $t,c as fe,o as xe,s as Ht}from"./popover-UExmgBsf.js";import{a as qt,c as Ut,i as Ot,n as Vt,r as Yt,s as Bt,t as Ft}from"./select-5i7URBEn.js";import{vt as Kt}from"./JsonOutput-BLiYwyAC.js";import{c as De,d as ye,n as Gt,o as Jt,r as ke,t as Qt}from"./download-Bc8oaRxn.js";import{m as Xt}from"./form-BON4sAdY.js";import{t as Ae}from"./tooltip-Gcwqb_SK.js";import{r as Pe,t as q}from"./button-D9nb17Rw.js";import{i as Zt,r as ea,t as Ee}from"./strings-md4mFbOQ.js";import{r as U}from"./requests-DIwGYs0l.js";import{t as b}from"./createLucideIcon-D5guW7EU.js";import{A as Ie,a as Le,i as Te,j as ta,k as aa,u as Re}from"./layout-B31_eP6P.js";import{t as be}from"./check-BH35Ndha.js";import{n as oa}from"./maps-C48Oksn0.js";import{r as na}from"./useCellActionButton-DLUN-oPD.js";import{t as $e}from"./copy-BwrPA9zQ.js";import{t as sa}from"./eye-off-n1Li95bE.js";import{t as ae}from"./file-BrdxGLRX.js";import{t as la}from"./github-BKS_2Qwn.js";import{n as ia,r as ra,t as da}from"./youtube-CXGBiuia.js";import{i as ca,n as He}from"./add-connection-dialog-C1aIq9FP.js";import{n as ha,t as ma}from"./square-k2WwJdZy.js";import{t as pa}from"./image-HpSc22eh.js";import{t as ua}from"./link-DlqtQzll.js";import{r as fa}from"./input-gOeJx-hY.js";import{t as xa}from"./settings-DDffqDzb.js";import{t as ya}from"./sparkles-C9V_hOqY.js";import{y as ka}from"./textarea-DLywVJ2b.js";import{t as D}from"./use-toast-DZOInYtM.js";import{n as qe,t as ba}from"./paths-2eb7kMpE.js";import{o as wa}from"./session-DI1agD5_.js";import{n as O}from"./copy-MpDsCBB6.js";import{r as ja}from"./useRunCells-Ce0N_5Wc.js";import{a as Ue,c as Oe,i as Ve,n as Ye,r as Be}from"./dialog-BEgS5oXa.js";import{n as we}from"./ImperativeModal-QWJWbLVR.js";import{r as ga,t as Fe}from"./share-C7-yIyYZ.js";import{a as va}from"./cell-link-DiZacqDz.js";import{a as Ca}from"./renderShortcut-B-72v1dC.js";import{t as za}from"./icons-C66kZH_4.js";import{n as Ke}from"./marimo-icons-ifBE8yqY.js";import{t as Ma}from"./links-DJCEkOLM.js";import{r as Wa,t as Ge}from"./hooks-CLXoEljg.js";import{t as Je}from"./types-DOdUT9LT.js";var _a=b("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Na=b("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Qe=b("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"}]]),Xe=b("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"}]]),Ze=b("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"}]]),Sa=b("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"}]]),Da=b("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"}]]),Aa=b("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"}]]),et=b("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"}]]),Pa=b("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"}]]),Ea=b("notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]),Ia=b("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),tt=b("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"}]]),La=b("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"}]]),Ta=b("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"}]]),at=b("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"}]]),je=N(),A=ze(ut(),1),a=ze(Tt(),1);function Ra(){return"uvx marimo@latest"}function $a(t,e,n){let o=n?" --with-token":"",s=`${Ra()} pair prompt --url '${e}'${o}`;switch(t){case"claude":return`claude "$(${s} --claude)"`;case"codex":return`codex "$(${s} --codex)"`;case"opencode":return`opencode "$(${s} --opencode)"`;default:ea(t)}}function Ha(t){return t.length<=4?"****":`${"*".repeat(Math.min(t.length-4,8))}${t.slice(-4)}`}var qa="npx skills add marimo-team/marimo-pair";function Ua(){let t=(0,je.c)(2),[e,n]=(0,A.useState)(null),o,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{fetch(Pt("/auth/token").href,{headers:Lt.headers()}).then(Oa).then(r=>n((r==null?void 0:r.token)??null)).catch(()=>n(null))},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,A.useEffect)(o,s),e}function Oa(t){return t.ok?t.json():null}const Va=t=>{let e=(0,je.c)(32),{onClose:n}=t,[o,s]=(0,A.useState)("claude"),r=Et(),i=Ua(),l=!!i,d;e[0]!==o||e[1]!==l||e[2]!==r.httpURL?(d=$a(o,r.httpURL.toString(),l),e[0]=o,e[1]=l,e[2]=r.httpURL,e[3]=d):d=e[3];let c=d,p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(Oe,{children:"Pair with an agent"}),e[4]=p):p=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsxs)(Ue,{children:[p,(0,a.jsxs)(Be,{children:["Use an AI coding agent to pair-program on this notebook."," ",(0,a.jsx)("a",{href:"https://links.marimo.app/marimo-pair",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Learn more"}),"."]})]}),e[5]=u):u=e[5];let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"1. Install the skill"}),(0,a.jsx)(V,{command:qa})]}),e[6]=h):h=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=(0,a.jsx)("span",{className:"text-sm font-medium",children:"2. Run in your terminal"}),e[7]=f):f=e[7];let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=_=>s(_),e[8]=x):x=e[8];let w;e[9]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(Ht,{className:"w-full",children:[(0,a.jsx)(fe,{value:"claude",className:"flex-1",children:"Claude"}),(0,a.jsx)(fe,{value:"codex",className:"flex-1",children:"Codex"}),(0,a.jsx)(fe,{value:"opencode",className:"flex-1",children:"OpenCode"})]}),e[9]=w):w=e[9];let y;e[10]===c?y=e[11]:(y=(0,a.jsx)(xe,{value:"claude",className:"mt-3",children:(0,a.jsx)(V,{command:c})}),e[10]=c,e[11]=y);let k;e[12]===c?k=e[13]:(k=(0,a.jsx)(xe,{value:"codex",className:"mt-3",children:(0,a.jsx)(V,{command:c})}),e[12]=c,e[13]=k);let j;e[14]===c?j=e[15]:(j=(0,a.jsx)(xe,{value:"opencode",className:"mt-3",children:(0,a.jsx)(V,{command:c})}),e[14]=c,e[15]=j);let g;e[16]!==o||e[17]!==j||e[18]!==y||e[19]!==k?(g=(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[f,(0,a.jsxs)($t,{value:o,onValueChange:x,children:[w,y,k,j]})]}),e[16]=o,e[17]=j,e[18]=y,e[19]=k,e[20]=g):g=e[20];let z;e[21]!==i||e[22]!==l?(z=l&&i&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"3. Paste when prompted for token"}),(0,a.jsx)(V,{command:i,display:Ha(i)})]}),e[21]=i,e[22]=l,e[23]=z):z=e[23];let v;e[24]!==g||e[25]!==z?(v=(0,a.jsxs)("div",{className:"flex flex-col gap-4 py-2",children:[h,g,z]}),e[24]=g,e[25]=z,e[26]=v):v=e[26];let M;e[27]===n?M=e[28]:(M=(0,a.jsx)(Ve,{children:(0,a.jsx)(q,{variant:"secondary",onClick:n,children:"Close"})}),e[27]=n,e[28]=M);let W;return e[29]!==v||e[30]!==M?(W=(0,a.jsxs)(Ye,{className:"sm:max-w-lg",children:[u,v,M]}),e[29]=v,e[30]=M,e[31]=W):W=e[31],W};var V=t=>{let e=(0,je.c)(15),{command:n,display:o}=t,[s,r]=(0,A.useState)(!1),i;e[0]===n?i=e[1]:(i=Pe.stopPropagation(async x=>{x.preventDefault(),await O(n),r(!0),setTimeout(()=>r(!1),2e3)}),e[0]=n,e[1]=i);let l=i,d=o??n,c;e[2]===d?c=e[3]:(c=(0,a.jsx)("code",{className:"flex-1 select-all break-words",children:d}),e[2]=d,e[3]=c);let p;e[4]===s?p=e[5]:(p=s?(0,a.jsx)(be,{size:14,strokeWidth:1.5}):(0,a.jsx)($e,{size:14,strokeWidth:1.5}),e[4]=s,e[5]=p);let u;e[6]!==l||e[7]!==p?(u=(0,a.jsx)(q,{onClick:l,size:"xs",variant:"ghost",children:p}),e[6]=l,e[7]=p,e[8]=u):u=e[8];let h;e[9]!==s||e[10]!==u?(h=(0,a.jsx)(Ae,{content:"Copied!",open:s,children:u}),e[9]=s,e[10]=u,e[11]=h):h=e[11];let f;return e[12]!==c||e[13]!==h?(f=(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-xs",children:[c,h]}),e[12]=c,e[13]=h,e[14]=f):f=e[14],f},ot=N(),oe="https://static.marimo.app";const Ya=t=>{let e=(0,ot.c)(25),{onClose:n}=t,[o,s]=(0,A.useState)(""),{exportAsHTML:r}=U(),i=`${o}-${Math.random().toString(36).slice(2,6)}`,l=`${oe}/static/${i}`,d;e[0]!==r||e[1]!==n||e[2]!==i?(d=async g=>{g.preventDefault(),n();let z=await r({download:!1,includeCode:!0,files:aa.INSTANCE.filenames()}),v=D({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${oe}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:z,path:i})}).catch(()=>{v.dismiss(),D({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:S.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),v.dismiss(),D({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."]})})},e[0]=r,e[1]=n,e[2]=i,e[3]=d):d=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.jsx)(Oe,{children:"Share static notebook"}),e[4]=c):c=e[4];let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsxs)(Ue,{children:[c,(0,a.jsxs)(Be,{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:oe,target:"_blank",children:oe}),"."]})]}),e[5]=p):p=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=g=>{s(g.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},e[6]=u):u=e[6];let h;e[7]===o?h=e[8]:(h=(0,a.jsx)(fa,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:u,required:!0,autoComplete:"off"}),e[7]=o,e[8]=h);let f;e[9]===l?f=e[10]:(f=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(Ba,{text:l}),(0,a.jsx)("span",{className:"text-primary",children:l})]})]}),e[9]=l,e[10]=f);let x;e[11]!==h||e[12]!==f?(x=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[h,f]}),e[11]=h,e[12]=f,e[13]=x):x=e[13];let w;e[14]===n?w=e[15]:(w=(0,a.jsx)(q,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=w);let y;e[16]===l?y=e[17]:(y=(0,a.jsx)(q,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await O(l)},children:"Create"}),e[16]=l,e[17]=y);let k;e[18]!==w||e[19]!==y?(k=(0,a.jsxs)(Ve,{children:[w,y]}),e[18]=w,e[19]=y,e[20]=k):k=e[20];let j;return e[21]!==d||e[22]!==k||e[23]!==x?(j=(0,a.jsx)(Ye,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[p,x,k]})}),e[21]=d,e[22]=k,e[23]=x,e[24]=j):j=e[24],j};var Ba=t=>{let e=(0,ot.c)(8),[n,o]=A.useState(!1),s;e[0]===t.text?s=e[1]:(s=Pe.stopPropagation(async c=>{c.preventDefault(),await O(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=s);let r=s,i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)($e,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2];let l;e[3]===r?l=e[4]:(l=(0,a.jsx)(q,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:i}),e[3]=r,e[4]=l);let d;return e[5]!==n||e[6]!==l?(d=(0,a.jsx)(Ae,{content:"Copied!",open:n,children:l}),e[5]=n,e[6]=l,e[7]=d):d=e[7],d},Fa=N();function Ka(){let t=document.getElementsByClassName(Se.outputArea);for(let e of t){let n=e.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=pe.findElement(e);if(!o){H.warn("Could not find HTMLCellId for visible output area",e);continue}return{cellId:pe.parse(o.id)}}}return H.warn("No visible output area found for scroll anchor"),null}function Ga(t){if(!t){H.warn("No scroll anchor provided to restore scroll position");return}let e=document.getElementById(pe.create(t.cellId));if(!e){H.warn("Could not find cell element to restore scroll position",t.cellId);return}if(!e.querySelector(`.${Se.outputArea}`)){H.warn("Could not find output area to restore scroll position",t.cellId);return}e.scrollIntoView({block:"start",behavior:"auto"})}function nt(){let t=(0,Fa.c)(2),e=$(_e),n;return t[0]===e?n=t[1]:(n=()=>{let o=Ka();e(s=>({mode:zt(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Ga(o)})})},t[0]=e,t[1]=n),n}const st=pt(!1);var Ja=N();const Qa=()=>{let t=(0,Ja.c)(7),{selectedLayout:e}=Le(),{setLayoutView:n}=Te();if(ue()&&!ft("wasm_layouts"))return null;let o;t[0]===n?o=t[1]:(o=l=>n(l),t[0]=n,t[1]=o);let s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Bt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Ut,{placeholder:"Select a view"})}),t[2]=s):s=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Vt,{children:(0,a.jsxs)(Yt,{children:[(0,a.jsx)(qt,{children:"View as"}),Je.map(Za)]})}),t[3]=r):r=t[3];let i;return t[4]!==e||t[5]!==o?(i=(0,a.jsxs)(Ft,{"data-testid":"layout-select",value:e,onValueChange:o,children:[s,r]}),t[4]=e,t[5]=o,t[6]=i):i=t[6],i};function Xa(t){return(0,a.jsx)(lt(t),{className:"h-4 w-4"})}function lt(t){switch(t){case"vertical":return Pa;case"grid":return ra;case"slides":return tt;default:return Zt(t),ma}}function it(t){return Ee.startCase(t)}function Za(t){return(0,a.jsx)(Ot,{value:t,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Xa(t),(0,a.jsx)("span",{children:it(t)})]})},t)}async function eo(t){let{filename:e,preset:n,downloadPDF:o}=t;await o({filename:e,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var to=N();function ao(t){let e=(0,to.c)(5),{openPrompt:n,closeModal:o}=we(),{sendCopy:s}=U(),r;return e[0]!==o||e[1]!==n||e[2]!==s||e[3]!==t?(r=()=>{if(!t)return null;let i=ba.guessDeliminator(t);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${qe.basename(t)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:l=>{let d=i.join(qe.dirname(t),l);s({source:t,destination:d}).then(()=>{o(),D({title:"Notebook copied",description:"A copy of the notebook has been created."}),Ma(d)})}})},e[0]=o,e[1]=n,e[2]=s,e[3]=t,e[4]=r):r=e[4],r}const oo=()=>{let{updateCellConfig:t}=Me(),{saveCellConfig:e}=U();return(0,A.useCallback)(async()=>{let n=new bt,o=We(),s=o.cellIds.inOrderIds,r={};for(let l of s){if(o.cellData[l]===void 0)continue;let{code:d,config:c}=o.cellData[l];c.hide_code||n.isSupported(d)&&(r[l]={hide_code:!0})}let i=Ne.entries(r);if(i.length!==0){await e({configs:r});for(let[l,d]of i)t({cellId:l,config:d})}},[t])};var no=N();function rt(){let t=(0,no.c)(4),{openConfirm:e}=we(),n=$(At),{sendRestart:o}=U(),s;return t[0]!==e||t[1]!==o||t[2]!==n?(s=()=>{e({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)(Rt,{onClick:async()=>{n({state:It.CLOSING}),await o(),ga()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=o,t[2]=n,t[3]=s):s=t[3],s}var so=N(),T=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function lo(){var ve,Ce;let t=(0,so.c)(51),e=va(),{openModal:n,closeModal:o}=we(),{toggleApplication:s}=kt(),{selectedPanel:r}=yt(),[i]=mt(_e),l=me(Ct),d=oo(),[c]=Dt(),{updateCellConfig:p,undoDeleteCell:u,clearAllCellOutputs:h,addSetupCellIfDoesntExist:f,collapseAllCells:x,expandAllCells:w}=Me(),y=rt(),k=ja(),j=ao(e),g=$(st),z=$(Nt),v=$(St),{exportAsIPYNB:M,exportAsMarkdown:W,readCode:_,saveCellConfig:se,updateCellOutputs:P}=U(),E=Wa(),le=me(wt),ie=me(Mt),{selectedLayout:Y}=Le(),{setLayoutView:re}=Te(),B=nt(),F=((ve=c.sharing)==null?void 0:ve.html)??!0,K=((Ce=c.sharing)==null?void 0:Ce.wasm)??!0,ge=!ue(),de=Y==="slides",dt=zo,ct=Co,G;t[0]!==e||t[1]!==E||t[2]!==P?(G=async m=>{let{preset:C,title:R}=m;if(!e){ne();return}await De(R,async he=>{await Ge({takeScreenshots:()=>E({progress:he}),updateCellOutputs:P}),await eo({filename:e,preset:C,downloadPDF:Gt})})},t[0]=e,t[1]=E,t[2]=P,t[3]=G):G=t[3];let I=G,J;t[4]===I?J=t[5]:(J=async()=>{if(ge){await I({preset:"document",title:"Downloading Document PDF..."});return}let m=new Event("export-beforeprint"),C=new Event("export-afterprint");window.dispatchEvent(m),setTimeout(vo,0),setTimeout(()=>window.dispatchEvent(C),0)},t[4]=I,t[5]=J);let Q=J,X;t[6]!==M||t[7]!==e||t[8]!==E||t[9]!==P?(X=async()=>{if(!e){ne();return}await De("Downloading IPYNB...",async m=>{await Ge({takeScreenshots:()=>E({progress:m}),updateCellOutputs:P});let C=await M({download:!1});ke(new Blob([C],{type:"application/x-ipynb+json"}),ye.toIPYNB(document.title))})},t[6]=M,t[7]=e,t[8]=E,t[9]=P,t[10]=X):X=t[10];let ce=X,Z;t[11]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,a.jsx)(Kt,{size:14,strokeWidth:1.5}),t[11]=Z):Z=t[11];let ee;t[12]===Symbol.for("react.memo_cache_sentinel")?(ee=(0,a.jsx)(Ie,{size:14,strokeWidth:1.5}),t[12]=ee):ee=t[12];let L;t[13]===e?L=t[14]:(L=async()=>{if(!e){ne();return}await Re({filename:e,includeCode:!0})},t[13]=e,t[14]=L);let te;return t[15]!==f||t[16]!==ie||t[17]!==h||t[18]!==o||t[19]!==x||t[20]!==j||t[21]!==I||t[22]!==w||t[23]!==W||t[24]!==e||t[25]!==Q||t[26]!==ce||t[27]!==le||t[28]!==d||t[29]!==de||t[30]!==l||t[31]!==n||t[32]!==_||t[33]!==y||t[34]!==k||t[35]!==se||t[36]!==Y||t[37]!==r||t[38]!==g||t[39]!==v||t[40]!==re||t[41]!==z||t[42]!==F||t[43]!==K||t[44]!==L||t[45]!==s||t[46]!==B||t[47]!==u||t[48]!==p||t[49]!==i.mode?(te=[{icon:Z,label:"Download",handle:T,dropdown:[{icon:ee,label:"Download as HTML",handle:L},{icon:(0,a.jsx)(Ie,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!e){ne();return}await Re({filename:e,includeCode:!1})}},{icon:(0,a.jsx)(za,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let m=await W({download:!1});ke(new Blob([m],{type:"text/plain"}),ye.toMarkdown(document.title))}},{icon:(0,a.jsx)(Ea,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:ce},{icon:(0,a.jsx)(ta,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let m=await _();ke(new Blob([m.contents],{type:"text/plain"}),ye.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(pa,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:i.mode!=="present",tooltip:i.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Ca("global.hideCode",!1)]}),handle:go},de?{divider:!0,icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:T,dropdown:[{icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:Q},{icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:ct(!0),hidden:!ge,handle:async()=>{await I({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:Q}]},{icon:(0,a.jsx)(ya,{size:14,strokeWidth:1.5}),label:"Pair with an agent",handle:async()=>{n((0,a.jsx)(Va,{onClose:o}))}},{icon:(0,a.jsx)(La,{size:14,strokeWidth:1.5}),label:"Share",handle:T,hidden:!F&&!K,dropdown:[{icon:(0,a.jsx)(Xt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!F,handle:async()=>{n((0,a.jsx)(Ya,{onClose:o}))}},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!K,handle:async()=>{await O(Fe({code:(await _()).contents})),D({title:"Copied",description:"Link copied to clipboard."})}},{icon:(0,a.jsx)(Ke,{size:14,strokeWidth:1.5}),label:"Create molab notebook",handle:async()=>{let m=Fe({code:(await _()).contents,baseUrl:`${S.molab}/new`});window.open(m,"_blank")}}]},{icon:(0,a.jsx)(Ia,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:T,dropdown:xt.flatMap(m=>{let{type:C,Icon:R,hidden:he,additionalKeywords:ht}=m;return he?[]:{label:Ee.startCase(C),rightElement:dt(r===C),icon:(0,a.jsx)(R,{size:14,strokeWidth:1.5}),handle:()=>s(C),additionalKeywords:ht}})},{icon:(0,a.jsx)(tt,{size:14,strokeWidth:1.5}),label:"Present as",handle:T,dropdown:[{icon:i.mode==="present"?(0,a.jsx)(ka,{size:14,strokeWidth:1.5}):(0,a.jsx)(et,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{B()}},...Je.map((m,C)=>{let R=lt(m);return{divider:C===0,label:it(m),icon:(0,a.jsx)(R,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:Y===m&&(0,a.jsx)(be,{size:14})}),handle:()=>{re(m),i.mode==="edit"&&B()}}})]},{icon:(0,a.jsx)(Da,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!e||ue(),handle:j},{icon:(0,a.jsx)(Qe,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:async()=>{await O((await _()).contents),D({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(na,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!le||l,handle:async()=>{let m=_t(We());await se({configs:Ne.fromEntries(m.map(jo))});for(let C of m)p({cellId:C,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Ze,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{f({})}},{icon:(0,a.jsx)(jt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(He,{onClose:o}))}},{icon:(0,a.jsx)(ca,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(He,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(at,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!ie||l,handle:()=>{u()}},{icon:(0,a.jsx)(Ta,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:y,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Sa,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{k()}},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{h()}},{icon:(0,a.jsx)(sa,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(Na,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:x,redundant:!0},{icon:(0,a.jsx)(_a,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:w,redundant:!0},{divider:!0,icon:(0,a.jsx)(Xe,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>g(wo)},{icon:(0,a.jsx)(Aa,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>v(bo)},{icon:(0,a.jsx)(xa,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>z(ko),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(oa,{size:14,strokeWidth:1.5}),label:"Resources",handle:T,dropdown:[{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"Documentation",handle:yo},{icon:(0,a.jsx)(la,{size:14,strokeWidth:1.5}),label:"GitHub",handle:xo},{icon:(0,a.jsx)(ia,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:fo},{icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"YouTube",handle:uo},{icon:(0,a.jsx)(gt,{size:14,strokeWidth:1.5}),label:"Changelog",handle:po}]},{divider:!0,icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:mo},{icon:(0,a.jsx)(Ke,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:ho}].filter(co).map(io),t[15]=f,t[16]=ie,t[17]=h,t[18]=o,t[19]=x,t[20]=j,t[21]=I,t[22]=w,t[23]=W,t[24]=e,t[25]=Q,t[26]=ce,t[27]=le,t[28]=d,t[29]=de,t[30]=l,t[31]=n,t[32]=_,t[33]=y,t[34]=k,t[35]=se,t[36]=Y,t[37]=r,t[38]=g,t[39]=v,t[40]=re,t[41]=z,t[42]=F,t[43]=K,t[44]=L,t[45]=s,t[46]=B,t[47]=u,t[48]=p,t[49]=i.mode,t[50]=te):te=t[50],te}function io(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(ro)}:t}function ro(t){return!t.hidden}function co(t){return!t.hidden}function ho(){let t=wa();window.open(t,"_blank")}function mo(){let t=document.baseURI.split("?")[0];window.open(t,"_self")}function po(){window.open(S.releasesPage,"_blank")}function uo(){window.open(S.youtube,"_blank")}function fo(){window.open(S.discordLink,"_blank")}function xo(){window.open(S.githubPage,"_blank")}function yo(){window.open(S.docsPage,"_blank")}function ko(t){return!t}function bo(t){return!t}function wo(t){return!t}function jo(t){return[t,{disabled:!1}]}async function go(){let t=document.getElementById("App");t&&await Jt({element:t,filename:document.title,prepare:Qt})}function vo(){return window.print()}function Co(t){return t?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function zo(t){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:t&&(0,a.jsx)(be,{size:14})})}function ne(){D({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{nt as a,Ze as c,st as i,Xe as l,rt as n,at as o,Qa as r,et as s,lo as t,Qe 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-yDm96tKj.js"></script>
69
+ <script type="module" crossorigin src="./assets/index-Flgwmpg_.js"></script>
70
70
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-DXnewu3N.js">
71
71
  <link rel="modulepreload" crossorigin href="./assets/chunk-LvLJmgfZ.js">
72
72
  <link rel="modulepreload" crossorigin href="./assets/react-Bj1aDYRI.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.23.3-dev28",
3
+ "version": "0.23.3-dev29",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",