@marimo-team/frontend 0.15.0 → 0.15.1-dev12
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.
- package/dist/assets/{ConnectedDataExplorerComponent-Bl5fR_87.js → ConnectedDataExplorerComponent-BvA88co5.js} +1 -1
- package/dist/assets/{ImageComparisonComponent-CRfr-CiC.js → ImageComparisonComponent-DMstqRhm.js} +1 -1
- package/dist/assets/{VegaLite-Bo_A9ZZm.js → VegaLite-Mesl0wXW.js} +1 -1
- package/dist/assets/{_baseEach-CIMlsWNn.js → _baseEach-4LREA2xJ.js} +1 -1
- package/dist/assets/_baseMap-C6LNFWWn.js +1 -0
- package/dist/assets/{_baseUniq-CGK6su7v.js → _baseUniq-C4wq7Gz_.js} +1 -1
- package/dist/assets/{_createAggregator--z161kAx.js → _createAggregator-Di1sij95.js} +1 -1
- package/dist/assets/{any-language-editor-hSTaStg9.js → any-language-editor-CNdroSlJ.js} +1 -1
- package/dist/assets/{architectureDiagram-KFL7JDKH-CqrWvX5_.js → architectureDiagram-KFL7JDKH-BxXZfRHj.js} +1 -1
- package/dist/assets/{blockDiagram-ZYB65J3Q-CRgdhCYU.js → blockDiagram-ZYB65J3Q-8mg_ND0j.js} +1 -1
- package/dist/assets/{c4Diagram-AAMF2YG6-DUHfB-bk.js → c4Diagram-AAMF2YG6-BH1zFYgt.js} +1 -1
- package/dist/assets/channel-B3CCoyYy.js +1 -0
- package/dist/assets/{chunk-ANTBXLJU-ZgvmG8Pb.js → chunk-ANTBXLJU-wUIE1C6t.js} +1 -1
- package/dist/assets/{chunk-FHKO5MBM-B-EzrMTM.js → chunk-FHKO5MBM-BnGig1B_.js} +1 -1
- package/dist/assets/{chunk-GLLZNHP4-DRBUPzV6.js → chunk-GLLZNHP4-BeuHRwGr.js} +1 -1
- package/dist/assets/{chunk-JBRWN2VN-vkbXs27X.js → chunk-JBRWN2VN-BEuqVuwn.js} +1 -1
- package/dist/assets/{chunk-LXBSTHXV-itspTgVu.js → chunk-LXBSTHXV-DIaccDrz.js} +1 -1
- package/dist/assets/{chunk-NRVI72HA-gO-7Uy2L.js → chunk-NRVI72HA-I0EqNhLo.js} +1 -1
- package/dist/assets/{chunk-OMD6QJNC-CwDxph2q.js → chunk-OMD6QJNC-DBDKfLns.js} +1 -1
- package/dist/assets/{chunk-WVR4S24B-DkjWv9uk.js → chunk-WVR4S24B-D9vksrD4.js} +1 -1
- package/dist/assets/{circle-play-BURxVoHD.js → circle-play-Xdbicaqg.js} +1 -1
- package/dist/assets/classDiagram-3BZAVTQC-CLXskjCP.js +1 -0
- package/dist/assets/classDiagram-v2-QTMF73CY-CLXskjCP.js +1 -0
- package/dist/assets/clone-BCc-guNO.js +1 -0
- package/dist/assets/{compile-CQlZ79Z5.js → compile-D-SKgFzl.js} +1 -1
- package/dist/assets/{dagre-2BBEFEWP-DEiqD84H.js → dagre-2BBEFEWP-Dj4VJDXi.js} +1 -1
- package/dist/assets/{data-grid-overlay-editor-CS6yXy6C.js → data-grid-overlay-editor-BHUr5Xhc.js} +1 -1
- package/dist/assets/{diagram-4IRLE6MV-ommhV7Ge.js → diagram-4IRLE6MV-9wayoyRN.js} +1 -1
- package/dist/assets/{diagram-GUPCWM2R-D09B2kyR.js → diagram-GUPCWM2R-5NhVlGLr.js} +1 -1
- package/dist/assets/{diagram-RP2FKANI-D1AZYHbD.js → diagram-RP2FKANI-CNBOj37W.js} +1 -1
- package/dist/assets/{edit-page-DhSV7e13.js → edit-page-D8Xj7wsn.js} +16 -16
- package/dist/assets/{erDiagram-HZWUO2LU-Civ5tj0J.js → erDiagram-HZWUO2LU-KEjz95KS.js} +1 -1
- package/dist/assets/{flowDiagram-THRYKUMA--HeKh8ql.js → flowDiagram-THRYKUMA-9PtbKpm0.js} +1 -1
- package/dist/assets/{ganttDiagram-WV7ZQ7D5-YEcfQSSf.js → ganttDiagram-WV7ZQ7D5-CFXRYmNt.js} +1 -1
- package/dist/assets/{gitGraphDiagram-OJR772UL-DhkURReZ.js → gitGraphDiagram-OJR772UL-hFrAcG26.js} +1 -1
- package/dist/assets/{glide-data-editor-CudlNmdp.js → glide-data-editor-HLSiEHg4.js} +4 -4
- package/dist/assets/{graph-CQvdQbxU.js → graph-iTnwmAye.js} +1 -1
- package/dist/assets/{home-page-_l6RVaRB.js → home-page-DzRg-dzP.js} +1 -1
- package/dist/assets/{index-CAtmZMbK.js → index-B3l0i9L2.js} +1 -1
- package/dist/assets/{index-DZJOZ8C0.js → index-BA1eBtgJ.js} +1 -1
- package/dist/assets/{index-B9dXZoY1.js → index-BMCpi_hV.js} +1 -1
- package/dist/assets/index-BRPMSgmu.css +1 -0
- package/dist/assets/{index-DbsrZX7Q.js → index-Bj_MIGqG.js} +1 -1
- package/dist/assets/{index-QoqjKBP_.js → index-BlHS2xQv.js} +1 -1
- package/dist/assets/{index-DvySElQ5.js → index-BzQQnlIk.js} +1 -1
- package/dist/assets/{index-CvLIL6JV.js → index-BzZRHBMs.js} +1 -1
- package/dist/assets/{index-DMtmziVF.js → index-CEoUSuyW.js} +1 -1
- package/dist/assets/{index-6WfEFtf2.js → index-CJRYE40I.js} +1 -1
- package/dist/assets/{index-nyTtvXGx.js → index-CQ7rf4K7.js} +1 -1
- package/dist/assets/{index-C6CvZyWd.js → index-Cl5g0z7j.js} +1 -1
- package/dist/assets/{index-CbNkOFUU.js → index-Cni7Zj6s.js} +1 -1
- package/dist/assets/{index-CqRTe3S2.js → index-CrltF-5r.js} +1 -1
- package/dist/assets/{index-BCdqiRjH.js → index-CswmrBaY.js} +1 -1
- package/dist/assets/{index-Do3KUHEe.js → index-D1rqBcHl.js} +1 -1
- package/dist/assets/{index-DhRZE5tA.js → index-DApZsb--.js} +1 -1
- package/dist/assets/{index-3z3sI3MY.js → index-DNVhZM1y.js} +1 -1
- package/dist/assets/{index-BvRQ66y_.js → index-DWJwqJmD.js} +1 -1
- package/dist/assets/{index-D-8oCPO1.js → index-DmunXcbP.js} +1 -1
- package/dist/assets/{index-D4bXoNM3.js → index-WZpn7zIz.js} +157 -157
- package/dist/assets/infoDiagram-6WOFNB3A-BvitCnlF.js +2 -0
- package/dist/assets/{journeyDiagram-FFXJYRFH-CC3RaMZl.js → journeyDiagram-FFXJYRFH-BEiF2rN9.js} +1 -1
- package/dist/assets/{kanban-definition-KOZQBZVT-1Z4QU83I.js → kanban-definition-KOZQBZVT-BZZVRqX0.js} +1 -1
- package/dist/assets/{layout-DuQ9W6pS.js → layout-2hUFrdoK.js} +1 -1
- package/dist/assets/{linear-BsI0Wmp7.js → linear-DM7ygpKu.js} +1 -1
- package/dist/assets/{links-D_cg4TpC.js → links-BJFGdYRd.js} +8 -8
- package/dist/assets/{mermaid-D59lkToe.js → mermaid-CxGPSzDz.js} +4 -4
- package/dist/assets/{min-DrLfF3uL.js → min-DS87IVOa.js} +1 -1
- package/dist/assets/{mindmap-definition-LNHGMQRG-ePnX66wd.js → mindmap-definition-LNHGMQRG-C7yfXmRD.js} +1 -1
- package/dist/assets/{number-overlay-editor-CPxl07sM.js → number-overlay-editor-qOf48nx-.js} +1 -1
- package/dist/assets/{pieDiagram-DBDJKBY4-BWYaH6Hi.js → pieDiagram-DBDJKBY4-CRluUHH0.js} +1 -1
- package/dist/assets/{quadrantDiagram-YPSRARAO-BwuEJiK-.js → quadrantDiagram-YPSRARAO-FZO2_Kyx.js} +1 -1
- package/dist/assets/{react-plotly-eq8YBLKm.js → react-plotly-BV6Vu1ZC.js} +1 -1
- package/dist/assets/{requirementDiagram-EGVEC5DT-B0dO70r7.js → requirementDiagram-EGVEC5DT-CFEV56bq.js} +1 -1
- package/dist/assets/{run-page-DP_FNoql.js → run-page-BiiAHZuC.js} +1 -1
- package/dist/assets/{sankeyDiagram-HRAUVNP4-DlbnyCg4.js → sankeyDiagram-HRAUVNP4-cf6xzlF-.js} +1 -1
- package/dist/assets/{sequenceDiagram-WFGC7UMF-BfhFFLfz.js → sequenceDiagram-WFGC7UMF-CEIC5fba.js} +1 -1
- package/dist/assets/{slides-component-Bso9rHdK.js → slides-component-BXl359nW.js} +1 -1
- package/dist/assets/{sortBy-utaS96Bi.js → sortBy-Dv7jjKnm.js} +1 -1
- package/dist/assets/{stateDiagram-UUKSUZ4H-ByVZAeGw.js → stateDiagram-UUKSUZ4H-DLvG9b91.js} +1 -1
- package/dist/assets/stateDiagram-v2-EYPG3UTE-Z_xESMay.js +1 -0
- package/dist/assets/{storage-DrvlAZZd.js → storage-B47VVzw1.js} +3 -3
- package/dist/assets/{terminal-CuPjZ1vE.js → terminal-2p_4lGQJ.js} +1 -1
- package/dist/assets/{time-1P0zCPa4.js → time-OI-T4MiC.js} +1 -1
- package/dist/assets/{timeline-definition-3HZDQTIS-BLUL1ZU4.js → timeline-definition-3HZDQTIS-Da1Ro9aI.js} +1 -1
- package/dist/assets/{tracing-BpM0fbsC.js → tracing-CRxB69vv.js} +2 -2
- package/dist/assets/{trash-D5wptdZI.js → trash-DM7Eop-E.js} +1 -1
- package/dist/assets/{treemap-75Q7IDZK-Bh5pVSmo.js → treemap-75Q7IDZK-DaZTYidc.js} +1 -1
- package/dist/assets/{vega-component-tH6bw1Lr.js → vega-component-D1rpMJYI.js} +1 -1
- package/dist/assets/{xychartDiagram-FDP5SA34-qY_Wo73t.js → xychartDiagram-FDP5SA34-COsO2s8u.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/src/components/ai/ai-model-dropdown.tsx +165 -41
- package/src/components/datasources/datasources.tsx +19 -2
- package/src/components/ui/dropdown-menu.tsx +11 -10
- package/src/core/ai/__tests__/model-registry.test.ts +12 -12
- package/src/core/ai/model-registry.ts +19 -25
- package/src/core/config/config.ts +4 -0
- package/src/core/config/feature-flag.tsx +1 -5
- package/src/core/datasets/engines.ts +1 -0
- package/src/css/katex.min.css +1 -0
- package/dist/assets/_baseMap-1GEe_WcR.js +0 -1
- package/dist/assets/channel-D31q3TW_.js +0 -1
- package/dist/assets/classDiagram-3BZAVTQC-0O2jYKfn.js +0 -1
- package/dist/assets/classDiagram-v2-QTMF73CY-0O2jYKfn.js +0 -1
- package/dist/assets/clone-DFaYgbfI.js +0 -1
- package/dist/assets/index-CrH6PPjG.css +0 -1
- package/dist/assets/infoDiagram-6WOFNB3A-B7BrcI_a.js +0 -2
- package/dist/assets/stateDiagram-v2-EYPG3UTE-C6PYJGwL.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-
|
|
2
|
-
var TO=Object.defineProperty;var d3=Mt=>{throw TypeError(Mt)};var MO=(Mt,wt,nn)=>wt in Mt?TO(Mt,wt,{enumerable:!0,configurable:!0,writable:!0,value:nn}):Mt[wt]=nn;var Z=(Mt,wt,nn)=>MO(Mt,typeof wt!="symbol"?wt+"":wt,nn),OO=(Mt,wt,nn)=>wt.has(Mt)||d3("Cannot "+nn);var u3=(Mt,wt,nn)=>(OO(Mt,wt,"read from private field"),nn?nn.call(Mt):wt.get(Mt)),h3=(Mt,wt,nn)=>wt.has(Mt)?d3("Cannot add the same private member more than once"):wt instanceof WeakSet?wt.add(Mt):wt.set(Mt,nn);import{c as _e,iF as mr,iG as DO,iH as am,iI as RO,iJ as PO,iK as f3,iL as m3,iM as Yl,U as M,iN as LO,iO as FO,dM as p3,iP as zO,dI as BO,dL as UO,b as q,dG as lm,a as H,T as nt,ac as Je,j as u,a1 as Fn,a9 as Wo,a8 as ls,aa as cs,bo as qo,a6 as ve,ab as sn,iQ as Ti,a7 as Go,aT as zn,ad as Mi,at as Ee,ao as Ct,d_ as cm,eO as Oi,iR as $O,aO as Fe,S as lt,iS as VO,f0 as bn,iT as g3,iU as x3,iV as dm,iW as b3,L as ut,dy as Kl,aY as Yo,iX as Xl,a_ as um,ag as tn,iY as HO,aw as Di,iZ as WO,i_ as y3,e$ as v3,al as jt,b5 as hm,i$ as w3,cB as Jl,j0 as qO,dR as Qe,j1 as Zl,dY as In,j2 as Ri,V as Ne,ba as An,j3 as Ql,j4 as ec,eR as ds,j5 as GO,j6 as Pi,j7 as k3,eZ as C3,j8 as fm,j9 as mm,er as pm,ja as Jn,jb as pr,aW as tc,jc as YO,jd as nc,je as oc,au as No,ef as j3,av as Li,jf as KO,jg as rc,bq as gr,eS as xr,fv as S3,be as zt,jh as XO,ji as JO,g2 as Fi,aQ as sc,jj as gm,jk as ZO,jl as N3,jm as xm,jn as QO,jo as ic,jp as Zn,jq as E3,g4 as bm,jr as zi,js as ac,ew as ft,ey as us,jt as gt,ju as ze,jv as at,jw as ym,jx as eD,jy as vm,jz as xt,jA as _3,ds as lc,dn as cc,dp as wm,dq as dc,dm as uc,fI as km,b4 as Bn,aK as Tn,fy as I3,fA as A3,fB as tD,fG as nD,fC as T3,jB as M3,ar as xe,eq as oD,b2 as Eo,b0 as _o,b3 as Io,a$ as At,e_ as an,jC as O3,fE as D3,jD as rD,jE as sD,fw as R3,fx as P3,jF as hs,dr as Cm,jG as L3,gs as iD,jH as aD,a5 as lD,a4 as cD,jI as jm,dv as F3,dx as Sm,fj as hc,jJ as fc,jK as mc,bt as yn,eV as Bi,fg as ln,bj as z3,d$ as Bt,el as dD,a2 as Nm,jL as Ui,jM as pc,jN as uD,jO as hD,jP as B3,a3 as fD,ae as $i,eL as U3,jQ as Gt,aX as mD,af as Em,g7 as $3,es as gc,jR as pD,gM as _m,bi as xc,bl as gD,jS as xD,jT as V3,gW as bD,gU as yD,gX as vD,gY as wD,jU as Im,dt as Un,jV as kD,jW as bc,jX as fs,q as Qn,o as We,fO as $n,jY as vn,jZ as ot,j_ as ms,j$ as Tt,g3 as Dt,k0 as Am,ev as wn,k1 as CD,k2 as Tm,bg as H3,bh as W3,k3 as jD,gP as ps,k4 as yc,bd as vc,gQ as br,f1 as Mm,k5 as SD,k6 as q3,k7 as Vi,k8 as G3,k9 as Om,ka as Y3,kb as K3,kc as X3,kd as J3,f2 as Dm,ke as ND,kf as eo,kg as wc,kh as Z3,du as Q3,ki as kc,gL as Rm,kj as Cc,kk as Hi,kl as Wi,km as jc,kn as Ko,ko as eC,kp as Ao,kq as gs,kr as Pm,ks as qi,kt as xs,ku as Lm,kv as Fm,kw as tC,kx as Sc,ky as ED,ay as Gi,kz as Yi,kA as _D,dX as Nc,kB as ID,kC as zm,kD as AD,kE as TD,kF as Ec,e4 as MD,kG as yr,kH as _c,fN as Mn,kI as bs,fY as To,gh as nC,cm as oC,kJ as Bm,fH as rC,eK as sC,kK as iC,kL as Ic,kM as aC,kN as Ac,kO as Um,kP as ys,kQ as Ki,kR as Xi,kS as OD,ge as Tc,kT as $m,kU as Mc,ek as DD,gf as RD,kV as PD,kW as LD,kX as FD,kY as zD,u as BD,kZ as UD,k_ as $D,k$ as VD,fR as HD,l0 as WD,l1 as lC,t as L,l2 as qD,l3 as GD,l4 as YD,l5 as KD,l6 as XD,l7 as JD,l8 as ZD,l9 as QD,la as eR,lb as tR,lc as nR,ld as oR,le as rR,lf as sR,lg as iR,lh as aR,li as lR,lj as cR,lk as dR,ll as uR,lm as hR,ln as fR,lo as Ji,lp as mR,lq as pR,lr as gR,ls as xR,lt as bR,lu as yR,lv as vR,lw as wR,lx as Vm,ly as Oc,lz as cC,lA as kR,lB as CR,lC as dC,lD as jR,lE as vs,lF as On,lG as SR,lH as NR,lI as ER,lJ as _R,lK as IR,lL as AR,lM as TR,lN as MR,lO as OR,lP as DR,lQ as Xo,lR as RR,lS as PR,lT as LR,lU as FR,e1 as zR,lV as BR,lW as uC,e5 as UR,lX as Dc,lY as $R,lZ as VR,l_ as HR,l$ as WR,gZ as Jo,m0 as Rc,m1 as qR,m2 as GR,m3 as hC,m4 as Hm,gO as ws,m5 as YR,m6 as KR,m7 as XR,m8 as Zi,m9 as Qi,eY as Wm,ma as JR,fW as ZR,bn as QR,an as qm,mb as fC,mc as eP,md as tP,me as Gm,mf as Ym,mg as nP,mh as mC,mi as pC,mj as Pc,fM as oP,Y as gC,dP as rP,mk as xC,ft as vt,ml as ea,mm as ks,mn as sP,mo as iP,mp as aP,mq as lP,cl as Km,mr as cP,am as vr,ms as Lc,mt as dP,mu as bC,dN as Fc,mv as uP,bp as yC,bf as vC,mw as hP,mx as fP,my as mP,ex as pP,mz as wC,mA as kC,mB as CC,mC as gP,mD as jC,mE as SC,mF as ta,mG as xP,mH as NC,mI as bP,mJ as yP,mK as EC,Z as zc,mL as vP,br as _C,mM as wP,as as Mo,mN as kP,mO as na,mP as CP,mQ as IC,eX as AC,fK as Bc,mR as Xm,aV as Jm,ep as Uc,eo as Zm,mS as jP,eU as TC,mT as SP,mU as MC,fs as NP,mV as EP,gI as _P,fz as IP,fD as Qm,gJ as AP,bm as oa,mW as OC,mX as ep,mY as TP,mZ as MP,m_ as OP,_ as kn,et as DP,m$ as RP,n0 as PP,n1 as DC,fl as tp,dA as RC,n2 as LP,aq as wr,n3 as FP,n4 as zP,n5 as BP,aP as UP,n6 as $P,n7 as VP,n8 as HP,W as WP,n9 as $c,fh as qP,na as PC,gt as LC,fX as GP,gm as YP,nb as KP,nc as FC,nd as XP,ne as Cs,nf as JP,ng as Vc,nh as ZP,ni as QP,nj as eL,z as zC,gS as tL,nk as ra,gx as BC,gy as UC,gz as $C,gr as VC,nl as nL,C as HC,nm as oL,nn as rL,gv as sL,no as iL,np as aL,E as kr,f7 as WC,bc as lL,b9 as cL,nq as dL,nr as uL,ns as hL,dD as qC,nt as np,nu as fL,dZ as GC,nv as mL,nw as op,nx as pL,ny as gL,nz as xL,nA as YC,nB as KC,nC as XC,ff as JC,nD as bL,nE as yL,nF as ZC,nG as QC,nH as Hc,nI as ej,nJ as tj,nK as nj,nL as vL,nM as wL,nN as oj,nO as kL,nP as CL,nQ as jL,nR as SL,nS as NL,nT as EL,dW as _L,nU as IL,nV as AL,nW as TL,nX as ML,nY as OL,nZ as DL,n_ as RL,n$ as PL,o0 as LL,o1 as FL,o2 as zL,gj as BL,o3 as UL,o4 as $L,o5 as rj,o6 as VL,ax as HL,o7 as WL,ap as qL,eN as GL,o8 as YL,gD as rp,gB as js,gE as Cr,gC as jr,gF as sp,gG as ip,o9 as sj,oa as ij,ob as aj,oc as Zo,gu as KL,od as XL,oe as JL,of as ZL,og as QL,oh as eF,oi as lj,eC as tF,oj as ap,ok as nF,ah as Wc,ol as cj,om as dj,aj as uj,ai as oF,dV as rF,__tla as sF}from"./index-D4bXoNM3.js";import{b as Ss,A as iF,L as hj,g as aF,G as lF,o as fj,s as cF,k as dF,B as mj,a as uF,M as hF,Y as fF,c as cn,u as sa,C as mF,S as pF,K as gF,d as xF,i as bF,e as pj,f as yF,h as vF,j as ia,P as aa,l as gj,m as wF,n as kF,p as CF,D as Ns,q as jF,r as lp,T as SF}from"./links-D_cg4TpC.js";import{V as xj,d as Sr,I as cp,N as bj,S as yj,e as vj,f as wj,L as kj,g as Cj,F as jj,M as NF,l as Sj,h as EF,E as qc,i as _F,j as dp,k as up,n as IF,o as AF,p as TF,q as MF,s as OF,t as DF,v as RF,w as PF,u as LF,C as FF,R as Nj,A as zF,a as BF,T as UF,x as $F,y as VF,m as HF,z as WF,B as qF,O as GF,c as YF,P as KF,__tla as XF}from"./storage-DrvlAZZd.js";import{c as JF}from"./_createAggregator--z161kAx.js";import{_ as Ej,a as _j,i as ZF,w as QF,L as Ij,A as ez,C as Aj,b as hp,c as Tj,__tla as tz}from"./loro_wasm_bg-C3hKWL9L.js";import{s as Vn,i as Qo,T as fp,a as mp}from"./transform-B8bpuzxV.js";import{g as Mj}from"./timer-BwIYMJWC.js";import{i as nz}from"./zoom-COrs4lFh.js";import{s as la}from"./sortBy-utaS96Bi.js";let pp,Gc,dn,Yc,Oj,Es,oz=Promise.all([(()=>{try{return sF}catch{}})(),(()=>{try{return XF}catch{}})(),(()=>{try{return tz}catch{}})()]).then(async()=>{var Gl,a3;var Mt=JF(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let wt,nn,gp,Kc,_s,Nr,Xc,Jc,xp,bp,ca,Zc,yp,da,vp,Qc,wp,kp,ed,Cp,jp,Sp,ua,Np,td,Ep,_p,Ip,Ap,Tp,Mp,nd,Op,od,rd,Dp,Rp,Pp,Lp,Fp,zp,ha,Bp,Up,sd,$p,Vp,Hp,id,Wp,qp,Gp,fa,ad,ld,Yp,Kp,Xp,Jp,Zp,Qp,eg,tg,ng,cd,dd,og,rg,sg,ma,un,hn;wt=_e("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),nn=_e("arrow-right-to-line",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]),gp=_e("arrow-right-from-line",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M21 12H7",key:"13ipq5"}],["path",{d:"m15 18 6-6-6-6",key:"6tx3qv"}]]),Kc=_e("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),_s=_e("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),Nr=_e("between-horizontal-start",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]),Xc=_e("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),Jc=_e("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Yc=_e("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),xp=_e("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),bp=_e("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),ca=_e("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Zc=_e("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"}]]),yp=_e("clipboard-paste",[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]),da=_e("cloud-download",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]]),vp=_e("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),Qc=_e("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"}]]),wp=_e("copy-minus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),kp=_e("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"}]]),ed=_e("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),Cp=_e("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"}]]),jp=_e("fast-forward",[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]]),Sp=_e("file-pen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]),ua=_e("file-plus-2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]),Np=_e("files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]),td=_e("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),Ep=_e("folder-tree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]),_p=_e("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),Ip=_e("hard-drive-download",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]),Ap=_e("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"}]]),Tp=_e("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]),Mp=_e("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]),nd=_e("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]),Op=_e("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"}]]),od=_e("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"}]]),rd=_e("list-tree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]),Dp=_e("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]),Rp=_e("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]),Pp=_e("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]),Lp=_e("memory-stick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]),Fp=_e("message-circle-question-mark",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),zp=_e("microchip",[["path",{d:"M18 12h2",key:"quuxs7"}],["path",{d:"M18 16h2",key:"zsn3lv"}],["path",{d:"M18 20h2",key:"9x5y9y"}],["path",{d:"M18 4h2",key:"1luxfb"}],["path",{d:"M18 8h2",key:"nxqzg"}],["path",{d:"M4 12h2",key:"1ltxp0"}],["path",{d:"M4 16h2",key:"8a5zha"}],["path",{d:"M4 20h2",key:"27dk57"}],["path",{d:"M4 4h2",key:"10groj"}],["path",{d:"M4 8h2",key:"18vq6w"}],["path",{d:"M8 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-1.5c-.276 0-.494.227-.562.495a2 2 0 0 1-3.876 0C9.994 2.227 9.776 2 9.5 2z",key:"1681fp"}]]),ha=_e("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),Bp=_e("octagon-alert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]),Up=_e("package-check",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),sd=_e("package-x",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["path",{d:"m17 13 5 5m-5 0 5-5",key:"im3w4b"}]]),$p=_e("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Vp=_e("party-popper",[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]]),Hp=_e("pen-line",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]),id=_e("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"}]]),Wp=_e("regex",[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]]),qp=_e("rotate-ccw",[["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"}]]),Gp=_e("rows-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]),fa=_e("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),ad=_e("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]),ld=_e("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),Yp=_e("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"}]]),Kp=_e("square-code",[["path",{d:"m10 9-3 3 3 3",key:"1oro0q"}],["path",{d:"m14 15 3-3-3-3",key:"bz13h7"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Xp=_e("square-dashed-bottom-code",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}]]),Jp=_e("square-equal",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]),Zp=_e("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),Qp=_e("square-play",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 8 6 4-6 4Z",key:"f1r3lt"}]]),eg=_e("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"}]]),tg=_e("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),ng=_e("text-cursor-input",[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]]),cd=_e("text-search",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M10 12H3",key:"1ulcyk"}],["path",{d:"M10 18H3",key:"13769t"}],["circle",{cx:"17",cy:"15",r:"3",key:"1upz2a"}],["path",{d:"m21 19-1.9-1.9",key:"dwi7p8"}]]),dd=_e("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"}]]),og=_e("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),rg=_e("view",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]),sg=_e("whole-word",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}],["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]),ma=_e("workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]),un=_e("zap-off",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),hn=_e("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function pa(t,e){const n=+mr(t)-+mr(e);return n<0?-1:n>0?1:n}function Dj(t,e){const n=mr(t,e==null?void 0:e.in);return+function(o,r){const s=mr(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=mr(o,r==null?void 0:r.in),i=s.getMonth();return s.setFullYear(s.getFullYear(),i+1,0),s.setHours(23,59,59,999),s}(n,e)}function Rj(t,e,n){const[o,r,s]=am(n==null?void 0:n.in,t,t,e),i=pa(r,s),a=Math.abs(function(d,h,f){const[m,g]=am(f==null?void 0:f.in,d,h);return 12*(m.getFullYear()-g.getFullYear())+(m.getMonth()-g.getMonth())}(r,s));if(a<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*a);let l=pa(r,s)===-i;Dj(o)&&a===1&&pa(o,s)===1&&(l=!1);const c=i*(a-+l);return c===0?0:c}function Pj(t,e,n){const o=function(r,s){return+mr(r)-+mr(s)}(t,e)/1e3;return(r=>{const s=(0,Math.trunc)(r);return s===0?0:s})(o)}function Lj(t,e){return function(n,o,r){const s=RO(),i=(r==null?void 0:r.locale)??s.locale??PO,a=pa(n,o);if(isNaN(a))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:a}),[c,d]=am(r==null?void 0:r.in,...a>0?[o,n]:[n,o]),h=Pj(d,c),f=(f3(d)-f3(c))/1e3,m=Math.round((h-f)/60);let g;if(m<2)return m===0?i.formatDistance("lessThanXMinutes",1,l):i.formatDistance("xMinutes",m,l);if(m<45)return i.formatDistance("xMinutes",m,l);if(m<90)return i.formatDistance("aboutXHours",1,l);if(m<m3){const x=Math.round(m/60);return i.formatDistance("aboutXHours",x,l)}if(m<2520)return i.formatDistance("xDays",1,l);if(m<Yl){const x=Math.round(m/m3);return i.formatDistance("xDays",x,l)}if(m<2*Yl)return g=Math.round(m/Yl),i.formatDistance("aboutXMonths",g,l);if(g=Rj(d,c),g<12){const x=Math.round(m/Yl);return i.formatDistance("xMonths",x,l)}{const x=g%12,p=Math.trunc(g/12);return x<3?i.formatDistance("aboutXYears",p,l):x<9?i.formatDistance("overXYears",p,l):i.formatDistance("almostXYears",p+1,l)}}(t,function(n){return DO(n,Date.now())}(t),e)}const Fj=M.createContext({}),zj=M.forwardRef(function(t,e){[t,e]=BO(t,e,Fj);let{toolbarProps:n}=function(s,i){const{"aria-label":a,"aria-labelledby":l,orientation:c="horizontal"}=s;let[d,h]=M.useState(!1);LO(()=>{var p;h(!(!i.current||!(!((p=i.current.parentElement)===null||p===void 0)&&p.closest('[role="toolbar"]'))))});const{direction:f}=FO(),m=f==="rtl"&&c==="horizontal";let g=zO(i);const x=M.useRef(null);return{toolbarProps:{...p3(s,{labelable:!0}),role:d?"group":"toolbar","aria-orientation":c,"aria-label":a,"aria-labelledby":a==null?l:void 0,onKeyDownCapture:d?void 0:p=>{if(p.currentTarget.contains(p.target)){if(c==="horizontal"&&p.key==="ArrowRight"||c==="vertical"&&p.key==="ArrowDown")m?g.focusPrevious():g.focusNext();else{if(!(c==="horizontal"&&p.key==="ArrowLeft"||c==="vertical"&&p.key==="ArrowUp"))return p.key==="Tab"?(p.stopPropagation(),x.current=document.activeElement,void(p.shiftKey?g.focusFirst():g.focusLast())):void 0;m?g.focusNext():g.focusPrevious()}p.stopPropagation(),p.preventDefault()}},onFocusCapture:d?void 0:p=>{var b,y;x.current&&!p.currentTarget.contains(p.relatedTarget)&&(!((b=i.current)===null||b===void 0)&&b.contains(p.target))&&((y=x.current)===null||y===void 0||y.focus(),x.current=null)},onBlurCapture:d?void 0:p=>{p.currentTarget.contains(p.relatedTarget)||x.current||(x.current=p.target)}}}}(t,e),o=UO({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=p3(t,{global:!0});return delete r.id,q.createElement("div",{...lm(r,o,n),ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)}),ga="https://static.marimo.app",Bj=t=>{const e=H.c(25),{onClose:n}=t,[o,r]=M.useState(""),{exportAsHTML:s}=nt();let i;i=Math.random().toString(36).slice(2,6);const a=`${o}-${i}`,l=`${ga}/static/${a}`;let c,d,h,f,m,g,x,p,b,y,v;return e[0]!==s||e[1]!==n||e[2]!==a?(c=async w=>{w.preventDefault(),n();const j=await s({download:!1,includeCode:!0,files:xj.INSTANCE.filenames()}),C=Je({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${ga}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:j,path:a})}).catch(()=>{C.dismiss(),Je({title:"Error uploading static page",description:u.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",u.jsx("a",{href:Fn.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),C.dismiss(),Je({title:"Static page uploaded!",description:u.jsxs("div",{children:["The URL has been copied to your clipboard.",u.jsx("br",{}),"You can share it with anyone."]})})},e[0]=s,e[1]=n,e[2]=a,e[3]=c):c=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(Wo,{children:"Share static notebook"}),e[4]=d):d=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsxs(ls,{children:[d,u.jsxs(cs,{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"," ",u.jsx("a",{href:ga,target:"_blank",children:ga}),"."]})]}),e[5]=h):h=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(f=w=>{const j=w.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(j)},e[6]=f):f=e[6],e[7]!==o?(m=u.jsx(qo,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:f,required:!0,autoComplete:"off"}),e[7]=o,e[8]=m):m=e[8],e[9]!==l?(g=u.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:",u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Uj,{text:l}),u.jsx("span",{className:"text-primary",children:l})]})]}),e[9]=l,e[10]=g):g=e[10],e[11]!==m||e[12]!==g?(x=u.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[m,g]}),e[11]=m,e[12]=g,e[13]=x):x=e[13],e[14]!==n?(p=u.jsx(ve,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=p):p=e[15],e[16]!==l?(b=u.jsx(ve,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await sn(l)},children:"Create"}),e[16]=l,e[17]=b):b=e[17],e[18]!==b||e[19]!==p?(y=u.jsxs(Ti,{children:[p,b]}),e[18]=b,e[19]=p,e[20]=y):y=e[20],e[21]!==y||e[22]!==c||e[23]!==x?(v=u.jsx(Go,{className:"w-fit",children:u.jsxs("form",{onSubmit:c,children:[h,x,y]})}),e[21]=y,e[22]=c,e[23]=x,e[24]=v):v=e[24],v},Uj=t=>{const e=H.c(8),[n,o]=q.useState(!1);let r;e[0]!==t.text?(r=zn.stopPropagation(async c=>{c.preventDefault(),await sn(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=r):r=e[1];const s=r;let i,a,l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(Mi,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2],e[3]!==s?(a=u.jsx(ve,{"data-testid":"copy-static-notebook-url-button",onClick:s,size:"xs",variant:"secondary",children:i}),e[3]=s,e[4]=a):a=e[4],e[5]!==n||e[6]!==a?(l=u.jsx(Ee,{content:"Copied!",open:n,children:a}),e[5]=n,e[6]=a,e[7]=l):l=e[7],l};function ig(){const t=H.c(2),e=Ct(cm);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let s=null;for(const i of Array.from(o)){const a=i.getBoundingClientRect();if(a.top>=0&&a.top<=r||a.bottom>=0&&a.bottom<=r){s=Oi.parse(i.parentNode.id);break}}e(i=>({mode:$O(i.mode),cellAnchor:s})),requestAnimationFrame(()=>{var i;s!==null&&((i=document.getElementById(Oi.create(s)))==null||i.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function ud(t){const e=H.c(3),n=Is();let o;return e[0]!==t||e[1]!==n?(o=()=>{t!==void 0&&n([t])},e[0]=t,e[1]=n,e[2]=o):o=e[2],Fe(o)}function ag(){const t=H.c(2),e=Is();let n;return t[0]!==e?(n=()=>e(g3(bn())),t[0]=e,t[1]=n):n=t[1],Fe(n)}function Is(){const t=H.c(3),{prepareForRun:e}=lt(),{sendRun:n}=nt();let o;return t[0]!==e||t[1]!==n?(o=async r=>{var l,c;if(r.length===0)return;const{cellHandles:s,cellData:i}=bn(),a=[];for(const d of r){const h=s[d],f=(l=h==null?void 0:h.current)==null?void 0:l.editorView;let m;f?(x3(f)!=="markdown"&&dm(f),m=b3(f)):m=((c=i[d])==null?void 0:c.code)||"",a.push(m),e({cellId:d})}await n({cellIds:r,codes:a}).catch($j)},t[0]=e,t[1]=n,t[2]=o):o=t[2],Fe(o)}function $j(t){ut.error(t)}const hd=[{type:"files",Icon:Ep,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:Kl,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:Yo,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:ha,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:Ss,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:ld,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:Xl,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:cd,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:um,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:iF,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:Xp,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:Mp,tooltip:"Secrets",hidden:tn(),position:"sidebar"},{type:"scratchpad",Icon:HO,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:Di,tooltip:"View errors",position:"footer"}];function Vj(){const t=H.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];const[n,o]=function(i,a){const l=H.c(11);let c;l[0]!==a?(c=new WO(a),l[0]=a,l[1]=c):c=l[1];const d=c;let h;l[2]!==i||l[3]!==d?(h=()=>d.get(i),l[2]=i,l[3]=d,l[4]=h):h=l[4];const[f,m]=M.useState(h);let g;l[5]!==i||l[6]!==d?(g=b=>{m(b),d.set(i,b)},l[5]=i,l[6]=d,l[7]=g):g=l[7];const x=g;let p;return l[8]!==x||l[9]!==f?(p=[f,x],l[8]=x,l[9]=f,l[10]=p):p=l[10],p}("marimo:commands",e);let r,s;return t[1]!==n||t[2]!==o?(r=i=>{const a=(l=[i,...n],[...new Set(l)]);var l;o(a.slice(0,3))},t[1]=n,t[2]=o,t[3]=r):r=t[3],t[4]!==n||t[5]!==r?(s={recentCommands:n,addRecentCommand:r},t[4]=n,t[5]=r,t[6]=s):s=t[6],s}function lg(t){return t.dropdown!==void 0}function xa(t,e=""){return t.flatMap(n=>n.label?lg(n)?xa(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const As=t=>{const e=H.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=q.Children.toArray(n),e[0]=n,e[1]=s):s=e[1];const[i,a]=s,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let c,d;return e[2]!==a||e[3]!==l?(c=u.jsx("div",{className:l,children:a}),e[2]=a,e[3]=l,e[4]=c):c=e[4],e[5]!==i||e[6]!==c?(d=u.jsxs("div",{className:"multi-icon relative w-fit",children:[i,c]}),e[5]=i,e[6]=c,e[7]=d):d=e[7],d},Ts=jt(null),Hj=hm("marimo:ai:includeOtherCells",!0),fd=hm("marimo:ai:chatState:v3",{chats:[],activeChatId:null}),Wj=jt(t=>{const e=t(fd);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(fd,o=>({...o,activeChatId:n}))});function cg(t){return t!==w3&&!!(t&&t.trim().length>0)}const ba=t=>{const e=H.c(7);let n,o;e[0]!==t?(n=a=>{var l;(a.ctrlKey||a.metaKey)&&a.key==="z"&&(a.preventDefault(),a.stopPropagation(),(l=t.onClick)==null||l.call(t,a))},e[0]=t,e[1]=n):n=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(o={capture:!0},e[2]=o):o=e[2],Jl(window,"keydown",n,o);const r=t.children??"Undo";let s,i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx(qO,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(i=u.jsxs(ve,{"data-testid":"undo-button",size:"sm",variant:"outline",...t,children:[r," ",s]}),e[4]=r,e[5]=t,e[6]=i):i=e[6],i};function Ms(){const t=H.c(4),{deleteCell:e,undoDeleteCell:n}=lt(),{sendDeleteCell:o}=nt();let r;return t[0]!==e||t[1]!==o||t[2]!==n?(r=s=>{var c;if(Qe.get(Zl))return;const{cellId:i}=s,a=Qe.get(In),l=(((c=a.cellData[i])==null?void 0:c.code)??"").trim()==="";if(e({cellId:i}),o({cellId:i}).catch(()=>{n()}),!l){const{dismiss:d}=Je({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:u.jsx(ba,{"data-testid":"undo-delete-button",onClick:()=>{n(),h()}})}),h=d}},t[0]=e,t[1]=o,t[2]=n,t[3]=r):r=t[3],Fe(r)}function Os(){const t=H.c(4),{deleteCell:e,undoDeleteCell:n}=lt(),{sendDeleteCell:o}=nt();let r;return t[0]!==e||t[1]!==o||t[2]!==n?(r=async s=>{if(Qe.get(Zl))return;const{cellIds:i}=s;for(const c of i)await o({cellId:c}).then(()=>{e({cellId:c})});const{dismiss:a}=Je({title:"Cells deleted",action:u.jsx(ba,{"data-testid":"undo-delete-button",onClick:()=>{for(const c of i)n();l()}})}),l=a},t[0]=e,t[1]=o,t[2]=n,t[3]=r):r=t[3],Fe(r)}function dg(){const t=H.c(3),{splitCell:e,undoSplitCell:n}=lt();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=Ri(r.cellId);if(!s)return;const i=b3(s);e(r);const{dismiss:a}=Je({title:"Cell split",action:u.jsx(ba,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...r,snapshot:i}),l()},children:"Undo"})}),l=a},t[0]=e,t[1]=n,t[2]=o):o=t[2],Fe(o)}function md(t){const e=H.c(51),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:i,sendToTop:a,sendToBottom:l,addColumnBreakpoint:c,clearCellOutput:d}=lt(),h=dg(),f=ud(n==null?void 0:n.cellId),m=!Ne(Zl),g=Ms(),{openModal:x}=An(),p=Ct(Ts),b=Ne(Ql),y=Ne(ec),v=Ne(ds),w=Ne(GO),{saveCellConfig:j}=nt();if(!n||v){let U;return e[0]===Symbol.for("react.memo_cache_sentinel")?(U=[],e[0]=U):U=e[0],U}const{cellId:C,config:N,getEditorView:S,name:E,hasOutput:T,hasConsoleOutput:I,status:D}=n;let F;e[1]!==C||e[2]!==N.disabled||e[3]!==j||e[4]!==r?(F=async()=>{const U={disabled:!N.disabled};await j({configs:{[C]:U}}),r({cellId:C,config:U})},e[1]=C,e[2]=N.disabled,e[3]=j,e[4]=r,e[5]=F):F=e[5];const O=F;let R;e[6]!==C||e[7]!==N.hide_code||e[8]!==S||e[9]!==j||e[10]!==r?(R=async()=>{const U={hide_code:!N.hide_code};await j({configs:{[C]:U}}),r({cellId:C,config:U});const V=S();V&&(U.hide_code?V.contentDOM.blur():V.focus())},e[6]=C,e[7]=N.hide_code,e[8]=S,e[9]=j,e[10]=r,e[11]=R):R=e[11];const P=R;let z,_,k,B,A;return e[12]===Symbol.for("react.memo_cache_sentinel")?(z=u.jsx(ng,{size:13,strokeWidth:1.5}),e[12]=z):z=e[12],e[13]!==C||e[14]!==E||e[15]!==x||e[16]!==s?(_=()=>{x(u.jsxs(Go,{children:[u.jsx(ls,{children:u.jsx(Wo,{children:"Rename cell"})}),u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx(gr,{htmlFor:"cell-name",children:"Cell name"}),u.jsx(bj,{placeholder:"cell name",value:E,onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),U.stopPropagation(),x(null))},onChange:U=>s({cellId:C,name:U})})]})]}))},e[13]=C,e[14]=E,e[15]=x,e[16]=s,e[17]=_):_=e[17],e[18]!==C||e[19]!==s?(k=U=>s({cellId:C,name:U}),e[18]=C,e[19]=s,e[20]=k):k=e[20],e[21]!==E||e[22]!==k?(B=u.jsx(bj,{placeholder:"cell name",value:E,onChange:k}),e[21]=E,e[22]=k,e[23]=B):B=e[23],e[24]!==c||e[25]!==b||e[26]!==w||e[27]!==y||e[28]!==m||e[29]!==C||e[30]!==d||e[31]!==N.disabled||e[32]!==N.hide_code||e[33]!==o||e[34]!==g||e[35]!==S||e[36]!==I||e[37]!==T||e[38]!==i||e[39]!==E||e[40]!==f||e[41]!==l||e[42]!==a||e[43]!==p||e[44]!==h||e[45]!==D||e[46]!==_||e[47]!==B||e[48]!==O||e[49]!==P?(A=[[{icon:z,label:"Name",disableClick:!0,handle:Kj,handleHeadless:_,rightElement:B},{icon:u.jsx(Sr,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:D==="running"||D==="queued"||D==="disabled-transitively"||N.disabled,handle:()=>f()},{icon:u.jsx(Pi,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{p(U=>(U==null?void 0:U.cellId)===C?null:{cellId:C})},hotkey:"cell.aiCompletion"},{icon:u.jsx(ad,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>h({cellId:C})},{icon:u.jsx(cp,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!T,handle:()=>function(U){const V=document.getElementById(y3.create(U));V&&(V.classList.add("printing-output"),v3(V,"result.png").finally(()=>{V.classList.remove("printing-output")}))}(C)},{icon:u.jsx(C3,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const U=S();U&&k3({[C]:U})}},{icon:N.hide_code?u.jsx(fm,{size:13,strokeWidth:1.5}):u.jsx(mm,{size:13,strokeWidth:1.5}),label:N.hide_code?"Show code":"Hide code",handle:P,hotkey:"cell.hideCode"},{icon:N.disabled?u.jsx(un,{size:13,strokeWidth:1.5}):u.jsx(hn,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:u.jsx(pm,{"data-testid":"cell-disable-switch",checked:!N.disabled,size:"sm",onCheckedChange:O}),handle:O},{icon:u.jsx(Di,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(T||I),handle:()=>{d({cellId:C})}}],[{icon:u.jsx(tc,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const U=S();U&&(Jn({autoInstantiate:y,createNewCell:o}),pr(U,{language:"markdown",keepCodeAsIs:!1}))}},{icon:u.jsx(Yo,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const U=S();U&&(Jn({autoInstantiate:y,createNewCell:o}),pr(U,{language:"sql",keepCodeAsIs:!1}))}},{icon:u.jsx(nc,{}),label:"Toggle as Python",handle:()=>{const U=S();U&&(Jn({autoInstantiate:y,createNewCell:o}),YO(U,"python",{force:!0}))}}],[{icon:u.jsxs(As,{children:[u.jsx(ca,{size:13,strokeWidth:1.5}),u.jsx(oc,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:C,before:!0})},{icon:u.jsxs(As,{children:[u.jsx(ca,{size:13,strokeWidth:1.5}),u.jsx(No,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:C,before:!1})},{icon:u.jsx(oc,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>i({cellId:C,before:!0})},{icon:u.jsx(No,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>i({cellId:C,before:!1})},{icon:u.jsx(j3,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>i({cellId:C,direction:"left"}),hidden:w!=="columns"},{icon:u.jsx(Li,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>i({cellId:C,direction:"right"}),hidden:w!=="columns"},{icon:u.jsx(Jc,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>a({cellId:C,scroll:!1})},{icon:u.jsx(Xc,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:C,scroll:!1})},{icon:u.jsx(KO,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:w!=="columns",handle:()=>c({cellId:C})}],[{icon:u.jsx(hj,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!cg(E),tooltip:cg(E)?void 0:"Only named cells can be linked to",handle:async()=>{await sn(function(U){const V=new URL(window.location.href);return V.hash=`scrollTo=${encodeURIComponent(U)}`,V.toString()}(E)),Je({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!m,variant:"danger",icon:u.jsx(rc,{size:13,strokeWidth:1.5}),handle:()=>{g({cellId:C})}}]].map(Gj).filter(qj),e[24]=c,e[25]=b,e[26]=w,e[27]=y,e[28]=m,e[29]=C,e[30]=d,e[31]=N.disabled,e[32]=N.hide_code,e[33]=o,e[34]=g,e[35]=S,e[36]=I,e[37]=T,e[38]=i,e[39]=E,e[40]=f,e[41]=l,e[42]=a,e[43]=p,e[44]=h,e[45]=D,e[46]=_,e[47]=B,e[48]=O,e[49]=P,e[50]=A):A=e[50],A}function qj(t){return t.length>0}function Gj(t){return t.filter(Yj)}function Yj(t){return!t.hidden}function Kj(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function Xj(t){return!t.hidden}const pd=jt(!1),ug=()=>{const t=H.c(37),[e,n]=zt(pd),o=XO(),r=Ne(JO),s=Ne(Fi);let i;t[0]!==r?(i={cell:r},t[0]=r,t[1]=i):i=t[1];let a=md(i).flat();a=xa(a);const l=function(){const _=H.c(75),[k,B]=xr(),[A,U]=S3(),{saveAppConfig:V,saveUserConfig:X}=nt();let Y;_[0]!==X||_[1]!==B?(Y=async oe=>{await X({config:oe}).then(()=>{B(oe)})},_[0]=X,_[1]=B,_[2]=Y):Y=_[2];const G=Y;let W;_[3]!==V||_[4]!==U?(W=async oe=>{await V({config:oe}).then(()=>{U(oe)})},_[3]=V,_[4]=U,_[5]=W):W=_[5];const J=W;let $;if(_[6]!==A||_[7]!==k||_[8]!==J||_[9]!==G){let oe,ne,ie,se,ae;_[11]!==A?(oe=He=>He!==A.width,_[11]=A,_[12]=oe):oe=_[12],_[13]!==A||_[14]!==J?(ne=He=>({label:`App config > Set width=${He}`,handle:()=>{J({...A,width:He})}}),_[13]=A,_[14]=J,_[15]=ne):ne=_[15],_[16]!==k||_[17]!==G?(ie={label:"Config > Set theme: dark",handle:()=>{G({...k,display:{...k.display,theme:"dark"}})}},_[16]=k,_[17]=G,_[18]=ie):ie=_[18],_[19]!==k||_[20]!==G?(se={label:"Config > Set theme: light",handle:()=>{G({...k,display:{...k.display,theme:"light"}})}},_[19]=k,_[20]=G,_[21]=se):se=_[21],_[22]!==k||_[23]!==G?(ae={label:"Config > Set theme: system",handle:()=>{G({...k,display:{...k.display,theme:"system"}})}},_[22]=k,_[23]=G,_[24]=ae):ae=_[24];const fe=k.keymap.preset==="vim";let re,ue;_[25]!==k||_[26]!==G?(re=()=>{G({...k,keymap:{...k.keymap,preset:"vim"}})},_[25]=k,_[26]=G,_[27]=re):re=_[27],_[28]!==fe||_[29]!==re?(ue={label:"Config > Switch keymap to VIM",hidden:fe,handle:re},_[28]=fe,_[29]=re,_[30]=ue):ue=_[30];const le=k.keymap.preset==="default";let je,Se,Le;_[31]!==k||_[32]!==G?(je=()=>{G({...k,keymap:{...k.keymap,preset:"default"}})},_[31]=k,_[32]=G,_[33]=je):je=_[33],_[34]!==le||_[35]!==je?(Se={label:"Config > Switch keymap to default (current: VIM)",hidden:le,handle:je},_[34]=le,_[35]=je,_[36]=Se):Se=_[36],_[37]!==k||_[38]!==G?(Le=()=>{G({...k,completion:{...k.completion,copilot:!1}})},_[37]=k,_[38]=G,_[39]=Le):Le=_[39];const Ie=k.completion.copilot!=="github";let ke,Ye;_[40]!==Le||_[41]!==Ie?(ke={label:"Config > Disable GitHub Copilot",handle:Le,hidden:Ie},_[40]=Le,_[41]=Ie,_[42]=ke):ke=_[42],_[43]!==k||_[44]!==G?(Ye=()=>{G({...k,completion:{...k.completion,copilot:"github"}})},_[43]=k,_[44]=G,_[45]=Ye):Ye=_[45];const Ve=k.completion.copilot==="github";let Ke;_[46]!==Ye||_[47]!==Ve?(Ke={label:"Config > Enable GitHub Copilot",handle:Ye,hidden:Ve},_[46]=Ye,_[47]=Ve,_[48]=Ke):Ke=_[48];const ee=!k.display.reference_highlighting;let ye,we,Ae,K;_[49]!==k||_[50]!==G?(ye=()=>{G({...k,display:{...k.display,reference_highlighting:!1}})},_[49]=k,_[50]=G,_[51]=ye):ye=_[51],_[52]!==ee||_[53]!==ye?(we={label:"Config > Disable reference highlighting",hidden:ee,handle:ye},_[52]=ee,_[53]=ye,_[54]=we):we=_[54],_[55]!==k||_[56]!==G?(Ae=()=>{G({...k,display:{...k.display,reference_highlighting:!0}})},_[55]=k,_[56]=G,_[57]=Ae):Ae=_[57],_[58]!==k.display.reference_highlighting||_[59]!==Ae?(K={label:"Config > Enable reference highlighting",hidden:k.display.reference_highlighting,handle:Ae},_[58]=k.display.reference_highlighting,_[59]=Ae,_[60]=K):K=_[60];const pe=k.display.cell_output==="above";let ge,he;_[61]!==k||_[62]!==G?(ge=()=>{G({...k,display:{...k.display,cell_output:"above"}})},_[61]=k,_[62]=G,_[63]=ge):ge=_[63],_[64]!==pe||_[65]!==ge?(he={label:"Config > Set cell output area: above",hidden:pe,handle:ge},_[64]=pe,_[65]=ge,_[66]=he):he=_[66];const Ce=k.display.cell_output==="below";let Re,Pe;_[67]!==k||_[68]!==G?(Re=()=>{G({...k,display:{...k.display,cell_output:"below"}})},_[67]=k,_[68]=G,_[69]=Re):Re=_[69],_[70]!==Ce||_[71]!==Re?(Pe={label:"Config > Set cell output area: below",hidden:Ce,handle:Re},_[70]=Ce,_[71]=Re,_[72]=Pe):Pe=_[72],$=[...aF().filter(oe).map(ne),ie,se,ae,ue,Se,ke,Ke,we,K,he,Pe],_[6]=A,_[7]=k,_[8]=J,_[9]=G,_[10]=$}else $=_[10];const Q=$;let te;return _[73]!==Q?(te=Q.filter(Xj),_[73]=Q,_[74]=te):te=_[74],te}();let c=Ug();c=[...xa(c),...xa(l)];const d=c.filter(Jj),h=sc.keyBy(d,Zj),{recentCommands:f,addRecentCommand:m}=Vj();let g;t[2]!==f?(g=new Set(f),t[2]=f,t[3]=g):g=t[3];const x=g;let p,b;t[4]!==s||t[5]!==n?(p=_=>{ic(s.getHotkey("global.commandPalette").key)(_)&&(_.preventDefault(),n(Qj))},t[4]=s,t[5]=n,t[6]=p):p=t[6],Jl(document,"keydown",p),t[7]!==m||t[8]!==s||t[9]!==o||t[10]!==n?(b=(_,k)=>{const B=o[_];if(!B)return null;const A=s.getHotkey(_);return u.jsxs(Zn,{disabled:k.disabled,onSelect:()=>{m(_),n(!1),requestAnimationFrame(()=>{B()})},value:A.name,children:[u.jsxs("span",{children:[A.name,k.tooltip&&u.jsx("span",{className:"ml-2",children:k.tooltip})]}),u.jsx(E3,{children:u.jsx(bm,{shortcut:A.key})})]},_)},t[7]=m,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const y=b;let v;t[12]!==m||t[13]!==s||t[14]!==n?(v=_=>{const{label:k,handle:B,props:A,hotkey:U}=_,V=A===void 0?{}:A;return u.jsxs(Zn,{disabled:V.disabled,onSelect:()=>{m(k),n(!1),requestAnimationFrame(()=>{B()})},value:k,children:[u.jsxs("span",{children:[k,V.tooltip&&u.jsxs("span",{className:"ml-2",children:["(",V.tooltip,")"]})]}),U&&u.jsx(E3,{children:u.jsx(bm,{shortcut:s.getHotkey(U).key})})]},k)},t[12]=m,t[13]=s,t[14]=n,t[15]=v):v=t[15];const w=v,j=QO;let C;t[16]===Symbol.for("react.memo_cache_sentinel")?(C=u.jsx(zi,{placeholder:"Type to search..."}),t[16]=C):C=t[16];const N=xm;let S;t[17]===Symbol.for("react.memo_cache_sentinel")?(S=u.jsx(ac,{children:"No results found."}),t[17]=S):S=t[17];const E=f.length>0&&u.jsxs(u.Fragment,{children:[u.jsx(gm,{heading:"Recently Used",children:f.map(_=>{const k=h[_];return ZO(_)?y(_,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip}):k&&!lg(k)?w({label:k.label,handle:k.handleHeadless||k.handle,props:{disabled:k.disabled,tooltip:k.tooltip}}):null})}),u.jsx(N3,{})]}),T=gm,I=s.iterate().map(_=>{if(x.has(_))return null;const k=h[_];return y(_,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip})}),D=d.map(_=>x.has(_.label)?null:w({label:_.label,handle:_.handleHeadless||_.handle,props:{disabled:_.disabled,tooltip:_.tooltip}}));let F;t[18]!==x||t[19]!==w?(F=_=>x.has(_.label)?null:w({label:`Cell > ${_.label}`,handle:_.handleHeadless||_.handle,props:{disabled:_.disabled,tooltip:_.tooltip}}),t[18]=x,t[19]=w,t[20]=F):F=t[20];const O=a.map(F);let R,P,z;return t[21]!==T||t[22]!==D||t[23]!==O||t[24]!==I?(R=u.jsxs(T,{heading:"Commands",children:[I,D,O]}),t[21]=T,t[22]=D,t[23]=O,t[24]=I,t[25]=R):R=t[25],t[26]!==N||t[27]!==R||t[28]!==S||t[29]!==E?(P=u.jsxs(N,{children:[S,E,R]}),t[26]=N,t[27]=R,t[28]=S,t[29]=E,t[30]=P):P=t[30],t[31]!==j||t[32]!==e||t[33]!==n||t[34]!==P||t[35]!==C?(z=u.jsxs(j,{open:e,onOpenChange:n,children:[C,P]}),t[31]=j,t[32]=e,t[33]=n,t[34]=P,t[35]=C,t[36]=z):z=t[36],z};function Jj(t){return!t.hotkey}function Zj(t){return t.label}function Qj(t){return!t}function er(){return at().optional().describe(ze.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function hg(){return at().optional().describe(ze.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function ya(){return at().optional().describe(ze.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function fg(){return at().optional().describe(ze.of({label:"URI",optionRegex:".*uri.*"}))}function tr(){return at().nonempty().describe(ze.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function to(){return at().describe(ze.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function nr(){return at().nonempty().describe(ze.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function or(t){const e=eD.string().describe(ze.of({label:"Port",inputType:"number",placeholder:t==null?void 0:t.toString()})).transform(Number).refine(n=>n>=0&&n<=65535,{message:"Port must be between 0 and 65535"});return t!==void 0?e.default(t.toString()):e}function mg(){return us().default(!1).describe(ze.of({label:"Read Only"}))}const pg=ft({type:gt("postgres"),host:tr(),port:or(5432).optional(),database:to(),username:nr(),password:er(),ssl:us().default(!1).describe(ze.of({label:"Use SSL"}))}).describe(ze.of({direction:"two-columns"})),gg=ft({type:gt("mysql"),host:tr(),port:or(3306),database:to(),username:nr(),password:er(),ssl:us().default(!1).describe(ze.of({label:"Use SSL"}))}).describe(ze.of({direction:"two-columns"})),xg=ft({type:gt("sqlite"),database:to().describe(ze.of({label:"Database Path"}))}).describe(ze.of({direction:"two-columns"})),bg=ft({type:gt("duckdb"),database:to().describe(ze.of({label:"Database Path"})),read_only:mg()}).describe(ze.of({direction:"two-columns"})),yg=ft({type:gt("motherduck"),database:to().default("my_db").describe(ze.of({label:"Database Name"})),token:hg()}).describe(ze.of({direction:"two-columns"})),vg=ft({type:gt("snowflake"),account:at().nonempty().describe(ze.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:at().optional().describe(ze.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:to(),schema:at().optional().describe(ze.of({label:"Schema",optionRegex:".*snowflake.*"})),username:nr(),password:er(),role:at().optional().describe(ze.of({label:"Role"}))}).describe(ze.of({direction:"two-columns"})),wg=ft({type:gt("bigquery"),project:at().nonempty().describe(ze.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:at().nonempty().describe(ze.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:at().describe(ze.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(ze.of({direction:"two-columns"})),kg=ft({type:gt("clickhouse_connect"),host:tr(),port:or(8123).optional(),username:nr(),password:er(),secure:us().default(!1).describe(ze.of({label:"Use HTTPs"}))}).describe(ze.of({direction:"two-columns"})),Cg=ft({type:gt("timeplus"),host:tr().default("localhost"),port:or(8123).optional(),username:nr().default("default"),password:er().default("")}).describe(ze.of({direction:"two-columns"})),jg=ft({type:gt("chdb"),database:to().describe(ze.of({label:"Database Path"})),read_only:mg()}).describe(ze.of({direction:"two-columns"})),Sg=ft({type:gt("trino"),host:tr(),port:or(8080),database:to(),schema:at().describe(ze.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:nr(),password:er(),async_support:us().default(!1).describe(ze.of({label:"Async Support"}))}).describe(ze.of({direction:"two-columns"})),Ng=ft({type:gt("iceberg"),name:at().describe(ze.of({label:"Catalog Name"})),catalog:ym("type",[ft({type:gt("REST"),warehouse:ya(),uri:at().optional().describe(ze.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:hg()}),ft({type:gt("SQL"),warehouse:ya(),uri:at().optional().describe(ze.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),ft({type:gt("Hive"),warehouse:ya(),uri:fg()}),ft({type:gt("Glue"),warehouse:ya(),uri:fg()}),ft({type:gt("DynamoDB"),"dynamodb.profile-name":at().optional().describe(ze.of({label:"Profile Name"})),"dynamodb.region":at().optional().describe(ze.of({label:"Region"})),"dynamodb.access-key-id":at().optional().describe(ze.of({label:"Access Key ID"})),"dynamodb.secret-access-key":at().optional().describe(ze.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":at().optional().describe(ze.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(ze.of({special:"tabs"}))}),Eg=ft({type:gt("datafusion"),sessionContext:us().optional().describe(ze.of({label:"Use Session Context"}))}),_g=ft({type:gt("pyspark"),host:tr().optional(),port:or().optional()}),Ig=ft({type:gt("redshift"),host:tr(),port:or(5439),connectionType:ym("type",[ft({type:gt("IAM credentials"),region:at().describe(ze.of({label:"Region"})),aws_access_key_id:at().nonempty().describe(ze.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:at().nonempty().describe(ze.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:at().optional().describe(ze.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),ft({type:gt("DB credentials"),user:nr(),password:er()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:to()}).describe(ze.of({direction:"two-columns"})),eS=ym("type",[pg,gg,xg,bg,yg,vg,wg,kg,Cg,jg,Sg,Ng,Eg,_g,Ig]),gd="env:";function va(t){return typeof t=="string"&&t.startsWith(gd)}function xd(t){return`${gd}${t}`}const Ag={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class Yt{constructor(e,n,o){this.connection=void 0,this.orm=void 0,this.secrets=void 0,this.connection=e,this.orm=n,this.secrets=o}get imports(){const e=new Set(this.generateImports());switch(this.orm){case"sqlalchemy":e.add("import sqlalchemy");break;case"sqlmodel":e.add("import sqlmodel");break;case"duckdb":e.add("import duckdb")}return e}}class tS{constructor(){this.secrets={}}get imports(){return Object.keys(this.secrets).length===0?new Set:new Set(["import os"])}print(e,n,o){if(e=(r=>`_${r}`)(e),va(n)){const r=n.replace(gd,""),s=o?`os.environ.get("${r}", "${o}")`:`os.environ.get("${r}")`;return this.secrets[e]=s,e}if(o!=null){const r=`os.environ.get("${n}", "${o}")`;return this.secrets[e]=r,e}return typeof n=="number"||typeof n=="number"?`${n}`:typeof n=="boolean"?Er(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return Er(n);const r=this.print(e,n,o);return r.startsWith('"')&&r.endsWith('"')?r.slice(1,-1):`{${r}}`}printPassword(e,n,o){const r=o?this.printInFString.bind(this):this.print.bind(this);return va(e)?r("password",e):r("password",n,e)}getSecrets(){return this.secrets}formatSecrets(){return Object.keys(this.secrets).length===0?"":Object.entries(this.secrets).map(([e,n])=>`${e} = ${n}`).join(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-CRxB69vv.js","./index-WZpn7zIz.js","./index-BRPMSgmu.css","./compile-D-SKgFzl.js","./time-OI-T4MiC.js","./timer-BwIYMJWC.js","./linear-DM7ygpKu.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./zoom-COrs4lFh.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./step-BwsUM5iJ.js","./arc-ZB5pDULS.js","./index-BEQfoZiP.js","./storage-B47VVzw1.js","./index-BzZRHBMs.js","./index-BMCpi_hV.js","./index-DWJwqJmD.js","./index-DNVhZM1y.js","./index-Cni7Zj6s.js","./index-CJRYE40I.js","./index-BlHS2xQv.js","./index-CQ7rf4K7.js","./index-DmunXcbP.js","./index-B3l0i9L2.js","./index-CswmrBaY.js","./index-CrltF-5r.js","./index-CEoUSuyW.js","./apl-CXdQSnD-.js","./asciiarmor-D5V0T9Cu.js","./asterisk-B46aRdXb.js","./brainfuck-CtZaYBKt.js","./clike-BgBwzOhw.js","./cmake-DXn5xaP-.js","./cobol-stawOqaz.js","./coffeescript-BTDxI-eT.js","./commonlisp-vq6DHwts.js","./crystal-CRzZ78HM.js","./cypher-gJDei3ni.js","./d-BShv7fp-.js","./diff-UJJ5BM9S.js","./dockerfile-knGOOxt4.js","./simple-mode-C3vEBAcb.js","./dtd-DI9Herc-.js","./dylan-DkEP81N9.js","./ebnf-B-Df8AvO.js","./ecl-DPFc0Uaf.js","./eiffel-DR5c0IrL.js","./elm-DompmV0j.js","./erlang-BuqgqA5h.js","./factor-CFXhaUWb.js","./fcl-CVaBTCzQ.js","./forth-POgR1ypr.js","./fortran-DL7KluxX.js","./gas-bV0CklSb.js","./gherkin-B6X1vGSW.js","./groovy-DnIzCrpZ.js","./haskell-CLQs6EAM.js","./haxe-D25e-2l-.js","./http-BKJkqRj4.js","./idl-pcmmZuaN.js","./jinja2-DhgKlfW7.js","./julia-DjdwvFuI.js","./livescript-HO6ttBFx.js","./lua-8DXOpKDz.js","./mathematica-IIbmv7SK.js","./mbox-z_N2Mo3d.js","./mirc-DkvFAiy5.js","./modelica-DSrSSXCg.js","./mscgen-B2igx18G.js","./mumps-zvxmGV4l.js","./nginx-B4hAVlXN.js","./nsis-BvKfQ9lQ.js","./ntriples-BSwWqoLa.js","./octave-C4hdQ5Hf.js","./oz-qQq7irPq.js","./pascal-CafrKXZF.js","./perl-tdMlh9QA.js","./pig-CwGJVRC4.js","./powershell-D1ly3AHC.js","./properties-_nPj978X.js","./protobuf-B4y9do6W.js","./puppet-Bc-yJKzi.js","./q-B0kTJ4cI.js","./r-BA4EbLKE.js","./ruby-CR-u2WLS.js","./sas-Bqaci40L.js","./scheme-qjP0V5Ag.js","./shell-BLav31RL.js","./sieve-r025o_jW.js","./smalltalk-C7J3IyEP.js","./solr-78MBEUkU.js","./sparql-BRLJFz69.js","./spreadsheet-CGlWr0eM.js","./stylus-Bdo_Aemu.js","./swift-B_XXVlXX.js","./tcl-B2fODqDH.js","./textile-BuVhTOzU.js","./tiddlywiki-BgR6AEZu.js","./tiki-CI-ztowC.js","./toml-wcPdHu67.js","./troff-Ce85hlLp.js","./ttcn-BxnYHtq8.js","./turtle-BkSuIpt-.js","./vb-BHgjm0DN.js","./vbscript-Dawdd5GZ.js","./velocity-BdD_26Jv.js","./verilog-B4LBqg_1.js","./vhdl-CWWH2SUo.js","./webidl-CGwyPRYs.js","./xquery-CVDBqZPY.js","./yacas-I8QjZlxf.js","./z80-D8p3gKXp.js","./trash-DM7Eop-E.js","./storage-B6yZpgAI.css","./links-BJFGdYRd.js","./index-BA1eBtgJ.js","./links-Dn1Stwqz.css","./circle-play-Xdbicaqg.js","./_createAggregator-Di1sij95.js","./_baseEach-4LREA2xJ.js","./loro_wasm_bg-C3hKWL9L.js","./transform-B8bpuzxV.js","./sortBy-Dv7jjKnm.js","./_baseMap-C6LNFWWn.js","./terminal-2p_4lGQJ.js","./terminal-B3isKKSk.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var TO=Object.defineProperty;var d3=Mt=>{throw TypeError(Mt)};var MO=(Mt,wt,nn)=>wt in Mt?TO(Mt,wt,{enumerable:!0,configurable:!0,writable:!0,value:nn}):Mt[wt]=nn;var Z=(Mt,wt,nn)=>MO(Mt,typeof wt!="symbol"?wt+"":wt,nn),OO=(Mt,wt,nn)=>wt.has(Mt)||d3("Cannot "+nn);var u3=(Mt,wt,nn)=>(OO(Mt,wt,"read from private field"),nn?nn.call(Mt):wt.get(Mt)),h3=(Mt,wt,nn)=>wt.has(Mt)?d3("Cannot add the same private member more than once"):wt instanceof WeakSet?wt.add(Mt):wt.set(Mt,nn);import{c as _e,iG as mr,iH as DO,iI as am,iJ as RO,iK as PO,iL as f3,iM as m3,iN as Yl,U as M,iO as LO,iP as FO,dM as p3,iQ as zO,dI as BO,dL as UO,b as q,dG as lm,a as H,T as nt,ac as Je,j as u,a1 as Fn,a9 as Wo,a8 as ls,aa as cs,bo as qo,a6 as ve,ab as sn,iR as Ti,a7 as Go,aT as zn,ad as Mi,at as Ee,ao as Ct,d_ as cm,eO as Oi,iS as $O,aO as Fe,S as lt,iT as VO,f0 as bn,iU as g3,iV as x3,iW as dm,iX as b3,L as ut,dy as Kl,aY as Yo,iY as Xl,a_ as um,ag as tn,iZ as HO,aw as Di,i_ as WO,i$ as y3,e$ as v3,al as jt,b5 as hm,j0 as w3,cB as Jl,j1 as qO,dR as Qe,j2 as Zl,dY as In,j3 as Ri,V as Ne,ba as An,j4 as Ql,j5 as ec,eR as ds,j6 as GO,j7 as Pi,j8 as k3,eZ as C3,j9 as fm,ja as mm,er as pm,jb as Jn,jc as pr,aW as tc,jd as YO,je as nc,jf as oc,au as No,ef as j3,av as Li,jg as KO,jh as rc,bq as gr,eS as xr,fv as S3,be as zt,ji as XO,jj as JO,g2 as Fi,aQ as sc,jk as gm,jl as ZO,jm as N3,jn as xm,jo as QO,jp as ic,jq as Zn,jr as E3,g4 as bm,js as zi,jt as ac,ew as ft,ey as us,ju as gt,jv as ze,jw as at,jx as ym,jy as eD,jz as vm,jA as xt,jB as _3,ds as lc,dn as cc,dp as wm,dq as dc,dm as uc,fI as km,b4 as Bn,aK as Tn,fy as I3,fA as A3,fB as tD,fG as nD,fC as T3,jC as M3,ar as xe,eq as oD,b2 as Eo,b0 as _o,b3 as Io,a$ as At,e_ as an,jD as O3,fE as D3,jE as rD,jF as sD,fw as R3,fx as P3,jG as hs,dr as Cm,jH as L3,gs as iD,jI as aD,a5 as lD,a4 as cD,jJ as jm,dv as F3,dx as Sm,fj as hc,jK as fc,jL as mc,bt as yn,eV as Bi,fg as ln,bj as z3,d$ as Bt,el as dD,a2 as Nm,jM as Ui,jN as pc,jO as uD,jP as hD,jQ as B3,a3 as fD,ae as $i,eL as U3,jR as Gt,aX as mD,af as Em,g7 as $3,es as gc,jS as pD,gN as _m,bi as xc,bl as gD,jT as xD,jU as V3,gX as bD,gV as yD,gY as vD,gZ as wD,jV as Im,dt as Un,jW as kD,jX as bc,jY as fs,q as Qn,o as We,fO as $n,jZ as vn,j_ as ot,j$ as ms,k0 as Tt,g3 as Dt,k1 as Am,ev as wn,k2 as CD,k3 as Tm,bg as H3,bh as W3,k4 as jD,gQ as ps,k5 as yc,bd as vc,gR as br,f1 as Mm,k6 as SD,k7 as q3,k8 as Vi,k9 as G3,ka as Om,kb as Y3,kc as K3,kd as X3,ke as J3,f2 as Dm,kf as ND,kg as eo,kh as wc,ki as Z3,du as Q3,kj as kc,gM as Rm,kk as Cc,kl as Hi,km as Wi,kn as jc,ko as Ko,kp as eC,kq as Ao,kr as gs,ks as Pm,kt as qi,ku as xs,kv as Lm,kw as Fm,kx as tC,ky as Sc,kz as ED,ay as Gi,kA as Yi,kB as _D,dX as Nc,kC as ID,kD as zm,kE as AD,kF as TD,kG as Ec,e4 as MD,kH as yr,kI as _c,fN as Mn,kJ as bs,fY as To,gh as nC,cm as oC,kK as Bm,fH as rC,eK as sC,kL as iC,kM as Ic,kN as aC,kO as Ac,kP as Um,kQ as ys,kR as Ki,kS as Xi,kT as OD,ge as Tc,kU as $m,kV as Mc,ek as DD,gf as RD,kW as PD,kX as LD,kY as FD,kZ as zD,u as BD,k_ as UD,k$ as $D,l0 as VD,fR as HD,l1 as WD,l2 as lC,t as L,l3 as qD,l4 as GD,l5 as YD,l6 as KD,l7 as XD,l8 as JD,l9 as ZD,la as QD,lb as eR,lc as tR,ld as nR,le as oR,lf as rR,lg as sR,lh as iR,li as aR,lj as lR,lk as cR,ll as dR,lm as uR,ln as hR,lo as fR,lp as Ji,lq as mR,lr as pR,ls as gR,lt as xR,lu as bR,lv as yR,lw as vR,lx as wR,ly as Vm,lz as Oc,lA as cC,lB as kR,lC as CR,lD as dC,lE as jR,lF as vs,lG as On,lH as SR,lI as NR,lJ as ER,lK as _R,lL as IR,lM as AR,lN as TR,lO as MR,lP as OR,lQ as DR,lR as Xo,lS as RR,lT as PR,lU as LR,lV as FR,e1 as zR,lW as BR,lX as uC,e5 as UR,lY as Dc,lZ as $R,l_ as VR,l$ as HR,m0 as WR,g_ as Jo,m1 as Rc,m2 as qR,m3 as GR,m4 as hC,m5 as Hm,gP as ws,m6 as YR,m7 as KR,m8 as XR,m9 as Zi,ma as Qi,eY as Wm,mb as JR,fW as ZR,bn as QR,an as qm,mc as fC,md as eP,me as tP,mf as Gm,mg as Ym,mh as nP,mi as mC,mj as pC,mk as Pc,fM as oP,Y as gC,dP as rP,ml as xC,ft as vt,mm as ea,mn as ks,mo as sP,mp as iP,mq as aP,mr as lP,cl as Km,ms as cP,am as vr,mt as Lc,mu as dP,mv as bC,dN as Fc,mw as uP,bp as yC,bf as vC,mx as hP,my as fP,mz as mP,ex as pP,mA as wC,mB as kC,mC as CC,mD as gP,mE as jC,mF as SC,mG as ta,mH as xP,mI as NC,mJ as bP,mK as yP,mL as EC,Z as zc,mM as vP,br as _C,mN as wP,as as Mo,mO as kP,mP as na,mQ as CP,mR as IC,eX as AC,fK as Bc,mS as Xm,aV as Jm,ep as Uc,eo as Zm,mT as jP,eU as TC,mU as SP,mV as MC,fs as NP,mW as EP,gJ as _P,fz as IP,fD as Qm,gK as AP,bm as oa,mX as OC,mY as ep,mZ as TP,m_ as MP,m$ as OP,_ as kn,et as DP,n0 as RP,n1 as PP,n2 as DC,fl as tp,dA as RC,n3 as LP,aq as wr,n4 as FP,n5 as zP,n6 as BP,aP as UP,n7 as $P,n8 as VP,n9 as HP,W as WP,na as $c,fh as qP,nb as PC,gt as LC,fX as GP,gm as YP,nc as KP,nd as FC,ne as XP,nf as Cs,ng as JP,nh as Vc,ni as ZP,nj as QP,nk as eL,z as zC,gT as tL,nl as ra,gx as BC,gy as UC,gz as $C,gr as VC,nm as nL,C as HC,nn as oL,no as rL,gv as sL,np as iL,nq as aL,E as kr,f7 as WC,bc as lL,b9 as cL,nr as dL,ns as uL,nt as hL,dD as qC,nu as np,nv as fL,dZ as GC,nw as mL,nx as op,ny as pL,nz as gL,nA as xL,nB as YC,nC as bL,nD as KC,nE as XC,ff as JC,nF as yL,nG as vL,nH as ZC,nI as QC,nJ as Hc,nK as ej,nL as tj,nM as nj,nN as wL,nO as kL,nP as oj,nQ as CL,nR as jL,nS as SL,nT as NL,nU as EL,nV as _L,dW as IL,nW as AL,nX as TL,nY as ML,nZ as OL,n_ as DL,n$ as RL,o0 as PL,o1 as LL,o2 as FL,o3 as zL,o4 as BL,gj as UL,o5 as $L,o6 as VL,o7 as rj,o8 as HL,ax as WL,o9 as qL,ap as GL,eN as YL,oa as KL,gD as rp,gB as js,gE as Cr,gC as jr,gF as sp,gG as ip,ob as sj,oc as ij,od as aj,oe as Zo,gu as XL,of as JL,og as ZL,oh as QL,oi as eF,oj as tF,ok as lj,eC as nF,ol as ap,om as oF,ah as Wc,on as cj,oo as dj,aj as uj,ai as rF,dV as sF,__tla as iF}from"./index-WZpn7zIz.js";import{b as Ss,A as aF,L as hj,g as lF,G as cF,o as fj,s as dF,k as uF,B as mj,a as hF,M as fF,Y as mF,c as cn,u as sa,C as pF,S as gF,K as xF,d as bF,i as yF,e as pj,f as vF,h as wF,j as ia,P as aa,l as gj,m as kF,n as CF,p as jF,D as Ns,q as SF,r as lp,T as NF}from"./links-BJFGdYRd.js";import{V as xj,d as Sr,I as cp,N as bj,S as yj,e as vj,f as wj,L as kj,g as Cj,F as jj,M as EF,l as Sj,h as _F,E as qc,i as IF,j as dp,k as up,n as AF,o as TF,p as MF,q as OF,s as DF,t as RF,v as PF,w as LF,u as FF,C as zF,R as Nj,A as BF,a as UF,T as $F,x as VF,y as HF,m as WF,z as qF,B as GF,O as YF,c as KF,P as XF,__tla as JF}from"./storage-B47VVzw1.js";import{c as ZF}from"./_createAggregator-Di1sij95.js";import{_ as Ej,a as _j,i as QF,w as ez,L as Ij,A as tz,C as Aj,b as hp,c as Tj,__tla as nz}from"./loro_wasm_bg-C3hKWL9L.js";import{s as Vn,i as Qo,T as fp,a as mp}from"./transform-B8bpuzxV.js";import{g as Mj}from"./timer-BwIYMJWC.js";import{i as oz}from"./zoom-COrs4lFh.js";import{s as la}from"./sortBy-Dv7jjKnm.js";let pp,Gc,dn,Yc,Oj,Es,rz=Promise.all([(()=>{try{return iF}catch{}})(),(()=>{try{return JF}catch{}})(),(()=>{try{return nz}catch{}})()]).then(async()=>{var Gl,a3;var Mt=ZF(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let wt,nn,gp,Kc,_s,Nr,Xc,Jc,xp,bp,ca,Zc,yp,da,vp,Qc,wp,kp,ed,Cp,jp,Sp,ua,Np,td,Ep,_p,Ip,Ap,Tp,Mp,nd,Op,od,rd,Dp,Rp,Pp,Lp,Fp,zp,ha,Bp,Up,sd,$p,Vp,Hp,id,Wp,qp,Gp,fa,ad,ld,Yp,Kp,Xp,Jp,Zp,Qp,eg,tg,ng,cd,dd,og,rg,sg,ma,un,hn;wt=_e("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),nn=_e("arrow-right-to-line",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]),gp=_e("arrow-right-from-line",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M21 12H7",key:"13ipq5"}],["path",{d:"m15 18 6-6-6-6",key:"6tx3qv"}]]),Kc=_e("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),_s=_e("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),Nr=_e("between-horizontal-start",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]),Xc=_e("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),Jc=_e("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Yc=_e("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),xp=_e("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),bp=_e("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),ca=_e("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Zc=_e("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"}]]),yp=_e("clipboard-paste",[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]),da=_e("cloud-download",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]]),vp=_e("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),Qc=_e("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"}]]),wp=_e("copy-minus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),kp=_e("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"}]]),ed=_e("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),Cp=_e("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"}]]),jp=_e("fast-forward",[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]]),Sp=_e("file-pen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]),ua=_e("file-plus-2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]),Np=_e("files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]),td=_e("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),Ep=_e("folder-tree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]),_p=_e("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),Ip=_e("hard-drive-download",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]),Ap=_e("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"}]]),Tp=_e("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]),Mp=_e("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]),nd=_e("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]),Op=_e("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"}]]),od=_e("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"}]]),rd=_e("list-tree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]),Dp=_e("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]),Rp=_e("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]),Pp=_e("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]),Lp=_e("memory-stick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]),Fp=_e("message-circle-question-mark",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),zp=_e("microchip",[["path",{d:"M18 12h2",key:"quuxs7"}],["path",{d:"M18 16h2",key:"zsn3lv"}],["path",{d:"M18 20h2",key:"9x5y9y"}],["path",{d:"M18 4h2",key:"1luxfb"}],["path",{d:"M18 8h2",key:"nxqzg"}],["path",{d:"M4 12h2",key:"1ltxp0"}],["path",{d:"M4 16h2",key:"8a5zha"}],["path",{d:"M4 20h2",key:"27dk57"}],["path",{d:"M4 4h2",key:"10groj"}],["path",{d:"M4 8h2",key:"18vq6w"}],["path",{d:"M8 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-1.5c-.276 0-.494.227-.562.495a2 2 0 0 1-3.876 0C9.994 2.227 9.776 2 9.5 2z",key:"1681fp"}]]),ha=_e("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),Bp=_e("octagon-alert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]),Up=_e("package-check",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),sd=_e("package-x",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["path",{d:"m17 13 5 5m-5 0 5-5",key:"im3w4b"}]]),$p=_e("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Vp=_e("party-popper",[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]]),Hp=_e("pen-line",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]),id=_e("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"}]]),Wp=_e("regex",[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]]),qp=_e("rotate-ccw",[["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"}]]),Gp=_e("rows-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]),fa=_e("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),ad=_e("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]),ld=_e("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),Yp=_e("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"}]]),Kp=_e("square-code",[["path",{d:"m10 9-3 3 3 3",key:"1oro0q"}],["path",{d:"m14 15 3-3-3-3",key:"bz13h7"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Xp=_e("square-dashed-bottom-code",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}]]),Jp=_e("square-equal",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]),Zp=_e("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),Qp=_e("square-play",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 8 6 4-6 4Z",key:"f1r3lt"}]]),eg=_e("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"}]]),tg=_e("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),ng=_e("text-cursor-input",[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]]),cd=_e("text-search",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M10 12H3",key:"1ulcyk"}],["path",{d:"M10 18H3",key:"13769t"}],["circle",{cx:"17",cy:"15",r:"3",key:"1upz2a"}],["path",{d:"m21 19-1.9-1.9",key:"dwi7p8"}]]),dd=_e("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"}]]),og=_e("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),rg=_e("view",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]),sg=_e("whole-word",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}],["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]),ma=_e("workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]),un=_e("zap-off",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),hn=_e("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function pa(t,e){const n=+mr(t)-+mr(e);return n<0?-1:n>0?1:n}function Dj(t,e){const n=mr(t,e==null?void 0:e.in);return+function(o,r){const s=mr(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=mr(o,r==null?void 0:r.in),i=s.getMonth();return s.setFullYear(s.getFullYear(),i+1,0),s.setHours(23,59,59,999),s}(n,e)}function Rj(t,e,n){const[o,r,s]=am(n==null?void 0:n.in,t,t,e),i=pa(r,s),a=Math.abs(function(d,h,f){const[m,g]=am(f==null?void 0:f.in,d,h);return 12*(m.getFullYear()-g.getFullYear())+(m.getMonth()-g.getMonth())}(r,s));if(a<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*a);let l=pa(r,s)===-i;Dj(o)&&a===1&&pa(o,s)===1&&(l=!1);const c=i*(a-+l);return c===0?0:c}function Pj(t,e,n){const o=function(r,s){return+mr(r)-+mr(s)}(t,e)/1e3;return(r=>{const s=(0,Math.trunc)(r);return s===0?0:s})(o)}function Lj(t,e){return function(n,o,r){const s=RO(),i=(r==null?void 0:r.locale)??s.locale??PO,a=pa(n,o);if(isNaN(a))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:a}),[c,d]=am(r==null?void 0:r.in,...a>0?[o,n]:[n,o]),h=Pj(d,c),f=(f3(d)-f3(c))/1e3,m=Math.round((h-f)/60);let g;if(m<2)return m===0?i.formatDistance("lessThanXMinutes",1,l):i.formatDistance("xMinutes",m,l);if(m<45)return i.formatDistance("xMinutes",m,l);if(m<90)return i.formatDistance("aboutXHours",1,l);if(m<m3){const x=Math.round(m/60);return i.formatDistance("aboutXHours",x,l)}if(m<2520)return i.formatDistance("xDays",1,l);if(m<Yl){const x=Math.round(m/m3);return i.formatDistance("xDays",x,l)}if(m<2*Yl)return g=Math.round(m/Yl),i.formatDistance("aboutXMonths",g,l);if(g=Rj(d,c),g<12){const x=Math.round(m/Yl);return i.formatDistance("xMonths",x,l)}{const x=g%12,p=Math.trunc(g/12);return x<3?i.formatDistance("aboutXYears",p,l):x<9?i.formatDistance("overXYears",p,l):i.formatDistance("almostXYears",p+1,l)}}(t,function(n){return DO(n,Date.now())}(t),e)}const Fj=M.createContext({}),zj=M.forwardRef(function(t,e){[t,e]=BO(t,e,Fj);let{toolbarProps:n}=function(s,i){const{"aria-label":a,"aria-labelledby":l,orientation:c="horizontal"}=s;let[d,h]=M.useState(!1);LO(()=>{var p;h(!(!i.current||!(!((p=i.current.parentElement)===null||p===void 0)&&p.closest('[role="toolbar"]'))))});const{direction:f}=FO(),m=f==="rtl"&&c==="horizontal";let g=zO(i);const x=M.useRef(null);return{toolbarProps:{...p3(s,{labelable:!0}),role:d?"group":"toolbar","aria-orientation":c,"aria-label":a,"aria-labelledby":a==null?l:void 0,onKeyDownCapture:d?void 0:p=>{if(p.currentTarget.contains(p.target)){if(c==="horizontal"&&p.key==="ArrowRight"||c==="vertical"&&p.key==="ArrowDown")m?g.focusPrevious():g.focusNext();else{if(!(c==="horizontal"&&p.key==="ArrowLeft"||c==="vertical"&&p.key==="ArrowUp"))return p.key==="Tab"?(p.stopPropagation(),x.current=document.activeElement,void(p.shiftKey?g.focusFirst():g.focusLast())):void 0;m?g.focusNext():g.focusPrevious()}p.stopPropagation(),p.preventDefault()}},onFocusCapture:d?void 0:p=>{var b,y;x.current&&!p.currentTarget.contains(p.relatedTarget)&&(!((b=i.current)===null||b===void 0)&&b.contains(p.target))&&((y=x.current)===null||y===void 0||y.focus(),x.current=null)},onBlurCapture:d?void 0:p=>{p.currentTarget.contains(p.relatedTarget)||x.current||(x.current=p.target)}}}}(t,e),o=UO({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=p3(t,{global:!0});return delete r.id,q.createElement("div",{...lm(r,o,n),ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)}),ga="https://static.marimo.app",Bj=t=>{const e=H.c(25),{onClose:n}=t,[o,r]=M.useState(""),{exportAsHTML:s}=nt();let i;i=Math.random().toString(36).slice(2,6);const a=`${o}-${i}`,l=`${ga}/static/${a}`;let c,d,h,f,m,g,x,p,b,y,v;return e[0]!==s||e[1]!==n||e[2]!==a?(c=async w=>{w.preventDefault(),n();const j=await s({download:!1,includeCode:!0,files:xj.INSTANCE.filenames()}),C=Je({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${ga}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:j,path:a})}).catch(()=>{C.dismiss(),Je({title:"Error uploading static page",description:u.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",u.jsx("a",{href:Fn.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),C.dismiss(),Je({title:"Static page uploaded!",description:u.jsxs("div",{children:["The URL has been copied to your clipboard.",u.jsx("br",{}),"You can share it with anyone."]})})},e[0]=s,e[1]=n,e[2]=a,e[3]=c):c=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(Wo,{children:"Share static notebook"}),e[4]=d):d=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsxs(ls,{children:[d,u.jsxs(cs,{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"," ",u.jsx("a",{href:ga,target:"_blank",children:ga}),"."]})]}),e[5]=h):h=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(f=w=>{const j=w.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(j)},e[6]=f):f=e[6],e[7]!==o?(m=u.jsx(qo,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:f,required:!0,autoComplete:"off"}),e[7]=o,e[8]=m):m=e[8],e[9]!==l?(g=u.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:",u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Uj,{text:l}),u.jsx("span",{className:"text-primary",children:l})]})]}),e[9]=l,e[10]=g):g=e[10],e[11]!==m||e[12]!==g?(x=u.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[m,g]}),e[11]=m,e[12]=g,e[13]=x):x=e[13],e[14]!==n?(p=u.jsx(ve,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=p):p=e[15],e[16]!==l?(b=u.jsx(ve,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await sn(l)},children:"Create"}),e[16]=l,e[17]=b):b=e[17],e[18]!==b||e[19]!==p?(y=u.jsxs(Ti,{children:[p,b]}),e[18]=b,e[19]=p,e[20]=y):y=e[20],e[21]!==y||e[22]!==c||e[23]!==x?(v=u.jsx(Go,{className:"w-fit",children:u.jsxs("form",{onSubmit:c,children:[h,x,y]})}),e[21]=y,e[22]=c,e[23]=x,e[24]=v):v=e[24],v},Uj=t=>{const e=H.c(8),[n,o]=q.useState(!1);let r;e[0]!==t.text?(r=zn.stopPropagation(async c=>{c.preventDefault(),await sn(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=r):r=e[1];const s=r;let i,a,l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(Mi,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2],e[3]!==s?(a=u.jsx(ve,{"data-testid":"copy-static-notebook-url-button",onClick:s,size:"xs",variant:"secondary",children:i}),e[3]=s,e[4]=a):a=e[4],e[5]!==n||e[6]!==a?(l=u.jsx(Ee,{content:"Copied!",open:n,children:a}),e[5]=n,e[6]=a,e[7]=l):l=e[7],l};function ig(){const t=H.c(2),e=Ct(cm);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let s=null;for(const i of Array.from(o)){const a=i.getBoundingClientRect();if(a.top>=0&&a.top<=r||a.bottom>=0&&a.bottom<=r){s=Oi.parse(i.parentNode.id);break}}e(i=>({mode:$O(i.mode),cellAnchor:s})),requestAnimationFrame(()=>{var i;s!==null&&((i=document.getElementById(Oi.create(s)))==null||i.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function ud(t){const e=H.c(3),n=Is();let o;return e[0]!==t||e[1]!==n?(o=()=>{t!==void 0&&n([t])},e[0]=t,e[1]=n,e[2]=o):o=e[2],Fe(o)}function ag(){const t=H.c(2),e=Is();let n;return t[0]!==e?(n=()=>e(g3(bn())),t[0]=e,t[1]=n):n=t[1],Fe(n)}function Is(){const t=H.c(3),{prepareForRun:e}=lt(),{sendRun:n}=nt();let o;return t[0]!==e||t[1]!==n?(o=async r=>{var l,c;if(r.length===0)return;const{cellHandles:s,cellData:i}=bn(),a=[];for(const d of r){const h=s[d],f=(l=h==null?void 0:h.current)==null?void 0:l.editorView;let m;f?(x3(f)!=="markdown"&&dm(f),m=b3(f)):m=((c=i[d])==null?void 0:c.code)||"",a.push(m),e({cellId:d})}await n({cellIds:r,codes:a}).catch($j)},t[0]=e,t[1]=n,t[2]=o):o=t[2],Fe(o)}function $j(t){ut.error(t)}const hd=[{type:"files",Icon:Ep,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:Kl,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:Yo,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:ha,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:Ss,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:ld,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:Xl,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:cd,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:um,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:aF,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:Xp,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:Mp,tooltip:"Secrets",hidden:tn(),position:"sidebar"},{type:"scratchpad",Icon:HO,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:Di,tooltip:"View errors",position:"footer"}];function Vj(){const t=H.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];const[n,o]=function(i,a){const l=H.c(11);let c;l[0]!==a?(c=new WO(a),l[0]=a,l[1]=c):c=l[1];const d=c;let h;l[2]!==i||l[3]!==d?(h=()=>d.get(i),l[2]=i,l[3]=d,l[4]=h):h=l[4];const[f,m]=M.useState(h);let g;l[5]!==i||l[6]!==d?(g=b=>{m(b),d.set(i,b)},l[5]=i,l[6]=d,l[7]=g):g=l[7];const x=g;let p;return l[8]!==x||l[9]!==f?(p=[f,x],l[8]=x,l[9]=f,l[10]=p):p=l[10],p}("marimo:commands",e);let r,s;return t[1]!==n||t[2]!==o?(r=i=>{const a=(l=[i,...n],[...new Set(l)]);var l;o(a.slice(0,3))},t[1]=n,t[2]=o,t[3]=r):r=t[3],t[4]!==n||t[5]!==r?(s={recentCommands:n,addRecentCommand:r},t[4]=n,t[5]=r,t[6]=s):s=t[6],s}function lg(t){return t.dropdown!==void 0}function xa(t,e=""){return t.flatMap(n=>n.label?lg(n)?xa(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const As=t=>{const e=H.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=q.Children.toArray(n),e[0]=n,e[1]=s):s=e[1];const[i,a]=s,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let c,d;return e[2]!==a||e[3]!==l?(c=u.jsx("div",{className:l,children:a}),e[2]=a,e[3]=l,e[4]=c):c=e[4],e[5]!==i||e[6]!==c?(d=u.jsxs("div",{className:"multi-icon relative w-fit",children:[i,c]}),e[5]=i,e[6]=c,e[7]=d):d=e[7],d},Ts=jt(null),Hj=hm("marimo:ai:includeOtherCells",!0),fd=hm("marimo:ai:chatState:v3",{chats:[],activeChatId:null}),Wj=jt(t=>{const e=t(fd);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(fd,o=>({...o,activeChatId:n}))});function cg(t){return t!==w3&&!!(t&&t.trim().length>0)}const ba=t=>{const e=H.c(7);let n,o;e[0]!==t?(n=a=>{var l;(a.ctrlKey||a.metaKey)&&a.key==="z"&&(a.preventDefault(),a.stopPropagation(),(l=t.onClick)==null||l.call(t,a))},e[0]=t,e[1]=n):n=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(o={capture:!0},e[2]=o):o=e[2],Jl(window,"keydown",n,o);const r=t.children??"Undo";let s,i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx(qO,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(i=u.jsxs(ve,{"data-testid":"undo-button",size:"sm",variant:"outline",...t,children:[r," ",s]}),e[4]=r,e[5]=t,e[6]=i):i=e[6],i};function Ms(){const t=H.c(4),{deleteCell:e,undoDeleteCell:n}=lt(),{sendDeleteCell:o}=nt();let r;return t[0]!==e||t[1]!==o||t[2]!==n?(r=s=>{var c;if(Qe.get(Zl))return;const{cellId:i}=s,a=Qe.get(In),l=(((c=a.cellData[i])==null?void 0:c.code)??"").trim()==="";if(e({cellId:i}),o({cellId:i}).catch(()=>{n()}),!l){const{dismiss:d}=Je({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:u.jsx(ba,{"data-testid":"undo-delete-button",onClick:()=>{n(),h()}})}),h=d}},t[0]=e,t[1]=o,t[2]=n,t[3]=r):r=t[3],Fe(r)}function Os(){const t=H.c(4),{deleteCell:e,undoDeleteCell:n}=lt(),{sendDeleteCell:o}=nt();let r;return t[0]!==e||t[1]!==o||t[2]!==n?(r=async s=>{if(Qe.get(Zl))return;const{cellIds:i}=s;for(const c of i)await o({cellId:c}).then(()=>{e({cellId:c})});const{dismiss:a}=Je({title:"Cells deleted",action:u.jsx(ba,{"data-testid":"undo-delete-button",onClick:()=>{for(const c of i)n();l()}})}),l=a},t[0]=e,t[1]=o,t[2]=n,t[3]=r):r=t[3],Fe(r)}function dg(){const t=H.c(3),{splitCell:e,undoSplitCell:n}=lt();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=Ri(r.cellId);if(!s)return;const i=b3(s);e(r);const{dismiss:a}=Je({title:"Cell split",action:u.jsx(ba,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...r,snapshot:i}),l()},children:"Undo"})}),l=a},t[0]=e,t[1]=n,t[2]=o):o=t[2],Fe(o)}function md(t){const e=H.c(51),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:i,sendToTop:a,sendToBottom:l,addColumnBreakpoint:c,clearCellOutput:d}=lt(),h=dg(),f=ud(n==null?void 0:n.cellId),m=!Ne(Zl),g=Ms(),{openModal:x}=An(),p=Ct(Ts),b=Ne(Ql),y=Ne(ec),v=Ne(ds),w=Ne(GO),{saveCellConfig:j}=nt();if(!n||v){let U;return e[0]===Symbol.for("react.memo_cache_sentinel")?(U=[],e[0]=U):U=e[0],U}const{cellId:C,config:N,getEditorView:S,name:E,hasOutput:T,hasConsoleOutput:I,status:D}=n;let F;e[1]!==C||e[2]!==N.disabled||e[3]!==j||e[4]!==r?(F=async()=>{const U={disabled:!N.disabled};await j({configs:{[C]:U}}),r({cellId:C,config:U})},e[1]=C,e[2]=N.disabled,e[3]=j,e[4]=r,e[5]=F):F=e[5];const O=F;let R;e[6]!==C||e[7]!==N.hide_code||e[8]!==S||e[9]!==j||e[10]!==r?(R=async()=>{const U={hide_code:!N.hide_code};await j({configs:{[C]:U}}),r({cellId:C,config:U});const V=S();V&&(U.hide_code?V.contentDOM.blur():V.focus())},e[6]=C,e[7]=N.hide_code,e[8]=S,e[9]=j,e[10]=r,e[11]=R):R=e[11];const P=R;let z,_,k,B,A;return e[12]===Symbol.for("react.memo_cache_sentinel")?(z=u.jsx(ng,{size:13,strokeWidth:1.5}),e[12]=z):z=e[12],e[13]!==C||e[14]!==E||e[15]!==x||e[16]!==s?(_=()=>{x(u.jsxs(Go,{children:[u.jsx(ls,{children:u.jsx(Wo,{children:"Rename cell"})}),u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx(gr,{htmlFor:"cell-name",children:"Cell name"}),u.jsx(bj,{placeholder:"cell name",value:E,onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),U.stopPropagation(),x(null))},onChange:U=>s({cellId:C,name:U})})]})]}))},e[13]=C,e[14]=E,e[15]=x,e[16]=s,e[17]=_):_=e[17],e[18]!==C||e[19]!==s?(k=U=>s({cellId:C,name:U}),e[18]=C,e[19]=s,e[20]=k):k=e[20],e[21]!==E||e[22]!==k?(B=u.jsx(bj,{placeholder:"cell name",value:E,onChange:k}),e[21]=E,e[22]=k,e[23]=B):B=e[23],e[24]!==c||e[25]!==b||e[26]!==w||e[27]!==y||e[28]!==m||e[29]!==C||e[30]!==d||e[31]!==N.disabled||e[32]!==N.hide_code||e[33]!==o||e[34]!==g||e[35]!==S||e[36]!==I||e[37]!==T||e[38]!==i||e[39]!==E||e[40]!==f||e[41]!==l||e[42]!==a||e[43]!==p||e[44]!==h||e[45]!==D||e[46]!==_||e[47]!==B||e[48]!==O||e[49]!==P?(A=[[{icon:z,label:"Name",disableClick:!0,handle:Kj,handleHeadless:_,rightElement:B},{icon:u.jsx(Sr,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:D==="running"||D==="queued"||D==="disabled-transitively"||N.disabled,handle:()=>f()},{icon:u.jsx(Pi,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{p(U=>(U==null?void 0:U.cellId)===C?null:{cellId:C})},hotkey:"cell.aiCompletion"},{icon:u.jsx(ad,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>h({cellId:C})},{icon:u.jsx(cp,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!T,handle:()=>function(U){const V=document.getElementById(y3.create(U));V&&(V.classList.add("printing-output"),v3(V,"result.png").finally(()=>{V.classList.remove("printing-output")}))}(C)},{icon:u.jsx(C3,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const U=S();U&&k3({[C]:U})}},{icon:N.hide_code?u.jsx(fm,{size:13,strokeWidth:1.5}):u.jsx(mm,{size:13,strokeWidth:1.5}),label:N.hide_code?"Show code":"Hide code",handle:P,hotkey:"cell.hideCode"},{icon:N.disabled?u.jsx(un,{size:13,strokeWidth:1.5}):u.jsx(hn,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:u.jsx(pm,{"data-testid":"cell-disable-switch",checked:!N.disabled,size:"sm",onCheckedChange:O}),handle:O},{icon:u.jsx(Di,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(T||I),handle:()=>{d({cellId:C})}}],[{icon:u.jsx(tc,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const U=S();U&&(Jn({autoInstantiate:y,createNewCell:o}),pr(U,{language:"markdown",keepCodeAsIs:!1}))}},{icon:u.jsx(Yo,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const U=S();U&&(Jn({autoInstantiate:y,createNewCell:o}),pr(U,{language:"sql",keepCodeAsIs:!1}))}},{icon:u.jsx(nc,{}),label:"Toggle as Python",handle:()=>{const U=S();U&&(Jn({autoInstantiate:y,createNewCell:o}),YO(U,"python",{force:!0}))}}],[{icon:u.jsxs(As,{children:[u.jsx(ca,{size:13,strokeWidth:1.5}),u.jsx(oc,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:C,before:!0})},{icon:u.jsxs(As,{children:[u.jsx(ca,{size:13,strokeWidth:1.5}),u.jsx(No,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:C,before:!1})},{icon:u.jsx(oc,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>i({cellId:C,before:!0})},{icon:u.jsx(No,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>i({cellId:C,before:!1})},{icon:u.jsx(j3,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>i({cellId:C,direction:"left"}),hidden:w!=="columns"},{icon:u.jsx(Li,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>i({cellId:C,direction:"right"}),hidden:w!=="columns"},{icon:u.jsx(Jc,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>a({cellId:C,scroll:!1})},{icon:u.jsx(Xc,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:C,scroll:!1})},{icon:u.jsx(KO,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:w!=="columns",handle:()=>c({cellId:C})}],[{icon:u.jsx(hj,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!cg(E),tooltip:cg(E)?void 0:"Only named cells can be linked to",handle:async()=>{await sn(function(U){const V=new URL(window.location.href);return V.hash=`scrollTo=${encodeURIComponent(U)}`,V.toString()}(E)),Je({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!m,variant:"danger",icon:u.jsx(rc,{size:13,strokeWidth:1.5}),handle:()=>{g({cellId:C})}}]].map(Gj).filter(qj),e[24]=c,e[25]=b,e[26]=w,e[27]=y,e[28]=m,e[29]=C,e[30]=d,e[31]=N.disabled,e[32]=N.hide_code,e[33]=o,e[34]=g,e[35]=S,e[36]=I,e[37]=T,e[38]=i,e[39]=E,e[40]=f,e[41]=l,e[42]=a,e[43]=p,e[44]=h,e[45]=D,e[46]=_,e[47]=B,e[48]=O,e[49]=P,e[50]=A):A=e[50],A}function qj(t){return t.length>0}function Gj(t){return t.filter(Yj)}function Yj(t){return!t.hidden}function Kj(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function Xj(t){return!t.hidden}const pd=jt(!1),ug=()=>{const t=H.c(37),[e,n]=zt(pd),o=XO(),r=Ne(JO),s=Ne(Fi);let i;t[0]!==r?(i={cell:r},t[0]=r,t[1]=i):i=t[1];let a=md(i).flat();a=xa(a);const l=function(){const _=H.c(75),[k,B]=xr(),[A,U]=S3(),{saveAppConfig:V,saveUserConfig:X}=nt();let Y;_[0]!==X||_[1]!==B?(Y=async oe=>{await X({config:oe}).then(()=>{B(oe)})},_[0]=X,_[1]=B,_[2]=Y):Y=_[2];const G=Y;let W;_[3]!==V||_[4]!==U?(W=async oe=>{await V({config:oe}).then(()=>{U(oe)})},_[3]=V,_[4]=U,_[5]=W):W=_[5];const J=W;let $;if(_[6]!==A||_[7]!==k||_[8]!==J||_[9]!==G){let oe,ne,ie,se,ae;_[11]!==A?(oe=He=>He!==A.width,_[11]=A,_[12]=oe):oe=_[12],_[13]!==A||_[14]!==J?(ne=He=>({label:`App config > Set width=${He}`,handle:()=>{J({...A,width:He})}}),_[13]=A,_[14]=J,_[15]=ne):ne=_[15],_[16]!==k||_[17]!==G?(ie={label:"Config > Set theme: dark",handle:()=>{G({...k,display:{...k.display,theme:"dark"}})}},_[16]=k,_[17]=G,_[18]=ie):ie=_[18],_[19]!==k||_[20]!==G?(se={label:"Config > Set theme: light",handle:()=>{G({...k,display:{...k.display,theme:"light"}})}},_[19]=k,_[20]=G,_[21]=se):se=_[21],_[22]!==k||_[23]!==G?(ae={label:"Config > Set theme: system",handle:()=>{G({...k,display:{...k.display,theme:"system"}})}},_[22]=k,_[23]=G,_[24]=ae):ae=_[24];const fe=k.keymap.preset==="vim";let re,ue;_[25]!==k||_[26]!==G?(re=()=>{G({...k,keymap:{...k.keymap,preset:"vim"}})},_[25]=k,_[26]=G,_[27]=re):re=_[27],_[28]!==fe||_[29]!==re?(ue={label:"Config > Switch keymap to VIM",hidden:fe,handle:re},_[28]=fe,_[29]=re,_[30]=ue):ue=_[30];const le=k.keymap.preset==="default";let je,Se,Le;_[31]!==k||_[32]!==G?(je=()=>{G({...k,keymap:{...k.keymap,preset:"default"}})},_[31]=k,_[32]=G,_[33]=je):je=_[33],_[34]!==le||_[35]!==je?(Se={label:"Config > Switch keymap to default (current: VIM)",hidden:le,handle:je},_[34]=le,_[35]=je,_[36]=Se):Se=_[36],_[37]!==k||_[38]!==G?(Le=()=>{G({...k,completion:{...k.completion,copilot:!1}})},_[37]=k,_[38]=G,_[39]=Le):Le=_[39];const Ie=k.completion.copilot!=="github";let ke,Ye;_[40]!==Le||_[41]!==Ie?(ke={label:"Config > Disable GitHub Copilot",handle:Le,hidden:Ie},_[40]=Le,_[41]=Ie,_[42]=ke):ke=_[42],_[43]!==k||_[44]!==G?(Ye=()=>{G({...k,completion:{...k.completion,copilot:"github"}})},_[43]=k,_[44]=G,_[45]=Ye):Ye=_[45];const Ve=k.completion.copilot==="github";let Ke;_[46]!==Ye||_[47]!==Ve?(Ke={label:"Config > Enable GitHub Copilot",handle:Ye,hidden:Ve},_[46]=Ye,_[47]=Ve,_[48]=Ke):Ke=_[48];const ee=!k.display.reference_highlighting;let ye,we,Ae,K;_[49]!==k||_[50]!==G?(ye=()=>{G({...k,display:{...k.display,reference_highlighting:!1}})},_[49]=k,_[50]=G,_[51]=ye):ye=_[51],_[52]!==ee||_[53]!==ye?(we={label:"Config > Disable reference highlighting",hidden:ee,handle:ye},_[52]=ee,_[53]=ye,_[54]=we):we=_[54],_[55]!==k||_[56]!==G?(Ae=()=>{G({...k,display:{...k.display,reference_highlighting:!0}})},_[55]=k,_[56]=G,_[57]=Ae):Ae=_[57],_[58]!==k.display.reference_highlighting||_[59]!==Ae?(K={label:"Config > Enable reference highlighting",hidden:k.display.reference_highlighting,handle:Ae},_[58]=k.display.reference_highlighting,_[59]=Ae,_[60]=K):K=_[60];const pe=k.display.cell_output==="above";let ge,he;_[61]!==k||_[62]!==G?(ge=()=>{G({...k,display:{...k.display,cell_output:"above"}})},_[61]=k,_[62]=G,_[63]=ge):ge=_[63],_[64]!==pe||_[65]!==ge?(he={label:"Config > Set cell output area: above",hidden:pe,handle:ge},_[64]=pe,_[65]=ge,_[66]=he):he=_[66];const Ce=k.display.cell_output==="below";let Re,Pe;_[67]!==k||_[68]!==G?(Re=()=>{G({...k,display:{...k.display,cell_output:"below"}})},_[67]=k,_[68]=G,_[69]=Re):Re=_[69],_[70]!==Ce||_[71]!==Re?(Pe={label:"Config > Set cell output area: below",hidden:Ce,handle:Re},_[70]=Ce,_[71]=Re,_[72]=Pe):Pe=_[72],$=[...lF().filter(oe).map(ne),ie,se,ae,ue,Se,ke,Ke,we,K,he,Pe],_[6]=A,_[7]=k,_[8]=J,_[9]=G,_[10]=$}else $=_[10];const Q=$;let te;return _[73]!==Q?(te=Q.filter(Xj),_[73]=Q,_[74]=te):te=_[74],te}();let c=Ug();c=[...xa(c),...xa(l)];const d=c.filter(Jj),h=sc.keyBy(d,Zj),{recentCommands:f,addRecentCommand:m}=Vj();let g;t[2]!==f?(g=new Set(f),t[2]=f,t[3]=g):g=t[3];const x=g;let p,b;t[4]!==s||t[5]!==n?(p=_=>{ic(s.getHotkey("global.commandPalette").key)(_)&&(_.preventDefault(),n(Qj))},t[4]=s,t[5]=n,t[6]=p):p=t[6],Jl(document,"keydown",p),t[7]!==m||t[8]!==s||t[9]!==o||t[10]!==n?(b=(_,k)=>{const B=o[_];if(!B)return null;const A=s.getHotkey(_);return u.jsxs(Zn,{disabled:k.disabled,onSelect:()=>{m(_),n(!1),requestAnimationFrame(()=>{B()})},value:A.name,children:[u.jsxs("span",{children:[A.name,k.tooltip&&u.jsx("span",{className:"ml-2",children:k.tooltip})]}),u.jsx(E3,{children:u.jsx(bm,{shortcut:A.key})})]},_)},t[7]=m,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const y=b;let v;t[12]!==m||t[13]!==s||t[14]!==n?(v=_=>{const{label:k,handle:B,props:A,hotkey:U}=_,V=A===void 0?{}:A;return u.jsxs(Zn,{disabled:V.disabled,onSelect:()=>{m(k),n(!1),requestAnimationFrame(()=>{B()})},value:k,children:[u.jsxs("span",{children:[k,V.tooltip&&u.jsxs("span",{className:"ml-2",children:["(",V.tooltip,")"]})]}),U&&u.jsx(E3,{children:u.jsx(bm,{shortcut:s.getHotkey(U).key})})]},k)},t[12]=m,t[13]=s,t[14]=n,t[15]=v):v=t[15];const w=v,j=QO;let C;t[16]===Symbol.for("react.memo_cache_sentinel")?(C=u.jsx(zi,{placeholder:"Type to search..."}),t[16]=C):C=t[16];const N=xm;let S;t[17]===Symbol.for("react.memo_cache_sentinel")?(S=u.jsx(ac,{children:"No results found."}),t[17]=S):S=t[17];const E=f.length>0&&u.jsxs(u.Fragment,{children:[u.jsx(gm,{heading:"Recently Used",children:f.map(_=>{const k=h[_];return ZO(_)?y(_,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip}):k&&!lg(k)?w({label:k.label,handle:k.handleHeadless||k.handle,props:{disabled:k.disabled,tooltip:k.tooltip}}):null})}),u.jsx(N3,{})]}),T=gm,I=s.iterate().map(_=>{if(x.has(_))return null;const k=h[_];return y(_,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip})}),D=d.map(_=>x.has(_.label)?null:w({label:_.label,handle:_.handleHeadless||_.handle,props:{disabled:_.disabled,tooltip:_.tooltip}}));let F;t[18]!==x||t[19]!==w?(F=_=>x.has(_.label)?null:w({label:`Cell > ${_.label}`,handle:_.handleHeadless||_.handle,props:{disabled:_.disabled,tooltip:_.tooltip}}),t[18]=x,t[19]=w,t[20]=F):F=t[20];const O=a.map(F);let R,P,z;return t[21]!==T||t[22]!==D||t[23]!==O||t[24]!==I?(R=u.jsxs(T,{heading:"Commands",children:[I,D,O]}),t[21]=T,t[22]=D,t[23]=O,t[24]=I,t[25]=R):R=t[25],t[26]!==N||t[27]!==R||t[28]!==S||t[29]!==E?(P=u.jsxs(N,{children:[S,E,R]}),t[26]=N,t[27]=R,t[28]=S,t[29]=E,t[30]=P):P=t[30],t[31]!==j||t[32]!==e||t[33]!==n||t[34]!==P||t[35]!==C?(z=u.jsxs(j,{open:e,onOpenChange:n,children:[C,P]}),t[31]=j,t[32]=e,t[33]=n,t[34]=P,t[35]=C,t[36]=z):z=t[36],z};function Jj(t){return!t.hotkey}function Zj(t){return t.label}function Qj(t){return!t}function er(){return at().optional().describe(ze.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function hg(){return at().optional().describe(ze.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function ya(){return at().optional().describe(ze.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function fg(){return at().optional().describe(ze.of({label:"URI",optionRegex:".*uri.*"}))}function tr(){return at().nonempty().describe(ze.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function to(){return at().describe(ze.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function nr(){return at().nonempty().describe(ze.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function or(t){const e=eD.string().describe(ze.of({label:"Port",inputType:"number",placeholder:t==null?void 0:t.toString()})).transform(Number).refine(n=>n>=0&&n<=65535,{message:"Port must be between 0 and 65535"});return t!==void 0?e.default(t.toString()):e}function mg(){return us().default(!1).describe(ze.of({label:"Read Only"}))}const pg=ft({type:gt("postgres"),host:tr(),port:or(5432).optional(),database:to(),username:nr(),password:er(),ssl:us().default(!1).describe(ze.of({label:"Use SSL"}))}).describe(ze.of({direction:"two-columns"})),gg=ft({type:gt("mysql"),host:tr(),port:or(3306),database:to(),username:nr(),password:er(),ssl:us().default(!1).describe(ze.of({label:"Use SSL"}))}).describe(ze.of({direction:"two-columns"})),xg=ft({type:gt("sqlite"),database:to().describe(ze.of({label:"Database Path"}))}).describe(ze.of({direction:"two-columns"})),bg=ft({type:gt("duckdb"),database:to().describe(ze.of({label:"Database Path"})),read_only:mg()}).describe(ze.of({direction:"two-columns"})),yg=ft({type:gt("motherduck"),database:to().default("my_db").describe(ze.of({label:"Database Name"})),token:hg()}).describe(ze.of({direction:"two-columns"})),vg=ft({type:gt("snowflake"),account:at().nonempty().describe(ze.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:at().optional().describe(ze.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:to(),schema:at().optional().describe(ze.of({label:"Schema",optionRegex:".*snowflake.*"})),username:nr(),password:er(),role:at().optional().describe(ze.of({label:"Role"}))}).describe(ze.of({direction:"two-columns"})),wg=ft({type:gt("bigquery"),project:at().nonempty().describe(ze.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:at().nonempty().describe(ze.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:at().describe(ze.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(ze.of({direction:"two-columns"})),kg=ft({type:gt("clickhouse_connect"),host:tr(),port:or(8123).optional(),username:nr(),password:er(),secure:us().default(!1).describe(ze.of({label:"Use HTTPs"}))}).describe(ze.of({direction:"two-columns"})),Cg=ft({type:gt("timeplus"),host:tr().default("localhost"),port:or(8123).optional(),username:nr().default("default"),password:er().default("")}).describe(ze.of({direction:"two-columns"})),jg=ft({type:gt("chdb"),database:to().describe(ze.of({label:"Database Path"})),read_only:mg()}).describe(ze.of({direction:"two-columns"})),Sg=ft({type:gt("trino"),host:tr(),port:or(8080),database:to(),schema:at().describe(ze.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:nr(),password:er(),async_support:us().default(!1).describe(ze.of({label:"Async Support"}))}).describe(ze.of({direction:"two-columns"})),Ng=ft({type:gt("iceberg"),name:at().describe(ze.of({label:"Catalog Name"})),catalog:ym("type",[ft({type:gt("REST"),warehouse:ya(),uri:at().optional().describe(ze.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:hg()}),ft({type:gt("SQL"),warehouse:ya(),uri:at().optional().describe(ze.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),ft({type:gt("Hive"),warehouse:ya(),uri:fg()}),ft({type:gt("Glue"),warehouse:ya(),uri:fg()}),ft({type:gt("DynamoDB"),"dynamodb.profile-name":at().optional().describe(ze.of({label:"Profile Name"})),"dynamodb.region":at().optional().describe(ze.of({label:"Region"})),"dynamodb.access-key-id":at().optional().describe(ze.of({label:"Access Key ID"})),"dynamodb.secret-access-key":at().optional().describe(ze.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":at().optional().describe(ze.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(ze.of({special:"tabs"}))}),Eg=ft({type:gt("datafusion"),sessionContext:us().optional().describe(ze.of({label:"Use Session Context"}))}),_g=ft({type:gt("pyspark"),host:tr().optional(),port:or().optional()}),Ig=ft({type:gt("redshift"),host:tr(),port:or(5439),connectionType:ym("type",[ft({type:gt("IAM credentials"),region:at().describe(ze.of({label:"Region"})),aws_access_key_id:at().nonempty().describe(ze.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:at().nonempty().describe(ze.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:at().optional().describe(ze.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),ft({type:gt("DB credentials"),user:nr(),password:er()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:to()}).describe(ze.of({direction:"two-columns"})),eS=ym("type",[pg,gg,xg,bg,yg,vg,wg,kg,Cg,jg,Sg,Ng,Eg,_g,Ig]),gd="env:";function va(t){return typeof t=="string"&&t.startsWith(gd)}function xd(t){return`${gd}${t}`}const Ag={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class Yt{constructor(e,n,o){this.connection=void 0,this.orm=void 0,this.secrets=void 0,this.connection=e,this.orm=n,this.secrets=o}get imports(){const e=new Set(this.generateImports());switch(this.orm){case"sqlalchemy":e.add("import sqlalchemy");break;case"sqlmodel":e.add("import sqlmodel");break;case"duckdb":e.add("import duckdb")}return e}}class tS{constructor(){this.secrets={}}get imports(){return Object.keys(this.secrets).length===0?new Set:new Set(["import os"])}print(e,n,o){if(e=(r=>`_${r}`)(e),va(n)){const r=n.replace(gd,""),s=o?`os.environ.get("${r}", "${o}")`:`os.environ.get("${r}")`;return this.secrets[e]=s,e}if(o!=null){const r=`os.environ.get("${n}", "${o}")`;return this.secrets[e]=r,e}return typeof n=="number"||typeof n=="number"?`${n}`:typeof n=="boolean"?Er(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return Er(n);const r=this.print(e,n,o);return r.startsWith('"')&&r.endsWith('"')?r.slice(1,-1):`{${r}}`}printPassword(e,n,o){const r=o?this.printInFString.bind(this):this.print.bind(this);return va(e)?r("password",e):r("password",n,e)}getSecrets(){return this.secrets}formatSecrets(){return Object.keys(this.secrets).length===0?"":Object.entries(this.secrets).map(([e,n])=>`${e} = ${n}`).join(`
|
|
3
3
|
`)}}class nS extends Yt{generateImports(){return[]}generateConnectionCode(){const e=this.connection.ssl?", connect_args={'sslmode': 'require'}":"",n=this.secrets.printPassword(this.connection.password,"POSTGRES_PASSWORD",!0),o=this.secrets.printInFString("username",this.connection.username),r=this.secrets.printInFString("host",this.connection.host),s=this.secrets.printInFString("port",this.connection.port),i=this.secrets.printInFString("database",this.connection.database);return xt(`
|
|
4
4
|
DATABASE_URL = f"postgresql://${o}:${n}@${r}:${s}/${i}"
|
|
5
5
|
engine = ${this.orm}.create_engine(DATABASE_URL${e})
|
|
@@ -95,7 +95,7 @@ ${wa(i,a=>` ${a}`)},
|
|
|
95
95
|
)
|
|
96
96
|
`)}}class xS{constructor(){this.secrets=new tS}createGenerator(e,n){switch(e.type){case"postgres":return new nS(e,n,this.secrets);case"mysql":return new oS(e,n,this.secrets);case"sqlite":return new rS(e,n,this.secrets);case"snowflake":return new sS(e,n,this.secrets);case"bigquery":return new iS(e,n,this.secrets);case"duckdb":return new aS(e,n,this.secrets);case"motherduck":return new lS(e,n,this.secrets);case"clickhouse_connect":return new cS(e,n,this.secrets);case"timeplus":return new dS(e,n,this.secrets);case"chdb":return new uS(e,n,this.secrets);case"trino":return new hS(e,n,this.secrets);case"iceberg":return new fS(e,n,this.secrets);case"datafusion":return new mS(e,n,this.secrets);case"pyspark":return new pS(e,n,this.secrets);case"redshift":return new gS(e,n,this.secrets);default:vm(e)}}}function Er(t){return t.toString().charAt(0).toUpperCase()+t.toString().slice(1)}function wa(t,e){return Object.entries(t).filter(([,n])=>n!=null&&n!=="").map(([n,o])=>e(typeof o=="boolean"?`${n}=${Er(o)}`:`${n}=${o}`)).join(`,
|
|
97
97
|
`)}function Tg(t){return t.sort((e,n)=>e.provider==="env"?1:n.provider==="env"?-1:0)}const Mg=t=>{const e=H.c(43),{providerNames:n,onClose:o,onSuccess:r}=t,{writeSecret:s}=nt(),[i,a]=q.useState(""),[l,c]=q.useState(""),[d,h]=q.useState(n[0]);let f;e[0]!==i||e[1]!==d||e[2]!==r||e[3]!==l||e[4]!==s?(f=async _=>{if(_.preventDefault(),d)if(i&&l&&d)try{await s({key:i,value:l,provider:"dotenv",name:d}),Je({title:"Secret created",description:"The secret has been created successfully."}),r(i)}catch{Je({title:"Error",description:"Failed to create secret. Please try again.",variant:"danger"})}else Je({title:"Error",description:"Please fill in all fields.",variant:"danger"});else Je({title:"Error",description:"No location selected for the secret.",variant:"danger"})},e[0]=i,e[1]=d,e[2]=r,e[3]=l,e[4]=s,e[5]=f):f=e[5];const m=f;let g,x,p,b,y,v,w,j,C,N,S,E,T,I,D,F;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsxs(ls,{children:[u.jsx(Wo,{children:"Add Secret"}),u.jsx(cs,{children:"Add a new secret to your environment variables."})]}),e[6]=g):g=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx(gr,{htmlFor:"key",children:"Key"}),e[7]=x):x=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(p=_=>{a(_.target.value.replaceAll(/\W/g,"_"))},e[8]=p):p=e[8],e[9]!==i?(b=u.jsxs("div",{className:"grid gap-2",children:[x,u.jsx(qo,{id:"key",value:i,onChange:p,placeholder:"MY_SECRET_KEY",required:!0})]}),e[9]=i,e[10]=b):b=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(y=u.jsx(gr,{htmlFor:"value",children:"Value"}),e[11]=y):y=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(v=_=>c(_.target.value),e[12]=v):v=e[12],e[13]!==l?(w=u.jsx(qo,{id:"value",type:"text",value:l,onChange:v,required:!0,autoComplete:"off"}),e[13]=l,e[14]=w):w=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(j=window.location.href.startsWith("http://")&&u.jsx(_3,{children:"Note: You are sending this key over http."}),e[15]=j):j=e[15],e[16]!==w?(C=u.jsxs("div",{className:"grid gap-2",children:[y,w,j]}),e[16]=w,e[17]=C):C=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(N=u.jsx(gr,{htmlFor:"location",children:"Location"}),e[18]=N):N=e[18],e[19]!==n.length?(S=n.length===0&&u.jsx("p",{className:"text-sm text-muted-foreground",children:"No dotenv locations configured."}),e[19]=n.length,e[20]=S):S=e[20],e[21]!==d||e[22]!==n?(E=n.length>0&&u.jsxs(lc,{value:d,onValueChange:_=>h(_),children:[u.jsx(cc,{children:u.jsx(wm,{placeholder:"Select a provider"})}),u.jsx(dc,{children:n.map(bS)})]}),e[21]=d,e[22]=n,e[23]=E):E=e[23],e[24]===Symbol.for("react.memo_cache_sentinel")?(T=u.jsxs(_3,{children:["You can configure the location by setting the"," ",u.jsx(km,{href:"https://links.marimo.app/dotenv",children:"dotenv configuration"}),"."]}),e[24]=T):T=e[24],e[25]!==S||e[26]!==E?(I=u.jsxs("div",{className:"grid gap-2",children:[N,S,E,T]}),e[25]=S,e[26]=E,e[27]=I):I=e[27],e[28]!==C||e[29]!==I||e[30]!==b?(D=u.jsxs("div",{className:"grid gap-4 py-4",children:[b,C,I]}),e[28]=C,e[29]=I,e[30]=b,e[31]=D):D=e[31],e[32]!==o?(F=u.jsx(ve,{type:"button",variant:"outline",onClick:o,children:"Cancel"}),e[32]=o,e[33]=F):F=e[33];const O=!i||!l||!d;let R,P,z;return e[34]!==O?(R=u.jsx(ve,{type:"submit",disabled:O,children:"Add Secret"}),e[34]=O,e[35]=R):R=e[35],e[36]!==F||e[37]!==R?(P=u.jsxs(Ti,{children:[F,R]}),e[36]=F,e[37]=R,e[38]=P):P=e[38],e[39]!==m||e[40]!==D||e[41]!==P?(z=u.jsx(Go,{children:u.jsxs("form",{onSubmit:m,children:[g,D,P]})}),e[39]=m,e[40]=D,e[41]=P,e[42]=z):z=e[42],z};function bS(t){return u.jsx(uc,{value:t,children:t},t)}const Og=M.createContext({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:Bn.NOOP}),yS=t=>{const e=H.c(14),{children:n}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0];const{data:r,isPending:s,error:i,refetch:a}=Tn(jS,o);let l,c,d,h;return e[1]!==(r==null?void 0:r.secretKeys)?(l=(r==null?void 0:r.secretKeys)||[],e[1]=r==null?void 0:r.secretKeys,e[2]=l):l=e[2],e[3]!==(r==null?void 0:r.providerNames)?(c=(r==null?void 0:r.providerNames)||[],e[3]=r==null?void 0:r.providerNames,e[4]=c):c=e[4],e[5]!==i||e[6]!==s||e[7]!==a||e[8]!==l||e[9]!==c?(d={secretKeys:l,providerNames:c,loading:s,error:i,refreshSecrets:a},e[5]=i,e[6]=s,e[7]=a,e[8]=l,e[9]=c,e[10]=d):d=e[10],e[11]!==n||e[12]!==d?(h=u.jsx(Og,{value:d,children:n}),e[11]=n,e[12]=d,e[13]=h):h=e[13],h},vS={isMatch:t=>{if(t instanceof M3||t instanceof rD){const{optionRegex:e}=ze.parse(t._def.description||"");return!!e}return!1},Component:({schema:t,form:e,path:n})=>{const{secretKeys:o,providerNames:r,refreshSecrets:s}=M.use(Og),{openModal:i,closeModal:a}=An(),{label:l,description:c,optionRegex:d=""}=ze.parse(t._def.description||""),[h,f]=Mt(o,m=>new RegExp(d,"i").test(m));return u.jsx(I3,{control:e.control,name:n,render:({field:m})=>u.jsxs(A3,{children:[u.jsx(tD,{children:l}),u.jsx(nD,{children:c}),u.jsx(T3,{children:u.jsxs("div",{className:"flex gap-2",children:[t instanceof M3?u.jsx(qo,{...m,value:m.value,onChange:m.onChange,className:xe("flex-1")}):u.jsx(oD,{...m,value:m.value,onChange:m.onChange,className:"flex-1"}),u.jsxs(Eo,{children:[u.jsx(_o,{asChild:!0,children:u.jsx(ve,{variant:"outline",size:"icon",className:xe(va(m.value)&&"bg-accent"),children:u.jsx(nd,{className:"h-3 w-3"})})}),u.jsxs(Io,{align:"end",className:"max-h-60 overflow-y-auto",children:[u.jsxs(At,{onSelect:()=>{i(u.jsx(Mg,{providerNames:r,onSuccess:g=>{s(),m.onChange(xd(g)),a()},onClose:a}))},children:[u.jsx(ca,{className:"mr-2 h-3.5 w-3.5"}),"Create a new secret"]}),h.length>0&&u.jsxs(u.Fragment,{children:[u.jsx(an,{}),u.jsx(O3,{children:"Recommended"})]}),h.map(g=>u.jsx(At,{onSelect:()=>m.onChange(xd(g)),children:g},g)),f.length>0&&u.jsx(an,{}),f.map(g=>u.jsx(At,{onSelect:()=>m.onChange(xd(g)),children:g},g))]})]})]})}),u.jsx(D3,{})]})})}};function wS(t){return t.provider!=="env"}function kS(t){return t.name}function CS(t){return t.keys}async function jS(){const t=await yj.request({}),e=Tg(t.secrets).filter(wS).map(kS);return{secretKeys:t.secrets.flatMap(CS).sort(),providerNames:e}}const Dg=[{name:"PostgreSQL",schema:pg,color:"#336791",logo:"postgres",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"MySQL",schema:gg,color:"#00758F",logo:"mysql",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"SQLite",schema:xg,color:"#003B57",logo:"sqlite",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DuckDB",schema:bg,color:"#FFD700",logo:"duckdb",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"MotherDuck",schema:yg,color:"#ff9538",logo:"motherduck",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"Snowflake",schema:vg,color:"#29B5E8",logo:"snowflake",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse",schema:kg,color:"#2C2C1D",logo:"clickhouse",connectionLibraries:{libraries:["clickhouse_connect"],preferred:"clickhouse_connect"}},{name:"Timeplus",schema:Cg,color:"#B83280",logo:"timeplus",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"BigQuery",schema:wg,color:"#4285F4",logo:"bigquery",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse Embedded",schema:jg,color:"#f2b611",logo:"clickhouse",connectionLibraries:{libraries:["chdb"],preferred:"chdb"}},{name:"Trino",schema:Sg,color:"#d466b6",logo:"trino",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DataFusion",schema:Eg,color:"#202A37",logo:"datafusion",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"PySpark",schema:_g,color:"#1C5162",logo:"pyspark",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"Redshift",schema:Ig,color:"#522BAE",logo:"redshift",connectionLibraries:{libraries:["redshift"],preferred:"redshift"}}],Rg=[{name:"Iceberg",schema:Ng,color:"#000000",logo:"iceberg",connectionLibraries:{libraries:["pyiceberg"],preferred:"pyiceberg"}}],SS=t=>{const e=H.c(14),{onSelect:n}=t;let o;e[0]!==n?(o=h=>{const{name:f,schema:m,color:g,logo:x}=h;return u.jsxs("button",{type:"button",className:"py-3 flex flex-col items-center justify-center gap-1 transition-all hover:scale-105 hover:brightness-110 rounded shadow-sm-solid hover:shadow-md-solid",style:{backgroundColor:g},onClick:()=>n(m),children:[u.jsx(L3,{name:x,className:"w-8 h-8 text-white brightness-0 invert dark:invert"}),u.jsx("span",{className:"text-white font-medium text-lg",children:f})]},f)},e[0]=n,e[1]=o):o=e[1];const r=o;let s,i,a,l,c,d;return e[2]!==r?(s=Dg.map(r),e[2]=r,e[3]=s):s=e[3],e[4]!==s?(i=u.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:s}),e[4]=s,e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsxs("h4",{className:"font-semibold text-muted-foreground text-lg flex items-center gap-4",children:["Data Catalogs",u.jsx("hr",{className:"flex-1"})]}),e[6]=a):a=e[6],e[7]!==r?(l=Rg.map(r),e[7]=r,e[8]=l):l=e[8],e[9]!==l?(c=u.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:l}),e[9]=l,e[10]=c):c=e[10],e[11]!==i||e[12]!==c?(d=u.jsxs(u.Fragment,{children:[i,a,c]}),e[11]=i,e[12]=c,e[13]=d):d=e[13],d},NS=[vS],ES=t=>{var B;const e=H.c(49),{schema:n,onSubmit:o,onBack:r}=t;let s,i,a;e[0]!==n?(s=sD(n),e[0]=n,e[1]=s):s=e[1],e[2]!==n?(i=R3(n),e[2]=n,e[3]=i):i=e[3],e[4]!==s||e[5]!==i?(a={defaultValues:s,resolver:i,reValidateMode:"onChange"},e[4]=s,e[5]=i,e[6]=a):a=e[6];const l=P3(a),c=(B=[...Dg,...Rg].find(A=>A.schema===n))==null?void 0:B.connectionLibraries,[d,h]=M.useState((c==null?void 0:c.preferred)??"sqlalchemy"),{createNewCell:f}=lt(),m=hs();let g;e[7]!==f||e[8]!==m?(g=A=>{f({code:A,before:!1,cellId:m??"__end__",skipIfCodeExists:!0})},e[7]=f,e[8]=m,e[9]=g):g=e[9];const x=g;let p;e[10]!==x||e[11]!==o||e[12]!==d?(p=A=>{x(function(U,V){if(!(V in Ag))throw new Error(`Unsupported library: ${V}`);eS.parse(U);const X=new xS,Y=X.createGenerator(U,V),G=Y.generateConnectionCode(),W=X.secrets,J=[...new Set([...W.imports,...Y.imports])].sort();J.push("");const $=W.formatSecrets();return $&&J.push($),J.push(G.trim()),J.join(`
|
|
98
|
-
`)}(A,d)),o()},e[10]=x,e[11]=o,e[12]=d,e[13]=p):p=e[13];const b=p;let y;e[14]!==l||e[15]!==b?(y=l.handleSubmit(b),e[14]=l,e[15]=b,e[16]=y):y=e[16];let v,w;e[17]===Symbol.for("react.memo_cache_sentinel")?(v=u.jsx(iD,{}),e[17]=v):v=e[17],e[18]!==l||e[19]!==n?(w=u.jsx(yS,{children:u.jsx(aD,{schema:n,form:l,renderers:NS,children:v})}),e[18]=l,e[19]=n,e[20]=w):w=e[20];let j;e[21]!==r?(j=u.jsx(ve,{type:"button",variant:"outline",onClick:r,children:"Back"}),e[21]=r,e[22]=j):j=e[22];const C=!l.formState.isValid;let N,S;e[23]!==C?(N=u.jsx(ve,{type:"submit",disabled:C,children:"Add"}),e[23]=C,e[24]=N):N=e[24],e[25]!==j||e[26]!==N?(S=u.jsxs("div",{className:"flex gap-2",children:[j,N]}),e[25]=j,e[26]=N,e[27]=S):S=e[27];const E=lc;let T,I;e[28]===Symbol.for("react.memo_cache_sentinel")?(T=A=>h(A),e[28]=T):T=e[28],e[29]===Symbol.for("react.memo_cache_sentinel")?(I=u.jsxs("div",{className:"flex flex-col gap-1 items-end",children:[u.jsx(cc,{children:u.jsx(wm,{placeholder:"Select a library"})}),u.jsx("span",{className:"text-xs text-muted-foreground",children:"Preferred connection library"})]}),e[29]=I):I=e[29];const D=dc,F=Cm,O=c==null?void 0:c.libraries.map(IS);let R,P,z,_,k;return e[30]!==F||e[31]!==O?(R=u.jsx(F,{children:O}),e[30]=F,e[31]=O,e[32]=R):R=e[32],e[33]!==D||e[34]!==R?(P=u.jsx(D,{children:R}),e[33]=D,e[34]=R,e[35]=P):P=e[35],e[36]!==E||e[37]!==d||e[38]!==T||e[39]!==I||e[40]!==P?(z=u.jsx("div",{children:u.jsxs(E,{value:d,onValueChange:T,children:[I,P]})}),e[36]=E,e[37]=d,e[38]=T,e[39]=I,e[40]=P,e[41]=z):z=e[41],e[42]!==S||e[43]!==z?(_=u.jsxs("div",{className:"flex gap-2 justify-between",children:[S,z]}),e[42]=S,e[43]=z,e[44]=_):_=e[44],e[45]!==_||e[46]!==y||e[47]!==w?(k=u.jsxs("form",{onSubmit:y,className:"space-y-4",children:[w,_]}),e[45]=_,e[46]=y,e[47]=w,e[48]=k):k=e[48],k},_S=t=>{const e=H.c(5),{onSubmit:n}=t,[o,r]=M.useState(null);if(!o){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(SS,{onSelect:r}),e[0]=a):a=e[0],a}let s,i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=()=>r(null),e[1]=s):s=e[1],e[2]!==n||e[3]!==o?(i=u.jsx(ES,{schema:o,onSubmit:n,onBack:s}),e[2]=n,e[3]=o,e[4]=i):i=e[4],i},Pg=t=>{const e=H.c(6),{children:n}=t,[o,r]=M.useState(!1);let s,i,a;return e[0]!==n?(s=u.jsx(lD,{asChild:!0,children:n}),e[0]=n,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(Lg,{onClose:()=>r(!1)}),e[2]=i):i=e[2],e[3]!==o||e[4]!==s?(a=u.jsxs(cD,{open:o,onOpenChange:r,children:[s,i]}),e[3]=o,e[4]=s,e[5]=a):a=e[5],a},Lg=t=>{const e=H.c(4),{onClose:n}=t;let o,r,s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(Wo,{children:"Add Connection"}),e[0]=o):o=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsxs(ls,{className:"mb-4",children:[o,u.jsxs(cs,{children:["Connect to your database or data catalog to query data directly from your notebook. Learn more about how to connect to your database in our"," ",u.jsx(km,{href:"https://docs.marimo.io/guides/working_with_data/sql/#connecting-to-a-custom-database",children:"docs."})]})]}),e[1]=r):r=e[1],e[2]!==n?(s=u.jsxs(Go,{className:"max-h-[75vh] overflow-y-auto",children:[r,u.jsx(_S,{onSubmit:()=>n()})]}),e[2]=n,e[3]=s):s=e[3],s};function IS(t){return u.jsx(uc,{value:t,children:Ag[t]},t)}const AS=()=>{const t=H.c(7),{selectedLayout:e}=vj(),{setLayoutView:n}=wj();if(tn()&&!jm("wasm_layouts"))return null;let o,r,s,i;return t[0]!==n?(o=a=>n(a),t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(cc,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:u.jsx(wm,{placeholder:"Select a view"})}),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx(dc,{children:u.jsxs(Cm,{children:[u.jsx(F3,{children:"View as"}),kj.map(MS)]})}),t[3]=s):s=t[3],t[4]!==e||t[5]!==o?(i=u.jsxs(lc,{"data-testid":"layout-select",value:e,onValueChange:o,children:[r,s]}),t[4]=e,t[5]=o,t[6]=i):i=t[6],i};function TS(t){const e=Fg(t);return u.jsx(e,{className:"h-4 w-4"})}function Fg(t){switch(t){case"vertical":return Dp;case"grid":return lF;case"slides":return id;default:return hc(t),fc}}function zg(t){return Sm(t)}function MS(t){return u.jsx(uc,{value:t,children:u.jsxs("div",{className:"flex items-center gap-1.5 leading-5",children:[TS(t),u.jsx("span",{children:zg(t)})]})},t)}const OS=()=>{const{updateCellConfig:t}=lt(),{saveCellConfig:e}=nt();return M.useCallback(async()=>{const n=new Bi,o=bn(),r=o.cellIds.inOrderIds,s={};for(const a of r){if(o.cellData[a]===void 0)continue;const{code:l,config:c}=o.cellData[a];c.hide_code||n.isSupported(l)&&(s[a]={hide_code:!0})}const i=sc.entries(s);if(i.length!==0){await e({configs:s});for(const[a,l]of i)t({cellId:a,config:l})}},[t])};function Bg(){const t=H.c(4),{openConfirm:e}=An(),n=Ct(ln),{sendRestart:o}=nt();let r;return t[0]!==e||t[1]!==o||t[2]!==n?(r=()=>{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:u.jsx(z3,{onClick:async()=>{n({state:Bt.CLOSING}),await o(),dD()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=o,t[2]=n,t[3]=r):r=t[3],r}const Ds=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function Ug(){var X,Y;const t=H.c(39),e=Nm(),{openModal:n,closeModal:o}=An(),{toggleApplication:r}=Ui(),{selectedPanel:s}=pc(),[i]=zt(cm),a=Ne(ds),l=OS(),[c]=xr(),{updateCellConfig:d,undoDeleteCell:h,clearAllCellOutputs:f,upsertSetupCell:m,collapseAllCells:g,expandAllCells:x}=lt(),p=Bg(),b=ag(),y=function(G){const W=H.c(5),{openPrompt:J,closeModal:$}=An(),{sendCopy:Q}=nt();let te;return W[0]!==$||W[1]!==J||W[2]!==Q||W[3]!==G?(te=()=>{if(!G)return null;const oe=mc.guessDeliminator(G),ne=yn.basename(G);J({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${ne}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:ie=>{const se=oe.join(yn.dirname(G),ie);Q({source:G,destination:se}).then(()=>{$(),Je({title:"Notebook copied",description:"A copy of the notebook has been created."}),fj(se)})}})},W[0]=$,W[1]=J,W[2]=Q,W[3]=G,W[4]=te):te=W[4],te}(e),v=Ct(pd),w=Ct(cF),j=Ct(dF),{exportAsMarkdown:C,readCode:N,saveCellConfig:S}=nt(),E=Ne(uD),T=Ne(hD),I=Ne(B3),{selectedLayout:D}=vj(),{setLayoutView:F}=wj(),O=ig(),R=((X=c.sharing)==null?void 0:X.html)??!0,P=((Y=c.sharing)==null?void 0:Y.wasm)??!0,z=QS;let _;t[0]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(Yp,{size:14,strokeWidth:1.5}),t[0]=_):_=t[0];const k=!R&&!P;let B;t[1]===Symbol.for("react.memo_cache_sentinel")?(B=u.jsx(xD,{size:14,strokeWidth:1.5}),t[1]=B):B=t[1];const A=!R;let U,V;return t[2]!==o||t[3]!==n?(U=async()=>{n(u.jsx(Bj,{onClose:o}))},t[2]=o,t[3]=n,t[4]=U):U=t[4],t[5]!==I||t[6]!==f||t[7]!==o||t[8]!==g||t[9]!==y||t[10]!==x||t[11]!==C||t[12]!==e||t[13]!==E||t[14]!==T||t[15]!==l||t[16]!==a||t[17]!==n||t[18]!==N||t[19]!==p||t[20]!==b||t[21]!==S||t[22]!==D||t[23]!==s||t[24]!==v||t[25]!==j||t[26]!==F||t[27]!==w||t[28]!==P||t[29]!==k||t[30]!==A||t[31]!==U||t[32]!==r||t[33]!==O||t[34]!==h||t[35]!==d||t[36]!==m||t[37]!==i.mode?(V=[{icon:_,label:"Share",handle:Ds,hidden:k,dropdown:[{icon:B,label:"Publish HTML to web",hidden:A,handle:U},{icon:u.jsx(hj,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!P,handle:async()=>{const W=await N(),J=fD({code:W.contents});await sn(J),Je({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:u.jsx(Em,{size:14,strokeWidth:1.5}),label:"Download",handle:Ds,dropdown:[{icon:u.jsx(jj,{size:14,strokeWidth:1.5}),label:"Download as HTML",handle:async()=>{e?await Cj({filename:e,includeCode:!0}):Je({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:u.jsx(jj,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{e?await Cj({filename:e,includeCode:!1}):Je({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:u.jsx(tc,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{const W=await C({download:!1});$i(new Blob([W],{type:"text/plain"}),U3.toMarkdown(document.title))}},{icon:u.jsx(vp,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{const W=await N();$i(new Blob([W.contents],{type:"text/plain"}),U3.toPY(document.title))}},{divider:!0,icon:u.jsx(cp,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:i.mode!=="present",tooltip:i.mode==="present"?void 0:u.jsxs("span",{children:["Only available in app view. ",u.jsx("br",{}),"Toggle with: ",Gt("global.hideCode",!1)]}),handle:ZS},{icon:u.jsx(mD,{size:14,strokeWidth:1.5}),label:"Download as PDF",disabled:i.mode!=="present",tooltip:i.mode==="present"?void 0:u.jsxs("span",{children:["Only available in app view. ",u.jsx("br",{}),"Toggle with: ",Gt("global.hideCode",!1)]}),handle:XS}]},{divider:!0,icon:u.jsx($p,{size:14,strokeWidth:1.5}),label:"Helper panel",handle:Ds,dropdown:hd.flatMap(W=>{const{type:J,Icon:$,hidden:Q}=W;return Q?[]:{label:Sm(J),rightElement:z(s===J),icon:u.jsx($,{size:14,strokeWidth:1.5}),handle:()=>r(J)}})},{icon:u.jsx(id,{size:14,strokeWidth:1.5}),label:"Present as",handle:Ds,dropdown:[{icon:i.mode==="present"?u.jsx($3,{size:14,strokeWidth:1.5}):u.jsx(od,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{O()}},...kj.map((W,J)=>{const $=Fg(W);return{divider:J===0,label:zg(W),icon:u.jsx($,{size:14,strokeWidth:1.5}),rightElement:u.jsx("div",{className:"w-8 flex justify-end",children:D===W&&u.jsx(gc,{size:14})}),handle:()=>{F(W),i.mode==="edit"&&O()}}})]},{icon:u.jsx(Np,{size:14,strokeWidth:1.5}),label:"Create notebook copy",hidden:!e||tn(),handle:y},{icon:u.jsx(Zc,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:async()=>{const W=await N();await sn(W.contents),Je({title:"Copied",description:"Code copied to clipboard."})}},{icon:u.jsx(hn,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!E||a,handle:async()=>{const W=bn(),J=pD(W),$=sc.fromEntries(J.map(KS));await S({configs:$});for(const Q of J)d({cellId:Q,config:{disabled:!1}})}},{icon:u.jsx(un,{size:14,strokeWidth:1.5}),label:"Disable all cells",hidden:!T||a,handle:async()=>{const W=bn(),J=g3(W),$=sc.fromEntries(J.map(YS));await S({configs:$});for(const Q of J)d({cellId:Q,config:{disabled:!0}})}},{icon:u.jsx(mm,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:l},{icon:u.jsx(bp,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:g},{icon:u.jsx(xp,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:x},{icon:u.jsx(kp,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{m({code:"# Initialization code that runs before all other cells"})}},{icon:u.jsx(Di,{size:14,strokeWidth:1.5}),label:"Clear all outputs",handle:()=>{f()}},{icon:u.jsx(jp,{size:14,strokeWidth:1.5}),label:"Re-run all cells",hotkey:"global.runAll",handle:async()=>{b()}},{icon:u.jsx(dd,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!I||a,handle:()=>{h()}},{icon:u.jsx(Yo,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n(u.jsx(Lg,{onClose:o}))}},{divider:!0,icon:u.jsx(Qc,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(GS)},{icon:u.jsx(_m,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>w(qS)},{icon:u.jsx(Op,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>j(WS)},{icon:u.jsx(mj,{size:14,strokeWidth:1.5}),label:"Open documentation",handle:HS},{icon:u.jsx(xc,{size:14,strokeWidth:1.5}),label:"Resources",handle:Ds,dropdown:[{icon:u.jsx(mj,{size:14,strokeWidth:1.5}),label:"Documentation",handle:VS},{icon:u.jsx(uF,{size:14,strokeWidth:1.5}),label:"GitHub",handle:$S},{icon:u.jsx(hF,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:US},{icon:u.jsx(fF,{size:14,strokeWidth:1.5}),label:"YouTube",handle:BS},{icon:u.jsx(um,{size:14,strokeWidth:1.5}),label:"Changelog",handle:zS}]},{divider:!0,icon:u.jsx(Tp,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:FS},{icon:u.jsx(ua,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:LS},{icon:u.jsx(eg,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:p}].filter(PS).map(DS),t[5]=I,t[6]=f,t[7]=o,t[8]=g,t[9]=y,t[10]=x,t[11]=C,t[12]=e,t[13]=E,t[14]=T,t[15]=l,t[16]=a,t[17]=n,t[18]=N,t[19]=p,t[20]=b,t[21]=S,t[22]=D,t[23]=s,t[24]=v,t[25]=j,t[26]=F,t[27]=w,t[28]=P,t[29]=k,t[30]=A,t[31]=U,t[32]=r,t[33]=O,t[34]=h,t[35]=d,t[36]=m,t[37]=i.mode,t[38]=V):V=t[38],V}function DS(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(RS)}:t}function RS(t){return!t.hidden}function PS(t){return!t.hidden}function LS(){const t=gD();window.open(t,"_blank")}function FS(){const t=document.baseURI.split("?")[0];window.open(t,"_self")}function zS(){window.open(Fn.releasesPage,"_blank")}function BS(){window.open(Fn.youtube,"_blank")}function US(){window.open(Fn.discordLink,"_blank")}function $S(){window.open(Fn.githubPage,"_blank")}function VS(){window.open(Fn.docsPage,"_blank")}function HS(){window.open(Fn.docsPage,"_blank")}function WS(t){return!t}function qS(t){return!t}function GS(t){return!t}function YS(t){return[t,{disabled:!0}]}function KS(t){return[t,{disabled:!1}]}async function XS(){const t=new Event("export-beforeprint"),e=new Event("export-afterprint");window.dispatchEvent(t),setTimeout(JS,0),setTimeout(()=>window.dispatchEvent(e),0)}function JS(){return window.print()}async function ZS(){const t=document.getElementById("App");t&&await v3(t,document.title)}function QS(t){return u.jsx("div",{className:"w-8 flex justify-end",children:t&&u.jsx(gc,{size:14})})}const e4=t=>{const e=H.c(28),{disabled:n,tooltip:o}=t,r=n!==void 0&&n,s=o===void 0?"Actions":o,i=Ug();let a,l,c;e[0]!==s?(a=u.jsx("div",{children:s}),e[0]=s,e[1]=a):a=e[1],e[2]!==r?(l=!r&&u.jsxs("div",{className:"text-xs text-muted-foreground font-medium pt-1 -mt-2 border-t border-border flex items-center gap-2",children:[u.jsx("span",{children:"Open command palette"}),Gt("global.commandPalette",!1)]}),e[2]=r,e[3]=l):l=e[3],e[4]!==a||e[5]!==l?(c=u.jsxs("div",{className:"flex flex-col gap-2",children:[a,l]}),e[4]=a,e[5]=l,e[6]=c):c=e[6];const d=c,h=r?"disabled":"hint-green";let f,m,g;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(NF,{strokeWidth:1.8}),e[7]=f):f=e[7],e[8]!==d?(m=u.jsx(Ee,{content:d,children:f}),e[8]=d,e[9]=m):m=e[9],e[10]!==r||e[11]!==h||e[12]!==m?(g=u.jsx(cn,{"aria-label":"Config",shape:"circle",size:"small",className:"h-[27px] w-[27px]","data-testid":"notebook-menu-dropdown",disabled:r,color:h,children:m}),e[10]=r,e[11]=h,e[12]=m,e[13]=g):g=e[13];const x=g,p=t4;let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=E=>{const T=u.jsx(At,{variant:E.variant,disabled:E.disabled,onSelect:I=>E.handle(I),"data-testid":`notebook-menu-dropdown-${E.label}`,children:p(E)},E.label);return E.tooltip?u.jsx(Ee,{content:E.tooltip,side:"left",delayDuration:100,children:u.jsx("span",{children:T})},E.label):T},e[14]=b):b=e[14];const y=b;let v,w,j,C,N,S;if(e[15]!==x||e[16]!==r?(v=u.jsx(_o,{asChild:!0,disabled:r,children:x}),e[15]=x,e[16]=r,e[17]=v):v=e[17],e[18]!==i){let E;e[20]===Symbol.for("react.memo_cache_sentinel")?(E=T=>T.hidden?null:T.dropdown?u.jsxs(bD,{children:[u.jsx(yD,{"data-testid":`notebook-menu-dropdown-${T.label}`,children:p(T)}),u.jsx(vD,{children:u.jsx(wD,{children:T.dropdown.map(I=>u.jsxs(q.Fragment,{children:[I.divider&&u.jsx(an,{}),y(I)]},I.label))})})]},T.label):u.jsxs(q.Fragment,{children:[T.divider&&u.jsx(an,{}),y(T)]},T.label),e[20]=E):E=e[20],w=i.map(E),e[18]=i,e[19]=w}else w=e[19];return e[21]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx(an,{}),e[21]=j):j=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(C=u.jsx("div",{className:"flex-1 px-2 text-xs text-muted-foreground",children:u.jsxs("span",{children:["Version: ",V3()]})}),e[22]=C):C=e[22],e[23]!==w?(N=u.jsxs(Io,{align:"end",className:"no-print w-[240px]",children:[w,j,C]}),e[23]=w,e[24]=N):N=e[24],e[25]!==v||e[26]!==N?(S=u.jsxs(Eo,{modal:!1,children:[v,N]}),e[25]=v,e[26]=N,e[27]=S):S=e[27],S};function t4(t){return u.jsxs(u.Fragment,{children:[t.icon&&u.jsx("span",{className:"flex-0 mr-2",children:t.icon}),u.jsx("span",{className:"flex-1",children:t.labelElement||t.label}),t.hotkey&&u.jsx(Im,{shortcut:t.hotkey,className:"ml-4"}),t.rightElement]})}function bd(t){return Un("create"in t,'Expected query to have a "create" method'),t}const $t=kD({findText:"",replaceText:"",caseSensitive:!1,wholeWord:!1,regexp:!1,isOpen:!1,currentView:void 0},(t,e)=>{if(e===void 0)return t;switch(e.type){case"setFind":return{...t,findText:e.find};case"setReplace":return{...t,replaceText:e.replace};case"setCaseSensitive":return{...t,caseSensitive:e.caseSensitive};case"setWholeWord":return{...t,wholeWord:e.wholeWord};case"setRegex":return{...t,regexp:e.regexp};case"setIsOpen":return{...t,isOpen:e.isOpen};case"setCurrentView":return{...t,currentView:{view:e.view,range:e.range}};case"clearCurrentView":return{...t,currentView:void 0}}});function $g(t){if([...document.querySelectorAll('[role="dialog"][data-state="open"]')].some(e=>e instanceof HTMLElement&&e.childNodes.length>0))return!1;if(t){const e=t.state.selection.main,n=t.state.sliceDoc(e.from,e.to);n?(Qe.set($t,{type:"setFind",find:n}),Qe.set($t,{type:"setCurrentView",view:t,range:{from:e.from,to:e.to}})):Qe.set($t,{type:"setCurrentView",view:t,range:{from:0,to:0}})}return Qe.get($t).isOpen?(Qe.set($t,{type:"setIsOpen",isOpen:!1}),requestAnimationFrame(()=>{Qe.set($t,{type:"setIsOpen",isOpen:!0})}),!0):(Qe.set($t,{type:"setIsOpen",isOpen:!0}),!0)}function n4(){return!!Qe.get($t).isOpen&&(Qe.set($t,{type:"setIsOpen",isOpen:!1}),!0)}function ka(t){return()=>{const e=Qe.get($t),n=new bc({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord});return!!n.valid&&t({query:bd(n).create(),search:n})}}const Vg=t=>ka(({query:e})=>{const n=fs(),o=Qe.get($t).currentView||{view:n[0],range:{from:0,to:0}};let r=o.range.to;t==="prev"&&(n.reverse(),r=o.range.from);let s=n.indexOf(o.view);s<0&&(s=0);const i=[...n,...n].slice(s);for(const a of i){const l=t==="next"?e.nextMatch(a.state,0,r??0):e.prevMatch(a.state,r??a.state.doc.length,a.state.doc.length);if(!l){r=null,a.dispatch({selection:Qn.single(0)});continue}const c=Qn.single(l.from,l.to);return a.dispatch({selection:c,effects:[We.scrollIntoView(c.main,{y:"center"})],userEvent:"select.search"}),Qe.set($t,{type:"setCurrentView",view:a,range:{from:l.from,to:l.to}}),l}return!1}),yd=Vg("next"),Hg=Vg("prev"),o4=ka(({query:t})=>{var o;const e=fs(),n=[];for(const r of e){if(r.state.readOnly)continue;const s=(o=t.matchAll(r.state,1e9))==null?void 0:o.map(a=>{const{from:l,to:c}=a;return{from:l,to:c,insert:t.getReplacement(a)}});if(!s||s.length===0)continue;const i=r.state.doc.toString();n.push(()=>{r.dispatch({changes:[{from:0,to:r.state.doc.length,insert:i}],userEvent:"input.replace.all"})}),r.dispatch({changes:s,userEvent:"input.replace.all"})}return()=>{for(const r of n)r()}}),r4=ka(({query:t})=>{const e=fs(),n=Qe.get($t).currentView||{view:e[0],range:{from:0}};let o=n.range.from,r=e.indexOf(n.view);r<0&&(r=0);const s=[...e,...e].slice(r);for(const i of s){const a=t.nextMatch(i.state,0,o??0);if(!a){o=null,i.dispatch({selection:Qn.single(0)});continue}const l=i.state.toText(t.getReplacement(a));return i.dispatch({changes:[{from:a.from,to:a.to,insert:l}],userEvent:"input.replace"}),yd()}return!1}),s4=ka(({query:t})=>{const e=fs();let n=0;const o=new Map;for(const r of e){const s=t.matchAll(r.state,1e9)||[];for(const i of s){const{from:a,to:l}=i,c=o.get(r)||new Map;c.set(`${a}:${l}`,n++),o.set(r,c)}}return{count:n,position:o}}),vd=Tt.define();function Wg(){const t=fs();for(const e of t)e.state.readOnly||e.dispatch({effects:vd.of(new bc({search:""}))})}const Ca=vn.define({create(){const t=Qe.get($t);return bd(new bc({search:t.findText,caseSensitive:t.caseSensitive,regexp:t.regexp,replace:t.replaceText,wholeWord:t.wholeWord})).create()},update(t,e){for(const n of e.effects)n.is(vd)&&(t=bd(n.value).create());return t}}),i4=ot.mark({class:"cm-searchMatch"}),a4=ot.mark({class:"cm-searchMatch cm-searchMatch-selected"}),l4=$n.fromClass(class{constructor(t){this.view=t,this.decorations=void 0,this.decorations=this.highlight(t.state.field(Ca))}update(t){const e=t.state.field(Ca);(e!==t.startState.field(Ca)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight(t){if(!t.spec.valid)return ot.none;const{view:e}=this,n=new ms,o=e.visibleRanges,r=o.length;for(let s=0;s<r;s++){let{to:i}=o[s];const{from:a}=o[s];for(;s<r-1&&i>o[s+1].from-500;)i=o[++s].to;t.highlight(e.state,a,i,(l,c)=>{const d=e.state.selection.ranges.some(h=>h.from===l&&h.to===c);n.add(l,c,d?a4:i4)})}return n.finish()}},{decorations:t=>t.decorations}),c4=We.baseTheme({"&light .cm-searchMatch":{backgroundColor:"#99ff7780"},"&dark .cm-searchMatch":{backgroundColor:"#22bb0070"},"&light .cm-searchMatch-selected":{backgroundColor:"transparent"},"&dark .cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff88 !important"}}),d4=()=>{var Ie;const t=H.c(102),[e,n]=M.useState(!1),[o,r]=zt($t),[s,i]=M.useState(),a=M.useRef(null),l=Ne(Fi);let c,d;t[0]!==e||t[1]!==o.isOpen?(c=()=>(!e||!o.isOpen)&&$g(),t[0]=e,t[1]=o.isOpen,t[2]=c):c=t[2],Dt("cell.findAndReplace",c),t[3]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{const ke=s4();i(ke===!1?void 0:ke)},t[3]=d):d=t[3];const h=d;let f,m,g,x;if(t[4]!==o.isOpen?(f=()=>{o.isOpen&&a.current&&(a.current.focus(),a.current.select())},m=[o.isOpen],t[4]=o.isOpen,t[5]=f,t[6]=m):(f=t[5],m=t[6]),M.useEffect(f,m),t[7]!==o.findText||t[8]!==o.isOpen?(g=()=>{if(o.isOpen){if(o.findText==="")return i(void 0),void Wg();h(),function(){const ke=Qe.get($t),Ye=fs();for(const Ve of Ye)Ve.state.readOnly||Ve.dispatch({effects:vd.of(new bc({search:ke.findText,caseSensitive:ke.caseSensitive,regexp:ke.regexp,replace:ke.replaceText,wholeWord:ke.wholeWord}))})}()}else Wg()},t[7]=o.findText,t[8]=o.isOpen,t[9]=g):g=t[9],t[10]!==o.caseSensitive||t[11]!==o.findText||t[12]!==o.isOpen||t[13]!==o.regexp||t[14]!==o.wholeWord?(x=[o.findText,o.isOpen,o.caseSensitive,o.regexp,o.wholeWord],t[10]=o.caseSensitive,t[11]=o.findText,t[12]=o.isOpen,t[13]=o.regexp,t[14]=o.wholeWord,t[15]=x):x=t[15],M.useEffect(g,x),!o.isOpen)return null;const p=o.currentView;let b;t[16]!==s||t[17]!==p?(b=p&&s?(Ie=s.position.get(p.view))==null?void 0:Ie.get(`${p.range.from}:${p.range.to}`):void 0,t[16]=s,t[17]=p,t[18]=b):b=t[18];const y=b;let v,w,j,C,N,S,E,T,I,D,F;t[19]===Symbol.for("react.memo_cache_sentinel")?(v=()=>n(!0),t[19]=v):v=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(w=()=>n(!1),t[20]=w):w=t[20],t[21]!==r?(j=ke=>{ke.key==="Escape"&&r({type:"setIsOpen",isOpen:!1})},t[21]=r,t[22]=j):j=t[22],t[23]!==r?(C=()=>r({type:"setIsOpen",isOpen:!1}),t[23]=r,t[24]=C):C=t[24],t[25]===Symbol.for("react.memo_cache_sentinel")?(N=u.jsx(wn,{className:"w-4 h-4"}),t[25]=N):N=t[25],t[26]!==C?(S=u.jsx("div",{className:"absolute top-0 right-0",children:u.jsx(ve,{"data-testid":"close-find-replace-button",onClick:C,size:"xs",variant:"text",children:N})}),t[26]=C,t[27]=S):S=t[27],t[28]!==r?(E=ke=>{r({type:"setFind",find:ke.target.value})},t[28]=r,t[29]=E):E=t[29],t[30]!==o.findText||t[31]!==E?(T=u.jsx(qo,{ref:a,"data-testid":"find-input",value:o.findText,autoFocus:!0,className:"mr-2 mb-0",placeholder:"Find",onKeyDown:h4,onChange:E}),t[30]=o.findText,t[31]=E,t[32]=T):T=t[32],t[33]!==r?(I=ke=>{r({type:"setReplace",replace:ke.target.value})},t[33]=r,t[34]=I):I=t[34],t[35]!==o.replaceText||t[36]!==I?(D=u.jsx(qo,{"data-testid":"replace-input",value:o.replaceText,placeholder:"Replace",onChange:I}),t[35]=o.replaceText,t[36]=I,t[37]=D):D=t[37],t[38]!==T||t[39]!==D?(F=u.jsxs("div",{className:"flex flex-col flex-2 gap-2 w-[55%]",children:[T,D]}),t[38]=T,t[39]=D,t[40]=F):F=t[40];const O=o.caseSensitive?"on":"off";let R,P,z;t[41]!==r?(R=ke=>r({type:"setCaseSensitive",caseSensitive:ke}),t[41]=r,t[42]=R):R=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(P=u.jsx(CD,{className:"w-4 h-4"}),t[43]=P):P=t[43],t[44]!==o.caseSensitive||t[45]!==O||t[46]!==R?(z=u.jsx(Ee,{content:"Case Sensitive",children:u.jsx(Am,{size:"sm",pressed:o.caseSensitive,"data-state":O,onPressedChange:R,children:P})}),t[44]=o.caseSensitive,t[45]=O,t[46]=R,t[47]=z):z=t[47];const _=o.wholeWord?"on":"off";let k,B,A;t[48]!==r?(k=ke=>r({type:"setWholeWord",wholeWord:ke}),t[48]=r,t[49]=k):k=t[49],t[50]===Symbol.for("react.memo_cache_sentinel")?(B=u.jsx(sg,{className:"w-4 h-4"}),t[50]=B):B=t[50],t[51]!==o.wholeWord||t[52]!==_||t[53]!==k?(A=u.jsx(Ee,{content:"Match Whole Word",children:u.jsx(Am,{size:"sm",pressed:o.wholeWord,"data-state":_,onPressedChange:k,children:B})}),t[51]=o.wholeWord,t[52]=_,t[53]=k,t[54]=A):A=t[54];const U=o.regexp?"on":"off";let V,X,Y,G,W;t[55]!==r?(V=ke=>r({type:"setRegex",regexp:ke}),t[55]=r,t[56]=V):V=t[56],t[57]===Symbol.for("react.memo_cache_sentinel")?(X=u.jsx(Wp,{className:"w-4 h-4"}),t[57]=X):X=t[57],t[58]!==o.regexp||t[59]!==U||t[60]!==V?(Y=u.jsx(Ee,{content:"Use Regular Expression",children:u.jsx(Am,{size:"sm",pressed:o.regexp,"data-state":U,onPressedChange:V,children:X})}),t[58]=o.regexp,t[59]=U,t[60]=V,t[61]=Y):Y=t[61],t[62]!==z||t[63]!==A||t[64]!==Y?(G=u.jsxs("div",{className:"flex items-center gap-[2px]",children:[z,A,Y]}),t[62]=z,t[63]=A,t[64]=Y,t[65]=G):G=t[65],t[66]===Symbol.for("react.memo_cache_sentinel")?(W=()=>{r4()&&h()},t[66]=W):W=t[66];const J=o.findText==="";let $,Q;t[67]!==J?($=u.jsx(ve,{"data-testid":"replace-next-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:W,disabled:J,children:"Replace Next"}),t[67]=J,t[68]=$):$=t[68],t[69]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>{const ke=o4();if(!ke)return;h();const{dismiss:Ye}=Je({title:"Replaced all occurrences",action:u.jsx(ba,{"data-testid":"undo-replace-all-button",onClick:()=>{ke(),Ve()}})}),Ve=Ye},t[69]=Q):Q=t[69];const te=o.findText==="";let oe,ne,ie,se,ae,fe,re,ue,le,je,Se,Le;return t[70]!==te?(oe=u.jsx(ve,{"data-testid":"replace-all-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:Q,disabled:te,children:"Replace All"}),t[70]=te,t[71]=oe):oe=t[71],t[72]!==$||t[73]!==oe?(ne=u.jsxs("div",{className:"flex items-center gap-[2px]",children:[$,oe]}),t[72]=$,t[73]=oe,t[74]=ne):ne=t[74],t[75]!==G||t[76]!==ne?(ie=u.jsxs("div",{className:"flex flex-col gap-2",children:[G,ne]}),t[75]=G,t[76]=ne,t[77]=ie):ie=t[77],t[78]!==F||t[79]!==ie?(se=u.jsxs("div",{className:"flex items-center gap-3",children:[F,ie]}),t[78]=F,t[79]=ie,t[80]=se):se=t[80],t[81]===Symbol.for("react.memo_cache_sentinel")?(ae=u.jsx(Ee,{content:"Find Previous",children:u.jsx(ve,{"data-testid":"find-prev-button",size:"xs",variant:"secondary",onClick:f4,children:u.jsx(wt,{className:"w-4 h-4"})})}),t[81]=ae):ae=t[81],t[82]===Symbol.for("react.memo_cache_sentinel")?(fe=u.jsx(Ee,{content:"Find Next",children:u.jsx(ve,{"data-testid":"find-next-button",size:"xs",variant:"secondary",onClick:m4,children:u.jsx(Kc,{className:"w-4 h-4"})})}),t[82]=fe):fe=t[82],t[83]!==y||t[84]!==s?(re=s!=null&&y==null&&u.jsxs("span",{className:"text-sm",children:[s.count," matches"]}),t[83]=y,t[84]=s,t[85]=re):re=t[85],t[86]!==y||t[87]!==s?(ue=s!=null&&y!=null&&u.jsxs("span",{className:"text-sm",children:[y+1," of ",s.count]}),t[86]=y,t[87]=s,t[88]=ue):ue=t[88],t[89]!==re||t[90]!==ue?(le=u.jsxs("div",{className:"flex items-center gap-2",children:[ae,fe,re,ue]}),t[89]=re,t[90]=ue,t[91]=le):le=t[91],t[92]!==l?(je=l.getHotkey("cell.findAndReplace"),t[92]=l,t[93]=je):je=t[93],t[94]!==je.key?(Se=u.jsxs("div",{className:"text-xs text-muted-foreground flex gap-1 mt-2",children:["Press"," ",u.jsx(bm,{shortcut:je.key})," ","again to open the native browser search."]}),t[94]=je.key,t[95]=Se):Se=t[95],t[96]!==S||t[97]!==se||t[98]!==le||t[99]!==Se||t[100]!==j?(Le=u.jsx(Tm,{restoreFocus:!0,autoFocus:!0,children:u.jsxs("div",{onFocus:v,onClick:u4,onBlur:w,className:"fixed top-0 right-0 w-[500px] flex flex-col bg-(--sage-1) p-4 z-50 mt-2 mr-3 rounded-md shadow-lg border gap-2 print:hidden",onKeyDown:j,children:[S,se,le,Se]})}),t[96]=S,t[97]=se,t[98]=le,t[99]=Se,t[100]=j,t[101]=Le):Le=t[101],Le};function u4(t){t.stopPropagation(),t.preventDefault()}function h4(t){t.key==="Enter"&&(t.shiftKey?Hg():yd())}function f4(){return Hg()}function m4(){return yd()}const qg=t=>{const e=H.c(41),{resetOnBlur:n,placeholderText:o,initialValue:r,flexibleWidth:s,onNameChange:i,className:a}=t,l=n!==void 0&&n,c=r===void 0?null:r,d=s!==void 0&&s,{sendListFiles:h}=nt(),[f,m]=M.useState(c);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[0]=g):g=e[0];const[x,p]=M.useState(g),[b,y]=M.useState(!1),v=M.useRef(null),w=M.useRef(!1);let j,C,N;e[1]!==c?(j=()=>{m(c)},C=[c],e[1]=c,e[2]=j,e[3]=C):(j=e[2],C=e[3]),M.useEffect(j,C),e[4]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{y(!0)},e[4]=N):N=e[4];const S=N;let E;e[5]!==c||e[6]!==l?(E=te=>{var oe;(oe=te.relatedTarget)!=null&&oe.closest(".filename-input")||(y(!1),l&&m(c))},e[5]=c,e[6]=l,e[7]=E):E=e[7];const T=E;let I;e[8]!==f?(I=yn.dirname(f||""),e[8]=f,e[9]=I):I=e[9];const D=I,F=yn.basename(f||""),O=x.filter(te=>yn.basename(te.path).startsWith(F));let R,P;e[10]!==D||e[11]!==b||e[12]!==h?(R=async()=>{if(!b)return void p([]);const te=await h({path:D});p(te.files)},e[10]=D,e[11]=b,e[12]=h,e[13]=R):R=e[13],e[14]!==D||e[15]!==b?(P=[D,b],e[14]=D,e[15]=b,e[16]=P):P=e[16];const{isPending:z}=Tn(R,P),_=function(te,oe,ne){if(te&&!te.endsWith("/")&&((jm("markdown")?new Set(["py","md","markdown","qmd"]):new Set(["py"])).has(yn.extension(te))||(te=te.endsWith(".")?`${te}py`:te.endsWith(".p")?`${te}y`:`${te}.py`),!oe.some(ie=>ie.path===te||yn.basename(ie.path)===te)&&!(ne&&(ne===te||yn.basename(ne)===te))))return te}(f,x,c),k=(_||O.length>0)&&u.jsxs(xm,{className:"font-mono",children:[!z&&u.jsx(ac,{children:"No files"}),_&&u.jsxs(Zn,{variant:"success",className:"py-2 px-3",onSelect:()=>{var te;_&&(w.current=!0,i(_),(te=v.current)==null||te.blur())},children:[u.jsx(Sp,{className:"w-4 h-4 mr-2"})," ",u.jsxs("span",{className:"text-sm",children:[c?"Rename to: ":"Save as: ",u.jsx("span",{className:"font-medium text-sm",children:yn.basename(_)})]})]},"_rename_"),O.map(te=>{const oe=te.isDirectory?"directory":H3(te.path),ne=W3[oe];return u.jsxs(Zn,{variant:te.isDirectory?"default":"muted",className:"py-2 px-3",onSelect:()=>{te.isDirectory?m(`${te.path}/`):m(te.path)},children:[u.jsx(ne,{className:"w-4 h-4 mr-2"})," ",yn.basename(te.path)]},te.path)})]}),B=10*Math.max(20,(f==null?void 0:f.length)||(o==null?void 0:o.length)||0),A=b?f||"":c||"";let U,V,X;e[17]!==d||e[18]!==B?(U=d?{maxWidth:B}:void 0,e[17]=d,e[18]=B,e[19]=U):U=e[19],e[20]!==a?(V=xe(a,"w-full px-4 py-1 my-1 h-9 font-mono text-foreground/60"),e[20]=a,e[21]=V):V=e[21],e[22]!==o||e[23]!==A||e[24]!==U||e[25]!==V?(X=u.jsx(jD,{children:u.jsx(zi,{"data-testid":"dir-completion-input",tabIndex:-1,rootClassName:"border-none justify-center px-1",spellCheck:"false",value:A,onKeyDown:p4,icon:null,ref:v,onValueChange:m,placeholder:o,autoComplete:"off",style:U,className:V})}),e[22]=o,e[23]=A,e[24]=U,e[25]=V,e[26]=X):X=e[26];const Y=k&&"group-focus-within:block";let G,W,J,$,Q;return e[27]!==Y?(G=xe("p-0 w-full min-w-80 max-w-80vw hidden",Y),e[27]=Y,e[28]=G):G=e[28],e[29]!==k||e[30]!==G?(W=u.jsx(ps,{side:"bottom",className:G,portal:!1,children:k}),e[29]=k,e[30]=G,e[31]=W):W=e[31],e[32]!==X||e[33]!==W?(J=u.jsxs(xm,{children:[X,W]}),e[32]=X,e[33]=W,e[34]=J):J=e[34],e[35]!==T||e[36]!==J?($=u.jsx(yc,{onFocus:S,onBlur:T,shouldFilter:!1,id:"filename-input",className:"bg-transparent group filename-input",children:J}),e[35]=T,e[36]=J,e[37]=$):$=e[37],e[38]!==b||e[39]!==$?(Q=u.jsx(vc,{children:u.jsx(br,{open:b,modal:!1,children:$})}),e[38]=b,e[39]=$,e[40]=Q):Q=e[40],Q};function p4(t){t.key==="Escape"&&t.currentTarget.blur()}const g4=t=>{const e=H.c(33),n=()=>{$i(new Blob([o()],{type:"text/plain"}),`${t.proposedName}.json`)},o=Fe(y4);let r,s,i,a,l,c,d,h,f,m,g,x,p,b,y,v,w;return e[0]!==n||e[1]!==t?(r=j=>{j.preventDefault(),n(),t.closeModal()},e[0]=n,e[1]=t,e[2]=r):r=e[2],e[3]!==t?(s=j=>{j.key==="Escape"&&t.closeModal()},e[3]=t,e[4]=s):s=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(Wo,{className:"text-accent-foreground mb-6",children:"Download unsaved changes?"}),e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a={wordBreak:"break-word"},e[6]=a):a=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx("p",{children:"This app has unsaved changes. To recover:"}),c={paddingBottom:"10px"},e[7]=l,e[8]=c):(l=e[7],c=e[8]),e[9]!==t.proposedName?(d=u.jsxs("li",{style:c,children:['Click the "Download" button. This will download a file called\xA0',u.jsxs("code",{children:[t.proposedName,".json"]}),". This file contains your code."]}),e[9]=t.proposedName,e[10]=d):d=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(h={paddingBottom:"10px"},e[11]=h):h=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(f={display:"block",padding:"10px"},e[12]=f):f=e[12],e[13]!==t.proposedName?(m=u.jsxs("code",{style:f,children:["marimo recover ",t.proposedName,".json ",">"," ",t.proposedName,".py"]}),e[13]=t.proposedName,e[14]=m):m=e[14],e[15]!==t.proposedName?(g=u.jsxs("code",{children:[t.proposedName,".py"]}),e[15]=t.proposedName,e[16]=g):g=e[16],e[17]!==g||e[18]!==m?(x=u.jsxs("li",{style:h,children:["In your terminal, type",m,"to overwrite ",g," with the recovered changes."]}),e[17]=g,e[18]=m,e[19]=x):x=e[19],e[20]!==x||e[21]!==d?(p=u.jsx(cs,{className:"markdown break-words",style:a,children:u.jsxs("div",{className:"prose dark:prose-invert",children:[l,u.jsxs("ol",{children:[d,x]})]})}),e[20]=x,e[21]=d,e[22]=p):p=e[22],e[23]!==t.closeModal?(b=u.jsx(ve,{"aria-label":"Cancel",variant:"secondary","data-testid":"cancel-recovery-button",onClick:t.closeModal,children:"Cancel"}),e[23]=t.closeModal,e[24]=b):b=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(y=u.jsx(ve,{"data-testid":"download-recovery-button","aria-label":"Download",variant:"default",type:"submit",children:"Download"}),e[25]=y):y=e[25],e[26]!==b?(v=u.jsxs(Ti,{children:[b,y]}),e[26]=b,e[27]=v):v=e[27],e[28]!==r||e[29]!==s||e[30]!==p||e[31]!==v?(w=u.jsx(Go,{className:"w-fit",children:u.jsxs("form",{onSubmit:r,onKeyDown:s,children:[i,p,v]})}),e[28]=r,e[29]=s,e[30]=p,e[31]=v,e[32]=w):w=e[32],w},x4=t=>{const e=H.c(12),{filename:n,needsSave:o}=t,{openModal:r,closeModal:s}=An();let i;e[0]!==n?(i=n===null?"app":yn.basename(n).split(".")[0],e[0]=n,e[1]=i):i=e[1];const a=i;let l;e[2]!==s||e[3]!==o||e[4]!==r||e[5]!==a?(l=()=>{o&&r(u.jsx(g4,{proposedName:a,closeModal:s}))},e[2]=s,e[3]=o,e[4]=r,e[5]=a,e[6]=l):l=e[6];const c=l;let d;Dt("global.save",c),e[7]===Symbol.for("react.memo_cache_sentinel")?(d=Gt("global.save"),e[7]=d):d=e[7];const h=o?"yellow":"gray";let f,m;return e[8]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(fa,{strokeWidth:1.5,size:18}),e[8]=f):f=e[8],e[9]!==c||e[10]!==h?(m=u.jsx(Ee,{content:d,children:u.jsx(cn,{onClick:c,id:"save-button","aria-label":"Save",className:"rectangle",color:h,children:f})}),e[9]=c,e[10]=h,e[11]=m):m=e[11],m};function b4(t){return{id:t.id,name:t.name,code:t.code,code_hash:null,config:{column:0,...t.config}}}function y4(){const t=bn(),e=Mm(t),n={version:"1",metadata:{marimo_version:V3()},cells:e.map(b4)};return JSON.stringify(n,null,2)}const wd=5e3,kd=jt(void 0),Gg=jt(t=>{const e=t(kd);return function({state:n,layout:o,lastSavedNotebook:r}){if(!r)return!1;const{cellIds:s,cellData:i}=n,a=s.inOrderIds.map(h=>i[h]),l=a.map(h=>h.code),c=a.map(h=>h.config),d=a.map(h=>h.name);return!(q3(l,r.codes)&&q3(d,r.names)&&Vi(c,r.configs)&&Vi(o.selectedLayout,r.layout.selectedLayout)&&Vi(o.layoutData,r.layout.layoutData))}({state:t(In),layout:t(Sj),lastSavedNotebook:e})});function v4(t){return JSON.stringify(t)}const w4=t=>{const e=H.c(15),{kioskMode:n}=t,o=Nm(),r=Ne(Gg),s=Ne(ln).state===Bt.CLOSED,{saveOrNameNotebook:i,saveIfNotebookIsPersistent:a}=Cd();let l,c,d;e[0]!==n||e[1]!==a?(l={onSave:a,kioskMode:n},e[0]=n,e[1]=a,e[2]=l):l=e[2],function(p){const b=H.c(14),y=Ne(K3),v=Dm(),[w]=zt(ln),j=Ne(Gg);let C,N;if(b[0]!==v){const D=Mm(v);C=D.map(N4),N=D.map(S4),b[0]=v,b[1]=C,b[2]=N}else C=b[1],N=b[2];const S=N;let E;b[3]!==v?(E=Y3(v),b[3]=v,b[4]=E):E=b[4];const T=E;let I;b[5]!==y||b[6]!==S||b[7]!==C||b[8]!==T||b[9]!==w||b[10]!==j||b[11]!==p.kioskMode||b[12]!==p.onSave?(I={onSave:p.onSave,needsSave:j,codes:C,cellConfigs:T,cellNames:S,connStatus:w,config:y,kioskMode:p.kioskMode},b[5]=y,b[6]=S,b[7]=C,b[8]=T,b[9]=w,b[10]=j,b[11]=p.kioskMode,b[12]=p.onSave,b[13]=I):I=b[13],function(D){const F=H.c(21),{codes:O,cellConfigs:R,config:P,connStatus:z,cellNames:_,needsSave:k,kioskMode:B,onSave:A}=D,U=M.useRef(null);let V;F[0]!==O?(V=O.join(":"),F[0]=O,F[1]=V):V=F[1];const X=V;let Y;F[2]!==R?(Y=R.map(v4).join(":"),F[2]=R,F[3]=Y):Y=F[3];const G=Y;let W;F[4]!==_?(W=_.join(":"),F[4]=_,F[5]=W):W=F[5];const J=W;let $,Q;F[6]!==P||F[7]!==z.state||F[8]!==B||F[9]!==k||F[10]!==A?($=()=>{if(!B)return P.autosave==="after_delay"&&(U.current!==null&&clearTimeout(U.current),k&&z.state===Bt.OPEN&&(U.current=setTimeout(A,P.autosave_delay))),()=>{U.current!==null&&clearTimeout(U.current)}},F[6]=P,F[7]=z.state,F[8]=B,F[9]=k,F[10]=A,F[11]=$):$=F[11],F[12]!==G||F[13]!==J||F[14]!==X||F[15]!==P||F[16]!==z.state||F[17]!==B||F[18]!==k||F[19]!==A?(Q=[X,G,J,P,z.state,A,B,k],F[12]=G,F[13]=J,F[14]=X,F[15]=P,F[16]=z.state,F[17]=B,F[18]=k,F[19]=A,F[20]=Q):Q=F[20],M.useEffect($,Q)}(I)}(l),function(){const p=H.c(12),b=Ne(SD),{state:y}=Ne(ln),v=b.auto_download.includes("markdown"),w=b.auto_download.includes("html"),j=b.auto_download.includes("ipynb"),C=!v||y!==Bt.OPEN,N=!w||y!==Bt.OPEN,S=!j||y!==Bt.OPEN,{autoExportAsHTML:E,autoExportAsIPYNB:T,autoExportAsMarkdown:I}=nt();let D,F,O,R,P,z;p[0]!==I?(D=async()=>{await I({download:!1})},p[0]=I,p[1]=D):D=p[1],p[2]!==C?(F={delayMs:wd,whenVisible:!0,disabled:C},p[2]=C,p[3]=F):F=p[3],sa(D,F),p[4]!==E?(O=async()=>{await E({download:!1,includeCode:!0,files:xj.INSTANCE.filenames()})},p[4]=E,p[5]=O):O=p[5],p[6]!==N?(R={delayMs:wd,whenVisible:!0,disabled:N},p[6]=N,p[7]=R):R=p[7],sa(O,R),p[8]!==T?(P=async()=>{await T({download:!1})},p[8]=T,p[9]=P):P=p[9],p[10]!==S?(z={delayMs:wd,whenVisible:!0,disabled:S},p[10]=S,p[11]=z):z=p[11],sa(P,z)}(),e[3]!==r?(c=p=>{if(r)return p.preventDefault(),p.returnValue="You have unsaved changes. Are you sure you want to leave?",p.returnValue},e[3]=r,e[4]=c):c=e[4],Jl(window,"beforeunload",c),e[5]!==i?(d=p=>{p.preventDefault(),p.stopPropagation(),i()},e[5]=i,e[6]=d):d=e[6];const h=d;if(Dt("global.save",i),s){let p;return e[7]!==o||e[8]!==r?(p=u.jsx(x4,{filename:o,needsSave:r}),e[7]=o,e[8]=r,e[9]=p):p=e[9],p}let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=Gt("global.save"),e[10]=f):f=e[10];const m=r?"yellow":"hint-green";let g,x;return e[11]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx(fa,{strokeWidth:1.5,size:18}),e[11]=g):g=e[11],e[12]!==h||e[13]!==m?(x=u.jsx(Ee,{content:f,children:u.jsx(cn,{"data-testid":"save-button",id:"save-button",shape:"rectangle",color:m,onClick:h,children:g})}),e[12]=h,e[13]=m,e[14]=x):x=e[14],x};function Cd(){const t=H.c(20),{sendSave:e}=nt(),{openModal:n,closeModal:o,openAlert:r}=An(),s=Ct(kd),i=G3(),a=Om();let l;t[0]!==r||t[1]!==e||t[2]!==s||t[3]!==a?(l=(b,y)=>{const v=bn(),w=Mm(v),j=w.map(j4),C=w.map(C4),N=w.map(k4),S=Y3(v),E=a.get(ln),T=a.get(K3),I=a.get(Sj);a.get(ds)||C.length!==0&&(E.state===Bt.OPEN?(ut.log("saving to ",b),e({cellIds:j,codes:C,names:N,filename:b,configs:S,layout:EF(),persist:!0}).then(()=>{y&&T.format_on_save&&X3(),s({names:N,codes:C,configs:S,layout:I})})):r("Failed to save notebook: not connected to a kernel."))},t[0]=r,t[1]=e,t[2]=s,t[3]=a,t[4]=l):l=t[4];const c=Fe(l);let d;t[5]!==c||t[6]!==a?(d=b=>{const y=b!==void 0&&b,v=a.get(J3),w=a.get(ln);Yg(v)&&w.state===Bt.OPEN&&c(v,y)},t[5]=c,t[6]=a,t[7]=d):d=t[7];const h=Fe(d);let f;t[8]!==c||t[9]!==i?(f=b=>{i(b).then(y=>{y!==null&&c(y,!0)})},t[8]=c,t[9]=i,t[10]=f):f=t[10];const m=f;let g;t[11]!==o||t[12]!==m||t[13]!==n||t[14]!==h||t[15]!==a?(g=()=>{const b=a.get(J3),y=a.get(ln);h(!0),Yg(b)||y.state===Bt.CLOSED||n(u.jsx(E4,{onClose:o,onSave:m}))},t[11]=o,t[12]=m,t[13]=n,t[14]=h,t[15]=a,t[16]=g):g=t[16];const x=Fe(g);let p;return t[17]!==h||t[18]!==x?(p={saveOrNameNotebook:x,saveIfNotebookIsPersistent:h},t[17]=h,t[18]=x,t[19]=p):p=t[19],p}function k4(t){return t.name}function C4(t){return t.code}function j4(t){return t.id}function Yg(t){return t!==null&&!t.startsWith("/tmp")&&!t.startsWith("/var/folders")&&!t.includes("AppData\\Local\\Temp")}function S4(t){return t.name}function N4(t){return t.code}const E4=t=>{const e=H.c(17),{onClose:n,onSave:o}=t,[r,s]=M.useState();let i;e[0]!==n||e[1]!==o?(i=p=>{s(p),p.trim()&&(o(p),n())},e[0]=n,e[1]=o,e[2]=i):i=e[2];const a=i;let l,c,d,h;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(Wo,{children:"Save notebook"}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(gr,{className:"text-md pt-6 px-1",children:"Save as"}),e[4]=c):c=e[4],e[5]!==a?(d=u.jsxs("div",{className:"flex flex-col",children:[c,u.jsx(qg,{onNameChange:a,placeholderText:"filename",className:"missing-filename"})]}),e[5]=a,e[6]=d):d=e[6],e[7]!==n?(h=u.jsx(ve,{"data-testid":"cancel-save-dialog-button","aria-label":"Cancel",variant:"secondary",onClick:n,children:"Cancel"}),e[7]=n,e[8]=h):h=e[8];const f=!r;let m,g,x;return e[9]!==f?(m=u.jsx(ve,{"data-testid":"submit-save-dialog-button","aria-label":"Save",variant:"default",disabled:f,type:"submit",children:"Save"}),e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(g=u.jsxs(Ti,{children:[h,m]}),e[11]=h,e[12]=m,e[13]=g):g=e[13],e[14]!==d||e[15]!==g?(x=u.jsxs(Go,{children:[l,d,g]}),e[14]=d,e[15]=g,e[16]=x):x=e[16],x};function Kg(t){const e=H.c(3),[n,o]=M.useState(!1);let r,s;return e[0]!==t?(r=()=>{if(!t)return;o(!1);const i=setTimeout(()=>{o(!0)},200);return()=>clearTimeout(i)},s=[t],e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]),M.useEffect(r,s),t&&n}const Rs=t=>{const{children:e}=t;return Ne(ds)?null:e},_4=t=>{const{children:e}=t;return Ne(ds)?e:null},I4=()=>{const t=H.c(6),e=Ct(pd);let n;t[0]!==e?(n=()=>e(A4),t[0]=e,t[1]=n):n=t[1];const o=n;let r,s,i;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=Gt("global.commandPalette"),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx(Qc,{strokeWidth:1.5,size:18}),t[3]=s):s=t[3],t[4]!==o?(i=u.jsx(Ee,{content:r,children:u.jsx(cn,{"data-testid":"command-palette-button",onClick:o,shape:"rectangle",color:"hint-green",children:s})}),t[4]=o,t[5]=i):i=t[5],i};function A4(t){return!t}const T4=t=>{const e=H.c(47),{presenting:n,onTogglePresenting:o,onInterrupt:r,onRun:s,connectionState:i,running:a,appConfig:l}=t,c=l.width,d=Ne(B3),h=Ne(ND),{undoDeleteCell:f}=lt(),m=i===Bt.CLOSED;let g,x=null;if(!m&&d){let k,B;e[0]===Symbol.for("react.memo_cache_sentinel")?(k=u.jsx(dd,{size:16,strokeWidth:1.5}),e[0]=k):k=e[0],e[1]!==f?(B=u.jsx(Ee,{content:"Undo cell deletion",children:u.jsx(cn,{"data-testid":"undo-delete-cell",size:"medium",color:"hint-green",shape:"circle",onClick:f,children:k})}),e[1]=f,e[2]=B):B=e[2],x=B}e[3]!==i?(g=eo(i),e[3]=i,e[4]=g):g=e[4];const p=g;let b;e[5]!==i||e[6]!==p?(b=p?wc(i):void 0,e[5]=i,e[6]=p,e[7]=b):b=e[7];const y=b;let v,w;e[8]!==n?(v=!n&&u.jsx(d4,{}),e[8]=n,e[9]=v):v=e[9],e[10]!==m||e[11]!==y||e[12]!==p||e[13]!==n?(w=!m&&u.jsxs("div",{className:D4,children:[n&&u.jsx(AS,{}),u.jsx(e4,{disabled:p,tooltip:y}),u.jsx(mF,{disabled:p,tooltip:y}),u.jsx(pF,{description:"This will terminate the Python kernel. You'll lose all data that's in memory.",disabled:p,tooltip:y})]}),e[10]=m,e[11]=y,e[12]=p,e[13]=n,e[14]=w):w=e[14];const j=c==="compact"&&"xl:flex-row items-end";let C,N,S,E,T,I,D,F,O,R,P,z,_;return e[15]!==j?(C=xe(R4,j),e[15]=j,e[16]=C):C=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(N=u.jsx(Rs,{children:u.jsx(w4,{kioskMode:!1})}),e[17]=N):N=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(S=Gt("global.hideCode"),e[18]=S):S=e[18],e[19]!==n?(E=n?u.jsx($3,{strokeWidth:1.5,size:18}):u.jsx(od,{strokeWidth:1.5,size:18}),e[19]=n,e[20]=E):E=e[20],e[21]!==o||e[22]!==E?(T=u.jsx(Ee,{content:S,children:u.jsx(cn,{"data-testid":"hide-code-button",id:"preview-button",shape:"rectangle",color:"hint-green",onClick:o,children:E})}),e[21]=o,e[22]=E,e[23]=T):T=e[23],e[24]===Symbol.for("react.memo_cache_sentinel")?(I=u.jsx(I4,{}),D=u.jsx(gF,{}),F=u.jsx("div",{}),e[24]=I,e[25]=D,e[26]=F):(I=e[24],D=e[25],F=e[26]),e[27]!==m||e[28]!==r||e[29]!==a?(O=!m&&u.jsx(O4,{running:a,onInterrupt:r}),e[27]=m,e[28]=r,e[29]=a,e[30]=O):O=e[30],e[31]!==m||e[32]!==h||e[33]!==s?(R=!m&&u.jsx(M4,{needsRun:h,onRun:s}),e[31]=m,e[32]=h,e[33]=s,e[34]=R):R=e[34],e[35]!==O||e[36]!==R||e[37]!==x?(P=u.jsx(Rs,{children:u.jsxs("div",{className:"flex flex-col gap-2 items-center",children:[x,O,R]})}),e[35]=O,e[36]=R,e[37]=x,e[38]=P):P=e[38],e[39]!==T||e[40]!==P||e[41]!==C?(z=u.jsxs("div",{className:C,children:[N,T,I,D,F,P]}),e[39]=T,e[40]=P,e[41]=C,e[42]=z):z=e[42],e[43]!==z||e[44]!==v||e[45]!==w?(_=u.jsxs(u.Fragment,{children:[v,w,z]}),e[43]=z,e[44]=v,e[45]=w,e[46]=_):_=e[46],_},M4=t=>{const e=H.c(8),{needsRun:n,onRun:o}=t,r=Ne(Z3);if(n){let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=Gt("global.runStale"),e[0]=l):l=e[0];const c=r?o:void 0,d=!r;let h,f;return e[1]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(Sr,{strokeWidth:1.5,size:16}),e[1]=h):h=e[1],e[2]!==c||e[3]!==d?(f=u.jsx(Ee,{content:l,children:u.jsx(cn,{"data-testid":"run-button",size:"medium",color:"yellow",shape:"circle",onClick:c,disabled:d,children:h})}),e[2]=c,e[3]=d,e[4]=f):f=e[4],f}const s=!r;let i,a;return e[5]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(Sr,{strokeWidth:1.5,size:16}),e[5]=i):i=e[5],e[6]!==s?(a=u.jsx(Ee,{content:"Nothing to run",children:u.jsx(cn,{"data-testid":"run-button",className:"inactive-button",color:"disabled",size:"medium",shape:"circle",disabled:s,children:i})}),e[6]=s,e[7]=a):a=e[7],a},O4=t=>{const e=H.c(8),{running:n,onInterrupt:o}=t,r=Kg(n);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=Gt("global.interrupt"),e[0]=s):s=e[0];const i=!r&&"inactive-button active:shadow-xs-solid";let a;e[1]!==i?(a=xe(i),e[1]=i,e[2]=a):a=e[2];const l=r?"yellow":"disabled",c=r?o:Bn.NOOP;let d,h;return e[3]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(fc,{strokeWidth:1.5,size:16}),e[3]=d):d=e[3],e[4]!==a||e[5]!==l||e[6]!==c?(h=u.jsx(Ee,{content:s,children:u.jsx(cn,{className:a,"data-testid":"interrupt-button",size:"medium",color:l,shape:"circle",onClick:c,children:d})}),e[4]=a,e[5]=l,e[6]=c,e[7]=h):h=e[7],h},D4="absolute top-3 right-5 m-0 flex items-center gap-2 min-h-[28px] no-print pointer-events-auto z-30 print:hidden",R4="absolute bottom-5 right-5 flex flex-col gap-2 items-center no-print pointer-events-auto z-30 print:hidden",P4=t=>{const e=H.c(7),{filename:n}=t,o=G3();let r;e[0]!==n?(r=n?yn.basename(n):"untitled marimo notebook",e[0]=n,e[1]=r):r=e[1];const s=n===null?"missing-filename":"filename";let i;return e[2]!==n||e[3]!==o||e[4]!==r||e[5]!==s?(i=u.jsx(qg,{placeholderText:r,initialValue:n,onNameChange:o,flexibleWidth:!0,resetOnBlur:!0,"data-testid":"filename-input",className:s}),e[2]=n,e[3]=o,e[4]=r,e[5]=s,e[6]=i):i=e[6],i},jd=()=>({entries:new Map}),{valueAtom:Xg,useActions:Jg}=Q3(jd,{submit:(t,e)=>{const{cellIds:n,deleteCell:o,deleteManyCells:r,store:s}=e,i=s.get(In),a=s.get(kc),l=new Set(i.cellIds.inOrderIds.filter(h=>i.cellData[h].code.trim()==="")),c=new Map;for(const h of n){if(l.has(h)){c.set(h,{cellId:h,type:"simple"});continue}const f=i.cellRuntime[h],m=new Map;for(const x of Object.values(a)){const p=x.declaredBy.includes(h),b=x.usedBy.some(y=>!l.has(y));p&&b&&m.set(x.name,x.usedBy)}let g;f!=null&&f.runElapsedTimeMs&&f.runElapsedTimeMs>2e3&&(g=f.runElapsedTimeMs),m.size===0&&g===void 0?c.set(h,{cellId:h,type:"simple"}):c.set(h,{cellId:h,type:"expensive",executionDurationMs:g,defs:m})}const d=[...c.values()].every(h=>h.type==="simple");return c.size>0&&d?(c.size===1?o({cellId:[...c.values()][0].cellId}):r({cellIds:[...c.values()].map(h=>h.cellId)}),jd()):{...t,entries:c}},clear:()=>jd()});function Ps(){const t=Om(),{submit:e,clear:n}=Jg(),{entries:o}=Ne(Xg),r=Ms(),s=Os();return M.useMemo(()=>({submit:i=>{e({cellIds:i,deleteCell:r,deleteManyCells:s,store:t})},clear:n,get idle(){return o.size===0},get shouldConfirmDelete(){return o.size>1}}),[t,e,n,o,r,s])}function L4(t){return t.cellId}function Zg(){return{selectionStart:null,selectionEnd:null,selected:new Set}}const{valueAtom:Sd,useActions:F4}=Q3(Zg,{select:(t,e)=>({selectionStart:e.cellId,selectionEnd:e.cellId,selected:new Set([e.cellId])}),extend:(t,e)=>{if(!t.selectionStart)return{selectionStart:e.cellId,selectionEnd:e.cellId,selected:new Set([e.cellId])};const{cellId:n,allCellIds:o}=e;try{const r=o.findWithId(t.selectionStart),s=r.indexOfOrThrow(t.selectionStart),i=r.indexOfOrThrow(n),[a,l]=s<i?[s,i]:[i,s],c=r.slice(a,l+1);return{selectionStart:t.selectionStart,selectionEnd:n,selected:new Set(c)}}catch{return{selectionStart:n,selectionEnd:n,selected:new Set([n])}}},clear:t=>t.selected.size===0?t:Zg()});function ja(){return F4()}const z4=t=>{const e=H.c(14),{actions:n,cellIds:o,disabled:r}=t;let s,i,a,l,c;if(e[0]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx(qc,{size:13,strokeWidth:1.5}),e[0]=s):s=e[0],e[1]!==r?(i=u.jsx(_o,{asChild:!0,children:u.jsx(ve,{variant:"ghost",size:"sm",className:"h-8 px-2 gap-1",title:"More actions",disabled:r,children:s})}),e[1]=r,e[2]=i):i=e[2],e[3]!==n||e[4]!==o){let d;e[6]!==n.length||e[7]!==o?(d=(h,f)=>{const m=h.map(g=>u.jsx(At,{onSelect:()=>g.handle(o),className:"flex items-center gap-2",children:u.jsxs("div",{className:"flex items-center flex-1",children:[g.icon&&u.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:g.icon}),u.jsx("div",{className:"flex-1",children:g.label}),g.hotkey&&u.jsx(Im,{shortcut:g.hotkey,className:"ml-4"})]})},g.label));return u.jsxs(q.Fragment,{children:[m,f<n.length-1&&u.jsx(an,{})]},f)},e[6]=n.length,e[7]=o,e[8]=d):d=e[8],a=n.flatMap(d),e[3]=n,e[4]=o,e[5]=a}else a=e[5];return e[9]!==a?(l=u.jsx(Io,{align:"start","data-keep-cell-selection":!0,children:a}),e[9]=a,e[10]=l):l=e[10],e[11]!==i||e[12]!==l?(c=u.jsxs(Eo,{children:[i,l]}),e[11]=i,e[12]=l,e[13]=c):c=e[13],c};function B4(t){return t.length>0}function U4(t){return t.filter($4)}function $4(t){return!t.hidden}function V4(t){return t.length>0}function H4(t){return t.filter(W4)}function W4(t){return!t.hidden}function q4(t){const e={};t.forEach(n=>{const o=Ri(n);o&&(e[n]=o)}),k3(e)}const G4=()=>{const t=H.c(4),e=Ne(Sd);let n;t[0]!==e.selected?(n=[...e.selected],t[0]=e.selected,t[1]=n):n=t[1];const o=n;if(o.length<2)return null;let r;return t[2]!==o?(r=u.jsxs(u.Fragment,{children:[u.jsx(K4,{cellIds:o}),u.jsx(Y4,{cellIds:o})]}),t[2]=o,t[3]=r):r=t[3],r},Nd=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx("div",{className:"h-4 w-px bg-border mx-1"}),t[0]=e):e=t[0],e},Y4=t=>{const e=H.c(12),{cellIds:n}=t,o=Ps(),r=Os(),s=ja();if(!o.shouldConfirmDelete)return null;let i,a,l,c,d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(Rm,{className:"w-4 h-4 text-(--amber-11) mt-0.5 shrink-0"}),e[0]=i):i=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsxs("div",{className:"font-code text-sm text-[0.84375rem]",children:[u.jsx("p",{className:"text-(--amber-11) font-medium",children:"Some cells in selection may contain expensive operations."}),u.jsx("p",{className:"text-(--amber-11) mt-1",children:"Are you sure you want to delete?"})]}),e[1]=a):a=e[1],e[2]!==o?(l=u.jsx(ve,{size:"xs",variant:"ghost",onClick:()=>o.clear(),className:"text-(--amber-11) hover:bg-(--amber-4) hover:text-(--amber-11)",children:"Cancel"}),e[2]=o,e[3]=l):l=e[3],e[4]!==n||e[5]!==r||e[6]!==o||e[7]!==s?(c=u.jsx(ve,{size:"xs",variant:"secondary",onClick:()=>{r({cellIds:n}),o.clear(),s.clear()},className:"bg-(--amber-11) hover:bg-(--amber-12) text-white border-(--amber-11)",children:"Delete"}),e[4]=n,e[5]=r,e[6]=o,e[7]=s,e[8]=c):c=e[8],e[9]!==l||e[10]!==c?(d=u.jsx("div",{className:"absolute top-12 justify-center flex w-full left-0 right-0 z-50","data-keep-cell-selection":!0,children:u.jsx("div",{className:"mx-20",children:u.jsx("div",{className:"bg-(--amber-2) border border-(--amber-6) rounded-lg shadow-lg mt-14 px-4 py-3 animate-in slide-in-from-top-2 duration-200",children:u.jsxs("div",{className:"flex items-start gap-3",children:[i,u.jsxs("div",{className:"flex-1",children:[a,u.jsx(Tm,{restoreFocus:!0,autoFocus:!0,children:u.jsxs("div",{className:"flex items-center gap-2 mt-3",onKeyDown:X4,children:[l,c]})})]})]})})})}),e[9]=l,e[10]=c,e[11]=d):d=e[11],d},K4=t=>{const e=H.c(23),{cellIds:n}=t,o=ja(),r=Ps(),{actions:s,moreActions:i}=function(p){const b=H.c(31),{updateCellConfig:y,moveCell:v,clearCellOutput:w,sendToTop:j,sendToBottom:C}=lt(),N=Os(),S=Ne(Zl),E=ja(),T=Is(),I=Ps(),D=Ne(Cc),{saveCellConfig:F}=nt(),O=p.length,R=!S||O<p.length;let P;b[0]!==N||b[1]!==I||b[2]!==E||b[3]!==D?(P=oe=>{I.idle&&D.keymap.destructive_delete?I.submit(oe):(N({cellIds:oe}),I.clear(),E.clear())},b[0]=N,b[1]=I,b[2]=E,b[3]=D,b[4]=P):P=b[4];const z=Fe(P);let _;b[5]!==v?(_=(oe,ne)=>{if(ne==="down"){const ie=oe[oe.length-1];if(Qe.get(In).cellIds.findWithId(ie).last()===ie)return}if(ne==="up"){const ie=oe[0];if(Qe.get(In).cellIds.findWithId(ie).first()===ie)return}(ne==="up"?oe:[...oe].reverse()).forEach(ie=>{v({cellId:ie,before:ne==="up"})})},b[5]=v,b[6]=_):_=b[6];const k=Fe(_);let B;b[7]!==j?(B=oe=>{[...oe].reverse().forEach(ne=>{j({cellId:ne})})},b[7]=j,b[8]=B):B=b[8];const A=Fe(B);let U;b[9]!==C?(U=oe=>{oe.forEach(ne=>{C({cellId:ne})})},b[9]=C,b[10]=U):U=b[10];const V=Fe(U),X=Fe(q4);let Y;b[11]!==w?(Y=oe=>{oe.forEach(ne=>{w({cellId:ne})})},b[11]=w,b[12]=Y):Y=b[12];const G=Fe(Y);let W;b[13]!==F||b[14]!==y?(W=async(oe,ne,ie)=>{const se={};oe.forEach(ae=>{se[ae]={[ne]:ie}}),await F({configs:se}),oe.forEach(ae=>{y({cellId:ae,config:se[ae]})})},b[13]=F,b[14]=y,b[15]=W):W=b[15];const J=Fe(W);let $,Q,te;if(b[16]===Symbol.for("react.memo_cache_sentinel")?($=u.jsx(Sr,{size:13,strokeWidth:1.5}),b[16]=$):$=b[16],b[17]!==T?(Q=oe=>T(oe),b[17]=T,b[18]=Q):Q=b[18],b[19]!==R||b[20]!==G||b[21]!==z||b[22]!==X||b[23]!==k||b[24]!==V||b[25]!==A||b[26]!==Q||b[27]!==J){const oe=[[{icon:$,label:"Run cells",handle:Q,hotkey:"cell.run"}],[{icon:u.jsx(oc,{size:13,strokeWidth:1.5}),label:"Move up",handle:ae=>k(ae,"up"),hotkey:"cell.moveUp"},{icon:u.jsx(No,{size:13,strokeWidth:1.5}),label:"Move down",handle:ae=>k(ae,"down"),hotkey:"cell.moveDown"}],[{icon:u.jsx(rc,{size:13,strokeWidth:1.5}),label:"Delete cells",variant:"danger",hidden:!R,handle:z}]],ne=[[{icon:u.jsx(C3,{size:13,strokeWidth:1.5}),label:"Format cells",handle:X,hotkey:"cell.format"},{icon:u.jsx(Di,{size:13,strokeWidth:1.5}),label:"Clear outputs",handle:G}],[{icon:u.jsx(mm,{size:13,strokeWidth:1.5}),label:"Hide code",handle:ae=>J(ae,"hide_code",!0),hotkey:"cell.hideCode"},{icon:u.jsx(fm,{size:13,strokeWidth:1.5}),label:"Show code",handle:ae=>J(ae,"hide_code",!1),hotkey:"cell.hideCode"}],[{icon:u.jsx(oc,{size:13,strokeWidth:1.5}),label:"Move up",handle:ae=>k(ae,"up"),hotkey:"cell.moveUp"},{icon:u.jsx(No,{size:13,strokeWidth:1.5}),label:"Move down",handle:ae=>k(ae,"down"),hotkey:"cell.moveDown"},{icon:u.jsx(Jc,{size:13,strokeWidth:1.5}),label:"Send to top",handle:A,hotkey:"cell.sendToTop"},{icon:u.jsx(Xc,{size:13,strokeWidth:1.5}),label:"Send to bottom",handle:V,hotkey:"cell.sendToBottom"}],[{icon:u.jsx(un,{size:13,strokeWidth:1.5}),label:"Disable cells",handle:ae=>J(ae,"disabled",!0)},{icon:u.jsx(hn,{size:13,strokeWidth:1.5}),label:"Enable cells",handle:ae=>J(ae,"disabled",!1)}]],ie=oe.map(H4);let se;b[29]!==ie?(se=ie.filter(V4),b[29]=ie,b[30]=se):se=b[30],te={actions:se,moreActions:ne.map(U4).filter(B4)},b[19]=R,b[20]=G,b[21]=z,b[22]=X,b[23]=k,b[24]=V,b[25]=A,b[26]=Q,b[27]=J,b[28]=te}else te=b[28];return te}(n),a=n.length;let l;e[0]!==r||e[1]!==o?(l=p=>{(p.target instanceof HTMLElement||p.target instanceof SVGElement)&&p.target.closest("[data-keep-cell-selection]")!==null||p.target instanceof HTMLHtmlElement||(r.clear(),o.clear())},e[0]=r,e[1]=o,e[2]=l):l=e[2],Jl(window,"mousedown",l);const c=!r.idle;let d,h,f,m,g,x;if(e[3]!==a?(d=u.jsxs("span",{className:"text-sm font-medium text-muted-foreground px-2 shrink-0",children:[a," cells selected"]}),e[3]=a,e[4]=d):d=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(Nd,{}),e[5]=h):h=e[5],e[6]!==s||e[7]!==n||e[8]!==c){let p;e[10]!==s.length||e[11]!==n||e[12]!==c?(p=(b,y)=>u.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[b.map(v=>u.jsxs(ve,{variant:v.variant==="danger"?"linkDestructive":"ghost",size:"sm",onClick:()=>v.handle(n),className:"h-8 px-2 gap-1 shrink-0 flex items-center",title:v.label,disabled:c&&v.label!=="Delete cells",children:[v.icon,u.jsx("span",{className:"text-xs",children:v.label}),v.hotkey&&u.jsx("div",{className:"ml-1 border bg-muted rounded-md px-1",children:u.jsx(Im,{shortcut:v.hotkey})})]},v.label)),y<s.length-1&&u.jsx(Nd,{})]},y),e[10]=s.length,e[11]=n,e[12]=c,e[13]=p):p=e[13],f=s.map(p),e[6]=s,e[7]=n,e[8]=c,e[9]=f}else f=e[9];return e[14]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(Nd,{}),e[14]=m):m=e[14],e[15]!==n||e[16]!==c||e[17]!==i?(g=u.jsx(z4,{actions:i,cellIds:n,disabled:c}),e[15]=n,e[16]=c,e[17]=i,e[18]=g):g=e[18],e[19]!==d||e[20]!==f||e[21]!==g?(x=u.jsx("div",{className:"absolute top-12 justify-center flex w-full left-0 right-0 z-50","data-keep-cell-selection":!0,children:u.jsx("div",{className:"bg-background/95 backdrop-blur-sm supports-backdrop-filter:bg-background/60 border border-(--slate-7) rounded-lg shadow-lg p-2 overflow-x-auto overflow-y-hidden mx-20 scrollbar-thin",children:u.jsxs("div",{className:"flex items-center gap-1",children:[d,h,f,m,g]})})}),e[19]=d,e[20]=f,e[21]=g,e[22]=x):x=e[22],x};function X4(t){t.stopPropagation()}const J4={display:"none"};function Z4(t){let{id:e,value:n}=t;return q.createElement("div",{id:e,style:J4},n)}function Q4(t){let{id:e,announcement:n,ariaLiveType:o="assertive"}=t;return q.createElement("div",{id:e,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":o,"aria-atomic":!0},n)}const Qg=M.createContext(null),eN={draggable:`
|
|
98
|
+
`)}(A,d)),o()},e[10]=x,e[11]=o,e[12]=d,e[13]=p):p=e[13];const b=p;let y;e[14]!==l||e[15]!==b?(y=l.handleSubmit(b),e[14]=l,e[15]=b,e[16]=y):y=e[16];let v,w;e[17]===Symbol.for("react.memo_cache_sentinel")?(v=u.jsx(iD,{}),e[17]=v):v=e[17],e[18]!==l||e[19]!==n?(w=u.jsx(yS,{children:u.jsx(aD,{schema:n,form:l,renderers:NS,children:v})}),e[18]=l,e[19]=n,e[20]=w):w=e[20];let j;e[21]!==r?(j=u.jsx(ve,{type:"button",variant:"outline",onClick:r,children:"Back"}),e[21]=r,e[22]=j):j=e[22];const C=!l.formState.isValid;let N,S;e[23]!==C?(N=u.jsx(ve,{type:"submit",disabled:C,children:"Add"}),e[23]=C,e[24]=N):N=e[24],e[25]!==j||e[26]!==N?(S=u.jsxs("div",{className:"flex gap-2",children:[j,N]}),e[25]=j,e[26]=N,e[27]=S):S=e[27];const E=lc;let T,I;e[28]===Symbol.for("react.memo_cache_sentinel")?(T=A=>h(A),e[28]=T):T=e[28],e[29]===Symbol.for("react.memo_cache_sentinel")?(I=u.jsxs("div",{className:"flex flex-col gap-1 items-end",children:[u.jsx(cc,{children:u.jsx(wm,{placeholder:"Select a library"})}),u.jsx("span",{className:"text-xs text-muted-foreground",children:"Preferred connection library"})]}),e[29]=I):I=e[29];const D=dc,F=Cm,O=c==null?void 0:c.libraries.map(IS);let R,P,z,_,k;return e[30]!==F||e[31]!==O?(R=u.jsx(F,{children:O}),e[30]=F,e[31]=O,e[32]=R):R=e[32],e[33]!==D||e[34]!==R?(P=u.jsx(D,{children:R}),e[33]=D,e[34]=R,e[35]=P):P=e[35],e[36]!==E||e[37]!==d||e[38]!==T||e[39]!==I||e[40]!==P?(z=u.jsx("div",{children:u.jsxs(E,{value:d,onValueChange:T,children:[I,P]})}),e[36]=E,e[37]=d,e[38]=T,e[39]=I,e[40]=P,e[41]=z):z=e[41],e[42]!==S||e[43]!==z?(_=u.jsxs("div",{className:"flex gap-2 justify-between",children:[S,z]}),e[42]=S,e[43]=z,e[44]=_):_=e[44],e[45]!==_||e[46]!==y||e[47]!==w?(k=u.jsxs("form",{onSubmit:y,className:"space-y-4",children:[w,_]}),e[45]=_,e[46]=y,e[47]=w,e[48]=k):k=e[48],k},_S=t=>{const e=H.c(5),{onSubmit:n}=t,[o,r]=M.useState(null);if(!o){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(SS,{onSelect:r}),e[0]=a):a=e[0],a}let s,i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=()=>r(null),e[1]=s):s=e[1],e[2]!==n||e[3]!==o?(i=u.jsx(ES,{schema:o,onSubmit:n,onBack:s}),e[2]=n,e[3]=o,e[4]=i):i=e[4],i},Pg=t=>{const e=H.c(6),{children:n}=t,[o,r]=M.useState(!1);let s,i,a;return e[0]!==n?(s=u.jsx(lD,{asChild:!0,children:n}),e[0]=n,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(Lg,{onClose:()=>r(!1)}),e[2]=i):i=e[2],e[3]!==o||e[4]!==s?(a=u.jsxs(cD,{open:o,onOpenChange:r,children:[s,i]}),e[3]=o,e[4]=s,e[5]=a):a=e[5],a},Lg=t=>{const e=H.c(4),{onClose:n}=t;let o,r,s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(Wo,{children:"Add Connection"}),e[0]=o):o=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsxs(ls,{className:"mb-4",children:[o,u.jsxs(cs,{children:["Connect to your database or data catalog to query data directly from your notebook. Learn more about how to connect to your database in our"," ",u.jsx(km,{href:"https://docs.marimo.io/guides/working_with_data/sql/#connecting-to-a-custom-database",children:"docs."})]})]}),e[1]=r):r=e[1],e[2]!==n?(s=u.jsxs(Go,{className:"max-h-[75vh] overflow-y-auto",children:[r,u.jsx(_S,{onSubmit:()=>n()})]}),e[2]=n,e[3]=s):s=e[3],s};function IS(t){return u.jsx(uc,{value:t,children:Ag[t]},t)}const AS=()=>{const t=H.c(7),{selectedLayout:e}=vj(),{setLayoutView:n}=wj();if(tn()&&!jm("wasm_layouts"))return null;let o,r,s,i;return t[0]!==n?(o=a=>n(a),t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(cc,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:u.jsx(wm,{placeholder:"Select a view"})}),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx(dc,{children:u.jsxs(Cm,{children:[u.jsx(F3,{children:"View as"}),kj.map(MS)]})}),t[3]=s):s=t[3],t[4]!==e||t[5]!==o?(i=u.jsxs(lc,{"data-testid":"layout-select",value:e,onValueChange:o,children:[r,s]}),t[4]=e,t[5]=o,t[6]=i):i=t[6],i};function TS(t){const e=Fg(t);return u.jsx(e,{className:"h-4 w-4"})}function Fg(t){switch(t){case"vertical":return Dp;case"grid":return cF;case"slides":return id;default:return hc(t),fc}}function zg(t){return Sm(t)}function MS(t){return u.jsx(uc,{value:t,children:u.jsxs("div",{className:"flex items-center gap-1.5 leading-5",children:[TS(t),u.jsx("span",{children:zg(t)})]})},t)}const OS=()=>{const{updateCellConfig:t}=lt(),{saveCellConfig:e}=nt();return M.useCallback(async()=>{const n=new Bi,o=bn(),r=o.cellIds.inOrderIds,s={};for(const a of r){if(o.cellData[a]===void 0)continue;const{code:l,config:c}=o.cellData[a];c.hide_code||n.isSupported(l)&&(s[a]={hide_code:!0})}const i=sc.entries(s);if(i.length!==0){await e({configs:s});for(const[a,l]of i)t({cellId:a,config:l})}},[t])};function Bg(){const t=H.c(4),{openConfirm:e}=An(),n=Ct(ln),{sendRestart:o}=nt();let r;return t[0]!==e||t[1]!==o||t[2]!==n?(r=()=>{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:u.jsx(z3,{onClick:async()=>{n({state:Bt.CLOSING}),await o(),dD()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=o,t[2]=n,t[3]=r):r=t[3],r}const Ds=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function Ug(){var X,Y;const t=H.c(39),e=Nm(),{openModal:n,closeModal:o}=An(),{toggleApplication:r}=Ui(),{selectedPanel:s}=pc(),[i]=zt(cm),a=Ne(ds),l=OS(),[c]=xr(),{updateCellConfig:d,undoDeleteCell:h,clearAllCellOutputs:f,upsertSetupCell:m,collapseAllCells:g,expandAllCells:x}=lt(),p=Bg(),b=ag(),y=function(G){const W=H.c(5),{openPrompt:J,closeModal:$}=An(),{sendCopy:Q}=nt();let te;return W[0]!==$||W[1]!==J||W[2]!==Q||W[3]!==G?(te=()=>{if(!G)return null;const oe=mc.guessDeliminator(G),ne=yn.basename(G);J({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${ne}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:ie=>{const se=oe.join(yn.dirname(G),ie);Q({source:G,destination:se}).then(()=>{$(),Je({title:"Notebook copied",description:"A copy of the notebook has been created."}),fj(se)})}})},W[0]=$,W[1]=J,W[2]=Q,W[3]=G,W[4]=te):te=W[4],te}(e),v=Ct(pd),w=Ct(dF),j=Ct(uF),{exportAsMarkdown:C,readCode:N,saveCellConfig:S}=nt(),E=Ne(uD),T=Ne(hD),I=Ne(B3),{selectedLayout:D}=vj(),{setLayoutView:F}=wj(),O=ig(),R=((X=c.sharing)==null?void 0:X.html)??!0,P=((Y=c.sharing)==null?void 0:Y.wasm)??!0,z=QS;let _;t[0]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(Yp,{size:14,strokeWidth:1.5}),t[0]=_):_=t[0];const k=!R&&!P;let B;t[1]===Symbol.for("react.memo_cache_sentinel")?(B=u.jsx(xD,{size:14,strokeWidth:1.5}),t[1]=B):B=t[1];const A=!R;let U,V;return t[2]!==o||t[3]!==n?(U=async()=>{n(u.jsx(Bj,{onClose:o}))},t[2]=o,t[3]=n,t[4]=U):U=t[4],t[5]!==I||t[6]!==f||t[7]!==o||t[8]!==g||t[9]!==y||t[10]!==x||t[11]!==C||t[12]!==e||t[13]!==E||t[14]!==T||t[15]!==l||t[16]!==a||t[17]!==n||t[18]!==N||t[19]!==p||t[20]!==b||t[21]!==S||t[22]!==D||t[23]!==s||t[24]!==v||t[25]!==j||t[26]!==F||t[27]!==w||t[28]!==P||t[29]!==k||t[30]!==A||t[31]!==U||t[32]!==r||t[33]!==O||t[34]!==h||t[35]!==d||t[36]!==m||t[37]!==i.mode?(V=[{icon:_,label:"Share",handle:Ds,hidden:k,dropdown:[{icon:B,label:"Publish HTML to web",hidden:A,handle:U},{icon:u.jsx(hj,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!P,handle:async()=>{const W=await N(),J=fD({code:W.contents});await sn(J),Je({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:u.jsx(Em,{size:14,strokeWidth:1.5}),label:"Download",handle:Ds,dropdown:[{icon:u.jsx(jj,{size:14,strokeWidth:1.5}),label:"Download as HTML",handle:async()=>{e?await Cj({filename:e,includeCode:!0}):Je({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:u.jsx(jj,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{e?await Cj({filename:e,includeCode:!1}):Je({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:u.jsx(tc,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{const W=await C({download:!1});$i(new Blob([W],{type:"text/plain"}),U3.toMarkdown(document.title))}},{icon:u.jsx(vp,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{const W=await N();$i(new Blob([W.contents],{type:"text/plain"}),U3.toPY(document.title))}},{divider:!0,icon:u.jsx(cp,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:i.mode!=="present",tooltip:i.mode==="present"?void 0:u.jsxs("span",{children:["Only available in app view. ",u.jsx("br",{}),"Toggle with: ",Gt("global.hideCode",!1)]}),handle:ZS},{icon:u.jsx(mD,{size:14,strokeWidth:1.5}),label:"Download as PDF",disabled:i.mode!=="present",tooltip:i.mode==="present"?void 0:u.jsxs("span",{children:["Only available in app view. ",u.jsx("br",{}),"Toggle with: ",Gt("global.hideCode",!1)]}),handle:XS}]},{divider:!0,icon:u.jsx($p,{size:14,strokeWidth:1.5}),label:"Helper panel",handle:Ds,dropdown:hd.flatMap(W=>{const{type:J,Icon:$,hidden:Q}=W;return Q?[]:{label:Sm(J),rightElement:z(s===J),icon:u.jsx($,{size:14,strokeWidth:1.5}),handle:()=>r(J)}})},{icon:u.jsx(id,{size:14,strokeWidth:1.5}),label:"Present as",handle:Ds,dropdown:[{icon:i.mode==="present"?u.jsx($3,{size:14,strokeWidth:1.5}):u.jsx(od,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{O()}},...kj.map((W,J)=>{const $=Fg(W);return{divider:J===0,label:zg(W),icon:u.jsx($,{size:14,strokeWidth:1.5}),rightElement:u.jsx("div",{className:"w-8 flex justify-end",children:D===W&&u.jsx(gc,{size:14})}),handle:()=>{F(W),i.mode==="edit"&&O()}}})]},{icon:u.jsx(Np,{size:14,strokeWidth:1.5}),label:"Create notebook copy",hidden:!e||tn(),handle:y},{icon:u.jsx(Zc,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:async()=>{const W=await N();await sn(W.contents),Je({title:"Copied",description:"Code copied to clipboard."})}},{icon:u.jsx(hn,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!E||a,handle:async()=>{const W=bn(),J=pD(W),$=sc.fromEntries(J.map(KS));await S({configs:$});for(const Q of J)d({cellId:Q,config:{disabled:!1}})}},{icon:u.jsx(un,{size:14,strokeWidth:1.5}),label:"Disable all cells",hidden:!T||a,handle:async()=>{const W=bn(),J=g3(W),$=sc.fromEntries(J.map(YS));await S({configs:$});for(const Q of J)d({cellId:Q,config:{disabled:!0}})}},{icon:u.jsx(mm,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:l},{icon:u.jsx(bp,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:g},{icon:u.jsx(xp,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:x},{icon:u.jsx(kp,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{m({code:"# Initialization code that runs before all other cells"})}},{icon:u.jsx(Di,{size:14,strokeWidth:1.5}),label:"Clear all outputs",handle:()=>{f()}},{icon:u.jsx(jp,{size:14,strokeWidth:1.5}),label:"Re-run all cells",hotkey:"global.runAll",handle:async()=>{b()}},{icon:u.jsx(dd,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!I||a,handle:()=>{h()}},{icon:u.jsx(Yo,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n(u.jsx(Lg,{onClose:o}))}},{divider:!0,icon:u.jsx(Qc,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(GS)},{icon:u.jsx(_m,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>w(qS)},{icon:u.jsx(Op,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>j(WS)},{icon:u.jsx(mj,{size:14,strokeWidth:1.5}),label:"Open documentation",handle:HS},{icon:u.jsx(xc,{size:14,strokeWidth:1.5}),label:"Resources",handle:Ds,dropdown:[{icon:u.jsx(mj,{size:14,strokeWidth:1.5}),label:"Documentation",handle:VS},{icon:u.jsx(hF,{size:14,strokeWidth:1.5}),label:"GitHub",handle:$S},{icon:u.jsx(fF,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:US},{icon:u.jsx(mF,{size:14,strokeWidth:1.5}),label:"YouTube",handle:BS},{icon:u.jsx(um,{size:14,strokeWidth:1.5}),label:"Changelog",handle:zS}]},{divider:!0,icon:u.jsx(Tp,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:FS},{icon:u.jsx(ua,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:LS},{icon:u.jsx(eg,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:p}].filter(PS).map(DS),t[5]=I,t[6]=f,t[7]=o,t[8]=g,t[9]=y,t[10]=x,t[11]=C,t[12]=e,t[13]=E,t[14]=T,t[15]=l,t[16]=a,t[17]=n,t[18]=N,t[19]=p,t[20]=b,t[21]=S,t[22]=D,t[23]=s,t[24]=v,t[25]=j,t[26]=F,t[27]=w,t[28]=P,t[29]=k,t[30]=A,t[31]=U,t[32]=r,t[33]=O,t[34]=h,t[35]=d,t[36]=m,t[37]=i.mode,t[38]=V):V=t[38],V}function DS(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(RS)}:t}function RS(t){return!t.hidden}function PS(t){return!t.hidden}function LS(){const t=gD();window.open(t,"_blank")}function FS(){const t=document.baseURI.split("?")[0];window.open(t,"_self")}function zS(){window.open(Fn.releasesPage,"_blank")}function BS(){window.open(Fn.youtube,"_blank")}function US(){window.open(Fn.discordLink,"_blank")}function $S(){window.open(Fn.githubPage,"_blank")}function VS(){window.open(Fn.docsPage,"_blank")}function HS(){window.open(Fn.docsPage,"_blank")}function WS(t){return!t}function qS(t){return!t}function GS(t){return!t}function YS(t){return[t,{disabled:!0}]}function KS(t){return[t,{disabled:!1}]}async function XS(){const t=new Event("export-beforeprint"),e=new Event("export-afterprint");window.dispatchEvent(t),setTimeout(JS,0),setTimeout(()=>window.dispatchEvent(e),0)}function JS(){return window.print()}async function ZS(){const t=document.getElementById("App");t&&await v3(t,document.title)}function QS(t){return u.jsx("div",{className:"w-8 flex justify-end",children:t&&u.jsx(gc,{size:14})})}const e4=t=>{const e=H.c(28),{disabled:n,tooltip:o}=t,r=n!==void 0&&n,s=o===void 0?"Actions":o,i=Ug();let a,l,c;e[0]!==s?(a=u.jsx("div",{children:s}),e[0]=s,e[1]=a):a=e[1],e[2]!==r?(l=!r&&u.jsxs("div",{className:"text-xs text-muted-foreground font-medium pt-1 -mt-2 border-t border-border flex items-center gap-2",children:[u.jsx("span",{children:"Open command palette"}),Gt("global.commandPalette",!1)]}),e[2]=r,e[3]=l):l=e[3],e[4]!==a||e[5]!==l?(c=u.jsxs("div",{className:"flex flex-col gap-2",children:[a,l]}),e[4]=a,e[5]=l,e[6]=c):c=e[6];const d=c,h=r?"disabled":"hint-green";let f,m,g;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(EF,{strokeWidth:1.8}),e[7]=f):f=e[7],e[8]!==d?(m=u.jsx(Ee,{content:d,children:f}),e[8]=d,e[9]=m):m=e[9],e[10]!==r||e[11]!==h||e[12]!==m?(g=u.jsx(cn,{"aria-label":"Config",shape:"circle",size:"small",className:"h-[27px] w-[27px]","data-testid":"notebook-menu-dropdown",disabled:r,color:h,children:m}),e[10]=r,e[11]=h,e[12]=m,e[13]=g):g=e[13];const x=g,p=t4;let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=E=>{const T=u.jsx(At,{variant:E.variant,disabled:E.disabled,onSelect:I=>E.handle(I),"data-testid":`notebook-menu-dropdown-${E.label}`,children:p(E)},E.label);return E.tooltip?u.jsx(Ee,{content:E.tooltip,side:"left",delayDuration:100,children:u.jsx("span",{children:T})},E.label):T},e[14]=b):b=e[14];const y=b;let v,w,j,C,N,S;if(e[15]!==x||e[16]!==r?(v=u.jsx(_o,{asChild:!0,disabled:r,children:x}),e[15]=x,e[16]=r,e[17]=v):v=e[17],e[18]!==i){let E;e[20]===Symbol.for("react.memo_cache_sentinel")?(E=T=>T.hidden?null:T.dropdown?u.jsxs(bD,{children:[u.jsx(yD,{"data-testid":`notebook-menu-dropdown-${T.label}`,children:p(T)}),u.jsx(vD,{children:u.jsx(wD,{children:T.dropdown.map(I=>u.jsxs(q.Fragment,{children:[I.divider&&u.jsx(an,{}),y(I)]},I.label))})})]},T.label):u.jsxs(q.Fragment,{children:[T.divider&&u.jsx(an,{}),y(T)]},T.label),e[20]=E):E=e[20],w=i.map(E),e[18]=i,e[19]=w}else w=e[19];return e[21]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx(an,{}),e[21]=j):j=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(C=u.jsx("div",{className:"flex-1 px-2 text-xs text-muted-foreground",children:u.jsxs("span",{children:["Version: ",V3()]})}),e[22]=C):C=e[22],e[23]!==w?(N=u.jsxs(Io,{align:"end",className:"no-print w-[240px]",children:[w,j,C]}),e[23]=w,e[24]=N):N=e[24],e[25]!==v||e[26]!==N?(S=u.jsxs(Eo,{modal:!1,children:[v,N]}),e[25]=v,e[26]=N,e[27]=S):S=e[27],S};function t4(t){return u.jsxs(u.Fragment,{children:[t.icon&&u.jsx("span",{className:"flex-0 mr-2",children:t.icon}),u.jsx("span",{className:"flex-1",children:t.labelElement||t.label}),t.hotkey&&u.jsx(Im,{shortcut:t.hotkey,className:"ml-4"}),t.rightElement]})}function bd(t){return Un("create"in t,'Expected query to have a "create" method'),t}const $t=kD({findText:"",replaceText:"",caseSensitive:!1,wholeWord:!1,regexp:!1,isOpen:!1,currentView:void 0},(t,e)=>{if(e===void 0)return t;switch(e.type){case"setFind":return{...t,findText:e.find};case"setReplace":return{...t,replaceText:e.replace};case"setCaseSensitive":return{...t,caseSensitive:e.caseSensitive};case"setWholeWord":return{...t,wholeWord:e.wholeWord};case"setRegex":return{...t,regexp:e.regexp};case"setIsOpen":return{...t,isOpen:e.isOpen};case"setCurrentView":return{...t,currentView:{view:e.view,range:e.range}};case"clearCurrentView":return{...t,currentView:void 0}}});function $g(t){if([...document.querySelectorAll('[role="dialog"][data-state="open"]')].some(e=>e instanceof HTMLElement&&e.childNodes.length>0))return!1;if(t){const e=t.state.selection.main,n=t.state.sliceDoc(e.from,e.to);n?(Qe.set($t,{type:"setFind",find:n}),Qe.set($t,{type:"setCurrentView",view:t,range:{from:e.from,to:e.to}})):Qe.set($t,{type:"setCurrentView",view:t,range:{from:0,to:0}})}return Qe.get($t).isOpen?(Qe.set($t,{type:"setIsOpen",isOpen:!1}),requestAnimationFrame(()=>{Qe.set($t,{type:"setIsOpen",isOpen:!0})}),!0):(Qe.set($t,{type:"setIsOpen",isOpen:!0}),!0)}function n4(){return!!Qe.get($t).isOpen&&(Qe.set($t,{type:"setIsOpen",isOpen:!1}),!0)}function ka(t){return()=>{const e=Qe.get($t),n=new bc({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord});return!!n.valid&&t({query:bd(n).create(),search:n})}}const Vg=t=>ka(({query:e})=>{const n=fs(),o=Qe.get($t).currentView||{view:n[0],range:{from:0,to:0}};let r=o.range.to;t==="prev"&&(n.reverse(),r=o.range.from);let s=n.indexOf(o.view);s<0&&(s=0);const i=[...n,...n].slice(s);for(const a of i){const l=t==="next"?e.nextMatch(a.state,0,r??0):e.prevMatch(a.state,r??a.state.doc.length,a.state.doc.length);if(!l){r=null,a.dispatch({selection:Qn.single(0)});continue}const c=Qn.single(l.from,l.to);return a.dispatch({selection:c,effects:[We.scrollIntoView(c.main,{y:"center"})],userEvent:"select.search"}),Qe.set($t,{type:"setCurrentView",view:a,range:{from:l.from,to:l.to}}),l}return!1}),yd=Vg("next"),Hg=Vg("prev"),o4=ka(({query:t})=>{var o;const e=fs(),n=[];for(const r of e){if(r.state.readOnly)continue;const s=(o=t.matchAll(r.state,1e9))==null?void 0:o.map(a=>{const{from:l,to:c}=a;return{from:l,to:c,insert:t.getReplacement(a)}});if(!s||s.length===0)continue;const i=r.state.doc.toString();n.push(()=>{r.dispatch({changes:[{from:0,to:r.state.doc.length,insert:i}],userEvent:"input.replace.all"})}),r.dispatch({changes:s,userEvent:"input.replace.all"})}return()=>{for(const r of n)r()}}),r4=ka(({query:t})=>{const e=fs(),n=Qe.get($t).currentView||{view:e[0],range:{from:0}};let o=n.range.from,r=e.indexOf(n.view);r<0&&(r=0);const s=[...e,...e].slice(r);for(const i of s){const a=t.nextMatch(i.state,0,o??0);if(!a){o=null,i.dispatch({selection:Qn.single(0)});continue}const l=i.state.toText(t.getReplacement(a));return i.dispatch({changes:[{from:a.from,to:a.to,insert:l}],userEvent:"input.replace"}),yd()}return!1}),s4=ka(({query:t})=>{const e=fs();let n=0;const o=new Map;for(const r of e){const s=t.matchAll(r.state,1e9)||[];for(const i of s){const{from:a,to:l}=i,c=o.get(r)||new Map;c.set(`${a}:${l}`,n++),o.set(r,c)}}return{count:n,position:o}}),vd=Tt.define();function Wg(){const t=fs();for(const e of t)e.state.readOnly||e.dispatch({effects:vd.of(new bc({search:""}))})}const Ca=vn.define({create(){const t=Qe.get($t);return bd(new bc({search:t.findText,caseSensitive:t.caseSensitive,regexp:t.regexp,replace:t.replaceText,wholeWord:t.wholeWord})).create()},update(t,e){for(const n of e.effects)n.is(vd)&&(t=bd(n.value).create());return t}}),i4=ot.mark({class:"cm-searchMatch"}),a4=ot.mark({class:"cm-searchMatch cm-searchMatch-selected"}),l4=$n.fromClass(class{constructor(t){this.view=t,this.decorations=void 0,this.decorations=this.highlight(t.state.field(Ca))}update(t){const e=t.state.field(Ca);(e!==t.startState.field(Ca)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight(t){if(!t.spec.valid)return ot.none;const{view:e}=this,n=new ms,o=e.visibleRanges,r=o.length;for(let s=0;s<r;s++){let{to:i}=o[s];const{from:a}=o[s];for(;s<r-1&&i>o[s+1].from-500;)i=o[++s].to;t.highlight(e.state,a,i,(l,c)=>{const d=e.state.selection.ranges.some(h=>h.from===l&&h.to===c);n.add(l,c,d?a4:i4)})}return n.finish()}},{decorations:t=>t.decorations}),c4=We.baseTheme({"&light .cm-searchMatch":{backgroundColor:"#99ff7780"},"&dark .cm-searchMatch":{backgroundColor:"#22bb0070"},"&light .cm-searchMatch-selected":{backgroundColor:"transparent"},"&dark .cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff88 !important"}}),d4=()=>{var Ie;const t=H.c(102),[e,n]=M.useState(!1),[o,r]=zt($t),[s,i]=M.useState(),a=M.useRef(null),l=Ne(Fi);let c,d;t[0]!==e||t[1]!==o.isOpen?(c=()=>(!e||!o.isOpen)&&$g(),t[0]=e,t[1]=o.isOpen,t[2]=c):c=t[2],Dt("cell.findAndReplace",c),t[3]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{const ke=s4();i(ke===!1?void 0:ke)},t[3]=d):d=t[3];const h=d;let f,m,g,x;if(t[4]!==o.isOpen?(f=()=>{o.isOpen&&a.current&&(a.current.focus(),a.current.select())},m=[o.isOpen],t[4]=o.isOpen,t[5]=f,t[6]=m):(f=t[5],m=t[6]),M.useEffect(f,m),t[7]!==o.findText||t[8]!==o.isOpen?(g=()=>{if(o.isOpen){if(o.findText==="")return i(void 0),void Wg();h(),function(){const ke=Qe.get($t),Ye=fs();for(const Ve of Ye)Ve.state.readOnly||Ve.dispatch({effects:vd.of(new bc({search:ke.findText,caseSensitive:ke.caseSensitive,regexp:ke.regexp,replace:ke.replaceText,wholeWord:ke.wholeWord}))})}()}else Wg()},t[7]=o.findText,t[8]=o.isOpen,t[9]=g):g=t[9],t[10]!==o.caseSensitive||t[11]!==o.findText||t[12]!==o.isOpen||t[13]!==o.regexp||t[14]!==o.wholeWord?(x=[o.findText,o.isOpen,o.caseSensitive,o.regexp,o.wholeWord],t[10]=o.caseSensitive,t[11]=o.findText,t[12]=o.isOpen,t[13]=o.regexp,t[14]=o.wholeWord,t[15]=x):x=t[15],M.useEffect(g,x),!o.isOpen)return null;const p=o.currentView;let b;t[16]!==s||t[17]!==p?(b=p&&s?(Ie=s.position.get(p.view))==null?void 0:Ie.get(`${p.range.from}:${p.range.to}`):void 0,t[16]=s,t[17]=p,t[18]=b):b=t[18];const y=b;let v,w,j,C,N,S,E,T,I,D,F;t[19]===Symbol.for("react.memo_cache_sentinel")?(v=()=>n(!0),t[19]=v):v=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(w=()=>n(!1),t[20]=w):w=t[20],t[21]!==r?(j=ke=>{ke.key==="Escape"&&r({type:"setIsOpen",isOpen:!1})},t[21]=r,t[22]=j):j=t[22],t[23]!==r?(C=()=>r({type:"setIsOpen",isOpen:!1}),t[23]=r,t[24]=C):C=t[24],t[25]===Symbol.for("react.memo_cache_sentinel")?(N=u.jsx(wn,{className:"w-4 h-4"}),t[25]=N):N=t[25],t[26]!==C?(S=u.jsx("div",{className:"absolute top-0 right-0",children:u.jsx(ve,{"data-testid":"close-find-replace-button",onClick:C,size:"xs",variant:"text",children:N})}),t[26]=C,t[27]=S):S=t[27],t[28]!==r?(E=ke=>{r({type:"setFind",find:ke.target.value})},t[28]=r,t[29]=E):E=t[29],t[30]!==o.findText||t[31]!==E?(T=u.jsx(qo,{ref:a,"data-testid":"find-input",value:o.findText,autoFocus:!0,className:"mr-2 mb-0",placeholder:"Find",onKeyDown:h4,onChange:E}),t[30]=o.findText,t[31]=E,t[32]=T):T=t[32],t[33]!==r?(I=ke=>{r({type:"setReplace",replace:ke.target.value})},t[33]=r,t[34]=I):I=t[34],t[35]!==o.replaceText||t[36]!==I?(D=u.jsx(qo,{"data-testid":"replace-input",value:o.replaceText,placeholder:"Replace",onChange:I}),t[35]=o.replaceText,t[36]=I,t[37]=D):D=t[37],t[38]!==T||t[39]!==D?(F=u.jsxs("div",{className:"flex flex-col flex-2 gap-2 w-[55%]",children:[T,D]}),t[38]=T,t[39]=D,t[40]=F):F=t[40];const O=o.caseSensitive?"on":"off";let R,P,z;t[41]!==r?(R=ke=>r({type:"setCaseSensitive",caseSensitive:ke}),t[41]=r,t[42]=R):R=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(P=u.jsx(CD,{className:"w-4 h-4"}),t[43]=P):P=t[43],t[44]!==o.caseSensitive||t[45]!==O||t[46]!==R?(z=u.jsx(Ee,{content:"Case Sensitive",children:u.jsx(Am,{size:"sm",pressed:o.caseSensitive,"data-state":O,onPressedChange:R,children:P})}),t[44]=o.caseSensitive,t[45]=O,t[46]=R,t[47]=z):z=t[47];const _=o.wholeWord?"on":"off";let k,B,A;t[48]!==r?(k=ke=>r({type:"setWholeWord",wholeWord:ke}),t[48]=r,t[49]=k):k=t[49],t[50]===Symbol.for("react.memo_cache_sentinel")?(B=u.jsx(sg,{className:"w-4 h-4"}),t[50]=B):B=t[50],t[51]!==o.wholeWord||t[52]!==_||t[53]!==k?(A=u.jsx(Ee,{content:"Match Whole Word",children:u.jsx(Am,{size:"sm",pressed:o.wholeWord,"data-state":_,onPressedChange:k,children:B})}),t[51]=o.wholeWord,t[52]=_,t[53]=k,t[54]=A):A=t[54];const U=o.regexp?"on":"off";let V,X,Y,G,W;t[55]!==r?(V=ke=>r({type:"setRegex",regexp:ke}),t[55]=r,t[56]=V):V=t[56],t[57]===Symbol.for("react.memo_cache_sentinel")?(X=u.jsx(Wp,{className:"w-4 h-4"}),t[57]=X):X=t[57],t[58]!==o.regexp||t[59]!==U||t[60]!==V?(Y=u.jsx(Ee,{content:"Use Regular Expression",children:u.jsx(Am,{size:"sm",pressed:o.regexp,"data-state":U,onPressedChange:V,children:X})}),t[58]=o.regexp,t[59]=U,t[60]=V,t[61]=Y):Y=t[61],t[62]!==z||t[63]!==A||t[64]!==Y?(G=u.jsxs("div",{className:"flex items-center gap-[2px]",children:[z,A,Y]}),t[62]=z,t[63]=A,t[64]=Y,t[65]=G):G=t[65],t[66]===Symbol.for("react.memo_cache_sentinel")?(W=()=>{r4()&&h()},t[66]=W):W=t[66];const J=o.findText==="";let $,Q;t[67]!==J?($=u.jsx(ve,{"data-testid":"replace-next-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:W,disabled:J,children:"Replace Next"}),t[67]=J,t[68]=$):$=t[68],t[69]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>{const ke=o4();if(!ke)return;h();const{dismiss:Ye}=Je({title:"Replaced all occurrences",action:u.jsx(ba,{"data-testid":"undo-replace-all-button",onClick:()=>{ke(),Ve()}})}),Ve=Ye},t[69]=Q):Q=t[69];const te=o.findText==="";let oe,ne,ie,se,ae,fe,re,ue,le,je,Se,Le;return t[70]!==te?(oe=u.jsx(ve,{"data-testid":"replace-all-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:Q,disabled:te,children:"Replace All"}),t[70]=te,t[71]=oe):oe=t[71],t[72]!==$||t[73]!==oe?(ne=u.jsxs("div",{className:"flex items-center gap-[2px]",children:[$,oe]}),t[72]=$,t[73]=oe,t[74]=ne):ne=t[74],t[75]!==G||t[76]!==ne?(ie=u.jsxs("div",{className:"flex flex-col gap-2",children:[G,ne]}),t[75]=G,t[76]=ne,t[77]=ie):ie=t[77],t[78]!==F||t[79]!==ie?(se=u.jsxs("div",{className:"flex items-center gap-3",children:[F,ie]}),t[78]=F,t[79]=ie,t[80]=se):se=t[80],t[81]===Symbol.for("react.memo_cache_sentinel")?(ae=u.jsx(Ee,{content:"Find Previous",children:u.jsx(ve,{"data-testid":"find-prev-button",size:"xs",variant:"secondary",onClick:f4,children:u.jsx(wt,{className:"w-4 h-4"})})}),t[81]=ae):ae=t[81],t[82]===Symbol.for("react.memo_cache_sentinel")?(fe=u.jsx(Ee,{content:"Find Next",children:u.jsx(ve,{"data-testid":"find-next-button",size:"xs",variant:"secondary",onClick:m4,children:u.jsx(Kc,{className:"w-4 h-4"})})}),t[82]=fe):fe=t[82],t[83]!==y||t[84]!==s?(re=s!=null&&y==null&&u.jsxs("span",{className:"text-sm",children:[s.count," matches"]}),t[83]=y,t[84]=s,t[85]=re):re=t[85],t[86]!==y||t[87]!==s?(ue=s!=null&&y!=null&&u.jsxs("span",{className:"text-sm",children:[y+1," of ",s.count]}),t[86]=y,t[87]=s,t[88]=ue):ue=t[88],t[89]!==re||t[90]!==ue?(le=u.jsxs("div",{className:"flex items-center gap-2",children:[ae,fe,re,ue]}),t[89]=re,t[90]=ue,t[91]=le):le=t[91],t[92]!==l?(je=l.getHotkey("cell.findAndReplace"),t[92]=l,t[93]=je):je=t[93],t[94]!==je.key?(Se=u.jsxs("div",{className:"text-xs text-muted-foreground flex gap-1 mt-2",children:["Press"," ",u.jsx(bm,{shortcut:je.key})," ","again to open the native browser search."]}),t[94]=je.key,t[95]=Se):Se=t[95],t[96]!==S||t[97]!==se||t[98]!==le||t[99]!==Se||t[100]!==j?(Le=u.jsx(Tm,{restoreFocus:!0,autoFocus:!0,children:u.jsxs("div",{onFocus:v,onClick:u4,onBlur:w,className:"fixed top-0 right-0 w-[500px] flex flex-col bg-(--sage-1) p-4 z-50 mt-2 mr-3 rounded-md shadow-lg border gap-2 print:hidden",onKeyDown:j,children:[S,se,le,Se]})}),t[96]=S,t[97]=se,t[98]=le,t[99]=Se,t[100]=j,t[101]=Le):Le=t[101],Le};function u4(t){t.stopPropagation(),t.preventDefault()}function h4(t){t.key==="Enter"&&(t.shiftKey?Hg():yd())}function f4(){return Hg()}function m4(){return yd()}const qg=t=>{const e=H.c(41),{resetOnBlur:n,placeholderText:o,initialValue:r,flexibleWidth:s,onNameChange:i,className:a}=t,l=n!==void 0&&n,c=r===void 0?null:r,d=s!==void 0&&s,{sendListFiles:h}=nt(),[f,m]=M.useState(c);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[0]=g):g=e[0];const[x,p]=M.useState(g),[b,y]=M.useState(!1),v=M.useRef(null),w=M.useRef(!1);let j,C,N;e[1]!==c?(j=()=>{m(c)},C=[c],e[1]=c,e[2]=j,e[3]=C):(j=e[2],C=e[3]),M.useEffect(j,C),e[4]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{y(!0)},e[4]=N):N=e[4];const S=N;let E;e[5]!==c||e[6]!==l?(E=te=>{var oe;(oe=te.relatedTarget)!=null&&oe.closest(".filename-input")||(y(!1),l&&m(c))},e[5]=c,e[6]=l,e[7]=E):E=e[7];const T=E;let I;e[8]!==f?(I=yn.dirname(f||""),e[8]=f,e[9]=I):I=e[9];const D=I,F=yn.basename(f||""),O=x.filter(te=>yn.basename(te.path).startsWith(F));let R,P;e[10]!==D||e[11]!==b||e[12]!==h?(R=async()=>{if(!b)return void p([]);const te=await h({path:D});p(te.files)},e[10]=D,e[11]=b,e[12]=h,e[13]=R):R=e[13],e[14]!==D||e[15]!==b?(P=[D,b],e[14]=D,e[15]=b,e[16]=P):P=e[16];const{isPending:z}=Tn(R,P),_=function(te,oe,ne){if(te&&!te.endsWith("/")&&((jm("markdown")?new Set(["py","md","markdown","qmd"]):new Set(["py"])).has(yn.extension(te))||(te=te.endsWith(".")?`${te}py`:te.endsWith(".p")?`${te}y`:`${te}.py`),!oe.some(ie=>ie.path===te||yn.basename(ie.path)===te)&&!(ne&&(ne===te||yn.basename(ne)===te))))return te}(f,x,c),k=(_||O.length>0)&&u.jsxs(xm,{className:"font-mono",children:[!z&&u.jsx(ac,{children:"No files"}),_&&u.jsxs(Zn,{variant:"success",className:"py-2 px-3",onSelect:()=>{var te;_&&(w.current=!0,i(_),(te=v.current)==null||te.blur())},children:[u.jsx(Sp,{className:"w-4 h-4 mr-2"})," ",u.jsxs("span",{className:"text-sm",children:[c?"Rename to: ":"Save as: ",u.jsx("span",{className:"font-medium text-sm",children:yn.basename(_)})]})]},"_rename_"),O.map(te=>{const oe=te.isDirectory?"directory":H3(te.path),ne=W3[oe];return u.jsxs(Zn,{variant:te.isDirectory?"default":"muted",className:"py-2 px-3",onSelect:()=>{te.isDirectory?m(`${te.path}/`):m(te.path)},children:[u.jsx(ne,{className:"w-4 h-4 mr-2"})," ",yn.basename(te.path)]},te.path)})]}),B=10*Math.max(20,(f==null?void 0:f.length)||(o==null?void 0:o.length)||0),A=b?f||"":c||"";let U,V,X;e[17]!==d||e[18]!==B?(U=d?{maxWidth:B}:void 0,e[17]=d,e[18]=B,e[19]=U):U=e[19],e[20]!==a?(V=xe(a,"w-full px-4 py-1 my-1 h-9 font-mono text-foreground/60"),e[20]=a,e[21]=V):V=e[21],e[22]!==o||e[23]!==A||e[24]!==U||e[25]!==V?(X=u.jsx(jD,{children:u.jsx(zi,{"data-testid":"dir-completion-input",tabIndex:-1,rootClassName:"border-none justify-center px-1",spellCheck:"false",value:A,onKeyDown:p4,icon:null,ref:v,onValueChange:m,placeholder:o,autoComplete:"off",style:U,className:V})}),e[22]=o,e[23]=A,e[24]=U,e[25]=V,e[26]=X):X=e[26];const Y=k&&"group-focus-within:block";let G,W,J,$,Q;return e[27]!==Y?(G=xe("p-0 w-full min-w-80 max-w-80vw hidden",Y),e[27]=Y,e[28]=G):G=e[28],e[29]!==k||e[30]!==G?(W=u.jsx(ps,{side:"bottom",className:G,portal:!1,children:k}),e[29]=k,e[30]=G,e[31]=W):W=e[31],e[32]!==X||e[33]!==W?(J=u.jsxs(xm,{children:[X,W]}),e[32]=X,e[33]=W,e[34]=J):J=e[34],e[35]!==T||e[36]!==J?($=u.jsx(yc,{onFocus:S,onBlur:T,shouldFilter:!1,id:"filename-input",className:"bg-transparent group filename-input",children:J}),e[35]=T,e[36]=J,e[37]=$):$=e[37],e[38]!==b||e[39]!==$?(Q=u.jsx(vc,{children:u.jsx(br,{open:b,modal:!1,children:$})}),e[38]=b,e[39]=$,e[40]=Q):Q=e[40],Q};function p4(t){t.key==="Escape"&&t.currentTarget.blur()}const g4=t=>{const e=H.c(33),n=()=>{$i(new Blob([o()],{type:"text/plain"}),`${t.proposedName}.json`)},o=Fe(y4);let r,s,i,a,l,c,d,h,f,m,g,x,p,b,y,v,w;return e[0]!==n||e[1]!==t?(r=j=>{j.preventDefault(),n(),t.closeModal()},e[0]=n,e[1]=t,e[2]=r):r=e[2],e[3]!==t?(s=j=>{j.key==="Escape"&&t.closeModal()},e[3]=t,e[4]=s):s=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(Wo,{className:"text-accent-foreground mb-6",children:"Download unsaved changes?"}),e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a={wordBreak:"break-word"},e[6]=a):a=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx("p",{children:"This app has unsaved changes. To recover:"}),c={paddingBottom:"10px"},e[7]=l,e[8]=c):(l=e[7],c=e[8]),e[9]!==t.proposedName?(d=u.jsxs("li",{style:c,children:['Click the "Download" button. This will download a file called\xA0',u.jsxs("code",{children:[t.proposedName,".json"]}),". This file contains your code."]}),e[9]=t.proposedName,e[10]=d):d=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(h={paddingBottom:"10px"},e[11]=h):h=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(f={display:"block",padding:"10px"},e[12]=f):f=e[12],e[13]!==t.proposedName?(m=u.jsxs("code",{style:f,children:["marimo recover ",t.proposedName,".json ",">"," ",t.proposedName,".py"]}),e[13]=t.proposedName,e[14]=m):m=e[14],e[15]!==t.proposedName?(g=u.jsxs("code",{children:[t.proposedName,".py"]}),e[15]=t.proposedName,e[16]=g):g=e[16],e[17]!==g||e[18]!==m?(x=u.jsxs("li",{style:h,children:["In your terminal, type",m,"to overwrite ",g," with the recovered changes."]}),e[17]=g,e[18]=m,e[19]=x):x=e[19],e[20]!==x||e[21]!==d?(p=u.jsx(cs,{className:"markdown break-words",style:a,children:u.jsxs("div",{className:"prose dark:prose-invert",children:[l,u.jsxs("ol",{children:[d,x]})]})}),e[20]=x,e[21]=d,e[22]=p):p=e[22],e[23]!==t.closeModal?(b=u.jsx(ve,{"aria-label":"Cancel",variant:"secondary","data-testid":"cancel-recovery-button",onClick:t.closeModal,children:"Cancel"}),e[23]=t.closeModal,e[24]=b):b=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(y=u.jsx(ve,{"data-testid":"download-recovery-button","aria-label":"Download",variant:"default",type:"submit",children:"Download"}),e[25]=y):y=e[25],e[26]!==b?(v=u.jsxs(Ti,{children:[b,y]}),e[26]=b,e[27]=v):v=e[27],e[28]!==r||e[29]!==s||e[30]!==p||e[31]!==v?(w=u.jsx(Go,{className:"w-fit",children:u.jsxs("form",{onSubmit:r,onKeyDown:s,children:[i,p,v]})}),e[28]=r,e[29]=s,e[30]=p,e[31]=v,e[32]=w):w=e[32],w},x4=t=>{const e=H.c(12),{filename:n,needsSave:o}=t,{openModal:r,closeModal:s}=An();let i;e[0]!==n?(i=n===null?"app":yn.basename(n).split(".")[0],e[0]=n,e[1]=i):i=e[1];const a=i;let l;e[2]!==s||e[3]!==o||e[4]!==r||e[5]!==a?(l=()=>{o&&r(u.jsx(g4,{proposedName:a,closeModal:s}))},e[2]=s,e[3]=o,e[4]=r,e[5]=a,e[6]=l):l=e[6];const c=l;let d;Dt("global.save",c),e[7]===Symbol.for("react.memo_cache_sentinel")?(d=Gt("global.save"),e[7]=d):d=e[7];const h=o?"yellow":"gray";let f,m;return e[8]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(fa,{strokeWidth:1.5,size:18}),e[8]=f):f=e[8],e[9]!==c||e[10]!==h?(m=u.jsx(Ee,{content:d,children:u.jsx(cn,{onClick:c,id:"save-button","aria-label":"Save",className:"rectangle",color:h,children:f})}),e[9]=c,e[10]=h,e[11]=m):m=e[11],m};function b4(t){return{id:t.id,name:t.name,code:t.code,code_hash:null,config:{column:0,...t.config}}}function y4(){const t=bn(),e=Mm(t),n={version:"1",metadata:{marimo_version:V3()},cells:e.map(b4)};return JSON.stringify(n,null,2)}const wd=5e3,kd=jt(void 0),Gg=jt(t=>{const e=t(kd);return function({state:n,layout:o,lastSavedNotebook:r}){if(!r)return!1;const{cellIds:s,cellData:i}=n,a=s.inOrderIds.map(h=>i[h]),l=a.map(h=>h.code),c=a.map(h=>h.config),d=a.map(h=>h.name);return!(q3(l,r.codes)&&q3(d,r.names)&&Vi(c,r.configs)&&Vi(o.selectedLayout,r.layout.selectedLayout)&&Vi(o.layoutData,r.layout.layoutData))}({state:t(In),layout:t(Sj),lastSavedNotebook:e})});function v4(t){return JSON.stringify(t)}const w4=t=>{const e=H.c(15),{kioskMode:n}=t,o=Nm(),r=Ne(Gg),s=Ne(ln).state===Bt.CLOSED,{saveOrNameNotebook:i,saveIfNotebookIsPersistent:a}=Cd();let l,c,d;e[0]!==n||e[1]!==a?(l={onSave:a,kioskMode:n},e[0]=n,e[1]=a,e[2]=l):l=e[2],function(p){const b=H.c(14),y=Ne(K3),v=Dm(),[w]=zt(ln),j=Ne(Gg);let C,N;if(b[0]!==v){const D=Mm(v);C=D.map(N4),N=D.map(S4),b[0]=v,b[1]=C,b[2]=N}else C=b[1],N=b[2];const S=N;let E;b[3]!==v?(E=Y3(v),b[3]=v,b[4]=E):E=b[4];const T=E;let I;b[5]!==y||b[6]!==S||b[7]!==C||b[8]!==T||b[9]!==w||b[10]!==j||b[11]!==p.kioskMode||b[12]!==p.onSave?(I={onSave:p.onSave,needsSave:j,codes:C,cellConfigs:T,cellNames:S,connStatus:w,config:y,kioskMode:p.kioskMode},b[5]=y,b[6]=S,b[7]=C,b[8]=T,b[9]=w,b[10]=j,b[11]=p.kioskMode,b[12]=p.onSave,b[13]=I):I=b[13],function(D){const F=H.c(21),{codes:O,cellConfigs:R,config:P,connStatus:z,cellNames:_,needsSave:k,kioskMode:B,onSave:A}=D,U=M.useRef(null);let V;F[0]!==O?(V=O.join(":"),F[0]=O,F[1]=V):V=F[1];const X=V;let Y;F[2]!==R?(Y=R.map(v4).join(":"),F[2]=R,F[3]=Y):Y=F[3];const G=Y;let W;F[4]!==_?(W=_.join(":"),F[4]=_,F[5]=W):W=F[5];const J=W;let $,Q;F[6]!==P||F[7]!==z.state||F[8]!==B||F[9]!==k||F[10]!==A?($=()=>{if(!B)return P.autosave==="after_delay"&&(U.current!==null&&clearTimeout(U.current),k&&z.state===Bt.OPEN&&(U.current=setTimeout(A,P.autosave_delay))),()=>{U.current!==null&&clearTimeout(U.current)}},F[6]=P,F[7]=z.state,F[8]=B,F[9]=k,F[10]=A,F[11]=$):$=F[11],F[12]!==G||F[13]!==J||F[14]!==X||F[15]!==P||F[16]!==z.state||F[17]!==B||F[18]!==k||F[19]!==A?(Q=[X,G,J,P,z.state,A,B,k],F[12]=G,F[13]=J,F[14]=X,F[15]=P,F[16]=z.state,F[17]=B,F[18]=k,F[19]=A,F[20]=Q):Q=F[20],M.useEffect($,Q)}(I)}(l),function(){const p=H.c(12),b=Ne(SD),{state:y}=Ne(ln),v=b.auto_download.includes("markdown"),w=b.auto_download.includes("html"),j=b.auto_download.includes("ipynb"),C=!v||y!==Bt.OPEN,N=!w||y!==Bt.OPEN,S=!j||y!==Bt.OPEN,{autoExportAsHTML:E,autoExportAsIPYNB:T,autoExportAsMarkdown:I}=nt();let D,F,O,R,P,z;p[0]!==I?(D=async()=>{await I({download:!1})},p[0]=I,p[1]=D):D=p[1],p[2]!==C?(F={delayMs:wd,whenVisible:!0,disabled:C},p[2]=C,p[3]=F):F=p[3],sa(D,F),p[4]!==E?(O=async()=>{await E({download:!1,includeCode:!0,files:xj.INSTANCE.filenames()})},p[4]=E,p[5]=O):O=p[5],p[6]!==N?(R={delayMs:wd,whenVisible:!0,disabled:N},p[6]=N,p[7]=R):R=p[7],sa(O,R),p[8]!==T?(P=async()=>{await T({download:!1})},p[8]=T,p[9]=P):P=p[9],p[10]!==S?(z={delayMs:wd,whenVisible:!0,disabled:S},p[10]=S,p[11]=z):z=p[11],sa(P,z)}(),e[3]!==r?(c=p=>{if(r)return p.preventDefault(),p.returnValue="You have unsaved changes. Are you sure you want to leave?",p.returnValue},e[3]=r,e[4]=c):c=e[4],Jl(window,"beforeunload",c),e[5]!==i?(d=p=>{p.preventDefault(),p.stopPropagation(),i()},e[5]=i,e[6]=d):d=e[6];const h=d;if(Dt("global.save",i),s){let p;return e[7]!==o||e[8]!==r?(p=u.jsx(x4,{filename:o,needsSave:r}),e[7]=o,e[8]=r,e[9]=p):p=e[9],p}let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=Gt("global.save"),e[10]=f):f=e[10];const m=r?"yellow":"hint-green";let g,x;return e[11]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx(fa,{strokeWidth:1.5,size:18}),e[11]=g):g=e[11],e[12]!==h||e[13]!==m?(x=u.jsx(Ee,{content:f,children:u.jsx(cn,{"data-testid":"save-button",id:"save-button",shape:"rectangle",color:m,onClick:h,children:g})}),e[12]=h,e[13]=m,e[14]=x):x=e[14],x};function Cd(){const t=H.c(20),{sendSave:e}=nt(),{openModal:n,closeModal:o,openAlert:r}=An(),s=Ct(kd),i=G3(),a=Om();let l;t[0]!==r||t[1]!==e||t[2]!==s||t[3]!==a?(l=(b,y)=>{const v=bn(),w=Mm(v),j=w.map(j4),C=w.map(C4),N=w.map(k4),S=Y3(v),E=a.get(ln),T=a.get(K3),I=a.get(Sj);a.get(ds)||C.length!==0&&(E.state===Bt.OPEN?(ut.log("saving to ",b),e({cellIds:j,codes:C,names:N,filename:b,configs:S,layout:_F(),persist:!0}).then(()=>{y&&T.format_on_save&&X3(),s({names:N,codes:C,configs:S,layout:I})})):r("Failed to save notebook: not connected to a kernel."))},t[0]=r,t[1]=e,t[2]=s,t[3]=a,t[4]=l):l=t[4];const c=Fe(l);let d;t[5]!==c||t[6]!==a?(d=b=>{const y=b!==void 0&&b,v=a.get(J3),w=a.get(ln);Yg(v)&&w.state===Bt.OPEN&&c(v,y)},t[5]=c,t[6]=a,t[7]=d):d=t[7];const h=Fe(d);let f;t[8]!==c||t[9]!==i?(f=b=>{i(b).then(y=>{y!==null&&c(y,!0)})},t[8]=c,t[9]=i,t[10]=f):f=t[10];const m=f;let g;t[11]!==o||t[12]!==m||t[13]!==n||t[14]!==h||t[15]!==a?(g=()=>{const b=a.get(J3),y=a.get(ln);h(!0),Yg(b)||y.state===Bt.CLOSED||n(u.jsx(E4,{onClose:o,onSave:m}))},t[11]=o,t[12]=m,t[13]=n,t[14]=h,t[15]=a,t[16]=g):g=t[16];const x=Fe(g);let p;return t[17]!==h||t[18]!==x?(p={saveOrNameNotebook:x,saveIfNotebookIsPersistent:h},t[17]=h,t[18]=x,t[19]=p):p=t[19],p}function k4(t){return t.name}function C4(t){return t.code}function j4(t){return t.id}function Yg(t){return t!==null&&!t.startsWith("/tmp")&&!t.startsWith("/var/folders")&&!t.includes("AppData\\Local\\Temp")}function S4(t){return t.name}function N4(t){return t.code}const E4=t=>{const e=H.c(17),{onClose:n,onSave:o}=t,[r,s]=M.useState();let i;e[0]!==n||e[1]!==o?(i=p=>{s(p),p.trim()&&(o(p),n())},e[0]=n,e[1]=o,e[2]=i):i=e[2];const a=i;let l,c,d,h;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(Wo,{children:"Save notebook"}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(gr,{className:"text-md pt-6 px-1",children:"Save as"}),e[4]=c):c=e[4],e[5]!==a?(d=u.jsxs("div",{className:"flex flex-col",children:[c,u.jsx(qg,{onNameChange:a,placeholderText:"filename",className:"missing-filename"})]}),e[5]=a,e[6]=d):d=e[6],e[7]!==n?(h=u.jsx(ve,{"data-testid":"cancel-save-dialog-button","aria-label":"Cancel",variant:"secondary",onClick:n,children:"Cancel"}),e[7]=n,e[8]=h):h=e[8];const f=!r;let m,g,x;return e[9]!==f?(m=u.jsx(ve,{"data-testid":"submit-save-dialog-button","aria-label":"Save",variant:"default",disabled:f,type:"submit",children:"Save"}),e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(g=u.jsxs(Ti,{children:[h,m]}),e[11]=h,e[12]=m,e[13]=g):g=e[13],e[14]!==d||e[15]!==g?(x=u.jsxs(Go,{children:[l,d,g]}),e[14]=d,e[15]=g,e[16]=x):x=e[16],x};function Kg(t){const e=H.c(3),[n,o]=M.useState(!1);let r,s;return e[0]!==t?(r=()=>{if(!t)return;o(!1);const i=setTimeout(()=>{o(!0)},200);return()=>clearTimeout(i)},s=[t],e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]),M.useEffect(r,s),t&&n}const Rs=t=>{const{children:e}=t;return Ne(ds)?null:e},_4=t=>{const{children:e}=t;return Ne(ds)?e:null},I4=()=>{const t=H.c(6),e=Ct(pd);let n;t[0]!==e?(n=()=>e(A4),t[0]=e,t[1]=n):n=t[1];const o=n;let r,s,i;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=Gt("global.commandPalette"),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx(Qc,{strokeWidth:1.5,size:18}),t[3]=s):s=t[3],t[4]!==o?(i=u.jsx(Ee,{content:r,children:u.jsx(cn,{"data-testid":"command-palette-button",onClick:o,shape:"rectangle",color:"hint-green",children:s})}),t[4]=o,t[5]=i):i=t[5],i};function A4(t){return!t}const T4=t=>{const e=H.c(47),{presenting:n,onTogglePresenting:o,onInterrupt:r,onRun:s,connectionState:i,running:a,appConfig:l}=t,c=l.width,d=Ne(B3),h=Ne(ND),{undoDeleteCell:f}=lt(),m=i===Bt.CLOSED;let g,x=null;if(!m&&d){let k,B;e[0]===Symbol.for("react.memo_cache_sentinel")?(k=u.jsx(dd,{size:16,strokeWidth:1.5}),e[0]=k):k=e[0],e[1]!==f?(B=u.jsx(Ee,{content:"Undo cell deletion",children:u.jsx(cn,{"data-testid":"undo-delete-cell",size:"medium",color:"hint-green",shape:"circle",onClick:f,children:k})}),e[1]=f,e[2]=B):B=e[2],x=B}e[3]!==i?(g=eo(i),e[3]=i,e[4]=g):g=e[4];const p=g;let b;e[5]!==i||e[6]!==p?(b=p?wc(i):void 0,e[5]=i,e[6]=p,e[7]=b):b=e[7];const y=b;let v,w;e[8]!==n?(v=!n&&u.jsx(d4,{}),e[8]=n,e[9]=v):v=e[9],e[10]!==m||e[11]!==y||e[12]!==p||e[13]!==n?(w=!m&&u.jsxs("div",{className:D4,children:[n&&u.jsx(AS,{}),u.jsx(e4,{disabled:p,tooltip:y}),u.jsx(pF,{disabled:p,tooltip:y}),u.jsx(gF,{description:"This will terminate the Python kernel. You'll lose all data that's in memory.",disabled:p,tooltip:y})]}),e[10]=m,e[11]=y,e[12]=p,e[13]=n,e[14]=w):w=e[14];const j=c==="compact"&&"xl:flex-row items-end";let C,N,S,E,T,I,D,F,O,R,P,z,_;return e[15]!==j?(C=xe(R4,j),e[15]=j,e[16]=C):C=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(N=u.jsx(Rs,{children:u.jsx(w4,{kioskMode:!1})}),e[17]=N):N=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(S=Gt("global.hideCode"),e[18]=S):S=e[18],e[19]!==n?(E=n?u.jsx($3,{strokeWidth:1.5,size:18}):u.jsx(od,{strokeWidth:1.5,size:18}),e[19]=n,e[20]=E):E=e[20],e[21]!==o||e[22]!==E?(T=u.jsx(Ee,{content:S,children:u.jsx(cn,{"data-testid":"hide-code-button",id:"preview-button",shape:"rectangle",color:"hint-green",onClick:o,children:E})}),e[21]=o,e[22]=E,e[23]=T):T=e[23],e[24]===Symbol.for("react.memo_cache_sentinel")?(I=u.jsx(I4,{}),D=u.jsx(xF,{}),F=u.jsx("div",{}),e[24]=I,e[25]=D,e[26]=F):(I=e[24],D=e[25],F=e[26]),e[27]!==m||e[28]!==r||e[29]!==a?(O=!m&&u.jsx(O4,{running:a,onInterrupt:r}),e[27]=m,e[28]=r,e[29]=a,e[30]=O):O=e[30],e[31]!==m||e[32]!==h||e[33]!==s?(R=!m&&u.jsx(M4,{needsRun:h,onRun:s}),e[31]=m,e[32]=h,e[33]=s,e[34]=R):R=e[34],e[35]!==O||e[36]!==R||e[37]!==x?(P=u.jsx(Rs,{children:u.jsxs("div",{className:"flex flex-col gap-2 items-center",children:[x,O,R]})}),e[35]=O,e[36]=R,e[37]=x,e[38]=P):P=e[38],e[39]!==T||e[40]!==P||e[41]!==C?(z=u.jsxs("div",{className:C,children:[N,T,I,D,F,P]}),e[39]=T,e[40]=P,e[41]=C,e[42]=z):z=e[42],e[43]!==z||e[44]!==v||e[45]!==w?(_=u.jsxs(u.Fragment,{children:[v,w,z]}),e[43]=z,e[44]=v,e[45]=w,e[46]=_):_=e[46],_},M4=t=>{const e=H.c(8),{needsRun:n,onRun:o}=t,r=Ne(Z3);if(n){let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=Gt("global.runStale"),e[0]=l):l=e[0];const c=r?o:void 0,d=!r;let h,f;return e[1]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(Sr,{strokeWidth:1.5,size:16}),e[1]=h):h=e[1],e[2]!==c||e[3]!==d?(f=u.jsx(Ee,{content:l,children:u.jsx(cn,{"data-testid":"run-button",size:"medium",color:"yellow",shape:"circle",onClick:c,disabled:d,children:h})}),e[2]=c,e[3]=d,e[4]=f):f=e[4],f}const s=!r;let i,a;return e[5]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(Sr,{strokeWidth:1.5,size:16}),e[5]=i):i=e[5],e[6]!==s?(a=u.jsx(Ee,{content:"Nothing to run",children:u.jsx(cn,{"data-testid":"run-button",className:"inactive-button",color:"disabled",size:"medium",shape:"circle",disabled:s,children:i})}),e[6]=s,e[7]=a):a=e[7],a},O4=t=>{const e=H.c(8),{running:n,onInterrupt:o}=t,r=Kg(n);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=Gt("global.interrupt"),e[0]=s):s=e[0];const i=!r&&"inactive-button active:shadow-xs-solid";let a;e[1]!==i?(a=xe(i),e[1]=i,e[2]=a):a=e[2];const l=r?"yellow":"disabled",c=r?o:Bn.NOOP;let d,h;return e[3]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(fc,{strokeWidth:1.5,size:16}),e[3]=d):d=e[3],e[4]!==a||e[5]!==l||e[6]!==c?(h=u.jsx(Ee,{content:s,children:u.jsx(cn,{className:a,"data-testid":"interrupt-button",size:"medium",color:l,shape:"circle",onClick:c,children:d})}),e[4]=a,e[5]=l,e[6]=c,e[7]=h):h=e[7],h},D4="absolute top-3 right-5 m-0 flex items-center gap-2 min-h-[28px] no-print pointer-events-auto z-30 print:hidden",R4="absolute bottom-5 right-5 flex flex-col gap-2 items-center no-print pointer-events-auto z-30 print:hidden",P4=t=>{const e=H.c(7),{filename:n}=t,o=G3();let r;e[0]!==n?(r=n?yn.basename(n):"untitled marimo notebook",e[0]=n,e[1]=r):r=e[1];const s=n===null?"missing-filename":"filename";let i;return e[2]!==n||e[3]!==o||e[4]!==r||e[5]!==s?(i=u.jsx(qg,{placeholderText:r,initialValue:n,onNameChange:o,flexibleWidth:!0,resetOnBlur:!0,"data-testid":"filename-input",className:s}),e[2]=n,e[3]=o,e[4]=r,e[5]=s,e[6]=i):i=e[6],i},jd=()=>({entries:new Map}),{valueAtom:Xg,useActions:Jg}=Q3(jd,{submit:(t,e)=>{const{cellIds:n,deleteCell:o,deleteManyCells:r,store:s}=e,i=s.get(In),a=s.get(kc),l=new Set(i.cellIds.inOrderIds.filter(h=>i.cellData[h].code.trim()==="")),c=new Map;for(const h of n){if(l.has(h)){c.set(h,{cellId:h,type:"simple"});continue}const f=i.cellRuntime[h],m=new Map;for(const x of Object.values(a)){const p=x.declaredBy.includes(h),b=x.usedBy.some(y=>!l.has(y));p&&b&&m.set(x.name,x.usedBy)}let g;f!=null&&f.runElapsedTimeMs&&f.runElapsedTimeMs>2e3&&(g=f.runElapsedTimeMs),m.size===0&&g===void 0?c.set(h,{cellId:h,type:"simple"}):c.set(h,{cellId:h,type:"expensive",executionDurationMs:g,defs:m})}const d=[...c.values()].every(h=>h.type==="simple");return c.size>0&&d?(c.size===1?o({cellId:[...c.values()][0].cellId}):r({cellIds:[...c.values()].map(h=>h.cellId)}),jd()):{...t,entries:c}},clear:()=>jd()});function Ps(){const t=Om(),{submit:e,clear:n}=Jg(),{entries:o}=Ne(Xg),r=Ms(),s=Os();return M.useMemo(()=>({submit:i=>{e({cellIds:i,deleteCell:r,deleteManyCells:s,store:t})},clear:n,get idle(){return o.size===0},get shouldConfirmDelete(){return o.size>1}}),[t,e,n,o,r,s])}function L4(t){return t.cellId}function Zg(){return{selectionStart:null,selectionEnd:null,selected:new Set}}const{valueAtom:Sd,useActions:F4}=Q3(Zg,{select:(t,e)=>({selectionStart:e.cellId,selectionEnd:e.cellId,selected:new Set([e.cellId])}),extend:(t,e)=>{if(!t.selectionStart)return{selectionStart:e.cellId,selectionEnd:e.cellId,selected:new Set([e.cellId])};const{cellId:n,allCellIds:o}=e;try{const r=o.findWithId(t.selectionStart),s=r.indexOfOrThrow(t.selectionStart),i=r.indexOfOrThrow(n),[a,l]=s<i?[s,i]:[i,s],c=r.slice(a,l+1);return{selectionStart:t.selectionStart,selectionEnd:n,selected:new Set(c)}}catch{return{selectionStart:n,selectionEnd:n,selected:new Set([n])}}},clear:t=>t.selected.size===0?t:Zg()});function ja(){return F4()}const z4=t=>{const e=H.c(14),{actions:n,cellIds:o,disabled:r}=t;let s,i,a,l,c;if(e[0]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx(qc,{size:13,strokeWidth:1.5}),e[0]=s):s=e[0],e[1]!==r?(i=u.jsx(_o,{asChild:!0,children:u.jsx(ve,{variant:"ghost",size:"sm",className:"h-8 px-2 gap-1",title:"More actions",disabled:r,children:s})}),e[1]=r,e[2]=i):i=e[2],e[3]!==n||e[4]!==o){let d;e[6]!==n.length||e[7]!==o?(d=(h,f)=>{const m=h.map(g=>u.jsx(At,{onSelect:()=>g.handle(o),className:"flex items-center gap-2",children:u.jsxs("div",{className:"flex items-center flex-1",children:[g.icon&&u.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:g.icon}),u.jsx("div",{className:"flex-1",children:g.label}),g.hotkey&&u.jsx(Im,{shortcut:g.hotkey,className:"ml-4"})]})},g.label));return u.jsxs(q.Fragment,{children:[m,f<n.length-1&&u.jsx(an,{})]},f)},e[6]=n.length,e[7]=o,e[8]=d):d=e[8],a=n.flatMap(d),e[3]=n,e[4]=o,e[5]=a}else a=e[5];return e[9]!==a?(l=u.jsx(Io,{align:"start","data-keep-cell-selection":!0,children:a}),e[9]=a,e[10]=l):l=e[10],e[11]!==i||e[12]!==l?(c=u.jsxs(Eo,{children:[i,l]}),e[11]=i,e[12]=l,e[13]=c):c=e[13],c};function B4(t){return t.length>0}function U4(t){return t.filter($4)}function $4(t){return!t.hidden}function V4(t){return t.length>0}function H4(t){return t.filter(W4)}function W4(t){return!t.hidden}function q4(t){const e={};t.forEach(n=>{const o=Ri(n);o&&(e[n]=o)}),k3(e)}const G4=()=>{const t=H.c(4),e=Ne(Sd);let n;t[0]!==e.selected?(n=[...e.selected],t[0]=e.selected,t[1]=n):n=t[1];const o=n;if(o.length<2)return null;let r;return t[2]!==o?(r=u.jsxs(u.Fragment,{children:[u.jsx(K4,{cellIds:o}),u.jsx(Y4,{cellIds:o})]}),t[2]=o,t[3]=r):r=t[3],r},Nd=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx("div",{className:"h-4 w-px bg-border mx-1"}),t[0]=e):e=t[0],e},Y4=t=>{const e=H.c(12),{cellIds:n}=t,o=Ps(),r=Os(),s=ja();if(!o.shouldConfirmDelete)return null;let i,a,l,c,d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(Rm,{className:"w-4 h-4 text-(--amber-11) mt-0.5 shrink-0"}),e[0]=i):i=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsxs("div",{className:"font-code text-sm text-[0.84375rem]",children:[u.jsx("p",{className:"text-(--amber-11) font-medium",children:"Some cells in selection may contain expensive operations."}),u.jsx("p",{className:"text-(--amber-11) mt-1",children:"Are you sure you want to delete?"})]}),e[1]=a):a=e[1],e[2]!==o?(l=u.jsx(ve,{size:"xs",variant:"ghost",onClick:()=>o.clear(),className:"text-(--amber-11) hover:bg-(--amber-4) hover:text-(--amber-11)",children:"Cancel"}),e[2]=o,e[3]=l):l=e[3],e[4]!==n||e[5]!==r||e[6]!==o||e[7]!==s?(c=u.jsx(ve,{size:"xs",variant:"secondary",onClick:()=>{r({cellIds:n}),o.clear(),s.clear()},className:"bg-(--amber-11) hover:bg-(--amber-12) text-white border-(--amber-11)",children:"Delete"}),e[4]=n,e[5]=r,e[6]=o,e[7]=s,e[8]=c):c=e[8],e[9]!==l||e[10]!==c?(d=u.jsx("div",{className:"absolute top-12 justify-center flex w-full left-0 right-0 z-50","data-keep-cell-selection":!0,children:u.jsx("div",{className:"mx-20",children:u.jsx("div",{className:"bg-(--amber-2) border border-(--amber-6) rounded-lg shadow-lg mt-14 px-4 py-3 animate-in slide-in-from-top-2 duration-200",children:u.jsxs("div",{className:"flex items-start gap-3",children:[i,u.jsxs("div",{className:"flex-1",children:[a,u.jsx(Tm,{restoreFocus:!0,autoFocus:!0,children:u.jsxs("div",{className:"flex items-center gap-2 mt-3",onKeyDown:X4,children:[l,c]})})]})]})})})}),e[9]=l,e[10]=c,e[11]=d):d=e[11],d},K4=t=>{const e=H.c(23),{cellIds:n}=t,o=ja(),r=Ps(),{actions:s,moreActions:i}=function(p){const b=H.c(31),{updateCellConfig:y,moveCell:v,clearCellOutput:w,sendToTop:j,sendToBottom:C}=lt(),N=Os(),S=Ne(Zl),E=ja(),T=Is(),I=Ps(),D=Ne(Cc),{saveCellConfig:F}=nt(),O=p.length,R=!S||O<p.length;let P;b[0]!==N||b[1]!==I||b[2]!==E||b[3]!==D?(P=oe=>{I.idle&&D.keymap.destructive_delete?I.submit(oe):(N({cellIds:oe}),I.clear(),E.clear())},b[0]=N,b[1]=I,b[2]=E,b[3]=D,b[4]=P):P=b[4];const z=Fe(P);let _;b[5]!==v?(_=(oe,ne)=>{if(ne==="down"){const ie=oe[oe.length-1];if(Qe.get(In).cellIds.findWithId(ie).last()===ie)return}if(ne==="up"){const ie=oe[0];if(Qe.get(In).cellIds.findWithId(ie).first()===ie)return}(ne==="up"?oe:[...oe].reverse()).forEach(ie=>{v({cellId:ie,before:ne==="up"})})},b[5]=v,b[6]=_):_=b[6];const k=Fe(_);let B;b[7]!==j?(B=oe=>{[...oe].reverse().forEach(ne=>{j({cellId:ne})})},b[7]=j,b[8]=B):B=b[8];const A=Fe(B);let U;b[9]!==C?(U=oe=>{oe.forEach(ne=>{C({cellId:ne})})},b[9]=C,b[10]=U):U=b[10];const V=Fe(U),X=Fe(q4);let Y;b[11]!==w?(Y=oe=>{oe.forEach(ne=>{w({cellId:ne})})},b[11]=w,b[12]=Y):Y=b[12];const G=Fe(Y);let W;b[13]!==F||b[14]!==y?(W=async(oe,ne,ie)=>{const se={};oe.forEach(ae=>{se[ae]={[ne]:ie}}),await F({configs:se}),oe.forEach(ae=>{y({cellId:ae,config:se[ae]})})},b[13]=F,b[14]=y,b[15]=W):W=b[15];const J=Fe(W);let $,Q,te;if(b[16]===Symbol.for("react.memo_cache_sentinel")?($=u.jsx(Sr,{size:13,strokeWidth:1.5}),b[16]=$):$=b[16],b[17]!==T?(Q=oe=>T(oe),b[17]=T,b[18]=Q):Q=b[18],b[19]!==R||b[20]!==G||b[21]!==z||b[22]!==X||b[23]!==k||b[24]!==V||b[25]!==A||b[26]!==Q||b[27]!==J){const oe=[[{icon:$,label:"Run cells",handle:Q,hotkey:"cell.run"}],[{icon:u.jsx(oc,{size:13,strokeWidth:1.5}),label:"Move up",handle:ae=>k(ae,"up"),hotkey:"cell.moveUp"},{icon:u.jsx(No,{size:13,strokeWidth:1.5}),label:"Move down",handle:ae=>k(ae,"down"),hotkey:"cell.moveDown"}],[{icon:u.jsx(rc,{size:13,strokeWidth:1.5}),label:"Delete cells",variant:"danger",hidden:!R,handle:z}]],ne=[[{icon:u.jsx(C3,{size:13,strokeWidth:1.5}),label:"Format cells",handle:X,hotkey:"cell.format"},{icon:u.jsx(Di,{size:13,strokeWidth:1.5}),label:"Clear outputs",handle:G}],[{icon:u.jsx(mm,{size:13,strokeWidth:1.5}),label:"Hide code",handle:ae=>J(ae,"hide_code",!0),hotkey:"cell.hideCode"},{icon:u.jsx(fm,{size:13,strokeWidth:1.5}),label:"Show code",handle:ae=>J(ae,"hide_code",!1),hotkey:"cell.hideCode"}],[{icon:u.jsx(oc,{size:13,strokeWidth:1.5}),label:"Move up",handle:ae=>k(ae,"up"),hotkey:"cell.moveUp"},{icon:u.jsx(No,{size:13,strokeWidth:1.5}),label:"Move down",handle:ae=>k(ae,"down"),hotkey:"cell.moveDown"},{icon:u.jsx(Jc,{size:13,strokeWidth:1.5}),label:"Send to top",handle:A,hotkey:"cell.sendToTop"},{icon:u.jsx(Xc,{size:13,strokeWidth:1.5}),label:"Send to bottom",handle:V,hotkey:"cell.sendToBottom"}],[{icon:u.jsx(un,{size:13,strokeWidth:1.5}),label:"Disable cells",handle:ae=>J(ae,"disabled",!0)},{icon:u.jsx(hn,{size:13,strokeWidth:1.5}),label:"Enable cells",handle:ae=>J(ae,"disabled",!1)}]],ie=oe.map(H4);let se;b[29]!==ie?(se=ie.filter(V4),b[29]=ie,b[30]=se):se=b[30],te={actions:se,moreActions:ne.map(U4).filter(B4)},b[19]=R,b[20]=G,b[21]=z,b[22]=X,b[23]=k,b[24]=V,b[25]=A,b[26]=Q,b[27]=J,b[28]=te}else te=b[28];return te}(n),a=n.length;let l;e[0]!==r||e[1]!==o?(l=p=>{(p.target instanceof HTMLElement||p.target instanceof SVGElement)&&p.target.closest("[data-keep-cell-selection]")!==null||p.target instanceof HTMLHtmlElement||(r.clear(),o.clear())},e[0]=r,e[1]=o,e[2]=l):l=e[2],Jl(window,"mousedown",l);const c=!r.idle;let d,h,f,m,g,x;if(e[3]!==a?(d=u.jsxs("span",{className:"text-sm font-medium text-muted-foreground px-2 shrink-0",children:[a," cells selected"]}),e[3]=a,e[4]=d):d=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(Nd,{}),e[5]=h):h=e[5],e[6]!==s||e[7]!==n||e[8]!==c){let p;e[10]!==s.length||e[11]!==n||e[12]!==c?(p=(b,y)=>u.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[b.map(v=>u.jsxs(ve,{variant:v.variant==="danger"?"linkDestructive":"ghost",size:"sm",onClick:()=>v.handle(n),className:"h-8 px-2 gap-1 shrink-0 flex items-center",title:v.label,disabled:c&&v.label!=="Delete cells",children:[v.icon,u.jsx("span",{className:"text-xs",children:v.label}),v.hotkey&&u.jsx("div",{className:"ml-1 border bg-muted rounded-md px-1",children:u.jsx(Im,{shortcut:v.hotkey})})]},v.label)),y<s.length-1&&u.jsx(Nd,{})]},y),e[10]=s.length,e[11]=n,e[12]=c,e[13]=p):p=e[13],f=s.map(p),e[6]=s,e[7]=n,e[8]=c,e[9]=f}else f=e[9];return e[14]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(Nd,{}),e[14]=m):m=e[14],e[15]!==n||e[16]!==c||e[17]!==i?(g=u.jsx(z4,{actions:i,cellIds:n,disabled:c}),e[15]=n,e[16]=c,e[17]=i,e[18]=g):g=e[18],e[19]!==d||e[20]!==f||e[21]!==g?(x=u.jsx("div",{className:"absolute top-12 justify-center flex w-full left-0 right-0 z-50","data-keep-cell-selection":!0,children:u.jsx("div",{className:"bg-background/95 backdrop-blur-sm supports-backdrop-filter:bg-background/60 border border-(--slate-7) rounded-lg shadow-lg p-2 overflow-x-auto overflow-y-hidden mx-20 scrollbar-thin",children:u.jsxs("div",{className:"flex items-center gap-1",children:[d,h,f,m,g]})})}),e[19]=d,e[20]=f,e[21]=g,e[22]=x):x=e[22],x};function X4(t){t.stopPropagation()}const J4={display:"none"};function Z4(t){let{id:e,value:n}=t;return q.createElement("div",{id:e,style:J4},n)}function Q4(t){let{id:e,announcement:n,ariaLiveType:o="assertive"}=t;return q.createElement("div",{id:e,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":o,"aria-atomic":!0},n)}const Qg=M.createContext(null),eN={draggable:`
|
|
99
99
|
To pick up a draggable item, press the space bar.
|
|
100
100
|
While dragging, use the arrow keys to move the item.
|
|
101
101
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
@@ -103,29 +103,29 @@ ${wa(i,a=>` ${a}`)},
|
|
|
103
103
|
`).length-1}}class KN{constructor(e){Z(this,"cache",new Map);Z(this,"timeout");this.timeout=e}get(e){const n=this.cache.get(e);return n?Date.now()-n.timestamp>this.timeout?(this.cache.delete(e),null):n.result:null}set(e,n){this.cache.set(e,{result:n,timestamp:Date.now()})}}const XN=(t,e)=>$n.fromClass(class{constructor(){Z(this,"abortController",null);Z(this,"cache");this.cache=new KN(e.cacheTimeout??1e3)}async update(n){var i,a,l,c,d;if(!n.docChanged||((a=(i=e.events)==null?void 0:i.beforeSuggestionFetch)==null?void 0:a.call(i,n.view))===!1)return;(l=this.abortController)==null||l.abort(),this.abortController=new AbortController;const o=n.state.doc,r=o.toString(),s=this.cache.get(r);if(s)n.view.dispatch({effects:Fa.of({text:s,doc:o})});else try{const h=await t(n.state,this.abortController.signal,n.view);if(this.abortController.signal.aborted||((d=(c=e.events)==null?void 0:c.shouldShowSuggestion)==null?void 0:d.call(c,n.view,h))===!1)return;this.cache.set(r,h),n.view.dispatch({effects:Fa.of({text:h,doc:o})})}catch(h){h instanceof Error&&h.name!=="AbortError"&&console.error("Suggestion fetch error:",h)}}destroy(){var n;(n=this.abortController)==null||n.abort()}}),JN=$n.fromClass(class{constructor(){Z(this,"decorations");this.decorations=ot.none}update(t){var n;const e=(n=t.state.field(La))==null?void 0:n.suggestion;this.decorations=e?function(o,r){const s=o.state.selection.main.head,i=[],a=ot.widget({widget:new YN(r),side:1});return i.push(a.range(s)),ot.set(i)}(t.view,e):ot.none}},{decorations:t=>t.decorations});function ZN(t,e,n,o){return{...t.changeByRange(r=>{if(r===t.selection.main)return{changes:{from:n,to:o,insert:e},range:Qn.cursor(n+e.length)};const s=o-n;return!r.empty||s&&t.sliceDoc(r.from-s,r.from)!==t.sliceDoc(n,o)?{range:r}:{changes:{from:r.from-s,to:r.from,insert:e},range:Qn.cursor(r.from-s+e.length)}}),userEvent:"input.complete"}}const F1=t=>{var o,r,s;const e=(o=t.state.field(La))==null?void 0:o.suggestion;if(!e)return!1;const n=t.state.facet(Vd);return t.dispatch({effects:Fa.of({text:null,doc:t.state.doc})}),(s=(r=n.events)==null?void 0:r.onSuggestionRejected)==null||s.call(r,t,e),!0},QN=Mn.of([{key:"Tab",run:t=>{var o,r,s;const e=(o=t.state.field(La))==null?void 0:o.suggestion;if(!e)return!1;const n=t.state.facet(Vd);return t.dispatch({...ZN(t.state,e,t.state.selection.main.head,t.state.selection.main.head)}),(s=(r=n.events)==null?void 0:r.onSuggestionAccepted)==null||s.call(r,t,e),!0}},{key:"Escape",run:F1}]),Vd=yr.define({combine:t=>t.at(-1)});function z1(t){const{delay:e=500,includeKeymap:n=!0}=t,o=function(r,s,i){let a=()=>{};return(...l)=>(a(),new Promise((c,d)=>{const h=setTimeout(()=>c(r(...l)),s);a=()=>{clearTimeout(h),i!==void 0&&d(i)}}))}(t.fetchFn,e);return[La,Vd.of(t),XN(o,t),JN,n?QN:[]]}const eE=We.baseTheme({".cm-ai-input-container":{display:"flex",flexDirection:"column",gap:"4px",width:"min(calc(100% + 7px), 500px)",padding:"5px 5px",margin:"0 -6px",backgroundColor:"light-dark(rgb(241, 243, 245), rgb(40, 40, 40))"},".cm-ai-input":{display:"block",width:"100%",padding:"3px 8px",border:"2px solid rgb(51, 154, 240)",borderRadius:"5px",fontSize:"12px"},".cm-ai-help-info-button":{fontSize:"10px",paddingLeft:"10px",height:"18px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",display:"block",marginRight:"auto"},".cm-ai-help-info-button:hover":{color:"light-dark(rgb(89, 97, 105), rgb(190, 190, 190))"},".cm-ai-generate-button":{background:"#0E639C",border:"none",padding:"2px 6px",color:"#ffffff",cursor:"pointer",font:"inherit",borderRadius:"4px","&:hover":{backgroundColor:"#1177bb"}},".cm-line.cm-ai-selection, .cm-line.cm-ai-selection.cm-active-line":{backgroundColor:"light-dark(color-mix(in srgb, rgb(223, 227, 232) 50%, transparent), color-mix(in srgb, rgb(50, 50, 50) 50%, transparent)) !important"},".cm-line:has(.cm-new-code-line)":{backgroundColor:"light-dark(color-mix(in srgb, rgb(183, 235, 143) 50%, transparent), color-mix(in srgb, rgb(40, 100, 40) 50%, transparent)) !important"},".cm-old-code-container":{backgroundColor:"light-dark(rgb(255, 205, 205), rgb(100, 40, 40))",position:"relative",display:"flex",paddingTop:"0",width:"100%",alignItems:"center"},".cm-code-button":{position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",fontSize:"16px"},".cm-floating-buttons":{fontFamily:"sans-serif",position:"absolute",top:"-20px",left:"5px",display:"flex"},".cm-floating-button":{fontFamily:"sans-serif",padding:"2px 5px",fontSize:"10px",cursor:"pointer",fontWeight:"700"},".cm-floating-accept":{backgroundColor:"light-dark(rgb(55, 125, 34), rgb(40, 80, 25))",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px",color:"white",filter:"brightness(90%)","&:hover":{filter:"brightness(100%)"}},".cm-floating-reject":{backgroundColor:"light-dark(rgb(220, 53, 69), rgb(180, 40, 50))",color:"white",borderTopRightRadius:"5px",borderBottomRightRadius:"5px",filter:"brightness(90%)","&:hover":{filter:"brightness(100%)"}},".hotkey":{display:"inline-block",padding:"0 4px",borderRadius:"3px",backgroundColor:"rgba(255, 255, 255, 0.1)",fontSize:"90%"},".cm-ai-loading-indicator":{fontStyle:"italic",fontSize:"10px",paddingLeft:"12px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",opacity:"0",transition:"opacity 0.3s ease-in-out","&::after":{content:'""',display:"inline-block",animation:"ellipsis-pulse 1.5s steps(4, end) infinite"},"&:not(:empty)":{opacity:"1"}},".cm-ai-input:disabled":{opacity:"0.5"},"@keyframes ellipsis-pulse":{"0%":{content:"'.'"},"25%":{content:"'..'"},"50%":{content:"'...'"},"75%":{content:"''"}},".cm-ai-loading-container":{display:"flex",alignItems:"center",padding:"0 8px"},".cm-ai-cancel-button":{padding:"2px 8px",fontSize:"10px",borderRadius:"4px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",cursor:"pointer","&:hover":{background:"light-dark(rgb(223, 227, 232), rgb(50, 50, 50))"}},".hidden":{display:"none"}});function tE(t){var r,s;const e=t.state.facet($s),n={...Ra,...e.keymaps},o=Kt("div","cm-ai-tooltip").appendChild(Kt("div","cm-ai-tooltip-button"));return o.innerHTML=`<span>Edit <span class="hotkey">${$d(n.showInput)}</span></span>`,(r=o.querySelector("span"))==null||r.addEventListener("mousedown",i=>{i.stopPropagation(),i.button===0&&i.preventDefault()}),(s=o.querySelector("span"))==null||s.addEventListener("click",i=>{i.preventDefault(),R1(t)}),o}const Hd=yr.define({combine:t=>_c(t,{render:tE,hideOnBlur:!1})}),nE=$n.fromClass((a3=class{constructor(t){Z(this,"view");Z(this,"suppress");Z(this,"dom");Z(this,"mousedown",()=>{this.suppress=!0});Z(this,"mouseup",()=>{this.suppress=!1,this.display(this.view)});Z(this,"scroll",()=>{this.display(this.view)});Z(this,"windowScroll",()=>{this.display(this.view)});h3(this,Gl,t=>{var n;const e=t.state.selection.ranges.find(o=>!o.empty);if(e&&!this.suppress){const o=t.coordsAtPos(e.from);if(!o)return;const r=t.dom.getBoundingClientRect(),s=(n=t.dom.parentElement)==null?void 0:n.getBoundingClientRect(),i=o.top>=r.top&&o.top<=r.bottom&&o.left>=r.left&&o.left<=r.right,a=!s||o.top>=s.top&&o.top<=s.bottom&&o.left>=s.left&&o.left<=s.right;if(!i||!a)return this.dom.style.display="none",void this.dom.setAttribute("aria-hidden","true");this.dom.style.display="flex",this.dom.setAttribute("aria-hidden","false");const l=this.dom.getBoundingClientRect(),c=r.width-l.width,d=Math.min(o.left,c);let h=o.top-l.height;h=s?Math.max(s.y,h):h,this.dom.style.left=`${d}px`,this.dom.style.top=`${h}px`,requestAnimationFrame(()=>{this.dom&&this.dom.setAttribute("aria-hidden","false")})}else this.dom.style.display="none",this.dom.setAttribute("aria-hidden","true")});this.view=t;const e=t.state.facet(Hd);this.suppress=!1,document.addEventListener("mousedown",this.mousedown),document.addEventListener("mouseup",this.mouseup),t.scrollDOM.addEventListener("scroll",this.scroll),window.addEventListener("scroll",this.windowScroll,!0);const n=e.render(t);t.dom.appendChild(n),this.dom=n}update(t){this.display(t.view)}docViewUpdate(t){this.display(t)}display(t){if(t.state.field(sr).show)return void(this.dom.style.display="none");if(t.state.facet(Hd).hideOnBlur&&!t.hasFocus)return this.dom.style.display="none",void this.dom.setAttribute("aria-hidden","true");t.requestMeasure({read:u3(this,Gl)})}destroy(){document.removeEventListener("mousedown",this.mousedown),document.removeEventListener("mouseup",this.mouseup),this.view.scrollDOM.removeEventListener("scroll",this.scroll),window.removeEventListener("scroll",this.windowScroll,!0),this.dom.remove()}},Gl=new WeakMap,a3)),oE=We.baseTheme({".cm-ai-tooltip-button":{userSelect:"none",fontFamily:"system-ui, -apple-system, sans-serif",position:"fixed",display:"flex",boxSizing:"border-box",padding:"2px 6px",borderRadius:"4px",fontSize:"12px",backgroundColor:"#0E639C",color:"#ffffff",border:"1px solid transparent",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",zIndex:"999",transition:"opacity 0.5s","&[aria-hidden='true']":{opacity:"0"},"&[aria-hidden='false']":{opacity:"1"},"& > span":{pointerEvents:"auto",cursor:"pointer",display:"inline-block",padding:"2px"},"&:hover":{backgroundColor:"#1177bb"}}});class rE extends bs{constructor(n){super();Z(this,"oldCode");this.oldCode=n}toDOM(n){const o=Kt("div","cm-old-code-container");o.setAttribute("role","region"),o.setAttribute("aria-label","Previous code version");const r=Kt("div","cm-old-code cm-line");r.textContent=this.oldCode;const s=Kt("div","cm-floating-buttons"),i=n.state.facet($s),a={...Ra,...i.keymaps},l=Kt("button","cm-floating-button cm-floating-accept");l.innerHTML=`<span class="hotkey">${$d(a.acceptEdit)}</span> Accept`,l.setAttribute("aria-label","Accept changes"),l.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),n.focus(),P1(n)});const c=Kt("button","cm-floating-button cm-floating-reject");return c.innerHTML=`<span class="hotkey">${$d(a.rejectEdit)}</span> Reject`,c.setAttribute("aria-label","Reject changes"),c.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),n.focus(),L1(n)}),s.append(l,c),o.append(r,s),o}updateDOM(n,o){return!0}}class sE extends bs{constructor(n){super();Z(this,"complete");Z(this,"abortController",null);Z(this,"dom",null);Z(this,"input",null);Z(this,"loadingContainer",null);Z(this,"helpInfo",null);Z(this,"inputContainer",null);Z(this,"form",null);Z(this,"view",null);Z(this,"onKeyDown",async n=>{n.key!=="Enter"||n.shiftKey?n.key==="Escape"&&this.onCancel():(n.preventDefault(),await this.handleSubmit())});Z(this,"onCancel",()=>{this.cleanup();const n=this.view;n&&(n.dispatch({effects:[rr.of({show:!1,lineFrom:0,lineTo:0}),Ir.of(!1)]}),n.focus())});Z(this,"handleSubmit",async n=>{var x;const o=this.view;if(!o)return;const r=o.state.facet($s);n==null||n.stopPropagation();const s=o.state.field(sr),{input:i}=this;if(!i)return;const a=i.value.trim();if(!s.show||!a)return;const l=o.state.doc.line(s.lineFrom),c=o.state.doc.line(s.lineTo),d=l.from,h=c.to,f=o.state.sliceDoc(d,h),m=o.state.sliceDoc(0,d),g=o.state.sliceDoc(h);this.abortController=new AbortController,o.dispatch({effects:Ir.of(!0)}),this.toggleLoading(!0);try{const p=await this.complete({prompt:a,selection:f,codeBefore:m,codeAfter:g,editorView:o,signal:this.abortController.signal});if(!o.state.field(sr).show)return;if(!p||typeof p!="string")throw new Error("Invalid completion result");o.dispatch({changes:{from:d,to:h,insert:p},effects:[rr.of({show:!1,lineFrom:0,lineTo:0}),Pa.of({from:d,to:d+p.length,oldCode:f,newCode:p}),Ir.of(!1)]})}catch(p){if(p instanceof DOMException&&p.name==="AbortError")return;(x=r.onError)==null||x.call(r,p)}finally{this.cleanup(),this.toggleLoading(!1),o.focus()}});this.complete=n}toDOM(n){if(this.dom)return this.dom;this.view=n;const o=n.state.field(O1),r=n.state.field(D1),s=Kt("div","cm-ai-input-container");this.inputContainer=s,this.dom=s;const i=Kt("form","cm-ai-input-form");this.form=i,i.setAttribute("role","search"),i.setAttribute("aria-label","AI editing instructions"),i.addEventListener("submit",p=>p.preventDefault());const a=Kt("input","cm-ai-input");this.input=a,i.append(a),a.placeholder="Editing instructions...",a.setAttribute("aria-label","AI editing instructions"),a.setAttribute("autocomplete","off"),a.setAttribute("spellcheck","true"),a.value=o.inputValue;const l=Kt("div","cm-ai-loading-container");this.loadingContainer=l;const c=Kt("div","cm-ai-loading-indicator");c.setAttribute("role","status"),c.setAttribute("aria-live","polite"),c.textContent="Generating";const d=Kt("button","cm-ai-cancel-button");d.textContent="Cancel",d.setAttribute("aria-label","Cancel code generation"),d.addEventListener("click",this.onCancel),l.append(d,c);const h=Kt("div","cm-ai-help-info");this.helpInfo=h;const f=h.appendChild(document.createElement("button"));f.className="cm-ai-help-info-button",f.textContent="Esc to close",f.addEventListener("click",this.onCancel);const m=Kt("button","cm-ai-generate-button");function g(p){h.replaceChildren(p?m:f)}m.textContent="\u23CE Generate",m.setAttribute("aria-label","Generate code"),m.addEventListener("click",this.handleSubmit),this.toggleLoading(r),o.shouldFocus&&requestAnimationFrame(()=>{a.value=o.inputValue,a.focus(),n.dispatch({effects:Hs.of(!1)})}),g(a.value),a.addEventListener("input",function(){n.dispatch({effects:Vs.of(a.value)});const p=a.value.trim();p!==x&&(x=p,g(p))}),a.addEventListener("keydown",this.onKeyDown);let x="";return s}toggleLoading(n){var o;this.inputContainer&&this.form&&this.loadingContainer&&this.helpInfo&&((o=this.inputContainer)==null||o.replaceChildren(this.form,n?this.loadingContainer:this.helpInfo))}updateDOM(n,o){return this.dom=n,this.input=n.querySelector(".cm-ai-input"),!0}cleanup(){var n,o,r;(n=this.abortController)==null||n.abort(),this.abortController=null,(o=this.dom)==null||o.remove(),(r=this.input)==null||r.remove(),this.dom=null,this.input=null}destroy(){this.cleanup()}}function iE(t){if(!t.prompt)throw new Error("prompt function is required");const e={...Ra,...t.keymaps};return[$s.of(t),sr,O1,Ws,D1,[nE,oE],eE,Mn.of([{key:e.showInput,run:R1}]),To.highest([Mn.of([{key:e.acceptEdit,run:P1},{key:e.rejectEdit,run:L1}])]),aE,lE,cE,dE]}const aE=We.updateListener.of(t=>{const e=t.state.field(sr);if(!e.show||!t.docChanged)return;let{lineFrom:n,lineTo:o}=e,r=!1;t.changes.iterChanges((s,i,a,l)=>{const c=t.state.doc.lineAt(s).number;if(c<n){const d=t.state.doc.lineAt(l).number-t.state.doc.lineAt(a).number;n+=d,o+=d,r=!0}else if(c<=o){const d=t.state.doc.lineAt(l).number-t.state.doc.lineAt(a).number;o+=d,r=!0}}),r&&t.view.dispatch({effects:[rr.of({show:!0,lineFrom:n,lineTo:o})]})}),lE=We.decorations.of(t=>{const e=t.state.field(Ws);return e?ot.set([ot.mark({class:"cm-new-code-line"}).range(e.from,e.to)]):ot.none}),cE=We.decorations.compute([sr],t=>{const e=t.field(sr),n=t.facet($s),o=[];if(e.show){const r=e.lineFrom,s=e.lineTo;for(let i=r;i<=s;i++){const a=t.doc.line(i).from;o.push(ot.line({class:"cm-ai-selection"}).range(a)),i===r&&o.push(ot.widget({widget:new sE(n.prompt),side:-1}).range(a))}}return ot.set(o)}),dE=vn.define({create:t=>ot.none,update(t,e){const n=e.state.field(Ws);return n?ot.set([ot.widget({widget:new rE(n.oldCode),block:!0}).range(n.from)]):ot.none},provide:t=>We.decorations.from(t)}),B1="packages-install-input",uE=["%alias","%cd","%clear","%debug","%env","%load","%load_ext","%lsmagic","%matplotlib","%pwd","%who_ls","%system","%%time","%%timeit","%%writefile","%%capture","%%html","%%latex"];let Wd;function hE(){const t=async r=>{const s=Qe.get(Cc),{saveUserConfig:i}=sC(),a={...s,runtime:{...s.runtime,auto_reload:r}};await i({config:a}).then(()=>Qe.set(Cc,a))},e=()=>{requestAnimationFrame(()=>{const r=document.getElementById(B1);r&&r.focus()})},n=[{match:"!pip install",onMatch:()=>{Qe.set(Bm,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:u.jsxs(u.Fragment,{children:["The package manager sidebar has been opened.",u.jsx("br",{}),"Install packages directly from there instead."]})},{match:"!uv pip install",onMatch:()=>{Qe.set(Bm,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:u.jsxs(u.Fragment,{children:["The package manager sidebar has been opened.",u.jsx("br",{}),"Install packages directly from there instead."]})},{match:"!uv add",onMatch:()=>{Qe.set(Bm,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:u.jsxs(u.Fragment,{children:["The package manager sidebar has been opened.",u.jsx("br",{}),"Install packages directly from there instead."]})},{match:"%autoreload 2",onMatch:async()=>{await t("autorun")},title:"Module reload",description:u.jsxs(u.Fragment,{children:["Module reload mode set to ",u.jsx("b",{children:"autorun"})," - module changes will re-run the cells that import them."]})},{match:"%autoreload 1",onMatch:async()=>{await t("lazy")},title:"Module reload",description:u.jsxs(u.Fragment,{children:["Module reload mode set to ",u.jsx("b",{children:"lazy"})," - module changes will mark the cells that import them as stale."]})},{match:"%autoreload 0",onMatch:async()=>{await t("off")},title:"Module reload",description:u.jsx(u.Fragment,{children:"Module reload disabled - module changes will not be detected."})},{match:"!ls",onMatch:()=>{},title:"Listing files",description:u.jsxs(u.Fragment,{children:["Shell commands are not directly supported.",u.jsx("br",{}),"Use ",u.jsx("code",{children:"import subprocess; subprocess.run(['ls'])"})," instead."]})},...uE.map(r=>({match:r,onMatch:()=>{},title:u.jsx(rC,{className:"inline",children:r}),description:u.jsxs(u.Fragment,{children:["Magic commands are not supported in marimo. Read more about replacements in the"," ",u.jsx("a",{href:"https://docs.marimo.io/guides/coming_from/jupyter/#adapting-to-the-absence-of-magic-commands",target:"_blank",className:"text-link underline cursor-pointer",rel:"noopener noreferrer",children:"documentation"}),"."]})}))],o=new Map(n.map(r=>[r.match,r]));return We.updateListener.of(r=>{if(r.docChanged){const s=r.state.selection.main,i=r.state.doc,a=i.lineAt(s.head),l=i.sliceString(a.from,s.anchor).trim(),c=o.get(l);c&&(c.onMatch(),Wd?Wd.upsert({title:c.title,description:c.description}):Wd=Je({title:c.title,description:c.description}))}})}const fE=new Set(["Escape","Alt-`"]);function mE(){const t=iC.filter(e=>!fE.has(e.key));return To.highest(Mn.of([...t,{key:"Ctrl-y",run:e=>!!Ic(e)&&aC(e)},{key:"Ctrl-n",run:e=>!!Ic(e)&&Ac(!0)(e)},{key:"Ctrl-p",run:e=>!!Ic(e)&&Ac(!1)(e)}]))}const qd=Tt.define(),Gd=Tt.define(),Yd=Tt.define();function bt(t,e){if(!t)throw new Error(e)}function za(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>2147483647||t<-2147483648)throw new Error("invalid int 32: "+t)}function Kd(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>4294967295||t<0)throw new Error("invalid uint 32: "+t)}function U1(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>3402823466385289e23||t<-3402823466385289e23))throw new Error("invalid float 32: "+t)}const $1=Symbol("@bufbuild/protobuf/enum-type");function pE(t){const e=t[$1];return bt(e,"missing enum type on enum object"),e}function V1(t,e,n,o){t[$1]=H1(e,n.map(r=>({no:r.no,name:r.name,localName:t[r.no]})))}function H1(t,e,n){const o=Object.create(null),r=Object.create(null),s=[];for(const i of e){const a=W1(i);s.push(a),o[i.name]=a,r[i.no]=a}return{typeName:t,values:s,findName:i=>o[i],findNumber:i=>r[i]}}function gE(t,e,n){const o={};for(const r of e){const s=W1(r);o[s.localName]=s.no,o[s.no]=s.localName}return V1(o,t,e),o}function W1(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class St{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,n){const o=this.getType().runtime.bin,r=o.makeReadOptions(n);return o.readMessage(this,r.readerFactory(e),e.byteLength,r),this}fromJson(e,n){const o=this.getType(),r=o.runtime.json,s=r.makeReadOptions(n);return r.readMessage(o,e,s,this),this}fromJsonString(e,n){let o;try{o=JSON.parse(e)}catch(r){throw new Error(`cannot decode ${this.getType().typeName} from JSON: ${r instanceof Error?r.message:String(r)}`)}return this.fromJson(o,n)}toBinary(e){const n=this.getType().runtime.bin,o=n.makeWriteOptions(e),r=o.writerFactory();return n.writeMessage(this,r,o),r.finish()}toJson(e){const n=this.getType().runtime.json,o=n.makeWriteOptions(e);return n.writeMessage(this,o)}toJsonString(e){var n;const o=this.toJson(e);return JSON.stringify(o,null,(n=e==null?void 0:e.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function xE(){let t=0,e=0;for(let o=0;o<28;o+=7){let r=this.buf[this.pos++];if(t|=(127&r)<<o,!(128&r))return this.assertBounds(),[t,e]}let n=this.buf[this.pos++];if(t|=(15&n)<<28,e=(112&n)>>4,!(128&n))return this.assertBounds(),[t,e];for(let o=3;o<=31;o+=7){let r=this.buf[this.pos++];if(e|=(127&r)<<o,!(128&r))return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function Xd(t,e,n){for(let s=0;s<28;s+=7){const i=t>>>s,a=!(!(i>>>7)&&e==0),l=255&(a?128|i:i);if(n.push(l),!a)return}const o=t>>>28&15|(7&e)<<4,r=!!(e>>3);if(n.push(255&(r?128|o:o)),r){for(let s=3;s<31;s+=7){const i=e>>>s,a=!!(i>>>7),l=255&(a?128|i:i);if(n.push(l),!a)return}n.push(e>>>31&1)}}const Ba=4294967296;function q1(t){const e=t[0]==="-";e&&(t=t.slice(1));const n=1e6;let o=0,r=0;function s(i,a){const l=Number(t.slice(i,a));r*=n,o=o*n+l,o>=Ba&&(r+=o/Ba|0,o%=Ba)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),e?Y1(o,r):Jd(o,r)}function G1(t,e){if({lo:t,hi:e}=function(l,c){return{lo:l>>>0,hi:c>>>0}}(t,e),e<=2097151)return String(Ba*e+t);const n=16777215&(t>>>24|e<<8),o=e>>16&65535;let r=(16777215&t)+6777216*n+6710656*o,s=n+8147497*o,i=2*o;const a=1e7;return r>=a&&(s+=Math.floor(r/a),r%=a),s>=a&&(i+=Math.floor(s/a),s%=a),i.toString()+K1(s)+K1(r)}function Jd(t,e){return{lo:0|t,hi:0|e}}function Y1(t,e){return e=~e,t?t=1+~t:e+=1,Jd(t,e)}const K1=t=>{const e=String(t);return"0000000".slice(e.length)+e};function X1(t,e){if(t>=0){for(;t>127;)e.push(127&t|128),t>>>=7;e.push(t)}else{for(let n=0;n<9;n++)e.push(127&t|128),t>>=7;e.push(1)}}function bE(){let t=this.buf[this.pos++],e=127&t;if(!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<7,!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<14,!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<21,!(128&t))return this.assertBounds(),e;t=this.buf[this.pos++],e|=(15&t)<<28;for(let n=5;128&t&&n<10;n++)t=this.buf[this.pos++];if(128&t)throw new Error("invalid varint");return this.assertBounds(),e>>>0}var yE={};const pt=function(){const t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(typeof process!="object"||yE.BUF_BIGINT_DISABLE!=="1")){const o=BigInt("-9223372036854775808"),r=BigInt("9223372036854775807"),s=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(a){const l=typeof a=="bigint"?a:BigInt(a);if(l>r||l<o)throw new Error(`int64 invalid: ${a}`);return l},uParse(a){const l=typeof a=="bigint"?a:BigInt(a);if(l>i||l<s)throw new Error(`uint64 invalid: ${a}`);return l},enc(a){return t.setBigInt64(0,this.parse(a),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(a){return t.setBigInt64(0,this.uParse(a),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec:(a,l)=>(t.setInt32(0,a,!0),t.setInt32(4,l,!0),t.getBigInt64(0,!0)),uDec:(a,l)=>(t.setInt32(0,a,!0),t.setInt32(4,l,!0),t.getBigUint64(0,!0))}}const e=o=>bt(/^-?[0-9]+$/.test(o),`int64 invalid: ${o}`),n=o=>bt(/^[0-9]+$/.test(o),`uint64 invalid: ${o}`);return{zero:"0",supported:!1,parse:o=>(typeof o!="string"&&(o=o.toString()),e(o),o),uParse:o=>(typeof o!="string"&&(o=o.toString()),n(o),o),enc:o=>(typeof o!="string"&&(o=o.toString()),e(o),q1(o)),uEnc:o=>(typeof o!="string"&&(o=o.toString()),n(o),q1(o)),dec:(o,r)=>function(s,i){let a=Jd(s,i);const l=2147483648&a.hi;l&&(a=Y1(a.lo,a.hi));const c=G1(a.lo,a.hi);return l?"-"+c:c}(o,r),uDec:(o,r)=>G1(o,r)}}();var de,Do,kt;function Ro(t,e,n){if(e===n)return!0;if(t==de.BYTES){if(!(e instanceof Uint8Array&&n instanceof Uint8Array)||e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(e[o]!==n[o])return!1;return!0}switch(t){case de.UINT64:case de.FIXED64:case de.INT64:case de.SFIXED64:case de.SINT64:return e==n}return!1}function Ar(t,e){switch(t){case de.BOOL:return!1;case de.UINT64:case de.FIXED64:case de.INT64:case de.SFIXED64:case de.SINT64:return e==0?pt.zero:"0";case de.DOUBLE:case de.FLOAT:return 0;case de.BYTES:return new Uint8Array(0);case de.STRING:return"";default:return 0}}function J1(t,e){switch(t){case de.BOOL:return e===!1;case de.STRING:return e==="";case de.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(de||(de={})),function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"}(Do||(Do={})),function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"}(kt||(kt={}));class vE{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let r=0;r<this.chunks.length;r++)e+=this.chunks[r].length;let n=new Uint8Array(e),o=0;for(let r=0;r<this.chunks.length;r++)n.set(this.chunks[r],o),o+=this.chunks[r].length;return this.chunks=[],n}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),n=this.stack.pop();if(!n)throw new Error("invalid state, fork stack empty");return this.chunks=n.chunks,this.buf=n.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,n){return this.uint32((e<<3|n)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(Kd(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return za(e),X1(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let n=this.textEncoder.encode(e);return this.uint32(n.byteLength),this.raw(n)}float(e){U1(e);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,e,!0),this.raw(n)}double(e){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,e,!0),this.raw(n)}fixed32(e){Kd(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){za(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return za(e),X1(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let n=new Uint8Array(8),o=new DataView(n.buffer),r=pt.enc(e);return o.setInt32(0,r.lo,!0),o.setInt32(4,r.hi,!0),this.raw(n)}fixed64(e){let n=new Uint8Array(8),o=new DataView(n.buffer),r=pt.uEnc(e);return o.setInt32(0,r.lo,!0),o.setInt32(4,r.hi,!0),this.raw(n)}int64(e){let n=pt.enc(e);return Xd(n.lo,n.hi,this.buf),this}sint64(e){let n=pt.enc(e),o=n.hi>>31;return Xd(n.lo<<1^o,(n.hi<<1|n.lo>>>31)^o,this.buf),this}uint64(e){let n=pt.uEnc(e);return Xd(n.lo,n.hi,this.buf),this}}class wE{constructor(e,n){this.varint64=xE,this.uint32=bE,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=n??new TextDecoder}tag(){let e=this.uint32(),n=e>>>3,o=7&e;if(n<=0||o<0||o>5)throw new Error("illegal tag: field no "+n+" wire type "+o);return[n,o]}skip(e,n){let o=this.pos;switch(e){case kt.Varint:for(;128&this.buf[this.pos++];);break;case kt.Bit64:this.pos+=4;case kt.Bit32:this.pos+=4;break;case kt.LengthDelimited:let r=this.uint32();this.pos+=r;break;case kt.StartGroup:for(;;){const[s,i]=this.tag();if(i===kt.EndGroup){if(n!==void 0&&s!==n)throw new Error("invalid end group tag");break}this.skip(i,s)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return pt.dec(...this.varint64())}uint64(){return pt.uDec(...this.varint64())}sint64(){let[e,n]=this.varint64(),o=-(1&e);return e=(e>>>1|(1&n)<<31)^o,n=n>>>1^o,pt.dec(e,n)}bool(){let[e,n]=this.varint64();return e!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return pt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return pt.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),n=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(n,n+e)}string(){return this.textDecoder.decode(this.bytes())}}function Z1(t){const e=t.field.localName,n=Object.create(null);return n[e]=function(o){const r=o.field;if(r.repeated)return[];if(r.default!==void 0)return r.default;switch(r.kind){case"enum":return r.T.values[0].no;case"scalar":return Ar(r.T,r.L);case"message":const s=r.T,i=new s;return s.fieldWrapper?s.fieldWrapper.unwrapField(i):i;case"map":throw"map fields are not allowed to be extensions"}}(t),[n,()=>n[e]]}let no="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Ua=[];for(let t=0;t<no.length;t++)Ua[no[t].charCodeAt(0)]=t;Ua[45]=no.indexOf("+"),Ua[95]=no.indexOf("/");const $a={dec(t){let e=3*t.length/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let n,o=new Uint8Array(e),r=0,s=0,i=0;for(let a=0;a<t.length;a++){if(n=Ua[t.charCodeAt(a)],n===void 0)switch(t[a]){case"=":s=0;case`
|
|
104
104
|
`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(s){case 0:i=n,s=1;break;case 1:o[r++]=i<<2|(48&n)>>4,i=n,s=2;break;case 2:o[r++]=(15&i)<<4|(60&n)>>2,i=n,s=3;break;case 3:o[r++]=(3&i)<<6|n,s=0}}if(s==1)throw Error("invalid base64 string.");return o.subarray(0,r)},enc(t){let e,n="",o=0,r=0;for(let s=0;s<t.length;s++)switch(e=t[s],o){case 0:n+=no[e>>2],r=(3&e)<<4,o=1;break;case 1:n+=no[r|e>>4],r=(15&e)<<2,o=2;break;case 2:n+=no[r|e>>6],n+=no[63&e],o=0}return o&&(n+=no[r],n+="=",o==1&&(n+="=")),n}};function kE(t,e,n){e0(e,t);const o=e.runtime.bin.makeReadOptions(n),r=function(a,l){if(!l.repeated&&(l.kind=="enum"||l.kind=="scalar")){for(let c=a.length-1;c>=0;--c)if(a[c].no==l.no)return[a[c]];return[]}return a.filter(c=>c.no===l.no)}(t.getType().runtime.bin.listUnknownFields(t),e.field),[s,i]=Z1(e);for(const a of r)e.runtime.bin.readField(s,o.readerFactory(a.data),e.field,a.wireType,o);return i()}function CE(t,e,n,o){e0(e,t);const r=e.runtime.bin.makeReadOptions(o),s=e.runtime.bin.makeWriteOptions(o);if(Q1(t,e)){const c=t.getType().runtime.bin.listUnknownFields(t).filter(d=>d.no!=e.field.no);t.getType().runtime.bin.discardUnknownFields(t);for(const d of c)t.getType().runtime.bin.onUnknownField(t,d.no,d.wireType,d.data)}const i=s.writerFactory();let a=e.field;a.opt||a.repeated||a.kind!="enum"&&a.kind!="scalar"||(a=Object.assign(Object.assign({},e.field),{opt:!0})),e.runtime.bin.writeField(a,n,i,s);const l=r.readerFactory(i.finish());for(;l.pos<l.len;){const[c,d]=l.tag(),h=l.skip(d,c);t.getType().runtime.bin.onUnknownField(t,c,d,h)}}function Q1(t,e){const n=t.getType();return e.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(t).find(o=>o.no==e.field.no)}function e0(t,e){bt(t.extendee.typeName==e.getType().typeName,`extension ${t.typeName} can only be applied to message ${t.extendee.typeName}`)}function t0(t,e){const n=t.localName;if(t.repeated)return e[n].length>0;if(t.oneof)return e[t.oneof.localName].case===n;switch(t.kind){case"enum":case"scalar":return t.opt||t.req?e[n]!==void 0:t.kind=="enum"?e[n]!==t.T.values[0].no:!J1(t.T,e[n]);case"message":return e[n]!==void 0;case"map":return Object.keys(e[n]).length>0}}function n0(t,e){const n=t.localName,o=!t.opt&&!t.req;if(t.repeated)e[n]=[];else if(t.oneof)e[t.oneof.localName]={case:void 0};else switch(t.kind){case"map":e[n]={};break;case"enum":e[n]=o?t.T.values[0].no:void 0;break;case"scalar":e[n]=o?Ar(t.T,t.L):void 0;break;case"message":e[n]=void 0}}function oo(t,e){if(t===null||typeof t!="object"||!Object.getOwnPropertyNames(St.prototype).every(o=>o in t&&typeof t[o]=="function"))return!1;const n=t.getType();return n!==null&&typeof n=="function"&&"typeName"in n&&typeof n.typeName=="string"&&(e===void 0||n.typeName==e.typeName)}function o0(t,e){return oo(e)||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}de.DOUBLE,de.FLOAT,de.INT64,de.UINT64,de.INT32,de.UINT32,de.BOOL,de.STRING,de.BYTES;const r0={ignoreUnknownFields:!1},s0={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function jE(t){return t?Object.assign(Object.assign({},r0),t):r0}function SE(t){return t?Object.assign(Object.assign({},s0),t):s0}const Va=Symbol(),Ha=Symbol();function Hn(t){if(t===null)return"null";switch(typeof t){case"object":return Array.isArray(t)?"array":"object";case"string":return t.length>100?"string":`"${t.split('"').join('\\"')}"`;default:return String(t)}}function i0(t,e,n,o,r){let s=n.localName;if(n.repeated){if(bt(n.kind!="map"),e===null)return;if(!Array.isArray(e))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Hn(e)}`);const i=t[s];for(const a of e){if(a===null)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Hn(a)}`);switch(n.kind){case"message":i.push(n.T.fromJson(a,o));break;case"enum":const l=Zd(n.T,a,o.ignoreUnknownFields,!0);l!==Ha&&i.push(l);break;case"scalar":try{i.push(qs(n.T,a,n.L,!0))}catch(c){let d=`cannot decode field ${r.typeName}.${n.name} from JSON: ${Hn(a)}`;throw c instanceof Error&&c.message.length>0&&(d+=`: ${c.message}`),new Error(d)}}}}else if(n.kind=="map"){if(e===null)return;if(typeof e!="object"||Array.isArray(e))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Hn(e)}`);const i=t[s];for(const[a,l]of Object.entries(e)){if(l===null)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: map value null`);let c;try{c=NE(n.K,a)}catch(d){let h=`cannot decode map key for field ${r.typeName}.${n.name} from JSON: ${Hn(e)}`;throw d instanceof Error&&d.message.length>0&&(h+=`: ${d.message}`),new Error(h)}switch(n.V.kind){case"message":i[c]=n.V.T.fromJson(l,o);break;case"enum":const d=Zd(n.V.T,l,o.ignoreUnknownFields,!0);d!==Ha&&(i[c]=d);break;case"scalar":try{i[c]=qs(n.V.T,l,Do.BIGINT,!0)}catch(h){let f=`cannot decode map value for field ${r.typeName}.${n.name} from JSON: ${Hn(e)}`;throw h instanceof Error&&h.message.length>0&&(f+=`: ${h.message}`),new Error(f)}}}}else switch(n.oneof&&(t=t[n.oneof.localName]={case:s},s="value"),n.kind){case"message":const i=n.T;if(e===null&&i.typeName!="google.protobuf.Value")return;let a=t[s];oo(a)?a.fromJson(e,o):(t[s]=a=i.fromJson(e,o),i.fieldWrapper&&!n.oneof&&(t[s]=i.fieldWrapper.unwrapField(a)));break;case"enum":const l=Zd(n.T,e,o.ignoreUnknownFields,!1);switch(l){case Va:n0(n,t);break;case Ha:break;default:t[s]=l}break;case"scalar":try{const c=qs(n.T,e,n.L,!1);c===Va?n0(n,t):t[s]=c}catch(c){let d=`cannot decode field ${r.typeName}.${n.name} from JSON: ${Hn(e)}`;throw c instanceof Error&&c.message.length>0&&(d+=`: ${c.message}`),new Error(d)}}}function NE(t,e){if(t===de.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1}return qs(t,e,Do.BIGINT,!0).toString()}function qs(t,e,n,o){if(e===null)return o?Ar(t,n):Va;switch(t){case de.DOUBLE:case de.FLOAT:if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""||typeof e=="string"&&e.trim().length!==e.length||typeof e!="string"&&typeof e!="number")break;const r=Number(e);if(Number.isNaN(r)||!Number.isFinite(r))break;return t==de.FLOAT&&U1(r),r;case de.INT32:case de.FIXED32:case de.SFIXED32:case de.SINT32:case de.UINT32:let s;if(typeof e=="number"?s=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(s=Number(e)),s===void 0)break;return t==de.UINT32||t==de.FIXED32?Kd(s):za(s),s;case de.INT64:case de.SFIXED64:case de.SINT64:if(typeof e!="number"&&typeof e!="string")break;const i=pt.parse(e);return n?i.toString():i;case de.FIXED64:case de.UINT64:if(typeof e!="number"&&typeof e!="string")break;const a=pt.uParse(e);return n?a.toString():a;case de.BOOL:if(typeof e!="boolean")break;return e;case de.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case de.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return $a.dec(e)}throw new Error}function Zd(t,e,n,o){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:o?t.values[0].no:Va;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":const r=t.findName(e);if(r!==void 0)return r.no;if(n)return Ha}throw new Error(`cannot decode enum ${t.typeName} from JSON: ${Hn(e)}`)}function EE(t){return!(!t.repeated&&t.kind!="map")||!t.oneof&&t.kind!="message"&&!t.opt&&!t.req}function a0(t,e,n){if(t.kind=="map"){bt(typeof e=="object"&&e!=null);const o={},r=Object.entries(e);switch(t.V.kind){case"scalar":for(const[i,a]of r)o[i.toString()]=Wa(t.V.T,a);break;case"message":for(const[i,a]of r)o[i.toString()]=a.toJson(n);break;case"enum":const s=t.V.T;for(const[i,a]of r)o[i.toString()]=Qd(s,a,n.enumAsInteger)}return n.emitDefaultValues||r.length>0?o:void 0}if(t.repeated){bt(Array.isArray(e));const o=[];switch(t.kind){case"scalar":for(let r=0;r<e.length;r++)o.push(Wa(t.T,e[r]));break;case"enum":for(let r=0;r<e.length;r++)o.push(Qd(t.T,e[r],n.enumAsInteger));break;case"message":for(let r=0;r<e.length;r++)o.push(e[r].toJson(n))}return n.emitDefaultValues||o.length>0?o:void 0}switch(t.kind){case"scalar":return Wa(t.T,e);case"enum":return Qd(t.T,e,n.enumAsInteger);case"message":return o0(t.T,e).toJson(n)}}function Qd(t,e,n){var o;if(bt(typeof e=="number"),t.typeName=="google.protobuf.NullValue")return null;if(n)return e;const r=t.findNumber(e);return(o=r==null?void 0:r.name)!==null&&o!==void 0?o:e}function Wa(t,e){switch(t){case de.INT32:case de.SFIXED32:case de.SINT32:case de.FIXED32:case de.UINT32:return bt(typeof e=="number"),e;case de.FLOAT:case de.DOUBLE:return bt(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case de.STRING:return bt(typeof e=="string"),e;case de.BOOL:return bt(typeof e=="boolean"),e;case de.UINT64:case de.FIXED64:case de.INT64:case de.SFIXED64:case de.SINT64:return bt(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case de.BYTES:return bt(e instanceof Uint8Array),$a.enc(e)}}const Tr=Symbol("@bufbuild/protobuf/unknown-fields"),l0={readUnknownFields:!0,readerFactory:t=>new wE(t)},c0={writeUnknownFields:!0,writerFactory:()=>new vE};function _E(t){return t?Object.assign(Object.assign({},l0),t):l0}function IE(t){return t?Object.assign(Object.assign({},c0),t):c0}function d0(t,e,n,o,r){let{repeated:s,localName:i}=n;switch(n.oneof&&((t=t[n.oneof.localName]).case!=i&&delete t.value,t.case=i,i="value"),n.kind){case"scalar":case"enum":const a=n.kind=="enum"?de.INT32:n.T;let l=Ga;if(n.kind=="scalar"&&n.L>0&&(l=AE),s){let f=t[i];if(o==kt.LengthDelimited&&a!=de.STRING&&a!=de.BYTES){let m=e.uint32()+e.pos;for(;e.pos<m;)f.push(l(e,a))}else f.push(l(e,a))}else t[i]=l(e,a);break;case"message":const c=n.T;s?t[i].push(qa(e,new c,r,n)):oo(t[i])?qa(e,t[i],r,n):(t[i]=qa(e,new c,r,n),!c.fieldWrapper||n.oneof||n.repeated||(t[i]=c.fieldWrapper.unwrapField(t[i])));break;case"map":let[d,h]=function(f,m,g){const x=m.uint32(),p=m.pos+x;let b,y;for(;m.pos<p;){const[v]=m.tag();switch(v){case 1:b=Ga(m,f.K);break;case 2:switch(f.V.kind){case"scalar":y=Ga(m,f.V.T);break;case"enum":y=m.int32();break;case"message":y=qa(m,new f.V.T,g,void 0)}}}if(b===void 0&&(b=Ar(f.K,Do.BIGINT)),typeof b!="string"&&typeof b!="number"&&(b=b.toString()),y===void 0)switch(f.V.kind){case"scalar":y=Ar(f.V.T,Do.BIGINT);break;case"enum":y=f.V.T.values[0].no;break;case"message":y=new f.V.T}return[b,y]}(n,e,r);t[i][d]=h}}function qa(t,e,n,o){const r=e.getType().runtime.bin,s=o==null?void 0:o.delimited;return r.readMessage(e,t,s?o.no:t.uint32(),n,s),e}function AE(t,e){const n=Ga(t,e);return typeof n=="bigint"?n.toString():n}function Ga(t,e){switch(e){case de.STRING:return t.string();case de.BOOL:return t.bool();case de.DOUBLE:return t.double();case de.FLOAT:return t.float();case de.INT32:return t.int32();case de.INT64:return t.int64();case de.UINT64:return t.uint64();case de.FIXED64:return t.fixed64();case de.BYTES:return t.bytes();case de.FIXED32:return t.fixed32();case de.SFIXED32:return t.sfixed32();case de.SFIXED64:return t.sfixed64();case de.SINT64:return t.sint64();case de.UINT32:return t.uint32();case de.SINT32:return t.sint32()}}function u0(t,e,n,o){bt(e!==void 0);const r=t.repeated;switch(t.kind){case"scalar":case"enum":let s=t.kind=="enum"?de.INT32:t.T;if(r)if(bt(Array.isArray(e)),t.packed)(function(i,a,l,c){if(!c.length)return;i.tag(l,kt.LengthDelimited).fork();let[,d]=f0(a);for(let h=0;h<c.length;h++)i[d](c[h]);i.join()})(n,s,t.no,e);else for(const i of e)Gs(n,s,t.no,i);else Gs(n,s,t.no,e);break;case"message":if(r){bt(Array.isArray(e));for(const i of e)h0(n,o,t,i)}else h0(n,o,t,e);break;case"map":bt(typeof e=="object"&&e!=null);for(const[i,a]of Object.entries(e))TE(n,o,t,i,a)}}function TE(t,e,n,o,r){t.tag(n.no,kt.LengthDelimited),t.fork();let s=o;switch(n.K){case de.INT32:case de.FIXED32:case de.UINT32:case de.SFIXED32:case de.SINT32:s=Number.parseInt(o);break;case de.BOOL:bt(o=="true"||o=="false"),s=o=="true"}switch(Gs(t,n.K,1,s),n.V.kind){case"scalar":Gs(t,n.V.T,2,r);break;case"enum":Gs(t,de.INT32,2,r);break;case"message":bt(r!==void 0),t.tag(2,kt.LengthDelimited).bytes(r.toBinary(e))}t.join()}function h0(t,e,n,o){const r=o0(n.T,o);n.delimited?t.tag(n.no,kt.StartGroup).raw(r.toBinary(e)).tag(n.no,kt.EndGroup):t.tag(n.no,kt.LengthDelimited).bytes(r.toBinary(e))}function Gs(t,e,n,o){bt(o!==void 0);let[r,s]=f0(e);t.tag(n,r)[s](o)}function f0(t){let e=kt.Varint;switch(t){case de.BYTES:case de.STRING:e=kt.LengthDelimited;break;case de.DOUBLE:case de.FIXED64:case de.SFIXED64:e=kt.Bit64;break;case de.FIXED32:case de.SFIXED32:case de.FLOAT:e=kt.Bit32}return[e,de[t].toLowerCase()]}function Ya(t){if(t===void 0)return t;if(oo(t))return t.clone();if(t instanceof Uint8Array){const e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function Ys(t){return t instanceof Uint8Array?t:new Uint8Array(t)}class ME{constructor(e,n){this._fields=e,this._normalizer=n}findJsonName(e){if(!this.jsonNames){const n={};for(const o of this.list())n[o.jsonName]=n[o.name]=o;this.jsonNames=n}return this.jsonNames[e]}find(e){if(!this.numbers){const n={};for(const o of this.list())n[o.no]=o;this.numbers=n}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,n)=>e.no-n.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let n;for(const o of this.list())o.oneof?o.oneof!==n&&(n=o.oneof,e.push(n)):e.push(o)}return this.members}}function m0(t,e){const n=p0(t);return e?n:LE(PE(n))}const OE=p0;function p0(t){let e=!1;const n=[];for(let o=0;o<t.length;o++){let r=t.charAt(o);switch(r){case"_":e=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n.push(r),e=!1;break;default:e&&(e=!1,r=r.toUpperCase()),n.push(r)}}return n.join("")}const DE=new Set(["constructor","toString","toJSON","valueOf"]),RE=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),g0=t=>`${t}$`,PE=t=>RE.has(t)?g0(t):t,LE=t=>DE.has(t)?g0(t):t;class FE{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=m0(e,!1)}addField(e){bt(e.oneof===this,`field ${e.name} not one of ${this.name}`),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let n=0;n<this.fields.length;n++)this._lookup[this.fields[n].localName]=this.fields[n]}return this._lookup[e]}}const be=(x0=t=>new ME(t,e=>function(n){var o,r,s,i,a,l;const c=[];let d;for(const h of typeof n=="function"?n():n){const f=h;if(f.localName=m0(h.name,h.oneof!==void 0),f.jsonName=(o=h.jsonName)!==null&&o!==void 0?o:OE(h.name),f.repeated=(r=h.repeated)!==null&&r!==void 0&&r,h.kind=="scalar"&&(f.L=(s=h.L)!==null&&s!==void 0?s:Do.BIGINT),f.delimited=(i=h.delimited)!==null&&i!==void 0&&i,f.req=(a=h.req)!==null&&a!==void 0&&a,f.opt=(l=h.opt)!==null&&l!==void 0&&l,h.packed===void 0&&(f.packed=h.kind=="enum"||h.kind=="scalar"&&h.T!=de.BYTES&&h.T!=de.STRING),h.oneof!==void 0){const m=typeof h.oneof=="string"?h.oneof:h.oneof.name;d&&d.name==m||(d=new FE(m)),f.oneof=d,d.addField(f)}c.push(f)}return c}(e)),b0=t=>{for(const e of t.getType().fields.byMember()){if(e.opt)continue;const n=e.localName,o=t;if(e.repeated)o[n]=[];else switch(e.kind){case"oneof":o[n]={case:void 0};break;case"enum":o[n]=0;break;case"map":o[n]={};break;case"scalar":o[n]=Ar(e.T,e.L)}}},{syntax:"proto3",json:{makeReadOptions:jE,makeWriteOptions:SE,readMessage(t,e,n,o){if(e==null||Array.isArray(e)||typeof e!="object")throw new Error(`cannot decode message ${t.typeName} from JSON: ${Hn(e)}`);o=o??new t;const r=new Map,s=n.typeRegistry;for(const[i,a]of Object.entries(e)){const l=t.fields.findJsonName(i);if(l){if(l.oneof){if(a===null&&l.kind=="scalar")continue;const c=r.get(l.oneof);if(c!==void 0)throw new Error(`cannot decode message ${t.typeName} from JSON: multiple keys for oneof "${l.oneof.name}" present: "${c}", "${i}"`);r.set(l.oneof,i)}i0(o,a,l,n,t)}else{let c=!1;if(s!=null&&s.findExtension&&i.startsWith("[")&&i.endsWith("]")){const d=s.findExtension(i.substring(1,i.length-1));if(d&&d.extendee.typeName==t.typeName){c=!0;const[h,f]=Z1(d);i0(h,a,d.field,n,d),CE(o,d,f(),n)}}if(!c&&!n.ignoreUnknownFields)throw new Error(`cannot decode message ${t.typeName} from JSON: key "${i}" is unknown`)}}return o},writeMessage(t,e){const n=t.getType(),o={};let r;try{for(r of n.fields.byNumber()){if(!t0(r,t)){if(r.req)throw"required field not set";if(!e.emitDefaultValues||!EE(r))continue}const i=a0(r,r.oneof?t[r.oneof.localName].value:t[r.localName],e);i!==void 0&&(o[e.useProtoFieldName?r.name:r.jsonName]=i)}const s=e.typeRegistry;if(s!=null&&s.findExtensionFor)for(const i of n.runtime.bin.listUnknownFields(t)){const a=s.findExtensionFor(n.typeName,i.no);if(a&&Q1(t,a)){const l=kE(t,a,e),c=a0(a.field,l,e);c!==void 0&&(o[a.field.jsonName]=c)}}}catch(s){const i=r?`cannot encode field ${n.typeName}.${r.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,a=s instanceof Error?s.message:String(s);throw new Error(i+(a.length>0?`: ${a}`:""))}return o},readScalar:(t,e,n)=>qs(t,e,n??Do.BIGINT,!0),writeScalar(t,e,n){if(e!==void 0)return n||J1(t,e)?Wa(t,e):void 0},debug:Hn},bin:{makeReadOptions:_E,makeWriteOptions:IE,listUnknownFields(t){var e;return(e=t[Tr])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[Tr]},writeUnknownFields(t,e){const n=t[Tr];if(n)for(const o of n)e.tag(o.no,o.wireType).raw(o.data)},onUnknownField(t,e,n,o){const r=t;Array.isArray(r[Tr])||(r[Tr]=[]),r[Tr].push({no:e,wireType:n,data:o})},readMessage(t,e,n,o,r){const s=t.getType(),i=r?e.len:e.pos+n;let a,l;for(;e.pos<i&&([a,l]=e.tag(),r!==!0||l!=kt.EndGroup);){const c=s.fields.find(a);if(!c){const d=e.skip(l,a);o.readUnknownFields&&this.onUnknownField(t,a,l,d);continue}d0(t,e,c,l,o)}if(r&&(l!=kt.EndGroup||a!==n))throw new Error("invalid end group tag")},readField:d0,writeMessage(t,e,n){const o=t.getType();for(const r of o.fields.byNumber())if(t0(r,t))u0(r,r.oneof?t[r.oneof.localName].value:t[r.localName],e,n);else if(r.req)throw new Error(`cannot encode field ${o.typeName}.${r.name} to binary: required field not set`);return n.writeUnknownFields&&this.writeUnknownFields(t,e),e},writeField(t,e,n,o){e!==void 0&&u0(t,e,n,o)}},util:Object.assign(Object.assign({},{setEnumType:V1,initPartial(t,e){if(t===void 0)return;const n=e.getType();for(const o of n.fields.byMember()){const r=o.localName,s=e,i=t;if(i[r]!=null)switch(o.kind){case"oneof":const a=i[r].case;if(a===void 0)continue;const l=o.findField(a);let c=i[r].value;l&&l.kind=="message"&&!oo(c,l.T)?c=new l.T(c):l&&l.kind==="scalar"&&l.T===de.BYTES&&(c=Ys(c)),s[r]={case:a,value:c};break;case"scalar":case"enum":let d=i[r];o.T===de.BYTES&&(d=o.repeated?d.map(Ys):Ys(d)),s[r]=d;break;case"map":switch(o.V.kind){case"scalar":case"enum":if(o.V.T===de.BYTES)for(const[m,g]of Object.entries(i[r]))s[r][m]=Ys(g);else Object.assign(s[r],i[r]);break;case"message":const f=o.V.T;for(const m of Object.keys(i[r])){let g=i[r][m];f.fieldWrapper||(g=new f(g)),s[r][m]=g}}break;case"message":const h=o.T;if(o.repeated)s[r]=i[r].map(f=>oo(f,h)?f:new h(f));else{const f=i[r];h.fieldWrapper?h.typeName==="google.protobuf.BytesValue"?s[r]=Ys(f):s[r]=f:s[r]=oo(f,h)?f:new h(f)}}}},equals:(t,e,n)=>e===n||!(!e||!n)&&t.fields.byMember().every(o=>{const r=e[o.localName],s=n[o.localName];if(o.repeated){if(r.length!==s.length)return!1;switch(o.kind){case"message":return r.every((i,a)=>o.T.equals(i,s[a]));case"scalar":return r.every((i,a)=>Ro(o.T,i,s[a]));case"enum":return r.every((i,a)=>Ro(de.INT32,i,s[a]))}throw new Error(`repeated cannot contain ${o.kind}`)}switch(o.kind){case"message":let i=r,a=s;return o.T.fieldWrapper&&(i===void 0||oo(i)||(i=o.T.fieldWrapper.wrapField(i)),a===void 0||oo(a)||(a=o.T.fieldWrapper.wrapField(a))),o.T.equals(i,a);case"enum":return Ro(de.INT32,r,s);case"scalar":return Ro(o.T,r,s);case"oneof":if(r.case!==s.case)return!1;const l=o.findField(r.case);if(l===void 0)return!0;switch(l.kind){case"message":return l.T.equals(r.value,s.value);case"enum":return Ro(de.INT32,r.value,s.value);case"scalar":return Ro(l.T,r.value,s.value)}throw new Error(`oneof cannot contain ${l.kind}`);case"map":const c=Object.keys(r).concat(Object.keys(s));switch(o.V.kind){case"message":const d=o.V.T;return c.every(f=>d.equals(r[f],s[f]));case"enum":return c.every(f=>Ro(de.INT32,r[f],s[f]));case"scalar":const h=o.V.T;return c.every(f=>Ro(h,r[f],s[f]))}}}),clone(t){const e=t.getType(),n=new e,o=n;for(const r of e.fields.byMember()){const s=t[r.localName];let i;if(r.repeated)i=s.map(Ya);else if(r.kind=="map"){i=o[r.localName];for(const[a,l]of Object.entries(s))i[a]=Ya(l)}else i=r.kind=="oneof"?r.findField(s.case)?{case:s.case,value:Ya(s.value)}:{case:void 0}:Ya(s);o[r.localName]=i}for(const r of e.runtime.bin.listUnknownFields(t))e.runtime.bin.onUnknownField(o,r.no,r.wireType,r.data);return n}}),{newFieldList:x0,initFields:b0}),makeMessageType(t,e,n){return function(o,r,s,i){var a;const l=(a=i==null?void 0:i.localName)!==null&&a!==void 0?a:r.substring(r.lastIndexOf(".")+1),c={[l]:function(d){o.util.initFields(this),o.util.initPartial(d,this)}}[l];return Object.setPrototypeOf(c.prototype,new St),Object.assign(c,{runtime:o,typeName:r,fields:o.util.newFieldList(s),fromBinary:(d,h)=>new c().fromBinary(d,h),fromJson:(d,h)=>new c().fromJson(d,h),fromJsonString:(d,h)=>new c().fromJsonString(d,h),equals:(d,h)=>o.util.equals(c,d,h)}),c}(this,t,e,n)},makeEnum:gE,makeEnumType:H1,getEnumType:pE,makeExtension(t,e,n){return function(o,r,s,i){let a;return{typeName:r,extendee:s,get field(){if(!a){const l=typeof i=="function"?i():i;l.name=r.split(".").pop(),l.jsonName=`[${r}]`,a=o.util.newFieldList([l]).list()[0]}return a},runtime:o}}(this,t,e,n)}});var x0,b0,fn,eu,Ka,Ks,Xa,Xs,Po;(function(t){t[t.Unary=0]="Unary",t[t.ServerStreaming=1]="ServerStreaming",t[t.ClientStreaming=2]="ClientStreaming",t[t.BiDiStreaming=3]="BiDiStreaming"})(fn||(fn={})),function(t){t[t.NoSideEffects=1]="NoSideEffects",t[t.Idempotent=2]="Idempotent"}(eu||(eu={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.JUPYTER_FORMAT=77]="JUPYTER_FORMAT"}(Ka||(Ka={})),be.util.setEnumType(Ka,"exa.codeium_common_pb.ExperimentKey",[{no:0,name:"UNSPECIFIED"},{no:77,name:"JUPYTER_FORMAT"}]),function(t){t[t.CODEIUM=0]="CODEIUM"}(Ks||(Ks={})),be.util.setEnumType(Ks,"exa.codeium_common_pb.AuthSource",[{no:0,name:"AUTH_SOURCE_CODEIUM"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ENABLE_CODEIUM=1]="ENABLE_CODEIUM",t[t.DISABLE_CODEIUM=2]="DISABLE_CODEIUM",t[t.SHOW_PREVIOUS_COMPLETION=3]="SHOW_PREVIOUS_COMPLETION",t[t.SHOW_NEXT_COMPLETION=4]="SHOW_NEXT_COMPLETION"}(Xa||(Xa={})),be.util.setEnumType(Xa,"exa.codeium_common_pb.EventType",[{no:0,name:"EVENT_TYPE_UNSPECIFIED"},{no:1,name:"EVENT_TYPE_ENABLE_CODEIUM"},{no:2,name:"EVENT_TYPE_DISABLE_CODEIUM"},{no:3,name:"EVENT_TYPE_SHOW_PREVIOUS_COMPLETION"},{no:4,name:"EVENT_TYPE_SHOW_NEXT_COMPLETION"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TYPING_AS_SUGGESTED=1]="TYPING_AS_SUGGESTED",t[t.CACHE=2]="CACHE",t[t.NETWORK=3]="NETWORK"}(Xs||(Xs={})),be.util.setEnumType(Xs,"exa.codeium_common_pb.CompletionSource",[{no:0,name:"COMPLETION_SOURCE_UNSPECIFIED"},{no:1,name:"COMPLETION_SOURCE_TYPING_AS_SUGGESTED"},{no:2,name:"COMPLETION_SOURCE_CACHE"},{no:3,name:"COMPLETION_SOURCE_NETWORK"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.C=1]="C",t[t.CLOJURE=2]="CLOJURE",t[t.COFFEESCRIPT=3]="COFFEESCRIPT",t[t.CPP=4]="CPP",t[t.CSHARP=5]="CSHARP",t[t.CSS=6]="CSS",t[t.CUDACPP=7]="CUDACPP",t[t.DOCKERFILE=8]="DOCKERFILE",t[t.GO=9]="GO",t[t.GROOVY=10]="GROOVY",t[t.HANDLEBARS=11]="HANDLEBARS",t[t.HASKELL=12]="HASKELL",t[t.HCL=13]="HCL",t[t.HTML=14]="HTML",t[t.INI=15]="INI",t[t.JAVA=16]="JAVA",t[t.JAVASCRIPT=17]="JAVASCRIPT",t[t.JSON=18]="JSON",t[t.JULIA=19]="JULIA",t[t.KOTLIN=20]="KOTLIN",t[t.LATEX=21]="LATEX",t[t.LESS=22]="LESS",t[t.LUA=23]="LUA",t[t.MAKEFILE=24]="MAKEFILE",t[t.MARKDOWN=25]="MARKDOWN",t[t.OBJECTIVEC=26]="OBJECTIVEC",t[t.OBJECTIVECPP=27]="OBJECTIVECPP",t[t.PERL=28]="PERL",t[t.PHP=29]="PHP",t[t.PLAINTEXT=30]="PLAINTEXT",t[t.PROTOBUF=31]="PROTOBUF",t[t.PBTXT=32]="PBTXT",t[t.PYTHON=33]="PYTHON",t[t.R=34]="R",t[t.RUBY=35]="RUBY",t[t.RUST=36]="RUST",t[t.SASS=37]="SASS",t[t.SCALA=38]="SCALA",t[t.SCSS=39]="SCSS",t[t.SHELL=40]="SHELL",t[t.SQL=41]="SQL",t[t.STARLARK=42]="STARLARK",t[t.SWIFT=43]="SWIFT",t[t.TSX=44]="TSX",t[t.TYPESCRIPT=45]="TYPESCRIPT",t[t.VISUALBASIC=46]="VISUALBASIC",t[t.VUE=47]="VUE",t[t.XML=48]="XML",t[t.XSL=49]="XSL",t[t.YAML=50]="YAML",t[t.SVELTE=51]="SVELTE",t[t.TOML=52]="TOML",t[t.DART=53]="DART",t[t.RST=54]="RST",t[t.OCAML=55]="OCAML",t[t.CMAKE=56]="CMAKE",t[t.PASCAL=57]="PASCAL",t[t.ELIXIR=58]="ELIXIR",t[t.FSHARP=59]="FSHARP",t[t.LISP=60]="LISP",t[t.MATLAB=61]="MATLAB",t[t.POWERSHELL=62]="POWERSHELL",t[t.SOLIDITY=63]="SOLIDITY",t[t.ADA=64]="ADA",t[t.OCAML_INTERFACE=65]="OCAML_INTERFACE"}(Po||(Po={})),be.util.setEnumType(Po,"exa.codeium_common_pb.Language",[{no:0,name:"LANGUAGE_UNSPECIFIED"},{no:1,name:"LANGUAGE_C"},{no:2,name:"LANGUAGE_CLOJURE"},{no:3,name:"LANGUAGE_COFFEESCRIPT"},{no:4,name:"LANGUAGE_CPP"},{no:5,name:"LANGUAGE_CSHARP"},{no:6,name:"LANGUAGE_CSS"},{no:7,name:"LANGUAGE_CUDACPP"},{no:8,name:"LANGUAGE_DOCKERFILE"},{no:9,name:"LANGUAGE_GO"},{no:10,name:"LANGUAGE_GROOVY"},{no:11,name:"LANGUAGE_HANDLEBARS"},{no:12,name:"LANGUAGE_HASKELL"},{no:13,name:"LANGUAGE_HCL"},{no:14,name:"LANGUAGE_HTML"},{no:15,name:"LANGUAGE_INI"},{no:16,name:"LANGUAGE_JAVA"},{no:17,name:"LANGUAGE_JAVASCRIPT"},{no:18,name:"LANGUAGE_JSON"},{no:19,name:"LANGUAGE_JULIA"},{no:20,name:"LANGUAGE_KOTLIN"},{no:21,name:"LANGUAGE_LATEX"},{no:22,name:"LANGUAGE_LESS"},{no:23,name:"LANGUAGE_LUA"},{no:24,name:"LANGUAGE_MAKEFILE"},{no:25,name:"LANGUAGE_MARKDOWN"},{no:26,name:"LANGUAGE_OBJECTIVEC"},{no:27,name:"LANGUAGE_OBJECTIVECPP"},{no:28,name:"LANGUAGE_PERL"},{no:29,name:"LANGUAGE_PHP"},{no:30,name:"LANGUAGE_PLAINTEXT"},{no:31,name:"LANGUAGE_PROTOBUF"},{no:32,name:"LANGUAGE_PBTXT"},{no:33,name:"LANGUAGE_PYTHON"},{no:34,name:"LANGUAGE_R"},{no:35,name:"LANGUAGE_RUBY"},{no:36,name:"LANGUAGE_RUST"},{no:37,name:"LANGUAGE_SASS"},{no:38,name:"LANGUAGE_SCALA"},{no:39,name:"LANGUAGE_SCSS"},{no:40,name:"LANGUAGE_SHELL"},{no:41,name:"LANGUAGE_SQL"},{no:42,name:"LANGUAGE_STARLARK"},{no:43,name:"LANGUAGE_SWIFT"},{no:44,name:"LANGUAGE_TSX"},{no:45,name:"LANGUAGE_TYPESCRIPT"},{no:46,name:"LANGUAGE_VISUALBASIC"},{no:47,name:"LANGUAGE_VUE"},{no:48,name:"LANGUAGE_XML"},{no:49,name:"LANGUAGE_XSL"},{no:50,name:"LANGUAGE_YAML"},{no:51,name:"LANGUAGE_SVELTE"},{no:52,name:"LANGUAGE_TOML"},{no:53,name:"LANGUAGE_DART"},{no:54,name:"LANGUAGE_RST"},{no:55,name:"LANGUAGE_OCAML"},{no:56,name:"LANGUAGE_CMAKE"},{no:57,name:"LANGUAGE_PASCAL"},{no:58,name:"LANGUAGE_ELIXIR"},{no:59,name:"LANGUAGE_FSHARP"},{no:60,name:"LANGUAGE_LISP"},{no:61,name:"LANGUAGE_MATLAB"},{no:62,name:"LANGUAGE_POWERSHELL"},{no:63,name:"LANGUAGE_SOLIDITY"},{no:64,name:"LANGUAGE_ADA"},{no:65,name:"LANGUAGE_OCAML_INTERFACE"}]);const io=class io extends St{constructor(n){super();Z(this,"completionId","");Z(this,"text","");Z(this,"prefix","");Z(this,"stop","");Z(this,"score",0);Z(this,"tokens",[]);Z(this,"decodedTokens",[]);Z(this,"probabilities",[]);Z(this,"adjustedProbabilities",[]);Z(this,"generatedLength",pt.zero);be.util.initPartial(n,this)}static fromBinary(n,o){return new io().fromBinary(n,o)}static fromJson(n,o){return new io().fromJson(n,o)}static fromJsonString(n,o){return new io().fromJsonString(n,o)}static equals(n,o){return be.util.equals(io,n,o)}};Z(io,"runtime",be),Z(io,"typeName","exa.codeium_common_pb.Completion"),Z(io,"fields",be.util.newFieldList(()=>[{no:1,name:"completion_id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"prefix",kind:"scalar",T:9},{no:4,name:"stop",kind:"scalar",T:9},{no:5,name:"score",kind:"scalar",T:1},{no:6,name:"tokens",kind:"scalar",T:4,repeated:!0},{no:7,name:"decoded_tokens",kind:"scalar",T:9,repeated:!0},{no:8,name:"probabilities",kind:"scalar",T:1,repeated:!0},{no:9,name:"adjusted_probabilities",kind:"scalar",T:1,repeated:!0},{no:10,name:"generated_length",kind:"scalar",T:4}]));let tu=io;const ao=class ao extends St{constructor(n){super();Z(this,"ideName","");Z(this,"ideVersion","");Z(this,"extensionName","");Z(this,"extensionVersion","");Z(this,"apiKey","");Z(this,"locale","");Z(this,"sessionId","");Z(this,"requestId",pt.zero);Z(this,"userAgent","");Z(this,"url","");Z(this,"authSource",Ks.CODEIUM);be.util.initPartial(n,this)}static fromBinary(n,o){return new ao().fromBinary(n,o)}static fromJson(n,o){return new ao().fromJson(n,o)}static fromJsonString(n,o){return new ao().fromJsonString(n,o)}static equals(n,o){return be.util.equals(ao,n,o)}};Z(ao,"runtime",be),Z(ao,"typeName","exa.codeium_common_pb.Metadata"),Z(ao,"fields",be.util.newFieldList(()=>[{no:1,name:"ide_name",kind:"scalar",T:9},{no:7,name:"ide_version",kind:"scalar",T:9},{no:12,name:"extension_name",kind:"scalar",T:9},{no:2,name:"extension_version",kind:"scalar",T:9},{no:3,name:"api_key",kind:"scalar",T:9},{no:4,name:"locale",kind:"scalar",T:9},{no:10,name:"session_id",kind:"scalar",T:9},{no:9,name:"request_id",kind:"scalar",T:4},{no:13,name:"user_agent",kind:"scalar",T:9},{no:14,name:"url",kind:"scalar",T:9},{no:15,name:"auth_source",kind:"enum",T:be.getEnumType(Ks)}]));let Ja=ao;const lo=class lo extends St{constructor(n){super();Z(this,"tabSize",pt.zero);Z(this,"insertSpaces",!1);be.util.initPartial(n,this)}static fromBinary(n,o){return new lo().fromBinary(n,o)}static fromJson(n,o){return new lo().fromJson(n,o)}static fromJsonString(n,o){return new lo().fromJsonString(n,o)}static equals(n,o){return be.util.equals(lo,n,o)}};Z(lo,"runtime",be),Z(lo,"typeName","exa.codeium_common_pb.EditorOptions"),Z(lo,"fields",be.util.newFieldList(()=>[{no:1,name:"tab_size",kind:"scalar",T:4},{no:2,name:"insert_spaces",kind:"scalar",T:8}]));let nu=lo;be.util.newFieldList(()=>[{no:1,name:"event_type",kind:"enum",T:be.getEnumType(Xa)},{no:2,name:"event_json",kind:"scalar",T:9},{no:3,name:"timestamp_unix_ms",kind:"scalar",T:3}]);class zE extends bs{constructor(n,o){super();Z(this,"index");Z(this,"total");this.index=n,this.total=o}toDOM(){const n=document.createElement("span");n.setAttribute("aria-hidden","true"),n.className="cm-codeium-cycle";const o=n.appendChild(document.createElement("span"));o.className="cm-codeium-cycle-explanation",o.innerText=`${this.index+1}/${this.total}`;const r=n.appendChild(document.createElement("button"));return r.className="cm-codeium-cycle-key",r.innerText="\u2192 (Ctrl ])",r.dataset.action="codeium-cycle",n}ignoreEvent(){return!1}}const Za=yr.define({combine:t=>_c(t,{language:Po.TYPESCRIPT,timeout:150,widgetClass:zE,alwaysOn:!0},{})}),y0=yr.define({combine:t=>_c(t,{override:()=>[]},{})}),BE=ot.mark({class:"cm-ghostText"}),ir=vn.define({create:t=>null,update(t,e){var o;const n=e.state.facet(Za);for(const r of e.effects){if(r.is(qd)){const{changeSpecs:s,index:i}=r.value,a=s[i].map(c=>BE.range(c.absoluteStartPos,c.absoluteEndPos)),l=(o=a.at(-1))==null?void 0:o.to;return{index:i,decorations:ot.set([...a,...l!==void 0&&s.length>1&&n.widgetClass?[ot.widget({widget:new n.widgetClass(i,s.length),side:1}).range(l)]:[]]),changeSpecs:s,reverseChangeSet:r.value.reverseChangeSet}}if(r.is(Gd)||r.is(Yd))return null}return t&&{...t,decorations:t.decorations.map(e.changes),reverseChangeSet:t.reverseChangeSet.map(e.changes)}},provide:t=>We.decorations.from(t,e=>(e==null?void 0:e.decorations)||ot.none)}),Mr=Um.define(),Qa=Um.define();var mt;function ou(t){const e=mt[t];return typeof e!="string"?t.toString():e[0].toLowerCase()+e.substring(1).replace(/[A-Z]/g,n=>"_"+n.toLowerCase())}let el;(function(t){t[t.Canceled=1]="Canceled",t[t.Unknown=2]="Unknown",t[t.InvalidArgument=3]="InvalidArgument",t[t.DeadlineExceeded=4]="DeadlineExceeded",t[t.NotFound=5]="NotFound",t[t.AlreadyExists=6]="AlreadyExists",t[t.PermissionDenied=7]="PermissionDenied",t[t.ResourceExhausted=8]="ResourceExhausted",t[t.FailedPrecondition=9]="FailedPrecondition",t[t.Aborted=10]="Aborted",t[t.OutOfRange=11]="OutOfRange",t[t.Unimplemented=12]="Unimplemented",t[t.Internal=13]="Internal",t[t.Unavailable=14]="Unavailable",t[t.DataLoss=15]="DataLoss",t[t.Unauthenticated=16]="Unauthenticated"})(mt||(mt={}));class Nt extends Error{constructor(e,n=mt.Unknown,o,r,s){super(function(i,a){return i.length?`[${ou(a)}] ${i}`:`[${ou(a)}]`}(e,n)),this.name="ConnectError",Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=e,this.code=n,this.metadata=new Headers(o??{}),this.details=r??[],this.cause=s}static from(e,n=mt.Unknown){return e instanceof Nt?e:e instanceof Error?e.name=="AbortError"?new Nt(e.message,mt.Canceled):new Nt(e.message,n,void 0,void 0,e):new Nt(String(e),n,void 0,void 0,e)}static[Symbol.hasInstance](e){return e instanceof Error&&(Object.getPrototypeOf(e)===Nt.prototype||e.name==="ConnectError"&&"code"in e&&typeof e.code=="number"&&"metadata"in e&&"details"in e&&Array.isArray(e.details)&&"rawMessage"in e&&typeof e.rawMessage=="string"&&"cause"in e)}findDetails(e){const n="typeName"in e?{findMessage:r=>r===e.typeName?e:void 0}:e,o=[];for(const r of this.details){if("getType"in r){n.findMessage(r.getType().typeName)&&o.push(r);continue}const s=n.findMessage(r.type);if(s)try{o.push(s.fromBinary(r.value))}catch{}}return o}}var UE=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(r){e[r]=t[r]&&function(s){return new Promise(function(i,a){(function(l,c,d,h){Promise.resolve(h).then(function(f){l({value:f,done:d})},c)})(i,a,(s=t[r](s)).done,s.value)})}}},Js=function(t){return this instanceof Js?(this.v=t,this):new Js(t)},$E=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},i("next"),i("throw"),i("return",function(h){return function(f){return Promise.resolve(f).then(h,c)}}),o[Symbol.asyncIterator]=function(){return this},o;function i(h,f){r[h]&&(o[h]=function(m){return new Promise(function(g,x){s.push([h,m,g,x])>1||a(h,m)})},f&&(o[h]=f(o[h])))}function a(h,f){try{(m=r[h](f)).value instanceof Js?Promise.resolve(m.value.v).then(l,c):d(s[0][2],m)}catch(g){d(s[0][3],g)}var m}function l(h){a("next",h)}function c(h){a("throw",h)}function d(h,f){h(f),s.shift(),s.length&&a(s[0][0],s[0][1])}},VE=function(t){var e,n;return e={},o("next"),o("throw",function(r){throw r}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(r,s){e[r]=t[r]?function(i){return(n=!n)?{value:Js(t[r](i)),done:!1}:s?s(i):i}:s}},v0=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(r){e[r]=t[r]&&function(s){return new Promise(function(i,a){(function(l,c,d,h){Promise.resolve(h).then(function(f){l({value:f,done:d})},c)})(i,a,(s=t[r](s)).done,s.value)})}}},Or=function(t){return this instanceof Or?(this.v=t,this):new Or(t)},HE=function(t){var e,n;return e={},o("next"),o("throw",function(r){throw r}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(r,s){e[r]=t[r]?function(i){return(n=!n)?{value:Or(t[r](i)),done:!1}:s?s(i):i}:s}},WE=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},i("next"),i("throw"),i("return",function(h){return function(f){return Promise.resolve(f).then(h,c)}}),o[Symbol.asyncIterator]=function(){return this},o;function i(h,f){r[h]&&(o[h]=function(m){return new Promise(function(g,x){s.push([h,m,g,x])>1||a(h,m)})},f&&(o[h]=f(o[h])))}function a(h,f){try{(m=r[h](f)).value instanceof Or?Promise.resolve(m.value.v).then(l,c):d(s[0][2],m)}catch(g){d(s[0][3],g)}var m}function l(h){a("next",h)}function c(h){a("throw",h)}function d(h,f){h(f),s.shift(),s.length&&a(s[0][0],s[0][1])}};function qE(t,e){return function(n,o){const r={};for(const[s,i]of Object.entries(n.methods)){const a=o(Object.assign(Object.assign({},i),{localName:s,service:n}));a!=null&&(r[s]=a)}return r}(t,n=>{switch(n.kind){case fn.Unary:return function(o,r,s){return async function(i,a){var l,c;const d=await o.unary(r,s,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,i,a==null?void 0:a.contextValues);return(l=a==null?void 0:a.onHeader)===null||l===void 0||l.call(a,d.header),(c=a==null?void 0:a.onTrailer)===null||c===void 0||c.call(a,d.trailer),d.message}}(e,t,n);case fn.ServerStreaming:return function(o,r,s){return function(i,a){return w0(o.stream(r,s,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,function(l){return $E(this,arguments,function*(){yield Js(yield*VE(UE(l)))})}([i]),a==null?void 0:a.contextValues),a)}}(e,t,n);case fn.ClientStreaming:return function(o,r,s){return async function(i,a){var l,c,d,h,f,m;const g=await o.stream(r,s,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,i,a==null?void 0:a.contextValues);let x;(f=a==null?void 0:a.onHeader)===null||f===void 0||f.call(a,g.header);let p=0;try{for(var b,y=!0,v=v0(g.message);!(l=(b=await v.next()).done);y=!0)h=b.value,y=!1,x=h,p++}catch(w){c={error:w}}finally{try{y||l||!(d=v.return)||await d.call(v)}finally{if(c)throw c.error}}if(!x)throw new Nt("protocol error: missing response message",mt.Unimplemented);if(p>1)throw new Nt("protocol error: received extra messages for client streaming method",mt.Unimplemented);return(m=a==null?void 0:a.onTrailer)===null||m===void 0||m.call(a,g.trailer),x}}(e,t,n);case fn.BiDiStreaming:return function(o,r,s){return function(i,a){return w0(o.stream(r,s,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,i,a==null?void 0:a.contextValues),a)}}(e,t,n);default:return null}})}function w0(t,e){const n=function(){return WE(this,arguments,function*(){var o,r;const s=yield Or(t);(o=e==null?void 0:e.onHeader)===null||o===void 0||o.call(e,s.header),yield Or(yield*HE(v0(s.message))),(r=e==null?void 0:e.onTrailer)===null||r===void 0||r.call(e,s.trailer)})}()[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({next:()=>n.next()})}}function k0(t){if(!t.aborted)return;if(t.reason!==void 0)return t.reason;const e=new Error("This operation was aborted");return e.name="AbortError",e}function C0(){return{get(t){return t.id in this?this[t.id]:t.defaultValue},set(t,e){return this[t.id]=e,this},delete(t){return delete this[t.id],this}}}function j0(t,e,n){const o=typeof e=="string"?e:e.typeName,r=typeof n=="string"?n:n.name;return t.toString().replace(/\/?$/,`/${o}/${r}`)}function S0(t,e){return e instanceof t?e:new t(e)}function GE(t,e){function n(o){return o.done===!0?o:{done:o.done,value:S0(t,o.value)}}return{[Symbol.asyncIterator](){const o=e[Symbol.asyncIterator](),r={next:()=>o.next().then(n)};return o.throw!==void 0&&(r.throw=s=>o.throw(s).then(n)),o.return!==void 0&&(r.return=s=>o.return(s).then(n)),r}}}function N0(t,e){var n;return(n=e==null?void 0:e.concat().reverse().reduce((o,r)=>r(o),t))!==null&&n!==void 0?n:t}function E0(t){var e;const n=Object.assign({},t);return(e=n.ignoreUnknownFields)!==null&&e!==void 0||(n.ignoreUnknownFields=!0),n}function _0(t,e,n,o){const r=e?I0(t.I,o):A0(t.I,n);return{parse:(e?I0(t.O,o):A0(t.O,n)).parse,serialize:r.serialize}}function I0(t,e){return{parse(n){try{return t.fromBinary(n,e)}catch(o){const r=o instanceof Error?o.message:String(o);throw new Nt(`parse binary: ${r}`,mt.Internal)}},serialize(n){try{return n.toBinary(e)}catch(o){const r=o instanceof Error?o.message:String(o);throw new Nt(`serialize binary: ${r}`,mt.Internal)}}}}function A0(t,e){var n,o;const r=(n=e==null?void 0:e.textEncoder)!==null&&n!==void 0?n:new TextEncoder,s=(o=e==null?void 0:e.textDecoder)!==null&&o!==void 0?o:new TextDecoder,i=E0(e);return{parse(a){try{const l=s.decode(a);return t.fromJsonString(l,i)}catch(l){throw Nt.from(l,mt.InvalidArgument)}},serialize(a){try{const l=a.toJsonString(i);return r.encode(l)}catch(l){throw Nt.from(l,mt.Internal)}}}}const YE=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i;function T0(t,e,n){var o;if(e&&new Headers(e).forEach((a,l)=>n.metadata.append(l,a)),typeof t!="object"||t==null||Array.isArray(t))throw n;let r=n.code;"code"in t&&typeof t.code=="string"&&(r=(o=function(a){if(!el){el={};for(const l of Object.values(mt))typeof l!="string"&&(el[ou(l)]=l)}return el[a]}(t.code))!==null&&o!==void 0?o:r);const s=t.message;if(s!=null&&typeof s!="string")throw n;const i=new Nt(s??"",r,e);if("details"in t&&Array.isArray(t.details))for(const a of t.details){if(a===null||typeof a!="object"||Array.isArray(a)||typeof a.type!="string"||typeof a.value!="string")throw n;try{i.details.push({type:a.type,value:$a.dec(a.value),debug:a.debug})}catch{throw n}}return i}function KE(t){const e=new Nt("invalid end stream",mt.Unknown);let n;try{n=JSON.parse(typeof t=="string"?t:new TextDecoder().decode(t))}catch{throw e}if(typeof n!="object"||n==null||Array.isArray(n))throw e;const o=new Headers;if("metadata"in n){if(typeof n.metadata!="object"||n.metadata==null||Array.isArray(n.metadata))throw e;for(const[r,s]of Object.entries(n.metadata)){if(!Array.isArray(s)||s.some(i=>typeof i!="string"))throw e;for(const i of s)o.append(r,i)}}return{metadata:o,error:"error"in n&&n.error!=null?T0(n.error,o,e):void 0}}const tl="Content-Type",XE="Content-Length",M0="Content-Encoding",JE="Accept-Encoding",O0="Connect-Protocol-Version";function D0(t){const e=new Headers,n=new Headers;return t.forEach((o,r)=>{r.toLowerCase().startsWith("trailer-")?n.append(r.substring(8),o):e.append(r,o)}),[e,n]}function R0(t,e,n,o,r){const s=new Headers(o??{});return n!==void 0&&s.set("Connect-Timeout-Ms",`${n}`),s.set(tl,t==fn.Unary?e?"application/proto":"application/json":e?"application/connect+proto":"application/connect+json"),s.set(O0,"1"),s}function P0(t,e,n,o){const r=o.get(tl),s=function(l){const c=l==null?void 0:l.match(YE);if(c)return{stream:!!c[1],binary:!!c[3]}}(r);if(n!==200){const l=new Nt(`HTTP ${n}`,function(c){switch(c){case 400:return mt.Internal;case 401:return mt.Unauthenticated;case 403:return mt.PermissionDenied;case 404:return mt.Unimplemented;case 429:case 502:case 503:case 504:return mt.Unavailable;default:return mt.Unknown}}(n),o);if(t==fn.Unary&&s&&!s.binary)return{isUnaryError:!0,unaryError:l};throw l}const i=e,a=t!==fn.Unary;if((s==null?void 0:s.binary)!==i||s.stream!==a)throw new Nt(`unsupported content type ${r}`,s===void 0?mt.Unknown:mt.Internal,o);return{isUnaryError:!1}}const ZE="application/";function QE(t,e,n){let o="?connect=v1";const r=t.header.get(tl);(r==null?void 0:r.indexOf(ZE))===0&&(o+="&encoding="+encodeURIComponent(r.slice(12)));const s=t.header.get(M0);s!==null&&s!=="identity"&&(o+="&compression="+encodeURIComponent(s),n=!0),n&&(o+="&base64=1"),o+="&message="+function(l,c){return c?$a.enc(l).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):encodeURIComponent(new TextDecoder().decode(l))}(e,n);const i=t.url+o,a=new Headers(t.header);return[O0,tl,XE,M0,JE].forEach(l=>a.delete(l)),Object.assign(Object.assign({},t),{init:Object.assign(Object.assign({},t.init),{method:"GET"}),url:i,header:a})}function L0(t){const{signal:e,cleanup:n}=function(r){const s=new AbortController,i=()=>{s.abort(new Nt("the operation timed out",mt.DeadlineExceeded))};let a;return r!==void 0&&(r<=0?i():a=setTimeout(i,r)),{signal:s.signal,cleanup:()=>clearTimeout(a)}}(t.timeoutMs),o=function(...r){const s=new AbortController,i=r.filter(l=>l!==void 0).concat(s.signal);for(const l of i){if(l.aborted){a.apply(l);break}l.addEventListener("abort",a)}function a(){s.signal.aborted||s.abort(k0(this));for(const l of i)l.removeEventListener("abort",a)}return s}(t.signal,e);return[o.signal,function(r){const s=Nt.from(e.aborted?k0(e):r);return o.abort(s),n(),Promise.reject(s)},function(){n(),o.abort()}]}var Zs,ru,Qs;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.INACTIVE=1]="INACTIVE",t[t.PROCESSING=2]="PROCESSING",t[t.SUCCESS=3]="SUCCESS",t[t.WARNING=4]="WARNING",t[t.ERROR=5]="ERROR"})(Zs||(Zs={})),be.util.setEnumType(Zs,"exa.language_server_pb.CodeiumState",[{no:0,name:"CODEIUM_STATE_UNSPECIFIED"},{no:1,name:"CODEIUM_STATE_INACTIVE"},{no:2,name:"CODEIUM_STATE_PROCESSING"},{no:3,name:"CODEIUM_STATE_SUCCESS"},{no:4,name:"CODEIUM_STATE_WARNING"},{no:5,name:"CODEIUM_STATE_ERROR"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SINGLE=1]="SINGLE",t[t.MULTI=2]="MULTI"}(ru||(ru={})),be.util.setEnumType(ru,"exa.language_server_pb.LineType",[{no:0,name:"LINE_TYPE_UNSPECIFIED"},{no:1,name:"LINE_TYPE_SINGLE"},{no:2,name:"LINE_TYPE_MULTI"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.INLINE=1]="INLINE",t[t.BLOCK=2]="BLOCK",t[t.INLINE_MASK=3]="INLINE_MASK"}(Qs||(Qs={})),be.util.setEnumType(Qs,"exa.language_server_pb.CompletionPartType",[{no:0,name:"COMPLETION_PART_TYPE_UNSPECIFIED"},{no:1,name:"COMPLETION_PART_TYPE_INLINE"},{no:2,name:"COMPLETION_PART_TYPE_BLOCK"},{no:3,name:"COMPLETION_PART_TYPE_INLINE_MASK"}]);const co=class co extends St{constructor(n){super();Z(this,"threshold",0);be.util.initPartial(n,this)}static fromBinary(n,o){return new co().fromBinary(n,o)}static fromJson(n,o){return new co().fromJson(n,o)}static fromJsonString(n,o){return new co().fromJsonString(n,o)}static equals(n,o){return be.util.equals(co,n,o)}};Z(co,"runtime",be),Z(co,"typeName","exa.language_server_pb.MultilineConfig"),Z(co,"fields",be.util.newFieldList(()=>[{no:1,name:"threshold",kind:"scalar",T:2}]));let su=co;const uo=class uo extends St{constructor(n){super();Z(this,"metadata");Z(this,"document");Z(this,"editorOptions");Z(this,"otherDocuments",[]);Z(this,"experimentConfig");Z(this,"modelName","");Z(this,"multilineConfig");be.util.initPartial(n,this)}static fromBinary(n,o){return new uo().fromBinary(n,o)}static fromJson(n,o){return new uo().fromJson(n,o)}static fromJsonString(n,o){return new uo().fromJsonString(n,o)}static equals(n,o){return be.util.equals(uo,n,o)}};Z(uo,"runtime",be),Z(uo,"typeName","exa.language_server_pb.GetCompletionsRequest"),Z(uo,"fields",be.util.newFieldList(()=>[{no:1,name:"metadata",kind:"message",T:Ja},{no:2,name:"document",kind:"message",T:nl},{no:3,name:"editor_options",kind:"message",T:nu},{no:5,name:"other_documents",kind:"message",T:nl,repeated:!0},{no:7,name:"experiment_config",kind:"message",T:hu},{no:10,name:"model_name",kind:"scalar",T:9},{no:13,name:"multiline_config",kind:"message",T:su}]));let iu=uo;const ho=class ho extends St{constructor(n){super();Z(this,"state");Z(this,"completionItems",[]);be.util.initPartial(n,this)}static fromBinary(n,o){return new ho().fromBinary(n,o)}static fromJson(n,o){return new ho().fromJson(n,o)}static fromJsonString(n,o){return new ho().fromJsonString(n,o)}static equals(n,o){return be.util.equals(ho,n,o)}};Z(ho,"runtime",be),Z(ho,"typeName","exa.language_server_pb.GetCompletionsResponse"),Z(ho,"fields",be.util.newFieldList(()=>[{no:1,name:"state",kind:"message",T:fu},{no:2,name:"completion_items",kind:"message",T:xu,repeated:!0}]));let au=ho;const fo=class fo extends St{constructor(n){super();Z(this,"metadata");Z(this,"completionId","");be.util.initPartial(n,this)}static fromBinary(n,o){return new fo().fromBinary(n,o)}static fromJson(n,o){return new fo().fromJson(n,o)}static fromJsonString(n,o){return new fo().fromJsonString(n,o)}static equals(n,o){return be.util.equals(fo,n,o)}};Z(fo,"runtime",be),Z(fo,"typeName","exa.language_server_pb.AcceptCompletionRequest"),Z(fo,"fields",be.util.newFieldList(()=>[{no:1,name:"metadata",kind:"message",T:Ja},{no:2,name:"completion_id",kind:"scalar",T:9}]));let lu=fo;const mo=class mo extends St{constructor(e){super(),be.util.initPartial(e,this)}static fromBinary(e,n){return new mo().fromBinary(e,n)}static fromJson(e,n){return new mo().fromJson(e,n)}static fromJsonString(e,n){return new mo().fromJsonString(e,n)}static equals(e,n){return be.util.equals(mo,e,n)}};Z(mo,"runtime",be),Z(mo,"typeName","exa.language_server_pb.AcceptCompletionResponse"),Z(mo,"fields",be.util.newFieldList(()=>[]));let cu=mo;const po=class po extends St{constructor(e){super(),be.util.initPartial(e,this)}static fromBinary(e,n){return new po().fromBinary(e,n)}static fromJson(e,n){return new po().fromJson(e,n)}static fromJsonString(e,n){return new po().fromJsonString(e,n)}static equals(e,n){return be.util.equals(po,e,n)}};Z(po,"runtime",be),Z(po,"typeName","exa.language_server_pb.GetAuthTokenRequest"),Z(po,"fields",be.util.newFieldList(()=>[]));let du=po;const go=class go extends St{constructor(n){super();Z(this,"authToken","");Z(this,"uuid","");be.util.initPartial(n,this)}static fromBinary(n,o){return new go().fromBinary(n,o)}static fromJson(n,o){return new go().fromJson(n,o)}static fromJsonString(n,o){return new go().fromJsonString(n,o)}static equals(n,o){return be.util.equals(go,n,o)}};Z(go,"runtime",be),Z(go,"typeName","exa.language_server_pb.GetAuthTokenResponse"),Z(go,"fields",be.util.newFieldList(()=>[{no:1,name:"auth_token",kind:"scalar",T:9},{no:2,name:"uuid",kind:"scalar",T:9}]));let uu=go;const xo=class xo extends St{constructor(n){super();Z(this,"row",pt.zero);Z(this,"col",pt.zero);be.util.initPartial(n,this)}static fromBinary(n,o){return new xo().fromBinary(n,o)}static fromJson(n,o){return new xo().fromJson(n,o)}static fromJsonString(n,o){return new xo().fromJsonString(n,o)}static equals(n,o){return be.util.equals(xo,n,o)}};Z(xo,"runtime",be),Z(xo,"typeName","exa.language_server_pb.DocumentPosition"),Z(xo,"fields",be.util.newFieldList(()=>[{no:1,name:"row",kind:"scalar",T:4},{no:2,name:"col",kind:"scalar",T:4}]));let ei=xo;const bo=class bo extends St{constructor(n){super();Z(this,"absolutePath","");Z(this,"relativePath","");Z(this,"text","");Z(this,"editorLanguage","");Z(this,"language",Po.UNSPECIFIED);Z(this,"cursorOffset",pt.zero);Z(this,"cursorPosition");Z(this,"lineEnding","");be.util.initPartial(n,this)}static fromBinary(n,o){return new bo().fromBinary(n,o)}static fromJson(n,o){return new bo().fromJson(n,o)}static fromJsonString(n,o){return new bo().fromJsonString(n,o)}static equals(n,o){return be.util.equals(bo,n,o)}};Z(bo,"runtime",be),Z(bo,"typeName","exa.language_server_pb.Document"),Z(bo,"fields",be.util.newFieldList(()=>[{no:1,name:"absolute_path",kind:"scalar",T:9},{no:2,name:"relative_path",kind:"scalar",T:9},{no:3,name:"text",kind:"scalar",T:9},{no:4,name:"editor_language",kind:"scalar",T:9},{no:5,name:"language",kind:"enum",T:be.getEnumType(Po)},{no:6,name:"cursor_offset",kind:"scalar",T:4},{no:8,name:"cursor_position",kind:"message",T:ei},{no:7,name:"line_ending",kind:"scalar",T:9}]));let nl=bo;const yo=class yo extends St{constructor(n){super();Z(this,"forceEnableExperiments",[]);be.util.initPartial(n,this)}static fromBinary(n,o){return new yo().fromBinary(n,o)}static fromJson(n,o){return new yo().fromJson(n,o)}static fromJsonString(n,o){return new yo().fromJsonString(n,o)}static equals(n,o){return be.util.equals(yo,n,o)}};Z(yo,"runtime",be),Z(yo,"typeName","exa.language_server_pb.ExperimentConfig"),Z(yo,"fields",be.util.newFieldList(()=>[{no:1,name:"force_enable_experiments",kind:"enum",T:be.getEnumType(Ka),repeated:!0}]));let hu=yo;const vo=class vo extends St{constructor(n){super();Z(this,"state",Zs.UNSPECIFIED);Z(this,"message","");be.util.initPartial(n,this)}static fromBinary(n,o){return new vo().fromBinary(n,o)}static fromJson(n,o){return new vo().fromJson(n,o)}static fromJsonString(n,o){return new vo().fromJsonString(n,o)}static equals(n,o){return be.util.equals(vo,n,o)}};Z(vo,"runtime",be),Z(vo,"typeName","exa.language_server_pb.State"),Z(vo,"fields",be.util.newFieldList(()=>[{no:1,name:"state",kind:"enum",T:be.getEnumType(Zs)},{no:2,name:"message",kind:"scalar",T:9}]));let fu=vo;const wo=class wo extends St{constructor(n){super();Z(this,"startOffset",pt.zero);Z(this,"endOffset",pt.zero);Z(this,"startPosition");Z(this,"endPosition");be.util.initPartial(n,this)}static fromBinary(n,o){return new wo().fromBinary(n,o)}static fromJson(n,o){return new wo().fromJson(n,o)}static fromJsonString(n,o){return new wo().fromJsonString(n,o)}static equals(n,o){return be.util.equals(wo,n,o)}};Z(wo,"runtime",be),Z(wo,"typeName","exa.language_server_pb.Range"),Z(wo,"fields",be.util.newFieldList(()=>[{no:1,name:"start_offset",kind:"scalar",T:4},{no:2,name:"end_offset",kind:"scalar",T:4},{no:3,name:"start_position",kind:"message",T:ei},{no:4,name:"end_position",kind:"message",T:ei}]));let mu=wo;const ko=class ko extends St{constructor(n){super();Z(this,"text","");Z(this,"deltaCursorOffset",pt.zero);be.util.initPartial(n,this)}static fromBinary(n,o){return new ko().fromBinary(n,o)}static fromJson(n,o){return new ko().fromJson(n,o)}static fromJsonString(n,o){return new ko().fromJsonString(n,o)}static equals(n,o){return be.util.equals(ko,n,o)}};Z(ko,"runtime",be),Z(ko,"typeName","exa.language_server_pb.Suffix"),Z(ko,"fields",be.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"delta_cursor_offset",kind:"scalar",T:3}]));let pu=ko;const Co=class Co extends St{constructor(n){super();Z(this,"text","");Z(this,"offset",pt.zero);Z(this,"type",Qs.UNSPECIFIED);Z(this,"prefix","");Z(this,"line",pt.zero);be.util.initPartial(n,this)}static fromBinary(n,o){return new Co().fromBinary(n,o)}static fromJson(n,o){return new Co().fromJson(n,o)}static fromJsonString(n,o){return new Co().fromJsonString(n,o)}static equals(n,o){return be.util.equals(Co,n,o)}};Z(Co,"runtime",be),Z(Co,"typeName","exa.language_server_pb.CompletionPart"),Z(Co,"fields",be.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"offset",kind:"scalar",T:4},{no:3,name:"type",kind:"enum",T:be.getEnumType(Qs)},{no:4,name:"prefix",kind:"scalar",T:9},{no:5,name:"line",kind:"scalar",T:4}]));let gu=Co;const jo=class jo extends St{constructor(n){super();Z(this,"completion");Z(this,"suffix");Z(this,"range");Z(this,"source",Xs.UNSPECIFIED);Z(this,"completionParts",[]);be.util.initPartial(n,this)}static fromBinary(n,o){return new jo().fromBinary(n,o)}static fromJson(n,o){return new jo().fromJson(n,o)}static fromJsonString(n,o){return new jo().fromJsonString(n,o)}static equals(n,o){return be.util.equals(jo,n,o)}};Z(jo,"runtime",be),Z(jo,"typeName","exa.language_server_pb.CompletionItem"),Z(jo,"fields",be.util.newFieldList(()=>[{no:1,name:"completion",kind:"message",T:tu},{no:5,name:"suffix",kind:"message",T:pu},{no:2,name:"range",kind:"message",T:mu},{no:3,name:"source",kind:"enum",T:be.getEnumType(Xs)},{no:8,name:"completion_parts",kind:"message",T:gu,repeated:!0}]));let xu=jo;const e5={typeName:"exa.language_server_pb.LanguageServerService",methods:{getCompletions:{name:"GetCompletions",I:iu,O:au,kind:fn.Unary},acceptCompletion:{name:"AcceptCompletion",I:lu,O:cu,kind:fn.Unary},getAuthToken:{name:"GetAuthToken",I:du,O:uu,kind:fn.Unary}}};var ti=function(t){return this instanceof ti?(this.v=t,this):new ti(t)},t5=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},i("next"),i("throw"),i("return",function(h){return function(f){return Promise.resolve(f).then(h,c)}}),o[Symbol.asyncIterator]=function(){return this},o;function i(h,f){r[h]&&(o[h]=function(m){return new Promise(function(g,x){s.push([h,m,g,x])>1||a(h,m)})},f&&(o[h]=f(o[h])))}function a(h,f){try{(m=r[h](f)).value instanceof ti?Promise.resolve(m.value.v).then(l,c):d(s[0][2],m)}catch(g){d(s[0][3],g)}var m}function l(h){a("next",h)}function c(h){a("throw",h)}function d(h,f){h(f),s.shift(),s.length&&a(s[0][0],s[0][1])}};const n5=function(t){var e;(function(){try{new Headers}catch{throw new Error("connect-web requires the fetch API. Are you running on an old version of Node.js? Node.js is not supported in Connect for Web - please stay tuned for Connect for Node.")}})();const n=(e=t.useBinaryFormat)!==null&&e!==void 0&&e;return{async unary(o,r,s,i,a,l,c){var d;const{serialize:h,parse:f}=_0(r,n,t.jsonOptions,t.binaryOptions);return i=i===void 0?t.defaultTimeoutMs:i<=0?void 0:i,await function(m){const g=N0(m.next,m.interceptors),[x,p,b]=L0(m);return g(Object.assign(Object.assign({},m.req),{message:S0(m.req.method.I,m.req.message),signal:x})).then(y=>(b(),y),p)}({interceptors:t.interceptors,signal:s,timeoutMs:i,req:{stream:!1,service:o,method:r,url:j0(t.baseUrl,o,r),init:{method:"POST",credentials:(d=t.credentials)!==null&&d!==void 0?d:"same-origin",redirect:"error",mode:"cors"},header:R0(r.kind,n,i,a),contextValues:c??C0(),message:l},next:async m=>{var g;let x=null;t.useHttpGet===!0&&r.idempotency===eu.NoSideEffects?m=QE(m,h(m.message),n):x=h(m.message);const p=(g=t.fetch)!==null&&g!==void 0?g:globalThis.fetch,b=await p(m.url,Object.assign(Object.assign({},m.init),{headers:m.header,signal:m.signal,body:x})),{isUnaryError:y,unaryError:v}=P0(r.kind,n,b.status,b.headers);if(y)throw T0(await b.json(),function(...C){const N=new Headers;for(const S of C)S.forEach((E,T)=>{N.append(T,E)});return N}(...D0(b.headers)),v);const[w,j]=D0(b.headers);return{stream:!1,service:o,method:r,header:w,message:n?f(new Uint8Array(await b.arrayBuffer())):r.O.fromJson(await b.json(),E0(t.jsonOptions)),trailer:j}}})},async stream(o,r,s,i,a,l,c){var d;const{serialize:h,parse:f}=_0(r,n,t.jsonOptions,t.binaryOptions);function m(x,p,b,y){return t5(this,arguments,function*(){const v=function(j){let C,N=new Uint8Array(0);function S(E){const T=new Uint8Array(N.length+E.length);T.set(N),T.set(E,N.length),N=T}return new ReadableStream({start(){C=j.getReader()},async pull(E){let T;for(;;){if(T===void 0&&N.byteLength>=5){let F=0;for(let O=1;O<5;O++)F=(F<<8)+N[O];T={flags:N[0],length:F}}if(T!==void 0&&N.byteLength>=T.length+5)break;const D=await C.read();if(D.done)break;S(D.value)}if(T===void 0)return N.byteLength==0?void E.close():void E.error(new Nt("premature end of stream",mt.DataLoss));const I=N.subarray(5,5+T.length);N=N.subarray(5+T.length),E.enqueue({flags:T.flags,data:I})}})}(x).getReader();let w=!1;for(;;){const j=yield ti(v.read());if(j.done)break;const{flags:C,data:N}=j.value;if(!(1&~C))throw new Nt("protocol error: received unsupported compressed output",mt.Internal);if(!(2&~C)){w=!0;const S=KE(N);if(S.error){const E=S.error;throw b.forEach((T,I)=>{E.metadata.append(I,T)}),E}S.metadata.forEach((E,T)=>p.set(T,E));continue}yield yield ti(f(N))}if("throwIfAborted"in y&&y.throwIfAborted(),!w)throw"missing EndStreamResponse"})}async function g(x){if(r.kind!=fn.ServerStreaming)throw"The fetch API does not support streaming request bodies";const p=await x[Symbol.asyncIterator]().next();if(p.done==1)throw"missing request message";return function(b,y){const v=new Uint8Array(y.length+5);v.set(y,5);const w=new DataView(v.buffer,v.byteOffset,v.byteLength);return w.setUint8(0,b),w.setUint32(1,y.length),v}(0,h(p.value))}return i=i===void 0?t.defaultTimeoutMs:i<=0?void 0:i,await function(x){const p=N0(x.next,x.interceptors),[b,y,v]=L0(x),w=Object.assign(Object.assign({},x.req),{message:GE(x.req.method.I,x.req.message),signal:b});let j=!1;return b.addEventListener("abort",function(){var C,N;const S=x.req.message[Symbol.asyncIterator]();j||(C=S.throw)===null||C===void 0||C.call(S,this.reason).catch(()=>{}),(N=S.return)===null||N===void 0||N.call(S).catch(()=>{})}),p(w).then(C=>Object.assign(Object.assign({},C),{message:{[Symbol.asyncIterator](){const N=C.message[Symbol.asyncIterator]();return{next:()=>N.next().then(S=>(S.done==1&&(j=!0,v()),S),y)}}}}),y)}({interceptors:t.interceptors,timeoutMs:i,signal:s,req:{stream:!0,service:o,method:r,url:j0(t.baseUrl,o,r),init:{method:"POST",credentials:(d=t.credentials)!==null&&d!==void 0?d:"same-origin",redirect:"error",mode:"cors"},header:R0(r.kind,n,i,a),contextValues:c??C0(),message:l},next:async x=>{var p;const b=(p=t.fetch)!==null&&p!==void 0?p:globalThis.fetch,y=await b(x.url,Object.assign(Object.assign({},x.init),{headers:x.header,signal:x.signal,body:await g(x.message)}));if(P0(r.kind,n,y.status,y.headers),y.body===null)throw"missing response body";const v=new Headers;return Object.assign(Object.assign({},x),{header:y.headers,trailer:v,message:m(y.body,v,y.headers,x.signal)})}})}}}({baseUrl:"https://web-backend.codeium.com",useBinaryFormat:!0}),o5=function(t,e){return qE(t,e)}(e5,n5);let ol;try{ol=crypto.randomUUID()}catch{ol="10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^(crypto.getRandomValues(new Uint8Array(1))[0]??0)&15>>+t/4).toString(16))}async function r5(t,e){const n=t.state.facet(Za),{override:o}=t.state.facet(y0),r=await o(),s=t.state,i=s.selection.main.head,a=s.doc.toString();try{const l=await async function({text:g,cursorOffset:x,config:p,otherDocuments:b}){return await o5.getCompletions({metadata:{ideName:"web",ideVersion:"0.0.5",extensionName:"@valtown/codemirror-codeium",extensionVersion:"1.0.0",apiKey:p.apiKey,sessionId:ol,authSource:p.authSource},document:{text:g,cursorOffset:BigInt(x),language:p.language,editorLanguage:"typescript",lineEnding:`
|
|
105
105
|
`},editorOptions:{tabSize:2n,insertSpaces:!0},otherDocuments:b,multilineConfig:void 0},{headers:{Authorization:`Basic ${p.apiKey}-${ol}`}})}({text:a,cursorOffset:i,config:n,otherDocuments:r});if(!l||l.completionItems.length===0||e!==void 0&&i!==e||ys(t.state)==="active"||!t.hasFocus)return;const c=l.completionItems.map(g=>{let x=0;return g.completionParts.filter(p=>p.type!==3).map(p=>{const b=Number(p.offset),y=p.type===2?`
|
|
106
|
-
${p.text}`:p.text,v={absoluteStartPos:x+b,absoluteEndPos:x+b+y.length,from:b,to:b,insert:y};return x+=y.length,v})}),d=0,h=c.at(d);if(!h)return;const f=Ki.of(h,s.doc.length),m=f.invert(s.doc);t.dispatch({changes:f,effects:qd.of({index:d,reverseChangeSet:m,changeSpecs:c}),annotations:[Qa.of(null),Mr.of(null),Xi.addToHistory.of(!1)]})}catch(l){console.warn("copilot completion failed",l),await new Promise(c=>setTimeout(c,300))}}function s5(){let t=null,e=0;return We.updateListener.of(n=>{const o=n.view.state.facet(Za);if(!o.alwaysOn||!function(s){return s.docChanged&&!s.transactions.some(i=>i.effects.some(a=>a.is(Gd)||a.is(Yd)))}(n)||(t&&clearTimeout(t),function(s){if(!s.view.hasFocus||s.state.field(ir)||ys(s.state)==="active")return!0;for(const i of s.transactions)if(i.annotation(Mr)!==void 0)return!0}(n)))return;const r=n.state.selection.main.head;o.shouldComplete&&!o.shouldComplete(new OD(n.view.state,r,!1))||(t=setTimeout(async()=>{r===e&&await r5(n.view,e)},o.timeout),e=r)})}function F0(t){var r;const e=t.state.field(ir);if(!e)return!1;const n=(r=e.reverseChangeSet)==null?void 0:r.invert(t.state.doc);t.dispatch({changes:e.reverseChangeSet,effects:Gd.of(null),annotations:[Qa.of(null),Mr.of(null),Xi.addToHistory.of(!1)]});let o=0;return n==null||n.iterChangedRanges((s,i,a,l)=>{o=l}),t.dispatch({changes:n,selection:Qn.cursor(o),annotations:[Mr.of(null),Xi.addToHistory.of(!0)]}),!0}const z0=t=>{const{state:e}=t,n=e.field(ir);if(!n)return!1;const{changeSpecs:o}=n;if(o.length<2)return!1;const r=(n.index+1)%o.length,s=o.at(r);if(!s)return!1;const i=n.reverseChangeSet.apply(e.doc),a=Ki.of(n.reverseChangeSet,e.doc.length).compose(Ki.of(s,i.length)),l=Ki.of(s,i.length).invert(i);return t.dispatch({changes:a,effects:qd.of({index:r,reverseChangeSet:l,changeSpecs:o}),annotations:[Qa.of(null),Mr.of(null),Xi.addToHistory.of(!1)]}),!0};function bu(t){const e=t.state.field(ir);return!!e&&(t.dispatch({changes:e.reverseChangeSet,effects:Yd.of(null),annotations:[Qa.of(null),Mr.of(null),Xi.addToHistory.of(!1)]}),!1)}function i5(){return We.domEventHandlers({keydown:(t,e)=>(t.key!=="]"||!t.ctrlKey)&&t.key!=="Shift"&&t.key!=="Control"&&t.key!=="Alt"&&t.key!=="Meta"&&function(n,o){return!!n.state.field(ir)&&(o==="Tab"?F0(n):bu(n))}(e,t.key),mouseup(t,e){const n=t.target;return n.nodeName==="BUTTON"&&n.dataset.action==="codeium-cycle"?(z0(e),t.stopPropagation(),t.preventDefault(),!0):function(o){var a,l;let r=!1;const s=(a=o.state.selection.asSingle().ranges.at(0))==null?void 0:a.head,i=o.state.field(ir);return!(s===void 0||!i)&&((l=i.decorations)==null||l.between(s,s,()=>{r=!0}),r)}(e)?F0(e):bu(e)}})}const a5=new $m,yu=ut.get("@github/copilot-language-server"),B0={delay:300,includeKeymap:!0,events:{shouldShowSuggestion:t=>t.hasFocus,beforeSuggestionFetch:t=>t.hasFocus}},l5=t=>{const e=[];return t.copilot==="codeium"&&t.codeium_api_key&&e.push(function(n){return[Za.of(n),ir,To.highest(Mn.of([{key:"Ctrl-]",run:z0}])),To.highest(We.updateListener.of(o=>{o.focusChanged&&bu(o.view)})),To.high(i5()),s5()]}({apiKey:t.codeium_api_key,language:Po.PYTHON}),y0.of({override:async()=>[{text:Tc(""),language:Po.PYTHON,editorLanguage:"python"}]})),t.copilot==="github"&&e.push(z1({...B0,fetchFn:async(n,o,r)=>{const s=n.selection.main.head;if(!
|
|
106
|
+
${p.text}`:p.text,v={absoluteStartPos:x+b,absoluteEndPos:x+b+y.length,from:b,to:b,insert:y};return x+=y.length,v})}),d=0,h=c.at(d);if(!h)return;const f=Ki.of(h,s.doc.length),m=f.invert(s.doc);t.dispatch({changes:f,effects:qd.of({index:d,reverseChangeSet:m,changeSpecs:c}),annotations:[Qa.of(null),Mr.of(null),Xi.addToHistory.of(!1)]})}catch(l){console.warn("copilot completion failed",l),await new Promise(c=>setTimeout(c,300))}}function s5(){let t=null,e=0;return We.updateListener.of(n=>{const o=n.view.state.facet(Za);if(!o.alwaysOn||!function(s){return s.docChanged&&!s.transactions.some(i=>i.effects.some(a=>a.is(Gd)||a.is(Yd)))}(n)||(t&&clearTimeout(t),function(s){if(!s.view.hasFocus||s.state.field(ir)||ys(s.state)==="active")return!0;for(const i of s.transactions)if(i.annotation(Mr)!==void 0)return!0}(n)))return;const r=n.state.selection.main.head;o.shouldComplete&&!o.shouldComplete(new OD(n.view.state,r,!1))||(t=setTimeout(async()=>{r===e&&await r5(n.view,e)},o.timeout),e=r)})}function F0(t){var r;const e=t.state.field(ir);if(!e)return!1;const n=(r=e.reverseChangeSet)==null?void 0:r.invert(t.state.doc);t.dispatch({changes:e.reverseChangeSet,effects:Gd.of(null),annotations:[Qa.of(null),Mr.of(null),Xi.addToHistory.of(!1)]});let o=0;return n==null||n.iterChangedRanges((s,i,a,l)=>{o=l}),t.dispatch({changes:n,selection:Qn.cursor(o),annotations:[Mr.of(null),Xi.addToHistory.of(!0)]}),!0}const z0=t=>{const{state:e}=t,n=e.field(ir);if(!n)return!1;const{changeSpecs:o}=n;if(o.length<2)return!1;const r=(n.index+1)%o.length,s=o.at(r);if(!s)return!1;const i=n.reverseChangeSet.apply(e.doc),a=Ki.of(n.reverseChangeSet,e.doc.length).compose(Ki.of(s,i.length)),l=Ki.of(s,i.length).invert(i);return t.dispatch({changes:a,effects:qd.of({index:r,reverseChangeSet:l,changeSpecs:o}),annotations:[Qa.of(null),Mr.of(null),Xi.addToHistory.of(!1)]}),!0};function bu(t){const e=t.state.field(ir);return!!e&&(t.dispatch({changes:e.reverseChangeSet,effects:Yd.of(null),annotations:[Qa.of(null),Mr.of(null),Xi.addToHistory.of(!1)]}),!1)}function i5(){return We.domEventHandlers({keydown:(t,e)=>(t.key!=="]"||!t.ctrlKey)&&t.key!=="Shift"&&t.key!=="Control"&&t.key!=="Alt"&&t.key!=="Meta"&&function(n,o){return!!n.state.field(ir)&&(o==="Tab"?F0(n):bu(n))}(e,t.key),mouseup(t,e){const n=t.target;return n.nodeName==="BUTTON"&&n.dataset.action==="codeium-cycle"?(z0(e),t.stopPropagation(),t.preventDefault(),!0):function(o){var a,l;let r=!1;const s=(a=o.state.selection.asSingle().ranges.at(0))==null?void 0:a.head,i=o.state.field(ir);return!(s===void 0||!i)&&((l=i.decorations)==null||l.between(s,s,()=>{r=!0}),r)}(e)?F0(e):bu(e)}})}const a5=new $m,yu=ut.get("@github/copilot-language-server"),B0={delay:300,includeKeymap:!0,events:{shouldShowSuggestion:t=>t.hasFocus,beforeSuggestionFetch:t=>t.hasFocus}},l5=t=>{const e=[];return t.copilot==="codeium"&&t.codeium_api_key&&e.push(function(n){return[Za.of(n),ir,To.highest(Mn.of([{key:"Ctrl-]",run:z0}])),To.highest(We.updateListener.of(o=>{o.focusChanged&&bu(o.view)})),To.high(i5()),s5()]}({apiKey:t.codeium_api_key,language:Po.PYTHON}),y0.of({override:async()=>[{text:Tc(""),language:Po.PYTHON,editorLanguage:"python"}]})),t.copilot==="github"&&e.push(z1({...B0,fetchFn:async(n,o,r)=>{const s=n.selection.main.head;if(!yF()||!r.hasFocus||n.doc.length===0)return"";await new Promise(d=>setTimeout(d,20));const i=n.doc.toString(),a=function(d,h){const f=d.doc.toString(),m=h.split(`
|
|
107
107
|
`).length-f.split(`
|
|
108
|
-
`).length,g=function(x,p){const b=x.lineAt(p);return{line:b.number-1,character:p-b.from}}(d.doc,d.selection.main.head);return g.line+=m,{textDocument:{uri:`file://${
|
|
108
|
+
`).length,g=function(x,p){const b=x.lineAt(p);return{line:b.number-1,character:p-b.from}}(d.doc,d.selection.main.head);return g.line+=m,{textDocument:{uri:`file://${vF}`,version:"replace_me"},position:g,context:{triggerKind:RD.InlineCompletionTriggerKind.Automatic},formattingOptions:{tabSize:d.tabSize,insertSpaces:!0}}}(n,Tc(i)),l=await pj().getCompletion(a);return s!==r.state.selection.main.head?(ut.debug("ignoring response because of new position"),""):function(d,h,f){if(!d)return yu.debug("No response from copilot"),"";const m=Array.isArray(d)?d[0]:d.items[0];if(!m)return yu.debug("No response from copilot"),"";const{insertText:g,range:x}=m,p=String(g);if(!x)return yu.error("No range from copilot"),p;const b=x.start.character-h.character,y=b<0?p.slice(-b):p,v=f.doc.sliceString(f.selection.main.head,f.doc.length);for(let w=0;w<y.length;w++){const j=y.slice(w);if(v.startsWith(j))return y.slice(0,w)}return y}(l,a.position,n)}})),t.copilot==="custom"&&e.push(z1({...B0,fetchFn:async(n,o,r)=>{const s=n.selection.main.head;if(n.doc.length===0||!r.hasFocus)return"";const i=n.doc.sliceString(0,n.selection.main.head),a=n.doc.sliceString(n.selection.main.head,n.doc.length);if(i.length===0)return"";const l=n.field(Mc).type;let c=await DD.post("/ai/inline_completion",{prefix:i,suffix:a,language:l});return s!==r.state.selection.main.head?(ut.debug("ignoring response because of new position"),""):(c=function({response:d,prefix:h,suffix:f}){if(!d)return d;let m=d;return h&&m.startsWith(h)&&(m=m.slice(h.length)),f&&m.endsWith(f)&&(m=m.slice(0,-f.length)),m}({response:c,prefix:i,suffix:a}),c)}})),[...e,To.highest(Mn.of([{key:"Escape",run:n=>{const o=F1(n);return!Ic(n)&&o}}])),a5.of(bF())]};function c5(t){return[Mn.of([{key:"Escape",preventDefault:!1,run:n4},{key:t.getHotkey("cell.selectNextOccurrence").key,preventDefault:!0,run:LD},{key:t.getHotkey("cell.findAndReplace").key,preventDefault:!0,run:$g}]),PD(),l4,Ca,c4]}const d5=ot.mark({class:"underline"}),U0=Tt.define(),$0=Tt.define(),V0=Tt.define(),u5=vn.define({create:()=>ot.none,update(t,e){let n=t.map(e.changes);for(const o of e.effects)o.is(U0)?n=t.update({add:[d5.range(o.value.from,o.value.to)]}):o.is($0)?n=t.update({add:[FD.range(o.value.from,o.value.to)]}):o.is(V0)&&(n=ot.none);return n},provide:t=>We.decorations.from(t)});class h5{constructor(e,n){this.view=void 0,this.commandClickMode=void 0,this.hoveredRange=void 0,this.onClick=void 0,this.keydown=o=>{o.key!=="Meta"&&o.key!=="Control"||(this.commandClickMode=!0,this.view.dom.addEventListener("mousemove",this.mousemove),this.view.dom.addEventListener("click",this.click))},this.keyup=o=>{o.key!=="Meta"&&o.key!=="Control"||this.exitCommandClickMode()},this.windowBlur=()=>{this.commandClickMode&&this.exitCommandClickMode()},this.mousemove=o=>{if(!o.metaKey&&!o.ctrlKey)return void this.exitCommandClickMode();if(!this.commandClickMode)return void this.clearUnderline();const r=this.view.posAtCoords({x:o.clientX,y:o.clientY});if(r==null)return void this.clearUnderline();const s=this.view.state.field(zD,!1),i=s==null?void 0:s.ranges.find(l=>r>=l.from&&r<=l.to);if(i){const{from:l,to:c}=i;return this.hoveredRange&&this.hoveredRange.from===l&&this.hoveredRange.to===c?void 0:(this.clearUnderline(),this.hoveredRange={from:l,to:c,position:r},void this.view.dispatch({effects:$0.of(this.hoveredRange)}))}const a=BD(this.view.state).cursorAt(r);if(a.name==="VariableName"){const{from:l,to:c}=a;if(this.hoveredRange&&this.hoveredRange.from===l&&this.hoveredRange.to===c)return;this.clearUnderline(),this.hoveredRange={from:l,to:c,position:r},this.view.dispatch({effects:U0.of(this.hoveredRange)})}else this.clearUnderline()},this.click=o=>{if(this.hoveredRange){const r=this.view.state.doc.sliceString(this.hoveredRange.from,this.hoveredRange.to);o.preventDefault(),o.stopPropagation(),this.onClick(this.view,r),this.view.dispatch({selection:{head:this.hoveredRange.position,anchor:this.hoveredRange.position}})}},this.view=e,this.commandClickMode=!1,this.hoveredRange=null,this.onClick=n,window.addEventListener("keydown",this.keydown),window.addEventListener("keyup",this.keyup),window.addEventListener("blur",this.windowBlur),window.addEventListener("mouseleave",this.windowBlur)}update(e){}destroy(){window.removeEventListener("keydown",this.keydown),window.removeEventListener("keyup",this.keyup),window.removeEventListener("blur",this.windowBlur),window.removeEventListener("mouseleave",this.windowBlur),this.view.dom.removeEventListener("mousemove",this.mousemove),this.view.dom.removeEventListener("click",this.click)}exitCommandClickMode(){this.commandClickMode=!1,this.view.dom.removeEventListener("mousemove",this.mousemove),this.view.dom.removeEventListener("click",this.click),this.clearUnderline()}clearUnderline(){this.hoveredRange&&(this.view.dispatch({effects:V0.of(null)}),this.hoveredRange=null)}}function f5(){return[We.domEventHandlers({paste:(t,e)=>{var r;const n=(r=t.clipboardData)==null?void 0:r.getData("text/plain");if(!(n!=null&&n.includes("@app.cell")))return!1;const o=function(s){if(!s.includes("@app.cell"))return[];const i=[],a=s.split(`
|
|
109
109
|
`);let l=[],c=!1,d=0,h=!1,f=!1,m=0;const g=/\(/g,x=/\)/g,p=new Set(["@"]);function b(v){return(v.match(g)||[]).length-(v.match(x)||[]).length}function y(){if(l.length!==0){for(;l.length>0&&l[l.length-1].trim().startsWith("return");)l.pop();l.some(v=>v.trim()!=="")&&i.push(function(v){const w=v.split(`
|
|
110
110
|
`);if(w.length===0)return"";const j=w.filter(S=>S.trim().length>0);if(j.length===0)return"";const C=/^\s*/,N=Math.min(...j.map(S=>{var E;return((E=S.match(C))==null?void 0:E[0].length)??Number.POSITIVE_INFINITY}));return N===0?v.trim():w.map(S=>S.slice(N)).join(`
|
|
111
111
|
`).trim()}(l.join(`
|
|
112
|
-
`))),l=[]}}for(const v of a){const w=v.trim();(w||c)&&(w.startsWith("@app.cell")?(y(),c=!0,d=1):d>0?(w.startsWith("def")&&w.includes("(")&&!w.includes("):")&&(h=!0,m=b(w)),d--):h?(m+=b(w),m===0&&(h=!1)):c&&(p.has(w[0])||w.startsWith("if __name__")?(y(),c=w.startsWith("@")):w.startsWith("return")?w.includes("(")&&!w.endsWith(")")&&(f=!0,m=b(w)):f?(m+=b(w),m===0&&(f=!1)):l.push(v)))}return y(),i}(n);return o.length===0?!1:(e.state.facet(HD).createManyBelow(o),!0)}})]}const Pt=({variant:t,settings:e,styles:n})=>{const o=We.theme({"&":{backgroundColor:e.background,color:e.foreground},".cm-content":{caretColor:e.caret},".cm-cursor, .cm-dropCursor":{borderLeftColor:e.caret},"&.cm-focused .cm-selectionBackgroundm .cm-selectionBackground, .cm-content ::selection":{backgroundColor:e.selection},".cm-activeLine":{backgroundColor:e.lineHighlight},".cm-gutters":{backgroundColor:e.gutterBackground,color:e.gutterForeground},".cm-activeLineGutter":{backgroundColor:e.lineHighlight}},{dark:t==="dark"}),r=WD.define(n);return[o,lC(r)]};Pt({variant:"dark",settings:{background:"#200020",foreground:"#D0D0FF",caret:"#7070FF",selection:"#80000080",gutterBackground:"#200020",gutterForeground:"#C080C0",lineHighlight:"#80000040"},styles:[{tag:L.comment,color:"#404080"},{tag:[L.string,L.regexp],color:"#999999"},{tag:L.number,color:"#7090B0"},{tag:[L.bool,L.null],color:"#8080A0"},{tag:[L.punctuation,L.derefOperator],color:"#805080"},{tag:L.keyword,color:"#60B0FF"},{tag:L.definitionKeyword,color:"#B0FFF0"},{tag:L.moduleKeyword,color:"#60B0FF"},{tag:L.operator,color:"#A0A0FF"},{tag:[L.variableName,L.self],color:"#008080"},{tag:L.operatorKeyword,color:"#A0A0FF"},{tag:L.controlKeyword,color:"#80A0FF"},{tag:L.className,color:"#70E080"},{tag:[L.function(L.propertyName),L.propertyName],color:"#50A0A0"},{tag:L.tagName,color:"#009090"},{tag:L.modifier,color:"#B0FFF0"},{tag:[L.squareBracket,L.attributeName],color:"#D0D0FF"}]}),Pt({variant:"light",settings:{background:"#fcfcfc",foreground:"#5c6166",caret:"#ffaa33",selection:"#036dd626",gutterBackground:"#fcfcfc",gutterForeground:"#8a919966",lineHighlight:"#8a91991a"},styles:[{tag:L.comment,color:"#787b8099"},{tag:L.string,color:"#86b300"},{tag:L.regexp,color:"#4cbf99"},{tag:[L.number,L.bool,L.null],color:"#ffaa33"},{tag:L.variableName,color:"#5c6166"},{tag:[L.definitionKeyword,L.modifier],color:"#fa8d3e"},{tag:[L.keyword,L.special(L.brace)],color:"#fa8d3e"},{tag:L.operator,color:"#ed9366"},{tag:L.separator,color:"#5c6166b3"},{tag:L.punctuation,color:"#5c6166"},{tag:[L.definition(L.propertyName),L.function(L.variableName)],color:"#f2ae49"},{tag:[L.className,L.definition(L.typeName)],color:"#22a4e6"},{tag:[L.tagName,L.typeName,L.self,L.labelName],color:"#55b4d4"},{tag:L.angleBracket,color:"#55b4d480"},{tag:L.attributeName,color:"#f2ae49"}]}),Pt({variant:"dark",settings:{background:"#15191EFA",foreground:"#EEF2F7",caret:"#C4C4C4",selection:"#90B2D557",gutterBackground:"#15191EFA",gutterForeground:"#aaaaaa95",lineHighlight:"#57575712"},styles:[{tag:L.comment,color:"#6E6E6E"},{tag:[L.string,L.regexp,L.special(L.brace)],color:"#5C81B3"},{tag:L.number,color:"#C1E1B8"},{tag:L.bool,color:"#53667D"},{tag:[L.definitionKeyword,L.modifier,L.function(L.propertyName)],color:"#A3D295",fontWeight:"bold"},{tag:[L.keyword,L.moduleKeyword,L.operatorKeyword,L.operator],color:"#697A8E",fontWeight:"bold"},{tag:[L.variableName,L.attributeName],color:"#708E67"},{tag:[L.function(L.variableName),L.definition(L.propertyName),L.derefOperator],color:"#fff"},{tag:L.tagName,color:"#A3D295"}]}),Pt({variant:"dark",settings:{background:"#2e241d",foreground:"#BAAE9E",caret:"#A7A7A7",selection:"#DDF0FF33",gutterBackground:"#28211C",gutterForeground:"#BAAE9E90",lineHighlight:"#FFFFFF08"},styles:[{tag:L.comment,color:"#666666"},{tag:[L.string,L.special(L.brace)],color:"#54BE0D"},{tag:L.regexp,color:"#E9C062"},{tag:L.number,color:"#CF6A4C"},{tag:[L.keyword,L.operator],color:"#5EA6EA"},{tag:L.variableName,color:"#7587A6"},{tag:[L.definitionKeyword,L.modifier],color:"#F9EE98"},{tag:[L.propertyName,L.function(L.variableName)],color:"#937121"},{tag:[L.typeName,L.angleBracket,L.tagName],color:"#9B859D"}]}),Pt({variant:"dark",settings:{background:"#3b2627",foreground:"#E6E1C4",caret:"#E6E1C4",selection:"#16120E",gutterBackground:"#3b2627",gutterForeground:"#E6E1C490",lineHighlight:"#1F1611"},styles:[{tag:L.comment,color:"#6B4E32"},{tag:[L.keyword,L.operator,L.derefOperator],color:"#EF5D32"},{tag:L.className,color:"#EFAC32",fontWeight:"bold"},{tag:[L.typeName,L.propertyName,L.function(L.variableName),L.definition(L.variableName)],color:"#EFAC32"},{tag:L.definition(L.typeName),color:"#EFAC32",fontWeight:"bold"},{tag:L.labelName,color:"#EFAC32",fontWeight:"bold"},{tag:[L.number,L.bool],color:"#6C99BB"},{tag:[L.variableName,L.self],color:"#7DAF9C"},{tag:[L.string,L.special(L.brace),L.regexp],color:"#D9D762"},{tag:[L.angleBracket,L.tagName,L.attributeName],color:"#EFCB43"}]}),Pt({variant:"dark",settings:{background:"#000205",foreground:"#FFFFFF",caret:"#E60065",selection:"#E60C6559",gutterBackground:"#000205",gutterForeground:"#ffffff90",lineHighlight:"#4DD7FC1A"},styles:[{tag:L.comment,color:"#404040"},{tag:[L.string,L.special(L.brace),L.regexp],color:"#00D8FF"},{tag:L.number,color:"#E62286"},{tag:[L.variableName,L.attributeName,L.self],color:"#E62286",fontWeight:"bold"},{tag:L.function(L.variableName),color:"#fff",fontWeight:"bold"}]}),Pt({variant:"light",settings:{background:"#fff",foreground:"#000",caret:"#000",selection:"#BDD5FC",gutterBackground:"#fff",gutterForeground:"#00000070",lineHighlight:"#FFFBD1"},styles:[{tag:L.comment,color:"#BCC8BA"},{tag:[L.string,L.special(L.brace),L.regexp],color:"#5D90CD"},{tag:[L.number,L.bool,L.null],color:"#46A609"},{tag:L.keyword,color:"#AF956F"},{tag:[L.definitionKeyword,L.modifier],color:"#C52727"},{tag:[L.angleBracket,L.tagName,L.attributeName],color:"#606060"},{tag:L.self,color:"#000"}]}),Pt({variant:"dark",settings:{background:"#00254b",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#B36539BF",gutterBackground:"#00254b",gutterForeground:"#FFFFFF70",lineHighlight:"#00000059"},styles:[{tag:L.comment,color:"#0088FF"},{tag:L.string,color:"#3AD900"},{tag:L.regexp,color:"#80FFC2"},{tag:[L.number,L.bool,L.null],color:"#FF628C"},{tag:[L.definitionKeyword,L.modifier],color:"#FFEE80"},{tag:L.variableName,color:"#CCCCCC"},{tag:L.self,color:"#FF80E1"},{tag:[L.className,L.definition(L.propertyName),L.function(L.variableName),L.definition(L.typeName),L.labelName],color:"#FFDD00"},{tag:[L.keyword,L.operator],color:"#FF9D00"},{tag:[L.propertyName,L.typeName],color:"#80FFBB"},{tag:L.special(L.brace),color:"#EDEF7D"},{tag:L.attributeName,color:"#9EFFFF"},{tag:L.derefOperator,color:"#fff"}]}),Pt({variant:"dark",settings:{background:"#060521",foreground:"#E0E0E0",caret:"#FFFFFFA6",selection:"#122BBB",gutterBackground:"#060521",gutterForeground:"#E0E0E090",lineHighlight:"#FFFFFF0F"},styles:[{tag:L.comment,color:"#AEAEAE"},{tag:[L.string,L.special(L.brace),L.regexp],color:"#8DFF8E"},{tag:[L.className,L.definition(L.propertyName),L.function(L.variableName),L.function(L.definition(L.variableName)),L.definition(L.typeName)],color:"#A3EBFF"},{tag:[L.number,L.bool,L.null],color:"#62E9BD"},{tag:[L.keyword,L.operator],color:"#2BF1DC"},{tag:[L.definitionKeyword,L.modifier],color:"#F8FBB1"},{tag:[L.variableName,L.self],color:"#B683CA"},{tag:[L.angleBracket,L.tagName,L.typeName,L.propertyName],color:"#60A4F1"},{tag:L.derefOperator,color:"#E0E0E0"},{tag:L.attributeName,color:"#7BACCA"}]}),Pt({variant:"dark",settings:{background:"#2d2f3f",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"#44475a",gutterBackground:"#282a36",gutterForeground:"rgb(144, 145, 148)",lineHighlight:"#44475a"},styles:[{tag:L.comment,color:"#6272a4"},{tag:[L.string,L.special(L.brace)],color:"#f1fa8c"},{tag:[L.number,L.self,L.bool,L.null],color:"#bd93f9"},{tag:[L.keyword,L.operator],color:"#ff79c6"},{tag:[L.definitionKeyword,L.typeName],color:"#8be9fd"},{tag:L.definition(L.typeName),color:"#f8f8f2"},{tag:[L.className,L.definition(L.propertyName),L.function(L.variableName),L.attributeName],color:"#50fa7b"}]}),Pt({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#80C7FF",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#C1E2F8"},styles:[{tag:L.comment,color:"#AAAAAA"},{tag:[L.keyword,L.operator,L.typeName,L.tagName,L.propertyName],color:"#2F6F9F",fontWeight:"bold"},{tag:[L.attributeName,L.definition(L.propertyName)],color:"#4F9FD0"},{tag:[L.className,L.string,L.special(L.brace)],color:"#CF4F5F"},{tag:L.number,color:"#CF4F5F",fontWeight:"bold"},{tag:L.variableName,fontWeight:"bold"}]}),Pt({variant:"light",settings:{background:"#f2f1f8",foreground:"#0c006b",caret:"#5c49e9",selection:"#d5d1f2",gutterBackground:"#f2f1f8",gutterForeground:"#0c006b70",lineHighlight:"#e1def3"},styles:[{tag:L.comment,color:"#9995b7"},{tag:L.keyword,color:"#ff5792",fontWeight:"bold"},{tag:[L.definitionKeyword,L.modifier],color:"#ff5792"},{tag:[L.className,L.tagName,L.definition(L.typeName)],color:"#0094f0"},{tag:[L.number,L.bool,L.null,L.special(L.brace)],color:"#5842ff"},{tag:[L.definition(L.propertyName),L.function(L.variableName)],color:"#0095a8"},{tag:L.typeName,color:"#b3694d"},{tag:[L.propertyName,L.variableName],color:"#fa8900"},{tag:L.operator,color:"#ff5792"},{tag:L.self,color:"#e64100"},{tag:[L.string,L.regexp],color:"#00b368"},{tag:[L.paren,L.bracket],color:"#0431fa"},{tag:L.labelName,color:"#00bdd6"},{tag:L.attributeName,color:"#e64100"},{tag:L.angleBracket,color:"#9995b7"}]}),Pt({variant:"light",settings:{background:"#faf4ed",foreground:"#575279",caret:"#575279",selection:"#6e6a8614",gutterBackground:"#faf4ed",gutterForeground:"#57527970",lineHighlight:"#6e6a860d"},styles:[{tag:L.comment,color:"#9893a5"},{tag:[L.bool,L.null],color:"#286983"},{tag:L.number,color:"#d7827e"},{tag:L.className,color:"#d7827e"},{tag:[L.angleBracket,L.tagName,L.typeName],color:"#56949f"},{tag:L.attributeName,color:"#907aa9"},{tag:L.punctuation,color:"#797593"},{tag:[L.keyword,L.modifier],color:"#286983"},{tag:[L.string,L.regexp],color:"#ea9d34"},{tag:L.variableName,color:"#d7827e"}]}),Pt({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#FFFD0054",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#00000008"},styles:[{tag:L.comment,color:"#CFCFCF"},{tag:[L.number,L.bool,L.null],color:"#E66C29"},{tag:[L.className,L.definition(L.propertyName),L.function(L.variableName),L.labelName,L.definition(L.typeName)],color:"#2EB43B"},{tag:L.keyword,color:"#D8B229"},{tag:L.operator,color:"#4EA44E",fontWeight:"bold"},{tag:[L.definitionKeyword,L.modifier],color:"#925A47"},{tag:L.string,color:"#704D3D"},{tag:L.typeName,color:"#2F8996"},{tag:[L.variableName,L.propertyName],color:"#77ACB0"},{tag:L.self,color:"#77ACB0",fontWeight:"bold"},{tag:L.regexp,color:"#E3965E"},{tag:[L.tagName,L.angleBracket],color:"#BAA827"},{tag:L.attributeName,color:"#B06520"},{tag:L.derefOperator,color:"#000"}]}),Pt({variant:"light",settings:{background:"#fef7e5",foreground:"#586E75",caret:"#000000",selection:"#073642",gutterBackground:"#fef7e5",gutterForeground:"#586E7580",lineHighlight:"#EEE8D5"},styles:[{tag:L.comment,color:"#93A1A1"},{tag:L.string,color:"#2AA198"},{tag:L.regexp,color:"#D30102"},{tag:L.number,color:"#D33682"},{tag:L.variableName,color:"#268BD2"},{tag:[L.keyword,L.operator,L.punctuation],color:"#859900"},{tag:[L.definitionKeyword,L.modifier],color:"#073642",fontWeight:"bold"},{tag:[L.className,L.self,L.definition(L.propertyName)],color:"#268BD2"},{tag:L.function(L.variableName),color:"#268BD2"},{tag:[L.bool,L.null],color:"#B58900"},{tag:L.tagName,color:"#268BD2",fontWeight:"bold"},{tag:L.angleBracket,color:"#93A1A1"},{tag:L.attributeName,color:"#93A1A1"},{tag:L.typeName,color:"#859900"}]}),Pt({variant:"light",settings:{background:"#FFFFFF",foreground:"#4D4D4C",caret:"#AEAFAD",selection:"#D6D6D6",gutterBackground:"#FFFFFF",gutterForeground:"#4D4D4C80",lineHighlight:"#EFEFEF"},styles:[{tag:L.comment,color:"#8E908C"},{tag:[L.variableName,L.self,L.propertyName,L.attributeName,L.regexp],color:"#C82829"},{tag:[L.number,L.bool,L.null],color:"#F5871F"},{tag:[L.className,L.typeName,L.definition(L.typeName)],color:"#C99E00"},{tag:[L.string,L.special(L.brace)],color:"#718C00"},{tag:L.operator,color:"#3E999F"},{tag:[L.definition(L.propertyName),L.function(L.variableName)],color:"#4271AE"},{tag:L.keyword,color:"#8959A8"},{tag:L.derefOperator,color:"#4D4D4C"}]});const m5=[Pt({variant:"dark",settings:{background:"#282c34",foreground:"#abb2bf",caret:"#528bff",selection:"#3E4451",lineHighlight:"#2c313c",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:L.comment,color:"#5c6370"},{tag:L.variableName,color:"#abb2bf"},{tag:[L.string,L.special(L.brace)],color:"#98c379"},{tag:L.number,color:"#d19a66"},{tag:L.bool,color:"#d19a66"},{tag:L.null,color:"#d19a66"},{tag:L.keyword,color:"#c678dd",fontWeight:500},{tag:L.className,color:"#61afef"},{tag:L.definition(L.typeName),color:"#61afef"},{tag:L.typeName,color:"#56b6c2"},{tag:L.angleBracket,color:"#abb2bf"},{tag:L.tagName,color:"#e06c75"},{tag:L.attributeName,color:"#d19a66"},{tag:L.operator,color:"#56b6c2",fontWeight:500},{tag:[L.function(L.variableName)],color:"#61afef"},{tag:[L.propertyName],color:"#e5c07b"}]}),We.theme({".mo-cm-reactive-reference":{fontWeight:"400",color:"#2a7aa5",borderBottom:"2px solid #bad3de"},".mo-cm-reactive-reference-hover":{cursor:"pointer",borderBottomWidth:"3px",borderBottomColor:"#4a90a5"}})],p5=[Pt({variant:"light",settings:{background:"#ffffff",foreground:"#000000",caret:"#000000",selection:"#d7d4f0",lineHighlight:"#cceeff44",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:L.comment,color:"#708090"},{tag:L.variableName,color:"#000000"},{tag:[L.string,L.special(L.brace)],color:"#a11"},{tag:L.number,color:"#164"},{tag:L.bool,color:"#219"},{tag:L.null,color:"#219"},{tag:L.keyword,color:"#708",fontWeight:500},{tag:L.className,color:"#00f"},{tag:L.definition(L.typeName),color:"#00f"},{tag:L.typeName,color:"#085"},{tag:L.angleBracket,color:"#000000"},{tag:L.tagName,color:"#170"},{tag:L.attributeName,color:"#00c"},{tag:L.operator,color:"#a2f",fontWeight:500},{tag:[L.function(L.variableName)],color:"#00c"},{tag:[L.propertyName],color:"#05a"}]}),We.theme({".mo-cm-reactive-reference":{fontWeight:"400",color:"#005f87",borderBottom:"2px solid #bad3de"},".mo-cm-reactive-reference-hover":{cursor:"pointer",borderBottomWidth:"3px"}})];function H0(t){const{showPlaceholder:e,enableAI:n}=t;return e?"marimo-import":n?"ai":"none"}const g5=t=>{const{cellId:e,keymapConfig:n,hotkeys:o,enableAI:r,cellActions:s,completionConfig:i,lspConfig:a,diagnosticsConfig:l,displayConfig:c}=t,d=H0(t);return[vF(n,o),[We.domEventHandlers({drop:(f,m)=>{var p,b;const g=(p=f.dataTransfer)==null?void 0:p.files[0];if(g!=null&&g.type.startsWith("text/"))return f.preventDefault(),$D(m,g),!0;if(g!=null&&g.type.startsWith("image/"))return f.preventDefault(),VD(m,g),!0;const x=(b=f.dataTransfer)==null?void 0:b.getData("text/plain");if(x){f.preventDefault();const y=m.posAtCoords({x:f.clientX,y:f.clientY});return y!==null&&m.dispatch({changes:{from:y,to:y,insert:x},scrollIntoView:!0}),!0}return!1},dragover:f=>{f.preventDefault()}})],f5(),hE(),qD({completionConfig:i,hotkeys:o,placeholderType:d,lspConfig:a,diagnosticsConfig:l}),GD({cellId:e,hotkeys:o,cellActions:s}),x5(t),[u5,(h=(f,m)=>{UD(f,m)},$n.define(f=>new h5(f,h))),We.baseTheme({".underline":{textDecoration:"underline",cursor:"pointer",color:"var(--link)"}})],l!=null&&l.enabled?YD():[],r&&jm("inline_ai_tooltip")?[iE({prompt:f=>async function(m){var w,j;const g=`
|
|
112
|
+
`))),l=[]}}for(const v of a){const w=v.trim();(w||c)&&(w.startsWith("@app.cell")?(y(),c=!0,d=1):d>0?(w.startsWith("def")&&w.includes("(")&&!w.includes("):")&&(h=!0,m=b(w)),d--):h?(m+=b(w),m===0&&(h=!1)):c&&(p.has(w[0])||w.startsWith("if __name__")?(y(),c=w.startsWith("@")):w.startsWith("return")?w.includes("(")&&!w.endsWith(")")&&(f=!0,m=b(w)):f?(m+=b(w),m===0&&(f=!1)):l.push(v)))}return y(),i}(n);return o.length===0?!1:(e.state.facet(HD).createManyBelow(o),!0)}})]}const Pt=({variant:t,settings:e,styles:n})=>{const o=We.theme({"&":{backgroundColor:e.background,color:e.foreground},".cm-content":{caretColor:e.caret},".cm-cursor, .cm-dropCursor":{borderLeftColor:e.caret},"&.cm-focused .cm-selectionBackgroundm .cm-selectionBackground, .cm-content ::selection":{backgroundColor:e.selection},".cm-activeLine":{backgroundColor:e.lineHighlight},".cm-gutters":{backgroundColor:e.gutterBackground,color:e.gutterForeground},".cm-activeLineGutter":{backgroundColor:e.lineHighlight}},{dark:t==="dark"}),r=WD.define(n);return[o,lC(r)]};Pt({variant:"dark",settings:{background:"#200020",foreground:"#D0D0FF",caret:"#7070FF",selection:"#80000080",gutterBackground:"#200020",gutterForeground:"#C080C0",lineHighlight:"#80000040"},styles:[{tag:L.comment,color:"#404080"},{tag:[L.string,L.regexp],color:"#999999"},{tag:L.number,color:"#7090B0"},{tag:[L.bool,L.null],color:"#8080A0"},{tag:[L.punctuation,L.derefOperator],color:"#805080"},{tag:L.keyword,color:"#60B0FF"},{tag:L.definitionKeyword,color:"#B0FFF0"},{tag:L.moduleKeyword,color:"#60B0FF"},{tag:L.operator,color:"#A0A0FF"},{tag:[L.variableName,L.self],color:"#008080"},{tag:L.operatorKeyword,color:"#A0A0FF"},{tag:L.controlKeyword,color:"#80A0FF"},{tag:L.className,color:"#70E080"},{tag:[L.function(L.propertyName),L.propertyName],color:"#50A0A0"},{tag:L.tagName,color:"#009090"},{tag:L.modifier,color:"#B0FFF0"},{tag:[L.squareBracket,L.attributeName],color:"#D0D0FF"}]}),Pt({variant:"light",settings:{background:"#fcfcfc",foreground:"#5c6166",caret:"#ffaa33",selection:"#036dd626",gutterBackground:"#fcfcfc",gutterForeground:"#8a919966",lineHighlight:"#8a91991a"},styles:[{tag:L.comment,color:"#787b8099"},{tag:L.string,color:"#86b300"},{tag:L.regexp,color:"#4cbf99"},{tag:[L.number,L.bool,L.null],color:"#ffaa33"},{tag:L.variableName,color:"#5c6166"},{tag:[L.definitionKeyword,L.modifier],color:"#fa8d3e"},{tag:[L.keyword,L.special(L.brace)],color:"#fa8d3e"},{tag:L.operator,color:"#ed9366"},{tag:L.separator,color:"#5c6166b3"},{tag:L.punctuation,color:"#5c6166"},{tag:[L.definition(L.propertyName),L.function(L.variableName)],color:"#f2ae49"},{tag:[L.className,L.definition(L.typeName)],color:"#22a4e6"},{tag:[L.tagName,L.typeName,L.self,L.labelName],color:"#55b4d4"},{tag:L.angleBracket,color:"#55b4d480"},{tag:L.attributeName,color:"#f2ae49"}]}),Pt({variant:"dark",settings:{background:"#15191EFA",foreground:"#EEF2F7",caret:"#C4C4C4",selection:"#90B2D557",gutterBackground:"#15191EFA",gutterForeground:"#aaaaaa95",lineHighlight:"#57575712"},styles:[{tag:L.comment,color:"#6E6E6E"},{tag:[L.string,L.regexp,L.special(L.brace)],color:"#5C81B3"},{tag:L.number,color:"#C1E1B8"},{tag:L.bool,color:"#53667D"},{tag:[L.definitionKeyword,L.modifier,L.function(L.propertyName)],color:"#A3D295",fontWeight:"bold"},{tag:[L.keyword,L.moduleKeyword,L.operatorKeyword,L.operator],color:"#697A8E",fontWeight:"bold"},{tag:[L.variableName,L.attributeName],color:"#708E67"},{tag:[L.function(L.variableName),L.definition(L.propertyName),L.derefOperator],color:"#fff"},{tag:L.tagName,color:"#A3D295"}]}),Pt({variant:"dark",settings:{background:"#2e241d",foreground:"#BAAE9E",caret:"#A7A7A7",selection:"#DDF0FF33",gutterBackground:"#28211C",gutterForeground:"#BAAE9E90",lineHighlight:"#FFFFFF08"},styles:[{tag:L.comment,color:"#666666"},{tag:[L.string,L.special(L.brace)],color:"#54BE0D"},{tag:L.regexp,color:"#E9C062"},{tag:L.number,color:"#CF6A4C"},{tag:[L.keyword,L.operator],color:"#5EA6EA"},{tag:L.variableName,color:"#7587A6"},{tag:[L.definitionKeyword,L.modifier],color:"#F9EE98"},{tag:[L.propertyName,L.function(L.variableName)],color:"#937121"},{tag:[L.typeName,L.angleBracket,L.tagName],color:"#9B859D"}]}),Pt({variant:"dark",settings:{background:"#3b2627",foreground:"#E6E1C4",caret:"#E6E1C4",selection:"#16120E",gutterBackground:"#3b2627",gutterForeground:"#E6E1C490",lineHighlight:"#1F1611"},styles:[{tag:L.comment,color:"#6B4E32"},{tag:[L.keyword,L.operator,L.derefOperator],color:"#EF5D32"},{tag:L.className,color:"#EFAC32",fontWeight:"bold"},{tag:[L.typeName,L.propertyName,L.function(L.variableName),L.definition(L.variableName)],color:"#EFAC32"},{tag:L.definition(L.typeName),color:"#EFAC32",fontWeight:"bold"},{tag:L.labelName,color:"#EFAC32",fontWeight:"bold"},{tag:[L.number,L.bool],color:"#6C99BB"},{tag:[L.variableName,L.self],color:"#7DAF9C"},{tag:[L.string,L.special(L.brace),L.regexp],color:"#D9D762"},{tag:[L.angleBracket,L.tagName,L.attributeName],color:"#EFCB43"}]}),Pt({variant:"dark",settings:{background:"#000205",foreground:"#FFFFFF",caret:"#E60065",selection:"#E60C6559",gutterBackground:"#000205",gutterForeground:"#ffffff90",lineHighlight:"#4DD7FC1A"},styles:[{tag:L.comment,color:"#404040"},{tag:[L.string,L.special(L.brace),L.regexp],color:"#00D8FF"},{tag:L.number,color:"#E62286"},{tag:[L.variableName,L.attributeName,L.self],color:"#E62286",fontWeight:"bold"},{tag:L.function(L.variableName),color:"#fff",fontWeight:"bold"}]}),Pt({variant:"light",settings:{background:"#fff",foreground:"#000",caret:"#000",selection:"#BDD5FC",gutterBackground:"#fff",gutterForeground:"#00000070",lineHighlight:"#FFFBD1"},styles:[{tag:L.comment,color:"#BCC8BA"},{tag:[L.string,L.special(L.brace),L.regexp],color:"#5D90CD"},{tag:[L.number,L.bool,L.null],color:"#46A609"},{tag:L.keyword,color:"#AF956F"},{tag:[L.definitionKeyword,L.modifier],color:"#C52727"},{tag:[L.angleBracket,L.tagName,L.attributeName],color:"#606060"},{tag:L.self,color:"#000"}]}),Pt({variant:"dark",settings:{background:"#00254b",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#B36539BF",gutterBackground:"#00254b",gutterForeground:"#FFFFFF70",lineHighlight:"#00000059"},styles:[{tag:L.comment,color:"#0088FF"},{tag:L.string,color:"#3AD900"},{tag:L.regexp,color:"#80FFC2"},{tag:[L.number,L.bool,L.null],color:"#FF628C"},{tag:[L.definitionKeyword,L.modifier],color:"#FFEE80"},{tag:L.variableName,color:"#CCCCCC"},{tag:L.self,color:"#FF80E1"},{tag:[L.className,L.definition(L.propertyName),L.function(L.variableName),L.definition(L.typeName),L.labelName],color:"#FFDD00"},{tag:[L.keyword,L.operator],color:"#FF9D00"},{tag:[L.propertyName,L.typeName],color:"#80FFBB"},{tag:L.special(L.brace),color:"#EDEF7D"},{tag:L.attributeName,color:"#9EFFFF"},{tag:L.derefOperator,color:"#fff"}]}),Pt({variant:"dark",settings:{background:"#060521",foreground:"#E0E0E0",caret:"#FFFFFFA6",selection:"#122BBB",gutterBackground:"#060521",gutterForeground:"#E0E0E090",lineHighlight:"#FFFFFF0F"},styles:[{tag:L.comment,color:"#AEAEAE"},{tag:[L.string,L.special(L.brace),L.regexp],color:"#8DFF8E"},{tag:[L.className,L.definition(L.propertyName),L.function(L.variableName),L.function(L.definition(L.variableName)),L.definition(L.typeName)],color:"#A3EBFF"},{tag:[L.number,L.bool,L.null],color:"#62E9BD"},{tag:[L.keyword,L.operator],color:"#2BF1DC"},{tag:[L.definitionKeyword,L.modifier],color:"#F8FBB1"},{tag:[L.variableName,L.self],color:"#B683CA"},{tag:[L.angleBracket,L.tagName,L.typeName,L.propertyName],color:"#60A4F1"},{tag:L.derefOperator,color:"#E0E0E0"},{tag:L.attributeName,color:"#7BACCA"}]}),Pt({variant:"dark",settings:{background:"#2d2f3f",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"#44475a",gutterBackground:"#282a36",gutterForeground:"rgb(144, 145, 148)",lineHighlight:"#44475a"},styles:[{tag:L.comment,color:"#6272a4"},{tag:[L.string,L.special(L.brace)],color:"#f1fa8c"},{tag:[L.number,L.self,L.bool,L.null],color:"#bd93f9"},{tag:[L.keyword,L.operator],color:"#ff79c6"},{tag:[L.definitionKeyword,L.typeName],color:"#8be9fd"},{tag:L.definition(L.typeName),color:"#f8f8f2"},{tag:[L.className,L.definition(L.propertyName),L.function(L.variableName),L.attributeName],color:"#50fa7b"}]}),Pt({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#80C7FF",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#C1E2F8"},styles:[{tag:L.comment,color:"#AAAAAA"},{tag:[L.keyword,L.operator,L.typeName,L.tagName,L.propertyName],color:"#2F6F9F",fontWeight:"bold"},{tag:[L.attributeName,L.definition(L.propertyName)],color:"#4F9FD0"},{tag:[L.className,L.string,L.special(L.brace)],color:"#CF4F5F"},{tag:L.number,color:"#CF4F5F",fontWeight:"bold"},{tag:L.variableName,fontWeight:"bold"}]}),Pt({variant:"light",settings:{background:"#f2f1f8",foreground:"#0c006b",caret:"#5c49e9",selection:"#d5d1f2",gutterBackground:"#f2f1f8",gutterForeground:"#0c006b70",lineHighlight:"#e1def3"},styles:[{tag:L.comment,color:"#9995b7"},{tag:L.keyword,color:"#ff5792",fontWeight:"bold"},{tag:[L.definitionKeyword,L.modifier],color:"#ff5792"},{tag:[L.className,L.tagName,L.definition(L.typeName)],color:"#0094f0"},{tag:[L.number,L.bool,L.null,L.special(L.brace)],color:"#5842ff"},{tag:[L.definition(L.propertyName),L.function(L.variableName)],color:"#0095a8"},{tag:L.typeName,color:"#b3694d"},{tag:[L.propertyName,L.variableName],color:"#fa8900"},{tag:L.operator,color:"#ff5792"},{tag:L.self,color:"#e64100"},{tag:[L.string,L.regexp],color:"#00b368"},{tag:[L.paren,L.bracket],color:"#0431fa"},{tag:L.labelName,color:"#00bdd6"},{tag:L.attributeName,color:"#e64100"},{tag:L.angleBracket,color:"#9995b7"}]}),Pt({variant:"light",settings:{background:"#faf4ed",foreground:"#575279",caret:"#575279",selection:"#6e6a8614",gutterBackground:"#faf4ed",gutterForeground:"#57527970",lineHighlight:"#6e6a860d"},styles:[{tag:L.comment,color:"#9893a5"},{tag:[L.bool,L.null],color:"#286983"},{tag:L.number,color:"#d7827e"},{tag:L.className,color:"#d7827e"},{tag:[L.angleBracket,L.tagName,L.typeName],color:"#56949f"},{tag:L.attributeName,color:"#907aa9"},{tag:L.punctuation,color:"#797593"},{tag:[L.keyword,L.modifier],color:"#286983"},{tag:[L.string,L.regexp],color:"#ea9d34"},{tag:L.variableName,color:"#d7827e"}]}),Pt({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#FFFD0054",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#00000008"},styles:[{tag:L.comment,color:"#CFCFCF"},{tag:[L.number,L.bool,L.null],color:"#E66C29"},{tag:[L.className,L.definition(L.propertyName),L.function(L.variableName),L.labelName,L.definition(L.typeName)],color:"#2EB43B"},{tag:L.keyword,color:"#D8B229"},{tag:L.operator,color:"#4EA44E",fontWeight:"bold"},{tag:[L.definitionKeyword,L.modifier],color:"#925A47"},{tag:L.string,color:"#704D3D"},{tag:L.typeName,color:"#2F8996"},{tag:[L.variableName,L.propertyName],color:"#77ACB0"},{tag:L.self,color:"#77ACB0",fontWeight:"bold"},{tag:L.regexp,color:"#E3965E"},{tag:[L.tagName,L.angleBracket],color:"#BAA827"},{tag:L.attributeName,color:"#B06520"},{tag:L.derefOperator,color:"#000"}]}),Pt({variant:"light",settings:{background:"#fef7e5",foreground:"#586E75",caret:"#000000",selection:"#073642",gutterBackground:"#fef7e5",gutterForeground:"#586E7580",lineHighlight:"#EEE8D5"},styles:[{tag:L.comment,color:"#93A1A1"},{tag:L.string,color:"#2AA198"},{tag:L.regexp,color:"#D30102"},{tag:L.number,color:"#D33682"},{tag:L.variableName,color:"#268BD2"},{tag:[L.keyword,L.operator,L.punctuation],color:"#859900"},{tag:[L.definitionKeyword,L.modifier],color:"#073642",fontWeight:"bold"},{tag:[L.className,L.self,L.definition(L.propertyName)],color:"#268BD2"},{tag:L.function(L.variableName),color:"#268BD2"},{tag:[L.bool,L.null],color:"#B58900"},{tag:L.tagName,color:"#268BD2",fontWeight:"bold"},{tag:L.angleBracket,color:"#93A1A1"},{tag:L.attributeName,color:"#93A1A1"},{tag:L.typeName,color:"#859900"}]}),Pt({variant:"light",settings:{background:"#FFFFFF",foreground:"#4D4D4C",caret:"#AEAFAD",selection:"#D6D6D6",gutterBackground:"#FFFFFF",gutterForeground:"#4D4D4C80",lineHighlight:"#EFEFEF"},styles:[{tag:L.comment,color:"#8E908C"},{tag:[L.variableName,L.self,L.propertyName,L.attributeName,L.regexp],color:"#C82829"},{tag:[L.number,L.bool,L.null],color:"#F5871F"},{tag:[L.className,L.typeName,L.definition(L.typeName)],color:"#C99E00"},{tag:[L.string,L.special(L.brace)],color:"#718C00"},{tag:L.operator,color:"#3E999F"},{tag:[L.definition(L.propertyName),L.function(L.variableName)],color:"#4271AE"},{tag:L.keyword,color:"#8959A8"},{tag:L.derefOperator,color:"#4D4D4C"}]});const m5=[Pt({variant:"dark",settings:{background:"#282c34",foreground:"#abb2bf",caret:"#528bff",selection:"#3E4451",lineHighlight:"#2c313c",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:L.comment,color:"#5c6370"},{tag:L.variableName,color:"#abb2bf"},{tag:[L.string,L.special(L.brace)],color:"#98c379"},{tag:L.number,color:"#d19a66"},{tag:L.bool,color:"#d19a66"},{tag:L.null,color:"#d19a66"},{tag:L.keyword,color:"#c678dd",fontWeight:500},{tag:L.className,color:"#61afef"},{tag:L.definition(L.typeName),color:"#61afef"},{tag:L.typeName,color:"#56b6c2"},{tag:L.angleBracket,color:"#abb2bf"},{tag:L.tagName,color:"#e06c75"},{tag:L.attributeName,color:"#d19a66"},{tag:L.operator,color:"#56b6c2",fontWeight:500},{tag:[L.function(L.variableName)],color:"#61afef"},{tag:[L.propertyName],color:"#e5c07b"}]}),We.theme({".mo-cm-reactive-reference":{fontWeight:"400",color:"#2a7aa5",borderBottom:"2px solid #bad3de"},".mo-cm-reactive-reference-hover":{cursor:"pointer",borderBottomWidth:"3px",borderBottomColor:"#4a90a5"}})],p5=[Pt({variant:"light",settings:{background:"#ffffff",foreground:"#000000",caret:"#000000",selection:"#d7d4f0",lineHighlight:"#cceeff44",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:L.comment,color:"#708090"},{tag:L.variableName,color:"#000000"},{tag:[L.string,L.special(L.brace)],color:"#a11"},{tag:L.number,color:"#164"},{tag:L.bool,color:"#219"},{tag:L.null,color:"#219"},{tag:L.keyword,color:"#708",fontWeight:500},{tag:L.className,color:"#00f"},{tag:L.definition(L.typeName),color:"#00f"},{tag:L.typeName,color:"#085"},{tag:L.angleBracket,color:"#000000"},{tag:L.tagName,color:"#170"},{tag:L.attributeName,color:"#00c"},{tag:L.operator,color:"#a2f",fontWeight:500},{tag:[L.function(L.variableName)],color:"#00c"},{tag:[L.propertyName],color:"#05a"}]}),We.theme({".mo-cm-reactive-reference":{fontWeight:"400",color:"#005f87",borderBottom:"2px solid #bad3de"},".mo-cm-reactive-reference-hover":{cursor:"pointer",borderBottomWidth:"3px"}})];function H0(t){const{showPlaceholder:e,enableAI:n}=t;return e?"marimo-import":n?"ai":"none"}const g5=t=>{const{cellId:e,keymapConfig:n,hotkeys:o,enableAI:r,cellActions:s,completionConfig:i,lspConfig:a,diagnosticsConfig:l,displayConfig:c}=t,d=H0(t);return[wF(n,o),[We.domEventHandlers({drop:(f,m)=>{var p,b;const g=(p=f.dataTransfer)==null?void 0:p.files[0];if(g!=null&&g.type.startsWith("text/"))return f.preventDefault(),$D(m,g),!0;if(g!=null&&g.type.startsWith("image/"))return f.preventDefault(),VD(m,g),!0;const x=(b=f.dataTransfer)==null?void 0:b.getData("text/plain");if(x){f.preventDefault();const y=m.posAtCoords({x:f.clientX,y:f.clientY});return y!==null&&m.dispatch({changes:{from:y,to:y,insert:x},scrollIntoView:!0}),!0}return!1},dragover:f=>{f.preventDefault()}})],f5(),hE(),qD({completionConfig:i,hotkeys:o,placeholderType:d,lspConfig:a,diagnosticsConfig:l}),GD({cellId:e,hotkeys:o,cellActions:s}),x5(t),[u5,(h=(f,m)=>{UD(f,m)},$n.define(f=>new h5(f,h))),We.baseTheme({".underline":{textDecoration:"underline",cursor:"pointer",color:"var(--link)"}})],l!=null&&l.enabled?YD():[],r&&jm("inline_ai_tooltip")?[iE({prompt:f=>async function(m){var w,j;const g=`
|
|
113
113
|
${m.codeBefore}
|
|
114
114
|
<rewrite_this>
|
|
115
115
|
${m.selection}
|
|
116
116
|
</rewrite_this>
|
|
117
117
|
${m.codeAfter}
|
|
118
|
-
`.trim(),x=nC();await oC();const p=await fetch(x.getAiURL("completion").toString(),{method:"POST",headers:x.headers(),body:JSON.stringify({prompt:m.prompt,code:g,selectedText:m.selection,includeOtherCode:"",language:m.language})}),b=((w=m.selection.match(/^\s*/))==null?void 0:w[0])||"",y=(j=p.body)==null?void 0:j.getReader();if(!y)throw new Error("Failed to get response reader");let v="";for(;;){const{done:C,value:N}=await y.read();if(C)break;v+=new TextDecoder().decode(N)}return v.startsWith(b)||(v=b+v),v}({prompt:f.prompt,selection:f.selection,codeBefore:f.codeBefore,codeAfter:f.codeAfter,language:x3(f.editorView)})}),Hd.of({hideOnBlur:!0})]:[],KD(Qe),XD(e,c.reference_highlighting??!1)];var h},x5=t=>{const{theme:e,hotkeys:n,completionConfig:o,cellId:r,lspConfig:s,diagnosticsConfig:i}=t,a=H0(t);return[We.lineWrapping,JD(),ZD(),QD(),eR(),tR(),nR(),oR(),rR({position:"fixed",parent:document.querySelector("#App")??void 0}),sR(),e==="dark"?m5:p5,iR(s),l5(o),aR(),lR(),mE(),To.high(Mn.of(mR)),cR(),dR(),uR.of(" "),lC(pR,{fallback:!0}),Mn.of(gR),hR({placeholderType:a,completionConfig:o,hotkeys:n,cellId:r,lspConfig:{...s,diagnostics:i}}),fR.of(xR()),Ji.allowMultipleSelections.of(!0),c5(n),Mn.of([{key:"Tab",run:l=>aC(l)||(c=>{const{from:d,to:h}=c.state.selection.main;if(d!==h)return!1;const f=c.state.doc.lineAt(h);return f.text.slice(0,h-f.from).trim()!==""&&wR(c)})(l)||bR(l),preventDefault:!0},{key:n.getHotkey("completion.moveDown").key,run:l=>ys(l.state)!==null&&(Ac(!0)(l),!0),preventDefault:!0},{key:n.getHotkey("completion.moveUp").key,run:l=>ys(l.state)!==null&&(Ac(!1)(l),!0),preventDefault:!0}]),Mn.of([...yR,vR])]},b5={width:void 0,height:void 0};function W0(t,e,n){return t[e]?Array.isArray(t[e])?t[e][0][n]:t[e][n]:e==="contentBoxSize"?t.contentRect[n==="inlineSize"?"width":"height"]:void 0}let q0,G0,Y0,K0;q0=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),G0=new Intl.DateTimeFormat("en-US",{month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),Y0=t=>{const e=H.c(79),{editing:n,status:o,disabled:r,staleInputs:s,edited:i,interrupted:a,elapsedTime:l,runStartTimestamp:c,lastRunStartTimestamp:d,uninstantiated:h}=t;if(!n)return null;const f=c??d;let m;e[0]!==f?(m=f?u.jsx(K0,{lastRanTime:f}):null,e[0]=f,e[1]=m):m=e[1];const g=m;if(r&&o==="running")return ut.error("CellStatusComponent: disabled and running"),null;if(r&&s){let x,p,b,y;return e[2]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx("span",{children:"This cell is stale, but it's disabled and can't be run"}),e[2]=x):x=e[2],e[3]!==g?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[x,g]}),e[3]=g,e[4]=p):p=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:u.jsxs(As,{children:[u.jsx(_s,{className:"h-5 w-5",strokeWidth:1.5}),u.jsx(Oc,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[5]=b):b=e[5],e[6]!==p?(y=u.jsx(Ee,{content:p,usePortal:!0,children:b}),e[6]=p,e[7]=y):y=e[7],y}if(r){let x,p,b,y;return e[8]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx("span",{children:"This cell is disabled"}),e[8]=x):x=e[8],e[9]!==g?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[x,g]}),e[9]=g,e[10]=p):p=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-disabled","data-testid":"cell-status","data-status":"disabled",children:u.jsx(_s,{className:"h-5 w-5",strokeWidth:1.5})}),e[11]=b):b=e[11],e[12]!==p?(y=u.jsx(Ee,{content:p,usePortal:!0,children:b}),e[12]=p,e[13]=y):y=e[13],y}if(!s&&o==="disabled-transitively"){let x,p,b,y;return e[14]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx("span",{children:"An ancestor of this cell is disabled, so it can't be run"}),e[14]=x):x=e[14],e[15]!==g?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[x,g]}),e[15]=g,e[16]=p):p=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"disabled-transitively",children:u.jsxs(As,{layerTop:!0,children:[u.jsx(ma,{className:"h-5 w-5",strokeWidth:1.5}),u.jsx(_s,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[17]=b):b=e[17],e[18]!==p?(y=u.jsx(Ee,{content:p,usePortal:!0,children:b}),e[18]=p,e[19]=y):y=e[19],y}if(s&&o==="disabled-transitively"){let x,p,b,y;return e[20]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx("span",{children:"This cell is stale, but an ancestor is disabled so it can't be run"}),e[20]=x):x=e[20],e[21]!==g?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[x,g]}),e[21]=g,e[22]=p):p=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:u.jsxs(As,{children:[u.jsx(Oc,{className:"h-5 w-5",strokeWidth:1}),u.jsx(_s,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[23]=b):b=e[23],e[24]!==p?(y=u.jsx(Ee,{content:p,usePortal:!0,children:b}),e[24]=p,e[25]=y):y=e[25],y}if(o==="running"){let x,p,b,y,v;return e[26]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx("span",{children:"This cell is running"}),e[26]=x):x=e[26],e[27]!==g?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[x,g]}),e[27]=g,e[28]=p):p=e[28],e[29]!==c?(b=Vm.fromSeconds(c)||Vm.now(),e[29]=c,e[30]=b):b=e[30],e[31]!==b?(y=u.jsx("div",{className:"cell-status-icon elapsed-time running","data-testid":"cell-status","data-status":"running",children:u.jsx(y5,{startTime:b})}),e[31]=b,e[32]=y):y=e[32],e[33]!==p||e[34]!==y?(v=u.jsx(Ee,{content:p,usePortal:!0,children:y}),e[33]=p,e[34]=y,e[35]=v):v=e[35],v}if(o==="queued"){let x,p,b,y;return e[36]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx("span",{children:"This cell is queued to run"}),e[36]=x):x=e[36],e[37]!==g?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[x,g]}),e[37]=g,e[38]=p):p=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-queued","data-testid":"cell-status","data-status":"queued",children:u.jsx(qc,{className:"h-5 w-5",strokeWidth:1.5})}),e[39]=b):b=e[39],e[40]!==p?(y=u.jsx(Ee,{content:p,usePortal:!0,children:b}),e[40]=p,e[41]=y):y=e[41],y}if(i||a||s||h){let x;e[42]!==l?(x=Es(l),e[42]=l,e[43]=x):x=e[43];const p=x;let b;e[44]!==l||e[45]!==p?(b=l?u.jsx(Gc,{elapsedTime:p}):null,e[44]=l,e[45]=p,e[46]=b):b=e[46];const y=b;let v,w,j,C,N,S="";if(h)v="This cell has not yet been run";else if(a){let E;v="This cell was interrupted when it was last run",e[47]!==y?(E=u.jsxs("span",{children:["This cell ran for ",y," before being interrupted"]}),e[47]=y,e[48]=E):E=e[48],S=E}else if(i){let E;v="This cell has been modified since it was last run",e[49]!==y?(E=u.jsxs("span",{children:["This cell took ",y," to run"]}),e[49]=y,e[50]=E):E=e[50],S=E}else{let E;v="This cell has not been run with the latest inputs",e[51]!==y?(E=u.jsxs("span",{children:["This cell took ",y," to run"]}),e[51]=y,e[52]=E):E=e[52],S=E}return e[53]===Symbol.for("react.memo_cache_sentinel")?(w=u.jsx("div",{className:"cell-status-stale","data-testid":"cell-status","data-status":"outdated",children:u.jsx(Oc,{className:"h-5 w-5",strokeWidth:1.5})}),e[53]=w):w=e[53],e[54]!==v?(j=u.jsx(Ee,{content:v,usePortal:!0,children:w}),e[54]=v,e[55]=j):j=e[55],e[56]!==l||e[57]!==p||e[58]!==g||e[59]!==S?(C=l&&u.jsx(Ee,{content:u.jsxs("div",{className:"flex flex-col gap-1",children:[S,g]}),usePortal:!0,children:u.jsx("div",{className:"elapsed-time hover-action","data-testid":"cell-status","data-status":"outdated",children:u.jsx("span",{children:p})})}),e[56]=l,e[57]=p,e[58]=g,e[59]=S,e[60]=C):C=e[60],e[61]!==j||e[62]!==C?(N=u.jsxs("div",{className:"cell-status-icon flex items-center gap-2",children:[j,C]}),e[61]=j,e[62]=C,e[63]=N):N=e[63],N}if(l!==null){let x;e[64]!==l?(x=Es(l),e[64]=l,e[65]=x):x=e[65];const p=x;let b;e[66]!==l||e[67]!==p?(b=l?u.jsx(Gc,{elapsedTime:p}):null,e[66]=l,e[67]=p,e[68]=b):b=e[68];const y=b;let v,w,j,C;return e[69]!==y?(v=u.jsxs("span",{children:["This cell took ",y," to run"]}),e[69]=y,e[70]=v):v=e[70],e[71]!==g||e[72]!==v?(w=u.jsxs("div",{className:"flex flex-col gap-1",children:[v,g]}),e[71]=g,e[72]=v,e[73]=w):w=e[73],e[74]!==p?(j=u.jsx("div",{className:"cell-status-icon elapsed-time hover-action","data-testid":"cell-status","data-status":"idle",children:u.jsx("span",{children:p})}),e[74]=p,e[75]=j):j=e[75],e[76]!==w||e[77]!==j?(C=u.jsx(Ee,{content:w,usePortal:!0,children:j}),e[76]=w,e[77]=j,e[78]=C):C=e[78],C}return null},Gc=t=>{const e=H.c(2);let n;return e[0]!==t.elapsedTime?(n=u.jsx("span",{className:"tracking-wide font-semibold",children:t.elapsedTime}),e[0]=t.elapsedTime,e[1]=n):n=e[1],n},K0=t=>{const e=H.c(18),n=1e3*t.lastRanTime;let o,r,s,i,a,l,c,d,h;if(e[0]!==n){const f=new Date(n),m=new Date,g=f.toDateString()===m.toDateString()?q0:G0;i="Ran at",a=" ",l=u.jsx("strong",{className:"tracking-wide font-semibold",children:g.format(f)}),c=" ",o="text-muted-foreground",r="(",s=Lj(f),e[0]=n,e[1]=o,e[2]=r,e[3]=s,e[4]=i,e[5]=a,e[6]=l,e[7]=c}else o=e[1],r=e[2],s=e[3],i=e[4],a=e[5],l=e[6],c=e[7];return e[8]!==o||e[9]!==r||e[10]!==s?(d=u.jsxs("span",{className:o,children:[r,s," ago)"]}),e[8]=o,e[9]=r,e[10]=s,e[11]=d):d=e[11],e[12]!==i||e[13]!==a||e[14]!==l||e[15]!==c||e[16]!==d?(h=u.jsxs("span",{children:[i,a,l,c,d]}),e[12]=i,e[13]=a,e[14]=l,e[15]=c,e[16]=d,e[17]=h):h=e[17],h},Es=function(t){if(t===null)return"";const e=t,n=e/1e3;return n>=60?`${Math.floor(n/60)}m${Math.floor(n%60)}s`:n>=1?`${n.toFixed(2).toString()}s`:`${e.toFixed(0).toString()}ms`};const y5=t=>{const e=H.c(6);let n;e[0]!==t.startTime?(n=t.startTime.toMilliseconds(),e[0]=t.startTime,e[1]=n):n=e[1];const o=function(i){const a=M.useRef(i),[l,c]=M.useState(i);return M.useEffect(()=>{const d=setInterval(()=>{c(Vm.now().toMilliseconds())},17);return()=>clearInterval(d)},[]),l-a.current}(n);let r,s;return e[2]!==o?(r=Es(o),e[2]=o,e[3]=r):r=e[3],e[4]!==r?(s=u.jsx("span",{children:r}),e[4]=r,e[5]=s):s=e[5],s};var vu="ContextMenu",[v5,rz]=dC(vu,[cC]),Xt=cC(),[w5,X0]=v5(vu),J0=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:o,dir:r,modal:s=!0}=t,[i,a]=M.useState(!1),l=Xt(e),c=Xo(o),d=M.useCallback(h=>{a(h),c(h)},[c]);return u.jsx(w5,{scope:e,open:i,onOpenChange:d,modal:s,children:u.jsx(RR,{...l,dir:r,open:i,onOpenChange:d,modal:s,children:n})})};J0.displayName=vu;var Z0="ContextMenuTrigger",Q0=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:o=!1,...r}=t,s=X0(Z0,n),i=Xt(n),a=M.useRef({x:0,y:0}),l=M.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...a.current})}),c=M.useRef(0),d=M.useCallback(()=>window.clearTimeout(c.current),[]),h=f=>{a.current={x:f.clientX,y:f.clientY},s.onOpenChange(!0)};return M.useEffect(()=>d,[d]),M.useEffect(()=>{o&&d()},[o,d]),u.jsxs(u.Fragment,{children:[u.jsx(jR,{...i,virtualRef:l}),u.jsx(vs.span,{"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,...r,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:o?t.onContextMenu:On(t.onContextMenu,f=>{d(),h(f),f.preventDefault()}),onPointerDown:o?t.onPointerDown:On(t.onPointerDown,rl(f=>{d(),c.current=window.setTimeout(()=>h(f),700)})),onPointerMove:o?t.onPointerMove:On(t.onPointerMove,rl(d)),onPointerCancel:o?t.onPointerCancel:On(t.onPointerCancel,rl(d)),onPointerUp:o?t.onPointerUp:On(t.onPointerUp,rl(d))})]})});Q0.displayName=Z0;var ex=t=>{const{__scopeContextMenu:e,...n}=t,o=Xt(e);return u.jsx(PR,{...o,...n})};ex.displayName="ContextMenuPortal";var tx="ContextMenuContent",nx=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=X0(tx,n),s=Xt(n),i=M.useRef(!1);return u.jsx(SR,{...s,...o,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:a=>{var l;(l=t.onCloseAutoFocus)==null||l.call(t,a),!a.defaultPrevented&&i.current&&a.preventDefault(),i.current=!1},onInteractOutside:a=>{var l;(l=t.onInteractOutside)==null||l.call(t,a),a.defaultPrevented||r.modal||(i.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});nx.displayName=tx,M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(NR,{...r,...o,ref:e})}).displayName="ContextMenuGroup";var ox=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(ER,{...r,...o,ref:e})});ox.displayName="ContextMenuLabel";var rx=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(CR,{...r,...o,ref:e})});rx.displayName="ContextMenuItem";var sx=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(_R,{...r,...o,ref:e})});sx.displayName="ContextMenuCheckboxItem",M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(IR,{...r,...o,ref:e})}).displayName="ContextMenuRadioGroup";var ix=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(AR,{...r,...o,ref:e})});ix.displayName="ContextMenuRadioItem";var ax=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(TR,{...r,...o,ref:e})});ax.displayName="ContextMenuItemIndicator";var lx=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(kR,{...r,...o,ref:e})});lx.displayName="ContextMenuSeparator",M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(MR,{...r,...o,ref:e})}).displayName="ContextMenuArrow";var cx=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(OR,{...r,...o,ref:e})});cx.displayName="ContextMenuSubTrigger";var dx=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(DR,{...r,...o,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});function rl(t){return e=>e.pointerType!=="mouse"?t(e):void 0}dx.displayName="ContextMenuSubContent";var ux=nx,hx=ox,fx=rx,mx=sx,px=ix,gx=ax,xx=lx,bx=cx,yx=dx;const vx=J0,wx=Q0,k5=zR(ex);M.forwardRef((t,e)=>{const n=H.c(14);let o,r,s,i,a,l,c;return n[0]!==t?({className:r,inset:s,children:o,...i}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i):(o=n[1],r=n[2],s=n[3],i=n[4]),n[5]!==r||n[6]!==s?(a=BR({className:r,inset:s}),n[5]=r,n[6]=s,n[7]=a):a=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(VR,{className:"ml-auto h-4 w-4"}),n[8]=l):l=n[8],n[9]!==o||n[10]!==i||n[11]!==e||n[12]!==a?(c=u.jsxs(bx,{ref:e,className:a,...i,children:[o,l]}),n[9]=o,n[10]=i,n[11]=e,n[12]=a,n[13]=c):c=n[13],c}).displayName=bx.displayName;const kx="data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2";M.forwardRef((t,e)=>{const n=H.c(9);let o,r,s,i;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(s=xe(uC({subcontent:!0}),kx,o),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(i=u.jsx(yx,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=i):i=n[8],i}).displayName=yx.displayName;const wu=M.forwardRef((t,e)=>{const n=H.c(15);let o,r,s;n[0]!==t?({className:o,scrollable:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const i=s===void 0||s;let a;n[4]!==o||n[5]!==i?(a=xe(uC(),kx,i&&"overflow-auto",o),n[4]=o,n[5]=i,n[6]=a):a=n[6];const l=i?"calc(var(--radix-context-menu-content-available-height) - 30px)":void 0;let c,d;return n[7]!==r.style||n[8]!==l?(c={...r.style,maxHeight:l},n[7]=r.style,n[8]=l,n[9]=c):c=n[9],n[10]!==r||n[11]!==e||n[12]!==a||n[13]!==c?(d=u.jsx(k5,{children:u.jsx(UR,{children:u.jsx(ux,{ref:e,className:a,style:c,...r})})}),n[10]=r,n[11]=e,n[12]=a,n[13]=c,n[14]=d):d=n[14],d});wu.displayName=ux.displayName;const ni=M.forwardRef((t,e)=>{const n=H.c(13);let o,r,s,i,a,l;return n[0]!==t?({className:o,inset:r,variant:i,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i):(o=n[1],r=n[2],s=n[3],i=n[4]),n[5]!==o||n[6]!==r||n[7]!==i?(a=FR({className:o,inset:r,variant:i}),n[5]=o,n[6]=r,n[7]=i,n[8]=a):a=n[8],n[9]!==s||n[10]!==e||n[11]!==a?(l=u.jsx(fx,{ref:e,className:a,...s}),n[9]=s,n[10]=e,n[11]=a,n[12]=l):l=n[12],l});ni.displayName=fx.displayName,M.forwardRef((t,e)=>{const n=H.c(15);let o,r,s,i,a,l,c,d;return n[0]!==t?({className:s,children:r,checked:o,...i}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i):(o=n[1],r=n[2],s=n[3],i=n[4]),n[5]!==s?(a=Dc({className:s}),n[5]=s,n[6]=a):a=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=Dc(),n[7]=l):l=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx("span",{className:l,children:u.jsx(gx,{children:u.jsx(HR,{className:"h-4 w-4"})})}),n[8]=c):c=n[8],n[9]!==o||n[10]!==r||n[11]!==i||n[12]!==e||n[13]!==a?(d=u.jsxs(mx,{ref:e,className:a,checked:o,...i,children:[c,r]}),n[9]=o,n[10]=r,n[11]=i,n[12]=e,n[13]=a,n[14]=d):d=n[14],d}).displayName=mx.displayName,M.forwardRef((t,e)=>{const n=H.c(13);let o,r,s,i,a,l,c;return n[0]!==t?({className:r,children:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(i=Dc({className:r}),n[4]=r,n[5]=i):i=n[5],n[6]===Symbol.for("react.memo_cache_sentinel")?(a=Dc(),n[6]=a):a=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx("span",{className:a,children:u.jsx(gx,{children:u.jsx(WR,{className:"h-4 w-4 fill-current"})})}),n[7]=l):l=n[7],n[8]!==o||n[9]!==s||n[10]!==e||n[11]!==i?(c=u.jsxs(px,{ref:e,className:i,...s,children:[l,o]}),n[8]=o,n[9]=s,n[10]=e,n[11]=i,n[12]=c):c=n[12],c}).displayName=px.displayName,M.forwardRef((t,e)=>{const n=H.c(11);let o,r,s,i,a;return n[0]!==t?({className:o,inset:r,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==o||n[5]!==r?(i=$R({className:o,inset:r}),n[4]=o,n[5]=r,n[6]=i):i=n[6],n[7]!==s||n[8]!==e||n[9]!==i?(a=u.jsx(hx,{ref:e,className:i,...s}),n[7]=s,n[8]=e,n[9]=i,n[10]=a):a=n[10],a}).displayName=hx.displayName;const Cx=M.forwardRef((t,e)=>{const n=H.c(9);let o,r,s,i;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(s=xe(LR({className:o})),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(i=u.jsx(xx,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=i):i=n[8],i});Cx.displayName=xx.displayName;const jx=t=>{const e=H.c(20),{connectionState:n,onClick:o,tooltipContent:r}=t;let s;e[0]!==n||e[1]!==r?(s=wc(n)||r,e[0]=n,e[1]=r,e[2]=s):s=e[2];const i=s;let a;e[3]!==i||e[4]!==n?(a=eo(n)?i:u.jsxs("div",{className:"flex flex-col gap-4",children:[u.jsx("div",{children:i}),u.jsx("div",{className:"text-xs text-muted-foreground font-medium pt-1 -mt-2 border-t border-border",children:"Right-click for cell types"})]}),e[3]=i,e[4]=n,e[5]=a):a=e[5];const l=a;let c,d,h,f,m,g;return e[6]!==o?(c=()=>o==null?void 0:o({code:""}),e[6]=o,e[7]=c):c=e[7],e[8]!==n?(d=xe("shoulder-button hover-action",eo(n)&&" inactive-button"),e[8]=n,e[9]=d):d=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(Jo,{strokeWidth:1.8}),e[10]=h):h=e[10],e[11]!==c||e[12]!==d?(f=u.jsx(cn,{onClick:c,className:d,onMouseDown:zn.preventFocus,shape:"circle",size:"small",color:"hint-green","data-testid":"create-cell-button",children:h}),e[11]=c,e[12]=d,e[13]=f):f=e[13],e[14]!==l||e[15]!==f?(m=u.jsx(Ee,{content:l,children:f}),e[14]=l,e[15]=f,e[16]=m):m=e[16],e[17]!==o||e[18]!==m?(g=u.jsx(C5,{onClick:o,children:m}),e[17]=o,e[18]=m,e[19]=g):g=e[19],g},C5=t=>{const e=H.c(26),{children:n,onClick:o}=t,{createNewCell:r}=lt();if(!o)return n;let s,i,a,l,c,d,h,f,m,g,x,p;return e[0]!==n?(s=u.jsx(wx,{children:n}),e[0]=n,e[1]=s):s=e[1],e[2]!==o?(i=b=>{b.stopPropagation(),o({code:""})},e[2]=o,e[3]=i):i=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx("div",{className:"mr-3 text-muted-foreground",children:u.jsx(nc,{})}),e[4]=a):a=e[4],e[5]!==i?(l=u.jsxs(ni,{onSelect:i,children:[a,"Python cell"]},"python"),e[5]=i,e[6]=l):l=e[6],e[7]!==r||e[8]!==o?(c=b=>{b.stopPropagation(),Jn({autoInstantiate:!0,createNewCell:r}),o({code:new Bi().defaultCode,hideCode:!0})},e[7]=r,e[8]=o,e[9]=c):c=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx("div",{className:"mr-3 text-muted-foreground",children:u.jsx(tc,{})}),e[10]=d):d=e[10],e[11]!==c?(h=u.jsxs(ni,{onSelect:c,children:[d,"Markdown cell"]},"markdown"),e[11]=c,e[12]=h):h=e[12],e[13]!==r||e[14]!==o?(f=b=>{b.stopPropagation(),Jn({autoInstantiate:!0,createNewCell:r}),o({code:new Rc().defaultCode})},e[13]=r,e[14]=o,e[15]=f):f=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx("div",{className:"mr-3 text-muted-foreground",children:u.jsx(Yo,{size:13,strokeWidth:1.5})}),e[16]=m):m=e[16],e[17]!==f?(g=u.jsxs(ni,{onSelect:f,children:[m,"SQL cell"]},"sql"),e[17]=f,e[18]=g):g=e[18],e[19]!==l||e[20]!==h||e[21]!==g?(x=u.jsxs(wu,{children:[l,h,g]}),e[19]=l,e[20]=h,e[21]=g,e[22]=x):x=e[22],e[23]!==s||e[24]!==x?(p=u.jsxs(vx,{children:[s,x]}),e[23]=s,e[24]=x,e[25]=p):p=e[25],p},Sx=q.memo(q.forwardRef((t,e)=>{const n=H.c(34);let o,r,s;n[0]!==t?({children:o,showTooltip:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const i=s===void 0||s,[a,l]=M.useState(!1);let c;n[4]!==r?(c={cell:r},n[4]=r,n[5]=c):c=n[5];const d=md(c),h=GR();let f,m,g,x,p,b;if(n[6]===Symbol.for("react.memo_cache_sentinel")?(f=()=>({toggle:()=>l(j5)}),n[6]=f):f=n[6],M.useImperativeHandle(e,f),n[7]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(zi,{placeholder:"Search actions...",className:"h-6 m-1"}),n[7]=m):m=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx(ac,{children:"No results"}),n[8]=g):g=n[8],n[9]!==d){let S;n[11]!==d.length?(S=(E,T)=>u.jsxs(M.Fragment,{children:[u.jsx(gm,{children:E.map(I=>{let D=u.jsxs("div",{className:"flex items-center flex-1",children:[I.icon&&u.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:I.icon}),u.jsx("div",{className:"flex-1",children:I.label}),u.jsxs("div",{className:"shrink-0 text-sm",children:[I.hotkey&&hC(I.hotkey),I.rightElement]})]});return I.tooltip&&(D=u.jsx(Ee,{content:I.tooltip,delayDuration:100,children:D})),u.jsx(Zn,{className:xe(I.disabled&&"opacity-50!"),onSelect:()=>{I.disableClick||I.disabled||(I.handle(),l(!1))},variant:I.variant,children:D},I.label)})},T),T<d.length-1&&u.jsx(N3,{})]},T),n[11]=d.length,n[12]=S):S=n[12],x=d.map(S),n[9]=d,n[10]=x}else x=n[10];n[13]!==x?(p=u.jsxs(yc,{children:[m,u.jsxs(Hm,{children:[g,x]})]}),n[13]=x,n[14]=p):p=n[14],n[15]!==h||n[16]!==p?(b=u.jsx(ps,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...h,children:p}),n[15]=h,n[16]=p,n[17]=b):b=n[17];const y=b;if(!i){let S,E;return n[18]!==o?(S=u.jsx(ws,{asChild:!0,children:o}),n[18]=o,n[19]=S):S=n[19],n[20]!==y||n[21]!==a||n[22]!==S?(E=u.jsxs(br,{open:a,onOpenChange:l,children:[S,y]}),n[20]=y,n[21]=a,n[22]=S,n[23]=E):E=n[23],E}let v;n[24]===Symbol.for("react.memo_cache_sentinel")?(v=u.jsx(YR,{tabIndex:-1,children:Gt("cell.cellActions")}),n[24]=v):v=n[24];const w=!a&&v;let j,C,N;return n[25]!==o?(j=u.jsx(KR,{children:u.jsx(ws,{className:"flex",children:o})}),n[25]=o,n[26]=j):j=n[26],n[27]!==w||n[28]!==j?(C=u.jsxs(XR,{delayDuration:200,disableHoverableContent:!0,children:[w,j]}),n[27]=w,n[28]=j,n[29]=C):C=n[29],n[30]!==y||n[31]!==a||n[32]!==C?(N=u.jsxs(br,{open:a,onOpenChange:l,children:[C,y]}),n[30]=y,n[31]=a,n[32]=C,n[33]=N):N=n[33],N})),Nx=q.memo(t=>{const e=H.c(5),{children:n,cellId:o}=t;let r,s;e[0]!==o?(s=qR(o),e[0]=o,e[1]=s):s=e[1],r=s;const i=Ne(r);if(!i)return null;let a;return e[2]!==n||e[3]!==i?(a=u.jsx(Sx,{showTooltip:!1,...i,children:n}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a});function j5(t){return!t}Nx.displayName="ConnectionCellActionsDropdown";const Ex=t=>{const e=H.c(35),{children:n,cellId:o,getEditorView:r}=t,s=Zi(o),i=Qi(o),a=!Wm(i.output),l=i.consoleOutputs.length>0;let c;e[0]!==s.config||e[1]!==s.name||e[2]!==o||e[3]!==i.status||e[4]!==r||e[5]!==a||e[6]!==l?(c={cell:{cellId:o,name:s.name,config:s.config,status:i.status,hasOutput:a,hasConsoleOutput:l,getEditorView:r}},e[0]=s.config,e[1]=s.name,e[2]=o,e[3]=i.status,e[4]=r,e[5]=a,e[6]=l,e[7]=c):c=e[7];const d=md(c),[h,f]=q.useState(),m=!!h;let g,x,p,b,y,v,w,j,C,N;if(e[8]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx(Mi,{size:13,strokeWidth:1.5}),e[8]=g):g=e[8],e[9]!==o?(x=async()=>{var T;if((T=window.getSelection())==null?void 0:T.toString())return void document.execCommand("copy");const E=document.getElementById(y3.create(o));E?await sn(E.textContent??""):ut.warn("cell-context-menu: output not found")},e[9]=o,e[10]=x):x=e[10],e[11]!==d||e[12]!==n||e[13]!==r||e[14]!==h||e[15]!==m||e[16]!==x){const S=[{label:"Copy",hidden:m,icon:g,handle:x},{label:"Cut",hidden:!!h,icon:u.jsx(ad,{size:13,strokeWidth:1.5}),handle:S5},{label:"Paste",hidden:!!h,icon:u.jsx(yp,{size:13,strokeWidth:1.5}),handle:async()=>{const I=r();if(I)try{const D=await navigator.clipboard.readText();if(D){const{from:F,to:O}=I.state.selection.main,R=I.state.update({changes:{from:F,to:O,insert:D}});I.dispatch(R)}}catch(D){const F=D;ut.error("Failed to paste from clipboard",F),JR({command:"paste"})}}},{label:"Copy image",hidden:!h,icon:u.jsx(Zc,{size:13,strokeWidth:1.5}),handle:async()=>{if(h){const I=await fetch(h.src),D=await I.blob(),F=new ClipboardItem({[D.type]:D});await navigator.clipboard.write([F]).then(N5).catch(E5)}}},{icon:u.jsx(cp,{size:13,strokeWidth:1.5}),label:"Download image",hidden:!h,handle:()=>{if(h){const I=document.createElement("a");I.download="image.png",I.href=h.src,I.click()}}},{label:"Go to Definition",icon:u.jsx(QR,{size:13,strokeWidth:1.5}),handle:()=>{const I=r();I&&ZR(I)}}],E=[S,...d];let T;b=vx,e[23]===Symbol.for("react.memo_cache_sentinel")?(T=I=>{I.target instanceof HTMLImageElement?f(I.target):f(void 0)},e[23]=T):T=e[23],e[24]!==n?(y=u.jsx(wx,{onContextMenu:T,asChild:!0,children:n}),e[24]=n,e[25]=y):y=e[25],p=wu,v="w-[300px]",w=!0,j=E.map((I,D)=>u.jsxs(M.Fragment,{children:[I.map(_5),D<E.length-1&&u.jsx(Cx,{})]},D)),e[11]=d,e[12]=n,e[13]=r,e[14]=h,e[15]=m,e[16]=x,e[17]=p,e[18]=b,e[19]=y,e[20]=v,e[21]=w,e[22]=j}else p=e[17],b=e[18],y=e[19],v=e[20],w=e[21],j=e[22];return e[26]!==p||e[27]!==v||e[28]!==w||e[29]!==j?(C=u.jsx(p,{className:v,scrollable:w,children:j}),e[26]=p,e[27]=v,e[28]=w,e[29]=j,e[30]=C):C=e[30],e[31]!==b||e[32]!==y||e[33]!==C?(N=u.jsxs(b,{children:[y,C]}),e[31]=b,e[32]=y,e[33]=C,e[34]=N):N=e[34],N};function S5(){document.execCommand("cut")}function N5(){Je({title:"Copied image to clipboard"})}function E5(t){Je({title:"Failed to copy image to clipboard. Try downloading instead.",description:t.message}),ut.error("Failed to copy image to clipboard",t)}function _5(t){if(t.hidden)return null;let e=u.jsxs("div",{className:"flex items-center flex-1",children:[t.icon&&u.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:t.icon}),u.jsx("div",{className:"flex-1",children:t.label}),u.jsxs("div",{className:"shrink-0 text-sm",children:[t.hotkey&&hC(t.hotkey),t.rightElement]})]});return t.tooltip&&(e=u.jsx(Ee,{delayDuration:100,content:t.tooltip,children:e})),u.jsx(ni,{className:t.disabled?"opacity-50!":"",onSelect:n=>{t.disableClick||t.disabled||t.handle(n)},variant:t.variant,children:e},t.label)}if(Ej)_j(QF),Ej();else{const t=await qm(()=>import("./loro_wasm_bg-C3hKWL9L.js").then(async e=>(await e.__tla,e)).then(e=>e.w),[],import.meta.url);_j(new WebAssembly.Instance(t.default,{"./loro_wasm_bg.js":ZF}).exports)}const I5=["Map","Text","List","Tree","MovableList","Counter"];function _x(t){if(typeof t!="object"||t==null)return!1;const e=Object.getPrototypeOf(t);return e!=null&&typeof e=="object"&&typeof e.kind=="function"&&I5.includes(t.kind())}Ij.prototype.toJsonWithReplacer=function(t){const e=new Set,n=this,o=(i,a)=>{if(typeof a=="string"&&a.startsWith("cid:")&&!e.has(a)){e.add(a);const c=n.getContainerById(a);if(c==null)throw new Error(`ContainerID not found: ${a}`);const d=t(i,c);if(d===c){const h=c.getShallowValue();return typeof h=="object"?r(h):h}if(_x(d))throw new Error("Using new container is not allowed in toJsonWithReplacer");return typeof d=="object"&&d!=null?r(d):d}if(typeof a=="object"&&a!=null)return r(a);const l=t(i,a);if(_x(l))throw new Error("Using new container is not allowed in toJsonWithReplacer");return l},r=i=>{if(Array.isArray(i))return i.map((l,c)=>o(c,l)).filter(l=>l!==void 0);const a={};for(const[l,c]of Object.entries(i)){const d=o(l,c);d!==void 0&&(a[l]=d)}return a},s=n.getShallowValue();return r(s)};const A5=We.baseTheme({".loro-cursor":{position:"absolute",width:"2px",display:"inline-block",height:"1.2em"},".loro-cursor::before":{position:"absolute",top:"1.3em",left:"0",content:"var(--rtc-name)",padding:"2px 6px",fontSize:"12px",borderRadius:"3px",whiteSpace:"nowrap",userSelect:"none",backgroundColor:"inherit",opacity:"0.7"},".loro-selection":{opacity:"0.5"}}),oi=Tt.define(),ku=vn.define({create:()=>({remoteCursors:new Map,isCheckout:!1}),update(t,e){for(const n of e.effects)if(n.is(oi))switch(n.value.type){case"update":{const{peer:o,user:r,cursor:s}=n.value;t.remoteCursors.set(o,{uid:o,cursor:s,user:r});break}case"delete":t.remoteCursors.delete(n.value.peer);break;case"checkout":t.isCheckout=n.value.checkout}return t}}),Ix=t=>{const e=t.transactions.flatMap(n=>n.effects).filter(n=>n.is(oi));return t.docChanged||t.viewportChanged||e.length>0};class sl{constructor(e,n,o,r,s){this.left=e,this.top=n,this.height=o,this.name=r,this.colorClassName=s}draw(){const e=document.createElement("div");return this.adjust(e),e}update(e){return this.adjust(e),!0}adjust(e){e.style.left=`${this.left}px`,e.style.top=`${this.top}px`,e.style.height=`${this.height}px`,e.className=`loro-cursor ${this.colorClassName}`,e.style.setProperty("--rtc-name",`"${this.name}"`)}eq(e){return this.left===e.left&&this.top===e.top&&this.height===e.height&&this.name===e.name}static createCursor(e,n,o,r){const s=sl.calculateAbsoluteCursorPosition(n,e);if(!s)return[];const i=e.scrollDOM.getBoundingClientRect(),a=(e.textDirection===tP.LTR?i.left:i.right-e.scrollDOM.clientWidth)-e.scrollDOM.scrollLeft,l=i.top-e.scrollDOM.scrollTop;return[new sl(s.left-a,s.top-l,s.bottom-s.top,o,r)]}static calculateAbsoluteCursorPosition(e,n){const o=Math.max(0,Math.min(n.state.doc.length,e.anchor));return n.coordsAtPos(o,e.assoc||1)}}const T5=(t,e,n,o)=>{const r=[],{updated:s,added:i}=n;for(const a of[...s,...i]){const l=Ax(t,e,a,o);l&&r.push(l)}return r},Ax=(t,e,n,o)=>{const r=e.getAllStates()[n];if(!r||n===t.peerIdStr||r.scopeId!==o)return;if(r.type==="delete")return oi.of({type:"delete",peer:r.uid,scopeId:r.scopeId});const s=Aj.decode(r.cursor.anchor),i=t.getCursorPos(s).offset;let a=i;if(r.cursor.head){const l=Aj.decode(r.cursor.head);a=t.getCursorPos(l).offset}return oi.of({type:"update",peer:r.uid,scopeId:r.scopeId,cursor:{anchor:i,head:a},user:r.user})};class M5{constructor(e,n,o,r,s,i,a){this.view=e,this.doc=n,this.user=o,this.awareness=r,this.getTextFromDoc=s,this.scopeId=i,this.getUserId=a,this.sub=void 0,this.sub=this.doc.subscribe(l=>{if(l.by==="local"){const c=[];for(const d of this.awareness.peers()){const h=Ax(this.doc,this.awareness,d,this.scopeId);h&&c.push(h)}this.view.dispatch({effects:c})}else l.by==="checkout"&&this.view.dispatch({effects:[oi.of({type:"checkout",checkout:this.doc.isDetached()})]})})}update(e){if(!e.selectionSet&&!e.focusChanged&&!e.docChanged)return;const n=e.state.selection.main;if(this.view.hasFocus&&!this.doc.isDetached()){const o=D5({doc:this.doc,getTextFromDoc:this.getTextFromDoc,anchor:n.anchor,head:n.head});this.awareness.setLocalState({type:"update",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId,cursor:o,user:this.user})}else this.awareness.setLocalState({type:"delete",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}destroy(){var e;(e=this.sub)==null||e.call(this),this.awareness.setLocalState({type:"delete",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}}class O5{constructor(e,n,o,r){this.view=e,this.doc=n,this.awareness=o,this.scopeId=r,this._awarenessListener=void 0;const s=async(i,a)=>{a!=="local"&&this.view.dispatch({effects:T5(this.doc,this.awareness,i,this.scopeId)})};this._awarenessListener=s,this.awareness.addListener(s)}destroy(){this._awarenessListener&&this.awareness.removeListener(this._awarenessListener)}}const D5=({doc:t,getTextFromDoc:e,anchor:n,head:o})=>{var i,a;n===o&&(o=void 0);const r=(i=e(t).getCursor(n))==null?void 0:i.encode();if(!r)throw new Error("cursor head not found");let s;return o!==void 0&&(s=(a=e(t).getCursor(o))==null?void 0:a.encode()),{anchor:r,head:s}},il=["bg-(--amber-6)","bg-(--blue-6)","bg-(--crimson-6)","bg-(--cyan-6)","bg-(--grass-6)","bg-(--gray-6)","bg-(--green-6)","bg-(--lime-6)","bg-(--orange-6)","bg-(--purple-6)","bg-(--red-6)","bg-(--sage-6)","bg-(--sky-6)","bg-(--slate-6)"],R5=(t,e,n)=>$n.define(o=>new P5(o,t,e,n)),Dr=Um.define();class P5{constructor(e,n,o,r){this.view=e,this.doc=n,this.docPath=o,this.getTextFromDoc=r,this.sub=void 0,this.isInitDispatch=!1,this.onRemoteUpdate=s=>{if(s.by!=="local")if(s.by!=="checkout"){if(s.by==="import"){const i=[];let a=0;for(const{diff:l,path:c}of s.events){if(c.join("/")!==this.docPath.join("/")||l.type!=="text")continue;const d=l.diff;for(const h of d)h.insert?i.push({from:a,to:a,insert:h.insert}):h.delete?(i.push({from:a,to:a+h.delete}),a+=h.delete):h.retain!=null&&(a+=h.retain);i.length>0&&this.view.dispatch({changes:i,annotations:[Dr.of(this)]})}}}else this.view.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:this.getTextFromDoc(this.doc).toString()}],annotations:[Dr.of(this)]})},this.sub=n.subscribe(this.onRemoteUpdate),Promise.resolve().then(()=>{this.isInitDispatch=!0;const s=this.view.state.doc.toString(),i=this.getTextFromDoc(this.doc);s!==i.toString()&&e.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:i.toString()}]})})}update(e){if(this.isInitDispatch)return void(this.isInitDispatch=!1);if(!e.docChanged||e.transactions.length>0&&(e.transactions[0].annotation(Dr)===this||e.transactions[0].annotation(Dr)==="undo"))return;let n=0;e.changes.iterChanges((o,r,s,i,a)=>{const l=a.sliceString(0,a.length,`
|
|
119
|
-
`);o!==r&&this.getTextFromDoc(this.doc).delete(o+n,r-o),l.length>0&&this.getTextFromDoc(this.doc).insert(o+n,l),n+=l.length-(r-o)}),this.doc.commit()}destroy(){var e;(e=this.sub)==null||e.call(this),this.sub=void 0}}const Jt=ut.get("rtc"),Tx=Jt.get("awareness").disabled(),Cu="awareness:",Rr=jt(void 0),Lt=new Ij,al=new class{constructor(t,e=3e4){this.listeners=new Set,this.inner=new ez(t,e),this.peer=t,this.timeout=e}apply(t,e="remote"){const{updated:n,added:o}=this.inner.apply(t);this.listeners.forEach(r=>{r({updated:n,added:o,removed:[]},e)}),this.startTimerIfNotEmpty()}setLocalState(t){const e=this.inner.getState(this.peer)==null;this.inner.setLocalState(t),e?this.listeners.forEach(n=>{n({updated:[],added:[this.inner.peer()],removed:[]},"local")}):this.listeners.forEach(n=>{n({updated:[this.inner.peer()],added:[],removed:[]},"local")}),this.startTimerIfNotEmpty()}getLocalState(){return this.inner.getState(this.peer)}getAllStates(){return this.inner.getAllStates()}encode(t){return this.inner.encode(t)}encodeAll(){return this.inner.encodeAll()}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}peers(){return this.inner.peers()}destroy(){clearInterval(this.timer),this.listeners.clear()}startTimerIfNotEmpty(){this.inner.isEmpty()||this.timer!=null||(this.timer=setInterval(()=>{const t=this.inner.removeOutdated();t.length>0&&this.listeners.forEach(e=>{e({updated:[],added:[],removed:t},"timeout")}),this.inner.isEmpty()&&(clearInterval(this.timer),this.timer=void 0)},this.timeout/2))}}(Lt.peerIdStr),ju=oP(()=>{Jt.debug("creating websocket");const t=nC().getWsSyncURL(gC()).toString(),e=new _F(t,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4});return Promise.resolve().then(async()=>{await oC(),rP()==="edit"&&e.reconnect()}),e.addEventListener("message",async n=>{const o=n.data,r=await o.arrayBuffer(),s=new Uint8Array(r);if(function(i,a){return new TextDecoder().decode(i.slice(0,a.length))===a}(s,Cu)){const i=function(a,l){return a.slice(l.length)}(s,Cu);return al.apply(i),void Tx.debug("applied awareness update")}Lt.import(s),Jt.debug("imported doc change. new doc:",Lt.toJSON()),Qe.get(Rr)!==Lt&&Qe.set(Rr,Lt)}),e.addEventListener("open",()=>{Jt.debug("websocket open")}),e.addEventListener("close",n=>{Jt.warn("websocket close",n),Qe.get(Rr)===Lt&&Qe.set(Rr,void 0)}),e});function Su(t,e,n=""){if(tn())return{extension:[],code:n};const o=Lt.getByPath(`codes/${t}`)!==void 0,r=Lt.getMap("codes").getOrCreateContainer(t,new hp);o||(Jt.log("initializing code for new cell",n),r.insert(0,n));const s={get name(){return Qe.get(xC)||"Anonymous"},get colorClassName(){return(i=>{if(typeof i=="string"){let a=0;for(let l=0;l<i.length;l++)a=(a<<5)-a+i.charCodeAt(l),a=Math.trunc(a);return il[Math.abs(a)%il.length]}return il[i%il.length]})(this.name)}};return{code:n.toString(),extension:[L5(t),F5(t),z5(Lt,al,s,()=>r,t),R5(Lt,["codes",t],()=>r)]}}function L5(t){const e=(o,r)=>{const s=o.state.field(Mc).type,i=r.toString();i&&i!==s&&(Jt.debug(`[incoming] setting language type: ${s} -> ${i}`),pr(o,{language:i,keepCodeAsIs:!0}))},n=(o,r)=>{const s=o.state.field(Ym),i=r.toJSON();Vi(s,i)||o.dispatch({effects:[mC.of(i)],annotations:[Dr.of(!0)]})};return $n.define(o=>{let r;return Promise.resolve().then(()=>{const s=Lt.getByPath(`languages/${t}`);if(!s)return void Jt.error("no language container found for cell",t);Un(s instanceof hp,"language type is not a LoroText");const i=Lt.getByPath(`language_metadata/${t}`);i?(Un(i instanceof Tj,"language metadata is not a LoroMap"),e(o,s),n(o,i),r=Lt.subscribe(a=>{if(a.origin==="local")return;const l=a.events.some(d=>d.target===s.id),c=a.events.some(d=>d.target===i.id);l&&e(o,s),c&&n(o,i)})):Jt.error("no language metadata container found for cell",t)}),{destroy(){r()}}})}function F5(t){const e=Lt.getMap("languages").getOrCreateContainer(t,new hp),n=Lt.getMap("language_metadata").getOrCreateContainer(t,new Tj);return We.updateListener.of(o=>{const r=e.toString()!=="";if(!o.docChanged&&r)return;if(!r){const i=Gm(o.state).type;pr(o.view,{language:i}),Jt.debug("no initial language, setting default to",i),e.delete(0,e.length),e.insert(0,i),Jt.debug("no initial language metadata, setting default to",o.state.field(Ym));const a=o.state.field(Ym);for(const l of Object.keys(a))n.set(l,a[l]);return void Lt.commit()}let s=!1;for(const i of o.transactions)if(!i.annotation(Dr)){for(const a of i.effects)if(a.is(nP)&&e.toString()!==a.value.type&&(Jt.debug(`[outgoing] language change: ${e} -> ${a.value.type}`),e.delete(0,e.length),e.insert(0,a.value.type),s=!0),a.is(mC)||a.is(pC)){const l=a.value;a.is(pC)?(Jt.debug("[outgoing] setting language metadata: ",l),n.clear()):Jt.debug("[outgoing] updating language metadata: ",l);for(const c of Object.keys(l))n.set(c,l[c]);s=!0}}s&&Lt.commit()})}function z5(t,e,n,o,r,s){const i=`loro:cell:${r}`;return[ku,fC({above:!0,class:"loro-cursor-layer",update:Ix,markers:a=>{const{remoteCursors:l,isCheckout:c}=a.state.field(ku);return c?[]:[...l.values()].flatMap(d=>{var f,m;const h=Qn.cursor(d.cursor.anchor);return sl.createCursor(a,h,((f=d.user)==null?void 0:f.name)||"unknown",((m=d.user)==null?void 0:m.colorClassName)||"")})}}),fC({above:!1,class:"loro-selection-layer",update:Ix,markers:a=>{const{remoteCursors:l,isCheckout:c}=a.state.field(ku);return c?[]:[...l.entries()].filter(([,d])=>d.cursor.head!==void 0&&d.cursor.anchor!==d.cursor.head).flatMap(([,d])=>{var f;const h=Qn.range(d.cursor.anchor,d.cursor.head);return eP.forRange(a,`loro-selection ${((f=d.user)==null?void 0:f.colorClassName)||""}`,h)})}}),$n.define(a=>new M5(a,t,n,e,o,i,s)),$n.define(a=>new O5(a,t,e,i)),A5]}function ll(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}Pc()&&ju(),Lt.subscribeLocalUpdates(t=>{Jt.debug("local update, sending to server"),ju().send(t)}),al.addListener((t,e)=>{const n=[...t.added,...t.removed,...t.updated];e==="local"&&(Tx.debug("awareness changes",n),ju().send(function(o,r){const s=new TextEncoder().encode(o);return new Uint8Array([...s,...r])}(Cu,al.encode(n))))});var Mx={modified:{doc:""},original:{doc:""}},Ox=M.createContext(Mx);function B5(t,e){return vt({},t,e,{modified:vt({},t.modified,e.modified),original:vt({},t.original,e.original)})}var Nu=()=>M.useContext(Ox),U5=t=>{var{children:e,theme:n}=t,[o,r]=M.useReducer(B5,vt({},Mx,{theme:n}));return M.useEffect(()=>r({theme:n}),[n]),u.jsx(Ox.Provider,{value:vt({},o,{dispatch:r}),children:e})},$5=["extensions","value","selection","onChange"],Dx=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=ea(t,$5),{theme:i,dispatch:a}=Nu(),l=ks(vt({},s,{theme:i}));return M.useEffect(()=>a({original:{doc:n,selection:o,extensions:[...l,...e]},originalExtension:{onChange:r,option:s,extension:[e]}}),[t]),null};Dx.displayName="CodeMirrorMerge.Original";var V5=["extensions","value","selection","onChange"],Rx=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=ea(t,V5),{theme:i,dispatch:a}=Nu(),l=ks(vt({},s,{theme:i}));return M.useEffect(()=>{a({modified:{doc:n,selection:o,extensions:[...l,...e]},modifiedExtension:{onChange:r,option:s,extension:[e]}})},[t]),null};Rx.displayName="CodeMirrorMerge.Modified";class Et{constructor(e,n,o,r){this.fromA=e,this.toA=n,this.fromB=o,this.toB=r}offset(e,n=e){return new Et(this.fromA+e,this.toA+e,this.fromB+n,this.toB+n)}}function ar(t,e,n,o,r,s){if(t==o)return[];let i=Au(t,e,n,o,r,s),a=Tu(t,e+i,n,o,r+i,s),l=(n-=a)-(e+=i),c=(s-=a)-(r+=i);if(!l||!c)return[new Et(e,n,r,s)];if(l>c){let h=t.slice(e,n).indexOf(o.slice(r,s));if(h>-1)return[new Et(e,e+h,r,r),new Et(e+h+c,n,s,s)]}else if(c>l){let h=o.slice(r,s).indexOf(t.slice(e,n));if(h>-1)return[new Et(e,e,r,r+h),new Et(n,n,r+h+l,s)]}if(l==1||c==1)return[new Et(e,n,r,s)];let d=Fx(t,e,n,o,r,s);if(d){let[h,f,m]=d;return ar(t,e,h,o,r,f).concat(ar(t,h+m,n,o,f+m,s))}return function(h,f,m,g,x,p){let b=m-f,y=p-x;if(ri<1e9&&Math.min(b,y)>16*ri||si>0&&Date.now()>si)return Math.min(b,y)>64*ri?[new Et(f,m,x,p)]:zx(h,f,m,g,x,p);let v=Math.ceil((b+y)/2);_u.reset(v),Iu.reset(v);let w=(S,E)=>h.charCodeAt(f+S)==g.charCodeAt(x+E),j=(S,E)=>h.charCodeAt(m-S-1)==g.charCodeAt(p-E-1),C=(b-y)%2!=0?Iu:null,N=C?null:_u;for(let S=0;S<v;S++){if(S>ri||si>0&&!(63&S)&&Date.now()>si)return zx(h,f,m,g,x,p);let E=_u.advance(S,b,y,v,C,!1,w)||Iu.advance(S,b,y,v,N,!0,j);if(E)return H5(h,f,m,f+E[0],g,x,p,x+E[1])}return[new Et(f,m,x,p)]}(t,e,n,o,r,s)}let ri=1e9,si=0,Eu=!1;class Px{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,n,o,r,s,i,a){for(let l=-e+this.start;l<=e-this.end;l+=2){let c=r+l,d=l==-e||l!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,h=d-l;for(;d<n&&h<o&&a(d,h);)d++,h++;if(this.vec[c]=d,d>n)this.end+=2;else if(h>o)this.start+=2;else if(s){let f=r+(n-o)-l;if(f>=0&&f<this.len&&s.vec[f]!=-1){if(i){let m=s.vec[f];if(m>=n-d)return[m,r+m-f]}else if(d>=n-s.vec[f])return[d,h]}}}return null}}const _u=new Px,Iu=new Px;function H5(t,e,n,o,r,s,i,a){let l=!1;return Pr(t,o)||++o!=n||(l=!0),Pr(r,a)||++a!=i||(l=!0),l?[new Et(e,n,s,i)]:ar(t,e,o,r,s,a).concat(ar(t,o,n,r,a,i))}function Lx(t,e){let n=1,o=Math.min(t,e);for(;n<o;)n<<=1;return n}function Au(t,e,n,o,r,s){if(e==n||e==s||t.charCodeAt(e)!=o.charCodeAt(r))return 0;let i=Lx(n-e,s-r);for(let a=e,l=r;;){let c=a+i,d=l+i;if(c>n||d>s||t.slice(a,c)!=o.slice(l,d)){if(i==1)return a-e-(Pr(t,a)?0:1);i>>=1}else{if(c==n||d==s)return c-e;a=c,l=d}}}function Tu(t,e,n,o,r,s){if(e==n||r==s||t.charCodeAt(n-1)!=o.charCodeAt(s-1))return 0;let i=Lx(n-e,s-r);for(let a=n,l=s;;){let c=a-i,d=l-i;if(c<e||d<r||t.slice(c,a)!=o.slice(d,l)){if(i==1)return n-a-(Pr(t,a)?0:1);i>>=1}else{if(c==e||d==r)return n-c;a=c,l=d}}}function Mu(t,e,n,o,r,s,i,a){let l=o.slice(r,s),c=null;for(;;){if(c||i<a)return c;for(let d=e+i;;){Pr(t,d)||d++;let h=d+i;if(Pr(t,h)||(h+=h==d+1?1:-1),h>=n)break;let f=t.slice(d,h),m=-1;for(;(m=l.indexOf(f,m+1))!=-1;){let g=Au(t,h,n,o,r+m+f.length,s),x=Tu(t,e,d,o,r,r+m),p=f.length+g+x;(!c||c[2]<p)&&(c=[d-x,r+m-x,p])}d=h}if(a<0)return c;i>>=1}}function Fx(t,e,n,o,r,s){let i=n-e,a=s-r;if(i<a){let l=Fx(o,r,s,t,e,n);return l&&[l[1],l[0],l[2]]}return i<4||2*a<i?null:Mu(t,e,n,o,r,s,Math.floor(i/4),-1)}function zx(t,e,n,o,r,s){Eu=!0;let i,a=n-e,l=s-r;if(a<l){let f=Mu(o,r,s,t,e,n,Math.floor(a/6),50);i=f&&[f[1],f[0],f[2]]}else i=Mu(t,e,n,o,r,s,Math.floor(l/6),50);if(!i)return[new Et(e,n,r,s)];let[c,d,h]=i;return ar(t,e,c,o,r,d).concat(ar(t,c+h,n,o,d+h,s))}function Bx(t,e){for(let n=1;n<t.length;n++){let o=t[n-1],r=t[n];o.toA>r.fromA-e&&o.toB>r.fromB-e&&(t[n-1]=new Et(o.fromA,r.toA,o.fromB,r.toB),t.splice(n--,1))}}let lr;try{lr=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function Ux(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function $x(t,e){if(e==t.length)return 0;let n=t.charCodeAt(e);return n<192?Ux(n)?1:0:lr?Kx(n)&&e!=t.length-1?lr.test(t.slice(e,e+2))?2:0:lr.test(String.fromCharCode(n))?1:0:0}function Vx(t,e){if(!e)return 0;let n=t.charCodeAt(e-1);return n<192?Ux(n)?1:0:lr?Xx(n)&&e!=1?lr.test(t.slice(e-2,e))?2:0:lr.test(String.fromCharCode(n))?1:0:0}const Hx=8;function Wx(t,e,n){if(e==t.length||!Vx(t,e))return e;for(let o=e,r=e+n,s=0;s<Hx;s++){let i=$x(t,o);if(!i||o+i>r)return o;o+=i}return e}function qx(t,e,n){if(!e||!$x(t,e))return e;for(let o=e,r=e-n,s=0;s<Hx;s++){let i=Vx(t,o);if(!i||o-i<r)return o;o-=i}return e}function Gx(t,e,n){for(;e!=n;e--)if(t.charCodeAt(e-1)==10)return e;return-1}function Yx(t,e,n){for(;e!=n;e++)if(t.charCodeAt(e)==10)return e;return-1}const Kx=t=>t>=55296&&t<=56319,Xx=t=>t>=56320&&t<=57343;function Pr(t,e){return!e||e==t.length||!Kx(t.charCodeAt(e-1))||!Xx(t.charCodeAt(e))}function W5(t,e,n){var o;return ri=((o=n==null?void 0:n.scanLimit)!==null&&o!==void 0?o:1e9)>>1,si=n!=null&&n.timeout?Date.now()+n.timeout:0,Eu=!1,function(r,s,i){for(;;){Bx(i,1);let a=!1;for(let l=0;l<i.length;l++){let c,d,h=i[l];(c=Au(r,h.fromA,h.toA,s,h.fromB,h.toB))&&(h=i[l]=new Et(h.fromA+c,h.toA,h.fromB+c,h.toB)),(d=Tu(r,h.fromA,h.toA,s,h.fromB,h.toB))&&(h=i[l]=new Et(h.fromA,h.toA-d,h.fromB,h.toB-d));let f=h.toA-h.fromA,m=h.toB-h.fromB;if(f&&m)continue;let g=h.fromA-(l?i[l-1].toA:0),x=(l<i.length-1?i[l+1].fromA:r.length)-h.toA;if(!g||!x)continue;let p=f?r.slice(h.fromA,h.toA):s.slice(h.fromB,h.toB);g<=p.length&&r.slice(h.fromA-g,h.fromA)==p.slice(p.length-g)?(i[l]=new Et(h.fromA-g,h.toA-g,h.fromB-g,h.toB-g),a=!0):x<=p.length&&r.slice(h.toA,h.toA+x)==p.slice(0,x)&&(i[l]=new Et(h.fromA+x,h.toA+x,h.fromB+x,h.toB+x),a=!0)}if(!a)break}return i}(t,e,ar(t,0,t.length,e,0,e.length))}function Jx(){return!Eu}function Zx(t,e,n){return function(o,r,s){for(let i=0,a=0;a<o.length;a++){let l=o[a],c=l.toA-l.fromA,d=l.toB-l.fromB;if(c&&d||c>3||d>3){let h=a==o.length-1?r.length:o[a+1].fromA,f=l.fromA-i,m=h-l.toA,g=qx(r,l.fromA,f),x=Wx(r,l.toA,m),p=l.fromA-g,b=x-l.toA;if((!c||!d)&&p&&b){let y=Math.max(c,d),[v,w,j]=c?[r,l.fromA,l.toA]:[s,l.fromB,l.toB];y>p&&r.slice(g,l.fromA)==v.slice(j-p,j)?(l=o[a]=new Et(g,g+c,l.fromB-p,l.toB-p),g=l.fromA,x=Wx(r,l.toA,h-l.toA)):y>b&&r.slice(l.toA,x)==v.slice(w,w+b)&&(l=o[a]=new Et(x-c,x,l.fromB+b,l.toB+b),x=l.toA,g=qx(r,l.fromA,l.fromA-i)),p=l.fromA-g,b=x-l.toA}if(p||b)l=o[a]=new Et(l.fromA-p,l.toA+b,l.fromB-p,l.toB+b);else if(c){if(!d){let y,v=Yx(r,l.fromA,l.toA),w=v<0?-1:Gx(r,l.toA,l.fromA);v>-1&&(y=v-l.fromA)<=m&&r.slice(l.fromA,v)==r.slice(l.toA,l.toA+y)?l=o[a]=l.offset(y):w>-1&&(y=l.toA-w)<=f&&r.slice(l.fromA-y,l.fromA)==r.slice(w,l.toA)&&(l=o[a]=l.offset(-y))}}else{let y,v=Yx(s,l.fromB,l.toB),w=v<0?-1:Gx(s,l.toB,l.fromB);v>-1&&(y=v-l.fromB)<=m&&s.slice(l.fromB,v)==s.slice(l.toB,l.toB+y)?l=o[a]=l.offset(y):w>-1&&(y=l.toB-w)<=f&&s.slice(l.fromB-y,l.fromB)==s.slice(w,l.toB)&&(l=o[a]=l.offset(-y))}}i=l.toA}return Bx(o,3),o}(W5(t,e,n),t,e)}const Wn=yr.define({combine:t=>t[0]}),Ou=Tt.define(),q5=yr.define(),Lr=vn.define({create:t=>null,update(t,e){for(let n of e.effects)n.is(Ou)&&(t=n.value);for(let n of e.state.facet(q5))t=n(t,e);return t}});class Fr{constructor(e,n,o,r,s,i=!0){this.changes=e,this.fromA=n,this.toA=o,this.fromB=r,this.toB=s,this.precise=i}offset(e,n){return e||n?new Fr(this.changes,this.fromA+e,this.toA+e,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,n,o){return tb(Zx(e.toString(),n.toString(),o),e,n,0,0,Jx())}static updateA(e,n,o,r,s){return rb(ob(e,r,!0,o.length),e,n,o,s)}static updateB(e,n,o,r,s){return rb(ob(e,r,!1,n.length),e,n,o,s)}}function Qx(t,e,n,o){let r=n.lineAt(t),s=o.lineAt(e);return r.to==t&&s.to==e&&t<n.length&&e<o.length?[t+1,e+1]:[r.from,s.from]}function eb(t,e,n,o){let r=n.lineAt(t),s=o.lineAt(e);return r.from==t&&s.from==e?[t,e]:[r.to+1,s.to+1]}function tb(t,e,n,o,r,s){let i=[];for(let a=0;a<t.length;a++){let l=t[a],[c,d]=Qx(l.fromA+o,l.fromB+r,e,n),[h,f]=eb(l.toA+o,l.toB+r,e,n),m=[l.offset(-c+o,-d+r)];for(;a<t.length-1;){let g=t[a+1],[x,p]=Qx(g.fromA+o,g.fromB+r,e,n);if(x>h+1&&p>f+1)break;m.push(g.offset(-c+o,-d+r)),[h,f]=eb(g.toA+o,g.toB+r,e,n),a++}i.push(new Fr(m,c,Math.max(c,h),d,Math.max(d,f),s))}return i}const cl=1e3;function nb(t,e,n,o){let r=0,s=t.length;for(;;){if(r==s){let d=0,h=0;r&&({toA:d,toB:h}=t[r-1]);let f=e-(n?d:h);return[d+f,h+f]}let i=r+s>>1,a=t[i],[l,c]=n?[a.fromA,a.toA]:[a.fromB,a.toB];if(l>e)s=i;else{if(!(c<=e))return o?[a.fromA,a.fromB]:[a.toA,a.toB];r=i+1}}}function ob(t,e,n,o){let r=[];return e.iterChangedRanges((s,i,a,l)=>{let c=0,d=n?e.length:o,h=0,f=n?o:e.length;s>cl&&([c,h]=nb(t,s-cl,n,!0)),i<e.length-cl&&([d,f]=nb(t,i+cl,n,!1));let m,g=l-a-(i-s),[x,p]=n?[g,0]:[0,g];r.length&&(m=r[r.length-1]).toA>=c?r[r.length-1]={fromA:m.fromA,fromB:m.fromB,toA:d,toB:f,diffA:m.diffA+x,diffB:m.diffB+p}:r.push({fromA:c,toA:d,fromB:h,toB:f,diffA:x,diffB:p})}),r}function rb(t,e,n,o,r){if(!t.length)return e;let s=[];for(let i=0,a=0,l=0,c=0;;i++){let d=i==t.length?null:t[i],h=d?d.fromA+a:n.length,f=d?d.fromB+l:o.length;for(;c<e.length;){let p=e[c];if(p.toA+a>h||p.toB+l>f)break;s.push(p.offset(a,l)),c++}if(!d)break;let m=d.toA+a+d.diffA,g=d.toB+l+d.diffB,x=Zx(n.sliceString(h,m),o.sliceString(f,g),r);for(let p of tb(x,n,o,h,f,Jx()))s.push(p);for(a+=d.diffA,l+=d.diffB;c<e.length;){let p=e[c];if(p.fromA+a>m&&p.fromB+l>g)break;c++}}return s}const G5={scanLimit:500},sb=$n.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=lb(t))}update(t){var e,n;(t.docChanged||t.viewportChanged||(e=t.startState,n=t.state,e.field(Lr,!1)!=n.field(Lr,!1))||function(o,r){return o.facet(Wn)!=r.facet(Wn)}(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=lb(t.view))}},{decorations:t=>t.deco}),dl=To.low(iP({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(sb))===null||e===void 0?void 0:e.gutter)||aP.empty}})),ib=ot.line({class:"cm-changedLine"}),Y5=ot.mark({class:"cm-changedText"}),K5=ot.mark({tagName:"ins",class:"cm-insertedLine"}),X5=ot.mark({tagName:"del",class:"cm-deletedLine"}),ab=new class extends lP{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function J5(t,e,n,o,r,s){let i=n?t.fromA:t.fromB,a=n?t.toA:t.toB,l=0;if(i!=a){r.add(i,i,ib),r.add(i,a,n?X5:K5),s&&s.add(i,i,ab);for(let c=e.iterRange(i,a-1),d=i;!c.next().done;){if(c.lineBreak){d++,r.add(d,d,ib),s&&s.add(d,d,ab);continue}let h=d+c.value.length;if(o)for(;l<t.changes.length;){let f=t.changes[l],m=i+(n?f.fromA:f.fromB),g=i+(n?f.toA:f.toB),x=Math.max(d,m),p=Math.min(h,g);if(x<p&&r.add(x,p,Y5),!(g<h))break;l++}d=h}}}function lb(t){let e=t.state.field(Lr),{side:n,highlightChanges:o,markGutter:r,overrideChunk:s}=t.state.facet(Wn),i=n=="a",a=new ms,l=r?new ms:null,{from:c,to:d}=t.viewport;for(let h of e){if((i?h.fromA:h.fromB)>=d)break;(i?h.toA:h.toB)>c&&(s&&s(t.state,h,a,l)||J5(h,t.state.doc,i,o,a,l))}return{deco:a.finish(),gutter:l&&l.finish()}}class ul extends bs{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement("div");return e.className="cm-mergeSpacer",e.style.height=this.height+"px",e}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}const hl=Tt.define({map:(t,e)=>t.map(e)}),ii=vn.define({create:()=>ot.none,update:(t,e)=>{for(let n of e.effects)if(n.is(hl))return n.value;return t.map(e.changes)},provide:t=>We.decorations.from(t)}),Du=.01;function cb(t,e){if(t.size!=e.size)return!1;let n=t.iter(),o=e.iter();for(;n.value;){if(n.from!=o.from||Math.abs(n.value.spec.widget.height-o.value.spec.widget.height)>1)return!1;n.next(),o.next()}return!0}const Ru=Tt.define({map:(t,e)=>e.mapPos(t)});class Z5 extends bs{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let n=document.createElement("div");return n.className="cm-collapsedLines",n.textContent=e.state.phrase("$ unchanged lines",this.lines),n.addEventListener("click",o=>{let r=e.posAtDOM(o.target);e.dispatch({effects:Ru.of(r)});let{side:s,sibling:i}=e.state.facet(Wn);i&&i().dispatch({effects:Ru.of(Q5(r,e.state.field(Lr),s=="a"))})}),n}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function Q5(t,e,n){let o=0,r=0;for(let s=0;;s++){let i=s<e.length?e[s]:null;if(!i||(n?i.fromA:i.fromB)>=t)return r+(t-o);[o,r]=n?[i.toA,i.toB]:[i.toB,i.toA]}}const e_=vn.define({create:t=>ot.none,update(t,e){t=t.map(e.changes);for(let n of e.effects)n.is(Ru)&&(t=t.update({filter:o=>o!=n.value}));return t},provide:t=>We.decorations.from(t)});function db({margin:t=3,minSize:e=4}){return e_.init(n=>function(o,r,s){let i=new ms,a=o.facet(Wn).side=="a",l=o.field(Lr),c=1;for(let d=0;;d++){let h=d<l.length?l[d]:null,f=d?c+r:1,m=h?o.doc.lineAt(a?h.fromA:h.fromB).number-1-r:o.doc.lines,g=m-f+1;if(g>=s&&i.add(o.doc.line(f).from,o.doc.line(m).to,ot.replace({widget:new Z5(g),block:!0})),!h)break;c=o.doc.lineAt(Math.min(o.doc.length,a?h.toA:h.toB)).number}return i.finish()}(n,t,e))}const t_=We.styleModule.of(new sP({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),n_=We.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"\u299A"',marginInlineEnd:"7px"},"&:after":{content:'"\u299A"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),ub=new $m,fl=new $m;class hb{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||G5;let n=[To.low(sb),n_,t_,ii,We.updateListener.of(h=>{this.measuring<0&&(h.heightChanged||h.viewportChanged)&&!h.transactions.some(f=>f.effects.some(m=>m.is(hl)))&&this.measure()})],o=[Wn.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&o.push(dl);let r=Ji.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],We.editorAttributes.of({class:"cm-merge-a"}),fl.of(o),n]}),s=[Wn.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&s.push(dl);let i=Ji.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],We.editorAttributes.of({class:"cm-merge-b"}),fl.of(s),n]});this.chunks=Fr.build(r.doc,i.doc,this.diffConf);let a=[Lr.init(()=>this.chunks),ub.of(e.collapseUnchanged?db(e.collapseUnchanged):[])];r=r.update({effects:Tt.appendConfig.of(a)}).state,i=i.update({effects:Tt.appendConfig.of(a)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let l=e.orientation||"a-b",c=document.createElement("div");c.className="cm-mergeViewEditor";let d=document.createElement("div");d.className="cm-mergeViewEditor",this.editorDOM.appendChild(l=="a-b"?c:d),this.editorDOM.appendChild(l=="a-b"?d:c),this.a=new We({state:r,parent:c,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.a)}),this.b=new We({state:i,parent:d,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,n){if(e.some(o=>o.docChanged)){let o=e[e.length-1],r=e.reduce((i,a)=>i.compose(a.changes),Ki.empty(e[0].startState.doc.length));this.chunks=n==this.a?Fr.updateA(this.chunks,o.newDoc,this.b.state.doc,r,this.diffConf):Fr.updateB(this.chunks,this.a.state.doc,o.newDoc,r,this.diffConf),n.update([...e,o.state.update({effects:Ou.of(this.chunks)})]);let s=n==this.a?this.b:this.a;s.update([s.state.update({effects:Ou.of(this.chunks)})]),this.scheduleMeasure()}else n.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let s=e.orientation!="b-a";if(s!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let i=this.a.dom.parentNode,a=this.b.dom.parentNode;i.remove(),a.remove(),this.editorDOM.insertBefore(s?i:a,this.editorDOM.firstChild),this.editorDOM.appendChild(s?a:i),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let s=!!this.revertDOM,i=this.revertToA,a=this.renderRevert;"revertControls"in e&&(s=!!e.revertControls,i=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(a=e.renderRevertControl),this.setupRevertControls(s,i,a)}let n="highlightChanges"in e,o="gutter"in e,r="collapseUnchanged"in e;if(n||o||r){let s=[],i=[];if(n||o){let a=this.a.state.facet(Wn),l=o?e.gutter!==!1:a.markGutter,c=n?e.highlightChanges!==!1:a.highlightChanges;s.push(fl.reconfigure([Wn.of({side:"a",sibling:()=>this.b,highlightChanges:c,markGutter:l}),l?dl:[]])),i.push(fl.reconfigure([Wn.of({side:"b",sibling:()=>this.a,highlightChanges:c,markGutter:l}),l?dl:[]]))}if(r){let a=ub.reconfigure(e.collapseUnchanged?db(e.collapseUnchanged):[]);s.push(a),i.push(a)}this.a.dispatch({effects:s}),this.b.dispatch({effects:i})}this.scheduleMeasure()}setupRevertControls(e,n,o){this.revertToA=n,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=o,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",r=>this.revertClicked(r)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){(function(e,n,o){let r=new ms,s=new ms,i=e.state.field(ii).iter(),a=n.state.field(ii).iter(),l=0,c=0,d=0,h=0,f=e.viewport,m=n.viewport;for(let b=0;;b++){let y=b<o.length?o[b]:null,v=y?y.fromA:e.state.doc.length,w=y?y.fromB:n.state.doc.length;if(l<v){let j=e.lineBlockAt(l).top+d-(n.lineBlockAt(c).top+h);j<-.01?(d-=j,r.add(l,l,ot.widget({widget:new ul(-j),block:!0,side:-1}))):j>Du&&(h+=j,s.add(c,c,ot.widget({widget:new ul(j),block:!0,side:-1})))}if(v>l+1e3&&l<f.from&&v>f.from&&c<m.from&&w>m.from){let j=Math.min(f.from-l,m.from-c);l+=j,c+=j,b--}else{if(!y)break;l=y.toA,c=y.toB}for(;i.value&&i.from<l;)d-=i.value.spec.widget.height,i.next();for(;a.value&&a.from<c;)h-=a.value.spec.widget.height,a.next()}for(;i.value;)d-=i.value.spec.widget.height,i.next();for(;a.value;)h-=a.value.spec.widget.height,a.next();let g=e.contentHeight+d-(n.contentHeight+h);g<Du?r.add(e.state.doc.length,e.state.doc.length,ot.widget({widget:new ul(-g),block:!0,side:1})):g>Du&&s.add(n.state.doc.length,n.state.doc.length,ot.widget({widget:new ul(g),block:!0,side:1}));let x=r.finish(),p=s.finish();cb(x,e.state.field(ii))||e.dispatch({effects:hl.of(x)}),cb(p,n.state.field(ii))||n.dispatch({effects:hl.of(p)})})(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,n=e.firstChild,o=this.a.viewport,r=this.b.viewport;for(let s=0;s<this.chunks.length;s++){let i=this.chunks[s];if(i.fromA>o.to||i.fromB>r.to)break;if(i.fromA<o.from||i.fromB<r.from)continue;let a=this.a.lineBlockAt(i.fromA).top+"px";for(;n&&+n.dataset.chunk<s;)n=fb(n);n&&n.dataset.chunk==String(s)?(n.style.top!=a&&(n.style.top=a),n=n.nextSibling):e.insertBefore(this.renderRevertButton(a,s),n)}for(;n;)n=fb(n)}renderRevertButton(e,n){let o;if(this.renderRevert)o=this.renderRevert();else{o=document.createElement("button");let r=this.a.state.phrase("Revert this chunk");o.setAttribute("aria-label",r),o.setAttribute("title",r),o.textContent=this.revertToLeft?"\u21DC":"\u21DD"}return o.style.top=e,o.setAttribute("data-chunk",String(n)),o}revertClicked(e){let n,o=e.target;for(;o&&o.parentNode!=this.revertDOM;)o=o.parentNode;if(o&&(n=this.chunks[o.dataset.chunk])){let[r,s,i,a,l,c]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],d=r.state.sliceDoc(i,Math.max(i,a-1));i!=a&&c<=s.state.doc.length&&(d+=r.state.lineBreak),s.dispatch({changes:{from:l,to:Math.min(s.state.doc.length,c),insert:d},userEvent:"revert"}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}}function fb(t){let e=t.nextSibling;return t.remove(),e}var o_=["className","children","orientation","revertControls","highlightChanges","gutter","collapseUnchanged","destroyRerender","renderRevertControl","diffConfig","root"],r_=["modified","modifiedExtension","original","originalExtension","theme","dispatch"],mb=q.forwardRef((t,e)=>{var{className:n,children:o,orientation:r,revertControls:s,highlightChanges:i,gutter:a,collapseUnchanged:l,destroyRerender:c=!0,renderRevertControl:d,diffConfig:h,root:f}=t,m=ea(t,o_),g=Nu(),{modified:x,modifiedExtension:p,original:b,originalExtension:y,theme:v,dispatch:w}=g,j=ea(g,r_),C=M.useRef(null),N=M.useRef(),S={orientation:r,revertControls:s,highlightChanges:i,gutter:a,collapseUnchanged:l,renderRevertControl:d,diffConfig:h,root:f};M.useImperativeHandle(e,()=>({container:C.current,view:N.current,modified:x,original:b,config:vt({a:b,b:x,parent:C.current},S)}),[C,N,x,b,S]);var E=We.updateListener.of(I=>{if(I.docChanged&&typeof(y==null?void 0:y.onChange)=="function"){var D=I.state.doc.toString();y==null||y.onChange(D,I)}}),T=We.updateListener.of(I=>{if(I.docChanged&&typeof(p==null?void 0:p.onChange)=="function"){var D=I.state.doc.toString();p==null||p.onChange(D,I)}});return M.useEffect(()=>{!N.current&&C.current&&y&&p&&(N.current=new hb(vt({a:vt({},b,{extensions:[...(y==null?void 0:y.extension)||[],...ks(vt({},y==null?void 0:y.option,{theme:v})),E]}),b:vt({},x,{extensions:[...(p==null?void 0:p.extension)||[],...ks(vt({},p==null?void 0:p.option,{theme:v})),T]}),parent:C.current},S)),w({view:N.current}))},[N,C,y,p]),M.useEffect(()=>{if(b&&b.doc&&N.current){var I,D,F=(I=N.current)==null?void 0:I.a.state.doc.toString();F!==b.doc&&((D=N.current)==null||D.a.dispatch({changes:{from:0,to:F.length,insert:b.doc||""}}))}if(x&&x.doc&&N.current){var O,R,P=(O=N.current)==null?void 0:O.b.state.doc.toString();P!==x.doc&&((R=N.current)==null||R.b.dispatch({changes:{from:0,to:P.length,insert:x.doc||""}}))}if(c&&N.current){var z=N.current.a.state.selection.ranges[0].from,_=N.current.b.state.selection.ranges[0].from;N.current.destroy(),N.current=new hb(vt({a:vt({},b,{extensions:[...(y==null?void 0:y.extension)||[],...ks(vt({},y==null?void 0:y.option,{theme:v}))]}),b:vt({},x,{extensions:[...(p==null?void 0:p.extension)||[],...ks(vt({},p==null?void 0:p.option,{theme:v}))]}),parent:C.current},S)),z&&(N.current.a.focus(),N.current.a.dispatch({selection:{anchor:z,head:z}})),_&&(N.current.b.focus(),N.current.b.dispatch({selection:{anchor:_,head:_}}))}},[N,v,C.current,b,x,y,p,c]),M.useEffect(()=>()=>N.current&&N.current.destroy(),[]),M.useEffect(()=>{if(N.current){var I={};j.orientation!==r&&(I.orientation=r),j.revertControls!==s&&(I.revertControls=s),j.highlightChanges!==i&&(I.highlightChanges=i),j.gutter!==a&&(I.gutter=a),j.collapseUnchanged!==l&&(I.collapseUnchanged=l),j.renderRevertControl!==d&&(I.collapseUnchanged=l),Object.keys(I).length&&w&&N.current&&(N.current.reconfigure(vt({},I)),w(vt({},I)))}},[w,N,r,s,i,a,l,d]),u.jsx("div",vt({ref:C,className:"cm-merge-theme"+(n?" "+n:"")},m,{children:o}))});mb.displayName="CodeMirrorMerge.Internal";var s_=["theme"],zr=q.forwardRef((t,e)=>{var{theme:n}=t,o=ea(t,s_);return u.jsx(U5,{theme:n,children:u.jsx(mb,vt({},o,{ref:e}))})});zr.Original=Dx,zr.Modified=Rx,zr.displayName="CodeMirrorMerge";const i_=zr.Original,a_=zr.Modified,pb=[hP(),We.lineWrapping],l_=t=>{const e=H.c(23),{className:n,onChange:o,initialPrompt:r,currentLanguageAdapter:s,currentCode:i,declineChange:a,acceptChange:l,enabled:c,children:d}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={},e[0]=h):h=e[0];const[f,m]=M.useState(h),[g,x]=zt(Hj),p=M.useId(),b=Km(),{completion:y,input:v,stop:w,isLoading:j,setCompletion:C,setInput:N,handleSubmit:S}=cP({api:b.getAiURL("completion").toString(),headers:b.headers(),initialInput:r,streamProtocol:"text",experimental_throttle:100,body:{...f,includeOtherCode:g?Tc(i):"",code:i,language:s},onError:c_,onFinish:(G,W)=>{E(W.trimEnd())}}),E=C,T=q.useRef(null),I=y.trimEnd();let D,F;e[1]!==c?(D=()=>{var G;c&&(fP(()=>{const W=T.current;return!!(W!=null&&W.view)&&(W.view.focus(),!0)},{retries:3,delay:100,initialDelay:100}),mP((G=T.current)==null?void 0:G.view))},F=[c],e[1]=c,e[2]=D,e[3]=F):(D=e[2],F=e[3]),M.useEffect(D,F),M.useEffect(()=>{c&&N(r||"")},[c,r,N]);const{theme:O}=vr(),R=()=>{l(I),E("")},P=()=>{E("")};let z;e[4]!==n?(z=xe("flex flex-col w-full rounded-[inherit]",n),e[4]=n,e[5]=z):z=e[5];const _=c&&"max-h-[400px] min-h-11 visible",k=!c&&"max-h-0 min-h-0 invisible";let B;e[6]!==_||e[7]!==k?(B=xe("flex items-center gap-2 border-b px-3 transition-all rounded-[inherit] rounded-b-none duration-300",_,k),e[6]=_,e[7]=k,e[8]=B):B=e[8];const A=c&&u.jsxs(u.Fragment,{children:[u.jsx(Pi,{className:"text-(--blue-10) shrink-0",size:16}),u.jsx(Lc,{inputRef:T,className:"h-full my-0 py-1.5",onClose:()=>{a(),E("")},value:v,onChange:G=>{N(G),m(bC({input:G}))},onSubmit:()=>{j||S()},onKeyDown:dP({handleAcceptCompletion:R,handleDeclineCompletion:P,isLoading:j,completion:I})}),j&&u.jsxs(ve,{"data-testid":"stop-completion-button",variant:"text",size:"xs",className:"mb-0",onClick:w,children:[u.jsx(Fc,{className:"animate-spin mr-1",size:14}),"Stop"]}),I&&u.jsx(uP,{isLoading:j,onAccept:R,onDecline:P,size:"xs"}),u.jsx("div",{className:"h-full w-px bg-border mx-2"}),u.jsx(Ee,{content:"Include code from other cells",children:u.jsxs("div",{className:"flex flex-row items-start gap-1 overflow-hidden",children:[u.jsx(yC,{"data-testid":"include-other-cells-checkbox",id:p,checked:g,onCheckedChange:G=>x(!!G)}),u.jsx(gr,{htmlFor:p,className:"text-muted-foreground text-xs whitespace-nowrap ellipsis",children:"Include all code"})]})}),u.jsx(ve,{"data-testid":"decline-completion-button",variant:"text",size:"icon",disabled:j,onClick:()=>{w(),a(),E("")},children:u.jsx(wn,{className:"text-(--red-10)",size:16})})]});let U,V;e[9]!==B||e[10]!==A?(U=u.jsx("div",{className:B,children:A}),e[9]=B,e[10]=A,e[11]=U):U=e[11],e[12]!==I||e[13]!==i||e[14]!==c||e[15]!==o||e[16]!==O?(V=I&&c&&u.jsxs(zr,{className:"cm",theme:O,children:[u.jsx(i_,{onChange:o,value:i,extensions:pb}),u.jsx(a_,{value:I,editable:!1,readOnly:!0,extensions:pb})]}),e[12]=I,e[13]=i,e[14]=c,e[15]=o,e[16]=O,e[17]=V):V=e[17];const X=(!I||!c)&&d;let Y;return e[18]!==U||e[19]!==V||e[20]!==X||e[21]!==z?(Y=u.jsxs("div",{className:z,children:[U,V,X]}),e[18]=U,e[19]=V,e[20]=X,e[21]=z,e[22]=Y):Y=e[22],Y};function c_(t){Je({title:"Completion failed",description:vC(t)})}const Pu="web application/x-marimo-cell",d_=ft({cells:pP(ft({code:at()})),version:gt("1.0")}),gb=t=>{const e=t===1?"Cell":`${t} cells`;Je({title:`${e} copied`,description:`${e} ${t===1?"has":"have"} been copied to clipboard.`})},u_=()=>{Je({title:"Copy failed",description:"Failed to copy cells to clipboard.",variant:"danger"})},h_=()=>{Je({title:"Nothing to paste",description:"No cell or text found in clipboard.",variant:"danger"})},f_=()=>{Je({title:"Paste failed",description:"Failed to read from clipboard",variant:"danger"})};class m_{constructor(){this.items={}}add(e,n){return ClipboardItem.supports(e)?typeof n=="string"?(this.items[e]=new Blob([n],{type:e}),this):(this.items[e]=new Blob([JSON.stringify(n)],{type:e}),this):(ut.warn(`ClipboardItem does not support ${e}`),this)}build(){return new ClipboardItem(this.items)}}const ai=jt(!1),li=new WeakMap;function xb(t){return{handle:e=>t(e),bulkHandle:e=>{let n=!0;try{for(const o of e)n=n&&t(o);return n}catch{return!1}}}}function ro(t){return{handle:e=>t([e]),bulkHandle:e=>t(e)}}function bb(t,e){const n=H.c(30),{canMoveX:o,editorView:r,cellActionDropdownRef:s}=e,{saveOrNameNotebook:i}=Cd(),{saveCellConfig:a}=nt(),l=Ct(Ts),c=lt(),d=Om(),h=Ct(ai),f=Is(),m=Ne(wC),{copyCells:g,pasteAtCell:x}=function(){const O=lt(),R=Fe(async z=>{const _=bn(),k=z.map(B=>_.cellData[B]).filter(Boolean);if(k.length!==0)try{const B={cells:k.map(V=>({code:V.code})),version:"1.0"},A=k.map(V=>V.code).join(`
|
|
118
|
+
`.trim(),x=nC();await oC();const p=await fetch(x.getAiURL("completion").toString(),{method:"POST",headers:x.headers(),body:JSON.stringify({prompt:m.prompt,code:g,selectedText:m.selection,includeOtherCode:"",language:m.language})}),b=((w=m.selection.match(/^\s*/))==null?void 0:w[0])||"",y=(j=p.body)==null?void 0:j.getReader();if(!y)throw new Error("Failed to get response reader");let v="";for(;;){const{done:C,value:N}=await y.read();if(C)break;v+=new TextDecoder().decode(N)}return v.startsWith(b)||(v=b+v),v}({prompt:f.prompt,selection:f.selection,codeBefore:f.codeBefore,codeAfter:f.codeAfter,language:x3(f.editorView)})}),Hd.of({hideOnBlur:!0})]:[],KD(Qe),XD(e,c.reference_highlighting??!1)];var h},x5=t=>{const{theme:e,hotkeys:n,completionConfig:o,cellId:r,lspConfig:s,diagnosticsConfig:i}=t,a=H0(t);return[We.lineWrapping,JD(),ZD(),QD(),eR(),tR(),nR(),oR(),rR({position:"fixed",parent:document.querySelector("#App")??void 0}),sR(),e==="dark"?m5:p5,iR(s),l5(o),aR(),lR(),mE(),To.high(Mn.of(mR)),cR(),dR(),uR.of(" "),lC(pR,{fallback:!0}),Mn.of(gR),hR({placeholderType:a,completionConfig:o,hotkeys:n,cellId:r,lspConfig:{...s,diagnostics:i}}),fR.of(xR()),Ji.allowMultipleSelections.of(!0),c5(n),Mn.of([{key:"Tab",run:l=>aC(l)||(c=>{const{from:d,to:h}=c.state.selection.main;if(d!==h)return!1;const f=c.state.doc.lineAt(h);return f.text.slice(0,h-f.from).trim()!==""&&wR(c)})(l)||bR(l),preventDefault:!0},{key:n.getHotkey("completion.moveDown").key,run:l=>ys(l.state)!==null&&(Ac(!0)(l),!0),preventDefault:!0},{key:n.getHotkey("completion.moveUp").key,run:l=>ys(l.state)!==null&&(Ac(!1)(l),!0),preventDefault:!0}]),Mn.of([...yR,vR])]},b5={width:void 0,height:void 0};function W0(t,e,n){return t[e]?Array.isArray(t[e])?t[e][0][n]:t[e][n]:e==="contentBoxSize"?t.contentRect[n==="inlineSize"?"width":"height"]:void 0}let q0,G0,Y0,K0;q0=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),G0=new Intl.DateTimeFormat("en-US",{month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),Y0=t=>{const e=H.c(79),{editing:n,status:o,disabled:r,staleInputs:s,edited:i,interrupted:a,elapsedTime:l,runStartTimestamp:c,lastRunStartTimestamp:d,uninstantiated:h}=t;if(!n)return null;const f=c??d;let m;e[0]!==f?(m=f?u.jsx(K0,{lastRanTime:f}):null,e[0]=f,e[1]=m):m=e[1];const g=m;if(r&&o==="running")return ut.error("CellStatusComponent: disabled and running"),null;if(r&&s){let x,p,b,y;return e[2]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx("span",{children:"This cell is stale, but it's disabled and can't be run"}),e[2]=x):x=e[2],e[3]!==g?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[x,g]}),e[3]=g,e[4]=p):p=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:u.jsxs(As,{children:[u.jsx(_s,{className:"h-5 w-5",strokeWidth:1.5}),u.jsx(Oc,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[5]=b):b=e[5],e[6]!==p?(y=u.jsx(Ee,{content:p,usePortal:!0,children:b}),e[6]=p,e[7]=y):y=e[7],y}if(r){let x,p,b,y;return e[8]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx("span",{children:"This cell is disabled"}),e[8]=x):x=e[8],e[9]!==g?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[x,g]}),e[9]=g,e[10]=p):p=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-disabled","data-testid":"cell-status","data-status":"disabled",children:u.jsx(_s,{className:"h-5 w-5",strokeWidth:1.5})}),e[11]=b):b=e[11],e[12]!==p?(y=u.jsx(Ee,{content:p,usePortal:!0,children:b}),e[12]=p,e[13]=y):y=e[13],y}if(!s&&o==="disabled-transitively"){let x,p,b,y;return e[14]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx("span",{children:"An ancestor of this cell is disabled, so it can't be run"}),e[14]=x):x=e[14],e[15]!==g?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[x,g]}),e[15]=g,e[16]=p):p=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"disabled-transitively",children:u.jsxs(As,{layerTop:!0,children:[u.jsx(ma,{className:"h-5 w-5",strokeWidth:1.5}),u.jsx(_s,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[17]=b):b=e[17],e[18]!==p?(y=u.jsx(Ee,{content:p,usePortal:!0,children:b}),e[18]=p,e[19]=y):y=e[19],y}if(s&&o==="disabled-transitively"){let x,p,b,y;return e[20]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx("span",{children:"This cell is stale, but an ancestor is disabled so it can't be run"}),e[20]=x):x=e[20],e[21]!==g?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[x,g]}),e[21]=g,e[22]=p):p=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:u.jsxs(As,{children:[u.jsx(Oc,{className:"h-5 w-5",strokeWidth:1}),u.jsx(_s,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[23]=b):b=e[23],e[24]!==p?(y=u.jsx(Ee,{content:p,usePortal:!0,children:b}),e[24]=p,e[25]=y):y=e[25],y}if(o==="running"){let x,p,b,y,v;return e[26]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx("span",{children:"This cell is running"}),e[26]=x):x=e[26],e[27]!==g?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[x,g]}),e[27]=g,e[28]=p):p=e[28],e[29]!==c?(b=Vm.fromSeconds(c)||Vm.now(),e[29]=c,e[30]=b):b=e[30],e[31]!==b?(y=u.jsx("div",{className:"cell-status-icon elapsed-time running","data-testid":"cell-status","data-status":"running",children:u.jsx(y5,{startTime:b})}),e[31]=b,e[32]=y):y=e[32],e[33]!==p||e[34]!==y?(v=u.jsx(Ee,{content:p,usePortal:!0,children:y}),e[33]=p,e[34]=y,e[35]=v):v=e[35],v}if(o==="queued"){let x,p,b,y;return e[36]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx("span",{children:"This cell is queued to run"}),e[36]=x):x=e[36],e[37]!==g?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[x,g]}),e[37]=g,e[38]=p):p=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-queued","data-testid":"cell-status","data-status":"queued",children:u.jsx(qc,{className:"h-5 w-5",strokeWidth:1.5})}),e[39]=b):b=e[39],e[40]!==p?(y=u.jsx(Ee,{content:p,usePortal:!0,children:b}),e[40]=p,e[41]=y):y=e[41],y}if(i||a||s||h){let x;e[42]!==l?(x=Es(l),e[42]=l,e[43]=x):x=e[43];const p=x;let b;e[44]!==l||e[45]!==p?(b=l?u.jsx(Gc,{elapsedTime:p}):null,e[44]=l,e[45]=p,e[46]=b):b=e[46];const y=b;let v,w,j,C,N,S="";if(h)v="This cell has not yet been run";else if(a){let E;v="This cell was interrupted when it was last run",e[47]!==y?(E=u.jsxs("span",{children:["This cell ran for ",y," before being interrupted"]}),e[47]=y,e[48]=E):E=e[48],S=E}else if(i){let E;v="This cell has been modified since it was last run",e[49]!==y?(E=u.jsxs("span",{children:["This cell took ",y," to run"]}),e[49]=y,e[50]=E):E=e[50],S=E}else{let E;v="This cell has not been run with the latest inputs",e[51]!==y?(E=u.jsxs("span",{children:["This cell took ",y," to run"]}),e[51]=y,e[52]=E):E=e[52],S=E}return e[53]===Symbol.for("react.memo_cache_sentinel")?(w=u.jsx("div",{className:"cell-status-stale","data-testid":"cell-status","data-status":"outdated",children:u.jsx(Oc,{className:"h-5 w-5",strokeWidth:1.5})}),e[53]=w):w=e[53],e[54]!==v?(j=u.jsx(Ee,{content:v,usePortal:!0,children:w}),e[54]=v,e[55]=j):j=e[55],e[56]!==l||e[57]!==p||e[58]!==g||e[59]!==S?(C=l&&u.jsx(Ee,{content:u.jsxs("div",{className:"flex flex-col gap-1",children:[S,g]}),usePortal:!0,children:u.jsx("div",{className:"elapsed-time hover-action","data-testid":"cell-status","data-status":"outdated",children:u.jsx("span",{children:p})})}),e[56]=l,e[57]=p,e[58]=g,e[59]=S,e[60]=C):C=e[60],e[61]!==j||e[62]!==C?(N=u.jsxs("div",{className:"cell-status-icon flex items-center gap-2",children:[j,C]}),e[61]=j,e[62]=C,e[63]=N):N=e[63],N}if(l!==null){let x;e[64]!==l?(x=Es(l),e[64]=l,e[65]=x):x=e[65];const p=x;let b;e[66]!==l||e[67]!==p?(b=l?u.jsx(Gc,{elapsedTime:p}):null,e[66]=l,e[67]=p,e[68]=b):b=e[68];const y=b;let v,w,j,C;return e[69]!==y?(v=u.jsxs("span",{children:["This cell took ",y," to run"]}),e[69]=y,e[70]=v):v=e[70],e[71]!==g||e[72]!==v?(w=u.jsxs("div",{className:"flex flex-col gap-1",children:[v,g]}),e[71]=g,e[72]=v,e[73]=w):w=e[73],e[74]!==p?(j=u.jsx("div",{className:"cell-status-icon elapsed-time hover-action","data-testid":"cell-status","data-status":"idle",children:u.jsx("span",{children:p})}),e[74]=p,e[75]=j):j=e[75],e[76]!==w||e[77]!==j?(C=u.jsx(Ee,{content:w,usePortal:!0,children:j}),e[76]=w,e[77]=j,e[78]=C):C=e[78],C}return null},Gc=t=>{const e=H.c(2);let n;return e[0]!==t.elapsedTime?(n=u.jsx("span",{className:"tracking-wide font-semibold",children:t.elapsedTime}),e[0]=t.elapsedTime,e[1]=n):n=e[1],n},K0=t=>{const e=H.c(18),n=1e3*t.lastRanTime;let o,r,s,i,a,l,c,d,h;if(e[0]!==n){const f=new Date(n),m=new Date,g=f.toDateString()===m.toDateString()?q0:G0;i="Ran at",a=" ",l=u.jsx("strong",{className:"tracking-wide font-semibold",children:g.format(f)}),c=" ",o="text-muted-foreground",r="(",s=Lj(f),e[0]=n,e[1]=o,e[2]=r,e[3]=s,e[4]=i,e[5]=a,e[6]=l,e[7]=c}else o=e[1],r=e[2],s=e[3],i=e[4],a=e[5],l=e[6],c=e[7];return e[8]!==o||e[9]!==r||e[10]!==s?(d=u.jsxs("span",{className:o,children:[r,s," ago)"]}),e[8]=o,e[9]=r,e[10]=s,e[11]=d):d=e[11],e[12]!==i||e[13]!==a||e[14]!==l||e[15]!==c||e[16]!==d?(h=u.jsxs("span",{children:[i,a,l,c,d]}),e[12]=i,e[13]=a,e[14]=l,e[15]=c,e[16]=d,e[17]=h):h=e[17],h},Es=function(t){if(t===null)return"";const e=t,n=e/1e3;return n>=60?`${Math.floor(n/60)}m${Math.floor(n%60)}s`:n>=1?`${n.toFixed(2).toString()}s`:`${e.toFixed(0).toString()}ms`};const y5=t=>{const e=H.c(6);let n;e[0]!==t.startTime?(n=t.startTime.toMilliseconds(),e[0]=t.startTime,e[1]=n):n=e[1];const o=function(i){const a=M.useRef(i),[l,c]=M.useState(i);return M.useEffect(()=>{const d=setInterval(()=>{c(Vm.now().toMilliseconds())},17);return()=>clearInterval(d)},[]),l-a.current}(n);let r,s;return e[2]!==o?(r=Es(o),e[2]=o,e[3]=r):r=e[3],e[4]!==r?(s=u.jsx("span",{children:r}),e[4]=r,e[5]=s):s=e[5],s};var vu="ContextMenu",[v5,sz]=dC(vu,[cC]),Xt=cC(),[w5,X0]=v5(vu),J0=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:o,dir:r,modal:s=!0}=t,[i,a]=M.useState(!1),l=Xt(e),c=Xo(o),d=M.useCallback(h=>{a(h),c(h)},[c]);return u.jsx(w5,{scope:e,open:i,onOpenChange:d,modal:s,children:u.jsx(RR,{...l,dir:r,open:i,onOpenChange:d,modal:s,children:n})})};J0.displayName=vu;var Z0="ContextMenuTrigger",Q0=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:o=!1,...r}=t,s=X0(Z0,n),i=Xt(n),a=M.useRef({x:0,y:0}),l=M.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...a.current})}),c=M.useRef(0),d=M.useCallback(()=>window.clearTimeout(c.current),[]),h=f=>{a.current={x:f.clientX,y:f.clientY},s.onOpenChange(!0)};return M.useEffect(()=>d,[d]),M.useEffect(()=>{o&&d()},[o,d]),u.jsxs(u.Fragment,{children:[u.jsx(jR,{...i,virtualRef:l}),u.jsx(vs.span,{"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,...r,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:o?t.onContextMenu:On(t.onContextMenu,f=>{d(),h(f),f.preventDefault()}),onPointerDown:o?t.onPointerDown:On(t.onPointerDown,rl(f=>{d(),c.current=window.setTimeout(()=>h(f),700)})),onPointerMove:o?t.onPointerMove:On(t.onPointerMove,rl(d)),onPointerCancel:o?t.onPointerCancel:On(t.onPointerCancel,rl(d)),onPointerUp:o?t.onPointerUp:On(t.onPointerUp,rl(d))})]})});Q0.displayName=Z0;var ex=t=>{const{__scopeContextMenu:e,...n}=t,o=Xt(e);return u.jsx(PR,{...o,...n})};ex.displayName="ContextMenuPortal";var tx="ContextMenuContent",nx=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=X0(tx,n),s=Xt(n),i=M.useRef(!1);return u.jsx(SR,{...s,...o,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:a=>{var l;(l=t.onCloseAutoFocus)==null||l.call(t,a),!a.defaultPrevented&&i.current&&a.preventDefault(),i.current=!1},onInteractOutside:a=>{var l;(l=t.onInteractOutside)==null||l.call(t,a),a.defaultPrevented||r.modal||(i.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});nx.displayName=tx,M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(NR,{...r,...o,ref:e})}).displayName="ContextMenuGroup";var ox=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(ER,{...r,...o,ref:e})});ox.displayName="ContextMenuLabel";var rx=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(CR,{...r,...o,ref:e})});rx.displayName="ContextMenuItem";var sx=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(_R,{...r,...o,ref:e})});sx.displayName="ContextMenuCheckboxItem",M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(IR,{...r,...o,ref:e})}).displayName="ContextMenuRadioGroup";var ix=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(AR,{...r,...o,ref:e})});ix.displayName="ContextMenuRadioItem";var ax=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(TR,{...r,...o,ref:e})});ax.displayName="ContextMenuItemIndicator";var lx=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(kR,{...r,...o,ref:e})});lx.displayName="ContextMenuSeparator",M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(MR,{...r,...o,ref:e})}).displayName="ContextMenuArrow";var cx=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(OR,{...r,...o,ref:e})});cx.displayName="ContextMenuSubTrigger";var dx=M.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Xt(n);return u.jsx(DR,{...r,...o,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});function rl(t){return e=>e.pointerType!=="mouse"?t(e):void 0}dx.displayName="ContextMenuSubContent";var ux=nx,hx=ox,fx=rx,mx=sx,px=ix,gx=ax,xx=lx,bx=cx,yx=dx;const vx=J0,wx=Q0,k5=zR(ex);M.forwardRef((t,e)=>{const n=H.c(14);let o,r,s,i,a,l,c;return n[0]!==t?({className:r,inset:s,children:o,...i}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i):(o=n[1],r=n[2],s=n[3],i=n[4]),n[5]!==r||n[6]!==s?(a=BR({className:r,inset:s}),n[5]=r,n[6]=s,n[7]=a):a=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(VR,{className:"ml-auto h-4 w-4"}),n[8]=l):l=n[8],n[9]!==o||n[10]!==i||n[11]!==e||n[12]!==a?(c=u.jsxs(bx,{ref:e,className:a,...i,children:[o,l]}),n[9]=o,n[10]=i,n[11]=e,n[12]=a,n[13]=c):c=n[13],c}).displayName=bx.displayName;const kx="data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2";M.forwardRef((t,e)=>{const n=H.c(9);let o,r,s,i;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(s=xe(uC({subcontent:!0}),kx,o),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(i=u.jsx(yx,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=i):i=n[8],i}).displayName=yx.displayName;const wu=M.forwardRef((t,e)=>{const n=H.c(15);let o,r,s;n[0]!==t?({className:o,scrollable:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const i=s===void 0||s;let a;n[4]!==o||n[5]!==i?(a=xe(uC(),kx,i&&"overflow-auto",o),n[4]=o,n[5]=i,n[6]=a):a=n[6];const l=i?"calc(var(--radix-context-menu-content-available-height) - 30px)":void 0;let c,d;return n[7]!==r.style||n[8]!==l?(c={...r.style,maxHeight:l},n[7]=r.style,n[8]=l,n[9]=c):c=n[9],n[10]!==r||n[11]!==e||n[12]!==a||n[13]!==c?(d=u.jsx(k5,{children:u.jsx(UR,{children:u.jsx(ux,{ref:e,className:a,style:c,...r})})}),n[10]=r,n[11]=e,n[12]=a,n[13]=c,n[14]=d):d=n[14],d});wu.displayName=ux.displayName;const ni=M.forwardRef((t,e)=>{const n=H.c(13);let o,r,s,i,a,l;return n[0]!==t?({className:o,inset:r,variant:i,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i):(o=n[1],r=n[2],s=n[3],i=n[4]),n[5]!==o||n[6]!==r||n[7]!==i?(a=FR({className:o,inset:r,variant:i}),n[5]=o,n[6]=r,n[7]=i,n[8]=a):a=n[8],n[9]!==s||n[10]!==e||n[11]!==a?(l=u.jsx(fx,{ref:e,className:a,...s}),n[9]=s,n[10]=e,n[11]=a,n[12]=l):l=n[12],l});ni.displayName=fx.displayName,M.forwardRef((t,e)=>{const n=H.c(15);let o,r,s,i,a,l,c,d;return n[0]!==t?({className:s,children:r,checked:o,...i}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i):(o=n[1],r=n[2],s=n[3],i=n[4]),n[5]!==s?(a=Dc({className:s}),n[5]=s,n[6]=a):a=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=Dc(),n[7]=l):l=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx("span",{className:l,children:u.jsx(gx,{children:u.jsx(HR,{className:"h-4 w-4"})})}),n[8]=c):c=n[8],n[9]!==o||n[10]!==r||n[11]!==i||n[12]!==e||n[13]!==a?(d=u.jsxs(mx,{ref:e,className:a,checked:o,...i,children:[c,r]}),n[9]=o,n[10]=r,n[11]=i,n[12]=e,n[13]=a,n[14]=d):d=n[14],d}).displayName=mx.displayName,M.forwardRef((t,e)=>{const n=H.c(13);let o,r,s,i,a,l,c;return n[0]!==t?({className:r,children:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(i=Dc({className:r}),n[4]=r,n[5]=i):i=n[5],n[6]===Symbol.for("react.memo_cache_sentinel")?(a=Dc(),n[6]=a):a=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx("span",{className:a,children:u.jsx(gx,{children:u.jsx(WR,{className:"h-4 w-4 fill-current"})})}),n[7]=l):l=n[7],n[8]!==o||n[9]!==s||n[10]!==e||n[11]!==i?(c=u.jsxs(px,{ref:e,className:i,...s,children:[l,o]}),n[8]=o,n[9]=s,n[10]=e,n[11]=i,n[12]=c):c=n[12],c}).displayName=px.displayName,M.forwardRef((t,e)=>{const n=H.c(11);let o,r,s,i,a;return n[0]!==t?({className:o,inset:r,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==o||n[5]!==r?(i=$R({className:o,inset:r}),n[4]=o,n[5]=r,n[6]=i):i=n[6],n[7]!==s||n[8]!==e||n[9]!==i?(a=u.jsx(hx,{ref:e,className:i,...s}),n[7]=s,n[8]=e,n[9]=i,n[10]=a):a=n[10],a}).displayName=hx.displayName;const Cx=M.forwardRef((t,e)=>{const n=H.c(9);let o,r,s,i;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(s=xe(LR({className:o})),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(i=u.jsx(xx,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=i):i=n[8],i});Cx.displayName=xx.displayName;const jx=t=>{const e=H.c(20),{connectionState:n,onClick:o,tooltipContent:r}=t;let s;e[0]!==n||e[1]!==r?(s=wc(n)||r,e[0]=n,e[1]=r,e[2]=s):s=e[2];const i=s;let a;e[3]!==i||e[4]!==n?(a=eo(n)?i:u.jsxs("div",{className:"flex flex-col gap-4",children:[u.jsx("div",{children:i}),u.jsx("div",{className:"text-xs text-muted-foreground font-medium pt-1 -mt-2 border-t border-border",children:"Right-click for cell types"})]}),e[3]=i,e[4]=n,e[5]=a):a=e[5];const l=a;let c,d,h,f,m,g;return e[6]!==o?(c=()=>o==null?void 0:o({code:""}),e[6]=o,e[7]=c):c=e[7],e[8]!==n?(d=xe("shoulder-button hover-action",eo(n)&&" inactive-button"),e[8]=n,e[9]=d):d=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(Jo,{strokeWidth:1.8}),e[10]=h):h=e[10],e[11]!==c||e[12]!==d?(f=u.jsx(cn,{onClick:c,className:d,onMouseDown:zn.preventFocus,shape:"circle",size:"small",color:"hint-green","data-testid":"create-cell-button",children:h}),e[11]=c,e[12]=d,e[13]=f):f=e[13],e[14]!==l||e[15]!==f?(m=u.jsx(Ee,{content:l,children:f}),e[14]=l,e[15]=f,e[16]=m):m=e[16],e[17]!==o||e[18]!==m?(g=u.jsx(C5,{onClick:o,children:m}),e[17]=o,e[18]=m,e[19]=g):g=e[19],g},C5=t=>{const e=H.c(26),{children:n,onClick:o}=t,{createNewCell:r}=lt();if(!o)return n;let s,i,a,l,c,d,h,f,m,g,x,p;return e[0]!==n?(s=u.jsx(wx,{children:n}),e[0]=n,e[1]=s):s=e[1],e[2]!==o?(i=b=>{b.stopPropagation(),o({code:""})},e[2]=o,e[3]=i):i=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx("div",{className:"mr-3 text-muted-foreground",children:u.jsx(nc,{})}),e[4]=a):a=e[4],e[5]!==i?(l=u.jsxs(ni,{onSelect:i,children:[a,"Python cell"]},"python"),e[5]=i,e[6]=l):l=e[6],e[7]!==r||e[8]!==o?(c=b=>{b.stopPropagation(),Jn({autoInstantiate:!0,createNewCell:r}),o({code:new Bi().defaultCode,hideCode:!0})},e[7]=r,e[8]=o,e[9]=c):c=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx("div",{className:"mr-3 text-muted-foreground",children:u.jsx(tc,{})}),e[10]=d):d=e[10],e[11]!==c?(h=u.jsxs(ni,{onSelect:c,children:[d,"Markdown cell"]},"markdown"),e[11]=c,e[12]=h):h=e[12],e[13]!==r||e[14]!==o?(f=b=>{b.stopPropagation(),Jn({autoInstantiate:!0,createNewCell:r}),o({code:new Rc().defaultCode})},e[13]=r,e[14]=o,e[15]=f):f=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx("div",{className:"mr-3 text-muted-foreground",children:u.jsx(Yo,{size:13,strokeWidth:1.5})}),e[16]=m):m=e[16],e[17]!==f?(g=u.jsxs(ni,{onSelect:f,children:[m,"SQL cell"]},"sql"),e[17]=f,e[18]=g):g=e[18],e[19]!==l||e[20]!==h||e[21]!==g?(x=u.jsxs(wu,{children:[l,h,g]}),e[19]=l,e[20]=h,e[21]=g,e[22]=x):x=e[22],e[23]!==s||e[24]!==x?(p=u.jsxs(vx,{children:[s,x]}),e[23]=s,e[24]=x,e[25]=p):p=e[25],p},Sx=q.memo(q.forwardRef((t,e)=>{const n=H.c(34);let o,r,s;n[0]!==t?({children:o,showTooltip:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const i=s===void 0||s,[a,l]=M.useState(!1);let c;n[4]!==r?(c={cell:r},n[4]=r,n[5]=c):c=n[5];const d=md(c),h=GR();let f,m,g,x,p,b;if(n[6]===Symbol.for("react.memo_cache_sentinel")?(f=()=>({toggle:()=>l(j5)}),n[6]=f):f=n[6],M.useImperativeHandle(e,f),n[7]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(zi,{placeholder:"Search actions...",className:"h-6 m-1"}),n[7]=m):m=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx(ac,{children:"No results"}),n[8]=g):g=n[8],n[9]!==d){let S;n[11]!==d.length?(S=(E,T)=>u.jsxs(M.Fragment,{children:[u.jsx(gm,{children:E.map(I=>{let D=u.jsxs("div",{className:"flex items-center flex-1",children:[I.icon&&u.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:I.icon}),u.jsx("div",{className:"flex-1",children:I.label}),u.jsxs("div",{className:"shrink-0 text-sm",children:[I.hotkey&&hC(I.hotkey),I.rightElement]})]});return I.tooltip&&(D=u.jsx(Ee,{content:I.tooltip,delayDuration:100,children:D})),u.jsx(Zn,{className:xe(I.disabled&&"opacity-50!"),onSelect:()=>{I.disableClick||I.disabled||(I.handle(),l(!1))},variant:I.variant,children:D},I.label)})},T),T<d.length-1&&u.jsx(N3,{})]},T),n[11]=d.length,n[12]=S):S=n[12],x=d.map(S),n[9]=d,n[10]=x}else x=n[10];n[13]!==x?(p=u.jsxs(yc,{children:[m,u.jsxs(Hm,{children:[g,x]})]}),n[13]=x,n[14]=p):p=n[14],n[15]!==h||n[16]!==p?(b=u.jsx(ps,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...h,children:p}),n[15]=h,n[16]=p,n[17]=b):b=n[17];const y=b;if(!i){let S,E;return n[18]!==o?(S=u.jsx(ws,{asChild:!0,children:o}),n[18]=o,n[19]=S):S=n[19],n[20]!==y||n[21]!==a||n[22]!==S?(E=u.jsxs(br,{open:a,onOpenChange:l,children:[S,y]}),n[20]=y,n[21]=a,n[22]=S,n[23]=E):E=n[23],E}let v;n[24]===Symbol.for("react.memo_cache_sentinel")?(v=u.jsx(YR,{tabIndex:-1,children:Gt("cell.cellActions")}),n[24]=v):v=n[24];const w=!a&&v;let j,C,N;return n[25]!==o?(j=u.jsx(KR,{children:u.jsx(ws,{className:"flex",children:o})}),n[25]=o,n[26]=j):j=n[26],n[27]!==w||n[28]!==j?(C=u.jsxs(XR,{delayDuration:200,disableHoverableContent:!0,children:[w,j]}),n[27]=w,n[28]=j,n[29]=C):C=n[29],n[30]!==y||n[31]!==a||n[32]!==C?(N=u.jsxs(br,{open:a,onOpenChange:l,children:[C,y]}),n[30]=y,n[31]=a,n[32]=C,n[33]=N):N=n[33],N})),Nx=q.memo(t=>{const e=H.c(5),{children:n,cellId:o}=t;let r,s;e[0]!==o?(s=qR(o),e[0]=o,e[1]=s):s=e[1],r=s;const i=Ne(r);if(!i)return null;let a;return e[2]!==n||e[3]!==i?(a=u.jsx(Sx,{showTooltip:!1,...i,children:n}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a});function j5(t){return!t}Nx.displayName="ConnectionCellActionsDropdown";const Ex=t=>{const e=H.c(35),{children:n,cellId:o,getEditorView:r}=t,s=Zi(o),i=Qi(o),a=!Wm(i.output),l=i.consoleOutputs.length>0;let c;e[0]!==s.config||e[1]!==s.name||e[2]!==o||e[3]!==i.status||e[4]!==r||e[5]!==a||e[6]!==l?(c={cell:{cellId:o,name:s.name,config:s.config,status:i.status,hasOutput:a,hasConsoleOutput:l,getEditorView:r}},e[0]=s.config,e[1]=s.name,e[2]=o,e[3]=i.status,e[4]=r,e[5]=a,e[6]=l,e[7]=c):c=e[7];const d=md(c),[h,f]=q.useState(),m=!!h;let g,x,p,b,y,v,w,j,C,N;if(e[8]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx(Mi,{size:13,strokeWidth:1.5}),e[8]=g):g=e[8],e[9]!==o?(x=async()=>{var T;if((T=window.getSelection())==null?void 0:T.toString())return void document.execCommand("copy");const E=document.getElementById(y3.create(o));E?await sn(E.textContent??""):ut.warn("cell-context-menu: output not found")},e[9]=o,e[10]=x):x=e[10],e[11]!==d||e[12]!==n||e[13]!==r||e[14]!==h||e[15]!==m||e[16]!==x){const S=[{label:"Copy",hidden:m,icon:g,handle:x},{label:"Cut",hidden:!!h,icon:u.jsx(ad,{size:13,strokeWidth:1.5}),handle:S5},{label:"Paste",hidden:!!h,icon:u.jsx(yp,{size:13,strokeWidth:1.5}),handle:async()=>{const I=r();if(I)try{const D=await navigator.clipboard.readText();if(D){const{from:F,to:O}=I.state.selection.main,R=I.state.update({changes:{from:F,to:O,insert:D}});I.dispatch(R)}}catch(D){const F=D;ut.error("Failed to paste from clipboard",F),JR({command:"paste"})}}},{label:"Copy image",hidden:!h,icon:u.jsx(Zc,{size:13,strokeWidth:1.5}),handle:async()=>{if(h){const I=await fetch(h.src),D=await I.blob(),F=new ClipboardItem({[D.type]:D});await navigator.clipboard.write([F]).then(N5).catch(E5)}}},{icon:u.jsx(cp,{size:13,strokeWidth:1.5}),label:"Download image",hidden:!h,handle:()=>{if(h){const I=document.createElement("a");I.download="image.png",I.href=h.src,I.click()}}},{label:"Go to Definition",icon:u.jsx(QR,{size:13,strokeWidth:1.5}),handle:()=>{const I=r();I&&ZR(I)}}],E=[S,...d];let T;b=vx,e[23]===Symbol.for("react.memo_cache_sentinel")?(T=I=>{I.target instanceof HTMLImageElement?f(I.target):f(void 0)},e[23]=T):T=e[23],e[24]!==n?(y=u.jsx(wx,{onContextMenu:T,asChild:!0,children:n}),e[24]=n,e[25]=y):y=e[25],p=wu,v="w-[300px]",w=!0,j=E.map((I,D)=>u.jsxs(M.Fragment,{children:[I.map(_5),D<E.length-1&&u.jsx(Cx,{})]},D)),e[11]=d,e[12]=n,e[13]=r,e[14]=h,e[15]=m,e[16]=x,e[17]=p,e[18]=b,e[19]=y,e[20]=v,e[21]=w,e[22]=j}else p=e[17],b=e[18],y=e[19],v=e[20],w=e[21],j=e[22];return e[26]!==p||e[27]!==v||e[28]!==w||e[29]!==j?(C=u.jsx(p,{className:v,scrollable:w,children:j}),e[26]=p,e[27]=v,e[28]=w,e[29]=j,e[30]=C):C=e[30],e[31]!==b||e[32]!==y||e[33]!==C?(N=u.jsxs(b,{children:[y,C]}),e[31]=b,e[32]=y,e[33]=C,e[34]=N):N=e[34],N};function S5(){document.execCommand("cut")}function N5(){Je({title:"Copied image to clipboard"})}function E5(t){Je({title:"Failed to copy image to clipboard. Try downloading instead.",description:t.message}),ut.error("Failed to copy image to clipboard",t)}function _5(t){if(t.hidden)return null;let e=u.jsxs("div",{className:"flex items-center flex-1",children:[t.icon&&u.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:t.icon}),u.jsx("div",{className:"flex-1",children:t.label}),u.jsxs("div",{className:"shrink-0 text-sm",children:[t.hotkey&&hC(t.hotkey),t.rightElement]})]});return t.tooltip&&(e=u.jsx(Ee,{delayDuration:100,content:t.tooltip,children:e})),u.jsx(ni,{className:t.disabled?"opacity-50!":"",onSelect:n=>{t.disableClick||t.disabled||t.handle(n)},variant:t.variant,children:e},t.label)}if(Ej)_j(ez),Ej();else{const t=await qm(()=>import("./loro_wasm_bg-C3hKWL9L.js").then(async e=>(await e.__tla,e)).then(e=>e.w),[],import.meta.url);_j(new WebAssembly.Instance(t.default,{"./loro_wasm_bg.js":QF}).exports)}const I5=["Map","Text","List","Tree","MovableList","Counter"];function _x(t){if(typeof t!="object"||t==null)return!1;const e=Object.getPrototypeOf(t);return e!=null&&typeof e=="object"&&typeof e.kind=="function"&&I5.includes(t.kind())}Ij.prototype.toJsonWithReplacer=function(t){const e=new Set,n=this,o=(i,a)=>{if(typeof a=="string"&&a.startsWith("cid:")&&!e.has(a)){e.add(a);const c=n.getContainerById(a);if(c==null)throw new Error(`ContainerID not found: ${a}`);const d=t(i,c);if(d===c){const h=c.getShallowValue();return typeof h=="object"?r(h):h}if(_x(d))throw new Error("Using new container is not allowed in toJsonWithReplacer");return typeof d=="object"&&d!=null?r(d):d}if(typeof a=="object"&&a!=null)return r(a);const l=t(i,a);if(_x(l))throw new Error("Using new container is not allowed in toJsonWithReplacer");return l},r=i=>{if(Array.isArray(i))return i.map((l,c)=>o(c,l)).filter(l=>l!==void 0);const a={};for(const[l,c]of Object.entries(i)){const d=o(l,c);d!==void 0&&(a[l]=d)}return a},s=n.getShallowValue();return r(s)};const A5=We.baseTheme({".loro-cursor":{position:"absolute",width:"2px",display:"inline-block",height:"1.2em"},".loro-cursor::before":{position:"absolute",top:"1.3em",left:"0",content:"var(--rtc-name)",padding:"2px 6px",fontSize:"12px",borderRadius:"3px",whiteSpace:"nowrap",userSelect:"none",backgroundColor:"inherit",opacity:"0.7"},".loro-selection":{opacity:"0.5"}}),oi=Tt.define(),ku=vn.define({create:()=>({remoteCursors:new Map,isCheckout:!1}),update(t,e){for(const n of e.effects)if(n.is(oi))switch(n.value.type){case"update":{const{peer:o,user:r,cursor:s}=n.value;t.remoteCursors.set(o,{uid:o,cursor:s,user:r});break}case"delete":t.remoteCursors.delete(n.value.peer);break;case"checkout":t.isCheckout=n.value.checkout}return t}}),Ix=t=>{const e=t.transactions.flatMap(n=>n.effects).filter(n=>n.is(oi));return t.docChanged||t.viewportChanged||e.length>0};class sl{constructor(e,n,o,r,s){this.left=e,this.top=n,this.height=o,this.name=r,this.colorClassName=s}draw(){const e=document.createElement("div");return this.adjust(e),e}update(e){return this.adjust(e),!0}adjust(e){e.style.left=`${this.left}px`,e.style.top=`${this.top}px`,e.style.height=`${this.height}px`,e.className=`loro-cursor ${this.colorClassName}`,e.style.setProperty("--rtc-name",`"${this.name}"`)}eq(e){return this.left===e.left&&this.top===e.top&&this.height===e.height&&this.name===e.name}static createCursor(e,n,o,r){const s=sl.calculateAbsoluteCursorPosition(n,e);if(!s)return[];const i=e.scrollDOM.getBoundingClientRect(),a=(e.textDirection===tP.LTR?i.left:i.right-e.scrollDOM.clientWidth)-e.scrollDOM.scrollLeft,l=i.top-e.scrollDOM.scrollTop;return[new sl(s.left-a,s.top-l,s.bottom-s.top,o,r)]}static calculateAbsoluteCursorPosition(e,n){const o=Math.max(0,Math.min(n.state.doc.length,e.anchor));return n.coordsAtPos(o,e.assoc||1)}}const T5=(t,e,n,o)=>{const r=[],{updated:s,added:i}=n;for(const a of[...s,...i]){const l=Ax(t,e,a,o);l&&r.push(l)}return r},Ax=(t,e,n,o)=>{const r=e.getAllStates()[n];if(!r||n===t.peerIdStr||r.scopeId!==o)return;if(r.type==="delete")return oi.of({type:"delete",peer:r.uid,scopeId:r.scopeId});const s=Aj.decode(r.cursor.anchor),i=t.getCursorPos(s).offset;let a=i;if(r.cursor.head){const l=Aj.decode(r.cursor.head);a=t.getCursorPos(l).offset}return oi.of({type:"update",peer:r.uid,scopeId:r.scopeId,cursor:{anchor:i,head:a},user:r.user})};class M5{constructor(e,n,o,r,s,i,a){this.view=e,this.doc=n,this.user=o,this.awareness=r,this.getTextFromDoc=s,this.scopeId=i,this.getUserId=a,this.sub=void 0,this.sub=this.doc.subscribe(l=>{if(l.by==="local"){const c=[];for(const d of this.awareness.peers()){const h=Ax(this.doc,this.awareness,d,this.scopeId);h&&c.push(h)}this.view.dispatch({effects:c})}else l.by==="checkout"&&this.view.dispatch({effects:[oi.of({type:"checkout",checkout:this.doc.isDetached()})]})})}update(e){if(!e.selectionSet&&!e.focusChanged&&!e.docChanged)return;const n=e.state.selection.main;if(this.view.hasFocus&&!this.doc.isDetached()){const o=D5({doc:this.doc,getTextFromDoc:this.getTextFromDoc,anchor:n.anchor,head:n.head});this.awareness.setLocalState({type:"update",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId,cursor:o,user:this.user})}else this.awareness.setLocalState({type:"delete",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}destroy(){var e;(e=this.sub)==null||e.call(this),this.awareness.setLocalState({type:"delete",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}}class O5{constructor(e,n,o,r){this.view=e,this.doc=n,this.awareness=o,this.scopeId=r,this._awarenessListener=void 0;const s=async(i,a)=>{a!=="local"&&this.view.dispatch({effects:T5(this.doc,this.awareness,i,this.scopeId)})};this._awarenessListener=s,this.awareness.addListener(s)}destroy(){this._awarenessListener&&this.awareness.removeListener(this._awarenessListener)}}const D5=({doc:t,getTextFromDoc:e,anchor:n,head:o})=>{var i,a;n===o&&(o=void 0);const r=(i=e(t).getCursor(n))==null?void 0:i.encode();if(!r)throw new Error("cursor head not found");let s;return o!==void 0&&(s=(a=e(t).getCursor(o))==null?void 0:a.encode()),{anchor:r,head:s}},il=["bg-(--amber-6)","bg-(--blue-6)","bg-(--crimson-6)","bg-(--cyan-6)","bg-(--grass-6)","bg-(--gray-6)","bg-(--green-6)","bg-(--lime-6)","bg-(--orange-6)","bg-(--purple-6)","bg-(--red-6)","bg-(--sage-6)","bg-(--sky-6)","bg-(--slate-6)"],R5=(t,e,n)=>$n.define(o=>new P5(o,t,e,n)),Dr=Um.define();class P5{constructor(e,n,o,r){this.view=e,this.doc=n,this.docPath=o,this.getTextFromDoc=r,this.sub=void 0,this.isInitDispatch=!1,this.onRemoteUpdate=s=>{if(s.by!=="local")if(s.by!=="checkout"){if(s.by==="import"){const i=[];let a=0;for(const{diff:l,path:c}of s.events){if(c.join("/")!==this.docPath.join("/")||l.type!=="text")continue;const d=l.diff;for(const h of d)h.insert?i.push({from:a,to:a,insert:h.insert}):h.delete?(i.push({from:a,to:a+h.delete}),a+=h.delete):h.retain!=null&&(a+=h.retain);i.length>0&&this.view.dispatch({changes:i,annotations:[Dr.of(this)]})}}}else this.view.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:this.getTextFromDoc(this.doc).toString()}],annotations:[Dr.of(this)]})},this.sub=n.subscribe(this.onRemoteUpdate),Promise.resolve().then(()=>{this.isInitDispatch=!0;const s=this.view.state.doc.toString(),i=this.getTextFromDoc(this.doc);s!==i.toString()&&e.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:i.toString()}]})})}update(e){if(this.isInitDispatch)return void(this.isInitDispatch=!1);if(!e.docChanged||e.transactions.length>0&&(e.transactions[0].annotation(Dr)===this||e.transactions[0].annotation(Dr)==="undo"))return;let n=0;e.changes.iterChanges((o,r,s,i,a)=>{const l=a.sliceString(0,a.length,`
|
|
119
|
+
`);o!==r&&this.getTextFromDoc(this.doc).delete(o+n,r-o),l.length>0&&this.getTextFromDoc(this.doc).insert(o+n,l),n+=l.length-(r-o)}),this.doc.commit()}destroy(){var e;(e=this.sub)==null||e.call(this),this.sub=void 0}}const Jt=ut.get("rtc"),Tx=Jt.get("awareness").disabled(),Cu="awareness:",Rr=jt(void 0),Lt=new Ij,al=new class{constructor(t,e=3e4){this.listeners=new Set,this.inner=new tz(t,e),this.peer=t,this.timeout=e}apply(t,e="remote"){const{updated:n,added:o}=this.inner.apply(t);this.listeners.forEach(r=>{r({updated:n,added:o,removed:[]},e)}),this.startTimerIfNotEmpty()}setLocalState(t){const e=this.inner.getState(this.peer)==null;this.inner.setLocalState(t),e?this.listeners.forEach(n=>{n({updated:[],added:[this.inner.peer()],removed:[]},"local")}):this.listeners.forEach(n=>{n({updated:[this.inner.peer()],added:[],removed:[]},"local")}),this.startTimerIfNotEmpty()}getLocalState(){return this.inner.getState(this.peer)}getAllStates(){return this.inner.getAllStates()}encode(t){return this.inner.encode(t)}encodeAll(){return this.inner.encodeAll()}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}peers(){return this.inner.peers()}destroy(){clearInterval(this.timer),this.listeners.clear()}startTimerIfNotEmpty(){this.inner.isEmpty()||this.timer!=null||(this.timer=setInterval(()=>{const t=this.inner.removeOutdated();t.length>0&&this.listeners.forEach(e=>{e({updated:[],added:[],removed:t},"timeout")}),this.inner.isEmpty()&&(clearInterval(this.timer),this.timer=void 0)},this.timeout/2))}}(Lt.peerIdStr),ju=oP(()=>{Jt.debug("creating websocket");const t=nC().getWsSyncURL(gC()).toString(),e=new IF(t,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4});return Promise.resolve().then(async()=>{await oC(),rP()==="edit"&&e.reconnect()}),e.addEventListener("message",async n=>{const o=n.data,r=await o.arrayBuffer(),s=new Uint8Array(r);if(function(i,a){return new TextDecoder().decode(i.slice(0,a.length))===a}(s,Cu)){const i=function(a,l){return a.slice(l.length)}(s,Cu);return al.apply(i),void Tx.debug("applied awareness update")}Lt.import(s),Jt.debug("imported doc change. new doc:",Lt.toJSON()),Qe.get(Rr)!==Lt&&Qe.set(Rr,Lt)}),e.addEventListener("open",()=>{Jt.debug("websocket open")}),e.addEventListener("close",n=>{Jt.warn("websocket close",n),Qe.get(Rr)===Lt&&Qe.set(Rr,void 0)}),e});function Su(t,e,n=""){if(tn())return{extension:[],code:n};const o=Lt.getByPath(`codes/${t}`)!==void 0,r=Lt.getMap("codes").getOrCreateContainer(t,new hp);o||(Jt.log("initializing code for new cell",n),r.insert(0,n));const s={get name(){return Qe.get(xC)||"Anonymous"},get colorClassName(){return(i=>{if(typeof i=="string"){let a=0;for(let l=0;l<i.length;l++)a=(a<<5)-a+i.charCodeAt(l),a=Math.trunc(a);return il[Math.abs(a)%il.length]}return il[i%il.length]})(this.name)}};return{code:n.toString(),extension:[L5(t),F5(t),z5(Lt,al,s,()=>r,t),R5(Lt,["codes",t],()=>r)]}}function L5(t){const e=(o,r)=>{const s=o.state.field(Mc).type,i=r.toString();i&&i!==s&&(Jt.debug(`[incoming] setting language type: ${s} -> ${i}`),pr(o,{language:i,keepCodeAsIs:!0}))},n=(o,r)=>{const s=o.state.field(Ym),i=r.toJSON();Vi(s,i)||o.dispatch({effects:[mC.of(i)],annotations:[Dr.of(!0)]})};return $n.define(o=>{let r;return Promise.resolve().then(()=>{const s=Lt.getByPath(`languages/${t}`);if(!s)return void Jt.error("no language container found for cell",t);Un(s instanceof hp,"language type is not a LoroText");const i=Lt.getByPath(`language_metadata/${t}`);i?(Un(i instanceof Tj,"language metadata is not a LoroMap"),e(o,s),n(o,i),r=Lt.subscribe(a=>{if(a.origin==="local")return;const l=a.events.some(d=>d.target===s.id),c=a.events.some(d=>d.target===i.id);l&&e(o,s),c&&n(o,i)})):Jt.error("no language metadata container found for cell",t)}),{destroy(){r()}}})}function F5(t){const e=Lt.getMap("languages").getOrCreateContainer(t,new hp),n=Lt.getMap("language_metadata").getOrCreateContainer(t,new Tj);return We.updateListener.of(o=>{const r=e.toString()!=="";if(!o.docChanged&&r)return;if(!r){const i=Gm(o.state).type;pr(o.view,{language:i}),Jt.debug("no initial language, setting default to",i),e.delete(0,e.length),e.insert(0,i),Jt.debug("no initial language metadata, setting default to",o.state.field(Ym));const a=o.state.field(Ym);for(const l of Object.keys(a))n.set(l,a[l]);return void Lt.commit()}let s=!1;for(const i of o.transactions)if(!i.annotation(Dr)){for(const a of i.effects)if(a.is(nP)&&e.toString()!==a.value.type&&(Jt.debug(`[outgoing] language change: ${e} -> ${a.value.type}`),e.delete(0,e.length),e.insert(0,a.value.type),s=!0),a.is(mC)||a.is(pC)){const l=a.value;a.is(pC)?(Jt.debug("[outgoing] setting language metadata: ",l),n.clear()):Jt.debug("[outgoing] updating language metadata: ",l);for(const c of Object.keys(l))n.set(c,l[c]);s=!0}}s&&Lt.commit()})}function z5(t,e,n,o,r,s){const i=`loro:cell:${r}`;return[ku,fC({above:!0,class:"loro-cursor-layer",update:Ix,markers:a=>{const{remoteCursors:l,isCheckout:c}=a.state.field(ku);return c?[]:[...l.values()].flatMap(d=>{var f,m;const h=Qn.cursor(d.cursor.anchor);return sl.createCursor(a,h,((f=d.user)==null?void 0:f.name)||"unknown",((m=d.user)==null?void 0:m.colorClassName)||"")})}}),fC({above:!1,class:"loro-selection-layer",update:Ix,markers:a=>{const{remoteCursors:l,isCheckout:c}=a.state.field(ku);return c?[]:[...l.entries()].filter(([,d])=>d.cursor.head!==void 0&&d.cursor.anchor!==d.cursor.head).flatMap(([,d])=>{var f;const h=Qn.range(d.cursor.anchor,d.cursor.head);return eP.forRange(a,`loro-selection ${((f=d.user)==null?void 0:f.colorClassName)||""}`,h)})}}),$n.define(a=>new M5(a,t,n,e,o,i,s)),$n.define(a=>new O5(a,t,e,i)),A5]}function ll(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}Pc()&&ju(),Lt.subscribeLocalUpdates(t=>{Jt.debug("local update, sending to server"),ju().send(t)}),al.addListener((t,e)=>{const n=[...t.added,...t.removed,...t.updated];e==="local"&&(Tx.debug("awareness changes",n),ju().send(function(o,r){const s=new TextEncoder().encode(o);return new Uint8Array([...s,...r])}(Cu,al.encode(n))))});var Mx={modified:{doc:""},original:{doc:""}},Ox=M.createContext(Mx);function B5(t,e){return vt({},t,e,{modified:vt({},t.modified,e.modified),original:vt({},t.original,e.original)})}var Nu=()=>M.useContext(Ox),U5=t=>{var{children:e,theme:n}=t,[o,r]=M.useReducer(B5,vt({},Mx,{theme:n}));return M.useEffect(()=>r({theme:n}),[n]),u.jsx(Ox.Provider,{value:vt({},o,{dispatch:r}),children:e})},$5=["extensions","value","selection","onChange"],Dx=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=ea(t,$5),{theme:i,dispatch:a}=Nu(),l=ks(vt({},s,{theme:i}));return M.useEffect(()=>a({original:{doc:n,selection:o,extensions:[...l,...e]},originalExtension:{onChange:r,option:s,extension:[e]}}),[t]),null};Dx.displayName="CodeMirrorMerge.Original";var V5=["extensions","value","selection","onChange"],Rx=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=ea(t,V5),{theme:i,dispatch:a}=Nu(),l=ks(vt({},s,{theme:i}));return M.useEffect(()=>{a({modified:{doc:n,selection:o,extensions:[...l,...e]},modifiedExtension:{onChange:r,option:s,extension:[e]}})},[t]),null};Rx.displayName="CodeMirrorMerge.Modified";class Et{constructor(e,n,o,r){this.fromA=e,this.toA=n,this.fromB=o,this.toB=r}offset(e,n=e){return new Et(this.fromA+e,this.toA+e,this.fromB+n,this.toB+n)}}function ar(t,e,n,o,r,s){if(t==o)return[];let i=Au(t,e,n,o,r,s),a=Tu(t,e+i,n,o,r+i,s),l=(n-=a)-(e+=i),c=(s-=a)-(r+=i);if(!l||!c)return[new Et(e,n,r,s)];if(l>c){let h=t.slice(e,n).indexOf(o.slice(r,s));if(h>-1)return[new Et(e,e+h,r,r),new Et(e+h+c,n,s,s)]}else if(c>l){let h=o.slice(r,s).indexOf(t.slice(e,n));if(h>-1)return[new Et(e,e,r,r+h),new Et(n,n,r+h+l,s)]}if(l==1||c==1)return[new Et(e,n,r,s)];let d=Fx(t,e,n,o,r,s);if(d){let[h,f,m]=d;return ar(t,e,h,o,r,f).concat(ar(t,h+m,n,o,f+m,s))}return function(h,f,m,g,x,p){let b=m-f,y=p-x;if(ri<1e9&&Math.min(b,y)>16*ri||si>0&&Date.now()>si)return Math.min(b,y)>64*ri?[new Et(f,m,x,p)]:zx(h,f,m,g,x,p);let v=Math.ceil((b+y)/2);_u.reset(v),Iu.reset(v);let w=(S,E)=>h.charCodeAt(f+S)==g.charCodeAt(x+E),j=(S,E)=>h.charCodeAt(m-S-1)==g.charCodeAt(p-E-1),C=(b-y)%2!=0?Iu:null,N=C?null:_u;for(let S=0;S<v;S++){if(S>ri||si>0&&!(63&S)&&Date.now()>si)return zx(h,f,m,g,x,p);let E=_u.advance(S,b,y,v,C,!1,w)||Iu.advance(S,b,y,v,N,!0,j);if(E)return H5(h,f,m,f+E[0],g,x,p,x+E[1])}return[new Et(f,m,x,p)]}(t,e,n,o,r,s)}let ri=1e9,si=0,Eu=!1;class Px{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,n,o,r,s,i,a){for(let l=-e+this.start;l<=e-this.end;l+=2){let c=r+l,d=l==-e||l!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,h=d-l;for(;d<n&&h<o&&a(d,h);)d++,h++;if(this.vec[c]=d,d>n)this.end+=2;else if(h>o)this.start+=2;else if(s){let f=r+(n-o)-l;if(f>=0&&f<this.len&&s.vec[f]!=-1){if(i){let m=s.vec[f];if(m>=n-d)return[m,r+m-f]}else if(d>=n-s.vec[f])return[d,h]}}}return null}}const _u=new Px,Iu=new Px;function H5(t,e,n,o,r,s,i,a){let l=!1;return Pr(t,o)||++o!=n||(l=!0),Pr(r,a)||++a!=i||(l=!0),l?[new Et(e,n,s,i)]:ar(t,e,o,r,s,a).concat(ar(t,o,n,r,a,i))}function Lx(t,e){let n=1,o=Math.min(t,e);for(;n<o;)n<<=1;return n}function Au(t,e,n,o,r,s){if(e==n||e==s||t.charCodeAt(e)!=o.charCodeAt(r))return 0;let i=Lx(n-e,s-r);for(let a=e,l=r;;){let c=a+i,d=l+i;if(c>n||d>s||t.slice(a,c)!=o.slice(l,d)){if(i==1)return a-e-(Pr(t,a)?0:1);i>>=1}else{if(c==n||d==s)return c-e;a=c,l=d}}}function Tu(t,e,n,o,r,s){if(e==n||r==s||t.charCodeAt(n-1)!=o.charCodeAt(s-1))return 0;let i=Lx(n-e,s-r);for(let a=n,l=s;;){let c=a-i,d=l-i;if(c<e||d<r||t.slice(c,a)!=o.slice(d,l)){if(i==1)return n-a-(Pr(t,a)?0:1);i>>=1}else{if(c==e||d==r)return n-c;a=c,l=d}}}function Mu(t,e,n,o,r,s,i,a){let l=o.slice(r,s),c=null;for(;;){if(c||i<a)return c;for(let d=e+i;;){Pr(t,d)||d++;let h=d+i;if(Pr(t,h)||(h+=h==d+1?1:-1),h>=n)break;let f=t.slice(d,h),m=-1;for(;(m=l.indexOf(f,m+1))!=-1;){let g=Au(t,h,n,o,r+m+f.length,s),x=Tu(t,e,d,o,r,r+m),p=f.length+g+x;(!c||c[2]<p)&&(c=[d-x,r+m-x,p])}d=h}if(a<0)return c;i>>=1}}function Fx(t,e,n,o,r,s){let i=n-e,a=s-r;if(i<a){let l=Fx(o,r,s,t,e,n);return l&&[l[1],l[0],l[2]]}return i<4||2*a<i?null:Mu(t,e,n,o,r,s,Math.floor(i/4),-1)}function zx(t,e,n,o,r,s){Eu=!0;let i,a=n-e,l=s-r;if(a<l){let f=Mu(o,r,s,t,e,n,Math.floor(a/6),50);i=f&&[f[1],f[0],f[2]]}else i=Mu(t,e,n,o,r,s,Math.floor(l/6),50);if(!i)return[new Et(e,n,r,s)];let[c,d,h]=i;return ar(t,e,c,o,r,d).concat(ar(t,c+h,n,o,d+h,s))}function Bx(t,e){for(let n=1;n<t.length;n++){let o=t[n-1],r=t[n];o.toA>r.fromA-e&&o.toB>r.fromB-e&&(t[n-1]=new Et(o.fromA,r.toA,o.fromB,r.toB),t.splice(n--,1))}}let lr;try{lr=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function Ux(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function $x(t,e){if(e==t.length)return 0;let n=t.charCodeAt(e);return n<192?Ux(n)?1:0:lr?Kx(n)&&e!=t.length-1?lr.test(t.slice(e,e+2))?2:0:lr.test(String.fromCharCode(n))?1:0:0}function Vx(t,e){if(!e)return 0;let n=t.charCodeAt(e-1);return n<192?Ux(n)?1:0:lr?Xx(n)&&e!=1?lr.test(t.slice(e-2,e))?2:0:lr.test(String.fromCharCode(n))?1:0:0}const Hx=8;function Wx(t,e,n){if(e==t.length||!Vx(t,e))return e;for(let o=e,r=e+n,s=0;s<Hx;s++){let i=$x(t,o);if(!i||o+i>r)return o;o+=i}return e}function qx(t,e,n){if(!e||!$x(t,e))return e;for(let o=e,r=e-n,s=0;s<Hx;s++){let i=Vx(t,o);if(!i||o-i<r)return o;o-=i}return e}function Gx(t,e,n){for(;e!=n;e--)if(t.charCodeAt(e-1)==10)return e;return-1}function Yx(t,e,n){for(;e!=n;e++)if(t.charCodeAt(e)==10)return e;return-1}const Kx=t=>t>=55296&&t<=56319,Xx=t=>t>=56320&&t<=57343;function Pr(t,e){return!e||e==t.length||!Kx(t.charCodeAt(e-1))||!Xx(t.charCodeAt(e))}function W5(t,e,n){var o;return ri=((o=n==null?void 0:n.scanLimit)!==null&&o!==void 0?o:1e9)>>1,si=n!=null&&n.timeout?Date.now()+n.timeout:0,Eu=!1,function(r,s,i){for(;;){Bx(i,1);let a=!1;for(let l=0;l<i.length;l++){let c,d,h=i[l];(c=Au(r,h.fromA,h.toA,s,h.fromB,h.toB))&&(h=i[l]=new Et(h.fromA+c,h.toA,h.fromB+c,h.toB)),(d=Tu(r,h.fromA,h.toA,s,h.fromB,h.toB))&&(h=i[l]=new Et(h.fromA,h.toA-d,h.fromB,h.toB-d));let f=h.toA-h.fromA,m=h.toB-h.fromB;if(f&&m)continue;let g=h.fromA-(l?i[l-1].toA:0),x=(l<i.length-1?i[l+1].fromA:r.length)-h.toA;if(!g||!x)continue;let p=f?r.slice(h.fromA,h.toA):s.slice(h.fromB,h.toB);g<=p.length&&r.slice(h.fromA-g,h.fromA)==p.slice(p.length-g)?(i[l]=new Et(h.fromA-g,h.toA-g,h.fromB-g,h.toB-g),a=!0):x<=p.length&&r.slice(h.toA,h.toA+x)==p.slice(0,x)&&(i[l]=new Et(h.fromA+x,h.toA+x,h.fromB+x,h.toB+x),a=!0)}if(!a)break}return i}(t,e,ar(t,0,t.length,e,0,e.length))}function Jx(){return!Eu}function Zx(t,e,n){return function(o,r,s){for(let i=0,a=0;a<o.length;a++){let l=o[a],c=l.toA-l.fromA,d=l.toB-l.fromB;if(c&&d||c>3||d>3){let h=a==o.length-1?r.length:o[a+1].fromA,f=l.fromA-i,m=h-l.toA,g=qx(r,l.fromA,f),x=Wx(r,l.toA,m),p=l.fromA-g,b=x-l.toA;if((!c||!d)&&p&&b){let y=Math.max(c,d),[v,w,j]=c?[r,l.fromA,l.toA]:[s,l.fromB,l.toB];y>p&&r.slice(g,l.fromA)==v.slice(j-p,j)?(l=o[a]=new Et(g,g+c,l.fromB-p,l.toB-p),g=l.fromA,x=Wx(r,l.toA,h-l.toA)):y>b&&r.slice(l.toA,x)==v.slice(w,w+b)&&(l=o[a]=new Et(x-c,x,l.fromB+b,l.toB+b),x=l.toA,g=qx(r,l.fromA,l.fromA-i)),p=l.fromA-g,b=x-l.toA}if(p||b)l=o[a]=new Et(l.fromA-p,l.toA+b,l.fromB-p,l.toB+b);else if(c){if(!d){let y,v=Yx(r,l.fromA,l.toA),w=v<0?-1:Gx(r,l.toA,l.fromA);v>-1&&(y=v-l.fromA)<=m&&r.slice(l.fromA,v)==r.slice(l.toA,l.toA+y)?l=o[a]=l.offset(y):w>-1&&(y=l.toA-w)<=f&&r.slice(l.fromA-y,l.fromA)==r.slice(w,l.toA)&&(l=o[a]=l.offset(-y))}}else{let y,v=Yx(s,l.fromB,l.toB),w=v<0?-1:Gx(s,l.toB,l.fromB);v>-1&&(y=v-l.fromB)<=m&&s.slice(l.fromB,v)==s.slice(l.toB,l.toB+y)?l=o[a]=l.offset(y):w>-1&&(y=l.toB-w)<=f&&s.slice(l.fromB-y,l.fromB)==s.slice(w,l.toB)&&(l=o[a]=l.offset(-y))}}i=l.toA}return Bx(o,3),o}(W5(t,e,n),t,e)}const Wn=yr.define({combine:t=>t[0]}),Ou=Tt.define(),q5=yr.define(),Lr=vn.define({create:t=>null,update(t,e){for(let n of e.effects)n.is(Ou)&&(t=n.value);for(let n of e.state.facet(q5))t=n(t,e);return t}});class Fr{constructor(e,n,o,r,s,i=!0){this.changes=e,this.fromA=n,this.toA=o,this.fromB=r,this.toB=s,this.precise=i}offset(e,n){return e||n?new Fr(this.changes,this.fromA+e,this.toA+e,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,n,o){return tb(Zx(e.toString(),n.toString(),o),e,n,0,0,Jx())}static updateA(e,n,o,r,s){return rb(ob(e,r,!0,o.length),e,n,o,s)}static updateB(e,n,o,r,s){return rb(ob(e,r,!1,n.length),e,n,o,s)}}function Qx(t,e,n,o){let r=n.lineAt(t),s=o.lineAt(e);return r.to==t&&s.to==e&&t<n.length&&e<o.length?[t+1,e+1]:[r.from,s.from]}function eb(t,e,n,o){let r=n.lineAt(t),s=o.lineAt(e);return r.from==t&&s.from==e?[t,e]:[r.to+1,s.to+1]}function tb(t,e,n,o,r,s){let i=[];for(let a=0;a<t.length;a++){let l=t[a],[c,d]=Qx(l.fromA+o,l.fromB+r,e,n),[h,f]=eb(l.toA+o,l.toB+r,e,n),m=[l.offset(-c+o,-d+r)];for(;a<t.length-1;){let g=t[a+1],[x,p]=Qx(g.fromA+o,g.fromB+r,e,n);if(x>h+1&&p>f+1)break;m.push(g.offset(-c+o,-d+r)),[h,f]=eb(g.toA+o,g.toB+r,e,n),a++}i.push(new Fr(m,c,Math.max(c,h),d,Math.max(d,f),s))}return i}const cl=1e3;function nb(t,e,n,o){let r=0,s=t.length;for(;;){if(r==s){let d=0,h=0;r&&({toA:d,toB:h}=t[r-1]);let f=e-(n?d:h);return[d+f,h+f]}let i=r+s>>1,a=t[i],[l,c]=n?[a.fromA,a.toA]:[a.fromB,a.toB];if(l>e)s=i;else{if(!(c<=e))return o?[a.fromA,a.fromB]:[a.toA,a.toB];r=i+1}}}function ob(t,e,n,o){let r=[];return e.iterChangedRanges((s,i,a,l)=>{let c=0,d=n?e.length:o,h=0,f=n?o:e.length;s>cl&&([c,h]=nb(t,s-cl,n,!0)),i<e.length-cl&&([d,f]=nb(t,i+cl,n,!1));let m,g=l-a-(i-s),[x,p]=n?[g,0]:[0,g];r.length&&(m=r[r.length-1]).toA>=c?r[r.length-1]={fromA:m.fromA,fromB:m.fromB,toA:d,toB:f,diffA:m.diffA+x,diffB:m.diffB+p}:r.push({fromA:c,toA:d,fromB:h,toB:f,diffA:x,diffB:p})}),r}function rb(t,e,n,o,r){if(!t.length)return e;let s=[];for(let i=0,a=0,l=0,c=0;;i++){let d=i==t.length?null:t[i],h=d?d.fromA+a:n.length,f=d?d.fromB+l:o.length;for(;c<e.length;){let p=e[c];if(p.toA+a>h||p.toB+l>f)break;s.push(p.offset(a,l)),c++}if(!d)break;let m=d.toA+a+d.diffA,g=d.toB+l+d.diffB,x=Zx(n.sliceString(h,m),o.sliceString(f,g),r);for(let p of tb(x,n,o,h,f,Jx()))s.push(p);for(a+=d.diffA,l+=d.diffB;c<e.length;){let p=e[c];if(p.fromA+a>m&&p.fromB+l>g)break;c++}}return s}const G5={scanLimit:500},sb=$n.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=lb(t))}update(t){var e,n;(t.docChanged||t.viewportChanged||(e=t.startState,n=t.state,e.field(Lr,!1)!=n.field(Lr,!1))||function(o,r){return o.facet(Wn)!=r.facet(Wn)}(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=lb(t.view))}},{decorations:t=>t.deco}),dl=To.low(iP({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(sb))===null||e===void 0?void 0:e.gutter)||aP.empty}})),ib=ot.line({class:"cm-changedLine"}),Y5=ot.mark({class:"cm-changedText"}),K5=ot.mark({tagName:"ins",class:"cm-insertedLine"}),X5=ot.mark({tagName:"del",class:"cm-deletedLine"}),ab=new class extends lP{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function J5(t,e,n,o,r,s){let i=n?t.fromA:t.fromB,a=n?t.toA:t.toB,l=0;if(i!=a){r.add(i,i,ib),r.add(i,a,n?X5:K5),s&&s.add(i,i,ab);for(let c=e.iterRange(i,a-1),d=i;!c.next().done;){if(c.lineBreak){d++,r.add(d,d,ib),s&&s.add(d,d,ab);continue}let h=d+c.value.length;if(o)for(;l<t.changes.length;){let f=t.changes[l],m=i+(n?f.fromA:f.fromB),g=i+(n?f.toA:f.toB),x=Math.max(d,m),p=Math.min(h,g);if(x<p&&r.add(x,p,Y5),!(g<h))break;l++}d=h}}}function lb(t){let e=t.state.field(Lr),{side:n,highlightChanges:o,markGutter:r,overrideChunk:s}=t.state.facet(Wn),i=n=="a",a=new ms,l=r?new ms:null,{from:c,to:d}=t.viewport;for(let h of e){if((i?h.fromA:h.fromB)>=d)break;(i?h.toA:h.toB)>c&&(s&&s(t.state,h,a,l)||J5(h,t.state.doc,i,o,a,l))}return{deco:a.finish(),gutter:l&&l.finish()}}class ul extends bs{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement("div");return e.className="cm-mergeSpacer",e.style.height=this.height+"px",e}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}const hl=Tt.define({map:(t,e)=>t.map(e)}),ii=vn.define({create:()=>ot.none,update:(t,e)=>{for(let n of e.effects)if(n.is(hl))return n.value;return t.map(e.changes)},provide:t=>We.decorations.from(t)}),Du=.01;function cb(t,e){if(t.size!=e.size)return!1;let n=t.iter(),o=e.iter();for(;n.value;){if(n.from!=o.from||Math.abs(n.value.spec.widget.height-o.value.spec.widget.height)>1)return!1;n.next(),o.next()}return!0}const Ru=Tt.define({map:(t,e)=>e.mapPos(t)});class Z5 extends bs{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let n=document.createElement("div");return n.className="cm-collapsedLines",n.textContent=e.state.phrase("$ unchanged lines",this.lines),n.addEventListener("click",o=>{let r=e.posAtDOM(o.target);e.dispatch({effects:Ru.of(r)});let{side:s,sibling:i}=e.state.facet(Wn);i&&i().dispatch({effects:Ru.of(Q5(r,e.state.field(Lr),s=="a"))})}),n}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function Q5(t,e,n){let o=0,r=0;for(let s=0;;s++){let i=s<e.length?e[s]:null;if(!i||(n?i.fromA:i.fromB)>=t)return r+(t-o);[o,r]=n?[i.toA,i.toB]:[i.toB,i.toA]}}const e_=vn.define({create:t=>ot.none,update(t,e){t=t.map(e.changes);for(let n of e.effects)n.is(Ru)&&(t=t.update({filter:o=>o!=n.value}));return t},provide:t=>We.decorations.from(t)});function db({margin:t=3,minSize:e=4}){return e_.init(n=>function(o,r,s){let i=new ms,a=o.facet(Wn).side=="a",l=o.field(Lr),c=1;for(let d=0;;d++){let h=d<l.length?l[d]:null,f=d?c+r:1,m=h?o.doc.lineAt(a?h.fromA:h.fromB).number-1-r:o.doc.lines,g=m-f+1;if(g>=s&&i.add(o.doc.line(f).from,o.doc.line(m).to,ot.replace({widget:new Z5(g),block:!0})),!h)break;c=o.doc.lineAt(Math.min(o.doc.length,a?h.toA:h.toB)).number}return i.finish()}(n,t,e))}const t_=We.styleModule.of(new sP({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),n_=We.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"\u299A"',marginInlineEnd:"7px"},"&:after":{content:'"\u299A"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),ub=new $m,fl=new $m;class hb{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||G5;let n=[To.low(sb),n_,t_,ii,We.updateListener.of(h=>{this.measuring<0&&(h.heightChanged||h.viewportChanged)&&!h.transactions.some(f=>f.effects.some(m=>m.is(hl)))&&this.measure()})],o=[Wn.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&o.push(dl);let r=Ji.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],We.editorAttributes.of({class:"cm-merge-a"}),fl.of(o),n]}),s=[Wn.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&s.push(dl);let i=Ji.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],We.editorAttributes.of({class:"cm-merge-b"}),fl.of(s),n]});this.chunks=Fr.build(r.doc,i.doc,this.diffConf);let a=[Lr.init(()=>this.chunks),ub.of(e.collapseUnchanged?db(e.collapseUnchanged):[])];r=r.update({effects:Tt.appendConfig.of(a)}).state,i=i.update({effects:Tt.appendConfig.of(a)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let l=e.orientation||"a-b",c=document.createElement("div");c.className="cm-mergeViewEditor";let d=document.createElement("div");d.className="cm-mergeViewEditor",this.editorDOM.appendChild(l=="a-b"?c:d),this.editorDOM.appendChild(l=="a-b"?d:c),this.a=new We({state:r,parent:c,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.a)}),this.b=new We({state:i,parent:d,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,n){if(e.some(o=>o.docChanged)){let o=e[e.length-1],r=e.reduce((i,a)=>i.compose(a.changes),Ki.empty(e[0].startState.doc.length));this.chunks=n==this.a?Fr.updateA(this.chunks,o.newDoc,this.b.state.doc,r,this.diffConf):Fr.updateB(this.chunks,this.a.state.doc,o.newDoc,r,this.diffConf),n.update([...e,o.state.update({effects:Ou.of(this.chunks)})]);let s=n==this.a?this.b:this.a;s.update([s.state.update({effects:Ou.of(this.chunks)})]),this.scheduleMeasure()}else n.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let s=e.orientation!="b-a";if(s!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let i=this.a.dom.parentNode,a=this.b.dom.parentNode;i.remove(),a.remove(),this.editorDOM.insertBefore(s?i:a,this.editorDOM.firstChild),this.editorDOM.appendChild(s?a:i),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let s=!!this.revertDOM,i=this.revertToA,a=this.renderRevert;"revertControls"in e&&(s=!!e.revertControls,i=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(a=e.renderRevertControl),this.setupRevertControls(s,i,a)}let n="highlightChanges"in e,o="gutter"in e,r="collapseUnchanged"in e;if(n||o||r){let s=[],i=[];if(n||o){let a=this.a.state.facet(Wn),l=o?e.gutter!==!1:a.markGutter,c=n?e.highlightChanges!==!1:a.highlightChanges;s.push(fl.reconfigure([Wn.of({side:"a",sibling:()=>this.b,highlightChanges:c,markGutter:l}),l?dl:[]])),i.push(fl.reconfigure([Wn.of({side:"b",sibling:()=>this.a,highlightChanges:c,markGutter:l}),l?dl:[]]))}if(r){let a=ub.reconfigure(e.collapseUnchanged?db(e.collapseUnchanged):[]);s.push(a),i.push(a)}this.a.dispatch({effects:s}),this.b.dispatch({effects:i})}this.scheduleMeasure()}setupRevertControls(e,n,o){this.revertToA=n,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=o,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",r=>this.revertClicked(r)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){(function(e,n,o){let r=new ms,s=new ms,i=e.state.field(ii).iter(),a=n.state.field(ii).iter(),l=0,c=0,d=0,h=0,f=e.viewport,m=n.viewport;for(let b=0;;b++){let y=b<o.length?o[b]:null,v=y?y.fromA:e.state.doc.length,w=y?y.fromB:n.state.doc.length;if(l<v){let j=e.lineBlockAt(l).top+d-(n.lineBlockAt(c).top+h);j<-.01?(d-=j,r.add(l,l,ot.widget({widget:new ul(-j),block:!0,side:-1}))):j>Du&&(h+=j,s.add(c,c,ot.widget({widget:new ul(j),block:!0,side:-1})))}if(v>l+1e3&&l<f.from&&v>f.from&&c<m.from&&w>m.from){let j=Math.min(f.from-l,m.from-c);l+=j,c+=j,b--}else{if(!y)break;l=y.toA,c=y.toB}for(;i.value&&i.from<l;)d-=i.value.spec.widget.height,i.next();for(;a.value&&a.from<c;)h-=a.value.spec.widget.height,a.next()}for(;i.value;)d-=i.value.spec.widget.height,i.next();for(;a.value;)h-=a.value.spec.widget.height,a.next();let g=e.contentHeight+d-(n.contentHeight+h);g<Du?r.add(e.state.doc.length,e.state.doc.length,ot.widget({widget:new ul(-g),block:!0,side:1})):g>Du&&s.add(n.state.doc.length,n.state.doc.length,ot.widget({widget:new ul(g),block:!0,side:1}));let x=r.finish(),p=s.finish();cb(x,e.state.field(ii))||e.dispatch({effects:hl.of(x)}),cb(p,n.state.field(ii))||n.dispatch({effects:hl.of(p)})})(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,n=e.firstChild,o=this.a.viewport,r=this.b.viewport;for(let s=0;s<this.chunks.length;s++){let i=this.chunks[s];if(i.fromA>o.to||i.fromB>r.to)break;if(i.fromA<o.from||i.fromB<r.from)continue;let a=this.a.lineBlockAt(i.fromA).top+"px";for(;n&&+n.dataset.chunk<s;)n=fb(n);n&&n.dataset.chunk==String(s)?(n.style.top!=a&&(n.style.top=a),n=n.nextSibling):e.insertBefore(this.renderRevertButton(a,s),n)}for(;n;)n=fb(n)}renderRevertButton(e,n){let o;if(this.renderRevert)o=this.renderRevert();else{o=document.createElement("button");let r=this.a.state.phrase("Revert this chunk");o.setAttribute("aria-label",r),o.setAttribute("title",r),o.textContent=this.revertToLeft?"\u21DC":"\u21DD"}return o.style.top=e,o.setAttribute("data-chunk",String(n)),o}revertClicked(e){let n,o=e.target;for(;o&&o.parentNode!=this.revertDOM;)o=o.parentNode;if(o&&(n=this.chunks[o.dataset.chunk])){let[r,s,i,a,l,c]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],d=r.state.sliceDoc(i,Math.max(i,a-1));i!=a&&c<=s.state.doc.length&&(d+=r.state.lineBreak),s.dispatch({changes:{from:l,to:Math.min(s.state.doc.length,c),insert:d},userEvent:"revert"}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}}function fb(t){let e=t.nextSibling;return t.remove(),e}var o_=["className","children","orientation","revertControls","highlightChanges","gutter","collapseUnchanged","destroyRerender","renderRevertControl","diffConfig","root"],r_=["modified","modifiedExtension","original","originalExtension","theme","dispatch"],mb=q.forwardRef((t,e)=>{var{className:n,children:o,orientation:r,revertControls:s,highlightChanges:i,gutter:a,collapseUnchanged:l,destroyRerender:c=!0,renderRevertControl:d,diffConfig:h,root:f}=t,m=ea(t,o_),g=Nu(),{modified:x,modifiedExtension:p,original:b,originalExtension:y,theme:v,dispatch:w}=g,j=ea(g,r_),C=M.useRef(null),N=M.useRef(),S={orientation:r,revertControls:s,highlightChanges:i,gutter:a,collapseUnchanged:l,renderRevertControl:d,diffConfig:h,root:f};M.useImperativeHandle(e,()=>({container:C.current,view:N.current,modified:x,original:b,config:vt({a:b,b:x,parent:C.current},S)}),[C,N,x,b,S]);var E=We.updateListener.of(I=>{if(I.docChanged&&typeof(y==null?void 0:y.onChange)=="function"){var D=I.state.doc.toString();y==null||y.onChange(D,I)}}),T=We.updateListener.of(I=>{if(I.docChanged&&typeof(p==null?void 0:p.onChange)=="function"){var D=I.state.doc.toString();p==null||p.onChange(D,I)}});return M.useEffect(()=>{!N.current&&C.current&&y&&p&&(N.current=new hb(vt({a:vt({},b,{extensions:[...(y==null?void 0:y.extension)||[],...ks(vt({},y==null?void 0:y.option,{theme:v})),E]}),b:vt({},x,{extensions:[...(p==null?void 0:p.extension)||[],...ks(vt({},p==null?void 0:p.option,{theme:v})),T]}),parent:C.current},S)),w({view:N.current}))},[N,C,y,p]),M.useEffect(()=>{if(b&&b.doc&&N.current){var I,D,F=(I=N.current)==null?void 0:I.a.state.doc.toString();F!==b.doc&&((D=N.current)==null||D.a.dispatch({changes:{from:0,to:F.length,insert:b.doc||""}}))}if(x&&x.doc&&N.current){var O,R,P=(O=N.current)==null?void 0:O.b.state.doc.toString();P!==x.doc&&((R=N.current)==null||R.b.dispatch({changes:{from:0,to:P.length,insert:x.doc||""}}))}if(c&&N.current){var z=N.current.a.state.selection.ranges[0].from,_=N.current.b.state.selection.ranges[0].from;N.current.destroy(),N.current=new hb(vt({a:vt({},b,{extensions:[...(y==null?void 0:y.extension)||[],...ks(vt({},y==null?void 0:y.option,{theme:v}))]}),b:vt({},x,{extensions:[...(p==null?void 0:p.extension)||[],...ks(vt({},p==null?void 0:p.option,{theme:v}))]}),parent:C.current},S)),z&&(N.current.a.focus(),N.current.a.dispatch({selection:{anchor:z,head:z}})),_&&(N.current.b.focus(),N.current.b.dispatch({selection:{anchor:_,head:_}}))}},[N,v,C.current,b,x,y,p,c]),M.useEffect(()=>()=>N.current&&N.current.destroy(),[]),M.useEffect(()=>{if(N.current){var I={};j.orientation!==r&&(I.orientation=r),j.revertControls!==s&&(I.revertControls=s),j.highlightChanges!==i&&(I.highlightChanges=i),j.gutter!==a&&(I.gutter=a),j.collapseUnchanged!==l&&(I.collapseUnchanged=l),j.renderRevertControl!==d&&(I.collapseUnchanged=l),Object.keys(I).length&&w&&N.current&&(N.current.reconfigure(vt({},I)),w(vt({},I)))}},[w,N,r,s,i,a,l,d]),u.jsx("div",vt({ref:C,className:"cm-merge-theme"+(n?" "+n:"")},m,{children:o}))});mb.displayName="CodeMirrorMerge.Internal";var s_=["theme"],zr=q.forwardRef((t,e)=>{var{theme:n}=t,o=ea(t,s_);return u.jsx(U5,{theme:n,children:u.jsx(mb,vt({},o,{ref:e}))})});zr.Original=Dx,zr.Modified=Rx,zr.displayName="CodeMirrorMerge";const i_=zr.Original,a_=zr.Modified,pb=[hP(),We.lineWrapping],l_=t=>{const e=H.c(23),{className:n,onChange:o,initialPrompt:r,currentLanguageAdapter:s,currentCode:i,declineChange:a,acceptChange:l,enabled:c,children:d}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={},e[0]=h):h=e[0];const[f,m]=M.useState(h),[g,x]=zt(Hj),p=M.useId(),b=Km(),{completion:y,input:v,stop:w,isLoading:j,setCompletion:C,setInput:N,handleSubmit:S}=cP({api:b.getAiURL("completion").toString(),headers:b.headers(),initialInput:r,streamProtocol:"text",experimental_throttle:100,body:{...f,includeOtherCode:g?Tc(i):"",code:i,language:s},onError:c_,onFinish:(G,W)=>{E(W.trimEnd())}}),E=C,T=q.useRef(null),I=y.trimEnd();let D,F;e[1]!==c?(D=()=>{var G;c&&(fP(()=>{const W=T.current;return!!(W!=null&&W.view)&&(W.view.focus(),!0)},{retries:3,delay:100,initialDelay:100}),mP((G=T.current)==null?void 0:G.view))},F=[c],e[1]=c,e[2]=D,e[3]=F):(D=e[2],F=e[3]),M.useEffect(D,F),M.useEffect(()=>{c&&N(r||"")},[c,r,N]);const{theme:O}=vr(),R=()=>{l(I),E("")},P=()=>{E("")};let z;e[4]!==n?(z=xe("flex flex-col w-full rounded-[inherit]",n),e[4]=n,e[5]=z):z=e[5];const _=c&&"max-h-[400px] min-h-11 visible",k=!c&&"max-h-0 min-h-0 invisible";let B;e[6]!==_||e[7]!==k?(B=xe("flex items-center gap-2 border-b px-3 transition-all rounded-[inherit] rounded-b-none duration-300",_,k),e[6]=_,e[7]=k,e[8]=B):B=e[8];const A=c&&u.jsxs(u.Fragment,{children:[u.jsx(Pi,{className:"text-(--blue-10) shrink-0",size:16}),u.jsx(Lc,{inputRef:T,className:"h-full my-0 py-1.5",onClose:()=>{a(),E("")},value:v,onChange:G=>{N(G),m(bC({input:G}))},onSubmit:()=>{j||S()},onKeyDown:dP({handleAcceptCompletion:R,handleDeclineCompletion:P,isLoading:j,completion:I})}),j&&u.jsxs(ve,{"data-testid":"stop-completion-button",variant:"text",size:"xs",className:"mb-0",onClick:w,children:[u.jsx(Fc,{className:"animate-spin mr-1",size:14}),"Stop"]}),I&&u.jsx(uP,{isLoading:j,onAccept:R,onDecline:P,size:"xs"}),u.jsx("div",{className:"h-full w-px bg-border mx-2"}),u.jsx(Ee,{content:"Include code from other cells",children:u.jsxs("div",{className:"flex flex-row items-start gap-1 overflow-hidden",children:[u.jsx(yC,{"data-testid":"include-other-cells-checkbox",id:p,checked:g,onCheckedChange:G=>x(!!G)}),u.jsx(gr,{htmlFor:p,className:"text-muted-foreground text-xs whitespace-nowrap ellipsis",children:"Include all code"})]})}),u.jsx(ve,{"data-testid":"decline-completion-button",variant:"text",size:"icon",disabled:j,onClick:()=>{w(),a(),E("")},children:u.jsx(wn,{className:"text-(--red-10)",size:16})})]});let U,V;e[9]!==B||e[10]!==A?(U=u.jsx("div",{className:B,children:A}),e[9]=B,e[10]=A,e[11]=U):U=e[11],e[12]!==I||e[13]!==i||e[14]!==c||e[15]!==o||e[16]!==O?(V=I&&c&&u.jsxs(zr,{className:"cm",theme:O,children:[u.jsx(i_,{onChange:o,value:i,extensions:pb}),u.jsx(a_,{value:I,editable:!1,readOnly:!0,extensions:pb})]}),e[12]=I,e[13]=i,e[14]=c,e[15]=o,e[16]=O,e[17]=V):V=e[17];const X=(!I||!c)&&d;let Y;return e[18]!==U||e[19]!==V||e[20]!==X||e[21]!==z?(Y=u.jsxs("div",{className:z,children:[U,V,X]}),e[18]=U,e[19]=V,e[20]=X,e[21]=z,e[22]=Y):Y=e[22],Y};function c_(t){Je({title:"Completion failed",description:vC(t)})}const Pu="web application/x-marimo-cell",d_=ft({cells:pP(ft({code:at()})),version:gt("1.0")}),gb=t=>{const e=t===1?"Cell":`${t} cells`;Je({title:`${e} copied`,description:`${e} ${t===1?"has":"have"} been copied to clipboard.`})},u_=()=>{Je({title:"Copy failed",description:"Failed to copy cells to clipboard.",variant:"danger"})},h_=()=>{Je({title:"Nothing to paste",description:"No cell or text found in clipboard.",variant:"danger"})},f_=()=>{Je({title:"Paste failed",description:"Failed to read from clipboard",variant:"danger"})};class m_{constructor(){this.items={}}add(e,n){return ClipboardItem.supports(e)?typeof n=="string"?(this.items[e]=new Blob([n],{type:e}),this):(this.items[e]=new Blob([JSON.stringify(n)],{type:e}),this):(ut.warn(`ClipboardItem does not support ${e}`),this)}build(){return new ClipboardItem(this.items)}}const ai=jt(!1),li=new WeakMap;function xb(t){return{handle:e=>t(e),bulkHandle:e=>{let n=!0;try{for(const o of e)n=n&&t(o);return n}catch{return!1}}}}function ro(t){return{handle:e=>t([e]),bulkHandle:e=>t(e)}}function bb(t,e){const n=H.c(30),{canMoveX:o,editorView:r,cellActionDropdownRef:s}=e,{saveOrNameNotebook:i}=Cd(),{saveCellConfig:a}=nt(),l=Ct(Ts),c=lt(),d=Om(),h=Ct(ai),f=Is(),m=Ne(wC),{copyCells:g,pasteAtCell:x}=function(){const O=lt(),R=Fe(async z=>{const _=bn(),k=z.map(B=>_.cellData[B]).filter(Boolean);if(k.length!==0)try{const B={cells:k.map(V=>({code:V.code})),version:"1.0"},A=k.map(V=>V.code).join(`
|
|
120
120
|
|
|
121
121
|
`),U=new m_().add(Pu,B).add("text/plain",A).build();await navigator.clipboard.write([U]),gb(k.length)}catch(B){ut.error("Failed to copy cells to clipboard",B);try{const A=k.map(U=>U.code).join(`
|
|
122
122
|
|
|
123
|
-
`);await navigator.clipboard.writeText(A),gb(k.length)}catch{u_()}}}),P=Fe(async(z,_)=>{const{before:k=!1}=_??{};try{const B=await navigator.clipboard.read();for(const U of B)if(U.types.includes(Pu)){const V=await U.getType(Pu),X=await V.text();try{const Y=d_.parse(JSON.parse(X));if(Y.cells.length===0)break;const G=z,W=Y.cells.reverse();for(const J of W)O.createNewCell({cellId:G,before:k,code:J.code,autoFocus:!0});return}catch(Y){ut.warn("Failed to parse clipboard cell data",Y)}}const A=await navigator.clipboard.readText();A.trim()?O.createNewCell({cellId:z,before:k,code:A,autoFocus:!0}):h_()}catch(B){ut.error("Failed to paste from clipboard",B),f_()}});return{copyCells:R,pasteAtCell:P}}(),p=ja(),b=function(O){const R=H.c(2);let P,z;return R[0]!==O?(z=jt(_=>_(Sd).selected.has(O)),R[0]=O,R[1]=z):z=R[1],P=z,Ne(P)}(t),y=Ps(),v=Os(),w=Ne(Cc);let j;n[0]!==y||n[1]!==p?(j={clear:()=>{y.clear(),p.clear()},extend:O=>{y.clear(),p.extend(O)},select:O=>{y.clear(),p.select(O)}},n[0]=y,n[1]=p,n[2]=j):j=n[2];const C=j,N=Ne(Fi);let S;n[3]!==N?(S=(O,R)=>ic(N.getHotkey(O).key)(R.nativeEvent||R),n[3]=N,n[4]=S):S=n[4];const E=S,T=function(O){const R=H.c(11),P=CC(),z=lt(),_=Ct(ai);let k,B,A;R[0]!==O||R[1]!==P?(k=()=>{P.focusCell({cellId:O})},R[0]=O,R[1]=P,R[2]=k):k=R[2],R[3]!==z||R[4]!==O||R[5]!==P||R[6]!==_?(B=()=>{_(!1),z.markTouched({cellId:O}),P.blurCell()},R[3]=z,R[4]=O,R[5]=P,R[6]=_,R[7]=B):B=R[7],R[8]!==k||R[9]!==B?(A={onFocusWithin:k,onBlurWithin:B},R[8]=k,R[9]=B,R[10]=A):A=R[10];const{focusWithinProps:U}=gP(A);return U}(t);let I;n[5]!==c||n[6]!==o||n[7]!==s||n[8]!==t||n[9]!==g||n[10]!==v||n[11]!==r||n[12]!==b||n[13]!==E||n[14]!==m||n[15]!==x||n[16]!==y||n[17]!==f||n[18]!==a||n[19]!==i||n[20]!==C||n[21]!==l||n[22]!==h||n[23]!==d||n[24]!==w?(I={onKeyDown:O=>{if(zn.fromInput(O))return void O.continuePropagation();const R={"Mod+ArrowUp":()=>(c.focusTopCell(),C.clear(),!0),"Mod+ArrowDown":()=>(c.focusBottomCell(),C.clear(),!0),ArrowUp:()=>(c.focusCell({cellId:t,where:"before"}),C.clear(),!0),ArrowDown:()=>(c.focusCell({cellId:t,where:"after"}),C.clear(),!0),ArrowLeft:()=>{if(o){const _=d.get(In),k=_.cellIds.findWithId(t),B=_.cellIds.indexOf(k),A=_.cellIds.at(B-1);if(A&&A.length>0){const U=yb(t,A);return c.focusCell({cellId:U,where:"exact"}),C.clear(),!0}}return!1},ArrowRight:()=>{if(o){const _=d.get(In),k=_.cellIds.findWithId(t),B=_.cellIds.indexOf(k),A=_.cellIds.at(B+1);if(A&&A.length>0){const U=yb(t,A);return c.focusCell({cellId:U,where:"exact"}),C.clear(),!0}}return!1},"Shift+ArrowUp":()=>{const _=d.get(ta);C.extend({cellId:t,allCellIds:_});const k=_.findWithId(t).before(t);return k&&C.extend({cellId:k,allCellIds:_}),c.focusCell({cellId:t,where:"before"}),!0},"Shift+ArrowDown":()=>{const _=d.get(ta);C.extend({cellId:t,allCellIds:_});const k=_.findWithId(t).after(t);return k&&C.extend({cellId:k,allCellIds:_}),c.focusCell({cellId:t,where:"after"}),!0},Escape:()=>!!b&&(C.clear(),!0),Enter:()=>(h(!0),SC(d,t),C.clear(),!0),s:()=>(i(),!0)};for(const[_,k]of Object.entries(R))if(ic(_)(O)&&k())return void O.preventDefault();const P={"cell.run":ro(_=>(f(_),!0)),"cell.runAndNewBelow":ro(_=>{f(_);const k=_[_.length-1];return c.moveToNextCell({cellId:k,before:!1}),!0}),"cell.runAndNewAbove":ro(_=>{f(_);const k=_[0];return c.moveToNextCell({cellId:k,before:!0}),!0}),"cell.createAbove":_=>(c.createNewCell({cellId:_,before:!0}),!0),"cell.createBelow":_=>(c.createNewCell({cellId:_,before:!1}),!0),"cell.moveUp":ro(_=>{const k=_[0];return d.get(In).cellIds.findWithId(k).first()!==k&&(_.forEach(B=>{c.moveCell({cellId:B,before:!0})}),!0)}),"cell.moveDown":ro(_=>{const k=_[_.length-1];return d.get(In).cellIds.findWithId(k).last()!==k&&([..._].reverse().forEach(B=>{c.moveCell({cellId:B,before:!1})}),!0)}),"cell.moveLeft":xb(_=>!!o&&(c.moveCell({cellId:_,direction:"left"}),!0)),"cell.moveRight":xb(_=>!!o&&(c.moveCell({cellId:_,direction:"right"}),!0)),"cell.hideCode":ro(_=>{var B;const k=!_.map(A=>{var V;return((V=d.get(In).cellData[A])==null?void 0:V.config)||null}).every(p_);a({configs:Object.fromEntries(_.map(A=>[A,{hide_code:k}]))});for(const A of _)c.updateCellConfig({cellId:A,config:{hide_code:k}});if(_.length===1){const A=_[0];c.focusCell({cellId:A,where:"after"}),k?((B=r.current)==null||B.contentDOM.blur(),jC(A)):SC(d,A)}return!0}),"cell.focusDown":_=>(c.focusCell({cellId:_,where:"after"}),!0),"cell.focusUp":_=>(c.focusCell({cellId:_,where:"before"}),!0),"cell.sendToBottom":ro(_=>(_.forEach(k=>{c.sendToBottom({cellId:k})}),!0)),"cell.sendToTop":ro(_=>([..._].reverse().forEach(k=>{c.sendToTop({cellId:k})}),!0)),"cell.aiCompletion":_=>{var B;let k=!1;return l(A=>(A==null?void 0:A.cellId)===_?(k=!0,null):{cellId:_}),k&&((B=r.current)==null||B.focus()),!0},"cell.cellActions":()=>{var _;return(_=s.current)==null||_.toggle(),!0},"command.copyCell":ro(_=>(g(_),!0)),"command.pasteCell":_=>(x(_),!0),"command.createCellBefore":_=>!zn.hasModifier(O)&&(c.createNewCell({cellId:_,before:!0,autoFocus:!0}),!0),"command.createCellAfter":_=>!zn.hasModifier(O)&&(c.createNewCell({cellId:_,before:!1,autoFocus:!0}),!0),"cell.delete":()=>{if(!w.keymap.destructive_delete)return!1;const _=z.size>=2?[...z]:[t],k=d.get(In);return!_.some(B=>{const{status:A}=k.cellRuntime[B];return A==="running"||A==="queued"})&&(y.idle?(y.submit(_),!0):(v({cellIds:_}),y.clear(),!0))}},z=function(_){return _.get(Sd).selected}(d);if(m==="vim"&&function(_,k){const B=function(Y){if(Y.ctrlKey||Y.metaKey||Y.altKey)return"";const G=Y.key.toLowerCase();return Y.shiftKey?`shift+${G}`:G}(_),A=_.target;if(!B||!A)return!1;const U=li.get(A);let V=B;U!=null&&U.timeout&&clearTimeout(U.timeout),U&&(V=`${U.sequence} ${B}`);const X=k[V];if(X)return li.delete(A),X();if(!U){const Y=k[B];if(Y)return Y()}if(Object.keys(k).some(Y=>Y.startsWith(`${V} `))){const Y=window.setTimeout(()=>{li.delete(A)},500);return li.set(A,{sequence:V,timeout:Y}),!0}return li.delete(A),!1}(O.nativeEvent||O,{j:R.ArrowDown,k:R.ArrowUp,h:R.ArrowLeft,l:R.ArrowRight,i:R.Enter,"shift+j":R["Shift+ArrowDown"],"shift+k":R["Shift+ArrowUp"],"g g":R["Mod+ArrowUp"],"shift+g":R["Mod+ArrowDown"],"d d":()=>P["cell.delete"](),"y y":()=>(g(z.size>=2?[...z]:[t]),!0),p:()=>(x(t,{before:!1}),!0),"shift+p":()=>(x(t,{before:!0}),!0),o:()=>(c.createNewCell({cellId:t,before:!1,autoFocus:!0}),!0),"shift+o":()=>(c.createNewCell({cellId:t,before:!0,autoFocus:!0}),!0),u:()=>(c.undoDeleteCell(),!0)}))O.preventDefault();else{for(const[_,k]of Object.entries(P))if(E(_,O)){if(k instanceof Function){if(k(t))return void O.preventDefault()}else if(z.size>=2?k.bulkHandle([...z]):k.handle(t))return void O.preventDefault();return}O.continuePropagation()}}},n[5]=c,n[6]=o,n[7]=s,n[8]=t,n[9]=g,n[10]=v,n[11]=r,n[12]=b,n[13]=E,n[14]=m,n[15]=x,n[16]=y,n[17]=f,n[18]=a,n[19]=i,n[20]=C,n[21]=l,n[22]=h,n[23]=d,n[24]=w,n[25]=I):I=n[25];const{keyboardProps:D}=kC(I);let F;return n[26]!==T||n[27]!==b||n[28]!==D?(F=lm(T,D,{"data-selected":b,className:"data-[selected=true]:ring-1 data-[selected=true]:ring-(--blue-8) data-[selected=true]:ring-offset-1"}),n[26]=T,n[27]=b,n[28]=D,n[29]=F):F=n[29],F}function p_(t){return t==null?void 0:t.hide_code}function yb(t,e){const n=document.getElementById(Oi.create(t));if(!n)return e.first();const o=n.getBoundingClientRect();for(const r of e.topLevelIds){const s=document.getElementById(Oi.create(r));if(s){const i=s.getBoundingClientRect();if(o.top<=i.bottom&&o.bottom>=i.top)return r}}return e.last()}const g_=t=>{const e=H.c(24),{editorView:n,code:o,currentLanguageAdapter:r,onAfterToggle:s}=t;let i,a;e[0]!==o?(a=new Bi().isSupported(o)||o.trim()==="",e[0]=o,e[1]=a):a=e[1],i=a;const l=i;let c,d;e[2]!==o?(d=new Rc().isSupported(o)||o.trim()==="",e[2]=o,e[3]=d):d=e[3],c=d;const h=c&&r==="python";let f,m;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(Yo,{color:"var(--sky-11)",strokeWidth:2.5,className:"w-4 h-4"}),e[4]=f):f=e[4],e[5]!==r||e[6]!==n||e[7]!==s||e[8]!==h?(m=u.jsx(Lu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:h,icon:f,toType:"sql",displayName:"SQL",onAfterToggle:s}),e[5]=r,e[6]=n,e[7]=s,e[8]=h,e[9]=m):m=e[9];const g=l&&r==="python";let x,p,b,y,v;return e[10]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx(tc,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[10]=x):x=e[10],e[11]!==r||e[12]!==n||e[13]!==s||e[14]!==g?(p=u.jsx(Lu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:g,icon:x,toType:"markdown",displayName:"Markdown",onAfterToggle:s}),e[11]=r,e[12]=n,e[13]=s,e[14]=g,e[15]=p):p=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(nc,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[16]=b):b=e[16],e[17]!==r||e[18]!==n?(y=u.jsx(Lu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:!0,icon:b,toType:"python",displayName:"Python",onAfterToggle:Bn.NOOP}),e[17]=r,e[18]=n,e[19]=y):y=e[19],e[20]!==p||e[21]!==y||e[22]!==m?(v=u.jsxs("div",{className:"absolute right-3 top-2 z-20 flex hover-action gap-1",children:[m,p,y]}),e[20]=p,e[21]=y,e[22]=m,e[23]=v):v=e[23],v},Lu=t=>{const e=H.c(10),{editorView:n,currentLanguageAdapter:o,canSwitchToLanguage:r,icon:s,toType:i,displayName:a,onAfterToggle:l}=t;let c;e[0]!==n||e[1]!==l||e[2]!==i?(c=()=>{n&&(pr(n,{language:i}),l())},e[0]=n,e[1]=l,e[2]=i,e[3]=c):c=e[3];const d=c;if(!r||o===i)return null;const h=`View as ${a}`;let f,m;return e[4]!==d||e[5]!==s?(f=u.jsx(ve,{"data-testid":"language-toggle-button",variant:"text",size:"xs",className:"opacity-80 px-1",onClick:d,children:s}),e[4]=d,e[5]=s,e[6]=f):f=e[6],e[7]!==h||e[8]!==f?(m=u.jsx(Ee,{content:h,children:f}),e[7]=h,e[8]=f,e[9]=m):m=e[9],m},vb=({theme:t,showPlaceholder:e,id:n,config:o,code:r,status:s,serializedEditorState:i,setEditorView:a,runCell:l,userConfig:c,editorViewRef:d,editorViewParentRef:h,hidden:f,hasOutput:m,showHiddenCode:g,languageAdapter:x,setLanguageAdapter:p,showLanguageToggles:b=!0})=>{var G;const[y,v]=zt(Ts),w=Ms(),{saveOrNameNotebook:j}=Cd(),C=Ps(),{saveCellConfig:N}=nt(),S=s==="running"||s==="queued",E=lt(),T=dg(),I=x==="markdown",D=Fe(()=>!S&&(C.idle&&c.keymap.destructive_delete?(C.submit([n]),!0):(w({cellId:n}),!0))),F=Fe(()=>!S&&(l(),!0)),O=Fe(()=>{const W=!o.hide_code;return N({configs:{[n]:{hide_code:W}}}),E.updateCellConfig({cellId:n,config:{hide_code:W}}),W}),R=Ne(ec),P=Fe(()=>{Jn({autoInstantiate:R,createNewCell:E.createNewCell})}),z=xP(c),_=M.useMemo(()=>{const W=g5({cellId:n,showPlaceholder:e,enableAI:z,cellActions:{...E,afterToggleMarkdown:P,onRun:F,deleteCell:D,saveNotebook:j,createManyBelow:J=>{for(const $ of[...J].reverse())E.createNewCell({code:$,before:!1,cellId:n,skipIfCodeExists:!0})},splitCell:T,toggleHideCode:O,aiCellCompletion:()=>{let J=!1;return v($=>($==null?void 0:$.cellId)===n?(J=!0,null):{cellId:n}),J}},completionConfig:c.completion,keymapConfig:c.keymap,lspConfig:c.language_servers,theme:t,hotkeys:new NC(c.keymap.overrides??{}),diagnosticsConfig:c.diagnostics,displayConfig:c.display});return W.push($n.define(J=>{const $=J.state.field(Mc);return p($.type),{update(Q){const te=Q.state.field(Mc);p(te.type)}}}),We.updateListener.of(J=>{J.selectionSet&&J.state.selection.ranges.some($=>$.from!==$.to)&&g({focus:!1})}),We.domEventHandlers({focus:()=>{g({focus:!1})}})),W},[n,c.keymap,c.completion,c.language_servers,c.display,c.diagnostics,z,t,e,E,T,O,D,F,v,P,p,g,j]),k=Pc(),B=Fe(()=>{if(k){const J=Su(n,0,r);_.push(J.extension),r=J.code}const W=new We({state:Ji.create({doc:r,extensions:_})});a(W),k||pr(W,{language:Gm(W.state).type})}),A=Fe(()=>{if(Un(d.current!==null,"Editor view is not initialized"),k){const W=Su(n);_.push(W.extension)}d.current.dispatch({effects:[Tt.reconfigure.of([_]),bP(d.current,{completionConfig:c.completion,hotkeysProvider:new NC(c.keymap.overrides??{}),lspConfig:{...c.language_servers,diagnostics:c.diagnostics}})]})}),U=Fe(()=>{if(Un(i,"Editor view is not initialized"),k){const J=Su(n,0,r);_.push(J.extension),r=J.code}const W=new We({state:Ji.fromJSON(i,{doc:r,extensions:_},{history:yP})});k||pr(W,{language:Gm(W.state).type}),a(W),E.clearSerializedEditorState({cellId:n})});M.useEffect(()=>{i===null?d.current===null?B():A():U(),d.current!==null&&h&&h.current!==null&&h.current.replaceChildren(d.current.dom)},[B,A,U,d,h,i,_]),M.useEffect(()=>{const W=d.current;return()=>{W==null||W.destroy()}},[d]);const V=function(W,J){const $=H.c(12),Q=Ct(ai),te=Ne(wC),oe=Ne(Fi);let ne,ie;if($[0]!==oe){const Se=oe.getHotkey("command.vimEnterCommandMode");ie=ic(Se.key),$[0]=oe,$[1]=ie}else ie=$[1];ne=ie;const se=ne;let ae;$[2]!==W||$[3]!==Q?(ae=()=>{Q(!1),jC(W)},$[2]=W,$[3]=Q,$[4]=ae):ae=$[4];const fe=ae;let re;$[5]!==J||$[6]!==fe?(re=()=>{if(!J.current)return void fe();const Se=J.current,Le=Se.state;Le.selection.main.empty?ys(Le)!==null?dm(Se):fe():Se.dispatch({selection:Qn.single(Le.selection.main.from)})},$[5]=J,$[6]=fe,$[7]=re):re=$[7];const ue=re;let le;$[8]!==ue||$[9]!==te||$[10]!==se?(le={onKeyDown:Se=>{te==="vim"?se(Se)&&ue():Se.key==="Escape"&&ue(),Se.continuePropagation()}},$[8]=ue,$[9]=te,$[10]=se,$[11]=le):le=$[11];const{keyboardProps:je}=kC(le);return je}(n,d),X=f&&!I||f&&I&&!m;let Y="";return I&&f&&m?Y="h-0 overflow-hidden":f&&(Y="opacity-20 h-8 [&>div.cm-editor]:h-full [&>div.cm-editor]:overflow-hidden [&_.cm-panels]:hidden"),u.jsx(l_,{enabled:(y==null?void 0:y.cellId)===n,initialPrompt:y==null?void 0:y.initialPrompt,currentCode:((G=d.current)==null?void 0:G.state.doc.toString())??r,currentLanguageAdapter:x,declineChange:Fe(()=>{var W;v(null),(W=d.current)==null||W.focus()}),onChange:Fe(W=>{var J;(J=d.current)==null||J.dispatch({changes:{from:0,to:d.current.state.doc.length,insert:W}})}),acceptChange:Fe(W=>{var J,$;(J=d.current)==null||J.dispatch({changes:{from:0,to:d.current.state.doc.length,insert:W}}),($=d.current)==null||$.focus(),v(null)}),children:u.jsxs("div",{className:"relative w-full",...V,children:[X&&u.jsx(EC,{tooltip:"Edit code",className:"absolute inset-0 z-10",onClick:g}),u.jsx(wb,{className:Y,editorView:d.current,ref:h}),!f&&b&&u.jsx("div",{className:"absolute top-1 right-5",children:u.jsx(g_,{code:r,editorView:d.current,currentLanguageAdapter:x,onAfterToggle:P})})]})})},wb=q.forwardRef((t,e)=>{const n=H.c(10),{className:o,editorView:r}=t,s=M.useRef(null);let i,a,l,c,d;return n[0]!==r?(i=()=>{r!==null&&s.current!==null&&s.current.children.length===0&&s.current.append(r.dom)},a=[r,s],n[0]=r,n[1]=i,n[2]=a):(i=n[1],a=n[2]),M.useEffect(i,a),n[3]!==o?(l=xe("cm mathjax_ignore",o),n[3]=o,n[4]=l):l=n[4],n[5]!==e?(c=h=>{e?ll(e,s)(h):ll(s)(h)},n[5]=e,n[6]=c):c=n[6],n[7]!==l||n[8]!==c?(d=u.jsx("div",{className:l,ref:c,"data-testid":"cell-editor"}),n[7]=l,n[8]=c,n[9]=d):d=n[9],d});wb.displayName="CellCodeMirrorEditor";const Fu=Pc()?function(t){const e=n=>{const o=H.c(5),r=Ne(ln),[s,i]=zt(Rr);if(r.state===Bt.CONNECTING||s===void 0){let l,c;return o[0]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx("span",{children:"Waiting for real-time collaboration connection..."}),o[0]=l):l=o[0],o[1]!==i?(c=u.jsx("div",{className:"flex h-full w-full items-baseline p-4",children:u.jsxs(zc,{milliseconds:1e3,fallback:null,children:[l,u.jsx(ve,{variant:"link",onClick:()=>{i("disabled")},children:"Turn off real-time collaboration"})]})}),o[1]=i,o[2]=c):c=o[2],c}let a;return o[3]!==n?(a=u.jsx(t,{...n}),o[3]=n,o[4]=a):a=o[4],a};return e.displayName=`WithWaitUntilConnected(${t.displayName})`,e}(M.memo(vb)):M.memo(vb),x_=t=>{const e=H.c(10);let n,o,r,s;return e[0]!==t.left?(n=u.jsx("div",{className:"flex-1 flex item-center gap-2",children:t.left}),e[0]=t.left,e[1]=n):n=e[1],e[2]!==t.center?(o=u.jsx("div",{className:"flex-1 flex item-center gap-2 justify-center",children:t.center}),e[2]=t.center,e[3]=o):o=e[3],e[4]!==t.right?(r=u.jsx("div",{className:"flex-1 flex item-center gap-2 justify-end",children:t.right}),e[4]=t.right,e[5]=r):r=e[5],e[6]!==n||e[7]!==o||e[8]!==r?(s=u.jsxs("div",{className:"flex items-center gap-2 w-full px-3",children:[n,o,r]}),e[6]=n,e[7]=o,e[8]=r,e[9]=s):s=e[9],s},b_=t=>{const e=H.c(8);if(!t.canCollapse&&!t.isCollapsed)return null;const n=t.isCollapsed?"Expand":"Collapse";let o,r,s;return e[0]!==t.isCollapsed?(o=u.jsx("span",{children:u.jsx(y_,{isCollapsed:t.isCollapsed})}),e[0]=t.isCollapsed,e[1]=o):o=e[1],e[2]!==n||e[3]!==o?(r=u.jsx(Ee,{content:n,children:o}),e[2]=n,e[3]=o,e[4]=r):r=e[4],e[5]!==t.onClick||e[6]!==r?(s=u.jsx(ve,{variant:"text",size:"icon",onClick:t.onClick,children:r}),e[5]=t.onClick,e[6]=r,e[7]=s):s=e[7],s},y_=t=>{const e=H.c(2),{isCollapsed:n}=t;let o;return e[0]!==n?(o=n?u.jsx(Li,{className:"w-5 h-5 shrink-0"}):u.jsx(No,{className:"w-5 h-5 shrink-0"}),e[0]=n,e[1]=o):o=e[1],o},kb=M.memo(t=>{const e=H.c(24),{onClick:n,count:o,cellId:r}=t,s=Dm();let i;e[0]!==r||e[1]!==s?(i=vP(s,r),e[0]=r,e[1]=s,e[2]=i):i=e[2];const a=i;let l,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=xe("flex items-center justify-between w-[calc(100%-2rem)] h-9 bg-muted rounded-b mx-4 opacity-80 hover:opacity-100 cursor-pointer"),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(wP,{className:"w-4 h-4 shrink-0"}),e[4]=c):c=e[4];const d=o===1?"cell":"cells";let h,f,m,g,x,p,b;return e[5]!==o||e[6]!==d?(h=u.jsxs(u.Fragment,{children:[c,u.jsxs("span",{className:"text-sm text-gray-500",children:[o," ",d," collapsed"]})]}),e[5]=o,e[6]=d,e[7]=h):h=e[7],e[8]!==a.errored?(f=a.errored&&u.jsx(Ee,{content:"Has errors",delayDuration:100,children:u.jsx(Bp,{className:"w-4 h-4 shrink-0 text-destructive"})}),e[8]=a.errored,e[9]=f):f=e[9],e[10]!==a.stale?(m=a.stale&&u.jsx(Ee,{content:"Has stale cells",delayDuration:100,children:u.jsx(_C,{className:"w-4 h-4 shrink-0 text-(--yellow-11)"})}),e[10]=a.stale,e[11]=m):m=e[11],e[12]!==a.runningOrQueued?(g=a.runningOrQueued&&u.jsx(Ee,{content:"Running",delayDuration:100,children:u.jsx(Fc,{className:"w-4 h-4 shrink-0 animate-spin"})}),e[12]=a.runningOrQueued,e[13]=g):g=e[13],e[14]!==f||e[15]!==m||e[16]!==g?(x=u.jsxs(u.Fragment,{children:[f,m,g]}),e[14]=f,e[15]=m,e[16]=g,e[17]=x):x=e[17],e[18]!==h||e[19]!==x?(p=u.jsx(x_,{center:h,right:x}),e[18]=h,e[19]=x,e[20]=p):p=e[20],e[21]!==n||e[22]!==p?(b=u.jsx("div",{onClick:n,className:l,children:p}),e[21]=n,e[22]=p,e[23]=b):b=e[23],b});kb.displayName="CollapsedCellBanner";const Cb=t=>{const e=H.c(31),{status:n,connectionState:o,onClick:r}=t,s=n==="running"||n==="queued";let i,a,l,c,d,h,f,m,g,x,p,b,y,v;if(e[0]!==o||e[1]!==s||e[2]!==r||e[3]!==n){const w=eo(o);let j;if(w){let C;e[14]!==o?(C=wc(o),e[14]=o,e[15]=C):C=e[15],j=C}else j=n==="running"?"A cell can't be deleted when it's running":n==="queued"?"A cell can't be deleted when it's queued to run":"Delete";a=Ee,g=j,x=!1,i=ve,l="ghost",c="icon",d=r,h="delete-button",f=zn.preventFocus,m=xe("hover:bg-transparent text-destructive/60 hover:text-destructive",(w||s)&&"inactive-button"),e[0]=o,e[1]=s,e[2]=r,e[3]=n,e[4]=i,e[5]=a,e[6]=l,e[7]=c,e[8]=d,e[9]=h,e[10]=f,e[11]=m,e[12]=g,e[13]=x}else i=e[4],a=e[5],l=e[6],c=e[7],d=e[8],h=e[9],f=e[10],m=e[11],g=e[12],x=e[13];return e[16]===Symbol.for("react.memo_cache_sentinel")?(p={boxShadow:"none"},b=u.jsx(rc,{size:14}),e[16]=p,e[17]=b):(p=e[16],b=e[17]),e[18]!==i||e[19]!==l||e[20]!==c||e[21]!==d||e[22]!==h||e[23]!==f||e[24]!==m?(y=u.jsx(i,{variant:l,size:c,onClick:d,"data-testid":h,onMouseDown:f,className:m,style:p,children:b}),e[18]=i,e[19]=l,e[20]=c,e[21]=d,e[22]=h,e[23]=f,e[24]=m,e[25]=y):y=e[25],e[26]!==a||e[27]!==y||e[28]!==g||e[29]!==x?(v=u.jsx(a,{content:g,usePortal:x,children:y}),e[26]=a,e[27]=y,e[28]=g,e[29]=x,e[30]=v):v=e[30],v},v_=t=>{const e=H.c(22),{cellId:n}=t,o=function(b){const y=H.c(16),v=Ne(Xg),w=Jg(),j=Os();let C;y[0]!==b||y[1]!==v.entries?(C=v.entries.get(b),y[0]=b,y[1]=v.entries,y[2]=C):C=y[2];const N=C;if(!N){let I;return y[3]===Symbol.for("react.memo_cache_sentinel")?(I={isPending:!1},y[3]=I):I=y[3],I}if(v.entries.size!==1){let I;return y[4]!==N?(I={isPending:!0,shouldConfirmDelete:!1,...N},y[4]=N,y[5]=I):I=y[5],I}let S,E,T;return y[6]!==w||y[7]!==j||y[8]!==v.entries?(S=()=>{j({cellIds:[...v.entries.values()].map(L4)}),w.clear()},y[6]=w,y[7]=j,y[8]=v.entries,y[9]=S):S=y[9],y[10]!==w?(E=()=>w.clear(),y[10]=w,y[11]=E):E=y[11],y[12]!==N||y[13]!==S||y[14]!==E?(T={isPending:!0,...N,shouldConfirmDelete:!0,confirm:S,cancel:E},y[12]=N,y[13]=S,y[14]=E,y[15]=T):T=y[15],T}(n);if(!o.isPending)return null;if(o.type==="simple"){let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=xe("px-3 py-1.5","bg-(--amber-2) border-t border-(--amber-6)","animate-in slide-in-from-top-2 duration-200"),e[0]=b):b=e[0];const y=`pending-delete-${n}`;let v,w;return e[1]===Symbol.for("react.memo_cache_sentinel")?(v=u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Rm,{className:"w-3 h-3 text-(--amber-11) shrink-0"}),u.jsx("span",{className:"text-(--amber-11) text-xs",children:"Pending deletion"})]}),e[1]=v):v=e[1],e[2]!==y?(w=u.jsx("div",{className:b,"data-testid":y,children:v}),e[2]=y,e[3]=w):w=e[3],w}const r=o.executionDurationMs!==void 0,s=o.defs.size>0,i=Es(o.executionDurationMs??0);let a,l="Pending deletion";r&&s?l=`This cell took ${i} to run and contains variables referenced by other cells.`:r?l=`This cell took ${i} to run.`:s&&(l="This cell contains variables referenced by other cells."),e[4]===Symbol.for("react.memo_cache_sentinel")?(a=xe("px-4 py-3","bg-(--amber-2) border-t border-(--amber-6)","animate-in slide-in-from-top-2 duration-200"),e[4]=a):a=e[4];const c=`pending-delete-${n}`;let d,h,f,m,g,x,p;return e[5]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(Rm,{className:"w-4 h-4 text-(--amber-11) mt-0.5 shrink-0"}),e[5]=d):d=e[5],e[6]!==l?(h=u.jsx("p",{className:"text-(--amber-11) font-medium",children:l}),e[6]=l,e[7]=h):h=e[7],e[8]!==s||e[9]!==o.defs?(f=s&&[...o.defs.entries()].map(k_),e[8]=s,e[9]=o.defs,e[10]=f):f=e[10],e[11]!==h||e[12]!==f?(m=u.jsxs("div",{className:"font-code text-sm text-[0.84375rem]",children:[h,f]}),e[11]=h,e[12]=f,e[13]=m):m=e[13],e[14]!==o?(g=o.shouldConfirmDelete&&u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"text-(--amber-11) mt-2 mb-3",children:"Are you sure you want to delete?"}),u.jsx(Tm,{autoFocus:!0,children:u.jsxs("div",{className:"flex items-center gap-2",onKeyDown:C_,children:[u.jsx(ve,{size:"xs",variant:"ghost",onClick:()=>o.cancel(),className:"text-(--amber-11) hover:bg-(--amber-4) hover:text-(--amber-11)",children:"Cancel"}),u.jsx(ve,{size:"xs",variant:"secondary",onClick:()=>o.confirm(),className:"bg-(--amber-11) hover:bg-(--amber-12) text-white border-(--amber-11)",children:"Delete"})]})})]}),e[14]=o,e[15]=g):g=e[15],e[16]!==m||e[17]!==g?(x=u.jsxs("div",{className:"flex items-start gap-3",children:[d,u.jsxs("div",{className:"flex-1",children:[m,g]})]}),e[16]=m,e[17]=g,e[18]=x):x=e[18],e[19]!==c||e[20]!==x?(p=u.jsx("div",{className:a,"data-testid":c,children:x}),e[19]=c,e[20]=x,e[21]=p):p=e[21],p};function w_(t){return u.jsx("li",{className:"my-0.5 ml-8 text-(--amber-11)/60",children:u.jsx(Mo,{cellId:t})},t)}function k_(t){const[e,n]=t;return u.jsxs("div",{children:[u.jsxs("p",{className:"text-(--amber-11) mt-2",children:["'",u.jsx("span",{className:"font-mono",children:e}),"' is referenced by:"]}),u.jsx("ul",{className:"list-disc",children:n.map(w_)})]},e)}function C_(t){t.stopPropagation()}const j_=t=>{const e=H.c(27),{onClick:n,connectionState:o,needsRun:r,status:s,config:i,edited:a}=t,l=s==="disabled-transitively",c=s==="running"||s==="queued";let d,h;e[0]!==l||e[1]!==i.disabled||e[2]!==o||e[3]!==a||e[4]!==c||e[5]!==r?(d=eo(o)||c||!i.disabled&&l&&!a,h=function({connectionState:p,needsRun:b,loading:y,inactive:v}){return eo(p)?"disabled":b&&!y?"stale":y||v?"disabled":"green"}({connectionState:o,needsRun:r,loading:c,inactive:d}),e[0]=l,e[1]=i.disabled,e[2]=o,e[3]=a,e[4]=c,e[5]=r,e[6]=d,e[7]=h):(d=e[6],h=e[7]);const f=h;if(i.disabled){let p,b;return e[8]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(Ip,{}),e[8]=p):p=e[8],e[9]!==d||e[10]!==n||e[11]!==f?(b=u.jsx(Us,{tooltip:"Add code to notebook",disabled:d,onClick:n,variant:f,"data-testid":"run-button",children:p}),e[9]=d,e[10]=n,e[11]=f,e[12]=b):b=e[12],b}if(!i.disabled&&l&&!a){let p,b;return e[13]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(Sr,{strokeWidth:1.2}),e[13]=p):p=e[13],e[14]!==d||e[15]!==n||e[16]!==f?(b=u.jsx(Us,{disabled:d,tooltip:"This cell can't be run because it has a disabled ancestor",onClick:n,variant:f,"data-testid":"run-button",children:p}),e[14]=d,e[15]=n,e[16]=f,e[17]=b):b=e[17],b}let m,g,x;if(eo(o)){let p;e[18]!==o?(p=wc(o),e[18]=o,e[19]=p):p=e[19],m=p}else if(s==="queued")m="This cell is already queued to run";else if(s==="running")m="This cell is already running.";else{let p;e[20]===Symbol.for("react.memo_cache_sentinel")?(p=Gt("cell.run"),e[20]=p):p=e[20],m=p}return e[21]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx(Sr,{strokeWidth:1.2}),e[21]=g):g=e[21],e[22]!==d||e[23]!==n||e[24]!==m||e[25]!==f?(x=u.jsx(Us,{tooltip:m,disabled:d,onClick:n,variant:f,"data-testid":"run-button",children:g}),e[22]=d,e[23]=n,e[24]=m,e[25]=f,e[26]=x):x=e[26],x},jb=q.createContext(null),Sb=M.memo(()=>M.use(jb));Sb.displayName="DragHandle";const Nb=q.forwardRef((t,e)=>{const n=H.c(21);let o,r,s,i,a;n[0]!==t?({cellId:r,canMoveX:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(i=r.toString(),n[4]=r,n[5]=i):i=n[5],n[6]!==i?(a={id:i},n[6]=i,n[7]=a):a=n[7];const{attributes:l,listeners:c,setNodeRef:d,transform:h,transition:f,isDragging:m}=T1(a);let g;n[8]!==h?(g=function(y){return!y||y.x===0&&y.y===0&&y.scaleX===1&&y.scaleY===1}(h)?null:h,n[8]=h,n[9]=g):g=n[9];const x=g,p=x==null?void 0:f;let b;return n[10]!==l||n[11]!==o||n[12]!==r||n[13]!==m||n[14]!==c||n[15]!==s||n[16]!==e||n[17]!==d||n[18]!==x||n[19]!==p?(b=u.jsx(Eb,{ref:e,cellId:r,canMoveX:o,...s,attributes:l,listeners:c,setNodeRef:d,transform:x,transition:p,isDragging:m}),n[10]=l,n[11]=o,n[12]=r,n[13]=m,n[14]=c,n[15]=s,n[16]=e,n[17]=d,n[18]=x,n[19]=p,n[20]=b):b=n[20],b});Nb.displayName="SortableCell";const Eb=q.forwardRef((t,e)=>{const n=H.c(37);let o,r,s,i,a,l,c,d,h,f;if(n[0]!==t){const{cellId:E,canMoveX:T,children:I,attributes:D,listeners:F,setNodeRef:O,transform:R,transition:P,isDragging:z,..._}=t;r=T,s=I,o=D,a=F,c=O,d=R,h=P,i=z,l=_,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i,n[5]=a,n[6]=l,n[7]=c,n[8]=d,n[9]=h}else o=n[1],r=n[2],s=n[3],i=n[4],a=n[5],l=n[6],c=n[7],d=n[8],h=n[9];n[10]!==r||n[11]!==d?(f=d?Ec.Transform.toString({x:r?d.x:0,y:d.y,scaleX:1,scaleY:1}):void 0,n[10]=r,n[11]=d,n[12]=f):f=n[12];const m=i?2:void 0;let g;n[13]!==f||n[14]!==m||n[15]!==h?(g={transform:f,transition:h,zIndex:m,position:"relative"},n[13]=f,n[14]=m,n[15]=h,n[16]=g):g=n[16];const x=g;let p,b;n[17]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(_p,{strokeWidth:1,size:20}),n[17]=p):p=n[17],n[18]!==o||n[19]!==a?(b=u.jsx("div",{...o,...a,onMouseDown:zn.preventFocus,"data-testid":"drag-button",className:"py-px cursor-grab opacity-50 hover:opacity-100 hover-action hover:bg-muted rounded border border-transparent hover:border-border active:bg-accent",children:p}),n[18]=o,n[19]=a,n[20]=b):b=n[20];const y=b,v=!!d;let w;n[21]!==e||n[22]!==c?(w=E=>{ll(e,c)(E)},n[21]=e,n[22]=c,n[23]=w):w=n[23];const j=v&&"is-moving";let C,N,S;return n[24]!==l.className||n[25]!==j?(C=xe(l.className,j,"outline-hidden rounded-lg"),n[24]=l.className,n[25]=j,n[26]=C):C=n[26],n[27]!==s||n[28]!==y?(N=u.jsx(jb.Provider,{value:y,children:s}),n[27]=s,n[28]=y,n[29]=N):N=n[29],n[30]!==i||n[31]!==l||n[32]!==x||n[33]!==w||n[34]!==C||n[35]!==N?(S=u.jsx("div",{tabIndex:-1,ref:w,...l,"data-is-dragging":i,className:C,style:x,children:N}),n[30]=i,n[31]=l,n[32]=x,n[33]=w,n[34]=C,n[35]=N,n[36]=S):S=n[36],S});function _b(t,e){const n=H.c(9);let o;n[0]!==t.current||n[1]!==e?(o=l=>{t.current===null||t.current.contains(l.relatedTarget)||e.current===null||dm(e.current)},n[0]=t.current,n[1]=e,n[2]=o):o=n[2];const r=Fe(o);let s;n[3]!==t.current||n[4]!==e?(s=l=>{if(t.current===document.activeElement&&e.current!==null&&ys(e.current.state)==="active"){for(const c of iC)if(l.key===c.key&&c.run){c.run(e.current),l.preventDefault(),l.stopPropagation();break}e.current.focus()}},n[3]=t.current,n[4]=e,n[5]=s):s=n[5];const i=Fe(s);let a;return n[6]!==r||n[7]!==i?(a={closeCompletionHandler:r,resumeCompletionHandler:i},n[6]=r,n[7]=i,n[8]=a):a=n[8],a}function Ib(t){const e=H.c(15),{cellId:n,cellConfig:o,languageAdapter:r,editorView:s}=t,[i,a]=zt(ai);let l,c;e[0]!==n?(c=SP(n),e[0]=n,e[1]=c):c=e[1],l=c;const d=Ne(l),h=!o.hide_code||i||d,f=r==="markdown",m=f&&!h;let g;e[2]!==s||e[3]!==h||e[4]!==a?(g=v=>{var j;if(h)return;const w=(v==null?void 0:v.focus)??!0;a(!0),w&&((j=s.current)==null||j.focus())},e[2]=s,e[3]=h,e[4]=a,e[5]=g):g=e[5];const x=Fe(g);let p;e[6]!==m||e[7]!==x?(p=()=>{m&&x({focus:!0})},e[6]=m,e[7]=x,e[8]=p):p=e[8];const b=Fe(p);let y;return e[9]!==h||e[10]!==f||e[11]!==m||e[12]!==x||e[13]!==b?(y={isCellCodeShown:h,isMarkdown:f,isMarkdownCodeHidden:m,showHiddenCode:x,showHiddenCodeIfMarkdown:b},e[9]=h,e[10]=f,e[11]=m,e[12]=x,e[13]=b,e[14]=y):y=e[14],y}Eb.displayName="SortableCellInternal";const Ab=M.forwardRef((t,e)=>{var x;const n=H.c(18),{cellId:o}=t,r=Zi(o),s=Qi(o);let i;n[0]===Symbol.for("react.memo_cache_sentinel")?(i=Bc("marimo-cell","hover-actions-parent z-10",{published:!0}),n[0]=i):i=n[0];const a=i,l=AC((x=s.output)==null?void 0:x.mimetype);if(s.errored||s.interrupted||s.stopped||l)return null;let c;n[1]!==r.name||n[2]!==o?(c=dp(o,r.name),n[1]=r.name,n[2]=o,n[3]=c):c=n[3];const d=s.output;let h,f,m,g;return n[4]!==r.edited||n[5]!==s?(h=TC(s,r.edited),n[4]=r.edited,n[5]=s,n[6]=h):h=n[6],n[7]!==s.status?(f=Zm(s.status),n[7]=s.status,n[8]=f):f=n[8],n[9]!==o||n[10]!==s.output||n[11]!==h||n[12]!==f?(m=u.jsx(Uc,{allowExpand:!1,forceExpand:!0,className:"output-area",cellId:o,output:d,stale:h,loading:f}),n[9]=o,n[10]=s.output,n[11]=h,n[12]=f,n[13]=m):m=n[13],n[14]!==e||n[15]!==c||n[16]!==m?(g=u.jsx("div",{tabIndex:-1,ref:e,className:a,...c,children:m}),n[14]=e,n[15]=c,n[16]=m,n[17]=g):g=n[17],g});Ab.displayName="ReadonlyCellComponent";const S_=({theme:t,showPlaceholder:e,cellId:n,canDelete:o,userConfig:r,isCollapsed:s,collapseCount:i,canMoveX:a,editorView:l,setEditorView:c})=>{var fe;const d=M.useRef(null),h=Zi(n),f=Qi(n),m=M.useRef(null),g=M.useRef(null),x=M.useRef(null),p=lt(),b=Ne(ln),y=Ct(Ts),v=Ms(),w=ud(n),{sendStdin:j}=nt(),[C,N]=M.useState(),S=h.config.disabled||f.status==="disabled-transitively",E=IC({executionTime:f.runElapsedTimeMs??h.lastExecutionTime,status:f.status,errored:f.errored,interrupted:f.interrupted,stopped:f.stopped}),T=h.edited||f.interrupted||f.staleInputs&&!S,I=Zm(f.status),D=(f.status==="queued"||h.edited||f.staleInputs)&&!f.interrupted,F=M.useCallback(()=>l.current,[l]),{closeCompletionHandler:O,resumeCompletionHandler:R}=_b(d,l),{isCellCodeShown:P,isMarkdown:z,isMarkdownCodeHidden:_,showHiddenCode:k,showHiddenCodeIfMarkdown:B}=Ib({cellId:n,cellConfig:h.config,languageAdapter:C,editorView:l}),A=bb(n,{canMoveX:a,editorView:l,cellActionDropdownRef:m}),U=jP(f.outline),V=!Wm(f.output),X=f.consoleOutputs.length>0,Y=r.display.cell_output,G=V&&Y==="above",W=V&&Y==="below",[J,$]=M.useState(!1),[Q,te]=M.useState(!1);(function(re){const{ref:ue,box:le="content-box",skip:je}=re,Se=M.useRef({...b5}),Le=M.useRef(void 0);Le.current=re.onResize,M.useEffect(()=>{if(!ue.current||je||typeof window>"u"||!("ResizeObserver"in window))return;const Ie=new ResizeObserver(([ke])=>{const Ye=le==="border-box"?"borderBoxSize":le==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",Ve=W0(ke,Ye,"inlineSize"),Ke=W0(ke,Ye,"blockSize");if(Se.current.width!==Ve||Se.current.height!==Ke){const ee={width:Ve,height:Ke};Se.current.width=Ve,Se.current.height=Ke,Le.current&&Le.current(ee)}});return Ie.observe(ue.current,{box:le}),()=>{Ie.disconnect()}},[le,ue,je])})({ref:x,skip:!z,onResize:re=>{const ue=re.height&&re.height<68,le=_&&(ue||Y==="below");$(le),U&&le?te(!0):Q&&te(!1)}});const oe=re=>u.jsx(EC,{tooltip:"Edit markdown",className:xe("z-20 relative",re),onClick:k}),ne=V&&u.jsxs("div",{className:"relative",onDoubleClick:B,children:[u.jsx("div",{className:"absolute top-5 -left-8 z-10 print:hidden",children:u.jsx(b_,{isCollapsed:s,onClick:()=>{s?p.expandCell({cellId:n}):p.collapseCell({cellId:n})},canCollapse:U})}),_&&W&&oe("top-3"),u.jsx(Uc,{allowExpand:!0,forceExpand:_,className:"output-area",cellId:n,output:f.output,stale:TC(f,h.edited),loading:Zm(f.status)}),_&&G&&oe("bottom-3")]}),ie=Bc("marimo-cell","hover-actions-parent z-10",{interactive:!0,"needs-run":T,"has-error":f.errored,stopped:f.stopped,disabled:h.config.disabled,stale:f.status==="disabled-transitively",borderless:_&&V&&!A["data-selected"]}),se=Fe(re=>{y({cellId:n,initialPrompt:re.prompt})}),ae=((fe=f.serialization)==null?void 0:fe.toLowerCase())==="valid";return u.jsx(Xm,{children:u.jsx(Ex,{cellId:n,getEditorView:F,children:u.jsxs(Nb,{tabIndex:-1,ref:d,"data-status":f.status,onBlur:O,onKeyDown:R,cellId:n,canMoveX:a,title:h.config.disabled?"This cell is disabled":f.status==="disabled-transitively"?"This cell has a disabled ancestor":void 0,children:[u.jsxs("div",{tabIndex:-1,...A,className:xe(ie,A.className,"focus:ring-1 focus:ring-(--blue-7) focus:ring-offset-0"),ref:x,...dp(n,h.name),children:[Y==="above"&&ne,u.jsxs("div",{className:xe("tray"),"data-hidden":_,children:[u.jsx("div",{className:"absolute right-2 -top-4 z-10",children:u.jsx(Bu,{edited:h.edited,status:f.status,cellConfig:h.config,needsRun:T,hasOutput:V,hasConsoleOutput:X,cellActionDropdownRef:m,cellId:n,name:h.name,getEditorView:F,onRun:w})}),u.jsx(Tb,{cellId:n,className:xe(_&&G&&"-top-7",_&&W&&"-bottom-8",_&&Q&&"-left-[3.8rem]"),actions:p}),u.jsx(Fu,{theme:t,showPlaceholder:e,id:n,code:h.code,config:h.config,status:f.status,serializedEditorState:h.serializedEditorState,runCell:w,setEditorView:c,userConfig:r,editorViewRef:l,editorViewParentRef:g,hidden:!P,hasOutput:V,showHiddenCode:k,languageAdapter:C,setLanguageAdapter:N}),u.jsx(zu,{className:xe(_&&Y==="below"&&"top-14"),edited:h.edited,status:f.status,isCellStatusInline:J,uninstantiated:E,disabled:h.config.disabled,runElapsedTimeMs:f.runElapsedTimeMs,runStartTimestamp:f.runStartTimestamp,lastRunStartTimestamp:f.lastRunStartTimestamp,staleInputs:f.staleInputs,interrupted:f.interrupted}),u.jsx("div",{className:"shoulder-bottom hover-action",children:o&&P&&u.jsx(Cb,{status:f.status,connectionState:b.state,onClick:()=>{I||eo(b.state)||v({cellId:n})}})})]}),Y==="below"&&ne,f.serialization&&u.jsxs("div",{className:"py-1 px-2 flex items-center justify-end gap-2 last:rounded-b",children:[ae&&u.jsx("a",{href:"https://links.marimo.app/reusable-definitions",target:"_blank",className:"hover:underline text-muted-foreground text-xs font-bold",rel:"noopener",children:"reusable"}),u.jsx(Ee,{content:u.jsx("span",{className:"max-w-16 text-xs",children:ae?"This function or class can be imported into other Python notebooks or modules.":u.jsxs(u.Fragment,{children:["This definition can't be reused in other Python modules:",u.jsx("br",{}),u.jsx("br",{}),u.jsx("pre",{children:f.serialization}),u.jsx("br",{}),"Click this icon to learn more."]})}),children:ae?u.jsx("a",{href:"https://links.marimo.app/reusable-definitions",target:"_blank",rel:"noopener",children:u.jsx(Kl,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})}):u.jsx("a",{href:"https://links.marimo.app/reusable-definitions",target:"_blank",rel:"noopener",children:u.jsx(Jm,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})})]}),u.jsx(up,{consoleOutputs:f.consoleOutputs,stale:D,cellName:f.serialization?"_":h.name,onRefactorWithAI:se,onClear:()=>{p.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:(re,ue)=>{p.setStdinResponse({cellId:n,response:re,outputIndex:ue}),j({text:re})},cellId:n,debuggerActive:f.debuggerActive}),u.jsx(v_,{cellId:n})]}),s&&u.jsx(kb,{onClick:()=>p.expandCell({cellId:n}),count:i,cellId:n})]})})})},zu=M.memo(t=>{const e=H.c(19),{className:n,disabled:o,edited:r,interrupted:s,isCellStatusInline:i,lastRunStartTimestamp:a,runElapsedTimeMs:l,runStartTimestamp:c,staleInputs:d,status:h,uninstantiated:f}=t,m=o!==void 0&&o;let g;e[0]!==m||e[1]!==r||e[2]!==s||e[3]!==a||e[4]!==l||e[5]!==c||e[6]!==d||e[7]!==h||e[8]!==f?(g=u.jsx(Y0,{status:h,staleInputs:d,interrupted:s,editing:!0,edited:r,disabled:m,elapsedTime:l,runStartTimestamp:c,uninstantiated:f,lastRunStartTimestamp:a}),e[0]=m,e[1]=r,e[2]=s,e[3]=a,e[4]=l,e[5]=c,e[6]=d,e[7]=h,e[8]=f,e[9]=g):g=e[9];const x=g;let p;e[10]!==n?(p=xe("shoulder-right z-20",n),e[10]=n,e[11]=p):p=e[11];const b=!i&&x;let y;e[12]===Symbol.for("react.memo_cache_sentinel")?(y=u.jsx(Sb,{}),e[12]=y):y=e[12];const v=i&&x;let w,j;return e[13]!==v?(w=u.jsxs("div",{className:"flex gap-2 items-end",children:[y,v]}),e[13]=v,e[14]=w):w=e[14],e[15]!==p||e[16]!==b||e[17]!==w?(j=u.jsxs("div",{className:p,children:[b,w]}),e[15]=p,e[16]=b,e[17]=w,e[18]=j):j=e[18],j});zu.displayName="CellRightSideActions";const Tb=M.memo(t=>{const e=H.c(21),n=Ne(ln),{className:o,actions:r,cellId:s}=t;let i;e[0]!==r||e[1]!==s?(i=w=>{const j=w===void 0?{}:w;return r.createNewCell({cellId:s,before:!1,...j})},e[0]=r,e[1]=s,e[2]=i):i=e[2];const a=Fe(i);let l;e[3]!==r||e[4]!==s?(l=w=>{const j=w===void 0?{}:w;return r.createNewCell({cellId:s,before:!0,...j})},e[3]=r,e[4]=s,e[5]=l):l=e[5];const c=Fe(l),d=MC(n.state);let h,f;e[6]!==o?(h=xe("absolute flex flex-col gap-[2px] justify-center h-full left-[-34px] z-20",o),e[6]=o,e[7]=h):h=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(f=Gt("cell.createAbove"),e[8]=f):f=e[8];const m=d?c:void 0;let g,x,p;e[9]!==n.state||e[10]!==m?(g=u.jsx(jx,{tooltipContent:f,connectionState:n.state,onClick:m}),e[9]=n.state,e[10]=m,e[11]=g):g=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx("div",{className:"flex-1"}),e[12]=x):x=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(p=Gt("cell.createBelow"),e[13]=p):p=e[13];const b=d?a:void 0;let y,v;return e[14]!==n.state||e[15]!==b?(y=u.jsx(jx,{tooltipContent:p,connectionState:n.state,onClick:b}),e[14]=n.state,e[15]=b,e[16]=y):y=e[16],e[17]!==h||e[18]!==g||e[19]!==y?(v=u.jsxs("div",{className:h,children:[g,x,y]}),e[17]=h,e[18]=g,e[19]=y,e[20]=v):v=e[20],v});Tb.displayName="CellLeftSideActions";const Bu=M.memo(t=>{const e=H.c(27),{edited:n,status:o,cellConfig:r,needsRun:s,hasOutput:i,hasConsoleOutput:a,onRun:l,cellActionDropdownRef:c,cellId:d,getEditorView:h,name:f,includeCellActions:m}=t,g=m===void 0||m,x=Ne(ln),p=MC(x.state),b=!s&&"hover-action";let y;e[0]!==b?(y=xe(b),e[0]=b,e[1]=y):y=e[1];const v=p?l:Bn.NOOP;let w,j,C,N;return e[2]!==r||e[3]!==x.state||e[4]!==n||e[5]!==s||e[6]!==o||e[7]!==v?(w=u.jsx(j_,{edited:n,onClick:v,connectionState:x.state,status:o,config:r,needsRun:s}),e[2]=r,e[3]=x.state,e[4]=n,e[5]=s,e[6]=o,e[7]=v,e[8]=w):w=e[8],e[9]!==x.state||e[10]!==o?(j=u.jsx(HN,{status:o,connectionState:x.state}),e[9]=x.state,e[10]=o,e[11]=j):j=e[11],e[12]!==c||e[13]!==r||e[14]!==d||e[15]!==h||e[16]!==a||e[17]!==i||e[18]!==g||e[19]!==f||e[20]!==o?(C=g&&u.jsx(Sx,{ref:c,cellId:d,status:o,getEditorView:h,name:f,config:r,hasOutput:i,hasConsoleOutput:a,children:u.jsx(Us,{variant:"green",tooltip:null,"data-testid":"cell-actions-button",children:u.jsx(qc,{strokeWidth:1.5})})}),e[12]=c,e[13]=r,e[14]=d,e[15]=h,e[16]=a,e[17]=i,e[18]=g,e[19]=f,e[20]=o,e[21]=C):C=e[21],e[22]!==y||e[23]!==w||e[24]!==j||e[25]!==C?(N=u.jsxs(VN,{className:y,children:[w,j,C]}),e[22]=y,e[23]=w,e[24]=j,e[25]=C,e[26]=N):N=e[26],N});Bu.displayName="CellToolbar";const N_=({theme:t,showPlaceholder:e,cellId:n,canDelete:o,userConfig:r,canMoveX:s,editorView:i,setEditorView:a})=>{var k;const l=M.useRef(null),c=Zi(n),d=Qi(n),h=M.useRef(null),f=M.useRef(null),m=Ne(ln),g=lt(),x=nt(),p=Ms(),b=Ct(Ts),y=ud(n),v=c.config.disabled||d.status==="disabled-transitively",w=IC({executionTime:d.runElapsedTimeMs??c.lastExecutionTime,status:d.status,errored:d.errored,interrupted:d.interrupted,stopped:d.stopped}),j=c.edited||d.interrupted||d.staleInputs&&!v,C=d.status==="running"||d.status==="queued",N=(d.status==="queued"||c.edited||d.staleInputs)&&!d.interrupted,S=M.useCallback(()=>i.current,[i]),{isCellCodeShown:E,showHiddenCode:T}=Ib({cellId:n,cellConfig:c.config,languageAdapter:"python",editorView:i}),{closeCompletionHandler:I,resumeCompletionHandler:D}=_b(l,i),F=bb(n,{canMoveX:s,editorView:i,cellActionDropdownRef:h}),O=!Wm(d.output),R=d.consoleOutputs.length>0,P=AC((k=d.output)==null?void 0:k.mimetype),z=Bc("marimo-cell","hover-actions-parent z-10 border shadow-sm","border-(--blue-5)! rounded-sm!",{"needs-run":j,"has-error":d.errored,stopped:d.stopped}),_=Fe(B=>{b({cellId:n,initialPrompt:B.prompt})});return u.jsx(Xm,{children:u.jsx(Ex,{cellId:n,getEditorView:S,children:u.jsxs("div",{"data-status":d.status,ref:l,...lm(F,{className:z,onBlur:I,onKeyDown:D}),...dp(n,c.name),title:c.config.disabled?"This cell is disabled":d.status==="disabled-transitively"?"This cell has a disabled ancestor":void 0,"data-setup-cell":!0,children:[u.jsxs("div",{className:xe("tray"),"data-hidden":!E,children:[u.jsx("div",{className:"absolute right-2 -top-4 z-10",children:u.jsx(Bu,{edited:c.edited,status:d.status,cellConfig:c.config,needsRun:j,hasOutput:O,hasConsoleOutput:R,cellActionDropdownRef:h,cellId:n,name:c.name,getEditorView:S,onRun:y,includeCellActions:!0})}),u.jsx(Fu,{theme:t,showPlaceholder:e,id:n,code:c.code,config:c.config,status:d.status,serializedEditorState:c.serializedEditorState,runCell:y,setEditorView:a,userConfig:r,editorViewRef:i,editorViewParentRef:f,hidden:!E,hasOutput:O,showHiddenCode:T,languageAdapter:"python",setLanguageAdapter:Bn.NOOP,showLanguageToggles:!1}),u.jsx(zu,{edited:c.edited,status:d.status,isCellStatusInline:!1,uninstantiated:w,disabled:c.config.disabled,runElapsedTimeMs:d.runElapsedTimeMs,runStartTimestamp:d.runStartTimestamp,lastRunStartTimestamp:d.lastRunStartTimestamp,staleInputs:d.staleInputs,interrupted:d.interrupted}),u.jsx("div",{className:"shoulder-bottom hover-action",children:o&&u.jsx(Cb,{connectionState:m.state,status:d.status,onClick:()=>{C||eo(m.state)||p({cellId:n})}})})]}),u.jsxs("div",{className:"py-1 px-2 flex justify-end gap-2 last:rounded-b",children:[u.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"setup cell"}),u.jsx(Ee,{content:u.jsxs("span",{className:"max-w-16",children:["This ",u.jsx("b",{children:"setup cell"})," is guaranteed to run before all other cells. Include ",u.jsx("br",{}),"initialization or imports and constants required by top-level functions."]}),children:u.jsx(Jm,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),P&&u.jsx(Uc,{allowExpand:!0,forceExpand:!0,className:"output-area",cellId:n,output:d.output,stale:!1,loading:C}),u.jsx(up,{consoleOutputs:d.consoleOutputs,stale:N,cellName:"_",onRefactorWithAI:_,onClear:()=>{g.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:(B,A)=>{g.setStdinResponse({cellId:n,response:B,outputIndex:A}),x.sendStdin({text:B})},cellId:n,debuggerActive:d.debuggerActive})]})})})},Mb=M.memo(t=>{const{cellId:e,mode:n}=t,o=kP(e);ut.debug("Rendering Cell",e);const r=M.useRef(null);return M.useImperativeHandle(o,()=>({get editorView(){return function(s){const i=s.current;if(i===null)throw new ReferenceError("Attempting to dereference null object.");return i}(r)},get editorViewOrNull(){return r.current}}),[r]),e===na?u.jsx(N_,{...t,cellId:e,editorView:r,setEditorView:s=>{r.current=s}}):n==="edit"?u.jsx(CP,{atoms:[ai],children:u.jsx(S_,{...t,cellId:e,editorView:r,setEditorView:s=>{r.current=s}})}):u.jsx(Ab,{cellId:e})}),E_=(t,e)=>function(n,o){const r=/^(\d+)\.(\d+)\.(\d+)(?:-([\w.-]+))?(?:\+([\w.-]+))?$/,s=i=>{const a=i.match(r);if(!a)return null;const[,l,c,d,h]=a;return{major:Number.parseInt(l,10),minor:Number.parseInt(c,10),patch:Number.parseInt(d,10),preRelease:h||""}};try{const i=s(n),a=s(o);return i&&a?i.major!==a.major?i.major-a.major:i.minor!==a.minor?i.minor-a.minor:i.patch!==a.patch?i.patch-a.patch:i.preRelease===""&&a.preRelease!==""?1:i.preRelease!==""&&a.preRelease===""?-1:i.preRelease.localeCompare(a.preRelease):n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}catch{return n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}}(e,t),Ob=new class{constructor(t){this.ttl=void 0,this.cache=new Map,this.ttl=t.ttl}cleanupExpiredEntries(){const t=Date.now();for(const[e,n]of this.cache.entries())t-n.timestamp>this.ttl&&this.cache.delete(e)}get(t){this.cleanupExpiredEntries();const e=this.cache.get(t);if(e){if(!(Date.now()-e.timestamp>this.ttl))return e.data;this.cache.delete(t)}}set(t,e){this.cache.set(t,{data:e,timestamp:Date.now()})}clear(){this.cache.clear()}}({ttl:3e5}),__=ft({info:ft({provides_extra:at().array().nullable()}),releases:NP(at(),EP())});function Db(t){const e=H.c(5);let n;e[0]!==t?(n=function(i){return i.replaceAll(/\[.*]/g,"").trim()}(t),e[0]=t,e[1]=n):n=e[1];const o=n;let r,s;return e[2]!==o?(r=async()=>{const i=Ob.get(o);if(i)return i;const a=await fetch(`https://pypi.org/pypi/${o}/json`,{method:"GET"});if(!a.ok)throw new Error(`HTTP ${a.status}: ${a.statusText}`);const l=__.transform(I_).parse(await a.json());return Ob.set(o,l),l},s=[o],e[2]=o,e[3]=r,e[4]=s):(r=e[3],s=e[4]),Tn(r,s)}function I_(t){return{versions:Object.keys(t.releases).toSorted(E_),extras:t.info.provides_extra??[]}}function Rb(t){const e=t.match(/^([^[]+)(?:\[([^\]]+)])?$/);if(!e)return{name:t,extras:[]};const[,n,o]=e;return{name:n,extras:o?o.split(",").map(r=>r.trim()):[]}}const A_=()=>{const t=H.c(70),{packageAlert:e}=IF(),{clearPackageAlert:n}=AF(),[o]=xr();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={},t[0]=r):r=t[0];const[s,i]=M.useState(r);let a;t[1]===Symbol.for("react.memo_cache_sentinel")?(a={},t[1]=a):a=t[1];const[l,c]=M.useState(a);if(e===null)return null;const d=o.package_management.manager!=="pixi";if(TF(e)){let h,f,m,g,x,p,b,y,v,w;if(t[2]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[u.jsx(sd,{className:"w-5 h-5 inline-block mr-2"}),"Missing packages"]}),t[2]=h):h=t[2],t[3]!==n||t[4]!==e.id?(f=()=>n(e.id),t[3]=n,t[4]=e.id,t[5]=f):f=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(wn,{className:"w-5 h-5"}),t[6]=m):m=t[6],t[7]!==f?(g=u.jsxs("div",{className:"flex justify-between",children:[h,u.jsx(ve,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:f,children:m})]}),t[7]=f,t[8]=g):g=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx("p",{children:"The following packages were not found:"}),t[9]=x):x=t[9],t[10]!==s||t[11]!==d||t[12]!==e.packages||t[13]!==l){let j;t[15]!==s||t[16]!==d||t[17]!==l?(j=(C,N)=>{const S=Rb(C),E=l[C]||S.extras;return u.jsxs("li",{className:"flex items-center gap-2 font-mono text-sm",children:[u.jsx(Ss,{size:"1rem"}),u.jsx(D_,{packageName:S.name,selectedExtras:E,onExtrasChange:T=>c(I=>({...I,[C]:T}))}),d&&u.jsx(R_,{value:s[C]??"latest",onChange:T=>i(I=>({...I,[C]:T})),packageName:S.name})]},N)},t[15]=s,t[16]=d,t[17]=l,t[18]=j):j=t[18],p=e.packages.map(j),t[10]=s,t[11]=d,t[12]=e.packages,t[13]=l,t[14]=p}else p=t[14];return t[19]!==p?(b=u.jsxs("div",{children:[x,u.jsx("ul",{className:"list-disc ml-4 mt-1",children:p})]}),t[19]=p,t[20]=b):b=t[20],t[21]!==n||t[22]!==s||t[23]!==e.id||t[24]!==e.isolated||t[25]!==e.packages||t[26]!==l||t[27]!==o.package_management.manager?(y=u.jsx("div",{className:"ml-auto flex flex-row items-baseline",children:e.isolated?u.jsxs(u.Fragment,{children:[u.jsx(M_,{manager:o.package_management.manager,packages:e.packages.map(j=>{const C=Rb(j),N=l[j]||C.extras;return function(S,E){return E.length===0?S:`${S}[${E.join(",")}]`}(C.name,N)}),versions:s,clearPackageAlert:()=>n(e.id)}),!tn()&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"px-2 text-sm",children:"with"})," ",u.jsx(O_,{})]})]}):u.jsxs("p",{children:["If you set up a"," ",u.jsx(km,{href:"https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments",children:"virtual environment"}),", marimo can install these packages for you."]})}),t[21]=n,t[22]=s,t[23]=e.id,t[24]=e.isolated,t[25]=e.packages,t[26]=l,t[27]=o.package_management.manager,t[28]=y):y=t[28],t[29]!==b||t[30]!==y?(v=u.jsxs("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:[b,y]}),t[29]=b,t[30]=y,t[31]=v):v=t[31],t[32]!==v||t[33]!==g?(w=u.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-200 opacity-95",children:u.jsxs(oa,{kind:"danger",className:"flex flex-col rounded py-3 px-5 animate-in slide-in-from-left",children:[g,v]})}),t[32]=v,t[33]=g,t[34]=w):w=t[34],w}if(MF(e)){let h;t[35]!==e.packages?(h=function(O){const R=new Set(Object.values(O)),P=R.has("queued")||R.has("installing")?"installing":R.has("failed")?"failed":"installed";return P==="installing"?{status:"installing",title:"Installing packages",titleIcon:u.jsx(da,{className:"w-5 h-5 inline-block mr-2"}),description:"Installing packages:"}:P==="installed"?{status:"installed",title:"All packages installed!",titleIcon:u.jsx(Up,{className:"w-5 h-5 inline-block mr-2"}),description:"Installed packages:"}:{status:"failed",title:"Some packages failed to install",titleIcon:u.jsx(sd,{className:"w-5 h-5 inline-block mr-2"}),description:"See terminal for error logs."}}(e.packages),t[35]=e.packages,t[36]=h):h=t[36];const{status:f,title:m,titleIcon:g,description:x}=h;f==="installed"&&setTimeout(()=>n(e.id),1e4);const p=f==="failed"?"danger":"info";let b,y,v,w,j;t[37]!==m||t[38]!==g?(b=u.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[g,m]}),t[37]=m,t[38]=g,t[39]=b):b=t[39],t[40]!==n||t[41]!==e.id?(y=()=>n(e.id),t[40]=n,t[41]=e.id,t[42]=y):y=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(v=u.jsx(wn,{className:"w-5 h-5"}),t[43]=v):v=t[43],t[44]!==y?(w=u.jsx(ve,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:y,children:v}),t[44]=y,t[45]=w):w=t[45],t[46]!==b||t[47]!==w?(j=u.jsxs("div",{className:"flex justify-between",children:[b,w]}),t[46]=b,t[47]=w,t[48]=j):j=t[48];const C=f==="installed"&&"text-accent-foreground";let N,S,E,T,I,D,F;if(t[49]!==C?(N=xe("flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",C),t[49]=C,t[50]=N):N=t[50],t[51]!==x?(S=u.jsx("p",{children:x}),t[51]=x,t[52]=S):S=t[52],t[53]!==e.packages||t[54]!==f){let O;t[56]!==f?(O=(R,P)=>{const[z,_]=R;return u.jsxs("li",{className:xe("flex items-center gap-1 font-mono text-sm",_==="installing"&&"font-semibold",_==="failed"&&"text-destructive",_==="installed"&&"text-accent-foreground",_==="installed"&&f==="failed"&&"text-muted-foreground"),children:[u.jsx(T_,{status:_}),z]},P)},t[56]=f,t[57]=O):O=t[57],E=Object.entries(e.packages).map(O),t[53]=e.packages,t[54]=f,t[55]=E}else E=t[55];return t[58]!==E?(T=u.jsx("ul",{className:"list-disc ml-4 mt-1",children:E}),t[58]=E,t[59]=T):T=t[59],t[60]!==S||t[61]!==T?(I=u.jsxs("div",{children:[S,T]}),t[60]=S,t[61]=T,t[62]=I):I=t[62],t[63]!==N||t[64]!==I?(D=u.jsx("div",{className:N,children:I}),t[63]=N,t[64]=I,t[65]=D):D=t[65],t[66]!==D||t[67]!==p||t[68]!==j?(F=u.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-200 opacity-95",children:u.jsxs(oa,{kind:p,className:"flex flex-col rounded pt-3 pb-4 px-5",children:[j,D]})}),t[66]=D,t[67]=p,t[68]=j,t[69]=F):F=t[69],F}return hc(e),null},T_=t=>{const e=H.c(4),{status:n}=t;switch(n){case"queued":{let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(Ss,{size:"1rem"}),e[0]=o):o=e[0],o}case"installing":{let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(da,{size:"1rem"}),e[1]=o):o=e[1],o}case"installed":{let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(gc,{size:"1rem"}),e[2]=o):o=e[2],o}case"failed":{let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(wn,{size:"1rem"}),e[3]=o):o=e[3],o}default:return hc(n),null}},M_=t=>{const e=H.c(10),{manager:n,packages:o,versions:r,clearPackageAlert:s}=t,{sendInstallMissingPackages:i}=nt();let a,l,c,d;return e[0]!==s||e[1]!==n||e[2]!==o||e[3]!==i||e[4]!==r?(a=async()=>{s();const h={...r};for(const f of o)h[f]=h[f]??"";await i({manager:n,versions:h}).catch(P_)},e[0]=s,e[1]=n,e[2]=o,e[3]=i,e[4]=r,e[5]=a):a=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(da,{className:"w-4 h-4 mr-2"}),c=u.jsx("span",{className:"font-semibold",children:"Install"}),e[6]=l,e[7]=c):(l=e[6],c=e[7]),e[8]!==a?(d=u.jsxs(ve,{variant:"outline","data-testid":"install-packages-button",size:"sm",onClick:a,children:[l,c]}),e[8]=a,e[9]=d):d=e[9],d},O_=()=>{const t=H.c(17),[e,n]=xr(),{saveUserConfig:o}=nt();let r,s;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=R3(_P),t[0]=r):r=t[0],t[1]!==e?(s={resolver:r,defaultValues:e},t[1]=e,t[2]=s):s=t[2];const i=P3(s);let a;t[3]!==o||t[4]!==n?(a=async m=>{await o({config:m}).then(()=>{n(m)})},t[3]=o,t[4]=n,t[5]=a):a=t[5];const l=a;let c,d,h,f;return t[6]!==i||t[7]!==l?(c=i.handleSubmit(l),t[6]=i,t[7]=l,t[8]=c):c=t[8],t[9]!==i.control?(d=u.jsx("div",{className:"flex flex-col gap-3",children:u.jsx(I3,{control:i.control,name:"package_management.manager",render:F_})}),t[9]=i.control,t[10]=d):d=t[10],t[11]!==c||t[12]!==d?(h=u.jsx("form",{onChange:c,className:"flex flex-col gap-5",children:d}),t[11]=c,t[12]=d,t[13]=h):h=t[13],t[14]!==i||t[15]!==h?(f=u.jsx(IP,{...i,children:h}),t[14]=i,t[15]=h,t[16]=f):f=t[16],f},D_=t=>{const e=H.c(14),{packageName:n,selectedExtras:o,onExtrasChange:r}=t,[s,i]=M.useState(!1),{isPending:a,error:l,data:c}=Db(n);let d;e[0]!==r||e[1]!==o?(d=(x,p)=>{r(p?[...o,x]:o.filter(b=>b!==x))},e[0]=r,e[1]=o,e[2]=d):d=e[2];const h=d,f=!a&&!l;let m,g;if(e[3]!==(c==null?void 0:c.extras)?(m=(c==null?void 0:c.extras)??[],e[3]=c==null?void 0:c.extras,e[4]=m):m=e[4],e[5]!==f||e[6]!==h||e[7]!==s||e[8]!==n||e[9]!==o||e[10]!==m){const x=m.filter(z_);let p;e[12]!==n?(p=u.jsx("span",{className:"shrink-0",children:n}),e[12]=n,e[13]=p):p=e[13],g=u.jsxs("div",{className:"flex items-center max-w-72",children:[p,o.length>0?u.jsxs("span",{className:"flex items-center min-w-0 flex-1",children:[u.jsx("span",{className:"shrink-0",children:"["}),u.jsxs(Eo,{open:s&&f,onOpenChange:b=>{f&&i(b)},children:[u.jsx(_o,{asChild:!0,children:u.jsx("button",{className:"hover:bg-muted/50 rounded text-sm px-1 transition-colors border border-muted-foreground/30 hover:border-muted-foreground/60 min-w-0 flex-1 truncate text-left",title:`Selected extras: ${o.join(", ")}`,children:o.join(",")})}),u.jsxs(Io,{align:"start",className:"w-64 p-0 max-h-96 flex flex-col",children:[o.length>0&&u.jsx("div",{className:"p-2 bg-popover border-b border-border",children:u.jsx("div",{className:"flex flex-wrap gap-1 p-1 min-h-[24px]",children:o.map(b=>u.jsxs("span",{className:"inline-flex items-center gap-1 px-1 py-0.5 text-sm font-mono border border-muted-foreground/30 hover:border-muted-foreground/60 rounded-sm cursor-pointer group transition-colors",onClick:()=>h(b,!1),children:[b,u.jsx(wn,{className:"w-3 h-3 opacity-60 group-hover:opacity-100"})]},b))})}),u.jsx("div",{className:"overflow-y-auto flex-1",children:x.map(b=>u.jsx(OC,{checked:o.includes(b),onCheckedChange:y=>{h(b,y)},className:"font-mono text-sm",onSelect:B_,children:b},b))})]})]}),u.jsx("span",{className:"shrink-0",children:"]"})]}):x.length>0?u.jsxs(Eo,{open:s&&f,onOpenChange:b=>{f&&i(b)},children:[u.jsx(_o,{asChild:!0,children:u.jsx("button",{disabled:!f,className:xe("hover:bg-muted/50 rounded text-sm ml-2 transition-colors border border-muted-foreground/30 hover:border-muted-foreground/60 h-5 w-5 flex items-center justify-center p-0",!f&&"opacity-50 cursor-not-allowed"),title:f?"Add extras":"Loading extras...",children:u.jsx(Jo,{className:"w-3 h-3 shrink-0"})})}),u.jsxs(Io,{align:"start",className:"w-64 p-0 max-h-96 flex flex-col",children:[u.jsx("div",{className:"p-2 bg-popover border-b border-border",children:u.jsx("span",{className:"text-muted-foreground italic text-sm",children:"Package extras"})}),u.jsx("div",{className:"overflow-y-auto flex-1",children:x.map(b=>u.jsx(OC,{checked:o.includes(b),onCheckedChange:y=>{h(b,y)},className:"font-mono text-sm",onSelect:U_,children:b},b))})]})]}):null]}),e[5]=f,e[6]=h,e[7]=s,e[8]=n,e[9]=o,e[10]=m,e[11]=g}else g=e[11];return g},R_=t=>{const e=H.c(16),{value:n,onChange:o,packageName:r}=t,{error:s,isPending:i,data:a}=Db(r);if(s){let h,f,m;return e[0]!==o?(h=g=>o(g.target.value),e[0]=o,e[1]=h):h=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx("option",{value:"latest",children:"latest"}),e[2]=f):f=e[2],e[3]!==h||e[4]!==n?(m=u.jsx(Ee,{content:"Failed to fetch package versions",children:u.jsx(Qm,{value:n,onChange:h,disabled:!0,className:"inline-flex ml-2 w-24 text-ellipsis",children:f})}),e[3]=h,e[4]=n,e[5]=m):m=e[5],m}let l,c,d;return e[6]!==o?(l=h=>o(h.target.value),e[6]=o,e[7]=l):l=e[7],e[8]!==i||e[9]!==a?(c=i?u.jsx("option",{value:"latest",children:"latest"}):["latest",...a.versions.slice(0,100)].map($_),e[8]=i,e[9]=a,e[10]=c):c=e[10],e[11]!==i||e[12]!==l||e[13]!==c||e[14]!==n?(d=u.jsx(Qm,{value:n,onChange:l,disabled:i,className:"inline-flex ml-2 w-24 text-ellipsis",children:c}),e[11]=i,e[12]=l,e[13]=c,e[14]=n,e[15]=d):d=e[15],d};function P_(t){ut.error(t)}function L_(t){return u.jsx("option",{value:t,children:t},t)}function F_(t){const{field:e}=t;return u.jsxs(A3,{children:[u.jsx(T3,{children:u.jsx(Qm,{"data-testid":"install-package-manager-select",onChange:n=>e.onChange(n.target.value),value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:AP.map(L_)})}),u.jsx(D3,{})]})}function z_(t){return!/^(dev|test|testing)$/i.test(t)}function B_(t){return t.preventDefault()}function U_(t){return t.preventDefault()}function $_(t){return u.jsx("option",{value:t,children:t},t)}const V_=t=>{let{transform:e}=t;return{...e,x:0}},H_={threshold:{x:0,y:.1}},W_=q.memo(t=>{const e=H.c(23),{children:n,multiColumn:o}=t,{dropCellOverCell:r,dropCellOverColumn:s,moveColumn:i,compactColumns:a}=lt(),[l,c]=M.useState(null),[d,h]=M.useState(null),[f]=S3();let m;e:{if(f.width==="columns"){m=ep.EMPTY;break e}let O;e[0]===Symbol.for("react.memo_cache_sentinel")?(O=[V_],e[0]=O):O=e[0],m=O}const g=m;let x,p;e[1]===Symbol.for("react.memo_cache_sentinel")?(x={activationConstraint:{distance:8}},e[1]=x):x=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(p={coordinateGetter:UN},e[2]=p):p=e[2];const b=function(){for(var O=arguments.length,R=new Array(O),P=0;P<O;P++)R[P]=arguments[P];return M.useMemo(()=>[...R].filter(z=>z!=null),[...R])}(e1(Fd,x),e1(Pd,p));let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y=O=>{c(O.active.id);const R=bn();h(R.cellIds)},e[3]=y):y=e[3];const v=Fe(y);let w;e[4]!==d?(w=()=>{c(null),h(null)},e[4]=d,e[5]=w):w=e[5];const j=Fe(w);let C;e[6]!==l?(C=O=>{const R=O.droppableContainers.filter(q_);if(l&&Br(l))return Td({...O,droppableContainers:R});const P=(A=>{let{droppableContainers:U,droppableRects:V,pointerCoordinates:X}=A;if(!X)return[];const Y=[];for(const G of U){const{id:W}=G,J=V.get(W);if(J&&sN(X,J)){const $=Id(J).reduce((te,oe)=>te+Ed(X,oe),0),Q=Number(($/4).toFixed(4));Y.push({id:W,data:{droppableContainer:G,value:Q}})}}return Y.sort(_d)})({...O,droppableContainers:R}),z=Ad(P.length>0?P:n1({...O,droppableContainers:R}),"id");if(!z)return[];Un(Br(z),`Expected column id. Got: ${z}`);const _=bn().cellIds.get(z);if(Un(_,`Expected column. Got: ${z}`),_&&_.topLevelIds.length===0)return[{id:z}];const k=new Set(_.topLevelIds),B=Td({...O,droppableContainers:O.droppableContainers.filter(A=>A.id!==z&&k.has(A.id))});if(B.length>0){const A=B[0].id;return Un(Uu(A),`Expected cell id. Got: ${A}`),[{id:A}]}return[]},e[6]=l,e[7]=C):C=e[7];const N=C;let S;e[8]!==r||e[9]!==s||e[10]!==i?(S=O=>{const{active:R,over:P}=O,z=P==null?void 0:P.id;if(z!=null&&R.id!==z){if(Uu(R.id)){if(Br(z))return void s({cellId:R.id,columnId:z});if(Uu(z))return void r({cellId:R.id,overCellId:z})}Br(R.id)&&Br(z)&&i({column:R.id,overColumn:z})}},e[8]=r,e[9]=s,e[10]=i,e[11]=S):S=e[11];const E=Fe(S);let T;e[12]!==a?(T=O=>{const{active:R,over:P}=O;P!==null&&R.id!==P.id&&a()},e[12]=a,e[13]=T):T=e[13];const I=Fe(T),D=o?N:Td;let F;return e[14]!==n||e[15]!==j||e[16]!==I||e[17]!==E||e[18]!==v||e[19]!==g||e[20]!==b||e[21]!==D?(F=u.jsx(_N,{autoScroll:H_,sensors:b,collisionDetection:D,modifiers:g,onDragEnd:I,onDragStart:v,onDragCancel:j,onDragOver:E,children:n}),e[14]=n,e[15]=j,e[16]=I,e[17]=E,e[18]=v,e[19]=g,e[20]=b,e[21]=D,e[22]=F):F=e[22],F});function Uu(t){return typeof t=="string"&&!t.startsWith("tree_")}function Br(t){return typeof t=="string"&&t.startsWith("tree_")}function q_(t){return Br(t.id)}const G_=t=>{const e=H.c(13),{className:n,size:o,gap:r,durationMs:s}=t,i=o===void 0?8:o,a=r===void 0?"gap-1":r,l=s===void 0?1200:s,c=`${l}ms`;let d;e[0]!==c?(d={animationDuration:c},e[0]=c,e[1]=d):d=e[1];const h=d;let f,m,g,x;return e[2]!==n||e[3]!==a?(f=Bc("flex",a,n),e[2]=n,e[3]=a,e[4]=f):f=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(m=[0,1,2],e[5]=m):m=e[5],e[6]!==h||e[7]!==l||e[8]!==i?(g=m.map(p=>u.jsx(TP,{width:i,height:i,className:"fill-current text-current animate-ellipsis-dot",style:{...h,animationDelay:l/3*p+"ms"}},p)),e[6]=h,e[7]=l,e[8]=i,e[9]=g):g=e[9],e[10]!==f||e[11]!==g?(x=u.jsx("div",{className:f,"aria-label":"Loading",children:g}),e[10]=f,e[11]=g,e[12]=x):x=e[12],x},Pb=t=>{const e=H.c(11),{title:n,children:o,show:r,delayMs:s,kind:i}=t,a=s===void 0?2e3:s,l=i===void 0?"info":i;if(!r)return null;let c,d,h;e[0]!==n?(c=n&&u.jsx("div",{className:"flex justify-between",children:u.jsx("span",{className:"font-bold text-lg flex items-center mb-1",children:n})}),e[0]=n,e[1]=c):c=e[1],e[2]!==o?(d=u.jsx("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:u.jsx("div",{children:o})}),e[2]=o,e[3]=d):d=e[3],e[4]!==l||e[5]!==c||e[6]!==d?(h=u.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-1/2 transform -translate-x-1/2 z-200 opacity-95",children:u.jsxs(oa,{kind:l,className:"flex flex-col rounded py-2 px-4 animate-in slide-in-from-top w-fit",children:[c,d]})}),e[4]=l,e[5]=c,e[6]=d,e[7]=h):h=e[7];const f=h;let m;return e[8]!==f||e[9]!==a?(m=u.jsx(zc,{milliseconds:a,children:f}),e[8]=f,e[9]=a,e[10]=m):m=e[10],m},Y_=()=>{const t=H.c(3),e=Ne(MP),n=Ne(OP);let o;return t[0]!==n||t[1]!==e?(o=e&&u.jsxs(u.Fragment,{children:[u.jsx(zc,{milliseconds:1e3,children:u.jsx("div",{className:"absolute top-4 m-0 flex items-center min-h-[28px] left-1/2 transform -translate-x-1/2 z-200 ",children:u.jsx(Ee,{content:"Connecting to a marimo runtime",children:u.jsx("div",{className:"flex items-center",children:u.jsx(G_,{size:5,className:"text-yellow-500"})})})})}),u.jsx(Pb,{show:e,delayMs:5e3,children:u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(kn,{className:"h-4 w-4"}),u.jsx("p",{children:"Connecting to a marimo runtime ..."})]})})]})||n&&u.jsx(Pb,{show:n,kind:"danger",children:u.jsx("div",{className:"flex items-center gap-2",children:u.jsx("p",{children:"Failed to connect."})})}),t[0]=n,t[1]=e,t[2]=o):o=t[2],o},Lb=q.forwardRef((t,e)=>{const n=H.c(71);let o,r,s,i,a,l,c;n[0]!==t?({columnId:i,canDelete:o,canMoveLeft:r,canMoveRight:s,footer:a,...l}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i,n[5]=a,n[6]=l):(o=n[1],r=n[2],s=n[3],i=n[4],a=n[5],l=n[6]),n[7]!==i?(c={id:i},n[7]=i,n[8]=c):c=n[8];const{attributes:d,listeners:h,setNodeRef:f,transform:m,transition:g,isDragging:x,isOver:p}=T1(c);let b;n[9]!==m?(b=m?Ec.Transform.toString({x:m.x,y:0,scaleX:1,scaleY:1}):void 0,n[9]=m,n[10]=b):b=n[10];const y=x?2:void 0;let v;n[11]!==b||n[12]!==y||n[13]!==g?(v={transform:b,transition:g,zIndex:y,position:"relative","--gutter-width":"50px"},n[11]=b,n[12]=y,n[13]=g,n[14]=v):v=n[14];const w=v,{deleteColumn:j,moveColumn:C,addColumn:N}=lt(),S=X_;let E;n[15]!==i||n[16]!==C?(E=()=>C({column:i,overColumn:"_left_"}),n[15]=i,n[16]=C,n[17]=E):E=n[17];const T=!r;let I,D,F;n[18]===Symbol.for("react.memo_cache_sentinel")?(I=u.jsx(j3,{className:"size-4"}),n[18]=I):I=n[18],n[19]!==E||n[20]!==T?(D=u.jsx(Ee,{content:"Move column left",side:"top",delayDuration:300,children:u.jsx(ve,{variant:"text",size:"xs",className:"hover:bg-(--gray-3) aspect-square p-0 w-7 h-7",onClick:E,disabled:T,children:I})}),n[19]=E,n[20]=T,n[21]=D):D=n[21],n[22]!==i||n[23]!==C?(F=()=>C({column:i,overColumn:"_right_"}),n[22]=i,n[23]=C,n[24]=F):F=n[24];const O=!s;let R,P,z,_,k,B;n[25]===Symbol.for("react.memo_cache_sentinel")?(R=u.jsx(Li,{className:"size-4"}),n[25]=R):R=n[25],n[26]!==O||n[27]!==F?(P=u.jsx(Ee,{content:"Move column right",side:"top",delayDuration:300,children:u.jsx(ve,{variant:"text",size:"xs",className:"hover:bg-(--gray-3) aspect-square p-0 w-7 h-7",onClick:F,disabled:O,children:R})}),n[26]=O,n[27]=F,n[28]=P):P=n[28],n[29]===Symbol.for("react.memo_cache_sentinel")?(z=u.jsx(DP,{className:"size-4 opacity-0 group-hover:opacity-50 transition-opacity duration-200"}),n[29]=z):z=n[29],n[30]!==d||n[31]!==h?(_=u.jsx("div",{className:"flex gap-2 h-full grow cursor-grab active:cursor-grabbing items-center justify-center","data-testid":"column-drag-spacer",...d,...h,children:z}),n[30]=d,n[31]=h,n[32]=_):_=n[32],n[33]===Symbol.for("react.memo_cache_sentinel")?(k=u.jsx(_o,{asChild:!0,children:u.jsx(ve,{variant:"text",size:"xs",className:"hover:bg-(--gray-3) aspect-square p-0 w-7 h-7",children:u.jsx(qc,{className:"size-4"})})}),n[33]=k):k=n[33],n[34]!==i||n[35]!==j?(B=()=>j({columnId:i}),n[34]=i,n[35]=j,n[36]=B):B=n[36];const A=!o;let U,V,X,Y,G,W;n[37]===Symbol.for("react.memo_cache_sentinel")?(U=u.jsx(wn,{className:"mr-2 size-4"}),n[37]=U):U=n[37],n[38]!==B||n[39]!==A?(V=u.jsxs(Eo,{children:[k,u.jsx(Io,{align:"end",children:u.jsxs(At,{onClick:B,disabled:A,children:[U,"Delete column"]})})]}),n[38]=B,n[39]=A,n[40]=V):V=n[40],n[41]!==N||n[42]!==i?(X=()=>{N({columnId:i}),requestAnimationFrame(S)},n[41]=N,n[42]=i,n[43]=X):X=n[43],n[44]===Symbol.for("react.memo_cache_sentinel")?(Y=u.jsx(Jo,{className:"size-4"}),n[44]=Y):Y=n[44],n[45]!==X?(G=u.jsx(Ee,{content:"Add column",side:"top",delayDuration:300,children:u.jsx(ve,{variant:"text",size:"xs",className:"hover:bg-(--gray-3) aspect-square p-0 w-7 h-7",onClick:X,children:Y})}),n[45]=X,n[46]=G):G=n[46],n[47]!==P||n[48]!==_||n[49]!==V||n[50]!==G||n[51]!==D?(W=u.jsxs("div",{className:"px-2 pt-3 pb-0 group flex items-center rounded-t-lg overflow-hidden",children:[D,P,_,V,G]}),n[47]=P,n[48]=_,n[49]=V,n[50]=G,n[51]=D,n[52]=W):W=n[52];const J=W;let $;n[53]!==e||n[54]!==f?($=ae=>{ll(e,f)(ae)},n[53]=e,n[54]=f,n[55]=$):$=n[55];const Q=x?"":l.className,te=x?"z-20":"z-1 hover:z-10 focus-within:z-10",oe=p&&"bg-accent/20";let ne,ie,se;return n[56]!==Q||n[57]!==te||n[58]!==oe?(ne=xe(Q,te,oe),n[56]=Q,n[57]=te,n[58]=oe,n[59]=ne):ne=n[59],n[60]!==J||n[61]!==l.children?(ie=u.jsxs("div",{className:"bg-(--slate-1) rounded-lg",children:[J,l.children]}),n[60]=J,n[61]=l.children,n[62]=ie):ie=n[62],n[63]!==a||n[64]!==x||n[65]!==l||n[66]!==w||n[67]!==$||n[68]!==ne||n[69]!==ie?(se=u.jsxs("div",{tabIndex:-1,ref:$,...l,style:w,"data-is-dragging":x,className:ne,children:[ie,a]}),n[63]=a,n[64]=x,n[65]=l,n[66]=w,n[67]=$,n[68]=ne,n[69]=ie,n[70]=se):se=n[70],se});Lb.displayName="SortableColumn";const K_=M.memo(Lb);function X_(){const t=document.getElementById("App");t&&t.scrollTo({left:t.scrollLeft+1e3,behavior:"smooth"})}const{getColumnWidth:J_,saveColumnWidth:Z_}=RP,Fb=M.memo(t=>{const e=H.c(20),n=M.useRef(null);if(t.width==="columns"){const s=t.canDelete,i=t.columnId,a=t.canMoveLeft,l=t.canMoveRight,c=t.footer;let d,h,f,m;return e[0]!==t.index?(d=J_(t.index),e[0]=t.index,e[1]=d):d=e[1],e[2]!==t.index?(h=g=>{Z_(t.index,g)},e[2]=t.index,e[3]=h):h=e[3],e[4]!==t.children||e[5]!==d||e[6]!==h?(f=u.jsx(Q_,{startingWidth:d,onResize:h,children:t.children}),e[4]=t.children,e[5]=d,e[6]=h,e[7]=f):f=e[7],e[8]!==t.canDelete||e[9]!==t.canMoveLeft||e[10]!==t.canMoveRight||e[11]!==t.columnId||e[12]!==t.footer||e[13]!==f?(m=u.jsx(K_,{tabIndex:-1,ref:n,canDelete:s,columnId:i,canMoveLeft:a,canMoveRight:l,className:"group/column",footer:c,children:f}),e[8]=t.canDelete,e[9]=t.canMoveLeft,e[10]=t.canMoveRight,e[11]=t.columnId,e[12]=t.footer,e[13]=f,e[14]=m):m=e[14],m}let o,r;return e[15]!==t.children?(o=u.jsx("div",{"data-testid":"cell-column",className:"flex flex-col gap-5",children:t.children}),e[15]=t.children,e[16]=o):o=e[16],e[17]!==t.footer||e[18]!==o?(r=u.jsxs(u.Fragment,{children:[o,t.footer]}),e[17]=t.footer,e[18]=o,e[19]=r):r=e[19],r});Fb.displayName="Column";const Q_=t=>{const e=H.c(15),{startingWidth:n,onResize:o,children:r}=t;let s;e[0]!==o||e[1]!==n?(s={startingWidth:n,onResize:o},e[0]=o,e[1]=n,e[2]=s):s=e[2];const{resizableDivRef:i,handleRefs:a,style:l}=PP(s),c=e6;let d,h,f,m;return e[3]!==a.left?(d=c(a.left),e[3]=a.left,e[4]=d):d=e[4],e[5]!==r||e[6]!==i||e[7]!==l?(h=u.jsx("div",{ref:i,className:"flex flex-col gap-5 box-content min-h-[100px] px-11 pt-3 pb-6 min-w-[500px] z-1",style:l,children:r}),e[5]=r,e[6]=i,e[7]=l,e[8]=h):h=e[8],e[9]!==a.right?(f=c(a.right),e[9]=a.right,e[10]=f):f=e[10],e[11]!==d||e[12]!==h||e[13]!==f?(m=u.jsxs("div",{className:"flex flex-row",children:[d,h,f]}),e[11]=d,e[12]=h,e[13]=f,e[14]=m):m=e[14],m};function e6(t){return u.jsx("div",{ref:t,className:`w-[3px] cursor-col-resize transition-colors duration-200 z-100
|
|
123
|
+
`);await navigator.clipboard.writeText(A),gb(k.length)}catch{u_()}}}),P=Fe(async(z,_)=>{const{before:k=!1}=_??{};try{const B=await navigator.clipboard.read();for(const U of B)if(U.types.includes(Pu)){const V=await U.getType(Pu),X=await V.text();try{const Y=d_.parse(JSON.parse(X));if(Y.cells.length===0)break;const G=z,W=Y.cells.reverse();for(const J of W)O.createNewCell({cellId:G,before:k,code:J.code,autoFocus:!0});return}catch(Y){ut.warn("Failed to parse clipboard cell data",Y)}}const A=await navigator.clipboard.readText();A.trim()?O.createNewCell({cellId:z,before:k,code:A,autoFocus:!0}):h_()}catch(B){ut.error("Failed to paste from clipboard",B),f_()}});return{copyCells:R,pasteAtCell:P}}(),p=ja(),b=function(O){const R=H.c(2);let P,z;return R[0]!==O?(z=jt(_=>_(Sd).selected.has(O)),R[0]=O,R[1]=z):z=R[1],P=z,Ne(P)}(t),y=Ps(),v=Os(),w=Ne(Cc);let j;n[0]!==y||n[1]!==p?(j={clear:()=>{y.clear(),p.clear()},extend:O=>{y.clear(),p.extend(O)},select:O=>{y.clear(),p.select(O)}},n[0]=y,n[1]=p,n[2]=j):j=n[2];const C=j,N=Ne(Fi);let S;n[3]!==N?(S=(O,R)=>ic(N.getHotkey(O).key)(R.nativeEvent||R),n[3]=N,n[4]=S):S=n[4];const E=S,T=function(O){const R=H.c(11),P=CC(),z=lt(),_=Ct(ai);let k,B,A;R[0]!==O||R[1]!==P?(k=()=>{P.focusCell({cellId:O})},R[0]=O,R[1]=P,R[2]=k):k=R[2],R[3]!==z||R[4]!==O||R[5]!==P||R[6]!==_?(B=()=>{_(!1),z.markTouched({cellId:O}),P.blurCell()},R[3]=z,R[4]=O,R[5]=P,R[6]=_,R[7]=B):B=R[7],R[8]!==k||R[9]!==B?(A={onFocusWithin:k,onBlurWithin:B},R[8]=k,R[9]=B,R[10]=A):A=R[10];const{focusWithinProps:U}=gP(A);return U}(t);let I;n[5]!==c||n[6]!==o||n[7]!==s||n[8]!==t||n[9]!==g||n[10]!==v||n[11]!==r||n[12]!==b||n[13]!==E||n[14]!==m||n[15]!==x||n[16]!==y||n[17]!==f||n[18]!==a||n[19]!==i||n[20]!==C||n[21]!==l||n[22]!==h||n[23]!==d||n[24]!==w?(I={onKeyDown:O=>{if(zn.fromInput(O))return void O.continuePropagation();const R={"Mod+ArrowUp":()=>(c.focusTopCell(),C.clear(),!0),"Mod+ArrowDown":()=>(c.focusBottomCell(),C.clear(),!0),ArrowUp:()=>(c.focusCell({cellId:t,where:"before"}),C.clear(),!0),ArrowDown:()=>(c.focusCell({cellId:t,where:"after"}),C.clear(),!0),ArrowLeft:()=>{if(o){const _=d.get(In),k=_.cellIds.findWithId(t),B=_.cellIds.indexOf(k),A=_.cellIds.at(B-1);if(A&&A.length>0){const U=yb(t,A);return c.focusCell({cellId:U,where:"exact"}),C.clear(),!0}}return!1},ArrowRight:()=>{if(o){const _=d.get(In),k=_.cellIds.findWithId(t),B=_.cellIds.indexOf(k),A=_.cellIds.at(B+1);if(A&&A.length>0){const U=yb(t,A);return c.focusCell({cellId:U,where:"exact"}),C.clear(),!0}}return!1},"Shift+ArrowUp":()=>{const _=d.get(ta);C.extend({cellId:t,allCellIds:_});const k=_.findWithId(t).before(t);return k&&C.extend({cellId:k,allCellIds:_}),c.focusCell({cellId:t,where:"before"}),!0},"Shift+ArrowDown":()=>{const _=d.get(ta);C.extend({cellId:t,allCellIds:_});const k=_.findWithId(t).after(t);return k&&C.extend({cellId:k,allCellIds:_}),c.focusCell({cellId:t,where:"after"}),!0},Escape:()=>!!b&&(C.clear(),!0),Enter:()=>(h(!0),SC(d,t),C.clear(),!0),s:()=>(i(),!0)};for(const[_,k]of Object.entries(R))if(ic(_)(O)&&k())return void O.preventDefault();const P={"cell.run":ro(_=>(f(_),!0)),"cell.runAndNewBelow":ro(_=>{f(_);const k=_[_.length-1];return c.moveToNextCell({cellId:k,before:!1}),!0}),"cell.runAndNewAbove":ro(_=>{f(_);const k=_[0];return c.moveToNextCell({cellId:k,before:!0}),!0}),"cell.createAbove":_=>(c.createNewCell({cellId:_,before:!0}),!0),"cell.createBelow":_=>(c.createNewCell({cellId:_,before:!1}),!0),"cell.moveUp":ro(_=>{const k=_[0];return d.get(In).cellIds.findWithId(k).first()!==k&&(_.forEach(B=>{c.moveCell({cellId:B,before:!0})}),!0)}),"cell.moveDown":ro(_=>{const k=_[_.length-1];return d.get(In).cellIds.findWithId(k).last()!==k&&([..._].reverse().forEach(B=>{c.moveCell({cellId:B,before:!1})}),!0)}),"cell.moveLeft":xb(_=>!!o&&(c.moveCell({cellId:_,direction:"left"}),!0)),"cell.moveRight":xb(_=>!!o&&(c.moveCell({cellId:_,direction:"right"}),!0)),"cell.hideCode":ro(_=>{var B;const k=!_.map(A=>{var V;return((V=d.get(In).cellData[A])==null?void 0:V.config)||null}).every(p_);a({configs:Object.fromEntries(_.map(A=>[A,{hide_code:k}]))});for(const A of _)c.updateCellConfig({cellId:A,config:{hide_code:k}});if(_.length===1){const A=_[0];c.focusCell({cellId:A,where:"after"}),k?((B=r.current)==null||B.contentDOM.blur(),jC(A)):SC(d,A)}return!0}),"cell.focusDown":_=>(c.focusCell({cellId:_,where:"after"}),!0),"cell.focusUp":_=>(c.focusCell({cellId:_,where:"before"}),!0),"cell.sendToBottom":ro(_=>(_.forEach(k=>{c.sendToBottom({cellId:k})}),!0)),"cell.sendToTop":ro(_=>([..._].reverse().forEach(k=>{c.sendToTop({cellId:k})}),!0)),"cell.aiCompletion":_=>{var B;let k=!1;return l(A=>(A==null?void 0:A.cellId)===_?(k=!0,null):{cellId:_}),k&&((B=r.current)==null||B.focus()),!0},"cell.cellActions":()=>{var _;return(_=s.current)==null||_.toggle(),!0},"command.copyCell":ro(_=>(g(_),!0)),"command.pasteCell":_=>(x(_),!0),"command.createCellBefore":_=>!zn.hasModifier(O)&&(c.createNewCell({cellId:_,before:!0,autoFocus:!0}),!0),"command.createCellAfter":_=>!zn.hasModifier(O)&&(c.createNewCell({cellId:_,before:!1,autoFocus:!0}),!0),"cell.delete":()=>{if(!w.keymap.destructive_delete)return!1;const _=z.size>=2?[...z]:[t],k=d.get(In);return!_.some(B=>{const{status:A}=k.cellRuntime[B];return A==="running"||A==="queued"})&&(y.idle?(y.submit(_),!0):(v({cellIds:_}),y.clear(),!0))}},z=function(_){return _.get(Sd).selected}(d);if(m==="vim"&&function(_,k){const B=function(Y){if(Y.ctrlKey||Y.metaKey||Y.altKey)return"";const G=Y.key.toLowerCase();return Y.shiftKey?`shift+${G}`:G}(_),A=_.target;if(!B||!A)return!1;const U=li.get(A);let V=B;U!=null&&U.timeout&&clearTimeout(U.timeout),U&&(V=`${U.sequence} ${B}`);const X=k[V];if(X)return li.delete(A),X();if(!U){const Y=k[B];if(Y)return Y()}if(Object.keys(k).some(Y=>Y.startsWith(`${V} `))){const Y=window.setTimeout(()=>{li.delete(A)},500);return li.set(A,{sequence:V,timeout:Y}),!0}return li.delete(A),!1}(O.nativeEvent||O,{j:R.ArrowDown,k:R.ArrowUp,h:R.ArrowLeft,l:R.ArrowRight,i:R.Enter,"shift+j":R["Shift+ArrowDown"],"shift+k":R["Shift+ArrowUp"],"g g":R["Mod+ArrowUp"],"shift+g":R["Mod+ArrowDown"],"d d":()=>P["cell.delete"](),"y y":()=>(g(z.size>=2?[...z]:[t]),!0),p:()=>(x(t,{before:!1}),!0),"shift+p":()=>(x(t,{before:!0}),!0),o:()=>(c.createNewCell({cellId:t,before:!1,autoFocus:!0}),!0),"shift+o":()=>(c.createNewCell({cellId:t,before:!0,autoFocus:!0}),!0),u:()=>(c.undoDeleteCell(),!0)}))O.preventDefault();else{for(const[_,k]of Object.entries(P))if(E(_,O)){if(k instanceof Function){if(k(t))return void O.preventDefault()}else if(z.size>=2?k.bulkHandle([...z]):k.handle(t))return void O.preventDefault();return}O.continuePropagation()}}},n[5]=c,n[6]=o,n[7]=s,n[8]=t,n[9]=g,n[10]=v,n[11]=r,n[12]=b,n[13]=E,n[14]=m,n[15]=x,n[16]=y,n[17]=f,n[18]=a,n[19]=i,n[20]=C,n[21]=l,n[22]=h,n[23]=d,n[24]=w,n[25]=I):I=n[25];const{keyboardProps:D}=kC(I);let F;return n[26]!==T||n[27]!==b||n[28]!==D?(F=lm(T,D,{"data-selected":b,className:"data-[selected=true]:ring-1 data-[selected=true]:ring-(--blue-8) data-[selected=true]:ring-offset-1"}),n[26]=T,n[27]=b,n[28]=D,n[29]=F):F=n[29],F}function p_(t){return t==null?void 0:t.hide_code}function yb(t,e){const n=document.getElementById(Oi.create(t));if(!n)return e.first();const o=n.getBoundingClientRect();for(const r of e.topLevelIds){const s=document.getElementById(Oi.create(r));if(s){const i=s.getBoundingClientRect();if(o.top<=i.bottom&&o.bottom>=i.top)return r}}return e.last()}const g_=t=>{const e=H.c(24),{editorView:n,code:o,currentLanguageAdapter:r,onAfterToggle:s}=t;let i,a;e[0]!==o?(a=new Bi().isSupported(o)||o.trim()==="",e[0]=o,e[1]=a):a=e[1],i=a;const l=i;let c,d;e[2]!==o?(d=new Rc().isSupported(o)||o.trim()==="",e[2]=o,e[3]=d):d=e[3],c=d;const h=c&&r==="python";let f,m;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(Yo,{color:"var(--sky-11)",strokeWidth:2.5,className:"w-4 h-4"}),e[4]=f):f=e[4],e[5]!==r||e[6]!==n||e[7]!==s||e[8]!==h?(m=u.jsx(Lu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:h,icon:f,toType:"sql",displayName:"SQL",onAfterToggle:s}),e[5]=r,e[6]=n,e[7]=s,e[8]=h,e[9]=m):m=e[9];const g=l&&r==="python";let x,p,b,y,v;return e[10]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx(tc,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[10]=x):x=e[10],e[11]!==r||e[12]!==n||e[13]!==s||e[14]!==g?(p=u.jsx(Lu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:g,icon:x,toType:"markdown",displayName:"Markdown",onAfterToggle:s}),e[11]=r,e[12]=n,e[13]=s,e[14]=g,e[15]=p):p=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(nc,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[16]=b):b=e[16],e[17]!==r||e[18]!==n?(y=u.jsx(Lu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:!0,icon:b,toType:"python",displayName:"Python",onAfterToggle:Bn.NOOP}),e[17]=r,e[18]=n,e[19]=y):y=e[19],e[20]!==p||e[21]!==y||e[22]!==m?(v=u.jsxs("div",{className:"absolute right-3 top-2 z-20 flex hover-action gap-1",children:[m,p,y]}),e[20]=p,e[21]=y,e[22]=m,e[23]=v):v=e[23],v},Lu=t=>{const e=H.c(10),{editorView:n,currentLanguageAdapter:o,canSwitchToLanguage:r,icon:s,toType:i,displayName:a,onAfterToggle:l}=t;let c;e[0]!==n||e[1]!==l||e[2]!==i?(c=()=>{n&&(pr(n,{language:i}),l())},e[0]=n,e[1]=l,e[2]=i,e[3]=c):c=e[3];const d=c;if(!r||o===i)return null;const h=`View as ${a}`;let f,m;return e[4]!==d||e[5]!==s?(f=u.jsx(ve,{"data-testid":"language-toggle-button",variant:"text",size:"xs",className:"opacity-80 px-1",onClick:d,children:s}),e[4]=d,e[5]=s,e[6]=f):f=e[6],e[7]!==h||e[8]!==f?(m=u.jsx(Ee,{content:h,children:f}),e[7]=h,e[8]=f,e[9]=m):m=e[9],m},vb=({theme:t,showPlaceholder:e,id:n,config:o,code:r,status:s,serializedEditorState:i,setEditorView:a,runCell:l,userConfig:c,editorViewRef:d,editorViewParentRef:h,hidden:f,hasOutput:m,showHiddenCode:g,languageAdapter:x,setLanguageAdapter:p,showLanguageToggles:b=!0})=>{var G;const[y,v]=zt(Ts),w=Ms(),{saveOrNameNotebook:j}=Cd(),C=Ps(),{saveCellConfig:N}=nt(),S=s==="running"||s==="queued",E=lt(),T=dg(),I=x==="markdown",D=Fe(()=>!S&&(C.idle&&c.keymap.destructive_delete?(C.submit([n]),!0):(w({cellId:n}),!0))),F=Fe(()=>!S&&(l(),!0)),O=Fe(()=>{const W=!o.hide_code;return N({configs:{[n]:{hide_code:W}}}),E.updateCellConfig({cellId:n,config:{hide_code:W}}),W}),R=Ne(ec),P=Fe(()=>{Jn({autoInstantiate:R,createNewCell:E.createNewCell})}),z=xP(c),_=M.useMemo(()=>{const W=g5({cellId:n,showPlaceholder:e,enableAI:z,cellActions:{...E,afterToggleMarkdown:P,onRun:F,deleteCell:D,saveNotebook:j,createManyBelow:J=>{for(const $ of[...J].reverse())E.createNewCell({code:$,before:!1,cellId:n,skipIfCodeExists:!0})},splitCell:T,toggleHideCode:O,aiCellCompletion:()=>{let J=!1;return v($=>($==null?void 0:$.cellId)===n?(J=!0,null):{cellId:n}),J}},completionConfig:c.completion,keymapConfig:c.keymap,lspConfig:c.language_servers,theme:t,hotkeys:new NC(c.keymap.overrides??{}),diagnosticsConfig:c.diagnostics,displayConfig:c.display});return W.push($n.define(J=>{const $=J.state.field(Mc);return p($.type),{update(Q){const te=Q.state.field(Mc);p(te.type)}}}),We.updateListener.of(J=>{J.selectionSet&&J.state.selection.ranges.some($=>$.from!==$.to)&&g({focus:!1})}),We.domEventHandlers({focus:()=>{g({focus:!1})}})),W},[n,c.keymap,c.completion,c.language_servers,c.display,c.diagnostics,z,t,e,E,T,O,D,F,v,P,p,g,j]),k=Pc(),B=Fe(()=>{if(k){const J=Su(n,0,r);_.push(J.extension),r=J.code}const W=new We({state:Ji.create({doc:r,extensions:_})});a(W),k||pr(W,{language:Gm(W.state).type})}),A=Fe(()=>{if(Un(d.current!==null,"Editor view is not initialized"),k){const W=Su(n);_.push(W.extension)}d.current.dispatch({effects:[Tt.reconfigure.of([_]),bP(d.current,{completionConfig:c.completion,hotkeysProvider:new NC(c.keymap.overrides??{}),lspConfig:{...c.language_servers,diagnostics:c.diagnostics}})]})}),U=Fe(()=>{if(Un(i,"Editor view is not initialized"),k){const J=Su(n,0,r);_.push(J.extension),r=J.code}const W=new We({state:Ji.fromJSON(i,{doc:r,extensions:_},{history:yP})});k||pr(W,{language:Gm(W.state).type}),a(W),E.clearSerializedEditorState({cellId:n})});M.useEffect(()=>{i===null?d.current===null?B():A():U(),d.current!==null&&h&&h.current!==null&&h.current.replaceChildren(d.current.dom)},[B,A,U,d,h,i,_]),M.useEffect(()=>{const W=d.current;return()=>{W==null||W.destroy()}},[d]);const V=function(W,J){const $=H.c(12),Q=Ct(ai),te=Ne(wC),oe=Ne(Fi);let ne,ie;if($[0]!==oe){const Se=oe.getHotkey("command.vimEnterCommandMode");ie=ic(Se.key),$[0]=oe,$[1]=ie}else ie=$[1];ne=ie;const se=ne;let ae;$[2]!==W||$[3]!==Q?(ae=()=>{Q(!1),jC(W)},$[2]=W,$[3]=Q,$[4]=ae):ae=$[4];const fe=ae;let re;$[5]!==J||$[6]!==fe?(re=()=>{if(!J.current)return void fe();const Se=J.current,Le=Se.state;Le.selection.main.empty?ys(Le)!==null?dm(Se):fe():Se.dispatch({selection:Qn.single(Le.selection.main.from)})},$[5]=J,$[6]=fe,$[7]=re):re=$[7];const ue=re;let le;$[8]!==ue||$[9]!==te||$[10]!==se?(le={onKeyDown:Se=>{te==="vim"?se(Se)&&ue():Se.key==="Escape"&&ue(),Se.continuePropagation()}},$[8]=ue,$[9]=te,$[10]=se,$[11]=le):le=$[11];const{keyboardProps:je}=kC(le);return je}(n,d),X=f&&!I||f&&I&&!m;let Y="";return I&&f&&m?Y="h-0 overflow-hidden":f&&(Y="opacity-20 h-8 [&>div.cm-editor]:h-full [&>div.cm-editor]:overflow-hidden [&_.cm-panels]:hidden"),u.jsx(l_,{enabled:(y==null?void 0:y.cellId)===n,initialPrompt:y==null?void 0:y.initialPrompt,currentCode:((G=d.current)==null?void 0:G.state.doc.toString())??r,currentLanguageAdapter:x,declineChange:Fe(()=>{var W;v(null),(W=d.current)==null||W.focus()}),onChange:Fe(W=>{var J;(J=d.current)==null||J.dispatch({changes:{from:0,to:d.current.state.doc.length,insert:W}})}),acceptChange:Fe(W=>{var J,$;(J=d.current)==null||J.dispatch({changes:{from:0,to:d.current.state.doc.length,insert:W}}),($=d.current)==null||$.focus(),v(null)}),children:u.jsxs("div",{className:"relative w-full",...V,children:[X&&u.jsx(EC,{tooltip:"Edit code",className:"absolute inset-0 z-10",onClick:g}),u.jsx(wb,{className:Y,editorView:d.current,ref:h}),!f&&b&&u.jsx("div",{className:"absolute top-1 right-5",children:u.jsx(g_,{code:r,editorView:d.current,currentLanguageAdapter:x,onAfterToggle:P})})]})})},wb=q.forwardRef((t,e)=>{const n=H.c(10),{className:o,editorView:r}=t,s=M.useRef(null);let i,a,l,c,d;return n[0]!==r?(i=()=>{r!==null&&s.current!==null&&s.current.children.length===0&&s.current.append(r.dom)},a=[r,s],n[0]=r,n[1]=i,n[2]=a):(i=n[1],a=n[2]),M.useEffect(i,a),n[3]!==o?(l=xe("cm mathjax_ignore",o),n[3]=o,n[4]=l):l=n[4],n[5]!==e?(c=h=>{e?ll(e,s)(h):ll(s)(h)},n[5]=e,n[6]=c):c=n[6],n[7]!==l||n[8]!==c?(d=u.jsx("div",{className:l,ref:c,"data-testid":"cell-editor"}),n[7]=l,n[8]=c,n[9]=d):d=n[9],d});wb.displayName="CellCodeMirrorEditor";const Fu=Pc()?function(t){const e=n=>{const o=H.c(5),r=Ne(ln),[s,i]=zt(Rr);if(r.state===Bt.CONNECTING||s===void 0){let l,c;return o[0]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx("span",{children:"Waiting for real-time collaboration connection..."}),o[0]=l):l=o[0],o[1]!==i?(c=u.jsx("div",{className:"flex h-full w-full items-baseline p-4",children:u.jsxs(zc,{milliseconds:1e3,fallback:null,children:[l,u.jsx(ve,{variant:"link",onClick:()=>{i("disabled")},children:"Turn off real-time collaboration"})]})}),o[1]=i,o[2]=c):c=o[2],c}let a;return o[3]!==n?(a=u.jsx(t,{...n}),o[3]=n,o[4]=a):a=o[4],a};return e.displayName=`WithWaitUntilConnected(${t.displayName})`,e}(M.memo(vb)):M.memo(vb),x_=t=>{const e=H.c(10);let n,o,r,s;return e[0]!==t.left?(n=u.jsx("div",{className:"flex-1 flex item-center gap-2",children:t.left}),e[0]=t.left,e[1]=n):n=e[1],e[2]!==t.center?(o=u.jsx("div",{className:"flex-1 flex item-center gap-2 justify-center",children:t.center}),e[2]=t.center,e[3]=o):o=e[3],e[4]!==t.right?(r=u.jsx("div",{className:"flex-1 flex item-center gap-2 justify-end",children:t.right}),e[4]=t.right,e[5]=r):r=e[5],e[6]!==n||e[7]!==o||e[8]!==r?(s=u.jsxs("div",{className:"flex items-center gap-2 w-full px-3",children:[n,o,r]}),e[6]=n,e[7]=o,e[8]=r,e[9]=s):s=e[9],s},b_=t=>{const e=H.c(8);if(!t.canCollapse&&!t.isCollapsed)return null;const n=t.isCollapsed?"Expand":"Collapse";let o,r,s;return e[0]!==t.isCollapsed?(o=u.jsx("span",{children:u.jsx(y_,{isCollapsed:t.isCollapsed})}),e[0]=t.isCollapsed,e[1]=o):o=e[1],e[2]!==n||e[3]!==o?(r=u.jsx(Ee,{content:n,children:o}),e[2]=n,e[3]=o,e[4]=r):r=e[4],e[5]!==t.onClick||e[6]!==r?(s=u.jsx(ve,{variant:"text",size:"icon",onClick:t.onClick,children:r}),e[5]=t.onClick,e[6]=r,e[7]=s):s=e[7],s},y_=t=>{const e=H.c(2),{isCollapsed:n}=t;let o;return e[0]!==n?(o=n?u.jsx(Li,{className:"w-5 h-5 shrink-0"}):u.jsx(No,{className:"w-5 h-5 shrink-0"}),e[0]=n,e[1]=o):o=e[1],o},kb=M.memo(t=>{const e=H.c(24),{onClick:n,count:o,cellId:r}=t,s=Dm();let i;e[0]!==r||e[1]!==s?(i=vP(s,r),e[0]=r,e[1]=s,e[2]=i):i=e[2];const a=i;let l,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=xe("flex items-center justify-between w-[calc(100%-2rem)] h-9 bg-muted rounded-b mx-4 opacity-80 hover:opacity-100 cursor-pointer"),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(wP,{className:"w-4 h-4 shrink-0"}),e[4]=c):c=e[4];const d=o===1?"cell":"cells";let h,f,m,g,x,p,b;return e[5]!==o||e[6]!==d?(h=u.jsxs(u.Fragment,{children:[c,u.jsxs("span",{className:"text-sm text-gray-500",children:[o," ",d," collapsed"]})]}),e[5]=o,e[6]=d,e[7]=h):h=e[7],e[8]!==a.errored?(f=a.errored&&u.jsx(Ee,{content:"Has errors",delayDuration:100,children:u.jsx(Bp,{className:"w-4 h-4 shrink-0 text-destructive"})}),e[8]=a.errored,e[9]=f):f=e[9],e[10]!==a.stale?(m=a.stale&&u.jsx(Ee,{content:"Has stale cells",delayDuration:100,children:u.jsx(_C,{className:"w-4 h-4 shrink-0 text-(--yellow-11)"})}),e[10]=a.stale,e[11]=m):m=e[11],e[12]!==a.runningOrQueued?(g=a.runningOrQueued&&u.jsx(Ee,{content:"Running",delayDuration:100,children:u.jsx(Fc,{className:"w-4 h-4 shrink-0 animate-spin"})}),e[12]=a.runningOrQueued,e[13]=g):g=e[13],e[14]!==f||e[15]!==m||e[16]!==g?(x=u.jsxs(u.Fragment,{children:[f,m,g]}),e[14]=f,e[15]=m,e[16]=g,e[17]=x):x=e[17],e[18]!==h||e[19]!==x?(p=u.jsx(x_,{center:h,right:x}),e[18]=h,e[19]=x,e[20]=p):p=e[20],e[21]!==n||e[22]!==p?(b=u.jsx("div",{onClick:n,className:l,children:p}),e[21]=n,e[22]=p,e[23]=b):b=e[23],b});kb.displayName="CollapsedCellBanner";const Cb=t=>{const e=H.c(31),{status:n,connectionState:o,onClick:r}=t,s=n==="running"||n==="queued";let i,a,l,c,d,h,f,m,g,x,p,b,y,v;if(e[0]!==o||e[1]!==s||e[2]!==r||e[3]!==n){const w=eo(o);let j;if(w){let C;e[14]!==o?(C=wc(o),e[14]=o,e[15]=C):C=e[15],j=C}else j=n==="running"?"A cell can't be deleted when it's running":n==="queued"?"A cell can't be deleted when it's queued to run":"Delete";a=Ee,g=j,x=!1,i=ve,l="ghost",c="icon",d=r,h="delete-button",f=zn.preventFocus,m=xe("hover:bg-transparent text-destructive/60 hover:text-destructive",(w||s)&&"inactive-button"),e[0]=o,e[1]=s,e[2]=r,e[3]=n,e[4]=i,e[5]=a,e[6]=l,e[7]=c,e[8]=d,e[9]=h,e[10]=f,e[11]=m,e[12]=g,e[13]=x}else i=e[4],a=e[5],l=e[6],c=e[7],d=e[8],h=e[9],f=e[10],m=e[11],g=e[12],x=e[13];return e[16]===Symbol.for("react.memo_cache_sentinel")?(p={boxShadow:"none"},b=u.jsx(rc,{size:14}),e[16]=p,e[17]=b):(p=e[16],b=e[17]),e[18]!==i||e[19]!==l||e[20]!==c||e[21]!==d||e[22]!==h||e[23]!==f||e[24]!==m?(y=u.jsx(i,{variant:l,size:c,onClick:d,"data-testid":h,onMouseDown:f,className:m,style:p,children:b}),e[18]=i,e[19]=l,e[20]=c,e[21]=d,e[22]=h,e[23]=f,e[24]=m,e[25]=y):y=e[25],e[26]!==a||e[27]!==y||e[28]!==g||e[29]!==x?(v=u.jsx(a,{content:g,usePortal:x,children:y}),e[26]=a,e[27]=y,e[28]=g,e[29]=x,e[30]=v):v=e[30],v},v_=t=>{const e=H.c(22),{cellId:n}=t,o=function(b){const y=H.c(16),v=Ne(Xg),w=Jg(),j=Os();let C;y[0]!==b||y[1]!==v.entries?(C=v.entries.get(b),y[0]=b,y[1]=v.entries,y[2]=C):C=y[2];const N=C;if(!N){let I;return y[3]===Symbol.for("react.memo_cache_sentinel")?(I={isPending:!1},y[3]=I):I=y[3],I}if(v.entries.size!==1){let I;return y[4]!==N?(I={isPending:!0,shouldConfirmDelete:!1,...N},y[4]=N,y[5]=I):I=y[5],I}let S,E,T;return y[6]!==w||y[7]!==j||y[8]!==v.entries?(S=()=>{j({cellIds:[...v.entries.values()].map(L4)}),w.clear()},y[6]=w,y[7]=j,y[8]=v.entries,y[9]=S):S=y[9],y[10]!==w?(E=()=>w.clear(),y[10]=w,y[11]=E):E=y[11],y[12]!==N||y[13]!==S||y[14]!==E?(T={isPending:!0,...N,shouldConfirmDelete:!0,confirm:S,cancel:E},y[12]=N,y[13]=S,y[14]=E,y[15]=T):T=y[15],T}(n);if(!o.isPending)return null;if(o.type==="simple"){let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=xe("px-3 py-1.5","bg-(--amber-2) border-t border-(--amber-6)","animate-in slide-in-from-top-2 duration-200"),e[0]=b):b=e[0];const y=`pending-delete-${n}`;let v,w;return e[1]===Symbol.for("react.memo_cache_sentinel")?(v=u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Rm,{className:"w-3 h-3 text-(--amber-11) shrink-0"}),u.jsx("span",{className:"text-(--amber-11) text-xs",children:"Pending deletion"})]}),e[1]=v):v=e[1],e[2]!==y?(w=u.jsx("div",{className:b,"data-testid":y,children:v}),e[2]=y,e[3]=w):w=e[3],w}const r=o.executionDurationMs!==void 0,s=o.defs.size>0,i=Es(o.executionDurationMs??0);let a,l="Pending deletion";r&&s?l=`This cell took ${i} to run and contains variables referenced by other cells.`:r?l=`This cell took ${i} to run.`:s&&(l="This cell contains variables referenced by other cells."),e[4]===Symbol.for("react.memo_cache_sentinel")?(a=xe("px-4 py-3","bg-(--amber-2) border-t border-(--amber-6)","animate-in slide-in-from-top-2 duration-200"),e[4]=a):a=e[4];const c=`pending-delete-${n}`;let d,h,f,m,g,x,p;return e[5]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(Rm,{className:"w-4 h-4 text-(--amber-11) mt-0.5 shrink-0"}),e[5]=d):d=e[5],e[6]!==l?(h=u.jsx("p",{className:"text-(--amber-11) font-medium",children:l}),e[6]=l,e[7]=h):h=e[7],e[8]!==s||e[9]!==o.defs?(f=s&&[...o.defs.entries()].map(k_),e[8]=s,e[9]=o.defs,e[10]=f):f=e[10],e[11]!==h||e[12]!==f?(m=u.jsxs("div",{className:"font-code text-sm text-[0.84375rem]",children:[h,f]}),e[11]=h,e[12]=f,e[13]=m):m=e[13],e[14]!==o?(g=o.shouldConfirmDelete&&u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"text-(--amber-11) mt-2 mb-3",children:"Are you sure you want to delete?"}),u.jsx(Tm,{autoFocus:!0,children:u.jsxs("div",{className:"flex items-center gap-2",onKeyDown:C_,children:[u.jsx(ve,{size:"xs",variant:"ghost",onClick:()=>o.cancel(),className:"text-(--amber-11) hover:bg-(--amber-4) hover:text-(--amber-11)",children:"Cancel"}),u.jsx(ve,{size:"xs",variant:"secondary",onClick:()=>o.confirm(),className:"bg-(--amber-11) hover:bg-(--amber-12) text-white border-(--amber-11)",children:"Delete"})]})})]}),e[14]=o,e[15]=g):g=e[15],e[16]!==m||e[17]!==g?(x=u.jsxs("div",{className:"flex items-start gap-3",children:[d,u.jsxs("div",{className:"flex-1",children:[m,g]})]}),e[16]=m,e[17]=g,e[18]=x):x=e[18],e[19]!==c||e[20]!==x?(p=u.jsx("div",{className:a,"data-testid":c,children:x}),e[19]=c,e[20]=x,e[21]=p):p=e[21],p};function w_(t){return u.jsx("li",{className:"my-0.5 ml-8 text-(--amber-11)/60",children:u.jsx(Mo,{cellId:t})},t)}function k_(t){const[e,n]=t;return u.jsxs("div",{children:[u.jsxs("p",{className:"text-(--amber-11) mt-2",children:["'",u.jsx("span",{className:"font-mono",children:e}),"' is referenced by:"]}),u.jsx("ul",{className:"list-disc",children:n.map(w_)})]},e)}function C_(t){t.stopPropagation()}const j_=t=>{const e=H.c(27),{onClick:n,connectionState:o,needsRun:r,status:s,config:i,edited:a}=t,l=s==="disabled-transitively",c=s==="running"||s==="queued";let d,h;e[0]!==l||e[1]!==i.disabled||e[2]!==o||e[3]!==a||e[4]!==c||e[5]!==r?(d=eo(o)||c||!i.disabled&&l&&!a,h=function({connectionState:p,needsRun:b,loading:y,inactive:v}){return eo(p)?"disabled":b&&!y?"stale":y||v?"disabled":"green"}({connectionState:o,needsRun:r,loading:c,inactive:d}),e[0]=l,e[1]=i.disabled,e[2]=o,e[3]=a,e[4]=c,e[5]=r,e[6]=d,e[7]=h):(d=e[6],h=e[7]);const f=h;if(i.disabled){let p,b;return e[8]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(Ip,{}),e[8]=p):p=e[8],e[9]!==d||e[10]!==n||e[11]!==f?(b=u.jsx(Us,{tooltip:"Add code to notebook",disabled:d,onClick:n,variant:f,"data-testid":"run-button",children:p}),e[9]=d,e[10]=n,e[11]=f,e[12]=b):b=e[12],b}if(!i.disabled&&l&&!a){let p,b;return e[13]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(Sr,{strokeWidth:1.2}),e[13]=p):p=e[13],e[14]!==d||e[15]!==n||e[16]!==f?(b=u.jsx(Us,{disabled:d,tooltip:"This cell can't be run because it has a disabled ancestor",onClick:n,variant:f,"data-testid":"run-button",children:p}),e[14]=d,e[15]=n,e[16]=f,e[17]=b):b=e[17],b}let m,g,x;if(eo(o)){let p;e[18]!==o?(p=wc(o),e[18]=o,e[19]=p):p=e[19],m=p}else if(s==="queued")m="This cell is already queued to run";else if(s==="running")m="This cell is already running.";else{let p;e[20]===Symbol.for("react.memo_cache_sentinel")?(p=Gt("cell.run"),e[20]=p):p=e[20],m=p}return e[21]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx(Sr,{strokeWidth:1.2}),e[21]=g):g=e[21],e[22]!==d||e[23]!==n||e[24]!==m||e[25]!==f?(x=u.jsx(Us,{tooltip:m,disabled:d,onClick:n,variant:f,"data-testid":"run-button",children:g}),e[22]=d,e[23]=n,e[24]=m,e[25]=f,e[26]=x):x=e[26],x},jb=q.createContext(null),Sb=M.memo(()=>M.use(jb));Sb.displayName="DragHandle";const Nb=q.forwardRef((t,e)=>{const n=H.c(21);let o,r,s,i,a;n[0]!==t?({cellId:r,canMoveX:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(i=r.toString(),n[4]=r,n[5]=i):i=n[5],n[6]!==i?(a={id:i},n[6]=i,n[7]=a):a=n[7];const{attributes:l,listeners:c,setNodeRef:d,transform:h,transition:f,isDragging:m}=T1(a);let g;n[8]!==h?(g=function(y){return!y||y.x===0&&y.y===0&&y.scaleX===1&&y.scaleY===1}(h)?null:h,n[8]=h,n[9]=g):g=n[9];const x=g,p=x==null?void 0:f;let b;return n[10]!==l||n[11]!==o||n[12]!==r||n[13]!==m||n[14]!==c||n[15]!==s||n[16]!==e||n[17]!==d||n[18]!==x||n[19]!==p?(b=u.jsx(Eb,{ref:e,cellId:r,canMoveX:o,...s,attributes:l,listeners:c,setNodeRef:d,transform:x,transition:p,isDragging:m}),n[10]=l,n[11]=o,n[12]=r,n[13]=m,n[14]=c,n[15]=s,n[16]=e,n[17]=d,n[18]=x,n[19]=p,n[20]=b):b=n[20],b});Nb.displayName="SortableCell";const Eb=q.forwardRef((t,e)=>{const n=H.c(37);let o,r,s,i,a,l,c,d,h,f;if(n[0]!==t){const{cellId:E,canMoveX:T,children:I,attributes:D,listeners:F,setNodeRef:O,transform:R,transition:P,isDragging:z,..._}=t;r=T,s=I,o=D,a=F,c=O,d=R,h=P,i=z,l=_,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i,n[5]=a,n[6]=l,n[7]=c,n[8]=d,n[9]=h}else o=n[1],r=n[2],s=n[3],i=n[4],a=n[5],l=n[6],c=n[7],d=n[8],h=n[9];n[10]!==r||n[11]!==d?(f=d?Ec.Transform.toString({x:r?d.x:0,y:d.y,scaleX:1,scaleY:1}):void 0,n[10]=r,n[11]=d,n[12]=f):f=n[12];const m=i?2:void 0;let g;n[13]!==f||n[14]!==m||n[15]!==h?(g={transform:f,transition:h,zIndex:m,position:"relative"},n[13]=f,n[14]=m,n[15]=h,n[16]=g):g=n[16];const x=g;let p,b;n[17]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(_p,{strokeWidth:1,size:20}),n[17]=p):p=n[17],n[18]!==o||n[19]!==a?(b=u.jsx("div",{...o,...a,onMouseDown:zn.preventFocus,"data-testid":"drag-button",className:"py-px cursor-grab opacity-50 hover:opacity-100 hover-action hover:bg-muted rounded border border-transparent hover:border-border active:bg-accent",children:p}),n[18]=o,n[19]=a,n[20]=b):b=n[20];const y=b,v=!!d;let w;n[21]!==e||n[22]!==c?(w=E=>{ll(e,c)(E)},n[21]=e,n[22]=c,n[23]=w):w=n[23];const j=v&&"is-moving";let C,N,S;return n[24]!==l.className||n[25]!==j?(C=xe(l.className,j,"outline-hidden rounded-lg"),n[24]=l.className,n[25]=j,n[26]=C):C=n[26],n[27]!==s||n[28]!==y?(N=u.jsx(jb.Provider,{value:y,children:s}),n[27]=s,n[28]=y,n[29]=N):N=n[29],n[30]!==i||n[31]!==l||n[32]!==x||n[33]!==w||n[34]!==C||n[35]!==N?(S=u.jsx("div",{tabIndex:-1,ref:w,...l,"data-is-dragging":i,className:C,style:x,children:N}),n[30]=i,n[31]=l,n[32]=x,n[33]=w,n[34]=C,n[35]=N,n[36]=S):S=n[36],S});function _b(t,e){const n=H.c(9);let o;n[0]!==t.current||n[1]!==e?(o=l=>{t.current===null||t.current.contains(l.relatedTarget)||e.current===null||dm(e.current)},n[0]=t.current,n[1]=e,n[2]=o):o=n[2];const r=Fe(o);let s;n[3]!==t.current||n[4]!==e?(s=l=>{if(t.current===document.activeElement&&e.current!==null&&ys(e.current.state)==="active"){for(const c of iC)if(l.key===c.key&&c.run){c.run(e.current),l.preventDefault(),l.stopPropagation();break}e.current.focus()}},n[3]=t.current,n[4]=e,n[5]=s):s=n[5];const i=Fe(s);let a;return n[6]!==r||n[7]!==i?(a={closeCompletionHandler:r,resumeCompletionHandler:i},n[6]=r,n[7]=i,n[8]=a):a=n[8],a}function Ib(t){const e=H.c(15),{cellId:n,cellConfig:o,languageAdapter:r,editorView:s}=t,[i,a]=zt(ai);let l,c;e[0]!==n?(c=SP(n),e[0]=n,e[1]=c):c=e[1],l=c;const d=Ne(l),h=!o.hide_code||i||d,f=r==="markdown",m=f&&!h;let g;e[2]!==s||e[3]!==h||e[4]!==a?(g=v=>{var j;if(h)return;const w=(v==null?void 0:v.focus)??!0;a(!0),w&&((j=s.current)==null||j.focus())},e[2]=s,e[3]=h,e[4]=a,e[5]=g):g=e[5];const x=Fe(g);let p;e[6]!==m||e[7]!==x?(p=()=>{m&&x({focus:!0})},e[6]=m,e[7]=x,e[8]=p):p=e[8];const b=Fe(p);let y;return e[9]!==h||e[10]!==f||e[11]!==m||e[12]!==x||e[13]!==b?(y={isCellCodeShown:h,isMarkdown:f,isMarkdownCodeHidden:m,showHiddenCode:x,showHiddenCodeIfMarkdown:b},e[9]=h,e[10]=f,e[11]=m,e[12]=x,e[13]=b,e[14]=y):y=e[14],y}Eb.displayName="SortableCellInternal";const Ab=M.forwardRef((t,e)=>{var x;const n=H.c(18),{cellId:o}=t,r=Zi(o),s=Qi(o);let i;n[0]===Symbol.for("react.memo_cache_sentinel")?(i=Bc("marimo-cell","hover-actions-parent z-10",{published:!0}),n[0]=i):i=n[0];const a=i,l=AC((x=s.output)==null?void 0:x.mimetype);if(s.errored||s.interrupted||s.stopped||l)return null;let c;n[1]!==r.name||n[2]!==o?(c=dp(o,r.name),n[1]=r.name,n[2]=o,n[3]=c):c=n[3];const d=s.output;let h,f,m,g;return n[4]!==r.edited||n[5]!==s?(h=TC(s,r.edited),n[4]=r.edited,n[5]=s,n[6]=h):h=n[6],n[7]!==s.status?(f=Zm(s.status),n[7]=s.status,n[8]=f):f=n[8],n[9]!==o||n[10]!==s.output||n[11]!==h||n[12]!==f?(m=u.jsx(Uc,{allowExpand:!1,forceExpand:!0,className:"output-area",cellId:o,output:d,stale:h,loading:f}),n[9]=o,n[10]=s.output,n[11]=h,n[12]=f,n[13]=m):m=n[13],n[14]!==e||n[15]!==c||n[16]!==m?(g=u.jsx("div",{tabIndex:-1,ref:e,className:a,...c,children:m}),n[14]=e,n[15]=c,n[16]=m,n[17]=g):g=n[17],g});Ab.displayName="ReadonlyCellComponent";const S_=({theme:t,showPlaceholder:e,cellId:n,canDelete:o,userConfig:r,isCollapsed:s,collapseCount:i,canMoveX:a,editorView:l,setEditorView:c})=>{var fe;const d=M.useRef(null),h=Zi(n),f=Qi(n),m=M.useRef(null),g=M.useRef(null),x=M.useRef(null),p=lt(),b=Ne(ln),y=Ct(Ts),v=Ms(),w=ud(n),{sendStdin:j}=nt(),[C,N]=M.useState(),S=h.config.disabled||f.status==="disabled-transitively",E=IC({executionTime:f.runElapsedTimeMs??h.lastExecutionTime,status:f.status,errored:f.errored,interrupted:f.interrupted,stopped:f.stopped}),T=h.edited||f.interrupted||f.staleInputs&&!S,I=Zm(f.status),D=(f.status==="queued"||h.edited||f.staleInputs)&&!f.interrupted,F=M.useCallback(()=>l.current,[l]),{closeCompletionHandler:O,resumeCompletionHandler:R}=_b(d,l),{isCellCodeShown:P,isMarkdown:z,isMarkdownCodeHidden:_,showHiddenCode:k,showHiddenCodeIfMarkdown:B}=Ib({cellId:n,cellConfig:h.config,languageAdapter:C,editorView:l}),A=bb(n,{canMoveX:a,editorView:l,cellActionDropdownRef:m}),U=jP(f.outline),V=!Wm(f.output),X=f.consoleOutputs.length>0,Y=r.display.cell_output,G=V&&Y==="above",W=V&&Y==="below",[J,$]=M.useState(!1),[Q,te]=M.useState(!1);(function(re){const{ref:ue,box:le="content-box",skip:je}=re,Se=M.useRef({...b5}),Le=M.useRef(void 0);Le.current=re.onResize,M.useEffect(()=>{if(!ue.current||je||typeof window>"u"||!("ResizeObserver"in window))return;const Ie=new ResizeObserver(([ke])=>{const Ye=le==="border-box"?"borderBoxSize":le==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",Ve=W0(ke,Ye,"inlineSize"),Ke=W0(ke,Ye,"blockSize");if(Se.current.width!==Ve||Se.current.height!==Ke){const ee={width:Ve,height:Ke};Se.current.width=Ve,Se.current.height=Ke,Le.current&&Le.current(ee)}});return Ie.observe(ue.current,{box:le}),()=>{Ie.disconnect()}},[le,ue,je])})({ref:x,skip:!z,onResize:re=>{const ue=re.height&&re.height<68,le=_&&(ue||Y==="below");$(le),U&&le?te(!0):Q&&te(!1)}});const oe=re=>u.jsx(EC,{tooltip:"Edit markdown",className:xe("z-20 relative",re),onClick:k}),ne=V&&u.jsxs("div",{className:"relative",onDoubleClick:B,children:[u.jsx("div",{className:"absolute top-5 -left-8 z-10 print:hidden",children:u.jsx(b_,{isCollapsed:s,onClick:()=>{s?p.expandCell({cellId:n}):p.collapseCell({cellId:n})},canCollapse:U})}),_&&W&&oe("top-3"),u.jsx(Uc,{allowExpand:!0,forceExpand:_,className:"output-area",cellId:n,output:f.output,stale:TC(f,h.edited),loading:Zm(f.status)}),_&&G&&oe("bottom-3")]}),ie=Bc("marimo-cell","hover-actions-parent z-10",{interactive:!0,"needs-run":T,"has-error":f.errored,stopped:f.stopped,disabled:h.config.disabled,stale:f.status==="disabled-transitively",borderless:_&&V&&!A["data-selected"]}),se=Fe(re=>{y({cellId:n,initialPrompt:re.prompt})}),ae=((fe=f.serialization)==null?void 0:fe.toLowerCase())==="valid";return u.jsx(Xm,{children:u.jsx(Ex,{cellId:n,getEditorView:F,children:u.jsxs(Nb,{tabIndex:-1,ref:d,"data-status":f.status,onBlur:O,onKeyDown:R,cellId:n,canMoveX:a,title:h.config.disabled?"This cell is disabled":f.status==="disabled-transitively"?"This cell has a disabled ancestor":void 0,children:[u.jsxs("div",{tabIndex:-1,...A,className:xe(ie,A.className,"focus:ring-1 focus:ring-(--blue-7) focus:ring-offset-0"),ref:x,...dp(n,h.name),children:[Y==="above"&&ne,u.jsxs("div",{className:xe("tray"),"data-hidden":_,children:[u.jsx("div",{className:"absolute right-2 -top-4 z-10",children:u.jsx(Bu,{edited:h.edited,status:f.status,cellConfig:h.config,needsRun:T,hasOutput:V,hasConsoleOutput:X,cellActionDropdownRef:m,cellId:n,name:h.name,getEditorView:F,onRun:w})}),u.jsx(Tb,{cellId:n,className:xe(_&&G&&"-top-7",_&&W&&"-bottom-8",_&&Q&&"-left-[3.8rem]"),actions:p}),u.jsx(Fu,{theme:t,showPlaceholder:e,id:n,code:h.code,config:h.config,status:f.status,serializedEditorState:h.serializedEditorState,runCell:w,setEditorView:c,userConfig:r,editorViewRef:l,editorViewParentRef:g,hidden:!P,hasOutput:V,showHiddenCode:k,languageAdapter:C,setLanguageAdapter:N}),u.jsx(zu,{className:xe(_&&Y==="below"&&"top-14"),edited:h.edited,status:f.status,isCellStatusInline:J,uninstantiated:E,disabled:h.config.disabled,runElapsedTimeMs:f.runElapsedTimeMs,runStartTimestamp:f.runStartTimestamp,lastRunStartTimestamp:f.lastRunStartTimestamp,staleInputs:f.staleInputs,interrupted:f.interrupted}),u.jsx("div",{className:"shoulder-bottom hover-action",children:o&&P&&u.jsx(Cb,{status:f.status,connectionState:b.state,onClick:()=>{I||eo(b.state)||v({cellId:n})}})})]}),Y==="below"&&ne,f.serialization&&u.jsxs("div",{className:"py-1 px-2 flex items-center justify-end gap-2 last:rounded-b",children:[ae&&u.jsx("a",{href:"https://links.marimo.app/reusable-definitions",target:"_blank",className:"hover:underline text-muted-foreground text-xs font-bold",rel:"noopener",children:"reusable"}),u.jsx(Ee,{content:u.jsx("span",{className:"max-w-16 text-xs",children:ae?"This function or class can be imported into other Python notebooks or modules.":u.jsxs(u.Fragment,{children:["This definition can't be reused in other Python modules:",u.jsx("br",{}),u.jsx("br",{}),u.jsx("pre",{children:f.serialization}),u.jsx("br",{}),"Click this icon to learn more."]})}),children:ae?u.jsx("a",{href:"https://links.marimo.app/reusable-definitions",target:"_blank",rel:"noopener",children:u.jsx(Kl,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})}):u.jsx("a",{href:"https://links.marimo.app/reusable-definitions",target:"_blank",rel:"noopener",children:u.jsx(Jm,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})})]}),u.jsx(up,{consoleOutputs:f.consoleOutputs,stale:D,cellName:f.serialization?"_":h.name,onRefactorWithAI:se,onClear:()=>{p.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:(re,ue)=>{p.setStdinResponse({cellId:n,response:re,outputIndex:ue}),j({text:re})},cellId:n,debuggerActive:f.debuggerActive}),u.jsx(v_,{cellId:n})]}),s&&u.jsx(kb,{onClick:()=>p.expandCell({cellId:n}),count:i,cellId:n})]})})})},zu=M.memo(t=>{const e=H.c(19),{className:n,disabled:o,edited:r,interrupted:s,isCellStatusInline:i,lastRunStartTimestamp:a,runElapsedTimeMs:l,runStartTimestamp:c,staleInputs:d,status:h,uninstantiated:f}=t,m=o!==void 0&&o;let g;e[0]!==m||e[1]!==r||e[2]!==s||e[3]!==a||e[4]!==l||e[5]!==c||e[6]!==d||e[7]!==h||e[8]!==f?(g=u.jsx(Y0,{status:h,staleInputs:d,interrupted:s,editing:!0,edited:r,disabled:m,elapsedTime:l,runStartTimestamp:c,uninstantiated:f,lastRunStartTimestamp:a}),e[0]=m,e[1]=r,e[2]=s,e[3]=a,e[4]=l,e[5]=c,e[6]=d,e[7]=h,e[8]=f,e[9]=g):g=e[9];const x=g;let p;e[10]!==n?(p=xe("shoulder-right z-20",n),e[10]=n,e[11]=p):p=e[11];const b=!i&&x;let y;e[12]===Symbol.for("react.memo_cache_sentinel")?(y=u.jsx(Sb,{}),e[12]=y):y=e[12];const v=i&&x;let w,j;return e[13]!==v?(w=u.jsxs("div",{className:"flex gap-2 items-end",children:[y,v]}),e[13]=v,e[14]=w):w=e[14],e[15]!==p||e[16]!==b||e[17]!==w?(j=u.jsxs("div",{className:p,children:[b,w]}),e[15]=p,e[16]=b,e[17]=w,e[18]=j):j=e[18],j});zu.displayName="CellRightSideActions";const Tb=M.memo(t=>{const e=H.c(21),n=Ne(ln),{className:o,actions:r,cellId:s}=t;let i;e[0]!==r||e[1]!==s?(i=w=>{const j=w===void 0?{}:w;return r.createNewCell({cellId:s,before:!1,...j})},e[0]=r,e[1]=s,e[2]=i):i=e[2];const a=Fe(i);let l;e[3]!==r||e[4]!==s?(l=w=>{const j=w===void 0?{}:w;return r.createNewCell({cellId:s,before:!0,...j})},e[3]=r,e[4]=s,e[5]=l):l=e[5];const c=Fe(l),d=MC(n.state);let h,f;e[6]!==o?(h=xe("absolute flex flex-col gap-[2px] justify-center h-full left-[-34px] z-20",o),e[6]=o,e[7]=h):h=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(f=Gt("cell.createAbove"),e[8]=f):f=e[8];const m=d?c:void 0;let g,x,p;e[9]!==n.state||e[10]!==m?(g=u.jsx(jx,{tooltipContent:f,connectionState:n.state,onClick:m}),e[9]=n.state,e[10]=m,e[11]=g):g=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx("div",{className:"flex-1"}),e[12]=x):x=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(p=Gt("cell.createBelow"),e[13]=p):p=e[13];const b=d?a:void 0;let y,v;return e[14]!==n.state||e[15]!==b?(y=u.jsx(jx,{tooltipContent:p,connectionState:n.state,onClick:b}),e[14]=n.state,e[15]=b,e[16]=y):y=e[16],e[17]!==h||e[18]!==g||e[19]!==y?(v=u.jsxs("div",{className:h,children:[g,x,y]}),e[17]=h,e[18]=g,e[19]=y,e[20]=v):v=e[20],v});Tb.displayName="CellLeftSideActions";const Bu=M.memo(t=>{const e=H.c(27),{edited:n,status:o,cellConfig:r,needsRun:s,hasOutput:i,hasConsoleOutput:a,onRun:l,cellActionDropdownRef:c,cellId:d,getEditorView:h,name:f,includeCellActions:m}=t,g=m===void 0||m,x=Ne(ln),p=MC(x.state),b=!s&&"hover-action";let y;e[0]!==b?(y=xe(b),e[0]=b,e[1]=y):y=e[1];const v=p?l:Bn.NOOP;let w,j,C,N;return e[2]!==r||e[3]!==x.state||e[4]!==n||e[5]!==s||e[6]!==o||e[7]!==v?(w=u.jsx(j_,{edited:n,onClick:v,connectionState:x.state,status:o,config:r,needsRun:s}),e[2]=r,e[3]=x.state,e[4]=n,e[5]=s,e[6]=o,e[7]=v,e[8]=w):w=e[8],e[9]!==x.state||e[10]!==o?(j=u.jsx(HN,{status:o,connectionState:x.state}),e[9]=x.state,e[10]=o,e[11]=j):j=e[11],e[12]!==c||e[13]!==r||e[14]!==d||e[15]!==h||e[16]!==a||e[17]!==i||e[18]!==g||e[19]!==f||e[20]!==o?(C=g&&u.jsx(Sx,{ref:c,cellId:d,status:o,getEditorView:h,name:f,config:r,hasOutput:i,hasConsoleOutput:a,children:u.jsx(Us,{variant:"green",tooltip:null,"data-testid":"cell-actions-button",children:u.jsx(qc,{strokeWidth:1.5})})}),e[12]=c,e[13]=r,e[14]=d,e[15]=h,e[16]=a,e[17]=i,e[18]=g,e[19]=f,e[20]=o,e[21]=C):C=e[21],e[22]!==y||e[23]!==w||e[24]!==j||e[25]!==C?(N=u.jsxs(VN,{className:y,children:[w,j,C]}),e[22]=y,e[23]=w,e[24]=j,e[25]=C,e[26]=N):N=e[26],N});Bu.displayName="CellToolbar";const N_=({theme:t,showPlaceholder:e,cellId:n,canDelete:o,userConfig:r,canMoveX:s,editorView:i,setEditorView:a})=>{var k;const l=M.useRef(null),c=Zi(n),d=Qi(n),h=M.useRef(null),f=M.useRef(null),m=Ne(ln),g=lt(),x=nt(),p=Ms(),b=Ct(Ts),y=ud(n),v=c.config.disabled||d.status==="disabled-transitively",w=IC({executionTime:d.runElapsedTimeMs??c.lastExecutionTime,status:d.status,errored:d.errored,interrupted:d.interrupted,stopped:d.stopped}),j=c.edited||d.interrupted||d.staleInputs&&!v,C=d.status==="running"||d.status==="queued",N=(d.status==="queued"||c.edited||d.staleInputs)&&!d.interrupted,S=M.useCallback(()=>i.current,[i]),{isCellCodeShown:E,showHiddenCode:T}=Ib({cellId:n,cellConfig:c.config,languageAdapter:"python",editorView:i}),{closeCompletionHandler:I,resumeCompletionHandler:D}=_b(l,i),F=bb(n,{canMoveX:s,editorView:i,cellActionDropdownRef:h}),O=!Wm(d.output),R=d.consoleOutputs.length>0,P=AC((k=d.output)==null?void 0:k.mimetype),z=Bc("marimo-cell","hover-actions-parent z-10 border shadow-sm","border-(--blue-5)! rounded-sm!",{"needs-run":j,"has-error":d.errored,stopped:d.stopped}),_=Fe(B=>{b({cellId:n,initialPrompt:B.prompt})});return u.jsx(Xm,{children:u.jsx(Ex,{cellId:n,getEditorView:S,children:u.jsxs("div",{"data-status":d.status,ref:l,...lm(F,{className:z,onBlur:I,onKeyDown:D}),...dp(n,c.name),title:c.config.disabled?"This cell is disabled":d.status==="disabled-transitively"?"This cell has a disabled ancestor":void 0,"data-setup-cell":!0,children:[u.jsxs("div",{className:xe("tray"),"data-hidden":!E,children:[u.jsx("div",{className:"absolute right-2 -top-4 z-10",children:u.jsx(Bu,{edited:c.edited,status:d.status,cellConfig:c.config,needsRun:j,hasOutput:O,hasConsoleOutput:R,cellActionDropdownRef:h,cellId:n,name:c.name,getEditorView:S,onRun:y,includeCellActions:!0})}),u.jsx(Fu,{theme:t,showPlaceholder:e,id:n,code:c.code,config:c.config,status:d.status,serializedEditorState:c.serializedEditorState,runCell:y,setEditorView:a,userConfig:r,editorViewRef:i,editorViewParentRef:f,hidden:!E,hasOutput:O,showHiddenCode:T,languageAdapter:"python",setLanguageAdapter:Bn.NOOP,showLanguageToggles:!1}),u.jsx(zu,{edited:c.edited,status:d.status,isCellStatusInline:!1,uninstantiated:w,disabled:c.config.disabled,runElapsedTimeMs:d.runElapsedTimeMs,runStartTimestamp:d.runStartTimestamp,lastRunStartTimestamp:d.lastRunStartTimestamp,staleInputs:d.staleInputs,interrupted:d.interrupted}),u.jsx("div",{className:"shoulder-bottom hover-action",children:o&&u.jsx(Cb,{connectionState:m.state,status:d.status,onClick:()=>{C||eo(m.state)||p({cellId:n})}})})]}),u.jsxs("div",{className:"py-1 px-2 flex justify-end gap-2 last:rounded-b",children:[u.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"setup cell"}),u.jsx(Ee,{content:u.jsxs("span",{className:"max-w-16",children:["This ",u.jsx("b",{children:"setup cell"})," is guaranteed to run before all other cells. Include ",u.jsx("br",{}),"initialization or imports and constants required by top-level functions."]}),children:u.jsx(Jm,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),P&&u.jsx(Uc,{allowExpand:!0,forceExpand:!0,className:"output-area",cellId:n,output:d.output,stale:!1,loading:C}),u.jsx(up,{consoleOutputs:d.consoleOutputs,stale:N,cellName:"_",onRefactorWithAI:_,onClear:()=>{g.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:(B,A)=>{g.setStdinResponse({cellId:n,response:B,outputIndex:A}),x.sendStdin({text:B})},cellId:n,debuggerActive:d.debuggerActive})]})})})},Mb=M.memo(t=>{const{cellId:e,mode:n}=t,o=kP(e);ut.debug("Rendering Cell",e);const r=M.useRef(null);return M.useImperativeHandle(o,()=>({get editorView(){return function(s){const i=s.current;if(i===null)throw new ReferenceError("Attempting to dereference null object.");return i}(r)},get editorViewOrNull(){return r.current}}),[r]),e===na?u.jsx(N_,{...t,cellId:e,editorView:r,setEditorView:s=>{r.current=s}}):n==="edit"?u.jsx(CP,{atoms:[ai],children:u.jsx(S_,{...t,cellId:e,editorView:r,setEditorView:s=>{r.current=s}})}):u.jsx(Ab,{cellId:e})}),E_=(t,e)=>function(n,o){const r=/^(\d+)\.(\d+)\.(\d+)(?:-([\w.-]+))?(?:\+([\w.-]+))?$/,s=i=>{const a=i.match(r);if(!a)return null;const[,l,c,d,h]=a;return{major:Number.parseInt(l,10),minor:Number.parseInt(c,10),patch:Number.parseInt(d,10),preRelease:h||""}};try{const i=s(n),a=s(o);return i&&a?i.major!==a.major?i.major-a.major:i.minor!==a.minor?i.minor-a.minor:i.patch!==a.patch?i.patch-a.patch:i.preRelease===""&&a.preRelease!==""?1:i.preRelease!==""&&a.preRelease===""?-1:i.preRelease.localeCompare(a.preRelease):n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}catch{return n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}}(e,t),Ob=new class{constructor(t){this.ttl=void 0,this.cache=new Map,this.ttl=t.ttl}cleanupExpiredEntries(){const t=Date.now();for(const[e,n]of this.cache.entries())t-n.timestamp>this.ttl&&this.cache.delete(e)}get(t){this.cleanupExpiredEntries();const e=this.cache.get(t);if(e){if(!(Date.now()-e.timestamp>this.ttl))return e.data;this.cache.delete(t)}}set(t,e){this.cache.set(t,{data:e,timestamp:Date.now()})}clear(){this.cache.clear()}}({ttl:3e5}),__=ft({info:ft({provides_extra:at().array().nullable()}),releases:NP(at(),EP())});function Db(t){const e=H.c(5);let n;e[0]!==t?(n=function(i){return i.replaceAll(/\[.*]/g,"").trim()}(t),e[0]=t,e[1]=n):n=e[1];const o=n;let r,s;return e[2]!==o?(r=async()=>{const i=Ob.get(o);if(i)return i;const a=await fetch(`https://pypi.org/pypi/${o}/json`,{method:"GET"});if(!a.ok)throw new Error(`HTTP ${a.status}: ${a.statusText}`);const l=__.transform(I_).parse(await a.json());return Ob.set(o,l),l},s=[o],e[2]=o,e[3]=r,e[4]=s):(r=e[3],s=e[4]),Tn(r,s)}function I_(t){return{versions:Object.keys(t.releases).toSorted(E_),extras:t.info.provides_extra??[]}}function Rb(t){const e=t.match(/^([^[]+)(?:\[([^\]]+)])?$/);if(!e)return{name:t,extras:[]};const[,n,o]=e;return{name:n,extras:o?o.split(",").map(r=>r.trim()):[]}}const A_=()=>{const t=H.c(70),{packageAlert:e}=AF(),{clearPackageAlert:n}=TF(),[o]=xr();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={},t[0]=r):r=t[0];const[s,i]=M.useState(r);let a;t[1]===Symbol.for("react.memo_cache_sentinel")?(a={},t[1]=a):a=t[1];const[l,c]=M.useState(a);if(e===null)return null;const d=o.package_management.manager!=="pixi";if(MF(e)){let h,f,m,g,x,p,b,y,v,w;if(t[2]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[u.jsx(sd,{className:"w-5 h-5 inline-block mr-2"}),"Missing packages"]}),t[2]=h):h=t[2],t[3]!==n||t[4]!==e.id?(f=()=>n(e.id),t[3]=n,t[4]=e.id,t[5]=f):f=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(wn,{className:"w-5 h-5"}),t[6]=m):m=t[6],t[7]!==f?(g=u.jsxs("div",{className:"flex justify-between",children:[h,u.jsx(ve,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:f,children:m})]}),t[7]=f,t[8]=g):g=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx("p",{children:"The following packages were not found:"}),t[9]=x):x=t[9],t[10]!==s||t[11]!==d||t[12]!==e.packages||t[13]!==l){let j;t[15]!==s||t[16]!==d||t[17]!==l?(j=(C,N)=>{const S=Rb(C),E=l[C]||S.extras;return u.jsxs("li",{className:"flex items-center gap-2 font-mono text-sm",children:[u.jsx(Ss,{size:"1rem"}),u.jsx(D_,{packageName:S.name,selectedExtras:E,onExtrasChange:T=>c(I=>({...I,[C]:T}))}),d&&u.jsx(R_,{value:s[C]??"latest",onChange:T=>i(I=>({...I,[C]:T})),packageName:S.name})]},N)},t[15]=s,t[16]=d,t[17]=l,t[18]=j):j=t[18],p=e.packages.map(j),t[10]=s,t[11]=d,t[12]=e.packages,t[13]=l,t[14]=p}else p=t[14];return t[19]!==p?(b=u.jsxs("div",{children:[x,u.jsx("ul",{className:"list-disc ml-4 mt-1",children:p})]}),t[19]=p,t[20]=b):b=t[20],t[21]!==n||t[22]!==s||t[23]!==e.id||t[24]!==e.isolated||t[25]!==e.packages||t[26]!==l||t[27]!==o.package_management.manager?(y=u.jsx("div",{className:"ml-auto flex flex-row items-baseline",children:e.isolated?u.jsxs(u.Fragment,{children:[u.jsx(M_,{manager:o.package_management.manager,packages:e.packages.map(j=>{const C=Rb(j),N=l[j]||C.extras;return function(S,E){return E.length===0?S:`${S}[${E.join(",")}]`}(C.name,N)}),versions:s,clearPackageAlert:()=>n(e.id)}),!tn()&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"px-2 text-sm",children:"with"})," ",u.jsx(O_,{})]})]}):u.jsxs("p",{children:["If you set up a"," ",u.jsx(km,{href:"https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments",children:"virtual environment"}),", marimo can install these packages for you."]})}),t[21]=n,t[22]=s,t[23]=e.id,t[24]=e.isolated,t[25]=e.packages,t[26]=l,t[27]=o.package_management.manager,t[28]=y):y=t[28],t[29]!==b||t[30]!==y?(v=u.jsxs("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:[b,y]}),t[29]=b,t[30]=y,t[31]=v):v=t[31],t[32]!==v||t[33]!==g?(w=u.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-200 opacity-95",children:u.jsxs(oa,{kind:"danger",className:"flex flex-col rounded py-3 px-5 animate-in slide-in-from-left",children:[g,v]})}),t[32]=v,t[33]=g,t[34]=w):w=t[34],w}if(OF(e)){let h;t[35]!==e.packages?(h=function(O){const R=new Set(Object.values(O)),P=R.has("queued")||R.has("installing")?"installing":R.has("failed")?"failed":"installed";return P==="installing"?{status:"installing",title:"Installing packages",titleIcon:u.jsx(da,{className:"w-5 h-5 inline-block mr-2"}),description:"Installing packages:"}:P==="installed"?{status:"installed",title:"All packages installed!",titleIcon:u.jsx(Up,{className:"w-5 h-5 inline-block mr-2"}),description:"Installed packages:"}:{status:"failed",title:"Some packages failed to install",titleIcon:u.jsx(sd,{className:"w-5 h-5 inline-block mr-2"}),description:"See terminal for error logs."}}(e.packages),t[35]=e.packages,t[36]=h):h=t[36];const{status:f,title:m,titleIcon:g,description:x}=h;f==="installed"&&setTimeout(()=>n(e.id),1e4);const p=f==="failed"?"danger":"info";let b,y,v,w,j;t[37]!==m||t[38]!==g?(b=u.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[g,m]}),t[37]=m,t[38]=g,t[39]=b):b=t[39],t[40]!==n||t[41]!==e.id?(y=()=>n(e.id),t[40]=n,t[41]=e.id,t[42]=y):y=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(v=u.jsx(wn,{className:"w-5 h-5"}),t[43]=v):v=t[43],t[44]!==y?(w=u.jsx(ve,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:y,children:v}),t[44]=y,t[45]=w):w=t[45],t[46]!==b||t[47]!==w?(j=u.jsxs("div",{className:"flex justify-between",children:[b,w]}),t[46]=b,t[47]=w,t[48]=j):j=t[48];const C=f==="installed"&&"text-accent-foreground";let N,S,E,T,I,D,F;if(t[49]!==C?(N=xe("flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",C),t[49]=C,t[50]=N):N=t[50],t[51]!==x?(S=u.jsx("p",{children:x}),t[51]=x,t[52]=S):S=t[52],t[53]!==e.packages||t[54]!==f){let O;t[56]!==f?(O=(R,P)=>{const[z,_]=R;return u.jsxs("li",{className:xe("flex items-center gap-1 font-mono text-sm",_==="installing"&&"font-semibold",_==="failed"&&"text-destructive",_==="installed"&&"text-accent-foreground",_==="installed"&&f==="failed"&&"text-muted-foreground"),children:[u.jsx(T_,{status:_}),z]},P)},t[56]=f,t[57]=O):O=t[57],E=Object.entries(e.packages).map(O),t[53]=e.packages,t[54]=f,t[55]=E}else E=t[55];return t[58]!==E?(T=u.jsx("ul",{className:"list-disc ml-4 mt-1",children:E}),t[58]=E,t[59]=T):T=t[59],t[60]!==S||t[61]!==T?(I=u.jsxs("div",{children:[S,T]}),t[60]=S,t[61]=T,t[62]=I):I=t[62],t[63]!==N||t[64]!==I?(D=u.jsx("div",{className:N,children:I}),t[63]=N,t[64]=I,t[65]=D):D=t[65],t[66]!==D||t[67]!==p||t[68]!==j?(F=u.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-200 opacity-95",children:u.jsxs(oa,{kind:p,className:"flex flex-col rounded pt-3 pb-4 px-5",children:[j,D]})}),t[66]=D,t[67]=p,t[68]=j,t[69]=F):F=t[69],F}return hc(e),null},T_=t=>{const e=H.c(4),{status:n}=t;switch(n){case"queued":{let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(Ss,{size:"1rem"}),e[0]=o):o=e[0],o}case"installing":{let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(da,{size:"1rem"}),e[1]=o):o=e[1],o}case"installed":{let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(gc,{size:"1rem"}),e[2]=o):o=e[2],o}case"failed":{let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(wn,{size:"1rem"}),e[3]=o):o=e[3],o}default:return hc(n),null}},M_=t=>{const e=H.c(10),{manager:n,packages:o,versions:r,clearPackageAlert:s}=t,{sendInstallMissingPackages:i}=nt();let a,l,c,d;return e[0]!==s||e[1]!==n||e[2]!==o||e[3]!==i||e[4]!==r?(a=async()=>{s();const h={...r};for(const f of o)h[f]=h[f]??"";await i({manager:n,versions:h}).catch(P_)},e[0]=s,e[1]=n,e[2]=o,e[3]=i,e[4]=r,e[5]=a):a=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(da,{className:"w-4 h-4 mr-2"}),c=u.jsx("span",{className:"font-semibold",children:"Install"}),e[6]=l,e[7]=c):(l=e[6],c=e[7]),e[8]!==a?(d=u.jsxs(ve,{variant:"outline","data-testid":"install-packages-button",size:"sm",onClick:a,children:[l,c]}),e[8]=a,e[9]=d):d=e[9],d},O_=()=>{const t=H.c(17),[e,n]=xr(),{saveUserConfig:o}=nt();let r,s;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=R3(_P),t[0]=r):r=t[0],t[1]!==e?(s={resolver:r,defaultValues:e},t[1]=e,t[2]=s):s=t[2];const i=P3(s);let a;t[3]!==o||t[4]!==n?(a=async m=>{await o({config:m}).then(()=>{n(m)})},t[3]=o,t[4]=n,t[5]=a):a=t[5];const l=a;let c,d,h,f;return t[6]!==i||t[7]!==l?(c=i.handleSubmit(l),t[6]=i,t[7]=l,t[8]=c):c=t[8],t[9]!==i.control?(d=u.jsx("div",{className:"flex flex-col gap-3",children:u.jsx(I3,{control:i.control,name:"package_management.manager",render:F_})}),t[9]=i.control,t[10]=d):d=t[10],t[11]!==c||t[12]!==d?(h=u.jsx("form",{onChange:c,className:"flex flex-col gap-5",children:d}),t[11]=c,t[12]=d,t[13]=h):h=t[13],t[14]!==i||t[15]!==h?(f=u.jsx(IP,{...i,children:h}),t[14]=i,t[15]=h,t[16]=f):f=t[16],f},D_=t=>{const e=H.c(14),{packageName:n,selectedExtras:o,onExtrasChange:r}=t,[s,i]=M.useState(!1),{isPending:a,error:l,data:c}=Db(n);let d;e[0]!==r||e[1]!==o?(d=(x,p)=>{r(p?[...o,x]:o.filter(b=>b!==x))},e[0]=r,e[1]=o,e[2]=d):d=e[2];const h=d,f=!a&&!l;let m,g;if(e[3]!==(c==null?void 0:c.extras)?(m=(c==null?void 0:c.extras)??[],e[3]=c==null?void 0:c.extras,e[4]=m):m=e[4],e[5]!==f||e[6]!==h||e[7]!==s||e[8]!==n||e[9]!==o||e[10]!==m){const x=m.filter(z_);let p;e[12]!==n?(p=u.jsx("span",{className:"shrink-0",children:n}),e[12]=n,e[13]=p):p=e[13],g=u.jsxs("div",{className:"flex items-center max-w-72",children:[p,o.length>0?u.jsxs("span",{className:"flex items-center min-w-0 flex-1",children:[u.jsx("span",{className:"shrink-0",children:"["}),u.jsxs(Eo,{open:s&&f,onOpenChange:b=>{f&&i(b)},children:[u.jsx(_o,{asChild:!0,children:u.jsx("button",{className:"hover:bg-muted/50 rounded text-sm px-1 transition-colors border border-muted-foreground/30 hover:border-muted-foreground/60 min-w-0 flex-1 truncate text-left",title:`Selected extras: ${o.join(", ")}`,children:o.join(",")})}),u.jsxs(Io,{align:"start",className:"w-64 p-0 max-h-96 flex flex-col",children:[o.length>0&&u.jsx("div",{className:"p-2 bg-popover border-b border-border",children:u.jsx("div",{className:"flex flex-wrap gap-1 p-1 min-h-[24px]",children:o.map(b=>u.jsxs("span",{className:"inline-flex items-center gap-1 px-1 py-0.5 text-sm font-mono border border-muted-foreground/30 hover:border-muted-foreground/60 rounded-sm cursor-pointer group transition-colors",onClick:()=>h(b,!1),children:[b,u.jsx(wn,{className:"w-3 h-3 opacity-60 group-hover:opacity-100"})]},b))})}),u.jsx("div",{className:"overflow-y-auto flex-1",children:x.map(b=>u.jsx(OC,{checked:o.includes(b),onCheckedChange:y=>{h(b,y)},className:"font-mono text-sm",onSelect:B_,children:b},b))})]})]}),u.jsx("span",{className:"shrink-0",children:"]"})]}):x.length>0?u.jsxs(Eo,{open:s&&f,onOpenChange:b=>{f&&i(b)},children:[u.jsx(_o,{asChild:!0,children:u.jsx("button",{disabled:!f,className:xe("hover:bg-muted/50 rounded text-sm ml-2 transition-colors border border-muted-foreground/30 hover:border-muted-foreground/60 h-5 w-5 flex items-center justify-center p-0",!f&&"opacity-50 cursor-not-allowed"),title:f?"Add extras":"Loading extras...",children:u.jsx(Jo,{className:"w-3 h-3 shrink-0"})})}),u.jsxs(Io,{align:"start",className:"w-64 p-0 max-h-96 flex flex-col",children:[u.jsx("div",{className:"p-2 bg-popover border-b border-border",children:u.jsx("span",{className:"text-muted-foreground italic text-sm",children:"Package extras"})}),u.jsx("div",{className:"overflow-y-auto flex-1",children:x.map(b=>u.jsx(OC,{checked:o.includes(b),onCheckedChange:y=>{h(b,y)},className:"font-mono text-sm",onSelect:U_,children:b},b))})]})]}):null]}),e[5]=f,e[6]=h,e[7]=s,e[8]=n,e[9]=o,e[10]=m,e[11]=g}else g=e[11];return g},R_=t=>{const e=H.c(16),{value:n,onChange:o,packageName:r}=t,{error:s,isPending:i,data:a}=Db(r);if(s){let h,f,m;return e[0]!==o?(h=g=>o(g.target.value),e[0]=o,e[1]=h):h=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx("option",{value:"latest",children:"latest"}),e[2]=f):f=e[2],e[3]!==h||e[4]!==n?(m=u.jsx(Ee,{content:"Failed to fetch package versions",children:u.jsx(Qm,{value:n,onChange:h,disabled:!0,className:"inline-flex ml-2 w-24 text-ellipsis",children:f})}),e[3]=h,e[4]=n,e[5]=m):m=e[5],m}let l,c,d;return e[6]!==o?(l=h=>o(h.target.value),e[6]=o,e[7]=l):l=e[7],e[8]!==i||e[9]!==a?(c=i?u.jsx("option",{value:"latest",children:"latest"}):["latest",...a.versions.slice(0,100)].map($_),e[8]=i,e[9]=a,e[10]=c):c=e[10],e[11]!==i||e[12]!==l||e[13]!==c||e[14]!==n?(d=u.jsx(Qm,{value:n,onChange:l,disabled:i,className:"inline-flex ml-2 w-24 text-ellipsis",children:c}),e[11]=i,e[12]=l,e[13]=c,e[14]=n,e[15]=d):d=e[15],d};function P_(t){ut.error(t)}function L_(t){return u.jsx("option",{value:t,children:t},t)}function F_(t){const{field:e}=t;return u.jsxs(A3,{children:[u.jsx(T3,{children:u.jsx(Qm,{"data-testid":"install-package-manager-select",onChange:n=>e.onChange(n.target.value),value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:AP.map(L_)})}),u.jsx(D3,{})]})}function z_(t){return!/^(dev|test|testing)$/i.test(t)}function B_(t){return t.preventDefault()}function U_(t){return t.preventDefault()}function $_(t){return u.jsx("option",{value:t,children:t},t)}const V_=t=>{let{transform:e}=t;return{...e,x:0}},H_={threshold:{x:0,y:.1}},W_=q.memo(t=>{const e=H.c(23),{children:n,multiColumn:o}=t,{dropCellOverCell:r,dropCellOverColumn:s,moveColumn:i,compactColumns:a}=lt(),[l,c]=M.useState(null),[d,h]=M.useState(null),[f]=S3();let m;e:{if(f.width==="columns"){m=ep.EMPTY;break e}let O;e[0]===Symbol.for("react.memo_cache_sentinel")?(O=[V_],e[0]=O):O=e[0],m=O}const g=m;let x,p;e[1]===Symbol.for("react.memo_cache_sentinel")?(x={activationConstraint:{distance:8}},e[1]=x):x=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(p={coordinateGetter:UN},e[2]=p):p=e[2];const b=function(){for(var O=arguments.length,R=new Array(O),P=0;P<O;P++)R[P]=arguments[P];return M.useMemo(()=>[...R].filter(z=>z!=null),[...R])}(e1(Fd,x),e1(Pd,p));let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y=O=>{c(O.active.id);const R=bn();h(R.cellIds)},e[3]=y):y=e[3];const v=Fe(y);let w;e[4]!==d?(w=()=>{c(null),h(null)},e[4]=d,e[5]=w):w=e[5];const j=Fe(w);let C;e[6]!==l?(C=O=>{const R=O.droppableContainers.filter(q_);if(l&&Br(l))return Td({...O,droppableContainers:R});const P=(A=>{let{droppableContainers:U,droppableRects:V,pointerCoordinates:X}=A;if(!X)return[];const Y=[];for(const G of U){const{id:W}=G,J=V.get(W);if(J&&sN(X,J)){const $=Id(J).reduce((te,oe)=>te+Ed(X,oe),0),Q=Number(($/4).toFixed(4));Y.push({id:W,data:{droppableContainer:G,value:Q}})}}return Y.sort(_d)})({...O,droppableContainers:R}),z=Ad(P.length>0?P:n1({...O,droppableContainers:R}),"id");if(!z)return[];Un(Br(z),`Expected column id. Got: ${z}`);const _=bn().cellIds.get(z);if(Un(_,`Expected column. Got: ${z}`),_&&_.topLevelIds.length===0)return[{id:z}];const k=new Set(_.topLevelIds),B=Td({...O,droppableContainers:O.droppableContainers.filter(A=>A.id!==z&&k.has(A.id))});if(B.length>0){const A=B[0].id;return Un(Uu(A),`Expected cell id. Got: ${A}`),[{id:A}]}return[]},e[6]=l,e[7]=C):C=e[7];const N=C;let S;e[8]!==r||e[9]!==s||e[10]!==i?(S=O=>{const{active:R,over:P}=O,z=P==null?void 0:P.id;if(z!=null&&R.id!==z){if(Uu(R.id)){if(Br(z))return void s({cellId:R.id,columnId:z});if(Uu(z))return void r({cellId:R.id,overCellId:z})}Br(R.id)&&Br(z)&&i({column:R.id,overColumn:z})}},e[8]=r,e[9]=s,e[10]=i,e[11]=S):S=e[11];const E=Fe(S);let T;e[12]!==a?(T=O=>{const{active:R,over:P}=O;P!==null&&R.id!==P.id&&a()},e[12]=a,e[13]=T):T=e[13];const I=Fe(T),D=o?N:Td;let F;return e[14]!==n||e[15]!==j||e[16]!==I||e[17]!==E||e[18]!==v||e[19]!==g||e[20]!==b||e[21]!==D?(F=u.jsx(_N,{autoScroll:H_,sensors:b,collisionDetection:D,modifiers:g,onDragEnd:I,onDragStart:v,onDragCancel:j,onDragOver:E,children:n}),e[14]=n,e[15]=j,e[16]=I,e[17]=E,e[18]=v,e[19]=g,e[20]=b,e[21]=D,e[22]=F):F=e[22],F});function Uu(t){return typeof t=="string"&&!t.startsWith("tree_")}function Br(t){return typeof t=="string"&&t.startsWith("tree_")}function q_(t){return Br(t.id)}const G_=t=>{const e=H.c(13),{className:n,size:o,gap:r,durationMs:s}=t,i=o===void 0?8:o,a=r===void 0?"gap-1":r,l=s===void 0?1200:s,c=`${l}ms`;let d;e[0]!==c?(d={animationDuration:c},e[0]=c,e[1]=d):d=e[1];const h=d;let f,m,g,x;return e[2]!==n||e[3]!==a?(f=Bc("flex",a,n),e[2]=n,e[3]=a,e[4]=f):f=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(m=[0,1,2],e[5]=m):m=e[5],e[6]!==h||e[7]!==l||e[8]!==i?(g=m.map(p=>u.jsx(TP,{width:i,height:i,className:"fill-current text-current animate-ellipsis-dot",style:{...h,animationDelay:l/3*p+"ms"}},p)),e[6]=h,e[7]=l,e[8]=i,e[9]=g):g=e[9],e[10]!==f||e[11]!==g?(x=u.jsx("div",{className:f,"aria-label":"Loading",children:g}),e[10]=f,e[11]=g,e[12]=x):x=e[12],x},Pb=t=>{const e=H.c(11),{title:n,children:o,show:r,delayMs:s,kind:i}=t,a=s===void 0?2e3:s,l=i===void 0?"info":i;if(!r)return null;let c,d,h;e[0]!==n?(c=n&&u.jsx("div",{className:"flex justify-between",children:u.jsx("span",{className:"font-bold text-lg flex items-center mb-1",children:n})}),e[0]=n,e[1]=c):c=e[1],e[2]!==o?(d=u.jsx("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:u.jsx("div",{children:o})}),e[2]=o,e[3]=d):d=e[3],e[4]!==l||e[5]!==c||e[6]!==d?(h=u.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-1/2 transform -translate-x-1/2 z-200 opacity-95",children:u.jsxs(oa,{kind:l,className:"flex flex-col rounded py-2 px-4 animate-in slide-in-from-top w-fit",children:[c,d]})}),e[4]=l,e[5]=c,e[6]=d,e[7]=h):h=e[7];const f=h;let m;return e[8]!==f||e[9]!==a?(m=u.jsx(zc,{milliseconds:a,children:f}),e[8]=f,e[9]=a,e[10]=m):m=e[10],m},Y_=()=>{const t=H.c(3),e=Ne(MP),n=Ne(OP);let o;return t[0]!==n||t[1]!==e?(o=e&&u.jsxs(u.Fragment,{children:[u.jsx(zc,{milliseconds:1e3,children:u.jsx("div",{className:"absolute top-4 m-0 flex items-center min-h-[28px] left-1/2 transform -translate-x-1/2 z-200 ",children:u.jsx(Ee,{content:"Connecting to a marimo runtime",children:u.jsx("div",{className:"flex items-center",children:u.jsx(G_,{size:5,className:"text-yellow-500"})})})})}),u.jsx(Pb,{show:e,delayMs:5e3,children:u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(kn,{className:"h-4 w-4"}),u.jsx("p",{children:"Connecting to a marimo runtime ..."})]})})]})||n&&u.jsx(Pb,{show:n,kind:"danger",children:u.jsx("div",{className:"flex items-center gap-2",children:u.jsx("p",{children:"Failed to connect."})})}),t[0]=n,t[1]=e,t[2]=o):o=t[2],o},Lb=q.forwardRef((t,e)=>{const n=H.c(71);let o,r,s,i,a,l,c;n[0]!==t?({columnId:i,canDelete:o,canMoveLeft:r,canMoveRight:s,footer:a,...l}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i,n[5]=a,n[6]=l):(o=n[1],r=n[2],s=n[3],i=n[4],a=n[5],l=n[6]),n[7]!==i?(c={id:i},n[7]=i,n[8]=c):c=n[8];const{attributes:d,listeners:h,setNodeRef:f,transform:m,transition:g,isDragging:x,isOver:p}=T1(c);let b;n[9]!==m?(b=m?Ec.Transform.toString({x:m.x,y:0,scaleX:1,scaleY:1}):void 0,n[9]=m,n[10]=b):b=n[10];const y=x?2:void 0;let v;n[11]!==b||n[12]!==y||n[13]!==g?(v={transform:b,transition:g,zIndex:y,position:"relative","--gutter-width":"50px"},n[11]=b,n[12]=y,n[13]=g,n[14]=v):v=n[14];const w=v,{deleteColumn:j,moveColumn:C,addColumn:N}=lt(),S=X_;let E;n[15]!==i||n[16]!==C?(E=()=>C({column:i,overColumn:"_left_"}),n[15]=i,n[16]=C,n[17]=E):E=n[17];const T=!r;let I,D,F;n[18]===Symbol.for("react.memo_cache_sentinel")?(I=u.jsx(j3,{className:"size-4"}),n[18]=I):I=n[18],n[19]!==E||n[20]!==T?(D=u.jsx(Ee,{content:"Move column left",side:"top",delayDuration:300,children:u.jsx(ve,{variant:"text",size:"xs",className:"hover:bg-(--gray-3) aspect-square p-0 w-7 h-7",onClick:E,disabled:T,children:I})}),n[19]=E,n[20]=T,n[21]=D):D=n[21],n[22]!==i||n[23]!==C?(F=()=>C({column:i,overColumn:"_right_"}),n[22]=i,n[23]=C,n[24]=F):F=n[24];const O=!s;let R,P,z,_,k,B;n[25]===Symbol.for("react.memo_cache_sentinel")?(R=u.jsx(Li,{className:"size-4"}),n[25]=R):R=n[25],n[26]!==O||n[27]!==F?(P=u.jsx(Ee,{content:"Move column right",side:"top",delayDuration:300,children:u.jsx(ve,{variant:"text",size:"xs",className:"hover:bg-(--gray-3) aspect-square p-0 w-7 h-7",onClick:F,disabled:O,children:R})}),n[26]=O,n[27]=F,n[28]=P):P=n[28],n[29]===Symbol.for("react.memo_cache_sentinel")?(z=u.jsx(DP,{className:"size-4 opacity-0 group-hover:opacity-50 transition-opacity duration-200"}),n[29]=z):z=n[29],n[30]!==d||n[31]!==h?(_=u.jsx("div",{className:"flex gap-2 h-full grow cursor-grab active:cursor-grabbing items-center justify-center","data-testid":"column-drag-spacer",...d,...h,children:z}),n[30]=d,n[31]=h,n[32]=_):_=n[32],n[33]===Symbol.for("react.memo_cache_sentinel")?(k=u.jsx(_o,{asChild:!0,children:u.jsx(ve,{variant:"text",size:"xs",className:"hover:bg-(--gray-3) aspect-square p-0 w-7 h-7",children:u.jsx(qc,{className:"size-4"})})}),n[33]=k):k=n[33],n[34]!==i||n[35]!==j?(B=()=>j({columnId:i}),n[34]=i,n[35]=j,n[36]=B):B=n[36];const A=!o;let U,V,X,Y,G,W;n[37]===Symbol.for("react.memo_cache_sentinel")?(U=u.jsx(wn,{className:"mr-2 size-4"}),n[37]=U):U=n[37],n[38]!==B||n[39]!==A?(V=u.jsxs(Eo,{children:[k,u.jsx(Io,{align:"end",children:u.jsxs(At,{onClick:B,disabled:A,children:[U,"Delete column"]})})]}),n[38]=B,n[39]=A,n[40]=V):V=n[40],n[41]!==N||n[42]!==i?(X=()=>{N({columnId:i}),requestAnimationFrame(S)},n[41]=N,n[42]=i,n[43]=X):X=n[43],n[44]===Symbol.for("react.memo_cache_sentinel")?(Y=u.jsx(Jo,{className:"size-4"}),n[44]=Y):Y=n[44],n[45]!==X?(G=u.jsx(Ee,{content:"Add column",side:"top",delayDuration:300,children:u.jsx(ve,{variant:"text",size:"xs",className:"hover:bg-(--gray-3) aspect-square p-0 w-7 h-7",onClick:X,children:Y})}),n[45]=X,n[46]=G):G=n[46],n[47]!==P||n[48]!==_||n[49]!==V||n[50]!==G||n[51]!==D?(W=u.jsxs("div",{className:"px-2 pt-3 pb-0 group flex items-center rounded-t-lg overflow-hidden",children:[D,P,_,V,G]}),n[47]=P,n[48]=_,n[49]=V,n[50]=G,n[51]=D,n[52]=W):W=n[52];const J=W;let $;n[53]!==e||n[54]!==f?($=ae=>{ll(e,f)(ae)},n[53]=e,n[54]=f,n[55]=$):$=n[55];const Q=x?"":l.className,te=x?"z-20":"z-1 hover:z-10 focus-within:z-10",oe=p&&"bg-accent/20";let ne,ie,se;return n[56]!==Q||n[57]!==te||n[58]!==oe?(ne=xe(Q,te,oe),n[56]=Q,n[57]=te,n[58]=oe,n[59]=ne):ne=n[59],n[60]!==J||n[61]!==l.children?(ie=u.jsxs("div",{className:"bg-(--slate-1) rounded-lg",children:[J,l.children]}),n[60]=J,n[61]=l.children,n[62]=ie):ie=n[62],n[63]!==a||n[64]!==x||n[65]!==l||n[66]!==w||n[67]!==$||n[68]!==ne||n[69]!==ie?(se=u.jsxs("div",{tabIndex:-1,ref:$,...l,style:w,"data-is-dragging":x,className:ne,children:[ie,a]}),n[63]=a,n[64]=x,n[65]=l,n[66]=w,n[67]=$,n[68]=ne,n[69]=ie,n[70]=se):se=n[70],se});Lb.displayName="SortableColumn";const K_=M.memo(Lb);function X_(){const t=document.getElementById("App");t&&t.scrollTo({left:t.scrollLeft+1e3,behavior:"smooth"})}const{getColumnWidth:J_,saveColumnWidth:Z_}=RP,Fb=M.memo(t=>{const e=H.c(20),n=M.useRef(null);if(t.width==="columns"){const s=t.canDelete,i=t.columnId,a=t.canMoveLeft,l=t.canMoveRight,c=t.footer;let d,h,f,m;return e[0]!==t.index?(d=J_(t.index),e[0]=t.index,e[1]=d):d=e[1],e[2]!==t.index?(h=g=>{Z_(t.index,g)},e[2]=t.index,e[3]=h):h=e[3],e[4]!==t.children||e[5]!==d||e[6]!==h?(f=u.jsx(Q_,{startingWidth:d,onResize:h,children:t.children}),e[4]=t.children,e[5]=d,e[6]=h,e[7]=f):f=e[7],e[8]!==t.canDelete||e[9]!==t.canMoveLeft||e[10]!==t.canMoveRight||e[11]!==t.columnId||e[12]!==t.footer||e[13]!==f?(m=u.jsx(K_,{tabIndex:-1,ref:n,canDelete:s,columnId:i,canMoveLeft:a,canMoveRight:l,className:"group/column",footer:c,children:f}),e[8]=t.canDelete,e[9]=t.canMoveLeft,e[10]=t.canMoveRight,e[11]=t.columnId,e[12]=t.footer,e[13]=f,e[14]=m):m=e[14],m}let o,r;return e[15]!==t.children?(o=u.jsx("div",{"data-testid":"cell-column",className:"flex flex-col gap-5",children:t.children}),e[15]=t.children,e[16]=o):o=e[16],e[17]!==t.footer||e[18]!==o?(r=u.jsxs(u.Fragment,{children:[o,t.footer]}),e[17]=t.footer,e[18]=o,e[19]=r):r=e[19],r});Fb.displayName="Column";const Q_=t=>{const e=H.c(15),{startingWidth:n,onResize:o,children:r}=t;let s;e[0]!==o||e[1]!==n?(s={startingWidth:n,onResize:o},e[0]=o,e[1]=n,e[2]=s):s=e[2];const{resizableDivRef:i,handleRefs:a,style:l}=PP(s),c=e6;let d,h,f,m;return e[3]!==a.left?(d=c(a.left),e[3]=a.left,e[4]=d):d=e[4],e[5]!==r||e[6]!==i||e[7]!==l?(h=u.jsx("div",{ref:i,className:"flex flex-col gap-5 box-content min-h-[100px] px-11 pt-3 pb-6 min-w-[500px] z-1",style:l,children:r}),e[5]=r,e[6]=i,e[7]=l,e[8]=h):h=e[8],e[9]!==a.right?(f=c(a.right),e[9]=a.right,e[10]=f):f=e[10],e[11]!==d||e[12]!==h||e[13]!==f?(m=u.jsxs("div",{className:"flex flex-row",children:[d,h,f]}),e[11]=d,e[12]=h,e[13]=f,e[14]=m):m=e[14],m};function e6(t){return u.jsx("div",{ref:t,className:`w-[3px] cursor-col-resize transition-colors duration-200 z-100
|
|
124
124
|
relative before:content-[''] before:absolute before:inset-y-0 before:-left-[3px]
|
|
125
125
|
before:right-[-3px] before:w-[9px] before:z-[-1]
|
|
126
126
|
hover/column:bg-[var(--slate-3)] dark:hover/column:bg-[var(--slate-5)]
|
|
127
|
-
hover/column:hover:bg-primary/60 dark:hover/column:hover:bg-primary/60`})}const t6=t=>{const e=H.c(10),{width:n}=t,{banners:o}=OF(),{removeBanner:r}=DF();if(o.length===0)return null;const s=n==="columns"&&"sticky left-12 w-full max-w-[80vw]";let i,a,l;if(e[0]!==s?(i=xe("flex flex-col gap-4 mb-5 print:hidden",s),e[0]=s,e[1]=i):i=e[1],e[2]!==o||e[3]!==r){let c;e[5]!==r?(c=d=>u.jsxs(oa,{kind:d.variant||"info",className:"flex flex-col rounded p-3",children:[u.jsxs("div",{className:"flex justify-between",children:[u.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[u.jsx(DC,{className:"w-5 h-5 inline-block mr-2"}),d.title]}),u.jsx(ve,{"data-testid":"remove-banner-button",variant:"text",size:"icon",onClick:()=>r(d.id),children:u.jsx(wn,{className:"w-5 h-5"})})]}),u.jsxs("div",{className:"flex justify-between items-end",children:[u.jsx("span",{children:tp({html:d.description})}),d.action==="restart"&&u.jsx(n6,{})]})]},d.id),e[5]=r,e[6]=c):c=e[6],a=o.map(c),e[2]=o,e[3]=r,e[4]=a}else a=e[4];return e[7]!==i||e[8]!==a?(l=u.jsx("div",{className:i,children:a}),e[7]=i,e[8]=a,e[9]=l):l=e[9],l},n6=()=>{const t=H.c(3),e=Bg();let n,o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=u.jsx(qp,{className:"w-3 h-3 mr-2"}),t[0]=n):n=t[0],t[1]!==e?(o=u.jsxs(ve,{"data-testid":"restart-session-button",variant:"link",size:"xs",onClick:e,children:[n,"Restart"]}),t[1]=e,t[2]=o):o=t[2],o},o6=jt(t=>{const e=t(In);for(const n of e.cellIds.inOrderIds){const o=e.cellRuntime[n];if(o.status==="idle"&&o.consoleOutputs.some(r=>r.channel==="stdin"&&r.response===void 0))return!0}return!1}),r6=()=>{const t=H.c(3),e=s6;if(!Ne(o6))return null;let n,o,r;if(t[0]===Symbol.for("react.memo_cache_sentinel")?(n=u.jsx("div",{className:"flex justify-between",children:u.jsx("span",{className:"font-bold text-lg flex items-center mb-1",children:"Program waiting for input"})}),t[0]=n):n=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(rC,{className:"inline",children:"stdin"}),t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")){const s=u.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-1/2 transform -translate-x-1/2 z-200 opacity-95",children:u.jsxs(oa,{kind:"info",className:"flex flex-col rounded py-2 px-4 animate-in slide-in-from-top w-fit",children:[n,u.jsx("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:u.jsx("div",{children:u.jsxs("p",{children:["The program is still running, but blocked on"," ",o,".",u.jsx(ve,{variant:"link",className:"h-auto font-normal",onClick:e,children:"Jump to the cell"})]})})})]})});r=u.jsx(zc,{milliseconds:2e3,children:s}),t[2]=r}else r=t[2];return r};function s6(){const t=document.querySelector("[data-stdin-blocking]");t?(t.scrollIntoView({behavior:"smooth",block:"center"}),requestAnimationFrame(()=>{t.focus()})):ut.error("No element with data-stdin-blocking found")}function i6(){const t=setTimeout(a6,100);return()=>clearTimeout(t)}function a6(){requestAnimationFrame(l6)}function l6(){const t=function(e){const n=e.match(/scrollTo=([^&]+)/),o=n==null?void 0:n[1];return o?decodeURIComponent(o.split("&")[0]):null}(window.location.hash);if(t)(function(e){var o,r;if(Bb)return;const n=document.querySelector(`[data-cell-name="${e}"]`);if(n){if(n.scrollIntoView({behavior:"smooth",block:"start"}),Bb=!0,n instanceof HTMLElement){n.focus();const{cellHandles:s}=bn(),i=n.dataset.cellId;if(!i)return void ut.error(`Missing cellId for cell with name ${e}`);const a=(r=(o=s[i])==null?void 0:o.current)==null?void 0:r.editorView;a&&a.focus()}}else ut.warn(`Cannot focus cell with name ${e} because it was not found`),zb()})(t);else try{zb()}catch(e){const n=e;ut.warn("Error focusing first editor",n)}}function zb(){var o,r;const{cellIds:t,cellData:e,cellHandles:n}=bn();for(const s of t.iterateTopLevelIds){const i=n[s];if(!((o=e[s])==null?void 0:o.config.hide_code)&&((r=i==null?void 0:i.current)!=null&&r.editorView))return void i.current.editorView.focus()}}let Bb=!1;const c6=t=>{const e=H.c(8),n=Ne(LP),o=t.appConfig.width==="columns";let r,s,i;return e[0]!==t?(r=u.jsx(d6,{...t}),e[0]=t,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(s=u.jsx(I1,{id:"column-container",items:n,strategy:ON,children:r}),e[2]=n,e[3]=r,e[4]=s):s=e[4],e[5]!==o||e[6]!==s?(i=u.jsx(W_,{multiColumn:o,children:s}),e[5]=o,e[6]=s,e[7]=i):i=e[7],i},d6=t=>{const e=H.c(26),{mode:n,userConfig:o,appConfig:r}=t,s=lt(),{theme:i}=vr(),{toggleSidebarPanel:a}=Ui();RC(i6),Dt("global.focusTop",s.focusTopCell),Dt("global.focusBottom",s.focusBottomCell),Dt("global.toggleSidebar",a),Dt("global.foldCode",s.foldAll),Dt("global.unfoldCode",s.unfoldAll),Dt("global.formatAll",f6),Dt("cell.hideCode",Bn.NOOP),Dt("cell.format",Bn.NOOP);const l=wr(),c=FP(),d=l.getColumnIds(),h=s.scrollToTarget;let f,m;e[0]!==c||e[1]!==h?(f=()=>{c!==null&&h()},e[0]=c,e[1]=h,e[2]=f):f=e[2],e[3]!==l||e[4]!==c||e[5]!==h?(m=[l,c,h],e[3]=l,e[4]=c,e[5]=h,e[6]=m):m=e[6],M.useEffect(f,m);const g=RF;let x,p,b,y;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx(A_,{}),p=u.jsx(r6,{}),b=u.jsx(Y_,{}),e[7]=x,e[8]=p,e[9]=b):(x=e[7],p=e[8],b=e[9]),e[10]!==r.width?(y=u.jsx(t6,{width:r.width}),e[10]=r.width,e[11]=y):y=e[11];const v=r.width==="columns"&&"grid grid-flow-col auto-cols-min gap-6";let w;e[12]!==v?(w=xe(v),e[12]=v,e[13]=w):w=e[13];const j=d.map((E,T)=>u.jsx(u6,{columnId:E,index:T,columnsLength:d.length,appConfig:r,mode:n,userConfig:o,theme:i},E));let C,N,S;return e[14]!==w||e[15]!==j?(C=u.jsx("div",{className:w,children:j}),e[14]=w,e[15]=j,e[16]=C):C=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(N=u.jsx(PF,{}),e[17]=N):N=e[17],e[18]!==g||e[19]!==r||e[20]!==C||e[21]!==x||e[22]!==p||e[23]!==b||e[24]!==y?(S=u.jsxs(g,{className:"pb-[40vh]",invisible:!1,appConfig:r,innerClassName:"pr-4",children:[x,p,b,y,C,N]}),e[18]=g,e[19]=r,e[20]=C,e[21]=x,e[22]=p,e[23]=b,e[24]=y,e[25]=S):S=e[25],S},u6=t=>{const e=H.c(54),{columnId:n,index:o,columnsLength:r,appConfig:s,mode:i,userConfig:a,theme:l}=t,c=wr();let d,h,f,m,g,x,p,b,y,v,w,j,C,N,S,E;if(e[0]!==s.width||e[1]!==c||e[2]!==n||e[3]!==r||e[4]!==o||e[5]!==i||e[6]!==l||e[7]!==a){const T=c.get(n);let I;Un(T,`Expected column for: ${n}`),e[22]!==c?(I=c.hasOnlyOneId(),e[22]=c,e[23]=I):I=e[23];const D=I;let F;e[24]!==c.inOrderIds?(F=c.inOrderIds.includes(na),e[24]=c.inOrderIds,e[25]=F):F=e[25];const O=F;h=Fb,w=n,j=o,C=o>0,N=o<r-1,m=s.width,g=r>1;const R=s.width==="columns"&&"opacity-0 group-hover/column:opacity-100";let P;e[26]!==R?(P=xe(R),e[26]=R,e[27]=P):P=e[27],e[28]!==n||e[29]!==P?(x=u.jsx(h6,{columnId:n,className:P}),e[28]=n,e[29]=P,e[30]=x):x=e[30],d=I1,f=`column-${o+1}`,p=T.topLevelIds,b=DN,e[31]!==O||e[32]!==o||e[33]!==i||e[34]!==l||e[35]!==a?(y=o===0&&O&&u.jsx(Mb,{cellId:na,theme:l,showPlaceholder:!1,canDelete:!0,mode:i,userConfig:a,isCollapsed:!1,collapseCount:0,canMoveX:!1},na),e[31]=O,e[32]=o,e[33]=i,e[34]=l,e[35]=a,e[36]=y):y=e[36],v=T.topLevelIds.map(z=>z===na?null:u.jsx(Mb,{cellId:z,theme:l,showPlaceholder:D,canDelete:!D,mode:i,userConfig:a,isCollapsed:T.isCollapsed(z),collapseCount:T.getCount(z),canMoveX:s.width==="columns"},z)),e[0]=s.width,e[1]=c,e[2]=n,e[3]=r,e[4]=o,e[5]=i,e[6]=l,e[7]=a,e[8]=d,e[9]=h,e[10]=f,e[11]=m,e[12]=g,e[13]=x,e[14]=p,e[15]=b,e[16]=y,e[17]=v,e[18]=w,e[19]=j,e[20]=C,e[21]=N}else d=e[8],h=e[9],f=e[10],m=e[11],g=e[12],x=e[13],p=e[14],b=e[15],y=e[16],v=e[17],w=e[18],j=e[19],C=e[20],N=e[21];return e[37]!==d||e[38]!==f||e[39]!==p||e[40]!==b||e[41]!==y||e[42]!==v?(S=u.jsxs(d,{id:f,items:p,strategy:b,children:[y,v]}),e[37]=d,e[38]=f,e[39]=p,e[40]=b,e[41]=y,e[42]=v,e[43]=S):S=e[43],e[44]!==h||e[45]!==m||e[46]!==g||e[47]!==x||e[48]!==S||e[49]!==w||e[50]!==j||e[51]!==C||e[52]!==N?(E=u.jsx(h,{columnId:w,index:j,canMoveLeft:C,canMoveRight:N,width:m,canDelete:g,footer:x,children:S}),e[44]=h,e[45]=m,e[46]=g,e[47]=x,e[48]=S,e[49]=w,e[50]=j,e[51]=C,e[52]=N,e[53]=E):E=e[53],E},h6=t=>{const e=H.c(17),{columnId:n,className:o}=t,{createNewCell:r}=lt(),[s,i]=zP(!1),a=Ne(Ql),l=Ne(Z3);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=xe("mb-0 rounded-none sm:px-4 md:px-5 lg:px-8 tracking-wide no-wrap whitespace-nowrap","hover:bg-accent hover:text-accent-foreground font-semibold uppercase text-xs"),e[0]=c):c=e[0];const d=c;let h;e[1]!==a||e[2]!==n||e[3]!==r||e[4]!==s||e[5]!==i.toggle||e[6]!==l?(h=()=>s?u.jsx(BP,{onClose:i.toggle}):u.jsxs(u.Fragment,{children:[u.jsxs(ve,{className:d,variant:"text",size:"sm",disabled:!l,onClick:()=>r({cellId:{type:"__end__",columnId:n},before:!1}),children:[u.jsx(Kp,{className:"mr-2 size-4 shrink-0"}),"Python"]}),u.jsxs(ve,{className:d,variant:"text",size:"sm",disabled:!l,onClick:()=>{Jn({autoInstantiate:!0,createNewCell:r}),r({cellId:{type:"__end__",columnId:n},before:!1,code:new Bi().defaultCode,hideCode:!0})},children:[u.jsx(Zp,{className:"mr-2 size-4 shrink-0"}),"Markdown"]}),u.jsxs(ve,{className:d,variant:"text",size:"sm",disabled:!l,onClick:()=>{Jn({autoInstantiate:!0,createNewCell:r}),r({cellId:{type:"__end__",columnId:n},before:!1,code:new Rc().defaultCode})},children:[u.jsx(Yo,{className:"mr-2 size-4 shrink-0"}),"SQL"]}),u.jsx(Ee,{content:a?null:u.jsx("span",{children:"Enable via settings under AI Assist"}),delayDuration:100,asChild:!1,children:u.jsxs(ve,{className:d,variant:"text",size:"sm",disabled:!a||!l,onClick:i.toggle,children:[u.jsx(Pi,{className:"mr-2 size-4 shrink-0"}),"Generate with AI"]})})]}),e[1]=a,e[2]=n,e[3]=r,e[4]=s,e[5]=i.toggle,e[6]=l,e[7]=h):h=e[7];const f=h,m=!s&&"w-fit",g=s&&"opacity-100 w-full max-w-4xl shadow-lg shadow-(color:--blue-3)";let x,p,b;return e[8]!==o||e[9]!==m||e[10]!==g?(x=xe("shadow-sm border border-border rounded transition-all duration-200 overflow-hidden divide-x divide-border flex",m,g,o),e[8]=o,e[9]=m,e[10]=g,e[11]=x):x=e[11],e[12]!==f?(p=f(),e[12]=f,e[13]=p):p=e[13],e[14]!==x||e[15]!==p?(b=u.jsx("div",{className:"flex justify-center mt-4 pt-6 pb-32 group gap-4 w-full print:hidden",children:u.jsx("div",{className:x,children:p})}),e[14]=x,e[15]=p,e[16]=b):b=e[16],b};function f6(){X3()}const m6=UP(t=>sC().syncCellIds(t),400),p6=(t,e)=>{Qe.get(ds)||t.isEmpty()||e.isEmpty()||Vi(t.inOrderIds,e.inOrderIds)||m6({cell_ids:t.inOrderIds})},Ub=t=>{const e=H.c(70),{userConfig:n,appConfig:o,hideControls:r}=t,s=r!==void 0&&r;$P(ta,p6);const{setCells:i,mergeAllColumns:a,collapseAllCells:l,expandAllCells:c}=lt(),d=Ne(cm),h=Ne(VP),f=Ne(HP),m=Nm(),g=Ct(kd),{sendComponentValues:x,sendInterrupt:p}=nt(),b=d.mode==="edit",y=d.mode==="present",v=Ne(WP);let w,j;e[0]!==x?(w=()=>(Nj.INSTANCE.start(x),g6),e[0]=x,e[1]=w):w=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[2]=j):j=e[2],M.useEffect(w,j);const C=n.runtime.auto_instantiate;let N,S,E;e[3]!==i||e[4]!==g?(N=(ae,fe)=>{i(ae);const re=ae.map(x6),ue=ae.map(b6),le=ae.map(y6);g({names:re,codes:ue,configs:le,layout:fe})},e[3]=i,e[4]=g,e[5]=N):N=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(S=gC(),e[6]=S):S=e[6],e[7]!==N||e[8]!==n.runtime.auto_instantiate?(E={autoInstantiate:C,setCells:N,sessionId:S},e[7]=N,e[8]=n.runtime.auto_instantiate,e[9]=E):E=e[9];const{connection:T}=LF(E);let I,D;e[10]!==o.app_title||e[11]!==m?(I=()=>{document.title=o.app_title||yn.basename(m??"")||"Untitled Notebook"},D=[o.app_title,m],e[10]=o.app_title,e[11]=m,e[12]=I,e[13]=D):(I=e[12],D=e[13]),M.useEffect(I,D);const F=Nc(o.width);let O,R;e[14]!==o.width||e[15]!==a||e[16]!==F?(O=()=>{F==="columns"&&o.width!=="columns"&&a()},e[14]=o.width,e[15]=a,e[16]=F,e[17]=O):O=e[17],e[18]!==o.width||e[19]!==a||e[20]!==h||e[21]!==F?(R=[o.width,F,a,h],e[18]=o.width,e[19]=a,e[20]=h,e[21]=F,e[22]=R):R=e[22],M.useEffect(O,R);const P=function(){const ae=H.c(2),fe=Is();let re;return ae[0]!==fe?(re=()=>fe(VO(bn())),ae[0]=fe,ae[1]=re):re=ae[1],Fe(re)}(),z=ag(),_=ig();let k,B,A,U,V,X,Y;e[23]!==P?(k=()=>{P()},e[23]=P,e[24]=k):k=e[24],Dt("global.runStale",k),e[25]!==p?(B=()=>{p()},e[25]=p,e[26]=B):B=e[26],Dt("global.interrupt",B),e[27]!==_?(A=()=>{_()},e[27]=_,e[28]=A):A=e[28],Dt("global.hideCode",A),e[29]!==z?(U=()=>{z()},e[29]=z,e[30]=U):U=e[30],Dt("global.runAll",U),e[31]!==l?(V=()=>{l()},e[31]=l,e[32]=V):V=e[32],Dt("global.collapseAllSections",V),e[33]!==c?(X=()=>{c()},e[33]=c,e[34]=X):X=e[34],Dt("global.expandAllSections",X),e[35]!==o||e[36]!==n||e[37]!==d.mode?(Y=u.jsx(c6,{mode:d.mode,userConfig:n,appConfig:o}),e[35]=o,e[36]=n,e[37]=d.mode,e[38]=Y):Y=e[38];const G=Y,W=o.width;let J,$,Q,te,oe,ne,ie,se;return e[39]===Symbol.for("react.memo_cache_sentinel")?(J=xe("pt-4 sm:pt-12 pb-2 mb-4 print:hidden z-50","sticky left-0"),e[39]=J):J=e[39],e[40]!==m||e[41]!==b?($=b&&u.jsx("div",{className:"flex items-center justify-center container",children:u.jsx(P4,{filename:m})}),e[40]=m,e[41]=b,e[42]=$):$=e[42],e[43]!==T||e[44]!==$?(Q=u.jsx(zF,{connection:T,className:J,children:$}),e[43]=T,e[44]=$,e[45]=Q):Q=e[45],e[46]!==o||e[47]!==G||e[48]!==f||e[49]!==d.mode?(te=f&&u.jsx(FF,{appConfig:o,mode:d.mode,children:G}),e[46]=o,e[47]=G,e[48]=f,e[49]=d.mode,e[50]=te):te=e[50],e[51]!==o.width||e[52]!==T||e[53]!==v||e[54]!==Q||e[55]!==te?(oe=u.jsxs(BF,{connection:T,isRunning:v,width:W,children:[Q,te]}),e[51]=o.width,e[52]=T,e[53]=v,e[54]=Q,e[55]=te,e[56]=oe):oe=e[56],e[57]===Symbol.for("react.memo_cache_sentinel")?(ne=u.jsx(G4,{}),e[57]=ne):ne=e[57],e[58]!==o||e[59]!==T||e[60]!==s||e[61]!==y||e[62]!==v||e[63]!==P||e[64]!==p||e[65]!==_?(ie=!s&&u.jsx($c,{children:u.jsx(T4,{presenting:y,onTogglePresenting:_,onInterrupt:p,onRun:P,connectionState:T.state,running:v,appConfig:o})}),e[58]=o,e[59]=T,e[60]=s,e[61]=y,e[62]=v,e[63]=P,e[64]=p,e[65]=_,e[66]=ie):ie=e[66],e[67]!==oe||e[68]!==ie?(se=u.jsxs(u.Fragment,{children:[oe,ne,ie]}),e[67]=oe,e[68]=ie,e[69]=se):se=e[69],se};function g6(){Nj.INSTANCE.stop()}function x6(t){return t.name}function b6(t){return t.code}function y6(t){return t.config}const $b=t=>Ne(qP)[t.capability]?t.children:null,mn=M.forwardRef((t,e)=>{const n=H.c(18);let o,r,s,i,a;n[0]!==t?({children:o,tooltip:a,selected:i,className:r,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i,n[5]=a):(o=n[1],r=n[2],s=n[3],i=n[4],a=n[5]);const l=!i&&"hover:bg-(--sage-3)",c=i&&"bg-(--sage-4)";let d,h;n[6]!==r||n[7]!==l||n[8]!==c?(d=xe("h-full flex items-center p-2 text-sm shadow-inset font-mono cursor-pointer rounded",l,c,r),n[6]=r,n[7]=l,n[8]=c,n[9]=d):d=n[9],n[10]!==o||n[11]!==e||n[12]!==s||n[13]!==d?(h=u.jsx("div",{ref:e,className:d,...s,children:o}),n[10]=o,n[11]=e,n[12]=s,n[13]=d,n[14]=h):h=n[14];const f=h;if(a){let m;return n[15]!==f||n[16]!==a?(m=u.jsx(Ee,{content:a,side:"top",delayDuration:200,children:f}),n[15]=f,n[16]=a,n[17]=m):m=n[17],m}return f});mn.displayName="FooterItem";const v6=()=>{var m,g;const t=H.c(17),e=Ne(PC),n=Ne(Ql),o=((m=e==null?void 0:e.models)==null?void 0:m.chat_model)||LC,r=((g=e==null?void 0:e.models)==null?void 0:g.edit_model)||o,{handleClick:s}=ia();if(!n){let x,p,b;return t[0]!==s?(x=()=>s("ai"),t[0]=s,t[1]=x):x=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(Pi,{className:"h-4 w-4 opacity-60"}),t[2]=p):p=t[2],t[3]!==x?(b=u.jsx(mn,{tooltip:"Assist is disabled",selected:!1,onClick:x,"data-testid":"footer-ai-disabled",children:p}),t[3]=x,t[4]=b):b=t[4],b}let i,a,l,c,d,h,f;return t[5]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx("b",{children:"Chat model:"}),t[5]=i):i=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx("br",{}),l=u.jsx("b",{children:"Edit model:"}),t[6]=a,t[7]=l):(a=t[6],l=t[7]),t[8]!==o||t[9]!==r?(c=u.jsxs(u.Fragment,{children:[i," ",o,a,l," ",r]}),t[8]=o,t[9]=r,t[10]=c):c=t[10],t[11]!==s?(d=()=>s("ai"),t[11]=s,t[12]=d):d=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(Pi,{className:"h-4 w-4"}),t[13]=h):h=t[13],t[14]!==c||t[15]!==d?(f=u.jsx(mn,{tooltip:c,onClick:d,selected:!1,"data-testid":"footer-ai-enabled",children:h}),t[14]=c,t[15]=d,t[16]=f):f=t[16],f},w6=()=>{const t=H.c(26),e=Ne(ln).state,n=Km();let o,r;t[0]!==e||t[1]!==n?(o=async()=>{if(e===Bt.OPEN){if(tn())return{isHealthy:!0,lastChecked:new Date,error:void 0};try{return{isHealthy:await n.isHealthy(),lastChecked:new Date,error:void 0}}catch(w){const j=w;return{isHealthy:!1,lastChecked:new Date,error:j instanceof Error?j.message:"Unknown error"}}}},r=[n,e],t[0]=e,t[1]=n,t[2]=o,t[3]=r):(o=t[2],r=t[3]);const{isFetching:s,error:i,data:a,refetch:l}=Tn(o,r),c=e===Bt.OPEN?3e4:null;let d,h;t[4]!==c?(d={delayMs:c,whenVisible:!0},t[4]=c,t[5]=d):d=t[5],sa(l,d),t[6]!==e||t[7]!==a||t[8]!==i?(h=()=>[Sm(e.toLowerCase()),a!=null&&a.lastChecked?a.isHealthy?"\u2713 Healthy":"\u2717 Unhealthy":"Health: Unknown",i?`Error: ${i}`:""].filter(Boolean).join(`
|
|
128
|
-
`),t[6]=e,t[7]=a,t[8]=i,t[9]=h):h=t[9];const f=h;let m;t[10]!==e||t[11]!==(a==null?void 0:a.isHealthy)||t[12]!==(a==null?void 0:a.lastChecked)||t[13]!==s?(m=()=>s||e===Bt.CONNECTING?u.jsx(kn,{size:"small"}):e===Bt.CLOSING?u.jsx(kn,{className:"text-destructive",size:"small"}):e===Bt.OPEN?a!=null&&a.isHealthy?u.jsx(Yc,{className:"w-4 h-4 text-(--green-9)"}):a!=null&&a.lastChecked?u.jsx(DC,{className:"w-4 h-4 text-(--yellow-9)"}):u.jsx(Yc,{className:"w-4 h-4"}):u.jsx(aa,{className:"w-4 h-4 text-red-500"}),t[10]=e,t[11]=a==null?void 0:a.isHealthy,t[12]=a==null?void 0:a.lastChecked,t[13]=s,t[14]=m):m=t[14];const g=m,x=f();let p,b,y,v;return t[15]!==e?(p=e===Bt.OPEN&&u.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Click to refresh health status"}),t[15]=e,t[16]=p):p=t[16],t[17]!==x||t[18]!==p?(b=u.jsxs("div",{className:"text-sm whitespace-pre-line",children:[x,p]}),t[17]=x,t[18]=p,t[19]=b):b=t[19],t[20]!==g?(y=g(),t[20]=g,t[21]=y):y=t[21],t[22]!==l||t[23]!==b||t[24]!==y?(v=u.jsx(mn,{tooltip:b,selected:!1,onClick:l,"data-testid":"footer-backend-status",children:y}),t[22]=l,t[23]=b,t[24]=y,t[25]=v):v=t[25],v},k6=t=>{const e=H.c(3);let n,o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=u.jsx("path",{d:"M205.28 31.36c14.096 14.88 20.016 35.2 22.512 63.68c6.626 0 12.805 1.47 16.976 7.152l7.792 10.56A17.55 17.55 0 0 1 256 123.2v28.688c-.008 3.704-1.843 7.315-4.832 9.504C215.885 187.222 172.35 208 128 208c-49.066 0-98.19-28.273-123.168-46.608c-2.989-2.189-4.825-5.8-4.832-9.504V123.2c0-3.776 1.2-7.424 3.424-10.464l7.792-10.544c4.173-5.657 10.38-7.152 16.992-7.152c2.496-28.48 8.4-48.8 22.512-63.68C77.331 3.165 112.567.06 127.552 0H128c14.72 0 50.4 2.88 77.28 31.36m-77.264 47.376c-3.04 0-6.544.176-10.272.544c-1.312 4.896-3.248 9.312-6.08 12.128c-11.2 11.2-24.704 12.928-31.936 12.928c-6.802 0-13.927-1.42-19.744-5.088c-5.502 1.808-10.786 4.415-11.136 10.912c-.586 12.28-.637 24.55-.688 36.824c-.026 6.16-.05 12.322-.144 18.488c.024 3.579 2.182 6.903 5.44 8.384C79.936 185.92 104.976 192 128.016 192c23.008 0 48.048-6.08 74.512-18.144c3.258-1.48 5.415-4.805 5.44-8.384c.317-18.418.062-36.912-.816-55.312h.016c-.342-6.534-5.648-9.098-11.168-10.912c-5.82 3.652-12.927 5.088-19.728 5.088c-7.232 0-20.72-1.728-31.936-12.928c-2.832-2.816-4.768-7.232-6.08-12.128a106 106 0 0 0-10.24-.544m-26.941 43.93c5.748 0 10.408 4.66 10.408 10.409v19.183c0 5.749-4.66 10.409-10.408 10.409s-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408m53.333 0c5.749 0 10.409 4.66 10.409 10.409v19.183c0 5.749-4.66 10.409-10.409 10.409c-5.748 0-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408M81.44 28.32c-11.2 1.12-20.64 4.8-25.44 9.92c-10.4 11.36-8.16 40.16-2.24 46.24c4.32 4.32 12.48 7.2 21.28 7.2c6.72 0 19.52-1.44 30.08-12.16c4.64-4.48 7.52-15.68 7.2-27.04c-.32-9.12-2.88-16.64-6.72-19.84c-4.16-3.68-13.6-5.28-24.16-4.32m68.96 4.32c-3.84 3.2-6.4 10.72-6.72 19.84c-.32 11.36 2.56 22.56 7.2 27.04c10.56 10.72 23.36 12.16 30.08 12.16c8.8 0 16.96-2.88 21.28-7.2c5.92-6.08 8.16-34.88-2.24-46.24c-4.8-5.12-14.24-8.8-25.44-9.92c-10.56-.96-20 .64-24.16 4.32M128 56c-2.56 0-5.6.16-8.96.48c.32 1.76.48 3.68.64 5.76c0 1.44 0 2.88-.16 4.48c3.2-.32 5.92-.32 8.48-.32s5.28 0 8.48.32c-.16-1.6-.16-3.04-.16-4.48c.16-2.08.32-4 .64-5.76c-3.36-.32-6.4-.48-8.96-.48"}),e[0]=n):n=e[0],e[1]!==t?(o=u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.24em",height:"1em",viewBox:"0 0 256 208",fill:"currentColor",...t,children:n}),e[1]=t,e[2]=o):o=e[2],o},C6=jt(t=>t(GP).completion.copilot),j6=()=>{const t=H.c(1);if(Ne(C6)==="github"){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(S6,{}),t[0]=e):e=t[0],e}return null},Vb=ut.get("[copilot-status-bar]"),S6=()=>{const t=Ne(gj),e=Ne(wF)!==null,{handleClick:n}=ia(),o=()=>n("ai"),r=t?"Ready":"Not connected",s=Ct(gj),i=Ct(kF);return RC(()=>{const a=pj();let l=!0;return(async()=>{try{if(await a.initializePromise.catch(d=>{throw Vb.error("Failed to initialize",d),a.close(),d}),!l)return;const c=await a.signedIn();if(!l)return;s(c),i(c?"signedIn":"signedOut")}catch(c){if(!l)return;Vb.warn("Connection failed",c),s(!1),i("connectionError"),Je({title:"GitHub Copilot Connection Error",description:"Failed to connect to GitHub Copilot. Check settings and try again.",variant:"danger",action:u.jsx(ve,{variant:"link",onClick:o,children:"Settings"})})}})(),()=>{l=!1}}),u.jsx(mn,{tooltip:u.jsxs(u.Fragment,{children:[u.jsx("b",{children:"GitHub Copilot:"})," ",r]}),selected:!1,onClick:o,"data-testid":"footer-copilot-status",children:u.jsx("span",{children:e?u.jsx(kn,{className:"h-4 w-4"}):u.jsx(k6,{className:xe("h-4 w-4",!t&&"opacity-60")})})})},N6=()=>{const t=H.c(18),[e,n]=M.useState(0),o=Ne(ln),{getUsageStats:r}=nt();let s,i,a,l;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>n(A6),i={delayMs:1e4,whenVisible:!0},t[0]=s,t[1]=i):(s=t[0],i=t[1]),sa(s,i),t[2]!==o.state||t[3]!==r?(a=async()=>tn()||o.state!==Bt.OPEN?null:r(),t[2]=o.state,t[3]=r,t[4]=a):a=t[4],t[5]!==o.state||t[6]!==e?(l=[e,o.state],t[5]=o.state,t[6]=e,t[7]=l):l=t[7];const{data:c}=Tn(a,l);let d,h,f,m;return t[8]!==c?(d=(c==null?void 0:c.gpu)&&c.gpu.length>0&&u.jsx(I6,{gpus:c.gpu}),t[8]=c,t[9]=d):d=t[9],t[10]!==c?(h=c&&u.jsx(E6,{memory:c.memory,kernel:c.kernel,server:c.server}),t[10]=c,t[11]=h):h=t[11],t[12]!==c?(f=c&&u.jsx(_6,{cpu:c.cpu}),t[12]=c,t[13]=f):f=t[13],t[14]!==d||t[15]!==h||t[16]!==f?(m=u.jsxs("div",{className:"flex gap-2 items-center px-1",children:[d,h,f]}),t[14]=d,t[15]=h,t[16]=f,t[17]=m):m=t[17],m},E6=t=>{const e=H.c(25),{memory:n,kernel:o,server:r}=t,{percent:s,total:i,available:a}=n;let l;e[0]!==s?(l=Math.round(s),e[0]=s,e[1]=l):l=e[1];const c=l;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx("b",{children:"computer memory:"}),e[2]=d):d=e[2];const h=i-a;let f,m,g,x,p,b,y,v,w;return e[3]!==h?(f=Vu(h),e[3]=h,e[4]=f):f=e[4],e[5]!==i?(m=Vu(i),e[5]=i,e[6]=m):m=e[6],e[7]!==c||e[8]!==f||e[9]!==m?(g=u.jsxs("span",{children:[d," ",f," / ",m," GB (",c,"%)"]}),e[7]=c,e[8]=f,e[9]=m,e[10]=g):g=e[10],e[11]!==r?(x=(r==null?void 0:r.memory)&&u.jsxs("span",{children:[u.jsx("b",{children:"marimo server:"})," ",ml(r.memory)]}),e[11]=r,e[12]=x):x=e[12],e[13]!==o?(p=(o==null?void 0:o.memory)&&u.jsxs("span",{children:[u.jsx("b",{children:"kernel:"})," ",ml(o.memory)]}),e[13]=o,e[14]=p):p=e[14],e[15]!==g||e[16]!==x||e[17]!==p?(b=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,x,p]}),e[15]=g,e[16]=x,e[17]=p,e[18]=b):b=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?(y=u.jsx(Lp,{className:"w-4 h-4"}),e[19]=y):y=e[19],e[20]!==c?(v=u.jsxs("div",{className:"flex items-center gap-1","data-testid":"memory-usage-bar",children:[y,u.jsx($u,{percent:c,colorClassName:"bg-primary"})]}),e[20]=c,e[21]=v):v=e[21],e[22]!==v||e[23]!==b?(w=u.jsx(Ee,{delayDuration:200,content:b,children:v}),e[22]=v,e[23]=b,e[24]=w):w=e[24],w},_6=t=>{const e=H.c(11),{cpu:n}=t,{percent:o}=n;let r;e[0]!==o?(r=Math.round(o),e[0]=o,e[1]=r):r=e[1];const s=r;let i,a,l,c,d;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx("b",{children:"CPU:"}),e[2]=i):i=e[2],e[3]!==s?(a=u.jsxs("span",{children:[i," ",s,"%"]}),e[3]=s,e[4]=a):a=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(CF,{className:"w-4 h-4"}),e[5]=l):l=e[5],e[6]!==s?(c=u.jsxs("div",{className:"flex items-center gap-1","data-testid":"cpu-bar",children:[l,u.jsx($u,{percent:s,colorClassName:"bg-primary"})]}),e[6]=s,e[7]=c):c=e[7],e[8]!==a||e[9]!==c?(d=u.jsx(Ee,{delayDuration:200,content:a,children:c}),e[8]=a,e[9]=c,e[10]=d):d=e[10],d},I6=t=>{const e=H.c(12),{gpus:n}=t;let o;e[0]!==n?(o=Math.round(n.reduce(T6,0)/n.length),e[0]=n,e[1]=o):o=e[1];const r=o;let s,i,a,l,c;return e[2]!==n?(s=n.map(M6),e[2]=n,e[3]=s):s=e[3],e[4]!==s?(i=u.jsx("div",{className:"flex flex-col gap-1",children:s}),e[4]=s,e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(zp,{className:"w-4 h-4"}),e[6]=a):a=e[6],e[7]!==r?(l=u.jsxs("div",{className:"flex items-center gap-1","data-testid":"gpu-bar",children:[a,u.jsx($u,{percent:r,colorClassName:"bg-(--grass-9)"})]}),e[7]=r,e[8]=l):l=e[8],e[9]!==i||e[10]!==l?(c=u.jsx(Ee,{delayDuration:200,content:i,children:l}),e[9]=i,e[10]=l,e[11]=c):c=e[11],c},$u=t=>{const e=H.c(7),{percent:n,colorClassName:o}=t;let r;e[0]!==o?(r=xe("h-full bg-primary",o),e[0]=o,e[1]=r):r=e[1];const s=`${n}%`;let i,a;return e[2]!==s?(i={width:s},e[2]=s,e[3]=i):i=e[3],e[4]!==r||e[5]!==i?(a=u.jsx("div",{className:"h-3 w-20 bg-(--slate-4) rounded-lg overflow-hidden border",children:u.jsx("div",{className:r,style:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a};function ml(t){return t>1073741824?`${Vu(t)} GB`:`${function(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(e/1048576)}(t)} MB`}function Vu(t){return new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(t/1073741824)}function A6(t){return t+1}function T6(t,e){return t+e.memory.percent}function M6(t){return u.jsxs("span",{children:[u.jsxs("b",{children:["GPU ",t.index," (",t.name,"):"]})," ",ml(t.memory.used)," / ",ml(t.memory.total)," GB (",Math.round(t.memory.percent),"%)"]},t.index)}const Hb=jt(!1);function Hu(t,e,n=new Set){if(n.has(t))return new Set;n.add(t);const o=new Set;for(const r of e(t)){o.add(r);for(const s of Hu(r,e,n))o.add(s)}return o}const O6=jt(t=>{const e=t(ta),n=t(kc);return function(o,r){var a,l,c;const s=new Map;for(const d of o)s.set(d,{variables:new Set,parents:new Set,children:new Set});for(const d of Object.values(r))if(d.dataType!=="module")for(const h of d.declaredBy){(a=s.get(h))==null||a.variables.add(d.name);for(const f of d.usedBy)h!==f&&((l=s.get(f))==null||l.parents.add(h),(c=s.get(h))==null||c.children.add(f))}const i={};for(const[d,h]of s.entries())i[d]={parents:h.parents,children:h.children,variables:[...h.variables],ancestors:Hu(d,f=>{var m;return((m=s.get(f))==null?void 0:m.parents)??new Set}),descendants:Hu(d,f=>{var m;return((m=s.get(f))==null?void 0:m.children)??new Set})};return i}(e.inOrderIds,n)});function D6(t,e){return e?t.usedBy.includes(e.id)||t.declaredBy.includes(e.id)?!0:t.declaredBy.some(n=>e.graph.parents.has(n))?t.usedBy.some(n=>e.graph.parents.has(n)):!!t.declaredBy.some(n=>e.graph.children.has(n)):!1}const R6=()=>{const t=H.c(6),[e,n]=zt(Hb);let o,r,s;return t[0]!==n?(o=()=>n(P6),t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(Pp,{className:"h-4 w-4"}),t[2]=r):r=t[2],t[3]!==e||t[4]!==o?(s=u.jsx(mn,{tooltip:"Toggle Minimap",selected:e,onClick:o,"data-testid":"footer-minimap",children:r}),t[3]=e,t[4]=o,t[5]=s):s=t[5],s};function P6(t){return!t}const L6=()=>{const t=H.c(13),e=Ne(Rr),[n,o]=zt(xC),[r,s]=M.useState(!1);if(!Pc()||e==="disabled")return null;const i=e?"Real-time collaboration active":"Connecting to real-time collaboration";let a,l,c,d,h,f;return t[0]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(og,{className:"w-4 h-4"}),t[0]=a):a=t[0],t[1]!==i?(l=u.jsx(ws,{asChild:!0,children:u.jsx(mn,{tooltip:i,selected:!1,"data-testid":"footer-rtc-status",children:a})}),t[1]=i,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsxs("div",{className:"space-y-2",children:[u.jsx("h4",{className:"font-medium leading-none",children:"Username"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Set your username for real-time collaboration"})]}),t[3]=c):c=t[3],t[4]!==o?(d=m=>o(m.target.value),t[4]=o,t[5]=d):d=t[5],t[6]!==d||t[7]!==n?(h=u.jsx(ps,{className:"w-80",children:u.jsxs("div",{className:"space-y-4",children:[c,u.jsx(qo,{value:n,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",onChange:d,placeholder:"Enter your username"})]})}),t[6]=d,t[7]=n,t[8]=h):h=t[8],t[9]!==r||t[10]!==l||t[11]!==h?(f=u.jsxs(br,{open:r,onOpenChange:s,children:[l,h]}),t[9]=r,t[10]=l,t[11]=h,t[12]=f):f=t[12],f},F6=t=>{const e=H.c(104),{className:n}=t,{saveUserConfig:o}=nt(),[r,s]=YP(),i=xr()[0],[a,l]=M.useState(!1);let c,d,h;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>{const Ie=window.matchMedia("(min-width: 768px)"),ke=()=>{Ie.matches&&l(!1)};return Ie.addEventListener("change",ke),()=>Ie.removeEventListener("change",ke)},d=[],e[0]=c,e[1]=d):(c=e[0],d=e[1]),M.useEffect(c,d),e[2]!==i||e[3]!==o||e[4]!==s?(h=async Ie=>{const ke={...i,runtime:{...i.runtime,auto_instantiate:Ie}};await o({config:ke}).then(()=>s(ke))},e[2]=i,e[3]=o,e[4]=s,e[5]=h):h=e[5];const f=h;let m;e[6]!==o||e[7]!==s||e[8]!==r?(m=async Ie=>{const ke={...r,runtime:{...r.runtime,on_cell_change:Ie?"autorun":"lazy"}};await o({config:ke}).then(()=>s(ke))},e[6]=o,e[7]=s,e[8]=r,e[9]=m):m=e[9];const g=m;let x;e[10]!==o||e[11]!==s||e[12]!==r?(x=async Ie=>{const ke={...r,runtime:{...r.runtime,auto_reload:Ie}};await o({config:ke}).then(()=>s(ke))},e[10]=o,e[11]=s,e[12]=r,e[13]=x):x=e[13];const p=x;let b;e[14]!==i.runtime.auto_instantiate||e[15]!==i.runtime.auto_reload||e[16]!==i.runtime.on_cell_change?(b=!i.runtime.auto_instantiate&&i.runtime.on_cell_change==="lazy"&&(tn()||i.runtime.auto_reload!=="autorun"),e[14]=i.runtime.auto_instantiate,e[15]=i.runtime.auto_reload,e[16]=i.runtime.on_cell_change,e[17]=b):b=e[17];const y=b;let v;e[18]!==n?(v=xe("flex items-center",n),e[18]=n,e[19]=v):v=e[19];const w=i.runtime.auto_instantiate?"Disable autorun on startup":"Enable autorun on startup";let j,C,N;e[20]!==i.runtime.auto_instantiate||e[21]!==f?(j=()=>f(!i.runtime.auto_instantiate),e[20]=i.runtime.auto_instantiate,e[21]=f,e[22]=j):j=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(C=u.jsx("span",{children:"on startup: "}),e[23]=C):C=e[23],e[24]!==i.runtime.auto_instantiate?(N=i.runtime.auto_instantiate?u.jsx(hn,{size:14}):u.jsx(un,{size:14}),e[24]=i.runtime.auto_instantiate,e[25]=N):N=e[25];const S=i.runtime.auto_instantiate?"autorun":"lazy";let E,T,I,D;e[26]!==S?(E=u.jsx("span",{children:S}),e[26]=S,e[27]=E):E=e[27],e[28]!==N||e[29]!==E?(T=u.jsxs("div",{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[C,N,E]}),e[28]=N,e[29]=E,e[30]=T):T=e[30],e[31]!==T||e[32]!==w||e[33]!==j?(I=u.jsx(Ns,{name:"runtime.auto_instantiate",children:u.jsx(mn,{tooltip:w,selected:!1,onClick:j,"data-testid":"footer-autorun-startup",children:T})}),e[31]=T,e[32]=w,e[33]=j,e[34]=I):I=e[34],e[35]===Symbol.for("react.memo_cache_sentinel")?(D=u.jsx("div",{className:"border-r border-border h-6 mx-1"}),e[35]=D):D=e[35];const F=i.runtime.on_cell_change==="autorun"?"Disable autorun":"Enable autorun";let O,R,P,z,_,k,B,A,U,V,X,Y,G;e[36]!==i.runtime.on_cell_change||e[37]!==g?(O=()=>g(i.runtime.on_cell_change!=="autorun"),e[36]=i.runtime.on_cell_change,e[37]=g,e[38]=O):O=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(R=u.jsx("span",{children:"on cell change: "}),e[39]=R):R=e[39],e[40]!==i.runtime.on_cell_change?(P=u.jsxs("div",{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[R,i.runtime.on_cell_change==="autorun"?u.jsx(hn,{size:14}):u.jsx(un,{size:14}),u.jsx("span",{children:i.runtime.on_cell_change})]}),e[40]=i.runtime.on_cell_change,e[41]=P):P=e[41],e[42]!==F||e[43]!==O||e[44]!==P?(z=u.jsx(Ns,{name:"runtime.on_cell_change",children:u.jsx(mn,{tooltip:F,selected:!1,onClick:O,"data-testid":"footer-autorun-cell-change",children:P})}),e[42]=F,e[43]=O,e[44]=P,e[45]=z):z=e[45],e[46]!==i.runtime.auto_reload||e[47]!==p?(_=!tn()&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"border-r border-border h-6 mx-1"}),u.jsx(Ns,{name:"runtime.auto_reload",children:u.jsx(mn,{tooltip:null,selected:!1,"data-testid":"footer-module-reload",children:u.jsxs(Eo,{children:[u.jsxs(_o,{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[u.jsx("span",{children:"on module change: "}),i.runtime.auto_reload==="off"&&u.jsx(aa,{size:14}),i.runtime.auto_reload==="lazy"&&u.jsx(un,{size:14}),i.runtime.auto_reload==="autorun"&&u.jsx(hn,{size:14}),u.jsx("span",{children:i.runtime.auto_reload}),u.jsx(No,{size:14})]}),u.jsx(Io,{children:["off","lazy","autorun"].map(Ie=>u.jsxs(At,{onClick:()=>p(Ie),children:[Ie==="off"&&u.jsx(aa,{size:14,className:"mr-2 text-muted-foreground"}),Ie==="lazy"&&u.jsx(un,{size:14,className:"mr-2 text-muted-foreground"}),Ie==="autorun"&&u.jsx(hn,{size:14,className:"mr-2 text-muted-foreground"}),Ie]},Ie))})]})})})]}),e[46]=i.runtime.auto_reload,e[47]=p,e[48]=_):_=e[48],e[49]!==I||e[50]!==z||e[51]!==_?(k=u.jsxs("div",{className:"hidden md:flex md:items-center",children:[I,D,z,_]}),e[49]=I,e[50]=z,e[51]=_,e[52]=k):k=e[52],e[53]!==y?(B=y?u.jsx(un,{size:16,className:"text-muted-foreground"}):u.jsx(hn,{size:16,className:"text-amber-500"}),e[53]=y,e[54]=B):B=e[54],e[55]===Symbol.for("react.memo_cache_sentinel")?(A=u.jsx(No,{size:14}),e[55]=A):A=e[55],e[56]!==B?(U=u.jsx(_o,{asChild:!0,children:u.jsx(mn,{tooltip:"Runtime reactivity",selected:!1,"data-testid":"footer-runtime-settings",children:u.jsxs("div",{className:"flex items-center gap-1",children:[B,A]})})}),e[56]=B,e[57]=U):U=e[57],e[58]===Symbol.for("react.memo_cache_sentinel")?(V=u.jsx(O3,{children:"Runtime reactivity"}),X=u.jsx(an,{}),e[58]=V,e[59]=X):(V=e[58],X=e[59]),e[60]!==i.runtime.auto_instantiate?(Y=i.runtime.auto_instantiate?u.jsx(hn,{size:14,className:"text-amber-500"}):u.jsx(un,{size:14,className:"text-muted-foreground"}),e[60]=i.runtime.auto_instantiate,e[61]=Y):Y=e[61],e[62]===Symbol.for("react.memo_cache_sentinel")?(G=u.jsx("div",{className:"text-sm font-medium",children:"On startup"}),e[62]=G):G=e[62];const W=i.runtime.auto_instantiate?"autorun":"lazy";let J,$,Q,te,oe,ne,ie,se,ae;e[63]!==W?(J=u.jsxs("div",{children:[G,u.jsx("div",{className:"text-xs text-muted-foreground",children:W})]}),e[63]=W,e[64]=J):J=e[64],e[65]!==Y||e[66]!==J?($=u.jsxs("div",{className:"flex items-center space-x-2",children:[Y,J]}),e[65]=Y,e[66]=J,e[67]=$):$=e[67],e[68]!==i.runtime.auto_instantiate||e[69]!==f?(Q=u.jsx(pm,{checked:i.runtime.auto_instantiate,onCheckedChange:f,size:"sm"}),e[68]=i.runtime.auto_instantiate,e[69]=f,e[70]=Q):Q=e[70],e[71]!==$||e[72]!==Q?(te=u.jsx(Ns,{name:"runtime.auto_instantiate",children:u.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[$,Q]})}),e[71]=$,e[72]=Q,e[73]=te):te=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(oe=u.jsx(an,{}),e[74]=oe):oe=e[74],e[75]!==i.runtime.on_cell_change?(ne=i.runtime.on_cell_change==="autorun"?u.jsx(hn,{size:14,className:"text-amber-500"}):u.jsx(un,{size:14,className:"text-muted-foreground"}),e[75]=i.runtime.on_cell_change,e[76]=ne):ne=e[76],e[77]===Symbol.for("react.memo_cache_sentinel")?(ie=u.jsx("div",{className:"text-sm font-medium",children:"On cell change"}),e[77]=ie):ie=e[77],e[78]!==i.runtime.on_cell_change?(se=u.jsxs("div",{children:[ie,u.jsx("div",{className:"text-xs text-muted-foreground",children:i.runtime.on_cell_change})]}),e[78]=i.runtime.on_cell_change,e[79]=se):se=e[79],e[80]!==ne||e[81]!==se?(ae=u.jsxs("div",{className:"flex items-center space-x-2",children:[ne,se]}),e[80]=ne,e[81]=se,e[82]=ae):ae=e[82];const fe=i.runtime.on_cell_change==="autorun";let re,ue,le,je,Se,Le;return e[83]!==g||e[84]!==fe?(re=u.jsx(pm,{checked:fe,onCheckedChange:g,size:"sm"}),e[83]=g,e[84]=fe,e[85]=re):re=e[85],e[86]!==ae||e[87]!==re?(ue=u.jsx(Ns,{name:"runtime.on_cell_change",children:u.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[ae,re]})}),e[86]=ae,e[87]=re,e[88]=ue):ue=e[88],e[89]!==i.runtime.auto_reload||e[90]!==p?(le=!tn()&&u.jsxs(u.Fragment,{children:[u.jsx(an,{}),u.jsx(Ns,{name:"runtime.auto_reload",children:u.jsxs("div",{className:"px-2 py-1",children:[u.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[i.runtime.auto_reload==="off"&&u.jsx(aa,{size:14,className:"text-muted-foreground"}),i.runtime.auto_reload==="lazy"&&u.jsx(un,{size:14,className:"text-muted-foreground"}),i.runtime.auto_reload==="autorun"&&u.jsx(hn,{size:14,className:"text-amber-500"}),u.jsxs("div",{children:[u.jsx("div",{className:"text-sm font-medium",children:"On module change"}),u.jsx("div",{className:"text-xs text-muted-foreground",children:i.runtime.auto_reload})]})]}),u.jsx("div",{className:"space-y-1",children:["off","lazy","autorun"].map(Ie=>u.jsxs("button",{onClick:()=>p(Ie),className:xe("w-full flex items-center px-2 py-1 text-sm rounded hover:bg-accent",Ie===i.runtime.auto_reload&&"bg-accent"),children:[Ie==="off"&&u.jsx(aa,{size:12,className:"mr-2"}),Ie==="lazy"&&u.jsx(un,{size:12,className:"mr-2"}),Ie==="autorun"&&u.jsx(hn,{size:12,className:"mr-2"}),u.jsx("span",{className:"capitalize",children:Ie}),Ie===i.runtime.auto_reload&&u.jsx("span",{className:"ml-auto",children:"\u2713"})]},Ie))})]})})]}),e[89]=i.runtime.auto_reload,e[90]=p,e[91]=le):le=e[91],e[92]!==te||e[93]!==ue||e[94]!==le?(je=u.jsxs(Io,{align:"start",className:"w-64",children:[V,X,te,oe,ue,le]}),e[92]=te,e[93]=ue,e[94]=le,e[95]=je):je=e[95],e[96]!==a||e[97]!==U||e[98]!==je?(Se=u.jsx("div",{className:"flex md:hidden",children:u.jsxs(Eo,{open:a,onOpenChange:l,children:[U,je]})}),e[96]=a,e[97]=U,e[98]=je,e[99]=Se):Se=e[99],e[100]!==k||e[101]!==Se||e[102]!==v?(Le=u.jsxs("div",{className:v,children:[k,Se]}),e[100]=k,e[101]=Se,e[102]=v,e[103]=Le):Le=e[103],Le},z6=()=>{const t=H.c(24),{selectedPanel:e,isTerminalOpen:n}=pc(),{toggleApplication:o,toggleTerminal:r}=Ui(),s=Ne(KP),i=B6,a=hd.find(U6);let l;Un(a,"Error panel not found"),t[0]!==r?(l=()=>{r()},t[0]=r,t[1]=l):l=t[1],Dt("global.toggleTerminal",l);const c=mn,d=a.tooltip,h=e===a.type,f=()=>o(a.type),m=i(a,s>0?"text-destructive":"");let g,x,p,b,y,v,w,j,C,N;return t[2]!==s?(g=u.jsx("span",{className:"ml-1 font-mono mt-0.5",children:s}),t[2]=s,t[3]=g):g=t[3],t[4]!==c||t[5]!==a||t[6]!==h||t[7]!==f||t[8]!==m||t[9]!==g?(x=u.jsxs(c,{tooltip:d,selected:h,onClick:f,"data-testid":"footer-errors",children:[m,g]}),t[4]=c,t[5]=a,t[6]=h,t[7]=f,t[8]=m,t[9]=g,t[10]=x):x=t[10],t[11]!==r?(p=()=>r(),t[11]=r,t[12]=p):p=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(tg,{className:"h-5 w-5"}),t[13]=b):b=t[13],t[14]!==n||t[15]!==p?(y=u.jsx($b,{capability:"terminal",children:u.jsx(mn,{tooltip:"Open terminal",selected:n,onClick:p,"data-testid":"footer-terminal",children:b})}),t[14]=n,t[15]=p,t[16]=y):y=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(v=u.jsx(F6,{}),w=u.jsx("div",{className:"mx-auto"}),t[17]=v,t[18]=w):(v=t[17],w=t[18]),t[19]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx(_4,{children:u.jsx(Ee,{content:u.jsx("div",{className:"w-[200px]",children:"Kiosk mode is enabled. This allows you to view the outputs of the cells without the ability to edit them."}),children:u.jsx("span",{className:"text-muted-foreground text-sm mr-4",children:"kiosk mode"})})}),t[19]=j):j=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(C=u.jsxs("div",{className:"flex items-center shrink-0 min-w-0",children:[u.jsx(N6,{}),u.jsx(R6,{}),u.jsx(v6,{}),u.jsx(j6,{}),u.jsx(L6,{}),u.jsx(w6,{})]}),t[20]=C):C=t[20],t[21]!==y||t[22]!==x?(N=u.jsxs("footer",{className:"h-10 py-2 bg-background flex items-center text-muted-foreground text-md px-1 border-t border-border select-none no-print text-sm shadow-[0_0_4px_1px_rgba(0,0,0,0.1)] z-50 print:hidden hide-on-fullscreen overflow-x-auto overflow-y-hidden scrollbar-thin",children:[x,y,v,w,j,C]}),t[21]=y,t[22]=x,t[23]=N):N=t[23],N};function B6(t,e){const{Icon:n}=t;return u.jsx(n,{className:xe("h-5 w-5",e)})}function U6(t){return t.type==="errors"}const $6=t=>{const e=H.c(6),{children:n}=t,{openModal:o,closeModal:r}=An();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(u.jsx(V6,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=u.jsx(FC,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},V6=t=>{const e=H.c(9),{onClose:n}=t;let o,r,s,i,a,l,c;return e[0]!==n?(o=async d=>{d.preventDefault();const h=new FormData(d.target),f=h.get("rating"),m=h.get("message");fetch("https://marimo.io/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rating:f,message:m})}),n(),Je({title:"Feedback sent!",description:"Thank you for your feedback!"})},e[0]=n,e[1]=o):o=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(Wo,{children:"Send Feedback"}),e[2]=r):r=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We want to hear from you \u2014 from minor bug reports to wishlist features and everything in between. Here are some ways you can get in touch:"}),e[3]=s):s=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsxs("li",{className:"my-0",children:["Take our"," ",u.jsx("a",{href:Fn.feedbackForm,target:"_blank",className:"underline",children:"two-minute survey."})]}),e[4]=i):i=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsxs("li",{className:"my-0",children:["File a"," ",u.jsx("a",{href:Fn.issuesPage,target:"_blank",className:"underline",children:"GitHub issue."})]}),e[5]=a):a=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsxs(ls,{children:[r,u.jsxs(cs,{children:[s,u.jsxs("ul",{className:"list-disc ml-8 my-2 prose dark:prose-invert",children:[i,a,u.jsxs("li",{className:"my-0",children:["Chat with us on"," ",u.jsx("a",{href:Fn.discordLink,target:"_blank",className:"underline",children:"Discord."})]})]}),u.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We're excited you're here as we build the future of Python data tooling. Thanks for being part of our community!"})]})]}),e[6]=l):l=e[6],e[7]!==o?(c=u.jsx(Go,{className:"w-fit",children:u.jsx("form",{onSubmit:o,children:l})}),e[7]=o,e[8]=c):c=e[8],c},H6=()=>{const t=H.c(10),{selectedPanel:e}=pc(),{toggleApplication:n}=Ui(),o=q6;let r,s,i,a,l,c;return t[0]!==e||t[1]!==n?(r="h-full pt-4 pb-1 px-1 flex flex-col items-start text-muted-foreground text-md select-none no-print text-sm z-50 dark:bg-background print:hidden hide-on-fullscreen",s=hd.filter(G6).map(d=>u.jsx(Wb,{tooltip:d.tooltip,selected:e===d.type,onClick:()=>n(d.type),children:o(d)},d.type)),t[0]=e,t[1]=n,t[2]=r,t[3]=s):(r=t[2],s=t[3]),t[4]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx($6,{children:u.jsx(Wb,{tooltip:"Send feedback!",selected:!1,children:u.jsx(Fp,{className:"h-5 w-5"})})}),a=u.jsx("div",{className:"flex-1"}),l=u.jsx(W6,{}),t[4]=i,t[5]=a,t[6]=l):(i=t[4],a=t[5],l=t[6]),t[7]!==r||t[8]!==s?(c=u.jsxs("div",{className:r,children:[s,i,a,l]}),t[7]=r,t[8]=s,t[9]=c):c=t[9],c},W6=()=>{const t=H.c(7),e=Ne(XP);let n,o,r;return t[0]!==e?(n=e>0?u.jsxs("span",{children:[e," cell",e>1?"s":""," queued or running"]}):"No cells queued or running",t[0]=e,t[1]=n):n=t[1],t[2]!==e?(o=u.jsx("div",{className:"flex flex-col-reverse gap-px overflow-hidden",children:Array.from({length:e}).map(Y6)}),t[2]=e,t[3]=o):o=t[3],t[4]!==n||t[5]!==o?(r=u.jsx(Ee,{content:n,side:"right",delayDuration:200,children:o}),t[4]=n,t[5]=o,t[6]=r):r=t[6],r},Wb=t=>{const e=H.c(17);let n,o,r,s,i;e[0]!==t?({children:n,tooltip:i,selected:s,className:o,...r}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s,e[5]=i):(n=e[1],o=e[2],r=e[3],s=e[4],i=e[5]);const a=!s&&"hover:bg-(--sage-3)",l=s&&"bg-(--sage-4)";let c,d,h;return e[6]!==o||e[7]!==a||e[8]!==l?(c=xe("flex items-center p-2 text-sm mx-px shadow-inset font-mono cursor-pointer rounded",a,l,o),e[6]=o,e[7]=a,e[8]=l,e[9]=c):c=e[9],e[10]!==n||e[11]!==r||e[12]!==c?(d=u.jsx("button",{className:c,...r,children:n}),e[10]=n,e[11]=r,e[12]=c,e[13]=d):d=e[13],e[14]!==d||e[15]!==i?(h=u.jsx(Ee,{content:i,side:"right",delayDuration:200,children:d}),e[14]=d,e[15]=i,e[16]=h):h=e[16],h};function q6(t,e){const{Icon:n}=t;return u.jsx(n,{className:xe("h-5 w-5",e)})}function G6(t){return!t.hidden&&t.position==="sidebar"}function Y6(t,e){return u.jsx("div",{className:"shrink-0 h-1 w-2 bg-(--grass-6) border border-(--grass-7)"},e.toString())}var Wu="ScrollArea",[qb,sz]=dC(Wu),[K6,jn]=qb(Wu),Gb=M.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:o="hover",dir:r,scrollHideDelay:s=600,...i}=t,[a,l]=M.useState(null),[c,d]=M.useState(null),[h,f]=M.useState(null),[m,g]=M.useState(null),[x,p]=M.useState(null),[b,y]=M.useState(0),[v,w]=M.useState(0),[j,C]=M.useState(!1),[N,S]=M.useState(!1),E=Cs(e,I=>l(I)),T=JP(r);return u.jsx(K6,{scope:n,type:o,dir:T,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:d,content:h,onContentChange:f,scrollbarX:m,onScrollbarXChange:g,scrollbarXEnabled:j,onScrollbarXEnabledChange:C,scrollbarY:x,onScrollbarYChange:p,scrollbarYEnabled:N,onScrollbarYEnabledChange:S,onCornerWidthChange:y,onCornerHeightChange:w,children:u.jsx(vs.div,{dir:T,...i,ref:E,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":v+"px",...t.style}})})});Gb.displayName=Wu;var Yb="ScrollAreaViewport",Kb=M.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:o,nonce:r,...s}=t,i=jn(Yb,n),a=M.useRef(null),l=Cs(e,a,i.onViewportChange);return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),u.jsx(vs.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...t.style},children:u.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});Kb.displayName=Yb;var qn="ScrollAreaScrollbar",qu=M.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=jn(qn,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=r,a=t.orientation==="horizontal";return M.useEffect(()=>(a?s(!0):i(!0),()=>{a?s(!1):i(!1)}),[a,s,i]),r.type==="hover"?u.jsx(X6,{...o,ref:e,forceMount:n}):r.type==="scroll"?u.jsx(J6,{...o,ref:e,forceMount:n}):r.type==="auto"?u.jsx(Xb,{...o,ref:e,forceMount:n}):r.type==="always"?u.jsx(Gu,{...o,ref:e}):null});qu.displayName=qn;var X6=M.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=jn(qn,t.__scopeScrollArea),[s,i]=M.useState(!1);return M.useEffect(()=>{const a=r.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),i(!0)},d=()=>{l=window.setTimeout(()=>i(!1),r.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",d)}}},[r.scrollArea,r.scrollHideDelay]),u.jsx(Vc,{present:n||s,children:u.jsx(Xb,{"data-state":s?"visible":"hidden",...o,ref:e})})}),J6=M.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=jn(qn,t.__scopeScrollArea),s=t.orientation==="horizontal",i=bl(()=>l("SCROLL_END"),100),[a,l]=function(c,d){return M.useReducer((h,f)=>d[h][f]??h,c)}("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return M.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,r.scrollHideDelay,l]),M.useEffect(()=>{const c=r.viewport,d=s?"scrollLeft":"scrollTop";if(c){let h=c[d];const f=()=>{const m=c[d];h!==m&&(l("SCROLL"),i()),h=m};return c.addEventListener("scroll",f),()=>c.removeEventListener("scroll",f)}},[r.viewport,s,l,i]),u.jsx(Vc,{present:n||a!=="hidden",children:u.jsx(Gu,{"data-state":a==="hidden"?"hidden":"visible",...o,ref:e,onPointerEnter:On(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:On(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),Xb=M.forwardRef((t,e)=>{const n=jn(qn,t.__scopeScrollArea),{forceMount:o,...r}=t,[s,i]=M.useState(!1),a=t.orientation==="horizontal",l=bl(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;i(a?c:d)}},10);return Ur(n.viewport,l),Ur(n.content,l),u.jsx(Vc,{present:o||s,children:u.jsx(Gu,{"data-state":s?"visible":"hidden",...r,ref:e})})}),Gu=M.forwardRef((t,e)=>{const{orientation:n="vertical",...o}=t,r=jn(qn,t.__scopeScrollArea),s=M.useRef(null),i=M.useRef(0),[a,l]=M.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=ty(a.viewport,a.content),d={...o,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:f=>s.current=f,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:f=>i.current=f};function h(f,m){return function(g,x,p,b="ltr"){const y=xl(p),v=y/2,w=x||v,j=y-w,C=p.scrollbar.paddingStart+w,N=p.scrollbar.size-p.scrollbar.paddingEnd-j,S=p.content-p.viewport,E=b==="ltr"?[0,S]:[-1*S,0];return oy([C,N],E)(g)}(f,i.current,a,m)}return n==="horizontal"?u.jsx(Z6,{...d,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const f=ny(r.viewport.scrollLeft,a,r.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollLeft=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollLeft=h(f,r.dir))}}):n==="vertical"?u.jsx(Q6,{...d,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const f=ny(r.viewport.scrollTop,a);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollTop=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollTop=h(f))}}):null}),Z6=M.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,s=jn(qn,t.__scopeScrollArea),[i,a]=M.useState(),l=M.useRef(null),c=Cs(e,l,s.onScrollbarXChange);return M.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),u.jsx(Zb,{"data-orientation":"horizontal",...r,ref:c,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":xl(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,h)=>{if(s.viewport){const f=s.viewport.scrollLeft+d.deltaX;t.onWheelScroll(f),ry(f,h)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&o({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:gl(i.paddingLeft),paddingEnd:gl(i.paddingRight)}})}})}),Q6=M.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,s=jn(qn,t.__scopeScrollArea),[i,a]=M.useState(),l=M.useRef(null),c=Cs(e,l,s.onScrollbarYChange);return M.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),u.jsx(Zb,{"data-orientation":"vertical",...r,ref:c,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":xl(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,h)=>{if(s.viewport){const f=s.viewport.scrollTop+d.deltaY;t.onWheelScroll(f),ry(f,h)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&o({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:gl(i.paddingTop),paddingEnd:gl(i.paddingBottom)}})}})}),[eI,Jb]=qb(qn),Zb=M.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:o,hasThumb:r,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:d,onResize:h,...f}=t,m=jn(qn,n),[g,x]=M.useState(null),p=Cs(e,E=>x(E)),b=M.useRef(null),y=M.useRef(""),v=m.viewport,w=o.content-o.viewport,j=Xo(d),C=Xo(l),N=bl(h,10);function S(E){if(b.current){const T=E.clientX-b.current.left,I=E.clientY-b.current.top;c({x:T,y:I})}}return M.useEffect(()=>{const E=T=>{const I=T.target;(g==null?void 0:g.contains(I))&&j(T,w)};return document.addEventListener("wheel",E,{passive:!1}),()=>document.removeEventListener("wheel",E,{passive:!1})},[v,g,w,j]),M.useEffect(C,[o,C]),Ur(g,N),Ur(m.content,N),u.jsx(eI,{scope:n,scrollbar:g,hasThumb:r,onThumbChange:Xo(s),onThumbPointerUp:Xo(i),onThumbPositionChange:C,onThumbPointerDown:Xo(a),children:u.jsx(vs.div,{...f,ref:p,style:{position:"absolute",...f.style},onPointerDown:On(t.onPointerDown,E=>{E.button===0&&(E.target.setPointerCapture(E.pointerId),b.current=g.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),S(E))}),onPointerMove:On(t.onPointerMove,S),onPointerUp:On(t.onPointerUp,E=>{const T=E.target;T.hasPointerCapture(E.pointerId)&&T.releasePointerCapture(E.pointerId),document.body.style.webkitUserSelect=y.current,m.viewport&&(m.viewport.style.scrollBehavior=""),b.current=null})})})}),pl="ScrollAreaThumb",Qb=M.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Jb(pl,t.__scopeScrollArea);return u.jsx(Vc,{present:n||r.hasThumb,children:u.jsx(tI,{ref:e,...o})})}),tI=M.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:o,...r}=t,s=jn(pl,n),i=Jb(pl,n),{onThumbPositionChange:a}=i,l=Cs(e,h=>i.onThumbChange(h)),c=M.useRef(void 0),d=bl(()=>{c.current&&(c.current(),c.current=void 0)},100);return M.useEffect(()=>{const h=s.viewport;if(h){const f=()=>{if(d(),!c.current){const m=oI(h,a);c.current=m,a()}};return a(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[s.viewport,d,a]),u.jsx(vs.div,{"data-state":i.hasThumb?"visible":"hidden",...r,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:On(t.onPointerDownCapture,h=>{const f=h.target.getBoundingClientRect(),m=h.clientX-f.left,g=h.clientY-f.top;i.onThumbPointerDown({x:m,y:g})}),onPointerUp:On(t.onPointerUp,i.onThumbPointerUp)})});Qb.displayName=pl;var Yu="ScrollAreaCorner",ey=M.forwardRef((t,e)=>{const n=jn(Yu,t.__scopeScrollArea),o=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&o?u.jsx(nI,{...t,ref:e}):null});ey.displayName=Yu;var nI=M.forwardRef((t,e)=>{const{__scopeScrollArea:n,...o}=t,r=jn(Yu,n),[s,i]=M.useState(0),[a,l]=M.useState(0),c=!!(s&&a);return Ur(r.scrollbarX,()=>{var h;const d=((h=r.scrollbarX)==null?void 0:h.offsetHeight)||0;r.onCornerHeightChange(d),l(d)}),Ur(r.scrollbarY,()=>{var h;const d=((h=r.scrollbarY)==null?void 0:h.offsetWidth)||0;r.onCornerWidthChange(d),i(d)}),c?u.jsx(vs.div,{...o,ref:e,style:{width:s,height:a,position:"absolute",right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function gl(t){return t?parseInt(t,10):0}function ty(t,e){const n=t/e;return isNaN(n)?0:n}function xl(t){const e=ty(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=(t.scrollbar.size-n)*e;return Math.max(o,18)}function ny(t,e,n="ltr"){const o=xl(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-r,i=e.content-e.viewport,a=s-o,l=QP(t,n==="ltr"?[0,i]:[-1*i,0]);return oy([0,i],[0,a])(l)}function oy(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const o=(e[1]-e[0])/(t[1]-t[0]);return e[0]+o*(n-t[0])}}function ry(t,e){return t>0&&t<e}var oI=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},o=0;return function r(){const s={left:t.scrollLeft,top:t.scrollTop},i=n.left!==s.left,a=n.top!==s.top;(i||a)&&e(),n=s,o=window.requestAnimationFrame(r)}(),()=>window.cancelAnimationFrame(o)};function bl(t,e){const n=Xo(t),o=M.useRef(0);return M.useEffect(()=>()=>window.clearTimeout(o.current),[]),M.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(n,e)},[n,e])}function Ur(t,e){const n=Xo(e);ZP(()=>{let o=0;if(t){const r=new ResizeObserver(()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(n)});return r.observe(t),()=>{window.cancelAnimationFrame(o),r.unobserve(t)}}},[t,n])}var sy=Gb,rI=Kb,sI=ey;const iy=M.forwardRef((t,e)=>{const n=H.c(15);let o,r,s,i,a,l,c,d;return n[0]!==t?({className:r,children:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(i=xe("relative overflow-hidden",r),n[4]=r,n[5]=i):i=n[5],n[6]!==o?(a=u.jsx(rI,{className:"h-full w-full rounded-[inherit]",children:o}),n[6]=o,n[7]=a):a=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(ay,{}),c=u.jsx(sI,{}),n[8]=l,n[9]=c):(l=n[8],c=n[9]),n[10]!==s||n[11]!==e||n[12]!==i||n[13]!==a?(d=u.jsxs(sy,{ref:e,className:i,...s,children:[a,l,c]}),n[10]=s,n[11]=e,n[12]=i,n[13]=a,n[14]=d):d=n[14],d});iy.displayName=sy.displayName;const ay=M.forwardRef((t,e)=>{const n=H.c(14);let o,r,s;n[0]!==t?({className:o,orientation:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const i=s===void 0?"vertical":s,a=i==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-px",l=i==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-px";let c,d,h;return n[4]!==o||n[5]!==a||n[6]!==l?(c=xe("flex touch-none select-none transition-colors",a,l,o),n[4]=o,n[5]=a,n[6]=l,n[7]=c):c=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(Qb,{className:"relative flex-1 rounded-full bg-border"}),n[8]=d):d=n[8],n[9]!==i||n[10]!==r||n[11]!==e||n[12]!==c?(h=u.jsx(qu,{ref:e,orientation:i,className:c,...r,children:d}),n[9]=i,n[10]=r,n[11]=e,n[12]=c,n[13]=h):h=n[13],h});ay.displayName=qu.displayName;let Ku;Ku=(t,e,n,o,r,s)=>{if(!e)return ut.warn("No active chat"),t;const i=t.chats.findIndex(h=>h.id===e);if(i===-1)return ut.warn("No active chat"),t;const a=t.chats[i],l=a.messages.findIndex(h=>h.id===n),c=[...t.chats],d=Date.now();if(l===-1)c[i]={...a,messages:[...a.messages,{id:n,role:o,content:r,timestamp:d,parts:s}],updatedAt:d};else{const h=[...a.messages];h[l]={...h[l],content:r,parts:s},c[i]={...a,messages:h,updatedAt:d}}return{...t,chats:c}},dn=t=>{const e=H.c(15),{title:n,description:o,icon:r,action:s}=t;let i,a,l,c,d,h;return e[0]!==r?(i=r&&q.cloneElement(r,{className:"text-accent-foreground"}),e[0]=r,e[1]=i):i=e[1],e[2]!==n?(a=u.jsx("span",{className:"mt-1 text-accent-foreground",children:n}),e[2]=n,e[3]=a):a=e[3],e[4]!==i||e[5]!==a?(l=u.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[i,a]}),e[4]=i,e[5]=a,e[6]=l):l=e[6],e[7]!==o?(c=u.jsx("span",{className:"text-muted-foreground text-sm",children:o}),e[7]=o,e[8]=c):c=e[8],e[9]!==s?(d=s&&u.jsx("div",{className:"mt-2",children:s}),e[9]=s,e[10]=d):d=e[10],e[11]!==l||e[12]!==c||e[13]!==d?(h=u.jsxs("div",{className:"mx-6 my-6 flex flex-col gap-2",children:[l,c,d]}),e[11]=l,e[12]=c,e[13]=d,e[14]=h):h=e[14],h};function iz(){}function az(){}const iI=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,aI=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,lI={};function ly(t,e){return(lI.jsx?aI:iI).test(t)}const cI=/[ \t\n\f\r]/g;function cy(t){return t.replace(cI,"")===""}class ci{constructor(e,n,o){this.normal=n,this.property=e,o&&(this.space=o)}}function dy(t,e){const n={},o={};for(const r of t)Object.assign(n,r.property),Object.assign(o,r.normal);return new ci(n,o,e)}function Xu(t){return t.toLowerCase()}ci.prototype.normal={},ci.prototype.property={},ci.prototype.space=void 0;class on{constructor(e,n){this.attribute=n,this.property=e}}on.prototype.attribute="",on.prototype.booleanish=!1,on.prototype.boolean=!1,on.prototype.commaOrSpaceSeparated=!1,on.prototype.commaSeparated=!1,on.prototype.defined=!1,on.prototype.mustUseProperty=!1,on.prototype.number=!1,on.prototype.overloadedBoolean=!1,on.prototype.property="",on.prototype.spaceSeparated=!1,on.prototype.space=void 0;let dI=0;const Ge=cr(),_t=cr(),Ju=cr(),me=cr(),ht=cr(),$r=cr(),pn=cr();function cr(){return 2**++dI}const Zu=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ge,booleanish:_t,commaOrSpaceSeparated:pn,commaSeparated:$r,number:me,overloadedBoolean:Ju,spaceSeparated:ht},Symbol.toStringTag,{value:"Module"})),Qu=Object.keys(Zu);class eh extends on{constructor(e,n,o,r){let s=-1;if(super(e,n),uy(this,"space",r),typeof o=="number")for(;++s<Qu.length;){const i=Qu[s];uy(this,Qu[s],(o&Zu[i])===Zu[i])}}}function uy(t,e,n){n&&(t[e]=n)}function Vr(t){const e={},n={};for(const[o,r]of Object.entries(t.properties)){const s=new eh(o,t.transform(t.attributes||{},o),r,t.space);t.mustUseProperty&&t.mustUseProperty.includes(o)&&(s.mustUseProperty=!0),e[o]=s,n[Xu(o)]=o,n[Xu(s.attribute)]=o}return new ci(e,n,t.space)}eh.prototype.defined=!0;const hy=Vr({properties:{ariaActiveDescendant:null,ariaAtomic:_t,ariaAutoComplete:null,ariaBusy:_t,ariaChecked:_t,ariaColCount:me,ariaColIndex:me,ariaColSpan:me,ariaControls:ht,ariaCurrent:null,ariaDescribedBy:ht,ariaDetails:null,ariaDisabled:_t,ariaDropEffect:ht,ariaErrorMessage:null,ariaExpanded:_t,ariaFlowTo:ht,ariaGrabbed:_t,ariaHasPopup:null,ariaHidden:_t,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ht,ariaLevel:me,ariaLive:null,ariaModal:_t,ariaMultiLine:_t,ariaMultiSelectable:_t,ariaOrientation:null,ariaOwns:ht,ariaPlaceholder:null,ariaPosInSet:me,ariaPressed:_t,ariaReadOnly:_t,ariaRelevant:null,ariaRequired:_t,ariaRoleDescription:ht,ariaRowCount:me,ariaRowIndex:me,ariaRowSpan:me,ariaSelected:_t,ariaSetSize:me,ariaSort:null,ariaValueMax:me,ariaValueMin:me,ariaValueNow:me,ariaValueText:null,role:null},transform:(t,e)=>e==="role"?e:"aria-"+e.slice(4).toLowerCase()});function fy(t,e){return e in t?t[e]:e}function my(t,e){return fy(t,e.toLowerCase())}const uI=Vr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:$r,acceptCharset:ht,accessKey:ht,action:null,allow:null,allowFullScreen:Ge,allowPaymentRequest:Ge,allowUserMedia:Ge,alt:null,as:null,async:Ge,autoCapitalize:null,autoComplete:ht,autoFocus:Ge,autoPlay:Ge,blocking:ht,capture:null,charSet:null,checked:Ge,cite:null,className:ht,cols:me,colSpan:null,content:null,contentEditable:_t,controls:Ge,controlsList:ht,coords:me|$r,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ge,defer:Ge,dir:null,dirName:null,disabled:Ge,download:Ju,draggable:_t,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ge,formTarget:null,headers:ht,height:me,hidden:Ju,high:me,href:null,hrefLang:null,htmlFor:ht,httpEquiv:ht,id:null,imageSizes:null,imageSrcSet:null,inert:Ge,inputMode:null,integrity:null,is:null,isMap:Ge,itemId:null,itemProp:ht,itemRef:ht,itemScope:Ge,itemType:ht,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ge,low:me,manifest:null,max:null,maxLength:me,media:null,method:null,min:null,minLength:me,multiple:Ge,muted:Ge,name:null,nonce:null,noModule:Ge,noValidate:Ge,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ge,optimum:me,pattern:null,ping:ht,placeholder:null,playsInline:Ge,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ge,referrerPolicy:null,rel:ht,required:Ge,reversed:Ge,rows:me,rowSpan:me,sandbox:ht,scope:null,scoped:Ge,seamless:Ge,selected:Ge,shadowRootClonable:Ge,shadowRootDelegatesFocus:Ge,shadowRootMode:null,shape:null,size:me,sizes:null,slot:null,span:me,spellCheck:_t,src:null,srcDoc:null,srcLang:null,srcSet:null,start:me,step:null,style:null,tabIndex:me,target:null,title:null,translate:null,type:null,typeMustMatch:Ge,useMap:null,value:_t,width:me,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ht,axis:null,background:null,bgColor:null,border:me,borderColor:null,bottomMargin:me,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ge,declare:Ge,event:null,face:null,frame:null,frameBorder:null,hSpace:me,leftMargin:me,link:null,longDesc:null,lowSrc:null,marginHeight:me,marginWidth:me,noResize:Ge,noHref:Ge,noShade:Ge,noWrap:Ge,object:null,profile:null,prompt:null,rev:null,rightMargin:me,rules:null,scheme:null,scrolling:_t,standby:null,summary:null,text:null,topMargin:me,valueType:null,version:null,vAlign:null,vLink:null,vSpace:me,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ge,disableRemotePlayback:Ge,prefix:null,property:null,results:me,security:null,unselectable:null},space:"html",transform:my}),hI=Vr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:pn,accentHeight:me,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:me,amplitude:me,arabicForm:null,ascent:me,attributeName:null,attributeType:null,azimuth:me,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:me,by:null,calcMode:null,capHeight:me,className:ht,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:me,diffuseConstant:me,direction:null,display:null,dur:null,divisor:me,dominantBaseline:null,download:Ge,dx:null,dy:null,edgeMode:null,editable:null,elevation:me,enableBackground:null,end:null,event:null,exponent:me,externalResourcesRequired:null,fill:null,fillOpacity:me,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:$r,g2:$r,glyphName:$r,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:me,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:me,horizOriginX:me,horizOriginY:me,id:null,ideographic:me,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:me,k:me,k1:me,k2:me,k3:me,k4:me,kernelMatrix:pn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:me,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:me,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:me,overlineThickness:me,paintOrder:null,panose1:null,path:null,pathLength:me,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ht,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:me,pointsAtY:me,pointsAtZ:me,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:pn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:pn,rev:pn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:pn,requiredFeatures:pn,requiredFonts:pn,requiredFormats:pn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:me,specularExponent:me,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:me,strikethroughThickness:me,string:null,stroke:null,strokeDashArray:pn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:me,strokeOpacity:me,strokeWidth:null,style:null,surfaceScale:me,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:pn,tabIndex:me,tableValues:null,target:null,targetX:me,targetY:me,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:pn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:me,underlineThickness:me,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:me,values:null,vAlphabetic:me,vMathematical:me,vectorEffect:null,vHanging:me,vIdeographic:me,version:null,vertAdvY:me,vertOriginX:me,vertOriginY:me,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:me,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:fy}),py=Vr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(t,e)=>"xlink:"+e.slice(5).toLowerCase()}),gy=Vr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:my}),xy=Vr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(t,e)=>"xml:"+e.slice(3).toLowerCase()}),fI={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},mI=/[A-Z]/g,by=/-[a-z]/g,pI=/^data[-\w.:]+$/i;function gI(t){return"-"+t.toLowerCase()}function xI(t){return t.charAt(1).toUpperCase()}const bI=dy([hy,uI,py,gy,xy],"html"),th=dy([hy,hI,py,gy,xy],"svg");var yy,Hr={},vy,yl,wy,di={};function yI(){if(vy)return di;vy=1,Object.defineProperty(di,"__esModule",{value:!0}),di.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,r=/^-(ms)-/,s=function(a,l){return l.toUpperCase()},i=function(a,l){return"".concat(l,"-")};return di.camelCase=function(a,l){return l===void 0&&(l={}),function(c){return!c||n.test(c)||t.test(c)}(a)?a:(a=a.toLowerCase(),(a=l.reactCompat?a.replace(r,i):a.replace(o,i)).replace(e,s))},di}var vI=function(){if(wy)return yl;wy=1;var t=(yl&&yl.__importDefault||function(o){return o&&o.__esModule?o:{default:o}})(function(){if(yy)return Hr;yy=1;var o=Hr&&Hr.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.default=function(s,i){var a=null;if(!s||typeof s!="string")return a;var l=(0,r.default)(s),c=typeof i=="function";return l.forEach(function(d){if(d.type==="declaration"){var h=d.property,f=d.value;c?i(h,f,d):f&&((a=a||{})[h]=f)}}),a};var r=o(eL());return Hr}()),e=yI();function n(o,r){var s={};return o&&typeof o=="string"&&(0,t.default)(o,function(i,a){i&&a&&(s[(0,e.camelCase)(i,r)]=a)}),s}return n.default=n,yl=n}();const wI=zC(vI),ky=Cy("end"),nh=Cy("start");function Cy(t){return function(e){const n=e&&e.position&&e.position[t]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function ui(t){return t&&typeof t=="object"?"position"in t||"type"in t?jy(t.position):"start"in t||"end"in t?jy(t):"line"in t||"column"in t?oh(t):"":""}function oh(t){return Sy(t&&t.line)+":"+Sy(t&&t.column)}function jy(t){return oh(t&&t.start)+"-"+oh(t&&t.end)}function Sy(t){return t&&typeof t=="number"?t:1}class Vt extends Error{constructor(e,n,o){super(),typeof n=="string"&&(o=n,n=void 0);let r="",s={},i=!1;if(n&&(s="line"in n&&"column"in n||"start"in n&&"end"in n?{place:n}:"type"in n?{ancestors:[n],place:n.position}:{...n}),typeof e=="string"?r=e:!s.cause&&e&&(i=!0,r=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof o=="string"){const l=o.indexOf(":");l===-1?s.ruleId=o:(s.source=o.slice(0,l),s.ruleId=o.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=r,this.line=a?a.line:void 0,this.name=ui(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=i&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual,this.expected,this.note,this.url}}Vt.prototype.file="",Vt.prototype.name="",Vt.prototype.reason="",Vt.prototype.message="",Vt.prototype.stack="",Vt.prototype.column=void 0,Vt.prototype.line=void 0,Vt.prototype.ancestors=void 0,Vt.prototype.cause=void 0,Vt.prototype.fatal=void 0,Vt.prototype.place=void 0,Vt.prototype.ruleId=void 0,Vt.prototype.source=void 0;const rh={}.hasOwnProperty,kI=new Map,CI=/[A-Z]/g,jI=new Set(["table","tbody","thead","tfoot","tr"]),SI=new Set(["td","th"]),Ny="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function NI(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let o;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");o=function(i,a){return l;function l(c,d,h,f){const m=Array.isArray(h.children),g=nh(c);return a(d,h,f,m,{columnNumber:g?g.column-1:void 0,fileName:i,lineNumber:g?g.line:void 0},void 0)}}(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");o=function(i,a,l){return c;function c(d,h,f,m){const g=Array.isArray(f.children)?l:a;return m?g(h,f,m):g(h,f)}}(0,e.jsx,e.jsxs)}const r={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:o,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?th:bI,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=Ey(r,t,void 0);return s&&typeof s!="string"?s:r.create(t,r.Fragment,{children:s||void 0},void 0)}function Ey(t,e,n){return e.type==="element"?function(o,r,s){const i=o.schema;let a=i;r.tagName.toLowerCase()==="svg"&&i.space==="html"&&(a=th,o.schema=a),o.ancestors.push(r);const l=Iy(o,r.tagName,!1),c=function(h,f){const m={};let g,x;for(x in f.properties)if(x!=="children"&&rh.call(f.properties,x)){const p=EI(h,x,f.properties[x]);if(p){const[b,y]=p;h.tableCellAlignToStyle&&b==="align"&&typeof y=="string"&&SI.has(f.tagName)?g=y:m[b]=y}}return g&&((m.style||(m.style={}))[h.stylePropertyNameCase==="css"?"text-align":"textAlign"]=g),m}(o,r);let d=ih(o,r);return jI.has(r.tagName)&&(d=d.filter(function(h){return typeof h!="string"||!(typeof(f=h)=="object"?f.type==="text"&&cy(f.value):cy(f));var f})),_y(o,c,l,r),sh(c,d),o.ancestors.pop(),o.schema=i,o.create(r,l,c,s)}(t,e,n):e.type==="mdxFlowExpression"||e.type==="mdxTextExpression"?function(o,r){if(r.data&&r.data.estree&&o.evaluater){const s=r.data.estree.body[0];return s.type,o.evaluater.evaluateExpression(s.expression)}hi(o,r.position)}(t,e):e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement"?function(o,r,s){const i=o.schema;let a=i;r.name==="svg"&&i.space==="html"&&(a=th,o.schema=a),o.ancestors.push(r);const l=r.name===null?o.Fragment:Iy(o,r.name,!0),c=function(h,f){const m={};for(const g of f.attributes)if(g.type==="mdxJsxExpressionAttribute")if(g.data&&g.data.estree&&h.evaluater){const x=g.data.estree.body[0];x.type;const p=x.expression;p.type;const b=p.properties[0];b.type,Object.assign(m,h.evaluater.evaluateExpression(b.argument))}else hi(h,f.position);else{const x=g.name;let p;if(g.value&&typeof g.value=="object")if(g.value.data&&g.value.data.estree&&h.evaluater){const b=g.value.data.estree.body[0];b.type,p=h.evaluater.evaluateExpression(b.expression)}else hi(h,f.position);else p=g.value===null||g.value;m[x]=p}return m}(o,r),d=ih(o,r);return _y(o,c,l,r),sh(c,d),o.ancestors.pop(),o.schema=i,o.create(r,l,c,s)}(t,e,n):e.type==="mdxjsEsm"?function(o,r){if(r.data&&r.data.estree&&o.evaluater)return o.evaluater.evaluateProgram(r.data.estree);hi(o,r.position)}(t,e):e.type==="root"?function(o,r,s){const i={};return sh(i,ih(o,r)),o.create(r,o.Fragment,i,s)}(t,e,n):e.type==="text"?function(o,r){return r.value}(0,e):void 0}function _y(t,e,n,o){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=o)}function sh(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function ih(t,e){const n=[];let o=-1;const r=t.passKeys?new Map:kI;for(;++o<e.children.length;){const s=e.children[o];let i;if(t.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=r.get(l)||0;i=l+"-"+c,r.set(l,c+1)}}const a=Ey(t,s,i);a!==void 0&&n.push(a)}return n}function EI(t,e,n){const o=function(r,s){const i=Xu(s);let a=s,l=on;if(i in r.normal)return r.property[r.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&pI.test(s)){if(s.charAt(4)==="-"){const c=s.slice(5).replace(by,xI);a="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=s.slice(4);if(!by.test(c)){let d=c.replace(mI,gI);d.charAt(0)!=="-"&&(d="-"+d),s="data"+d}}l=eh}return new l(a,s)}(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=o.commaSeparated?function(r){const s={};return(r[r.length-1]===""?[...r,""]:r).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}(n):n.join(" ").trim()),o.property==="style"){let r=typeof n=="object"?n:function(s,i){try{return wI(i,{reactCompat:!0})}catch(a){if(s.ignoreInvalidStyle)return{};const l=a,c=new Vt("Cannot parse `style` attribute",{ancestors:s.ancestors,cause:l,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=s.filePath||void 0,c.url=Ny+"#cannot-parse-style-attribute",c}}(t,String(n));return t.stylePropertyNameCase==="css"&&(r=function(s){const i={};let a;for(a in s)rh.call(s,a)&&(i[_I(a)]=s[a]);return i}(r)),["style",r]}return[t.elementAttributeNameCase==="react"&&o.space?fI[o.property]||o.property:o.attribute,n]}}function Iy(t,e,n){let o;if(n)if(e.includes(".")){const r=e.split(".");let s,i=-1;for(;++i<r.length;){const a=ly(r[i])?{type:"Identifier",name:r[i]}:{type:"Literal",value:r[i]};s=s?{type:"MemberExpression",object:s,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}o=s}else o=ly(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};else o={type:"Literal",value:e};if(o.type==="Literal"){const r=o.value;return rh.call(t.components,r)?t.components[r]:r}if(t.evaluater)return t.evaluater.evaluateExpression(o);hi(t)}function hi(t,e){const n=new Vt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=Ny+"#cannot-handle-mdx-estrees-without-createevaluater",n}function _I(t){let e=t.replace(CI,II);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function II(t){return"-"+t.toLowerCase()}const ah={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},vl={};function lh(t,e){return Ay(t,typeof vl.includeImageAlt!="boolean"||vl.includeImageAlt,typeof vl.includeHtml!="boolean"||vl.includeHtml)}function Ay(t,e,n){if(function(o){return!!(o&&typeof o=="object")}(t)){if("value"in t)return t.type!=="html"||n?t.value:"";if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return Ty(t.children,e,n)}return Array.isArray(t)?Ty(t,e,n):""}function Ty(t,e,n){const o=[];let r=-1;for(;++r<t.length;)o[r]=Ay(t[r],e,n);return o.join("")}const My=document.createElement("i");function ch(t){const e="&"+t+";";My.innerHTML=e;const n=My.textContent;return(n.charCodeAt(n.length-1)!==59||t==="semi")&&n!==e&&n}function gn(t,e,n,o){const r=t.length;let s,i=0;if(e=e<0?-e>r?0:r+e:e>r?r:e,n=n>0?n:0,o.length<1e4)s=Array.from(o),s.unshift(e,n),t.splice(...s);else for(n&&t.splice(e,n);i<o.length;)s=o.slice(i,i+1e4),s.unshift(e,0),t.splice(...s),i+=1e4,e+=1e4}function Sn(t,e){return t.length>0?(gn(t,t.length,0,e),t):e}const Oy={}.hasOwnProperty;function Dy(t){const e={};let n=-1;for(;++n<t.length;)AI(e,t[n]);return e}function AI(t,e){let n;for(n in e){const o=(Oy.call(t,n)?t[n]:void 0)||(t[n]={}),r=e[n];let s;if(r)for(s in r){Oy.call(o,s)||(o[s]=[]);const i=r[s];TI(o[s],Array.isArray(i)?i:i?[i]:[])}}}function TI(t,e){let n=-1;const o=[];for(;++n<e.length;)(e[n].add==="after"?t:o).push(e[n]);gn(t,0,0,o)}function Ry(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||(65535&n)==65534||n>1114111?"\uFFFD":String.fromCodePoint(n)}function Rn(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Zt=Lo(/[A-Za-z]/),Ht=Lo(/[\dA-Za-z]/),MI=Lo(/[#-'*+\--9=?A-Z^-~]/);function wl(t){return t!==null&&(t<32||t===127)}const dh=Lo(/\d/),OI=Lo(/[\dA-Fa-f]/),DI=Lo(/[!-/:-@[-`{-~]/);function Be(t){return t!==null&&t<-2}function ct(t){return t!==null&&(t<0||t===32)}function et(t){return t===-2||t===-1||t===32}const kl=Lo(new RegExp("\\p{P}|\\p{S}","u")),dr=Lo(/\s/);function Lo(t){return function(e){return e!==null&&e>-1&&t.test(String.fromCharCode(e))}}function Wr(t){const e=[];let n=-1,o=0,r=0;for(;++n<t.length;){const s=t.charCodeAt(n);let i="";if(s===37&&Ht(t.charCodeAt(n+1))&&Ht(t.charCodeAt(n+2)))r=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(i=String.fromCharCode(s));else if(s>55295&&s<57344){const a=t.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(i=String.fromCharCode(s,a),r=1):i="\uFFFD"}else i=String.fromCharCode(s);i&&(e.push(t.slice(o,n),encodeURIComponent(i)),o=n+r+1,i=""),r&&(n+=r,r=0)}return e.join("")+t.slice(o)}function rt(t,e,n,o){const r=o?o-1:Number.POSITIVE_INFINITY;let s=0;return function(a){return et(a)?(t.enter(n),i(a)):e(a)};function i(a){return et(a)&&s++<r?(t.consume(a),i):(t.exit(n),e(a))}}const RI={tokenize:function(t){const e=t.attempt(this.parser.constructs.contentInitial,function(s){return s===null?void t.consume(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),rt(t,e,"linePrefix"))},function(s){return t.enter("paragraph"),o(s)});let n;return e;function o(s){const i=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=i),n=i,r(s)}function r(s){return s===null?(t.exit("chunkText"),t.exit("paragraph"),void t.consume(s)):Be(s)?(t.consume(s),t.exit("chunkText"),o):(t.consume(s),r)}}},PI={tokenize:function(t){const e=this,n=[];let o,r,s,i=0;return a;function a(v){if(i<n.length){const w=n[i];return e.containerState=w[1],t.attempt(w[0].continuation,l,c)(v)}return c(v)}function l(v){if(i++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,o&&y();const w=e.events.length;let j,C=w;for(;C--;)if(e.events[C][0]==="exit"&&e.events[C][1].type==="chunkFlow"){j=e.events[C][1].end;break}b(i);let N=w;for(;N<e.events.length;)e.events[N][1].end={...j},N++;return gn(e.events,C+1,0,e.events.slice(w)),e.events.length=N,c(v)}return a(v)}function c(v){if(i===n.length){if(!o)return f(v);if(o.currentConstruct&&o.currentConstruct.concrete)return g(v);e.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(Py,d,h)(v)}function d(v){return o&&y(),b(i),f(v)}function h(v){return e.parser.lazy[e.now().line]=i!==n.length,s=e.now().offset,g(v)}function f(v){return e.containerState={},t.attempt(Py,m,g)(v)}function m(v){return i++,n.push([e.currentConstruct,e.containerState]),f(v)}function g(v){return v===null?(o&&y(),b(0),void t.consume(v)):(o=o||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:r}),x(v))}function x(v){return v===null?(p(t.exit("chunkFlow"),!0),b(0),void t.consume(v)):Be(v)?(t.consume(v),p(t.exit("chunkFlow")),i=0,e.interrupt=void 0,a):(t.consume(v),x)}function p(v,w){const j=e.sliceStream(v);if(w&&j.push(null),v.previous=r,r&&(r.next=v),r=v,o.defineSkip(v.start),o.write(j),e.parser.lazy[v.start.line]){let C=o.events.length;for(;C--;)if(o.events[C][1].start.offset<s&&(!o.events[C][1].end||o.events[C][1].end.offset>s))return;const N=e.events.length;let S,E,T=N;for(;T--;)if(e.events[T][0]==="exit"&&e.events[T][1].type==="chunkFlow"){if(S){E=e.events[T][1].end;break}S=!0}for(b(i),C=N;C<e.events.length;)e.events[C][1].end={...E},C++;gn(e.events,T+1,0,e.events.slice(N)),e.events.length=C}}function b(v){let w=n.length;for(;w-- >v;){const j=n[w];e.containerState=j[1],j[0].exit.call(e,t)}n.length=v}function y(){o.write([null]),r=void 0,o=void 0,e.containerState._closeFlow=void 0}}},Py={tokenize:function(t,e,n){return rt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function qr(t){return t===null||ct(t)||dr(t)?1:kl(t)?2:void 0}function Cl(t,e,n){const o=[];let r=-1;for(;++r<t.length;){const s=t[r].resolveAll;s&&!o.includes(s)&&(e=s(e,n),o.push(s))}return e}const uh={name:"attention",resolveAll:function(t,e){let n,o,r,s,i,a,l,c,d=-1;for(;++d<t.length;)if(t[d][0]==="enter"&&t[d][1].type==="attentionSequence"&&t[d][1]._close){for(n=d;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[d][1]).charCodeAt(0)){if((t[n][1]._close||t[d][1]._open)&&(t[d][1].end.offset-t[d][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[d][1].end.offset-t[d][1].start.offset)%3))continue;a=t[n][1].end.offset-t[n][1].start.offset>1&&t[d][1].end.offset-t[d][1].start.offset>1?2:1;const h={...t[n][1].end},f={...t[d][1].start};Ly(h,-a),Ly(f,a),s={type:a>1?"strongSequence":"emphasisSequence",start:h,end:{...t[n][1].end}},i={type:a>1?"strongSequence":"emphasisSequence",start:{...t[d][1].start},end:f},r={type:a>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[d][1].start}},o={type:a>1?"strong":"emphasis",start:{...s.start},end:{...i.end}},t[n][1].end={...s.start},t[d][1].start={...i.end},l=[],t[n][1].end.offset-t[n][1].start.offset&&(l=Sn(l,[["enter",t[n][1],e],["exit",t[n][1],e]])),l=Sn(l,[["enter",o,e],["enter",s,e],["exit",s,e],["enter",r,e]]),l=Sn(l,Cl(e.parser.constructs.insideSpan.null,t.slice(n+1,d),e)),l=Sn(l,[["exit",r,e],["enter",i,e],["exit",i,e],["exit",o,e]]),t[d][1].end.offset-t[d][1].start.offset?(c=2,l=Sn(l,[["enter",t[d][1],e],["exit",t[d][1],e]])):c=0,gn(t,n-1,d-n+3,l),d=n+l.length-c-2;break}}for(d=-1;++d<t.length;)t[d][1].type==="attentionSequence"&&(t[d][1].type="data");return t},tokenize:function(t,e){const n=this.parser.constructs.attentionMarkers.null,o=this.previous,r=qr(o);let s;return function(a){return s=a,t.enter("attentionSequence"),i(a)};function i(a){if(a===s)return t.consume(a),i;const l=t.exit("attentionSequence"),c=qr(a),d=!c||c===2&&r||n.includes(a),h=!r||r===2&&c||n.includes(o);return l._open=!!(s===42?d:d&&(r||!h)),l._close=!!(s===42?h:h&&(c||!d)),e(a)}}};function Ly(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const LI={name:"autolink",tokenize:function(t,e,n){let o=0;return function(f){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),r};function r(f){return Zt(f)?(t.consume(f),s):f===64?n(f):l(f)}function s(f){return f===43||f===45||f===46||Ht(f)?(o=1,i(f)):l(f)}function i(f){return f===58?(t.consume(f),o=0,a):(f===43||f===45||f===46||Ht(f))&&o++<32?(t.consume(f),i):(o=0,l(f))}function a(f){return f===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):f===null||f===32||f===60||wl(f)?n(f):(t.consume(f),a)}function l(f){return f===64?(t.consume(f),c):MI(f)?(t.consume(f),l):n(f)}function c(f){return Ht(f)?d(f):n(f)}function d(f){return f===46?(t.consume(f),o=0,c):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):h(f)}function h(f){if((f===45||Ht(f))&&o++<63){const m=f===45?h:d;return t.consume(f),m}return n(f)}}},fi={partial:!0,tokenize:function(t,e,n){return function(r){return et(r)?rt(t,o,"linePrefix")(r):o(r)};function o(r){return r===null||Be(r)?e(r):n(r)}}},Fy={continuation:{tokenize:function(t,e,n){const o=this;return function(s){return et(s)?rt(t,r,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):r(s)};function r(s){return t.attempt(Fy,e,n)(s)}}},exit:function(t){t.exit("blockQuote")},name:"blockQuote",tokenize:function(t,e,n){const o=this;return function(s){if(s===62){const i=o.containerState;return i.open||(t.enter("blockQuote",{_container:!0}),i.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(s),t.exit("blockQuoteMarker"),r}return n(s)};function r(s){return et(s)?(t.enter("blockQuotePrefixWhitespace"),t.consume(s),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(s))}}},zy={name:"characterEscape",tokenize:function(t,e,n){return function(r){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(r),t.exit("escapeMarker"),o};function o(r){return DI(r)?(t.enter("characterEscapeValue"),t.consume(r),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(r)}}},By={name:"characterReference",tokenize:function(t,e,n){const o=this;let r,s,i=0;return function(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),a};function a(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),l):(t.enter("characterReferenceValue"),r=31,s=Ht,c(d))}function l(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),r=6,s=OI,c):(t.enter("characterReferenceValue"),r=7,s=dh,c(d))}function c(d){if(d===59&&i){const h=t.exit("characterReferenceValue");return s!==Ht||ch(o.sliceSerialize(h))?(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e):n(d)}return s(d)&&i++<r?(t.consume(d),c):n(d)}}},Uy={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return s===null?n(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r)};function r(s){return o.parser.lazy[o.now().line]?n(s):e(s)}}},$y={concrete:!0,name:"codeFenced",tokenize:function(t,e,n){const o=this,r={partial:!0,tokenize:function(v,w,j){let C=0;return N;function N(D){return v.enter("lineEnding"),v.consume(D),v.exit("lineEnding"),S}function S(D){return v.enter("codeFencedFence"),et(D)?rt(v,E,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):E(D)}function E(D){return D===s?(v.enter("codeFencedFenceSequence"),T(D)):j(D)}function T(D){return D===s?(C++,v.consume(D),T):C>=a?(v.exit("codeFencedFenceSequence"),et(D)?rt(v,I,"whitespace")(D):I(D)):j(D)}function I(D){return D===null||Be(D)?(v.exit("codeFencedFence"),w(D)):j(D)}}};let s,i=0,a=0;return function(v){return function(w){const j=o.events[o.events.length-1];return i=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,s=w,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),l(w)}(v)};function l(v){return v===s?(a++,t.consume(v),l):a<3?n(v):(t.exit("codeFencedFenceSequence"),et(v)?rt(t,c,"whitespace")(v):c(v))}function c(v){return v===null||Be(v)?(t.exit("codeFencedFence"),o.interrupt?e(v):t.check(Uy,m,y)(v)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),d(v))}function d(v){return v===null||Be(v)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),c(v)):et(v)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),rt(t,h,"whitespace")(v)):v===96&&v===s?n(v):(t.consume(v),d)}function h(v){return v===null||Be(v)?c(v):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),f(v))}function f(v){return v===null||Be(v)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),c(v)):v===96&&v===s?n(v):(t.consume(v),f)}function m(v){return t.attempt(r,y,g)(v)}function g(v){return t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),x}function x(v){return i>0&&et(v)?rt(t,p,"linePrefix",i+1)(v):p(v)}function p(v){return v===null||Be(v)?t.check(Uy,m,y)(v):(t.enter("codeFlowValue"),b(v))}function b(v){return v===null||Be(v)?(t.exit("codeFlowValue"),p(v)):(t.consume(v),b)}function y(v){return t.exit("codeFenced"),e(v)}}},hh={name:"codeIndented",tokenize:function(t,e,n){const o=this;return function(l){return t.enter("codeIndented"),rt(t,r,"linePrefix",5)(l)};function r(l){const c=o.events[o.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(l):n(l)}function s(l){return l===null?a(l):Be(l)?t.attempt(FI,s,a)(l):(t.enter("codeFlowValue"),i(l))}function i(l){return l===null||Be(l)?(t.exit("codeFlowValue"),s(l)):(t.consume(l),i)}function a(l){return t.exit("codeIndented"),e(l)}}},FI={partial:!0,tokenize:function(t,e,n){const o=this;return r;function r(i){return o.parser.lazy[o.now().line]?n(i):Be(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r):rt(t,s,"linePrefix",5)(i)}function s(i){const a=o.events[o.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(i):Be(i)?r(i):n(i)}}},zI={name:"codeText",previous:function(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"},resolve:function(t){let e,n,o=t.length-4,r=3;if(!(t[r][1].type!=="lineEnding"&&t[r][1].type!=="space"||t[o][1].type!=="lineEnding"&&t[o][1].type!=="space")){for(e=r;++e<o;)if(t[e][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[o][1].type="codeTextPadding",r+=2,o-=2;break}}for(e=r-1,o++;++e<=o;)n===void 0?e!==o&&t[e][1].type!=="lineEnding"&&(n=e):e!==o&&t[e][1].type!=="lineEnding"||(t[n][1].type="codeTextData",e!==n+2&&(t[n][1].end=t[e-1][1].end,t.splice(n+2,e-n-2),o-=e-n-2,e=n+2),n=void 0);return t},tokenize:function(t,e,n){let o,r,s=0;return function(d){return t.enter("codeText"),t.enter("codeTextSequence"),i(d)};function i(d){return d===96?(t.consume(d),s++,i):(t.exit("codeTextSequence"),a(d))}function a(d){return d===null?n(d):d===32?(t.enter("space"),t.consume(d),t.exit("space"),a):d===96?(r=t.enter("codeTextSequence"),o=0,c(d)):Be(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),a):(t.enter("codeTextData"),l(d))}function l(d){return d===null||d===32||d===96||Be(d)?(t.exit("codeTextData"),a(d)):(t.consume(d),l)}function c(d){return d===96?(t.consume(d),o++,c):o===s?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(r.type="codeTextData",l(d))}}};class BI{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const o=n??Number.POSITIVE_INFINITY;return o<this.left.length?this.left.slice(e,o):e>this.left.length?this.right.slice(this.right.length-o+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-o+this.left.length).reverse())}splice(e,n,o){const r=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return o&&mi(this.left,o),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),mi(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),mi(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);mi(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);mi(this.left,n.reverse())}}}function mi(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function Vy(t){const e={};let n,o,r,s,i,a,l,c=-1;const d=new BI(t);for(;++c<d.length;){for(;c in e;)c=e[c];if(n=d.get(c),c&&n[1].type==="chunkFlow"&&d.get(c-1)[1].type==="listItemPrefix"&&(a=n[1]._tokenizer.events,r=0,r<a.length&&a[r][1].type==="lineEndingBlank"&&(r+=2),r<a.length&&a[r][1].type==="content"))for(;++r<a.length&&a[r][1].type!=="content";)a[r][1].type==="chunkText"&&(a[r][1]._isInFirstContentOfListItem=!0,r++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,UI(d,c)),c=e[c],l=!0);else if(n[1]._container){for(r=c,o=void 0;r--;)if(s=d.get(r),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(o&&(d.get(o)[1].type="lineEndingBlank"),s[1].type="lineEnding",o=r);else if(s[1].type!=="linePrefix"&&s[1].type!=="listItemIndent")break;o&&(n[1].end={...d.get(o)[1].start},i=d.slice(o,c),i.unshift(n),d.splice(o,c-o+1,i))}}return gn(t,0,Number.POSITIVE_INFINITY,d.slice(0)),!l}function UI(t,e){const n=t.get(e)[1],o=t.get(e)[2];let r=e-1;const s=[];let i=n._tokenizer;i||(i=o.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(i._contentTypeTextTrailing=!0));const a=i.events,l=[],c={};let d,h,f=-1,m=n,g=0,x=0;const p=[x];for(;m;){for(;t.get(++r)[1]!==m;);s.push(r),m._tokenizer||(d=o.sliceStream(m),m.next||d.push(null),h&&i.defineSkip(m.start),m._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(d),m._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(x=f+1,p.push(x),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(i.events=[],m?(m._tokenizer=void 0,m.previous=void 0):p.pop(),f=p.length;f--;){const b=a.slice(p[f],p[f+1]),y=s.pop();l.push([y,y+b.length-1]),t.splice(y,2,b)}for(l.reverse(),f=-1;++f<l.length;)c[g+l[f][0]]=g+l[f][1],g+=l[f][1]-l[f][0]-1;return c}const $I={resolve:function(t){return Vy(t),t},tokenize:function(t,e){let n;return function(i){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),o(i)};function o(i){return i===null?r(i):Be(i)?t.check(VI,s,r)(i):(t.consume(i),o)}function r(i){return t.exit("chunkContent"),t.exit("content"),e(i)}function s(i){return t.consume(i),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}},VI={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),rt(t,r,"linePrefix")};function r(s){if(s===null||Be(s))return n(s);const i=o.events[o.events.length-1];return!o.parser.constructs.disable.null.includes("codeIndented")&&i&&i[1].type==="linePrefix"&&i[2].sliceSerialize(i[1],!0).length>=4?e(s):t.interrupt(o.parser.constructs.flow,n,e)(s)}}};function Hy(t,e,n,o,r,s,i,a,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return function(p){return p===60?(t.enter(o),t.enter(r),t.enter(s),t.consume(p),t.exit(s),h):p===null||p===32||p===41||wl(p)?n(p):(t.enter(o),t.enter(i),t.enter(a),t.enter("chunkString",{contentType:"string"}),g(p))};function h(p){return p===62?(t.enter(s),t.consume(p),t.exit(s),t.exit(r),t.exit(o),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===62?(t.exit("chunkString"),t.exit(a),h(p)):p===null||p===60||Be(p)?n(p):(t.consume(p),p===92?m:f)}function m(p){return p===60||p===62||p===92?(t.consume(p),f):f(p)}function g(p){return d||p!==null&&p!==41&&!ct(p)?d<c&&p===40?(t.consume(p),d++,g):p===41?(t.consume(p),d--,g):p===null||p===32||p===40||wl(p)?n(p):(t.consume(p),p===92?x:g):(t.exit("chunkString"),t.exit(a),t.exit(i),t.exit(o),e(p))}function x(p){return p===40||p===41||p===92?(t.consume(p),g):g(p)}}function Wy(t,e,n,o,r,s){const i=this;let a,l=0;return function(f){return t.enter(o),t.enter(r),t.consume(f),t.exit(r),t.enter(s),c};function c(f){return l>999||f===null||f===91||f===93&&!a||f===94&&!l&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):f===93?(t.exit(s),t.enter(r),t.consume(f),t.exit(r),t.exit(o),e):Be(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||Be(f)||l++>999?(t.exit("chunkString"),c(f)):(t.consume(f),a||(a=!et(f)),f===92?h:d)}function h(f){return f===91||f===92||f===93?(t.consume(f),l++,d):d(f)}}function qy(t,e,n,o,r,s){let i;return function(h){return h===34||h===39||h===40?(t.enter(o),t.enter(r),t.consume(h),t.exit(r),i=h===40?41:h,a):n(h)};function a(h){return h===i?(t.enter(r),t.consume(h),t.exit(r),t.exit(o),e):(t.enter(s),l(h))}function l(h){return h===i?(t.exit(s),a(i)):h===null?n(h):Be(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),rt(t,l,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(h))}function c(h){return h===i||h===null||Be(h)?(t.exit("chunkString"),l(h)):(t.consume(h),h===92?d:c)}function d(h){return h===i||h===92?(t.consume(h),c):c(h)}}function pi(t,e){let n;return function o(r){return Be(r)?(t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),n=!0,o):et(r)?rt(t,o,n?"linePrefix":"lineSuffix")(r):e(r)}}const HI={name:"definition",tokenize:function(t,e,n){const o=this;let r;return function(h){return t.enter("definition"),function(f){return Wy.call(o,t,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}(h)};function s(h){return r=Rn(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)),h===58?(t.enter("definitionMarker"),t.consume(h),t.exit("definitionMarker"),i):n(h)}function i(h){return ct(h)?pi(t,a)(h):a(h)}function a(h){return Hy(t,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function l(h){return t.attempt(WI,c,c)(h)}function c(h){return et(h)?rt(t,d,"whitespace")(h):d(h)}function d(h){return h===null||Be(h)?(t.exit("definition"),o.parser.defined.push(r),e(h)):n(h)}}},WI={partial:!0,tokenize:function(t,e,n){return function(i){return ct(i)?pi(t,o)(i):n(i)};function o(i){return qy(t,r,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(i)}function r(i){return et(i)?rt(t,s,"whitespace")(i):s(i)}function s(i){return i===null||Be(i)?e(i):n(i)}}},qI={name:"hardBreakEscape",tokenize:function(t,e,n){return function(r){return t.enter("hardBreakEscape"),t.consume(r),o};function o(r){return Be(r)?(t.exit("hardBreakEscape"),e(r)):n(r)}}},GI={name:"headingAtx",resolve:function(t,e){let n,o,r=t.length-2,s=3;return t[s][1].type==="whitespace"&&(s+=2),r-2>s&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(s===r-1||r-4>s&&t[r-2][1].type==="whitespace")&&(r-=s+1===r?2:4),r>s&&(n={type:"atxHeadingText",start:t[s][1].start,end:t[r][1].end},o={type:"chunkText",start:t[s][1].start,end:t[r][1].end,contentType:"text"},gn(t,s,r-s+1,[["enter",n,e],["enter",o,e],["exit",o,e],["exit",n,e]])),t},tokenize:function(t,e,n){let o=0;return function(l){return t.enter("atxHeading"),function(c){return t.enter("atxHeadingSequence"),r(c)}(l)};function r(l){return l===35&&o++<6?(t.consume(l),r):l===null||ct(l)?(t.exit("atxHeadingSequence"),s(l)):n(l)}function s(l){return l===35?(t.enter("atxHeadingSequence"),i(l)):l===null||Be(l)?(t.exit("atxHeading"),e(l)):et(l)?rt(t,s,"whitespace")(l):(t.enter("atxHeadingText"),a(l))}function i(l){return l===35?(t.consume(l),i):(t.exit("atxHeadingSequence"),s(l))}function a(l){return l===null||l===35||ct(l)?(t.exit("atxHeadingText"),s(l)):(t.consume(l),a)}}},YI=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Gy=["pre","script","style","textarea"],KI={concrete:!0,name:"htmlFlow",resolveTo:function(t){let e=t.length;for(;e--&&(t[e][0]!=="enter"||t[e][1].type!=="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t},tokenize:function(t,e,n){const o=this;let r,s,i,a,l;return function(A){return function(U){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(U),c}(A)};function c(A){return A===33?(t.consume(A),d):A===47?(t.consume(A),s=!0,m):A===63?(t.consume(A),r=3,o.interrupt?e:_):Zt(A)?(t.consume(A),i=String.fromCharCode(A),g):n(A)}function d(A){return A===45?(t.consume(A),r=2,h):A===91?(t.consume(A),r=5,a=0,f):Zt(A)?(t.consume(A),r=4,o.interrupt?e:_):n(A)}function h(A){return A===45?(t.consume(A),o.interrupt?e:_):n(A)}function f(A){return A==="CDATA[".charCodeAt(a++)?(t.consume(A),a===6?o.interrupt?e:T:f):n(A)}function m(A){return Zt(A)?(t.consume(A),i=String.fromCharCode(A),g):n(A)}function g(A){if(A===null||A===47||A===62||ct(A)){const U=A===47,V=i.toLowerCase();return U||s||!Gy.includes(V)?YI.includes(i.toLowerCase())?(r=6,U?(t.consume(A),x):o.interrupt?e(A):T(A)):(r=7,o.interrupt&&!o.parser.lazy[o.now().line]?n(A):s?p(A):b(A)):(r=1,o.interrupt?e(A):T(A))}return A===45||Ht(A)?(t.consume(A),i+=String.fromCharCode(A),g):n(A)}function x(A){return A===62?(t.consume(A),o.interrupt?e:T):n(A)}function p(A){return et(A)?(t.consume(A),p):S(A)}function b(A){return A===47?(t.consume(A),S):A===58||A===95||Zt(A)?(t.consume(A),y):et(A)?(t.consume(A),b):S(A)}function y(A){return A===45||A===46||A===58||A===95||Ht(A)?(t.consume(A),y):v(A)}function v(A){return A===61?(t.consume(A),w):et(A)?(t.consume(A),v):b(A)}function w(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(t.consume(A),l=A,j):et(A)?(t.consume(A),w):C(A)}function j(A){return A===l?(t.consume(A),l=null,N):A===null||Be(A)?n(A):(t.consume(A),j)}function C(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||ct(A)?v(A):(t.consume(A),C)}function N(A){return A===47||A===62||et(A)?b(A):n(A)}function S(A){return A===62?(t.consume(A),E):n(A)}function E(A){return A===null||Be(A)?T(A):et(A)?(t.consume(A),E):n(A)}function T(A){return A===45&&r===2?(t.consume(A),O):A===60&&r===1?(t.consume(A),R):A===62&&r===4?(t.consume(A),k):A===63&&r===3?(t.consume(A),_):A===93&&r===5?(t.consume(A),z):!Be(A)||r!==6&&r!==7?A===null||Be(A)?(t.exit("htmlFlowData"),I(A)):(t.consume(A),T):(t.exit("htmlFlowData"),t.check(XI,B,I)(A))}function I(A){return t.check(JI,D,B)(A)}function D(A){return t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),F}function F(A){return A===null||Be(A)?I(A):(t.enter("htmlFlowData"),T(A))}function O(A){return A===45?(t.consume(A),_):T(A)}function R(A){return A===47?(t.consume(A),i="",P):T(A)}function P(A){if(A===62){const U=i.toLowerCase();return Gy.includes(U)?(t.consume(A),k):T(A)}return Zt(A)&&i.length<8?(t.consume(A),i+=String.fromCharCode(A),P):T(A)}function z(A){return A===93?(t.consume(A),_):T(A)}function _(A){return A===62?(t.consume(A),k):A===45&&r===2?(t.consume(A),_):T(A)}function k(A){return A===null||Be(A)?(t.exit("htmlFlowData"),B(A)):(t.consume(A),k)}function B(A){return t.exit("htmlFlow"),e(A)}}},XI={partial:!0,tokenize:function(t,e,n){return function(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(fi,e,n)}}},JI={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return Be(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r):n(s)};function r(s){return o.parser.lazy[o.now().line]?n(s):e(s)}}},ZI={name:"htmlText",tokenize:function(t,e,n){const o=this;let r,s,i;return function(k){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(k),a};function a(k){return k===33?(t.consume(k),l):k===47?(t.consume(k),w):k===63?(t.consume(k),y):Zt(k)?(t.consume(k),N):n(k)}function l(k){return k===45?(t.consume(k),c):k===91?(t.consume(k),s=0,m):Zt(k)?(t.consume(k),b):n(k)}function c(k){return k===45?(t.consume(k),f):n(k)}function d(k){return k===null?n(k):k===45?(t.consume(k),h):Be(k)?(i=d,P(k)):(t.consume(k),d)}function h(k){return k===45?(t.consume(k),f):d(k)}function f(k){return k===62?R(k):k===45?h(k):d(k)}function m(k){return k==="CDATA[".charCodeAt(s++)?(t.consume(k),s===6?g:m):n(k)}function g(k){return k===null?n(k):k===93?(t.consume(k),x):Be(k)?(i=g,P(k)):(t.consume(k),g)}function x(k){return k===93?(t.consume(k),p):g(k)}function p(k){return k===62?R(k):k===93?(t.consume(k),p):g(k)}function b(k){return k===null||k===62?R(k):Be(k)?(i=b,P(k)):(t.consume(k),b)}function y(k){return k===null?n(k):k===63?(t.consume(k),v):Be(k)?(i=y,P(k)):(t.consume(k),y)}function v(k){return k===62?R(k):y(k)}function w(k){return Zt(k)?(t.consume(k),j):n(k)}function j(k){return k===45||Ht(k)?(t.consume(k),j):C(k)}function C(k){return Be(k)?(i=C,P(k)):et(k)?(t.consume(k),C):R(k)}function N(k){return k===45||Ht(k)?(t.consume(k),N):k===47||k===62||ct(k)?S(k):n(k)}function S(k){return k===47?(t.consume(k),R):k===58||k===95||Zt(k)?(t.consume(k),E):Be(k)?(i=S,P(k)):et(k)?(t.consume(k),S):R(k)}function E(k){return k===45||k===46||k===58||k===95||Ht(k)?(t.consume(k),E):T(k)}function T(k){return k===61?(t.consume(k),I):Be(k)?(i=T,P(k)):et(k)?(t.consume(k),T):S(k)}function I(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(t.consume(k),r=k,D):Be(k)?(i=I,P(k)):et(k)?(t.consume(k),I):(t.consume(k),F)}function D(k){return k===r?(t.consume(k),r=void 0,O):k===null?n(k):Be(k)?(i=D,P(k)):(t.consume(k),D)}function F(k){return k===null||k===34||k===39||k===60||k===61||k===96?n(k):k===47||k===62||ct(k)?S(k):(t.consume(k),F)}function O(k){return k===47||k===62||ct(k)?S(k):n(k)}function R(k){return k===62?(t.consume(k),t.exit("htmlTextData"),t.exit("htmlText"),e):n(k)}function P(k){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(k),t.exit("lineEnding"),z}function z(k){return et(k)?rt(t,_,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):_(k)}function _(k){return t.enter("htmlTextData"),i(k)}}},fh={name:"labelEnd",resolveAll:function(t){let e=-1;const n=[];for(;++e<t.length;){const o=t[e][1];if(n.push(t[e]),o.type==="labelImage"||o.type==="labelLink"||o.type==="labelEnd"){const r=o.type==="labelImage"?4:2;o.type="data",e+=r}}return t.length!==n.length&&gn(t,0,t.length,n),t},resolveTo:function(t,e){let n,o,r,s,i=t.length,a=0;for(;i--;)if(n=t[i][1],o){if(n.type==="link"||n.type==="labelLink"&&n._inactive)break;t[i][0]==="enter"&&n.type==="labelLink"&&(n._inactive=!0)}else if(r){if(t[i][0]==="enter"&&(n.type==="labelImage"||n.type==="labelLink")&&!n._balanced&&(o=i,n.type!=="labelLink")){a=2;break}}else n.type==="labelEnd"&&(r=i);const l={type:t[o][1].type==="labelLink"?"link":"image",start:{...t[o][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[o][1].start},end:{...t[r][1].end}},d={type:"labelText",start:{...t[o+a+2][1].end},end:{...t[r-2][1].start}};return s=[["enter",l,e],["enter",c,e]],s=Sn(s,t.slice(o+1,o+a+3)),s=Sn(s,[["enter",d,e]]),s=Sn(s,Cl(e.parser.constructs.insideSpan.null,t.slice(o+a+4,r-3),e)),s=Sn(s,[["exit",d,e],t[r-2],t[r-1],["exit",c,e]]),s=Sn(s,t.slice(r+1)),s=Sn(s,[["exit",l,e]]),gn(t,o,t.length,s),t},tokenize:function(t,e,n){const o=this;let r,s,i=o.events.length;for(;i--;)if((o.events[i][1].type==="labelImage"||o.events[i][1].type==="labelLink")&&!o.events[i][1]._balanced){r=o.events[i][1];break}return function(h){return r?r._inactive?d(h):(s=o.parser.defined.includes(Rn(o.sliceSerialize({start:r.end,end:o.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(h),t.exit("labelMarker"),t.exit("labelEnd"),a):n(h)};function a(h){return h===40?t.attempt(QI,c,s?c:d)(h):h===91?t.attempt(eA,c,s?l:d)(h):s?c(h):d(h)}function l(h){return t.attempt(tA,c,d)(h)}function c(h){return e(h)}function d(h){return r._balanced=!0,n(h)}}},QI={tokenize:function(t,e,n){return function(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),o};function o(d){return ct(d)?pi(t,r)(d):r(d)}function r(d){return d===41?c(d):Hy(t,s,i,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function s(d){return ct(d)?pi(t,a)(d):c(d)}function i(d){return n(d)}function a(d){return d===34||d===39||d===40?qy(t,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):c(d)}function l(d){return ct(d)?pi(t,c)(d):c(d)}function c(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):n(d)}}},eA={tokenize:function(t,e,n){const o=this;return function(i){return Wy.call(o,t,r,s,"reference","referenceMarker","referenceString")(i)};function r(i){return o.parser.defined.includes(Rn(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)))?e(i):n(i)}function s(i){return n(i)}}},tA={tokenize:function(t,e,n){return function(r){return t.enter("reference"),t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),o};function o(r){return r===93?(t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),t.exit("reference"),e):n(r)}}},nA={name:"labelStartImage",resolveAll:fh.resolveAll,tokenize:function(t,e,n){const o=this;return function(i){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(i),t.exit("labelImageMarker"),r};function r(i){return i===91?(t.enter("labelMarker"),t.consume(i),t.exit("labelMarker"),t.exit("labelImage"),s):n(i)}function s(i){return i===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(i):e(i)}}},oA={name:"labelStartLink",resolveAll:fh.resolveAll,tokenize:function(t,e,n){const o=this;return function(s){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelLink"),r};function r(s){return s===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(s):e(s)}}},mh={name:"lineEnding",tokenize:function(t,e){return function(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),rt(t,e,"linePrefix")}}},jl={name:"thematicBreak",tokenize:function(t,e,n){let o,r=0;return function(a){return t.enter("thematicBreak"),function(l){return o=l,s(l)}(a)};function s(a){return a===o?(t.enter("thematicBreakSequence"),i(a)):r>=3&&(a===null||Be(a))?(t.exit("thematicBreak"),e(a)):n(a)}function i(a){return a===o?(t.consume(a),r++,i):(t.exit("thematicBreakSequence"),et(a)?rt(t,s,"whitespace")(a):s(a))}}},rn={continuation:{tokenize:function(t,e,n){const o=this;return o.containerState._closeFlow=void 0,t.check(fi,r,s);function r(a){return o.containerState.furtherBlankLines=o.containerState.furtherBlankLines||o.containerState.initialBlankLine,rt(t,e,"listItemIndent",o.containerState.size+1)(a)}function s(a){return o.containerState.furtherBlankLines||!et(a)?(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,i(a)):(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,t.attempt(sA,e,i)(a))}function i(a){return o.containerState._closeFlow=!0,o.interrupt=void 0,rt(t,t.attempt(rn,e,n),"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}},exit:function(t){t.exit(this.containerState.type)},name:"list",tokenize:function(t,e,n){const o=this,r=o.events[o.events.length-1];let s=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,i=0;return function(f){const m=o.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!o.containerState.marker||f===o.containerState.marker:dh(f)){if(o.containerState.type||(o.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check(jl,n,l)(f):l(f);if(!o.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),a(f)}return n(f)};function a(f){return dh(f)&&++i<10?(t.consume(f),a):(!o.interrupt||i<2)&&(o.containerState.marker?f===o.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),l(f)):n(f)}function l(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),o.containerState.marker=o.containerState.marker||f,t.check(fi,o.interrupt?n:c,t.attempt(rA,h,d))}function c(f){return o.containerState.initialBlankLine=!0,s++,h(f)}function d(f){return et(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),h):n(f)}function h(f){return o.containerState.size=s+o.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}},rA={partial:!0,tokenize:function(t,e,n){const o=this;return rt(t,function(r){const s=o.events[o.events.length-1];return!et(r)&&s&&s[1].type==="listItemPrefixWhitespace"?e(r):n(r)},"listItemPrefixWhitespace",o.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},sA={partial:!0,tokenize:function(t,e,n){const o=this;return rt(t,function(r){const s=o.events[o.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===o.containerState.size?e(r):n(r)},"listItemIndent",o.containerState.size+1)}},Yy={name:"setextUnderline",resolveTo:function(t,e){let n,o,r,s=t.length;for(;s--;)if(t[s][0]==="enter"){if(t[s][1].type==="content"){n=s;break}t[s][1].type==="paragraph"&&(o=s)}else t[s][1].type==="content"&&t.splice(s,1),r||t[s][1].type!=="definition"||(r=s);const i={type:"setextHeading",start:{...t[n][1].start},end:{...t[t.length-1][1].end}};return t[o][1].type="setextHeadingText",r?(t.splice(o,0,["enter",i,e]),t.splice(r+1,0,["exit",t[n][1],e]),t[n][1].end={...t[r][1].end}):t[n][1]=i,t.push(["exit",i,e]),t},tokenize:function(t,e,n){const o=this;let r;return function(a){let l,c=o.events.length;for(;c--;)if(o.events[c][1].type!=="lineEnding"&&o.events[c][1].type!=="linePrefix"&&o.events[c][1].type!=="content"){l=o.events[c][1].type==="paragraph";break}return!o.parser.lazy[o.now().line]&&(o.interrupt||l)?(t.enter("setextHeadingLine"),r=a,function(d){return t.enter("setextHeadingLineSequence"),s(d)}(a)):n(a)};function s(a){return a===r?(t.consume(a),s):(t.exit("setextHeadingLineSequence"),et(a)?rt(t,i,"lineSuffix")(a):i(a))}function i(a){return a===null||Be(a)?(t.exit("setextHeadingLine"),e(a)):n(a)}}},iA={tokenize:function(t){const e=this,n=t.attempt(fi,function(r){return r===null?void t.consume(r):(t.enter("lineEndingBlank"),t.consume(r),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n)},t.attempt(this.parser.constructs.flowInitial,o,rt(t,t.attempt(this.parser.constructs.flow,o,t.attempt($I,o)),"linePrefix")));return n;function o(r){if(r!==null)return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),e.currentConstruct=void 0,n;t.consume(r)}}},aA={resolveAll:Xy()},lA=Ky("string"),cA=Ky("text");function Ky(t){return{resolveAll:Xy(t==="text"?dA:void 0),tokenize:function(e){const n=this,o=this.parser.constructs[t],r=e.attempt(o,s,i);return s;function s(c){return l(c)?r(c):i(c)}function i(c){if(c!==null)return e.enter("data"),e.consume(c),a;e.consume(c)}function a(c){return l(c)?(e.exit("data"),r(c)):(e.consume(c),a)}function l(c){if(c===null)return!0;const d=o[c];let h=-1;if(d)for(;++h<d.length;){const f=d[h];if(!f.previous||f.previous.call(n,n.previous))return!0}return!1}}}}function Xy(t){return function(e,n){let o,r=-1;for(;++r<=e.length;)o===void 0?e[r]&&e[r][1].type==="data"&&(o=r,r++):e[r]&&e[r][1].type==="data"||(r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),r=o+2),o=void 0);return t?t(e,n):e}}function dA(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const o=t[n-1][1],r=e.sliceStream(o);let s,i=r.length,a=-1,l=0;for(;i--;){const c=r[i];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(c===-2)s=!0,l++;else if(c!==-1){i++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(l=0),l){const c={type:n===t.length||s||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:o.start._bufferIndex+a,_index:o.start._index+i,line:o.end.line,column:o.end.column-l,offset:o.end.offset-l},end:{...o.end}};o.end={...c.start},o.start.offset===o.end.offset?Object.assign(o,c):(t.splice(n,0,["enter",c,e],["exit",c,e]),n+=2)}n++}return t}const uA={42:rn,43:rn,45:rn,48:rn,49:rn,50:rn,51:rn,52:rn,53:rn,54:rn,55:rn,56:rn,57:rn,62:Fy},hA={91:HI},fA={[-2]:hh,[-1]:hh,32:hh},mA={35:GI,42:jl,45:[Yy,jl],60:KI,61:Yy,95:jl,96:$y,126:$y},pA={38:By,92:zy},gA={[-5]:mh,[-4]:mh,[-3]:mh,33:nA,38:By,42:uh,60:[LI,ZI],91:oA,92:[qI,zy],93:fh,95:uh,96:zI},xA={null:[uh,aA]},bA=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:hA,disable:{null:[]},document:uA,flow:mA,flowInitial:fA,insideSpan:xA,string:pA,text:gA},Symbol.toStringTag,{value:"Module"}));function yA(t,e,n){let o={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const r={},s=[];let i=[],a=[];const l={attempt:p(function(v,w){b(v,w.from)}),check:p(x),consume:function(v){Be(v)?(o.line++,o.column=1,o.offset+=v===-3?2:1,y()):v!==-1&&(o.column++,o.offset++),o._bufferIndex<0?o._index++:(o._bufferIndex++,o._bufferIndex===i[o._index].length&&(o._bufferIndex=-1,o._index++)),c.previous=v},enter:function(v,w){const j=w||{};return j.type=v,j.start=f(),c.events.push(["enter",j,c]),a.push(j),j},exit:function(v){const w=a.pop();return w.end=f(),c.events.push(["exit",w,c]),w},interrupt:p(x,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(v){r[v.line]=v.column,y()},events:[],now:f,parser:t,previous:null,sliceSerialize:function(v,w){return function(j,C){let N=-1;const S=[];let E;for(;++N<j.length;){const T=j[N];let I;if(typeof T=="string")I=T;else switch(T){case-5:I="\r";break;case-4:I=`
|
|
127
|
+
hover/column:hover:bg-primary/60 dark:hover/column:hover:bg-primary/60`})}const t6=t=>{const e=H.c(10),{width:n}=t,{banners:o}=DF(),{removeBanner:r}=RF();if(o.length===0)return null;const s=n==="columns"&&"sticky left-12 w-full max-w-[80vw]";let i,a,l;if(e[0]!==s?(i=xe("flex flex-col gap-4 mb-5 print:hidden",s),e[0]=s,e[1]=i):i=e[1],e[2]!==o||e[3]!==r){let c;e[5]!==r?(c=d=>u.jsxs(oa,{kind:d.variant||"info",className:"flex flex-col rounded p-3",children:[u.jsxs("div",{className:"flex justify-between",children:[u.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[u.jsx(DC,{className:"w-5 h-5 inline-block mr-2"}),d.title]}),u.jsx(ve,{"data-testid":"remove-banner-button",variant:"text",size:"icon",onClick:()=>r(d.id),children:u.jsx(wn,{className:"w-5 h-5"})})]}),u.jsxs("div",{className:"flex justify-between items-end",children:[u.jsx("span",{children:tp({html:d.description})}),d.action==="restart"&&u.jsx(n6,{})]})]},d.id),e[5]=r,e[6]=c):c=e[6],a=o.map(c),e[2]=o,e[3]=r,e[4]=a}else a=e[4];return e[7]!==i||e[8]!==a?(l=u.jsx("div",{className:i,children:a}),e[7]=i,e[8]=a,e[9]=l):l=e[9],l},n6=()=>{const t=H.c(3),e=Bg();let n,o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=u.jsx(qp,{className:"w-3 h-3 mr-2"}),t[0]=n):n=t[0],t[1]!==e?(o=u.jsxs(ve,{"data-testid":"restart-session-button",variant:"link",size:"xs",onClick:e,children:[n,"Restart"]}),t[1]=e,t[2]=o):o=t[2],o},o6=jt(t=>{const e=t(In);for(const n of e.cellIds.inOrderIds){const o=e.cellRuntime[n];if(o.status==="idle"&&o.consoleOutputs.some(r=>r.channel==="stdin"&&r.response===void 0))return!0}return!1}),r6=()=>{const t=H.c(3),e=s6;if(!Ne(o6))return null;let n,o,r;if(t[0]===Symbol.for("react.memo_cache_sentinel")?(n=u.jsx("div",{className:"flex justify-between",children:u.jsx("span",{className:"font-bold text-lg flex items-center mb-1",children:"Program waiting for input"})}),t[0]=n):n=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(rC,{className:"inline",children:"stdin"}),t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")){const s=u.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-1/2 transform -translate-x-1/2 z-200 opacity-95",children:u.jsxs(oa,{kind:"info",className:"flex flex-col rounded py-2 px-4 animate-in slide-in-from-top w-fit",children:[n,u.jsx("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:u.jsx("div",{children:u.jsxs("p",{children:["The program is still running, but blocked on"," ",o,".",u.jsx(ve,{variant:"link",className:"h-auto font-normal",onClick:e,children:"Jump to the cell"})]})})})]})});r=u.jsx(zc,{milliseconds:2e3,children:s}),t[2]=r}else r=t[2];return r};function s6(){const t=document.querySelector("[data-stdin-blocking]");t?(t.scrollIntoView({behavior:"smooth",block:"center"}),requestAnimationFrame(()=>{t.focus()})):ut.error("No element with data-stdin-blocking found")}function i6(){const t=setTimeout(a6,100);return()=>clearTimeout(t)}function a6(){requestAnimationFrame(l6)}function l6(){const t=function(e){const n=e.match(/scrollTo=([^&]+)/),o=n==null?void 0:n[1];return o?decodeURIComponent(o.split("&")[0]):null}(window.location.hash);if(t)(function(e){var o,r;if(Bb)return;const n=document.querySelector(`[data-cell-name="${e}"]`);if(n){if(n.scrollIntoView({behavior:"smooth",block:"start"}),Bb=!0,n instanceof HTMLElement){n.focus();const{cellHandles:s}=bn(),i=n.dataset.cellId;if(!i)return void ut.error(`Missing cellId for cell with name ${e}`);const a=(r=(o=s[i])==null?void 0:o.current)==null?void 0:r.editorView;a&&a.focus()}}else ut.warn(`Cannot focus cell with name ${e} because it was not found`),zb()})(t);else try{zb()}catch(e){const n=e;ut.warn("Error focusing first editor",n)}}function zb(){var o,r;const{cellIds:t,cellData:e,cellHandles:n}=bn();for(const s of t.iterateTopLevelIds){const i=n[s];if(!((o=e[s])==null?void 0:o.config.hide_code)&&((r=i==null?void 0:i.current)!=null&&r.editorView))return void i.current.editorView.focus()}}let Bb=!1;const c6=t=>{const e=H.c(8),n=Ne(LP),o=t.appConfig.width==="columns";let r,s,i;return e[0]!==t?(r=u.jsx(d6,{...t}),e[0]=t,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(s=u.jsx(I1,{id:"column-container",items:n,strategy:ON,children:r}),e[2]=n,e[3]=r,e[4]=s):s=e[4],e[5]!==o||e[6]!==s?(i=u.jsx(W_,{multiColumn:o,children:s}),e[5]=o,e[6]=s,e[7]=i):i=e[7],i},d6=t=>{const e=H.c(26),{mode:n,userConfig:o,appConfig:r}=t,s=lt(),{theme:i}=vr(),{toggleSidebarPanel:a}=Ui();RC(i6),Dt("global.focusTop",s.focusTopCell),Dt("global.focusBottom",s.focusBottomCell),Dt("global.toggleSidebar",a),Dt("global.foldCode",s.foldAll),Dt("global.unfoldCode",s.unfoldAll),Dt("global.formatAll",f6),Dt("cell.hideCode",Bn.NOOP),Dt("cell.format",Bn.NOOP);const l=wr(),c=FP(),d=l.getColumnIds(),h=s.scrollToTarget;let f,m;e[0]!==c||e[1]!==h?(f=()=>{c!==null&&h()},e[0]=c,e[1]=h,e[2]=f):f=e[2],e[3]!==l||e[4]!==c||e[5]!==h?(m=[l,c,h],e[3]=l,e[4]=c,e[5]=h,e[6]=m):m=e[6],M.useEffect(f,m);const g=PF;let x,p,b,y;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx(A_,{}),p=u.jsx(r6,{}),b=u.jsx(Y_,{}),e[7]=x,e[8]=p,e[9]=b):(x=e[7],p=e[8],b=e[9]),e[10]!==r.width?(y=u.jsx(t6,{width:r.width}),e[10]=r.width,e[11]=y):y=e[11];const v=r.width==="columns"&&"grid grid-flow-col auto-cols-min gap-6";let w;e[12]!==v?(w=xe(v),e[12]=v,e[13]=w):w=e[13];const j=d.map((E,T)=>u.jsx(u6,{columnId:E,index:T,columnsLength:d.length,appConfig:r,mode:n,userConfig:o,theme:i},E));let C,N,S;return e[14]!==w||e[15]!==j?(C=u.jsx("div",{className:w,children:j}),e[14]=w,e[15]=j,e[16]=C):C=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(N=u.jsx(LF,{}),e[17]=N):N=e[17],e[18]!==g||e[19]!==r||e[20]!==C||e[21]!==x||e[22]!==p||e[23]!==b||e[24]!==y?(S=u.jsxs(g,{className:"pb-[40vh]",invisible:!1,appConfig:r,innerClassName:"pr-4",children:[x,p,b,y,C,N]}),e[18]=g,e[19]=r,e[20]=C,e[21]=x,e[22]=p,e[23]=b,e[24]=y,e[25]=S):S=e[25],S},u6=t=>{const e=H.c(54),{columnId:n,index:o,columnsLength:r,appConfig:s,mode:i,userConfig:a,theme:l}=t,c=wr();let d,h,f,m,g,x,p,b,y,v,w,j,C,N,S,E;if(e[0]!==s.width||e[1]!==c||e[2]!==n||e[3]!==r||e[4]!==o||e[5]!==i||e[6]!==l||e[7]!==a){const T=c.get(n);let I;Un(T,`Expected column for: ${n}`),e[22]!==c?(I=c.hasOnlyOneId(),e[22]=c,e[23]=I):I=e[23];const D=I;let F;e[24]!==c.inOrderIds?(F=c.inOrderIds.includes(na),e[24]=c.inOrderIds,e[25]=F):F=e[25];const O=F;h=Fb,w=n,j=o,C=o>0,N=o<r-1,m=s.width,g=r>1;const R=s.width==="columns"&&"opacity-0 group-hover/column:opacity-100";let P;e[26]!==R?(P=xe(R),e[26]=R,e[27]=P):P=e[27],e[28]!==n||e[29]!==P?(x=u.jsx(h6,{columnId:n,className:P}),e[28]=n,e[29]=P,e[30]=x):x=e[30],d=I1,f=`column-${o+1}`,p=T.topLevelIds,b=DN,e[31]!==O||e[32]!==o||e[33]!==i||e[34]!==l||e[35]!==a?(y=o===0&&O&&u.jsx(Mb,{cellId:na,theme:l,showPlaceholder:!1,canDelete:!0,mode:i,userConfig:a,isCollapsed:!1,collapseCount:0,canMoveX:!1},na),e[31]=O,e[32]=o,e[33]=i,e[34]=l,e[35]=a,e[36]=y):y=e[36],v=T.topLevelIds.map(z=>z===na?null:u.jsx(Mb,{cellId:z,theme:l,showPlaceholder:D,canDelete:!D,mode:i,userConfig:a,isCollapsed:T.isCollapsed(z),collapseCount:T.getCount(z),canMoveX:s.width==="columns"},z)),e[0]=s.width,e[1]=c,e[2]=n,e[3]=r,e[4]=o,e[5]=i,e[6]=l,e[7]=a,e[8]=d,e[9]=h,e[10]=f,e[11]=m,e[12]=g,e[13]=x,e[14]=p,e[15]=b,e[16]=y,e[17]=v,e[18]=w,e[19]=j,e[20]=C,e[21]=N}else d=e[8],h=e[9],f=e[10],m=e[11],g=e[12],x=e[13],p=e[14],b=e[15],y=e[16],v=e[17],w=e[18],j=e[19],C=e[20],N=e[21];return e[37]!==d||e[38]!==f||e[39]!==p||e[40]!==b||e[41]!==y||e[42]!==v?(S=u.jsxs(d,{id:f,items:p,strategy:b,children:[y,v]}),e[37]=d,e[38]=f,e[39]=p,e[40]=b,e[41]=y,e[42]=v,e[43]=S):S=e[43],e[44]!==h||e[45]!==m||e[46]!==g||e[47]!==x||e[48]!==S||e[49]!==w||e[50]!==j||e[51]!==C||e[52]!==N?(E=u.jsx(h,{columnId:w,index:j,canMoveLeft:C,canMoveRight:N,width:m,canDelete:g,footer:x,children:S}),e[44]=h,e[45]=m,e[46]=g,e[47]=x,e[48]=S,e[49]=w,e[50]=j,e[51]=C,e[52]=N,e[53]=E):E=e[53],E},h6=t=>{const e=H.c(17),{columnId:n,className:o}=t,{createNewCell:r}=lt(),[s,i]=zP(!1),a=Ne(Ql),l=Ne(Z3);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=xe("mb-0 rounded-none sm:px-4 md:px-5 lg:px-8 tracking-wide no-wrap whitespace-nowrap","hover:bg-accent hover:text-accent-foreground font-semibold uppercase text-xs"),e[0]=c):c=e[0];const d=c;let h;e[1]!==a||e[2]!==n||e[3]!==r||e[4]!==s||e[5]!==i.toggle||e[6]!==l?(h=()=>s?u.jsx(BP,{onClose:i.toggle}):u.jsxs(u.Fragment,{children:[u.jsxs(ve,{className:d,variant:"text",size:"sm",disabled:!l,onClick:()=>r({cellId:{type:"__end__",columnId:n},before:!1}),children:[u.jsx(Kp,{className:"mr-2 size-4 shrink-0"}),"Python"]}),u.jsxs(ve,{className:d,variant:"text",size:"sm",disabled:!l,onClick:()=>{Jn({autoInstantiate:!0,createNewCell:r}),r({cellId:{type:"__end__",columnId:n},before:!1,code:new Bi().defaultCode,hideCode:!0})},children:[u.jsx(Zp,{className:"mr-2 size-4 shrink-0"}),"Markdown"]}),u.jsxs(ve,{className:d,variant:"text",size:"sm",disabled:!l,onClick:()=>{Jn({autoInstantiate:!0,createNewCell:r}),r({cellId:{type:"__end__",columnId:n},before:!1,code:new Rc().defaultCode})},children:[u.jsx(Yo,{className:"mr-2 size-4 shrink-0"}),"SQL"]}),u.jsx(Ee,{content:a?null:u.jsx("span",{children:"Enable via settings under AI Assist"}),delayDuration:100,asChild:!1,children:u.jsxs(ve,{className:d,variant:"text",size:"sm",disabled:!a||!l,onClick:i.toggle,children:[u.jsx(Pi,{className:"mr-2 size-4 shrink-0"}),"Generate with AI"]})})]}),e[1]=a,e[2]=n,e[3]=r,e[4]=s,e[5]=i.toggle,e[6]=l,e[7]=h):h=e[7];const f=h,m=!s&&"w-fit",g=s&&"opacity-100 w-full max-w-4xl shadow-lg shadow-(color:--blue-3)";let x,p,b;return e[8]!==o||e[9]!==m||e[10]!==g?(x=xe("shadow-sm border border-border rounded transition-all duration-200 overflow-hidden divide-x divide-border flex",m,g,o),e[8]=o,e[9]=m,e[10]=g,e[11]=x):x=e[11],e[12]!==f?(p=f(),e[12]=f,e[13]=p):p=e[13],e[14]!==x||e[15]!==p?(b=u.jsx("div",{className:"flex justify-center mt-4 pt-6 pb-32 group gap-4 w-full print:hidden",children:u.jsx("div",{className:x,children:p})}),e[14]=x,e[15]=p,e[16]=b):b=e[16],b};function f6(){X3()}const m6=UP(t=>sC().syncCellIds(t),400),p6=(t,e)=>{Qe.get(ds)||t.isEmpty()||e.isEmpty()||Vi(t.inOrderIds,e.inOrderIds)||m6({cell_ids:t.inOrderIds})},Ub=t=>{const e=H.c(70),{userConfig:n,appConfig:o,hideControls:r}=t,s=r!==void 0&&r;$P(ta,p6);const{setCells:i,mergeAllColumns:a,collapseAllCells:l,expandAllCells:c}=lt(),d=Ne(cm),h=Ne(VP),f=Ne(HP),m=Nm(),g=Ct(kd),{sendComponentValues:x,sendInterrupt:p}=nt(),b=d.mode==="edit",y=d.mode==="present",v=Ne(WP);let w,j;e[0]!==x?(w=()=>(Nj.INSTANCE.start(x),g6),e[0]=x,e[1]=w):w=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[2]=j):j=e[2],M.useEffect(w,j);const C=n.runtime.auto_instantiate;let N,S,E;e[3]!==i||e[4]!==g?(N=(ae,fe)=>{i(ae);const re=ae.map(x6),ue=ae.map(b6),le=ae.map(y6);g({names:re,codes:ue,configs:le,layout:fe})},e[3]=i,e[4]=g,e[5]=N):N=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(S=gC(),e[6]=S):S=e[6],e[7]!==N||e[8]!==n.runtime.auto_instantiate?(E={autoInstantiate:C,setCells:N,sessionId:S},e[7]=N,e[8]=n.runtime.auto_instantiate,e[9]=E):E=e[9];const{connection:T}=FF(E);let I,D;e[10]!==o.app_title||e[11]!==m?(I=()=>{document.title=o.app_title||yn.basename(m??"")||"Untitled Notebook"},D=[o.app_title,m],e[10]=o.app_title,e[11]=m,e[12]=I,e[13]=D):(I=e[12],D=e[13]),M.useEffect(I,D);const F=Nc(o.width);let O,R;e[14]!==o.width||e[15]!==a||e[16]!==F?(O=()=>{F==="columns"&&o.width!=="columns"&&a()},e[14]=o.width,e[15]=a,e[16]=F,e[17]=O):O=e[17],e[18]!==o.width||e[19]!==a||e[20]!==h||e[21]!==F?(R=[o.width,F,a,h],e[18]=o.width,e[19]=a,e[20]=h,e[21]=F,e[22]=R):R=e[22],M.useEffect(O,R);const P=function(){const ae=H.c(2),fe=Is();let re;return ae[0]!==fe?(re=()=>fe(VO(bn())),ae[0]=fe,ae[1]=re):re=ae[1],Fe(re)}(),z=ag(),_=ig();let k,B,A,U,V,X,Y;e[23]!==P?(k=()=>{P()},e[23]=P,e[24]=k):k=e[24],Dt("global.runStale",k),e[25]!==p?(B=()=>{p()},e[25]=p,e[26]=B):B=e[26],Dt("global.interrupt",B),e[27]!==_?(A=()=>{_()},e[27]=_,e[28]=A):A=e[28],Dt("global.hideCode",A),e[29]!==z?(U=()=>{z()},e[29]=z,e[30]=U):U=e[30],Dt("global.runAll",U),e[31]!==l?(V=()=>{l()},e[31]=l,e[32]=V):V=e[32],Dt("global.collapseAllSections",V),e[33]!==c?(X=()=>{c()},e[33]=c,e[34]=X):X=e[34],Dt("global.expandAllSections",X),e[35]!==o||e[36]!==n||e[37]!==d.mode?(Y=u.jsx(c6,{mode:d.mode,userConfig:n,appConfig:o}),e[35]=o,e[36]=n,e[37]=d.mode,e[38]=Y):Y=e[38];const G=Y,W=o.width;let J,$,Q,te,oe,ne,ie,se;return e[39]===Symbol.for("react.memo_cache_sentinel")?(J=xe("pt-4 sm:pt-12 pb-2 mb-4 print:hidden z-50","sticky left-0"),e[39]=J):J=e[39],e[40]!==m||e[41]!==b?($=b&&u.jsx("div",{className:"flex items-center justify-center container",children:u.jsx(P4,{filename:m})}),e[40]=m,e[41]=b,e[42]=$):$=e[42],e[43]!==T||e[44]!==$?(Q=u.jsx(BF,{connection:T,className:J,children:$}),e[43]=T,e[44]=$,e[45]=Q):Q=e[45],e[46]!==o||e[47]!==G||e[48]!==f||e[49]!==d.mode?(te=f&&u.jsx(zF,{appConfig:o,mode:d.mode,children:G}),e[46]=o,e[47]=G,e[48]=f,e[49]=d.mode,e[50]=te):te=e[50],e[51]!==o.width||e[52]!==T||e[53]!==v||e[54]!==Q||e[55]!==te?(oe=u.jsxs(UF,{connection:T,isRunning:v,width:W,children:[Q,te]}),e[51]=o.width,e[52]=T,e[53]=v,e[54]=Q,e[55]=te,e[56]=oe):oe=e[56],e[57]===Symbol.for("react.memo_cache_sentinel")?(ne=u.jsx(G4,{}),e[57]=ne):ne=e[57],e[58]!==o||e[59]!==T||e[60]!==s||e[61]!==y||e[62]!==v||e[63]!==P||e[64]!==p||e[65]!==_?(ie=!s&&u.jsx($c,{children:u.jsx(T4,{presenting:y,onTogglePresenting:_,onInterrupt:p,onRun:P,connectionState:T.state,running:v,appConfig:o})}),e[58]=o,e[59]=T,e[60]=s,e[61]=y,e[62]=v,e[63]=P,e[64]=p,e[65]=_,e[66]=ie):ie=e[66],e[67]!==oe||e[68]!==ie?(se=u.jsxs(u.Fragment,{children:[oe,ne,ie]}),e[67]=oe,e[68]=ie,e[69]=se):se=e[69],se};function g6(){Nj.INSTANCE.stop()}function x6(t){return t.name}function b6(t){return t.code}function y6(t){return t.config}const $b=t=>Ne(qP)[t.capability]?t.children:null,mn=M.forwardRef((t,e)=>{const n=H.c(18);let o,r,s,i,a;n[0]!==t?({children:o,tooltip:a,selected:i,className:r,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i,n[5]=a):(o=n[1],r=n[2],s=n[3],i=n[4],a=n[5]);const l=!i&&"hover:bg-(--sage-3)",c=i&&"bg-(--sage-4)";let d,h;n[6]!==r||n[7]!==l||n[8]!==c?(d=xe("h-full flex items-center p-2 text-sm shadow-inset font-mono cursor-pointer rounded",l,c,r),n[6]=r,n[7]=l,n[8]=c,n[9]=d):d=n[9],n[10]!==o||n[11]!==e||n[12]!==s||n[13]!==d?(h=u.jsx("div",{ref:e,className:d,...s,children:o}),n[10]=o,n[11]=e,n[12]=s,n[13]=d,n[14]=h):h=n[14];const f=h;if(a){let m;return n[15]!==f||n[16]!==a?(m=u.jsx(Ee,{content:a,side:"top",delayDuration:200,children:f}),n[15]=f,n[16]=a,n[17]=m):m=n[17],m}return f});mn.displayName="FooterItem";const v6=()=>{var m,g;const t=H.c(17),e=Ne(PC),n=Ne(Ql),o=((m=e==null?void 0:e.models)==null?void 0:m.chat_model)||LC,r=((g=e==null?void 0:e.models)==null?void 0:g.edit_model)||o,{handleClick:s}=ia();if(!n){let x,p,b;return t[0]!==s?(x=()=>s("ai"),t[0]=s,t[1]=x):x=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(Pi,{className:"h-4 w-4 opacity-60"}),t[2]=p):p=t[2],t[3]!==x?(b=u.jsx(mn,{tooltip:"Assist is disabled",selected:!1,onClick:x,"data-testid":"footer-ai-disabled",children:p}),t[3]=x,t[4]=b):b=t[4],b}let i,a,l,c,d,h,f;return t[5]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx("b",{children:"Chat model:"}),t[5]=i):i=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx("br",{}),l=u.jsx("b",{children:"Edit model:"}),t[6]=a,t[7]=l):(a=t[6],l=t[7]),t[8]!==o||t[9]!==r?(c=u.jsxs(u.Fragment,{children:[i," ",o,a,l," ",r]}),t[8]=o,t[9]=r,t[10]=c):c=t[10],t[11]!==s?(d=()=>s("ai"),t[11]=s,t[12]=d):d=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(Pi,{className:"h-4 w-4"}),t[13]=h):h=t[13],t[14]!==c||t[15]!==d?(f=u.jsx(mn,{tooltip:c,onClick:d,selected:!1,"data-testid":"footer-ai-enabled",children:h}),t[14]=c,t[15]=d,t[16]=f):f=t[16],f},w6=()=>{const t=H.c(26),e=Ne(ln).state,n=Km();let o,r;t[0]!==e||t[1]!==n?(o=async()=>{if(e===Bt.OPEN){if(tn())return{isHealthy:!0,lastChecked:new Date,error:void 0};try{return{isHealthy:await n.isHealthy(),lastChecked:new Date,error:void 0}}catch(w){const j=w;return{isHealthy:!1,lastChecked:new Date,error:j instanceof Error?j.message:"Unknown error"}}}},r=[n,e],t[0]=e,t[1]=n,t[2]=o,t[3]=r):(o=t[2],r=t[3]);const{isFetching:s,error:i,data:a,refetch:l}=Tn(o,r),c=e===Bt.OPEN?3e4:null;let d,h;t[4]!==c?(d={delayMs:c,whenVisible:!0},t[4]=c,t[5]=d):d=t[5],sa(l,d),t[6]!==e||t[7]!==a||t[8]!==i?(h=()=>[Sm(e.toLowerCase()),a!=null&&a.lastChecked?a.isHealthy?"\u2713 Healthy":"\u2717 Unhealthy":"Health: Unknown",i?`Error: ${i}`:""].filter(Boolean).join(`
|
|
128
|
+
`),t[6]=e,t[7]=a,t[8]=i,t[9]=h):h=t[9];const f=h;let m;t[10]!==e||t[11]!==(a==null?void 0:a.isHealthy)||t[12]!==(a==null?void 0:a.lastChecked)||t[13]!==s?(m=()=>s||e===Bt.CONNECTING?u.jsx(kn,{size:"small"}):e===Bt.CLOSING?u.jsx(kn,{className:"text-destructive",size:"small"}):e===Bt.OPEN?a!=null&&a.isHealthy?u.jsx(Yc,{className:"w-4 h-4 text-(--green-9)"}):a!=null&&a.lastChecked?u.jsx(DC,{className:"w-4 h-4 text-(--yellow-9)"}):u.jsx(Yc,{className:"w-4 h-4"}):u.jsx(aa,{className:"w-4 h-4 text-red-500"}),t[10]=e,t[11]=a==null?void 0:a.isHealthy,t[12]=a==null?void 0:a.lastChecked,t[13]=s,t[14]=m):m=t[14];const g=m,x=f();let p,b,y,v;return t[15]!==e?(p=e===Bt.OPEN&&u.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Click to refresh health status"}),t[15]=e,t[16]=p):p=t[16],t[17]!==x||t[18]!==p?(b=u.jsxs("div",{className:"text-sm whitespace-pre-line",children:[x,p]}),t[17]=x,t[18]=p,t[19]=b):b=t[19],t[20]!==g?(y=g(),t[20]=g,t[21]=y):y=t[21],t[22]!==l||t[23]!==b||t[24]!==y?(v=u.jsx(mn,{tooltip:b,selected:!1,onClick:l,"data-testid":"footer-backend-status",children:y}),t[22]=l,t[23]=b,t[24]=y,t[25]=v):v=t[25],v},k6=t=>{const e=H.c(3);let n,o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=u.jsx("path",{d:"M205.28 31.36c14.096 14.88 20.016 35.2 22.512 63.68c6.626 0 12.805 1.47 16.976 7.152l7.792 10.56A17.55 17.55 0 0 1 256 123.2v28.688c-.008 3.704-1.843 7.315-4.832 9.504C215.885 187.222 172.35 208 128 208c-49.066 0-98.19-28.273-123.168-46.608c-2.989-2.189-4.825-5.8-4.832-9.504V123.2c0-3.776 1.2-7.424 3.424-10.464l7.792-10.544c4.173-5.657 10.38-7.152 16.992-7.152c2.496-28.48 8.4-48.8 22.512-63.68C77.331 3.165 112.567.06 127.552 0H128c14.72 0 50.4 2.88 77.28 31.36m-77.264 47.376c-3.04 0-6.544.176-10.272.544c-1.312 4.896-3.248 9.312-6.08 12.128c-11.2 11.2-24.704 12.928-31.936 12.928c-6.802 0-13.927-1.42-19.744-5.088c-5.502 1.808-10.786 4.415-11.136 10.912c-.586 12.28-.637 24.55-.688 36.824c-.026 6.16-.05 12.322-.144 18.488c.024 3.579 2.182 6.903 5.44 8.384C79.936 185.92 104.976 192 128.016 192c23.008 0 48.048-6.08 74.512-18.144c3.258-1.48 5.415-4.805 5.44-8.384c.317-18.418.062-36.912-.816-55.312h.016c-.342-6.534-5.648-9.098-11.168-10.912c-5.82 3.652-12.927 5.088-19.728 5.088c-7.232 0-20.72-1.728-31.936-12.928c-2.832-2.816-4.768-7.232-6.08-12.128a106 106 0 0 0-10.24-.544m-26.941 43.93c5.748 0 10.408 4.66 10.408 10.409v19.183c0 5.749-4.66 10.409-10.408 10.409s-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408m53.333 0c5.749 0 10.409 4.66 10.409 10.409v19.183c0 5.749-4.66 10.409-10.409 10.409c-5.748 0-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408M81.44 28.32c-11.2 1.12-20.64 4.8-25.44 9.92c-10.4 11.36-8.16 40.16-2.24 46.24c4.32 4.32 12.48 7.2 21.28 7.2c6.72 0 19.52-1.44 30.08-12.16c4.64-4.48 7.52-15.68 7.2-27.04c-.32-9.12-2.88-16.64-6.72-19.84c-4.16-3.68-13.6-5.28-24.16-4.32m68.96 4.32c-3.84 3.2-6.4 10.72-6.72 19.84c-.32 11.36 2.56 22.56 7.2 27.04c10.56 10.72 23.36 12.16 30.08 12.16c8.8 0 16.96-2.88 21.28-7.2c5.92-6.08 8.16-34.88-2.24-46.24c-4.8-5.12-14.24-8.8-25.44-9.92c-10.56-.96-20 .64-24.16 4.32M128 56c-2.56 0-5.6.16-8.96.48c.32 1.76.48 3.68.64 5.76c0 1.44 0 2.88-.16 4.48c3.2-.32 5.92-.32 8.48-.32s5.28 0 8.48.32c-.16-1.6-.16-3.04-.16-4.48c.16-2.08.32-4 .64-5.76c-3.36-.32-6.4-.48-8.96-.48"}),e[0]=n):n=e[0],e[1]!==t?(o=u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.24em",height:"1em",viewBox:"0 0 256 208",fill:"currentColor",...t,children:n}),e[1]=t,e[2]=o):o=e[2],o},C6=jt(t=>t(GP).completion.copilot),j6=()=>{const t=H.c(1);if(Ne(C6)==="github"){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(S6,{}),t[0]=e):e=t[0],e}return null},Vb=ut.get("[copilot-status-bar]"),S6=()=>{const t=Ne(gj),e=Ne(kF)!==null,{handleClick:n}=ia(),o=()=>n("ai"),r=t?"Ready":"Not connected",s=Ct(gj),i=Ct(CF);return RC(()=>{const a=pj();let l=!0;return(async()=>{try{if(await a.initializePromise.catch(d=>{throw Vb.error("Failed to initialize",d),a.close(),d}),!l)return;const c=await a.signedIn();if(!l)return;s(c),i(c?"signedIn":"signedOut")}catch(c){if(!l)return;Vb.warn("Connection failed",c),s(!1),i("connectionError"),Je({title:"GitHub Copilot Connection Error",description:"Failed to connect to GitHub Copilot. Check settings and try again.",variant:"danger",action:u.jsx(ve,{variant:"link",onClick:o,children:"Settings"})})}})(),()=>{l=!1}}),u.jsx(mn,{tooltip:u.jsxs(u.Fragment,{children:[u.jsx("b",{children:"GitHub Copilot:"})," ",r]}),selected:!1,onClick:o,"data-testid":"footer-copilot-status",children:u.jsx("span",{children:e?u.jsx(kn,{className:"h-4 w-4"}):u.jsx(k6,{className:xe("h-4 w-4",!t&&"opacity-60")})})})},N6=()=>{const t=H.c(18),[e,n]=M.useState(0),o=Ne(ln),{getUsageStats:r}=nt();let s,i,a,l;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>n(A6),i={delayMs:1e4,whenVisible:!0},t[0]=s,t[1]=i):(s=t[0],i=t[1]),sa(s,i),t[2]!==o.state||t[3]!==r?(a=async()=>tn()||o.state!==Bt.OPEN?null:r(),t[2]=o.state,t[3]=r,t[4]=a):a=t[4],t[5]!==o.state||t[6]!==e?(l=[e,o.state],t[5]=o.state,t[6]=e,t[7]=l):l=t[7];const{data:c}=Tn(a,l);let d,h,f,m;return t[8]!==c?(d=(c==null?void 0:c.gpu)&&c.gpu.length>0&&u.jsx(I6,{gpus:c.gpu}),t[8]=c,t[9]=d):d=t[9],t[10]!==c?(h=c&&u.jsx(E6,{memory:c.memory,kernel:c.kernel,server:c.server}),t[10]=c,t[11]=h):h=t[11],t[12]!==c?(f=c&&u.jsx(_6,{cpu:c.cpu}),t[12]=c,t[13]=f):f=t[13],t[14]!==d||t[15]!==h||t[16]!==f?(m=u.jsxs("div",{className:"flex gap-2 items-center px-1",children:[d,h,f]}),t[14]=d,t[15]=h,t[16]=f,t[17]=m):m=t[17],m},E6=t=>{const e=H.c(25),{memory:n,kernel:o,server:r}=t,{percent:s,total:i,available:a}=n;let l;e[0]!==s?(l=Math.round(s),e[0]=s,e[1]=l):l=e[1];const c=l;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx("b",{children:"computer memory:"}),e[2]=d):d=e[2];const h=i-a;let f,m,g,x,p,b,y,v,w;return e[3]!==h?(f=Vu(h),e[3]=h,e[4]=f):f=e[4],e[5]!==i?(m=Vu(i),e[5]=i,e[6]=m):m=e[6],e[7]!==c||e[8]!==f||e[9]!==m?(g=u.jsxs("span",{children:[d," ",f," / ",m," GB (",c,"%)"]}),e[7]=c,e[8]=f,e[9]=m,e[10]=g):g=e[10],e[11]!==r?(x=(r==null?void 0:r.memory)&&u.jsxs("span",{children:[u.jsx("b",{children:"marimo server:"})," ",ml(r.memory)]}),e[11]=r,e[12]=x):x=e[12],e[13]!==o?(p=(o==null?void 0:o.memory)&&u.jsxs("span",{children:[u.jsx("b",{children:"kernel:"})," ",ml(o.memory)]}),e[13]=o,e[14]=p):p=e[14],e[15]!==g||e[16]!==x||e[17]!==p?(b=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,x,p]}),e[15]=g,e[16]=x,e[17]=p,e[18]=b):b=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?(y=u.jsx(Lp,{className:"w-4 h-4"}),e[19]=y):y=e[19],e[20]!==c?(v=u.jsxs("div",{className:"flex items-center gap-1","data-testid":"memory-usage-bar",children:[y,u.jsx($u,{percent:c,colorClassName:"bg-primary"})]}),e[20]=c,e[21]=v):v=e[21],e[22]!==v||e[23]!==b?(w=u.jsx(Ee,{delayDuration:200,content:b,children:v}),e[22]=v,e[23]=b,e[24]=w):w=e[24],w},_6=t=>{const e=H.c(11),{cpu:n}=t,{percent:o}=n;let r;e[0]!==o?(r=Math.round(o),e[0]=o,e[1]=r):r=e[1];const s=r;let i,a,l,c,d;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx("b",{children:"CPU:"}),e[2]=i):i=e[2],e[3]!==s?(a=u.jsxs("span",{children:[i," ",s,"%"]}),e[3]=s,e[4]=a):a=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(jF,{className:"w-4 h-4"}),e[5]=l):l=e[5],e[6]!==s?(c=u.jsxs("div",{className:"flex items-center gap-1","data-testid":"cpu-bar",children:[l,u.jsx($u,{percent:s,colorClassName:"bg-primary"})]}),e[6]=s,e[7]=c):c=e[7],e[8]!==a||e[9]!==c?(d=u.jsx(Ee,{delayDuration:200,content:a,children:c}),e[8]=a,e[9]=c,e[10]=d):d=e[10],d},I6=t=>{const e=H.c(12),{gpus:n}=t;let o;e[0]!==n?(o=Math.round(n.reduce(T6,0)/n.length),e[0]=n,e[1]=o):o=e[1];const r=o;let s,i,a,l,c;return e[2]!==n?(s=n.map(M6),e[2]=n,e[3]=s):s=e[3],e[4]!==s?(i=u.jsx("div",{className:"flex flex-col gap-1",children:s}),e[4]=s,e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(zp,{className:"w-4 h-4"}),e[6]=a):a=e[6],e[7]!==r?(l=u.jsxs("div",{className:"flex items-center gap-1","data-testid":"gpu-bar",children:[a,u.jsx($u,{percent:r,colorClassName:"bg-(--grass-9)"})]}),e[7]=r,e[8]=l):l=e[8],e[9]!==i||e[10]!==l?(c=u.jsx(Ee,{delayDuration:200,content:i,children:l}),e[9]=i,e[10]=l,e[11]=c):c=e[11],c},$u=t=>{const e=H.c(7),{percent:n,colorClassName:o}=t;let r;e[0]!==o?(r=xe("h-full bg-primary",o),e[0]=o,e[1]=r):r=e[1];const s=`${n}%`;let i,a;return e[2]!==s?(i={width:s},e[2]=s,e[3]=i):i=e[3],e[4]!==r||e[5]!==i?(a=u.jsx("div",{className:"h-3 w-20 bg-(--slate-4) rounded-lg overflow-hidden border",children:u.jsx("div",{className:r,style:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a};function ml(t){return t>1073741824?`${Vu(t)} GB`:`${function(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(e/1048576)}(t)} MB`}function Vu(t){return new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(t/1073741824)}function A6(t){return t+1}function T6(t,e){return t+e.memory.percent}function M6(t){return u.jsxs("span",{children:[u.jsxs("b",{children:["GPU ",t.index," (",t.name,"):"]})," ",ml(t.memory.used)," / ",ml(t.memory.total)," GB (",Math.round(t.memory.percent),"%)"]},t.index)}const Hb=jt(!1);function Hu(t,e,n=new Set){if(n.has(t))return new Set;n.add(t);const o=new Set;for(const r of e(t)){o.add(r);for(const s of Hu(r,e,n))o.add(s)}return o}const O6=jt(t=>{const e=t(ta),n=t(kc);return function(o,r){var a,l,c;const s=new Map;for(const d of o)s.set(d,{variables:new Set,parents:new Set,children:new Set});for(const d of Object.values(r))if(d.dataType!=="module")for(const h of d.declaredBy){(a=s.get(h))==null||a.variables.add(d.name);for(const f of d.usedBy)h!==f&&((l=s.get(f))==null||l.parents.add(h),(c=s.get(h))==null||c.children.add(f))}const i={};for(const[d,h]of s.entries())i[d]={parents:h.parents,children:h.children,variables:[...h.variables],ancestors:Hu(d,f=>{var m;return((m=s.get(f))==null?void 0:m.parents)??new Set}),descendants:Hu(d,f=>{var m;return((m=s.get(f))==null?void 0:m.children)??new Set})};return i}(e.inOrderIds,n)});function D6(t,e){return e?t.usedBy.includes(e.id)||t.declaredBy.includes(e.id)?!0:t.declaredBy.some(n=>e.graph.parents.has(n))?t.usedBy.some(n=>e.graph.parents.has(n)):!!t.declaredBy.some(n=>e.graph.children.has(n)):!1}const R6=()=>{const t=H.c(6),[e,n]=zt(Hb);let o,r,s;return t[0]!==n?(o=()=>n(P6),t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(Pp,{className:"h-4 w-4"}),t[2]=r):r=t[2],t[3]!==e||t[4]!==o?(s=u.jsx(mn,{tooltip:"Toggle Minimap",selected:e,onClick:o,"data-testid":"footer-minimap",children:r}),t[3]=e,t[4]=o,t[5]=s):s=t[5],s};function P6(t){return!t}const L6=()=>{const t=H.c(13),e=Ne(Rr),[n,o]=zt(xC),[r,s]=M.useState(!1);if(!Pc()||e==="disabled")return null;const i=e?"Real-time collaboration active":"Connecting to real-time collaboration";let a,l,c,d,h,f;return t[0]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(og,{className:"w-4 h-4"}),t[0]=a):a=t[0],t[1]!==i?(l=u.jsx(ws,{asChild:!0,children:u.jsx(mn,{tooltip:i,selected:!1,"data-testid":"footer-rtc-status",children:a})}),t[1]=i,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsxs("div",{className:"space-y-2",children:[u.jsx("h4",{className:"font-medium leading-none",children:"Username"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Set your username for real-time collaboration"})]}),t[3]=c):c=t[3],t[4]!==o?(d=m=>o(m.target.value),t[4]=o,t[5]=d):d=t[5],t[6]!==d||t[7]!==n?(h=u.jsx(ps,{className:"w-80",children:u.jsxs("div",{className:"space-y-4",children:[c,u.jsx(qo,{value:n,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",onChange:d,placeholder:"Enter your username"})]})}),t[6]=d,t[7]=n,t[8]=h):h=t[8],t[9]!==r||t[10]!==l||t[11]!==h?(f=u.jsxs(br,{open:r,onOpenChange:s,children:[l,h]}),t[9]=r,t[10]=l,t[11]=h,t[12]=f):f=t[12],f},F6=t=>{const e=H.c(104),{className:n}=t,{saveUserConfig:o}=nt(),[r,s]=YP(),i=xr()[0],[a,l]=M.useState(!1);let c,d,h;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>{const Ie=window.matchMedia("(min-width: 768px)"),ke=()=>{Ie.matches&&l(!1)};return Ie.addEventListener("change",ke),()=>Ie.removeEventListener("change",ke)},d=[],e[0]=c,e[1]=d):(c=e[0],d=e[1]),M.useEffect(c,d),e[2]!==i||e[3]!==o||e[4]!==s?(h=async Ie=>{const ke={...i,runtime:{...i.runtime,auto_instantiate:Ie}};await o({config:ke}).then(()=>s(ke))},e[2]=i,e[3]=o,e[4]=s,e[5]=h):h=e[5];const f=h;let m;e[6]!==o||e[7]!==s||e[8]!==r?(m=async Ie=>{const ke={...r,runtime:{...r.runtime,on_cell_change:Ie?"autorun":"lazy"}};await o({config:ke}).then(()=>s(ke))},e[6]=o,e[7]=s,e[8]=r,e[9]=m):m=e[9];const g=m;let x;e[10]!==o||e[11]!==s||e[12]!==r?(x=async Ie=>{const ke={...r,runtime:{...r.runtime,auto_reload:Ie}};await o({config:ke}).then(()=>s(ke))},e[10]=o,e[11]=s,e[12]=r,e[13]=x):x=e[13];const p=x;let b;e[14]!==i.runtime.auto_instantiate||e[15]!==i.runtime.auto_reload||e[16]!==i.runtime.on_cell_change?(b=!i.runtime.auto_instantiate&&i.runtime.on_cell_change==="lazy"&&(tn()||i.runtime.auto_reload!=="autorun"),e[14]=i.runtime.auto_instantiate,e[15]=i.runtime.auto_reload,e[16]=i.runtime.on_cell_change,e[17]=b):b=e[17];const y=b;let v;e[18]!==n?(v=xe("flex items-center",n),e[18]=n,e[19]=v):v=e[19];const w=i.runtime.auto_instantiate?"Disable autorun on startup":"Enable autorun on startup";let j,C,N;e[20]!==i.runtime.auto_instantiate||e[21]!==f?(j=()=>f(!i.runtime.auto_instantiate),e[20]=i.runtime.auto_instantiate,e[21]=f,e[22]=j):j=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(C=u.jsx("span",{children:"on startup: "}),e[23]=C):C=e[23],e[24]!==i.runtime.auto_instantiate?(N=i.runtime.auto_instantiate?u.jsx(hn,{size:14}):u.jsx(un,{size:14}),e[24]=i.runtime.auto_instantiate,e[25]=N):N=e[25];const S=i.runtime.auto_instantiate?"autorun":"lazy";let E,T,I,D;e[26]!==S?(E=u.jsx("span",{children:S}),e[26]=S,e[27]=E):E=e[27],e[28]!==N||e[29]!==E?(T=u.jsxs("div",{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[C,N,E]}),e[28]=N,e[29]=E,e[30]=T):T=e[30],e[31]!==T||e[32]!==w||e[33]!==j?(I=u.jsx(Ns,{name:"runtime.auto_instantiate",children:u.jsx(mn,{tooltip:w,selected:!1,onClick:j,"data-testid":"footer-autorun-startup",children:T})}),e[31]=T,e[32]=w,e[33]=j,e[34]=I):I=e[34],e[35]===Symbol.for("react.memo_cache_sentinel")?(D=u.jsx("div",{className:"border-r border-border h-6 mx-1"}),e[35]=D):D=e[35];const F=i.runtime.on_cell_change==="autorun"?"Disable autorun":"Enable autorun";let O,R,P,z,_,k,B,A,U,V,X,Y,G;e[36]!==i.runtime.on_cell_change||e[37]!==g?(O=()=>g(i.runtime.on_cell_change!=="autorun"),e[36]=i.runtime.on_cell_change,e[37]=g,e[38]=O):O=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(R=u.jsx("span",{children:"on cell change: "}),e[39]=R):R=e[39],e[40]!==i.runtime.on_cell_change?(P=u.jsxs("div",{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[R,i.runtime.on_cell_change==="autorun"?u.jsx(hn,{size:14}):u.jsx(un,{size:14}),u.jsx("span",{children:i.runtime.on_cell_change})]}),e[40]=i.runtime.on_cell_change,e[41]=P):P=e[41],e[42]!==F||e[43]!==O||e[44]!==P?(z=u.jsx(Ns,{name:"runtime.on_cell_change",children:u.jsx(mn,{tooltip:F,selected:!1,onClick:O,"data-testid":"footer-autorun-cell-change",children:P})}),e[42]=F,e[43]=O,e[44]=P,e[45]=z):z=e[45],e[46]!==i.runtime.auto_reload||e[47]!==p?(_=!tn()&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"border-r border-border h-6 mx-1"}),u.jsx(Ns,{name:"runtime.auto_reload",children:u.jsx(mn,{tooltip:null,selected:!1,"data-testid":"footer-module-reload",children:u.jsxs(Eo,{children:[u.jsxs(_o,{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[u.jsx("span",{children:"on module change: "}),i.runtime.auto_reload==="off"&&u.jsx(aa,{size:14}),i.runtime.auto_reload==="lazy"&&u.jsx(un,{size:14}),i.runtime.auto_reload==="autorun"&&u.jsx(hn,{size:14}),u.jsx("span",{children:i.runtime.auto_reload}),u.jsx(No,{size:14})]}),u.jsx(Io,{children:["off","lazy","autorun"].map(Ie=>u.jsxs(At,{onClick:()=>p(Ie),children:[Ie==="off"&&u.jsx(aa,{size:14,className:"mr-2 text-muted-foreground"}),Ie==="lazy"&&u.jsx(un,{size:14,className:"mr-2 text-muted-foreground"}),Ie==="autorun"&&u.jsx(hn,{size:14,className:"mr-2 text-muted-foreground"}),Ie]},Ie))})]})})})]}),e[46]=i.runtime.auto_reload,e[47]=p,e[48]=_):_=e[48],e[49]!==I||e[50]!==z||e[51]!==_?(k=u.jsxs("div",{className:"hidden md:flex md:items-center",children:[I,D,z,_]}),e[49]=I,e[50]=z,e[51]=_,e[52]=k):k=e[52],e[53]!==y?(B=y?u.jsx(un,{size:16,className:"text-muted-foreground"}):u.jsx(hn,{size:16,className:"text-amber-500"}),e[53]=y,e[54]=B):B=e[54],e[55]===Symbol.for("react.memo_cache_sentinel")?(A=u.jsx(No,{size:14}),e[55]=A):A=e[55],e[56]!==B?(U=u.jsx(_o,{asChild:!0,children:u.jsx(mn,{tooltip:"Runtime reactivity",selected:!1,"data-testid":"footer-runtime-settings",children:u.jsxs("div",{className:"flex items-center gap-1",children:[B,A]})})}),e[56]=B,e[57]=U):U=e[57],e[58]===Symbol.for("react.memo_cache_sentinel")?(V=u.jsx(O3,{children:"Runtime reactivity"}),X=u.jsx(an,{}),e[58]=V,e[59]=X):(V=e[58],X=e[59]),e[60]!==i.runtime.auto_instantiate?(Y=i.runtime.auto_instantiate?u.jsx(hn,{size:14,className:"text-amber-500"}):u.jsx(un,{size:14,className:"text-muted-foreground"}),e[60]=i.runtime.auto_instantiate,e[61]=Y):Y=e[61],e[62]===Symbol.for("react.memo_cache_sentinel")?(G=u.jsx("div",{className:"text-sm font-medium",children:"On startup"}),e[62]=G):G=e[62];const W=i.runtime.auto_instantiate?"autorun":"lazy";let J,$,Q,te,oe,ne,ie,se,ae;e[63]!==W?(J=u.jsxs("div",{children:[G,u.jsx("div",{className:"text-xs text-muted-foreground",children:W})]}),e[63]=W,e[64]=J):J=e[64],e[65]!==Y||e[66]!==J?($=u.jsxs("div",{className:"flex items-center space-x-2",children:[Y,J]}),e[65]=Y,e[66]=J,e[67]=$):$=e[67],e[68]!==i.runtime.auto_instantiate||e[69]!==f?(Q=u.jsx(pm,{checked:i.runtime.auto_instantiate,onCheckedChange:f,size:"sm"}),e[68]=i.runtime.auto_instantiate,e[69]=f,e[70]=Q):Q=e[70],e[71]!==$||e[72]!==Q?(te=u.jsx(Ns,{name:"runtime.auto_instantiate",children:u.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[$,Q]})}),e[71]=$,e[72]=Q,e[73]=te):te=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(oe=u.jsx(an,{}),e[74]=oe):oe=e[74],e[75]!==i.runtime.on_cell_change?(ne=i.runtime.on_cell_change==="autorun"?u.jsx(hn,{size:14,className:"text-amber-500"}):u.jsx(un,{size:14,className:"text-muted-foreground"}),e[75]=i.runtime.on_cell_change,e[76]=ne):ne=e[76],e[77]===Symbol.for("react.memo_cache_sentinel")?(ie=u.jsx("div",{className:"text-sm font-medium",children:"On cell change"}),e[77]=ie):ie=e[77],e[78]!==i.runtime.on_cell_change?(se=u.jsxs("div",{children:[ie,u.jsx("div",{className:"text-xs text-muted-foreground",children:i.runtime.on_cell_change})]}),e[78]=i.runtime.on_cell_change,e[79]=se):se=e[79],e[80]!==ne||e[81]!==se?(ae=u.jsxs("div",{className:"flex items-center space-x-2",children:[ne,se]}),e[80]=ne,e[81]=se,e[82]=ae):ae=e[82];const fe=i.runtime.on_cell_change==="autorun";let re,ue,le,je,Se,Le;return e[83]!==g||e[84]!==fe?(re=u.jsx(pm,{checked:fe,onCheckedChange:g,size:"sm"}),e[83]=g,e[84]=fe,e[85]=re):re=e[85],e[86]!==ae||e[87]!==re?(ue=u.jsx(Ns,{name:"runtime.on_cell_change",children:u.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[ae,re]})}),e[86]=ae,e[87]=re,e[88]=ue):ue=e[88],e[89]!==i.runtime.auto_reload||e[90]!==p?(le=!tn()&&u.jsxs(u.Fragment,{children:[u.jsx(an,{}),u.jsx(Ns,{name:"runtime.auto_reload",children:u.jsxs("div",{className:"px-2 py-1",children:[u.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[i.runtime.auto_reload==="off"&&u.jsx(aa,{size:14,className:"text-muted-foreground"}),i.runtime.auto_reload==="lazy"&&u.jsx(un,{size:14,className:"text-muted-foreground"}),i.runtime.auto_reload==="autorun"&&u.jsx(hn,{size:14,className:"text-amber-500"}),u.jsxs("div",{children:[u.jsx("div",{className:"text-sm font-medium",children:"On module change"}),u.jsx("div",{className:"text-xs text-muted-foreground",children:i.runtime.auto_reload})]})]}),u.jsx("div",{className:"space-y-1",children:["off","lazy","autorun"].map(Ie=>u.jsxs("button",{onClick:()=>p(Ie),className:xe("w-full flex items-center px-2 py-1 text-sm rounded hover:bg-accent",Ie===i.runtime.auto_reload&&"bg-accent"),children:[Ie==="off"&&u.jsx(aa,{size:12,className:"mr-2"}),Ie==="lazy"&&u.jsx(un,{size:12,className:"mr-2"}),Ie==="autorun"&&u.jsx(hn,{size:12,className:"mr-2"}),u.jsx("span",{className:"capitalize",children:Ie}),Ie===i.runtime.auto_reload&&u.jsx("span",{className:"ml-auto",children:"\u2713"})]},Ie))})]})})]}),e[89]=i.runtime.auto_reload,e[90]=p,e[91]=le):le=e[91],e[92]!==te||e[93]!==ue||e[94]!==le?(je=u.jsxs(Io,{align:"start",className:"w-64",children:[V,X,te,oe,ue,le]}),e[92]=te,e[93]=ue,e[94]=le,e[95]=je):je=e[95],e[96]!==a||e[97]!==U||e[98]!==je?(Se=u.jsx("div",{className:"flex md:hidden",children:u.jsxs(Eo,{open:a,onOpenChange:l,children:[U,je]})}),e[96]=a,e[97]=U,e[98]=je,e[99]=Se):Se=e[99],e[100]!==k||e[101]!==Se||e[102]!==v?(Le=u.jsxs("div",{className:v,children:[k,Se]}),e[100]=k,e[101]=Se,e[102]=v,e[103]=Le):Le=e[103],Le},z6=()=>{const t=H.c(24),{selectedPanel:e,isTerminalOpen:n}=pc(),{toggleApplication:o,toggleTerminal:r}=Ui(),s=Ne(KP),i=B6,a=hd.find(U6);let l;Un(a,"Error panel not found"),t[0]!==r?(l=()=>{r()},t[0]=r,t[1]=l):l=t[1],Dt("global.toggleTerminal",l);const c=mn,d=a.tooltip,h=e===a.type,f=()=>o(a.type),m=i(a,s>0?"text-destructive":"");let g,x,p,b,y,v,w,j,C,N;return t[2]!==s?(g=u.jsx("span",{className:"ml-1 font-mono mt-0.5",children:s}),t[2]=s,t[3]=g):g=t[3],t[4]!==c||t[5]!==a||t[6]!==h||t[7]!==f||t[8]!==m||t[9]!==g?(x=u.jsxs(c,{tooltip:d,selected:h,onClick:f,"data-testid":"footer-errors",children:[m,g]}),t[4]=c,t[5]=a,t[6]=h,t[7]=f,t[8]=m,t[9]=g,t[10]=x):x=t[10],t[11]!==r?(p=()=>r(),t[11]=r,t[12]=p):p=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(tg,{className:"h-5 w-5"}),t[13]=b):b=t[13],t[14]!==n||t[15]!==p?(y=u.jsx($b,{capability:"terminal",children:u.jsx(mn,{tooltip:"Open terminal",selected:n,onClick:p,"data-testid":"footer-terminal",children:b})}),t[14]=n,t[15]=p,t[16]=y):y=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(v=u.jsx(F6,{}),w=u.jsx("div",{className:"mx-auto"}),t[17]=v,t[18]=w):(v=t[17],w=t[18]),t[19]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx(_4,{children:u.jsx(Ee,{content:u.jsx("div",{className:"w-[200px]",children:"Kiosk mode is enabled. This allows you to view the outputs of the cells without the ability to edit them."}),children:u.jsx("span",{className:"text-muted-foreground text-sm mr-4",children:"kiosk mode"})})}),t[19]=j):j=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(C=u.jsxs("div",{className:"flex items-center shrink-0 min-w-0",children:[u.jsx(N6,{}),u.jsx(R6,{}),u.jsx(v6,{}),u.jsx(j6,{}),u.jsx(L6,{}),u.jsx(w6,{})]}),t[20]=C):C=t[20],t[21]!==y||t[22]!==x?(N=u.jsxs("footer",{className:"h-10 py-2 bg-background flex items-center text-muted-foreground text-md px-1 border-t border-border select-none no-print text-sm shadow-[0_0_4px_1px_rgba(0,0,0,0.1)] z-50 print:hidden hide-on-fullscreen overflow-x-auto overflow-y-hidden scrollbar-thin",children:[x,y,v,w,j,C]}),t[21]=y,t[22]=x,t[23]=N):N=t[23],N};function B6(t,e){const{Icon:n}=t;return u.jsx(n,{className:xe("h-5 w-5",e)})}function U6(t){return t.type==="errors"}const $6=t=>{const e=H.c(6),{children:n}=t,{openModal:o,closeModal:r}=An();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(u.jsx(V6,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=u.jsx(FC,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},V6=t=>{const e=H.c(9),{onClose:n}=t;let o,r,s,i,a,l,c;return e[0]!==n?(o=async d=>{d.preventDefault();const h=new FormData(d.target),f=h.get("rating"),m=h.get("message");fetch("https://marimo.io/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rating:f,message:m})}),n(),Je({title:"Feedback sent!",description:"Thank you for your feedback!"})},e[0]=n,e[1]=o):o=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(Wo,{children:"Send Feedback"}),e[2]=r):r=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We want to hear from you \u2014 from minor bug reports to wishlist features and everything in between. Here are some ways you can get in touch:"}),e[3]=s):s=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsxs("li",{className:"my-0",children:["Take our"," ",u.jsx("a",{href:Fn.feedbackForm,target:"_blank",className:"underline",children:"two-minute survey."})]}),e[4]=i):i=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsxs("li",{className:"my-0",children:["File a"," ",u.jsx("a",{href:Fn.issuesPage,target:"_blank",className:"underline",children:"GitHub issue."})]}),e[5]=a):a=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsxs(ls,{children:[r,u.jsxs(cs,{children:[s,u.jsxs("ul",{className:"list-disc ml-8 my-2 prose dark:prose-invert",children:[i,a,u.jsxs("li",{className:"my-0",children:["Chat with us on"," ",u.jsx("a",{href:Fn.discordLink,target:"_blank",className:"underline",children:"Discord."})]})]}),u.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We're excited you're here as we build the future of Python data tooling. Thanks for being part of our community!"})]})]}),e[6]=l):l=e[6],e[7]!==o?(c=u.jsx(Go,{className:"w-fit",children:u.jsx("form",{onSubmit:o,children:l})}),e[7]=o,e[8]=c):c=e[8],c},H6=()=>{const t=H.c(10),{selectedPanel:e}=pc(),{toggleApplication:n}=Ui(),o=q6;let r,s,i,a,l,c;return t[0]!==e||t[1]!==n?(r="h-full pt-4 pb-1 px-1 flex flex-col items-start text-muted-foreground text-md select-none no-print text-sm z-50 dark:bg-background print:hidden hide-on-fullscreen",s=hd.filter(G6).map(d=>u.jsx(Wb,{tooltip:d.tooltip,selected:e===d.type,onClick:()=>n(d.type),children:o(d)},d.type)),t[0]=e,t[1]=n,t[2]=r,t[3]=s):(r=t[2],s=t[3]),t[4]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx($6,{children:u.jsx(Wb,{tooltip:"Send feedback!",selected:!1,children:u.jsx(Fp,{className:"h-5 w-5"})})}),a=u.jsx("div",{className:"flex-1"}),l=u.jsx(W6,{}),t[4]=i,t[5]=a,t[6]=l):(i=t[4],a=t[5],l=t[6]),t[7]!==r||t[8]!==s?(c=u.jsxs("div",{className:r,children:[s,i,a,l]}),t[7]=r,t[8]=s,t[9]=c):c=t[9],c},W6=()=>{const t=H.c(7),e=Ne(XP);let n,o,r;return t[0]!==e?(n=e>0?u.jsxs("span",{children:[e," cell",e>1?"s":""," queued or running"]}):"No cells queued or running",t[0]=e,t[1]=n):n=t[1],t[2]!==e?(o=u.jsx("div",{className:"flex flex-col-reverse gap-px overflow-hidden",children:Array.from({length:e}).map(Y6)}),t[2]=e,t[3]=o):o=t[3],t[4]!==n||t[5]!==o?(r=u.jsx(Ee,{content:n,side:"right",delayDuration:200,children:o}),t[4]=n,t[5]=o,t[6]=r):r=t[6],r},Wb=t=>{const e=H.c(17);let n,o,r,s,i;e[0]!==t?({children:n,tooltip:i,selected:s,className:o,...r}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s,e[5]=i):(n=e[1],o=e[2],r=e[3],s=e[4],i=e[5]);const a=!s&&"hover:bg-(--sage-3)",l=s&&"bg-(--sage-4)";let c,d,h;return e[6]!==o||e[7]!==a||e[8]!==l?(c=xe("flex items-center p-2 text-sm mx-px shadow-inset font-mono cursor-pointer rounded",a,l,o),e[6]=o,e[7]=a,e[8]=l,e[9]=c):c=e[9],e[10]!==n||e[11]!==r||e[12]!==c?(d=u.jsx("button",{className:c,...r,children:n}),e[10]=n,e[11]=r,e[12]=c,e[13]=d):d=e[13],e[14]!==d||e[15]!==i?(h=u.jsx(Ee,{content:i,side:"right",delayDuration:200,children:d}),e[14]=d,e[15]=i,e[16]=h):h=e[16],h};function q6(t,e){const{Icon:n}=t;return u.jsx(n,{className:xe("h-5 w-5",e)})}function G6(t){return!t.hidden&&t.position==="sidebar"}function Y6(t,e){return u.jsx("div",{className:"shrink-0 h-1 w-2 bg-(--grass-6) border border-(--grass-7)"},e.toString())}var Wu="ScrollArea",[qb,iz]=dC(Wu),[K6,jn]=qb(Wu),Gb=M.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:o="hover",dir:r,scrollHideDelay:s=600,...i}=t,[a,l]=M.useState(null),[c,d]=M.useState(null),[h,f]=M.useState(null),[m,g]=M.useState(null),[x,p]=M.useState(null),[b,y]=M.useState(0),[v,w]=M.useState(0),[j,C]=M.useState(!1),[N,S]=M.useState(!1),E=Cs(e,I=>l(I)),T=JP(r);return u.jsx(K6,{scope:n,type:o,dir:T,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:d,content:h,onContentChange:f,scrollbarX:m,onScrollbarXChange:g,scrollbarXEnabled:j,onScrollbarXEnabledChange:C,scrollbarY:x,onScrollbarYChange:p,scrollbarYEnabled:N,onScrollbarYEnabledChange:S,onCornerWidthChange:y,onCornerHeightChange:w,children:u.jsx(vs.div,{dir:T,...i,ref:E,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":v+"px",...t.style}})})});Gb.displayName=Wu;var Yb="ScrollAreaViewport",Kb=M.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:o,nonce:r,...s}=t,i=jn(Yb,n),a=M.useRef(null),l=Cs(e,a,i.onViewportChange);return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),u.jsx(vs.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...t.style},children:u.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});Kb.displayName=Yb;var qn="ScrollAreaScrollbar",qu=M.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=jn(qn,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=r,a=t.orientation==="horizontal";return M.useEffect(()=>(a?s(!0):i(!0),()=>{a?s(!1):i(!1)}),[a,s,i]),r.type==="hover"?u.jsx(X6,{...o,ref:e,forceMount:n}):r.type==="scroll"?u.jsx(J6,{...o,ref:e,forceMount:n}):r.type==="auto"?u.jsx(Xb,{...o,ref:e,forceMount:n}):r.type==="always"?u.jsx(Gu,{...o,ref:e}):null});qu.displayName=qn;var X6=M.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=jn(qn,t.__scopeScrollArea),[s,i]=M.useState(!1);return M.useEffect(()=>{const a=r.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),i(!0)},d=()=>{l=window.setTimeout(()=>i(!1),r.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",d)}}},[r.scrollArea,r.scrollHideDelay]),u.jsx(Vc,{present:n||s,children:u.jsx(Xb,{"data-state":s?"visible":"hidden",...o,ref:e})})}),J6=M.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=jn(qn,t.__scopeScrollArea),s=t.orientation==="horizontal",i=bl(()=>l("SCROLL_END"),100),[a,l]=function(c,d){return M.useReducer((h,f)=>d[h][f]??h,c)}("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return M.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,r.scrollHideDelay,l]),M.useEffect(()=>{const c=r.viewport,d=s?"scrollLeft":"scrollTop";if(c){let h=c[d];const f=()=>{const m=c[d];h!==m&&(l("SCROLL"),i()),h=m};return c.addEventListener("scroll",f),()=>c.removeEventListener("scroll",f)}},[r.viewport,s,l,i]),u.jsx(Vc,{present:n||a!=="hidden",children:u.jsx(Gu,{"data-state":a==="hidden"?"hidden":"visible",...o,ref:e,onPointerEnter:On(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:On(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),Xb=M.forwardRef((t,e)=>{const n=jn(qn,t.__scopeScrollArea),{forceMount:o,...r}=t,[s,i]=M.useState(!1),a=t.orientation==="horizontal",l=bl(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;i(a?c:d)}},10);return Ur(n.viewport,l),Ur(n.content,l),u.jsx(Vc,{present:o||s,children:u.jsx(Gu,{"data-state":s?"visible":"hidden",...r,ref:e})})}),Gu=M.forwardRef((t,e)=>{const{orientation:n="vertical",...o}=t,r=jn(qn,t.__scopeScrollArea),s=M.useRef(null),i=M.useRef(0),[a,l]=M.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=ty(a.viewport,a.content),d={...o,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:f=>s.current=f,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:f=>i.current=f};function h(f,m){return function(g,x,p,b="ltr"){const y=xl(p),v=y/2,w=x||v,j=y-w,C=p.scrollbar.paddingStart+w,N=p.scrollbar.size-p.scrollbar.paddingEnd-j,S=p.content-p.viewport,E=b==="ltr"?[0,S]:[-1*S,0];return oy([C,N],E)(g)}(f,i.current,a,m)}return n==="horizontal"?u.jsx(Z6,{...d,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const f=ny(r.viewport.scrollLeft,a,r.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollLeft=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollLeft=h(f,r.dir))}}):n==="vertical"?u.jsx(Q6,{...d,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const f=ny(r.viewport.scrollTop,a);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollTop=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollTop=h(f))}}):null}),Z6=M.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,s=jn(qn,t.__scopeScrollArea),[i,a]=M.useState(),l=M.useRef(null),c=Cs(e,l,s.onScrollbarXChange);return M.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),u.jsx(Zb,{"data-orientation":"horizontal",...r,ref:c,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":xl(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,h)=>{if(s.viewport){const f=s.viewport.scrollLeft+d.deltaX;t.onWheelScroll(f),ry(f,h)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&o({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:gl(i.paddingLeft),paddingEnd:gl(i.paddingRight)}})}})}),Q6=M.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,s=jn(qn,t.__scopeScrollArea),[i,a]=M.useState(),l=M.useRef(null),c=Cs(e,l,s.onScrollbarYChange);return M.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),u.jsx(Zb,{"data-orientation":"vertical",...r,ref:c,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":xl(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,h)=>{if(s.viewport){const f=s.viewport.scrollTop+d.deltaY;t.onWheelScroll(f),ry(f,h)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&o({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:gl(i.paddingTop),paddingEnd:gl(i.paddingBottom)}})}})}),[eI,Jb]=qb(qn),Zb=M.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:o,hasThumb:r,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:d,onResize:h,...f}=t,m=jn(qn,n),[g,x]=M.useState(null),p=Cs(e,E=>x(E)),b=M.useRef(null),y=M.useRef(""),v=m.viewport,w=o.content-o.viewport,j=Xo(d),C=Xo(l),N=bl(h,10);function S(E){if(b.current){const T=E.clientX-b.current.left,I=E.clientY-b.current.top;c({x:T,y:I})}}return M.useEffect(()=>{const E=T=>{const I=T.target;(g==null?void 0:g.contains(I))&&j(T,w)};return document.addEventListener("wheel",E,{passive:!1}),()=>document.removeEventListener("wheel",E,{passive:!1})},[v,g,w,j]),M.useEffect(C,[o,C]),Ur(g,N),Ur(m.content,N),u.jsx(eI,{scope:n,scrollbar:g,hasThumb:r,onThumbChange:Xo(s),onThumbPointerUp:Xo(i),onThumbPositionChange:C,onThumbPointerDown:Xo(a),children:u.jsx(vs.div,{...f,ref:p,style:{position:"absolute",...f.style},onPointerDown:On(t.onPointerDown,E=>{E.button===0&&(E.target.setPointerCapture(E.pointerId),b.current=g.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),S(E))}),onPointerMove:On(t.onPointerMove,S),onPointerUp:On(t.onPointerUp,E=>{const T=E.target;T.hasPointerCapture(E.pointerId)&&T.releasePointerCapture(E.pointerId),document.body.style.webkitUserSelect=y.current,m.viewport&&(m.viewport.style.scrollBehavior=""),b.current=null})})})}),pl="ScrollAreaThumb",Qb=M.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=Jb(pl,t.__scopeScrollArea);return u.jsx(Vc,{present:n||r.hasThumb,children:u.jsx(tI,{ref:e,...o})})}),tI=M.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:o,...r}=t,s=jn(pl,n),i=Jb(pl,n),{onThumbPositionChange:a}=i,l=Cs(e,h=>i.onThumbChange(h)),c=M.useRef(void 0),d=bl(()=>{c.current&&(c.current(),c.current=void 0)},100);return M.useEffect(()=>{const h=s.viewport;if(h){const f=()=>{if(d(),!c.current){const m=oI(h,a);c.current=m,a()}};return a(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[s.viewport,d,a]),u.jsx(vs.div,{"data-state":i.hasThumb?"visible":"hidden",...r,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:On(t.onPointerDownCapture,h=>{const f=h.target.getBoundingClientRect(),m=h.clientX-f.left,g=h.clientY-f.top;i.onThumbPointerDown({x:m,y:g})}),onPointerUp:On(t.onPointerUp,i.onThumbPointerUp)})});Qb.displayName=pl;var Yu="ScrollAreaCorner",ey=M.forwardRef((t,e)=>{const n=jn(Yu,t.__scopeScrollArea),o=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&o?u.jsx(nI,{...t,ref:e}):null});ey.displayName=Yu;var nI=M.forwardRef((t,e)=>{const{__scopeScrollArea:n,...o}=t,r=jn(Yu,n),[s,i]=M.useState(0),[a,l]=M.useState(0),c=!!(s&&a);return Ur(r.scrollbarX,()=>{var h;const d=((h=r.scrollbarX)==null?void 0:h.offsetHeight)||0;r.onCornerHeightChange(d),l(d)}),Ur(r.scrollbarY,()=>{var h;const d=((h=r.scrollbarY)==null?void 0:h.offsetWidth)||0;r.onCornerWidthChange(d),i(d)}),c?u.jsx(vs.div,{...o,ref:e,style:{width:s,height:a,position:"absolute",right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function gl(t){return t?parseInt(t,10):0}function ty(t,e){const n=t/e;return isNaN(n)?0:n}function xl(t){const e=ty(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=(t.scrollbar.size-n)*e;return Math.max(o,18)}function ny(t,e,n="ltr"){const o=xl(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-r,i=e.content-e.viewport,a=s-o,l=QP(t,n==="ltr"?[0,i]:[-1*i,0]);return oy([0,i],[0,a])(l)}function oy(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const o=(e[1]-e[0])/(t[1]-t[0]);return e[0]+o*(n-t[0])}}function ry(t,e){return t>0&&t<e}var oI=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},o=0;return function r(){const s={left:t.scrollLeft,top:t.scrollTop},i=n.left!==s.left,a=n.top!==s.top;(i||a)&&e(),n=s,o=window.requestAnimationFrame(r)}(),()=>window.cancelAnimationFrame(o)};function bl(t,e){const n=Xo(t),o=M.useRef(0);return M.useEffect(()=>()=>window.clearTimeout(o.current),[]),M.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(n,e)},[n,e])}function Ur(t,e){const n=Xo(e);ZP(()=>{let o=0;if(t){const r=new ResizeObserver(()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(n)});return r.observe(t),()=>{window.cancelAnimationFrame(o),r.unobserve(t)}}},[t,n])}var sy=Gb,rI=Kb,sI=ey;const iy=M.forwardRef((t,e)=>{const n=H.c(15);let o,r,s,i,a,l,c,d;return n[0]!==t?({className:r,children:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(i=xe("relative overflow-hidden",r),n[4]=r,n[5]=i):i=n[5],n[6]!==o?(a=u.jsx(rI,{className:"h-full w-full rounded-[inherit]",children:o}),n[6]=o,n[7]=a):a=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(ay,{}),c=u.jsx(sI,{}),n[8]=l,n[9]=c):(l=n[8],c=n[9]),n[10]!==s||n[11]!==e||n[12]!==i||n[13]!==a?(d=u.jsxs(sy,{ref:e,className:i,...s,children:[a,l,c]}),n[10]=s,n[11]=e,n[12]=i,n[13]=a,n[14]=d):d=n[14],d});iy.displayName=sy.displayName;const ay=M.forwardRef((t,e)=>{const n=H.c(14);let o,r,s;n[0]!==t?({className:o,orientation:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const i=s===void 0?"vertical":s,a=i==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-px",l=i==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-px";let c,d,h;return n[4]!==o||n[5]!==a||n[6]!==l?(c=xe("flex touch-none select-none transition-colors",a,l,o),n[4]=o,n[5]=a,n[6]=l,n[7]=c):c=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(Qb,{className:"relative flex-1 rounded-full bg-border"}),n[8]=d):d=n[8],n[9]!==i||n[10]!==r||n[11]!==e||n[12]!==c?(h=u.jsx(qu,{ref:e,orientation:i,className:c,...r,children:d}),n[9]=i,n[10]=r,n[11]=e,n[12]=c,n[13]=h):h=n[13],h});ay.displayName=qu.displayName;let Ku;Ku=(t,e,n,o,r,s)=>{if(!e)return ut.warn("No active chat"),t;const i=t.chats.findIndex(h=>h.id===e);if(i===-1)return ut.warn("No active chat"),t;const a=t.chats[i],l=a.messages.findIndex(h=>h.id===n),c=[...t.chats],d=Date.now();if(l===-1)c[i]={...a,messages:[...a.messages,{id:n,role:o,content:r,timestamp:d,parts:s}],updatedAt:d};else{const h=[...a.messages];h[l]={...h[l],content:r,parts:s},c[i]={...a,messages:h,updatedAt:d}}return{...t,chats:c}},dn=t=>{const e=H.c(15),{title:n,description:o,icon:r,action:s}=t;let i,a,l,c,d,h;return e[0]!==r?(i=r&&q.cloneElement(r,{className:"text-accent-foreground"}),e[0]=r,e[1]=i):i=e[1],e[2]!==n?(a=u.jsx("span",{className:"mt-1 text-accent-foreground",children:n}),e[2]=n,e[3]=a):a=e[3],e[4]!==i||e[5]!==a?(l=u.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[i,a]}),e[4]=i,e[5]=a,e[6]=l):l=e[6],e[7]!==o?(c=u.jsx("span",{className:"text-muted-foreground text-sm",children:o}),e[7]=o,e[8]=c):c=e[8],e[9]!==s?(d=s&&u.jsx("div",{className:"mt-2",children:s}),e[9]=s,e[10]=d):d=e[10],e[11]!==l||e[12]!==c||e[13]!==d?(h=u.jsxs("div",{className:"mx-6 my-6 flex flex-col gap-2",children:[l,c,d]}),e[11]=l,e[12]=c,e[13]=d,e[14]=h):h=e[14],h};function az(){}function lz(){}const iI=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,aI=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,lI={};function ly(t,e){return(lI.jsx?aI:iI).test(t)}const cI=/[ \t\n\f\r]/g;function cy(t){return t.replace(cI,"")===""}class ci{constructor(e,n,o){this.normal=n,this.property=e,o&&(this.space=o)}}function dy(t,e){const n={},o={};for(const r of t)Object.assign(n,r.property),Object.assign(o,r.normal);return new ci(n,o,e)}function Xu(t){return t.toLowerCase()}ci.prototype.normal={},ci.prototype.property={},ci.prototype.space=void 0;class on{constructor(e,n){this.attribute=n,this.property=e}}on.prototype.attribute="",on.prototype.booleanish=!1,on.prototype.boolean=!1,on.prototype.commaOrSpaceSeparated=!1,on.prototype.commaSeparated=!1,on.prototype.defined=!1,on.prototype.mustUseProperty=!1,on.prototype.number=!1,on.prototype.overloadedBoolean=!1,on.prototype.property="",on.prototype.spaceSeparated=!1,on.prototype.space=void 0;let dI=0;const Ge=cr(),_t=cr(),Ju=cr(),me=cr(),ht=cr(),$r=cr(),pn=cr();function cr(){return 2**++dI}const Zu=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ge,booleanish:_t,commaOrSpaceSeparated:pn,commaSeparated:$r,number:me,overloadedBoolean:Ju,spaceSeparated:ht},Symbol.toStringTag,{value:"Module"})),Qu=Object.keys(Zu);class eh extends on{constructor(e,n,o,r){let s=-1;if(super(e,n),uy(this,"space",r),typeof o=="number")for(;++s<Qu.length;){const i=Qu[s];uy(this,Qu[s],(o&Zu[i])===Zu[i])}}}function uy(t,e,n){n&&(t[e]=n)}function Vr(t){const e={},n={};for(const[o,r]of Object.entries(t.properties)){const s=new eh(o,t.transform(t.attributes||{},o),r,t.space);t.mustUseProperty&&t.mustUseProperty.includes(o)&&(s.mustUseProperty=!0),e[o]=s,n[Xu(o)]=o,n[Xu(s.attribute)]=o}return new ci(e,n,t.space)}eh.prototype.defined=!0;const hy=Vr({properties:{ariaActiveDescendant:null,ariaAtomic:_t,ariaAutoComplete:null,ariaBusy:_t,ariaChecked:_t,ariaColCount:me,ariaColIndex:me,ariaColSpan:me,ariaControls:ht,ariaCurrent:null,ariaDescribedBy:ht,ariaDetails:null,ariaDisabled:_t,ariaDropEffect:ht,ariaErrorMessage:null,ariaExpanded:_t,ariaFlowTo:ht,ariaGrabbed:_t,ariaHasPopup:null,ariaHidden:_t,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ht,ariaLevel:me,ariaLive:null,ariaModal:_t,ariaMultiLine:_t,ariaMultiSelectable:_t,ariaOrientation:null,ariaOwns:ht,ariaPlaceholder:null,ariaPosInSet:me,ariaPressed:_t,ariaReadOnly:_t,ariaRelevant:null,ariaRequired:_t,ariaRoleDescription:ht,ariaRowCount:me,ariaRowIndex:me,ariaRowSpan:me,ariaSelected:_t,ariaSetSize:me,ariaSort:null,ariaValueMax:me,ariaValueMin:me,ariaValueNow:me,ariaValueText:null,role:null},transform:(t,e)=>e==="role"?e:"aria-"+e.slice(4).toLowerCase()});function fy(t,e){return e in t?t[e]:e}function my(t,e){return fy(t,e.toLowerCase())}const uI=Vr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:$r,acceptCharset:ht,accessKey:ht,action:null,allow:null,allowFullScreen:Ge,allowPaymentRequest:Ge,allowUserMedia:Ge,alt:null,as:null,async:Ge,autoCapitalize:null,autoComplete:ht,autoFocus:Ge,autoPlay:Ge,blocking:ht,capture:null,charSet:null,checked:Ge,cite:null,className:ht,cols:me,colSpan:null,content:null,contentEditable:_t,controls:Ge,controlsList:ht,coords:me|$r,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ge,defer:Ge,dir:null,dirName:null,disabled:Ge,download:Ju,draggable:_t,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ge,formTarget:null,headers:ht,height:me,hidden:Ju,high:me,href:null,hrefLang:null,htmlFor:ht,httpEquiv:ht,id:null,imageSizes:null,imageSrcSet:null,inert:Ge,inputMode:null,integrity:null,is:null,isMap:Ge,itemId:null,itemProp:ht,itemRef:ht,itemScope:Ge,itemType:ht,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ge,low:me,manifest:null,max:null,maxLength:me,media:null,method:null,min:null,minLength:me,multiple:Ge,muted:Ge,name:null,nonce:null,noModule:Ge,noValidate:Ge,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ge,optimum:me,pattern:null,ping:ht,placeholder:null,playsInline:Ge,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ge,referrerPolicy:null,rel:ht,required:Ge,reversed:Ge,rows:me,rowSpan:me,sandbox:ht,scope:null,scoped:Ge,seamless:Ge,selected:Ge,shadowRootClonable:Ge,shadowRootDelegatesFocus:Ge,shadowRootMode:null,shape:null,size:me,sizes:null,slot:null,span:me,spellCheck:_t,src:null,srcDoc:null,srcLang:null,srcSet:null,start:me,step:null,style:null,tabIndex:me,target:null,title:null,translate:null,type:null,typeMustMatch:Ge,useMap:null,value:_t,width:me,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ht,axis:null,background:null,bgColor:null,border:me,borderColor:null,bottomMargin:me,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ge,declare:Ge,event:null,face:null,frame:null,frameBorder:null,hSpace:me,leftMargin:me,link:null,longDesc:null,lowSrc:null,marginHeight:me,marginWidth:me,noResize:Ge,noHref:Ge,noShade:Ge,noWrap:Ge,object:null,profile:null,prompt:null,rev:null,rightMargin:me,rules:null,scheme:null,scrolling:_t,standby:null,summary:null,text:null,topMargin:me,valueType:null,version:null,vAlign:null,vLink:null,vSpace:me,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ge,disableRemotePlayback:Ge,prefix:null,property:null,results:me,security:null,unselectable:null},space:"html",transform:my}),hI=Vr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:pn,accentHeight:me,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:me,amplitude:me,arabicForm:null,ascent:me,attributeName:null,attributeType:null,azimuth:me,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:me,by:null,calcMode:null,capHeight:me,className:ht,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:me,diffuseConstant:me,direction:null,display:null,dur:null,divisor:me,dominantBaseline:null,download:Ge,dx:null,dy:null,edgeMode:null,editable:null,elevation:me,enableBackground:null,end:null,event:null,exponent:me,externalResourcesRequired:null,fill:null,fillOpacity:me,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:$r,g2:$r,glyphName:$r,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:me,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:me,horizOriginX:me,horizOriginY:me,id:null,ideographic:me,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:me,k:me,k1:me,k2:me,k3:me,k4:me,kernelMatrix:pn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:me,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:me,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:me,overlineThickness:me,paintOrder:null,panose1:null,path:null,pathLength:me,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ht,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:me,pointsAtY:me,pointsAtZ:me,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:pn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:pn,rev:pn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:pn,requiredFeatures:pn,requiredFonts:pn,requiredFormats:pn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:me,specularExponent:me,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:me,strikethroughThickness:me,string:null,stroke:null,strokeDashArray:pn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:me,strokeOpacity:me,strokeWidth:null,style:null,surfaceScale:me,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:pn,tabIndex:me,tableValues:null,target:null,targetX:me,targetY:me,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:pn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:me,underlineThickness:me,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:me,values:null,vAlphabetic:me,vMathematical:me,vectorEffect:null,vHanging:me,vIdeographic:me,version:null,vertAdvY:me,vertOriginX:me,vertOriginY:me,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:me,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:fy}),py=Vr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(t,e)=>"xlink:"+e.slice(5).toLowerCase()}),gy=Vr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:my}),xy=Vr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(t,e)=>"xml:"+e.slice(3).toLowerCase()}),fI={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},mI=/[A-Z]/g,by=/-[a-z]/g,pI=/^data[-\w.:]+$/i;function gI(t){return"-"+t.toLowerCase()}function xI(t){return t.charAt(1).toUpperCase()}const bI=dy([hy,uI,py,gy,xy],"html"),th=dy([hy,hI,py,gy,xy],"svg");var yy,Hr={},vy,yl,wy,di={};function yI(){if(vy)return di;vy=1,Object.defineProperty(di,"__esModule",{value:!0}),di.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,r=/^-(ms)-/,s=function(a,l){return l.toUpperCase()},i=function(a,l){return"".concat(l,"-")};return di.camelCase=function(a,l){return l===void 0&&(l={}),function(c){return!c||n.test(c)||t.test(c)}(a)?a:(a=a.toLowerCase(),(a=l.reactCompat?a.replace(r,i):a.replace(o,i)).replace(e,s))},di}var vI=function(){if(wy)return yl;wy=1;var t=(yl&&yl.__importDefault||function(o){return o&&o.__esModule?o:{default:o}})(function(){if(yy)return Hr;yy=1;var o=Hr&&Hr.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.default=function(s,i){var a=null;if(!s||typeof s!="string")return a;var l=(0,r.default)(s),c=typeof i=="function";return l.forEach(function(d){if(d.type==="declaration"){var h=d.property,f=d.value;c?i(h,f,d):f&&((a=a||{})[h]=f)}}),a};var r=o(eL());return Hr}()),e=yI();function n(o,r){var s={};return o&&typeof o=="string"&&(0,t.default)(o,function(i,a){i&&a&&(s[(0,e.camelCase)(i,r)]=a)}),s}return n.default=n,yl=n}();const wI=zC(vI),ky=Cy("end"),nh=Cy("start");function Cy(t){return function(e){const n=e&&e.position&&e.position[t]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function ui(t){return t&&typeof t=="object"?"position"in t||"type"in t?jy(t.position):"start"in t||"end"in t?jy(t):"line"in t||"column"in t?oh(t):"":""}function oh(t){return Sy(t&&t.line)+":"+Sy(t&&t.column)}function jy(t){return oh(t&&t.start)+"-"+oh(t&&t.end)}function Sy(t){return t&&typeof t=="number"?t:1}class Vt extends Error{constructor(e,n,o){super(),typeof n=="string"&&(o=n,n=void 0);let r="",s={},i=!1;if(n&&(s="line"in n&&"column"in n||"start"in n&&"end"in n?{place:n}:"type"in n?{ancestors:[n],place:n.position}:{...n}),typeof e=="string"?r=e:!s.cause&&e&&(i=!0,r=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof o=="string"){const l=o.indexOf(":");l===-1?s.ruleId=o:(s.source=o.slice(0,l),s.ruleId=o.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=r,this.line=a?a.line:void 0,this.name=ui(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=i&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual,this.expected,this.note,this.url}}Vt.prototype.file="",Vt.prototype.name="",Vt.prototype.reason="",Vt.prototype.message="",Vt.prototype.stack="",Vt.prototype.column=void 0,Vt.prototype.line=void 0,Vt.prototype.ancestors=void 0,Vt.prototype.cause=void 0,Vt.prototype.fatal=void 0,Vt.prototype.place=void 0,Vt.prototype.ruleId=void 0,Vt.prototype.source=void 0;const rh={}.hasOwnProperty,kI=new Map,CI=/[A-Z]/g,jI=new Set(["table","tbody","thead","tfoot","tr"]),SI=new Set(["td","th"]),Ny="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function NI(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let o;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");o=function(i,a){return l;function l(c,d,h,f){const m=Array.isArray(h.children),g=nh(c);return a(d,h,f,m,{columnNumber:g?g.column-1:void 0,fileName:i,lineNumber:g?g.line:void 0},void 0)}}(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");o=function(i,a,l){return c;function c(d,h,f,m){const g=Array.isArray(f.children)?l:a;return m?g(h,f,m):g(h,f)}}(0,e.jsx,e.jsxs)}const r={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:o,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?th:bI,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=Ey(r,t,void 0);return s&&typeof s!="string"?s:r.create(t,r.Fragment,{children:s||void 0},void 0)}function Ey(t,e,n){return e.type==="element"?function(o,r,s){const i=o.schema;let a=i;r.tagName.toLowerCase()==="svg"&&i.space==="html"&&(a=th,o.schema=a),o.ancestors.push(r);const l=Iy(o,r.tagName,!1),c=function(h,f){const m={};let g,x;for(x in f.properties)if(x!=="children"&&rh.call(f.properties,x)){const p=EI(h,x,f.properties[x]);if(p){const[b,y]=p;h.tableCellAlignToStyle&&b==="align"&&typeof y=="string"&&SI.has(f.tagName)?g=y:m[b]=y}}return g&&((m.style||(m.style={}))[h.stylePropertyNameCase==="css"?"text-align":"textAlign"]=g),m}(o,r);let d=ih(o,r);return jI.has(r.tagName)&&(d=d.filter(function(h){return typeof h!="string"||!(typeof(f=h)=="object"?f.type==="text"&&cy(f.value):cy(f));var f})),_y(o,c,l,r),sh(c,d),o.ancestors.pop(),o.schema=i,o.create(r,l,c,s)}(t,e,n):e.type==="mdxFlowExpression"||e.type==="mdxTextExpression"?function(o,r){if(r.data&&r.data.estree&&o.evaluater){const s=r.data.estree.body[0];return s.type,o.evaluater.evaluateExpression(s.expression)}hi(o,r.position)}(t,e):e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement"?function(o,r,s){const i=o.schema;let a=i;r.name==="svg"&&i.space==="html"&&(a=th,o.schema=a),o.ancestors.push(r);const l=r.name===null?o.Fragment:Iy(o,r.name,!0),c=function(h,f){const m={};for(const g of f.attributes)if(g.type==="mdxJsxExpressionAttribute")if(g.data&&g.data.estree&&h.evaluater){const x=g.data.estree.body[0];x.type;const p=x.expression;p.type;const b=p.properties[0];b.type,Object.assign(m,h.evaluater.evaluateExpression(b.argument))}else hi(h,f.position);else{const x=g.name;let p;if(g.value&&typeof g.value=="object")if(g.value.data&&g.value.data.estree&&h.evaluater){const b=g.value.data.estree.body[0];b.type,p=h.evaluater.evaluateExpression(b.expression)}else hi(h,f.position);else p=g.value===null||g.value;m[x]=p}return m}(o,r),d=ih(o,r);return _y(o,c,l,r),sh(c,d),o.ancestors.pop(),o.schema=i,o.create(r,l,c,s)}(t,e,n):e.type==="mdxjsEsm"?function(o,r){if(r.data&&r.data.estree&&o.evaluater)return o.evaluater.evaluateProgram(r.data.estree);hi(o,r.position)}(t,e):e.type==="root"?function(o,r,s){const i={};return sh(i,ih(o,r)),o.create(r,o.Fragment,i,s)}(t,e,n):e.type==="text"?function(o,r){return r.value}(0,e):void 0}function _y(t,e,n,o){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=o)}function sh(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function ih(t,e){const n=[];let o=-1;const r=t.passKeys?new Map:kI;for(;++o<e.children.length;){const s=e.children[o];let i;if(t.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=r.get(l)||0;i=l+"-"+c,r.set(l,c+1)}}const a=Ey(t,s,i);a!==void 0&&n.push(a)}return n}function EI(t,e,n){const o=function(r,s){const i=Xu(s);let a=s,l=on;if(i in r.normal)return r.property[r.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&pI.test(s)){if(s.charAt(4)==="-"){const c=s.slice(5).replace(by,xI);a="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=s.slice(4);if(!by.test(c)){let d=c.replace(mI,gI);d.charAt(0)!=="-"&&(d="-"+d),s="data"+d}}l=eh}return new l(a,s)}(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=o.commaSeparated?function(r){const s={};return(r[r.length-1]===""?[...r,""]:r).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}(n):n.join(" ").trim()),o.property==="style"){let r=typeof n=="object"?n:function(s,i){try{return wI(i,{reactCompat:!0})}catch(a){if(s.ignoreInvalidStyle)return{};const l=a,c=new Vt("Cannot parse `style` attribute",{ancestors:s.ancestors,cause:l,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=s.filePath||void 0,c.url=Ny+"#cannot-parse-style-attribute",c}}(t,String(n));return t.stylePropertyNameCase==="css"&&(r=function(s){const i={};let a;for(a in s)rh.call(s,a)&&(i[_I(a)]=s[a]);return i}(r)),["style",r]}return[t.elementAttributeNameCase==="react"&&o.space?fI[o.property]||o.property:o.attribute,n]}}function Iy(t,e,n){let o;if(n)if(e.includes(".")){const r=e.split(".");let s,i=-1;for(;++i<r.length;){const a=ly(r[i])?{type:"Identifier",name:r[i]}:{type:"Literal",value:r[i]};s=s?{type:"MemberExpression",object:s,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}o=s}else o=ly(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};else o={type:"Literal",value:e};if(o.type==="Literal"){const r=o.value;return rh.call(t.components,r)?t.components[r]:r}if(t.evaluater)return t.evaluater.evaluateExpression(o);hi(t)}function hi(t,e){const n=new Vt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=Ny+"#cannot-handle-mdx-estrees-without-createevaluater",n}function _I(t){let e=t.replace(CI,II);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function II(t){return"-"+t.toLowerCase()}const ah={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},vl={};function lh(t,e){return Ay(t,typeof vl.includeImageAlt!="boolean"||vl.includeImageAlt,typeof vl.includeHtml!="boolean"||vl.includeHtml)}function Ay(t,e,n){if(function(o){return!!(o&&typeof o=="object")}(t)){if("value"in t)return t.type!=="html"||n?t.value:"";if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return Ty(t.children,e,n)}return Array.isArray(t)?Ty(t,e,n):""}function Ty(t,e,n){const o=[];let r=-1;for(;++r<t.length;)o[r]=Ay(t[r],e,n);return o.join("")}const My=document.createElement("i");function ch(t){const e="&"+t+";";My.innerHTML=e;const n=My.textContent;return(n.charCodeAt(n.length-1)!==59||t==="semi")&&n!==e&&n}function gn(t,e,n,o){const r=t.length;let s,i=0;if(e=e<0?-e>r?0:r+e:e>r?r:e,n=n>0?n:0,o.length<1e4)s=Array.from(o),s.unshift(e,n),t.splice(...s);else for(n&&t.splice(e,n);i<o.length;)s=o.slice(i,i+1e4),s.unshift(e,0),t.splice(...s),i+=1e4,e+=1e4}function Sn(t,e){return t.length>0?(gn(t,t.length,0,e),t):e}const Oy={}.hasOwnProperty;function Dy(t){const e={};let n=-1;for(;++n<t.length;)AI(e,t[n]);return e}function AI(t,e){let n;for(n in e){const o=(Oy.call(t,n)?t[n]:void 0)||(t[n]={}),r=e[n];let s;if(r)for(s in r){Oy.call(o,s)||(o[s]=[]);const i=r[s];TI(o[s],Array.isArray(i)?i:i?[i]:[])}}}function TI(t,e){let n=-1;const o=[];for(;++n<e.length;)(e[n].add==="after"?t:o).push(e[n]);gn(t,0,0,o)}function Ry(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||(65535&n)==65534||n>1114111?"\uFFFD":String.fromCodePoint(n)}function Rn(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Zt=Lo(/[A-Za-z]/),Ht=Lo(/[\dA-Za-z]/),MI=Lo(/[#-'*+\--9=?A-Z^-~]/);function wl(t){return t!==null&&(t<32||t===127)}const dh=Lo(/\d/),OI=Lo(/[\dA-Fa-f]/),DI=Lo(/[!-/:-@[-`{-~]/);function Be(t){return t!==null&&t<-2}function ct(t){return t!==null&&(t<0||t===32)}function et(t){return t===-2||t===-1||t===32}const kl=Lo(new RegExp("\\p{P}|\\p{S}","u")),dr=Lo(/\s/);function Lo(t){return function(e){return e!==null&&e>-1&&t.test(String.fromCharCode(e))}}function Wr(t){const e=[];let n=-1,o=0,r=0;for(;++n<t.length;){const s=t.charCodeAt(n);let i="";if(s===37&&Ht(t.charCodeAt(n+1))&&Ht(t.charCodeAt(n+2)))r=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(i=String.fromCharCode(s));else if(s>55295&&s<57344){const a=t.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(i=String.fromCharCode(s,a),r=1):i="\uFFFD"}else i=String.fromCharCode(s);i&&(e.push(t.slice(o,n),encodeURIComponent(i)),o=n+r+1,i=""),r&&(n+=r,r=0)}return e.join("")+t.slice(o)}function rt(t,e,n,o){const r=o?o-1:Number.POSITIVE_INFINITY;let s=0;return function(a){return et(a)?(t.enter(n),i(a)):e(a)};function i(a){return et(a)&&s++<r?(t.consume(a),i):(t.exit(n),e(a))}}const RI={tokenize:function(t){const e=t.attempt(this.parser.constructs.contentInitial,function(s){return s===null?void t.consume(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),rt(t,e,"linePrefix"))},function(s){return t.enter("paragraph"),o(s)});let n;return e;function o(s){const i=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=i),n=i,r(s)}function r(s){return s===null?(t.exit("chunkText"),t.exit("paragraph"),void t.consume(s)):Be(s)?(t.consume(s),t.exit("chunkText"),o):(t.consume(s),r)}}},PI={tokenize:function(t){const e=this,n=[];let o,r,s,i=0;return a;function a(v){if(i<n.length){const w=n[i];return e.containerState=w[1],t.attempt(w[0].continuation,l,c)(v)}return c(v)}function l(v){if(i++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,o&&y();const w=e.events.length;let j,C=w;for(;C--;)if(e.events[C][0]==="exit"&&e.events[C][1].type==="chunkFlow"){j=e.events[C][1].end;break}b(i);let N=w;for(;N<e.events.length;)e.events[N][1].end={...j},N++;return gn(e.events,C+1,0,e.events.slice(w)),e.events.length=N,c(v)}return a(v)}function c(v){if(i===n.length){if(!o)return f(v);if(o.currentConstruct&&o.currentConstruct.concrete)return g(v);e.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(Py,d,h)(v)}function d(v){return o&&y(),b(i),f(v)}function h(v){return e.parser.lazy[e.now().line]=i!==n.length,s=e.now().offset,g(v)}function f(v){return e.containerState={},t.attempt(Py,m,g)(v)}function m(v){return i++,n.push([e.currentConstruct,e.containerState]),f(v)}function g(v){return v===null?(o&&y(),b(0),void t.consume(v)):(o=o||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:r}),x(v))}function x(v){return v===null?(p(t.exit("chunkFlow"),!0),b(0),void t.consume(v)):Be(v)?(t.consume(v),p(t.exit("chunkFlow")),i=0,e.interrupt=void 0,a):(t.consume(v),x)}function p(v,w){const j=e.sliceStream(v);if(w&&j.push(null),v.previous=r,r&&(r.next=v),r=v,o.defineSkip(v.start),o.write(j),e.parser.lazy[v.start.line]){let C=o.events.length;for(;C--;)if(o.events[C][1].start.offset<s&&(!o.events[C][1].end||o.events[C][1].end.offset>s))return;const N=e.events.length;let S,E,T=N;for(;T--;)if(e.events[T][0]==="exit"&&e.events[T][1].type==="chunkFlow"){if(S){E=e.events[T][1].end;break}S=!0}for(b(i),C=N;C<e.events.length;)e.events[C][1].end={...E},C++;gn(e.events,T+1,0,e.events.slice(N)),e.events.length=C}}function b(v){let w=n.length;for(;w-- >v;){const j=n[w];e.containerState=j[1],j[0].exit.call(e,t)}n.length=v}function y(){o.write([null]),r=void 0,o=void 0,e.containerState._closeFlow=void 0}}},Py={tokenize:function(t,e,n){return rt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function qr(t){return t===null||ct(t)||dr(t)?1:kl(t)?2:void 0}function Cl(t,e,n){const o=[];let r=-1;for(;++r<t.length;){const s=t[r].resolveAll;s&&!o.includes(s)&&(e=s(e,n),o.push(s))}return e}const uh={name:"attention",resolveAll:function(t,e){let n,o,r,s,i,a,l,c,d=-1;for(;++d<t.length;)if(t[d][0]==="enter"&&t[d][1].type==="attentionSequence"&&t[d][1]._close){for(n=d;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[d][1]).charCodeAt(0)){if((t[n][1]._close||t[d][1]._open)&&(t[d][1].end.offset-t[d][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[d][1].end.offset-t[d][1].start.offset)%3))continue;a=t[n][1].end.offset-t[n][1].start.offset>1&&t[d][1].end.offset-t[d][1].start.offset>1?2:1;const h={...t[n][1].end},f={...t[d][1].start};Ly(h,-a),Ly(f,a),s={type:a>1?"strongSequence":"emphasisSequence",start:h,end:{...t[n][1].end}},i={type:a>1?"strongSequence":"emphasisSequence",start:{...t[d][1].start},end:f},r={type:a>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[d][1].start}},o={type:a>1?"strong":"emphasis",start:{...s.start},end:{...i.end}},t[n][1].end={...s.start},t[d][1].start={...i.end},l=[],t[n][1].end.offset-t[n][1].start.offset&&(l=Sn(l,[["enter",t[n][1],e],["exit",t[n][1],e]])),l=Sn(l,[["enter",o,e],["enter",s,e],["exit",s,e],["enter",r,e]]),l=Sn(l,Cl(e.parser.constructs.insideSpan.null,t.slice(n+1,d),e)),l=Sn(l,[["exit",r,e],["enter",i,e],["exit",i,e],["exit",o,e]]),t[d][1].end.offset-t[d][1].start.offset?(c=2,l=Sn(l,[["enter",t[d][1],e],["exit",t[d][1],e]])):c=0,gn(t,n-1,d-n+3,l),d=n+l.length-c-2;break}}for(d=-1;++d<t.length;)t[d][1].type==="attentionSequence"&&(t[d][1].type="data");return t},tokenize:function(t,e){const n=this.parser.constructs.attentionMarkers.null,o=this.previous,r=qr(o);let s;return function(a){return s=a,t.enter("attentionSequence"),i(a)};function i(a){if(a===s)return t.consume(a),i;const l=t.exit("attentionSequence"),c=qr(a),d=!c||c===2&&r||n.includes(a),h=!r||r===2&&c||n.includes(o);return l._open=!!(s===42?d:d&&(r||!h)),l._close=!!(s===42?h:h&&(c||!d)),e(a)}}};function Ly(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const LI={name:"autolink",tokenize:function(t,e,n){let o=0;return function(f){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),r};function r(f){return Zt(f)?(t.consume(f),s):f===64?n(f):l(f)}function s(f){return f===43||f===45||f===46||Ht(f)?(o=1,i(f)):l(f)}function i(f){return f===58?(t.consume(f),o=0,a):(f===43||f===45||f===46||Ht(f))&&o++<32?(t.consume(f),i):(o=0,l(f))}function a(f){return f===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):f===null||f===32||f===60||wl(f)?n(f):(t.consume(f),a)}function l(f){return f===64?(t.consume(f),c):MI(f)?(t.consume(f),l):n(f)}function c(f){return Ht(f)?d(f):n(f)}function d(f){return f===46?(t.consume(f),o=0,c):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):h(f)}function h(f){if((f===45||Ht(f))&&o++<63){const m=f===45?h:d;return t.consume(f),m}return n(f)}}},fi={partial:!0,tokenize:function(t,e,n){return function(r){return et(r)?rt(t,o,"linePrefix")(r):o(r)};function o(r){return r===null||Be(r)?e(r):n(r)}}},Fy={continuation:{tokenize:function(t,e,n){const o=this;return function(s){return et(s)?rt(t,r,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):r(s)};function r(s){return t.attempt(Fy,e,n)(s)}}},exit:function(t){t.exit("blockQuote")},name:"blockQuote",tokenize:function(t,e,n){const o=this;return function(s){if(s===62){const i=o.containerState;return i.open||(t.enter("blockQuote",{_container:!0}),i.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(s),t.exit("blockQuoteMarker"),r}return n(s)};function r(s){return et(s)?(t.enter("blockQuotePrefixWhitespace"),t.consume(s),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(s))}}},zy={name:"characterEscape",tokenize:function(t,e,n){return function(r){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(r),t.exit("escapeMarker"),o};function o(r){return DI(r)?(t.enter("characterEscapeValue"),t.consume(r),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(r)}}},By={name:"characterReference",tokenize:function(t,e,n){const o=this;let r,s,i=0;return function(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),a};function a(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),l):(t.enter("characterReferenceValue"),r=31,s=Ht,c(d))}function l(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),r=6,s=OI,c):(t.enter("characterReferenceValue"),r=7,s=dh,c(d))}function c(d){if(d===59&&i){const h=t.exit("characterReferenceValue");return s!==Ht||ch(o.sliceSerialize(h))?(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e):n(d)}return s(d)&&i++<r?(t.consume(d),c):n(d)}}},Uy={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return s===null?n(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r)};function r(s){return o.parser.lazy[o.now().line]?n(s):e(s)}}},$y={concrete:!0,name:"codeFenced",tokenize:function(t,e,n){const o=this,r={partial:!0,tokenize:function(v,w,j){let C=0;return N;function N(D){return v.enter("lineEnding"),v.consume(D),v.exit("lineEnding"),S}function S(D){return v.enter("codeFencedFence"),et(D)?rt(v,E,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):E(D)}function E(D){return D===s?(v.enter("codeFencedFenceSequence"),T(D)):j(D)}function T(D){return D===s?(C++,v.consume(D),T):C>=a?(v.exit("codeFencedFenceSequence"),et(D)?rt(v,I,"whitespace")(D):I(D)):j(D)}function I(D){return D===null||Be(D)?(v.exit("codeFencedFence"),w(D)):j(D)}}};let s,i=0,a=0;return function(v){return function(w){const j=o.events[o.events.length-1];return i=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,s=w,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),l(w)}(v)};function l(v){return v===s?(a++,t.consume(v),l):a<3?n(v):(t.exit("codeFencedFenceSequence"),et(v)?rt(t,c,"whitespace")(v):c(v))}function c(v){return v===null||Be(v)?(t.exit("codeFencedFence"),o.interrupt?e(v):t.check(Uy,m,y)(v)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),d(v))}function d(v){return v===null||Be(v)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),c(v)):et(v)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),rt(t,h,"whitespace")(v)):v===96&&v===s?n(v):(t.consume(v),d)}function h(v){return v===null||Be(v)?c(v):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),f(v))}function f(v){return v===null||Be(v)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),c(v)):v===96&&v===s?n(v):(t.consume(v),f)}function m(v){return t.attempt(r,y,g)(v)}function g(v){return t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),x}function x(v){return i>0&&et(v)?rt(t,p,"linePrefix",i+1)(v):p(v)}function p(v){return v===null||Be(v)?t.check(Uy,m,y)(v):(t.enter("codeFlowValue"),b(v))}function b(v){return v===null||Be(v)?(t.exit("codeFlowValue"),p(v)):(t.consume(v),b)}function y(v){return t.exit("codeFenced"),e(v)}}},hh={name:"codeIndented",tokenize:function(t,e,n){const o=this;return function(l){return t.enter("codeIndented"),rt(t,r,"linePrefix",5)(l)};function r(l){const c=o.events[o.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(l):n(l)}function s(l){return l===null?a(l):Be(l)?t.attempt(FI,s,a)(l):(t.enter("codeFlowValue"),i(l))}function i(l){return l===null||Be(l)?(t.exit("codeFlowValue"),s(l)):(t.consume(l),i)}function a(l){return t.exit("codeIndented"),e(l)}}},FI={partial:!0,tokenize:function(t,e,n){const o=this;return r;function r(i){return o.parser.lazy[o.now().line]?n(i):Be(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r):rt(t,s,"linePrefix",5)(i)}function s(i){const a=o.events[o.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(i):Be(i)?r(i):n(i)}}},zI={name:"codeText",previous:function(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"},resolve:function(t){let e,n,o=t.length-4,r=3;if(!(t[r][1].type!=="lineEnding"&&t[r][1].type!=="space"||t[o][1].type!=="lineEnding"&&t[o][1].type!=="space")){for(e=r;++e<o;)if(t[e][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[o][1].type="codeTextPadding",r+=2,o-=2;break}}for(e=r-1,o++;++e<=o;)n===void 0?e!==o&&t[e][1].type!=="lineEnding"&&(n=e):e!==o&&t[e][1].type!=="lineEnding"||(t[n][1].type="codeTextData",e!==n+2&&(t[n][1].end=t[e-1][1].end,t.splice(n+2,e-n-2),o-=e-n-2,e=n+2),n=void 0);return t},tokenize:function(t,e,n){let o,r,s=0;return function(d){return t.enter("codeText"),t.enter("codeTextSequence"),i(d)};function i(d){return d===96?(t.consume(d),s++,i):(t.exit("codeTextSequence"),a(d))}function a(d){return d===null?n(d):d===32?(t.enter("space"),t.consume(d),t.exit("space"),a):d===96?(r=t.enter("codeTextSequence"),o=0,c(d)):Be(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),a):(t.enter("codeTextData"),l(d))}function l(d){return d===null||d===32||d===96||Be(d)?(t.exit("codeTextData"),a(d)):(t.consume(d),l)}function c(d){return d===96?(t.consume(d),o++,c):o===s?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(r.type="codeTextData",l(d))}}};class BI{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const o=n??Number.POSITIVE_INFINITY;return o<this.left.length?this.left.slice(e,o):e>this.left.length?this.right.slice(this.right.length-o+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-o+this.left.length).reverse())}splice(e,n,o){const r=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return o&&mi(this.left,o),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),mi(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),mi(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);mi(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);mi(this.left,n.reverse())}}}function mi(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function Vy(t){const e={};let n,o,r,s,i,a,l,c=-1;const d=new BI(t);for(;++c<d.length;){for(;c in e;)c=e[c];if(n=d.get(c),c&&n[1].type==="chunkFlow"&&d.get(c-1)[1].type==="listItemPrefix"&&(a=n[1]._tokenizer.events,r=0,r<a.length&&a[r][1].type==="lineEndingBlank"&&(r+=2),r<a.length&&a[r][1].type==="content"))for(;++r<a.length&&a[r][1].type!=="content";)a[r][1].type==="chunkText"&&(a[r][1]._isInFirstContentOfListItem=!0,r++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,UI(d,c)),c=e[c],l=!0);else if(n[1]._container){for(r=c,o=void 0;r--;)if(s=d.get(r),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(o&&(d.get(o)[1].type="lineEndingBlank"),s[1].type="lineEnding",o=r);else if(s[1].type!=="linePrefix"&&s[1].type!=="listItemIndent")break;o&&(n[1].end={...d.get(o)[1].start},i=d.slice(o,c),i.unshift(n),d.splice(o,c-o+1,i))}}return gn(t,0,Number.POSITIVE_INFINITY,d.slice(0)),!l}function UI(t,e){const n=t.get(e)[1],o=t.get(e)[2];let r=e-1;const s=[];let i=n._tokenizer;i||(i=o.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(i._contentTypeTextTrailing=!0));const a=i.events,l=[],c={};let d,h,f=-1,m=n,g=0,x=0;const p=[x];for(;m;){for(;t.get(++r)[1]!==m;);s.push(r),m._tokenizer||(d=o.sliceStream(m),m.next||d.push(null),h&&i.defineSkip(m.start),m._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(d),m._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(x=f+1,p.push(x),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(i.events=[],m?(m._tokenizer=void 0,m.previous=void 0):p.pop(),f=p.length;f--;){const b=a.slice(p[f],p[f+1]),y=s.pop();l.push([y,y+b.length-1]),t.splice(y,2,b)}for(l.reverse(),f=-1;++f<l.length;)c[g+l[f][0]]=g+l[f][1],g+=l[f][1]-l[f][0]-1;return c}const $I={resolve:function(t){return Vy(t),t},tokenize:function(t,e){let n;return function(i){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),o(i)};function o(i){return i===null?r(i):Be(i)?t.check(VI,s,r)(i):(t.consume(i),o)}function r(i){return t.exit("chunkContent"),t.exit("content"),e(i)}function s(i){return t.consume(i),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}},VI={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),rt(t,r,"linePrefix")};function r(s){if(s===null||Be(s))return n(s);const i=o.events[o.events.length-1];return!o.parser.constructs.disable.null.includes("codeIndented")&&i&&i[1].type==="linePrefix"&&i[2].sliceSerialize(i[1],!0).length>=4?e(s):t.interrupt(o.parser.constructs.flow,n,e)(s)}}};function Hy(t,e,n,o,r,s,i,a,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return function(p){return p===60?(t.enter(o),t.enter(r),t.enter(s),t.consume(p),t.exit(s),h):p===null||p===32||p===41||wl(p)?n(p):(t.enter(o),t.enter(i),t.enter(a),t.enter("chunkString",{contentType:"string"}),g(p))};function h(p){return p===62?(t.enter(s),t.consume(p),t.exit(s),t.exit(r),t.exit(o),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===62?(t.exit("chunkString"),t.exit(a),h(p)):p===null||p===60||Be(p)?n(p):(t.consume(p),p===92?m:f)}function m(p){return p===60||p===62||p===92?(t.consume(p),f):f(p)}function g(p){return d||p!==null&&p!==41&&!ct(p)?d<c&&p===40?(t.consume(p),d++,g):p===41?(t.consume(p),d--,g):p===null||p===32||p===40||wl(p)?n(p):(t.consume(p),p===92?x:g):(t.exit("chunkString"),t.exit(a),t.exit(i),t.exit(o),e(p))}function x(p){return p===40||p===41||p===92?(t.consume(p),g):g(p)}}function Wy(t,e,n,o,r,s){const i=this;let a,l=0;return function(f){return t.enter(o),t.enter(r),t.consume(f),t.exit(r),t.enter(s),c};function c(f){return l>999||f===null||f===91||f===93&&!a||f===94&&!l&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):f===93?(t.exit(s),t.enter(r),t.consume(f),t.exit(r),t.exit(o),e):Be(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||Be(f)||l++>999?(t.exit("chunkString"),c(f)):(t.consume(f),a||(a=!et(f)),f===92?h:d)}function h(f){return f===91||f===92||f===93?(t.consume(f),l++,d):d(f)}}function qy(t,e,n,o,r,s){let i;return function(h){return h===34||h===39||h===40?(t.enter(o),t.enter(r),t.consume(h),t.exit(r),i=h===40?41:h,a):n(h)};function a(h){return h===i?(t.enter(r),t.consume(h),t.exit(r),t.exit(o),e):(t.enter(s),l(h))}function l(h){return h===i?(t.exit(s),a(i)):h===null?n(h):Be(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),rt(t,l,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(h))}function c(h){return h===i||h===null||Be(h)?(t.exit("chunkString"),l(h)):(t.consume(h),h===92?d:c)}function d(h){return h===i||h===92?(t.consume(h),c):c(h)}}function pi(t,e){let n;return function o(r){return Be(r)?(t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),n=!0,o):et(r)?rt(t,o,n?"linePrefix":"lineSuffix")(r):e(r)}}const HI={name:"definition",tokenize:function(t,e,n){const o=this;let r;return function(h){return t.enter("definition"),function(f){return Wy.call(o,t,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}(h)};function s(h){return r=Rn(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)),h===58?(t.enter("definitionMarker"),t.consume(h),t.exit("definitionMarker"),i):n(h)}function i(h){return ct(h)?pi(t,a)(h):a(h)}function a(h){return Hy(t,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function l(h){return t.attempt(WI,c,c)(h)}function c(h){return et(h)?rt(t,d,"whitespace")(h):d(h)}function d(h){return h===null||Be(h)?(t.exit("definition"),o.parser.defined.push(r),e(h)):n(h)}}},WI={partial:!0,tokenize:function(t,e,n){return function(i){return ct(i)?pi(t,o)(i):n(i)};function o(i){return qy(t,r,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(i)}function r(i){return et(i)?rt(t,s,"whitespace")(i):s(i)}function s(i){return i===null||Be(i)?e(i):n(i)}}},qI={name:"hardBreakEscape",tokenize:function(t,e,n){return function(r){return t.enter("hardBreakEscape"),t.consume(r),o};function o(r){return Be(r)?(t.exit("hardBreakEscape"),e(r)):n(r)}}},GI={name:"headingAtx",resolve:function(t,e){let n,o,r=t.length-2,s=3;return t[s][1].type==="whitespace"&&(s+=2),r-2>s&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(s===r-1||r-4>s&&t[r-2][1].type==="whitespace")&&(r-=s+1===r?2:4),r>s&&(n={type:"atxHeadingText",start:t[s][1].start,end:t[r][1].end},o={type:"chunkText",start:t[s][1].start,end:t[r][1].end,contentType:"text"},gn(t,s,r-s+1,[["enter",n,e],["enter",o,e],["exit",o,e],["exit",n,e]])),t},tokenize:function(t,e,n){let o=0;return function(l){return t.enter("atxHeading"),function(c){return t.enter("atxHeadingSequence"),r(c)}(l)};function r(l){return l===35&&o++<6?(t.consume(l),r):l===null||ct(l)?(t.exit("atxHeadingSequence"),s(l)):n(l)}function s(l){return l===35?(t.enter("atxHeadingSequence"),i(l)):l===null||Be(l)?(t.exit("atxHeading"),e(l)):et(l)?rt(t,s,"whitespace")(l):(t.enter("atxHeadingText"),a(l))}function i(l){return l===35?(t.consume(l),i):(t.exit("atxHeadingSequence"),s(l))}function a(l){return l===null||l===35||ct(l)?(t.exit("atxHeadingText"),s(l)):(t.consume(l),a)}}},YI=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Gy=["pre","script","style","textarea"],KI={concrete:!0,name:"htmlFlow",resolveTo:function(t){let e=t.length;for(;e--&&(t[e][0]!=="enter"||t[e][1].type!=="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t},tokenize:function(t,e,n){const o=this;let r,s,i,a,l;return function(A){return function(U){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(U),c}(A)};function c(A){return A===33?(t.consume(A),d):A===47?(t.consume(A),s=!0,m):A===63?(t.consume(A),r=3,o.interrupt?e:_):Zt(A)?(t.consume(A),i=String.fromCharCode(A),g):n(A)}function d(A){return A===45?(t.consume(A),r=2,h):A===91?(t.consume(A),r=5,a=0,f):Zt(A)?(t.consume(A),r=4,o.interrupt?e:_):n(A)}function h(A){return A===45?(t.consume(A),o.interrupt?e:_):n(A)}function f(A){return A==="CDATA[".charCodeAt(a++)?(t.consume(A),a===6?o.interrupt?e:T:f):n(A)}function m(A){return Zt(A)?(t.consume(A),i=String.fromCharCode(A),g):n(A)}function g(A){if(A===null||A===47||A===62||ct(A)){const U=A===47,V=i.toLowerCase();return U||s||!Gy.includes(V)?YI.includes(i.toLowerCase())?(r=6,U?(t.consume(A),x):o.interrupt?e(A):T(A)):(r=7,o.interrupt&&!o.parser.lazy[o.now().line]?n(A):s?p(A):b(A)):(r=1,o.interrupt?e(A):T(A))}return A===45||Ht(A)?(t.consume(A),i+=String.fromCharCode(A),g):n(A)}function x(A){return A===62?(t.consume(A),o.interrupt?e:T):n(A)}function p(A){return et(A)?(t.consume(A),p):S(A)}function b(A){return A===47?(t.consume(A),S):A===58||A===95||Zt(A)?(t.consume(A),y):et(A)?(t.consume(A),b):S(A)}function y(A){return A===45||A===46||A===58||A===95||Ht(A)?(t.consume(A),y):v(A)}function v(A){return A===61?(t.consume(A),w):et(A)?(t.consume(A),v):b(A)}function w(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(t.consume(A),l=A,j):et(A)?(t.consume(A),w):C(A)}function j(A){return A===l?(t.consume(A),l=null,N):A===null||Be(A)?n(A):(t.consume(A),j)}function C(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||ct(A)?v(A):(t.consume(A),C)}function N(A){return A===47||A===62||et(A)?b(A):n(A)}function S(A){return A===62?(t.consume(A),E):n(A)}function E(A){return A===null||Be(A)?T(A):et(A)?(t.consume(A),E):n(A)}function T(A){return A===45&&r===2?(t.consume(A),O):A===60&&r===1?(t.consume(A),R):A===62&&r===4?(t.consume(A),k):A===63&&r===3?(t.consume(A),_):A===93&&r===5?(t.consume(A),z):!Be(A)||r!==6&&r!==7?A===null||Be(A)?(t.exit("htmlFlowData"),I(A)):(t.consume(A),T):(t.exit("htmlFlowData"),t.check(XI,B,I)(A))}function I(A){return t.check(JI,D,B)(A)}function D(A){return t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),F}function F(A){return A===null||Be(A)?I(A):(t.enter("htmlFlowData"),T(A))}function O(A){return A===45?(t.consume(A),_):T(A)}function R(A){return A===47?(t.consume(A),i="",P):T(A)}function P(A){if(A===62){const U=i.toLowerCase();return Gy.includes(U)?(t.consume(A),k):T(A)}return Zt(A)&&i.length<8?(t.consume(A),i+=String.fromCharCode(A),P):T(A)}function z(A){return A===93?(t.consume(A),_):T(A)}function _(A){return A===62?(t.consume(A),k):A===45&&r===2?(t.consume(A),_):T(A)}function k(A){return A===null||Be(A)?(t.exit("htmlFlowData"),B(A)):(t.consume(A),k)}function B(A){return t.exit("htmlFlow"),e(A)}}},XI={partial:!0,tokenize:function(t,e,n){return function(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(fi,e,n)}}},JI={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return Be(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r):n(s)};function r(s){return o.parser.lazy[o.now().line]?n(s):e(s)}}},ZI={name:"htmlText",tokenize:function(t,e,n){const o=this;let r,s,i;return function(k){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(k),a};function a(k){return k===33?(t.consume(k),l):k===47?(t.consume(k),w):k===63?(t.consume(k),y):Zt(k)?(t.consume(k),N):n(k)}function l(k){return k===45?(t.consume(k),c):k===91?(t.consume(k),s=0,m):Zt(k)?(t.consume(k),b):n(k)}function c(k){return k===45?(t.consume(k),f):n(k)}function d(k){return k===null?n(k):k===45?(t.consume(k),h):Be(k)?(i=d,P(k)):(t.consume(k),d)}function h(k){return k===45?(t.consume(k),f):d(k)}function f(k){return k===62?R(k):k===45?h(k):d(k)}function m(k){return k==="CDATA[".charCodeAt(s++)?(t.consume(k),s===6?g:m):n(k)}function g(k){return k===null?n(k):k===93?(t.consume(k),x):Be(k)?(i=g,P(k)):(t.consume(k),g)}function x(k){return k===93?(t.consume(k),p):g(k)}function p(k){return k===62?R(k):k===93?(t.consume(k),p):g(k)}function b(k){return k===null||k===62?R(k):Be(k)?(i=b,P(k)):(t.consume(k),b)}function y(k){return k===null?n(k):k===63?(t.consume(k),v):Be(k)?(i=y,P(k)):(t.consume(k),y)}function v(k){return k===62?R(k):y(k)}function w(k){return Zt(k)?(t.consume(k),j):n(k)}function j(k){return k===45||Ht(k)?(t.consume(k),j):C(k)}function C(k){return Be(k)?(i=C,P(k)):et(k)?(t.consume(k),C):R(k)}function N(k){return k===45||Ht(k)?(t.consume(k),N):k===47||k===62||ct(k)?S(k):n(k)}function S(k){return k===47?(t.consume(k),R):k===58||k===95||Zt(k)?(t.consume(k),E):Be(k)?(i=S,P(k)):et(k)?(t.consume(k),S):R(k)}function E(k){return k===45||k===46||k===58||k===95||Ht(k)?(t.consume(k),E):T(k)}function T(k){return k===61?(t.consume(k),I):Be(k)?(i=T,P(k)):et(k)?(t.consume(k),T):S(k)}function I(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(t.consume(k),r=k,D):Be(k)?(i=I,P(k)):et(k)?(t.consume(k),I):(t.consume(k),F)}function D(k){return k===r?(t.consume(k),r=void 0,O):k===null?n(k):Be(k)?(i=D,P(k)):(t.consume(k),D)}function F(k){return k===null||k===34||k===39||k===60||k===61||k===96?n(k):k===47||k===62||ct(k)?S(k):(t.consume(k),F)}function O(k){return k===47||k===62||ct(k)?S(k):n(k)}function R(k){return k===62?(t.consume(k),t.exit("htmlTextData"),t.exit("htmlText"),e):n(k)}function P(k){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(k),t.exit("lineEnding"),z}function z(k){return et(k)?rt(t,_,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):_(k)}function _(k){return t.enter("htmlTextData"),i(k)}}},fh={name:"labelEnd",resolveAll:function(t){let e=-1;const n=[];for(;++e<t.length;){const o=t[e][1];if(n.push(t[e]),o.type==="labelImage"||o.type==="labelLink"||o.type==="labelEnd"){const r=o.type==="labelImage"?4:2;o.type="data",e+=r}}return t.length!==n.length&&gn(t,0,t.length,n),t},resolveTo:function(t,e){let n,o,r,s,i=t.length,a=0;for(;i--;)if(n=t[i][1],o){if(n.type==="link"||n.type==="labelLink"&&n._inactive)break;t[i][0]==="enter"&&n.type==="labelLink"&&(n._inactive=!0)}else if(r){if(t[i][0]==="enter"&&(n.type==="labelImage"||n.type==="labelLink")&&!n._balanced&&(o=i,n.type!=="labelLink")){a=2;break}}else n.type==="labelEnd"&&(r=i);const l={type:t[o][1].type==="labelLink"?"link":"image",start:{...t[o][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[o][1].start},end:{...t[r][1].end}},d={type:"labelText",start:{...t[o+a+2][1].end},end:{...t[r-2][1].start}};return s=[["enter",l,e],["enter",c,e]],s=Sn(s,t.slice(o+1,o+a+3)),s=Sn(s,[["enter",d,e]]),s=Sn(s,Cl(e.parser.constructs.insideSpan.null,t.slice(o+a+4,r-3),e)),s=Sn(s,[["exit",d,e],t[r-2],t[r-1],["exit",c,e]]),s=Sn(s,t.slice(r+1)),s=Sn(s,[["exit",l,e]]),gn(t,o,t.length,s),t},tokenize:function(t,e,n){const o=this;let r,s,i=o.events.length;for(;i--;)if((o.events[i][1].type==="labelImage"||o.events[i][1].type==="labelLink")&&!o.events[i][1]._balanced){r=o.events[i][1];break}return function(h){return r?r._inactive?d(h):(s=o.parser.defined.includes(Rn(o.sliceSerialize({start:r.end,end:o.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(h),t.exit("labelMarker"),t.exit("labelEnd"),a):n(h)};function a(h){return h===40?t.attempt(QI,c,s?c:d)(h):h===91?t.attempt(eA,c,s?l:d)(h):s?c(h):d(h)}function l(h){return t.attempt(tA,c,d)(h)}function c(h){return e(h)}function d(h){return r._balanced=!0,n(h)}}},QI={tokenize:function(t,e,n){return function(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),o};function o(d){return ct(d)?pi(t,r)(d):r(d)}function r(d){return d===41?c(d):Hy(t,s,i,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function s(d){return ct(d)?pi(t,a)(d):c(d)}function i(d){return n(d)}function a(d){return d===34||d===39||d===40?qy(t,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):c(d)}function l(d){return ct(d)?pi(t,c)(d):c(d)}function c(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):n(d)}}},eA={tokenize:function(t,e,n){const o=this;return function(i){return Wy.call(o,t,r,s,"reference","referenceMarker","referenceString")(i)};function r(i){return o.parser.defined.includes(Rn(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)))?e(i):n(i)}function s(i){return n(i)}}},tA={tokenize:function(t,e,n){return function(r){return t.enter("reference"),t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),o};function o(r){return r===93?(t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),t.exit("reference"),e):n(r)}}},nA={name:"labelStartImage",resolveAll:fh.resolveAll,tokenize:function(t,e,n){const o=this;return function(i){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(i),t.exit("labelImageMarker"),r};function r(i){return i===91?(t.enter("labelMarker"),t.consume(i),t.exit("labelMarker"),t.exit("labelImage"),s):n(i)}function s(i){return i===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(i):e(i)}}},oA={name:"labelStartLink",resolveAll:fh.resolveAll,tokenize:function(t,e,n){const o=this;return function(s){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelLink"),r};function r(s){return s===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(s):e(s)}}},mh={name:"lineEnding",tokenize:function(t,e){return function(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),rt(t,e,"linePrefix")}}},jl={name:"thematicBreak",tokenize:function(t,e,n){let o,r=0;return function(a){return t.enter("thematicBreak"),function(l){return o=l,s(l)}(a)};function s(a){return a===o?(t.enter("thematicBreakSequence"),i(a)):r>=3&&(a===null||Be(a))?(t.exit("thematicBreak"),e(a)):n(a)}function i(a){return a===o?(t.consume(a),r++,i):(t.exit("thematicBreakSequence"),et(a)?rt(t,s,"whitespace")(a):s(a))}}},rn={continuation:{tokenize:function(t,e,n){const o=this;return o.containerState._closeFlow=void 0,t.check(fi,r,s);function r(a){return o.containerState.furtherBlankLines=o.containerState.furtherBlankLines||o.containerState.initialBlankLine,rt(t,e,"listItemIndent",o.containerState.size+1)(a)}function s(a){return o.containerState.furtherBlankLines||!et(a)?(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,i(a)):(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,t.attempt(sA,e,i)(a))}function i(a){return o.containerState._closeFlow=!0,o.interrupt=void 0,rt(t,t.attempt(rn,e,n),"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}},exit:function(t){t.exit(this.containerState.type)},name:"list",tokenize:function(t,e,n){const o=this,r=o.events[o.events.length-1];let s=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,i=0;return function(f){const m=o.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!o.containerState.marker||f===o.containerState.marker:dh(f)){if(o.containerState.type||(o.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check(jl,n,l)(f):l(f);if(!o.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),a(f)}return n(f)};function a(f){return dh(f)&&++i<10?(t.consume(f),a):(!o.interrupt||i<2)&&(o.containerState.marker?f===o.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),l(f)):n(f)}function l(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),o.containerState.marker=o.containerState.marker||f,t.check(fi,o.interrupt?n:c,t.attempt(rA,h,d))}function c(f){return o.containerState.initialBlankLine=!0,s++,h(f)}function d(f){return et(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),h):n(f)}function h(f){return o.containerState.size=s+o.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}},rA={partial:!0,tokenize:function(t,e,n){const o=this;return rt(t,function(r){const s=o.events[o.events.length-1];return!et(r)&&s&&s[1].type==="listItemPrefixWhitespace"?e(r):n(r)},"listItemPrefixWhitespace",o.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},sA={partial:!0,tokenize:function(t,e,n){const o=this;return rt(t,function(r){const s=o.events[o.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===o.containerState.size?e(r):n(r)},"listItemIndent",o.containerState.size+1)}},Yy={name:"setextUnderline",resolveTo:function(t,e){let n,o,r,s=t.length;for(;s--;)if(t[s][0]==="enter"){if(t[s][1].type==="content"){n=s;break}t[s][1].type==="paragraph"&&(o=s)}else t[s][1].type==="content"&&t.splice(s,1),r||t[s][1].type!=="definition"||(r=s);const i={type:"setextHeading",start:{...t[n][1].start},end:{...t[t.length-1][1].end}};return t[o][1].type="setextHeadingText",r?(t.splice(o,0,["enter",i,e]),t.splice(r+1,0,["exit",t[n][1],e]),t[n][1].end={...t[r][1].end}):t[n][1]=i,t.push(["exit",i,e]),t},tokenize:function(t,e,n){const o=this;let r;return function(a){let l,c=o.events.length;for(;c--;)if(o.events[c][1].type!=="lineEnding"&&o.events[c][1].type!=="linePrefix"&&o.events[c][1].type!=="content"){l=o.events[c][1].type==="paragraph";break}return!o.parser.lazy[o.now().line]&&(o.interrupt||l)?(t.enter("setextHeadingLine"),r=a,function(d){return t.enter("setextHeadingLineSequence"),s(d)}(a)):n(a)};function s(a){return a===r?(t.consume(a),s):(t.exit("setextHeadingLineSequence"),et(a)?rt(t,i,"lineSuffix")(a):i(a))}function i(a){return a===null||Be(a)?(t.exit("setextHeadingLine"),e(a)):n(a)}}},iA={tokenize:function(t){const e=this,n=t.attempt(fi,function(r){return r===null?void t.consume(r):(t.enter("lineEndingBlank"),t.consume(r),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n)},t.attempt(this.parser.constructs.flowInitial,o,rt(t,t.attempt(this.parser.constructs.flow,o,t.attempt($I,o)),"linePrefix")));return n;function o(r){if(r!==null)return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),e.currentConstruct=void 0,n;t.consume(r)}}},aA={resolveAll:Xy()},lA=Ky("string"),cA=Ky("text");function Ky(t){return{resolveAll:Xy(t==="text"?dA:void 0),tokenize:function(e){const n=this,o=this.parser.constructs[t],r=e.attempt(o,s,i);return s;function s(c){return l(c)?r(c):i(c)}function i(c){if(c!==null)return e.enter("data"),e.consume(c),a;e.consume(c)}function a(c){return l(c)?(e.exit("data"),r(c)):(e.consume(c),a)}function l(c){if(c===null)return!0;const d=o[c];let h=-1;if(d)for(;++h<d.length;){const f=d[h];if(!f.previous||f.previous.call(n,n.previous))return!0}return!1}}}}function Xy(t){return function(e,n){let o,r=-1;for(;++r<=e.length;)o===void 0?e[r]&&e[r][1].type==="data"&&(o=r,r++):e[r]&&e[r][1].type==="data"||(r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),r=o+2),o=void 0);return t?t(e,n):e}}function dA(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const o=t[n-1][1],r=e.sliceStream(o);let s,i=r.length,a=-1,l=0;for(;i--;){const c=r[i];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(c===-2)s=!0,l++;else if(c!==-1){i++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(l=0),l){const c={type:n===t.length||s||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:o.start._bufferIndex+a,_index:o.start._index+i,line:o.end.line,column:o.end.column-l,offset:o.end.offset-l},end:{...o.end}};o.end={...c.start},o.start.offset===o.end.offset?Object.assign(o,c):(t.splice(n,0,["enter",c,e],["exit",c,e]),n+=2)}n++}return t}const uA={42:rn,43:rn,45:rn,48:rn,49:rn,50:rn,51:rn,52:rn,53:rn,54:rn,55:rn,56:rn,57:rn,62:Fy},hA={91:HI},fA={[-2]:hh,[-1]:hh,32:hh},mA={35:GI,42:jl,45:[Yy,jl],60:KI,61:Yy,95:jl,96:$y,126:$y},pA={38:By,92:zy},gA={[-5]:mh,[-4]:mh,[-3]:mh,33:nA,38:By,42:uh,60:[LI,ZI],91:oA,92:[qI,zy],93:fh,95:uh,96:zI},xA={null:[uh,aA]},bA=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:hA,disable:{null:[]},document:uA,flow:mA,flowInitial:fA,insideSpan:xA,string:pA,text:gA},Symbol.toStringTag,{value:"Module"}));function yA(t,e,n){let o={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const r={},s=[];let i=[],a=[];const l={attempt:p(function(v,w){b(v,w.from)}),check:p(x),consume:function(v){Be(v)?(o.line++,o.column=1,o.offset+=v===-3?2:1,y()):v!==-1&&(o.column++,o.offset++),o._bufferIndex<0?o._index++:(o._bufferIndex++,o._bufferIndex===i[o._index].length&&(o._bufferIndex=-1,o._index++)),c.previous=v},enter:function(v,w){const j=w||{};return j.type=v,j.start=f(),c.events.push(["enter",j,c]),a.push(j),j},exit:function(v){const w=a.pop();return w.end=f(),c.events.push(["exit",w,c]),w},interrupt:p(x,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(v){r[v.line]=v.column,y()},events:[],now:f,parser:t,previous:null,sliceSerialize:function(v,w){return function(j,C){let N=-1;const S=[];let E;for(;++N<j.length;){const T=j[N];let I;if(typeof T=="string")I=T;else switch(T){case-5:I="\r";break;case-4:I=`
|
|
129
129
|
`;break;case-3:I=`\r
|
|
130
130
|
`;break;case-2:I=C?" ":" ";break;case-1:if(!C&&E)continue;I=" ";break;default:I=String.fromCharCode(T)}E=T===-2,S.push(I)}return S.join("")}(h(v),w)},sliceStream:h,write:function(v){return i=Sn(i,v),m(),i[i.length-1]!==null?[]:(b(e,0),c.events=Cl(s,c.events,c),c.events)}};let d=e.tokenize.call(c,l);return e.resolveAll&&s.push(e),c;function h(v){return function(w,j){const C=j.start._index,N=j.start._bufferIndex,S=j.end._index,E=j.end._bufferIndex;let T;if(C===S)T=[w[C].slice(N,E)];else{if(T=w.slice(C,S),N>-1){const I=T[0];typeof I=="string"?T[0]=I.slice(N):T.shift()}E>0&&T.push(w[S].slice(0,E))}return T}(i,v)}function f(){const{_bufferIndex:v,_index:w,line:j,column:C,offset:N}=o;return{_bufferIndex:v,_index:w,line:j,column:C,offset:N}}function m(){let v;for(;o._index<i.length;){const w=i[o._index];if(typeof w=="string")for(v=o._index,o._bufferIndex<0&&(o._bufferIndex=0);o._index===v&&o._bufferIndex<w.length;)g(w.charCodeAt(o._bufferIndex));else g(w)}}function g(v){d=d(v)}function x(v,w){w.restore()}function p(v,w){return function(j,C,N){let S,E,T,I;return Array.isArray(j)?D(j):"tokenize"in j?D([j]):function(P){return z;function z(_){const k=_!==null&&P[_],B=_!==null&&P.null;return D([...Array.isArray(k)?k:k?[k]:[],...Array.isArray(B)?B:B?[B]:[]])(_)}}(j);function D(P){return S=P,E=0,P.length===0?N:F(P[E])}function F(P){return function(z){return I=function(){const _=f(),k=c.previous,B=c.currentConstruct,A=c.events.length,U=Array.from(a);return{from:A,restore:V};function V(){o=_,c.previous=k,c.currentConstruct=B,c.events.length=A,a=U,y()}}(),T=P,P.partial||(c.currentConstruct=P),P.name&&c.parser.constructs.disable.null.includes(P.name)?R():P.tokenize.call(w?Object.assign(Object.create(c),w):c,l,O,R)(z)}}function O(P){return v(T,I),C}function R(P){return I.restore(),++E<S.length?F(S[E]):N}}}function b(v,w){v.resolveAll&&!s.includes(v)&&s.push(v),v.resolve&&gn(c.events,w,c.events.length-w,v.resolve(c.events.slice(w),c)),v.resolveTo&&(c.events=v.resolveTo(c.events,c))}function y(){o.line in r&&o.column<2&&(o.column=r[o.line],o.offset+=r[o.line]-1)}}const Jy=/[\0\t\n\r]/g,vA=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function wA(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),r=o===120||o===88;return Ry(n.slice(r?2:1),r?16:10)}return ch(n)||t}const Zy={}.hasOwnProperty;function kA(t,e,n){return typeof e!="string"&&(n=e,e=void 0),function(o){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(Se),autolinkProtocol:D,autolinkEmail:D,atxHeading:l(re),blockQuote:l(ne),characterEscape:D,characterReference:D,codeFenced:l(ie),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:l(ie,c),codeText:l(se,c),codeTextData:D,data:D,codeFlowValue:D,definition:l(ae),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:l(fe),hardBreakEscape:l(ue),hardBreakTrailing:l(ue),htmlFlow:l(le,c),htmlFlowData:D,htmlText:l(le,c),htmlTextData:D,image:l(je),label:c,link:l(Se),listItem:l(Ie),listItemValue:x,listOrdered:l(Le,g),listUnordered:l(Le),paragraph:l(ke),reference:G,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:l(re),strong:l(Ye),thematicBreak:l(Ke)},exit:{atxHeading:h(),atxHeadingSequence:S,autolink:h(),autolinkEmail:oe,autolinkProtocol:te,blockQuote:h(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:J,characterReferenceMarkerNumeric:J,characterReferenceValue:$,characterReference:Q,codeFenced:h(v),codeFencedFence:y,codeFencedFenceInfo:p,codeFencedFenceMeta:b,codeFlowValue:F,codeIndented:h(w),codeText:h(_),codeTextData:F,data:F,definition:h(),definitionDestinationString:N,definitionLabelString:j,definitionTitleString:C,emphasis:h(),hardBreakEscape:h(R),hardBreakTrailing:h(R),htmlFlow:h(P),htmlFlowData:F,htmlText:h(z),htmlTextData:F,image:h(B),label:U,labelText:A,lineEnding:O,link:h(k),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:W,resourceDestinationString:V,resourceTitleString:X,resource:Y,setextHeading:h(I),setextHeadingLineSequence:T,setextHeadingText:E,strong:h(),thematicBreak:h()}};Qy(r,(o||{}).mdastExtensions||[]);const s={};return i;function i(ee){let ye={type:"root",children:[]};const we={stack:[ye],tokenStack:[],config:r,enter:d,exit:f,buffer:c,resume:m,data:s},Ae=[];let K=-1;for(;++K<ee.length;)(ee[K][1].type==="listOrdered"||ee[K][1].type==="listUnordered")&&(ee[K][0]==="enter"?Ae.push(K):K=a(ee,Ae.pop(),K));for(K=-1;++K<ee.length;){const pe=r[ee[K][0]];Zy.call(pe,ee[K][1].type)&&pe[ee[K][1].type].call(Object.assign({sliceSerialize:ee[K][2].sliceSerialize},we),ee[K][1])}if(we.tokenStack.length>0){const pe=we.tokenStack[we.tokenStack.length-1];(pe[1]||ev).call(we,void 0,pe[0])}for(ye.position={start:Fo(ee.length>0?ee[0][1].start:{line:1,column:1,offset:0}),end:Fo(ee.length>0?ee[ee.length-2][1].end:{line:1,column:1,offset:0})},K=-1;++K<r.transforms.length;)ye=r.transforms[K](ye)||ye;return ye}function a(ee,ye,we){let Ae,K,pe,ge,he=ye-1,Ce=-1,Re=!1;for(;++he<=we;){const Pe=ee[he];switch(Pe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":Pe[0]==="enter"?Ce++:Ce--,ge=void 0;break;case"lineEndingBlank":Pe[0]==="enter"&&(!Ae||ge||Ce||pe||(pe=he),ge=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ge=void 0}if(!Ce&&Pe[0]==="enter"&&Pe[1].type==="listItemPrefix"||Ce===-1&&Pe[0]==="exit"&&(Pe[1].type==="listUnordered"||Pe[1].type==="listOrdered")){if(Ae){let He=he;for(K=void 0;He--;){const ce=ee[He];if(ce[1].type==="lineEnding"||ce[1].type==="lineEndingBlank"){if(ce[0]==="exit")continue;K&&(ee[K][1].type="lineEndingBlank",Re=!0),ce[1].type="lineEnding",K=He}else if(ce[1].type!=="linePrefix"&&ce[1].type!=="blockQuotePrefix"&&ce[1].type!=="blockQuotePrefixWhitespace"&&ce[1].type!=="blockQuoteMarker"&&ce[1].type!=="listItemIndent")break}pe&&(!K||pe<K)&&(Ae._spread=!0),Ae.end=Object.assign({},K?ee[K][1].start:Pe[1].end),ee.splice(K||he,0,["exit",Ae,Pe[2]]),he++,we++}if(Pe[1].type==="listItemPrefix"){const He={type:"listItem",_spread:!1,start:Object.assign({},Pe[1].start),end:void 0};Ae=He,ee.splice(he,0,["enter",He,Pe[2]]),he++,we++,pe=void 0,ge=!0}}}return ee[ye][1]._spread=Re,we}function l(ee,ye){return we;function we(Ae){d.call(this,ee(Ae),Ae),ye&&ye.call(this,Ae)}}function c(){this.stack.push({type:"fragment",children:[]})}function d(ee,ye,we){this.stack[this.stack.length-1].children.push(ee),this.stack.push(ee),this.tokenStack.push([ye,we||void 0]),ee.position={start:Fo(ye.start),end:void 0}}function h(ee){return ye;function ye(we){ee&&ee.call(this,we),f.call(this,we)}}function f(ee,ye){const we=this.stack.pop(),Ae=this.tokenStack.pop();if(!Ae)throw new Error("Cannot close `"+ee.type+"` ("+ui({start:ee.start,end:ee.end})+"): it\u2019s not open");Ae[0].type!==ee.type&&(ye?ye.call(this,ee,Ae[0]):(Ae[1]||ev).call(this,ee,Ae[0])),we.position.end=Fo(ee.end)}function m(){return lh(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function x(ee){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(ee),10),this.data.expectingFirstListItemValue=void 0)}function p(){const ee=this.resume();this.stack[this.stack.length-1].lang=ee}function b(){const ee=this.resume();this.stack[this.stack.length-1].meta=ee}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const ee=this.resume();this.stack[this.stack.length-1].value=ee.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const ee=this.resume();this.stack[this.stack.length-1].value=ee.replace(/(\r?\n|\r)$/g,"")}function j(ee){const ye=this.resume(),we=this.stack[this.stack.length-1];we.label=ye,we.identifier=Rn(this.sliceSerialize(ee)).toLowerCase()}function C(){const ee=this.resume();this.stack[this.stack.length-1].title=ee}function N(){const ee=this.resume();this.stack[this.stack.length-1].url=ee}function S(ee){const ye=this.stack[this.stack.length-1];if(!ye.depth){const we=this.sliceSerialize(ee).length;ye.depth=we}}function E(){this.data.setextHeadingSlurpLineEnding=!0}function T(ee){this.stack[this.stack.length-1].depth=this.sliceSerialize(ee).codePointAt(0)===61?1:2}function I(){this.data.setextHeadingSlurpLineEnding=void 0}function D(ee){const ye=this.stack[this.stack.length-1].children;let we=ye[ye.length-1];we&&we.type==="text"||(we=Ve(),we.position={start:Fo(ee.start),end:void 0},ye.push(we)),this.stack.push(we)}function F(ee){const ye=this.stack.pop();ye.value+=this.sliceSerialize(ee),ye.position.end=Fo(ee.end)}function O(ee){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak)return ye.children[ye.children.length-1].position.end=Fo(ee.end),void(this.data.atHardBreak=void 0);!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(ye.type)&&(D.call(this,ee),F.call(this,ee))}function R(){this.data.atHardBreak=!0}function P(){const ee=this.resume();this.stack[this.stack.length-1].value=ee}function z(){const ee=this.resume();this.stack[this.stack.length-1].value=ee}function _(){const ee=this.resume();this.stack[this.stack.length-1].value=ee}function k(){const ee=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ee.type+="Reference",ee.referenceType=ye,delete ee.url,delete ee.title}else delete ee.identifier,delete ee.label;this.data.referenceType=void 0}function B(){const ee=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ee.type+="Reference",ee.referenceType=ye,delete ee.url,delete ee.title}else delete ee.identifier,delete ee.label;this.data.referenceType=void 0}function A(ee){const ye=this.sliceSerialize(ee),we=this.stack[this.stack.length-2];we.label=function(Ae){return Ae.replace(vA,wA)}(ye),we.identifier=Rn(ye).toLowerCase()}function U(){const ee=this.stack[this.stack.length-1],ye=this.resume(),we=this.stack[this.stack.length-1];if(this.data.inReference=!0,we.type==="link"){const Ae=ee.children;we.children=Ae}else we.alt=ye}function V(){const ee=this.resume();this.stack[this.stack.length-1].url=ee}function X(){const ee=this.resume();this.stack[this.stack.length-1].title=ee}function Y(){this.data.inReference=void 0}function G(){this.data.referenceType="collapsed"}function W(ee){const ye=this.resume(),we=this.stack[this.stack.length-1];we.label=ye,we.identifier=Rn(this.sliceSerialize(ee)).toLowerCase(),this.data.referenceType="full"}function J(ee){this.data.characterReferenceType=ee.type}function $(ee){const ye=this.sliceSerialize(ee),we=this.data.characterReferenceType;let Ae;we?(Ae=Ry(ye,we==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ae=ch(ye),this.stack[this.stack.length-1].value+=Ae}function Q(ee){this.stack.pop().position.end=Fo(ee.end)}function te(ee){F.call(this,ee),this.stack[this.stack.length-1].url=this.sliceSerialize(ee)}function oe(ee){F.call(this,ee),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(ee)}function ne(){return{type:"blockquote",children:[]}}function ie(){return{type:"code",lang:null,meta:null,value:""}}function se(){return{type:"inlineCode",value:""}}function ae(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function fe(){return{type:"emphasis",children:[]}}function re(){return{type:"heading",depth:0,children:[]}}function ue(){return{type:"break"}}function le(){return{type:"html",value:""}}function je(){return{type:"image",title:null,url:"",alt:null}}function Se(){return{type:"link",title:null,url:"",children:[]}}function Le(ee){return{type:"list",ordered:ee.type==="listOrdered",start:null,spread:ee._spread,children:[]}}function Ie(ee){return{type:"listItem",spread:ee._spread,checked:null,children:[]}}function ke(){return{type:"paragraph",children:[]}}function Ye(){return{type:"strong",children:[]}}function Ve(){return{type:"text",value:""}}function Ke(){return{type:"thematicBreak"}}}(n)(function(o){for(;!Vy(o););return o}(function(o){const r={constructs:Dy([bA,...(o||{}).extensions||[]]),content:s(RI),defined:[],document:s(PI),flow:s(iA),lazy:{},string:s(lA),text:s(cA)};return r;function s(i){return function(a){return yA(r,i,a)}}}(n).document().write(function(){let o,r=1,s="",i=!0;return function(a,l,c){const d=[];let h,f,m,g,x;for(a=s+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a)),m=0,s="",i&&(a.charCodeAt(0)===65279&&m++,i=void 0);m<a.length;){if(Jy.lastIndex=m,h=Jy.exec(a),g=h&&h.index!==void 0?h.index:a.length,x=a.charCodeAt(g),!h){s=a.slice(m);break}if(x===10&&m===g&&o)d.push(-3),o=void 0;else switch(o&&(d.push(-5),o=void 0),m<g&&(d.push(a.slice(m,g)),r+=g-m),x){case 0:d.push(65533),r++;break;case 9:for(f=4*Math.ceil(r/4),d.push(-2);r++<f;)d.push(-1);break;case 10:d.push(-4),r=1;break;default:o=!0,r=1}m=g+1}return c&&(o&&d.push(-5),s&&d.push(s),d.push(null)),d}}()(t,e,!0))))}function Fo(t){return{line:t.line,column:t.column,offset:t.offset}}function Qy(t,e){let n=-1;for(;++n<e.length;){const o=e[n];Array.isArray(o)?Qy(t,o):CA(t,o)}}function CA(t,e){let n;for(n in e)if(Zy.call(e,n))switch(n){case"canContainEols":{const o=e[n];o&&t[n].push(...o);break}case"transforms":{const o=e[n];o&&t[n].push(...o);break}case"enter":case"exit":{const o=e[n];o&&Object.assign(t[n],o);break}}}function ev(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+ui({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+ui({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+ui({start:e.start,end:e.end})+") is still open")}function jA(t){const e=this;e.parser=function(n){return kA(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function tv(t,e){const n=e.referenceType;let o="]";if(n==="collapsed"?o+="[]":n==="full"&&(o+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+o}];const r=t.all(e),s=r[0];s&&s.type==="text"?s.value="["+s.value:r.unshift({type:"text",value:"["});const i=r[r.length-1];return i&&i.type==="text"?i.value+=o:r.push({type:"text",value:o}),r}function nv(t){const e=t.spread;return e??t.children.length>1}function SA(t){const e=String(t),n=/\r?\n|\r/g;let o=n.exec(e),r=0;const s=[];for(;o;)s.push(ov(e.slice(r,o.index),r>0,!0),o[0]),r=o.index+o[0].length,o=n.exec(e);return s.push(ov(e.slice(r),r>0,!1)),s.join("")}function ov(t,e,n){let o=0,r=t.length;if(e){let s=t.codePointAt(o);for(;s===9||s===32;)o++,s=t.codePointAt(o)}if(n){let s=t.codePointAt(r-1);for(;s===9||s===32;)r--,s=t.codePointAt(r-1)}return r>o?t.slice(o,r):""}const NA={blockquote:function(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)},break:function(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
|
|
131
131
|
`}]},code:function(t,e){const n=e.value?e.value+`
|
|
@@ -155,9 +155,9 @@ ${m.codeAfter}
|
|
|
155
155
|
`)}(c,{align:d,alignDelimiters:o,padding:n,stringLength:r})}function l(c,d,h){const f=c.children;let m=-1;const g=[],x=d.enter("tableRow");for(;++m<f.length;)g[m]=i(f[m],0,d,h);return x(),g}}function zv(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function M8(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const o=n.children[0];if(o&&o.type==="text"){const r=e.children;let s,i=-1;for(;++i<r.length;){const a=r[i];if(a.type==="paragraph"){s=a;break}}s===n&&(o.value=o.value.slice(1),o.value.length===0?n.children.shift():n.position&&o.position&&typeof o.position.start.offset=="number"&&(o.position.start.column++,o.position.start.offset++,n.position.start=Object.assign({},o.position.start)))}}this.exit(t)}function O8(t,e,n,o){const r=t.children[0],s=typeof t.checked=="boolean"&&r&&r.type==="paragraph",i="["+(t.checked?"x":" ")+"] ",a=n.createTracker(o);s&&a.move(i);let l=Lv.listItem(t,e,n,{...o,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(c){return c+i})),l}const D8={tokenize:function(t,e,n){let o=0;return function s(i){return(i===87||i===119)&&o<3?(o++,t.consume(i),s):i===46&&o===3?(t.consume(i),r):n(i)};function r(s){return s===null?n(s):e(s)}},partial:!0},Bv={tokenize:function(t,e,n){let o,r,s;return i;function i(c){return c===46||c===95?t.check($v,l,a)(c):c===null||ct(c)||dr(c)||c!==45&&kl(c)?l(c):(s=!0,t.consume(c),i)}function a(c){return c===95?o=!0:(r=o,o=void 0),t.consume(c),i}function l(c){return r||o||!s?n(c):e(c)}},partial:!0},Uv={tokenize:function(t,e){let n=0,o=0;return r;function r(i){return i===40?(n++,t.consume(i),r):i===41&&o<n?s(i):i===33||i===34||i===38||i===39||i===41||i===42||i===44||i===46||i===58||i===59||i===60||i===63||i===93||i===95||i===126?t.check($v,e,s)(i):i===null||ct(i)||dr(i)?e(i):(t.consume(i),r)}function s(i){return i===41&&o++,t.consume(i),r}},partial:!0},$v={tokenize:function(t,e,n){return o;function o(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(t.consume(a),o):a===38?(t.consume(a),s):a===93?(t.consume(a),r):a===60||a===null||ct(a)||dr(a)?e(a):n(a)}function r(a){return a===null||a===40||a===91||ct(a)||dr(a)?e(a):o(a)}function s(a){return Zt(a)?i(a):n(a)}function i(a){return a===59?(t.consume(a),o):Zt(a)?(t.consume(a),i):n(a)}},partial:!0},R8={tokenize:function(t,e,n){return function(r){return t.consume(r),o};function o(r){return Ht(r)?n(r):e(r)}},partial:!0},Vv={name:"wwwAutolink",tokenize:function(t,e,n){const o=this;return function(s){return s!==87&&s!==119||!Wv.call(o,o.previous)||Ph(o.events)?n(s):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(D8,t.attempt(Bv,t.attempt(Uv,r),n),n)(s))};function r(s){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(s)}},previous:Wv},Hv={name:"protocolAutolink",tokenize:function(t,e,n){const o=this;let r="",s=!1;return function(d){return(d===72||d===104)&&qv.call(o,o.previous)&&!Ph(o.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),r+=String.fromCodePoint(d),t.consume(d),i):n(d)};function i(d){if(Zt(d)&&r.length<5)return r+=String.fromCodePoint(d),t.consume(d),i;if(d===58){const h=r.toLowerCase();if(h==="http"||h==="https")return t.consume(d),a}return n(d)}function a(d){return d===47?(t.consume(d),s?l:(s=!0,a)):n(d)}function l(d){return d===null||wl(d)||ct(d)||dr(d)||kl(d)?n(d):t.attempt(Bv,t.attempt(Uv,c),n)(d)}function c(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}},previous:qv},so={name:"emailAutolink",tokenize:function(t,e,n){const o=this;let r,s;return function(d){return!Rh(d)||!Gv.call(o,o.previous)||Ph(o.events)?n(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),i(d))};function i(d){return Rh(d)?(t.consume(d),i):d===64?(t.consume(d),a):n(d)}function a(d){return d===46?t.check(R8,c,l)(d):d===45||d===95||Ht(d)?(s=!0,t.consume(d),a):c(d)}function l(d){return t.consume(d),r=!0,a}function c(d){return s&&r&&Zt(o.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):n(d)}},previous:Gv},Yn={};let ur=48;for(;ur<123;)Yn[ur]=so,ur++,ur===58?ur=65:ur===91&&(ur=97);function Wv(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||ct(t)}function qv(t){return!Zt(t)}function Gv(t){return!(t===47||Rh(t))}function Rh(t){return t===43||t===45||t===46||t===95||Ht(t)}function Ph(t){let e=t.length,n=!1;for(;e--;){const o=t[e][1];if((o.type==="labelLink"||o.type==="labelImage")&&!o._balanced){n=!0;break}if(o._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}Yn[43]=so,Yn[45]=so,Yn[46]=so,Yn[95]=so,Yn[72]=[so,Hv],Yn[104]=[so,Hv],Yn[87]=[so,Vv],Yn[119]=[so,Vv];const P8={tokenize:function(t,e,n){const o=this;return rt(t,function(r){const s=o.events[o.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?e(r):n(r)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function L8(t,e,n){const o=this;let r=o.events.length;const s=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]);let i;for(;r--;){const a=o.events[r][1];if(a.type==="labelImage"){i=a;break}if(a.type==="gfmFootnoteCall"||a.type==="labelLink"||a.type==="label"||a.type==="image"||a.type==="link")break}return function(a){if(!i||!i._balanced)return n(a);const l=Rn(o.sliceSerialize({start:i.end,end:o.now()}));return l.codePointAt(0)!==94||!s.includes(l.slice(1))?n(a):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(a),t.exit("gfmFootnoteCallLabelMarker"),e(a))}}function F8(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const o={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},r={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};r.end.column++,r.end.offset++,r.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},r.end),end:Object.assign({},t[t.length-1][1].start)},i={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[t[n+1],t[n+2],["enter",o,e],t[n+3],t[n+4],["enter",r,e],["exit",r,e],["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",o,e]];return t.splice(n,t.length-n+1,...a),t}function z8(t,e,n){const o=this,r=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]);let s,i=0;return function(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),a};function a(d){return d!==94?n(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",l)}function l(d){if(i>999||d===93&&!s||d===null||d===91||ct(d))return n(d);if(d===93){t.exit("chunkString");const h=t.exit("gfmFootnoteCallString");return r.includes(Rn(o.sliceSerialize(h)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(d)}return ct(d)||(s=!0),i++,t.consume(d),d===92?c:l}function c(d){return d===91||d===92||d===93?(t.consume(d),i++,l):l(d)}}function B8(t,e,n){const o=this,r=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]);let s,i,a=0;return function(m){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(m){return m===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",c):n(m)}function c(m){if(a>999||m===93&&!i||m===null||m===91||ct(m))return n(m);if(m===93){t.exit("chunkString");const g=t.exit("gfmFootnoteDefinitionLabelString");return s=Rn(o.sliceSerialize(g)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),h}return ct(m)||(i=!0),a++,t.consume(m),m===92?d:c}function d(m){return m===91||m===92||m===93?(t.consume(m),a++,c):c(m)}function h(m){return m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),r.includes(s)||r.push(s),rt(t,f,"gfmFootnoteDefinitionWhitespace")):n(m)}function f(m){return e(m)}}function U8(t,e,n){return t.check(fi,e,t.attempt(P8,e,n))}function $8(t){t.exit("gfmFootnoteDefinition")}function V8(t){let e=(t||{}).singleTilde;const n={name:"strikethrough",tokenize:function(o,r,s){const i=this.previous,a=this.events;let l=0;return function(d){return i===126&&a[a.length-1][1].type!=="characterEscape"?s(d):(o.enter("strikethroughSequenceTemporary"),c(d))};function c(d){const h=qr(i);if(d===126)return l>1?s(d):(o.consume(d),l++,c);if(l<2&&!e)return s(d);const f=o.exit("strikethroughSequenceTemporary"),m=qr(d);return f._open=!m||m===2&&!!h,f._close=!h||h===2&&!!m,r(d)}},resolveAll:function(o,r){let s=-1;for(;++s<o.length;)if(o[s][0]==="enter"&&o[s][1].type==="strikethroughSequenceTemporary"&&o[s][1]._close){let i=s;for(;i--;)if(o[i][0]==="exit"&&o[i][1].type==="strikethroughSequenceTemporary"&&o[i][1]._open&&o[s][1].end.offset-o[s][1].start.offset===o[i][1].end.offset-o[i][1].start.offset){o[s][1].type="strikethroughSequence",o[i][1].type="strikethroughSequence";const a={type:"strikethrough",start:Object.assign({},o[i][1].start),end:Object.assign({},o[s][1].end)},l={type:"strikethroughText",start:Object.assign({},o[i][1].end),end:Object.assign({},o[s][1].start)},c=[["enter",a,r],["enter",o[i][1],r],["exit",o[i][1],r],["enter",l,r]],d=r.parser.constructs.insideSpan.null;d&&gn(c,c.length,0,Cl(d,o.slice(i+1,s),r)),gn(c,c.length,0,[["exit",l,r],["enter",o[s][1],r],["exit",o[s][1],r],["exit",a,r]]),gn(o,i-1,s-i+3,c),s=i+c.length-2;break}}for(s=-1;++s<o.length;)o[s][1].type==="strikethroughSequenceTemporary"&&(o[s][1].type="data");return o}};return e==null&&(e=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}}class H8{constructor(){this.map=[]}add(e,n,o){(function(r,s,i,a){let l=0;if(!(i===0&&a.length===0)){for(;l<r.map.length;){if(r.map[l][0]===s)return r.map[l][1]+=i,void r.map[l][2].push(...a);l+=1}r.map.push([s,i,a])}})(this,e,n,o)}consume(e){if(this.map.sort(function(s,i){return s[0]-i[0]}),this.map.length===0)return;let n=this.map.length;const o=[];for(;n>0;)n-=1,o.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];o.push(e.slice()),e.length=0;let r=o.pop();for(;r;){for(const s of r)e.push(s);r=o.pop()}this.map.length=0}}function W8(t,e){let n=!1;const o=[];for(;e<t.length;){const r=t[e];if(n){if(r[0]==="enter")r[1].type==="tableContent"&&o.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(r[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=o.length-1;o[s]=o[s]==="left"?"center":"right"}}else if(r[1].type==="tableDelimiterRow")break}else r[0]==="enter"&&r[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return o}function q8(t,e,n){const o=this;let r,s=0,i=0;return function(S){let E=o.events.length-1;for(;E>-1;){const D=o.events[E][1].type;if(D!=="lineEnding"&&D!=="linePrefix")break;E--}const T=E>-1?o.events[E][1].type:null,I=T==="tableHead"||T==="tableRow"?w:a;return I===w&&o.parser.lazy[o.now().line]?n(S):I(S)};function a(S){return t.enter("tableHead"),t.enter("tableRow"),function(E){return E===124||(r=!0,i+=1),l(E)}(S)}function l(S){return S===null?n(S):Be(S)?i>1?(i=0,o.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),h):n(S):et(S)?rt(t,l,"whitespace")(S):(i+=1,r&&(r=!1,s+=1),S===124?(t.enter("tableCellDivider"),t.consume(S),t.exit("tableCellDivider"),r=!0,l):(t.enter("data"),c(S)))}function c(S){return S===null||S===124||ct(S)?(t.exit("data"),l(S)):(t.consume(S),S===92?d:c)}function d(S){return S===92||S===124?(t.consume(S),c):c(S)}function h(S){return o.interrupt=!1,o.parser.lazy[o.now().line]?n(S):(t.enter("tableDelimiterRow"),r=!1,et(S)?rt(t,f,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):f(S))}function f(S){return S===45||S===58?g(S):S===124?(r=!0,t.enter("tableCellDivider"),t.consume(S),t.exit("tableCellDivider"),m):v(S)}function m(S){return et(S)?rt(t,g,"whitespace")(S):g(S)}function g(S){return S===58?(i+=1,r=!0,t.enter("tableDelimiterMarker"),t.consume(S),t.exit("tableDelimiterMarker"),x):S===45?(i+=1,x(S)):S===null||Be(S)?y(S):v(S)}function x(S){return S===45?(t.enter("tableDelimiterFiller"),p(S)):v(S)}function p(S){return S===45?(t.consume(S),p):S===58?(r=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(S),t.exit("tableDelimiterMarker"),b):(t.exit("tableDelimiterFiller"),b(S))}function b(S){return et(S)?rt(t,y,"whitespace")(S):y(S)}function y(S){return S===124?f(S):(S===null||Be(S))&&r&&s===i?(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(S)):v(S)}function v(S){return n(S)}function w(S){return t.enter("tableRow"),j(S)}function j(S){return S===124?(t.enter("tableCellDivider"),t.consume(S),t.exit("tableCellDivider"),j):S===null||Be(S)?(t.exit("tableRow"),e(S)):et(S)?rt(t,j,"whitespace")(S):(t.enter("data"),C(S))}function C(S){return S===null||S===124||ct(S)?(t.exit("data"),j(S)):(t.consume(S),S===92?N:C)}function N(S){return S===92||S===124?(t.consume(S),C):C(S)}}function G8(t,e){let n,o,r,s=-1,i=!0,a=0,l=[0,0,0,0],c=[0,0,0,0],d=!1,h=0;const f=new H8;for(;++s<t.length;){const m=t[s],g=m[1];m[0]==="enter"?g.type==="tableHead"?(d=!1,h!==0&&(Yv(f,e,h,n,o),o=void 0,h=0),n={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},f.add(s,0,[["enter",n,e]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(i=!0,r=void 0,l=[0,0,0,0],c=[0,s+1,0,0],d&&(d=!1,o={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},f.add(s,0,[["enter",o,e]])),a=g.type==="tableDelimiterRow"?2:o?3:1):!a||g.type!=="data"&&g.type!=="tableDelimiterMarker"&&g.type!=="tableDelimiterFiller"?g.type==="tableCellDivider"&&(i?i=!1:(l[1]!==0&&(c[0]=c[1],r=Ml(f,e,l,a,void 0,r)),l=c,c=[l[1],s,0,0])):(i=!1,c[2]===0&&(l[1]!==0&&(c[0]=c[1],r=Ml(f,e,l,a,void 0,r),l=[0,0,0,0]),c[2]=s)):g.type==="tableHead"?(d=!0,h=s):g.type==="tableRow"||g.type==="tableDelimiterRow"?(h=s,l[1]!==0?(c[0]=c[1],r=Ml(f,e,l,a,s,r)):c[1]!==0&&(r=Ml(f,e,c,a,s,r)),a=0):!a||g.type!=="data"&&g.type!=="tableDelimiterMarker"&&g.type!=="tableDelimiterFiller"||(c[3]=s)}for(h!==0&&Yv(f,e,h,n,o),f.consume(e.events),s=-1;++s<e.events.length;){const m=e.events[s];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=W8(e.events,s))}return t}function Ml(t,e,n,o,r,s){const i=o===1?"tableHeader":o===2?"tableDelimiter":"tableData";n[0]!==0&&(s.end=Object.assign({},Yr(e.events,n[0])),t.add(n[0],0,[["exit",s,e]]));const a=Yr(e.events,n[1]);if(s={type:i,start:Object.assign({},a),end:Object.assign({},a)},t.add(n[1],0,[["enter",s,e]]),n[2]!==0){const l=Yr(e.events,n[2]),c=Yr(e.events,n[3]),d={type:"tableContent",start:Object.assign({},l),end:Object.assign({},c)};if(t.add(n[2],0,[["enter",d,e]]),o!==2){const h=e.events[n[2]],f=e.events[n[3]];if(h[1].end=Object.assign({},f[1].end),h[1].type="chunkText",h[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,g=n[3]-n[2]-1;t.add(m,g,[])}}t.add(n[3]+1,0,[["exit",d,e]])}return r!==void 0&&(s.end=Object.assign({},Yr(e.events,r)),t.add(r,0,[["exit",s,e]]),s=void 0),s}function Yv(t,e,n,o,r){const s=[],i=Yr(e.events,n);r&&(r.end=Object.assign({},i),s.push(["exit",r,e])),o.end=Object.assign({},i),s.push(["exit",o,e]),t.add(n+1,0,s)}function Yr(t,e){const n=t[e],o=n[0]==="enter"?"start":"end";return n[1][o]}const Y8={name:"tasklistCheck",tokenize:function(t,e,n){const o=this;return function(a){return o.previous!==null||!o._gfmTasklistFirstContentOfListItem?n(a):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(a),t.exit("taskListCheckMarker"),r)};function r(a){return ct(a)?(t.enter("taskListCheckValueUnchecked"),t.consume(a),t.exit("taskListCheckValueUnchecked"),s):a===88||a===120?(t.enter("taskListCheckValueChecked"),t.consume(a),t.exit("taskListCheckValueChecked"),s):n(a)}function s(a){return a===93?(t.enter("taskListCheckMarker"),t.consume(a),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),i):n(a)}function i(a){return Be(a)?e(a):et(a)?t.check({tokenize:K8},e,n)(a):n(a)}}};function K8(t,e,n){return rt(t,function(o){return o===null?n(o):e(o)},"whitespace")}const X8={};function J8(t){const e=t||X8,n=this.data(),o=n.micromarkExtensions||(n.micromarkExtensions=[]),r=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),s=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);o.push(function(i){return Dy([{text:Yn},{document:{91:{name:"gfmFootnoteDefinition",tokenize:B8,continuation:{tokenize:U8},exit:$8}},text:{91:{name:"gfmFootnoteCall",tokenize:z8},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:L8,resolveTo:F8}}},V8(i),{flow:{null:{name:"table",tokenize:q8,resolveAll:G8}}},{text:{91:Y8}}])}(e)),r.push([{transforms:[r8],enter:{literalAutolink:QA,literalAutolinkEmail:Th,literalAutolinkHttp:Th,literalAutolinkWww:Th},exit:{literalAutolink:o8,literalAutolinkEmail:n8,literalAutolinkHttp:e8,literalAutolinkWww:t8}},{enter:{gfmFootnoteCallString:a8,gfmFootnoteCall:l8,gfmFootnoteDefinitionLabelString:c8,gfmFootnoteDefinition:d8},exit:{gfmFootnoteCallString:u8,gfmFootnoteCall:h8,gfmFootnoteDefinitionLabelString:f8,gfmFootnoteDefinition:m8}},{canContainEols:["delete"],enter:{strikethrough:b8},exit:{strikethrough:y8}},{enter:{table:N8,tableData:Fv,tableHeader:Fv,tableRow:_8},exit:{codeText:I8,table:E8,tableData:Dh,tableHeader:Dh,tableRow:Dh}},{exit:{taskListCheckValueChecked:zv,taskListCheckValueUnchecked:zv,paragraph:M8}}]),s.push(function(i){return{extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ih,notInConstruct:Ah},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Ih,notInConstruct:Ah},{character:":",before:"[ps]",after:"\\/",inConstruct:Ih,notInConstruct:Ah}]},p8(i),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:x8}],handlers:{delete:Cv}},T8(i),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:O8}}]}}(e))}const Z8=[We.lineWrapping],Q8=new Set(["python","markdown","sql","json","yaml","toml","shell","javascript","typescript","jsx","tsx","css","html"]),eT=t=>{const e=H.c(26),{code:n,language:o}=t,{theme:r}=vr(),{createNewCell:s}=lt(),i=hs(),a=Ne(ec),[l,c]=M.useState(n);let d,h,f;e[0]!==n?(d=()=>{c(n)},h=[n],e[0]=n,e[1]=d,e[2]=h):(d=e[1],h=e[2]),M.useEffect(d,h),e[3]!==a||e[4]!==s||e[5]!==o||e[6]!==i||e[7]!==l?(f=()=>{const S=function(E,T){return E?E==="python"?{language:E,code:T}:E==="sql"?{language:"python",code:Rc.fromQuery(T)}:E==="markdown"?{language:"python",code:Bi.fromMarkdown(T)}:E==="shell"||E==="bash"?{language:"python",code:`import subprocess
|
|
156
156
|
subprocess.run("${T}")`}:{language:"python",code:`_${E} = """
|
|
157
157
|
${T}
|
|
158
|
-
"""`}:{language:"python",code:T}}(o,l);o==="sql"&&Jn({autoInstantiate:a,createNewCell:s,fromCellId:i}),s({code:S.code,before:!1,cellId:i??"__end__"})},e[3]=a,e[4]=s,e[5]=o,e[6]=i,e[7]=l,e[8]=f):f=e[8];const m=f;let g;e[9]!==l?(g=async()=>{await sn(l)},e[9]=l,e[10]=g):g=e[10];const x=g,p=r==="dark"?"dark":"light",b=o&&Q8.has(o)?o:void 0;let y,v,w,j,C,N;return e[11]!==p||e[12]!==b||e[13]!==l?(y=u.jsx(M.Suspense,{children:u.jsx(ra,{theme:p,language:b,className:"cm border rounded overflow-hidden",extensions:Z8,value:l,onChange:c})}),e[11]=p,e[12]=b,e[13]=l,e[14]=y):y=e[14],e[15]!==x?(v=u.jsx(tT,{size:"xs",variant:"outline",onClick:x,children:"Copy"}),e[15]=x,e[16]=v):v=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(w=u.jsx(Nr,{className:"ml-2 h-4 w-4"}),e[17]=w):w=e[17],e[18]!==m?(j=u.jsxs(ve,{size:"xs",variant:"outline",onClick:m,children:["Add to Notebook",w]}),e[18]=m,e[19]=j):j=e[19],e[20]!==j||e[21]!==v?(C=u.jsxs("div",{className:"flex justify-end mt-2 space-x-2",children:[v,j]}),e[20]=j,e[21]=v,e[22]=C):C=e[22],e[23]!==C||e[24]!==y?(N=u.jsxs("div",{className:"relative",children:[y,C]}),e[23]=C,e[24]=y,e[25]=N):N=e[25],N},tT=t=>{const e=H.c(12);let n,o;e[0]!==t?({onClick:n,...o}=t,e[0]=t,e[1]=n,e[2]=o):(n=e[1],o=e[2]);const[r,s]=M.useState(!1);let i,a,l;e[3]!==r?(i=()=>{r&&setTimeout(()=>s(!1),1e3)},a=[r],e[3]=r,e[4]=i,e[5]=a):(i=e[4],a=e[5]),M.useEffect(i,a),e[6]!==n?(l=h=>{n==null||n(h),s(!0)},e[6]=n,e[7]=l):l=e[7];const c=r?"Copied":"Copy";let d;return e[8]!==o||e[9]!==l||e[10]!==c?(d=u.jsx(ve,{...o,onClick:l,children:c}),e[8]=o,e[9]=l,e[10]=c,e[11]=d):d=e[11],d},nT={code:({children:t,className:e})=>{const n=e==null?void 0:e.replace("language-","");return n&&typeof t=="string"?u.jsxs("div",{children:[u.jsx("div",{className:"text-xs text-muted-foreground pl-1",children:n}),u.jsx(eT,{code:t.trim(),language:n})]}):u.jsx("code",{className:e,children:t})}},Kv=M.memo(t=>{const e=H.c(3),{content:n}=t;let o,r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[J8],e[0]=o):o=e[0],e[1]!==n?(r=u.jsx(YA,{components:nT,remarkPlugins:o,className:"prose dark:prose-invert max-w-none prose-pre:pl-0",children:n}),e[1]=n,e[2]=r):r=e[2],r},(t,e)=>t.content===e.content);Kv.displayName="MemoizedMarkdownBlock";const Lh=M.memo(({content:t})=>{const e=M.useMemo(()=>{return n=t,tL.lexer(n).map(o=>o.raw);var n},[t]);return u.jsx(u.Fragment,{children:e.map((n,o)=>u.jsx(Kv,{content:n},`markdown-block-${o}`))})});Lh.displayName="MarkdownRenderer";const oT=t=>{const e=H.c(13),{reasoning:n,index:o,isStreaming:r}=t,s=o===void 0?0:o,i=r!==void 0&&r,a=i?"reasoning":void 0;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(Xl,{className:"h-3 w-3"}),e[0]=l):l=e[0];const c=i?"Thinking":"View reasoning";let d,h,f,m;return e[1]!==n.length||e[2]!==c?(d=u.jsx(BC,{className:"text-xs text-muted-foreground hover:bg-muted/50 px-2 py-1 h-auto rounded-sm [&[data-state=open]>svg]:rotate-180",children:u.jsxs("span",{className:"flex items-center gap-2",children:[l,c," (",n.length," ","chars)"]})}),e[1]=n.length,e[2]=c,e[3]=d):d=e[3],e[4]!==n?(h=u.jsx(UC,{className:"pb-2 px-2",children:u.jsx("div",{className:"bg-muted/30 border border-muted/50 rounded-md p-3 italic text-muted-foreground/90 relative",children:u.jsx("div",{className:"pr-6",children:u.jsx(Lh,{content:n})})})}),e[4]=n,e[5]=h):h=e[5],e[6]!==d||e[7]!==h?(f=u.jsxs($C,{value:"reasoning",className:"border-0",children:[d,h]}),e[6]=d,e[7]=h,e[8]=f):f=e[8],e[9]!==s||e[10]!==a||e[11]!==f?(m=u.jsx(VC,{type:"single",collapsible:!0,className:"w-full mb-2",value:a,children:f},s),e[9]=s,e[10]=a,e[11]=f,e[12]=m):m=e[12],m},rT=t=>{const e=H.c(32),{toolName:n,result:o,error:r,index:s,state:i}=t,a=s===void 0?0:s,l=i==="result"&&(o||r),c=r?"error":l?"success":"loading";let d;e[0]!==c?(d=()=>{switch(c){case"loading":return u.jsx(Fc,{className:"h-3 w-3 animate-spin"});case"error":return u.jsx(Di,{className:"h-3 w-3 text-destructive"});case"success":return u.jsx(jF,{className:"h-3 w-3 text-green-600"});default:return u.jsx(nL,{className:"h-3 w-3"})}},e[0]=c,e[1]=d):d=e[1];const h=d;let f;e[2]!==r||e[3]!==l||e[4]!==c?(f=()=>c==="loading"?"Running: ":r?"Failed: ":l?"Done: ":"Tool call",e[2]=r,e[3]=l,e[4]=c,e[5]=f):f=e[5];const m=f,g=`tool-${a}`,x=c==="error"&&"text-destructive/80",p=c==="success"&&"text-green-600/80";let b,y;e[6]!==x||e[7]!==p?(b=xe("h-6 text-xs border-border shadow-none! ring-0! bg-muted hover:bg-muted/30 py-0 px-2 gap-1 rounded-sm [&[data-state=open]>svg]:rotate-180",x,p),e[6]=x,e[7]=p,e[8]=b):b=e[8],e[9]!==h?(y=h(),e[9]=h,e[10]=y):y=e[10];const v=m();let w,j,C,N,S,E,T;return e[11]!==n?(w=u.jsx("code",{className:"font-mono text-xs",children:n}),e[11]=n,e[12]=w):w=e[12],e[13]!==w||e[14]!==y||e[15]!==v?(j=u.jsxs("span",{className:"flex items-center gap-1",children:[y,v,":"," ",w]}),e[13]=w,e[14]=y,e[15]=v,e[16]=j):j=e[16],e[17]!==j||e[18]!==b?(C=u.jsx(BC,{className:b,children:j}),e[17]=j,e[18]=b,e[19]=C):C=e[19],e[20]!==r||e[21]!==l||e[22]!==o?(N=l&&u.jsxs("div",{className:"space-y-3",children:[o&&u.jsxs("div",{children:[u.jsx("div",{className:"text-xs font-medium text-muted-foreground mt-2 mb-1",children:"Result:"}),u.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:typeof o=="string"?o:JSON.stringify(o,null,2)})]}),r&&u.jsxs("div",{children:[u.jsx("div",{className:"text-xs font-medium text-destructive mb-1",children:"Error:"}),u.jsx("div",{className:"bg-destructive/10 border border-destructive/20 rounded-md p-3 text-sm text-destructive",children:r})]})]}),e[20]=r,e[21]=l,e[22]=o,e[23]=N):N=e[23],e[24]!==N?(S=u.jsx(UC,{className:"pb-2 px-2",children:N}),e[24]=N,e[25]=S):S=e[25],e[26]!==C||e[27]!==S?(E=u.jsxs($C,{value:"tool-call",className:"border-0",children:[C,S]}),e[26]=C,e[27]=S,e[28]=E):E=e[28],e[29]!==E||e[30]!==g?(T=u.jsx(VC,{type:"single",collapsible:!0,className:"w-full my-4",children:E},g),e[29]=E,e[30]=g,e[31]=T):T=e[31],T},sT=t=>{const e=H.c(27),{onNewChat:n,activeChatId:o,setActiveChat:r,chats:s}=t,{handleClick:i}=ia();let a,l,c,d,h,f,m,g,x,p,b;if(e[0]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(Jo,{className:"h-4 w-4"}),e[0]=a):a=e[0],e[1]!==n?(l=u.jsx(Ee,{content:"New chat",children:u.jsx(ve,{variant:"text",size:"icon",onClick:n,children:a})}),e[1]=n,e[2]=l):l=e[2],e[3]!==i?(c=()=>i("ai"),e[3]=i,e[4]=c):c=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(_m,{className:"h-4 w-4"}),e[5]=d):d=e[5],e[6]!==c?(h=u.jsx(Ee,{content:"AI Settings",children:u.jsx(ve,{variant:"text",size:"xs",className:"hover:bg-foreground/10 py-2",onClick:c,children:d})}),e[6]=c,e[7]=h):h=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(Ee,{content:"Previous chats",children:u.jsx(ws,{asChild:!0,children:u.jsx(ve,{variant:"text",size:"icon",children:u.jsx(lL,{className:"h-4 w-4"})})})}),e[8]=f):f=e[8],e[9]!==s.length?(m=s.length===0&&u.jsx(dn,{title:"No chats yet",description:"Start a new chat to get started",icon:u.jsx(Xl,{})}),e[9]=s.length,e[10]=m):m=e[10],e[11]!==o||e[12]!==s||e[13]!==r){let y;e[15]!==o||e[16]!==r?(y=v=>u.jsxs("button",{className:xe("w-full p-3 rounded-md cursor-pointer hover:bg-accent text-left",v.id===o&&"bg-accent"),onClick:()=>{r(v.id)},type:"button",children:[u.jsx("div",{className:"font-medium",children:v.title}),u.jsx("div",{className:"text-sm text-muted-foreground",children:cL(v.updatedAt)})]},v.id),e[15]=o,e[16]=r,e[17]=y):y=e[17],g=s.map(y),e[11]=o,e[12]=s,e[13]=r,e[14]=g}else g=e[14];return e[18]!==m||e[19]!==g?(x=u.jsxs(br,{children:[f,u.jsx(ps,{className:"w-[520px] p-0",align:"start",side:"right",children:u.jsx(iy,{className:"h-[500px] p-4",children:u.jsxs("div",{className:"space-y-4",children:[m,g]})})})]}),e[18]=m,e[19]=g,e[20]=x):x=e[20],e[21]!==h||e[22]!==x?(p=u.jsxs("div",{className:"flex items-center gap-2",children:[h,x]}),e[21]=h,e[22]=x,e[23]=p):p=e[23],e[24]!==p||e[25]!==l?(b=u.jsxs("div",{className:"flex border-b px-2 py-1 justify-between shrink-0 items-center",children:[l,p]}),e[24]=p,e[25]=l,e[26]=b):b=e[26],b},Xv=M.memo(t=>{var h;const e=H.c(14),{message:n,index:o,onEdit:r,isStreamingReasoning:s,totalMessages:i}=t,a=n.role==="user"?"justify-end":"justify-start";let l,c,d;return e[0]!==a?(l=xe("flex group relative",a),e[0]=a,e[1]=l):l=e[1],e[2]!==o||e[3]!==s||e[4]!==n.content||e[5]!==n.id||e[6]!==n.parts||e[7]!==n.role||e[8]!==r||e[9]!==i?(c=n.role==="user"?u.jsx("div",{className:"w-[95%] bg-background border p-1 rounded-sm",children:u.jsx(Lc,{value:n.content,placeholder:"Type your message...",onChange:lT,onSubmit:(f,m)=>{m.trim()&&r(o,m)},onClose:cT},n.id)}):u.jsxs("div",{className:"w-[95%] break-words",children:[u.jsx("div",{className:"absolute right-1 top-1 opacity-0 group-hover:opacity-100 transition-opacity",children:u.jsx(HC,{className:"h-3 w-3",value:n.content})}),(h=n.parts)==null?void 0:h.map((f,m)=>{var g;switch(f.type){case"text":return u.jsx(Lh,{content:f.text},m);case"reasoning":return u.jsx(oT,{reasoning:f.reasoning,index:m,isStreaming:o===i-1&&s&&m===(((g=n.parts)==null?void 0:g.length)||0)-1},m);case"tool-invocation":return u.jsx(rT,{index:m,toolName:f.toolInvocation.toolName,result:f.toolInvocation.state==="result"?f.toolInvocation.result:null,state:f.toolInvocation.state},m);default:return null}})]}),e[2]=o,e[3]=s,e[4]=n.content,e[5]=n.id,e[6]=n.parts,e[7]=n.role,e[8]=r,e[9]=i,e[10]=c):c=e[10],e[11]!==l||e[12]!==c?(d=u.jsx("div",{className:l,children:c}),e[11]=l,e[12]=c,e[13]=d):d=e[13],d});Xv.displayName="ChatMessage";const Fh=M.memo(t=>{var S;const e=H.c(25),{input:n,onSendClick:o,isLoading:r,onStop:s}=t,i=Ne(PC),a=(i==null?void 0:i.mode)||"manual",l=((S=i==null?void 0:i.models)==null?void 0:S.chat_model)||LC,{saveModeChange:c,saveModelChange:d}=oL();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=[{value:"ask",label:"Ask",subtitle:"Use AI with access to read-only tools like documentation search"},{value:"manual",label:"Manual",subtitle:"Pure chat, no tool usage"}],e[0]=h):h=e[0];const f=h;let m,g,x,p,b,y;e[1]!==a?(m=u.jsx(cc,{className:"h-6 text-xs border-border shadow-none! ring-0! bg-muted hover:bg-muted/30 py-0 px-2 gap-1 capitalize",children:a}),e[1]=a,e[2]=m):m=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx(dc,{children:u.jsxs(Cm,{children:[u.jsx(F3,{children:"AI Mode"}),f.map(dT)]})}),e[3]=g):g=e[3],e[4]!==a||e[5]!==c||e[6]!==m?(x=u.jsx(rL,{feature:"mcp_docs",children:u.jsxs(lc,{value:a,onValueChange:c,children:[m,g]})}),e[4]=a,e[5]=c,e[6]=m,e[7]=x):x=e[7],e[8]!==d?(p=E=>d(E,"chat"),e[8]=d,e[9]=p):p=e[9],e[10]!==l||e[11]!==p?(b=u.jsx(sL,{value:l,placeholder:"Model",onSelect:p,triggerClassName:"h-6 text-xs shadow-none! ring-0! bg-muted hover:bg-muted/30 rounded-sm",iconSize:"small",showAddCustomModelDocs:!0,forRole:"chat"}),e[10]=l,e[11]=p,e[12]=b):b=e[12],e[13]!==x||e[14]!==b?(y=u.jsxs("div",{className:"flex items-center gap-2",children:[x,b]}),e[13]=x,e[14]=b,e[15]=y):y=e[15];const v=r?s:o,w=!r&&!n.trim();let j,C,N;return e[16]!==r?(j=r?u.jsx(fc,{className:"h-3 w-3 fill-current"}):u.jsx(iL,{className:"h-3 w-3"}),e[16]=r,e[17]=j):j=e[17],e[18]!==j||e[19]!==v||e[20]!==w?(C=u.jsx(ve,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-muted/30",onClick:v,disabled:w,children:j}),e[18]=j,e[19]=v,e[20]=w,e[21]=C):C=e[21],e[22]!==C||e[23]!==y?(N=u.jsxs("div",{className:"px-3 py-2 border-t border-border/20 flex items-center justify-between",children:[y,C]}),e[22]=C,e[23]=y,e[24]=N):N=e[24],N});Fh.displayName="ChatInputFooter";const Jv=M.memo(t=>{var g,x;const e=H.c(18),{input:n,setInput:o,onSubmit:r,inputRef:s,isLoading:i,onStop:a}=t;let l;e[0]!==n||e[1]!==r?(l=()=>{n.trim()&&r(void 0,n)},e[0]=n,e[1]=r,e[2]=l):l=e[2];const c=l;let d,h,f,m;return e[3]!==((g=s.current)==null?void 0:g.editor)?(d=()=>{var p,b;return(b=(p=s.current)==null?void 0:p.editor)==null?void 0:b.blur()},e[3]=(x=s.current)==null?void 0:x.editor,e[4]=d):d=e[4],e[5]!==n||e[6]!==r||e[7]!==o||e[8]!==d?(h=u.jsx("div",{className:"px-2 py-3 flex-1",children:u.jsx(Lc,{value:n,onChange:o,onSubmit:r,onClose:d,placeholder:"Type your message..."})}),e[5]=n,e[6]=r,e[7]=o,e[8]=d,e[9]=h):h=e[9],e[10]!==c||e[11]!==n||e[12]!==i||e[13]!==a?(f=u.jsx(Fh,{input:n,onSendClick:c,isLoading:i,onStop:a}),e[10]=c,e[11]=n,e[12]=i,e[13]=a,e[14]=f):f=e[14],e[15]!==h||e[16]!==f?(m=u.jsxs("div",{className:"border-t relative shrink-0 min-h-[80px] flex flex-col",children:[h,f]}),e[15]=h,e[16]=f,e[17]=m):m=e[17],m});Jv.displayName="ChatInput";const iT=()=>{const t=H.c(6),e=Ne(Ql),{handleClick:n}=ia();if(!e){let r,s,i;return t[0]!==n?(r=u.jsx(ve,{variant:"outline",size:"sm",onClick:()=>n("ai"),children:"Edit AI settings"}),t[0]=n,t[1]=r):r=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx(Xl,{}),t[2]=s):s=t[2],t[3]!==r?(i=u.jsx(dn,{title:"Chat with AI",description:"AI is currently disabled. Add your API key to enable.",action:r,icon:s}),t[3]=r,t[4]=i):i=t[4],i}let o;return t[5]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(aT,{}),t[5]=o):o=t[5],o},aT=()=>{const[t,e]=zt(fd),[n,o]=zt(Wj),[r,s]=M.useState(""),i=M.useRef(null),a=M.useRef(null),l=M.useRef(null),c=M.useRef(null),d=Km(),{invokeAiTool:h}=nt(),{messages:f,input:m,setInput:g,setMessages:x,append:p,handleSubmit:b,error:y,status:v,reload:w,stop:j}=aL({id:n==null?void 0:n.id,maxSteps:10,initialMessages:(n==null?void 0:n.messages)||[],keepLastMessageOnError:!0,api:d.getAiURL("chat").toString(),headers:d.headers(),experimental_prepareRequestBody:T=>({...T,...bC({input:T.messages.map(I=>I.content).join(`
|
|
159
|
-
`)}),includeOtherCode:Tc("")}),onFinish:T=>{e(I=>Ku(I,I.activeChatId,T.id,"assistant",T.content,T.parts))},onToolCall:async({toolCall:T})=>{try{const I=await h({toolName:T.toolName,arguments:T.args});return I.result||I.error}catch(I){return ut.error("Tool call failed:",I),`Error: ${I instanceof Error?I.message:String(I)}`}},onError:T=>{ut.error("An error occurred:",T)},onResponse:T=>{ut.debug("Received HTTP response from server:",T)}}),C=v==="submitted"||v==="streaming";M.useEffect(()=>{if(!t.activeChatId||f.length===0)return;const T=f[f.length-1];if((T==null?void 0:T.role)!=="user")return;const I=t.chats.find(O=>O.id===t.activeChatId);if(!I)return;const D=new Set(I.messages.map(O=>O.id)),F=f.filter(O=>O.role==="user"&&!D.has(O.id));F.length>0&&e(O=>{let R=O;for(const P of F)R=Ku(R,O.activeChatId,P.id,"user",P.content);return R})},[f,t.activeChatId,t.chats,e]);const N=C&&f.length>0&&(T=>{if(T.length===0)return!1;const I=T.at(-1);if(!I||I.role!=="assistant"||!I.parts)return!1;const D=I.parts;return D.length===0?!1:D[D.length-1].type==="reasoning"})(f);M.useEffect(()=>{requestAnimationFrame(()=>{if(l.current){const T=l.current;T.scrollTop=T.scrollHeight}})},[t.activeChatId]);const S=(T,I)=>{x(D=>D.slice(0,T)),t.activeChatId&&e(D=>({...D,chats:D.chats.map(F=>F.id===t.activeChatId?{...F,messages:F.messages.slice(0,T),updatedAt:Date.now()}:F)})),p({role:"user",content:I})},E=()=>{r.trim()&&(T=>{const I=Date.now(),D={id:WC(),title:T.length>50?`${T.slice(0,50)}...`:T,messages:[],createdAt:I,updatedAt:I};e(O=>({...O,chats:[...O.chats,D],activeChatId:D.id}));const F=WC();p({id:F,role:"user",content:T}),g("")})(r.trim())};return u.jsxs("div",{className:"flex flex-col h-[calc(100%-53px)]",children:[u.jsx(Xm,{children:u.jsx(sT,{onNewChat:()=>{o(null),g(""),s("")},activeChatId:n==null?void 0:n.id,setActiveChat:o,chats:[...t.chats].sort((T,I)=>I.updatedAt-T.updatedAt)})}),u.jsxs("div",{className:"flex-1 px-3 bg-(--slate-1) gap-4 py-3 flex flex-col overflow-y-auto",ref:l,children:[(!f||f.length===0)&&u.jsxs("div",{className:"flex flex-col rounded-md border bg-background",children:[u.jsx("div",{className:"px-1",children:u.jsx(Lc,{value:r,placeholder:"Ask anything, @ to include context about tables or dataframes",onClose:()=>{var T,I;return(I=(T=i.current)==null?void 0:T.editor)==null?void 0:I.blur()},onChange:s,onSubmit:E},"new-thread-input")}),u.jsx(Fh,{input:r,onSendClick:E,isLoading:C,onStop:j})]}),f.map((T,I)=>u.jsx(Xv,{message:T,index:I,onEdit:S,setChatState:e,chatState:t,isStreamingReasoning:N,totalMessages:f.length},I)),C&&u.jsx("div",{className:"flex justify-center py-4",children:u.jsx(Fc,{className:"h-4 w-4 animate-spin"})}),y&&u.jsxs("div",{className:"flex items-center justify-center space-x-2 mb-4",children:[u.jsx(kr,{error:y}),u.jsx(ve,{variant:"outline",size:"sm",onClick:()=>{w()},children:"Retry"})]}),u.jsx("div",{ref:c})]}),C&&u.jsx("div",{className:"w-full flex justify-center items-center z-20 border-t",children:u.jsx(ve,{variant:"linkDestructive",size:"sm",onClick:j,children:"Stop"})}),f&&f.length>0&&u.jsx(Jv,{input:m,setInput:g,onSubmit:(T,I)=>{I.trim()&&b(T)},inputRef:a,isLoading:C,onStop:j})]})};function lT(){}function cT(){}function dT(t){return u.jsx(uc,{value:t.value,className:"text-xs",children:u.jsxs("div",{className:"flex flex-col",children:[t.label,u.jsx("div",{className:"text-muted-foreground text-xs pt-1 block",children:t.subtitle})]})},t.value)}function Qt(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n,o=0;o<t.length;o++)(n=Qt(t[o]))!==""&&(e+=(e&&" ")+n);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}const{useDebugValue:uT}=q,{useSyncExternalStoreWithSelector:hT}=dL,fT=t=>t;function Zv(t,e=fT,n){const o=hT(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return uT(o),o}const Qv=(t,e)=>{const n=uL(t),o=(r,s=e)=>Zv(n,r,s);return Object.assign(o,n),o};function Wt(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[o,r]of t)if(!Object.is(r,e.get(o)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||!Object.is(t[o],e[o]))return!1;return!0}function Kn(t,e){if(t=function(s){let i;for(;i=s.sourceEvent;)s=i;return s}(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,[(o=o.matrixTransform(e.getScreenCTM().inverse())).x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}const mT={passive:!1},yi={capture:!0,passive:!1};function zh(t){t.stopImmediatePropagation()}function Kr(t){t.preventDefault(),t.stopImmediatePropagation()}function e2(t){var e=t.document.documentElement,n=Vn(t).on("dragstart.drag",Kr,yi);"onselectstart"in e?n.on("selectstart.drag",Kr,yi):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function t2(t,e){var n=t.document.documentElement,o=Vn(t).on("dragstart.drag",null);e&&(o.on("click.drag",Kr,yi),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Ol=t=>()=>t;function Bh(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}function pT(t){return!t.ctrlKey&&!t.button}function gT(){return this.parentNode}function xT(t,e){return e??{x:t.x,y:t.y}}function bT(){return navigator.maxTouchPoints||"ontouchstart"in this}Bh.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};const Dl=t=>()=>t;function yT(t,{sourceEvent:e,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Uh(t){t.stopImmediatePropagation()}function vi(t){t.preventDefault(),t.stopImmediatePropagation()}function vT(t){return!(t.ctrlKey&&t.type!=="wheel"||t.button)}function wT(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function n2(){return this.__zoom||Qo}function kT(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function CT(){return navigator.maxTouchPoints||"ontouchstart"in this}function jT(t,e,n){var o=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],s=t.invertY(e[0][1])-n[0][1],i=t.invertY(e[1][1])-n[1][1];return t.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}const Rl=M.createContext(null),ST=Rl.Provider,NT=t=>`Node type "${t}" not found. Using fallback type "default".`,ET=()=>"The React Flow parent container needs a width and a height to render the graph.",_T=()=>"Only child nodes can use a parent extent.",IT=t=>`Marker type "${t}" doesn't exist.`,AT=(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,TT=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",MT=t=>`Edge type "${t}" not found. Using fallback type "default".`,OT=t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,o2="[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001";function dt(t,e){const n=M.useContext(Rl);if(n===null)throw new Error(o2);return Zv(n,t,e)}const Ft=()=>{const t=M.useContext(Rl);if(t===null)throw new Error(o2);return M.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},DT=t=>t.userSelectionActive?"none":"all";function Pl({position:t,children:e,className:n,style:o,...r}){const s=dt(DT),i=`${t}`.split("-");return q.createElement("div",{className:Qt(["react-flow__panel",n,...i]),style:{...o,pointerEvents:s},...r},e)}function RT({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:q.createElement(Pl,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},q.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var PT=M.memo(({x:t,y:e,label:n,labelStyle:o={},labelShowBg:r=!0,labelBgStyle:s={},labelBgPadding:i=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...d})=>{const h=M.useRef(null),[f,m]=M.useState({x:0,y:0,width:0,height:0}),g=Qt(["react-flow__edge-textwrapper",c]);return M.useEffect(()=>{if(h.current){const x=h.current.getBBox();m({x:x.x,y:x.y,width:x.width,height:x.height})}},[n]),n!==void 0&&n?q.createElement("g",{transform:`translate(${t-f.width/2} ${e-f.height/2})`,className:g,visibility:f.width?"visible":"hidden",...d},r&&q.createElement("rect",{width:f.width+2*i[0],x:-i[0],y:-i[1],height:f.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:a,ry:a}),q.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:h,style:o},n),l):null});const $h=t=>({width:t.offsetWidth,height:t.offsetHeight}),Xr=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Vh=(t={x:0,y:0},e)=>({x:Xr(t.x,e[0][0],e[1][0]),y:Xr(t.y,e[0][1],e[1][1])}),r2=(t,e,n)=>t<e?Xr(Math.abs(t-e),1,50)/50:t>n?-Xr(Math.abs(t-n),1,50)/50:0,s2=(t,e)=>[20*r2(t.x,35,e.width-35),20*r2(t.y,35,e.height-35)],i2=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},Hh=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),a2=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),Wh=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),o=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*o)},Nn=t=>!isNaN(t)&&isFinite(t),yt=Symbol.for("internals"),l2=["Enter"," ","Escape"];function qh(t){var o,r;const e=(s=>"nativeEvent"in s)(t)?t.nativeEvent:t,n=((r=(o=e.composedPath)==null?void 0:o.call(e))==null?void 0:r[0])||t.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const c2=t=>"clientX"in t,zo=(t,e)=>{var s,i;const n=c2(t),o=n?t.clientX:(s=t.touches)==null?void 0:s[0].clientX,r=n?t.clientY:(i=t.touches)==null?void 0:i[0].clientY;return{x:o-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},Ll=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0},wi=({id:t,path:e,labelX:n,labelY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:f,interactionWidth:m=20})=>q.createElement(q.Fragment,null,q.createElement("path",{id:t,style:d,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:h,markerStart:f}),m&&q.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:m,className:"react-flow__edge-interaction"}),r&&Nn(n)&&Nn(o)?q.createElement(PT,{x:n,y:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null);function ki(t,e,n){return n===void 0?n:o=>{const r=e().edges.find(s=>s.id===t);r&&n(o,{...r})}}function d2({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,s=n<t?n+r:n-r,i=Math.abs(o-e)/2;return[s,o<e?o+i:o-i,r,i]}function u2({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const l=.125*t+.375*r+.375*i+.125*n,c=.125*e+.375*s+.375*a+.125*o;return[l,c,Math.abs(l-t),Math.abs(c-e)]}var hr,h2,Bo,Gh,Ci,f2,Uo,ji,Jr,m2,Oe,Fl;function p2({pos:t,x1:e,y1:n,x2:o,y2:r}){return t===Oe.Left||t===Oe.Right?[.5*(e+o),n]:[e,.5*(n+r)]}function g2({sourceX:t,sourceY:e,sourcePosition:n=Oe.Bottom,targetX:o,targetY:r,targetPosition:s=Oe.Top}){const[i,a]=p2({pos:n,x1:t,y1:e,x2:o,y2:r}),[l,c]=p2({pos:s,x1:o,y1:r,x2:t,y2:e}),[d,h,f,m]=u2({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${t},${e} C${i},${a} ${l},${c} ${o},${r}`,d,h,f,m]}wi.displayName="BaseEdge",(h2=hr||(hr={})).Strict="strict",h2.Loose="loose",(Gh=Bo||(Bo={})).Free="free",Gh.Vertical="vertical",Gh.Horizontal="horizontal",(f2=Ci||(Ci={})).Partial="partial",f2.Full="full",(ji=Uo||(Uo={})).Bezier="default",ji.Straight="straight",ji.Step="step",ji.SmoothStep="smoothstep",ji.SimpleBezier="simplebezier",(m2=Jr||(Jr={})).Arrow="arrow",m2.ArrowClosed="arrowclosed",(Fl=Oe||(Oe={})).Left="left",Fl.Top="top",Fl.Right="right",Fl.Bottom="bottom";const Yh=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Oe.Bottom,targetPosition:s=Oe.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x})=>{const[p,b,y]=g2({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s});return q.createElement(wi,{path:p,labelX:b,labelY:y,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x})});Yh.displayName="SimpleBezierEdge";const x2={[Oe.Left]:{x:-1,y:0},[Oe.Right]:{x:1,y:0},[Oe.Top]:{x:0,y:-1},[Oe.Bottom]:{x:0,y:1}},b2=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function LT({source:t,sourcePosition:e=Oe.Bottom,target:n,targetPosition:o=Oe.Top,center:r,offset:s}){const i=x2[e],a=x2[o],l={x:t.x+i.x*s,y:t.y+i.y*s},c={x:n.x+a.x*s,y:n.y+a.y*s},d=(({source:C,sourcePosition:N=Oe.Bottom,target:S})=>N===Oe.Left||N===Oe.Right?C.x<S.x?{x:1,y:0}:{x:-1,y:0}:C.y<S.y?{x:0,y:1}:{x:0,y:-1})({source:l,sourcePosition:e,target:c}),h=d.x!==0?"x":"y",f=d[h];let m,g,x=[];const p={x:0,y:0},b={x:0,y:0},[y,v,w,j]=d2({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(i[h]*a[h]===-1){m=r.x??y,g=r.y??v;const C=[{x:m,y:l.y},{x:m,y:c.y}],N=[{x:l.x,y:g},{x:c.x,y:g}];x=i[h]===f?h==="x"?C:N:h==="x"?N:C}else{const C=[{x:l.x,y:c.y}],N=[{x:c.x,y:l.y}];if(x=h==="x"?i.x===f?N:C:i.y===f?C:N,e===o){const T=Math.abs(t[h]-n[h]);if(T<=s){const I=Math.min(s-1,s-T);i[h]===f?p[h]=(l[h]>t[h]?-1:1)*I:b[h]=(c[h]>n[h]?-1:1)*I}}if(e!==o){const T=h==="x"?"y":"x",I=i[h]===a[T],D=l[T]>c[T],F=l[T]<c[T];(i[h]===1&&(!I&&D||I&&F)||i[h]!==1&&(!I&&F||I&&D))&&(x=h==="x"?C:N)}const S={x:l.x+p.x,y:l.y+p.y},E={x:c.x+b.x,y:c.y+b.y};Math.max(Math.abs(S.x-x[0].x),Math.abs(E.x-x[0].x))>=Math.max(Math.abs(S.y-x[0].y),Math.abs(E.y-x[0].y))?(m=(S.x+E.x)/2,g=x[0].y):(m=x[0].x,g=(S.y+E.y)/2)}return[[t,{x:l.x+p.x,y:l.y+p.y},...x,{x:c.x+b.x,y:c.y+b.y},n],m,g,w,j]}function Kh({sourceX:t,sourceY:e,sourcePosition:n=Oe.Bottom,targetX:o,targetY:r,targetPosition:s=Oe.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20}){const[d,h,f,m,g]=LT({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:c});return[d.reduce((x,p,b)=>{let y="";return y=b>0&&b<d.length-1?function(v,w,j,C){const N=Math.min(b2(v,w)/2,b2(w,j)/2,C),{x:S,y:E}=w;if(v.x===S&&S===j.x||v.y===E&&E===j.y)return`L${S} ${E}`;if(v.y===E)return`L ${S+N*(v.x<j.x?-1:1)},${E}Q ${S},${E} ${S},${E+N*(v.y<j.y?1:-1)}`;const T=v.x<j.x?1:-1;return`L ${S},${E+N*(v.y<j.y?-1:1)}Q ${S},${E} ${S+N*T},${E}`}(d[b-1],p,d[b+1],i):`${b===0?"M":"L"}${p.x} ${p.y}`,x+=y},""),h,f,m,g]}const zl=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,sourcePosition:h=Oe.Bottom,targetPosition:f=Oe.Top,markerEnd:m,markerStart:g,pathOptions:x,interactionWidth:p})=>{const[b,y,v]=Kh({sourceX:t,sourceY:e,sourcePosition:h,targetX:n,targetY:o,targetPosition:f,borderRadius:x==null?void 0:x.borderRadius,offset:x==null?void 0:x.offset});return q.createElement(wi,{path:b,labelX:y,labelY:v,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:m,markerStart:g,interactionWidth:p})});zl.displayName="SmoothStepEdge";const Xh=M.memo(t=>{var e;return q.createElement(zl,{...t,pathOptions:M.useMemo(()=>{var n;return{borderRadius:0,offset:(n=t.pathOptions)==null?void 0:n.offset}},[(e=t.pathOptions)==null?void 0:e.offset])})});Xh.displayName="StepEdge";const Jh=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:f,interactionWidth:m})=>{const[g,x,p]=function({sourceX:b,sourceY:y,targetX:v,targetY:w}){const[j,C,N,S]=d2({sourceX:b,sourceY:y,targetX:v,targetY:w});return[`M ${b},${y}L ${v},${w}`,j,C,N,S]}({sourceX:t,sourceY:e,targetX:n,targetY:o});return q.createElement(wi,{path:g,labelX:x,labelY:p,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:f,interactionWidth:m})});function Bl(t,e){return t>=0?.5*t:25*e*Math.sqrt(-t)}function y2({pos:t,x1:e,y1:n,x2:o,y2:r,c:s}){switch(t){case Oe.Left:return[e-Bl(e-o,s),n];case Oe.Right:return[e+Bl(o-e,s),n];case Oe.Top:return[e,n-Bl(n-r,s)];case Oe.Bottom:return[e,n+Bl(r-n,s)]}}function v2({sourceX:t,sourceY:e,sourcePosition:n=Oe.Bottom,targetX:o,targetY:r,targetPosition:s=Oe.Top,curvature:i=.25}){const[a,l]=y2({pos:n,x1:t,y1:e,x2:o,y2:r,c:i}),[c,d]=y2({pos:s,x1:o,y1:r,x2:t,y2:e,c:i}),[h,f,m,g]=u2({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${t},${e} C${a},${l} ${c},${d} ${o},${r}`,h,f,m,g]}Jh.displayName="StraightEdge";const Ul=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Oe.Bottom,targetPosition:s=Oe.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,pathOptions:x,interactionWidth:p})=>{const[b,y,v]=v2({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s,curvature:x==null?void 0:x.curvature});return q.createElement(wi,{path:b,labelX:y,labelY:v,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:p})});Ul.displayName="BezierEdge";const Zh=M.createContext(null),FT=Zh.Provider;Zh.Consumer;const zT=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`reactflow__edge-${t}${e||""}-${n}${o||""}`,Qh=(t,e)=>t===void 0?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`,ef=({x:t,y:e},[n,o,r],s,[i,a])=>{const l={x:(t-n)/r,y:(e-o)/r};return s?{x:i*Math.round(l.x/i),y:a*Math.round(l.y/a)}:l},w2=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o}),Zr=(t,e=[0,0])=>{if(!t)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(t.width??0)*e[0],o=(t.height??0)*e[1],r={x:t.position.x-n,y:t.position.y-o};return{...r,positionAbsolute:t.positionAbsolute?{x:t.positionAbsolute.x-n,y:t.positionAbsolute.y-o}:r}},tf=(t,e=[0,0])=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((o,r)=>{const{x:s,y:i}=Zr(r,e).positionAbsolute;return a=o,l=Hh({x:s,y:i,width:r.width||0,height:r.height||0}),{x:Math.min(a.x,l.x),y:Math.min(a.y,l.y),x2:Math.max(a.x2,l.x2),y2:Math.max(a.y2,l.y2)};var a,l},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return(({x:o,y:r,x2:s,y2:i})=>({x:o,y:r,width:s-o,height:i-r}))(n)},k2=(t,e,[n,o,r]=[0,0,1],s=!1,i=!1,a=[0,0])=>{const l={x:(e.x-n)/r,y:(e.y-o)/r,width:e.width/r,height:e.height/r},c=[];return t.forEach(d=>{const{width:h,height:f,selectable:m=!0,hidden:g=!1}=d;if(i&&!m||g)return!1;const{positionAbsolute:x}=Zr(d,a),p={x:x.x,y:x.y,width:h||0,height:f||0},b=Wh(l,p);(h===void 0||f===void 0||h===null||f===null||s&&b>0||b>=(h||0)*(f||0)||d.dragging)&&c.push(d)}),c},C2=(t,e)=>{const n=t.map(o=>o.id);return e.filter(o=>n.includes(o.source)||n.includes(o.target))},j2=(t,e,n,o,r,s=.1)=>{const i=e/(t.width*(1+s)),a=n/(t.height*(1+s)),l=Math.min(i,a),c=Xr(l,o,r);return{x:e/2-(t.x+t.width/2)*c,y:n/2-(t.y+t.height/2)*c,zoom:c}},fr=(t,e=0)=>t.transition().duration(e);function S2(t,e,n,o){return(e[n]||[]).reduce((r,s)=>{var i,a;return`${t.id}-${s.id}-${n}`!==o&&r.push({id:s.id||null,type:n,nodeId:t.id,x:(((i=t.positionAbsolute)==null?void 0:i.x)??0)+s.x+s.width/2,y:(((a=t.positionAbsolute)==null?void 0:a.y)??0)+s.y+s.height/2}),r},[])}const BT={source:null,target:null,sourceHandle:null,targetHandle:null},N2=()=>({handleDomNode:null,isValid:!1,connection:BT,endHandle:null});function E2(t,e,n,o,r,s,i){const a=r==="target",l=i.querySelector(`.react-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),c={...N2(),handleDomNode:l};if(l){const d=nf(void 0,l),h=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),m=l.classList.contains("connectable"),g=l.classList.contains("connectableend"),x={source:a?h:n,sourceHandle:a?f:o,target:a?n:h,targetHandle:a?o:f};c.connection=x,m&&g&&(e===hr.Strict?a&&d==="source"||!a&&d==="target":h!==n||f!==o)&&(c.endHandle={nodeId:h,handleId:f,type:d},c.isValid=s(x))}return c}function nf(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function of(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function UT(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function _2({event:t,handleId:e,nodeId:n,onConnect:o,isTarget:r,getState:s,setState:i,isValidConnection:a,edgeUpdaterType:l,onReconnectEnd:c}){const d=i2(t.target),{connectionMode:h,domNode:f,autoPanOnConnect:m,connectionRadius:g,onConnectStart:x,panBy:p,getNodes:b,cancelConnection:y}=s();let v,w=0;const{x:j,y:C}=zo(t),N=d==null?void 0:d.elementFromPoint(j,C),S=nf(l,N),E=f==null?void 0:f.getBoundingClientRect();if(!E||!S)return;let T,I=zo(t,E),D=!1,F=null,O=!1,R=null;const P=function({nodes:B,nodeId:A,handleId:U,handleType:V}){return B.reduce((X,Y)=>{if(Y[yt]){const{handleBounds:G}=Y[yt];let W=[],J=[];G&&(W=S2(Y,G,"source",`${A}-${U}-${V}`),J=S2(Y,G,"target",`${A}-${U}-${V}`)),X.push(...W,...J)}return X},[])}({nodes:b(),nodeId:n,handleId:e,handleType:S}),z=()=>{if(!m)return;const[B,A]=s2(I,E);p({x:B,y:A}),w=requestAnimationFrame(z)};function _(B){const{transform:A}=s();I=zo(B,E);const{handle:U,validHandleResult:V}=function(X,Y,G,W,J,$){const{x:Q,y:te}=zo(X),oe=Y.elementsFromPoint(Q,te).find(fe=>fe.classList.contains("react-flow__handle"));if(oe){const fe=oe.getAttribute("data-nodeid");if(fe){const re=nf(void 0,oe),ue=oe.getAttribute("data-handleid"),le=$({nodeId:fe,id:ue,type:re});if(le){const je=J.find(Se=>Se.nodeId===fe&&Se.type===re&&Se.id===ue);return{handle:{id:ue,type:re,nodeId:fe,x:(je==null?void 0:je.x)||G.x,y:(je==null?void 0:je.y)||G.y},validHandleResult:le}}}}let ne=[],ie=1/0;if(J.forEach(fe=>{const re=Math.sqrt((fe.x-G.x)**2+(fe.y-G.y)**2);if(re<=W){const ue=$(fe);re<=ie&&(re<ie?ne=[{handle:fe,validHandleResult:ue}]:re===ie&&ne.push({handle:fe,validHandleResult:ue}),ie=re)}}),!ne.length)return{handle:null,validHandleResult:N2()};if(ne.length===1)return ne[0];const se=ne.some(({validHandleResult:fe})=>fe.isValid),ae=ne.some(({handle:fe})=>fe.type==="target");return ne.find(({handle:fe,validHandleResult:re})=>ae?fe.type==="target":!se||re.isValid)||ne[0]}(B,d,ef(I,A,!1,[1,1]),g,P,X=>E2(X,h,n,e,r?"target":"source",a,d));if(v=U,D||(z(),D=!0),R=V.handleDomNode,F=V.connection,O=V.isValid,i({connectionPosition:v&&O?w2({x:v.x,y:v.y},A):I,connectionStatus:UT(!!v,O),connectionEndHandle:V.endHandle}),!v&&!O&&!R)return of(T);F.source!==F.target&&R&&(of(T),T=R,R.classList.add("connecting","react-flow__handle-connecting"),R.classList.toggle("valid",O),R.classList.toggle("react-flow__handle-valid",O))}function k(B){var A,U;(v||R)&&F&&O&&(o==null||o(F)),(U=(A=s()).onConnectEnd)==null||U.call(A,B),l&&(c==null||c(B)),of(T),y(),cancelAnimationFrame(w),D=!1,O=!1,F=null,R=null,d.removeEventListener("mousemove",_),d.removeEventListener("mouseup",k),d.removeEventListener("touchmove",_),d.removeEventListener("touchend",k)}i({connectionPosition:I,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:S,connectionStartHandle:{nodeId:n,handleId:e,type:S},connectionEndHandle:null}),x==null||x(t,{nodeId:n,handleId:e,handleType:S}),d.addEventListener("mousemove",_),d.addEventListener("mouseup",k),d.addEventListener("touchmove",_),d.addEventListener("touchend",k)}const I2=()=>!0,$T=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),A2=M.forwardRef(({type:t="source",position:e=Oe.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:i,onConnect:a,children:l,className:c,onMouseDown:d,onTouchStart:h,...f},m)=>{var S,E;const g=i||null,x=t==="target",p=Ft(),b=M.useContext(Zh),{connectOnClick:y,noPanClassName:v}=dt($T,Wt),{connecting:w,clickConnecting:j}=dt(((T,I,D)=>F=>{const{connectionStartHandle:O,connectionEndHandle:R,connectionClickStartHandle:P}=F;return{connecting:(O==null?void 0:O.nodeId)===T&&(O==null?void 0:O.handleId)===I&&(O==null?void 0:O.type)===D||(R==null?void 0:R.nodeId)===T&&(R==null?void 0:R.handleId)===I&&(R==null?void 0:R.type)===D,clickConnecting:(P==null?void 0:P.nodeId)===T&&(P==null?void 0:P.handleId)===I&&(P==null?void 0:P.type)===D}})(b,g,t),Wt);b||((E=(S=p.getState()).onError)==null||E.call(S,"010",TT()));const C=T=>{const{defaultEdgeOptions:I,onConnect:D,hasDefaultEdges:F}=p.getState(),O={...I,...T};if(F){const{edges:R,setEdges:P}=p.getState();P(((z,_)=>{if(!z.source||!z.target)return _;let k;return k=(B=>"id"in B&&"source"in B&&"target"in B)(z)?{...z}:{...z,id:zT(z)},((B,A)=>A.some(U=>!(U.source!==B.source||U.target!==B.target||U.sourceHandle!==B.sourceHandle&&(U.sourceHandle||B.sourceHandle)||U.targetHandle!==B.targetHandle&&(U.targetHandle||B.targetHandle))))(k,_)?_:_.concat(k)})(O,R))}D==null||D(O),a==null||a(O)},N=T=>{if(!b)return;const I=c2(T);r&&(I&&T.button===0||!I)&&_2({event:T,handleId:g,nodeId:b,onConnect:C,isTarget:x,getState:p.getState,setState:p.setState,isValidConnection:n||p.getState().isValidConnection||I2}),I?d==null||d(T):h==null||h(T)};return q.createElement("div",{"data-handleid":g,"data-nodeid":b,"data-handlepos":e,"data-id":`${b}-${g}-${t}`,className:Qt(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",v,c,{source:!x,target:x,connectable:o,connectablestart:r,connectableend:s,connecting:j,connectionindicator:o&&(r&&!w||s&&w)}]),onMouseDown:N,onTouchStart:N,onClick:y?T=>{const{onClickConnectStart:I,onClickConnectEnd:D,connectionClickStartHandle:F,connectionMode:O,isValidConnection:R}=p.getState();if(!b||!F&&!r)return;if(!F)return I==null||I(T,{nodeId:b,handleId:g,handleType:t}),void p.setState({connectionClickStartHandle:{nodeId:b,type:t,handleId:g}});const P=i2(T.target),z=n||R||I2,{connection:_,isValid:k}=E2({nodeId:b,id:g,type:t},O,F.nodeId,F.handleId||null,F.type,z,P);k&&C(_),D==null||D(T),p.setState({connectionClickStartHandle:null})}:void 0,ref:m,...f},l)});A2.displayName="Handle";var $o=M.memo(A2);const T2=({data:t,isConnectable:e,targetPosition:n=Oe.Top,sourcePosition:o=Oe.Bottom})=>q.createElement(q.Fragment,null,q.createElement($o,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,q.createElement($o,{type:"source",position:o,isConnectable:e}));T2.displayName="DefaultNode";var rf=M.memo(T2);const M2=({data:t,isConnectable:e,sourcePosition:n=Oe.Bottom})=>q.createElement(q.Fragment,null,t==null?void 0:t.label,q.createElement($o,{type:"source",position:n,isConnectable:e}));M2.displayName="InputNode";var O2=M.memo(M2);const D2=({data:t,isConnectable:e,targetPosition:n=Oe.Top})=>q.createElement(q.Fragment,null,q.createElement($o,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label);D2.displayName="OutputNode";var R2=M.memo(D2);const sf=()=>null;sf.displayName="GroupNode";const VT=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),$l=t=>t.id;function HT(t,e){return Wt(t.selectedNodes.map($l),e.selectedNodes.map($l))&&Wt(t.selectedEdges.map($l),e.selectedEdges.map($l))}const P2=M.memo(({onSelectionChange:t})=>{const e=Ft(),{selectedNodes:n,selectedEdges:o}=dt(VT,HT);return M.useEffect(()=>{const r={nodes:n,edges:o};t==null||t(r),e.getState().onSelectionChange.forEach(s=>s(r))},[n,o,t]),null});P2.displayName="SelectionListener";const WT=t=>!!t.onSelectionChange;function qT({onSelectionChange:t}){const e=dt(WT);return t||e?q.createElement(P2,{onSelectionChange:t}):null}const GT=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset});function Qr(t,e){M.useEffect(()=>{t!==void 0&&e(t)},[t])}function Ze(t,e,n){M.useEffect(()=>{e!==void 0&&n({[t]:e})},[e])}const YT=({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:r,onConnectStart:s,onConnectEnd:i,onClickConnectStart:a,onClickConnectEnd:l,nodesDraggable:c,nodesConnectable:d,nodesFocusable:h,edgesFocusable:f,edgesUpdatable:m,elevateNodesOnSelect:g,minZoom:x,maxZoom:p,nodeExtent:b,onNodesChange:y,onEdgesChange:v,elementsSelectable:w,connectionMode:j,snapGrid:C,snapToGrid:N,translateExtent:S,connectOnClick:E,defaultEdgeOptions:T,fitView:I,fitViewOptions:D,onNodesDelete:F,onEdgesDelete:O,onNodeDrag:R,onNodeDragStart:P,onNodeDragStop:z,onSelectionDrag:_,onSelectionDragStart:k,onSelectionDragStop:B,noPanClassName:A,nodeOrigin:U,rfId:V,autoPanOnConnect:X,autoPanOnNodeDrag:Y,onError:G,connectionRadius:W,isValidConnection:J,nodeDragThreshold:$})=>{const{setNodes:Q,setEdges:te,setDefaultNodesAndEdges:oe,setMinZoom:ne,setMaxZoom:ie,setTranslateExtent:se,setNodeExtent:ae,reset:fe}=dt(GT,Wt),re=Ft();return M.useEffect(()=>{const ue=o==null?void 0:o.map(le=>({...le,...T}));return oe(n,ue),()=>{fe()}},[]),Ze("defaultEdgeOptions",T,re.setState),Ze("connectionMode",j,re.setState),Ze("onConnect",r,re.setState),Ze("onConnectStart",s,re.setState),Ze("onConnectEnd",i,re.setState),Ze("onClickConnectStart",a,re.setState),Ze("onClickConnectEnd",l,re.setState),Ze("nodesDraggable",c,re.setState),Ze("nodesConnectable",d,re.setState),Ze("nodesFocusable",h,re.setState),Ze("edgesFocusable",f,re.setState),Ze("edgesUpdatable",m,re.setState),Ze("elementsSelectable",w,re.setState),Ze("elevateNodesOnSelect",g,re.setState),Ze("snapToGrid",N,re.setState),Ze("snapGrid",C,re.setState),Ze("onNodesChange",y,re.setState),Ze("onEdgesChange",v,re.setState),Ze("connectOnClick",E,re.setState),Ze("fitViewOnInit",I,re.setState),Ze("fitViewOnInitOptions",D,re.setState),Ze("onNodesDelete",F,re.setState),Ze("onEdgesDelete",O,re.setState),Ze("onNodeDrag",R,re.setState),Ze("onNodeDragStart",P,re.setState),Ze("onNodeDragStop",z,re.setState),Ze("onSelectionDrag",_,re.setState),Ze("onSelectionDragStart",k,re.setState),Ze("onSelectionDragStop",B,re.setState),Ze("noPanClassName",A,re.setState),Ze("nodeOrigin",U,re.setState),Ze("rfId",V,re.setState),Ze("autoPanOnConnect",X,re.setState),Ze("autoPanOnNodeDrag",Y,re.setState),Ze("onError",G,re.setState),Ze("connectionRadius",W,re.setState),Ze("isValidConnection",J,re.setState),Ze("nodeDragThreshold",$,re.setState),Qr(t,Q),Qr(e,te),Qr(x,ne),Qr(p,ie),Qr(S,se),Qr(b,ae),null},L2={display:"none"},KT={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},F2="react-flow__node-desc",z2="react-flow__edge-desc",XT=t=>t.ariaLiveMessage;function JT({rfId:t}){const e=dt(XT);return q.createElement("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:KT},e)}function ZT({rfId:t,disableKeyboardA11y:e}){return q.createElement(q.Fragment,null,q.createElement("div",{id:`${F2}-${t}`,style:L2},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),q.createElement("div",{id:`${z2}-${t}`,style:L2},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&q.createElement(JT,{rfId:t}))}var Si=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,o]=M.useState(!1),r=M.useRef(!1),s=M.useRef(new Set([])),[i,a]=M.useMemo(()=>{if(t!==null){const l=(Array.isArray(t)?t:[t]).filter(d=>typeof d=="string").map(d=>d.split("+")),c=l.reduce((d,h)=>d.concat(...h),[]);return[l,c]}return[[],[]]},[t]);return M.useEffect(()=>{const l=typeof document<"u"?document:null,c=(e==null?void 0:e.target)||l;if(t!==null){const d=m=>{if(r.current=m.ctrlKey||m.metaKey||m.shiftKey,(!r.current||r.current&&!e.actInsideInputWithModifier)&&qh(m))return!1;const g=U2(m.code,a);s.current.add(m[g]),B2(i,s.current,!1)&&(m.preventDefault(),o(!0))},h=m=>{if((!r.current||r.current&&!e.actInsideInputWithModifier)&&qh(m))return!1;const g=U2(m.code,a);B2(i,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(m[g]),m.key==="Meta"&&s.current.clear(),r.current=!1},f=()=>{s.current.clear(),o(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",h),window.addEventListener("blur",f),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",h),window.removeEventListener("blur",f)}}},[t,o]),n};function B2(t,e,n){return t.filter(o=>n||o.length===e.size).some(o=>o.every(r=>e.has(r)))}function U2(t,e){return e.includes(t)?"code":"key"}function $2(t,e,n,o){var a,l;const r=t.parentNode||t.parentId;if(!r)return n;const s=e.get(r),i=Zr(s,o);return $2(s,e,{x:(n.x??0)+i.x,y:(n.y??0)+i.y,z:(((a=s[yt])==null?void 0:a.z)??0)>(n.z??0)?((l=s[yt])==null?void 0:l.z)??0:n.z??0},o)}function V2(t,e,n){t.forEach(o=>{var s;const r=o.parentNode||o.parentId;if(r&&!t.has(r))throw new Error(`Parent node ${r} not found`);if(r||n!=null&&n[o.id]){const{x:i,y:a,z:l}=$2(o,t,{...o.position,z:((s=o[yt])==null?void 0:s.z)??0},e);o.positionAbsolute={x:i,y:a},o[yt].z=l,n!=null&&n[o.id]&&(o[yt].isParent=!0)}})}function af(t,e,n,o){const r=new Map,s={},i=o?1e3:0;return t.forEach(a=>{var m;const l=(Nn(a.zIndex)?a.zIndex:0)+(a.selected?i:0),c=e.get(a.id),d={...a,positionAbsolute:{x:a.position.x,y:a.position.y}},h=a.parentNode||a.parentId;h&&(s[h]=!0);const f=(c==null?void 0:c.type)&&(c==null?void 0:c.type)!==a.type;Object.defineProperty(d,yt,{enumerable:!1,value:{handleBounds:f||(m=c==null?void 0:c[yt])==null?void 0:m.handleBounds,z:l}}),r.set(a.id,d)}),V2(r,n,s),r}function H2(t,e={}){const{getNodes:n,width:o,height:r,minZoom:s,maxZoom:i,d3Zoom:a,d3Selection:l,fitViewOnInitDone:c,fitViewOnInit:d,nodeOrigin:h}=t(),f=e.initial&&!c&&d;if(a&&l&&(f||!e.initial)){const m=n().filter(x=>{var b;const p=e.includeHiddenNodes?x.width&&x.height:!x.hidden;return(b=e.nodes)!=null&&b.length?p&&e.nodes.some(y=>y.id===x.id):p}),g=m.every(x=>x.width&&x.height);if(m.length>0&&g){const x=tf(m,h),{x:p,y:b,zoom:y}=j2(x,o,r,e.minZoom??s,e.maxZoom??i,e.padding??.1),v=Qo.translate(p,b).scale(y);return typeof e.duration=="number"&&e.duration>0?a.transform(fr(l,e.duration),v):a.transform(l,v),!0}}return!1}function QT(t,e){return t.forEach(n=>{const o=e.get(n.id);o&&e.set(o.id,{...o,[yt]:o[yt],selected:n.selected})}),new Map(e)}function eM(t,e){return e.map(n=>{const o=t.find(r=>r.id===n.id);return o&&(n.selected=o.selected),n})}function Vl({changedNodes:t,changedEdges:e,get:n,set:o}){const{nodeInternals:r,edges:s,onNodesChange:i,onEdgesChange:a,hasDefaultNodes:l,hasDefaultEdges:c}=n();t!=null&&t.length&&(l&&o({nodeInternals:QT(t,r)}),i==null||i(t)),e!=null&&e.length&&(c&&o({edges:eM(e,s)}),a==null||a(e))}const es=()=>{},tM={zoomIn:es,zoomOut:es,zoomTo:es,getZoom:()=>1,setViewport:es,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:es,fitBounds:es,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},nM=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection});function Ni(){const t=(()=>{const x=Ft(),{d3Zoom:p,d3Selection:b}=dt(nM,Wt);return M.useMemo(()=>b&&p?{zoomIn:v=>p.scaleBy(fr(b,v==null?void 0:v.duration),1.2),zoomOut:v=>p.scaleBy(fr(b,v==null?void 0:v.duration),1/1.2),zoomTo:(v,w)=>p.scaleTo(fr(b,w==null?void 0:w.duration),v),getZoom:()=>x.getState().transform[2],setViewport:(v,w)=>{const[j,C,N]=x.getState().transform,S=Qo.translate(v.x??j,v.y??C).scale(v.zoom??N);p.transform(fr(b,w==null?void 0:w.duration),S)},getViewport:()=>{const[v,w,j]=x.getState().transform;return{x:v,y:w,zoom:j}},fitView:v=>H2(x.getState,v),setCenter:(v,w,j)=>{const{width:C,height:N,maxZoom:S}=x.getState(),E=(j==null?void 0:j.zoom)!==void 0?j.zoom:S,T=C/2-v*E,I=N/2-w*E,D=Qo.translate(T,I).scale(E);p.transform(fr(b,j==null?void 0:j.duration),D)},fitBounds:(v,w)=>{const{width:j,height:C,minZoom:N,maxZoom:S}=x.getState(),{x:E,y:T,zoom:I}=j2(v,j,C,N,S,(w==null?void 0:w.padding)??.1),D=Qo.translate(E,T).scale(I);p.transform(fr(b,w==null?void 0:w.duration),D)},project:v=>{const{transform:w,snapToGrid:j,snapGrid:C}=x.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),ef(v,w,j,C)},screenToFlowPosition:v=>{const{transform:w,snapToGrid:j,snapGrid:C,domNode:N}=x.getState();if(!N)return v;const{x:S,y:E}=N.getBoundingClientRect(),T={x:v.x-S,y:v.y-E};return ef(T,w,j,C)},flowToScreenPosition:v=>{const{transform:w,domNode:j}=x.getState();if(!j)return v;const{x:C,y:N}=j.getBoundingClientRect(),S=w2(v,w);return{x:S.x+C,y:S.y+N}},viewportInitialized:!0}:tM,[p,b])})(),e=Ft(),n=M.useCallback(()=>e.getState().getNodes().map(x=>({...x})),[]),o=M.useCallback(x=>e.getState().nodeInternals.get(x),[]),r=M.useCallback(()=>{const{edges:x=[]}=e.getState();return x.map(p=>({...p}))},[]),s=M.useCallback(x=>{const{edges:p=[]}=e.getState();return p.find(b=>b.id===x)},[]),i=M.useCallback(x=>{const{getNodes:p,setNodes:b,hasDefaultNodes:y,onNodesChange:v}=e.getState(),w=p(),j=typeof x=="function"?x(w):x;if(y)b(j);else if(v){const C=j.length===0?w.map(N=>({type:"remove",id:N.id})):j.map(N=>({item:N,type:"reset"}));v(C)}},[]),a=M.useCallback(x=>{const{edges:p=[],setEdges:b,hasDefaultEdges:y,onEdgesChange:v}=e.getState(),w=typeof x=="function"?x(p):x;y?b(w):v&&v(w.length===0?p.map(j=>({type:"remove",id:j.id})):w.map(j=>({item:j,type:"reset"})))},[]),l=M.useCallback(x=>{const p=Array.isArray(x)?x:[x],{getNodes:b,setNodes:y,hasDefaultNodes:v,onNodesChange:w}=e.getState();if(v)y([...b(),...p]);else if(w){const j=p.map(C=>({item:C,type:"add"}));w(j)}},[]),c=M.useCallback(x=>{const p=Array.isArray(x)?x:[x],{edges:b=[],setEdges:y,hasDefaultEdges:v,onEdgesChange:w}=e.getState();v?y([...b,...p]):w&&w(p.map(j=>({item:j,type:"add"})))},[]),d=M.useCallback(()=>{const{getNodes:x,edges:p=[],transform:b}=e.getState(),[y,v,w]=b;return{nodes:x().map(j=>({...j})),edges:p.map(j=>({...j})),viewport:{x:y,y:v,zoom:w}}},[]),h=M.useCallback(({nodes:x,edges:p})=>{const{nodeInternals:b,getNodes:y,edges:v,hasDefaultNodes:w,hasDefaultEdges:j,onNodesDelete:C,onEdgesDelete:N,onNodesChange:S,onEdgesChange:E}=e.getState(),T=(x||[]).map(R=>R.id),I=(p||[]).map(R=>R.id),D=y().reduce((R,P)=>{const z=P.parentNode||P.parentId,_=!T.includes(P.id)&&z&&R.find(k=>k.id===z);return(typeof P.deletable!="boolean"||P.deletable)&&(T.includes(P.id)||_)&&R.push(P),R},[]),F=v.filter(R=>typeof R.deletable!="boolean"||R.deletable),O=F.filter(R=>I.includes(R.id));if(D||O){const R=C2(D,F),P=[...O,...R],z=P.reduce((_,k)=>(_.includes(k.id)||_.push(k.id),_),[]);(j||w)&&(j&&e.setState({edges:v.filter(_=>!z.includes(_.id))}),w&&(D.forEach(_=>{b.delete(_.id)}),e.setState({nodeInternals:new Map(b)}))),z.length>0&&(N==null||N(P),E&&E(z.map(_=>({id:_,type:"remove"})))),D.length>0&&(C==null||C(D),S)&&S(D.map(_=>({id:_.id,type:"remove"})))}},[]),f=M.useCallback(x=>{const p=Nn((b=x).width)&&Nn(b.height)&&Nn(b.x)&&Nn(b.y);var b;const y=p?null:e.getState().nodeInternals.get(x.id);return!p&&!y?[null,null,p]:[p?x:a2(y),y,p]},[]),m=M.useCallback((x,p=!0,b)=>{const[y,v,w]=f(x);return y?(b||e.getState().getNodes()).filter(j=>{if(!(w||j.id!==v.id&&j.positionAbsolute))return!1;const C=a2(j),N=Wh(C,y);return p&&N>0||N>=y.width*y.height}):[]},[]),g=M.useCallback((x,p,b=!0)=>{const[y]=f(x);if(!y)return!1;const v=Wh(y,p);return b&&v>0||v>=y.width*y.height},[]);return M.useMemo(()=>({...t,getNodes:n,getNode:o,getEdges:r,getEdge:s,setNodes:i,setEdges:a,addNodes:l,addEdges:c,toObject:d,deleteElements:h,getIntersectingNodes:m,isNodeIntersecting:g}),[t,n,o,r,s,i,a,l,c,d,h,m,g])}const oM={actInsideInputWithModifier:!1},lf={position:"absolute",width:"100%",height:"100%",top:0,left:0},Hl=t=>({x:t.x,y:t.y,zoom:t.k}),ts=(t,e)=>t.target.closest(`.${e}`),W2=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),q2=t=>{const e=t.ctrlKey&&Ll()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},rM=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),sM=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:r=!0,zoomOnPinch:s=!0,panOnScroll:i=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=Bo.Free,zoomOnDoubleClick:c=!0,elementsSelectable:d,panOnDrag:h=!0,defaultViewport:f,translateExtent:m,minZoom:g,maxZoom:x,zoomActivationKeyCode:p,preventScrolling:b=!0,children:y,noWheelClassName:v,noPanClassName:w})=>{const j=M.useRef(),C=Ft(),N=M.useRef(!1),S=M.useRef(!1),E=M.useRef(null),T=M.useRef({x:0,y:0,zoom:0}),{d3Zoom:I,d3Selection:D,d3ZoomHandler:F,userSelectionActive:O}=dt(rM,Wt),R=Si(p),P=M.useRef(0),z=M.useRef(!1),_=M.useRef();return function(k){const B=Ft();M.useEffect(()=>{let A;const U=()=>{var X,Y;if(!k.current)return;const V=$h(k.current);V.height!==0&&V.width!==0||((Y=(X=B.getState()).onError)==null||Y.call(X,"004",ET())),B.setState({width:V.width||500,height:V.height||500})};return U(),window.addEventListener("resize",U),k.current&&(A=new ResizeObserver(()=>U()),A.observe(k.current)),()=>{window.removeEventListener("resize",U),A&&k.current&&A.unobserve(k.current)}},[])}(E),M.useEffect(()=>{if(E.current){const k=E.current.getBoundingClientRect(),B=function(){var Y,G,W,J=vT,$=wT,Q=jT,te=kT,oe=CT,ne=[0,1/0],ie=[[-1/0,-1/0],[1/0,1/0]],se=250,ae=nz,fe=Mj("start","zoom","end"),re=0,ue=10;function le(K){K.property("__zoom",n2).on("wheel.zoom",Ve,{passive:!1}).on("mousedown.zoom",Ke).on("dblclick.zoom",ee).filter(oe).on("touchstart.zoom",ye).on("touchmove.zoom",we).on("touchend.zoom touchcancel.zoom",Ae).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function je(K,pe){return(pe=Math.max(ne[0],Math.min(ne[1],pe)))===K.k?K:new fp(pe,K.x,K.y)}function Se(K,pe,ge){var he=pe[0]-ge[0]*K.k,Ce=pe[1]-ge[1]*K.k;return he===K.x&&Ce===K.y?K:new fp(K.k,he,Ce)}function Le(K){return[(+K[0][0]+ +K[1][0])/2,(+K[0][1]+ +K[1][1])/2]}function Ie(K,pe,ge,he){K.on("start.zoom",function(){ke(this,arguments).event(he).start()}).on("interrupt.zoom end.zoom",function(){ke(this,arguments).event(he).end()}).tween("zoom",function(){var Ce=this,Re=arguments,Pe=ke(Ce,Re).event(he),He=$.apply(Ce,Re),ce=ge==null?Le(He):typeof ge=="function"?ge.apply(Ce,Re):ge,Te=Math.max(He[1][0]-He[0][0],He[1][1]-He[0][1]),Me=Ce.__zoom,Ue=typeof pe=="function"?pe.apply(Ce,Re):pe,qe=ae(Me.invert(ce).concat(Te/Me.k),Ue.invert(ce).concat(Te/Ue.k));return function(De){if(De===1)De=Ue;else{var $e=qe(De),st=Te/$e[2];De=new fp(st,ce[0]-$e[0]*st,ce[1]-$e[1]*st)}Pe.zoom(null,De)}})}function ke(K,pe,ge){return!ge&&K.__zooming||new Ye(K,pe)}function Ye(K,pe){this.that=K,this.args=pe,this.active=0,this.sourceEvent=null,this.extent=$.apply(K,pe),this.taps=0}function Ve(K,...pe){if(J.apply(this,arguments)){var ge=ke(this,pe).event(K),he=this.__zoom,Ce=Math.max(ne[0],Math.min(ne[1],he.k*Math.pow(2,te.apply(this,arguments)))),Re=Kn(K);if(ge.wheel)ge.mouse[0][0]===Re[0]&&ge.mouse[0][1]===Re[1]||(ge.mouse[1]=he.invert(ge.mouse[0]=Re)),clearTimeout(ge.wheel);else{if(he.k===Ce)return;ge.mouse=[Re,he.invert(Re)],mp(this),ge.start()}vi(K),ge.wheel=setTimeout(function(){ge.wheel=null,ge.end()},150),ge.zoom("mouse",Q(Se(je(he,Ce),ge.mouse[0],ge.mouse[1]),ge.extent,ie))}}function Ke(K,...pe){if(!W&&J.apply(this,arguments)){var ge=K.currentTarget,he=ke(this,pe,!0).event(K),Ce=Vn(K.view).on("mousemove.zoom",function(ce){if(vi(ce),!he.moved){var Te=ce.clientX-Pe,Me=ce.clientY-He;he.moved=Te*Te+Me*Me>re}he.event(ce).zoom("mouse",Q(Se(he.that.__zoom,he.mouse[0]=Kn(ce,ge),he.mouse[1]),he.extent,ie))},!0).on("mouseup.zoom",function(ce){Ce.on("mousemove.zoom mouseup.zoom",null),t2(ce.view,he.moved),vi(ce),he.event(ce).end()},!0),Re=Kn(K,ge),Pe=K.clientX,He=K.clientY;e2(K.view),Uh(K),he.mouse=[Re,this.__zoom.invert(Re)],mp(this),he.start()}}function ee(K,...pe){if(J.apply(this,arguments)){var ge=this.__zoom,he=Kn(K.changedTouches?K.changedTouches[0]:K,this),Ce=ge.invert(he),Re=ge.k*(K.shiftKey?.5:2),Pe=Q(Se(je(ge,Re),he,Ce),$.apply(this,pe),ie);vi(K),se>0?Vn(this).transition().duration(se).call(Ie,Pe,he,K):Vn(this).call(le.transform,Pe,he,K)}}function ye(K,...pe){if(J.apply(this,arguments)){var ge,he,Ce,Re,Pe=K.touches,He=Pe.length,ce=ke(this,pe,K.changedTouches.length===He).event(K);for(Uh(K),he=0;he<He;++he)Re=[Re=Kn(Ce=Pe[he],this),this.__zoom.invert(Re),Ce.identifier],ce.touch0?ce.touch1||ce.touch0[2]===Re[2]||(ce.touch1=Re,ce.taps=0):(ce.touch0=Re,ge=!0,ce.taps=1+!!Y);Y&&(Y=clearTimeout(Y)),ge&&(ce.taps<2&&(G=Re[0],Y=setTimeout(function(){Y=null},500)),mp(this),ce.start())}}function we(K,...pe){if(this.__zooming){var ge,he,Ce,Re,Pe=ke(this,pe).event(K),He=K.changedTouches,ce=He.length;for(vi(K),ge=0;ge<ce;++ge)Ce=Kn(he=He[ge],this),Pe.touch0&&Pe.touch0[2]===he.identifier?Pe.touch0[0]=Ce:Pe.touch1&&Pe.touch1[2]===he.identifier&&(Pe.touch1[0]=Ce);if(he=Pe.that.__zoom,Pe.touch1){var Te=Pe.touch0[0],Me=Pe.touch0[1],Ue=Pe.touch1[0],qe=Pe.touch1[1],De=(De=Ue[0]-Te[0])*De+(De=Ue[1]-Te[1])*De,$e=($e=qe[0]-Me[0])*$e+($e=qe[1]-Me[1])*$e;he=je(he,Math.sqrt(De/$e)),Ce=[(Te[0]+Ue[0])/2,(Te[1]+Ue[1])/2],Re=[(Me[0]+qe[0])/2,(Me[1]+qe[1])/2]}else{if(!Pe.touch0)return;Ce=Pe.touch0[0],Re=Pe.touch0[1]}Pe.zoom("touch",Q(Se(he,Ce,Re),Pe.extent,ie))}}function Ae(K,...pe){if(this.__zooming){var ge,he,Ce=ke(this,pe).event(K),Re=K.changedTouches,Pe=Re.length;for(Uh(K),W&&clearTimeout(W),W=setTimeout(function(){W=null},500),ge=0;ge<Pe;++ge)he=Re[ge],Ce.touch0&&Ce.touch0[2]===he.identifier?delete Ce.touch0:Ce.touch1&&Ce.touch1[2]===he.identifier&&delete Ce.touch1;if(Ce.touch1&&!Ce.touch0&&(Ce.touch0=Ce.touch1,delete Ce.touch1),Ce.touch0)Ce.touch0[1]=this.__zoom.invert(Ce.touch0[0]);else if(Ce.end(),Ce.taps===2&&(he=Kn(he,this),Math.hypot(G[0]-he[0],G[1]-he[1])<ue)){var He=Vn(this).on("dblclick.zoom");He&&He.apply(this,arguments)}}}return le.transform=function(K,pe,ge,he){var Ce=K.selection?K.selection():K;Ce.property("__zoom",n2),K!==Ce?Ie(K,pe,ge,he):Ce.interrupt().each(function(){ke(this,arguments).event(he).start().zoom(null,typeof pe=="function"?pe.apply(this,arguments):pe).end()})},le.scaleBy=function(K,pe,ge,he){le.scaleTo(K,function(){return this.__zoom.k*(typeof pe=="function"?pe.apply(this,arguments):pe)},ge,he)},le.scaleTo=function(K,pe,ge,he){le.transform(K,function(){var Ce=$.apply(this,arguments),Re=this.__zoom,Pe=ge==null?Le(Ce):typeof ge=="function"?ge.apply(this,arguments):ge,He=Re.invert(Pe),ce=typeof pe=="function"?pe.apply(this,arguments):pe;return Q(Se(je(Re,ce),Pe,He),Ce,ie)},ge,he)},le.translateBy=function(K,pe,ge,he){le.transform(K,function(){return Q(this.__zoom.translate(typeof pe=="function"?pe.apply(this,arguments):pe,typeof ge=="function"?ge.apply(this,arguments):ge),$.apply(this,arguments),ie)},null,he)},le.translateTo=function(K,pe,ge,he,Ce){le.transform(K,function(){var Re=$.apply(this,arguments),Pe=this.__zoom,He=he==null?Le(Re):typeof he=="function"?he.apply(this,arguments):he;return Q(Qo.translate(He[0],He[1]).scale(Pe.k).translate(typeof pe=="function"?-pe.apply(this,arguments):-pe,typeof ge=="function"?-ge.apply(this,arguments):-ge),Re,ie)},he,Ce)},Ye.prototype={event:function(K){return K&&(this.sourceEvent=K),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(K,pe){return this.mouse&&K!=="mouse"&&(this.mouse[1]=pe.invert(this.mouse[0])),this.touch0&&K!=="touch"&&(this.touch0[1]=pe.invert(this.touch0[0])),this.touch1&&K!=="touch"&&(this.touch1[1]=pe.invert(this.touch1[0])),this.that.__zoom=pe,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(K){var pe=Vn(this.that).datum();fe.call(K,this.that,new yT(K,{sourceEvent:this.sourceEvent,target:le,transform:this.that.__zoom,dispatch:fe}),pe)}},le.wheelDelta=function(K){return arguments.length?(te=typeof K=="function"?K:Dl(+K),le):te},le.filter=function(K){return arguments.length?(J=typeof K=="function"?K:Dl(!!K),le):J},le.touchable=function(K){return arguments.length?(oe=typeof K=="function"?K:Dl(!!K),le):oe},le.extent=function(K){return arguments.length?($=typeof K=="function"?K:Dl([[+K[0][0],+K[0][1]],[+K[1][0],+K[1][1]]]),le):$},le.scaleExtent=function(K){return arguments.length?(ne[0]=+K[0],ne[1]=+K[1],le):[ne[0],ne[1]]},le.translateExtent=function(K){return arguments.length?(ie[0][0]=+K[0][0],ie[1][0]=+K[1][0],ie[0][1]=+K[0][1],ie[1][1]=+K[1][1],le):[[ie[0][0],ie[0][1]],[ie[1][0],ie[1][1]]]},le.constrain=function(K){return arguments.length?(Q=K,le):Q},le.duration=function(K){return arguments.length?(se=+K,le):se},le.interpolate=function(K){return arguments.length?(ae=K,le):ae},le.on=function(){var K=fe.on.apply(fe,arguments);return K===fe?le:K},le.clickDistance=function(K){return arguments.length?(re=(K=+K)*K,le):Math.sqrt(re)},le.tapDistance=function(K){return arguments.length?(ue=+K,le):ue},le}().scaleExtent([g,x]).translateExtent(m),A=Vn(E.current).call(B),U=Qo.translate(f.x,f.y).scale(Xr(f.zoom,g,x)),V=[[0,0],[k.width,k.height]],X=B.constrain()(U,V,m);B.transform(A,X),B.wheelDelta(q2),C.setState({d3Zoom:B,d3Selection:A,d3ZoomHandler:A.on("wheel.zoom"),transform:[X.x,X.y,X.k],domNode:E.current.closest(".react-flow")})}},[]),M.useEffect(()=>{D&&I&&(!i||R||O?F!==void 0&&D.on("wheel.zoom",function(k,B){if(!b&&k.type==="wheel"&&!k.ctrlKey||ts(k,v))return null;k.preventDefault(),F.call(this,k,B)},{passive:!1}):D.on("wheel.zoom",k=>{if(ts(k,v))return!1;k.preventDefault(),k.stopImmediatePropagation();const B=D.property("__zoom").k||1;if(k.ctrlKey&&s){const J=Kn(k),$=q2(k),Q=B*Math.pow(2,$);return void I.scaleTo(D,Q,J,k)}const A=k.deltaMode===1?20:1;let U=l===Bo.Vertical?0:k.deltaX*A,V=l===Bo.Horizontal?0:k.deltaY*A;!Ll()&&k.shiftKey&&l!==Bo.Vertical&&(U=k.deltaY*A,V=0),I.translateBy(D,-U/B*a,-V/B*a,{internal:!0});const X=Hl(D.property("__zoom")),{onViewportChangeStart:Y,onViewportChange:G,onViewportChangeEnd:W}=C.getState();clearTimeout(_.current),z.current||(z.current=!0,e==null||e(k,X),Y==null||Y(X)),z.current&&(t==null||t(k,X),G==null||G(X),_.current=setTimeout(()=>{n==null||n(k,X),W==null||W(X),z.current=!1},150))},{passive:!1}))},[O,i,l,D,I,F,R,s,b,v,e,t,n]),M.useEffect(()=>{I&&I.on("start",k=>{var U,V;if(!k.sourceEvent||k.sourceEvent.internal)return null;P.current=(U=k.sourceEvent)==null?void 0:U.button;const{onViewportChangeStart:B}=C.getState(),A=Hl(k.transform);N.current=!0,T.current=A,((V=k.sourceEvent)==null?void 0:V.type)==="mousedown"&&C.setState({paneDragging:!0}),B==null||B(A),e==null||e(k.sourceEvent,A)})},[I,e]),M.useEffect(()=>{I&&(O&&!N.current?I.on("zoom",null):O||I.on("zoom",k=>{var A;const{onViewportChange:B}=C.getState();if(C.setState({transform:[k.transform.x,k.transform.y,k.transform.k]}),S.current=!(!o||!W2(h,P.current??0)),(t||B)&&!((A=k.sourceEvent)!=null&&A.internal)){const U=Hl(k.transform);B==null||B(U),t==null||t(k.sourceEvent,U)}}))},[O,I,t,h,o]),M.useEffect(()=>{I&&I.on("end",k=>{if(!k.sourceEvent||k.sourceEvent.internal)return null;const{onViewportChangeEnd:B}=C.getState();if(N.current=!1,C.setState({paneDragging:!1}),o&&W2(h,P.current??0)&&!S.current&&o(k.sourceEvent),S.current=!1,(n||B)&&(A=T.current,U=k.transform,A.x!==U.x||A.y!==U.y||A.zoom!==U.k)){const V=Hl(k.transform);T.current=V,clearTimeout(j.current),j.current=setTimeout(()=>{B==null||B(V),n==null||n(k.sourceEvent,V)},i?150:0)}var A,U})},[I,i,h,n,o]),M.useEffect(()=>{I&&I.filter(k=>{const B=R||r,A=s&&k.ctrlKey;if((h===!0||Array.isArray(h)&&h.includes(1))&&k.button===1&&k.type==="mousedown"&&(ts(k,"react-flow__node")||ts(k,"react-flow__edge")))return!0;if(!(h||B||i||c||s)||O||!c&&k.type==="dblclick"||ts(k,v)&&k.type==="wheel"||ts(k,w)&&(k.type!=="wheel"||i&&k.type==="wheel"&&!R)||!s&&k.ctrlKey&&k.type==="wheel"||!B&&!i&&!A&&k.type==="wheel"||!h&&(k.type==="mousedown"||k.type==="touchstart")||Array.isArray(h)&&!h.includes(k.button)&&k.type==="mousedown")return!1;const U=Array.isArray(h)&&h.includes(k.button)||!k.button||k.button<=1;return(!k.ctrlKey||k.type==="wheel")&&U})},[O,I,r,s,i,c,h,d,R]),q.createElement("div",{className:"react-flow__renderer",ref:E,style:lf},y)},iM=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function aM(){const{userSelectionActive:t,userSelectionRect:e}=dt(iM,Wt);return t&&e?q.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function G2(t,e){const n=e.parentNode||e.parentId,o=t.find(r=>r.id===n);if(o){const r=e.position.x+e.width-o.width,s=e.position.y+e.height-o.height;if(r>0||s>0||e.position.x<0||e.position.y<0){if(o.style={...o.style},o.style.width=o.style.width??o.width,o.style.height=o.style.height??o.height,r>0&&(o.style.width+=r),s>0&&(o.style.height+=s),e.position.x<0){const i=Math.abs(e.position.x);o.position.x=o.position.x-i,o.style.width+=i,e.position.x=0}if(e.position.y<0){const i=Math.abs(e.position.y);o.position.y=o.position.y-i,o.style.height+=i,e.position.y=0}o.width=o.style.width,o.height=o.style.height}}}function Y2(t,e){if(t.some(o=>o.type==="reset"))return t.filter(o=>o.type==="reset").map(o=>o.item);const n=t.filter(o=>o.type==="add").map(o=>o.item);return e.reduce((o,r)=>{const s=t.filter(a=>a.id===r.id);if(s.length===0)return o.push(r),o;const i={...r};for(const a of s)if(a)switch(a.type){case"select":i.selected=a.selected;break;case"position":a.position!==void 0&&(i.position=a.position),a.positionAbsolute!==void 0&&(i.positionAbsolute=a.positionAbsolute),a.dragging!==void 0&&(i.dragging=a.dragging),i.expandParent&&G2(o,i);break;case"dimensions":a.dimensions!==void 0&&(i.width=a.dimensions.width,i.height=a.dimensions.height),a.updateStyle!==void 0&&(i.style={...i.style||{},...a.dimensions}),typeof a.resizing=="boolean"&&(i.resizing=a.resizing),i.expandParent&&G2(o,i);break;case"remove":return o}return o.push(i),o},n)}function K2(t,e){return Y2(t,e)}const Vo=(t,e)=>({id:t,type:"select",selected:e});function ns(t,e){return t.reduce((n,o)=>{const r=e.includes(o.id);return!o.selected&&r?(o.selected=!0,n.push(Vo(o.id,!0))):o.selected&&!r&&(o.selected=!1,n.push(Vo(o.id,!1))),n},[])}const cf=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},lM=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),X2=M.memo(({isSelecting:t,selectionMode:e=Ci.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:r,onPaneClick:s,onPaneContextMenu:i,onPaneScroll:a,onPaneMouseEnter:l,onPaneMouseMove:c,onPaneMouseLeave:d,children:h})=>{const f=M.useRef(null),m=Ft(),g=M.useRef(0),x=M.useRef(0),p=M.useRef(),{userSelectionActive:b,elementsSelectable:y,dragging:v}=dt(lM,Wt),w=()=>{m.setState({userSelectionActive:!1,userSelectionRect:null}),g.current=0,x.current=0},j=S=>{s==null||s(S),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},C=a?S=>a(S):void 0,N=y&&(t||b);return q.createElement("div",{className:Qt(["react-flow__pane",{dragging:v,selection:t}]),onClick:N?void 0:cf(j,f),onContextMenu:cf(S=>{Array.isArray(n)&&(n!=null&&n.includes(2))?S.preventDefault():i==null||i(S)},f),onWheel:cf(C,f),onMouseEnter:N?void 0:l,onMouseDown:N?S=>{const{resetSelectedElements:E,domNode:T}=m.getState();if(p.current=T==null?void 0:T.getBoundingClientRect(),!y||!t||S.button!==0||S.target!==f.current||!p.current)return;const{x:I,y:D}=zo(S,p.current);E(),m.setState({userSelectionRect:{width:0,height:0,startX:I,startY:D,x:I,y:D}}),o==null||o(S)}:void 0,onMouseMove:N?S=>{const{userSelectionRect:E,nodeInternals:T,edges:I,transform:D,onNodesChange:F,onEdgesChange:O,nodeOrigin:R,getNodes:P}=m.getState();if(!t||!p.current||!E)return;m.setState({userSelectionActive:!0,nodesSelectionActive:!1});const z=zo(S,p.current),_=E.startX??0,k=E.startY??0,B={...E,x:z.x<_?z.x:_,y:z.y<k?z.y:k,width:Math.abs(z.x-_),height:Math.abs(z.y-k)},A=P(),U=k2(T,B,D,e===Ci.Partial,!0,R),V=C2(U,I).map(Y=>Y.id),X=U.map(Y=>Y.id);if(g.current!==X.length){g.current=X.length;const Y=ns(A,X);Y.length&&(F==null||F(Y))}if(x.current!==V.length){x.current=V.length;const Y=ns(I,V);Y.length&&(O==null||O(Y))}m.setState({userSelectionRect:B})}:c,onMouseUp:N?S=>{if(S.button!==0)return;const{userSelectionRect:E}=m.getState();!b&&E&&S.target===f.current&&(j==null||j(S)),m.setState({nodesSelectionActive:g.current>0}),w(),r==null||r(S)}:void 0,onMouseLeave:N?S=>{b&&(m.setState({nodesSelectionActive:g.current>0}),r==null||r(S)),w()}:d,ref:f,style:lf},h,q.createElement(aM,null))});function J2(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const o=e.get(n);return!!o&&(!!o.selected||J2(o,e))}function Z2(t,e,n){let o=t;do{if(o!=null&&o.matches(e))return!0;if(o===n.current)return!1;o=o.parentElement}while(o);return!1}function cM(t,e,n,o){return Array.from(t.values()).filter(r=>(r.selected||r.id===o)&&(!r.parentNode||r.parentId||!J2(r,t))&&(r.draggable||e&&r.draggable===void 0)).map(r=>{var s,i;return{id:r.id,position:r.position||{x:0,y:0},positionAbsolute:r.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((s=r.positionAbsolute)==null?void 0:s.x)??0),y:n.y-(((i=r.positionAbsolute)==null?void 0:i.y)??0)},delta:{x:0,y:0},extent:r.extent,parentNode:r.parentNode||r.parentId,parentId:r.parentNode||r.parentId,width:r.width,height:r.height,expandParent:r.expandParent}})}function Q2(t,e,n,o,r=[0,0],s){const i=function(h,f){return f&&f!=="parent"?[f[0],[f[1][0]-(h.width||0),f[1][1]-(h.height||0)]]:f}(t,t.extent||o);let a=i;const l=t.parentNode||t.parentId;if(t.extent!=="parent"||t.expandParent){if(t.extent&&l&&t.extent!=="parent"){const h=n.get(l),{x:f,y:m}=Zr(h,r).positionAbsolute;a=[[t.extent[0][0]+f,t.extent[0][1]+m],[t.extent[1][0]+f,t.extent[1][1]+m]]}}else if(l&&t.width&&t.height){const h=n.get(l),{x:f,y:m}=Zr(h,r).positionAbsolute;a=h&&Nn(f)&&Nn(m)&&Nn(h.width)&&Nn(h.height)?[[f+t.width*r[0],m+t.height*r[1]],[f+h.width-t.width+t.width*r[0],m+h.height-t.height+t.height*r[1]]]:a}else s==null||s("005",_T()),a=i;let c={x:0,y:0};if(l){const h=n.get(l);c=Zr(h,r).positionAbsolute}const d=a&&a!=="parent"?Vh(e,a):e;return{position:{x:d.x-c.x,y:d.y-c.y},positionAbsolute:d}}function df({nodeId:t,dragItems:e,nodeInternals:n}){const o=e.map(r=>({...n.get(r.id),position:r.position,positionAbsolute:r.positionAbsolute}));return[t?o.find(r=>r.id===t):o[0],o]}X2.displayName="Pane";const ew=(t,e,n,o)=>{const r=e.querySelectorAll(t);if(!r||!r.length)return null;const s=Array.from(r),i=e.getBoundingClientRect(),a=i.width*o[0],l=i.height*o[1];return s.map(c=>{const d=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),position:c.getAttribute("data-handlepos"),x:(d.left-i.left-a)/n,y:(d.top-i.top-l)/n,...$h(c)}})};function Ei(t,e,n){return n===void 0?n:o=>{const r=e().nodeInternals.get(t);r&&n(o,{...r})}}function uf({id:t,store:e,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:i,nodeInternals:a,onError:l}=e.getState(),c=a.get(t);c?(e.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&i)&&(s({nodes:[c],edges:[]}),requestAnimationFrame(()=>{var d;return(d=o==null?void 0:o.current)==null?void 0:d.blur()})):r([t])):l==null||l("012",OT(t))}function hf(t){return(e,n,o)=>t==null?void 0:t(e,o)}function tw({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:s,selectNodesOnDrag:i}){const a=Ft(),[l,c]=M.useState(!1),d=M.useRef([]),h=M.useRef({x:null,y:null}),f=M.useRef(0),m=M.useRef(null),g=M.useRef({x:0,y:0}),x=M.useRef(null),p=M.useRef(!1),b=M.useRef(!1),y=M.useRef(!1),v=function(){const w=Ft();return M.useCallback(({sourceEvent:C})=>{const{transform:N,snapGrid:S,snapToGrid:E}=w.getState(),T=C.touches?C.touches[0].clientX:C.clientX,I=C.touches?C.touches[0].clientY:C.clientY,D={x:(T-N[0])/N[2],y:(I-N[1])/N[2]};return{xSnapped:E?S[0]*Math.round(D.x/S[0]):D.x,ySnapped:E?S[1]*Math.round(D.y/S[1]):D.y,...D}},[])}();return M.useEffect(()=>{if(t!=null&&t.current){const w=Vn(t.current),j=({x:S,y:E})=>{const{nodeInternals:T,onNodeDrag:I,onSelectionDrag:D,updateNodePositions:F,nodeExtent:O,snapGrid:R,snapToGrid:P,nodeOrigin:z,onError:_}=a.getState();h.current={x:S,y:E};let k=!1,B={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&O){const U=tf(d.current,z);B=Hh(U)}if(d.current=d.current.map(U=>{const V={x:S-U.distance.x,y:E-U.distance.y};P&&(V.x=R[0]*Math.round(V.x/R[0]),V.y=R[1]*Math.round(V.y/R[1]));const X=[[O[0][0],O[0][1]],[O[1][0],O[1][1]]];d.current.length>1&&O&&!U.extent&&(X[0][0]=U.positionAbsolute.x-B.x+O[0][0],X[1][0]=U.positionAbsolute.x+(U.width??0)-B.x2+O[1][0],X[0][1]=U.positionAbsolute.y-B.y+O[0][1],X[1][1]=U.positionAbsolute.y+(U.height??0)-B.y2+O[1][1]);const Y=Q2(U,V,T,X,z,_);return k=k||U.position.x!==Y.position.x||U.position.y!==Y.position.y,U.position=Y.position,U.positionAbsolute=Y.positionAbsolute,U}),!k)return;F(d.current,!0,!0),c(!0);const A=r?I:hf(D);if(A&&x.current){const[U,V]=df({nodeId:r,dragItems:d.current,nodeInternals:T});A(x.current,U,V)}},C=()=>{if(!m.current)return;const[S,E]=s2(g.current,m.current);if(S!==0||E!==0){const{transform:T,panBy:I}=a.getState();h.current.x=(h.current.x??0)-S/T[2],h.current.y=(h.current.y??0)-E/T[2],I({x:S,y:E})&&j(h.current)}f.current=requestAnimationFrame(C)},N=S=>{var z;const{nodeInternals:E,multiSelectionActive:T,nodesDraggable:I,unselectNodesAndEdges:D,onNodeDragStart:F,onSelectionDragStart:O}=a.getState();b.current=!0;const R=r?F:hf(O);i&&s||T||!r||(z=E.get(r))!=null&&z.selected||D(),r&&s&&i&&uf({id:r,store:a,nodeRef:t});const P=v(S);if(h.current=P,d.current=cM(E,I,P,r),R&&d.current){const[_,k]=df({nodeId:r,dragItems:d.current,nodeInternals:E});R(S.sourceEvent,_,k)}};if(!e){const S=function(){var E,T,I,D,F=pT,O=gT,R=xT,P=bT,z={},_=Mj("start","drag","end"),k=0,B=0;function A($){$.on("mousedown.drag",U).filter(P).on("touchstart.drag",Y).on("touchmove.drag",G,mT).on("touchend.drag touchcancel.drag",W).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function U($,Q){if(!D&&F.call(this,$,Q)){var te=J(this,O.call(this,$,Q),$,Q,"mouse");te&&(Vn($.view).on("mousemove.drag",V,yi).on("mouseup.drag",X,yi),e2($.view),zh($),I=!1,E=$.clientX,T=$.clientY,te("start",$))}}function V($){if(Kr($),!I){var Q=$.clientX-E,te=$.clientY-T;I=Q*Q+te*te>B}z.mouse("drag",$)}function X($){Vn($.view).on("mousemove.drag mouseup.drag",null),t2($.view,I),Kr($),z.mouse("end",$)}function Y($,Q){if(F.call(this,$,Q)){var te,oe,ne=$.changedTouches,ie=O.call(this,$,Q),se=ne.length;for(te=0;te<se;++te)(oe=J(this,ie,$,Q,ne[te].identifier,ne[te]))&&(zh($),oe("start",$,ne[te]))}}function G($){var Q,te,oe=$.changedTouches,ne=oe.length;for(Q=0;Q<ne;++Q)(te=z[oe[Q].identifier])&&(Kr($),te("drag",$,oe[Q]))}function W($){var Q,te,oe=$.changedTouches,ne=oe.length;for(D&&clearTimeout(D),D=setTimeout(function(){D=null},500),Q=0;Q<ne;++Q)(te=z[oe[Q].identifier])&&(zh($),te("end",$,oe[Q]))}function J($,Q,te,oe,ne,ie){var se,ae,fe,re=_.copy(),ue=Kn(ie||te,Q);if((fe=R.call($,new Bh("beforestart",{sourceEvent:te,target:A,identifier:ne,active:k,x:ue[0],y:ue[1],dx:0,dy:0,dispatch:re}),oe))!=null)return se=fe.x-ue[0]||0,ae=fe.y-ue[1]||0,function le(je,Se,Le){var Ie,ke=ue;switch(je){case"start":z[ne]=le,Ie=k++;break;case"end":delete z[ne],--k;case"drag":ue=Kn(Le||Se,Q),Ie=k}re.call(je,$,new Bh(je,{sourceEvent:Se,subject:fe,target:A,identifier:ne,active:Ie,x:ue[0]+se,y:ue[1]+ae,dx:ue[0]-ke[0],dy:ue[1]-ke[1],dispatch:re}),oe)}}return A.filter=function($){return arguments.length?(F=typeof $=="function"?$:Ol(!!$),A):F},A.container=function($){return arguments.length?(O=typeof $=="function"?$:Ol($),A):O},A.subject=function($){return arguments.length?(R=typeof $=="function"?$:Ol($),A):R},A.touchable=function($){return arguments.length?(P=typeof $=="function"?$:Ol(!!$),A):P},A.on=function(){var $=_.on.apply(_,arguments);return $===_?A:$},A.clickDistance=function($){return arguments.length?(B=($=+$)*$,A):Math.sqrt(B)},A}().on("start",E=>{const{domNode:T,nodeDragThreshold:I}=a.getState();I===0&&N(E),y.current=!1;const D=v(E);h.current=D,m.current=(T==null?void 0:T.getBoundingClientRect())||null,g.current=zo(E.sourceEvent,m.current)}).on("drag",E=>{var F,O;const T=v(E),{autoPanOnNodeDrag:I,nodeDragThreshold:D}=a.getState();if(E.sourceEvent.type==="touchmove"&&E.sourceEvent.touches.length>1&&(y.current=!0),!y.current){if(!p.current&&b.current&&I&&(p.current=!0,C()),!b.current){const R=T.xSnapped-(((F=h==null?void 0:h.current)==null?void 0:F.x)??0),P=T.ySnapped-(((O=h==null?void 0:h.current)==null?void 0:O.y)??0);Math.sqrt(R*R+P*P)>D&&N(E)}(h.current.x!==T.xSnapped||h.current.y!==T.ySnapped)&&d.current&&b.current&&(x.current=E.sourceEvent,g.current=zo(E.sourceEvent,m.current),j(T))}}).on("end",E=>{if(b.current&&!y.current&&(c(!1),p.current=!1,b.current=!1,cancelAnimationFrame(f.current),d.current)){const{updateNodePositions:T,nodeInternals:I,onNodeDragStop:D,onSelectionDragStop:F}=a.getState(),O=r?D:hf(F);if(T(d.current,!1,!1),O){const[R,P]=df({nodeId:r,dragItems:d.current,nodeInternals:I});O(E.sourceEvent,R,P)}}}).filter(E=>{const T=E.target;return!E.button&&(!n||!Z2(T,`.${n}`,t))&&(!o||Z2(T,o,t))});return w.call(S),()=>{w.on(".drag",null)}}w.on(".drag",null)}},[t,e,n,o,s,a,r,i,v]),l}function nw(){const t=Ft();return M.useCallback(n=>{const{nodeInternals:o,nodeExtent:r,updateNodePositions:s,getNodes:i,snapToGrid:a,snapGrid:l,onError:c,nodesDraggable:d}=t.getState(),h=i().filter(y=>y.selected&&(y.draggable||d&&y.draggable===void 0)),f=a?l[0]:5,m=a?l[1]:5,g=n.isShiftPressed?4:1,x=n.x*f*g,p=n.y*m*g,b=h.map(y=>{if(y.positionAbsolute){const v={x:y.positionAbsolute.x+x,y:y.positionAbsolute.y+p};a&&(v.x=l[0]*Math.round(v.x/l[0]),v.y=l[1]*Math.round(v.y/l[1]));const{positionAbsolute:w,position:j}=Q2(y,v,o,r,void 0,c);y.position=j,y.positionAbsolute=w}return y});s(b,!0,!1)},[])}const os={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var _i=t=>{const e=({id:n,type:o,data:r,xPos:s,yPos:i,xPosOrigin:a,yPosOrigin:l,selected:c,onClick:d,onMouseEnter:h,onMouseMove:f,onMouseLeave:m,onContextMenu:g,onDoubleClick:x,style:p,className:b,isDraggable:y,isSelectable:v,isConnectable:w,isFocusable:j,selectNodesOnDrag:C,sourcePosition:N,targetPosition:S,hidden:E,resizeObserver:T,dragHandle:I,zIndex:D,isParent:F,noDragClassName:O,noPanClassName:R,initialized:P,disableKeyboardA11y:z,ariaLabel:_,rfId:k,hasHandleBounds:B})=>{const A=Ft(),U=M.useRef(null),V=M.useRef(null),X=M.useRef(N),Y=M.useRef(S),G=M.useRef(o),W=v||y||d||h||f||m,J=nw(),$=Ei(n,A.getState,h),Q=Ei(n,A.getState,f),te=Ei(n,A.getState,m),oe=Ei(n,A.getState,g),ne=Ei(n,A.getState,x);M.useEffect(()=>()=>{V.current&&(T==null||T.unobserve(V.current),V.current=null)},[]),M.useEffect(()=>{if(U.current&&!E){const se=U.current;P&&B&&V.current===se||(V.current&&(T==null||T.unobserve(V.current)),T==null||T.observe(se),V.current=se)}},[E,P,B]),M.useEffect(()=>{const se=G.current!==o,ae=X.current!==N,fe=Y.current!==S;U.current&&(se||ae||fe)&&(se&&(G.current=o),ae&&(X.current=N),fe&&(Y.current=S),A.getState().updateNodeDimensions([{id:n,nodeElement:U.current,forceUpdate:!0}]))},[n,o,N,S]);const ie=tw({nodeRef:U,disabled:E||!y,noDragClassName:O,handleSelector:I,nodeId:n,isSelectable:v,selectNodesOnDrag:C});return E?null:q.createElement("div",{className:Qt(["react-flow__node",`react-flow__node-${o}`,{[R]:y},b,{selected:c,selectable:v,parent:F,dragging:ie}]),ref:U,style:{zIndex:D,transform:`translate(${a}px,${l}px)`,pointerEvents:W?"all":"none",visibility:P?"visible":"hidden",...p},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:$,onMouseMove:Q,onMouseLeave:te,onContextMenu:oe,onClick:se=>{const{nodeDragThreshold:ae}=A.getState();if(v&&(!C||!y||ae>0)&&uf({id:n,store:A,nodeRef:U}),d){const fe=A.getState().nodeInternals.get(n);fe&&d(se,{...fe})}},onDoubleClick:ne,onKeyDown:j?se=>{if(!qh(se)&&!z)if(l2.includes(se.key)&&v){const ae=se.key==="Escape";uf({id:n,store:A,unselect:ae,nodeRef:U})}else y&&c&&Object.prototype.hasOwnProperty.call(os,se.key)&&(A.setState({ariaLiveMessage:`Moved selected node ${se.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~s}, y: ${~~i}`}),J({x:os[se.key].x,y:os[se.key].y,isShiftPressed:se.shiftKey}))}:void 0,tabIndex:j?0:void 0,role:j?"button":void 0,"aria-describedby":z?void 0:`${F2}-${k}`,"aria-label":_},q.createElement(FT,{value:n},q.createElement(t,{id:n,data:r,type:o,xPos:s,yPos:i,selected:c,isConnectable:w,sourcePosition:N,targetPosition:S,dragging:ie,dragHandle:I,zIndex:D})))};return e.displayName="NodeWrapper",M.memo(e)};const dM=t=>{const e=t.getNodes().filter(n=>n.selected);return{...tf(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};var uM=M.memo(function({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const o=Ft(),{width:r,height:s,x:i,y:a,transformString:l,userSelectionActive:c}=dt(dM,Wt),d=nw(),h=M.useRef(null);if(M.useEffect(()=>{var m;n||((m=h.current)==null||m.focus({preventScroll:!0}))},[n]),tw({nodeRef:h}),c||!r||!s)return null;const f=t?m=>{const g=o.getState().getNodes().filter(x=>x.selected);t(m,g)}:void 0;return q.createElement("div",{className:Qt(["react-flow__nodesselection","react-flow__container",e]),style:{transform:l}},q.createElement("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:m=>{Object.prototype.hasOwnProperty.call(os,m.key)&&d({x:os[m.key].x,y:os[m.key].y,isShiftPressed:m.shiftKey})},style:{width:r,height:s,top:a,left:i}}))});const hM=t=>t.nodesSelectionActive,ow=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,deleteKeyCode:a,onMove:l,onMoveStart:c,onMoveEnd:d,selectionKeyCode:h,selectionOnDrag:f,selectionMode:m,onSelectionStart:g,onSelectionEnd:x,multiSelectionKeyCode:p,panActivationKeyCode:b,zoomActivationKeyCode:y,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:j,panOnScroll:C,panOnScrollSpeed:N,panOnScrollMode:S,zoomOnDoubleClick:E,panOnDrag:T,defaultViewport:I,translateExtent:D,minZoom:F,maxZoom:O,preventScrolling:R,onSelectionContextMenu:P,noWheelClassName:z,noPanClassName:_,disableKeyboardA11y:k})=>{const B=dt(hM),A=Si(h),U=Si(b),V=U||T,X=U||C,Y=A||f&&V!==!0;return(({deleteKeyCode:G,multiSelectionKeyCode:W})=>{const J=Ft(),{deleteElements:$}=Ni(),Q=Si(G,oM),te=Si(W);M.useEffect(()=>{if(Q){const{edges:oe,getNodes:ne}=J.getState(),ie=ne().filter(ae=>ae.selected),se=oe.filter(ae=>ae.selected);$({nodes:ie,edges:se}),J.setState({nodesSelectionActive:!1})}},[Q]),M.useEffect(()=>{J.setState({multiSelectionActive:te})},[te])})({deleteKeyCode:a,multiSelectionKeyCode:p}),q.createElement(sM,{onMove:l,onMoveStart:c,onMoveEnd:d,onPaneContextMenu:s,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:j,panOnScroll:X,panOnScrollSpeed:N,panOnScrollMode:S,zoomOnDoubleClick:E,panOnDrag:!A&&V,defaultViewport:I,translateExtent:D,minZoom:F,maxZoom:O,zoomActivationKeyCode:y,preventScrolling:R,noWheelClassName:z,noPanClassName:_},q.createElement(X2,{onSelectionStart:g,onSelectionEnd:x,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:V,isSelecting:!!Y,selectionMode:m},t,B&&q.createElement(uM,{onSelectionContextMenu:P,noPanClassName:_,disableKeyboardA11y:k})))};ow.displayName="FlowRenderer";var fM=M.memo(ow);function mM(t){return{input:_i(t.input||O2),default:_i(t.default||rf),output:_i(t.output||R2),group:_i(t.group||sf),...Object.keys(t).filter(e=>!["input","default","output","group"].includes(e)).reduce((e,n)=>(e[n]=_i(t[n]||rf),e),{})}}const pM=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),rw=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,updateNodeDimensions:s,onError:i}=dt(pM,Wt),a=(l=t.onlyRenderVisibleElements,dt(M.useCallback(h=>l?k2(h.nodeInternals,{x:0,y:0,width:h.width,height:h.height},h.transform,!0):h.getNodes(),[l])));var l;const c=M.useRef(),d=M.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(f=>{const m=f.map(g=>({id:g.target.getAttribute("data-id"),nodeElement:g.target,forceUpdate:!0}));s(m)});return c.current=h,h},[]);return M.useEffect(()=>()=>{var h;(h=c==null?void 0:c.current)==null||h.disconnect()},[]),q.createElement("div",{className:"react-flow__nodes",style:lf},a.map(h=>{var C,N,S;let f=h.type||"default";t.nodeTypes[f]||(i==null||i("003",NT(f)),f="default");const m=t.nodeTypes[f]||t.nodeTypes.default,g=!!(h.draggable||e&&h.draggable===void 0),x=!!(h.selectable||r&&h.selectable===void 0),p=!!(h.connectable||n&&h.connectable===void 0),b=!!(h.focusable||o&&h.focusable===void 0),y=t.nodeExtent?Vh(h.positionAbsolute,t.nodeExtent):h.positionAbsolute,v=(y==null?void 0:y.x)??0,w=(y==null?void 0:y.y)??0,j=(({x:E,y:T,width:I,height:D,origin:F})=>I&&D?F[0]<0||F[1]<0||F[0]>1||F[1]>1?{x:E,y:T}:{x:E-I*F[0],y:T-D*F[1]}:{x:E,y:T})({x:v,y:w,width:h.width??0,height:h.height??0,origin:t.nodeOrigin});return q.createElement(m,{key:h.id,id:h.id,className:h.className,style:h.style,type:f,data:h.data,sourcePosition:h.sourcePosition||Oe.Bottom,targetPosition:h.targetPosition||Oe.Top,hidden:h.hidden,xPos:v,yPos:w,xPosOrigin:j.x,yPosOrigin:j.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!h.selected,isDraggable:g,isSelectable:x,isConnectable:p,isFocusable:b,resizeObserver:d,dragHandle:h.dragHandle,zIndex:((C=h[yt])==null?void 0:C.z)??0,isParent:!!((N=h[yt])!=null&&N.isParent),noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!h.width&&!!h.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((S=h[yt])!=null&&S.handleBounds)})}))};rw.displayName="NodeRenderer";var gM=M.memo(rw);const xM=(t,e,n)=>n===Oe.Left?t-e:n===Oe.Right?t+e:t,bM=(t,e,n)=>n===Oe.Top?t-e:n===Oe.Bottom?t+e:t,sw="react-flow__edgeupdater",iw=({position:t,centerX:e,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:s,onMouseOut:i,type:a})=>q.createElement("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:i,className:Qt([sw,`${sw}-${a}`]),cx:xM(e,o,t),cy:bM(n,o,t),r:o,stroke:"transparent",fill:"transparent"}),yM=()=>!0;var rs=t=>{const e=({id:n,className:o,type:r,data:s,onClick:i,onEdgeDoubleClick:a,selected:l,animated:c,label:d,labelStyle:h,labelShowBg:f,labelBgStyle:m,labelBgPadding:g,labelBgBorderRadius:x,style:p,source:b,target:y,sourceX:v,sourceY:w,targetX:j,targetY:C,sourcePosition:N,targetPosition:S,elementsSelectable:E,hidden:T,sourceHandleId:I,targetHandleId:D,onContextMenu:F,onMouseEnter:O,onMouseMove:R,onMouseLeave:P,reconnectRadius:z,onReconnect:_,onReconnectStart:k,onReconnectEnd:B,markerEnd:A,markerStart:U,rfId:V,ariaLabel:X,isFocusable:Y,isReconnectable:G,pathOptions:W,interactionWidth:J,disableKeyboardA11y:$})=>{const Q=M.useRef(null),[te,oe]=M.useState(!1),[ne,ie]=M.useState(!1),se=Ft(),ae=M.useMemo(()=>`url('#${Qh(U,V)}')`,[U,V]),fe=M.useMemo(()=>`url('#${Qh(A,V)}')`,[A,V]);if(T)return null;const re=ki(n,se.getState,a),ue=ki(n,se.getState,F),le=ki(n,se.getState,O),je=ki(n,se.getState,R),Se=ki(n,se.getState,P),Le=(Ve,Ke)=>{if(Ve.button!==0)return;const{edges:ee,isValidConnection:ye}=se.getState(),we=Ke?y:b,Ae=(Ke?D:I)||null,K=Ke?"target":"source",pe=ye||yM,ge=Ke,he=ee.find(Ce=>Ce.id===n);ie(!0),k==null||k(Ve,he,K),_2({event:Ve,handleId:Ae,nodeId:we,onConnect:Ce=>_==null?void 0:_(he,Ce),isTarget:ge,getState:se.getState,setState:se.setState,isValidConnection:pe,edgeUpdaterType:K,onReconnectEnd:Ce=>{ie(!1),B==null||B(Ce,he,K)}})},Ie=()=>oe(!0),ke=()=>oe(!1),Ye=!E&&!i;return q.createElement("g",{className:Qt(["react-flow__edge",`react-flow__edge-${r}`,o,{selected:l,animated:c,inactive:Ye,updating:te}]),onClick:Ve=>{var K;const{edges:Ke,addSelectedEdges:ee,unselectNodesAndEdges:ye,multiSelectionActive:we}=se.getState(),Ae=Ke.find(pe=>pe.id===n);Ae&&(E&&(se.setState({nodesSelectionActive:!1}),Ae.selected&&we?(ye({nodes:[],edges:[Ae]}),(K=Q.current)==null||K.blur()):ee([n])),i&&i(Ve,Ae))},onDoubleClick:re,onContextMenu:ue,onMouseEnter:le,onMouseMove:je,onMouseLeave:Se,onKeyDown:Y?Ve=>{var Ke;if(!$&&l2.includes(Ve.key)&&E){const{unselectNodesAndEdges:ee,addSelectedEdges:ye,edges:we}=se.getState();Ve.key==="Escape"?((Ke=Q.current)==null||Ke.blur(),ee({edges:[we.find(Ae=>Ae.id===n)]})):ye([n])}}:void 0,tabIndex:Y?0:void 0,role:Y?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":X===null?void 0:X||`Edge from ${b} to ${y}`,"aria-describedby":Y?`${z2}-${V}`:void 0,ref:Q},!ne&&q.createElement(t,{id:n,source:b,target:y,selected:l,animated:c,label:d,labelStyle:h,labelShowBg:f,labelBgStyle:m,labelBgPadding:g,labelBgBorderRadius:x,data:s,style:p,sourceX:v,sourceY:w,targetX:j,targetY:C,sourcePosition:N,targetPosition:S,sourceHandleId:I,targetHandleId:D,markerStart:ae,markerEnd:fe,pathOptions:W,interactionWidth:J}),G&&q.createElement(q.Fragment,null,(G==="source"||G===!0)&&q.createElement(iw,{position:N,centerX:v,centerY:w,radius:z,onMouseDown:Ve=>Le(Ve,!0),onMouseEnter:Ie,onMouseOut:ke,type:"source"}),(G==="target"||G===!0)&&q.createElement(iw,{position:S,centerX:j,centerY:C,radius:z,onMouseDown:Ve=>Le(Ve,!1),onMouseEnter:Ie,onMouseOut:ke,type:"target"})))};return e.displayName="EdgeWrapper",M.memo(e)};function vM(t){return{default:rs(t.default||Ul),straight:rs(t.bezier||Jh),step:rs(t.step||Xh),smoothstep:rs(t.step||zl),simplebezier:rs(t.simplebezier||Yh),...Object.keys(t).filter(e=>!["default","bezier"].includes(e)).reduce((e,n)=>(e[n]=rs(t[n]||Ul),e),{})}}function aw(t,e,n=null){const o=((n==null?void 0:n.x)||0)+e.x,r=((n==null?void 0:n.y)||0)+e.y,s=(n==null?void 0:n.width)||e.width,i=(n==null?void 0:n.height)||e.height;switch(t){case Oe.Top:return{x:o+s/2,y:r};case Oe.Right:return{x:o+s,y:r+i/2};case Oe.Bottom:return{x:o+s/2,y:r+i};case Oe.Left:return{x:o,y:r+i/2}}}function lw(t,e){return t?t.length!==1&&e?e&&t.find(n=>n.id===e)||null:t[0]:null}function cw(t){var o,r,s,i,a;const e=((o=t==null?void 0:t[yt])==null?void 0:o.handleBounds)||null,n=e&&(t==null?void 0:t.width)&&(t==null?void 0:t.height)&&((r=t==null?void 0:t.positionAbsolute)==null?void 0:r.x)!==void 0&&((s=t==null?void 0:t.positionAbsolute)==null?void 0:s.y)!==void 0;return[{x:((i=t==null?void 0:t.positionAbsolute)==null?void 0:i.x)||0,y:((a=t==null?void 0:t.positionAbsolute)==null?void 0:a.y)||0,width:(t==null?void 0:t.width)||0,height:(t==null?void 0:t.height)||0},e,!!n]}const wM=[{level:0,isMaxLevel:!0,edges:[]}];function kM(t,e,n){return function(o,r,s=!1){let i=-1;const a=o.reduce((c,d)=>{var m,g;const h=Nn(d.zIndex);let f=h?d.zIndex:0;if(s){const x=r.get(d.target),p=r.get(d.source),b=d.selected||(x==null?void 0:x.selected)||(p==null?void 0:p.selected),y=Math.max(((m=p==null?void 0:p[yt])==null?void 0:m.z)||0,((g=x==null?void 0:x[yt])==null?void 0:g.z)||0,1e3);f=(h?d.zIndex:0)+(b?y:0)}return c[f]?c[f].push(d):c[f]=[d],i=f>i?f:i,c},{}),l=Object.entries(a).map(([c,d])=>{const h=+c;return{edges:d,level:h,isMaxLevel:h===i}});return l.length===0?wM:l}(dt(M.useCallback(o=>t?o.edges.filter(r=>{const s=e.get(r.source),i=e.get(r.target);return(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&(i==null?void 0:i.width)&&(i==null?void 0:i.height)&&function({sourcePos:a,targetPos:l,sourceWidth:c,sourceHeight:d,targetWidth:h,targetHeight:f,width:m,height:g,transform:x}){const p={x:Math.min(a.x,l.x),y:Math.min(a.y,l.y),x2:Math.max(a.x+c,l.x+h),y2:Math.max(a.y+d,l.y+f)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const b=Hh({x:(0-x[0])/x[2],y:(0-x[1])/x[2],width:m/x[2],height:g/x[2]}),y=Math.max(0,Math.min(b.x2,p.x2)-Math.max(b.x,p.x)),v=Math.max(0,Math.min(b.y2,p.y2)-Math.max(b.y,p.y));return Math.ceil(y*v)>0}({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:i.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:i.width,targetHeight:i.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[t,e])),e,n)}const dw={[Jr.Arrow]:({color:t="none",strokeWidth:e=1})=>q.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[Jr.ArrowClosed]:({color:t="none",strokeWidth:e=1})=>q.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},CM=({id:t,type:e,color:n,width:o=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:a="auto-start-reverse"})=>{const l=function(c){const d=Ft();return M.useMemo(()=>{var h,f;return Object.prototype.hasOwnProperty.call(dw,c)?dw[c]:((f=(h=d.getState()).onError)==null||f.call(h,"009",IT(c)),null)},[c])}(e);return l?q.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:a,refX:"0",refY:"0"},q.createElement(l,{color:n,strokeWidth:i})):null},uw=({defaultColor:t,rfId:e})=>{const n=dt(M.useCallback((({defaultColor:o,rfId:r})=>s=>{const i=[];return s.edges.reduce((a,l)=>([l.markerStart,l.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const d=Qh(c,r);i.includes(d)||(a.push({id:d,color:c.color||o,...c}),i.push(d))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))})({defaultColor:t,rfId:e}),[t,e]),(o,r)=>!(o.length!==r.length||o.some((s,i)=>s.id!==r[i].id)));return q.createElement("defs",null,n.map(o=>q.createElement(CM,{id:o.id,key:o.id,type:o.type,color:o.color,width:o.width,height:o.height,markerUnits:o.markerUnits,strokeWidth:o.strokeWidth,orient:o.orient})))};uw.displayName="MarkerDefinitions";var jM=M.memo(uw);const SM=t=>({nodesConnectable:t.nodesConnectable,edgesFocusable:t.edgesFocusable,edgesUpdatable:t.edgesUpdatable,elementsSelectable:t.elementsSelectable,width:t.width,height:t.height,connectionMode:t.connectionMode,nodeInternals:t.nodeInternals,onError:t.onError}),hw=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:o,edgeTypes:r,noPanClassName:s,onEdgeContextMenu:i,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:d,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:m,onReconnectEnd:g,reconnectRadius:x,children:p,disableKeyboardA11y:b})=>{const{edgesFocusable:y,edgesUpdatable:v,elementsSelectable:w,width:j,height:C,connectionMode:N,nodeInternals:S,onError:E}=dt(SM,Wt),T=kM(e,S,n);return j?q.createElement(q.Fragment,null,T.map(({level:I,edges:D,isMaxLevel:F})=>q.createElement("svg",{key:I,style:{zIndex:I},width:j,height:C,className:"react-flow__edges react-flow__container"},F&&q.createElement(jM,{defaultColor:t,rfId:o}),q.createElement("g",null,D.map(O=>{const[R,P,z]=cw(S.get(O.source)),[_,k,B]=cw(S.get(O.target));if(!z||!B)return null;let A=O.type||"default";r[A]||(E==null||E("011",MT(A)),A="default");const U=r[A]||r.default,V=N===hr.Strict?k.target:(k.target??[]).concat(k.source??[]),X=lw(P.source,O.sourceHandle),Y=lw(V,O.targetHandle),G=(X==null?void 0:X.position)||Oe.Bottom,W=(Y==null?void 0:Y.position)||Oe.Top,J=!!(O.focusable||y&&O.focusable===void 0),$=O.reconnectable||O.updatable,Q=f!==void 0&&($||v&&$===void 0);if(!X||!Y)return E==null||E("008",AT(X,O)),null;const{sourceX:te,sourceY:oe,targetX:ne,targetY:ie}=((se,ae,fe,re,ue,le)=>{const je=aw(fe,se,ae),Se=aw(le,re,ue);return{sourceX:je.x,sourceY:je.y,targetX:Se.x,targetY:Se.y}})(R,X,G,_,Y,W);return q.createElement(U,{key:O.id,id:O.id,className:Qt([O.className,s]),type:A,data:O.data,selected:!!O.selected,animated:!!O.animated,hidden:!!O.hidden,label:O.label,labelStyle:O.labelStyle,labelShowBg:O.labelShowBg,labelBgStyle:O.labelBgStyle,labelBgPadding:O.labelBgPadding,labelBgBorderRadius:O.labelBgBorderRadius,style:O.style,source:O.source,target:O.target,sourceHandleId:O.sourceHandle,targetHandleId:O.targetHandle,markerEnd:O.markerEnd,markerStart:O.markerStart,sourceX:te,sourceY:oe,targetX:ne,targetY:ie,sourcePosition:G,targetPosition:W,elementsSelectable:w,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:d,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:m,onReconnectEnd:g,reconnectRadius:x,rfId:o,ariaLabel:O.ariaLabel,isFocusable:J,isReconnectable:Q,pathOptions:"pathOptions"in O?O.pathOptions:void 0,interactionWidth:O.interactionWidth,disableKeyboardA11y:b})})))),p):null};hw.displayName="EdgeRenderer";var NM=M.memo(hw);const EM=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function _M({children:t}){const e=dt(EM);return q.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}const IM={[Oe.Left]:Oe.Right,[Oe.Right]:Oe.Left,[Oe.Top]:Oe.Bottom,[Oe.Bottom]:Oe.Top},fw=({nodeId:t,handleType:e,style:n,type:o=Uo.Bezier,CustomComponent:r,connectionStatus:s})=>{var C,N,S;const{fromNode:i,handleId:a,toX:l,toY:c,connectionMode:d}=dt(M.useCallback(E=>({fromNode:E.nodeInternals.get(t),handleId:E.connectionHandleId,toX:(E.connectionPosition.x-E.transform[0])/E.transform[2],toY:(E.connectionPosition.y-E.transform[1])/E.transform[2],connectionMode:E.connectionMode}),[t]),Wt),h=(C=i==null?void 0:i[yt])==null?void 0:C.handleBounds;let f=h==null?void 0:h[e];if(d===hr.Loose&&(f=f||(h==null?void 0:h[e==="source"?"target":"source"])),!i||!f)return null;const m=a?f.find(E=>E.id===a):f[0],g=m?m.x+m.width/2:(i.width??0)/2,x=m?m.y+m.height/2:i.height??0,p=(((N=i.positionAbsolute)==null?void 0:N.x)??0)+g,b=(((S=i.positionAbsolute)==null?void 0:S.y)??0)+x,y=m==null?void 0:m.position,v=y?IM[y]:null;if(!y||!v)return null;if(r)return q.createElement(r,{connectionLineType:o,connectionLineStyle:n,fromNode:i,fromHandle:m,fromX:p,fromY:b,toX:l,toY:c,fromPosition:y,toPosition:v,connectionStatus:s});let w="";const j={sourceX:p,sourceY:b,sourcePosition:y,targetX:l,targetY:c,targetPosition:v};return o===Uo.Bezier?[w]=v2(j):o===Uo.Step?[w]=Kh({...j,borderRadius:0}):o===Uo.SmoothStep?[w]=Kh(j):o===Uo.SimpleBezier?[w]=g2(j):w=`M${p},${b} ${l},${c}`,q.createElement("path",{d:w,fill:"none",className:"react-flow__connection-path",style:n})};fw.displayName="ConnectionLine";const AM=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function TM({containerStyle:t,style:e,type:n,component:o}){const{nodeId:r,handleType:s,nodesConnectable:i,width:a,height:l,connectionStatus:c}=dt(AM,Wt);return r&&s&&a&&i?q.createElement("svg",{style:t,width:a,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},q.createElement("g",{className:Qt(["react-flow__connection",c])},q.createElement(fw,{nodeId:r,handleType:s,style:e,type:n,CustomComponent:o,connectionStatus:c}))):null}function mw(t,e){return M.useRef(null),Ft(),M.useMemo(()=>e(t),[t])}const pw=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:o,onMoveEnd:r,onInit:s,onNodeClick:i,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:c,onNodeMouseEnter:d,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:m,onSelectionContextMenu:g,onSelectionStart:x,onSelectionEnd:p,connectionLineType:b,connectionLineStyle:y,connectionLineComponent:v,connectionLineContainerStyle:w,selectionKeyCode:j,selectionOnDrag:C,selectionMode:N,multiSelectionKeyCode:S,panActivationKeyCode:E,zoomActivationKeyCode:T,deleteKeyCode:I,onlyRenderVisibleElements:D,elementsSelectable:F,selectNodesOnDrag:O,defaultViewport:R,translateExtent:P,minZoom:z,maxZoom:_,preventScrolling:k,defaultMarkerColor:B,zoomOnScroll:A,zoomOnPinch:U,panOnScroll:V,panOnScrollSpeed:X,panOnScrollMode:Y,zoomOnDoubleClick:G,panOnDrag:W,onPaneClick:J,onPaneMouseEnter:$,onPaneMouseMove:Q,onPaneMouseLeave:te,onPaneScroll:oe,onPaneContextMenu:ne,onEdgeContextMenu:ie,onEdgeMouseEnter:se,onEdgeMouseMove:ae,onEdgeMouseLeave:fe,onReconnect:re,onReconnectStart:ue,onReconnectEnd:le,reconnectRadius:je,noDragClassName:Se,noWheelClassName:Le,noPanClassName:Ie,elevateEdgesOnSelect:ke,disableKeyboardA11y:Ye,nodeOrigin:Ve,nodeExtent:Ke,rfId:ee})=>{const ye=mw(t,mM),we=mw(e,vM);return function(Ae){const K=Ni(),pe=M.useRef(!1);M.useEffect(()=>{!pe.current&&K.viewportInitialized&&Ae&&(setTimeout(()=>Ae(K),1),pe.current=!0)},[Ae,K.viewportInitialized])}(s),q.createElement(fM,{onPaneClick:J,onPaneMouseEnter:$,onPaneMouseMove:Q,onPaneMouseLeave:te,onPaneContextMenu:ne,onPaneScroll:oe,deleteKeyCode:I,selectionKeyCode:j,selectionOnDrag:C,selectionMode:N,onSelectionStart:x,onSelectionEnd:p,multiSelectionKeyCode:S,panActivationKeyCode:E,zoomActivationKeyCode:T,elementsSelectable:F,onMove:n,onMoveStart:o,onMoveEnd:r,zoomOnScroll:A,zoomOnPinch:U,zoomOnDoubleClick:G,panOnScroll:V,panOnScrollSpeed:X,panOnScrollMode:Y,panOnDrag:W,defaultViewport:R,translateExtent:P,minZoom:z,maxZoom:_,onSelectionContextMenu:g,preventScrolling:k,noDragClassName:Se,noWheelClassName:Le,noPanClassName:Ie,disableKeyboardA11y:Ye},q.createElement(_M,null,q.createElement(NM,{edgeTypes:we,onEdgeClick:a,onEdgeDoubleClick:c,onlyRenderVisibleElements:D,onEdgeContextMenu:ie,onEdgeMouseEnter:se,onEdgeMouseMove:ae,onEdgeMouseLeave:fe,onReconnect:re,onReconnectStart:ue,onReconnectEnd:le,reconnectRadius:je,defaultMarkerColor:B,noPanClassName:Ie,elevateEdgesOnSelect:!!ke,disableKeyboardA11y:Ye,rfId:ee},q.createElement(TM,{style:y,type:b,component:v,containerStyle:w})),q.createElement("div",{className:"react-flow__edgelabel-renderer"}),q.createElement(gM,{nodeTypes:ye,onNodeClick:i,onNodeDoubleClick:l,onNodeMouseEnter:d,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:m,selectNodesOnDrag:O,onlyRenderVisibleElements:D,noPanClassName:Ie,noDragClassName:Se,disableKeyboardA11y:Ye,nodeOrigin:Ve,nodeExtent:Ke,rfId:ee})))};pw.displayName="GraphView";var MM=M.memo(pw);const ff=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ho={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:ff,nodeExtent:ff,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:hr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:(t,e)=>{},isValidConnection:void 0},OM=()=>((t,e)=>t?Qv(t,e):Qv)((t,e)=>({...Ho,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:s}=e();t({nodeInternals:af(n,o,r,s)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:o={}}=e();t({edges:n.map(r=>({...o,...r}))})},setDefaultNodesAndEdges:(n,o)=>{const r=n!==void 0,s=o!==void 0,i=r?af(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:i,edges:s?o:[],hasDefaultNodes:r,hasDefaultEdges:s})},updateNodeDimensions:n=>{const{onNodesChange:o,nodeInternals:r,fitViewOnInit:s,fitViewOnInitDone:i,fitViewOnInitOptions:a,domNode:l,nodeOrigin:c}=e(),d=l==null?void 0:l.querySelector(".react-flow__viewport");if(!d)return;const h=window.getComputedStyle(d),{m22:f}=new window.DOMMatrixReadOnly(h.transform),m=n.reduce((x,p)=>{const b=r.get(p.id);if(b!=null&&b.hidden)r.set(b.id,{...b,[yt]:{...b[yt],handleBounds:void 0}});else if(b){const y=$h(p.nodeElement);!(!y.width||!y.height||b.width===y.width&&b.height===y.height&&!p.forceUpdate)&&(r.set(b.id,{...b,[yt]:{...b[yt],handleBounds:{source:ew(".source",p.nodeElement,f,c),target:ew(".target",p.nodeElement,f,c)}},...y}),x.push({id:b.id,type:"dimensions",dimensions:y}))}return x},[]);V2(r,c);const g=i||s&&!i&&H2(e,{initial:!0,...a});t({nodeInternals:new Map(r),fitViewOnInitDone:g}),(m==null?void 0:m.length)>0&&(o==null||o(m))},updateNodePositions:(n,o=!0,r=!1)=>{const{triggerNodeChanges:s}=e(),i=n.map(a=>{const l={id:a.id,type:"position",dragging:r};return o&&(l.positionAbsolute=a.positionAbsolute,l.position=a.position),l});s(i)},triggerNodeChanges:n=>{const{onNodesChange:o,nodeInternals:r,hasDefaultNodes:s,nodeOrigin:i,getNodes:a,elevateNodesOnSelect:l}=e();if(n!=null&&n.length){if(s){const c=af(K2(n,a()),r,i,l);t({nodeInternals:c})}o==null||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let i,a=null;o?i=n.map(l=>Vo(l,!0)):(i=ns(s(),n),a=ns(r,[])),Vl({changedNodes:i,changedEdges:a,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let i,a=null;o?i=n.map(l=>Vo(l,!0)):(i=ns(r,n),a=ns(s(),[])),Vl({changedNodes:a,changedEdges:i,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:s}=e(),i=o||r;Vl({changedNodes:(n||s()).map(a=>(a.selected=!1,Vo(a.id,!1))),changedEdges:i.map(a=>Vo(a.id,!1)),get:e,set:t})},setMinZoom:n=>{const{d3Zoom:o,maxZoom:r}=e();o==null||o.scaleExtent([n,r]),t({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:o,minZoom:r}=e();o==null||o.scaleExtent([r,n]),t({maxZoom:n})},setTranslateExtent:n=>{var o;(o=e().d3Zoom)==null||o.translateExtent(n),t({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:o}=e();Vl({changedNodes:o().filter(r=>r.selected).map(r=>Vo(r.id,!1)),changedEdges:n.filter(r=>r.selected).map(r=>Vo(r.id,!1)),get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:o}=e();o.forEach(r=>{r.positionAbsolute=Vh(r.position,n)}),t({nodeExtent:n,nodeInternals:new Map(o)})},panBy:n=>{const{transform:o,width:r,height:s,d3Zoom:i,d3Selection:a,translateExtent:l}=e();if(!i||!a||!n.x&&!n.y)return!1;const c=Qo.translate(o[0]+n.x,o[1]+n.y).scale(o[2]),d=[[0,0],[r,s]],h=i==null?void 0:i.constrain()(c,d,l);return i.transform(a,h),o[0]!==h.x||o[1]!==h.y||o[2]!==h.k},cancelConnection:()=>t({connectionNodeId:Ho.connectionNodeId,connectionHandleId:Ho.connectionHandleId,connectionHandleType:Ho.connectionHandleType,connectionStatus:Ho.connectionStatus,connectionStartHandle:Ho.connectionStartHandle,connectionEndHandle:Ho.connectionEndHandle}),reset:()=>t({...Ho})}),Object.is),mf=({children:t})=>{const e=M.useRef(null);return e.current||(e.current=OM()),q.createElement(ST,{value:e.current},t)};mf.displayName="ReactFlowProvider";const gw=({children:t})=>M.useContext(Rl)?q.createElement(q.Fragment,null,t):q.createElement(mf,null,t);gw.displayName="ReactFlowWrapper";const DM={input:O2,default:rf,output:R2,group:sf},RM={default:Ul,straight:Jh,step:Xh,smoothstep:zl,simplebezier:Yh},PM=[0,0],LM=[15,15],FM={x:0,y:0,zoom:1},zM={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},pf=M.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s=DM,edgeTypes:i=RM,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:d,onMoveStart:h,onMoveEnd:f,onConnect:m,onConnectStart:g,onConnectEnd:x,onClickConnectStart:p,onClickConnectEnd:b,onNodeMouseEnter:y,onNodeMouseMove:v,onNodeMouseLeave:w,onNodeContextMenu:j,onNodeDoubleClick:C,onNodeDragStart:N,onNodeDrag:S,onNodeDragStop:E,onNodesDelete:T,onEdgesDelete:I,onSelectionChange:D,onSelectionDragStart:F,onSelectionDrag:O,onSelectionDragStop:R,onSelectionContextMenu:P,onSelectionStart:z,onSelectionEnd:_,connectionMode:k=hr.Strict,connectionLineType:B=Uo.Bezier,connectionLineStyle:A,connectionLineComponent:U,connectionLineContainerStyle:V,deleteKeyCode:X="Backspace",selectionKeyCode:Y="Shift",selectionOnDrag:G=!1,selectionMode:W=Ci.Full,panActivationKeyCode:J="Space",multiSelectionKeyCode:$=Ll()?"Meta":"Control",zoomActivationKeyCode:Q=Ll()?"Meta":"Control",snapToGrid:te=!1,snapGrid:oe=LM,onlyRenderVisibleElements:ne=!1,selectNodesOnDrag:ie=!0,nodesDraggable:se,nodesConnectable:ae,nodesFocusable:fe,nodeOrigin:re=PM,edgesFocusable:ue,edgesUpdatable:le,elementsSelectable:je,defaultViewport:Se=FM,minZoom:Le=.5,maxZoom:Ie=2,translateExtent:ke=ff,preventScrolling:Ye=!0,nodeExtent:Ve,defaultMarkerColor:Ke="#b1b1b7",zoomOnScroll:ee=!0,zoomOnPinch:ye=!0,panOnScroll:we=!1,panOnScrollSpeed:Ae=.5,panOnScrollMode:K=Bo.Free,zoomOnDoubleClick:pe=!0,panOnDrag:ge=!0,onPaneClick:he,onPaneMouseEnter:Ce,onPaneMouseMove:Re,onPaneMouseLeave:Pe,onPaneScroll:He,onPaneContextMenu:ce,children:Te,onEdgeContextMenu:Me,onEdgeDoubleClick:Ue,onEdgeMouseEnter:qe,onEdgeMouseMove:De,onEdgeMouseLeave:$e,onEdgeUpdate:st,onEdgeUpdateStart:Xe,onEdgeUpdateEnd:it,onReconnect:Ut,onReconnectStart:qt,onReconnectEnd:xn,reconnectRadius:en=10,edgeUpdaterRadius:Ln=10,onNodesChange:is,onEdgesChange:Xn,noDragClassName:So="nodrag",noWheelClassName:_n="nowheel",noPanClassName:as="nopan",fitView:Ai=!1,fitViewOptions:pO,connectOnClick:gO=!0,attributionPosition:xO,proOptions:bO,defaultEdgeOptions:yO,elevateNodesOnSelect:vO=!0,elevateEdgesOnSelect:wO=!1,disableKeyboardA11y:l3=!1,autoPanOnConnect:kO=!0,autoPanOnNodeDrag:CO=!0,connectionRadius:jO=20,isValidConnection:SO,onError:NO,style:EO,id:c3,nodeDragThreshold:_O,...IO},AO)=>{const im=c3||"1";return q.createElement("div",{...IO,style:{...EO,...zM},ref:AO,className:Qt(["react-flow",r]),"data-testid":"rf__wrapper",id:c3},q.createElement(gw,null,q.createElement(MM,{onInit:c,onMove:d,onMoveStart:h,onMoveEnd:f,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:y,onNodeMouseMove:v,onNodeMouseLeave:w,onNodeContextMenu:j,onNodeDoubleClick:C,nodeTypes:s,edgeTypes:i,connectionLineType:B,connectionLineStyle:A,connectionLineComponent:U,connectionLineContainerStyle:V,selectionKeyCode:Y,selectionOnDrag:G,selectionMode:W,deleteKeyCode:X,multiSelectionKeyCode:$,panActivationKeyCode:J,zoomActivationKeyCode:Q,onlyRenderVisibleElements:ne,selectNodesOnDrag:ie,defaultViewport:Se,translateExtent:ke,minZoom:Le,maxZoom:Ie,preventScrolling:Ye,zoomOnScroll:ee,zoomOnPinch:ye,zoomOnDoubleClick:pe,panOnScroll:we,panOnScrollSpeed:Ae,panOnScrollMode:K,panOnDrag:ge,onPaneClick:he,onPaneMouseEnter:Ce,onPaneMouseMove:Re,onPaneMouseLeave:Pe,onPaneScroll:He,onPaneContextMenu:ce,onSelectionContextMenu:P,onSelectionStart:z,onSelectionEnd:_,onEdgeContextMenu:Me,onEdgeDoubleClick:Ue,onEdgeMouseEnter:qe,onEdgeMouseMove:De,onEdgeMouseLeave:$e,onReconnect:Ut??st,onReconnectStart:qt??Xe,onReconnectEnd:xn??it,reconnectRadius:en??Ln,defaultMarkerColor:Ke,noDragClassName:So,noWheelClassName:_n,noPanClassName:as,elevateEdgesOnSelect:wO,rfId:im,disableKeyboardA11y:l3,nodeOrigin:re,nodeExtent:Ve}),q.createElement(YT,{nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:m,onConnectStart:g,onConnectEnd:x,onClickConnectStart:p,onClickConnectEnd:b,nodesDraggable:se,nodesConnectable:ae,nodesFocusable:fe,edgesFocusable:ue,edgesUpdatable:le,elementsSelectable:je,elevateNodesOnSelect:vO,minZoom:Le,maxZoom:Ie,nodeExtent:Ve,onNodesChange:is,onEdgesChange:Xn,snapToGrid:te,snapGrid:oe,connectionMode:k,translateExtent:ke,connectOnClick:gO,defaultEdgeOptions:yO,fitView:Ai,fitViewOptions:pO,onNodesDelete:T,onEdgesDelete:I,onNodeDragStart:N,onNodeDrag:S,onNodeDragStop:E,onSelectionDrag:O,onSelectionDragStart:F,onSelectionDragStop:R,noPanClassName:as,nodeOrigin:re,rfId:im,autoPanOnConnect:kO,autoPanOnNodeDrag:CO,onError:NO,connectionRadius:jO,isValidConnection:SO,nodeDragThreshold:_O}),q.createElement(qT,{onSelectionChange:D}),Te,q.createElement(RT,{proOptions:bO,position:xO}),q.createElement(ZT,{rfId:im,disableKeyboardA11y:l3})))});function xw(t){return e=>{const[n,o]=M.useState(e),r=M.useCallback(s=>o(i=>t(s,i)),[]);return[n,o,r]}}pf.displayName="ReactFlow";const bw=xw(K2),yw=xw(function(t,e){return Y2(t,e)});function BM(){return q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},q.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function UM(){return q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},q.createElement("path",{d:"M0 0h32v4.2H0z"}))}function $M(){return q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},q.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function VM(){return q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},q.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function HM(){return q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},q.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const ss=({children:t,className:e,...n})=>q.createElement("button",{type:"button",className:Qt(["react-flow__controls-button",e]),...n},t);ss.displayName="ControlButton";const WM=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),vw=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:i,onFitView:a,onInteractiveChange:l,className:c,children:d,position:h="bottom-left"})=>{const f=Ft(),[m,g]=M.useState(!1),{isInteractive:x,minZoomReached:p,maxZoomReached:b}=dt(WM,Wt),{zoomIn:y,zoomOut:v,fitView:w}=Ni();return M.useEffect(()=>{g(!0)},[]),m?q.createElement(Pl,{className:Qt(["react-flow__controls",c]),position:h,style:t,"data-testid":"rf__controls"},e&&q.createElement(q.Fragment,null,q.createElement(ss,{onClick:()=>{y(),s==null||s()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},q.createElement(BM,null)),q.createElement(ss,{onClick:()=>{v(),i==null||i()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:p},q.createElement(UM,null))),n&&q.createElement(ss,{className:"react-flow__controls-fitview",onClick:()=>{w(r),a==null||a()},title:"fit view","aria-label":"fit view"},q.createElement($M,null)),o&&q.createElement(ss,{className:"react-flow__controls-interactive",onClick:()=>{f.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),l==null||l(!x)},title:"toggle interactivity","aria-label":"toggle interactivity"},x?q.createElement(HM,null):q.createElement(VM,null)),d):null};vw.displayName="Controls";var En,qM=M.memo(vw);function GM({color:t,dimensions:e,lineWidth:n}){return q.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function YM({color:t,radius:e}){return q.createElement("circle",{cx:e,cy:e,r:e,fill:t})}(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(En||(En={}));const KM={[En.Dots]:"#91919a",[En.Lines]:"#eee",[En.Cross]:"#e2e2e2"},XM={[En.Dots]:1,[En.Lines]:1,[En.Cross]:6},JM=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function ww({id:t,variant:e=En.Dots,gap:n=20,size:o,lineWidth:r=1,offset:s=2,color:i,style:a,className:l}){const c=M.useRef(null),{transform:d,patternId:h}=dt(JM,Wt),f=i||KM[e],m=o||XM[e],g=e===En.Dots,x=e===En.Cross,p=Array.isArray(n)?n:[n,n],b=[p[0]*d[2]||1,p[1]*d[2]||1],y=m*d[2],v=x?[y,y]:b,w=g?[y/s,y/s]:[v[0]/s,v[1]/s];return q.createElement("svg",{className:Qt(["react-flow__background",l]),style:{...a,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:c,"data-testid":"rf__background"},q.createElement("pattern",{id:h+t,x:d[0]%b[0],y:d[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${w[0]},-${w[1]})`},g?q.createElement(YM,{color:f,radius:y/s}):q.createElement(GM,{dimensions:v,color:f,lineWidth:r})),q.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+t})`}))}ww.displayName="Background";var ZM=M.memo(ww);function gf(t){return Math.min(11*t+35,200)}const kw=q.createContext("LR"),Cw=M.memo(t=>{const e=H.c(51),{data:n,selected:o}=t,r=Ne(n.atom),s=wr().inOrderIds.indexOf(r.id),i=o?"var(--gray-9)":"var(--gray-3)",a=dt(QM),l=M.use(kw);let c,d,h,f,m;if(e[0]!==r.code||e[1]!==i||e[2]!==l||e[3]!==o){const I=r.code.split(`
|
|
160
|
-
`).length,D=l==="LR"?Oe.Left:Oe.Top;let F;e[8]!==i?(F={background:i},e[8]=i,e[9]=F):F=e[9],e[10]!==D||e[11]!==F?(h=u.jsx($o,{type:"target",id:"inputs",position:D,style:F}),e[10]=D,e[11]=F,e[12]=h):h=e[12];const O=l==="LR"?Oe.Left:Oe.Top;let R;e[13]!==i?(R={background:i},e[13]=i,e[14]=R):R=e[14],e[15]!==O||e[16]!==R?(f=u.jsx($o,{type:"source",id:"inputs",position:O,style:R}),e[15]=O,e[16]=R,e[17]=f):f=e[17];const P=o&&"border-primary";e[18]!==P?(d=xe("flex flex-col bg-card border border-input/50 rounded-md mx-[2px] overflow-hidden",P),e[18]=P,e[19]=d):d=e[19],c=gf(I),e[0]=r.code,e[1]=i,e[2]=l,e[3]=o,e[4]=c,e[5]=d,e[6]=h,e[7]=f}else c=e[4],d=e[5],h=e[6],f=e[7];var g;let x;e[20]!==n.forceWidth||e[21]!==a?(m=n.forceWidth||(g=a,Math.min(Math.max(g-100,100),400)),e[20]=n.forceWidth,e[21]=a,e[22]=m):m=e[22],e[23]!==c||e[24]!==m?(x={height:c,width:m},e[23]=c,e[24]=m,e[25]=x):x=e[25];const p=hL(r.name,s);let b,y,v;e[26]!==p?(b=u.jsx("div",{className:"text-muted-foreground font-semibold text-xs py-1 px-2 bg-muted border-b",children:p}),e[26]=p,e[27]=b):b=e[27],e[28]!==r.code?(y=u.jsx(UF,{code:r.code}),e[28]=r.code,e[29]=y):y=e[29],e[30]!==d||e[31]!==x||e[32]!==b||e[33]!==y?(v=u.jsxs("div",{className:d,style:x,children:[b,y]}),e[30]=d,e[31]=x,e[32]=b,e[33]=y,e[34]=v):v=e[34];const w=l==="LR"?Oe.Right:Oe.Bottom;let j,C;e[35]!==i?(j={background:i},e[35]=i,e[36]=j):j=e[36],e[37]!==w||e[38]!==j?(C=u.jsx($o,{type:"source",id:"outputs",position:w,style:j}),e[37]=w,e[38]=j,e[39]=C):C=e[39];const N=l==="LR"?Oe.Right:Oe.Bottom;let S,E,T;return e[40]!==i?(S={background:i},e[40]=i,e[41]=S):S=e[41],e[42]!==N||e[43]!==S?(E=u.jsx($o,{type:"target",id:"outputs",position:N,style:S}),e[42]=N,e[43]=S,e[44]=E):E=e[44],e[45]!==v||e[46]!==C||e[47]!==E||e[48]!==h||e[49]!==f?(T=u.jsxs("div",{children:[h,f,v,C,E]}),e[45]=v,e[46]=C,e[47]=E,e[48]=h,e[49]=f,e[50]=T):T=e[50],T},(t,e)=>["data","selected","id"].every(n=>t[n]===e[n]));Cw.displayName="CustomNode";const jw={custom:Cw};function QM(t){const{width:e}=t;return e}const Sw=t=>{const e=H.c(18),{maxCount:n,cellIds:o,onClick:r,skipScroll:s}=t,i=wr();let a,l,c,d;if(e[0]!==o||e[1]!==i||e[2]!==n||e[3]!==r||e[4]!==s){c=Symbol.for("react.early_return_sentinel");e:{let h;e[8]!==i?(h=(g,x)=>i.inOrderIds.indexOf(g)-i.inOrderIds.indexOf(x),e[8]=i,e[9]=h):h=e[9];const f=[...o].sort(h);if(o.length===0){let g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("div",{className:"text-muted-foreground",children:"--"}),e[10]=g):g=e[10],c=g;break e}let m;e[11]!==o.length||e[12]!==r||e[13]!==s?(m=(g,x)=>u.jsxs("span",{className:"truncate",children:[u.jsx(Mo,{variant:"focus",cellId:g,skipScroll:s,className:"whitespace-nowrap",onClick:r?()=>r(g):void 0},g),x<o.length-1&&", "]},g),e[11]=o.length,e[12]=r,e[13]=s,e[14]=m):m=e[14],a=f.slice(0,n).map(m),l=o.length>n&&u.jsxs(br,{children:[u.jsx(ws,{asChild:!0,children:u.jsxs("span",{className:"whitespace-nowrap text-muted-foreground text-xs hover:underline cursor-pointer",children:["+",o.length-n," more"]})}),u.jsx(ps,{className:"w-auto",children:u.jsx("div",{className:"flex flex-col gap-1 py-1",children:f.slice(n).map(g=>u.jsx(Mo,{variant:"focus",cellId:g,className:"whitespace-nowrap",onClick:r?()=>r(g):void 0},g))})})]})}e[0]=o,e[1]=i,e[2]=n,e[3]=r,e[4]=s,e[5]=a,e[6]=l,e[7]=c}else a=e[5],l=e[6],c=e[7];return c!==Symbol.for("react.early_return_sentinel")?c:(e[15]!==a||e[16]!==l?(d=u.jsxs(u.Fragment,{children:[a,l]}),e[15]=a,e[16]=l,e[17]=d):d=e[17],d)},xf=t=>{const e=H.c(15);let n,o,r,s;e[0]!==t?({name:o,declaredBy:n,onClick:r,...s}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s):(n=e[1],o=e[2],r=e[3],s=e[4]);const i=n.length>1?"destructive":"outline";let a,l,c;return e[5]!==o||e[6]!==r?(a=async d=>{r?r(d):(await sn(o),Je({title:"Copied to clipboard"}))},e[5]=o,e[6]=r,e[7]=a):a=e[7],e[8]!==o||e[9]!==i||e[10]!==a?(l=u.jsx(qC,{title:o,variant:i,className:"rounded-sm text-ellipsis block overflow-hidden max-w-fit cursor-pointer font-medium",onClick:a,children:o}),e[8]=o,e[9]=i,e[10]=a,e[11]=l):l=e[11],e[12]!==s||e[13]!==l?(c=u.jsx("div",{className:"max-w-[130px]",...s,children:l}),e[12]=s,e[13]=l,e[14]=c):c=e[14],c},bf=M.memo(t=>{const e=H.c(38),{onChange:n,view:o,settings:r,onSettingsChange:s}=t;let i;e[0]!==s||e[1]!==r?(i=(O,R)=>{s({...r,[O]:R})},e[0]=s,e[1]=r,e[2]=i):i=e[2];const a=i;let l,c,d,h,f,m;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(ws,{asChild:!0,children:u.jsx(ve,{variant:"text",size:"xs",children:u.jsx(_m,{className:"w-4 h-4"})})}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx("div",{className:"font-semibold pb-4",children:"Settings"}),e[4]=c):c=e[4],e[5]!==a?(d=O=>a("hidePureMarkdown",!!O),e[5]=a,e[6]=d):d=e[6],e[7]!==r.hidePureMarkdown||e[8]!==d?(h=u.jsx(yC,{"data-testid":"hide-pure-markdown-checkbox",id:"hide-pure-markdown",checked:r.hidePureMarkdown,onCheckedChange:d}),e[7]=r.hidePureMarkdown,e[8]=d,e[9]=h):h=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(gr,{htmlFor:"hide-pure-markdown",children:"Hide pure markdown"}),e[10]=f):f=e[10],e[11]!==h?(m=u.jsxs(br,{children:[l,u.jsxs(ps,{className:"w-auto p-2 text-muted-foreground",children:[c,u.jsxs("div",{className:"flex items-center gap-2",children:[h,f]})]})]}),e[11]=h,e[12]=m):m=e[12];const g=m,x=o==="_minimap_";let p,b,y;e[13]!==n?(p=()=>n("_minimap_"),e[13]=n,e[14]=p):p=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(Gp,{className:"w-4 h-4 mr-1"}),e[15]=b):b=e[15],e[16]!==x||e[17]!==p?(y=u.jsxs(ve,{variant:"outline",className:"bg-background","aria-selected":x,size:"xs",onClick:p,children:[b,"Mini Map"]}),e[16]=x,e[17]=p,e[18]=y):y=e[18];const v=o==="TB";let w,j,C;e[19]!==n?(w=()=>n("TB"),e[19]=n,e[20]=w):w=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx(ha,{className:"w-4 h-4 mr-1"}),e[21]=j):j=e[21],e[22]!==v||e[23]!==w?(C=u.jsxs(ve,{variant:"outline",className:"bg-background","aria-selected":v,size:"xs",onClick:w,children:[j,"Vertical Tree"]}),e[22]=v,e[23]=w,e[24]=C):C=e[24];const N=o==="LR";let S,E,T,I;e[25]!==n?(S=()=>n("LR"),e[25]=n,e[26]=S):S=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(E=u.jsx(ha,{className:"w-4 h-4 mr-1 transform -rotate-90"}),e[27]=E):E=e[27],e[28]!==N||e[29]!==S?(T=u.jsxs(ve,{variant:"outline",className:"bg-background","aria-selected":N,size:"xs",onClick:S,children:[E," ","Horizontal Tree"]}),e[28]=N,e[29]=S,e[30]=T):T=e[30],e[31]!==y||e[32]!==C||e[33]!==T?(I=u.jsxs("div",{className:"flex gap-2",children:[y,C,T]}),e[31]=y,e[32]=C,e[33]=T,e[34]=I):I=e[34];const D=o!=="_minimap_"&&g;let F;return e[35]!==I||e[36]!==D?(F=u.jsxs(Pl,{position:"top-right",className:"flex flex-col items-end gap-2",children:[I,D]}),e[35]=I,e[36]=D,e[37]=F):F=e[37],F});bf.displayName="GraphToolbar";const Wl=M.memo(t=>{const e=H.c(11),{selection:n,variables:o,onClearSelection:r}=t;if(!n)return null;const s=e7;let i;e[0]!==r||e[1]!==n.id||e[2]!==n.source||e[3]!==n.target||e[4]!==n.type||e[5]!==o?(i=()=>{if(n.type==="node"){const d=Object.values(o).filter(m=>m.usedBy.includes(n.id)),h=Object.values(o).filter(m=>m.declaredBy.includes(n.id)),f=(m,g)=>u.jsxs(u.Fragment,{children:[m.length===0&&u.jsx("div",{className:"text-muted-foreground text-sm text-center",children:"--"}),u.jsx("div",{className:"grid grid-cols-5 gap-3 items-center text-sm py-1 flex-1 empty:hidden",children:m.map(x=>u.jsxs(q.Fragment,{children:[u.jsx(xf,{declaredBy:x.declaredBy,name:x.name}),u.jsxs("div",{className:"truncate col-span-2",title:x.value??"",children:[x.value,u.jsxs("span",{className:"ml-1 truncate text-foreground/60 font-mono",children:["(",x.dataType,")"]})]}),u.jsx("div",{className:"truncate col-span-2 gap-1 items-center",children:u.jsx(Sw,{skipScroll:!0,onClick:()=>s(g==="in"?x.declaredBy[0]:x.usedBy[0],x.name),maxCount:3,cellIds:x.usedBy})})]},x.name))})]});return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[u.jsx(Kl,{className:"w-5 h-5"}),u.jsx(Mo,{cellId:n.id}),u.jsx("div",{className:"flex-1"}),u.jsx(Nx,{cellId:n.id,children:u.jsx(ve,{variant:"ghost",size:"icon",children:u.jsx(ed,{className:"w-4 h-4"})})}),u.jsx(ve,{variant:"text",size:"icon",onClick:()=>{r()},children:u.jsx(wn,{className:"w-4 h-4"})})]}),u.jsxs("div",{className:"text-sm flex flex-col py-3 pl-2 pr-4 flex-1 justify-center",children:[u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[u.jsx(gp,{className:"w-4 h-4"}),"Outputs"]}),f(h,"out")]}),u.jsx("hr",{className:"border-divider my-3"}),u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[u.jsx(nn,{className:"w-4 h-4"}),"Inputs"]}),f(d,"in")]})]})]})}if(n.type==="edge"){const d=Object.values(o).filter(h=>h.declaredBy.includes(n.source)&&h.usedBy.includes(n.target));return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[u.jsx(ma,{className:"w-4 h-4"}),u.jsx(Mo,{cellId:n.source}),u.jsx(Kc,{className:"w-4 h-4"}),u.jsx(Mo,{cellId:n.target})]}),u.jsx("div",{className:"grid grid-cols-4 gap-3 max-w-[350px] items-center text-sm p-3 flex-1",children:d.map(h=>u.jsxs(q.Fragment,{children:[u.jsx(xf,{declaredBy:h.declaredBy,name:h.name,onClick:()=>{s(h.declaredBy[0],h.name)}}),u.jsx("div",{className:"truncate text-foreground/60 font-mono",children:h.dataType}),u.jsx("div",{className:"truncate col-span-2",title:h.value??"",children:h.value})]},h.name))})]})}},e[0]=r,e[1]=n.id,e[2]=n.source,e[3]=n.target,e[4]=n.type,e[5]=o,e[6]=i):i=e[6];const a=i;let l,c;return e[7]!==a?(l=a(),e[7]=a,e[8]=l):l=e[8],e[9]!==l?(c=u.jsx(Pl,{position:"bottom-left",className:"max-h-[90%] flex flex-col w-[calc(100%-5rem)]",children:u.jsx("div",{className:"min-h-[100px] shadow-md rounded-md border max-w-[550px] border-primary/40 my-4 min-w-[240px] bg-(--slate-1) text-muted-foreground/80 flex flex-col overflow-y-auto",children:l})}),e[9]=l,e[10]=c):c=e[10],c});function e7(t,e){const n=Ri(t);n&&np(n,e)}function Nw(){const t=H.c(7),e=Ni(),n=dt(n7),o=dt(t7);let r;t[0]!==e?(r=()=>{e.fitView({duration:100})},t[0]=e,t[1]=r):r=t[1];const s=fL(r,100);let i,a;t[2]!==s||t[3]!==o||t[4]!==n?(i=()=>{n&&o&&s()},a=[n,o,s],t[2]=s,t[3]=o,t[4]=n,t[5]=i,t[6]=a):(i=t[5],a=t[6]),M.useEffect(i,a)}function t7(t){const{height:e}=t;return e}function n7(t){const{width:e}=t;return e}Wl.displayName="GraphSelectionPanel";const Ew=new class{createEdge(t,e,n){return{type:"smoothstep",pathOptions:{offset:20,borderRadius:100},data:{direction:n},markerEnd:{type:Jr.Arrow},id:`${t}-${e}-${n}`,source:t,sourceHandle:n,targetHandle:n,target:e}}createNode(t,e,n){return{id:t,data:{atom:e},width:250,type:"custom",height:gf(Qe.get(e).code.trim().split(`
|
|
158
|
+
"""`}:{language:"python",code:T}}(o,l);o==="sql"&&Jn({autoInstantiate:a,createNewCell:s,fromCellId:i}),s({code:S.code,before:!1,cellId:i??"__end__"})},e[3]=a,e[4]=s,e[5]=o,e[6]=i,e[7]=l,e[8]=f):f=e[8];const m=f;let g;e[9]!==l?(g=async()=>{await sn(l)},e[9]=l,e[10]=g):g=e[10];const x=g,p=r==="dark"?"dark":"light",b=o&&Q8.has(o)?o:void 0;let y,v,w,j,C,N;return e[11]!==p||e[12]!==b||e[13]!==l?(y=u.jsx(M.Suspense,{children:u.jsx(ra,{theme:p,language:b,className:"cm border rounded overflow-hidden",extensions:Z8,value:l,onChange:c})}),e[11]=p,e[12]=b,e[13]=l,e[14]=y):y=e[14],e[15]!==x?(v=u.jsx(tT,{size:"xs",variant:"outline",onClick:x,children:"Copy"}),e[15]=x,e[16]=v):v=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(w=u.jsx(Nr,{className:"ml-2 h-4 w-4"}),e[17]=w):w=e[17],e[18]!==m?(j=u.jsxs(ve,{size:"xs",variant:"outline",onClick:m,children:["Add to Notebook",w]}),e[18]=m,e[19]=j):j=e[19],e[20]!==j||e[21]!==v?(C=u.jsxs("div",{className:"flex justify-end mt-2 space-x-2",children:[v,j]}),e[20]=j,e[21]=v,e[22]=C):C=e[22],e[23]!==C||e[24]!==y?(N=u.jsxs("div",{className:"relative",children:[y,C]}),e[23]=C,e[24]=y,e[25]=N):N=e[25],N},tT=t=>{const e=H.c(12);let n,o;e[0]!==t?({onClick:n,...o}=t,e[0]=t,e[1]=n,e[2]=o):(n=e[1],o=e[2]);const[r,s]=M.useState(!1);let i,a,l;e[3]!==r?(i=()=>{r&&setTimeout(()=>s(!1),1e3)},a=[r],e[3]=r,e[4]=i,e[5]=a):(i=e[4],a=e[5]),M.useEffect(i,a),e[6]!==n?(l=h=>{n==null||n(h),s(!0)},e[6]=n,e[7]=l):l=e[7];const c=r?"Copied":"Copy";let d;return e[8]!==o||e[9]!==l||e[10]!==c?(d=u.jsx(ve,{...o,onClick:l,children:c}),e[8]=o,e[9]=l,e[10]=c,e[11]=d):d=e[11],d},nT={code:({children:t,className:e})=>{const n=e==null?void 0:e.replace("language-","");return n&&typeof t=="string"?u.jsxs("div",{children:[u.jsx("div",{className:"text-xs text-muted-foreground pl-1",children:n}),u.jsx(eT,{code:t.trim(),language:n})]}):u.jsx("code",{className:e,children:t})}},Kv=M.memo(t=>{const e=H.c(3),{content:n}=t;let o,r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[J8],e[0]=o):o=e[0],e[1]!==n?(r=u.jsx(YA,{components:nT,remarkPlugins:o,className:"prose dark:prose-invert max-w-none prose-pre:pl-0",children:n}),e[1]=n,e[2]=r):r=e[2],r},(t,e)=>t.content===e.content);Kv.displayName="MemoizedMarkdownBlock";const Lh=M.memo(({content:t})=>{const e=M.useMemo(()=>{return n=t,tL.lexer(n).map(o=>o.raw);var n},[t]);return u.jsx(u.Fragment,{children:e.map((n,o)=>u.jsx(Kv,{content:n},`markdown-block-${o}`))})});Lh.displayName="MarkdownRenderer";const oT=t=>{const e=H.c(13),{reasoning:n,index:o,isStreaming:r}=t,s=o===void 0?0:o,i=r!==void 0&&r,a=i?"reasoning":void 0;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(Xl,{className:"h-3 w-3"}),e[0]=l):l=e[0];const c=i?"Thinking":"View reasoning";let d,h,f,m;return e[1]!==n.length||e[2]!==c?(d=u.jsx(BC,{className:"text-xs text-muted-foreground hover:bg-muted/50 px-2 py-1 h-auto rounded-sm [&[data-state=open]>svg]:rotate-180",children:u.jsxs("span",{className:"flex items-center gap-2",children:[l,c," (",n.length," ","chars)"]})}),e[1]=n.length,e[2]=c,e[3]=d):d=e[3],e[4]!==n?(h=u.jsx(UC,{className:"pb-2 px-2",children:u.jsx("div",{className:"bg-muted/30 border border-muted/50 rounded-md p-3 italic text-muted-foreground/90 relative",children:u.jsx("div",{className:"pr-6",children:u.jsx(Lh,{content:n})})})}),e[4]=n,e[5]=h):h=e[5],e[6]!==d||e[7]!==h?(f=u.jsxs($C,{value:"reasoning",className:"border-0",children:[d,h]}),e[6]=d,e[7]=h,e[8]=f):f=e[8],e[9]!==s||e[10]!==a||e[11]!==f?(m=u.jsx(VC,{type:"single",collapsible:!0,className:"w-full mb-2",value:a,children:f},s),e[9]=s,e[10]=a,e[11]=f,e[12]=m):m=e[12],m},rT=t=>{const e=H.c(32),{toolName:n,result:o,error:r,index:s,state:i}=t,a=s===void 0?0:s,l=i==="result"&&(o||r),c=r?"error":l?"success":"loading";let d;e[0]!==c?(d=()=>{switch(c){case"loading":return u.jsx(Fc,{className:"h-3 w-3 animate-spin"});case"error":return u.jsx(Di,{className:"h-3 w-3 text-destructive"});case"success":return u.jsx(SF,{className:"h-3 w-3 text-green-600"});default:return u.jsx(nL,{className:"h-3 w-3"})}},e[0]=c,e[1]=d):d=e[1];const h=d;let f;e[2]!==r||e[3]!==l||e[4]!==c?(f=()=>c==="loading"?"Running: ":r?"Failed: ":l?"Done: ":"Tool call",e[2]=r,e[3]=l,e[4]=c,e[5]=f):f=e[5];const m=f,g=`tool-${a}`,x=c==="error"&&"text-destructive/80",p=c==="success"&&"text-green-600/80";let b,y;e[6]!==x||e[7]!==p?(b=xe("h-6 text-xs border-border shadow-none! ring-0! bg-muted hover:bg-muted/30 py-0 px-2 gap-1 rounded-sm [&[data-state=open]>svg]:rotate-180",x,p),e[6]=x,e[7]=p,e[8]=b):b=e[8],e[9]!==h?(y=h(),e[9]=h,e[10]=y):y=e[10];const v=m();let w,j,C,N,S,E,T;return e[11]!==n?(w=u.jsx("code",{className:"font-mono text-xs",children:n}),e[11]=n,e[12]=w):w=e[12],e[13]!==w||e[14]!==y||e[15]!==v?(j=u.jsxs("span",{className:"flex items-center gap-1",children:[y,v,":"," ",w]}),e[13]=w,e[14]=y,e[15]=v,e[16]=j):j=e[16],e[17]!==j||e[18]!==b?(C=u.jsx(BC,{className:b,children:j}),e[17]=j,e[18]=b,e[19]=C):C=e[19],e[20]!==r||e[21]!==l||e[22]!==o?(N=l&&u.jsxs("div",{className:"space-y-3",children:[o&&u.jsxs("div",{children:[u.jsx("div",{className:"text-xs font-medium text-muted-foreground mt-2 mb-1",children:"Result:"}),u.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:typeof o=="string"?o:JSON.stringify(o,null,2)})]}),r&&u.jsxs("div",{children:[u.jsx("div",{className:"text-xs font-medium text-destructive mb-1",children:"Error:"}),u.jsx("div",{className:"bg-destructive/10 border border-destructive/20 rounded-md p-3 text-sm text-destructive",children:r})]})]}),e[20]=r,e[21]=l,e[22]=o,e[23]=N):N=e[23],e[24]!==N?(S=u.jsx(UC,{className:"pb-2 px-2",children:N}),e[24]=N,e[25]=S):S=e[25],e[26]!==C||e[27]!==S?(E=u.jsxs($C,{value:"tool-call",className:"border-0",children:[C,S]}),e[26]=C,e[27]=S,e[28]=E):E=e[28],e[29]!==E||e[30]!==g?(T=u.jsx(VC,{type:"single",collapsible:!0,className:"w-full my-4",children:E},g),e[29]=E,e[30]=g,e[31]=T):T=e[31],T},sT=t=>{const e=H.c(27),{onNewChat:n,activeChatId:o,setActiveChat:r,chats:s}=t,{handleClick:i}=ia();let a,l,c,d,h,f,m,g,x,p,b;if(e[0]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(Jo,{className:"h-4 w-4"}),e[0]=a):a=e[0],e[1]!==n?(l=u.jsx(Ee,{content:"New chat",children:u.jsx(ve,{variant:"text",size:"icon",onClick:n,children:a})}),e[1]=n,e[2]=l):l=e[2],e[3]!==i?(c=()=>i("ai"),e[3]=i,e[4]=c):c=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(_m,{className:"h-4 w-4"}),e[5]=d):d=e[5],e[6]!==c?(h=u.jsx(Ee,{content:"AI Settings",children:u.jsx(ve,{variant:"text",size:"xs",className:"hover:bg-foreground/10 py-2",onClick:c,children:d})}),e[6]=c,e[7]=h):h=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(Ee,{content:"Previous chats",children:u.jsx(ws,{asChild:!0,children:u.jsx(ve,{variant:"text",size:"icon",children:u.jsx(lL,{className:"h-4 w-4"})})})}),e[8]=f):f=e[8],e[9]!==s.length?(m=s.length===0&&u.jsx(dn,{title:"No chats yet",description:"Start a new chat to get started",icon:u.jsx(Xl,{})}),e[9]=s.length,e[10]=m):m=e[10],e[11]!==o||e[12]!==s||e[13]!==r){let y;e[15]!==o||e[16]!==r?(y=v=>u.jsxs("button",{className:xe("w-full p-3 rounded-md cursor-pointer hover:bg-accent text-left",v.id===o&&"bg-accent"),onClick:()=>{r(v.id)},type:"button",children:[u.jsx("div",{className:"font-medium",children:v.title}),u.jsx("div",{className:"text-sm text-muted-foreground",children:cL(v.updatedAt)})]},v.id),e[15]=o,e[16]=r,e[17]=y):y=e[17],g=s.map(y),e[11]=o,e[12]=s,e[13]=r,e[14]=g}else g=e[14];return e[18]!==m||e[19]!==g?(x=u.jsxs(br,{children:[f,u.jsx(ps,{className:"w-[520px] p-0",align:"start",side:"right",children:u.jsx(iy,{className:"h-[500px] p-4",children:u.jsxs("div",{className:"space-y-4",children:[m,g]})})})]}),e[18]=m,e[19]=g,e[20]=x):x=e[20],e[21]!==h||e[22]!==x?(p=u.jsxs("div",{className:"flex items-center gap-2",children:[h,x]}),e[21]=h,e[22]=x,e[23]=p):p=e[23],e[24]!==p||e[25]!==l?(b=u.jsxs("div",{className:"flex border-b px-2 py-1 justify-between shrink-0 items-center",children:[l,p]}),e[24]=p,e[25]=l,e[26]=b):b=e[26],b},Xv=M.memo(t=>{var h;const e=H.c(14),{message:n,index:o,onEdit:r,isStreamingReasoning:s,totalMessages:i}=t,a=n.role==="user"?"justify-end":"justify-start";let l,c,d;return e[0]!==a?(l=xe("flex group relative",a),e[0]=a,e[1]=l):l=e[1],e[2]!==o||e[3]!==s||e[4]!==n.content||e[5]!==n.id||e[6]!==n.parts||e[7]!==n.role||e[8]!==r||e[9]!==i?(c=n.role==="user"?u.jsx("div",{className:"w-[95%] bg-background border p-1 rounded-sm",children:u.jsx(Lc,{value:n.content,placeholder:"Type your message...",onChange:lT,onSubmit:(f,m)=>{m.trim()&&r(o,m)},onClose:cT},n.id)}):u.jsxs("div",{className:"w-[95%] break-words",children:[u.jsx("div",{className:"absolute right-1 top-1 opacity-0 group-hover:opacity-100 transition-opacity",children:u.jsx(HC,{className:"h-3 w-3",value:n.content})}),(h=n.parts)==null?void 0:h.map((f,m)=>{var g;switch(f.type){case"text":return u.jsx(Lh,{content:f.text},m);case"reasoning":return u.jsx(oT,{reasoning:f.reasoning,index:m,isStreaming:o===i-1&&s&&m===(((g=n.parts)==null?void 0:g.length)||0)-1},m);case"tool-invocation":return u.jsx(rT,{index:m,toolName:f.toolInvocation.toolName,result:f.toolInvocation.state==="result"?f.toolInvocation.result:null,state:f.toolInvocation.state},m);default:return null}})]}),e[2]=o,e[3]=s,e[4]=n.content,e[5]=n.id,e[6]=n.parts,e[7]=n.role,e[8]=r,e[9]=i,e[10]=c):c=e[10],e[11]!==l||e[12]!==c?(d=u.jsx("div",{className:l,children:c}),e[11]=l,e[12]=c,e[13]=d):d=e[13],d});Xv.displayName="ChatMessage";const Fh=M.memo(t=>{var S;const e=H.c(25),{input:n,onSendClick:o,isLoading:r,onStop:s}=t,i=Ne(PC),a=(i==null?void 0:i.mode)||"manual",l=((S=i==null?void 0:i.models)==null?void 0:S.chat_model)||LC,{saveModeChange:c,saveModelChange:d}=oL();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=[{value:"ask",label:"Ask",subtitle:"Use AI with access to read-only tools like documentation search"},{value:"manual",label:"Manual",subtitle:"Pure chat, no tool usage"}],e[0]=h):h=e[0];const f=h;let m,g,x,p,b,y;e[1]!==a?(m=u.jsx(cc,{className:"h-6 text-xs border-border shadow-none! ring-0! bg-muted hover:bg-muted/30 py-0 px-2 gap-1 capitalize",children:a}),e[1]=a,e[2]=m):m=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx(dc,{children:u.jsxs(Cm,{children:[u.jsx(F3,{children:"AI Mode"}),f.map(dT)]})}),e[3]=g):g=e[3],e[4]!==a||e[5]!==c||e[6]!==m?(x=u.jsx(rL,{feature:"mcp_docs",children:u.jsxs(lc,{value:a,onValueChange:c,children:[m,g]})}),e[4]=a,e[5]=c,e[6]=m,e[7]=x):x=e[7],e[8]!==d?(p=E=>d(E,"chat"),e[8]=d,e[9]=p):p=e[9],e[10]!==l||e[11]!==p?(b=u.jsx(sL,{value:l,placeholder:"Model",onSelect:p,triggerClassName:"h-6 text-xs shadow-none! ring-0! bg-muted hover:bg-muted/30 rounded-sm",iconSize:"small",showAddCustomModelDocs:!0,forRole:"chat"}),e[10]=l,e[11]=p,e[12]=b):b=e[12],e[13]!==x||e[14]!==b?(y=u.jsxs("div",{className:"flex items-center gap-2",children:[x,b]}),e[13]=x,e[14]=b,e[15]=y):y=e[15];const v=r?s:o,w=!r&&!n.trim();let j,C,N;return e[16]!==r?(j=r?u.jsx(fc,{className:"h-3 w-3 fill-current"}):u.jsx(iL,{className:"h-3 w-3"}),e[16]=r,e[17]=j):j=e[17],e[18]!==j||e[19]!==v||e[20]!==w?(C=u.jsx(ve,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-muted/30",onClick:v,disabled:w,children:j}),e[18]=j,e[19]=v,e[20]=w,e[21]=C):C=e[21],e[22]!==C||e[23]!==y?(N=u.jsxs("div",{className:"px-3 py-2 border-t border-border/20 flex items-center justify-between",children:[y,C]}),e[22]=C,e[23]=y,e[24]=N):N=e[24],N});Fh.displayName="ChatInputFooter";const Jv=M.memo(t=>{var g,x;const e=H.c(18),{input:n,setInput:o,onSubmit:r,inputRef:s,isLoading:i,onStop:a}=t;let l;e[0]!==n||e[1]!==r?(l=()=>{n.trim()&&r(void 0,n)},e[0]=n,e[1]=r,e[2]=l):l=e[2];const c=l;let d,h,f,m;return e[3]!==((g=s.current)==null?void 0:g.editor)?(d=()=>{var p,b;return(b=(p=s.current)==null?void 0:p.editor)==null?void 0:b.blur()},e[3]=(x=s.current)==null?void 0:x.editor,e[4]=d):d=e[4],e[5]!==n||e[6]!==r||e[7]!==o||e[8]!==d?(h=u.jsx("div",{className:"px-2 py-3 flex-1",children:u.jsx(Lc,{value:n,onChange:o,onSubmit:r,onClose:d,placeholder:"Type your message..."})}),e[5]=n,e[6]=r,e[7]=o,e[8]=d,e[9]=h):h=e[9],e[10]!==c||e[11]!==n||e[12]!==i||e[13]!==a?(f=u.jsx(Fh,{input:n,onSendClick:c,isLoading:i,onStop:a}),e[10]=c,e[11]=n,e[12]=i,e[13]=a,e[14]=f):f=e[14],e[15]!==h||e[16]!==f?(m=u.jsxs("div",{className:"border-t relative shrink-0 min-h-[80px] flex flex-col",children:[h,f]}),e[15]=h,e[16]=f,e[17]=m):m=e[17],m});Jv.displayName="ChatInput";const iT=()=>{const t=H.c(6),e=Ne(Ql),{handleClick:n}=ia();if(!e){let r,s,i;return t[0]!==n?(r=u.jsx(ve,{variant:"outline",size:"sm",onClick:()=>n("ai"),children:"Edit AI settings"}),t[0]=n,t[1]=r):r=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx(Xl,{}),t[2]=s):s=t[2],t[3]!==r?(i=u.jsx(dn,{title:"Chat with AI",description:"AI is currently disabled. Add your API key to enable.",action:r,icon:s}),t[3]=r,t[4]=i):i=t[4],i}let o;return t[5]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(aT,{}),t[5]=o):o=t[5],o},aT=()=>{const[t,e]=zt(fd),[n,o]=zt(Wj),[r,s]=M.useState(""),i=M.useRef(null),a=M.useRef(null),l=M.useRef(null),c=M.useRef(null),d=Km(),{invokeAiTool:h}=nt(),{messages:f,input:m,setInput:g,setMessages:x,append:p,handleSubmit:b,error:y,status:v,reload:w,stop:j}=aL({id:n==null?void 0:n.id,maxSteps:10,initialMessages:(n==null?void 0:n.messages)||[],keepLastMessageOnError:!0,api:d.getAiURL("chat").toString(),headers:d.headers(),experimental_prepareRequestBody:T=>({...T,...bC({input:T.messages.map(I=>I.content).join(`
|
|
159
|
+
`)}),includeOtherCode:Tc("")}),onFinish:T=>{e(I=>Ku(I,I.activeChatId,T.id,"assistant",T.content,T.parts))},onToolCall:async({toolCall:T})=>{try{const I=await h({toolName:T.toolName,arguments:T.args});return I.result||I.error}catch(I){return ut.error("Tool call failed:",I),`Error: ${I instanceof Error?I.message:String(I)}`}},onError:T=>{ut.error("An error occurred:",T)},onResponse:T=>{ut.debug("Received HTTP response from server:",T)}}),C=v==="submitted"||v==="streaming";M.useEffect(()=>{if(!t.activeChatId||f.length===0)return;const T=f[f.length-1];if((T==null?void 0:T.role)!=="user")return;const I=t.chats.find(O=>O.id===t.activeChatId);if(!I)return;const D=new Set(I.messages.map(O=>O.id)),F=f.filter(O=>O.role==="user"&&!D.has(O.id));F.length>0&&e(O=>{let R=O;for(const P of F)R=Ku(R,O.activeChatId,P.id,"user",P.content);return R})},[f,t.activeChatId,t.chats,e]);const N=C&&f.length>0&&(T=>{if(T.length===0)return!1;const I=T.at(-1);if(!I||I.role!=="assistant"||!I.parts)return!1;const D=I.parts;return D.length===0?!1:D[D.length-1].type==="reasoning"})(f);M.useEffect(()=>{requestAnimationFrame(()=>{if(l.current){const T=l.current;T.scrollTop=T.scrollHeight}})},[t.activeChatId]);const S=(T,I)=>{x(D=>D.slice(0,T)),t.activeChatId&&e(D=>({...D,chats:D.chats.map(F=>F.id===t.activeChatId?{...F,messages:F.messages.slice(0,T),updatedAt:Date.now()}:F)})),p({role:"user",content:I})},E=()=>{r.trim()&&(T=>{const I=Date.now(),D={id:WC(),title:T.length>50?`${T.slice(0,50)}...`:T,messages:[],createdAt:I,updatedAt:I};e(O=>({...O,chats:[...O.chats,D],activeChatId:D.id}));const F=WC();p({id:F,role:"user",content:T}),g("")})(r.trim())};return u.jsxs("div",{className:"flex flex-col h-[calc(100%-53px)]",children:[u.jsx(Xm,{children:u.jsx(sT,{onNewChat:()=>{o(null),g(""),s("")},activeChatId:n==null?void 0:n.id,setActiveChat:o,chats:[...t.chats].sort((T,I)=>I.updatedAt-T.updatedAt)})}),u.jsxs("div",{className:"flex-1 px-3 bg-(--slate-1) gap-4 py-3 flex flex-col overflow-y-auto",ref:l,children:[(!f||f.length===0)&&u.jsxs("div",{className:"flex flex-col rounded-md border bg-background",children:[u.jsx("div",{className:"px-1",children:u.jsx(Lc,{value:r,placeholder:"Ask anything, @ to include context about tables or dataframes",onClose:()=>{var T,I;return(I=(T=i.current)==null?void 0:T.editor)==null?void 0:I.blur()},onChange:s,onSubmit:E},"new-thread-input")}),u.jsx(Fh,{input:r,onSendClick:E,isLoading:C,onStop:j})]}),f.map((T,I)=>u.jsx(Xv,{message:T,index:I,onEdit:S,setChatState:e,chatState:t,isStreamingReasoning:N,totalMessages:f.length},I)),C&&u.jsx("div",{className:"flex justify-center py-4",children:u.jsx(Fc,{className:"h-4 w-4 animate-spin"})}),y&&u.jsxs("div",{className:"flex items-center justify-center space-x-2 mb-4",children:[u.jsx(kr,{error:y}),u.jsx(ve,{variant:"outline",size:"sm",onClick:()=>{w()},children:"Retry"})]}),u.jsx("div",{ref:c})]}),C&&u.jsx("div",{className:"w-full flex justify-center items-center z-20 border-t",children:u.jsx(ve,{variant:"linkDestructive",size:"sm",onClick:j,children:"Stop"})}),f&&f.length>0&&u.jsx(Jv,{input:m,setInput:g,onSubmit:(T,I)=>{I.trim()&&b(T)},inputRef:a,isLoading:C,onStop:j})]})};function lT(){}function cT(){}function dT(t){return u.jsx(uc,{value:t.value,className:"text-xs",children:u.jsxs("div",{className:"flex flex-col",children:[t.label,u.jsx("div",{className:"text-muted-foreground text-xs pt-1 block",children:t.subtitle})]})},t.value)}function Qt(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n,o=0;o<t.length;o++)(n=Qt(t[o]))!==""&&(e+=(e&&" ")+n);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}const{useDebugValue:uT}=q,{useSyncExternalStoreWithSelector:hT}=dL,fT=t=>t;function Zv(t,e=fT,n){const o=hT(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return uT(o),o}const Qv=(t,e)=>{const n=uL(t),o=(r,s=e)=>Zv(n,r,s);return Object.assign(o,n),o};function Wt(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[o,r]of t)if(!Object.is(r,e.get(o)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||!Object.is(t[o],e[o]))return!1;return!0}function Kn(t,e){if(t=function(s){let i;for(;i=s.sourceEvent;)s=i;return s}(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,[(o=o.matrixTransform(e.getScreenCTM().inverse())).x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}const mT={passive:!1},yi={capture:!0,passive:!1};function zh(t){t.stopImmediatePropagation()}function Kr(t){t.preventDefault(),t.stopImmediatePropagation()}function e2(t){var e=t.document.documentElement,n=Vn(t).on("dragstart.drag",Kr,yi);"onselectstart"in e?n.on("selectstart.drag",Kr,yi):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function t2(t,e){var n=t.document.documentElement,o=Vn(t).on("dragstart.drag",null);e&&(o.on("click.drag",Kr,yi),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Ol=t=>()=>t;function Bh(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}function pT(t){return!t.ctrlKey&&!t.button}function gT(){return this.parentNode}function xT(t,e){return e??{x:t.x,y:t.y}}function bT(){return navigator.maxTouchPoints||"ontouchstart"in this}Bh.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};const Dl=t=>()=>t;function yT(t,{sourceEvent:e,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Uh(t){t.stopImmediatePropagation()}function vi(t){t.preventDefault(),t.stopImmediatePropagation()}function vT(t){return!(t.ctrlKey&&t.type!=="wheel"||t.button)}function wT(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function n2(){return this.__zoom||Qo}function kT(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function CT(){return navigator.maxTouchPoints||"ontouchstart"in this}function jT(t,e,n){var o=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],s=t.invertY(e[0][1])-n[0][1],i=t.invertY(e[1][1])-n[1][1];return t.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}const Rl=M.createContext(null),ST=Rl.Provider,NT=t=>`Node type "${t}" not found. Using fallback type "default".`,ET=()=>"The React Flow parent container needs a width and a height to render the graph.",_T=()=>"Only child nodes can use a parent extent.",IT=t=>`Marker type "${t}" doesn't exist.`,AT=(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,TT=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",MT=t=>`Edge type "${t}" not found. Using fallback type "default".`,OT=t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,o2="[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001";function dt(t,e){const n=M.useContext(Rl);if(n===null)throw new Error(o2);return Zv(n,t,e)}const Ft=()=>{const t=M.useContext(Rl);if(t===null)throw new Error(o2);return M.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},DT=t=>t.userSelectionActive?"none":"all";function Pl({position:t,children:e,className:n,style:o,...r}){const s=dt(DT),i=`${t}`.split("-");return q.createElement("div",{className:Qt(["react-flow__panel",n,...i]),style:{...o,pointerEvents:s},...r},e)}function RT({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:q.createElement(Pl,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},q.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var PT=M.memo(({x:t,y:e,label:n,labelStyle:o={},labelShowBg:r=!0,labelBgStyle:s={},labelBgPadding:i=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...d})=>{const h=M.useRef(null),[f,m]=M.useState({x:0,y:0,width:0,height:0}),g=Qt(["react-flow__edge-textwrapper",c]);return M.useEffect(()=>{if(h.current){const x=h.current.getBBox();m({x:x.x,y:x.y,width:x.width,height:x.height})}},[n]),n!==void 0&&n?q.createElement("g",{transform:`translate(${t-f.width/2} ${e-f.height/2})`,className:g,visibility:f.width?"visible":"hidden",...d},r&&q.createElement("rect",{width:f.width+2*i[0],x:-i[0],y:-i[1],height:f.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:a,ry:a}),q.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:h,style:o},n),l):null});const $h=t=>({width:t.offsetWidth,height:t.offsetHeight}),Xr=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Vh=(t={x:0,y:0},e)=>({x:Xr(t.x,e[0][0],e[1][0]),y:Xr(t.y,e[0][1],e[1][1])}),r2=(t,e,n)=>t<e?Xr(Math.abs(t-e),1,50)/50:t>n?-Xr(Math.abs(t-n),1,50)/50:0,s2=(t,e)=>[20*r2(t.x,35,e.width-35),20*r2(t.y,35,e.height-35)],i2=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},Hh=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),a2=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),Wh=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),o=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*o)},Nn=t=>!isNaN(t)&&isFinite(t),yt=Symbol.for("internals"),l2=["Enter"," ","Escape"];function qh(t){var o,r;const e=(s=>"nativeEvent"in s)(t)?t.nativeEvent:t,n=((r=(o=e.composedPath)==null?void 0:o.call(e))==null?void 0:r[0])||t.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const c2=t=>"clientX"in t,zo=(t,e)=>{var s,i;const n=c2(t),o=n?t.clientX:(s=t.touches)==null?void 0:s[0].clientX,r=n?t.clientY:(i=t.touches)==null?void 0:i[0].clientY;return{x:o-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},Ll=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0},wi=({id:t,path:e,labelX:n,labelY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:f,interactionWidth:m=20})=>q.createElement(q.Fragment,null,q.createElement("path",{id:t,style:d,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:h,markerStart:f}),m&&q.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:m,className:"react-flow__edge-interaction"}),r&&Nn(n)&&Nn(o)?q.createElement(PT,{x:n,y:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null);function ki(t,e,n){return n===void 0?n:o=>{const r=e().edges.find(s=>s.id===t);r&&n(o,{...r})}}function d2({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,s=n<t?n+r:n-r,i=Math.abs(o-e)/2;return[s,o<e?o+i:o-i,r,i]}function u2({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const l=.125*t+.375*r+.375*i+.125*n,c=.125*e+.375*s+.375*a+.125*o;return[l,c,Math.abs(l-t),Math.abs(c-e)]}var hr,h2,Bo,Gh,Ci,f2,Uo,ji,Jr,m2,Oe,Fl;function p2({pos:t,x1:e,y1:n,x2:o,y2:r}){return t===Oe.Left||t===Oe.Right?[.5*(e+o),n]:[e,.5*(n+r)]}function g2({sourceX:t,sourceY:e,sourcePosition:n=Oe.Bottom,targetX:o,targetY:r,targetPosition:s=Oe.Top}){const[i,a]=p2({pos:n,x1:t,y1:e,x2:o,y2:r}),[l,c]=p2({pos:s,x1:o,y1:r,x2:t,y2:e}),[d,h,f,m]=u2({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${t},${e} C${i},${a} ${l},${c} ${o},${r}`,d,h,f,m]}wi.displayName="BaseEdge",(h2=hr||(hr={})).Strict="strict",h2.Loose="loose",(Gh=Bo||(Bo={})).Free="free",Gh.Vertical="vertical",Gh.Horizontal="horizontal",(f2=Ci||(Ci={})).Partial="partial",f2.Full="full",(ji=Uo||(Uo={})).Bezier="default",ji.Straight="straight",ji.Step="step",ji.SmoothStep="smoothstep",ji.SimpleBezier="simplebezier",(m2=Jr||(Jr={})).Arrow="arrow",m2.ArrowClosed="arrowclosed",(Fl=Oe||(Oe={})).Left="left",Fl.Top="top",Fl.Right="right",Fl.Bottom="bottom";const Yh=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Oe.Bottom,targetPosition:s=Oe.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x})=>{const[p,b,y]=g2({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s});return q.createElement(wi,{path:p,labelX:b,labelY:y,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x})});Yh.displayName="SimpleBezierEdge";const x2={[Oe.Left]:{x:-1,y:0},[Oe.Right]:{x:1,y:0},[Oe.Top]:{x:0,y:-1},[Oe.Bottom]:{x:0,y:1}},b2=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function LT({source:t,sourcePosition:e=Oe.Bottom,target:n,targetPosition:o=Oe.Top,center:r,offset:s}){const i=x2[e],a=x2[o],l={x:t.x+i.x*s,y:t.y+i.y*s},c={x:n.x+a.x*s,y:n.y+a.y*s},d=(({source:C,sourcePosition:N=Oe.Bottom,target:S})=>N===Oe.Left||N===Oe.Right?C.x<S.x?{x:1,y:0}:{x:-1,y:0}:C.y<S.y?{x:0,y:1}:{x:0,y:-1})({source:l,sourcePosition:e,target:c}),h=d.x!==0?"x":"y",f=d[h];let m,g,x=[];const p={x:0,y:0},b={x:0,y:0},[y,v,w,j]=d2({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(i[h]*a[h]===-1){m=r.x??y,g=r.y??v;const C=[{x:m,y:l.y},{x:m,y:c.y}],N=[{x:l.x,y:g},{x:c.x,y:g}];x=i[h]===f?h==="x"?C:N:h==="x"?N:C}else{const C=[{x:l.x,y:c.y}],N=[{x:c.x,y:l.y}];if(x=h==="x"?i.x===f?N:C:i.y===f?C:N,e===o){const T=Math.abs(t[h]-n[h]);if(T<=s){const I=Math.min(s-1,s-T);i[h]===f?p[h]=(l[h]>t[h]?-1:1)*I:b[h]=(c[h]>n[h]?-1:1)*I}}if(e!==o){const T=h==="x"?"y":"x",I=i[h]===a[T],D=l[T]>c[T],F=l[T]<c[T];(i[h]===1&&(!I&&D||I&&F)||i[h]!==1&&(!I&&F||I&&D))&&(x=h==="x"?C:N)}const S={x:l.x+p.x,y:l.y+p.y},E={x:c.x+b.x,y:c.y+b.y};Math.max(Math.abs(S.x-x[0].x),Math.abs(E.x-x[0].x))>=Math.max(Math.abs(S.y-x[0].y),Math.abs(E.y-x[0].y))?(m=(S.x+E.x)/2,g=x[0].y):(m=x[0].x,g=(S.y+E.y)/2)}return[[t,{x:l.x+p.x,y:l.y+p.y},...x,{x:c.x+b.x,y:c.y+b.y},n],m,g,w,j]}function Kh({sourceX:t,sourceY:e,sourcePosition:n=Oe.Bottom,targetX:o,targetY:r,targetPosition:s=Oe.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20}){const[d,h,f,m,g]=LT({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:c});return[d.reduce((x,p,b)=>{let y="";return y=b>0&&b<d.length-1?function(v,w,j,C){const N=Math.min(b2(v,w)/2,b2(w,j)/2,C),{x:S,y:E}=w;if(v.x===S&&S===j.x||v.y===E&&E===j.y)return`L${S} ${E}`;if(v.y===E)return`L ${S+N*(v.x<j.x?-1:1)},${E}Q ${S},${E} ${S},${E+N*(v.y<j.y?1:-1)}`;const T=v.x<j.x?1:-1;return`L ${S},${E+N*(v.y<j.y?-1:1)}Q ${S},${E} ${S+N*T},${E}`}(d[b-1],p,d[b+1],i):`${b===0?"M":"L"}${p.x} ${p.y}`,x+=y},""),h,f,m,g]}const zl=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,sourcePosition:h=Oe.Bottom,targetPosition:f=Oe.Top,markerEnd:m,markerStart:g,pathOptions:x,interactionWidth:p})=>{const[b,y,v]=Kh({sourceX:t,sourceY:e,sourcePosition:h,targetX:n,targetY:o,targetPosition:f,borderRadius:x==null?void 0:x.borderRadius,offset:x==null?void 0:x.offset});return q.createElement(wi,{path:b,labelX:y,labelY:v,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:m,markerStart:g,interactionWidth:p})});zl.displayName="SmoothStepEdge";const Xh=M.memo(t=>{var e;return q.createElement(zl,{...t,pathOptions:M.useMemo(()=>{var n;return{borderRadius:0,offset:(n=t.pathOptions)==null?void 0:n.offset}},[(e=t.pathOptions)==null?void 0:e.offset])})});Xh.displayName="StepEdge";const Jh=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:f,interactionWidth:m})=>{const[g,x,p]=function({sourceX:b,sourceY:y,targetX:v,targetY:w}){const[j,C,N,S]=d2({sourceX:b,sourceY:y,targetX:v,targetY:w});return[`M ${b},${y}L ${v},${w}`,j,C,N,S]}({sourceX:t,sourceY:e,targetX:n,targetY:o});return q.createElement(wi,{path:g,labelX:x,labelY:p,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:f,interactionWidth:m})});function Bl(t,e){return t>=0?.5*t:25*e*Math.sqrt(-t)}function y2({pos:t,x1:e,y1:n,x2:o,y2:r,c:s}){switch(t){case Oe.Left:return[e-Bl(e-o,s),n];case Oe.Right:return[e+Bl(o-e,s),n];case Oe.Top:return[e,n-Bl(n-r,s)];case Oe.Bottom:return[e,n+Bl(r-n,s)]}}function v2({sourceX:t,sourceY:e,sourcePosition:n=Oe.Bottom,targetX:o,targetY:r,targetPosition:s=Oe.Top,curvature:i=.25}){const[a,l]=y2({pos:n,x1:t,y1:e,x2:o,y2:r,c:i}),[c,d]=y2({pos:s,x1:o,y1:r,x2:t,y2:e,c:i}),[h,f,m,g]=u2({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${t},${e} C${a},${l} ${c},${d} ${o},${r}`,h,f,m,g]}Jh.displayName="StraightEdge";const Ul=M.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Oe.Bottom,targetPosition:s=Oe.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,pathOptions:x,interactionWidth:p})=>{const[b,y,v]=v2({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s,curvature:x==null?void 0:x.curvature});return q.createElement(wi,{path:b,labelX:y,labelY:v,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:p})});Ul.displayName="BezierEdge";const Zh=M.createContext(null),FT=Zh.Provider;Zh.Consumer;const zT=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`reactflow__edge-${t}${e||""}-${n}${o||""}`,Qh=(t,e)=>t===void 0?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`,ef=({x:t,y:e},[n,o,r],s,[i,a])=>{const l={x:(t-n)/r,y:(e-o)/r};return s?{x:i*Math.round(l.x/i),y:a*Math.round(l.y/a)}:l},w2=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o}),Zr=(t,e=[0,0])=>{if(!t)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(t.width??0)*e[0],o=(t.height??0)*e[1],r={x:t.position.x-n,y:t.position.y-o};return{...r,positionAbsolute:t.positionAbsolute?{x:t.positionAbsolute.x-n,y:t.positionAbsolute.y-o}:r}},tf=(t,e=[0,0])=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((o,r)=>{const{x:s,y:i}=Zr(r,e).positionAbsolute;return a=o,l=Hh({x:s,y:i,width:r.width||0,height:r.height||0}),{x:Math.min(a.x,l.x),y:Math.min(a.y,l.y),x2:Math.max(a.x2,l.x2),y2:Math.max(a.y2,l.y2)};var a,l},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return(({x:o,y:r,x2:s,y2:i})=>({x:o,y:r,width:s-o,height:i-r}))(n)},k2=(t,e,[n,o,r]=[0,0,1],s=!1,i=!1,a=[0,0])=>{const l={x:(e.x-n)/r,y:(e.y-o)/r,width:e.width/r,height:e.height/r},c=[];return t.forEach(d=>{const{width:h,height:f,selectable:m=!0,hidden:g=!1}=d;if(i&&!m||g)return!1;const{positionAbsolute:x}=Zr(d,a),p={x:x.x,y:x.y,width:h||0,height:f||0},b=Wh(l,p);(h===void 0||f===void 0||h===null||f===null||s&&b>0||b>=(h||0)*(f||0)||d.dragging)&&c.push(d)}),c},C2=(t,e)=>{const n=t.map(o=>o.id);return e.filter(o=>n.includes(o.source)||n.includes(o.target))},j2=(t,e,n,o,r,s=.1)=>{const i=e/(t.width*(1+s)),a=n/(t.height*(1+s)),l=Math.min(i,a),c=Xr(l,o,r);return{x:e/2-(t.x+t.width/2)*c,y:n/2-(t.y+t.height/2)*c,zoom:c}},fr=(t,e=0)=>t.transition().duration(e);function S2(t,e,n,o){return(e[n]||[]).reduce((r,s)=>{var i,a;return`${t.id}-${s.id}-${n}`!==o&&r.push({id:s.id||null,type:n,nodeId:t.id,x:(((i=t.positionAbsolute)==null?void 0:i.x)??0)+s.x+s.width/2,y:(((a=t.positionAbsolute)==null?void 0:a.y)??0)+s.y+s.height/2}),r},[])}const BT={source:null,target:null,sourceHandle:null,targetHandle:null},N2=()=>({handleDomNode:null,isValid:!1,connection:BT,endHandle:null});function E2(t,e,n,o,r,s,i){const a=r==="target",l=i.querySelector(`.react-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),c={...N2(),handleDomNode:l};if(l){const d=nf(void 0,l),h=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),m=l.classList.contains("connectable"),g=l.classList.contains("connectableend"),x={source:a?h:n,sourceHandle:a?f:o,target:a?n:h,targetHandle:a?o:f};c.connection=x,m&&g&&(e===hr.Strict?a&&d==="source"||!a&&d==="target":h!==n||f!==o)&&(c.endHandle={nodeId:h,handleId:f,type:d},c.isValid=s(x))}return c}function nf(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function of(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function UT(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function _2({event:t,handleId:e,nodeId:n,onConnect:o,isTarget:r,getState:s,setState:i,isValidConnection:a,edgeUpdaterType:l,onReconnectEnd:c}){const d=i2(t.target),{connectionMode:h,domNode:f,autoPanOnConnect:m,connectionRadius:g,onConnectStart:x,panBy:p,getNodes:b,cancelConnection:y}=s();let v,w=0;const{x:j,y:C}=zo(t),N=d==null?void 0:d.elementFromPoint(j,C),S=nf(l,N),E=f==null?void 0:f.getBoundingClientRect();if(!E||!S)return;let T,I=zo(t,E),D=!1,F=null,O=!1,R=null;const P=function({nodes:B,nodeId:A,handleId:U,handleType:V}){return B.reduce((X,Y)=>{if(Y[yt]){const{handleBounds:G}=Y[yt];let W=[],J=[];G&&(W=S2(Y,G,"source",`${A}-${U}-${V}`),J=S2(Y,G,"target",`${A}-${U}-${V}`)),X.push(...W,...J)}return X},[])}({nodes:b(),nodeId:n,handleId:e,handleType:S}),z=()=>{if(!m)return;const[B,A]=s2(I,E);p({x:B,y:A}),w=requestAnimationFrame(z)};function _(B){const{transform:A}=s();I=zo(B,E);const{handle:U,validHandleResult:V}=function(X,Y,G,W,J,$){const{x:Q,y:te}=zo(X),oe=Y.elementsFromPoint(Q,te).find(fe=>fe.classList.contains("react-flow__handle"));if(oe){const fe=oe.getAttribute("data-nodeid");if(fe){const re=nf(void 0,oe),ue=oe.getAttribute("data-handleid"),le=$({nodeId:fe,id:ue,type:re});if(le){const je=J.find(Se=>Se.nodeId===fe&&Se.type===re&&Se.id===ue);return{handle:{id:ue,type:re,nodeId:fe,x:(je==null?void 0:je.x)||G.x,y:(je==null?void 0:je.y)||G.y},validHandleResult:le}}}}let ne=[],ie=1/0;if(J.forEach(fe=>{const re=Math.sqrt((fe.x-G.x)**2+(fe.y-G.y)**2);if(re<=W){const ue=$(fe);re<=ie&&(re<ie?ne=[{handle:fe,validHandleResult:ue}]:re===ie&&ne.push({handle:fe,validHandleResult:ue}),ie=re)}}),!ne.length)return{handle:null,validHandleResult:N2()};if(ne.length===1)return ne[0];const se=ne.some(({validHandleResult:fe})=>fe.isValid),ae=ne.some(({handle:fe})=>fe.type==="target");return ne.find(({handle:fe,validHandleResult:re})=>ae?fe.type==="target":!se||re.isValid)||ne[0]}(B,d,ef(I,A,!1,[1,1]),g,P,X=>E2(X,h,n,e,r?"target":"source",a,d));if(v=U,D||(z(),D=!0),R=V.handleDomNode,F=V.connection,O=V.isValid,i({connectionPosition:v&&O?w2({x:v.x,y:v.y},A):I,connectionStatus:UT(!!v,O),connectionEndHandle:V.endHandle}),!v&&!O&&!R)return of(T);F.source!==F.target&&R&&(of(T),T=R,R.classList.add("connecting","react-flow__handle-connecting"),R.classList.toggle("valid",O),R.classList.toggle("react-flow__handle-valid",O))}function k(B){var A,U;(v||R)&&F&&O&&(o==null||o(F)),(U=(A=s()).onConnectEnd)==null||U.call(A,B),l&&(c==null||c(B)),of(T),y(),cancelAnimationFrame(w),D=!1,O=!1,F=null,R=null,d.removeEventListener("mousemove",_),d.removeEventListener("mouseup",k),d.removeEventListener("touchmove",_),d.removeEventListener("touchend",k)}i({connectionPosition:I,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:S,connectionStartHandle:{nodeId:n,handleId:e,type:S},connectionEndHandle:null}),x==null||x(t,{nodeId:n,handleId:e,handleType:S}),d.addEventListener("mousemove",_),d.addEventListener("mouseup",k),d.addEventListener("touchmove",_),d.addEventListener("touchend",k)}const I2=()=>!0,$T=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),A2=M.forwardRef(({type:t="source",position:e=Oe.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:i,onConnect:a,children:l,className:c,onMouseDown:d,onTouchStart:h,...f},m)=>{var S,E;const g=i||null,x=t==="target",p=Ft(),b=M.useContext(Zh),{connectOnClick:y,noPanClassName:v}=dt($T,Wt),{connecting:w,clickConnecting:j}=dt(((T,I,D)=>F=>{const{connectionStartHandle:O,connectionEndHandle:R,connectionClickStartHandle:P}=F;return{connecting:(O==null?void 0:O.nodeId)===T&&(O==null?void 0:O.handleId)===I&&(O==null?void 0:O.type)===D||(R==null?void 0:R.nodeId)===T&&(R==null?void 0:R.handleId)===I&&(R==null?void 0:R.type)===D,clickConnecting:(P==null?void 0:P.nodeId)===T&&(P==null?void 0:P.handleId)===I&&(P==null?void 0:P.type)===D}})(b,g,t),Wt);b||((E=(S=p.getState()).onError)==null||E.call(S,"010",TT()));const C=T=>{const{defaultEdgeOptions:I,onConnect:D,hasDefaultEdges:F}=p.getState(),O={...I,...T};if(F){const{edges:R,setEdges:P}=p.getState();P(((z,_)=>{if(!z.source||!z.target)return _;let k;return k=(B=>"id"in B&&"source"in B&&"target"in B)(z)?{...z}:{...z,id:zT(z)},((B,A)=>A.some(U=>!(U.source!==B.source||U.target!==B.target||U.sourceHandle!==B.sourceHandle&&(U.sourceHandle||B.sourceHandle)||U.targetHandle!==B.targetHandle&&(U.targetHandle||B.targetHandle))))(k,_)?_:_.concat(k)})(O,R))}D==null||D(O),a==null||a(O)},N=T=>{if(!b)return;const I=c2(T);r&&(I&&T.button===0||!I)&&_2({event:T,handleId:g,nodeId:b,onConnect:C,isTarget:x,getState:p.getState,setState:p.setState,isValidConnection:n||p.getState().isValidConnection||I2}),I?d==null||d(T):h==null||h(T)};return q.createElement("div",{"data-handleid":g,"data-nodeid":b,"data-handlepos":e,"data-id":`${b}-${g}-${t}`,className:Qt(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",v,c,{source:!x,target:x,connectable:o,connectablestart:r,connectableend:s,connecting:j,connectionindicator:o&&(r&&!w||s&&w)}]),onMouseDown:N,onTouchStart:N,onClick:y?T=>{const{onClickConnectStart:I,onClickConnectEnd:D,connectionClickStartHandle:F,connectionMode:O,isValidConnection:R}=p.getState();if(!b||!F&&!r)return;if(!F)return I==null||I(T,{nodeId:b,handleId:g,handleType:t}),void p.setState({connectionClickStartHandle:{nodeId:b,type:t,handleId:g}});const P=i2(T.target),z=n||R||I2,{connection:_,isValid:k}=E2({nodeId:b,id:g,type:t},O,F.nodeId,F.handleId||null,F.type,z,P);k&&C(_),D==null||D(T),p.setState({connectionClickStartHandle:null})}:void 0,ref:m,...f},l)});A2.displayName="Handle";var $o=M.memo(A2);const T2=({data:t,isConnectable:e,targetPosition:n=Oe.Top,sourcePosition:o=Oe.Bottom})=>q.createElement(q.Fragment,null,q.createElement($o,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,q.createElement($o,{type:"source",position:o,isConnectable:e}));T2.displayName="DefaultNode";var rf=M.memo(T2);const M2=({data:t,isConnectable:e,sourcePosition:n=Oe.Bottom})=>q.createElement(q.Fragment,null,t==null?void 0:t.label,q.createElement($o,{type:"source",position:n,isConnectable:e}));M2.displayName="InputNode";var O2=M.memo(M2);const D2=({data:t,isConnectable:e,targetPosition:n=Oe.Top})=>q.createElement(q.Fragment,null,q.createElement($o,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label);D2.displayName="OutputNode";var R2=M.memo(D2);const sf=()=>null;sf.displayName="GroupNode";const VT=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),$l=t=>t.id;function HT(t,e){return Wt(t.selectedNodes.map($l),e.selectedNodes.map($l))&&Wt(t.selectedEdges.map($l),e.selectedEdges.map($l))}const P2=M.memo(({onSelectionChange:t})=>{const e=Ft(),{selectedNodes:n,selectedEdges:o}=dt(VT,HT);return M.useEffect(()=>{const r={nodes:n,edges:o};t==null||t(r),e.getState().onSelectionChange.forEach(s=>s(r))},[n,o,t]),null});P2.displayName="SelectionListener";const WT=t=>!!t.onSelectionChange;function qT({onSelectionChange:t}){const e=dt(WT);return t||e?q.createElement(P2,{onSelectionChange:t}):null}const GT=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset});function Qr(t,e){M.useEffect(()=>{t!==void 0&&e(t)},[t])}function Ze(t,e,n){M.useEffect(()=>{e!==void 0&&n({[t]:e})},[e])}const YT=({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:r,onConnectStart:s,onConnectEnd:i,onClickConnectStart:a,onClickConnectEnd:l,nodesDraggable:c,nodesConnectable:d,nodesFocusable:h,edgesFocusable:f,edgesUpdatable:m,elevateNodesOnSelect:g,minZoom:x,maxZoom:p,nodeExtent:b,onNodesChange:y,onEdgesChange:v,elementsSelectable:w,connectionMode:j,snapGrid:C,snapToGrid:N,translateExtent:S,connectOnClick:E,defaultEdgeOptions:T,fitView:I,fitViewOptions:D,onNodesDelete:F,onEdgesDelete:O,onNodeDrag:R,onNodeDragStart:P,onNodeDragStop:z,onSelectionDrag:_,onSelectionDragStart:k,onSelectionDragStop:B,noPanClassName:A,nodeOrigin:U,rfId:V,autoPanOnConnect:X,autoPanOnNodeDrag:Y,onError:G,connectionRadius:W,isValidConnection:J,nodeDragThreshold:$})=>{const{setNodes:Q,setEdges:te,setDefaultNodesAndEdges:oe,setMinZoom:ne,setMaxZoom:ie,setTranslateExtent:se,setNodeExtent:ae,reset:fe}=dt(GT,Wt),re=Ft();return M.useEffect(()=>{const ue=o==null?void 0:o.map(le=>({...le,...T}));return oe(n,ue),()=>{fe()}},[]),Ze("defaultEdgeOptions",T,re.setState),Ze("connectionMode",j,re.setState),Ze("onConnect",r,re.setState),Ze("onConnectStart",s,re.setState),Ze("onConnectEnd",i,re.setState),Ze("onClickConnectStart",a,re.setState),Ze("onClickConnectEnd",l,re.setState),Ze("nodesDraggable",c,re.setState),Ze("nodesConnectable",d,re.setState),Ze("nodesFocusable",h,re.setState),Ze("edgesFocusable",f,re.setState),Ze("edgesUpdatable",m,re.setState),Ze("elementsSelectable",w,re.setState),Ze("elevateNodesOnSelect",g,re.setState),Ze("snapToGrid",N,re.setState),Ze("snapGrid",C,re.setState),Ze("onNodesChange",y,re.setState),Ze("onEdgesChange",v,re.setState),Ze("connectOnClick",E,re.setState),Ze("fitViewOnInit",I,re.setState),Ze("fitViewOnInitOptions",D,re.setState),Ze("onNodesDelete",F,re.setState),Ze("onEdgesDelete",O,re.setState),Ze("onNodeDrag",R,re.setState),Ze("onNodeDragStart",P,re.setState),Ze("onNodeDragStop",z,re.setState),Ze("onSelectionDrag",_,re.setState),Ze("onSelectionDragStart",k,re.setState),Ze("onSelectionDragStop",B,re.setState),Ze("noPanClassName",A,re.setState),Ze("nodeOrigin",U,re.setState),Ze("rfId",V,re.setState),Ze("autoPanOnConnect",X,re.setState),Ze("autoPanOnNodeDrag",Y,re.setState),Ze("onError",G,re.setState),Ze("connectionRadius",W,re.setState),Ze("isValidConnection",J,re.setState),Ze("nodeDragThreshold",$,re.setState),Qr(t,Q),Qr(e,te),Qr(x,ne),Qr(p,ie),Qr(S,se),Qr(b,ae),null},L2={display:"none"},KT={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},F2="react-flow__node-desc",z2="react-flow__edge-desc",XT=t=>t.ariaLiveMessage;function JT({rfId:t}){const e=dt(XT);return q.createElement("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:KT},e)}function ZT({rfId:t,disableKeyboardA11y:e}){return q.createElement(q.Fragment,null,q.createElement("div",{id:`${F2}-${t}`,style:L2},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),q.createElement("div",{id:`${z2}-${t}`,style:L2},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&q.createElement(JT,{rfId:t}))}var Si=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,o]=M.useState(!1),r=M.useRef(!1),s=M.useRef(new Set([])),[i,a]=M.useMemo(()=>{if(t!==null){const l=(Array.isArray(t)?t:[t]).filter(d=>typeof d=="string").map(d=>d.split("+")),c=l.reduce((d,h)=>d.concat(...h),[]);return[l,c]}return[[],[]]},[t]);return M.useEffect(()=>{const l=typeof document<"u"?document:null,c=(e==null?void 0:e.target)||l;if(t!==null){const d=m=>{if(r.current=m.ctrlKey||m.metaKey||m.shiftKey,(!r.current||r.current&&!e.actInsideInputWithModifier)&&qh(m))return!1;const g=U2(m.code,a);s.current.add(m[g]),B2(i,s.current,!1)&&(m.preventDefault(),o(!0))},h=m=>{if((!r.current||r.current&&!e.actInsideInputWithModifier)&&qh(m))return!1;const g=U2(m.code,a);B2(i,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(m[g]),m.key==="Meta"&&s.current.clear(),r.current=!1},f=()=>{s.current.clear(),o(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",h),window.addEventListener("blur",f),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",h),window.removeEventListener("blur",f)}}},[t,o]),n};function B2(t,e,n){return t.filter(o=>n||o.length===e.size).some(o=>o.every(r=>e.has(r)))}function U2(t,e){return e.includes(t)?"code":"key"}function $2(t,e,n,o){var a,l;const r=t.parentNode||t.parentId;if(!r)return n;const s=e.get(r),i=Zr(s,o);return $2(s,e,{x:(n.x??0)+i.x,y:(n.y??0)+i.y,z:(((a=s[yt])==null?void 0:a.z)??0)>(n.z??0)?((l=s[yt])==null?void 0:l.z)??0:n.z??0},o)}function V2(t,e,n){t.forEach(o=>{var s;const r=o.parentNode||o.parentId;if(r&&!t.has(r))throw new Error(`Parent node ${r} not found`);if(r||n!=null&&n[o.id]){const{x:i,y:a,z:l}=$2(o,t,{...o.position,z:((s=o[yt])==null?void 0:s.z)??0},e);o.positionAbsolute={x:i,y:a},o[yt].z=l,n!=null&&n[o.id]&&(o[yt].isParent=!0)}})}function af(t,e,n,o){const r=new Map,s={},i=o?1e3:0;return t.forEach(a=>{var m;const l=(Nn(a.zIndex)?a.zIndex:0)+(a.selected?i:0),c=e.get(a.id),d={...a,positionAbsolute:{x:a.position.x,y:a.position.y}},h=a.parentNode||a.parentId;h&&(s[h]=!0);const f=(c==null?void 0:c.type)&&(c==null?void 0:c.type)!==a.type;Object.defineProperty(d,yt,{enumerable:!1,value:{handleBounds:f||(m=c==null?void 0:c[yt])==null?void 0:m.handleBounds,z:l}}),r.set(a.id,d)}),V2(r,n,s),r}function H2(t,e={}){const{getNodes:n,width:o,height:r,minZoom:s,maxZoom:i,d3Zoom:a,d3Selection:l,fitViewOnInitDone:c,fitViewOnInit:d,nodeOrigin:h}=t(),f=e.initial&&!c&&d;if(a&&l&&(f||!e.initial)){const m=n().filter(x=>{var b;const p=e.includeHiddenNodes?x.width&&x.height:!x.hidden;return(b=e.nodes)!=null&&b.length?p&&e.nodes.some(y=>y.id===x.id):p}),g=m.every(x=>x.width&&x.height);if(m.length>0&&g){const x=tf(m,h),{x:p,y:b,zoom:y}=j2(x,o,r,e.minZoom??s,e.maxZoom??i,e.padding??.1),v=Qo.translate(p,b).scale(y);return typeof e.duration=="number"&&e.duration>0?a.transform(fr(l,e.duration),v):a.transform(l,v),!0}}return!1}function QT(t,e){return t.forEach(n=>{const o=e.get(n.id);o&&e.set(o.id,{...o,[yt]:o[yt],selected:n.selected})}),new Map(e)}function eM(t,e){return e.map(n=>{const o=t.find(r=>r.id===n.id);return o&&(n.selected=o.selected),n})}function Vl({changedNodes:t,changedEdges:e,get:n,set:o}){const{nodeInternals:r,edges:s,onNodesChange:i,onEdgesChange:a,hasDefaultNodes:l,hasDefaultEdges:c}=n();t!=null&&t.length&&(l&&o({nodeInternals:QT(t,r)}),i==null||i(t)),e!=null&&e.length&&(c&&o({edges:eM(e,s)}),a==null||a(e))}const es=()=>{},tM={zoomIn:es,zoomOut:es,zoomTo:es,getZoom:()=>1,setViewport:es,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:es,fitBounds:es,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},nM=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection});function Ni(){const t=(()=>{const x=Ft(),{d3Zoom:p,d3Selection:b}=dt(nM,Wt);return M.useMemo(()=>b&&p?{zoomIn:v=>p.scaleBy(fr(b,v==null?void 0:v.duration),1.2),zoomOut:v=>p.scaleBy(fr(b,v==null?void 0:v.duration),1/1.2),zoomTo:(v,w)=>p.scaleTo(fr(b,w==null?void 0:w.duration),v),getZoom:()=>x.getState().transform[2],setViewport:(v,w)=>{const[j,C,N]=x.getState().transform,S=Qo.translate(v.x??j,v.y??C).scale(v.zoom??N);p.transform(fr(b,w==null?void 0:w.duration),S)},getViewport:()=>{const[v,w,j]=x.getState().transform;return{x:v,y:w,zoom:j}},fitView:v=>H2(x.getState,v),setCenter:(v,w,j)=>{const{width:C,height:N,maxZoom:S}=x.getState(),E=(j==null?void 0:j.zoom)!==void 0?j.zoom:S,T=C/2-v*E,I=N/2-w*E,D=Qo.translate(T,I).scale(E);p.transform(fr(b,j==null?void 0:j.duration),D)},fitBounds:(v,w)=>{const{width:j,height:C,minZoom:N,maxZoom:S}=x.getState(),{x:E,y:T,zoom:I}=j2(v,j,C,N,S,(w==null?void 0:w.padding)??.1),D=Qo.translate(E,T).scale(I);p.transform(fr(b,w==null?void 0:w.duration),D)},project:v=>{const{transform:w,snapToGrid:j,snapGrid:C}=x.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),ef(v,w,j,C)},screenToFlowPosition:v=>{const{transform:w,snapToGrid:j,snapGrid:C,domNode:N}=x.getState();if(!N)return v;const{x:S,y:E}=N.getBoundingClientRect(),T={x:v.x-S,y:v.y-E};return ef(T,w,j,C)},flowToScreenPosition:v=>{const{transform:w,domNode:j}=x.getState();if(!j)return v;const{x:C,y:N}=j.getBoundingClientRect(),S=w2(v,w);return{x:S.x+C,y:S.y+N}},viewportInitialized:!0}:tM,[p,b])})(),e=Ft(),n=M.useCallback(()=>e.getState().getNodes().map(x=>({...x})),[]),o=M.useCallback(x=>e.getState().nodeInternals.get(x),[]),r=M.useCallback(()=>{const{edges:x=[]}=e.getState();return x.map(p=>({...p}))},[]),s=M.useCallback(x=>{const{edges:p=[]}=e.getState();return p.find(b=>b.id===x)},[]),i=M.useCallback(x=>{const{getNodes:p,setNodes:b,hasDefaultNodes:y,onNodesChange:v}=e.getState(),w=p(),j=typeof x=="function"?x(w):x;if(y)b(j);else if(v){const C=j.length===0?w.map(N=>({type:"remove",id:N.id})):j.map(N=>({item:N,type:"reset"}));v(C)}},[]),a=M.useCallback(x=>{const{edges:p=[],setEdges:b,hasDefaultEdges:y,onEdgesChange:v}=e.getState(),w=typeof x=="function"?x(p):x;y?b(w):v&&v(w.length===0?p.map(j=>({type:"remove",id:j.id})):w.map(j=>({item:j,type:"reset"})))},[]),l=M.useCallback(x=>{const p=Array.isArray(x)?x:[x],{getNodes:b,setNodes:y,hasDefaultNodes:v,onNodesChange:w}=e.getState();if(v)y([...b(),...p]);else if(w){const j=p.map(C=>({item:C,type:"add"}));w(j)}},[]),c=M.useCallback(x=>{const p=Array.isArray(x)?x:[x],{edges:b=[],setEdges:y,hasDefaultEdges:v,onEdgesChange:w}=e.getState();v?y([...b,...p]):w&&w(p.map(j=>({item:j,type:"add"})))},[]),d=M.useCallback(()=>{const{getNodes:x,edges:p=[],transform:b}=e.getState(),[y,v,w]=b;return{nodes:x().map(j=>({...j})),edges:p.map(j=>({...j})),viewport:{x:y,y:v,zoom:w}}},[]),h=M.useCallback(({nodes:x,edges:p})=>{const{nodeInternals:b,getNodes:y,edges:v,hasDefaultNodes:w,hasDefaultEdges:j,onNodesDelete:C,onEdgesDelete:N,onNodesChange:S,onEdgesChange:E}=e.getState(),T=(x||[]).map(R=>R.id),I=(p||[]).map(R=>R.id),D=y().reduce((R,P)=>{const z=P.parentNode||P.parentId,_=!T.includes(P.id)&&z&&R.find(k=>k.id===z);return(typeof P.deletable!="boolean"||P.deletable)&&(T.includes(P.id)||_)&&R.push(P),R},[]),F=v.filter(R=>typeof R.deletable!="boolean"||R.deletable),O=F.filter(R=>I.includes(R.id));if(D||O){const R=C2(D,F),P=[...O,...R],z=P.reduce((_,k)=>(_.includes(k.id)||_.push(k.id),_),[]);(j||w)&&(j&&e.setState({edges:v.filter(_=>!z.includes(_.id))}),w&&(D.forEach(_=>{b.delete(_.id)}),e.setState({nodeInternals:new Map(b)}))),z.length>0&&(N==null||N(P),E&&E(z.map(_=>({id:_,type:"remove"})))),D.length>0&&(C==null||C(D),S)&&S(D.map(_=>({id:_.id,type:"remove"})))}},[]),f=M.useCallback(x=>{const p=Nn((b=x).width)&&Nn(b.height)&&Nn(b.x)&&Nn(b.y);var b;const y=p?null:e.getState().nodeInternals.get(x.id);return!p&&!y?[null,null,p]:[p?x:a2(y),y,p]},[]),m=M.useCallback((x,p=!0,b)=>{const[y,v,w]=f(x);return y?(b||e.getState().getNodes()).filter(j=>{if(!(w||j.id!==v.id&&j.positionAbsolute))return!1;const C=a2(j),N=Wh(C,y);return p&&N>0||N>=y.width*y.height}):[]},[]),g=M.useCallback((x,p,b=!0)=>{const[y]=f(x);if(!y)return!1;const v=Wh(y,p);return b&&v>0||v>=y.width*y.height},[]);return M.useMemo(()=>({...t,getNodes:n,getNode:o,getEdges:r,getEdge:s,setNodes:i,setEdges:a,addNodes:l,addEdges:c,toObject:d,deleteElements:h,getIntersectingNodes:m,isNodeIntersecting:g}),[t,n,o,r,s,i,a,l,c,d,h,m,g])}const oM={actInsideInputWithModifier:!1},lf={position:"absolute",width:"100%",height:"100%",top:0,left:0},Hl=t=>({x:t.x,y:t.y,zoom:t.k}),ts=(t,e)=>t.target.closest(`.${e}`),W2=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),q2=t=>{const e=t.ctrlKey&&Ll()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},rM=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),sM=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:r=!0,zoomOnPinch:s=!0,panOnScroll:i=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=Bo.Free,zoomOnDoubleClick:c=!0,elementsSelectable:d,panOnDrag:h=!0,defaultViewport:f,translateExtent:m,minZoom:g,maxZoom:x,zoomActivationKeyCode:p,preventScrolling:b=!0,children:y,noWheelClassName:v,noPanClassName:w})=>{const j=M.useRef(),C=Ft(),N=M.useRef(!1),S=M.useRef(!1),E=M.useRef(null),T=M.useRef({x:0,y:0,zoom:0}),{d3Zoom:I,d3Selection:D,d3ZoomHandler:F,userSelectionActive:O}=dt(rM,Wt),R=Si(p),P=M.useRef(0),z=M.useRef(!1),_=M.useRef();return function(k){const B=Ft();M.useEffect(()=>{let A;const U=()=>{var X,Y;if(!k.current)return;const V=$h(k.current);V.height!==0&&V.width!==0||((Y=(X=B.getState()).onError)==null||Y.call(X,"004",ET())),B.setState({width:V.width||500,height:V.height||500})};return U(),window.addEventListener("resize",U),k.current&&(A=new ResizeObserver(()=>U()),A.observe(k.current)),()=>{window.removeEventListener("resize",U),A&&k.current&&A.unobserve(k.current)}},[])}(E),M.useEffect(()=>{if(E.current){const k=E.current.getBoundingClientRect(),B=function(){var Y,G,W,J=vT,$=wT,Q=jT,te=kT,oe=CT,ne=[0,1/0],ie=[[-1/0,-1/0],[1/0,1/0]],se=250,ae=oz,fe=Mj("start","zoom","end"),re=0,ue=10;function le(K){K.property("__zoom",n2).on("wheel.zoom",Ve,{passive:!1}).on("mousedown.zoom",Ke).on("dblclick.zoom",ee).filter(oe).on("touchstart.zoom",ye).on("touchmove.zoom",we).on("touchend.zoom touchcancel.zoom",Ae).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function je(K,pe){return(pe=Math.max(ne[0],Math.min(ne[1],pe)))===K.k?K:new fp(pe,K.x,K.y)}function Se(K,pe,ge){var he=pe[0]-ge[0]*K.k,Ce=pe[1]-ge[1]*K.k;return he===K.x&&Ce===K.y?K:new fp(K.k,he,Ce)}function Le(K){return[(+K[0][0]+ +K[1][0])/2,(+K[0][1]+ +K[1][1])/2]}function Ie(K,pe,ge,he){K.on("start.zoom",function(){ke(this,arguments).event(he).start()}).on("interrupt.zoom end.zoom",function(){ke(this,arguments).event(he).end()}).tween("zoom",function(){var Ce=this,Re=arguments,Pe=ke(Ce,Re).event(he),He=$.apply(Ce,Re),ce=ge==null?Le(He):typeof ge=="function"?ge.apply(Ce,Re):ge,Te=Math.max(He[1][0]-He[0][0],He[1][1]-He[0][1]),Me=Ce.__zoom,Ue=typeof pe=="function"?pe.apply(Ce,Re):pe,qe=ae(Me.invert(ce).concat(Te/Me.k),Ue.invert(ce).concat(Te/Ue.k));return function(De){if(De===1)De=Ue;else{var $e=qe(De),st=Te/$e[2];De=new fp(st,ce[0]-$e[0]*st,ce[1]-$e[1]*st)}Pe.zoom(null,De)}})}function ke(K,pe,ge){return!ge&&K.__zooming||new Ye(K,pe)}function Ye(K,pe){this.that=K,this.args=pe,this.active=0,this.sourceEvent=null,this.extent=$.apply(K,pe),this.taps=0}function Ve(K,...pe){if(J.apply(this,arguments)){var ge=ke(this,pe).event(K),he=this.__zoom,Ce=Math.max(ne[0],Math.min(ne[1],he.k*Math.pow(2,te.apply(this,arguments)))),Re=Kn(K);if(ge.wheel)ge.mouse[0][0]===Re[0]&&ge.mouse[0][1]===Re[1]||(ge.mouse[1]=he.invert(ge.mouse[0]=Re)),clearTimeout(ge.wheel);else{if(he.k===Ce)return;ge.mouse=[Re,he.invert(Re)],mp(this),ge.start()}vi(K),ge.wheel=setTimeout(function(){ge.wheel=null,ge.end()},150),ge.zoom("mouse",Q(Se(je(he,Ce),ge.mouse[0],ge.mouse[1]),ge.extent,ie))}}function Ke(K,...pe){if(!W&&J.apply(this,arguments)){var ge=K.currentTarget,he=ke(this,pe,!0).event(K),Ce=Vn(K.view).on("mousemove.zoom",function(ce){if(vi(ce),!he.moved){var Te=ce.clientX-Pe,Me=ce.clientY-He;he.moved=Te*Te+Me*Me>re}he.event(ce).zoom("mouse",Q(Se(he.that.__zoom,he.mouse[0]=Kn(ce,ge),he.mouse[1]),he.extent,ie))},!0).on("mouseup.zoom",function(ce){Ce.on("mousemove.zoom mouseup.zoom",null),t2(ce.view,he.moved),vi(ce),he.event(ce).end()},!0),Re=Kn(K,ge),Pe=K.clientX,He=K.clientY;e2(K.view),Uh(K),he.mouse=[Re,this.__zoom.invert(Re)],mp(this),he.start()}}function ee(K,...pe){if(J.apply(this,arguments)){var ge=this.__zoom,he=Kn(K.changedTouches?K.changedTouches[0]:K,this),Ce=ge.invert(he),Re=ge.k*(K.shiftKey?.5:2),Pe=Q(Se(je(ge,Re),he,Ce),$.apply(this,pe),ie);vi(K),se>0?Vn(this).transition().duration(se).call(Ie,Pe,he,K):Vn(this).call(le.transform,Pe,he,K)}}function ye(K,...pe){if(J.apply(this,arguments)){var ge,he,Ce,Re,Pe=K.touches,He=Pe.length,ce=ke(this,pe,K.changedTouches.length===He).event(K);for(Uh(K),he=0;he<He;++he)Re=[Re=Kn(Ce=Pe[he],this),this.__zoom.invert(Re),Ce.identifier],ce.touch0?ce.touch1||ce.touch0[2]===Re[2]||(ce.touch1=Re,ce.taps=0):(ce.touch0=Re,ge=!0,ce.taps=1+!!Y);Y&&(Y=clearTimeout(Y)),ge&&(ce.taps<2&&(G=Re[0],Y=setTimeout(function(){Y=null},500)),mp(this),ce.start())}}function we(K,...pe){if(this.__zooming){var ge,he,Ce,Re,Pe=ke(this,pe).event(K),He=K.changedTouches,ce=He.length;for(vi(K),ge=0;ge<ce;++ge)Ce=Kn(he=He[ge],this),Pe.touch0&&Pe.touch0[2]===he.identifier?Pe.touch0[0]=Ce:Pe.touch1&&Pe.touch1[2]===he.identifier&&(Pe.touch1[0]=Ce);if(he=Pe.that.__zoom,Pe.touch1){var Te=Pe.touch0[0],Me=Pe.touch0[1],Ue=Pe.touch1[0],qe=Pe.touch1[1],De=(De=Ue[0]-Te[0])*De+(De=Ue[1]-Te[1])*De,$e=($e=qe[0]-Me[0])*$e+($e=qe[1]-Me[1])*$e;he=je(he,Math.sqrt(De/$e)),Ce=[(Te[0]+Ue[0])/2,(Te[1]+Ue[1])/2],Re=[(Me[0]+qe[0])/2,(Me[1]+qe[1])/2]}else{if(!Pe.touch0)return;Ce=Pe.touch0[0],Re=Pe.touch0[1]}Pe.zoom("touch",Q(Se(he,Ce,Re),Pe.extent,ie))}}function Ae(K,...pe){if(this.__zooming){var ge,he,Ce=ke(this,pe).event(K),Re=K.changedTouches,Pe=Re.length;for(Uh(K),W&&clearTimeout(W),W=setTimeout(function(){W=null},500),ge=0;ge<Pe;++ge)he=Re[ge],Ce.touch0&&Ce.touch0[2]===he.identifier?delete Ce.touch0:Ce.touch1&&Ce.touch1[2]===he.identifier&&delete Ce.touch1;if(Ce.touch1&&!Ce.touch0&&(Ce.touch0=Ce.touch1,delete Ce.touch1),Ce.touch0)Ce.touch0[1]=this.__zoom.invert(Ce.touch0[0]);else if(Ce.end(),Ce.taps===2&&(he=Kn(he,this),Math.hypot(G[0]-he[0],G[1]-he[1])<ue)){var He=Vn(this).on("dblclick.zoom");He&&He.apply(this,arguments)}}}return le.transform=function(K,pe,ge,he){var Ce=K.selection?K.selection():K;Ce.property("__zoom",n2),K!==Ce?Ie(K,pe,ge,he):Ce.interrupt().each(function(){ke(this,arguments).event(he).start().zoom(null,typeof pe=="function"?pe.apply(this,arguments):pe).end()})},le.scaleBy=function(K,pe,ge,he){le.scaleTo(K,function(){return this.__zoom.k*(typeof pe=="function"?pe.apply(this,arguments):pe)},ge,he)},le.scaleTo=function(K,pe,ge,he){le.transform(K,function(){var Ce=$.apply(this,arguments),Re=this.__zoom,Pe=ge==null?Le(Ce):typeof ge=="function"?ge.apply(this,arguments):ge,He=Re.invert(Pe),ce=typeof pe=="function"?pe.apply(this,arguments):pe;return Q(Se(je(Re,ce),Pe,He),Ce,ie)},ge,he)},le.translateBy=function(K,pe,ge,he){le.transform(K,function(){return Q(this.__zoom.translate(typeof pe=="function"?pe.apply(this,arguments):pe,typeof ge=="function"?ge.apply(this,arguments):ge),$.apply(this,arguments),ie)},null,he)},le.translateTo=function(K,pe,ge,he,Ce){le.transform(K,function(){var Re=$.apply(this,arguments),Pe=this.__zoom,He=he==null?Le(Re):typeof he=="function"?he.apply(this,arguments):he;return Q(Qo.translate(He[0],He[1]).scale(Pe.k).translate(typeof pe=="function"?-pe.apply(this,arguments):-pe,typeof ge=="function"?-ge.apply(this,arguments):-ge),Re,ie)},he,Ce)},Ye.prototype={event:function(K){return K&&(this.sourceEvent=K),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(K,pe){return this.mouse&&K!=="mouse"&&(this.mouse[1]=pe.invert(this.mouse[0])),this.touch0&&K!=="touch"&&(this.touch0[1]=pe.invert(this.touch0[0])),this.touch1&&K!=="touch"&&(this.touch1[1]=pe.invert(this.touch1[0])),this.that.__zoom=pe,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(K){var pe=Vn(this.that).datum();fe.call(K,this.that,new yT(K,{sourceEvent:this.sourceEvent,target:le,transform:this.that.__zoom,dispatch:fe}),pe)}},le.wheelDelta=function(K){return arguments.length?(te=typeof K=="function"?K:Dl(+K),le):te},le.filter=function(K){return arguments.length?(J=typeof K=="function"?K:Dl(!!K),le):J},le.touchable=function(K){return arguments.length?(oe=typeof K=="function"?K:Dl(!!K),le):oe},le.extent=function(K){return arguments.length?($=typeof K=="function"?K:Dl([[+K[0][0],+K[0][1]],[+K[1][0],+K[1][1]]]),le):$},le.scaleExtent=function(K){return arguments.length?(ne[0]=+K[0],ne[1]=+K[1],le):[ne[0],ne[1]]},le.translateExtent=function(K){return arguments.length?(ie[0][0]=+K[0][0],ie[1][0]=+K[1][0],ie[0][1]=+K[0][1],ie[1][1]=+K[1][1],le):[[ie[0][0],ie[0][1]],[ie[1][0],ie[1][1]]]},le.constrain=function(K){return arguments.length?(Q=K,le):Q},le.duration=function(K){return arguments.length?(se=+K,le):se},le.interpolate=function(K){return arguments.length?(ae=K,le):ae},le.on=function(){var K=fe.on.apply(fe,arguments);return K===fe?le:K},le.clickDistance=function(K){return arguments.length?(re=(K=+K)*K,le):Math.sqrt(re)},le.tapDistance=function(K){return arguments.length?(ue=+K,le):ue},le}().scaleExtent([g,x]).translateExtent(m),A=Vn(E.current).call(B),U=Qo.translate(f.x,f.y).scale(Xr(f.zoom,g,x)),V=[[0,0],[k.width,k.height]],X=B.constrain()(U,V,m);B.transform(A,X),B.wheelDelta(q2),C.setState({d3Zoom:B,d3Selection:A,d3ZoomHandler:A.on("wheel.zoom"),transform:[X.x,X.y,X.k],domNode:E.current.closest(".react-flow")})}},[]),M.useEffect(()=>{D&&I&&(!i||R||O?F!==void 0&&D.on("wheel.zoom",function(k,B){if(!b&&k.type==="wheel"&&!k.ctrlKey||ts(k,v))return null;k.preventDefault(),F.call(this,k,B)},{passive:!1}):D.on("wheel.zoom",k=>{if(ts(k,v))return!1;k.preventDefault(),k.stopImmediatePropagation();const B=D.property("__zoom").k||1;if(k.ctrlKey&&s){const J=Kn(k),$=q2(k),Q=B*Math.pow(2,$);return void I.scaleTo(D,Q,J,k)}const A=k.deltaMode===1?20:1;let U=l===Bo.Vertical?0:k.deltaX*A,V=l===Bo.Horizontal?0:k.deltaY*A;!Ll()&&k.shiftKey&&l!==Bo.Vertical&&(U=k.deltaY*A,V=0),I.translateBy(D,-U/B*a,-V/B*a,{internal:!0});const X=Hl(D.property("__zoom")),{onViewportChangeStart:Y,onViewportChange:G,onViewportChangeEnd:W}=C.getState();clearTimeout(_.current),z.current||(z.current=!0,e==null||e(k,X),Y==null||Y(X)),z.current&&(t==null||t(k,X),G==null||G(X),_.current=setTimeout(()=>{n==null||n(k,X),W==null||W(X),z.current=!1},150))},{passive:!1}))},[O,i,l,D,I,F,R,s,b,v,e,t,n]),M.useEffect(()=>{I&&I.on("start",k=>{var U,V;if(!k.sourceEvent||k.sourceEvent.internal)return null;P.current=(U=k.sourceEvent)==null?void 0:U.button;const{onViewportChangeStart:B}=C.getState(),A=Hl(k.transform);N.current=!0,T.current=A,((V=k.sourceEvent)==null?void 0:V.type)==="mousedown"&&C.setState({paneDragging:!0}),B==null||B(A),e==null||e(k.sourceEvent,A)})},[I,e]),M.useEffect(()=>{I&&(O&&!N.current?I.on("zoom",null):O||I.on("zoom",k=>{var A;const{onViewportChange:B}=C.getState();if(C.setState({transform:[k.transform.x,k.transform.y,k.transform.k]}),S.current=!(!o||!W2(h,P.current??0)),(t||B)&&!((A=k.sourceEvent)!=null&&A.internal)){const U=Hl(k.transform);B==null||B(U),t==null||t(k.sourceEvent,U)}}))},[O,I,t,h,o]),M.useEffect(()=>{I&&I.on("end",k=>{if(!k.sourceEvent||k.sourceEvent.internal)return null;const{onViewportChangeEnd:B}=C.getState();if(N.current=!1,C.setState({paneDragging:!1}),o&&W2(h,P.current??0)&&!S.current&&o(k.sourceEvent),S.current=!1,(n||B)&&(A=T.current,U=k.transform,A.x!==U.x||A.y!==U.y||A.zoom!==U.k)){const V=Hl(k.transform);T.current=V,clearTimeout(j.current),j.current=setTimeout(()=>{B==null||B(V),n==null||n(k.sourceEvent,V)},i?150:0)}var A,U})},[I,i,h,n,o]),M.useEffect(()=>{I&&I.filter(k=>{const B=R||r,A=s&&k.ctrlKey;if((h===!0||Array.isArray(h)&&h.includes(1))&&k.button===1&&k.type==="mousedown"&&(ts(k,"react-flow__node")||ts(k,"react-flow__edge")))return!0;if(!(h||B||i||c||s)||O||!c&&k.type==="dblclick"||ts(k,v)&&k.type==="wheel"||ts(k,w)&&(k.type!=="wheel"||i&&k.type==="wheel"&&!R)||!s&&k.ctrlKey&&k.type==="wheel"||!B&&!i&&!A&&k.type==="wheel"||!h&&(k.type==="mousedown"||k.type==="touchstart")||Array.isArray(h)&&!h.includes(k.button)&&k.type==="mousedown")return!1;const U=Array.isArray(h)&&h.includes(k.button)||!k.button||k.button<=1;return(!k.ctrlKey||k.type==="wheel")&&U})},[O,I,r,s,i,c,h,d,R]),q.createElement("div",{className:"react-flow__renderer",ref:E,style:lf},y)},iM=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function aM(){const{userSelectionActive:t,userSelectionRect:e}=dt(iM,Wt);return t&&e?q.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function G2(t,e){const n=e.parentNode||e.parentId,o=t.find(r=>r.id===n);if(o){const r=e.position.x+e.width-o.width,s=e.position.y+e.height-o.height;if(r>0||s>0||e.position.x<0||e.position.y<0){if(o.style={...o.style},o.style.width=o.style.width??o.width,o.style.height=o.style.height??o.height,r>0&&(o.style.width+=r),s>0&&(o.style.height+=s),e.position.x<0){const i=Math.abs(e.position.x);o.position.x=o.position.x-i,o.style.width+=i,e.position.x=0}if(e.position.y<0){const i=Math.abs(e.position.y);o.position.y=o.position.y-i,o.style.height+=i,e.position.y=0}o.width=o.style.width,o.height=o.style.height}}}function Y2(t,e){if(t.some(o=>o.type==="reset"))return t.filter(o=>o.type==="reset").map(o=>o.item);const n=t.filter(o=>o.type==="add").map(o=>o.item);return e.reduce((o,r)=>{const s=t.filter(a=>a.id===r.id);if(s.length===0)return o.push(r),o;const i={...r};for(const a of s)if(a)switch(a.type){case"select":i.selected=a.selected;break;case"position":a.position!==void 0&&(i.position=a.position),a.positionAbsolute!==void 0&&(i.positionAbsolute=a.positionAbsolute),a.dragging!==void 0&&(i.dragging=a.dragging),i.expandParent&&G2(o,i);break;case"dimensions":a.dimensions!==void 0&&(i.width=a.dimensions.width,i.height=a.dimensions.height),a.updateStyle!==void 0&&(i.style={...i.style||{},...a.dimensions}),typeof a.resizing=="boolean"&&(i.resizing=a.resizing),i.expandParent&&G2(o,i);break;case"remove":return o}return o.push(i),o},n)}function K2(t,e){return Y2(t,e)}const Vo=(t,e)=>({id:t,type:"select",selected:e});function ns(t,e){return t.reduce((n,o)=>{const r=e.includes(o.id);return!o.selected&&r?(o.selected=!0,n.push(Vo(o.id,!0))):o.selected&&!r&&(o.selected=!1,n.push(Vo(o.id,!1))),n},[])}const cf=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},lM=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),X2=M.memo(({isSelecting:t,selectionMode:e=Ci.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:r,onPaneClick:s,onPaneContextMenu:i,onPaneScroll:a,onPaneMouseEnter:l,onPaneMouseMove:c,onPaneMouseLeave:d,children:h})=>{const f=M.useRef(null),m=Ft(),g=M.useRef(0),x=M.useRef(0),p=M.useRef(),{userSelectionActive:b,elementsSelectable:y,dragging:v}=dt(lM,Wt),w=()=>{m.setState({userSelectionActive:!1,userSelectionRect:null}),g.current=0,x.current=0},j=S=>{s==null||s(S),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},C=a?S=>a(S):void 0,N=y&&(t||b);return q.createElement("div",{className:Qt(["react-flow__pane",{dragging:v,selection:t}]),onClick:N?void 0:cf(j,f),onContextMenu:cf(S=>{Array.isArray(n)&&(n!=null&&n.includes(2))?S.preventDefault():i==null||i(S)},f),onWheel:cf(C,f),onMouseEnter:N?void 0:l,onMouseDown:N?S=>{const{resetSelectedElements:E,domNode:T}=m.getState();if(p.current=T==null?void 0:T.getBoundingClientRect(),!y||!t||S.button!==0||S.target!==f.current||!p.current)return;const{x:I,y:D}=zo(S,p.current);E(),m.setState({userSelectionRect:{width:0,height:0,startX:I,startY:D,x:I,y:D}}),o==null||o(S)}:void 0,onMouseMove:N?S=>{const{userSelectionRect:E,nodeInternals:T,edges:I,transform:D,onNodesChange:F,onEdgesChange:O,nodeOrigin:R,getNodes:P}=m.getState();if(!t||!p.current||!E)return;m.setState({userSelectionActive:!0,nodesSelectionActive:!1});const z=zo(S,p.current),_=E.startX??0,k=E.startY??0,B={...E,x:z.x<_?z.x:_,y:z.y<k?z.y:k,width:Math.abs(z.x-_),height:Math.abs(z.y-k)},A=P(),U=k2(T,B,D,e===Ci.Partial,!0,R),V=C2(U,I).map(Y=>Y.id),X=U.map(Y=>Y.id);if(g.current!==X.length){g.current=X.length;const Y=ns(A,X);Y.length&&(F==null||F(Y))}if(x.current!==V.length){x.current=V.length;const Y=ns(I,V);Y.length&&(O==null||O(Y))}m.setState({userSelectionRect:B})}:c,onMouseUp:N?S=>{if(S.button!==0)return;const{userSelectionRect:E}=m.getState();!b&&E&&S.target===f.current&&(j==null||j(S)),m.setState({nodesSelectionActive:g.current>0}),w(),r==null||r(S)}:void 0,onMouseLeave:N?S=>{b&&(m.setState({nodesSelectionActive:g.current>0}),r==null||r(S)),w()}:d,ref:f,style:lf},h,q.createElement(aM,null))});function J2(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const o=e.get(n);return!!o&&(!!o.selected||J2(o,e))}function Z2(t,e,n){let o=t;do{if(o!=null&&o.matches(e))return!0;if(o===n.current)return!1;o=o.parentElement}while(o);return!1}function cM(t,e,n,o){return Array.from(t.values()).filter(r=>(r.selected||r.id===o)&&(!r.parentNode||r.parentId||!J2(r,t))&&(r.draggable||e&&r.draggable===void 0)).map(r=>{var s,i;return{id:r.id,position:r.position||{x:0,y:0},positionAbsolute:r.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((s=r.positionAbsolute)==null?void 0:s.x)??0),y:n.y-(((i=r.positionAbsolute)==null?void 0:i.y)??0)},delta:{x:0,y:0},extent:r.extent,parentNode:r.parentNode||r.parentId,parentId:r.parentNode||r.parentId,width:r.width,height:r.height,expandParent:r.expandParent}})}function Q2(t,e,n,o,r=[0,0],s){const i=function(h,f){return f&&f!=="parent"?[f[0],[f[1][0]-(h.width||0),f[1][1]-(h.height||0)]]:f}(t,t.extent||o);let a=i;const l=t.parentNode||t.parentId;if(t.extent!=="parent"||t.expandParent){if(t.extent&&l&&t.extent!=="parent"){const h=n.get(l),{x:f,y:m}=Zr(h,r).positionAbsolute;a=[[t.extent[0][0]+f,t.extent[0][1]+m],[t.extent[1][0]+f,t.extent[1][1]+m]]}}else if(l&&t.width&&t.height){const h=n.get(l),{x:f,y:m}=Zr(h,r).positionAbsolute;a=h&&Nn(f)&&Nn(m)&&Nn(h.width)&&Nn(h.height)?[[f+t.width*r[0],m+t.height*r[1]],[f+h.width-t.width+t.width*r[0],m+h.height-t.height+t.height*r[1]]]:a}else s==null||s("005",_T()),a=i;let c={x:0,y:0};if(l){const h=n.get(l);c=Zr(h,r).positionAbsolute}const d=a&&a!=="parent"?Vh(e,a):e;return{position:{x:d.x-c.x,y:d.y-c.y},positionAbsolute:d}}function df({nodeId:t,dragItems:e,nodeInternals:n}){const o=e.map(r=>({...n.get(r.id),position:r.position,positionAbsolute:r.positionAbsolute}));return[t?o.find(r=>r.id===t):o[0],o]}X2.displayName="Pane";const ew=(t,e,n,o)=>{const r=e.querySelectorAll(t);if(!r||!r.length)return null;const s=Array.from(r),i=e.getBoundingClientRect(),a=i.width*o[0],l=i.height*o[1];return s.map(c=>{const d=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),position:c.getAttribute("data-handlepos"),x:(d.left-i.left-a)/n,y:(d.top-i.top-l)/n,...$h(c)}})};function Ei(t,e,n){return n===void 0?n:o=>{const r=e().nodeInternals.get(t);r&&n(o,{...r})}}function uf({id:t,store:e,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:i,nodeInternals:a,onError:l}=e.getState(),c=a.get(t);c?(e.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&i)&&(s({nodes:[c],edges:[]}),requestAnimationFrame(()=>{var d;return(d=o==null?void 0:o.current)==null?void 0:d.blur()})):r([t])):l==null||l("012",OT(t))}function hf(t){return(e,n,o)=>t==null?void 0:t(e,o)}function tw({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:s,selectNodesOnDrag:i}){const a=Ft(),[l,c]=M.useState(!1),d=M.useRef([]),h=M.useRef({x:null,y:null}),f=M.useRef(0),m=M.useRef(null),g=M.useRef({x:0,y:0}),x=M.useRef(null),p=M.useRef(!1),b=M.useRef(!1),y=M.useRef(!1),v=function(){const w=Ft();return M.useCallback(({sourceEvent:C})=>{const{transform:N,snapGrid:S,snapToGrid:E}=w.getState(),T=C.touches?C.touches[0].clientX:C.clientX,I=C.touches?C.touches[0].clientY:C.clientY,D={x:(T-N[0])/N[2],y:(I-N[1])/N[2]};return{xSnapped:E?S[0]*Math.round(D.x/S[0]):D.x,ySnapped:E?S[1]*Math.round(D.y/S[1]):D.y,...D}},[])}();return M.useEffect(()=>{if(t!=null&&t.current){const w=Vn(t.current),j=({x:S,y:E})=>{const{nodeInternals:T,onNodeDrag:I,onSelectionDrag:D,updateNodePositions:F,nodeExtent:O,snapGrid:R,snapToGrid:P,nodeOrigin:z,onError:_}=a.getState();h.current={x:S,y:E};let k=!1,B={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&O){const U=tf(d.current,z);B=Hh(U)}if(d.current=d.current.map(U=>{const V={x:S-U.distance.x,y:E-U.distance.y};P&&(V.x=R[0]*Math.round(V.x/R[0]),V.y=R[1]*Math.round(V.y/R[1]));const X=[[O[0][0],O[0][1]],[O[1][0],O[1][1]]];d.current.length>1&&O&&!U.extent&&(X[0][0]=U.positionAbsolute.x-B.x+O[0][0],X[1][0]=U.positionAbsolute.x+(U.width??0)-B.x2+O[1][0],X[0][1]=U.positionAbsolute.y-B.y+O[0][1],X[1][1]=U.positionAbsolute.y+(U.height??0)-B.y2+O[1][1]);const Y=Q2(U,V,T,X,z,_);return k=k||U.position.x!==Y.position.x||U.position.y!==Y.position.y,U.position=Y.position,U.positionAbsolute=Y.positionAbsolute,U}),!k)return;F(d.current,!0,!0),c(!0);const A=r?I:hf(D);if(A&&x.current){const[U,V]=df({nodeId:r,dragItems:d.current,nodeInternals:T});A(x.current,U,V)}},C=()=>{if(!m.current)return;const[S,E]=s2(g.current,m.current);if(S!==0||E!==0){const{transform:T,panBy:I}=a.getState();h.current.x=(h.current.x??0)-S/T[2],h.current.y=(h.current.y??0)-E/T[2],I({x:S,y:E})&&j(h.current)}f.current=requestAnimationFrame(C)},N=S=>{var z;const{nodeInternals:E,multiSelectionActive:T,nodesDraggable:I,unselectNodesAndEdges:D,onNodeDragStart:F,onSelectionDragStart:O}=a.getState();b.current=!0;const R=r?F:hf(O);i&&s||T||!r||(z=E.get(r))!=null&&z.selected||D(),r&&s&&i&&uf({id:r,store:a,nodeRef:t});const P=v(S);if(h.current=P,d.current=cM(E,I,P,r),R&&d.current){const[_,k]=df({nodeId:r,dragItems:d.current,nodeInternals:E});R(S.sourceEvent,_,k)}};if(!e){const S=function(){var E,T,I,D,F=pT,O=gT,R=xT,P=bT,z={},_=Mj("start","drag","end"),k=0,B=0;function A($){$.on("mousedown.drag",U).filter(P).on("touchstart.drag",Y).on("touchmove.drag",G,mT).on("touchend.drag touchcancel.drag",W).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function U($,Q){if(!D&&F.call(this,$,Q)){var te=J(this,O.call(this,$,Q),$,Q,"mouse");te&&(Vn($.view).on("mousemove.drag",V,yi).on("mouseup.drag",X,yi),e2($.view),zh($),I=!1,E=$.clientX,T=$.clientY,te("start",$))}}function V($){if(Kr($),!I){var Q=$.clientX-E,te=$.clientY-T;I=Q*Q+te*te>B}z.mouse("drag",$)}function X($){Vn($.view).on("mousemove.drag mouseup.drag",null),t2($.view,I),Kr($),z.mouse("end",$)}function Y($,Q){if(F.call(this,$,Q)){var te,oe,ne=$.changedTouches,ie=O.call(this,$,Q),se=ne.length;for(te=0;te<se;++te)(oe=J(this,ie,$,Q,ne[te].identifier,ne[te]))&&(zh($),oe("start",$,ne[te]))}}function G($){var Q,te,oe=$.changedTouches,ne=oe.length;for(Q=0;Q<ne;++Q)(te=z[oe[Q].identifier])&&(Kr($),te("drag",$,oe[Q]))}function W($){var Q,te,oe=$.changedTouches,ne=oe.length;for(D&&clearTimeout(D),D=setTimeout(function(){D=null},500),Q=0;Q<ne;++Q)(te=z[oe[Q].identifier])&&(zh($),te("end",$,oe[Q]))}function J($,Q,te,oe,ne,ie){var se,ae,fe,re=_.copy(),ue=Kn(ie||te,Q);if((fe=R.call($,new Bh("beforestart",{sourceEvent:te,target:A,identifier:ne,active:k,x:ue[0],y:ue[1],dx:0,dy:0,dispatch:re}),oe))!=null)return se=fe.x-ue[0]||0,ae=fe.y-ue[1]||0,function le(je,Se,Le){var Ie,ke=ue;switch(je){case"start":z[ne]=le,Ie=k++;break;case"end":delete z[ne],--k;case"drag":ue=Kn(Le||Se,Q),Ie=k}re.call(je,$,new Bh(je,{sourceEvent:Se,subject:fe,target:A,identifier:ne,active:Ie,x:ue[0]+se,y:ue[1]+ae,dx:ue[0]-ke[0],dy:ue[1]-ke[1],dispatch:re}),oe)}}return A.filter=function($){return arguments.length?(F=typeof $=="function"?$:Ol(!!$),A):F},A.container=function($){return arguments.length?(O=typeof $=="function"?$:Ol($),A):O},A.subject=function($){return arguments.length?(R=typeof $=="function"?$:Ol($),A):R},A.touchable=function($){return arguments.length?(P=typeof $=="function"?$:Ol(!!$),A):P},A.on=function(){var $=_.on.apply(_,arguments);return $===_?A:$},A.clickDistance=function($){return arguments.length?(B=($=+$)*$,A):Math.sqrt(B)},A}().on("start",E=>{const{domNode:T,nodeDragThreshold:I}=a.getState();I===0&&N(E),y.current=!1;const D=v(E);h.current=D,m.current=(T==null?void 0:T.getBoundingClientRect())||null,g.current=zo(E.sourceEvent,m.current)}).on("drag",E=>{var F,O;const T=v(E),{autoPanOnNodeDrag:I,nodeDragThreshold:D}=a.getState();if(E.sourceEvent.type==="touchmove"&&E.sourceEvent.touches.length>1&&(y.current=!0),!y.current){if(!p.current&&b.current&&I&&(p.current=!0,C()),!b.current){const R=T.xSnapped-(((F=h==null?void 0:h.current)==null?void 0:F.x)??0),P=T.ySnapped-(((O=h==null?void 0:h.current)==null?void 0:O.y)??0);Math.sqrt(R*R+P*P)>D&&N(E)}(h.current.x!==T.xSnapped||h.current.y!==T.ySnapped)&&d.current&&b.current&&(x.current=E.sourceEvent,g.current=zo(E.sourceEvent,m.current),j(T))}}).on("end",E=>{if(b.current&&!y.current&&(c(!1),p.current=!1,b.current=!1,cancelAnimationFrame(f.current),d.current)){const{updateNodePositions:T,nodeInternals:I,onNodeDragStop:D,onSelectionDragStop:F}=a.getState(),O=r?D:hf(F);if(T(d.current,!1,!1),O){const[R,P]=df({nodeId:r,dragItems:d.current,nodeInternals:I});O(E.sourceEvent,R,P)}}}).filter(E=>{const T=E.target;return!E.button&&(!n||!Z2(T,`.${n}`,t))&&(!o||Z2(T,o,t))});return w.call(S),()=>{w.on(".drag",null)}}w.on(".drag",null)}},[t,e,n,o,s,a,r,i,v]),l}function nw(){const t=Ft();return M.useCallback(n=>{const{nodeInternals:o,nodeExtent:r,updateNodePositions:s,getNodes:i,snapToGrid:a,snapGrid:l,onError:c,nodesDraggable:d}=t.getState(),h=i().filter(y=>y.selected&&(y.draggable||d&&y.draggable===void 0)),f=a?l[0]:5,m=a?l[1]:5,g=n.isShiftPressed?4:1,x=n.x*f*g,p=n.y*m*g,b=h.map(y=>{if(y.positionAbsolute){const v={x:y.positionAbsolute.x+x,y:y.positionAbsolute.y+p};a&&(v.x=l[0]*Math.round(v.x/l[0]),v.y=l[1]*Math.round(v.y/l[1]));const{positionAbsolute:w,position:j}=Q2(y,v,o,r,void 0,c);y.position=j,y.positionAbsolute=w}return y});s(b,!0,!1)},[])}const os={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var _i=t=>{const e=({id:n,type:o,data:r,xPos:s,yPos:i,xPosOrigin:a,yPosOrigin:l,selected:c,onClick:d,onMouseEnter:h,onMouseMove:f,onMouseLeave:m,onContextMenu:g,onDoubleClick:x,style:p,className:b,isDraggable:y,isSelectable:v,isConnectable:w,isFocusable:j,selectNodesOnDrag:C,sourcePosition:N,targetPosition:S,hidden:E,resizeObserver:T,dragHandle:I,zIndex:D,isParent:F,noDragClassName:O,noPanClassName:R,initialized:P,disableKeyboardA11y:z,ariaLabel:_,rfId:k,hasHandleBounds:B})=>{const A=Ft(),U=M.useRef(null),V=M.useRef(null),X=M.useRef(N),Y=M.useRef(S),G=M.useRef(o),W=v||y||d||h||f||m,J=nw(),$=Ei(n,A.getState,h),Q=Ei(n,A.getState,f),te=Ei(n,A.getState,m),oe=Ei(n,A.getState,g),ne=Ei(n,A.getState,x);M.useEffect(()=>()=>{V.current&&(T==null||T.unobserve(V.current),V.current=null)},[]),M.useEffect(()=>{if(U.current&&!E){const se=U.current;P&&B&&V.current===se||(V.current&&(T==null||T.unobserve(V.current)),T==null||T.observe(se),V.current=se)}},[E,P,B]),M.useEffect(()=>{const se=G.current!==o,ae=X.current!==N,fe=Y.current!==S;U.current&&(se||ae||fe)&&(se&&(G.current=o),ae&&(X.current=N),fe&&(Y.current=S),A.getState().updateNodeDimensions([{id:n,nodeElement:U.current,forceUpdate:!0}]))},[n,o,N,S]);const ie=tw({nodeRef:U,disabled:E||!y,noDragClassName:O,handleSelector:I,nodeId:n,isSelectable:v,selectNodesOnDrag:C});return E?null:q.createElement("div",{className:Qt(["react-flow__node",`react-flow__node-${o}`,{[R]:y},b,{selected:c,selectable:v,parent:F,dragging:ie}]),ref:U,style:{zIndex:D,transform:`translate(${a}px,${l}px)`,pointerEvents:W?"all":"none",visibility:P?"visible":"hidden",...p},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:$,onMouseMove:Q,onMouseLeave:te,onContextMenu:oe,onClick:se=>{const{nodeDragThreshold:ae}=A.getState();if(v&&(!C||!y||ae>0)&&uf({id:n,store:A,nodeRef:U}),d){const fe=A.getState().nodeInternals.get(n);fe&&d(se,{...fe})}},onDoubleClick:ne,onKeyDown:j?se=>{if(!qh(se)&&!z)if(l2.includes(se.key)&&v){const ae=se.key==="Escape";uf({id:n,store:A,unselect:ae,nodeRef:U})}else y&&c&&Object.prototype.hasOwnProperty.call(os,se.key)&&(A.setState({ariaLiveMessage:`Moved selected node ${se.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~s}, y: ${~~i}`}),J({x:os[se.key].x,y:os[se.key].y,isShiftPressed:se.shiftKey}))}:void 0,tabIndex:j?0:void 0,role:j?"button":void 0,"aria-describedby":z?void 0:`${F2}-${k}`,"aria-label":_},q.createElement(FT,{value:n},q.createElement(t,{id:n,data:r,type:o,xPos:s,yPos:i,selected:c,isConnectable:w,sourcePosition:N,targetPosition:S,dragging:ie,dragHandle:I,zIndex:D})))};return e.displayName="NodeWrapper",M.memo(e)};const dM=t=>{const e=t.getNodes().filter(n=>n.selected);return{...tf(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};var uM=M.memo(function({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const o=Ft(),{width:r,height:s,x:i,y:a,transformString:l,userSelectionActive:c}=dt(dM,Wt),d=nw(),h=M.useRef(null);if(M.useEffect(()=>{var m;n||((m=h.current)==null||m.focus({preventScroll:!0}))},[n]),tw({nodeRef:h}),c||!r||!s)return null;const f=t?m=>{const g=o.getState().getNodes().filter(x=>x.selected);t(m,g)}:void 0;return q.createElement("div",{className:Qt(["react-flow__nodesselection","react-flow__container",e]),style:{transform:l}},q.createElement("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:m=>{Object.prototype.hasOwnProperty.call(os,m.key)&&d({x:os[m.key].x,y:os[m.key].y,isShiftPressed:m.shiftKey})},style:{width:r,height:s,top:a,left:i}}))});const hM=t=>t.nodesSelectionActive,ow=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,deleteKeyCode:a,onMove:l,onMoveStart:c,onMoveEnd:d,selectionKeyCode:h,selectionOnDrag:f,selectionMode:m,onSelectionStart:g,onSelectionEnd:x,multiSelectionKeyCode:p,panActivationKeyCode:b,zoomActivationKeyCode:y,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:j,panOnScroll:C,panOnScrollSpeed:N,panOnScrollMode:S,zoomOnDoubleClick:E,panOnDrag:T,defaultViewport:I,translateExtent:D,minZoom:F,maxZoom:O,preventScrolling:R,onSelectionContextMenu:P,noWheelClassName:z,noPanClassName:_,disableKeyboardA11y:k})=>{const B=dt(hM),A=Si(h),U=Si(b),V=U||T,X=U||C,Y=A||f&&V!==!0;return(({deleteKeyCode:G,multiSelectionKeyCode:W})=>{const J=Ft(),{deleteElements:$}=Ni(),Q=Si(G,oM),te=Si(W);M.useEffect(()=>{if(Q){const{edges:oe,getNodes:ne}=J.getState(),ie=ne().filter(ae=>ae.selected),se=oe.filter(ae=>ae.selected);$({nodes:ie,edges:se}),J.setState({nodesSelectionActive:!1})}},[Q]),M.useEffect(()=>{J.setState({multiSelectionActive:te})},[te])})({deleteKeyCode:a,multiSelectionKeyCode:p}),q.createElement(sM,{onMove:l,onMoveStart:c,onMoveEnd:d,onPaneContextMenu:s,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:j,panOnScroll:X,panOnScrollSpeed:N,panOnScrollMode:S,zoomOnDoubleClick:E,panOnDrag:!A&&V,defaultViewport:I,translateExtent:D,minZoom:F,maxZoom:O,zoomActivationKeyCode:y,preventScrolling:R,noWheelClassName:z,noPanClassName:_},q.createElement(X2,{onSelectionStart:g,onSelectionEnd:x,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:V,isSelecting:!!Y,selectionMode:m},t,B&&q.createElement(uM,{onSelectionContextMenu:P,noPanClassName:_,disableKeyboardA11y:k})))};ow.displayName="FlowRenderer";var fM=M.memo(ow);function mM(t){return{input:_i(t.input||O2),default:_i(t.default||rf),output:_i(t.output||R2),group:_i(t.group||sf),...Object.keys(t).filter(e=>!["input","default","output","group"].includes(e)).reduce((e,n)=>(e[n]=_i(t[n]||rf),e),{})}}const pM=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),rw=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,updateNodeDimensions:s,onError:i}=dt(pM,Wt),a=(l=t.onlyRenderVisibleElements,dt(M.useCallback(h=>l?k2(h.nodeInternals,{x:0,y:0,width:h.width,height:h.height},h.transform,!0):h.getNodes(),[l])));var l;const c=M.useRef(),d=M.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(f=>{const m=f.map(g=>({id:g.target.getAttribute("data-id"),nodeElement:g.target,forceUpdate:!0}));s(m)});return c.current=h,h},[]);return M.useEffect(()=>()=>{var h;(h=c==null?void 0:c.current)==null||h.disconnect()},[]),q.createElement("div",{className:"react-flow__nodes",style:lf},a.map(h=>{var C,N,S;let f=h.type||"default";t.nodeTypes[f]||(i==null||i("003",NT(f)),f="default");const m=t.nodeTypes[f]||t.nodeTypes.default,g=!!(h.draggable||e&&h.draggable===void 0),x=!!(h.selectable||r&&h.selectable===void 0),p=!!(h.connectable||n&&h.connectable===void 0),b=!!(h.focusable||o&&h.focusable===void 0),y=t.nodeExtent?Vh(h.positionAbsolute,t.nodeExtent):h.positionAbsolute,v=(y==null?void 0:y.x)??0,w=(y==null?void 0:y.y)??0,j=(({x:E,y:T,width:I,height:D,origin:F})=>I&&D?F[0]<0||F[1]<0||F[0]>1||F[1]>1?{x:E,y:T}:{x:E-I*F[0],y:T-D*F[1]}:{x:E,y:T})({x:v,y:w,width:h.width??0,height:h.height??0,origin:t.nodeOrigin});return q.createElement(m,{key:h.id,id:h.id,className:h.className,style:h.style,type:f,data:h.data,sourcePosition:h.sourcePosition||Oe.Bottom,targetPosition:h.targetPosition||Oe.Top,hidden:h.hidden,xPos:v,yPos:w,xPosOrigin:j.x,yPosOrigin:j.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!h.selected,isDraggable:g,isSelectable:x,isConnectable:p,isFocusable:b,resizeObserver:d,dragHandle:h.dragHandle,zIndex:((C=h[yt])==null?void 0:C.z)??0,isParent:!!((N=h[yt])!=null&&N.isParent),noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!h.width&&!!h.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((S=h[yt])!=null&&S.handleBounds)})}))};rw.displayName="NodeRenderer";var gM=M.memo(rw);const xM=(t,e,n)=>n===Oe.Left?t-e:n===Oe.Right?t+e:t,bM=(t,e,n)=>n===Oe.Top?t-e:n===Oe.Bottom?t+e:t,sw="react-flow__edgeupdater",iw=({position:t,centerX:e,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:s,onMouseOut:i,type:a})=>q.createElement("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:i,className:Qt([sw,`${sw}-${a}`]),cx:xM(e,o,t),cy:bM(n,o,t),r:o,stroke:"transparent",fill:"transparent"}),yM=()=>!0;var rs=t=>{const e=({id:n,className:o,type:r,data:s,onClick:i,onEdgeDoubleClick:a,selected:l,animated:c,label:d,labelStyle:h,labelShowBg:f,labelBgStyle:m,labelBgPadding:g,labelBgBorderRadius:x,style:p,source:b,target:y,sourceX:v,sourceY:w,targetX:j,targetY:C,sourcePosition:N,targetPosition:S,elementsSelectable:E,hidden:T,sourceHandleId:I,targetHandleId:D,onContextMenu:F,onMouseEnter:O,onMouseMove:R,onMouseLeave:P,reconnectRadius:z,onReconnect:_,onReconnectStart:k,onReconnectEnd:B,markerEnd:A,markerStart:U,rfId:V,ariaLabel:X,isFocusable:Y,isReconnectable:G,pathOptions:W,interactionWidth:J,disableKeyboardA11y:$})=>{const Q=M.useRef(null),[te,oe]=M.useState(!1),[ne,ie]=M.useState(!1),se=Ft(),ae=M.useMemo(()=>`url('#${Qh(U,V)}')`,[U,V]),fe=M.useMemo(()=>`url('#${Qh(A,V)}')`,[A,V]);if(T)return null;const re=ki(n,se.getState,a),ue=ki(n,se.getState,F),le=ki(n,se.getState,O),je=ki(n,se.getState,R),Se=ki(n,se.getState,P),Le=(Ve,Ke)=>{if(Ve.button!==0)return;const{edges:ee,isValidConnection:ye}=se.getState(),we=Ke?y:b,Ae=(Ke?D:I)||null,K=Ke?"target":"source",pe=ye||yM,ge=Ke,he=ee.find(Ce=>Ce.id===n);ie(!0),k==null||k(Ve,he,K),_2({event:Ve,handleId:Ae,nodeId:we,onConnect:Ce=>_==null?void 0:_(he,Ce),isTarget:ge,getState:se.getState,setState:se.setState,isValidConnection:pe,edgeUpdaterType:K,onReconnectEnd:Ce=>{ie(!1),B==null||B(Ce,he,K)}})},Ie=()=>oe(!0),ke=()=>oe(!1),Ye=!E&&!i;return q.createElement("g",{className:Qt(["react-flow__edge",`react-flow__edge-${r}`,o,{selected:l,animated:c,inactive:Ye,updating:te}]),onClick:Ve=>{var K;const{edges:Ke,addSelectedEdges:ee,unselectNodesAndEdges:ye,multiSelectionActive:we}=se.getState(),Ae=Ke.find(pe=>pe.id===n);Ae&&(E&&(se.setState({nodesSelectionActive:!1}),Ae.selected&&we?(ye({nodes:[],edges:[Ae]}),(K=Q.current)==null||K.blur()):ee([n])),i&&i(Ve,Ae))},onDoubleClick:re,onContextMenu:ue,onMouseEnter:le,onMouseMove:je,onMouseLeave:Se,onKeyDown:Y?Ve=>{var Ke;if(!$&&l2.includes(Ve.key)&&E){const{unselectNodesAndEdges:ee,addSelectedEdges:ye,edges:we}=se.getState();Ve.key==="Escape"?((Ke=Q.current)==null||Ke.blur(),ee({edges:[we.find(Ae=>Ae.id===n)]})):ye([n])}}:void 0,tabIndex:Y?0:void 0,role:Y?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":X===null?void 0:X||`Edge from ${b} to ${y}`,"aria-describedby":Y?`${z2}-${V}`:void 0,ref:Q},!ne&&q.createElement(t,{id:n,source:b,target:y,selected:l,animated:c,label:d,labelStyle:h,labelShowBg:f,labelBgStyle:m,labelBgPadding:g,labelBgBorderRadius:x,data:s,style:p,sourceX:v,sourceY:w,targetX:j,targetY:C,sourcePosition:N,targetPosition:S,sourceHandleId:I,targetHandleId:D,markerStart:ae,markerEnd:fe,pathOptions:W,interactionWidth:J}),G&&q.createElement(q.Fragment,null,(G==="source"||G===!0)&&q.createElement(iw,{position:N,centerX:v,centerY:w,radius:z,onMouseDown:Ve=>Le(Ve,!0),onMouseEnter:Ie,onMouseOut:ke,type:"source"}),(G==="target"||G===!0)&&q.createElement(iw,{position:S,centerX:j,centerY:C,radius:z,onMouseDown:Ve=>Le(Ve,!1),onMouseEnter:Ie,onMouseOut:ke,type:"target"})))};return e.displayName="EdgeWrapper",M.memo(e)};function vM(t){return{default:rs(t.default||Ul),straight:rs(t.bezier||Jh),step:rs(t.step||Xh),smoothstep:rs(t.step||zl),simplebezier:rs(t.simplebezier||Yh),...Object.keys(t).filter(e=>!["default","bezier"].includes(e)).reduce((e,n)=>(e[n]=rs(t[n]||Ul),e),{})}}function aw(t,e,n=null){const o=((n==null?void 0:n.x)||0)+e.x,r=((n==null?void 0:n.y)||0)+e.y,s=(n==null?void 0:n.width)||e.width,i=(n==null?void 0:n.height)||e.height;switch(t){case Oe.Top:return{x:o+s/2,y:r};case Oe.Right:return{x:o+s,y:r+i/2};case Oe.Bottom:return{x:o+s/2,y:r+i};case Oe.Left:return{x:o,y:r+i/2}}}function lw(t,e){return t?t.length!==1&&e?e&&t.find(n=>n.id===e)||null:t[0]:null}function cw(t){var o,r,s,i,a;const e=((o=t==null?void 0:t[yt])==null?void 0:o.handleBounds)||null,n=e&&(t==null?void 0:t.width)&&(t==null?void 0:t.height)&&((r=t==null?void 0:t.positionAbsolute)==null?void 0:r.x)!==void 0&&((s=t==null?void 0:t.positionAbsolute)==null?void 0:s.y)!==void 0;return[{x:((i=t==null?void 0:t.positionAbsolute)==null?void 0:i.x)||0,y:((a=t==null?void 0:t.positionAbsolute)==null?void 0:a.y)||0,width:(t==null?void 0:t.width)||0,height:(t==null?void 0:t.height)||0},e,!!n]}const wM=[{level:0,isMaxLevel:!0,edges:[]}];function kM(t,e,n){return function(o,r,s=!1){let i=-1;const a=o.reduce((c,d)=>{var m,g;const h=Nn(d.zIndex);let f=h?d.zIndex:0;if(s){const x=r.get(d.target),p=r.get(d.source),b=d.selected||(x==null?void 0:x.selected)||(p==null?void 0:p.selected),y=Math.max(((m=p==null?void 0:p[yt])==null?void 0:m.z)||0,((g=x==null?void 0:x[yt])==null?void 0:g.z)||0,1e3);f=(h?d.zIndex:0)+(b?y:0)}return c[f]?c[f].push(d):c[f]=[d],i=f>i?f:i,c},{}),l=Object.entries(a).map(([c,d])=>{const h=+c;return{edges:d,level:h,isMaxLevel:h===i}});return l.length===0?wM:l}(dt(M.useCallback(o=>t?o.edges.filter(r=>{const s=e.get(r.source),i=e.get(r.target);return(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&(i==null?void 0:i.width)&&(i==null?void 0:i.height)&&function({sourcePos:a,targetPos:l,sourceWidth:c,sourceHeight:d,targetWidth:h,targetHeight:f,width:m,height:g,transform:x}){const p={x:Math.min(a.x,l.x),y:Math.min(a.y,l.y),x2:Math.max(a.x+c,l.x+h),y2:Math.max(a.y+d,l.y+f)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const b=Hh({x:(0-x[0])/x[2],y:(0-x[1])/x[2],width:m/x[2],height:g/x[2]}),y=Math.max(0,Math.min(b.x2,p.x2)-Math.max(b.x,p.x)),v=Math.max(0,Math.min(b.y2,p.y2)-Math.max(b.y,p.y));return Math.ceil(y*v)>0}({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:i.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:i.width,targetHeight:i.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[t,e])),e,n)}const dw={[Jr.Arrow]:({color:t="none",strokeWidth:e=1})=>q.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[Jr.ArrowClosed]:({color:t="none",strokeWidth:e=1})=>q.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},CM=({id:t,type:e,color:n,width:o=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:a="auto-start-reverse"})=>{const l=function(c){const d=Ft();return M.useMemo(()=>{var h,f;return Object.prototype.hasOwnProperty.call(dw,c)?dw[c]:((f=(h=d.getState()).onError)==null||f.call(h,"009",IT(c)),null)},[c])}(e);return l?q.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:a,refX:"0",refY:"0"},q.createElement(l,{color:n,strokeWidth:i})):null},uw=({defaultColor:t,rfId:e})=>{const n=dt(M.useCallback((({defaultColor:o,rfId:r})=>s=>{const i=[];return s.edges.reduce((a,l)=>([l.markerStart,l.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const d=Qh(c,r);i.includes(d)||(a.push({id:d,color:c.color||o,...c}),i.push(d))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))})({defaultColor:t,rfId:e}),[t,e]),(o,r)=>!(o.length!==r.length||o.some((s,i)=>s.id!==r[i].id)));return q.createElement("defs",null,n.map(o=>q.createElement(CM,{id:o.id,key:o.id,type:o.type,color:o.color,width:o.width,height:o.height,markerUnits:o.markerUnits,strokeWidth:o.strokeWidth,orient:o.orient})))};uw.displayName="MarkerDefinitions";var jM=M.memo(uw);const SM=t=>({nodesConnectable:t.nodesConnectable,edgesFocusable:t.edgesFocusable,edgesUpdatable:t.edgesUpdatable,elementsSelectable:t.elementsSelectable,width:t.width,height:t.height,connectionMode:t.connectionMode,nodeInternals:t.nodeInternals,onError:t.onError}),hw=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:o,edgeTypes:r,noPanClassName:s,onEdgeContextMenu:i,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:d,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:m,onReconnectEnd:g,reconnectRadius:x,children:p,disableKeyboardA11y:b})=>{const{edgesFocusable:y,edgesUpdatable:v,elementsSelectable:w,width:j,height:C,connectionMode:N,nodeInternals:S,onError:E}=dt(SM,Wt),T=kM(e,S,n);return j?q.createElement(q.Fragment,null,T.map(({level:I,edges:D,isMaxLevel:F})=>q.createElement("svg",{key:I,style:{zIndex:I},width:j,height:C,className:"react-flow__edges react-flow__container"},F&&q.createElement(jM,{defaultColor:t,rfId:o}),q.createElement("g",null,D.map(O=>{const[R,P,z]=cw(S.get(O.source)),[_,k,B]=cw(S.get(O.target));if(!z||!B)return null;let A=O.type||"default";r[A]||(E==null||E("011",MT(A)),A="default");const U=r[A]||r.default,V=N===hr.Strict?k.target:(k.target??[]).concat(k.source??[]),X=lw(P.source,O.sourceHandle),Y=lw(V,O.targetHandle),G=(X==null?void 0:X.position)||Oe.Bottom,W=(Y==null?void 0:Y.position)||Oe.Top,J=!!(O.focusable||y&&O.focusable===void 0),$=O.reconnectable||O.updatable,Q=f!==void 0&&($||v&&$===void 0);if(!X||!Y)return E==null||E("008",AT(X,O)),null;const{sourceX:te,sourceY:oe,targetX:ne,targetY:ie}=((se,ae,fe,re,ue,le)=>{const je=aw(fe,se,ae),Se=aw(le,re,ue);return{sourceX:je.x,sourceY:je.y,targetX:Se.x,targetY:Se.y}})(R,X,G,_,Y,W);return q.createElement(U,{key:O.id,id:O.id,className:Qt([O.className,s]),type:A,data:O.data,selected:!!O.selected,animated:!!O.animated,hidden:!!O.hidden,label:O.label,labelStyle:O.labelStyle,labelShowBg:O.labelShowBg,labelBgStyle:O.labelBgStyle,labelBgPadding:O.labelBgPadding,labelBgBorderRadius:O.labelBgBorderRadius,style:O.style,source:O.source,target:O.target,sourceHandleId:O.sourceHandle,targetHandleId:O.targetHandle,markerEnd:O.markerEnd,markerStart:O.markerStart,sourceX:te,sourceY:oe,targetX:ne,targetY:ie,sourcePosition:G,targetPosition:W,elementsSelectable:w,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:d,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:m,onReconnectEnd:g,reconnectRadius:x,rfId:o,ariaLabel:O.ariaLabel,isFocusable:J,isReconnectable:Q,pathOptions:"pathOptions"in O?O.pathOptions:void 0,interactionWidth:O.interactionWidth,disableKeyboardA11y:b})})))),p):null};hw.displayName="EdgeRenderer";var NM=M.memo(hw);const EM=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function _M({children:t}){const e=dt(EM);return q.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}const IM={[Oe.Left]:Oe.Right,[Oe.Right]:Oe.Left,[Oe.Top]:Oe.Bottom,[Oe.Bottom]:Oe.Top},fw=({nodeId:t,handleType:e,style:n,type:o=Uo.Bezier,CustomComponent:r,connectionStatus:s})=>{var C,N,S;const{fromNode:i,handleId:a,toX:l,toY:c,connectionMode:d}=dt(M.useCallback(E=>({fromNode:E.nodeInternals.get(t),handleId:E.connectionHandleId,toX:(E.connectionPosition.x-E.transform[0])/E.transform[2],toY:(E.connectionPosition.y-E.transform[1])/E.transform[2],connectionMode:E.connectionMode}),[t]),Wt),h=(C=i==null?void 0:i[yt])==null?void 0:C.handleBounds;let f=h==null?void 0:h[e];if(d===hr.Loose&&(f=f||(h==null?void 0:h[e==="source"?"target":"source"])),!i||!f)return null;const m=a?f.find(E=>E.id===a):f[0],g=m?m.x+m.width/2:(i.width??0)/2,x=m?m.y+m.height/2:i.height??0,p=(((N=i.positionAbsolute)==null?void 0:N.x)??0)+g,b=(((S=i.positionAbsolute)==null?void 0:S.y)??0)+x,y=m==null?void 0:m.position,v=y?IM[y]:null;if(!y||!v)return null;if(r)return q.createElement(r,{connectionLineType:o,connectionLineStyle:n,fromNode:i,fromHandle:m,fromX:p,fromY:b,toX:l,toY:c,fromPosition:y,toPosition:v,connectionStatus:s});let w="";const j={sourceX:p,sourceY:b,sourcePosition:y,targetX:l,targetY:c,targetPosition:v};return o===Uo.Bezier?[w]=v2(j):o===Uo.Step?[w]=Kh({...j,borderRadius:0}):o===Uo.SmoothStep?[w]=Kh(j):o===Uo.SimpleBezier?[w]=g2(j):w=`M${p},${b} ${l},${c}`,q.createElement("path",{d:w,fill:"none",className:"react-flow__connection-path",style:n})};fw.displayName="ConnectionLine";const AM=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function TM({containerStyle:t,style:e,type:n,component:o}){const{nodeId:r,handleType:s,nodesConnectable:i,width:a,height:l,connectionStatus:c}=dt(AM,Wt);return r&&s&&a&&i?q.createElement("svg",{style:t,width:a,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},q.createElement("g",{className:Qt(["react-flow__connection",c])},q.createElement(fw,{nodeId:r,handleType:s,style:e,type:n,CustomComponent:o,connectionStatus:c}))):null}function mw(t,e){return M.useRef(null),Ft(),M.useMemo(()=>e(t),[t])}const pw=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:o,onMoveEnd:r,onInit:s,onNodeClick:i,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:c,onNodeMouseEnter:d,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:m,onSelectionContextMenu:g,onSelectionStart:x,onSelectionEnd:p,connectionLineType:b,connectionLineStyle:y,connectionLineComponent:v,connectionLineContainerStyle:w,selectionKeyCode:j,selectionOnDrag:C,selectionMode:N,multiSelectionKeyCode:S,panActivationKeyCode:E,zoomActivationKeyCode:T,deleteKeyCode:I,onlyRenderVisibleElements:D,elementsSelectable:F,selectNodesOnDrag:O,defaultViewport:R,translateExtent:P,minZoom:z,maxZoom:_,preventScrolling:k,defaultMarkerColor:B,zoomOnScroll:A,zoomOnPinch:U,panOnScroll:V,panOnScrollSpeed:X,panOnScrollMode:Y,zoomOnDoubleClick:G,panOnDrag:W,onPaneClick:J,onPaneMouseEnter:$,onPaneMouseMove:Q,onPaneMouseLeave:te,onPaneScroll:oe,onPaneContextMenu:ne,onEdgeContextMenu:ie,onEdgeMouseEnter:se,onEdgeMouseMove:ae,onEdgeMouseLeave:fe,onReconnect:re,onReconnectStart:ue,onReconnectEnd:le,reconnectRadius:je,noDragClassName:Se,noWheelClassName:Le,noPanClassName:Ie,elevateEdgesOnSelect:ke,disableKeyboardA11y:Ye,nodeOrigin:Ve,nodeExtent:Ke,rfId:ee})=>{const ye=mw(t,mM),we=mw(e,vM);return function(Ae){const K=Ni(),pe=M.useRef(!1);M.useEffect(()=>{!pe.current&&K.viewportInitialized&&Ae&&(setTimeout(()=>Ae(K),1),pe.current=!0)},[Ae,K.viewportInitialized])}(s),q.createElement(fM,{onPaneClick:J,onPaneMouseEnter:$,onPaneMouseMove:Q,onPaneMouseLeave:te,onPaneContextMenu:ne,onPaneScroll:oe,deleteKeyCode:I,selectionKeyCode:j,selectionOnDrag:C,selectionMode:N,onSelectionStart:x,onSelectionEnd:p,multiSelectionKeyCode:S,panActivationKeyCode:E,zoomActivationKeyCode:T,elementsSelectable:F,onMove:n,onMoveStart:o,onMoveEnd:r,zoomOnScroll:A,zoomOnPinch:U,zoomOnDoubleClick:G,panOnScroll:V,panOnScrollSpeed:X,panOnScrollMode:Y,panOnDrag:W,defaultViewport:R,translateExtent:P,minZoom:z,maxZoom:_,onSelectionContextMenu:g,preventScrolling:k,noDragClassName:Se,noWheelClassName:Le,noPanClassName:Ie,disableKeyboardA11y:Ye},q.createElement(_M,null,q.createElement(NM,{edgeTypes:we,onEdgeClick:a,onEdgeDoubleClick:c,onlyRenderVisibleElements:D,onEdgeContextMenu:ie,onEdgeMouseEnter:se,onEdgeMouseMove:ae,onEdgeMouseLeave:fe,onReconnect:re,onReconnectStart:ue,onReconnectEnd:le,reconnectRadius:je,defaultMarkerColor:B,noPanClassName:Ie,elevateEdgesOnSelect:!!ke,disableKeyboardA11y:Ye,rfId:ee},q.createElement(TM,{style:y,type:b,component:v,containerStyle:w})),q.createElement("div",{className:"react-flow__edgelabel-renderer"}),q.createElement(gM,{nodeTypes:ye,onNodeClick:i,onNodeDoubleClick:l,onNodeMouseEnter:d,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:m,selectNodesOnDrag:O,onlyRenderVisibleElements:D,noPanClassName:Ie,noDragClassName:Se,disableKeyboardA11y:Ye,nodeOrigin:Ve,nodeExtent:Ke,rfId:ee})))};pw.displayName="GraphView";var MM=M.memo(pw);const ff=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ho={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:ff,nodeExtent:ff,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:hr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:(t,e)=>{},isValidConnection:void 0},OM=()=>((t,e)=>t?Qv(t,e):Qv)((t,e)=>({...Ho,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:s}=e();t({nodeInternals:af(n,o,r,s)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:o={}}=e();t({edges:n.map(r=>({...o,...r}))})},setDefaultNodesAndEdges:(n,o)=>{const r=n!==void 0,s=o!==void 0,i=r?af(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:i,edges:s?o:[],hasDefaultNodes:r,hasDefaultEdges:s})},updateNodeDimensions:n=>{const{onNodesChange:o,nodeInternals:r,fitViewOnInit:s,fitViewOnInitDone:i,fitViewOnInitOptions:a,domNode:l,nodeOrigin:c}=e(),d=l==null?void 0:l.querySelector(".react-flow__viewport");if(!d)return;const h=window.getComputedStyle(d),{m22:f}=new window.DOMMatrixReadOnly(h.transform),m=n.reduce((x,p)=>{const b=r.get(p.id);if(b!=null&&b.hidden)r.set(b.id,{...b,[yt]:{...b[yt],handleBounds:void 0}});else if(b){const y=$h(p.nodeElement);!(!y.width||!y.height||b.width===y.width&&b.height===y.height&&!p.forceUpdate)&&(r.set(b.id,{...b,[yt]:{...b[yt],handleBounds:{source:ew(".source",p.nodeElement,f,c),target:ew(".target",p.nodeElement,f,c)}},...y}),x.push({id:b.id,type:"dimensions",dimensions:y}))}return x},[]);V2(r,c);const g=i||s&&!i&&H2(e,{initial:!0,...a});t({nodeInternals:new Map(r),fitViewOnInitDone:g}),(m==null?void 0:m.length)>0&&(o==null||o(m))},updateNodePositions:(n,o=!0,r=!1)=>{const{triggerNodeChanges:s}=e(),i=n.map(a=>{const l={id:a.id,type:"position",dragging:r};return o&&(l.positionAbsolute=a.positionAbsolute,l.position=a.position),l});s(i)},triggerNodeChanges:n=>{const{onNodesChange:o,nodeInternals:r,hasDefaultNodes:s,nodeOrigin:i,getNodes:a,elevateNodesOnSelect:l}=e();if(n!=null&&n.length){if(s){const c=af(K2(n,a()),r,i,l);t({nodeInternals:c})}o==null||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let i,a=null;o?i=n.map(l=>Vo(l,!0)):(i=ns(s(),n),a=ns(r,[])),Vl({changedNodes:i,changedEdges:a,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=e();let i,a=null;o?i=n.map(l=>Vo(l,!0)):(i=ns(r,n),a=ns(s(),[])),Vl({changedNodes:a,changedEdges:i,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:s}=e(),i=o||r;Vl({changedNodes:(n||s()).map(a=>(a.selected=!1,Vo(a.id,!1))),changedEdges:i.map(a=>Vo(a.id,!1)),get:e,set:t})},setMinZoom:n=>{const{d3Zoom:o,maxZoom:r}=e();o==null||o.scaleExtent([n,r]),t({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:o,minZoom:r}=e();o==null||o.scaleExtent([r,n]),t({maxZoom:n})},setTranslateExtent:n=>{var o;(o=e().d3Zoom)==null||o.translateExtent(n),t({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:o}=e();Vl({changedNodes:o().filter(r=>r.selected).map(r=>Vo(r.id,!1)),changedEdges:n.filter(r=>r.selected).map(r=>Vo(r.id,!1)),get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:o}=e();o.forEach(r=>{r.positionAbsolute=Vh(r.position,n)}),t({nodeExtent:n,nodeInternals:new Map(o)})},panBy:n=>{const{transform:o,width:r,height:s,d3Zoom:i,d3Selection:a,translateExtent:l}=e();if(!i||!a||!n.x&&!n.y)return!1;const c=Qo.translate(o[0]+n.x,o[1]+n.y).scale(o[2]),d=[[0,0],[r,s]],h=i==null?void 0:i.constrain()(c,d,l);return i.transform(a,h),o[0]!==h.x||o[1]!==h.y||o[2]!==h.k},cancelConnection:()=>t({connectionNodeId:Ho.connectionNodeId,connectionHandleId:Ho.connectionHandleId,connectionHandleType:Ho.connectionHandleType,connectionStatus:Ho.connectionStatus,connectionStartHandle:Ho.connectionStartHandle,connectionEndHandle:Ho.connectionEndHandle}),reset:()=>t({...Ho})}),Object.is),mf=({children:t})=>{const e=M.useRef(null);return e.current||(e.current=OM()),q.createElement(ST,{value:e.current},t)};mf.displayName="ReactFlowProvider";const gw=({children:t})=>M.useContext(Rl)?q.createElement(q.Fragment,null,t):q.createElement(mf,null,t);gw.displayName="ReactFlowWrapper";const DM={input:O2,default:rf,output:R2,group:sf},RM={default:Ul,straight:Jh,step:Xh,smoothstep:zl,simplebezier:Yh},PM=[0,0],LM=[15,15],FM={x:0,y:0,zoom:1},zM={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},pf=M.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s=DM,edgeTypes:i=RM,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:d,onMoveStart:h,onMoveEnd:f,onConnect:m,onConnectStart:g,onConnectEnd:x,onClickConnectStart:p,onClickConnectEnd:b,onNodeMouseEnter:y,onNodeMouseMove:v,onNodeMouseLeave:w,onNodeContextMenu:j,onNodeDoubleClick:C,onNodeDragStart:N,onNodeDrag:S,onNodeDragStop:E,onNodesDelete:T,onEdgesDelete:I,onSelectionChange:D,onSelectionDragStart:F,onSelectionDrag:O,onSelectionDragStop:R,onSelectionContextMenu:P,onSelectionStart:z,onSelectionEnd:_,connectionMode:k=hr.Strict,connectionLineType:B=Uo.Bezier,connectionLineStyle:A,connectionLineComponent:U,connectionLineContainerStyle:V,deleteKeyCode:X="Backspace",selectionKeyCode:Y="Shift",selectionOnDrag:G=!1,selectionMode:W=Ci.Full,panActivationKeyCode:J="Space",multiSelectionKeyCode:$=Ll()?"Meta":"Control",zoomActivationKeyCode:Q=Ll()?"Meta":"Control",snapToGrid:te=!1,snapGrid:oe=LM,onlyRenderVisibleElements:ne=!1,selectNodesOnDrag:ie=!0,nodesDraggable:se,nodesConnectable:ae,nodesFocusable:fe,nodeOrigin:re=PM,edgesFocusable:ue,edgesUpdatable:le,elementsSelectable:je,defaultViewport:Se=FM,minZoom:Le=.5,maxZoom:Ie=2,translateExtent:ke=ff,preventScrolling:Ye=!0,nodeExtent:Ve,defaultMarkerColor:Ke="#b1b1b7",zoomOnScroll:ee=!0,zoomOnPinch:ye=!0,panOnScroll:we=!1,panOnScrollSpeed:Ae=.5,panOnScrollMode:K=Bo.Free,zoomOnDoubleClick:pe=!0,panOnDrag:ge=!0,onPaneClick:he,onPaneMouseEnter:Ce,onPaneMouseMove:Re,onPaneMouseLeave:Pe,onPaneScroll:He,onPaneContextMenu:ce,children:Te,onEdgeContextMenu:Me,onEdgeDoubleClick:Ue,onEdgeMouseEnter:qe,onEdgeMouseMove:De,onEdgeMouseLeave:$e,onEdgeUpdate:st,onEdgeUpdateStart:Xe,onEdgeUpdateEnd:it,onReconnect:Ut,onReconnectStart:qt,onReconnectEnd:xn,reconnectRadius:en=10,edgeUpdaterRadius:Ln=10,onNodesChange:is,onEdgesChange:Xn,noDragClassName:So="nodrag",noWheelClassName:_n="nowheel",noPanClassName:as="nopan",fitView:Ai=!1,fitViewOptions:pO,connectOnClick:gO=!0,attributionPosition:xO,proOptions:bO,defaultEdgeOptions:yO,elevateNodesOnSelect:vO=!0,elevateEdgesOnSelect:wO=!1,disableKeyboardA11y:l3=!1,autoPanOnConnect:kO=!0,autoPanOnNodeDrag:CO=!0,connectionRadius:jO=20,isValidConnection:SO,onError:NO,style:EO,id:c3,nodeDragThreshold:_O,...IO},AO)=>{const im=c3||"1";return q.createElement("div",{...IO,style:{...EO,...zM},ref:AO,className:Qt(["react-flow",r]),"data-testid":"rf__wrapper",id:c3},q.createElement(gw,null,q.createElement(MM,{onInit:c,onMove:d,onMoveStart:h,onMoveEnd:f,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:y,onNodeMouseMove:v,onNodeMouseLeave:w,onNodeContextMenu:j,onNodeDoubleClick:C,nodeTypes:s,edgeTypes:i,connectionLineType:B,connectionLineStyle:A,connectionLineComponent:U,connectionLineContainerStyle:V,selectionKeyCode:Y,selectionOnDrag:G,selectionMode:W,deleteKeyCode:X,multiSelectionKeyCode:$,panActivationKeyCode:J,zoomActivationKeyCode:Q,onlyRenderVisibleElements:ne,selectNodesOnDrag:ie,defaultViewport:Se,translateExtent:ke,minZoom:Le,maxZoom:Ie,preventScrolling:Ye,zoomOnScroll:ee,zoomOnPinch:ye,zoomOnDoubleClick:pe,panOnScroll:we,panOnScrollSpeed:Ae,panOnScrollMode:K,panOnDrag:ge,onPaneClick:he,onPaneMouseEnter:Ce,onPaneMouseMove:Re,onPaneMouseLeave:Pe,onPaneScroll:He,onPaneContextMenu:ce,onSelectionContextMenu:P,onSelectionStart:z,onSelectionEnd:_,onEdgeContextMenu:Me,onEdgeDoubleClick:Ue,onEdgeMouseEnter:qe,onEdgeMouseMove:De,onEdgeMouseLeave:$e,onReconnect:Ut??st,onReconnectStart:qt??Xe,onReconnectEnd:xn??it,reconnectRadius:en??Ln,defaultMarkerColor:Ke,noDragClassName:So,noWheelClassName:_n,noPanClassName:as,elevateEdgesOnSelect:wO,rfId:im,disableKeyboardA11y:l3,nodeOrigin:re,nodeExtent:Ve}),q.createElement(YT,{nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:m,onConnectStart:g,onConnectEnd:x,onClickConnectStart:p,onClickConnectEnd:b,nodesDraggable:se,nodesConnectable:ae,nodesFocusable:fe,edgesFocusable:ue,edgesUpdatable:le,elementsSelectable:je,elevateNodesOnSelect:vO,minZoom:Le,maxZoom:Ie,nodeExtent:Ve,onNodesChange:is,onEdgesChange:Xn,snapToGrid:te,snapGrid:oe,connectionMode:k,translateExtent:ke,connectOnClick:gO,defaultEdgeOptions:yO,fitView:Ai,fitViewOptions:pO,onNodesDelete:T,onEdgesDelete:I,onNodeDragStart:N,onNodeDrag:S,onNodeDragStop:E,onSelectionDrag:O,onSelectionDragStart:F,onSelectionDragStop:R,noPanClassName:as,nodeOrigin:re,rfId:im,autoPanOnConnect:kO,autoPanOnNodeDrag:CO,onError:NO,connectionRadius:jO,isValidConnection:SO,nodeDragThreshold:_O}),q.createElement(qT,{onSelectionChange:D}),Te,q.createElement(RT,{proOptions:bO,position:xO}),q.createElement(ZT,{rfId:im,disableKeyboardA11y:l3})))});function xw(t){return e=>{const[n,o]=M.useState(e),r=M.useCallback(s=>o(i=>t(s,i)),[]);return[n,o,r]}}pf.displayName="ReactFlow";const bw=xw(K2),yw=xw(function(t,e){return Y2(t,e)});function BM(){return q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},q.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function UM(){return q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},q.createElement("path",{d:"M0 0h32v4.2H0z"}))}function $M(){return q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},q.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function VM(){return q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},q.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function HM(){return q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},q.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const ss=({children:t,className:e,...n})=>q.createElement("button",{type:"button",className:Qt(["react-flow__controls-button",e]),...n},t);ss.displayName="ControlButton";const WM=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),vw=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:i,onFitView:a,onInteractiveChange:l,className:c,children:d,position:h="bottom-left"})=>{const f=Ft(),[m,g]=M.useState(!1),{isInteractive:x,minZoomReached:p,maxZoomReached:b}=dt(WM,Wt),{zoomIn:y,zoomOut:v,fitView:w}=Ni();return M.useEffect(()=>{g(!0)},[]),m?q.createElement(Pl,{className:Qt(["react-flow__controls",c]),position:h,style:t,"data-testid":"rf__controls"},e&&q.createElement(q.Fragment,null,q.createElement(ss,{onClick:()=>{y(),s==null||s()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},q.createElement(BM,null)),q.createElement(ss,{onClick:()=>{v(),i==null||i()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:p},q.createElement(UM,null))),n&&q.createElement(ss,{className:"react-flow__controls-fitview",onClick:()=>{w(r),a==null||a()},title:"fit view","aria-label":"fit view"},q.createElement($M,null)),o&&q.createElement(ss,{className:"react-flow__controls-interactive",onClick:()=>{f.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),l==null||l(!x)},title:"toggle interactivity","aria-label":"toggle interactivity"},x?q.createElement(HM,null):q.createElement(VM,null)),d):null};vw.displayName="Controls";var En,qM=M.memo(vw);function GM({color:t,dimensions:e,lineWidth:n}){return q.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function YM({color:t,radius:e}){return q.createElement("circle",{cx:e,cy:e,r:e,fill:t})}(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(En||(En={}));const KM={[En.Dots]:"#91919a",[En.Lines]:"#eee",[En.Cross]:"#e2e2e2"},XM={[En.Dots]:1,[En.Lines]:1,[En.Cross]:6},JM=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function ww({id:t,variant:e=En.Dots,gap:n=20,size:o,lineWidth:r=1,offset:s=2,color:i,style:a,className:l}){const c=M.useRef(null),{transform:d,patternId:h}=dt(JM,Wt),f=i||KM[e],m=o||XM[e],g=e===En.Dots,x=e===En.Cross,p=Array.isArray(n)?n:[n,n],b=[p[0]*d[2]||1,p[1]*d[2]||1],y=m*d[2],v=x?[y,y]:b,w=g?[y/s,y/s]:[v[0]/s,v[1]/s];return q.createElement("svg",{className:Qt(["react-flow__background",l]),style:{...a,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:c,"data-testid":"rf__background"},q.createElement("pattern",{id:h+t,x:d[0]%b[0],y:d[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${w[0]},-${w[1]})`},g?q.createElement(YM,{color:f,radius:y/s}):q.createElement(GM,{dimensions:v,color:f,lineWidth:r})),q.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+t})`}))}ww.displayName="Background";var ZM=M.memo(ww);function gf(t){return Math.min(11*t+35,200)}const kw=q.createContext("LR"),Cw=M.memo(t=>{const e=H.c(51),{data:n,selected:o}=t,r=Ne(n.atom),s=wr().inOrderIds.indexOf(r.id),i=o?"var(--gray-9)":"var(--gray-3)",a=dt(QM),l=M.use(kw);let c,d,h,f,m;if(e[0]!==r.code||e[1]!==i||e[2]!==l||e[3]!==o){const I=r.code.split(`
|
|
160
|
+
`).length,D=l==="LR"?Oe.Left:Oe.Top;let F;e[8]!==i?(F={background:i},e[8]=i,e[9]=F):F=e[9],e[10]!==D||e[11]!==F?(h=u.jsx($o,{type:"target",id:"inputs",position:D,style:F}),e[10]=D,e[11]=F,e[12]=h):h=e[12];const O=l==="LR"?Oe.Left:Oe.Top;let R;e[13]!==i?(R={background:i},e[13]=i,e[14]=R):R=e[14],e[15]!==O||e[16]!==R?(f=u.jsx($o,{type:"source",id:"inputs",position:O,style:R}),e[15]=O,e[16]=R,e[17]=f):f=e[17];const P=o&&"border-primary";e[18]!==P?(d=xe("flex flex-col bg-card border border-input/50 rounded-md mx-[2px] overflow-hidden",P),e[18]=P,e[19]=d):d=e[19],c=gf(I),e[0]=r.code,e[1]=i,e[2]=l,e[3]=o,e[4]=c,e[5]=d,e[6]=h,e[7]=f}else c=e[4],d=e[5],h=e[6],f=e[7];var g;let x;e[20]!==n.forceWidth||e[21]!==a?(m=n.forceWidth||(g=a,Math.min(Math.max(g-100,100),400)),e[20]=n.forceWidth,e[21]=a,e[22]=m):m=e[22],e[23]!==c||e[24]!==m?(x={height:c,width:m},e[23]=c,e[24]=m,e[25]=x):x=e[25];const p=hL(r.name,s);let b,y,v;e[26]!==p?(b=u.jsx("div",{className:"text-muted-foreground font-semibold text-xs py-1 px-2 bg-muted border-b",children:p}),e[26]=p,e[27]=b):b=e[27],e[28]!==r.code?(y=u.jsx($F,{code:r.code}),e[28]=r.code,e[29]=y):y=e[29],e[30]!==d||e[31]!==x||e[32]!==b||e[33]!==y?(v=u.jsxs("div",{className:d,style:x,children:[b,y]}),e[30]=d,e[31]=x,e[32]=b,e[33]=y,e[34]=v):v=e[34];const w=l==="LR"?Oe.Right:Oe.Bottom;let j,C;e[35]!==i?(j={background:i},e[35]=i,e[36]=j):j=e[36],e[37]!==w||e[38]!==j?(C=u.jsx($o,{type:"source",id:"outputs",position:w,style:j}),e[37]=w,e[38]=j,e[39]=C):C=e[39];const N=l==="LR"?Oe.Right:Oe.Bottom;let S,E,T;return e[40]!==i?(S={background:i},e[40]=i,e[41]=S):S=e[41],e[42]!==N||e[43]!==S?(E=u.jsx($o,{type:"target",id:"outputs",position:N,style:S}),e[42]=N,e[43]=S,e[44]=E):E=e[44],e[45]!==v||e[46]!==C||e[47]!==E||e[48]!==h||e[49]!==f?(T=u.jsxs("div",{children:[h,f,v,C,E]}),e[45]=v,e[46]=C,e[47]=E,e[48]=h,e[49]=f,e[50]=T):T=e[50],T},(t,e)=>["data","selected","id"].every(n=>t[n]===e[n]));Cw.displayName="CustomNode";const jw={custom:Cw};function QM(t){const{width:e}=t;return e}const Sw=t=>{const e=H.c(18),{maxCount:n,cellIds:o,onClick:r,skipScroll:s}=t,i=wr();let a,l,c,d;if(e[0]!==o||e[1]!==i||e[2]!==n||e[3]!==r||e[4]!==s){c=Symbol.for("react.early_return_sentinel");e:{let h;e[8]!==i?(h=(g,x)=>i.inOrderIds.indexOf(g)-i.inOrderIds.indexOf(x),e[8]=i,e[9]=h):h=e[9];const f=[...o].sort(h);if(o.length===0){let g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("div",{className:"text-muted-foreground",children:"--"}),e[10]=g):g=e[10],c=g;break e}let m;e[11]!==o.length||e[12]!==r||e[13]!==s?(m=(g,x)=>u.jsxs("span",{className:"truncate",children:[u.jsx(Mo,{variant:"focus",cellId:g,skipScroll:s,className:"whitespace-nowrap",onClick:r?()=>r(g):void 0},g),x<o.length-1&&", "]},g),e[11]=o.length,e[12]=r,e[13]=s,e[14]=m):m=e[14],a=f.slice(0,n).map(m),l=o.length>n&&u.jsxs(br,{children:[u.jsx(ws,{asChild:!0,children:u.jsxs("span",{className:"whitespace-nowrap text-muted-foreground text-xs hover:underline cursor-pointer",children:["+",o.length-n," more"]})}),u.jsx(ps,{className:"w-auto",children:u.jsx("div",{className:"flex flex-col gap-1 py-1",children:f.slice(n).map(g=>u.jsx(Mo,{variant:"focus",cellId:g,className:"whitespace-nowrap",onClick:r?()=>r(g):void 0},g))})})]})}e[0]=o,e[1]=i,e[2]=n,e[3]=r,e[4]=s,e[5]=a,e[6]=l,e[7]=c}else a=e[5],l=e[6],c=e[7];return c!==Symbol.for("react.early_return_sentinel")?c:(e[15]!==a||e[16]!==l?(d=u.jsxs(u.Fragment,{children:[a,l]}),e[15]=a,e[16]=l,e[17]=d):d=e[17],d)},xf=t=>{const e=H.c(15);let n,o,r,s;e[0]!==t?({name:o,declaredBy:n,onClick:r,...s}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s):(n=e[1],o=e[2],r=e[3],s=e[4]);const i=n.length>1?"destructive":"outline";let a,l,c;return e[5]!==o||e[6]!==r?(a=async d=>{r?r(d):(await sn(o),Je({title:"Copied to clipboard"}))},e[5]=o,e[6]=r,e[7]=a):a=e[7],e[8]!==o||e[9]!==i||e[10]!==a?(l=u.jsx(qC,{title:o,variant:i,className:"rounded-sm text-ellipsis block overflow-hidden max-w-fit cursor-pointer font-medium",onClick:a,children:o}),e[8]=o,e[9]=i,e[10]=a,e[11]=l):l=e[11],e[12]!==s||e[13]!==l?(c=u.jsx("div",{className:"max-w-[130px]",...s,children:l}),e[12]=s,e[13]=l,e[14]=c):c=e[14],c},bf=M.memo(t=>{const e=H.c(38),{onChange:n,view:o,settings:r,onSettingsChange:s}=t;let i;e[0]!==s||e[1]!==r?(i=(O,R)=>{s({...r,[O]:R})},e[0]=s,e[1]=r,e[2]=i):i=e[2];const a=i;let l,c,d,h,f,m;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(ws,{asChild:!0,children:u.jsx(ve,{variant:"text",size:"xs",children:u.jsx(_m,{className:"w-4 h-4"})})}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx("div",{className:"font-semibold pb-4",children:"Settings"}),e[4]=c):c=e[4],e[5]!==a?(d=O=>a("hidePureMarkdown",!!O),e[5]=a,e[6]=d):d=e[6],e[7]!==r.hidePureMarkdown||e[8]!==d?(h=u.jsx(yC,{"data-testid":"hide-pure-markdown-checkbox",id:"hide-pure-markdown",checked:r.hidePureMarkdown,onCheckedChange:d}),e[7]=r.hidePureMarkdown,e[8]=d,e[9]=h):h=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(gr,{htmlFor:"hide-pure-markdown",children:"Hide pure markdown"}),e[10]=f):f=e[10],e[11]!==h?(m=u.jsxs(br,{children:[l,u.jsxs(ps,{className:"w-auto p-2 text-muted-foreground",children:[c,u.jsxs("div",{className:"flex items-center gap-2",children:[h,f]})]})]}),e[11]=h,e[12]=m):m=e[12];const g=m,x=o==="_minimap_";let p,b,y;e[13]!==n?(p=()=>n("_minimap_"),e[13]=n,e[14]=p):p=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(Gp,{className:"w-4 h-4 mr-1"}),e[15]=b):b=e[15],e[16]!==x||e[17]!==p?(y=u.jsxs(ve,{variant:"outline",className:"bg-background","aria-selected":x,size:"xs",onClick:p,children:[b,"Mini Map"]}),e[16]=x,e[17]=p,e[18]=y):y=e[18];const v=o==="TB";let w,j,C;e[19]!==n?(w=()=>n("TB"),e[19]=n,e[20]=w):w=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx(ha,{className:"w-4 h-4 mr-1"}),e[21]=j):j=e[21],e[22]!==v||e[23]!==w?(C=u.jsxs(ve,{variant:"outline",className:"bg-background","aria-selected":v,size:"xs",onClick:w,children:[j,"Vertical Tree"]}),e[22]=v,e[23]=w,e[24]=C):C=e[24];const N=o==="LR";let S,E,T,I;e[25]!==n?(S=()=>n("LR"),e[25]=n,e[26]=S):S=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(E=u.jsx(ha,{className:"w-4 h-4 mr-1 transform -rotate-90"}),e[27]=E):E=e[27],e[28]!==N||e[29]!==S?(T=u.jsxs(ve,{variant:"outline",className:"bg-background","aria-selected":N,size:"xs",onClick:S,children:[E," ","Horizontal Tree"]}),e[28]=N,e[29]=S,e[30]=T):T=e[30],e[31]!==y||e[32]!==C||e[33]!==T?(I=u.jsxs("div",{className:"flex gap-2",children:[y,C,T]}),e[31]=y,e[32]=C,e[33]=T,e[34]=I):I=e[34];const D=o!=="_minimap_"&&g;let F;return e[35]!==I||e[36]!==D?(F=u.jsxs(Pl,{position:"top-right",className:"flex flex-col items-end gap-2",children:[I,D]}),e[35]=I,e[36]=D,e[37]=F):F=e[37],F});bf.displayName="GraphToolbar";const Wl=M.memo(t=>{const e=H.c(11),{selection:n,variables:o,onClearSelection:r}=t;if(!n)return null;const s=e7;let i;e[0]!==r||e[1]!==n.id||e[2]!==n.source||e[3]!==n.target||e[4]!==n.type||e[5]!==o?(i=()=>{if(n.type==="node"){const d=Object.values(o).filter(m=>m.usedBy.includes(n.id)),h=Object.values(o).filter(m=>m.declaredBy.includes(n.id)),f=(m,g)=>u.jsxs(u.Fragment,{children:[m.length===0&&u.jsx("div",{className:"text-muted-foreground text-sm text-center",children:"--"}),u.jsx("div",{className:"grid grid-cols-5 gap-3 items-center text-sm py-1 flex-1 empty:hidden",children:m.map(x=>u.jsxs(q.Fragment,{children:[u.jsx(xf,{declaredBy:x.declaredBy,name:x.name}),u.jsxs("div",{className:"truncate col-span-2",title:x.value??"",children:[x.value,u.jsxs("span",{className:"ml-1 truncate text-foreground/60 font-mono",children:["(",x.dataType,")"]})]}),u.jsx("div",{className:"truncate col-span-2 gap-1 items-center",children:u.jsx(Sw,{skipScroll:!0,onClick:()=>s(g==="in"?x.declaredBy[0]:x.usedBy[0],x.name),maxCount:3,cellIds:x.usedBy})})]},x.name))})]});return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[u.jsx(Kl,{className:"w-5 h-5"}),u.jsx(Mo,{cellId:n.id}),u.jsx("div",{className:"flex-1"}),u.jsx(Nx,{cellId:n.id,children:u.jsx(ve,{variant:"ghost",size:"icon",children:u.jsx(ed,{className:"w-4 h-4"})})}),u.jsx(ve,{variant:"text",size:"icon",onClick:()=>{r()},children:u.jsx(wn,{className:"w-4 h-4"})})]}),u.jsxs("div",{className:"text-sm flex flex-col py-3 pl-2 pr-4 flex-1 justify-center",children:[u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[u.jsx(gp,{className:"w-4 h-4"}),"Outputs"]}),f(h,"out")]}),u.jsx("hr",{className:"border-divider my-3"}),u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[u.jsx(nn,{className:"w-4 h-4"}),"Inputs"]}),f(d,"in")]})]})]})}if(n.type==="edge"){const d=Object.values(o).filter(h=>h.declaredBy.includes(n.source)&&h.usedBy.includes(n.target));return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[u.jsx(ma,{className:"w-4 h-4"}),u.jsx(Mo,{cellId:n.source}),u.jsx(Kc,{className:"w-4 h-4"}),u.jsx(Mo,{cellId:n.target})]}),u.jsx("div",{className:"grid grid-cols-4 gap-3 max-w-[350px] items-center text-sm p-3 flex-1",children:d.map(h=>u.jsxs(q.Fragment,{children:[u.jsx(xf,{declaredBy:h.declaredBy,name:h.name,onClick:()=>{s(h.declaredBy[0],h.name)}}),u.jsx("div",{className:"truncate text-foreground/60 font-mono",children:h.dataType}),u.jsx("div",{className:"truncate col-span-2",title:h.value??"",children:h.value})]},h.name))})]})}},e[0]=r,e[1]=n.id,e[2]=n.source,e[3]=n.target,e[4]=n.type,e[5]=o,e[6]=i):i=e[6];const a=i;let l,c;return e[7]!==a?(l=a(),e[7]=a,e[8]=l):l=e[8],e[9]!==l?(c=u.jsx(Pl,{position:"bottom-left",className:"max-h-[90%] flex flex-col w-[calc(100%-5rem)]",children:u.jsx("div",{className:"min-h-[100px] shadow-md rounded-md border max-w-[550px] border-primary/40 my-4 min-w-[240px] bg-(--slate-1) text-muted-foreground/80 flex flex-col overflow-y-auto",children:l})}),e[9]=l,e[10]=c):c=e[10],c});function e7(t,e){const n=Ri(t);n&&np(n,e)}function Nw(){const t=H.c(7),e=Ni(),n=dt(n7),o=dt(t7);let r;t[0]!==e?(r=()=>{e.fitView({duration:100})},t[0]=e,t[1]=r):r=t[1];const s=fL(r,100);let i,a;t[2]!==s||t[3]!==o||t[4]!==n?(i=()=>{n&&o&&s()},a=[n,o,s],t[2]=s,t[3]=o,t[4]=n,t[5]=i,t[6]=a):(i=t[5],a=t[6]),M.useEffect(i,a)}function t7(t){const{height:e}=t;return e}function n7(t){const{width:e}=t;return e}Wl.displayName="GraphSelectionPanel";const Ew=new class{createEdge(t,e,n){return{type:"smoothstep",pathOptions:{offset:20,borderRadius:100},data:{direction:n},markerEnd:{type:Jr.Arrow},id:`${t}-${e}-${n}`,source:t,sourceHandle:n,targetHandle:n,target:e}}createNode(t,e,n){return{id:t,data:{atom:e},width:250,type:"custom",height:gf(Qe.get(e).code.trim().split(`
|
|
161
161
|
`).length),position:{x:0,y:n+20}}}createElements(t,e,n,o){let r=0;const s=[],i=[];for(const[l,c]of ep.zip(t,e)){const d=this.createNode(l,c,r);s.push(d),r=d.position.y+(d.height||0)}const a=new Set;for(const l of Object.values(n)){const{declaredBy:c,usedBy:d}=l;for(const h of c)for(const f of d){const m=`${h}-${f}`;a.has(m)||(a.add(m),i.push(this.createEdge(h,f,"inputs"),this.createEdge(h,f,"outputs")))}}return{nodes:s,edges:i}}},o7=t=>{const e=H.c(37),{cellIds:n,variables:o,cellAtoms:r,children:s}=t;let i;e[0]!==r||e[1]!==n||e[2]!==o?(i=Ew.createElements(n,r,o,!1),e[0]=r,e[1]=n,e[2]=o,e[3]=i):i=e[3];const{nodes:a,edges:l}=i;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=[],e[4]=c):c=e[4];const[d,h]=yw(c),[f,m]=bw(a),[g,x]=M.useState(),[p,b]=M.useState(),y=M.useRef(!1);Nw();const v=dt(r7);let w;e[5]!==h||e[6]!==m?(w=k=>{m(k.nodes),h([])},e[5]=h,e[6]=m,e[7]=w):w=e[7];const j=Fe(w);let C,N,S,E;e[8]!==r||e[9]!==n||e[10]!==j||e[11]!==o?(C=()=>{y.current?j(Ew.createElements(n,r,o,!1)):y.current=!0},N=[n,o,r,j],e[8]=r,e[9]=n,e[10]=j,e[11]=o,e[12]=C,e[13]=N):(C=e[12],N=e[13]),M.useEffect(C,N),e[14]!==l||e[15]!==g||e[16]!==h?(S=()=>{if(g){const k=l.filter(B=>{const{source:A,target:U,data:V}=B;return A===g&&V.direction==="outputs"||U===g&&V.direction==="inputs"});h(k)}},E=[g,h,l],e[14]=l,e[15]=g,e[16]=h,e[17]=S,e[18]=E):(S=e[17],E=e[18]),M.useEffect(S,E);const T=function(k,B){const A=H.c(17);let U,V;if(A[0]!==B||A[1]!==k){let Q;A[3]!==B?(Q=(te,oe)=>{const{position:ne}=oe;return Math.min(te,ne.y-B/2-10)},A[3]=B,A[4]=Q):Q=A[4],V=k.reduce(Q,Number.POSITIVE_INFINITY),A[0]=B,A[1]=k,A[2]=V}else V=A[2];const X=V;let Y;if(A[5]!==B||A[6]!==k){let Q;A[8]!==B?(Q=(te,oe)=>{const{position:ne}=oe;return Math.max(te,ne.y+B/2+10)},A[8]=B,A[9]=Q):Q=A[9],Y=k.reduce(Q,Number.NEGATIVE_INFINITY),A[5]=B,A[6]=k,A[7]=Y}else Y=A[7];const G=Y;let W,J,$;return A[10]!==X?(W=[Number.NEGATIVE_INFINITY,X],A[10]=X,A[11]=W):W=A[11],A[12]!==G?(J=[Number.POSITIVE_INFINITY,G],A[12]=G,A[13]=J):J=A[13],A[14]!==W||A[15]!==J?($=[W,J],A[14]=W,A[15]=J,A[16]=$):$=A[16],U=$,U}(f,v);let I;e[19]===Symbol.for("react.memo_cache_sentinel")?(I=()=>{x(void 0),b(void 0)},e[19]=I):I=e[19];const D=I;let F;e[20]!==d||e[21]!==p||e[22]!==g||e[23]!==o?(F=()=>p?u.jsx(Wl,{selection:{type:"edge",source:p.source,target:p.target},onClearSelection:D,variables:o,edges:d}):g?u.jsx(Wl,{selection:{type:"node",id:g},variables:o,edges:d,onClearSelection:D}):null,e[20]=d,e[21]=p,e[22]=g,e[23]=o,e[24]=F):F=e[24];const O=F;let R,P,z,_;return e[25]!==h?(R=(k,B)=>{const A=B.id;x(A),b(void 0),h([])},e[25]=h,e[26]=R):R=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(P=(k,B)=>{b(B)},e[27]=P):P=e[27],e[28]!==O?(z=O(),e[28]=O,e[29]=z):z=e[29],e[30]!==s||e[31]!==d||e[32]!==f||e[33]!==R||e[34]!==z||e[35]!==T?(_=u.jsxs(pf,{nodes:f,edges:d,nodeTypes:jw,translateExtent:T,onNodeClick:R,onNodeDoubleClick:s7,onEdgeClick:P,snapToGrid:!0,fitView:!0,elementsSelectable:!0,minZoom:1,maxZoom:1,draggable:!1,panOnScrollMode:Bo.Vertical,zoomOnDoubleClick:!1,nodesDraggable:!1,nodesConnectable:!1,nodesFocusable:!1,edgesFocusable:!1,selectNodesOnDrag:!1,panOnDrag:!1,preventScrolling:!1,zoomOnPinch:!1,panOnScroll:!0,autoPanOnNodeDrag:!1,autoPanOnConnect:!1,children:[z,s]}),e[30]=s,e[31]=d,e[32]=f,e[33]=R,e[34]=z,e[35]=T,e[36]=_):_=e[36],_};function r7(t){const{height:e}=t;return e}function s7(t,e){GC(e.id,"focus")}var yf,_w,Iw,Aw,Tw,Mw,vf,Ow,wf,Dw,kf,Rw,Cf,Pw,jf,Lw,Sf,Fw,Nf,zw,Ef,Bw,_f,Uw,If,$w,Af,Vw,Tf,Hw,Mf,Ww,Of,qw,Gw,Yw,Kw,Xw,Jw,Zw,Df,Qw,Rf,ek,Pf,tk,Lf,nk,Ff,ok,zf,rk,Bf,sk,Uf,ik,$f,ak,Vf,lk,Hf,ck,Wf,dk,qf,uk,Gf,hk,fk,mk,pk,gk,xk,bk,Yf,yk,Kf,vk,wk,kk,Xf,Ck,Jf,jk,Zf,Sk,Qf,Nk,em,Ek,_k,Ik,Ak,Tk;function tm(){if(_w)return yf;_w=1;var t="\0";function e(s,i){s[i]?s[i]++:s[i]=1}function n(s,i){--s[i]||delete s[i]}function o(s,i,a,l){var c=""+i,d=""+a;if(!s&&c>d){var h=c;c=d,d=h}return c+""+d+""+(l===void 0?"\0":l)}function r(s,i){return o(s,i.v,i.w,i.name)}return yf=class{constructor(s){Z(this,"_isDirected",!0);Z(this,"_isMultigraph",!1);Z(this,"_isCompound",!1);Z(this,"_label");Z(this,"_defaultNodeLabelFn",()=>{});Z(this,"_defaultEdgeLabelFn",()=>{});Z(this,"_nodes",{});Z(this,"_in",{});Z(this,"_preds",{});Z(this,"_out",{});Z(this,"_sucs",{});Z(this,"_edgeObjs",{});Z(this,"_edgeLabels",{});Z(this,"_nodeCount",0);Z(this,"_edgeCount",0);Z(this,"_parent");Z(this,"_children");s&&(this._isDirected=!Object.hasOwn(s,"directed")||s.directed,this._isMultigraph=!!Object.hasOwn(s,"multigraph")&&s.multigraph,this._isCompound=!!Object.hasOwn(s,"compound")&&s.compound),this._isCompound&&(this._parent={},this._children={},this._children[t]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(s){return this._label=s,this}graph(){return this._label}setDefaultNodeLabel(s){return this._defaultNodeLabelFn=s,typeof s!="function"&&(this._defaultNodeLabelFn=()=>s),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var s=this;return this.nodes().filter(i=>Object.keys(s._in[i]).length===0)}sinks(){var s=this;return this.nodes().filter(i=>Object.keys(s._out[i]).length===0)}setNodes(s,i){var a=arguments,l=this;return s.forEach(function(c){a.length>1?l.setNode(c,i):l.setNode(c)}),this}setNode(s,i){return Object.hasOwn(this._nodes,s)?(arguments.length>1&&(this._nodes[s]=i),this):(this._nodes[s]=arguments.length>1?i:this._defaultNodeLabelFn(s),this._isCompound&&(this._parent[s]=t,this._children[s]={},this._children[t][s]=!0),this._in[s]={},this._preds[s]={},this._out[s]={},this._sucs[s]={},++this._nodeCount,this)}node(s){return this._nodes[s]}hasNode(s){return Object.hasOwn(this._nodes,s)}removeNode(s){var i=this;if(Object.hasOwn(this._nodes,s)){var a=l=>i.removeEdge(i._edgeObjs[l]);delete this._nodes[s],this._isCompound&&(this._removeFromParentsChildList(s),delete this._parent[s],this.children(s).forEach(function(l){i.setParent(l)}),delete this._children[s]),Object.keys(this._in[s]).forEach(a),delete this._in[s],delete this._preds[s],Object.keys(this._out[s]).forEach(a),delete this._out[s],delete this._sucs[s],--this._nodeCount}return this}setParent(s,i){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(i===void 0)i=t;else{for(var a=i+="";a!==void 0;a=this.parent(a))if(a===s)throw new Error("Setting "+i+" as parent of "+s+" would create a cycle");this.setNode(i)}return this.setNode(s),this._removeFromParentsChildList(s),this._parent[s]=i,this._children[i][s]=!0,this}_removeFromParentsChildList(s){delete this._children[this._parent[s]][s]}parent(s){if(this._isCompound){var i=this._parent[s];if(i!==t)return i}}children(s=t){if(this._isCompound){var i=this._children[s];if(i)return Object.keys(i)}else{if(s===t)return this.nodes();if(this.hasNode(s))return[]}}predecessors(s){var i=this._preds[s];if(i)return Object.keys(i)}successors(s){var i=this._sucs[s];if(i)return Object.keys(i)}neighbors(s){var i=this.predecessors(s);if(i){const l=new Set(i);for(var a of this.successors(s))l.add(a);return Array.from(l.values())}}isLeaf(s){return(this.isDirected()?this.successors(s):this.neighbors(s)).length===0}filterNodes(s){var i=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});i.setGraph(this.graph());var a=this;Object.entries(this._nodes).forEach(function([d,h]){s(d)&&i.setNode(d,h)}),Object.values(this._edgeObjs).forEach(function(d){i.hasNode(d.v)&&i.hasNode(d.w)&&i.setEdge(d,a.edge(d))});var l={};function c(d){var h=a.parent(d);return h===void 0||i.hasNode(h)?(l[d]=h,h):h in l?l[h]:c(h)}return this._isCompound&&i.nodes().forEach(d=>i.setParent(d,c(d))),i}setDefaultEdgeLabel(s){return this._defaultEdgeLabelFn=s,typeof s!="function"&&(this._defaultEdgeLabelFn=()=>s),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(s,i){var a=this,l=arguments;return s.reduce(function(c,d){return l.length>1?a.setEdge(c,d,i):a.setEdge(c,d),d}),this}setEdge(){var s,i,a,l,c=!1,d=arguments[0];typeof d=="object"&&d!==null&&"v"in d?(s=d.v,i=d.w,a=d.name,arguments.length===2&&(l=arguments[1],c=!0)):(s=d,i=arguments[1],a=arguments[3],arguments.length>2&&(l=arguments[2],c=!0)),s=""+s,i=""+i,a!==void 0&&(a=""+a);var h=o(this._isDirected,s,i,a);if(Object.hasOwn(this._edgeLabels,h))return c&&(this._edgeLabels[h]=l),this;if(a!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(i),this._edgeLabels[h]=c?l:this._defaultEdgeLabelFn(s,i,a);var f=function(m,g,x,p){var b=""+g,y=""+x;if(!m&&b>y){var v=b;b=y,y=v}var w={v:b,w:y};return p&&(w.name=p),w}(this._isDirected,s,i,a);return s=f.v,i=f.w,Object.freeze(f),this._edgeObjs[h]=f,e(this._preds[i],s),e(this._sucs[s],i),this._in[i][h]=f,this._out[s][h]=f,this._edgeCount++,this}edge(s,i,a){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,i,a);return this._edgeLabels[l]}edgeAsObj(){const s=this.edge(...arguments);return typeof s!="object"?{label:s}:s}hasEdge(s,i,a){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,i,a);return Object.hasOwn(this._edgeLabels,l)}removeEdge(s,i,a){var l=arguments.length===1?r(this._isDirected,arguments[0]):o(this._isDirected,s,i,a),c=this._edgeObjs[l];return c&&(s=c.v,i=c.w,delete this._edgeLabels[l],delete this._edgeObjs[l],n(this._preds[i],s),n(this._sucs[s],i),delete this._in[i][l],delete this._out[s][l],this._edgeCount--),this}inEdges(s,i){var a=this._in[s];if(a){var l=Object.values(a);return i?l.filter(c=>c.v===i):l}}outEdges(s,i){var a=this._out[s];if(a){var l=Object.values(a);return i?l.filter(c=>c.w===i):l}}nodeEdges(s,i){var a=this.inEdges(s,i);if(a)return a.concat(this.outEdges(s,i))}},yf}function i7(){return Mw?Tw:(Mw=1,Tw={Graph:tm(),version:Aw?Iw:(Aw=1,Iw="2.2.4")})}function a7(){if(Ow)return vf;Ow=1;var t=tm();function e(o){return o.nodes().map(function(r){var s=o.node(r),i=o.parent(r),a={v:r};return s!==void 0&&(a.value=s),i!==void 0&&(a.parent=i),a})}function n(o){return o.edges().map(function(r){var s=o.edge(r),i={v:r.v,w:r.w};return r.name!==void 0&&(i.name=r.name),s!==void 0&&(i.value=s),i})}return vf={write:function(o){var r={options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:e(o),edges:n(o)};return o.graph()!==void 0&&(r.value=structuredClone(o.graph())),r},read:function(o){var r=new t(o.options).setGraph(o.value);return o.nodes.forEach(function(s){r.setNode(s.v,s.value),s.parent&&r.setParent(s.v,s.parent)}),o.edges.forEach(function(s){r.setEdge({v:s.v,w:s.w,name:s.name},s.value)}),r}},vf}function l7(){return Dw||(Dw=1,wf=function(t){var e,n={},o=[];function r(s){Object.hasOwn(n,s)||(n[s]=!0,e.push(s),t.successors(s).forEach(r),t.predecessors(s).forEach(r))}return t.nodes().forEach(function(s){e=[],r(s),e.length&&o.push(e)}),o}),wf}function Mk(){return Rw?kf:(Rw=1,kf=class{constructor(){Z(this,"_arr",[]);Z(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(t){return t.key})}has(t){return Object.hasOwn(this._keyIndices,t)}priority(t){var e=this._keyIndices[t];if(e!==void 0)return this._arr[e].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(t,e){var n=this._keyIndices;if(t=String(t),!Object.hasOwn(n,t)){var o=this._arr,r=o.length;return n[t]=r,o.push({key:t,priority:e}),this._decrease(r),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)}_heapify(t){var e=this._arr,n=2*t,o=n+1,r=t;n<e.length&&(r=e[n].priority<e[r].priority?n:r,o<e.length&&(r=e[o].priority<e[r].priority?o:r),r!==t&&(this._swap(t,r),this._heapify(r)))}_decrease(t){for(var e,n=this._arr,o=n[t].priority;t!==0&&!(n[e=t>>1].priority<o);)this._swap(t,e),t=e}_swap(t,e){var n=this._arr,o=this._keyIndices,r=n[t],s=n[e];n[t]=s,n[e]=r,o[s.key]=t,o[r.key]=e}},kf)}function Ok(){if(Pw)return Cf;Pw=1;var t=Mk();Cf=function(n,o,r,s){return function(i,a,l,c){var d,h,f={},m=new t,g=function(x){var p=x.v!==d?x.v:x.w,b=f[p],y=l(x),v=h.distance+y;if(y<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+x+" Weight: "+y);v<b.distance&&(b.distance=v,b.predecessor=d,m.decrease(p,v))};for(i.nodes().forEach(function(x){var p=x===a?0:Number.POSITIVE_INFINITY;f[x]={distance:p},m.add(x,p)});m.size()>0&&(d=m.removeMin(),(h=f[d]).distance!==Number.POSITIVE_INFINITY);)c(d).forEach(g);return f}(n,String(o),r||e,s||function(i){return n.outEdges(i)})};var e=()=>1;return Cf}function c7(){if(Lw)return jf;Lw=1;var t=Ok();return jf=function(e,n,o){return e.nodes().reduce(function(r,s){return r[s]=t(e,s,n,o),r},{})},jf}function Dk(){return Fw||(Fw=1,Sf=function(t){var e=0,n=[],o={},r=[];function s(i){var a=o[i]={onStack:!0,lowlink:e,index:e++};if(n.push(i),t.successors(i).forEach(function(d){Object.hasOwn(o,d)?o[d].onStack&&(a.lowlink=Math.min(a.lowlink,o[d].index)):(s(d),a.lowlink=Math.min(a.lowlink,o[d].lowlink))}),a.lowlink===a.index){var l,c=[];do l=n.pop(),o[l].onStack=!1,c.push(l);while(i!==l);r.push(c)}}return t.nodes().forEach(function(i){Object.hasOwn(o,i)||s(i)}),r}),Sf}function d7(){if(zw)return Nf;zw=1;var t=Dk();return Nf=function(e){return t(e).filter(function(n){return n.length>1||n.length===1&&e.hasEdge(n[0],n[0])})},Nf}function u7(){if(Bw)return Ef;Bw=1,Ef=function(e,n,o){return function(r,s,i){var a={},l=r.nodes();return l.forEach(function(c){a[c]={},a[c][c]={distance:0},l.forEach(function(d){c!==d&&(a[c][d]={distance:Number.POSITIVE_INFINITY})}),i(c).forEach(function(d){var h=d.v===c?d.w:d.v,f=s(d);a[c][h]={distance:f,predecessor:c}})}),l.forEach(function(c){var d=a[c];l.forEach(function(h){var f=a[h];l.forEach(function(m){var g=f[c],x=d[m],p=f[m],b=g.distance+x.distance;b<p.distance&&(p.distance=b,p.predecessor=x.predecessor)})})}),a}(e,n||t,o||function(r){return e.outEdges(r)})};var t=()=>1;return Ef}function Rk(){if(Uw)return _f;function t(n){var o={},r={},s=[];if(n.sinks().forEach(function i(a){if(Object.hasOwn(r,a))throw new e;Object.hasOwn(o,a)||(r[a]=!0,o[a]=!0,n.predecessors(a).forEach(i),delete r[a],s.push(a))}),Object.keys(o).length!==n.nodeCount())throw new e;return s}Uw=1;class e extends Error{constructor(){super(...arguments)}}return _f=t,t.CycleException=e,_f}function h7(){if($w)return If;$w=1;var t=Rk();return If=function(e){try{t(e)}catch(n){if(n instanceof t.CycleException)return!1;throw n}return!0},If}function Pk(){if(Vw)return Af;function t(o,r,s,i){for(var a=[[o,!1]];a.length>0;){var l=a.pop();l[1]?i.push(l[0]):Object.hasOwn(s,l[0])||(s[l[0]]=!0,a.push([l[0],!0]),n(r(l[0]),c=>a.push([c,!1])))}}function e(o,r,s,i){for(var a=[o];a.length>0;){var l=a.pop();Object.hasOwn(s,l)||(s[l]=!0,i.push(l),n(r(l),c=>a.push(c)))}}function n(o,r){for(var s=o.length;s--;)r(o[s],s,o);return o}return Vw=1,Af=function(o,r,s){Array.isArray(r)||(r=[r]);var i=o.isDirected()?d=>o.successors(d):d=>o.neighbors(d),a=s==="post"?t:e,l=[],c={};return r.forEach(d=>{if(!o.hasNode(d))throw new Error("Graph does not have node: "+d);a(d,i,c,l)}),l},Af}function f7(){if(Hw)return Tf;Hw=1;var t=Pk();return Tf=function(e,n){return t(e,n,"post")},Tf}function m7(){if(Ww)return Mf;Ww=1;var t=Pk();return Mf=function(e,n){return t(e,n,"pre")},Mf}function p7(){if(qw)return Of;qw=1;var t=tm(),e=Mk();return Of=function(n,o){var r,s=new t,i={},a=new e;function l(d){var h=d.v===r?d.w:d.v,f=a.priority(h);if(f!==void 0){var m=o(d);m<f&&(i[h]=r,a.decrease(h,m))}}if(n.nodeCount()===0)return s;n.nodes().forEach(function(d){a.add(d,Number.POSITIVE_INFINITY),s.setNode(d)}),a.decrease(n.nodes()[0],0);for(var c=!1;a.size()>0;){if(r=a.removeMin(),Object.hasOwn(i,r))s.setEdge(r,i[r]);else{if(c)throw new Error("Input graph is not connected: "+n);c=!0}n.nodeEdges(r).forEach(l)}return s},Of}function Pn(){if(Xw)return Kw;Xw=1;var t=i7();return Kw={Graph:t.Graph,json:a7(),alg:Yw?Gw:(Yw=1,Gw={components:l7(),dijkstra:Ok(),dijkstraAll:c7(),findCycles:d7(),floydWarshall:u7(),isAcyclic:h7(),postorder:f7(),preorder:m7(),prim:p7(),tarjan:Dk(),topsort:Rk()}),version:t.version}}function g7(){if(Qw)return Df;Qw=1;let t=Pn().Graph,e=function(){if(Zw)return Jw;function s(a){a._prev._next=a._next,a._next._prev=a._prev,delete a._next,delete a._prev}function i(a,l){if(a!=="_next"&&a!=="_prev")return l}return Zw=1,Jw=class{constructor(){let a={};a._next=a._prev=a,this._sentinel=a}dequeue(){let a=this._sentinel,l=a._prev;if(l!==a)return s(l),l}enqueue(a){let l=this._sentinel;a._prev&&a._next&&s(a),a._next=l._next,l._next._prev=a,l._next=a,a._prev=l}toString(){let a=[],l=this._sentinel,c=l._prev;for(;c!==l;)a.push(JSON.stringify(c,i)),c=c._prev;return"["+a.join(", ")+"]"}}}();Df=function(s,i){if(s.nodeCount()<=1)return[];let a=function(l,c){let d=new t,h=0,f=0;l.nodes().forEach(x=>{d.setNode(x,{v:x,in:0,out:0})}),l.edges().forEach(x=>{let p=d.edge(x.v,x.w)||0,b=c(x),y=p+b;d.setEdge(x.v,x.w,y),f=Math.max(f,d.node(x.v).out+=b),h=Math.max(h,d.node(x.w).in+=b)});let m=function(x){const p=[];for(let b=0;b<x;b++)p.push(b);return p}(f+h+3).map(()=>new e),g=h+1;return d.nodes().forEach(x=>{r(m,g,d.node(x))}),{graph:d,buckets:m,zeroIdx:g}}(s,i||n);return function(l,c,d){let h,f=[],m=c[c.length-1],g=c[0];for(;l.nodeCount();){for(;h=g.dequeue();)o(l,c,d,h);for(;h=m.dequeue();)o(l,c,d,h);if(l.nodeCount()){for(let x=c.length-2;x>0;--x)if(h=c[x].dequeue(),h){f=f.concat(o(l,c,d,h,!0));break}}}return f}(a.graph,a.buckets,a.zeroIdx).flatMap(l=>s.outEdges(l.v,l.w))};let n=()=>1;function o(s,i,a,l,c){let d=c?[]:void 0;return s.inEdges(l.v).forEach(h=>{let f=s.edge(h),m=s.node(h.v);c&&d.push({v:h.v,w:h.w}),m.out-=f,r(i,a,m)}),s.outEdges(l.v).forEach(h=>{let f=s.edge(h),m=h.w,g=s.node(m);g.in-=f,r(i,a,g)}),s.removeNode(l.v),d}function r(s,i,a){a.out?a.in?s[a.out-a.in+i].enqueue(a):s[s.length-1].enqueue(a):s[0].enqueue(a)}return Df}function It(){if(ek)return Rf;ek=1;let t=Pn().Graph;function e(c,d,h,f){for(var m=f;c.hasNode(m);)m=i(f);return h.dummy=d,c.setNode(m,h),m}Rf={addBorderNode:function(c,d,h,f){let m={width:0,height:0};return arguments.length>=4&&(m.rank=h,m.order=f),e(c,"border",m,d)},addDummyNode:e,applyWithChunking:o,asNonCompoundGraph:function(c){let d=new t({multigraph:c.isMultigraph()}).setGraph(c.graph());return c.nodes().forEach(h=>{c.children(h).length||d.setNode(h,c.node(h))}),c.edges().forEach(h=>{d.setEdge(h,c.edge(h))}),d},buildLayerMatrix:function(c){let d=a(r(c)+1).map(()=>[]);return c.nodes().forEach(h=>{let f=c.node(h),m=f.rank;m!==void 0&&(d[m][f.order]=h)}),d},intersectRect:function(c,d){let h,f,m=c.x,g=c.y,x=d.x-m,p=d.y-g,b=c.width/2,y=c.height/2;if(!x&&!p)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(p)*b>Math.abs(x)*y?(p<0&&(y=-y),h=y*x/p,f=y):(x<0&&(b=-b),h=b,f=b*p/x),{x:m+h,y:g+f}},mapValues:function(c,d){let h=d;return typeof d=="string"&&(h=f=>f[d]),Object.entries(c).reduce((f,[m,g])=>(f[m]=h(g,m),f),{})},maxRank:r,normalizeRanks:function(c){let d=c.nodes().map(f=>{let m=c.node(f).rank;return m===void 0?Number.MAX_VALUE:m}),h=o(Math.min,d);c.nodes().forEach(f=>{let m=c.node(f);Object.hasOwn(m,"rank")&&(m.rank-=h)})},notime:function(c,d){return d()},partition:function(c,d){let h={lhs:[],rhs:[]};return c.forEach(f=>{d(f)?h.lhs.push(f):h.rhs.push(f)}),h},pick:function(c,d){const h={};for(const f of d)c[f]!==void 0&&(h[f]=c[f]);return h},predecessorWeights:function(c){let d=c.nodes().map(h=>{let f={};return c.inEdges(h).forEach(m=>{f[m.v]=(f[m.v]||0)+c.edge(m).weight}),f});return l(c.nodes(),d)},range:a,removeEmptyRanks:function(c){let d=c.nodes().map(x=>c.node(x).rank),h=o(Math.min,d),f=[];c.nodes().forEach(x=>{let p=c.node(x).rank-h;f[p]||(f[p]=[]),f[p].push(x)});let m=0,g=c.graph().nodeRankFactor;Array.from(f).forEach((x,p)=>{x===void 0&&p%g!==0?--m:x!==void 0&&m&&x.forEach(b=>c.node(b).rank+=m)})},simplify:function(c){let d=new t().setGraph(c.graph());return c.nodes().forEach(h=>d.setNode(h,c.node(h))),c.edges().forEach(h=>{let f=d.edge(h.v,h.w)||{weight:0,minlen:1},m=c.edge(h);d.setEdge(h.v,h.w,{weight:f.weight+m.weight,minlen:Math.max(f.minlen,m.minlen)})}),d},successorWeights:function(c){let d=c.nodes().map(h=>{let f={};return c.outEdges(h).forEach(m=>{f[m.w]=(f[m.w]||0)+c.edge(m).weight}),f});return l(c.nodes(),d)},time:function(c,d){let h=Date.now();try{return d()}finally{console.log(c+" time: "+(Date.now()-h)+"ms")}},uniqueId:i,zipObject:l};const n=65535;function o(c,d){if(d.length>n){const h=function(f,m=n){const g=[];for(let x=0;x<f.length;x+=m){const p=f.slice(x,x+m);g.push(p)}return g}(d);return c.apply(null,h.map(f=>c.apply(null,f)))}return c.apply(null,d)}function r(c){const d=c.nodes().map(h=>{let f=c.node(h).rank;return f===void 0?Number.MIN_VALUE:f});return o(Math.max,d)}let s=0;function i(c){return c+""+ ++s}function a(c,d,h=1){d==null&&(d=c,c=0);let f=g=>g<d;h<0&&(f=g=>d<g);const m=[];for(let g=c;f(g);g+=h)m.push(g);return m}function l(c,d){return c.reduce((h,f,m)=>(h[f]=d[m],h),{})}return Rf}function x7(){if(tk)return Pf;tk=1;let t=g7(),e=It().uniqueId;return Pf={run:function(n){(n.graph().acyclicer==="greedy"?t(n,function(r){return s=>r.edge(s).weight}(n)):function(r){let s=[],i={},a={};function l(c){Object.hasOwn(a,c)||(a[c]=!0,i[c]=!0,r.outEdges(c).forEach(d=>{Object.hasOwn(i,d.w)?s.push(d):l(d.w)}),delete i[c])}return r.nodes().forEach(l),s}(n)).forEach(r=>{let s=n.edge(r);n.removeEdge(r),s.forwardName=r.name,s.reversed=!0,n.setEdge(r.w,r.v,s,e("rev"))})},undo:function(n){n.edges().forEach(o=>{let r=n.edge(o);if(r.reversed){n.removeEdge(o);let s=r.forwardName;delete r.reversed,delete r.forwardName,n.setEdge(o.w,o.v,r,s)}})}},Pf}function b7(){if(nk)return Lf;nk=1;let t=It();return Lf={run:function(e){e.graph().dummyChains=[],e.edges().forEach(n=>function(o,r){let s,i,a,l=r.v,c=o.node(l).rank,d=r.w,h=o.node(d).rank,f=r.name,m=o.edge(r),g=m.labelRank;if(h!==c+1){for(o.removeEdge(r),a=0,++c;c<h;++a,++c)m.points=[],i={width:0,height:0,edgeLabel:m,edgeObj:r,rank:c},s=t.addDummyNode(o,"edge",i,"_d"),c===g&&(i.width=m.width,i.height=m.height,i.dummy="edge-label",i.labelpos=m.labelpos),o.setEdge(l,s,{weight:m.weight},f),a===0&&o.graph().dummyChains.push(s),l=s;o.setEdge(l,d,{weight:m.weight},f)}}(e,n))},undo:function(e){e.graph().dummyChains.forEach(n=>{let o,r=e.node(n),s=r.edgeLabel;for(e.setEdge(r.edgeObj,s);r.dummy;)o=e.successors(n)[0],e.removeNode(n),s.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height),n=o,r=e.node(n)})}},Lf}function ql(){if(ok)return Ff;ok=1;const{applyWithChunking:t}=It();return Ff={longestPath:function(e){var n={};e.sources().forEach(function o(r){var s=e.node(r);if(Object.hasOwn(n,r))return s.rank;n[r]=!0;let i=e.outEdges(r).map(l=>l==null?Number.POSITIVE_INFINITY:o(l.w)-e.edge(l).minlen);var a=t(Math.min,i);return a===Number.POSITIVE_INFINITY&&(a=0),s.rank=a})},slack:function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}},Ff}function Lk(){if(rk)return zf;rk=1;var t=Pn().Graph,e=ql().slack;function n(s,i){return s.nodes().forEach(function a(l){i.nodeEdges(l).forEach(c=>{var d=c.v,h=l===d?c.w:d;s.hasNode(h)||e(i,c)||(s.setNode(h,{}),s.setEdge(l,h,{}),a(h))})}),s.nodeCount()}function o(s,i){return i.edges().reduce((a,l)=>{let c=Number.POSITIVE_INFINITY;return s.hasNode(l.v)!==s.hasNode(l.w)&&(c=e(i,l)),c<a[0]?[c,l]:a},[Number.POSITIVE_INFINITY,null])[1]}function r(s,i,a){s.nodes().forEach(l=>i.node(l).rank+=a)}return zf=function(s){var i,a,l=new t({directed:!1}),c=s.nodes()[0],d=s.nodeCount();for(l.setNode(c,{});n(l,s)<d;)i=o(l,s),a=l.hasNode(i.v)?e(s,i):-e(s,i),r(l,s,a);return l},zf}function y7(){if(sk)return Bf;sk=1;var t=Lk(),e=ql().slack,n=ql().longestPath,o=Pn().alg.preorder,r=Pn().alg.postorder,s=It().simplify;function i(x){x=s(x),n(x);var p,b=t(x);for(c(b),a(b,x);p=h(b);)m(b,x,p,f(b,x,p))}function a(x,p){var b=r(x,x.nodes());(b=b.slice(0,b.length-1)).forEach(y=>function(v,w,j){var C=v.node(j),N=C.parent;v.edge(j,N).cutvalue=l(v,w,j)}(x,p,y))}function l(x,p,b){var y=x.node(b).parent,v=!0,w=p.edge(b,y),j=0;return w||(v=!1,w=p.edge(y,b)),j=w.weight,p.nodeEdges(b).forEach(C=>{var N,S,E=C.v===b,T=E?C.w:C.v;if(T!==y){var I=E===v,D=p.edge(C).weight;if(j+=I?D:-D,N=b,S=T,x.hasEdge(N,S)){var F=x.edge(b,T).cutvalue;j+=I?-F:F}}}),j}function c(x,p){arguments.length<2&&(p=x.nodes()[0]),d(x,{},1,p)}function d(x,p,b,y,v){var w=b,j=x.node(y);return p[y]=!0,x.neighbors(y).forEach(C=>{Object.hasOwn(p,C)||(b=d(x,p,b,C,y))}),j.low=w,j.lim=b++,v?j.parent=v:delete j.parent,b}function h(x){return x.edges().find(p=>x.edge(p).cutvalue<0)}function f(x,p,b){var y=b.v,v=b.w;p.hasEdge(y,v)||(y=b.w,v=b.v);var w=x.node(y),j=x.node(v),C=w,N=!1;w.lim>j.lim&&(C=j,N=!0);var S=p.edges().filter(E=>N===g(x,x.node(E.v),C)&&N!==g(x,x.node(E.w),C));return S.reduce((E,T)=>e(p,T)<e(p,E)?T:E)}function m(x,p,b,y){var v=b.v,w=b.w;x.removeEdge(v,w),x.setEdge(y.v,y.w,{}),c(x),a(x,p),function(j,C){var N=j.nodes().find(E=>!C.node(E).parent),S=o(j,N);(S=S.slice(1)).forEach(E=>{var T=j.node(E).parent,I=C.edge(E,T),D=!1;I||(I=C.edge(T,E),D=!0),C.node(E).rank=C.node(T).rank+(D?I.minlen:-I.minlen)})}(x,p)}function g(x,p,b){return b.low<=p.lim&&p.lim<=b.lim}return Bf=i,i.initLowLimValues=c,i.initCutValues=a,i.calcCutValue=l,i.leaveEdge=h,i.enterEdge=f,i.exchangeEdges=m,Bf}function v7(){if(ik)return Uf;ik=1;var t=ql().longestPath,e=Lk(),n=y7();Uf=function(s){var i=s.graph().ranker;if(i instanceof Function)return i(s);switch(s.graph().ranker){case"network-simplex":default:r(s);break;case"tight-tree":(function(a){t(a),e(a)})(s);break;case"longest-path":o(s);case"none":}};var o=t;function r(s){n(s)}return Uf}function w7(){return ak||(ak=1,$f=function(t){let e=function(n){let o={},r=0;function s(i){let a=r;n.children(i).forEach(s),o[i]={low:a,lim:r++}}return n.children().forEach(s),o}(t);t.graph().dummyChains.forEach(n=>{let o=t.node(n),r=o.edgeObj,s=function(h,f,m,g){let x,p,b=[],y=[],v=Math.min(f[m].low,f[g].low),w=Math.max(f[m].lim,f[g].lim);x=m;do x=h.parent(x),b.push(x);while(x&&(f[x].low>v||w>f[x].lim));for(p=x,x=g;(x=h.parent(x))!==p;)y.push(x);return{path:b.concat(y.reverse()),lca:p}}(t,e,r.v,r.w),i=s.path,a=s.lca,l=0,c=i[l],d=!0;for(;n!==r.w;){if(o=t.node(n),d){for(;(c=i[l])!==a&&t.node(c).maxRank<o.rank;)l++;c===a&&(d=!1)}if(!d){for(;l<i.length-1&&t.node(c=i[l+1]).minRank<=o.rank;)l++;c=i[l]}t.setParent(n,c),n=t.successors(n)[0]}})}),$f}function k7(){if(lk)return Vf;lk=1;let t=It();function e(n,o,r,s,i,a,l){let c=n.children(l);if(!c.length)return void(l!==o&&n.setEdge(o,l,{weight:0,minlen:r}));let d=t.addBorderNode(n,"_bt"),h=t.addBorderNode(n,"_bb"),f=n.node(l);n.setParent(d,l),f.borderTop=d,n.setParent(h,l),f.borderBottom=h,c.forEach(m=>{e(n,o,r,s,i,a,m);let g=n.node(m),x=g.borderTop?g.borderTop:m,p=g.borderBottom?g.borderBottom:m,b=g.borderTop?s:2*s,y=x!==p?1:i-a[l]+1;n.setEdge(d,x,{weight:b,minlen:y,nestingEdge:!0}),n.setEdge(p,h,{weight:b,minlen:y,nestingEdge:!0})}),n.parent(l)||n.setEdge(o,d,{weight:0,minlen:i+a[l]})}return Vf={run:function(n){let o=t.addDummyNode(n,"root",{},"_root"),r=function(c){var d={};function h(f,m){var g=c.children(f);g&&g.length&&g.forEach(x=>h(x,m+1)),d[f]=m}return c.children().forEach(f=>h(f,1)),d}(n),s=Object.values(r),i=t.applyWithChunking(Math.max,s)-1,a=2*i+1;n.graph().nestingRoot=o,n.edges().forEach(c=>n.edge(c).minlen*=a);let l=function(c){return c.edges().reduce((d,h)=>d+c.edge(h).weight,0)}(n)+1;n.children().forEach(c=>e(n,o,a,l,i,r,c)),n.graph().nodeRankFactor=a},cleanup:function(n){var o=n.graph();n.removeNode(o.nestingRoot),delete o.nestingRoot,n.edges().forEach(r=>{n.edge(r).nestingEdge&&n.removeEdge(r)})}},Vf}function C7(){if(dk)return Wf;function t(r){r.nodes().forEach(s=>e(r.node(s))),r.edges().forEach(s=>e(r.edge(s)))}function e(r){let s=r.width;r.width=r.height,r.height=s}function n(r){r.y=-r.y}function o(r){let s=r.x;r.x=r.y,r.y=s}return dk=1,Wf={adjust:function(r){let s=r.graph().rankdir.toLowerCase();s!=="lr"&&s!=="rl"||t(r)},undo:function(r){let s=r.graph().rankdir.toLowerCase();s!=="bt"&&s!=="rl"||function(i){i.nodes().forEach(a=>n(i.node(a))),i.edges().forEach(a=>{let l=i.edge(a);l.points.forEach(n),Object.hasOwn(l,"y")&&n(l)})}(r),s!=="lr"&&s!=="rl"||(function(i){i.nodes().forEach(a=>o(i.node(a))),i.edges().forEach(a=>{let l=i.edge(a);l.points.forEach(o),Object.hasOwn(l,"x")&&o(l)})}(r),t(r))}},Wf}function j7(){if(gk)return pk;gk=1;let t=It();return pk=function(e,n){let o={};return e.forEach((r,s)=>{let i=o[r.v]={indegree:0,in:[],out:[],vs:[r.v],i:s};r.barycenter!==void 0&&(i.barycenter=r.barycenter,i.weight=r.weight)}),n.edges().forEach(r=>{let s=o[r.v],i=o[r.w];s!==void 0&&i!==void 0&&(i.indegree++,s.out.push(o[r.w]))}),function(r){let s=[];function i(l){return c=>{c.merged||(c.barycenter===void 0||l.barycenter===void 0||c.barycenter>=l.barycenter)&&function(d,h){let f=0,m=0;d.weight&&(f+=d.barycenter*d.weight,m+=d.weight),h.weight&&(f+=h.barycenter*h.weight,m+=h.weight),d.vs=h.vs.concat(d.vs),d.barycenter=f/m,d.weight=m,d.i=Math.min(h.i,d.i),h.merged=!0}(l,c)}}function a(l){return c=>{c.in.push(l),--c.indegree===0&&r.push(c)}}for(;r.length;){let l=r.pop();s.push(l),l.in.reverse().forEach(i(l)),l.out.forEach(a(l))}return s.filter(l=>!l.merged).map(l=>t.pick(l,["vs","i","barycenter","weight"]))}(Object.values(o).filter(r=>!r.indegree))}}function S7(){if(yk)return Yf;yk=1;let t=(mk||(mk=1,fk=function(o,r=[]){return r.map(s=>{let i=o.inEdges(s);if(i.length){let a=i.reduce((l,c)=>{let d=o.edge(c),h=o.node(c.v);return{sum:l.sum+d.weight*h.order,weight:l.weight+d.weight}},{sum:0,weight:0});return{v:s,barycenter:a.sum/a.weight,weight:a.weight}}return{v:s}})}),fk),e=j7(),n=function(){if(bk)return xk;bk=1;let o=It();function r(s,i,a){let l;for(;i.length&&(l=i[i.length-1]).i<=a;)i.pop(),s.push(l.vs),a++;return a}return xk=function(s,i){let a=o.partition(s,p=>Object.hasOwn(p,"barycenter")),l=a.lhs,c=a.rhs.sort((p,b)=>b.i-p.i),d=[],h=0,f=0,m=0;var g;l.sort((g=!!i,(p,b)=>p.barycenter<b.barycenter?-1:p.barycenter>b.barycenter?1:g?b.i-p.i:p.i-b.i)),m=r(d,c,m),l.forEach(p=>{m+=p.vs.length,d.push(p.vs),h+=p.barycenter*p.weight,f+=p.weight,m=r(d,c,m)});let x={vs:d.flat(!0)};return f&&(x.barycenter=h/f,x.weight=f),x}}();return Yf=function o(r,s,i,a){let l=r.children(s),c=r.node(s),d=c?c.borderLeft:void 0,h=c?c.borderRight:void 0,f={};d&&(l=l.filter(p=>p!==d&&p!==h));let m=t(r,l);m.forEach(p=>{if(r.children(p.v).length){let v=o(r,p.v,i,a);f[p.v]=v,Object.hasOwn(v,"barycenter")&&(y=v,(b=p).barycenter!==void 0?(b.barycenter=(b.barycenter*b.weight+y.barycenter*y.weight)/(b.weight+y.weight),b.weight+=y.weight):(b.barycenter=y.barycenter,b.weight=y.weight))}var b,y});let g=e(m,i);(function(p,b){p.forEach(y=>{y.vs=y.vs.flatMap(v=>b[v]?b[v].vs:v)})})(g,f);let x=n(g,a);if(d&&(x.vs=[d,x.vs,h].flat(!0),r.predecessors(d).length)){let p=r.node(r.predecessors(d)[0]),b=r.node(r.predecessors(h)[0]);Object.hasOwn(x,"barycenter")||(x.barycenter=0,x.weight=0),x.barycenter=(x.barycenter*x.weight+p.order+b.order)/(x.weight+2),x.weight+=2}return x},Yf}function N7(){if(vk)return Kf;vk=1;let t=Pn().Graph,e=It();return Kf=function(n,o,r){let s=function(a){for(var l;a.hasNode(l=e.uniqueId("_root")););return l}(n),i=new t({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(a=>n.node(a));return n.nodes().forEach(a=>{let l=n.node(a),c=n.parent(a);(l.rank===o||l.minRank<=o&&o<=l.maxRank)&&(i.setNode(a),i.setParent(a,c||s),n[r](a).forEach(d=>{let h=d.v===a?d.w:d.v,f=i.edge(h,a),m=f!==void 0?f.weight:0;i.setEdge(h,a,{weight:n.edge(d).weight+m})}),Object.hasOwn(l,"minRank")&&i.setNode(a,{borderLeft:l.borderLeft[o],borderRight:l.borderRight[o]}))}),i},Kf}function E7(){if(Ck)return Xf;Ck=1;let t=function(){if(uk)return qf;uk=1;let d=It();return qf=function(h){let f={},m=h.nodes().filter(y=>!h.children(y).length),g=m.map(y=>h.node(y).rank),x=d.applyWithChunking(Math.max,g),p=d.range(x+1).map(()=>[]);function b(y){if(f[y])return;f[y]=!0;let v=h.node(y);p[v.rank].push(y),h.successors(y).forEach(b)}return m.sort((y,v)=>h.node(y).rank-h.node(v).rank).forEach(b),p},qf}(),e=function(){if(hk)return Gf;hk=1;let d=It().zipObject;function h(f,m,g){let x=d(g,g.map((j,C)=>C)),p=m.flatMap(j=>f.outEdges(j).map(C=>({pos:x[C.w],weight:f.edge(C).weight})).sort((C,N)=>C.pos-N.pos)),b=1;for(;b<g.length;)b<<=1;let y=2*b-1;b-=1;let v=new Array(y).fill(0),w=0;return p.forEach(j=>{let C=j.pos+b;v[C]+=j.weight;let N=0;for(;C>0;)C%2&&(N+=v[C+1]),C=C-1>>1,v[C]+=j.weight;w+=j.weight*N}),w}return Gf=function(f,m){let g=0;for(let x=1;x<m.length;++x)g+=h(f,m[x-1],m[x]);return g},Gf}(),n=S7(),o=N7(),r=(kk||(kk=1,wk=function(d,h,f){let m,g={};f.forEach(x=>{let p,b,y=d.parent(x);for(;y;){if(p=d.parent(y),p?(b=g[p],g[p]=y):(b=m,m=y),b&&b!==y)return void h.setEdge(b,y);y=p}})}),wk),s=Pn().Graph,i=It();function a(d,h,f){return h.map(function(m){return o(d,m,f)})}function l(d,h){let f=new s;d.forEach(function(m){let g=m.graph().root,x=n(m,g,f,h);x.vs.forEach((p,b)=>m.node(p).order=b),r(m,f,x.vs)})}function c(d,h){Object.values(h).forEach(f=>f.forEach((m,g)=>d.node(m).order=g))}return Xf=function d(h,f){if(f&&typeof f.customOrder=="function")return void f.customOrder(h,d);let m=i.maxRank(h),g=a(h,i.range(1,m+1),"inEdges"),x=a(h,i.range(m-1,-1,-1),"outEdges"),p=t(h);if(c(h,p),f&&f.disableOptimalOrderHeuristic)return;let b,y=Number.POSITIVE_INFINITY;for(let v=0,w=0;w<4;++v,++w){l(v%2?g:x,v%4>=2),p=i.buildLayerMatrix(h);let j=e(h,p);j<y&&(w=0,b=Object.assign({},p),y=j)}c(h,b)},Xf}function _7(){if(jk)return Jf;jk=1;let t=Pn().Graph,e=It();function n(h,f){let m={};return f.length&&f.reduce(function(g,x){let p=0,b=0,y=g.length,v=x[x.length-1];return x.forEach((w,j)=>{let C=function(S,E){if(S.node(E).dummy)return S.predecessors(E).find(T=>S.node(T).dummy)}(h,w),N=C?h.node(C).order:y;(C||w===v)&&(x.slice(b,j+1).forEach(S=>{h.predecessors(S).forEach(E=>{let T=h.node(E),I=T.order;!(I<p||N<I)||T.dummy&&h.node(S).dummy||r(m,E,S)})}),b=j+1,p=N)}),x}),m}function o(h,f){let m={};function g(x,p,b,y,v){let w;e.range(p,b).forEach(j=>{w=x[j],h.node(w).dummy&&h.predecessors(w).forEach(C=>{let N=h.node(C);N.dummy&&(N.order<y||N.order>v)&&r(m,C,w)})})}return f.length&&f.reduce(function(x,p){let b,y=-1,v=0;return p.forEach((w,j)=>{if(h.node(w).dummy==="border"){let C=h.predecessors(w);C.length&&(b=h.node(C[0]).order,g(p,v,j,y,b),v=j,y=b)}g(p,v,p.length,b,x.length)}),p}),m}function r(h,f,m){if(f>m){let x=f;f=m,m=x}let g=h[f];g||(h[f]=g={}),g[m]=!0}function s(h,f,m){if(f>m){let g=f;f=m,m=g}return!!h[f]&&Object.hasOwn(h[f],m)}function i(h,f,m,g){let x={},p={},b={};return f.forEach(y=>{y.forEach((v,w)=>{x[v]=v,p[v]=v,b[v]=w})}),f.forEach(y=>{let v=-1;y.forEach(w=>{let j=g(w);if(j.length){j=j.sort((N,S)=>b[N]-b[S]);let C=(j.length-1)/2;for(let N=Math.floor(C),S=Math.ceil(C);N<=S;++N){let E=j[N];p[w]===w&&v<b[E]&&!s(m,w,E)&&(p[E]=w,p[w]=x[w]=x[E],v=b[E])}}})}),{root:x,align:p}}function a(h,f,m,g,x){let p={},b=function(w,j,C,N){let S=new t,E=w.graph(),T=function(I,D,F){return(O,R,P)=>{let z,_=O.node(R),k=O.node(P),B=0;if(B+=_.width/2,Object.hasOwn(_,"labelpos"))switch(_.labelpos.toLowerCase()){case"l":z=-_.width/2;break;case"r":z=_.width/2}if(z&&(B+=F?z:-z),z=0,B+=(_.dummy?D:I)/2,B+=(k.dummy?D:I)/2,B+=k.width/2,Object.hasOwn(k,"labelpos"))switch(k.labelpos.toLowerCase()){case"l":z=k.width/2;break;case"r":z=-k.width/2}return z&&(B+=F?z:-z),z=0,B}}(E.nodesep,E.edgesep,N);return j.forEach(I=>{let D;I.forEach(F=>{let O=C[F];if(S.setNode(O),D){var R=C[D],P=S.edge(R,O);S.setEdge(R,O,Math.max(T(w,F,D),P||0))}D=F})}),S}(h,f,m,x),y=x?"borderLeft":"borderRight";function v(w,j){let C=b.nodes(),N=C.pop(),S={};for(;N;)S[N]?w(N):(S[N]=!0,C.push(N),C=C.concat(j(N))),N=C.pop()}return v(function(w){p[w]=b.inEdges(w).reduce((j,C)=>Math.max(j,p[C.v]+b.edge(C)),0)},b.predecessors.bind(b)),v(function(w){let j=b.outEdges(w).reduce((N,S)=>Math.min(N,p[S.w]-b.edge(S)),Number.POSITIVE_INFINITY),C=h.node(w);j!==Number.POSITIVE_INFINITY&&C.borderType!==y&&(p[w]=Math.max(p[w],j))},b.successors.bind(b)),Object.keys(g).forEach(w=>p[w]=p[m[w]]),p}function l(h,f){return Object.values(f).reduce((m,g)=>{let x=Number.NEGATIVE_INFINITY,p=Number.POSITIVE_INFINITY;Object.entries(g).forEach(([y,v])=>{let w=function(j,C){return j.node(C).width}(h,y)/2;x=Math.max(v+w,x),p=Math.min(v-w,p)});const b=x-p;return b<m[0]&&(m=[b,g]),m},[Number.POSITIVE_INFINITY,null])[1]}function c(h,f){let m=Object.values(f),g=e.applyWithChunking(Math.min,m),x=e.applyWithChunking(Math.max,m);["u","d"].forEach(p=>{["l","r"].forEach(b=>{let y=p+b,v=h[y];if(v===f)return;let w=Object.values(v),j=g-e.applyWithChunking(Math.min,w);b!=="l"&&(j=x-e.applyWithChunking(Math.max,w)),j&&(h[y]=e.mapValues(v,C=>C+j))})})}function d(h,f){return e.mapValues(h.ul,(m,g)=>{if(f)return h[f.toLowerCase()][g];{let x=Object.values(h).map(p=>p[g]).sort((p,b)=>p-b);return(x[1]+x[2])/2}})}return Jf={positionX:function(h){let f,m=e.buildLayerMatrix(h),g=Object.assign(n(h,m),o(h,m)),x={};["u","d"].forEach(b=>{f=b==="u"?m:Object.values(m).reverse(),["l","r"].forEach(y=>{y==="r"&&(f=f.map(C=>Object.values(C).reverse()));let v=(b==="u"?h.predecessors:h.successors).bind(h),w=i(h,f,g,v),j=a(h,f,w.root,w.align,y==="r");y==="r"&&(j=e.mapValues(j,C=>-C)),x[b+y]=j})});let p=l(h,x);return c(x,p),d(x,h.graph().align)},findType1Conflicts:n,findType2Conflicts:o,addConflict:r,hasConflict:s,verticalAlignment:i,horizontalCompaction:a,alignCoordinates:c,findSmallestWidthAlignment:l,balance:d},Jf}function I7(){if(Sk)return Zf;Sk=1;let t=It(),e=_7().positionX;return Zf=function(n){n=t.asNonCompoundGraph(n),function(o){let r=t.buildLayerMatrix(o),s=o.graph().ranksep,i=0;r.forEach(a=>{const l=a.reduce((c,d)=>{const h=o.node(d).height;return c>h?c:h},0);a.forEach(c=>o.node(c).y=i+l/2),i+=l+s})}(n),Object.entries(e(n)).forEach(([o,r])=>n.node(o).x=r)},Zf}function A7(){if(Nk)return Qf;Nk=1;let t=x7(),e=b7(),n=v7(),o=It().normalizeRanks,r=w7(),s=It().removeEmptyRanks,i=k7(),a=function(){if(ck)return Hf;ck=1;let N=It();function S(E,T,I,D,F,O){let R={width:0,height:0,rank:O,borderType:T},P=F[T][O-1],z=N.addDummyNode(E,"border",R,I);F[T][O]=z,E.setParent(z,D),P&&E.setEdge(P,z,{weight:1})}return Hf=function(E){E.children().forEach(function T(I){let D=E.children(I),F=E.node(I);if(D.length&&D.forEach(T),Object.hasOwn(F,"minRank")){F.borderLeft=[],F.borderRight=[];for(let O=F.minRank,R=F.maxRank+1;O<R;++O)S(E,"borderLeft","_bl",I,F,O),S(E,"borderRight","_br",I,F,O)}})},Hf}(),l=C7(),c=E7(),d=I7(),h=It(),f=Pn().Graph;Qf=function(N,S){let E=S&&S.debugTiming?h.time:h.notime;E("layout",()=>{let T=E(" buildLayoutGraph",()=>function(I){let D=new f({multigraph:!0,compound:!0}),F=C(I.graph());return D.setGraph(Object.assign({},g,j(F,m),h.pick(F,x))),I.nodes().forEach(O=>{const R=j(C(I.node(O)),p);Object.keys(b).forEach(P=>{R[P]===void 0&&(R[P]=b[P])}),D.setNode(O,R),D.setParent(O,I.parent(O))}),I.edges().forEach(O=>{let R=C(I.edge(O));D.setEdge(O,Object.assign({},v,j(R,y),h.pick(R,w)))}),D}(N));E(" runLayout",()=>function(I,D,F){D(" makeSpaceForEdgeLabels",()=>function(O){let R=O.graph();R.ranksep/=2,O.edges().forEach(P=>{let z=O.edge(P);z.minlen*=2,z.labelpos.toLowerCase()!=="c"&&(R.rankdir==="TB"||R.rankdir==="BT"?z.width+=z.labeloffset:z.height+=z.labeloffset)})}(I)),D(" removeSelfEdges",()=>function(O){O.edges().forEach(R=>{if(R.v===R.w){var P=O.node(R.v);P.selfEdges||(P.selfEdges=[]),P.selfEdges.push({e:R,label:O.edge(R)}),O.removeEdge(R)}})}(I)),D(" acyclic",()=>t.run(I)),D(" nestingGraph.run",()=>i.run(I)),D(" rank",()=>n(h.asNonCompoundGraph(I))),D(" injectEdgeLabelProxies",()=>function(O){O.edges().forEach(R=>{let P=O.edge(R);if(P.width&&P.height){let z=O.node(R.v),_={rank:(O.node(R.w).rank-z.rank)/2+z.rank,e:R};h.addDummyNode(O,"edge-proxy",_,"_ep")}})}(I)),D(" removeEmptyRanks",()=>s(I)),D(" nestingGraph.cleanup",()=>i.cleanup(I)),D(" normalizeRanks",()=>o(I)),D(" assignRankMinMax",()=>function(O){let R=0;O.nodes().forEach(P=>{let z=O.node(P);z.borderTop&&(z.minRank=O.node(z.borderTop).rank,z.maxRank=O.node(z.borderBottom).rank,R=Math.max(R,z.maxRank))}),O.graph().maxRank=R}(I)),D(" removeEdgeLabelProxies",()=>function(O){O.nodes().forEach(R=>{let P=O.node(R);P.dummy==="edge-proxy"&&(O.edge(P.e).labelRank=P.rank,O.removeNode(R))})}(I)),D(" normalize.run",()=>e.run(I)),D(" parentDummyChains",()=>r(I)),D(" addBorderSegments",()=>a(I)),D(" order",()=>c(I,F)),D(" insertSelfEdges",()=>function(O){var R=h.buildLayerMatrix(O);R.forEach(P=>{var z=0;P.forEach((_,k)=>{var B=O.node(_);B.order=k+z,(B.selfEdges||[]).forEach(A=>{h.addDummyNode(O,"selfedge",{width:A.label.width,height:A.label.height,rank:B.rank,order:k+ ++z,e:A.e,label:A.label},"_se")}),delete B.selfEdges})})}(I)),D(" adjustCoordinateSystem",()=>l.adjust(I)),D(" position",()=>d(I)),D(" positionSelfEdges",()=>function(O){O.nodes().forEach(R=>{var P=O.node(R);if(P.dummy==="selfedge"){var z=O.node(P.e.v),_=z.x+z.width/2,k=z.y,B=P.x-_,A=z.height/2;O.setEdge(P.e,P.label),O.removeNode(R),P.label.points=[{x:_+2*B/3,y:k-A},{x:_+5*B/6,y:k-A},{x:_+B,y:k},{x:_+5*B/6,y:k+A},{x:_+2*B/3,y:k+A}],P.label.x=P.x,P.label.y=P.y}})}(I)),D(" removeBorderNodes",()=>function(O){O.nodes().forEach(R=>{if(O.children(R).length){let P=O.node(R),z=O.node(P.borderTop),_=O.node(P.borderBottom),k=O.node(P.borderLeft[P.borderLeft.length-1]),B=O.node(P.borderRight[P.borderRight.length-1]);P.width=Math.abs(B.x-k.x),P.height=Math.abs(_.y-z.y),P.x=k.x+P.width/2,P.y=z.y+P.height/2}}),O.nodes().forEach(R=>{O.node(R).dummy==="border"&&O.removeNode(R)})}(I)),D(" normalize.undo",()=>e.undo(I)),D(" fixupEdgeLabelCoords",()=>function(O){O.edges().forEach(R=>{let P=O.edge(R);if(Object.hasOwn(P,"x"))switch(P.labelpos!=="l"&&P.labelpos!=="r"||(P.width-=P.labeloffset),P.labelpos){case"l":P.x-=P.width/2+P.labeloffset;break;case"r":P.x+=P.width/2+P.labeloffset}})}(I)),D(" undoCoordinateSystem",()=>l.undo(I)),D(" translateGraph",()=>function(O){let R=Number.POSITIVE_INFINITY,P=0,z=Number.POSITIVE_INFINITY,_=0,k=O.graph(),B=k.marginx||0,A=k.marginy||0;function U(V){let X=V.x,Y=V.y,G=V.width,W=V.height;R=Math.min(R,X-G/2),P=Math.max(P,X+G/2),z=Math.min(z,Y-W/2),_=Math.max(_,Y+W/2)}O.nodes().forEach(V=>U(O.node(V))),O.edges().forEach(V=>{let X=O.edge(V);Object.hasOwn(X,"x")&&U(X)}),R-=B,z-=A,O.nodes().forEach(V=>{let X=O.node(V);X.x-=R,X.y-=z}),O.edges().forEach(V=>{let X=O.edge(V);X.points.forEach(Y=>{Y.x-=R,Y.y-=z}),Object.hasOwn(X,"x")&&(X.x-=R),Object.hasOwn(X,"y")&&(X.y-=z)}),k.width=P-R+B,k.height=_-z+A}(I)),D(" assignNodeIntersects",()=>function(O){O.edges().forEach(R=>{let P,z,_=O.edge(R),k=O.node(R.v),B=O.node(R.w);_.points?(P=_.points[0],z=_.points[_.points.length-1]):(_.points=[],P=B,z=k),_.points.unshift(h.intersectRect(k,P)),_.points.push(h.intersectRect(B,z))})}(I)),D(" reversePoints",()=>function(O){O.edges().forEach(R=>{let P=O.edge(R);P.reversed&&P.points.reverse()})}(I)),D(" acyclic.undo",()=>t.undo(I))}(T,E,S)),E(" updateInputGraph",()=>function(I,D){I.nodes().forEach(F=>{let O=I.node(F),R=D.node(F);O&&(O.x=R.x,O.y=R.y,O.rank=R.rank,D.children(F).length&&(O.width=R.width,O.height=R.height))}),I.edges().forEach(F=>{let O=I.edge(F),R=D.edge(F);O.points=R.points,Object.hasOwn(R,"x")&&(O.x=R.x,O.y=R.y)}),I.graph().width=D.graph().width,I.graph().height=D.graph().height}(N,T))})};let m=["nodesep","edgesep","ranksep","marginx","marginy"],g={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},x=["acyclicer","ranker","rankdir","align"],p=["width","height","rank"],b={width:0,height:0},y=["minlen","weight","width","height","labeloffset"],v={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},w=["labelpos"];function j(N,S){return h.mapValues(h.pick(N,S),Number)}function C(N){var S={};return N&&Object.entries(N).forEach(([E,T])=>{typeof E=="string"&&(E=E.toLowerCase()),S[E]=T}),S}return Qf}function T7(){if(Ek)return em;Ek=1;let t=It(),e=Pn().Graph;return em={debugOrdering:function(n){let o=t.buildLayerMatrix(n),r=new e({compound:!0,multigraph:!0}).setGraph({});return n.nodes().forEach(s=>{r.setNode(s,{label:s}),r.setParent(s,"layer"+n.node(s).rank)}),n.edges().forEach(s=>r.setEdge(s.v,s.w,{},s.name)),o.forEach((s,i)=>{let a="layer"+i;r.setNode(a,{rank:"same"}),s.reduce((l,c)=>(r.setEdge(l,c,{style:"invis"}),c))}),r}},em}var Fk=Tk?Ak:(Tk=1,Ak={graphlib:Pn(),layout:A7(),debug:T7(),util:{time:It().time,notime:It().notime},version:Ik?_k:(Ik=1,_k="1.1.5")});const Ii=new Fk.graphlib.Graph().setDefaultEdgeLabel(()=>({})),zk=({nodes:t,edges:e,direction:n})=>(Ii.setGraph({rankdir:n,nodesep:150,ranksep:200,ranker:"longest-path"}),e.forEach(o=>Ii.setEdge(o.source,o.target)),t.forEach(o=>Ii.setNode(o.id,{...o,width:o.width??0,height:o.height??0})),Fk.layout(Ii),{nodes:t.map(o=>{const{x:r,y:s}=Ii.node(o.id);return{...o,position:{x:r,y:s}}}),edges:e}),Bk=new class{createEdge(t,e){return{animated:!0,markerEnd:{type:Jr.ArrowClosed},id:`${t}-${e}`,style:{strokeWidth:2},source:t,sourceHandle:"outputs",targetHandle:"inputs",target:e}}createNode(t,e){return{id:t,data:{atom:e,forceWidth:300},width:300,type:"custom",height:gf(Qe.get(e).code.trim().split(`
|
|
162
|
-
`).length),position:{x:0,y:0}}}createElements(t,e,n,o){const r=[],s=[],i=new Set,a=new Set;for(const l of Object.values(n)){if(l.value==="marimo"&&l.name==="mo")continue;const{declaredBy:c,usedBy:d}=l;for(const h of c)for(const f of d){const m=`${h}-${f}`;a.has(m)||(a.add(m),i.add(h),i.add(f),s.push(this.createEdge(h,f)))}}for(const[l,c]of ep.zip(t,e)){o||r.push(this.createNode(l,c));const d=i.has(l),h=Qe.get(c).code.trim().startsWith("mo.md");!d&&h||r.push(this.createNode(l,c))}return{nodes:r,edges:s}}},M7=t=>{const e=H.c(43),{cellIds:n,variables:o,cellAtoms:r,children:s,layoutDirection:i,settings:a}=t;let l;e[0]!==r||e[1]!==n||e[2]!==i||e[3]!==a.hidePureMarkdown||e[4]!==o?(l=()=>{let k=Bk.createElements(n,r,o,a.hidePureMarkdown);return k=zk({nodes:k.nodes,edges:k.edges,direction:i}),k},e[0]=r,e[1]=n,e[2]=i,e[3]=a.hidePureMarkdown,e[4]=o,e[5]=l):l=e[5];const[c]=M.useState(l),[d,h,f]=bw(c.nodes),[m,g,x]=yw(c.edges),p=Ni();let b;e[6]!==i||e[7]!==g||e[8]!==h?(b=k=>{const B=zk({nodes:k.nodes,edges:k.edges,direction:i});h(B.nodes),g(B.edges)},e[6]=i,e[7]=g,e[8]=h,e[9]=b):b=e[9];const y=Fe(b);let v,w;e[10]!==r||e[11]!==n||e[12]!==a.hidePureMarkdown||e[13]!==y||e[14]!==o?(v=()=>{y(Bk.createElements(n,r,o,a.hidePureMarkdown))},w=[n,o,r,y,a.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=a.hidePureMarkdown,e[13]=y,e[14]=o,e[15]=v,e[16]=w):(v=e[15],w=e[16]),M.useEffect(v,w);const[j,C]=M.useState();let N;Nw(),e[17]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{C(void 0)},e[17]=N):N=e[17];const S=N;let E,T,I,D,F,O,R,P,z,_;return e[18]===Symbol.for("react.memo_cache_sentinel")?(E={minZoom:.5,maxZoom:1.5},T=(k,B)=>{C({type:"node",id:B.id})},I=(k,B)=>{const{source:A,target:U}=B;C({type:"edge",source:A,target:U})},e[18]=E,e[19]=T,e[20]=I):(E=e[18],T=e[19],I=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(D=u.jsx(ZM,{color:"#ccc",variant:En.Dots}),e[21]=D):D=e[21],e[22]!==p||e[23]!==d?(F=()=>{const k=Qe.get(mL);if(k){const B=d.find(A=>A.id===k);B&&(p.fitView({padding:1,duration:600,nodes:[B]}),C({type:"node",id:k}))}},e[22]=p,e[23]=d,e[24]=F):F=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(O=u.jsx(Rp,{className:"size-4"}),e[25]=O):O=e[25],e[26]!==F?(R=u.jsx(qM,{position:"bottom-right",showInteractive:!1,children:u.jsx(Ee,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:u.jsx(ss,{onMouseDown:zn.preventFocus,onClick:F,children:O})})}),e[26]=F,e[27]=R):R=e[27],e[28]!==m||e[29]!==j||e[30]!==o?(P=u.jsx(Wl,{selection:j,variables:o,edges:m,onClearSelection:S}),e[28]=m,e[29]=j,e[30]=o,e[31]=P):P=e[31],e[32]!==s||e[33]!==m||e[34]!==d||e[35]!==x||e[36]!==f||e[37]!==R||e[38]!==P?(z=u.jsxs(pf,{nodes:d,edges:m,nodeTypes:jw,minZoom:.2,fitViewOptions:E,onNodeClick:T,onEdgeClick:I,onNodeDoubleClick:O7,fitView:!0,onNodesChange:f,onEdgesChange:x,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[D,R,P,s]}),e[32]=s,e[33]=m,e[34]=d,e[35]=x,e[36]=f,e[37]=R,e[38]=P,e[39]=z):z=e[39],e[40]!==i||e[41]!==z?(_=u.jsx(kw,{value:i,children:z}),e[40]=i,e[41]=z,e[42]=_):_=e[42],_};function O7(t,e){GC(e.id,"focus")}const D7=jt("_minimap_"),R7=jt({hidePureMarkdown:!0}),P7=t=>{const e=H.c(11),[n,o]=zt(D7),[r,s]=zt(R7);let i;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(i=()=>n==="_minimap_"?u.jsx(o7,{...t,children:u.jsx(bf,{settings:r,onSettingsChange:s,view:n,onChange:o})}):u.jsx(M7,{...t,settings:r,layoutDirection:n,children:u.jsx(bf,{settings:r,onSettingsChange:s,view:n,onChange:o})}),e[0]=n,e[1]=t,e[2]=o,e[3]=s,e[4]=r,e[5]=i):i=e[5];const a=i;let l,c;return e[6]!==a?(l=a(),e[6]=a,e[7]=l):l=e[7],e[8]!==n||e[9]!==l?(c=u.jsx(mf,{children:l},n),e[8]=n,e[9]=l,e[10]=c):c=e[10],c},L7=()=>{const t=H.c(5),e=op(),n=wr(),[o]=pL();let r,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=xe("w-full h-full flex-1 mx-auto -mb-4 relative"),t[0]=r):r=t[0],t[1]!==n.inOrderIds||t[2]!==o||t[3]!==e?(s=u.jsx("div",{className:r,children:u.jsx(P7,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},F7=t=>{const e=H.c(4),{isOpen:n,children:o}=t,[r,s]=q.useState(!1);let i,a;return e[0]!==r||e[1]!==n?(i=()=>{n&&!r&&s(!0)},a=[n,r],e[0]=r,e[1]=n,e[2]=i,e[3]=a):(i=e[2],a=e[3]),q.useEffect(i,a),r?o:null},z7=t=>{const e=H.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(d){const h=Qe.get(kc)[d];if(h)return h.declaredBy[0]}(n);if(!l)return;const c=Ri(l);c&&np(c,n)},e[0]=n,e[1]=r):r=e[1];const s=r;let i,a;return e[2]!==o?(i=xe("text-link opacity-80 hover:opacity-100 hover:underline",o),e[2]=o,e[3]=i):i=e[3],e[4]!==s||e[5]!==i||e[6]!==n?(a=u.jsx("button",{type:"button",onClick:s,className:i,children:n}),e[4]=s,e[5]=i,e[6]=n,e[7]=a):a=e[7],a},B7=jt(t=>{const e=t(gL),n=t(kc),o=t(ta);return la(e,r=>{if(!r.variable_name)return-1;const s=Object.values(n).find(a=>a.name===r.variable_name);if(!s)return 0;const i=o.inOrderIds.indexOf(s.declaredBy[0]);return i===-1?0:i})}),U7=jt(t=>{const e=new Map(t(xL));for(const n of YC){const o=e.get(n);o&&o.databases.length===0&&e.delete(n)}return la([...e.values()],n=>YC.has(n.name)?1:0)}),$7=()=>{const t=H.c(32),[e,n]=q.useState(""),o=Ct(KC),r=Ne(B7),s=Ne(U7);if(r.length===0&&s.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(dn,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:u.jsx(Pg,{children:u.jsxs(ve,{variant:"outline",size:"sm",children:["Add database or catalog",u.jsx(Jo,{className:"h-4 w-4 ml-2"})]})}),icon:u.jsx(Yo,{})}),t[0]=b):b=t[0],b}const i=!!e.trim();let a,l,c,d,h,f,m,g,x,p;if(t[1]!==o?(a=b=>{o(b.length>0),n(b)},t[1]=o,t[2]=a):a=t[2],t[3]!==e||t[4]!==a?(l=u.jsx(zi,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:a,rootClassName:"flex-1 border-r"}),t[3]=e,t[4]=a,t[5]=l):l=t[5],t[6]!==i?(c=i&&u.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>n(""),children:u.jsx(wn,{className:"h-4 w-4"})}),t[6]=i,t[7]=c):c=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(Pg,{children:u.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:u.jsx(Jo,{className:"h-4 w-4"})})}),t[8]=d):d=t[8],t[9]!==l||t[10]!==c?(h=u.jsxs("div",{className:"flex items-center w-full",children:[l,c,d]}),t[9]=l,t[10]=c,t[11]=h):h=t[11],t[12]!==s||t[13]!==i||t[14]!==e){let b;t[16]!==i||t[17]!==e?(b=y=>u.jsx(V7,{connection:y,hasChildren:y.databases.length>0,children:y.databases.map(v=>u.jsx(H7,{engineName:y.name,database:v,hasSearch:i,children:u.jsx(W7,{schemas:v.schemas,defaultSchema:y.default_schema,defaultDatabase:y.default_database,engineName:y.name,databaseName:v.name,hasSearch:i,searchValue:e})},v.name))},y.name),t[16]=i,t[17]=e,t[18]=b):b=t[18],f=s.map(b),t[12]=s,t[13]=i,t[14]=e,t[15]=f}else f=t[15];return t[19]!==s.length||t[20]!==r.length?(m=s.length>0&&r.length>0&&u.jsxs(XC,{children:[u.jsx(nc,{className:"h-4 w-4 text-muted-foreground"}),u.jsx("span",{className:"text-xs",children:"Python"})]}),t[19]=s.length,t[20]=r.length,t[21]=m):m=t[21],t[22]!==e||t[23]!==r?(g=r.length>0&&u.jsx(Uk,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=g):g=t[24],t[25]!==f||t[26]!==m||t[27]!==g?(x=u.jsxs(Hm,{className:"flex flex-col",children:[f,m,g]}),t[25]=f,t[26]=m,t[27]=g,t[28]=x):x=t[28],t[29]!==h||t[30]!==x?(p=u.jsxs(yc,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden",shouldFilter:!1,children:[h,x]}),t[29]=h,t[30]=x,t[31]=p):p=t[31],p},V7=t=>{const e=H.c(26),{connection:n,children:o,hasChildren:r}=t,s=n.name===bL,i=s?"In-Memory":n.name,{previewDataSourceConnection:a}=nt(),[l,c]=q.useState(!1);let d;e[0]!==n.name||e[1]!==a?(d=async()=>{c(!0),await a({engine:n.name}),setTimeout(()=>c(!1),500)},e[0]=n.name,e[1]=a,e[2]=d):d=e[2];const h=d;let f,m,g;e[3]!==n.dialect?(f=u.jsx(L3,{className:"h-4 w-4 text-muted-foreground",name:n.dialect}),e[3]=n.dialect,e[4]=f):f=e[4],e[5]!==n.dialect?(m=yL(n.dialect),e[5]=n.dialect,e[6]=m):m=e[6],e[7]!==m?(g=u.jsx("span",{className:"text-xs",children:m}),e[7]=m,e[8]=g):g=e[8];const x=i;let p,b,y,v,w;return e[9]!==x?(p=u.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",u.jsx(z7,{variableName:x}),")"]}),e[9]=x,e[10]=p):p=e[10],e[11]!==h||e[12]!==s||e[13]!==l?(b=!s&&u.jsx(Ee,{content:"Refresh connection",children:u.jsx(ve,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:h,children:u.jsx(Oc,{className:xe("h-4 w-4 text-muted-foreground hover:text-foreground",l&&"animate-[spin_0.5s]")})})}),e[11]=h,e[12]=s,e[13]=l,e[14]=b):b=e[14],e[15]!==f||e[16]!==g||e[17]!==p||e[18]!==b?(y=u.jsxs(XC,{children:[f,g,p,b]}),e[15]=f,e[16]=g,e[17]=p,e[18]=b,e[19]=y):y=e[19],e[20]!==o||e[21]!==r?(v=r?o:u.jsx(Hc,{content:"No databases available",className:"pl-2"}),e[20]=o,e[21]=r,e[22]=v):v=e[22],e[23]!==y||e[24]!==v?(w=u.jsxs(u.Fragment,{children:[y,v]}),e[23]=y,e[24]=v,e[25]=w):w=e[25],w},H7=t=>{const e=H.c(28),{hasSearch:n,engineName:o,database:r,children:s}=t,[i,a]=q.useState(!1),[l,c]=q.useState(!1);let d,h,f;e[0]!==n?(d=()=>{a(n)},h=[n],e[0]=n,e[1]=d,e[2]=h):(d=e[1],h=e[2]),q.useEffect(d,h),e[3]!==i||e[4]!==l?(f=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=f):f=e[5];const m=`${o}:${r.name}`;let g;e[6]!==i?(g=u.jsx(nj,{isExpanded:i}),e[6]=i,e[7]=g):g=e[7];const x=l&&i?"text-foreground":"text-muted-foreground";let p,b;e[8]!==x?(p=xe("h-4 w-4",x),e[8]=x,e[9]=p):p=e[9],e[10]!==p?(b=u.jsx(Yo,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&i&&"font-semibold";let v,w,j,C;e[12]!==y?(v=xe(y),e[12]=y,e[13]=v):v=e[13],e[14]!==r.name?(w=r.name===""?u.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=w):w=e[15],e[16]!==v||e[17]!==w?(j=u.jsx("span",{className:v,children:w}),e[16]=v,e[17]=w,e[18]=j):j=e[18],e[19]!==j||e[20]!==f||e[21]!==m||e[22]!==g||e[23]!==b?(C=u.jsxs(Zn,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:m,children:[g,b,j]}),e[19]=j,e[20]=f,e[21]=m,e[22]=g,e[23]=b,e[24]=C):C=e[24];const N=i&&s;let S;return e[25]!==C||e[26]!==N?(S=u.jsxs(u.Fragment,{children:[C,N]}),e[25]=C,e[26]=N,e[27]=S):S=e[27],S},W7=t=>{const e=H.c(20),{schemas:n,defaultSchema:o,defaultDatabase:r,engineName:s,databaseName:i,hasSearch:a,searchValue:l}=t;if(n.length===0){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(Hc,{content:"No schemas available",className:"pl-6"}),e[0]=h):h=e[0],h}let c,d;if(e[1]!==i||e[2]!==r||e[3]!==o||e[4]!==s||e[5]!==a||e[6]!==n||e[7]!==l){let h;e[9]!==l?(h=g=>!l||g.tables.some(x=>x.name.toLowerCase().includes(l.toLowerCase())),e[9]=l,e[10]=h):h=e[10];const f=n.filter(h);let m;e[11]!==i||e[12]!==r||e[13]!==o||e[14]!==s||e[15]!==a||e[16]!==l?(m=g=>u.jsx(q7,{databaseName:i,schema:g,hasSearch:a,children:u.jsx(Uk,{tables:g.tables,searchValue:l,sqlTableContext:{engine:s,database:i,schema:g.name,defaultSchema:o,defaultDatabase:r}})},g.name),e[11]=i,e[12]=r,e[13]=o,e[14]=s,e[15]=a,e[16]=l,e[17]=m):m=e[17],c=f.map(m),e[1]=i,e[2]=r,e[3]=o,e[4]=s,e[5]=a,e[6]=n,e[7]=l,e[8]=c}else c=e[8];return e[18]!==c?(d=u.jsx(u.Fragment,{children:c}),e[18]=c,e[19]=d):d=e[19],d},q7=t=>{const e=H.c(26),{databaseName:n,schema:o,children:r,hasSearch:s}=t,[i,a]=q.useState(!1),[l,c]=q.useState(!1),d=`${n}:${o.name}`;let h,f,m,g;if(e[0]!==s?(h=()=>{a(s)},f=[s],e[0]=s,e[1]=h,e[2]=f):(h=e[1],f=e[2]),q.useEffect(h,f),tj(o.name))return r;e[3]!==i||e[4]!==l?(m=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=m):m=e[5],e[6]!==i?(g=u.jsx(nj,{isExpanded:i}),e[6]=i,e[7]=g):g=e[7];const x=l&&i&&"text-foreground";let p,b;e[8]!==x?(p=xe("h-4 w-4 text-muted-foreground",x),e[8]=x,e[9]=p):p=e[9],e[10]!==p?(b=u.jsx(NL,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&i&&"font-semibold";let v,w,j;e[12]!==y?(v=xe(y),e[12]=y,e[13]=v):v=e[13],e[14]!==o.name||e[15]!==v?(w=u.jsx("span",{className:v,children:o.name}),e[14]=o.name,e[15]=v,e[16]=w):w=e[16],e[17]!==w||e[18]!==m||e[19]!==g||e[20]!==b||e[21]!==d?(j=u.jsxs(Zn,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:m,value:d,children:[g,b,w]}),e[17]=w,e[18]=m,e[19]=g,e[20]=b,e[21]=d,e[22]=j):j=e[22];const C=i&&r;let N;return e[23]!==j||e[24]!==C?(N=u.jsxs(u.Fragment,{children:[j,C]}),e[23]=j,e[24]=C,e[25]=N):N=e[25],N},Uk=t=>{const e=H.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=JC(),[i,a]=q.useState(!1),[l,c]=q.useState(!1);let d,h;e[0]!==s||e[1]!==o||e[2]!==n.length||e[3]!==i?(d=async()=>{if(n.length===0&&o&&!i){a(!0),c(!0);const{engine:p,database:b,schema:y}=o,v=await $F.request({engine:p,database:b,schema:y});if(!(v!=null&&v.tables))throw c(!1),new Error("No tables available");s({tables:v.tables,sqlTableContext:o}),c(!1)}},e[0]=s,e[1]=o,e[2]=n.length,e[3]=i,e[4]=d):d=e[4],e[5]!==o||e[6]!==n.length||e[7]!==i?(h=[n.length,o,i],e[5]=o,e[6]=n.length,e[7]=i,e[8]=h):h=e[8];const{isPending:f,error:m}=Tn(d,h);if(f||l){let p;return e[9]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(ZC,{message:"Loading tables...",className:"pl-12"}),e[9]=p):p=e[9],p}if(m){let p;return e[10]!==m?(p=u.jsx(QC,{error:m,className:"pl-12"}),e[10]=m,e[11]=p):p=e[11],p}if(n.length===0){let p;return e[12]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(Hc,{content:"No tables found",className:"pl-9"}),e[12]=p):p=e[12],p}let g,x;if(e[13]!==r||e[14]!==o||e[15]!==n){let p;e[17]!==r?(p=v=>!r||v.name.toLowerCase().includes(r.toLowerCase()),e[17]=r,e[18]=p):p=e[18];const b=n.filter(p);let y;e[19]!==r||e[20]!==o?(y=v=>u.jsx(G7,{table:v,sqlTableContext:o,isSearching:!!r},v.name),e[19]=r,e[20]=o,e[21]=y):y=e[21],g=b.map(y),e[13]=r,e[14]=o,e[15]=n,e[16]=g}else g=e[16];return e[22]!==g?(x=u.jsx(u.Fragment,{children:g}),e[22]=g,e[23]=x):x=e[23],x},G7=t=>{const e=H.c(64),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=JC(),[i,a]=q.useState(!1),[l,c]=q.useState(!1),d=n.columns.length>0;let h,f;e[0]!==s||e[1]!==i||e[2]!==o||e[3]!==n.name||e[4]!==d||e[5]!==l?(h=async()=>{if(i&&!d&&o&&!l){c(!0);const{engine:W,database:J,schema:$}=o,Q=await VF.request({engine:W,database:J,schema:$,tableName:n.name});if(!(Q!=null&&Q.table))throw new Error("No table details available");s({table:Q.table,sqlTableContext:o})}},e[0]=s,e[1]=i,e[2]=o,e[3]=n.name,e[4]=d,e[5]=l,e[6]=h):h=e[6],e[7]!==i||e[8]!==d?(f=[i,d],e[7]=i,e[8]=d,e[9]=f):f=e[9];const{isFetching:m,isPending:g,error:x}=Tn(h,f),p=Ne(ec),b=hs(),{createNewCell:y}=lt(),v=ej();let w;e[10]!==v||e[11]!==p||e[12]!==y||e[13]!==b||e[14]!==o||e[15]!==n?(w=()=>{Jn({autoInstantiate:p,createNewCell:y,fromCellId:b}),v((()=>{if(n.source_type==="catalog"){const W=o!=null&&o.database?`${o.database}.${n.name}`:n.name;return`${n.engine}.load_table("${W}")`}if(o)return oj({table:n,columnName:"*",sqlTableContext:o});switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return oj({table:n,columnName:"*",sqlTableContext:o});default:return hc(n.source_type),""}})())},e[10]=v,e[11]=p,e[12]=y,e[13]=b,e[14]=o,e[15]=n,e[16]=w):w=e[16];const j=w;let C;e[17]!==n.num_columns||e[18]!==n.num_rows?(C=()=>{const W=[];return n.num_rows!=null&&W.push(`${n.num_rows} rows`),n.num_columns!=null&&W.push(`${n.num_columns} columns`),W.length===0?null:u.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:u.jsx("span",{className:"text-xs text-muted-foreground",children:W.join(", ")})})},e[17]=n.num_columns,e[18]=n.num_rows,e[19]=C):C=e[19];const N=C;let S;e[20]!==x||e[21]!==m||e[22]!==g||e[23]!==o||e[24]!==n?(S=()=>{if(g||m)return u.jsx(ZC,{message:"Loading columns...",className:"pl-12"});if(x)return u.jsx(QC,{error:x,className:"pl-12"});const W=n.columns;return W.length===0?u.jsx(Hc,{content:"No columns found",className:"pl-12"}):W.map(J=>u.jsx(Y7,{table:n,column:J,sqlTableContext:o},J.name))},e[20]=x,e[21]=m,e[22]=g,e[23]=o,e[24]=n,e[25]=S):S=e[25];const E=S;let T;e[26]!==i||e[27]!==r||e[28]!==n.source_type||e[29]!==n.type?(T=()=>{if(n.source_type==="local")return;const W=n.type==="table"?vL:fm;return u.jsx(W,{className:"h-3 w-3",strokeWidth:i||r?2.5:void 0})},e[26]=i,e[27]=r,e[28]=n.source_type,e[29]=n.type,e[30]=T):T=e[30];const I=T,D=o?`${o.database}.${o.schema}.${n.name}`:n.name,F=o&&(tj(o.schema)?"pl-9":"pl-12"),O=(i||r)&&"font-semibold";let R,P,z,_,k,B,A,U,V,X,Y,G;return e[31]!==F||e[32]!==O?(R=xe("rounded-none group h-8 cursor-pointer",F,O),e[31]=F,e[32]=O,e[33]=R):R=e[33],e[34]!==i?(P=()=>a(!i),e[34]=i,e[35]=P):P=e[35],e[36]!==I?(z=I(),e[36]=I,e[37]=z):z=e[37],e[38]!==n.name?(_=u.jsx("span",{className:"text-sm",children:n.name}),e[38]=n.name,e[39]=_):_=e[39],e[40]!==z||e[41]!==_?(k=u.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[z,_]}),e[40]=z,e[41]=_,e[42]=k):k=e[42],e[43]!==N?(B=N(),e[43]=N,e[44]=B):B=e[44],e[45]!==j?(A=zn.stopPropagation(()=>j()),e[45]=j,e[46]=A):A=e[46],e[47]===Symbol.for("react.memo_cache_sentinel")?(U=u.jsx(wL,{className:"h-3 w-3"}),e[47]=U):U=e[47],e[48]!==A?(V=u.jsx(Ee,{content:"Add table to notebook",delayDuration:400,children:u.jsx(ve,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:A,children:U})}),e[48]=A,e[49]=V):V=e[49],e[50]!==i||e[51]!==P||e[52]!==k||e[53]!==B||e[54]!==V||e[55]!==R||e[56]!==D?(X=u.jsxs(Zn,{className:R,value:D,"aria-selected":i,forceMount:!0,onSelect:P,children:[k,B,V]}),e[50]=i,e[51]=P,e[52]=k,e[53]=B,e[54]=V,e[55]=R,e[56]=D,e[57]=X):X=e[57],e[58]!==i||e[59]!==E?(Y=i&&E(),e[58]=i,e[59]=E,e[60]=Y):Y=e[60],e[61]!==X||e[62]!==Y?(G=u.jsxs(u.Fragment,{children:[X,Y]}),e[61]=X,e[62]=Y,e[63]=G):G=e[63],G},Y7=t=>{var A,U;const e=H.c(51),{table:n,column:o,sqlTableContext:r}=t,[s,i]=q.useState(!1),a=Ne(KC),l=Ct(kL);let c,d;e[0]!==a?(c=()=>{a&&i(!1)},d=[a],e[0]=a,e[1]=c,e[2]=d):(c=e[1],d=e[2]),q.useEffect(c,d),l(s?V=>new Set([...V,`${n.name}:${o.name}`]):V=>(V.delete(`${n.name}:${o.name}`),new Set(V)));const h=ej(),{columnsPreviews:f}=CL();let m;e[3]!==o.name||e[4]!==n.primary_keys?(m=((A=n.primary_keys)==null?void 0:A.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=m):m=e[5];const g=m;let x;e[6]!==o.name||e[7]!==n.indexes?(x=((U=n.indexes)==null?void 0:U.includes(o.name))||!1,e[6]=o.name,e[7]=n.indexes,e[8]=x):x=e[8];const p=x;let b;e[9]!==h?(b=V=>{h(V)},e[9]=h,e[10]=b):b=e[10];const y=b,v=K7,w=s?"font-semibold":"";let j;e[11]!==o.name||e[12]!==w?(j=u.jsx("span",{className:w,children:o.name}),e[11]=o.name,e[12]=w,e[13]=j):j=e[13];const C=j,N=`${n.name}.${o.name}`,S=`${n.name}.${o.name}`;let E;e[14]!==s?(E=()=>i(!s),e[14]=s,e[15]=E):E=e[15];const T=r?"pl-14":"pl-7";let I,D,F,O,R,P,z,_,k,B;return e[16]!==T?(I=xe("flex flex-row gap-2 items-center flex-1",T),e[16]=T,e[17]=I):I=e[17],e[18]!==o.type||e[19]!==C?(D=u.jsx(jL,{columnName:C,dataType:o.type}),e[18]=o.type,e[19]=C,e[20]=D):D=e[20],e[21]!==g?(F=g&&v({tooltipContent:"Primary key",content:"PK"}),e[21]=g,e[22]=F):F=e[22],e[23]!==p?(O=p&&v({tooltipContent:"Indexed",content:"IDX"}),e[23]=p,e[24]=O):O=e[24],e[25]!==I||e[26]!==D||e[27]!==F||e[28]!==O?(R=u.jsxs("div",{className:I,children:[D,F,O]}),e[25]=I,e[26]=D,e[27]=F,e[28]=O,e[29]=R):R=e[29],e[30]!==o.name?(P=u.jsx(Ee,{content:"Copy column name",delayDuration:400,children:u.jsx(ve,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:u.jsx(HC,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[30]=o.name,e[31]=P):P=e[31],e[32]!==o.external_type?(z=u.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),e[32]=o.external_type,e[33]=z):z=e[33],e[34]!==E||e[35]!==R||e[36]!==P||e[37]!==z||e[38]!==N||e[39]!==S?(_=u.jsxs(Zn,{className:"rounded-none py-1 group cursor-pointer",value:S,onSelect:E,children:[R,P,z]},N),e[34]=E,e[35]=R,e[36]=P,e[37]=z,e[38]=N,e[39]=S,e[40]=_):_=e[40],e[41]!==o||e[42]!==f||e[43]!==y||e[44]!==s||e[45]!==r||e[46]!==n?(k=s&&u.jsx("div",{className:"pl-10 pr-2 py-2 bg-(--slate-1) shadow-inner border-b",children:u.jsx(vc,{children:u.jsx(SL,{table:n,column:o,onAddColumnChart:y,preview:f.get(r?`${r.database}.${r.schema}.${n.name}:${o.name}`:`${n.name}:${o.name}`),sqlTableContext:r})})}),e[41]=o,e[42]=f,e[43]=y,e[44]=s,e[45]=r,e[46]=n,e[47]=k):k=e[47],e[48]!==_||e[49]!==k?(B=u.jsxs(u.Fragment,{children:[_,k]}),e[48]=_,e[49]=k,e[50]=B):B=e[50],B};function K7(t){const{tooltipContent:e,content:n}=t;return u.jsx(Ee,{content:e,delayDuration:100,children:u.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}const X7=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx($7,{}),t[0]=e):e=t[0],e},J7=()=>{const t=H.c(5),{documentation:e}=Ne(EL);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(dn,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:u.jsx(cd,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=tp({html:e}),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=u.jsx("div",{className:"p-3 overflow-y-auto overflow-x-hidden h-full docs-documentation flex flex-col gap-4",children:n}),t[3]=n,t[4]=o):o=t[4],o},Z7=()=>{const t=H.c(5),e=_L();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(dn,{title:"No errors!",icon:u.jsx(Vp,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(Q7),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=u.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function Q7(t){return u.jsxs("div",{children:[u.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:u.jsx(IL,{cellId:t.cellId})}),u.jsx("div",{className:"px-2",children:u.jsx(AL,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}const nm=new Map,e9=({file:t,onOpenNotebook:e})=>{const{theme:n}=vr(),{sendFileDetails:o,sendUpdateFile:r}=nt(),s=Ne(Fi),[i,a]=M.useState(""),{data:l,isPending:c,error:d,setData:h}=Tn(async()=>{const b=await o({path:t.path}),y=b.contents||"";return a(nm.get(t.path)||y),b},[t.path]),f=async()=>{i!==(l==null?void 0:l.contents)&&await r({path:t.path,contents:i}).then(b=>{b.success&&(h(y=>({...y,contents:i})),a(i))})},m=M.useRef(i);if(m.current=i,M.useEffect(()=>()=>{if(!(l!=null&&l.contents))return;const b=m.current;b===l.contents?nm.delete(t.path):nm.set(t.path,b)},[t.path,l==null?void 0:l.contents]),d)return u.jsx(kr,{error:d});if(c||!l)return null;const g=l.mimeType||"text/plain",x=g in om;if(!l.contents&&!x)return u.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[u.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),u.jsx("div",{children:l.file.name}),u.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),u.jsx("div",{children:g})]});const p=u.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!tn()&&u.jsx(Ee,{content:"Open notebook",children:u.jsx(cn,{size:"small",onClick:b=>e(b),children:u.jsx(xc,{})})}),u.jsx(Ee,{content:"Download",children:u.jsx(cn,{size:"small",onClick:()=>{if($k(g)){const b=PL(l.contents,g);return void LL(b,l.file.name)}$i(new Blob([l.contents||i],{type:g}),l.file.name)},children:u.jsx(Em,{})})}),!$k(g)&&u.jsxs(u.Fragment,{children:[u.jsx(Ee,{content:"Copy contents to clipboard",children:u.jsx(cn,{size:"small",onClick:async()=>{await sn(i)},children:u.jsx(Mi,{})})}),u.jsx(Ee,{content:Gt("global.save"),children:u.jsx(cn,{size:"small",color:i===l.contents?void 0:"green",onClick:f,disabled:i===l.contents,children:u.jsx(fa,{})})})]})]});return g.startsWith("image/")?u.jsxs(u.Fragment,{children:[p,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(TL,{base64:l.contents,mime:g})})]}):g==="text/csv"&&l.contents?u.jsxs(u.Fragment,{children:[p,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(ML,{contents:l.contents})})]}):g.startsWith("audio/")?u.jsxs(u.Fragment,{children:[p,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(OL,{base64:l.contents,mime:g})})]}):g.startsWith("video/")?u.jsxs(u.Fragment,{children:[p,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(DL,{base64:l.contents,mime:g})})]}):g.startsWith("application/pdf")?u.jsxs(u.Fragment,{children:[p,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(RL,{base64:l.contents,mime:g})})]}):u.jsxs(u.Fragment,{children:[p,u.jsx("div",{className:"flex-1 overflow-auto",children:u.jsx(M.Suspense,{children:u.jsx(ra,{theme:n==="dark"?"dark":"light",language:om[g]||om.default,className:"border-b",extensions:[We.lineWrapping,Mn.of([{key:s.getHotkey("global.save").key,stopPropagation:!0,run:()=>i!==l.contents&&(f(),!0)}])],value:i,onChange:a})})})]})},$k=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/")||t.startsWith("application/pdf"),om={"application/javascript":"javascript","text/markdown":"markdown","text/html":"html","text/css":"css","text/x-python":"python","application/json":"json","application/xml":"xml","text/x-yaml":"yaml","text/csv":"markdown","text/plain":"markdown",default:"markdown"};class t9{constructor(e){this.callbacks=e,this.delegate=new lp([]),this.rootPath="",this.onChange=Bn.NOOP,this.path=new mc("/"),this.initialize=async n=>{if(this.onChange=n,this.delegate.data.length===0)try{const o=await this.callbacks.listFiles({path:this.rootPath});this.delegate=new lp(o.files),this.rootPath=o.root,this.path=mc.guessDeliminator(o.root)}catch(o){Je({title:"Failed",description:vC(o)})}this.onChange(this.delegate.data)},this.refreshAll=async n=>{const o=[this.rootPath,...n.map(s=>{var i;return(i=this.delegate.find(s))==null?void 0:i.data.path})].filter(Boolean),r=await Promise.all(o.map(s=>this.callbacks.listFiles({path:s}).catch(()=>({files:[]}))));for(const[s,i]of o.entries()){const a=r[s];i===this.rootPath?this.delegate=new lp(a.files):this.delegate.update({id:i,changes:{children:a.files}})}this.onChange(this.delegate.data)},this.relativeFromRoot=n=>{const o=this.rootPath.endsWith(this.path.deliminator)?this.rootPath:`${this.rootPath}${this.path.deliminator}`;return n.startsWith(o)?n.slice(o.length):n},this.handleResponse=n=>n.success?n:(Je({title:"Failed",description:n.message}),null)}async expand(e){const n=this.delegate.find(e);if(!n||!n.data.isDirectory)return!1;if(n.children&&n.children.length>0)return!0;const o=await this.callbacks.listFiles({path:n.data.path});return this.delegate.update({id:e,changes:{children:o.files}}),this.onChange(this.delegate.data),!0}async rename(e,n){const o=this.delegate.find(e);if(!o)return;const r=o.data.path,s=this.path.join(this.path.dirname(r),n);await this.callbacks.renameFileOrFolder({path:r,newPath:s}).then(this.handleResponse),this.delegate.update({id:e,changes:{name:n,path:s}}),this.onChange(this.delegate.data),await this.refreshAll([s])}async move(e,n){var r;const o=n?((r=this.delegate.find(n))==null?void 0:r.data.path)??n:this.rootPath;await Promise.all(e.map(s=>{this.delegate.move({id:s,parentId:n,index:0});const i=this.delegate.find(s);if(!i)return Promise.resolve();const a=this.path.join(o,this.path.basename(i.data.path));return this.delegate.update({id:s,changes:{path:a}}),this.callbacks.renameFileOrFolder({path:i.data.path,newPath:a}).then(this.handleResponse)})),this.onChange(this.delegate.data),await this.refreshAll([o])}async createFile(e,n){var s;const o=n?((s=this.delegate.find(n))==null?void 0:s.data.path)??n:this.rootPath,r=await this.callbacks.createFileOrFolder({path:o,type:"file",name:e}).then(this.handleResponse);r!=null&&r.info&&(this.delegate.create({parentId:n,index:0,data:r.info}),this.onChange(this.delegate.data),await this.refreshAll([o]))}async createFolder(e,n){var s;const o=n?((s=this.delegate.find(n))==null?void 0:s.data.path)??n:this.rootPath,r=await this.callbacks.createFileOrFolder({path:o,type:"directory",name:e}).then(this.handleResponse);r!=null&&r.info&&(this.delegate.create({parentId:n,index:0,data:r.info}),this.onChange(this.delegate.data),await this.refreshAll([o]))}async delete(e){const n=this.delegate.find(e);n&&(await this.callbacks.deleteFileOrFolder({path:n.data.path}).then(this.handleResponse),this.delegate.drop({id:e}),this.onChange(this.delegate.data))}}const Vk=jt(t=>{const e=t(FL);return Un(e,"no requestClientAtom set"),new t9({listFiles:e.sendListFiles,createFileOrFolder:e.sendCreateFileOrFolder,deleteFileOrFolder:e.sendDeleteFileOrFolder,renameFileOrFolder:e.sendRenameFileOrFolder})}),n9=jt({});function o9(t){return new Promise((e,n)=>{const o=new FileReader;o.onload=r=>{var s;e((s=r.target)==null?void 0:s.result)},o.onerror=r=>{n(new Error(`Failed to read blob: ${r.type}`))},o.readAsDataURL(t)})}function Hk(t){const e=H.c(7);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const o=n,{sendCreateFileOrFolder:r}=nt();let s,i;return e[2]!==r?(s=async a=>{for(const l of a){const c=c9(l9(l));let d="";c&&(d=mc.guessDeliminator(c).dirname(c));const h=(await o9(l)).split(",")[1];await r({path:d,type:"file",name:l.name,contents:h})}await async function(){await Qe.get(Vk).refreshAll([])}()},e[2]=r,e[3]=s):s=e[3],e[4]!==o||e[5]!==s?(i={multiple:!0,maxSize:104857600,onError:a9,onDropRejected:r9,onDrop:s,...o},e[4]=o,e[5]=s,e[6]=i):i=e[6],zL(i)}function r9(t){Je({title:"File upload failed",description:u.jsx("div",{className:"flex flex-col gap-1",children:t.map(s9)}),variant:"danger"})}function s9(t){return u.jsxs("div",{children:[t.file.name," (",t.errors.map(i9).join(", "),")"]},t.file.name)}function i9(t){return t.message}function a9(t){ut.error(t),Je({title:"File upload failed",description:t.message,variant:"danger"})}function l9(t){return t.webkitRelativePath?t.webkitRelativePath:"path"in t&&typeof t.path=="string"?t.path:"relativePath"in t&&typeof t.relativePath=="string"?t.relativePath:void 0}function c9(t){if(t)return t.replace(/^\/+/,"")}const Wk=q.createContext(null),d9=t=>{const e=H.c(60),{height:n}=t,o=M.useRef(null),[r]=zt(Vk);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const[i,a]=M.useState(s),[l,c]=M.useState(null),{openPrompt:d}=An(),[h,f]=zt(n9);let m,g;e[1]!==r?(m=()=>r.initialize(a),e[1]=r,e[2]=m):m=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[3]=g):g=e[3];const{isPending:x,error:p}=Tn(m,g);let b;e[4]!==h||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(h).filter(k=>h[k]))},e[4]=h,e[5]=r,e[6]=b):b=e[6];const y=Fe(b);let v;e[7]!==d||e[8]!==r?(v=async()=>{d({title:"Folder name",onConfirm:async k=>{r.createFolder(k,null)}})},e[7]=d,e[8]=r,e[9]=v):v=e[9];const w=Fe(v);let j;e[10]!==d||e[11]!==r?(j=async()=>{d({title:"File name",onConfirm:async k=>{r.createFile(k,null)}})},e[10]=d,e[11]=r,e[12]=j):j=e[12];const C=Fe(j);let N;e[13]!==f?(N=()=>{var k;(k=o.current)==null||k.closeAll(),f({})},e[13]=f,e[14]=N):N=e[14];const S=Fe(N);if(x){let k;return e[15]===Symbol.for("react.memo_cache_sentinel")?(k=u.jsx(kn,{size:"medium",centered:!0}),e[15]=k):k=e[15],k}if(p){let k;return e[16]!==p?(k=u.jsx(kr,{error:p}),e[16]=p,e[17]=k):k=e[17],k}if(l){let k,B,A,U,V,X;return e[18]===Symbol.for("react.memo_cache_sentinel")?(k=()=>c(null),e[18]=k):k=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?(B=u.jsx(ve,{onClick:k,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:u.jsx(wt,{size:16})}),e[19]=B):B=e[19],e[20]!==l.name?(A=u.jsxs("div",{className:"flex items-center pl-1 pr-3 shrink-0 border-b justify-between",children:[B,u.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=A):A=e[21],e[22]!==l.path||e[23]!==r?(U=Y=>qk(Y,r.relativeFromRoot(l.path)),e[22]=l.path,e[23]=r,e[24]=U):U=e[24],e[25]!==l||e[26]!==U?(V=u.jsx(M.Suspense,{children:u.jsx(e9,{onOpenNotebook:U,file:l})}),e[25]=l,e[26]=U,e[27]=V):V=e[27],e[28]!==A||e[29]!==V?(X=u.jsxs(u.Fragment,{children:[A,V]}),e[28]=A,e[29]=V,e[30]=X):X=e[30],X}let E;e[31]!==S||e[32]!==C||e[33]!==w||e[34]!==y||e[35]!==r?(E=u.jsx(h9,{onRefresh:y,onCreateFile:C,onCreateFolder:w,onCollapseAll:S,tree:r}),e[31]=S,e[32]=C,e[33]=w,e[34]=y,e[35]=r,e[36]=E):E=e[36];const T=n-33;let I,D,F,O,R,P,z,_;return e[37]!==r?(I=async k=>{const{ids:B}=k;for(const A of B)await r.delete(A)},D=async k=>{const{id:B,name:A}=k;await r.rename(B,A)},F=async k=>{const{dragIds:B,parentId:A}=k;await r.move(B,A)},e[37]=r,e[38]=I,e[39]=D,e[40]=F):(I=e[38],D=e[39],F=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(O=k=>{const B=k[0];B&&(B.data.isDirectory||c(B.data))},e[41]=O):O=e[41],e[42]!==h||e[43]!==f||e[44]!==r?(R=async k=>{if(await r.expand(k)){const B=h[k]??!1;f({...h,[k]:!B})}},e[42]=h,e[43]=f,e[44]=r,e[45]=R):R=e[45],e[46]!==i||e[47]!==h||e[48]!==I||e[49]!==D||e[50]!==F||e[51]!==R||e[52]!==T?(P=u.jsx(SF,{width:"100%",ref:o,height:T,className:"h-full",data:i,initialOpenState:h,openByDefault:!1,renderCursor:x9,disableDrop:b9,onDelete:I,onRename:D,onMove:F,onSelect:O,onToggle:R,padding:15,rowHeight:30,indent:u9,overscanCount:1e3,disableMultiSelection:!0,children:p9}),e[46]=i,e[47]=h,e[48]=I,e[49]=D,e[50]=F,e[51]=R,e[52]=T,e[53]=P):P=e[53],e[54]!==P||e[55]!==r?(z=u.jsx(Wk,{value:r,children:P}),e[54]=P,e[55]=r,e[56]=z):z=e[56],e[57]!==z||e[58]!==E?(_=u.jsxs(u.Fragment,{children:[E,z]}),e[57]=z,e[58]=E,e[59]=_):_=e[59],_},u9=15,h9=t=>{const e=H.c(30),{onRefresh:n,onCreateFile:o,onCreateFolder:r,onCollapseAll:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={noDrag:!0,noDragEventsBubbling:!0},e[0]=i):i=e[0];const{getRootProps:a,getInputProps:l}=Hk(i);let c,d,h,f,m,g,x,p,b,y,v,w,j,C,N;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(ua,{size:16}),e[1]=c):c=e[1],e[2]!==o?(d=u.jsx(Ee,{content:"Add file",children:u.jsx(ve,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:c})}),e[2]=o,e[3]=d):d=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(td,{size:16}),e[4]=h):h=e[4],e[5]!==r?(f=u.jsx(Ee,{content:"Add folder",children:u.jsx(ve,{"data-testid":"file-explorer-add-folder-button",onClick:r,variant:"text",size:"xs",children:h})}),e[5]=r,e[6]=f):f=e[6],e[7]!==a?(m=a({}),e[7]=a,e[8]=m):m=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(g=BL({variant:"text",size:"xs"}),x=u.jsx($L,{size:16}),e[9]=g,e[10]=x):(g=e[9],x=e[10]),e[11]!==m?(p=u.jsx(Ee,{content:"Upload file",children:u.jsx("button",{"data-testid":"file-explorer-upload-button",...m,className:g,children:x})}),e[11]=m,e[12]=p):p=e[12],e[13]!==l?(b=l({}),e[13]=l,e[14]=b):b=e[14],e[15]!==b?(y=u.jsx("input",{...b,type:"file"}),e[15]=b,e[16]=y):y=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(v=u.jsx(_C,{size:16}),e[17]=v):v=e[17],e[18]!==n?(w=u.jsx(Ee,{content:"Refresh",children:u.jsx(ve,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:v})}),e[18]=n,e[19]=w):w=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx(wp,{size:16}),e[20]=j):j=e[20],e[21]!==s?(C=u.jsx(Ee,{content:"Collapse all folders",children:u.jsx(ve,{"data-testid":"file-explorer-collapse-button",onClick:s,variant:"text",size:"xs",children:j})}),e[21]=s,e[22]=C):C=e[22],e[23]!==y||e[24]!==w||e[25]!==C||e[26]!==d||e[27]!==f||e[28]!==p?(N=u.jsxs("div",{className:"flex items-center justify-end px-2 shrink-0 border-b",children:[d,f,p,y,w,C]}),e[23]=y,e[24]=w,e[25]=C,e[26]=d,e[27]=f,e[28]=p,e[29]=N):N=e[29],N},f9=t=>{const e=H.c(9),{node:n,onOpenMarimoFile:o}=t;let r,s,i;return e[0]!==n?(r=a=>{n.data.isDirectory||(a.stopPropagation(),n.select())},e[0]=n,e[1]=r):r=e[1],e[2]!==n.data.isMarimoFile||e[3]!==o?(s=n.data.isMarimoFile&&!tn()&&u.jsxs("span",{className:"shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",u.jsx(xc,{className:"inline ml-1",size:12})]}),e[2]=n.data.isMarimoFile,e[3]=o,e[4]=s):s=e[4],e[5]!==n.data.name||e[6]!==r||e[7]!==s?(i=u.jsxs("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:r,children:[n.data.name,s]}),e[5]=n.data.name,e[6]=r,e[7]=s,e[8]=i):i=e[8],i},m9=t=>{const e=H.c(10),{node:n}=t,o=M.useRef(null);let r,s,i,a,l;return e[0]!==n.data.name?(r=()=>{var c,d;(c=o.current)==null||c.focus(),(d=o.current)==null||d.setSelectionRange(0,n.data.name.lastIndexOf("."))},s=[n.data.name],e[0]=n.data.name,e[1]=r,e[2]=s):(r=e[1],s=e[2]),M.useEffect(r,s),e[3]!==n?(i=()=>n.reset(),a=c=>{c.key==="Escape"&&n.reset(),c.key==="Enter"&&n.submit(c.currentTarget.value)},e[3]=n,e[4]=i,e[5]=a):(i=e[4],a=e[5]),e[6]!==n.data.name||e[7]!==i||e[8]!==a?(l=u.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:y9,onBlur:i,onKeyDown:a}),e[6]=n.data.name,e[7]=i,e[8]=a,e[9]=l):l=e[9],l},p9=({node:t,style:e,dragHandle:n})=>{const{openFile:o,sendCreateFileOrFolder:r,sendFileDetails:s}=nt(),i=t.data.isDirectory?"directory":H3(t.data.name),a=W3[i],{openConfirm:l,openPrompt:c}=An(),{createNewCell:d}=lt(),h=hs(),f=M.use(Wk),m=async y=>{qk(y,f?f.relativeFromRoot(t.data.path):t.data.path)},g=async y=>{y.stopPropagation(),y.preventDefault(),l({title:"Delete file",description:`Are you sure you want to delete ${t.data.name}?`,confirmAction:u.jsx(z3,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},x=Fe(async()=>{t.open(),c({title:"Folder name",onConfirm:async y=>{f==null||f.createFolder(y,t.id)}})}),p=Fe(async()=>{t.open(),c({title:"File name",onConfirm:async y=>{f==null||f.createFile(y,t.id)}})}),b=Fe(async()=>{var j;if(!f||t.data.isDirectory)return;const[y,v]=UL(t.data.name),w=`${y}_copy${v}`;try{const C=await s({path:t.data.path}),N=((j=t.parent)==null?void 0:j.data.path)||"";await r({path:N,type:"file",name:w,contents:C.contents?btoa(C.contents):void 0}),await f.refreshAll([N])}catch{Je({title:"Failed to duplicate file",description:"Unable to create a duplicate of the file",variant:"danger"})}});return u.jsxs("div",{style:e,ref:n,className:xe("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),draggable:!0,onClick:y=>{y.stopPropagation(),t.data.isDirectory&&t.toggle()},children:[u.jsx(g9,{node:t}),u.jsxs("span",{className:xe("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",t.willReceiveDrop&&t.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground"),children:[t.data.isMarimoFile?u.jsx("img",{src:HF,className:"w-5 h-5 shrink-0 mr-2 filter grayscale",alt:"Marimo"}):u.jsx(a,{className:"w-5 h-5 shrink-0 mr-2",strokeWidth:1.5}),t.isEditing?u.jsx(m9,{node:t}):u.jsx(f9,{node:t,onOpenMarimoFile:m}),u.jsxs(Eo,{modal:!1,children:[u.jsx(_o,{asChild:!0,tabIndex:-1,onClick:y=>y.stopPropagation(),children:u.jsx(ve,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:u.jsx(ed,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),(()=>{const y={size:14,strokeWidth:1.5,className:"mr-2"};return u.jsxs(Io,{align:"end",className:"no-print w-[220px]",onClick:v=>v.stopPropagation(),onCloseAutoFocus:v=>v.preventDefault(),children:[!t.data.isDirectory&&u.jsxs(At,{onSelect:()=>t.select(),children:[u.jsx(rg,{...y}),"Open file"]}),!t.data.isDirectory&&!tn()&&u.jsxs(At,{onSelect:()=>{o({path:t.data.path})},children:[u.jsx(xc,{...y}),"Open file in external editor"]}),t.data.isDirectory&&u.jsxs(u.Fragment,{children:[u.jsxs(At,{onSelect:()=>p(),children:[u.jsx(ua,{...y}),"Create file"]}),u.jsxs(At,{onSelect:()=>x(),children:[u.jsx(td,{...y}),"Create folder"]}),u.jsx(an,{})]}),u.jsxs(At,{onSelect:()=>t.edit(),children:[u.jsx(Hp,{...y}),"Rename"]}),!t.data.isDirectory&&u.jsxs(At,{onSelect:b,children:[u.jsx(Mi,{...y}),"Duplicate"]}),u.jsxs(At,{onSelect:async()=>{await sn(t.data.path),Je({title:"Copied to clipboard"})},children:[u.jsx(rd,{...y}),"Copy path"]}),f&&u.jsxs(At,{onSelect:async()=>{await sn(f.relativeFromRoot(t.data.path)),Je({title:"Copied to clipboard"})},children:[u.jsx(rd,{...y}),"Copy relative path"]}),u.jsx(an,{}),u.jsxs(At,{onSelect:()=>{const{path:v}=t.data;(w=>{d({code:w,before:!1,cellId:h??"__end__"})})(rj[i](v))},children:[u.jsx(Nr,{...y}),"Insert snippet for reading file"]}),u.jsxs(At,{onSelect:async()=>{Je({title:"Copied to clipboard",description:"Code to open the file has been copied to your clipboard. You can also drag and drop this file into the editor"});const{path:v}=t.data,w=rj[i](v);await sn(w)},children:[u.jsx(VL,{...y}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!tn()&&u.jsxs(u.Fragment,{children:[u.jsx(an,{}),u.jsxs(At,{onSelect:m,children:[u.jsx(Qp,{...y}),"Open notebook"]})]}),u.jsx(an,{}),!t.data.isDirectory&&u.jsxs(u.Fragment,{children:[u.jsxs(At,{onSelect:async()=>{const v=(await s({path:t.data.path})).contents||"";$i(new Blob([v]),t.data.name)},children:[u.jsx(Em,{...y}),"Download"]}),u.jsx(an,{})]}),u.jsxs(At,{onSelect:g,variant:"danger",children:[u.jsx(rc,{...y}),"Delete"]})]})})()]})]})]})},g9=t=>{const e=H.c(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx("span",{className:"w-5 h-5 shrink-0"}),e[0]=r):r=e[0],r}let o;return e[1]!==n.isOpen?(o=n.isOpen?u.jsx(No,{className:"w-5 h-5 shrink-0"}):u.jsx(Li,{className:"w-5 h-5 shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function qk(t,e){t.stopPropagation(),t.preventDefault(),fj(e)}function x9(){return null}function b9(t){const{parentNode:e}=t;return!e.data.isDirectory}function y9(t){return t.stopPropagation()}let Gk,Yk,Kk;Gk=()=>{const t=H.c(20),{ref:e,height:n}=HL(),o=n===void 0?1:n;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={noClick:!0,noKeyboard:!0},t[0]=r):r=t[0];const{getRootProps:s,getInputProps:i,isDragActive:a}=Hk(r);let l,c,d,h,f,m,g,x;return t[1]!==s?(l=s(),t[1]=s,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=xe("flex flex-col flex-1 overflow-hidden relative"),t[3]=c):c=t[3],t[4]!==i?(d=i(),t[4]=i,t[5]=d):d=t[5],t[6]!==d?(h=u.jsx("input",{...d}),t[6]=d,t[7]=h):h=t[7],t[8]!==a?(f=a&&u.jsx("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),t[8]=a,t[9]=f):f=t[9],t[10]!==o?(m=u.jsx(d9,{height:o}),t[10]=o,t[11]=m):m=t[11],t[12]!==e||t[13]!==m?(g=u.jsx("div",{ref:e,className:"flex flex-col flex-1 overflow-hidden",children:m}),t[12]=e,t[13]=m,t[14]=g):g=t[14],t[15]!==l||t[16]!==h||t[17]!==f||t[18]!==g?(x=u.jsxs("div",{...l,className:c,children:[h,f,g]}),t[15]=l,t[16]=h,t[17]=f,t[18]=g,t[19]=x):x=t[19],x},pp=t=>{const e=H.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=xe("text-xs font-semibold text-accent-foreground",t.className),e[0]=t.className,e[1]=o):o=e[1],e[2]!==t.dataTestId||e[3]!==t.onClick||e[4]!==o?(r=u.jsx("button",{type:"button","data-testid":n,className:o,onClick:t.onClick,children:"Clear"}),e[2]=t.dataTestId,e[3]=t.onClick,e[4]=o,e[5]=r):r=e[5],r},Yk=()=>{const t=H.c(9),e=WL(),{clearLogs:n}=lt();if(e.length===0){let i,a;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx("code",{className:"border rounded px-1",children:"stdout"}),t[0]=i):i=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(dn,{title:"No logs",description:u.jsxs("span",{children:[i," and"," ",u.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:u.jsx(um,{})}),t[1]=a):a=t[1],a}let o,r,s;return t[2]!==n?(o=u.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:u.jsx(pp,{dataTestId:"clear-logs-button",onClick:n})}),t[2]=n,t[3]=o):o=t[3],t[4]!==e?(r=u.jsx("div",{className:"overflow-auto flex-1",children:u.jsx(Kk,{logs:e,className:"min-w-[300px]"})}),t[4]=e,t[5]=r):r=t[5],t[6]!==o||t[7]!==r?(s=u.jsxs(u.Fragment,{children:[o,r]}),t[6]=o,t[7]=r,t[8]=s):s=t[8],s},Kk=t=>{const e=H.c(10),{logs:n,className:o}=t;let r,s,i,a,l;return e[0]!==o?(r=xe("flex flex-col",o),e[0]=o,e[1]=r):r=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(s={whiteSpace:"pre-wrap"},e[2]=s):s=e[2],e[3]!==n?(i=n.map(k9),e[3]=n,e[4]=i):i=e[4],e[5]!==i?(a=u.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:u.jsx("div",{className:"grid grid-cols-[30px_1fr]",style:s,children:i})}),e[5]=i,e[6]=a):a=e[6],e[7]!==r||e[8]!==a?(l=u.jsx("div",{className:r,children:a}),e[7]=r,e[8]=a,e[9]=l):l=e[9],l};function v9(t){const e=qL(t.timestamp),n=w9[t.level],o=t.level.toUpperCase();return u.jsxs(u.Fragment,{children:[u.jsxs("span",{className:"shrink-0 text-(--gray-10) dark:text-(--gray-11)",children:["[",e,"]"]}),u.jsx("span",{className:xe("shrink-0",n),children:o}),u.jsxs("span",{className:"shrink-0 text-(--gray-10)",children:["(",u.jsx(Mo,{cellId:t.cellId}),")"]}),t.message]})}const w9={stdout:"text-(--grass-9)",stderr:"text-(--red-9)"};function k9(t,e){return u.jsxs("div",{className:"contents group",children:[u.jsx("span",{className:xe("opacity-70 group-hover:bg-(--gray-3) group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),u.jsx("span",{className:xe("opacity-70 group-hover:bg-(--gray-3) group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:v9(t)})]},e)}const C9=()=>{const t=H.c(7),{items:e}=Ne(GL);let n,o;t[0]!==e?(o=WF(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s,activeOccurrences:i}=qF(r);if(e.length===0){let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(dn,{title:"No outline found",description:"Add markdown headings to your notebook to create an outline.",icon:u.jsx(ld,{})}),t[2]=l):l=t[2],l}let a;return t[3]!==s||t[4]!==i||t[5]!==e?(a=u.jsx(GF,{items:e,activeHeaderId:s,activeOccurrences:i}),t[3]=s,t[4]=i,t[5]=e,t[6]=a):a=t[6],a},Xk=jt(null),Jk=t=>{const e=H.c(9),{onClick:n,loading:o,children:r,className:s}=t;if(o){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(kn,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=c):c=e[0],c}let i,a,l;return e[1]!==s?(i=xe("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",s),e[1]=s,e[2]=i):i=e[2],e[3]!==n?(a=zn.stopPropagation(n),e[3]=n,e[4]=a):a=e[4],e[5]!==r||e[6]!==i||e[7]!==a?(l=u.jsx("button",{type:"button",className:i,onClick:a,children:r}),e[5]=r,e[6]=i,e[7]=a,e[8]=l):l=e[8],l},j9=()=>{var N,S;const t=H.c(30),[e]=xr(),n=e.package_management.manager,{getDependencyTree:o,getPackageList:r}=nt(),[s,i]=q.useState(null);let a,l;t[0]!==o||t[1]!==r?(a=async()=>{const[E,T]=await Promise.all([r(),o()]);return{list:E.packages,tree:T.tree}},t[0]=o,t[1]=r,t[2]=a):a=t[2],t[3]!==n?(l=[n],t[3]=n,t[4]=l):l=t[4];const{data:c,error:d,refetch:h,isPending:f}=Tn(a,l);if(f){let E;return t[5]===Symbol.for("react.memo_cache_sentinel")?(E=u.jsx(kn,{size:"medium",centered:!0}),t[5]=E):E=t[5],E}if(d){let E;return t[6]!==d?(E=u.jsx(kr,{error:d}),t[6]=d,t[7]=E):E=t[7],E}const m=c.tree!=null;let g;t[8]!==m||t[9]!==s?(g=function(E,T){return E==="list"?"list":T?E||"tree":"list"}(s,m),t[8]=m,t[9]=s,t[10]=g):g=t[10];const x=g,p=(N=c.tree)==null?void 0:N.name,b=(S=c==null?void 0:c.tree)==null?void 0:S.version,y=p==="<root>";let v,w,j,C;return t[11]!==n||t[12]!==h?(v=u.jsx(S9,{packageManager:n,onSuccess:h}),t[11]=n,t[12]=h,t[13]=v):v=t[13],t[14]!==y||t[15]!==m||t[16]!==p||t[17]!==b||t[18]!==x?(w=m&&u.jsxs("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[u.jsxs("div",{className:"flex gap-1",children:[u.jsx("button",{type:"button",className:xe("px-2 py-1 text-xs rounded",x==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>i("list"),children:"List"}),u.jsx("button",{type:"button",className:xe("px-2 py-1 text-xs rounded",x==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>i("tree"),children:"Tree"})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium",title:y?"sandbox":"project",children:y?"sandbox":"project"}),p&&!y&&u.jsxs("span",{className:"text-xs text-muted-foreground",children:[p,b&&` v${b}`]})]})]}),t[14]=y,t[15]=m,t[16]=p,t[17]=b,t[18]=x,t[19]=w):w=t[19],t[20]!==c.list||t[21]!==c.tree||t[22]!==d||t[23]!==h||t[24]!==x?(j=x==="list"?u.jsx(N9,{packages:c.list,onSuccess:h}):u.jsx(E9,{tree:c.tree,error:d,onSuccess:h}),t[20]=c.list,t[21]=c.tree,t[22]=d,t[23]=h,t[24]=x,t[25]=j):j=t[25],t[26]!==v||t[27]!==w||t[28]!==j?(C=u.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[v,w,j]}),t[26]=v,t[27]=w,t[28]=j,t[29]=C):C=t[29],C},S9=t=>{const e=H.c(40),{onSuccess:n,packageManager:o}=t,[r,s]=q.useState(""),{handleClick:i}=ia(),a=Ne(Xk),l=Ct(Xk);let c,d;e[0]!==a||e[1]!==l?(c=()=>{a&&(s(a),l(null))},d=[a,l],e[0]=a,e[1]=l,e[2]=c,e[3]=d):(c=e[2],d=e[3]),q.useEffect(c,d);const{loading:h,handleInstallPackages:f}=YL();let m;e[4]!==n?(m=()=>{n(),s("")},e[4]=n,e[5]=m):m=e[5];const g=m;let x;e[6]!==f||e[7]!==r||e[8]!==g?(x=()=>{f(r.split(",").map(_9),g)},e[6]=f,e[7]=r,e[8]=g,e[9]=x):x=e[9];const p=x,b=`Install packages with ${o}...`;let y,v,w,j,C,N,S,E,T,I,D,F,O,R;e[10]!==h||e[11]!==i?(y=h?u.jsx(kn,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):u.jsx(Ee,{content:"Change package manager",children:u.jsx(Ss,{onClick:()=>i("packageManagement"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=h,e[11]=i,e[12]=y):y=e[12],e[13]!==p?(v=A=>{A.key==="Enter"&&(A.preventDefault(),p())},e[13]=p,e[14]=v):v=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(w=A=>s(A.target.value),e[15]=w):w=e[15],e[16]!==r||e[17]!==b||e[18]!==y||e[19]!==v?(j=u.jsx(sj,{placeholder:b,id:B1,icon:y,rootClassName:"flex-1 border-none",value:r,onKeyDown:v,onChange:w}),e[16]=r,e[17]=b,e[18]=y,e[19]=v,e[20]=j):j=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(C=u.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=C):C=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(N=u.jsxs("div",{children:[C," A package name; this will install the latest version.",u.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),S=u.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=N,e[23]=S):(N=e[22],S=e[23]),e[24]===Symbol.for("react.memo_cache_sentinel")?(E=u.jsxs("div",{children:[S," ","A package with a specific version or version range.",u.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),T=u.jsx("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=E,e[25]=T):(E=e[24],T=e[25]),e[26]===Symbol.for("react.memo_cache_sentinel")?(I=u.jsxs("div",{children:[T," A Git repository",u.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),D=u.jsx("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=I,e[27]=D):(I=e[26],D=e[27]),e[28]===Symbol.for("react.memo_cache_sentinel")?(F=u.jsxs("div",{children:[D," A remote wheel or source distribution.",u.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),O=u.jsx("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=F,e[29]=O):(F=e[28],O=e[29]),e[30]===Symbol.for("react.memo_cache_sentinel")?(R=u.jsx(Ee,{delayDuration:300,side:"left",align:"start",content:u.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:",u.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[N,E,I,F,u.jsxs("div",{children:[O," A local wheel, source distribution, or project directory.",u.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:u.jsx(Jm,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=R):R=e[30];const P=r&&"bg-accent text-accent-foreground";let z;e[31]!==P?(z=xe("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",P,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=P,e[32]=z):z=e[32];const _=!r;let k,B;return e[33]!==p||e[34]!==z||e[35]!==_?(k=u.jsx("button",{type:"button",className:z,onClick:p,disabled:_,children:"Add"}),e[33]=p,e[34]=z,e[35]=_,e[36]=k):k=e[36],e[37]!==k||e[38]!==j?(B=u.jsxs("div",{className:"flex items-center w-full border-b",children:[j,R,k]}),e[37]=k,e[38]=j,e[39]=B):B=e[39],B},N9=t=>{const e=H.c(9),{onSuccess:n,packages:o}=t;if(o.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(dn,{title:"No packages",description:"No packages are installed in this environment.",icon:u.jsx(Ss,{})}),e[0]=a):a=e[0],a}let r,s,i;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(rp,{children:u.jsxs(js,{children:[u.jsx(Cr,{children:"Name"}),u.jsx(Cr,{children:"Version"}),u.jsx(Cr,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let a;e[5]!==n?(a=l=>u.jsxs(js,{className:"group",onClick:async()=>{await sn(`${l.name}==${l.version}`),Je({title:"Copied to clipboard"})},children:[u.jsx(jr,{children:l.name}),u.jsx(jr,{children:l.version}),u.jsxs(jr,{className:"flex justify-end",children:[u.jsx(Zk,{packageName:l.name,onSuccess:n}),u.jsx(Qk,{packageName:l.name,onSuccess:n})]})]},l.name),e[5]=n,e[6]=a):a=e[6],s=o.map(a),e[2]=n,e[3]=o,e[4]=s}else s=e[4];return e[7]!==s?(i=u.jsxs(sp,{className:"overflow-auto flex-1",children:[r,u.jsx(ip,{children:s})]}),e[7]=s,e[8]=i):i=e[8],i},Zk=({packageName:t,onSuccess:e})=>{const[n,o]=q.useState(!1),{addPackage:r}=nt();return tn()?null:u.jsx(Jk,{onClick:async()=>{try{o(!0);const s=await r({package:t,upgrade:!0});s.success?(e(),ij(t)):ij(t,s.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},Qk=({packageName:t,onSuccess:e})=>{const[n,o]=q.useState(!1),{removePackage:r}=nt();return u.jsx(Jk,{onClick:async()=>{try{o(!0);const s=await r({package:t});s.success?(e(),aj(t)):aj(t,s.error)}finally{o(!1)}},loading:n,children:"Remove"})},E9=t=>{const e=H.c(18),{tree:n,error:o,onSuccess:r}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=new Set,e[0]=s):s=e[0];const[i,a]=q.useState(s);let l,c,d;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{a(new Set)},e[1]=l):l=e[1],e[2]!==n?(c=[n],e[2]=n,e[3]=c):c=e[3],q.useEffect(l,c),o){let g;return e[4]!==o?(g=u.jsx(kr,{error:o}),e[4]=o,e[5]=g):g=e[5],g}if(!n){let g;return e[6]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx(kn,{size:"medium",centered:!0}),e[6]=g):g=e[6],g}if(n.dependencies.length===0){let g;return e[7]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx(dn,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:u.jsx(Ss,{})}),e[7]=g):g=e[7],g}e[8]===Symbol.for("react.memo_cache_sentinel")?(d=g=>{a(x=>{const p=new Set(x);return p.has(g)?p.delete(g):p.add(g),p})},e[8]=d):d=e[8];const h=d;let f,m;if(e[9]!==i||e[10]!==r||e[11]!==n.dependencies){let g;e[13]!==i||e[14]!==r?(g=(x,p)=>u.jsx("div",{className:"border-b",children:u.jsx(e3,{nodeId:`root-${p}`,node:x,level:0,isTopLevel:!0,expandedNodes:i,onToggle:h,onSuccess:r})},`${x.name}-${p}`),e[13]=i,e[14]=r,e[15]=g):g=e[15],f=n.dependencies.map(g),e[9]=i,e[10]=r,e[11]=n.dependencies,e[12]=f}else f=e[12];return e[16]!==f?(m=u.jsx("div",{className:"flex-1 overflow-auto",children:u.jsx("div",{children:f})}),e[16]=f,e[17]=m):m=e[17],m},e3=t=>{const e=H.c(57),{nodeId:n,node:o,level:r,isTopLevel:s,expandedNodes:i,onToggle:a,onSuccess:l}=t,c=s!==void 0&&s,d=o.dependencies.length>0;let h;e[0]!==i||e[1]!==n?(h=i.has(n),e[0]=i,e[1]=n,e[2]=h):h=e[2];const f=h,m=c?0:16+16*r;let g;e[3]!==d||e[4]!==n||e[5]!==a?(g=z=>{z.key!=="Enter"&&z.key!==" "||(z.preventDefault(),d&&a(n))},e[3]=d,e[4]=n,e[5]=a,e[6]=g):g=e[6];const x=g;let p;e[7]!==d||e[8]!==n||e[9]!==a?(p=z=>{z.stopPropagation(),d&&a(n)},e[7]=d,e[8]=n,e[9]=a,e[10]=p):p=e[10];const b=p,y=d&&"select-none",v=c?"px-2 py-0.5":"";let w,j;e[11]!==y||e[12]!==v?(w=xe("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-(--slate-2) focus:bg-(--slate-2) focus:outline-hidden",y,v),e[11]=y,e[12]=v,e[13]=w):w=e[13],e[14]!==m||e[15]!==c?(j=c?{}:{paddingLeft:`${m}px`},e[14]=m,e[15]=c,e[16]=j):j=e[16];const C=d?f:void 0;let N,S,E,T,I,D,F,O,R,P;return e[17]!==d||e[18]!==f?(N=d?f?u.jsx(No,{className:"w-4 h-4 mr-2 shrink-0"}):u.jsx(Li,{className:"w-4 h-4 mr-2 shrink-0"}):u.jsx("div",{className:"w-4 mr-2 shrink-0"}),e[17]=d,e[18]=f,e[19]=N):N=e[19],e[20]!==o.name?(S=u.jsx("span",{className:"font-medium truncate",children:o.name}),e[20]=o.name,e[21]=S):S=e[21],e[22]!==o.version?(E=o.version&&u.jsxs("span",{className:"text-muted-foreground text-xs",children:["v",o.version]}),e[22]=o.version,e[23]=E):E=e[23],e[24]!==S||e[25]!==E?(T=u.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[S,E]}),e[24]=S,e[25]=E,e[26]=T):T=e[26],e[27]!==o.tags?(I=o.tags.map(I9),e[27]=o.tags,e[28]=I):I=e[28],e[29]!==I?(D=u.jsx("div",{className:"flex items-center gap-1 ml-2",children:I}),e[29]=I,e[30]=D):D=e[30],e[31]!==c||e[32]!==o.name||e[33]!==l?(F=c&&u.jsxs("div",{className:"flex gap-1 invisible group-hover:visible",children:[u.jsx(Zk,{packageName:o.name,onSuccess:l}),u.jsx(Qk,{packageName:o.name,onSuccess:l})]}),e[31]=c,e[32]=o.name,e[33]=l,e[34]=F):F=e[34],e[35]!==b||e[36]!==x||e[37]!==N||e[38]!==T||e[39]!==D||e[40]!==F||e[41]!==w||e[42]!==j||e[43]!==C?(O=u.jsxs("div",{className:w,style:j,onClick:b,onKeyDown:x,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":C,children:[N,T,D,F]}),e[35]=b,e[36]=x,e[37]=N,e[38]=T,e[39]=D,e[40]=F,e[41]=w,e[42]=j,e[43]=C,e[44]=O):O=e[44],e[45]!==i||e[46]!==d||e[47]!==f||e[48]!==r||e[49]!==o.dependencies||e[50]!==n||e[51]!==l||e[52]!==a?(R=d&&f&&u.jsx("div",{role:"group",children:o.dependencies.map((z,_)=>u.jsx(e3,{nodeId:`${n}-${_}`,node:z,level:r+1,isTopLevel:!1,expandedNodes:i,onToggle:a,onSuccess:l},`${z.name}-${_}`))}),e[45]=i,e[46]=d,e[47]=f,e[48]=r,e[49]=o.dependencies,e[50]=n,e[51]=l,e[52]=a,e[53]=R):R=e[53],e[54]!==O||e[55]!==R?(P=u.jsxs("div",{children:[O,R]}),e[54]=O,e[55]=R,e[56]=P):P=e[56],P};function _9(t){return t.trim()}function I9(t,e){return t.kind==="cycle"?u.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"?u.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"?u.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}const rm=hm("marimo:scratchpadHistory:v1",[]),A9=jt(!1),T9=jt(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(rm),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(rm,r)}),M9={hide_code:!1,disabled:!1},O9=()=>{const t=H.c(71),e=Dm(),[n]=xr(),{theme:o}=vr(),r=M.useRef(null),s=hs(),{createNewCell:i,updateCellCode:a}=lt(),{sendRunScratchpad:l}=nt(),c=e.cellRuntime[Zo],d=c==null?void 0:c.output,h=c==null?void 0:c.status,f=c==null?void 0:c.consoleOutputs,m=e.cellData[Zo],g=(m==null?void 0:m.code)??"",x=Ct(T9),[p,b]=zt(A9),y=Ne(rm);let v;t[0]!==x||t[1]!==g||t[2]!==l?(v=()=>{l({code:g}),x(g)},t[0]=x,t[1]=g,t[2]=l,t[3]=v):v=t[3];const w=Fe(v);let j;t[4]!==g||t[5]!==i||t[6]!==s?(j=()=>{g.trim()&&i({code:g,before:!1,cellId:s??"__end__"})},t[4]=g,t[5]=i,t[6]=s,t[7]=j):j=t[7];const C=Fe(j);let N;t[8]!==l||t[9]!==a?(N=()=>{a({cellId:Zo,code:"",formattingChange:!1}),l({code:""});const ue=r.current;ue&&ue.dispatch({changes:{from:0,to:ue.state.doc.length,insert:""}})},t[8]=l,t[9]=a,t[10]=N):N=t[10];const S=Fe(N);let E;t[11]!==b||t[12]!==a?(E=ue=>{b(!1),a({cellId:Zo,code:ue,formattingChange:!1});const le=r.current;le&&le.dispatch({changes:{from:0,to:le.state.doc.length,insert:ue}})},t[11]=b,t[12]=a,t[13]=E):E=t[13];const T=Fe(E),[I,D]=M.useState();let F;t[14]!==g||t[15]!==f||t[16]!==w||t[17]!==I||t[18]!==d||t[19]!==o||t[20]!==n?(F=()=>u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"overflow-auto shrink-0 max-h-[40%]",children:u.jsx(Fu,{theme:o,showPlaceholder:!1,id:Zo,code:g,config:M9,status:"idle",serializedEditorState:null,runCell:w,userConfig:n,editorViewRef:r,setEditorView:ue=>{r.current=ue},hidden:!1,showHiddenCode:Bn.NOOP,languageAdapter:I,setLanguageAdapter:D})}),u.jsx("div",{className:"flex-1 overflow-auto shrink-0",children:u.jsx(Uc,{allowExpand:!1,output:d,className:"output-area",cellId:Zo,stale:!1,loading:!1})}),u.jsx("div",{className:"overflow-auto shrink-0 max-h-[35%]",children:u.jsx(up,{consoleOutputs:f,className:"overflow-auto",stale:!1,cellName:w3,onSubmitDebugger:Bn.NOOP,cellId:Zo,debuggerActive:!1})})]}),t[14]=g,t[15]=f,t[16]=w,t[17]=I,t[18]=d,t[19]=o,t[20]=n,t[21]=F):F=t[21];const O=F;let R;t[22]!==T||t[23]!==y||t[24]!==p||t[25]!==o?(R=()=>p?u.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:u.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:y.map((ue,le)=>u.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>T(ue),children:u.jsx(M.Suspense,{children:u.jsx(ra,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:ue.trim(),editable:!1,readOnly:!0})})},le))})}):null,t[22]=T,t[23]=y,t[24]=p,t[25]=o,t[26]=R):R=t[26];const P=R;let z,_,k,B,A,U,V,X,Y,G,W;t[27]===Symbol.for("react.memo_cache_sentinel")?(z=Oi.create(Zo),_=u.jsx("p",{className:"mx-2 my-2 text-muted-foreground text-sm",children:"Use this scratchpad cell to experiment with code without restrictions on variable names. Scratchpad code is ephemeral: variables defined in the scratchpad aren't saved to notebook memory, and the code is not saved in the notebook file."}),t[27]=z,t[28]=_):(z=t[27],_=t[28]),t[29]===Symbol.for("react.memo_cache_sentinel")?(k=Gt("cell.run"),t[29]=k):k=t[29],t[30]===Symbol.for("react.memo_cache_sentinel")?(B=u.jsx(Sr,{color:"var(--grass-11)",size:16}),t[30]=B):B=t[30],t[31]!==w||t[32]!==p?(A=u.jsx(Ee,{content:k,children:u.jsx(ve,{"data-testid":"scratchpad-run-button",onClick:w,disabled:p,variant:"text",size:"xs",children:B})}),t[31]=w,t[32]=p,t[33]=A):A=t[33],t[34]===Symbol.for("react.memo_cache_sentinel")?(U=u.jsx(Cp,{size:16}),t[34]=U):U=t[34],t[35]!==S||t[36]!==p?(V=u.jsx(Ee,{content:"Clear code and outputs",children:u.jsx(ve,{disabled:p,size:"xs",variant:"text",onClick:S,children:U})}),t[35]=S,t[36]=p,t[37]=V):V=t[37],t[38]===Symbol.for("react.memo_cache_sentinel")?(X=u.jsx(Nr,{size:16}),t[38]=X):X=t[38],t[39]!==C||t[40]!==p?(Y=u.jsx(Rs,{children:u.jsx(Ee,{content:"Insert code",children:u.jsx(ve,{disabled:p,size:"xs",variant:"text",onClick:C,children:X})})}),t[39]=C,t[40]=p,t[41]=Y):Y=t[41],t[42]!==h?(G=(h==="running"||h==="queued")&&u.jsx(kn,{className:"inline",size:"small"}),t[42]=h,t[43]=G):G=t[43],t[44]===Symbol.for("react.memo_cache_sentinel")?(W=u.jsx("div",{className:"flex-1"}),t[44]=W):W=t[44];const J=p&&"bg-(--sky-3) rounded-none";let $,Q;t[45]!==J?($=xe(J),t[45]=J,t[46]=$):$=t[46],t[47]!==p||t[48]!==b?(Q=()=>b(!p),t[47]=p,t[48]=b,t[49]=Q):Q=t[49];const te=y.length===0;let oe,ne,ie,se,ae,fe,re;return t[50]===Symbol.for("react.memo_cache_sentinel")?(oe=u.jsx(Ap,{size:16}),t[50]=oe):oe=t[50],t[51]!==$||t[52]!==Q||t[53]!==te?(ne=u.jsx(Ee,{content:"Toggle history",children:u.jsx(ve,{size:"xs",variant:"text",className:$,onClick:Q,disabled:te,children:oe})}),t[51]=$,t[52]=Q,t[53]=te,t[54]=ne):ne=t[54],t[55]!==A||t[56]!==V||t[57]!==Y||t[58]!==G||t[59]!==ne?(ie=u.jsxs("div",{className:"flex items-center shrink-0",children:[A,V,Y,G,W,ne]}),t[55]=A,t[56]=V,t[57]=Y,t[58]=G,t[59]=ne,t[60]=ie):ie=t[60],t[61]!==O?(se=O(),t[61]=O,t[62]=se):se=t[62],t[63]!==P?(ae=P(),t[63]=P,t[64]=ae):ae=t[64],t[65]!==se||t[66]!==ae?(fe=u.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[se,ae]}),t[65]=se,t[66]=ae,t[67]=fe):fe=t[67],t[68]!==ie||t[69]!==fe?(re=u.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:z,children:[_,ie,fe]}),t[68]=ie,t[69]=fe,t[70]=re):re=t[70],re},D9=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(O9,{}),t[0]=e):e=t[0],e},R9=()=>{const t=H.c(23),{openModal:e,closeModal:n}=An();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,isPending:s,error:i,refetch:a}=Tn(L9,o);if(s){let b;return t[1]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(kn,{size:"medium",centered:!0}),t[1]=b):b=t[1],b}if(i){let b;return t[2]!==i?(b=u.jsx(kr,{error:i}),t[2]=i,t[3]=b):b=t[3],b}let l;t[4]!==r?(l=r.filter(F9).map(z9),t[4]=r,t[5]=l):l=t[5];const c=l;if(r.length===0){let b;return t[6]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(dn,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:u.jsx(nd,{})}),t[6]=b):b=t[6],b}let d,h,f,m,g,x,p;return t[7]!==n||t[8]!==e||t[9]!==c||t[10]!==a?(d=()=>e(u.jsx(Mg,{providerNames:c,onSuccess:()=>{a(),n()},onClose:n})),t[7]=n,t[8]=e,t[9]=c,t[10]=a,t[11]=d):d=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(Jo,{className:"h-4 w-4"}),t[12]=h):h=t[12],t[13]!==d?(f=u.jsx("div",{className:"flex justify-end h-8 border-b",children:u.jsx("button",{type:"button",className:"float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:d,children:h})}),t[13]=d,t[14]=f):f=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(rp,{children:u.jsxs(js,{children:[u.jsx(Cr,{children:"Environment Variable"}),u.jsx(Cr,{children:"Source"}),u.jsx(Cr,{})]})}),t[15]=m):m=t[15],t[16]!==r?(g=r.map(B9),t[16]=r,t[17]=g):g=t[17],t[18]!==g?(x=u.jsxs(sp,{className:"overflow-auto flex-1 mb-16",children:[m,u.jsx(ip,{children:g})]}),t[18]=g,t[19]=x):x=t[19],t[20]!==f||t[21]!==x?(p=u.jsxs("div",{className:"flex flex-col h-full",children:[f,x]}),t[20]=f,t[21]=x,t[22]=p):p=t[22],p},P9=t=>{const e=H.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,i]=q.useState(!1);let a;e[0]!==r?(a=()=>{r(),i(!0),setTimeout(()=>i(!1),1e3)},e[0]=r,e[1]=a):a=e[1];const l=a;let c,d;return e[2]!==s?(c=s?u.jsx(gc,{className:"w-3 h-3 text-green-700 rounded"}):u.jsx(Mi,{className:"w-3 h-3 hover:bg-muted rounded"}),e[2]=s,e[3]=c):c=e[3],e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==c?(d=u.jsx("button",{type:"button",className:n,onClick:l,"aria-label":o,children:c}),e[4]=o,e[5]=n,e[6]=l,e[7]=c,e[8]=d):d=e[8],d};async function L9(){return Tg((await yj.request({})).secrets)}function F9(t){return t.provider!=="env"}function z9(t){return t.name}function B9(t){return t.keys.map(e=>u.jsxs(js,{className:"group",children:[u.jsx(jr,{children:e}),u.jsx(jr,{children:t.provider!=="env"&&u.jsx(qC,{variant:"outline",className:"select-none",children:t.name})}),u.jsx(jr,{children:u.jsx(P9,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await sn(`os.environ["${e}"]`),Je({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:xe("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const U9=t=>{const e=H.c(6),{children:n}=t,{openModal:o,closeModal:r}=An();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(u.jsx(V9,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=u.jsx(FC,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},$9=[We.lineWrapping],V9=t=>{const e=H.c(23),{onClose:n}=t,[o,r]=M.useState(""),{theme:s}=vr();let i,a,l,c,d,h;e[0]!==n?(i=async v=>{v.preventDefault();const w=new FormData(v.target),j=w.get("title"),C=w.get("description"),N=w.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:j,description:C,code:N})}),n(),Je({title:"Snippet Submitted",description:"Thank you for contributing! We will review your snippet shortly."})},e[0]=n,e[1]=i):i=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(Wo,{children:"Contribute a Snippet"}),e[2]=a):a=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsxs(ls,{children:[a,u.jsxs(cs,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",u.jsx("a",{href:Fn.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(qo,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),d=u.jsx(KL,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),e[4]=c,e[5]=d):(c=e[4],d=e[5]),e[6]!==o?(h=u.jsx("input",{type:"hidden",name:"code",value:o}),e[6]=o,e[7]=h):h=e[7];const f=s==="dark"?"dark":"light";let m,g,x,p,b,y;return e[8]!==o||e[9]!==f?(m=u.jsx(ra,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:$9,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(g=u.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[c,d,h,m]}),e[11]=h,e[12]=m,e[13]=g):g=e[13],e[14]!==n?(x=u.jsx(ve,{"data-testid":"snippet-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=x):x=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(ve,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=p):p=e[16],e[17]!==x?(b=u.jsxs(Ti,{children:[x,p]}),e[17]=x,e[18]=b):b=e[18],e[19]!==i||e[20]!==b||e[21]!==g?(y=u.jsx(Go,{className:"w-fit",children:u.jsxs("form",{onSubmit:i,children:[l,g,b]})}),e[19]=i,e[20]=b,e[21]=g,e[22]=y):y=e[22],y},H9=[We.lineWrapping],W9=()=>{const t=H.c(22),{readSnippets:e}=nt(),[n,o]=q.useState();let r,s;t[0]!==e?(r=()=>e(),t[0]=e,t[1]=r):r=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(s=[],t[2]=s):s=t[2];const{data:i,error:a,isPending:l}=Tn(r,s);if(a){let v;return t[3]!==a?(v=u.jsx(kr,{error:a}),t[3]=a,t[4]=v):v=t[4],v}if(l||!i){let v;return t[5]===Symbol.for("react.memo_cache_sentinel")?(v=u.jsx(kn,{size:"medium",centered:!0}),t[5]=v):v=t[5],v}const c=n?"h-1/3":"h-full";let d,h,f,m,g,x,p,b,y;return t[6]!==c?(d=xe("border-b rounded-none",c),t[6]=c,t[7]=d):d=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(zi,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[8]=h):h=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsxs("div",{className:"flex items-center w-full",children:[h,u.jsx(U9,{children:u.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:u.jsx(Jo,{className:"h-4 w-4"})})})]}),m=u.jsx(ac,{children:"No results"}),t[9]=f,t[10]=m):(f=t[9],m=t[10]),t[11]===Symbol.for("react.memo_cache_sentinel")?(g=v=>o(v),t[11]=g):g=t[11],t[12]!==i.snippets?(x=u.jsx(G9,{onSelect:g,snippets:i.snippets}),t[12]=i.snippets,t[13]=x):x=t[13],t[14]!==d||t[15]!==x?(p=u.jsxs(yc,{className:d,children:[f,m,x]}),t[14]=d,t[15]=x,t[16]=p):p=t[16],t[17]!==n?(b=u.jsx(M.Suspense,{children:u.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:n?u.jsx(q9,{snippet:n,onClose:()=>o(void 0)},n.title):u.jsx(dn,{title:"",description:"Click on a snippet to view its content."})})}),t[17]=n,t[18]=b):b=t[18],t[19]!==b||t[20]!==p?(y=u.jsxs("div",{className:"flex-1 overflow-hidden",children:[p,b]}),t[19]=b,t[20]=p,t[21]=y):y=t[21],y},q9=t=>{const e=H.c(33),{snippet:n,onClose:o}=t,{theme:r}=vr(),{createNewCell:s}=lt(),i=hs();let a;e[0]!==s||e[1]!==i||e[2]!==n.sections?(a=()=>{for(const w of[...n.sections].reverse())w.code&&s({code:w.code,before:!1,cellId:i??"__end__",skipIfCodeExists:!0})},e[0]=s,e[1]=i,e[2]=n.sections,e[3]=a):a=e[3];const l=a;let c;e[4]!==s||e[5]!==i?(c=w=>{s({code:w,before:!1,cellId:i??"__end__"})},e[4]=s,e[5]=i,e[6]=c):c=e[6];const d=c;let h,f,m,g,x,p,b,y,v;if(e[7]!==n.title?(h=u.jsx("span",{children:n.title}),e[7]=n.title,e[8]=h):h=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(wn,{className:"h-4 w-4"}),e[9]=f):f=e[9],e[10]!==o?(m=u.jsx(ve,{size:"sm",variant:"ghost",onClick:o,className:"h-6 w-6 p-0 hover:bg-muted-foreground/10",children:f}),e[10]=o,e[11]=m):m=e[11],e[12]!==h||e[13]!==m?(g=u.jsxs("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1 flex justify-between items-center",children:[h,m]}),e[12]=h,e[13]=m,e[14]=g):g=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx(Nr,{className:"ml-2 h-4 w-4"}),e[15]=x):x=e[15],e[16]!==l?(p=u.jsx("div",{className:"flex justify-end",children:u.jsx(Rs,{children:u.jsxs(ve,{className:"float-right",size:"xs",variant:"outline",onClick:l,children:["Insert snippet",x]})})}),e[16]=l,e[17]=p):p=e[17],e[18]!==d||e[19]!==n.sections||e[20]!==n.title||e[21]!==r){let w;e[23]!==d||e[24]!==n.title||e[25]!==r?(w=j=>{const{code:C,html:N,id:S}=j;return N?u.jsx("div",{children:tp({html:N})},`${n.title}-${S}`):C?u.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[u.jsx(Rs,{children:u.jsx(Ee,{content:"Insert snippet",children:u.jsx(ve,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{d(C)},children:u.jsx(Nr,{className:"h-5 w-5"})})})}),u.jsx(M.Suspense,{children:u.jsx(ra,{theme:r==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:H9,value:C,readOnly:!0},`${n.title}-${S}`)})]},`${n.title}-${S}`):null},e[23]=d,e[24]=n.title,e[25]=r,e[26]=w):w=e[26],b=n.sections.map(w),e[18]=d,e[19]=n.sections,e[20]=n.title,e[21]=r,e[22]=b}else b=e[22];return e[27]!==p||e[28]!==b?(y=u.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[p,b]}),e[27]=p,e[28]=b,e[29]=y):y=e[29],e[30]!==y||e[31]!==g?(v=u.jsxs(u.Fragment,{children:[g,y]}),e[30]=y,e[31]=g,e[32]=v):v=e[32],v},G9=t=>{const e=H.c(7),{snippets:n,onSelect:o}=t;let r,s;if(e[0]!==o||e[1]!==n){let i;e[3]!==o?(i=a=>u.jsx(Zn,{className:"rounded-none",onSelect:()=>o(a),children:u.jsx("div",{className:"flex flex-row gap-2 items-center",children:u.jsx("span",{className:"mt-1 text-accent-foreground",children:a.title})})},a.title),e[3]=o,e[4]=i):i=e[4],r=n.map(i),e[0]=o,e[1]=n,e[2]=r}else r=e[2];return e[5]!==r?(s=u.jsx(Hm,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s},Y9=q.lazy(()=>qm(()=>import("./tracing-BpM0fbsC.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125]),import.meta.url).then(t=>({default:t.Tracing}))),K9=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(q.Suspense,{fallback:u.jsx(X9,{}),children:u.jsx(Y9,{})}),t[0]=e):e=t[0],e},X9=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:u.jsx(kn,{})}),t[0]=e):e=t[0],e},t3="name",n3="type-value",sm="defs-refs",J9=[{id:t3,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>u.jsx(ap,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return u.jsx(xf,{name:e,declaredBy:n})}},{id:n3,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>u.jsx(ap,{header:u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx("span",{children:"Type"}),u.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return u.jsxs("div",{className:"max-w-[150px]",children:[u.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),u.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:sm,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>u.jsx(ap,{header:u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx("span",{children:"Declared By"}),u.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=s=>{const i=Ri(s);i&&np(i,o)};return u.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[u.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[u.jsx("span",{title:"Declared by",children:u.jsx(Jp,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?u.jsx(Mo,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):u.jsx("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((s,i)=>u.jsxs("span",{className:"flex",children:[u.jsx(Mo,{variant:"focus",cellId:s,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(s)},s),i<e.length-1&&", "]},s))})]}),u.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[u.jsx("span",{title:"Used by",children:u.jsx(ma,{className:"w-3.5 h-3.5 text-muted-foreground"})}),u.jsx(Sw,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],o3=M.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=q.useState([]),[s,i]=q.useState(""),a=XL(),l=M.useMemo(()=>{const h=f=>{const m=a[f];return tF(m)?`cell-${e.indexOf(f)}`:m??`cell-${e.indexOf(f)}`};return Object.values(n).map(f=>({...f,declaredByNames:f.declaredBy.map(h),usedByNames:f.usedBy.map(h)}))},[n,a,e]),c=M.useMemo(()=>{const h=new Map;return e.forEach((f,m)=>h.set(f,m)),function({variables:f,sort:m,cellIdToIndex:g}){m||(m={id:sm,desc:!1});let x=[];switch(m.id){case t3:x=la(f,p=>p.name);break;case n3:x=la(f,p=>p.dataType);break;case sm:x=la(f,p=>g.get(p.declaredBy[0]))}return m.desc?x.reverse():x}({variables:l,sort:o[0],cellIdToIndex:h})},[l,o,e]),d=JL({data:c,columns:J9,getCoreRowModel:eF(),onGlobalFilterChange:i,getFilteredRowModel:QL(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:h=>h.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:ZL(),state:{sorting:o,globalFilter:s}});return u.jsxs(u.Fragment,{children:[u.jsx(sj,{className:"w-full",placeholder:"Search",value:s,onChange:h=>i(h.target.value)}),u.jsxs(sp,{className:xe("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[u.jsx(rp,{children:u.jsx(js,{className:"whitespace-nowrap text-xs",children:d.getFlatHeaders().map(h=>u.jsx(Cr,{className:"sticky top-0 bg-background border-b",children:lj(h.column.columnDef.header,h.getContext())},h.id))})}),u.jsx(ip,{children:d.getRowModel().rows.map(h=>u.jsx(js,{className:"hover:bg-accent",children:h.getVisibleCells().map(f=>u.jsx(jr,{className:"border-b",children:lj(f.column.columnDef.cell,f.getContext())},f.id))},h.id))})]})]})});o3.displayName="VariableTable";const Z9=()=>{const t=H.c(4),e=op(),n=wr();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(dn,{title:"No variables",description:"Global variables will appear here.",icon:u.jsx(Kl,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=u.jsx(o3,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o},Q9=t=>{const e=H.c(54),n=Ne(nF),o=Ne(O6),r=lt(),s=CC(),i=t.cellId,a=o[t.cellId],l=Zi(t.cellId),c=l.code,d=Qi(t.cellId);let h,f,m,g,x,p,b,y,v,w,j,C,N,S;if(e[0]!==r||e[1]!==s||e[2]!==n.focusedCellId||e[3]!==o||e[4]!==t.cellId||e[5]!==a||e[6]!==l.code||e[7]!==d.errored){if(h={id:i,graph:a,code:c,hasError:d.errored},n.focusedCellId&&o[n.focusedCellId]){const z=o[n.focusedCellId];let _;e[20]!==n.focusedCellId||e[21]!==z?(_={id:n.focusedCellId,graph:z},e[20]=n.focusedCellId,e[21]=z,e[22]=_):_=e[22],g=_}m=(g==null?void 0:g.id)===h.id,f=s3(h.graph)?1.5:3;const O=()=>{m?s.blurCell():(r.focusCell({cellId:h.id,where:"exact"}),s.focusCell({cellId:h.id}))};C=h.id;const R=m?"text-primary-foreground":"text-(--gray-8) hover:text-(--gray-9)";e[23]!==R?(x=xe("group bg-transparent text-left w-full flex relative justify-between items-center","border-none rounded cursor-pointer","h-[21px] pl-[51px] font-inherit",R),e[23]=R,e[24]=x):x=e[24],p=O,b=iO;const P=m&&"bg-primary group-hover:bg-primary";e[25]!==P?(j=xe("group-hover:bg-(--gray-2) flex h-full w-full px-0.5 items-center rounded",P),e[25]=P,e[26]=j):j=e[26],y="truncate px-1 font-mono text-sm flex gap-1",v=h.code,w=h.graph.variables.length>0?u.jsx(oO,{cell:h,selectedCell:g}):u.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap max-w-full",children:nO(h.code)??u.jsx("span",{className:"italic",children:"empty"})}),e[0]=r,e[1]=s,e[2]=n.focusedCellId,e[3]=o,e[4]=t.cellId,e[5]=a,e[6]=l.code,e[7]=d.errored,e[8]=h,e[9]=f,e[10]=m,e[11]=g,e[12]=x,e[13]=p,e[14]=b,e[15]=y,e[16]=v,e[17]=w,e[18]=j,e[19]=C}else h=e[8],f=e[9],m=e[10],g=e[11],x=e[12],p=e[13],b=e[14],y=e[15],v=e[16],w=e[17],j=e[18],C=e[19];e[27]!==y||e[28]!==v||e[29]!==w?(N=u.jsx("div",{className:y,title:v,children:w}),e[27]=y,e[28]=v,e[29]=w,e[30]=N):N=e[30],e[31]!==N||e[32]!==j?(S=u.jsx("div",{className:j,children:N}),e[31]=N,e[32]=j,e[33]=S):S=e[33];const E=m?"z-30":"z-20";let T,I,D,F;return e[34]!==h||e[35]!==g||e[36]!==E?(T=xe("absolute overflow-visible top-[10.5px] left-[calc(var(--spacing-extra-small,8px)+17px)] pointer-events-none",E,function({cell:O,selectedCell:R}){return O.hasError?"text-destructive":!R&&!s3(O.graph)?"text-foreground":(R==null?void 0:R.id)===O.id||R!=null&&R.graph.parents.has(O.id)||R!=null&&R.graph.children.has(O.id)?"text-primary":"text-(--gray-8)"}({cell:h,selectedCell:g})),e[34]=h,e[35]=g,e[36]=E,e[37]=T):T=e[37],e[38]!==h||e[39]!==f||e[40]!==m||e[41]!==t.cellPositions||e[42]!==g?(I=m?u.jsx(rO,{cell:h,cellPositions:t.cellPositions,circleRadius:f}):u.jsx(sO,{cell:h,selectedCell:g,circleRadius:f}),e[38]=h,e[39]=f,e[40]=m,e[41]=t.cellPositions,e[42]=g,e[43]=I):I=e[43],e[44]!==T||e[45]!==I?(D=u.jsx("svg",{className:T,width:"1",height:"1",children:I}),e[44]=T,e[45]=I,e[46]=D):D=e[46],e[47]!==x||e[48]!==p||e[49]!==b||e[50]!==S||e[51]!==D||e[52]!==C?(F=u.jsxs("button",{"data-node-id":C,className:x,onClick:p,onMouseDown:b,children:[S,D]}),e[47]=x,e[48]=p,e[49]=b,e[50]=S,e[51]=D,e[52]=C,e[53]=F):F=e[53],F},eO=t=>{const e=H.c(28),{open:n,setOpen:o}=t,r=wr();let s;e[0]!==r.inOrderIds?(s=Object.fromEntries(r.inOrderIds.map(aO)),e[0]=r.inOrderIds,e[1]=s):s=e[1];const i=s;let a;if(e[2]!==r){a=[];let v=0;for(const[w,j]of r.getColumns().entries())w>0&&a.push(v),v+=j.inOrderIds.length;e[2]=r,e[3]=a}else a=e[3];const l=n?"translate-x-0":"translate-x-[calc(100%+20px)]";let c,d,h,f,m,g,x,p,b,y;if(e[4]!==l?(c=xe("fixed top-14 right-5 z-50 bg-background/95 backdrop-blur-sm supports-backdrop-filter:bg-background/60 rounded-lg border shadow-lg w-64 flex flex-col max-h-[58vh]","motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-in-out",l),e[4]=l,e[5]=c):c=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx("span",{className:"text-sm font-semibold",children:"Minimap"}),e[6]=d):d=e[6],e[7]!==o?(h=()=>o(!1),e[7]=o,e[8]=h):h=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(wn,{className:"h-4 w-4"}),e[9]=f):f=e[9],e[10]!==h?(m=u.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[d,u.jsx(ve,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:h,children:f})]}),e[10]=h,e[11]=m):m=e[11],e[12]!==r.inOrderIds||e[13]!==i||e[14]!==a){let v;e[16]!==i||e[17]!==a?(v=(w,j)=>{const C=a.includes(j);return u.jsxs(M.Fragment,{children:[C&&u.jsx("div",{className:"absolute left-5 w-[36px] h-px bg-(--gray-4) pointer-events-none","aria-hidden":"true"}),u.jsx(Q9,{cellId:w,cellPositions:i})]},w)},e[16]=i,e[17]=a,e[18]=v):v=e[18],g=r.inOrderIds.map(v),e[12]=r.inOrderIds,e[13]=i,e[14]=a,e[15]=g}else g=e[15];return e[19]!==g?(x=u.jsx("div",{className:"py-3 pl-3 pr-4 relative min-h-full",children:g}),e[19]=g,e[20]=x):x=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx("div",{className:"h-0 overflow-hidden","aria-hidden":"true"}),e[21]=p):p=e[21],e[22]!==x?(b=u.jsxs("div",{className:"overflow-y-auto overflow-x-hidden flex-1 scrollbar-none",children:[x,p]}),e[22]=x,e[23]=b):b=e[23],e[24]!==b||e[25]!==c||e[26]!==m?(y=u.jsxs("div",{className:c,children:[m,b]}),e[24]=b,e[25]=c,e[26]=m,e[27]=y):y=e[27],y},tO=()=>{const t=H.c(5),[e,n]=zt(Hb);let o,r;return t[0]!==n?(o=()=>n(lO),t[0]=n,t[1]=o):o=t[1],Dt("global.toggleMinimap",o),t[2]!==e||t[3]!==n?(r=u.jsx(eO,{open:e,setOpen:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r};function nO(t){return t.split(`
|
|
163
|
-
`)[0].trim()||void 0}const oO=t=>{const e=H.c(11),{cell:n,selectedCell:o}=t,r=op(),s=n.id===(o==null?void 0:o.id);let i,a;if(e[0]!==n.graph.variables||e[1]!==s||e[2]!==o||e[3]!==r){let l;e[5]!==s||e[6]!==o||e[7]!==r?(l=(c,d)=>{const h=r[c];return u.jsxs(M.Fragment,{children:[d>0&&", ",u.jsx("span",{className:xe({"font-bold":s,"text-foreground":o===void 0,"text-primary font-medium":!s&&D6(h,o)}),children:c})]},c)},e[5]=s,e[6]=o,e[7]=r,e[8]=l):l=e[8],i=n.graph.variables.map(l),e[0]=n.graph.variables,e[1]=s,e[2]=o,e[3]=r,e[4]=i}else i=e[4];return e[9]!==i?(a=u.jsx(u.Fragment,{children:i}),e[9]=i,e[10]=a):a=e[10],a},rO=t=>{const e=H.c(12),{cell:n,cellPositions:o,circleRadius:r}=t;let s,i,a,l;if(e[0]!==n.graph.children||e[1]!==n.graph.parents||e[2]!==n.id||e[3]!==o){s=[];const c=o[n.id]??0,d=new Set;for(const h of n.graph.parents)n.graph.children.has(h)&&d.add(h);for(const h of d){const f=o[h];if(f!==void 0){const m=21*(f-c);s.push(u.jsx("path",{d:`M -3 0 H -7 v ${m} h 14 v ${-m} H 3`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n.id}-cycle-${h}`))}}for(const h of n.graph.parents){if(d.has(h))continue;const f=o[h];if(f!==void 0){const m=21*(f-c);s.push(u.jsx("path",{d:`M -3 0 H -7 v ${m} h -4`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n.id}-up-${h}`))}}for(const h of n.graph.children){if(d.has(h))continue;const f=o[h];if(f!==void 0){const m=21*(f-c);s.push(u.jsx("path",{d:`M 3 0 H 7 v ${m} h 4`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n.id}-down-${h}`))}}e[0]=n.graph.children,e[1]=n.graph.parents,e[2]=n.id,e[3]=o,e[4]=s}else s=e[4];return e[5]!==r?(i=u.jsx("circle",{r,fill:"currentColor",className:"pointer-events-auto"}),e[5]=r,e[6]=i):i=e[6],e[7]!==s?(a=u.jsx("g",{className:"pen pointer-events-auto",children:s}),e[7]=s,e[8]=a):a=e[8],e[9]!==i||e[10]!==a?(l=u.jsxs("g",{transform:"translate(0, 0)",children:[i,a]}),e[9]=i,e[10]=a,e[11]=l):l=e[11],l};function sO(t){const{cell:e,selectedCell:n,circleRadius:o}=t,r=e.graph.ancestors.size>0,s=e.graph.descendants.size>0;if(!n)return r3({circleRadius:o,leftWisker:r,rightWisker:s});const i=n.graph.ancestors.has(e.id),a=n.graph.descendants.has(e.id);return r3(i||a?{circleRadius:o,leftWisker:r,rightWisker:s,shift:i&&a?void 0:i?"left":"right"}:{circleRadius:o,leftWisker:!1,rightWisker:!1})}function r3(t){const{circleRadius:e,leftWisker:n,rightWisker:o,shift:r}=t,s=r===void 0?0:r==="left"?-14:14;return u.jsxs("g",{transform:`translate(${s}, 0)`,children:[u.jsxs("g",{children:[n&&u.jsx("path",{d:"M 0 0 h -8",fill:"none",strokeWidth:"2",stroke:"currentColor"}),o&&u.jsx("path",{d:"M 0 0 h 8",fill:"none",strokeWidth:"2",stroke:"currentColor"})]}),u.jsx("circle",{r:e,fill:"currentColor",className:"pointer-events-auto"})]})}function s3(t){return t.variables.length===0&&t.ancestors.size===0&&t.descendants.size===0}function iO(t){return t.preventDefault()}function aO(t,e){return[t,e]}function lO(t){return!t}const cO=q.lazy(()=>qm(()=>import("./terminal-CuPjZ1vE.js"),__vite__mapDeps([126,1,2,127]),import.meta.url)),dO=t=>{const e=H.c(122),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=pc(),{setIsSidebarOpen:i,setIsTerminalOpen:a}=Ui(),l=q.useRef(null),c=q.useRef(null);let d,h,f,m,g;e[0]!==o?(d=()=>{if(!l.current)return;const Re=l.current.isCollapsed();o&&Re&&l.current.expand(),o||Re||l.current.collapse(),requestAnimationFrame(hO)},h=[o],e[0]=o,e[1]=d,e[2]=h):(d=e[1],h=e[2]),M.useEffect(d,h),e[3]!==r?(f=()=>{if(!c.current)return;const Re=c.current.isCollapsed();r&&Re&&c.current.expand(),r||Re||c.current.collapse(),requestAnimationFrame(mO)},m=[r],e[3]=r,e[4]=f,e[5]=m):(f=e[4],m=e[5]),M.useEffect(f,m),e[6]!==n?(g=u.jsx(Wc,{id:"app",className:"relative h-full",children:u.jsx(M.Suspense,{children:n})},"app"),e[6]=n,e[7]=g):g=e[7];const x=g,p=o?"resize-handle":"resize-handle-collapsed";let b,y;e[8]!==p?(b=xe("border-border no-print z-10",p,"vertical"),e[8]=p,e[9]=b):b=e[9],e[10]!==b?(y=u.jsx(cj,{onDragging:dj,className:b}),e[10]=b,e[11]=y):y=e[11];const v=y,w=r?"resize-handle":"resize-handle-collapsed";let j,C;e[12]!==w?(j=xe("border-border no-print z-20",w,"horizontal"),e[12]=w,e[13]=j):j=e[13],e[14]!==j?(C=u.jsx(cj,{onDragging:dj,className:j}),e[14]=j,e[15]=C):C=e[15];const N=C;let S,E,T,I,D,F,O,R,P,z,_,k,B,A,U,V,X,Y,G,W,J;e[16]!==s?(S=u.jsx("div",{className:"text-sm text-(--slate-11) uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=S):S=e[17],e[18]!==i?(E=()=>i(!1),e[18]=i,e[19]=E):E=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(T=u.jsx(wn,{className:"w-4 h-4"}),e[20]=T):T=e[20],e[21]!==E?(I=u.jsx(ve,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:E,children:T}),e[21]=E,e[22]=I):I=e[22],e[23]!==S||e[24]!==I?(D=u.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[S,I]}),e[23]=S,e[24]=I,e[25]=D):D=e[25],e[26]!==s?(F=s==="files"&&u.jsx(Gk,{}),e[26]=s,e[27]=F):F=e[27],e[28]!==s?(O=s==="errors"&&u.jsx(Z7,{}),e[28]=s,e[29]=O):O=e[29],e[30]!==s?(R=s==="variables"&&u.jsx(Z9,{}),e[30]=s,e[31]=R):R=e[31],e[32]!==s?(P=s==="dependencies"&&u.jsx(L7,{}),e[32]=s,e[33]=P):P=e[33],e[34]!==s?(z=s==="packages"&&u.jsx(j9,{}),e[34]=s,e[35]=z):z=e[35],e[36]!==s?(_=s==="outline"&&u.jsx(C9,{}),e[36]=s,e[37]=_):_=e[37],e[38]!==s?(k=s==="datasources"&&u.jsx(X7,{}),e[38]=s,e[39]=k):k=e[39],e[40]!==s?(B=s==="documentation"&&u.jsx(J7,{}),e[40]=s,e[41]=B):B=e[41],e[42]!==s?(A=s==="snippets"&&u.jsx(W9,{}),e[42]=s,e[43]=A):A=e[43],e[44]!==s?(U=s==="scratchpad"&&u.jsx(D9,{}),e[44]=s,e[45]=U):U=e[45],e[46]!==s?(V=s==="chat"&&u.jsx(iT,{}),e[46]=s,e[47]=V):V=e[47],e[48]!==s?(X=s==="logs"&&u.jsx(Yk,{}),e[48]=s,e[49]=X):X=e[49],e[50]!==s?(Y=s==="tracing"&&u.jsx(K9,{}),e[50]=s,e[51]=Y):Y=e[51],e[52]!==s?(G=s==="secrets"&&u.jsx(R9,{}),e[52]=s,e[53]=G):G=e[53],e[54]!==F||e[55]!==O||e[56]!==R||e[57]!==P||e[58]!==z||e[59]!==_||e[60]!==k||e[61]!==B||e[62]!==A||e[63]!==U||e[64]!==V||e[65]!==X||e[66]!==Y||e[67]!==G?(W=u.jsx(M.Suspense,{children:u.jsxs($c,{children:[F,O,R,P,z,_,k,B,A,U,V,X,Y,G]})}),e[54]=F,e[55]=O,e[56]=R,e[57]=P,e[58]=z,e[59]=_,e[60]=k,e[61]=B,e[62]=A,e[63]=U,e[64]=V,e[65]=X,e[66]=Y,e[67]=G,e[68]=W):W=e[68],e[69]!==D||e[70]!==W?(J=u.jsx(vc,{children:u.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[D,W]})}),e[69]=D,e[70]=W,e[71]=J):J=e[71];const $=J,Q=o&&"border-r border-l border-(--slate-7)";let te,oe,ne,ie,se,ae;e[72]!==Q?(te=xe("dark:bg-(--slate-1) no-print print:hidden hide-on-fullscreen",Q),e[72]=Q,e[73]=te):te=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(oe=(Re,Pe)=>{var He;Pe===0&&Re===10&&((He=l.current)==null||He.resize(30))},e[74]=oe):oe=e[74],e[75]!==i?(ne=()=>i(!1),ie=()=>i(!0),e[75]=i,e[76]=ne,e[77]=ie):(ne=e[76],ie=e[77]),e[78]!==$||e[79]!==v?(se=u.jsxs("span",{className:"flex flex-row h-full",children:[$," ",v]}),e[78]=$,e[79]=v,e[80]=se):se=e[80],e[81]!==te||e[82]!==ne||e[83]!==ie||e[84]!==se?(ae=u.jsx(Wc,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:te,minSize:10,defaultSize:0,maxSize:75,onResize:oe,onCollapse:ne,onExpand:ie,children:se},"helper"),e[81]=te,e[82]=ne,e[83]=ie,e[84]=se,e[85]=ae):ae=e[85];const fe=ae,re=r&&"border-(--slate-7)";let ue,le,je,Se,Le,Ie,ke,Ye,Ve;e[86]!==re?(ue=xe("dark:bg-(--slate-1) no-print print:hidden hide-on-fullscreen",re),e[86]=re,e[87]=ue):ue=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(le=(Re,Pe)=>{var He;Pe===0&&Re===10&&((He=c.current)==null||He.resize(30))},e[88]=le):le=e[88],e[89]!==a?(je=()=>a(!1),Se=()=>a(!0),e[89]=a,e[90]=je,e[91]=Se):(je=e[90],Se=e[91]),e[92]===Symbol.for("react.memo_cache_sentinel")?(Le=u.jsx("div",{}),e[92]=Le):Le=e[92],e[93]!==a?(Ie=()=>a(!1),e[93]=a,e[94]=Ie):Ie=e[94],e[95]!==r||e[96]!==Ie?(ke=u.jsx(M.Suspense,{fallback:Le,children:u.jsx(cO,{visible:r,onClose:Ie})}),e[95]=r,e[96]=Ie,e[97]=ke):ke=e[97],e[98]!==r||e[99]!==ke?(Ye=u.jsx(F7,{isOpen:r,children:ke}),e[98]=r,e[99]=ke,e[100]=Ye):Ye=e[100],e[101]!==ue||e[102]!==je||e[103]!==Se||e[104]!==Ye||e[105]!==N?(Ve=u.jsxs(Wc,{ref:c,id:"terminal",collapsedSize:0,collapsible:!0,className:ue,minSize:10,defaultSize:0,maxSize:75,onResize:le,onCollapse:je,onExpand:Se,children:[N,Ye]},"terminal"),e[101]=ue,e[102]=je,e[103]=Se,e[104]=Ye,e[105]=N,e[106]=Ve):Ve=e[106];const Ke=Ve;let ee,ye,we,Ae,K,pe,ge,he,Ce;return e[107]===Symbol.for("react.memo_cache_sentinel")?(ee=YF(),e[107]=ee):ee=e[107],e[108]===Symbol.for("react.memo_cache_sentinel")?(ye=u.jsx($c,{children:u.jsx(H6,{})}),e[108]=ye):ye=e[108],e[109]!==Ke?(we=u.jsx($b,{capability:"terminal",children:Ke}),e[109]=Ke,e[110]=we):we=e[110],e[111]!==x||e[112]!==we?(Ae=u.jsx(Wc,{children:u.jsxs(uj,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[x,we]})}),e[111]=x,e[112]=we,e[113]=Ae):Ae=e[113],e[114]===Symbol.for("react.memo_cache_sentinel")?(K=u.jsx(oF,{}),e[114]=K):K=e[114],e[115]!==fe||e[116]!==Ae?(pe=u.jsxs(uj,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:ee,children:[ye,fe,Ae,K]}),e[115]=fe,e[116]=Ae,e[117]=pe):pe=e[117],e[118]===Symbol.for("react.memo_cache_sentinel")?(ge=u.jsx(tO,{}),e[118]=ge):ge=e[118],e[119]===Symbol.for("react.memo_cache_sentinel")?(he=u.jsx(vc,{children:u.jsx($c,{children:u.jsx(z6,{})})}),e[119]=he):he=e[119],e[120]!==pe?(Ce=u.jsxs(KF,{children:[pe,ge,he]}),e[120]=pe,e[121]=Ce):Ce=e[121],Ce};function uO(){window.dispatchEvent(new Event("resize"))}function hO(){requestAnimationFrame(uO)}function fO(){window.dispatchEvent(new Event("resize"))}function mO(){requestAnimationFrame(fO)}let i3;i3=new URL(window.location.href).searchParams.get(rF.showChrome)==="false",Oj=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=H.c(10);if(i3){let s,i,a;return e[0]!==t?(s=u.jsx(Ub,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(ug,{}),e[2]=i):i=e[2],e[3]!==s?(a=u.jsxs(u.Fragment,{children:[s,i]}),e[3]=s,e[4]=a):a=e[4],a}let n,o,r;return e[5]!==t?(n=u.jsx(Ub,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(ug,{}),e[7]=o):o=e[7],e[8]!==n?(r=u.jsxs(dO,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{pp as C,Gc as E,dn as P,oz as __tla,Yc as a,Oj as e,Es as f};
|
|
162
|
+
`).length),position:{x:0,y:0}}}createElements(t,e,n,o){const r=[],s=[],i=new Set,a=new Set;for(const l of Object.values(n)){if(l.value==="marimo"&&l.name==="mo")continue;const{declaredBy:c,usedBy:d}=l;for(const h of c)for(const f of d){const m=`${h}-${f}`;a.has(m)||(a.add(m),i.add(h),i.add(f),s.push(this.createEdge(h,f)))}}for(const[l,c]of ep.zip(t,e)){o||r.push(this.createNode(l,c));const d=i.has(l),h=Qe.get(c).code.trim().startsWith("mo.md");!d&&h||r.push(this.createNode(l,c))}return{nodes:r,edges:s}}},M7=t=>{const e=H.c(43),{cellIds:n,variables:o,cellAtoms:r,children:s,layoutDirection:i,settings:a}=t;let l;e[0]!==r||e[1]!==n||e[2]!==i||e[3]!==a.hidePureMarkdown||e[4]!==o?(l=()=>{let k=Bk.createElements(n,r,o,a.hidePureMarkdown);return k=zk({nodes:k.nodes,edges:k.edges,direction:i}),k},e[0]=r,e[1]=n,e[2]=i,e[3]=a.hidePureMarkdown,e[4]=o,e[5]=l):l=e[5];const[c]=M.useState(l),[d,h,f]=bw(c.nodes),[m,g,x]=yw(c.edges),p=Ni();let b;e[6]!==i||e[7]!==g||e[8]!==h?(b=k=>{const B=zk({nodes:k.nodes,edges:k.edges,direction:i});h(B.nodes),g(B.edges)},e[6]=i,e[7]=g,e[8]=h,e[9]=b):b=e[9];const y=Fe(b);let v,w;e[10]!==r||e[11]!==n||e[12]!==a.hidePureMarkdown||e[13]!==y||e[14]!==o?(v=()=>{y(Bk.createElements(n,r,o,a.hidePureMarkdown))},w=[n,o,r,y,a.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=a.hidePureMarkdown,e[13]=y,e[14]=o,e[15]=v,e[16]=w):(v=e[15],w=e[16]),M.useEffect(v,w);const[j,C]=M.useState();let N;Nw(),e[17]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{C(void 0)},e[17]=N):N=e[17];const S=N;let E,T,I,D,F,O,R,P,z,_;return e[18]===Symbol.for("react.memo_cache_sentinel")?(E={minZoom:.5,maxZoom:1.5},T=(k,B)=>{C({type:"node",id:B.id})},I=(k,B)=>{const{source:A,target:U}=B;C({type:"edge",source:A,target:U})},e[18]=E,e[19]=T,e[20]=I):(E=e[18],T=e[19],I=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(D=u.jsx(ZM,{color:"#ccc",variant:En.Dots}),e[21]=D):D=e[21],e[22]!==p||e[23]!==d?(F=()=>{const k=Qe.get(mL);if(k){const B=d.find(A=>A.id===k);B&&(p.fitView({padding:1,duration:600,nodes:[B]}),C({type:"node",id:k}))}},e[22]=p,e[23]=d,e[24]=F):F=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(O=u.jsx(Rp,{className:"size-4"}),e[25]=O):O=e[25],e[26]!==F?(R=u.jsx(qM,{position:"bottom-right",showInteractive:!1,children:u.jsx(Ee,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:u.jsx(ss,{onMouseDown:zn.preventFocus,onClick:F,children:O})})}),e[26]=F,e[27]=R):R=e[27],e[28]!==m||e[29]!==j||e[30]!==o?(P=u.jsx(Wl,{selection:j,variables:o,edges:m,onClearSelection:S}),e[28]=m,e[29]=j,e[30]=o,e[31]=P):P=e[31],e[32]!==s||e[33]!==m||e[34]!==d||e[35]!==x||e[36]!==f||e[37]!==R||e[38]!==P?(z=u.jsxs(pf,{nodes:d,edges:m,nodeTypes:jw,minZoom:.2,fitViewOptions:E,onNodeClick:T,onEdgeClick:I,onNodeDoubleClick:O7,fitView:!0,onNodesChange:f,onEdgesChange:x,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[D,R,P,s]}),e[32]=s,e[33]=m,e[34]=d,e[35]=x,e[36]=f,e[37]=R,e[38]=P,e[39]=z):z=e[39],e[40]!==i||e[41]!==z?(_=u.jsx(kw,{value:i,children:z}),e[40]=i,e[41]=z,e[42]=_):_=e[42],_};function O7(t,e){GC(e.id,"focus")}const D7=jt("_minimap_"),R7=jt({hidePureMarkdown:!0}),P7=t=>{const e=H.c(11),[n,o]=zt(D7),[r,s]=zt(R7);let i;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(i=()=>n==="_minimap_"?u.jsx(o7,{...t,children:u.jsx(bf,{settings:r,onSettingsChange:s,view:n,onChange:o})}):u.jsx(M7,{...t,settings:r,layoutDirection:n,children:u.jsx(bf,{settings:r,onSettingsChange:s,view:n,onChange:o})}),e[0]=n,e[1]=t,e[2]=o,e[3]=s,e[4]=r,e[5]=i):i=e[5];const a=i;let l,c;return e[6]!==a?(l=a(),e[6]=a,e[7]=l):l=e[7],e[8]!==n||e[9]!==l?(c=u.jsx(mf,{children:l},n),e[8]=n,e[9]=l,e[10]=c):c=e[10],c},L7=()=>{const t=H.c(5),e=op(),n=wr(),[o]=pL();let r,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=xe("w-full h-full flex-1 mx-auto -mb-4 relative"),t[0]=r):r=t[0],t[1]!==n.inOrderIds||t[2]!==o||t[3]!==e?(s=u.jsx("div",{className:r,children:u.jsx(P7,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},F7=t=>{const e=H.c(4),{isOpen:n,children:o}=t,[r,s]=q.useState(!1);let i,a;return e[0]!==r||e[1]!==n?(i=()=>{n&&!r&&s(!0)},a=[n,r],e[0]=r,e[1]=n,e[2]=i,e[3]=a):(i=e[2],a=e[3]),q.useEffect(i,a),r?o:null},z7=t=>{const e=H.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(d){const h=Qe.get(kc)[d];if(h)return h.declaredBy[0]}(n);if(!l)return;const c=Ri(l);c&&np(c,n)},e[0]=n,e[1]=r):r=e[1];const s=r;let i,a;return e[2]!==o?(i=xe("text-link opacity-80 hover:opacity-100 hover:underline",o),e[2]=o,e[3]=i):i=e[3],e[4]!==s||e[5]!==i||e[6]!==n?(a=u.jsx("button",{type:"button",onClick:s,className:i,children:n}),e[4]=s,e[5]=i,e[6]=n,e[7]=a):a=e[7],a},B7=jt(t=>{const e=t(gL),n=t(kc),o=t(ta);return la(e,r=>{if(!r.variable_name)return-1;const s=Object.values(n).find(a=>a.name===r.variable_name);if(!s)return 0;const i=o.inOrderIds.indexOf(s.declaredBy[0]);return i===-1?0:i})}),U7=jt(t=>{const e=new Map(t(xL));for(const n of YC){const o=e.get(n);o&&(o.databases.length===0&&e.delete(n),o.databases.length===1&&o.databases[0].name===bL&&o.databases[0].schemas.length===0&&e.delete(n))}return la([...e.values()],n=>YC.has(n.name)?1:0)}),$7=()=>{const t=H.c(32),[e,n]=q.useState(""),o=Ct(KC),r=Ne(B7),s=Ne(U7);if(r.length===0&&s.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(dn,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:u.jsx(Pg,{children:u.jsxs(ve,{variant:"outline",size:"sm",children:["Add database or catalog",u.jsx(Jo,{className:"h-4 w-4 ml-2"})]})}),icon:u.jsx(Yo,{})}),t[0]=b):b=t[0],b}const i=!!e.trim();let a,l,c,d,h,f,m,g,x,p;if(t[1]!==o?(a=b=>{o(b.length>0),n(b)},t[1]=o,t[2]=a):a=t[2],t[3]!==e||t[4]!==a?(l=u.jsx(zi,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:a,rootClassName:"flex-1 border-r"}),t[3]=e,t[4]=a,t[5]=l):l=t[5],t[6]!==i?(c=i&&u.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>n(""),children:u.jsx(wn,{className:"h-4 w-4"})}),t[6]=i,t[7]=c):c=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(Pg,{children:u.jsx("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:u.jsx(Jo,{className:"h-4 w-4"})})}),t[8]=d):d=t[8],t[9]!==l||t[10]!==c?(h=u.jsxs("div",{className:"flex items-center w-full",children:[l,c,d]}),t[9]=l,t[10]=c,t[11]=h):h=t[11],t[12]!==s||t[13]!==i||t[14]!==e){let b;t[16]!==i||t[17]!==e?(b=y=>u.jsx(V7,{connection:y,hasChildren:y.databases.length>0,children:y.databases.map(v=>u.jsx(H7,{engineName:y.name,database:v,hasSearch:i,children:u.jsx(W7,{schemas:v.schemas,defaultSchema:y.default_schema,defaultDatabase:y.default_database,engineName:y.name,databaseName:v.name,hasSearch:i,searchValue:e})},v.name))},y.name),t[16]=i,t[17]=e,t[18]=b):b=t[18],f=s.map(b),t[12]=s,t[13]=i,t[14]=e,t[15]=f}else f=t[15];return t[19]!==s.length||t[20]!==r.length?(m=s.length>0&&r.length>0&&u.jsxs(XC,{children:[u.jsx(nc,{className:"h-4 w-4 text-muted-foreground"}),u.jsx("span",{className:"text-xs",children:"Python"})]}),t[19]=s.length,t[20]=r.length,t[21]=m):m=t[21],t[22]!==e||t[23]!==r?(g=r.length>0&&u.jsx(Uk,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=g):g=t[24],t[25]!==f||t[26]!==m||t[27]!==g?(x=u.jsxs(Hm,{className:"flex flex-col",children:[f,m,g]}),t[25]=f,t[26]=m,t[27]=g,t[28]=x):x=t[28],t[29]!==h||t[30]!==x?(p=u.jsxs(yc,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden",shouldFilter:!1,children:[h,x]}),t[29]=h,t[30]=x,t[31]=p):p=t[31],p},V7=t=>{const e=H.c(26),{connection:n,children:o,hasChildren:r}=t,s=n.name===yL,i=s?"In-Memory":n.name,{previewDataSourceConnection:a}=nt(),[l,c]=q.useState(!1);let d;e[0]!==n.name||e[1]!==a?(d=async()=>{c(!0),await a({engine:n.name}),setTimeout(()=>c(!1),500)},e[0]=n.name,e[1]=a,e[2]=d):d=e[2];const h=d;let f,m,g;e[3]!==n.dialect?(f=u.jsx(L3,{className:"h-4 w-4 text-muted-foreground",name:n.dialect}),e[3]=n.dialect,e[4]=f):f=e[4],e[5]!==n.dialect?(m=vL(n.dialect),e[5]=n.dialect,e[6]=m):m=e[6],e[7]!==m?(g=u.jsx("span",{className:"text-xs",children:m}),e[7]=m,e[8]=g):g=e[8];const x=i;let p,b,y,v,w;return e[9]!==x?(p=u.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",u.jsx(z7,{variableName:x}),")"]}),e[9]=x,e[10]=p):p=e[10],e[11]!==h||e[12]!==s||e[13]!==l?(b=!s&&u.jsx(Ee,{content:"Refresh connection",children:u.jsx(ve,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:h,children:u.jsx(Oc,{className:xe("h-4 w-4 text-muted-foreground hover:text-foreground",l&&"animate-[spin_0.5s]")})})}),e[11]=h,e[12]=s,e[13]=l,e[14]=b):b=e[14],e[15]!==f||e[16]!==g||e[17]!==p||e[18]!==b?(y=u.jsxs(XC,{children:[f,g,p,b]}),e[15]=f,e[16]=g,e[17]=p,e[18]=b,e[19]=y):y=e[19],e[20]!==o||e[21]!==r?(v=r?o:u.jsx(Hc,{content:"No databases available",className:"pl-2"}),e[20]=o,e[21]=r,e[22]=v):v=e[22],e[23]!==y||e[24]!==v?(w=u.jsxs(u.Fragment,{children:[y,v]}),e[23]=y,e[24]=v,e[25]=w):w=e[25],w},H7=t=>{const e=H.c(28),{hasSearch:n,engineName:o,database:r,children:s}=t,[i,a]=q.useState(!1),[l,c]=q.useState(!1);let d,h,f;e[0]!==n?(d=()=>{a(n)},h=[n],e[0]=n,e[1]=d,e[2]=h):(d=e[1],h=e[2]),q.useEffect(d,h),e[3]!==i||e[4]!==l?(f=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=f):f=e[5];const m=`${o}:${r.name}`;let g;e[6]!==i?(g=u.jsx(nj,{isExpanded:i}),e[6]=i,e[7]=g):g=e[7];const x=l&&i?"text-foreground":"text-muted-foreground";let p,b;e[8]!==x?(p=xe("h-4 w-4",x),e[8]=x,e[9]=p):p=e[9],e[10]!==p?(b=u.jsx(Yo,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&i&&"font-semibold";let v,w,j,C;e[12]!==y?(v=xe(y),e[12]=y,e[13]=v):v=e[13],e[14]!==r.name?(w=r.name===""?u.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=w):w=e[15],e[16]!==v||e[17]!==w?(j=u.jsx("span",{className:v,children:w}),e[16]=v,e[17]=w,e[18]=j):j=e[18],e[19]!==j||e[20]!==f||e[21]!==m||e[22]!==g||e[23]!==b?(C=u.jsxs(Zn,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:m,children:[g,b,j]}),e[19]=j,e[20]=f,e[21]=m,e[22]=g,e[23]=b,e[24]=C):C=e[24];const N=i&&s;let S;return e[25]!==C||e[26]!==N?(S=u.jsxs(u.Fragment,{children:[C,N]}),e[25]=C,e[26]=N,e[27]=S):S=e[27],S},W7=t=>{const e=H.c(20),{schemas:n,defaultSchema:o,defaultDatabase:r,engineName:s,databaseName:i,hasSearch:a,searchValue:l}=t;if(n.length===0){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(Hc,{content:"No schemas available",className:"pl-6"}),e[0]=h):h=e[0],h}let c,d;if(e[1]!==i||e[2]!==r||e[3]!==o||e[4]!==s||e[5]!==a||e[6]!==n||e[7]!==l){let h;e[9]!==l?(h=g=>!l||g.tables.some(x=>x.name.toLowerCase().includes(l.toLowerCase())),e[9]=l,e[10]=h):h=e[10];const f=n.filter(h);let m;e[11]!==i||e[12]!==r||e[13]!==o||e[14]!==s||e[15]!==a||e[16]!==l?(m=g=>u.jsx(q7,{databaseName:i,schema:g,hasSearch:a,children:u.jsx(Uk,{tables:g.tables,searchValue:l,sqlTableContext:{engine:s,database:i,schema:g.name,defaultSchema:o,defaultDatabase:r}})},g.name),e[11]=i,e[12]=r,e[13]=o,e[14]=s,e[15]=a,e[16]=l,e[17]=m):m=e[17],c=f.map(m),e[1]=i,e[2]=r,e[3]=o,e[4]=s,e[5]=a,e[6]=n,e[7]=l,e[8]=c}else c=e[8];return e[18]!==c?(d=u.jsx(u.Fragment,{children:c}),e[18]=c,e[19]=d):d=e[19],d},q7=t=>{const e=H.c(26),{databaseName:n,schema:o,children:r,hasSearch:s}=t,[i,a]=q.useState(!1),[l,c]=q.useState(!1),d=`${n}:${o.name}`;let h,f,m,g;if(e[0]!==s?(h=()=>{a(s)},f=[s],e[0]=s,e[1]=h,e[2]=f):(h=e[1],f=e[2]),q.useEffect(h,f),tj(o.name))return r;e[3]!==i||e[4]!==l?(m=()=>{a(!i),c(!l)},e[3]=i,e[4]=l,e[5]=m):m=e[5],e[6]!==i?(g=u.jsx(nj,{isExpanded:i}),e[6]=i,e[7]=g):g=e[7];const x=l&&i&&"text-foreground";let p,b;e[8]!==x?(p=xe("h-4 w-4 text-muted-foreground",x),e[8]=x,e[9]=p):p=e[9],e[10]!==p?(b=u.jsx(EL,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&i&&"font-semibold";let v,w,j;e[12]!==y?(v=xe(y),e[12]=y,e[13]=v):v=e[13],e[14]!==o.name||e[15]!==v?(w=u.jsx("span",{className:v,children:o.name}),e[14]=o.name,e[15]=v,e[16]=w):w=e[16],e[17]!==w||e[18]!==m||e[19]!==g||e[20]!==b||e[21]!==d?(j=u.jsxs(Zn,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:m,value:d,children:[g,b,w]}),e[17]=w,e[18]=m,e[19]=g,e[20]=b,e[21]=d,e[22]=j):j=e[22];const C=i&&r;let N;return e[23]!==j||e[24]!==C?(N=u.jsxs(u.Fragment,{children:[j,C]}),e[23]=j,e[24]=C,e[25]=N):N=e[25],N},Uk=t=>{const e=H.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=JC(),[i,a]=q.useState(!1),[l,c]=q.useState(!1);let d,h;e[0]!==s||e[1]!==o||e[2]!==n.length||e[3]!==i?(d=async()=>{if(n.length===0&&o&&!i){a(!0),c(!0);const{engine:p,database:b,schema:y}=o,v=await VF.request({engine:p,database:b,schema:y});if(!(v!=null&&v.tables))throw c(!1),new Error("No tables available");s({tables:v.tables,sqlTableContext:o}),c(!1)}},e[0]=s,e[1]=o,e[2]=n.length,e[3]=i,e[4]=d):d=e[4],e[5]!==o||e[6]!==n.length||e[7]!==i?(h=[n.length,o,i],e[5]=o,e[6]=n.length,e[7]=i,e[8]=h):h=e[8];const{isPending:f,error:m}=Tn(d,h);if(f||l){let p;return e[9]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(ZC,{message:"Loading tables...",className:"pl-12"}),e[9]=p):p=e[9],p}if(m){let p;return e[10]!==m?(p=u.jsx(QC,{error:m,className:"pl-12"}),e[10]=m,e[11]=p):p=e[11],p}if(n.length===0){let p;return e[12]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(Hc,{content:"No tables found",className:"pl-9"}),e[12]=p):p=e[12],p}let g,x;if(e[13]!==r||e[14]!==o||e[15]!==n){let p;e[17]!==r?(p=v=>!r||v.name.toLowerCase().includes(r.toLowerCase()),e[17]=r,e[18]=p):p=e[18];const b=n.filter(p);let y;e[19]!==r||e[20]!==o?(y=v=>u.jsx(G7,{table:v,sqlTableContext:o,isSearching:!!r},v.name),e[19]=r,e[20]=o,e[21]=y):y=e[21],g=b.map(y),e[13]=r,e[14]=o,e[15]=n,e[16]=g}else g=e[16];return e[22]!==g?(x=u.jsx(u.Fragment,{children:g}),e[22]=g,e[23]=x):x=e[23],x},G7=t=>{const e=H.c(64),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=JC(),[i,a]=q.useState(!1),[l,c]=q.useState(!1),d=n.columns.length>0;let h,f;e[0]!==s||e[1]!==i||e[2]!==o||e[3]!==n.name||e[4]!==d||e[5]!==l?(h=async()=>{if(i&&!d&&o&&!l){c(!0);const{engine:W,database:J,schema:$}=o,Q=await HF.request({engine:W,database:J,schema:$,tableName:n.name});if(!(Q!=null&&Q.table))throw new Error("No table details available");s({table:Q.table,sqlTableContext:o})}},e[0]=s,e[1]=i,e[2]=o,e[3]=n.name,e[4]=d,e[5]=l,e[6]=h):h=e[6],e[7]!==i||e[8]!==d?(f=[i,d],e[7]=i,e[8]=d,e[9]=f):f=e[9];const{isFetching:m,isPending:g,error:x}=Tn(h,f),p=Ne(ec),b=hs(),{createNewCell:y}=lt(),v=ej();let w;e[10]!==v||e[11]!==p||e[12]!==y||e[13]!==b||e[14]!==o||e[15]!==n?(w=()=>{Jn({autoInstantiate:p,createNewCell:y,fromCellId:b}),v((()=>{if(n.source_type==="catalog"){const W=o!=null&&o.database?`${o.database}.${n.name}`:n.name;return`${n.engine}.load_table("${W}")`}if(o)return oj({table:n,columnName:"*",sqlTableContext:o});switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return oj({table:n,columnName:"*",sqlTableContext:o});default:return hc(n.source_type),""}})())},e[10]=v,e[11]=p,e[12]=y,e[13]=b,e[14]=o,e[15]=n,e[16]=w):w=e[16];const j=w;let C;e[17]!==n.num_columns||e[18]!==n.num_rows?(C=()=>{const W=[];return n.num_rows!=null&&W.push(`${n.num_rows} rows`),n.num_columns!=null&&W.push(`${n.num_columns} columns`),W.length===0?null:u.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:u.jsx("span",{className:"text-xs text-muted-foreground",children:W.join(", ")})})},e[17]=n.num_columns,e[18]=n.num_rows,e[19]=C):C=e[19];const N=C;let S;e[20]!==x||e[21]!==m||e[22]!==g||e[23]!==o||e[24]!==n?(S=()=>{if(g||m)return u.jsx(ZC,{message:"Loading columns...",className:"pl-12"});if(x)return u.jsx(QC,{error:x,className:"pl-12"});const W=n.columns;return W.length===0?u.jsx(Hc,{content:"No columns found",className:"pl-12"}):W.map(J=>u.jsx(Y7,{table:n,column:J,sqlTableContext:o},J.name))},e[20]=x,e[21]=m,e[22]=g,e[23]=o,e[24]=n,e[25]=S):S=e[25];const E=S;let T;e[26]!==i||e[27]!==r||e[28]!==n.source_type||e[29]!==n.type?(T=()=>{if(n.source_type==="local")return;const W=n.type==="table"?wL:fm;return u.jsx(W,{className:"h-3 w-3",strokeWidth:i||r?2.5:void 0})},e[26]=i,e[27]=r,e[28]=n.source_type,e[29]=n.type,e[30]=T):T=e[30];const I=T,D=o?`${o.database}.${o.schema}.${n.name}`:n.name,F=o&&(tj(o.schema)?"pl-9":"pl-12"),O=(i||r)&&"font-semibold";let R,P,z,_,k,B,A,U,V,X,Y,G;return e[31]!==F||e[32]!==O?(R=xe("rounded-none group h-8 cursor-pointer",F,O),e[31]=F,e[32]=O,e[33]=R):R=e[33],e[34]!==i?(P=()=>a(!i),e[34]=i,e[35]=P):P=e[35],e[36]!==I?(z=I(),e[36]=I,e[37]=z):z=e[37],e[38]!==n.name?(_=u.jsx("span",{className:"text-sm",children:n.name}),e[38]=n.name,e[39]=_):_=e[39],e[40]!==z||e[41]!==_?(k=u.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[z,_]}),e[40]=z,e[41]=_,e[42]=k):k=e[42],e[43]!==N?(B=N(),e[43]=N,e[44]=B):B=e[44],e[45]!==j?(A=zn.stopPropagation(()=>j()),e[45]=j,e[46]=A):A=e[46],e[47]===Symbol.for("react.memo_cache_sentinel")?(U=u.jsx(kL,{className:"h-3 w-3"}),e[47]=U):U=e[47],e[48]!==A?(V=u.jsx(Ee,{content:"Add table to notebook",delayDuration:400,children:u.jsx(ve,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:A,children:U})}),e[48]=A,e[49]=V):V=e[49],e[50]!==i||e[51]!==P||e[52]!==k||e[53]!==B||e[54]!==V||e[55]!==R||e[56]!==D?(X=u.jsxs(Zn,{className:R,value:D,"aria-selected":i,forceMount:!0,onSelect:P,children:[k,B,V]}),e[50]=i,e[51]=P,e[52]=k,e[53]=B,e[54]=V,e[55]=R,e[56]=D,e[57]=X):X=e[57],e[58]!==i||e[59]!==E?(Y=i&&E(),e[58]=i,e[59]=E,e[60]=Y):Y=e[60],e[61]!==X||e[62]!==Y?(G=u.jsxs(u.Fragment,{children:[X,Y]}),e[61]=X,e[62]=Y,e[63]=G):G=e[63],G},Y7=t=>{var A,U;const e=H.c(51),{table:n,column:o,sqlTableContext:r}=t,[s,i]=q.useState(!1),a=Ne(KC),l=Ct(CL);let c,d;e[0]!==a?(c=()=>{a&&i(!1)},d=[a],e[0]=a,e[1]=c,e[2]=d):(c=e[1],d=e[2]),q.useEffect(c,d),l(s?V=>new Set([...V,`${n.name}:${o.name}`]):V=>(V.delete(`${n.name}:${o.name}`),new Set(V)));const h=ej(),{columnsPreviews:f}=jL();let m;e[3]!==o.name||e[4]!==n.primary_keys?(m=((A=n.primary_keys)==null?void 0:A.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=m):m=e[5];const g=m;let x;e[6]!==o.name||e[7]!==n.indexes?(x=((U=n.indexes)==null?void 0:U.includes(o.name))||!1,e[6]=o.name,e[7]=n.indexes,e[8]=x):x=e[8];const p=x;let b;e[9]!==h?(b=V=>{h(V)},e[9]=h,e[10]=b):b=e[10];const y=b,v=K7,w=s?"font-semibold":"";let j;e[11]!==o.name||e[12]!==w?(j=u.jsx("span",{className:w,children:o.name}),e[11]=o.name,e[12]=w,e[13]=j):j=e[13];const C=j,N=`${n.name}.${o.name}`,S=`${n.name}.${o.name}`;let E;e[14]!==s?(E=()=>i(!s),e[14]=s,e[15]=E):E=e[15];const T=r?"pl-14":"pl-7";let I,D,F,O,R,P,z,_,k,B;return e[16]!==T?(I=xe("flex flex-row gap-2 items-center flex-1",T),e[16]=T,e[17]=I):I=e[17],e[18]!==o.type||e[19]!==C?(D=u.jsx(SL,{columnName:C,dataType:o.type}),e[18]=o.type,e[19]=C,e[20]=D):D=e[20],e[21]!==g?(F=g&&v({tooltipContent:"Primary key",content:"PK"}),e[21]=g,e[22]=F):F=e[22],e[23]!==p?(O=p&&v({tooltipContent:"Indexed",content:"IDX"}),e[23]=p,e[24]=O):O=e[24],e[25]!==I||e[26]!==D||e[27]!==F||e[28]!==O?(R=u.jsxs("div",{className:I,children:[D,F,O]}),e[25]=I,e[26]=D,e[27]=F,e[28]=O,e[29]=R):R=e[29],e[30]!==o.name?(P=u.jsx(Ee,{content:"Copy column name",delayDuration:400,children:u.jsx(ve,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:u.jsx(HC,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[30]=o.name,e[31]=P):P=e[31],e[32]!==o.external_type?(z=u.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),e[32]=o.external_type,e[33]=z):z=e[33],e[34]!==E||e[35]!==R||e[36]!==P||e[37]!==z||e[38]!==N||e[39]!==S?(_=u.jsxs(Zn,{className:"rounded-none py-1 group cursor-pointer",value:S,onSelect:E,children:[R,P,z]},N),e[34]=E,e[35]=R,e[36]=P,e[37]=z,e[38]=N,e[39]=S,e[40]=_):_=e[40],e[41]!==o||e[42]!==f||e[43]!==y||e[44]!==s||e[45]!==r||e[46]!==n?(k=s&&u.jsx("div",{className:"pl-10 pr-2 py-2 bg-(--slate-1) shadow-inner border-b",children:u.jsx(vc,{children:u.jsx(NL,{table:n,column:o,onAddColumnChart:y,preview:f.get(r?`${r.database}.${r.schema}.${n.name}:${o.name}`:`${n.name}:${o.name}`),sqlTableContext:r})})}),e[41]=o,e[42]=f,e[43]=y,e[44]=s,e[45]=r,e[46]=n,e[47]=k):k=e[47],e[48]!==_||e[49]!==k?(B=u.jsxs(u.Fragment,{children:[_,k]}),e[48]=_,e[49]=k,e[50]=B):B=e[50],B};function K7(t){const{tooltipContent:e,content:n}=t;return u.jsx(Ee,{content:e,delayDuration:100,children:u.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}const X7=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx($7,{}),t[0]=e):e=t[0],e},J7=()=>{const t=H.c(5),{documentation:e}=Ne(_L);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(dn,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:u.jsx(cd,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=tp({html:e}),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=u.jsx("div",{className:"p-3 overflow-y-auto overflow-x-hidden h-full docs-documentation flex flex-col gap-4",children:n}),t[3]=n,t[4]=o):o=t[4],o},Z7=()=>{const t=H.c(5),e=IL();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(dn,{title:"No errors!",icon:u.jsx(Vp,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(Q7),t[1]=e,t[2]=n):n=t[2],t[3]!==n?(o=u.jsx("div",{className:"flex flex-col overflow-auto",children:n}),t[3]=n,t[4]=o):o=t[4],o};function Q7(t){return u.jsxs("div",{children:[u.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:u.jsx(AL,{cellId:t.cellId})}),u.jsx("div",{className:"px-2",children:u.jsx(TL,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}const nm=new Map,e9=({file:t,onOpenNotebook:e})=>{const{theme:n}=vr(),{sendFileDetails:o,sendUpdateFile:r}=nt(),s=Ne(Fi),[i,a]=M.useState(""),{data:l,isPending:c,error:d,setData:h}=Tn(async()=>{const b=await o({path:t.path}),y=b.contents||"";return a(nm.get(t.path)||y),b},[t.path]),f=async()=>{i!==(l==null?void 0:l.contents)&&await r({path:t.path,contents:i}).then(b=>{b.success&&(h(y=>({...y,contents:i})),a(i))})},m=M.useRef(i);if(m.current=i,M.useEffect(()=>()=>{if(!(l!=null&&l.contents))return;const b=m.current;b===l.contents?nm.delete(t.path):nm.set(t.path,b)},[t.path,l==null?void 0:l.contents]),d)return u.jsx(kr,{error:d});if(c||!l)return null;const g=l.mimeType||"text/plain",x=g in om;if(!l.contents&&!x)return u.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[u.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),u.jsx("div",{children:l.file.name}),u.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),u.jsx("div",{children:g})]});const p=u.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!tn()&&u.jsx(Ee,{content:"Open notebook",children:u.jsx(cn,{size:"small",onClick:b=>e(b),children:u.jsx(xc,{})})}),u.jsx(Ee,{content:"Download",children:u.jsx(cn,{size:"small",onClick:()=>{if($k(g)){const b=LL(l.contents,g);return void FL(b,l.file.name)}$i(new Blob([l.contents||i],{type:g}),l.file.name)},children:u.jsx(Em,{})})}),!$k(g)&&u.jsxs(u.Fragment,{children:[u.jsx(Ee,{content:"Copy contents to clipboard",children:u.jsx(cn,{size:"small",onClick:async()=>{await sn(i)},children:u.jsx(Mi,{})})}),u.jsx(Ee,{content:Gt("global.save"),children:u.jsx(cn,{size:"small",color:i===l.contents?void 0:"green",onClick:f,disabled:i===l.contents,children:u.jsx(fa,{})})})]})]});return g.startsWith("image/")?u.jsxs(u.Fragment,{children:[p,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(ML,{base64:l.contents,mime:g})})]}):g==="text/csv"&&l.contents?u.jsxs(u.Fragment,{children:[p,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(OL,{contents:l.contents})})]}):g.startsWith("audio/")?u.jsxs(u.Fragment,{children:[p,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(DL,{base64:l.contents,mime:g})})]}):g.startsWith("video/")?u.jsxs(u.Fragment,{children:[p,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(RL,{base64:l.contents,mime:g})})]}):g.startsWith("application/pdf")?u.jsxs(u.Fragment,{children:[p,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(PL,{base64:l.contents,mime:g})})]}):u.jsxs(u.Fragment,{children:[p,u.jsx("div",{className:"flex-1 overflow-auto",children:u.jsx(M.Suspense,{children:u.jsx(ra,{theme:n==="dark"?"dark":"light",language:om[g]||om.default,className:"border-b",extensions:[We.lineWrapping,Mn.of([{key:s.getHotkey("global.save").key,stopPropagation:!0,run:()=>i!==l.contents&&(f(),!0)}])],value:i,onChange:a})})})]})},$k=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/")||t.startsWith("application/pdf"),om={"application/javascript":"javascript","text/markdown":"markdown","text/html":"html","text/css":"css","text/x-python":"python","application/json":"json","application/xml":"xml","text/x-yaml":"yaml","text/csv":"markdown","text/plain":"markdown",default:"markdown"};class t9{constructor(e){this.callbacks=e,this.delegate=new lp([]),this.rootPath="",this.onChange=Bn.NOOP,this.path=new mc("/"),this.initialize=async n=>{if(this.onChange=n,this.delegate.data.length===0)try{const o=await this.callbacks.listFiles({path:this.rootPath});this.delegate=new lp(o.files),this.rootPath=o.root,this.path=mc.guessDeliminator(o.root)}catch(o){Je({title:"Failed",description:vC(o)})}this.onChange(this.delegate.data)},this.refreshAll=async n=>{const o=[this.rootPath,...n.map(s=>{var i;return(i=this.delegate.find(s))==null?void 0:i.data.path})].filter(Boolean),r=await Promise.all(o.map(s=>this.callbacks.listFiles({path:s}).catch(()=>({files:[]}))));for(const[s,i]of o.entries()){const a=r[s];i===this.rootPath?this.delegate=new lp(a.files):this.delegate.update({id:i,changes:{children:a.files}})}this.onChange(this.delegate.data)},this.relativeFromRoot=n=>{const o=this.rootPath.endsWith(this.path.deliminator)?this.rootPath:`${this.rootPath}${this.path.deliminator}`;return n.startsWith(o)?n.slice(o.length):n},this.handleResponse=n=>n.success?n:(Je({title:"Failed",description:n.message}),null)}async expand(e){const n=this.delegate.find(e);if(!n||!n.data.isDirectory)return!1;if(n.children&&n.children.length>0)return!0;const o=await this.callbacks.listFiles({path:n.data.path});return this.delegate.update({id:e,changes:{children:o.files}}),this.onChange(this.delegate.data),!0}async rename(e,n){const o=this.delegate.find(e);if(!o)return;const r=o.data.path,s=this.path.join(this.path.dirname(r),n);await this.callbacks.renameFileOrFolder({path:r,newPath:s}).then(this.handleResponse),this.delegate.update({id:e,changes:{name:n,path:s}}),this.onChange(this.delegate.data),await this.refreshAll([s])}async move(e,n){var r;const o=n?((r=this.delegate.find(n))==null?void 0:r.data.path)??n:this.rootPath;await Promise.all(e.map(s=>{this.delegate.move({id:s,parentId:n,index:0});const i=this.delegate.find(s);if(!i)return Promise.resolve();const a=this.path.join(o,this.path.basename(i.data.path));return this.delegate.update({id:s,changes:{path:a}}),this.callbacks.renameFileOrFolder({path:i.data.path,newPath:a}).then(this.handleResponse)})),this.onChange(this.delegate.data),await this.refreshAll([o])}async createFile(e,n){var s;const o=n?((s=this.delegate.find(n))==null?void 0:s.data.path)??n:this.rootPath,r=await this.callbacks.createFileOrFolder({path:o,type:"file",name:e}).then(this.handleResponse);r!=null&&r.info&&(this.delegate.create({parentId:n,index:0,data:r.info}),this.onChange(this.delegate.data),await this.refreshAll([o]))}async createFolder(e,n){var s;const o=n?((s=this.delegate.find(n))==null?void 0:s.data.path)??n:this.rootPath,r=await this.callbacks.createFileOrFolder({path:o,type:"directory",name:e}).then(this.handleResponse);r!=null&&r.info&&(this.delegate.create({parentId:n,index:0,data:r.info}),this.onChange(this.delegate.data),await this.refreshAll([o]))}async delete(e){const n=this.delegate.find(e);n&&(await this.callbacks.deleteFileOrFolder({path:n.data.path}).then(this.handleResponse),this.delegate.drop({id:e}),this.onChange(this.delegate.data))}}const Vk=jt(t=>{const e=t(zL);return Un(e,"no requestClientAtom set"),new t9({listFiles:e.sendListFiles,createFileOrFolder:e.sendCreateFileOrFolder,deleteFileOrFolder:e.sendDeleteFileOrFolder,renameFileOrFolder:e.sendRenameFileOrFolder})}),n9=jt({});function o9(t){return new Promise((e,n)=>{const o=new FileReader;o.onload=r=>{var s;e((s=r.target)==null?void 0:s.result)},o.onerror=r=>{n(new Error(`Failed to read blob: ${r.type}`))},o.readAsDataURL(t)})}function Hk(t){const e=H.c(7);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const o=n,{sendCreateFileOrFolder:r}=nt();let s,i;return e[2]!==r?(s=async a=>{for(const l of a){const c=c9(l9(l));let d="";c&&(d=mc.guessDeliminator(c).dirname(c));const h=(await o9(l)).split(",")[1];await r({path:d,type:"file",name:l.name,contents:h})}await async function(){await Qe.get(Vk).refreshAll([])}()},e[2]=r,e[3]=s):s=e[3],e[4]!==o||e[5]!==s?(i={multiple:!0,maxSize:104857600,onError:a9,onDropRejected:r9,onDrop:s,...o},e[4]=o,e[5]=s,e[6]=i):i=e[6],BL(i)}function r9(t){Je({title:"File upload failed",description:u.jsx("div",{className:"flex flex-col gap-1",children:t.map(s9)}),variant:"danger"})}function s9(t){return u.jsxs("div",{children:[t.file.name," (",t.errors.map(i9).join(", "),")"]},t.file.name)}function i9(t){return t.message}function a9(t){ut.error(t),Je({title:"File upload failed",description:t.message,variant:"danger"})}function l9(t){return t.webkitRelativePath?t.webkitRelativePath:"path"in t&&typeof t.path=="string"?t.path:"relativePath"in t&&typeof t.relativePath=="string"?t.relativePath:void 0}function c9(t){if(t)return t.replace(/^\/+/,"")}const Wk=q.createContext(null),d9=t=>{const e=H.c(60),{height:n}=t,o=M.useRef(null),[r]=zt(Vk);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const[i,a]=M.useState(s),[l,c]=M.useState(null),{openPrompt:d}=An(),[h,f]=zt(n9);let m,g;e[1]!==r?(m=()=>r.initialize(a),e[1]=r,e[2]=m):m=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[3]=g):g=e[3];const{isPending:x,error:p}=Tn(m,g);let b;e[4]!==h||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(h).filter(k=>h[k]))},e[4]=h,e[5]=r,e[6]=b):b=e[6];const y=Fe(b);let v;e[7]!==d||e[8]!==r?(v=async()=>{d({title:"Folder name",onConfirm:async k=>{r.createFolder(k,null)}})},e[7]=d,e[8]=r,e[9]=v):v=e[9];const w=Fe(v);let j;e[10]!==d||e[11]!==r?(j=async()=>{d({title:"File name",onConfirm:async k=>{r.createFile(k,null)}})},e[10]=d,e[11]=r,e[12]=j):j=e[12];const C=Fe(j);let N;e[13]!==f?(N=()=>{var k;(k=o.current)==null||k.closeAll(),f({})},e[13]=f,e[14]=N):N=e[14];const S=Fe(N);if(x){let k;return e[15]===Symbol.for("react.memo_cache_sentinel")?(k=u.jsx(kn,{size:"medium",centered:!0}),e[15]=k):k=e[15],k}if(p){let k;return e[16]!==p?(k=u.jsx(kr,{error:p}),e[16]=p,e[17]=k):k=e[17],k}if(l){let k,B,A,U,V,X;return e[18]===Symbol.for("react.memo_cache_sentinel")?(k=()=>c(null),e[18]=k):k=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?(B=u.jsx(ve,{onClick:k,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:u.jsx(wt,{size:16})}),e[19]=B):B=e[19],e[20]!==l.name?(A=u.jsxs("div",{className:"flex items-center pl-1 pr-3 shrink-0 border-b justify-between",children:[B,u.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=A):A=e[21],e[22]!==l.path||e[23]!==r?(U=Y=>qk(Y,r.relativeFromRoot(l.path)),e[22]=l.path,e[23]=r,e[24]=U):U=e[24],e[25]!==l||e[26]!==U?(V=u.jsx(M.Suspense,{children:u.jsx(e9,{onOpenNotebook:U,file:l})}),e[25]=l,e[26]=U,e[27]=V):V=e[27],e[28]!==A||e[29]!==V?(X=u.jsxs(u.Fragment,{children:[A,V]}),e[28]=A,e[29]=V,e[30]=X):X=e[30],X}let E;e[31]!==S||e[32]!==C||e[33]!==w||e[34]!==y||e[35]!==r?(E=u.jsx(h9,{onRefresh:y,onCreateFile:C,onCreateFolder:w,onCollapseAll:S,tree:r}),e[31]=S,e[32]=C,e[33]=w,e[34]=y,e[35]=r,e[36]=E):E=e[36];const T=n-33;let I,D,F,O,R,P,z,_;return e[37]!==r?(I=async k=>{const{ids:B}=k;for(const A of B)await r.delete(A)},D=async k=>{const{id:B,name:A}=k;await r.rename(B,A)},F=async k=>{const{dragIds:B,parentId:A}=k;await r.move(B,A)},e[37]=r,e[38]=I,e[39]=D,e[40]=F):(I=e[38],D=e[39],F=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(O=k=>{const B=k[0];B&&(B.data.isDirectory||c(B.data))},e[41]=O):O=e[41],e[42]!==h||e[43]!==f||e[44]!==r?(R=async k=>{if(await r.expand(k)){const B=h[k]??!1;f({...h,[k]:!B})}},e[42]=h,e[43]=f,e[44]=r,e[45]=R):R=e[45],e[46]!==i||e[47]!==h||e[48]!==I||e[49]!==D||e[50]!==F||e[51]!==R||e[52]!==T?(P=u.jsx(NF,{width:"100%",ref:o,height:T,className:"h-full",data:i,initialOpenState:h,openByDefault:!1,renderCursor:x9,disableDrop:b9,onDelete:I,onRename:D,onMove:F,onSelect:O,onToggle:R,padding:15,rowHeight:30,indent:u9,overscanCount:1e3,disableMultiSelection:!0,children:p9}),e[46]=i,e[47]=h,e[48]=I,e[49]=D,e[50]=F,e[51]=R,e[52]=T,e[53]=P):P=e[53],e[54]!==P||e[55]!==r?(z=u.jsx(Wk,{value:r,children:P}),e[54]=P,e[55]=r,e[56]=z):z=e[56],e[57]!==z||e[58]!==E?(_=u.jsxs(u.Fragment,{children:[E,z]}),e[57]=z,e[58]=E,e[59]=_):_=e[59],_},u9=15,h9=t=>{const e=H.c(30),{onRefresh:n,onCreateFile:o,onCreateFolder:r,onCollapseAll:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={noDrag:!0,noDragEventsBubbling:!0},e[0]=i):i=e[0];const{getRootProps:a,getInputProps:l}=Hk(i);let c,d,h,f,m,g,x,p,b,y,v,w,j,C,N;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(ua,{size:16}),e[1]=c):c=e[1],e[2]!==o?(d=u.jsx(Ee,{content:"Add file",children:u.jsx(ve,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:c})}),e[2]=o,e[3]=d):d=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(td,{size:16}),e[4]=h):h=e[4],e[5]!==r?(f=u.jsx(Ee,{content:"Add folder",children:u.jsx(ve,{"data-testid":"file-explorer-add-folder-button",onClick:r,variant:"text",size:"xs",children:h})}),e[5]=r,e[6]=f):f=e[6],e[7]!==a?(m=a({}),e[7]=a,e[8]=m):m=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(g=UL({variant:"text",size:"xs"}),x=u.jsx(VL,{size:16}),e[9]=g,e[10]=x):(g=e[9],x=e[10]),e[11]!==m?(p=u.jsx(Ee,{content:"Upload file",children:u.jsx("button",{"data-testid":"file-explorer-upload-button",...m,className:g,children:x})}),e[11]=m,e[12]=p):p=e[12],e[13]!==l?(b=l({}),e[13]=l,e[14]=b):b=e[14],e[15]!==b?(y=u.jsx("input",{...b,type:"file"}),e[15]=b,e[16]=y):y=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(v=u.jsx(_C,{size:16}),e[17]=v):v=e[17],e[18]!==n?(w=u.jsx(Ee,{content:"Refresh",children:u.jsx(ve,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:v})}),e[18]=n,e[19]=w):w=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx(wp,{size:16}),e[20]=j):j=e[20],e[21]!==s?(C=u.jsx(Ee,{content:"Collapse all folders",children:u.jsx(ve,{"data-testid":"file-explorer-collapse-button",onClick:s,variant:"text",size:"xs",children:j})}),e[21]=s,e[22]=C):C=e[22],e[23]!==y||e[24]!==w||e[25]!==C||e[26]!==d||e[27]!==f||e[28]!==p?(N=u.jsxs("div",{className:"flex items-center justify-end px-2 shrink-0 border-b",children:[d,f,p,y,w,C]}),e[23]=y,e[24]=w,e[25]=C,e[26]=d,e[27]=f,e[28]=p,e[29]=N):N=e[29],N},f9=t=>{const e=H.c(9),{node:n,onOpenMarimoFile:o}=t;let r,s,i;return e[0]!==n?(r=a=>{n.data.isDirectory||(a.stopPropagation(),n.select())},e[0]=n,e[1]=r):r=e[1],e[2]!==n.data.isMarimoFile||e[3]!==o?(s=n.data.isMarimoFile&&!tn()&&u.jsxs("span",{className:"shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",u.jsx(xc,{className:"inline ml-1",size:12})]}),e[2]=n.data.isMarimoFile,e[3]=o,e[4]=s):s=e[4],e[5]!==n.data.name||e[6]!==r||e[7]!==s?(i=u.jsxs("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:r,children:[n.data.name,s]}),e[5]=n.data.name,e[6]=r,e[7]=s,e[8]=i):i=e[8],i},m9=t=>{const e=H.c(10),{node:n}=t,o=M.useRef(null);let r,s,i,a,l;return e[0]!==n.data.name?(r=()=>{var c,d;(c=o.current)==null||c.focus(),(d=o.current)==null||d.setSelectionRange(0,n.data.name.lastIndexOf("."))},s=[n.data.name],e[0]=n.data.name,e[1]=r,e[2]=s):(r=e[1],s=e[2]),M.useEffect(r,s),e[3]!==n?(i=()=>n.reset(),a=c=>{c.key==="Escape"&&n.reset(),c.key==="Enter"&&n.submit(c.currentTarget.value)},e[3]=n,e[4]=i,e[5]=a):(i=e[4],a=e[5]),e[6]!==n.data.name||e[7]!==i||e[8]!==a?(l=u.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:y9,onBlur:i,onKeyDown:a}),e[6]=n.data.name,e[7]=i,e[8]=a,e[9]=l):l=e[9],l},p9=({node:t,style:e,dragHandle:n})=>{const{openFile:o,sendCreateFileOrFolder:r,sendFileDetails:s}=nt(),i=t.data.isDirectory?"directory":H3(t.data.name),a=W3[i],{openConfirm:l,openPrompt:c}=An(),{createNewCell:d}=lt(),h=hs(),f=M.use(Wk),m=async y=>{qk(y,f?f.relativeFromRoot(t.data.path):t.data.path)},g=async y=>{y.stopPropagation(),y.preventDefault(),l({title:"Delete file",description:`Are you sure you want to delete ${t.data.name}?`,confirmAction:u.jsx(z3,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},x=Fe(async()=>{t.open(),c({title:"Folder name",onConfirm:async y=>{f==null||f.createFolder(y,t.id)}})}),p=Fe(async()=>{t.open(),c({title:"File name",onConfirm:async y=>{f==null||f.createFile(y,t.id)}})}),b=Fe(async()=>{var j;if(!f||t.data.isDirectory)return;const[y,v]=$L(t.data.name),w=`${y}_copy${v}`;try{const C=await s({path:t.data.path}),N=((j=t.parent)==null?void 0:j.data.path)||"";await r({path:N,type:"file",name:w,contents:C.contents?btoa(C.contents):void 0}),await f.refreshAll([N])}catch{Je({title:"Failed to duplicate file",description:"Unable to create a duplicate of the file",variant:"danger"})}});return u.jsxs("div",{style:e,ref:n,className:xe("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),draggable:!0,onClick:y=>{y.stopPropagation(),t.data.isDirectory&&t.toggle()},children:[u.jsx(g9,{node:t}),u.jsxs("span",{className:xe("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",t.willReceiveDrop&&t.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground"),children:[t.data.isMarimoFile?u.jsx("img",{src:WF,className:"w-5 h-5 shrink-0 mr-2 filter grayscale",alt:"Marimo"}):u.jsx(a,{className:"w-5 h-5 shrink-0 mr-2",strokeWidth:1.5}),t.isEditing?u.jsx(m9,{node:t}):u.jsx(f9,{node:t,onOpenMarimoFile:m}),u.jsxs(Eo,{modal:!1,children:[u.jsx(_o,{asChild:!0,tabIndex:-1,onClick:y=>y.stopPropagation(),children:u.jsx(ve,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:u.jsx(ed,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),(()=>{const y={size:14,strokeWidth:1.5,className:"mr-2"};return u.jsxs(Io,{align:"end",className:"no-print w-[220px]",onClick:v=>v.stopPropagation(),onCloseAutoFocus:v=>v.preventDefault(),children:[!t.data.isDirectory&&u.jsxs(At,{onSelect:()=>t.select(),children:[u.jsx(rg,{...y}),"Open file"]}),!t.data.isDirectory&&!tn()&&u.jsxs(At,{onSelect:()=>{o({path:t.data.path})},children:[u.jsx(xc,{...y}),"Open file in external editor"]}),t.data.isDirectory&&u.jsxs(u.Fragment,{children:[u.jsxs(At,{onSelect:()=>p(),children:[u.jsx(ua,{...y}),"Create file"]}),u.jsxs(At,{onSelect:()=>x(),children:[u.jsx(td,{...y}),"Create folder"]}),u.jsx(an,{})]}),u.jsxs(At,{onSelect:()=>t.edit(),children:[u.jsx(Hp,{...y}),"Rename"]}),!t.data.isDirectory&&u.jsxs(At,{onSelect:b,children:[u.jsx(Mi,{...y}),"Duplicate"]}),u.jsxs(At,{onSelect:async()=>{await sn(t.data.path),Je({title:"Copied to clipboard"})},children:[u.jsx(rd,{...y}),"Copy path"]}),f&&u.jsxs(At,{onSelect:async()=>{await sn(f.relativeFromRoot(t.data.path)),Je({title:"Copied to clipboard"})},children:[u.jsx(rd,{...y}),"Copy relative path"]}),u.jsx(an,{}),u.jsxs(At,{onSelect:()=>{const{path:v}=t.data;(w=>{d({code:w,before:!1,cellId:h??"__end__"})})(rj[i](v))},children:[u.jsx(Nr,{...y}),"Insert snippet for reading file"]}),u.jsxs(At,{onSelect:async()=>{Je({title:"Copied to clipboard",description:"Code to open the file has been copied to your clipboard. You can also drag and drop this file into the editor"});const{path:v}=t.data,w=rj[i](v);await sn(w)},children:[u.jsx(HL,{...y}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!tn()&&u.jsxs(u.Fragment,{children:[u.jsx(an,{}),u.jsxs(At,{onSelect:m,children:[u.jsx(Qp,{...y}),"Open notebook"]})]}),u.jsx(an,{}),!t.data.isDirectory&&u.jsxs(u.Fragment,{children:[u.jsxs(At,{onSelect:async()=>{const v=(await s({path:t.data.path})).contents||"";$i(new Blob([v]),t.data.name)},children:[u.jsx(Em,{...y}),"Download"]}),u.jsx(an,{})]}),u.jsxs(At,{onSelect:g,variant:"danger",children:[u.jsx(rc,{...y}),"Delete"]})]})})()]})]})]})},g9=t=>{const e=H.c(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx("span",{className:"w-5 h-5 shrink-0"}),e[0]=r):r=e[0],r}let o;return e[1]!==n.isOpen?(o=n.isOpen?u.jsx(No,{className:"w-5 h-5 shrink-0"}):u.jsx(Li,{className:"w-5 h-5 shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function qk(t,e){t.stopPropagation(),t.preventDefault(),fj(e)}function x9(){return null}function b9(t){const{parentNode:e}=t;return!e.data.isDirectory}function y9(t){return t.stopPropagation()}let Gk,Yk,Kk;Gk=()=>{const t=H.c(20),{ref:e,height:n}=WL(),o=n===void 0?1:n;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={noClick:!0,noKeyboard:!0},t[0]=r):r=t[0];const{getRootProps:s,getInputProps:i,isDragActive:a}=Hk(r);let l,c,d,h,f,m,g,x;return t[1]!==s?(l=s(),t[1]=s,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=xe("flex flex-col flex-1 overflow-hidden relative"),t[3]=c):c=t[3],t[4]!==i?(d=i(),t[4]=i,t[5]=d):d=t[5],t[6]!==d?(h=u.jsx("input",{...d}),t[6]=d,t[7]=h):h=t[7],t[8]!==a?(f=a&&u.jsx("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),t[8]=a,t[9]=f):f=t[9],t[10]!==o?(m=u.jsx(d9,{height:o}),t[10]=o,t[11]=m):m=t[11],t[12]!==e||t[13]!==m?(g=u.jsx("div",{ref:e,className:"flex flex-col flex-1 overflow-hidden",children:m}),t[12]=e,t[13]=m,t[14]=g):g=t[14],t[15]!==l||t[16]!==h||t[17]!==f||t[18]!==g?(x=u.jsxs("div",{...l,className:c,children:[h,f,g]}),t[15]=l,t[16]=h,t[17]=f,t[18]=g,t[19]=x):x=t[19],x},pp=t=>{const e=H.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=xe("text-xs font-semibold text-accent-foreground",t.className),e[0]=t.className,e[1]=o):o=e[1],e[2]!==t.dataTestId||e[3]!==t.onClick||e[4]!==o?(r=u.jsx("button",{type:"button","data-testid":n,className:o,onClick:t.onClick,children:"Clear"}),e[2]=t.dataTestId,e[3]=t.onClick,e[4]=o,e[5]=r):r=e[5],r},Yk=()=>{const t=H.c(9),e=qL(),{clearLogs:n}=lt();if(e.length===0){let i,a;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx("code",{className:"border rounded px-1",children:"stdout"}),t[0]=i):i=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(dn,{title:"No logs",description:u.jsxs("span",{children:[i," and"," ",u.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:u.jsx(um,{})}),t[1]=a):a=t[1],a}let o,r,s;return t[2]!==n?(o=u.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:u.jsx(pp,{dataTestId:"clear-logs-button",onClick:n})}),t[2]=n,t[3]=o):o=t[3],t[4]!==e?(r=u.jsx("div",{className:"overflow-auto flex-1",children:u.jsx(Kk,{logs:e,className:"min-w-[300px]"})}),t[4]=e,t[5]=r):r=t[5],t[6]!==o||t[7]!==r?(s=u.jsxs(u.Fragment,{children:[o,r]}),t[6]=o,t[7]=r,t[8]=s):s=t[8],s},Kk=t=>{const e=H.c(10),{logs:n,className:o}=t;let r,s,i,a,l;return e[0]!==o?(r=xe("flex flex-col",o),e[0]=o,e[1]=r):r=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(s={whiteSpace:"pre-wrap"},e[2]=s):s=e[2],e[3]!==n?(i=n.map(k9),e[3]=n,e[4]=i):i=e[4],e[5]!==i?(a=u.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:u.jsx("div",{className:"grid grid-cols-[30px_1fr]",style:s,children:i})}),e[5]=i,e[6]=a):a=e[6],e[7]!==r||e[8]!==a?(l=u.jsx("div",{className:r,children:a}),e[7]=r,e[8]=a,e[9]=l):l=e[9],l};function v9(t){const e=GL(t.timestamp),n=w9[t.level],o=t.level.toUpperCase();return u.jsxs(u.Fragment,{children:[u.jsxs("span",{className:"shrink-0 text-(--gray-10) dark:text-(--gray-11)",children:["[",e,"]"]}),u.jsx("span",{className:xe("shrink-0",n),children:o}),u.jsxs("span",{className:"shrink-0 text-(--gray-10)",children:["(",u.jsx(Mo,{cellId:t.cellId}),")"]}),t.message]})}const w9={stdout:"text-(--grass-9)",stderr:"text-(--red-9)"};function k9(t,e){return u.jsxs("div",{className:"contents group",children:[u.jsx("span",{className:xe("opacity-70 group-hover:bg-(--gray-3) group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),u.jsx("span",{className:xe("opacity-70 group-hover:bg-(--gray-3) group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:v9(t)})]},e)}const C9=()=>{const t=H.c(7),{items:e}=Ne(YL);let n,o;t[0]!==e?(o=qF(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s,activeOccurrences:i}=GF(r);if(e.length===0){let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(dn,{title:"No outline found",description:"Add markdown headings to your notebook to create an outline.",icon:u.jsx(ld,{})}),t[2]=l):l=t[2],l}let a;return t[3]!==s||t[4]!==i||t[5]!==e?(a=u.jsx(YF,{items:e,activeHeaderId:s,activeOccurrences:i}),t[3]=s,t[4]=i,t[5]=e,t[6]=a):a=t[6],a},Xk=jt(null),Jk=t=>{const e=H.c(9),{onClick:n,loading:o,children:r,className:s}=t;if(o){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(kn,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=c):c=e[0],c}let i,a,l;return e[1]!==s?(i=xe("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",s),e[1]=s,e[2]=i):i=e[2],e[3]!==n?(a=zn.stopPropagation(n),e[3]=n,e[4]=a):a=e[4],e[5]!==r||e[6]!==i||e[7]!==a?(l=u.jsx("button",{type:"button",className:i,onClick:a,children:r}),e[5]=r,e[6]=i,e[7]=a,e[8]=l):l=e[8],l},j9=()=>{var N,S;const t=H.c(30),[e]=xr(),n=e.package_management.manager,{getDependencyTree:o,getPackageList:r}=nt(),[s,i]=q.useState(null);let a,l;t[0]!==o||t[1]!==r?(a=async()=>{const[E,T]=await Promise.all([r(),o()]);return{list:E.packages,tree:T.tree}},t[0]=o,t[1]=r,t[2]=a):a=t[2],t[3]!==n?(l=[n],t[3]=n,t[4]=l):l=t[4];const{data:c,error:d,refetch:h,isPending:f}=Tn(a,l);if(f){let E;return t[5]===Symbol.for("react.memo_cache_sentinel")?(E=u.jsx(kn,{size:"medium",centered:!0}),t[5]=E):E=t[5],E}if(d){let E;return t[6]!==d?(E=u.jsx(kr,{error:d}),t[6]=d,t[7]=E):E=t[7],E}const m=c.tree!=null;let g;t[8]!==m||t[9]!==s?(g=function(E,T){return E==="list"?"list":T?E||"tree":"list"}(s,m),t[8]=m,t[9]=s,t[10]=g):g=t[10];const x=g,p=(N=c.tree)==null?void 0:N.name,b=(S=c==null?void 0:c.tree)==null?void 0:S.version,y=p==="<root>";let v,w,j,C;return t[11]!==n||t[12]!==h?(v=u.jsx(S9,{packageManager:n,onSuccess:h}),t[11]=n,t[12]=h,t[13]=v):v=t[13],t[14]!==y||t[15]!==m||t[16]!==p||t[17]!==b||t[18]!==x?(w=m&&u.jsxs("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[u.jsxs("div",{className:"flex gap-1",children:[u.jsx("button",{type:"button",className:xe("px-2 py-1 text-xs rounded",x==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>i("list"),children:"List"}),u.jsx("button",{type:"button",className:xe("px-2 py-1 text-xs rounded",x==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>i("tree"),children:"Tree"})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium",title:y?"sandbox":"project",children:y?"sandbox":"project"}),p&&!y&&u.jsxs("span",{className:"text-xs text-muted-foreground",children:[p,b&&` v${b}`]})]})]}),t[14]=y,t[15]=m,t[16]=p,t[17]=b,t[18]=x,t[19]=w):w=t[19],t[20]!==c.list||t[21]!==c.tree||t[22]!==d||t[23]!==h||t[24]!==x?(j=x==="list"?u.jsx(N9,{packages:c.list,onSuccess:h}):u.jsx(E9,{tree:c.tree,error:d,onSuccess:h}),t[20]=c.list,t[21]=c.tree,t[22]=d,t[23]=h,t[24]=x,t[25]=j):j=t[25],t[26]!==v||t[27]!==w||t[28]!==j?(C=u.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[v,w,j]}),t[26]=v,t[27]=w,t[28]=j,t[29]=C):C=t[29],C},S9=t=>{const e=H.c(40),{onSuccess:n,packageManager:o}=t,[r,s]=q.useState(""),{handleClick:i}=ia(),a=Ne(Xk),l=Ct(Xk);let c,d;e[0]!==a||e[1]!==l?(c=()=>{a&&(s(a),l(null))},d=[a,l],e[0]=a,e[1]=l,e[2]=c,e[3]=d):(c=e[2],d=e[3]),q.useEffect(c,d);const{loading:h,handleInstallPackages:f}=KL();let m;e[4]!==n?(m=()=>{n(),s("")},e[4]=n,e[5]=m):m=e[5];const g=m;let x;e[6]!==f||e[7]!==r||e[8]!==g?(x=()=>{f(r.split(",").map(_9),g)},e[6]=f,e[7]=r,e[8]=g,e[9]=x):x=e[9];const p=x,b=`Install packages with ${o}...`;let y,v,w,j,C,N,S,E,T,I,D,F,O,R;e[10]!==h||e[11]!==i?(y=h?u.jsx(kn,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):u.jsx(Ee,{content:"Change package manager",children:u.jsx(Ss,{onClick:()=>i("packageManagement"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=h,e[11]=i,e[12]=y):y=e[12],e[13]!==p?(v=A=>{A.key==="Enter"&&(A.preventDefault(),p())},e[13]=p,e[14]=v):v=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(w=A=>s(A.target.value),e[15]=w):w=e[15],e[16]!==r||e[17]!==b||e[18]!==y||e[19]!==v?(j=u.jsx(sj,{placeholder:b,id:B1,icon:y,rootClassName:"flex-1 border-none",value:r,onKeyDown:v,onChange:w}),e[16]=r,e[17]=b,e[18]=y,e[19]=v,e[20]=j):j=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(C=u.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=C):C=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(N=u.jsxs("div",{children:[C," A package name; this will install the latest version.",u.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),S=u.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=N,e[23]=S):(N=e[22],S=e[23]),e[24]===Symbol.for("react.memo_cache_sentinel")?(E=u.jsxs("div",{children:[S," ","A package with a specific version or version range.",u.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),T=u.jsx("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=E,e[25]=T):(E=e[24],T=e[25]),e[26]===Symbol.for("react.memo_cache_sentinel")?(I=u.jsxs("div",{children:[T," A Git repository",u.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),D=u.jsx("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=I,e[27]=D):(I=e[26],D=e[27]),e[28]===Symbol.for("react.memo_cache_sentinel")?(F=u.jsxs("div",{children:[D," A remote wheel or source distribution.",u.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),O=u.jsx("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=F,e[29]=O):(F=e[28],O=e[29]),e[30]===Symbol.for("react.memo_cache_sentinel")?(R=u.jsx(Ee,{delayDuration:300,side:"left",align:"start",content:u.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:",u.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[N,E,I,F,u.jsxs("div",{children:[O," A local wheel, source distribution, or project directory.",u.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:u.jsx(Jm,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=R):R=e[30];const P=r&&"bg-accent text-accent-foreground";let z;e[31]!==P?(z=xe("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",P,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=P,e[32]=z):z=e[32];const _=!r;let k,B;return e[33]!==p||e[34]!==z||e[35]!==_?(k=u.jsx("button",{type:"button",className:z,onClick:p,disabled:_,children:"Add"}),e[33]=p,e[34]=z,e[35]=_,e[36]=k):k=e[36],e[37]!==k||e[38]!==j?(B=u.jsxs("div",{className:"flex items-center w-full border-b",children:[j,R,k]}),e[37]=k,e[38]=j,e[39]=B):B=e[39],B},N9=t=>{const e=H.c(9),{onSuccess:n,packages:o}=t;if(o.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(dn,{title:"No packages",description:"No packages are installed in this environment.",icon:u.jsx(Ss,{})}),e[0]=a):a=e[0],a}let r,s,i;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(rp,{children:u.jsxs(js,{children:[u.jsx(Cr,{children:"Name"}),u.jsx(Cr,{children:"Version"}),u.jsx(Cr,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let a;e[5]!==n?(a=l=>u.jsxs(js,{className:"group",onClick:async()=>{await sn(`${l.name}==${l.version}`),Je({title:"Copied to clipboard"})},children:[u.jsx(jr,{children:l.name}),u.jsx(jr,{children:l.version}),u.jsxs(jr,{className:"flex justify-end",children:[u.jsx(Zk,{packageName:l.name,onSuccess:n}),u.jsx(Qk,{packageName:l.name,onSuccess:n})]})]},l.name),e[5]=n,e[6]=a):a=e[6],s=o.map(a),e[2]=n,e[3]=o,e[4]=s}else s=e[4];return e[7]!==s?(i=u.jsxs(sp,{className:"overflow-auto flex-1",children:[r,u.jsx(ip,{children:s})]}),e[7]=s,e[8]=i):i=e[8],i},Zk=({packageName:t,onSuccess:e})=>{const[n,o]=q.useState(!1),{addPackage:r}=nt();return tn()?null:u.jsx(Jk,{onClick:async()=>{try{o(!0);const s=await r({package:t,upgrade:!0});s.success?(e(),ij(t)):ij(t,s.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},Qk=({packageName:t,onSuccess:e})=>{const[n,o]=q.useState(!1),{removePackage:r}=nt();return u.jsx(Jk,{onClick:async()=>{try{o(!0);const s=await r({package:t});s.success?(e(),aj(t)):aj(t,s.error)}finally{o(!1)}},loading:n,children:"Remove"})},E9=t=>{const e=H.c(18),{tree:n,error:o,onSuccess:r}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=new Set,e[0]=s):s=e[0];const[i,a]=q.useState(s);let l,c,d;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{a(new Set)},e[1]=l):l=e[1],e[2]!==n?(c=[n],e[2]=n,e[3]=c):c=e[3],q.useEffect(l,c),o){let g;return e[4]!==o?(g=u.jsx(kr,{error:o}),e[4]=o,e[5]=g):g=e[5],g}if(!n){let g;return e[6]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx(kn,{size:"medium",centered:!0}),e[6]=g):g=e[6],g}if(n.dependencies.length===0){let g;return e[7]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx(dn,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:u.jsx(Ss,{})}),e[7]=g):g=e[7],g}e[8]===Symbol.for("react.memo_cache_sentinel")?(d=g=>{a(x=>{const p=new Set(x);return p.has(g)?p.delete(g):p.add(g),p})},e[8]=d):d=e[8];const h=d;let f,m;if(e[9]!==i||e[10]!==r||e[11]!==n.dependencies){let g;e[13]!==i||e[14]!==r?(g=(x,p)=>u.jsx("div",{className:"border-b",children:u.jsx(e3,{nodeId:`root-${p}`,node:x,level:0,isTopLevel:!0,expandedNodes:i,onToggle:h,onSuccess:r})},`${x.name}-${p}`),e[13]=i,e[14]=r,e[15]=g):g=e[15],f=n.dependencies.map(g),e[9]=i,e[10]=r,e[11]=n.dependencies,e[12]=f}else f=e[12];return e[16]!==f?(m=u.jsx("div",{className:"flex-1 overflow-auto",children:u.jsx("div",{children:f})}),e[16]=f,e[17]=m):m=e[17],m},e3=t=>{const e=H.c(57),{nodeId:n,node:o,level:r,isTopLevel:s,expandedNodes:i,onToggle:a,onSuccess:l}=t,c=s!==void 0&&s,d=o.dependencies.length>0;let h;e[0]!==i||e[1]!==n?(h=i.has(n),e[0]=i,e[1]=n,e[2]=h):h=e[2];const f=h,m=c?0:16+16*r;let g;e[3]!==d||e[4]!==n||e[5]!==a?(g=z=>{z.key!=="Enter"&&z.key!==" "||(z.preventDefault(),d&&a(n))},e[3]=d,e[4]=n,e[5]=a,e[6]=g):g=e[6];const x=g;let p;e[7]!==d||e[8]!==n||e[9]!==a?(p=z=>{z.stopPropagation(),d&&a(n)},e[7]=d,e[8]=n,e[9]=a,e[10]=p):p=e[10];const b=p,y=d&&"select-none",v=c?"px-2 py-0.5":"";let w,j;e[11]!==y||e[12]!==v?(w=xe("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-(--slate-2) focus:bg-(--slate-2) focus:outline-hidden",y,v),e[11]=y,e[12]=v,e[13]=w):w=e[13],e[14]!==m||e[15]!==c?(j=c?{}:{paddingLeft:`${m}px`},e[14]=m,e[15]=c,e[16]=j):j=e[16];const C=d?f:void 0;let N,S,E,T,I,D,F,O,R,P;return e[17]!==d||e[18]!==f?(N=d?f?u.jsx(No,{className:"w-4 h-4 mr-2 shrink-0"}):u.jsx(Li,{className:"w-4 h-4 mr-2 shrink-0"}):u.jsx("div",{className:"w-4 mr-2 shrink-0"}),e[17]=d,e[18]=f,e[19]=N):N=e[19],e[20]!==o.name?(S=u.jsx("span",{className:"font-medium truncate",children:o.name}),e[20]=o.name,e[21]=S):S=e[21],e[22]!==o.version?(E=o.version&&u.jsxs("span",{className:"text-muted-foreground text-xs",children:["v",o.version]}),e[22]=o.version,e[23]=E):E=e[23],e[24]!==S||e[25]!==E?(T=u.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[S,E]}),e[24]=S,e[25]=E,e[26]=T):T=e[26],e[27]!==o.tags?(I=o.tags.map(I9),e[27]=o.tags,e[28]=I):I=e[28],e[29]!==I?(D=u.jsx("div",{className:"flex items-center gap-1 ml-2",children:I}),e[29]=I,e[30]=D):D=e[30],e[31]!==c||e[32]!==o.name||e[33]!==l?(F=c&&u.jsxs("div",{className:"flex gap-1 invisible group-hover:visible",children:[u.jsx(Zk,{packageName:o.name,onSuccess:l}),u.jsx(Qk,{packageName:o.name,onSuccess:l})]}),e[31]=c,e[32]=o.name,e[33]=l,e[34]=F):F=e[34],e[35]!==b||e[36]!==x||e[37]!==N||e[38]!==T||e[39]!==D||e[40]!==F||e[41]!==w||e[42]!==j||e[43]!==C?(O=u.jsxs("div",{className:w,style:j,onClick:b,onKeyDown:x,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":C,children:[N,T,D,F]}),e[35]=b,e[36]=x,e[37]=N,e[38]=T,e[39]=D,e[40]=F,e[41]=w,e[42]=j,e[43]=C,e[44]=O):O=e[44],e[45]!==i||e[46]!==d||e[47]!==f||e[48]!==r||e[49]!==o.dependencies||e[50]!==n||e[51]!==l||e[52]!==a?(R=d&&f&&u.jsx("div",{role:"group",children:o.dependencies.map((z,_)=>u.jsx(e3,{nodeId:`${n}-${_}`,node:z,level:r+1,isTopLevel:!1,expandedNodes:i,onToggle:a,onSuccess:l},`${z.name}-${_}`))}),e[45]=i,e[46]=d,e[47]=f,e[48]=r,e[49]=o.dependencies,e[50]=n,e[51]=l,e[52]=a,e[53]=R):R=e[53],e[54]!==O||e[55]!==R?(P=u.jsxs("div",{children:[O,R]}),e[54]=O,e[55]=R,e[56]=P):P=e[56],P};function _9(t){return t.trim()}function I9(t,e){return t.kind==="cycle"?u.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"?u.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"?u.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}const rm=hm("marimo:scratchpadHistory:v1",[]),A9=jt(!1),T9=jt(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(rm),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(rm,r)}),M9={hide_code:!1,disabled:!1},O9=()=>{const t=H.c(71),e=Dm(),[n]=xr(),{theme:o}=vr(),r=M.useRef(null),s=hs(),{createNewCell:i,updateCellCode:a}=lt(),{sendRunScratchpad:l}=nt(),c=e.cellRuntime[Zo],d=c==null?void 0:c.output,h=c==null?void 0:c.status,f=c==null?void 0:c.consoleOutputs,m=e.cellData[Zo],g=(m==null?void 0:m.code)??"",x=Ct(T9),[p,b]=zt(A9),y=Ne(rm);let v;t[0]!==x||t[1]!==g||t[2]!==l?(v=()=>{l({code:g}),x(g)},t[0]=x,t[1]=g,t[2]=l,t[3]=v):v=t[3];const w=Fe(v);let j;t[4]!==g||t[5]!==i||t[6]!==s?(j=()=>{g.trim()&&i({code:g,before:!1,cellId:s??"__end__"})},t[4]=g,t[5]=i,t[6]=s,t[7]=j):j=t[7];const C=Fe(j);let N;t[8]!==l||t[9]!==a?(N=()=>{a({cellId:Zo,code:"",formattingChange:!1}),l({code:""});const ue=r.current;ue&&ue.dispatch({changes:{from:0,to:ue.state.doc.length,insert:""}})},t[8]=l,t[9]=a,t[10]=N):N=t[10];const S=Fe(N);let E;t[11]!==b||t[12]!==a?(E=ue=>{b(!1),a({cellId:Zo,code:ue,formattingChange:!1});const le=r.current;le&&le.dispatch({changes:{from:0,to:le.state.doc.length,insert:ue}})},t[11]=b,t[12]=a,t[13]=E):E=t[13];const T=Fe(E),[I,D]=M.useState();let F;t[14]!==g||t[15]!==f||t[16]!==w||t[17]!==I||t[18]!==d||t[19]!==o||t[20]!==n?(F=()=>u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"overflow-auto shrink-0 max-h-[40%]",children:u.jsx(Fu,{theme:o,showPlaceholder:!1,id:Zo,code:g,config:M9,status:"idle",serializedEditorState:null,runCell:w,userConfig:n,editorViewRef:r,setEditorView:ue=>{r.current=ue},hidden:!1,showHiddenCode:Bn.NOOP,languageAdapter:I,setLanguageAdapter:D})}),u.jsx("div",{className:"flex-1 overflow-auto shrink-0",children:u.jsx(Uc,{allowExpand:!1,output:d,className:"output-area",cellId:Zo,stale:!1,loading:!1})}),u.jsx("div",{className:"overflow-auto shrink-0 max-h-[35%]",children:u.jsx(up,{consoleOutputs:f,className:"overflow-auto",stale:!1,cellName:w3,onSubmitDebugger:Bn.NOOP,cellId:Zo,debuggerActive:!1})})]}),t[14]=g,t[15]=f,t[16]=w,t[17]=I,t[18]=d,t[19]=o,t[20]=n,t[21]=F):F=t[21];const O=F;let R;t[22]!==T||t[23]!==y||t[24]!==p||t[25]!==o?(R=()=>p?u.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:u.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:y.map((ue,le)=>u.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>T(ue),children:u.jsx(M.Suspense,{children:u.jsx(ra,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:ue.trim(),editable:!1,readOnly:!0})})},le))})}):null,t[22]=T,t[23]=y,t[24]=p,t[25]=o,t[26]=R):R=t[26];const P=R;let z,_,k,B,A,U,V,X,Y,G,W;t[27]===Symbol.for("react.memo_cache_sentinel")?(z=Oi.create(Zo),_=u.jsx("p",{className:"mx-2 my-2 text-muted-foreground text-sm",children:"Use this scratchpad cell to experiment with code without restrictions on variable names. Scratchpad code is ephemeral: variables defined in the scratchpad aren't saved to notebook memory, and the code is not saved in the notebook file."}),t[27]=z,t[28]=_):(z=t[27],_=t[28]),t[29]===Symbol.for("react.memo_cache_sentinel")?(k=Gt("cell.run"),t[29]=k):k=t[29],t[30]===Symbol.for("react.memo_cache_sentinel")?(B=u.jsx(Sr,{color:"var(--grass-11)",size:16}),t[30]=B):B=t[30],t[31]!==w||t[32]!==p?(A=u.jsx(Ee,{content:k,children:u.jsx(ve,{"data-testid":"scratchpad-run-button",onClick:w,disabled:p,variant:"text",size:"xs",children:B})}),t[31]=w,t[32]=p,t[33]=A):A=t[33],t[34]===Symbol.for("react.memo_cache_sentinel")?(U=u.jsx(Cp,{size:16}),t[34]=U):U=t[34],t[35]!==S||t[36]!==p?(V=u.jsx(Ee,{content:"Clear code and outputs",children:u.jsx(ve,{disabled:p,size:"xs",variant:"text",onClick:S,children:U})}),t[35]=S,t[36]=p,t[37]=V):V=t[37],t[38]===Symbol.for("react.memo_cache_sentinel")?(X=u.jsx(Nr,{size:16}),t[38]=X):X=t[38],t[39]!==C||t[40]!==p?(Y=u.jsx(Rs,{children:u.jsx(Ee,{content:"Insert code",children:u.jsx(ve,{disabled:p,size:"xs",variant:"text",onClick:C,children:X})})}),t[39]=C,t[40]=p,t[41]=Y):Y=t[41],t[42]!==h?(G=(h==="running"||h==="queued")&&u.jsx(kn,{className:"inline",size:"small"}),t[42]=h,t[43]=G):G=t[43],t[44]===Symbol.for("react.memo_cache_sentinel")?(W=u.jsx("div",{className:"flex-1"}),t[44]=W):W=t[44];const J=p&&"bg-(--sky-3) rounded-none";let $,Q;t[45]!==J?($=xe(J),t[45]=J,t[46]=$):$=t[46],t[47]!==p||t[48]!==b?(Q=()=>b(!p),t[47]=p,t[48]=b,t[49]=Q):Q=t[49];const te=y.length===0;let oe,ne,ie,se,ae,fe,re;return t[50]===Symbol.for("react.memo_cache_sentinel")?(oe=u.jsx(Ap,{size:16}),t[50]=oe):oe=t[50],t[51]!==$||t[52]!==Q||t[53]!==te?(ne=u.jsx(Ee,{content:"Toggle history",children:u.jsx(ve,{size:"xs",variant:"text",className:$,onClick:Q,disabled:te,children:oe})}),t[51]=$,t[52]=Q,t[53]=te,t[54]=ne):ne=t[54],t[55]!==A||t[56]!==V||t[57]!==Y||t[58]!==G||t[59]!==ne?(ie=u.jsxs("div",{className:"flex items-center shrink-0",children:[A,V,Y,G,W,ne]}),t[55]=A,t[56]=V,t[57]=Y,t[58]=G,t[59]=ne,t[60]=ie):ie=t[60],t[61]!==O?(se=O(),t[61]=O,t[62]=se):se=t[62],t[63]!==P?(ae=P(),t[63]=P,t[64]=ae):ae=t[64],t[65]!==se||t[66]!==ae?(fe=u.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[se,ae]}),t[65]=se,t[66]=ae,t[67]=fe):fe=t[67],t[68]!==ie||t[69]!==fe?(re=u.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:z,children:[_,ie,fe]}),t[68]=ie,t[69]=fe,t[70]=re):re=t[70],re},D9=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(O9,{}),t[0]=e):e=t[0],e},R9=()=>{const t=H.c(23),{openModal:e,closeModal:n}=An();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,isPending:s,error:i,refetch:a}=Tn(L9,o);if(s){let b;return t[1]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(kn,{size:"medium",centered:!0}),t[1]=b):b=t[1],b}if(i){let b;return t[2]!==i?(b=u.jsx(kr,{error:i}),t[2]=i,t[3]=b):b=t[3],b}let l;t[4]!==r?(l=r.filter(F9).map(z9),t[4]=r,t[5]=l):l=t[5];const c=l;if(r.length===0){let b;return t[6]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(dn,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:u.jsx(nd,{})}),t[6]=b):b=t[6],b}let d,h,f,m,g,x,p;return t[7]!==n||t[8]!==e||t[9]!==c||t[10]!==a?(d=()=>e(u.jsx(Mg,{providerNames:c,onSuccess:()=>{a(),n()},onClose:n})),t[7]=n,t[8]=e,t[9]=c,t[10]=a,t[11]=d):d=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(Jo,{className:"h-4 w-4"}),t[12]=h):h=t[12],t[13]!==d?(f=u.jsx("div",{className:"flex justify-end h-8 border-b",children:u.jsx("button",{type:"button",className:"float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:d,children:h})}),t[13]=d,t[14]=f):f=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(rp,{children:u.jsxs(js,{children:[u.jsx(Cr,{children:"Environment Variable"}),u.jsx(Cr,{children:"Source"}),u.jsx(Cr,{})]})}),t[15]=m):m=t[15],t[16]!==r?(g=r.map(B9),t[16]=r,t[17]=g):g=t[17],t[18]!==g?(x=u.jsxs(sp,{className:"overflow-auto flex-1 mb-16",children:[m,u.jsx(ip,{children:g})]}),t[18]=g,t[19]=x):x=t[19],t[20]!==f||t[21]!==x?(p=u.jsxs("div",{className:"flex flex-col h-full",children:[f,x]}),t[20]=f,t[21]=x,t[22]=p):p=t[22],p},P9=t=>{const e=H.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,i]=q.useState(!1);let a;e[0]!==r?(a=()=>{r(),i(!0),setTimeout(()=>i(!1),1e3)},e[0]=r,e[1]=a):a=e[1];const l=a;let c,d;return e[2]!==s?(c=s?u.jsx(gc,{className:"w-3 h-3 text-green-700 rounded"}):u.jsx(Mi,{className:"w-3 h-3 hover:bg-muted rounded"}),e[2]=s,e[3]=c):c=e[3],e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==c?(d=u.jsx("button",{type:"button",className:n,onClick:l,"aria-label":o,children:c}),e[4]=o,e[5]=n,e[6]=l,e[7]=c,e[8]=d):d=e[8],d};async function L9(){return Tg((await yj.request({})).secrets)}function F9(t){return t.provider!=="env"}function z9(t){return t.name}function B9(t){return t.keys.map(e=>u.jsxs(js,{className:"group",children:[u.jsx(jr,{children:e}),u.jsx(jr,{children:t.provider!=="env"&&u.jsx(qC,{variant:"outline",className:"select-none",children:t.name})}),u.jsx(jr,{children:u.jsx(P9,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await sn(`os.environ["${e}"]`),Je({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:xe("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const U9=t=>{const e=H.c(6),{children:n}=t,{openModal:o,closeModal:r}=An();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(u.jsx(V9,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=u.jsx(FC,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},$9=[We.lineWrapping],V9=t=>{const e=H.c(23),{onClose:n}=t,[o,r]=M.useState(""),{theme:s}=vr();let i,a,l,c,d,h;e[0]!==n?(i=async v=>{v.preventDefault();const w=new FormData(v.target),j=w.get("title"),C=w.get("description"),N=w.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:j,description:C,code:N})}),n(),Je({title:"Snippet Submitted",description:"Thank you for contributing! We will review your snippet shortly."})},e[0]=n,e[1]=i):i=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(Wo,{children:"Contribute a Snippet"}),e[2]=a):a=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsxs(ls,{children:[a,u.jsxs(cs,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",u.jsx("a",{href:Fn.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(qo,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),d=u.jsx(XL,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),e[4]=c,e[5]=d):(c=e[4],d=e[5]),e[6]!==o?(h=u.jsx("input",{type:"hidden",name:"code",value:o}),e[6]=o,e[7]=h):h=e[7];const f=s==="dark"?"dark":"light";let m,g,x,p,b,y;return e[8]!==o||e[9]!==f?(m=u.jsx(ra,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:$9,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(g=u.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[c,d,h,m]}),e[11]=h,e[12]=m,e[13]=g):g=e[13],e[14]!==n?(x=u.jsx(ve,{"data-testid":"snippet-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=x):x=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(ve,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=p):p=e[16],e[17]!==x?(b=u.jsxs(Ti,{children:[x,p]}),e[17]=x,e[18]=b):b=e[18],e[19]!==i||e[20]!==b||e[21]!==g?(y=u.jsx(Go,{className:"w-fit",children:u.jsxs("form",{onSubmit:i,children:[l,g,b]})}),e[19]=i,e[20]=b,e[21]=g,e[22]=y):y=e[22],y},H9=[We.lineWrapping],W9=()=>{const t=H.c(22),{readSnippets:e}=nt(),[n,o]=q.useState();let r,s;t[0]!==e?(r=()=>e(),t[0]=e,t[1]=r):r=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(s=[],t[2]=s):s=t[2];const{data:i,error:a,isPending:l}=Tn(r,s);if(a){let v;return t[3]!==a?(v=u.jsx(kr,{error:a}),t[3]=a,t[4]=v):v=t[4],v}if(l||!i){let v;return t[5]===Symbol.for("react.memo_cache_sentinel")?(v=u.jsx(kn,{size:"medium",centered:!0}),t[5]=v):v=t[5],v}const c=n?"h-1/3":"h-full";let d,h,f,m,g,x,p,b,y;return t[6]!==c?(d=xe("border-b rounded-none",c),t[6]=c,t[7]=d):d=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(zi,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[8]=h):h=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsxs("div",{className:"flex items-center w-full",children:[h,u.jsx(U9,{children:u.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:u.jsx(Jo,{className:"h-4 w-4"})})})]}),m=u.jsx(ac,{children:"No results"}),t[9]=f,t[10]=m):(f=t[9],m=t[10]),t[11]===Symbol.for("react.memo_cache_sentinel")?(g=v=>o(v),t[11]=g):g=t[11],t[12]!==i.snippets?(x=u.jsx(G9,{onSelect:g,snippets:i.snippets}),t[12]=i.snippets,t[13]=x):x=t[13],t[14]!==d||t[15]!==x?(p=u.jsxs(yc,{className:d,children:[f,m,x]}),t[14]=d,t[15]=x,t[16]=p):p=t[16],t[17]!==n?(b=u.jsx(M.Suspense,{children:u.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:n?u.jsx(q9,{snippet:n,onClose:()=>o(void 0)},n.title):u.jsx(dn,{title:"",description:"Click on a snippet to view its content."})})}),t[17]=n,t[18]=b):b=t[18],t[19]!==b||t[20]!==p?(y=u.jsxs("div",{className:"flex-1 overflow-hidden",children:[p,b]}),t[19]=b,t[20]=p,t[21]=y):y=t[21],y},q9=t=>{const e=H.c(33),{snippet:n,onClose:o}=t,{theme:r}=vr(),{createNewCell:s}=lt(),i=hs();let a;e[0]!==s||e[1]!==i||e[2]!==n.sections?(a=()=>{for(const w of[...n.sections].reverse())w.code&&s({code:w.code,before:!1,cellId:i??"__end__",skipIfCodeExists:!0})},e[0]=s,e[1]=i,e[2]=n.sections,e[3]=a):a=e[3];const l=a;let c;e[4]!==s||e[5]!==i?(c=w=>{s({code:w,before:!1,cellId:i??"__end__"})},e[4]=s,e[5]=i,e[6]=c):c=e[6];const d=c;let h,f,m,g,x,p,b,y,v;if(e[7]!==n.title?(h=u.jsx("span",{children:n.title}),e[7]=n.title,e[8]=h):h=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(wn,{className:"h-4 w-4"}),e[9]=f):f=e[9],e[10]!==o?(m=u.jsx(ve,{size:"sm",variant:"ghost",onClick:o,className:"h-6 w-6 p-0 hover:bg-muted-foreground/10",children:f}),e[10]=o,e[11]=m):m=e[11],e[12]!==h||e[13]!==m?(g=u.jsxs("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1 flex justify-between items-center",children:[h,m]}),e[12]=h,e[13]=m,e[14]=g):g=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx(Nr,{className:"ml-2 h-4 w-4"}),e[15]=x):x=e[15],e[16]!==l?(p=u.jsx("div",{className:"flex justify-end",children:u.jsx(Rs,{children:u.jsxs(ve,{className:"float-right",size:"xs",variant:"outline",onClick:l,children:["Insert snippet",x]})})}),e[16]=l,e[17]=p):p=e[17],e[18]!==d||e[19]!==n.sections||e[20]!==n.title||e[21]!==r){let w;e[23]!==d||e[24]!==n.title||e[25]!==r?(w=j=>{const{code:C,html:N,id:S}=j;return N?u.jsx("div",{children:tp({html:N})},`${n.title}-${S}`):C?u.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[u.jsx(Rs,{children:u.jsx(Ee,{content:"Insert snippet",children:u.jsx(ve,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{d(C)},children:u.jsx(Nr,{className:"h-5 w-5"})})})}),u.jsx(M.Suspense,{children:u.jsx(ra,{theme:r==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:H9,value:C,readOnly:!0},`${n.title}-${S}`)})]},`${n.title}-${S}`):null},e[23]=d,e[24]=n.title,e[25]=r,e[26]=w):w=e[26],b=n.sections.map(w),e[18]=d,e[19]=n.sections,e[20]=n.title,e[21]=r,e[22]=b}else b=e[22];return e[27]!==p||e[28]!==b?(y=u.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[p,b]}),e[27]=p,e[28]=b,e[29]=y):y=e[29],e[30]!==y||e[31]!==g?(v=u.jsxs(u.Fragment,{children:[g,y]}),e[30]=y,e[31]=g,e[32]=v):v=e[32],v},G9=t=>{const e=H.c(7),{snippets:n,onSelect:o}=t;let r,s;if(e[0]!==o||e[1]!==n){let i;e[3]!==o?(i=a=>u.jsx(Zn,{className:"rounded-none",onSelect:()=>o(a),children:u.jsx("div",{className:"flex flex-row gap-2 items-center",children:u.jsx("span",{className:"mt-1 text-accent-foreground",children:a.title})})},a.title),e[3]=o,e[4]=i):i=e[4],r=n.map(i),e[0]=o,e[1]=n,e[2]=r}else r=e[2];return e[5]!==r?(s=u.jsx(Hm,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s},Y9=q.lazy(()=>qm(()=>import("./tracing-CRxB69vv.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125]),import.meta.url).then(t=>({default:t.Tracing}))),K9=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(q.Suspense,{fallback:u.jsx(X9,{}),children:u.jsx(Y9,{})}),t[0]=e):e=t[0],e},X9=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:u.jsx(kn,{})}),t[0]=e):e=t[0],e},t3="name",n3="type-value",sm="defs-refs",J9=[{id:t3,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>u.jsx(ap,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return u.jsx(xf,{name:e,declaredBy:n})}},{id:n3,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>u.jsx(ap,{header:u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx("span",{children:"Type"}),u.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return u.jsxs("div",{className:"max-w-[150px]",children:[u.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),u.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:sm,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>u.jsx(ap,{header:u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx("span",{children:"Declared By"}),u.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=s=>{const i=Ri(s);i&&np(i,o)};return u.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[u.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[u.jsx("span",{title:"Declared by",children:u.jsx(Jp,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?u.jsx(Mo,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):u.jsx("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((s,i)=>u.jsxs("span",{className:"flex",children:[u.jsx(Mo,{variant:"focus",cellId:s,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(s)},s),i<e.length-1&&", "]},s))})]}),u.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[u.jsx("span",{title:"Used by",children:u.jsx(ma,{className:"w-3.5 h-3.5 text-muted-foreground"})}),u.jsx(Sw,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],o3=M.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=q.useState([]),[s,i]=q.useState(""),a=JL(),l=M.useMemo(()=>{const h=f=>{const m=a[f];return nF(m)?`cell-${e.indexOf(f)}`:m??`cell-${e.indexOf(f)}`};return Object.values(n).map(f=>({...f,declaredByNames:f.declaredBy.map(h),usedByNames:f.usedBy.map(h)}))},[n,a,e]),c=M.useMemo(()=>{const h=new Map;return e.forEach((f,m)=>h.set(f,m)),function({variables:f,sort:m,cellIdToIndex:g}){m||(m={id:sm,desc:!1});let x=[];switch(m.id){case t3:x=la(f,p=>p.name);break;case n3:x=la(f,p=>p.dataType);break;case sm:x=la(f,p=>g.get(p.declaredBy[0]))}return m.desc?x.reverse():x}({variables:l,sort:o[0],cellIdToIndex:h})},[l,o,e]),d=ZL({data:c,columns:J9,getCoreRowModel:tF(),onGlobalFilterChange:i,getFilteredRowModel:eF(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:h=>h.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:QL(),state:{sorting:o,globalFilter:s}});return u.jsxs(u.Fragment,{children:[u.jsx(sj,{className:"w-full",placeholder:"Search",value:s,onChange:h=>i(h.target.value)}),u.jsxs(sp,{className:xe("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[u.jsx(rp,{children:u.jsx(js,{className:"whitespace-nowrap text-xs",children:d.getFlatHeaders().map(h=>u.jsx(Cr,{className:"sticky top-0 bg-background border-b",children:lj(h.column.columnDef.header,h.getContext())},h.id))})}),u.jsx(ip,{children:d.getRowModel().rows.map(h=>u.jsx(js,{className:"hover:bg-accent",children:h.getVisibleCells().map(f=>u.jsx(jr,{className:"border-b",children:lj(f.column.columnDef.cell,f.getContext())},f.id))},h.id))})]})]})});o3.displayName="VariableTable";const Z9=()=>{const t=H.c(4),e=op(),n=wr();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(dn,{title:"No variables",description:"Global variables will appear here.",icon:u.jsx(Kl,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=u.jsx(o3,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o},Q9=t=>{const e=H.c(54),n=Ne(oF),o=Ne(O6),r=lt(),s=CC(),i=t.cellId,a=o[t.cellId],l=Zi(t.cellId),c=l.code,d=Qi(t.cellId);let h,f,m,g,x,p,b,y,v,w,j,C,N,S;if(e[0]!==r||e[1]!==s||e[2]!==n.focusedCellId||e[3]!==o||e[4]!==t.cellId||e[5]!==a||e[6]!==l.code||e[7]!==d.errored){if(h={id:i,graph:a,code:c,hasError:d.errored},n.focusedCellId&&o[n.focusedCellId]){const z=o[n.focusedCellId];let _;e[20]!==n.focusedCellId||e[21]!==z?(_={id:n.focusedCellId,graph:z},e[20]=n.focusedCellId,e[21]=z,e[22]=_):_=e[22],g=_}m=(g==null?void 0:g.id)===h.id,f=s3(h.graph)?1.5:3;const O=()=>{m?s.blurCell():(r.focusCell({cellId:h.id,where:"exact"}),s.focusCell({cellId:h.id}))};C=h.id;const R=m?"text-primary-foreground":"text-(--gray-8) hover:text-(--gray-9)";e[23]!==R?(x=xe("group bg-transparent text-left w-full flex relative justify-between items-center","border-none rounded cursor-pointer","h-[21px] pl-[51px] font-inherit",R),e[23]=R,e[24]=x):x=e[24],p=O,b=iO;const P=m&&"bg-primary group-hover:bg-primary";e[25]!==P?(j=xe("group-hover:bg-(--gray-2) flex h-full w-full px-0.5 items-center rounded",P),e[25]=P,e[26]=j):j=e[26],y="truncate px-1 font-mono text-sm flex gap-1",v=h.code,w=h.graph.variables.length>0?u.jsx(oO,{cell:h,selectedCell:g}):u.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap max-w-full",children:nO(h.code)??u.jsx("span",{className:"italic",children:"empty"})}),e[0]=r,e[1]=s,e[2]=n.focusedCellId,e[3]=o,e[4]=t.cellId,e[5]=a,e[6]=l.code,e[7]=d.errored,e[8]=h,e[9]=f,e[10]=m,e[11]=g,e[12]=x,e[13]=p,e[14]=b,e[15]=y,e[16]=v,e[17]=w,e[18]=j,e[19]=C}else h=e[8],f=e[9],m=e[10],g=e[11],x=e[12],p=e[13],b=e[14],y=e[15],v=e[16],w=e[17],j=e[18],C=e[19];e[27]!==y||e[28]!==v||e[29]!==w?(N=u.jsx("div",{className:y,title:v,children:w}),e[27]=y,e[28]=v,e[29]=w,e[30]=N):N=e[30],e[31]!==N||e[32]!==j?(S=u.jsx("div",{className:j,children:N}),e[31]=N,e[32]=j,e[33]=S):S=e[33];const E=m?"z-30":"z-20";let T,I,D,F;return e[34]!==h||e[35]!==g||e[36]!==E?(T=xe("absolute overflow-visible top-[10.5px] left-[calc(var(--spacing-extra-small,8px)+17px)] pointer-events-none",E,function({cell:O,selectedCell:R}){return O.hasError?"text-destructive":!R&&!s3(O.graph)?"text-foreground":(R==null?void 0:R.id)===O.id||R!=null&&R.graph.parents.has(O.id)||R!=null&&R.graph.children.has(O.id)?"text-primary":"text-(--gray-8)"}({cell:h,selectedCell:g})),e[34]=h,e[35]=g,e[36]=E,e[37]=T):T=e[37],e[38]!==h||e[39]!==f||e[40]!==m||e[41]!==t.cellPositions||e[42]!==g?(I=m?u.jsx(rO,{cell:h,cellPositions:t.cellPositions,circleRadius:f}):u.jsx(sO,{cell:h,selectedCell:g,circleRadius:f}),e[38]=h,e[39]=f,e[40]=m,e[41]=t.cellPositions,e[42]=g,e[43]=I):I=e[43],e[44]!==T||e[45]!==I?(D=u.jsx("svg",{className:T,width:"1",height:"1",children:I}),e[44]=T,e[45]=I,e[46]=D):D=e[46],e[47]!==x||e[48]!==p||e[49]!==b||e[50]!==S||e[51]!==D||e[52]!==C?(F=u.jsxs("button",{"data-node-id":C,className:x,onClick:p,onMouseDown:b,children:[S,D]}),e[47]=x,e[48]=p,e[49]=b,e[50]=S,e[51]=D,e[52]=C,e[53]=F):F=e[53],F},eO=t=>{const e=H.c(28),{open:n,setOpen:o}=t,r=wr();let s;e[0]!==r.inOrderIds?(s=Object.fromEntries(r.inOrderIds.map(aO)),e[0]=r.inOrderIds,e[1]=s):s=e[1];const i=s;let a;if(e[2]!==r){a=[];let v=0;for(const[w,j]of r.getColumns().entries())w>0&&a.push(v),v+=j.inOrderIds.length;e[2]=r,e[3]=a}else a=e[3];const l=n?"translate-x-0":"translate-x-[calc(100%+20px)]";let c,d,h,f,m,g,x,p,b,y;if(e[4]!==l?(c=xe("fixed top-14 right-5 z-50 bg-background/95 backdrop-blur-sm supports-backdrop-filter:bg-background/60 rounded-lg border shadow-lg w-64 flex flex-col max-h-[58vh]","motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-in-out",l),e[4]=l,e[5]=c):c=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx("span",{className:"text-sm font-semibold",children:"Minimap"}),e[6]=d):d=e[6],e[7]!==o?(h=()=>o(!1),e[7]=o,e[8]=h):h=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(wn,{className:"h-4 w-4"}),e[9]=f):f=e[9],e[10]!==h?(m=u.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[d,u.jsx(ve,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:h,children:f})]}),e[10]=h,e[11]=m):m=e[11],e[12]!==r.inOrderIds||e[13]!==i||e[14]!==a){let v;e[16]!==i||e[17]!==a?(v=(w,j)=>{const C=a.includes(j);return u.jsxs(M.Fragment,{children:[C&&u.jsx("div",{className:"absolute left-5 w-[36px] h-px bg-(--gray-4) pointer-events-none","aria-hidden":"true"}),u.jsx(Q9,{cellId:w,cellPositions:i})]},w)},e[16]=i,e[17]=a,e[18]=v):v=e[18],g=r.inOrderIds.map(v),e[12]=r.inOrderIds,e[13]=i,e[14]=a,e[15]=g}else g=e[15];return e[19]!==g?(x=u.jsx("div",{className:"py-3 pl-3 pr-4 relative min-h-full",children:g}),e[19]=g,e[20]=x):x=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx("div",{className:"h-0 overflow-hidden","aria-hidden":"true"}),e[21]=p):p=e[21],e[22]!==x?(b=u.jsxs("div",{className:"overflow-y-auto overflow-x-hidden flex-1 scrollbar-none",children:[x,p]}),e[22]=x,e[23]=b):b=e[23],e[24]!==b||e[25]!==c||e[26]!==m?(y=u.jsxs("div",{className:c,children:[m,b]}),e[24]=b,e[25]=c,e[26]=m,e[27]=y):y=e[27],y},tO=()=>{const t=H.c(5),[e,n]=zt(Hb);let o,r;return t[0]!==n?(o=()=>n(lO),t[0]=n,t[1]=o):o=t[1],Dt("global.toggleMinimap",o),t[2]!==e||t[3]!==n?(r=u.jsx(eO,{open:e,setOpen:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r};function nO(t){return t.split(`
|
|
163
|
+
`)[0].trim()||void 0}const oO=t=>{const e=H.c(11),{cell:n,selectedCell:o}=t,r=op(),s=n.id===(o==null?void 0:o.id);let i,a;if(e[0]!==n.graph.variables||e[1]!==s||e[2]!==o||e[3]!==r){let l;e[5]!==s||e[6]!==o||e[7]!==r?(l=(c,d)=>{const h=r[c];return u.jsxs(M.Fragment,{children:[d>0&&", ",u.jsx("span",{className:xe({"font-bold":s,"text-foreground":o===void 0,"text-primary font-medium":!s&&D6(h,o)}),children:c})]},c)},e[5]=s,e[6]=o,e[7]=r,e[8]=l):l=e[8],i=n.graph.variables.map(l),e[0]=n.graph.variables,e[1]=s,e[2]=o,e[3]=r,e[4]=i}else i=e[4];return e[9]!==i?(a=u.jsx(u.Fragment,{children:i}),e[9]=i,e[10]=a):a=e[10],a},rO=t=>{const e=H.c(12),{cell:n,cellPositions:o,circleRadius:r}=t;let s,i,a,l;if(e[0]!==n.graph.children||e[1]!==n.graph.parents||e[2]!==n.id||e[3]!==o){s=[];const c=o[n.id]??0,d=new Set;for(const h of n.graph.parents)n.graph.children.has(h)&&d.add(h);for(const h of d){const f=o[h];if(f!==void 0){const m=21*(f-c);s.push(u.jsx("path",{d:`M -3 0 H -7 v ${m} h 14 v ${-m} H 3`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n.id}-cycle-${h}`))}}for(const h of n.graph.parents){if(d.has(h))continue;const f=o[h];if(f!==void 0){const m=21*(f-c);s.push(u.jsx("path",{d:`M -3 0 H -7 v ${m} h -4`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n.id}-up-${h}`))}}for(const h of n.graph.children){if(d.has(h))continue;const f=o[h];if(f!==void 0){const m=21*(f-c);s.push(u.jsx("path",{d:`M 3 0 H 7 v ${m} h 4`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n.id}-down-${h}`))}}e[0]=n.graph.children,e[1]=n.graph.parents,e[2]=n.id,e[3]=o,e[4]=s}else s=e[4];return e[5]!==r?(i=u.jsx("circle",{r,fill:"currentColor",className:"pointer-events-auto"}),e[5]=r,e[6]=i):i=e[6],e[7]!==s?(a=u.jsx("g",{className:"pen pointer-events-auto",children:s}),e[7]=s,e[8]=a):a=e[8],e[9]!==i||e[10]!==a?(l=u.jsxs("g",{transform:"translate(0, 0)",children:[i,a]}),e[9]=i,e[10]=a,e[11]=l):l=e[11],l};function sO(t){const{cell:e,selectedCell:n,circleRadius:o}=t,r=e.graph.ancestors.size>0,s=e.graph.descendants.size>0;if(!n)return r3({circleRadius:o,leftWisker:r,rightWisker:s});const i=n.graph.ancestors.has(e.id),a=n.graph.descendants.has(e.id);return r3(i||a?{circleRadius:o,leftWisker:r,rightWisker:s,shift:i&&a?void 0:i?"left":"right"}:{circleRadius:o,leftWisker:!1,rightWisker:!1})}function r3(t){const{circleRadius:e,leftWisker:n,rightWisker:o,shift:r}=t,s=r===void 0?0:r==="left"?-14:14;return u.jsxs("g",{transform:`translate(${s}, 0)`,children:[u.jsxs("g",{children:[n&&u.jsx("path",{d:"M 0 0 h -8",fill:"none",strokeWidth:"2",stroke:"currentColor"}),o&&u.jsx("path",{d:"M 0 0 h 8",fill:"none",strokeWidth:"2",stroke:"currentColor"})]}),u.jsx("circle",{r:e,fill:"currentColor",className:"pointer-events-auto"})]})}function s3(t){return t.variables.length===0&&t.ancestors.size===0&&t.descendants.size===0}function iO(t){return t.preventDefault()}function aO(t,e){return[t,e]}function lO(t){return!t}const cO=q.lazy(()=>qm(()=>import("./terminal-2p_4lGQJ.js"),__vite__mapDeps([126,1,2,127]),import.meta.url)),dO=t=>{const e=H.c(122),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=pc(),{setIsSidebarOpen:i,setIsTerminalOpen:a}=Ui(),l=q.useRef(null),c=q.useRef(null);let d,h,f,m,g;e[0]!==o?(d=()=>{if(!l.current)return;const Re=l.current.isCollapsed();o&&Re&&l.current.expand(),o||Re||l.current.collapse(),requestAnimationFrame(hO)},h=[o],e[0]=o,e[1]=d,e[2]=h):(d=e[1],h=e[2]),M.useEffect(d,h),e[3]!==r?(f=()=>{if(!c.current)return;const Re=c.current.isCollapsed();r&&Re&&c.current.expand(),r||Re||c.current.collapse(),requestAnimationFrame(mO)},m=[r],e[3]=r,e[4]=f,e[5]=m):(f=e[4],m=e[5]),M.useEffect(f,m),e[6]!==n?(g=u.jsx(Wc,{id:"app",className:"relative h-full",children:u.jsx(M.Suspense,{children:n})},"app"),e[6]=n,e[7]=g):g=e[7];const x=g,p=o?"resize-handle":"resize-handle-collapsed";let b,y;e[8]!==p?(b=xe("border-border no-print z-10",p,"vertical"),e[8]=p,e[9]=b):b=e[9],e[10]!==b?(y=u.jsx(cj,{onDragging:dj,className:b}),e[10]=b,e[11]=y):y=e[11];const v=y,w=r?"resize-handle":"resize-handle-collapsed";let j,C;e[12]!==w?(j=xe("border-border no-print z-20",w,"horizontal"),e[12]=w,e[13]=j):j=e[13],e[14]!==j?(C=u.jsx(cj,{onDragging:dj,className:j}),e[14]=j,e[15]=C):C=e[15];const N=C;let S,E,T,I,D,F,O,R,P,z,_,k,B,A,U,V,X,Y,G,W,J;e[16]!==s?(S=u.jsx("div",{className:"text-sm text-(--slate-11) uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=S):S=e[17],e[18]!==i?(E=()=>i(!1),e[18]=i,e[19]=E):E=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(T=u.jsx(wn,{className:"w-4 h-4"}),e[20]=T):T=e[20],e[21]!==E?(I=u.jsx(ve,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:E,children:T}),e[21]=E,e[22]=I):I=e[22],e[23]!==S||e[24]!==I?(D=u.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[S,I]}),e[23]=S,e[24]=I,e[25]=D):D=e[25],e[26]!==s?(F=s==="files"&&u.jsx(Gk,{}),e[26]=s,e[27]=F):F=e[27],e[28]!==s?(O=s==="errors"&&u.jsx(Z7,{}),e[28]=s,e[29]=O):O=e[29],e[30]!==s?(R=s==="variables"&&u.jsx(Z9,{}),e[30]=s,e[31]=R):R=e[31],e[32]!==s?(P=s==="dependencies"&&u.jsx(L7,{}),e[32]=s,e[33]=P):P=e[33],e[34]!==s?(z=s==="packages"&&u.jsx(j9,{}),e[34]=s,e[35]=z):z=e[35],e[36]!==s?(_=s==="outline"&&u.jsx(C9,{}),e[36]=s,e[37]=_):_=e[37],e[38]!==s?(k=s==="datasources"&&u.jsx(X7,{}),e[38]=s,e[39]=k):k=e[39],e[40]!==s?(B=s==="documentation"&&u.jsx(J7,{}),e[40]=s,e[41]=B):B=e[41],e[42]!==s?(A=s==="snippets"&&u.jsx(W9,{}),e[42]=s,e[43]=A):A=e[43],e[44]!==s?(U=s==="scratchpad"&&u.jsx(D9,{}),e[44]=s,e[45]=U):U=e[45],e[46]!==s?(V=s==="chat"&&u.jsx(iT,{}),e[46]=s,e[47]=V):V=e[47],e[48]!==s?(X=s==="logs"&&u.jsx(Yk,{}),e[48]=s,e[49]=X):X=e[49],e[50]!==s?(Y=s==="tracing"&&u.jsx(K9,{}),e[50]=s,e[51]=Y):Y=e[51],e[52]!==s?(G=s==="secrets"&&u.jsx(R9,{}),e[52]=s,e[53]=G):G=e[53],e[54]!==F||e[55]!==O||e[56]!==R||e[57]!==P||e[58]!==z||e[59]!==_||e[60]!==k||e[61]!==B||e[62]!==A||e[63]!==U||e[64]!==V||e[65]!==X||e[66]!==Y||e[67]!==G?(W=u.jsx(M.Suspense,{children:u.jsxs($c,{children:[F,O,R,P,z,_,k,B,A,U,V,X,Y,G]})}),e[54]=F,e[55]=O,e[56]=R,e[57]=P,e[58]=z,e[59]=_,e[60]=k,e[61]=B,e[62]=A,e[63]=U,e[64]=V,e[65]=X,e[66]=Y,e[67]=G,e[68]=W):W=e[68],e[69]!==D||e[70]!==W?(J=u.jsx(vc,{children:u.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[D,W]})}),e[69]=D,e[70]=W,e[71]=J):J=e[71];const $=J,Q=o&&"border-r border-l border-(--slate-7)";let te,oe,ne,ie,se,ae;e[72]!==Q?(te=xe("dark:bg-(--slate-1) no-print print:hidden hide-on-fullscreen",Q),e[72]=Q,e[73]=te):te=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(oe=(Re,Pe)=>{var He;Pe===0&&Re===10&&((He=l.current)==null||He.resize(30))},e[74]=oe):oe=e[74],e[75]!==i?(ne=()=>i(!1),ie=()=>i(!0),e[75]=i,e[76]=ne,e[77]=ie):(ne=e[76],ie=e[77]),e[78]!==$||e[79]!==v?(se=u.jsxs("span",{className:"flex flex-row h-full",children:[$," ",v]}),e[78]=$,e[79]=v,e[80]=se):se=e[80],e[81]!==te||e[82]!==ne||e[83]!==ie||e[84]!==se?(ae=u.jsx(Wc,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:te,minSize:10,defaultSize:0,maxSize:75,onResize:oe,onCollapse:ne,onExpand:ie,children:se},"helper"),e[81]=te,e[82]=ne,e[83]=ie,e[84]=se,e[85]=ae):ae=e[85];const fe=ae,re=r&&"border-(--slate-7)";let ue,le,je,Se,Le,Ie,ke,Ye,Ve;e[86]!==re?(ue=xe("dark:bg-(--slate-1) no-print print:hidden hide-on-fullscreen",re),e[86]=re,e[87]=ue):ue=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(le=(Re,Pe)=>{var He;Pe===0&&Re===10&&((He=c.current)==null||He.resize(30))},e[88]=le):le=e[88],e[89]!==a?(je=()=>a(!1),Se=()=>a(!0),e[89]=a,e[90]=je,e[91]=Se):(je=e[90],Se=e[91]),e[92]===Symbol.for("react.memo_cache_sentinel")?(Le=u.jsx("div",{}),e[92]=Le):Le=e[92],e[93]!==a?(Ie=()=>a(!1),e[93]=a,e[94]=Ie):Ie=e[94],e[95]!==r||e[96]!==Ie?(ke=u.jsx(M.Suspense,{fallback:Le,children:u.jsx(cO,{visible:r,onClose:Ie})}),e[95]=r,e[96]=Ie,e[97]=ke):ke=e[97],e[98]!==r||e[99]!==ke?(Ye=u.jsx(F7,{isOpen:r,children:ke}),e[98]=r,e[99]=ke,e[100]=Ye):Ye=e[100],e[101]!==ue||e[102]!==je||e[103]!==Se||e[104]!==Ye||e[105]!==N?(Ve=u.jsxs(Wc,{ref:c,id:"terminal",collapsedSize:0,collapsible:!0,className:ue,minSize:10,defaultSize:0,maxSize:75,onResize:le,onCollapse:je,onExpand:Se,children:[N,Ye]},"terminal"),e[101]=ue,e[102]=je,e[103]=Se,e[104]=Ye,e[105]=N,e[106]=Ve):Ve=e[106];const Ke=Ve;let ee,ye,we,Ae,K,pe,ge,he,Ce;return e[107]===Symbol.for("react.memo_cache_sentinel")?(ee=KF(),e[107]=ee):ee=e[107],e[108]===Symbol.for("react.memo_cache_sentinel")?(ye=u.jsx($c,{children:u.jsx(H6,{})}),e[108]=ye):ye=e[108],e[109]!==Ke?(we=u.jsx($b,{capability:"terminal",children:Ke}),e[109]=Ke,e[110]=we):we=e[110],e[111]!==x||e[112]!==we?(Ae=u.jsx(Wc,{children:u.jsxs(uj,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[x,we]})}),e[111]=x,e[112]=we,e[113]=Ae):Ae=e[113],e[114]===Symbol.for("react.memo_cache_sentinel")?(K=u.jsx(rF,{}),e[114]=K):K=e[114],e[115]!==fe||e[116]!==Ae?(pe=u.jsxs(uj,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:ee,children:[ye,fe,Ae,K]}),e[115]=fe,e[116]=Ae,e[117]=pe):pe=e[117],e[118]===Symbol.for("react.memo_cache_sentinel")?(ge=u.jsx(tO,{}),e[118]=ge):ge=e[118],e[119]===Symbol.for("react.memo_cache_sentinel")?(he=u.jsx(vc,{children:u.jsx($c,{children:u.jsx(z6,{})})}),e[119]=he):he=e[119],e[120]!==pe?(Ce=u.jsxs(XF,{children:[pe,ge,he]}),e[120]=pe,e[121]=Ce):Ce=e[121],Ce};function uO(){window.dispatchEvent(new Event("resize"))}function hO(){requestAnimationFrame(uO)}function fO(){window.dispatchEvent(new Event("resize"))}function mO(){requestAnimationFrame(fO)}let i3;i3=new URL(window.location.href).searchParams.get(sF.showChrome)==="false",Oj=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=H.c(10);if(i3){let s,i,a;return e[0]!==t?(s=u.jsx(Ub,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(ug,{}),e[2]=i):i=e[2],e[3]!==s?(a=u.jsxs(u.Fragment,{children:[s,i]}),e[3]=s,e[4]=a):a=e[4],a}let n,o,r;return e[5]!==t?(n=u.jsx(Ub,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(ug,{}),e[7]=o):o=e[7],e[8]!==n?(r=u.jsxs(dO,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{pp as C,Gc as E,dn as P,rz as __tla,Yc as a,Oj as e,Es as f};
|