import{s as I}from"./chunk-LvLJmgfZ.js";import{o as D,p as E}from"./useEvent-D91BmmQi.js";import{t as F}from"./react-Bj1aDYRI.js";import{Yt as L,yr as V}from"./cells-DQ5n6Zef.js";import{t as Y}from"./compiler-runtime-B3qBwwSJ.js";import{t as A}from"./cn-X2M2usMq.js";import{t as q}from"./jsx-runtime-PbYoItBR.js";import{r as G}from"./radio-group-D7RG9Px_.js";import{t as g}from"./tooltip-CgQpRVyN.js";import{r as J,t as W}from"./button-BF7GSjhW.js";import{st as M}from"./dist-Dez1I5M9.js";import{f as K}from"./dist-CfGDksO-.js";import{t as Q}from"./createLucideIcon-BTp1tQDO.js";import{t as U}from"./copy-IBNGDypD.js";import{t as X}from"./eye-off-DI0EQXw0.js";import{t as Z}from"./plus-CExKUszm.js";import{t as $}from"./use-toast-BH8bU9Xf.js";import{r as tt}from"./useTheme-CWoNQwFz.js";import{n as ot}from"./copy-CyasABTK.js";import{t as et}from"./esm-DSv-aO_T.js";var rt=Q("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);const O=E({isInstantiated:!1,error:null});function at(){return D(O,o=>o.isInstantiated)}var w=Y(),R=I(F(),1),s=I(q(),1),st=[L(),M.lineWrapping],it=[K(),M.lineWrapping];const T=(0,R.memo)(o=>{let t=(0,w.c)(41),{theme:a}=tt(),e,r,i,l,c,k,C,j;t[0]===o?(e=t[1],r=t[2],i=t[3],l=t[4],c=t[5],k=t[6],C=t[7],j=t[8]):({code:r,className:e,initiallyHideCode:i,showHideCode:k,showCopyCode:C,insertNewCell:l,language:j,...c}=o,t[0]=o,t[1]=e,t[2]=r,t[3]=i,t[4]=l,t[5]=c,t[6]=k,t[7]=C,t[8]=j);let m=k===void 0?!0:k,b=C===void 0?!0:C,B=j===void 0?"python":j,[n,H]=(0,R.useState)(i),d;t[9]===e?d=t[10]:(d=A("relative hover-actions-parent w-full overflow-hidden",e),t[9]=e,t[10]=d);let p;t[11]!==n||t[12]!==m?(p=m&&n&&(0,s.jsx)(ct,{tooltip:"Show code",onClick:()=>H(!1)}),t[11]=n,t[12]=m,t[13]=p):p=t[13];let h;t[14]!==r||t[15]!==b?(h=b&&(0,s.jsx)(lt,{text:r}),t[14]=r,t[15]=b,t[16]=h):h=t[16];let f;t[17]!==r||t[18]!==l?(f=l&&(0,s.jsx)(mt,{code:r}),t[17]=r,t[18]=l,t[19]=f):f=t[19];let x;t[20]!==n||t[21]!==m?(x=m&&!n&&(0,s.jsx)(nt,{onClick:()=>H(!0)}),t[20]=n,t[21]=m,t[22]=x):x=t[22];let y;t[23]!==h||t[24]!==f||t[25]!==x?(y=(0,s.jsxs)("div",{className:"absolute top-0 right-0 my-1 mx-2 z-10 hover-action flex gap-2",children:[h,f,x]}),t[23]=h,t[24]=f,t[25]=x,t[26]=y):y=t[26];let z=n&&"opacity-20 h-8 overflow-hidden",v;t[27]===z?v=t[28]:(v=A("cm",z),t[27]=z,t[28]=v);let _=a==="dark"?"dark":"light",S=!n,P=B==="python"?st:it,u;t[29]!==r||t[30]!==c||t[31]!==v||t[32]!==_||t[33]!==S||t[34]!==P?(u=(0,s.jsx)(et,{...c,className:v,theme:_,height:"100%",editable:S,extensions:P,value:r,readOnly:!0}),t[29]=r,t[30]=c,t[31]=v,t[32]=_,t[33]=S,t[34]=P,t[35]=u):u=t[35];let N;return t[36]!==u||t[37]!==d||t[38]!==p||t[39]!==y?(N=(0,s.jsxs)("div",{className:d,children:[p,y,u]}),t[36]=u,t[37]=d,t[38]=p,t[39]=y,t[40]=N):N=t[40],N});T.displayName="ReadonlyCode";var lt=o=>{let t=(0,w.c)(5),a;t[0]===o.text?a=t[1]:(a=J.stopPropagation(async()=>{await ot(o.text),$({title:"Copied to clipboard"})}),t[0]=o.text,t[1]=a);let e=a,r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,s.jsx)(U,{size:14,strokeWidth:1.5}),t[2]=r):r=t[2];let i;return t[3]===e?i=t[4]:(i=(0,s.jsx)(g,{content:"Copy code",usePortal:!1,children:(0,s.jsx)(W,{onClick:e,size:"xs",className:"py-0",variant:"secondary",children:r})}),t[3]=e,t[4]=i),i},nt=o=>{let t=(0,w.c)(3),a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,s.jsx)(X,{size:14,strokeWidth:1.5}),t[0]=a):a=t[0];let e;return t[1]===o.onClick?e=t[2]:(e=(0,s.jsx)(g,{content:"Hide code",usePortal:!1,children:(0,s.jsx)(W,{onClick:o.onClick,size:"xs",className:"py-0",variant:"secondary",children:a})}),t[1]=o.onClick,t[2]=e),e};const ct=o=>{let t=(0,w.c)(7),a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,s.jsx)(V,{className:"hover-action w-5 h-5 text-muted-foreground cursor-pointer absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 opacity-80 hover:opacity-100 z-20"}),t[0]=a):a=t[0];let e;t[1]===o.tooltip?e=t[2]:(e=(0,s.jsx)(g,{usePortal:!1,content:o.tooltip,children:a}),t[1]=o.tooltip,t[2]=e);let r;return t[3]!==o.className||t[4]!==o.onClick||t[5]!==e?(r=(0,s.jsx)("div",{className:o.className,onClick:o.onClick,children:e}),t[3]=o.className,t[4]=o.onClick,t[5]=e,t[6]=r):r=t[6],r};var mt=o=>{let t=(0,w.c)(6),a=G(),e;t[0]!==a||t[1]!==o.code?(e=()=>{a(o.code)},t[0]=a,t[1]=o.code,t[2]=e):e=t[2];let r=e,i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.jsx)(Z,{size:14,strokeWidth:1.5}),t[3]=i):i=t[3];let l;return t[4]===r?l=t[5]:(l=(0,s.jsx)(g,{content:"Add code to notebook",usePortal:!1,children:(0,s.jsx)(W,{onClick:r,size:"xs",className:"py-0",variant:"secondary",children:i})}),t[4]=r,t[5]=l),l};export{rt as i,O as n,at as r,T as t};
