import{s as W}from"./chunk-DZLz74EQ.js";import{t as F}from"./react-BcIddLXZ.js";import{in as I,jt as L}from"./cells-B6jS0AIj.js";import{n as T,t as V}from"./jsx-runtime-DvsdsEjx.js";import{t as D}from"./cn-C5VTNYKf.js";import{r as q,t as H}from"./button-nRVaalxL.js";import{rt as M}from"./dist-BPcMnGQn.js";import{t as G}from"./use-toast-BiL_AQz9.js";import{f as J}from"./dist-Q3T6mWQ0.js";import{r as K}from"./useTheme-BMknLtnH.js";import{t as Q}from"./createLucideIcon-DA8ZBm4D.js";import{t as U}from"./eye-off-Dyzb-Ibf.js";import{t as X}from"./copy-CWjpIcfl.js";import{t as Y}from"./plus-CmzxQYgQ.js";import{t as g}from"./tooltip-BQKXsEoT.js";import{t as Z}from"./copy-DAqXDCGN.js";import{t as $}from"./esm-ChGlv0th.js";import{t as tt}from"./useAddCell-BcZiZJfL.js";var ot=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"}]]),N=W(T(),1),O=W(F(),1),s=W(V(),1),et=[I(),M.lineWrapping],rt=[J(),M.lineWrapping];const R=(0,O.memo)(r=>{let t=(0,N.c)(41),{theme:a}=K(),o,e,i,l,c,j,C,u;t[0]===r?(o=t[1],e=t[2],i=t[3],l=t[4],c=t[5],j=t[6],C=t[7],u=t[8]):({code:e,className:o,initiallyHideCode:i,showHideCode:j,showCopyCode:C,insertNewCell:l,language:u,...c}=r,t[0]=r,t[1]=o,t[2]=e,t[3]=i,t[4]=l,t[5]=c,t[6]=j,t[7]=C,t[8]=u);let m=j===void 0?!0:j,b=C===void 0?!0:C,E=u===void 0?"python":u,[n,A]=(0,O.useState)(i),d;t[9]===o?d=t[10]:(d=D("relative hover-actions-parent w-full overflow-hidden",o),t[9]=o,t[10]=d);let p;t[11]!==n||t[12]!==m?(p=m&&n&&(0,s.jsx)(B,{tooltip:"Show code",onClick:()=>A(!1)}),t[11]=n,t[12]=m,t[13]=p):p=t[13];let h;t[14]!==e||t[15]!==b?(h=b&&(0,s.jsx)(at,{text:e}),t[14]=e,t[15]=b,t[16]=h):h=t[16];let x;t[17]!==e||t[18]!==l?(x=l&&(0,s.jsx)(it,{code:e}),t[17]=e,t[18]=l,t[19]=x):x=t[19];let f;t[20]!==n||t[21]!==m?(f=m&&!n&&(0,s.jsx)(st,{onClick:()=>A(!0)}),t[20]=n,t[21]=m,t[22]=f):f=t[22];let y;t[23]!==h||t[24]!==x||t[25]!==f?(y=(0,s.jsxs)("div",{className:"absolute top-0 right-0 my-1 mx-2 z-10 hover-action flex gap-2",children:[h,x,f]}),t[23]=h,t[24]=x,t[25]=f,t[26]=y):y=t[26];let z=n&&"opacity-20 h-8 overflow-hidden",v;t[27]===z?v=t[28]:(v=D("cm",z),t[27]=z,t[28]=v);let _=a==="dark"?"dark":"light",S=!n,P=E==="python"?et:rt,k;t[29]!==e||t[30]!==c||t[31]!==v||t[32]!==_||t[33]!==S||t[34]!==P?(k=(0,s.jsx)($,{...c,className:v,theme:_,height:"100%",editable:S,extensions:P,value:e,readOnly:!0}),t[29]=e,t[30]=c,t[31]=v,t[32]=_,t[33]=S,t[34]=P,t[35]=k):k=t[35];let w;return t[36]!==k||t[37]!==d||t[38]!==p||t[39]!==y?(w=(0,s.jsxs)("div",{className:d,children:[p,y,k]}),t[36]=k,t[37]=d,t[38]=p,t[39]=y,t[40]=w):w=t[40],w});R.displayName="ReadonlyCode";var at=r=>{let t=(0,N.c)(5),a;t[0]===r.text?a=t[1]:(a=q.stopPropagation(async()=>{await Z(r.text),G({title:"Copied to clipboard"})}),t[0]=r.text,t[1]=a);let o=a,e;t[2]===Symbol.for("react.memo_cache_sentinel")?(e=(0,s.jsx)(X,{size:14,strokeWidth:1.5}),t[2]=e):e=t[2];let i;return t[3]===o?i=t[4]:(i=(0,s.jsx)(g,{content:"Copy code",usePortal:!1,children:(0,s.jsx)(H,{onClick:o,size:"xs",className:"py-0",variant:"secondary",children:e})}),t[3]=o,t[4]=i),i},st=r=>{let t=(0,N.c)(3),a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,s.jsx)(U,{size:14,strokeWidth:1.5}),t[0]=a):a=t[0];let o;return t[1]===r.onClick?o=t[2]:(o=(0,s.jsx)(g,{content:"Hide code",usePortal:!1,children:(0,s.jsx)(H,{onClick:r.onClick,size:"xs",className:"py-0",variant:"secondary",children:a})}),t[1]=r.onClick,t[2]=o),o};const B=r=>{let t=(0,N.c)(7),a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,s.jsx)(L,{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 o;t[1]===r.tooltip?o=t[2]:(o=(0,s.jsx)(g,{usePortal:!1,content:r.tooltip,children:a}),t[1]=r.tooltip,t[2]=o);let e;return t[3]!==r.className||t[4]!==r.onClick||t[5]!==o?(e=(0,s.jsx)("div",{className:r.className,onClick:r.onClick,children:o}),t[3]=r.className,t[4]=r.onClick,t[5]=o,t[6]=e):e=t[6],e};var it=r=>{let t=(0,N.c)(6),a=tt(),o;t[0]!==a||t[1]!==r.code?(o=()=>{a(r.code)},t[0]=a,t[1]=r.code,t[2]=o):o=t[2];let e=o,i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.jsx)(Y,{size:14,strokeWidth:1.5}),t[3]=i):i=t[3];let l;return t[4]===e?l=t[5]:(l=(0,s.jsx)(g,{content:"Add code to notebook",usePortal:!1,children:(0,s.jsx)(H,{onClick:e,size:"xs",className:"py-0",variant:"secondary",children:i})}),t[4]=e,t[5]=l),l};export{R as n,ot as r,B as t};
