@marimo-team/frontend 0.15.1-dev34 → 0.15.1-dev35
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-BcJwEN2q.js → ConnectedDataExplorerComponent-BYxPTiA6.js} +1 -1
- package/dist/assets/{ImageComparisonComponent-CnwGwcTi.js → ImageComparisonComponent-DBpvpxlw.js} +1 -1
- package/dist/assets/{VegaLite-Cnk7Ozer.js → VegaLite-DzkGo9LJ.js} +1 -1
- package/dist/assets/{_baseEach-DJPM6ZzY.js → _baseEach-CnK_W3-W.js} +1 -1
- package/dist/assets/_baseMap-CIc0IDdl.js +1 -0
- package/dist/assets/{_baseUniq-CrXjB6JP.js → _baseUniq-DsEUejTO.js} +1 -1
- package/dist/assets/{_createAggregator-Cd0noqMc.js → _createAggregator-xSD3e6yX.js} +1 -1
- package/dist/assets/{any-language-editor-ZfVYrHPH.js → any-language-editor-CSLfx3Fo.js} +1 -1
- package/dist/assets/{architectureDiagram-KFL7JDKH-DuJCaD_M.js → architectureDiagram-KFL7JDKH-DDJcEe4E.js} +1 -1
- package/dist/assets/{blockDiagram-ZYB65J3Q-B0f3bVJ0.js → blockDiagram-ZYB65J3Q-DrajNxU6.js} +1 -1
- package/dist/assets/{c4Diagram-AAMF2YG6-3srX8_ui.js → c4Diagram-AAMF2YG6-DkbBAlkB.js} +1 -1
- package/dist/assets/channel-D2aPrBH4.js +1 -0
- package/dist/assets/{chunk-ANTBXLJU-CD8Ya77t.js → chunk-ANTBXLJU-CyFpCIAD.js} +1 -1
- package/dist/assets/{chunk-FHKO5MBM-34L0hhh_.js → chunk-FHKO5MBM-DaRG9EJ9.js} +1 -1
- package/dist/assets/{chunk-GLLZNHP4-CRWkmhQj.js → chunk-GLLZNHP4-C852Uilf.js} +1 -1
- package/dist/assets/{chunk-JBRWN2VN-CB8a_SQv.js → chunk-JBRWN2VN-DF6c2w7p.js} +1 -1
- package/dist/assets/{chunk-LXBSTHXV-YNRk01ob.js → chunk-LXBSTHXV-DJc1jClD.js} +1 -1
- package/dist/assets/{chunk-NRVI72HA-nFtyi9pH.js → chunk-NRVI72HA-BYzJjL14.js} +1 -1
- package/dist/assets/{chunk-OMD6QJNC-BXZ4Kapq.js → chunk-OMD6QJNC-DpzW6M54.js} +1 -1
- package/dist/assets/{chunk-WVR4S24B-ZnYlHppS.js → chunk-WVR4S24B-Ds_Fnulu.js} +1 -1
- package/dist/assets/{circle-play-k88jloBa.js → circle-play-ILK7D0lo.js} +1 -1
- package/dist/assets/classDiagram-3BZAVTQC-DAUNRz1h.js +1 -0
- package/dist/assets/classDiagram-v2-QTMF73CY-DAUNRz1h.js +1 -0
- package/dist/assets/clone-CYXehyk_.js +1 -0
- package/dist/assets/{compile-CDMtSySK.js → compile-Q6b1NW0Y.js} +1 -1
- package/dist/assets/{dagre-2BBEFEWP-Bfm20vyd.js → dagre-2BBEFEWP-DUplj_Iy.js} +1 -1
- package/dist/assets/{data-grid-overlay-editor-CwEfDFcK.js → data-grid-overlay-editor-BHVNUwJL.js} +1 -1
- package/dist/assets/{diagram-4IRLE6MV-A9psNOWP.js → diagram-4IRLE6MV-CqSPK4-w.js} +1 -1
- package/dist/assets/{diagram-GUPCWM2R-B23WLgai.js → diagram-GUPCWM2R-Yz9pe62o.js} +1 -1
- package/dist/assets/{diagram-RP2FKANI-CU5qL55k.js → diagram-RP2FKANI-DAvv4Av_.js} +1 -1
- package/dist/assets/{edit-page-DYm-s1ff.js → edit-page-hlKtRc6p.js} +4 -4
- package/dist/assets/{erDiagram-HZWUO2LU-D31RvIVf.js → erDiagram-HZWUO2LU-BIlDOHrw.js} +1 -1
- package/dist/assets/{flowDiagram-THRYKUMA-ClYGAL8Y.js → flowDiagram-THRYKUMA-w6HYIjcR.js} +1 -1
- package/dist/assets/{ganttDiagram-WV7ZQ7D5-Cmed9KL9.js → ganttDiagram-WV7ZQ7D5-CS1t__7-.js} +1 -1
- package/dist/assets/{gitGraphDiagram-OJR772UL-CWvdnGVc.js → gitGraphDiagram-OJR772UL-DCcukZnI.js} +1 -1
- package/dist/assets/{glide-data-editor-CFVz2aZ5.js → glide-data-editor-BoQ4MEIu.js} +4 -4
- package/dist/assets/{graph-OxTx0_rA.js → graph-DzywueYf.js} +1 -1
- package/dist/assets/{home-page-Dt3nnRSz.js → home-page-CTLf7o0o.js} +1 -1
- package/dist/assets/{index-D4HfKv3U.js → index-B8egTd_Y.js} +1 -1
- package/dist/assets/{index-DjT-1R5N.js → index-BNpIaqHq.js} +1 -1
- package/dist/assets/{index-BM1NAxco.js → index-BNuSEPHf.js} +1 -1
- package/dist/assets/{index-BOFl7de8.js → index-BOaSI40H.js} +1 -1
- package/dist/assets/{index-DLO62gfd.js → index-BVdia1-T.js} +1 -1
- package/dist/assets/{index-Baw8vWOg.js → index-BbrvgVGd.js} +1 -1
- package/dist/assets/{index-KCIhgRrL.js → index-BobSdMcV.js} +1 -1
- package/dist/assets/{index-BLXqwIOX.js → index-BsZupkBE.js} +1 -1
- package/dist/assets/{index-C0Q8e5FM.js → index-CTTXrsVd.js} +1 -1
- package/dist/assets/{index-Bd2C9zUZ.js → index-C_ZOWmXX.js} +1 -1
- package/dist/assets/{index-WltWzc1Z.js → index-CjvmeMRd.js} +1 -1
- package/dist/assets/{index-quG0To4_.js → index-DMgZFfTJ.js} +1 -1
- package/dist/assets/{index-CQFSXxPp.js → index-DMvScaq6.js} +133 -133
- package/dist/assets/{index-DsWckHTg.js → index-DNjb9MyH.js} +1 -1
- package/dist/assets/{index-DETsDEp1.js → index-DUumP-lt.js} +1 -1
- package/dist/assets/{index-4GKIL9qL.js → index-Dl6_NSX4.js} +1 -1
- package/dist/assets/{index-B-P7QUhF.js → index-DsMyERcC.js} +1 -1
- package/dist/assets/{index-DHlxJ27b.js → index-EaCZDGUn.js} +1 -1
- package/dist/assets/{index-BUwTI3go.js → index-gZP0fYKG.js} +1 -1
- package/dist/assets/{index-Bu3XvTHk.js → index-txir7kB2.js} +1 -1
- package/dist/assets/infoDiagram-6WOFNB3A-B1zwcYam.js +2 -0
- package/dist/assets/{journeyDiagram-FFXJYRFH-BLEcUGJo.js → journeyDiagram-FFXJYRFH-IwybgEnB.js} +1 -1
- package/dist/assets/{kanban-definition-KOZQBZVT-RanT6u8e.js → kanban-definition-KOZQBZVT-BnLxznwF.js} +1 -1
- package/dist/assets/{layout-D4n_CEl8.js → layout-lIKJEEeS.js} +1 -1
- package/dist/assets/{linear-BbPKk0w3.js → linear-DzfVWjvh.js} +1 -1
- package/dist/assets/{links-B7_BzQLv.js → links-yIZ6advT.js} +1 -1
- package/dist/assets/{mermaid-CUkYs7pX.js → mermaid-CEpdDmik.js} +4 -4
- package/dist/assets/{min-Yuyj_o4k.js → min-CH9RTxJs.js} +1 -1
- package/dist/assets/{mindmap-definition-LNHGMQRG-x4MjCJ_j.js → mindmap-definition-LNHGMQRG-BGOBqdZQ.js} +1 -1
- package/dist/assets/{number-overlay-editor-DeKR_mfB.js → number-overlay-editor-Bp8EEFG4.js} +1 -1
- package/dist/assets/{pieDiagram-DBDJKBY4-ZOMhJp-a.js → pieDiagram-DBDJKBY4-BH18DMec.js} +1 -1
- package/dist/assets/{quadrantDiagram-YPSRARAO-vZeyiYxN.js → quadrantDiagram-YPSRARAO-DyEaA3Tj.js} +1 -1
- package/dist/assets/{react-plotly-BV6-1ruP.js → react-plotly-BWJyJ31U.js} +1 -1
- package/dist/assets/{requirementDiagram-EGVEC5DT-DkgbH0oi.js → requirementDiagram-EGVEC5DT-BIDYwWds.js} +1 -1
- package/dist/assets/{run-page-0slxHZwl.js → run-page-CFGHZjjp.js} +1 -1
- package/dist/assets/{sankeyDiagram-HRAUVNP4-BuFPw2i8.js → sankeyDiagram-HRAUVNP4-CI7WE82z.js} +1 -1
- package/dist/assets/{sequenceDiagram-WFGC7UMF-BKGIaix6.js → sequenceDiagram-WFGC7UMF-CAt5_R3a.js} +1 -1
- package/dist/assets/{slides-component-DYhLRND3.js → slides-component-BE3m7wod.js} +1 -1
- package/dist/assets/{sortBy-C_bWmRoh.js → sortBy-D8wYLA9x.js} +1 -1
- package/dist/assets/{stateDiagram-UUKSUZ4H-Cm2zkw0M.js → stateDiagram-UUKSUZ4H-B9ghWYn7.js} +1 -1
- package/dist/assets/stateDiagram-v2-EYPG3UTE-DtL7XYtB.js +1 -0
- package/dist/assets/{storage-Dk-ciwQU.js → storage-BseyfFaj.js} +3 -3
- package/dist/assets/{terminal-DrDWxiEU.js → terminal-R2SnqHO_.js} +1 -1
- package/dist/assets/{time-DW3BCgky.js → time-CftJc27E.js} +1 -1
- package/dist/assets/{timeline-definition-3HZDQTIS-B_ZdpuLp.js → timeline-definition-3HZDQTIS-B8ej5Uev.js} +1 -1
- package/dist/assets/{tracing-BuGDnWcg.js → tracing-OU6KdAjg.js} +2 -2
- package/dist/assets/{trash-BKmRbRfw.js → trash-BX0buH-6.js} +1 -1
- package/dist/assets/{treemap-75Q7IDZK-BBbbCdps.js → treemap-75Q7IDZK-C6t8vi8s.js} +1 -1
- package/dist/assets/{vega-component-DogOWa6S.js → vega-component-a-Wve7v1.js} +1 -1
- package/dist/assets/{xychartDiagram-FDP5SA34-3B1j_9pq.js → xychartDiagram-FDP5SA34-DmTMju1m.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/__mocks__/notebook.ts +108 -0
- package/src/components/editor/ai/__tests__/completion-utils.test.ts +119 -139
- package/src/components/editor/ai/completion-utils.ts +7 -33
- package/src/core/ai/context/__tests__/registry.test.ts +154 -0
- package/src/core/ai/context/__tests__/utils.test.ts +174 -0
- package/src/core/ai/context/context.ts +3 -1
- package/src/core/ai/context/providers/__tests__/__snapshots__/error.test.ts.snap +3 -0
- package/src/core/ai/context/providers/__tests__/__snapshots__/tables.test.ts.snap +8 -12
- package/src/core/ai/context/providers/__tests__/__snapshots__/variable.test.ts.snap +4 -20
- package/src/core/ai/context/providers/__tests__/error.test.ts +328 -0
- package/src/core/ai/context/providers/common.ts +1 -0
- package/src/core/ai/context/providers/error.ts +165 -0
- package/src/core/ai/context/providers/tables.ts +14 -6
- package/src/core/ai/context/providers/variable.ts +11 -2
- package/src/core/ai/context/utils.ts +49 -0
- package/src/core/cells/cells.ts +1 -1
- package/dist/assets/_baseMap-u5TY8JMW.js +0 -1
- package/dist/assets/channel-BIZI32eZ.js +0 -1
- package/dist/assets/classDiagram-3BZAVTQC-DfPpF-gd.js +0 -1
- package/dist/assets/classDiagram-v2-QTMF73CY-DfPpF-gd.js +0 -1
- package/dist/assets/clone-yHYNh3QG.js +0 -1
- package/dist/assets/infoDiagram-6WOFNB3A-BQOY1VMN.js +0 -2
- package/dist/assets/stateDiagram-v2-EYPG3UTE-DX5NRIHK.js +0 -1
@@ -1,5 +1,5 @@
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-
|
2
|
-
var DO=Object.defineProperty;var h3=Mt=>{throw TypeError(Mt)};var RO=(Mt,wt,nn)=>wt in Mt?DO(Mt,wt,{enumerable:!0,configurable:!0,writable:!0,value:nn}):Mt[wt]=nn;var Z=(Mt,wt,nn)=>RO(Mt,typeof wt!="symbol"?wt+"":wt,nn),PO=(Mt,wt,nn)=>wt.has(Mt)||h3("Cannot "+nn);var f3=(Mt,wt,nn)=>(PO(Mt,wt,"read from private field"),nn?nn.call(Mt):wt.get(Mt)),m3=(Mt,wt,nn)=>wt.has(Mt)?h3("Cannot add the same private member more than once"):wt instanceof WeakSet?wt.add(Mt):wt.set(Mt,nn);import{c as _e,jo as mr,jp as LO,jq as lm,jr as FO,js as zO,jt as p3,ju as g3,jv as Yl,U as M,ft as BO,fK as UO,dM as x3,jw as $O,dI as VO,dL as HO,b as q,dG as cm,jx as pr,jy as bn,jz as Kl,jA as At,q as Jn,gs as Fn,gr as In,jB as nt,jC as ls,o as We,gC as No,a as H,T as ot,ac as Je,j as u,a1 as zn,a9 as Wo,a8 as cs,aa as ds,bo as qo,a6 as ve,ab as sn,jD as Ti,a7 as Go,aT as Bn,ad as Mi,at as Ee,ao as Ct,d_ as dm,eO as Oi,jE as WO,aO as Le,S as lt,jF as qO,f0 as yn,jG as b3,jH as y3,jI as um,jJ as v3,L as ct,dy as Xl,aY as Yo,jK as Jl,a_ as hm,ag as tn,jL as GO,aw as Di,jM as YO,jN as w3,e$ as k3,al as St,b5 as fm,jO as C3,cB as Zl,jP as KO,dR as Qe,jQ as Ql,dY as An,jR as Ri,V as Ne,ba as Tn,jS as ec,jT as tc,eR as us,jU as XO,jV as Pi,jW as S3,eZ as j3,jX as mm,jY as pm,er as gm,jZ as Zn,j_ as gr,aW as nc,j$ as JO,k0 as oc,k1 as rc,au as Eo,ef as N3,av as Li,k2 as ZO,k3 as sc,bq as xr,eS as br,g8 as E3,be as zt,k4 as QO,k5 as eD,gI as Fi,aQ as ic,k6 as xm,k7 as tD,k8 as _3,k9 as bm,ka as nD,kb as ac,kc as Qn,kd as I3,gK as ym,ke as zi,kf as lc,ew as ft,ey as hs,kg as gt,kh as ze,ki as at,kj as vm,kk as oD,kl as wm,km as xt,kn as A3,ds as cc,dn as dc,dp as km,dq as uc,dm as hc,gm as Cm,b4 as Un,aK as Mn,gc as T3,ge as M3,gf as rD,gk as sD,gg as O3,ko as D3,ar as xe,eq as iD,b2 as _o,b0 as Io,b3 as Ao,a$ as Tt,e_ as an,kp as R3,gi as P3,kq as aD,kr as lD,g9 as L3,ga as F3,ks as fs,dr as Sm,kt as z3,h8 as cD,ku as dD,a5 as uD,a4 as hD,kv as jm,dv as B3,dx as Nm,fj as fc,kw as mc,kx as pc,bt as vn,eV as Bi,fg as ln,bj as U3,d$ as Bt,el as fD,a2 as Em,ky as Ui,kz as gc,kA as mD,kB as pD,kC as $3,a3 as gD,ae as $i,eL as V3,kD as Gt,aX as xD,af as _m,gN as H3,es as xc,kE as bD,hv as Im,bi as bc,bl as yD,kF as vD,kG as W3,hF as wD,hD as kD,hG as CD,hH as SD,kH as Am,dt as $n,kI as jD,kJ as yc,kK as ms,kL as ps,gJ as Dt,kM as Tm,ev as wn,kN as ND,g0 as Mm,bg as q3,bh as G3,kO as ED,hy as gs,kP as vc,bd as wc,hz as yr,f1 as Om,kQ as _D,kR as Y3,kS as Vi,kT as K3,kU as Dm,kV as X3,kW as J3,kX as Z3,kY as Q3,f2 as Rm,kZ as ID,k_ as eo,k$ as kc,l0 as eC,du as tC,l1 as Cc,hu as Pm,l2 as Sc,l3 as Hi,l4 as Wi,l5 as jc,l6 as Ko,l7 as nC,l8 as To,l9 as xs,la as Lm,lb as qi,lc as bs,ld as Fm,le as zm,lf as oC,lg as Nc,lh as AD,ay as Gi,li as Yi,lj as TD,dX as Ec,lk as MD,ll as Bm,lm as OD,ln as DD,lo as _c,e4 as RD,gX as rC,cm as sC,lp as Um,gl as iC,eK as aC,lq as lC,lr as Ic,ls as cC,lt as Ac,lu as $m,lv as ys,lw as Ki,lx as Xi,ly as PD,gU as Tc,lz as Vm,lA as Mc,ek as LD,gV as FD,lB as zD,lC as BD,lD as UD,lE as $D,u as VD,lF as HD,lG as WD,lH as qD,gv as GD,lI as YD,lJ as dC,t as F,lK as KD,lL as XD,lM as JD,lN as ZD,lO as QD,lP as eR,lQ as tR,lR as nR,lS as oR,lT as rR,lU as sR,lV as iR,lW as aR,lX as lR,lY as cR,lZ as dR,l_ as uR,l$ as hR,m0 as fR,m1 as mR,m2 as pR,m3 as gR,m4 as Ji,m5 as xR,m6 as bR,m7 as yR,m8 as vR,m9 as wR,ma as kR,mb as CR,mc as SR,md as Hm,me as Oc,mf as uC,mg as jR,mh as NR,mi as hC,mj as ER,mk as vs,ml as On,mm as _R,mn as IR,mo as AR,mp as TR,mq as MR,mr as OR,ms as DR,mt as RR,mu as PR,mv as LR,mw as Xo,mx as FR,my as zR,mz as BR,mA as UR,e1 as $R,mB as VR,mC as fC,e5 as HR,mD as Dc,mE as WR,mF as qR,mG as GR,mH as YR,hI as Jo,mI as Rc,mJ as KR,mK as XR,mL as mC,mM as Wm,hx as ws,mN as JR,mO as ZR,mP as QR,mQ as Zi,mR as Qi,eY as qm,mS as eP,gA as tP,bn as nP,an as Gm,mT as pC,mU as oP,mV as rP,mW as Ym,mX as Km,mY as sP,mZ as gC,m_ as xC,m$ as Pc,gq as iP,Y as bC,dP as aP,n0 as yC,g7 as vt,n1 as ea,n2 as ks,n3 as lP,n4 as cP,n5 as dP,n6 as uP,cl as Xm,n7 as hP,am as vr,n8 as Lc,n9 as fP,na as Jm,nb as vC,dN as Fc,nc as mP,bp as wC,bf as kC,nd as pP,ne as gP,nf as xP,ex as bP,ng as CC,nh as SC,ni as jC,nj as yP,nk as NC,nl as EC,nm as ta,nn as vP,no as _C,np as wP,nq as kP,nr as IC,Z as zc,ns as CP,br as AC,nt as SP,as as Mo,nu as jP,nv as na,nw as NP,nx as TC,eX as MC,go as Bc,ny as Zm,aV as Qm,ep as Uc,eo as ep,nz as EP,eU as OC,nA as _P,nB as DC,fs as IP,nC as AP,hr as TP,gd as MP,gh as tp,hs as OP,bm as oa,nD as RC,nE as np,nF as DP,nG as RP,nH as PP,_ as kn,et as LP,nI as FP,nJ as zP,nK as PC,fl as op,dA as LC,nL as BP,aq as wr,nM as UP,nN as $P,nO as VP,aP as HP,nP as WP,nQ as qP,nR as GP,W as YP,nS as $c,fh as KP,nT as FC,h9 as zC,gB as XP,h0 as JP,nU as ZP,nV as BC,nW as QP,nX as Cs,nY as eL,nZ as Vc,n_ as tL,n$ as nL,o0 as oL,z as UC,hB as rL,o1 as ra,hh as $C,hi as VC,hj as HC,h7 as WC,o2 as sL,C as qC,o3 as iL,o4 as aL,hd as lL,o5 as cL,o6 as dL,E as kr,f7 as GC,bc as uL,b9 as hL,o7 as fL,o8 as mL,o9 as pL,dD as YC,oa as rp,gb as gL,dZ as KC,ob as xL,oc as sp,od as bL,oe as yL,of as vL,og as XC,oh as wL,oi as JC,oj as ZC,ff as QC,ok as kL,ol as CL,om as eS,on as tS,oo as Hc,op as nS,oq as oS,or as rS,os as SL,ot as jL,ou as sS,ov as NL,ow as EL,ox as _L,oy as IL,oz as AL,oA as TL,dW as ML,oB as OL,oC as DL,oD as RL,oE as PL,oF as LL,oG as FL,oH as zL,oI as BL,oJ as UL,oK as $L,oL as VL,gZ as HL,oM as WL,oN as qL,oO as iS,oP as GL,ax as YL,oQ as KL,ap as XL,eN as JL,oR as ZL,hm as ip,hk as Ss,hn as Cr,hl as Sr,ho as ap,hp as lp,oS as aS,oT as lS,oU as cS,oV as Zo,ha as QL,oW as eF,oX as tF,oY as nF,oZ as oF,o_ as rF,o$ as dS,eC as sF,p0 as cp,p1 as iF,ah as Wc,p2 as uS,p3 as hS,aj as fS,ai as aF,dV as lF,__tla as cF}from"./index-CQFSXxPp.js";import{b as js,A as dF,L as mS,g as uF,G as hF,o as pS,s as fF,k as mF,B as gS,a as pF,M as gF,Y as xF,c as cn,u as sa,C as bF,S as yF,K as vF,d as wF,i as kF,e as xS,f as CF,h as SF,j as ia,P as aa,l as bS,m as jF,n as NF,p as EF,D as Ns,q as _F,r as dp,T as IF}from"./links-B7_BzQLv.js";import{V as yS,d as jr,I as up,N as vS,S as wS,e as kS,f as CS,L as SS,g as jS,F as NS,M as AF,l as ES,h as TF,E as qc,i as MF,j as hp,k as fp,n as OF,o as DF,p as RF,q as PF,s as LF,t as FF,v as zF,w as BF,u as UF,C as $F,R as _S,A as VF,a as HF,T as WF,x as qF,y as GF,m as YF,z as KF,B as XF,O as JF,c as ZF,P as QF,__tla as ez}from"./storage-Dk-ciwQU.js";import{c as tz}from"./_createAggregator-Cd0noqMc.js";import{_ as IS,a as AS,i as nz,w as oz,L as TS,A as rz,C as MS,b as mp,c as OS,__tla as sz}from"./loro_wasm_bg-C3hKWL9L.js";import{s as Vn,i as Qo,T as pp,a as gp}from"./transform-B8bpuzxV.js";import{g as DS}from"./timer-BwIYMJWC.js";import{i as iz}from"./zoom-COrs4lFh.js";import{s as la}from"./sortBy-C_bWmRoh.js";let xp,Gc,dn,Yc,RS,Es,az=Promise.all([(()=>{try{return cF}catch{}})(),(()=>{try{return ez}catch{}})(),(()=>{try{return sz}catch{}})()]).then(async()=>{var Gl,c3;var Mt=tz(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let wt,nn,bp,Kc,_s,Nr,Xc,Jc,yp,vp,ca,Zc,wp,da,kp,Qc,Cp,Sp,ed,jp,Np,Ep,ua,_p,td,Ip,Ap,Tp,Mp,Op,Dp,nd,Rp,od,rd,Pp,Lp,Fp,zp,Bp,Up,ha,$p,Vp,sd,Hp,Wp,qp,id,Gp,Yp,Kp,fa,ad,ld,Xp,Jp,Zp,Qp,eg,tg,ng,og,rg,cd,dd,sg,ig,ag,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"}]]),bp=_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"}]]),yp=_e("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),vp=_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"}]]),wp=_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"}]]),kp=_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"}]]),Cp=_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"}]]),Sp=_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"}]]),jp=_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"}]]),Np=_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"}]]),Ep=_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"}]]),_p=_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"}]]),Ip=_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"}]]),Ap=_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"}]]),Tp=_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"}]]),Mp=_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"}]]),Op=_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"}]]),Dp=_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"}]]),Rp=_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"}]]),Pp=_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"}]]),Lp=_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"}]]),Fp=_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"}]]),zp=_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"}]]),Bp=_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"}]]),Up=_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"}]]),$p=_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"}]]),Vp=_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"}]]),Hp=_e("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Wp=_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"}]]),qp=_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"}]]),Gp=_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"}]]),Yp=_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"}]]),Kp=_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"}]]),Xp=_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"}]]),Jp=_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"}]]),Zp=_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"}]]),Qp=_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"}]]),eg=_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"}]]),tg=_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"}]]),ng=_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"}]]),og=_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"}]]),rg=_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"}]]),sg=_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"}]]),ig=_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"}]]),ag=_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 PS(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 LS(t,e,n){const[o,r,s]=lm(n==null?void 0:n.in,t,t,e),i=pa(r,s),a=Math.abs(function(d,h,f){const[m,g]=lm(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;PS(o)&&a===1&&pa(o,s)===1&&(l=!1);const c=i*(a-+l);return c===0?0:c}function FS(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 zS(t,e){return function(n,o,r){const s=FO(),i=(r==null?void 0:r.locale)??s.locale??zO,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]=lm(r==null?void 0:r.in,...a>0?[o,n]:[n,o]),h=FS(d,c),f=(p3(d)-p3(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<g3){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/g3);return i.formatDistance("xDays",x,l)}if(m<2*Yl)return g=Math.round(m/Yl),i.formatDistance("aboutXMonths",g,l);if(g=LS(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 LO(n,Date.now())}(t),e)}const BS=M.createContext({}),US=M.forwardRef(function(t,e){[t,e]=VO(t,e,BS);let{toolbarProps:n}=function(s,i){const{"aria-label":a,"aria-labelledby":l,orientation:c="horizontal"}=s;let[d,h]=M.useState(!1);BO(()=>{var p;h(!(!i.current||!(!((p=i.current.parentElement)===null||p===void 0)&&p.closest('[role="toolbar"]'))))});const{direction:f}=UO(),m=f==="rtl"&&c==="horizontal";let g=$O(i);const x=M.useRef(null);return{toolbarProps:{...x3(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=HO({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=x3(t,{global:!0});return delete r.id,q.createElement("div",{...cm(r,o,n),ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)}),ga={showInput:"Mod-l",acceptEdit:"Mod-y",rejectEdit:"Mod-u"},Is=pr.define({combine:t=>Kl(t,{onError:console.error,inputDebounceTime:300,keymaps:ga},{onError:(e,n)=>e&&n,inputDebounceTime:(e,n)=>e&&n,keymaps:(e,n)=>e&&n})}),er=At.define(),tr=bn.define({create:()=>({show:!1,lineFrom:0,lineTo:0}),update(t,e){for(const n of e.effects)if(n.is(er))return n.value;return t}}),As=At.define(),Ts=At.define(),lg=bn.define({create:()=>({shouldFocus:!1,inputValue:""}),update(t,e){let n=t;for(const o of e.effects)o.is(As)&&(n={...n,inputValue:o.value}),o.is(Ts)&&(n={...n,shouldFocus:o.value});return n}}),xa=At.define(),Ms=bn.define({create:()=>null,update(t,e){for(const n of e.effects)if(n.is(xa))return n.value;return t}}),Er=At.define(),cg=bn.define({create:()=>!1,update(t,e){for(const n of e.effects)if(n.is(Er))return n.value;return t}}),dg=t=>{const{state:e}=t,n=e.selection.main;if(n.empty)return!1;const o=e.doc,r=o.lineAt(n.from),s=o.lineAt(n.to);if(e.sliceDoc(r.from,s.to).trim().length<1)return!1;const i=Math.max(1,Math.min(r.number,o.lines)),a=Math.max(1,Math.min(s.number,o.lines));return t.dispatch({effects:[er.of({show:!0,lineFrom:i,lineTo:a}),Ts.of(!0),As.of("")],selection:Jn.cursor(r.from)}),!0},ug=t=>!!t.state.field(Ms)&&(t.dispatch({effects:[xa.of(null),er.of({show:!1,lineFrom:0,lineTo:0}),Ts.of(!1),As.of(""),Er.of(!1)]}),!0),hg=t=>{const e=t.state.field(Ms);return!!e&&(t.dispatch({changes:{from:e.from,to:e.to,insert:e.oldCode},effects:[xa.of(null),er.of({show:!1,lineFrom:0,lineTo:0}),Ts.of(!1),As.of(""),Er.of(!1)]}),!0)},$S="\u2318",VS="\u229E Win",HS="Ctrl";function ud(t){return t.replace("Mod",navigator.platform.startsWith("Mac")?$S:navigator.platform.startsWith("Win")?VS:HS).replace("-"," ").toUpperCase()}function Yt(t,e){const n=document.createElement(t);return n.className=e,n}const ba=bn.define({create:()=>({suggestion:null}),update(t,e){const n=e.effects.find(o=>o.is(ya));return e.docChanged||n||e.selection?n&&e.state.doc===n.value.doc?{suggestion:n.value.text}:{suggestion:null}:t}}),ya=At.define();class WS extends ls{constructor(n){super();Z(this,"suggestion");this.suggestion=n}toDOM(){const n=document.createElement("span");return n.style.opacity="0.4",n.className="cm-inline-suggestion",n.textContent=this.suggestion,n.setAttribute("role","suggestion"),n.setAttribute("aria-label",`Suggestion: ${this.suggestion}`),n}get lineBreaks(){return this.suggestion.split(`
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-OU6KdAjg.js","./index-DMvScaq6.js","./index-B6q_Qknx.css","./compile-Q6b1NW0Y.js","./time-CftJc27E.js","./timer-BwIYMJWC.js","./linear-DzfVWjvh.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-BseyfFaj.js","./index-C_ZOWmXX.js","./index-DsMyERcC.js","./index-BNuSEPHf.js","./index-BobSdMcV.js","./index-Dl6_NSX4.js","./index-DNjb9MyH.js","./index-B8egTd_Y.js","./index-EaCZDGUn.js","./index-BbrvgVGd.js","./index-CTTXrsVd.js","./index-gZP0fYKG.js","./index-CjvmeMRd.js","./index-BOaSI40H.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-BX0buH-6.js","./storage-B6yZpgAI.css","./links-yIZ6advT.js","./index-txir7kB2.js","./links-Dn1Stwqz.css","./circle-play-ILK7D0lo.js","./_createAggregator-xSD3e6yX.js","./_baseEach-CnK_W3-W.js","./loro_wasm_bg-C3hKWL9L.js","./transform-B8bpuzxV.js","./sortBy-D8wYLA9x.js","./_baseMap-CIc0IDdl.js","./terminal-R2SnqHO_.js","./terminal-B3isKKSk.css"])))=>i.map(i=>d[i]);
|
2
|
+
var DO=Object.defineProperty;var h3=Mt=>{throw TypeError(Mt)};var RO=(Mt,wt,nn)=>wt in Mt?DO(Mt,wt,{enumerable:!0,configurable:!0,writable:!0,value:nn}):Mt[wt]=nn;var Z=(Mt,wt,nn)=>RO(Mt,typeof wt!="symbol"?wt+"":wt,nn),PO=(Mt,wt,nn)=>wt.has(Mt)||h3("Cannot "+nn);var f3=(Mt,wt,nn)=>(PO(Mt,wt,"read from private field"),nn?nn.call(Mt):wt.get(Mt)),m3=(Mt,wt,nn)=>wt.has(Mt)?h3("Cannot add the same private member more than once"):wt instanceof WeakSet?wt.add(Mt):wt.set(Mt,nn);import{c as _e,jo as mr,jp as LO,jq as lm,jr as FO,js as zO,jt as p3,ju as g3,jv as Yl,U as M,ft as BO,fK as UO,dM as x3,jw as $O,dI as VO,dL as HO,b as q,dG as cm,jx as pr,jy as bn,jz as Kl,jA as At,q as Jn,gs as Fn,gr as In,jB as nt,jC as ls,o as We,gC as No,a as H,T as ot,ac as Je,j as u,a1 as zn,a9 as Wo,a8 as cs,aa as ds,bo as qo,a6 as ve,ab as sn,jD as Ti,a7 as Go,aT as Bn,ad as Mi,at as Ee,ao as Ct,d_ as dm,eO as Oi,jE as WO,aO as Le,S as lt,jF as qO,f0 as yn,jG as b3,jH as y3,jI as um,jJ as v3,L as ct,dy as Xl,aY as Yo,jK as Jl,a_ as hm,ag as tn,jL as GO,aw as Di,jM as YO,jN as w3,e$ as k3,al as St,b5 as fm,jO as C3,cB as Zl,jP as KO,dR as Qe,jQ as Ql,dY as An,jR as Ri,V as Ne,ba as Tn,jS as ec,jT as tc,eR as us,jU as XO,jV as Pi,jW as S3,eZ as j3,jX as mm,jY as pm,er as gm,jZ as Zn,j_ as gr,aW as nc,j$ as JO,k0 as oc,k1 as rc,au as Eo,ef as N3,av as Li,k2 as ZO,k3 as sc,bq as xr,eS as br,g8 as E3,be as zt,k4 as QO,k5 as eD,gI as Fi,aQ as ic,k6 as xm,k7 as tD,k8 as _3,k9 as bm,ka as nD,kb as ac,kc as Qn,kd as I3,gK as ym,ke as zi,kf as lc,ew as ft,ey as hs,kg as gt,kh as ze,ki as at,kj as vm,kk as oD,kl as wm,km as xt,kn as A3,ds as cc,dn as dc,dp as km,dq as uc,dm as hc,gm as Cm,b4 as Un,aK as Mn,gc as T3,ge as M3,gf as rD,gk as sD,gg as O3,ko as D3,ar as xe,eq as iD,b2 as _o,b0 as Io,b3 as Ao,a$ as Tt,e_ as an,kp as R3,gi as P3,kq as aD,kr as lD,g9 as L3,ga as F3,ks as fs,dr as Sm,kt as z3,h8 as cD,ku as dD,a5 as uD,a4 as hD,kv as jm,dv as B3,dx as Nm,fj as fc,kw as mc,kx as pc,bt as vn,eV as Bi,fg as ln,bj as U3,d$ as Bt,el as fD,a2 as Em,ky as Ui,kz as gc,kA as mD,kB as pD,kC as $3,a3 as gD,ae as $i,eL as V3,kD as Gt,aX as xD,af as _m,gN as H3,es as xc,kE as bD,hv as Im,bi as bc,bl as yD,kF as vD,kG as W3,hF as wD,hD as kD,hG as CD,hH as SD,kH as Am,dt as $n,kI as jD,kJ as yc,kK as ms,kL as ps,gJ as Dt,kM as Tm,ev as wn,kN as ND,g0 as Mm,bg as q3,bh as G3,kO as ED,hy as gs,kP as vc,bd as wc,hz as yr,f1 as Om,kQ as _D,kR as Y3,kS as Vi,kT as K3,kU as Dm,kV as X3,kW as J3,kX as Z3,kY as Q3,f2 as Rm,kZ as ID,k_ as eo,k$ as kc,l0 as eC,du as tC,l1 as Cc,hu as Pm,l2 as Sc,l3 as Hi,l4 as Wi,l5 as jc,l6 as Ko,l7 as nC,l8 as To,l9 as xs,la as Lm,lb as qi,lc as bs,ld as Fm,le as zm,lf as oC,lg as Nc,lh as AD,ay as Gi,li as Yi,lj as TD,dX as Ec,lk as MD,ll as Bm,lm as OD,ln as DD,lo as _c,e4 as RD,gX as rC,cm as sC,lp as Um,gl as iC,eK as aC,lq as lC,lr as Ic,ls as cC,lt as Ac,lu as $m,lv as ys,lw as Ki,lx as Xi,ly as PD,gU as Tc,lz as Vm,lA as Mc,ek as LD,gV as FD,lB as zD,lC as BD,lD as UD,lE as $D,u as VD,lF as HD,lG as WD,lH as qD,gv as GD,lI as YD,lJ as dC,t as F,lK as KD,lL as XD,lM as JD,lN as ZD,lO as QD,lP as eR,lQ as tR,lR as nR,lS as oR,lT as rR,lU as sR,lV as iR,lW as aR,lX as lR,lY as cR,lZ as dR,l_ as uR,l$ as hR,m0 as fR,m1 as mR,m2 as pR,m3 as gR,m4 as Ji,m5 as xR,m6 as bR,m7 as yR,m8 as vR,m9 as wR,ma as kR,mb as CR,mc as SR,md as Hm,me as Oc,mf as uC,mg as jR,mh as NR,mi as hC,mj as ER,mk as vs,ml as On,mm as _R,mn as IR,mo as AR,mp as TR,mq as MR,mr as OR,ms as DR,mt as RR,mu as PR,mv as LR,mw as Xo,mx as FR,my as zR,mz as BR,mA as UR,e1 as $R,mB as VR,mC as fC,e5 as HR,mD as Dc,mE as WR,mF as qR,mG as GR,mH as YR,hI as Jo,mI as Rc,mJ as KR,mK as XR,mL as mC,mM as Wm,hx as ws,mN as JR,mO as ZR,mP as QR,mQ as Zi,mR as Qi,eY as qm,mS as eP,gA as tP,bn as nP,an as Gm,mT as pC,mU as oP,mV as rP,mW as Ym,mX as Km,mY as sP,mZ as gC,m_ as xC,m$ as Pc,gq as iP,Y as bC,dP as aP,n0 as yC,g7 as vt,n1 as ea,n2 as ks,n3 as lP,n4 as cP,n5 as dP,n6 as uP,cl as Xm,n7 as hP,am as vr,n8 as Lc,n9 as fP,na as Jm,nb as vC,dN as Fc,nc as mP,bp as wC,bf as kC,nd as pP,ne as gP,nf as xP,ex as bP,ng as CC,nh as SC,ni as jC,nj as yP,nk as NC,nl as EC,nm as ta,nn as vP,no as _C,np as wP,nq as kP,nr as IC,Z as zc,ns as CP,br as AC,nt as SP,as as Mo,nu as jP,nv as na,nw as NP,nx as TC,eX as MC,go as Bc,ny as Zm,aV as Qm,ep as Uc,eo as ep,nz as EP,eU as OC,nA as _P,nB as DC,fs as IP,nC as AP,hr as TP,gd as MP,gh as tp,hs as OP,bm as oa,nD as RC,nE as np,nF as DP,nG as RP,nH as PP,_ as kn,et as LP,nI as FP,nJ as zP,nK as PC,fl as op,dA as LC,nL as BP,aq as wr,nM as UP,nN as $P,nO as VP,aP as HP,nP as WP,nQ as qP,nR as GP,W as YP,nS as $c,fh as KP,nT as FC,h9 as zC,gB as XP,h0 as JP,nU as ZP,nV as BC,nW as QP,nX as Cs,nY as eL,nZ as Vc,n_ as tL,n$ as nL,o0 as oL,z as UC,hB as rL,o1 as ra,hh as $C,hi as VC,hj as HC,h7 as WC,o2 as sL,C as qC,o3 as iL,o4 as aL,hd as lL,o5 as cL,o6 as dL,E as kr,f7 as GC,bc as uL,b9 as hL,o7 as fL,o8 as mL,o9 as pL,dD as YC,oa as rp,gb as gL,dZ as KC,ob as xL,oc as sp,od as bL,oe as yL,of as vL,og as XC,oh as wL,oi as JC,oj as ZC,ff as QC,ok as kL,ol as CL,om as eS,on as tS,oo as Hc,op as nS,oq as oS,or as rS,os as SL,ot as jL,ou as sS,ov as NL,ow as EL,ox as _L,oy as IL,oz as AL,oA as TL,dW as ML,oB as OL,oC as DL,oD as RL,oE as PL,oF as LL,oG as FL,oH as zL,oI as BL,oJ as UL,oK as $L,oL as VL,gZ as HL,oM as WL,oN as qL,oO as iS,oP as GL,ax as YL,oQ as KL,ap as XL,eN as JL,oR as ZL,hm as ip,hk as Ss,hn as Cr,hl as Sr,ho as ap,hp as lp,oS as aS,oT as lS,oU as cS,oV as Zo,ha as QL,oW as eF,oX as tF,oY as nF,oZ as oF,o_ as rF,o$ as dS,eC as sF,p0 as cp,p1 as iF,ah as Wc,p2 as uS,p3 as hS,aj as fS,ai as aF,dV as lF,__tla as cF}from"./index-DMvScaq6.js";import{b as js,A as dF,L as mS,g as uF,G as hF,o as pS,s as fF,k as mF,B as gS,a as pF,M as gF,Y as xF,c as cn,u as sa,C as bF,S as yF,K as vF,d as wF,i as kF,e as xS,f as CF,h as SF,j as ia,P as aa,l as bS,m as jF,n as NF,p as EF,D as Ns,q as _F,r as dp,T as IF}from"./links-yIZ6advT.js";import{V as yS,d as jr,I as up,N as vS,S as wS,e as kS,f as CS,L as SS,g as jS,F as NS,M as AF,l as ES,h as TF,E as qc,i as MF,j as hp,k as fp,n as OF,o as DF,p as RF,q as PF,s as LF,t as FF,v as zF,w as BF,u as UF,C as $F,R as _S,A as VF,a as HF,T as WF,x as qF,y as GF,m as YF,z as KF,B as XF,O as JF,c as ZF,P as QF,__tla as ez}from"./storage-BseyfFaj.js";import{c as tz}from"./_createAggregator-xSD3e6yX.js";import{_ as IS,a as AS,i as nz,w as oz,L as TS,A as rz,C as MS,b as mp,c as OS,__tla as sz}from"./loro_wasm_bg-C3hKWL9L.js";import{s as Vn,i as Qo,T as pp,a as gp}from"./transform-B8bpuzxV.js";import{g as DS}from"./timer-BwIYMJWC.js";import{i as iz}from"./zoom-COrs4lFh.js";import{s as la}from"./sortBy-D8wYLA9x.js";let xp,Gc,dn,Yc,RS,Es,az=Promise.all([(()=>{try{return cF}catch{}})(),(()=>{try{return ez}catch{}})(),(()=>{try{return sz}catch{}})()]).then(async()=>{var Gl,c3;var Mt=tz(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let wt,nn,bp,Kc,_s,Nr,Xc,Jc,yp,vp,ca,Zc,wp,da,kp,Qc,Cp,Sp,ed,jp,Np,Ep,ua,_p,td,Ip,Ap,Tp,Mp,Op,Dp,nd,Rp,od,rd,Pp,Lp,Fp,zp,Bp,Up,ha,$p,Vp,sd,Hp,Wp,qp,id,Gp,Yp,Kp,fa,ad,ld,Xp,Jp,Zp,Qp,eg,tg,ng,og,rg,cd,dd,sg,ig,ag,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"}]]),bp=_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"}]]),yp=_e("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),vp=_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"}]]),wp=_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"}]]),kp=_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"}]]),Cp=_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"}]]),Sp=_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"}]]),jp=_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"}]]),Np=_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"}]]),Ep=_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"}]]),_p=_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"}]]),Ip=_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"}]]),Ap=_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"}]]),Tp=_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"}]]),Mp=_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"}]]),Op=_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"}]]),Dp=_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"}]]),Rp=_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"}]]),Pp=_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"}]]),Lp=_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"}]]),Fp=_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"}]]),zp=_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"}]]),Bp=_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"}]]),Up=_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"}]]),$p=_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"}]]),Vp=_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"}]]),Hp=_e("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Wp=_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"}]]),qp=_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"}]]),Gp=_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"}]]),Yp=_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"}]]),Kp=_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"}]]),Xp=_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"}]]),Jp=_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"}]]),Zp=_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"}]]),Qp=_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"}]]),eg=_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"}]]),tg=_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"}]]),ng=_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"}]]),og=_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"}]]),rg=_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"}]]),sg=_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"}]]),ig=_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"}]]),ag=_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 PS(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 LS(t,e,n){const[o,r,s]=lm(n==null?void 0:n.in,t,t,e),i=pa(r,s),a=Math.abs(function(d,h,f){const[m,g]=lm(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;PS(o)&&a===1&&pa(o,s)===1&&(l=!1);const c=i*(a-+l);return c===0?0:c}function FS(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 zS(t,e){return function(n,o,r){const s=FO(),i=(r==null?void 0:r.locale)??s.locale??zO,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]=lm(r==null?void 0:r.in,...a>0?[o,n]:[n,o]),h=FS(d,c),f=(p3(d)-p3(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<g3){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/g3);return i.formatDistance("xDays",x,l)}if(m<2*Yl)return g=Math.round(m/Yl),i.formatDistance("aboutXMonths",g,l);if(g=LS(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 LO(n,Date.now())}(t),e)}const BS=M.createContext({}),US=M.forwardRef(function(t,e){[t,e]=VO(t,e,BS);let{toolbarProps:n}=function(s,i){const{"aria-label":a,"aria-labelledby":l,orientation:c="horizontal"}=s;let[d,h]=M.useState(!1);BO(()=>{var p;h(!(!i.current||!(!((p=i.current.parentElement)===null||p===void 0)&&p.closest('[role="toolbar"]'))))});const{direction:f}=UO(),m=f==="rtl"&&c==="horizontal";let g=$O(i);const x=M.useRef(null);return{toolbarProps:{...x3(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=HO({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=x3(t,{global:!0});return delete r.id,q.createElement("div",{...cm(r,o,n),ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)}),ga={showInput:"Mod-l",acceptEdit:"Mod-y",rejectEdit:"Mod-u"},Is=pr.define({combine:t=>Kl(t,{onError:console.error,inputDebounceTime:300,keymaps:ga},{onError:(e,n)=>e&&n,inputDebounceTime:(e,n)=>e&&n,keymaps:(e,n)=>e&&n})}),er=At.define(),tr=bn.define({create:()=>({show:!1,lineFrom:0,lineTo:0}),update(t,e){for(const n of e.effects)if(n.is(er))return n.value;return t}}),As=At.define(),Ts=At.define(),lg=bn.define({create:()=>({shouldFocus:!1,inputValue:""}),update(t,e){let n=t;for(const o of e.effects)o.is(As)&&(n={...n,inputValue:o.value}),o.is(Ts)&&(n={...n,shouldFocus:o.value});return n}}),xa=At.define(),Ms=bn.define({create:()=>null,update(t,e){for(const n of e.effects)if(n.is(xa))return n.value;return t}}),Er=At.define(),cg=bn.define({create:()=>!1,update(t,e){for(const n of e.effects)if(n.is(Er))return n.value;return t}}),dg=t=>{const{state:e}=t,n=e.selection.main;if(n.empty)return!1;const o=e.doc,r=o.lineAt(n.from),s=o.lineAt(n.to);if(e.sliceDoc(r.from,s.to).trim().length<1)return!1;const i=Math.max(1,Math.min(r.number,o.lines)),a=Math.max(1,Math.min(s.number,o.lines));return t.dispatch({effects:[er.of({show:!0,lineFrom:i,lineTo:a}),Ts.of(!0),As.of("")],selection:Jn.cursor(r.from)}),!0},ug=t=>!!t.state.field(Ms)&&(t.dispatch({effects:[xa.of(null),er.of({show:!1,lineFrom:0,lineTo:0}),Ts.of(!1),As.of(""),Er.of(!1)]}),!0),hg=t=>{const e=t.state.field(Ms);return!!e&&(t.dispatch({changes:{from:e.from,to:e.to,insert:e.oldCode},effects:[xa.of(null),er.of({show:!1,lineFrom:0,lineTo:0}),Ts.of(!1),As.of(""),Er.of(!1)]}),!0)},$S="\u2318",VS="\u229E Win",HS="Ctrl";function ud(t){return t.replace("Mod",navigator.platform.startsWith("Mac")?$S:navigator.platform.startsWith("Win")?VS:HS).replace("-"," ").toUpperCase()}function Yt(t,e){const n=document.createElement(t);return n.className=e,n}const ba=bn.define({create:()=>({suggestion:null}),update(t,e){const n=e.effects.find(o=>o.is(ya));return e.docChanged||n||e.selection?n&&e.state.doc===n.value.doc?{suggestion:n.value.text}:{suggestion:null}:t}}),ya=At.define();class WS extends ls{constructor(n){super();Z(this,"suggestion");this.suggestion=n}toDOM(){const n=document.createElement("span");return n.style.opacity="0.4",n.className="cm-inline-suggestion",n.textContent=this.suggestion,n.setAttribute("role","suggestion"),n.setAttribute("aria-label",`Suggestion: ${this.suggestion}`),n}get lineBreaks(){return this.suggestion.split(`
|
3
3
|
`).length-1}}class qS{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 GS=(t,e)=>Fn.fromClass(class{constructor(){Z(this,"abortController",null);Z(this,"cache");this.cache=new qS(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:ya.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:ya.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()}}),YS=Fn.fromClass(class{constructor(){Z(this,"decorations");this.decorations=nt.none}update(t){var n;const e=(n=t.state.field(ba))==null?void 0:n.suggestion;this.decorations=e?function(o,r){const s=o.state.selection.main.head,i=[],a=nt.widget({widget:new WS(r),side:1});return i.push(a.range(s)),nt.set(i)}(t.view,e):nt.none}},{decorations:t=>t.decorations});function KS(t,e,n,o){return{...t.changeByRange(r=>{if(r===t.selection.main)return{changes:{from:n,to:o,insert:e},range:Jn.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:Jn.cursor(r.from-s+e.length)}}),userEvent:"input.complete"}}const fg=t=>{var o,r,s;const e=(o=t.state.field(ba))==null?void 0:o.suggestion;if(!e)return!1;const n=t.state.facet(hd);return t.dispatch({effects:ya.of({text:null,doc:t.state.doc})}),(s=(r=n.events)==null?void 0:r.onSuggestionRejected)==null||s.call(r,t,e),!0},XS=In.of([{key:"Tab",run:t=>{var o,r,s;const e=(o=t.state.field(ba))==null?void 0:o.suggestion;if(!e)return!1;const n=t.state.facet(hd);return t.dispatch({...KS(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:fg}]),hd=pr.define({combine:t=>t.at(-1)});function mg(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[ba,hd.of(t),GS(o,t),YS,n?XS:[]]}const JS=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 ZS(t){var r,s;const e=t.state.facet(Is),n={...ga,...e.keymaps},o=Yt("div","cm-ai-tooltip").appendChild(Yt("div","cm-ai-tooltip-button"));return o.innerHTML=`<span>Edit <span class="hotkey">${ud(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(),dg(t)}),o}const fd=pr.define({combine:t=>Kl(t,{render:ZS,hideOnBlur:!1})}),QS=Fn.fromClass((c3=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)});m3(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(fd);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(tr).show)return void(this.dom.style.display="none");if(t.state.facet(fd).hideOnBlur&&!t.hasFocus)return this.dom.style.display="none",void this.dom.setAttribute("aria-hidden","true");t.requestMeasure({read:f3(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,c3)),ej=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 tj extends ls{constructor(n){super();Z(this,"oldCode");this.oldCode=n}toDOM(n){const o=Yt("div","cm-old-code-container");o.setAttribute("role","region"),o.setAttribute("aria-label","Previous code version");const r=Yt("div","cm-old-code cm-line");r.textContent=this.oldCode;const s=Yt("div","cm-floating-buttons"),i=n.state.facet(Is),a={...ga,...i.keymaps},l=Yt("button","cm-floating-button cm-floating-accept");l.innerHTML=`<span class="hotkey">${ud(a.acceptEdit)}</span> Accept`,l.setAttribute("aria-label","Accept changes"),l.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),n.focus(),ug(n)});const c=Yt("button","cm-floating-button cm-floating-reject");return c.innerHTML=`<span class="hotkey">${ud(a.rejectEdit)}</span> Reject`,c.setAttribute("aria-label","Reject changes"),c.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),n.focus(),hg(n)}),s.append(l,c),o.append(r,s),o}updateDOM(n,o){return!0}}class nj extends ls{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:[er.of({show:!1,lineFrom:0,lineTo:0}),Er.of(!1)]}),n.focus())});Z(this,"handleSubmit",async n=>{var x;const o=this.view;if(!o)return;const r=o.state.facet(Is);n==null||n.stopPropagation();const s=o.state.field(tr),{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:Er.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(tr).show)return;if(!p||typeof p!="string")throw new Error("Invalid completion result");o.dispatch({changes:{from:d,to:h,insert:p},effects:[er.of({show:!1,lineFrom:0,lineTo:0}),xa.of({from:d,to:d+p.length,oldCode:f,newCode:p}),Er.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(lg),r=n.state.field(cg),s=Yt("div","cm-ai-input-container");this.inputContainer=s,this.dom=s;const i=Yt("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=Yt("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=Yt("div","cm-ai-loading-container");this.loadingContainer=l;const c=Yt("div","cm-ai-loading-indicator");c.setAttribute("role","status"),c.setAttribute("aria-live","polite"),c.textContent="Generating";const d=Yt("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=Yt("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=Yt("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:Ts.of(!1)})}),g(a.value),a.addEventListener("input",function(){n.dispatch({effects:As.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 oj(t){if(!t.prompt)throw new Error("prompt function is required");const e={...ga,...t.keymaps};return[Is.of(t),tr,lg,Ms,cg,[QS,ej],JS,In.of([{key:e.showInput,run:dg}]),No.highest([In.of([{key:e.acceptEdit,run:ug},{key:e.rejectEdit,run:hg}])]),rj,sj,ij,aj]}const rj=We.updateListener.of(t=>{const e=t.state.field(tr);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:[er.of({show:!0,lineFrom:n,lineTo:o})]})}),sj=We.decorations.of(t=>{const e=t.state.field(Ms);return e?nt.set([nt.mark({class:"cm-new-code-line"}).range(e.from,e.to)]):nt.none}),ij=We.decorations.compute([tr],t=>{const e=t.field(tr),n=t.facet(Is),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(nt.line({class:"cm-ai-selection"}).range(a)),i===r&&o.push(nt.widget({widget:new nj(n.prompt),side:-1}).range(a))}}return nt.set(o)}),aj=bn.define({create:t=>nt.none,update(t,e){const n=e.state.field(Ms);return n?nt.set([nt.widget({widget:new tj(n.oldCode),block:!0}).range(n.from)]):nt.none},provide:t=>We.decorations.from(t)}),va="https://static.marimo.app",lj=t=>{const e=H.c(25),{onClose:n}=t,[o,r]=M.useState(""),{exportAsHTML:s}=ot();let i;i=Math.random().toString(36).slice(2,6);const a=`${o}-${i}`,l=`${va}/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 S=await s({download:!1,includeCode:!0,files:yS.INSTANCE.filenames()}),C=Je({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${va}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:S,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:zn.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(cs,{children:[d,u.jsxs(ds,{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:va,target:"_blank",children:va}),"."]})]}),e[5]=h):h=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(f=w=>{const S=w.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(S)},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(cj,{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},cj=t=>{const e=H.c(8),[n,o]=q.useState(!1);let r;e[0]!==t.text?(r=Bn.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 pg(){const t=H.c(2),e=Ct(dm);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:WO(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 md(t){const e=H.c(3),n=Os();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],Le(o)}function gg(){const t=H.c(2),e=Os();let n;return t[0]!==e?(n=()=>e(b3(yn())),t[0]=e,t[1]=n):n=t[1],Le(n)}function Os(){const t=H.c(3),{prepareForRun:e}=lt(),{sendRun:n}=ot();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}=yn(),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?(y3(f)!=="markdown"&&um(f),m=v3(f)):m=((c=i[d])==null?void 0:c.code)||"",a.push(m),e({cellId:d})}await n({cellIds:r,codes:a}).catch(dj)},t[0]=e,t[1]=n,t[2]=o):o=t[2],Le(o)}function dj(t){ct.error(t)}const pd=[{type:"files",Icon:Ip,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:Xl,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:js,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:ld,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:Jl,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:cd,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:hm,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:dF,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:Zp,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:Dp,tooltip:"Secrets",hidden:tn(),position:"sidebar"},{type:"scratchpad",Icon:GO,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:Di,tooltip:"View errors",position:"footer"}];function uj(){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 YO(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 xg(t){return t.dropdown!==void 0}function wa(t,e=""){return t.flatMap(n=>n.label?xg(n)?wa(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const Ds=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},Rs=St(null),hj=fm("marimo:ai:includeOtherCells",!0),gd=fm("marimo:ai:chatState:v4",{chats:new Map,activeChatId:null},(xd={toSerializable:t=>({chats:[...t.chats.entries()],activeChatId:t.activeChatId}),fromSerializable:t=>({chats:new Map(t.chats),activeChatId:t.activeChatId})},{getItem(t,e){try{const n=localStorage.getItem(t);if(!n)return e;const o=JSON.parse(n);return xd.fromSerializable(o)}catch(n){return ct.warn(`Error getting ${t} from storage`,n),e}},setItem:(t,e)=>{localStorage.setItem(t,JSON.stringify(xd.toSerializable(e)))},removeItem:t=>{localStorage.removeItem(t)}}));var xd;const fj=St(t=>{const e=t(gd);return e.activeChatId?e.chats.get(e.activeChatId):null},(t,e,n)=>{e(gd,o=>({...o,activeChatId:n}))});function bg(t){return t!==C3&&!!(t&&t.trim().length>0)}const ka=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],Zl(window,"keydown",n,o);const r=t.children??"Undo";let s,i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx(KO,{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 Ps(){const t=H.c(4),{deleteCell:e,undoDeleteCell:n}=lt(),{sendDeleteCell:o}=ot();let r;return t[0]!==e||t[1]!==o||t[2]!==n?(r=s=>{var c;if(Qe.get(Ql))return;const{cellId:i}=s,a=Qe.get(An),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(ka,{"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],Le(r)}function Ls(){const t=H.c(4),{deleteCell:e,undoDeleteCell:n}=lt(),{sendDeleteCell:o}=ot();let r;return t[0]!==e||t[1]!==o||t[2]!==n?(r=async s=>{if(Qe.get(Ql))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(ka,{"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],Le(r)}function yg(){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=v3(s);e(r);const{dismiss:a}=Je({title:"Cell split",action:u.jsx(ka,{"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],Le(o)}function bd(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=yg(),f=md(n==null?void 0:n.cellId),m=!Ne(Ql),g=Ps(),{openModal:x}=Tn(),p=Ct(Rs),b=Ne(ec),y=Ne(tc),v=Ne(us),w=Ne(XO),{saveCellConfig:S}=ot();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:j,name:_,hasOutput:O,hasConsoleOutput:A,status:R}=n;let P;e[1]!==C||e[2]!==N.disabled||e[3]!==S||e[4]!==r?(P=async()=>{const U={disabled:!N.disabled};await S({configs:{[C]:U}}),r({cellId:C,config:U})},e[1]=C,e[2]=N.disabled,e[3]=S,e[4]=r,e[5]=P):P=e[5];const T=P;let D;e[6]!==C||e[7]!==N.hide_code||e[8]!==j||e[9]!==S||e[10]!==r?(D=async()=>{const U={hide_code:!N.hide_code};await S({configs:{[C]:U}}),r({cellId:C,config:U});const V=j();V&&(U.hide_code?V.contentDOM.blur():V.focus())},e[6]=C,e[7]=N.hide_code,e[8]=j,e[9]=S,e[10]=r,e[11]=D):D=e[11];const L=D;let z,E,k,B,I;return e[12]===Symbol.for("react.memo_cache_sentinel")?(z=u.jsx(rg,{size:13,strokeWidth:1.5}),e[12]=z):z=e[12],e[13]!==C||e[14]!==_||e[15]!==x||e[16]!==s?(E=()=>{x(u.jsxs(Go,{children:[u.jsx(cs,{children:u.jsx(Wo,{children:"Rename cell"})}),u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx(xr,{htmlFor:"cell-name",children:"Cell name"}),u.jsx(vS,{placeholder:"cell name",value:_,onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),U.stopPropagation(),x(null))},onChange:U=>s({cellId:C,name:U})})]})]}))},e[13]=C,e[14]=_,e[15]=x,e[16]=s,e[17]=E):E=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[22]!==k?(B=u.jsx(vS,{placeholder:"cell name",value:_,onChange:k}),e[21]=_,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]!==j||e[36]!==A||e[37]!==O||e[38]!==i||e[39]!==_||e[40]!==f||e[41]!==l||e[42]!==a||e[43]!==p||e[44]!==h||e[45]!==R||e[46]!==E||e[47]!==B||e[48]!==T||e[49]!==L?(I=[[{icon:z,label:"Name",disableClick:!0,handle:xj,handleHeadless:E,rightElement:B},{icon:u.jsx(jr,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:R==="running"||R==="queued"||R==="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(up,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!O,handle:()=>function(U){const V=document.getElementById(w3.create(U));V&&(V.classList.add("printing-output"),k3(V,"result.png").finally(()=>{V.classList.remove("printing-output")}))}(C)},{icon:u.jsx(j3,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const U=j();U&&S3({[C]:U})}},{icon:N.hide_code?u.jsx(mm,{size:13,strokeWidth:1.5}):u.jsx(pm,{size:13,strokeWidth:1.5}),label:N.hide_code?"Show code":"Hide code",handle:L,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(gm,{"data-testid":"cell-disable-switch",checked:!N.disabled,size:"sm",onCheckedChange:T}),handle:T},{icon:u.jsx(Di,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(O||A),handle:()=>{d({cellId:C})}}],[{icon:u.jsx(nc,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const U=j();U&&(Zn({autoInstantiate:y,createNewCell:o}),gr(U,{language:"markdown",keepCodeAsIs:!1}))}},{icon:u.jsx(Yo,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const U=j();U&&(Zn({autoInstantiate:y,createNewCell:o}),gr(U,{language:"sql",keepCodeAsIs:!1}))}},{icon:u.jsx(oc,{}),label:"Toggle as Python",handle:()=>{const U=j();U&&(Zn({autoInstantiate:y,createNewCell:o}),JO(U,"python",{force:!0}))}}],[{icon:u.jsxs(Ds,{children:[u.jsx(ca,{size:13,strokeWidth:1.5}),u.jsx(rc,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:C,before:!0})},{icon:u.jsxs(Ds,{children:[u.jsx(ca,{size:13,strokeWidth:1.5}),u.jsx(Eo,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:C,before:!1})},{icon:u.jsx(rc,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>i({cellId:C,before:!0})},{icon:u.jsx(Eo,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>i({cellId:C,before:!1})},{icon:u.jsx(N3,{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(ZO,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:w!=="columns",handle:()=>c({cellId:C})}],[{icon:u.jsx(mS,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!bg(_),tooltip:bg(_)?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()}(_)),Je({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!m,variant:"danger",icon:u.jsx(sc,{size:13,strokeWidth:1.5}),handle:()=>{g({cellId:C})}}]].map(pj).filter(mj),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]=j,e[36]=A,e[37]=O,e[38]=i,e[39]=_,e[40]=f,e[41]=l,e[42]=a,e[43]=p,e[44]=h,e[45]=R,e[46]=E,e[47]=B,e[48]=T,e[49]=L,e[50]=I):I=e[50],I}function mj(t){return t.length>0}function pj(t){return t.filter(gj)}function gj(t){return!t.hidden}function xj(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function bj(t){return!t.hidden}const yd=St(!1),vg=()=>{const t=H.c(37),[e,n]=zt(yd),o=QO(),r=Ne(eD),s=Ne(Fi);let i;t[0]!==r?(i={cell:r},t[0]=r,t[1]=i):i=t[1];let a=bd(i).flat();a=wa(a);const l=function(){const E=H.c(75),[k,B]=br(),[I,U]=E3(),{saveAppConfig:V,saveUserConfig:X}=ot();let Y;E[0]!==X||E[1]!==B?(Y=async oe=>{await X({config:oe}).then(()=>{B(oe)})},E[0]=X,E[1]=B,E[2]=Y):Y=E[2];const G=Y;let W;E[3]!==V||E[4]!==U?(W=async oe=>{await V({config:oe}).then(()=>{U(oe)})},E[3]=V,E[4]=U,E[5]=W):W=E[5];const J=W;let $;if(E[6]!==I||E[7]!==k||E[8]!==J||E[9]!==G){let oe,ne,ie,se,ae;E[11]!==I?(oe=He=>He!==I.width,E[11]=I,E[12]=oe):oe=E[12],E[13]!==I||E[14]!==J?(ne=He=>({label:`App config > Set width=${He}`,handle:()=>{J({...I,width:He})}}),E[13]=I,E[14]=J,E[15]=ne):ne=E[15],E[16]!==k||E[17]!==G?(ie={label:"Config > Set theme: dark",handle:()=>{G({...k,display:{...k.display,theme:"dark"}})}},E[16]=k,E[17]=G,E[18]=ie):ie=E[18],E[19]!==k||E[20]!==G?(se={label:"Config > Set theme: light",handle:()=>{G({...k,display:{...k.display,theme:"light"}})}},E[19]=k,E[20]=G,E[21]=se):se=E[21],E[22]!==k||E[23]!==G?(ae={label:"Config > Set theme: system",handle:()=>{G({...k,display:{...k.display,theme:"system"}})}},E[22]=k,E[23]=G,E[24]=ae):ae=E[24];const fe=k.keymap.preset==="vim";let re,ue;E[25]!==k||E[26]!==G?(re=()=>{G({...k,keymap:{...k.keymap,preset:"vim"}})},E[25]=k,E[26]=G,E[27]=re):re=E[27],E[28]!==fe||E[29]!==re?(ue={label:"Config > Switch keymap to VIM",hidden:fe,handle:re},E[28]=fe,E[29]=re,E[30]=ue):ue=E[30];const le=k.keymap.preset==="default";let Se,je,Fe;E[31]!==k||E[32]!==G?(Se=()=>{G({...k,keymap:{...k.keymap,preset:"default"}})},E[31]=k,E[32]=G,E[33]=Se):Se=E[33],E[34]!==le||E[35]!==Se?(je={label:"Config > Switch keymap to default (current: VIM)",hidden:le,handle:Se},E[34]=le,E[35]=Se,E[36]=je):je=E[36],E[37]!==k||E[38]!==G?(Fe=()=>{G({...k,completion:{...k.completion,copilot:!1}})},E[37]=k,E[38]=G,E[39]=Fe):Fe=E[39];const Ie=k.completion.copilot!=="github";let ke,Ye;E[40]!==Fe||E[41]!==Ie?(ke={label:"Config > Disable GitHub Copilot",handle:Fe,hidden:Ie},E[40]=Fe,E[41]=Ie,E[42]=ke):ke=E[42],E[43]!==k||E[44]!==G?(Ye=()=>{G({...k,completion:{...k.completion,copilot:"github"}})},E[43]=k,E[44]=G,E[45]=Ye):Ye=E[45];const Ve=k.completion.copilot==="github";let Ke;E[46]!==Ye||E[47]!==Ve?(Ke={label:"Config > Enable GitHub Copilot",handle:Ye,hidden:Ve},E[46]=Ye,E[47]=Ve,E[48]=Ke):Ke=E[48];const ee=!k.display.reference_highlighting;let ye,we,Ae,K;E[49]!==k||E[50]!==G?(ye=()=>{G({...k,display:{...k.display,reference_highlighting:!1}})},E[49]=k,E[50]=G,E[51]=ye):ye=E[51],E[52]!==ee||E[53]!==ye?(we={label:"Config > Disable reference highlighting",hidden:ee,handle:ye},E[52]=ee,E[53]=ye,E[54]=we):we=E[54],E[55]!==k||E[56]!==G?(Ae=()=>{G({...k,display:{...k.display,reference_highlighting:!0}})},E[55]=k,E[56]=G,E[57]=Ae):Ae=E[57],E[58]!==k.display.reference_highlighting||E[59]!==Ae?(K={label:"Config > Enable reference highlighting",hidden:k.display.reference_highlighting,handle:Ae},E[58]=k.display.reference_highlighting,E[59]=Ae,E[60]=K):K=E[60];const pe=k.display.cell_output==="above";let ge,he;E[61]!==k||E[62]!==G?(ge=()=>{G({...k,display:{...k.display,cell_output:"above"}})},E[61]=k,E[62]=G,E[63]=ge):ge=E[63],E[64]!==pe||E[65]!==ge?(he={label:"Config > Set cell output area: above",hidden:pe,handle:ge},E[64]=pe,E[65]=ge,E[66]=he):he=E[66];const Ce=k.display.cell_output==="below";let Re,Pe;E[67]!==k||E[68]!==G?(Re=()=>{G({...k,display:{...k.display,cell_output:"below"}})},E[67]=k,E[68]=G,E[69]=Re):Re=E[69],E[70]!==Ce||E[71]!==Re?(Pe={label:"Config > Set cell output area: below",hidden:Ce,handle:Re},E[70]=Ce,E[71]=Re,E[72]=Pe):Pe=E[72],$=[...uF().filter(oe).map(ne),ie,se,ae,ue,je,ke,Ke,we,K,he,Pe],E[6]=I,E[7]=k,E[8]=J,E[9]=G,E[10]=$}else $=E[10];const Q=$;let te;return E[73]!==Q?(te=Q.filter(bj),E[73]=Q,E[74]=te):te=E[74],te}();let c=Xg();c=[...wa(c),...wa(l)];const d=c.filter(yj),h=ic.keyBy(d,vj),{recentCommands:f,addRecentCommand:m}=uj();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=E=>{ac(s.getHotkey("global.commandPalette").key)(E)&&(E.preventDefault(),n(wj))},t[4]=s,t[5]=n,t[6]=p):p=t[6],Zl(document,"keydown",p),t[7]!==m||t[8]!==s||t[9]!==o||t[10]!==n?(b=(E,k)=>{const B=o[E];if(!B)return null;const I=s.getHotkey(E);return u.jsxs(Qn,{disabled:k.disabled,onSelect:()=>{m(E),n(!1),requestAnimationFrame(()=>{B()})},value:I.name,children:[u.jsxs("span",{children:[I.name,k.tooltip&&u.jsx("span",{className:"ml-2",children:k.tooltip})]}),u.jsx(I3,{children:u.jsx(ym,{shortcut:I.key})})]},E)},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=E=>{const{label:k,handle:B,props:I,hotkey:U}=E,V=I===void 0?{}:I;return u.jsxs(Qn,{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(I3,{children:u.jsx(ym,{shortcut:s.getHotkey(U).key})})]},k)},t[12]=m,t[13]=s,t[14]=n,t[15]=v):v=t[15];const w=v,S=nD;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=bm;let j;t[17]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx(lc,{children:"No results found."}),t[17]=j):j=t[17];const _=f.length>0&&u.jsxs(u.Fragment,{children:[u.jsx(xm,{heading:"Recently Used",children:f.map(E=>{const k=h[E];return tD(E)?y(E,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip}):k&&!xg(k)?w({label:k.label,handle:k.handleHeadless||k.handle,props:{disabled:k.disabled,tooltip:k.tooltip}}):null})}),u.jsx(_3,{})]}),O=xm,A=s.iterate().map(E=>{if(x.has(E))return null;const k=h[E];return y(E,{disabled:k==null?void 0:k.disabled,tooltip:k==null?void 0:k.tooltip})}),R=d.map(E=>x.has(E.label)?null:w({label:E.label,handle:E.handleHeadless||E.handle,props:{disabled:E.disabled,tooltip:E.tooltip}}));let P;t[18]!==x||t[19]!==w?(P=E=>x.has(E.label)?null:w({label:`Cell > ${E.label}`,handle:E.handleHeadless||E.handle,props:{disabled:E.disabled,tooltip:E.tooltip}}),t[18]=x,t[19]=w,t[20]=P):P=t[20];const T=a.map(P);let D,L,z;return t[21]!==O||t[22]!==R||t[23]!==T||t[24]!==A?(D=u.jsxs(O,{heading:"Commands",children:[A,R,T]}),t[21]=O,t[22]=R,t[23]=T,t[24]=A,t[25]=D):D=t[25],t[26]!==N||t[27]!==D||t[28]!==j||t[29]!==_?(L=u.jsxs(N,{children:[j,_,D]}),t[26]=N,t[27]=D,t[28]=j,t[29]=_,t[30]=L):L=t[30],t[31]!==S||t[32]!==e||t[33]!==n||t[34]!==L||t[35]!==C?(z=u.jsxs(S,{open:e,onOpenChange:n,children:[C,L]}),t[31]=S,t[32]=e,t[33]=n,t[34]=L,t[35]=C,t[36]=z):z=t[36],z};function yj(t){return!t.hotkey}function vj(t){return t.label}function wj(t){return!t}function nr(){return at().optional().describe(ze.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function wg(){return at().optional().describe(ze.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function Ca(){return at().optional().describe(ze.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function kg(){return at().optional().describe(ze.of({label:"URI",optionRegex:".*uri.*"}))}function or(){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 rr(){return at().nonempty().describe(ze.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function sr(t){const e=oD.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 Cg(){return hs().default(!1).describe(ze.of({label:"Read Only"}))}const Sg=ft({type:gt("postgres"),host:or(),port:sr(5432).optional(),database:to(),username:rr(),password:nr(),ssl:hs().default(!1).describe(ze.of({label:"Use SSL"}))}).describe(ze.of({direction:"two-columns"})),jg=ft({type:gt("mysql"),host:or(),port:sr(3306),database:to(),username:rr(),password:nr(),ssl:hs().default(!1).describe(ze.of({label:"Use SSL"}))}).describe(ze.of({direction:"two-columns"})),Ng=ft({type:gt("sqlite"),database:to().describe(ze.of({label:"Database Path"}))}).describe(ze.of({direction:"two-columns"})),Eg=ft({type:gt("duckdb"),database:to().describe(ze.of({label:"Database Path"})),read_only:Cg()}).describe(ze.of({direction:"two-columns"})),_g=ft({type:gt("motherduck"),database:to().default("my_db").describe(ze.of({label:"Database Name"})),token:wg()}).describe(ze.of({direction:"two-columns"})),Ig=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:rr(),password:nr(),role:at().optional().describe(ze.of({label:"Role"}))}).describe(ze.of({direction:"two-columns"})),Ag=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"})),Tg=ft({type:gt("clickhouse_connect"),host:or(),port:sr(8123).optional(),username:rr(),password:nr(),secure:hs().default(!1).describe(ze.of({label:"Use HTTPs"}))}).describe(ze.of({direction:"two-columns"})),Mg=ft({type:gt("timeplus"),host:or().default("localhost"),port:sr(8123).optional(),username:rr().default("default"),password:nr().default("")}).describe(ze.of({direction:"two-columns"})),Og=ft({type:gt("chdb"),database:to().describe(ze.of({label:"Database Path"})),read_only:Cg()}).describe(ze.of({direction:"two-columns"})),Dg=ft({type:gt("trino"),host:or(),port:sr(8080),database:to(),schema:at().describe(ze.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:rr(),password:nr(),async_support:hs().default(!1).describe(ze.of({label:"Async Support"}))}).describe(ze.of({direction:"two-columns"})),Rg=ft({type:gt("iceberg"),name:at().describe(ze.of({label:"Catalog Name"})),catalog:vm("type",[ft({type:gt("REST"),warehouse:Ca(),uri:at().optional().describe(ze.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:wg()}),ft({type:gt("SQL"),warehouse:Ca(),uri:at().optional().describe(ze.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),ft({type:gt("Hive"),warehouse:Ca(),uri:kg()}),ft({type:gt("Glue"),warehouse:Ca(),uri:kg()}),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"}))}),Pg=ft({type:gt("datafusion"),sessionContext:hs().optional().describe(ze.of({label:"Use Session Context"}))}),Lg=ft({type:gt("pyspark"),host:or().optional(),port:sr().optional()}),Fg=ft({type:gt("redshift"),host:or(),port:sr(5439),connectionType:vm("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:rr(),password:nr()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:to()}).describe(ze.of({direction:"two-columns"})),kj=vm("type",[Sg,jg,Ng,Eg,_g,Ig,Ag,Tg,Mg,Og,Dg,Rg,Pg,Lg,Fg]),vd="env:";function Sa(t){return typeof t=="string"&&t.startsWith(vd)}function wd(t){return`${vd}${t}`}const zg={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class Kt{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 Cj{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),Sa(n)){const r=n.replace(vd,""),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"?_r(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return _r(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 Sa(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(`
|
4
4
|
`)}}class Sj extends Kt{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(`
|
5
5
|
DATABASE_URL = f"postgresql://${o}:${n}@${r}:${s}/${i}"
|
@@ -159,5 +159,5 @@ ${m}
|
|
159
159
|
`)}),includeOtherCode:Tc("")}),onFinish:P=>{e(T=>Xu(T,T.activeChatId,P.id,"assistant",P.content,P.parts))},onToolCall:async({toolCall:P})=>{try{const T=await h({toolName:P.toolName,arguments:P.args});return T.result||T.error}catch(T){return ct.error("Tool call failed:",T),`Error: ${T instanceof Error?T.message:String(T)}`}},onError:P=>{ct.error("An error occurred:",P)},onResponse:P=>{ct.debug("Received HTTP response from server:",P)}}),C=v==="submitted"||v==="streaming";M.useEffect(()=>{if(!t.activeChatId||f.length===0||C)return;const P=f[f.length-1];if((P==null?void 0:P.role)!=="user")return;const T=t.chats.get(t.activeChatId);if(!T)return;const D=new Set(T.messages.map(z=>z.id)),L=f.filter(z=>z.role==="user"&&!D.has(z.id));L.length>0&&e(z=>{let E=z;for(const k of L)E=Xu(E,z.activeChatId,k.id,"user",k.content);return E})},[f,t.activeChatId,t.chats,e,C]);const N=C&&f.length>0&&function(P){if(P.length===0)return!1;const T=P.at(-1);if(!T||T.role!=="assistant"||!T.parts)return!1;const D=T.parts;return D.length===0?!1:D[D.length-1].type==="reasoning"}(f);M.useEffect(()=>{requestAnimationFrame(()=>{if(l.current){const P=l.current;P.scrollTop=P.scrollHeight}})},[t.activeChatId]);const j=Le(()=>{o(null),g(""),s("")}),_=Le((P,T)=>{x(L=>L.slice(0,P));const D=t.activeChatId;D&&e(L=>{const z=new Map(L.chats),E=t.chats.get(D);return E&&z.set(E.id,{...E,messages:E.messages.slice(0,P),updatedAt:Date.now()}),{...L,chats:z}}),p({role:"user",content:T})}),O=Le((P,T)=>{var D;T.trim()&&((D=a.current)!=null&&D.view&&Jm(a.current.view),b(P))}),A=Le(()=>{var P;r.trim()&&((P=i.current)!=null&&P.view&&Jm(i.current.view),(T=>{const D=Date.now(),L={id:GC(),title:T.length>50?`${T.slice(0,50)}...`:T,messages:[],createdAt:D,updatedAt:D};e(z=>{const E=new Map(z.chats);return E.set(L.id,L),{...z,chats:E,activeChatId:L.id}}),p({id:GC(),role:"user",content:T}),g("")})(r.trim()))}),R=M.useMemo(()=>[...t.chats.values()].sort((P,T)=>T.updatedAt-P.updatedAt),[t.chats]);return u.jsxs("div",{className:"flex flex-col h-[calc(100%-53px)]",children:[u.jsx(Zm,{children:u.jsx(lT,{onNewChat:j,activeChatId:n==null?void 0:n.id,setActiveChat:o,chats:R})}),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,{inputRef:i,value:r,placeholder:"Ask anything, @ to include context about tables or dataframes",onClose:()=>{var P,T;return(T=(P=i.current)==null?void 0:P.editor)==null?void 0:T.blur()},onChange:s,onSubmit:A},"new-thread-input")}),u.jsx(zh,{isEmpty:!r.trim(),onSendClick:A,isLoading:C,onStop:S})]}),f.map((P,T)=>u.jsx(Zv,{message:P,index:T,onEdit:_,setChatState:e,chatState:t,isStreamingReasoning:N,isLast:T===f.length-1},P.id)),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:S,children:"Stop"})}),f&&f.length>0&&u.jsx(Qv,{input:m,setInput:g,onSubmit:O,inputRef:a,isLoading:C,onStop:S})]})};function uT(){}function hT(){}function fT(t){return u.jsx(hc,{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:mT}=q,{useSyncExternalStoreWithSelector:pT}=fL,gT=t=>t;function e2(t,e=gT,n){const o=pT(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return mT(o),o}const t2=(t,e)=>{const n=mL(t),o=(r,s=e)=>e2(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 xT={passive:!1},yi={capture:!0,passive:!1};function Bh(t){t.stopImmediatePropagation()}function Kr(t){t.preventDefault(),t.stopImmediatePropagation()}function n2(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 o2(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 Uh(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 bT(t){return!t.ctrlKey&&!t.button}function yT(){return this.parentNode}function vT(t,e){return e??{x:t.x,y:t.y}}function wT(){return navigator.maxTouchPoints||"ontouchstart"in this}Uh.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};const Dl=t=>()=>t;function kT(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 $h(t){t.stopImmediatePropagation()}function vi(t){t.preventDefault(),t.stopImmediatePropagation()}function CT(t){return!(t.ctrlKey&&t.type!=="wheel"||t.button)}function ST(){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 r2(){return this.__zoom||Qo}function jT(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function NT(){return navigator.maxTouchPoints||"ontouchstart"in this}function ET(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),_T=Rl.Provider,IT=t=>`Node type "${t}" not found. Using fallback type "default".`,AT=()=>"The React Flow parent container needs a width and a height to render the graph.",TT=()=>"Only child nodes can use a parent extent.",MT=t=>`Marker type "${t}" doesn't exist.`,OT=(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,DT=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",RT=t=>`Edge type "${t}" not found. Using fallback type "default".`,PT=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.`,s2="[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001";function ut(t,e){const n=M.useContext(Rl);if(n===null)throw new Error(s2);return e2(n,t,e)}const Ft=()=>{const t=M.useContext(Rl);if(t===null)throw new Error(s2);return M.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},LT=t=>t.userSelectionActive?"none":"all";function Pl({position:t,children:e,className:n,style:o,...r}){const s=ut(LT),i=`${t}`.split("-");return q.createElement("div",{className:Qt(["react-flow__panel",n,...i]),style:{...o,pointerEvents:s},...r},e)}function FT({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 zT=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 Vh=t=>({width:t.offsetWidth,height:t.offsetHeight}),Xr=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Hh=(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])}),i2=(t,e,n)=>t<e?Xr(Math.abs(t-e),1,50)/50:t>n?-Xr(Math.abs(t-n),1,50)/50:0,a2=(t,e)=>[20*i2(t.x,35,e.width-35),20*i2(t.y,35,e.height-35)],l2=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},Wh=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),c2=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),qh=(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"),d2=["Enter"," ","Escape"];function Gh(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 u2=t=>"clientX"in t,zo=(t,e)=>{var s,i;const n=u2(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(zT,{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 h2({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 f2({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,m2,Bo,Yh,Ci,p2,Uo,Si,Jr,g2,Oe,Fl;function x2({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 b2({sourceX:t,sourceY:e,sourcePosition:n=Oe.Bottom,targetX:o,targetY:r,targetPosition:s=Oe.Top}){const[i,a]=x2({pos:n,x1:t,y1:e,x2:o,y2:r}),[l,c]=x2({pos:s,x1:o,y1:r,x2:t,y2:e}),[d,h,f,m]=f2({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",(m2=hr||(hr={})).Strict="strict",m2.Loose="loose",(Yh=Bo||(Bo={})).Free="free",Yh.Vertical="vertical",Yh.Horizontal="horizontal",(p2=Ci||(Ci={})).Partial="partial",p2.Full="full",(Si=Uo||(Uo={})).Bezier="default",Si.Straight="straight",Si.Step="step",Si.SmoothStep="smoothstep",Si.SimpleBezier="simplebezier",(g2=Jr||(Jr={})).Arrow="arrow",g2.ArrowClosed="arrowclosed",(Fl=Oe||(Oe={})).Left="left",Fl.Top="top",Fl.Right="right",Fl.Bottom="bottom";const Kh=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]=b2({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})});Kh.displayName="SimpleBezierEdge";const y2={[Oe.Left]:{x:-1,y:0},[Oe.Right]:{x:1,y:0},[Oe.Top]:{x:0,y:-1},[Oe.Bottom]:{x:0,y:1}},v2=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function BT({source:t,sourcePosition:e=Oe.Bottom,target:n,targetPosition:o=Oe.Top,center:r,offset:s}){const i=y2[e],a=y2[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:j})=>N===Oe.Left||N===Oe.Right?C.x<j.x?{x:1,y:0}:{x:-1,y:0}:C.y<j.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,S]=h2({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 O=Math.abs(t[h]-n[h]);if(O<=s){const A=Math.min(s-1,s-O);i[h]===f?p[h]=(l[h]>t[h]?-1:1)*A:b[h]=(c[h]>n[h]?-1:1)*A}}if(e!==o){const O=h==="x"?"y":"x",A=i[h]===a[O],R=l[O]>c[O],P=l[O]<c[O];(i[h]===1&&(!A&&R||A&&P)||i[h]!==1&&(!A&&P||A&&R))&&(x=h==="x"?C:N)}const j={x:l.x+p.x,y:l.y+p.y},_={x:c.x+b.x,y:c.y+b.y};Math.max(Math.abs(j.x-x[0].x),Math.abs(_.x-x[0].x))>=Math.max(Math.abs(j.y-x[0].y),Math.abs(_.y-x[0].y))?(m=(j.x+_.x)/2,g=x[0].y):(m=x[0].x,g=(j.y+_.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,S]}function Xh({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]=BT({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,S,C){const N=Math.min(v2(v,w)/2,v2(w,S)/2,C),{x:j,y:_}=w;if(v.x===j&&j===S.x||v.y===_&&_===S.y)return`L${j} ${_}`;if(v.y===_)return`L ${j+N*(v.x<S.x?-1:1)},${_}Q ${j},${_} ${j},${_+N*(v.y<S.y?1:-1)}`;const O=v.x<S.x?1:-1;return`L ${j},${_+N*(v.y<S.y?-1:1)}Q ${j},${_} ${j+N*O},${_}`}(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]=Xh({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 Jh=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])})});Jh.displayName="StepEdge";const Zh=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[S,C,N,j]=h2({sourceX:b,sourceY:y,targetX:v,targetY:w});return[`M ${b},${y}L ${v},${w}`,S,C,N,j]}({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 w2({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 k2({sourceX:t,sourceY:e,sourcePosition:n=Oe.Bottom,targetX:o,targetY:r,targetPosition:s=Oe.Top,curvature:i=.25}){const[a,l]=w2({pos:n,x1:t,y1:e,x2:o,y2:r,c:i}),[c,d]=w2({pos:s,x1:o,y1:r,x2:t,y2:e,c:i}),[h,f,m,g]=f2({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]}Zh.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]=k2({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 Qh=M.createContext(null),UT=Qh.Provider;Qh.Consumer;const $T=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`reactflow__edge-${t}${e||""}-${n}${o||""}`,ef=(t,e)=>t===void 0?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`,tf=({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},C2=({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}},nf=(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=Wh({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)},S2=(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=qh(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},j2=(t,e)=>{const n=t.map(o=>o.id);return e.filter(o=>n.includes(o.source)||n.includes(o.target))},N2=(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 E2(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 VT={source:null,target:null,sourceHandle:null,targetHandle:null},_2=()=>({handleDomNode:null,isValid:!1,connection:VT,endHandle:null});function I2(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={..._2(),handleDomNode:l};if(l){const d=of(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 of(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function rf(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function HT(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function A2({event:t,handleId:e,nodeId:n,onConnect:o,isTarget:r,getState:s,setState:i,isValidConnection:a,edgeUpdaterType:l,onReconnectEnd:c}){const d=l2(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:S,y:C}=zo(t),N=d==null?void 0:d.elementFromPoint(S,C),j=of(l,N),_=f==null?void 0:f.getBoundingClientRect();if(!_||!j)return;let O,A=zo(t,_),R=!1,P=null,T=!1,D=null;const L=function({nodes:B,nodeId:I,handleId:U,handleType:V}){return B.reduce((X,Y)=>{if(Y[yt]){const{handleBounds:G}=Y[yt];let W=[],J=[];G&&(W=E2(Y,G,"source",`${I}-${U}-${V}`),J=E2(Y,G,"target",`${I}-${U}-${V}`)),X.push(...W,...J)}return X},[])}({nodes:b(),nodeId:n,handleId:e,handleType:j}),z=()=>{if(!m)return;const[B,I]=a2(A,_);p({x:B,y:I}),w=requestAnimationFrame(z)};function E(B){const{transform:I}=s();A=zo(B,_);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=of(void 0,oe),ue=oe.getAttribute("data-handleid"),le=$({nodeId:fe,id:ue,type:re});if(le){const Se=J.find(je=>je.nodeId===fe&&je.type===re&&je.id===ue);return{handle:{id:ue,type:re,nodeId:fe,x:(Se==null?void 0:Se.x)||G.x,y:(Se==null?void 0:Se.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:_2()};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,tf(A,I,!1,[1,1]),g,L,X=>I2(X,h,n,e,r?"target":"source",a,d));if(v=U,R||(z(),R=!0),D=V.handleDomNode,P=V.connection,T=V.isValid,i({connectionPosition:v&&T?C2({x:v.x,y:v.y},I):A,connectionStatus:HT(!!v,T),connectionEndHandle:V.endHandle}),!v&&!T&&!D)return rf(O);P.source!==P.target&&D&&(rf(O),O=D,D.classList.add("connecting","react-flow__handle-connecting"),D.classList.toggle("valid",T),D.classList.toggle("react-flow__handle-valid",T))}function k(B){var I,U;(v||D)&&P&&T&&(o==null||o(P)),(U=(I=s()).onConnectEnd)==null||U.call(I,B),l&&(c==null||c(B)),rf(O),y(),cancelAnimationFrame(w),R=!1,T=!1,P=null,D=null,d.removeEventListener("mousemove",E),d.removeEventListener("mouseup",k),d.removeEventListener("touchmove",E),d.removeEventListener("touchend",k)}i({connectionPosition:A,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:j,connectionStartHandle:{nodeId:n,handleId:e,type:j},connectionEndHandle:null}),x==null||x(t,{nodeId:n,handleId:e,handleType:j}),d.addEventListener("mousemove",E),d.addEventListener("mouseup",k),d.addEventListener("touchmove",E),d.addEventListener("touchend",k)}const T2=()=>!0,WT=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),M2=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 j,_;const g=i||null,x=t==="target",p=Ft(),b=M.useContext(Qh),{connectOnClick:y,noPanClassName:v}=ut(WT,Wt),{connecting:w,clickConnecting:S}=ut(((O,A,R)=>P=>{const{connectionStartHandle:T,connectionEndHandle:D,connectionClickStartHandle:L}=P;return{connecting:(T==null?void 0:T.nodeId)===O&&(T==null?void 0:T.handleId)===A&&(T==null?void 0:T.type)===R||(D==null?void 0:D.nodeId)===O&&(D==null?void 0:D.handleId)===A&&(D==null?void 0:D.type)===R,clickConnecting:(L==null?void 0:L.nodeId)===O&&(L==null?void 0:L.handleId)===A&&(L==null?void 0:L.type)===R}})(b,g,t),Wt);b||((_=(j=p.getState()).onError)==null||_.call(j,"010",DT()));const C=O=>{const{defaultEdgeOptions:A,onConnect:R,hasDefaultEdges:P}=p.getState(),T={...A,...O};if(P){const{edges:D,setEdges:L}=p.getState();L(((z,E)=>{if(!z.source||!z.target)return E;let k;return k=(B=>"id"in B&&"source"in B&&"target"in B)(z)?{...z}:{...z,id:$T(z)},((B,I)=>I.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,E)?E:E.concat(k)})(T,D))}R==null||R(T),a==null||a(T)},N=O=>{if(!b)return;const A=u2(O);r&&(A&&O.button===0||!A)&&A2({event:O,handleId:g,nodeId:b,onConnect:C,isTarget:x,getState:p.getState,setState:p.setState,isValidConnection:n||p.getState().isValidConnection||T2}),A?d==null||d(O):h==null||h(O)};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:S,connectionindicator:o&&(r&&!w||s&&w)}]),onMouseDown:N,onTouchStart:N,onClick:y?O=>{const{onClickConnectStart:A,onClickConnectEnd:R,connectionClickStartHandle:P,connectionMode:T,isValidConnection:D}=p.getState();if(!b||!P&&!r)return;if(!P)return A==null||A(O,{nodeId:b,handleId:g,handleType:t}),void p.setState({connectionClickStartHandle:{nodeId:b,type:t,handleId:g}});const L=l2(O.target),z=n||D||T2,{connection:E,isValid:k}=I2({nodeId:b,id:g,type:t},T,P.nodeId,P.handleId||null,P.type,z,L);k&&C(E),R==null||R(O),p.setState({connectionClickStartHandle:null})}:void 0,ref:m,...f},l)});M2.displayName="Handle";var $o=M.memo(M2);const O2=({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}));O2.displayName="DefaultNode";var sf=M.memo(O2);const D2=({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}));D2.displayName="InputNode";var R2=M.memo(D2);const P2=({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);P2.displayName="OutputNode";var L2=M.memo(P2);const af=()=>null;af.displayName="GroupNode";const qT=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),$l=t=>t.id;function GT(t,e){return Wt(t.selectedNodes.map($l),e.selectedNodes.map($l))&&Wt(t.selectedEdges.map($l),e.selectedEdges.map($l))}const F2=M.memo(({onSelectionChange:t})=>{const e=Ft(),{selectedNodes:n,selectedEdges:o}=ut(qT,GT);return M.useEffect(()=>{const r={nodes:n,edges:o};t==null||t(r),e.getState().onSelectionChange.forEach(s=>s(r))},[n,o,t]),null});F2.displayName="SelectionListener";const YT=t=>!!t.onSelectionChange;function KT({onSelectionChange:t}){const e=ut(YT);return t||e?q.createElement(F2,{onSelectionChange:t}):null}const XT=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 JT=({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:S,snapGrid:C,snapToGrid:N,translateExtent:j,connectOnClick:_,defaultEdgeOptions:O,fitView:A,fitViewOptions:R,onNodesDelete:P,onEdgesDelete:T,onNodeDrag:D,onNodeDragStart:L,onNodeDragStop:z,onSelectionDrag:E,onSelectionDragStart:k,onSelectionDragStop:B,noPanClassName:I,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}=ut(XT,Wt),re=Ft();return M.useEffect(()=>{const ue=o==null?void 0:o.map(le=>({...le,...O}));return oe(n,ue),()=>{fe()}},[]),Ze("defaultEdgeOptions",O,re.setState),Ze("connectionMode",S,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",_,re.setState),Ze("fitViewOnInit",A,re.setState),Ze("fitViewOnInitOptions",R,re.setState),Ze("onNodesDelete",P,re.setState),Ze("onEdgesDelete",T,re.setState),Ze("onNodeDrag",D,re.setState),Ze("onNodeDragStart",L,re.setState),Ze("onNodeDragStop",z,re.setState),Ze("onSelectionDrag",E,re.setState),Ze("onSelectionDragStart",k,re.setState),Ze("onSelectionDragStop",B,re.setState),Ze("noPanClassName",I,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(j,se),Qr(b,ae),null},z2={display:"none"},ZT={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},B2="react-flow__node-desc",U2="react-flow__edge-desc",QT=t=>t.ariaLiveMessage;function eM({rfId:t}){const e=ut(QT);return q.createElement("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:ZT},e)}function tM({rfId:t,disableKeyboardA11y:e}){return q.createElement(q.Fragment,null,q.createElement("div",{id:`${B2}-${t}`,style:z2},"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:`${U2}-${t}`,style:z2},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&q.createElement(eM,{rfId:t}))}var ji=(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)&&Gh(m))return!1;const g=V2(m.code,a);s.current.add(m[g]),$2(i,s.current,!1)&&(m.preventDefault(),o(!0))},h=m=>{if((!r.current||r.current&&!e.actInsideInputWithModifier)&&Gh(m))return!1;const g=V2(m.code,a);$2(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 $2(t,e,n){return t.filter(o=>n||o.length===e.size).some(o=>o.every(r=>e.has(r)))}function V2(t,e){return e.includes(t)?"code":"key"}function H2(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 H2(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 W2(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}=H2(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 lf(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)}),W2(r,n,s),r}function q2(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=nf(m,h),{x:p,y:b,zoom:y}=N2(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 nM(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 oM(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:nM(t,r)}),i==null||i(t)),e!=null&&e.length&&(c&&o({edges:oM(e,s)}),a==null||a(e))}const es=()=>{},rM={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},sM=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection});function Ni(){const t=(()=>{const x=Ft(),{d3Zoom:p,d3Selection:b}=ut(sM,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[S,C,N]=x.getState().transform,j=Qo.translate(v.x??S,v.y??C).scale(v.zoom??N);p.transform(fr(b,w==null?void 0:w.duration),j)},getViewport:()=>{const[v,w,S]=x.getState().transform;return{x:v,y:w,zoom:S}},fitView:v=>q2(x.getState,v),setCenter:(v,w,S)=>{const{width:C,height:N,maxZoom:j}=x.getState(),_=(S==null?void 0:S.zoom)!==void 0?S.zoom:j,O=C/2-v*_,A=N/2-w*_,R=Qo.translate(O,A).scale(_);p.transform(fr(b,S==null?void 0:S.duration),R)},fitBounds:(v,w)=>{const{width:S,height:C,minZoom:N,maxZoom:j}=x.getState(),{x:_,y:O,zoom:A}=N2(v,S,C,N,j,(w==null?void 0:w.padding)??.1),R=Qo.translate(_,O).scale(A);p.transform(fr(b,w==null?void 0:w.duration),R)},project:v=>{const{transform:w,snapToGrid:S,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"),tf(v,w,S,C)},screenToFlowPosition:v=>{const{transform:w,snapToGrid:S,snapGrid:C,domNode:N}=x.getState();if(!N)return v;const{x:j,y:_}=N.getBoundingClientRect(),O={x:v.x-j,y:v.y-_};return tf(O,w,S,C)},flowToScreenPosition:v=>{const{transform:w,domNode:S}=x.getState();if(!S)return v;const{x:C,y:N}=S.getBoundingClientRect(),j=C2(v,w);return{x:j.x+C,y:j.y+N}},viewportInitialized:!0}:rM,[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(),S=typeof x=="function"?x(w):x;if(y)b(S);else if(v){const C=S.length===0?w.map(N=>({type:"remove",id:N.id})):S.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(S=>({type:"remove",id:S.id})):w.map(S=>({item:S,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 S=p.map(C=>({item:C,type:"add"}));w(S)}},[]),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(S=>({item:S,type:"add"})))},[]),d=M.useCallback(()=>{const{getNodes:x,edges:p=[],transform:b}=e.getState(),[y,v,w]=b;return{nodes:x().map(S=>({...S})),edges:p.map(S=>({...S})),viewport:{x:y,y:v,zoom:w}}},[]),h=M.useCallback(({nodes:x,edges:p})=>{const{nodeInternals:b,getNodes:y,edges:v,hasDefaultNodes:w,hasDefaultEdges:S,onNodesDelete:C,onEdgesDelete:N,onNodesChange:j,onEdgesChange:_}=e.getState(),O=(x||[]).map(D=>D.id),A=(p||[]).map(D=>D.id),R=y().reduce((D,L)=>{const z=L.parentNode||L.parentId,E=!O.includes(L.id)&&z&&D.find(k=>k.id===z);return(typeof L.deletable!="boolean"||L.deletable)&&(O.includes(L.id)||E)&&D.push(L),D},[]),P=v.filter(D=>typeof D.deletable!="boolean"||D.deletable),T=P.filter(D=>A.includes(D.id));if(R||T){const D=j2(R,P),L=[...T,...D],z=L.reduce((E,k)=>(E.includes(k.id)||E.push(k.id),E),[]);(S||w)&&(S&&e.setState({edges:v.filter(E=>!z.includes(E.id))}),w&&(R.forEach(E=>{b.delete(E.id)}),e.setState({nodeInternals:new Map(b)}))),z.length>0&&(N==null||N(L),_&&_(z.map(E=>({id:E,type:"remove"})))),R.length>0&&(C==null||C(R),j)&&j(R.map(E=>({id:E.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:c2(y),y,p]},[]),m=M.useCallback((x,p=!0,b)=>{const[y,v,w]=f(x);return y?(b||e.getState().getNodes()).filter(S=>{if(!(w||S.id!==v.id&&S.positionAbsolute))return!1;const C=c2(S),N=qh(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=qh(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 iM={actInsideInputWithModifier:!1},cf={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}`),G2=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),Y2=t=>{const e=t.ctrlKey&&Ll()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},aM=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),lM=({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 S=M.useRef(),C=Ft(),N=M.useRef(!1),j=M.useRef(!1),_=M.useRef(null),O=M.useRef({x:0,y:0,zoom:0}),{d3Zoom:A,d3Selection:R,d3ZoomHandler:P,userSelectionActive:T}=ut(aM,Wt),D=ji(p),L=M.useRef(0),z=M.useRef(!1),E=M.useRef();return function(k){const B=Ft();M.useEffect(()=>{let I;const U=()=>{var X,Y;if(!k.current)return;const V=Vh(k.current);V.height!==0&&V.width!==0||((Y=(X=B.getState()).onError)==null||Y.call(X,"004",AT())),B.setState({width:V.width||500,height:V.height||500})};return U(),window.addEventListener("resize",U),k.current&&(I=new ResizeObserver(()=>U()),I.observe(k.current)),()=>{window.removeEventListener("resize",U),I&&k.current&&I.unobserve(k.current)}},[])}(_),M.useEffect(()=>{if(_.current){const k=_.current.getBoundingClientRect(),B=function(){var Y,G,W,J=CT,$=ST,Q=ET,te=jT,oe=NT,ne=[0,1/0],ie=[[-1/0,-1/0],[1/0,1/0]],se=250,ae=iz,fe=DS("start","zoom","end"),re=0,ue=10;function le(K){K.property("__zoom",r2).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 Se(K,pe){return(pe=Math.max(ne[0],Math.min(ne[1],pe)))===K.k?K:new pp(pe,K.x,K.y)}function je(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 pp(K.k,he,Ce)}function Fe(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?Fe(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 pp(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)],gp(this),ge.start()}vi(K),ge.wheel=setTimeout(function(){ge.wheel=null,ge.end()},150),ge.zoom("mouse",Q(je(Se(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(je(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),o2(ce.view,he.moved),vi(ce),he.event(ce).end()},!0),Re=Kn(K,ge),Pe=K.clientX,He=K.clientY;n2(K.view),$h(K),he.mouse=[Re,this.__zoom.invert(Re)],gp(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(je(Se(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($h(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)),gp(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=Se(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(je(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($h(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",r2),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?Fe(Ce):typeof ge=="function"?ge.apply(this,arguments):ge,He=Re.invert(Pe),ce=typeof pe=="function"?pe.apply(this,arguments):pe;return Q(je(Se(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?Fe(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 kT(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),I=Vn(_.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(I,X),B.wheelDelta(Y2),C.setState({d3Zoom:B,d3Selection:I,d3ZoomHandler:I.on("wheel.zoom"),transform:[X.x,X.y,X.k],domNode:_.current.closest(".react-flow")})}},[]),M.useEffect(()=>{R&&A&&(!i||D||T?P!==void 0&&R.on("wheel.zoom",function(k,B){if(!b&&k.type==="wheel"&&!k.ctrlKey||ts(k,v))return null;k.preventDefault(),P.call(this,k,B)},{passive:!1}):R.on("wheel.zoom",k=>{if(ts(k,v))return!1;k.preventDefault(),k.stopImmediatePropagation();const B=R.property("__zoom").k||1;if(k.ctrlKey&&s){const J=Kn(k),$=Y2(k),Q=B*Math.pow(2,$);return void A.scaleTo(R,Q,J,k)}const I=k.deltaMode===1?20:1;let U=l===Bo.Vertical?0:k.deltaX*I,V=l===Bo.Horizontal?0:k.deltaY*I;!Ll()&&k.shiftKey&&l!==Bo.Vertical&&(U=k.deltaY*I,V=0),A.translateBy(R,-U/B*a,-V/B*a,{internal:!0});const X=Hl(R.property("__zoom")),{onViewportChangeStart:Y,onViewportChange:G,onViewportChangeEnd:W}=C.getState();clearTimeout(E.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),E.current=setTimeout(()=>{n==null||n(k,X),W==null||W(X),z.current=!1},150))},{passive:!1}))},[T,i,l,R,A,P,D,s,b,v,e,t,n]),M.useEffect(()=>{A&&A.on("start",k=>{var U,V;if(!k.sourceEvent||k.sourceEvent.internal)return null;L.current=(U=k.sourceEvent)==null?void 0:U.button;const{onViewportChangeStart:B}=C.getState(),I=Hl(k.transform);N.current=!0,O.current=I,((V=k.sourceEvent)==null?void 0:V.type)==="mousedown"&&C.setState({paneDragging:!0}),B==null||B(I),e==null||e(k.sourceEvent,I)})},[A,e]),M.useEffect(()=>{A&&(T&&!N.current?A.on("zoom",null):T||A.on("zoom",k=>{var I;const{onViewportChange:B}=C.getState();if(C.setState({transform:[k.transform.x,k.transform.y,k.transform.k]}),j.current=!(!o||!G2(h,L.current??0)),(t||B)&&!((I=k.sourceEvent)!=null&&I.internal)){const U=Hl(k.transform);B==null||B(U),t==null||t(k.sourceEvent,U)}}))},[T,A,t,h,o]),M.useEffect(()=>{A&&A.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&&G2(h,L.current??0)&&!j.current&&o(k.sourceEvent),j.current=!1,(n||B)&&(I=O.current,U=k.transform,I.x!==U.x||I.y!==U.y||I.zoom!==U.k)){const V=Hl(k.transform);O.current=V,clearTimeout(S.current),S.current=setTimeout(()=>{B==null||B(V),n==null||n(k.sourceEvent,V)},i?150:0)}var I,U})},[A,i,h,n,o]),M.useEffect(()=>{A&&A.filter(k=>{const B=D||r,I=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)||T||!c&&k.type==="dblclick"||ts(k,v)&&k.type==="wheel"||ts(k,w)&&(k.type!=="wheel"||i&&k.type==="wheel"&&!D)||!s&&k.ctrlKey&&k.type==="wheel"||!B&&!i&&!I&&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})},[T,A,r,s,i,c,h,d,D]),q.createElement("div",{className:"react-flow__renderer",ref:_,style:cf},y)},cM=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function dM(){const{userSelectionActive:t,userSelectionRect:e}=ut(cM,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 K2(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 X2(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&&K2(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&&K2(o,i);break;case"remove":return o}return o.push(i),o},n)}function J2(t,e){return X2(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 df=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},uM=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),Z2=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}=ut(uM,Wt),w=()=>{m.setState({userSelectionActive:!1,userSelectionRect:null}),g.current=0,x.current=0},S=j=>{s==null||s(j),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},C=a?j=>a(j):void 0,N=y&&(t||b);return q.createElement("div",{className:Qt(["react-flow__pane",{dragging:v,selection:t}]),onClick:N?void 0:df(S,f),onContextMenu:df(j=>{Array.isArray(n)&&(n!=null&&n.includes(2))?j.preventDefault():i==null||i(j)},f),onWheel:df(C,f),onMouseEnter:N?void 0:l,onMouseDown:N?j=>{const{resetSelectedElements:_,domNode:O}=m.getState();if(p.current=O==null?void 0:O.getBoundingClientRect(),!y||!t||j.button!==0||j.target!==f.current||!p.current)return;const{x:A,y:R}=zo(j,p.current);_(),m.setState({userSelectionRect:{width:0,height:0,startX:A,startY:R,x:A,y:R}}),o==null||o(j)}:void 0,onMouseMove:N?j=>{const{userSelectionRect:_,nodeInternals:O,edges:A,transform:R,onNodesChange:P,onEdgesChange:T,nodeOrigin:D,getNodes:L}=m.getState();if(!t||!p.current||!_)return;m.setState({userSelectionActive:!0,nodesSelectionActive:!1});const z=zo(j,p.current),E=_.startX??0,k=_.startY??0,B={..._,x:z.x<E?z.x:E,y:z.y<k?z.y:k,width:Math.abs(z.x-E),height:Math.abs(z.y-k)},I=L(),U=S2(O,B,R,e===Ci.Partial,!0,D),V=j2(U,A).map(Y=>Y.id),X=U.map(Y=>Y.id);if(g.current!==X.length){g.current=X.length;const Y=ns(I,X);Y.length&&(P==null||P(Y))}if(x.current!==V.length){x.current=V.length;const Y=ns(A,V);Y.length&&(T==null||T(Y))}m.setState({userSelectionRect:B})}:c,onMouseUp:N?j=>{if(j.button!==0)return;const{userSelectionRect:_}=m.getState();!b&&_&&j.target===f.current&&(S==null||S(j)),m.setState({nodesSelectionActive:g.current>0}),w(),r==null||r(j)}:void 0,onMouseLeave:N?j=>{b&&(m.setState({nodesSelectionActive:g.current>0}),r==null||r(j)),w()}:d,ref:f,style:cf},h,q.createElement(dM,null))});function Q2(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const o=e.get(n);return!!o&&(!!o.selected||Q2(o,e))}function ew(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 hM(t,e,n,o){return Array.from(t.values()).filter(r=>(r.selected||r.id===o)&&(!r.parentNode||r.parentId||!Q2(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 tw(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",TT()),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"?Hh(e,a):e;return{position:{x:d.x-c.x,y:d.y-c.y},positionAbsolute:d}}function uf({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]}Z2.displayName="Pane";const nw=(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,...Vh(c)}})};function Ei(t,e,n){return n===void 0?n:o=>{const r=e().nodeInternals.get(t);r&&n(o,{...r})}}function hf({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",PT(t))}function ff(t){return(e,n,o)=>t==null?void 0:t(e,o)}function ow({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:j,snapToGrid:_}=w.getState(),O=C.touches?C.touches[0].clientX:C.clientX,A=C.touches?C.touches[0].clientY:C.clientY,R={x:(O-N[0])/N[2],y:(A-N[1])/N[2]};return{xSnapped:_?j[0]*Math.round(R.x/j[0]):R.x,ySnapped:_?j[1]*Math.round(R.y/j[1]):R.y,...R}},[])}();return M.useEffect(()=>{if(t!=null&&t.current){const w=Vn(t.current),S=({x:j,y:_})=>{const{nodeInternals:O,onNodeDrag:A,onSelectionDrag:R,updateNodePositions:P,nodeExtent:T,snapGrid:D,snapToGrid:L,nodeOrigin:z,onError:E}=a.getState();h.current={x:j,y:_};let k=!1,B={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&T){const U=nf(d.current,z);B=Wh(U)}if(d.current=d.current.map(U=>{const V={x:j-U.distance.x,y:_-U.distance.y};L&&(V.x=D[0]*Math.round(V.x/D[0]),V.y=D[1]*Math.round(V.y/D[1]));const X=[[T[0][0],T[0][1]],[T[1][0],T[1][1]]];d.current.length>1&&T&&!U.extent&&(X[0][0]=U.positionAbsolute.x-B.x+T[0][0],X[1][0]=U.positionAbsolute.x+(U.width??0)-B.x2+T[1][0],X[0][1]=U.positionAbsolute.y-B.y+T[0][1],X[1][1]=U.positionAbsolute.y+(U.height??0)-B.y2+T[1][1]);const Y=tw(U,V,O,X,z,E);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;P(d.current,!0,!0),c(!0);const I=r?A:ff(R);if(I&&x.current){const[U,V]=uf({nodeId:r,dragItems:d.current,nodeInternals:O});I(x.current,U,V)}},C=()=>{if(!m.current)return;const[j,_]=a2(g.current,m.current);if(j!==0||_!==0){const{transform:O,panBy:A}=a.getState();h.current.x=(h.current.x??0)-j/O[2],h.current.y=(h.current.y??0)-_/O[2],A({x:j,y:_})&&S(h.current)}f.current=requestAnimationFrame(C)},N=j=>{var z;const{nodeInternals:_,multiSelectionActive:O,nodesDraggable:A,unselectNodesAndEdges:R,onNodeDragStart:P,onSelectionDragStart:T}=a.getState();b.current=!0;const D=r?P:ff(T);i&&s||O||!r||(z=_.get(r))!=null&&z.selected||R(),r&&s&&i&&hf({id:r,store:a,nodeRef:t});const L=v(j);if(h.current=L,d.current=hM(_,A,L,r),D&&d.current){const[E,k]=uf({nodeId:r,dragItems:d.current,nodeInternals:_});D(j.sourceEvent,E,k)}};if(!e){const j=function(){var _,O,A,R,P=bT,T=yT,D=vT,L=wT,z={},E=DS("start","drag","end"),k=0,B=0;function I($){$.on("mousedown.drag",U).filter(L).on("touchstart.drag",Y).on("touchmove.drag",G,xT).on("touchend.drag touchcancel.drag",W).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function U($,Q){if(!R&&P.call(this,$,Q)){var te=J(this,T.call(this,$,Q),$,Q,"mouse");te&&(Vn($.view).on("mousemove.drag",V,yi).on("mouseup.drag",X,yi),n2($.view),Bh($),A=!1,_=$.clientX,O=$.clientY,te("start",$))}}function V($){if(Kr($),!A){var Q=$.clientX-_,te=$.clientY-O;A=Q*Q+te*te>B}z.mouse("drag",$)}function X($){Vn($.view).on("mousemove.drag mouseup.drag",null),o2($.view,A),Kr($),z.mouse("end",$)}function Y($,Q){if(P.call(this,$,Q)){var te,oe,ne=$.changedTouches,ie=T.call(this,$,Q),se=ne.length;for(te=0;te<se;++te)(oe=J(this,ie,$,Q,ne[te].identifier,ne[te]))&&(Bh($),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(R&&clearTimeout(R),R=setTimeout(function(){R=null},500),Q=0;Q<ne;++Q)(te=z[oe[Q].identifier])&&(Bh($),te("end",$,oe[Q]))}function J($,Q,te,oe,ne,ie){var se,ae,fe,re=E.copy(),ue=Kn(ie||te,Q);if((fe=D.call($,new Uh("beforestart",{sourceEvent:te,target:I,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(Se,je,Fe){var Ie,ke=ue;switch(Se){case"start":z[ne]=le,Ie=k++;break;case"end":delete z[ne],--k;case"drag":ue=Kn(Fe||je,Q),Ie=k}re.call(Se,$,new Uh(Se,{sourceEvent:je,subject:fe,target:I,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 I.filter=function($){return arguments.length?(P=typeof $=="function"?$:Ol(!!$),I):P},I.container=function($){return arguments.length?(T=typeof $=="function"?$:Ol($),I):T},I.subject=function($){return arguments.length?(D=typeof $=="function"?$:Ol($),I):D},I.touchable=function($){return arguments.length?(L=typeof $=="function"?$:Ol(!!$),I):L},I.on=function(){var $=E.on.apply(E,arguments);return $===E?I:$},I.clickDistance=function($){return arguments.length?(B=($=+$)*$,I):Math.sqrt(B)},I}().on("start",_=>{const{domNode:O,nodeDragThreshold:A}=a.getState();A===0&&N(_),y.current=!1;const R=v(_);h.current=R,m.current=(O==null?void 0:O.getBoundingClientRect())||null,g.current=zo(_.sourceEvent,m.current)}).on("drag",_=>{var P,T;const O=v(_),{autoPanOnNodeDrag:A,nodeDragThreshold:R}=a.getState();if(_.sourceEvent.type==="touchmove"&&_.sourceEvent.touches.length>1&&(y.current=!0),!y.current){if(!p.current&&b.current&&A&&(p.current=!0,C()),!b.current){const D=O.xSnapped-(((P=h==null?void 0:h.current)==null?void 0:P.x)??0),L=O.ySnapped-(((T=h==null?void 0:h.current)==null?void 0:T.y)??0);Math.sqrt(D*D+L*L)>R&&N(_)}(h.current.x!==O.xSnapped||h.current.y!==O.ySnapped)&&d.current&&b.current&&(x.current=_.sourceEvent,g.current=zo(_.sourceEvent,m.current),S(O))}}).on("end",_=>{if(b.current&&!y.current&&(c(!1),p.current=!1,b.current=!1,cancelAnimationFrame(f.current),d.current)){const{updateNodePositions:O,nodeInternals:A,onNodeDragStop:R,onSelectionDragStop:P}=a.getState(),T=r?R:ff(P);if(O(d.current,!1,!1),T){const[D,L]=uf({nodeId:r,dragItems:d.current,nodeInternals:A});T(_.sourceEvent,D,L)}}}).filter(_=>{const O=_.target;return!_.button&&(!n||!ew(O,`.${n}`,t))&&(!o||ew(O,o,t))});return w.call(j),()=>{w.on(".drag",null)}}w.on(".drag",null)}},[t,e,n,o,s,a,r,i,v]),l}function rw(){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:S}=tw(y,v,o,r,void 0,c);y.position=S,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:S,selectNodesOnDrag:C,sourcePosition:N,targetPosition:j,hidden:_,resizeObserver:O,dragHandle:A,zIndex:R,isParent:P,noDragClassName:T,noPanClassName:D,initialized:L,disableKeyboardA11y:z,ariaLabel:E,rfId:k,hasHandleBounds:B})=>{const I=Ft(),U=M.useRef(null),V=M.useRef(null),X=M.useRef(N),Y=M.useRef(j),G=M.useRef(o),W=v||y||d||h||f||m,J=rw(),$=Ei(n,I.getState,h),Q=Ei(n,I.getState,f),te=Ei(n,I.getState,m),oe=Ei(n,I.getState,g),ne=Ei(n,I.getState,x);M.useEffect(()=>()=>{V.current&&(O==null||O.unobserve(V.current),V.current=null)},[]),M.useEffect(()=>{if(U.current&&!_){const se=U.current;L&&B&&V.current===se||(V.current&&(O==null||O.unobserve(V.current)),O==null||O.observe(se),V.current=se)}},[_,L,B]),M.useEffect(()=>{const se=G.current!==o,ae=X.current!==N,fe=Y.current!==j;U.current&&(se||ae||fe)&&(se&&(G.current=o),ae&&(X.current=N),fe&&(Y.current=j),I.getState().updateNodeDimensions([{id:n,nodeElement:U.current,forceUpdate:!0}]))},[n,o,N,j]);const ie=ow({nodeRef:U,disabled:_||!y,noDragClassName:T,handleSelector:A,nodeId:n,isSelectable:v,selectNodesOnDrag:C});return _?null:q.createElement("div",{className:Qt(["react-flow__node",`react-flow__node-${o}`,{[D]:y},b,{selected:c,selectable:v,parent:P,dragging:ie}]),ref:U,style:{zIndex:R,transform:`translate(${a}px,${l}px)`,pointerEvents:W?"all":"none",visibility:L?"visible":"hidden",...p},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:$,onMouseMove:Q,onMouseLeave:te,onContextMenu:oe,onClick:se=>{const{nodeDragThreshold:ae}=I.getState();if(v&&(!C||!y||ae>0)&&hf({id:n,store:I,nodeRef:U}),d){const fe=I.getState().nodeInternals.get(n);fe&&d(se,{...fe})}},onDoubleClick:ne,onKeyDown:S?se=>{if(!Gh(se)&&!z)if(d2.includes(se.key)&&v){const ae=se.key==="Escape";hf({id:n,store:I,unselect:ae,nodeRef:U})}else y&&c&&Object.prototype.hasOwnProperty.call(os,se.key)&&(I.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:S?0:void 0,role:S?"button":void 0,"aria-describedby":z?void 0:`${B2}-${k}`,"aria-label":E},q.createElement(UT,{value:n},q.createElement(t,{id:n,data:r,type:o,xPos:s,yPos:i,selected:c,isConnectable:w,sourcePosition:N,targetPosition:j,dragging:ie,dragHandle:A,zIndex:R})))};return e.displayName="NodeWrapper",M.memo(e)};const fM=t=>{const e=t.getNodes().filter(n=>n.selected);return{...nf(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};var mM=M.memo(function({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const o=Ft(),{width:r,height:s,x:i,y:a,transformString:l,userSelectionActive:c}=ut(fM,Wt),d=rw(),h=M.useRef(null);if(M.useEffect(()=>{var m;n||((m=h.current)==null||m.focus({preventScroll:!0}))},[n]),ow({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 pM=t=>t.nodesSelectionActive,sw=({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:S,panOnScroll:C,panOnScrollSpeed:N,panOnScrollMode:j,zoomOnDoubleClick:_,panOnDrag:O,defaultViewport:A,translateExtent:R,minZoom:P,maxZoom:T,preventScrolling:D,onSelectionContextMenu:L,noWheelClassName:z,noPanClassName:E,disableKeyboardA11y:k})=>{const B=ut(pM),I=ji(h),U=ji(b),V=U||O,X=U||C,Y=I||f&&V!==!0;return(({deleteKeyCode:G,multiSelectionKeyCode:W})=>{const J=Ft(),{deleteElements:$}=Ni(),Q=ji(G,iM),te=ji(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(lM,{onMove:l,onMoveStart:c,onMoveEnd:d,onPaneContextMenu:s,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:S,panOnScroll:X,panOnScrollSpeed:N,panOnScrollMode:j,zoomOnDoubleClick:_,panOnDrag:!I&&V,defaultViewport:A,translateExtent:R,minZoom:P,maxZoom:T,zoomActivationKeyCode:y,preventScrolling:D,noWheelClassName:z,noPanClassName:E},q.createElement(Z2,{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(mM,{onSelectionContextMenu:L,noPanClassName:E,disableKeyboardA11y:k})))};sw.displayName="FlowRenderer";var gM=M.memo(sw);function xM(t){return{input:_i(t.input||R2),default:_i(t.default||sf),output:_i(t.output||L2),group:_i(t.group||af),...Object.keys(t).filter(e=>!["input","default","output","group"].includes(e)).reduce((e,n)=>(e[n]=_i(t[n]||sf),e),{})}}const bM=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),iw=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,updateNodeDimensions:s,onError:i}=ut(bM,Wt),a=(l=t.onlyRenderVisibleElements,ut(M.useCallback(h=>l?S2(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:cf},a.map(h=>{var C,N,j;let f=h.type||"default";t.nodeTypes[f]||(i==null||i("003",IT(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?Hh(h.positionAbsolute,t.nodeExtent):h.positionAbsolute,v=(y==null?void 0:y.x)??0,w=(y==null?void 0:y.y)??0,S=(({x:_,y:O,width:A,height:R,origin:P})=>A&&R?P[0]<0||P[1]<0||P[0]>1||P[1]>1?{x:_,y:O}:{x:_-A*P[0],y:O-R*P[1]}:{x:_,y:O})({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:S.x,yPosOrigin:S.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:!!((j=h[yt])!=null&&j.handleBounds)})}))};iw.displayName="NodeRenderer";var yM=M.memo(iw);const vM=(t,e,n)=>n===Oe.Left?t-e:n===Oe.Right?t+e:t,wM=(t,e,n)=>n===Oe.Top?t-e:n===Oe.Bottom?t+e:t,aw="react-flow__edgeupdater",lw=({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([aw,`${aw}-${a}`]),cx:vM(e,o,t),cy:wM(n,o,t),r:o,stroke:"transparent",fill:"transparent"}),kM=()=>!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:S,targetY:C,sourcePosition:N,targetPosition:j,elementsSelectable:_,hidden:O,sourceHandleId:A,targetHandleId:R,onContextMenu:P,onMouseEnter:T,onMouseMove:D,onMouseLeave:L,reconnectRadius:z,onReconnect:E,onReconnectStart:k,onReconnectEnd:B,markerEnd:I,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('#${ef(U,V)}')`,[U,V]),fe=M.useMemo(()=>`url('#${ef(I,V)}')`,[I,V]);if(O)return null;const re=ki(n,se.getState,a),ue=ki(n,se.getState,P),le=ki(n,se.getState,T),Se=ki(n,se.getState,D),je=ki(n,se.getState,L),Fe=(Ve,Ke)=>{if(Ve.button!==0)return;const{edges:ee,isValidConnection:ye}=se.getState(),we=Ke?y:b,Ae=(Ke?R:A)||null,K=Ke?"target":"source",pe=ye||kM,ge=Ke,he=ee.find(Ce=>Ce.id===n);ie(!0),k==null||k(Ve,he,K),A2({event:Ve,handleId:Ae,nodeId:we,onConnect:Ce=>E==null?void 0:E(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=!_&&!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&&(_&&(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:Se,onMouseLeave:je,onKeyDown:Y?Ve=>{var Ke;if(!$&&d2.includes(Ve.key)&&_){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?`${U2}-${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:S,targetY:C,sourcePosition:N,targetPosition:j,sourceHandleId:A,targetHandleId:R,markerStart:ae,markerEnd:fe,pathOptions:W,interactionWidth:J}),G&&q.createElement(q.Fragment,null,(G==="source"||G===!0)&&q.createElement(lw,{position:N,centerX:v,centerY:w,radius:z,onMouseDown:Ve=>Fe(Ve,!0),onMouseEnter:Ie,onMouseOut:ke,type:"source"}),(G==="target"||G===!0)&&q.createElement(lw,{position:j,centerX:S,centerY:C,radius:z,onMouseDown:Ve=>Fe(Ve,!1),onMouseEnter:Ie,onMouseOut:ke,type:"target"})))};return e.displayName="EdgeWrapper",M.memo(e)};function CM(t){return{default:rs(t.default||Ul),straight:rs(t.bezier||Zh),step:rs(t.step||Jh),smoothstep:rs(t.step||zl),simplebezier:rs(t.simplebezier||Kh),...Object.keys(t).filter(e=>!["default","bezier"].includes(e)).reduce((e,n)=>(e[n]=rs(t[n]||Ul),e),{})}}function cw(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 dw(t,e){return t?t.length!==1&&e?e&&t.find(n=>n.id===e)||null:t[0]:null}function uw(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 SM=[{level:0,isMaxLevel:!0,edges:[]}];function jM(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?SM:l}(ut(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=Wh({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 hw={[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"})},NM=({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(hw,c)?hw[c]:((f=(h=d.getState()).onError)==null||f.call(h,"009",MT(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},fw=({defaultColor:t,rfId:e})=>{const n=ut(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=ef(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(NM,{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})))};fw.displayName="MarkerDefinitions";var EM=M.memo(fw);const _M=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}),mw=({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:S,height:C,connectionMode:N,nodeInternals:j,onError:_}=ut(_M,Wt),O=jM(e,j,n);return S?q.createElement(q.Fragment,null,O.map(({level:A,edges:R,isMaxLevel:P})=>q.createElement("svg",{key:A,style:{zIndex:A},width:S,height:C,className:"react-flow__edges react-flow__container"},P&&q.createElement(EM,{defaultColor:t,rfId:o}),q.createElement("g",null,R.map(T=>{const[D,L,z]=uw(j.get(T.source)),[E,k,B]=uw(j.get(T.target));if(!z||!B)return null;let I=T.type||"default";r[I]||(_==null||_("011",RT(I)),I="default");const U=r[I]||r.default,V=N===hr.Strict?k.target:(k.target??[]).concat(k.source??[]),X=dw(L.source,T.sourceHandle),Y=dw(V,T.targetHandle),G=(X==null?void 0:X.position)||Oe.Bottom,W=(Y==null?void 0:Y.position)||Oe.Top,J=!!(T.focusable||y&&T.focusable===void 0),$=T.reconnectable||T.updatable,Q=f!==void 0&&($||v&&$===void 0);if(!X||!Y)return _==null||_("008",OT(X,T)),null;const{sourceX:te,sourceY:oe,targetX:ne,targetY:ie}=((se,ae,fe,re,ue,le)=>{const Se=cw(fe,se,ae),je=cw(le,re,ue);return{sourceX:Se.x,sourceY:Se.y,targetX:je.x,targetY:je.y}})(D,X,G,E,Y,W);return q.createElement(U,{key:T.id,id:T.id,className:Qt([T.className,s]),type:I,data:T.data,selected:!!T.selected,animated:!!T.animated,hidden:!!T.hidden,label:T.label,labelStyle:T.labelStyle,labelShowBg:T.labelShowBg,labelBgStyle:T.labelBgStyle,labelBgPadding:T.labelBgPadding,labelBgBorderRadius:T.labelBgBorderRadius,style:T.style,source:T.source,target:T.target,sourceHandleId:T.sourceHandle,targetHandleId:T.targetHandle,markerEnd:T.markerEnd,markerStart:T.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:T.ariaLabel,isFocusable:J,isReconnectable:Q,pathOptions:"pathOptions"in T?T.pathOptions:void 0,interactionWidth:T.interactionWidth,disableKeyboardA11y:b})})))),p):null};mw.displayName="EdgeRenderer";var IM=M.memo(mw);const AM=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function TM({children:t}){const e=ut(AM);return q.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}const MM={[Oe.Left]:Oe.Right,[Oe.Right]:Oe.Left,[Oe.Top]:Oe.Bottom,[Oe.Bottom]:Oe.Top},pw=({nodeId:t,handleType:e,style:n,type:o=Uo.Bezier,CustomComponent:r,connectionStatus:s})=>{var C,N,j;const{fromNode:i,handleId:a,toX:l,toY:c,connectionMode:d}=ut(M.useCallback(_=>({fromNode:_.nodeInternals.get(t),handleId:_.connectionHandleId,toX:(_.connectionPosition.x-_.transform[0])/_.transform[2],toY:(_.connectionPosition.y-_.transform[1])/_.transform[2],connectionMode:_.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(_=>_.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=(((j=i.positionAbsolute)==null?void 0:j.y)??0)+x,y=m==null?void 0:m.position,v=y?MM[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 S={sourceX:p,sourceY:b,sourcePosition:y,targetX:l,targetY:c,targetPosition:v};return o===Uo.Bezier?[w]=k2(S):o===Uo.Step?[w]=Xh({...S,borderRadius:0}):o===Uo.SmoothStep?[w]=Xh(S):o===Uo.SimpleBezier?[w]=b2(S):w=`M${p},${b} ${l},${c}`,q.createElement("path",{d:w,fill:"none",className:"react-flow__connection-path",style:n})};pw.displayName="ConnectionLine";const OM=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function DM({containerStyle:t,style:e,type:n,component:o}){const{nodeId:r,handleType:s,nodesConnectable:i,width:a,height:l,connectionStatus:c}=ut(OM,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(pw,{nodeId:r,handleType:s,style:e,type:n,CustomComponent:o,connectionStatus:c}))):null}function gw(t,e){return M.useRef(null),Ft(),M.useMemo(()=>e(t),[t])}const xw=({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:S,selectionOnDrag:C,selectionMode:N,multiSelectionKeyCode:j,panActivationKeyCode:_,zoomActivationKeyCode:O,deleteKeyCode:A,onlyRenderVisibleElements:R,elementsSelectable:P,selectNodesOnDrag:T,defaultViewport:D,translateExtent:L,minZoom:z,maxZoom:E,preventScrolling:k,defaultMarkerColor:B,zoomOnScroll:I,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:Se,noDragClassName:je,noWheelClassName:Fe,noPanClassName:Ie,elevateEdgesOnSelect:ke,disableKeyboardA11y:Ye,nodeOrigin:Ve,nodeExtent:Ke,rfId:ee})=>{const ye=gw(t,xM),we=gw(e,CM);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(gM,{onPaneClick:J,onPaneMouseEnter:$,onPaneMouseMove:Q,onPaneMouseLeave:te,onPaneContextMenu:ne,onPaneScroll:oe,deleteKeyCode:A,selectionKeyCode:S,selectionOnDrag:C,selectionMode:N,onSelectionStart:x,onSelectionEnd:p,multiSelectionKeyCode:j,panActivationKeyCode:_,zoomActivationKeyCode:O,elementsSelectable:P,onMove:n,onMoveStart:o,onMoveEnd:r,zoomOnScroll:I,zoomOnPinch:U,zoomOnDoubleClick:G,panOnScroll:V,panOnScrollSpeed:X,panOnScrollMode:Y,panOnDrag:W,defaultViewport:D,translateExtent:L,minZoom:z,maxZoom:E,onSelectionContextMenu:g,preventScrolling:k,noDragClassName:je,noWheelClassName:Fe,noPanClassName:Ie,disableKeyboardA11y:Ye},q.createElement(TM,null,q.createElement(IM,{edgeTypes:we,onEdgeClick:a,onEdgeDoubleClick:c,onlyRenderVisibleElements:R,onEdgeContextMenu:ie,onEdgeMouseEnter:se,onEdgeMouseMove:ae,onEdgeMouseLeave:fe,onReconnect:re,onReconnectStart:ue,onReconnectEnd:le,reconnectRadius:Se,defaultMarkerColor:B,noPanClassName:Ie,elevateEdgesOnSelect:!!ke,disableKeyboardA11y:Ye,rfId:ee},q.createElement(DM,{style:y,type:b,component:v,containerStyle:w})),q.createElement("div",{className:"react-flow__edgelabel-renderer"}),q.createElement(yM,{nodeTypes:ye,onNodeClick:i,onNodeDoubleClick:l,onNodeMouseEnter:d,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:m,selectNodesOnDrag:T,onlyRenderVisibleElements:R,noPanClassName:Ie,noDragClassName:je,disableKeyboardA11y:Ye,nodeOrigin:Ve,nodeExtent:Ke,rfId:ee})))};xw.displayName="GraphView";var RM=M.memo(xw);const mf=[[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:mf,nodeExtent:mf,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},PM=()=>((t,e)=>t?t2(t,e):t2)((t,e)=>({...Ho,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:s}=e();t({nodeInternals:lf(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?lf(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=Vh(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:nw(".source",p.nodeElement,f,c),target:nw(".target",p.nodeElement,f,c)}},...y}),x.push({id:b.id,type:"dimensions",dimensions:y}))}return x},[]);W2(r,c);const g=i||s&&!i&&q2(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=lf(J2(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=Hh(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),pf=({children:t})=>{const e=M.useRef(null);return e.current||(e.current=PM()),q.createElement(_T,{value:e.current},t)};pf.displayName="ReactFlowProvider";const bw=({children:t})=>M.useContext(Rl)?q.createElement(q.Fragment,null,t):q.createElement(pf,null,t);bw.displayName="ReactFlowWrapper";const LM={input:R2,default:sf,output:L2,group:af},FM={default:Ul,straight:Zh,step:Jh,smoothstep:zl,simplebezier:Kh},zM=[0,0],BM=[15,15],UM={x:0,y:0,zoom:1},$M={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},gf=M.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s=LM,edgeTypes:i=FM,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:S,onNodeDoubleClick:C,onNodeDragStart:N,onNodeDrag:j,onNodeDragStop:_,onNodesDelete:O,onEdgesDelete:A,onSelectionChange:R,onSelectionDragStart:P,onSelectionDrag:T,onSelectionDragStop:D,onSelectionContextMenu:L,onSelectionStart:z,onSelectionEnd:E,connectionMode:k=hr.Strict,connectionLineType:B=Uo.Bezier,connectionLineStyle:I,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=BM,onlyRenderVisibleElements:ne=!1,selectNodesOnDrag:ie=!0,nodesDraggable:se,nodesConnectable:ae,nodesFocusable:fe,nodeOrigin:re=zM,edgesFocusable:ue,edgesUpdatable:le,elementsSelectable:Se,defaultViewport:je=UM,minZoom:Fe=.5,maxZoom:Ie=2,translateExtent:ke=mf,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:jo="nodrag",noWheelClassName:_n="nowheel",noPanClassName:as="nopan",fitView:Ai=!1,fitViewOptions:bO,connectOnClick:yO=!0,attributionPosition:vO,proOptions:wO,defaultEdgeOptions:kO,elevateNodesOnSelect:CO=!0,elevateEdgesOnSelect:SO=!1,disableKeyboardA11y:d3=!1,autoPanOnConnect:jO=!0,autoPanOnNodeDrag:NO=!0,connectionRadius:EO=20,isValidConnection:_O,onError:IO,style:AO,id:u3,nodeDragThreshold:TO,...MO},OO)=>{const am=u3||"1";return q.createElement("div",{...MO,style:{...AO,...$M},ref:OO,className:Qt(["react-flow",r]),"data-testid":"rf__wrapper",id:u3},q.createElement(bw,null,q.createElement(RM,{onInit:c,onMove:d,onMoveStart:h,onMoveEnd:f,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:y,onNodeMouseMove:v,onNodeMouseLeave:w,onNodeContextMenu:S,onNodeDoubleClick:C,nodeTypes:s,edgeTypes:i,connectionLineType:B,connectionLineStyle:I,connectionLineComponent:U,connectionLineContainerStyle:V,selectionKeyCode:Y,selectionOnDrag:G,selectionMode:W,deleteKeyCode:X,multiSelectionKeyCode:$,panActivationKeyCode:J,zoomActivationKeyCode:Q,onlyRenderVisibleElements:ne,selectNodesOnDrag:ie,defaultViewport:je,translateExtent:ke,minZoom:Fe,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:L,onSelectionStart:z,onSelectionEnd:E,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:jo,noWheelClassName:_n,noPanClassName:as,elevateEdgesOnSelect:SO,rfId:am,disableKeyboardA11y:d3,nodeOrigin:re,nodeExtent:Ve}),q.createElement(JT,{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:Se,elevateNodesOnSelect:CO,minZoom:Fe,maxZoom:Ie,nodeExtent:Ve,onNodesChange:is,onEdgesChange:Xn,snapToGrid:te,snapGrid:oe,connectionMode:k,translateExtent:ke,connectOnClick:yO,defaultEdgeOptions:kO,fitView:Ai,fitViewOptions:bO,onNodesDelete:O,onEdgesDelete:A,onNodeDragStart:N,onNodeDrag:j,onNodeDragStop:_,onSelectionDrag:T,onSelectionDragStart:P,onSelectionDragStop:D,noPanClassName:as,nodeOrigin:re,rfId:am,autoPanOnConnect:jO,autoPanOnNodeDrag:NO,onError:IO,connectionRadius:EO,isValidConnection:_O,nodeDragThreshold:TO}),q.createElement(KT,{onSelectionChange:R}),Te,q.createElement(FT,{proOptions:wO,position:vO}),q.createElement(tM,{rfId:am,disableKeyboardA11y:d3})))});function yw(t){return e=>{const[n,o]=M.useState(e),r=M.useCallback(s=>o(i=>t(s,i)),[]);return[n,o,r]}}gf.displayName="ReactFlow";const vw=yw(J2),ww=yw(function(t,e){return X2(t,e)});function VM(){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 HM(){return q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},q.createElement("path",{d:"M0 0h32v4.2H0z"}))}function WM(){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 qM(){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 GM(){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 YM=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),kw=({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}=ut(YM,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(VM,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(HM,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(WM,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(GM,null):q.createElement(qM,null)),d):null};kw.displayName="Controls";var En,KM=M.memo(kw);function XM({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 JM({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 ZM={[En.Dots]:"#91919a",[En.Lines]:"#eee",[En.Cross]:"#e2e2e2"},QM={[En.Dots]:1,[En.Lines]:1,[En.Cross]:6},e7=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function Cw({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}=ut(e7,Wt),f=i||ZM[e],m=o||QM[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(JM,{color:f,radius:y/s}):q.createElement(XM,{dimensions:v,color:f,lineWidth:r})),q.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+t})`}))}Cw.displayName="Background";var t7=M.memo(Cw);function xf(t){return Math.min(11*t+35,200)}const Sw=q.createContext("LR"),jw=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=ut(n7),l=M.use(Sw);let c,d,h,f,m;if(e[0]!==r.code||e[1]!==i||e[2]!==l||e[3]!==o){const A=r.code.split(`
|
160
160
|
`).length,R=l==="LR"?Oe.Left:Oe.Top;let P;e[8]!==i?(P={background:i},e[8]=i,e[9]=P):P=e[9],e[10]!==R||e[11]!==P?(h=u.jsx($o,{type:"target",id:"inputs",position:R,style:P}),e[10]=R,e[11]=P,e[12]=h):h=e[12];const T=l==="LR"?Oe.Left:Oe.Top;let D;e[13]!==i?(D={background:i},e[13]=i,e[14]=D):D=e[14],e[15]!==T||e[16]!==D?(f=u.jsx($o,{type:"source",id:"inputs",position:T,style:D}),e[15]=T,e[16]=D,e[17]=f):f=e[17];const L=o&&"border-primary";e[18]!==L?(d=xe("flex flex-col bg-card border border-input/50 rounded-md mx-[2px] overflow-hidden",L),e[18]=L,e[19]=d):d=e[19],c=xf(A),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=pL(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(WF,{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 S,C;e[35]!==i?(S={background:i},e[35]=i,e[36]=S):S=e[36],e[37]!==w||e[38]!==S?(C=u.jsx($o,{type:"source",id:"outputs",position:w,style:S}),e[37]=w,e[38]=S,e[39]=C):C=e[39];const N=l==="LR"?Oe.Right:Oe.Bottom;let j,_,O;return e[40]!==i?(j={background:i},e[40]=i,e[41]=j):j=e[41],e[42]!==N||e[43]!==j?(_=u.jsx($o,{type:"target",id:"outputs",position:N,style:j}),e[42]=N,e[43]=j,e[44]=_):_=e[44],e[45]!==v||e[46]!==C||e[47]!==_||e[48]!==h||e[49]!==f?(O=u.jsxs("div",{children:[h,f,v,C,_]}),e[45]=v,e[46]=C,e[47]=_,e[48]=h,e[49]=f,e[50]=O):O=e[50],O},(t,e)=>["data","selected","id"].every(n=>t[n]===e[n]));jw.displayName="CustomNode";const Nw={custom:jw};function n7(t){const{width:e}=t;return e}const Ew=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(yr,{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(gs,{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)},bf=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(YC,{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},yf=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=(T,D)=>{s({...r,[T]:D})},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(Im,{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=T=>a("hidePureMarkdown",!!T),e[5]=a,e[6]=d):d=e[6],e[7]!==r.hidePureMarkdown||e[8]!==d?(h=u.jsx(wC,{"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(xr,{htmlFor:"hide-pure-markdown",children:"Hide pure markdown"}),e[10]=f):f=e[10],e[11]!==h?(m=u.jsxs(yr,{children:[l,u.jsxs(gs,{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(Kp,{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,S,C;e[19]!==n?(w=()=>n("TB"),e[19]=n,e[20]=w):w=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(S=u.jsx(ha,{className:"w-4 h-4 mr-1"}),e[21]=S):S=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:[S,"Vertical Tree"]}),e[22]=v,e[23]=w,e[24]=C):C=e[24];const N=o==="LR";let j,_,O,A;e[25]!==n?(j=()=>n("LR"),e[25]=n,e[26]=j):j=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(ha,{className:"w-4 h-4 mr-1 transform -rotate-90"}),e[27]=_):_=e[27],e[28]!==N||e[29]!==j?(O=u.jsxs(ve,{variant:"outline",className:"bg-background","aria-selected":N,size:"xs",onClick:j,children:[_," ","Horizontal Tree"]}),e[28]=N,e[29]=j,e[30]=O):O=e[30],e[31]!==y||e[32]!==C||e[33]!==O?(A=u.jsxs("div",{className:"flex gap-2",children:[y,C,O]}),e[31]=y,e[32]=C,e[33]=O,e[34]=A):A=e[34];const R=o!=="_minimap_"&&g;let P;return e[35]!==A||e[36]!==R?(P=u.jsxs(Pl,{position:"top-right",className:"flex flex-col items-end gap-2",children:[A,R]}),e[35]=A,e[36]=R,e[37]=P):P=e[37],P});yf.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=o7;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(bf,{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(Ew,{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(Xl,{className:"w-5 h-5"}),u.jsx(Mo,{cellId:n.id}),u.jsx("div",{className:"flex-1"}),u.jsx(_x,{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(bp,{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(bf,{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 o7(t,e){const n=Ri(t);n&&rp(n,e)}function _w(){const t=H.c(7),e=Ni(),n=ut(s7),o=ut(r7);let r;t[0]!==e?(r=()=>{e.fitView({duration:100})},t[0]=e,t[1]=r):r=t[1];const s=gL(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 r7(t){const{height:e}=t;return e}function s7(t){const{width:e}=t;return e}Wl.displayName="GraphSelectionPanel";const Iw=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:xf(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 np.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}}},i7=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=Iw.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]=ww(c),[f,m]=vw(a),[g,x]=M.useState(),[p,b]=M.useState(),y=M.useRef(!1);_w();const v=ut(a7);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 S=Le(w);let C,N,j,_;e[8]!==r||e[9]!==n||e[10]!==S||e[11]!==o?(C=()=>{y.current?S(Iw.createElements(n,r,o,!1)):y.current=!0},N=[n,o,r,S],e[8]=r,e[9]=n,e[10]=S,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?(j=()=>{if(g){const k=l.filter(B=>{const{source:I,target:U,data:V}=B;return I===g&&V.direction==="outputs"||U===g&&V.direction==="inputs"});h(k)}},_=[g,h,l],e[14]=l,e[15]=g,e[16]=h,e[17]=j,e[18]=_):(j=e[17],_=e[18]),M.useEffect(j,_);const O=function(k,B){const I=H.c(17);let U,V;if(I[0]!==B||I[1]!==k){let Q;I[3]!==B?(Q=(te,oe)=>{const{position:ne}=oe;return Math.min(te,ne.y-B/2-10)},I[3]=B,I[4]=Q):Q=I[4],V=k.reduce(Q,Number.POSITIVE_INFINITY),I[0]=B,I[1]=k,I[2]=V}else V=I[2];const X=V;let Y;if(I[5]!==B||I[6]!==k){let Q;I[8]!==B?(Q=(te,oe)=>{const{position:ne}=oe;return Math.max(te,ne.y+B/2+10)},I[8]=B,I[9]=Q):Q=I[9],Y=k.reduce(Q,Number.NEGATIVE_INFINITY),I[5]=B,I[6]=k,I[7]=Y}else Y=I[7];const G=Y;let W,J,$;return I[10]!==X?(W=[Number.NEGATIVE_INFINITY,X],I[10]=X,I[11]=W):W=I[11],I[12]!==G?(J=[Number.POSITIVE_INFINITY,G],I[12]=G,I[13]=J):J=I[13],I[14]!==W||I[15]!==J?($=[W,J],I[14]=W,I[15]=J,I[16]=$):$=I[16],U=$,U}(f,v);let A;e[19]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{x(void 0),b(void 0)},e[19]=A):A=e[19];const R=A;let P;e[20]!==d||e[21]!==p||e[22]!==g||e[23]!==o?(P=()=>p?u.jsx(Wl,{selection:{type:"edge",source:p.source,target:p.target},onClearSelection:R,variables:o,edges:d}):g?u.jsx(Wl,{selection:{type:"node",id:g},variables:o,edges:d,onClearSelection:R}):null,e[20]=d,e[21]=p,e[22]=g,e[23]=o,e[24]=P):P=e[24];const T=P;let D,L,z,E;return e[25]!==h?(D=(k,B)=>{const I=B.id;x(I),b(void 0),h([])},e[25]=h,e[26]=D):D=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(L=(k,B)=>{b(B)},e[27]=L):L=e[27],e[28]!==T?(z=T(),e[28]=T,e[29]=z):z=e[29],e[30]!==s||e[31]!==d||e[32]!==f||e[33]!==D||e[34]!==z||e[35]!==O?(E=u.jsxs(gf,{nodes:f,edges:d,nodeTypes:Nw,translateExtent:O,onNodeClick:D,onNodeDoubleClick:l7,onEdgeClick:L,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]=D,e[34]=z,e[35]=O,e[36]=E):E=e[36],E};function a7(t){const{height:e}=t;return e}function l7(t,e){KC(e.id,"focus")}var vf,Aw,Tw,Mw,Ow,Dw,wf,Rw,kf,Pw,Cf,Lw,Sf,Fw,jf,zw,Nf,Bw,Ef,Uw,_f,$w,If,Vw,Af,Hw,Tf,Ww,Mf,qw,Of,Gw,Df,Yw,Kw,Xw,Jw,Zw,Qw,ek,Rf,tk,Pf,nk,Lf,ok,Ff,rk,zf,sk,Bf,ik,Uf,ak,$f,lk,Vf,ck,Hf,dk,Wf,uk,qf,hk,Gf,fk,Yf,mk,pk,gk,xk,bk,yk,vk,Kf,wk,Xf,kk,Ck,Sk,Jf,jk,Zf,Nk,Qf,Ek,em,_k,tm,Ik,Ak,Tk,Mk,Ok;function nm(){if(Aw)return vf;Aw=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 vf=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))}},vf}function c7(){return Dw?Ow:(Dw=1,Ow={Graph:nm(),version:Mw?Tw:(Mw=1,Tw="2.2.4")})}function d7(){if(Rw)return wf;Rw=1;var t=nm();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 wf={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}},wf}function u7(){return Pw||(Pw=1,kf=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}),kf}function Dk(){return Lw?Cf:(Lw=1,Cf=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}},Cf)}function Rk(){if(Fw)return Sf;Fw=1;var t=Dk();Sf=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 Sf}function h7(){if(zw)return jf;zw=1;var t=Rk();return jf=function(e,n,o){return e.nodes().reduce(function(r,s){return r[s]=t(e,s,n,o),r},{})},jf}function Pk(){return Bw||(Bw=1,Nf=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}),Nf}function f7(){if(Uw)return Ef;Uw=1;var t=Pk();return Ef=function(e){return t(e).filter(function(n){return n.length>1||n.length===1&&e.hasEdge(n[0],n[0])})},Ef}function m7(){if($w)return _f;$w=1,_f=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 _f}function Lk(){if(Vw)return If;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}Vw=1;class e extends Error{constructor(){super(...arguments)}}return If=t,t.CycleException=e,If}function p7(){if(Hw)return Af;Hw=1;var t=Lk();return Af=function(e){try{t(e)}catch(n){if(n instanceof t.CycleException)return!1;throw n}return!0},Af}function Fk(){if(Ww)return Tf;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 Ww=1,Tf=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},Tf}function g7(){if(qw)return Mf;qw=1;var t=Fk();return Mf=function(e,n){return t(e,n,"post")},Mf}function x7(){if(Gw)return Of;Gw=1;var t=Fk();return Of=function(e,n){return t(e,n,"pre")},Of}function b7(){if(Yw)return Df;Yw=1;var t=nm(),e=Dk();return Df=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},Df}function Pn(){if(Zw)return Jw;Zw=1;var t=c7();return Jw={Graph:t.Graph,json:d7(),alg:Xw?Kw:(Xw=1,Kw={components:u7(),dijkstra:Rk(),dijkstraAll:h7(),findCycles:f7(),floydWarshall:m7(),isAcyclic:p7(),postorder:g7(),preorder:x7(),prim:b7(),tarjan:Pk(),topsort:Lk()}),version:t.version}}function y7(){if(tk)return Rf;tk=1;let t=Pn().Graph,e=function(){if(ek)return Qw;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 ek=1,Qw=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(", ")+"]"}}}();Rf=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 Rf}function It(){if(nk)return Pf;nk=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}Pf={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 Pf}function v7(){if(ok)return Lf;ok=1;let t=y7(),e=It().uniqueId;return Lf={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)}})}},Lf}function w7(){if(rk)return Ff;rk=1;let t=It();return Ff={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)})}},Ff}function ql(){if(sk)return zf;sk=1;const{applyWithChunking:t}=It();return zf={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}},zf}function zk(){if(ik)return Bf;ik=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 Bf=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},Bf}function k7(){if(ak)return Uf;ak=1;var t=zk(),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,S){var C=v.node(S),N=C.parent;v.edge(S,N).cutvalue=l(v,w,S)}(x,p,y))}function l(x,p,b){var y=x.node(b).parent,v=!0,w=p.edge(b,y),S=0;return w||(v=!1,w=p.edge(y,b)),S=w.weight,p.nodeEdges(b).forEach(C=>{var N,j,_=C.v===b,O=_?C.w:C.v;if(O!==y){var A=_===v,R=p.edge(C).weight;if(S+=A?R:-R,N=b,j=O,x.hasEdge(N,j)){var P=x.edge(b,O).cutvalue;S+=A?-P:P}}}),S}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,S=x.node(y);return p[y]=!0,x.neighbors(y).forEach(C=>{Object.hasOwn(p,C)||(b=d(x,p,b,C,y))}),S.low=w,S.lim=b++,v?S.parent=v:delete S.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),S=x.node(v),C=w,N=!1;w.lim>S.lim&&(C=S,N=!0);var j=p.edges().filter(_=>N===g(x,x.node(_.v),C)&&N!==g(x,x.node(_.w),C));return j.reduce((_,O)=>e(p,O)<e(p,_)?O:_)}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(S,C){var N=S.nodes().find(_=>!C.node(_).parent),j=o(S,N);(j=j.slice(1)).forEach(_=>{var O=S.node(_).parent,A=C.edge(_,O),R=!1;A||(A=C.edge(O,_),R=!0),C.node(_).rank=C.node(O).rank+(R?A.minlen:-A.minlen)})}(x,p)}function g(x,p,b){return b.low<=p.lim&&p.lim<=b.lim}return Uf=i,i.initLowLimValues=c,i.initCutValues=a,i.calcCutValue=l,i.leaveEdge=h,i.enterEdge=f,i.exchangeEdges=m,Uf}function C7(){if(lk)return $f;lk=1;var t=ql().longestPath,e=zk(),n=k7();$f=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 $f}function S7(){return ck||(ck=1,Vf=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]}})}),Vf}function j7(){if(dk)return Hf;dk=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 Hf={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)})}},Hf}function N7(){if(hk)return qf;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 hk=1,qf={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))}},qf}function E7(){if(bk)return xk;bk=1;let t=It();return xk=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 _7(){if(wk)return Kf;wk=1;let t=(gk||(gk=1,pk=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}})}),pk),e=E7(),n=function(){if(vk)return yk;vk=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 yk=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 Kf=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},Kf}function I7(){if(kk)return Xf;kk=1;let t=Pn().Graph,e=It();return Xf=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},Xf}function A7(){if(jk)return Jf;jk=1;let t=function(){if(fk)return Gf;fk=1;let d=It();return Gf=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},Gf}(),e=function(){if(mk)return Yf;mk=1;let d=It().zipObject;function h(f,m,g){let x=d(g,g.map((S,C)=>C)),p=m.flatMap(S=>f.outEdges(S).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(S=>{let C=S.pos+b;v[C]+=S.weight;let N=0;for(;C>0;)C%2&&(N+=v[C+1]),C=C-1>>1,v[C]+=S.weight;w+=S.weight*N}),w}return Yf=function(f,m){let g=0;for(let x=1;x<m.length;++x)g+=h(f,m[x-1],m[x]);return g},Yf}(),n=_7(),o=I7(),r=(Sk||(Sk=1,Ck=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}})}),Ck),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 Jf=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 S=e(h,p);S<y&&(w=0,b=Object.assign({},p),y=S)}c(h,b)},Jf}function T7(){if(Nk)return Zf;Nk=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,S)=>{let C=function(j,_){if(j.node(_).dummy)return j.predecessors(_).find(O=>j.node(O).dummy)}(h,w),N=C?h.node(C).order:y;(C||w===v)&&(x.slice(b,S+1).forEach(j=>{h.predecessors(j).forEach(_=>{let O=h.node(_),A=O.order;!(A<p||N<A)||O.dummy&&h.node(j).dummy||r(m,_,j)})}),b=S+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(S=>{w=x[S],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,S)=>{if(h.node(w).dummy==="border"){let C=h.predecessors(w);C.length&&(b=h.node(C[0]).order,g(p,v,S,y,b),v=S,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 S=g(w);if(S.length){S=S.sort((N,j)=>b[N]-b[j]);let C=(S.length-1)/2;for(let N=Math.floor(C),j=Math.ceil(C);N<=j;++N){let _=S[N];p[w]===w&&v<b[_]&&!s(m,w,_)&&(p[_]=w,p[w]=x[w]=x[_],v=b[_])}}})}),{root:x,align:p}}function a(h,f,m,g,x){let p={},b=function(w,S,C,N){let j=new t,_=w.graph(),O=function(A,R,P){return(T,D,L)=>{let z,E=T.node(D),k=T.node(L),B=0;if(B+=E.width/2,Object.hasOwn(E,"labelpos"))switch(E.labelpos.toLowerCase()){case"l":z=-E.width/2;break;case"r":z=E.width/2}if(z&&(B+=P?z:-z),z=0,B+=(E.dummy?R:A)/2,B+=(k.dummy?R:A)/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+=P?z:-z),z=0,B}}(_.nodesep,_.edgesep,N);return S.forEach(A=>{let R;A.forEach(P=>{let T=C[P];if(j.setNode(T),R){var D=C[R],L=j.edge(D,T);j.setEdge(D,T,Math.max(O(w,P,R),L||0))}R=P})}),j}(h,f,m,x),y=x?"borderLeft":"borderRight";function v(w,S){let C=b.nodes(),N=C.pop(),j={};for(;N;)j[N]?w(N):(j[N]=!0,C.push(N),C=C.concat(S(N))),N=C.pop()}return v(function(w){p[w]=b.inEdges(w).reduce((S,C)=>Math.max(S,p[C.v]+b.edge(C)),0)},b.predecessors.bind(b)),v(function(w){let S=b.outEdges(w).reduce((N,j)=>Math.min(N,p[j.w]-b.edge(j)),Number.POSITIVE_INFINITY),C=h.node(w);S!==Number.POSITIVE_INFINITY&&C.borderType!==y&&(p[w]=Math.max(p[w],S))},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(S,C){return S.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),S=g-e.applyWithChunking(Math.min,w);b!=="l"&&(S=x-e.applyWithChunking(Math.max,w)),S&&(h[y]=e.mapValues(v,C=>C+S))})})}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 Zf={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),S=a(h,f,w.root,w.align,y==="r");y==="r"&&(S=e.mapValues(S,C=>-C)),x[b+y]=S})});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},Zf}function M7(){if(Ek)return Qf;Ek=1;let t=It(),e=T7().positionX;return Qf=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)},Qf}function O7(){if(_k)return em;_k=1;let t=v7(),e=w7(),n=C7(),o=It().normalizeRanks,r=S7(),s=It().removeEmptyRanks,i=j7(),a=function(){if(uk)return Wf;uk=1;let N=It();function j(_,O,A,R,P,T){let D={width:0,height:0,rank:T,borderType:O},L=P[O][T-1],z=N.addDummyNode(_,"border",D,A);P[O][T]=z,_.setParent(z,R),L&&_.setEdge(L,z,{weight:1})}return Wf=function(_){_.children().forEach(function O(A){let R=_.children(A),P=_.node(A);if(R.length&&R.forEach(O),Object.hasOwn(P,"minRank")){P.borderLeft=[],P.borderRight=[];for(let T=P.minRank,D=P.maxRank+1;T<D;++T)j(_,"borderLeft","_bl",A,P,T),j(_,"borderRight","_br",A,P,T)}})},Wf}(),l=N7(),c=A7(),d=M7(),h=It(),f=Pn().Graph;em=function(N,j){let _=j&&j.debugTiming?h.time:h.notime;_("layout",()=>{let O=_(" buildLayoutGraph",()=>function(A){let R=new f({multigraph:!0,compound:!0}),P=C(A.graph());return R.setGraph(Object.assign({},g,S(P,m),h.pick(P,x))),A.nodes().forEach(T=>{const D=S(C(A.node(T)),p);Object.keys(b).forEach(L=>{D[L]===void 0&&(D[L]=b[L])}),R.setNode(T,D),R.setParent(T,A.parent(T))}),A.edges().forEach(T=>{let D=C(A.edge(T));R.setEdge(T,Object.assign({},v,S(D,y),h.pick(D,w)))}),R}(N));_(" runLayout",()=>function(A,R,P){R(" makeSpaceForEdgeLabels",()=>function(T){let D=T.graph();D.ranksep/=2,T.edges().forEach(L=>{let z=T.edge(L);z.minlen*=2,z.labelpos.toLowerCase()!=="c"&&(D.rankdir==="TB"||D.rankdir==="BT"?z.width+=z.labeloffset:z.height+=z.labeloffset)})}(A)),R(" removeSelfEdges",()=>function(T){T.edges().forEach(D=>{if(D.v===D.w){var L=T.node(D.v);L.selfEdges||(L.selfEdges=[]),L.selfEdges.push({e:D,label:T.edge(D)}),T.removeEdge(D)}})}(A)),R(" acyclic",()=>t.run(A)),R(" nestingGraph.run",()=>i.run(A)),R(" rank",()=>n(h.asNonCompoundGraph(A))),R(" injectEdgeLabelProxies",()=>function(T){T.edges().forEach(D=>{let L=T.edge(D);if(L.width&&L.height){let z=T.node(D.v),E={rank:(T.node(D.w).rank-z.rank)/2+z.rank,e:D};h.addDummyNode(T,"edge-proxy",E,"_ep")}})}(A)),R(" removeEmptyRanks",()=>s(A)),R(" nestingGraph.cleanup",()=>i.cleanup(A)),R(" normalizeRanks",()=>o(A)),R(" assignRankMinMax",()=>function(T){let D=0;T.nodes().forEach(L=>{let z=T.node(L);z.borderTop&&(z.minRank=T.node(z.borderTop).rank,z.maxRank=T.node(z.borderBottom).rank,D=Math.max(D,z.maxRank))}),T.graph().maxRank=D}(A)),R(" removeEdgeLabelProxies",()=>function(T){T.nodes().forEach(D=>{let L=T.node(D);L.dummy==="edge-proxy"&&(T.edge(L.e).labelRank=L.rank,T.removeNode(D))})}(A)),R(" normalize.run",()=>e.run(A)),R(" parentDummyChains",()=>r(A)),R(" addBorderSegments",()=>a(A)),R(" order",()=>c(A,P)),R(" insertSelfEdges",()=>function(T){var D=h.buildLayerMatrix(T);D.forEach(L=>{var z=0;L.forEach((E,k)=>{var B=T.node(E);B.order=k+z,(B.selfEdges||[]).forEach(I=>{h.addDummyNode(T,"selfedge",{width:I.label.width,height:I.label.height,rank:B.rank,order:k+ ++z,e:I.e,label:I.label},"_se")}),delete B.selfEdges})})}(A)),R(" adjustCoordinateSystem",()=>l.adjust(A)),R(" position",()=>d(A)),R(" positionSelfEdges",()=>function(T){T.nodes().forEach(D=>{var L=T.node(D);if(L.dummy==="selfedge"){var z=T.node(L.e.v),E=z.x+z.width/2,k=z.y,B=L.x-E,I=z.height/2;T.setEdge(L.e,L.label),T.removeNode(D),L.label.points=[{x:E+2*B/3,y:k-I},{x:E+5*B/6,y:k-I},{x:E+B,y:k},{x:E+5*B/6,y:k+I},{x:E+2*B/3,y:k+I}],L.label.x=L.x,L.label.y=L.y}})}(A)),R(" removeBorderNodes",()=>function(T){T.nodes().forEach(D=>{if(T.children(D).length){let L=T.node(D),z=T.node(L.borderTop),E=T.node(L.borderBottom),k=T.node(L.borderLeft[L.borderLeft.length-1]),B=T.node(L.borderRight[L.borderRight.length-1]);L.width=Math.abs(B.x-k.x),L.height=Math.abs(E.y-z.y),L.x=k.x+L.width/2,L.y=z.y+L.height/2}}),T.nodes().forEach(D=>{T.node(D).dummy==="border"&&T.removeNode(D)})}(A)),R(" normalize.undo",()=>e.undo(A)),R(" fixupEdgeLabelCoords",()=>function(T){T.edges().forEach(D=>{let L=T.edge(D);if(Object.hasOwn(L,"x"))switch(L.labelpos!=="l"&&L.labelpos!=="r"||(L.width-=L.labeloffset),L.labelpos){case"l":L.x-=L.width/2+L.labeloffset;break;case"r":L.x+=L.width/2+L.labeloffset}})}(A)),R(" undoCoordinateSystem",()=>l.undo(A)),R(" translateGraph",()=>function(T){let D=Number.POSITIVE_INFINITY,L=0,z=Number.POSITIVE_INFINITY,E=0,k=T.graph(),B=k.marginx||0,I=k.marginy||0;function U(V){let X=V.x,Y=V.y,G=V.width,W=V.height;D=Math.min(D,X-G/2),L=Math.max(L,X+G/2),z=Math.min(z,Y-W/2),E=Math.max(E,Y+W/2)}T.nodes().forEach(V=>U(T.node(V))),T.edges().forEach(V=>{let X=T.edge(V);Object.hasOwn(X,"x")&&U(X)}),D-=B,z-=I,T.nodes().forEach(V=>{let X=T.node(V);X.x-=D,X.y-=z}),T.edges().forEach(V=>{let X=T.edge(V);X.points.forEach(Y=>{Y.x-=D,Y.y-=z}),Object.hasOwn(X,"x")&&(X.x-=D),Object.hasOwn(X,"y")&&(X.y-=z)}),k.width=L-D+B,k.height=E-z+I}(A)),R(" assignNodeIntersects",()=>function(T){T.edges().forEach(D=>{let L,z,E=T.edge(D),k=T.node(D.v),B=T.node(D.w);E.points?(L=E.points[0],z=E.points[E.points.length-1]):(E.points=[],L=B,z=k),E.points.unshift(h.intersectRect(k,L)),E.points.push(h.intersectRect(B,z))})}(A)),R(" reversePoints",()=>function(T){T.edges().forEach(D=>{let L=T.edge(D);L.reversed&&L.points.reverse()})}(A)),R(" acyclic.undo",()=>t.undo(A))}(O,_,j)),_(" updateInputGraph",()=>function(A,R){A.nodes().forEach(P=>{let T=A.node(P),D=R.node(P);T&&(T.x=D.x,T.y=D.y,T.rank=D.rank,R.children(P).length&&(T.width=D.width,T.height=D.height))}),A.edges().forEach(P=>{let T=A.edge(P),D=R.edge(P);T.points=D.points,Object.hasOwn(D,"x")&&(T.x=D.x,T.y=D.y)}),A.graph().width=R.graph().width,A.graph().height=R.graph().height}(N,O))})};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 S(N,j){return h.mapValues(h.pick(N,j),Number)}function C(N){var j={};return N&&Object.entries(N).forEach(([_,O])=>{typeof _=="string"&&(_=_.toLowerCase()),j[_]=O}),j}return em}function D7(){if(Ik)return tm;Ik=1;let t=It(),e=Pn().Graph;return tm={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}},tm}var Bk=Ok?Mk:(Ok=1,Mk={graphlib:Pn(),layout:O7(),debug:D7(),util:{time:It().time,notime:It().notime},version:Tk?Ak:(Tk=1,Ak="1.1.5")});const Ii=new Bk.graphlib.Graph().setDefaultEdgeLabel(()=>({})),Uk=({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})),Bk.layout(Ii),{nodes:t.map(o=>{const{x:r,y:s}=Ii.node(o.id);return{...o,position:{x:r,y:s}}}),edges:e}),$k=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:xf(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 np.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}}},R7=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=$k.createElements(n,r,o,a.hidePureMarkdown);return k=Uk({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]=vw(c.nodes),[m,g,x]=ww(c.edges),p=Ni();let b;e[6]!==i||e[7]!==g||e[8]!==h?(b=k=>{const B=Uk({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=Le(b);let v,w;e[10]!==r||e[11]!==n||e[12]!==a.hidePureMarkdown||e[13]!==y||e[14]!==o?(v=()=>{y($k.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[S,C]=M.useState();let N;_w(),e[17]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{C(void 0)},e[17]=N):N=e[17];const j=N;let _,O,A,R,P,T,D,L,z,E;return e[18]===Symbol.for("react.memo_cache_sentinel")?(_={minZoom:.5,maxZoom:1.5},O=(k,B)=>{C({type:"node",id:B.id})},A=(k,B)=>{const{source:I,target:U}=B;C({type:"edge",source:I,target:U})},e[18]=_,e[19]=O,e[20]=A):(_=e[18],O=e[19],A=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(R=u.jsx(t7,{color:"#ccc",variant:En.Dots}),e[21]=R):R=e[21],e[22]!==p||e[23]!==d?(P=()=>{const k=Qe.get(xL);if(k){const B=d.find(I=>I.id===k);B&&(p.fitView({padding:1,duration:600,nodes:[B]}),C({type:"node",id:k}))}},e[22]=p,e[23]=d,e[24]=P):P=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(T=u.jsx(Lp,{className:"size-4"}),e[25]=T):T=e[25],e[26]!==P?(D=u.jsx(KM,{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:Bn.preventFocus,onClick:P,children:T})})}),e[26]=P,e[27]=D):D=e[27],e[28]!==m||e[29]!==S||e[30]!==o?(L=u.jsx(Wl,{selection:S,variables:o,edges:m,onClearSelection:j}),e[28]=m,e[29]=S,e[30]=o,e[31]=L):L=e[31],e[32]!==s||e[33]!==m||e[34]!==d||e[35]!==x||e[36]!==f||e[37]!==D||e[38]!==L?(z=u.jsxs(gf,{nodes:d,edges:m,nodeTypes:Nw,minZoom:.2,fitViewOptions:_,onNodeClick:O,onEdgeClick:A,onNodeDoubleClick:P7,fitView:!0,onNodesChange:f,onEdgesChange:x,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[R,D,L,s]}),e[32]=s,e[33]=m,e[34]=d,e[35]=x,e[36]=f,e[37]=D,e[38]=L,e[39]=z):z=e[39],e[40]!==i||e[41]!==z?(E=u.jsx(Sw,{value:i,children:z}),e[40]=i,e[41]=z,e[42]=E):E=e[42],E};function P7(t,e){KC(e.id,"focus")}const L7=St("_minimap_"),F7=St({hidePureMarkdown:!0}),z7=t=>{const e=H.c(11),[n,o]=zt(L7),[r,s]=zt(F7);let i;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(i=()=>n==="_minimap_"?u.jsx(i7,{...t,children:u.jsx(yf,{settings:r,onSettingsChange:s,view:n,onChange:o})}):u.jsx(R7,{...t,settings:r,layoutDirection:n,children:u.jsx(yf,{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(pf,{children:l},n),e[8]=n,e[9]=l,e[10]=c):c=e[10],c},B7=()=>{const t=H.c(5),e=sp(),n=wr(),[o]=bL();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(z7,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},U7=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},$7=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(Cc)[d];if(h)return h.declaredBy[0]}(n);if(!l)return;const c=Ri(l);c&&rp(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},V7=St(t=>{const e=t(yL),n=t(Cc),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})}),H7=St(t=>{const e=new Map(t(vL));for(const n of XC){const o=e.get(n);o&&(o.databases.length===0&&e.delete(n),o.databases.length===1&&o.databases[0].name===wL&&o.databases[0].schemas.length===0&&e.delete(n))}return la([...e.values()],n=>XC.has(n.name)?1:0)}),W7=()=>{const t=H.c(32),[e,n]=q.useState(""),o=Ct(JC),r=Ne(V7),s=Ne(H7);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(Wg,{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(Wg,{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(q7,{connection:y,hasChildren:y.databases.length>0,children:y.databases.map(v=>u.jsx(G7,{engineName:y.name,database:v,hasSearch:i,children:u.jsx(Y7,{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(ZC,{children:[u.jsx(oc,{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(Vk,{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(Wm,{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(vc,{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},q7=t=>{const e=H.c(26),{connection:n,children:o,hasChildren:r}=t,s=n.name===kL,i=s?"In-Memory":n.name,{previewDataSourceConnection:a}=ot(),[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(z3,{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=CL(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($7,{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(ZC,{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},G7=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(rS,{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,S,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?(S=u.jsx("span",{className:v,children:w}),e[16]=v,e[17]=w,e[18]=S):S=e[18],e[19]!==S||e[20]!==f||e[21]!==m||e[22]!==g||e[23]!==b?(C=u.jsxs(Qn,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:m,children:[g,b,S]}),e[19]=S,e[20]=f,e[21]=m,e[22]=g,e[23]=b,e[24]=C):C=e[24];const N=i&&s;let j;return e[25]!==C||e[26]!==N?(j=u.jsxs(u.Fragment,{children:[C,N]}),e[25]=C,e[26]=N,e[27]=j):j=e[27],j},Y7=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(K7,{databaseName:i,schema:g,hasSearch:a,children:u.jsx(Vk,{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},K7=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),oS(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(rS,{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(AL,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&i&&"font-semibold";let v,w,S;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?(S=u.jsxs(Qn,{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]=S):S=e[22];const C=i&&r;let N;return e[23]!==S||e[24]!==C?(N=u.jsxs(u.Fragment,{children:[S,C]}),e[23]=S,e[24]=C,e[25]=N):N=e[25],N},Vk=t=>{const e=H.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=QC(),[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 qF.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}=Mn(d,h);if(f||l){let p;return e[9]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(eS,{message:"Loading tables...",className:"pl-12"}),e[9]=p):p=e[9],p}if(m){let p;return e[10]!==m?(p=u.jsx(tS,{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(X7,{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},X7=t=>{const e=H.c(64),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=QC(),[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 GF.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}=Mn(h,f),p=Ne(tc),b=fs(),{createNewCell:y}=lt(),v=nS();let w;e[10]!==v||e[11]!==p||e[12]!==y||e[13]!==b||e[14]!==o||e[15]!==n?(w=()=>{Zn({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 sS({table:n,columnName:"*",sqlTableContext:o});switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return sS({table:n,columnName:"*",sqlTableContext:o});default:return fc(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 S=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 j;e[20]!==x||e[21]!==m||e[22]!==g||e[23]!==o||e[24]!==n?(j=()=>{if(g||m)return u.jsx(eS,{message:"Loading columns...",className:"pl-12"});if(x)return u.jsx(tS,{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(J7,{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]=j):j=e[25];const _=j;let O;e[26]!==i||e[27]!==r||e[28]!==n.source_type||e[29]!==n.type?(O=()=>{if(n.source_type==="local")return;const W=n.type==="table"?SL:mm;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]=O):O=e[30];const A=O,R=o?`${o.database}.${o.schema}.${n.name}`:n.name,P=o&&(oS(o.schema)?"pl-9":"pl-12"),T=(i||r)&&"font-semibold";let D,L,z,E,k,B,I,U,V,X,Y,G;return e[31]!==P||e[32]!==T?(D=xe("rounded-none group h-8 cursor-pointer",P,T),e[31]=P,e[32]=T,e[33]=D):D=e[33],e[34]!==i?(L=()=>a(!i),e[34]=i,e[35]=L):L=e[35],e[36]!==A?(z=A(),e[36]=A,e[37]=z):z=e[37],e[38]!==n.name?(E=u.jsx("span",{className:"text-sm",children:n.name}),e[38]=n.name,e[39]=E):E=e[39],e[40]!==z||e[41]!==E?(k=u.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[z,E]}),e[40]=z,e[41]=E,e[42]=k):k=e[42],e[43]!==N?(B=N(),e[43]=N,e[44]=B):B=e[44],e[45]!==S?(I=Bn.stopPropagation(()=>S()),e[45]=S,e[46]=I):I=e[46],e[47]===Symbol.for("react.memo_cache_sentinel")?(U=u.jsx(jL,{className:"h-3 w-3"}),e[47]=U):U=e[47],e[48]!==I?(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:I,children:U})}),e[48]=I,e[49]=V):V=e[49],e[50]!==i||e[51]!==L||e[52]!==k||e[53]!==B||e[54]!==V||e[55]!==D||e[56]!==R?(X=u.jsxs(Qn,{className:D,value:R,"aria-selected":i,forceMount:!0,onSelect:L,children:[k,B,V]}),e[50]=i,e[51]=L,e[52]=k,e[53]=B,e[54]=V,e[55]=D,e[56]=R,e[57]=X):X=e[57],e[58]!==i||e[59]!==_?(Y=i&&_(),e[58]=i,e[59]=_,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},J7=t=>{var I,U;const e=H.c(51),{table:n,column:o,sqlTableContext:r}=t,[s,i]=q.useState(!1),a=Ne(JC),l=Ct(NL);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=nS(),{columnsPreviews:f}=EL();let m;e[3]!==o.name||e[4]!==n.primary_keys?(m=((I=n.primary_keys)==null?void 0:I.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=Z7,w=s?"font-semibold":"";let S;e[11]!==o.name||e[12]!==w?(S=u.jsx("span",{className:w,children:o.name}),e[11]=o.name,e[12]=w,e[13]=S):S=e[13];const C=S,N=`${n.name}.${o.name}`,j=`${n.name}.${o.name}`;let _;e[14]!==s?(_=()=>i(!s),e[14]=s,e[15]=_):_=e[15];const O=r?"pl-14":"pl-7";let A,R,P,T,D,L,z,E,k,B;return e[16]!==O?(A=xe("flex flex-row gap-2 items-center flex-1",O),e[16]=O,e[17]=A):A=e[17],e[18]!==o.type||e[19]!==C?(R=u.jsx(_L,{columnName:C,dataType:o.type}),e[18]=o.type,e[19]=C,e[20]=R):R=e[20],e[21]!==g?(P=g&&v({tooltipContent:"Primary key",content:"PK"}),e[21]=g,e[22]=P):P=e[22],e[23]!==p?(T=p&&v({tooltipContent:"Indexed",content:"IDX"}),e[23]=p,e[24]=T):T=e[24],e[25]!==A||e[26]!==R||e[27]!==P||e[28]!==T?(D=u.jsxs("div",{className:A,children:[R,P,T]}),e[25]=A,e[26]=R,e[27]=P,e[28]=T,e[29]=D):D=e[29],e[30]!==o.name?(L=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(qC,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[30]=o.name,e[31]=L):L=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[35]!==D||e[36]!==L||e[37]!==z||e[38]!==N||e[39]!==j?(E=u.jsxs(Qn,{className:"rounded-none py-1 group cursor-pointer",value:j,onSelect:_,children:[D,L,z]},N),e[34]=_,e[35]=D,e[36]=L,e[37]=z,e[38]=N,e[39]=j,e[40]=E):E=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(wc,{children:u.jsx(IL,{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||e[49]!==k?(B=u.jsxs(u.Fragment,{children:[E,k]}),e[48]=E,e[49]=k,e[50]=B):B=e[50],B};function Z7(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 Q7=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(W7,{}),t[0]=e):e=t[0],e},e9=()=>{const t=H.c(5),{documentation:e}=Ne(TL);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=op({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},t9=()=>{const t=H.c(5),e=ML();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(Wp,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(n9),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 n9(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(OL,{cellId:t.cellId})}),u.jsx("div",{className:"px-2",children:u.jsx(DL,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}const om=new Map,o9=({file:t,onOpenNotebook:e})=>{const{theme:n}=vr(),{sendFileDetails:o,sendUpdateFile:r}=ot(),s=Ne(Fi),[i,a]=M.useState(""),{data:l,isPending:c,error:d,setData:h}=Mn(async()=>{const b=await o({path:t.path}),y=b.contents||"";return a(om.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?om.delete(t.path):om.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 rm;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(bc,{})})}),u.jsx(Ee,{content:"Download",children:u.jsx(cn,{size:"small",onClick:()=>{if(Hk(g)){const b=BL(l.contents,g);return void UL(b,l.file.name)}$i(new Blob([l.contents||i],{type:g}),l.file.name)},children:u.jsx(_m,{})})}),!Hk(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(RL,{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(PL,{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(LL,{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(FL,{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(zL,{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:rm[g]||rm.default,className:"border-b",extensions:[We.lineWrapping,In.of([{key:s.getHotkey("global.save").key,stopPropagation:!0,run:()=>i!==l.contents&&(f(),!0)}])],value:i,onChange:a})})})]})},Hk=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/")||t.startsWith("application/pdf"),rm={"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 r9{constructor(e){this.callbacks=e,this.delegate=new dp([]),this.rootPath="",this.onChange=Un.NOOP,this.path=new pc("/"),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 dp(o.files),this.rootPath=o.root,this.path=pc.guessDeliminator(o.root)}catch(o){Je({title:"Failed",description:kC(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 dp(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 Wk=St(t=>{const e=t($L);return $n(e,"no requestClientAtom set"),new r9({listFiles:e.sendListFiles,createFileOrFolder:e.sendCreateFileOrFolder,deleteFileOrFolder:e.sendDeleteFileOrFolder,renameFileOrFolder:e.sendRenameFileOrFolder})}),s9=St({});function i9(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 qk(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}=ot();let s,i;return e[2]!==r?(s=async a=>{for(const l of a){const c=h9(u9(l));let d="";c&&(d=pc.guessDeliminator(c).dirname(c));const h=(await i9(l)).split(",")[1];await r({path:d,type:"file",name:l.name,contents:h})}await async function(){await Qe.get(Wk).refreshAll([])}()},e[2]=r,e[3]=s):s=e[3],e[4]!==o||e[5]!==s?(i={multiple:!0,maxSize:104857600,onError:d9,onDropRejected:a9,onDrop:s,...o},e[4]=o,e[5]=s,e[6]=i):i=e[6],VL(i)}function a9(t){Je({title:"File upload failed",description:u.jsx("div",{className:"flex flex-col gap-1",children:t.map(l9)}),variant:"danger"})}function l9(t){return u.jsxs("div",{children:[t.file.name," (",t.errors.map(c9).join(", "),")"]},t.file.name)}function c9(t){return t.message}function d9(t){ct.error(t),Je({title:"File upload failed",description:t.message,variant:"danger"})}function u9(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 h9(t){if(t)return t.replace(/^\/+/,"")}const Gk=q.createContext(null),f9=t=>{const e=H.c(60),{height:n}=t,o=M.useRef(null),[r]=zt(Wk);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}=Tn(),[h,f]=zt(s9);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}=Mn(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=Le(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=Le(v);let S;e[10]!==d||e[11]!==r?(S=async()=>{d({title:"File name",onConfirm:async k=>{r.createFile(k,null)}})},e[10]=d,e[11]=r,e[12]=S):S=e[12];const C=Le(S);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 j=Le(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,I,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?(I=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]=I):I=e[21],e[22]!==l.path||e[23]!==r?(U=Y=>Yk(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(o9,{onOpenNotebook:U,file:l})}),e[25]=l,e[26]=U,e[27]=V):V=e[27],e[28]!==I||e[29]!==V?(X=u.jsxs(u.Fragment,{children:[I,V]}),e[28]=I,e[29]=V,e[30]=X):X=e[30],X}let _;e[31]!==j||e[32]!==C||e[33]!==w||e[34]!==y||e[35]!==r?(_=u.jsx(p9,{onRefresh:y,onCreateFile:C,onCreateFolder:w,onCollapseAll:j,tree:r}),e[31]=j,e[32]=C,e[33]=w,e[34]=y,e[35]=r,e[36]=_):_=e[36];const O=n-33;let A,R,P,T,D,L,z,E;return e[37]!==r?(A=async k=>{const{ids:B}=k;for(const I of B)await r.delete(I)},R=async k=>{const{id:B,name:I}=k;await r.rename(B,I)},P=async k=>{const{dragIds:B,parentId:I}=k;await r.move(B,I)},e[37]=r,e[38]=A,e[39]=R,e[40]=P):(A=e[38],R=e[39],P=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(T=k=>{const B=k[0];B&&(B.data.isDirectory||c(B.data))},e[41]=T):T=e[41],e[42]!==h||e[43]!==f||e[44]!==r?(D=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]=D):D=e[45],e[46]!==i||e[47]!==h||e[48]!==A||e[49]!==R||e[50]!==P||e[51]!==D||e[52]!==O?(L=u.jsx(IF,{width:"100%",ref:o,height:O,className:"h-full",data:i,initialOpenState:h,openByDefault:!1,renderCursor:v9,disableDrop:w9,onDelete:A,onRename:R,onMove:P,onSelect:T,onToggle:D,padding:15,rowHeight:30,indent:m9,overscanCount:1e3,disableMultiSelection:!0,children:b9}),e[46]=i,e[47]=h,e[48]=A,e[49]=R,e[50]=P,e[51]=D,e[52]=O,e[53]=L):L=e[53],e[54]!==L||e[55]!==r?(z=u.jsx(Gk,{value:r,children:L}),e[54]=L,e[55]=r,e[56]=z):z=e[56],e[57]!==z||e[58]!==_?(E=u.jsxs(u.Fragment,{children:[_,z]}),e[57]=z,e[58]=_,e[59]=E):E=e[59],E},m9=15,p9=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}=qk(i);let c,d,h,f,m,g,x,p,b,y,v,w,S,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=HL({variant:"text",size:"xs"}),x=u.jsx(qL,{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(AC,{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")?(S=u.jsx(Cp,{size:16}),e[20]=S):S=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:S})}),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},g9=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(bc,{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},x9=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:k9,onBlur:i,onKeyDown:a}),e[6]=n.data.name,e[7]=i,e[8]=a,e[9]=l):l=e[9],l},b9=({node:t,style:e,dragHandle:n})=>{const{openFile:o,sendCreateFileOrFolder:r,sendFileDetails:s}=ot(),i=t.data.isDirectory?"directory":q3(t.data.name),a=G3[i],{openConfirm:l,openPrompt:c}=Tn(),{createNewCell:d}=lt(),h=fs(),f=M.use(Gk),m=async y=>{Yk(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(U3,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},x=Le(async()=>{t.open(),c({title:"Folder name",onConfirm:async y=>{f==null||f.createFolder(y,t.id)}})}),p=Le(async()=>{t.open(),c({title:"File name",onConfirm:async y=>{f==null||f.createFile(y,t.id)}})}),b=Le(async()=>{var S;if(!f||t.data.isDirectory)return;const[y,v]=WL(t.data.name),w=`${y}_copy${v}`;try{const C=await s({path:t.data.path}),N=((S=t.parent)==null?void 0:S.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(y9,{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:YF,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(x9,{node:t}):u.jsx(g9,{node:t,onOpenMarimoFile:m}),u.jsxs(_o,{modal:!1,children:[u.jsx(Io,{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(Ao,{align:"end",className:"no-print w-[220px]",onClick:v=>v.stopPropagation(),onCloseAutoFocus:v=>v.preventDefault(),children:[!t.data.isDirectory&&u.jsxs(Tt,{onSelect:()=>t.select(),children:[u.jsx(ig,{...y}),"Open file"]}),!t.data.isDirectory&&!tn()&&u.jsxs(Tt,{onSelect:()=>{o({path:t.data.path})},children:[u.jsx(bc,{...y}),"Open file in external editor"]}),t.data.isDirectory&&u.jsxs(u.Fragment,{children:[u.jsxs(Tt,{onSelect:()=>p(),children:[u.jsx(ua,{...y}),"Create file"]}),u.jsxs(Tt,{onSelect:()=>x(),children:[u.jsx(td,{...y}),"Create folder"]}),u.jsx(an,{})]}),u.jsxs(Tt,{onSelect:()=>t.edit(),children:[u.jsx(qp,{...y}),"Rename"]}),!t.data.isDirectory&&u.jsxs(Tt,{onSelect:b,children:[u.jsx(Mi,{...y}),"Duplicate"]}),u.jsxs(Tt,{onSelect:async()=>{await sn(t.data.path),Je({title:"Copied to clipboard"})},children:[u.jsx(rd,{...y}),"Copy path"]}),f&&u.jsxs(Tt,{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(Tt,{onSelect:()=>{const{path:v}=t.data;(w=>{d({code:w,before:!1,cellId:h??"__end__"})})(iS[i](v))},children:[u.jsx(Nr,{...y}),"Insert snippet for reading file"]}),u.jsxs(Tt,{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=iS[i](v);await sn(w)},children:[u.jsx(GL,{...y}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!tn()&&u.jsxs(u.Fragment,{children:[u.jsx(an,{}),u.jsxs(Tt,{onSelect:m,children:[u.jsx(tg,{...y}),"Open notebook"]})]}),u.jsx(an,{}),!t.data.isDirectory&&u.jsxs(u.Fragment,{children:[u.jsxs(Tt,{onSelect:async()=>{const v=(await s({path:t.data.path})).contents||"";$i(new Blob([v]),t.data.name)},children:[u.jsx(_m,{...y}),"Download"]}),u.jsx(an,{})]}),u.jsxs(Tt,{onSelect:g,variant:"danger",children:[u.jsx(sc,{...y}),"Delete"]})]})})()]})]})]})},y9=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(Eo,{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 Yk(t,e){t.stopPropagation(),t.preventDefault(),pS(e)}function v9(){return null}function w9(t){const{parentNode:e}=t;return!e.data.isDirectory}function k9(t){return t.stopPropagation()}let Kk,Xk,Jk;Kk=()=>{const t=H.c(20),{ref:e,height:n}=YL(),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}=qk(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(f9,{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},xp=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},Xk=()=>{const t=H.c(9),e=KL(),{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(hm,{})}),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(xp,{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(Jk,{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},Jk=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(j9),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 C9(t){const e=XL(t.timestamp),n=S9[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 S9={stdout:"text-(--grass-9)",stderr:"text-(--red-9)"};function j9(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:C9(t)})]},e)}const N9=()=>{const t=H.c(7),{items:e}=Ne(JL);let n,o;t[0]!==e?(o=KF(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s,activeOccurrences:i}=XF(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(JF,{items:e,activeHeaderId:s,activeOccurrences:i}),t[3]=s,t[4]=i,t[5]=e,t[6]=a):a=t[6],a},Zk=St(null),Qk=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=Bn.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},E9=()=>{var N,j;const t=H.c(30),[e]=br(),n=e.package_management.manager,{getDependencyTree:o,getPackageList:r}=ot(),[s,i]=q.useState(null);let a,l;t[0]!==o||t[1]!==r?(a=async()=>{const[_,O]=await Promise.all([r(),o()]);return{list:_.packages,tree:O.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}=Mn(a,l);if(f){let _;return t[5]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(kn,{size:"medium",centered:!0}),t[5]=_):_=t[5],_}if(d){let _;return t[6]!==d?(_=u.jsx(kr,{error:d}),t[6]=d,t[7]=_):_=t[7],_}const m=c.tree!=null;let g;t[8]!==m||t[9]!==s?(g=function(_,O){return _==="list"?"list":O?_||"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=(j=c==null?void 0:c.tree)==null?void 0:j.version,y=p==="<root>";let v,w,S,C;return t[11]!==n||t[12]!==h?(v=u.jsx(_9,{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?(S=x==="list"?u.jsx(I9,{packages:c.list,onSuccess:h}):u.jsx(A9,{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]=S):S=t[25],t[26]!==v||t[27]!==w||t[28]!==S?(C=u.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[v,w,S]}),t[26]=v,t[27]=w,t[28]=S,t[29]=C):C=t[29],C},_9=t=>{const e=H.c(40),{onSuccess:n,packageManager:o}=t,[r,s]=q.useState(""),{handleClick:i}=ia(),a=Ne(Zk),l=Ct(Zk);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}=ZL();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(T9),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,S,C,N,j,_,O,A,R,P,T,D;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(js,{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=I=>{I.key==="Enter"&&(I.preventDefault(),p())},e[13]=p,e[14]=v):v=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(w=I=>s(I.target.value),e[15]=w):w=e[15],e[16]!==r||e[17]!==b||e[18]!==y||e[19]!==v?(S=u.jsx(aS,{placeholder:b,id:$1,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]=S):S=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"})]}),j=u.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=N,e[23]=j):(N=e[22],j=e[23]),e[24]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsxs("div",{children:[j," ","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"})]}),O=u.jsx("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=_,e[25]=O):(_=e[24],O=e[25]),e[26]===Symbol.for("react.memo_cache_sentinel")?(A=u.jsxs("div",{children:[O," A Git repository",u.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),R=u.jsx("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=A,e[27]=R):(A=e[26],R=e[27]),e[28]===Symbol.for("react.memo_cache_sentinel")?(P=u.jsxs("div",{children:[R," A remote wheel or source distribution.",u.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),T=u.jsx("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=P,e[29]=T):(P=e[28],T=e[29]),e[30]===Symbol.for("react.memo_cache_sentinel")?(D=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,_,A,P,u.jsxs("div",{children:[T," 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(Qm,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=D):D=e[30];const L=r&&"bg-accent text-accent-foreground";let z;e[31]!==L?(z=xe("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",L,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=L,e[32]=z):z=e[32];const E=!r;let k,B;return e[33]!==p||e[34]!==z||e[35]!==E?(k=u.jsx("button",{type:"button",className:z,onClick:p,disabled:E,children:"Add"}),e[33]=p,e[34]=z,e[35]=E,e[36]=k):k=e[36],e[37]!==k||e[38]!==S?(B=u.jsxs("div",{className:"flex items-center w-full border-b",children:[S,D,k]}),e[37]=k,e[38]=S,e[39]=B):B=e[39],B},I9=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(js,{})}),e[0]=a):a=e[0],a}let r,s,i;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(ip,{children:u.jsxs(Ss,{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(Ss,{className:"group",onClick:async()=>{await sn(`${l.name}==${l.version}`),Je({title:"Copied to clipboard"})},children:[u.jsx(Sr,{children:l.name}),u.jsx(Sr,{children:l.version}),u.jsxs(Sr,{className:"flex justify-end",children:[u.jsx(e3,{packageName:l.name,onSuccess:n}),u.jsx(t3,{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(ap,{className:"overflow-auto flex-1",children:[r,u.jsx(lp,{children:s})]}),e[7]=s,e[8]=i):i=e[8],i},e3=({packageName:t,onSuccess:e})=>{const[n,o]=q.useState(!1),{addPackage:r}=ot();return tn()?null:u.jsx(Qk,{onClick:async()=>{try{o(!0);const s=await r({package:t,upgrade:!0});s.success?(e(),lS(t)):lS(t,s.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},t3=({packageName:t,onSuccess:e})=>{const[n,o]=q.useState(!1),{removePackage:r}=ot();return u.jsx(Qk,{onClick:async()=>{try{o(!0);const s=await r({package:t});s.success?(e(),cS(t)):cS(t,s.error)}finally{o(!1)}},loading:n,children:"Remove"})},A9=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(js,{})}),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(n3,{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},n3=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,S;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?(S=c?{}:{paddingLeft:`${m}px`},e[14]=m,e[15]=c,e[16]=S):S=e[16];const C=d?f:void 0;let N,j,_,O,A,R,P,T,D,L;return e[17]!==d||e[18]!==f?(N=d?f?u.jsx(Eo,{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?(j=u.jsx("span",{className:"font-medium truncate",children:o.name}),e[20]=o.name,e[21]=j):j=e[21],e[22]!==o.version?(_=o.version&&u.jsxs("span",{className:"text-muted-foreground text-xs",children:["v",o.version]}),e[22]=o.version,e[23]=_):_=e[23],e[24]!==j||e[25]!==_?(O=u.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[j,_]}),e[24]=j,e[25]=_,e[26]=O):O=e[26],e[27]!==o.tags?(A=o.tags.map(M9),e[27]=o.tags,e[28]=A):A=e[28],e[29]!==A?(R=u.jsx("div",{className:"flex items-center gap-1 ml-2",children:A}),e[29]=A,e[30]=R):R=e[30],e[31]!==c||e[32]!==o.name||e[33]!==l?(P=c&&u.jsxs("div",{className:"flex gap-1 invisible group-hover:visible",children:[u.jsx(e3,{packageName:o.name,onSuccess:l}),u.jsx(t3,{packageName:o.name,onSuccess:l})]}),e[31]=c,e[32]=o.name,e[33]=l,e[34]=P):P=e[34],e[35]!==b||e[36]!==x||e[37]!==N||e[38]!==O||e[39]!==R||e[40]!==P||e[41]!==w||e[42]!==S||e[43]!==C?(T=u.jsxs("div",{className:w,style:S,onClick:b,onKeyDown:x,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":C,children:[N,O,R,P]}),e[35]=b,e[36]=x,e[37]=N,e[38]=O,e[39]=R,e[40]=P,e[41]=w,e[42]=S,e[43]=C,e[44]=T):T=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?(D=d&&f&&u.jsx("div",{role:"group",children:o.dependencies.map((z,E)=>u.jsx(n3,{nodeId:`${n}-${E}`,node:z,level:r+1,isTopLevel:!1,expandedNodes:i,onToggle:a,onSuccess:l},`${z.name}-${E}`))}),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]=D):D=e[53],e[54]!==T||e[55]!==D?(L=u.jsxs("div",{children:[T,D]}),e[54]=T,e[55]=D,e[56]=L):L=e[56],L};function T9(t){return t.trim()}function M9(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 sm=fm("marimo:scratchpadHistory:v1",[]),O9=St(!1),D9=St(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(sm),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(sm,r)}),R9={hide_code:!1,disabled:!1},P9=()=>{const t=H.c(71),e=Rm(),[n]=br(),{theme:o}=vr(),r=M.useRef(null),s=fs(),{createNewCell:i,updateCellCode:a}=lt(),{sendRunScratchpad:l}=ot(),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(D9),[p,b]=zt(O9),y=Ne(sm);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=Le(v);let S;t[4]!==g||t[5]!==i||t[6]!==s?(S=()=>{g.trim()&&i({code:g,before:!1,cellId:s??"__end__"})},t[4]=g,t[5]=i,t[6]=s,t[7]=S):S=t[7];const C=Le(S);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 j=Le(N);let _;t[11]!==b||t[12]!==a?(_=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]=_):_=t[13];const O=Le(_),[A,R]=M.useState();let P;t[14]!==g||t[15]!==f||t[16]!==w||t[17]!==A||t[18]!==d||t[19]!==o||t[20]!==n?(P=()=>u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"overflow-auto shrink-0 max-h-[40%]",children:u.jsx(zu,{theme:o,showPlaceholder:!1,id:Zo,code:g,config:R9,status:"idle",serializedEditorState:null,runCell:w,userConfig:n,editorViewRef:r,setEditorView:ue=>{r.current=ue},hidden:!1,showHiddenCode:Un.NOOP,languageAdapter:A,setLanguageAdapter:R})}),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(fp,{consoleOutputs:f,className:"overflow-auto",stale:!1,cellName:C3,onSubmitDebugger:Un.NOOP,cellId:Zo,debuggerActive:!1})})]}),t[14]=g,t[15]=f,t[16]=w,t[17]=A,t[18]=d,t[19]=o,t[20]=n,t[21]=P):P=t[21];const T=P;let D;t[22]!==O||t[23]!==y||t[24]!==p||t[25]!==o?(D=()=>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:()=>O(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]=O,t[23]=y,t[24]=p,t[25]=o,t[26]=D):D=t[26];const L=D;let z,E,k,B,I,U,V,X,Y,G,W;t[27]===Symbol.for("react.memo_cache_sentinel")?(z=Oi.create(Zo),E=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]=E):(z=t[27],E=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(jr,{color:"var(--grass-11)",size:16}),t[30]=B):B=t[30],t[31]!==w||t[32]!==p?(I=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]=I):I=t[33],t[34]===Symbol.for("react.memo_cache_sentinel")?(U=u.jsx(jp,{size:16}),t[34]=U):U=t[34],t[35]!==j||t[36]!==p?(V=u.jsx(Ee,{content:"Clear code and outputs",children:u.jsx(ve,{disabled:p,size:"xs",variant:"text",onClick:j,children:U})}),t[35]=j,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(zs,{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(Mp,{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]!==I||t[56]!==V||t[57]!==Y||t[58]!==G||t[59]!==ne?(ie=u.jsxs("div",{className:"flex items-center shrink-0",children:[I,V,Y,G,W,ne]}),t[55]=I,t[56]=V,t[57]=Y,t[58]=G,t[59]=ne,t[60]=ie):ie=t[60],t[61]!==T?(se=T(),t[61]=T,t[62]=se):se=t[62],t[63]!==L?(ae=L(),t[63]=L,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:[E,ie,fe]}),t[68]=ie,t[69]=fe,t[70]=re):re=t[70],re},L9=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(P9,{}),t[0]=e):e=t[0],e},F9=()=>{const t=H.c(23),{openModal:e,closeModal:n}=Tn();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}=Mn(B9,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(U9).map($9),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(Ug,{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(ip,{children:u.jsxs(Ss,{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(V9),t[16]=r,t[17]=g):g=t[17],t[18]!==g?(x=u.jsxs(ap,{className:"overflow-auto flex-1 mb-16",children:[m,u.jsx(lp,{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},z9=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(xc,{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 B9(){return Bg((await wS.request({})).secrets)}function U9(t){return t.provider!=="env"}function $9(t){return t.name}function V9(t){return t.keys.map(e=>u.jsxs(Ss,{className:"group",children:[u.jsx(Sr,{children:e}),u.jsx(Sr,{children:t.provider!=="env"&&u.jsx(YC,{variant:"outline",className:"select-none",children:t.name})}),u.jsx(Sr,{children:u.jsx(z9,{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 H9=t=>{const e=H.c(6),{children:n}=t,{openModal:o,closeModal:r}=Tn();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(u.jsx(q9,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=u.jsx(BC,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},W9=[We.lineWrapping],q9=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),S=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:S,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(cs,{children:[a,u.jsxs(ds,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",u.jsx("a",{href:zn.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(QL,{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:W9,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},G9=[We.lineWrapping],Y9=()=>{const t=H.c(22),{readSnippets:e}=ot(),[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}=Mn(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(H9,{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(lc,{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(X9,{onSelect:g,snippets:i.snippets}),t[12]=i.snippets,t[13]=x):x=t[13],t[14]!==d||t[15]!==x?(p=u.jsxs(vc,{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(K9,{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},K9=t=>{const e=H.c(33),{snippet:n,onClose:o}=t,{theme:r}=vr(),{createNewCell:s}=lt(),i=fs();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(zs,{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=S=>{const{code:C,html:N,id:j}=S;return N?u.jsx("div",{children:op({html:N})},`${n.title}-${j}`):C?u.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[u.jsx(zs,{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:G9,value:C,readOnly:!0},`${n.title}-${j}`)})]},`${n.title}-${j}`):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},X9=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(Qn,{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(Wm,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s},J9=q.lazy(()=>Gm(()=>import("./tracing-BuGDnWcg.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}))),Z9=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(q.Suspense,{fallback:u.jsx(Q9,{}),children:u.jsx(J9,{})}),t[0]=e):e=t[0],e},Q9=()=>{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},o3="name",r3="type-value",im="defs-refs",eO=[{id:o3,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>u.jsx(cp,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return u.jsx(bf,{name:e,declaredBy:n})}},{id:r3,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>u.jsx(cp,{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:im,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>u.jsx(cp,{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&&rp(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(Qp,{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(Ew,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],s3=M.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=q.useState([]),[s,i]=q.useState(""),a=eF(),l=M.useMemo(()=>{const h=f=>{const m=a[f];return sF(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:im,desc:!1});let x=[];switch(m.id){case o3:x=la(f,p=>p.name);break;case r3:x=la(f,p=>p.dataType);break;case im: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=tF({data:c,columns:eO,getCoreRowModel:rF(),onGlobalFilterChange:i,getFilteredRowModel:oF(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:h=>h.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:nF(),state:{sorting:o,globalFilter:s}});return u.jsxs(u.Fragment,{children:[u.jsx(aS,{className:"w-full",placeholder:"Search",value:s,onChange:h=>i(h.target.value)}),u.jsxs(ap,{className:xe("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[u.jsx(ip,{children:u.jsx(Ss,{className:"whitespace-nowrap text-xs",children:d.getFlatHeaders().map(h=>u.jsx(Cr,{className:"sticky top-0 bg-background border-b",children:dS(h.column.columnDef.header,h.getContext())},h.id))})}),u.jsx(lp,{children:d.getRowModel().rows.map(h=>u.jsx(Ss,{className:"hover:bg-accent",children:h.getVisibleCells().map(f=>u.jsx(Sr,{className:"border-b",children:dS(f.column.columnDef.cell,f.getContext())},f.id))},h.id))})]})]})});s3.displayName="VariableTable";const tO=()=>{const t=H.c(4),e=sp(),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(Xl,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=u.jsx(s3,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o},nO=t=>{const e=H.c(54),n=Ne(iF),o=Ne(R6),r=lt(),s=jC(),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,S,C,N,j;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;e[20]!==n.focusedCellId||e[21]!==z?(E={id:n.focusedCellId,graph:z},e[20]=n.focusedCellId,e[21]=z,e[22]=E):E=e[22],g=E}m=(g==null?void 0:g.id)===h.id,f=a3(h.graph)?1.5:3;const T=()=>{m?s.blurCell():(r.focusCell({cellId:h.id,where:"exact"}),s.focusCell({cellId:h.id}))};C=h.id;const D=m?"text-primary-foreground":"text-(--gray-8) hover:text-(--gray-9)";e[23]!==D?(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",D),e[23]=D,e[24]=x):x=e[24],p=T,b=cO;const L=m&&"bg-primary group-hover:bg-primary";e[25]!==L?(S=xe("group-hover:bg-(--gray-2) flex h-full w-full px-0.5 items-center rounded",L),e[25]=L,e[26]=S):S=e[26],y="truncate px-1 font-mono text-sm flex gap-1",v=h.code,w=h.graph.variables.length>0?u.jsx(iO,{cell:h,selectedCell:g}):u.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap max-w-full",children:sO(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]=S,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],S=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]!==S?(j=u.jsx("div",{className:S,children:N}),e[31]=N,e[32]=S,e[33]=j):j=e[33];const _=m?"z-30":"z-20";let O,A,R,P;return e[34]!==h||e[35]!==g||e[36]!==_?(O=xe("absolute overflow-visible top-[10.5px] left-[calc(var(--spacing-extra-small,8px)+17px)] pointer-events-none",_,function({cell:T,selectedCell:D}){return T.hasError?"text-destructive":!D&&!a3(T.graph)?"text-foreground":(D==null?void 0:D.id)===T.id||D!=null&&D.graph.parents.has(T.id)||D!=null&&D.graph.children.has(T.id)?"text-primary":"text-(--gray-8)"}({cell:h,selectedCell:g})),e[34]=h,e[35]=g,e[36]=_,e[37]=O):O=e[37],e[38]!==h||e[39]!==f||e[40]!==m||e[41]!==t.cellPositions||e[42]!==g?(A=m?u.jsx(aO,{cell:h,cellPositions:t.cellPositions,circleRadius:f}):u.jsx(lO,{cell:h,selectedCell:g,circleRadius:f}),e[38]=h,e[39]=f,e[40]=m,e[41]=t.cellPositions,e[42]=g,e[43]=A):A=e[43],e[44]!==O||e[45]!==A?(R=u.jsx("svg",{className:O,width:"1",height:"1",children:A}),e[44]=O,e[45]=A,e[46]=R):R=e[46],e[47]!==x||e[48]!==p||e[49]!==b||e[50]!==j||e[51]!==R||e[52]!==C?(P=u.jsxs("button",{"data-node-id":C,className:x,onClick:p,onMouseDown:b,children:[j,R]}),e[47]=x,e[48]=p,e[49]=b,e[50]=j,e[51]=R,e[52]=C,e[53]=P):P=e[53],P},oO=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(dO)),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,S]of r.getColumns().entries())w>0&&a.push(v),v+=S.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,S)=>{const C=a.includes(S);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(nO,{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},rO=()=>{const t=H.c(5),[e,n]=zt(qb);let o,r;return t[0]!==n?(o=()=>n(uO),t[0]=n,t[1]=o):o=t[1],Dt("global.toggleMinimap",o),t[2]!==e||t[3]!==n?(r=u.jsx(oO,{open:e,setOpen:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r};function sO(t){return t.split(`
|
163
|
-
`)[0].trim()||void 0}const iO=t=>{const e=H.c(11),{cell:n,selectedCell:o}=t,r=sp(),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&&P6(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},aO=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 lO(t){const{cell:e,selectedCell:n,circleRadius:o}=t,r=e.graph.ancestors.size>0,s=e.graph.descendants.size>0;if(!n)return i3({circleRadius:o,leftWisker:r,rightWisker:s});const i=n.graph.ancestors.has(e.id),a=n.graph.descendants.has(e.id);return i3(i||a?{circleRadius:o,leftWisker:r,rightWisker:s,shift:i&&a?void 0:i?"left":"right"}:{circleRadius:o,leftWisker:!1,rightWisker:!1})}function i3(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 a3(t){return t.variables.length===0&&t.ancestors.size===0&&t.descendants.size===0}function cO(t){return t.preventDefault()}function dO(t,e){return[t,e]}function uO(t){return!t}const hO=q.lazy(()=>Gm(()=>import("./terminal-DrDWxiEU.js"),__vite__mapDeps([126,1,2,127]),import.meta.url)),fO=t=>{const e=H.c(122),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=gc(),{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(pO)},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(xO)},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(uS,{onDragging:hS,className:b}),e[10]=b,e[11]=y):y=e[11];const v=y,w=r?"resize-handle":"resize-handle-collapsed";let S,C;e[12]!==w?(S=xe("border-border no-print z-20",w,"horizontal"),e[12]=w,e[13]=S):S=e[13],e[14]!==S?(C=u.jsx(uS,{onDragging:hS,className:S}),e[14]=S,e[15]=C):C=e[15];const N=C;let j,_,O,A,R,P,T,D,L,z,E,k,B,I,U,V,X,Y,G,W,J;e[16]!==s?(j=u.jsx("div",{className:"text-sm text-(--slate-11) uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=j):j=e[17],e[18]!==i?(_=()=>i(!1),e[18]=i,e[19]=_):_=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(O=u.jsx(wn,{className:"w-4 h-4"}),e[20]=O):O=e[20],e[21]!==_?(A=u.jsx(ve,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:_,children:O}),e[21]=_,e[22]=A):A=e[22],e[23]!==j||e[24]!==A?(R=u.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[j,A]}),e[23]=j,e[24]=A,e[25]=R):R=e[25],e[26]!==s?(P=s==="files"&&u.jsx(Kk,{}),e[26]=s,e[27]=P):P=e[27],e[28]!==s?(T=s==="errors"&&u.jsx(t9,{}),e[28]=s,e[29]=T):T=e[29],e[30]!==s?(D=s==="variables"&&u.jsx(tO,{}),e[30]=s,e[31]=D):D=e[31],e[32]!==s?(L=s==="dependencies"&&u.jsx(B7,{}),e[32]=s,e[33]=L):L=e[33],e[34]!==s?(z=s==="packages"&&u.jsx(E9,{}),e[34]=s,e[35]=z):z=e[35],e[36]!==s?(E=s==="outline"&&u.jsx(N9,{}),e[36]=s,e[37]=E):E=e[37],e[38]!==s?(k=s==="datasources"&&u.jsx(Q7,{}),e[38]=s,e[39]=k):k=e[39],e[40]!==s?(B=s==="documentation"&&u.jsx(e9,{}),e[40]=s,e[41]=B):B=e[41],e[42]!==s?(I=s==="snippets"&&u.jsx(Y9,{}),e[42]=s,e[43]=I):I=e[43],e[44]!==s?(U=s==="scratchpad"&&u.jsx(L9,{}),e[44]=s,e[45]=U):U=e[45],e[46]!==s?(V=s==="chat"&&u.jsx(cT,{}),e[46]=s,e[47]=V):V=e[47],e[48]!==s?(X=s==="logs"&&u.jsx(Xk,{}),e[48]=s,e[49]=X):X=e[49],e[50]!==s?(Y=s==="tracing"&&u.jsx(Z9,{}),e[50]=s,e[51]=Y):Y=e[51],e[52]!==s?(G=s==="secrets"&&u.jsx(F9,{}),e[52]=s,e[53]=G):G=e[53],e[54]!==P||e[55]!==T||e[56]!==D||e[57]!==L||e[58]!==z||e[59]!==E||e[60]!==k||e[61]!==B||e[62]!==I||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:[P,T,D,L,z,E,k,B,I,U,V,X,Y,G]})}),e[54]=P,e[55]=T,e[56]=D,e[57]=L,e[58]=z,e[59]=E,e[60]=k,e[61]=B,e[62]=I,e[63]=U,e[64]=V,e[65]=X,e[66]=Y,e[67]=G,e[68]=W):W=e[68],e[69]!==R||e[70]!==W?(J=u.jsx(wc,{children:u.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[R,W]})}),e[69]=R,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,Se,je,Fe,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?(Se=()=>a(!1),je=()=>a(!0),e[89]=a,e[90]=Se,e[91]=je):(Se=e[90],je=e[91]),e[92]===Symbol.for("react.memo_cache_sentinel")?(Fe=u.jsx("div",{}),e[92]=Fe):Fe=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:Fe,children:u.jsx(hO,{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(U7,{isOpen:r,children:ke}),e[98]=r,e[99]=ke,e[100]=Ye):Ye=e[100],e[101]!==ue||e[102]!==Se||e[103]!==je||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:Se,onExpand:je,children:[N,Ye]},"terminal"),e[101]=ue,e[102]=Se,e[103]=je,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=ZF(),e[107]=ee):ee=e[107],e[108]===Symbol.for("react.memo_cache_sentinel")?(ye=u.jsx($c,{children:u.jsx(q6,{})}),e[108]=ye):ye=e[108],e[109]!==Ke?(we=u.jsx(Hb,{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(fS,{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(aF,{}),e[114]=K):K=e[114],e[115]!==fe||e[116]!==Ae?(pe=u.jsxs(fS,{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(rO,{}),e[118]=ge):ge=e[118],e[119]===Symbol.for("react.memo_cache_sentinel")?(he=u.jsx(wc,{children:u.jsx($c,{children:u.jsx(U6,{})})}),e[119]=he):he=e[119],e[120]!==pe?(Ce=u.jsxs(QF,{children:[pe,ge,he]}),e[120]=pe,e[121]=Ce):Ce=e[121],Ce};function mO(){window.dispatchEvent(new Event("resize"))}function pO(){requestAnimationFrame(mO)}function gO(){window.dispatchEvent(new Event("resize"))}function xO(){requestAnimationFrame(gO)}let l3;l3=new URL(window.location.href).searchParams.get(lF.showChrome)==="false",RS=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=H.c(10);if(l3){let s,i,a;return e[0]!==t?(s=u.jsx(Vb,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(vg,{}),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(Vb,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(vg,{}),e[7]=o):o=e[7],e[8]!==n?(r=u.jsxs(fO,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{xp as C,Gc as E,dn as P,az as __tla,Yc as a,RS 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 np.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}}},R7=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=$k.createElements(n,r,o,a.hidePureMarkdown);return k=Uk({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]=vw(c.nodes),[m,g,x]=ww(c.edges),p=Ni();let b;e[6]!==i||e[7]!==g||e[8]!==h?(b=k=>{const B=Uk({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=Le(b);let v,w;e[10]!==r||e[11]!==n||e[12]!==a.hidePureMarkdown||e[13]!==y||e[14]!==o?(v=()=>{y($k.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[S,C]=M.useState();let N;_w(),e[17]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{C(void 0)},e[17]=N):N=e[17];const j=N;let _,O,A,R,P,T,D,L,z,E;return e[18]===Symbol.for("react.memo_cache_sentinel")?(_={minZoom:.5,maxZoom:1.5},O=(k,B)=>{C({type:"node",id:B.id})},A=(k,B)=>{const{source:I,target:U}=B;C({type:"edge",source:I,target:U})},e[18]=_,e[19]=O,e[20]=A):(_=e[18],O=e[19],A=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(R=u.jsx(t7,{color:"#ccc",variant:En.Dots}),e[21]=R):R=e[21],e[22]!==p||e[23]!==d?(P=()=>{const k=Qe.get(xL);if(k){const B=d.find(I=>I.id===k);B&&(p.fitView({padding:1,duration:600,nodes:[B]}),C({type:"node",id:k}))}},e[22]=p,e[23]=d,e[24]=P):P=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(T=u.jsx(Lp,{className:"size-4"}),e[25]=T):T=e[25],e[26]!==P?(D=u.jsx(KM,{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:Bn.preventFocus,onClick:P,children:T})})}),e[26]=P,e[27]=D):D=e[27],e[28]!==m||e[29]!==S||e[30]!==o?(L=u.jsx(Wl,{selection:S,variables:o,edges:m,onClearSelection:j}),e[28]=m,e[29]=S,e[30]=o,e[31]=L):L=e[31],e[32]!==s||e[33]!==m||e[34]!==d||e[35]!==x||e[36]!==f||e[37]!==D||e[38]!==L?(z=u.jsxs(gf,{nodes:d,edges:m,nodeTypes:Nw,minZoom:.2,fitViewOptions:_,onNodeClick:O,onEdgeClick:A,onNodeDoubleClick:P7,fitView:!0,onNodesChange:f,onEdgesChange:x,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[R,D,L,s]}),e[32]=s,e[33]=m,e[34]=d,e[35]=x,e[36]=f,e[37]=D,e[38]=L,e[39]=z):z=e[39],e[40]!==i||e[41]!==z?(E=u.jsx(Sw,{value:i,children:z}),e[40]=i,e[41]=z,e[42]=E):E=e[42],E};function P7(t,e){KC(e.id,"focus")}const L7=St("_minimap_"),F7=St({hidePureMarkdown:!0}),z7=t=>{const e=H.c(11),[n,o]=zt(L7),[r,s]=zt(F7);let i;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(i=()=>n==="_minimap_"?u.jsx(i7,{...t,children:u.jsx(yf,{settings:r,onSettingsChange:s,view:n,onChange:o})}):u.jsx(R7,{...t,settings:r,layoutDirection:n,children:u.jsx(yf,{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(pf,{children:l},n),e[8]=n,e[9]=l,e[10]=c):c=e[10],c},B7=()=>{const t=H.c(5),e=sp(),n=wr(),[o]=bL();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(z7,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},U7=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},$7=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(Cc)[d];if(h)return h.declaredBy[0]}(n);if(!l)return;const c=Ri(l);c&&rp(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},V7=St(t=>{const e=t(yL),n=t(Cc),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})}),H7=St(t=>{const e=new Map(t(vL));for(const n of XC){const o=e.get(n);o&&(o.databases.length===0&&e.delete(n),o.databases.length===1&&o.databases[0].name===wL&&o.databases[0].schemas.length===0&&e.delete(n))}return la([...e.values()],n=>XC.has(n.name)?1:0)}),W7=()=>{const t=H.c(32),[e,n]=q.useState(""),o=Ct(JC),r=Ne(V7),s=Ne(H7);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(Wg,{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(Wg,{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(q7,{connection:y,hasChildren:y.databases.length>0,children:y.databases.map(v=>u.jsx(G7,{engineName:y.name,database:v,hasSearch:i,children:u.jsx(Y7,{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(ZC,{children:[u.jsx(oc,{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(Vk,{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(Wm,{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(vc,{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},q7=t=>{const e=H.c(26),{connection:n,children:o,hasChildren:r}=t,s=n.name===kL,i=s?"In-Memory":n.name,{previewDataSourceConnection:a}=ot(),[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(z3,{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=CL(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($7,{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(ZC,{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},G7=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(rS,{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,S,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?(S=u.jsx("span",{className:v,children:w}),e[16]=v,e[17]=w,e[18]=S):S=e[18],e[19]!==S||e[20]!==f||e[21]!==m||e[22]!==g||e[23]!==b?(C=u.jsxs(Qn,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:m,children:[g,b,S]}),e[19]=S,e[20]=f,e[21]=m,e[22]=g,e[23]=b,e[24]=C):C=e[24];const N=i&&s;let j;return e[25]!==C||e[26]!==N?(j=u.jsxs(u.Fragment,{children:[C,N]}),e[25]=C,e[26]=N,e[27]=j):j=e[27],j},Y7=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(K7,{databaseName:i,schema:g,hasSearch:a,children:u.jsx(Vk,{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},K7=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),oS(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(rS,{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(AL,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&i&&"font-semibold";let v,w,S;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?(S=u.jsxs(Qn,{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]=S):S=e[22];const C=i&&r;let N;return e[23]!==S||e[24]!==C?(N=u.jsxs(u.Fragment,{children:[S,C]}),e[23]=S,e[24]=C,e[25]=N):N=e[25],N},Vk=t=>{const e=H.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=QC(),[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 qF.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}=Mn(d,h);if(f||l){let p;return e[9]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(eS,{message:"Loading tables...",className:"pl-12"}),e[9]=p):p=e[9],p}if(m){let p;return e[10]!==m?(p=u.jsx(tS,{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(X7,{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},X7=t=>{const e=H.c(64),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=QC(),[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 GF.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}=Mn(h,f),p=Ne(tc),b=fs(),{createNewCell:y}=lt(),v=nS();let w;e[10]!==v||e[11]!==p||e[12]!==y||e[13]!==b||e[14]!==o||e[15]!==n?(w=()=>{Zn({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 sS({table:n,columnName:"*",sqlTableContext:o});switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return sS({table:n,columnName:"*",sqlTableContext:o});default:return fc(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 S=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 j;e[20]!==x||e[21]!==m||e[22]!==g||e[23]!==o||e[24]!==n?(j=()=>{if(g||m)return u.jsx(eS,{message:"Loading columns...",className:"pl-12"});if(x)return u.jsx(tS,{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(J7,{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]=j):j=e[25];const _=j;let O;e[26]!==i||e[27]!==r||e[28]!==n.source_type||e[29]!==n.type?(O=()=>{if(n.source_type==="local")return;const W=n.type==="table"?SL:mm;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]=O):O=e[30];const A=O,R=o?`${o.database}.${o.schema}.${n.name}`:n.name,P=o&&(oS(o.schema)?"pl-9":"pl-12"),T=(i||r)&&"font-semibold";let D,L,z,E,k,B,I,U,V,X,Y,G;return e[31]!==P||e[32]!==T?(D=xe("rounded-none group h-8 cursor-pointer",P,T),e[31]=P,e[32]=T,e[33]=D):D=e[33],e[34]!==i?(L=()=>a(!i),e[34]=i,e[35]=L):L=e[35],e[36]!==A?(z=A(),e[36]=A,e[37]=z):z=e[37],e[38]!==n.name?(E=u.jsx("span",{className:"text-sm",children:n.name}),e[38]=n.name,e[39]=E):E=e[39],e[40]!==z||e[41]!==E?(k=u.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[z,E]}),e[40]=z,e[41]=E,e[42]=k):k=e[42],e[43]!==N?(B=N(),e[43]=N,e[44]=B):B=e[44],e[45]!==S?(I=Bn.stopPropagation(()=>S()),e[45]=S,e[46]=I):I=e[46],e[47]===Symbol.for("react.memo_cache_sentinel")?(U=u.jsx(jL,{className:"h-3 w-3"}),e[47]=U):U=e[47],e[48]!==I?(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:I,children:U})}),e[48]=I,e[49]=V):V=e[49],e[50]!==i||e[51]!==L||e[52]!==k||e[53]!==B||e[54]!==V||e[55]!==D||e[56]!==R?(X=u.jsxs(Qn,{className:D,value:R,"aria-selected":i,forceMount:!0,onSelect:L,children:[k,B,V]}),e[50]=i,e[51]=L,e[52]=k,e[53]=B,e[54]=V,e[55]=D,e[56]=R,e[57]=X):X=e[57],e[58]!==i||e[59]!==_?(Y=i&&_(),e[58]=i,e[59]=_,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},J7=t=>{var I,U;const e=H.c(51),{table:n,column:o,sqlTableContext:r}=t,[s,i]=q.useState(!1),a=Ne(JC),l=Ct(NL);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=nS(),{columnsPreviews:f}=EL();let m;e[3]!==o.name||e[4]!==n.primary_keys?(m=((I=n.primary_keys)==null?void 0:I.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=Z7,w=s?"font-semibold":"";let S;e[11]!==o.name||e[12]!==w?(S=u.jsx("span",{className:w,children:o.name}),e[11]=o.name,e[12]=w,e[13]=S):S=e[13];const C=S,N=`${n.name}.${o.name}`,j=`${n.name}.${o.name}`;let _;e[14]!==s?(_=()=>i(!s),e[14]=s,e[15]=_):_=e[15];const O=r?"pl-14":"pl-7";let A,R,P,T,D,L,z,E,k,B;return e[16]!==O?(A=xe("flex flex-row gap-2 items-center flex-1",O),e[16]=O,e[17]=A):A=e[17],e[18]!==o.type||e[19]!==C?(R=u.jsx(_L,{columnName:C,dataType:o.type}),e[18]=o.type,e[19]=C,e[20]=R):R=e[20],e[21]!==g?(P=g&&v({tooltipContent:"Primary key",content:"PK"}),e[21]=g,e[22]=P):P=e[22],e[23]!==p?(T=p&&v({tooltipContent:"Indexed",content:"IDX"}),e[23]=p,e[24]=T):T=e[24],e[25]!==A||e[26]!==R||e[27]!==P||e[28]!==T?(D=u.jsxs("div",{className:A,children:[R,P,T]}),e[25]=A,e[26]=R,e[27]=P,e[28]=T,e[29]=D):D=e[29],e[30]!==o.name?(L=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(qC,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[30]=o.name,e[31]=L):L=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[35]!==D||e[36]!==L||e[37]!==z||e[38]!==N||e[39]!==j?(E=u.jsxs(Qn,{className:"rounded-none py-1 group cursor-pointer",value:j,onSelect:_,children:[D,L,z]},N),e[34]=_,e[35]=D,e[36]=L,e[37]=z,e[38]=N,e[39]=j,e[40]=E):E=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(wc,{children:u.jsx(IL,{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||e[49]!==k?(B=u.jsxs(u.Fragment,{children:[E,k]}),e[48]=E,e[49]=k,e[50]=B):B=e[50],B};function Z7(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 Q7=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(W7,{}),t[0]=e):e=t[0],e},e9=()=>{const t=H.c(5),{documentation:e}=Ne(TL);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=op({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},t9=()=>{const t=H.c(5),e=ML();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(Wp,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(n9),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 n9(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(OL,{cellId:t.cellId})}),u.jsx("div",{className:"px-2",children:u.jsx(DL,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}const om=new Map,o9=({file:t,onOpenNotebook:e})=>{const{theme:n}=vr(),{sendFileDetails:o,sendUpdateFile:r}=ot(),s=Ne(Fi),[i,a]=M.useState(""),{data:l,isPending:c,error:d,setData:h}=Mn(async()=>{const b=await o({path:t.path}),y=b.contents||"";return a(om.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?om.delete(t.path):om.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 rm;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(bc,{})})}),u.jsx(Ee,{content:"Download",children:u.jsx(cn,{size:"small",onClick:()=>{if(Hk(g)){const b=BL(l.contents,g);return void UL(b,l.file.name)}$i(new Blob([l.contents||i],{type:g}),l.file.name)},children:u.jsx(_m,{})})}),!Hk(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(RL,{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(PL,{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(LL,{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(FL,{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(zL,{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:rm[g]||rm.default,className:"border-b",extensions:[We.lineWrapping,In.of([{key:s.getHotkey("global.save").key,stopPropagation:!0,run:()=>i!==l.contents&&(f(),!0)}])],value:i,onChange:a})})})]})},Hk=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/")||t.startsWith("application/pdf"),rm={"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 r9{constructor(e){this.callbacks=e,this.delegate=new dp([]),this.rootPath="",this.onChange=Un.NOOP,this.path=new pc("/"),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 dp(o.files),this.rootPath=o.root,this.path=pc.guessDeliminator(o.root)}catch(o){Je({title:"Failed",description:kC(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 dp(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 Wk=St(t=>{const e=t($L);return $n(e,"no requestClientAtom set"),new r9({listFiles:e.sendListFiles,createFileOrFolder:e.sendCreateFileOrFolder,deleteFileOrFolder:e.sendDeleteFileOrFolder,renameFileOrFolder:e.sendRenameFileOrFolder})}),s9=St({});function i9(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 qk(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}=ot();let s,i;return e[2]!==r?(s=async a=>{for(const l of a){const c=h9(u9(l));let d="";c&&(d=pc.guessDeliminator(c).dirname(c));const h=(await i9(l)).split(",")[1];await r({path:d,type:"file",name:l.name,contents:h})}await async function(){await Qe.get(Wk).refreshAll([])}()},e[2]=r,e[3]=s):s=e[3],e[4]!==o||e[5]!==s?(i={multiple:!0,maxSize:104857600,onError:d9,onDropRejected:a9,onDrop:s,...o},e[4]=o,e[5]=s,e[6]=i):i=e[6],VL(i)}function a9(t){Je({title:"File upload failed",description:u.jsx("div",{className:"flex flex-col gap-1",children:t.map(l9)}),variant:"danger"})}function l9(t){return u.jsxs("div",{children:[t.file.name," (",t.errors.map(c9).join(", "),")"]},t.file.name)}function c9(t){return t.message}function d9(t){ct.error(t),Je({title:"File upload failed",description:t.message,variant:"danger"})}function u9(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 h9(t){if(t)return t.replace(/^\/+/,"")}const Gk=q.createContext(null),f9=t=>{const e=H.c(60),{height:n}=t,o=M.useRef(null),[r]=zt(Wk);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}=Tn(),[h,f]=zt(s9);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}=Mn(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=Le(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=Le(v);let S;e[10]!==d||e[11]!==r?(S=async()=>{d({title:"File name",onConfirm:async k=>{r.createFile(k,null)}})},e[10]=d,e[11]=r,e[12]=S):S=e[12];const C=Le(S);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 j=Le(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,I,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?(I=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]=I):I=e[21],e[22]!==l.path||e[23]!==r?(U=Y=>Yk(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(o9,{onOpenNotebook:U,file:l})}),e[25]=l,e[26]=U,e[27]=V):V=e[27],e[28]!==I||e[29]!==V?(X=u.jsxs(u.Fragment,{children:[I,V]}),e[28]=I,e[29]=V,e[30]=X):X=e[30],X}let _;e[31]!==j||e[32]!==C||e[33]!==w||e[34]!==y||e[35]!==r?(_=u.jsx(p9,{onRefresh:y,onCreateFile:C,onCreateFolder:w,onCollapseAll:j,tree:r}),e[31]=j,e[32]=C,e[33]=w,e[34]=y,e[35]=r,e[36]=_):_=e[36];const O=n-33;let A,R,P,T,D,L,z,E;return e[37]!==r?(A=async k=>{const{ids:B}=k;for(const I of B)await r.delete(I)},R=async k=>{const{id:B,name:I}=k;await r.rename(B,I)},P=async k=>{const{dragIds:B,parentId:I}=k;await r.move(B,I)},e[37]=r,e[38]=A,e[39]=R,e[40]=P):(A=e[38],R=e[39],P=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(T=k=>{const B=k[0];B&&(B.data.isDirectory||c(B.data))},e[41]=T):T=e[41],e[42]!==h||e[43]!==f||e[44]!==r?(D=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]=D):D=e[45],e[46]!==i||e[47]!==h||e[48]!==A||e[49]!==R||e[50]!==P||e[51]!==D||e[52]!==O?(L=u.jsx(IF,{width:"100%",ref:o,height:O,className:"h-full",data:i,initialOpenState:h,openByDefault:!1,renderCursor:v9,disableDrop:w9,onDelete:A,onRename:R,onMove:P,onSelect:T,onToggle:D,padding:15,rowHeight:30,indent:m9,overscanCount:1e3,disableMultiSelection:!0,children:b9}),e[46]=i,e[47]=h,e[48]=A,e[49]=R,e[50]=P,e[51]=D,e[52]=O,e[53]=L):L=e[53],e[54]!==L||e[55]!==r?(z=u.jsx(Gk,{value:r,children:L}),e[54]=L,e[55]=r,e[56]=z):z=e[56],e[57]!==z||e[58]!==_?(E=u.jsxs(u.Fragment,{children:[_,z]}),e[57]=z,e[58]=_,e[59]=E):E=e[59],E},m9=15,p9=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}=qk(i);let c,d,h,f,m,g,x,p,b,y,v,w,S,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=HL({variant:"text",size:"xs"}),x=u.jsx(qL,{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(AC,{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")?(S=u.jsx(Cp,{size:16}),e[20]=S):S=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:S})}),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},g9=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(bc,{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},x9=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:k9,onBlur:i,onKeyDown:a}),e[6]=n.data.name,e[7]=i,e[8]=a,e[9]=l):l=e[9],l},b9=({node:t,style:e,dragHandle:n})=>{const{openFile:o,sendCreateFileOrFolder:r,sendFileDetails:s}=ot(),i=t.data.isDirectory?"directory":q3(t.data.name),a=G3[i],{openConfirm:l,openPrompt:c}=Tn(),{createNewCell:d}=lt(),h=fs(),f=M.use(Gk),m=async y=>{Yk(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(U3,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},x=Le(async()=>{t.open(),c({title:"Folder name",onConfirm:async y=>{f==null||f.createFolder(y,t.id)}})}),p=Le(async()=>{t.open(),c({title:"File name",onConfirm:async y=>{f==null||f.createFile(y,t.id)}})}),b=Le(async()=>{var S;if(!f||t.data.isDirectory)return;const[y,v]=WL(t.data.name),w=`${y}_copy${v}`;try{const C=await s({path:t.data.path}),N=((S=t.parent)==null?void 0:S.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(y9,{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:YF,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(x9,{node:t}):u.jsx(g9,{node:t,onOpenMarimoFile:m}),u.jsxs(_o,{modal:!1,children:[u.jsx(Io,{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(Ao,{align:"end",className:"no-print w-[220px]",onClick:v=>v.stopPropagation(),onCloseAutoFocus:v=>v.preventDefault(),children:[!t.data.isDirectory&&u.jsxs(Tt,{onSelect:()=>t.select(),children:[u.jsx(ig,{...y}),"Open file"]}),!t.data.isDirectory&&!tn()&&u.jsxs(Tt,{onSelect:()=>{o({path:t.data.path})},children:[u.jsx(bc,{...y}),"Open file in external editor"]}),t.data.isDirectory&&u.jsxs(u.Fragment,{children:[u.jsxs(Tt,{onSelect:()=>p(),children:[u.jsx(ua,{...y}),"Create file"]}),u.jsxs(Tt,{onSelect:()=>x(),children:[u.jsx(td,{...y}),"Create folder"]}),u.jsx(an,{})]}),u.jsxs(Tt,{onSelect:()=>t.edit(),children:[u.jsx(qp,{...y}),"Rename"]}),!t.data.isDirectory&&u.jsxs(Tt,{onSelect:b,children:[u.jsx(Mi,{...y}),"Duplicate"]}),u.jsxs(Tt,{onSelect:async()=>{await sn(t.data.path),Je({title:"Copied to clipboard"})},children:[u.jsx(rd,{...y}),"Copy path"]}),f&&u.jsxs(Tt,{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(Tt,{onSelect:()=>{const{path:v}=t.data;(w=>{d({code:w,before:!1,cellId:h??"__end__"})})(iS[i](v))},children:[u.jsx(Nr,{...y}),"Insert snippet for reading file"]}),u.jsxs(Tt,{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=iS[i](v);await sn(w)},children:[u.jsx(GL,{...y}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!tn()&&u.jsxs(u.Fragment,{children:[u.jsx(an,{}),u.jsxs(Tt,{onSelect:m,children:[u.jsx(tg,{...y}),"Open notebook"]})]}),u.jsx(an,{}),!t.data.isDirectory&&u.jsxs(u.Fragment,{children:[u.jsxs(Tt,{onSelect:async()=>{const v=(await s({path:t.data.path})).contents||"";$i(new Blob([v]),t.data.name)},children:[u.jsx(_m,{...y}),"Download"]}),u.jsx(an,{})]}),u.jsxs(Tt,{onSelect:g,variant:"danger",children:[u.jsx(sc,{...y}),"Delete"]})]})})()]})]})]})},y9=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(Eo,{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 Yk(t,e){t.stopPropagation(),t.preventDefault(),pS(e)}function v9(){return null}function w9(t){const{parentNode:e}=t;return!e.data.isDirectory}function k9(t){return t.stopPropagation()}let Kk,Xk,Jk;Kk=()=>{const t=H.c(20),{ref:e,height:n}=YL(),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}=qk(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(f9,{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},xp=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},Xk=()=>{const t=H.c(9),e=KL(),{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(hm,{})}),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(xp,{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(Jk,{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},Jk=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(j9),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 C9(t){const e=XL(t.timestamp),n=S9[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 S9={stdout:"text-(--grass-9)",stderr:"text-(--red-9)"};function j9(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:C9(t)})]},e)}const N9=()=>{const t=H.c(7),{items:e}=Ne(JL);let n,o;t[0]!==e?(o=KF(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s,activeOccurrences:i}=XF(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(JF,{items:e,activeHeaderId:s,activeOccurrences:i}),t[3]=s,t[4]=i,t[5]=e,t[6]=a):a=t[6],a},Zk=St(null),Qk=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=Bn.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},E9=()=>{var N,j;const t=H.c(30),[e]=br(),n=e.package_management.manager,{getDependencyTree:o,getPackageList:r}=ot(),[s,i]=q.useState(null);let a,l;t[0]!==o||t[1]!==r?(a=async()=>{const[_,O]=await Promise.all([r(),o()]);return{list:_.packages,tree:O.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}=Mn(a,l);if(f){let _;return t[5]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(kn,{size:"medium",centered:!0}),t[5]=_):_=t[5],_}if(d){let _;return t[6]!==d?(_=u.jsx(kr,{error:d}),t[6]=d,t[7]=_):_=t[7],_}const m=c.tree!=null;let g;t[8]!==m||t[9]!==s?(g=function(_,O){return _==="list"?"list":O?_||"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=(j=c==null?void 0:c.tree)==null?void 0:j.version,y=p==="<root>";let v,w,S,C;return t[11]!==n||t[12]!==h?(v=u.jsx(_9,{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?(S=x==="list"?u.jsx(I9,{packages:c.list,onSuccess:h}):u.jsx(A9,{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]=S):S=t[25],t[26]!==v||t[27]!==w||t[28]!==S?(C=u.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[v,w,S]}),t[26]=v,t[27]=w,t[28]=S,t[29]=C):C=t[29],C},_9=t=>{const e=H.c(40),{onSuccess:n,packageManager:o}=t,[r,s]=q.useState(""),{handleClick:i}=ia(),a=Ne(Zk),l=Ct(Zk);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}=ZL();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(T9),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,S,C,N,j,_,O,A,R,P,T,D;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(js,{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=I=>{I.key==="Enter"&&(I.preventDefault(),p())},e[13]=p,e[14]=v):v=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(w=I=>s(I.target.value),e[15]=w):w=e[15],e[16]!==r||e[17]!==b||e[18]!==y||e[19]!==v?(S=u.jsx(aS,{placeholder:b,id:$1,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]=S):S=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"})]}),j=u.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=N,e[23]=j):(N=e[22],j=e[23]),e[24]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsxs("div",{children:[j," ","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"})]}),O=u.jsx("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=_,e[25]=O):(_=e[24],O=e[25]),e[26]===Symbol.for("react.memo_cache_sentinel")?(A=u.jsxs("div",{children:[O," A Git repository",u.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),R=u.jsx("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=A,e[27]=R):(A=e[26],R=e[27]),e[28]===Symbol.for("react.memo_cache_sentinel")?(P=u.jsxs("div",{children:[R," A remote wheel or source distribution.",u.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),T=u.jsx("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=P,e[29]=T):(P=e[28],T=e[29]),e[30]===Symbol.for("react.memo_cache_sentinel")?(D=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,_,A,P,u.jsxs("div",{children:[T," 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(Qm,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=D):D=e[30];const L=r&&"bg-accent text-accent-foreground";let z;e[31]!==L?(z=xe("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",L,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=L,e[32]=z):z=e[32];const E=!r;let k,B;return e[33]!==p||e[34]!==z||e[35]!==E?(k=u.jsx("button",{type:"button",className:z,onClick:p,disabled:E,children:"Add"}),e[33]=p,e[34]=z,e[35]=E,e[36]=k):k=e[36],e[37]!==k||e[38]!==S?(B=u.jsxs("div",{className:"flex items-center w-full border-b",children:[S,D,k]}),e[37]=k,e[38]=S,e[39]=B):B=e[39],B},I9=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(js,{})}),e[0]=a):a=e[0],a}let r,s,i;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(ip,{children:u.jsxs(Ss,{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(Ss,{className:"group",onClick:async()=>{await sn(`${l.name}==${l.version}`),Je({title:"Copied to clipboard"})},children:[u.jsx(Sr,{children:l.name}),u.jsx(Sr,{children:l.version}),u.jsxs(Sr,{className:"flex justify-end",children:[u.jsx(e3,{packageName:l.name,onSuccess:n}),u.jsx(t3,{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(ap,{className:"overflow-auto flex-1",children:[r,u.jsx(lp,{children:s})]}),e[7]=s,e[8]=i):i=e[8],i},e3=({packageName:t,onSuccess:e})=>{const[n,o]=q.useState(!1),{addPackage:r}=ot();return tn()?null:u.jsx(Qk,{onClick:async()=>{try{o(!0);const s=await r({package:t,upgrade:!0});s.success?(e(),lS(t)):lS(t,s.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},t3=({packageName:t,onSuccess:e})=>{const[n,o]=q.useState(!1),{removePackage:r}=ot();return u.jsx(Qk,{onClick:async()=>{try{o(!0);const s=await r({package:t});s.success?(e(),cS(t)):cS(t,s.error)}finally{o(!1)}},loading:n,children:"Remove"})},A9=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(js,{})}),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(n3,{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},n3=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,S;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?(S=c?{}:{paddingLeft:`${m}px`},e[14]=m,e[15]=c,e[16]=S):S=e[16];const C=d?f:void 0;let N,j,_,O,A,R,P,T,D,L;return e[17]!==d||e[18]!==f?(N=d?f?u.jsx(Eo,{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?(j=u.jsx("span",{className:"font-medium truncate",children:o.name}),e[20]=o.name,e[21]=j):j=e[21],e[22]!==o.version?(_=o.version&&u.jsxs("span",{className:"text-muted-foreground text-xs",children:["v",o.version]}),e[22]=o.version,e[23]=_):_=e[23],e[24]!==j||e[25]!==_?(O=u.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[j,_]}),e[24]=j,e[25]=_,e[26]=O):O=e[26],e[27]!==o.tags?(A=o.tags.map(M9),e[27]=o.tags,e[28]=A):A=e[28],e[29]!==A?(R=u.jsx("div",{className:"flex items-center gap-1 ml-2",children:A}),e[29]=A,e[30]=R):R=e[30],e[31]!==c||e[32]!==o.name||e[33]!==l?(P=c&&u.jsxs("div",{className:"flex gap-1 invisible group-hover:visible",children:[u.jsx(e3,{packageName:o.name,onSuccess:l}),u.jsx(t3,{packageName:o.name,onSuccess:l})]}),e[31]=c,e[32]=o.name,e[33]=l,e[34]=P):P=e[34],e[35]!==b||e[36]!==x||e[37]!==N||e[38]!==O||e[39]!==R||e[40]!==P||e[41]!==w||e[42]!==S||e[43]!==C?(T=u.jsxs("div",{className:w,style:S,onClick:b,onKeyDown:x,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":C,children:[N,O,R,P]}),e[35]=b,e[36]=x,e[37]=N,e[38]=O,e[39]=R,e[40]=P,e[41]=w,e[42]=S,e[43]=C,e[44]=T):T=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?(D=d&&f&&u.jsx("div",{role:"group",children:o.dependencies.map((z,E)=>u.jsx(n3,{nodeId:`${n}-${E}`,node:z,level:r+1,isTopLevel:!1,expandedNodes:i,onToggle:a,onSuccess:l},`${z.name}-${E}`))}),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]=D):D=e[53],e[54]!==T||e[55]!==D?(L=u.jsxs("div",{children:[T,D]}),e[54]=T,e[55]=D,e[56]=L):L=e[56],L};function T9(t){return t.trim()}function M9(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 sm=fm("marimo:scratchpadHistory:v1",[]),O9=St(!1),D9=St(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(sm),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(sm,r)}),R9={hide_code:!1,disabled:!1},P9=()=>{const t=H.c(71),e=Rm(),[n]=br(),{theme:o}=vr(),r=M.useRef(null),s=fs(),{createNewCell:i,updateCellCode:a}=lt(),{sendRunScratchpad:l}=ot(),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(D9),[p,b]=zt(O9),y=Ne(sm);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=Le(v);let S;t[4]!==g||t[5]!==i||t[6]!==s?(S=()=>{g.trim()&&i({code:g,before:!1,cellId:s??"__end__"})},t[4]=g,t[5]=i,t[6]=s,t[7]=S):S=t[7];const C=Le(S);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 j=Le(N);let _;t[11]!==b||t[12]!==a?(_=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]=_):_=t[13];const O=Le(_),[A,R]=M.useState();let P;t[14]!==g||t[15]!==f||t[16]!==w||t[17]!==A||t[18]!==d||t[19]!==o||t[20]!==n?(P=()=>u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"overflow-auto shrink-0 max-h-[40%]",children:u.jsx(zu,{theme:o,showPlaceholder:!1,id:Zo,code:g,config:R9,status:"idle",serializedEditorState:null,runCell:w,userConfig:n,editorViewRef:r,setEditorView:ue=>{r.current=ue},hidden:!1,showHiddenCode:Un.NOOP,languageAdapter:A,setLanguageAdapter:R})}),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(fp,{consoleOutputs:f,className:"overflow-auto",stale:!1,cellName:C3,onSubmitDebugger:Un.NOOP,cellId:Zo,debuggerActive:!1})})]}),t[14]=g,t[15]=f,t[16]=w,t[17]=A,t[18]=d,t[19]=o,t[20]=n,t[21]=P):P=t[21];const T=P;let D;t[22]!==O||t[23]!==y||t[24]!==p||t[25]!==o?(D=()=>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:()=>O(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]=O,t[23]=y,t[24]=p,t[25]=o,t[26]=D):D=t[26];const L=D;let z,E,k,B,I,U,V,X,Y,G,W;t[27]===Symbol.for("react.memo_cache_sentinel")?(z=Oi.create(Zo),E=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]=E):(z=t[27],E=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(jr,{color:"var(--grass-11)",size:16}),t[30]=B):B=t[30],t[31]!==w||t[32]!==p?(I=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]=I):I=t[33],t[34]===Symbol.for("react.memo_cache_sentinel")?(U=u.jsx(jp,{size:16}),t[34]=U):U=t[34],t[35]!==j||t[36]!==p?(V=u.jsx(Ee,{content:"Clear code and outputs",children:u.jsx(ve,{disabled:p,size:"xs",variant:"text",onClick:j,children:U})}),t[35]=j,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(zs,{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(Mp,{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]!==I||t[56]!==V||t[57]!==Y||t[58]!==G||t[59]!==ne?(ie=u.jsxs("div",{className:"flex items-center shrink-0",children:[I,V,Y,G,W,ne]}),t[55]=I,t[56]=V,t[57]=Y,t[58]=G,t[59]=ne,t[60]=ie):ie=t[60],t[61]!==T?(se=T(),t[61]=T,t[62]=se):se=t[62],t[63]!==L?(ae=L(),t[63]=L,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:[E,ie,fe]}),t[68]=ie,t[69]=fe,t[70]=re):re=t[70],re},L9=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(P9,{}),t[0]=e):e=t[0],e},F9=()=>{const t=H.c(23),{openModal:e,closeModal:n}=Tn();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}=Mn(B9,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(U9).map($9),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(Ug,{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(ip,{children:u.jsxs(Ss,{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(V9),t[16]=r,t[17]=g):g=t[17],t[18]!==g?(x=u.jsxs(ap,{className:"overflow-auto flex-1 mb-16",children:[m,u.jsx(lp,{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},z9=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(xc,{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 B9(){return Bg((await wS.request({})).secrets)}function U9(t){return t.provider!=="env"}function $9(t){return t.name}function V9(t){return t.keys.map(e=>u.jsxs(Ss,{className:"group",children:[u.jsx(Sr,{children:e}),u.jsx(Sr,{children:t.provider!=="env"&&u.jsx(YC,{variant:"outline",className:"select-none",children:t.name})}),u.jsx(Sr,{children:u.jsx(z9,{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 H9=t=>{const e=H.c(6),{children:n}=t,{openModal:o,closeModal:r}=Tn();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(u.jsx(q9,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=u.jsx(BC,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},W9=[We.lineWrapping],q9=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),S=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:S,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(cs,{children:[a,u.jsxs(ds,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",u.jsx("a",{href:zn.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(QL,{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:W9,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},G9=[We.lineWrapping],Y9=()=>{const t=H.c(22),{readSnippets:e}=ot(),[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}=Mn(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(H9,{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(lc,{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(X9,{onSelect:g,snippets:i.snippets}),t[12]=i.snippets,t[13]=x):x=t[13],t[14]!==d||t[15]!==x?(p=u.jsxs(vc,{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(K9,{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},K9=t=>{const e=H.c(33),{snippet:n,onClose:o}=t,{theme:r}=vr(),{createNewCell:s}=lt(),i=fs();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(zs,{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=S=>{const{code:C,html:N,id:j}=S;return N?u.jsx("div",{children:op({html:N})},`${n.title}-${j}`):C?u.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[u.jsx(zs,{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:G9,value:C,readOnly:!0},`${n.title}-${j}`)})]},`${n.title}-${j}`):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},X9=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(Qn,{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(Wm,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s},J9=q.lazy(()=>Gm(()=>import("./tracing-OU6KdAjg.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}))),Z9=()=>{const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(q.Suspense,{fallback:u.jsx(Q9,{}),children:u.jsx(J9,{})}),t[0]=e):e=t[0],e},Q9=()=>{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},o3="name",r3="type-value",im="defs-refs",eO=[{id:o3,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>u.jsx(cp,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return u.jsx(bf,{name:e,declaredBy:n})}},{id:r3,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>u.jsx(cp,{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:im,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>u.jsx(cp,{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&&rp(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(Qp,{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(Ew,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],s3=M.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=q.useState([]),[s,i]=q.useState(""),a=eF(),l=M.useMemo(()=>{const h=f=>{const m=a[f];return sF(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:im,desc:!1});let x=[];switch(m.id){case o3:x=la(f,p=>p.name);break;case r3:x=la(f,p=>p.dataType);break;case im: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=tF({data:c,columns:eO,getCoreRowModel:rF(),onGlobalFilterChange:i,getFilteredRowModel:oF(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:h=>h.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:nF(),state:{sorting:o,globalFilter:s}});return u.jsxs(u.Fragment,{children:[u.jsx(aS,{className:"w-full",placeholder:"Search",value:s,onChange:h=>i(h.target.value)}),u.jsxs(ap,{className:xe("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[u.jsx(ip,{children:u.jsx(Ss,{className:"whitespace-nowrap text-xs",children:d.getFlatHeaders().map(h=>u.jsx(Cr,{className:"sticky top-0 bg-background border-b",children:dS(h.column.columnDef.header,h.getContext())},h.id))})}),u.jsx(lp,{children:d.getRowModel().rows.map(h=>u.jsx(Ss,{className:"hover:bg-accent",children:h.getVisibleCells().map(f=>u.jsx(Sr,{className:"border-b",children:dS(f.column.columnDef.cell,f.getContext())},f.id))},h.id))})]})]})});s3.displayName="VariableTable";const tO=()=>{const t=H.c(4),e=sp(),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(Xl,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=u.jsx(s3,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o},nO=t=>{const e=H.c(54),n=Ne(iF),o=Ne(R6),r=lt(),s=jC(),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,S,C,N,j;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;e[20]!==n.focusedCellId||e[21]!==z?(E={id:n.focusedCellId,graph:z},e[20]=n.focusedCellId,e[21]=z,e[22]=E):E=e[22],g=E}m=(g==null?void 0:g.id)===h.id,f=a3(h.graph)?1.5:3;const T=()=>{m?s.blurCell():(r.focusCell({cellId:h.id,where:"exact"}),s.focusCell({cellId:h.id}))};C=h.id;const D=m?"text-primary-foreground":"text-(--gray-8) hover:text-(--gray-9)";e[23]!==D?(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",D),e[23]=D,e[24]=x):x=e[24],p=T,b=cO;const L=m&&"bg-primary group-hover:bg-primary";e[25]!==L?(S=xe("group-hover:bg-(--gray-2) flex h-full w-full px-0.5 items-center rounded",L),e[25]=L,e[26]=S):S=e[26],y="truncate px-1 font-mono text-sm flex gap-1",v=h.code,w=h.graph.variables.length>0?u.jsx(iO,{cell:h,selectedCell:g}):u.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap max-w-full",children:sO(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]=S,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],S=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]!==S?(j=u.jsx("div",{className:S,children:N}),e[31]=N,e[32]=S,e[33]=j):j=e[33];const _=m?"z-30":"z-20";let O,A,R,P;return e[34]!==h||e[35]!==g||e[36]!==_?(O=xe("absolute overflow-visible top-[10.5px] left-[calc(var(--spacing-extra-small,8px)+17px)] pointer-events-none",_,function({cell:T,selectedCell:D}){return T.hasError?"text-destructive":!D&&!a3(T.graph)?"text-foreground":(D==null?void 0:D.id)===T.id||D!=null&&D.graph.parents.has(T.id)||D!=null&&D.graph.children.has(T.id)?"text-primary":"text-(--gray-8)"}({cell:h,selectedCell:g})),e[34]=h,e[35]=g,e[36]=_,e[37]=O):O=e[37],e[38]!==h||e[39]!==f||e[40]!==m||e[41]!==t.cellPositions||e[42]!==g?(A=m?u.jsx(aO,{cell:h,cellPositions:t.cellPositions,circleRadius:f}):u.jsx(lO,{cell:h,selectedCell:g,circleRadius:f}),e[38]=h,e[39]=f,e[40]=m,e[41]=t.cellPositions,e[42]=g,e[43]=A):A=e[43],e[44]!==O||e[45]!==A?(R=u.jsx("svg",{className:O,width:"1",height:"1",children:A}),e[44]=O,e[45]=A,e[46]=R):R=e[46],e[47]!==x||e[48]!==p||e[49]!==b||e[50]!==j||e[51]!==R||e[52]!==C?(P=u.jsxs("button",{"data-node-id":C,className:x,onClick:p,onMouseDown:b,children:[j,R]}),e[47]=x,e[48]=p,e[49]=b,e[50]=j,e[51]=R,e[52]=C,e[53]=P):P=e[53],P},oO=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(dO)),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,S]of r.getColumns().entries())w>0&&a.push(v),v+=S.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,S)=>{const C=a.includes(S);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(nO,{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},rO=()=>{const t=H.c(5),[e,n]=zt(qb);let o,r;return t[0]!==n?(o=()=>n(uO),t[0]=n,t[1]=o):o=t[1],Dt("global.toggleMinimap",o),t[2]!==e||t[3]!==n?(r=u.jsx(oO,{open:e,setOpen:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r};function sO(t){return t.split(`
|
163
|
+
`)[0].trim()||void 0}const iO=t=>{const e=H.c(11),{cell:n,selectedCell:o}=t,r=sp(),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&&P6(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},aO=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 lO(t){const{cell:e,selectedCell:n,circleRadius:o}=t,r=e.graph.ancestors.size>0,s=e.graph.descendants.size>0;if(!n)return i3({circleRadius:o,leftWisker:r,rightWisker:s});const i=n.graph.ancestors.has(e.id),a=n.graph.descendants.has(e.id);return i3(i||a?{circleRadius:o,leftWisker:r,rightWisker:s,shift:i&&a?void 0:i?"left":"right"}:{circleRadius:o,leftWisker:!1,rightWisker:!1})}function i3(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 a3(t){return t.variables.length===0&&t.ancestors.size===0&&t.descendants.size===0}function cO(t){return t.preventDefault()}function dO(t,e){return[t,e]}function uO(t){return!t}const hO=q.lazy(()=>Gm(()=>import("./terminal-R2SnqHO_.js"),__vite__mapDeps([126,1,2,127]),import.meta.url)),fO=t=>{const e=H.c(122),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=gc(),{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(pO)},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(xO)},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(uS,{onDragging:hS,className:b}),e[10]=b,e[11]=y):y=e[11];const v=y,w=r?"resize-handle":"resize-handle-collapsed";let S,C;e[12]!==w?(S=xe("border-border no-print z-20",w,"horizontal"),e[12]=w,e[13]=S):S=e[13],e[14]!==S?(C=u.jsx(uS,{onDragging:hS,className:S}),e[14]=S,e[15]=C):C=e[15];const N=C;let j,_,O,A,R,P,T,D,L,z,E,k,B,I,U,V,X,Y,G,W,J;e[16]!==s?(j=u.jsx("div",{className:"text-sm text-(--slate-11) uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=j):j=e[17],e[18]!==i?(_=()=>i(!1),e[18]=i,e[19]=_):_=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(O=u.jsx(wn,{className:"w-4 h-4"}),e[20]=O):O=e[20],e[21]!==_?(A=u.jsx(ve,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:_,children:O}),e[21]=_,e[22]=A):A=e[22],e[23]!==j||e[24]!==A?(R=u.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[j,A]}),e[23]=j,e[24]=A,e[25]=R):R=e[25],e[26]!==s?(P=s==="files"&&u.jsx(Kk,{}),e[26]=s,e[27]=P):P=e[27],e[28]!==s?(T=s==="errors"&&u.jsx(t9,{}),e[28]=s,e[29]=T):T=e[29],e[30]!==s?(D=s==="variables"&&u.jsx(tO,{}),e[30]=s,e[31]=D):D=e[31],e[32]!==s?(L=s==="dependencies"&&u.jsx(B7,{}),e[32]=s,e[33]=L):L=e[33],e[34]!==s?(z=s==="packages"&&u.jsx(E9,{}),e[34]=s,e[35]=z):z=e[35],e[36]!==s?(E=s==="outline"&&u.jsx(N9,{}),e[36]=s,e[37]=E):E=e[37],e[38]!==s?(k=s==="datasources"&&u.jsx(Q7,{}),e[38]=s,e[39]=k):k=e[39],e[40]!==s?(B=s==="documentation"&&u.jsx(e9,{}),e[40]=s,e[41]=B):B=e[41],e[42]!==s?(I=s==="snippets"&&u.jsx(Y9,{}),e[42]=s,e[43]=I):I=e[43],e[44]!==s?(U=s==="scratchpad"&&u.jsx(L9,{}),e[44]=s,e[45]=U):U=e[45],e[46]!==s?(V=s==="chat"&&u.jsx(cT,{}),e[46]=s,e[47]=V):V=e[47],e[48]!==s?(X=s==="logs"&&u.jsx(Xk,{}),e[48]=s,e[49]=X):X=e[49],e[50]!==s?(Y=s==="tracing"&&u.jsx(Z9,{}),e[50]=s,e[51]=Y):Y=e[51],e[52]!==s?(G=s==="secrets"&&u.jsx(F9,{}),e[52]=s,e[53]=G):G=e[53],e[54]!==P||e[55]!==T||e[56]!==D||e[57]!==L||e[58]!==z||e[59]!==E||e[60]!==k||e[61]!==B||e[62]!==I||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:[P,T,D,L,z,E,k,B,I,U,V,X,Y,G]})}),e[54]=P,e[55]=T,e[56]=D,e[57]=L,e[58]=z,e[59]=E,e[60]=k,e[61]=B,e[62]=I,e[63]=U,e[64]=V,e[65]=X,e[66]=Y,e[67]=G,e[68]=W):W=e[68],e[69]!==R||e[70]!==W?(J=u.jsx(wc,{children:u.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[R,W]})}),e[69]=R,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,Se,je,Fe,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?(Se=()=>a(!1),je=()=>a(!0),e[89]=a,e[90]=Se,e[91]=je):(Se=e[90],je=e[91]),e[92]===Symbol.for("react.memo_cache_sentinel")?(Fe=u.jsx("div",{}),e[92]=Fe):Fe=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:Fe,children:u.jsx(hO,{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(U7,{isOpen:r,children:ke}),e[98]=r,e[99]=ke,e[100]=Ye):Ye=e[100],e[101]!==ue||e[102]!==Se||e[103]!==je||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:Se,onExpand:je,children:[N,Ye]},"terminal"),e[101]=ue,e[102]=Se,e[103]=je,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=ZF(),e[107]=ee):ee=e[107],e[108]===Symbol.for("react.memo_cache_sentinel")?(ye=u.jsx($c,{children:u.jsx(q6,{})}),e[108]=ye):ye=e[108],e[109]!==Ke?(we=u.jsx(Hb,{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(fS,{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(aF,{}),e[114]=K):K=e[114],e[115]!==fe||e[116]!==Ae?(pe=u.jsxs(fS,{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(rO,{}),e[118]=ge):ge=e[118],e[119]===Symbol.for("react.memo_cache_sentinel")?(he=u.jsx(wc,{children:u.jsx($c,{children:u.jsx(U6,{})})}),e[119]=he):he=e[119],e[120]!==pe?(Ce=u.jsxs(QF,{children:[pe,ge,he]}),e[120]=pe,e[121]=Ce):Ce=e[121],Ce};function mO(){window.dispatchEvent(new Event("resize"))}function pO(){requestAnimationFrame(mO)}function gO(){window.dispatchEvent(new Event("resize"))}function xO(){requestAnimationFrame(gO)}let l3;l3=new URL(window.location.href).searchParams.get(lF.showChrome)==="false",RS=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=H.c(10);if(l3){let s,i,a;return e[0]!==t?(s=u.jsx(Vb,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(vg,{}),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(Vb,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(vg,{}),e[7]=o):o=e[7],e[8]!==n?(r=u.jsxs(fO,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{xp as C,Gc as E,dn as P,az as __tla,Yc as a,RS as e,Es as f};
|