@marimo-team/frontend 0.14.9-dev16 → 0.14.9-dev4
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-4GM2STek.js → ConnectedDataExplorerComponent-CY1m13hu.js} +1 -1
- package/dist/assets/{ImageComparisonComponent-D9i_gkAF.js → ImageComparisonComponent-B4264Ror.js} +1 -1
- package/dist/assets/{VegaLite-BNmk2IVQ.js → VegaLite-BO0hJ_xo.js} +1 -1
- package/dist/assets/{_baseEach-DH7Slkql.js → _baseEach-SeqVLkKJ.js} +1 -1
- package/dist/assets/_baseMap-STgR0zZc.js +1 -0
- package/dist/assets/{_baseUniq-CR5yKjUQ.js → _baseUniq-kOzmCq4S.js} +1 -1
- package/dist/assets/{_createAggregator-M1L5I2H2.js → _createAggregator-O5AlDYub.js} +1 -1
- package/dist/assets/{any-language-editor-CG8jFWQ6.js → any-language-editor-CUZ5sLrC.js} +1 -1
- package/dist/assets/{architectureDiagram-IEHRJDOE-CA0NgePt.js → architectureDiagram-IEHRJDOE-DiwxpZKV.js} +1 -1
- package/dist/assets/{blockDiagram-JOT3LUYC-D5EKpDOX.js → blockDiagram-JOT3LUYC-CMDxz-aZ.js} +1 -1
- package/dist/assets/{c4Diagram-VJAJSXHY-Cl2yuyMh.js → c4Diagram-VJAJSXHY-ZEdTyLTv.js} +1 -1
- package/dist/assets/channel-3cys0erM.js +1 -0
- package/dist/assets/{chunk-4BMEZGHF-CYzWMCfb.js → chunk-4BMEZGHF-tu5lF9kc.js} +1 -1
- package/dist/assets/{chunk-A2AXSNBT-LRmUxR_u.js → chunk-A2AXSNBT-Bg-q6Ee2.js} +1 -1
- package/dist/assets/{chunk-AEK57VVT-ClK8FMFn.js → chunk-AEK57VVT-BIbhPVu-.js} +1 -1
- package/dist/assets/{chunk-D6G4REZN-BESp3t-9.js → chunk-D6G4REZN-DjwIP5xi.js} +1 -1
- package/dist/assets/{chunk-RZ5BOZE2-Dd93pMgt.js → chunk-RZ5BOZE2-ADgkfa0w.js} +1 -1
- package/dist/assets/{chunk-XZIHB7SX-80AOfzmu.js → chunk-XZIHB7SX-CKtQlhpR.js} +1 -1
- package/dist/assets/{circle-play-ClvgvQfO.js → circle-play-BUr1-Oil.js} +1 -1
- package/dist/assets/classDiagram-GIVACNV2-DCKxbavX.js +1 -0
- package/dist/assets/classDiagram-v2-COTLJTTW-DCKxbavX.js +1 -0
- package/dist/assets/clone-CUc9yhNc.js +1 -0
- package/dist/assets/{compile-BapKxctZ.js → compile-BSE35how.js} +1 -1
- package/dist/assets/{dagre-OKDRZEBW-Dzg44g1a.js → dagre-OKDRZEBW-B8JslsSV.js} +1 -1
- package/dist/assets/{data-editor-DesCKnhW.js → data-editor-1E1Zn9X_.js} +1 -1
- package/dist/assets/{diagram-SSKATNLV-yGIJlmfu.js → diagram-SSKATNLV-CN6Fiimp.js} +1 -1
- package/dist/assets/{diagram-VNBRO52H-foD9F_I3.js → diagram-VNBRO52H-C_56Q8eR.js} +1 -1
- package/dist/assets/edit-page-2SrOdqX1.js +144 -0
- package/dist/assets/{erDiagram-Q7BY3M3F-B_zW8kDH.js → erDiagram-Q7BY3M3F-BxnIHW9_.js} +1 -1
- package/dist/assets/{flowDiagram-4HSFHLVR-Bwpdw5Uy.js → flowDiagram-4HSFHLVR-9r4Xnmww.js} +1 -1
- package/dist/assets/{ganttDiagram-APWFNJXF-5SJZ7IHo.js → ganttDiagram-APWFNJXF-DXElXZ8J.js} +1 -1
- package/dist/assets/{gitGraphDiagram-7IBYFJ6S-CVM-_r-L.js → gitGraphDiagram-7IBYFJ6S-O9kmR4yL.js} +1 -1
- package/dist/assets/{graph-B7t7oBoL.js → graph-BjUycJ8s.js} +1 -1
- package/dist/assets/{home-page-DGYjAu8z.js → home-page-DY3cOOMj.js} +1 -1
- package/dist/assets/{index-MjEMaXoc.js → index-7MJx6yF5.js} +1 -1
- package/dist/assets/{index-Crs-NzaN.js → index-BK_TmDtu.js} +1 -1
- package/dist/assets/{index-DgI7bmFZ.js → index-BXGJ4AI3.js} +29 -29
- package/dist/assets/{index-Nqj2CIRI.js → index-BcUGu2Gi.js} +1 -1
- package/dist/assets/{index-RiRnvaKD.js → index-BuL0w0_U.js} +1 -1
- package/dist/assets/{index-CXA4ZhRi.js → index-C3kSZfIJ.js} +1 -1
- package/dist/assets/{index-BUsmIgms.js → index-C6-ELTGf.js} +1 -1
- package/dist/assets/{index-D1MFk3jd.js → index-CK3DMhBf.js} +1 -1
- package/dist/assets/{index-f8CtQt-f.js → index-CNg5L9jn.js} +1 -1
- package/dist/assets/{index-Cg-hWwnP.js → index-CWF9_e-_.js} +1 -1
- package/dist/assets/{index-BDi8xTOx.js → index-Cg0PPcWX.js} +1 -1
- package/dist/assets/{index-DhMCHfL3.js → index-CgHfayd5.js} +1 -1
- package/dist/assets/{index-BCFq8WRB.js → index-Cn3bE0bA.js} +1 -1
- package/dist/assets/{index-D__eweoN.js → index-CyZFbTTs.js} +1 -1
- package/dist/assets/{index-_uHhs6Sh.js → index-DAyr1cwv.js} +1 -1
- package/dist/assets/{index-D-YaMjwi.js → index-DEIyie_p.js} +1 -1
- package/dist/assets/{index-CCdYqwW-.js → index-DHpa2Wnw.js} +1 -1
- package/dist/assets/{index-CqR0LnCa.js → index-DlHWowa4.js} +1 -1
- package/dist/assets/{index-Cuve3PFF.js → index-QpLaSw8U.js} +1 -1
- package/dist/assets/infoDiagram-PH2N3AL5-DIRljYH-.js +2 -0
- package/dist/assets/{journeyDiagram-U35MCT3I-BUA8I8Wc.js → journeyDiagram-U35MCT3I-CcKvPY1J.js} +1 -1
- package/dist/assets/{kanban-definition-NDS4AKOZ-Be-_-_6m.js → kanban-definition-NDS4AKOZ-CO84hXmQ.js} +1 -1
- package/dist/assets/{layout-Ccr18Tcr.js → layout-tfvjDg6a.js} +1 -1
- package/dist/assets/{linear-aSIo3jFo.js → linear-d0cd5kue.js} +1 -1
- package/dist/assets/{mermaid-DwRBzUur.js → mermaid-QZwrnvAM.js} +4 -4
- package/dist/assets/{min-DbRBnib5.js → min-B03Xa-87.js} +1 -1
- package/dist/assets/{mindmap-definition-ALO5MXBD-BSJ7OESA.js → mindmap-definition-ALO5MXBD-C_ch8jDj.js} +1 -1
- package/dist/assets/{pieDiagram-IB7DONF6-BXVOKQvJ.js → pieDiagram-IB7DONF6-DYyE6uSc.js} +1 -1
- package/dist/assets/{quadrantDiagram-7GDLP6J5-DGkfIgCG.js → quadrantDiagram-7GDLP6J5-C-m0KWn4.js} +1 -1
- package/dist/assets/{radar-MK3ICKWK-oR5xYr6W.js → radar-MK3ICKWK-ME7Z0TMH.js} +1 -1
- package/dist/assets/{react-plotly-D71O4hL-.js → react-plotly-D1xEdv1o.js} +1 -1
- package/dist/assets/{requirementDiagram-KVF5MWMF-BARKJM6F.js → requirementDiagram-KVF5MWMF-Y1205s_p.js} +1 -1
- package/dist/assets/{run-page-BF9TaeM3.js → run-page-CKp7XDrB.js} +1 -1
- package/dist/assets/{sankeyDiagram-QLVOVGJD-kKOOgW1e.js → sankeyDiagram-QLVOVGJD-B19rRtG_.js} +1 -1
- package/dist/assets/{sequenceDiagram-X6HHIX6F-BjRQpnEJ.js → sequenceDiagram-X6HHIX6F-xxPyHSGF.js} +1 -1
- package/dist/assets/{shutdown-button-DPd6RpSO.js → shutdown-button-DzNwreQ2.js} +1 -1
- package/dist/assets/{slides-component-DCpOvgK5.js → slides-component-i59pMmtt.js} +1 -1
- package/dist/assets/{sortBy-YZkl3gUo.js → sortBy-BBFFso8A.js} +1 -1
- package/dist/assets/{stateDiagram-DGXRK772-BVV1_y1h.js → stateDiagram-DGXRK772-BIthmMQN.js} +1 -1
- package/dist/assets/stateDiagram-v2-YXO3MK2T-CbU0I4_1.js +1 -0
- package/dist/assets/{storage-CwcWTgFZ.js → storage-BTaKwCDI.js} +3 -3
- package/dist/assets/{terminal-C0sEMCTv.js → terminal-C5ASsGX3.js} +1 -1
- package/dist/assets/{time-D5YMlIcS.js → time-Ccn8FbO7.js} +1 -1
- package/dist/assets/{timeline-definition-BDJGKUSR-B7sReuSj.js → timeline-definition-BDJGKUSR-D1U45jkd.js} +1 -1
- package/dist/assets/{tracing-Ci33p0F6.js → tracing-rL3XguKu.js} +2 -2
- package/dist/assets/{vega-component-BhcMOuzf.js → vega-component-CZwahgGm.js} +1 -1
- package/dist/assets/{worker-CnoOKJWk.js → worker-BwUTXR8k.js} +1 -1
- package/dist/assets/{xychartDiagram-VJFVF3MP-Diu2qzDG.js → xychartDiagram-VJFVF3MP-DOEvHlhW.js} +1 -1
- package/dist/index.html +1 -6
- package/package.json +1 -1
- package/dist/assets/_baseMap-BJiiBMYV.js +0 -1
- package/dist/assets/channel-CWOR9f3f.js +0 -1
- package/dist/assets/classDiagram-GIVACNV2-DLrZBtuR.js +0 -1
- package/dist/assets/classDiagram-v2-COTLJTTW-DLrZBtuR.js +0 -1
- package/dist/assets/clone-Bj7S21pd.js +0 -1
- package/dist/assets/edit-page-Crkla_Gn.js +0 -144
- package/dist/assets/infoDiagram-PH2N3AL5-B50DnbUV.js +0 -2
- package/dist/assets/stateDiagram-v2-YXO3MK2T-dB5U2zl9.js +0 -1
@@ -0,0 +1,144 @@
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-rL3XguKu.js","./index-BXGJ4AI3.js","./index-B-hr6ABS.css","./compile-BSE35how.js","./time-Ccn8FbO7.js","./timer-Bqd5yn_a.js","./linear-d0cd5kue.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./zoom-COrs4lFh.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./step-BwsUM5iJ.js","./arc-CfyY4LWz.js","./storage-BTaKwCDI.js","./index-CNg5L9jn.js","./index-BK_TmDtu.js","./index-QpLaSw8U.js","./index-Cn3bE0bA.js","./index-DlHWowa4.js","./index-CyZFbTTs.js","./index-CWF9_e-_.js","./index-C3kSZfIJ.js","./index-DEIyie_p.js","./index-BuL0w0_U.js","./index-BcUGu2Gi.js","./index-C6-ELTGf.js","./index-CK3DMhBf.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","./storage-De8XnUVS.css","./shutdown-button-DzNwreQ2.js","./index-DAyr1cwv.js","./shutdown-button-C1rhMrxo.css","./circle-play-BUr1-Oil.js","./_createAggregator-O5AlDYub.js","./_baseEach-SeqVLkKJ.js","./transform-DetRMEbJ.js","./sortBy-BBFFso8A.js","./_baseMap-STgR0zZc.js","./terminal-C5ASsGX3.js","./terminal-WqMRJt5Z.css"])))=>i.map(i=>d[i]);
|
2
|
+
var tz=Object.defineProperty;var F3=Bt=>{throw TypeError(Bt)};var nz=(Bt,Et,gn)=>Et in Bt?tz(Bt,Et,{enumerable:!0,configurable:!0,writable:!0,value:gn}):Bt[Et]=gn;var ee=(Bt,Et,gn)=>nz(Bt,typeof Et!="symbol"?Et+"":Et,gn),oz=(Bt,Et,gn)=>Et.has(Bt)||F3("Cannot "+gn);var z3=(Bt,Et,gn)=>(oz(Bt,Et,"read from private field"),gn?gn.call(Bt):Et.get(Bt)),B3=(Bt,Et,gn)=>Et.has(Bt)?F3("Cannot add the same private member more than once"):Et instanceof WeakSet?Et.add(Bt):Et.set(Bt,gn);import{u as Pe,Q as T,ia as rz,ib as sz,ic as U3,id as iz,ie as az,ig as lz,a as J,ih as cz,ii as Rr,ij as dz,ik as um,il as V3,im as uz,io as hz,ip as $3,iq as lc,c as K,ez as fz,aq as ut,j as u,ag as no,an as ar,am as Ls,ao as Fs,br as lr,W as De,ap as xn,ir as oa,al as cr,aR as Hn,ar as ra,a4 as Te,a0 as en,dW as hm,eJ as zs,is as mz,aM as nt,a8 as Ot,it as pz,eP as Wn,iu as H3,iv as W3,iw as fm,ix as q3,iy as gz,L as Dt,dD as cc,aY as dr,iz as dc,a_ as mm,au as In,iA as _z,a7 as pm,iB as bz,iC as G3,eO as Y3,_ as Gt,b5 as J3,iD as K3,cF as gm,iE as yz,dN as ct,iF as X3,dU as _m,iG as xz,iH as uc,Z as $e,bc as qn,iI as hc,iJ as Bs,eE as Us,iK as wz,iL as sa,iM as vz,eM as kz,iN as Z3,iO as Q3,en as Sz,iP as ur,iQ as Pr,aW as fc,iR as Cz,iS as mc,iT as e4,a5 as Vs,eb as t4,a6 as ia,iU as Nz,iV as bm,iW as Lr,bt as Fr,eF as $s,fl as n4,g5 as zr,fA as jz,bf as an,iX as Ez,iY as Iz,g3 as ym,aO as pc,iZ as xm,i_ as Az,i$ as o4,j0 as wm,j1 as Tz,j2 as Mz,j3 as go,j4 as r4,g9 as vm,j5 as aa,j6 as gc,es as je,j7 as qe,j8 as km,j9 as St,ja as s4,dx as _c,dt as bc,du as yc,dv as xc,ds as la,jb as Oz,fy as Sm,b4 as An,aI as Gn,fo as i4,fq as a4,fr as Dz,fw as Rz,fs as l4,V as Ae,em as Pz,aU as Hs,b2 as Ws,aV as qs,a$ as Yt,eN as _o,jc as Lz,fu as c4,jd as Fz,fm as d4,fn as u4,je as Br,dw as h4,jf as f4,jg as zz,jh as Bz,ak as Uz,aj as Vz,ji as Cm,dA as $z,dC as Nm,fa as wc,jj as vc,jk as kc,bw as Tn,jl as Hz,eI as ca,f7 as mn,bk as m4,dX as Vt,jm as Wz,eh as qz,ah as jm,jn as da,jo as Sc,jp as Gz,jq as Yz,jr as p4,js as pn,g8 as g4,eo as Cc,bn as Jz,jt as Kz,at as Em,aX as Xz,ju as Zz,gu as Im,bj as Nc,jv as Am,as as ua,eA as _4,jw as Qz,ai as eB,jx as b4,jy as tB,jz as nB,jA as oB,jB as rB,jC as sB,dy as zo,jD as iB,jE as jc,jF as Gs,o as Bo,n as st,fP as Mn,jG as On,jH as dt,jI as Ys,jJ as Rt,g4 as Jt,jK as Tm,er as oo,jL as aB,jM as lB,bh as y4,bi as x4,jN as w4,jO as cB,gw as Js,jP as Ec,be as Ic,gx as Ur,eQ as Mm,jQ as dB,jR as uB,jS as hB,jT as fB,jU as v4,jV as ha,jW as k4,jX as mB,jY as S4,jZ as C4,j_ as pB,j$ as N4,k0 as j4,eR as Ac,k1 as gB,k2 as E4,k3 as fa,k4 as ma,k5 as Tc,k6 as hr,k7 as I4,k8 as Uo,k9 as Ks,ka as Om,kb as pa,kc as Xs,kd as Dm,ke as Rm,kf as A4,kg as Mc,kh as _B,S as ga,ki as _a,kj as bB,dT as Oc,kk as yB,kl as Pm,km as xB,kn as wB,ko as Dc,e0 as vB,kp as Lm,kq as Zs,kr as Rc,ks as Qs,fO as Yn,fZ as Vo,fL as T4,cp as M4,kt as Fm,fx as O4,ku as zm,kv as D4,kw as R4,kx as Bm,ky as ba,kz as ya,kA as xa,kB,fH as Pc,kC as Lc,kD as Fc,eg as SB,fI as CB,kE as NB,kF as jB,kG as EB,kH as IB,r as AB,kI as TB,kJ as MB,kK as OB,fS as DB,kL as fr,kM as RB,kN as P4,t as P,kO as PB,kP as LB,kQ as FB,kR as zB,kS as BB,kT as UB,kU as VB,kV as $B,kW as HB,kX as WB,kY as qB,kZ as GB,k_ as YB,k$ as JB,l0 as KB,l1 as XB,l2 as ZB,l3 as QB,l4 as eU,l5 as tU,l6 as nU,l7 as oU,l8 as rU,l9 as sU,la as iU,lb as aU,lc as lU,ld as L4,le as cU,lf as dU,lg as uU,lh as Um,li as zc,lj as F4,lk as hU,ll as fU,lm as z4,ln as mU,lo as ei,lp as Jn,lq as pU,lr as gU,ls as _U,lt as bU,lu as yU,lv as xU,lw as wU,lx as vU,ly as kU,lz as SU,lA as mr,lB as CU,lC as NU,lD as jU,lE as EU,dZ as IU,lF as AU,lG as B4,e1 as TU,lH as Bc,lI as MU,lJ as OU,lK as DU,lL as RU,X as pr,lM as Uc,lN as PU,lO as LU,lP as U4,lQ as Vm,gv as ti,lR as FU,lS as zU,lT as BU,lU as UU,fX as VU,bq as $U,$ as $m,lV as V4,lW as HU,lX as WU,lY as Hm,lZ as Wm,l_ as qU,l$ as $4,m0 as H4,m1 as Vc,fK as GU,ab as W4,dL as YU,m2 as q4,fj as jt,m3 as wa,m4 as ni,m5 as JU,m6 as KU,m7 as qm,m8 as XU,co as Gm,m9 as ZU,U as gr,bg as G4,ma as QU,mb as eV,mc as $c,md as Y4,dJ as Ym,bs as J4,me as tV,mf as nV,mg as K4,mh as oV,mi as rV,mj as X4,ac as Jm,mk as sV,bu as Z4,ml as iV,eH as aV,mm as $o,ek as Q4,mn as eS,eL as tS,fB as Hc,mo as Km,mp as nS,aT as Xm,el as Wc,mq as oS,mr as lV,ms as cV,mt as dV,mu as rS,mv as uV,mw as sS,mx as hV,gm as fV,fp as mV,ft as Zm,gp as pV,bp as qc,my as gV,mz as iS,mA as Qm,mB as _V,mC as bV,mD as yV,mE as xV,mF as aS,fc as ep,dF as lS,mG as wV,mH as vV,mI as kV,aN as SV,mJ as CV,mK as NV,mL as jV,mM as EV,a9 as IV,mN as Gc,aa as AV,mO as cS,f8 as TV,mP as dS,ad as Kn,fF as MV,mQ as OV,mR as DV,mS as uS,mT as RV,mU as oi,mV as PV,mW as Yc,mX as LV,mY as FV,y as hS,mZ as zV,dl as BV,m_ as va,m$ as UV,n0 as VV,n1 as $V,n2 as HV,C as fS,n3 as WV,n4 as qV,n5 as GV,E as Vr,eW as YV,bd as JV,bb as KV,n6 as XV,n7 as ZV,a2 as Jc,n8 as QV,a3 as _r,dI as mS,n9 as tp,na as e$,dV as pS,nb as t$,nc as gS,nd as n$,ne as _S,nf as o$,ng as r$,nh as bS,ni as yS,nj as xS,f6 as wS,nk as s$,nl as i$,nm as vS,nn as kS,no as Kc,np as SS,nq as a$,nr as CS,ns as l$,nt as c$,nu as NS,nv as d$,nw as u$,nx as h$,ny as f$,nz as m$,nA as p$,nB as g$,dS as _$,nC as b$,nD as y$,fY as np,nE as x$,nF as w$,nG as v$,nH as k$,nI as S$,nJ as C$,nK as N$,nL as j$,nM as E$,nN as I$,nO as op,nP as A$,fN as T$,nQ as M$,nR as O$,nS as D$,nT as jS,nU as R$,nV as P$,a1 as L$,eC as F$,ge as z$,nW as B$,nX as U$,gg as rp,gc as ri,gh as $r,gd as Hr,gi as sp,gj as ip,nY as ES,gf as V$,nZ as IS,n_ as $$,n$ as AS,o0 as br,o1 as TS,go as H$,o2 as W$,o3 as q$,o4 as G$,o5 as Y$,o6 as J$,o7 as K$,o8 as MS,et as X$,o9 as ap,av as Xc,oa as OS,ob as DS,ax as RS,aw as Z$,dR as Q$,__tla as eH}from"./index-BXGJ4AI3.js";import{b as si,A as tH,L as PS,g as nH,G as oH,s as rH,k as sH,B as LS,a as iH,M as aH,Y as lH,c as wn,u as ka,C as cH,S as dH,K as uH,d as hH,i as fH,e as FS,f as mH,h as pH,j as Sa,P as lp,l as zS,m as gH,n as _H,o as bH,p as BS,q as cp,T as yH}from"./shutdown-button-DzNwreQ2.js";import{V as US,d as ii,I as dp,N as VS,S as $S,e as HS,f as WS,L as qS,F as GS,g as YS,M as xH,l as JS,h as wH,j as Ho,k as Zc,m as Qc,i as vH,E as KS,n as kH,o as up,p as SH,q as CH,s as NH,t as jH,v as EH,w as IH,x as AH,y as TH,a as MH,C as OH,R as XS,A as DH,b as RH,T as PH,z as LH,B as FH,D as zH,G as BH,O as UH,c as VH,P as $H,__tla as HH}from"./storage-BTaKwCDI.js";import{c as WH}from"./_createAggregator-O5AlDYub.js";import{s as ro,i as yr,T as hp,a as fp}from"./transform-DetRMEbJ.js";import{g as ZS}from"./timer-Bqd5yn_a.js";import{i as qH}from"./zoom-COrs4lFh.js";import{s as Ca}from"./sortBy-BBFFso8A.js";let mp,ed,vn,td,QS,Na,pp,GH=Promise.all([(()=>{try{return eH}catch{}})(),(()=>{try{return HH}catch{}})()]).then(async()=>{var sc,L3;var Bt=WH(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let Et,gn,gp,nd,ai,Wr,_p,bp,yp,xp,ja,od,wp,Ea,vp,rd,kp,Sp,sd,Cp,Np,jp,Ia,Ep,id,Ip,Ap,Tp,Mp,Op,Dp,ad,Rp,ld,cd,Pp,Lp,Fp,zp,Bp,Aa,Up,Vp,dd,$p,Hp,Wp,ud,qp,Gp,Yp,Ta,hd,fd,Jp,Kp,Xp,Zp,Qp,eg,tg,ng,og,md,pd,rg,sg,ig,Ma,xr,wr;Et=Pe("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),gn=Pe("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"}]]),gp=Pe("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"}]]),nd=Pe("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),ai=Pe("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),Wr=Pe("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"}]]),_p=Pe("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),bp=Pe("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),td=Pe("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),yp=Pe("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),xp=Pe("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),ja=Pe("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),od=Pe("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=Pe("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"}]]),Ea=Pe("cloud-download",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]]),vp=Pe("code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]),rd=Pe("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"}]]),kp=Pe("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=Pe("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"}]]),sd=Pe("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),Cp=Pe("eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]),Np=Pe("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"}]]),jp=Pe("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"}]]),Ia=Pe("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"}]]),Ep=Pe("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"}]]),id=Pe("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=Pe("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=Pe("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=Pe("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=Pe("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=Pe("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=Pe("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"}]]),ad=Pe("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=Pe("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"}]]),ld=Pe("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"}]]),cd=Pe("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=Pe("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=Pe("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=Pe("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"}]]),zp=Pe("message-circle-question",[["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"}]]),Bp=Pe("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"}]]),Aa=Pe("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"}]]),Up=Pe("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=Pe("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"}]]),dd=Pe("package-x",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["path",{d:"m17 13 5 5m-5 0 5-5",key:"im3w4b"}]]),$p=Pe("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Hp=Pe("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"}]]),Wp=Pe("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"}]]),ud=Pe("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"}]]),qp=Pe("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"}]]),Gp=Pe("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"}]]),Yp=Pe("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"}]]),Ta=Pe("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"}]]),hd=Pe("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"}]]),fd=Pe("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"}]]),Jp=Pe("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),Kp=Pe("square-code",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),Xp=Pe("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"}]]),Zp=Pe("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"}]]),Qp=Pe("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),eg=Pe("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"}]]),tg=Pe("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"}]]),ng=Pe("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"}]]),og=Pe("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"}]]),md=Pe("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"}]]),pd=Pe("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"}]]),rg=Pe("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),sg=Pe("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"}]]),ig=Pe("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=Pe("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"}]]),xr=Pe("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"}]]),wr=Pe("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"}]]);const eC=T.createContext({}),tC=T.forwardRef(function(t,e){[t,e]=az(t,e,eC);let{toolbarProps:n}=function(s,i){const{"aria-label":a,"aria-labelledby":l,orientation:c="horizontal"}=s;let[d,h]=T.useState(!1);rz(()=>{var p;h(!(!i.current||!(!((p=i.current.parentElement)===null||p===void 0)&&p.closest('[role="toolbar"]'))))});const{direction:f}=sz(),m=f==="rtl"&&c==="horizontal";let _=iz(i);const g=T.useRef(null);return{toolbarProps:{...U3(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?_.focusPrevious():_.focusNext();else{if(!(c==="horizontal"&&p.key==="ArrowLeft"||c==="vertical"&&p.key==="ArrowUp"))return p.key==="Tab"?(p.stopPropagation(),g.current=document.activeElement,void(p.shiftKey?_.focusFirst():_.focusLast())):void 0;m?_.focusNext():_.focusPrevious()}p.stopPropagation(),p.preventDefault()}},onFocusCapture:d?void 0:p=>{var b,y;g.current&&!p.currentTarget.contains(p.relatedTarget)&&(!((b=i.current)===null||b===void 0)&&b.contains(p.target))&&((y=g.current)===null||y===void 0||y.focus(),g.current=null)},onBlurCapture:d?void 0:p=>{p.currentTarget.contains(p.relatedTarget)||g.current||(g.current=p.target)}}}}(t,e),o=lz({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=U3(t);return delete r.id,J.createElement("div",{...cz(n,r),...o,ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)});function Oa(t,e){const n=+Rr(t)-+Rr(e);return n<0?-1:n>0?1:n}function nC(t,e){const n=Rr(t,e==null?void 0:e.in);return+function(o,r){const s=Rr(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s}(n,e)==+function(o,r){const s=Rr(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 oC(t,e,n){const[o,r,s]=um(n==null?void 0:n.in,t,t,e),i=Oa(r,s),a=Math.abs(function(d,h,f){const[m,_]=um(f==null?void 0:f.in,d,h);return 12*(m.getFullYear()-_.getFullYear())+(m.getMonth()-_.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=Oa(r,s)===-i;nC(o)&&a===1&&Oa(o,s)===1&&(l=!1);const c=i*(a-+l);return c===0?0:c}function rC(t,e,n){const o=function(r,s){return+Rr(r)-+Rr(s)}(t,e)/1e3;return(r=>{const s=(0,Math.trunc)(r);return s===0?0:s})(o)}function sC(t,e){return function(n,o,r){const s=uz(),i=(r==null?void 0:r.locale)??s.locale??hz,a=Oa(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]=um(r==null?void 0:r.in,...a>0?[o,n]:[n,o]),h=rC(d,c),f=(V3(d)-V3(c))/1e3,m=Math.round((h-f)/60);let _;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<$3){const g=Math.round(m/60);return i.formatDistance("aboutXHours",g,l)}if(m<2520)return i.formatDistance("xDays",1,l);if(m<lc){const g=Math.round(m/$3);return i.formatDistance("xDays",g,l)}if(m<2*lc)return _=Math.round(m/lc),i.formatDistance("aboutXMonths",_,l);if(_=oC(d,c),_<12){const g=Math.round(m/lc);return i.formatDistance("xMonths",g,l)}{const g=_%12,p=Math.trunc(_/12);return g<3?i.formatDistance("aboutXYears",p,l):g<9?i.formatDistance("overXYears",p,l):i.formatDistance("almostXYears",p+1,l)}}(t,function(n){return dz(n,Date.now())}(t),e)}const Da="https://static.marimo.app",iC=t=>{const e=K.c(24),{onClose:n}=t,[o,r]=T.useState("");let s;s=Math.random().toString(36).slice(2,6);const i=`${o}-${s}`,a=`${Da}/static/${i}`;let l,c,d,h,f,m,_,g,p,b,y;return e[0]!==n||e[1]!==i?(l=async x=>{x.preventDefault(),n();const k=await fz({download:!1,includeCode:!0,files:US.INSTANCE.filenames()}),C=ut({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Da}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:k,path:i})}).catch(()=>{C.dismiss(),ut({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:no.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),C.dismiss(),ut({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]=n,e[1]=i,e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(ar,{children:"Share static notebook"}),e[3]=c):c=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsxs(Ls,{children:[c,u.jsxs(Fs,{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:Da,target:"_blank",children:Da}),"."]})]}),e[4]=d):d=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=x=>{const k=x.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(k)},e[5]=h):h=e[5],e[6]!==o?(f=u.jsx(lr,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:h,required:!0,autoComplete:"off"}),e[6]=o,e[7]=f):f=e[7],e[8]!==a?(m=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(aC,{text:a}),u.jsx("span",{className:"text-primary",children:a})]})]}),e[8]=a,e[9]=m):m=e[9],e[10]!==f||e[11]!==m?(_=u.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[f,m]}),e[10]=f,e[11]=m,e[12]=_):_=e[12],e[13]!==n?(g=u.jsx(De,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[13]=n,e[14]=g):g=e[14],e[15]!==a?(p=u.jsx(De,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await xn(a)},children:"Create"}),e[15]=a,e[16]=p):p=e[16],e[17]!==p||e[18]!==g?(b=u.jsxs(oa,{children:[g,p]}),e[17]=p,e[18]=g,e[19]=b):b=e[19],e[20]!==b||e[21]!==l||e[22]!==_?(y=u.jsx(cr,{className:"w-fit",children:u.jsxs("form",{onSubmit:l,children:[d,_,b]})}),e[20]=b,e[21]=l,e[22]=_,e[23]=y):y=e[23],y},aC=t=>{const e=K.c(8),[n,o]=J.useState(!1);let r;e[0]!==t.text?(r=Hn.stopPropagation(async c=>{c.preventDefault(),await xn(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(ra,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2],e[3]!==s?(a=u.jsx(De,{"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(Te,{content:"Copied!",open:n,children:a}),e[5]=n,e[6]=a,e[7]=l):l=e[7],l};function ag(){const t=K.c(2),e=en(hm);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let s;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=zs.parse(i.parentNode.id);break}}e(i=>({mode:mz(i.mode),cellAnchor:s})),requestAnimationFrame(()=>{var i;s!==null&&((i=document.getElementById(zs.create(s)))==null||i.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function gd(t){const e=K.c(3),n=_d();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],nt(o)}function lg(){const t=K.c(2),e=_d();let n;return t[0]!==e?(n=()=>e(H3(Wn())),t[0]=e,t[1]=n):n=t[1],nt(n)}function _d(){const t=K.c(2),{prepareForRun:e}=Ot();let n;return t[0]!==e?(n=async o=>{var a,l;if(o.length===0)return;const{cellHandles:r,cellData:s}=Wn(),i=[];for(const c of o){const d=r[c],h=(a=d==null?void 0:d.current)==null?void 0:a.editorView;let f;h?(W3(h)!=="markdown"&&fm(h),f=q3(h)):f=((l=s[c])==null?void 0:l.code)||"",i.push(f),e({cellId:c})}await gz({cellIds:o,codes:i}).catch(lC)},t[0]=e,t[1]=n):n=t[1],nt(n)}function lC(t){Dt.error(t)}const bd=[{type:"files",Icon:Ip,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:cc,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:dr,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:Aa,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:si,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:fd,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:dc,tooltip:"Chat with AI",position:"sidebar"},{type:"documentation",Icon:md,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:mm,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:tH,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:Xp,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:Dp,tooltip:"Secrets",hidden:In(),position:"sidebar"},{type:"scratchpad",Icon:_z,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:pm,tooltip:"View errors",position:"footer"}];function cC(){const t=K.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=K.c(11);let c;l[0]!==a?(c=new bz(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]=T.useState(h);let _;l[5]!==i||l[6]!==d?(_=b=>{m(b),d.set(i,b)},l[5]=i,l[6]=d,l[7]=_):_=l[7];const g=_;let p;return l[8]!==g||l[9]!==f?(p=[f,g],l[8]=g,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 cg(t){return t.dropdown!==void 0}function Ra(t,e=""){return t.flatMap(n=>n.label?cg(n)?Ra(n.dropdown,`${e+n.label} > `):{...n,label:e+n.label}:[])}const li=t=>{const e=K.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=J.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},Pa=Gt(null),dC=Gt(!1),yd=J3("marimo:ai:chatState:v2",{chats:[],activeChatId:null}),uC=Gt(t=>{const e=t(yd);return e.chats.find(n=>n.id===e.activeChatId)},(t,e,n)=>{e(yd,o=>({...o,activeChatId:n}))});function dg(t){return t!==K3&&!!(t&&t.trim().length>0)}const xd=t=>{const e=K.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],gm(window,"keydown",n,o);const r=t.children??"Undo";let s,i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx(yz,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(i=u.jsxs(De,{"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 wd(){const t=K.c(3),{deleteCell:e,undoDeleteCell:n}=Ot();let o;return t[0]!==e||t[1]!==n?(o=r=>{var l;if(ct.get(X3))return;const{cellId:s}=r,i=ct.get(_m),a=(((l=i.cellData[s])==null?void 0:l.code)??"").trim()==="";if(e({cellId:s}),xz({cellId:s}).catch(()=>{n()}),!a){const{dismiss:c}=ut({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:u.jsx(xd,{"data-testid":"undo-delete-button",onClick:()=>{n(),d()}})}),d=c}},t[0]=e,t[1]=n,t[2]=o):o=t[2],nt(o)}function ug(){const t=K.c(3),{splitCell:e,undoSplitCell:n}=Ot();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=uc(r.cellId);if(!s)return;const i=q3(s);e(r);const{dismiss:a}=ut({title:"Cell split",action:u.jsx(xd,{"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],nt(o)}function vd(t){const e=K.c(49),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:i,sendToTop:a,sendToBottom:l,addColumnBreakpoint:c,clearCellOutput:d}=Ot(),h=ug(),f=gd(n==null?void 0:n.cellId),m=!$e(X3),_=wd(),{openModal:g}=qn(),p=en(Pa),b=$e(hc),y=$e(Bs),x=$e(Us),k=$e(wz);if(!n||x){let j;return e[0]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[0]=j):j=e[0],j}const{cellId:C,config:v,getEditorView:E,name:N,hasOutput:I,hasConsoleOutput:A,status:M}=n;let R;e[1]!==C||e[2]!==v.disabled||e[3]!==r?(R=async()=>{const j={disabled:!v.disabled};await Lr({configs:{[C]:j}}),r({cellId:C,config:j})},e[1]=C,e[2]=v.disabled,e[3]=r,e[4]=R):R=e[4];const z=R;let D;e[5]!==C||e[6]!==v.hide_code||e[7]!==E||e[8]!==r?(D=async()=>{const j={hide_code:!v.hide_code};await Lr({configs:{[C]:j}}),r({cellId:C,config:j});const W=E();W&&(j.hide_code?W.contentDOM.blur():W.focus())},e[5]=C,e[6]=v.hide_code,e[7]=E,e[8]=r,e[9]=D):D=e[9];const F=D;let B,U,O,S,$;return e[10]===Symbol.for("react.memo_cache_sentinel")?(B=u.jsx(og,{size:13,strokeWidth:1.5}),e[10]=B):B=e[10],e[11]!==C||e[12]!==N||e[13]!==g||e[14]!==s?(U=()=>{g(u.jsxs(cr,{children:[u.jsx(Ls,{children:u.jsx(ar,{children:"Rename cell"})}),u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx(Fr,{htmlFor:"cell-name",children:"Cell name"}),u.jsx(VS,{placeholder:"cell name",value:N,onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),j.stopPropagation(),g(null))},onChange:j=>s({cellId:C,name:j})})]})]}))},e[11]=C,e[12]=N,e[13]=g,e[14]=s,e[15]=U):U=e[15],e[16]!==C||e[17]!==s?(O=j=>s({cellId:C,name:j}),e[16]=C,e[17]=s,e[18]=O):O=e[18],e[19]!==N||e[20]!==O?(S=u.jsx(VS,{placeholder:"cell name",value:N,onChange:O}),e[19]=N,e[20]=O,e[21]=S):S=e[21],e[22]!==c||e[23]!==b||e[24]!==k||e[25]!==y||e[26]!==m||e[27]!==C||e[28]!==d||e[29]!==v.disabled||e[30]!==v.hide_code||e[31]!==o||e[32]!==_||e[33]!==E||e[34]!==A||e[35]!==I||e[36]!==i||e[37]!==N||e[38]!==f||e[39]!==l||e[40]!==a||e[41]!==p||e[42]!==h||e[43]!==M||e[44]!==U||e[45]!==S||e[46]!==z||e[47]!==F?($=[[{icon:B,label:"Name",disableClick:!0,handle:pC,handleHeadless:U,rightElement:S},{icon:u.jsx(ii,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:M==="running"||M==="queued"||M==="disabled-transitively"||v.disabled,handle:()=>f()},{icon:u.jsx(sa,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!b,handle:()=>{p(j=>(j==null?void 0:j.cellId)===C?null:{cellId:C})},hotkey:"cell.aiCompletion"},{icon:u.jsx(hd,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>h({cellId:C})},{icon:u.jsx(dp,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!I,handle:()=>function(j){const W=document.getElementById(G3.create(j));W&&(W.classList.add("printing-output"),Y3(W,"result.png").finally(()=>{W.classList.remove("printing-output")}))}(C)},{icon:u.jsx(kz,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const j=E();j&&vz({[C]:j})}},{icon:v.hide_code?u.jsx(Z3,{size:13,strokeWidth:1.5}):u.jsx(Q3,{size:13,strokeWidth:1.5}),label:v.hide_code?"Show code":"Hide code",handle:F,hotkey:"cell.hideCode"},{icon:v.disabled?u.jsx(xr,{size:13,strokeWidth:1.5}):u.jsx(wr,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:u.jsx(Sz,{"data-testid":"cell-disable-switch",checked:!v.disabled,size:"sm",onCheckedChange:z}),handle:z},{icon:u.jsx(pm,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(I||A),handle:()=>{d({cellId:C})}}],[{icon:u.jsx(fc,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const j=E();j&&(ur(y,o),Pr(j,"markdown",{keepCodeAsIs:!1}))}},{icon:u.jsx(dr,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const j=E();j&&(ur(y,o),Pr(j,"sql",{keepCodeAsIs:!1}))}},{icon:u.jsx(mc,{}),label:"Toggle as Python",handle:()=>{const j=E();j&&(ur(y,o),Cz(j,"python",{force:!0}))}}],[{icon:u.jsxs(li,{children:[u.jsx(ja,{size:13,strokeWidth:1.5}),u.jsx(e4,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:C,before:!0})},{icon:u.jsxs(li,{children:[u.jsx(ja,{size:13,strokeWidth:1.5}),u.jsx(Vs,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:C,before:!1})},{icon:u.jsx(e4,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>i({cellId:C,before:!0})},{icon:u.jsx(Vs,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>i({cellId:C,before:!1})},{icon:u.jsx(t4,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>i({cellId:C,direction:"left"}),hidden:k!=="columns"},{icon:u.jsx(ia,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>i({cellId:C,direction:"right"}),hidden:k!=="columns"},{icon:u.jsx(bp,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>a({cellId:C})},{icon:u.jsx(_p,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>l({cellId:C})},{icon:u.jsx(Nz,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:k!=="columns",handle:()=>c({cellId:C})}],[{icon:u.jsx(PS,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!dg(N),tooltip:dg(N)?void 0:"Only named cells can be linked to",handle:async()=>{await xn(function(j){const W=new URL(window.location.href);return W.hash=`scrollTo=${encodeURIComponent(j)}`,W.toString()}(N)),ut({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!m,variant:"danger",icon:u.jsx(bm,{size:13,strokeWidth:1.5}),handle:()=>{_({cellId:C})}}]].map(fC).filter(hC),e[22]=c,e[23]=b,e[24]=k,e[25]=y,e[26]=m,e[27]=C,e[28]=d,e[29]=v.disabled,e[30]=v.hide_code,e[31]=o,e[32]=_,e[33]=E,e[34]=A,e[35]=I,e[36]=i,e[37]=N,e[38]=f,e[39]=l,e[40]=a,e[41]=p,e[42]=h,e[43]=M,e[44]=U,e[45]=S,e[46]=z,e[47]=F,e[48]=$):$=e[48],$}function hC(t){return t.length>0}function fC(t){return t.filter(mC)}function mC(t){return!t.hidden}function pC(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}function gC(t){return!t.hidden}const kd=Gt(!1),hg=()=>{const t=K.c(37),[e,n]=an(kd),o=Ez(),r=$e(Iz),s=$e(ym);let i;t[0]!==r?(i={cell:r},t[0]=r,t[1]=i):i=t[1];let a=vd(i).flat();a=Ra(a);const l=function(){const O=K.c(61),[S,$]=$s(),[j,W]=n4();let X;O[0]!==$?(X=async Q=>{await zr({config:Q}).then(()=>{$(Q)})},O[0]=$,O[1]=X):X=O[1];const Y=X;let q;O[2]!==W?(q=async Q=>{await jz({config:Q}).then(()=>{W(Q)})},O[2]=W,O[3]=q):q=O[3];const ne=q;let re;if(O[4]!==j||O[5]!==S||O[6]!==ne||O[7]!==Y){let Q,he,pe,ce,fe;O[9]!==j?(Q=Me=>Me!==j.width,O[9]=j,O[10]=Q):Q=O[10],O[11]!==j||O[12]!==ne?(he=Me=>({label:`App config > Set width=${Me}`,handle:()=>{ne({...j,width:Me})}}),O[11]=j,O[12]=ne,O[13]=he):he=O[13],O[14]!==S||O[15]!==Y?(pe={label:"Config > Set theme: dark",handle:()=>{Y({...S,display:{...S.display,theme:"dark"}})}},O[14]=S,O[15]=Y,O[16]=pe):pe=O[16],O[17]!==S||O[18]!==Y?(ce={label:"Config > Set theme: light",handle:()=>{Y({...S,display:{...S.display,theme:"light"}})}},O[17]=S,O[18]=Y,O[19]=ce):ce=O[19],O[20]!==S||O[21]!==Y?(fe={label:"Config > Set theme: system",handle:()=>{Y({...S,display:{...S.display,theme:"system"}})}},O[20]=S,O[21]=Y,O[22]=fe):fe=O[22];const de=S.keymap.preset==="vim";let Ce,Ne;O[23]!==S||O[24]!==Y?(Ce=()=>{Y({...S,keymap:{...S.keymap,preset:"vim"}})},O[23]=S,O[24]=Y,O[25]=Ce):Ce=O[25],O[26]!==de||O[27]!==Ce?(Ne={label:"Config > Switch keymap to VIM",hidden:de,handle:Ce},O[26]=de,O[27]=Ce,O[28]=Ne):Ne=O[28];const se=S.keymap.preset==="default";let Ie,be,Oe;O[29]!==S||O[30]!==Y?(Ie=()=>{Y({...S,keymap:{...S.keymap,preset:"default"}})},O[29]=S,O[30]=Y,O[31]=Ie):Ie=O[31],O[32]!==se||O[33]!==Ie?(be={label:"Config > Switch keymap to default (current: VIM)",hidden:se,handle:Ie},O[32]=se,O[33]=Ie,O[34]=be):be=O[34],O[35]!==S||O[36]!==Y?(Oe=()=>{Y({...S,completion:{...S.completion,copilot:!1}})},O[35]=S,O[36]=Y,O[37]=Oe):Oe=O[37];const ze=S.completion.copilot!=="github";let Ge,Je;O[38]!==Oe||O[39]!==ze?(Ge={label:"Config > Disable GitHub Copilot",handle:Oe,hidden:ze},O[38]=Oe,O[39]=ze,O[40]=Ge):Ge=O[40],O[41]!==S||O[42]!==Y?(Je=()=>{Y({...S,completion:{...S.completion,copilot:"github"}})},O[41]=S,O[42]=Y,O[43]=Je):Je=O[43];const Le=S.completion.copilot==="github";let et;O[44]!==Je||O[45]!==Le?(et={label:"Config > Enable GitHub Copilot",handle:Je,hidden:Le},O[44]=Je,O[45]=Le,O[46]=et):et=O[46];const Qe=!S.display.reference_highlighting;let tt,te,ye,ke;O[47]!==S||O[48]!==Y?(tt=()=>{Y({...S,display:{...S.display,reference_highlighting:!1}})},O[47]=S,O[48]=Y,O[49]=tt):tt=O[49],O[50]!==Qe||O[51]!==tt?(te={label:"Config > Disable reference highlighting",hidden:Qe,handle:tt},O[50]=Qe,O[51]=tt,O[52]=te):te=O[52],O[53]!==S||O[54]!==Y?(ye=()=>{Y({...S,display:{...S.display,reference_highlighting:!0}})},O[53]=S,O[54]=Y,O[55]=ye):ye=O[55],O[56]!==S.display.reference_highlighting||O[57]!==ye?(ke={label:"Config > Enable reference highlighting",hidden:S.display.reference_highlighting,handle:ye},O[56]=S.display.reference_highlighting,O[57]=ye,O[58]=ke):ke=O[58],re=[...nH().filter(Q).map(he),pe,ce,fe,Ne,be,Ge,et,te,ke],O[4]=j,O[5]=S,O[6]=ne,O[7]=Y,O[8]=re}else re=O[8];const ae=re;let Z;return O[59]!==ae?(Z=ae.filter(gC),O[59]=ae,O[60]=Z):Z=O[60],Z}();let c=Vg();c=[...Ra(c),...Ra(l)];const d=c.filter(_C),h=pc.keyBy(d,bC),{recentCommands:f,addRecentCommand:m}=cC();let _;t[2]!==f?(_=new Set(f),t[2]=f,t[3]=_):_=t[3];const g=_;let p,b;t[4]!==s||t[5]!==n?(p=O=>{Mz(s.getHotkey("global.commandPalette").key)(O)&&(O.preventDefault(),n(yC))},t[4]=s,t[5]=n,t[6]=p):p=t[6],gm(document,"keydown",p),t[7]!==m||t[8]!==s||t[9]!==o||t[10]!==n?(b=(O,S)=>{const $=o[O];if(!$)return null;const j=s.getHotkey(O);return u.jsxs(go,{disabled:S.disabled,onSelect:()=>{m(O),n(!1),requestAnimationFrame(()=>{$()})},value:j.name,children:[u.jsxs("span",{children:[j.name,S.tooltip&&u.jsx("span",{className:"ml-2",children:S.tooltip})]}),u.jsx(r4,{children:u.jsx(vm,{shortcut:j.key})})]},O)},t[7]=m,t[8]=s,t[9]=o,t[10]=n,t[11]=b):b=t[11];const y=b;let x;t[12]!==m||t[13]!==s||t[14]!==n?(x=(O,S,$,j)=>{const W=$===void 0?{}:$;return u.jsxs(go,{disabled:W.disabled,onSelect:()=>{m(O),n(!1),requestAnimationFrame(()=>{S()})},value:O,children:[u.jsxs("span",{children:[O,W.tooltip&&u.jsxs("span",{className:"ml-2",children:["(",W.tooltip,")"]})]}),j&&u.jsx(r4,{children:u.jsx(vm,{shortcut:s.getHotkey(j).key})})]},O)},t[12]=m,t[13]=s,t[14]=n,t[15]=x):x=t[15];const k=x,C=Tz;let v;t[16]===Symbol.for("react.memo_cache_sentinel")?(v=u.jsx(aa,{placeholder:"Type to search..."}),t[16]=v):v=t[16];const E=wm;let N;t[17]===Symbol.for("react.memo_cache_sentinel")?(N=u.jsx(gc,{children:"No results found."}),t[17]=N):N=t[17];const I=f.length>0&&u.jsxs(u.Fragment,{children:[u.jsx(xm,{heading:"Recently Used",children:f.map(O=>{const S=h[O];return Az(O)?y(O,{disabled:S==null?void 0:S.disabled,tooltip:S==null?void 0:S.tooltip}):S&&!cg(S)?k(S.label,S.handleHeadless||S.handle,{disabled:S.disabled,tooltip:S.tooltip}):null})}),u.jsx(o4,{})]}),A=xm,M=s.iterate().map(O=>{if(g.has(O))return null;const S=h[O];return y(O,{disabled:S==null?void 0:S.disabled,tooltip:S==null?void 0:S.tooltip})}),R=d.map(O=>g.has(O.label)?null:k(O.label,O.handleHeadless||O.handle,{disabled:O.disabled,tooltip:O.tooltip}));let z;t[18]!==g||t[19]!==k?(z=O=>g.has(O.label)?null:k(`Cell > ${O.label}`,O.handleHeadless||O.handle,{disabled:O.disabled,tooltip:O.tooltip}),t[18]=g,t[19]=k,t[20]=z):z=t[20];const D=a.map(z);let F,B,U;return t[21]!==A||t[22]!==R||t[23]!==D||t[24]!==M?(F=u.jsxs(A,{heading:"Commands",children:[M,R,D]}),t[21]=A,t[22]=R,t[23]=D,t[24]=M,t[25]=F):F=t[25],t[26]!==E||t[27]!==F||t[28]!==N||t[29]!==I?(B=u.jsxs(E,{children:[N,I,F]}),t[26]=E,t[27]=F,t[28]=N,t[29]=I,t[30]=B):B=t[30],t[31]!==C||t[32]!==e||t[33]!==n||t[34]!==B||t[35]!==v?(U=u.jsxs(C,{open:e,onOpenChange:n,children:[v,B]}),t[31]=C,t[32]=e,t[33]=n,t[34]=B,t[35]=v,t[36]=U):U=t[36],U};function _C(t){return!t.hotkey}function bC(t){return t.label}function yC(t){return!t}function vr(){return je.string().optional().describe(qe.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function fg(){return je.string().optional().describe(qe.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function La(){return je.string().optional().describe(qe.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function mg(){return je.string().optional().describe(qe.of({label:"URI",optionRegex:".*uri.*"}))}function kr(){return je.string().nonempty().describe(qe.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function bo(){return je.string().describe(qe.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function Sr(){return je.string().nonempty().describe(qe.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function Cr(t){const e=je.coerce.string().describe(qe.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 pg(){return je.boolean().default(!1).describe(qe.of({label:"Read Only"}))}const gg=je.object({type:je.literal("postgres"),host:kr(),port:Cr(5432).optional(),database:bo(),username:Sr(),password:vr(),ssl:je.boolean().default(!1).describe(qe.of({label:"Use SSL"}))}).describe(qe.of({direction:"two-columns"})),_g=je.object({type:je.literal("mysql"),host:kr(),port:Cr(3306),database:bo(),username:Sr(),password:vr(),ssl:je.boolean().default(!1).describe(qe.of({label:"Use SSL"}))}).describe(qe.of({direction:"two-columns"})),bg=je.object({type:je.literal("sqlite"),database:bo().describe(qe.of({label:"Database Path"}))}).describe(qe.of({direction:"two-columns"})),yg=je.object({type:je.literal("duckdb"),database:bo().describe(qe.of({label:"Database Path"})),read_only:pg()}).describe(qe.of({direction:"two-columns"})),xg=je.object({type:je.literal("motherduck"),database:bo().default("my_db").describe(qe.of({label:"Database Name"})),token:fg()}).describe(qe.of({direction:"two-columns"})),wg=je.object({type:je.literal("snowflake"),account:je.string().nonempty().describe(qe.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:je.string().optional().describe(qe.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:bo(),schema:je.string().optional().describe(qe.of({label:"Schema",optionRegex:".*snowflake.*"})),username:Sr(),password:vr(),role:je.string().optional().describe(qe.of({label:"Role"}))}).describe(qe.of({direction:"two-columns"})),vg=je.object({type:je.literal("bigquery"),project:je.string().nonempty().describe(qe.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:je.string().nonempty().describe(qe.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:je.string().describe(qe.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(qe.of({direction:"two-columns"})),kg=je.object({type:je.literal("clickhouse_connect"),host:kr(),port:Cr(8123).optional(),username:Sr(),password:vr(),secure:je.boolean().default(!1).describe(qe.of({label:"Use HTTPs"}))}).describe(qe.of({direction:"two-columns"})),Sg=je.object({type:je.literal("timeplus"),host:kr().default("localhost"),port:Cr(8123).optional(),username:Sr().default("default"),password:vr().default("")}).describe(qe.of({direction:"two-columns"})),Cg=je.object({type:je.literal("chdb"),database:bo().describe(qe.of({label:"Database Path"})),read_only:pg()}).describe(qe.of({direction:"two-columns"})),Ng=je.object({type:je.literal("trino"),host:kr(),port:Cr(8080),database:bo(),schema:je.string().describe(qe.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:Sr(),password:vr(),async_support:je.boolean().default(!1).describe(qe.of({label:"Async Support"}))}).describe(qe.of({direction:"two-columns"})),jg=je.object({type:je.literal("iceberg"),name:je.string().describe(qe.of({label:"Catalog Name"})),catalog:je.discriminatedUnion("type",[je.object({type:je.literal("REST"),warehouse:La(),uri:je.string().optional().describe(qe.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:fg()}),je.object({type:je.literal("SQL"),warehouse:La(),uri:je.string().optional().describe(qe.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),je.object({type:je.literal("Hive"),warehouse:La(),uri:mg()}),je.object({type:je.literal("Glue"),warehouse:La(),uri:mg()}),je.object({type:je.literal("DynamoDB"),"dynamodb.profile-name":je.string().optional().describe(qe.of({label:"Profile Name"})),"dynamodb.region":je.string().optional().describe(qe.of({label:"Region"})),"dynamodb.access-key-id":je.string().optional().describe(qe.of({label:"Access Key ID"})),"dynamodb.secret-access-key":je.string().optional().describe(qe.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":je.string().optional().describe(qe.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(qe.of({special:"tabs"}))}),Eg=je.object({type:je.literal("datafusion"),sessionContext:je.boolean().optional().describe(qe.of({label:"Use Session Context"}))}),Ig=je.object({type:je.literal("pyspark"),host:kr().optional(),port:Cr().optional()}),Ag=je.object({type:je.literal("redshift"),host:kr(),port:Cr(5439),connectionType:je.discriminatedUnion("type",[je.object({type:je.literal("IAM credentials"),region:je.string().describe(qe.of({label:"Region"})),aws_access_key_id:je.string().nonempty().describe(qe.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:je.string().nonempty().describe(qe.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:je.string().optional().describe(qe.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),je.object({type:je.literal("DB credentials"),user:Sr(),password:vr()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:bo()}).describe(qe.of({direction:"two-columns"})),xC=je.discriminatedUnion("type",[gg,_g,bg,yg,xg,wg,vg,kg,Sg,Cg,Ng,jg,Eg,Ig,Ag]),Sd="env:";function Fa(t){return typeof t=="string"&&t.startsWith(Sd)}function Cd(t){return`${Sd}${t}`}const Tg={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class ln{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 wC{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),Fa(n)){const r=n.replace(Sd,""),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"?qr(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return qr(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 Fa(e)?r("password",e):r("password",n,e)}getSecrets(){return this.secrets}formatSecrets(){return Object.keys(this.secrets).length===0?"":Object.entries(this.secrets).map(([e,n])=>`${e} = ${n}`).join(`
|
3
|
+
`)}}class vC extends ln{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 St(`
|
4
|
+
DATABASE_URL = f"postgresql://${o}:${n}@${r}:${s}/${i}"
|
5
|
+
engine = ${this.orm}.create_engine(DATABASE_URL${e})
|
6
|
+
`)}}class kC extends ln{generateImports(){return[]}generateConnectionCode(){const e=this.connection.ssl?", connect_args={'ssl': {'ssl-mode': 'preferred'}}":"",n=this.secrets.printPassword(this.connection.password,"MYSQL_PASSWORD",!0),o=this.secrets.printInFString("database",this.connection.database),r=this.secrets.printInFString("username",this.connection.username),s=this.secrets.printInFString("host",this.connection.host),i=this.secrets.printInFString("port",this.connection.port);return St(`
|
7
|
+
DATABASE_URL = f"mysql+pymysql://${r}:${n}@${s}:${i}/${o}"
|
8
|
+
engine = ${this.orm}.create_engine(DATABASE_URL${e})
|
9
|
+
`)}}class SC extends ln{generateImports(){return[]}generateConnectionCode(){const e=this.connection.database?this.secrets.printInFString("database",this.connection.database):"",n=e.startsWith("{")&&e.endsWith("}")?`DATABASE_URL = f"sqlite:///${e}"`:`DATABASE_URL = "sqlite:///${e}"`;return St(`
|
10
|
+
${n}
|
11
|
+
engine = ${this.orm}.create_engine(DATABASE_URL)
|
12
|
+
`)}}class CC extends ln{generateImports(){return["from snowflake.sqlalchemy import URL"]}generateConnectionCode(){const e=this.secrets.printPassword(this.connection.password,"SNOWFLAKE_PASSWORD",!1),n={account:this.secrets.print("account",this.connection.account),user:this.secrets.print("user",this.connection.username),database:this.secrets.print("database",this.connection.database),warehouse:this.connection.warehouse?this.secrets.print("warehouse",this.connection.warehouse):void 0,schema:this.connection.schema?this.secrets.print("schema",this.connection.schema):void 0,role:this.connection.role?this.secrets.print("role",this.connection.role):void 0,password:e};return St(`
|
13
|
+
engine = ${this.orm}.create_engine(
|
14
|
+
URL(
|
15
|
+
${za(n,o=>` ${o}`)},
|
16
|
+
)
|
17
|
+
)
|
18
|
+
`)}}class NC extends ln{generateImports(){return["import json"]}generateConnectionCode(){const e=this.secrets.printInFString("project",this.connection.project),n=this.secrets.printInFString("dataset",this.connection.dataset);return St(`
|
19
|
+
credentials = json.loads("""${this.connection.credentials_json}""")
|
20
|
+
engine = ${this.orm}.create_engine(f"bigquery://${e}/${n}", credentials_info=credentials)
|
21
|
+
`)}}class jC extends ln{generateImports(){return[]}generateConnectionCode(){const e=this.secrets.printInFString("database",this.connection.database||":memory:");return St(`
|
22
|
+
DATABASE_URL = "${e}"
|
23
|
+
engine = ${this.orm}.connect(DATABASE_URL, read_only=${qr(this.connection.read_only)})
|
24
|
+
`)}}class EC extends ln{generateImports(){return[]}generateConnectionCode(){const e=this.secrets.printInFString("database",this.connection.database);if(!this.connection.token)return St(`
|
25
|
+
conn = duckdb.connect("md:${e}")
|
26
|
+
`);const n=this.secrets.printPassword(this.connection.token,"MOTHERDUCK_TOKEN",!1);return St(`
|
27
|
+
conn = duckdb.connect("md:${e}", config={"motherduck_token": ${n}})
|
28
|
+
`)}}class IC extends ln{generateImports(){return["import clickhouse_connect"]}generateConnectionCode(){const e=this.secrets.printPassword(this.connection.password,"CLICKHOUSE_PASSWORD",!1),n={host:this.secrets.print("host",this.connection.host),user:this.secrets.print("user",this.connection.username),secure:this.secrets.print("secure",this.connection.secure),port:this.connection.port?this.secrets.print("port",this.connection.port):void 0,password:this.connection.password?e:void 0};return St(`
|
29
|
+
engine = ${this.orm}.get_client(
|
30
|
+
${za(n,o=>` ${o}`)},
|
31
|
+
)
|
32
|
+
`)}}class AC extends ln{generateImports(){return[]}generateConnectionCode(){const e=this.secrets.printPassword(this.connection.password,"TIMEPLUS_PASSWORD",!0),n=this.secrets.printInFString("username",this.connection.username),o=this.secrets.printInFString("host",this.connection.host),r=this.secrets.printInFString("port",this.connection.port);return St(`
|
33
|
+
DATABASE_URL = f"timeplus://${n}:${e}@${o}:${r}"
|
34
|
+
engine = ${this.orm}.create_engine(DATABASE_URL)
|
35
|
+
`)}}class TC extends ln{generateImports(){return["import chdb"]}generateConnectionCode(){const e=this.secrets.print("database",this.connection.database)||'""';return St(`
|
36
|
+
engine = ${this.orm}.connect(${e}, read_only=${qr(this.connection.read_only)})
|
37
|
+
`)}}class MC extends ln{generateImports(){return this.connection.async_support?["import aiotrino"]:["import trino.sqlalchemy"]}generateConnectionCode(){const e=this.connection.async_support?"aiotrino":"trino",n=this.connection.schema?`/${this.connection.schema}`:"",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),a=this.secrets.printPassword(this.connection.password,"TRINO_PASSWORD",!0);return St(`
|
38
|
+
engine = ${this.orm}.create_engine(f"${e}://${o}:${a}@${r}:${s}/${i}${n}")
|
39
|
+
`)}}class OC extends ln{generateImports(){switch(this.connection.catalog.type){case"REST":return["from pyiceberg.catalog.rest import RestCatalog"];case"SQL":return["from pyiceberg.catalog.sql import SqlCatalog"];case"Hive":return["from pyiceberg.catalog.hive import HiveCatalog"];case"Glue":return["from pyiceberg.catalog.glue import GlueCatalog"];case"DynamoDB":return["from pyiceberg.catalog.dynamodb import DynamoDBCatalog"];default:km(this.connection.catalog)}}generateConnectionCode(){let e={...this.connection.catalog};e=Object.fromEntries(Object.entries(e).filter(([i,a])=>a!=null&&a!==""&&i!=="type"));for(const[i,a]of Object.entries(e))Fa(a)?e[i]=this.secrets.print(i,a):typeof a=="string"&&(e[i]=`"${a}"`);const n=(o=e,r=i=>` ${i}`,Object.entries(o).filter(([,i])=>i!=null&&i!=="").map(([i,a])=>{const l=`"${i}"`;return r(typeof a=="boolean"?`${l}: ${qr(a)}`:`${l}: ${a}`)}).join(`,
|
40
|
+
`));var o,r;const s=`"${this.connection.name}"`;switch(this.connection.catalog.type){case"REST":return St(`
|
41
|
+
catalog = RestCatalog(
|
42
|
+
${s},
|
43
|
+
**{
|
44
|
+
${n}
|
45
|
+
},
|
46
|
+
)
|
47
|
+
`);case"SQL":return St(`
|
48
|
+
catalog = SqlCatalog(
|
49
|
+
${s},
|
50
|
+
**{
|
51
|
+
${n}
|
52
|
+
},
|
53
|
+
)
|
54
|
+
`);case"Hive":return St(`
|
55
|
+
catalog = HiveCatalog(
|
56
|
+
${s},
|
57
|
+
**{
|
58
|
+
${n}
|
59
|
+
},
|
60
|
+
)
|
61
|
+
`);case"Glue":return St(`
|
62
|
+
catalog = GlueCatalog(
|
63
|
+
${s},
|
64
|
+
**{
|
65
|
+
${n}
|
66
|
+
},
|
67
|
+
)
|
68
|
+
`);case"DynamoDB":return St(`
|
69
|
+
catalog = DynamoDBCatalog(
|
70
|
+
${s},
|
71
|
+
**{
|
72
|
+
${n}
|
73
|
+
},
|
74
|
+
)
|
75
|
+
`);default:km(this.connection.catalog)}}}class DC extends ln{generateImports(){return["import ibis","from datafusion import SessionContext"]}generateConnectionCode(){return this.connection.sessionContext?St(`
|
76
|
+
ctx = SessionContext()
|
77
|
+
# Sample table
|
78
|
+
_ = ctx.from_pydict({"a": [1, 2, 3]}, "my_table")
|
79
|
+
|
80
|
+
con = ibis.datafusion.connect(ctx)
|
81
|
+
`):St(`
|
82
|
+
con = ibis.datafusion.connect()
|
83
|
+
`)}}class RC extends ln{generateImports(){return["import ibis","from pyspark.sql import SparkSession"]}generateConnectionCode(){if(this.connection.host||this.connection.port){const e=this.secrets.printInFString("host",this.connection.host),n=this.secrets.printInFString("port",this.connection.port);return St(`
|
84
|
+
session = SparkSession.builder.remote(f"sc://${e}:${n}").getOrCreate()
|
85
|
+
con = ibis.pyspark.connect(session)
|
86
|
+
`)}return St(`
|
87
|
+
con = ibis.pyspark.connect()
|
88
|
+
`)}}class PC extends ln{generateImports(){return["import redshift_connector"]}generateConnectionCode(){const e=this.secrets.print("host",this.connection.host),n=this.secrets.print("port",this.connection.port),o=this.secrets.print("database",this.connection.database);if(this.connection.connectionType.type==="IAM credentials"){const a=this.secrets.print("aws_access_key_id",this.connection.connectionType.aws_access_key_id),l=this.secrets.print("aws_secret_access_key",this.connection.connectionType.aws_secret_access_key),c=this.connection.connectionType.aws_session_token?this.secrets.print("aws_session_token",this.connection.connectionType.aws_session_token):void 0,d={iam:!0,host:e,port:n,region:`"${this.connection.connectionType.region}"`,database:o,access_key_id:a,secret_access_key:l,...c&&{session_token:c}};return St(`
|
89
|
+
con = redshift_connector.connect(
|
90
|
+
${za(d,h=>` ${h}`)},
|
91
|
+
)
|
92
|
+
`)}const r=this.connection.connectionType.user?this.secrets.print("user",this.connection.connectionType.user):void 0,s=this.connection.connectionType.password?this.secrets.printPassword(this.connection.connectionType.password,"REDSHIFT_PASSWORD",!1):void 0,i={host:e,port:n,database:o,...r&&{user:r},...s&&{password:s}};return St(`
|
93
|
+
con = redshift_connector.connect(
|
94
|
+
${za(i,a=>` ${a}`)},
|
95
|
+
)
|
96
|
+
`)}}class LC{constructor(){this.secrets=new wC}createGenerator(e,n){switch(e.type){case"postgres":return new vC(e,n,this.secrets);case"mysql":return new kC(e,n,this.secrets);case"sqlite":return new SC(e,n,this.secrets);case"snowflake":return new CC(e,n,this.secrets);case"bigquery":return new NC(e,n,this.secrets);case"duckdb":return new jC(e,n,this.secrets);case"motherduck":return new EC(e,n,this.secrets);case"clickhouse_connect":return new IC(e,n,this.secrets);case"timeplus":return new AC(e,n,this.secrets);case"chdb":return new TC(e,n,this.secrets);case"trino":return new MC(e,n,this.secrets);case"iceberg":return new OC(e,n,this.secrets);case"datafusion":return new DC(e,n,this.secrets);case"pyspark":return new RC(e,n,this.secrets);case"redshift":return new PC(e,n,this.secrets);default:km(e)}}}function qr(t){return t.toString().charAt(0).toUpperCase()+t.toString().slice(1)}function za(t,e){return Object.entries(t).filter(([,n])=>n!=null&&n!=="").map(([n,o])=>e(typeof o=="boolean"?`${n}=${qr(o)}`:`${n}=${o}`)).join(`,
|
97
|
+
`)}function Mg(t){return t.sort((e,n)=>e.provider==="env"?1:n.provider==="env"?-1:0)}const Og=t=>{const e=K.c(42),{providerNames:n,onClose:o,onSuccess:r}=t,[s,i]=J.useState(""),[a,l]=J.useState(""),[c,d]=J.useState(n[0]);let h;e[0]!==s||e[1]!==c||e[2]!==r||e[3]!==a?(h=async U=>{if(U.preventDefault(),c)if(s&&a&&c)try{await Oz({key:s,value:a,provider:"dotenv",name:c}),ut({title:"Secret created",description:"The secret has been created successfully."}),r(s)}catch{ut({title:"Error",description:"Failed to create secret. Please try again.",variant:"danger"})}else ut({title:"Error",description:"Please fill in all fields.",variant:"danger"});else ut({title:"Error",description:"No location selected for the secret.",variant:"danger"})},e[0]=s,e[1]=c,e[2]=r,e[3]=a,e[4]=h):h=e[4];const f=h;let m,_,g,p,b,y,x,k,C,v,E,N,I,A,M,R;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsxs(Ls,{children:[u.jsx(ar,{children:"Add Secret"}),u.jsx(Fs,{children:"Add a new secret to your environment variables."})]}),e[5]=m):m=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(Fr,{htmlFor:"key",children:"Key"}),e[6]=_):_=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(g=U=>{i(U.target.value.replaceAll(/\W/g,"_"))},e[7]=g):g=e[7],e[8]!==s?(p=u.jsxs("div",{className:"grid gap-2",children:[_,u.jsx(lr,{id:"key",value:s,onChange:g,placeholder:"MY_SECRET_KEY",required:!0})]}),e[8]=s,e[9]=p):p=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(Fr,{htmlFor:"value",children:"Value"}),e[10]=b):b=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(y=U=>l(U.target.value),e[11]=y):y=e[11],e[12]!==a?(x=u.jsx(lr,{id:"value",type:"text",value:a,onChange:y,required:!0,autoComplete:"off"}),e[12]=a,e[13]=x):x=e[13],e[14]===Symbol.for("react.memo_cache_sentinel")?(k=window.location.href.startsWith("http://")&&u.jsx(s4,{children:"Note: You are sending this key over http."}),e[14]=k):k=e[14],e[15]!==x?(C=u.jsxs("div",{className:"grid gap-2",children:[b,x,k]}),e[15]=x,e[16]=C):C=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(v=u.jsx(Fr,{htmlFor:"location",children:"Location"}),e[17]=v):v=e[17],e[18]!==n.length?(E=n.length===0&&u.jsx("p",{className:"text-sm text-muted-foreground",children:"No dotenv locations configured."}),e[18]=n.length,e[19]=E):E=e[19],e[20]!==c||e[21]!==n?(N=n.length>0&&u.jsxs(_c,{value:c,onValueChange:U=>d(U),children:[u.jsx(bc,{children:u.jsx(yc,{placeholder:"Select a provider"})}),u.jsx(xc,{children:n.map(FC)})]}),e[20]=c,e[21]=n,e[22]=N):N=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(I=u.jsxs(s4,{children:["You can configure the location by setting the"," ",u.jsx(Sm,{href:"https://links.marimo.app/dotenv",children:"dotenv configuration"}),"."]}),e[23]=I):I=e[23],e[24]!==E||e[25]!==N?(A=u.jsxs("div",{className:"grid gap-2",children:[v,E,N,I]}),e[24]=E,e[25]=N,e[26]=A):A=e[26],e[27]!==C||e[28]!==A||e[29]!==p?(M=u.jsxs("div",{className:"grid gap-4 py-4",children:[p,C,A]}),e[27]=C,e[28]=A,e[29]=p,e[30]=M):M=e[30],e[31]!==o?(R=u.jsx(De,{type:"button",variant:"outline",onClick:o,children:"Cancel"}),e[31]=o,e[32]=R):R=e[32];const z=!s||!a||!c;let D,F,B;return e[33]!==z?(D=u.jsx(De,{type:"submit",disabled:z,children:"Add Secret"}),e[33]=z,e[34]=D):D=e[34],e[35]!==R||e[36]!==D?(F=u.jsxs(oa,{children:[R,D]}),e[35]=R,e[36]=D,e[37]=F):F=e[37],e[38]!==f||e[39]!==M||e[40]!==F?(B=u.jsx(cr,{children:u.jsxs("form",{onSubmit:f,children:[m,M,F]})}),e[38]=f,e[39]=M,e[40]=F,e[41]=B):B=e[41],B};function FC(t){return u.jsx(la,{value:t,children:t},t)}const Dg=T.createContext({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:An.NOOP}),zC=t=>{const e=K.c(14),{children:n}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0];const{data:r,isPending:s,error:i,refetch:a}=Gn($C,o);let l,c,d,h;return e[1]!==(r==null?void 0:r.secretKeys)?(l=(r==null?void 0:r.secretKeys)||[],e[1]=r==null?void 0:r.secretKeys,e[2]=l):l=e[2],e[3]!==(r==null?void 0:r.providerNames)?(c=(r==null?void 0:r.providerNames)||[],e[3]=r==null?void 0:r.providerNames,e[4]=c):c=e[4],e[5]!==i||e[6]!==s||e[7]!==a||e[8]!==l||e[9]!==c?(d={secretKeys:l,providerNames:c,loading:s,error:i,refreshSecrets:a},e[5]=i,e[6]=s,e[7]=a,e[8]=l,e[9]=c,e[10]=d):d=e[10],e[11]!==n||e[12]!==d?(h=u.jsx(Dg,{value:d,children:n}),e[11]=n,e[12]=d,e[13]=h):h=e[13],h};function BC(t){return t.provider!=="env"}function UC(t){return t.name}function VC(t){return t.keys}async function $C(){const t=await $S.request({}),e=Mg(t.secrets).filter(BC).map(UC);return{secretKeys:t.secrets.flatMap(VC).sort(),providerNames:e}}const Rg=[{name:"PostgreSQL",schema:gg,color:"#336791",logo:"postgres",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"MySQL",schema:_g,color:"#00758F",logo:"mysql",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"SQLite",schema:bg,color:"#003B57",logo:"sqlite",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DuckDB",schema:yg,color:"#FFD700",logo:"duckdb",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"MotherDuck",schema:xg,color:"#ff9538",logo:"motherduck",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"Snowflake",schema:wg,color:"#29B5E8",logo:"snowflake",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse",schema:kg,color:"#2C2C1D",logo:"clickhouse",connectionLibraries:{libraries:["clickhouse_connect"],preferred:"clickhouse_connect"}},{name:"Timeplus",schema:Sg,color:"#B83280",logo:"timeplus",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"BigQuery",schema:vg,color:"#4285F4",logo:"bigquery",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse Embedded",schema:Cg,color:"#f2b611",logo:"clickhouse",connectionLibraries:{libraries:["chdb"],preferred:"chdb"}},{name:"Trino",schema:Ng,color:"#d466b6",logo:"trino",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DataFusion",schema:Eg,color:"#202A37",logo:"datafusion",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"PySpark",schema:Ig,color:"#1C5162",logo:"pyspark",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"Redshift",schema:Ag,color:"#522BAE",logo:"redshift",connectionLibraries:{libraries:["redshift"],preferred:"redshift"}}],Pg=[{name:"Iceberg",schema:jg,color:"#000000",logo:"iceberg",connectionLibraries:{libraries:["pyiceberg"],preferred:"pyiceberg"}}],HC=t=>{const e=K.c(14),{onSelect:n}=t;let o;e[0]!==n?(o=h=>{const{name:f,schema:m,color:_,logo:g}=h;return u.jsxs("button",{type:"button",className:"py-3 flex flex-col items-center justify-center gap-1 transition-all hover:scale-105 hover:brightness-110 rounded shadow-smSolid hover:shadow-mdSolid",style:{backgroundColor:_},onClick:()=>n(m),children:[u.jsx(f4,{name:g,className:"w-8 h-8 text-white brightness-0 invert dark:invert"}),u.jsx("span",{className:"text-white font-medium text-lg",children:f})]},f)},e[0]=n,e[1]=o):o=e[1];const r=o;let s,i,a,l,c,d;return e[2]!==r?(s=Rg.map(r),e[2]=r,e[3]=s):s=e[3],e[4]!==s?(i=u.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:s}),e[4]=s,e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsxs("h4",{className:"font-semibold text-muted-foreground text-lg flex items-center gap-4",children:["Data Catalogs",u.jsx("hr",{className:"flex-1"})]}),e[6]=a):a=e[6],e[7]!==r?(l=Pg.map(r),e[7]=r,e[8]=l):l=e[8],e[9]!==l?(c=u.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:l}),e[9]=l,e[10]=c):c=e[10],e[11]!==i||e[12]!==c?(d=u.jsxs(u.Fragment,{children:[i,a,c]}),e[11]=i,e[12]=c,e[13]=d):d=e[13],d},WC=[{isMatch:t=>{if(t instanceof je.ZodString||t instanceof je.ZodNumber){const{optionRegex:e}=qe.parse(t._def.description||"");return!!e}return!1},Component:({schema:t,form:e,path:n})=>{const{secretKeys:o,providerNames:r,refreshSecrets:s}=T.use(Dg),{openModal:i,closeModal:a}=qn(),{label:l,description:c,optionRegex:d=""}=qe.parse(t._def.description||""),[h,f]=Bt(o,m=>new RegExp(d,"i").test(m));return u.jsx(i4,{control:e.control,name:n,render:({field:m})=>u.jsxs(a4,{children:[u.jsx(Dz,{children:l}),u.jsx(Rz,{children:c}),u.jsx(l4,{children:u.jsxs("div",{className:"flex gap-2",children:[t instanceof je.ZodString?u.jsx(lr,{...m,value:m.value,onChange:m.onChange,className:Ae("flex-1")}):u.jsx(Pz,{...m,value:m.value,onChange:m.onChange,className:"flex-1"}),u.jsxs(Hs,{children:[u.jsx(Ws,{asChild:!0,children:u.jsx(De,{variant:"outline",size:"icon",className:Ae(Fa(m.value)&&"bg-accent"),children:u.jsx(ad,{className:"h-3 w-3"})})}),u.jsxs(qs,{align:"end",className:"max-h-60 overflow-y-auto",children:[u.jsxs(Yt,{onSelect:()=>{i(u.jsx(Og,{providerNames:r,onSuccess:_=>{s(),m.onChange(Cd(_)),a()},onClose:a}))},children:[u.jsx(ja,{className:"mr-2 h-3.5 w-3.5"}),"Create a new secret"]}),h.length>0&&u.jsxs(u.Fragment,{children:[u.jsx(_o,{}),u.jsx(Lz,{children:"Recommended"})]}),h.map(_=>u.jsx(Yt,{onSelect:()=>m.onChange(Cd(_)),children:_},_)),f.length>0&&u.jsx(_o,{}),f.map(_=>u.jsx(Yt,{onSelect:()=>m.onChange(Cd(_)),children:_},_))]})]})]})}),u.jsx(c4,{})]})})}}],qC=t=>{var $;const e=K.c(49),{schema:n,onSubmit:o,onBack:r}=t;let s,i,a;e[0]!==n?(s=Fz(n),e[0]=n,e[1]=s):s=e[1],e[2]!==n?(i=d4(n),e[2]=n,e[3]=i):i=e[3],e[4]!==s||e[5]!==i?(a={defaultValues:s,resolver:i,reValidateMode:"onChange"},e[4]=s,e[5]=i,e[6]=a):a=e[6];const l=u4(a),c=($=[...Rg,...Pg].find(j=>j.schema===n))==null?void 0:$.connectionLibraries,[d,h]=T.useState((c==null?void 0:c.preferred)??"sqlalchemy"),{createNewCell:f}=Ot(),m=Br();let _;e[7]!==f||e[8]!==m?(_=j=>{f({code:j,before:!1,cellId:m??"__end__",skipIfCodeExists:!0})},e[7]=f,e[8]=m,e[9]=_):_=e[9];const g=_;let p;e[10]!==g||e[11]!==o||e[12]!==d?(p=j=>{g(function(W,X){if(!(X in Tg))throw new Error(`Unsupported library: ${X}`);xC.parse(W);const Y=new LC,q=Y.createGenerator(W,X),ne=q.generateConnectionCode(),re=Y.secrets,ae=[...new Set([...re.imports,...q.imports])].sort();ae.push("");const Z=re.formatSecrets();return Z&&ae.push(Z),ae.push(ne.trim()),ae.join(`
|
98
|
+
`)}(j,d)),o()},e[10]=g,e[11]=o,e[12]=d,e[13]=p):p=e[13];const b=p;let y;e[14]!==l||e[15]!==b?(y=l.handleSubmit(b),e[14]=l,e[15]=b,e[16]=y):y=e[16];let x,k;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx(zz,{}),e[17]=x):x=e[17],e[18]!==l||e[19]!==n?(k=u.jsx(zC,{children:u.jsx(Bz,{schema:n,form:l,renderers:WC,children:x})}),e[18]=l,e[19]=n,e[20]=k):k=e[20];let C;e[21]!==r?(C=u.jsx(De,{type:"button",variant:"outline",onClick:r,children:"Back"}),e[21]=r,e[22]=C):C=e[22];const v=!l.formState.isValid;let E,N;e[23]!==v?(E=u.jsx(De,{type:"submit",disabled:v,children:"Add"}),e[23]=v,e[24]=E):E=e[24],e[25]!==C||e[26]!==E?(N=u.jsxs("div",{className:"flex gap-2",children:[C,E]}),e[25]=C,e[26]=E,e[27]=N):N=e[27];const I=_c;let A,M;e[28]===Symbol.for("react.memo_cache_sentinel")?(A=j=>h(j),e[28]=A):A=e[28],e[29]===Symbol.for("react.memo_cache_sentinel")?(M=u.jsxs("div",{className:"flex flex-col gap-1 items-end",children:[u.jsx(bc,{children:u.jsx(yc,{placeholder:"Select a library"})}),u.jsx("span",{className:"text-xs text-muted-foreground",children:"Preferred connection library"})]}),e[29]=M):M=e[29];const R=xc,z=h4,D=c==null?void 0:c.libraries.map(YC);let F,B,U,O,S;return e[30]!==z||e[31]!==D?(F=u.jsx(z,{children:D}),e[30]=z,e[31]=D,e[32]=F):F=e[32],e[33]!==R||e[34]!==F?(B=u.jsx(R,{children:F}),e[33]=R,e[34]=F,e[35]=B):B=e[35],e[36]!==I||e[37]!==d||e[38]!==A||e[39]!==M||e[40]!==B?(U=u.jsx("div",{children:u.jsxs(I,{value:d,onValueChange:A,children:[M,B]})}),e[36]=I,e[37]=d,e[38]=A,e[39]=M,e[40]=B,e[41]=U):U=e[41],e[42]!==N||e[43]!==U?(O=u.jsxs("div",{className:"flex gap-2 justify-between",children:[N,U]}),e[42]=N,e[43]=U,e[44]=O):O=e[44],e[45]!==O||e[46]!==y||e[47]!==k?(S=u.jsxs("form",{onSubmit:y,className:"space-y-4",children:[k,O]}),e[45]=O,e[46]=y,e[47]=k,e[48]=S):S=e[48],S},GC=t=>{const e=K.c(5),{onSubmit:n}=t,[o,r]=T.useState(null);if(!o){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(HC,{onSelect:r}),e[0]=a):a=e[0],a}let s,i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=()=>r(null),e[1]=s):s=e[1],e[2]!==n||e[3]!==o?(i=u.jsx(qC,{schema:o,onSubmit:n,onBack:s}),e[2]=n,e[3]=o,e[4]=i):i=e[4],i},Lg=t=>{const e=K.c(6),{children:n}=t,[o,r]=T.useState(!1);let s,i,a;return e[0]!==n?(s=u.jsx(Uz,{asChild:!0,children:n}),e[0]=n,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(Fg,{onClose:()=>r(!1)}),e[2]=i):i=e[2],e[3]!==o||e[4]!==s?(a=u.jsxs(Vz,{open:o,onOpenChange:r,children:[s,i]}),e[3]=o,e[4]=s,e[5]=a):a=e[5],a},Fg=t=>{const e=K.c(4),{onClose:n}=t;let o,r,s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(ar,{children:"Add Connection"}),e[0]=o):o=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsxs(Ls,{className:"mb-4",children:[o,u.jsxs(Fs,{children:["Connect to your database or data catalog to query data directly from your notebook. Learn more about how to connect to your database in our"," ",u.jsx(Sm,{href:"https://docs.marimo.io/guides/working_with_data/sql/#connecting-to-a-custom-database",children:"docs."})]})]}),e[1]=r):r=e[1],e[2]!==n?(s=u.jsxs(cr,{className:"max-h-[75vh] overflow-y-auto",children:[r,u.jsx(GC,{onSubmit:()=>n()})]}),e[2]=n,e[3]=s):s=e[3],s};function YC(t){return u.jsx(la,{value:t,children:Tg[t]},t)}const JC=()=>{const t=K.c(7),{selectedLayout:e}=HS(),{setLayoutView:n}=WS();if(In()&&!Cm("wasm_layouts"))return null;let o,r,s,i;return t[0]!==n?(o=a=>n(a),t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(bc,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:u.jsx(yc,{placeholder:"Select a view"})}),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx(xc,{children:u.jsxs(h4,{children:[u.jsx($z,{children:"View as"}),qS.map(XC)]})}),t[3]=s):s=t[3],t[4]!==e||t[5]!==o?(i=u.jsxs(_c,{"data-testid":"layout-select",value:e,onValueChange:o,children:[r,s]}),t[4]=e,t[5]=o,t[6]=i):i=t[6],i};function KC(t){const e=zg(t);return u.jsx(e,{className:"h-4 w-4"})}function zg(t){switch(t){case"vertical":return Pp;case"grid":return oH;case"slides":return ud;default:return wc(t),vc}}function Bg(t){return Nm(t)}function XC(t){return u.jsx(la,{value:t,children:u.jsxs("div",{className:"flex items-center gap-1.5 leading-5",children:[KC(t),u.jsx("span",{children:Bg(t)})]})},t)}const ZC=()=>{const t=K.c(2),{updateCellConfig:e}=Ot();let n;return t[0]!==e?(n=async()=>{const o=new ca,r=Wn(),s=r.cellIds.inOrderIds,i={};for(const l of s){if(r.cellData[l]===void 0)continue;const{code:c,config:d}=r.cellData[l];d.hide_code||o.isSupported(c)&&(i[l]={hide_code:!0})}const a=pc.entries(i);if(a.length!==0){await Lr({configs:i});for(const[l,c]of a)e({cellId:l,config:c})}},t[0]=e,t[1]=n):n=t[1],n};function Ug(){const t=K.c(3),{openConfirm:e}=qn(),n=en(mn);let o;return t[0]!==e||t[1]!==n?(o=()=>{e({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:u.jsx(m4,{onClick:async()=>{n({state:Vt.CLOSING}),await Wz(),qz()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=n,t[2]=o):o=t[2],o}const ci=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function Vg(){const t=K.c(150),e=jm(),{openModal:n,closeModal:o}=qn(),{toggleApplication:r}=da(),{selectedPanel:s}=Sc(),[i]=an(hm),a=$e(Us),l=ZC(),{updateCellConfig:c,undoDeleteCell:d,clearAllCellOutputs:h,upsertSetupCell:f,collapseAllCells:m,expandAllCells:_}=Ot(),g=Ug(),p=lg(),b=function(zt){const wt=K.c(4),{openPrompt:jn,closeModal:En}=qn();let Ps;return wt[0]!==En||wt[1]!==jn||wt[2]!==zt?(Ps=()=>{if(!zt)return null;const ic=kc.guessDeliminator(zt),lm=Tn.basename(zt);jn({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${lm}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:cm=>{const ac=ic.join(Tn.dirname(zt),cm);Hz({source:zt,destination:ac}).then(()=>{En(),ut({title:"Notebook copied",description:"A copy of the notebook has been created."}),window.open(`/?file=${ac}`,"_blank")})}})},wt[0]=En,wt[1]=jn,wt[2]=zt,wt[3]=Ps):Ps=wt[3],Ps}(e),y=en(kd),x=en(rH),k=en(sH),C=$e(Gz),v=$e(Yz),E=$e(p4),{selectedLayout:N}=HS(),{setLayoutView:I}=WS(),A=ag(),M=xN;let R,z,D,F,B,U,O,S,$,j,W,X,Y;t[0]===Symbol.for("react.memo_cache_sentinel")?(R=u.jsx(Jp,{size:14,strokeWidth:1.5}),t[0]=R):R=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(z=u.jsx(Kz,{size:14,strokeWidth:1.5}),t[1]=z):z=t[1],t[2]!==o||t[3]!==n?(D={icon:z,label:"Publish HTML to web",handle:async()=>{n(u.jsx(iC,{onClose:o}))}},t[2]=o,t[3]=n,t[4]=D):D=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(F={icon:u.jsx(PS,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",handle:yN},t[5]=F):F=t[5],t[6]!==D?(B={icon:R,label:"Share",handle:ci,dropdown:[D,F]},t[6]=D,t[7]=B):B=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(U=u.jsx(Em,{size:14,strokeWidth:1.5}),t[8]=U):U=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(O=u.jsx(GS,{size:14,strokeWidth:1.5}),t[9]=O):O=t[9],t[10]!==e?(S={icon:O,label:"Download as HTML",handle:async()=>{e?await YS({filename:e,includeCode:!0}):ut({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},t[10]=e,t[11]=S):S=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?($=u.jsx(GS,{size:14,strokeWidth:1.5}),t[12]=$):$=t[12],t[13]!==e?(j={icon:$,label:"Download as HTML (exclude code)",handle:async()=>{e?await YS({filename:e,includeCode:!1}):ut({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},t[13]=e,t[14]=j):j=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(W={icon:u.jsx(fc,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:bN},X={icon:u.jsx(vp,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:_N},t[15]=W,t[16]=X):(W=t[15],X=t[16]),t[17]===Symbol.for("react.memo_cache_sentinel")?(Y=u.jsx(dp,{size:14,strokeWidth:1.5}),t[17]=Y):Y=t[17];const q=i.mode!=="present";let ne,re,ae;t[18]!==i.mode?(ne=i.mode==="present"?void 0:u.jsxs("span",{children:["Only available in app view. ",u.jsx("br",{}),"Toggle with: ",pn("global.hideCode",!1)]}),t[18]=i.mode,t[19]=ne):ne=t[19],t[20]!==q||t[21]!==ne?(re={divider:!0,icon:Y,label:"Download as PNG",disabled:q,tooltip:ne,handle:gN},t[20]=q,t[21]=ne,t[22]=re):re=t[22],t[23]===Symbol.for("react.memo_cache_sentinel")?(ae=u.jsx(Xz,{size:14,strokeWidth:1.5}),t[23]=ae):ae=t[23];const Z=i.mode!=="present";let Q,he,pe,ce,fe,de,Ce,Ne,se,Ie,be,Oe,ze,Ge,Je;if(t[24]!==i.mode?(Q=i.mode==="present"?void 0:u.jsxs("span",{children:["Only available in app view. ",u.jsx("br",{}),"Toggle with: ",pn("global.hideCode",!1)]}),t[24]=i.mode,t[25]=Q):Q=t[25],t[26]!==Z||t[27]!==Q?(he={icon:ae,label:"Download as PDF",disabled:Z,tooltip:Q,handle:mN},t[26]=Z,t[27]=Q,t[28]=he):he=t[28],t[29]!==re||t[30]!==he||t[31]!==S||t[32]!==j?(pe={icon:U,label:"Download",handle:ci,dropdown:[S,j,W,X,re,he]},t[29]=re,t[30]=he,t[31]=S,t[32]=j,t[33]=pe):pe=t[33],t[34]===Symbol.for("react.memo_cache_sentinel")?(ce=u.jsx($p,{size:14,strokeWidth:1.5}),t[34]=ce):ce=t[34],t[35]!==s||t[36]!==r?(fe=bd.flatMap(zt=>{const{type:wt,Icon:jn,hidden:En}=zt;return En?[]:{label:Nm(wt),rightElement:M(s===wt),icon:u.jsx(jn,{size:14,strokeWidth:1.5}),handle:()=>r(wt)}}),t[35]=s,t[36]=r,t[37]=fe):fe=t[37],t[38]!==fe?(de={divider:!0,icon:ce,label:"Helper panel",handle:ci,dropdown:fe},t[38]=fe,t[39]=de):de=t[39],t[40]===Symbol.for("react.memo_cache_sentinel")?(Ce=u.jsx(ud,{size:14,strokeWidth:1.5}),t[40]=Ce):Ce=t[40],t[41]!==i.mode?(Ne=i.mode==="present"?u.jsx(g4,{size:14,strokeWidth:1.5}):u.jsx(ld,{size:14,strokeWidth:1.5}),t[41]=i.mode,t[42]=Ne):Ne=t[42],t[43]!==A?(se=()=>{A()},t[43]=A,t[44]=se):se=t[44],t[45]!==Ne||t[46]!==se?(Ie={icon:Ne,label:"Toggle app view",hotkey:"global.hideCode",handle:se},t[45]=Ne,t[46]=se,t[47]=Ie):Ie=t[47],t[48]!==N||t[49]!==I||t[50]!==Ie||t[51]!==A||t[52]!==i.mode){let zt;t[54]!==N||t[55]!==I||t[56]!==A||t[57]!==i.mode?(zt=(wt,jn)=>{const En=zg(wt);return{divider:jn===0,label:Bg(wt),icon:u.jsx(En,{size:14,strokeWidth:1.5}),rightElement:u.jsx("div",{className:"w-8 flex justify-end",children:N===wt&&u.jsx(Cc,{size:14})}),handle:()=>{I(wt),i.mode==="edit"&&A()}}},t[54]=N,t[55]=I,t[56]=A,t[57]=i.mode,t[58]=zt):zt=t[58],be={icon:Ce,label:"Present as",handle:ci,dropdown:[Ie,...qS.map(zt)]},t[48]=N,t[49]=I,t[50]=Ie,t[51]=A,t[52]=i.mode,t[53]=be}else be=t[53];t[59]===Symbol.for("react.memo_cache_sentinel")?(Oe=u.jsx(Ep,{size:14,strokeWidth:1.5}),t[59]=Oe):Oe=t[59],t[60]!==e?(ze=!e||In(),t[60]=e,t[61]=ze):ze=t[61],t[62]!==b||t[63]!==ze?(Ge={icon:Oe,label:"Create notebook copy",hidden:ze,handle:b},t[62]=b,t[63]=ze,t[64]=Ge):Ge=t[64],t[65]===Symbol.for("react.memo_cache_sentinel")?(Je=u.jsx(od,{size:14,strokeWidth:1.5}),t[65]=Je):Je=t[65];const Le=!e;let et,Qe;t[66]!==Le?(et={icon:Je,label:"Copy code to clipboard",hidden:Le,handle:fN},t[66]=Le,t[67]=et):et=t[67],t[68]===Symbol.for("react.memo_cache_sentinel")?(Qe=u.jsx(wr,{size:14,strokeWidth:1.5}),t[68]=Qe):Qe=t[68];const tt=!C||a;let te,ye,ke;t[69]!==c?(te=async()=>{const zt=Wn(),wt=Zz(zt),jn=pc.fromEntries(wt.map(hN));await Lr({configs:jn});for(const En of wt)c({cellId:En,config:{disabled:!1}})},t[69]=c,t[70]=te):te=t[70],t[71]!==tt||t[72]!==te?(ye={icon:Qe,label:"Enable all cells",hidden:tt,handle:te},t[71]=tt,t[72]=te,t[73]=ye):ye=t[73],t[74]===Symbol.for("react.memo_cache_sentinel")?(ke=u.jsx(xr,{size:14,strokeWidth:1.5}),t[74]=ke):ke=t[74];const Me=!v||a;let G,ge,_e,me,le,Ve,Fe,Ke,ie,Se,Ee,Be,Ye,Re,He;t[75]!==c?(G=async()=>{const zt=Wn(),wt=H3(zt),jn=pc.fromEntries(wt.map(uN));await Lr({configs:jn});for(const En of wt)c({cellId:En,config:{disabled:!0}})},t[75]=c,t[76]=G):G=t[76],t[77]!==Me||t[78]!==G?(ge={icon:ke,label:"Disable all cells",hidden:Me,handle:G},t[77]=Me,t[78]=G,t[79]=ge):ge=t[79],t[80]===Symbol.for("react.memo_cache_sentinel")?(_e=u.jsx(Q3,{size:14,strokeWidth:1.5}),t[80]=_e):_e=t[80],t[81]!==l?(me={icon:_e,label:"Hide all markdown code",handle:l},t[81]=l,t[82]=me):me=t[82],t[83]===Symbol.for("react.memo_cache_sentinel")?(le=u.jsx(xp,{size:14,strokeWidth:1.5}),t[83]=le):le=t[83],t[84]!==m?(Ve={icon:le,label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:m},t[84]=m,t[85]=Ve):Ve=t[85],t[86]===Symbol.for("react.memo_cache_sentinel")?(Fe=u.jsx(yp,{size:14,strokeWidth:1.5}),t[86]=Fe):Fe=t[86],t[87]!==_?(Ke={icon:Fe,label:"Expand all sections",hotkey:"global.expandAllSections",handle:_},t[87]=_,t[88]=Ke):Ke=t[88],t[89]===Symbol.for("react.memo_cache_sentinel")?(ie=u.jsx(Sp,{size:14,strokeWidth:1.5}),t[89]=ie):ie=t[89],t[90]!==f?(Se={icon:ie,label:"Add setup cell",handle:()=>{f({code:"# Initialization code that runs before all other cells"})}},t[90]=f,t[91]=Se):Se=t[91],t[92]===Symbol.for("react.memo_cache_sentinel")?(Ee=u.jsx(pm,{size:14,strokeWidth:1.5}),t[92]=Ee):Ee=t[92],t[93]!==h?(Be={icon:Ee,label:"Clear all outputs",handle:()=>{h()}},t[93]=h,t[94]=Be):Be=t[94],t[95]===Symbol.for("react.memo_cache_sentinel")?(Ye=u.jsx(Np,{size:14,strokeWidth:1.5}),t[95]=Ye):Ye=t[95],t[96]!==p?(Re={icon:Ye,label:"Re-run all cells",hotkey:"global.runAll",handle:async()=>{p()}},t[96]=p,t[97]=Re):Re=t[97],t[98]===Symbol.for("react.memo_cache_sentinel")?(He=u.jsx(pd,{size:14,strokeWidth:1.5}),t[98]=He):He=t[98];const it=!E||a;let Xe,ot,yt,bt,Mt,xt,rn,Nn,fn,sn,Qt,to,po,Es,Is,As,Ts,Ms,ir,Os;t[99]!==d?(Xe=()=>{d()},t[99]=d,t[100]=Xe):Xe=t[100],t[101]!==it||t[102]!==Xe?(ot={icon:He,label:"Undo cell deletion",hidden:it,handle:Xe},t[101]=it,t[102]=Xe,t[103]=ot):ot=t[103],t[104]===Symbol.for("react.memo_cache_sentinel")?(yt=u.jsx(dr,{size:14,strokeWidth:1.5}),t[104]=yt):yt=t[104],t[105]!==o||t[106]!==n?(bt={icon:yt,label:"Add database connection",handle:()=>{n(u.jsx(Fg,{onClose:o}))}},t[105]=o,t[106]=n,t[107]=bt):bt=t[107],t[108]===Symbol.for("react.memo_cache_sentinel")?(Mt=u.jsx(rd,{size:14,strokeWidth:1.5}),t[108]=Mt):Mt=t[108],t[109]!==y?(xt={divider:!0,icon:Mt,label:"Command palette",hotkey:"global.commandPalette",handle:()=>y(dN)},t[109]=y,t[110]=xt):xt=t[110],t[111]===Symbol.for("react.memo_cache_sentinel")?(rn=u.jsx(Im,{size:14,strokeWidth:1.5}),t[111]=rn):rn=t[111],t[112]!==x?(Nn={icon:rn,label:"User settings",handle:()=>x(cN)},t[112]=x,t[113]=Nn):Nn=t[113],t[114]===Symbol.for("react.memo_cache_sentinel")?(fn=u.jsx(Rp,{size:14,strokeWidth:1.5}),t[114]=fn):fn=t[114],t[115]!==k?(sn={icon:fn,label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>k(lN)},t[115]=k,t[116]=sn):sn=t[116],t[117]===Symbol.for("react.memo_cache_sentinel")?(Qt={icon:u.jsx(LS,{size:14,strokeWidth:1.5}),label:"Open documentation",handle:aN},to=u.jsx(Nc,{size:14,strokeWidth:1.5}),t[117]=Qt,t[118]=to):(Qt=t[117],to=t[118]),t[119]===Symbol.for("react.memo_cache_sentinel")?(po={icon:to,label:"Resources",handle:ci,dropdown:[{icon:u.jsx(LS,{size:14,strokeWidth:1.5}),label:"Documentation",handle:iN},{icon:u.jsx(iH,{size:14,strokeWidth:1.5}),label:"GitHub",handle:sN},{icon:u.jsx(aH,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:rN},{icon:u.jsx(lH,{size:14,strokeWidth:1.5}),label:"YouTube",handle:oN},{icon:u.jsx(mm,{size:14,strokeWidth:1.5}),label:"Changelog",handle:nN}]},t[119]=po):po=t[119],t[120]===Symbol.for("react.memo_cache_sentinel")?(Es=u.jsx(Op,{size:14,strokeWidth:1.5}),t[120]=Es):Es=t[120],t[121]===Symbol.for("react.memo_cache_sentinel")?(Is={divider:!0,icon:Es,label:"Return home",hidden:!location.search.includes("file"),handle:tN},As=u.jsx(Ia,{size:14,strokeWidth:1.5}),t[121]=Is,t[122]=As):(Is=t[121],As=t[122]),t[123]===Symbol.for("react.memo_cache_sentinel")?(Ts={icon:As,label:"New notebook",hidden:!location.search.includes("file"),handle:eN},Ms=u.jsx(tg,{size:14,strokeWidth:1.5}),t[123]=Ts,t[124]=Ms):(Ts=t[123],Ms=t[124]),t[125]!==g?(ir={icon:Ms,label:"Restart kernel",variant:"danger",handle:g},t[125]=g,t[126]=ir):ir=t[126],t[127]!==pe||t[128]!==de||t[129]!==be||t[130]!==Ge||t[131]!==et||t[132]!==ye||t[133]!==B||t[134]!==ge||t[135]!==me||t[136]!==Ve||t[137]!==Ke||t[138]!==Se||t[139]!==Be||t[140]!==Re||t[141]!==ot||t[142]!==bt||t[143]!==xt||t[144]!==Nn||t[145]!==sn||t[146]!==ir?(Os=[B,pe,de,be,Ge,et,ye,ge,me,Ve,Ke,Se,Be,Re,ot,bt,xt,Nn,sn,Qt,po,Is,Ts,ir],t[127]=pe,t[128]=de,t[129]=be,t[130]=Ge,t[131]=et,t[132]=ye,t[133]=B,t[134]=ge,t[135]=me,t[136]=Ve,t[137]=Ke,t[138]=Se,t[139]=Be,t[140]=Re,t[141]=ot,t[142]=bt,t[143]=xt,t[144]=Nn,t[145]=sn,t[146]=ir,t[147]=Os):Os=t[147];const Ds=Os;let Rs;return t[148]!==Ds?(Rs=Ds.filter(QC),t[148]=Ds,t[149]=Rs):Rs=t[149],Rs}function QC(t){return!t.hidden}function eN(){const t=Jz();window.open(t,"_blank")}function tN(){const t=document.baseURI.split("?")[0];window.open(t,"_self")}function nN(){window.open(no.releasesPage,"_blank")}function oN(){window.open(no.youtube,"_blank")}function rN(){window.open(no.discordLink,"_blank")}function sN(){window.open(no.githubPage,"_blank")}function iN(){window.open(no.docsPage,"_blank")}function aN(){window.open(no.docsPage,"_blank")}function lN(t){return!t}function cN(t){return!t}function dN(t){return!t}function uN(t){return[t,{disabled:!0}]}function hN(t){return[t,{disabled:!1}]}async function fN(){const t=await Am();await xn(t.contents),ut({title:"Copied",description:"Code copied to clipboard."})}async function mN(){const t=new Event("export-beforeprint"),e=new Event("export-afterprint");window.dispatchEvent(t),setTimeout(pN,0),setTimeout(()=>window.dispatchEvent(e),0)}function pN(){return window.print()}async function gN(){const t=document.getElementById("App");t&&await Y3(t,document.title)}async function _N(){const t=await Am();ua(new Blob([t.contents],{type:"text/plain"}),_4.toPY(document.title))}async function bN(){const t=await Qz({download:!1});ua(new Blob([t],{type:"text/plain"}),_4.toMarkdown(document.title))}async function yN(){const t=await Am(),e=eB({code:t.contents});await xn(e),ut({title:"Copied",description:"Link copied to clipboard."})}function xN(t){return u.jsx("div",{className:"w-8 flex justify-end",children:t&&u.jsx(Cc,{size:14})})}const wN=t=>{const e=K.c(21),{disabled:n,tooltip:o}=t,r=n!==void 0&&n,s=o===void 0?"Actions":o,i=Vg(),a=r?"disabled":"hint-green";let l,c,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(xH,{strokeWidth:1.8}),e[0]=l):l=e[0],e[1]!==s?(c=u.jsx(Te,{content:s,children:l}),e[1]=s,e[2]=c):c=e[2],e[3]!==r||e[4]!==a||e[5]!==c?(d=u.jsx(wn,{"aria-label":"Config",shape:"circle",size:"small",className:"h-[27px] w-[27px]","data-testid":"notebook-menu-dropdown",disabled:r,color:a,children:c}),e[3]=r,e[4]=a,e[5]=c,e[6]=d):d=e[6];const h=d,f=vN;let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=C=>{const v=u.jsx(Yt,{variant:C.variant,disabled:C.disabled,onSelect:E=>C.handle(E),"data-testid":`notebook-menu-dropdown-${C.label}`,children:f(C)},C.label);return C.tooltip?u.jsx(Te,{content:C.tooltip,side:"left",delayDuration:100,children:u.jsx("span",{children:v})},C.label):v},e[7]=m):m=e[7];const _=m;let g,p,b,y,x,k;if(e[8]!==h||e[9]!==r?(g=u.jsx(Ws,{asChild:!0,disabled:r,children:h}),e[8]=h,e[9]=r,e[10]=g):g=e[10],e[11]!==i){let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=v=>v.hidden?null:v.dropdown?u.jsxs(tB,{children:[u.jsx(nB,{"data-testid":`notebook-menu-dropdown-${v.label}`,children:f(v)}),u.jsx(oB,{children:u.jsx(rB,{children:v.dropdown.map(E=>u.jsxs(J.Fragment,{children:[E.divider&&u.jsx(_o,{}),_(E)]},E.label))})})]},v.label):u.jsxs(J.Fragment,{children:[v.divider&&u.jsx(_o,{}),_(v)]},v.label),e[13]=C):C=e[13],p=i.map(C),e[11]=i,e[12]=p}else p=e[12];return e[14]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(_o,{}),e[14]=b):b=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(y=u.jsx("div",{className:"flex-1 px-2 text-xs text-muted-foreground",children:u.jsxs("span",{children:["Version: ",b4()]})}),e[15]=y):y=e[15],e[16]!==p?(x=u.jsxs(qs,{align:"end",className:"no-print w-[240px]",children:[p,b,y]}),e[16]=p,e[17]=x):x=e[17],e[18]!==x||e[19]!==g?(k=u.jsxs(Hs,{modal:!1,children:[g,x]}),e[18]=x,e[19]=g,e[20]=k):k=e[20],k};function vN(t){return u.jsxs(u.Fragment,{children:[t.icon&&u.jsx("span",{className:"flex-0 mr-2",children:t.icon}),u.jsx("span",{className:"flex-1",children:t.labelElement||t.label}),t.hotkey&&u.jsx(sB,{shortcut:t.hotkey,className:"ml-4"}),t.rightElement]})}function Nd(t){return zo("create"in t,'Expected query to have a "create" method'),t}const tn=iB({findText:"",replaceText:"",caseSensitive:!1,wholeWord:!1,regexp:!1,isOpen:!1,currentView:void 0},(t,e)=>{if(e===void 0)return t;switch(e.type){case"setFind":return{...t,findText:e.find};case"setReplace":return{...t,replaceText:e.replace};case"setCaseSensitive":return{...t,caseSensitive:e.caseSensitive};case"setWholeWord":return{...t,wholeWord:e.wholeWord};case"setRegex":return{...t,regexp:e.regexp};case"setIsOpen":return{...t,isOpen:e.isOpen};case"setCurrentView":return{...t,currentView:{view:e.view,range:e.range}};case"clearCurrentView":return{...t,currentView:void 0}}});function $g(t){if([...document.querySelectorAll('[role="dialog"][data-state="open"]')].some(e=>e instanceof HTMLElement&&e.childNodes.length>0))return!1;if(t){const e=t.state.selection.main,n=t.state.sliceDoc(e.from,e.to);n?(ct.set(tn,{type:"setFind",find:n}),ct.set(tn,{type:"setCurrentView",view:t,range:{from:e.from,to:e.to}})):ct.set(tn,{type:"setCurrentView",view:t,range:{from:0,to:0}})}return ct.get(tn).isOpen?(ct.set(tn,{type:"setIsOpen",isOpen:!1}),requestAnimationFrame(()=>{ct.set(tn,{type:"setIsOpen",isOpen:!0})}),!0):(ct.set(tn,{type:"setIsOpen",isOpen:!0}),!0)}function kN(){return!!ct.get(tn).isOpen&&(ct.set(tn,{type:"setIsOpen",isOpen:!1}),!0)}function Ba(t){return()=>{const e=ct.get(tn),n=new jc({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord});return!!n.valid&&t({query:Nd(n).create(),search:n})}}const Hg=t=>Ba(({query:e})=>{const n=Gs(),o=ct.get(tn).currentView||{view:n[0],range:{from:0,to:0}};let r=o.range.to;t==="prev"&&(n.reverse(),r=o.range.from);let s=n.indexOf(o.view);s<0&&(s=0);const i=[...n,...n].slice(s);for(const a of i){const l=t==="next"?e.nextMatch(a.state,0,r??0):e.prevMatch(a.state,r??a.state.doc.length,a.state.doc.length);if(!l){r=null,a.dispatch({selection:Bo.single(0)});continue}const c=Bo.single(l.from,l.to);return a.dispatch({selection:c,effects:[st.scrollIntoView(c.main,{y:"center"})],userEvent:"select.search"}),ct.set(tn,{type:"setCurrentView",view:a,range:{from:l.from,to:l.to}}),l}return!1}),jd=Hg("next"),Wg=Hg("prev"),SN=Ba(({query:t})=>{var o;const e=Gs(),n=[];for(const r of e){if(r.state.readOnly)continue;const s=(o=t.matchAll(r.state,1e9))==null?void 0:o.map(a=>{const{from:l,to:c}=a;return{from:l,to:c,insert:t.getReplacement(a)}});if(!s||s.length===0)continue;const i=r.state.doc.toString();n.push(()=>{r.dispatch({changes:[{from:0,to:r.state.doc.length,insert:i}],userEvent:"input.replace.all"})}),r.dispatch({changes:s,userEvent:"input.replace.all"})}return()=>{for(const r of n)r()}}),CN=Ba(({query:t})=>{const e=Gs(),n=ct.get(tn).currentView||{view:e[0],range:{from:0}};let o=n.range.from,r=e.indexOf(n.view);r<0&&(r=0);const s=[...e,...e].slice(r);for(const i of s){const a=t.nextMatch(i.state,0,o??0);if(!a){o=null,i.dispatch({selection:Bo.single(0)});continue}const l=i.state.toText(t.getReplacement(a));return i.dispatch({changes:[{from:a.from,to:a.to,insert:l}],userEvent:"input.replace"}),jd()}return!1}),NN=Ba(({query:t})=>{const e=Gs();let n=0;const o=new Map;for(const r of e){const s=t.matchAll(r.state,1e9)||[];for(const i of s){const{from:a,to:l}=i,c=o.get(r)||new Map;c.set(`${a}:${l}`,n++),o.set(r,c)}}return{count:n,position:o}}),Ed=Rt.define();function qg(){const t=Gs();for(const e of t)e.state.readOnly||e.dispatch({effects:Ed.of(new jc({search:""}))})}const Ua=On.define({create(){const t=ct.get(tn);return Nd(new jc({search:t.findText,caseSensitive:t.caseSensitive,regexp:t.regexp,replace:t.replaceText,wholeWord:t.wholeWord})).create()},update(t,e){for(const n of e.effects)n.is(Ed)&&(t=Nd(n.value).create());return t}}),jN=dt.mark({class:"cm-searchMatch"}),EN=dt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),IN=Mn.fromClass(class{constructor(t){this.view=t,this.decorations=void 0,this.decorations=this.highlight(t.state.field(Ua))}update(t){const e=t.state.field(Ua);(e!==t.startState.field(Ua)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight(t){if(!t.spec.valid)return dt.none;const{view:e}=this,n=new Ys,o=e.visibleRanges,r=o.length;for(let s=0;s<r;s++){let{to:i}=o[s];const{from:a}=o[s];for(;s<r-1&&i>o[s+1].from-500;)i=o[++s].to;t.highlight(e.state,a,i,(l,c)=>{const d=e.state.selection.ranges.some(h=>h.from===l&&h.to===c);n.add(l,c,d?EN:jN)})}return n.finish()}},{decorations:t=>t.decorations}),AN=st.baseTheme({"&light .cm-searchMatch":{backgroundColor:"#99ff7780"},"&dark .cm-searchMatch":{backgroundColor:"#22bb0070"},"&light .cm-searchMatch-selected":{backgroundColor:"transparent"},"&dark .cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff88 !important"}}),TN=()=>{var Je;const t=K.c(102),[e,n]=T.useState(!1),[o,r]=an(tn),[s,i]=T.useState(),a=T.useRef(null),l=$e(ym);let c,d;t[0]!==e||t[1]!==o.isOpen?(c=()=>(!e||!o.isOpen)&&$g(),t[0]=e,t[1]=o.isOpen,t[2]=c):c=t[2],Jt("cell.findAndReplace",c),t[3]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{const Le=NN();i(Le===!1?void 0:Le)},t[3]=d):d=t[3];const h=d;let f,m,_,g;if(t[4]!==o.isOpen?(f=()=>{o.isOpen&&a.current&&(a.current.focus(),a.current.select())},m=[o.isOpen],t[4]=o.isOpen,t[5]=f,t[6]=m):(f=t[5],m=t[6]),T.useEffect(f,m),t[7]!==o.findText||t[8]!==o.isOpen?(_=()=>{if(o.isOpen){if(o.findText==="")return i(void 0),void qg();h(),function(){const Le=ct.get(tn),et=Gs();for(const Qe of et)Qe.state.readOnly||Qe.dispatch({effects:Ed.of(new jc({search:Le.findText,caseSensitive:Le.caseSensitive,regexp:Le.regexp,replace:Le.replaceText,wholeWord:Le.wholeWord}))})}()}else qg()},t[7]=o.findText,t[8]=o.isOpen,t[9]=_):_=t[9],t[10]!==o.caseSensitive||t[11]!==o.findText||t[12]!==o.isOpen||t[13]!==o.regexp||t[14]!==o.wholeWord?(g=[o.findText,o.isOpen,o.caseSensitive,o.regexp,o.wholeWord],t[10]=o.caseSensitive,t[11]=o.findText,t[12]=o.isOpen,t[13]=o.regexp,t[14]=o.wholeWord,t[15]=g):g=t[15],T.useEffect(_,g),!o.isOpen)return null;const p=o.currentView;let b;t[16]!==s||t[17]!==p?(b=p&&s?(Je=s.position.get(p.view))==null?void 0:Je.get(`${p.range.from}:${p.range.to}`):void 0,t[16]=s,t[17]=p,t[18]=b):b=t[18];const y=b;let x,k,C,v,E,N,I,A,M,R,z;t[19]===Symbol.for("react.memo_cache_sentinel")?(x=()=>n(!0),t[19]=x):x=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(k=()=>n(!1),t[20]=k):k=t[20],t[21]!==r?(C=Le=>{Le.key==="Escape"&&r({type:"setIsOpen",isOpen:!1})},t[21]=r,t[22]=C):C=t[22],t[23]!==r?(v=()=>r({type:"setIsOpen",isOpen:!1}),t[23]=r,t[24]=v):v=t[24],t[25]===Symbol.for("react.memo_cache_sentinel")?(E=u.jsx(oo,{className:"w-4 h-4"}),t[25]=E):E=t[25],t[26]!==v?(N=u.jsx("div",{className:"absolute top-0 right-0",children:u.jsx(De,{"data-testid":"close-find-replace-button",onClick:v,size:"xs",variant:"text",children:E})}),t[26]=v,t[27]=N):N=t[27],t[28]!==r?(I=Le=>{r({type:"setFind",find:Le.target.value})},t[28]=r,t[29]=I):I=t[29],t[30]!==o.findText||t[31]!==I?(A=u.jsx(lr,{ref:a,"data-testid":"find-input",value:o.findText,autoFocus:!0,className:"mr-2 mb-0",placeholder:"Find",onKeyDown:ON,onChange:I}),t[30]=o.findText,t[31]=I,t[32]=A):A=t[32],t[33]!==r?(M=Le=>{r({type:"setReplace",replace:Le.target.value})},t[33]=r,t[34]=M):M=t[34],t[35]!==o.replaceText||t[36]!==M?(R=u.jsx(lr,{"data-testid":"replace-input",value:o.replaceText,placeholder:"Replace",onChange:M}),t[35]=o.replaceText,t[36]=M,t[37]=R):R=t[37],t[38]!==A||t[39]!==R?(z=u.jsxs("div",{className:"flex flex-col flex-2 gap-2 w-[55%]",children:[A,R]}),t[38]=A,t[39]=R,t[40]=z):z=t[40];const D=o.caseSensitive?"on":"off";let F,B,U;t[41]!==r?(F=Le=>r({type:"setCaseSensitive",caseSensitive:Le}),t[41]=r,t[42]=F):F=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(B=u.jsx(aB,{className:"w-4 h-4"}),t[43]=B):B=t[43],t[44]!==o.caseSensitive||t[45]!==D||t[46]!==F?(U=u.jsx(Te,{content:"Case Sensitive",children:u.jsx(Tm,{size:"sm",pressed:o.caseSensitive,"data-state":D,onPressedChange:F,children:B})}),t[44]=o.caseSensitive,t[45]=D,t[46]=F,t[47]=U):U=t[47];const O=o.wholeWord?"on":"off";let S,$,j;t[48]!==r?(S=Le=>r({type:"setWholeWord",wholeWord:Le}),t[48]=r,t[49]=S):S=t[49],t[50]===Symbol.for("react.memo_cache_sentinel")?($=u.jsx(ig,{className:"w-4 h-4"}),t[50]=$):$=t[50],t[51]!==o.wholeWord||t[52]!==O||t[53]!==S?(j=u.jsx(Te,{content:"Match Whole Word",children:u.jsx(Tm,{size:"sm",pressed:o.wholeWord,"data-state":O,onPressedChange:S,children:$})}),t[51]=o.wholeWord,t[52]=O,t[53]=S,t[54]=j):j=t[54];const W=o.regexp?"on":"off";let X,Y,q,ne,re;t[55]!==r?(X=Le=>r({type:"setRegex",regexp:Le}),t[55]=r,t[56]=X):X=t[56],t[57]===Symbol.for("react.memo_cache_sentinel")?(Y=u.jsx(qp,{className:"w-4 h-4"}),t[57]=Y):Y=t[57],t[58]!==o.regexp||t[59]!==W||t[60]!==X?(q=u.jsx(Te,{content:"Use Regular Expression",children:u.jsx(Tm,{size:"sm",pressed:o.regexp,"data-state":W,onPressedChange:X,children:Y})}),t[58]=o.regexp,t[59]=W,t[60]=X,t[61]=q):q=t[61],t[62]!==U||t[63]!==j||t[64]!==q?(ne=u.jsxs("div",{className:"flex items-center gap-[2px]",children:[U,j,q]}),t[62]=U,t[63]=j,t[64]=q,t[65]=ne):ne=t[65],t[66]===Symbol.for("react.memo_cache_sentinel")?(re=()=>{CN()&&h()},t[66]=re):re=t[66];const ae=o.findText==="";let Z,Q;t[67]!==ae?(Z=u.jsx(De,{"data-testid":"replace-next-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:re,disabled:ae,children:"Replace Next"}),t[67]=ae,t[68]=Z):Z=t[68],t[69]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>{const Le=SN();if(!Le)return;h();const{dismiss:et}=ut({title:"Replaced all occurrences",action:u.jsx(xd,{"data-testid":"undo-replace-all-button",onClick:()=>{Le(),Qe()}})}),Qe=et},t[69]=Q):Q=t[69];const he=o.findText==="";let pe,ce,fe,de,Ce,Ne,se,Ie,be,Oe,ze,Ge;return t[70]!==he?(pe=u.jsx(De,{"data-testid":"replace-all-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:Q,disabled:he,children:"Replace All"}),t[70]=he,t[71]=pe):pe=t[71],t[72]!==Z||t[73]!==pe?(ce=u.jsxs("div",{className:"flex items-center gap-[2px]",children:[Z,pe]}),t[72]=Z,t[73]=pe,t[74]=ce):ce=t[74],t[75]!==ne||t[76]!==ce?(fe=u.jsxs("div",{className:"flex flex-col gap-2",children:[ne,ce]}),t[75]=ne,t[76]=ce,t[77]=fe):fe=t[77],t[78]!==z||t[79]!==fe?(de=u.jsxs("div",{className:"flex items-center gap-3",children:[z,fe]}),t[78]=z,t[79]=fe,t[80]=de):de=t[80],t[81]===Symbol.for("react.memo_cache_sentinel")?(Ce=u.jsx(Te,{content:"Find Previous",children:u.jsx(De,{"data-testid":"find-prev-button",size:"xs",variant:"secondary",onClick:DN,children:u.jsx(Et,{className:"w-4 h-4"})})}),t[81]=Ce):Ce=t[81],t[82]===Symbol.for("react.memo_cache_sentinel")?(Ne=u.jsx(Te,{content:"Find Next",children:u.jsx(De,{"data-testid":"find-next-button",size:"xs",variant:"secondary",onClick:RN,children:u.jsx(nd,{className:"w-4 h-4"})})}),t[82]=Ne):Ne=t[82],t[83]!==y||t[84]!==s?(se=s!=null&&y==null&&u.jsxs("span",{className:"text-sm",children:[s.count," matches"]}),t[83]=y,t[84]=s,t[85]=se):se=t[85],t[86]!==y||t[87]!==s?(Ie=s!=null&&y!=null&&u.jsxs("span",{className:"text-sm",children:[y+1," of ",s.count]}),t[86]=y,t[87]=s,t[88]=Ie):Ie=t[88],t[89]!==se||t[90]!==Ie?(be=u.jsxs("div",{className:"flex items-center gap-2",children:[Ce,Ne,se,Ie]}),t[89]=se,t[90]=Ie,t[91]=be):be=t[91],t[92]!==l?(Oe=l.getHotkey("cell.findAndReplace"),t[92]=l,t[93]=Oe):Oe=t[93],t[94]!==Oe.key?(ze=u.jsxs("div",{className:"text-xs text-muted-foreground flex gap-1 mt-2",children:["Press"," ",u.jsx(vm,{shortcut:Oe.key})," ","again to open the native browser search."]}),t[94]=Oe.key,t[95]=ze):ze=t[95],t[96]!==N||t[97]!==de||t[98]!==be||t[99]!==ze||t[100]!==C?(Ge=u.jsx(lB,{restoreFocus:!0,autoFocus:!0,children:u.jsxs("div",{onFocus:x,onClick:MN,onBlur:k,className:"fixed top-0 right-0 w-[500px] flex flex-col bg-[var(--sage-1)] p-4 z-50 mt-2 mr-3 rounded-md shadow-lg border gap-2 print:hidden",onKeyDown:C,children:[N,de,be,ze]})}),t[96]=N,t[97]=de,t[98]=be,t[99]=ze,t[100]=C,t[101]=Ge):Ge=t[101],Ge};function MN(t){t.stopPropagation(),t.preventDefault()}function ON(t){t.key==="Enter"&&(t.shiftKey?Wg():jd())}function DN(){return Wg()}function RN(){return jd()}const Gg=t=>{const e=K.c(38),{resetOnBlur:n,placeholderText:o,initialValue:r,flexibleWidth:s,onNameChange:i,className:a}=t,l=n!==void 0&&n,c=r===void 0?null:r,d=s!==void 0&&s,[h,f]=T.useState(c);let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=[],e[0]=m):m=e[0];const[_,g]=T.useState(m),[p,b]=T.useState(!1),y=T.useRef(null),x=T.useRef(!1);let k,C,v;e[1]!==c?(k=()=>{f(c)},C=[c],e[1]=c,e[2]=k,e[3]=C):(k=e[2],C=e[3]),T.useEffect(k,C),e[4]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{b(!0)},e[4]=v):v=e[4];const E=v;let N;e[5]!==c||e[6]!==l?(N=Q=>{var he;(he=Q.relatedTarget)!=null&&he.closest(".filename-input")||(b(!1),l&&f(c))},e[5]=c,e[6]=l,e[7]=N):N=e[7];const I=N;let A;e[8]!==h?(A=Tn.dirname(h||""),e[8]=h,e[9]=A):A=e[9];const M=A,R=Tn.basename(h||""),z=_.filter(Q=>Tn.basename(Q.path).startsWith(R));let D,F;e[10]!==M||e[11]!==p?(D=async()=>{if(!p)return void g([]);const Q=await w4({path:M});g(Q.files)},F=[M,p],e[10]=M,e[11]=p,e[12]=D,e[13]=F):(D=e[12],F=e[13]);const{isPending:B}=Gn(D,F),U=function(Q,he,pe){if(Q&&!Q.endsWith("/")&&((Cm("markdown")?new Set(["py","md","markdown","qmd"]):new Set(["py"])).has(Tn.extension(Q))||(Q=Q.endsWith(".")?`${Q}py`:Q.endsWith(".p")?`${Q}y`:`${Q}.py`),!he.some(ce=>ce.path===Q||Tn.basename(ce.path)===Q)&&!(pe&&(pe===Q||Tn.basename(pe)===Q))))return Q}(h,_,c),O=(U||z.length>0)&&u.jsxs(wm,{className:"font-mono",children:[!B&&u.jsx(gc,{children:"No files"}),U&&u.jsxs(go,{variant:"success",className:"py-2 px-3",onSelect:()=>{var Q;U&&(x.current=!0,i(U),(Q=y.current)==null||Q.blur())},children:[u.jsx(jp,{className:"w-4 h-4 mr-2"})," ",u.jsxs("span",{className:"text-sm",children:[c?"Rename to: ":"Save as: ",u.jsx("span",{className:"font-medium text-sm",children:Tn.basename(U)})]})]},"_rename_"),z.map(Q=>{const he=Q.isDirectory?"directory":y4(Q.path),pe=x4[he];return u.jsxs(go,{variant:Q.isDirectory?"default":"muted",className:"py-2 px-3",onSelect:()=>{Q.isDirectory?f(`${Q.path}/`):f(Q.path)},children:[u.jsx(pe,{className:"w-4 h-4 mr-2"})," ",Tn.basename(Q.path)]},Q.path)})]}),S=10*Math.max(20,(h==null?void 0:h.length)||(o==null?void 0:o.length)||0),$=p?h||"":c||"";let j,W,X;e[14]!==d||e[15]!==S?(j=d?{maxWidth:S}:void 0,e[14]=d,e[15]=S,e[16]=j):j=e[16],e[17]!==a?(W=Ae(a,"w-full px-4 py-1 my-1 h-9 font-mono text-foreground/60"),e[17]=a,e[18]=W):W=e[18],e[19]!==o||e[20]!==$||e[21]!==j||e[22]!==W?(X=u.jsx(cB,{children:u.jsx(aa,{"data-testid":"dir-completion-input",tabIndex:-1,rootClassName:"border-none justify-center px-1",spellCheck:"false",value:$,onKeyDown:PN,icon:null,ref:y,onValueChange:f,placeholder:o,autoComplete:"off",style:j,className:W})}),e[19]=o,e[20]=$,e[21]=j,e[22]=W,e[23]=X):X=e[23];const Y=O&&"group-focus-within:block";let q,ne,re,ae,Z;return e[24]!==Y?(q=Ae("p-0 w-full min-w-80 max-w-80vw hidden",Y),e[24]=Y,e[25]=q):q=e[25],e[26]!==O||e[27]!==q?(ne=u.jsx(Js,{side:"bottom",className:q,portal:!1,children:O}),e[26]=O,e[27]=q,e[28]=ne):ne=e[28],e[29]!==X||e[30]!==ne?(re=u.jsxs(wm,{children:[X,ne]}),e[29]=X,e[30]=ne,e[31]=re):re=e[31],e[32]!==I||e[33]!==re?(ae=u.jsx(Ec,{onFocus:E,onBlur:I,shouldFilter:!1,id:"filename-input",className:"bg-transparent group filename-input",children:re}),e[32]=I,e[33]=re,e[34]=ae):ae=e[34],e[35]!==p||e[36]!==ae?(Z=u.jsx(Ic,{children:u.jsx(Ur,{open:p,modal:!1,children:ae})}),e[35]=p,e[36]=ae,e[37]=Z):Z=e[37],Z};function PN(t){t.key==="Escape"&&t.currentTarget.blur()}const LN=t=>{const e=K.c(33),n=()=>{ua(new Blob([o()],{type:"text/plain"}),`${t.proposedName}.json`)},o=nt(BN);let r,s,i,a,l,c,d,h,f,m,_,g,p,b,y,x,k;return e[0]!==n||e[1]!==t?(r=C=>{C.preventDefault(),n(),t.closeModal()},e[0]=n,e[1]=t,e[2]=r):r=e[2],e[3]!==t?(s=C=>{C.key==="Escape"&&t.closeModal()},e[3]=t,e[4]=s):s=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(ar,{className:"text-accent-foreground mb-6",children:"Download unsaved changes?"}),e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a={wordBreak:"break-word"},e[6]=a):a=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx("p",{children:"This app has unsaved changes. To recover:"}),c={paddingBottom:"10px"},e[7]=l,e[8]=c):(l=e[7],c=e[8]),e[9]!==t.proposedName?(d=u.jsxs("li",{style:c,children:['Click the "Download" button. This will download a file called\xA0',u.jsxs("code",{children:[t.proposedName,".json"]}),". This file contains your code."]}),e[9]=t.proposedName,e[10]=d):d=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(h={paddingBottom:"10px"},e[11]=h):h=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(f={display:"block",padding:"10px"},e[12]=f):f=e[12],e[13]!==t.proposedName?(m=u.jsxs("code",{style:f,children:["marimo recover ",t.proposedName,".json ",">"," ",t.proposedName,".py"]}),e[13]=t.proposedName,e[14]=m):m=e[14],e[15]!==t.proposedName?(_=u.jsxs("code",{children:[t.proposedName,".py"]}),e[15]=t.proposedName,e[16]=_):_=e[16],e[17]!==_||e[18]!==m?(g=u.jsxs("li",{style:h,children:["In your terminal, type",m,"to overwrite ",_," with the recovered changes."]}),e[17]=_,e[18]=m,e[19]=g):g=e[19],e[20]!==g||e[21]!==d?(p=u.jsx(Fs,{className:"markdown break-words",style:a,children:u.jsxs("div",{className:"prose dark:prose-invert",children:[l,u.jsxs("ol",{children:[d,g]})]})}),e[20]=g,e[21]=d,e[22]=p):p=e[22],e[23]!==t.closeModal?(b=u.jsx(De,{"aria-label":"Cancel",variant:"secondary","data-testid":"cancel-recovery-button",onClick:t.closeModal,children:"Cancel"}),e[23]=t.closeModal,e[24]=b):b=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(y=u.jsx(De,{"data-testid":"download-recovery-button","aria-label":"Download",variant:"default",type:"submit",children:"Download"}),e[25]=y):y=e[25],e[26]!==b?(x=u.jsxs(oa,{children:[b,y]}),e[26]=b,e[27]=x):x=e[27],e[28]!==r||e[29]!==s||e[30]!==p||e[31]!==x?(k=u.jsx(cr,{className:"w-fit",children:u.jsxs("form",{onSubmit:r,onKeyDown:s,children:[i,p,x]})}),e[28]=r,e[29]=s,e[30]=p,e[31]=x,e[32]=k):k=e[32],k},FN=t=>{const e=K.c(12),{filename:n,needsSave:o}=t,{openModal:r,closeModal:s}=qn();let i;e[0]!==n?(i=n===null?"app":Tn.basename(n).split(".")[0],e[0]=n,e[1]=i):i=e[1];const a=i;let l;e[2]!==s||e[3]!==o||e[4]!==r||e[5]!==a?(l=()=>{o&&r(u.jsx(LN,{proposedName:a,closeModal:s}))},e[2]=s,e[3]=o,e[4]=r,e[5]=a,e[6]=l):l=e[6];const c=l;let d;Jt("global.save",c),e[7]===Symbol.for("react.memo_cache_sentinel")?(d=pn("global.save"),e[7]=d):d=e[7];const h=o?"yellow":"gray";let f,m;return e[8]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(Ta,{strokeWidth:1.5,size:18}),e[8]=f):f=e[8],e[9]!==c||e[10]!==h?(m=u.jsx(Te,{content:d,children:u.jsx(wn,{onClick:c,id:"save-button","aria-label":"Save",className:"rectangle",color:h,children:f})}),e[9]=c,e[10]=h,e[11]=m):m=e[11],m};function zN(t){return{id:t.id,name:t.name,code:t.code,code_hash:null,config:{column:0,...t.config}}}function BN(){const t=Wn(),e=Mm(t),n={version:"1",metadata:{marimo_version:b4()},cells:e.map(zN)};return JSON.stringify(n,null,2)}const Id=5e3;async function UN(){await fB({download:!1})}async function VN(){await hB({download:!1,includeCode:!0,files:US.INSTANCE.filenames()})}async function $N(){await uB({download:!1})}const Ad=Gt(void 0),Yg=Gt(t=>{const e=t(Ad);return function(n,o,r){if(!r)return!1;const{cellIds:s,cellData:i}=n,a=s.inOrderIds.map(h=>i[h]),l=a.map(h=>h.code),c=a.map(h=>h.config),d=a.map(h=>h.name);return!(v4(l,r.codes)&&v4(d,r.names)&&ha(c,r.configs)&&ha(o.selectedLayout,r.layout.selectedLayout)&&ha(o.layoutData,r.layout.layoutData))}(t(_m),t(JS),e)});function HN(t){return JSON.stringify(t)}const WN=t=>{const e=K.c(15),{kioskMode:n}=t,o=jm(),r=$e(Yg),s=$e(mn).state===Vt.CLOSED,{saveOrNameNotebook:i,saveIfNotebookIsPersistent:a}=Jg();let l,c,d;e[0]!==n||e[1]!==a?(l={onSave:a,kioskMode:n},e[0]=n,e[1]=a,e[2]=l):l=e[2],function(p){const b=K.c(14),y=$e(C4),x=Ac(),[k]=an(mn),C=$e(Yg);let v,E;if(b[0]!==x){const R=Mm(x);v=R.map(KN),E=R.map(JN),b[0]=x,b[1]=v,b[2]=E}else v=b[1],E=b[2];const N=E;let I;b[3]!==x?(I=S4(x),b[3]=x,b[4]=I):I=b[4];const A=I;let M;b[5]!==y||b[6]!==N||b[7]!==v||b[8]!==A||b[9]!==k||b[10]!==C||b[11]!==p.kioskMode||b[12]!==p.onSave?(M={onSave:p.onSave,needsSave:C,codes:v,cellConfigs:A,cellNames:N,connStatus:k,config:y,kioskMode:p.kioskMode},b[5]=y,b[6]=N,b[7]=v,b[8]=A,b[9]=k,b[10]=C,b[11]=p.kioskMode,b[12]=p.onSave,b[13]=M):M=b[13],function(R){const z=K.c(21),{codes:D,cellConfigs:F,config:B,connStatus:U,cellNames:O,needsSave:S,kioskMode:$,onSave:j}=R,W=T.useRef(null);let X;z[0]!==D?(X=D.join(":"),z[0]=D,z[1]=X):X=z[1];const Y=X;let q;z[2]!==F?(q=F.map(HN).join(":"),z[2]=F,z[3]=q):q=z[3];const ne=q;let re;z[4]!==O?(re=O.join(":"),z[4]=O,z[5]=re):re=z[5];const ae=re;let Z,Q;z[6]!==B||z[7]!==U.state||z[8]!==$||z[9]!==S||z[10]!==j?(Z=()=>{if(!$)return B.autosave==="after_delay"&&(W.current!==null&&clearTimeout(W.current),S&&U.state===Vt.OPEN&&(W.current=setTimeout(j,B.autosave_delay))),()=>{W.current!==null&&clearTimeout(W.current)}},z[6]=B,z[7]=U.state,z[8]=$,z[9]=S,z[10]=j,z[11]=Z):Z=z[11],z[12]!==ne||z[13]!==ae||z[14]!==Y||z[15]!==B||z[16]!==U.state||z[17]!==$||z[18]!==S||z[19]!==j?(Q=[Y,ne,ae,B,U.state,j,$,S],z[12]=ne,z[13]=ae,z[14]=Y,z[15]=B,z[16]=U.state,z[17]=$,z[18]=S,z[19]=j,z[20]=Q):Q=z[20],T.useEffect(Z,Q)}(M)}(l),function(){const p=K.c(6),b=$e(dB),{state:y}=$e(mn),x=b.auto_download.includes("markdown"),k=b.auto_download.includes("html"),C=b.auto_download.includes("ipynb"),v=!x||y!==Vt.OPEN,E=!k||y!==Vt.OPEN,N=!C||y!==Vt.OPEN;let I,A,M;p[0]!==v?(I={delayMs:Id,whenVisible:!0,disabled:v},p[0]=v,p[1]=I):I=p[1],ka($N,I),p[2]!==E?(A={delayMs:Id,whenVisible:!0,disabled:E},p[2]=E,p[3]=A):A=p[3],ka(VN,A),p[4]!==N?(M={delayMs:Id,whenVisible:!0,disabled:N},p[4]=N,p[5]=M):M=p[5],ka(UN,M)}(),e[3]!==r?(c=p=>{if(r)return p.preventDefault(),p.returnValue="You have unsaved changes. Are you sure you want to leave?",p.returnValue},e[3]=r,e[4]=c):c=e[4],gm(window,"beforeunload",c),e[5]!==i?(d=p=>{p.preventDefault(),p.stopPropagation(),i()},e[5]=i,e[6]=d):d=e[6];const h=d;if(Jt("global.save",i),s){let p;return e[7]!==o||e[8]!==r?(p=u.jsx(FN,{filename:o,needsSave:r}),e[7]=o,e[8]=r,e[9]=p):p=e[9],p}let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=pn("global.save"),e[10]=f):f=e[10];const m=r?"yellow":"hint-green";let _,g;return e[11]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(Ta,{strokeWidth:1.5,size:18}),e[11]=_):_=e[11],e[12]!==h||e[13]!==m?(g=u.jsx(Te,{content:f,children:u.jsx(wn,{"data-testid":"save-button",id:"save-button",shape:"rectangle",color:m,onClick:h,children:_})}),e[12]=h,e[13]=m,e[14]=g):g=e[14],g};function Jg(){const t=K.c(19),{openModal:e,closeModal:n,openAlert:o}=qn(),r=en(Ad),s=k4(),i=mB();let a;t[0]!==o||t[1]!==r||t[2]!==i?(a=(p,b)=>{const y=Wn(),x=Mm(y),k=x.map(YN),C=x.map(GN),v=x.map(qN),E=S4(y),N=i.get(mn),I=i.get(C4),A=i.get(JS);i.get(Us)||C.length!==0&&(N.state===Vt.OPEN?(Dt.log("saving to ",p),pB({cellIds:k,codes:C,names:v,filename:p,configs:E,layout:wH(),persist:!0}).then(()=>{b&&I.format_on_save&&N4(),r({names:v,codes:C,configs:E,layout:A})})):o("Failed to save notebook: not connected to a kernel."))},t[0]=o,t[1]=r,t[2]=i,t[3]=a):a=t[3];const l=nt(a);let c;t[4]!==l||t[5]!==i?(c=p=>{const b=p!==void 0&&p,y=i.get(j4),x=i.get(mn);Kg(y)&&x.state===Vt.OPEN&&l(y,b)},t[4]=l,t[5]=i,t[6]=c):c=t[6];const d=nt(c);let h;t[7]!==l||t[8]!==s?(h=p=>{s(p).then(b=>{b!==null&&l(b,!0)})},t[7]=l,t[8]=s,t[9]=h):h=t[9];const f=h;let m;t[10]!==n||t[11]!==f||t[12]!==e||t[13]!==d||t[14]!==i?(m=()=>{const p=i.get(j4),b=i.get(mn);d(!0),Kg(p)||b.state===Vt.CLOSED||e(u.jsx(XN,{onClose:n,onSave:f}))},t[10]=n,t[11]=f,t[12]=e,t[13]=d,t[14]=i,t[15]=m):m=t[15];const _=nt(m);let g;return t[16]!==d||t[17]!==_?(g={saveOrNameNotebook:_,saveIfNotebookIsPersistent:d},t[16]=d,t[17]=_,t[18]=g):g=t[18],g}function qN(t){return t.name}function GN(t){return t.code}function YN(t){return t.id}function Kg(t){return t!==null&&!t.startsWith("/tmp")&&!t.startsWith("/var/folders")&&!t.includes("AppData\\Local\\Temp")}function JN(t){return t.name}function KN(t){return t.code}const XN=t=>{const e=K.c(17),{onClose:n,onSave:o}=t,[r,s]=T.useState();let i;e[0]!==n||e[1]!==o?(i=p=>{s(p),p.trim()&&(o(p),n())},e[0]=n,e[1]=o,e[2]=i):i=e[2];const a=i;let l,c,d,h;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(ar,{children:"Save notebook"}),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(Fr,{className:"text-md pt-6 px-1",children:"Save as"}),e[4]=c):c=e[4],e[5]!==a?(d=u.jsxs("div",{className:"flex flex-col",children:[c,u.jsx(Gg,{onNameChange:a,placeholderText:"filename",className:"missing-filename"})]}),e[5]=a,e[6]=d):d=e[6],e[7]!==n?(h=u.jsx(De,{"data-testid":"cancel-save-dialog-button","aria-label":"Cancel",variant:"secondary",onClick:n,children:"Cancel"}),e[7]=n,e[8]=h):h=e[8];const f=!r;let m,_,g;return e[9]!==f?(m=u.jsx(De,{"data-testid":"submit-save-dialog-button","aria-label":"Save",variant:"default",disabled:f,type:"submit",children:"Save"}),e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(_=u.jsxs(oa,{children:[h,m]}),e[11]=h,e[12]=m,e[13]=_):_=e[13],e[14]!==d||e[15]!==_?(g=u.jsxs(cr,{children:[l,d,_]}),e[14]=d,e[15]=_,e[16]=g):g=e[16],g};function Xg(t){const e=K.c(3),[n,o]=T.useState(!1);let r,s;return e[0]!==t?(r=()=>{if(!t)return;o(!1);const i=setTimeout(()=>{o(!0)},200);return()=>clearTimeout(i)},s=[t],e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]),T.useEffect(r,s),t&&n}const di=t=>{const{children:e}=t;return $e(Us)?null:e},ZN=t=>{const{children:e}=t;return $e(Us)?e:null},QN=()=>{const t=K.c(6),e=en(kd);let n;t[0]!==e?(n=()=>e(ej),t[0]=e,t[1]=n):n=t[1];const o=n;let r,s,i;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=pn("global.commandPalette"),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx(rd,{strokeWidth:1.5,size:18}),t[3]=s):s=t[3],t[4]!==o?(i=u.jsx(Te,{content:r,children:u.jsx(wn,{"data-testid":"command-palette-button",onClick:o,shape:"rectangle",color:"hint-green",children:s})}),t[4]=o,t[5]=i):i=t[5],i};function ej(t){return!t}const tj=t=>{const e=K.c(47),{presenting:n,onTogglePresenting:o,onInterrupt:r,onRun:s,connectionState:i,running:a,appConfig:l}=t,c=l.width,d=$e(p4),h=$e(gB),{undoDeleteCell:f}=Ot(),m=i===Vt.CLOSED;let _,g=null;if(!m&&d){let S,$;e[0]===Symbol.for("react.memo_cache_sentinel")?(S=u.jsx(pd,{size:16,strokeWidth:1.5}),e[0]=S):S=e[0],e[1]!==f?($=u.jsx(Te,{content:"Undo cell deletion",children:u.jsx(wn,{"data-testid":"undo-delete-cell",size:"medium",color:"hint-green",shape:"circle",onClick:f,children:S})}),e[1]=f,e[2]=$):$=e[2],g=$}e[3]!==i?(_=Ho(i),e[3]=i,e[4]=_):_=e[4];const p=_;let b;e[5]!==i||e[6]!==p?(b=p?Zc(i):void 0,e[5]=i,e[6]=p,e[7]=b):b=e[7];const y=b;let x,k;e[8]!==n?(x=!n&&u.jsx(TN,{}),e[8]=n,e[9]=x):x=e[9],e[10]!==m||e[11]!==y||e[12]!==p||e[13]!==n?(k=!m&&u.jsxs("div",{className:rj,children:[n&&u.jsx(JC,{}),u.jsx(wN,{disabled:p,tooltip:y}),u.jsx(cH,{disabled:p,tooltip:y}),u.jsx(dH,{description:"This will terminate the Python kernel. You'll lose all data that's in memory.",disabled:p,tooltip:y})]}),e[10]=m,e[11]=y,e[12]=p,e[13]=n,e[14]=k):k=e[14];const C=c==="compact"&&"xl:flex-row items-end";let v,E,N,I,A,M,R,z,D,F,B,U,O;return e[15]!==C?(v=Ae(sj,C),e[15]=C,e[16]=v):v=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(E=u.jsx(di,{children:u.jsx(WN,{kioskMode:!1})}),e[17]=E):E=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(N=pn("global.hideCode"),e[18]=N):N=e[18],e[19]!==n?(I=n?u.jsx(g4,{strokeWidth:1.5,size:18}):u.jsx(ld,{strokeWidth:1.5,size:18}),e[19]=n,e[20]=I):I=e[20],e[21]!==o||e[22]!==I?(A=u.jsx(Te,{content:N,children:u.jsx(wn,{"data-testid":"hide-code-button",id:"preview-button",shape:"rectangle",color:"hint-green",onClick:o,children:I})}),e[21]=o,e[22]=I,e[23]=A):A=e[23],e[24]===Symbol.for("react.memo_cache_sentinel")?(M=u.jsx(QN,{}),R=u.jsx(uH,{}),z=u.jsx("div",{}),e[24]=M,e[25]=R,e[26]=z):(M=e[24],R=e[25],z=e[26]),e[27]!==m||e[28]!==r||e[29]!==a?(D=!m&&u.jsx(oj,{running:a,onInterrupt:r}),e[27]=m,e[28]=r,e[29]=a,e[30]=D):D=e[30],e[31]!==m||e[32]!==h||e[33]!==s?(F=!m&&u.jsx(nj,{needsRun:h,onRun:s}),e[31]=m,e[32]=h,e[33]=s,e[34]=F):F=e[34],e[35]!==D||e[36]!==F||e[37]!==g?(B=u.jsx(di,{children:u.jsxs("div",{className:"flex flex-col gap-2 items-center",children:[g,D,F]})}),e[35]=D,e[36]=F,e[37]=g,e[38]=B):B=e[38],e[39]!==A||e[40]!==B||e[41]!==v?(U=u.jsxs("div",{className:v,children:[E,A,M,R,z,B]}),e[39]=A,e[40]=B,e[41]=v,e[42]=U):U=e[42],e[43]!==U||e[44]!==x||e[45]!==k?(O=u.jsxs(u.Fragment,{children:[x,k,U]}),e[43]=U,e[44]=x,e[45]=k,e[46]=O):O=e[46],O},nj=t=>{const e=K.c(8),{needsRun:n,onRun:o}=t,r=$e(E4);if(n){let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=pn("global.runStale"),e[0]=l):l=e[0];const c=r?o:void 0,d=!r;let h,f;return e[1]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(ii,{strokeWidth:1.5,size:16}),e[1]=h):h=e[1],e[2]!==c||e[3]!==d?(f=u.jsx(Te,{content:l,children:u.jsx(wn,{"data-testid":"run-button",size:"medium",color:"yellow",shape:"circle",onClick:c,disabled:d,children:h})}),e[2]=c,e[3]=d,e[4]=f):f=e[4],f}const s=!r;let i,a;return e[5]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(ii,{strokeWidth:1.5,size:16}),e[5]=i):i=e[5],e[6]!==s?(a=u.jsx(Te,{content:"Nothing to run",children:u.jsx(wn,{"data-testid":"run-button",className:"inactive-button",color:"disabled",size:"medium",shape:"circle",disabled:s,children:i})}),e[6]=s,e[7]=a):a=e[7],a},oj=t=>{const e=K.c(8),{running:n,onInterrupt:o}=t,r=Xg(n);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=pn("global.interrupt"),e[0]=s):s=e[0];const i=!r&&"inactive-button active:shadow-xsSolid";let a;e[1]!==i?(a=Ae(i),e[1]=i,e[2]=a):a=e[2];const l=r?"yellow":"disabled",c=r?o:An.NOOP;let d,h;return e[3]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(vc,{strokeWidth:1.5,size:16}),e[3]=d):d=e[3],e[4]!==a||e[5]!==l||e[6]!==c?(h=u.jsx(Te,{content:s,children:u.jsx(wn,{className:a,"data-testid":"interrupt-button",size:"medium",color:l,shape:"circle",onClick:c,children:d})}),e[4]=a,e[5]=l,e[6]=c,e[7]=h):h=e[7],h},rj="absolute top-3 right-5 m-0 flex items-center space-x-3 min-h-[28px] no-print pointer-events-auto z-30 print:hidden",sj="absolute bottom-5 right-5 flex flex-col gap-2 items-center no-print pointer-events-auto z-30 print:hidden",ij=t=>{const e=K.c(7),{filename:n}=t,o=k4();let r;e[0]!==n?(r=n?Tn.basename(n):"untitled marimo notebook",e[0]=n,e[1]=r):r=e[1];const s=n===null?"missing-filename":"filename";let i;return e[2]!==n||e[3]!==o||e[4]!==r||e[5]!==s?(i=u.jsx(Gg,{placeholderText:r,initialValue:n,onNameChange:o,flexibleWidth:!0,resetOnBlur:!0,"data-testid":"filename-input",className:s}),e[2]=n,e[3]=o,e[4]=r,e[5]=s,e[6]=i):i=e[6],i},aj={display:"none"};function lj(t){let{id:e,value:n}=t;return J.createElement("div",{id:e,style:aj},n)}function cj(t){let{id:e,announcement:n,ariaLiveType:o="assertive"}=t;return J.createElement("div",{id:e,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":o,"aria-atomic":!0},n)}const Zg=T.createContext(null),dj={draggable:`
|
99
|
+
To pick up a draggable item, press the space bar.
|
100
|
+
While dragging, use the arrow keys to move the item.
|
101
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
102
|
+
`},uj={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function hj(t){let{announcements:e=uj,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=dj}=t;const{announce:s,announcement:i}=function(){const[h,f]=T.useState("");return{announce:T.useCallback(m=>{m!=null&&f(m)},[]),announcement:h}}(),a=fa("DndLiveRegion"),[l,c]=T.useState(!1);if(T.useEffect(()=>{c(!0)},[]),function(h){const f=T.useContext(Zg);T.useEffect(()=>{if(!f)throw new Error("useDndMonitor must be used within a children of <DndContext>");return f(h)},[h,f])}(T.useMemo(()=>({onDragStart(h){let{active:f}=h;s(e.onDragStart({active:f}))},onDragMove(h){let{active:f,over:m}=h;e.onDragMove&&s(e.onDragMove({active:f,over:m}))},onDragOver(h){let{active:f,over:m}=h;s(e.onDragOver({active:f,over:m}))},onDragEnd(h){let{active:f,over:m}=h;s(e.onDragEnd({active:f,over:m}))},onDragCancel(h){let{active:f,over:m}=h;s(e.onDragCancel({active:f,over:m}))}}),[s,e])),!l)return null;const d=J.createElement(J.Fragment,null,J.createElement(lj,{id:o,value:r.draggable}),J.createElement(cj,{id:a,announcement:i}));return n?ga.createPortal(d,n):d}var Ut;function Va(){}function Qg(t,e){return T.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Ut||(Ut={}));const Xn=Object.freeze({x:0,y:0});function Td(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Md(t,e){let{data:{value:n}}=t,{data:{value:o}}=e;return n-o}function fj(t,e){let{data:{value:n}}=t,{data:{value:o}}=e;return o-n}function Od(t){let{left:e,top:n,height:o,width:r}=t;return[{x:e,y:n},{x:e+r,y:n},{x:e,y:n+o},{x:e+r,y:n+o}]}function Dd(t,e){if(!t||t.length===0)return null;const[n]=t;return e?n[e]:n}function e1(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+.5*t.width,y:n+.5*t.height}}const Rd=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:o}=t;const r=e1(e,e.left,e.top),s=[];for(const i of o){const{id:a}=i,l=n.get(a);if(l){const c=Td(e1(l),r);s.push({id:a,data:{droppableContainer:i,value:c}})}}return s.sort(Md)};function mj(t,e){const n=Math.max(e.top,t.top),o=Math.max(e.left,t.left),r=Math.min(e.left+e.width,t.left+t.width),s=Math.min(e.top+e.height,t.top+t.height),i=r-o,a=s-n;if(o<r&&n<s){const l=e.width*e.height,c=t.width*t.height,d=i*a;return Number((d/(l+c-d)).toFixed(4))}return 0}const t1=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:o}=t;const r=[];for(const s of o){const{id:i}=s,a=n.get(i);if(a){const l=mj(a,e);l>0&&r.push({id:i,data:{droppableContainer:s,value:l}})}}return r.sort(fj)};function pj(t,e){const{top:n,left:o,bottom:r,right:s}=e;return n<=t.y&&t.y<=r&&o<=t.x&&t.x<=s}function n1(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Xn}function gj(t){return function(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return o.reduce((s,i)=>({...s,top:s.top+t*i.y,bottom:s.bottom+t*i.y,left:s.left+t*i.x,right:s.right+t*i.x}),{...e})}}const _j=gj(1),bj={ignoreTransform:!1};function Gr(t,e){e===void 0&&(e=bj);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:d}=Uo(t).getComputedStyle(t);c&&(n=function(h,f,m){const _=function(E){if(E.startsWith("matrix3d(")){const N=E.slice(9,-1).split(/, /);return{x:+N[12],y:+N[13],scaleX:+N[0],scaleY:+N[5]}}if(E.startsWith("matrix(")){const N=E.slice(7,-1).split(/, /);return{x:+N[4],y:+N[5],scaleX:+N[0],scaleY:+N[3]}}return null}(f);if(!_)return h;const{scaleX:g,scaleY:p,x:b,y}=_,x=h.left-b-(1-g)*parseFloat(m),k=h.top-y-(1-p)*parseFloat(m.slice(m.indexOf(" ")+1)),C=g?h.width/g:h.width,v=p?h.height/p:h.height;return{width:C,height:v,top:k,right:x+C,bottom:k+v,left:x}}(n,c,d))}const{top:o,left:r,width:s,height:i,bottom:a,right:l}=n;return{top:o,left:r,width:s,height:i,bottom:a,right:l}}function o1(t){return Gr(t,{ignoreTransform:!0})}function $a(t,e){const n=[];return t?function o(r){if(e!=null&&n.length>=e||!r)return n;if(A4(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!Mc(r)||_B(r)||n.includes(r))return n;const s=Uo(t).getComputedStyle(r);return r!==t&&function(i,a){a===void 0&&(a=Uo(i).getComputedStyle(i));const l=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(c=>{const d=a[c];return typeof d=="string"&&l.test(d)})}(r,s)&&n.push(r),function(i,a){return a===void 0&&(a=Uo(i).getComputedStyle(i)),a.position==="fixed"}(r,s)?n:o(r.parentNode)}(t):n}function r1(t){const[e]=$a(t,1);return e??null}function Pd(t){return Rm&&t?Pm(t)?t:xB(t)?A4(t)||t===Ks(t).scrollingElement?window:Mc(t)?t:null:null:null}function s1(t){return Pm(t)?t.scrollX:t.scrollLeft}function i1(t){return Pm(t)?t.scrollY:t.scrollTop}function Ld(t){return{x:s1(t),y:i1(t)}}var $t;function a1(t){return!(!Rm||!t)&&t===document.scrollingElement}function l1(t){const e={x:0,y:0},n=a1(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},o={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height};return{isTop:t.scrollTop<=e.y,isLeft:t.scrollLeft<=e.x,isBottom:t.scrollTop>=o.y,isRight:t.scrollLeft>=o.x,maxScroll:o,minScroll:e}}(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})($t||($t={}));const yj={x:.2,y:.2};function xj(t,e,n,o,r){let{top:s,left:i,right:a,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=yj);const{isTop:c,isBottom:d,isLeft:h,isRight:f}=l1(t),m={x:0,y:0},_={x:0,y:0},g=e.height*r.y,p=e.width*r.x;return!c&&s<=e.top+g?(m.y=$t.Backward,_.y=o*Math.abs((e.top+g-s)/g)):!d&&l>=e.bottom-g&&(m.y=$t.Forward,_.y=o*Math.abs((e.bottom-g-l)/g)),!f&&a>=e.right-p?(m.x=$t.Forward,_.x=o*Math.abs((e.right-p-a)/p)):!h&&i<=e.left+p&&(m.x=$t.Backward,_.x=o*Math.abs((e.left+p-i)/p)),{direction:m,speed:_}}function wj(t){if(t===document.scrollingElement){const{innerWidth:s,innerHeight:i}=window;return{top:0,left:0,right:s,bottom:i,width:s,height:i}}const{top:e,left:n,right:o,bottom:r}=t.getBoundingClientRect();return{top:e,left:n,right:o,bottom:r,width:t.clientWidth,height:t.clientHeight}}function c1(t){return t.reduce((e,n)=>Xs(e,Ld(n)),Xn)}const vj=[["x",["left","right"],function(t){return t.reduce((e,n)=>e+s1(n),0)}],["y",["top","bottom"],function(t){return t.reduce((e,n)=>e+i1(n),0)}]];class Fd{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const o=$a(n),r=c1(o);this.rect={...e},this.width=e.width,this.height=e.height;for(const[s,i,a]of vj)for(const l of i)Object.defineProperty(this,l,{get:()=>{const c=a(o),d=r[s]-c;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ui{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...n)})},this.target=e}add(e,n,o){var r;(r=this.target)==null||r.addEventListener(e,n,o),this.listeners.push([e,n,o])}}function zd(t,e){const n=Math.abs(t.x),o=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+o**2)>e:"x"in e&&"y"in e?n>e.x&&o>e.y:"x"in e?n>e.x:"y"in e&&o>e.y}var Dn,lt;function d1(t){t.preventDefault()}function kj(t){t.stopPropagation()}(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Dn||(Dn={})),function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"}(lt||(lt={}));const u1={start:[lt.Space,lt.Enter],cancel:[lt.Esc],end:[lt.Space,lt.Enter,lt.Tab]},Sj=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case lt.Right:return{...n,x:n.x+25};case lt.Left:return{...n,x:n.x-25};case lt.Down:return{...n,y:n.y+25};case lt.Up:return{...n,y:n.y-25}}};class Bd{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new ui(Ks(n)),this.windowListeners=new ui(Uo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Dn.Resize,this.handleCancel),this.windowListeners.add(Dn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Dn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,o=e.node.current;o&&function(r,s){if(s===void 0&&(s=Gr),!r)return;const{top:i,left:a,bottom:l,right:c}=s(r);r1(r)&&(l<=0||c<=0||i>=window.innerHeight||a>=window.innerWidth)&&r.scrollIntoView({block:"center",inline:"center"})}(o),n(Xn)}handleKeyDown(e){if(Om(e)){const{active:n,context:o,options:r}=this.props,{keyboardCodes:s=u1,coordinateGetter:i=Sj,scrollBehavior:a="smooth"}=r,{code:l}=e;if(s.end.includes(l))return void this.handleEnd(e);if(s.cancel.includes(l))return void this.handleCancel(e);const{collisionRect:c}=o.current,d=c?{x:c.left,y:c.top}:Xn;this.referenceCoordinates||(this.referenceCoordinates=d);const h=i(e,{active:n,context:o.current,currentCoordinates:d});if(h){const f=pa(h,d),m={x:0,y:0},{scrollableAncestors:_}=o.current;for(const g of _){const p=e.code,{isTop:b,isRight:y,isLeft:x,isBottom:k,maxScroll:C,minScroll:v}=l1(g),E=wj(g),N={x:Math.min(p===lt.Right?E.right-E.width/2:E.right,Math.max(p===lt.Right?E.left:E.left+E.width/2,h.x)),y:Math.min(p===lt.Down?E.bottom-E.height/2:E.bottom,Math.max(p===lt.Down?E.top:E.top+E.height/2,h.y))},I=p===lt.Right&&!y||p===lt.Left&&!x,A=p===lt.Down&&!k||p===lt.Up&&!b;if(I&&N.x!==h.x){const M=g.scrollLeft+f.x,R=p===lt.Right&&M<=C.x||p===lt.Left&&M>=v.x;if(R&&!f.y)return void g.scrollTo({left:M,behavior:a});m.x=R?g.scrollLeft-M:p===lt.Right?g.scrollLeft-C.x:g.scrollLeft-v.x,m.x&&g.scrollBy({left:-m.x,behavior:a});break}if(A&&N.y!==h.y){const M=g.scrollTop+f.y,R=p===lt.Down&&M<=C.y||p===lt.Up&&M>=v.y;if(R&&!f.x)return void g.scrollTo({top:M,behavior:a});m.y=R?g.scrollTop-M:p===lt.Down?g.scrollTop-C.y:g.scrollTop-v.y,m.y&&g.scrollBy({top:-m.y,behavior:a});break}}this.handleMove(e,Xs(pa(h,this.referenceCoordinates),m))}}}handleMove(e,n){const{onMove:o}=this.props;e.preventDefault(),o(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function h1(t){return!!(t&&"distance"in t)}function f1(t){return!!(t&&"delay"in t)}Bd.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:o=u1,onActivation:r}=e,{active:s}=n;const{code:i}=t.nativeEvent;if(o.start.includes(i)){const a=s.activatorNode.current;return(!a||t.target===a)&&(t.preventDefault(),r==null||r({event:t.nativeEvent}),!0)}return!1}}];class Ud{constructor(e,n,o){var r;o===void 0&&(o=function(a){const{EventTarget:l}=Uo(a);return a instanceof l?a:Ks(a)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:s}=e,{target:i}=s;this.props=e,this.events=n,this.document=Ks(i),this.documentListeners=new ui(this.document),this.listeners=new ui(o),this.windowListeners=new ui(Uo(i)),this.initialCoordinates=(r=Dm(s))!=null?r:Xn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:o}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Dn.Resize,this.handleCancel),this.windowListeners.add(Dn.DragStart,d1),this.windowListeners.add(Dn.VisibilityChange,this.handleCancel),this.windowListeners.add(Dn.ContextMenu,d1),this.documentListeners.add(Dn.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(f1(n))return this.timeoutId=setTimeout(this.handleStart,n.delay),void this.handlePending(n);if(h1(n))return void this.handlePending(n)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:o,onPending:r}=this.props;r(o,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(Dn.Click,kj,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Dn.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:o,initialCoordinates:r,props:s}=this,{onMove:i,options:{activationConstraint:a}}=s;if(!r)return;const l=(n=Dm(e))!=null?n:Xn,c=pa(r,l);if(!o&&a){if(h1(a)){if(a.tolerance!=null&&zd(c,a.tolerance))return this.handleCancel();if(zd(c,a.distance))return this.handleStart()}return f1(a)&&zd(c,a.tolerance)?this.handleCancel():void this.handlePending(a,c)}e.cancelable&&e.preventDefault(),i(l)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===lt.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const Cj={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Vd extends Ud{constructor(e){const{event:n}=e,o=Ks(n.target);super(e,Cj,o)}}Vd.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;return!(!n.isPrimary||n.button!==0)&&(o==null||o({event:n}),!0)}}];const Nj={move:{name:"mousemove"},end:{name:"mouseup"}};var $d;(function(t){t[t.RightClick=2]="RightClick"})($d||($d={})),(class extends Ud{constructor(t){super(t,Nj,Ks(t.event.target))}}).activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;return n.button!==$d.RightClick&&(o==null||o({event:n}),!0)}}];const Hd={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var hi,Ha;function jj(t){let{acceleration:e,activator:n=hi.Pointer,canScroll:o,draggingRect:r,enabled:s,interval:i=5,order:a=Ha.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:h,threshold:f}=t;const m=function(v){let{delta:E,disabled:N}=v;const I=Oc(E);return _a(A=>{if(N||!I||!A)return Ej;const M={x:Math.sign(E.x-I.x),y:Math.sign(E.y-I.y)};return{x:{[$t.Backward]:A.x[$t.Backward]||M.x===-1,[$t.Forward]:A.x[$t.Forward]||M.x===1},y:{[$t.Backward]:A.y[$t.Backward]||M.y===-1,[$t.Forward]:A.y[$t.Forward]||M.y===1}}},[N,E,I])}({delta:h,disabled:!s}),[_,g]=bB(),p=T.useRef({x:0,y:0}),b=T.useRef({x:0,y:0}),y=T.useMemo(()=>{switch(n){case hi.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case hi.DraggableRect:return r}},[n,r,l]),x=T.useRef(null),k=T.useCallback(()=>{const v=x.current;if(!v)return;const E=p.current.x*b.current.x,N=p.current.y*b.current.y;v.scrollBy(E,N)},[]),C=T.useMemo(()=>a===Ha.TreeOrder?[...c].reverse():c,[a,c]);T.useEffect(()=>{if(s&&c.length&&y){for(const v of C){if((o==null?void 0:o(v))===!1)continue;const E=c.indexOf(v),N=d[E];if(!N)continue;const{direction:I,speed:A}=xj(v,N,y,e,f);for(const M of["x","y"])m[M][I[M]]||(A[M]=0,I[M]=0);if(A.x>0||A.y>0)return g(),x.current=v,_(k,i),p.current=A,void(b.current=I)}p.current={x:0,y:0},b.current={x:0,y:0},g()}else g()},[e,k,o,g,s,i,JSON.stringify(y),JSON.stringify(m),_,c,C,d,JSON.stringify(f)])}(class extends Ud{constructor(t){super(t,Hd)}static setup(){return window.addEventListener(Hd.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Hd.move.name,t)};function t(){}}}).activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;const{touches:r}=n;return!(r.length>1)&&(o==null||o({event:n}),!0)}}],function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"}(hi||(hi={})),function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"}(Ha||(Ha={}));const Ej={x:{[$t.Backward]:!1,[$t.Forward]:!1},y:{[$t.Backward]:!1,[$t.Forward]:!1}};var fi,Wd;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(fi||(fi={})),function(t){t.Optimized="optimized"}(Wd||(Wd={}));const m1=new Map;function p1(t,e){return _a(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function Wa(t){let{callback:e,disabled:n}=t;const o=I4(e),r=T.useMemo(()=>{if(n||typeof window>"u"||window.ResizeObserver===void 0)return;const{ResizeObserver:s}=window;return new s(o)},[n]);return T.useEffect(()=>()=>r==null?void 0:r.disconnect(),[r]),r}function Ij(t){return new Fd(Gr(t),t)}function g1(t,e,n){e===void 0&&(e=Ij);const[o,r]=T.useState(null);function s(){r(l=>{if(!t)return null;var c;if(t.isConnected===!1)return(c=l??n)!=null?c:null;const d=e(t);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const i=function(l){let{callback:c,disabled:d}=l;const h=I4(c),f=T.useMemo(()=>{if(d||typeof window>"u"||window.MutationObserver===void 0)return;const{MutationObserver:m}=window;return new m(h)},[h,d]);return T.useEffect(()=>()=>f==null?void 0:f.disconnect(),[f]),f}({callback(l){if(t)for(const c of l){const{type:d,target:h}=c;if(d==="childList"&&h instanceof HTMLElement&&h.contains(t)){s();break}}}}),a=Wa({callback:s});return hr(()=>{s(),t?(a==null||a.observe(t),i==null||i.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),i==null||i.disconnect())},[t]),o}const _1=[];function b1(t,e){e===void 0&&(e=[]);const n=T.useRef(null);return T.useEffect(()=>{n.current=null},e),T.useEffect(()=>{const o=t!==Xn;o&&!n.current&&(n.current=t),!o&&n.current&&(n.current=null)},[t]),n.current?pa(t,n.current):Xn}function y1(t){return T.useMemo(()=>t?function(e){const n=e.innerWidth,o=e.innerHeight;return{top:0,left:0,right:n,bottom:o,width:n,height:o}}(t):null,[t])}const x1=[];function Aj(t){let{measure:e}=t;const[n,o]=T.useState(null),r=T.useCallback(c=>{for(const{target:d}of c)if(Mc(d)){o(h=>{const f=e(d);return h?{...h,width:f.width,height:f.height}:f});break}},[e]),s=Wa({callback:r}),i=T.useCallback(c=>{const d=function(h){if(!h)return null;if(h.children.length>1)return h;const f=h.children[0];return Mc(f)?f:h}(c);s==null||s.disconnect(),d&&(s==null||s.observe(d)),o(d?e(d):null)},[e,s]),[a,l]=Tc(i);return T.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const Tj=[{sensor:Vd,options:{}},{sensor:Bd,options:{}}],Mj={current:{}},qa={draggable:{measure:o1},droppable:{measure:o1,strategy:fi.WhileDragging,frequency:Wd.Optimized},dragOverlay:{measure:Gr}};class mi extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,o;return(n=(o=this.get(e))==null?void 0:o.node.current)!=null?n:void 0}}const Oj={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new mi,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Va},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:qa,measureDroppableContainers:Va,windowRect:null,measuringScheduled:!1},Dj={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Va,draggableNodes:new Map,over:null,measureDroppableContainers:Va},Ga=T.createContext(Dj),w1=T.createContext(Oj);function Rj(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new mi}}}function Pj(t,e){switch(e.type){case Ut.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Ut.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case Ut.DragEnd:case Ut.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ut.RegisterDroppable:{const{element:n}=e,{id:o}=n,r=new mi(t.droppable.containers);return r.set(o,n),{...t,droppable:{...t.droppable,containers:r}}}case Ut.SetDroppableDisabled:{const{id:n,key:o,disabled:r}=e,s=t.droppable.containers.get(n);if(!s||o!==s.key)return t;const i=new mi(t.droppable.containers);return i.set(n,{...s,disabled:r}),{...t,droppable:{...t.droppable,containers:i}}}case Ut.UnregisterDroppable:{const{id:n,key:o}=e,r=t.droppable.containers.get(n);if(!r||o!==r.key)return t;const s=new mi(t.droppable.containers);return s.delete(n),{...t,droppable:{...t.droppable,containers:s}}}default:return t}}function Lj(t){let{disabled:e}=t;const{active:n,activatorEvent:o,draggableNodes:r}=T.useContext(Ga),s=Oc(o),i=Oc(n==null?void 0:n.id);return T.useEffect(()=>{if(!e&&!o&&s&&i!=null){if(!Om(s)||document.activeElement===s.target)return;const a=r.get(i);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[l.current,c.current]){if(!d)continue;const h=yB(d);if(h){h.focus();break}}})}},[o,e,r,i,s]),null}const v1=T.createContext({...Xn,scaleX:1,scaleY:1});var Wo;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Wo||(Wo={}));const Fj=T.memo(function(t){var e,n,o,r;let{id:s,accessibility:i,autoScroll:a=!0,children:l,sensors:c=Tj,collisionDetection:d=t1,measuring:h,modifiers:f,...m}=t;const _=T.useReducer(Pj,void 0,Rj),[g,p]=_,[b,y]=function(){const[ie]=T.useState(()=>new Set),Se=T.useCallback(Ee=>(ie.add(Ee),()=>ie.delete(Ee)),[ie]);return[T.useCallback(Ee=>{let{type:Be,event:Ye}=Ee;ie.forEach(Re=>{var He;return(He=Re[Be])==null?void 0:He.call(Re,Ye)})},[ie]),Se]}(),[x,k]=T.useState(Wo.Uninitialized),C=x===Wo.Initialized,{draggable:{active:v,nodes:E,translate:N},droppable:{containers:I}}=g,A=v!=null?E.get(v):null,M=T.useRef({initial:null,translated:null}),R=T.useMemo(()=>{var ie;return v!=null?{id:v,data:(ie=A==null?void 0:A.data)!=null?ie:Mj,rect:M}:null},[v,A]),z=T.useRef(null),[D,F]=T.useState(null),[B,U]=T.useState(null),O=ma(m,Object.values(m)),S=fa("DndDescribedBy",s),$=T.useMemo(()=>I.getEnabled(),[I]),j=(W=h,T.useMemo(()=>({draggable:{...qa.draggable,...W==null?void 0:W.draggable},droppable:{...qa.droppable,...W==null?void 0:W.droppable},dragOverlay:{...qa.dragOverlay,...W==null?void 0:W.dragOverlay}}),[W==null?void 0:W.draggable,W==null?void 0:W.droppable,W==null?void 0:W.dragOverlay]));var W;const{droppableRects:X,measureDroppableContainers:Y,measuringScheduled:q}=function(ie,Se){let{dragging:Ee,dependencies:Be,config:Ye}=Se;const[Re,He]=T.useState(null),{frequency:it,measure:Xe,strategy:ot}=Ye,yt=T.useRef(ie),bt=function(){switch(ot){case fi.Always:return!1;case fi.BeforeDragging:return Ee;default:return!Ee}}(),Mt=ma(bt),xt=T.useCallback(function(fn){fn===void 0&&(fn=[]),Mt.current||He(sn=>sn===null?fn:sn.concat(fn.filter(Qt=>!sn.includes(Qt))))},[Mt]),rn=T.useRef(null),Nn=_a(fn=>{if(bt&&!Ee)return m1;if(!fn||fn===m1||yt.current!==ie||Re!=null){const sn=new Map;for(let Qt of ie){if(!Qt)continue;if(Re&&Re.length>0&&!Re.includes(Qt.id)&&Qt.rect.current){sn.set(Qt.id,Qt.rect.current);continue}const to=Qt.node.current,po=to?new Fd(Xe(to),to):null;Qt.rect.current=po,po&&sn.set(Qt.id,po)}return sn}return fn},[ie,Re,Ee,bt,Xe]);return T.useEffect(()=>{yt.current=ie},[ie]),T.useEffect(()=>{bt||xt()},[Ee,bt]),T.useEffect(()=>{Re&&Re.length>0&&He(null)},[JSON.stringify(Re)]),T.useEffect(()=>{bt||typeof it!="number"||rn.current!==null||(rn.current=setTimeout(()=>{xt(),rn.current=null},it))},[it,bt,xt,...Be]),{droppableRects:Nn,measureDroppableContainers:xt,measuringScheduled:Re!=null}}($,{dragging:C,dependencies:[N.x,N.y],config:j.droppable}),ne=function(ie,Se){const Ee=Se!=null?ie.get(Se):void 0,Be=Ee?Ee.node.current:null;return _a(Ye=>{var Re;return Se==null?null:(Re=Be??Ye)!=null?Re:null},[Be,Se])}(E,v),re=T.useMemo(()=>B?Dm(B):null,[B]),ae=function(){const ie=(D==null?void 0:D.autoScrollEnabled)===!1,Se=typeof a=="object"?a.enabled===!1:a===!1,Ee=C&&!ie&&!Se;return typeof a=="object"?{...a,enabled:Ee}:{enabled:Ee}}(),Z=function(ie,Se){return p1(ie,Se)}(ne,j.draggable.measure);(function(ie){let{activeNode:Se,measure:Ee,initialRect:Be,config:Ye=!0}=ie;const Re=T.useRef(!1),{x:He,y:it}=typeof Ye=="boolean"?{x:Ye,y:Ye}:Ye;hr(()=>{if(!He&&!it||!Se)return void(Re.current=!1);if(Re.current||!Be)return;const Xe=Se==null?void 0:Se.node.current;if(!Xe||Xe.isConnected===!1)return;const ot=n1(Ee(Xe),Be);if(He||(ot.x=0),it||(ot.y=0),Re.current=!0,Math.abs(ot.x)>0||Math.abs(ot.y)>0){const yt=r1(Xe);yt&&yt.scrollBy({top:ot.y,left:ot.x})}},[Se,He,it,Be,Ee])})({activeNode:v!=null?E.get(v):null,config:ae.layoutShiftCompensation,initialRect:Z,measure:j.draggable.measure});const Q=g1(ne,j.draggable.measure,Z),he=g1(ne?ne.parentElement:null),pe=T.useRef({activatorEvent:null,active:null,activeNode:ne,collisionRect:null,collisions:null,droppableRects:X,draggableNodes:E,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ce=I.getNodeFor((e=pe.current.over)==null?void 0:e.id),fe=Aj({measure:j.dragOverlay.measure}),de=(n=fe.nodeRef.current)!=null?n:ne,Ce=C?(o=fe.rect)!=null?o:Q:null,Ne=!!(fe.nodeRef.current&&fe.rect),se=n1(Ie=Ne?null:Q,p1(Ie));var Ie;const be=y1(de?Uo(de):null),Oe=function(ie){const Se=T.useRef(ie),Ee=_a(Be=>ie?Be&&Be!==_1&&ie&&Se.current&&ie.parentNode===Se.current.parentNode?Be:$a(ie):_1,[ie]);return T.useEffect(()=>{Se.current=ie},[ie]),Ee}(C?ce??ne:null),ze=function(ie,Se){Se===void 0&&(Se=Gr);const[Ee]=ie,Be=y1(Ee?Uo(Ee):null),[Ye,Re]=T.useState(x1);function He(){Re(()=>ie.length?ie.map(Xe=>a1(Xe)?Be:new Fd(Se(Xe),Xe)):x1)}const it=Wa({callback:He});return hr(()=>{it==null||it.disconnect(),He(),ie.forEach(Xe=>it==null?void 0:it.observe(Xe))},[ie]),Ye}(Oe),Ge=function(ie,Se){let{transform:Ee,...Be}=Se;return ie!=null&&ie.length?ie.reduce((Ye,Re)=>Re({transform:Ye,...Be}),Ee):Ee}(f,{transform:{x:N.x-se.x,y:N.y-se.y,scaleX:1,scaleY:1},activatorEvent:B,active:R,activeNodeRect:Q,containerNodeRect:he,draggingNodeRect:Ce,over:pe.current.over,overlayNodeRect:fe.rect,scrollableAncestors:Oe,scrollableAncestorRects:ze,windowRect:be}),Je=re?Xs(re,N):null,Le=function(ie){const[Se,Ee]=T.useState(null),Be=T.useRef(ie),Ye=T.useCallback(Re=>{const He=Pd(Re.target);He&&Ee(it=>it?(it.set(He,Ld(He)),new Map(it)):null)},[]);return T.useEffect(()=>{const Re=Be.current;if(ie!==Re){He(Re);const it=ie.map(Xe=>{const ot=Pd(Xe);return ot?(ot.addEventListener("scroll",Ye,{passive:!0}),[ot,Ld(ot)]):null}).filter(Xe=>Xe!=null);Ee(it.length?new Map(it):null),Be.current=ie}return()=>{He(ie),He(Re)};function He(it){it.forEach(Xe=>{const ot=Pd(Xe);ot==null||ot.removeEventListener("scroll",Ye)})}},[Ye,ie]),T.useMemo(()=>ie.length?Se?Array.from(Se.values()).reduce((Re,He)=>Xs(Re,He),Xn):c1(ie):Xn,[ie,Se])}(Oe),et=b1(Le),Qe=b1(Le,[Q]),tt=Xs(Ge,et),te=Ce?_j(Ce,Ge):null,ye=R&&te?d({active:R,collisionRect:te,droppableRects:X,droppableContainers:$,pointerCoordinates:Je}):null,ke=Dd(ye,"id"),[Me,G]=T.useState(null),ge=function(ie,Se,Ee){return{...ie,scaleX:Se&&Ee?Se.width/Ee.width:1,scaleY:Se&&Ee?Se.height/Ee.height:1}}(Ne?Ge:Xs(Ge,Qe),(r=Me==null?void 0:Me.rect)!=null?r:null,Q),_e=T.useRef(null),me=T.useCallback((ie,Se)=>{let{sensor:Ee,options:Be}=Se;if(z.current==null)return;const Ye=E.get(z.current);if(!Ye)return;const Re=ie.nativeEvent,He=new Ee({active:z.current,activeNode:Ye,event:Re,options:Be,context:pe,onAbort(Xe){if(!E.get(Xe))return;const{onDragAbort:ot}=O.current,yt={id:Xe};ot==null||ot(yt),b({type:"onDragAbort",event:yt})},onPending(Xe,ot,yt,bt){if(!E.get(Xe))return;const{onDragPending:Mt}=O.current,xt={id:Xe,constraint:ot,initialCoordinates:yt,offset:bt};Mt==null||Mt(xt),b({type:"onDragPending",event:xt})},onStart(Xe){const ot=z.current;if(ot==null)return;const yt=E.get(ot);if(!yt)return;const{onDragStart:bt}=O.current,Mt={activatorEvent:Re,active:{id:ot,data:yt.data,rect:M}};ga.unstable_batchedUpdates(()=>{bt==null||bt(Mt),k(Wo.Initializing),p({type:Ut.DragStart,initialCoordinates:Xe,active:ot}),b({type:"onDragStart",event:Mt}),F(_e.current),U(Re)})},onMove(Xe){p({type:Ut.DragMove,coordinates:Xe})},onEnd:it(Ut.DragEnd),onCancel:it(Ut.DragCancel)});function it(Xe){return async function(){const{active:ot,collisions:yt,over:bt,scrollAdjustedTranslate:Mt}=pe.current;let xt=null;if(ot&&Mt){const{cancelDrop:rn}=O.current;xt={activatorEvent:Re,active:ot,collisions:yt,delta:Mt,over:bt},Xe===Ut.DragEnd&&typeof rn=="function"&&await Promise.resolve(rn(xt))&&(Xe=Ut.DragCancel)}z.current=null,ga.unstable_batchedUpdates(()=>{p({type:Xe}),k(Wo.Uninitialized),G(null),F(null),U(null),_e.current=null;const rn=Xe===Ut.DragEnd?"onDragEnd":"onDragCancel";if(xt){const Nn=O.current[rn];Nn==null||Nn(xt),b({type:rn,event:xt})}})}}_e.current=He},[E]),le=T.useCallback((ie,Se)=>(Ee,Be)=>{const Ye=Ee.nativeEvent,Re=E.get(Be);if(z.current!==null||!Re||Ye.dndKit||Ye.defaultPrevented)return;const He={active:Re};ie(Ee,Se.options,He)===!0&&(Ye.dndKit={capturedBy:Se.sensor},z.current=Be,me(Ee,Se))},[E,me]),Ve=function(ie,Se){return T.useMemo(()=>ie.reduce((Ee,Be)=>{const{sensor:Ye}=Be;return[...Ee,...Ye.activators.map(Re=>({eventName:Re.eventName,handler:Se(Re.handler,Be)}))]},[]),[ie,Se])}(c,le);(function(ie){T.useEffect(()=>{if(!Rm)return;const Se=ie.map(Ee=>{let{sensor:Be}=Ee;return Be.setup==null?void 0:Be.setup()});return()=>{for(const Ee of Se)Ee==null||Ee()}},ie.map(Se=>{let{sensor:Ee}=Se;return Ee}))})(c),hr(()=>{Q&&x===Wo.Initializing&&k(Wo.Initialized)},[Q,x]),T.useEffect(()=>{const{onDragMove:ie}=O.current,{active:Se,activatorEvent:Ee,collisions:Be,over:Ye}=pe.current;if(!Se||!Ee)return;const Re={active:Se,activatorEvent:Ee,collisions:Be,delta:{x:tt.x,y:tt.y},over:Ye};ga.unstable_batchedUpdates(()=>{ie==null||ie(Re),b({type:"onDragMove",event:Re})})},[tt.x,tt.y]),T.useEffect(()=>{const{active:ie,activatorEvent:Se,collisions:Ee,droppableContainers:Be,scrollAdjustedTranslate:Ye}=pe.current;if(!ie||z.current==null||!Se||!Ye)return;const{onDragOver:Re}=O.current,He=Be.get(ke),it=He&&He.rect.current?{id:He.id,rect:He.rect.current,data:He.data,disabled:He.disabled}:null,Xe={active:ie,activatorEvent:Se,collisions:Ee,delta:{x:Ye.x,y:Ye.y},over:it};ga.unstable_batchedUpdates(()=>{G(it),Re==null||Re(Xe),b({type:"onDragOver",event:Xe})})},[ke]),hr(()=>{pe.current={activatorEvent:B,active:R,activeNode:ne,collisionRect:te,collisions:ye,droppableRects:X,draggableNodes:E,draggingNode:de,draggingNodeRect:Ce,droppableContainers:I,over:Me,scrollableAncestors:Oe,scrollAdjustedTranslate:tt},M.current={initial:Ce,translated:te}},[R,ne,ye,te,E,de,Ce,X,I,Me,Oe,tt]),jj({...ae,delta:N,draggingRect:te,pointerCoordinates:Je,scrollableAncestors:Oe,scrollableAncestorRects:ze});const Fe=T.useMemo(()=>({active:R,activeNode:ne,activeNodeRect:Q,activatorEvent:B,collisions:ye,containerNodeRect:he,dragOverlay:fe,draggableNodes:E,droppableContainers:I,droppableRects:X,over:Me,measureDroppableContainers:Y,scrollableAncestors:Oe,scrollableAncestorRects:ze,measuringConfiguration:j,measuringScheduled:q,windowRect:be}),[R,ne,Q,B,ye,he,fe,E,I,X,Me,Y,Oe,ze,j,q,be]),Ke=T.useMemo(()=>({activatorEvent:B,activators:Ve,active:R,activeNodeRect:Q,ariaDescribedById:{draggable:S},dispatch:p,draggableNodes:E,over:Me,measureDroppableContainers:Y}),[B,Ve,R,Q,p,S,E,Me,Y]);return J.createElement(Zg.Provider,{value:y},J.createElement(Ga.Provider,{value:Ke},J.createElement(w1.Provider,{value:Fe},J.createElement(v1.Provider,{value:ge},l)),J.createElement(Lj,{disabled:(i==null?void 0:i.restoreFocus)===!1})),J.createElement(hj,{...i,hiddenTextDescribedById:S}))}),zj=T.createContext(null),k1="button";function Bj(t){let{id:e,data:n,disabled:o=!1,attributes:r}=t;const s=fa("Draggable"),{activators:i,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:h,over:f}=T.useContext(Ga),{role:m=k1,roleDescription:_="draggable",tabIndex:g=0}=r??{},p=(l==null?void 0:l.id)===e,b=T.useContext(p?v1:zj),[y,x]=Tc(),[k,C]=Tc(),v=function(N,I){return T.useMemo(()=>N.reduce((A,M)=>{let{eventName:R,handler:z}=M;return A[R]=D=>{z(D,I)},A},{}),[N,I])}(i,e),E=ma(n);return hr(()=>(h.set(e,{id:e,key:s,node:y,activatorNode:k,data:E}),()=>{const N=h.get(e);N&&N.key===s&&h.delete(e)}),[h,e]),{active:l,activatorEvent:a,activeNodeRect:c,attributes:T.useMemo(()=>({role:m,tabIndex:g,"aria-disabled":o,"aria-pressed":!(!p||m!==k1)||void 0,"aria-roledescription":_,"aria-describedby":d.draggable}),[o,m,g,p,_,d.draggable]),isDragging:p,listeners:o?void 0:v,node:y,over:f,setNodeRef:x,setActivatorNodeRef:C,transform:b}}const Uj={timeout:25};function S1(t,e,n){const o=t.slice();return o.splice(n<0?o.length+n:n,0,o.splice(e,1)[0]),o}function Vj(t,e){return t.reduce((n,o,r)=>{const s=e.get(o);return s&&(n[r]=s),n},Array(t.length))}function Ya(t){return t!==null&&t>=0}const Ja={scaleX:1,scaleY:1},$j=t=>{var e;let{rects:n,activeNodeRect:o,activeIndex:r,overIndex:s,index:i}=t;const a=(e=n[r])!=null?e:o;if(!a)return null;const l=function(c,d,h){const f=c[d],m=c[d-1],_=c[d+1];return!f||!m&&!_?0:h<d?m?f.left-(m.left+m.width):_.left-(f.left+f.width):_?_.left-(f.left+f.width):f.left-(m.left+m.width)}(n,i,r);if(i===r){const c=n[s];return c?{x:r<s?c.left+c.width-(a.left+a.width):c.left-a.left,y:0,...Ja}:null}return i>r&&i<=s?{x:-a.width-l,y:0,...Ja}:i<r&&i>=s?{x:a.width+l,y:0,...Ja}:{x:0,y:0,...Ja}},C1=t=>{let{rects:e,activeIndex:n,overIndex:o,index:r}=t;const s=S1(e,o,n),i=e[r],a=s[r];return a&&i?{x:a.left-i.left,y:a.top-i.top,scaleX:a.width/i.width,scaleY:a.height/i.height}:null},Ka={scaleX:1,scaleY:1},Hj=t=>{var e;let{activeIndex:n,activeNodeRect:o,index:r,rects:s,overIndex:i}=t;const a=(e=s[n])!=null?e:o;if(!a)return null;if(r===n){const c=s[i];return c?{x:0,y:n<i?c.top+c.height-(a.top+a.height):c.top-a.top,...Ka}:null}const l=function(c,d,h){const f=c[d],m=c[d-1],_=c[d+1];return f?h<d?m?f.top-(m.top+m.height):_?_.top-(f.top+f.height):0:_?_.top-(f.top+f.height):m?f.top-(m.top+m.height):0:0}(s,r,n);return r>n&&r<=i?{x:0,y:-a.height-l,...Ka}:r<n&&r>=i?{x:0,y:a.height+l,...Ka}:{x:0,y:0,...Ka}},N1="Sortable",j1=J.createContext({activeIndex:-1,containerId:N1,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:C1,disabled:{draggable:!1,droppable:!1}});function E1(t){let{children:e,id:n,items:o,strategy:r=C1,disabled:s=!1}=t;const{active:i,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:d}=T.useContext(w1),h=fa(N1,n),f=a.rect!==null,m=T.useMemo(()=>o.map(v=>typeof v=="object"&&"id"in v?v.id:v),[o]),_=i!=null,g=i?m.indexOf(i.id):-1,p=c?m.indexOf(c.id):-1,b=T.useRef(m),y=!function(v,E){if(v===E)return!0;if(v.length!==E.length)return!1;for(let N=0;N<v.length;N++)if(v[N]!==E[N])return!1;return!0}(m,b.current),x=p!==-1&&g===-1||y,k=function(v){return typeof v=="boolean"?{draggable:v,droppable:v}:v}(s);hr(()=>{y&&_&&d(m)},[y,m,_,d]),T.useEffect(()=>{b.current=m},[m]);const C=T.useMemo(()=>({activeIndex:g,containerId:h,disabled:k,disableTransforms:x,items:m,overIndex:p,useDragOverlay:f,sortedRects:Vj(m,l),strategy:r}),[g,h,k.draggable,k.droppable,x,m,p,l,f,r]);return J.createElement(j1.Provider,{value:C},e)}const Wj=t=>{let{id:e,items:n,activeIndex:o,overIndex:r}=t;return S1(n,o,r).indexOf(e)},qj=t=>{let{containerId:e,isSorting:n,wasDragging:o,index:r,items:s,newIndex:i,previousItems:a,previousContainerId:l,transition:c}=t;return!(!c||!o)&&(a===s||r!==i)&&(!!n||i!==r&&e===l)},Gj={duration:200,easing:"ease"},I1="transform",Yj=Dc.Transition.toString({property:I1,duration:0,easing:"linear"}),Jj={roleDescription:"sortable"};function A1(t){let{animateLayoutChanges:e=qj,attributes:n,disabled:o,data:r,getNewIndex:s=Wj,id:i,strategy:a,resizeObserverConfig:l,transition:c=Gj}=t;const{items:d,containerId:h,activeIndex:f,disabled:m,disableTransforms:_,sortedRects:g,overIndex:p,useDragOverlay:b,strategy:y}=T.useContext(j1),x=function(ce,fe){var de,Ce;return typeof ce=="boolean"?{draggable:ce,droppable:!1}:{draggable:(de=ce==null?void 0:ce.draggable)!=null?de:fe.draggable,droppable:(Ce=ce==null?void 0:ce.droppable)!=null?Ce:fe.droppable}}(o,m),k=d.indexOf(i),C=T.useMemo(()=>({sortable:{containerId:h,index:k,items:d},...r}),[h,r,k,d]),v=T.useMemo(()=>d.slice(d.indexOf(i)),[d,i]),{rect:E,node:N,isOver:I,setNodeRef:A}=function(ce){let{data:fe,disabled:de=!1,id:Ce,resizeObserverConfig:Ne}=ce;const se=fa("Droppable"),{active:Ie,dispatch:be,over:Oe,measureDroppableContainers:ze}=T.useContext(Ga),Ge=T.useRef({disabled:de}),Je=T.useRef(!1),Le=T.useRef(null),et=T.useRef(null),{disabled:Qe,updateMeasurementsFor:tt,timeout:te}={...Uj,...Ne},ye=ma(tt??Ce),ke=Wa({callback:T.useCallback(()=>{Je.current?(et.current!=null&&clearTimeout(et.current),et.current=setTimeout(()=>{ze(Array.isArray(ye.current)?ye.current:[ye.current]),et.current=null},te)):Je.current=!0},[te]),disabled:Qe||!Ie}),Me=T.useCallback((me,le)=>{ke&&(le&&(ke.unobserve(le),Je.current=!1),me&&ke.observe(me))},[ke]),[G,ge]=Tc(Me),_e=ma(fe);return T.useEffect(()=>{ke&&G.current&&(ke.disconnect(),Je.current=!1,ke.observe(G.current))},[G,ke]),T.useEffect(()=>(be({type:Ut.RegisterDroppable,element:{id:Ce,key:se,disabled:de,node:G,rect:Le,data:_e}}),()=>be({type:Ut.UnregisterDroppable,key:se,id:Ce})),[Ce]),T.useEffect(()=>{de!==Ge.current.disabled&&(be({type:Ut.SetDroppableDisabled,id:Ce,key:se,disabled:de}),Ge.current.disabled=de)},[Ce,se,de,be]),{active:Ie,rect:Le,isOver:(Oe==null?void 0:Oe.id)===Ce,node:G,over:Oe,setNodeRef:ge}}({id:i,data:C,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:v,...l}}),{active:M,activatorEvent:R,activeNodeRect:z,attributes:D,setNodeRef:F,listeners:B,isDragging:U,over:O,setActivatorNodeRef:S,transform:$}=Bj({id:i,data:C,attributes:{...Jj,...n},disabled:x.draggable}),j=wB(A,F),W=!!M,X=W&&!_&&Ya(f)&&Ya(p),Y=!b&&U,q=Y&&X?$:null,ne=X?q??(a??y)({rects:g,activeNodeRect:z,activeIndex:f,overIndex:p,index:k}):null,re=Ya(f)&&Ya(p)?s({id:i,items:d,activeIndex:f,overIndex:p}):k,ae=M==null?void 0:M.id,Z=T.useRef({activeId:ae,items:d,newIndex:re,containerId:h}),Q=d!==Z.current.items,he=e({active:M,containerId:h,isDragging:U,isSorting:W,id:i,index:k,items:d,newIndex:Z.current.newIndex,previousItems:Z.current.items,previousContainerId:Z.current.containerId,transition:c,wasDragging:Z.current.activeId!=null}),pe=function(ce){let{disabled:fe,index:de,node:Ce,rect:Ne}=ce;const[se,Ie]=T.useState(null),be=T.useRef(de);return hr(()=>{if(!fe&&de!==be.current&&Ce.current){const Oe=Ne.current;if(Oe){const ze=Gr(Ce.current,{ignoreTransform:!0}),Ge={x:Oe.left-ze.left,y:Oe.top-ze.top,scaleX:Oe.width/ze.width,scaleY:Oe.height/ze.height};(Ge.x||Ge.y)&&Ie(Ge)}}de!==be.current&&(be.current=de)},[fe,de,Ce,Ne]),T.useEffect(()=>{se&&Ie(null)},[se]),se}({disabled:!he,index:k,node:N,rect:E});return T.useEffect(()=>{W&&Z.current.newIndex!==re&&(Z.current.newIndex=re),h!==Z.current.containerId&&(Z.current.containerId=h),d!==Z.current.items&&(Z.current.items=d)},[W,re,h,d]),T.useEffect(()=>{if(ae===Z.current.activeId)return;if(ae!=null&&Z.current.activeId==null)return void(Z.current.activeId=ae);const ce=setTimeout(()=>{Z.current.activeId=ae},50);return()=>clearTimeout(ce)},[ae]),{active:M,activeIndex:f,attributes:D,data:C,rect:E,index:k,newIndex:re,items:d,isOver:I,isSorting:W,isDragging:U,listeners:B,node:N,overIndex:p,over:O,setNodeRef:j,setActivatorNodeRef:S,setDroppableNodeRef:A,setDraggableNodeRef:F,transform:pe??ne,transition:function(){if(pe||Q&&Z.current.newIndex===k)return Yj;if(!(Y&&!Om(R)||!c)&&(W||he))return Dc.Transition.toString({...c,property:I1})}()}}function Xa(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const Kj=[lt.Down,lt.Right,lt.Up,lt.Left],Xj=(t,e)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:s,over:i,scrollableAncestors:a}}=e;if(Kj.includes(t.code)){if(t.preventDefault(),!n||!o)return;const l=[];s.getEnabled().forEach(h=>{if(!h||h!=null&&h.disabled)return;const f=r.get(h.id);if(f)switch(t.code){case lt.Down:o.top<f.top&&l.push(h);break;case lt.Up:o.top>f.top&&l.push(h);break;case lt.Left:o.left>f.left&&l.push(h);break;case lt.Right:o.left<f.left&&l.push(h)}});const c=(h=>{let{collisionRect:f,droppableRects:m,droppableContainers:_}=h;const g=Od(f),p=[];for(const b of _){const{id:y}=b,x=m.get(y);if(x){const k=Od(x),C=g.reduce((E,N,I)=>E+Td(k[I],N),0),v=Number((C/4).toFixed(4));p.push({id:y,data:{droppableContainer:b,value:v}})}}return p.sort(Md)})({collisionRect:o,droppableRects:r,droppableContainers:l});let d=Dd(c,"id");if(d===(i==null?void 0:i.id)&&c.length>1&&(d=c[1].id),d!=null){const h=s.get(n.id),f=s.get(d),m=f?r.get(f.id):null,_=f==null?void 0:f.node.current;if(_&&m&&h&&f){const g=$a(_).some((k,C)=>a[C]!==k),p=T1(h,f),b=function(k,C){return!Xa(k)||!Xa(C)||!T1(k,C)?!1:k.data.current.sortable.index<C.data.current.sortable.index}(h,f),y=g||!p?{x:0,y:0}:{x:b?o.width-m.width:0,y:b?o.height-m.height:0},x={x:m.left,y:m.top};return y.x&&y.y?x:pa(x,y)}}}};function T1(t,e){return!(!Xa(t)||!Xa(e))&&t.data.current.sortable.containerId===e.data.current.sortable.containerId}const Zj=vB("rounded-full shadow-xsSolid border p-[5px] transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 [&>svg]:size-3 active:shadow-none bg-background",{variants:{variant:{default:"hover:bg-accent hover:text-accent-foreground",stale:"bg-[var(--yellow-3)] hover:bg-[var(--yellow-4)] text-[var(--yellow-11)]",green:"hover:bg-[var(--grass-2)] hover:text-[var(--grass-11)] hover:border-[var(--grass-7)],",disabled:"opacity-50 cursor-not-allowed",danger:"hover:bg-[var(--red-3)] hover:text-[var(--red-11)]"}},defaultVariants:{variant:"default"}}),pi=t=>{const e=K.c(21);let n,o,r,s,i;e[0]!==t?({children:n,tooltip:s,disabled:r,variant:i,...o}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s,e[5]=i):(n=e[1],o=e[2],r=e[3],s=e[4],i=e[5]);const a=r!==void 0&&r;let l,c,d;e[6]!==a||e[7]!==o?(l=f=>{var m;a||((m=o.onClick)==null||m.call(o,f))},e[6]=a,e[7]=o,e[8]=l):l=e[8],e[9]!==o.className||e[10]!==i?(c=Ae(Zj({variant:i}),o.className),e[9]=o.className,e[10]=i,e[11]=c):c=e[11],e[12]!==n||e[13]!==a||e[14]!==o||e[15]!==l||e[16]!==c?(d=u.jsx("button",{disabled:a,...o,onClick:l,onMouseDown:Hn.preventFocus,className:c,children:n}),e[12]=n,e[13]=a,e[14]=o,e[15]=l,e[16]=c,e[17]=d):d=e[17];const h=d;if(s){let f;return e[18]!==h||e[19]!==s?(f=u.jsx(Te,{content:s,side:"top",delayDuration:200,usePortal:!1,children:h}),e[18]=h,e[19]=s,e[20]=f):f=e[20],f}return h},Qj=t=>{const e=K.c(5),{children:n,className:o}=t;let r,s;return e[0]!==o?(r=Ae("flex items-center gap-1 bg-background m-[2px] rounded-full",o),e[0]=o,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(s=u.jsx(tC,{className:r,children:n}),e[2]=n,e[3]=r,e[4]=s):s=e[4],s},eE=t=>{const e=K.c(9),{connectionState:n,status:o}=t,r=Xg(o==="running");let s,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=pn("global.interrupt"),e[0]=s):s=e[0],e[1]!==n||e[2]!==r?(i=Ho(n)||!r,e[1]=n,e[2]=r,e[3]=i):i=e[3];const a=r?Lm:An.NOOP,l=r?"stale":"disabled";let c,d;return e[4]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(vc,{strokeWidth:1.5}),e[4]=c):c=e[4],e[5]!==i||e[6]!==a||e[7]!==l?(d=u.jsx(pi,{tooltip:s,disabled:i,onClick:a,variant:l,"data-testid":"run-button",children:c}),e[5]=i,e[6]=a,e[7]=l,e[8]=d):d=e[8],d},Yr={showInput:"Mod-l",acceptEdit:"Mod-y",rejectEdit:"Mod-u"},gi=Zs.define({combine:t=>Rc(t,{onError:console.error,inputDebounceTime:300,keymaps:Yr},{onError:(e,n)=>e&&n,inputDebounceTime:(e,n)=>e&&n,keymaps:(e,n)=>e&&n})}),Nr=Rt.define(),jr=On.define({create:()=>({show:!1,lineFrom:0,lineTo:0}),update(t,e){for(const n of e.effects)if(n.is(Nr))return n.value;return t}}),_i=Rt.define(),bi=Rt.define(),M1=On.define({create:()=>({shouldFocus:!1,inputValue:""}),update(t,e){let n=t;for(const o of e.effects)o.is(_i)&&(n={...n,inputValue:o.value}),o.is(bi)&&(n={...n,shouldFocus:o.value});return n}}),Za=Rt.define(),yi=On.define({create:()=>null,update(t,e){for(const n of e.effects)if(n.is(Za))return n.value;return t}}),Jr=Rt.define(),O1=On.define({create:()=>!1,update(t,e){for(const n of e.effects)if(n.is(Jr))return n.value;return t}}),D1=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:[Nr.of({show:!0,lineFrom:i,lineTo:a}),bi.of(!0),_i.of("")],selection:Bo.cursor(r.from)}),!0},R1=t=>!!t.state.field(yi)&&(t.dispatch({effects:[Za.of(null),Nr.of({show:!1,lineFrom:0,lineTo:0}),bi.of(!1),_i.of(""),Jr.of(!1)]}),!0),P1=t=>{const e=t.state.field(yi);return!!e&&(t.dispatch({changes:{from:e.from,to:e.to,insert:e.oldCode},effects:[Za.of(null),Nr.of({show:!1,lineFrom:0,lineTo:0}),bi.of(!1),_i.of(""),Jr.of(!1)]}),!0)},tE=st.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"}}),nE="\u2318",oE="\u229E Win",rE="Ctrl";function qd(t){return t.replace("Mod",navigator.platform.startsWith("Mac")?nE:navigator.platform.startsWith("Win")?oE:rE).replace("-"," ").toUpperCase()}function cn(t,e){const n=document.createElement(t);return n.className=e,n}function sE(t){var r,s;const e=t.state.facet(gi),n={...Yr,...e.keymaps},o=cn("div","cm-ai-tooltip").appendChild(cn("div","cm-ai-tooltip-button"));return o.innerHTML=`<span>Edit <span class="hotkey">${qd(n.showInput)}</span></span>`,(r=o.querySelector("span"))==null||r.addEventListener("mousedown",i=>{i.stopPropagation()}),(s=o.querySelector("span"))==null||s.addEventListener("click",i=>{i.preventDefault(),D1(t)}),o}const iE=Zs.define({combine:t=>Rc(t,{render:sE})}),aE=Mn.fromClass((L3=class{constructor(t){ee(this,"view");ee(this,"suppress");ee(this,"dom");ee(this,"mousedown",()=>{this.suppress=!0});ee(this,"mouseup",()=>{this.suppress=!1,this.display(this.view)});B3(this,sc,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;this.dom.style.display="flex";const r=this.dom.getBoundingClientRect(),s=t.dom.getBoundingClientRect(),i=(n=t.dom.parentElement)==null?void 0:n.getBoundingClientRect(),a=s.width-r.width,l=Math.min(o.left,a);let c=o.top-r.height;c=i?Math.max(i.y,c):c,this.dom.style.left=`${l}px`,this.dom.style.top=`${c}px`,requestAnimationFrame(()=>{this.dom&&(this.dom.ariaHidden="false")})}else this.dom.style.display="none",this.dom.ariaHidden="true"});this.view=t;const e=t.state.facet(iE);this.suppress=!1,document.addEventListener("mousedown",this.mousedown),document.addEventListener("mouseup",this.mouseup);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){t.state.field(jr).show?this.dom.style.display="none":t.requestMeasure({read:z3(this,sc)})}destroy(){document.removeEventListener("mousedown",this.mousedown),document.removeEventListener("mouseup",this.mouseup),this.dom.remove()}},sc=new WeakMap,L3)),lE=st.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 cE extends Qs{constructor(n){super();ee(this,"oldCode");this.oldCode=n}toDOM(n){const o=cn("div","cm-old-code-container");o.setAttribute("role","region"),o.setAttribute("aria-label","Previous code version");const r=cn("div","cm-old-code cm-line");r.textContent=this.oldCode;const s=cn("div","cm-floating-buttons"),i=n.state.facet(gi),a={...Yr,...i.keymaps},l=cn("button","cm-floating-button cm-floating-accept");l.innerHTML=`<span class="hotkey">${qd(a.acceptEdit)}</span> Accept`,l.setAttribute("aria-label","Accept changes"),l.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),n.focus(),R1(n)});const c=cn("button","cm-floating-button cm-floating-reject");return c.innerHTML=`<span class="hotkey">${qd(a.rejectEdit)}</span> Reject`,c.setAttribute("aria-label","Reject changes"),c.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),n.focus(),P1(n)}),s.append(l,c),o.append(r,s),o}updateDOM(n,o){return!0}}class dE extends Qs{constructor(n){super();ee(this,"complete");ee(this,"abortController",null);ee(this,"dom",null);ee(this,"input",null);ee(this,"loadingContainer",null);ee(this,"helpInfo",null);ee(this,"inputContainer",null);ee(this,"form",null);ee(this,"view",null);ee(this,"onKeyDown",async n=>{n.key!=="Enter"||n.shiftKey?n.key==="Escape"&&this.onCancel():(n.preventDefault(),await this.handleSubmit())});ee(this,"onCancel",()=>{this.cleanup();const n=this.view;n&&(n.dispatch({effects:[Nr.of({show:!1,lineFrom:0,lineTo:0}),Jr.of(!1)]}),n.focus())});ee(this,"handleSubmit",async n=>{var g;const o=this.view;if(!o)return;const r=o.state.facet(gi);n==null||n.stopPropagation();const s=o.state.field(jr),{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),_=o.state.sliceDoc(h);this.abortController=new AbortController,o.dispatch({effects:Jr.of(!0)}),this.toggleLoading(!0);try{const p=await this.complete({prompt:a,selection:f,codeBefore:m,codeAfter:_,editorView:o,signal:this.abortController.signal});if(!o.state.field(jr).show)return;if(!p||typeof p!="string")throw new Error("Invalid completion result");o.dispatch({changes:{from:d,to:h,insert:p},effects:[Nr.of({show:!1,lineFrom:0,lineTo:0}),Za.of({from:d,to:d+p.length,oldCode:f,newCode:p}),Jr.of(!1)]})}catch(p){if(p instanceof DOMException&&p.name==="AbortError")return;(g=r.onError)==null||g.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(M1),r=n.state.field(O1),s=cn("div","cm-ai-input-container");this.inputContainer=s,this.dom=s;const i=cn("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=cn("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=cn("div","cm-ai-loading-container");this.loadingContainer=l;const c=cn("div","cm-ai-loading-indicator");c.setAttribute("role","status"),c.setAttribute("aria-live","polite"),c.textContent="Generating";const d=cn("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=cn("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=cn("button","cm-ai-generate-button");function _(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:bi.of(!1)})}),_(a.value),a.addEventListener("input",function(){n.dispatch({effects:_i.of(a.value)});const p=a.value.trim();p!==g&&(g=p,_(p))}),a.addEventListener("keydown",this.onKeyDown);let g="";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 uE(t){if(!t.prompt)throw new Error("prompt function is required");return[gi.of(t),jr,M1,yi,O1,[aE,lE],tE,Yn.of([{key:Yr.showInput,run:D1}]),Vo.highest([Yn.of([{key:Yr.acceptEdit,run:R1},{key:Yr.rejectEdit,run:P1}])]),hE,fE,mE,pE]}const hE=st.updateListener.of(t=>{const e=t.state.field(jr);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:[Nr.of({show:!0,lineFrom:n,lineTo:o})]})}),fE=st.decorations.of(t=>{const e=t.state.field(yi);return e?dt.set([dt.mark({class:"cm-new-code-line"}).range(e.from,e.to)]):dt.none}),mE=st.decorations.compute([jr],t=>{const e=t.field(jr),n=t.facet(gi),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(dt.line({class:"cm-ai-selection"}).range(a)),i===r&&o.push(dt.widget({widget:new dE(n.prompt),side:-1}).range(a))}}return dt.set(o)}),pE=On.define({create:t=>dt.none,update(t,e){const n=e.state.field(yi);return n?dt.set([dt.widget({widget:new cE(n.oldCode),block:!0}).range(n.from)]):dt.none},provide:t=>st.decorations.from(t)}),Qa=On.define({create:()=>({suggestion:null}),update(t,e){const n=e.effects.find(o=>o.is(el));return e.docChanged||n||e.selection?n&&e.state.doc===n.value.doc?{suggestion:n.value.text}:{suggestion:null}:t}}),el=Rt.define();class gE extends Qs{constructor(n){super();ee(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(`
|
103
|
+
`).length-1}}class _E{constructor(e){ee(this,"cache",new Map);ee(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 bE=(t,e)=>Mn.fromClass(class{constructor(){ee(this,"abortController",null);ee(this,"cache");this.cache=new _E(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:el.of({text:s,doc:o})});else try{const h=await t(n.state,this.abortController.signal);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:el.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()}}),yE=Mn.fromClass(class{constructor(){ee(this,"decorations");this.decorations=dt.none}update(t){var n;const e=(n=t.state.field(Qa))==null?void 0:n.suggestion;this.decorations=e?function(o,r){const s=o.state.selection.main.head,i=[],a=dt.widget({widget:new gE(r),side:1});return i.push(a.range(s)),dt.set(i)}(t.view,e):dt.none}},{decorations:t=>t.decorations});function xE(t,e,n,o){return{...t.changeByRange(r=>{if(r===t.selection.main)return{changes:{from:n,to:o,insert:e},range:Bo.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:Bo.cursor(r.from-s+e.length)}}),userEvent:"input.complete"}}const L1=t=>{var o,r,s;const e=(o=t.state.field(Qa))==null?void 0:o.suggestion;if(!e)return!1;const n=t.state.facet(Gd);return t.dispatch({effects:el.of({text:null,doc:t.state.doc})}),(s=(r=n.events)==null?void 0:r.onSuggestionRejected)==null||s.call(r,t,e),!0},wE=Yn.of([{key:"Tab",run:t=>{var o,r,s;const e=(o=t.state.field(Qa))==null?void 0:o.suggestion;if(!e)return!1;const n=t.state.facet(Gd);return t.dispatch({...xE(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:L1}]),Gd=Zs.define({combine:t=>t.at(-1)});function F1(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[Qa,Gd.of(t),bE(o,t),yE,n?wE:[]]}const z1="packages-install-input",vE=["%alias","%cd","%clear","%debug","%env","%load","%load_ext","%lsmagic","%matplotlib","%pwd","%who_ls","%system","%%time","%%timeit","%%writefile","%%capture","%%html","%%latex"];let Yd;function kE(){const t=async r=>{const s=ct.get(zm),i={...s,runtime:{...s.runtime,auto_reload:r}};await zr({config:i}).then(()=>ct.set(zm,i))},e=()=>{requestAnimationFrame(()=>{const r=document.getElementById(z1);r&&r.focus()})},n=[{match:"!pip install",onMatch:()=>{ct.set(Fm,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:u.jsxs(u.Fragment,{children:["The package manager sidebar has been opened.",u.jsx("br",{}),"Install packages directly from there instead."]})},{match:"!uv pip install",onMatch:()=>{ct.set(Fm,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:u.jsxs(u.Fragment,{children:["The package manager sidebar has been opened.",u.jsx("br",{}),"Install packages directly from there instead."]})},{match:"!uv add",onMatch:()=>{ct.set(Fm,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:u.jsxs(u.Fragment,{children:["The package manager sidebar has been opened.",u.jsx("br",{}),"Install packages directly from there instead."]})},{match:"%autoreload 2",onMatch:async()=>{await t("autorun")},title:"Module reload",description:u.jsxs(u.Fragment,{children:["Module reload mode set to ",u.jsx("b",{children:"autorun"})," - module changes will re-run the cells that import them."]})},{match:"%autoreload 1",onMatch:async()=>{await t("lazy")},title:"Module reload",description:u.jsxs(u.Fragment,{children:["Module reload mode set to ",u.jsx("b",{children:"lazy"})," - module changes will mark the cells that import them as stale."]})},{match:"%autoreload 0",onMatch:async()=>{await t("off")},title:"Module reload",description:u.jsx(u.Fragment,{children:"Module reload disabled - module changes will not be detected."})},{match:"!ls",onMatch:()=>{},title:"Listing files",description:u.jsxs(u.Fragment,{children:["Shell commands are not directly supported.",u.jsx("br",{}),"Use ",u.jsx("code",{children:"import subprocess; subprocess.run(['ls'])"})," instead."]})},...vE.map(r=>({match:r,onMatch:()=>{},title:u.jsx(O4,{className:"inline",children:r}),description:u.jsxs(u.Fragment,{children:["Magic commands are not supported in marimo. Read more about replacements in the"," ",u.jsx("a",{href:"https://docs.marimo.io/guides/coming_from/jupyter/#adapting-to-the-absence-of-magic-commands",target:"_blank",className:"text-link underline cursor-pointer",rel:"noopener noreferrer",children:"documentation"}),"."]})}))],o=new Map(n.map(r=>[r.match,r]));return st.updateListener.of(r=>{if(r.docChanged){const s=r.state.selection.main,i=r.state.doc,a=i.lineAt(s.head),l=i.sliceString(a.from,s.anchor).trim(),c=o.get(l);c&&(c.onMatch(),Yd?Yd.upsert({title:c.title,description:c.description}):Yd=ut({title:c.title,description:c.description}))}})}function SE(){const t=D4.filter(e=>e.key!=="Escape");return Vo.highest(Yn.of([...t,{key:"Escape",run:e=>{const n=fm(e);return!R4(e)&&n}}]))}const Jd=Rt.define(),Kd=Rt.define(),Xd=Rt.define();function Ct(t,e){if(!t)throw new Error(e)}function tl(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>2147483647||t<-2147483648)throw new Error("invalid int 32: "+t)}function Zd(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>4294967295||t<0)throw new Error("invalid uint 32: "+t)}function B1(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>3402823466385289e23||t<-3402823466385289e23))throw new Error("invalid float 32: "+t)}const U1=Symbol("@bufbuild/protobuf/enum-type");function CE(t){const e=t[U1];return Ct(e,"missing enum type on enum object"),e}function V1(t,e,n,o){t[U1]=$1(e,n.map(r=>({no:r.no,name:r.name,localName:t[r.no]})))}function $1(t,e,n){const o=Object.create(null),r=Object.create(null),s=[];for(const i of e){const a=H1(i);s.push(a),o[i.name]=a,r[i.no]=a}return{typeName:t,values:s,findName:i=>o[i],findNumber:i=>r[i]}}function NE(t,e,n){const o={};for(const r of e){const s=H1(r);o[s.localName]=s.no,o[s.no]=s.localName}return V1(o,t,e),o}function H1(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class Pt{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,n){const o=this.getType().runtime.bin,r=o.makeReadOptions(n);return o.readMessage(this,r.readerFactory(e),e.byteLength,r),this}fromJson(e,n){const o=this.getType(),r=o.runtime.json,s=r.makeReadOptions(n);return r.readMessage(o,e,s,this),this}fromJsonString(e,n){let o;try{o=JSON.parse(e)}catch(r){throw new Error(`cannot decode ${this.getType().typeName} from JSON: ${r instanceof Error?r.message:String(r)}`)}return this.fromJson(o,n)}toBinary(e){const n=this.getType().runtime.bin,o=n.makeWriteOptions(e),r=o.writerFactory();return n.writeMessage(this,r,o),r.finish()}toJson(e){const n=this.getType().runtime.json,o=n.makeWriteOptions(e);return n.writeMessage(this,o)}toJsonString(e){var n;const o=this.toJson(e);return JSON.stringify(o,null,(n=e==null?void 0:e.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function jE(){let t=0,e=0;for(let o=0;o<28;o+=7){let r=this.buf[this.pos++];if(t|=(127&r)<<o,!(128&r))return this.assertBounds(),[t,e]}let n=this.buf[this.pos++];if(t|=(15&n)<<28,e=(112&n)>>4,!(128&n))return this.assertBounds(),[t,e];for(let o=3;o<=31;o+=7){let r=this.buf[this.pos++];if(e|=(127&r)<<o,!(128&r))return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function Qd(t,e,n){for(let s=0;s<28;s+=7){const i=t>>>s,a=!(!(i>>>7)&&e==0),l=255&(a?128|i:i);if(n.push(l),!a)return}const o=t>>>28&15|(7&e)<<4,r=!!(e>>3);if(n.push(255&(r?128|o:o)),r){for(let s=3;s<31;s+=7){const i=e>>>s,a=!!(i>>>7),l=255&(a?128|i:i);if(n.push(l),!a)return}n.push(e>>>31&1)}}const nl=4294967296;function W1(t){const e=t[0]==="-";e&&(t=t.slice(1));const n=1e6;let o=0,r=0;function s(i,a){const l=Number(t.slice(i,a));r*=n,o=o*n+l,o>=nl&&(r+=o/nl|0,o%=nl)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),e?G1(o,r):eu(o,r)}function q1(t,e){if({lo:t,hi:e}=function(l,c){return{lo:l>>>0,hi:c>>>0}}(t,e),e<=2097151)return String(nl*e+t);const n=16777215&(t>>>24|e<<8),o=e>>16&65535;let r=(16777215&t)+6777216*n+6710656*o,s=n+8147497*o,i=2*o;const a=1e7;return r>=a&&(s+=Math.floor(r/a),r%=a),s>=a&&(i+=Math.floor(s/a),s%=a),i.toString()+Y1(s)+Y1(r)}function eu(t,e){return{lo:0|t,hi:0|e}}function G1(t,e){return e=~e,t?t=1+~t:e+=1,eu(t,e)}const Y1=t=>{const e=String(t);return"0000000".slice(e.length)+e};function J1(t,e){if(t>=0){for(;t>127;)e.push(127&t|128),t>>>=7;e.push(t)}else{for(let n=0;n<9;n++)e.push(127&t|128),t>>=7;e.push(1)}}function EE(){let t=this.buf[this.pos++],e=127&t;if(!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<7,!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<14,!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<21,!(128&t))return this.assertBounds(),e;t=this.buf[this.pos++],e|=(15&t)<<28;for(let n=5;128&t&&n<10;n++)t=this.buf[this.pos++];if(128&t)throw new Error("invalid varint");return this.assertBounds(),e>>>0}var IE={};const vt=function(){const t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(typeof process!="object"||IE.BUF_BIGINT_DISABLE!=="1")){const o=BigInt("-9223372036854775808"),r=BigInt("9223372036854775807"),s=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(a){const l=typeof a=="bigint"?a:BigInt(a);if(l>r||l<o)throw new Error(`int64 invalid: ${a}`);return l},uParse(a){const l=typeof a=="bigint"?a:BigInt(a);if(l>i||l<s)throw new Error(`uint64 invalid: ${a}`);return l},enc(a){return t.setBigInt64(0,this.parse(a),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(a){return t.setBigInt64(0,this.uParse(a),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec:(a,l)=>(t.setInt32(0,a,!0),t.setInt32(4,l,!0),t.getBigInt64(0,!0)),uDec:(a,l)=>(t.setInt32(0,a,!0),t.setInt32(4,l,!0),t.getBigUint64(0,!0))}}const e=o=>Ct(/^-?[0-9]+$/.test(o),`int64 invalid: ${o}`),n=o=>Ct(/^[0-9]+$/.test(o),`uint64 invalid: ${o}`);return{zero:"0",supported:!1,parse:o=>(typeof o!="string"&&(o=o.toString()),e(o),o),uParse:o=>(typeof o!="string"&&(o=o.toString()),n(o),o),enc:o=>(typeof o!="string"&&(o=o.toString()),e(o),W1(o)),uEnc:o=>(typeof o!="string"&&(o=o.toString()),n(o),W1(o)),dec:(o,r)=>function(s,i){let a=eu(s,i);const l=2147483648&a.hi;l&&(a=G1(a.lo,a.hi));const c=q1(a.lo,a.hi);return l?"-"+c:c}(o,r),uDec:(o,r)=>q1(o,r)}}();var ue,qo,It;function Go(t,e,n){if(e===n)return!0;if(t==ue.BYTES){if(!(e instanceof Uint8Array&&n instanceof Uint8Array)||e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(e[o]!==n[o])return!1;return!0}switch(t){case ue.UINT64:case ue.FIXED64:case ue.INT64:case ue.SFIXED64:case ue.SINT64:return e==n}return!1}function Kr(t,e){switch(t){case ue.BOOL:return!1;case ue.UINT64:case ue.FIXED64:case ue.INT64:case ue.SFIXED64:case ue.SINT64:return e==0?vt.zero:"0";case ue.DOUBLE:case ue.FLOAT:return 0;case ue.BYTES:return new Uint8Array(0);case ue.STRING:return"";default:return 0}}function K1(t,e){switch(t){case ue.BOOL:return e===!1;case ue.STRING:return e==="";case ue.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(ue||(ue={})),function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"}(qo||(qo={})),function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"}(It||(It={}));class AE{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let r=0;r<this.chunks.length;r++)e+=this.chunks[r].length;let n=new Uint8Array(e),o=0;for(let r=0;r<this.chunks.length;r++)n.set(this.chunks[r],o),o+=this.chunks[r].length;return this.chunks=[],n}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),n=this.stack.pop();if(!n)throw new Error("invalid state, fork stack empty");return this.chunks=n.chunks,this.buf=n.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,n){return this.uint32((e<<3|n)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(Zd(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return tl(e),J1(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let n=this.textEncoder.encode(e);return this.uint32(n.byteLength),this.raw(n)}float(e){B1(e);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,e,!0),this.raw(n)}double(e){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,e,!0),this.raw(n)}fixed32(e){Zd(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){tl(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return tl(e),J1(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let n=new Uint8Array(8),o=new DataView(n.buffer),r=vt.enc(e);return o.setInt32(0,r.lo,!0),o.setInt32(4,r.hi,!0),this.raw(n)}fixed64(e){let n=new Uint8Array(8),o=new DataView(n.buffer),r=vt.uEnc(e);return o.setInt32(0,r.lo,!0),o.setInt32(4,r.hi,!0),this.raw(n)}int64(e){let n=vt.enc(e);return Qd(n.lo,n.hi,this.buf),this}sint64(e){let n=vt.enc(e),o=n.hi>>31;return Qd(n.lo<<1^o,(n.hi<<1|n.lo>>>31)^o,this.buf),this}uint64(e){let n=vt.uEnc(e);return Qd(n.lo,n.hi,this.buf),this}}class TE{constructor(e,n){this.varint64=jE,this.uint32=EE,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=n??new TextDecoder}tag(){let e=this.uint32(),n=e>>>3,o=7&e;if(n<=0||o<0||o>5)throw new Error("illegal tag: field no "+n+" wire type "+o);return[n,o]}skip(e,n){let o=this.pos;switch(e){case It.Varint:for(;128&this.buf[this.pos++];);break;case It.Bit64:this.pos+=4;case It.Bit32:this.pos+=4;break;case It.LengthDelimited:let r=this.uint32();this.pos+=r;break;case It.StartGroup:for(;;){const[s,i]=this.tag();if(i===It.EndGroup){if(n!==void 0&&s!==n)throw new Error("invalid end group tag");break}this.skip(i,s)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return vt.dec(...this.varint64())}uint64(){return vt.uDec(...this.varint64())}sint64(){let[e,n]=this.varint64(),o=-(1&e);return e=(e>>>1|(1&n)<<31)^o,n=n>>>1^o,vt.dec(e,n)}bool(){let[e,n]=this.varint64();return e!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return vt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return vt.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),n=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(n,n+e)}string(){return this.textDecoder.decode(this.bytes())}}function X1(t){const e=t.field.localName,n=Object.create(null);return n[e]=function(o){const r=o.field;if(r.repeated)return[];if(r.default!==void 0)return r.default;switch(r.kind){case"enum":return r.T.values[0].no;case"scalar":return Kr(r.T,r.L);case"message":const s=r.T,i=new s;return s.fieldWrapper?s.fieldWrapper.unwrapField(i):i;case"map":throw"map fields are not allowed to be extensions"}}(t),[n,()=>n[e]]}let yo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),ol=[];for(let t=0;t<yo.length;t++)ol[yo[t].charCodeAt(0)]=t;ol[45]=yo.indexOf("+"),ol[95]=yo.indexOf("/");const rl={dec(t){let e=3*t.length/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let n,o=new Uint8Array(e),r=0,s=0,i=0;for(let a=0;a<t.length;a++){if(n=ol[t.charCodeAt(a)],n===void 0)switch(t[a]){case"=":s=0;case`
|
104
|
+
`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(s){case 0:i=n,s=1;break;case 1:o[r++]=i<<2|(48&n)>>4,i=n,s=2;break;case 2:o[r++]=(15&i)<<4|(60&n)>>2,i=n,s=3;break;case 3:o[r++]=(3&i)<<6|n,s=0}}if(s==1)throw Error("invalid base64 string.");return o.subarray(0,r)},enc(t){let e,n="",o=0,r=0;for(let s=0;s<t.length;s++)switch(e=t[s],o){case 0:n+=yo[e>>2],r=(3&e)<<4,o=1;break;case 1:n+=yo[r|e>>4],r=(15&e)<<2,o=2;break;case 2:n+=yo[r|e>>6],n+=yo[63&e],o=0}return o&&(n+=yo[r],n+="=",o==1&&(n+="=")),n}};function ME(t,e,n){Q1(e,t);const o=e.runtime.bin.makeReadOptions(n),r=function(a,l){if(!l.repeated&&(l.kind=="enum"||l.kind=="scalar")){for(let c=a.length-1;c>=0;--c)if(a[c].no==l.no)return[a[c]];return[]}return a.filter(c=>c.no===l.no)}(t.getType().runtime.bin.listUnknownFields(t),e.field),[s,i]=X1(e);for(const a of r)e.runtime.bin.readField(s,o.readerFactory(a.data),e.field,a.wireType,o);return i()}function OE(t,e,n,o){Q1(e,t);const r=e.runtime.bin.makeReadOptions(o),s=e.runtime.bin.makeWriteOptions(o);if(Z1(t,e)){const c=t.getType().runtime.bin.listUnknownFields(t).filter(d=>d.no!=e.field.no);t.getType().runtime.bin.discardUnknownFields(t);for(const d of c)t.getType().runtime.bin.onUnknownField(t,d.no,d.wireType,d.data)}const i=s.writerFactory();let a=e.field;a.opt||a.repeated||a.kind!="enum"&&a.kind!="scalar"||(a=Object.assign(Object.assign({},e.field),{opt:!0})),e.runtime.bin.writeField(a,n,i,s);const l=r.readerFactory(i.finish());for(;l.pos<l.len;){const[c,d]=l.tag(),h=l.skip(d,c);t.getType().runtime.bin.onUnknownField(t,c,d,h)}}function Z1(t,e){const n=t.getType();return e.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(t).find(o=>o.no==e.field.no)}function Q1(t,e){Ct(t.extendee.typeName==e.getType().typeName,`extension ${t.typeName} can only be applied to message ${t.extendee.typeName}`)}function e_(t,e){const n=t.localName;if(t.repeated)return e[n].length>0;if(t.oneof)return e[t.oneof.localName].case===n;switch(t.kind){case"enum":case"scalar":return t.opt||t.req?e[n]!==void 0:t.kind=="enum"?e[n]!==t.T.values[0].no:!K1(t.T,e[n]);case"message":return e[n]!==void 0;case"map":return Object.keys(e[n]).length>0}}function t_(t,e){const n=t.localName,o=!t.opt&&!t.req;if(t.repeated)e[n]=[];else if(t.oneof)e[t.oneof.localName]={case:void 0};else switch(t.kind){case"map":e[n]={};break;case"enum":e[n]=o?t.T.values[0].no:void 0;break;case"scalar":e[n]=o?Kr(t.T,t.L):void 0;break;case"message":e[n]=void 0}}function Er(t,e){if(t===null||typeof t!="object"||!Object.getOwnPropertyNames(Pt.prototype).every(o=>o in t&&typeof t[o]=="function"))return!1;const n=t.getType();return n!==null&&typeof n=="function"&&"typeName"in n&&typeof n.typeName=="string"&&(e===void 0||n.typeName==e.typeName)}function n_(t,e){return Er(e)||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}ue.DOUBLE,ue.FLOAT,ue.INT64,ue.UINT64,ue.INT32,ue.UINT32,ue.BOOL,ue.STRING,ue.BYTES;const o_={ignoreUnknownFields:!1},r_={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function DE(t){return t?Object.assign(Object.assign({},o_),t):o_}function RE(t){return t?Object.assign(Object.assign({},r_),t):r_}const sl=Symbol(),il=Symbol();function so(t){if(t===null)return"null";switch(typeof t){case"object":return Array.isArray(t)?"array":"object";case"string":return t.length>100?"string":`"${t.split('"').join('\\"')}"`;default:return String(t)}}function s_(t,e,n,o,r){let s=n.localName;if(n.repeated){if(Ct(n.kind!="map"),e===null)return;if(!Array.isArray(e))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${so(e)}`);const i=t[s];for(const a of e){if(a===null)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${so(a)}`);switch(n.kind){case"message":i.push(n.T.fromJson(a,o));break;case"enum":const l=tu(n.T,a,o.ignoreUnknownFields,!0);l!==il&&i.push(l);break;case"scalar":try{i.push(xi(n.T,a,n.L,!0))}catch(c){let d=`cannot decode field ${r.typeName}.${n.name} from JSON: ${so(a)}`;throw c instanceof Error&&c.message.length>0&&(d+=`: ${c.message}`),new Error(d)}}}}else if(n.kind=="map"){if(e===null)return;if(typeof e!="object"||Array.isArray(e))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${so(e)}`);const i=t[s];for(const[a,l]of Object.entries(e)){if(l===null)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: map value null`);let c;try{c=PE(n.K,a)}catch(d){let h=`cannot decode map key for field ${r.typeName}.${n.name} from JSON: ${so(e)}`;throw d instanceof Error&&d.message.length>0&&(h+=`: ${d.message}`),new Error(h)}switch(n.V.kind){case"message":i[c]=n.V.T.fromJson(l,o);break;case"enum":const d=tu(n.V.T,l,o.ignoreUnknownFields,!0);d!==il&&(i[c]=d);break;case"scalar":try{i[c]=xi(n.V.T,l,qo.BIGINT,!0)}catch(h){let f=`cannot decode map value for field ${r.typeName}.${n.name} from JSON: ${so(e)}`;throw h instanceof Error&&h.message.length>0&&(f+=`: ${h.message}`),new Error(f)}}}}else switch(n.oneof&&(t=t[n.oneof.localName]={case:s},s="value"),n.kind){case"message":const i=n.T;if(e===null&&i.typeName!="google.protobuf.Value")return;let a=t[s];Er(a)?a.fromJson(e,o):(t[s]=a=i.fromJson(e,o),i.fieldWrapper&&!n.oneof&&(t[s]=i.fieldWrapper.unwrapField(a)));break;case"enum":const l=tu(n.T,e,o.ignoreUnknownFields,!1);switch(l){case sl:t_(n,t);break;case il:break;default:t[s]=l}break;case"scalar":try{const c=xi(n.T,e,n.L,!1);c===sl?t_(n,t):t[s]=c}catch(c){let d=`cannot decode field ${r.typeName}.${n.name} from JSON: ${so(e)}`;throw c instanceof Error&&c.message.length>0&&(d+=`: ${c.message}`),new Error(d)}}}function PE(t,e){if(t===ue.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1}return xi(t,e,qo.BIGINT,!0).toString()}function xi(t,e,n,o){if(e===null)return o?Kr(t,n):sl;switch(t){case ue.DOUBLE:case ue.FLOAT:if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""||typeof e=="string"&&e.trim().length!==e.length||typeof e!="string"&&typeof e!="number")break;const r=Number(e);if(Number.isNaN(r)||!Number.isFinite(r))break;return t==ue.FLOAT&&B1(r),r;case ue.INT32:case ue.FIXED32:case ue.SFIXED32:case ue.SINT32:case ue.UINT32:let s;if(typeof e=="number"?s=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(s=Number(e)),s===void 0)break;return t==ue.UINT32||t==ue.FIXED32?Zd(s):tl(s),s;case ue.INT64:case ue.SFIXED64:case ue.SINT64:if(typeof e!="number"&&typeof e!="string")break;const i=vt.parse(e);return n?i.toString():i;case ue.FIXED64:case ue.UINT64:if(typeof e!="number"&&typeof e!="string")break;const a=vt.uParse(e);return n?a.toString():a;case ue.BOOL:if(typeof e!="boolean")break;return e;case ue.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case ue.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return rl.dec(e)}throw new Error}function tu(t,e,n,o){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:o?t.values[0].no:sl;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":const r=t.findName(e);if(r!==void 0)return r.no;if(n)return il}throw new Error(`cannot decode enum ${t.typeName} from JSON: ${so(e)}`)}function LE(t){return!(!t.repeated&&t.kind!="map")||!t.oneof&&t.kind!="message"&&!t.opt&&!t.req}function i_(t,e,n){if(t.kind=="map"){Ct(typeof e=="object"&&e!=null);const o={},r=Object.entries(e);switch(t.V.kind){case"scalar":for(const[i,a]of r)o[i.toString()]=al(t.V.T,a);break;case"message":for(const[i,a]of r)o[i.toString()]=a.toJson(n);break;case"enum":const s=t.V.T;for(const[i,a]of r)o[i.toString()]=nu(s,a,n.enumAsInteger)}return n.emitDefaultValues||r.length>0?o:void 0}if(t.repeated){Ct(Array.isArray(e));const o=[];switch(t.kind){case"scalar":for(let r=0;r<e.length;r++)o.push(al(t.T,e[r]));break;case"enum":for(let r=0;r<e.length;r++)o.push(nu(t.T,e[r],n.enumAsInteger));break;case"message":for(let r=0;r<e.length;r++)o.push(e[r].toJson(n))}return n.emitDefaultValues||o.length>0?o:void 0}switch(t.kind){case"scalar":return al(t.T,e);case"enum":return nu(t.T,e,n.enumAsInteger);case"message":return n_(t.T,e).toJson(n)}}function nu(t,e,n){var o;if(Ct(typeof e=="number"),t.typeName=="google.protobuf.NullValue")return null;if(n)return e;const r=t.findNumber(e);return(o=r==null?void 0:r.name)!==null&&o!==void 0?o:e}function al(t,e){switch(t){case ue.INT32:case ue.SFIXED32:case ue.SINT32:case ue.FIXED32:case ue.UINT32:return Ct(typeof e=="number"),e;case ue.FLOAT:case ue.DOUBLE:return Ct(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case ue.STRING:return Ct(typeof e=="string"),e;case ue.BOOL:return Ct(typeof e=="boolean"),e;case ue.UINT64:case ue.FIXED64:case ue.INT64:case ue.SFIXED64:case ue.SINT64:return Ct(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case ue.BYTES:return Ct(e instanceof Uint8Array),rl.enc(e)}}const Xr=Symbol("@bufbuild/protobuf/unknown-fields"),a_={readUnknownFields:!0,readerFactory:t=>new TE(t)},l_={writeUnknownFields:!0,writerFactory:()=>new AE};function FE(t){return t?Object.assign(Object.assign({},a_),t):a_}function zE(t){return t?Object.assign(Object.assign({},l_),t):l_}function c_(t,e,n,o,r){let{repeated:s,localName:i}=n;switch(n.oneof&&((t=t[n.oneof.localName]).case!=i&&delete t.value,t.case=i,i="value"),n.kind){case"scalar":case"enum":const a=n.kind=="enum"?ue.INT32:n.T;let l=cl;if(n.kind=="scalar"&&n.L>0&&(l=BE),s){let f=t[i];if(o==It.LengthDelimited&&a!=ue.STRING&&a!=ue.BYTES){let m=e.uint32()+e.pos;for(;e.pos<m;)f.push(l(e,a))}else f.push(l(e,a))}else t[i]=l(e,a);break;case"message":const c=n.T;s?t[i].push(ll(e,new c,r,n)):Er(t[i])?ll(e,t[i],r,n):(t[i]=ll(e,new c,r,n),!c.fieldWrapper||n.oneof||n.repeated||(t[i]=c.fieldWrapper.unwrapField(t[i])));break;case"map":let[d,h]=function(f,m,_){const g=m.uint32(),p=m.pos+g;let b,y;for(;m.pos<p;){const[x]=m.tag();switch(x){case 1:b=cl(m,f.K);break;case 2:switch(f.V.kind){case"scalar":y=cl(m,f.V.T);break;case"enum":y=m.int32();break;case"message":y=ll(m,new f.V.T,_,void 0)}}}if(b===void 0&&(b=Kr(f.K,qo.BIGINT)),typeof b!="string"&&typeof b!="number"&&(b=b.toString()),y===void 0)switch(f.V.kind){case"scalar":y=Kr(f.V.T,qo.BIGINT);break;case"enum":y=f.V.T.values[0].no;break;case"message":y=new f.V.T}return[b,y]}(n,e,r);t[i][d]=h}}function ll(t,e,n,o){const r=e.getType().runtime.bin,s=o==null?void 0:o.delimited;return r.readMessage(e,t,s?o.no:t.uint32(),n,s),e}function BE(t,e){const n=cl(t,e);return typeof n=="bigint"?n.toString():n}function cl(t,e){switch(e){case ue.STRING:return t.string();case ue.BOOL:return t.bool();case ue.DOUBLE:return t.double();case ue.FLOAT:return t.float();case ue.INT32:return t.int32();case ue.INT64:return t.int64();case ue.UINT64:return t.uint64();case ue.FIXED64:return t.fixed64();case ue.BYTES:return t.bytes();case ue.FIXED32:return t.fixed32();case ue.SFIXED32:return t.sfixed32();case ue.SFIXED64:return t.sfixed64();case ue.SINT64:return t.sint64();case ue.UINT32:return t.uint32();case ue.SINT32:return t.sint32()}}function d_(t,e,n,o){Ct(e!==void 0);const r=t.repeated;switch(t.kind){case"scalar":case"enum":let s=t.kind=="enum"?ue.INT32:t.T;if(r)if(Ct(Array.isArray(e)),t.packed)(function(i,a,l,c){if(!c.length)return;i.tag(l,It.LengthDelimited).fork();let[,d]=h_(a);for(let h=0;h<c.length;h++)i[d](c[h]);i.join()})(n,s,t.no,e);else for(const i of e)wi(n,s,t.no,i);else wi(n,s,t.no,e);break;case"message":if(r){Ct(Array.isArray(e));for(const i of e)u_(n,o,t,i)}else u_(n,o,t,e);break;case"map":Ct(typeof e=="object"&&e!=null);for(const[i,a]of Object.entries(e))UE(n,o,t,i,a)}}function UE(t,e,n,o,r){t.tag(n.no,It.LengthDelimited),t.fork();let s=o;switch(n.K){case ue.INT32:case ue.FIXED32:case ue.UINT32:case ue.SFIXED32:case ue.SINT32:s=Number.parseInt(o);break;case ue.BOOL:Ct(o=="true"||o=="false"),s=o=="true"}switch(wi(t,n.K,1,s),n.V.kind){case"scalar":wi(t,n.V.T,2,r);break;case"enum":wi(t,ue.INT32,2,r);break;case"message":Ct(r!==void 0),t.tag(2,It.LengthDelimited).bytes(r.toBinary(e))}t.join()}function u_(t,e,n,o){const r=n_(n.T,o);n.delimited?t.tag(n.no,It.StartGroup).raw(r.toBinary(e)).tag(n.no,It.EndGroup):t.tag(n.no,It.LengthDelimited).bytes(r.toBinary(e))}function wi(t,e,n,o){Ct(o!==void 0);let[r,s]=h_(e);t.tag(n,r)[s](o)}function h_(t){let e=It.Varint;switch(t){case ue.BYTES:case ue.STRING:e=It.LengthDelimited;break;case ue.DOUBLE:case ue.FIXED64:case ue.SFIXED64:e=It.Bit64;break;case ue.FIXED32:case ue.SFIXED32:case ue.FLOAT:e=It.Bit32}return[e,ue[t].toLowerCase()]}function dl(t){if(t===void 0)return t;if(Er(t))return t.clone();if(t instanceof Uint8Array){const e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function vi(t){return t instanceof Uint8Array?t:new Uint8Array(t)}class VE{constructor(e,n){this._fields=e,this._normalizer=n}findJsonName(e){if(!this.jsonNames){const n={};for(const o of this.list())n[o.jsonName]=n[o.name]=o;this.jsonNames=n}return this.jsonNames[e]}find(e){if(!this.numbers){const n={};for(const o of this.list())n[o.no]=o;this.numbers=n}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,n)=>e.no-n.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let n;for(const o of this.list())o.oneof?o.oneof!==n&&(n=o.oneof,e.push(n)):e.push(o)}return this.members}}function f_(t,e){const n=m_(t);return e?n:GE(qE(n))}const $E=m_;function m_(t){let e=!1;const n=[];for(let o=0;o<t.length;o++){let r=t.charAt(o);switch(r){case"_":e=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n.push(r),e=!1;break;default:e&&(e=!1,r=r.toUpperCase()),n.push(r)}}return n.join("")}const HE=new Set(["constructor","toString","toJSON","valueOf"]),WE=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),p_=t=>`${t}$`,qE=t=>WE.has(t)?p_(t):t,GE=t=>HE.has(t)?p_(t):t;class YE{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=f_(e,!1)}addField(e){Ct(e.oneof===this,`field ${e.name} not one of ${this.name}`),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let n=0;n<this.fields.length;n++)this._lookup[this.fields[n].localName]=this.fields[n]}return this._lookup[e]}}const ve=(g_=t=>new VE(t,e=>function(n){var o,r,s,i,a,l;const c=[];let d;for(const h of typeof n=="function"?n():n){const f=h;if(f.localName=f_(h.name,h.oneof!==void 0),f.jsonName=(o=h.jsonName)!==null&&o!==void 0?o:$E(h.name),f.repeated=(r=h.repeated)!==null&&r!==void 0&&r,h.kind=="scalar"&&(f.L=(s=h.L)!==null&&s!==void 0?s:qo.BIGINT),f.delimited=(i=h.delimited)!==null&&i!==void 0&&i,f.req=(a=h.req)!==null&&a!==void 0&&a,f.opt=(l=h.opt)!==null&&l!==void 0&&l,h.packed===void 0&&(f.packed=h.kind=="enum"||h.kind=="scalar"&&h.T!=ue.BYTES&&h.T!=ue.STRING),h.oneof!==void 0){const m=typeof h.oneof=="string"?h.oneof:h.oneof.name;d&&d.name==m||(d=new YE(m)),f.oneof=d,d.addField(f)}c.push(f)}return c}(e)),__=t=>{for(const e of t.getType().fields.byMember()){if(e.opt)continue;const n=e.localName,o=t;if(e.repeated)o[n]=[];else switch(e.kind){case"oneof":o[n]={case:void 0};break;case"enum":o[n]=0;break;case"map":o[n]={};break;case"scalar":o[n]=Kr(e.T,e.L)}}},{syntax:"proto3",json:{makeReadOptions:DE,makeWriteOptions:RE,readMessage(t,e,n,o){if(e==null||Array.isArray(e)||typeof e!="object")throw new Error(`cannot decode message ${t.typeName} from JSON: ${so(e)}`);o=o??new t;const r=new Map,s=n.typeRegistry;for(const[i,a]of Object.entries(e)){const l=t.fields.findJsonName(i);if(l){if(l.oneof){if(a===null&&l.kind=="scalar")continue;const c=r.get(l.oneof);if(c!==void 0)throw new Error(`cannot decode message ${t.typeName} from JSON: multiple keys for oneof "${l.oneof.name}" present: "${c}", "${i}"`);r.set(l.oneof,i)}s_(o,a,l,n,t)}else{let c=!1;if(s!=null&&s.findExtension&&i.startsWith("[")&&i.endsWith("]")){const d=s.findExtension(i.substring(1,i.length-1));if(d&&d.extendee.typeName==t.typeName){c=!0;const[h,f]=X1(d);s_(h,a,d.field,n,d),OE(o,d,f(),n)}}if(!c&&!n.ignoreUnknownFields)throw new Error(`cannot decode message ${t.typeName} from JSON: key "${i}" is unknown`)}}return o},writeMessage(t,e){const n=t.getType(),o={};let r;try{for(r of n.fields.byNumber()){if(!e_(r,t)){if(r.req)throw"required field not set";if(!e.emitDefaultValues||!LE(r))continue}const i=i_(r,r.oneof?t[r.oneof.localName].value:t[r.localName],e);i!==void 0&&(o[e.useProtoFieldName?r.name:r.jsonName]=i)}const s=e.typeRegistry;if(s!=null&&s.findExtensionFor)for(const i of n.runtime.bin.listUnknownFields(t)){const a=s.findExtensionFor(n.typeName,i.no);if(a&&Z1(t,a)){const l=ME(t,a,e),c=i_(a.field,l,e);c!==void 0&&(o[a.field.jsonName]=c)}}}catch(s){const i=r?`cannot encode field ${n.typeName}.${r.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,a=s instanceof Error?s.message:String(s);throw new Error(i+(a.length>0?`: ${a}`:""))}return o},readScalar:(t,e,n)=>xi(t,e,n??qo.BIGINT,!0),writeScalar(t,e,n){if(e!==void 0)return n||K1(t,e)?al(t,e):void 0},debug:so},bin:{makeReadOptions:FE,makeWriteOptions:zE,listUnknownFields(t){var e;return(e=t[Xr])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[Xr]},writeUnknownFields(t,e){const n=t[Xr];if(n)for(const o of n)e.tag(o.no,o.wireType).raw(o.data)},onUnknownField(t,e,n,o){const r=t;Array.isArray(r[Xr])||(r[Xr]=[]),r[Xr].push({no:e,wireType:n,data:o})},readMessage(t,e,n,o,r){const s=t.getType(),i=r?e.len:e.pos+n;let a,l;for(;e.pos<i&&([a,l]=e.tag(),r!==!0||l!=It.EndGroup);){const c=s.fields.find(a);if(!c){const d=e.skip(l,a);o.readUnknownFields&&this.onUnknownField(t,a,l,d);continue}c_(t,e,c,l,o)}if(r&&(l!=It.EndGroup||a!==n))throw new Error("invalid end group tag")},readField:c_,writeMessage(t,e,n){const o=t.getType();for(const r of o.fields.byNumber())if(e_(r,t))d_(r,r.oneof?t[r.oneof.localName].value:t[r.localName],e,n);else if(r.req)throw new Error(`cannot encode field ${o.typeName}.${r.name} to binary: required field not set`);return n.writeUnknownFields&&this.writeUnknownFields(t,e),e},writeField(t,e,n,o){e!==void 0&&d_(t,e,n,o)}},util:Object.assign(Object.assign({},{setEnumType:V1,initPartial(t,e){if(t===void 0)return;const n=e.getType();for(const o of n.fields.byMember()){const r=o.localName,s=e,i=t;if(i[r]!=null)switch(o.kind){case"oneof":const a=i[r].case;if(a===void 0)continue;const l=o.findField(a);let c=i[r].value;l&&l.kind=="message"&&!Er(c,l.T)?c=new l.T(c):l&&l.kind==="scalar"&&l.T===ue.BYTES&&(c=vi(c)),s[r]={case:a,value:c};break;case"scalar":case"enum":let d=i[r];o.T===ue.BYTES&&(d=o.repeated?d.map(vi):vi(d)),s[r]=d;break;case"map":switch(o.V.kind){case"scalar":case"enum":if(o.V.T===ue.BYTES)for(const[m,_]of Object.entries(i[r]))s[r][m]=vi(_);else Object.assign(s[r],i[r]);break;case"message":const f=o.V.T;for(const m of Object.keys(i[r])){let _=i[r][m];f.fieldWrapper||(_=new f(_)),s[r][m]=_}}break;case"message":const h=o.T;if(o.repeated)s[r]=i[r].map(f=>Er(f,h)?f:new h(f));else{const f=i[r];h.fieldWrapper?h.typeName==="google.protobuf.BytesValue"?s[r]=vi(f):s[r]=f:s[r]=Er(f,h)?f:new h(f)}}}},equals:(t,e,n)=>e===n||!(!e||!n)&&t.fields.byMember().every(o=>{const r=e[o.localName],s=n[o.localName];if(o.repeated){if(r.length!==s.length)return!1;switch(o.kind){case"message":return r.every((i,a)=>o.T.equals(i,s[a]));case"scalar":return r.every((i,a)=>Go(o.T,i,s[a]));case"enum":return r.every((i,a)=>Go(ue.INT32,i,s[a]))}throw new Error(`repeated cannot contain ${o.kind}`)}switch(o.kind){case"message":return o.T.equals(r,s);case"enum":return Go(ue.INT32,r,s);case"scalar":return Go(o.T,r,s);case"oneof":if(r.case!==s.case)return!1;const i=o.findField(r.case);if(i===void 0)return!0;switch(i.kind){case"message":return i.T.equals(r.value,s.value);case"enum":return Go(ue.INT32,r.value,s.value);case"scalar":return Go(i.T,r.value,s.value)}throw new Error(`oneof cannot contain ${i.kind}`);case"map":const a=Object.keys(r).concat(Object.keys(s));switch(o.V.kind){case"message":const l=o.V.T;return a.every(d=>l.equals(r[d],s[d]));case"enum":return a.every(d=>Go(ue.INT32,r[d],s[d]));case"scalar":const c=o.V.T;return a.every(d=>Go(c,r[d],s[d]))}}}),clone(t){const e=t.getType(),n=new e,o=n;for(const r of e.fields.byMember()){const s=t[r.localName];let i;if(r.repeated)i=s.map(dl);else if(r.kind=="map"){i=o[r.localName];for(const[a,l]of Object.entries(s))i[a]=dl(l)}else i=r.kind=="oneof"?r.findField(s.case)?{case:s.case,value:dl(s.value)}:{case:void 0}:dl(s);o[r.localName]=i}for(const r of e.runtime.bin.listUnknownFields(t))e.runtime.bin.onUnknownField(o,r.no,r.wireType,r.data);return n}}),{newFieldList:g_,initFields:__}),makeMessageType(t,e,n){return function(o,r,s,i){var a;const l=(a=i==null?void 0:i.localName)!==null&&a!==void 0?a:r.substring(r.lastIndexOf(".")+1),c={[l]:function(d){o.util.initFields(this),o.util.initPartial(d,this)}}[l];return Object.setPrototypeOf(c.prototype,new Pt),Object.assign(c,{runtime:o,typeName:r,fields:o.util.newFieldList(s),fromBinary:(d,h)=>new c().fromBinary(d,h),fromJson:(d,h)=>new c().fromJson(d,h),fromJsonString:(d,h)=>new c().fromJsonString(d,h),equals:(d,h)=>o.util.equals(c,d,h)}),c}(this,t,e,n)},makeEnum:NE,makeEnumType:$1,getEnumType:CE,makeExtension(t,e,n){return function(o,r,s,i){let a;return{typeName:r,extendee:s,get field(){if(!a){const l=typeof i=="function"?i():i;l.name=r.split(".").pop(),l.jsonName=`[${r}]`,a=o.util.newFieldList([l]).list()[0]}return a},runtime:o}}(this,t,e,n)}});var g_,__,Rn,ou,ul,ki,hl,Si,Yo;(function(t){t[t.Unary=0]="Unary",t[t.ServerStreaming=1]="ServerStreaming",t[t.ClientStreaming=2]="ClientStreaming",t[t.BiDiStreaming=3]="BiDiStreaming"})(Rn||(Rn={})),function(t){t[t.NoSideEffects=1]="NoSideEffects",t[t.Idempotent=2]="Idempotent"}(ou||(ou={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.JUPYTER_FORMAT=77]="JUPYTER_FORMAT"}(ul||(ul={})),ve.util.setEnumType(ul,"exa.codeium_common_pb.ExperimentKey",[{no:0,name:"UNSPECIFIED"},{no:77,name:"JUPYTER_FORMAT"}]),function(t){t[t.CODEIUM=0]="CODEIUM"}(ki||(ki={})),ve.util.setEnumType(ki,"exa.codeium_common_pb.AuthSource",[{no:0,name:"AUTH_SOURCE_CODEIUM"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ENABLE_CODEIUM=1]="ENABLE_CODEIUM",t[t.DISABLE_CODEIUM=2]="DISABLE_CODEIUM",t[t.SHOW_PREVIOUS_COMPLETION=3]="SHOW_PREVIOUS_COMPLETION",t[t.SHOW_NEXT_COMPLETION=4]="SHOW_NEXT_COMPLETION"}(hl||(hl={})),ve.util.setEnumType(hl,"exa.codeium_common_pb.EventType",[{no:0,name:"EVENT_TYPE_UNSPECIFIED"},{no:1,name:"EVENT_TYPE_ENABLE_CODEIUM"},{no:2,name:"EVENT_TYPE_DISABLE_CODEIUM"},{no:3,name:"EVENT_TYPE_SHOW_PREVIOUS_COMPLETION"},{no:4,name:"EVENT_TYPE_SHOW_NEXT_COMPLETION"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TYPING_AS_SUGGESTED=1]="TYPING_AS_SUGGESTED",t[t.CACHE=2]="CACHE",t[t.NETWORK=3]="NETWORK"}(Si||(Si={})),ve.util.setEnumType(Si,"exa.codeium_common_pb.CompletionSource",[{no:0,name:"COMPLETION_SOURCE_UNSPECIFIED"},{no:1,name:"COMPLETION_SOURCE_TYPING_AS_SUGGESTED"},{no:2,name:"COMPLETION_SOURCE_CACHE"},{no:3,name:"COMPLETION_SOURCE_NETWORK"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.C=1]="C",t[t.CLOJURE=2]="CLOJURE",t[t.COFFEESCRIPT=3]="COFFEESCRIPT",t[t.CPP=4]="CPP",t[t.CSHARP=5]="CSHARP",t[t.CSS=6]="CSS",t[t.CUDACPP=7]="CUDACPP",t[t.DOCKERFILE=8]="DOCKERFILE",t[t.GO=9]="GO",t[t.GROOVY=10]="GROOVY",t[t.HANDLEBARS=11]="HANDLEBARS",t[t.HASKELL=12]="HASKELL",t[t.HCL=13]="HCL",t[t.HTML=14]="HTML",t[t.INI=15]="INI",t[t.JAVA=16]="JAVA",t[t.JAVASCRIPT=17]="JAVASCRIPT",t[t.JSON=18]="JSON",t[t.JULIA=19]="JULIA",t[t.KOTLIN=20]="KOTLIN",t[t.LATEX=21]="LATEX",t[t.LESS=22]="LESS",t[t.LUA=23]="LUA",t[t.MAKEFILE=24]="MAKEFILE",t[t.MARKDOWN=25]="MARKDOWN",t[t.OBJECTIVEC=26]="OBJECTIVEC",t[t.OBJECTIVECPP=27]="OBJECTIVECPP",t[t.PERL=28]="PERL",t[t.PHP=29]="PHP",t[t.PLAINTEXT=30]="PLAINTEXT",t[t.PROTOBUF=31]="PROTOBUF",t[t.PBTXT=32]="PBTXT",t[t.PYTHON=33]="PYTHON",t[t.R=34]="R",t[t.RUBY=35]="RUBY",t[t.RUST=36]="RUST",t[t.SASS=37]="SASS",t[t.SCALA=38]="SCALA",t[t.SCSS=39]="SCSS",t[t.SHELL=40]="SHELL",t[t.SQL=41]="SQL",t[t.STARLARK=42]="STARLARK",t[t.SWIFT=43]="SWIFT",t[t.TSX=44]="TSX",t[t.TYPESCRIPT=45]="TYPESCRIPT",t[t.VISUALBASIC=46]="VISUALBASIC",t[t.VUE=47]="VUE",t[t.XML=48]="XML",t[t.XSL=49]="XSL",t[t.YAML=50]="YAML",t[t.SVELTE=51]="SVELTE",t[t.TOML=52]="TOML",t[t.DART=53]="DART",t[t.RST=54]="RST",t[t.OCAML=55]="OCAML",t[t.CMAKE=56]="CMAKE",t[t.PASCAL=57]="PASCAL",t[t.ELIXIR=58]="ELIXIR",t[t.FSHARP=59]="FSHARP",t[t.LISP=60]="LISP",t[t.MATLAB=61]="MATLAB",t[t.POWERSHELL=62]="POWERSHELL",t[t.SOLIDITY=63]="SOLIDITY",t[t.ADA=64]="ADA",t[t.OCAML_INTERFACE=65]="OCAML_INTERFACE"}(Yo||(Yo={})),ve.util.setEnumType(Yo,"exa.codeium_common_pb.Language",[{no:0,name:"LANGUAGE_UNSPECIFIED"},{no:1,name:"LANGUAGE_C"},{no:2,name:"LANGUAGE_CLOJURE"},{no:3,name:"LANGUAGE_COFFEESCRIPT"},{no:4,name:"LANGUAGE_CPP"},{no:5,name:"LANGUAGE_CSHARP"},{no:6,name:"LANGUAGE_CSS"},{no:7,name:"LANGUAGE_CUDACPP"},{no:8,name:"LANGUAGE_DOCKERFILE"},{no:9,name:"LANGUAGE_GO"},{no:10,name:"LANGUAGE_GROOVY"},{no:11,name:"LANGUAGE_HANDLEBARS"},{no:12,name:"LANGUAGE_HASKELL"},{no:13,name:"LANGUAGE_HCL"},{no:14,name:"LANGUAGE_HTML"},{no:15,name:"LANGUAGE_INI"},{no:16,name:"LANGUAGE_JAVA"},{no:17,name:"LANGUAGE_JAVASCRIPT"},{no:18,name:"LANGUAGE_JSON"},{no:19,name:"LANGUAGE_JULIA"},{no:20,name:"LANGUAGE_KOTLIN"},{no:21,name:"LANGUAGE_LATEX"},{no:22,name:"LANGUAGE_LESS"},{no:23,name:"LANGUAGE_LUA"},{no:24,name:"LANGUAGE_MAKEFILE"},{no:25,name:"LANGUAGE_MARKDOWN"},{no:26,name:"LANGUAGE_OBJECTIVEC"},{no:27,name:"LANGUAGE_OBJECTIVECPP"},{no:28,name:"LANGUAGE_PERL"},{no:29,name:"LANGUAGE_PHP"},{no:30,name:"LANGUAGE_PLAINTEXT"},{no:31,name:"LANGUAGE_PROTOBUF"},{no:32,name:"LANGUAGE_PBTXT"},{no:33,name:"LANGUAGE_PYTHON"},{no:34,name:"LANGUAGE_R"},{no:35,name:"LANGUAGE_RUBY"},{no:36,name:"LANGUAGE_RUST"},{no:37,name:"LANGUAGE_SASS"},{no:38,name:"LANGUAGE_SCALA"},{no:39,name:"LANGUAGE_SCSS"},{no:40,name:"LANGUAGE_SHELL"},{no:41,name:"LANGUAGE_SQL"},{no:42,name:"LANGUAGE_STARLARK"},{no:43,name:"LANGUAGE_SWIFT"},{no:44,name:"LANGUAGE_TSX"},{no:45,name:"LANGUAGE_TYPESCRIPT"},{no:46,name:"LANGUAGE_VISUALBASIC"},{no:47,name:"LANGUAGE_VUE"},{no:48,name:"LANGUAGE_XML"},{no:49,name:"LANGUAGE_XSL"},{no:50,name:"LANGUAGE_YAML"},{no:51,name:"LANGUAGE_SVELTE"},{no:52,name:"LANGUAGE_TOML"},{no:53,name:"LANGUAGE_DART"},{no:54,name:"LANGUAGE_RST"},{no:55,name:"LANGUAGE_OCAML"},{no:56,name:"LANGUAGE_CMAKE"},{no:57,name:"LANGUAGE_PASCAL"},{no:58,name:"LANGUAGE_ELIXIR"},{no:59,name:"LANGUAGE_FSHARP"},{no:60,name:"LANGUAGE_LISP"},{no:61,name:"LANGUAGE_MATLAB"},{no:62,name:"LANGUAGE_POWERSHELL"},{no:63,name:"LANGUAGE_SOLIDITY"},{no:64,name:"LANGUAGE_ADA"},{no:65,name:"LANGUAGE_OCAML_INTERFACE"}]);const wo=class wo extends Pt{constructor(n){super();ee(this,"completionId","");ee(this,"text","");ee(this,"prefix","");ee(this,"stop","");ee(this,"score",0);ee(this,"tokens",[]);ee(this,"decodedTokens",[]);ee(this,"probabilities",[]);ee(this,"adjustedProbabilities",[]);ee(this,"generatedLength",vt.zero);ve.util.initPartial(n,this)}static fromBinary(n,o){return new wo().fromBinary(n,o)}static fromJson(n,o){return new wo().fromJson(n,o)}static fromJsonString(n,o){return new wo().fromJsonString(n,o)}static equals(n,o){return ve.util.equals(wo,n,o)}};ee(wo,"runtime",ve),ee(wo,"typeName","exa.codeium_common_pb.Completion"),ee(wo,"fields",ve.util.newFieldList(()=>[{no:1,name:"completion_id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"prefix",kind:"scalar",T:9},{no:4,name:"stop",kind:"scalar",T:9},{no:5,name:"score",kind:"scalar",T:1},{no:6,name:"tokens",kind:"scalar",T:4,repeated:!0},{no:7,name:"decoded_tokens",kind:"scalar",T:9,repeated:!0},{no:8,name:"probabilities",kind:"scalar",T:1,repeated:!0},{no:9,name:"adjusted_probabilities",kind:"scalar",T:1,repeated:!0},{no:10,name:"generated_length",kind:"scalar",T:4}]));let ru=wo;const vo=class vo extends Pt{constructor(n){super();ee(this,"ideName","");ee(this,"ideVersion","");ee(this,"extensionName","");ee(this,"extensionVersion","");ee(this,"apiKey","");ee(this,"locale","");ee(this,"sessionId","");ee(this,"requestId",vt.zero);ee(this,"userAgent","");ee(this,"url","");ee(this,"authSource",ki.CODEIUM);ve.util.initPartial(n,this)}static fromBinary(n,o){return new vo().fromBinary(n,o)}static fromJson(n,o){return new vo().fromJson(n,o)}static fromJsonString(n,o){return new vo().fromJsonString(n,o)}static equals(n,o){return ve.util.equals(vo,n,o)}};ee(vo,"runtime",ve),ee(vo,"typeName","exa.codeium_common_pb.Metadata"),ee(vo,"fields",ve.util.newFieldList(()=>[{no:1,name:"ide_name",kind:"scalar",T:9},{no:7,name:"ide_version",kind:"scalar",T:9},{no:12,name:"extension_name",kind:"scalar",T:9},{no:2,name:"extension_version",kind:"scalar",T:9},{no:3,name:"api_key",kind:"scalar",T:9},{no:4,name:"locale",kind:"scalar",T:9},{no:10,name:"session_id",kind:"scalar",T:9},{no:9,name:"request_id",kind:"scalar",T:4},{no:13,name:"user_agent",kind:"scalar",T:9},{no:14,name:"url",kind:"scalar",T:9},{no:15,name:"auth_source",kind:"enum",T:ve.getEnumType(ki)}]));let fl=vo;const ko=class ko extends Pt{constructor(n){super();ee(this,"tabSize",vt.zero);ee(this,"insertSpaces",!1);ve.util.initPartial(n,this)}static fromBinary(n,o){return new ko().fromBinary(n,o)}static fromJson(n,o){return new ko().fromJson(n,o)}static fromJsonString(n,o){return new ko().fromJsonString(n,o)}static equals(n,o){return ve.util.equals(ko,n,o)}};ee(ko,"runtime",ve),ee(ko,"typeName","exa.codeium_common_pb.EditorOptions"),ee(ko,"fields",ve.util.newFieldList(()=>[{no:1,name:"tab_size",kind:"scalar",T:4},{no:2,name:"insert_spaces",kind:"scalar",T:8}]));let su=ko;ve.util.newFieldList(()=>[{no:1,name:"event_type",kind:"enum",T:ve.getEnumType(hl)},{no:2,name:"event_json",kind:"scalar",T:9},{no:3,name:"timestamp_unix_ms",kind:"scalar",T:3}]);class JE extends Qs{constructor(n,o){super();ee(this,"index");ee(this,"total");this.index=n,this.total=o}toDOM(){const n=document.createElement("span");n.setAttribute("aria-hidden","true"),n.className="cm-codeium-cycle";const o=n.appendChild(document.createElement("span"));o.className="cm-codeium-cycle-explanation",o.innerText=`${this.index+1}/${this.total}`;const r=n.appendChild(document.createElement("button"));return r.className="cm-codeium-cycle-key",r.innerText="\u2192 (Ctrl ])",r.dataset.action="codeium-cycle",n}ignoreEvent(){return!1}}const ml=Zs.define({combine:t=>Rc(t,{language:Yo.TYPESCRIPT,timeout:150,widgetClass:JE,alwaysOn:!0},{})}),b_=Zs.define({combine:t=>Rc(t,{override:()=>[]},{})}),KE=dt.mark({class:"cm-ghostText"}),Ir=On.define({create:t=>null,update(t,e){var o;const n=e.state.facet(ml);for(const r of e.effects){if(r.is(Jd)){const{changeSpecs:s,index:i}=r.value,a=s[i].map(c=>KE.range(c.absoluteStartPos,c.absoluteEndPos)),l=(o=a.at(-1))==null?void 0:o.to;return{index:i,decorations:dt.set([...a,...l!==void 0&&s.length>1&&n.widgetClass?[dt.widget({widget:new n.widgetClass(i,s.length),side:1}).range(l)]:[]]),changeSpecs:s,reverseChangeSet:r.value.reverseChangeSet}}if(r.is(Kd)||r.is(Xd))return null}return t&&{...t,decorations:t.decorations.map(e.changes),reverseChangeSet:t.reverseChangeSet.map(e.changes)}},provide:t=>st.decorations.from(t,e=>(e==null?void 0:e.decorations)||dt.none)}),Zr=Bm.define(),pl=Bm.define();var pt;function iu(t){const e=pt[t];return typeof e!="string"?t.toString():e[0].toLowerCase()+e.substring(1).replace(/[A-Z]/g,n=>"_"+n.toLowerCase())}let gl;(function(t){t[t.Canceled=1]="Canceled",t[t.Unknown=2]="Unknown",t[t.InvalidArgument=3]="InvalidArgument",t[t.DeadlineExceeded=4]="DeadlineExceeded",t[t.NotFound=5]="NotFound",t[t.AlreadyExists=6]="AlreadyExists",t[t.PermissionDenied=7]="PermissionDenied",t[t.ResourceExhausted=8]="ResourceExhausted",t[t.FailedPrecondition=9]="FailedPrecondition",t[t.Aborted=10]="Aborted",t[t.OutOfRange=11]="OutOfRange",t[t.Unimplemented=12]="Unimplemented",t[t.Internal=13]="Internal",t[t.Unavailable=14]="Unavailable",t[t.DataLoss=15]="DataLoss",t[t.Unauthenticated=16]="Unauthenticated"})(pt||(pt={}));class Kt extends Error{constructor(e,n=pt.Unknown,o,r,s){super(function(i,a){return i.length?`[${iu(a)}] ${i}`:`[${iu(a)}]`}(e,n)),this.name="ConnectError",Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=e,this.code=n,this.metadata=new Headers(o??{}),this.details=r??[],this.cause=s}static from(e,n=pt.Unknown){return e instanceof Kt?e:e instanceof Error?e.name=="AbortError"?new Kt(e.message,pt.Canceled):new Kt(e.message,n,void 0,void 0,e):new Kt(String(e),n,void 0,void 0,e)}static[Symbol.hasInstance](e){return e instanceof Error&&(Object.getPrototypeOf(e)===Kt.prototype||e.name==="ConnectError"&&"code"in e&&typeof e.code=="number"&&"metadata"in e&&"details"in e&&Array.isArray(e.details)&&"rawMessage"in e&&typeof e.rawMessage=="string"&&"cause"in e)}findDetails(e){const n="typeName"in e?{findMessage:r=>r===e.typeName?e:void 0}:e,o=[];for(const r of this.details){if("getType"in r){n.findMessage(r.getType().typeName)&&o.push(r);continue}const s=n.findMessage(r.type);if(s)try{o.push(s.fromBinary(r.value))}catch{}}return o}}var XE=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(r){e[r]=t[r]&&function(s){return new Promise(function(i,a){(function(l,c,d,h){Promise.resolve(h).then(function(f){l({value:f,done:d})},c)})(i,a,(s=t[r](s)).done,s.value)})}}},Ci=function(t){return this instanceof Ci?(this.v=t,this):new Ci(t)},ZE=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},i("next"),i("throw"),i("return",function(h){return function(f){return Promise.resolve(f).then(h,c)}}),o[Symbol.asyncIterator]=function(){return this},o;function i(h,f){r[h]&&(o[h]=function(m){return new Promise(function(_,g){s.push([h,m,_,g])>1||a(h,m)})},f&&(o[h]=f(o[h])))}function a(h,f){try{(m=r[h](f)).value instanceof Ci?Promise.resolve(m.value.v).then(l,c):d(s[0][2],m)}catch(_){d(s[0][3],_)}var m}function l(h){a("next",h)}function c(h){a("throw",h)}function d(h,f){h(f),s.shift(),s.length&&a(s[0][0],s[0][1])}},QE=function(t){var e,n;return e={},o("next"),o("throw",function(r){throw r}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(r,s){e[r]=t[r]?function(i){return(n=!n)?{value:Ci(t[r](i)),done:!1}:s?s(i):i}:s}},y_=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(r){e[r]=t[r]&&function(s){return new Promise(function(i,a){(function(l,c,d,h){Promise.resolve(h).then(function(f){l({value:f,done:d})},c)})(i,a,(s=t[r](s)).done,s.value)})}}},Qr=function(t){return this instanceof Qr?(this.v=t,this):new Qr(t)},e5=function(t){var e,n;return e={},o("next"),o("throw",function(r){throw r}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(r,s){e[r]=t[r]?function(i){return(n=!n)?{value:Qr(t[r](i)),done:!1}:s?s(i):i}:s}},t5=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},i("next"),i("throw"),i("return",function(h){return function(f){return Promise.resolve(f).then(h,c)}}),o[Symbol.asyncIterator]=function(){return this},o;function i(h,f){r[h]&&(o[h]=function(m){return new Promise(function(_,g){s.push([h,m,_,g])>1||a(h,m)})},f&&(o[h]=f(o[h])))}function a(h,f){try{(m=r[h](f)).value instanceof Qr?Promise.resolve(m.value.v).then(l,c):d(s[0][2],m)}catch(_){d(s[0][3],_)}var m}function l(h){a("next",h)}function c(h){a("throw",h)}function d(h,f){h(f),s.shift(),s.length&&a(s[0][0],s[0][1])}};function x_(t,e){const n=function(){var o,r;return t5(this,arguments,function*(){const s=yield Qr(t);(o=e==null?void 0:e.onHeader)===null||o===void 0||o.call(e,s.header),yield Qr(yield*e5(y_(s.message))),(r=e==null?void 0:e.onTrailer)===null||r===void 0||r.call(e,s.trailer)})}()[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({next:()=>n.next()})}}function w_(t){if(!t.aborted)return;if(t.reason!==void 0)return t.reason;const e=new Error("This operation was aborted");return e.name="AbortError",e}function v_(){return{get(t){return t.id in this?this[t.id]:t.defaultValue},set(t,e){return this[t.id]=e,this},delete(t){return delete this[t.id],this}}}function k_(t,e,n){const o=typeof e=="string"?e:e.typeName,r=typeof n=="string"?n:n.name;return t.toString().replace(/\/?$/,`/${o}/${r}`)}function S_(t,e){return e instanceof t?e:new t(e)}function n5(t,e){function n(o){return o.done===!0?o:{done:o.done,value:S_(t,o.value)}}return{[Symbol.asyncIterator](){const o=e[Symbol.asyncIterator](),r={next:()=>o.next().then(n)};return o.throw!==void 0&&(r.throw=s=>o.throw(s).then(n)),o.return!==void 0&&(r.return=s=>o.return(s).then(n)),r}}}function C_(t,e){var n;return(n=e==null?void 0:e.concat().reverse().reduce((o,r)=>r(o),t))!==null&&n!==void 0?n:t}function N_(t){var e;const n=Object.assign({},t);return(e=n.ignoreUnknownFields)!==null&&e!==void 0||(n.ignoreUnknownFields=!0),n}function j_(t,e,n,o){const r=e?E_(t.I,o):I_(t.I,n);return{parse:(e?E_(t.O,o):I_(t.O,n)).parse,serialize:r.serialize}}function E_(t,e){return{parse(n){try{return t.fromBinary(n,e)}catch(o){const r=o instanceof Error?o.message:String(o);throw new Kt(`parse binary: ${r}`,pt.InvalidArgument)}},serialize(n){try{return n.toBinary(e)}catch(o){const r=o instanceof Error?o.message:String(o);throw new Kt(`serialize binary: ${r}`,pt.Internal)}}}}function I_(t,e){var n,o;const r=(n=e==null?void 0:e.textEncoder)!==null&&n!==void 0?n:new TextEncoder,s=(o=e==null?void 0:e.textDecoder)!==null&&o!==void 0?o:new TextDecoder,i=N_(e);return{parse(a){try{const l=s.decode(a);return t.fromJsonString(l,i)}catch(l){throw Kt.from(l,pt.InvalidArgument)}},serialize(a){try{const l=a.toJsonString(i);return r.encode(l)}catch(l){throw Kt.from(l,pt.Internal)}}}}const o5=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i;function A_(t,e,n){if(e&&new Headers(e).forEach((i,a)=>n.metadata.append(a,i)),typeof t!="object"||t==null||Array.isArray(t)||!("code"in t)||typeof t.code!="string")throw n;const o=function(i){if(!gl){gl={};for(const a of Object.values(pt))typeof a!="string"&&(gl[iu(a)]=a)}return gl[i]}(t.code);if(o===void 0)throw n;const r=t.message;if(r!=null&&typeof r!="string")throw n;const s=new Kt(r??"",o,e);if("details"in t&&Array.isArray(t.details))for(const i of t.details){if(i===null||typeof i!="object"||Array.isArray(i)||typeof i.type!="string"||typeof i.value!="string"||"debug"in i&&typeof i.debug!="object")throw n;try{s.details.push({type:i.type,value:rl.dec(i.value),debug:i.debug})}catch{throw n}}return s}function r5(t){const e=new Kt("invalid end stream",pt.InvalidArgument);let n;try{n=JSON.parse(typeof t=="string"?t:new TextDecoder().decode(t))}catch{throw e}if(typeof n!="object"||n==null||Array.isArray(n))throw e;const o=new Headers;if("metadata"in n){if(typeof n.metadata!="object"||n.metadata==null||Array.isArray(n.metadata))throw e;for(const[r,s]of Object.entries(n.metadata)){if(!Array.isArray(s)||s.some(i=>typeof i!="string"))throw e;for(const i of s)o.append(r,i)}}return{metadata:o,error:"error"in n?A_(n.error,o,e):void 0}}const au="Content-Type",s5="Content-Length",T_="Content-Encoding",i5="Accept-Encoding",M_="Connect-Protocol-Version";function O_(t){const e=new Headers,n=new Headers;return t.forEach((o,r)=>{r.toLowerCase().startsWith("trailer-")?n.set(r.substring(8),o):e.set(r,o)}),[e,n]}function D_(t,e,n,o,r){const s=new Headers(o??{});return n!==void 0&&s.set("Connect-Timeout-Ms",`${n}`),s.set(au,t==Rn.Unary?e?"application/proto":"application/json":e?"application/connect+proto":"application/connect+json"),s.set(M_,"1"),s}function R_(t,e,n){const o=function(r){const s=r==null?void 0:r.match(o5);if(s)return{stream:!!s[1],binary:!!s[3]}}(n.get("Content-Type"));if(e!==200){const r=new Kt(`HTTP ${e}`,function(s){switch(s){case 400:return pt.InvalidArgument;case 401:return pt.Unauthenticated;case 403:return pt.PermissionDenied;case 404:return pt.Unimplemented;case 408:return pt.DeadlineExceeded;case 409:return pt.Aborted;case 412:return pt.FailedPrecondition;case 413:case 431:return pt.ResourceExhausted;case 415:return pt.Internal;case 429:case 502:case 503:case 504:return pt.Unavailable;default:return pt.Unknown}}(e),n);if(t==Rn.Unary&&o&&!o.binary)return{isUnaryError:!0,unaryError:r};throw r}return{isUnaryError:!1}}const a5="application/";function l5(t,e,n){let o="?connect=v1";const r=t.header.get(au);(r==null?void 0:r.indexOf(a5))===0&&(o+="&encoding="+encodeURIComponent(r.slice(12)));const s=t.header.get(T_);s!==null&&s!=="identity"&&(o+="&compression="+encodeURIComponent(s),n=!0),n&&(o+="&base64=1"),o+="&message="+function(l,c){return c?rl.enc(l).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):encodeURIComponent(new TextDecoder().decode(l))}(e,n);const i=t.url+o,a=new Headers(t.header);return[M_,au,s5,T_,i5].forEach(l=>a.delete(l)),Object.assign(Object.assign({},t),{init:Object.assign(Object.assign({},t.init),{method:"GET"}),url:i,header:a})}function P_(t){const{signal:e,cleanup:n}=function(r){const s=new AbortController,i=()=>{s.abort(new Kt("the operation timed out",pt.DeadlineExceeded))};let a;return r!==void 0&&(r<=0?i():a=setTimeout(i,r)),{signal:s.signal,cleanup:()=>clearTimeout(a)}}(t.timeoutMs),o=function(...r){const s=new AbortController,i=r.filter(l=>l!==void 0).concat(s.signal);for(const l of i){if(l.aborted){a.apply(l);break}l.addEventListener("abort",a)}function a(){s.signal.aborted||s.abort(w_(this));for(const l of i)l.removeEventListener("abort",a)}return s}(t.signal,e);return[o.signal,function(r){const s=Kt.from(e.aborted?w_(e):r);return o.abort(s),n(),Promise.reject(s)},function(){n(),o.abort()}]}var Ni,lu,ji;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.INACTIVE=1]="INACTIVE",t[t.PROCESSING=2]="PROCESSING",t[t.SUCCESS=3]="SUCCESS",t[t.WARNING=4]="WARNING",t[t.ERROR=5]="ERROR"})(Ni||(Ni={})),ve.util.setEnumType(Ni,"exa.language_server_pb.CodeiumState",[{no:0,name:"CODEIUM_STATE_UNSPECIFIED"},{no:1,name:"CODEIUM_STATE_INACTIVE"},{no:2,name:"CODEIUM_STATE_PROCESSING"},{no:3,name:"CODEIUM_STATE_SUCCESS"},{no:4,name:"CODEIUM_STATE_WARNING"},{no:5,name:"CODEIUM_STATE_ERROR"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SINGLE=1]="SINGLE",t[t.MULTI=2]="MULTI"}(lu||(lu={})),ve.util.setEnumType(lu,"exa.language_server_pb.LineType",[{no:0,name:"LINE_TYPE_UNSPECIFIED"},{no:1,name:"LINE_TYPE_SINGLE"},{no:2,name:"LINE_TYPE_MULTI"}]),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.INLINE=1]="INLINE",t[t.BLOCK=2]="BLOCK",t[t.INLINE_MASK=3]="INLINE_MASK"}(ji||(ji={})),ve.util.setEnumType(ji,"exa.language_server_pb.CompletionPartType",[{no:0,name:"COMPLETION_PART_TYPE_UNSPECIFIED"},{no:1,name:"COMPLETION_PART_TYPE_INLINE"},{no:2,name:"COMPLETION_PART_TYPE_BLOCK"},{no:3,name:"COMPLETION_PART_TYPE_INLINE_MASK"}]);const So=class So extends Pt{constructor(n){super();ee(this,"threshold",0);ve.util.initPartial(n,this)}static fromBinary(n,o){return new So().fromBinary(n,o)}static fromJson(n,o){return new So().fromJson(n,o)}static fromJsonString(n,o){return new So().fromJsonString(n,o)}static equals(n,o){return ve.util.equals(So,n,o)}};ee(So,"runtime",ve),ee(So,"typeName","exa.language_server_pb.MultilineConfig"),ee(So,"fields",ve.util.newFieldList(()=>[{no:1,name:"threshold",kind:"scalar",T:2}]));let cu=So;const Co=class Co extends Pt{constructor(n){super();ee(this,"metadata");ee(this,"document");ee(this,"editorOptions");ee(this,"otherDocuments",[]);ee(this,"experimentConfig");ee(this,"modelName","");ee(this,"multilineConfig");ve.util.initPartial(n,this)}static fromBinary(n,o){return new Co().fromBinary(n,o)}static fromJson(n,o){return new Co().fromJson(n,o)}static fromJsonString(n,o){return new Co().fromJsonString(n,o)}static equals(n,o){return ve.util.equals(Co,n,o)}};ee(Co,"runtime",ve),ee(Co,"typeName","exa.language_server_pb.GetCompletionsRequest"),ee(Co,"fields",ve.util.newFieldList(()=>[{no:1,name:"metadata",kind:"message",T:fl},{no:2,name:"document",kind:"message",T:_l},{no:3,name:"editor_options",kind:"message",T:su},{no:5,name:"other_documents",kind:"message",T:_l,repeated:!0},{no:7,name:"experiment_config",kind:"message",T:gu},{no:10,name:"model_name",kind:"scalar",T:9},{no:13,name:"multiline_config",kind:"message",T:cu}]));let du=Co;const No=class No extends Pt{constructor(n){super();ee(this,"state");ee(this,"completionItems",[]);ve.util.initPartial(n,this)}static fromBinary(n,o){return new No().fromBinary(n,o)}static fromJson(n,o){return new No().fromJson(n,o)}static fromJsonString(n,o){return new No().fromJsonString(n,o)}static equals(n,o){return ve.util.equals(No,n,o)}};ee(No,"runtime",ve),ee(No,"typeName","exa.language_server_pb.GetCompletionsResponse"),ee(No,"fields",ve.util.newFieldList(()=>[{no:1,name:"state",kind:"message",T:_u},{no:2,name:"completion_items",kind:"message",T:wu,repeated:!0}]));let uu=No;const jo=class jo extends Pt{constructor(n){super();ee(this,"metadata");ee(this,"completionId","");ve.util.initPartial(n,this)}static fromBinary(n,o){return new jo().fromBinary(n,o)}static fromJson(n,o){return new jo().fromJson(n,o)}static fromJsonString(n,o){return new jo().fromJsonString(n,o)}static equals(n,o){return ve.util.equals(jo,n,o)}};ee(jo,"runtime",ve),ee(jo,"typeName","exa.language_server_pb.AcceptCompletionRequest"),ee(jo,"fields",ve.util.newFieldList(()=>[{no:1,name:"metadata",kind:"message",T:fl},{no:2,name:"completion_id",kind:"scalar",T:9}]));let hu=jo;const Eo=class Eo extends Pt{constructor(e){super(),ve.util.initPartial(e,this)}static fromBinary(e,n){return new Eo().fromBinary(e,n)}static fromJson(e,n){return new Eo().fromJson(e,n)}static fromJsonString(e,n){return new Eo().fromJsonString(e,n)}static equals(e,n){return ve.util.equals(Eo,e,n)}};ee(Eo,"runtime",ve),ee(Eo,"typeName","exa.language_server_pb.AcceptCompletionResponse"),ee(Eo,"fields",ve.util.newFieldList(()=>[]));let fu=Eo;const Io=class Io extends Pt{constructor(e){super(),ve.util.initPartial(e,this)}static fromBinary(e,n){return new Io().fromBinary(e,n)}static fromJson(e,n){return new Io().fromJson(e,n)}static fromJsonString(e,n){return new Io().fromJsonString(e,n)}static equals(e,n){return ve.util.equals(Io,e,n)}};ee(Io,"runtime",ve),ee(Io,"typeName","exa.language_server_pb.GetAuthTokenRequest"),ee(Io,"fields",ve.util.newFieldList(()=>[]));let mu=Io;const Ao=class Ao extends Pt{constructor(n){super();ee(this,"authToken","");ee(this,"uuid","");ve.util.initPartial(n,this)}static fromBinary(n,o){return new Ao().fromBinary(n,o)}static fromJson(n,o){return new Ao().fromJson(n,o)}static fromJsonString(n,o){return new Ao().fromJsonString(n,o)}static equals(n,o){return ve.util.equals(Ao,n,o)}};ee(Ao,"runtime",ve),ee(Ao,"typeName","exa.language_server_pb.GetAuthTokenResponse"),ee(Ao,"fields",ve.util.newFieldList(()=>[{no:1,name:"auth_token",kind:"scalar",T:9},{no:2,name:"uuid",kind:"scalar",T:9}]));let pu=Ao;const To=class To extends Pt{constructor(n){super();ee(this,"row",vt.zero);ee(this,"col",vt.zero);ve.util.initPartial(n,this)}static fromBinary(n,o){return new To().fromBinary(n,o)}static fromJson(n,o){return new To().fromJson(n,o)}static fromJsonString(n,o){return new To().fromJsonString(n,o)}static equals(n,o){return ve.util.equals(To,n,o)}};ee(To,"runtime",ve),ee(To,"typeName","exa.language_server_pb.DocumentPosition"),ee(To,"fields",ve.util.newFieldList(()=>[{no:1,name:"row",kind:"scalar",T:4},{no:2,name:"col",kind:"scalar",T:4}]));let Ei=To;const Mo=class Mo extends Pt{constructor(n){super();ee(this,"absolutePath","");ee(this,"relativePath","");ee(this,"text","");ee(this,"editorLanguage","");ee(this,"language",Yo.UNSPECIFIED);ee(this,"cursorOffset",vt.zero);ee(this,"cursorPosition");ee(this,"lineEnding","");ve.util.initPartial(n,this)}static fromBinary(n,o){return new Mo().fromBinary(n,o)}static fromJson(n,o){return new Mo().fromJson(n,o)}static fromJsonString(n,o){return new Mo().fromJsonString(n,o)}static equals(n,o){return ve.util.equals(Mo,n,o)}};ee(Mo,"runtime",ve),ee(Mo,"typeName","exa.language_server_pb.Document"),ee(Mo,"fields",ve.util.newFieldList(()=>[{no:1,name:"absolute_path",kind:"scalar",T:9},{no:2,name:"relative_path",kind:"scalar",T:9},{no:3,name:"text",kind:"scalar",T:9},{no:4,name:"editor_language",kind:"scalar",T:9},{no:5,name:"language",kind:"enum",T:ve.getEnumType(Yo)},{no:6,name:"cursor_offset",kind:"scalar",T:4},{no:8,name:"cursor_position",kind:"message",T:Ei},{no:7,name:"line_ending",kind:"scalar",T:9}]));let _l=Mo;const Oo=class Oo extends Pt{constructor(n){super();ee(this,"forceEnableExperiments",[]);ve.util.initPartial(n,this)}static fromBinary(n,o){return new Oo().fromBinary(n,o)}static fromJson(n,o){return new Oo().fromJson(n,o)}static fromJsonString(n,o){return new Oo().fromJsonString(n,o)}static equals(n,o){return ve.util.equals(Oo,n,o)}};ee(Oo,"runtime",ve),ee(Oo,"typeName","exa.language_server_pb.ExperimentConfig"),ee(Oo,"fields",ve.util.newFieldList(()=>[{no:1,name:"force_enable_experiments",kind:"enum",T:ve.getEnumType(ul),repeated:!0}]));let gu=Oo;const Do=class Do extends Pt{constructor(n){super();ee(this,"state",Ni.UNSPECIFIED);ee(this,"message","");ve.util.initPartial(n,this)}static fromBinary(n,o){return new Do().fromBinary(n,o)}static fromJson(n,o){return new Do().fromJson(n,o)}static fromJsonString(n,o){return new Do().fromJsonString(n,o)}static equals(n,o){return ve.util.equals(Do,n,o)}};ee(Do,"runtime",ve),ee(Do,"typeName","exa.language_server_pb.State"),ee(Do,"fields",ve.util.newFieldList(()=>[{no:1,name:"state",kind:"enum",T:ve.getEnumType(Ni)},{no:2,name:"message",kind:"scalar",T:9}]));let _u=Do;const Ro=class Ro extends Pt{constructor(n){super();ee(this,"startOffset",vt.zero);ee(this,"endOffset",vt.zero);ee(this,"startPosition");ee(this,"endPosition");ve.util.initPartial(n,this)}static fromBinary(n,o){return new Ro().fromBinary(n,o)}static fromJson(n,o){return new Ro().fromJson(n,o)}static fromJsonString(n,o){return new Ro().fromJsonString(n,o)}static equals(n,o){return ve.util.equals(Ro,n,o)}};ee(Ro,"runtime",ve),ee(Ro,"typeName","exa.language_server_pb.Range"),ee(Ro,"fields",ve.util.newFieldList(()=>[{no:1,name:"start_offset",kind:"scalar",T:4},{no:2,name:"end_offset",kind:"scalar",T:4},{no:3,name:"start_position",kind:"message",T:Ei},{no:4,name:"end_position",kind:"message",T:Ei}]));let bu=Ro;const Po=class Po extends Pt{constructor(n){super();ee(this,"text","");ee(this,"deltaCursorOffset",vt.zero);ve.util.initPartial(n,this)}static fromBinary(n,o){return new Po().fromBinary(n,o)}static fromJson(n,o){return new Po().fromJson(n,o)}static fromJsonString(n,o){return new Po().fromJsonString(n,o)}static equals(n,o){return ve.util.equals(Po,n,o)}};ee(Po,"runtime",ve),ee(Po,"typeName","exa.language_server_pb.Suffix"),ee(Po,"fields",ve.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"delta_cursor_offset",kind:"scalar",T:3}]));let yu=Po;const Lo=class Lo extends Pt{constructor(n){super();ee(this,"text","");ee(this,"offset",vt.zero);ee(this,"type",ji.UNSPECIFIED);ee(this,"prefix","");ee(this,"line",vt.zero);ve.util.initPartial(n,this)}static fromBinary(n,o){return new Lo().fromBinary(n,o)}static fromJson(n,o){return new Lo().fromJson(n,o)}static fromJsonString(n,o){return new Lo().fromJsonString(n,o)}static equals(n,o){return ve.util.equals(Lo,n,o)}};ee(Lo,"runtime",ve),ee(Lo,"typeName","exa.language_server_pb.CompletionPart"),ee(Lo,"fields",ve.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"offset",kind:"scalar",T:4},{no:3,name:"type",kind:"enum",T:ve.getEnumType(ji)},{no:4,name:"prefix",kind:"scalar",T:9},{no:5,name:"line",kind:"scalar",T:4}]));let xu=Lo;const Fo=class Fo extends Pt{constructor(n){super();ee(this,"completion");ee(this,"suffix");ee(this,"range");ee(this,"source",Si.UNSPECIFIED);ee(this,"completionParts",[]);ve.util.initPartial(n,this)}static fromBinary(n,o){return new Fo().fromBinary(n,o)}static fromJson(n,o){return new Fo().fromJson(n,o)}static fromJsonString(n,o){return new Fo().fromJsonString(n,o)}static equals(n,o){return ve.util.equals(Fo,n,o)}};ee(Fo,"runtime",ve),ee(Fo,"typeName","exa.language_server_pb.CompletionItem"),ee(Fo,"fields",ve.util.newFieldList(()=>[{no:1,name:"completion",kind:"message",T:ru},{no:5,name:"suffix",kind:"message",T:yu},{no:2,name:"range",kind:"message",T:bu},{no:3,name:"source",kind:"enum",T:ve.getEnumType(Si)},{no:8,name:"completion_parts",kind:"message",T:xu,repeated:!0}]));let wu=Fo;const c5={typeName:"exa.language_server_pb.LanguageServerService",methods:{getCompletions:{name:"GetCompletions",I:du,O:uu,kind:Rn.Unary},acceptCompletion:{name:"AcceptCompletion",I:hu,O:fu,kind:Rn.Unary},getAuthToken:{name:"GetAuthToken",I:mu,O:pu,kind:Rn.Unary}}};var Ii=function(t){return this instanceof Ii?(this.v=t,this):new Ii(t)},d5=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},i("next"),i("throw"),i("return",function(h){return function(f){return Promise.resolve(f).then(h,c)}}),o[Symbol.asyncIterator]=function(){return this},o;function i(h,f){r[h]&&(o[h]=function(m){return new Promise(function(_,g){s.push([h,m,_,g])>1||a(h,m)})},f&&(o[h]=f(o[h])))}function a(h,f){try{(m=r[h](f)).value instanceof Ii?Promise.resolve(m.value.v).then(l,c):d(s[0][2],m)}catch(_){d(s[0][3],_)}var m}function l(h){a("next",h)}function c(h){a("throw",h)}function d(h,f){h(f),s.shift(),s.length&&a(s[0][0],s[0][1])}};const u5=function(t){var e;(function(){try{new Headers}catch{throw new Error("connect-web requires the fetch API. Are you running on an old version of Node.js? Node.js is not supported in Connect for Web - please stay tuned for Connect for Node.")}})();const n=(e=t.useBinaryFormat)!==null&&e!==void 0&&e;return{async unary(o,r,s,i,a,l,c){var d;const{serialize:h,parse:f}=j_(r,n,t.jsonOptions,t.binaryOptions);return i=i===void 0?t.defaultTimeoutMs:i<=0?void 0:i,await function(m){const _=C_(m.next,m.interceptors),[g,p,b]=P_(m);return _(Object.assign(Object.assign({},m.req),{message:S_(m.req.method.I,m.req.message),signal:g})).then(y=>(b(),y),p)}({interceptors:t.interceptors,signal:s,timeoutMs:i,req:{stream:!1,service:o,method:r,url:k_(t.baseUrl,o,r),init:{method:"POST",credentials:(d=t.credentials)!==null&&d!==void 0?d:"same-origin",redirect:"error",mode:"cors"},header:D_(r.kind,n,i,a),contextValues:c??v_(),message:l},next:async m=>{var _;let g=null;t.useHttpGet===!0&&r.idempotency===ou.NoSideEffects?m=l5(m,h(m.message),n):g=h(m.message);const p=(_=t.fetch)!==null&&_!==void 0?_:globalThis.fetch,b=await p(m.url,Object.assign(Object.assign({},m.init),{headers:m.header,signal:m.signal,body:g})),{isUnaryError:y,unaryError:x}=R_(r.kind,b.status,b.headers);if(y)throw A_(await b.json(),function(...v){const E=new Headers;for(const N of v)N.forEach((I,A)=>{E.append(A,I)});return E}(...O_(b.headers)),x);const[k,C]=O_(b.headers);return{stream:!1,service:o,method:r,header:k,message:n?f(new Uint8Array(await b.arrayBuffer())):r.O.fromJson(await b.json(),N_(t.jsonOptions)),trailer:C}}})},async stream(o,r,s,i,a,l,c){var d;const{serialize:h,parse:f}=j_(r,n,t.jsonOptions,t.binaryOptions);function m(g,p,b){return d5(this,arguments,function*(){const y=function(k){let C,v=new Uint8Array(0);function E(N){const I=new Uint8Array(v.length+N.length);I.set(v),I.set(N,v.length),v=I}return new ReadableStream({start(){C=k.getReader()},async pull(N){let I;for(;;){if(I===void 0&&v.byteLength>=5){let R=0;for(let z=1;z<5;z++)R=(R<<8)+v[z];I={flags:v[0],length:R}}if(I!==void 0&&v.byteLength>=I.length+5)break;const M=await C.read();if(M.done)break;E(M.value)}if(I===void 0)return v.byteLength==0?void N.close():void N.error(new Kt("premature end of stream",pt.DataLoss));const A=v.subarray(5,5+I.length);v=v.subarray(5+I.length),N.enqueue({flags:I.flags,data:A})}})}(g).getReader();let x=!1;for(;;){const k=yield Ii(y.read());if(k.done)break;const{flags:C,data:v}=k.value;if(!(2&~C)){x=!0;const E=r5(v);if(E.error){const N=E.error;throw b.forEach((I,A)=>{N.metadata.append(A,I)}),N}E.metadata.forEach((N,I)=>p.set(I,N));continue}yield yield Ii(f(v))}if(!x)throw"missing EndStreamResponse"})}async function _(g){if(r.kind!=Rn.ServerStreaming)throw"The fetch API does not support streaming request bodies";const p=await g[Symbol.asyncIterator]().next();if(p.done==1)throw"missing request message";return function(b,y){const x=new Uint8Array(y.length+5);x.set(y,5);const k=new DataView(x.buffer,x.byteOffset,x.byteLength);return k.setUint8(0,b),k.setUint32(1,y.length),x}(0,h(p.value))}return i=i===void 0?t.defaultTimeoutMs:i<=0?void 0:i,await function(g){const p=C_(g.next,g.interceptors),[b,y,x]=P_(g),k=Object.assign(Object.assign({},g.req),{message:n5(g.req.method.I,g.req.message),signal:b});let C=!1;return b.addEventListener("abort",function(){var v,E;const N=g.req.message[Symbol.asyncIterator]();C||(v=N.throw)===null||v===void 0||v.call(N,this.reason).catch(()=>{}),(E=N.return)===null||E===void 0||E.call(N).catch(()=>{})}),p(k).then(v=>Object.assign(Object.assign({},v),{message:{[Symbol.asyncIterator](){const E=v.message[Symbol.asyncIterator]();return{next:()=>E.next().then(N=>(N.done==1&&(C=!0,x()),N),y)}}}}),y)}({interceptors:t.interceptors,timeoutMs:i,signal:s,req:{stream:!0,service:o,method:r,url:k_(t.baseUrl,o,r),init:{method:"POST",credentials:(d=t.credentials)!==null&&d!==void 0?d:"same-origin",redirect:"error",mode:"cors"},header:D_(r.kind,n,i,a),contextValues:c??v_(),message:l},next:async g=>{var p;const b=(p=t.fetch)!==null&&p!==void 0?p:globalThis.fetch,y=await b(g.url,Object.assign(Object.assign({},g.init),{headers:g.header,signal:g.signal,body:await _(g.message)}));if(R_(r.kind,y.status,y.headers),y.body===null)throw"missing response body";const x=new Headers;return Object.assign(Object.assign({},g),{header:y.headers,trailer:x,message:m(y.body,x,y.headers)})}})}}}({baseUrl:"https://web-backend.codeium.com",useBinaryFormat:!0}),h5=function(t,e){return function(n,o){const r={};for(const[s,i]of Object.entries(n.methods)){const a=o(Object.assign(Object.assign({},i),{localName:s,service:n}));a!=null&&(r[s]=a)}return r}(t,n=>{switch(n.kind){case Rn.Unary:return function(o,r,s){return async function(i,a){var l,c;const d=await o.unary(r,s,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,i,a==null?void 0:a.contextValues);return(l=a==null?void 0:a.onHeader)===null||l===void 0||l.call(a,d.header),(c=a==null?void 0:a.onTrailer)===null||c===void 0||c.call(a,d.trailer),d.message}}(e,t,n);case Rn.ServerStreaming:return function(o,r,s){return function(i,a){return x_(o.stream(r,s,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,function(l){return ZE(this,arguments,function*(){yield Ci(yield*QE(XE(l)))})}([i]),a==null?void 0:a.contextValues),a)}}(e,t,n);case Rn.ClientStreaming:return function(o,r,s){return async function(i,a){var l,c,d,h,f,m;const _=await o.stream(r,s,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,i,a==null?void 0:a.contextValues);let g;(f=a==null?void 0:a.onHeader)===null||f===void 0||f.call(a,_.header);try{for(var p,b=!0,y=y_(_.message);!(l=(p=await y.next()).done);b=!0)h=p.value,b=!1,g=h}catch(x){c={error:x}}finally{try{b||l||!(d=y.return)||await d.call(y)}finally{if(c)throw c.error}}if(!g)throw new Kt("protocol error: missing response message",pt.Internal);return(m=a==null?void 0:a.onTrailer)===null||m===void 0||m.call(a,_.trailer),g}}(e,t,n);case Rn.BiDiStreaming:return function(o,r,s){return function(i,a){return x_(o.stream(r,s,a==null?void 0:a.signal,a==null?void 0:a.timeoutMs,a==null?void 0:a.headers,i,a==null?void 0:a.contextValues),a)}}(e,t,n);default:return null}})}(c5,u5);let bl;try{bl=crypto.randomUUID()}catch{bl="10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^(crypto.getRandomValues(new Uint8Array(1))[0]??0)&15>>+t/4).toString(16))}async function f5(t,e){const n=t.state.facet(ml),{override:o}=t.state.facet(b_),r=await o(),s=t.state,i=s.selection.main.head,a=s.doc.toString();try{const l=await async function({text:_,cursorOffset:g,config:p,otherDocuments:b}){return await h5.getCompletions({metadata:{ideName:"web",ideVersion:"0.0.5",extensionName:"@valtown/codemirror-codeium",extensionVersion:"1.0.0",apiKey:p.apiKey,sessionId:bl,authSource:p.authSource},document:{text:_,cursorOffset:BigInt(g),language:p.language,editorLanguage:"typescript",lineEnding:`
|
105
|
+
`},editorOptions:{tabSize:2n,insertSpaces:!0},otherDocuments:b,multilineConfig:void 0},{headers:{Authorization:`Basic ${p.apiKey}-${bl}`}})}({text:a,cursorOffset:i,config:n,otherDocuments:r});if(!l||l.completionItems.length===0||e!==void 0&&i!==e||ba(t.state)==="active"||!t.hasFocus)return;const c=l.completionItems.map(_=>{let g=0;return _.completionParts.filter(p=>p.type!==3).map(p=>{const b=Number(p.offset),y=p.type===2?`
|
106
|
+
${p.text}`:p.text,x={absoluteStartPos:g+b,absoluteEndPos:g+b+y.length,from:b,to:b,insert:y};return g+=y.length,x})}),d=0,h=c.at(d);if(!h)return;const f=ya.of(h,s.doc.length),m=f.invert(s.doc);t.dispatch({changes:f,effects:Jd.of({index:d,reverseChangeSet:m,changeSpecs:c}),annotations:[pl.of(null),Zr.of(null),xa.addToHistory.of(!1)]})}catch(l){console.warn("copilot completion failed",l),await new Promise(c=>setTimeout(c,300))}}function m5(){let t=null,e=0;return st.updateListener.of(n=>{const o=n.view.state.facet(ml);if(!o.alwaysOn||!function(s){return s.docChanged&&!s.transactions.some(i=>i.effects.some(a=>a.is(Kd)||a.is(Xd)))}(n)||(t&&clearTimeout(t),function(s){if(!s.view.hasFocus||s.state.field(Ir)||ba(s.state)==="active")return!0;for(const i of s.transactions)if(i.annotation(Zr)!==void 0)return!0}(n)))return;const r=n.state.selection.main.head;o.shouldComplete&&!o.shouldComplete(new kB(n.view.state,r,!1))||(t=setTimeout(async()=>{r===e&&await f5(n.view,e)},o.timeout),e=r)})}function L_(t){var r;const e=t.state.field(Ir);if(!e)return!1;const n=(r=e.reverseChangeSet)==null?void 0:r.invert(t.state.doc);t.dispatch({changes:e.reverseChangeSet,effects:Kd.of(null),annotations:[pl.of(null),Zr.of(null),xa.addToHistory.of(!1)]});let o=0;return n==null||n.iterChangedRanges((s,i,a,l)=>{o=l}),t.dispatch({changes:n,selection:Bo.cursor(o),annotations:[Zr.of(null),xa.addToHistory.of(!0)]}),!0}const F_=t=>{const{state:e}=t,n=e.field(Ir);if(!n)return!1;const{changeSpecs:o}=n;if(o.length<2)return!1;const r=(n.index+1)%o.length,s=o.at(r);if(!s)return!1;const i=n.reverseChangeSet.apply(e.doc),a=ya.of(n.reverseChangeSet,e.doc.length).compose(ya.of(s,i.length)),l=ya.of(s,i.length).invert(i);return t.dispatch({changes:a,effects:Jd.of({index:r,reverseChangeSet:l,changeSpecs:o}),annotations:[pl.of(null),Zr.of(null),xa.addToHistory.of(!1)]}),!0};function vu(t){const e=t.state.field(Ir);return!!e&&(t.dispatch({changes:e.reverseChangeSet,effects:Xd.of(null),annotations:[pl.of(null),Zr.of(null),xa.addToHistory.of(!1)]}),!1)}function p5(){return st.domEventHandlers({keydown:(t,e)=>(t.key!=="]"||!t.ctrlKey)&&t.key!=="Shift"&&t.key!=="Control"&&t.key!=="Alt"&&t.key!=="Meta"&&function(n,o){return!!n.state.field(Ir)&&(o==="Tab"?L_(n):vu(n))}(e,t.key),mouseup(t,e){const n=t.target;return n.nodeName==="BUTTON"&&n.dataset.action==="codeium-cycle"?(F_(e),t.stopPropagation(),t.preventDefault(),!0):function(o){var a,l;let r=!1;const s=(a=o.state.selection.asSingle().ranges.at(0))==null?void 0:a.head,i=o.state.field(Ir);return!(s===void 0||!i)&&((l=i.decorations)==null||l.between(s,s,()=>{r=!0}),r)}(e)?L_(e):vu(e)}})}const g5=new Lc,ku=Dt.get("@github/copilot-language-server"),z_={delay:500,includeKeymap:!0,events:{shouldShowSuggestion:t=>t.hasFocus,beforeSuggestionFetch:t=>t.hasFocus}},_5=t=>{const e=[];return t.copilot==="codeium"&&t.codeium_api_key&&e.push(function(n){return[ml.of(n),Ir,Vo.highest(Yn.of([{key:"Ctrl-]",run:F_}])),Vo.highest(st.updateListener.of(o=>{o.focusChanged&&vu(o.view)})),Vo.high(p5()),m5()]}({apiKey:t.codeium_api_key,language:Yo.PYTHON}),b_.of({override:async()=>[{text:Pc(""),language:Yo.PYTHON,editorLanguage:"python"}]})),t.copilot==="github"&&e.push(F1({...z_,fetchFn:async n=>{if(!fH()||n.doc.length===0)return"";await new Promise(i=>setTimeout(i,20));const o=n.doc.toString(),r=function(i,a){const l=i.doc.toString(),c=a.split(`
|
107
|
+
`).length-l.split(`
|
108
|
+
`).length,d=function(h,f){const m=h.lineAt(f);return{line:m.number-1,character:f-m.from}}(i.doc,i.selection.main.head);return d.line+=c,{textDocument:{uri:`file://${mH}`,version:"replace_me"},position:d,context:{triggerKind:CB.InlineCompletionTriggerKind.Automatic},formattingOptions:{tabSize:i.tabSize,insertSpaces:!0}}}(n,Pc(o));return function(i,a,l){if(!i)return ku.debug("No response from copilot"),"";const c=Array.isArray(i)?i[0]:i.items[0];if(!c)return ku.debug("No response from copilot"),"";const{insertText:d,range:h}=c,f=String(d);if(!h)return ku.error("No range from copilot"),f;const m=h.start.character-a.character,_=m<0?f.slice(-m):f,g=l.doc.sliceString(l.selection.main.head,l.doc.length);for(let p=0;p<_.length;p++){const b=_.slice(p);if(g.startsWith(b))return _.slice(0,p)}return _}(await FS().getCompletion(r),r.position,n)}})),t.copilot==="custom"&&e.push(F1({...z_,fetchFn:async n=>{if(n.doc.length===0)return"";const o=n.doc.sliceString(0,n.selection.main.head),r=n.doc.sliceString(n.selection.main.head,n.doc.length);if(o.length===0)return"";const s=n.field(Fc).type;let i=await SB.post("/ai/inline_completion",{prefix:o,suffix:r,language:s});return o&&i.startsWith(o)&&(i=i.slice(o.length)),r&&i.endsWith(r)&&(i=i.slice(0,-r.length)),i}})),[...e,Vo.highest(Yn.of([{key:"Escape",run:n=>{const o=L1(n);return!R4(n)&&o}}])),g5.of(hH())]};function b5(t){return[Yn.of([{key:"Escape",preventDefault:!1,run:kN},{key:t.getHotkey("cell.selectNextOccurrence").key,preventDefault:!0,run:jB},{key:t.getHotkey("cell.findAndReplace").key,preventDefault:!0,run:$g}]),NB(),IN,Ua,AN]}const y5=dt.mark({class:"underline"}),B_=Rt.define(),U_=Rt.define(),V_=Rt.define(),x5=On.define({create:()=>dt.none,update(t,e){let n=t.map(e.changes);for(const o of e.effects)o.is(B_)?n=t.update({add:[y5.range(o.value.from,o.value.to)]}):o.is(U_)?n=t.update({add:[EB.range(o.value.from,o.value.to)]}):o.is(V_)&&(n=dt.none);return n},provide:t=>st.decorations.from(t)});class w5{constructor(e,n){this.view=void 0,this.commandClickMode=void 0,this.hoveredRange=void 0,this.onClick=void 0,this.keydown=o=>{o.key!=="Meta"&&o.key!=="Control"||(this.commandClickMode=!0,this.view.dom.addEventListener("mousemove",this.mousemove),this.view.dom.addEventListener("click",this.click))},this.keyup=o=>{o.key!=="Meta"&&o.key!=="Control"||this.exitCommandClickMode()},this.windowBlur=()=>{this.commandClickMode&&this.exitCommandClickMode()},this.mousemove=o=>{if(!o.metaKey&&!o.ctrlKey)return void this.exitCommandClickMode();if(!this.commandClickMode)return void this.clearUnderline();const r=this.view.posAtCoords({x:o.clientX,y:o.clientY});if(r==null)return void this.clearUnderline();const s=this.view.state.field(IB,!1),i=s==null?void 0:s.ranges.find(l=>r>=l.from&&r<=l.to);if(i){const{from:l,to:c}=i;return this.hoveredRange&&this.hoveredRange.from===l&&this.hoveredRange.to===c?void 0:(this.clearUnderline(),this.hoveredRange={from:l,to:c,position:r},void this.view.dispatch({effects:U_.of(this.hoveredRange)}))}const a=AB(this.view.state).cursorAt(r);if(a.name==="VariableName"){const{from:l,to:c}=a;if(this.hoveredRange&&this.hoveredRange.from===l&&this.hoveredRange.to===c)return;this.clearUnderline(),this.hoveredRange={from:l,to:c,position:r},this.view.dispatch({effects:B_.of(this.hoveredRange)})}else this.clearUnderline()},this.click=o=>{if(this.hoveredRange){const r=this.view.state.doc.sliceString(this.hoveredRange.from,this.hoveredRange.to);o.preventDefault(),o.stopPropagation(),this.onClick(this.view,r),this.view.dispatch({selection:{head:this.hoveredRange.position,anchor:this.hoveredRange.position}})}},this.view=e,this.commandClickMode=!1,this.hoveredRange=null,this.onClick=n,window.addEventListener("keydown",this.keydown),window.addEventListener("keyup",this.keyup),window.addEventListener("blur",this.windowBlur),window.addEventListener("mouseleave",this.windowBlur)}update(e){}destroy(){window.removeEventListener("keydown",this.keydown),window.removeEventListener("keyup",this.keyup),window.removeEventListener("blur",this.windowBlur),window.removeEventListener("mouseleave",this.windowBlur),this.view.dom.removeEventListener("mousemove",this.mousemove),this.view.dom.removeEventListener("click",this.click)}exitCommandClickMode(){this.commandClickMode=!1,this.view.dom.removeEventListener("mousemove",this.mousemove),this.view.dom.removeEventListener("click",this.click),this.clearUnderline()}clearUnderline(){this.hoveredRange&&(this.view.dispatch({effects:V_.of(null)}),this.hoveredRange=null)}}function v5(){return[st.domEventHandlers({paste:(t,e)=>{var r;const n=(r=t.clipboardData)==null?void 0:r.getData("text/plain");if(!(n!=null&&n.includes("@app.cell")))return!1;const o=function(s){if(!s.includes("@app.cell"))return[];const i=[],a=s.split(`
|
109
|
+
`);let l=[],c=!1,d=0,h=!1,f=!1,m=0;const _=/\(/g,g=/\)/g,p=new Set(["@"]);function b(x){return(x.match(_)||[]).length-(x.match(g)||[]).length}function y(){if(l.length!==0){for(;l.length>0&&l[l.length-1].trim().startsWith("return");)l.pop();l.some(x=>x.trim()!=="")&&i.push(function(x){const k=x.split(`
|
110
|
+
`);if(k.length===0)return"";const C=k.filter(N=>N.trim().length>0);if(C.length===0)return"";const v=/^\s*/,E=Math.min(...C.map(N=>{var I;return((I=N.match(v))==null?void 0:I[0].length)??Number.POSITIVE_INFINITY}));return E===0?x.trim():k.map(N=>N.slice(E)).join(`
|
111
|
+
`).trim()}(l.join(`
|
112
|
+
`))),l=[]}}for(const x of a){const k=x.trim();(k||c)&&(k.startsWith("@app.cell")?(y(),c=!0,d=1):d>0?(k.startsWith("def")&&k.includes("(")&&!k.includes("):")&&(h=!0,m=b(k)),d--):h?(m+=b(k),m===0&&(h=!1)):c&&(p.has(k[0])||k.startsWith("if __name__")?(y(),c=k.startsWith("@")):k.startsWith("return")?k.includes("(")&&!k.endsWith(")")&&(f=!0,m=b(k)):f?(m+=b(k),m===0&&(f=!1)):l.push(x)))}return y(),i}(n);return o.length===0?!1:(e.state.facet(DB).createManyBelow(o),!0)}})]}const $_=Rt.define(),H_=new Lc,Su="marimo-connecting-indicator";function W_(t,e){const n=function(){let o=document.getElementById(Su);return o||(o=document.createElement("div"),o.id=Su,o.textContent="Connecting\u2026",o.style.position="fixed",o.style.zIndex="9999",o.style.background="#222",o.style.color="#fff",o.style.padding="2px 8px",o.style.borderRadius="6px",o.style.fontSize="0.9em",o.style.boxShadow="0 2px 8px rgba(0,0,0,0.15)",o.style.pointerEvents="none",o.style.display="none",document.body.append(o)),o}();n.style.left=`${t}px`,n.style.top=`${e}px`,n.style.display="block",n.textContent="Connecting\u2026"}function Cu(){const t=document.getElementById(Su);t&&(t.style.display="none")}let Nu=null;function k5(t){const e=()=>t.get(mn).state;let n=!Qc(e());const o=Mn.define(r=>{let s=!1;const i=r.dom;function a(){(function(){const h=r.state.selection.main,f=r.coordsAtPos(h.head);f?W_(f.left+2,f.bottom+2):W_(window.innerWidth/2,.1*window.innerHeight),Nu&&window.clearTimeout(Nu),Nu=window.setTimeout(Cu,1500)})()}function l(){s||(i.addEventListener("keydown",a,{capture:!0}),i.addEventListener("paste",a,{capture:!0}),s=!0)}function c(){s&&(i.removeEventListener("keydown",a,{capture:!0}),i.removeEventListener("paste",a,{capture:!0}),s=!1)}const d=t.sub(mn,()=>{t.get(mn).state===Vt.CONNECTING?l():(c(),Cu())});return vH(e())&&l(),{destroy(){c(),d(),Cu()}}});return[H_.of(fr.readOnly.of(n)),fr.transactionExtender.of(r=>{for(const s of r.effects)if(s.is($_)){const i=s.value;if(i!==n)return n=i,{effects:H_.reconfigure(fr.readOnly.of(i))}}return null}),Mn.define(r=>{const s=t.sub(mn,()=>{const i=t.get(mn),a=!Qc(i.state);r.dispatch({effects:$_.of(a)})});return{destroy(){s()}}}),o]}const Ht=({variant:t,settings:e,styles:n})=>{const o=st.theme({"&":{backgroundColor:e.background,color:e.foreground},".cm-content":{caretColor:e.caret},".cm-cursor, .cm-dropCursor":{borderLeftColor:e.caret},"&.cm-focused .cm-selectionBackgroundm .cm-selectionBackground, .cm-content ::selection":{backgroundColor:e.selection},".cm-activeLine":{backgroundColor:e.lineHighlight},".cm-gutters":{backgroundColor:e.gutterBackground,color:e.gutterForeground},".cm-activeLineGutter":{backgroundColor:e.lineHighlight}},{dark:t==="dark"}),r=RB.define(n);return[o,P4(r)]};Ht({variant:"dark",settings:{background:"#200020",foreground:"#D0D0FF",caret:"#7070FF",selection:"#80000080",gutterBackground:"#200020",gutterForeground:"#C080C0",lineHighlight:"#80000040"},styles:[{tag:P.comment,color:"#404080"},{tag:[P.string,P.regexp],color:"#999999"},{tag:P.number,color:"#7090B0"},{tag:[P.bool,P.null],color:"#8080A0"},{tag:[P.punctuation,P.derefOperator],color:"#805080"},{tag:P.keyword,color:"#60B0FF"},{tag:P.definitionKeyword,color:"#B0FFF0"},{tag:P.moduleKeyword,color:"#60B0FF"},{tag:P.operator,color:"#A0A0FF"},{tag:[P.variableName,P.self],color:"#008080"},{tag:P.operatorKeyword,color:"#A0A0FF"},{tag:P.controlKeyword,color:"#80A0FF"},{tag:P.className,color:"#70E080"},{tag:[P.function(P.propertyName),P.propertyName],color:"#50A0A0"},{tag:P.tagName,color:"#009090"},{tag:P.modifier,color:"#B0FFF0"},{tag:[P.squareBracket,P.attributeName],color:"#D0D0FF"}]}),Ht({variant:"light",settings:{background:"#fcfcfc",foreground:"#5c6166",caret:"#ffaa33",selection:"#036dd626",gutterBackground:"#fcfcfc",gutterForeground:"#8a919966",lineHighlight:"#8a91991a"},styles:[{tag:P.comment,color:"#787b8099"},{tag:P.string,color:"#86b300"},{tag:P.regexp,color:"#4cbf99"},{tag:[P.number,P.bool,P.null],color:"#ffaa33"},{tag:P.variableName,color:"#5c6166"},{tag:[P.definitionKeyword,P.modifier],color:"#fa8d3e"},{tag:[P.keyword,P.special(P.brace)],color:"#fa8d3e"},{tag:P.operator,color:"#ed9366"},{tag:P.separator,color:"#5c6166b3"},{tag:P.punctuation,color:"#5c6166"},{tag:[P.definition(P.propertyName),P.function(P.variableName)],color:"#f2ae49"},{tag:[P.className,P.definition(P.typeName)],color:"#22a4e6"},{tag:[P.tagName,P.typeName,P.self,P.labelName],color:"#55b4d4"},{tag:P.angleBracket,color:"#55b4d480"},{tag:P.attributeName,color:"#f2ae49"}]}),Ht({variant:"dark",settings:{background:"#15191EFA",foreground:"#EEF2F7",caret:"#C4C4C4",selection:"#90B2D557",gutterBackground:"#15191EFA",gutterForeground:"#aaaaaa95",lineHighlight:"#57575712"},styles:[{tag:P.comment,color:"#6E6E6E"},{tag:[P.string,P.regexp,P.special(P.brace)],color:"#5C81B3"},{tag:P.number,color:"#C1E1B8"},{tag:P.bool,color:"#53667D"},{tag:[P.definitionKeyword,P.modifier,P.function(P.propertyName)],color:"#A3D295",fontWeight:"bold"},{tag:[P.keyword,P.moduleKeyword,P.operatorKeyword,P.operator],color:"#697A8E",fontWeight:"bold"},{tag:[P.variableName,P.attributeName],color:"#708E67"},{tag:[P.function(P.variableName),P.definition(P.propertyName),P.derefOperator],color:"#fff"},{tag:P.tagName,color:"#A3D295"}]}),Ht({variant:"dark",settings:{background:"#2e241d",foreground:"#BAAE9E",caret:"#A7A7A7",selection:"#DDF0FF33",gutterBackground:"#28211C",gutterForeground:"#BAAE9E90",lineHighlight:"#FFFFFF08"},styles:[{tag:P.comment,color:"#666666"},{tag:[P.string,P.special(P.brace)],color:"#54BE0D"},{tag:P.regexp,color:"#E9C062"},{tag:P.number,color:"#CF6A4C"},{tag:[P.keyword,P.operator],color:"#5EA6EA"},{tag:P.variableName,color:"#7587A6"},{tag:[P.definitionKeyword,P.modifier],color:"#F9EE98"},{tag:[P.propertyName,P.function(P.variableName)],color:"#937121"},{tag:[P.typeName,P.angleBracket,P.tagName],color:"#9B859D"}]}),Ht({variant:"dark",settings:{background:"#3b2627",foreground:"#E6E1C4",caret:"#E6E1C4",selection:"#16120E",gutterBackground:"#3b2627",gutterForeground:"#E6E1C490",lineHighlight:"#1F1611"},styles:[{tag:P.comment,color:"#6B4E32"},{tag:[P.keyword,P.operator,P.derefOperator],color:"#EF5D32"},{tag:P.className,color:"#EFAC32",fontWeight:"bold"},{tag:[P.typeName,P.propertyName,P.function(P.variableName),P.definition(P.variableName)],color:"#EFAC32"},{tag:P.definition(P.typeName),color:"#EFAC32",fontWeight:"bold"},{tag:P.labelName,color:"#EFAC32",fontWeight:"bold"},{tag:[P.number,P.bool],color:"#6C99BB"},{tag:[P.variableName,P.self],color:"#7DAF9C"},{tag:[P.string,P.special(P.brace),P.regexp],color:"#D9D762"},{tag:[P.angleBracket,P.tagName,P.attributeName],color:"#EFCB43"}]}),Ht({variant:"dark",settings:{background:"#000205",foreground:"#FFFFFF",caret:"#E60065",selection:"#E60C6559",gutterBackground:"#000205",gutterForeground:"#ffffff90",lineHighlight:"#4DD7FC1A"},styles:[{tag:P.comment,color:"#404040"},{tag:[P.string,P.special(P.brace),P.regexp],color:"#00D8FF"},{tag:P.number,color:"#E62286"},{tag:[P.variableName,P.attributeName,P.self],color:"#E62286",fontWeight:"bold"},{tag:P.function(P.variableName),color:"#fff",fontWeight:"bold"}]}),Ht({variant:"light",settings:{background:"#fff",foreground:"#000",caret:"#000",selection:"#BDD5FC",gutterBackground:"#fff",gutterForeground:"#00000070",lineHighlight:"#FFFBD1"},styles:[{tag:P.comment,color:"#BCC8BA"},{tag:[P.string,P.special(P.brace),P.regexp],color:"#5D90CD"},{tag:[P.number,P.bool,P.null],color:"#46A609"},{tag:P.keyword,color:"#AF956F"},{tag:[P.definitionKeyword,P.modifier],color:"#C52727"},{tag:[P.angleBracket,P.tagName,P.attributeName],color:"#606060"},{tag:P.self,color:"#000"}]}),Ht({variant:"dark",settings:{background:"#00254b",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#B36539BF",gutterBackground:"#00254b",gutterForeground:"#FFFFFF70",lineHighlight:"#00000059"},styles:[{tag:P.comment,color:"#0088FF"},{tag:P.string,color:"#3AD900"},{tag:P.regexp,color:"#80FFC2"},{tag:[P.number,P.bool,P.null],color:"#FF628C"},{tag:[P.definitionKeyword,P.modifier],color:"#FFEE80"},{tag:P.variableName,color:"#CCCCCC"},{tag:P.self,color:"#FF80E1"},{tag:[P.className,P.definition(P.propertyName),P.function(P.variableName),P.definition(P.typeName),P.labelName],color:"#FFDD00"},{tag:[P.keyword,P.operator],color:"#FF9D00"},{tag:[P.propertyName,P.typeName],color:"#80FFBB"},{tag:P.special(P.brace),color:"#EDEF7D"},{tag:P.attributeName,color:"#9EFFFF"},{tag:P.derefOperator,color:"#fff"}]}),Ht({variant:"dark",settings:{background:"#060521",foreground:"#E0E0E0",caret:"#FFFFFFA6",selection:"#122BBB",gutterBackground:"#060521",gutterForeground:"#E0E0E090",lineHighlight:"#FFFFFF0F"},styles:[{tag:P.comment,color:"#AEAEAE"},{tag:[P.string,P.special(P.brace),P.regexp],color:"#8DFF8E"},{tag:[P.className,P.definition(P.propertyName),P.function(P.variableName),P.function(P.definition(P.variableName)),P.definition(P.typeName)],color:"#A3EBFF"},{tag:[P.number,P.bool,P.null],color:"#62E9BD"},{tag:[P.keyword,P.operator],color:"#2BF1DC"},{tag:[P.definitionKeyword,P.modifier],color:"#F8FBB1"},{tag:[P.variableName,P.self],color:"#B683CA"},{tag:[P.angleBracket,P.tagName,P.typeName,P.propertyName],color:"#60A4F1"},{tag:P.derefOperator,color:"#E0E0E0"},{tag:P.attributeName,color:"#7BACCA"}]}),Ht({variant:"dark",settings:{background:"#2d2f3f",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"#44475a",gutterBackground:"#282a36",gutterForeground:"rgb(144, 145, 148)",lineHighlight:"#44475a"},styles:[{tag:P.comment,color:"#6272a4"},{tag:[P.string,P.special(P.brace)],color:"#f1fa8c"},{tag:[P.number,P.self,P.bool,P.null],color:"#bd93f9"},{tag:[P.keyword,P.operator],color:"#ff79c6"},{tag:[P.definitionKeyword,P.typeName],color:"#8be9fd"},{tag:P.definition(P.typeName),color:"#f8f8f2"},{tag:[P.className,P.definition(P.propertyName),P.function(P.variableName),P.attributeName],color:"#50fa7b"}]}),Ht({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#80C7FF",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#C1E2F8"},styles:[{tag:P.comment,color:"#AAAAAA"},{tag:[P.keyword,P.operator,P.typeName,P.tagName,P.propertyName],color:"#2F6F9F",fontWeight:"bold"},{tag:[P.attributeName,P.definition(P.propertyName)],color:"#4F9FD0"},{tag:[P.className,P.string,P.special(P.brace)],color:"#CF4F5F"},{tag:P.number,color:"#CF4F5F",fontWeight:"bold"},{tag:P.variableName,fontWeight:"bold"}]}),Ht({variant:"light",settings:{background:"#f2f1f8",foreground:"#0c006b",caret:"#5c49e9",selection:"#d5d1f2",gutterBackground:"#f2f1f8",gutterForeground:"#0c006b70",lineHighlight:"#e1def3"},styles:[{tag:P.comment,color:"#9995b7"},{tag:P.keyword,color:"#ff5792",fontWeight:"bold"},{tag:[P.definitionKeyword,P.modifier],color:"#ff5792"},{tag:[P.className,P.tagName,P.definition(P.typeName)],color:"#0094f0"},{tag:[P.number,P.bool,P.null,P.special(P.brace)],color:"#5842ff"},{tag:[P.definition(P.propertyName),P.function(P.variableName)],color:"#0095a8"},{tag:P.typeName,color:"#b3694d"},{tag:[P.propertyName,P.variableName],color:"#fa8900"},{tag:P.operator,color:"#ff5792"},{tag:P.self,color:"#e64100"},{tag:[P.string,P.regexp],color:"#00b368"},{tag:[P.paren,P.bracket],color:"#0431fa"},{tag:P.labelName,color:"#00bdd6"},{tag:P.attributeName,color:"#e64100"},{tag:P.angleBracket,color:"#9995b7"}]}),Ht({variant:"light",settings:{background:"#faf4ed",foreground:"#575279",caret:"#575279",selection:"#6e6a8614",gutterBackground:"#faf4ed",gutterForeground:"#57527970",lineHighlight:"#6e6a860d"},styles:[{tag:P.comment,color:"#9893a5"},{tag:[P.bool,P.null],color:"#286983"},{tag:P.number,color:"#d7827e"},{tag:P.className,color:"#d7827e"},{tag:[P.angleBracket,P.tagName,P.typeName],color:"#56949f"},{tag:P.attributeName,color:"#907aa9"},{tag:P.punctuation,color:"#797593"},{tag:[P.keyword,P.modifier],color:"#286983"},{tag:[P.string,P.regexp],color:"#ea9d34"},{tag:P.variableName,color:"#d7827e"}]}),Ht({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#FFFD0054",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#00000008"},styles:[{tag:P.comment,color:"#CFCFCF"},{tag:[P.number,P.bool,P.null],color:"#E66C29"},{tag:[P.className,P.definition(P.propertyName),P.function(P.variableName),P.labelName,P.definition(P.typeName)],color:"#2EB43B"},{tag:P.keyword,color:"#D8B229"},{tag:P.operator,color:"#4EA44E",fontWeight:"bold"},{tag:[P.definitionKeyword,P.modifier],color:"#925A47"},{tag:P.string,color:"#704D3D"},{tag:P.typeName,color:"#2F8996"},{tag:[P.variableName,P.propertyName],color:"#77ACB0"},{tag:P.self,color:"#77ACB0",fontWeight:"bold"},{tag:P.regexp,color:"#E3965E"},{tag:[P.tagName,P.angleBracket],color:"#BAA827"},{tag:P.attributeName,color:"#B06520"},{tag:P.derefOperator,color:"#000"}]}),Ht({variant:"light",settings:{background:"#fef7e5",foreground:"#586E75",caret:"#000000",selection:"#073642",gutterBackground:"#fef7e5",gutterForeground:"#586E7580",lineHighlight:"#EEE8D5"},styles:[{tag:P.comment,color:"#93A1A1"},{tag:P.string,color:"#2AA198"},{tag:P.regexp,color:"#D30102"},{tag:P.number,color:"#D33682"},{tag:P.variableName,color:"#268BD2"},{tag:[P.keyword,P.operator,P.punctuation],color:"#859900"},{tag:[P.definitionKeyword,P.modifier],color:"#073642",fontWeight:"bold"},{tag:[P.className,P.self,P.definition(P.propertyName)],color:"#268BD2"},{tag:P.function(P.variableName),color:"#268BD2"},{tag:[P.bool,P.null],color:"#B58900"},{tag:P.tagName,color:"#268BD2",fontWeight:"bold"},{tag:P.angleBracket,color:"#93A1A1"},{tag:P.attributeName,color:"#93A1A1"},{tag:P.typeName,color:"#859900"}]}),Ht({variant:"light",settings:{background:"#FFFFFF",foreground:"#4D4D4C",caret:"#AEAFAD",selection:"#D6D6D6",gutterBackground:"#FFFFFF",gutterForeground:"#4D4D4C80",lineHighlight:"#EFEFEF"},styles:[{tag:P.comment,color:"#8E908C"},{tag:[P.variableName,P.self,P.propertyName,P.attributeName,P.regexp],color:"#C82829"},{tag:[P.number,P.bool,P.null],color:"#F5871F"},{tag:[P.className,P.typeName,P.definition(P.typeName)],color:"#C99E00"},{tag:[P.string,P.special(P.brace)],color:"#718C00"},{tag:P.operator,color:"#3E999F"},{tag:[P.definition(P.propertyName),P.function(P.variableName)],color:"#4271AE"},{tag:P.keyword,color:"#8959A8"},{tag:P.derefOperator,color:"#4D4D4C"}]});const S5=[Ht({variant:"dark",settings:{background:"#282c34",foreground:"#abb2bf",caret:"#528bff",selection:"#3E4451",lineHighlight:"#2c313c",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:P.comment,color:"#5c6370"},{tag:P.variableName,color:"#abb2bf"},{tag:[P.string,P.special(P.brace)],color:"#98c379"},{tag:P.number,color:"#d19a66"},{tag:P.bool,color:"#d19a66"},{tag:P.null,color:"#d19a66"},{tag:P.keyword,color:"#c678dd",fontWeight:500},{tag:P.className,color:"#61afef"},{tag:P.definition(P.typeName),color:"#61afef"},{tag:P.typeName,color:"#56b6c2"},{tag:P.angleBracket,color:"#abb2bf"},{tag:P.tagName,color:"#e06c75"},{tag:P.attributeName,color:"#d19a66"},{tag:P.operator,color:"#56b6c2",fontWeight:500},{tag:[P.function(P.variableName)],color:"#61afef"},{tag:[P.propertyName],color:"#e5c07b"}]}),st.theme({".mo-cm-reactive-reference":{fontWeight:"400",color:"#2a7aa5",borderBottom:"2px solid #bad3de"},".mo-cm-reactive-reference-hover":{cursor:"pointer",borderBottomWidth:"3px",borderBottomColor:"#4a90a5"}})],C5=[Ht({variant:"light",settings:{background:"#ffffff",foreground:"#000000",caret:"#000000",selection:"#d7d4f0",lineHighlight:"#cceeff44",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:P.comment,color:"#708090"},{tag:P.variableName,color:"#000000"},{tag:[P.string,P.special(P.brace)],color:"#a11"},{tag:P.number,color:"#164"},{tag:P.bool,color:"#219"},{tag:P.null,color:"#219"},{tag:P.keyword,color:"#708",fontWeight:500},{tag:P.className,color:"#00f"},{tag:P.definition(P.typeName),color:"#00f"},{tag:P.typeName,color:"#085"},{tag:P.angleBracket,color:"#000000"},{tag:P.tagName,color:"#170"},{tag:P.attributeName,color:"#00c"},{tag:P.operator,color:"#a2f",fontWeight:500},{tag:[P.function(P.variableName)],color:"#00c"},{tag:[P.propertyName],color:"#05a"}]}),st.theme({".mo-cm-reactive-reference":{fontWeight:"400",color:"#005f87",borderBottom:"2px solid #bad3de"},".mo-cm-reactive-reference-hover":{cursor:"pointer",borderBottomWidth:"3px"}})];function q_(t){const{showPlaceholder:e,enableAI:n}=t;return e?"marimo-import":n?"ai":"none"}const N5=t=>{const{cellId:e,keymapConfig:n,hotkeys:o,enableAI:r,cellActions:s,completionConfig:i,lspConfig:a,diagnosticsConfig:l,displayConfig:c}=t,d=q_(t);return[pH(n,o),[st.domEventHandlers({drop:(f,m)=>{var p,b;const _=(p=f.dataTransfer)==null?void 0:p.files[0];if(_!=null&&_.type.startsWith("text/"))return f.preventDefault(),MB(m,_),!0;if(_!=null&&_.type.startsWith("image/"))return f.preventDefault(),OB(m,_),!0;const g=(b=f.dataTransfer)==null?void 0:b.getData("text/plain");if(g){f.preventDefault();const y=m.posAtCoords({x:f.clientX,y:f.clientY});return y!==null&&m.dispatch({changes:{from:y,to:y,insert:g},scrollIntoView:!0}),!0}return!1},dragover:f=>{f.preventDefault()}})],v5(),kE(),PB(i,o,d,a,l),LB(e,o,s),j5(t),[x5,(h=(f,m)=>{TB(f,m)},Mn.define(f=>new w5(f,h))),st.baseTheme({".underline":{textDecoration:"underline",cursor:"pointer",color:"var(--link)"}})],l!=null&&l.enabled?FB():[],r&&Cm("inline_ai_tooltip")?uE({prompt:f=>async function(m){var k,C;const _=`
|
113
|
+
${m.codeBefore}
|
114
|
+
<rewrite_this>
|
115
|
+
${m.selection}
|
116
|
+
</rewrite_this>
|
117
|
+
${m.codeAfter}
|
118
|
+
`.trim(),g=T4();await M4();const p=await fetch(g.getAiURL("completion").toString(),{method:"POST",headers:g.headers(),body:JSON.stringify({prompt:m.prompt,code:_,selectedText:m.selection,includeOtherCode:"",language:m.language})}),b=((k=m.selection.match(/^\s*/))==null?void 0:k[0])||"",y=(C=p.body)==null?void 0:C.getReader();if(!y)throw new Error("Failed to get response reader");let x="";for(;;){const{done:v,value:E}=await y.read();if(v)break;x+=new TextDecoder().decode(E)}return x.startsWith(b)||(x=b+x),x}({prompt:f.prompt,selection:f.selection,codeBefore:f.codeBefore,codeAfter:f.codeAfter,language:W3(f.editorView)})}):[],k5(ct),zB(e,c.reference_highlighting??!1)];var h},j5=t=>{const{theme:e,hotkeys:n,completionConfig:o,cellId:r,lspConfig:s,diagnosticsConfig:i}=t,a=q_(t);return[st.lineWrapping,BB(),UB(),VB(),$B(),HB(),WB(),qB(),GB({position:"fixed",parent:document.querySelector("#App")??void 0}),YB(),e==="dark"?S5:C5,JB(s),_5(o),KB(),XB(),SE(),Vo.high(Yn.of(oU)),ZB(),QB(),eU.of(" "),P4(rU,{fallback:!0}),Yn.of(sU),tU({placeholderType:a,completionConfig:o,hotkeys:n,cellId:r,lspConfig:{...s,diagnostics:i}}),nU.of(iU()),fr.allowMultipleSelections.of(!0),b5(n),Yn.of([{key:"Tab",run:l=>aU(l)||(c=>{const{from:d,to:h}=c.state.selection.main;if(d!==h)return!1;const f=c.state.doc.lineAt(h);return f.text.slice(0,h-f.from).trim()!==""&&uU(c)})(l)||lU(l),preventDefault:!0},{key:n.getHotkey("completion.moveDown").key,run:l=>ba(l.state)!==null&&(L4(!0)(l),!0),preventDefault:!0},{key:n.getHotkey("completion.moveUp").key,run:l=>ba(l.state)!==null&&(L4(!1)(l),!0),preventDefault:!0}]),Yn.of([...cU,dU])]},E5={width:void 0,height:void 0};function G_(t,e,n){return t[e]?Array.isArray(t[e])?t[e][0][n]:t[e][n]:e==="contentBoxSize"?t.contentRect[n==="inlineSize"?"width":"height"]:void 0}function Y_(t){const e=t.current;if(e===null)throw new ReferenceError("Attempting to dereference null object.");return e}let J_,K_,X_,Z_;J_=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),K_=new Intl.DateTimeFormat("en-US",{month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),X_=t=>{const e=K.c(79),{editing:n,status:o,disabled:r,staleInputs:s,edited:i,interrupted:a,elapsedTime:l,runStartTimestamp:c,lastRunStartTimestamp:d,uninstantiated:h}=t;if(!n)return null;const f=c??d;let m;e[0]!==f?(m=f?u.jsx(Z_,{lastRanTime:f}):null,e[0]=f,e[1]=m):m=e[1];const _=m;if(r&&o==="running")return Dt.error("CellStatusComponent: disabled and running"),null;if(r&&s){let g,p,b,y;return e[2]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"This cell is stale, but it's disabled and can't be run"}),e[2]=g):g=e[2],e[3]!==_?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[3]=_,e[4]=p):p=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:u.jsxs(li,{children:[u.jsx(ai,{className:"h-5 w-5",strokeWidth:1.5}),u.jsx(zc,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[5]=b):b=e[5],e[6]!==p?(y=u.jsx(Te,{content:p,usePortal:!0,children:b}),e[6]=p,e[7]=y):y=e[7],y}if(r){let g,p,b,y;return e[8]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"This cell is disabled"}),e[8]=g):g=e[8],e[9]!==_?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[9]=_,e[10]=p):p=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-disabled","data-testid":"cell-status","data-status":"disabled",children:u.jsx(ai,{className:"h-5 w-5",strokeWidth:1.5})}),e[11]=b):b=e[11],e[12]!==p?(y=u.jsx(Te,{content:p,usePortal:!0,children:b}),e[12]=p,e[13]=y):y=e[13],y}if(!s&&o==="disabled-transitively"){let g,p,b,y;return e[14]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"An ancestor of this cell is disabled, so it can't be run"}),e[14]=g):g=e[14],e[15]!==_?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[15]=_,e[16]=p):p=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"disabled-transitively",children:u.jsxs(li,{layerTop:!0,children:[u.jsx(Ma,{className:"h-5 w-5",strokeWidth:1.5}),u.jsx(ai,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[17]=b):b=e[17],e[18]!==p?(y=u.jsx(Te,{content:p,usePortal:!0,children:b}),e[18]=p,e[19]=y):y=e[19],y}if(s&&o==="disabled-transitively"){let g,p,b,y;return e[20]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"This cell is stale, but an ancestor is disabled so it can't be run"}),e[20]=g):g=e[20],e[21]!==_?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[21]=_,e[22]=p):p=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:u.jsxs(li,{children:[u.jsx(zc,{className:"h-5 w-5",strokeWidth:1}),u.jsx(ai,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[23]=b):b=e[23],e[24]!==p?(y=u.jsx(Te,{content:p,usePortal:!0,children:b}),e[24]=p,e[25]=y):y=e[25],y}if(o==="running"){let g,p,b,y,x;return e[26]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"This cell is running"}),e[26]=g):g=e[26],e[27]!==_?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[27]=_,e[28]=p):p=e[28],e[29]!==c?(b=Um.fromSeconds(c)||Um.now(),e[29]=c,e[30]=b):b=e[30],e[31]!==b?(y=u.jsx("div",{className:"cell-status-icon elapsed-time running","data-testid":"cell-status","data-status":"running",children:u.jsx(I5,{startTime:b})}),e[31]=b,e[32]=y):y=e[32],e[33]!==p||e[34]!==y?(x=u.jsx(Te,{content:p,usePortal:!0,children:y}),e[33]=p,e[34]=y,e[35]=x):x=e[35],x}if(o==="queued"){let g,p,b,y;return e[36]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("span",{children:"This cell is queued to run"}),e[36]=g):g=e[36],e[37]!==_?(p=u.jsxs("div",{className:"flex flex-col gap-1",children:[g,_]}),e[37]=_,e[38]=p):p=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx("div",{className:"cell-status-icon cell-status-queued","data-testid":"cell-status","data-status":"queued",children:u.jsx(KS,{className:"h-5 w-5",strokeWidth:1.5})}),e[39]=b):b=e[39],e[40]!==p?(y=u.jsx(Te,{content:p,usePortal:!0,children:b}),e[40]=p,e[41]=y):y=e[41],y}if(i||a||s||h){let g;e[42]!==l?(g=Na(l),e[42]=l,e[43]=g):g=e[43];const p=g;let b;e[44]!==l||e[45]!==p?(b=l?u.jsx(ed,{elapsedTime:p}):null,e[44]=l,e[45]=p,e[46]=b):b=e[46];const y=b;let x,k,C,v,E,N="";if(h)x="This cell has not yet been run";else if(a){let I;x="This cell was interrupted when it was last run",e[47]!==y?(I=u.jsxs("span",{children:["This cell ran for ",y," before being interrupted"]}),e[47]=y,e[48]=I):I=e[48],N=I}else if(i){let I;x="This cell has been modified since it was last run",e[49]!==y?(I=u.jsxs("span",{children:["This cell took ",y," to run"]}),e[49]=y,e[50]=I):I=e[50],N=I}else{let I;x="This cell has not been run with the latest inputs",e[51]!==y?(I=u.jsxs("span",{children:["This cell took ",y," to run"]}),e[51]=y,e[52]=I):I=e[52],N=I}return e[53]===Symbol.for("react.memo_cache_sentinel")?(k=u.jsx("div",{className:"cell-status-stale","data-testid":"cell-status","data-status":"outdated",children:u.jsx(zc,{className:"h-5 w-5",strokeWidth:1.5})}),e[53]=k):k=e[53],e[54]!==x?(C=u.jsx(Te,{content:x,usePortal:!0,children:k}),e[54]=x,e[55]=C):C=e[55],e[56]!==l||e[57]!==p||e[58]!==_||e[59]!==N?(v=l&&u.jsx(Te,{content:u.jsxs("div",{className:"flex flex-col gap-1",children:[N,_]}),usePortal:!0,children:u.jsx("div",{className:"elapsed-time hover-action","data-testid":"cell-status","data-status":"outdated",children:u.jsx("span",{children:p})})}),e[56]=l,e[57]=p,e[58]=_,e[59]=N,e[60]=v):v=e[60],e[61]!==C||e[62]!==v?(E=u.jsxs("div",{className:"cell-status-icon flex items-center gap-2",children:[C,v]}),e[61]=C,e[62]=v,e[63]=E):E=e[63],E}if(l!==null){let g;e[64]!==l?(g=Na(l),e[64]=l,e[65]=g):g=e[65];const p=g;let b;e[66]!==l||e[67]!==p?(b=l?u.jsx(ed,{elapsedTime:p}):null,e[66]=l,e[67]=p,e[68]=b):b=e[68];const y=b;let x,k,C,v;return e[69]!==y?(x=u.jsxs("span",{children:["This cell took ",y," to run"]}),e[69]=y,e[70]=x):x=e[70],e[71]!==_||e[72]!==x?(k=u.jsxs("div",{className:"flex flex-col gap-1",children:[x,_]}),e[71]=_,e[72]=x,e[73]=k):k=e[73],e[74]!==p?(C=u.jsx("div",{className:"cell-status-icon elapsed-time hover-action","data-testid":"cell-status","data-status":"idle",children:u.jsx("span",{children:p})}),e[74]=p,e[75]=C):C=e[75],e[76]!==k||e[77]!==C?(v=u.jsx(Te,{content:k,usePortal:!0,children:C}),e[76]=k,e[77]=C,e[78]=v):v=e[78],v}return null},ed=t=>{const e=K.c(2);let n;return e[0]!==t.elapsedTime?(n=u.jsx("span",{className:"tracking-wide font-semibold",children:t.elapsedTime}),e[0]=t.elapsedTime,e[1]=n):n=e[1],n},Z_=t=>{const e=K.c(18),n=1e3*t.lastRanTime;let o,r,s,i,a,l,c,d,h;if(e[0]!==n){const f=new Date(n),m=new Date,_=f.toDateString()===m.toDateString()?J_:K_;i="Ran at",a=" ",l=u.jsx("strong",{className:"tracking-wide font-semibold",children:_.format(f)}),c=" ",o="text-muted-foreground",r="(",s=sC(f),e[0]=n,e[1]=o,e[2]=r,e[3]=s,e[4]=i,e[5]=a,e[6]=l,e[7]=c}else o=e[1],r=e[2],s=e[3],i=e[4],a=e[5],l=e[6],c=e[7];return e[8]!==o||e[9]!==r||e[10]!==s?(d=u.jsxs("span",{className:o,children:[r,s," ago)"]}),e[8]=o,e[9]=r,e[10]=s,e[11]=d):d=e[11],e[12]!==i||e[13]!==a||e[14]!==l||e[15]!==c||e[16]!==d?(h=u.jsxs("span",{children:[i,a,l,c,d]}),e[12]=i,e[13]=a,e[14]=l,e[15]=c,e[16]=d,e[17]=h):h=e[17],h},Na=function(t){if(t===null)return"";const e=t,n=e/1e3;return n>=60?`${Math.floor(n/60)}m${Math.floor(n%60)}s`:n>=1?`${n.toFixed(2).toString()}s`:`${e.toFixed(0).toString()}ms`};const I5=t=>{const e=K.c(6);let n;e[0]!==t.startTime?(n=t.startTime.toMilliseconds(),e[0]=t.startTime,e[1]=n):n=e[1];const o=function(i){const a=T.useRef(i),[l,c]=T.useState(i);return T.useEffect(()=>{const d=setInterval(()=>{c(Um.now().toMilliseconds())},17);return()=>clearInterval(d)},[]),l-a.current}(n);let r,s;return e[2]!==o?(r=Na(o),e[2]=o,e[3]=r):r=e[3],e[4]!==r?(s=u.jsx("span",{children:r}),e[4]=r,e[5]=s):s=e[5],s};var ju="ContextMenu",[A5,YH]=z4(ju,[F4]),dn=F4(),[T5,Q_]=A5(ju),e0=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:o,dir:r,modal:s=!0}=t,[i,a]=T.useState(!1),l=dn(e),c=mr(o),d=T.useCallback(h=>{a(h),c(h)},[c]);return u.jsx(T5,{scope:e,open:i,onOpenChange:d,modal:s,children:u.jsx(CU,{...l,dir:r,open:i,onOpenChange:d,modal:s,children:n})})};e0.displayName=ju;var t0="ContextMenuTrigger",n0=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:o=!1,...r}=t,s=Q_(t0,n),i=dn(n),a=T.useRef({x:0,y:0}),l=T.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...a.current})}),c=T.useRef(0),d=T.useCallback(()=>window.clearTimeout(c.current),[]),h=f=>{a.current={x:f.clientX,y:f.clientY},s.onOpenChange(!0)};return T.useEffect(()=>d,[d]),T.useEffect(()=>{o&&d()},[o,d]),u.jsxs(u.Fragment,{children:[u.jsx(mU,{...i,virtualRef:l}),u.jsx(ei.span,{"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,...r,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:o?t.onContextMenu:Jn(t.onContextMenu,f=>{d(),h(f),f.preventDefault()}),onPointerDown:o?t.onPointerDown:Jn(t.onPointerDown,yl(f=>{d(),c.current=window.setTimeout(()=>h(f),700)})),onPointerMove:o?t.onPointerMove:Jn(t.onPointerMove,yl(d)),onPointerCancel:o?t.onPointerCancel:Jn(t.onPointerCancel,yl(d)),onPointerUp:o?t.onPointerUp:Jn(t.onPointerUp,yl(d))})]})});n0.displayName=t0;var o0=t=>{const{__scopeContextMenu:e,...n}=t,o=dn(e);return u.jsx(NU,{...o,...n})};o0.displayName="ContextMenuPortal";var r0="ContextMenuContent",s0=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=Q_(r0,n),s=dn(n),i=T.useRef(!1);return u.jsx(pU,{...s,...o,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:a=>{var l;(l=t.onCloseAutoFocus)==null||l.call(t,a),!a.defaultPrevented&&i.current&&a.preventDefault(),i.current=!1},onInteractOutside:a=>{var l;(l=t.onInteractOutside)==null||l.call(t,a),a.defaultPrevented||r.modal||(i.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});s0.displayName=r0,T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(gU,{...r,...o,ref:e})}).displayName="ContextMenuGroup";var i0=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(_U,{...r,...o,ref:e})});i0.displayName="ContextMenuLabel";var a0=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(fU,{...r,...o,ref:e})});a0.displayName="ContextMenuItem";var l0=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(bU,{...r,...o,ref:e})});l0.displayName="ContextMenuCheckboxItem",T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(yU,{...r,...o,ref:e})}).displayName="ContextMenuRadioGroup";var c0=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(xU,{...r,...o,ref:e})});c0.displayName="ContextMenuRadioItem";var d0=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(wU,{...r,...o,ref:e})});d0.displayName="ContextMenuItemIndicator";var u0=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(hU,{...r,...o,ref:e})});u0.displayName="ContextMenuSeparator",T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(vU,{...r,...o,ref:e})}).displayName="ContextMenuArrow";var h0=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(kU,{...r,...o,ref:e})});h0.displayName="ContextMenuSubTrigger";var f0=T.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dn(n);return u.jsx(SU,{...r,...o,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});function yl(t){return e=>e.pointerType!=="mouse"?t(e):void 0}f0.displayName="ContextMenuSubContent";var m0=s0,p0=i0,g0=a0,_0=l0,b0=c0,y0=d0,x0=u0,w0=h0,v0=f0;const k0=e0,S0=n0,M5=IU(o0);T.forwardRef((t,e)=>{const n=K.c(14);let o,r,s,i,a,l,c;return n[0]!==t?({className:r,inset:s,children:o,...i}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i):(o=n[1],r=n[2],s=n[3],i=n[4]),n[5]!==r||n[6]!==s?(a=AU({className:r,inset:s}),n[5]=r,n[6]=s,n[7]=a):a=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(OU,{className:"ml-auto h-4 w-4"}),n[8]=l):l=n[8],n[9]!==o||n[10]!==i||n[11]!==e||n[12]!==a?(c=u.jsxs(w0,{ref:e,className:a,...i,children:[o,l]}),n[9]=o,n[10]=i,n[11]=e,n[12]=a,n[13]=c):c=n[13],c}).displayName=w0.displayName;const C0="data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2";T.forwardRef((t,e)=>{const n=K.c(9);let o,r,s,i;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(s=Ae(B4({subcontent:!0}),C0,o),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(i=u.jsx(v0,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=i):i=n[8],i}).displayName=v0.displayName;const Eu=T.forwardRef((t,e)=>{const n=K.c(15);let o,r,s;n[0]!==t?({className:o,scrollable:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const i=s===void 0||s;let a;n[4]!==o||n[5]!==i?(a=Ae(B4(),C0,i&&"overflow-auto",o),n[4]=o,n[5]=i,n[6]=a):a=n[6];const l=i?"calc(var(--radix-context-menu-content-available-height) - 30px)":void 0;let c,d;return n[7]!==r.style||n[8]!==l?(c={...r.style,maxHeight:l},n[7]=r.style,n[8]=l,n[9]=c):c=n[9],n[10]!==r||n[11]!==e||n[12]!==a||n[13]!==c?(d=u.jsx(M5,{children:u.jsx(TU,{children:u.jsx(m0,{ref:e,className:a,style:c,...r})})}),n[10]=r,n[11]=e,n[12]=a,n[13]=c,n[14]=d):d=n[14],d});Eu.displayName=m0.displayName;const Ai=T.forwardRef((t,e)=>{const n=K.c(13);let o,r,s,i,a,l;return n[0]!==t?({className:o,inset:r,variant:i,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i):(o=n[1],r=n[2],s=n[3],i=n[4]),n[5]!==o||n[6]!==r||n[7]!==i?(a=EU({className:o,inset:r,variant:i}),n[5]=o,n[6]=r,n[7]=i,n[8]=a):a=n[8],n[9]!==s||n[10]!==e||n[11]!==a?(l=u.jsx(g0,{ref:e,className:a,...s}),n[9]=s,n[10]=e,n[11]=a,n[12]=l):l=n[12],l});Ai.displayName=g0.displayName,T.forwardRef((t,e)=>{const n=K.c(15);let o,r,s,i,a,l,c,d;return n[0]!==t?({className:s,children:r,checked:o,...i}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i):(o=n[1],r=n[2],s=n[3],i=n[4]),n[5]!==s?(a=Bc({className:s}),n[5]=s,n[6]=a):a=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=Bc(),n[7]=l):l=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx("span",{className:l,children:u.jsx(y0,{children:u.jsx(DU,{className:"h-4 w-4"})})}),n[8]=c):c=n[8],n[9]!==o||n[10]!==r||n[11]!==i||n[12]!==e||n[13]!==a?(d=u.jsxs(_0,{ref:e,className:a,checked:o,...i,children:[c,r]}),n[9]=o,n[10]=r,n[11]=i,n[12]=e,n[13]=a,n[14]=d):d=n[14],d}).displayName=_0.displayName,T.forwardRef((t,e)=>{const n=K.c(13);let o,r,s,i,a,l,c;return n[0]!==t?({className:r,children:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(i=Bc({className:r}),n[4]=r,n[5]=i):i=n[5],n[6]===Symbol.for("react.memo_cache_sentinel")?(a=Bc(),n[6]=a):a=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx("span",{className:a,children:u.jsx(y0,{children:u.jsx(RU,{className:"h-4 w-4 fill-current"})})}),n[7]=l):l=n[7],n[8]!==o||n[9]!==s||n[10]!==e||n[11]!==i?(c=u.jsxs(b0,{ref:e,className:i,...s,children:[l,o]}),n[8]=o,n[9]=s,n[10]=e,n[11]=i,n[12]=c):c=n[12],c}).displayName=b0.displayName,T.forwardRef((t,e)=>{const n=K.c(11);let o,r,s,i,a;return n[0]!==t?({className:o,inset:r,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==o||n[5]!==r?(i=MU({className:o,inset:r}),n[4]=o,n[5]=r,n[6]=i):i=n[6],n[7]!==s||n[8]!==e||n[9]!==i?(a=u.jsx(p0,{ref:e,className:i,...s}),n[7]=s,n[8]=e,n[9]=i,n[10]=a):a=n[10],a}).displayName=p0.displayName;const N0=T.forwardRef((t,e)=>{const n=K.c(9);let o,r,s,i;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(s=Ae(jU({className:o})),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(i=u.jsx(x0,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=i):i=n[8],i});N0.displayName=x0.displayName;const j0=t=>{const e=K.c(17),{connectionState:n,onClick:o,tooltipContent:r}=t;let s;e[0]!==n||e[1]!==r?(s=Zc(n)||r,e[0]=n,e[1]=r,e[2]=s):s=e[2];const i=s;let a,l,c,d,h,f;return e[3]!==o?(a=()=>o==null?void 0:o({code:""}),e[3]=o,e[4]=a):a=e[4],e[5]!==n?(l=Ae("shoulder-button hover-action",Ho(n)&&" inactive-button"),e[5]=n,e[6]=l):l=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(pr,{strokeWidth:1.8}),e[7]=c):c=e[7],e[8]!==a||e[9]!==l?(d=u.jsx(wn,{onClick:a,className:l,onMouseDown:Hn.preventFocus,shape:"circle",size:"small",color:"hint-green","data-testid":"create-cell-button",children:c}),e[8]=a,e[9]=l,e[10]=d):d=e[10],e[11]!==i||e[12]!==d?(h=u.jsx(Te,{content:i,usePortal:!1,children:d}),e[11]=i,e[12]=d,e[13]=h):h=e[13],e[14]!==o||e[15]!==h?(f=u.jsx(O5,{onClick:o,children:h}),e[14]=o,e[15]=h,e[16]=f):f=e[16],f},O5=t=>{const e=K.c(24),{children:n,onClick:o}=t;if(!o)return n;let r,s,i,a,l,c,d,h,f,m,_,g;return e[0]!==n?(r=u.jsx(S0,{children:n}),e[0]=n,e[1]=r):r=e[1],e[2]!==o?(s=p=>{p.stopPropagation(),o({code:""})},e[2]=o,e[3]=s):s=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx("div",{className:"mr-3 text-muted-foreground",children:u.jsx(mc,{})}),e[4]=i):i=e[4],e[5]!==s?(a=u.jsxs(Ai,{onSelect:s,children:[i,"Python cell"]},"python"),e[5]=s,e[6]=a):a=e[6],e[7]!==o?(l=p=>{p.stopPropagation(),o({code:new ca().defaultCode})},e[7]=o,e[8]=l):l=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx("div",{className:"mr-3 text-muted-foreground",children:u.jsx(fc,{})}),e[9]=c):c=e[9],e[10]!==l?(d=u.jsxs(Ai,{onSelect:l,children:[c,"Markdown cell"]},"markdown"),e[10]=l,e[11]=d):d=e[11],e[12]!==o?(h=p=>{p.stopPropagation(),o({code:new Uc().defaultCode})},e[12]=o,e[13]=h):h=e[13],e[14]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx("div",{className:"mr-3 text-muted-foreground",children:u.jsx(dr,{size:13,strokeWidth:1.5})}),e[14]=f):f=e[14],e[15]!==h?(m=u.jsxs(Ai,{onSelect:h,children:[f,"SQL cell"]},"sql"),e[15]=h,e[16]=m):m=e[16],e[17]!==a||e[18]!==d||e[19]!==m?(_=u.jsxs(Eu,{children:[a,d,m]}),e[17]=a,e[18]=d,e[19]=m,e[20]=_):_=e[20],e[21]!==r||e[22]!==_?(g=u.jsxs(k0,{children:[r,_]}),e[21]=r,e[22]=_,e[23]=g):g=e[23],g},E0=J.memo(J.forwardRef((t,e)=>{const n=K.c(34);let o,r,s;n[0]!==t?({children:o,showTooltip:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const i=s===void 0||s,[a,l]=T.useState(!1);let c;n[4]!==r?(c={cell:r},n[4]=r,n[5]=c):c=n[5];const d=vd(c),h=LU();let f,m,_,g,p,b;if(n[6]===Symbol.for("react.memo_cache_sentinel")?(f=()=>({toggle:()=>l(D5)}),n[6]=f):f=n[6],T.useImperativeHandle(e,f),n[7]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(aa,{placeholder:"Search actions...",className:"h-6 m-1"}),n[7]=m):m=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(gc,{children:"No results"}),n[8]=_):_=n[8],n[9]!==d){let N;n[11]!==d.length?(N=(I,A)=>u.jsxs(T.Fragment,{children:[u.jsx(xm,{children:I.map(M=>{let R=u.jsxs("div",{className:"flex items-center flex-1",children:[M.icon&&u.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:M.icon}),u.jsx("div",{className:"flex-1",children:M.label}),u.jsxs("div",{className:"flex-shrink-0 text-sm",children:[M.hotkey&&U4(M.hotkey),M.rightElement]})]});return M.tooltip&&(R=u.jsx(Te,{content:M.tooltip,delayDuration:100,children:R})),u.jsx(go,{className:Ae(M.disabled&&"!opacity-50"),onSelect:()=>{M.disableClick||M.disabled||(M.handle(),l(!1))},variant:M.variant,children:R},M.label)})},A),A<d.length-1&&u.jsx(o4,{})]},A),n[11]=d.length,n[12]=N):N=n[12],g=d.map(N),n[9]=d,n[10]=g}else g=n[10];n[13]!==g?(p=u.jsxs(Ec,{children:[m,u.jsxs(Vm,{children:[_,g]})]}),n[13]=g,n[14]=p):p=n[14],n[15]!==h||n[16]!==p?(b=u.jsx(Js,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...h,children:p}),n[15]=h,n[16]=p,n[17]=b):b=n[17];const y=b;if(!i){let N,I;return n[18]!==o?(N=u.jsx(ti,{asChild:!0,children:o}),n[18]=o,n[19]=N):N=n[19],n[20]!==y||n[21]!==a||n[22]!==N?(I=u.jsxs(Ur,{open:a,onOpenChange:l,children:[N,y]}),n[20]=y,n[21]=a,n[22]=N,n[23]=I):I=n[23],I}let x;n[24]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx(FU,{tabIndex:-1,children:pn("cell.cellActions")}),n[24]=x):x=n[24];const k=!a&&x;let C,v,E;return n[25]!==o?(C=u.jsx(zU,{children:u.jsx(ti,{className:"flex",children:o})}),n[25]=o,n[26]=C):C=n[26],n[27]!==k||n[28]!==C?(v=u.jsxs(BU,{delayDuration:200,disableHoverableContent:!0,children:[k,C]}),n[27]=k,n[28]=C,n[29]=v):v=n[29],n[30]!==y||n[31]!==a||n[32]!==v?(E=u.jsxs(Ur,{open:a,onOpenChange:l,children:[v,y]}),n[30]=y,n[31]=a,n[32]=v,n[33]=E):E=n[33],E})),I0=J.memo(t=>{const e=K.c(5),{children:n,cellId:o}=t;let r,s;e[0]!==o?(s=PU(o),e[0]=o,e[1]=s):s=e[1],r=s;const i=$e(r);if(!i)return null;let a;return e[2]!==n||e[3]!==i?(a=u.jsx(E0,{showTooltip:!1,...i,children:n}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a});function D5(t){return!t}I0.displayName="ConnectionCellActionsDropdown";const A0=t=>{const e=K.c(32);let n,o,r;e[0]!==t?({children:n,...o}=t,e[0]=t,e[1]=n,e[2]=o):(n=e[1],o=e[2]),e[3]!==o?(r={cell:o},e[3]=o,e[4]=r):r=e[4];const s=vd(r),[i,a]=J.useState(),l=!!i;let c,d,h,f,m,_,g,p,b,y;if(e[5]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(ra,{size:13,strokeWidth:1.5}),e[5]=c):c=e[5],e[6]!==o?(d=async()=>{var C;if((C=window.getSelection())==null?void 0:C.toString())return void document.execCommand("copy");const k=document.getElementById(G3.create(o.cellId));k?await xn(k.textContent??""):Dt.warn("cell-context-menu: output not found")},e[6]=o,e[7]=d):d=e[7],e[8]!==s||e[9]!==n||e[10]!==i||e[11]!==o||e[12]!==l||e[13]!==d){const x=[{label:"Copy",hidden:l,icon:c,handle:d},{label:"Cut",hidden:!!i,icon:u.jsx(hd,{size:13,strokeWidth:1.5}),handle:R5},{label:"Paste",hidden:!!i,icon:u.jsx(wp,{size:13,strokeWidth:1.5}),handle:async()=>{const{getEditorView:v}=o,E=v();if(E)try{const N=await navigator.clipboard.readText();if(N){const{from:I,to:A}=E.state.selection.main,M=E.state.update({changes:{from:I,to:A,insert:N}});E.dispatch(M)}}catch(N){const I=N;Dt.error("Failed to paste from clipboard",I),UU({command:"paste"})}}},{label:"Copy image",hidden:!i,icon:u.jsx(od,{size:13,strokeWidth:1.5}),handle:async()=>{if(i){const v=await fetch(i.src),E=await v.blob(),N=new ClipboardItem({[E.type]:E});await navigator.clipboard.write([N]).then(P5).catch(L5)}}},{icon:u.jsx(dp,{size:13,strokeWidth:1.5}),label:"Download image",hidden:!i,handle:()=>{if(i){const v=document.createElement("a");v.download="image.png",v.href=i.src,v.click()}}},{label:"Go to Definition",icon:u.jsx($U,{size:13,strokeWidth:1.5}),handle:()=>{const{getEditorView:v}=o,E=v();E&&VU(E)}}],k=[x,...s];let C;f=k0,e[20]===Symbol.for("react.memo_cache_sentinel")?(C=v=>{v.target instanceof HTMLImageElement?a(v.target):a(void 0)},e[20]=C):C=e[20],e[21]!==n?(p=u.jsx(S0,{onContextMenu:C,asChild:!0,children:n}),e[21]=n,e[22]=p):p=e[22],h=Eu,m="w-[300px]",_=!0,g=k.map((v,E)=>u.jsxs(T.Fragment,{children:[v.map(F5),E<k.length-1&&u.jsx(N0,{})]},E)),e[8]=s,e[9]=n,e[10]=i,e[11]=o,e[12]=l,e[13]=d,e[14]=h,e[15]=f,e[16]=m,e[17]=_,e[18]=g,e[19]=p}else h=e[14],f=e[15],m=e[16],_=e[17],g=e[18],p=e[19];return e[23]!==h||e[24]!==m||e[25]!==_||e[26]!==g?(b=u.jsx(h,{className:m,scrollable:_,children:g}),e[23]=h,e[24]=m,e[25]=_,e[26]=g,e[27]=b):b=e[27],e[28]!==f||e[29]!==p||e[30]!==b?(y=u.jsxs(f,{children:[p,b]}),e[28]=f,e[29]=p,e[30]=b,e[31]=y):y=e[31],y};function R5(){document.execCommand("cut")}function P5(){ut({title:"Copied image to clipboard"})}function L5(t){ut({title:"Failed to copy image to clipboard. Try downloading instead.",description:t.message}),Dt.error("Failed to copy image to clipboard",t)}function F5(t){if(t.hidden)return null;let e=u.jsxs("div",{className:"flex items-center flex-1",children:[t.icon&&u.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:t.icon}),u.jsx("div",{className:"flex-1",children:t.label}),u.jsxs("div",{className:"flex-shrink-0 text-sm",children:[t.hotkey&&U4(t.hotkey),t.rightElement]})]});return t.tooltip&&(e=u.jsx(Te,{delayDuration:100,content:t.tooltip,children:e})),u.jsx(Ai,{className:t.disabled?"!opacity-50":"",onSelect:n=>{t.disableClick||t.disabled||t.handle(n)},variant:t.variant,children:e},t.label)}const z5=""+new URL("loro_wasm_bg-DHBNbovs.wasm",import.meta.url).href;let w;function Iu(t){w=t}const kt=new Array(128).fill(void 0);function xe(t){return kt[t]}kt.push(void 0,null,!0,!1);let We=0,xl=null;function es(){return xl!==null&&xl.byteLength!==0||(xl=new Uint8Array(w.memory.buffer)),xl}let wl=new(typeof TextEncoder>"u"?(0,module.require)("util").TextEncoder:TextEncoder)("utf-8");const B5=typeof wl.encodeInto=="function"?function(t,e){return wl.encodeInto(t,e)}:function(t,e){const n=wl.encode(t);return e.set(n),{read:t.length,written:n.length}};function ft(t,e,n){if(n===void 0){const a=wl.encode(t),l=e(a.length,1)>>>0;return es().subarray(l,l+a.length).set(a),We=a.length,l}let o=t.length,r=e(o,1)>>>0;const s=es();let i=0;for(;i<o;i++){const a=t.charCodeAt(i);if(a>127)break;s[r+i]=a}if(i!==o){i!==0&&(t=t.slice(i)),r=n(r,o,o=i+3*t.length,1)>>>0;const a=es().subarray(r+i,r+o);i+=B5(t,a).written,r=n(r,o,i,1)>>>0}return We=i,r}let ts=null;function L(){return(ts===null||ts.buffer.detached===!0||ts.buffer.detached===void 0&&ts.buffer!==w.memory.buffer)&&(ts=new DataView(w.memory.buffer)),ts}let Ti=kt.length;function oe(t){Ti===kt.length&&kt.push(kt.length+1);const e=Ti;return Ti=kt[e],kt[e]=t,e}function Xt(t,e){try{return t.apply(this,e)}catch(n){w.__wbindgen_export_2(oe(n))}}let T0=new(typeof TextDecoder>"u"?(0,module.require)("util").TextDecoder:TextDecoder)("utf-8",{ignoreBOM:!0,fatal:!0});function At(t,e){return t>>>=0,T0.decode(es().subarray(t,t+e))}function H(t){const e=xe(t);return function(n){n<132||(kt[n]=Ti,Ti=n)}(t),e}function Pn(t){return t==null}T0.decode();const M0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{w.__wbindgen_export_4.get(t.dtor)(t.a,t.b)});function O0(t,e,n,o){const r={a:t,b:e,cnt:1,dtor:n},s=(...i)=>{r.cnt++;const a=r.a;r.a=0;try{return o(a,r.b,...i)}finally{--r.cnt===0?(w.__wbindgen_export_4.get(r.dtor)(a,r.b),M0.unregister(r)):r.a=a}};return s.original=r,M0.register(s,r,r),s}function Au(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const r=t.description;return r==null?"Symbol":`Symbol(${r})`}if(e=="function"){const r=t.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(t)){const r=t.length;let s="[";r>0&&(s+=Au(t[0]));for(let i=1;i<r;i++)s+=", "+Au(t[i]);return s+="]",s}const n=/\[object ([^\]]+)\]/.exec(toString.call(t));let o;if(!(n&&n.length>1))return toString.call(t);if(o=n[1],o=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}
|
119
|
+
${t.stack}`:o}function io(t,e){return t>>>=0,es().subarray(t/1,t/1+e)}function Jo(t,e){const n=e(1*t.length,1)>>>0;return es().set(t,n/1),We=t.length,n}function Ln(t,e){t>>>=0;const n=L(),o=[];for(let r=t;r<t+4*e;r+=4)o.push(H(n.getUint32(r,!0)));return o}function kn(t,e){const n=e(4*t.length,4)>>>0,o=L();for(let r=0;r<t.length;r++)o.setUint32(n+4*r,oe(t[r]),!0);return We=t.length,n}let Zt=128;function _n(t){if(Zt==1)throw new Error("out of js stack");return kt[--Zt]=t,Zt}function ns(t,e){if(!(t instanceof e))throw new Error(`expected instance of ${e.name}`)}function U5(t,e,n){w.__wbindgen_export_5(t,e,oe(n))}function V5(t,e){w.__wbindgen_export_6(t,e)}const D0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_awarenesswasm_free(t>>>0,1));class R0{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,D0.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_awarenesswasm_free(e,0)}constructor(e,n){const o=w.awarenesswasm_new(oe(e),n);return this.__wbg_ptr=o>>>0,D0.register(this,this.__wbg_ptr,this),this}encode(e){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_encode(s,this.__wbg_ptr,oe(e));var n=L().getInt32(s+0,!0),o=L().getInt32(s+4,!0),r=io(n,o).slice();return w.__wbindgen_export_3(n,1*o,1),r}finally{w.__wbindgen_add_to_stack_pointer(16)}}encodeAll(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_encodeAll(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=io(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}apply(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=Jo(e,w.__wbindgen_export_0),i=We;w.awarenesswasm_apply(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setLocalState(e){w.awarenesswasm_setLocalState(this.__wbg_ptr,oe(e))}peer(){return H(w.awarenesswasm_peer(this.__wbg_ptr))}getAllStates(){return H(w.awarenesswasm_getAllStates(this.__wbg_ptr))}getState(e){return H(w.awarenesswasm_getState(this.__wbg_ptr,oe(e)))}getTimestamp(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_getTimestamp(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getFloat64(r+8,!0);return n===0?void 0:o}finally{w.__wbindgen_add_to_stack_pointer(16)}}removeOutdated(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_removeOutdated(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Ln(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}length(){return w.awarenesswasm_length(this.__wbg_ptr)}isEmpty(){return w.awarenesswasm_isEmpty(this.__wbg_ptr)!==0}peers(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.awarenesswasm_peers(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Ln(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}}const P0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_changemodifier_free(t>>>0,1));class os{static __wrap(e){e>>>=0;const n=Object.create(os.prototype);return n.__wbg_ptr=e,P0.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,P0.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_changemodifier_free(e,0)}setMessage(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=We,r=w.changemodifier_setMessage(this.__wbg_ptr,n,o);return os.__wrap(r)}setTimestamp(e){const n=w.changemodifier_setTimestamp(this.__wbg_ptr,e);return os.__wrap(n)}}const L0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_cursor_free(t>>>0,1));class Zn{static __wrap(e){e>>>=0;const n=Object.create(Zn.prototype);return n.__wbg_ptr=e,L0.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,L0.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_cursor_free(e,0)}containerId(){return H(w.cursor_containerId(this.__wbg_ptr))}pos(){return H(w.cursor_pos(this.__wbg_ptr))}side(){return H(w.cursor_side(this.__wbg_ptr))}encode(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.cursor_encode(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=io(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}static decode(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=Jo(e,w.__wbindgen_export_0),i=We;w.cursor_decode(r,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Zn.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}kind(){return H(w.cursor_kind(this.__wbg_ptr))}}const F0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_ephemeralstorewasm_free(t>>>0,1)),Tu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorocounter_free(t>>>0,1));class Mi{static __wrap(e){e>>>=0;const n=Object.create(Mi.prototype);return n.__wbg_ptr=e,Tu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Tu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorocounter_free(e,0)}constructor(){const e=w.lorocounter_new();return this.__wbg_ptr=e>>>0,Tu.register(this,this.__wbg_ptr,this),this}kind(){return H(w.lorocounter_kind(this.__wbg_ptr))}get id(){return H(w.lorocounter_id(this.__wbg_ptr))}increment(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorocounter_increment(o,this.__wbg_ptr,e);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}decrement(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorocounter_decrement(o,this.__wbg_ptr,e);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get value(){return w.lorocounter_value(this.__wbg_ptr)}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorocounter_subscribe(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){return H(w.lorocounter_parent(this.__wbg_ptr))}isAttached(){return w.lorocounter_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.lorocounter_getAttached(this.__wbg_ptr))}getShallowValue(){return w.lorocounter_getShallowValue(this.__wbg_ptr)}}const Mu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorodoc_free(t>>>0,1));class xo{static __wrap(e){e>>>=0;const n=Object.create(xo.prototype);return n.__wbg_ptr=e,Mu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Mu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorodoc_free(e,0)}constructor(){const e=w.lorodoc_new();return this.__wbg_ptr=e>>>0,Mu.register(this,this.__wbg_ptr,this),this}setDetachedEditing(e){w.lorodoc_setDetachedEditing(this.__wbg_ptr,e)}isDetachedEditingEnabled(){return w.lorodoc_isDetachedEditingEnabled(this.__wbg_ptr)!==0}setRecordTimestamp(e){w.lorodoc_setRecordTimestamp(this.__wbg_ptr,e)}setChangeMergeInterval(e){w.lorodoc_setChangeMergeInterval(this.__wbg_ptr,e)}configTextStyle(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_configTextStyle(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}configDefaultTextStyle(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_configDefaultTextStyle(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}static fromSnapshot(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=Jo(e,w.__wbindgen_export_0),i=We;w.lorodoc_fromSnapshot(r,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return xo.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}attach(){w.lorodoc_attach(this.__wbg_ptr)}isDetached(){return w.lorodoc_isDetached(this.__wbg_ptr)!==0}detach(){w.lorodoc_detach(this.__wbg_ptr)}fork(){const e=w.lorodoc_fork(this.__wbg_ptr);return xo.__wrap(e)}forkAt(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=kn(e,w.__wbindgen_export_0),i=We;w.lorodoc_forkAt(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return xo.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}checkoutToLatest(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_checkoutToLatest(n,this.__wbg_ptr);var e=L().getInt32(n+0,!0);if(L().getInt32(n+4,!0))throw H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}travelChangeAncestors(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=kn(e,w.__wbindgen_export_0),i=We;w.lorodoc_travelChangeAncestors(r,this.__wbg_ptr,s,i,oe(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}findIdSpansBetween(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=kn(e,w.__wbindgen_export_0),a=We,l=kn(n,w.__wbindgen_export_0),c=We;w.lorodoc_findIdSpansBetween(s,this.__wbg_ptr,i,a,l,c);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}checkout(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=kn(e,w.__wbindgen_export_0),s=We;w.lorodoc_checkout(o,this.__wbg_ptr,r,s);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get peerId(){const e=w.lorodoc_peerId(this.__wbg_ptr);return BigInt.asUintN(64,e)}get peerIdStr(){return H(w.lorodoc_peerIdStr(this.__wbg_ptr))}setPeerId(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_setPeerId(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}commit(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_commit(o,this.__wbg_ptr,Pn(e)?0:oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getPendingTxnLength(){return w.lorodoc_getPendingTxnLength(this.__wbg_ptr)>>>0}getText(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getText(r,this.__wbg_ptr,_n(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Xo.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Zt++]=void 0}}getMap(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getMap(r,this.__wbg_ptr,_n(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Ko.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Zt++]=void 0}}getList(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getList(r,this.__wbg_ptr,_n(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Oi.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Zt++]=void 0}}getMovableList(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getMovableList(r,this.__wbg_ptr,_n(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Di.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Zt++]=void 0}}getCounter(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getCounter(r,this.__wbg_ptr,_n(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Mi.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Zt++]=void 0}}getTree(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getTree(r,this.__wbg_ptr,_n(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Ri.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Zt++]=void 0}}hasContainer(e){return w.lorodoc_hasContainer(this.__wbg_ptr,oe(e))!==0}getContainerById(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getContainerById(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setNextCommitMessage(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=We;w.lorodoc_setNextCommitMessage(this.__wbg_ptr,n,o)}setNextCommitOrigin(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=We;w.lorodoc_setNextCommitOrigin(this.__wbg_ptr,n,o)}setNextCommitTimestamp(e){w.lorodoc_setNextCommitTimestamp(this.__wbg_ptr,e)}setNextCommitOptions(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_setNextCommitOptions(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}clearNextCommitOptions(){w.lorodoc_clearNextCommitOptions(this.__wbg_ptr)}getDeepValueWithID(){return H(w.lorodoc_getDeepValueWithID(this.__wbg_ptr))}getPathToContainer(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getPathToContainer(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}JSONPath(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),i=We;w.lorodoc_JSONPath(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}version(){const e=w.lorodoc_version(this.__wbg_ptr);return Fn.__wrap(e)}shallowSinceVV(){const e=w.lorodoc_shallowSinceVV(this.__wbg_ptr);return Fn.__wrap(e)}isShallow(){return w.lorodoc_isShallow(this.__wbg_ptr)!==0}shallowSinceFrontiers(){return H(w.lorodoc_shallowSinceFrontiers(this.__wbg_ptr))}oplogVersion(){const e=w.lorodoc_oplogVersion(this.__wbg_ptr);return Fn.__wrap(e)}frontiers(){return H(w.lorodoc_frontiers(this.__wbg_ptr))}oplogFrontiers(){return H(w.lorodoc_oplogFrontiers(this.__wbg_ptr))}cmpWithFrontiers(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=kn(e,w.__wbindgen_export_0),i=We;w.lorodoc_cmpWithFrontiers(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return n}finally{w.__wbindgen_add_to_stack_pointer(16)}}cmpFrontiers(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=kn(e,w.__wbindgen_export_0),a=We,l=kn(n,w.__wbindgen_export_0),c=We;w.lorodoc_cmpFrontiers(s,this.__wbg_ptr,i,a,l,c);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}exportSnapshot(){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_exportSnapshot(s,this.__wbg_ptr);var e=L().getInt32(s+0,!0),n=L().getInt32(s+4,!0),o=L().getInt32(s+8,!0);if(L().getInt32(s+12,!0))throw H(o);var r=io(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),r}finally{w.__wbindgen_add_to_stack_pointer(16)}}exportFrom(e){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_exportFrom(i,this.__wbg_ptr,oe(e));var n=L().getInt32(i+0,!0),o=L().getInt32(i+4,!0),r=L().getInt32(i+8,!0);if(L().getInt32(i+12,!0))throw H(r);var s=io(n,o).slice();return w.__wbindgen_export_3(n,1*o,1),s}finally{w.__wbindgen_add_to_stack_pointer(16)}}export(e){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_export(i,this.__wbg_ptr,oe(e));var n=L().getInt32(i+0,!0),o=L().getInt32(i+4,!0),r=L().getInt32(i+8,!0);if(L().getInt32(i+12,!0))throw H(r);var s=io(n,o).slice();return w.__wbindgen_export_3(n,1*o,1),s}finally{w.__wbindgen_add_to_stack_pointer(16)}}exportJsonUpdates(e,n,o){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_exportJsonUpdates(i,this.__wbg_ptr,oe(e),oe(n),Pn(o)?16777215:o?1:0);var r=L().getInt32(i+0,!0),s=L().getInt32(i+4,!0);if(L().getInt32(i+8,!0))throw H(s);return H(r)}finally{w.__wbindgen_add_to_stack_pointer(16)}}exportJsonInIdSpan(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_exportJsonInIdSpan(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}importJsonUpdates(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_importJsonUpdates(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}import(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=Jo(e,w.__wbindgen_export_0),i=We;w.lorodoc_import(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}importUpdateBatch(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_importBatch(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}importBatch(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_importBatch(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getShallowValue(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getShallowValue(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_toJSON(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){return H(w.lorodoc_subscribe(this.__wbg_ptr,oe(e)))}subscribeLocalUpdates(e){return H(w.lorodoc_subscribeLocalUpdates(this.__wbg_ptr,oe(e)))}debugHistory(){w.lorodoc_debugHistory(this.__wbg_ptr)}changeCount(){return w.lorodoc_changeCount(this.__wbg_ptr)>>>0}opCount(){return w.lorodoc_opCount(this.__wbg_ptr)>>>0}getAllChanges(){return H(w.lorodoc_getAllChanges(this.__wbg_ptr))}getChangeAt(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getChangeAt(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getChangeAtLamport(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),a=We;w.lorodoc_getChangeAtLamport(s,this.__wbg_ptr,i,a,n);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getOpsInChange(e){try{const i=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getOpsInChange(i,this.__wbg_ptr,oe(e));var n=L().getInt32(i+0,!0),o=L().getInt32(i+4,!0),r=L().getInt32(i+8,!0);if(L().getInt32(i+12,!0))throw H(r);var s=Ln(n,o).slice();return w.__wbindgen_export_3(n,4*o,4),s}finally{w.__wbindgen_add_to_stack_pointer(16)}}frontiersToVV(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=kn(e,w.__wbindgen_export_0),i=We;w.lorodoc_frontiersToVV(r,this.__wbg_ptr,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Fn.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}vvToFrontiers(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);ns(e,Fn),w.lorodoc_vvToFrontiers(r,this.__wbg_ptr,e.__wbg_ptr);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getByPath(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=We;return H(w.lorodoc_getByPath(this.__wbg_ptr,n,o))}getCursorPos(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);ns(e,Zn),w.lorodoc_getCursorPos(r,this.__wbg_ptr,e.__wbg_ptr);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getChangedContainersIn(e,n){try{const a=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getChangedContainersIn(a,this.__wbg_ptr,oe(e),n);var o=L().getInt32(a+0,!0),r=L().getInt32(a+4,!0),s=L().getInt32(a+8,!0);if(L().getInt32(a+12,!0))throw H(s);var i=Ln(o,r).slice();return w.__wbindgen_export_3(o,4*r,4),i}finally{w.__wbindgen_add_to_stack_pointer(16)}}revertTo(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=kn(e,w.__wbindgen_export_0),s=We;w.lorodoc_revertTo(o,this.__wbg_ptr,r,s);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}applyDiff(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_applyDiff(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}diff(e,n,o){try{const i=w.__wbindgen_add_to_stack_pointer(-16),a=kn(e,w.__wbindgen_export_0),l=We,c=kn(n,w.__wbindgen_export_0),d=We;w.lorodoc_diff(i,this.__wbg_ptr,a,l,c,d,Pn(o)?16777215:o?1:0);var r=L().getInt32(i+0,!0),s=L().getInt32(i+4,!0);if(L().getInt32(i+8,!0))throw H(s);return H(r)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getUncommittedOpsAsJson(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_getUncommittedOpsAsJson(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribeFirstCommitFromPeer(e){return H(w.lorodoc_subscribeFirstCommitFromPeer(this.__wbg_ptr,oe(e)))}subscribePreCommit(e){return H(w.lorodoc_subscribePreCommit(this.__wbg_ptr,oe(e)))}deleteRootContainer(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_deleteRootContainer(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setHideEmptyRootContainers(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorodoc_setHideEmptyRootContainers(o,this.__wbg_ptr,e);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}}const Ou=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorolist_free(t>>>0,1));class Oi{static __wrap(e){e>>>=0;const n=Object.create(Oi.prototype);return n.__wbg_ptr=e,Ou.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Ou.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorolist_free(e,0)}constructor(){const e=w.lorolist_new();return this.__wbg_ptr=e>>>0,Ou.register(this,this.__wbg_ptr,this),this}kind(){return H(w.lorolist_kind(this.__wbg_ptr))}insert(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_insert(r,this.__wbg_ptr,e,oe(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}delete(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_delete(r,this.__wbg_ptr,e,n);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){return H(w.lorolist_get(this.__wbg_ptr,e))}get id(){return H(w.lorolist_id(this.__wbg_ptr))}toArray(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_toArray(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Ln(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return H(w.lorolist_toJSON(this.__wbg_ptr))}insertContainer(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_insertContainer(s,this.__wbg_ptr,e,oe(n));var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}pushContainer(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_pushContainer(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_subscribe(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get length(){return w.lorolist_length(this.__wbg_ptr)>>>0}parent(){return H(w.lorolist_parent(this.__wbg_ptr))}isAttached(){return w.lorolist_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.lorolist_getAttached(this.__wbg_ptr))}getCursor(e,n){const o=w.lorolist_getCursor(this.__wbg_ptr,e,oe(n));return o===0?void 0:Zn.__wrap(o)}push(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_push(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}pop(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_pop(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}clear(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.lorolist_clear(n,this.__wbg_ptr);var e=L().getInt32(n+0,!0);if(L().getInt32(n+4,!0))throw H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getIdAt(e){return H(w.lorolist_getIdAt(this.__wbg_ptr,e))}isDeleted(){return w.lorolist_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return H(w.lorolist_getShallowValue(this.__wbg_ptr))}}const Du=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_loromap_free(t>>>0,1));class Ko{static __wrap(e){e>>>=0;const n=Object.create(Ko.prototype);return n.__wbg_ptr=e,Du.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Du.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_loromap_free(e,0)}constructor(){const e=w.loromap_new();return this.__wbg_ptr=e>>>0,Du.register(this,this.__wbg_ptr,this),this}kind(){return H(w.loromap_kind(this.__wbg_ptr))}set(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),i=We;w.loromap_set(r,this.__wbg_ptr,s,i,oe(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}delete(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),s=We;w.loromap_delete(o,this.__wbg_ptr,r,s);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=We;return H(w.loromap_get(this.__wbg_ptr,n,o))}getOrCreateContainer(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),a=We;w.loromap_getOrCreateContainer(s,this.__wbg_ptr,i,a,oe(n));var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}keys(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_keys(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Ln(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}values(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_values(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Ln(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}entries(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_entries(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Ln(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}get id(){return H(w.loromap_id(this.__wbg_ptr))}toJSON(){return H(w.loromap_toJSON(this.__wbg_ptr))}setContainer(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),a=We;w.loromap_setContainer(s,this.__wbg_ptr,i,a,oe(n));var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_subscribe(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get size(){return w.loromap_size(this.__wbg_ptr)>>>0}parent(){return H(w.loromap_parent(this.__wbg_ptr))}isAttached(){return w.loromap_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.loromap_getAttached(this.__wbg_ptr))}clear(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.loromap_clear(n,this.__wbg_ptr);var e=L().getInt32(n+0,!0);if(L().getInt32(n+4,!0))throw H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getLastEditor(e){const n=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),o=We;return H(w.loromap_getLastEditor(this.__wbg_ptr,n,o))}isDeleted(){return w.loromap_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return H(w.loromap_getShallowValue(this.__wbg_ptr))}}const Ru=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_loromovablelist_free(t>>>0,1));class Di{static __wrap(e){e>>>=0;const n=Object.create(Di.prototype);return n.__wbg_ptr=e,Ru.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Ru.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_loromovablelist_free(e,0)}constructor(){const e=w.loromovablelist_new();return this.__wbg_ptr=e>>>0,Ru.register(this,this.__wbg_ptr,this),this}kind(){return H(w.loromovablelist_kind(this.__wbg_ptr))}insert(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_insert(r,this.__wbg_ptr,e,oe(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}delete(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_delete(r,this.__wbg_ptr,e,n);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){return H(w.loromovablelist_get(this.__wbg_ptr,e))}get id(){return H(w.loromovablelist_id(this.__wbg_ptr))}toArray(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_toArray(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Ln(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return H(w.loromovablelist_toJSON(this.__wbg_ptr))}insertContainer(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_insertContainer(s,this.__wbg_ptr,e,oe(n));var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}pushContainer(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_pushContainer(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_subscribe(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get length(){return w.loromovablelist_length(this.__wbg_ptr)>>>0}parent(){return H(w.loromovablelist_parent(this.__wbg_ptr))}isAttached(){return w.loromovablelist_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.loromovablelist_getAttached(this.__wbg_ptr))}getCursor(e,n){const o=w.loromovablelist_getCursor(this.__wbg_ptr,e,oe(n));return o===0?void 0:Zn.__wrap(o)}move(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_move(r,this.__wbg_ptr,e,n);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}set(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_set(r,this.__wbg_ptr,e,oe(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setContainer(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_setContainer(s,this.__wbg_ptr,e,oe(n));var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}push(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_push(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}pop(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_pop(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}clear(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.loromovablelist_clear(n,this.__wbg_ptr);var e=L().getInt32(n+0,!0);if(L().getInt32(n+4,!0))throw H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getCreatorAt(e){return H(w.loromovablelist_getCreatorAt(this.__wbg_ptr,e))}getLastMoverAt(e){return H(w.loromovablelist_getLastMoverAt(this.__wbg_ptr,e))}getLastEditorAt(e){return H(w.loromovablelist_getLastEditorAt(this.__wbg_ptr,e))}isDeleted(){return w.loromovablelist_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return H(w.loromovablelist_getShallowValue(this.__wbg_ptr))}}const Pu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorotext_free(t>>>0,1));class Xo{static __wrap(e){e>>>=0;const n=Object.create(Xo.prototype);return n.__wbg_ptr=e,Pu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Pu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorotext_free(e,0)}constructor(){const e=w.lorotext_new();return this.__wbg_ptr=e>>>0,Pu.register(this,this.__wbg_ptr,this),this}kind(){return H(w.lorotext_kind(this.__wbg_ptr))}iter(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_iter(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}update(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),i=We;w.lorotext_update(r,this.__wbg_ptr,s,i,oe(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}updateByLine(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),i=We;w.lorotext_updateByLine(r,this.__wbg_ptr,s,i,oe(n));var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}insert(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(n,w.__wbindgen_export_0,w.__wbindgen_export_1),i=We;w.lorotext_insert(r,this.__wbg_ptr,e,s,i);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}slice(e,n){let o,r;try{const h=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_slice(h,this.__wbg_ptr,e,n);var s=L().getInt32(h+0,!0),i=L().getInt32(h+4,!0),a=L().getInt32(h+8,!0),l=L().getInt32(h+12,!0),c=s,d=i;if(l)throw c=0,d=0,H(a);return o=c,r=d,At(c,d)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(o,r,1)}}charAt(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_charAt(r,this.__wbg_ptr,e);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return String.fromCodePoint(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}splice(e,n,o){let r,s;try{const f=w.__wbindgen_add_to_stack_pointer(-16),m=ft(o,w.__wbindgen_export_0,w.__wbindgen_export_1),_=We;w.lorotext_splice(f,this.__wbg_ptr,e,n,m,_);var i=L().getInt32(f+0,!0),a=L().getInt32(f+4,!0),l=L().getInt32(f+8,!0),c=L().getInt32(f+12,!0),d=i,h=a;if(c)throw d=0,h=0,H(l);return r=d,s=h,At(d,h)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(r,s,1)}}insertUtf8(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(n,w.__wbindgen_export_0,w.__wbindgen_export_1),i=We;w.lorotext_insertUtf8(r,this.__wbg_ptr,e,s,i);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}delete(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_delete(r,this.__wbg_ptr,e,n);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}deleteUtf8(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_deleteUtf8(r,this.__wbg_ptr,e,n);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}mark(e,n,o){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=ft(n,w.__wbindgen_export_0,w.__wbindgen_export_1),a=We;w.lorotext_mark(s,this.__wbg_ptr,oe(e),i,a,oe(o));var r=L().getInt32(s+0,!0);if(L().getInt32(s+4,!0))throw H(r)}finally{w.__wbindgen_add_to_stack_pointer(16)}}unmark(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(n,w.__wbindgen_export_0,w.__wbindgen_export_1),i=We;w.lorotext_unmark(r,this.__wbg_ptr,oe(e),s,i);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toString(){let e,n;try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_toString(s,this.__wbg_ptr);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);return e=o,n=r,At(o,r)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(e,n,1)}}toDelta(){return H(w.lorotext_toDelta(this.__wbg_ptr))}get id(){return H(w.lorotext_id(this.__wbg_ptr))}get length(){return w.lorotext_length(this.__wbg_ptr)>>>0}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_subscribe(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}applyDelta(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_applyDelta(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){return H(w.lorotext_parent(this.__wbg_ptr))}isAttached(){return w.lorotext_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.lorotext_getAttached(this.__wbg_ptr))}getCursor(e,n){const o=w.lorotext_getCursor(this.__wbg_ptr,e,oe(n));return o===0?void 0:Zn.__wrap(o)}push(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=ft(e,w.__wbindgen_export_0,w.__wbindgen_export_1),s=We;w.lorotext_push(o,this.__wbg_ptr,r,s);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getEditorOf(e){return H(w.lorotext_getEditorOf(this.__wbg_ptr,e))}isDeleted(){return w.lorotext_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){let e,n;try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotext_getShallowValue(s,this.__wbg_ptr);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);return e=o,n=r,At(o,r)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(e,n,1)}}toJSON(){return H(w.lorotext_toJSON(this.__wbg_ptr))}}const Lu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorotree_free(t>>>0,1));class Ri{static __wrap(e){e>>>=0;const n=Object.create(Ri.prototype);return n.__wbg_ptr=e,Lu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Lu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorotree_free(e,0)}constructor(){const e=w.lorotree_new();return this.__wbg_ptr=e>>>0,Lu.register(this,this.__wbg_ptr,this),this}kind(){return H(w.lorotree_kind(this.__wbg_ptr))}createNode(e,n){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_createNode(s,this.__wbg_ptr,_n(e),Pn(n)?4294967297:n>>>0);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);if(L().getInt32(s+8,!0))throw H(r);return ao.__wrap(o)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Zt++]=void 0}}move(e,n,o){try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_move(s,this.__wbg_ptr,_n(e),_n(n),Pn(o)?4294967297:o>>>0);var r=L().getInt32(s+0,!0);if(L().getInt32(s+4,!0))throw H(r)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Zt++]=void 0,kt[Zt++]=void 0}}delete(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_delete(o,this.__wbg_ptr,_n(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Zt++]=void 0}}getNodeByID(e){try{const n=w.lorotree_getNodeByID(this.__wbg_ptr,_n(e));return n===0?void 0:ao.__wrap(n)}finally{kt[Zt++]=void 0}}get id(){return H(w.lorotree_id(this.__wbg_ptr))}has(e){try{return w.lorotree_has(this.__wbg_ptr,_n(e))!==0}finally{kt[Zt++]=void 0}}isNodeDeleted(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_isNodeDeleted(r,this.__wbg_ptr,_n(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return n!==0}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Zt++]=void 0}}toArray(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_toArray(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}getNodes(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_getNodes(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return H(w.lorotree_toJSON(this.__wbg_ptr))}nodes(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_nodes(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Ln(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}roots(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_roots(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=Ln(e,n).slice();return w.__wbindgen_export_3(e,4*n,4),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotree_subscribe(r,this.__wbg_ptr,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){return H(w.lorotree_parent(this.__wbg_ptr))}isAttached(){return w.lorotree_isAttached(this.__wbg_ptr)!==0}getAttached(){return H(w.lorotree_getAttached(this.__wbg_ptr))}enableFractionalIndex(e){w.lorotree_enableFractionalIndex(this.__wbg_ptr,e)}disableFractionalIndex(){w.lorotree_disableFractionalIndex(this.__wbg_ptr)}isFractionalIndexEnabled(){return w.lorotree_isFractionalIndexEnabled(this.__wbg_ptr)!==0}isDeleted(){return w.lorotree_isDeleted(this.__wbg_ptr)!==0}getShallowValue(){return H(w.lorotree_getShallowValue(this.__wbg_ptr))}}const z0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_lorotreenode_free(t>>>0,1));class ao{static __wrap(e){e>>>=0;const n=Object.create(ao.prototype);return n.__wbg_ptr=e,z0.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,z0.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_lorotreenode_free(e,0)}__getClassname(){let e,n;try{const s=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode___getClassname(s,this.__wbg_ptr);var o=L().getInt32(s+0,!0),r=L().getInt32(s+4,!0);return e=o,n=r,At(o,r)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(e,n,1)}}get id(){return H(w.lorotreenode_id(this.__wbg_ptr))}createNode(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_createNode(r,this.__wbg_ptr,Pn(e)?4294967297:e>>>0);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return ao.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}move(e,n){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_move(r,this.__wbg_ptr,_n(e),Pn(n)?4294967297:n>>>0);var o=L().getInt32(r+0,!0);if(L().getInt32(r+4,!0))throw H(o)}finally{w.__wbindgen_add_to_stack_pointer(16),kt[Zt++]=void 0}}moveAfter(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);ns(e,ao),w.lorotreenode_moveAfter(o,this.__wbg_ptr,e.__wbg_ptr);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}moveBefore(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);ns(e,ao),w.lorotreenode_moveBefore(o,this.__wbg_ptr,e.__wbg_ptr);var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}index(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_index(o,this.__wbg_ptr);var e=L().getFloat64(o+0,!0),n=L().getInt32(o+8,!0);if(L().getInt32(o+12,!0))throw H(n);return e===4294967297?void 0:e}finally{w.__wbindgen_add_to_stack_pointer(16)}}fractionalIndex(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_fractionalIndex(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get data(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_data(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return Ko.__wrap(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_toJSON(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}parent(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_parent(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return e===0?void 0:ao.__wrap(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}}children(){return H(w.lorotreenode_children(this.__wbg_ptr))}isDeleted(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.lorotreenode_isDeleted(o,this.__wbg_ptr);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return e!==0}finally{w.__wbindgen_add_to_stack_pointer(16)}}getLastMoveId(){return H(w.lorotreenode_getLastMoveId(this.__wbg_ptr))}creationId(){return H(w.lorotreenode_creationId(this.__wbg_ptr))}creator(){return H(w.lorotreenode_creator(this.__wbg_ptr))}}const B0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_undomanager_free(t>>>0,1)),Fu=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>w.__wbg_versionvector_free(t>>>0,1));class Fn{static __wrap(e){e>>>=0;const n=Object.create(Fn.prototype);return n.__wbg_ptr=e,Fu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Fu.unregister(this),e}free(){const e=this.__destroy_into_raw();w.__wbg_versionvector_free(e,0)}constructor(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_new(r,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return this.__wbg_ptr=n>>>0,Fu.register(this,this.__wbg_ptr,this),this}finally{w.__wbindgen_add_to_stack_pointer(16)}}static parseJSON(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_parseJSON(r,oe(e));var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Fn.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return H(w.versionvector_toJSON(this.__wbg_ptr))}encode(){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_encode(r,this.__wbg_ptr);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=io(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}static decode(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=Jo(e,w.__wbindgen_export_0),i=We;w.versionvector_decode(r,s,i);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return Fn.__wrap(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}get(e){try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_get(r,this.__wbg_ptr,oe(e));var n=L().getFloat64(r+0,!0),o=L().getInt32(r+8,!0);if(L().getInt32(r+12,!0))throw H(o);return n===4294967297?void 0:n}finally{w.__wbindgen_add_to_stack_pointer(16)}}compare(e){ns(e,Fn);const n=w.versionvector_compare(this.__wbg_ptr,e.__wbg_ptr);return n===4294967297?void 0:n}setEnd(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_setEnd(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}setLast(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_setLast(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}remove(e){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.versionvector_remove(o,this.__wbg_ptr,oe(e));var n=L().getInt32(o+0,!0);if(L().getInt32(o+4,!0))throw H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}}length(){return w.versionvector_length(this.__wbg_ptr)>>>0}}function U0(t,e){const n=ft(String(xe(e)),w.__wbindgen_export_0,w.__wbindgen_export_1),o=We;L().setInt32(t+4,o,!0),L().setInt32(t+0,n,!0)}function V0(){return Xt(function(t,e,n){return oe(Reflect.apply(xe(t),xe(e),xe(n)))},arguments)}function $0(t){return oe(xe(t).buffer)}function H0(){return Xt(function(t,e){return oe(xe(t).call(xe(e)))},arguments)}function W0(){return Xt(function(t,e,n){return oe(xe(t).call(xe(e),xe(n)))},arguments)}function q0(){return Xt(function(t,e,n,o,r){return oe(xe(t).call(xe(e),xe(n),xe(o),xe(r)))},arguments)}function G0(){return Xt(function(t,e,n,o){return oe(xe(t).call(xe(e),xe(n),xe(o)))},arguments)}function Y0(t){return oe(os.__wrap(t))}function J0(t){return oe(xe(t).crypto)}function K0(t){return oe(Zn.__wrap(t))}function X0(t){return xe(t).done}function Z0(t){return oe(xe(t).entries())}function Q0(t){return oe(Object.entries(xe(t)))}function eb(t,e){let n,o;try{n=t,o=e,console.error(At(t,e))}finally{w.__wbindgen_export_3(n,o,1)}}function tb(t,e){console.error(At(t,e))}function nb(t){return oe(Array.from(xe(t)))}function ob(){return Xt(function(t,e){xe(t).getRandomValues(xe(e))},arguments)}function rb(t,e){return oe(xe(t)[e>>>0])}function sb(){return Xt(function(t,e){return oe(Reflect.get(xe(t),xe(e)))},arguments)}function ib(t,e){return xe(t)[e>>>0]}function ab(t,e){return oe(xe(t)[xe(e)])}function lb(){return Xt(function(){return oe(globalThis.globalThis)},arguments)}function cb(){return Xt(function(){return oe(global.global)},arguments)}function db(t){let e;try{e=xe(t)instanceof ArrayBuffer}catch{e=!1}return e}function ub(t){let e;try{e=xe(t)instanceof Map}catch{e=!1}return e}function hb(t){let e;try{e=xe(t)instanceof Object}catch{e=!1}return e}function fb(t){let e;try{e=xe(t)instanceof Uint8Array}catch{e=!1}return e}function mb(t){return Array.isArray(xe(t))}function pb(t){return Number.isSafeInteger(xe(t))}function gb(){return oe(Symbol.iterator)}function _b(t){return xe(t).length}function bb(t){return xe(t).length}function yb(t,e,n,o,r,s,i,a){let l,c;try{l=t,c=e,console.log(At(t,e),At(n,o),At(r,s),At(i,a))}finally{w.__wbindgen_export_3(l,c,1)}}function xb(t,e){console.log(At(t,e))}function wb(t,e){let n,o;try{n=t,o=e,console.log(At(t,e))}finally{w.__wbindgen_export_3(n,o,1)}}function vb(t){return oe(Mi.__wrap(t))}function kb(t){return oe(Oi.__wrap(t))}function Sb(t){return oe(Ko.__wrap(t))}function Cb(t){return oe(Di.__wrap(t))}function Nb(t){return oe(Xo.__wrap(t))}function jb(t){return oe(Ri.__wrap(t))}function Eb(t){return oe(ao.__wrap(t))}function Ib(t,e){performance.mark(At(t,e))}function Ab(){return Xt(function(t,e,n,o){let r,s,i,a;try{r=t,s=e,i=n,a=o,performance.measure(At(t,e),At(n,o))}finally{w.__wbindgen_export_3(r,s,1),w.__wbindgen_export_3(i,a,1)}},arguments)}function Tb(t){return oe(xe(t).msCrypto)}function Mb(){return oe(new Map)}function Ob(t){return oe(new Uint8Array(xe(t)))}function Db(){return oe(new Object)}function Rb(){return oe(new Error)}function Pb(){return oe(new Array)}function Lb(t,e){return oe(new Function(At(t,e)))}function Fb(t,e,n){return oe(new Uint8Array(xe(t),e>>>0,n>>>0))}function zb(t){return oe(new Uint8Array(t>>>0))}function Bb(t){return oe(new Array(t>>>0))}function Ub(t){return oe(xe(t).next)}function Vb(){return Xt(function(t){return oe(xe(t).next())},arguments)}function $b(t){return oe(xe(t).node)}function Hb(){return Date.now()}function Wb(){return Xt(function(t){return oe(Reflect.ownKeys(xe(t)))},arguments)}function qb(t){return oe(xe(t).process)}function Gb(t,e){return xe(t).push(xe(e))}function Yb(){return Xt(function(t,e){xe(t).randomFillSync(H(e))},arguments)}function Jb(){return Xt(function(){return oe(module.require)},arguments)}function Kb(t){return oe(Promise.resolve(xe(t)))}function Xb(){return Xt(function(){return oe(self.self)},arguments)}function Zb(){return Xt(function(t,e,n){return Reflect.set(xe(t),xe(e),xe(n))},arguments)}function Qb(t,e,n){return oe(xe(t).set(xe(e),xe(n)))}function ey(t,e,n){xe(t)[H(e)]=H(n)}function ty(t,e,n){xe(t).set(xe(e),n>>>0)}function ny(t,e,n){xe(t)[e>>>0]=H(n)}function oy(t,e,n){xe(t)[e>>>0]=n}function ry(t,e){const n=ft(xe(e).stack,w.__wbindgen_export_0,w.__wbindgen_export_1),o=We;L().setInt32(t+4,o,!0),L().setInt32(t+0,n,!0)}function sy(t,e,n){return oe(xe(t).subarray(e>>>0,n>>>0))}function iy(t,e){return oe(xe(t).then(xe(e)))}function ay(t){return oe(xe(t).value)}function ly(t){return oe(xe(t).versions)}function cy(t){return oe(Fn.__wrap(t))}function dy(){return Xt(function(){return oe(window.window)},arguments)}function uy(t){return+xe(t)}function hy(t){return oe(t)}function fy(t){return oe(BigInt.asUintN(64,t))}function my(t,e){const n=xe(e),o=typeof n=="bigint"?n:void 0;L().setBigInt64(t+8,Pn(o)?BigInt(0):o,!0),L().setInt32(t+0,!Pn(o),!0)}function py(t){const e=xe(t);return typeof e=="boolean"?e?1:0:2}function gy(t){const e=H(t).original;return e.cnt--==1?(e.a=0,!0):!1}function _y(t,e,n){return oe(O0(t,e,10,U5))}function by(t,e,n){return oe(O0(t,e,8,V5))}function yy(t,e){const n=ft(Au(xe(e)),w.__wbindgen_export_0,w.__wbindgen_export_1),o=We;L().setInt32(t+4,o,!0),L().setInt32(t+0,n,!0)}function xy(t,e){return oe(new Error(At(t,e)))}function wy(t,e){return xe(t)in xe(e)}function vy(t){return Array.isArray(xe(t))}function ky(t){return typeof xe(t)=="bigint"}function Sy(t){return!xe(t)}function Cy(t){return typeof xe(t)=="function"}function Ny(t){return xe(t)===null}function jy(t){const e=xe(t);return typeof e=="object"&&e!==null}function Ey(t){return typeof xe(t)=="string"}function Iy(t){return xe(t)===void 0}function Ay(t,e){return xe(t)===xe(e)}function Ty(t,e){return xe(t)==xe(e)}function My(){return oe(w.memory)}function Oy(t,e){const n=xe(e),o=typeof n=="number"?n:void 0;L().setFloat64(t+8,Pn(o)?0:o,!0),L().setInt32(t+0,!Pn(o),!0)}function Dy(t){return oe(t)}function Ry(t){return oe(xe(t))}function Py(t){H(t)}function Ly(t){throw H(t)}function Fy(t,e){const n=xe(e),o=typeof n=="string"?n:void 0;var r=Pn(o)?0:ft(o,w.__wbindgen_export_0,w.__wbindgen_export_1),s=We;L().setInt32(t+4,s,!0),L().setInt32(t+0,r,!0)}function zy(t,e){return oe(At(t,e))}function By(t,e){throw new Error(At(t,e))}function Uy(t){return oe(typeof xe(t))}const $5=Object.freeze(Object.defineProperty({__proto__:null,AwarenessWasm:R0,ChangeModifier:os,Cursor:Zn,EphemeralStoreWasm:class{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,F0.unregister(this),t}free(){const t=this.__destroy_into_raw();w.__wbg_ephemeralstorewasm_free(t,0)}constructor(t){const e=w.ephemeralstorewasm_new(t);return this.__wbg_ptr=e>>>0,F0.register(this,this.__wbg_ptr,this),this}set(t,e){const n=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),o=We;w.ephemeralstorewasm_set(this.__wbg_ptr,n,o,oe(e))}delete(t){const e=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),n=We;w.ephemeralstorewasm_delete(this.__wbg_ptr,e,n)}get(t){const e=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),n=We;return H(w.ephemeralstorewasm_get(this.__wbg_ptr,e,n))}getAllStates(){return H(w.ephemeralstorewasm_getAllStates(this.__wbg_ptr))}subscribeLocalUpdates(t){return H(w.ephemeralstorewasm_subscribeLocalUpdates(this.__wbg_ptr,oe(t)))}subscribe(t){return H(w.ephemeralstorewasm_subscribe(this.__wbg_ptr,oe(t)))}encode(t){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),i=We;w.ephemeralstorewasm_encode(r,this.__wbg_ptr,s,i);var e=L().getInt32(r+0,!0),n=L().getInt32(r+4,!0),o=io(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),o}finally{w.__wbindgen_add_to_stack_pointer(16)}}encodeAll(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.ephemeralstorewasm_encodeAll(o,this.__wbg_ptr);var t=L().getInt32(o+0,!0),e=L().getInt32(o+4,!0),n=io(t,e).slice();return w.__wbindgen_export_3(t,1*e,1),n}finally{w.__wbindgen_add_to_stack_pointer(16)}}apply(t){const e=Jo(t,w.__wbindgen_export_0),n=We;w.ephemeralstorewasm_apply(this.__wbg_ptr,e,n)}removeOutdated(){w.ephemeralstorewasm_removeOutdated(this.__wbg_ptr)}isEmpty(){return w.ephemeralstorewasm_isEmpty(this.__wbg_ptr)!==0}keys(){try{const o=w.__wbindgen_add_to_stack_pointer(-16);w.ephemeralstorewasm_keys(o,this.__wbg_ptr);var t=L().getInt32(o+0,!0),e=L().getInt32(o+4,!0),n=Ln(t,e).slice();return w.__wbindgen_export_3(t,4*e,4),n}finally{w.__wbindgen_add_to_stack_pointer(16)}}},LORO_VERSION:function(){let t,e;try{const r=w.__wbindgen_add_to_stack_pointer(-16);w.LORO_VERSION(r);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);return t=n,e=o,At(n,o)}finally{w.__wbindgen_add_to_stack_pointer(16),w.__wbindgen_export_3(t,e,1)}},LoroCounter:Mi,LoroDoc:xo,LoroList:Oi,LoroMap:Ko,LoroMovableList:Di,LoroText:Xo,LoroTree:Ri,LoroTreeNode:ao,UndoManager:class{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,B0.unregister(this),t}free(){const t=this.__destroy_into_raw();w.__wbg_undomanager_free(t,0)}constructor(t,e){ns(t,xo);const n=w.undomanager_new(t.__wbg_ptr,oe(e));return this.__wbg_ptr=n>>>0,B0.register(this,this.__wbg_ptr,this),this}undo(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.undomanager_undo(n,this.__wbg_ptr);var t=L().getInt32(n+0,!0),e=L().getInt32(n+4,!0);if(L().getInt32(n+8,!0))throw H(e);return t!==0}finally{w.__wbindgen_add_to_stack_pointer(16)}}redo(){try{const n=w.__wbindgen_add_to_stack_pointer(-16);w.undomanager_redo(n,this.__wbg_ptr);var t=L().getInt32(n+0,!0),e=L().getInt32(n+4,!0);if(L().getInt32(n+8,!0))throw H(e);return t!==0}finally{w.__wbindgen_add_to_stack_pointer(16)}}canUndo(){return w.undomanager_canUndo(this.__wbg_ptr)!==0}canRedo(){return w.undomanager_canRedo(this.__wbg_ptr)!==0}setMaxUndoSteps(t){w.undomanager_setMaxUndoSteps(this.__wbg_ptr,t)}setMergeInterval(t){w.undomanager_setMergeInterval(this.__wbg_ptr,t)}addExcludeOriginPrefix(t){const e=ft(t,w.__wbindgen_export_0,w.__wbindgen_export_1),n=We;w.undomanager_addExcludeOriginPrefix(this.__wbg_ptr,e,n)}setOnPush(t){w.undomanager_setOnPush(this.__wbg_ptr,oe(t))}setOnPop(t){w.undomanager_setOnPop(this.__wbg_ptr,oe(t))}clear(){w.undomanager_clear(this.__wbg_ptr)}},VersionVector:Fn,__wbg_String_8f0eb39a4a4c2f66:U0,__wbg_apply_9bb7fe8fff013a3f:V0,__wbg_buffer_ef9774282e5dab94:$0,__wbg_call_0ad083564791763a:H0,__wbg_call_a34b6b4765f27be0:W0,__wbg_call_d00953b926be4879:q0,__wbg_call_efe5a4db7065d1a2:G0,__wbg_changemodifier_new:Y0,__wbg_crypto_ed58b8e10a292839:J0,__wbg_cursor_new:K0,__wbg_done_f4c254830a095eaf:X0,__wbg_entries_4dce6361e3ba6fbc:Z0,__wbg_entries_83beb641792ccb9c:Q0,__wbg_error_7534b8e9a36f1ab4:eb,__wbg_error_9912f7d6d7835a4b:tb,__wbg_from_3aa0fcaa8eef0104:nb,__wbg_getRandomValues_bcb4912f16000dc4:ob,__wbg_get_0c3cc364764a0b98:rb,__wbg_get_b996a12be035ef4f:sb,__wbg_getindex_a471648b3037c750:ib,__wbg_getwithrefkey_1dc361bd10053bfe:ab,__wbg_globalThis_6b4d52a0b6aaeaea:lb,__wbg_global_49324ce12193de77:cb,__wbg_instanceof_ArrayBuffer_ff40e55b5978e215:db,__wbg_instanceof_Map_0f3f3653f757ced1:ub,__wbg_instanceof_Object_9108547bac1f91b1:hb,__wbg_instanceof_Uint8Array_db97368f94b1373f:fb,__wbg_isArray_8738f1062fa88586:mb,__wbg_isSafeInteger_a1b3e0811faecf2f:pb,__wbg_iterator_c0c688f37fa815e6:gb,__wbg_length_12246a78d2f65d3a:_b,__wbg_length_c24da17096edfe57:bb,__wbg_log_0cc1b7768397bcfe:yb,__wbg_log_0fd6c49475c7bece:xb,__wbg_log_cb9e190acc5753fb:wb,__wbg_lorocounter_new:vb,__wbg_lorolist_new:kb,__wbg_loromap_new:Sb,__wbg_loromovablelist_new:Cb,__wbg_lorotext_new:Nb,__wbg_lorotree_new:jb,__wbg_lorotreenode_new:Eb,__wbg_mark_7438147ce31e9d4b:Ib,__wbg_measure_fb7825c11612c823:Ab,__wbg_msCrypto_0a36e2ec3a343d26:Tb,__wbg_new_518e2184725aa711:Mb,__wbg_new_59845962d1127937:Ob,__wbg_new_67abf4a77618ee3e:Db,__wbg_new_8a6f238a6ece86ea:Rb,__wbg_new_e2d07398d7689006:Pb,__wbg_newnoargs_a136448eeb7d48ac:Lb,__wbg_newwithbyteoffsetandlength_84908302a4c137cf:Fb,__wbg_newwithlength_4c216eaaf23f2f9a:zb,__wbg_newwithlength_88b49de1eb24d63e:Bb,__wbg_next_928df8c15fc0c9b0:Ub,__wbg_next_9dc0926f351c7090:Vb,__wbg_node_02999533c4ea02e3:$b,__wbg_now_3e8577e703add0ba:Hb,__wbg_ownKeys_b16312a839a4152c:Wb,__wbg_process_5c1d670bc53614b8:qb,__wbg_push_e7d7247e69dad3ee:Gb,__wbg_randomFillSync_ab2cfe79ebbf2740:Yb,__wbg_require_79b1e9274cde3c87:Jb,__wbg_resolve_267ff08e7e1d2ce4:Kb,__wbg_self_cca3ca60d61220f4:Xb,__wbg_set_1b50d2de855a9d50:Zb,__wbg_set_393f510a6b7e9da5:Qb,__wbg_set_3f1d0b984ed272ed:ey,__wbg_set_5deee49b10b2b780:ty,__wbg_set_93ba9407b5476ec6:ny,__wbg_set_wasm:Iu,__wbg_setindex_e0b7b31bfc87ba3f:oy,__wbg_stack_0ed75d68575b0f3c:ry,__wbg_subarray_2dc34705c0dc7cdb:sy,__wbg_then_84907e7a6730461e:iy,__wbg_value_51f8a88d4a1805fb:ay,__wbg_versions_c71aa1626a93e0a1:ly,__wbg_versionvector_new:cy,__wbg_window_2aba046d3fc4ad7c:dy,__wbindgen_as_number:uy,__wbindgen_bigint_from_i64:hy,__wbindgen_bigint_from_u64:fy,__wbindgen_bigint_get_as_i64:my,__wbindgen_boolean_get:py,__wbindgen_cb_drop:gy,__wbindgen_closure_wrapper483:_y,__wbindgen_closure_wrapper486:by,__wbindgen_debug_string:yy,__wbindgen_error_new:xy,__wbindgen_in:wy,__wbindgen_is_array:vy,__wbindgen_is_bigint:ky,__wbindgen_is_falsy:Sy,__wbindgen_is_function:Cy,__wbindgen_is_null:Ny,__wbindgen_is_object:jy,__wbindgen_is_string:Ey,__wbindgen_is_undefined:Iy,__wbindgen_jsval_eq:Ay,__wbindgen_jsval_loose_eq:Ty,__wbindgen_memory:My,__wbindgen_number_get:Oy,__wbindgen_number_new:Dy,__wbindgen_object_clone_ref:Ry,__wbindgen_object_drop_ref:Py,__wbindgen_rethrow:Ly,__wbindgen_string_get:Fy,__wbindgen_string_new:zy,__wbindgen_throw:By,__wbindgen_typeof:Uy,decodeFrontiers:function(t){try{const o=w.__wbindgen_add_to_stack_pointer(-16),r=Jo(t,w.__wbindgen_export_0),s=We;w.decodeFrontiers(o,r,s);var e=L().getInt32(o+0,!0),n=L().getInt32(o+4,!0);if(L().getInt32(o+8,!0))throw H(n);return H(e)}finally{w.__wbindgen_add_to_stack_pointer(16)}},decodeImportBlobMeta:function(t,e){try{const r=w.__wbindgen_add_to_stack_pointer(-16),s=Jo(t,w.__wbindgen_export_0),i=We;w.decodeImportBlobMeta(r,s,i,e);var n=L().getInt32(r+0,!0),o=L().getInt32(r+4,!0);if(L().getInt32(r+8,!0))throw H(o);return H(n)}finally{w.__wbindgen_add_to_stack_pointer(16)}},encodeFrontiers:function(t){try{const s=w.__wbindgen_add_to_stack_pointer(-16),i=kn(t,w.__wbindgen_export_0),a=We;w.encodeFrontiers(s,i,a);var e=L().getInt32(s+0,!0),n=L().getInt32(s+4,!0),o=L().getInt32(s+8,!0);if(L().getInt32(s+12,!0))throw H(o);var r=io(e,n).slice();return w.__wbindgen_export_3(e,1*n,1),r}finally{w.__wbindgen_add_to_stack_pointer(16)}},run:function(){w.run()},setDebug:function(){w.setDebug()}},Symbol.toStringTag,{value:"Module"}));URL=globalThis.URL;const V=await(async(t={},e)=>{let n;if(e.startsWith("data:")){const o=e.replace(/^data:.*?base64,/,"");let r;if(typeof Buffer=="function"&&typeof Buffer.from=="function")r=Buffer.from(o,"base64");else{if(typeof atob!="function")throw new Error("Cannot decode base64-encoded data URL");{const s=atob(o);r=new Uint8Array(s.length);for(let i=0;i<s.length;i++)r[i]=s.charCodeAt(i)}}n=await WebAssembly.instantiate(r,t)}else{const o=await fetch(e),r=o.headers.get("Content-Type")||"";if("instantiateStreaming"in WebAssembly&&r.startsWith("application/wasm"))n=await WebAssembly.instantiateStreaming(o,t);else{const s=await o.arrayBuffer();n=await WebAssembly.instantiate(s,t)}}return n.instance.exports})({"./loro_wasm_bg.js":{__wbindgen_object_drop_ref:Py,__wbg_lorotree_new:jb,__wbg_lorocounter_new:vb,__wbg_loromovablelist_new:Cb,__wbg_lorotreenode_new:Eb,__wbg_cursor_new:K0,__wbg_lorolist_new:kb,__wbg_lorotext_new:Nb,__wbg_loromap_new:Sb,__wbg_versionvector_new:cy,__wbg_changemodifier_new:Y0,__wbindgen_is_function:Cy,__wbindgen_string_new:zy,__wbindgen_boolean_get:py,__wbindgen_error_new:xy,__wbindgen_object_clone_ref:Ry,__wbindgen_string_get:Fy,__wbindgen_is_undefined:Iy,__wbindgen_in:wy,__wbindgen_is_bigint:ky,__wbindgen_number_get:Oy,__wbindgen_bigint_from_i64:hy,__wbindgen_jsval_eq:Ay,__wbindgen_is_object:jy,__wbindgen_bigint_from_u64:fy,__wbindgen_cb_drop:gy,__wbindgen_as_number:uy,__wbindgen_is_string:Ey,__wbindgen_is_null:Ny,__wbindgen_number_new:Dy,__wbindgen_is_array:vy,__wbindgen_typeof:Uy,__wbg_error_9912f7d6d7835a4b:tb,__wbg_log_0fd6c49475c7bece:xb,__wbindgen_is_falsy:Sy,__wbindgen_jsval_loose_eq:Ty,__wbg_String_8f0eb39a4a4c2f66:U0,__wbg_getwithrefkey_1dc361bd10053bfe:ab,__wbg_set_3f1d0b984ed272ed:ey,__wbg_log_cb9e190acc5753fb:wb,__wbg_log_0cc1b7768397bcfe:yb,__wbg_mark_7438147ce31e9d4b:Ib,__wbg_measure_fb7825c11612c823:Ab,__wbg_new_8a6f238a6ece86ea:Rb,__wbg_stack_0ed75d68575b0f3c:ry,__wbg_error_7534b8e9a36f1ab4:eb,__wbg_now_3e8577e703add0ba:Hb,__wbg_crypto_ed58b8e10a292839:J0,__wbg_process_5c1d670bc53614b8:qb,__wbg_versions_c71aa1626a93e0a1:ly,__wbg_node_02999533c4ea02e3:$b,__wbg_require_79b1e9274cde3c87:Jb,__wbg_msCrypto_0a36e2ec3a343d26:Tb,__wbg_randomFillSync_ab2cfe79ebbf2740:Yb,__wbg_getRandomValues_bcb4912f16000dc4:ob,__wbg_self_cca3ca60d61220f4:Xb,__wbg_window_2aba046d3fc4ad7c:dy,__wbg_globalThis_6b4d52a0b6aaeaea:lb,__wbg_global_49324ce12193de77:cb,__wbg_newnoargs_a136448eeb7d48ac:Lb,__wbg_call_0ad083564791763a:H0,__wbg_get_0c3cc364764a0b98:rb,__wbg_length_12246a78d2f65d3a:_b,__wbg_new_e2d07398d7689006:Pb,__wbg_new_518e2184725aa711:Mb,__wbg_next_928df8c15fc0c9b0:Ub,__wbg_next_9dc0926f351c7090:Vb,__wbg_done_f4c254830a095eaf:X0,__wbg_value_51f8a88d4a1805fb:ay,__wbg_iterator_c0c688f37fa815e6:gb,__wbg_get_b996a12be035ef4f:sb,__wbg_new_67abf4a77618ee3e:Db,__wbg_newwithlength_88b49de1eb24d63e:Bb,__wbg_set_93ba9407b5476ec6:ny,__wbg_from_3aa0fcaa8eef0104:nb,__wbg_isArray_8738f1062fa88586:mb,__wbg_push_e7d7247e69dad3ee:Gb,__wbg_instanceof_ArrayBuffer_ff40e55b5978e215:db,__wbg_call_a34b6b4765f27be0:W0,__wbg_call_efe5a4db7065d1a2:G0,__wbg_call_d00953b926be4879:q0,__wbg_instanceof_Map_0f3f3653f757ced1:ub,__wbg_set_393f510a6b7e9da5:Qb,__wbg_entries_4dce6361e3ba6fbc:Z0,__wbg_isSafeInteger_a1b3e0811faecf2f:pb,__wbg_instanceof_Object_9108547bac1f91b1:hb,__wbg_entries_83beb641792ccb9c:Q0,__wbg_apply_9bb7fe8fff013a3f:V0,__wbg_ownKeys_b16312a839a4152c:Wb,__wbg_set_1b50d2de855a9d50:Zb,__wbg_buffer_ef9774282e5dab94:$0,__wbg_resolve_267ff08e7e1d2ce4:Kb,__wbg_then_84907e7a6730461e:iy,__wbg_newwithbyteoffsetandlength_84908302a4c137cf:Fb,__wbg_new_59845962d1127937:Ob,__wbg_set_5deee49b10b2b780:ty,__wbg_length_c24da17096edfe57:bb,__wbg_instanceof_Uint8Array_db97368f94b1373f:fb,__wbg_newwithlength_4c216eaaf23f2f9a:zb,__wbg_subarray_2dc34705c0dc7cdb:sy,__wbg_getindex_a471648b3037c750:ib,__wbg_setindex_e0b7b31bfc87ba3f:oy,__wbindgen_bigint_get_as_i64:my,__wbindgen_debug_string:yy,__wbindgen_throw:By,__wbindgen_rethrow:Ly,__wbindgen_memory:My,__wbindgen_closure_wrapper483:_y,__wbindgen_closure_wrapper486:by}},z5),H5=V.memory,W5=V.__wbg_lorocounter_free,q5=V.lorocounter_new,G5=V.lorocounter_kind,Y5=V.lorocounter_id,J5=V.lorocounter_increment,K5=V.lorocounter_decrement,X5=V.lorocounter_value,Z5=V.lorocounter_subscribe,Q5=V.lorocounter_parent,e6=V.lorocounter_isAttached,t6=V.lorocounter_getAttached,n6=V.lorocounter_getShallowValue,o6=V.__wbg_awarenesswasm_free,r6=V.awarenesswasm_new,s6=V.awarenesswasm_encode,i6=V.awarenesswasm_encodeAll,a6=V.awarenesswasm_apply,l6=V.awarenesswasm_setLocalState,c6=V.awarenesswasm_peer,d6=V.awarenesswasm_getAllStates,u6=V.awarenesswasm_getState,h6=V.awarenesswasm_getTimestamp,f6=V.awarenesswasm_removeOutdated,m6=V.awarenesswasm_length,p6=V.awarenesswasm_isEmpty,g6=V.awarenesswasm_peers,_6=V.__wbg_ephemeralstorewasm_free,b6=V.ephemeralstorewasm_new,y6=V.ephemeralstorewasm_set,x6=V.ephemeralstorewasm_delete,w6=V.ephemeralstorewasm_get,v6=V.ephemeralstorewasm_getAllStates,k6=V.ephemeralstorewasm_subscribeLocalUpdates,S6=V.ephemeralstorewasm_subscribe,C6=V.ephemeralstorewasm_encode,N6=V.ephemeralstorewasm_encodeAll,j6=V.ephemeralstorewasm_apply,E6=V.ephemeralstorewasm_removeOutdated,I6=V.ephemeralstorewasm_isEmpty,A6=V.ephemeralstorewasm_keys,T6=V.LORO_VERSION,M6=V.run,O6=V.encodeFrontiers,D6=V.decodeFrontiers,R6=V.setDebug,P6=V.__wbg_lorodoc_free,L6=V.lorodoc_new,F6=V.lorodoc_setDetachedEditing,z6=V.lorodoc_isDetachedEditingEnabled,B6=V.lorodoc_setRecordTimestamp,U6=V.lorodoc_setChangeMergeInterval,V6=V.lorodoc_configTextStyle,$6=V.lorodoc_configDefaultTextStyle,H6=V.lorodoc_fromSnapshot,W6=V.lorodoc_attach,q6=V.lorodoc_isDetached,G6=V.lorodoc_detach,Y6=V.lorodoc_fork,J6=V.lorodoc_forkAt,K6=V.lorodoc_checkoutToLatest,X6=V.lorodoc_travelChangeAncestors,Z6=V.lorodoc_findIdSpansBetween,Q6=V.lorodoc_checkout,eI=V.lorodoc_peerId,tI=V.lorodoc_peerIdStr,nI=V.lorodoc_setPeerId,oI=V.lorodoc_commit,rI=V.lorodoc_getPendingTxnLength,sI=V.lorodoc_getText,iI=V.lorodoc_getMap,aI=V.lorodoc_getList,lI=V.lorodoc_getMovableList,cI=V.lorodoc_getCounter,dI=V.lorodoc_getTree,uI=V.lorodoc_hasContainer,hI=V.lorodoc_getContainerById,fI=V.lorodoc_setNextCommitMessage,mI=V.lorodoc_setNextCommitOrigin,pI=V.lorodoc_setNextCommitTimestamp,gI=V.lorodoc_setNextCommitOptions,_I=V.lorodoc_clearNextCommitOptions,bI=V.lorodoc_getDeepValueWithID,yI=V.lorodoc_getPathToContainer,xI=V.lorodoc_JSONPath,wI=V.lorodoc_version,vI=V.lorodoc_shallowSinceVV,kI=V.lorodoc_isShallow,SI=V.lorodoc_shallowSinceFrontiers,CI=V.lorodoc_oplogVersion,NI=V.lorodoc_frontiers,jI=V.lorodoc_oplogFrontiers,EI=V.lorodoc_cmpWithFrontiers,II=V.lorodoc_cmpFrontiers,AI=V.lorodoc_exportSnapshot,TI=V.lorodoc_exportFrom,MI=V.lorodoc_export,OI=V.lorodoc_exportJsonUpdates,DI=V.lorodoc_exportJsonInIdSpan,RI=V.lorodoc_importJsonUpdates,PI=V.lorodoc_import,LI=V.lorodoc_importBatch,FI=V.lorodoc_getShallowValue,zI=V.lorodoc_toJSON,BI=V.lorodoc_subscribe,UI=V.lorodoc_subscribeLocalUpdates,VI=V.lorodoc_debugHistory,$I=V.lorodoc_changeCount,HI=V.lorodoc_opCount,WI=V.lorodoc_getAllChanges,qI=V.lorodoc_getChangeAt,GI=V.lorodoc_getChangeAtLamport,YI=V.lorodoc_getOpsInChange,JI=V.lorodoc_frontiersToVV,KI=V.lorodoc_vvToFrontiers,XI=V.lorodoc_getByPath,ZI=V.lorodoc_getCursorPos,QI=V.lorodoc_getChangedContainersIn,e8=V.lorodoc_revertTo,t8=V.lorodoc_applyDiff,n8=V.lorodoc_diff,o8=V.lorodoc_getUncommittedOpsAsJson,r8=V.lorodoc_subscribeFirstCommitFromPeer,s8=V.lorodoc_subscribePreCommit,i8=V.lorodoc_deleteRootContainer,a8=V.lorodoc_setHideEmptyRootContainers,l8=V.__wbg_lorotext_free,c8=V.lorotext_new,d8=V.lorotext_kind,u8=V.lorotext_iter,h8=V.lorotext_update,f8=V.lorotext_updateByLine,m8=V.lorotext_insert,p8=V.lorotext_slice,g8=V.lorotext_charAt,_8=V.lorotext_splice,b8=V.lorotext_insertUtf8,y8=V.lorotext_delete,x8=V.lorotext_deleteUtf8,w8=V.lorotext_mark,v8=V.lorotext_unmark,k8=V.lorotext_toString,S8=V.lorotext_toDelta,C8=V.lorotext_id,N8=V.lorotext_length,j8=V.lorotext_subscribe,E8=V.lorotext_applyDelta,I8=V.lorotext_parent,A8=V.lorotext_isAttached,T8=V.lorotext_getAttached,M8=V.lorotext_getCursor,O8=V.lorotext_push,D8=V.lorotext_getEditorOf,R8=V.lorotext_isDeleted,P8=V.lorotext_getShallowValue,L8=V.lorotext_toJSON,F8=V.__wbg_loromap_free,z8=V.loromap_new,B8=V.loromap_kind,U8=V.loromap_set,V8=V.loromap_delete,$8=V.loromap_get,H8=V.loromap_getOrCreateContainer,W8=V.loromap_keys,q8=V.loromap_values,G8=V.loromap_entries,Y8=V.loromap_id,J8=V.loromap_toJSON,K8=V.loromap_setContainer,X8=V.loromap_subscribe,Z8=V.loromap_size,Q8=V.loromap_parent,eA=V.loromap_isAttached,tA=V.loromap_getAttached,nA=V.loromap_clear,oA=V.loromap_getLastEditor,rA=V.loromap_isDeleted,sA=V.loromap_getShallowValue,iA=V.__wbg_lorolist_free,aA=V.lorolist_new,lA=V.lorolist_kind,cA=V.lorolist_insert,dA=V.lorolist_delete,uA=V.lorolist_get,hA=V.lorolist_id,fA=V.lorolist_toArray,mA=V.lorolist_toJSON,pA=V.lorolist_insertContainer,gA=V.lorolist_pushContainer,_A=V.lorolist_subscribe,bA=V.lorolist_length,yA=V.lorolist_parent,xA=V.lorolist_isAttached,wA=V.lorolist_getAttached,vA=V.lorolist_getCursor,kA=V.lorolist_push,SA=V.lorolist_pop,CA=V.lorolist_clear,NA=V.lorolist_getIdAt,jA=V.lorolist_isDeleted,EA=V.lorolist_getShallowValue,IA=V.loromovablelist_new,AA=V.loromovablelist_kind,TA=V.loromovablelist_insert,MA=V.loromovablelist_delete,OA=V.loromovablelist_get,DA=V.loromovablelist_id,RA=V.loromovablelist_toArray,PA=V.loromovablelist_toJSON,LA=V.loromovablelist_insertContainer,FA=V.loromovablelist_pushContainer,zA=V.loromovablelist_subscribe,BA=V.loromovablelist_length,UA=V.loromovablelist_parent,VA=V.loromovablelist_isAttached,$A=V.loromovablelist_getAttached,HA=V.loromovablelist_getCursor,WA=V.loromovablelist_move,qA=V.loromovablelist_set,GA=V.loromovablelist_setContainer,YA=V.loromovablelist_push,JA=V.loromovablelist_pop,KA=V.loromovablelist_clear,XA=V.loromovablelist_getCreatorAt,ZA=V.loromovablelist_getLastMoverAt,QA=V.loromovablelist_getLastEditorAt,eT=V.loromovablelist_isDeleted,tT=V.loromovablelist_getShallowValue,nT=V.__wbg_lorotree_free,oT=V.lorotreenode___getClassname,rT=V.__wbg_lorotreenode_free,sT=V.lorotreenode_id,iT=V.lorotreenode_createNode,aT=V.lorotreenode_move,lT=V.lorotreenode_moveAfter,cT=V.lorotreenode_moveBefore,dT=V.lorotreenode_index,uT=V.lorotreenode_fractionalIndex,hT=V.lorotreenode_data,fT=V.lorotreenode_toJSON,mT=V.lorotreenode_parent,pT=V.lorotreenode_children,gT=V.lorotreenode_isDeleted,_T=V.lorotreenode_getLastMoveId,bT=V.lorotreenode_creationId,yT=V.lorotreenode_creator,xT=V.lorotree_new,wT=V.lorotree_kind,vT=V.lorotree_createNode,kT=V.lorotree_move,ST=V.lorotree_delete,CT=V.lorotree_getNodeByID,NT=V.lorotree_id,jT=V.lorotree_has,ET=V.lorotree_isNodeDeleted,IT=V.lorotree_toArray,AT=V.lorotree_getNodes,TT=V.lorotree_toJSON,MT=V.lorotree_nodes,OT=V.lorotree_roots,DT=V.lorotree_subscribe,RT=V.lorotree_parent,PT=V.lorotree_isAttached,LT=V.lorotree_getAttached,FT=V.lorotree_enableFractionalIndex,zT=V.lorotree_disableFractionalIndex,BT=V.lorotree_isFractionalIndexEnabled,UT=V.lorotree_isDeleted,VT=V.lorotree_getShallowValue,$T=V.__wbg_cursor_free,HT=V.cursor_containerId,WT=V.cursor_pos,qT=V.cursor_side,GT=V.cursor_encode,YT=V.cursor_decode,JT=V.cursor_kind,KT=V.__wbg_undomanager_free,XT=V.undomanager_new,ZT=V.undomanager_undo,QT=V.undomanager_redo,e7=V.undomanager_canUndo,t7=V.undomanager_canRedo,n7=V.undomanager_setMaxUndoSteps,o7=V.undomanager_setMergeInterval,r7=V.undomanager_addExcludeOriginPrefix,s7=V.undomanager_setOnPush,i7=V.undomanager_setOnPop,a7=V.undomanager_clear,l7=V.__wbg_versionvector_free,c7=V.versionvector_new,d7=V.versionvector_parseJSON,u7=V.versionvector_toJSON,h7=V.versionvector_encode,f7=V.versionvector_decode,m7=V.versionvector_get,p7=V.versionvector_compare,g7=V.versionvector_setEnd,_7=V.versionvector_setLast,b7=V.versionvector_remove,y7=V.versionvector_length,x7=V.decodeImportBlobMeta,w7=V.__wbg_changemodifier_free,v7=V.changemodifier_setMessage,k7=V.changemodifier_setTimestamp,S7=V.lorodoc_importUpdateBatch,C7=V.__wbg_loromovablelist_free,N7=V.__wbindgen_export_0,j7=V.__wbindgen_export_1,E7=V.__wbindgen_export_2,I7=V.__wbindgen_export_3,A7=V.__wbindgen_export_4,T7=V.__wbindgen_add_to_stack_pointer,M7=V.__wbindgen_export_5,O7=V.__wbindgen_export_6,zu=V.__wbindgen_start,Vy=Object.freeze(Object.defineProperty({__proto__:null,LORO_VERSION:T6,__wbg_awarenesswasm_free:o6,__wbg_changemodifier_free:w7,__wbg_cursor_free:$T,__wbg_ephemeralstorewasm_free:_6,__wbg_lorocounter_free:W5,__wbg_lorodoc_free:P6,__wbg_lorolist_free:iA,__wbg_loromap_free:F8,__wbg_loromovablelist_free:C7,__wbg_lorotext_free:l8,__wbg_lorotree_free:nT,__wbg_lorotreenode_free:rT,__wbg_undomanager_free:KT,__wbg_versionvector_free:l7,__wbindgen_add_to_stack_pointer:T7,__wbindgen_export_0:N7,__wbindgen_export_1:j7,__wbindgen_export_2:E7,__wbindgen_export_3:I7,__wbindgen_export_4:A7,__wbindgen_export_5:M7,__wbindgen_export_6:O7,__wbindgen_start:zu,awarenesswasm_apply:a6,awarenesswasm_encode:s6,awarenesswasm_encodeAll:i6,awarenesswasm_getAllStates:d6,awarenesswasm_getState:u6,awarenesswasm_getTimestamp:h6,awarenesswasm_isEmpty:p6,awarenesswasm_length:m6,awarenesswasm_new:r6,awarenesswasm_peer:c6,awarenesswasm_peers:g6,awarenesswasm_removeOutdated:f6,awarenesswasm_setLocalState:l6,changemodifier_setMessage:v7,changemodifier_setTimestamp:k7,cursor_containerId:HT,cursor_decode:YT,cursor_encode:GT,cursor_kind:JT,cursor_pos:WT,cursor_side:qT,decodeFrontiers:D6,decodeImportBlobMeta:x7,encodeFrontiers:O6,ephemeralstorewasm_apply:j6,ephemeralstorewasm_delete:x6,ephemeralstorewasm_encode:C6,ephemeralstorewasm_encodeAll:N6,ephemeralstorewasm_get:w6,ephemeralstorewasm_getAllStates:v6,ephemeralstorewasm_isEmpty:I6,ephemeralstorewasm_keys:A6,ephemeralstorewasm_new:b6,ephemeralstorewasm_removeOutdated:E6,ephemeralstorewasm_set:y6,ephemeralstorewasm_subscribe:S6,ephemeralstorewasm_subscribeLocalUpdates:k6,lorocounter_decrement:K5,lorocounter_getAttached:t6,lorocounter_getShallowValue:n6,lorocounter_id:Y5,lorocounter_increment:J5,lorocounter_isAttached:e6,lorocounter_kind:G5,lorocounter_new:q5,lorocounter_parent:Q5,lorocounter_subscribe:Z5,lorocounter_value:X5,lorodoc_JSONPath:xI,lorodoc_applyDiff:t8,lorodoc_attach:W6,lorodoc_changeCount:$I,lorodoc_checkout:Q6,lorodoc_checkoutToLatest:K6,lorodoc_clearNextCommitOptions:_I,lorodoc_cmpFrontiers:II,lorodoc_cmpWithFrontiers:EI,lorodoc_commit:oI,lorodoc_configDefaultTextStyle:$6,lorodoc_configTextStyle:V6,lorodoc_debugHistory:VI,lorodoc_deleteRootContainer:i8,lorodoc_detach:G6,lorodoc_diff:n8,lorodoc_export:MI,lorodoc_exportFrom:TI,lorodoc_exportJsonInIdSpan:DI,lorodoc_exportJsonUpdates:OI,lorodoc_exportSnapshot:AI,lorodoc_findIdSpansBetween:Z6,lorodoc_fork:Y6,lorodoc_forkAt:J6,lorodoc_fromSnapshot:H6,lorodoc_frontiers:NI,lorodoc_frontiersToVV:JI,lorodoc_getAllChanges:WI,lorodoc_getByPath:XI,lorodoc_getChangeAt:qI,lorodoc_getChangeAtLamport:GI,lorodoc_getChangedContainersIn:QI,lorodoc_getContainerById:hI,lorodoc_getCounter:cI,lorodoc_getCursorPos:ZI,lorodoc_getDeepValueWithID:bI,lorodoc_getList:aI,lorodoc_getMap:iI,lorodoc_getMovableList:lI,lorodoc_getOpsInChange:YI,lorodoc_getPathToContainer:yI,lorodoc_getPendingTxnLength:rI,lorodoc_getShallowValue:FI,lorodoc_getText:sI,lorodoc_getTree:dI,lorodoc_getUncommittedOpsAsJson:o8,lorodoc_hasContainer:uI,lorodoc_import:PI,lorodoc_importBatch:LI,lorodoc_importJsonUpdates:RI,lorodoc_importUpdateBatch:S7,lorodoc_isDetached:q6,lorodoc_isDetachedEditingEnabled:z6,lorodoc_isShallow:kI,lorodoc_new:L6,lorodoc_opCount:HI,lorodoc_oplogFrontiers:jI,lorodoc_oplogVersion:CI,lorodoc_peerId:eI,lorodoc_peerIdStr:tI,lorodoc_revertTo:e8,lorodoc_setChangeMergeInterval:U6,lorodoc_setDetachedEditing:F6,lorodoc_setHideEmptyRootContainers:a8,lorodoc_setNextCommitMessage:fI,lorodoc_setNextCommitOptions:gI,lorodoc_setNextCommitOrigin:mI,lorodoc_setNextCommitTimestamp:pI,lorodoc_setPeerId:nI,lorodoc_setRecordTimestamp:B6,lorodoc_shallowSinceFrontiers:SI,lorodoc_shallowSinceVV:vI,lorodoc_subscribe:BI,lorodoc_subscribeFirstCommitFromPeer:r8,lorodoc_subscribeLocalUpdates:UI,lorodoc_subscribePreCommit:s8,lorodoc_toJSON:zI,lorodoc_travelChangeAncestors:X6,lorodoc_version:wI,lorodoc_vvToFrontiers:KI,lorolist_clear:CA,lorolist_delete:dA,lorolist_get:uA,lorolist_getAttached:wA,lorolist_getCursor:vA,lorolist_getIdAt:NA,lorolist_getShallowValue:EA,lorolist_id:hA,lorolist_insert:cA,lorolist_insertContainer:pA,lorolist_isAttached:xA,lorolist_isDeleted:jA,lorolist_kind:lA,lorolist_length:bA,lorolist_new:aA,lorolist_parent:yA,lorolist_pop:SA,lorolist_push:kA,lorolist_pushContainer:gA,lorolist_subscribe:_A,lorolist_toArray:fA,lorolist_toJSON:mA,loromap_clear:nA,loromap_delete:V8,loromap_entries:G8,loromap_get:$8,loromap_getAttached:tA,loromap_getLastEditor:oA,loromap_getOrCreateContainer:H8,loromap_getShallowValue:sA,loromap_id:Y8,loromap_isAttached:eA,loromap_isDeleted:rA,loromap_keys:W8,loromap_kind:B8,loromap_new:z8,loromap_parent:Q8,loromap_set:U8,loromap_setContainer:K8,loromap_size:Z8,loromap_subscribe:X8,loromap_toJSON:J8,loromap_values:q8,loromovablelist_clear:KA,loromovablelist_delete:MA,loromovablelist_get:OA,loromovablelist_getAttached:$A,loromovablelist_getCreatorAt:XA,loromovablelist_getCursor:HA,loromovablelist_getLastEditorAt:QA,loromovablelist_getLastMoverAt:ZA,loromovablelist_getShallowValue:tT,loromovablelist_id:DA,loromovablelist_insert:TA,loromovablelist_insertContainer:LA,loromovablelist_isAttached:VA,loromovablelist_isDeleted:eT,loromovablelist_kind:AA,loromovablelist_length:BA,loromovablelist_move:WA,loromovablelist_new:IA,loromovablelist_parent:UA,loromovablelist_pop:JA,loromovablelist_push:YA,loromovablelist_pushContainer:FA,loromovablelist_set:qA,loromovablelist_setContainer:GA,loromovablelist_subscribe:zA,loromovablelist_toArray:RA,loromovablelist_toJSON:PA,lorotext_applyDelta:E8,lorotext_charAt:g8,lorotext_delete:y8,lorotext_deleteUtf8:x8,lorotext_getAttached:T8,lorotext_getCursor:M8,lorotext_getEditorOf:D8,lorotext_getShallowValue:P8,lorotext_id:C8,lorotext_insert:m8,lorotext_insertUtf8:b8,lorotext_isAttached:A8,lorotext_isDeleted:R8,lorotext_iter:u8,lorotext_kind:d8,lorotext_length:N8,lorotext_mark:w8,lorotext_new:c8,lorotext_parent:I8,lorotext_push:O8,lorotext_slice:p8,lorotext_splice:_8,lorotext_subscribe:j8,lorotext_toDelta:S8,lorotext_toJSON:L8,lorotext_toString:k8,lorotext_unmark:v8,lorotext_update:h8,lorotext_updateByLine:f8,lorotree_createNode:vT,lorotree_delete:ST,lorotree_disableFractionalIndex:zT,lorotree_enableFractionalIndex:FT,lorotree_getAttached:LT,lorotree_getNodeByID:CT,lorotree_getNodes:AT,lorotree_getShallowValue:VT,lorotree_has:jT,lorotree_id:NT,lorotree_isAttached:PT,lorotree_isDeleted:UT,lorotree_isFractionalIndexEnabled:BT,lorotree_isNodeDeleted:ET,lorotree_kind:wT,lorotree_move:kT,lorotree_new:xT,lorotree_nodes:MT,lorotree_parent:RT,lorotree_roots:OT,lorotree_subscribe:DT,lorotree_toArray:IT,lorotree_toJSON:TT,lorotreenode___getClassname:oT,lorotreenode_children:pT,lorotreenode_createNode:iT,lorotreenode_creationId:bT,lorotreenode_creator:yT,lorotreenode_data:hT,lorotreenode_fractionalIndex:uT,lorotreenode_getLastMoveId:_T,lorotreenode_id:sT,lorotreenode_index:dT,lorotreenode_isDeleted:gT,lorotreenode_move:aT,lorotreenode_moveAfter:lT,lorotreenode_moveBefore:cT,lorotreenode_parent:mT,lorotreenode_toJSON:fT,memory:H5,run:M6,setDebug:R6,undomanager_addExcludeOriginPrefix:r7,undomanager_canRedo:t7,undomanager_canUndo:e7,undomanager_clear:a7,undomanager_new:XT,undomanager_redo:QT,undomanager_setMaxUndoSteps:n7,undomanager_setMergeInterval:o7,undomanager_setOnPop:i7,undomanager_setOnPush:s7,undomanager_undo:ZT,versionvector_compare:p7,versionvector_decode:f7,versionvector_encode:h7,versionvector_get:m7,versionvector_length:y7,versionvector_new:c7,versionvector_parseJSON:d7,versionvector_remove:b7,versionvector_setEnd:g7,versionvector_setLast:_7,versionvector_toJSON:u7},Symbol.toStringTag,{value:"Module"}));if(zu)Iu(Vy),zu();else{const t=await $m(()=>Promise.resolve().then(()=>Vy),void 0,import.meta.url);Iu(new WebAssembly.Instance(t.default,{"./loro_wasm_bg.js":$5}).exports)}const D7=["Map","Text","List","Tree","MovableList","Counter"];function $y(t){if(typeof t!="object"||t==null)return!1;const e=Object.getPrototypeOf(t);return e!=null&&typeof e=="object"&&typeof e.kind=="function"&&D7.includes(t.kind())}xo.prototype.toJsonWithReplacer=function(t){const e=new Set,n=this,o=(i,a)=>{if(typeof a=="string"&&a.startsWith("cid:")&&!e.has(a)){e.add(a);const c=n.getContainerById(a);if(c==null)throw new Error(`ContainerID not found: ${a}`);const d=t(i,c);if(d===c){const h=c.getShallowValue();return typeof h=="object"?r(h):h}if($y(d))throw new Error("Using new container is not allowed in toJsonWithReplacer");return typeof d=="object"&&d!=null?r(d):d}if(typeof a=="object"&&a!=null)return r(a);const l=t(i,a);if($y(l))throw new Error("Using new container is not allowed in toJsonWithReplacer");return l},r=i=>{if(Array.isArray(i))return i.map((l,c)=>o(c,l)).filter(l=>l!==void 0);const a={};for(const[l,c]of Object.entries(i)){const d=o(l,c);d!==void 0&&(a[l]=d)}return a},s=n.getShallowValue();return r(s)};const R7=st.baseTheme({".loro-cursor":{position:"absolute",width:"2px",display:"inline-block",height:"1.2em"},".loro-cursor::before":{position:"absolute",top:"1.3em",left:"0",content:"var(--rtc-name)",padding:"2px 6px",fontSize:"12px",borderRadius:"3px",whiteSpace:"nowrap",userSelect:"none",backgroundColor:"inherit",opacity:"0.7"},".loro-selection":{opacity:"0.5"}}),Pi=Rt.define(),Bu=On.define({create:()=>({remoteCursors:new Map,isCheckout:!1}),update(t,e){for(const n of e.effects)if(n.is(Pi))switch(n.value.type){case"update":{const{peer:o,user:r,cursor:s}=n.value;t.remoteCursors.set(o,{uid:o,cursor:s,user:r});break}case"delete":t.remoteCursors.delete(n.value.peer);break;case"checkout":t.isCheckout=n.value.checkout}return t}}),Hy=t=>{const e=t.transactions.flatMap(n=>n.effects).filter(n=>n.is(Pi));return t.docChanged||t.viewportChanged||e.length>0};class vl{constructor(e,n,o,r,s){this.left=e,this.top=n,this.height=o,this.name=r,this.colorClassName=s}draw(){const e=document.createElement("div");return this.adjust(e),e}update(e){return this.adjust(e),!0}adjust(e){e.style.left=`${this.left}px`,e.style.top=`${this.top}px`,e.style.height=`${this.height}px`,e.className=`loro-cursor ${this.colorClassName}`,e.style.setProperty("--rtc-name",`"${this.name}"`)}eq(e){return this.left===e.left&&this.top===e.top&&this.height===e.height&&this.name===e.name}static createCursor(e,n,o,r){const s=vl.calculateAbsoluteCursorPosition(n,e);if(!s)return[];const i=e.scrollDOM.getBoundingClientRect(),a=(e.textDirection===WU.LTR?i.left:i.right-e.scrollDOM.clientWidth)-e.scrollDOM.scrollLeft,l=i.top-e.scrollDOM.scrollTop;return[new vl(s.left-a,s.top-l,s.bottom-s.top,o,r)]}static calculateAbsoluteCursorPosition(e,n){const o=Math.max(0,Math.min(n.state.doc.length,e.anchor));return n.coordsAtPos(o,e.assoc||1)}}const P7=(t,e,n,o)=>{const r=[],{updated:s,added:i}=n;for(const a of[...s,...i]){const l=Wy(t,e,a,o);l&&r.push(l)}return r},Wy=(t,e,n,o)=>{const r=e.getAllStates()[n];if(!r||n===t.peerIdStr||r.scopeId!==o)return;if(r.type==="delete")return Pi.of({type:"delete",peer:r.uid,scopeId:r.scopeId});const s=Zn.decode(r.cursor.anchor),i=t.getCursorPos(s).offset;let a=i;if(r.cursor.head){const l=Zn.decode(r.cursor.head);a=t.getCursorPos(l).offset}return Pi.of({type:"update",peer:r.uid,scopeId:r.scopeId,cursor:{anchor:i,head:a},user:r.user})};class L7{constructor(e,n,o,r,s,i,a){this.view=e,this.doc=n,this.user=o,this.awareness=r,this.getTextFromDoc=s,this.scopeId=i,this.getUserId=a,this.sub=void 0,this.sub=this.doc.subscribe(l=>{if(l.by==="local"){const c=[];for(const d of this.awareness.peers()){const h=Wy(this.doc,this.awareness,d,this.scopeId);h&&c.push(h)}this.view.dispatch({effects:c})}else l.by==="checkout"&&this.view.dispatch({effects:[Pi.of({type:"checkout",checkout:this.doc.isDetached()})]})})}update(e){if(!e.selectionSet&&!e.focusChanged&&!e.docChanged)return;const n=e.state.selection.main;if(this.view.hasFocus&&!this.doc.isDetached()){const o=z7(this.doc,this.getTextFromDoc,n.anchor,n.head);this.awareness.setLocalState({type:"update",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId,cursor:o,user:this.user})}else this.awareness.setLocalState({type:"delete",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}destroy(){var e;(e=this.sub)==null||e.call(this),this.awareness.setLocalState({type:"delete",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}}class F7{constructor(e,n,o,r){this.view=e,this.doc=n,this.awareness=o,this.scopeId=r,this._awarenessListener=void 0;const s=async(i,a)=>{a!=="local"&&this.view.dispatch({effects:P7(this.doc,this.awareness,i,this.scopeId)})};this._awarenessListener=s,this.awareness.addListener(s)}destroy(){this._awarenessListener&&this.awareness.removeListener(this._awarenessListener)}}const z7=(t,e,n,o)=>{var i,a;n===o&&(o=void 0);const r=(i=e(t).getCursor(n))==null?void 0:i.encode();if(!r)throw new Error("cursor head not found");let s;return o!==void 0&&(s=(a=e(t).getCursor(o))==null?void 0:a.encode()),{anchor:r,head:s}},kl=["bg-[var(--amber-6)]","bg-[var(--blue-6)]","bg-[var(--crimson-6)]","bg-[var(--cyan-6)]","bg-[var(--grass-6)]","bg-[var(--gray-6)]","bg-[var(--green-6)]","bg-[var(--lime-6)]","bg-[var(--orange-6)]","bg-[var(--purple-6)]","bg-[var(--red-6)]","bg-[var(--sage-6)]","bg-[var(--sky-6)]","bg-[var(--slate-6)]"],B7=(t,e,n)=>Mn.define(o=>new U7(o,t,e,n)),rs=Bm.define();class U7{constructor(e,n,o,r){this.view=e,this.doc=n,this.docPath=o,this.getTextFromDoc=r,this.sub=void 0,this.isInitDispatch=!1,this.onRemoteUpdate=s=>{if(s.by!=="local")if(s.by!=="checkout"){if(s.by==="import"){const i=[];let a=0;for(const{diff:l,path:c}of s.events){if(c.join("/")!==this.docPath.join("/")||l.type!=="text")continue;const d=l.diff;for(const h of d)h.insert?i.push({from:a,to:a,insert:h.insert}):h.delete?(i.push({from:a,to:a+h.delete}),a+=h.delete):h.retain!=null&&(a+=h.retain);i.length>0&&this.view.dispatch({changes:i,annotations:[rs.of(this)]})}}}else this.view.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:this.getTextFromDoc(this.doc).toString()}],annotations:[rs.of(this)]})},this.sub=n.subscribe(this.onRemoteUpdate),Promise.resolve().then(()=>{this.isInitDispatch=!0;const s=this.view.state.doc.toString(),i=this.getTextFromDoc(this.doc);s!==i.toString()&&e.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:i.toString()}]})})}update(e){if(this.isInitDispatch)return void(this.isInitDispatch=!1);if(!e.docChanged||e.transactions.length>0&&(e.transactions[0].annotation(rs)===this||e.transactions[0].annotation(rs)==="undo"))return;let n=0;e.changes.iterChanges((o,r,s,i,a)=>{const l=a.sliceString(0,a.length,`
|
120
|
+
`);o!==r&&this.getTextFromDoc(this.doc).delete(o+n,r-o),l.length>0&&this.getTextFromDoc(this.doc).insert(o+n,l),n+=l.length-(r-o)}),this.doc.commit()}destroy(){var e;(e=this.sub)==null||e.call(this),this.sub=void 0}}const un=Dt.get("rtc"),qy=un.get("awareness").disabled(),Uu="awareness:",ss=Gt(void 0),Wt=new xo,Sl=new class{constructor(t,e=3e4){this.listeners=new Set,this.inner=new R0(t,e),this.peer=t,this.timeout=e}apply(t,e="remote"){const{updated:n,added:o}=this.inner.apply(t);this.listeners.forEach(r=>{r({updated:n,added:o,removed:[]},e)}),this.startTimerIfNotEmpty()}setLocalState(t){const e=this.inner.getState(this.peer)==null;this.inner.setLocalState(t),e?this.listeners.forEach(n=>{n({updated:[],added:[this.inner.peer()],removed:[]},"local")}):this.listeners.forEach(n=>{n({updated:[this.inner.peer()],added:[],removed:[]},"local")}),this.startTimerIfNotEmpty()}getLocalState(){return this.inner.getState(this.peer)}getAllStates(){return this.inner.getAllStates()}encode(t){return this.inner.encode(t)}encodeAll(){return this.inner.encodeAll()}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}peers(){return this.inner.peers()}destroy(){clearInterval(this.timer),this.listeners.clear()}startTimerIfNotEmpty(){this.inner.isEmpty()||this.timer!=null||(this.timer=setInterval(()=>{const t=this.inner.removeOutdated();t.length>0&&this.listeners.forEach(e=>{e({updated:[],added:[],removed:t},"timeout")}),this.inner.isEmpty()&&(clearInterval(this.timer),this.timer=void 0)},this.timeout/2))}}(Wt.peerIdStr),Vu=GU(()=>{un.debug("creating websocket");const t=T4().getWsSyncURL(W4()).toString(),e=new kH(t,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4});return Promise.resolve().then(async()=>{await M4(),YU()==="edit"&&e.reconnect()}),e.addEventListener("message",async n=>{const o=n.data,r=await o.arrayBuffer(),s=new Uint8Array(r);if(function(i,a){return new TextDecoder().decode(i.slice(0,a.length))===a}(s,Uu)){const i=function(a,l){return a.slice(l.length)}(s,Uu);return Sl.apply(i),void qy.debug("applied awareness update")}Wt.import(s),un.debug("imported doc change. new doc:",Wt.toJSON()),ct.get(ss)!==Wt&&ct.set(ss,Wt)}),e.addEventListener("open",()=>{un.debug("websocket open")}),e.addEventListener("close",n=>{un.warn("websocket close",n),ct.get(ss)===Wt&&ct.set(ss,void 0)}),e});function $u(t,e,n=""){if(In())return{extension:[],code:n};const o=Wt.getByPath(`codes/${t}`)!==void 0,r=Wt.getMap("codes").getOrCreateContainer(t,new Xo);o||(un.log("initializing code for new cell",n),r.insert(0,n));const s={get name(){return ct.get(q4)||"Anonymous"},get colorClassName(){return(i=>{if(typeof i=="string"){let a=0;for(let l=0;l<i.length;l++)a=(a<<5)-a+i.charCodeAt(l),a=Math.trunc(a);return kl[Math.abs(a)%kl.length]}return kl[i%kl.length]})(this.name)}};return{code:n.toString(),extension:[V7(t),$7(t),H7(Wt,Sl,s,()=>r,t),B7(Wt,["codes",t],()=>r)]}}function V7(t){const e=(o,r)=>{const s=o.state.field(Fc).type,i=r.toString();i&&i!==s&&(un.debug(`[incoming] setting language type: ${s} -> ${i}`),Pr(o,i,{keepCodeAsIs:!0}))},n=(o,r)=>{const s=o.state.field(Wm),i=r.toJSON();ha(s,i)||o.dispatch({effects:[$4.of(i)],annotations:[rs.of(!0)]})};return Mn.define(o=>{let r;return Promise.resolve().then(()=>{const s=Wt.getByPath(`languages/${t}`);if(!s)return void un.error("no language container found for cell",t);zo(s instanceof Xo,"language type is not a LoroText");const i=Wt.getByPath(`language_metadata/${t}`);i?(zo(i instanceof Ko,"language metadata is not a LoroMap"),e(o,s),n(o,i),r=Wt.subscribe(a=>{if(a.origin==="local")return;const l=a.events.some(d=>d.target===s.id),c=a.events.some(d=>d.target===i.id);l&&e(o,s),c&&n(o,i)})):un.error("no language metadata container found for cell",t)}),{destroy(){r()}}})}function $7(t){const e=Wt.getMap("languages").getOrCreateContainer(t,new Xo),n=Wt.getMap("language_metadata").getOrCreateContainer(t,new Ko);return st.updateListener.of(o=>{const r=e.toString()!=="";if(!o.docChanged&&r)return;if(!r){const i=Hm(o.state).type;Pr(o.view,i),un.debug("no initial language, setting default to",i),e.delete(0,e.length),e.insert(0,i),un.debug("no initial language metadata, setting default to",o.state.field(Wm));const a=o.state.field(Wm);for(const l of Object.keys(a))n.set(l,a[l]);return void Wt.commit()}let s=!1;for(const i of o.transactions)if(!i.annotation(rs)){for(const a of i.effects)if(a.is(qU)&&e.toString()!==a.value.type&&(un.debug(`[outgoing] language change: ${e} -> ${a.value.type}`),e.delete(0,e.length),e.insert(0,a.value.type),s=!0),a.is($4)||a.is(H4)){const l=a.value;a.is(H4)?(un.debug("[outgoing] setting language metadata: ",l),n.clear()):un.debug("[outgoing] updating language metadata: ",l);for(const c of Object.keys(l))n.set(c,l[c]);s=!0}}s&&Wt.commit()})}function H7(t,e,n,o,r,s){const i=`loro:cell:${r}`;return[Bu,V4({above:!0,class:"loro-cursor-layer",update:Hy,markers:a=>{const{remoteCursors:l,isCheckout:c}=a.state.field(Bu);return c?[]:[...l.values()].flatMap(d=>{var f,m;const h=Bo.cursor(d.cursor.anchor);return vl.createCursor(a,h,((f=d.user)==null?void 0:f.name)||"unknown",((m=d.user)==null?void 0:m.colorClassName)||"")})}}),V4({above:!1,class:"loro-selection-layer",update:Hy,markers:a=>{const{remoteCursors:l,isCheckout:c}=a.state.field(Bu);return c?[]:[...l.entries()].filter(([,d])=>d.cursor.head!==void 0&&d.cursor.anchor!==d.cursor.head).flatMap(([,d])=>{var f;const h=Bo.range(d.cursor.anchor,d.cursor.head);return HU.forRange(a,`loro-selection ${((f=d.user)==null?void 0:f.colorClassName)||""}`,h)})}}),Mn.define(a=>new L7(a,t,n,e,o,i,s)),Mn.define(a=>new F7(a,t,e,i)),R7]}function Cl(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}Vc()&&Vu(),Wt.subscribeLocalUpdates(t=>{un.debug("local update, sending to server"),Vu().send(t)}),Sl.addListener((t,e)=>{const n=[...t.added,...t.removed,...t.updated];e==="local"&&(qy.debug("awareness changes",n),Vu().send(function(o,r){const s=new TextEncoder().encode(o);return new Uint8Array([...s,...r])}(Uu,Sl.encode(n))))});var Gy={modified:{doc:""},original:{doc:""}},Yy=T.createContext(Gy);function W7(t,e){return jt({},t,e,{modified:jt({},t.modified,e.modified),original:jt({},t.original,e.original)})}var Hu=()=>T.useContext(Yy),q7=t=>{var{children:e,theme:n}=t,[o,r]=T.useReducer(W7,jt({},Gy,{theme:n}));return T.useEffect(()=>r({theme:n}),[n]),u.jsx(Yy.Provider,{value:jt({},o,{dispatch:r}),children:e})},G7=["extensions","value","selection","onChange"],Jy=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=wa(t,G7),{theme:i,dispatch:a}=Hu(),l=ni(jt({},s,{theme:i}));return T.useEffect(()=>a({original:{doc:n,selection:o,extensions:[...l,...e]},originalExtension:{onChange:r,option:s,extension:[e]}}),[t]),null};Jy.displayName="CodeMirrorMerge.Original";var Y7=["extensions","value","selection","onChange"],Ky=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=wa(t,Y7),{theme:i,dispatch:a}=Hu(),l=ni(jt({},s,{theme:i}));return T.useEffect(()=>{a({modified:{doc:n,selection:o,extensions:[...l,...e]},modifiedExtension:{onChange:r,option:s,extension:[e]}})},[t]),null};Ky.displayName="CodeMirrorMerge.Modified";class Tt{constructor(e,n,o,r){this.fromA=e,this.toA=n,this.fromB=o,this.toB=r}offset(e,n){return new Tt(this.fromA+e,this.toA+e,this.fromB+n,this.toB+n)}}function Ar(t,e,n,o,r,s){if(t==o)return[];let i=Gu(t,e,n,o,r,s),a=Yu(t,e+i,n,o,r+i,s),l=(n-=a)-(e+=i),c=(s-=a)-(r+=i);if(!l||!c)return[new Tt(e,n,r,s)];if(l>c){let h=t.slice(e,n).indexOf(o.slice(r,s));if(h>-1)return[new Tt(e,e+h,r,r),new Tt(e+h+c,n,s,s)]}else if(c>l){let h=o.slice(r,s).indexOf(t.slice(e,n));if(h>-1)return[new Tt(e,e,r,r+h),new Tt(n,n,r+h+l,s)]}if(l==1||c==1)return[new Tt(e,n,r,s)];let d=Qy(t,e,n,o,r,s);if(d){let[h,f,m]=d;return Ar(t,e,h,o,r,f).concat(Ar(t,h+m,n,o,f+m,s))}return function(h,f,m,_,g,p){let b=m-f,y=p-g;if(Li<1e9&&Math.min(b,y)>16*Li)return Math.min(b,y)>64*Li?[new Tt(f,m,g,p)]:ex(h,f,m,_,g,p);let x=Math.ceil((b+y)/2);Wu.reset(x),qu.reset(x);let k=(N,I)=>h.charCodeAt(f+N)==_.charCodeAt(g+I),C=(N,I)=>h.charCodeAt(m-N-1)==_.charCodeAt(p-I-1),v=(b-y)%2!=0?qu:null,E=v?null:Wu;for(let N=0;N<x;N++){if(N>Li)return ex(h,f,m,_,g,p);let I=Wu.advance(N,b,y,x,v,!1,k)||qu.advance(N,b,y,x,E,!0,C);if(I)return J7(h,f,m,f+I[0],_,g,p,g+I[1])}return[new Tt(f,m,g,p)]}(t,e,n,o,r,s)}let Li=1e9;class Xy{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,n,o,r,s,i,a){for(let l=-e+this.start;l<=e-this.end;l+=2){let c=r+l,d=l==-e||l!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,h=d-l;for(;d<n&&h<o&&a(d,h);)d++,h++;if(this.vec[c]=d,d>n)this.end+=2;else if(h>o)this.start+=2;else if(s){let f=r+(n-o)-l;if(f>=0&&f<this.len&&s.vec[f]!=-1){if(i){let m=s.vec[f];if(m>=n-d)return[m,r+m-f]}else if(d>=n-s.vec[f])return[d,h]}}}return null}}const Wu=new Xy,qu=new Xy;function J7(t,e,n,o,r,s,i,a){let l=!1;return is(t,o)||++o!=n||(l=!0),is(r,a)||++a!=i||(l=!0),l?[new Tt(e,n,s,i)]:Ar(t,e,o,r,s,a).concat(Ar(t,o,n,r,a,i))}function Zy(t,e){let n=1,o=Math.min(t,e);for(;n<o;)n<<=1;return n}function Gu(t,e,n,o,r,s){if(e==n||e==s||t.charCodeAt(e)!=o.charCodeAt(r))return 0;let i=Zy(n-e,s-r);for(let a=e,l=r;;){let c=a+i,d=l+i;if(c>n||d>s||t.slice(a,c)!=o.slice(l,d)){if(i==1)return a-e-(is(t,a)?0:1);i>>=1}else{if(c==n||d==s)return c-e;a=c,l=d}}}function Yu(t,e,n,o,r,s){if(e==n||r==s||t.charCodeAt(n-1)!=o.charCodeAt(s-1))return 0;let i=Zy(n-e,s-r);for(let a=n,l=s;;){let c=a-i,d=l-i;if(c<e||d<r||t.slice(c,a)!=o.slice(d,l)){if(i==1)return n-a-(is(t,a)?0:1);i>>=1}else{if(c==e||d==r)return n-c;a=c,l=d}}}function Ju(t,e,n,o,r,s,i,a){let l=o.slice(r,s),c=null;for(;;){if(c||i<a)return c;for(let d=e+i;;){is(t,d)||d++;let h=d+i;if(is(t,h)||(h+=h==d+1?1:-1),h>=n)break;let f=t.slice(d,h),m=-1;for(;(m=l.indexOf(f,m+1))!=-1;){let _=Gu(t,h,n,o,r+m+f.length,s),g=Yu(t,e,d,o,r,r+m),p=f.length+_+g;(!c||c[2]<p)&&(c=[d-g,r+m-g,p])}d=h}if(a<0)return c;i>>=1}}function Qy(t,e,n,o,r,s){let i=n-e,a=s-r;if(i<a){let l=Qy(o,r,s,t,e,n);return l&&[l[1],l[0],l[2]]}return i<4||2*a<i?null:Ju(t,e,n,o,r,s,Math.floor(i/4),-1)}function ex(t,e,n,o,r,s){let i,a=n-e,l=s-r;if(a<l){let f=Ju(o,r,s,t,e,n,Math.floor(a/6),50);i=f&&[f[1],f[0],f[2]]}else i=Ju(t,e,n,o,r,s,Math.floor(l/6),50);if(!i)return[new Tt(e,n,r,s)];let[c,d,h]=i;return Ar(t,e,c,o,r,d).concat(Ar(t,c+h,n,o,d+h,s))}function tx(t,e){for(let n=1;n<t.length;n++){let o=t[n-1],r=t[n];o.toA>r.fromA-e&&o.toB>r.fromB-e&&(t[n-1]=new Tt(o.fromA,r.toA,o.fromB,r.toB),t.splice(n--,1))}}let Tr;try{Tr=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function nx(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function ox(t,e){if(e==t.length)return 0;let n=t.charCodeAt(e);return n<192?nx(n)?1:0:Tr?ax(n)&&e!=t.length-1?Tr.test(t.slice(e,e+2))?2:0:Tr.test(String.fromCharCode(n))?1:0:0}function rx(t,e){if(!e)return 0;let n=t.charCodeAt(e-1);return n<192?nx(n)?1:0:Tr?lx(n)&&e!=1?Tr.test(t.slice(e-2,e))?2:0:Tr.test(String.fromCharCode(n))?1:0:0}function sx(t,e,n){if(e==t.length||!rx(t,e))return e;for(let o=e,r=e+n;;){let s=ox(t,o);if(!s)return o;if(o+=s,o>r)return e}}function ix(t,e,n){if(!e||!ox(t,e))return e;for(let o=e,r=e-n;;){let s=rx(t,o);if(!s)return o;if(o-=s,o<r)return e}}function K7(t,e,n){for(let o=e,r=e-n;;){let s=o?t.charCodeAt(o-1):10;if(s==10)return o;if(o--,o<r||s!=32&&s!=9)return e}}const ax=t=>t>=55296&&t<=56319,lx=t=>t>=56320&&t<=57343;function is(t,e){return!e||e==t.length||!ax(t.charCodeAt(e-1))||!lx(t.charCodeAt(e))}function X7(t,e,n){var o;return Li=((o=n==null?void 0:n.scanLimit)!==null&&o!==void 0?o:1e9)>>1,function(r,s,i){for(;;){tx(i,1);let a=!1;for(let l=0;l<i.length;l++){let c,d,h=i[l];(c=Gu(r,h.fromA,h.toA,s,h.fromB,h.toB))&&(h=i[l]=new Tt(h.fromA+c,h.toA,h.fromB+c,h.toB)),(d=Yu(r,h.fromA,h.toA,s,h.fromB,h.toB))&&(h=i[l]=new Tt(h.fromA,h.toA-d,h.fromB,h.toB-d));let f=h.toA-h.fromA,m=h.toB-h.fromB;if(f&&m)continue;let _=h.fromA-(l?i[l-1].toA:0),g=(l<i.length-1?i[l+1].fromA:r.length)-h.toA;if(!_||!g)continue;let p=f?r.slice(h.fromA,h.toA):s.slice(h.fromB,h.toB);_<=p.length&&r.slice(h.fromA-_,h.fromA)==p.slice(p.length-_)?(i[l]=new Tt(h.fromA-_,h.toA-_,h.fromB-_,h.toB-_),a=!0):g<=p.length&&r.slice(h.toA,h.toA+g)==p.slice(0,g)&&(i[l]=new Tt(h.fromA+g,h.toA+g,h.fromB+g,h.toB+g),a=!0)}if(!a)break}return i}(t,e,Ar(t,0,t.length,e,0,e.length))}function cx(t,e,n){return function(o,r,s){for(let i=0,a=0;a<o.length;a++){let l=o[a],c=l.toA-l.fromA,d=l.toB-l.fromB;if(c&&d||c>3||d>3){let h=a==o.length-1?r.length:o[a+1].fromA,f=l.fromA-i,m=h-l.toA,_=ix(r,l.fromA,Math.min(f,5)),g=sx(r,l.toA,Math.min(m,5)),p=l.fromA-_,b=g-l.toA;if(!c||!d){let y,x,k=Math.max(c,d),[C,v,E]=c?[r,l.fromA,l.toA]:[s,l.fromB,l.toB];p&&b?(k>p&&r.slice(_,l.fromA)==C.slice(E-p,E)?(l=o[a]=new Tt(_,_+c,l.fromB-p,l.toB-p),_=l.fromA,g=sx(r,l.toA,Math.min(h-l.toA,5))):k>b&&r.slice(l.toA,g)==C.slice(v,v+b)&&(l=o[a]=new Tt(g-c,g,l.fromB+b,l.toB+b),g=l.toA,_=ix(r,l.fromA,Math.min(l.fromA-i,5))),p=l.fromA-_,b=g-l.toA):p||b||!(x=l.fromA-(y=K7(r,l.fromA,f)))||r.slice(y,l.fromA)!=C.slice(E-x,E)||(l=o[a]=new Tt(y,y+c,l.fromB-x,l.toB-x))}(p||b)&&(l=o[a]=new Tt(l.fromA-p,l.toA+b,l.fromB-p,l.toB+b)),i=l.toA}}return tx(o,3),o}(X7(t,e,n),t,e)}const lo=Zs.define({combine:t=>t[0]}),Ku=Rt.define(),as=On.define({create:t=>null,update(t,e){for(let n of e.effects)n.is(Ku)&&(t=n.value);return t}});class ls{constructor(e,n,o,r,s){this.changes=e,this.fromA=n,this.toA=o,this.fromB=r,this.toB=s}offset(e,n){return e||n?new ls(this.changes,this.fromA+e,this.toA+e,this.fromB+n,this.toB+n):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,n,o){return hx(cx(e.toString(),n.toString(),o),e,n,0,0)}static updateA(e,n,o,r,s){return px(mx(e,r,!0,o.length),e,n,o,s)}static updateB(e,n,o,r,s){return px(mx(e,r,!1,n.length),e,n,o,s)}}function dx(t,e,n,o){let r=n.lineAt(t),s=o.lineAt(e);return r.to==t&&s.to==e&&t<n.length&&e<o.length?[t+1,e+1]:[r.from,s.from]}function ux(t,e,n,o){let r=n.lineAt(t),s=o.lineAt(e);return r.from==t&&s.from==e?[t,e]:[r.to+1,s.to+1]}function hx(t,e,n,o,r){let s=[];for(let i=0;i<t.length;i++){let a=t[i],[l,c]=dx(a.fromA+o,a.fromB+r,e,n),[d,h]=ux(a.toA+o,a.toB+r,e,n),f=[a.offset(-l+o,-c+r)];for(;i<t.length-1;){let m=t[i+1],[_,g]=dx(m.fromA+o,m.fromB+r,e,n);if(_>d+1&&g>h+1)break;f.push(m.offset(-l+o,-c+r)),[d,h]=ux(m.toA+o,m.toB+r,e,n),i++}s.push(new ls(f,l,Math.max(l,d),c,Math.max(c,h)))}return s}const Nl=1e3;function fx(t,e,n,o){let r=0,s=t.length;for(;;){if(r==s){let d=0,h=0;r&&({toA:d,toB:h}=t[r-1]);let f=e-(n?d:h);return[d+f,h+f]}let i=r+s>>1,a=t[i],[l,c]=n?[a.fromA,a.toA]:[a.fromB,a.toB];if(l>e)s=i;else{if(!(c<=e))return o?[a.fromA,a.fromB]:[a.toA,a.toB];r=i+1}}}function mx(t,e,n,o){let r=[];return e.iterChangedRanges((s,i,a,l)=>{let c=0,d=n?e.length:o,h=0,f=n?o:e.length;s>Nl&&([c,h]=fx(t,s-Nl,n,!0)),i<e.length-Nl&&([d,f]=fx(t,i+Nl,n,!1));let m,_=l-a-(i-s),[g,p]=n?[_,0]:[0,_];r.length&&(m=r[r.length-1]).toA>=c?r[r.length-1]={fromA:m.fromA,fromB:m.fromB,toA:d,toB:f,diffA:m.diffA+g,diffB:m.diffB+p}:r.push({fromA:c,toA:d,fromB:h,toB:f,diffA:g,diffB:p})}),r}function px(t,e,n,o,r){if(!t.length)return e;let s=0,i=0,a=0,l=[];for(let c of t){let d=c.fromA+i,h=c.toA+i+c.diffA,f=c.fromB+a,m=c.toB+a+c.diffB;for(;s<e.length;){let _=e[s];if(_.toA+i<=d&&_.toB+a<=f)l.push(_.offset(i,a));else if(_.fromA+i>h)break;s++}for(let _ of hx(cx(n.sliceString(d,h),o.sliceString(f,m),r),n,o,d,f))l.push(_);for(i+=c.diffA,a+=c.diffB;s<e.length;){let _=e[s];if(_.fromA>h+i&&_.fromB>m+a)break;s++}}for(;s<e.length;)l.push(e[s++].offset(i,a));return l}const gx=Mn.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=yx(t))}update(t){var e,n;(t.docChanged||t.viewportChanged||(e=t.startState,n=t.state,e.field(as,!1)!=n.field(as,!1))||function(o,r){return o.facet(lo)!=r.facet(lo)}(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=yx(t.view))}},{decorations:t=>t.deco}),jl=Vo.low(KU({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(gx))===null||e===void 0?void 0:e.gutter)||qm.empty}})),_x=dt.line({class:"cm-changedLine"}),Z7=dt.mark({class:"cm-changedText"}),Q7=dt.mark({tagName:"ins",class:"cm-insertedLine"}),eM=dt.mark({tagName:"del",class:"cm-deletedLine"}),bx=new class extends XU{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function tM(t,e,n,o,r,s){let i=n?t.fromA:t.fromB,a=n?t.toA:t.toB,l=0;if(i!=a){r.add(i,i,_x),r.add(i,a,n?eM:Q7),s&&s.add(i,i,bx);for(let c=e.iterRange(i,a-1),d=i;!c.next().done;){if(c.lineBreak){d++,r.add(d,d,_x),s&&s.add(d,d,bx);continue}let h=d+c.value.length;if(o)for(;l<t.changes.length;){let f=t.changes[l],m=i+(n?f.fromA:f.fromB),_=i+(n?f.toA:f.toB),g=Math.max(d,m),p=Math.min(h,_);if(g<p&&r.add(g,p,Z7),!(_<h))break;l++}d=h}}}function yx(t){let e=t.state.field(as),{side:n,highlightChanges:o,markGutter:r}=t.state.facet(lo),s=n=="a",i=new Ys,a=r?new Ys:null,{from:l,to:c}=t.viewport;for(let d of e){if((s?d.fromA:d.fromB)>=c)break;(s?d.toA:d.toB)>l&&tM(d,t.state.doc,s,o,i,a)}return{deco:i.finish(),gutter:a&&a.finish()}}class El extends Qs{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement("div");return e.className="cm-mergeSpacer",e.style.height=this.height+"px",e}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}const Il=Rt.define({map:(t,e)=>t.map(e)}),Fi=On.define({create:()=>dt.none,update:(t,e)=>{for(let n of e.effects)if(n.is(Il))return n.value;return t.map(e.changes)},provide:t=>st.decorations.from(t)}),Xu=.01,Zu=Rt.define({map:(t,e)=>e.mapPos(t)});class nM extends Qs{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let n=document.createElement("div");return n.className="cm-collapsedLines",n.textContent="\u299A "+e.state.phrase("$ unchanged lines",this.lines)+" \u299A",n.addEventListener("click",o=>{let r=e.posAtDOM(o.target);e.dispatch({effects:Zu.of(r)});let{side:s,sibling:i}=e.state.facet(lo);i&&i().dispatch({effects:Zu.of(oM(r,e.state.field(as),s=="a"))})}),n}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}}function oM(t,e,n){let o=0,r=0;for(let s=0;;s++){let i=s<e.length?e[s]:null;if(!i||(n?i.fromA:i.fromB)>=t)return r+(t-o);[o,r]=n?[i.toA,i.toB]:[i.toB,i.toA]}}const rM=On.define({create:t=>dt.none,update(t,e){t=t.map(e.changes);for(let n of e.effects)n.is(Zu)&&(t=t.update({filter:o=>o!=n.value}));return t},provide:t=>st.decorations.from(t)});function xx({margin:t=3,minSize:e=4}){return rM.init(n=>function(o,r,s){let i=new Ys,a=o.facet(lo).side=="a",l=o.field(as),c=1;for(let d=0;;d++){let h=d<l.length?l[d]:null,f=d?c+r:1,m=h?o.doc.lineAt(a?h.fromA:h.fromB).number-1-r:o.doc.lines,_=m-f+1;if(_>=s&&i.add(o.doc.line(f).from,o.doc.line(m).to,dt.replace({widget:new nM(_),block:!0})),!h)break;c=o.doc.lineAt(Math.min(o.doc.length,a?h.toA:h.toB)).number}return i.finish()}(n,t,e))}const sM=st.styleModule.of(new JU({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),iM=st.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb2266, #22bb2266) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff8866, #88ff8866) bottom/100% 2px no-repeat"},".cm-insertedLine, .cm-deletedLine":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer"},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"}}),wx=new Lc,Al=new Lc;class vx{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig;let n=[Vo.low(gx),iM,sM,Fi,st.updateListener.of(h=>{this.measuring<0&&(h.heightChanged||h.viewportChanged)&&!h.transactions.some(f=>f.effects.some(m=>m.is(Il)))&&this.measure()})],o=[lo.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&o.push(jl);let r=fr.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],st.editorAttributes.of({class:"cm-merge-a"}),Al.of(o),n]}),s=[lo.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&s.push(jl);let i=fr.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],st.editorAttributes.of({class:"cm-merge-b"}),Al.of(s),n]});this.chunks=ls.build(r.doc,i.doc,this.diffConf);let a=[as.init(()=>this.chunks),wx.of(e.collapseUnchanged?xx(e.collapseUnchanged):[])];r=r.update({effects:Rt.appendConfig.of(a)}).state,i=i.update({effects:Rt.appendConfig.of(a)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let l=e.orientation||"a-b",c=document.createElement("div");c.className="cm-mergeViewEditor";let d=document.createElement("div");d.className="cm-mergeViewEditor",this.editorDOM.appendChild(l=="a-b"?c:d),this.editorDOM.appendChild(l=="a-b"?d:c),this.a=new st({state:r,parent:c,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.a)}),this.b=new st({state:i,parent:d,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,n){if(e.some(o=>o.docChanged)){let o=e[e.length-1],r=e.reduce((i,a)=>i.compose(a.changes),ya.empty(e[0].startState.doc.length));this.chunks=n==this.a?ls.updateA(this.chunks,o.newDoc,this.b.state.doc,r,this.diffConf):ls.updateB(this.chunks,this.a.state.doc,o.newDoc,r,this.diffConf),n.update([...e,o.state.update({effects:Ku.of(this.chunks)})]);let s=n==this.a?this.b:this.a;s.update([s.state.update({effects:Ku.of(this.chunks)})]),this.scheduleMeasure()}else n.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let s=e.orientation!="b-a";if(s!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let i=this.a.dom.parentNode,a=this.b.dom.parentNode;i.remove(),a.remove(),this.editorDOM.insertBefore(s?i:a,this.editorDOM.firstChild),this.editorDOM.appendChild(s?a:i),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let s=!!this.revertDOM,i=this.revertToA,a=this.renderRevert;"revertControls"in e&&(s=!!e.revertControls,i=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(a=e.renderRevertControl),this.setupRevertControls(s,i,a)}let n="highlightChanges"in e,o="gutter"in e,r="collapseUnchanged"in e;if(n||o||r){let s=[],i=[];if(n||o){let a=this.a.state.facet(lo),l=o?e.gutter!==!1:a.markGutter,c=n?e.highlightChanges!==!1:a.highlightChanges;s.push(Al.reconfigure([lo.of({side:"a",sibling:()=>this.b,highlightChanges:c,markGutter:l}),l?jl:[]])),i.push(Al.reconfigure([lo.of({side:"b",sibling:()=>this.a,highlightChanges:c,markGutter:l}),l?jl:[]]))}if(r){let a=wx.reconfigure(e.collapseUnchanged?xx(e.collapseUnchanged):[]);s.push(a),i.push(a)}this.a.dispatch({effects:s}),this.b.dispatch({effects:i})}this.scheduleMeasure()}setupRevertControls(e,n,o){this.revertToA=n,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=o,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",r=>this.revertClicked(r)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){(function(e,n,o){let r=new Ys,s=new Ys,i=e.state.field(Fi).iter(),a=n.state.field(Fi).iter(),l=0,c=0,d=0,h=0;for(let g=0;;g++){let p=g<o.length?o[g]:null;if(l<(p?p.fromA:e.state.doc.length)){let b=e.lineBlockAt(l).top+d-(n.lineBlockAt(c).top+h);b<-.01?(d-=b,r.add(l,l,dt.widget({widget:new El(-b),block:!0,side:-1}))):b>Xu&&(h+=b,s.add(c,c,dt.widget({widget:new El(b),block:!0,side:-1})))}if(!p)break;for(l=p.toA,c=p.toB;i.value&&i.from<l;)d-=i.value.spec.widget.height,i.next();for(;a.value&&a.from<c;)h-=a.value.spec.widget.height,a.next()}for(;i.value;)d-=i.value.spec.widget.height,i.next();for(;a.value;)h-=a.value.spec.widget.height,a.next();let f=e.contentHeight+d-(n.contentHeight+h);f<Xu?r.add(e.state.doc.length,e.state.doc.length,dt.widget({widget:new El(-f),block:!0,side:1})):f>Xu&&s.add(n.state.doc.length,n.state.doc.length,dt.widget({widget:new El(f),block:!0,side:1}));let m=r.finish(),_=s.finish();qm.eq([m],[e.state.field(Fi)])||e.dispatch({effects:Il.of(m)}),qm.eq([_],[n.state.field(Fi)])||n.dispatch({effects:Il.of(_)})})(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,n=e.firstChild,o=this.a.viewport,r=this.b.viewport;for(let s=0;s<this.chunks.length;s++){let i=this.chunks[s];if(i.fromA>o.to||i.fromB>r.to)break;if(i.fromA<o.from||i.fromB<r.from)continue;let a=this.a.lineBlockAt(i.fromA).top+"px";for(;n&&+n.dataset.chunk<s;)n=kx(n);n&&n.dataset.chunk==String(s)?(n.style.top!=a&&(n.style.top=a),n=n.nextSibling):e.insertBefore(this.renderRevertButton(a,s),n)}for(;n;)n=kx(n)}renderRevertButton(e,n){let o;if(this.renderRevert)o=this.renderRevert();else{o=document.createElement("button");let r=this.a.state.phrase("Revert this chunk");o.setAttribute("aria-label",r),o.setAttribute("title",r),o.textContent=this.revertToLeft?"\u21DC":"\u21DD"}return o.style.top=e,o.setAttribute("data-chunk",String(n)),o}revertClicked(e){let n,o=e.target;for(;o&&o.parentNode!=this.revertDOM;)o=o.parentNode;if(o&&(n=this.chunks[o.dataset.chunk])){let[r,s,i,a,l,c]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],d=r.state.sliceDoc(i,Math.max(i,a-1));i!=a&&c<=s.state.doc.length&&(d+=r.state.lineBreak),s.dispatch({changes:{from:l,to:Math.min(s.state.doc.length,c),insert:d},userEvent:"revert"}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}}function kx(t){let e=t.nextSibling;return t.remove(),e}var aM=["className","children","orientation","revertControls","highlightChanges","gutter","collapseUnchanged","destroyRerender","renderRevertControl","diffConfig"],lM=["modified","modifiedExtension","original","originalExtension","theme","dispatch"],Sx=J.forwardRef((t,e)=>{var{className:n,children:o,orientation:r,revertControls:s,highlightChanges:i,gutter:a,collapseUnchanged:l,destroyRerender:c=!0,renderRevertControl:d,diffConfig:h}=t,f=wa(t,aM),m=Hu(),{modified:_,modifiedExtension:g,original:p,originalExtension:b,theme:y,dispatch:x}=m,k=wa(m,lM),C=T.useRef(null),v=T.useRef(),E={orientation:r,revertControls:s,highlightChanges:i,gutter:a,collapseUnchanged:l,renderRevertControl:d,diffConfig:h};T.useImperativeHandle(e,()=>({container:C.current,view:v.current,modified:_,original:p,config:jt({a:p,b:_,parent:C.current},E)}),[C,v,_,p,E]);var N=st.updateListener.of(A=>{if(A.docChanged&&typeof(b==null?void 0:b.onChange)=="function"){var M=A.state.doc.toString();b==null||b.onChange(M,A)}}),I=st.updateListener.of(A=>{if(A.docChanged&&typeof(g==null?void 0:g.onChange)=="function"){var M=A.state.doc.toString();g==null||g.onChange(M,A)}});return T.useEffect(()=>{!v.current&&C.current&&b&&g&&(v.current=new vx(jt({a:jt({},p,{extensions:[...(b==null?void 0:b.extension)||[],...ni(jt({},b==null?void 0:b.option,{theme:y})),N]}),b:jt({},_,{extensions:[...(g==null?void 0:g.extension)||[],...ni(jt({},g==null?void 0:g.option,{theme:y})),I]}),parent:C.current},E)),x({view:v.current}))},[v,C,b,g]),T.useEffect(()=>{if(p&&p.doc&&v.current){var A,M,R=(A=v.current)==null?void 0:A.a.state.doc.toString();R!==p.doc&&((M=v.current)==null||M.a.dispatch({changes:{from:0,to:R.length,insert:p.doc||""}}))}if(_&&_.doc&&v.current){var z,D,F=(z=v.current)==null?void 0:z.b.state.doc.toString();F!==_.doc&&((D=v.current)==null||D.b.dispatch({changes:{from:0,to:F.length,insert:_.doc||""}}))}if(c&&v.current){var B=v.current.a.state.selection.ranges[0].from,U=v.current.b.state.selection.ranges[0].from;v.current.destroy(),v.current=new vx(jt({a:jt({},p,{extensions:[...(b==null?void 0:b.extension)||[],...ni(jt({},b==null?void 0:b.option,{theme:y}))]}),b:jt({},_,{extensions:[...(g==null?void 0:g.extension)||[],...ni(jt({},g==null?void 0:g.option,{theme:y}))]}),parent:C.current},E)),B&&(v.current.a.focus(),v.current.a.dispatch({selection:{anchor:B,head:B}})),U&&(v.current.b.focus(),v.current.b.dispatch({selection:{anchor:U,head:U}}))}},[v,y,C.current,p,_,b,g,c]),T.useEffect(()=>()=>v.current&&v.current.destroy(),[]),T.useEffect(()=>{if(v.current){var A={};k.orientation!==r&&(A.orientation=r),k.revertControls!==s&&(A.revertControls=s),k.highlightChanges!==i&&(A.highlightChanges=i),k.gutter!==a&&(A.gutter=a),k.collapseUnchanged!==l&&(A.collapseUnchanged=l),k.renderRevertControl!==d&&(A.collapseUnchanged=l),Object.keys(A).length&&x&&v.current&&(v.current.reconfigure(jt({},A)),x(jt({},A)))}},[x,v,r,s,i,a,l,d]),u.jsx("div",jt({ref:C,className:"cm-merge-theme"+(n?" "+n:"")},f,{children:o}))});Sx.displayName="CodeMirrorMerge.Internal";var cM=["theme"],cs=J.forwardRef((t,e)=>{var{theme:n}=t,o=wa(t,cM);return u.jsx(q7,{theme:n,children:u.jsx(Sx,jt({},o,{ref:e}))})});cs.Original=Jy,cs.Modified=Ky,cs.displayName="CodeMirrorMerge";const dM=cs.Original,uM=cs.Modified,Cx=[QU(),st.lineWrapping],hM=t=>{const e=K.c(42),{className:n,onChange:o,initialPrompt:r,currentLanguageAdapter:s,currentCode:i,declineChange:a,acceptChange:l,enabled:c,children:d}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={},e[0]=h):h=e[0];const[f,m]=T.useState(h),[_,g]=an(dC),p=Gm(),{completion:b,input:y,stop:x,isLoading:k,setCompletion:C,setInput:v,handleSubmit:E}=ZU({api:p.getAiURL("completion").toString(),headers:p.headers(),initialInput:r,streamProtocol:"text",experimental_throttle:100,body:{...f,includeOtherCode:_?Pc(i):"",code:i,language:s},onError:fM,onFinish:(Y,q)=>{N(q.trimEnd())}}),N=C,I=J.useRef(null);let A,M,R,z;e[1]!==c?(A=()=>{var q;const Y=I.current;c&&Y&&(requestAnimationFrame(()=>{var ne;(ne=Y.view)==null||ne.focus()}),eV((q=I.current)==null?void 0:q.view))},M=[c],e[1]=c,e[2]=A,e[3]=M):(A=e[2],M=e[3]),T.useEffect(A,M),e[4]!==c||e[5]!==r||e[6]!==v?(R=()=>{c&&v(r||"")},z=[c,r,v],e[4]=c,e[5]=r,e[6]=v,e[7]=R,e[8]=z):(R=e[7],z=e[8]),T.useEffect(R,z);const{theme:D}=gr();let F;e[9]!==n?(F=Ae("flex flex-col w-full rounded-[inherit]",n),e[9]=n,e[10]=F):F=e[10];const B=c&&"max-h-[400px] min-h-11 visible",U=!c&&"max-h-0 min-h-0 invisible";let O,S,$,j;e[11]!==B||e[12]!==U?(O=Ae("flex items-center gap-2 border-b px-3 transition-all rounded-[inherit] rounded-b-none duration-300",B,U),e[11]=B,e[12]=U,e[13]=O):O=e[13],e[14]!==l||e[15]!==b||e[16]!==a||e[17]!==c||e[18]!==E||e[19]!==_||e[20]!==y||e[21]!==k||e[22]!==N||e[23]!==g||e[24]!==v||e[25]!==x||e[26]!==D?(S=c&&u.jsxs(u.Fragment,{children:[u.jsx(sa,{className:"text-[var(--blue-10)] flex-shrink-0",size:16}),u.jsx($c,{inputRef:I,theme:D,onClose:()=>{a(),N("")},value:y,onChange:Y=>{v(Y),m(Y4({input:Y}))},onSubmit:()=>{k||E()}}),k&&u.jsxs(De,{"data-testid":"stop-completion-button",variant:"text",size:"xs",className:"mb-0",onClick:x,children:[u.jsx(Ym,{className:"animate-spin mr-1",size:14}),"Stop"]}),!k&&b&&u.jsx(De,{"data-testid":"accept-completion-button",variant:"text",size:"xs",className:"mb-0",disabled:k,onClick:()=>{l(b),N("")},children:u.jsx("span",{className:"text-[var(--grass-11)] opacity-100",children:"Accept"})}),u.jsx("div",{className:"h-full w-px bg-border mx-2"}),u.jsx(Te,{content:"Include code from other cells",children:u.jsxs("div",{className:"flex flex-row items-start gap-1 overflow-hidden",children:[u.jsx(J4,{"data-testid":"include-other-cells-checkbox",id:"include-other-cells",checked:_,onCheckedChange:Y=>g(!!Y)}),u.jsx(Fr,{htmlFor:"include-other-cells",className:"text-muted-foreground text-xs whitespace-nowrap ellipsis",children:"Include all code"})]})}),u.jsx(De,{"data-testid":"decline-completion-button",variant:"text",size:"icon",disabled:k,onClick:()=>{x(),a(),N("")},children:u.jsx(oo,{className:"text-[var(--red-10)]",size:16})})]}),e[14]=l,e[15]=b,e[16]=a,e[17]=c,e[18]=E,e[19]=_,e[20]=y,e[21]=k,e[22]=N,e[23]=g,e[24]=v,e[25]=x,e[26]=D,e[27]=S):S=e[27],e[28]!==O||e[29]!==S?($=u.jsx("div",{className:O,children:S}),e[28]=O,e[29]=S,e[30]=$):$=e[30],e[31]!==b||e[32]!==i||e[33]!==c||e[34]!==o||e[35]!==D?(j=b&&c&&u.jsxs(cs,{className:"cm",theme:D,children:[u.jsx(dM,{onChange:o,value:i,extensions:Cx}),u.jsx(uM,{value:b,editable:!1,readOnly:!0,extensions:Cx})]}),e[31]=b,e[32]=i,e[33]=c,e[34]=o,e[35]=D,e[36]=j):j=e[36];const W=(!b||!c)&&d;let X;return e[37]!==$||e[38]!==j||e[39]!==W||e[40]!==F?(X=u.jsxs("div",{className:F,children:[$,j,W]}),e[37]=$,e[38]=j,e[39]=W,e[40]=F,e[41]=X):X=e[41],X};function fM(t){ut({title:"Completion failed",description:G4(t)})}const mM=t=>{const e=K.c(24),{editorView:n,code:o,currentLanguageAdapter:r,onAfterToggle:s}=t;let i,a;e[0]!==o?(a=new ca().isSupported(o)||o.trim()==="",e[0]=o,e[1]=a):a=e[1],i=a;const l=i;let c,d;e[2]!==o?(d=new Uc().isSupported(o)||o.trim()==="",e[2]=o,e[3]=d):d=e[3],c=d;const h=c&&r==="python";let f,m;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(dr,{color:"var(--sky-11)",strokeWidth:2.5,className:"w-4 h-4"}),e[4]=f):f=e[4],e[5]!==r||e[6]!==n||e[7]!==s||e[8]!==h?(m=u.jsx(Qu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:h,icon:f,toType:"sql",displayName:"SQL",onAfterToggle:s}),e[5]=r,e[6]=n,e[7]=s,e[8]=h,e[9]=m):m=e[9];const _=l&&r==="python";let g,p,b,y,x;return e[10]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx(fc,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[10]=g):g=e[10],e[11]!==r||e[12]!==n||e[13]!==s||e[14]!==_?(p=u.jsx(Qu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:_,icon:g,toType:"markdown",displayName:"Markdown",onAfterToggle:s}),e[11]=r,e[12]=n,e[13]=s,e[14]=_,e[15]=p):p=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(mc,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[16]=b):b=e[16],e[17]!==r||e[18]!==n?(y=u.jsx(Qu,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:!0,icon:b,toType:"python",displayName:"Python",onAfterToggle:An.NOOP}),e[17]=r,e[18]=n,e[19]=y):y=e[19],e[20]!==p||e[21]!==y||e[22]!==m?(x=u.jsxs("div",{className:"absolute right-3 top-2 z-20 flex hover-action gap-1",children:[m,p,y]}),e[20]=p,e[21]=y,e[22]=m,e[23]=x):x=e[23],x},Qu=t=>{const e=K.c(10),{editorView:n,currentLanguageAdapter:o,canSwitchToLanguage:r,icon:s,toType:i,displayName:a,onAfterToggle:l}=t;let c;e[0]!==n||e[1]!==l||e[2]!==i?(c=()=>{n&&(Pr(n,i),l())},e[0]=n,e[1]=l,e[2]=i,e[3]=c):c=e[3];const d=c;if(!r||o===i)return null;const h=`View as ${a}`;let f,m;return e[4]!==d||e[5]!==s?(f=u.jsx(De,{"data-testid":"language-toggle-button",variant:"text",size:"xs",className:"opacity-80 px-1",onClick:d,children:s}),e[4]=d,e[5]=s,e[6]=f):f=e[6],e[7]!==h||e[8]!==f?(m=u.jsx(Te,{content:h,children:f}),e[7]=h,e[8]=f,e[9]=m):m=e[9],m},Nx=({theme:t,showPlaceholder:e,id:n,config:o,code:r,status:s,serializedEditorState:i,setEditorView:a,runCell:l,userConfig:c,editorViewRef:d,editorViewParentRef:h,hidden:f,hasOutput:m,temporarilyShowCode:_,languageAdapter:g,setLanguageAdapter:p,showLanguageToggles:b=!0})=>{var Y;const[y,x]=an(Pa),k=tV(),C=wd(),{saveOrNameNotebook:v}=Jg(),E=s==="running"||s==="queued",N=Ot(),I=ug(),A=g==="markdown",M=nt(()=>!E&&(C({cellId:n}),!0)),R=nt(()=>!E&&(l(),!0)),z=nt(()=>{const q=!o.hide_code;return Lr({configs:{[n]:{hide_code:q}}}),N.updateCellConfig({cellId:n,config:{hide_code:q}}),q}),D=$e(Bs),F=nt(()=>{ur(D,N.createNewCell)}),B=nV(c),U=T.useMemo(()=>{const q=N5({cellId:n,showPlaceholder:e,enableAI:B,cellActions:{...N,afterToggleMarkdown:F,onRun:R,deleteCell:M,saveNotebook:v,createManyBelow:ne=>{for(const re of[...ne].reverse())N.createNewCell({code:re,before:!1,cellId:n,skipIfCodeExists:!0})},splitCell:I,toggleHideCode:z,aiCellCompletion:()=>{let ne=!1;return x(re=>(re==null?void 0:re.cellId)===n?(ne=!0,null):{cellId:n}),ne}},completionConfig:c.completion,keymapConfig:c.keymap,lspConfig:c.language_servers,theme:t,hotkeys:new K4(c.keymap.overrides??{}),diagnosticsConfig:c.diagnostics,displayConfig:c.display});return q.push(Mn.define(ne=>{const re=ne.state.field(Fc);return p(re.type),{update(ae){const Z=ae.state.field(Fc);p(Z.type)}}}),st.updateListener.of(ne=>{ne.selectionSet&&ne.state.selection.ranges.some(re=>re.from!==re.to)&&_({focus:!1})})),q},[n,c.keymap,c.completion,c.language_servers,c.diagnostics,B,t,e,N,I,z,M,R,x,F,p,_,v]),O=Vc(),S=nt(()=>{if(O){const ne=$u(n,0,r);U.push(ne.extension),r=ne.code}const q=new st({state:fr.create({doc:r,extensions:U})});a(q),O||Pr(q,Hm(q.state).type)}),$=nt(()=>{if(zo(d.current!==null,"Editor view is not initialized"),O){const q=$u(n);U.push(q.extension)}d.current.dispatch({effects:[Rt.reconfigure.of([U]),oV(d.current,c.completion,new K4(c.keymap.overrides??{}),{...c.language_servers,diagnostics:c.diagnostics})]})}),j=nt(()=>{if(zo(i,"Editor view is not initialized"),O){const ne=$u(n,0,r);U.push(ne.extension),r=ne.code}const q=new st({state:fr.fromJSON(i,{doc:r,extensions:U},{history:rV})});O||Pr(q,Hm(q.state).type),a(q),N.clearSerializedEditorState({cellId:n})});T.useEffect(()=>{i===null?d.current===null?S():$():j(),d.current!==null&&h&&h.current!==null&&h.current.replaceChildren(d.current.dom)},[S,$,j,d,h,i,U]),T.useEffect(()=>{const q=d.current;return()=>{q==null||q.destroy()}},[d]);const W=f&&!A||f&&A&&!m;let X="";return A&&f&&m?X="h-0 overflow-hidden":f&&(X="opacity-20 h-8 [&>div.cm-editor]:h-full [&>div.cm-editor]:overflow-hidden"),u.jsx(hM,{enabled:(y==null?void 0:y.cellId)===n,initialPrompt:y==null?void 0:y.initialPrompt,currentCode:((Y=d.current)==null?void 0:Y.state.doc.toString())??r,currentLanguageAdapter:g,declineChange:nt(()=>{var q;x(null),(q=d.current)==null||q.focus()}),onChange:nt(q=>{var ne;(ne=d.current)==null||ne.dispatch({changes:{from:0,to:d.current.state.doc.length,insert:q}})}),acceptChange:nt(q=>{var ne,re;(ne=d.current)==null||ne.dispatch({changes:{from:0,to:d.current.state.doc.length,insert:q}}),(re=d.current)==null||re.focus(),x(null)}),children:u.jsxs("div",{className:"relative w-full",onFocus:()=>k(n),children:[W&&u.jsx(X4,{tooltip:"Edit code",className:"absolute inset-0 z-10",onClick:_}),u.jsx(jx,{className:X,editorView:d.current,ref:h}),!f&&b&&u.jsx("div",{className:"absolute top-1 right-5",children:u.jsx(mM,{code:r,editorView:d.current,currentLanguageAdapter:g,onAfterToggle:F})})]})})},jx=J.forwardRef((t,e)=>{const n=K.c(10),{className:o,editorView:r}=t,s=T.useRef(null);let i,a,l,c,d;return n[0]!==r?(i=()=>{r!==null&&s.current!==null&&s.current.children.length===0&&s.current.append(r.dom)},a=[r,s],n[0]=r,n[1]=i,n[2]=a):(i=n[1],a=n[2]),T.useEffect(i,a),n[3]!==o?(l=Ae("cm mathjax_ignore",o),n[3]=o,n[4]=l):l=n[4],n[5]!==e?(c=h=>{e?Cl(e,s)(h):Cl(s)(h)},n[5]=e,n[6]=c):c=n[6],n[7]!==l||n[8]!==c?(d=u.jsx("div",{className:l,ref:c,"data-testid":"cell-editor"}),n[7]=l,n[8]=c,n[9]=d):d=n[9],d});jx.displayName="CellCodeMirrorEditor";const eh=Vc()?function(t){const e=n=>{const o=K.c(5),r=$e(mn),[s,i]=an(ss);if(r.state===Vt.CONNECTING||s===void 0){let l,c;return o[0]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx("span",{children:"Waiting for real-time collaboration connection..."}),o[0]=l):l=o[0],o[1]!==i?(c=u.jsx("div",{className:"flex h-full w-full items-baseline p-4",children:u.jsxs(Jm,{milliseconds:1e3,fallback:null,children:[l,u.jsx(De,{variant:"link",onClick:()=>{i("disabled")},children:"Turn off real-time collaboration"})]})}),o[1]=i,o[2]=c):c=o[2],c}let a;return o[3]!==n?(a=u.jsx(t,{...n}),o[3]=n,o[4]=a):a=o[4],a};return e.displayName=`WithWaitUntilConnected(${t.displayName})`,e}(T.memo(Nx)):T.memo(Nx),pM=t=>{const e=K.c(10);let n,o,r,s;return e[0]!==t.left?(n=u.jsx("div",{className:"flex-1 flex item-center gap-2",children:t.left}),e[0]=t.left,e[1]=n):n=e[1],e[2]!==t.center?(o=u.jsx("div",{className:"flex-1 flex item-center gap-2 justify-center",children:t.center}),e[2]=t.center,e[3]=o):o=e[3],e[4]!==t.right?(r=u.jsx("div",{className:"flex-1 flex item-center gap-2 justify-end",children:t.right}),e[4]=t.right,e[5]=r):r=e[5],e[6]!==n||e[7]!==o||e[8]!==r?(s=u.jsxs("div",{className:"flex items-center gap-2 w-full px-3",children:[n,o,r]}),e[6]=n,e[7]=o,e[8]=r,e[9]=s):s=e[9],s},gM=t=>{const e=K.c(8);if(!t.canCollapse&&!t.isCollapsed)return null;const n=t.isCollapsed?"Expand":"Collapse";let o,r,s;return e[0]!==t.isCollapsed?(o=u.jsx("span",{children:u.jsx(_M,{isCollapsed:t.isCollapsed})}),e[0]=t.isCollapsed,e[1]=o):o=e[1],e[2]!==n||e[3]!==o?(r=u.jsx(Te,{content:n,children:o}),e[2]=n,e[3]=o,e[4]=r):r=e[4],e[5]!==t.onClick||e[6]!==r?(s=u.jsx(De,{variant:"text",size:"icon",onClick:t.onClick,children:r}),e[5]=t.onClick,e[6]=r,e[7]=s):s=e[7],s},_M=t=>{const e=K.c(2),{isCollapsed:n}=t;let o;return e[0]!==n?(o=n?u.jsx(ia,{className:"w-5 h-5 flex-shrink-0"}):u.jsx(Vs,{className:"w-5 h-5 flex-shrink-0"}),e[0]=n,e[1]=o):o=e[1],o},Ex=T.memo(t=>{const e=K.c(24),{onClick:n,count:o,cellId:r}=t,s=Ac();let i;e[0]!==r||e[1]!==s?(i=sV(s,r),e[0]=r,e[1]=s,e[2]=i):i=e[2];const a=i;let l,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=Ae("flex items-center justify-between w-[calc(100%-2rem)] h-9 bg-muted rounded-b mx-4 opacity-80 hover:opacity-100 cursor-pointer"),e[3]=l):l=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(iV,{className:"w-4 h-4 flex-shrink-0"}),e[4]=c):c=e[4];const d=o===1?"cell":"cells";let h,f,m,_,g,p,b;return e[5]!==o||e[6]!==d?(h=u.jsxs(u.Fragment,{children:[c,u.jsxs("span",{className:"text-sm text-gray-500",children:[o," ",d," collapsed"]})]}),e[5]=o,e[6]=d,e[7]=h):h=e[7],e[8]!==a.errored?(f=a.errored&&u.jsx(Te,{content:"Has errors",delayDuration:100,children:u.jsx(Up,{className:"w-4 h-4 flex-shrink-0 text-destructive"})}),e[8]=a.errored,e[9]=f):f=e[9],e[10]!==a.stale?(m=a.stale&&u.jsx(Te,{content:"Has stale cells",delayDuration:100,children:u.jsx(Z4,{className:"w-4 h-4 flex-shrink-0 text-[var(--yellow-11)]"})}),e[10]=a.stale,e[11]=m):m=e[11],e[12]!==a.runningOrQueued?(_=a.runningOrQueued&&u.jsx(Te,{content:"Running",delayDuration:100,children:u.jsx(Ym,{className:"w-4 h-4 flex-shrink-0 animate-spin"})}),e[12]=a.runningOrQueued,e[13]=_):_=e[13],e[14]!==f||e[15]!==m||e[16]!==_?(g=u.jsxs(u.Fragment,{children:[f,m,_]}),e[14]=f,e[15]=m,e[16]=_,e[17]=g):g=e[17],e[18]!==h||e[19]!==g?(p=u.jsx(pM,{center:h,right:g}),e[18]=h,e[19]=g,e[20]=p):p=e[20],e[21]!==n||e[22]!==p?(b=u.jsx("div",{onClick:n,className:l,children:p}),e[21]=n,e[22]=p,e[23]=b):b=e[23],b});Ex.displayName="CollapsedCellBanner";const Ix=t=>{const e=K.c(31),{status:n,connectionState:o,onClick:r}=t,s=n==="running"||n==="queued";let i,a,l,c,d,h,f,m,_,g,p,b,y,x;if(e[0]!==o||e[1]!==s||e[2]!==r||e[3]!==n){const k=Ho(o);let C;if(k){let v;e[14]!==o?(v=Zc(o),e[14]=o,e[15]=v):v=e[15],C=v}else C=n==="running"?"A cell can't be deleted when it's running":n==="queued"?"A cell can't be deleted when it's queued to run":"Delete";a=Te,_=C,g=!1,i=De,l="ghost",c="icon",d=r,h="delete-button",f=Hn.preventFocus,m=Ae("hover:bg-transparent text-destructive/60 hover:text-destructive",(k||s)&&"inactive-button"),e[0]=o,e[1]=s,e[2]=r,e[3]=n,e[4]=i,e[5]=a,e[6]=l,e[7]=c,e[8]=d,e[9]=h,e[10]=f,e[11]=m,e[12]=_,e[13]=g}else i=e[4],a=e[5],l=e[6],c=e[7],d=e[8],h=e[9],f=e[10],m=e[11],_=e[12],g=e[13];return e[16]===Symbol.for("react.memo_cache_sentinel")?(p={boxShadow:"none"},b=u.jsx(bm,{size:14}),e[16]=p,e[17]=b):(p=e[16],b=e[17]),e[18]!==i||e[19]!==l||e[20]!==c||e[21]!==d||e[22]!==h||e[23]!==f||e[24]!==m?(y=u.jsx(i,{variant:l,size:c,onClick:d,"data-testid":h,onMouseDown:f,className:m,style:p,children:b}),e[18]=i,e[19]=l,e[20]=c,e[21]=d,e[22]=h,e[23]=f,e[24]=m,e[25]=y):y=e[25],e[26]!==a||e[27]!==y||e[28]!==_||e[29]!==g?(x=u.jsx(a,{content:_,usePortal:g,children:y}),e[26]=a,e[27]=y,e[28]=_,e[29]=g,e[30]=x):x=e[30],x},bM=t=>{const e=K.c(27),{onClick:n,connectionState:o,needsRun:r,status:s,config:i,edited:a}=t,l=s==="disabled-transitively",c=s==="running"||s==="queued";let d,h;e[0]!==l||e[1]!==i.disabled||e[2]!==o||e[3]!==a||e[4]!==c||e[5]!==r?(d=Ho(o)||c||!i.disabled&&l&&!a,h=function(p,b,y,x){return Ho(p)?"disabled":b&&!y?"stale":y||x?"disabled":"green"}(o,r,c,d),e[0]=l,e[1]=i.disabled,e[2]=o,e[3]=a,e[4]=c,e[5]=r,e[6]=d,e[7]=h):(d=e[6],h=e[7]);const f=h;if(i.disabled){let p,b;return e[8]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(Tp,{}),e[8]=p):p=e[8],e[9]!==d||e[10]!==n||e[11]!==f?(b=u.jsx(pi,{tooltip:"Add code to notebook",disabled:d,onClick:n,variant:f,"data-testid":"run-button",children:p}),e[9]=d,e[10]=n,e[11]=f,e[12]=b):b=e[12],b}if(!i.disabled&&l&&!a){let p,b;return e[13]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(ii,{strokeWidth:1.2}),e[13]=p):p=e[13],e[14]!==d||e[15]!==n||e[16]!==f?(b=u.jsx(pi,{disabled:d,tooltip:"This cell can't be run because it has a disabled ancestor",onClick:n,variant:f,"data-testid":"run-button",children:p}),e[14]=d,e[15]=n,e[16]=f,e[17]=b):b=e[17],b}let m,_,g;if(Ho(o)){let p;e[18]!==o?(p=Zc(o),e[18]=o,e[19]=p):p=e[19],m=p}else if(s==="queued")m="This cell is already queued to run";else if(s==="running")m="This cell is already running.";else{let p;e[20]===Symbol.for("react.memo_cache_sentinel")?(p=pn("cell.run"),e[20]=p):p=e[20],m=p}return e[21]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(ii,{strokeWidth:1.2}),e[21]=_):_=e[21],e[22]!==d||e[23]!==n||e[24]!==m||e[25]!==f?(g=u.jsx(pi,{tooltip:m,disabled:d,onClick:n,variant:f,"data-testid":"run-button",children:_}),e[22]=d,e[23]=n,e[24]=m,e[25]=f,e[26]=g):g=e[26],g},Ax=J.createContext(null),Tx=T.memo(()=>T.use(Ax));Tx.displayName="DragHandle";const Mx=J.forwardRef((t,e)=>{const n=K.c(21);let o,r,s,i,a;n[0]!==t?({cellId:r,canMoveX:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(i=r.toString(),n[4]=r,n[5]=i):i=n[5],n[6]!==i?(a={id:i},n[6]=i,n[7]=a):a=n[7];const{attributes:l,listeners:c,setNodeRef:d,transform:h,transition:f,isDragging:m}=A1(a);let _;n[8]!==h?(_=function(y){return!y||y.x===0&&y.y===0&&y.scaleX===1&&y.scaleY===1}(h)?null:h,n[8]=h,n[9]=_):_=n[9];const g=_,p=g==null?void 0:f;let b;return n[10]!==l||n[11]!==o||n[12]!==r||n[13]!==m||n[14]!==c||n[15]!==s||n[16]!==e||n[17]!==d||n[18]!==g||n[19]!==p?(b=u.jsx(Ox,{ref:e,cellId:r,canMoveX:o,...s,attributes:l,listeners:c,setNodeRef:d,transform:g,transition:p,isDragging:m}),n[10]=l,n[11]=o,n[12]=r,n[13]=m,n[14]=c,n[15]=s,n[16]=e,n[17]=d,n[18]=g,n[19]=p,n[20]=b):b=n[20],b});Mx.displayName="SortableCell";const Ox=J.forwardRef((t,e)=>{const n=K.c(37);let o,r,s,i,a,l,c,d,h,f;if(n[0]!==t){const{cellId:I,canMoveX:A,children:M,attributes:R,listeners:z,setNodeRef:D,transform:F,transition:B,isDragging:U,...O}=t;r=A,s=M,o=R,a=z,c=D,d=F,h=B,i=U,l=O,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i,n[5]=a,n[6]=l,n[7]=c,n[8]=d,n[9]=h}else o=n[1],r=n[2],s=n[3],i=n[4],a=n[5],l=n[6],c=n[7],d=n[8],h=n[9];n[10]!==r||n[11]!==d?(f=d?Dc.Transform.toString({x:r?d.x:0,y:d.y,scaleX:1,scaleY:1}):void 0,n[10]=r,n[11]=d,n[12]=f):f=n[12];const m=i?2:void 0;let _;n[13]!==f||n[14]!==m||n[15]!==h?(_={transform:f,transition:h,zIndex:m,position:"relative"},n[13]=f,n[14]=m,n[15]=h,n[16]=_):_=n[16];const g=_;let p,b;n[17]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(Ap,{strokeWidth:1,size:20}),n[17]=p):p=n[17],n[18]!==o||n[19]!==a?(b=u.jsx("div",{...o,...a,onMouseDown:Hn.preventFocus,"data-testid":"drag-button",className:"py-[1px] cursor-grab opacity-50 hover:opacity-100 hover-action hover:bg-muted rounded border border-transparent hover:border-border active:bg-accent",children:p}),n[18]=o,n[19]=a,n[20]=b):b=n[20];const y=b,x=!!d;let k;n[21]!==e||n[22]!==c?(k=I=>{Cl(e,c)(I)},n[21]=e,n[22]=c,n[23]=k):k=n[23];const C=x&&"is-moving";let v,E,N;return n[24]!==l.className||n[25]!==C?(v=Ae(l.className,C,"outline-offset-4 outline-primary/40 rounded-lg"),n[24]=l.className,n[25]=C,n[26]=v):v=n[26],n[27]!==s||n[28]!==y?(E=u.jsx(Ax.Provider,{value:y,children:s}),n[27]=s,n[28]=y,n[29]=E):E=n[29],n[30]!==i||n[31]!==l||n[32]!==g||n[33]!==k||n[34]!==v||n[35]!==E?(N=u.jsx("div",{tabIndex:-1,ref:k,...l,"data-is-dragging":i,className:v,style:g,children:E}),n[30]=i,n[31]=l,n[32]=g,n[33]=k,n[34]=v,n[35]=E,n[36]=N):N=n[36],N});function Dx(t,e){const n=K.c(9);let o;n[0]!==t.current||n[1]!==e?(o=l=>{t.current===null||t.current.contains(l.relatedTarget)||e.current===null||fm(e.current)},n[0]=t.current,n[1]=e,n[2]=o):o=n[2];const r=nt(o);let s;n[3]!==t.current||n[4]!==e?(s=l=>{if(t.current===document.activeElement&&e.current!==null&&ba(e.current.state)==="active"){for(const c of D4)if(l.key===c.key&&c.run){c.run(e.current),l.preventDefault(),l.stopPropagation();break}e.current.focus()}},n[3]=t.current,n[4]=e,n[5]=s):s=n[5];const i=nt(s);let a;return n[6]!==r||n[7]!==i?(a={closeCompletionHandler:r,resumeCompletionHandler:i},n[6]=r,n[7]=i,n[8]=a):a=n[8],a}function Rx(t,e,n,o,r,s,i,a,l){const c=K.c(51);let d,h,f,m,_,g,p,b,y,x,k,C,v,E,N,I;c[0]!==o||c[1]!==e||c[2]!==n?(d=()=>{n(),o.moveToNextCell({cellId:e,before:!1})},h=()=>{n(),o.moveToNextCell({cellId:e,before:!0})},c[0]=o,c[1]=e,c[2]=n,c[3]=d,c[4]=h):(d=c[3],h=c[4]),c[5]!==o||c[6]!==e?(f=()=>o.createNewCell({cellId:e,before:!0}),m=()=>o.createNewCell({cellId:e,before:!1}),_=()=>o.moveCell({cellId:e,before:!0}),g=()=>o.moveCell({cellId:e,before:!1}),c[5]=o,c[6]=e,c[7]=f,c[8]=m,c[9]=_,c[10]=g):(f=c[7],m=c[8],_=c[9],g=c[10]),c[11]!==o||c[12]!==r||c[13]!==e?(p=()=>r?o.moveCell({cellId:e,direction:"left"}):void 0,b=()=>r?o.moveCell({cellId:e,direction:"right"}):void 0,c[11]=o,c[12]=r,c[13]=e,c[14]=p,c[15]=b):(p=c[14],b=c[15]),c[16]!==o||c[17]!==s||c[18]!==e||c[19]!==(t==null?void 0:t.current)||c[20]!==i?(y=()=>{var M,R,z;const A=!s.hide_code;Lr({configs:{[e]:{hide_code:A}}}),o.updateCellConfig({cellId:e,config:{hide_code:A}}),A?((M=i.current)==null||M.contentDOM.blur(),(R=t==null?void 0:t.current)==null||R.focus()):(z=i.current)==null||z.focus()},c[16]=o,c[17]=s,c[18]=e,c[19]=t==null?void 0:t.current,c[20]=i,c[21]=y):y=c[21],c[22]!==o||c[23]!==e?(v=()=>o.moveToNextCell({cellId:e,before:!1,noCreate:!0}),x=()=>o.moveToNextCell({cellId:e,before:!0,noCreate:!0}),k=()=>o.sendToBottom({cellId:e}),C=()=>o.sendToTop({cellId:e}),c[22]=o,c[23]=e,c[24]=x,c[25]=k,c[26]=C,c[27]=v):(x=c[24],k=c[25],C=c[26],v=c[27]),c[28]!==e||c[29]!==i||c[30]!==a?(E=()=>{let A;A=!1,a(M=>(M==null?void 0:M.cellId)===e?(A=!0,null):{cellId:e}),A&&Y_(i).focus()},c[28]=e,c[29]=i,c[30]=a,c[31]=E):E=c[31],c[32]!==l?(N=()=>{var A;(A=l.current)==null||A.toggle()},c[32]=l,c[33]=N):N=c[33],c[34]!==n||c[35]!==d||c[36]!==h||c[37]!==x||c[38]!==k||c[39]!==C||c[40]!==E||c[41]!==N||c[42]!==f||c[43]!==m||c[44]!==_||c[45]!==g||c[46]!==p||c[47]!==b||c[48]!==y||c[49]!==v?(I={"cell.run":n,"cell.runAndNewBelow":d,"cell.runAndNewAbove":h,"cell.createAbove":f,"cell.createBelow":m,"cell.moveUp":_,"cell.moveDown":g,"cell.moveLeft":p,"cell.moveRight":b,"cell.hideCode":y,"cell.focusDown":v,"cell.focusUp":x,"cell.sendToBottom":k,"cell.sendToTop":C,"cell.aiCompletion":E,"cell.cellActions":N},c[34]=n,c[35]=d,c[36]=h,c[37]=x,c[38]=k,c[39]=C,c[40]=E,c[41]=N,c[42]=f,c[43]=m,c[44]=_,c[45]=g,c[46]=p,c[47]=b,c[48]=y,c[49]=v,c[50]=I):I=c[50],cV(t,I)}function Px(t,e,n,o,r,s){const i=K.c(16);let a,l,c,d,h;i[0]!==n||i[1]!==e?(a=f=>(!f||!Hn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0),l=f=>(!f||!Hn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!0,noCreate:!0}),!0),i[0]=n,i[1]=e,i[2]=a,i[3]=l):(a=i[2],l=i[3]),i[4]!==o?(c=()=>(o(),!1),i[4]=o,i[5]=c):c=i[5],i[6]!==n||i[7]!==e||i[8]!==s||i[9]!==r.keymap.preset?(d=r.keymap.preset!=="vim"||s?{}:{j:f=>(!f||!Hn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0),k:f=>(!f||!Hn.fromInput(f))&&(n.moveToNextCell({cellId:e,before:!0,noCreate:!0}),!0)},i[6]=n,i[7]=e,i[8]=s,i[9]=r.keymap.preset,i[10]=d):d=i[10],i[11]!==a||i[12]!==l||i[13]!==c||i[14]!==d?(h={ArrowDown:a,ArrowUp:l,Enter:c,...d},i[11]=a,i[12]=l,i[13]=c,i[14]=d,i[15]=h):h=i[15],dV(t,h)}Ox.displayName="SortableCellInternal";const Lx=T.forwardRef((t,e)=>{const n=K.c(14),{id:o,output:r,interrupted:s,errored:i,stopped:a,name:l,outputStale:c,outputLoading:d}=t;let h;n[0]===Symbol.for("react.memo_cache_sentinel")?(h=Hc("marimo-cell","hover-actions-parent z-10",{published:!0}),n[0]=h):h=n[0];const f=h;let m;n[1]!==o?(m=zs.create(o),n[1]=o,n[2]=m):m=n[2];const _=m,g=tS(r==null?void 0:r.mimetype);if(i||s||a||g)return null;let p,b;return n[3]!==o||n[4]!==r||n[5]!==d||n[6]!==c?(p=u.jsx(Wc,{allowExpand:!1,forceExpand:!0,output:r,className:"output-area",cellId:o,stale:c,loading:d}),n[3]=o,n[4]=r,n[5]=d,n[6]=c,n[7]=p):p=n[7],n[8]!==_||n[9]!==o||n[10]!==l||n[11]!==e||n[12]!==p?(b=u.jsx("div",{tabIndex:-1,id:_,ref:e,className:f,"data-cell-id":o,"data-cell-name":l,children:p}),n[8]=_,n[9]=o,n[10]=l,n[11]=e,n[12]=p,n[13]=b):b=n[13],b});Lx.displayName="ReadonlyCellComponent";const yM=({theme:t,showPlaceholder:e,id:n,code:o,output:r,consoleOutputs:s,status:i,runStartTimestamp:a,lastRunStartTimestamp:l,runElapsedTimeMs:c,edited:d,interrupted:h,errored:f,stopped:m,staleInputs:_,serializedEditorState:g,serialization:p,debuggerActive:b,connectionState:y,canDelete:x,actions:k,deleteCell:C,userConfig:v,outline:E,isCollapsed:N,collapseCount:I,config:A,canMoveX:M,name:R,editorView:z,setEditorView:D,outputStale:F})=>{const B=T.useRef(null),U=T.useRef(null),O=T.useRef(null),S=T.useRef(null),$=en(Pa),j=gd(n),[W,X]=T.useState(),Y=A.disabled||i==="disabled-transitively",q=nS({executionTime:c,status:i,errored:f,interrupted:h,stopped:m}),ne=d||h||_&&!Y,re=Q4(i),ae=(i==="queued"||d||_)&&!h,Z=T.useCallback(()=>z.current,[z]),{closeCompletionHandler:Q,resumeCompletionHandler:he}=Dx(B,z),{isCellCodeShown:pe,isMarkdown:ce,isMarkdownCodeHidden:fe,temporarilyShowCode:de,showHiddenMarkdownCode:Ce}=function(G,ge,_e,me){const le=K.c(13),[Ve,Fe]=T.useState(!1),Ke=!G.hide_code||Ve,ie=ge==="markdown",Se=ie&&!Ke;let Ee;le[0]!==_e||le[1]!==me||le[2]!==Ke?(Ee=it=>{var bt,Mt;if(Ke)return;const Xe=(it==null?void 0:it.focus)??!0;Fe(!0),Xe&&((bt=_e.current)==null||bt.focus());const ot=(Mt=me.current)==null?void 0:Mt.parentElement;if(!ot)return void Dt.error("Cell: No parent element found for editor view");const yt=()=>{requestAnimationFrame(()=>{var xt;ot.contains(document.activeElement)||(Fe(!1),(xt=_e.current)==null||xt.dom.blur(),ot.removeEventListener("focusout",yt))})};ot.addEventListener("focusout",yt)},le[0]=_e,le[1]=me,le[2]=Ke,le[3]=Ee):Ee=le[3];const Be=nt(Ee);let Ye;le[4]!==Se||le[5]!==Be?(Ye=()=>{Se&&Be({focus:!0})},le[4]=Se,le[5]=Be,le[6]=Ye):Ye=le[6];const Re=nt(Ye);let He;return le[7]!==Ke||le[8]!==ie||le[9]!==Se||le[10]!==Re||le[11]!==Be?(He={isCellCodeShown:Ke,isMarkdown:ie,isMarkdownCodeHidden:Se,temporarilyShowCode:Be,showHiddenMarkdownCode:Re},le[7]=Ke,le[8]=ie,le[9]=Se,le[10]=Re,le[11]=Be,le[12]=He):He=le[12],He}(A,W,z,O);Rx(B,n,j,k,M,A,z,$,U),Px(B,n,k,Ce,v,pe);const Ne=lV(E),se=!eS(r),Ie=s.length>0,be=v.display.cell_output,Oe=se&&be==="above",ze=se&&be==="below",[Ge,Je]=T.useState(!1),[Le,et]=T.useState(!1);(function(G){const{ref:ge,box:_e="content-box",skip:me}=G,le=T.useRef({...E5}),Ve=T.useRef(void 0);Ve.current=G.onResize,T.useEffect(()=>{if(!ge.current||me||typeof window>"u"||!("ResizeObserver"in window))return;const Fe=new ResizeObserver(([Ke])=>{const ie=_e==="border-box"?"borderBoxSize":_e==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",Se=G_(Ke,ie,"inlineSize"),Ee=G_(Ke,ie,"blockSize");if(le.current.width!==Se||le.current.height!==Ee){const Be={width:Se,height:Ee};le.current.width=Se,le.current.height=Ee,Ve.current&&Ve.current(Be)}});return Fe.observe(ge.current,{box:_e}),()=>{Fe.disconnect()}},[_e,ge,me])})({ref:S,skip:!ce,onResize:G=>{const ge=G.height&&G.height<68,_e=fe&&(ge||be==="below");Je(_e),Ne&&_e?et(!0):Le&&et(!1)}});const Qe=G=>u.jsx(X4,{tooltip:"Edit markdown",className:Ae("z-20 relative",G),onClick:de}),tt=se&&u.jsxs("div",{className:"relative",onDoubleClick:Ce,children:[u.jsx("div",{className:"absolute top-5 -left-8 z-10 print:hidden",children:u.jsx(gM,{isCollapsed:N,onClick:()=>{N?k.expandCell({cellId:n}):k.collapseCell({cellId:n})},canCollapse:Ne})}),fe&&ze&&Qe("top-3"),u.jsx(Wc,{allowExpand:!0,forceExpand:fe,output:r,className:"output-area",cellId:n,stale:F,loading:re}),fe&&Oe&&Qe("bottom-3")]}),te=Hc("marimo-cell","hover-actions-parent z-10",{interactive:!0,"needs-run":ne,"has-error":f,stopped:m,disabled:A.disabled,stale:i==="disabled-transitively",borderless:fe&&se}),ye=zs.create(n),ke=nt(G=>{$({cellId:n,initialPrompt:G.prompt})}),Me=!(!p||p.toLowerCase()!=="valid");return u.jsx(Km,{children:u.jsx(A0,{cellId:n,config:A,status:i,getEditorView:Z,hasOutput:se,hasConsoleOutput:Ie,name:R,children:u.jsxs(Mx,{tabIndex:-1,ref:B,"data-status":i,onBlur:Q,onKeyDown:he,cellId:n,canMoveX:M,title:A.disabled?"This cell is disabled":i==="disabled-transitively"?"This cell has a disabled ancestor":void 0,children:[u.jsxs("div",{className:te,id:ye,ref:S,"data-cell-id":n,"data-cell-name":R,children:[be==="above"&&tt,u.jsxs("div",{className:Ae("tray"),"data-hidden":fe,children:[u.jsx("div",{className:"absolute right-2 -top-4 z-10",children:u.jsx(zx,{edited:d,connectionState:y,status:i,cellConfig:A,needsRun:ne,hasOutput:se,hasConsoleOutput:Ie,cellActionDropdownRef:U,cellId:n,name:R,getEditorView:Z,onRun:j})}),u.jsx(xM,{cellId:n,className:Ae(fe&&Oe&&"-top-7",fe&&ze&&"-bottom-8",fe&&Le&&"-left-[3.8rem]"),connectionState:y,actions:k}),u.jsx(eh,{theme:t,showPlaceholder:e,id:n,code:o,config:A,status:i,serializedEditorState:g,runCell:j,setEditorView:D,userConfig:v,editorViewRef:z,editorViewParentRef:O,hidden:!pe,hasOutput:se,temporarilyShowCode:de,languageAdapter:W,setLanguageAdapter:X}),u.jsx(Fx,{className:Ae(fe&&be==="below"&&"top-14"),edited:d,status:i,isCellStatusInline:Ge,uninstantiated:q,disabled:A.disabled,runElapsedTimeMs:c,runStartTimestamp:a,lastRunStartTimestamp:l,staleInputs:_,interrupted:h}),u.jsx("div",{className:"shoulder-bottom hover-action",children:x&&pe&&u.jsx(Ix,{connectionState:y,status:i,onClick:()=>{re||Ho(y)||C({cellId:n})}})})]}),be==="below"&&tt,p&&u.jsxs("a",{href:"https://links.marimo.app/reusable-definitions",target:"_blank",className:"hover:underline py-1 px-2 flex items-center justify-end gap-2 last:rounded-b",rel:"noopener",children:[Me&&u.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"reusable"}),u.jsx(Te,{content:u.jsx("span",{className:"max-w-16 text-xs",children:Me?"This function or class can be imported into other Python notebooks or modules.":u.jsxs(u.Fragment,{children:["This definition can't be reused in other Python modules:",u.jsx("br",{}),u.jsx("br",{}),u.jsx("pre",{children:p}),u.jsx("br",{}),"Click this icon to learn more."]})}),children:Me&&u.jsx(cc,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})||u.jsx(Xm,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),u.jsx(up,{consoleOutputs:s,stale:ae,cellName:p?"_":R,onRefactorWithAI:ke,onClear:()=>{k.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:(G,ge)=>{k.setStdinResponse({cellId:n,response:G,outputIndex:ge}),oS({text:G})},cellId:n,debuggerActive:b})]}),N&&u.jsx(Ex,{onClick:()=>k.expandCell({cellId:n}),count:I,cellId:n})]})})})},Fx=t=>{const e=K.c(19),{className:n,disabled:o,edited:r,interrupted:s,isCellStatusInline:i,lastRunStartTimestamp:a,runElapsedTimeMs:l,runStartTimestamp:c,staleInputs:d,status:h,uninstantiated:f}=t,m=o!==void 0&&o;let _;e[0]!==m||e[1]!==r||e[2]!==s||e[3]!==a||e[4]!==l||e[5]!==c||e[6]!==d||e[7]!==h||e[8]!==f?(_=u.jsx(X_,{status:h,staleInputs:d,interrupted:s,editing:!0,edited:r,disabled:m,elapsedTime:l,runStartTimestamp:c,uninstantiated:f,lastRunStartTimestamp:a}),e[0]=m,e[1]=r,e[2]=s,e[3]=a,e[4]=l,e[5]=c,e[6]=d,e[7]=h,e[8]=f,e[9]=_):_=e[9];const g=_;let p;e[10]!==n?(p=Ae("shoulder-right z-20",n),e[10]=n,e[11]=p):p=e[11];const b=!i&&g;let y;e[12]===Symbol.for("react.memo_cache_sentinel")?(y=u.jsx(Tx,{}),e[12]=y):y=e[12];const x=i&&g;let k,C;return e[13]!==x?(k=u.jsxs("div",{className:"flex gap-2 items-end",children:[y,x]}),e[13]=x,e[14]=k):k=e[14],e[15]!==p||e[16]!==b||e[17]!==k?(C=u.jsxs("div",{className:p,children:[b,k]}),e[15]=p,e[16]=b,e[17]=k,e[18]=C):C=e[18],C},xM=t=>{const e=K.c(21),{className:n,connectionState:o,actions:r,cellId:s}=t;let i;e[0]!==r||e[1]!==s?(i=k=>{const C=k===void 0?{}:k;return r.createNewCell({cellId:s,before:!1,...C})},e[0]=r,e[1]=s,e[2]=i):i=e[2];const a=nt(i);let l;e[3]!==r||e[4]!==s?(l=k=>{const C=k===void 0?{}:k;return r.createNewCell({cellId:s,before:!0,...C})},e[3]=r,e[4]=s,e[5]=l):l=e[5];const c=nt(l),d=Qc(o);let h,f;e[6]!==n?(h=Ae("absolute flex flex-col gap-[2px] justify-center h-full left-[-34px] z-20",n),e[6]=n,e[7]=h):h=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(f=pn("cell.createAbove"),e[8]=f):f=e[8];const m=d?c:void 0;let _,g,p;e[9]!==o||e[10]!==m?(_=u.jsx(j0,{tooltipContent:f,connectionState:o,onClick:m}),e[9]=o,e[10]=m,e[11]=_):_=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("div",{className:"flex-1"}),e[12]=g):g=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(p=pn("cell.createBelow"),e[13]=p):p=e[13];const b=d?a:void 0;let y,x;return e[14]!==o||e[15]!==b?(y=u.jsx(j0,{tooltipContent:p,connectionState:o,onClick:b}),e[14]=o,e[15]=b,e[16]=y):y=e[16],e[17]!==h||e[18]!==_||e[19]!==y?(x=u.jsxs("div",{className:h,children:[_,g,y]}),e[17]=h,e[18]=_,e[19]=y,e[20]=x):x=e[20],x},zx=t=>{const e=K.c(27),{edited:n,connectionState:o,status:r,cellConfig:s,needsRun:i,hasOutput:a,hasConsoleOutput:l,onRun:c,cellActionDropdownRef:d,cellId:h,getEditorView:f,name:m,includeCellActions:_}=t,g=_===void 0||_,p=Qc(o),b=!i&&"hover-action";let y;e[0]!==b?(y=Ae(b),e[0]=b,e[1]=y):y=e[1];const x=p?c:An.NOOP;let k,C,v,E;return e[2]!==s||e[3]!==o||e[4]!==n||e[5]!==i||e[6]!==r||e[7]!==x?(k=u.jsx(bM,{edited:n,onClick:x,connectionState:o,status:r,config:s,needsRun:i}),e[2]=s,e[3]=o,e[4]=n,e[5]=i,e[6]=r,e[7]=x,e[8]=k):k=e[8],e[9]!==o||e[10]!==r?(C=u.jsx(eE,{status:r,connectionState:o}),e[9]=o,e[10]=r,e[11]=C):C=e[11],e[12]!==d||e[13]!==s||e[14]!==h||e[15]!==f||e[16]!==l||e[17]!==a||e[18]!==g||e[19]!==m||e[20]!==r?(v=g&&u.jsx(E0,{ref:d,cellId:h,status:r,getEditorView:f,name:m,config:s,hasOutput:a,hasConsoleOutput:l,children:u.jsx(pi,{variant:"green",tooltip:null,"data-testid":"cell-actions-button",children:u.jsx(KS,{strokeWidth:1.5})})}),e[12]=d,e[13]=s,e[14]=h,e[15]=f,e[16]=l,e[17]=a,e[18]=g,e[19]=m,e[20]=r,e[21]=v):v=e[21],e[22]!==y||e[23]!==k||e[24]!==C||e[25]!==v?(E=u.jsxs(Qj,{className:y,children:[k,C,v]}),e[22]=y,e[23]=k,e[24]=C,e[25]=v,e[26]=E):E=e[26],E},wM=({theme:t,showPlaceholder:e,id:n,code:o,output:r,consoleOutputs:s,status:i,runStartTimestamp:a,lastRunStartTimestamp:l,runElapsedTimeMs:c,edited:d,interrupted:h,errored:f,stopped:m,staleInputs:_,serializedEditorState:g,debuggerActive:p,connectionState:b,canDelete:y,actions:x,deleteCell:k,userConfig:C,config:v,canMoveX:E,name:N,editorView:I,setEditorView:A})=>{const M=T.useRef(null),R=T.useRef(null),z=T.useRef(null),D=en(Pa),F=gd(n),B=v.disabled||i==="disabled-transitively",U=nS({executionTime:c,status:i,errored:f,interrupted:h,stopped:m}),O=d||h||_&&!B,S=i==="running"||i==="queued",$=(i==="queued"||d||_)&&!h,j=T.useCallback(()=>I.current,[I]),{closeCompletionHandler:W,resumeCompletionHandler:X}=Dx(M,I);Rx(M,n,F,x,E,v,I,D,R),Px(M,n,x,An.NOOP,C,!0);const Y=!eS(r),q=s.length>0,ne=tS(r==null?void 0:r.mimetype),re=Hc("marimo-cell","hover-actions-parent z-10 border shadow-sm","!border-[var(--blue-5)] !rounded-sm",{"needs-run":O,"has-error":f,stopped:m}),ae=zs.create(n),Z=nt(Q=>{D({cellId:n,initialPrompt:Q.prompt})});return u.jsx(Km,{children:u.jsx(A0,{cellId:n,config:v,status:i,getEditorView:j,hasOutput:Y,hasConsoleOutput:q,name:N,children:u.jsxs("div",{className:re,"data-status":i,id:ae,ref:M,onBlur:W,onKeyDown:X,title:v.disabled?"This cell is disabled":i==="disabled-transitively"?"This cell has a disabled ancestor":void 0,"data-cell-id":n,"data-cell-name":N,"data-setup-cell":!0,children:[u.jsxs("div",{className:Ae("tray"),"data-hidden":!1,children:[u.jsx("div",{className:"absolute right-2 -top-4 z-10",children:u.jsx(zx,{edited:d,connectionState:b,status:i,cellConfig:v,needsRun:O,hasOutput:Y,hasConsoleOutput:q,cellActionDropdownRef:R,cellId:n,name:N,getEditorView:j,onRun:F,includeCellActions:!1})}),u.jsx(eh,{theme:t,showPlaceholder:e,id:n,code:o,config:v,status:i,serializedEditorState:g,runCell:F,setEditorView:A,userConfig:C,editorViewRef:I,editorViewParentRef:z,hidden:!1,hasOutput:Y,temporarilyShowCode:An.NOOP,languageAdapter:"python",setLanguageAdapter:An.NOOP,showLanguageToggles:!1}),u.jsx(Fx,{edited:d,status:i,isCellStatusInline:!1,uninstantiated:U,disabled:v.disabled,runElapsedTimeMs:c,runStartTimestamp:a,lastRunStartTimestamp:l,staleInputs:_,interrupted:h}),u.jsx("div",{className:"shoulder-bottom hover-action",children:y&&u.jsx(Ix,{connectionState:b,status:i,onClick:()=>{S||Ho(b)||k({cellId:n})}})})]}),u.jsxs("div",{className:"py-1 px-2 flex justify-end gap-2 last:rounded-b",children:[u.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"setup cell"}),u.jsx(Te,{content:u.jsxs("span",{className:"max-w-16",children:["This ",u.jsx("b",{children:"setup cell"})," is guaranteed to run before all other cells. Include ",u.jsx("br",{}),"initialization or imports and constants required by top-level functions."]}),children:u.jsx(Xm,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),ne&&u.jsx(Wc,{allowExpand:!0,forceExpand:!0,output:r,className:"output-area",cellId:n,stale:!1,loading:S}),u.jsx(up,{consoleOutputs:s,stale:$,cellName:"_",onRefactorWithAI:Z,onClear:()=>{x.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:(Q,he)=>{x.setStdinResponse({cellId:n,response:Q,outputIndex:he}),oS({text:Q})},cellId:n,debuggerActive:p})]})})})},Bx=T.memo(T.forwardRef((t,e)=>{const{status:n,output:o,runStartTimestamp:r,interrupted:s,staleInputs:i,edited:a,id:l,mode:c}=t;Dt.debug("Rendering Cell",l);const d=T.useRef(null);T.useImperativeHandle(e,()=>({get editorView(){return Y_(d)},get editorViewOrNull(){return d.current}}),[d]);const h=aV({status:n,output:o,runStartTimestamp:r,interrupted:s,staleInputs:i},a),f=Q4(n);return l===$o?u.jsx(wM,{...t,editorView:d,setEditorView:m=>{d.current=m},outputStale:h}):c==="edit"?u.jsx(yM,{...t,editorView:d,setEditorView:m=>{d.current=m},outputStale:h}):u.jsx(Lx,{...t,outputStale:h,outputLoading:f})})),vM=(t,e)=>function(n,o){const r=/^(\d+)\.(\d+)\.(\d+)(?:-([\w.-]+))?(?:\+([\w.-]+))?$/,s=i=>{const a=i.match(r);if(!a)return null;const[,l,c,d,h]=a;return{major:Number.parseInt(l,10),minor:Number.parseInt(c,10),patch:Number.parseInt(d,10),preRelease:h||""}};try{const i=s(n),a=s(o);return i&&a?i.major!==a.major?i.major-a.major:i.minor!==a.minor?i.minor-a.minor:i.patch!==a.patch?i.patch-a.patch:i.preRelease===""&&a.preRelease!==""?1:i.preRelease!==""&&a.preRelease===""?-1:i.preRelease.localeCompare(a.preRelease):n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}catch{return n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}}(e,t),Ux=new class{constructor(t){this.ttl=void 0,this.cache=new Map,this.ttl=t.ttl}cleanupExpiredEntries(){const t=Date.now();for(const[e,n]of this.cache.entries())t-n.timestamp>this.ttl&&this.cache.delete(e)}get(t){this.cleanupExpiredEntries();const e=this.cache.get(t);if(e){if(!(Date.now()-e.timestamp>this.ttl))return e.data;this.cache.delete(t)}}set(t,e){this.cache.set(t,{data:e,timestamp:Date.now()})}clear(){this.cache.clear()}}({ttl:3e5}),kM=rS({info:rS({provides_extra:sS().array().nullable()}),releases:uV(sS(),hV())});function Vx(t){const e=K.c(5);let n;e[0]!==t?(n=function(i){return i.replaceAll(/\[.*]/g,"").trim()}(t),e[0]=t,e[1]=n):n=e[1];const o=n;let r,s;return e[2]!==o?(r=async()=>{const i=Ux.get(o);if(i)return i;const a=await fetch(`https://pypi.org/pypi/${o}/json`,{method:"GET"});if(!a.ok)throw new Error(`HTTP ${a.status}: ${a.statusText}`);const l=kM.transform(SM).parse(await a.json());return Ux.set(o,l),l},s=[o],e[2]=o,e[3]=r,e[4]=s):(r=e[3],s=e[4]),Gn(r,s)}function SM(t){return{versions:Object.keys(t.releases).toSorted(vM),extras:t.info.provides_extra??[]}}function $x(t){const e=t.match(/^([^[]+)(?:\[([^\]]+)])?$/);if(!e)return{name:t,extras:[]};const[,n,o]=e;return{name:n,extras:o?o.split(",").map(r=>r.trim()):[]}}const CM=()=>{const t=K.c(70),{packageAlert:e}=SH(),{clearPackageAlert:n}=CH(),[o]=$s();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={},t[0]=r):r=t[0];const[s,i]=T.useState(r);let a;t[1]===Symbol.for("react.memo_cache_sentinel")?(a={},t[1]=a):a=t[1];const[l,c]=T.useState(a);if(e===null)return null;const d=o.package_management.manager!=="pixi";if(NH(e)){let h,f,m,_,g,p,b,y,x,k;if(t[2]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[u.jsx(dd,{className:"w-5 h-5 inline-block mr-2"}),"Missing packages"]}),t[2]=h):h=t[2],t[3]!==n||t[4]!==e.id?(f=()=>n(e.id),t[3]=n,t[4]=e.id,t[5]=f):f=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(oo,{className:"w-5 h-5"}),t[6]=m):m=t[6],t[7]!==f?(_=u.jsxs("div",{className:"flex justify-between",children:[h,u.jsx(De,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:f,children:m})]}),t[7]=f,t[8]=_):_=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(g=u.jsx("p",{children:"The following packages were not found:"}),t[9]=g):g=t[9],t[10]!==s||t[11]!==d||t[12]!==e.packages||t[13]!==l){let C;t[15]!==s||t[16]!==d||t[17]!==l?(C=(v,E)=>{const N=$x(v),I=l[v]||N.extras;return u.jsxs("li",{className:"flex items-center gap-2 font-mono text-sm",children:[u.jsx(si,{size:"1rem"}),u.jsx(IM,{packageName:N.name,selectedExtras:I,onExtrasChange:A=>c(M=>({...M,[v]:A}))}),d&&u.jsx(AM,{value:s[v]??"latest",onChange:A=>i(M=>({...M,[v]:A})),packageName:N.name})]},E)},t[15]=s,t[16]=d,t[17]=l,t[18]=C):C=t[18],p=e.packages.map(C),t[10]=s,t[11]=d,t[12]=e.packages,t[13]=l,t[14]=p}else p=t[14];return t[19]!==p?(b=u.jsxs("div",{children:[g,u.jsx("ul",{className:"list-disc ml-4 mt-1",children:p})]}),t[19]=p,t[20]=b):b=t[20],t[21]!==n||t[22]!==s||t[23]!==e.id||t[24]!==e.isolated||t[25]!==e.packages||t[26]!==l||t[27]!==o.package_management.manager?(y=u.jsx("div",{className:"ml-auto flex flex-row items-baseline",children:e.isolated?u.jsxs(u.Fragment,{children:[u.jsx(jM,{manager:o.package_management.manager,packages:e.packages.map(C=>{const v=$x(C),E=l[C]||v.extras;return function(N,I){return I.length===0?N:`${N}[${I.join(",")}]`}(v.name,E)}),versions:s,clearPackageAlert:()=>n(e.id)}),!In()&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"px-2 text-sm",children:"with"})," ",u.jsx(EM,{})]})]}):u.jsxs("p",{children:["If you set up a"," ",u.jsx(Sm,{href:"https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments",children:"virtual environment"}),", marimo can install these packages for you."]})}),t[21]=n,t[22]=s,t[23]=e.id,t[24]=e.isolated,t[25]=e.packages,t[26]=l,t[27]=o.package_management.manager,t[28]=y):y=t[28],t[29]!==b||t[30]!==y?(x=u.jsxs("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:[b,y]}),t[29]=b,t[30]=y,t[31]=x):x=t[31],t[32]!==x||t[33]!==_?(k=u.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:u.jsxs(qc,{kind:"danger",className:"flex flex-col rounded py-3 px-5 animate-in slide-in-from-left",children:[_,x]})}),t[32]=x,t[33]=_,t[34]=k):k=t[34],k}if(jH(e)){let h;t[35]!==e.packages?(h=function(D){const F=new Set(Object.values(D)),B=F.has("queued")||F.has("installing")?"installing":F.has("failed")?"failed":"installed";return B==="installing"?{status:"installing",title:"Installing packages",titleIcon:u.jsx(Ea,{className:"w-5 h-5 inline-block mr-2"}),description:"Installing packages:"}:B==="installed"?{status:"installed",title:"All packages installed!",titleIcon:u.jsx(Vp,{className:"w-5 h-5 inline-block mr-2"}),description:"Installed packages:"}:{status:"failed",title:"Some packages failed to install",titleIcon:u.jsx(dd,{className:"w-5 h-5 inline-block mr-2"}),description:"See terminal for error logs."}}(e.packages),t[35]=e.packages,t[36]=h):h=t[36];const{status:f,title:m,titleIcon:_,description:g}=h;f==="installed"&&setTimeout(()=>n(e.id),1e4);const p=f==="failed"?"danger":"info";let b,y,x,k,C;t[37]!==m||t[38]!==_?(b=u.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[_,m]}),t[37]=m,t[38]=_,t[39]=b):b=t[39],t[40]!==n||t[41]!==e.id?(y=()=>n(e.id),t[40]=n,t[41]=e.id,t[42]=y):y=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx(oo,{className:"w-5 h-5"}),t[43]=x):x=t[43],t[44]!==y?(k=u.jsx(De,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:y,children:x}),t[44]=y,t[45]=k):k=t[45],t[46]!==b||t[47]!==k?(C=u.jsxs("div",{className:"flex justify-between",children:[b,k]}),t[46]=b,t[47]=k,t[48]=C):C=t[48];const v=f==="installed"&&"text-accent-foreground";let E,N,I,A,M,R,z;if(t[49]!==v?(E=Ae("flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",v),t[49]=v,t[50]=E):E=t[50],t[51]!==g?(N=u.jsx("p",{children:g}),t[51]=g,t[52]=N):N=t[52],t[53]!==e.packages||t[54]!==f){let D;t[56]!==f?(D=(F,B)=>{const[U,O]=F;return u.jsxs("li",{className:Ae("flex items-center gap-1 font-mono text-sm",O==="installing"&&"font-semibold",O==="failed"&&"text-destructive",O==="installed"&&"text-accent-foreground",O==="installed"&&f==="failed"&&"text-muted-foreground"),children:[u.jsx(NM,{status:O}),U]},B)},t[56]=f,t[57]=D):D=t[57],I=Object.entries(e.packages).map(D),t[53]=e.packages,t[54]=f,t[55]=I}else I=t[55];return t[58]!==I?(A=u.jsx("ul",{className:"list-disc ml-4 mt-1",children:I}),t[58]=I,t[59]=A):A=t[59],t[60]!==N||t[61]!==A?(M=u.jsxs("div",{children:[N,A]}),t[60]=N,t[61]=A,t[62]=M):M=t[62],t[63]!==E||t[64]!==M?(R=u.jsx("div",{className:E,children:M}),t[63]=E,t[64]=M,t[65]=R):R=t[65],t[66]!==R||t[67]!==p||t[68]!==C?(z=u.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:u.jsxs(qc,{kind:p,className:"flex flex-col rounded pt-3 pb-4 px-5",children:[C,R]})}),t[66]=R,t[67]=p,t[68]=C,t[69]=z):z=t[69],z}return wc(e),null},NM=t=>{const e=K.c(4),{status:n}=t;switch(n){case"queued":{let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(si,{size:"1rem"}),e[0]=o):o=e[0],o}case"installing":{let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(Ea,{size:"1rem"}),e[1]=o):o=e[1],o}case"installed":{let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(Cc,{size:"1rem"}),e[2]=o):o=e[2],o}case"failed":{let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(oo,{size:"1rem"}),e[3]=o):o=e[3],o}default:return wc(n),null}},jM=t=>{const e=K.c(9),{manager:n,packages:o,versions:r,clearPackageAlert:s}=t;let i,a,l,c;return e[0]!==s||e[1]!==n||e[2]!==o||e[3]!==r?(i=async()=>{s();const d={...r};for(const h of o)d[h]=d[h]??"";await gV({manager:n,versions:d}).catch(TM)},e[0]=s,e[1]=n,e[2]=o,e[3]=r,e[4]=i):i=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(Ea,{className:"w-4 h-4 mr-2"}),l=u.jsx("span",{className:"font-semibold",children:"Install"}),e[5]=a,e[6]=l):(a=e[5],l=e[6]),e[7]!==i?(c=u.jsxs(De,{variant:"outline","data-testid":"install-packages-button",size:"sm",onClick:i,children:[a,l]}),e[7]=i,e[8]=c):c=e[8],c},EM=()=>{const t=K.c(16),[e,n]=$s();let o,r;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=d4(fV),t[0]=o):o=t[0],t[1]!==e?(r={resolver:o,defaultValues:e},t[1]=e,t[2]=r):r=t[2];const s=u4(r);let i;t[3]!==n?(i=async f=>{await zr({config:f}).then(()=>{n(f)})},t[3]=n,t[4]=i):i=t[4];const a=i;let l,c,d,h;return t[5]!==s||t[6]!==a?(l=s.handleSubmit(a),t[5]=s,t[6]=a,t[7]=l):l=t[7],t[8]!==s.control?(c=u.jsx("div",{className:"flex flex-col gap-3",children:u.jsx(i4,{control:s.control,name:"package_management.manager",render:OM})}),t[8]=s.control,t[9]=c):c=t[9],t[10]!==l||t[11]!==c?(d=u.jsx("form",{onChange:l,className:"flex flex-col gap-5",children:c}),t[10]=l,t[11]=c,t[12]=d):d=t[12],t[13]!==s||t[14]!==d?(h=u.jsx(mV,{...s,children:d}),t[13]=s,t[14]=d,t[15]=h):h=t[15],h},IM=t=>{const e=K.c(14),{packageName:n,selectedExtras:o,onExtrasChange:r}=t,[s,i]=T.useState(!1),{isPending:a,error:l,data:c}=Vx(n);let d;e[0]!==r||e[1]!==o?(d=(g,p)=>{r(p?[...o,g]:o.filter(b=>b!==g))},e[0]=r,e[1]=o,e[2]=d):d=e[2];const h=d,f=!a&&!l;let m,_;if(e[3]!==(c==null?void 0:c.extras)?(m=(c==null?void 0:c.extras)??[],e[3]=c==null?void 0:c.extras,e[4]=m):m=e[4],e[5]!==f||e[6]!==h||e[7]!==s||e[8]!==n||e[9]!==o||e[10]!==m){const g=m.filter(DM);let p;e[12]!==n?(p=u.jsx("span",{className:"shrink-0",children:n}),e[12]=n,e[13]=p):p=e[13],_=u.jsxs("div",{className:"flex items-center max-w-72",children:[p,o.length>0?u.jsxs("span",{className:"flex items-center min-w-0 flex-1",children:[u.jsx("span",{className:"shrink-0",children:"["}),u.jsxs(Hs,{open:s&&f,onOpenChange:b=>{f&&i(b)},children:[u.jsx(Ws,{asChild:!0,children:u.jsx("button",{className:"hover:bg-muted/50 rounded text-sm px-1 transition-colors border border-muted-foreground/30 hover:border-muted-foreground/60 min-w-0 flex-1 truncate text-left",title:`Selected extras: ${o.join(", ")}`,children:o.join(",")})}),u.jsxs(qs,{align:"start",className:"w-64 p-0 max-h-96 flex flex-col",children:[o.length>0&&u.jsx("div",{className:"p-2 bg-popover border-b border-border",children:u.jsx("div",{className:"flex flex-wrap gap-1 p-1 min-h-[24px]",children:o.map(b=>u.jsxs("span",{className:"inline-flex items-center gap-1 px-1 py-0.5 text-sm font-mono border border-muted-foreground/30 hover:border-muted-foreground/60 rounded-sm cursor-pointer group transition-colors",onClick:()=>h(b,!1),children:[b,u.jsx(oo,{className:"w-3 h-3 opacity-60 group-hover:opacity-100"})]},b))})}),u.jsx("div",{className:"overflow-y-auto flex-1",children:g.map(b=>u.jsx(iS,{checked:o.includes(b),onCheckedChange:y=>{h(b,y)},className:"font-mono text-sm",onSelect:RM,children:b},b))})]})]}),u.jsx("span",{className:"shrink-0",children:"]"})]}):g.length>0?u.jsxs(Hs,{open:s&&f,onOpenChange:b=>{f&&i(b)},children:[u.jsx(Ws,{asChild:!0,children:u.jsx("button",{disabled:!f,className:Ae("hover:bg-muted/50 rounded text-sm ml-2 transition-colors border border-muted-foreground/30 hover:border-muted-foreground/60 h-5 w-5 flex items-center justify-center p-0",!f&&"opacity-50 cursor-not-allowed"),title:f?"Add extras":"Loading extras...",children:u.jsx(pr,{className:"w-3 h-3 flex-shrink-0"})})}),u.jsxs(qs,{align:"start",className:"w-64 p-0 max-h-96 flex flex-col",children:[u.jsx("div",{className:"p-2 bg-popover border-b border-border",children:u.jsx("span",{className:"text-muted-foreground italic text-sm",children:"Package extras"})}),u.jsx("div",{className:"overflow-y-auto flex-1",children:g.map(b=>u.jsx(iS,{checked:o.includes(b),onCheckedChange:y=>{h(b,y)},className:"font-mono text-sm",onSelect:PM,children:b},b))})]})]}):null]}),e[5]=f,e[6]=h,e[7]=s,e[8]=n,e[9]=o,e[10]=m,e[11]=_}else _=e[11];return _},AM=t=>{const e=K.c(16),{value:n,onChange:o,packageName:r}=t,{error:s,isPending:i,data:a}=Vx(r);if(s){let h,f,m;return e[0]!==o?(h=_=>o(_.target.value),e[0]=o,e[1]=h):h=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx("option",{value:"latest",children:"latest"}),e[2]=f):f=e[2],e[3]!==h||e[4]!==n?(m=u.jsx(Te,{content:"Failed to fetch package versions",children:u.jsx(Zm,{value:n,onChange:h,disabled:!0,className:"inline-flex ml-2 w-24 text-ellipsis",children:f})}),e[3]=h,e[4]=n,e[5]=m):m=e[5],m}let l,c,d;return e[6]!==o?(l=h=>o(h.target.value),e[6]=o,e[7]=l):l=e[7],e[8]!==i||e[9]!==a?(c=i?u.jsx("option",{value:"latest",children:"latest"}):["latest",...a.versions.slice(0,100)].map(LM),e[8]=i,e[9]=a,e[10]=c):c=e[10],e[11]!==i||e[12]!==l||e[13]!==c||e[14]!==n?(d=u.jsx(Zm,{value:n,onChange:l,disabled:i,className:"inline-flex ml-2 w-24 text-ellipsis",children:c}),e[11]=i,e[12]=l,e[13]=c,e[14]=n,e[15]=d):d=e[15],d};function TM(t){Dt.error(t)}function MM(t){return u.jsx("option",{value:t,children:t},t)}function OM(t){const{field:e}=t;return u.jsxs(a4,{children:[u.jsx(l4,{children:u.jsx(Zm,{"data-testid":"install-package-manager-select",onChange:n=>e.onChange(n.target.value),value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:pV.map(MM)})}),u.jsx(c4,{})]})}function DM(t){return!/^(dev|test|testing)$/i.test(t)}function RM(t){return t.preventDefault()}function PM(t){return t.preventDefault()}function LM(t){return u.jsx("option",{value:t,children:t},t)}const FM=t=>{let{transform:e}=t;return{...e,x:0}},zM={threshold:{x:0,y:.1}},BM=J.memo(t=>{const e=K.c(23),{children:n,multiColumn:o}=t,{dropCellOverCell:r,dropCellOverColumn:s,moveColumn:i,compactColumns:a}=Ot(),[l,c]=T.useState(null),[d,h]=T.useState(null),[f]=n4();let m;e:{if(f.width==="columns"){m=Qm.EMPTY;break e}let D;e[0]===Symbol.for("react.memo_cache_sentinel")?(D=[FM],e[0]=D):D=e[0],m=D}const _=m;let g,p;e[1]===Symbol.for("react.memo_cache_sentinel")?(g={activationConstraint:{distance:8}},e[1]=g):g=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(p={coordinateGetter:Xj},e[2]=p):p=e[2];const b=function(){for(var D=arguments.length,F=new Array(D),B=0;B<D;B++)F[B]=arguments[B];return T.useMemo(()=>[...F].filter(U=>U!=null),[...F])}(Qg(Vd,g),Qg(Bd,p));let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y=D=>{c(D.active.id);const F=Wn();h(F.cellIds)},e[3]=y):y=e[3];const x=nt(y);let k;e[4]!==d?(k=()=>{c(null),h(null)},e[4]=d,e[5]=k):k=e[5];const C=nt(k);let v;e[6]!==l?(v=D=>{const F=D.droppableContainers.filter(UM);if(l&&ds(l))return Rd({...D,droppableContainers:F});const B=(j=>{let{droppableContainers:W,droppableRects:X,pointerCoordinates:Y}=j;if(!Y)return[];const q=[];for(const ne of W){const{id:re}=ne,ae=X.get(re);if(ae&&pj(Y,ae)){const Z=Od(ae).reduce((he,pe)=>he+Td(Y,pe),0),Q=Number((Z/4).toFixed(4));q.push({id:re,data:{droppableContainer:ne,value:Q}})}}return q.sort(Md)})({...D,droppableContainers:F}),U=Dd(B.length>0?B:t1({...D,droppableContainers:F}),"id");if(!U)return[];zo(ds(U),`Expected column id. Got: ${U}`);const O=Wn().cellIds.get(U);if(zo(O,`Expected column. Got: ${U}`),O&&O.topLevelIds.length===0)return[{id:U}];const S=new Set(O.topLevelIds),$=Rd({...D,droppableContainers:D.droppableContainers.filter(j=>j.id!==U&&S.has(j.id))});if($.length>0){const j=$[0].id;return zo(th(j),`Expected cell id. Got: ${j}`),[{id:j}]}return[]},e[6]=l,e[7]=v):v=e[7];const E=v;let N;e[8]!==r||e[9]!==s||e[10]!==i?(N=D=>{const{active:F,over:B}=D,U=B==null?void 0:B.id;if(U!=null&&F.id!==U){if(th(F.id)){if(ds(U))return void s({cellId:F.id,columnId:U});if(th(U))return void r({cellId:F.id,overCellId:U})}ds(F.id)&&ds(U)&&i({column:F.id,overColumn:U})}},e[8]=r,e[9]=s,e[10]=i,e[11]=N):N=e[11];const I=nt(N);let A;e[12]!==a?(A=D=>{const{active:F,over:B}=D;B!==null&&F.id!==B.id&&a()},e[12]=a,e[13]=A):A=e[13];const M=nt(A),R=o?E:Rd;let z;return e[14]!==n||e[15]!==C||e[16]!==M||e[17]!==I||e[18]!==x||e[19]!==_||e[20]!==b||e[21]!==R?(z=u.jsx(Fj,{autoScroll:zM,sensors:b,collisionDetection:R,modifiers:_,onDragEnd:M,onDragStart:x,onDragCancel:C,onDragOver:I,children:n}),e[14]=n,e[15]=C,e[16]=M,e[17]=I,e[18]=x,e[19]=_,e[20]=b,e[21]=R,e[22]=z):z=e[22],z});function th(t){return typeof t=="string"&&!t.startsWith("tree_")}function ds(t){return typeof t=="string"&&t.startsWith("tree_")}function UM(t){return ds(t.id)}const VM=t=>{const e=K.c(13),{className:n,size:o,gap:r,durationMs:s}=t,i=o===void 0?8:o,a=r===void 0?"gap-1":r,l=s===void 0?1200:s,c=`${l}ms`;let d;e[0]!==c?(d={animationDuration:c},e[0]=c,e[1]=d):d=e[1];const h=d;let f,m,_,g;return e[2]!==n||e[3]!==a?(f=Hc("flex",a,n),e[2]=n,e[3]=a,e[4]=f):f=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(m=[0,1,2],e[5]=m):m=e[5],e[6]!==h||e[7]!==l||e[8]!==i?(_=m.map(p=>u.jsx(_V,{width:i,height:i,className:"fill-current text-current animate-ellipsis-dot",style:{...h,animationDelay:l/3*p+"ms"}},p)),e[6]=h,e[7]=l,e[8]=i,e[9]=_):_=e[9],e[10]!==f||e[11]!==_?(g=u.jsx("div",{className:f,"aria-label":"Loading",children:_}),e[10]=f,e[11]=_,e[12]=g):g=e[12],g},$M=()=>{const t=K.c(2),e=$e(bV);let n;return t[0]!==e?(n=e&&u.jsx(Jm,{milliseconds:1e3,children:u.jsx("div",{className:"absolute top-4 m-0 flex items-center min-h-[28px] left-1/2 transform -translate-x-1/2 z-[200] ",children:u.jsx(Te,{content:"Connecting to a marimo runtime",children:u.jsx("div",{className:"flex items-center",children:u.jsx(VM,{size:5,className:"text-yellow-500"})})})})}),t[0]=e,t[1]=n):n=t[1],n},Hx=J.forwardRef((t,e)=>{const n=K.c(62);let o,r,s,i,a,l;n[0]!==t?({columnId:i,canDelete:o,canMoveLeft:r,canMoveRight:s,...a}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i,n[5]=a):(o=n[1],r=n[2],s=n[3],i=n[4],a=n[5]),n[6]!==i?(l={id:i},n[6]=i,n[7]=l):l=n[7];const{attributes:c,listeners:d,setNodeRef:h,transform:f,transition:m,isDragging:_,isOver:g}=A1(l);let p;n[8]!==f?(p=f?Dc.Transform.toString({x:f.x,y:0,scaleX:1,scaleY:1}):void 0,n[8]=f,n[9]=p):p=n[9];const b=_?2:void 0;let y;n[10]!==p||n[11]!==b||n[12]!==m?(y={transform:p,transition:m,zIndex:b,position:"relative","--gutter-width":"50px"},n[10]=p,n[11]=b,n[12]=m,n[13]=y):y=n[13];const x=y,{deleteColumn:k,moveColumn:C,addColumn:v}=Ot();let E;n[14]===Symbol.for("react.memo_cache_sentinel")?(E=Ae("h-full hover:bg-muted rounded-none"),n[14]=E):E=n[14];const N=E,I=WM;let A;n[15]!==i||n[16]!==C?(A=()=>C({column:i,overColumn:"_left_"}),n[15]=i,n[16]=C,n[17]=A):A=n[17];const M=!r;let R,z,D;n[18]===Symbol.for("react.memo_cache_sentinel")?(R=u.jsx(t4,{className:"size-4"}),n[18]=R):R=n[18],n[19]!==A||n[20]!==M?(z=u.jsx(Te,{content:"Move column left",side:"top",delayDuration:300,children:u.jsx(De,{variant:"text",size:"sm",className:N,onClick:A,disabled:M,children:R})}),n[19]=A,n[20]=M,n[21]=z):z=n[21],n[22]!==i||n[23]!==C?(D=()=>C({column:i,overColumn:"_right_"}),n[22]=i,n[23]=C,n[24]=D):D=n[24];const F=!s;let B,U,O,S,$,j,W,X;n[25]===Symbol.for("react.memo_cache_sentinel")?(B=u.jsx(ia,{className:"size-4"}),n[25]=B):B=n[25],n[26]!==D||n[27]!==F?(U=u.jsx(Te,{content:"Move column right",side:"top",delayDuration:300,children:u.jsx(De,{variant:"text",size:"sm",className:N,onClick:D,disabled:F,children:B})}),n[26]=D,n[27]=F,n[28]=U):U=n[28],n[29]!==c||n[30]!==d?(O=u.jsx("div",{className:"flex gap-2 h-full flex-grow active:bg-accent cursor-grab",...c,...d,"data-testid":"column-drag-button"}),n[29]=c,n[30]=d,n[31]=O):O=n[31],n[32]!==o||n[33]!==i||n[34]!==k?(S=o&&u.jsx(Te,{content:"Delete column",side:"top",delayDuration:300,children:u.jsx(De,{variant:"text",size:"sm",className:"opacity-0 group-hover:opacity-70 group-hover:hover:opacity-100 text-destructive h-full hover:bg-destructive/20 rounded-none",onClick:()=>k({columnId:i}),children:u.jsx(oo,{className:"size-4"})})}),n[32]=o,n[33]=i,n[34]=k,n[35]=S):S=n[35],n[36]!==v||n[37]!==i?($=()=>{v({columnId:i}),requestAnimationFrame(I)},n[36]=v,n[37]=i,n[38]=$):$=n[38],n[39]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx(pr,{className:"size-4"}),n[39]=j):j=n[39],n[40]!==$?(W=u.jsx(Te,{content:"Add column",side:"top",delayDuration:300,children:u.jsx(De,{variant:"text",size:"sm",className:N,onClick:$,children:j})}),n[40]=$,n[41]=W):W=n[41],n[42]!==U||n[43]!==O||n[44]!==S||n[45]!==W||n[46]!==z?(X=u.jsxs("div",{className:"h-6 group flex items-center rounded-t-lg border hover:border-border border-[var(--slate-3)] overflow-hidden bg-[var(--slate-1)]",children:[z,U,O,S,W]}),n[42]=U,n[43]=O,n[44]=S,n[45]=W,n[46]=z,n[47]=X):X=n[47];const Y=X;let q;n[48]!==e||n[49]!==h?(q=he=>{Cl(e,h)(he)},n[48]=e,n[49]=h,n[50]=q):q=n[50];const ne=_?"":a.className,re=_?"z-20":"z-1 hover:z-10 focus-within:z-10",ae=g&&"bg-accent/20";let Z,Q;return n[51]!==ne||n[52]!==re||n[53]!==ae?(Z=Ae(ne,re,ae),n[51]=ne,n[52]=re,n[53]=ae,n[54]=Z):Z=n[54],n[55]!==Y||n[56]!==_||n[57]!==a||n[58]!==x||n[59]!==q||n[60]!==Z?(Q=u.jsxs("div",{tabIndex:-1,ref:q,...a,style:x,"data-is-dragging":_,className:Z,children:[Y,a.children]}),n[55]=Y,n[56]=_,n[57]=a,n[58]=x,n[59]=q,n[60]=Z,n[61]=Q):Q=n[61],Q});Hx.displayName="SortableColumn";const HM=T.memo(Hx);function WM(){const t=document.getElementById("App");t&&t.scrollTo({left:t.scrollLeft+1e3,behavior:"smooth"})}const{getColumnWidth:qM,saveColumnWidth:GM}=yV,Wx=T.memo(t=>{const e=K.c(14),n=T.useRef(null);let o;e[0]!==t.children||e[1]!==t.index||e[2]!==t.width?(o=t.width==="columns"?u.jsx(YM,{startingWidth:qM(t.index),onResize:i=>{GM(t.index,i)},children:t.children}):u.jsx("div",{className:"flex flex-col gap-5",children:t.children}),e[0]=t.children,e[1]=t.index,e[2]=t.width,e[3]=o):o=e[3];const r=o;if(t.width==="columns"){let i;return e[4]!==r||e[5]!==t.canDelete||e[6]!==t.canMoveLeft||e[7]!==t.canMoveRight||e[8]!==t.columnId||e[9]!==t.footer?(i=u.jsxs(HM,{tabIndex:-1,ref:n,canDelete:t.canDelete,columnId:t.columnId,canMoveLeft:t.canMoveLeft,canMoveRight:t.canMoveRight,className:"group/column",children:[r,t.footer]}),e[4]=r,e[5]=t.canDelete,e[6]=t.canMoveLeft,e[7]=t.canMoveRight,e[8]=t.columnId,e[9]=t.footer,e[10]=i):i=e[10],i}let s;return e[11]!==r||e[12]!==t.footer?(s=u.jsxs(u.Fragment,{children:[r,t.footer]}),e[11]=r,e[12]=t.footer,e[13]=s):s=e[13],s});Wx.displayName="Column";const YM=t=>{const e=K.c(15),{startingWidth:n,onResize:o,children:r}=t;let s;e[0]!==o||e[1]!==n?(s={startingWidth:n,onResize:o},e[0]=o,e[1]=n,e[2]=s):s=e[2];const{resizableDivRef:i,handleRefs:a,style:l}=xV(s),c=JM;let d,h,f,m;return e[3]!==a.left?(d=c(a.left),e[3]=a.left,e[4]=d):d=e[4],e[5]!==r||e[6]!==i||e[7]!==l?(h=u.jsx("div",{ref:i,className:"flex flex-col gap-5 box-content min-h-[100px] px-11 py-6 min-w-[500px] z-1",style:l,children:r}),e[5]=r,e[6]=i,e[7]=l,e[8]=h):h=e[8],e[9]!==a.right?(f=c(a.right),e[9]=a.right,e[10]=f):f=e[10],e[11]!==d||e[12]!==h||e[13]!==f?(m=u.jsxs("div",{className:"flex flex-row",children:[d,h,f]}),e[11]=d,e[12]=h,e[13]=f,e[14]=m):m=e[14],m};function JM(t){return u.jsx("div",{ref:t,className:`w-[3px] cursor-col-resize transition-colors duration-200 z-[100]
|
121
|
+
relative before:content-[''] before:absolute before:inset-y-0 before:-left-[3px]
|
122
|
+
before:right-[-3px] before:w-[9px] before:z-[-1]
|
123
|
+
hover/column:bg-[var(--slate-3)] dark:hover/column:bg-[var(--slate-5)]
|
124
|
+
hover/column:hover:bg-primary/60 dark:hover/column:hover:bg-primary/60`})}const KM=t=>{const e=K.c(10),{width:n}=t,{banners:o}=EH(),{removeBanner:r}=IH();if(o.length===0)return null;const s=n==="columns"&&"sticky left-12 w-full max-w-[80vw]";let i,a,l;if(e[0]!==s?(i=Ae("flex flex-col gap-4 mb-5 print:hidden",s),e[0]=s,e[1]=i):i=e[1],e[2]!==o||e[3]!==r){let c;e[5]!==r?(c=d=>u.jsxs(qc,{kind:d.variant||"info",className:"flex flex-col rounded p-3",children:[u.jsxs("div",{className:"flex justify-between",children:[u.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[u.jsx(aS,{className:"w-5 h-5 inline-block mr-2"}),d.title]}),u.jsx(De,{"data-testid":"remove-banner-button",variant:"text",size:"icon",onClick:()=>r(d.id),children:u.jsx(oo,{className:"w-5 h-5"})})]}),u.jsxs("div",{className:"flex justify-between items-end",children:[u.jsx("span",{children:ep({html:d.description})}),d.action==="restart"&&u.jsx(XM,{})]})]},d.id),e[5]=r,e[6]=c):c=e[6],a=o.map(c),e[2]=o,e[3]=r,e[4]=a}else a=e[4];return e[7]!==i||e[8]!==a?(l=u.jsx("div",{className:i,children:a}),e[7]=i,e[8]=a,e[9]=l):l=e[9],l},XM=()=>{const t=K.c(3),e=Ug();let n,o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=u.jsx(Gp,{className:"w-3 h-3 mr-2"}),t[0]=n):n=t[0],t[1]!==e?(o=u.jsxs(De,{"data-testid":"restart-session-button",variant:"link",size:"xs",onClick:e,children:[n,"Restart"]}),t[1]=e,t[2]=o):o=t[2],o},ZM=Gt(t=>{const e=t(_m);for(const n of e.cellIds.inOrderIds){const o=e.cellRuntime[n];if(o.status==="idle"&&o.consoleOutputs.some(r=>r.channel==="stdin"&&r.response===void 0))return!0}return!1}),QM=()=>{const t=K.c(3),e=eO;if(!$e(ZM))return null;let n,o,r;if(t[0]===Symbol.for("react.memo_cache_sentinel")?(n=u.jsx("div",{className:"flex justify-between",children:u.jsx("span",{className:"font-bold text-lg flex items-center mb-1",children:"Program waiting for input"})}),t[0]=n):n=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(O4,{className:"inline",children:"stdin"}),t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")){const s=u.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-1/2 transform -translate-x-1/2 z-[200] opacity-95",children:u.jsxs(qc,{kind:"info",className:"flex flex-col rounded py-2 px-4 animate-in slide-in-from-top w-fit",children:[n,u.jsx("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:u.jsx("div",{children:u.jsxs("p",{children:["The program is still running, but blocked on"," ",o,".",u.jsx(De,{variant:"link",className:"h-auto font-normal",onClick:e,children:"Jump to the cell"})]})})})]})});r=u.jsx(Jm,{milliseconds:2e3,children:s}),t[2]=r}else r=t[2];return r};function eO(){const t=document.querySelector("[data-stdin-blocking]");t?(t.scrollIntoView({behavior:"smooth",block:"center"}),requestAnimationFrame(()=>{t.focus()})):Dt.error("No element with data-stdin-blocking found")}function tO(){const t=setTimeout(nO,100);return()=>clearTimeout(t)}function nO(){requestAnimationFrame(oO)}function oO(){const t=function(e){const n=e.match(/scrollTo=([^&]+)/),o=n==null?void 0:n[1];return o?decodeURIComponent(o.split("&")[0]):null}(window.location.hash);if(t)(function(e){var o,r;if(Gx)return;const n=document.querySelector(`[data-cell-name="${e}"]`);if(n){if(n.scrollIntoView({behavior:"smooth",block:"start"}),Gx=!0,n instanceof HTMLElement){n.focus();const{cellHandles:s}=Wn(),i=n.dataset.cellId;if(!i)return void Dt.error(`Missing cellId for cell with name ${e}`);const a=(r=(o=s[i])==null?void 0:o.current)==null?void 0:r.editorView;a&&a.focus()}}else Dt.warn(`Cannot focus cell with name ${e} because it was not found`),qx()})(t);else try{qx()}catch(e){const n=e;Dt.warn("Error focusing first editor",n)}}function qx(){var o,r;const{cellIds:t,cellData:e,cellHandles:n}=Wn();for(const s of t.iterateTopLevelIds){const i=n[s];if(!((o=e[s])==null?void 0:o.config.hide_code)&&((r=i==null?void 0:i.current)!=null&&r.editorView))return void i.current.editorView.focus()}}let Gx=!1;const rO=t=>{const e=K.c(8),n=$e(wV),o=t.appConfig.width==="columns";let r,s,i;return e[0]!==t?(r=u.jsx(sO,{...t}),e[0]=t,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(s=u.jsx(E1,{id:"column-container",items:n,strategy:$j,children:r}),e[2]=n,e[3]=r,e[4]=s):s=e[4],e[5]!==o||e[6]!==s?(i=u.jsx(BM,{multiColumn:o,children:s}),e[5]=o,e[6]=s,e[7]=i):i=e[7],i},sO=t=>{const e=K.c(52),{mode:n,userConfig:o,appConfig:r,connStatus:s}=t,i=Ac(),a=Ot(),{theme:l}=gr(),{toggleSidebarPanel:c}=da();lS(tO),Jt("global.focusTop",a.focusTopCell),Jt("global.focusBottom",a.focusBottomCell),Jt("global.toggleSidebar",c),Jt("global.foldCode",a.foldAll),Jt("global.unfoldCode",a.unfoldAll),Jt("global.formatAll",lO),Jt("cell.hideCode",An.NOOP),Jt("cell.format",An.NOOP);const d=wd(),h=a.scrollToTarget;let f,m,_,g,p,b,y,x,k,C,v,E,N,I,A,M;if(e[0]!==i.scrollKey||e[1]!==h?(f=()=>{i.scrollKey!==null&&h()},e[0]=i.scrollKey,e[1]=h,e[2]=f):f=e[2],e[3]!==i.cellIds||e[4]!==i.scrollKey||e[5]!==h?(m=[i.cellIds,i.scrollKey,h],e[3]=i.cellIds,e[4]=i.scrollKey,e[5]=h,e[6]=m):m=e[6],T.useEffect(f,m),e[7]!==a||e[8]!==r||e[9]!==s||e[10]!==n||e[11]!==i||e[12]!==d||e[13]!==l||e[14]!==o){const R=i.cellIds.getColumns();let z;e[26]!==i.cellIds?(z=i.cellIds.hasOnlyOneId(),e[26]=i.cellIds,e[27]=z):z=e[27];const D=z;let F;e[28]!==i.cellIds.inOrderIds?(F=i.cellIds.inOrderIds.includes($o),e[28]=i.cellIds.inOrderIds,e[29]=F):F=e[29];const B=F;_=AH,k="pb-[40vh]",C=!1,v=r,E="pr-4",e[30]===Symbol.for("react.memo_cache_sentinel")?(N=u.jsx(CM,{}),g=u.jsx(QM,{}),p=u.jsx($M,{}),e[30]=g,e[31]=p,e[32]=N):(g=e[30],p=e[31],N=e[32]),e[33]!==r.width?(b=u.jsx(KM,{width:r.width}),e[33]=r.width,e[34]=b):b=e[34];const U=r.width==="columns"&&"grid grid-flow-col auto-cols-min gap-6";e[35]!==U?(y=Ae(U),e[35]=U,e[36]=y):y=e[36],x=R.map((O,S)=>u.jsx(iO,{column:O,index:S,columnsLength:R.length,appConfig:r,notebook:i,mode:n,userConfig:o,connStatus:s,actions:a,theme:l,hasOnlyOneCell:D,hasSetupCell:B,onDeleteCell:d},O.id)),e[7]=a,e[8]=r,e[9]=s,e[10]=n,e[11]=i,e[12]=d,e[13]=l,e[14]=o,e[15]=_,e[16]=g,e[17]=p,e[18]=b,e[19]=y,e[20]=x,e[21]=k,e[22]=C,e[23]=v,e[24]=E,e[25]=N}else _=e[15],g=e[16],p=e[17],b=e[18],y=e[19],x=e[20],k=e[21],C=e[22],v=e[23],E=e[24],N=e[25];return e[37]!==y||e[38]!==x?(I=u.jsx("div",{className:y,children:x}),e[37]=y,e[38]=x,e[39]=I):I=e[39],e[40]===Symbol.for("react.memo_cache_sentinel")?(A=u.jsx(TH,{}),e[40]=A):A=e[40],e[41]!==_||e[42]!==g||e[43]!==p||e[44]!==b||e[45]!==I||e[46]!==k||e[47]!==C||e[48]!==v||e[49]!==E||e[50]!==N?(M=u.jsxs(_,{className:k,invisible:C,appConfig:v,innerClassName:E,children:[N,g,p,b,I,A]}),e[41]=_,e[42]=g,e[43]=p,e[44]=b,e[45]=I,e[46]=k,e[47]=C,e[48]=v,e[49]=E,e[50]=N,e[51]=M):M=e[51],M},iO=t=>{const e=K.c(40),{column:n,index:o,columnsLength:r,appConfig:s,notebook:i,mode:a,userConfig:l,connStatus:c,actions:d,theme:h,hasOnlyOneCell:f,hasSetupCell:m,onDeleteCell:_}=t,g=c.state,p=n.id,b=o>0,y=o<r-1,x=s.width,k=r>1,C=n.id,v=s.width==="columns"&&"opacity-0 group-hover/column:opacity-100";let E,N;e[0]!==v?(E=Ae(v),e[0]=v,e[1]=E):E=e[1],e[2]!==n.id||e[3]!==E?(N=u.jsx(aO,{columnId:C,className:E}),e[2]=n.id,e[3]=E,e[4]=N):N=e[4];const I=`column-${o+1}`,A=n.topLevelIds;let M,R,z,D;return e[5]!==d||e[6]!==g||e[7]!==m||e[8]!==o||e[9]!==a||e[10]!==i||e[11]!==_||e[12]!==h||e[13]!==l?(M=o===0&&m&&u.jsx(Bx,{theme:h,showPlaceholder:!1,...i.cellData[$o],...i.cellRuntime[$o],...d,runElapsedTimeMs:i.cellRuntime[$o].runElapsedTimeMs??i.cellData[$o].lastExecutionTime,canDelete:!0,mode:a,connectionState:g,ref:i.cellHandles[$o],userConfig:l,isCollapsed:!1,collapseCount:0,canMoveX:!1,actions:d,deleteCell:_},$o),e[5]=d,e[6]=g,e[7]=m,e[8]=o,e[9]=a,e[10]=i,e[11]=_,e[12]=h,e[13]=l,e[14]=M):M=e[14],e[15]!==d||e[16]!==s.width||e[17]!==n||e[18]!==g||e[19]!==f||e[20]!==a||e[21]!==i||e[22]!==_||e[23]!==h||e[24]!==l?(R=n.topLevelIds.map(F=>{if(F===$o)return null;const B=i.cellData[F],U=i.cellRuntime[F];return u.jsx(Bx,{theme:h,showPlaceholder:f,...B,...U,runElapsedTimeMs:U.runElapsedTimeMs??B.lastExecutionTime,canDelete:!f,mode:a,connectionState:g,ref:i.cellHandles[F],userConfig:l,config:B.config,name:B.name,isCollapsed:n.isCollapsed(F),collapseCount:n.getCount(F),canMoveX:s.width==="columns",actions:d,deleteCell:_},B.id.toString())}),e[15]=d,e[16]=s.width,e[17]=n,e[18]=g,e[19]=f,e[20]=a,e[21]=i,e[22]=_,e[23]=h,e[24]=l,e[25]=R):R=e[25],e[26]!==n.topLevelIds||e[27]!==I||e[28]!==M||e[29]!==R?(z=u.jsxs(E1,{id:I,items:A,strategy:Hj,children:[M,R]}),e[26]=n.topLevelIds,e[27]=I,e[28]=M,e[29]=R,e[30]=z):z=e[30],e[31]!==s.width||e[32]!==n.id||e[33]!==o||e[34]!==z||e[35]!==b||e[36]!==y||e[37]!==k||e[38]!==N?(D=u.jsx(Wx,{columnId:p,index:o,canMoveLeft:b,canMoveRight:y,width:x,canDelete:k,footer:N,children:z}),e[31]=s.width,e[32]=n.id,e[33]=o,e[34]=z,e[35]=b,e[36]=y,e[37]=k,e[38]=N,e[39]=D):D=e[39],D},aO=t=>{const e=K.c(18),{columnId:n,className:o}=t,{createNewCell:r}=Ot(),s=$e(Bs),[i,a]=vV(!1),l=$e(hc),c=$e(E4);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=Ae("mb-0 rounded-none sm:px-4 md:px-5 lg:px-8 tracking-wide no-wrap whitespace-nowrap","hover:bg-accent hover:text-accent-foreground font-semibold uppercase text-xs"),e[0]=d):d=e[0];const h=d;let f;e[1]!==l||e[2]!==s||e[3]!==n||e[4]!==r||e[5]!==i||e[6]!==a.toggle||e[7]!==c?(f=()=>i?u.jsx(kV,{onClose:a.toggle}):u.jsxs(u.Fragment,{children:[u.jsxs(De,{className:h,variant:"text",size:"sm",disabled:!c,onClick:()=>r({cellId:{type:"__end__",columnId:n},before:!1}),children:[u.jsx(Kp,{className:"mr-2 size-4 flex-shrink-0"}),"Python"]}),u.jsxs(De,{className:h,variant:"text",size:"sm",disabled:!c,onClick:()=>{ur(s,r),r({cellId:{type:"__end__",columnId:n},before:!1,code:new ca().defaultCode})},children:[u.jsx(Qp,{className:"mr-2 size-4 flex-shrink-0"}),"Markdown"]}),u.jsxs(De,{className:h,variant:"text",size:"sm",disabled:!c,onClick:()=>{ur(s,r),r({cellId:{type:"__end__",columnId:n},before:!1,code:new Uc().defaultCode})},children:[u.jsx(dr,{className:"mr-2 size-4 flex-shrink-0"}),"SQL"]}),u.jsx(Te,{content:l?null:u.jsx("span",{children:"Enable via settings under AI Assist"}),delayDuration:100,asChild:!1,children:u.jsxs(De,{className:h,variant:"text",size:"sm",disabled:!l||!c,onClick:a.toggle,children:[u.jsx(sa,{className:"mr-2 size-4 flex-shrink-0"}),"Generate with AI"]})})]}),e[1]=l,e[2]=s,e[3]=n,e[4]=r,e[5]=i,e[6]=a.toggle,e[7]=c,e[8]=f):f=e[8];const m=f,_=!i&&"w-fit",g=i&&"opacity-100 w-full max-w-4xl shadow-lg shadow-[var(--blue-3)]";let p,b,y;return e[9]!==o||e[10]!==_||e[11]!==g?(p=Ae("shadow-sm border border-border rounded transition-all duration-200 overflow-hidden divide-x divide-border flex",_,g,o),e[9]=o,e[10]=_,e[11]=g,e[12]=p):p=e[12],e[13]!==m?(b=m(),e[13]=m,e[14]=b):b=e[14],e[15]!==p||e[16]!==b?(y=u.jsx("div",{className:"flex justify-center mt-4 pt-6 pb-32 group gap-4 w-full print:hidden",children:u.jsx("div",{className:p,children:b})}),e[15]=p,e[16]=b,e[17]=y):y=e[17],y};function lO(){N4()}const cO=SV(CV,400),dO=(t,e)=>{ct.get(Us)||t.isEmpty()||e.isEmpty()||ha(t.inOrderIds,e.inOrderIds)||cO({cell_ids:t.inOrderIds})},Yx=t=>{const e=K.c(65),{userConfig:n,appConfig:o,hideControls:r}=t,s=r!==void 0&&r;NV(cS,dO);const{setCells:i,mergeAllColumns:a,collapseAllCells:l,expandAllCells:c}=Ot(),d=$e(hm),h=$e(jV),f=$e(EV),m=jm(),_=en(Ad),g=d.mode==="edit",p=d.mode==="present",b=$e(IV);let y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[0]=y):y=e[0],T.useEffect(hO,y);const x=n.runtime.auto_instantiate;let k,C,v;e[1]!==i||e[2]!==_?(k=(he,pe)=>{i(he);const ce=he.map(fO),fe=he.map(mO),de=he.map(pO);_({names:ce,codes:fe,configs:de,layout:pe})},e[1]=i,e[2]=_,e[3]=k):k=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(C=W4(),e[4]=C):C=e[4],e[5]!==k||e[6]!==n.runtime.auto_instantiate?(v={autoInstantiate:x,setCells:k,sessionId:C},e[5]=k,e[6]=n.runtime.auto_instantiate,e[7]=v):v=e[7];const{connection:E}=MH(v);let N,I;e[8]!==o.app_title||e[9]!==m?(N=()=>{document.title=o.app_title||Tn.basename(m??"")||"Untitled Notebook"},I=[o.app_title,m],e[8]=o.app_title,e[9]=m,e[10]=N,e[11]=I):(N=e[10],I=e[11]),T.useEffect(N,I);const A=Oc(o.width);let M,R;e[12]!==o.width||e[13]!==a||e[14]!==A?(M=()=>{A==="columns"&&o.width!=="columns"&&a()},e[12]=o.width,e[13]=a,e[14]=A,e[15]=M):M=e[15],e[16]!==o.width||e[17]!==a||e[18]!==h||e[19]!==A?(R=[o.width,A,a,h],e[16]=o.width,e[17]=a,e[18]=h,e[19]=A,e[20]=R):R=e[20],T.useEffect(M,R);const z=function(){const he=K.c(2),pe=_d();let ce;return he[0]!==pe?(ce=()=>pe(pz(Wn())),he[0]=pe,he[1]=ce):ce=he[1],nt(ce)}(),D=lg(),F=ag();let B,U,O,S,$,j;e[21]!==z?(B=()=>{z()},e[21]=z,e[22]=B):B=e[22],Jt("global.runStale",B),Jt("global.interrupt",gO),e[23]!==F?(U=()=>{F()},e[23]=F,e[24]=U):U=e[24],Jt("global.hideCode",U),e[25]!==D?(O=()=>{D()},e[25]=D,e[26]=O):O=e[26],Jt("global.runAll",O),e[27]!==l?(S=()=>{l()},e[27]=l,e[28]=S):S=e[28],Jt("global.collapseAllSections",S),e[29]!==c?($=()=>{c()},e[29]=c,e[30]=$):$=e[30],Jt("global.expandAllSections",$),e[31]!==o||e[32]!==E||e[33]!==n||e[34]!==d.mode?(j=u.jsx(rO,{connStatus:E,mode:d.mode,userConfig:n,appConfig:o}),e[31]=o,e[32]=E,e[33]=n,e[34]=d.mode,e[35]=j):j=e[35];const W=j,X=o.width;let Y,q,ne,re,ae,Z,Q;return e[36]===Symbol.for("react.memo_cache_sentinel")?(Y=Ae("pt-4 sm:pt-12 pb-2 mb-4 print:hidden z-50","sticky left-0"),e[36]=Y):Y=e[36],e[37]!==m||e[38]!==g?(q=g&&u.jsx("div",{className:"flex items-center justify-center container",children:u.jsx(ij,{filename:m})}),e[37]=m,e[38]=g,e[39]=q):q=e[39],e[40]!==E||e[41]!==q?(ne=u.jsx(DH,{connection:E,className:Y,children:q}),e[40]=E,e[41]=q,e[42]=ne):ne=e[42],e[43]!==o||e[44]!==W||e[45]!==f||e[46]!==d.mode?(re=f&&u.jsx(OH,{appConfig:o,mode:d.mode,children:W}),e[43]=o,e[44]=W,e[45]=f,e[46]=d.mode,e[47]=re):re=e[47],e[48]!==o.width||e[49]!==E||e[50]!==b||e[51]!==ne||e[52]!==re?(ae=u.jsxs(RH,{connection:E,isRunning:b,width:X,children:[ne,re]}),e[48]=o.width,e[49]=E,e[50]=b,e[51]=ne,e[52]=re,e[53]=ae):ae=e[53],e[54]!==o||e[55]!==E||e[56]!==s||e[57]!==p||e[58]!==b||e[59]!==z||e[60]!==F?(Z=!s&&u.jsx(Gc,{children:u.jsx(tj,{presenting:p,onTogglePresenting:F,onInterrupt:Lm,onRun:z,connectionState:E.state,running:b,appConfig:o})}),e[54]=o,e[55]=E,e[56]=s,e[57]=p,e[58]=b,e[59]=z,e[60]=F,e[61]=Z):Z=e[61],e[62]!==ae||e[63]!==Z?(Q=u.jsxs(u.Fragment,{children:[ae,Z]}),e[62]=ae,e[63]=Z,e[64]=Q):Q=e[64],Q};function uO(){XS.INSTANCE.stop()}function hO(){return XS.INSTANCE.start(AV),uO}function fO(t){return t.name}function mO(t){return t.code}function pO(t){return t.config}function gO(){Lm()}const Jx=t=>$e(TV)[t.capability]?t.children:null,Qn=T.forwardRef((t,e)=>{const n=K.c(18);let o,r,s,i,a;n[0]!==t?({children:o,tooltip:a,selected:i,className:r,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=i,n[5]=a):(o=n[1],r=n[2],s=n[3],i=n[4],a=n[5]);const l=!i&&"hover:bg-[var(--sage-3)]",c=i&&"bg-[var(--sage-4)]";let d,h;n[6]!==r||n[7]!==l||n[8]!==c?(d=Ae("h-full flex items-center p-2 text-sm shadow-inset font-mono cursor-pointer rounded",l,c,r),n[6]=r,n[7]=l,n[8]=c,n[9]=d):d=n[9],n[10]!==o||n[11]!==e||n[12]!==s||n[13]!==d?(h=u.jsx("div",{ref:e,className:d,...s,children:o}),n[10]=o,n[11]=e,n[12]=s,n[13]=d,n[14]=h):h=n[14];const f=h;if(a){let m;return n[15]!==f||n[16]!==a?(m=u.jsx(Te,{content:a,side:"top",delayDuration:200,children:f}),n[15]=f,n[16]=a,n[17]=m):m=n[17],m}return f});Qn.displayName="FooterItem";const _O=()=>{var d;const t=K.c(14),e=$e(dS),n=$e(hc),o=((d=e==null?void 0:e.open_ai)==null?void 0:d.model)||"gpt-4-turbo",{handleClick:r}=Sa();if(!n){let h,f,m;return t[0]!==r?(h=()=>r("ai"),t[0]=r,t[1]=h):h=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(sa,{className:"h-4 w-4 opacity-60"}),t[2]=f):f=t[2],t[3]!==h?(m=u.jsx(Qn,{tooltip:"Assist is disabled",selected:!1,onClick:h,"data-testid":"footer-ai-disabled",children:f}),t[3]=h,t[4]=m):m=t[4],m}let s,i,a,l,c;return t[5]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx("b",{children:"Assist model:"}),t[5]=s):s=t[5],t[6]!==o?(i=u.jsxs(u.Fragment,{children:[s," ",o]}),t[6]=o,t[7]=i):i=t[7],t[8]!==r?(a=()=>r("ai"),t[8]=r,t[9]=a):a=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(sa,{className:"h-4 w-4"}),t[10]=l):l=t[10],t[11]!==i||t[12]!==a?(c=u.jsx(Qn,{tooltip:i,onClick:a,selected:!1,"data-testid":"footer-ai-enabled",children:l}),t[11]=i,t[12]=a,t[13]=c):c=t[13],c},bO=()=>{const t=K.c(26),e=$e(mn).state,n=Gm();let o,r;t[0]!==e||t[1]!==n?(o=async()=>{if(e===Vt.OPEN){if(In())return{isHealthy:!0,lastChecked:new Date,error:void 0};try{return{isHealthy:await n.isHealthy(),lastChecked:new Date,error:void 0}}catch(k){const C=k;return{isHealthy:!1,lastChecked:new Date,error:C instanceof Error?C.message:"Unknown error"}}}},r=[n,e],t[0]=e,t[1]=n,t[2]=o,t[3]=r):(o=t[2],r=t[3]);const{isFetching:s,error:i,data:a,refetch:l}=Gn(o,r),c=e===Vt.OPEN?3e4:null;let d,h;t[4]!==c?(d={delayMs:c,whenVisible:!0},t[4]=c,t[5]=d):d=t[5],ka(l,d),t[6]!==e||t[7]!==a||t[8]!==i?(h=()=>[Nm(e.toLowerCase()),a!=null&&a.lastChecked?a.isHealthy?"\u2713 Healthy":"\u2717 Unhealthy":"Health: Unknown",i?`Error: ${i}`:""].filter(Boolean).join(`
|
125
|
+
`),t[6]=e,t[7]=a,t[8]=i,t[9]=h):h=t[9];const f=h;let m;t[10]!==e||t[11]!==(a==null?void 0:a.isHealthy)||t[12]!==(a==null?void 0:a.lastChecked)||t[13]!==s?(m=()=>s||e===Vt.CONNECTING?u.jsx(Kn,{size:"small"}):e===Vt.CLOSING?u.jsx(Kn,{className:"text-destructive",size:"small"}):e===Vt.OPEN?a!=null&&a.isHealthy?u.jsx(td,{className:"w-4 h-4 text-[var(--green-9)]"}):a!=null&&a.lastChecked?u.jsx(aS,{className:"w-4 h-4 text-[var(--yellow-9)]"}):u.jsx(td,{className:"w-4 h-4"}):u.jsx(lp,{className:"w-4 h-4 text-red-500"}),t[10]=e,t[11]=a==null?void 0:a.isHealthy,t[12]=a==null?void 0:a.lastChecked,t[13]=s,t[14]=m):m=t[14];const _=m,g=f();let p,b,y,x;return t[15]!==e?(p=e===Vt.OPEN&&u.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Click to refresh health status"}),t[15]=e,t[16]=p):p=t[16],t[17]!==g||t[18]!==p?(b=u.jsxs("div",{className:"text-sm whitespace-pre-line",children:[g,p]}),t[17]=g,t[18]=p,t[19]=b):b=t[19],t[20]!==_?(y=_(),t[20]=_,t[21]=y):y=t[21],t[22]!==l||t[23]!==b||t[24]!==y?(x=u.jsx(Qn,{tooltip:b,selected:!1,onClick:l,"data-testid":"footer-backend-status",children:y}),t[22]=l,t[23]=b,t[24]=y,t[25]=x):x=t[25],x},yO=t=>{const e=K.c(3);let n,o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=u.jsx("path",{d:"M205.28 31.36c14.096 14.88 20.016 35.2 22.512 63.68c6.626 0 12.805 1.47 16.976 7.152l7.792 10.56A17.55 17.55 0 0 1 256 123.2v28.688c-.008 3.704-1.843 7.315-4.832 9.504C215.885 187.222 172.35 208 128 208c-49.066 0-98.19-28.273-123.168-46.608c-2.989-2.189-4.825-5.8-4.832-9.504V123.2c0-3.776 1.2-7.424 3.424-10.464l7.792-10.544c4.173-5.657 10.38-7.152 16.992-7.152c2.496-28.48 8.4-48.8 22.512-63.68C77.331 3.165 112.567.06 127.552 0H128c14.72 0 50.4 2.88 77.28 31.36m-77.264 47.376c-3.04 0-6.544.176-10.272.544c-1.312 4.896-3.248 9.312-6.08 12.128c-11.2 11.2-24.704 12.928-31.936 12.928c-6.802 0-13.927-1.42-19.744-5.088c-5.502 1.808-10.786 4.415-11.136 10.912c-.586 12.28-.637 24.55-.688 36.824c-.026 6.16-.05 12.322-.144 18.488c.024 3.579 2.182 6.903 5.44 8.384C79.936 185.92 104.976 192 128.016 192c23.008 0 48.048-6.08 74.512-18.144c3.258-1.48 5.415-4.805 5.44-8.384c.317-18.418.062-36.912-.816-55.312h.016c-.342-6.534-5.648-9.098-11.168-10.912c-5.82 3.652-12.927 5.088-19.728 5.088c-7.232 0-20.72-1.728-31.936-12.928c-2.832-2.816-4.768-7.232-6.08-12.128a106 106 0 0 0-10.24-.544m-26.941 43.93c5.748 0 10.408 4.66 10.408 10.409v19.183c0 5.749-4.66 10.409-10.408 10.409s-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408m53.333 0c5.749 0 10.409 4.66 10.409 10.409v19.183c0 5.749-4.66 10.409-10.409 10.409c-5.748 0-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408M81.44 28.32c-11.2 1.12-20.64 4.8-25.44 9.92c-10.4 11.36-8.16 40.16-2.24 46.24c4.32 4.32 12.48 7.2 21.28 7.2c6.72 0 19.52-1.44 30.08-12.16c4.64-4.48 7.52-15.68 7.2-27.04c-.32-9.12-2.88-16.64-6.72-19.84c-4.16-3.68-13.6-5.28-24.16-4.32m68.96 4.32c-3.84 3.2-6.4 10.72-6.72 19.84c-.32 11.36 2.56 22.56 7.2 27.04c10.56 10.72 23.36 12.16 30.08 12.16c8.8 0 16.96-2.88 21.28-7.2c5.92-6.08 8.16-34.88-2.24-46.24c-4.8-5.12-14.24-8.8-25.44-9.92c-10.56-.96-20 .64-24.16 4.32M128 56c-2.56 0-5.6.16-8.96.48c.32 1.76.48 3.68.64 5.76c0 1.44 0 2.88-.16 4.48c3.2-.32 5.92-.32 8.48-.32s5.28 0 8.48.32c-.16-1.6-.16-3.04-.16-4.48c.16-2.08.32-4 .64-5.76c-3.36-.32-6.4-.48-8.96-.48"}),e[0]=n):n=e[0],e[1]!==t?(o=u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.24em",height:"1em",viewBox:"0 0 256 208",fill:"currentColor",...t,children:n}),e[1]=t,e[2]=o):o=e[2],o},xO=Gt(t=>t(MV).completion.copilot),wO=()=>{const t=K.c(1);if($e(xO)==="github"){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(vO,{}),t[0]=e):e=t[0],e}return null},Kx=Dt.get("[copilot-status-bar]"),vO=()=>{const t=$e(zS),e=$e(gH)!==null,{handleClick:n}=Sa(),o=()=>n("ai"),r=t?"Ready":"Not connected",s=en(zS),i=en(_H);return lS(()=>{const a=FS();let l=!0;return(async()=>{try{if(await a.initializePromise.catch(d=>{throw Kx.error("Failed to initialize",d),a.close(),d}),!l)return;const c=await a.signedIn();if(!l)return;s(c),i(c?"signedIn":"signedOut")}catch(c){if(!l)return;Kx.warn("Connection failed",c),s(!1),i("connectionError"),ut({title:"GitHub Copilot Connection Error",description:"Failed to connect to GitHub Copilot. Check settings and try again.",variant:"danger",action:u.jsx(De,{variant:"link",onClick:o,children:"Settings"})})}})(),()=>{l=!1}}),u.jsx(Qn,{tooltip:u.jsxs(u.Fragment,{children:[u.jsx("b",{children:"GitHub Copilot:"})," ",r]}),selected:!1,onClick:o,"data-testid":"footer-copilot-status",children:u.jsx("span",{children:e?u.jsx(Kn,{className:"h-4 w-4"}):u.jsx(yO,{className:Ae("h-4 w-4",!t&&"opacity-60")})})})},kO=t=>{const e=K.c(17),[n,o]=T.useState(0),r=$e(mn);let s,i,a,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>o(jO),i={delayMs:1e4,whenVisible:!0},e[0]=s,e[1]=i):(s=e[0],i=e[1]),ka(s,i),e[2]!==r.state?(a=async()=>In()||r.state!==Vt.OPEN?null:OV(),e[2]=r.state,e[3]=a):a=e[3],e[4]!==r.state||e[5]!==n?(l=[n,r.state],e[4]=r.state,e[5]=n,e[6]=l):l=e[6];const{data:c}=Gn(a,l);let d,h,f,m;return e[7]!==c?(d=(c==null?void 0:c.gpu)&&c.gpu.length>0&&u.jsx(NO,{gpus:c.gpu}),e[7]=c,e[8]=d):d=e[8],e[9]!==c?(h=c&&u.jsx(SO,{memory:c.memory,kernel:c.kernel,server:c.server}),e[9]=c,e[10]=h):h=e[10],e[11]!==c?(f=c&&u.jsx(CO,{cpu:c.cpu}),e[11]=c,e[12]=f):f=e[12],e[13]!==d||e[14]!==h||e[15]!==f?(m=u.jsxs("div",{className:"flex gap-2 items-center px-1",children:[d,h,f]}),e[13]=d,e[14]=h,e[15]=f,e[16]=m):m=e[16],m},SO=t=>{const e=K.c(25),{memory:n,kernel:o,server:r}=t,{percent:s,total:i,available:a}=n;let l;e[0]!==s?(l=Math.round(s),e[0]=s,e[1]=l):l=e[1];const c=l;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx("b",{children:"computer memory:"}),e[2]=d):d=e[2];const h=i-a;let f,m,_,g,p,b,y,x,k;return e[3]!==h?(f=oh(h),e[3]=h,e[4]=f):f=e[4],e[5]!==i?(m=oh(i),e[5]=i,e[6]=m):m=e[6],e[7]!==c||e[8]!==f||e[9]!==m?(_=u.jsxs("span",{children:[d," ",f," / ",m," GB (",c,"%)"]}),e[7]=c,e[8]=f,e[9]=m,e[10]=_):_=e[10],e[11]!==r?(g=(r==null?void 0:r.memory)&&u.jsxs("span",{children:[u.jsx("b",{children:"marimo server:"})," ",Tl(r.memory)]}),e[11]=r,e[12]=g):g=e[12],e[13]!==o?(p=(o==null?void 0:o.memory)&&u.jsxs("span",{children:[u.jsx("b",{children:"kernel:"})," ",Tl(o.memory)]}),e[13]=o,e[14]=p):p=e[14],e[15]!==_||e[16]!==g||e[17]!==p?(b=u.jsxs("div",{className:"flex flex-col gap-1",children:[_,g,p]}),e[15]=_,e[16]=g,e[17]=p,e[18]=b):b=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?(y=u.jsx(Fp,{className:"w-4 h-4"}),e[19]=y):y=e[19],e[20]!==c?(x=u.jsxs("div",{className:"flex items-center gap-1","data-testid":"memory-usage-bar",children:[y,u.jsx(nh,{percent:c,colorClassName:"bg-primary"})]}),e[20]=c,e[21]=x):x=e[21],e[22]!==x||e[23]!==b?(k=u.jsx(Te,{delayDuration:200,content:b,children:x}),e[22]=x,e[23]=b,e[24]=k):k=e[24],k},CO=t=>{const e=K.c(11),{cpu:n}=t,{percent:o}=n;let r;e[0]!==o?(r=Math.round(o),e[0]=o,e[1]=r):r=e[1];const s=r;let i,a,l,c,d;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx("b",{children:"CPU:"}),e[2]=i):i=e[2],e[3]!==s?(a=u.jsxs("span",{children:[i," ",s,"%"]}),e[3]=s,e[4]=a):a=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(bH,{className:"w-4 h-4"}),e[5]=l):l=e[5],e[6]!==s?(c=u.jsxs("div",{className:"flex items-center gap-1","data-testid":"cpu-bar",children:[l,u.jsx(nh,{percent:s,colorClassName:"bg-primary"})]}),e[6]=s,e[7]=c):c=e[7],e[8]!==a||e[9]!==c?(d=u.jsx(Te,{delayDuration:200,content:a,children:c}),e[8]=a,e[9]=c,e[10]=d):d=e[10],d},NO=t=>{const e=K.c(12),{gpus:n}=t;let o;e[0]!==n?(o=Math.round(n.reduce(EO,0)/n.length),e[0]=n,e[1]=o):o=e[1];const r=o;let s,i,a,l,c;return e[2]!==n?(s=n.map(IO),e[2]=n,e[3]=s):s=e[3],e[4]!==s?(i=u.jsx("div",{className:"flex flex-col gap-1",children:s}),e[4]=s,e[5]=i):i=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(Bp,{className:"w-4 h-4"}),e[6]=a):a=e[6],e[7]!==r?(l=u.jsxs("div",{className:"flex items-center gap-1","data-testid":"gpu-bar",children:[a,u.jsx(nh,{percent:r,colorClassName:"bg-[var(--grass-9)]"})]}),e[7]=r,e[8]=l):l=e[8],e[9]!==i||e[10]!==l?(c=u.jsx(Te,{delayDuration:200,content:i,children:l}),e[9]=i,e[10]=l,e[11]=c):c=e[11],c},nh=t=>{const e=K.c(7),{percent:n,colorClassName:o}=t;let r;e[0]!==o?(r=Ae("h-full bg-primary",o),e[0]=o,e[1]=r):r=e[1];const s=`${n}%`;let i,a;return e[2]!==s?(i={width:s},e[2]=s,e[3]=i):i=e[3],e[4]!==r||e[5]!==i?(a=u.jsx("div",{className:"h-3 w-20 bg-[var(--slate-4)] rounded-lg overflow-hidden border",children:u.jsx("div",{className:r,style:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a};function Tl(t){return t>1073741824?`${oh(t)} GB`:`${function(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(e/1048576)}(t)} MB`}function oh(t){return new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(t/1073741824)}function jO(t){return t+1}function EO(t,e){return t+e.memory.percent}function IO(t){return u.jsxs("span",{children:[u.jsxs("b",{children:["GPU ",t.index," (",t.name,"):"]})," ",Tl(t.memory.used)," / ",Tl(t.memory.total)," GB (",Math.round(t.memory.percent),"%)"]},t.index)}const AO=()=>{const t=K.c(13),e=$e(ss),[n,o]=an(q4),[r,s]=T.useState(!1);if(!Vc()||e==="disabled")return null;const i=e?"Real-time collaboration active":"Connecting to real-time collaboration";let a,l,c,d,h,f;return t[0]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(rg,{className:"w-4 h-4"}),t[0]=a):a=t[0],t[1]!==i?(l=u.jsx(ti,{asChild:!0,children:u.jsx(Qn,{tooltip:i,selected:!1,"data-testid":"footer-rtc-status",children:a})}),t[1]=i,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsxs("div",{className:"space-y-2",children:[u.jsx("h4",{className:"font-medium leading-none",children:"Username"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Set your username for real-time collaboration"})]}),t[3]=c):c=t[3],t[4]!==o?(d=m=>o(m.target.value),t[4]=o,t[5]=d):d=t[5],t[6]!==d||t[7]!==n?(h=u.jsx(Js,{className:"w-80",children:u.jsxs("div",{className:"space-y-4",children:[c,u.jsx(lr,{value:n,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",onChange:d,placeholder:"Enter your username"})]})}),t[6]=d,t[7]=n,t[8]=h):h=t[8],t[9]!==r||t[10]!==l||t[11]!==h?(f=u.jsxs(Ur,{open:r,onOpenChange:s,children:[l,h]}),t[9]=r,t[10]=l,t[11]=h,t[12]=f):f=t[12],f},TO=()=>{const t=K.c(56),{selectedPanel:e,isTerminalOpen:n}=Sc(),{toggleApplication:o,toggleTerminal:r}=da(),[s,i]=$s(),a=$e(DV),l=MO,c=bd.find(OO);let d;zo(c,"Error panel not found"),t[0]!==r?(d=()=>{r()},t[0]=r,t[1]=d):d=t[1],Jt("global.toggleTerminal",d);const h=Qn,f=c.tooltip,m=e===c.type,_=()=>o(c.type),g=l(c,a>0?"text-destructive":"");let p,b,y,x,k;t[2]!==a?(p=u.jsx("span",{className:"ml-1 font-mono mt-[0.125rem]",children:a}),t[2]=a,t[3]=p):p=t[3],t[4]!==h||t[5]!==c||t[6]!==m||t[7]!==_||t[8]!==g||t[9]!==p?(b=u.jsxs(h,{tooltip:f,selected:m,onClick:_,"data-testid":"footer-errors",children:[g,p]}),t[4]=h,t[5]=c,t[6]=m,t[7]=_,t[8]=g,t[9]=p,t[10]=b):b=t[10],t[11]!==r?(y=()=>r(),t[11]=r,t[12]=y):y=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(x=u.jsx(ng,{className:"h-5 w-5"}),t[13]=x):x=t[13],t[14]!==n||t[15]!==y?(k=u.jsx(Jx,{capability:"terminal",children:u.jsx(Qn,{tooltip:"Open terminal",selected:n,onClick:y,"data-testid":"footer-terminal",children:x})}),t[14]=n,t[15]=y,t[16]=k):k=t[16];const C=s.runtime.auto_instantiate?"Disable autorun on startup":"Enable autorun on startup";let v,E,N;t[17]!==s||t[18]!==i?(v=async()=>{const q={...s,runtime:{...s.runtime,auto_instantiate:!s.runtime.auto_instantiate}};await zr({config:q}).then(()=>i(q))},t[17]=s,t[18]=i,t[19]=v):v=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(E=u.jsx("span",{children:"on startup: "}),t[20]=E):E=t[20],t[21]!==s.runtime.auto_instantiate?(N=s.runtime.auto_instantiate?u.jsx(wr,{size:14}):u.jsx(xr,{size:14}),t[21]=s.runtime.auto_instantiate,t[22]=N):N=t[22];const I=s.runtime.auto_instantiate?"autorun":"lazy";let A,M,R,z;t[23]!==I?(A=u.jsx("span",{children:I}),t[23]=I,t[24]=A):A=t[24],t[25]!==N||t[26]!==A?(M=u.jsxs("div",{className:"font-prose text-sm flex items-center gap-1",children:[E,N,A]}),t[25]=N,t[26]=A,t[27]=M):M=t[27],t[28]!==C||t[29]!==v||t[30]!==M?(R=u.jsx(Qn,{tooltip:C,selected:!1,onClick:v,"data-testid":"footer-autorun-startup",children:M}),t[28]=C,t[29]=v,t[30]=M,t[31]=R):R=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(z=u.jsx("div",{className:"border-r border-border h-6 mx-1"}),t[32]=z):z=t[32];const D=s.runtime.on_cell_change==="autorun"?"Disable autorun":"Enable autorun";let F,B,U,O,S,$,j,W,X,Y;return t[33]!==s||t[34]!==i?(F=async()=>{const q={...s,runtime:{...s.runtime,on_cell_change:s.runtime.on_cell_change==="autorun"?"lazy":"autorun"}};await zr({config:q}).then(()=>i(q))},t[33]=s,t[34]=i,t[35]=F):F=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(B=u.jsx("span",{children:"on cell change: "}),t[36]=B):B=t[36],t[37]!==s.runtime.on_cell_change?(U=u.jsxs("div",{className:"font-prose text-sm flex items-center gap-1",children:[B,s.runtime.on_cell_change==="autorun"?u.jsx(wr,{size:14}):u.jsx(xr,{size:14}),u.jsx("span",{children:s.runtime.on_cell_change})]}),t[37]=s.runtime.on_cell_change,t[38]=U):U=t[38],t[39]!==D||t[40]!==F||t[41]!==U?(O=u.jsx(Qn,{tooltip:D,selected:!1,onClick:F,"data-testid":"footer-autorun-cell-change",children:U}),t[39]=D,t[40]=F,t[41]=U,t[42]=O):O=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(S=u.jsx("div",{className:"border-r border-border h-6 mx-1"}),t[43]=S):S=t[43],t[44]!==s||t[45]!==i?($=!In()&&u.jsx(Qn,{tooltip:null,selected:!1,"data-testid":"footer-module-reload",children:u.jsxs(Hs,{children:[u.jsxs(Ws,{className:"font-prose text-sm flex items-center gap-1",children:[u.jsx("span",{children:"on module change: "}),s.runtime.auto_reload==="off"&&u.jsx(lp,{size:14}),s.runtime.auto_reload==="lazy"&&u.jsx(xr,{size:14}),s.runtime.auto_reload==="autorun"&&u.jsx(wr,{size:14}),u.jsx("span",{children:s.runtime.auto_reload}),u.jsx(Vs,{size:14})]}),u.jsx(qs,{children:["off","lazy","autorun"].map(q=>u.jsxs(Yt,{onClick:async()=>{const ne={...s,runtime:{...s.runtime,auto_reload:q}};await zr({config:ne}).then(()=>i(ne))},children:[q==="off"&&u.jsx(lp,{size:14,className:"mr-2 text-muted-foreground"}),q==="lazy"&&u.jsx(xr,{size:14,className:"mr-2 text-muted-foreground"}),q==="autorun"&&u.jsx(wr,{size:14,className:"mr-2 text-muted-foreground"}),q]},q))})]})}),t[44]=s,t[45]=i,t[46]=$):$=t[46],t[47]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx("div",{className:"mx-auto"}),t[47]=j):j=t[47],t[48]===Symbol.for("react.memo_cache_sentinel")?(W=u.jsx(ZN,{children:u.jsx(Te,{content:u.jsx("div",{className:"w-[200px]",children:"Kiosk mode is enabled. This allows you to view the outputs of the cells without the ability to edit them."}),children:u.jsx("span",{className:"text-muted-foreground text-sm mr-4",children:"kiosk mode"})})}),t[48]=W):W=t[48],t[49]===Symbol.for("react.memo_cache_sentinel")?(X=u.jsxs("div",{className:"flex items-center",children:[u.jsx(kO,{}),u.jsx(_O,{}),u.jsx(wO,{}),u.jsx(AO,{}),u.jsx(bO,{})]}),t[49]=X):X=t[49],t[50]!==k||t[51]!==R||t[52]!==O||t[53]!==$||t[54]!==b?(Y=u.jsxs("footer",{className:"h-10 py-2 bg-background flex items-center text-muted-foreground text-md px-1 border-t border-border select-none no-print text-sm shadow-[0_0_4px_1px_rgba(0,0,0,0.1)] z-50 print:hidden hide-on-fullscreen",children:[b,k,R,z,O,S,$,j,W,X]}),t[50]=k,t[51]=R,t[52]=O,t[53]=$,t[54]=b,t[55]=Y):Y=t[55],Y};function MO(t,e){const{Icon:n}=t;return u.jsx(n,{className:Ae("h-5 w-5",e)})}function OO(t){return t.type==="errors"}const DO=t=>{const e=K.c(6),{children:n}=t,{openModal:o,closeModal:r}=qn();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(u.jsx(RO,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=u.jsx(uS,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},RO=t=>{const e=K.c(9),{onClose:n}=t;let o,r,s,i,a,l,c;return e[0]!==n?(o=async d=>{d.preventDefault();const h=new FormData(d.target),f=h.get("rating"),m=h.get("message");fetch("https://marimo.io/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rating:f,message:m})}),n(),ut({title:"Feedback sent!",description:"Thank you for your feedback!"})},e[0]=n,e[1]=o):o=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(ar,{children:"Send Feedback"}),e[2]=r):r=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We want to hear from you \u2014 from minor bug reports to wishlist features and everything in between. Here are some ways you can get in touch:"}),e[3]=s):s=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsxs("li",{className:"my-0",children:["Take our"," ",u.jsx("a",{href:no.feedbackForm,target:"_blank",className:"underline",children:"two-minute survey."})]}),e[4]=i):i=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsxs("li",{className:"my-0",children:["File a"," ",u.jsx("a",{href:no.issuesPage,target:"_blank",className:"underline",children:"GitHub issue."})]}),e[5]=a):a=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsxs(Ls,{children:[r,u.jsxs(Fs,{children:[s,u.jsxs("ul",{className:"list-disc ml-8 my-2 prose dark:prose-invert",children:[i,a,u.jsxs("li",{className:"my-0",children:["Chat with us on"," ",u.jsx("a",{href:no.discordLink,target:"_blank",className:"underline",children:"Discord."})]})]}),u.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We're excited you're here as we build the future of Python data tooling. Thanks for being part of our community!"})]})]}),e[6]=l):l=e[6],e[7]!==o?(c=u.jsx(cr,{className:"w-fit",children:u.jsx("form",{onSubmit:o,children:l})}),e[7]=o,e[8]=c):c=e[8],c},PO=()=>{const t=K.c(10),{selectedPanel:e}=Sc(),{toggleApplication:n}=da(),o=FO;let r,s,i,a,l,c;return t[0]!==e||t[1]!==n?(r="h-full pt-4 pb-1 px-1 flex flex-col items-start text-muted-foreground text-md select-none no-print text-sm z-50 dark:bg-background print:hidden hide-on-fullscreen",s=bd.filter(zO).map(d=>u.jsx(Xx,{tooltip:d.tooltip,selected:e===d.type,onClick:()=>n(d.type),children:o(d)},d.type)),t[0]=e,t[1]=n,t[2]=r,t[3]=s):(r=t[2],s=t[3]),t[4]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(DO,{children:u.jsx(Xx,{tooltip:"Send feedback!",selected:!1,children:u.jsx(zp,{className:"h-5 w-5"})})}),a=u.jsx("div",{className:"flex-1"}),l=u.jsx(LO,{}),t[4]=i,t[5]=a,t[6]=l):(i=t[4],a=t[5],l=t[6]),t[7]!==r||t[8]!==s?(c=u.jsxs("div",{className:r,children:[s,i,a,l]}),t[7]=r,t[8]=s,t[9]=c):c=t[9],c},LO=()=>{const t=K.c(7),e=$e(RV);let n,o,r;return t[0]!==e?(n=e>0?u.jsxs("span",{children:[e," cell",e>1?"s":""," queued or running"]}):"No cells queued or running",t[0]=e,t[1]=n):n=t[1],t[2]!==e?(o=u.jsx("div",{className:"flex flex-col-reverse gap-[1px] overflow-hidden",children:Array.from({length:e}).map(BO)}),t[2]=e,t[3]=o):o=t[3],t[4]!==n||t[5]!==o?(r=u.jsx(Te,{content:n,side:"right",delayDuration:200,children:o}),t[4]=n,t[5]=o,t[6]=r):r=t[6],r},Xx=t=>{const e=K.c(17);let n,o,r,s,i;e[0]!==t?({children:n,tooltip:i,selected:s,className:o,...r}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s,e[5]=i):(n=e[1],o=e[2],r=e[3],s=e[4],i=e[5]);const a=!s&&"hover:bg-[var(--sage-3)]",l=s&&"bg-[var(--sage-4)]";let c,d,h;return e[6]!==o||e[7]!==a||e[8]!==l?(c=Ae("flex items-center p-2 text-sm mx-[1px] shadow-inset font-mono cursor-pointer rounded",a,l,o),e[6]=o,e[7]=a,e[8]=l,e[9]=c):c=e[9],e[10]!==n||e[11]!==r||e[12]!==c?(d=u.jsx("div",{className:c,...r,children:n}),e[10]=n,e[11]=r,e[12]=c,e[13]=d):d=e[13],e[14]!==d||e[15]!==i?(h=u.jsx(Te,{content:i,side:"right",delayDuration:200,children:d}),e[14]=d,e[15]=i,e[16]=h):h=e[16],h};function FO(t,e){const{Icon:n}=t;return u.jsx(n,{className:Ae("h-5 w-5",e)})}function zO(t){return!t.hidden&&t.position==="sidebar"}function BO(t,e){return u.jsx("div",{className:"flex-shrink-0 h-1 w-2 bg-[var(--grass-6)] border border-[var(--grass-7)]"},e.toString())}var rh="ScrollArea",[Zx,JH]=z4(rh),[UO,zn]=Zx(rh),Qx=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:o="hover",dir:r,scrollHideDelay:s=600,...i}=t,[a,l]=T.useState(null),[c,d]=T.useState(null),[h,f]=T.useState(null),[m,_]=T.useState(null),[g,p]=T.useState(null),[b,y]=T.useState(0),[x,k]=T.useState(0),[C,v]=T.useState(!1),[E,N]=T.useState(!1),I=oi(e,M=>l(M)),A=PV(r);return u.jsx(UO,{scope:n,type:o,dir:A,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:d,content:h,onContentChange:f,scrollbarX:m,onScrollbarXChange:_,scrollbarXEnabled:C,onScrollbarXEnabledChange:v,scrollbarY:g,onScrollbarYChange:p,scrollbarYEnabled:E,onScrollbarYEnabledChange:N,onCornerWidthChange:y,onCornerHeightChange:k,children:u.jsx(ei.div,{dir:A,...i,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":x+"px",...t.style}})})});Qx.displayName=rh;var ew="ScrollAreaViewport",tw=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:o,nonce:r,...s}=t,i=zn(ew,n),a=T.useRef(null),l=oi(e,a,i.onViewportChange);return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),u.jsx(ei.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...t.style},children:u.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});tw.displayName=ew;var co="ScrollAreaScrollbar",sh=T.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=zn(co,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=r,a=t.orientation==="horizontal";return T.useEffect(()=>(a?s(!0):i(!0),()=>{a?s(!1):i(!1)}),[a,s,i]),r.type==="hover"?u.jsx(VO,{...o,ref:e,forceMount:n}):r.type==="scroll"?u.jsx($O,{...o,ref:e,forceMount:n}):r.type==="auto"?u.jsx(nw,{...o,ref:e,forceMount:n}):r.type==="always"?u.jsx(ih,{...o,ref:e}):null});sh.displayName=co;var VO=T.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=zn(co,t.__scopeScrollArea),[s,i]=T.useState(!1);return T.useEffect(()=>{const a=r.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),i(!0)},d=()=>{l=window.setTimeout(()=>i(!1),r.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",d)}}},[r.scrollArea,r.scrollHideDelay]),u.jsx(Yc,{present:n||s,children:u.jsx(nw,{"data-state":s?"visible":"hidden",...o,ref:e})})}),$O=T.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=zn(co,t.__scopeScrollArea),s=t.orientation==="horizontal",i=Rl(()=>l("SCROLL_END"),100),[a,l]=function(c,d){return T.useReducer((h,f)=>d[h][f]??h,c)}("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return T.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,r.scrollHideDelay,l]),T.useEffect(()=>{const c=r.viewport,d=s?"scrollLeft":"scrollTop";if(c){let h=c[d];const f=()=>{const m=c[d];h!==m&&(l("SCROLL"),i()),h=m};return c.addEventListener("scroll",f),()=>c.removeEventListener("scroll",f)}},[r.viewport,s,l,i]),u.jsx(Yc,{present:n||a!=="hidden",children:u.jsx(ih,{"data-state":a==="hidden"?"hidden":"visible",...o,ref:e,onPointerEnter:Jn(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Jn(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),nw=T.forwardRef((t,e)=>{const n=zn(co,t.__scopeScrollArea),{forceMount:o,...r}=t,[s,i]=T.useState(!1),a=t.orientation==="horizontal",l=Rl(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;i(a?c:d)}},10);return us(n.viewport,l),us(n.content,l),u.jsx(Yc,{present:o||s,children:u.jsx(ih,{"data-state":s?"visible":"hidden",...r,ref:e})})}),ih=T.forwardRef((t,e)=>{const{orientation:n="vertical",...o}=t,r=zn(co,t.__scopeScrollArea),s=T.useRef(null),i=T.useRef(0),[a,l]=T.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=aw(a.viewport,a.content),d={...o,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:f=>s.current=f,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:f=>i.current=f};function h(f,m){return function(_,g,p,b="ltr"){const y=Dl(p),x=y/2,k=g||x,C=y-k,v=p.scrollbar.paddingStart+k,E=p.scrollbar.size-p.scrollbar.paddingEnd-C,N=p.content-p.viewport,I=b==="ltr"?[0,N]:[-1*N,0];return cw([v,E],I)(_)}(f,i.current,a,m)}return n==="horizontal"?u.jsx(HO,{...d,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const f=lw(r.viewport.scrollLeft,a,r.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollLeft=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollLeft=h(f,r.dir))}}):n==="vertical"?u.jsx(WO,{...d,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const f=lw(r.viewport.scrollTop,a);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollTop=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollTop=h(f))}}):null}),HO=T.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,s=zn(co,t.__scopeScrollArea),[i,a]=T.useState(),l=T.useRef(null),c=oi(e,l,s.onScrollbarXChange);return T.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),u.jsx(rw,{"data-orientation":"horizontal",...r,ref:c,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Dl(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,h)=>{if(s.viewport){const f=s.viewport.scrollLeft+d.deltaX;t.onWheelScroll(f),dw(f,h)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&o({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Ol(i.paddingLeft),paddingEnd:Ol(i.paddingRight)}})}})}),WO=T.forwardRef((t,e)=>{const{sizes:n,onSizesChange:o,...r}=t,s=zn(co,t.__scopeScrollArea),[i,a]=T.useState(),l=T.useRef(null),c=oi(e,l,s.onScrollbarYChange);return T.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),u.jsx(rw,{"data-orientation":"vertical",...r,ref:c,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Dl(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,h)=>{if(s.viewport){const f=s.viewport.scrollTop+d.deltaY;t.onWheelScroll(f),dw(f,h)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&o({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Ol(i.paddingTop),paddingEnd:Ol(i.paddingBottom)}})}})}),[qO,ow]=Zx(co),rw=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:o,hasThumb:r,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:d,onResize:h,...f}=t,m=zn(co,n),[_,g]=T.useState(null),p=oi(e,I=>g(I)),b=T.useRef(null),y=T.useRef(""),x=m.viewport,k=o.content-o.viewport,C=mr(d),v=mr(l),E=Rl(h,10);function N(I){if(b.current){const A=I.clientX-b.current.left,M=I.clientY-b.current.top;c({x:A,y:M})}}return T.useEffect(()=>{const I=A=>{const M=A.target;(_==null?void 0:_.contains(M))&&C(A,k)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[x,_,k,C]),T.useEffect(v,[o,v]),us(_,E),us(m.content,E),u.jsx(qO,{scope:n,scrollbar:_,hasThumb:r,onThumbChange:mr(s),onThumbPointerUp:mr(i),onThumbPositionChange:v,onThumbPointerDown:mr(a),children:u.jsx(ei.div,{...f,ref:p,style:{position:"absolute",...f.style},onPointerDown:Jn(t.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),b.current=_.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),N(I))}),onPointerMove:Jn(t.onPointerMove,N),onPointerUp:Jn(t.onPointerUp,I=>{const A=I.target;A.hasPointerCapture(I.pointerId)&&A.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=y.current,m.viewport&&(m.viewport.style.scrollBehavior=""),b.current=null})})})}),Ml="ScrollAreaThumb",sw=T.forwardRef((t,e)=>{const{forceMount:n,...o}=t,r=ow(Ml,t.__scopeScrollArea);return u.jsx(Yc,{present:n||r.hasThumb,children:u.jsx(GO,{ref:e,...o})})}),GO=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:o,...r}=t,s=zn(Ml,n),i=ow(Ml,n),{onThumbPositionChange:a}=i,l=oi(e,h=>i.onThumbChange(h)),c=T.useRef(void 0),d=Rl(()=>{c.current&&(c.current(),c.current=void 0)},100);return T.useEffect(()=>{const h=s.viewport;if(h){const f=()=>{if(d(),!c.current){const m=JO(h,a);c.current=m,a()}};return a(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[s.viewport,d,a]),u.jsx(ei.div,{"data-state":i.hasThumb?"visible":"hidden",...r,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:Jn(t.onPointerDownCapture,h=>{const f=h.target.getBoundingClientRect(),m=h.clientX-f.left,_=h.clientY-f.top;i.onThumbPointerDown({x:m,y:_})}),onPointerUp:Jn(t.onPointerUp,i.onThumbPointerUp)})});sw.displayName=Ml;var ah="ScrollAreaCorner",iw=T.forwardRef((t,e)=>{const n=zn(ah,t.__scopeScrollArea),o=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&o?u.jsx(YO,{...t,ref:e}):null});iw.displayName=ah;var YO=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,...o}=t,r=zn(ah,n),[s,i]=T.useState(0),[a,l]=T.useState(0),c=!!(s&&a);return us(r.scrollbarX,()=>{var h;const d=((h=r.scrollbarX)==null?void 0:h.offsetHeight)||0;r.onCornerHeightChange(d),l(d)}),us(r.scrollbarY,()=>{var h;const d=((h=r.scrollbarY)==null?void 0:h.offsetWidth)||0;r.onCornerWidthChange(d),i(d)}),c?u.jsx(ei.div,{...o,ref:e,style:{width:s,height:a,position:"absolute",right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Ol(t){return t?parseInt(t,10):0}function aw(t,e){const n=t/e;return isNaN(n)?0:n}function Dl(t){const e=aw(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=(t.scrollbar.size-n)*e;return Math.max(o,18)}function lw(t,e,n="ltr"){const o=Dl(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-r,i=e.content-e.viewport,a=s-o,l=FV(t,n==="ltr"?[0,i]:[-1*i,0]);return cw([0,i],[0,a])(l)}function cw(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const o=(e[1]-e[0])/(t[1]-t[0]);return e[0]+o*(n-t[0])}}function dw(t,e){return t>0&&t<e}var JO=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},o=0;return function r(){const s={left:t.scrollLeft,top:t.scrollTop},i=n.left!==s.left,a=n.top!==s.top;(i||a)&&e(),n=s,o=window.requestAnimationFrame(r)}(),()=>window.cancelAnimationFrame(o)};function Rl(t,e){const n=mr(t),o=T.useRef(0);return T.useEffect(()=>()=>window.clearTimeout(o.current),[]),T.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(n,e)},[n,e])}function us(t,e){const n=mr(e);LV(()=>{let o=0;if(t){const r=new ResizeObserver(()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(n)});return r.observe(t),()=>{window.cancelAnimationFrame(o),r.unobserve(t)}}},[t,n])}var uw=Qx,KO=tw,XO=iw;const hw=T.forwardRef((t,e)=>{const n=K.c(15);let o,r,s,i,a,l,c,d;return n[0]!==t?({className:r,children:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(i=Ae("relative overflow-hidden",r),n[4]=r,n[5]=i):i=n[5],n[6]!==o?(a=u.jsx(KO,{className:"h-full w-full rounded-[inherit]",children:o}),n[6]=o,n[7]=a):a=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(fw,{}),c=u.jsx(XO,{}),n[8]=l,n[9]=c):(l=n[8],c=n[9]),n[10]!==s||n[11]!==e||n[12]!==i||n[13]!==a?(d=u.jsxs(uw,{ref:e,className:i,...s,children:[a,l,c]}),n[10]=s,n[11]=e,n[12]=i,n[13]=a,n[14]=d):d=n[14],d});hw.displayName=uw.displayName;const fw=T.forwardRef((t,e)=>{const n=K.c(14);let o,r,s;n[0]!==t?({className:o,orientation:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const i=s===void 0?"vertical":s,a=i==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",l=i==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]";let c,d,h;return n[4]!==o||n[5]!==a||n[6]!==l?(c=Ae("flex touch-none select-none transition-colors",a,l,o),n[4]=o,n[5]=a,n[6]=l,n[7]=c):c=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(sw,{className:"relative flex-1 rounded-full bg-border"}),n[8]=d):d=n[8],n[9]!==i||n[10]!==r||n[11]!==e||n[12]!==c?(h=u.jsx(sh,{ref:e,orientation:i,className:c,...r,children:d}),n[9]=i,n[10]=r,n[11]=e,n[12]=c,n[13]=h):h=n[13],h});fw.displayName=sh.displayName;let Pl;Pl=(t,e,n,o,r)=>e?{...t,chats:t.chats.map(s=>s.id===e?{...s,messages:[...s.messages,{role:n,content:o,timestamp:Date.now(),parts:r}],updatedAt:Date.now()}:s)}:(Dt.warn("No active chat"),t),vn=t=>{const e=K.c(15),{title:n,description:o,icon:r,action:s}=t;let i,a,l,c,d,h;return e[0]!==r?(i=r&&J.cloneElement(r,{className:"text-accent-foreground"}),e[0]=r,e[1]=i):i=e[1],e[2]!==n?(a=u.jsx("span",{className:"mt-1 text-accent-foreground",children:n}),e[2]=n,e[3]=a):a=e[3],e[4]!==i||e[5]!==a?(l=u.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[i,a]}),e[4]=i,e[5]=a,e[6]=l):l=e[6],e[7]!==o?(c=u.jsx("span",{className:"text-muted-foreground text-sm",children:o}),e[7]=o,e[8]=c):c=e[8],e[9]!==s?(d=s&&u.jsx("div",{className:"mt-2",children:s}),e[9]=s,e[10]=d):d=e[10],e[11]!==l||e[12]!==c||e[13]!==d?(h=u.jsxs("div",{className:"mx-6 my-6 flex flex-col gap-2",children:[l,c,d]}),e[11]=l,e[12]=c,e[13]=d,e[14]=h):h=e[14],h};function KH(){}function XH(){}const ZO=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,QO=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,e9={};function mw(t,e){return(e9.jsx?QO:ZO).test(t)}const t9=/[ \t\n\f\r]/g;function pw(t){return t.replace(t9,"")===""}class zi{constructor(e,n,o){this.property=e,this.normal=n,o&&(this.space=o)}}function gw(t,e){const n={},o={};let r=-1;for(;++r<t.length;)Object.assign(n,t[r].property),Object.assign(o,t[r].normal);return new zi(n,o,e)}function lh(t){return t.toLowerCase()}zi.prototype.property={},zi.prototype.normal={},zi.prototype.space=null;class Bn{constructor(e,n){this.property=e,this.attribute=n}}Bn.prototype.space=null,Bn.prototype.boolean=!1,Bn.prototype.booleanish=!1,Bn.prototype.overloadedBoolean=!1,Bn.prototype.number=!1,Bn.prototype.commaSeparated=!1,Bn.prototype.spaceSeparated=!1,Bn.prototype.commaOrSpaceSeparated=!1,Bn.prototype.mustUseProperty=!1,Bn.prototype.defined=!1;let n9=0;const rt=Mr(),Lt=Mr(),_w=Mr(),we=Mr(),gt=Mr(),hs=Mr(),Sn=Mr();function Mr(){return 2**++n9}const ch=Object.freeze(Object.defineProperty({__proto__:null,boolean:rt,booleanish:Lt,commaOrSpaceSeparated:Sn,commaSeparated:hs,number:we,overloadedBoolean:_w,spaceSeparated:gt},Symbol.toStringTag,{value:"Module"})),dh=Object.keys(ch);class uh extends Bn{constructor(e,n,o,r){let s=-1;if(super(e,n),bw(this,"space",r),typeof o=="number")for(;++s<dh.length;){const i=dh[s];bw(this,dh[s],(o&ch[i])===ch[i])}}}function bw(t,e,n){n&&(t[e]=n)}uh.prototype.defined=!0;const o9={}.hasOwnProperty;function fs(t){const e={},n={};let o;for(o in t.properties)if(o9.call(t.properties,o)){const r=t.properties[o],s=new uh(o,t.transform(t.attributes||{},o),r,t.space);t.mustUseProperty&&t.mustUseProperty.includes(o)&&(s.mustUseProperty=!0),e[o]=s,n[lh(o)]=o,n[lh(s.attribute)]=o}return new zi(e,n,t.space)}const yw=fs({space:"xlink",transform:(t,e)=>"xlink:"+e.slice(5).toLowerCase(),properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),xw=fs({space:"xml",transform:(t,e)=>"xml:"+e.slice(3).toLowerCase(),properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function ww(t,e){return e in t?t[e]:e}function vw(t,e){return ww(t,e.toLowerCase())}const kw=fs({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:vw,properties:{xmlns:null,xmlnsXLink:null}}),Sw=fs({transform:(t,e)=>e==="role"?e:"aria-"+e.slice(4).toLowerCase(),properties:{ariaActiveDescendant:null,ariaAtomic:Lt,ariaAutoComplete:null,ariaBusy:Lt,ariaChecked:Lt,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:gt,ariaCurrent:null,ariaDescribedBy:gt,ariaDetails:null,ariaDisabled:Lt,ariaDropEffect:gt,ariaErrorMessage:null,ariaExpanded:Lt,ariaFlowTo:gt,ariaGrabbed:Lt,ariaHasPopup:null,ariaHidden:Lt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:gt,ariaLevel:we,ariaLive:null,ariaModal:Lt,ariaMultiLine:Lt,ariaMultiSelectable:Lt,ariaOrientation:null,ariaOwns:gt,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:Lt,ariaReadOnly:Lt,ariaRelevant:null,ariaRequired:Lt,ariaRoleDescription:gt,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:Lt,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null}}),r9=fs({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:vw,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:hs,acceptCharset:gt,accessKey:gt,action:null,allow:null,allowFullScreen:rt,allowPaymentRequest:rt,allowUserMedia:rt,alt:null,as:null,async:rt,autoCapitalize:null,autoComplete:gt,autoFocus:rt,autoPlay:rt,blocking:gt,capture:null,charSet:null,checked:rt,cite:null,className:gt,cols:we,colSpan:null,content:null,contentEditable:Lt,controls:rt,controlsList:gt,coords:we|hs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:rt,defer:rt,dir:null,dirName:null,disabled:rt,download:_w,draggable:Lt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:rt,formTarget:null,headers:gt,height:we,hidden:rt,high:we,href:null,hrefLang:null,htmlFor:gt,httpEquiv:gt,id:null,imageSizes:null,imageSrcSet:null,inert:rt,inputMode:null,integrity:null,is:null,isMap:rt,itemId:null,itemProp:gt,itemRef:gt,itemScope:rt,itemType:gt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:rt,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:rt,muted:rt,name:null,nonce:null,noModule:rt,noValidate:rt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:rt,optimum:we,pattern:null,ping:gt,placeholder:null,playsInline:rt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:rt,referrerPolicy:null,rel:gt,required:rt,reversed:rt,rows:we,rowSpan:we,sandbox:gt,scope:null,scoped:rt,seamless:rt,selected:rt,shadowRootClonable:rt,shadowRootDelegatesFocus:rt,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:Lt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:we,step:null,style:null,tabIndex:we,target:null,title:null,translate:null,type:null,typeMustMatch:rt,useMap:null,value:Lt,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:gt,axis:null,background:null,bgColor:null,border:we,borderColor:null,bottomMargin:we,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:rt,declare:rt,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:rt,noHref:rt,noShade:rt,noWrap:rt,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:Lt,standby:null,summary:null,text:null,topMargin:we,valueType:null,version:null,vAlign:null,vLink:null,vSpace:we,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:rt,disableRemotePlayback:rt,prefix:null,property:null,results:we,security:null,unselectable:null}}),s9=fs({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:ww,properties:{about:Sn,accentHeight:we,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:we,amplitude:we,arabicForm:null,ascent:we,attributeName:null,attributeType:null,azimuth:we,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:we,by:null,calcMode:null,capHeight:we,className:gt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:we,diffuseConstant:we,direction:null,display:null,dur:null,divisor:we,dominantBaseline:null,download:rt,dx:null,dy:null,edgeMode:null,editable:null,elevation:we,enableBackground:null,end:null,event:null,exponent:we,externalResourcesRequired:null,fill:null,fillOpacity:we,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:hs,g2:hs,glyphName:hs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:we,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:we,horizOriginX:we,horizOriginY:we,id:null,ideographic:we,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:we,k:we,k1:we,k2:we,k3:we,k4:we,kernelMatrix:Sn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:we,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:we,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:we,overlineThickness:we,paintOrder:null,panose1:null,path:null,pathLength:we,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:gt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Sn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Sn,rev:Sn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Sn,requiredFeatures:Sn,requiredFonts:Sn,requiredFormats:Sn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:we,specularExponent:we,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:we,strikethroughThickness:we,string:null,stroke:null,strokeDashArray:Sn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:we,strokeOpacity:we,strokeWidth:null,style:null,surfaceScale:we,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Sn,tabIndex:we,tableValues:null,target:null,targetX:we,targetY:we,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Sn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:we,underlineThickness:we,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:we,values:null,vAlphabetic:we,vMathematical:we,vectorEffect:null,vHanging:we,vIdeographic:we,version:null,vertAdvY:we,vertOriginX:we,vertOriginY:we,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:we,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),i9=/^data[-\w.:]+$/i,Cw=/-[a-z]/g,a9=/[A-Z]/g;function l9(t){return"-"+t.toLowerCase()}function c9(t){return t.charAt(1).toUpperCase()}const d9={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},u9=gw([xw,yw,kw,Sw,r9],"html"),hh=gw([xw,yw,kw,Sw,s9],"svg"),Nw=hS(zV()),h9=Nw.default||Nw,jw=Ew("end"),fh=Ew("start");function Ew(t){return function(e){const n=e&&e.position&&e.position[t]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function Bi(t){return t&&typeof t=="object"?"position"in t||"type"in t?Iw(t.position):"start"in t||"end"in t?Iw(t):"line"in t||"column"in t?mh(t):"":""}function mh(t){return Aw(t&&t.line)+":"+Aw(t&&t.column)}function Iw(t){return mh(t&&t.start)+"-"+mh(t&&t.end)}function Aw(t){return t&&typeof t=="number"?t:1}class nn extends Error{constructor(e,n,o){super(),typeof n=="string"&&(o=n,n=void 0);let r="",s={},i=!1;if(n&&(s="line"in n&&"column"in n||"start"in n&&"end"in n?{place:n}:"type"in n?{ancestors:[n],place:n.position}:{...n}),typeof e=="string"?r=e:!s.cause&&e&&(i=!0,r=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof o=="string"){const l=o.indexOf(":");l===-1?s.ruleId=o:(s.source=o.slice(0,l),s.ruleId=o.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=r,this.line=a?a.line:void 0,this.name=Bi(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=i&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual,this.expected,this.note,this.url}}nn.prototype.file="",nn.prototype.name="",nn.prototype.reason="",nn.prototype.message="",nn.prototype.stack="",nn.prototype.column=void 0,nn.prototype.line=void 0,nn.prototype.ancestors=void 0,nn.prototype.cause=void 0,nn.prototype.fatal=void 0,nn.prototype.place=void 0,nn.prototype.ruleId=void 0,nn.prototype.source=void 0;const ph={}.hasOwnProperty,f9=new Map,m9=/[A-Z]/g,p9=/-([a-z])/g,g9=new Set(["table","tbody","thead","tfoot","tr"]),_9=new Set(["td","th"]),Tw="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function b9(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let o;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");o=function(i,a){return l;function l(c,d,h,f){const m=Array.isArray(h.children),_=fh(c);return a(d,h,f,m,{columnNumber:_?_.column-1:void 0,fileName:i,lineNumber:_?_.line:void 0},void 0)}}(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");o=function(i,a,l){return c;function c(d,h,f,m){const _=Array.isArray(f.children)?l:a;return m?_(h,f,m):_(h,f)}}(0,e.jsx,e.jsxs)}const r={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:o,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?hh:u9,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=Mw(r,t,void 0);return s&&typeof s!="string"?s:r.create(t,r.Fragment,{children:s||void 0},void 0)}function Mw(t,e,n){return e.type==="element"?function(o,r,s){const i=o.schema;let a=i;r.tagName.toLowerCase()==="svg"&&i.space==="html"&&(a=hh,o.schema=a),o.ancestors.push(r);const l=Dw(o,r.tagName,!1),c=function(h,f){const m={};let _,g;for(g in f.properties)if(g!=="children"&&ph.call(f.properties,g)){const p=y9(h,g,f.properties[g]);if(p){const[b,y]=p;h.tableCellAlignToStyle&&b==="align"&&typeof y=="string"&&_9.has(f.tagName)?_=y:m[b]=y}}return _&&((m.style||(m.style={}))[h.stylePropertyNameCase==="css"?"text-align":"textAlign"]=_),m}(o,r);let d=_h(o,r);return g9.has(r.tagName)&&(d=d.filter(function(h){return typeof h!="string"||!(typeof(f=h)=="object"?f.type==="text"&&pw(f.value):pw(f));var f})),Ow(o,c,l,r),gh(c,d),o.ancestors.pop(),o.schema=i,o.create(r,l,c,s)}(t,e,n):e.type==="mdxFlowExpression"||e.type==="mdxTextExpression"?function(o,r){if(r.data&&r.data.estree&&o.evaluater){const s=r.data.estree.body[0];return s.type,o.evaluater.evaluateExpression(s.expression)}Ui(o,r.position)}(t,e):e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement"?function(o,r,s){const i=o.schema;let a=i;r.name==="svg"&&i.space==="html"&&(a=hh,o.schema=a),o.ancestors.push(r);const l=r.name===null?o.Fragment:Dw(o,r.name,!0),c=function(h,f){const m={};for(const _ of f.attributes)if(_.type==="mdxJsxExpressionAttribute")if(_.data&&_.data.estree&&h.evaluater){const g=_.data.estree.body[0];g.type;const p=g.expression;p.type;const b=p.properties[0];b.type,Object.assign(m,h.evaluater.evaluateExpression(b.argument))}else Ui(h,f.position);else{const g=_.name;let p;if(_.value&&typeof _.value=="object")if(_.value.data&&_.value.data.estree&&h.evaluater){const b=_.value.data.estree.body[0];b.type,p=h.evaluater.evaluateExpression(b.expression)}else Ui(h,f.position);else p=_.value===null||_.value;m[g]=p}return m}(o,r),d=_h(o,r);return Ow(o,c,l,r),gh(c,d),o.ancestors.pop(),o.schema=i,o.create(r,l,c,s)}(t,e,n):e.type==="mdxjsEsm"?function(o,r){if(r.data&&r.data.estree&&o.evaluater)return o.evaluater.evaluateProgram(r.data.estree);Ui(o,r.position)}(t,e):e.type==="root"?function(o,r,s){const i={};return gh(i,_h(o,r)),o.create(r,o.Fragment,i,s)}(t,e,n):e.type==="text"?function(o,r){return r.value}(0,e):void 0}function Ow(t,e,n,o){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=o)}function gh(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function _h(t,e){const n=[];let o=-1;const r=t.passKeys?new Map:f9;for(;++o<e.children.length;){const s=e.children[o];let i;if(t.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=r.get(l)||0;i=l+"-"+c,r.set(l,c+1)}}const a=Mw(t,s,i);a!==void 0&&n.push(a)}return n}function y9(t,e,n){const o=function(r,s){const i=lh(s);let a=s,l=Bn;if(i in r.normal)return r.property[r.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&i9.test(s)){if(s.charAt(4)==="-"){const c=s.slice(5).replace(Cw,c9);a="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=s.slice(4);if(!Cw.test(c)){let d=c.replace(a9,l9);d.charAt(0)!=="-"&&(d="-"+d),s="data"+d}}l=uh}return new l(a,s)}(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=o.commaSeparated?function(r){const s={};return(r[r.length-1]===""?[...r,""]:r).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}(n):n.join(" ").trim()),o.property==="style"){let r=typeof n=="object"?n:function(s,i){const a={};try{h9(i,l)}catch(c){if(!s.ignoreInvalidStyle){const d=c,h=new nn("Cannot parse `style` attribute",{ancestors:s.ancestors,cause:d,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw h.file=s.filePath||void 0,h.url=Tw+"#cannot-parse-style-attribute",h}}return a;function l(c,d){let h=c;h.slice(0,2)!=="--"&&(h.slice(0,4)==="-ms-"&&(h="ms-"+h.slice(4)),h=h.replace(p9,w9)),a[h]=d}}(t,String(n));return t.stylePropertyNameCase==="css"&&(r=function(s){const i={};let a;for(a in s)ph.call(s,a)&&(i[x9(a)]=s[a]);return i}(r)),["style",r]}return[t.elementAttributeNameCase==="react"&&o.space?d9[o.property]||o.property:o.attribute,n]}}function Dw(t,e,n){let o;if(n)if(e.includes(".")){const r=e.split(".");let s,i=-1;for(;++i<r.length;){const a=mw(r[i])?{type:"Identifier",name:r[i]}:{type:"Literal",value:r[i]};s=s?{type:"MemberExpression",object:s,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}o=s}else o=mw(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};else o={type:"Literal",value:e};if(o.type==="Literal"){const r=o.value;return ph.call(t.components,r)?t.components[r]:r}if(t.evaluater)return t.evaluater.evaluateExpression(o);Ui(t)}function Ui(t,e){const n=new nn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=Tw+"#cannot-handle-mdx-estrees-without-createevaluater",n}function x9(t){let e=t.replace(m9,v9);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function w9(t,e){return e.toUpperCase()}function v9(t){return"-"+t.toLowerCase()}const bh={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Ll={};function Rw(t,e,n){if(function(o){return!!(o&&typeof o=="object")}(t)){if("value"in t)return t.type!=="html"||n?t.value:"";if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return Pw(t.children,e,n)}return Array.isArray(t)?Pw(t,e,n):""}function Pw(t,e,n){const o=[];let r=-1;for(;++r<t.length;)o[r]=Rw(t[r],e,n);return o.join("")}const Lw=document.createElement("i");function yh(t){const e="&"+t+";";Lw.innerHTML=e;const n=Lw.textContent;return(n.charCodeAt(n.length-1)!==59||t==="semi")&&n!==e&&n}function uo(t,e,n,o){const r=t.length;let s,i=0;if(e=e<0?-e>r?0:r+e:e>r?r:e,n=n>0?n:0,o.length<1e4)s=Array.from(o),s.unshift(e,n),t.splice(...s);else for(n&&t.splice(e,n);i<o.length;)s=o.slice(i,i+1e4),s.unshift(e,0),t.splice(...s),i+=1e4,e+=1e4}function Un(t,e){return t.length>0?(uo(t,t.length,0,e),t):e}const Fw={}.hasOwnProperty;function k9(t,e){let n;for(n in e){const o=(Fw.call(t,n)?t[n]:void 0)||(t[n]={}),r=e[n];let s;if(r)for(s in r){Fw.call(o,s)||(o[s]=[]);const i=r[s];S9(o[s],Array.isArray(i)?i:i?[i]:[])}}}function S9(t,e){let n=-1;const o=[];for(;++n<e.length;)(e[n].add==="after"?t:o).push(e[n]);uo(t,0,0,o)}function zw(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||(65535&n)==65534||n>1114111?"\uFFFD":String.fromCodePoint(n)}function ms(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ho=Zo(/[A-Za-z]/),Cn=Zo(/[\dA-Za-z]/),C9=Zo(/[#-'*+\--9=?A-Z^-~]/);function xh(t){return t!==null&&(t<32||t===127)}const wh=Zo(/\d/),N9=Zo(/[\dA-Fa-f]/),j9=Zo(/[!-/:-@[-`{-~]/);function Ze(t){return t!==null&&t<-2}function bn(t){return t!==null&&(t<0||t===32)}function ht(t){return t===-2||t===-1||t===32}const E9=Zo(new RegExp("\\p{P}|\\p{S}","u")),I9=Zo(/\s/);function Zo(t){return function(e){return e!==null&&e>-1&&t.test(String.fromCharCode(e))}}function ps(t){const e=[];let n=-1,o=0,r=0;for(;++n<t.length;){const s=t.charCodeAt(n);let i="";if(s===37&&Cn(t.charCodeAt(n+1))&&Cn(t.charCodeAt(n+2)))r=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(i=String.fromCharCode(s));else if(s>55295&&s<57344){const a=t.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(i=String.fromCharCode(s,a),r=1):i="\uFFFD"}else i=String.fromCharCode(s);i&&(e.push(t.slice(o,n),encodeURIComponent(i)),o=n+r+1,i=""),r&&(n+=r,r=0)}return e.join("")+t.slice(o)}function _t(t,e,n,o){const r=o?o-1:Number.POSITIVE_INFINITY;let s=0;return function(a){return ht(a)?(t.enter(n),i(a)):e(a)};function i(a){return ht(a)&&s++<r?(t.consume(a),i):(t.exit(n),e(a))}}const A9={tokenize:function(t){const e=t.attempt(this.parser.constructs.contentInitial,function(s){return s===null?void t.consume(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),_t(t,e,"linePrefix"))},function(s){return t.enter("paragraph"),o(s)});let n;return e;function o(s){const i=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=i),n=i,r(s)}function r(s){return s===null?(t.exit("chunkText"),t.exit("paragraph"),void t.consume(s)):Ze(s)?(t.consume(s),t.exit("chunkText"),o):(t.consume(s),r)}}},T9={tokenize:function(t){const e=this,n=[];let o,r,s,i=0;return a;function a(x){if(i<n.length){const k=n[i];return e.containerState=k[1],t.attempt(k[0].continuation,l,c)(x)}return c(x)}function l(x){if(i++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,o&&y();const k=e.events.length;let C,v=k;for(;v--;)if(e.events[v][0]==="exit"&&e.events[v][1].type==="chunkFlow"){C=e.events[v][1].end;break}b(i);let E=k;for(;E<e.events.length;)e.events[E][1].end={...C},E++;return uo(e.events,v+1,0,e.events.slice(k)),e.events.length=E,c(x)}return a(x)}function c(x){if(i===n.length){if(!o)return f(x);if(o.currentConstruct&&o.currentConstruct.concrete)return _(x);e.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(Bw,d,h)(x)}function d(x){return o&&y(),b(i),f(x)}function h(x){return e.parser.lazy[e.now().line]=i!==n.length,s=e.now().offset,_(x)}function f(x){return e.containerState={},t.attempt(Bw,m,_)(x)}function m(x){return i++,n.push([e.currentConstruct,e.containerState]),f(x)}function _(x){return x===null?(o&&y(),b(0),void t.consume(x)):(o=o||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:r}),g(x))}function g(x){return x===null?(p(t.exit("chunkFlow"),!0),b(0),void t.consume(x)):Ze(x)?(t.consume(x),p(t.exit("chunkFlow")),i=0,e.interrupt=void 0,a):(t.consume(x),g)}function p(x,k){const C=e.sliceStream(x);if(k&&C.push(null),x.previous=r,r&&(r.next=x),r=x,o.defineSkip(x.start),o.write(C),e.parser.lazy[x.start.line]){let v=o.events.length;for(;v--;)if(o.events[v][1].start.offset<s&&(!o.events[v][1].end||o.events[v][1].end.offset>s))return;const E=e.events.length;let N,I,A=E;for(;A--;)if(e.events[A][0]==="exit"&&e.events[A][1].type==="chunkFlow"){if(N){I=e.events[A][1].end;break}N=!0}for(b(i),v=E;v<e.events.length;)e.events[v][1].end={...I},v++;uo(e.events,A+1,0,e.events.slice(E)),e.events.length=v}}function b(x){let k=n.length;for(;k-- >x;){const C=n[k];e.containerState=C[1],C[0].exit.call(e,t)}n.length=x}function y(){o.write([null]),r=void 0,o=void 0,e.containerState._closeFlow=void 0}}},Bw={tokenize:function(t,e,n){return _t(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function Uw(t){return t===null||bn(t)||I9(t)?1:E9(t)?2:void 0}function vh(t,e,n){const o=[];let r=-1;for(;++r<t.length;){const s=t[r].resolveAll;s&&!o.includes(s)&&(e=s(e,n),o.push(s))}return e}const kh={name:"attention",resolveAll:function(t,e){let n,o,r,s,i,a,l,c,d=-1;for(;++d<t.length;)if(t[d][0]==="enter"&&t[d][1].type==="attentionSequence"&&t[d][1]._close){for(n=d;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[d][1]).charCodeAt(0)){if((t[n][1]._close||t[d][1]._open)&&(t[d][1].end.offset-t[d][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[d][1].end.offset-t[d][1].start.offset)%3))continue;a=t[n][1].end.offset-t[n][1].start.offset>1&&t[d][1].end.offset-t[d][1].start.offset>1?2:1;const h={...t[n][1].end},f={...t[d][1].start};Vw(h,-a),Vw(f,a),s={type:a>1?"strongSequence":"emphasisSequence",start:h,end:{...t[n][1].end}},i={type:a>1?"strongSequence":"emphasisSequence",start:{...t[d][1].start},end:f},r={type:a>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[d][1].start}},o={type:a>1?"strong":"emphasis",start:{...s.start},end:{...i.end}},t[n][1].end={...s.start},t[d][1].start={...i.end},l=[],t[n][1].end.offset-t[n][1].start.offset&&(l=Un(l,[["enter",t[n][1],e],["exit",t[n][1],e]])),l=Un(l,[["enter",o,e],["enter",s,e],["exit",s,e],["enter",r,e]]),l=Un(l,vh(e.parser.constructs.insideSpan.null,t.slice(n+1,d),e)),l=Un(l,[["exit",r,e],["enter",i,e],["exit",i,e],["exit",o,e]]),t[d][1].end.offset-t[d][1].start.offset?(c=2,l=Un(l,[["enter",t[d][1],e],["exit",t[d][1],e]])):c=0,uo(t,n-1,d-n+3,l),d=n+l.length-c-2;break}}for(d=-1;++d<t.length;)t[d][1].type==="attentionSequence"&&(t[d][1].type="data");return t},tokenize:function(t,e){const n=this.parser.constructs.attentionMarkers.null,o=this.previous,r=Uw(o);let s;return function(a){return s=a,t.enter("attentionSequence"),i(a)};function i(a){if(a===s)return t.consume(a),i;const l=t.exit("attentionSequence"),c=Uw(a),d=!c||c===2&&r||n.includes(a),h=!r||r===2&&c||n.includes(o);return l._open=!!(s===42?d:d&&(r||!h)),l._close=!!(s===42?h:h&&(c||!d)),e(a)}}};function Vw(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const M9={name:"autolink",tokenize:function(t,e,n){let o=0;return function(f){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),r};function r(f){return ho(f)?(t.consume(f),s):f===64?n(f):l(f)}function s(f){return f===43||f===45||f===46||Cn(f)?(o=1,i(f)):l(f)}function i(f){return f===58?(t.consume(f),o=0,a):(f===43||f===45||f===46||Cn(f))&&o++<32?(t.consume(f),i):(o=0,l(f))}function a(f){return f===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):f===null||f===32||f===60||xh(f)?n(f):(t.consume(f),a)}function l(f){return f===64?(t.consume(f),c):C9(f)?(t.consume(f),l):n(f)}function c(f){return Cn(f)?d(f):n(f)}function d(f){return f===46?(t.consume(f),o=0,c):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):h(f)}function h(f){if((f===45||Cn(f))&&o++<63){const m=f===45?h:d;return t.consume(f),m}return n(f)}}},Fl={partial:!0,tokenize:function(t,e,n){return function(r){return ht(r)?_t(t,o,"linePrefix")(r):o(r)};function o(r){return r===null||Ze(r)?e(r):n(r)}}},$w={continuation:{tokenize:function(t,e,n){const o=this;return function(s){return ht(s)?_t(t,r,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):r(s)};function r(s){return t.attempt($w,e,n)(s)}}},exit:function(t){t.exit("blockQuote")},name:"blockQuote",tokenize:function(t,e,n){const o=this;return function(s){if(s===62){const i=o.containerState;return i.open||(t.enter("blockQuote",{_container:!0}),i.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(s),t.exit("blockQuoteMarker"),r}return n(s)};function r(s){return ht(s)?(t.enter("blockQuotePrefixWhitespace"),t.consume(s),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(s))}}},Hw={name:"characterEscape",tokenize:function(t,e,n){return function(r){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(r),t.exit("escapeMarker"),o};function o(r){return j9(r)?(t.enter("characterEscapeValue"),t.consume(r),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(r)}}},Ww={name:"characterReference",tokenize:function(t,e,n){const o=this;let r,s,i=0;return function(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),a};function a(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),l):(t.enter("characterReferenceValue"),r=31,s=Cn,c(d))}function l(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),r=6,s=N9,c):(t.enter("characterReferenceValue"),r=7,s=wh,c(d))}function c(d){if(d===59&&i){const h=t.exit("characterReferenceValue");return s!==Cn||yh(o.sliceSerialize(h))?(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e):n(d)}return s(d)&&i++<r?(t.consume(d),c):n(d)}}},qw={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return s===null?n(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r)};function r(s){return o.parser.lazy[o.now().line]?n(s):e(s)}}},Gw={concrete:!0,name:"codeFenced",tokenize:function(t,e,n){const o=this,r={partial:!0,tokenize:function(x,k,C){let v=0;return E;function E(R){return x.enter("lineEnding"),x.consume(R),x.exit("lineEnding"),N}function N(R){return x.enter("codeFencedFence"),ht(R)?_t(x,I,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):I(R)}function I(R){return R===s?(x.enter("codeFencedFenceSequence"),A(R)):C(R)}function A(R){return R===s?(v++,x.consume(R),A):v>=a?(x.exit("codeFencedFenceSequence"),ht(R)?_t(x,M,"whitespace")(R):M(R)):C(R)}function M(R){return R===null||Ze(R)?(x.exit("codeFencedFence"),k(R)):C(R)}}};let s,i=0,a=0;return function(x){return function(k){const C=o.events[o.events.length-1];return i=C&&C[1].type==="linePrefix"?C[2].sliceSerialize(C[1],!0).length:0,s=k,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),l(k)}(x)};function l(x){return x===s?(a++,t.consume(x),l):a<3?n(x):(t.exit("codeFencedFenceSequence"),ht(x)?_t(t,c,"whitespace")(x):c(x))}function c(x){return x===null||Ze(x)?(t.exit("codeFencedFence"),o.interrupt?e(x):t.check(qw,m,y)(x)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),d(x))}function d(x){return x===null||Ze(x)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),c(x)):ht(x)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),_t(t,h,"whitespace")(x)):x===96&&x===s?n(x):(t.consume(x),d)}function h(x){return x===null||Ze(x)?c(x):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),f(x))}function f(x){return x===null||Ze(x)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),c(x)):x===96&&x===s?n(x):(t.consume(x),f)}function m(x){return t.attempt(r,y,_)(x)}function _(x){return t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),g}function g(x){return i>0&&ht(x)?_t(t,p,"linePrefix",i+1)(x):p(x)}function p(x){return x===null||Ze(x)?t.check(qw,m,y)(x):(t.enter("codeFlowValue"),b(x))}function b(x){return x===null||Ze(x)?(t.exit("codeFlowValue"),p(x)):(t.consume(x),b)}function y(x){return t.exit("codeFenced"),e(x)}}},Sh={name:"codeIndented",tokenize:function(t,e,n){const o=this;return function(l){return t.enter("codeIndented"),_t(t,r,"linePrefix",5)(l)};function r(l){const c=o.events[o.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(l):n(l)}function s(l){return l===null?a(l):Ze(l)?t.attempt(O9,s,a)(l):(t.enter("codeFlowValue"),i(l))}function i(l){return l===null||Ze(l)?(t.exit("codeFlowValue"),s(l)):(t.consume(l),i)}function a(l){return t.exit("codeIndented"),e(l)}}},O9={partial:!0,tokenize:function(t,e,n){const o=this;return r;function r(i){return o.parser.lazy[o.now().line]?n(i):Ze(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r):_t(t,s,"linePrefix",5)(i)}function s(i){const a=o.events[o.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(i):Ze(i)?r(i):n(i)}}},D9={name:"codeText",previous:function(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"},resolve:function(t){let e,n,o=t.length-4,r=3;if(!(t[r][1].type!=="lineEnding"&&t[r][1].type!=="space"||t[o][1].type!=="lineEnding"&&t[o][1].type!=="space")){for(e=r;++e<o;)if(t[e][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[o][1].type="codeTextPadding",r+=2,o-=2;break}}for(e=r-1,o++;++e<=o;)n===void 0?e!==o&&t[e][1].type!=="lineEnding"&&(n=e):e!==o&&t[e][1].type!=="lineEnding"||(t[n][1].type="codeTextData",e!==n+2&&(t[n][1].end=t[e-1][1].end,t.splice(n+2,e-n-2),o-=e-n-2,e=n+2),n=void 0);return t},tokenize:function(t,e,n){let o,r,s=0;return function(d){return t.enter("codeText"),t.enter("codeTextSequence"),i(d)};function i(d){return d===96?(t.consume(d),s++,i):(t.exit("codeTextSequence"),a(d))}function a(d){return d===null?n(d):d===32?(t.enter("space"),t.consume(d),t.exit("space"),a):d===96?(r=t.enter("codeTextSequence"),o=0,c(d)):Ze(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),a):(t.enter("codeTextData"),l(d))}function l(d){return d===null||d===32||d===96||Ze(d)?(t.exit("codeTextData"),a(d)):(t.consume(d),l)}function c(d){return d===96?(t.consume(d),o++,c):o===s?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(r.type="codeTextData",l(d))}}};class R9{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const o=n??Number.POSITIVE_INFINITY;return o<this.left.length?this.left.slice(e,o):e>this.left.length?this.right.slice(this.right.length-o+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-o+this.left.length).reverse())}splice(e,n,o){const r=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return o&&Vi(this.left,o),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Vi(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Vi(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);Vi(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Vi(this.left,n.reverse())}}}function Vi(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function Yw(t){const e={};let n,o,r,s,i,a,l,c=-1;const d=new R9(t);for(;++c<d.length;){for(;c in e;)c=e[c];if(n=d.get(c),c&&n[1].type==="chunkFlow"&&d.get(c-1)[1].type==="listItemPrefix"&&(a=n[1]._tokenizer.events,r=0,r<a.length&&a[r][1].type==="lineEndingBlank"&&(r+=2),r<a.length&&a[r][1].type==="content"))for(;++r<a.length&&a[r][1].type!=="content";)a[r][1].type==="chunkText"&&(a[r][1]._isInFirstContentOfListItem=!0,r++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,P9(d,c)),c=e[c],l=!0);else if(n[1]._container){for(r=c,o=void 0;r--&&(s=d.get(r),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(o&&(d.get(o)[1].type="lineEndingBlank"),s[1].type="lineEnding",o=r);o&&(n[1].end={...d.get(o)[1].start},i=d.slice(o,c),i.unshift(n),d.splice(o,c-o+1,i))}}return uo(t,0,Number.POSITIVE_INFINITY,d.slice(0)),!l}function P9(t,e){const n=t.get(e)[1],o=t.get(e)[2];let r=e-1;const s=[],i=n._tokenizer||o.parser[n.contentType](n.start),a=i.events,l=[],c={};let d,h,f=-1,m=n,_=0,g=0;const p=[g];for(;m;){for(;t.get(++r)[1]!==m;);s.push(r),m._tokenizer||(d=o.sliceStream(m),m.next||d.push(null),h&&i.defineSkip(m.start),m._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(d),m._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(g=f+1,p.push(g),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(i.events=[],m?(m._tokenizer=void 0,m.previous=void 0):p.pop(),f=p.length;f--;){const b=a.slice(p[f],p[f+1]),y=s.pop();l.push([y,y+b.length-1]),t.splice(y,2,b)}for(l.reverse(),f=-1;++f<l.length;)c[_+l[f][0]]=_+l[f][1],_+=l[f][1]-l[f][0]-1;return c}const L9={resolve:function(t){return Yw(t),t},tokenize:function(t,e){let n;return function(i){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),o(i)};function o(i){return i===null?r(i):Ze(i)?t.check(F9,s,r)(i):(t.consume(i),o)}function r(i){return t.exit("chunkContent"),t.exit("content"),e(i)}function s(i){return t.consume(i),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}},F9={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),_t(t,r,"linePrefix")};function r(s){if(s===null||Ze(s))return n(s);const i=o.events[o.events.length-1];return!o.parser.constructs.disable.null.includes("codeIndented")&&i&&i[1].type==="linePrefix"&&i[2].sliceSerialize(i[1],!0).length>=4?e(s):t.interrupt(o.parser.constructs.flow,n,e)(s)}}};function Jw(t,e,n,o,r,s,i,a,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return function(p){return p===60?(t.enter(o),t.enter(r),t.enter(s),t.consume(p),t.exit(s),h):p===null||p===32||p===41||xh(p)?n(p):(t.enter(o),t.enter(i),t.enter(a),t.enter("chunkString",{contentType:"string"}),_(p))};function h(p){return p===62?(t.enter(s),t.consume(p),t.exit(s),t.exit(r),t.exit(o),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===62?(t.exit("chunkString"),t.exit(a),h(p)):p===null||p===60||Ze(p)?n(p):(t.consume(p),p===92?m:f)}function m(p){return p===60||p===62||p===92?(t.consume(p),f):f(p)}function _(p){return d||p!==null&&p!==41&&!bn(p)?d<c&&p===40?(t.consume(p),d++,_):p===41?(t.consume(p),d--,_):p===null||p===32||p===40||xh(p)?n(p):(t.consume(p),p===92?g:_):(t.exit("chunkString"),t.exit(a),t.exit(i),t.exit(o),e(p))}function g(p){return p===40||p===41||p===92?(t.consume(p),_):_(p)}}function Kw(t,e,n,o,r,s){const i=this;let a,l=0;return function(f){return t.enter(o),t.enter(r),t.consume(f),t.exit(r),t.enter(s),c};function c(f){return l>999||f===null||f===91||f===93&&!a||f===94&&!l&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):f===93?(t.exit(s),t.enter(r),t.consume(f),t.exit(r),t.exit(o),e):Ze(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||Ze(f)||l++>999?(t.exit("chunkString"),c(f)):(t.consume(f),a||(a=!ht(f)),f===92?h:d)}function h(f){return f===91||f===92||f===93?(t.consume(f),l++,d):d(f)}}function Xw(t,e,n,o,r,s){let i;return function(h){return h===34||h===39||h===40?(t.enter(o),t.enter(r),t.consume(h),t.exit(r),i=h===40?41:h,a):n(h)};function a(h){return h===i?(t.enter(r),t.consume(h),t.exit(r),t.exit(o),e):(t.enter(s),l(h))}function l(h){return h===i?(t.exit(s),a(i)):h===null?n(h):Ze(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),_t(t,l,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(h))}function c(h){return h===i||h===null||Ze(h)?(t.exit("chunkString"),l(h)):(t.consume(h),h===92?d:c)}function d(h){return h===i||h===92?(t.consume(h),c):c(h)}}function $i(t,e){let n;return function o(r){return Ze(r)?(t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),n=!0,o):ht(r)?_t(t,o,n?"linePrefix":"lineSuffix")(r):e(r)}}const z9={name:"definition",tokenize:function(t,e,n){const o=this;let r;return function(h){return t.enter("definition"),function(f){return Kw.call(o,t,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}(h)};function s(h){return r=ms(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)),h===58?(t.enter("definitionMarker"),t.consume(h),t.exit("definitionMarker"),i):n(h)}function i(h){return bn(h)?$i(t,a)(h):a(h)}function a(h){return Jw(t,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function l(h){return t.attempt(B9,c,c)(h)}function c(h){return ht(h)?_t(t,d,"whitespace")(h):d(h)}function d(h){return h===null||Ze(h)?(t.exit("definition"),o.parser.defined.push(r),e(h)):n(h)}}},B9={partial:!0,tokenize:function(t,e,n){return function(i){return bn(i)?$i(t,o)(i):n(i)};function o(i){return Xw(t,r,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(i)}function r(i){return ht(i)?_t(t,s,"whitespace")(i):s(i)}function s(i){return i===null||Ze(i)?e(i):n(i)}}},U9={name:"hardBreakEscape",tokenize:function(t,e,n){return function(r){return t.enter("hardBreakEscape"),t.consume(r),o};function o(r){return Ze(r)?(t.exit("hardBreakEscape"),e(r)):n(r)}}},V9={name:"headingAtx",resolve:function(t,e){let n,o,r=t.length-2,s=3;return t[s][1].type==="whitespace"&&(s+=2),r-2>s&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(s===r-1||r-4>s&&t[r-2][1].type==="whitespace")&&(r-=s+1===r?2:4),r>s&&(n={type:"atxHeadingText",start:t[s][1].start,end:t[r][1].end},o={type:"chunkText",start:t[s][1].start,end:t[r][1].end,contentType:"text"},uo(t,s,r-s+1,[["enter",n,e],["enter",o,e],["exit",o,e],["exit",n,e]])),t},tokenize:function(t,e,n){let o=0;return function(l){return t.enter("atxHeading"),function(c){return t.enter("atxHeadingSequence"),r(c)}(l)};function r(l){return l===35&&o++<6?(t.consume(l),r):l===null||bn(l)?(t.exit("atxHeadingSequence"),s(l)):n(l)}function s(l){return l===35?(t.enter("atxHeadingSequence"),i(l)):l===null||Ze(l)?(t.exit("atxHeading"),e(l)):ht(l)?_t(t,s,"whitespace")(l):(t.enter("atxHeadingText"),a(l))}function i(l){return l===35?(t.consume(l),i):(t.exit("atxHeadingSequence"),s(l))}function a(l){return l===null||l===35||bn(l)?(t.exit("atxHeadingText"),s(l)):(t.consume(l),a)}}},$9=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Zw=["pre","script","style","textarea"],H9={concrete:!0,name:"htmlFlow",resolveTo:function(t){let e=t.length;for(;e--&&(t[e][0]!=="enter"||t[e][1].type!=="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t},tokenize:function(t,e,n){const o=this;let r,s,i,a,l;return function(j){return function(W){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(W),c}(j)};function c(j){return j===33?(t.consume(j),d):j===47?(t.consume(j),s=!0,m):j===63?(t.consume(j),r=3,o.interrupt?e:O):ho(j)?(t.consume(j),i=String.fromCharCode(j),_):n(j)}function d(j){return j===45?(t.consume(j),r=2,h):j===91?(t.consume(j),r=5,a=0,f):ho(j)?(t.consume(j),r=4,o.interrupt?e:O):n(j)}function h(j){return j===45?(t.consume(j),o.interrupt?e:O):n(j)}function f(j){return j==="CDATA[".charCodeAt(a++)?(t.consume(j),a===6?o.interrupt?e:A:f):n(j)}function m(j){return ho(j)?(t.consume(j),i=String.fromCharCode(j),_):n(j)}function _(j){if(j===null||j===47||j===62||bn(j)){const W=j===47,X=i.toLowerCase();return W||s||!Zw.includes(X)?$9.includes(i.toLowerCase())?(r=6,W?(t.consume(j),g):o.interrupt?e(j):A(j)):(r=7,o.interrupt&&!o.parser.lazy[o.now().line]?n(j):s?p(j):b(j)):(r=1,o.interrupt?e(j):A(j))}return j===45||Cn(j)?(t.consume(j),i+=String.fromCharCode(j),_):n(j)}function g(j){return j===62?(t.consume(j),o.interrupt?e:A):n(j)}function p(j){return ht(j)?(t.consume(j),p):N(j)}function b(j){return j===47?(t.consume(j),N):j===58||j===95||ho(j)?(t.consume(j),y):ht(j)?(t.consume(j),b):N(j)}function y(j){return j===45||j===46||j===58||j===95||Cn(j)?(t.consume(j),y):x(j)}function x(j){return j===61?(t.consume(j),k):ht(j)?(t.consume(j),x):b(j)}function k(j){return j===null||j===60||j===61||j===62||j===96?n(j):j===34||j===39?(t.consume(j),l=j,C):ht(j)?(t.consume(j),k):v(j)}function C(j){return j===l?(t.consume(j),l=null,E):j===null||Ze(j)?n(j):(t.consume(j),C)}function v(j){return j===null||j===34||j===39||j===47||j===60||j===61||j===62||j===96||bn(j)?x(j):(t.consume(j),v)}function E(j){return j===47||j===62||ht(j)?b(j):n(j)}function N(j){return j===62?(t.consume(j),I):n(j)}function I(j){return j===null||Ze(j)?A(j):ht(j)?(t.consume(j),I):n(j)}function A(j){return j===45&&r===2?(t.consume(j),D):j===60&&r===1?(t.consume(j),F):j===62&&r===4?(t.consume(j),S):j===63&&r===3?(t.consume(j),O):j===93&&r===5?(t.consume(j),U):!Ze(j)||r!==6&&r!==7?j===null||Ze(j)?(t.exit("htmlFlowData"),M(j)):(t.consume(j),A):(t.exit("htmlFlowData"),t.check(W9,$,M)(j))}function M(j){return t.check(q9,R,$)(j)}function R(j){return t.enter("lineEnding"),t.consume(j),t.exit("lineEnding"),z}function z(j){return j===null||Ze(j)?M(j):(t.enter("htmlFlowData"),A(j))}function D(j){return j===45?(t.consume(j),O):A(j)}function F(j){return j===47?(t.consume(j),i="",B):A(j)}function B(j){if(j===62){const W=i.toLowerCase();return Zw.includes(W)?(t.consume(j),S):A(j)}return ho(j)&&i.length<8?(t.consume(j),i+=String.fromCharCode(j),B):A(j)}function U(j){return j===93?(t.consume(j),O):A(j)}function O(j){return j===62?(t.consume(j),S):j===45&&r===2?(t.consume(j),O):A(j)}function S(j){return j===null||Ze(j)?(t.exit("htmlFlowData"),$(j)):(t.consume(j),S)}function $(j){return t.exit("htmlFlow"),e(j)}}},W9={partial:!0,tokenize:function(t,e,n){return function(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(Fl,e,n)}}},q9={partial:!0,tokenize:function(t,e,n){const o=this;return function(s){return Ze(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),r):n(s)};function r(s){return o.parser.lazy[o.now().line]?n(s):e(s)}}},G9={name:"htmlText",tokenize:function(t,e,n){const o=this;let r,s,i;return function(S){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(S),a};function a(S){return S===33?(t.consume(S),l):S===47?(t.consume(S),k):S===63?(t.consume(S),y):ho(S)?(t.consume(S),E):n(S)}function l(S){return S===45?(t.consume(S),c):S===91?(t.consume(S),s=0,m):ho(S)?(t.consume(S),b):n(S)}function c(S){return S===45?(t.consume(S),f):n(S)}function d(S){return S===null?n(S):S===45?(t.consume(S),h):Ze(S)?(i=d,B(S)):(t.consume(S),d)}function h(S){return S===45?(t.consume(S),f):d(S)}function f(S){return S===62?F(S):S===45?h(S):d(S)}function m(S){return S==="CDATA[".charCodeAt(s++)?(t.consume(S),s===6?_:m):n(S)}function _(S){return S===null?n(S):S===93?(t.consume(S),g):Ze(S)?(i=_,B(S)):(t.consume(S),_)}function g(S){return S===93?(t.consume(S),p):_(S)}function p(S){return S===62?F(S):S===93?(t.consume(S),p):_(S)}function b(S){return S===null||S===62?F(S):Ze(S)?(i=b,B(S)):(t.consume(S),b)}function y(S){return S===null?n(S):S===63?(t.consume(S),x):Ze(S)?(i=y,B(S)):(t.consume(S),y)}function x(S){return S===62?F(S):y(S)}function k(S){return ho(S)?(t.consume(S),C):n(S)}function C(S){return S===45||Cn(S)?(t.consume(S),C):v(S)}function v(S){return Ze(S)?(i=v,B(S)):ht(S)?(t.consume(S),v):F(S)}function E(S){return S===45||Cn(S)?(t.consume(S),E):S===47||S===62||bn(S)?N(S):n(S)}function N(S){return S===47?(t.consume(S),F):S===58||S===95||ho(S)?(t.consume(S),I):Ze(S)?(i=N,B(S)):ht(S)?(t.consume(S),N):F(S)}function I(S){return S===45||S===46||S===58||S===95||Cn(S)?(t.consume(S),I):A(S)}function A(S){return S===61?(t.consume(S),M):Ze(S)?(i=A,B(S)):ht(S)?(t.consume(S),A):N(S)}function M(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(t.consume(S),r=S,R):Ze(S)?(i=M,B(S)):ht(S)?(t.consume(S),M):(t.consume(S),z)}function R(S){return S===r?(t.consume(S),r=void 0,D):S===null?n(S):Ze(S)?(i=R,B(S)):(t.consume(S),R)}function z(S){return S===null||S===34||S===39||S===60||S===61||S===96?n(S):S===47||S===62||bn(S)?N(S):(t.consume(S),z)}function D(S){return S===47||S===62||bn(S)?N(S):n(S)}function F(S){return S===62?(t.consume(S),t.exit("htmlTextData"),t.exit("htmlText"),e):n(S)}function B(S){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),U}function U(S){return ht(S)?_t(t,O,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):O(S)}function O(S){return t.enter("htmlTextData"),i(S)}}},Ch={name:"labelEnd",resolveAll:function(t){let e=-1;const n=[];for(;++e<t.length;){const o=t[e][1];if(n.push(t[e]),o.type==="labelImage"||o.type==="labelLink"||o.type==="labelEnd"){const r=o.type==="labelImage"?4:2;o.type="data",e+=r}}return t.length!==n.length&&uo(t,0,t.length,n),t},resolveTo:function(t,e){let n,o,r,s,i=t.length,a=0;for(;i--;)if(n=t[i][1],o){if(n.type==="link"||n.type==="labelLink"&&n._inactive)break;t[i][0]==="enter"&&n.type==="labelLink"&&(n._inactive=!0)}else if(r){if(t[i][0]==="enter"&&(n.type==="labelImage"||n.type==="labelLink")&&!n._balanced&&(o=i,n.type!=="labelLink")){a=2;break}}else n.type==="labelEnd"&&(r=i);const l={type:t[o][1].type==="labelLink"?"link":"image",start:{...t[o][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[o][1].start},end:{...t[r][1].end}},d={type:"labelText",start:{...t[o+a+2][1].end},end:{...t[r-2][1].start}};return s=[["enter",l,e],["enter",c,e]],s=Un(s,t.slice(o+1,o+a+3)),s=Un(s,[["enter",d,e]]),s=Un(s,vh(e.parser.constructs.insideSpan.null,t.slice(o+a+4,r-3),e)),s=Un(s,[["exit",d,e],t[r-2],t[r-1],["exit",c,e]]),s=Un(s,t.slice(r+1)),s=Un(s,[["exit",l,e]]),uo(t,o,t.length,s),t},tokenize:function(t,e,n){const o=this;let r,s,i=o.events.length;for(;i--;)if((o.events[i][1].type==="labelImage"||o.events[i][1].type==="labelLink")&&!o.events[i][1]._balanced){r=o.events[i][1];break}return function(h){return r?r._inactive?d(h):(s=o.parser.defined.includes(ms(o.sliceSerialize({start:r.end,end:o.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(h),t.exit("labelMarker"),t.exit("labelEnd"),a):n(h)};function a(h){return h===40?t.attempt(Y9,c,s?c:d)(h):h===91?t.attempt(J9,c,s?l:d)(h):s?c(h):d(h)}function l(h){return t.attempt(K9,c,d)(h)}function c(h){return e(h)}function d(h){return r._balanced=!0,n(h)}}},Y9={tokenize:function(t,e,n){return function(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),o};function o(d){return bn(d)?$i(t,r)(d):r(d)}function r(d){return d===41?c(d):Jw(t,s,i,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function s(d){return bn(d)?$i(t,a)(d):c(d)}function i(d){return n(d)}function a(d){return d===34||d===39||d===40?Xw(t,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):c(d)}function l(d){return bn(d)?$i(t,c)(d):c(d)}function c(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):n(d)}}},J9={tokenize:function(t,e,n){const o=this;return function(i){return Kw.call(o,t,r,s,"reference","referenceMarker","referenceString")(i)};function r(i){return o.parser.defined.includes(ms(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)))?e(i):n(i)}function s(i){return n(i)}}},K9={tokenize:function(t,e,n){return function(r){return t.enter("reference"),t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),o};function o(r){return r===93?(t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),t.exit("reference"),e):n(r)}}},X9={name:"labelStartImage",resolveAll:Ch.resolveAll,tokenize:function(t,e,n){const o=this;return function(i){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(i),t.exit("labelImageMarker"),r};function r(i){return i===91?(t.enter("labelMarker"),t.consume(i),t.exit("labelMarker"),t.exit("labelImage"),s):n(i)}function s(i){return i===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(i):e(i)}}},Z9={name:"labelStartLink",resolveAll:Ch.resolveAll,tokenize:function(t,e,n){const o=this;return function(s){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelLink"),r};function r(s){return s===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(s):e(s)}}},Nh={name:"lineEnding",tokenize:function(t,e){return function(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),_t(t,e,"linePrefix")}}},zl={name:"thematicBreak",tokenize:function(t,e,n){let o,r=0;return function(a){return t.enter("thematicBreak"),function(l){return o=l,s(l)}(a)};function s(a){return a===o?(t.enter("thematicBreakSequence"),i(a)):r>=3&&(a===null||Ze(a))?(t.exit("thematicBreak"),e(a)):n(a)}function i(a){return a===o?(t.consume(a),r++,i):(t.exit("thematicBreakSequence"),ht(a)?_t(t,s,"whitespace")(a):s(a))}}},yn={continuation:{tokenize:function(t,e,n){const o=this;return o.containerState._closeFlow=void 0,t.check(Fl,r,s);function r(a){return o.containerState.furtherBlankLines=o.containerState.furtherBlankLines||o.containerState.initialBlankLine,_t(t,e,"listItemIndent",o.containerState.size+1)(a)}function s(a){return o.containerState.furtherBlankLines||!ht(a)?(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,i(a)):(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,t.attempt(eD,e,i)(a))}function i(a){return o.containerState._closeFlow=!0,o.interrupt=void 0,_t(t,t.attempt(yn,e,n),"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}},exit:function(t){t.exit(this.containerState.type)},name:"list",tokenize:function(t,e,n){const o=this,r=o.events[o.events.length-1];let s=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,i=0;return function(f){const m=o.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!o.containerState.marker||f===o.containerState.marker:wh(f)){if(o.containerState.type||(o.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check(zl,n,l)(f):l(f);if(!o.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),a(f)}return n(f)};function a(f){return wh(f)&&++i<10?(t.consume(f),a):(!o.interrupt||i<2)&&(o.containerState.marker?f===o.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),l(f)):n(f)}function l(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),o.containerState.marker=o.containerState.marker||f,t.check(Fl,o.interrupt?n:c,t.attempt(Q9,h,d))}function c(f){return o.containerState.initialBlankLine=!0,s++,h(f)}function d(f){return ht(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),h):n(f)}function h(f){return o.containerState.size=s+o.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}},Q9={partial:!0,tokenize:function(t,e,n){const o=this;return _t(t,function(r){const s=o.events[o.events.length-1];return!ht(r)&&s&&s[1].type==="listItemPrefixWhitespace"?e(r):n(r)},"listItemPrefixWhitespace",o.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},eD={partial:!0,tokenize:function(t,e,n){const o=this;return _t(t,function(r){const s=o.events[o.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===o.containerState.size?e(r):n(r)},"listItemIndent",o.containerState.size+1)}},Qw={name:"setextUnderline",resolveTo:function(t,e){let n,o,r,s=t.length;for(;s--;)if(t[s][0]==="enter"){if(t[s][1].type==="content"){n=s;break}t[s][1].type==="paragraph"&&(o=s)}else t[s][1].type==="content"&&t.splice(s,1),r||t[s][1].type!=="definition"||(r=s);const i={type:"setextHeading",start:{...t[o][1].start},end:{...t[t.length-1][1].end}};return t[o][1].type="setextHeadingText",r?(t.splice(o,0,["enter",i,e]),t.splice(r+1,0,["exit",t[n][1],e]),t[n][1].end={...t[r][1].end}):t[n][1]=i,t.push(["exit",i,e]),t},tokenize:function(t,e,n){const o=this;let r;return function(a){let l,c=o.events.length;for(;c--;)if(o.events[c][1].type!=="lineEnding"&&o.events[c][1].type!=="linePrefix"&&o.events[c][1].type!=="content"){l=o.events[c][1].type==="paragraph";break}return!o.parser.lazy[o.now().line]&&(o.interrupt||l)?(t.enter("setextHeadingLine"),r=a,function(d){return t.enter("setextHeadingLineSequence"),s(d)}(a)):n(a)};function s(a){return a===r?(t.consume(a),s):(t.exit("setextHeadingLineSequence"),ht(a)?_t(t,i,"lineSuffix")(a):i(a))}function i(a){return a===null||Ze(a)?(t.exit("setextHeadingLine"),e(a)):n(a)}}},tD={tokenize:function(t){const e=this,n=t.attempt(Fl,function(r){return r===null?void t.consume(r):(t.enter("lineEndingBlank"),t.consume(r),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n)},t.attempt(this.parser.constructs.flowInitial,o,_t(t,t.attempt(this.parser.constructs.flow,o,t.attempt(L9,o)),"linePrefix")));return n;function o(r){if(r!==null)return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),e.currentConstruct=void 0,n;t.consume(r)}}},nD={resolveAll:tv()},oD=ev("string"),rD=ev("text");function ev(t){return{resolveAll:tv(t==="text"?sD:void 0),tokenize:function(e){const n=this,o=this.parser.constructs[t],r=e.attempt(o,s,i);return s;function s(c){return l(c)?r(c):i(c)}function i(c){if(c!==null)return e.enter("data"),e.consume(c),a;e.consume(c)}function a(c){return l(c)?(e.exit("data"),r(c)):(e.consume(c),a)}function l(c){if(c===null)return!0;const d=o[c];let h=-1;if(d)for(;++h<d.length;){const f=d[h];if(!f.previous||f.previous.call(n,n.previous))return!0}return!1}}}}function tv(t){return function(e,n){let o,r=-1;for(;++r<=e.length;)o===void 0?e[r]&&e[r][1].type==="data"&&(o=r,r++):e[r]&&e[r][1].type==="data"||(r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),r=o+2),o=void 0);return t?t(e,n):e}}function sD(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const o=t[n-1][1],r=e.sliceStream(o);let s,i=r.length,a=-1,l=0;for(;i--;){const c=r[i];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(c===-2)s=!0,l++;else if(c!==-1){i++;break}}if(l){const c={type:n===t.length||s||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:o.start._bufferIndex+a,_index:o.start._index+i,line:o.end.line,column:o.end.column-l,offset:o.end.offset-l},end:{...o.end}};o.end={...c.start},o.start.offset===o.end.offset?Object.assign(o,c):(t.splice(n,0,["enter",c,e],["exit",c,e]),n+=2)}n++}return t}const iD={42:yn,43:yn,45:yn,48:yn,49:yn,50:yn,51:yn,52:yn,53:yn,54:yn,55:yn,56:yn,57:yn,62:$w},aD={91:z9},lD={[-2]:Sh,[-1]:Sh,32:Sh},cD={35:V9,42:zl,45:[Qw,zl],60:H9,61:Qw,95:zl,96:Gw,126:Gw},dD={38:Ww,92:Hw},uD={[-5]:Nh,[-4]:Nh,[-3]:Nh,33:X9,38:Ww,42:kh,60:[M9,G9],91:Z9,92:[U9,Hw],93:Ch,95:kh,96:D9},hD={null:[kh,nD]},fD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:aD,disable:{null:[]},document:iD,flow:cD,flowInitial:lD,insideSpan:hD,string:dD,text:uD},Symbol.toStringTag,{value:"Module"}));function mD(t,e,n){let o={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const r={},s=[];let i=[],a=[];const l={attempt:p(function(x,k){b(x,k.from)}),check:p(g),consume:function(x){Ze(x)?(o.line++,o.column=1,o.offset+=x===-3?2:1,y()):x!==-1&&(o.column++,o.offset++),o._bufferIndex<0?o._index++:(o._bufferIndex++,o._bufferIndex===i[o._index].length&&(o._bufferIndex=-1,o._index++)),c.previous=x},enter:function(x,k){const C=k||{};return C.type=x,C.start=f(),c.events.push(["enter",C,c]),a.push(C),C},exit:function(x){const k=a.pop();return k.end=f(),c.events.push(["exit",k,c]),k},interrupt:p(g,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(x){r[x.line]=x.column,y()},events:[],now:f,parser:t,previous:null,sliceSerialize:function(x,k){return function(C,v){let E=-1;const N=[];let I;for(;++E<C.length;){const A=C[E];let M;if(typeof A=="string")M=A;else switch(A){case-5:M="\r";break;case-4:M=`
|
126
|
+
`;break;case-3:M=`\r
|
127
|
+
`;break;case-2:M=v?" ":" ";break;case-1:if(!v&&I)continue;M=" ";break;default:M=String.fromCharCode(A)}I=A===-2,N.push(M)}return N.join("")}(h(x),k)},sliceStream:h,write:function(x){return i=Un(i,x),m(),i[i.length-1]!==null?[]:(b(e,0),c.events=vh(s,c.events,c),c.events)}};let d=e.tokenize.call(c,l);return e.resolveAll&&s.push(e),c;function h(x){return function(k,C){const v=C.start._index,E=C.start._bufferIndex,N=C.end._index,I=C.end._bufferIndex;let A;if(v===N)A=[k[v].slice(E,I)];else{if(A=k.slice(v,N),E>-1){const M=A[0];typeof M=="string"?A[0]=M.slice(E):A.shift()}I>0&&A.push(k[N].slice(0,I))}return A}(i,x)}function f(){const{_bufferIndex:x,_index:k,line:C,column:v,offset:E}=o;return{_bufferIndex:x,_index:k,line:C,column:v,offset:E}}function m(){let x;for(;o._index<i.length;){const k=i[o._index];if(typeof k=="string")for(x=o._index,o._bufferIndex<0&&(o._bufferIndex=0);o._index===x&&o._bufferIndex<k.length;)_(k.charCodeAt(o._bufferIndex));else _(k)}}function _(x){d=d(x)}function g(x,k){k.restore()}function p(x,k){return function(C,v,E){let N,I,A,M;return Array.isArray(C)?R(C):"tokenize"in C?R([C]):function(B){return U;function U(O){const S=O!==null&&B[O],$=O!==null&&B.null;return R([...Array.isArray(S)?S:S?[S]:[],...Array.isArray($)?$:$?[$]:[]])(O)}}(C);function R(B){return N=B,I=0,B.length===0?E:z(B[I])}function z(B){return function(U){return M=function(){const O=f(),S=c.previous,$=c.currentConstruct,j=c.events.length,W=Array.from(a);return{from:j,restore:X};function X(){o=O,c.previous=S,c.currentConstruct=$,c.events.length=j,a=W,y()}}(),A=B,B.partial||(c.currentConstruct=B),B.name&&c.parser.constructs.disable.null.includes(B.name)?F():B.tokenize.call(k?Object.assign(Object.create(c),k):c,l,D,F)(U)}}function D(B){return x(A,M),v}function F(B){return M.restore(),++I<N.length?z(N[I]):E}}}function b(x,k){x.resolveAll&&!s.includes(x)&&s.push(x),x.resolve&&uo(c.events,k,c.events.length-k,x.resolve(c.events.slice(k),c)),x.resolveTo&&(c.events=x.resolveTo(c.events,c))}function y(){o.line in r&&o.column<2&&(o.column=r[o.line],o.offset+=r[o.line]-1)}}function pD(t){const e=function(r){const s={};let i=-1;for(;++i<r.length;)k9(s,r[i]);return s}([fD,...(t||{}).extensions||[]]),n={constructs:e,content:o(A9),defined:[],document:o(T9),flow:o(tD),lazy:{},string:o(oD),text:o(rD)};return n;function o(r){return function(s){return mD(n,r,s)}}}const nv=/[\0\t\n\r]/g,gD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function _D(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),r=o===120||o===88;return zw(n.slice(r?2:1),r?16:10)}return yh(n)||t}const ov={}.hasOwnProperty;function bD(t,e,n){return typeof e!="string"&&(n=e,e=void 0),function(o){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(ze),autolinkProtocol:R,autolinkEmail:R,atxHeading:l(se),blockQuote:l(ce),characterEscape:R,characterReference:R,codeFenced:l(fe),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:l(fe,c),codeText:l(de,c),codeTextData:R,data:R,codeFlowValue:R,definition:l(Ce),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:l(Ne),hardBreakEscape:l(Ie),hardBreakTrailing:l(Ie),htmlFlow:l(be,c),htmlFlowData:R,htmlText:l(be,c),htmlTextData:R,image:l(Oe),label:c,link:l(ze),listItem:l(Je),listItemValue:g,listOrdered:l(Ge,_),listUnordered:l(Ge),paragraph:l(Le),reference:ne,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:l(se),strong:l(et),thematicBreak:l(tt)},exit:{atxHeading:h(),atxHeadingSequence:N,autolink:h(),autolinkEmail:pe,autolinkProtocol:he,blockQuote:h(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:Z,characterReference:Q,codeFenced:h(x),codeFencedFence:y,codeFencedFenceInfo:p,codeFencedFenceMeta:b,codeFlowValue:z,codeIndented:h(k),codeText:h(O),codeTextData:z,data:z,definition:h(),definitionDestinationString:E,definitionLabelString:C,definitionTitleString:v,emphasis:h(),hardBreakEscape:h(F),hardBreakTrailing:h(F),htmlFlow:h(B),htmlFlowData:z,htmlText:h(U),htmlTextData:z,image:h($),label:W,labelText:j,lineEnding:D,link:h(S),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:re,resourceDestinationString:X,resourceTitleString:Y,resource:q,setextHeading:h(M),setextHeadingLineSequence:A,setextHeadingText:I,strong:h(),thematicBreak:h()}};rv(r,(o||{}).mdastExtensions||[]);const s={};return i;function i(te){let ye={type:"root",children:[]};const ke={stack:[ye],tokenStack:[],config:r,enter:d,exit:f,buffer:c,resume:m,data:s},Me=[];let G=-1;for(;++G<te.length;)(te[G][1].type==="listOrdered"||te[G][1].type==="listUnordered")&&(te[G][0]==="enter"?Me.push(G):G=a(te,Me.pop(),G));for(G=-1;++G<te.length;){const ge=r[te[G][0]];ov.call(ge,te[G][1].type)&&ge[te[G][1].type].call(Object.assign({sliceSerialize:te[G][2].sliceSerialize},ke),te[G][1])}if(ke.tokenStack.length>0){const ge=ke.tokenStack[ke.tokenStack.length-1];(ge[1]||sv).call(ke,void 0,ge[0])}for(ye.position={start:Qo(te.length>0?te[0][1].start:{line:1,column:1,offset:0}),end:Qo(te.length>0?te[te.length-2][1].end:{line:1,column:1,offset:0})},G=-1;++G<r.transforms.length;)ye=r.transforms[G](ye)||ye;return ye}function a(te,ye,ke){let Me,G,ge,_e,me=ye-1,le=-1,Ve=!1;for(;++me<=ke;){const Fe=te[me];switch(Fe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":Fe[0]==="enter"?le++:le--,_e=void 0;break;case"lineEndingBlank":Fe[0]==="enter"&&(!Me||_e||le||ge||(ge=me),_e=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:_e=void 0}if(!le&&Fe[0]==="enter"&&Fe[1].type==="listItemPrefix"||le===-1&&Fe[0]==="exit"&&(Fe[1].type==="listUnordered"||Fe[1].type==="listOrdered")){if(Me){let Ke=me;for(G=void 0;Ke--;){const ie=te[Ke];if(ie[1].type==="lineEnding"||ie[1].type==="lineEndingBlank"){if(ie[0]==="exit")continue;G&&(te[G][1].type="lineEndingBlank",Ve=!0),ie[1].type="lineEnding",G=Ke}else if(ie[1].type!=="linePrefix"&&ie[1].type!=="blockQuotePrefix"&&ie[1].type!=="blockQuotePrefixWhitespace"&&ie[1].type!=="blockQuoteMarker"&&ie[1].type!=="listItemIndent")break}ge&&(!G||ge<G)&&(Me._spread=!0),Me.end=Object.assign({},G?te[G][1].start:Fe[1].end),te.splice(G||me,0,["exit",Me,Fe[2]]),me++,ke++}if(Fe[1].type==="listItemPrefix"){const Ke={type:"listItem",_spread:!1,start:Object.assign({},Fe[1].start),end:void 0};Me=Ke,te.splice(me,0,["enter",Ke,Fe[2]]),me++,ke++,ge=void 0,_e=!0}}}return te[ye][1]._spread=Ve,ke}function l(te,ye){return ke;function ke(Me){d.call(this,te(Me),Me),ye&&ye.call(this,Me)}}function c(){this.stack.push({type:"fragment",children:[]})}function d(te,ye,ke){this.stack[this.stack.length-1].children.push(te),this.stack.push(te),this.tokenStack.push([ye,ke||void 0]),te.position={start:Qo(ye.start),end:void 0}}function h(te){return ye;function ye(ke){te&&te.call(this,ke),f.call(this,ke)}}function f(te,ye){const ke=this.stack.pop(),Me=this.tokenStack.pop();if(!Me)throw new Error("Cannot close `"+te.type+"` ("+Bi({start:te.start,end:te.end})+"): it\u2019s not open");Me[0].type!==te.type&&(ye?ye.call(this,te,Me[0]):(Me[1]||sv).call(this,te,Me[0])),ke.position.end=Qo(te.end)}function m(){return function(te){return Rw(te,typeof Ll.includeImageAlt!="boolean"||Ll.includeImageAlt,typeof Ll.includeHtml!="boolean"||Ll.includeHtml)}(this.stack.pop())}function _(){this.data.expectingFirstListItemValue=!0}function g(te){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(te),10),this.data.expectingFirstListItemValue=void 0)}function p(){const te=this.resume();this.stack[this.stack.length-1].lang=te}function b(){const te=this.resume();this.stack[this.stack.length-1].meta=te}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const te=this.resume();this.stack[this.stack.length-1].value=te.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const te=this.resume();this.stack[this.stack.length-1].value=te.replace(/(\r?\n|\r)$/g,"")}function C(te){const ye=this.resume(),ke=this.stack[this.stack.length-1];ke.label=ye,ke.identifier=ms(this.sliceSerialize(te)).toLowerCase()}function v(){const te=this.resume();this.stack[this.stack.length-1].title=te}function E(){const te=this.resume();this.stack[this.stack.length-1].url=te}function N(te){const ye=this.stack[this.stack.length-1];if(!ye.depth){const ke=this.sliceSerialize(te).length;ye.depth=ke}}function I(){this.data.setextHeadingSlurpLineEnding=!0}function A(te){this.stack[this.stack.length-1].depth=this.sliceSerialize(te).codePointAt(0)===61?1:2}function M(){this.data.setextHeadingSlurpLineEnding=void 0}function R(te){const ye=this.stack[this.stack.length-1].children;let ke=ye[ye.length-1];ke&&ke.type==="text"||(ke=Qe(),ke.position={start:Qo(te.start),end:void 0},ye.push(ke)),this.stack.push(ke)}function z(te){const ye=this.stack.pop();ye.value+=this.sliceSerialize(te),ye.position.end=Qo(te.end)}function D(te){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak)return ye.children[ye.children.length-1].position.end=Qo(te.end),void(this.data.atHardBreak=void 0);!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(ye.type)&&(R.call(this,te),z.call(this,te))}function F(){this.data.atHardBreak=!0}function B(){const te=this.resume();this.stack[this.stack.length-1].value=te}function U(){const te=this.resume();this.stack[this.stack.length-1].value=te}function O(){const te=this.resume();this.stack[this.stack.length-1].value=te}function S(){const te=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";te.type+="Reference",te.referenceType=ye,delete te.url,delete te.title}else delete te.identifier,delete te.label;this.data.referenceType=void 0}function $(){const te=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";te.type+="Reference",te.referenceType=ye,delete te.url,delete te.title}else delete te.identifier,delete te.label;this.data.referenceType=void 0}function j(te){const ye=this.sliceSerialize(te),ke=this.stack[this.stack.length-2];ke.label=function(Me){return Me.replace(gD,_D)}(ye),ke.identifier=ms(ye).toLowerCase()}function W(){const te=this.stack[this.stack.length-1],ye=this.resume(),ke=this.stack[this.stack.length-1];if(this.data.inReference=!0,ke.type==="link"){const Me=te.children;ke.children=Me}else ke.alt=ye}function X(){const te=this.resume();this.stack[this.stack.length-1].url=te}function Y(){const te=this.resume();this.stack[this.stack.length-1].title=te}function q(){this.data.inReference=void 0}function ne(){this.data.referenceType="collapsed"}function re(te){const ye=this.resume(),ke=this.stack[this.stack.length-1];ke.label=ye,ke.identifier=ms(this.sliceSerialize(te)).toLowerCase(),this.data.referenceType="full"}function ae(te){this.data.characterReferenceType=te.type}function Z(te){const ye=this.sliceSerialize(te),ke=this.data.characterReferenceType;let Me;ke?(Me=zw(ye,ke==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Me=yh(ye),this.stack[this.stack.length-1].value+=Me}function Q(te){this.stack.pop().position.end=Qo(te.end)}function he(te){z.call(this,te),this.stack[this.stack.length-1].url=this.sliceSerialize(te)}function pe(te){z.call(this,te),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(te)}function ce(){return{type:"blockquote",children:[]}}function fe(){return{type:"code",lang:null,meta:null,value:""}}function de(){return{type:"inlineCode",value:""}}function Ce(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ne(){return{type:"emphasis",children:[]}}function se(){return{type:"heading",depth:0,children:[]}}function Ie(){return{type:"break"}}function be(){return{type:"html",value:""}}function Oe(){return{type:"image",title:null,url:"",alt:null}}function ze(){return{type:"link",title:null,url:"",children:[]}}function Ge(te){return{type:"list",ordered:te.type==="listOrdered",start:null,spread:te._spread,children:[]}}function Je(te){return{type:"listItem",spread:te._spread,checked:null,children:[]}}function Le(){return{type:"paragraph",children:[]}}function et(){return{type:"strong",children:[]}}function Qe(){return{type:"text",value:""}}function tt(){return{type:"thematicBreak"}}}(n)(function(o){for(;!Yw(o););return o}(pD(n).document().write(function(){let o,r=1,s="",i=!0;return function(a,l,c){const d=[];let h,f,m,_,g;for(a=s+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a)),m=0,s="",i&&(a.charCodeAt(0)===65279&&m++,i=void 0);m<a.length;){if(nv.lastIndex=m,h=nv.exec(a),_=h&&h.index!==void 0?h.index:a.length,g=a.charCodeAt(_),!h){s=a.slice(m);break}if(g===10&&m===_&&o)d.push(-3),o=void 0;else switch(o&&(d.push(-5),o=void 0),m<_&&(d.push(a.slice(m,_)),r+=_-m),g){case 0:d.push(65533),r++;break;case 9:for(f=4*Math.ceil(r/4),d.push(-2);r++<f;)d.push(-1);break;case 10:d.push(-4),r=1;break;default:o=!0,r=1}m=_+1}return c&&(o&&d.push(-5),s&&d.push(s),d.push(null)),d}}()(t,e,!0))))}function Qo(t){return{line:t.line,column:t.column,offset:t.offset}}function rv(t,e){let n=-1;for(;++n<e.length;){const o=e[n];Array.isArray(o)?rv(t,o):yD(t,o)}}function yD(t,e){let n;for(n in e)if(ov.call(e,n))switch(n){case"canContainEols":{const o=e[n];o&&t[n].push(...o);break}case"transforms":{const o=e[n];o&&t[n].push(...o);break}case"enter":case"exit":{const o=e[n];o&&Object.assign(t[n],o);break}}}function sv(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Bi({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Bi({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Bi({start:e.start,end:e.end})+") is still open")}function xD(t){const e=this;e.parser=function(n){return bD(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function iv(t,e){const n=e.referenceType;let o="]";if(n==="collapsed"?o+="[]":n==="full"&&(o+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+o}];const r=t.all(e),s=r[0];s&&s.type==="text"?s.value="["+s.value:r.unshift({type:"text",value:"["});const i=r[r.length-1];return i&&i.type==="text"?i.value+=o:r.push({type:"text",value:o}),r}function av(t){const e=t.spread;return e??t.children.length>1}function wD(t){const e=String(t),n=/\r?\n|\r/g;let o=n.exec(e),r=0;const s=[];for(;o;)s.push(lv(e.slice(r,o.index),r>0,!0),o[0]),r=o.index+o[0].length,o=n.exec(e);return s.push(lv(e.slice(r),r>0,!1)),s.join("")}function lv(t,e,n){let o=0,r=t.length;if(e){let s=t.codePointAt(o);for(;s===9||s===32;)o++,s=t.codePointAt(o)}if(n){let s=t.codePointAt(r-1);for(;s===9||s===32;)r--,s=t.codePointAt(r-1)}return r>o?t.slice(o,r):""}const vD={blockquote:function(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)},break:function(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
|
128
|
+
`}]},code:function(t,e){const n=e.value?e.value+`
|
129
|
+
`:"",o={};e.lang&&(o.className=["language-"+e.lang]);let r={type:"element",tagName:"code",properties:o,children:[{type:"text",value:n}]};return e.meta&&(r.data={meta:e.meta}),t.patch(e,r),r=t.applyData(e,r),r={type:"element",tagName:"pre",properties:{},children:[r]},t.patch(e,r),r},delete:function(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},emphasis:function(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},footnoteReference:function(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",o=String(e.identifier).toUpperCase(),r=ps(o.toLowerCase()),s=t.footnoteOrder.indexOf(o);let i,a=t.footnoteCounts.get(o);a===void 0?(a=0,t.footnoteOrder.push(o),i=t.footnoteOrder.length):i=s+1,a+=1,t.footnoteCounts.set(o,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+r,id:n+"fnref-"+r+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};t.patch(e,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,c),t.applyData(e,c)},heading:function(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},html:function(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}},imageReference:function(t,e){const n=String(e.identifier).toUpperCase(),o=t.definitionById.get(n);if(!o)return iv(t,e);const r={src:ps(o.url||""),alt:e.alt};o.title!==null&&o.title!==void 0&&(r.title=o.title);const s={type:"element",tagName:"img",properties:r,children:[]};return t.patch(e,s),t.applyData(e,s)},image:function(t,e){const n={src:ps(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const o={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,o),t.applyData(e,o)},inlineCode:function(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const o={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,o),t.applyData(e,o)},linkReference:function(t,e){const n=String(e.identifier).toUpperCase(),o=t.definitionById.get(n);if(!o)return iv(t,e);const r={href:ps(o.url||"")};o.title!==null&&o.title!==void 0&&(r.title=o.title);const s={type:"element",tagName:"a",properties:r,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)},link:function(t,e){const n={href:ps(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const o={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,o),t.applyData(e,o)},listItem:function(t,e,n){const o=t.all(e),r=n?function(d){let h=!1;if(d.type==="list"){h=d.spread||!1;const f=d.children;let m=-1;for(;!h&&++m<f.length;)h=av(f[m])}return h}(n):av(e),s={},i=[];if(typeof e.checked=="boolean"){const d=o[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},o.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<o.length;){const d=o[a];(r||a!==0||d.type!=="element"||d.tagName!=="p")&&i.push({type:"text",value:`
|
130
|
+
`}),d.type!=="element"||d.tagName!=="p"||r?i.push(d):i.push(...d.children)}const l=o[o.length-1];l&&(r||l.type!=="element"||l.tagName!=="p")&&i.push({type:"text",value:`
|
131
|
+
`});const c={type:"element",tagName:"li",properties:s,children:i};return t.patch(e,c),t.applyData(e,c)},list:function(t,e){const n={},o=t.all(e);let r=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++r<o.length;){const i=o[r];if(i.type==="element"&&i.tagName==="li"&&i.properties&&Array.isArray(i.properties.className)&&i.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(o,!0)};return t.patch(e,s),t.applyData(e,s)},paragraph:function(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},root:function(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)},strong:function(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},table:function(t,e){const n=t.all(e),o=n.shift(),r=[];if(o){const i={type:"element",tagName:"thead",properties:{},children:t.wrap([o],!0)};t.patch(e.children[0],i),r.push(i)}if(n.length>0){const i={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},a=fh(e.children[1]),l=jw(e.children[e.children.length-1]);a&&l&&(i.position={start:a,end:l}),r.push(i)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(r,!0)};return t.patch(e,s),t.applyData(e,s)},tableCell:function(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)},tableRow:function(t,e,n){const o=n?n.children:void 0,r=(o?o.indexOf(e):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,i=s?s.length:e.children.length;let a=-1;const l=[];for(;++a<i;){const d=e.children[a],h={},f=s?s[a]:void 0;f&&(h.align=f);let m={type:"element",tagName:r,properties:h,children:[]};d&&(m.children=t.all(d),t.patch(d,m),m=t.applyData(d,m)),l.push(m)}const c={type:"element",tagName:"tr",properties:{},children:t.wrap(l,!0)};return t.patch(e,c),t.applyData(e,c)},text:function(t,e){const n={type:"text",value:wD(String(e.value))};return t.patch(e,n),t.applyData(e,n)},thematicBreak:function(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)},toml:Bl,yaml:Bl,definition:Bl,footnoteDefinition:Bl};function Bl(){}const cv=typeof self=="object"?self:globalThis,dv=t=>((e,n)=>{const o=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,a]=n[s];switch(i){case 0:case-1:return o(a,s);case 1:{const l=o([],s);for(const c of a)l.push(r(c));return l}case 2:{const l=o({},s);for(const[c,d]of a)l[r(c)]=r(d);return l}case 3:return o(new Date(a),s);case 4:{const{source:l,flags:c}=a;return o(new RegExp(l,c),s)}case 5:{const l=o(new Map,s);for(const[c,d]of a)l.set(r(c),r(d));return l}case 6:{const l=o(new Set,s);for(const c of a)l.add(r(c));return l}case 7:{const{name:l,message:c}=a;return o(new cv[l](c),s)}case 8:return o(BigInt(a),s);case"BigInt":return o(Object(BigInt(a)),s)}return o(new cv[i](a),s)};return r})(new Map,t)(0),gs="",{toString:kD}={},{keys:SD}=Object,Hi=t=>{const e=typeof t;if(e!=="object"||!t)return[0,e];const n=kD.call(t).slice(8,-1);switch(n){case"Array":return[1,gs];case"Object":return[2,gs];case"Date":return[3,gs];case"RegExp":return[4,gs];case"Map":return[5,gs];case"Set":return[6,gs]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},Ul=([t,e])=>t===0&&(e==="function"||e==="symbol"),uv=(t,{json:e,lossy:n}={})=>{const o=[];return((r,s,i,a)=>{const l=(d,h)=>{const f=a.push(d)-1;return i.set(h,f),f},c=d=>{if(i.has(d))return i.get(d);let[h,f]=Hi(d);switch(h){case 0:{let _=d;switch(f){case"bigint":h=8,_=d.toString();break;case"function":case"symbol":if(r)throw new TypeError("unable to serialize "+f);_=null;break;case"undefined":return l([-1],d)}return l([h,_],d)}case 1:{if(f)return l([f,[...d]],d);const _=[],g=l([h,_],d);for(const p of d)_.push(c(p));return g}case 2:{if(f)switch(f){case"BigInt":return l([f,d.toString()],d);case"Boolean":case"Number":case"String":return l([f,d.valueOf()],d)}if(s&&"toJSON"in d)return c(d.toJSON());const _=[],g=l([h,_],d);for(const p of SD(d))!r&&Ul(Hi(d[p]))||_.push([c(p),c(d[p])]);return g}case 3:return l([h,d.toISOString()],d);case 4:{const{source:_,flags:g}=d;return l([h,{source:_,flags:g}],d)}case 5:{const _=[],g=l([h,_],d);for(const[p,b]of d)(r||!Ul(Hi(p))&&!Ul(Hi(b)))&&_.push([c(p),c(b)]);return g}case 6:{const _=[],g=l([h,_],d);for(const p of d)!r&&Ul(Hi(p))||_.push(c(p));return g}}const{message:m}=d;return l([h,{name:f,message:m}],d)};return c})(!(e||n),!!e,new Map,o)(t),o},Vl=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?dv(uv(t,e)):structuredClone(t):(t,e)=>dv(uv(t,e));function CD(t,e){const n=[{type:"text",value:"\u21A9"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function ND(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}const hv=function(t){if(t==null)return jD;if(typeof t=="function")return $l(t);if(typeof t=="object")return Array.isArray(t)?function(e){const n=[];let o=-1;for(;++o<e.length;)n[o]=hv(e[o]);return $l(r);function r(...s){let i=-1;for(;++i<n.length;)if(n[i].apply(this,s))return!0;return!1}}(t):function(e){const n=e;return $l(o);function o(r){const s=r;let i;for(i in e)if(s[i]!==n[i])return!1;return!0}}(t);if(typeof t=="string")return function(e){return $l(n);function n(o){return o&&o.type===e}}(t);throw new Error("Expected function, string, or object as test")};function $l(t){return function(e,n,o){return!!(function(r){return r!==null&&typeof r=="object"&&"type"in r}(e)&&t.call(this,e,typeof n=="number"?n:void 0,o||void 0))}}function jD(){return!0}const fv=[],ED=!0,mv=!1;function ID(t,e,n,o){let r;typeof e=="function"&&typeof n!="function"?(o=n,n=e):r=e;const s=hv(r),i=o?-1:1;(function a(l,c,d){const h=l&&typeof l=="object"?l:{};if(typeof h.type=="string"){const m=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(f,"name",{value:"node ("+l.type+(m?"<"+m+">":"")+")"})}return f;function f(){let m,_,g,p=fv;if((!e||s(l,c,d[d.length-1]||void 0))&&(p=function(b){return Array.isArray(b)?b:typeof b=="number"?[ED,b]:b==null?fv:[b]}(n(l,d)),p[0]===mv))return p;if("children"in l&&l.children){const b=l;if(b.children&&p[0]!=="skip")for(_=(o?b.children.length:-1)+i,g=d.concat(b);_>-1&&_<b.children.length;){const y=b.children[_];if(m=a(y,_,g)(),m[0]===mv)return m;_=typeof m[1]=="number"?m[1]:_+i}}return p}})(t,void 0,[])()}function pv(t,e,n,o){let r,s,i;typeof e=="function"?(s=void 0,i=e,r=n):(s=e,i=n,r=o),ID(t,s,function(a,l){const c=l[l.length-1],d=c?c.children.indexOf(a):void 0;return i(a,d,c)},r)}const jh={}.hasOwnProperty,AD={};function TD(t,e){t.position&&(e.position=function(n){const o=fh(n),r=jw(n);if(o&&r)return{start:o,end:r}}(t))}function MD(t,e){let n=e;if(t&&t.data){const o=t.data.hName,r=t.data.hChildren,s=t.data.hProperties;typeof o=="string"&&(n.type==="element"?n.tagName=o:n={type:"element",tagName:o,properties:{},children:"children"in n?n.children:[n]}),n.type==="element"&&s&&Object.assign(n.properties,Vl(s)),"children"in n&&n.children&&r!=null&&(n.children=r)}return n}function OD(t,e){const n=e.data||{},o=!("value"in e)||jh.call(n,"hProperties")||jh.call(n,"hChildren")?{type:"element",tagName:"div",properties:{},children:t.all(e)}:{type:"text",value:e.value};return t.patch(e,o),t.applyData(e,o)}function DD(t,e){const n=[];let o=-1;for(e&&n.push({type:"text",value:`
|
132
|
+
`});++o<t.length;)o&&n.push({type:"text",value:`
|
133
|
+
`}),n.push(t[o]);return e&&t.length>0&&n.push({type:"text",value:`
|
134
|
+
`}),n}function gv(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function _v(t,e){const n=function(i,a){const l=a||AD,c=new Map,d=new Map,h=new Map,f={...vD,...l.handlers},m={all:function(_){const g=[];if("children"in _){const p=_.children;let b=-1;for(;++b<p.length;){const y=m.one(p[b],_);if(y){if(b&&p[b-1].type==="break"&&(Array.isArray(y)||y.type!=="text"||(y.value=gv(y.value)),!Array.isArray(y)&&y.type==="element")){const x=y.children[0];x&&x.type==="text"&&(x.value=gv(x.value))}Array.isArray(y)?g.push(...y):g.push(y)}}}return g},applyData:MD,definitionById:c,footnoteById:d,footnoteCounts:h,footnoteOrder:[],handlers:f,one:function(_,g){const p=_.type,b=m.handlers[p];if(jh.call(m.handlers,p)&&b)return b(m,_,g);if(m.options.passThrough&&m.options.passThrough.includes(p)){if("children"in _){const{children:y,...x}=_,k=Vl(x);return k.children=m.all(_),k}return Vl(_)}return(m.options.unknownHandler||OD)(m,_,g)},options:l,patch:TD,wrap:DD};return pv(i,function(_){if(_.type==="definition"||_.type==="footnoteDefinition"){const g=_.type==="definition"?c:d,p=String(_.identifier).toUpperCase();g.has(p)||g.set(p,_)}}),m}(t,e),o=n.one(t,void 0),r=function(i){const a=typeof i.options.clobberPrefix=="string"?i.options.clobberPrefix:"user-content-",l=i.options.footnoteBackContent||CD,c=i.options.footnoteBackLabel||ND,d=i.options.footnoteLabel||"Footnotes",h=i.options.footnoteLabelTagName||"h2",f=i.options.footnoteLabelProperties||{className:["sr-only"]},m=[];let _=-1;for(;++_<i.footnoteOrder.length;){const g=i.footnoteById.get(i.footnoteOrder[_]);if(!g)continue;const p=i.all(g),b=String(g.identifier).toUpperCase(),y=ps(b.toLowerCase());let x=0;const k=[],C=i.footnoteCounts.get(b);for(;C!==void 0&&++x<=C;){k.length>0&&k.push({type:"text",value:" "});let N=typeof l=="string"?l:l(_,x);typeof N=="string"&&(N={type:"text",value:N}),k.push({type:"element",tagName:"a",properties:{href:"#"+a+"fnref-"+y+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof c=="string"?c:c(_,x),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const v=p[p.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const N=v.children[v.children.length-1];N&&N.type==="text"?N.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...k)}else p.push(...k);const E={type:"element",tagName:"li",properties:{id:a+"fn-"+y},children:i.wrap(p,!0)};i.patch(g,E),m.push(E)}if(m.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:h,properties:{...Vl(f),id:"footnote-label"},children:[{type:"text",value:d}]},{type:"text",value:`
|
135
|
+
`},{type:"element",tagName:"ol",properties:{},children:i.wrap(m,!0)},{type:"text",value:`
|
136
|
+
`}]}}(n),s=Array.isArray(o)?{type:"root",children:o}:o||{type:"root",children:[]};return r&&s.children.push({type:"text",value:`
|
137
|
+
`},r),s}function RD(t,e){return t&&"run"in t?async function(n,o){const r=_v(n,{file:o,...e});await t.run(r,o)}:function(n,o){return _v(n,{file:o,...t||e})}}function bv(t){if(t)throw t}var Eh,yv,PD=function(){if(yv)return Eh;yv=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,r=function(l){return typeof Array.isArray=="function"?Array.isArray(l):e.call(l)==="[object Array]"},s=function(l){if(!l||e.call(l)!=="[object Object]")return!1;var c,d=t.call(l,"constructor"),h=l.constructor&&l.constructor.prototype&&t.call(l.constructor.prototype,"isPrototypeOf");if(l.constructor&&!d&&!h)return!1;for(c in l);return c===void 0||t.call(l,c)},i=function(l,c){n&&c.name==="__proto__"?n(l,c.name,{enumerable:!0,configurable:!0,value:c.newValue,writable:!0}):l[c.name]=c.newValue},a=function(l,c){if(c==="__proto__"){if(!t.call(l,c))return;if(o)return o(l,c).value}return l[c]};return Eh=function l(){var c,d,h,f,m,_,g=arguments[0],p=1,b=arguments.length,y=!1;for(typeof g=="boolean"&&(y=g,g=arguments[1]||{},p=2),(g==null||typeof g!="object"&&typeof g!="function")&&(g={});p<b;++p)if((c=arguments[p])!=null)for(d in c)h=a(g,d),g!==(f=a(c,d))&&(y&&f&&(s(f)||(m=r(f)))?(m?(m=!1,_=h&&r(h)?h:[]):_=h&&s(h)?h:{},i(g,{name:d,newValue:l(y,_,f)})):f!==void 0&&i(g,{name:d,newValue:f}));return g},Eh}();const Ih=hS(PD);function Ah(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return!(e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.toStringTag in t||Symbol.iterator in t)}function LD(){const t=[],e={run:function(...n){let o=-1;const r=n.pop();if(typeof r!="function")throw new TypeError("Expected function as last argument, not "+r);(function s(i,...a){const l=t[++o];let c=-1;if(i)r(i);else{for(;++c<n.length;)a[c]!==null&&a[c]!==void 0||(a[c]=n[c]);n=a,l?function(d,h){let f;return m;function m(...p){const b=d.length>p.length;let y;b&&p.push(_);try{y=d.apply(this,p)}catch(x){if(b&&f)throw x;return _(x)}b||(y&&y.then&&typeof y.then=="function"?y.then(g,_):y instanceof Error?_(y):g(y))}function _(p,...b){f||(f=!0,h(p,...b))}function g(p){_(null,p)}}(l,s)(...a):r(null,...a)}})(null,...n)},use:function(n){if(typeof n!="function")throw new TypeError("Expected `middelware` to be a function, not "+n);return t.push(n),e}};return e}const fo={basename:function(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Wi(t);let n,o=0,r=-1,s=t.length;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(n){o=s+1;break}}else r<0&&(n=!0,r=s+1);return r<0?"":t.slice(o,r)}if(e===t)return"";let i=-1,a=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(n){o=s+1;break}}else i<0&&(n=!0,i=s+1),a>-1&&(t.codePointAt(s)===e.codePointAt(a--)?a<0&&(r=s):(a=-1,r=i));return o===r?r=i:r<0&&(r=t.length),t.slice(o,r)},dirname:function(t){if(Wi(t),t.length===0)return".";let e,n=-1,o=t.length;for(;--o;)if(t.codePointAt(o)===47){if(e){n=o;break}}else e||(e=!0);return n<0?t.codePointAt(0)===47?"/":".":n===1&&t.codePointAt(0)===47?"//":t.slice(0,n)},extname:function(t){Wi(t);let e,n=t.length,o=-1,r=0,s=-1,i=0;for(;n--;){const a=t.codePointAt(n);if(a!==47)o<0&&(e=!0,o=n+1),a===46?s<0?s=n:i!==1&&(i=1):s>-1&&(i=-1);else if(e){r=n+1;break}}return s<0||o<0||i===0||i===1&&s===o-1&&s===r+1?"":t.slice(s,o)},join:function(...t){let e,n=-1;for(;++n<t.length;)Wi(t[n]),t[n]&&(e=e===void 0?t[n]:e+"/"+t[n]);return e===void 0?".":function(o){Wi(o);const r=o.codePointAt(0)===47;let s=function(i,a){let l,c,d="",h=0,f=-1,m=0,_=-1;for(;++_<=i.length;){if(_<i.length)l=i.codePointAt(_);else{if(l===47)break;l=47}if(l===47){if(!(f===_-1||m===1))if(f!==_-1&&m===2){if(d.length<2||h!==2||d.codePointAt(d.length-1)!==46||d.codePointAt(d.length-2)!==46){if(d.length>2){if(c=d.lastIndexOf("/"),c!==d.length-1){c<0?(d="",h=0):(d=d.slice(0,c),h=d.length-1-d.lastIndexOf("/")),f=_,m=0;continue}}else if(d.length>0){d="",h=0,f=_,m=0;continue}}a&&(d=d.length>0?d+"/..":"..",h=2)}else d.length>0?d+="/"+i.slice(f+1,_):d=i.slice(f+1,_),h=_-f-1;f=_,m=0}else l===46&&m>-1?m++:m=-1}return d}(o,!r);return s.length!==0||r||(s="."),s.length>0&&o.codePointAt(o.length-1)===47&&(s+="/"),r?"/"+s:s}(e)},sep:"/"};function Wi(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const FD={cwd:function(){return"/"}};function Th(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function zD(t){if(typeof t=="string")t=new URL(t);else if(!Th(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const n=e.pathname;let o=-1;for(;++o<n.length;)if(n.codePointAt(o)===37&&n.codePointAt(o+1)===50){const r=n.codePointAt(o+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(n)}(t)}const Mh=["history","path","basename","stem","extname","dirname"];class xv{constructor(e){let n;n=e?Th(e)?{path:e}:typeof e=="string"||function(s){return!!(s&&typeof s=="object"&&"byteLength"in s&&"byteOffset"in s)}(e)?{value:e}:e:{},this.cwd="cwd"in n?"":FD.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let o,r=-1;for(;++r<Mh.length;){const s=Mh[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}for(o in n)Mh.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?fo.basename(this.path):void 0}set basename(e){Dh(e,"basename"),Oh(e,"basename"),this.path=fo.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?fo.dirname(this.path):void 0}set dirname(e){wv(this.basename,"dirname"),this.path=fo.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?fo.extname(this.path):void 0}set extname(e){if(Oh(e,"extname"),wv(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=fo.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Th(e)&&(e=zD(e)),Dh(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?fo.basename(this.path,this.extname):void 0}set stem(e){Dh(e,"stem"),Oh(e,"stem"),this.path=fo.join(this.dirname||"",e+(this.extname||""))}fail(e,n,o){const r=this.message(e,n,o);throw r.fatal=!0,r}info(e,n,o){const r=this.message(e,n,o);return r.fatal=void 0,r}message(e,n,o){const r=new nn(e,n,o);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Oh(t,e){if(t&&t.includes(fo.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+fo.sep+"`")}function Dh(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function wv(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}const BD=function(t){const e=this.constructor.prototype,n=e[t],o=function(){return n.apply(o,arguments)};return Object.setPrototypeOf(o,e),o},UD={}.hasOwnProperty;class Rh extends BD{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=LD()}copy(){const e=new Rh;let n=-1;for(;++n<this.attachers.length;){const o=this.attachers[n];e.use(...o)}return e.data(Ih(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(Fh("data",this.frozen),this.namespace[e]=n,this):UD.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Fh("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...o]=this.attachers[this.freezeIndex];if(o[0]===!1)continue;o[0]===!0&&(o[0]=void 0);const r=n.call(e,...o);typeof r=="function"&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=Hl(e),o=this.parser||this.Parser;return Ph("parse",o),o(String(n),n)}process(e,n){const o=this;return this.freeze(),Ph("process",this.parser||this.Parser),Lh("process",this.compiler||this.Compiler),n?r(void 0,n):new Promise(r);function r(s,i){const a=Hl(e),l=o.parse(a);function c(d,h){d||!h?i(d):s?s(h):n(void 0,h)}o.run(l,a,function(d,h,f){if(d||!h||!f)return c(d);const m=h,_=o.stringify(m,f);var g;typeof(g=_)=="string"||function(p){return!!(p&&typeof p=="object"&&"byteLength"in p&&"byteOffset"in p)}(g)?f.value=_:f.result=_,c(d,f)})}}processSync(e){let n,o=!1;return this.freeze(),Ph("processSync",this.parser||this.Parser),Lh("processSync",this.compiler||this.Compiler),this.process(e,function(r,s){o=!0,bv(r),n=s}),kv("processSync","process",o),n}run(e,n,o){vv(e),this.freeze();const r=this.transformers;return o||typeof n!="function"||(o=n,n=void 0),o?s(void 0,o):new Promise(s);function s(i,a){const l=Hl(n);r.run(e,l,function(c,d,h){const f=d||e;c?a(c):i?i(f):o(void 0,f,h)})}}runSync(e,n){let o,r=!1;return this.run(e,n,function(s,i){bv(s),o=i,r=!0}),kv("runSync","run",r),o}stringify(e,n){this.freeze();const o=Hl(n),r=this.compiler||this.Compiler;return Lh("stringify",r),vv(e),r(e,o)}use(e,...n){const o=this.attachers,r=this.namespace;if(Fh("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else{if(typeof e!="object")throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?a(e):i(e)}return this;function s(c){if(typeof c=="function")l(c,[]);else{if(typeof c!="object")throw new TypeError("Expected usable value, not `"+c+"`");if(Array.isArray(c)){const[d,...h]=c;l(d,h)}else i(c)}}function i(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(r.settings=Ih(!0,r.settings,c.settings))}function a(c){let d=-1;if(c!=null){if(!Array.isArray(c))throw new TypeError("Expected a list of plugins, not `"+c+"`");for(;++d<c.length;)s(c[d])}}function l(c,d){let h=-1,f=-1;for(;++h<o.length;)if(o[h][0]===c){f=h;break}if(f===-1)o.push([c,...d]);else if(d.length>0){let[m,..._]=d;const g=o[f][1];Ah(g)&&Ah(m)&&(m=Ih(!0,g,m)),o[f]=[c,m,..._]}}}}const VD=new Rh().freeze();function Ph(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Lh(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Fh(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function vv(t){if(!Ah(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function kv(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Hl(t){return function(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}(t)?t:new xv(t)}const Sv=[],Cv={allowDangerousHtml:!0},$D=/^(https?|ircs?|mailto|xmpp)$/i,HD=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function WD(t){const e=function(o){const r=o.rehypePlugins||Sv,s=o.remarkPlugins||Sv,i=o.remarkRehypeOptions?{...o.remarkRehypeOptions,...Cv}:Cv;return VD().use(xD).use(s).use(RD,i).use(r)}(t),n=function(o){const r=o.children||"",s=new xv;return typeof r=="string"&&(s.value=r),s}(t);return function(o,r){const s=r.allowedElements,i=r.allowElement,a=r.components,l=r.disallowedElements,c=r.skipHtml,d=r.unwrapDisallowed,h=r.urlTransform||qD;for(const m of HD)Object.hasOwn(r,m.from)&&(m.from,m.to&&m.to,m.id,void 0);return r.className&&(o={type:"element",tagName:"div",properties:{className:r.className},children:o.type==="root"?o.children:[o]}),pv(o,f),b9(o,{Fragment:u.Fragment,components:a,ignoreInvalidStyle:!0,jsx:u.jsx,jsxs:u.jsxs,passKeys:!0,passNode:!0});function f(m,_,g){if(m.type==="raw"&&g&&typeof _=="number")return c?g.children.splice(_,1):g.children[_]={type:"text",value:m.value},_;if(m.type==="element"){let p;for(p in bh)if(Object.hasOwn(bh,p)&&Object.hasOwn(m.properties,p)){const b=m.properties[p],y=bh[p];(y===null||y.includes(m.tagName))&&(m.properties[p]=h(String(b||""),p,m))}}if(m.type==="element"){let p=s?!s.includes(m.tagName):!!l&&l.includes(m.tagName);if(!p&&i&&typeof _=="number"&&(p=!i(m,_,g)),p&&g&&typeof _=="number")return d&&m.children?g.children.splice(_,1,...m.children):g.children.splice(_,1),_}}}(e.runSync(e.parse(n),n),t)}function qD(t){const e=t.indexOf(":"),n=t.indexOf("?"),o=t.indexOf("#"),r=t.indexOf("/");return e===-1||r!==-1&&e>r||n!==-1&&e>n||o!==-1&&e>o||$D.test(t.slice(0,e))?t:""}const GD=[st.lineWrapping],YD=new Set(["python","markdown","sql","json","yaml","toml","shell","javascript","typescript","jsx","tsx","css","html"]),JD=t=>{const e=K.c(26),{code:n,language:o}=t,{theme:r}=gr(),{createNewCell:s}=Ot(),i=Br(),a=$e(Bs),[l,c]=T.useState(n);let d,h,f;e[0]!==n?(d=()=>{c(n)},h=[n],e[0]=n,e[1]=d,e[2]=h):(d=e[1],h=e[2]),T.useEffect(d,h),e[3]!==a||e[4]!==s||e[5]!==o||e[6]!==i||e[7]!==l?(f=()=>{const N=function(I,A){return I?I==="python"?{language:I,code:A}:I==="sql"?{language:"python",code:Uc.fromQuery(A)}:I==="markdown"?{language:"python",code:ca.fromMarkdown(A)}:I==="shell"||I==="bash"?{language:"python",code:`import subprocess
|
138
|
+
subprocess.run("${A}")`}:{language:"python",code:`_${I} = """
|
139
|
+
${A}
|
140
|
+
"""`}:{language:"python",code:A}}(o,l);o==="sql"&&ur(a,s,i),s({code:N.code,before:!1,cellId:i??"__end__"})},e[3]=a,e[4]=s,e[5]=o,e[6]=i,e[7]=l,e[8]=f):f=e[8];const m=f;let _;e[9]!==l?(_=async()=>{await xn(l)},e[9]=l,e[10]=_):_=e[10];const g=_,p=r==="dark"?"dark":"light",b=o&&YD.has(o)?o:void 0;let y,x,k,C,v,E;return e[11]!==p||e[12]!==b||e[13]!==l?(y=u.jsx(T.Suspense,{children:u.jsx(va,{theme:p,language:b,className:"cm border rounded overflow-hidden",extensions:GD,value:l,onChange:c})}),e[11]=p,e[12]=b,e[13]=l,e[14]=y):y=e[14],e[15]!==g?(x=u.jsx(KD,{size:"xs",variant:"outline",onClick:g,children:"Copy"}),e[15]=g,e[16]=x):x=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(k=u.jsx(Wr,{className:"ml-2 h-4 w-4"}),e[17]=k):k=e[17],e[18]!==m?(C=u.jsxs(De,{size:"xs",variant:"outline",onClick:m,children:["Add to Notebook",k]}),e[18]=m,e[19]=C):C=e[19],e[20]!==C||e[21]!==x?(v=u.jsxs("div",{className:"flex justify-end mt-2 space-x-2",children:[x,C]}),e[20]=C,e[21]=x,e[22]=v):v=e[22],e[23]!==v||e[24]!==y?(E=u.jsxs("div",{className:"relative",children:[y,v]}),e[23]=v,e[24]=y,e[25]=E):E=e[25],E},KD=t=>{const e=K.c(12);let n,o;e[0]!==t?({onClick:n,...o}=t,e[0]=t,e[1]=n,e[2]=o):(n=e[1],o=e[2]);const[r,s]=T.useState(!1);let i,a,l;e[3]!==r?(i=()=>{r&&setTimeout(()=>s(!1),1e3)},a=[r],e[3]=r,e[4]=i,e[5]=a):(i=e[4],a=e[5]),T.useEffect(i,a),e[6]!==n?(l=h=>{n==null||n(h),s(!0)},e[6]=n,e[7]=l):l=e[7];const c=r?"Copied":"Copy";let d;return e[8]!==o||e[9]!==l||e[10]!==c?(d=u.jsx(De,{...o,onClick:l,children:c}),e[8]=o,e[9]=l,e[10]=c,e[11]=d):d=e[11],d},XD={code:({children:t,className:e})=>{const n=e==null?void 0:e.replace("language-","");return n&&typeof t=="string"?u.jsxs("div",{children:[u.jsx("div",{className:"text-xs text-muted-foreground pl-1",children:n}),u.jsx(JD,{code:t.trim(),language:n})]}):u.jsx("code",{className:e,children:t})}},Nv=T.memo(t=>{const e=K.c(2),{content:n}=t;let o;return e[0]!==n?(o=u.jsx(WD,{components:XD,className:"prose dark:prose-invert max-w-none prose-pre:pl-0",children:n}),e[0]=n,e[1]=o):o=e[1],o},(t,e)=>t.content===e.content);Nv.displayName="MemoizedMarkdownBlock";const zh=T.memo(({content:t})=>{const e=T.useMemo(()=>{return n=t,BV.lexer(n).map(o=>o.raw);var n},[t]);return u.jsx(u.Fragment,{children:e.map((n,o)=>u.jsx(Nv,{content:n},`markdown-block-${o}`))})});zh.displayName="MarkdownRenderer";const ZD=t=>{const e=K.c(13),{reasoning:n,index:o,isStreaming:r}=t,s=o===void 0?0:o,i=r!==void 0&&r,a=i?"reasoning":void 0;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(dc,{className:"h-3 w-3"}),e[0]=l):l=e[0];const c=i?"Thinking":"View reasoning";let d,h,f,m;return e[1]!==n.length||e[2]!==c?(d=u.jsx(UV,{className:"text-xs text-muted-foreground hover:bg-muted/50 px-2 py-1 h-auto rounded-sm [&[data-state=open]>svg]:rotate-180",children:u.jsxs("span",{className:"flex items-center gap-2",children:[l,c," (",n.length," ","chars)"]})}),e[1]=n.length,e[2]=c,e[3]=d):d=e[3],e[4]!==n?(h=u.jsx(VV,{className:"pb-2 px-2",children:u.jsx("div",{className:"bg-muted/30 border border-muted/50 rounded-md p-3 italic text-muted-foreground/90 relative",children:u.jsx("div",{className:"pr-6",children:u.jsx(zh,{content:n})})})}),e[4]=n,e[5]=h):h=e[5],e[6]!==d||e[7]!==h?(f=u.jsxs($V,{value:"reasoning",className:"border-0",children:[d,h]}),e[6]=d,e[7]=h,e[8]=f):f=e[8],e[9]!==s||e[10]!==a||e[11]!==f?(m=u.jsx(HV,{type:"single",collapsible:!0,className:"w-full mb-2",value:a,children:f},s),e[9]=s,e[10]=a,e[11]=f,e[12]=m):m=e[12],m},QD=t=>{const e=K.c(27),{onNewChat:n,activeChatId:o,setActiveChat:r,chats:s}=t,{handleClick:i}=Sa();let a,l,c,d,h,f,m,_,g,p,b;if(e[0]===Symbol.for("react.memo_cache_sentinel")?(a=u.jsx(pr,{className:"h-4 w-4"}),e[0]=a):a=e[0],e[1]!==n?(l=u.jsx(Te,{content:"New chat",children:u.jsx(De,{variant:"text",size:"icon",onClick:n,children:a})}),e[1]=n,e[2]=l):l=e[2],e[3]!==i?(c=()=>i("ai"),e[3]=i,e[4]=c):c=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(Im,{className:"h-4 w-4"}),e[5]=d):d=e[5],e[6]!==c?(h=u.jsx(Te,{content:"AI Settings",children:u.jsx(De,{variant:"text",size:"xs",className:"hover:bg-foreground/10 py-2",onClick:c,children:d})}),e[6]=c,e[7]=h):h=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx(Te,{content:"Previous chats",children:u.jsx(ti,{asChild:!0,children:u.jsx(De,{variant:"text",size:"icon",children:u.jsx(JV,{className:"h-4 w-4"})})})}),e[8]=f):f=e[8],e[9]!==s.length?(m=s.length===0&&u.jsx(vn,{title:"No chats yet",description:"Start a new chat to get started",icon:u.jsx(dc,{})}),e[9]=s.length,e[10]=m):m=e[10],e[11]!==o||e[12]!==s||e[13]!==r){let y;e[15]!==o||e[16]!==r?(y=x=>u.jsxs("button",{className:Ae("w-full p-3 rounded-md cursor-pointer hover:bg-accent text-left",x.id===o&&"bg-accent"),onClick:()=>{r(x.id)},children:[u.jsx("div",{className:"font-medium",children:x.title}),u.jsx("div",{className:"text-sm text-muted-foreground",children:KV(x.updatedAt)})]},x.id),e[15]=o,e[16]=r,e[17]=y):y=e[17],_=s.map(y),e[11]=o,e[12]=s,e[13]=r,e[14]=_}else _=e[14];return e[18]!==m||e[19]!==_?(g=u.jsxs(Ur,{children:[f,u.jsx(Js,{className:"w-[520px] p-0",align:"start",side:"right",children:u.jsx(hw,{className:"h-[500px] p-4",children:u.jsxs("div",{className:"space-y-4",children:[m,_]})})})]}),e[18]=m,e[19]=_,e[20]=g):g=e[20],e[21]!==h||e[22]!==g?(p=u.jsxs("div",{className:"flex items-center gap-2",children:[h,g]}),e[21]=h,e[22]=g,e[23]=p):p=e[23],e[24]!==p||e[25]!==l?(b=u.jsxs("div",{className:"flex border-b px-2 py-1 justify-between flex-shrink-0 items-center",children:[l,p]}),e[24]=p,e[25]=l,e[26]=b):b=e[26],b},jv=T.memo(t=>{var f;const e=K.c(15),{message:n,index:o,theme:r,onEdit:s,isStreamingReasoning:i,totalMessages:a}=t,l=n.role==="user"?"justify-end":"justify-start";let c,d,h;return e[0]!==l?(c=Ae("flex group relative",l),e[0]=l,e[1]=c):c=e[1],e[2]!==o||e[3]!==i||e[4]!==n.content||e[5]!==n.id||e[6]!==n.parts||e[7]!==n.role||e[8]!==s||e[9]!==r||e[10]!==a?(d=n.role==="user"?u.jsx("div",{className:"w-[95%] bg-background border p-1 rounded-sm",children:u.jsx($c,{value:n.content,theme:r,placeholder:"Type your message...",onChange:nR,onSubmit:(m,_)=>{_.trim()&&s(o,_)},onClose:oR},n.id)}):u.jsxs("div",{className:"w-[95%]",children:[u.jsx("div",{className:"absolute right-1 top-1 opacity-0 group-hover:opacity-100 transition-opacity",children:u.jsx(fS,{className:"h-3 w-3",value:n.content})}),(f=n.parts)==null?void 0:f.map((m,_)=>{switch(m.type){case"text":return u.jsx(zh,{content:m.text},_);case"reasoning":return u.jsx(ZD,{reasoning:m.reasoning,index:_,isStreaming:o===a-1&&i},_);default:return null}})]}),e[2]=o,e[3]=i,e[4]=n.content,e[5]=n.id,e[6]=n.parts,e[7]=n.role,e[8]=s,e[9]=r,e[10]=a,e[11]=d):d=e[11],e[12]!==c||e[13]!==d?(h=u.jsx("div",{className:c,children:d}),e[12]=c,e[13]=d,e[14]=h):h=e[14],h});jv.displayName="ChatMessage";const Bh=T.memo(t=>{var C;const e=K.c(22),{input:n,onSendClick:o,isLoading:r,onStop:s}=t,i=$e(dS),[a,l]=an(zm),c=((C=i==null?void 0:i.open_ai)==null?void 0:C.model)||"o4-mini";let d,h,f,m,_,g;if(e[0]!==l||e[1]!==a){d=async E=>{var I;const N={...a,ai:{...a.ai,open_ai:{...(I=a.ai)==null?void 0:I.open_ai,model:E}}};v(N)};const v=async E=>{await zr({config:E}).then(()=>{l(E)})};e[0]=l,e[1]=a,e[2]=d}else d=e[2];e[3]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(bc,{className:"h-6 text-xs border-border !shadow-none !ring-0 bg-muted hover:bg-muted/30 py-0 px-2 gap-1",children:u.jsx(yc,{placeholder:"Model"})}),e[3]=h):h=e[3],e[4]!==c?(f=!BS.includes(c)&&u.jsx(la,{value:c,className:"text-sm",children:c},c),e[4]=c,e[5]=f):f=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(m=BS.map(rR),e[6]=m):m=e[6],e[7]!==f?(_=u.jsxs(xc,{children:[f,m]}),e[7]=f,e[8]=_):_=e[8],e[9]!==c||e[10]!==d||e[11]!==_?(g=u.jsx("div",{className:"flex items-center gap-2",children:u.jsxs(_c,{value:c,onValueChange:d,children:[h,_]})}),e[9]=c,e[10]=d,e[11]=_,e[12]=g):g=e[12];const p=r?s:o,b=!r&&!n.trim();let y,x,k;return e[13]!==r?(y=r?u.jsx(vc,{className:"h-3 w-3 fill-current"}):u.jsx(WV,{className:"h-3 w-3"}),e[13]=r,e[14]=y):y=e[14],e[15]!==p||e[16]!==b||e[17]!==y?(x=u.jsx(De,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-muted/30",onClick:p,disabled:b,children:y}),e[15]=p,e[16]=b,e[17]=y,e[18]=x):x=e[18],e[19]!==g||e[20]!==x?(k=u.jsxs("div",{className:"px-3 py-2 border-t border-border/20 flex items-center justify-between",children:[g,x]}),e[19]=g,e[20]=x,e[21]=k):k=e[21],k});Bh.displayName="ChatInputFooter";const Ev=T.memo(t=>{var g,p;const e=K.c(19),{input:n,setInput:o,onSubmit:r,theme:s,inputRef:i,isLoading:a,onStop:l}=t;let c;e[0]!==n||e[1]!==r?(c=()=>{n.trim()&&r(void 0,n)},e[0]=n,e[1]=r,e[2]=c):c=e[2];const d=c;let h,f,m,_;return e[3]!==((g=i.current)==null?void 0:g.editor)?(h=()=>{var b,y;return(y=(b=i.current)==null?void 0:b.editor)==null?void 0:y.blur()},e[3]=(p=i.current)==null?void 0:p.editor,e[4]=h):h=e[4],e[5]!==n||e[6]!==r||e[7]!==o||e[8]!==h||e[9]!==s?(f=u.jsx("div",{className:"px-2 py-3 flex-1",children:u.jsx($c,{value:n,onChange:o,onSubmit:r,onClose:h,theme:s,placeholder:"Type your message..."})}),e[5]=n,e[6]=r,e[7]=o,e[8]=h,e[9]=s,e[10]=f):f=e[10],e[11]!==d||e[12]!==n||e[13]!==a||e[14]!==l?(m=u.jsx(Bh,{input:n,onSendClick:d,isLoading:a,onStop:l}),e[11]=d,e[12]=n,e[13]=a,e[14]=l,e[15]=m):m=e[15],e[16]!==f||e[17]!==m?(_=u.jsxs("div",{className:"border-t relative flex-shrink-0 min-h-[80px] flex flex-col",children:[f,m]}),e[16]=f,e[17]=m,e[18]=_):_=e[18],_});Ev.displayName="ChatInput";const eR=()=>{const t=K.c(6),e=$e(hc),{handleClick:n}=Sa();if(!e){let r,s,i;return t[0]!==n?(r=u.jsx(De,{variant:"outline",size:"sm",onClick:()=>n("ai"),children:"Edit AI settings"}),t[0]=n,t[1]=r):r=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx(dc,{}),t[2]=s):s=t[2],t[3]!==r?(i=u.jsx(vn,{title:"Chat with AI",description:"AI is currently disabled. Add your API key to enable.",action:r,icon:s}),t[3]=r,t[4]=i):i=t[4],i}let o;return t[5]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(tR,{}),t[5]=o):o=t[5],o},tR=()=>{const[t,e]=an(yd),[n,o]=an(uC),[r,s]=T.useState(""),i=T.useRef(null),a=T.useRef(null),l=T.useRef(null),c=T.useRef(null),{theme:d}=gr(),h=Gm(),{messages:f,input:m,setInput:_,setMessages:g,append:p,handleSubmit:b,error:y,status:x,reload:k,stop:C}=qV({id:n==null?void 0:n.id,maxSteps:10,initialMessages:T.useMemo(()=>n?n.messages.map(({role:A,content:M,timestamp:R,parts:z})=>({role:A,content:M,id:R.toString(),parts:z})):[],[n]),keepLastMessageOnError:!0,api:h.getAiURL("chat").toString(),headers:h.headers(),experimental_prepareRequestBody:A=>({...A,...Y4({input:A.messages.map(M=>M.content).join(`
|
141
|
+
`)}),includeOtherCode:Pc("")}),onFinish:A=>{e(M=>Pl(M,M.activeChatId,"assistant",A.content,A.parts))},onToolCall:async({toolCall:A})=>{try{const M=await GV({toolName:A.toolName,arguments:A.args});return M.result||M.error}catch(M){return Dt.error("Tool call failed:",M),`Error: ${M instanceof Error?M.message:String(M)}`}},onError:A=>{Dt.error("An error occurred:",A)},onResponse:A=>{Dt.debug("Received HTTP response from server:",A)}}),v=x==="submitted"||x==="streaming",E=v&&f.length>0&&(A=>{if(A.length===0)return!1;const M=A.at(-1);if(!M||M.role!=="assistant"||!M.parts)return!1;const R=M.parts;return R.length===0?!1:R[R.length-1].type==="reasoning"})(f);T.useEffect(()=>{requestAnimationFrame(()=>{if(l.current){const A=l.current;A.scrollTop=A.scrollHeight}})},[t.activeChatId]);const N=(A,M)=>{g(R=>R.slice(0,A)),t.activeChatId&&e(R=>({...R,chats:R.chats.map(z=>z.id===t.activeChatId?{...z,messages:z.messages.slice(0,A),updatedAt:Date.now()}:z)})),p({role:"user",content:M}),t.activeChatId&&e(R=>Pl(R,t.activeChatId,"user",M))},I=()=>{r.trim()&&(A=>{const M={id:YV(),title:A.length>50?`${A.slice(0,50)}...`:A,messages:[],createdAt:Date.now(),updatedAt:Date.now()};e(R=>({chats:[...R.chats,M],activeChatId:M.id})),_(""),p({role:"user",content:A})})(r.trim())};return u.jsxs("div",{className:"flex flex-col h-[calc(100%-53px)]",children:[u.jsx(Km,{children:u.jsx(QD,{onNewChat:()=>{o(null),_(""),s("")},activeChatId:n==null?void 0:n.id,setActiveChat:o,chats:[...t.chats].sort((A,M)=>M.updatedAt-A.updatedAt)})}),u.jsxs("div",{className:"flex-1 px-3 bg-[var(--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($c,{value:r,placeholder:"Ask anything, @ to include context about tables or dataframes",theme:d,onClose:()=>{var A,M;return(M=(A=i.current)==null?void 0:A.editor)==null?void 0:M.blur()},onChange:s,onSubmit:I},"new-thread-input")}),u.jsx(Bh,{input:r,onSendClick:I,isLoading:v,onStop:C})]}),f.map((A,M)=>u.jsx(jv,{message:A,index:M,theme:d,onEdit:N,setChatState:e,chatState:t,isStreamingReasoning:E,totalMessages:f.length},M)),v&&u.jsx("div",{className:"flex justify-center py-4",children:u.jsx(Ym,{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(Vr,{error:y}),u.jsx(De,{variant:"outline",size:"sm",onClick:()=>{k()},children:"Retry"})]}),u.jsx("div",{ref:c})]}),v&&u.jsx("div",{className:"w-full flex justify-center items-center z-20 border-t",children:u.jsx(De,{variant:"linkDestructive",size:"sm",onClick:C,children:"Stop"})}),f&&f.length>0&&u.jsx(Ev,{input:m,setInput:_,onSubmit:(A,M)=>{M.trim()&&(b(A),t.activeChatId&&e(R=>Pl(R,t.activeChatId,"user",M)))},theme:d,inputRef:a,isLoading:v,onStop:C})]})};function nR(){}function oR(){}function rR(t){return u.jsx(la,{value:t,className:"text-sm",children:t},t)}function hn(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=hn(t[o]))!==""&&(e+=(e&&" ")+n);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}const{useDebugValue:sR}=J,{useSyncExternalStoreWithSelector:iR}=XV,aR=t=>t;function Iv(t,e=aR,n){const o=iR(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return sR(o),o}const Av=(t,e)=>{const n=ZV(t),o=(r,s=e)=>Iv(n,r,s);return Object.assign(o,n),o};function on(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 mo(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 lR={passive:!1},qi={capture:!0,passive:!1};function Uh(t){t.stopImmediatePropagation()}function _s(t){t.preventDefault(),t.stopImmediatePropagation()}function Tv(t){var e=t.document.documentElement,n=ro(t).on("dragstart.drag",_s,qi);"onselectstart"in e?n.on("selectstart.drag",_s,qi):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Mv(t,e){var n=t.document.documentElement,o=ro(t).on("dragstart.drag",null);e&&(o.on("click.drag",_s,qi),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 Wl=t=>()=>t;function Vh(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 cR(t){return!t.ctrlKey&&!t.button}function dR(){return this.parentNode}function uR(t,e){return e??{x:t.x,y:t.y}}function hR(){return navigator.maxTouchPoints||"ontouchstart"in this}Vh.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};const ql=t=>()=>t;function fR(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 Gi(t){t.preventDefault(),t.stopImmediatePropagation()}function mR(t){return!(t.ctrlKey&&t.type!=="wheel"||t.button)}function pR(){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 Ov(){return this.__zoom||yr}function gR(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function _R(){return navigator.maxTouchPoints||"ontouchstart"in this}function bR(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 Gl=T.createContext(null),yR=Gl.Provider,xR=t=>`Node type "${t}" not found. Using fallback type "default".`,wR=()=>"The React Flow parent container needs a width and a height to render the graph.",vR=()=>"Only child nodes can use a parent extent.",kR=t=>`Marker type "${t}" doesn't exist.`,SR=(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,CR=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",NR=t=>`Edge type "${t}" not found. Using fallback type "default".`,jR=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.`,Dv="[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001";function mt(t,e){const n=T.useContext(Gl);if(n===null)throw new Error(Dv);return Iv(n,t,e)}const qt=()=>{const t=T.useContext(Gl);if(t===null)throw new Error(Dv);return T.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},ER=t=>t.userSelectionActive?"none":"all";function Yl({position:t,children:e,className:n,style:o,...r}){const s=mt(ER),i=`${t}`.split("-");return J.createElement("div",{className:hn(["react-flow__panel",n,...i]),style:{...o,pointerEvents:s},...r},e)}function IR({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:J.createElement(Yl,{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"},J.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var AR=T.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=T.useRef(null),[f,m]=T.useState({x:0,y:0,width:0,height:0}),_=hn(["react-flow__edge-textwrapper",c]);return T.useEffect(()=>{if(h.current){const g=h.current.getBBox();m({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n!==void 0&&n?J.createElement("g",{transform:`translate(${t-f.width/2} ${e-f.height/2})`,className:_,visibility:f.width?"visible":"hidden",...d},r&&J.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}),J.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:h,style:o},n),l):null});const Hh=t=>({width:t.offsetWidth,height:t.offsetHeight}),bs=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Wh=(t={x:0,y:0},e)=>({x:bs(t.x,e[0][0],e[1][0]),y:bs(t.y,e[0][1],e[1][1])}),Rv=(t,e,n)=>t<e?bs(Math.abs(t-e),1,50)/50:t>n?-bs(Math.abs(t-n),1,50)/50:0,Pv=(t,e)=>[20*Rv(t.x,35,e.width-35),20*Rv(t.y,35,e.height-35)],Lv=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},qh=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),Fv=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),Gh=(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)},Vn=t=>!isNaN(t)&&isFinite(t),Nt=Symbol.for("internals"),zv=["Enter"," ","Escape"];function Yh(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 Bv=t=>"clientX"in t,er=(t,e)=>{var s,i;const n=Bv(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)}},Jl=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0},Yi=({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})=>J.createElement(J.Fragment,null,J.createElement("path",{id:t,style:d,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:h,markerStart:f}),m&&J.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:m,className:"react-flow__edge-interaction"}),r&&Vn(n)&&Vn(o)?J.createElement(AR,{x:n,y:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null);function Ji(t,e,n){return n===void 0?n:o=>{const r=e().edges.find(s=>s.id===t);r&&n(o,{...r})}}function Uv({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 Vv({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 Or,$v,tr,Jh,Ki,Hv,nr,Xi,ys,Wv,Ue,Kl;function qv({pos:t,x1:e,y1:n,x2:o,y2:r}){return t===Ue.Left||t===Ue.Right?[.5*(e+o),n]:[e,.5*(n+r)]}function Gv({sourceX:t,sourceY:e,sourcePosition:n=Ue.Bottom,targetX:o,targetY:r,targetPosition:s=Ue.Top}){const[i,a]=qv({pos:n,x1:t,y1:e,x2:o,y2:r}),[l,c]=qv({pos:s,x1:o,y1:r,x2:t,y2:e}),[d,h,f,m]=Vv({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]}Yi.displayName="BaseEdge",($v=Or||(Or={})).Strict="strict",$v.Loose="loose",(Jh=tr||(tr={})).Free="free",Jh.Vertical="vertical",Jh.Horizontal="horizontal",(Hv=Ki||(Ki={})).Partial="partial",Hv.Full="full",(Xi=nr||(nr={})).Bezier="default",Xi.Straight="straight",Xi.Step="step",Xi.SmoothStep="smoothstep",Xi.SimpleBezier="simplebezier",(Wv=ys||(ys={})).Arrow="arrow",Wv.ArrowClosed="arrowclosed",(Kl=Ue||(Ue={})).Left="left",Kl.Top="top",Kl.Right="right",Kl.Bottom="bottom";const Kh=T.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Ue.Bottom,targetPosition:s=Ue.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:_,interactionWidth:g})=>{const[p,b,y]=Gv({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s});return J.createElement(Yi,{path:p,labelX:b,labelY:y,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:_,interactionWidth:g})});Kh.displayName="SimpleBezierEdge";const Yv={[Ue.Left]:{x:-1,y:0},[Ue.Right]:{x:1,y:0},[Ue.Top]:{x:0,y:-1},[Ue.Bottom]:{x:0,y:1}},Jv=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function TR({source:t,sourcePosition:e=Ue.Bottom,target:n,targetPosition:o=Ue.Top,center:r,offset:s}){const i=Yv[e],a=Yv[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:v,sourcePosition:E=Ue.Bottom,target:N})=>E===Ue.Left||E===Ue.Right?v.x<N.x?{x:1,y:0}:{x:-1,y:0}:v.y<N.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=[];const p={x:0,y:0},b={x:0,y:0},[y,x,k,C]=Uv({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(i[h]*a[h]===-1){m=r.x??y,_=r.y??x;const v=[{x:m,y:l.y},{x:m,y:c.y}],E=[{x:l.x,y:_},{x:c.x,y:_}];g=i[h]===f?h==="x"?v:E:h==="x"?E:v}else{const v=[{x:l.x,y:c.y}],E=[{x:c.x,y:l.y}];if(g=h==="x"?i.x===f?E:v:i.y===f?v:E,e===o){const A=Math.abs(t[h]-n[h]);if(A<=s){const M=Math.min(s-1,s-A);i[h]===f?p[h]=(l[h]>t[h]?-1:1)*M:b[h]=(c[h]>n[h]?-1:1)*M}}if(e!==o){const A=h==="x"?"y":"x",M=i[h]===a[A],R=l[A]>c[A],z=l[A]<c[A];(i[h]===1&&(!M&&R||M&&z)||i[h]!==1&&(!M&&z||M&&R))&&(g=h==="x"?v:E)}const N={x:l.x+p.x,y:l.y+p.y},I={x:c.x+b.x,y:c.y+b.y};Math.max(Math.abs(N.x-g[0].x),Math.abs(I.x-g[0].x))>=Math.max(Math.abs(N.y-g[0].y),Math.abs(I.y-g[0].y))?(m=(N.x+I.x)/2,_=g[0].y):(m=g[0].x,_=(N.y+I.y)/2)}return[[t,{x:l.x+p.x,y:l.y+p.y},...g,{x:c.x+b.x,y:c.y+b.y},n],m,_,k,C]}function Xh({sourceX:t,sourceY:e,sourcePosition:n=Ue.Bottom,targetX:o,targetY:r,targetPosition:s=Ue.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20}){const[d,h,f,m,_]=TR({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:c});return[d.reduce((g,p,b)=>{let y="";return y=b>0&&b<d.length-1?function(x,k,C,v){const E=Math.min(Jv(x,k)/2,Jv(k,C)/2,v),{x:N,y:I}=k;if(x.x===N&&N===C.x||x.y===I&&I===C.y)return`L${N} ${I}`;if(x.y===I)return`L ${N+E*(x.x<C.x?-1:1)},${I}Q ${N},${I} ${N},${I+E*(x.y<C.y?1:-1)}`;const A=x.x<C.x?1:-1;return`L ${N},${I+E*(x.y<C.y?-1:1)}Q ${N},${I} ${N+E*A},${I}`}(d[b-1],p,d[b+1],i):`${b===0?"M":"L"}${p.x} ${p.y}`,g+=y},""),h,f,m,_]}const Xl=T.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=Ue.Bottom,targetPosition:f=Ue.Top,markerEnd:m,markerStart:_,pathOptions:g,interactionWidth:p})=>{const[b,y,x]=Xh({sourceX:t,sourceY:e,sourcePosition:h,targetX:n,targetY:o,targetPosition:f,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset});return J.createElement(Yi,{path:b,labelX:y,labelY:x,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:m,markerStart:_,interactionWidth:p})});Xl.displayName="SmoothStepEdge";const Zh=T.memo(t=>{var e;return J.createElement(Xl,{...t,pathOptions:T.useMemo(()=>{var n;return{borderRadius:0,offset:(n=t.pathOptions)==null?void 0:n.offset}},[(e=t.pathOptions)==null?void 0:e.offset])})});Zh.displayName="StepEdge";const Qh=T.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,p]=function({sourceX:b,sourceY:y,targetX:x,targetY:k}){const[C,v,E,N]=Uv({sourceX:b,sourceY:y,targetX:x,targetY:k});return[`M ${b},${y}L ${x},${k}`,C,v,E,N]}({sourceX:t,sourceY:e,targetX:n,targetY:o});return J.createElement(Yi,{path:_,labelX:g,labelY:p,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:f,interactionWidth:m})});function Zl(t,e){return t>=0?.5*t:25*e*Math.sqrt(-t)}function Kv({pos:t,x1:e,y1:n,x2:o,y2:r,c:s}){switch(t){case Ue.Left:return[e-Zl(e-o,s),n];case Ue.Right:return[e+Zl(o-e,s),n];case Ue.Top:return[e,n-Zl(n-r,s)];case Ue.Bottom:return[e,n+Zl(r-n,s)]}}function Xv({sourceX:t,sourceY:e,sourcePosition:n=Ue.Bottom,targetX:o,targetY:r,targetPosition:s=Ue.Top,curvature:i=.25}){const[a,l]=Kv({pos:n,x1:t,y1:e,x2:o,y2:r,c:i}),[c,d]=Kv({pos:s,x1:o,y1:r,x2:t,y2:e,c:i}),[h,f,m,_]=Vv({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,_]}Qh.displayName="StraightEdge";const Ql=T.memo(({sourceX:t,sourceY:e,targetX:n,targetY:o,sourcePosition:r=Ue.Bottom,targetPosition:s=Ue.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:_,pathOptions:g,interactionWidth:p})=>{const[b,y,x]=Xv({sourceX:t,sourceY:e,sourcePosition:r,targetX:n,targetY:o,targetPosition:s,curvature:g==null?void 0:g.curvature});return J.createElement(Yi,{path:b,labelX:y,labelY:x,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:_,interactionWidth:p})});Ql.displayName="BezierEdge";const ef=T.createContext(null),MR=ef.Provider;ef.Consumer;const OR=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`reactflow__edge-${t}${e||""}-${n}${o||""}`,tf=(t,e)=>t===void 0?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`,nf=({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},Zv=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o}),xs=(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}},of=(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}=xs(r,e).positionAbsolute;return a=o,l=qh({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)},Qv=(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:_=!1}=d;if(i&&!m||_)return!1;const{positionAbsolute:g}=xs(d,a),p={x:g.x,y:g.y,width:h||0,height:f||0},b=Gh(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},e2=(t,e)=>{const n=t.map(o=>o.id);return e.filter(o=>n.includes(o.source)||n.includes(o.target))},t2=(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=bs(l,o,r);return{x:e/2-(t.x+t.width/2)*c,y:n/2-(t.y+t.height/2)*c,zoom:c}},Dr=(t,e=0)=>t.transition().duration(e);function n2(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 DR={source:null,target:null,sourceHandle:null,targetHandle:null},o2=()=>({handleDomNode:null,isValid:!1,connection:DR,endHandle:null});function r2(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={...o2(),handleDomNode:l};if(l){const d=rf(void 0,l),h=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),m=l.classList.contains("connectable"),_=l.classList.contains("connectableend"),g={source:a?h:n,sourceHandle:a?f:o,target:a?n:h,targetHandle:a?o:f};c.connection=g,m&&_&&(e===Or.Strict?a&&d==="source"||!a&&d==="target":h!==n||f!==o)&&(c.endHandle={nodeId:h,handleId:f,type:d},c.isValid=s(g))}return c}function rf(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function sf(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function RR(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function s2({event:t,handleId:e,nodeId:n,onConnect:o,isTarget:r,getState:s,setState:i,isValidConnection:a,edgeUpdaterType:l,onReconnectEnd:c}){const d=Lv(t.target),{connectionMode:h,domNode:f,autoPanOnConnect:m,connectionRadius:_,onConnectStart:g,panBy:p,getNodes:b,cancelConnection:y}=s();let x,k=0;const{x:C,y:v}=er(t),E=d==null?void 0:d.elementFromPoint(C,v),N=rf(l,E),I=f==null?void 0:f.getBoundingClientRect();if(!I||!N)return;let A,M=er(t,I),R=!1,z=null,D=!1,F=null;const B=function({nodes:$,nodeId:j,handleId:W,handleType:X}){return $.reduce((Y,q)=>{if(q[Nt]){const{handleBounds:ne}=q[Nt];let re=[],ae=[];ne&&(re=n2(q,ne,"source",`${j}-${W}-${X}`),ae=n2(q,ne,"target",`${j}-${W}-${X}`)),Y.push(...re,...ae)}return Y},[])}({nodes:b(),nodeId:n,handleId:e,handleType:N}),U=()=>{if(!m)return;const[$,j]=Pv(M,I);p({x:$,y:j}),k=requestAnimationFrame(U)};function O($){const{transform:j}=s();M=er($,I);const{handle:W,validHandleResult:X}=function(Y,q,ne,re,ae,Z){const{x:Q,y:he}=er(Y),pe=q.elementsFromPoint(Q,he).find(Ne=>Ne.classList.contains("react-flow__handle"));if(pe){const Ne=pe.getAttribute("data-nodeid");if(Ne){const se=rf(void 0,pe),Ie=pe.getAttribute("data-handleid"),be=Z({nodeId:Ne,id:Ie,type:se});if(be){const Oe=ae.find(ze=>ze.nodeId===Ne&&ze.type===se&&ze.id===Ie);return{handle:{id:Ie,type:se,nodeId:Ne,x:(Oe==null?void 0:Oe.x)||ne.x,y:(Oe==null?void 0:Oe.y)||ne.y},validHandleResult:be}}}}let ce=[],fe=1/0;if(ae.forEach(Ne=>{const se=Math.sqrt((Ne.x-ne.x)**2+(Ne.y-ne.y)**2);if(se<=re){const Ie=Z(Ne);se<=fe&&(se<fe?ce=[{handle:Ne,validHandleResult:Ie}]:se===fe&&ce.push({handle:Ne,validHandleResult:Ie}),fe=se)}}),!ce.length)return{handle:null,validHandleResult:o2()};if(ce.length===1)return ce[0];const de=ce.some(({validHandleResult:Ne})=>Ne.isValid),Ce=ce.some(({handle:Ne})=>Ne.type==="target");return ce.find(({handle:Ne,validHandleResult:se})=>Ce?Ne.type==="target":!de||se.isValid)||ce[0]}($,d,nf(M,j,!1,[1,1]),_,B,Y=>r2(Y,h,n,e,r?"target":"source",a,d));if(x=W,R||(U(),R=!0),F=X.handleDomNode,z=X.connection,D=X.isValid,i({connectionPosition:x&&D?Zv({x:x.x,y:x.y},j):M,connectionStatus:RR(!!x,D),connectionEndHandle:X.endHandle}),!x&&!D&&!F)return sf(A);z.source!==z.target&&F&&(sf(A),A=F,F.classList.add("connecting","react-flow__handle-connecting"),F.classList.toggle("valid",D),F.classList.toggle("react-flow__handle-valid",D))}function S($){var j,W;(x||F)&&z&&D&&(o==null||o(z)),(W=(j=s()).onConnectEnd)==null||W.call(j,$),l&&(c==null||c($)),sf(A),y(),cancelAnimationFrame(k),R=!1,D=!1,z=null,F=null,d.removeEventListener("mousemove",O),d.removeEventListener("mouseup",S),d.removeEventListener("touchmove",O),d.removeEventListener("touchend",S)}i({connectionPosition:M,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:N,connectionStartHandle:{nodeId:n,handleId:e,type:N},connectionEndHandle:null}),g==null||g(t,{nodeId:n,handleId:e,handleType:N}),d.addEventListener("mousemove",O),d.addEventListener("mouseup",S),d.addEventListener("touchmove",O),d.addEventListener("touchend",S)}const i2=()=>!0,PR=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),a2=T.forwardRef(({type:t="source",position:e=Ue.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 N,I;const _=i||null,g=t==="target",p=qt(),b=T.useContext(ef),{connectOnClick:y,noPanClassName:x}=mt(PR,on),{connecting:k,clickConnecting:C}=mt(((A,M,R)=>z=>{const{connectionStartHandle:D,connectionEndHandle:F,connectionClickStartHandle:B}=z;return{connecting:(D==null?void 0:D.nodeId)===A&&(D==null?void 0:D.handleId)===M&&(D==null?void 0:D.type)===R||(F==null?void 0:F.nodeId)===A&&(F==null?void 0:F.handleId)===M&&(F==null?void 0:F.type)===R,clickConnecting:(B==null?void 0:B.nodeId)===A&&(B==null?void 0:B.handleId)===M&&(B==null?void 0:B.type)===R}})(b,_,t),on);b||((I=(N=p.getState()).onError)==null||I.call(N,"010",CR()));const v=A=>{const{defaultEdgeOptions:M,onConnect:R,hasDefaultEdges:z}=p.getState(),D={...M,...A};if(z){const{edges:F,setEdges:B}=p.getState();B(((U,O)=>{if(!U.source||!U.target)return O;let S;return S=($=>"id"in $&&"source"in $&&"target"in $)(U)?{...U}:{...U,id:OR(U)},(($,j)=>j.some(W=>!(W.source!==$.source||W.target!==$.target||W.sourceHandle!==$.sourceHandle&&(W.sourceHandle||$.sourceHandle)||W.targetHandle!==$.targetHandle&&(W.targetHandle||$.targetHandle))))(S,O)?O:O.concat(S)})(D,F))}R==null||R(D),a==null||a(D)},E=A=>{if(!b)return;const M=Bv(A);r&&(M&&A.button===0||!M)&&s2({event:A,handleId:_,nodeId:b,onConnect:v,isTarget:g,getState:p.getState,setState:p.setState,isValidConnection:n||p.getState().isValidConnection||i2}),M?d==null||d(A):h==null||h(A)};return J.createElement("div",{"data-handleid":_,"data-nodeid":b,"data-handlepos":e,"data-id":`${b}-${_}-${t}`,className:hn(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",x,c,{source:!g,target:g,connectable:o,connectablestart:r,connectableend:s,connecting:C,connectionindicator:o&&(r&&!k||s&&k)}]),onMouseDown:E,onTouchStart:E,onClick:y?A=>{const{onClickConnectStart:M,onClickConnectEnd:R,connectionClickStartHandle:z,connectionMode:D,isValidConnection:F}=p.getState();if(!b||!z&&!r)return;if(!z)return M==null||M(A,{nodeId:b,handleId:_,handleType:t}),void p.setState({connectionClickStartHandle:{nodeId:b,type:t,handleId:_}});const B=Lv(A.target),U=n||F||i2,{connection:O,isValid:S}=r2({nodeId:b,id:_,type:t},D,z.nodeId,z.handleId||null,z.type,U,B);S&&v(O),R==null||R(A),p.setState({connectionClickStartHandle:null})}:void 0,ref:m,...f},l)});a2.displayName="Handle";var or=T.memo(a2);const l2=({data:t,isConnectable:e,targetPosition:n=Ue.Top,sourcePosition:o=Ue.Bottom})=>J.createElement(J.Fragment,null,J.createElement(or,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,J.createElement(or,{type:"source",position:o,isConnectable:e}));l2.displayName="DefaultNode";var af=T.memo(l2);const c2=({data:t,isConnectable:e,sourcePosition:n=Ue.Bottom})=>J.createElement(J.Fragment,null,t==null?void 0:t.label,J.createElement(or,{type:"source",position:n,isConnectable:e}));c2.displayName="InputNode";var d2=T.memo(c2);const u2=({data:t,isConnectable:e,targetPosition:n=Ue.Top})=>J.createElement(J.Fragment,null,J.createElement(or,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label);u2.displayName="OutputNode";var h2=T.memo(u2);const lf=()=>null;lf.displayName="GroupNode";const LR=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),ec=t=>t.id;function FR(t,e){return on(t.selectedNodes.map(ec),e.selectedNodes.map(ec))&&on(t.selectedEdges.map(ec),e.selectedEdges.map(ec))}const f2=T.memo(({onSelectionChange:t})=>{const e=qt(),{selectedNodes:n,selectedEdges:o}=mt(LR,FR);return T.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 zR=t=>!!t.onSelectionChange;function BR({onSelectionChange:t}){const e=mt(zR);return t||e?J.createElement(f2,{onSelectionChange:t}):null}const UR=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 ws(t,e){T.useEffect(()=>{t!==void 0&&e(t)},[t])}function at(t,e,n){T.useEffect(()=>{e!==void 0&&n({[t]:e})},[e])}const VR=({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:_,minZoom:g,maxZoom:p,nodeExtent:b,onNodesChange:y,onEdgesChange:x,elementsSelectable:k,connectionMode:C,snapGrid:v,snapToGrid:E,translateExtent:N,connectOnClick:I,defaultEdgeOptions:A,fitView:M,fitViewOptions:R,onNodesDelete:z,onEdgesDelete:D,onNodeDrag:F,onNodeDragStart:B,onNodeDragStop:U,onSelectionDrag:O,onSelectionDragStart:S,onSelectionDragStop:$,noPanClassName:j,nodeOrigin:W,rfId:X,autoPanOnConnect:Y,autoPanOnNodeDrag:q,onError:ne,connectionRadius:re,isValidConnection:ae,nodeDragThreshold:Z})=>{const{setNodes:Q,setEdges:he,setDefaultNodesAndEdges:pe,setMinZoom:ce,setMaxZoom:fe,setTranslateExtent:de,setNodeExtent:Ce,reset:Ne}=mt(UR,on),se=qt();return T.useEffect(()=>{const Ie=o==null?void 0:o.map(be=>({...be,...A}));return pe(n,Ie),()=>{Ne()}},[]),at("defaultEdgeOptions",A,se.setState),at("connectionMode",C,se.setState),at("onConnect",r,se.setState),at("onConnectStart",s,se.setState),at("onConnectEnd",i,se.setState),at("onClickConnectStart",a,se.setState),at("onClickConnectEnd",l,se.setState),at("nodesDraggable",c,se.setState),at("nodesConnectable",d,se.setState),at("nodesFocusable",h,se.setState),at("edgesFocusable",f,se.setState),at("edgesUpdatable",m,se.setState),at("elementsSelectable",k,se.setState),at("elevateNodesOnSelect",_,se.setState),at("snapToGrid",E,se.setState),at("snapGrid",v,se.setState),at("onNodesChange",y,se.setState),at("onEdgesChange",x,se.setState),at("connectOnClick",I,se.setState),at("fitViewOnInit",M,se.setState),at("fitViewOnInitOptions",R,se.setState),at("onNodesDelete",z,se.setState),at("onEdgesDelete",D,se.setState),at("onNodeDrag",F,se.setState),at("onNodeDragStart",B,se.setState),at("onNodeDragStop",U,se.setState),at("onSelectionDrag",O,se.setState),at("onSelectionDragStart",S,se.setState),at("onSelectionDragStop",$,se.setState),at("noPanClassName",j,se.setState),at("nodeOrigin",W,se.setState),at("rfId",X,se.setState),at("autoPanOnConnect",Y,se.setState),at("autoPanOnNodeDrag",q,se.setState),at("onError",ne,se.setState),at("connectionRadius",re,se.setState),at("isValidConnection",ae,se.setState),at("nodeDragThreshold",Z,se.setState),ws(t,Q),ws(e,he),ws(g,ce),ws(p,fe),ws(N,de),ws(b,Ce),null},m2={display:"none"},$R={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},p2="react-flow__node-desc",g2="react-flow__edge-desc",HR=t=>t.ariaLiveMessage;function WR({rfId:t}){const e=mt(HR);return J.createElement("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:$R},e)}function qR({rfId:t,disableKeyboardA11y:e}){return J.createElement(J.Fragment,null,J.createElement("div",{id:`${p2}-${t}`,style:m2},"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."," "),J.createElement("div",{id:`${g2}-${t}`,style:m2},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&J.createElement(WR,{rfId:t}))}var Zi=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,o]=T.useState(!1),r=T.useRef(!1),s=T.useRef(new Set([])),[i,a]=T.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 T.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)&&Yh(m))return!1;const _=b2(m.code,a);s.current.add(m[_]),_2(i,s.current,!1)&&(m.preventDefault(),o(!0))},h=m=>{if((!r.current||r.current&&!e.actInsideInputWithModifier)&&Yh(m))return!1;const _=b2(m.code,a);_2(i,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(m[_]),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 b2(t,e){return e.includes(t)?"code":"key"}function y2(t,e,n,o){var a,l;const r=t.parentNode||t.parentId;if(!r)return n;const s=e.get(r),i=xs(s,o);return y2(s,e,{x:(n.x??0)+i.x,y:(n.y??0)+i.y,z:(((a=s[Nt])==null?void 0:a.z)??0)>(n.z??0)?((l=s[Nt])==null?void 0:l.z)??0:n.z??0},o)}function x2(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}=y2(o,t,{...o.position,z:((s=o[Nt])==null?void 0:s.z)??0},e);o.positionAbsolute={x:i,y:a},o[Nt].z=l,n!=null&&n[o.id]&&(o[Nt].isParent=!0)}})}function cf(t,e,n,o){const r=new Map,s={},i=o?1e3:0;return t.forEach(a=>{var m;const l=(Vn(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,Nt,{enumerable:!1,value:{handleBounds:f||(m=c==null?void 0:c[Nt])==null?void 0:m.handleBounds,z:l}}),r.set(a.id,d)}),x2(r,n,s),r}function w2(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(g=>{var b;const p=e.includeHiddenNodes?g.width&&g.height:!g.hidden;return(b=e.nodes)!=null&&b.length?p&&e.nodes.some(y=>y.id===g.id):p}),_=m.every(g=>g.width&&g.height);if(m.length>0&&_){const g=of(m,h),{x:p,y:b,zoom:y}=t2(g,o,r,e.minZoom??s,e.maxZoom??i,e.padding??.1),x=yr.translate(p,b).scale(y);return typeof e.duration=="number"&&e.duration>0?a.transform(Dr(l,e.duration),x):a.transform(l,x),!0}}return!1}function GR(t,e){return t.forEach(n=>{const o=e.get(n.id);o&&e.set(o.id,{...o,[Nt]:o[Nt],selected:n.selected})}),new Map(e)}function YR(t,e){return e.map(n=>{const o=t.find(r=>r.id===n.id);return o&&(n.selected=o.selected),n})}function tc({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:GR(t,r)}),i==null||i(t)),e!=null&&e.length&&(c&&o({edges:YR(e,s)}),a==null||a(e))}const vs=()=>{},JR={zoomIn:vs,zoomOut:vs,zoomTo:vs,getZoom:()=>1,setViewport:vs,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:vs,fitBounds:vs,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},KR=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection});function Qi(){const t=(()=>{const g=qt(),{d3Zoom:p,d3Selection:b}=mt(KR,on);return T.useMemo(()=>b&&p?{zoomIn:x=>p.scaleBy(Dr(b,x==null?void 0:x.duration),1.2),zoomOut:x=>p.scaleBy(Dr(b,x==null?void 0:x.duration),1/1.2),zoomTo:(x,k)=>p.scaleTo(Dr(b,k==null?void 0:k.duration),x),getZoom:()=>g.getState().transform[2],setViewport:(x,k)=>{const[C,v,E]=g.getState().transform,N=yr.translate(x.x??C,x.y??v).scale(x.zoom??E);p.transform(Dr(b,k==null?void 0:k.duration),N)},getViewport:()=>{const[x,k,C]=g.getState().transform;return{x,y:k,zoom:C}},fitView:x=>w2(g.getState,x),setCenter:(x,k,C)=>{const{width:v,height:E,maxZoom:N}=g.getState(),I=(C==null?void 0:C.zoom)!==void 0?C.zoom:N,A=v/2-x*I,M=E/2-k*I,R=yr.translate(A,M).scale(I);p.transform(Dr(b,C==null?void 0:C.duration),R)},fitBounds:(x,k)=>{const{width:C,height:v,minZoom:E,maxZoom:N}=g.getState(),{x:I,y:A,zoom:M}=t2(x,C,v,E,N,(k==null?void 0:k.padding)??.1),R=yr.translate(I,A).scale(M);p.transform(Dr(b,k==null?void 0:k.duration),R)},project:x=>{const{transform:k,snapToGrid:C,snapGrid:v}=g.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"),nf(x,k,C,v)},screenToFlowPosition:x=>{const{transform:k,snapToGrid:C,snapGrid:v,domNode:E}=g.getState();if(!E)return x;const{x:N,y:I}=E.getBoundingClientRect(),A={x:x.x-N,y:x.y-I};return nf(A,k,C,v)},flowToScreenPosition:x=>{const{transform:k,domNode:C}=g.getState();if(!C)return x;const{x:v,y:E}=C.getBoundingClientRect(),N=Zv(x,k);return{x:N.x+v,y:N.y+E}},viewportInitialized:!0}:JR,[p,b])})(),e=qt(),n=T.useCallback(()=>e.getState().getNodes().map(g=>({...g})),[]),o=T.useCallback(g=>e.getState().nodeInternals.get(g),[]),r=T.useCallback(()=>{const{edges:g=[]}=e.getState();return g.map(p=>({...p}))},[]),s=T.useCallback(g=>{const{edges:p=[]}=e.getState();return p.find(b=>b.id===g)},[]),i=T.useCallback(g=>{const{getNodes:p,setNodes:b,hasDefaultNodes:y,onNodesChange:x}=e.getState(),k=p(),C=typeof g=="function"?g(k):g;if(y)b(C);else if(x){const v=C.length===0?k.map(E=>({type:"remove",id:E.id})):C.map(E=>({item:E,type:"reset"}));x(v)}},[]),a=T.useCallback(g=>{const{edges:p=[],setEdges:b,hasDefaultEdges:y,onEdgesChange:x}=e.getState(),k=typeof g=="function"?g(p):g;y?b(k):x&&x(k.length===0?p.map(C=>({type:"remove",id:C.id})):k.map(C=>({item:C,type:"reset"})))},[]),l=T.useCallback(g=>{const p=Array.isArray(g)?g:[g],{getNodes:b,setNodes:y,hasDefaultNodes:x,onNodesChange:k}=e.getState();if(x)y([...b(),...p]);else if(k){const C=p.map(v=>({item:v,type:"add"}));k(C)}},[]),c=T.useCallback(g=>{const p=Array.isArray(g)?g:[g],{edges:b=[],setEdges:y,hasDefaultEdges:x,onEdgesChange:k}=e.getState();x?y([...b,...p]):k&&k(p.map(C=>({item:C,type:"add"})))},[]),d=T.useCallback(()=>{const{getNodes:g,edges:p=[],transform:b}=e.getState(),[y,x,k]=b;return{nodes:g().map(C=>({...C})),edges:p.map(C=>({...C})),viewport:{x:y,y:x,zoom:k}}},[]),h=T.useCallback(({nodes:g,edges:p})=>{const{nodeInternals:b,getNodes:y,edges:x,hasDefaultNodes:k,hasDefaultEdges:C,onNodesDelete:v,onEdgesDelete:E,onNodesChange:N,onEdgesChange:I}=e.getState(),A=(g||[]).map(F=>F.id),M=(p||[]).map(F=>F.id),R=y().reduce((F,B)=>{const U=B.parentNode||B.parentId,O=!A.includes(B.id)&&U&&F.find(S=>S.id===U);return(typeof B.deletable!="boolean"||B.deletable)&&(A.includes(B.id)||O)&&F.push(B),F},[]),z=x.filter(F=>typeof F.deletable!="boolean"||F.deletable),D=z.filter(F=>M.includes(F.id));if(R||D){const F=e2(R,z),B=[...D,...F],U=B.reduce((O,S)=>(O.includes(S.id)||O.push(S.id),O),[]);(C||k)&&(C&&e.setState({edges:x.filter(O=>!U.includes(O.id))}),k&&(R.forEach(O=>{b.delete(O.id)}),e.setState({nodeInternals:new Map(b)}))),U.length>0&&(E==null||E(B),I&&I(U.map(O=>({id:O,type:"remove"})))),R.length>0&&(v==null||v(R),N)&&N(R.map(O=>({id:O.id,type:"remove"})))}},[]),f=T.useCallback(g=>{const p=Vn((b=g).width)&&Vn(b.height)&&Vn(b.x)&&Vn(b.y);var b;const y=p?null:e.getState().nodeInternals.get(g.id);return!p&&!y?[null,null,p]:[p?g:Fv(y),y,p]},[]),m=T.useCallback((g,p=!0,b)=>{const[y,x,k]=f(g);return y?(b||e.getState().getNodes()).filter(C=>{if(!(k||C.id!==x.id&&C.positionAbsolute))return!1;const v=Fv(C),E=Gh(v,y);return p&&E>0||E>=y.width*y.height}):[]},[]),_=T.useCallback((g,p,b=!0)=>{const[y]=f(g);if(!y)return!1;const x=Gh(y,p);return b&&x>0||x>=y.width*y.height},[]);return T.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:_}),[t,n,o,r,s,i,a,l,c,d,h,m,_])}const XR={actInsideInputWithModifier:!1},df={position:"absolute",width:"100%",height:"100%",top:0,left:0},nc=t=>({x:t.x,y:t.y,zoom:t.k}),ks=(t,e)=>t.target.closest(`.${e}`),v2=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),k2=t=>{const e=t.ctrlKey&&Jl()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},ZR=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),QR=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:r=!0,zoomOnPinch:s=!0,panOnScroll:i=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=tr.Free,zoomOnDoubleClick:c=!0,elementsSelectable:d,panOnDrag:h=!0,defaultViewport:f,translateExtent:m,minZoom:_,maxZoom:g,zoomActivationKeyCode:p,preventScrolling:b=!0,children:y,noWheelClassName:x,noPanClassName:k})=>{const C=T.useRef(),v=qt(),E=T.useRef(!1),N=T.useRef(!1),I=T.useRef(null),A=T.useRef({x:0,y:0,zoom:0}),{d3Zoom:M,d3Selection:R,d3ZoomHandler:z,userSelectionActive:D}=mt(ZR,on),F=Zi(p),B=T.useRef(0),U=T.useRef(!1),O=T.useRef();return function(S){const $=qt();T.useEffect(()=>{let j;const W=()=>{var Y,q;if(!S.current)return;const X=Hh(S.current);X.height!==0&&X.width!==0||((q=(Y=$.getState()).onError)==null||q.call(Y,"004",wR())),$.setState({width:X.width||500,height:X.height||500})};return W(),window.addEventListener("resize",W),S.current&&(j=new ResizeObserver(()=>W()),j.observe(S.current)),()=>{window.removeEventListener("resize",W),j&&S.current&&j.unobserve(S.current)}},[])}(I),T.useEffect(()=>{if(I.current){const S=I.current.getBoundingClientRect(),$=function(){var q,ne,re,ae=mR,Z=pR,Q=bR,he=gR,pe=_R,ce=[0,1/0],fe=[[-1/0,-1/0],[1/0,1/0]],de=250,Ce=qH,Ne=ZS("start","zoom","end"),se=0,Ie=10;function be(G){G.property("__zoom",Ov).on("wheel.zoom",Qe,{passive:!1}).on("mousedown.zoom",tt).on("dblclick.zoom",te).filter(pe).on("touchstart.zoom",ye).on("touchmove.zoom",ke).on("touchend.zoom touchcancel.zoom",Me).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function Oe(G,ge){return(ge=Math.max(ce[0],Math.min(ce[1],ge)))===G.k?G:new hp(ge,G.x,G.y)}function ze(G,ge,_e){var me=ge[0]-_e[0]*G.k,le=ge[1]-_e[1]*G.k;return me===G.x&&le===G.y?G:new hp(G.k,me,le)}function Ge(G){return[(+G[0][0]+ +G[1][0])/2,(+G[0][1]+ +G[1][1])/2]}function Je(G,ge,_e,me){G.on("start.zoom",function(){Le(this,arguments).event(me).start()}).on("interrupt.zoom end.zoom",function(){Le(this,arguments).event(me).end()}).tween("zoom",function(){var le=this,Ve=arguments,Fe=Le(le,Ve).event(me),Ke=Z.apply(le,Ve),ie=_e==null?Ge(Ke):typeof _e=="function"?_e.apply(le,Ve):_e,Se=Math.max(Ke[1][0]-Ke[0][0],Ke[1][1]-Ke[0][1]),Ee=le.__zoom,Be=typeof ge=="function"?ge.apply(le,Ve):ge,Ye=Ce(Ee.invert(ie).concat(Se/Ee.k),Be.invert(ie).concat(Se/Be.k));return function(Re){if(Re===1)Re=Be;else{var He=Ye(Re),it=Se/He[2];Re=new hp(it,ie[0]-He[0]*it,ie[1]-He[1]*it)}Fe.zoom(null,Re)}})}function Le(G,ge,_e){return!_e&&G.__zooming||new et(G,ge)}function et(G,ge){this.that=G,this.args=ge,this.active=0,this.sourceEvent=null,this.extent=Z.apply(G,ge),this.taps=0}function Qe(G,...ge){if(ae.apply(this,arguments)){var _e=Le(this,ge).event(G),me=this.__zoom,le=Math.max(ce[0],Math.min(ce[1],me.k*Math.pow(2,he.apply(this,arguments)))),Ve=mo(G);if(_e.wheel)_e.mouse[0][0]===Ve[0]&&_e.mouse[0][1]===Ve[1]||(_e.mouse[1]=me.invert(_e.mouse[0]=Ve)),clearTimeout(_e.wheel);else{if(me.k===le)return;_e.mouse=[Ve,me.invert(Ve)],fp(this),_e.start()}Gi(G),_e.wheel=setTimeout(function(){_e.wheel=null,_e.end()},150),_e.zoom("mouse",Q(ze(Oe(me,le),_e.mouse[0],_e.mouse[1]),_e.extent,fe))}}function tt(G,...ge){if(!re&&ae.apply(this,arguments)){var _e=G.currentTarget,me=Le(this,ge,!0).event(G),le=ro(G.view).on("mousemove.zoom",function(ie){if(Gi(ie),!me.moved){var Se=ie.clientX-Fe,Ee=ie.clientY-Ke;me.moved=Se*Se+Ee*Ee>se}me.event(ie).zoom("mouse",Q(ze(me.that.__zoom,me.mouse[0]=mo(ie,_e),me.mouse[1]),me.extent,fe))},!0).on("mouseup.zoom",function(ie){le.on("mousemove.zoom mouseup.zoom",null),Mv(ie.view,me.moved),Gi(ie),me.event(ie).end()},!0),Ve=mo(G,_e),Fe=G.clientX,Ke=G.clientY;Tv(G.view),$h(G),me.mouse=[Ve,this.__zoom.invert(Ve)],fp(this),me.start()}}function te(G,...ge){if(ae.apply(this,arguments)){var _e=this.__zoom,me=mo(G.changedTouches?G.changedTouches[0]:G,this),le=_e.invert(me),Ve=_e.k*(G.shiftKey?.5:2),Fe=Q(ze(Oe(_e,Ve),me,le),Z.apply(this,ge),fe);Gi(G),de>0?ro(this).transition().duration(de).call(Je,Fe,me,G):ro(this).call(be.transform,Fe,me,G)}}function ye(G,...ge){if(ae.apply(this,arguments)){var _e,me,le,Ve,Fe=G.touches,Ke=Fe.length,ie=Le(this,ge,G.changedTouches.length===Ke).event(G);for($h(G),me=0;me<Ke;++me)Ve=[Ve=mo(le=Fe[me],this),this.__zoom.invert(Ve),le.identifier],ie.touch0?ie.touch1||ie.touch0[2]===Ve[2]||(ie.touch1=Ve,ie.taps=0):(ie.touch0=Ve,_e=!0,ie.taps=1+!!q);q&&(q=clearTimeout(q)),_e&&(ie.taps<2&&(ne=Ve[0],q=setTimeout(function(){q=null},500)),fp(this),ie.start())}}function ke(G,...ge){if(this.__zooming){var _e,me,le,Ve,Fe=Le(this,ge).event(G),Ke=G.changedTouches,ie=Ke.length;for(Gi(G),_e=0;_e<ie;++_e)le=mo(me=Ke[_e],this),Fe.touch0&&Fe.touch0[2]===me.identifier?Fe.touch0[0]=le:Fe.touch1&&Fe.touch1[2]===me.identifier&&(Fe.touch1[0]=le);if(me=Fe.that.__zoom,Fe.touch1){var Se=Fe.touch0[0],Ee=Fe.touch0[1],Be=Fe.touch1[0],Ye=Fe.touch1[1],Re=(Re=Be[0]-Se[0])*Re+(Re=Be[1]-Se[1])*Re,He=(He=Ye[0]-Ee[0])*He+(He=Ye[1]-Ee[1])*He;me=Oe(me,Math.sqrt(Re/He)),le=[(Se[0]+Be[0])/2,(Se[1]+Be[1])/2],Ve=[(Ee[0]+Ye[0])/2,(Ee[1]+Ye[1])/2]}else{if(!Fe.touch0)return;le=Fe.touch0[0],Ve=Fe.touch0[1]}Fe.zoom("touch",Q(ze(me,le,Ve),Fe.extent,fe))}}function Me(G,...ge){if(this.__zooming){var _e,me,le=Le(this,ge).event(G),Ve=G.changedTouches,Fe=Ve.length;for($h(G),re&&clearTimeout(re),re=setTimeout(function(){re=null},500),_e=0;_e<Fe;++_e)me=Ve[_e],le.touch0&&le.touch0[2]===me.identifier?delete le.touch0:le.touch1&&le.touch1[2]===me.identifier&&delete le.touch1;if(le.touch1&&!le.touch0&&(le.touch0=le.touch1,delete le.touch1),le.touch0)le.touch0[1]=this.__zoom.invert(le.touch0[0]);else if(le.end(),le.taps===2&&(me=mo(me,this),Math.hypot(ne[0]-me[0],ne[1]-me[1])<Ie)){var Ke=ro(this).on("dblclick.zoom");Ke&&Ke.apply(this,arguments)}}}return be.transform=function(G,ge,_e,me){var le=G.selection?G.selection():G;le.property("__zoom",Ov),G!==le?Je(G,ge,_e,me):le.interrupt().each(function(){Le(this,arguments).event(me).start().zoom(null,typeof ge=="function"?ge.apply(this,arguments):ge).end()})},be.scaleBy=function(G,ge,_e,me){be.scaleTo(G,function(){return this.__zoom.k*(typeof ge=="function"?ge.apply(this,arguments):ge)},_e,me)},be.scaleTo=function(G,ge,_e,me){be.transform(G,function(){var le=Z.apply(this,arguments),Ve=this.__zoom,Fe=_e==null?Ge(le):typeof _e=="function"?_e.apply(this,arguments):_e,Ke=Ve.invert(Fe),ie=typeof ge=="function"?ge.apply(this,arguments):ge;return Q(ze(Oe(Ve,ie),Fe,Ke),le,fe)},_e,me)},be.translateBy=function(G,ge,_e,me){be.transform(G,function(){return Q(this.__zoom.translate(typeof ge=="function"?ge.apply(this,arguments):ge,typeof _e=="function"?_e.apply(this,arguments):_e),Z.apply(this,arguments),fe)},null,me)},be.translateTo=function(G,ge,_e,me,le){be.transform(G,function(){var Ve=Z.apply(this,arguments),Fe=this.__zoom,Ke=me==null?Ge(Ve):typeof me=="function"?me.apply(this,arguments):me;return Q(yr.translate(Ke[0],Ke[1]).scale(Fe.k).translate(typeof ge=="function"?-ge.apply(this,arguments):-ge,typeof _e=="function"?-_e.apply(this,arguments):-_e),Ve,fe)},me,le)},et.prototype={event:function(G){return G&&(this.sourceEvent=G),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(G,ge){return this.mouse&&G!=="mouse"&&(this.mouse[1]=ge.invert(this.mouse[0])),this.touch0&&G!=="touch"&&(this.touch0[1]=ge.invert(this.touch0[0])),this.touch1&&G!=="touch"&&(this.touch1[1]=ge.invert(this.touch1[0])),this.that.__zoom=ge,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(G){var ge=ro(this.that).datum();Ne.call(G,this.that,new fR(G,{sourceEvent:this.sourceEvent,target:be,transform:this.that.__zoom,dispatch:Ne}),ge)}},be.wheelDelta=function(G){return arguments.length?(he=typeof G=="function"?G:ql(+G),be):he},be.filter=function(G){return arguments.length?(ae=typeof G=="function"?G:ql(!!G),be):ae},be.touchable=function(G){return arguments.length?(pe=typeof G=="function"?G:ql(!!G),be):pe},be.extent=function(G){return arguments.length?(Z=typeof G=="function"?G:ql([[+G[0][0],+G[0][1]],[+G[1][0],+G[1][1]]]),be):Z},be.scaleExtent=function(G){return arguments.length?(ce[0]=+G[0],ce[1]=+G[1],be):[ce[0],ce[1]]},be.translateExtent=function(G){return arguments.length?(fe[0][0]=+G[0][0],fe[1][0]=+G[1][0],fe[0][1]=+G[0][1],fe[1][1]=+G[1][1],be):[[fe[0][0],fe[0][1]],[fe[1][0],fe[1][1]]]},be.constrain=function(G){return arguments.length?(Q=G,be):Q},be.duration=function(G){return arguments.length?(de=+G,be):de},be.interpolate=function(G){return arguments.length?(Ce=G,be):Ce},be.on=function(){var G=Ne.on.apply(Ne,arguments);return G===Ne?be:G},be.clickDistance=function(G){return arguments.length?(se=(G=+G)*G,be):Math.sqrt(se)},be.tapDistance=function(G){return arguments.length?(Ie=+G,be):Ie},be}().scaleExtent([_,g]).translateExtent(m),j=ro(I.current).call($),W=yr.translate(f.x,f.y).scale(bs(f.zoom,_,g)),X=[[0,0],[S.width,S.height]],Y=$.constrain()(W,X,m);$.transform(j,Y),$.wheelDelta(k2),v.setState({d3Zoom:$,d3Selection:j,d3ZoomHandler:j.on("wheel.zoom"),transform:[Y.x,Y.y,Y.k],domNode:I.current.closest(".react-flow")})}},[]),T.useEffect(()=>{R&&M&&(!i||F||D?z!==void 0&&R.on("wheel.zoom",function(S,$){if(!b&&S.type==="wheel"&&!S.ctrlKey||ks(S,x))return null;S.preventDefault(),z.call(this,S,$)},{passive:!1}):R.on("wheel.zoom",S=>{if(ks(S,x))return!1;S.preventDefault(),S.stopImmediatePropagation();const $=R.property("__zoom").k||1;if(S.ctrlKey&&s){const ae=mo(S),Z=k2(S),Q=$*Math.pow(2,Z);return void M.scaleTo(R,Q,ae,S)}const j=S.deltaMode===1?20:1;let W=l===tr.Vertical?0:S.deltaX*j,X=l===tr.Horizontal?0:S.deltaY*j;!Jl()&&S.shiftKey&&l!==tr.Vertical&&(W=S.deltaY*j,X=0),M.translateBy(R,-W/$*a,-X/$*a,{internal:!0});const Y=nc(R.property("__zoom")),{onViewportChangeStart:q,onViewportChange:ne,onViewportChangeEnd:re}=v.getState();clearTimeout(O.current),U.current||(U.current=!0,e==null||e(S,Y),q==null||q(Y)),U.current&&(t==null||t(S,Y),ne==null||ne(Y),O.current=setTimeout(()=>{n==null||n(S,Y),re==null||re(Y),U.current=!1},150))},{passive:!1}))},[D,i,l,R,M,z,F,s,b,x,e,t,n]),T.useEffect(()=>{M&&M.on("start",S=>{var W,X;if(!S.sourceEvent||S.sourceEvent.internal)return null;B.current=(W=S.sourceEvent)==null?void 0:W.button;const{onViewportChangeStart:$}=v.getState(),j=nc(S.transform);E.current=!0,A.current=j,((X=S.sourceEvent)==null?void 0:X.type)==="mousedown"&&v.setState({paneDragging:!0}),$==null||$(j),e==null||e(S.sourceEvent,j)})},[M,e]),T.useEffect(()=>{M&&(D&&!E.current?M.on("zoom",null):D||M.on("zoom",S=>{var j;const{onViewportChange:$}=v.getState();if(v.setState({transform:[S.transform.x,S.transform.y,S.transform.k]}),N.current=!(!o||!v2(h,B.current??0)),(t||$)&&!((j=S.sourceEvent)!=null&&j.internal)){const W=nc(S.transform);$==null||$(W),t==null||t(S.sourceEvent,W)}}))},[D,M,t,h,o]),T.useEffect(()=>{M&&M.on("end",S=>{if(!S.sourceEvent||S.sourceEvent.internal)return null;const{onViewportChangeEnd:$}=v.getState();if(E.current=!1,v.setState({paneDragging:!1}),o&&v2(h,B.current??0)&&!N.current&&o(S.sourceEvent),N.current=!1,(n||$)&&(j=A.current,W=S.transform,j.x!==W.x||j.y!==W.y||j.zoom!==W.k)){const X=nc(S.transform);A.current=X,clearTimeout(C.current),C.current=setTimeout(()=>{$==null||$(X),n==null||n(S.sourceEvent,X)},i?150:0)}var j,W})},[M,i,h,n,o]),T.useEffect(()=>{M&&M.filter(S=>{const $=F||r,j=s&&S.ctrlKey;if((h===!0||Array.isArray(h)&&h.includes(1))&&S.button===1&&S.type==="mousedown"&&(ks(S,"react-flow__node")||ks(S,"react-flow__edge")))return!0;if(!(h||$||i||c||s)||D||!c&&S.type==="dblclick"||ks(S,x)&&S.type==="wheel"||ks(S,k)&&(S.type!=="wheel"||i&&S.type==="wheel"&&!F)||!s&&S.ctrlKey&&S.type==="wheel"||!$&&!i&&!j&&S.type==="wheel"||!h&&(S.type==="mousedown"||S.type==="touchstart")||Array.isArray(h)&&!h.includes(S.button)&&S.type==="mousedown")return!1;const W=Array.isArray(h)&&h.includes(S.button)||!S.button||S.button<=1;return(!S.ctrlKey||S.type==="wheel")&&W})},[D,M,r,s,i,c,h,d,F]),J.createElement("div",{className:"react-flow__renderer",ref:I,style:df},y)},eP=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function tP(){const{userSelectionActive:t,userSelectionRect:e}=mt(eP,on);return t&&e?J.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 S2(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 C2(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&&S2(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&&S2(o,i);break;case"remove":return o}return o.push(i),o},n)}function N2(t,e){return C2(t,e)}const rr=(t,e)=>({id:t,type:"select",selected:e});function Ss(t,e){return t.reduce((n,o)=>{const r=e.includes(o.id);return!o.selected&&r?(o.selected=!0,n.push(rr(o.id,!0))):o.selected&&!r&&(o.selected=!1,n.push(rr(o.id,!1))),n},[])}const uf=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},nP=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),j2=T.memo(({isSelecting:t,selectionMode:e=Ki.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:r,onPaneClick:s,onPaneContextMenu:i,onPaneScroll:a,onPaneMouseEnter:l,onPaneMouseMove:c,onPaneMouseLeave:d,children:h})=>{const f=T.useRef(null),m=qt(),_=T.useRef(0),g=T.useRef(0),p=T.useRef(),{userSelectionActive:b,elementsSelectable:y,dragging:x}=mt(nP,on),k=()=>{m.setState({userSelectionActive:!1,userSelectionRect:null}),_.current=0,g.current=0},C=N=>{s==null||s(N),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},v=a?N=>a(N):void 0,E=y&&(t||b);return J.createElement("div",{className:hn(["react-flow__pane",{dragging:x,selection:t}]),onClick:E?void 0:uf(C,f),onContextMenu:uf(N=>{Array.isArray(n)&&(n!=null&&n.includes(2))?N.preventDefault():i==null||i(N)},f),onWheel:uf(v,f),onMouseEnter:E?void 0:l,onMouseDown:E?N=>{const{resetSelectedElements:I,domNode:A}=m.getState();if(p.current=A==null?void 0:A.getBoundingClientRect(),!y||!t||N.button!==0||N.target!==f.current||!p.current)return;const{x:M,y:R}=er(N,p.current);I(),m.setState({userSelectionRect:{width:0,height:0,startX:M,startY:R,x:M,y:R}}),o==null||o(N)}:void 0,onMouseMove:E?N=>{const{userSelectionRect:I,nodeInternals:A,edges:M,transform:R,onNodesChange:z,onEdgesChange:D,nodeOrigin:F,getNodes:B}=m.getState();if(!t||!p.current||!I)return;m.setState({userSelectionActive:!0,nodesSelectionActive:!1});const U=er(N,p.current),O=I.startX??0,S=I.startY??0,$={...I,x:U.x<O?U.x:O,y:U.y<S?U.y:S,width:Math.abs(U.x-O),height:Math.abs(U.y-S)},j=B(),W=Qv(A,$,R,e===Ki.Partial,!0,F),X=e2(W,M).map(q=>q.id),Y=W.map(q=>q.id);if(_.current!==Y.length){_.current=Y.length;const q=Ss(j,Y);q.length&&(z==null||z(q))}if(g.current!==X.length){g.current=X.length;const q=Ss(M,X);q.length&&(D==null||D(q))}m.setState({userSelectionRect:$})}:c,onMouseUp:E?N=>{if(N.button!==0)return;const{userSelectionRect:I}=m.getState();!b&&I&&N.target===f.current&&(C==null||C(N)),m.setState({nodesSelectionActive:_.current>0}),k(),r==null||r(N)}:void 0,onMouseLeave:E?N=>{b&&(m.setState({nodesSelectionActive:_.current>0}),r==null||r(N)),k()}:d,ref:f,style:df},h,J.createElement(tP,null))});function E2(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const o=e.get(n);return!!o&&(!!o.selected||E2(o,e))}function I2(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 oP(t,e,n,o){return Array.from(t.values()).filter(r=>(r.selected||r.id===o)&&(!r.parentNode||r.parentId||!E2(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 A2(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}=xs(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}=xs(h,r).positionAbsolute;a=h&&Vn(f)&&Vn(m)&&Vn(h.width)&&Vn(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",vR()),a=i;let c={x:0,y:0};if(l){const h=n.get(l);c=xs(h,r).positionAbsolute}const d=a&&a!=="parent"?Wh(e,a):e;return{position:{x:d.x-c.x,y:d.y-c.y},positionAbsolute:d}}function hf({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]}j2.displayName="Pane";const T2=(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,...Hh(c)}})};function ea(t,e,n){return n===void 0?n:o=>{const r=e().nodeInternals.get(t);r&&n(o,{...r})}}function ff({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",jR(t))}function mf(t){return(e,n,o)=>t==null?void 0:t(e,o)}function M2({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:s,selectNodesOnDrag:i}){const a=qt(),[l,c]=T.useState(!1),d=T.useRef([]),h=T.useRef({x:null,y:null}),f=T.useRef(0),m=T.useRef(null),_=T.useRef({x:0,y:0}),g=T.useRef(null),p=T.useRef(!1),b=T.useRef(!1),y=T.useRef(!1),x=function(){const k=qt();return T.useCallback(({sourceEvent:v})=>{const{transform:E,snapGrid:N,snapToGrid:I}=k.getState(),A=v.touches?v.touches[0].clientX:v.clientX,M=v.touches?v.touches[0].clientY:v.clientY,R={x:(A-E[0])/E[2],y:(M-E[1])/E[2]};return{xSnapped:I?N[0]*Math.round(R.x/N[0]):R.x,ySnapped:I?N[1]*Math.round(R.y/N[1]):R.y,...R}},[])}();return T.useEffect(()=>{if(t!=null&&t.current){const k=ro(t.current),C=({x:N,y:I})=>{const{nodeInternals:A,onNodeDrag:M,onSelectionDrag:R,updateNodePositions:z,nodeExtent:D,snapGrid:F,snapToGrid:B,nodeOrigin:U,onError:O}=a.getState();h.current={x:N,y:I};let S=!1,$={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&D){const W=of(d.current,U);$=qh(W)}if(d.current=d.current.map(W=>{const X={x:N-W.distance.x,y:I-W.distance.y};B&&(X.x=F[0]*Math.round(X.x/F[0]),X.y=F[1]*Math.round(X.y/F[1]));const Y=[[D[0][0],D[0][1]],[D[1][0],D[1][1]]];d.current.length>1&&D&&!W.extent&&(Y[0][0]=W.positionAbsolute.x-$.x+D[0][0],Y[1][0]=W.positionAbsolute.x+(W.width??0)-$.x2+D[1][0],Y[0][1]=W.positionAbsolute.y-$.y+D[0][1],Y[1][1]=W.positionAbsolute.y+(W.height??0)-$.y2+D[1][1]);const q=A2(W,X,A,Y,U,O);return S=S||W.position.x!==q.position.x||W.position.y!==q.position.y,W.position=q.position,W.positionAbsolute=q.positionAbsolute,W}),!S)return;z(d.current,!0,!0),c(!0);const j=r?M:mf(R);if(j&&g.current){const[W,X]=hf({nodeId:r,dragItems:d.current,nodeInternals:A});j(g.current,W,X)}},v=()=>{if(!m.current)return;const[N,I]=Pv(_.current,m.current);if(N!==0||I!==0){const{transform:A,panBy:M}=a.getState();h.current.x=(h.current.x??0)-N/A[2],h.current.y=(h.current.y??0)-I/A[2],M({x:N,y:I})&&C(h.current)}f.current=requestAnimationFrame(v)},E=N=>{var U;const{nodeInternals:I,multiSelectionActive:A,nodesDraggable:M,unselectNodesAndEdges:R,onNodeDragStart:z,onSelectionDragStart:D}=a.getState();b.current=!0;const F=r?z:mf(D);i&&s||A||!r||(U=I.get(r))!=null&&U.selected||R(),r&&s&&i&&ff({id:r,store:a,nodeRef:t});const B=x(N);if(h.current=B,d.current=oP(I,M,B,r),F&&d.current){const[O,S]=hf({nodeId:r,dragItems:d.current,nodeInternals:I});F(N.sourceEvent,O,S)}};if(!e){const N=function(){var I,A,M,R,z=cR,D=dR,F=uR,B=hR,U={},O=ZS("start","drag","end"),S=0,$=0;function j(Z){Z.on("mousedown.drag",W).filter(B).on("touchstart.drag",q).on("touchmove.drag",ne,lR).on("touchend.drag touchcancel.drag",re).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function W(Z,Q){if(!R&&z.call(this,Z,Q)){var he=ae(this,D.call(this,Z,Q),Z,Q,"mouse");he&&(ro(Z.view).on("mousemove.drag",X,qi).on("mouseup.drag",Y,qi),Tv(Z.view),Uh(Z),M=!1,I=Z.clientX,A=Z.clientY,he("start",Z))}}function X(Z){if(_s(Z),!M){var Q=Z.clientX-I,he=Z.clientY-A;M=Q*Q+he*he>$}U.mouse("drag",Z)}function Y(Z){ro(Z.view).on("mousemove.drag mouseup.drag",null),Mv(Z.view,M),_s(Z),U.mouse("end",Z)}function q(Z,Q){if(z.call(this,Z,Q)){var he,pe,ce=Z.changedTouches,fe=D.call(this,Z,Q),de=ce.length;for(he=0;he<de;++he)(pe=ae(this,fe,Z,Q,ce[he].identifier,ce[he]))&&(Uh(Z),pe("start",Z,ce[he]))}}function ne(Z){var Q,he,pe=Z.changedTouches,ce=pe.length;for(Q=0;Q<ce;++Q)(he=U[pe[Q].identifier])&&(_s(Z),he("drag",Z,pe[Q]))}function re(Z){var Q,he,pe=Z.changedTouches,ce=pe.length;for(R&&clearTimeout(R),R=setTimeout(function(){R=null},500),Q=0;Q<ce;++Q)(he=U[pe[Q].identifier])&&(Uh(Z),he("end",Z,pe[Q]))}function ae(Z,Q,he,pe,ce,fe){var de,Ce,Ne,se=O.copy(),Ie=mo(fe||he,Q);if((Ne=F.call(Z,new Vh("beforestart",{sourceEvent:he,target:j,identifier:ce,active:S,x:Ie[0],y:Ie[1],dx:0,dy:0,dispatch:se}),pe))!=null)return de=Ne.x-Ie[0]||0,Ce=Ne.y-Ie[1]||0,function be(Oe,ze,Ge){var Je,Le=Ie;switch(Oe){case"start":U[ce]=be,Je=S++;break;case"end":delete U[ce],--S;case"drag":Ie=mo(Ge||ze,Q),Je=S}se.call(Oe,Z,new Vh(Oe,{sourceEvent:ze,subject:Ne,target:j,identifier:ce,active:Je,x:Ie[0]+de,y:Ie[1]+Ce,dx:Ie[0]-Le[0],dy:Ie[1]-Le[1],dispatch:se}),pe)}}return j.filter=function(Z){return arguments.length?(z=typeof Z=="function"?Z:Wl(!!Z),j):z},j.container=function(Z){return arguments.length?(D=typeof Z=="function"?Z:Wl(Z),j):D},j.subject=function(Z){return arguments.length?(F=typeof Z=="function"?Z:Wl(Z),j):F},j.touchable=function(Z){return arguments.length?(B=typeof Z=="function"?Z:Wl(!!Z),j):B},j.on=function(){var Z=O.on.apply(O,arguments);return Z===O?j:Z},j.clickDistance=function(Z){return arguments.length?($=(Z=+Z)*Z,j):Math.sqrt($)},j}().on("start",I=>{const{domNode:A,nodeDragThreshold:M}=a.getState();M===0&&E(I),y.current=!1;const R=x(I);h.current=R,m.current=(A==null?void 0:A.getBoundingClientRect())||null,_.current=er(I.sourceEvent,m.current)}).on("drag",I=>{var z,D;const A=x(I),{autoPanOnNodeDrag:M,nodeDragThreshold:R}=a.getState();if(I.sourceEvent.type==="touchmove"&&I.sourceEvent.touches.length>1&&(y.current=!0),!y.current){if(!p.current&&b.current&&M&&(p.current=!0,v()),!b.current){const F=A.xSnapped-(((z=h==null?void 0:h.current)==null?void 0:z.x)??0),B=A.ySnapped-(((D=h==null?void 0:h.current)==null?void 0:D.y)??0);Math.sqrt(F*F+B*B)>R&&E(I)}(h.current.x!==A.xSnapped||h.current.y!==A.ySnapped)&&d.current&&b.current&&(g.current=I.sourceEvent,_.current=er(I.sourceEvent,m.current),C(A))}}).on("end",I=>{if(b.current&&!y.current&&(c(!1),p.current=!1,b.current=!1,cancelAnimationFrame(f.current),d.current)){const{updateNodePositions:A,nodeInternals:M,onNodeDragStop:R,onSelectionDragStop:z}=a.getState(),D=r?R:mf(z);if(A(d.current,!1,!1),D){const[F,B]=hf({nodeId:r,dragItems:d.current,nodeInternals:M});D(I.sourceEvent,F,B)}}}).filter(I=>{const A=I.target;return!I.button&&(!n||!I2(A,`.${n}`,t))&&(!o||I2(A,o,t))});return k.call(N),()=>{k.on(".drag",null)}}k.on(".drag",null)}},[t,e,n,o,s,a,r,i,x]),l}function O2(){const t=qt();return T.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,_=n.isShiftPressed?4:1,g=n.x*f*_,p=n.y*m*_,b=h.map(y=>{if(y.positionAbsolute){const x={x:y.positionAbsolute.x+g,y:y.positionAbsolute.y+p};a&&(x.x=l[0]*Math.round(x.x/l[0]),x.y=l[1]*Math.round(x.y/l[1]));const{positionAbsolute:k,position:C}=A2(y,x,o,r,void 0,c);y.position=C,y.positionAbsolute=k}return y});s(b,!0,!1)},[])}const Cs={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var ta=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:_,onDoubleClick:g,style:p,className:b,isDraggable:y,isSelectable:x,isConnectable:k,isFocusable:C,selectNodesOnDrag:v,sourcePosition:E,targetPosition:N,hidden:I,resizeObserver:A,dragHandle:M,zIndex:R,isParent:z,noDragClassName:D,noPanClassName:F,initialized:B,disableKeyboardA11y:U,ariaLabel:O,rfId:S,hasHandleBounds:$})=>{const j=qt(),W=T.useRef(null),X=T.useRef(null),Y=T.useRef(E),q=T.useRef(N),ne=T.useRef(o),re=x||y||d||h||f||m,ae=O2(),Z=ea(n,j.getState,h),Q=ea(n,j.getState,f),he=ea(n,j.getState,m),pe=ea(n,j.getState,_),ce=ea(n,j.getState,g);T.useEffect(()=>()=>{X.current&&(A==null||A.unobserve(X.current),X.current=null)},[]),T.useEffect(()=>{if(W.current&&!I){const de=W.current;B&&$&&X.current===de||(X.current&&(A==null||A.unobserve(X.current)),A==null||A.observe(de),X.current=de)}},[I,B,$]),T.useEffect(()=>{const de=ne.current!==o,Ce=Y.current!==E,Ne=q.current!==N;W.current&&(de||Ce||Ne)&&(de&&(ne.current=o),Ce&&(Y.current=E),Ne&&(q.current=N),j.getState().updateNodeDimensions([{id:n,nodeElement:W.current,forceUpdate:!0}]))},[n,o,E,N]);const fe=M2({nodeRef:W,disabled:I||!y,noDragClassName:D,handleSelector:M,nodeId:n,isSelectable:x,selectNodesOnDrag:v});return I?null:J.createElement("div",{className:hn(["react-flow__node",`react-flow__node-${o}`,{[F]:y},b,{selected:c,selectable:x,parent:z,dragging:fe}]),ref:W,style:{zIndex:R,transform:`translate(${a}px,${l}px)`,pointerEvents:re?"all":"none",visibility:B?"visible":"hidden",...p},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:Z,onMouseMove:Q,onMouseLeave:he,onContextMenu:pe,onClick:de=>{const{nodeDragThreshold:Ce}=j.getState();if(x&&(!v||!y||Ce>0)&&ff({id:n,store:j,nodeRef:W}),d){const Ne=j.getState().nodeInternals.get(n);Ne&&d(de,{...Ne})}},onDoubleClick:ce,onKeyDown:C?de=>{if(!Yh(de)&&!U)if(zv.includes(de.key)&&x){const Ce=de.key==="Escape";ff({id:n,store:j,unselect:Ce,nodeRef:W})}else y&&c&&Object.prototype.hasOwnProperty.call(Cs,de.key)&&(j.setState({ariaLiveMessage:`Moved selected node ${de.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~s}, y: ${~~i}`}),ae({x:Cs[de.key].x,y:Cs[de.key].y,isShiftPressed:de.shiftKey}))}:void 0,tabIndex:C?0:void 0,role:C?"button":void 0,"aria-describedby":U?void 0:`${p2}-${S}`,"aria-label":O},J.createElement(MR,{value:n},J.createElement(t,{id:n,data:r,type:o,xPos:s,yPos:i,selected:c,isConnectable:k,sourcePosition:E,targetPosition:N,dragging:fe,dragHandle:M,zIndex:R})))};return e.displayName="NodeWrapper",T.memo(e)};const rP=t=>{const e=t.getNodes().filter(n=>n.selected);return{...of(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};var sP=T.memo(function({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const o=qt(),{width:r,height:s,x:i,y:a,transformString:l,userSelectionActive:c}=mt(rP,on),d=O2(),h=T.useRef(null);if(T.useEffect(()=>{var m;n||((m=h.current)==null||m.focus({preventScroll:!0}))},[n]),M2({nodeRef:h}),c||!r||!s)return null;const f=t?m=>{const _=o.getState().getNodes().filter(g=>g.selected);t(m,_)}:void 0;return J.createElement("div",{className:hn(["react-flow__nodesselection","react-flow__container",e]),style:{transform:l}},J.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(Cs,m.key)&&d({x:Cs[m.key].x,y:Cs[m.key].y,isShiftPressed:m.shiftKey})},style:{width:r,height:s,top:a,left:i}}))});const iP=t=>t.nodesSelectionActive,D2=({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:_,onSelectionEnd:g,multiSelectionKeyCode:p,panActivationKeyCode:b,zoomActivationKeyCode:y,elementsSelectable:x,zoomOnScroll:k,zoomOnPinch:C,panOnScroll:v,panOnScrollSpeed:E,panOnScrollMode:N,zoomOnDoubleClick:I,panOnDrag:A,defaultViewport:M,translateExtent:R,minZoom:z,maxZoom:D,preventScrolling:F,onSelectionContextMenu:B,noWheelClassName:U,noPanClassName:O,disableKeyboardA11y:S})=>{const $=mt(iP),j=Zi(h),W=Zi(b),X=W||A,Y=W||v,q=j||f&&X!==!0;return(({deleteKeyCode:ne,multiSelectionKeyCode:re})=>{const ae=qt(),{deleteElements:Z}=Qi(),Q=Zi(ne,XR),he=Zi(re);T.useEffect(()=>{if(Q){const{edges:pe,getNodes:ce}=ae.getState(),fe=ce().filter(Ce=>Ce.selected),de=pe.filter(Ce=>Ce.selected);Z({nodes:fe,edges:de}),ae.setState({nodesSelectionActive:!1})}},[Q]),T.useEffect(()=>{ae.setState({multiSelectionActive:he})},[he])})({deleteKeyCode:a,multiSelectionKeyCode:p}),J.createElement(QR,{onMove:l,onMoveStart:c,onMoveEnd:d,onPaneContextMenu:s,elementsSelectable:x,zoomOnScroll:k,zoomOnPinch:C,panOnScroll:Y,panOnScrollSpeed:E,panOnScrollMode:N,zoomOnDoubleClick:I,panOnDrag:!j&&X,defaultViewport:M,translateExtent:R,minZoom:z,maxZoom:D,zoomActivationKeyCode:y,preventScrolling:F,noWheelClassName:U,noPanClassName:O},J.createElement(j2,{onSelectionStart:_,onSelectionEnd:g,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:X,isSelecting:!!q,selectionMode:m},t,$&&J.createElement(sP,{onSelectionContextMenu:B,noPanClassName:O,disableKeyboardA11y:S})))};D2.displayName="FlowRenderer";var aP=T.memo(D2);function lP(t){return{input:ta(t.input||d2),default:ta(t.default||af),output:ta(t.output||h2),group:ta(t.group||lf),...Object.keys(t).filter(e=>!["input","default","output","group"].includes(e)).reduce((e,n)=>(e[n]=ta(t[n]||af),e),{})}}const cP=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),R2=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,updateNodeDimensions:s,onError:i}=mt(cP,on),a=(l=t.onlyRenderVisibleElements,mt(T.useCallback(h=>l?Qv(h.nodeInternals,{x:0,y:0,width:h.width,height:h.height},h.transform,!0):h.getNodes(),[l])));var l;const c=T.useRef(),d=T.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(f=>{const m=f.map(_=>({id:_.target.getAttribute("data-id"),nodeElement:_.target,forceUpdate:!0}));s(m)});return c.current=h,h},[]);return T.useEffect(()=>()=>{var h;(h=c==null?void 0:c.current)==null||h.disconnect()},[]),J.createElement("div",{className:"react-flow__nodes",style:df},a.map(h=>{var v,E,N;let f=h.type||"default";t.nodeTypes[f]||(i==null||i("003",xR(f)),f="default");const m=t.nodeTypes[f]||t.nodeTypes.default,_=!!(h.draggable||e&&h.draggable===void 0),g=!!(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?Wh(h.positionAbsolute,t.nodeExtent):h.positionAbsolute,x=(y==null?void 0:y.x)??0,k=(y==null?void 0:y.y)??0,C=(({x:I,y:A,width:M,height:R,origin:z})=>M&&R?z[0]<0||z[1]<0||z[0]>1||z[1]>1?{x:I,y:A}:{x:I-M*z[0],y:A-R*z[1]}:{x:I,y:A})({x,y:k,width:h.width??0,height:h.height??0,origin:t.nodeOrigin});return J.createElement(m,{key:h.id,id:h.id,className:h.className,style:h.style,type:f,data:h.data,sourcePosition:h.sourcePosition||Ue.Bottom,targetPosition:h.targetPosition||Ue.Top,hidden:h.hidden,xPos:x,yPos:k,xPosOrigin:C.x,yPosOrigin:C.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:_,isSelectable:g,isConnectable:p,isFocusable:b,resizeObserver:d,dragHandle:h.dragHandle,zIndex:((v=h[Nt])==null?void 0:v.z)??0,isParent:!!((E=h[Nt])!=null&&E.isParent),noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!h.width&&!!h.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((N=h[Nt])!=null&&N.handleBounds)})}))};R2.displayName="NodeRenderer";var dP=T.memo(R2);const uP=(t,e,n)=>n===Ue.Left?t-e:n===Ue.Right?t+e:t,hP=(t,e,n)=>n===Ue.Top?t-e:n===Ue.Bottom?t+e:t,P2="react-flow__edgeupdater",L2=({position:t,centerX:e,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:s,onMouseOut:i,type:a})=>J.createElement("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:i,className:hn([P2,`${P2}-${a}`]),cx:uP(e,o,t),cy:hP(n,o,t),r:o,stroke:"transparent",fill:"transparent"}),fP=()=>!0;var Ns=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:_,labelBgBorderRadius:g,style:p,source:b,target:y,sourceX:x,sourceY:k,targetX:C,targetY:v,sourcePosition:E,targetPosition:N,elementsSelectable:I,hidden:A,sourceHandleId:M,targetHandleId:R,onContextMenu:z,onMouseEnter:D,onMouseMove:F,onMouseLeave:B,reconnectRadius:U,onReconnect:O,onReconnectStart:S,onReconnectEnd:$,markerEnd:j,markerStart:W,rfId:X,ariaLabel:Y,isFocusable:q,isReconnectable:ne,pathOptions:re,interactionWidth:ae,disableKeyboardA11y:Z})=>{const Q=T.useRef(null),[he,pe]=T.useState(!1),[ce,fe]=T.useState(!1),de=qt(),Ce=T.useMemo(()=>`url('#${tf(W,X)}')`,[W,X]),Ne=T.useMemo(()=>`url('#${tf(j,X)}')`,[j,X]);if(A)return null;const se=Ji(n,de.getState,a),Ie=Ji(n,de.getState,z),be=Ji(n,de.getState,D),Oe=Ji(n,de.getState,F),ze=Ji(n,de.getState,B),Ge=(Qe,tt)=>{if(Qe.button!==0)return;const{edges:te,isValidConnection:ye}=de.getState(),ke=tt?y:b,Me=(tt?R:M)||null,G=tt?"target":"source",ge=ye||fP,_e=tt,me=te.find(le=>le.id===n);fe(!0),S==null||S(Qe,me,G),s2({event:Qe,handleId:Me,nodeId:ke,onConnect:le=>O==null?void 0:O(me,le),isTarget:_e,getState:de.getState,setState:de.setState,isValidConnection:ge,edgeUpdaterType:G,onReconnectEnd:le=>{fe(!1),$==null||$(le,me,G)}})},Je=()=>pe(!0),Le=()=>pe(!1),et=!I&&!i;return J.createElement("g",{className:hn(["react-flow__edge",`react-flow__edge-${r}`,o,{selected:l,animated:c,inactive:et,updating:he}]),onClick:Qe=>{var G;const{edges:tt,addSelectedEdges:te,unselectNodesAndEdges:ye,multiSelectionActive:ke}=de.getState(),Me=tt.find(ge=>ge.id===n);Me&&(I&&(de.setState({nodesSelectionActive:!1}),Me.selected&&ke?(ye({nodes:[],edges:[Me]}),(G=Q.current)==null||G.blur()):te([n])),i&&i(Qe,Me))},onDoubleClick:se,onContextMenu:Ie,onMouseEnter:be,onMouseMove:Oe,onMouseLeave:ze,onKeyDown:q?Qe=>{var tt;if(!Z&&zv.includes(Qe.key)&&I){const{unselectNodesAndEdges:te,addSelectedEdges:ye,edges:ke}=de.getState();Qe.key==="Escape"?((tt=Q.current)==null||tt.blur(),te({edges:[ke.find(Me=>Me.id===n)]})):ye([n])}}:void 0,tabIndex:q?0:void 0,role:q?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":Y===null?void 0:Y||`Edge from ${b} to ${y}`,"aria-describedby":q?`${g2}-${X}`:void 0,ref:Q},!ce&&J.createElement(t,{id:n,source:b,target:y,selected:l,animated:c,label:d,labelStyle:h,labelShowBg:f,labelBgStyle:m,labelBgPadding:_,labelBgBorderRadius:g,data:s,style:p,sourceX:x,sourceY:k,targetX:C,targetY:v,sourcePosition:E,targetPosition:N,sourceHandleId:M,targetHandleId:R,markerStart:Ce,markerEnd:Ne,pathOptions:re,interactionWidth:ae}),ne&&J.createElement(J.Fragment,null,(ne==="source"||ne===!0)&&J.createElement(L2,{position:E,centerX:x,centerY:k,radius:U,onMouseDown:Qe=>Ge(Qe,!0),onMouseEnter:Je,onMouseOut:Le,type:"source"}),(ne==="target"||ne===!0)&&J.createElement(L2,{position:N,centerX:C,centerY:v,radius:U,onMouseDown:Qe=>Ge(Qe,!1),onMouseEnter:Je,onMouseOut:Le,type:"target"})))};return e.displayName="EdgeWrapper",T.memo(e)};function mP(t){return{default:Ns(t.default||Ql),straight:Ns(t.bezier||Qh),step:Ns(t.step||Zh),smoothstep:Ns(t.step||Xl),simplebezier:Ns(t.simplebezier||Kh),...Object.keys(t).filter(e=>!["default","bezier"].includes(e)).reduce((e,n)=>(e[n]=Ns(t[n]||Ql),e),{})}}function F2(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 Ue.Top:return{x:o+s/2,y:r};case Ue.Right:return{x:o+s,y:r+i/2};case Ue.Bottom:return{x:o+s/2,y:r+i};case Ue.Left:return{x:o,y:r+i/2}}}function z2(t,e){return t?t.length!==1&&e?e&&t.find(n=>n.id===e)||null:t[0]:null}function B2(t){var o,r,s,i,a;const e=((o=t==null?void 0:t[Nt])==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 pP=[{level:0,isMaxLevel:!0,edges:[]}];function gP(t,e,n){return function(o,r,s=!1){let i=-1;const a=o.reduce((c,d)=>{var m,_;const h=Vn(d.zIndex);let f=h?d.zIndex:0;if(s){const g=r.get(d.target),p=r.get(d.source),b=d.selected||(g==null?void 0:g.selected)||(p==null?void 0:p.selected),y=Math.max(((m=p==null?void 0:p[Nt])==null?void 0:m.z)||0,((_=g==null?void 0:g[Nt])==null?void 0:_.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?pP:l}(mt(T.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:_,transform:g}){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=qh({x:(0-g[0])/g[2],y:(0-g[1])/g[2],width:m/g[2],height:_/g[2]}),y=Math.max(0,Math.min(b.x2,p.x2)-Math.max(b.x,p.x)),x=Math.max(0,Math.min(b.y2,p.y2)-Math.max(b.y,p.y));return Math.ceil(y*x)>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 U2={[ys.Arrow]:({color:t="none",strokeWidth:e=1})=>J.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[ys.ArrowClosed]:({color:t="none",strokeWidth:e=1})=>J.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},_P=({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=qt();return T.useMemo(()=>{var h,f;return Object.prototype.hasOwnProperty.call(U2,c)?U2[c]:((f=(h=d.getState()).onError)==null||f.call(h,"009",kR(c)),null)},[c])}(e);return l?J.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"},J.createElement(l,{color:n,strokeWidth:i})):null},V2=({defaultColor:t,rfId:e})=>{const n=mt(T.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=tf(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 J.createElement("defs",null,n.map(o=>J.createElement(_P,{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})))};V2.displayName="MarkerDefinitions";var bP=T.memo(V2);const yP=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}),$2=({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:_,reconnectRadius:g,children:p,disableKeyboardA11y:b})=>{const{edgesFocusable:y,edgesUpdatable:x,elementsSelectable:k,width:C,height:v,connectionMode:E,nodeInternals:N,onError:I}=mt(yP,on),A=gP(e,N,n);return C?J.createElement(J.Fragment,null,A.map(({level:M,edges:R,isMaxLevel:z})=>J.createElement("svg",{key:M,style:{zIndex:M},width:C,height:v,className:"react-flow__edges react-flow__container"},z&&J.createElement(bP,{defaultColor:t,rfId:o}),J.createElement("g",null,R.map(D=>{const[F,B,U]=B2(N.get(D.source)),[O,S,$]=B2(N.get(D.target));if(!U||!$)return null;let j=D.type||"default";r[j]||(I==null||I("011",NR(j)),j="default");const W=r[j]||r.default,X=E===Or.Strict?S.target:(S.target??[]).concat(S.source??[]),Y=z2(B.source,D.sourceHandle),q=z2(X,D.targetHandle),ne=(Y==null?void 0:Y.position)||Ue.Bottom,re=(q==null?void 0:q.position)||Ue.Top,ae=!!(D.focusable||y&&D.focusable===void 0),Z=D.reconnectable||D.updatable,Q=f!==void 0&&(Z||x&&Z===void 0);if(!Y||!q)return I==null||I("008",SR(Y,D)),null;const{sourceX:he,sourceY:pe,targetX:ce,targetY:fe}=((de,Ce,Ne,se,Ie,be)=>{const Oe=F2(Ne,de,Ce),ze=F2(be,se,Ie);return{sourceX:Oe.x,sourceY:Oe.y,targetX:ze.x,targetY:ze.y}})(F,Y,ne,O,q,re);return J.createElement(W,{key:D.id,id:D.id,className:hn([D.className,s]),type:j,data:D.data,selected:!!D.selected,animated:!!D.animated,hidden:!!D.hidden,label:D.label,labelStyle:D.labelStyle,labelShowBg:D.labelShowBg,labelBgStyle:D.labelBgStyle,labelBgPadding:D.labelBgPadding,labelBgBorderRadius:D.labelBgBorderRadius,style:D.style,source:D.source,target:D.target,sourceHandleId:D.sourceHandle,targetHandleId:D.targetHandle,markerEnd:D.markerEnd,markerStart:D.markerStart,sourceX:he,sourceY:pe,targetX:ce,targetY:fe,sourcePosition:ne,targetPosition:re,elementsSelectable:k,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:d,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:m,onReconnectEnd:_,reconnectRadius:g,rfId:o,ariaLabel:D.ariaLabel,isFocusable:ae,isReconnectable:Q,pathOptions:"pathOptions"in D?D.pathOptions:void 0,interactionWidth:D.interactionWidth,disableKeyboardA11y:b})})))),p):null};$2.displayName="EdgeRenderer";var xP=T.memo($2);const wP=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function vP({children:t}){const e=mt(wP);return J.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}const kP={[Ue.Left]:Ue.Right,[Ue.Right]:Ue.Left,[Ue.Top]:Ue.Bottom,[Ue.Bottom]:Ue.Top},H2=({nodeId:t,handleType:e,style:n,type:o=nr.Bezier,CustomComponent:r,connectionStatus:s})=>{var v,E,N;const{fromNode:i,handleId:a,toX:l,toY:c,connectionMode:d}=mt(T.useCallback(I=>({fromNode:I.nodeInternals.get(t),handleId:I.connectionHandleId,toX:(I.connectionPosition.x-I.transform[0])/I.transform[2],toY:(I.connectionPosition.y-I.transform[1])/I.transform[2],connectionMode:I.connectionMode}),[t]),on),h=(v=i==null?void 0:i[Nt])==null?void 0:v.handleBounds;let f=h==null?void 0:h[e];if(d===Or.Loose&&(f=f||(h==null?void 0:h[e==="source"?"target":"source"])),!i||!f)return null;const m=a?f.find(I=>I.id===a):f[0],_=m?m.x+m.width/2:(i.width??0)/2,g=m?m.y+m.height/2:i.height??0,p=(((E=i.positionAbsolute)==null?void 0:E.x)??0)+_,b=(((N=i.positionAbsolute)==null?void 0:N.y)??0)+g,y=m==null?void 0:m.position,x=y?kP[y]:null;if(!y||!x)return null;if(r)return J.createElement(r,{connectionLineType:o,connectionLineStyle:n,fromNode:i,fromHandle:m,fromX:p,fromY:b,toX:l,toY:c,fromPosition:y,toPosition:x,connectionStatus:s});let k="";const C={sourceX:p,sourceY:b,sourcePosition:y,targetX:l,targetY:c,targetPosition:x};return o===nr.Bezier?[k]=Xv(C):o===nr.Step?[k]=Xh({...C,borderRadius:0}):o===nr.SmoothStep?[k]=Xh(C):o===nr.SimpleBezier?[k]=Gv(C):k=`M${p},${b} ${l},${c}`,J.createElement("path",{d:k,fill:"none",className:"react-flow__connection-path",style:n})};H2.displayName="ConnectionLine";const SP=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function CP({containerStyle:t,style:e,type:n,component:o}){const{nodeId:r,handleType:s,nodesConnectable:i,width:a,height:l,connectionStatus:c}=mt(SP,on);return r&&s&&a&&i?J.createElement("svg",{style:t,width:a,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},J.createElement("g",{className:hn(["react-flow__connection",c])},J.createElement(H2,{nodeId:r,handleType:s,style:e,type:n,CustomComponent:o,connectionStatus:c}))):null}function W2(t,e){return T.useRef(null),qt(),T.useMemo(()=>e(t),[t])}const q2=({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:_,onSelectionStart:g,onSelectionEnd:p,connectionLineType:b,connectionLineStyle:y,connectionLineComponent:x,connectionLineContainerStyle:k,selectionKeyCode:C,selectionOnDrag:v,selectionMode:E,multiSelectionKeyCode:N,panActivationKeyCode:I,zoomActivationKeyCode:A,deleteKeyCode:M,onlyRenderVisibleElements:R,elementsSelectable:z,selectNodesOnDrag:D,defaultViewport:F,translateExtent:B,minZoom:U,maxZoom:O,preventScrolling:S,defaultMarkerColor:$,zoomOnScroll:j,zoomOnPinch:W,panOnScroll:X,panOnScrollSpeed:Y,panOnScrollMode:q,zoomOnDoubleClick:ne,panOnDrag:re,onPaneClick:ae,onPaneMouseEnter:Z,onPaneMouseMove:Q,onPaneMouseLeave:he,onPaneScroll:pe,onPaneContextMenu:ce,onEdgeContextMenu:fe,onEdgeMouseEnter:de,onEdgeMouseMove:Ce,onEdgeMouseLeave:Ne,onReconnect:se,onReconnectStart:Ie,onReconnectEnd:be,reconnectRadius:Oe,noDragClassName:ze,noWheelClassName:Ge,noPanClassName:Je,elevateEdgesOnSelect:Le,disableKeyboardA11y:et,nodeOrigin:Qe,nodeExtent:tt,rfId:te})=>{const ye=W2(t,lP),ke=W2(e,mP);return function(Me){const G=Qi(),ge=T.useRef(!1);T.useEffect(()=>{!ge.current&&G.viewportInitialized&&Me&&(setTimeout(()=>Me(G),1),ge.current=!0)},[Me,G.viewportInitialized])}(s),J.createElement(aP,{onPaneClick:ae,onPaneMouseEnter:Z,onPaneMouseMove:Q,onPaneMouseLeave:he,onPaneContextMenu:ce,onPaneScroll:pe,deleteKeyCode:M,selectionKeyCode:C,selectionOnDrag:v,selectionMode:E,onSelectionStart:g,onSelectionEnd:p,multiSelectionKeyCode:N,panActivationKeyCode:I,zoomActivationKeyCode:A,elementsSelectable:z,onMove:n,onMoveStart:o,onMoveEnd:r,zoomOnScroll:j,zoomOnPinch:W,zoomOnDoubleClick:ne,panOnScroll:X,panOnScrollSpeed:Y,panOnScrollMode:q,panOnDrag:re,defaultViewport:F,translateExtent:B,minZoom:U,maxZoom:O,onSelectionContextMenu:_,preventScrolling:S,noDragClassName:ze,noWheelClassName:Ge,noPanClassName:Je,disableKeyboardA11y:et},J.createElement(vP,null,J.createElement(xP,{edgeTypes:ke,onEdgeClick:a,onEdgeDoubleClick:c,onlyRenderVisibleElements:R,onEdgeContextMenu:fe,onEdgeMouseEnter:de,onEdgeMouseMove:Ce,onEdgeMouseLeave:Ne,onReconnect:se,onReconnectStart:Ie,onReconnectEnd:be,reconnectRadius:Oe,defaultMarkerColor:$,noPanClassName:Je,elevateEdgesOnSelect:!!Le,disableKeyboardA11y:et,rfId:te},J.createElement(CP,{style:y,type:b,component:x,containerStyle:k})),J.createElement("div",{className:"react-flow__edgelabel-renderer"}),J.createElement(dP,{nodeTypes:ye,onNodeClick:i,onNodeDoubleClick:l,onNodeMouseEnter:d,onNodeMouseMove:h,onNodeMouseLeave:f,onNodeContextMenu:m,selectNodesOnDrag:D,onlyRenderVisibleElements:R,noPanClassName:Je,noDragClassName:ze,disableKeyboardA11y:et,nodeOrigin:Qe,nodeExtent:tt,rfId:te})))};q2.displayName="GraphView";var NP=T.memo(q2);const pf=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],sr={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:pf,nodeExtent:pf,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Or.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},jP=()=>((t,e)=>t?Av(t,e):Av)((t,e)=>({...sr,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:s}=e();t({nodeInternals:cf(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?cf(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((g,p)=>{const b=r.get(p.id);if(b!=null&&b.hidden)r.set(b.id,{...b,[Nt]:{...b[Nt],handleBounds:void 0}});else if(b){const y=Hh(p.nodeElement);!(!y.width||!y.height||b.width===y.width&&b.height===y.height&&!p.forceUpdate)&&(r.set(b.id,{...b,[Nt]:{...b[Nt],handleBounds:{source:T2(".source",p.nodeElement,f,c),target:T2(".target",p.nodeElement,f,c)}},...y}),g.push({id:b.id,type:"dimensions",dimensions:y}))}return g},[]);x2(r,c);const _=i||s&&!i&&w2(e,{initial:!0,...a});t({nodeInternals:new Map(r),fitViewOnInitDone:_}),(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=cf(N2(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=>rr(l,!0)):(i=Ss(s(),n),a=Ss(r,[])),tc({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=>rr(l,!0)):(i=Ss(r,n),a=Ss(s(),[])),tc({changedNodes:a,changedEdges:i,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:s}=e(),i=o||r;tc({changedNodes:(n||s()).map(a=>(a.selected=!1,rr(a.id,!1))),changedEdges:i.map(a=>rr(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();tc({changedNodes:o().filter(r=>r.selected).map(r=>rr(r.id,!1)),changedEdges:n.filter(r=>r.selected).map(r=>rr(r.id,!1)),get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:o}=e();o.forEach(r=>{r.positionAbsolute=Wh(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=yr.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:sr.connectionNodeId,connectionHandleId:sr.connectionHandleId,connectionHandleType:sr.connectionHandleType,connectionStatus:sr.connectionStatus,connectionStartHandle:sr.connectionStartHandle,connectionEndHandle:sr.connectionEndHandle}),reset:()=>t({...sr})}),Object.is),gf=({children:t})=>{const e=T.useRef(null);return e.current||(e.current=jP()),J.createElement(yR,{value:e.current},t)};gf.displayName="ReactFlowProvider";const G2=({children:t})=>T.useContext(Gl)?J.createElement(J.Fragment,null,t):J.createElement(gf,null,t);G2.displayName="ReactFlowWrapper";const EP={input:d2,default:af,output:h2,group:lf},IP={default:Ql,straight:Qh,step:Zh,smoothstep:Xl,simplebezier:Kh},AP=[0,0],TP=[15,15],MP={x:0,y:0,zoom:1},OP={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},_f=T.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s=EP,edgeTypes:i=IP,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:d,onMoveStart:h,onMoveEnd:f,onConnect:m,onConnectStart:_,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,onNodeMouseEnter:y,onNodeMouseMove:x,onNodeMouseLeave:k,onNodeContextMenu:C,onNodeDoubleClick:v,onNodeDragStart:E,onNodeDrag:N,onNodeDragStop:I,onNodesDelete:A,onEdgesDelete:M,onSelectionChange:R,onSelectionDragStart:z,onSelectionDrag:D,onSelectionDragStop:F,onSelectionContextMenu:B,onSelectionStart:U,onSelectionEnd:O,connectionMode:S=Or.Strict,connectionLineType:$=nr.Bezier,connectionLineStyle:j,connectionLineComponent:W,connectionLineContainerStyle:X,deleteKeyCode:Y="Backspace",selectionKeyCode:q="Shift",selectionOnDrag:ne=!1,selectionMode:re=Ki.Full,panActivationKeyCode:ae="Space",multiSelectionKeyCode:Z=Jl()?"Meta":"Control",zoomActivationKeyCode:Q=Jl()?"Meta":"Control",snapToGrid:he=!1,snapGrid:pe=TP,onlyRenderVisibleElements:ce=!1,selectNodesOnDrag:fe=!0,nodesDraggable:de,nodesConnectable:Ce,nodesFocusable:Ne,nodeOrigin:se=AP,edgesFocusable:Ie,edgesUpdatable:be,elementsSelectable:Oe,defaultViewport:ze=MP,minZoom:Ge=.5,maxZoom:Je=2,translateExtent:Le=pf,preventScrolling:et=!0,nodeExtent:Qe,defaultMarkerColor:tt="#b1b1b7",zoomOnScroll:te=!0,zoomOnPinch:ye=!0,panOnScroll:ke=!1,panOnScrollSpeed:Me=.5,panOnScrollMode:G=tr.Free,zoomOnDoubleClick:ge=!0,panOnDrag:_e=!0,onPaneClick:me,onPaneMouseEnter:le,onPaneMouseMove:Ve,onPaneMouseLeave:Fe,onPaneScroll:Ke,onPaneContextMenu:ie,children:Se,onEdgeContextMenu:Ee,onEdgeDoubleClick:Be,onEdgeMouseEnter:Ye,onEdgeMouseMove:Re,onEdgeMouseLeave:He,onEdgeUpdate:it,onEdgeUpdateStart:Xe,onEdgeUpdateEnd:ot,onReconnect:yt,onReconnectStart:bt,onReconnectEnd:Mt,reconnectRadius:xt=10,edgeUpdaterRadius:rn=10,onNodesChange:Nn,onEdgesChange:fn,noDragClassName:sn="nodrag",noWheelClassName:Qt="nowheel",noPanClassName:to="nopan",fitView:po=!1,fitViewOptions:Es,connectOnClick:Is=!0,attributionPosition:As,proOptions:Ts,defaultEdgeOptions:Ms,elevateNodesOnSelect:ir=!0,elevateEdgesOnSelect:Os=!1,disableKeyboardA11y:Ds=!1,autoPanOnConnect:Rs=!0,autoPanOnNodeDrag:zt=!0,connectionRadius:wt=20,isValidConnection:jn,onError:En,style:Ps,id:ic,nodeDragThreshold:lm,...cm},ac)=>{const dm=ic||"1";return J.createElement("div",{...cm,style:{...Ps,...OP},ref:ac,className:hn(["react-flow",r]),"data-testid":"rf__wrapper",id:ic},J.createElement(G2,null,J.createElement(NP,{onInit:c,onMove:d,onMoveStart:h,onMoveEnd:f,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:y,onNodeMouseMove:x,onNodeMouseLeave:k,onNodeContextMenu:C,onNodeDoubleClick:v,nodeTypes:s,edgeTypes:i,connectionLineType:$,connectionLineStyle:j,connectionLineComponent:W,connectionLineContainerStyle:X,selectionKeyCode:q,selectionOnDrag:ne,selectionMode:re,deleteKeyCode:Y,multiSelectionKeyCode:Z,panActivationKeyCode:ae,zoomActivationKeyCode:Q,onlyRenderVisibleElements:ce,selectNodesOnDrag:fe,defaultViewport:ze,translateExtent:Le,minZoom:Ge,maxZoom:Je,preventScrolling:et,zoomOnScroll:te,zoomOnPinch:ye,zoomOnDoubleClick:ge,panOnScroll:ke,panOnScrollSpeed:Me,panOnScrollMode:G,panOnDrag:_e,onPaneClick:me,onPaneMouseEnter:le,onPaneMouseMove:Ve,onPaneMouseLeave:Fe,onPaneScroll:Ke,onPaneContextMenu:ie,onSelectionContextMenu:B,onSelectionStart:U,onSelectionEnd:O,onEdgeContextMenu:Ee,onEdgeDoubleClick:Be,onEdgeMouseEnter:Ye,onEdgeMouseMove:Re,onEdgeMouseLeave:He,onReconnect:yt??it,onReconnectStart:bt??Xe,onReconnectEnd:Mt??ot,reconnectRadius:xt??rn,defaultMarkerColor:tt,noDragClassName:sn,noWheelClassName:Qt,noPanClassName:to,elevateEdgesOnSelect:Os,rfId:dm,disableKeyboardA11y:Ds,nodeOrigin:se,nodeExtent:Qe}),J.createElement(VR,{nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:m,onConnectStart:_,onConnectEnd:g,onClickConnectStart:p,onClickConnectEnd:b,nodesDraggable:de,nodesConnectable:Ce,nodesFocusable:Ne,edgesFocusable:Ie,edgesUpdatable:be,elementsSelectable:Oe,elevateNodesOnSelect:ir,minZoom:Ge,maxZoom:Je,nodeExtent:Qe,onNodesChange:Nn,onEdgesChange:fn,snapToGrid:he,snapGrid:pe,connectionMode:S,translateExtent:Le,connectOnClick:Is,defaultEdgeOptions:Ms,fitView:po,fitViewOptions:Es,onNodesDelete:A,onEdgesDelete:M,onNodeDragStart:E,onNodeDrag:N,onNodeDragStop:I,onSelectionDrag:D,onSelectionDragStart:z,onSelectionDragStop:F,noPanClassName:to,nodeOrigin:se,rfId:dm,autoPanOnConnect:Rs,autoPanOnNodeDrag:zt,onError:En,connectionRadius:wt,isValidConnection:jn,nodeDragThreshold:lm}),J.createElement(BR,{onSelectionChange:R}),Se,J.createElement(IR,{proOptions:Ts,position:As}),J.createElement(qR,{rfId:dm,disableKeyboardA11y:Ds})))});function Y2(t){return e=>{const[n,o]=T.useState(e),r=T.useCallback(s=>o(i=>t(s,i)),[]);return[n,o,r]}}_f.displayName="ReactFlow";const J2=Y2(N2),K2=Y2(function(t,e){return C2(t,e)});function DP(){return J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},J.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function RP(){return J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},J.createElement("path",{d:"M0 0h32v4.2H0z"}))}function PP(){return J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},J.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 LP(){return J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},J.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 FP(){return J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},J.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 js=({children:t,className:e,...n})=>J.createElement("button",{type:"button",className:hn(["react-flow__controls-button",e]),...n},t);js.displayName="ControlButton";const zP=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),X2=({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=qt(),[m,_]=T.useState(!1),{isInteractive:g,minZoomReached:p,maxZoomReached:b}=mt(zP,on),{zoomIn:y,zoomOut:x,fitView:k}=Qi();return T.useEffect(()=>{_(!0)},[]),m?J.createElement(Yl,{className:hn(["react-flow__controls",c]),position:h,style:t,"data-testid":"rf__controls"},e&&J.createElement(J.Fragment,null,J.createElement(js,{onClick:()=>{y(),s==null||s()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},J.createElement(DP,null)),J.createElement(js,{onClick:()=>{x(),i==null||i()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:p},J.createElement(RP,null))),n&&J.createElement(js,{className:"react-flow__controls-fitview",onClick:()=>{k(r),a==null||a()},title:"fit view","aria-label":"fit view"},J.createElement(PP,null)),o&&J.createElement(js,{className:"react-flow__controls-interactive",onClick:()=>{f.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),l==null||l(!g)},title:"toggle interactivity","aria-label":"toggle interactivity"},g?J.createElement(FP,null):J.createElement(LP,null)),d):null};X2.displayName="Controls";var $n,BP=T.memo(X2);function UP({color:t,dimensions:e,lineWidth:n}){return J.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function VP({color:t,radius:e}){return J.createElement("circle",{cx:e,cy:e,r:e,fill:t})}(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})($n||($n={}));const $P={[$n.Dots]:"#91919a",[$n.Lines]:"#eee",[$n.Cross]:"#e2e2e2"},HP={[$n.Dots]:1,[$n.Lines]:1,[$n.Cross]:6},WP=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function Z2({id:t,variant:e=$n.Dots,gap:n=20,size:o,lineWidth:r=1,offset:s=2,color:i,style:a,className:l}){const c=T.useRef(null),{transform:d,patternId:h}=mt(WP,on),f=i||$P[e],m=o||HP[e],_=e===$n.Dots,g=e===$n.Cross,p=Array.isArray(n)?n:[n,n],b=[p[0]*d[2]||1,p[1]*d[2]||1],y=m*d[2],x=g?[y,y]:b,k=_?[y/s,y/s]:[x[0]/s,x[1]/s];return J.createElement("svg",{className:hn(["react-flow__background",l]),style:{...a,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:c,"data-testid":"rf__background"},J.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(-${k[0]},-${k[1]})`},_?J.createElement(VP,{color:f,radius:y/s}):J.createElement(UP,{dimensions:x,color:f,lineWidth:r})),J.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+t})`}))}Z2.displayName="Background";var qP=T.memo(Z2);function bf(t){return Math.min(11*t+35,200)}const Q2=J.createContext("LR"),ek=T.memo(t=>{const e=K.c(51),{data:n,selected:o}=t,r=$e(n.atom),s=Jc().inOrderIds.indexOf(r.id),i=o?"var(--gray-9)":"var(--gray-3)",a=mt(GP),l=T.use(Q2);let c,d,h,f,m;if(e[0]!==r.code||e[1]!==i||e[2]!==l||e[3]!==o){const M=r.code.split(`
|
142
|
+
`).length,R=l==="LR"?Ue.Left:Ue.Top;let z;e[8]!==i?(z={background:i},e[8]=i,e[9]=z):z=e[9],e[10]!==R||e[11]!==z?(h=u.jsx(or,{type:"target",id:"inputs",position:R,style:z}),e[10]=R,e[11]=z,e[12]=h):h=e[12];const D=l==="LR"?Ue.Left:Ue.Top;let F;e[13]!==i?(F={background:i},e[13]=i,e[14]=F):F=e[14],e[15]!==D||e[16]!==F?(f=u.jsx(or,{type:"source",id:"inputs",position:D,style:F}),e[15]=D,e[16]=F,e[17]=f):f=e[17];const B=o&&"border-primary";e[18]!==B?(d=Ae("flex flex-col bg-card border border-input/50 rounded-md mx-[2px] overflow-hidden",B),e[18]=B,e[19]=d):d=e[19],c=bf(M),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 _;let g;e[20]!==n.forceWidth||e[21]!==a?(m=n.forceWidth||(_=a,Math.min(Math.max(_-100,100),400)),e[20]=n.forceWidth,e[21]=a,e[22]=m):m=e[22],e[23]!==c||e[24]!==m?(g={height:c,width:m},e[23]=c,e[24]=m,e[25]=g):g=e[25];const p=QV(r.name,s);let b,y,x;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(PH,{code:r.code}),e[28]=r.code,e[29]=y):y=e[29],e[30]!==d||e[31]!==g||e[32]!==b||e[33]!==y?(x=u.jsxs("div",{className:d,style:g,children:[b,y]}),e[30]=d,e[31]=g,e[32]=b,e[33]=y,e[34]=x):x=e[34];const k=l==="LR"?Ue.Right:Ue.Bottom;let C,v;e[35]!==i?(C={background:i},e[35]=i,e[36]=C):C=e[36],e[37]!==k||e[38]!==C?(v=u.jsx(or,{type:"source",id:"outputs",position:k,style:C}),e[37]=k,e[38]=C,e[39]=v):v=e[39];const E=l==="LR"?Ue.Right:Ue.Bottom;let N,I,A;return e[40]!==i?(N={background:i},e[40]=i,e[41]=N):N=e[41],e[42]!==E||e[43]!==N?(I=u.jsx(or,{type:"target",id:"outputs",position:E,style:N}),e[42]=E,e[43]=N,e[44]=I):I=e[44],e[45]!==x||e[46]!==v||e[47]!==I||e[48]!==h||e[49]!==f?(A=u.jsxs("div",{children:[h,f,x,v,I]}),e[45]=x,e[46]=v,e[47]=I,e[48]=h,e[49]=f,e[50]=A):A=e[50],A},(t,e)=>["data","selected","id"].every(n=>t[n]===e[n]));ek.displayName="CustomNode";const tk={custom:ek};function GP(t){const{width:e}=t;return e}const nk=t=>{const e=K.c(18),{maxCount:n,cellIds:o,onClick:r,skipScroll:s}=t,i=Jc();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)=>i.inOrderIds.indexOf(_)-i.inOrderIds.indexOf(g),e[8]=i,e[9]=h):h=e[9];const f=[...o].sort(h);if(o.length===0){let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx("div",{className:"text-muted-foreground",children:"--"}),e[10]=_):_=e[10],c=_;break e}let m;e[11]!==o.length||e[12]!==r||e[13]!==s?(m=(_,g)=>u.jsxs("span",{className:"truncate",children:[u.jsx(_r,{variant:"focus",cellId:_,skipScroll:s,className:"whitespace-nowrap",onClick:r?()=>r(_):void 0},_),g<o.length-1&&", "]},_),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(Ur,{children:[u.jsx(ti,{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(Js,{className:"w-auto",children:u.jsx("div",{className:"flex flex-col gap-1 py-1",children:f.slice(n).map(_=>u.jsx(_r,{variant:"focus",cellId:_,className:"whitespace-nowrap",onClick:r?()=>r(_):void 0},_))})})]})}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)},yf=t=>{const e=K.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 xn(o),ut({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(mS,{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},xf=T.memo(t=>{const e=K.c(38),{onChange:n,view:o,settings:r,onSettingsChange:s}=t;let i;e[0]!==s||e[1]!==r?(i=(D,F)=>{s({...r,[D]:F})},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(ti,{asChild:!0,children:u.jsx(De,{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=D=>a("hidePureMarkdown",!!D),e[5]=a,e[6]=d):d=e[6],e[7]!==r.hidePureMarkdown||e[8]!==d?(h=u.jsx(J4,{"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(Fr,{htmlFor:"hide-pure-markdown",children:"Hide pure markdown"}),e[10]=f):f=e[10],e[11]!==h?(m=u.jsxs(Ur,{children:[l,u.jsxs(Js,{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 _=m,g=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(Yp,{className:"w-4 h-4 mr-1"}),e[15]=b):b=e[15],e[16]!==g||e[17]!==p?(y=u.jsxs(De,{variant:"outline",className:"bg-background","aria-selected":g,size:"xs",onClick:p,children:[b,"Mini Map"]}),e[16]=g,e[17]=p,e[18]=y):y=e[18];const x=o==="TB";let k,C,v;e[19]!==n?(k=()=>n("TB"),e[19]=n,e[20]=k):k=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(C=u.jsx(Aa,{className:"w-4 h-4 mr-1"}),e[21]=C):C=e[21],e[22]!==x||e[23]!==k?(v=u.jsxs(De,{variant:"outline",className:"bg-background","aria-selected":x,size:"xs",onClick:k,children:[C,"Vertical Tree"]}),e[22]=x,e[23]=k,e[24]=v):v=e[24];const E=o==="LR";let N,I,A,M;e[25]!==n?(N=()=>n("LR"),e[25]=n,e[26]=N):N=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(I=u.jsx(Aa,{className:"w-4 h-4 mr-1 transform -rotate-90"}),e[27]=I):I=e[27],e[28]!==E||e[29]!==N?(A=u.jsxs(De,{variant:"outline",className:"bg-background","aria-selected":E,size:"xs",onClick:N,children:[I," ","Horizontal Tree"]}),e[28]=E,e[29]=N,e[30]=A):A=e[30],e[31]!==y||e[32]!==v||e[33]!==A?(M=u.jsxs("div",{className:"flex gap-2",children:[y,v,A]}),e[31]=y,e[32]=v,e[33]=A,e[34]=M):M=e[34];const R=o!=="_minimap_"&&_;let z;return e[35]!==M||e[36]!==R?(z=u.jsxs(Yl,{position:"top-right",className:"flex flex-col items-end gap-2",children:[M,R]}),e[35]=M,e[36]=R,e[37]=z):z=e[37],z});xf.displayName="GraphToolbar";const oc=T.memo(t=>{const e=K.c(11),{selection:n,variables:o,onClearSelection:r}=t;if(!n)return null;const s=YP;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,_)=>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(g=>u.jsxs(J.Fragment,{children:[u.jsx(yf,{declaredBy:g.declaredBy,name:g.name}),u.jsxs("div",{className:"truncate col-span-2",title:g.value??"",children:[g.value,u.jsxs("span",{className:"ml-1 truncate text-foreground/60 font-mono",children:["(",g.dataType,")"]})]}),u.jsx("div",{className:"truncate col-span-2 gap-1 items-center",children:u.jsx(nk,{skipScroll:!0,onClick:()=>s(_==="in"?g.declaredBy[0]:g.usedBy[0],g.name),maxCount:3,cellIds:g.usedBy})})]},g.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(cc,{className:"w-5 h-5"}),u.jsx(_r,{cellId:n.id}),u.jsx("div",{className:"flex-1"}),u.jsx(I0,{cellId:n.id,children:u.jsx(De,{variant:"ghost",size:"icon",children:u.jsx(sd,{className:"w-4 h-4"})})}),u.jsx(De,{variant:"text",size:"icon",onClick:()=>{r()},children:u.jsx(oo,{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(gn,{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(gp,{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(_r,{cellId:n.source}),u.jsx(nd,{className:"w-4 h-4"}),u.jsx(_r,{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(J.Fragment,{children:[u.jsx(yf,{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(Yl,{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-[var(--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 YP(t,e){const n=uc(t);n&&tp(n,e)}function ok(){const t=K.c(7),e=Qi(),n=mt(KP),o=mt(JP);let r;t[0]!==e?(r=()=>{e.fitView({duration:100})},t[0]=e,t[1]=r):r=t[1];const s=e$(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]),T.useEffect(i,a)}function JP(t){const{height:e}=t;return e}function KP(t){const{width:e}=t;return e}oc.displayName="GraphSelectionPanel";const rk=new class{createEdge(t,e,n){return{type:"smoothstep",pathOptions:{offset:20,borderRadius:100},data:{direction:n},markerEnd:{type:ys.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:bf(ct.get(e).code.trim().split(`
|
143
|
+
`).length),position:{x:0,y:n+20}}}createElements(t,e,n,o){let r=0;const s=[],i=[];for(const[l,c]of Qm.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}}},XP=t=>{const e=K.c(37),{cellIds:n,variables:o,cellAtoms:r,children:s}=t;let i;e[0]!==r||e[1]!==n||e[2]!==o?(i=rk.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]=K2(c),[f,m]=J2(a),[_,g]=T.useState(),[p,b]=T.useState(),y=T.useRef(!1);ok();const x=mt(ZP);let k;e[5]!==h||e[6]!==m?(k=S=>{m(S.nodes),h([])},e[5]=h,e[6]=m,e[7]=k):k=e[7];const C=nt(k);let v,E,N,I;e[8]!==r||e[9]!==n||e[10]!==C||e[11]!==o?(v=()=>{y.current?C(rk.createElements(n,r,o,!1)):y.current=!0},E=[n,o,r,C],e[8]=r,e[9]=n,e[10]=C,e[11]=o,e[12]=v,e[13]=E):(v=e[12],E=e[13]),T.useEffect(v,E),e[14]!==l||e[15]!==_||e[16]!==h?(N=()=>{if(_){const S=l.filter($=>{const{source:j,target:W,data:X}=$;return j===_&&X.direction==="outputs"||W===_&&X.direction==="inputs"});h(S)}},I=[_,h,l],e[14]=l,e[15]=_,e[16]=h,e[17]=N,e[18]=I):(N=e[17],I=e[18]),T.useEffect(N,I);const A=function(S,$){const j=K.c(17);let W,X;if(j[0]!==$||j[1]!==S){let Q;j[3]!==$?(Q=(he,pe)=>{const{position:ce}=pe;return Math.min(he,ce.y-$/2-10)},j[3]=$,j[4]=Q):Q=j[4],X=S.reduce(Q,Number.POSITIVE_INFINITY),j[0]=$,j[1]=S,j[2]=X}else X=j[2];const Y=X;let q;if(j[5]!==$||j[6]!==S){let Q;j[8]!==$?(Q=(he,pe)=>{const{position:ce}=pe;return Math.max(he,ce.y+$/2+10)},j[8]=$,j[9]=Q):Q=j[9],q=S.reduce(Q,Number.NEGATIVE_INFINITY),j[5]=$,j[6]=S,j[7]=q}else q=j[7];const ne=q;let re,ae,Z;return j[10]!==Y?(re=[Number.NEGATIVE_INFINITY,Y],j[10]=Y,j[11]=re):re=j[11],j[12]!==ne?(ae=[Number.POSITIVE_INFINITY,ne],j[12]=ne,j[13]=ae):ae=j[13],j[14]!==re||j[15]!==ae?(Z=[re,ae],j[14]=re,j[15]=ae,j[16]=Z):Z=j[16],W=Z,W}(f,x);let M;e[19]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{g(void 0),b(void 0)},e[19]=M):M=e[19];const R=M;let z;e[20]!==d||e[21]!==p||e[22]!==_||e[23]!==o?(z=()=>p?u.jsx(oc,{selection:{type:"edge",source:p.source,target:p.target},onClearSelection:R,variables:o,edges:d}):_?u.jsx(oc,{selection:{type:"node",id:_},variables:o,edges:d,onClearSelection:R}):null,e[20]=d,e[21]=p,e[22]=_,e[23]=o,e[24]=z):z=e[24];const D=z;let F,B,U,O;return e[25]!==h?(F=(S,$)=>{const j=$.id;g(j),b(void 0),h([])},e[25]=h,e[26]=F):F=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(B=(S,$)=>{b($)},e[27]=B):B=e[27],e[28]!==D?(U=D(),e[28]=D,e[29]=U):U=e[29],e[30]!==s||e[31]!==d||e[32]!==f||e[33]!==F||e[34]!==U||e[35]!==A?(O=u.jsxs(_f,{nodes:f,edges:d,nodeTypes:tk,translateExtent:A,onNodeClick:F,onNodeDoubleClick:QP,onEdgeClick:B,snapToGrid:!0,fitView:!0,elementsSelectable:!0,minZoom:1,maxZoom:1,draggable:!1,panOnScrollMode:tr.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:[U,s]}),e[30]=s,e[31]=d,e[32]=f,e[33]=F,e[34]=U,e[35]=A,e[36]=O):O=e[36],O};function ZP(t){const{height:e}=t;return e}function QP(t,e){pS(e.id,"focus")}var wf,sk,ik,ak,lk,ck,vf,dk,kf,uk,Sf,hk,Cf,fk,Nf,mk,jf,pk,Ef,gk,If,_k,Af,bk,Tf,yk,Mf,xk,Of,wk,Df,vk,Rf,kk,Sk,Ck,Nk,jk,Ek,Ik,Pf,Ak,Lf,Tk,Ff,Mk,zf,Ok,Bf,Dk,Uf,Rk,Vf,Pk,$f,Lk,Hf,Fk,Wf,zk,qf,Bk,Gf,Uk,Yf,Vk,Jf,$k,Hk,Wk,qk,Gk,Yk,Jk,Kf,Kk,Xf,Xk,Zk,Qk,Zf,e3,Qf,t3,em,n3,tm,o3,nm,r3,s3,i3,a3,l3;function om(){if(sk)return wf;sk=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 wf=class{constructor(s){ee(this,"_isDirected",!0);ee(this,"_isMultigraph",!1);ee(this,"_isCompound",!1);ee(this,"_label");ee(this,"_defaultNodeLabelFn",()=>{});ee(this,"_defaultEdgeLabelFn",()=>{});ee(this,"_nodes",{});ee(this,"_in",{});ee(this,"_preds",{});ee(this,"_out",{});ee(this,"_sucs",{});ee(this,"_edgeObjs",{});ee(this,"_edgeLabels",{});ee(this,"_nodeCount",0);ee(this,"_edgeCount",0);ee(this,"_parent");ee(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,p){var b=""+_,y=""+g;if(!m&&b>y){var x=b;b=y,y=x}var k={v:b,w:y};return p&&(k.name=p),k}(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))}},wf}function eL(){return ck?lk:(ck=1,lk={Graph:om(),version:ak?ik:(ak=1,ik="2.2.4")})}function tL(){if(dk)return vf;dk=1;var t=om();function e(o){return o.nodes().map(function(r){var s=o.node(r),i=o.parent(r),a={v:r};return s!==void 0&&(a.value=s),i!==void 0&&(a.parent=i),a})}function n(o){return o.edges().map(function(r){var s=o.edge(r),i={v:r.v,w:r.w};return r.name!==void 0&&(i.name=r.name),s!==void 0&&(i.value=s),i})}return vf={write:function(o){var r={options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:e(o),edges:n(o)};return o.graph()!==void 0&&(r.value=structuredClone(o.graph())),r},read:function(o){var r=new t(o.options).setGraph(o.value);return o.nodes.forEach(function(s){r.setNode(s.v,s.value),s.parent&&r.setParent(s.v,s.parent)}),o.edges.forEach(function(s){r.setEdge({v:s.v,w:s.w,name:s.name},s.value)}),r}},vf}function nL(){return uk||(uk=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 c3(){return hk?Sf:(hk=1,Sf=class{constructor(){ee(this,"_arr",[]);ee(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}},Sf)}function d3(){if(fk)return Cf;fk=1;var t=c3();Cf=function(n,o,r,s){return function(i,a,l,c){var d,h,f={},m=new t,_=function(g){var p=g.v!==d?g.v:g.w,b=f[p],y=l(g),x=h.distance+y;if(y<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+g+" Weight: "+y);x<b.distance&&(b.distance=x,b.predecessor=d,m.decrease(p,x))};for(i.nodes().forEach(function(g){var p=g===a?0:Number.POSITIVE_INFINITY;f[g]={distance:p},m.add(g,p)});m.size()>0&&(d=m.removeMin(),(h=f[d]).distance!==Number.POSITIVE_INFINITY);)c(d).forEach(_);return f}(n,String(o),r||e,s||function(i){return n.outEdges(i)})};var e=()=>1;return Cf}function oL(){if(mk)return Nf;mk=1;var t=d3();return Nf=function(e,n,o){return e.nodes().reduce(function(r,s){return r[s]=t(e,s,n,o),r},{})},Nf}function u3(){return pk||(pk=1,jf=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}),jf}function rL(){if(gk)return Ef;gk=1;var t=u3();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 sL(){if(_k)return If;_k=1,If=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 _=f[c],g=d[m],p=f[m],b=_.distance+g.distance;b<p.distance&&(p.distance=b,p.predecessor=g.predecessor)})})}),a}(e,n||t,o||function(r){return e.outEdges(r)})};var t=()=>1;return If}function h3(){if(bk)return Af;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}bk=1;class e extends Error{constructor(){super(...arguments)}}return Af=t,t.CycleException=e,Af}function iL(){if(yk)return Tf;yk=1;var t=h3();return Tf=function(e){try{t(e)}catch(n){if(n instanceof t.CycleException)return!1;throw n}return!0},Tf}function f3(){if(xk)return Mf;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 xk=1,Mf=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},Mf}function aL(){if(wk)return Of;wk=1;var t=f3();return Of=function(e,n){return t(e,n,"post")},Of}function lL(){if(vk)return Df;vk=1;var t=f3();return Df=function(e,n){return t(e,n,"pre")},Df}function cL(){if(kk)return Rf;kk=1;var t=om(),e=c3();return Rf=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},Rf}function eo(){if(jk)return Nk;jk=1;var t=eL();return Nk={Graph:t.Graph,json:tL(),alg:Ck?Sk:(Ck=1,Sk={components:nL(),dijkstra:d3(),dijkstraAll:oL(),findCycles:rL(),floydWarshall:sL(),isAcyclic:iL(),postorder:aL(),preorder:lL(),prim:cL(),tarjan:u3(),topsort:h3()}),version:t.version}}function dL(){if(Ak)return Pf;Ak=1;let t=eo().Graph,e=function(){if(Ik)return Ek;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 Ik=1,Ek=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(", ")+"]"}}}();Pf=function(s,i){if(s.nodeCount()<=1)return[];let a=function(l,c){let d=new t,h=0,f=0;l.nodes().forEach(g=>{d.setNode(g,{v:g,in:0,out:0})}),l.edges().forEach(g=>{let p=d.edge(g.v,g.w)||0,b=c(g),y=p+b;d.setEdge(g.v,g.w,y),f=Math.max(f,d.node(g.v).out+=b),h=Math.max(h,d.node(g.w).in+=b)});let m=function(g){const p=[];for(let b=0;b<g;b++)p.push(b);return p}(f+h+3).map(()=>new e),_=h+1;return d.nodes().forEach(g=>{r(m,_,d.node(g))}),{graph:d,buckets:m,zeroIdx:_}}(s,i||n);return function(l,c,d){let h,f=[],m=c[c.length-1],_=c[0];for(;l.nodeCount();){for(;h=_.dequeue();)o(l,c,d,h);for(;h=m.dequeue();)o(l,c,d,h);if(l.nodeCount()){for(let g=c.length-2;g>0;--g)if(h=c[g].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,_=s.node(m);_.in-=f,r(i,a,_)}),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 Pf}function Ft(){if(Tk)return Lf;Tk=1;let t=eo().Graph;function e(c,d,h,f){let m;do m=i(f);while(c.hasNode(m));return h.dummy=d,c.setNode(m,h),m}Lf={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,_=c.y,g=d.x-m,p=d.y-_,b=c.width/2,y=c.height/2;if(!g&&!p)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(p)*b>Math.abs(g)*y?(p<0&&(y=-y),h=y*g/p,f=y):(g<0&&(b=-b),h=b,f=b*p/g),{x:m+h,y:_+f}},mapValues:function(c,d){let h=d;return typeof d=="string"&&(h=f=>f[d]),Object.entries(c).reduce((f,[m,_])=>(f[m]=h(_,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(g=>c.node(g).rank),h=o(Math.min,d),f=[];c.nodes().forEach(g=>{let p=c.node(g).rank-h;f[p]||(f[p]=[]),f[p].push(g)});let m=0,_=c.graph().nodeRankFactor;Array.from(f).forEach((g,p)=>{g===void 0&&p%_!==0?--m:g!==void 0&&m&&g.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 _=[];for(let g=0;g<f.length;g+=m){const p=f.slice(g,g+m);_.push(p)}return _}(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){var d=++s;return toString(c)+d}function a(c,d,h=1){d==null&&(d=c,c=0);let f=_=>_<d;h<0&&(f=_=>d<_);const m=[];for(let _=c;f(_);_+=h)m.push(_);return m}function l(c,d){return c.reduce((h,f,m)=>(h[f]=d[m],h),{})}return Lf}function uL(){if(Mk)return Ff;Mk=1;let t=dL(),e=Ft().uniqueId;return Ff={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)}})}},Ff}function hL(){if(Ok)return zf;Ok=1;let t=Ft();return zf={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),_=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===_&&(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)})}},zf}function rc(){if(Dk)return Bf;Dk=1;const{applyWithChunking:t}=Ft();return Bf={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}},Bf}function m3(){if(Rk)return Uf;Rk=1;var t=eo().Graph,e=rc().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 Uf=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},Uf}function fL(){if(Pk)return Vf;Pk=1;var t=m3(),e=rc().slack,n=rc().longestPath,o=eo().alg.preorder,r=eo().alg.postorder,s=Ft().simplify;function i(g){g=s(g),n(g);var p,b=t(g);for(c(b),a(b,g);p=h(b);)m(b,g,p,f(b,g,p))}function a(g,p){var b=r(g,g.nodes());(b=b.slice(0,b.length-1)).forEach(y=>function(x,k,C){var v=x.node(C),E=v.parent;x.edge(C,E).cutvalue=l(x,k,C)}(g,p,y))}function l(g,p,b){var y=g.node(b).parent,x=!0,k=p.edge(b,y),C=0;return k||(x=!1,k=p.edge(y,b)),C=k.weight,p.nodeEdges(b).forEach(v=>{var E,N,I=v.v===b,A=I?v.w:v.v;if(A!==y){var M=I===x,R=p.edge(v).weight;if(C+=M?R:-R,E=b,N=A,g.hasEdge(E,N)){var z=g.edge(b,A).cutvalue;C+=M?-z:z}}}),C}function c(g,p){arguments.length<2&&(p=g.nodes()[0]),d(g,{},1,p)}function d(g,p,b,y,x){var k=b,C=g.node(y);return p[y]=!0,g.neighbors(y).forEach(v=>{Object.hasOwn(p,v)||(b=d(g,p,b,v,y))}),C.low=k,C.lim=b++,x?C.parent=x:delete C.parent,b}function h(g){return g.edges().find(p=>g.edge(p).cutvalue<0)}function f(g,p,b){var y=b.v,x=b.w;p.hasEdge(y,x)||(y=b.w,x=b.v);var k=g.node(y),C=g.node(x),v=k,E=!1;k.lim>C.lim&&(v=C,E=!0);var N=p.edges().filter(I=>E===_(g,g.node(I.v),v)&&E!==_(g,g.node(I.w),v));return N.reduce((I,A)=>e(p,A)<e(p,I)?A:I)}function m(g,p,b,y){var x=b.v,k=b.w;g.removeEdge(x,k),g.setEdge(y.v,y.w,{}),c(g),a(g,p),function(C,v){var E=C.nodes().find(I=>!v.node(I).parent),N=o(C,E);(N=N.slice(1)).forEach(I=>{var A=C.node(I).parent,M=v.edge(I,A),R=!1;M||(M=v.edge(A,I),R=!0),v.node(I).rank=v.node(A).rank+(R?M.minlen:-M.minlen)})}(g,p)}function _(g,p,b){return b.low<=p.lim&&p.lim<=b.lim}return Vf=i,i.initLowLimValues=c,i.initCutValues=a,i.calcCutValue=l,i.leaveEdge=h,i.enterEdge=f,i.exchangeEdges=m,Vf}function mL(){if(Lk)return $f;Lk=1;var t=rc().longestPath,e=m3(),n=fL();$f=function(s){switch(s.graph().ranker){case"network-simplex":default:r(s);break;case"tight-tree":(function(i){t(i),e(i)})(s);break;case"longest-path":o(s)}};var o=t;function r(s){n(s)}return $f}function pL(){return Fk||(Fk=1,Hf=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,_){let g,p,b=[],y=[],x=Math.min(f[m].low,f[_].low),k=Math.max(f[m].lim,f[_].lim);g=m;do g=h.parent(g),b.push(g);while(g&&(f[g].low>x||k>f[g].lim));for(p=g,g=_;(g=h.parent(g))!==p;)y.push(g);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]}})}),Hf}function gL(){if(zk)return Wf;zk=1;let t=Ft();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 _=n.node(m),g=_.borderTop?_.borderTop:m,p=_.borderBottom?_.borderBottom:m,b=_.borderTop?s:2*s,y=g!==p?1:i-a[l]+1;n.setEdge(d,g,{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 Wf={run:function(n){let o=t.addDummyNode(n,"root",{},"_root"),r=function(c){var d={};function h(f,m){var _=c.children(f);_&&_.length&&_.forEach(g=>h(g,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)})}},Wf}function _L(){if(Uk)return Gf;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 Uk=1,Gf={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))}},Gf}function bL(){if(Gk)return qk;Gk=1;let t=Ft();return qk=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 yL(){if(Kk)return Kf;Kk=1;let t=(Wk||(Wk=1,Hk=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}})}),Hk),e=bL(),n=function(){if(Jk)return Yk;Jk=1;let o=Ft();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 _;l.sort((_=!!i,(p,b)=>p.barycenter<b.barycenter?-1:p.barycenter>b.barycenter?1:_?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 g={vs:d.flat(!0)};return f&&(g.barycenter=h/f,g.weight=f),g}}();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 x=o(r,p.v,i,a);f[p.v]=x,Object.hasOwn(x,"barycenter")&&(y=x,(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 _=e(m,i);(function(p,b){p.forEach(y=>{y.vs=y.vs.flatMap(x=>b[x]?b[x].vs:x)})})(_,f);let g=n(_,a);if(d&&(g.vs=[d,g.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(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+p.order+b.order)/(g.weight+2),g.weight+=2}return g},Kf}function xL(){if(Xk)return Xf;Xk=1;let t=eo().Graph,e=Ft();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 wL(){if(e3)return Zf;e3=1;let t=function(){if(Vk)return Yf;Vk=1;let d=Ft();return Yf=function(h){let f={},m=h.nodes().filter(y=>!h.children(y).length),_=m.map(y=>h.node(y).rank),g=d.applyWithChunking(Math.max,_),p=d.range(g+1).map(()=>[]);function b(y){if(f[y])return;f[y]=!0;let x=h.node(y);p[x.rank].push(y),h.successors(y).forEach(b)}return m.sort((y,x)=>h.node(y).rank-h.node(x).rank).forEach(b),p},Yf}(),e=function(){if($k)return Jf;$k=1;let d=Ft().zipObject;function h(f,m,_){let g=d(_,_.map((C,v)=>v)),p=m.flatMap(C=>f.outEdges(C).map(v=>({pos:g[v.w],weight:f.edge(v).weight})).sort((v,E)=>v.pos-E.pos)),b=1;for(;b<_.length;)b<<=1;let y=2*b-1;b-=1;let x=new Array(y).fill(0),k=0;return p.forEach(C=>{let v=C.pos+b;x[v]+=C.weight;let E=0;for(;v>0;)v%2&&(E+=x[v+1]),v=v-1>>1,x[v]+=C.weight;k+=C.weight*E}),k}return Jf=function(f,m){let _=0;for(let g=1;g<m.length;++g)_+=h(f,m[g-1],m[g]);return _},Jf}(),n=yL(),o=xL(),r=(Qk||(Qk=1,Zk=function(d,h,f){let m,_={};f.forEach(g=>{let p,b,y=d.parent(g);for(;y;){if(p=d.parent(y),p?(b=_[p],_[p]=y):(b=m,m=y),b&&b!==y)return void h.setEdge(b,y);y=p}})}),Zk),s=eo().Graph,i=Ft();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 _=m.graph().root,g=n(m,_,f,h);g.vs.forEach((p,b)=>m.node(p).order=b),r(m,f,g.vs)})}function c(d,h){Object.values(h).forEach(f=>f.forEach((m,_)=>d.node(m).order=_))}return Zf=function d(h,f){if(f&&typeof f.customOrder=="function")return void f.customOrder(h,d);let m=i.maxRank(h),_=a(h,i.range(1,m+1),"inEdges"),g=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 x=0,k=0;k<4;++x,++k){l(x%2?_:g,x%4>=2),p=i.buildLayerMatrix(h);let C=e(h,p);C<y&&(k=0,b=Object.assign({},p),y=C)}c(h,b)},Zf}function vL(){if(t3)return Qf;t3=1;let t=eo().Graph,e=Ft();function n(h,f){let m={};return f.length&&f.reduce(function(_,g){let p=0,b=0,y=_.length,x=g[g.length-1];return g.forEach((k,C)=>{let v=function(N,I){if(N.node(I).dummy)return N.predecessors(I).find(A=>N.node(A).dummy)}(h,k),E=v?h.node(v).order:y;(v||k===x)&&(g.slice(b,C+1).forEach(N=>{h.predecessors(N).forEach(I=>{let A=h.node(I),M=A.order;!(M<p||E<M)||A.dummy&&h.node(N).dummy||r(m,I,N)})}),b=C+1,p=E)}),g}),m}function o(h,f){let m={};function _(g,p,b,y,x){let k;e.range(p,b).forEach(C=>{k=g[C],h.node(k).dummy&&h.predecessors(k).forEach(v=>{let E=h.node(v);E.dummy&&(E.order<y||E.order>x)&&r(m,v,k)})})}return f.length&&f.reduce(function(g,p){let b,y=-1,x=0;return p.forEach((k,C)=>{if(h.node(k).dummy==="border"){let v=h.predecessors(k);v.length&&(b=h.node(v[0]).order,_(p,x,C,y,b),x=C,y=b)}_(p,x,p.length,b,g.length)}),p}),m}function r(h,f,m){if(f>m){let g=f;f=m,m=g}let _=h[f];_||(h[f]=_={}),_[m]=!0}function s(h,f,m){if(f>m){let _=f;f=m,m=_}return!!h[f]&&Object.hasOwn(h[f],m)}function i(h,f,m,_){let g={},p={},b={};return f.forEach(y=>{y.forEach((x,k)=>{g[x]=x,p[x]=x,b[x]=k})}),f.forEach(y=>{let x=-1;y.forEach(k=>{let C=_(k);if(C.length){C=C.sort((E,N)=>b[E]-b[N]);let v=(C.length-1)/2;for(let E=Math.floor(v),N=Math.ceil(v);E<=N;++E){let I=C[E];p[k]===k&&x<b[I]&&!s(m,k,I)&&(p[I]=k,p[k]=g[k]=g[I],x=b[I])}}})}),{root:g,align:p}}function a(h,f,m,_,g){let p={},b=function(k,C,v,E){let N=new t,I=k.graph(),A=function(M,R,z){return(D,F,B)=>{let U,O=D.node(F),S=D.node(B),$=0;if($+=O.width/2,Object.hasOwn(O,"labelpos"))switch(O.labelpos.toLowerCase()){case"l":U=-O.width/2;break;case"r":U=O.width/2}if(U&&($+=z?U:-U),U=0,$+=(O.dummy?R:M)/2,$+=(S.dummy?R:M)/2,$+=S.width/2,Object.hasOwn(S,"labelpos"))switch(S.labelpos.toLowerCase()){case"l":U=S.width/2;break;case"r":U=-S.width/2}return U&&($+=z?U:-U),U=0,$}}(I.nodesep,I.edgesep,E);return C.forEach(M=>{let R;M.forEach(z=>{let D=v[z];if(N.setNode(D),R){var F=v[R],B=N.edge(F,D);N.setEdge(F,D,Math.max(A(k,z,R),B||0))}R=z})}),N}(h,f,m,g),y=g?"borderLeft":"borderRight";function x(k,C){let v=b.nodes(),E=v.pop(),N={};for(;E;)N[E]?k(E):(N[E]=!0,v.push(E),v=v.concat(C(E))),E=v.pop()}return x(function(k){p[k]=b.inEdges(k).reduce((C,v)=>Math.max(C,p[v.v]+b.edge(v)),0)},b.predecessors.bind(b)),x(function(k){let C=b.outEdges(k).reduce((E,N)=>Math.min(E,p[N.w]-b.edge(N)),Number.POSITIVE_INFINITY),v=h.node(k);C!==Number.POSITIVE_INFINITY&&v.borderType!==y&&(p[k]=Math.max(p[k],C))},b.successors.bind(b)),Object.keys(_).forEach(k=>p[k]=p[m[k]]),p}function l(h,f){return Object.values(f).reduce((m,_)=>{let g=Number.NEGATIVE_INFINITY,p=Number.POSITIVE_INFINITY;Object.entries(_).forEach(([y,x])=>{let k=function(C,v){return C.node(v).width}(h,y)/2;g=Math.max(x+k,g),p=Math.min(x-k,p)});const b=g-p;return b<m[0]&&(m=[b,_]),m},[Number.POSITIVE_INFINITY,null])[1]}function c(h,f){let m=Object.values(f),_=e.applyWithChunking(Math.min,m),g=e.applyWithChunking(Math.max,m);["u","d"].forEach(p=>{["l","r"].forEach(b=>{let y=p+b,x=h[y];if(x===f)return;let k=Object.values(x),C=_-e.applyWithChunking(Math.min,k);b!=="l"&&(C=g-e.applyWithChunking(Math.max,k)),C&&(h[y]=e.mapValues(x,v=>v+C))})})}function d(h,f){return e.mapValues(h.ul,(m,_)=>{if(f)return h[f.toLowerCase()][_];{let g=Object.values(h).map(p=>p[_]).sort((p,b)=>p-b);return(g[1]+g[2])/2}})}return Qf={positionX:function(h){let f,m=e.buildLayerMatrix(h),_=Object.assign(n(h,m),o(h,m)),g={};["u","d"].forEach(b=>{f=b==="u"?m:Object.values(m).reverse(),["l","r"].forEach(y=>{y==="r"&&(f=f.map(v=>Object.values(v).reverse()));let x=(b==="u"?h.predecessors:h.successors).bind(h),k=i(h,f,_,x),C=a(h,f,k.root,k.align,y==="r");y==="r"&&(C=e.mapValues(C,v=>-v)),g[b+y]=C})});let p=l(h,g);return c(g,p),d(g,h.graph().align)},findType1Conflicts:n,findType2Conflicts:o,addConflict:r,hasConflict:s,verticalAlignment:i,horizontalCompaction:a,alignCoordinates:c,findSmallestWidthAlignment:l,balance:d},Qf}function kL(){if(n3)return em;n3=1;let t=Ft(),e=vL().positionX;return em=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)},em}function SL(){if(o3)return tm;o3=1;let t=uL(),e=hL(),n=mL(),o=Ft().normalizeRanks,r=pL(),s=Ft().removeEmptyRanks,i=gL(),a=function(){if(Bk)return qf;Bk=1;let E=Ft();function N(I,A,M,R,z,D){let F={width:0,height:0,rank:D,borderType:A},B=z[A][D-1],U=E.addDummyNode(I,"border",F,M);z[A][D]=U,I.setParent(U,R),B&&I.setEdge(B,U,{weight:1})}return qf=function(I){I.children().forEach(function A(M){let R=I.children(M),z=I.node(M);if(R.length&&R.forEach(A),Object.hasOwn(z,"minRank")){z.borderLeft=[],z.borderRight=[];for(let D=z.minRank,F=z.maxRank+1;D<F;++D)N(I,"borderLeft","_bl",M,z,D),N(I,"borderRight","_br",M,z,D)}})},qf}(),l=_L(),c=wL(),d=kL(),h=Ft(),f=eo().Graph;tm=function(E,N){let I=N&&N.debugTiming?h.time:h.notime;I("layout",()=>{let A=I(" buildLayoutGraph",()=>function(M){let R=new f({multigraph:!0,compound:!0}),z=v(M.graph());return R.setGraph(Object.assign({},_,C(z,m),h.pick(z,g))),M.nodes().forEach(D=>{const F=C(v(M.node(D)),p);Object.keys(b).forEach(B=>{F[B]===void 0&&(F[B]=b[B])}),R.setNode(D,F),R.setParent(D,M.parent(D))}),M.edges().forEach(D=>{let F=v(M.edge(D));R.setEdge(D,Object.assign({},x,C(F,y),h.pick(F,k)))}),R}(E));I(" runLayout",()=>function(M,R,z){R(" makeSpaceForEdgeLabels",()=>function(D){let F=D.graph();F.ranksep/=2,D.edges().forEach(B=>{let U=D.edge(B);U.minlen*=2,U.labelpos.toLowerCase()!=="c"&&(F.rankdir==="TB"||F.rankdir==="BT"?U.width+=U.labeloffset:U.height+=U.labeloffset)})}(M)),R(" removeSelfEdges",()=>function(D){D.edges().forEach(F=>{if(F.v===F.w){var B=D.node(F.v);B.selfEdges||(B.selfEdges=[]),B.selfEdges.push({e:F,label:D.edge(F)}),D.removeEdge(F)}})}(M)),R(" acyclic",()=>t.run(M)),R(" nestingGraph.run",()=>i.run(M)),R(" rank",()=>n(h.asNonCompoundGraph(M))),R(" injectEdgeLabelProxies",()=>function(D){D.edges().forEach(F=>{let B=D.edge(F);if(B.width&&B.height){let U=D.node(F.v),O={rank:(D.node(F.w).rank-U.rank)/2+U.rank,e:F};h.addDummyNode(D,"edge-proxy",O,"_ep")}})}(M)),R(" removeEmptyRanks",()=>s(M)),R(" nestingGraph.cleanup",()=>i.cleanup(M)),R(" normalizeRanks",()=>o(M)),R(" assignRankMinMax",()=>function(D){let F=0;D.nodes().forEach(B=>{let U=D.node(B);U.borderTop&&(U.minRank=D.node(U.borderTop).rank,U.maxRank=D.node(U.borderBottom).rank,F=Math.max(F,U.maxRank))}),D.graph().maxRank=F}(M)),R(" removeEdgeLabelProxies",()=>function(D){D.nodes().forEach(F=>{let B=D.node(F);B.dummy==="edge-proxy"&&(D.edge(B.e).labelRank=B.rank,D.removeNode(F))})}(M)),R(" normalize.run",()=>e.run(M)),R(" parentDummyChains",()=>r(M)),R(" addBorderSegments",()=>a(M)),R(" order",()=>c(M,z)),R(" insertSelfEdges",()=>function(D){var F=h.buildLayerMatrix(D);F.forEach(B=>{var U=0;B.forEach((O,S)=>{var $=D.node(O);$.order=S+U,($.selfEdges||[]).forEach(j=>{h.addDummyNode(D,"selfedge",{width:j.label.width,height:j.label.height,rank:$.rank,order:S+ ++U,e:j.e,label:j.label},"_se")}),delete $.selfEdges})})}(M)),R(" adjustCoordinateSystem",()=>l.adjust(M)),R(" position",()=>d(M)),R(" positionSelfEdges",()=>function(D){D.nodes().forEach(F=>{var B=D.node(F);if(B.dummy==="selfedge"){var U=D.node(B.e.v),O=U.x+U.width/2,S=U.y,$=B.x-O,j=U.height/2;D.setEdge(B.e,B.label),D.removeNode(F),B.label.points=[{x:O+2*$/3,y:S-j},{x:O+5*$/6,y:S-j},{x:O+$,y:S},{x:O+5*$/6,y:S+j},{x:O+2*$/3,y:S+j}],B.label.x=B.x,B.label.y=B.y}})}(M)),R(" removeBorderNodes",()=>function(D){D.nodes().forEach(F=>{if(D.children(F).length){let B=D.node(F),U=D.node(B.borderTop),O=D.node(B.borderBottom),S=D.node(B.borderLeft[B.borderLeft.length-1]),$=D.node(B.borderRight[B.borderRight.length-1]);B.width=Math.abs($.x-S.x),B.height=Math.abs(O.y-U.y),B.x=S.x+B.width/2,B.y=U.y+B.height/2}}),D.nodes().forEach(F=>{D.node(F).dummy==="border"&&D.removeNode(F)})}(M)),R(" normalize.undo",()=>e.undo(M)),R(" fixupEdgeLabelCoords",()=>function(D){D.edges().forEach(F=>{let B=D.edge(F);if(Object.hasOwn(B,"x"))switch(B.labelpos!=="l"&&B.labelpos!=="r"||(B.width-=B.labeloffset),B.labelpos){case"l":B.x-=B.width/2+B.labeloffset;break;case"r":B.x+=B.width/2+B.labeloffset}})}(M)),R(" undoCoordinateSystem",()=>l.undo(M)),R(" translateGraph",()=>function(D){let F=Number.POSITIVE_INFINITY,B=0,U=Number.POSITIVE_INFINITY,O=0,S=D.graph(),$=S.marginx||0,j=S.marginy||0;function W(X){let Y=X.x,q=X.y,ne=X.width,re=X.height;F=Math.min(F,Y-ne/2),B=Math.max(B,Y+ne/2),U=Math.min(U,q-re/2),O=Math.max(O,q+re/2)}D.nodes().forEach(X=>W(D.node(X))),D.edges().forEach(X=>{let Y=D.edge(X);Object.hasOwn(Y,"x")&&W(Y)}),F-=$,U-=j,D.nodes().forEach(X=>{let Y=D.node(X);Y.x-=F,Y.y-=U}),D.edges().forEach(X=>{let Y=D.edge(X);Y.points.forEach(q=>{q.x-=F,q.y-=U}),Object.hasOwn(Y,"x")&&(Y.x-=F),Object.hasOwn(Y,"y")&&(Y.y-=U)}),S.width=B-F+$,S.height=O-U+j}(M)),R(" assignNodeIntersects",()=>function(D){D.edges().forEach(F=>{let B,U,O=D.edge(F),S=D.node(F.v),$=D.node(F.w);O.points?(B=O.points[0],U=O.points[O.points.length-1]):(O.points=[],B=$,U=S),O.points.unshift(h.intersectRect(S,B)),O.points.push(h.intersectRect($,U))})}(M)),R(" reversePoints",()=>function(D){D.edges().forEach(F=>{let B=D.edge(F);B.reversed&&B.points.reverse()})}(M)),R(" acyclic.undo",()=>t.undo(M))}(A,I,N)),I(" updateInputGraph",()=>function(M,R){M.nodes().forEach(z=>{let D=M.node(z),F=R.node(z);D&&(D.x=F.x,D.y=F.y,D.rank=F.rank,R.children(z).length&&(D.width=F.width,D.height=F.height))}),M.edges().forEach(z=>{let D=M.edge(z),F=R.edge(z);D.points=F.points,Object.hasOwn(F,"x")&&(D.x=F.x,D.y=F.y)}),M.graph().width=R.graph().width,M.graph().height=R.graph().height}(E,A))})};let m=["nodesep","edgesep","ranksep","marginx","marginy"],_={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},g=["acyclicer","ranker","rankdir","align"],p=["width","height"],b={width:0,height:0},y=["minlen","weight","width","height","labeloffset"],x={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},k=["labelpos"];function C(E,N){return h.mapValues(h.pick(E,N),Number)}function v(E){var N={};return E&&Object.entries(E).forEach(([I,A])=>{typeof I=="string"&&(I=I.toLowerCase()),N[I]=A}),N}return tm}function CL(){if(r3)return nm;r3=1;let t=Ft(),e=eo().Graph;return nm={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}},nm}var p3=l3?a3:(l3=1,a3={graphlib:eo(),layout:SL(),debug:CL(),util:{time:Ft().time,notime:Ft().notime},version:i3?s3:(i3=1,s3="1.1.4")});const na=new p3.graphlib.Graph().setDefaultEdgeLabel(()=>({})),g3=(t,e,n)=>(na.setGraph({rankdir:n.direction,nodesep:150,ranksep:200,ranker:"longest-path"}),e.forEach(o=>na.setEdge(o.source,o.target)),t.forEach(o=>na.setNode(o.id,{...o,width:o.width??0,height:o.height??0})),p3.layout(na),{nodes:t.map(o=>{const{x:r,y:s}=na.node(o.id);return{...o,position:{x:r,y:s}}}),edges:e}),_3=new class{createEdge(t,e){return{animated:!0,markerEnd:{type:ys.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:bf(ct.get(e).code.trim().split(`
|
144
|
+
`).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 Qm.zip(t,e)){o||r.push(this.createNode(l,c));const d=i.has(l),h=ct.get(c).code.trim().startsWith("mo.md");!d&&h||r.push(this.createNode(l,c))}return{nodes:r,edges:s}}},NL=t=>{const e=K.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 S=_3.createElements(n,r,o,a.hidePureMarkdown);return S=g3(S.nodes,S.edges,{direction:i}),S},e[0]=r,e[1]=n,e[2]=i,e[3]=a.hidePureMarkdown,e[4]=o,e[5]=l):l=e[5];const[c]=T.useState(l),[d,h,f]=J2(c.nodes),[m,_,g]=K2(c.edges),p=Qi();let b;e[6]!==i||e[7]!==_||e[8]!==h?(b=S=>{const $=g3(S.nodes,S.edges,{direction:i});h($.nodes),_($.edges)},e[6]=i,e[7]=_,e[8]=h,e[9]=b):b=e[9];const y=nt(b);let x,k;e[10]!==r||e[11]!==n||e[12]!==a.hidePureMarkdown||e[13]!==y||e[14]!==o?(x=()=>{y(_3.createElements(n,r,o,a.hidePureMarkdown))},k=[n,o,r,y,a.hidePureMarkdown],e[10]=r,e[11]=n,e[12]=a.hidePureMarkdown,e[13]=y,e[14]=o,e[15]=x,e[16]=k):(x=e[15],k=e[16]),T.useEffect(x,k);const[C,v]=T.useState();let E;ok(),e[17]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{v(void 0)},e[17]=E):E=e[17];const N=E;let I,A,M,R,z,D,F,B,U,O;return e[18]===Symbol.for("react.memo_cache_sentinel")?(I={minZoom:.5,maxZoom:1.5},A=(S,$)=>{v({type:"node",id:$.id})},M=(S,$)=>{const{source:j,target:W}=$;v({type:"edge",source:j,target:W})},e[18]=I,e[19]=A,e[20]=M):(I=e[18],A=e[19],M=e[20]),e[21]===Symbol.for("react.memo_cache_sentinel")?(R=u.jsx(qP,{color:"#ccc",variant:$n.Dots}),e[21]=R):R=e[21],e[22]!==p||e[23]!==d?(z=()=>{const S=ct.get(t$);if(S){const $=d.find(j=>j.id===S);$&&(p.fitView({padding:1,duration:600,nodes:[$]}),v({type:"node",id:S}))}},e[22]=p,e[23]=d,e[24]=z):z=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(D=u.jsx(Lp,{className:"size-4"}),e[25]=D):D=e[25],e[26]!==z?(F=u.jsx(BP,{position:"bottom-right",showInteractive:!1,children:u.jsx(Te,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:u.jsx(js,{onMouseDown:Hn.preventFocus,onClick:z,children:D})})}),e[26]=z,e[27]=F):F=e[27],e[28]!==m||e[29]!==C||e[30]!==o?(B=u.jsx(oc,{selection:C,variables:o,edges:m,onClearSelection:N}),e[28]=m,e[29]=C,e[30]=o,e[31]=B):B=e[31],e[32]!==s||e[33]!==m||e[34]!==d||e[35]!==g||e[36]!==f||e[37]!==F||e[38]!==B?(U=u.jsxs(_f,{nodes:d,edges:m,nodeTypes:tk,minZoom:.2,fitViewOptions:I,onNodeClick:A,onEdgeClick:M,onNodeDoubleClick:jL,fitView:!0,onNodesChange:f,onEdgesChange:g,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[R,F,B,s]}),e[32]=s,e[33]=m,e[34]=d,e[35]=g,e[36]=f,e[37]=F,e[38]=B,e[39]=U):U=e[39],e[40]!==i||e[41]!==U?(O=u.jsx(Q2,{value:i,children:U}),e[40]=i,e[41]=U,e[42]=O):O=e[42],O};function jL(t,e){pS(e.id,"focus")}const EL=Gt("_minimap_"),IL=Gt({hidePureMarkdown:!0}),AL=t=>{const e=K.c(11),[n,o]=an(EL),[r,s]=an(IL);let i;e[0]!==n||e[1]!==t||e[2]!==o||e[3]!==s||e[4]!==r?(i=()=>n==="_minimap_"?u.jsx(XP,{...t,children:u.jsx(xf,{settings:r,onSettingsChange:s,view:n,onChange:o})}):u.jsx(NL,{...t,settings:r,layoutDirection:n,children:u.jsx(xf,{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(gf,{children:l},n),e[8]=n,e[9]=l,e[10]=c):c=e[10],c},TL=()=>{const t=K.c(5),e=gS(),n=Jc(),[o]=n$();let r,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=Ae("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(AL,{cellAtoms:o,variables:e,cellIds:n.inOrderIds})}),t[1]=n.inOrderIds,t[2]=o,t[3]=e,t[4]=s):s=t[4],s},ML=t=>{const e=K.c(4),{isOpen:n,children:o}=t,[r,s]=J.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]),J.useEffect(i,a),r?o:null},OL=t=>{const e=K.c(8),{variableName:n,className:o}=t;let r;e[0]!==n?(r=()=>{const l=function(d){const h=ct.get(_S)[d];if(h)return h.declaredBy[0]}(n);if(!l)return;const c=uc(l);c&&tp(c,n)},e[0]=n,e[1]=r):r=e[1];const s=r;let i,a;return e[2]!==o?(i=Ae("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},DL=Gt(t=>{const e=t(o$),n=t(_S),o=t(cS);return Ca(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})}),RL=Gt(t=>{const e=new Map(t(r$));for(const n of bS){const o=e.get(n);o&&o.databases.length===0&&e.delete(n)}return Ca([...e.values()],n=>bS.has(n.name)?1:0)}),PL=()=>{const t=K.c(32),[e,n]=J.useState(""),o=en(yS),r=$e(DL),s=$e(RL);if(r.length===0&&s.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(vn,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:u.jsx(Lg,{children:u.jsxs(De,{variant:"outline",size:"sm",children:["Add database or catalog",u.jsx(pr,{className:"h-4 w-4 ml-2"})]})}),icon:u.jsx(dr,{})}),t[0]=b):b=t[0],b}const i=!!e.trim();let a,l,c,d,h,f,m,_,g,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(aa,{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(oo,{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(Lg,{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(pr,{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(LL,{connection:y,hasChildren:y.databases.length>0,children:y.databases.map(x=>u.jsx(FL,{engineName:y.name,database:x,hasSearch:i,children:u.jsx(zL,{schemas:x.schemas,defaultSchema:y.default_schema,defaultDatabase:y.default_database,engineName:y.name,databaseName:x.name,hasSearch:i,searchValue:e})},x.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(xS,{children:[u.jsx(mc,{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?(_=r.length>0&&u.jsx(b3,{tables:r,searchValue:e}),t[22]=e,t[23]=r,t[24]=_):_=t[24],t[25]!==f||t[26]!==m||t[27]!==_?(g=u.jsxs(Vm,{className:"flex flex-col",children:[f,m,_]}),t[25]=f,t[26]=m,t[27]=_,t[28]=g):g=t[28],t[29]!==h||t[30]!==g?(p=u.jsxs(Ec,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-none",shouldFilter:!1,children:[h,g]}),t[29]=h,t[30]=g,t[31]=p):p=t[31],p},LL=t=>{const e=K.c(25),{connection:n,children:o,hasChildren:r}=t,s=n.name===s$,i=s?"In-Memory":n.name,[a,l]=J.useState(!1);let c;e[0]!==n.name?(c=async()=>{l(!0),await a$({engine:n.name}),setTimeout(()=>l(!1),500)},e[0]=n.name,e[1]=c):c=e[1];const d=c;let h,f,m;e[2]!==n.dialect?(h=u.jsx(f4,{className:"h-4 w-4 text-muted-foreground",name:n.dialect}),e[2]=n.dialect,e[3]=h):h=e[3],e[4]!==n.dialect?(f=i$(n.dialect),e[4]=n.dialect,e[5]=f):f=e[5],e[6]!==f?(m=u.jsx("span",{className:"text-xs",children:f}),e[6]=f,e[7]=m):m=e[7];const _=i;let g,p,b,y,x;return e[8]!==_?(g=u.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",u.jsx(OL,{variableName:_}),")"]}),e[8]=_,e[9]=g):g=e[9],e[10]!==d||e[11]!==s||e[12]!==a?(p=!s&&u.jsx(Te,{content:"Refresh connection",children:u.jsx(De,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:d,children:u.jsx(zc,{className:Ae("h-4 w-4 text-muted-foreground hover:text-foreground",a&&"animate-[spin_0.5s]")})})}),e[10]=d,e[11]=s,e[12]=a,e[13]=p):p=e[13],e[14]!==h||e[15]!==m||e[16]!==g||e[17]!==p?(b=u.jsxs(xS,{children:[h,m,g,p]}),e[14]=h,e[15]=m,e[16]=g,e[17]=p,e[18]=b):b=e[18],e[19]!==o||e[20]!==r?(y=r?o:u.jsx(Kc,{content:"No databases available",className:"pl-2"}),e[19]=o,e[20]=r,e[21]=y):y=e[21],e[22]!==b||e[23]!==y?(x=u.jsxs(u.Fragment,{children:[b,y]}),e[22]=b,e[23]=y,e[24]=x):x=e[24],x},FL=t=>{const e=K.c(28),{hasSearch:n,engineName:o,database:r,children:s}=t,[i,a]=J.useState(!1),[l,c]=J.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]),J.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 _;e[6]!==i?(_=u.jsx(CS,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i?"text-foreground":"text-muted-foreground";let p,b;e[8]!==g?(p=Ae("h-4 w-4",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=u.jsx(dr,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&i&&"font-semibold";let x,k,C,v;e[12]!==y?(x=Ae(y),e[12]=y,e[13]=x):x=e[13],e[14]!==r.name?(k=r.name===""?u.jsx("i",{children:"Not connected"}):r.name,e[14]=r.name,e[15]=k):k=e[15],e[16]!==x||e[17]!==k?(C=u.jsx("span",{className:x,children:k}),e[16]=x,e[17]=k,e[18]=C):C=e[18],e[19]!==C||e[20]!==f||e[21]!==m||e[22]!==_||e[23]!==b?(v=u.jsxs(go,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",onSelect:f,value:m,children:[_,b,C]}),e[19]=C,e[20]=f,e[21]=m,e[22]=_,e[23]=b,e[24]=v):v=e[24];const E=i&&s;let N;return e[25]!==v||e[26]!==E?(N=u.jsxs(u.Fragment,{children:[v,E]}),e[25]=v,e[26]=E,e[27]=N):N=e[27],N},zL=t=>{const e=K.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(Kc,{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=_=>!l||_.tables.some(g=>g.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=_=>u.jsx(BL,{databaseName:i,schema:_,hasSearch:a,children:u.jsx(b3,{tables:_.tables,searchValue:l,sqlTableContext:{engine:s,database:i,schema:_.name,defaultSchema:o,defaultDatabase:r}})},_.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},BL=t=>{const e=K.c(26),{databaseName:n,schema:o,children:r,hasSearch:s}=t,[i,a]=J.useState(!1),[l,c]=J.useState(!1),d=`${n}:${o.name}`;let h,f,m,_;if(e[0]!==s?(h=()=>{a(s)},f=[s],e[0]=s,e[1]=h,e[2]=f):(h=e[1],f=e[2]),J.useEffect(h,f),SS(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?(_=u.jsx(CS,{isExpanded:i}),e[6]=i,e[7]=_):_=e[7];const g=l&&i&&"text-foreground";let p,b;e[8]!==g?(p=Ae("h-4 w-4 text-muted-foreground",g),e[8]=g,e[9]=p):p=e[9],e[10]!==p?(b=u.jsx(m$,{className:p}),e[10]=p,e[11]=b):b=e[11];const y=l&&i&&"font-semibold";let x,k,C;e[12]!==y?(x=Ae(y),e[12]=y,e[13]=x):x=e[13],e[14]!==o.name||e[15]!==x?(k=u.jsx("span",{className:x,children:o.name}),e[14]=o.name,e[15]=x,e[16]=k):k=e[16],e[17]!==k||e[18]!==m||e[19]!==_||e[20]!==b||e[21]!==d?(C=u.jsxs(go,{className:"text-sm flex flex-row gap-1 items-center pl-5 cursor-pointer rounded-none",onSelect:m,value:d,children:[_,b,k]}),e[17]=k,e[18]=m,e[19]=_,e[20]=b,e[21]=d,e[22]=C):C=e[22];const v=i&&r;let E;return e[23]!==C||e[24]!==v?(E=u.jsxs(u.Fragment,{children:[C,v]}),e[23]=C,e[24]=v,e[25]=E):E=e[25],E},b3=t=>{const e=K.c(24),{tables:n,sqlTableContext:o,searchValue:r}=t,{addTableList:s}=wS(),[i,a]=J.useState(!1),[l,c]=J.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,x=await LH.request({engine:p,database:b,schema:y});if(!(x!=null&&x.tables))throw c(!1),new Error("No tables available");s({tables:x.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}=Gn(d,h);if(f||l){let p;return e[9]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(vS,{message:"Loading tables...",className:"pl-12"}),e[9]=p):p=e[9],p}if(m){let p;return e[10]!==m?(p=u.jsx(kS,{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(Kc,{content:"No tables found",className:"pl-9"}),e[12]=p):p=e[12],p}let _,g;if(e[13]!==r||e[14]!==o||e[15]!==n){let p;e[17]!==r?(p=x=>!r||x.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=x=>u.jsx(UL,{table:x,sqlTableContext:o,isSearching:!!r},x.name),e[19]=r,e[20]=o,e[21]=y):y=e[21],_=b.map(y),e[13]=r,e[14]=o,e[15]=n,e[16]=_}else _=e[16];return e[22]!==_?(g=u.jsx(u.Fragment,{children:_}),e[22]=_,e[23]=g):g=e[23],g},UL=t=>{const e=K.c(62),{table:n,sqlTableContext:o,isSearching:r}=t,{addTable:s}=wS(),[i,a]=J.useState(!1),[l,c]=J.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:q,database:ne,schema:re}=o,ae=await FH.request({engine:q,database:ne,schema:re,tableName:n.name});if(!(ae!=null&&ae.table))throw new Error("No table details available");s({table:ae.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{isPending:m,error:_}=Gn(h,f),g=$e(Bs),p=Br(),{createNewCell:b}=Ot();let y;e[10]!==g||e[11]!==b||e[12]!==p||e[13]!==o||e[14]!==n?(y=()=>{ur(g,b,p),b({code:(()=>{if(n.source_type==="catalog"){const q=o!=null&&o.database?`${o.database}.${n.name}`:n.name;return`${n.engine}.load_table("${q}")`}if(o)return NS(n,"*",o);switch(n.source_type){case"local":return`mo.ui.table(${n.name})`;case"duckdb":case"connection":return NS(n,"*",o);default:return wc(n.source_type),""}})(),before:!1,cellId:p??"__end__"})},e[10]=g,e[11]=b,e[12]=p,e[13]=o,e[14]=n,e[15]=y):y=e[15];const x=y;let k;e[16]!==n.num_columns||e[17]!==n.num_rows?(k=()=>{const q=[];return n.num_rows!=null&&q.push(`${n.num_rows} rows`),n.num_columns!=null&&q.push(`${n.num_columns} columns`),q.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:q.join(", ")})})},e[16]=n.num_columns,e[17]=n.num_rows,e[18]=k):k=e[18];const C=k;let v;e[19]!==_||e[20]!==m||e[21]!==o||e[22]!==n?(v=()=>{if(m)return u.jsx(vS,{message:"Loading columns...",className:"pl-12"});if(_)return u.jsx(kS,{error:_,className:"pl-12"});const q=n.columns;return q.length===0?u.jsx(Kc,{content:"No columns found",className:"pl-12"}):q.map(ne=>u.jsx(VL,{table:n,column:ne,sqlTableContext:o},ne.name))},e[19]=_,e[20]=m,e[21]=o,e[22]=n,e[23]=v):v=e[23];const E=v;let N;e[24]!==i||e[25]!==r||e[26]!==n.source_type||e[27]!==n.type?(N=()=>{if(n.source_type==="local")return;const q=n.type==="table"?l$:Z3;return u.jsx(q,{className:"h-3 w-3",strokeWidth:i||r?2.5:void 0})},e[24]=i,e[25]=r,e[26]=n.source_type,e[27]=n.type,e[28]=N):N=e[28];const I=N,A=o?`${o.database}.${o.schema}.${n.name}`:n.name,M=o&&(SS(o.schema)?"pl-9":"pl-12"),R=(i||r)&&"font-semibold";let z,D,F,B,U,O,S,$,j,W,X,Y;return e[29]!==M||e[30]!==R?(z=Ae("rounded-none group h-8 cursor-pointer",M,R),e[29]=M,e[30]=R,e[31]=z):z=e[31],e[32]!==i?(D=()=>a(!i),e[32]=i,e[33]=D):D=e[33],e[34]!==I?(F=I(),e[34]=I,e[35]=F):F=e[35],e[36]!==n.name?(B=u.jsx("span",{className:"text-sm",children:n.name}),e[36]=n.name,e[37]=B):B=e[37],e[38]!==F||e[39]!==B?(U=u.jsxs("div",{className:"flex gap-2 items-center flex-1",children:[F,B]}),e[38]=F,e[39]=B,e[40]=U):U=e[40],e[41]!==C?(O=C(),e[41]=C,e[42]=O):O=e[42],e[43]!==x?(S=Hn.stopPropagation(()=>x()),e[43]=x,e[44]=S):S=e[44],e[45]===Symbol.for("react.memo_cache_sentinel")?($=u.jsx(c$,{className:"h-3 w-3"}),e[45]=$):$=e[45],e[46]!==S?(j=u.jsx(Te,{content:"Add table to notebook",delayDuration:400,children:u.jsx(De,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:S,children:$})}),e[46]=S,e[47]=j):j=e[47],e[48]!==i||e[49]!==D||e[50]!==U||e[51]!==O||e[52]!==j||e[53]!==z||e[54]!==A?(W=u.jsxs(go,{className:z,value:A,"aria-selected":i,forceMount:!0,onSelect:D,children:[U,O,j]}),e[48]=i,e[49]=D,e[50]=U,e[51]=O,e[52]=j,e[53]=z,e[54]=A,e[55]=W):W=e[55],e[56]!==i||e[57]!==E?(X=i&&E(),e[56]=i,e[57]=E,e[58]=X):X=e[58],e[59]!==W||e[60]!==X?(Y=u.jsxs(u.Fragment,{children:[W,X]}),e[59]=W,e[60]=X,e[61]=Y):Y=e[61],Y},VL=t=>{var X,Y;const e=K.c(53),{table:n,column:o,sqlTableContext:r}=t,[s,i]=J.useState(!1),a=$e(yS),l=en(d$);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]),J.useEffect(c,d),l(s?q=>new Set([...q,`${n.name}:${o.name}`]):q=>(q.delete(`${n.name}:${o.name}`),new Set(q)));const h=$e(Bs),f=Br(),{createNewCell:m}=Ot(),{columnsPreviews:_}=u$();let g;e[3]!==o.name||e[4]!==n.primary_keys?(g=((X=n.primary_keys)==null?void 0:X.includes(o.name))||!1,e[3]=o.name,e[4]=n.primary_keys,e[5]=g):g=e[5];const p=g;let b;e[6]!==o.name||e[7]!==n.indexes?(b=((Y=n.indexes)==null?void 0:Y.includes(o.name))||!1,e[6]=o.name,e[7]=n.indexes,e[8]=b):b=e[8];const y=b;let x;e[9]!==h||e[10]!==m||e[11]!==f?(x=q=>{q.includes("alt")&&p$(h,m,f),m({code:q,before:!1,cellId:f??"__end__"})},e[9]=h,e[10]=m,e[11]=f,e[12]=x):x=e[12];const k=x,C=$L,v=s?"font-semibold":"";let E;e[13]!==o.name||e[14]!==v?(E=u.jsx("span",{className:v,children:o.name}),e[13]=o.name,e[14]=v,e[15]=E):E=e[15];const N=E,I=`${n.name}.${o.name}`,A=`${n.name}.${o.name}`;let M;e[16]!==s?(M=()=>i(!s),e[16]=s,e[17]=M):M=e[17];const R=r?"pl-14":"pl-7";let z,D,F,B,U,O,S,$,j,W;return e[18]!==R?(z=Ae("flex flex-row gap-2 items-center flex-1",R),e[18]=R,e[19]=z):z=e[19],e[20]!==o.type||e[21]!==N?(D=u.jsx(h$,{columnName:N,dataType:o.type}),e[20]=o.type,e[21]=N,e[22]=D):D=e[22],e[23]!==p?(F=p&&C({tooltipContent:"Primary key",content:"PK"}),e[23]=p,e[24]=F):F=e[24],e[25]!==y?(B=y&&C({tooltipContent:"Indexed",content:"IDX"}),e[25]=y,e[26]=B):B=e[26],e[27]!==z||e[28]!==D||e[29]!==F||e[30]!==B?(U=u.jsxs("div",{className:z,children:[D,F,B]}),e[27]=z,e[28]=D,e[29]=F,e[30]=B,e[31]=U):U=e[31],e[32]!==o.name?(O=u.jsx(Te,{content:"Copy column name",delayDuration:400,children:u.jsx(De,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:u.jsx(fS,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),e[32]=o.name,e[33]=O):O=e[33],e[34]!==o.external_type?(S=u.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),e[34]=o.external_type,e[35]=S):S=e[35],e[36]!==M||e[37]!==U||e[38]!==O||e[39]!==S||e[40]!==I||e[41]!==A?($=u.jsxs(go,{className:"rounded-none py-1 group cursor-pointer",value:A,onSelect:M,children:[U,O,S]},I),e[36]=M,e[37]=U,e[38]=O,e[39]=S,e[40]=I,e[41]=A,e[42]=$):$=e[42],e[43]!==o||e[44]!==_||e[45]!==k||e[46]!==s||e[47]!==r||e[48]!==n?(j=s&&u.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:u.jsx(Ic,{children:u.jsx(f$,{table:n,column:o,onAddColumnChart:k,preview:_.get(r?`${r.database}.${r.schema}.${n.name}:${o.name}`:`${n.name}:${o.name}`),sqlTableContext:r})})}),e[43]=o,e[44]=_,e[45]=k,e[46]=s,e[47]=r,e[48]=n,e[49]=j):j=e[49],e[50]!==$||e[51]!==j?(W=u.jsxs(u.Fragment,{children:[$,j]}),e[50]=$,e[51]=j,e[52]=W):W=e[52],W};function $L(t){const{tooltipContent:e,content:n}=t;return u.jsx(Te,{content:e,delayDuration:100,children:u.jsx("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:n})})}const HL=()=>{const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(PL,{}),t[0]=e):e=t[0],e},WL=()=>{const t=K.c(5),{documentation:e}=$e(g$);if(!e){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(vn,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:u.jsx(md,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=ep({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},qL=()=>{const t=K.c(5),e=_$();if(e.length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(vn,{title:"No errors!",icon:u.jsx(Hp,{})}),t[0]=r):r=t[0],r}let n,o;return t[1]!==e?(n=e.map(GL),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 GL(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(b$,{cellId:t.cellId})}),u.jsx("div",{className:"px-2",children:u.jsx(y$,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}function y3(t,e,n){return t[e]?t[e][0]?t[e][0][n]:t[e][n]:e==="contentBoxSize"?t.contentRect[n==="inlineSize"?"width":"height"]:void 0}pp=function(t){t===void 0&&(t={});var e=t.onResize,n=T.useRef(void 0);n.current=e;var o=t.round||Math.round,r=T.useRef(),s=T.useState({width:void 0,height:void 0}),i=s[0],a=s[1],l=T.useRef(!1);T.useEffect(function(){return l.current=!1,function(){l.current=!0}},[]);var c=T.useRef({width:void 0,height:void 0}),d=function(h,f){var m=T.useRef(null),_=T.useRef(null);_.current=f;var g=T.useRef(null);T.useEffect(function(){p()});var p=T.useCallback(function(){var b=g.current,y=_.current,x=b||(y?y instanceof Element?y:y.current:null);m.current&&m.current.element===x&&m.current.subscriber===h||(m.current&&m.current.cleanup&&m.current.cleanup(),m.current={element:x,subscriber:h,cleanup:x?h(x):void 0})},[h]);return T.useEffect(function(){return function(){m.current&&m.current.cleanup&&(m.current.cleanup(),m.current=null)}},[]),T.useCallback(function(b){g.current=b,p()},[p])}(T.useCallback(function(h){return r.current&&r.current.box===t.box&&r.current.round===o||(r.current={box:t.box,round:o,instance:new ResizeObserver(function(f){var m=f[0],_=t.box==="border-box"?"borderBoxSize":t.box==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",g=y3(m,_,"inlineSize"),p=y3(m,_,"blockSize"),b=g?o(g):void 0,y=p?o(p):void 0;if(c.current.width!==b||c.current.height!==y){var x={width:b,height:y};c.current.width=b,c.current.height=y,n.current?n.current(x):l.current||a(x)}})}),r.current.instance.observe(h,{box:t.box}),function(){r.current&&r.current.instance.unobserve(h)}},[t.box,o]),t.ref);return T.useMemo(function(){return{ref:d,width:i.width,height:i.height}},[d,i.width,i.height])};const rm=new Map,YL=({file:t,onOpenNotebook:e})=>{const{theme:n}=gr(),o=$e(ym),[r,s]=T.useState(""),{data:i,isPending:a,error:l,setData:c}=Gn(async()=>{const g=await np({path:t.path}),p=g.contents||"";return s(rm.get(t.path)||p),g},[t.path]),d=async()=>{r!==(i==null?void 0:i.contents)&&await j$({path:t.path,contents:r}).then(g=>{g.success&&(c(p=>({...p,contents:r})),s(r))})},h=T.useRef(r);if(h.current=r,T.useEffect(()=>()=>{if(!(i!=null&&i.contents))return;const g=h.current;g===i.contents?rm.delete(t.path):rm.set(t.path,g)},[t.path,i==null?void 0:i.contents]),l)return u.jsx(Vr,{error:l});if(a||!i)return null;const f=i.mimeType||"text/plain",m=f in sm;if(!i.contents&&!m)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:i.file.name}),u.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),u.jsx("div",{children:f})]});const _=u.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[t.isMarimoFile&&!In()&&u.jsx(Te,{content:"Open notebook",children:u.jsx(wn,{size:"small",onClick:g=>e(g),children:u.jsx(Nc,{})})}),u.jsx(Te,{content:"Download",children:u.jsx(wn,{size:"small",onClick:()=>{if(x3(f)){const g=C$(i.contents,f);return void N$(g,i.file.name)}ua(new Blob([i.contents||r],{type:f}),i.file.name)},children:u.jsx(Em,{})})}),!x3(f)&&u.jsxs(u.Fragment,{children:[u.jsx(Te,{content:"Copy contents to clipboard",children:u.jsx(wn,{size:"small",onClick:async()=>{await xn(r)},children:u.jsx(ra,{})})}),u.jsx(Te,{content:pn("global.save"),children:u.jsx(wn,{size:"small",color:r===i.contents?void 0:"green",onClick:d,disabled:r===i.contents,children:u.jsx(Ta,{})})})]})]});return f.startsWith("image/")?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(x$,{base64:i.contents,mime:f})})]}):f==="text/csv"&&i.contents?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(w$,{contents:i.contents})})]}):f.startsWith("audio/")?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(v$,{base64:i.contents,mime:f})})]}):f.startsWith("video/")?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(k$,{base64:i.contents,mime:f})})]}):f.startsWith("application/pdf")?u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:u.jsx(S$,{base64:i.contents,mime:f})})]}):u.jsxs(u.Fragment,{children:[_,u.jsx("div",{className:"flex-1 overflow-auto",children:u.jsx(T.Suspense,{children:u.jsx(va,{theme:n==="dark"?"dark":"light",language:sm[f]||sm.default,className:"border-b",extensions:[st.lineWrapping,Yn.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>r!==i.contents&&(d(),!0)}])],value:r,onChange:s})})})]})},x3=t=>t.startsWith("image/")||t.startsWith("audio/")||t.startsWith("video/")||t.startsWith("application/pdf"),sm={"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"},w3=Gt(new class{constructor(t){this.callbacks=t,this.delegate=new cp([]),this.rootPath="",this.onChange=An.NOOP,this.path=new kc("/"),this.initialize=async e=>{if(this.onChange=e,this.delegate.data.length===0)try{const n=await this.callbacks.listFiles({path:this.rootPath});this.delegate=new cp(n.files),this.rootPath=n.root,this.path=kc.guessDeliminator(n.root)}catch(n){ut({title:"Failed",description:G4(n)})}this.onChange(this.delegate.data)},this.refreshAll=async e=>{const n=[this.rootPath,...e.map(r=>{var s;return(s=this.delegate.find(r))==null?void 0:s.data.path})].filter(Boolean),o=await Promise.all(n.map(r=>this.callbacks.listFiles({path:r}).catch(()=>({files:[]}))));for(const[r,s]of n.entries()){const i=o[r];s===this.rootPath?this.delegate=new cp(i.files):this.delegate.update({id:s,changes:{children:i.files}})}this.onChange(this.delegate.data)},this.relativeFromRoot=e=>{const n=this.rootPath.endsWith(this.path.deliminator)?this.rootPath:`${this.rootPath}${this.path.deliminator}`;return e.startsWith(n)?e.slice(n.length):e},this.handleResponse=e=>e.success?e:(ut({title:"Failed",description:e.message}),null)}async expand(t){const e=this.delegate.find(t);if(!e||!e.data.isDirectory)return!1;if(e.children&&e.children.length>0)return!0;const n=await this.callbacks.listFiles({path:e.data.path});return this.delegate.update({id:t,changes:{children:n.files}}),this.onChange(this.delegate.data),!0}async rename(t,e){const n=this.delegate.find(t);if(!n)return;const o=n.data.path,r=this.path.join(this.path.dirname(o),e);await this.callbacks.renameFileOrFolder({path:o,newPath:r}).then(this.handleResponse),this.delegate.update({id:t,changes:{name:e,path:r}}),this.onChange(this.delegate.data),await this.refreshAll([r])}async move(t,e){var o;const n=e?((o=this.delegate.find(e))==null?void 0:o.data.path)??e:this.rootPath;await Promise.all(t.map(r=>{this.delegate.move({id:r,parentId:e,index:0});const s=this.delegate.find(r);if(!s)return Promise.resolve();const i=this.path.join(n,this.path.basename(s.data.path));return this.delegate.update({id:r,changes:{path:i}}),this.callbacks.renameFileOrFolder({path:s.data.path,newPath:i}).then(this.handleResponse)})),this.onChange(this.delegate.data),await this.refreshAll([n])}async createFile(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"file",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async createFolder(t,e){var r;const n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,o=await this.callbacks.createFileOrFolder({path:n,type:"directory",name:t}).then(this.handleResponse);o!=null&&o.info&&(this.delegate.create({parentId:e,index:0,data:o.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async delete(t){const e=this.delegate.find(t);e&&(await this.callbacks.deleteFileOrFolder({path:e.data.path}).then(this.handleResponse),this.delegate.drop({id:t}),this.onChange(this.delegate.data))}}({listFiles:w4,createFileOrFolder:op,deleteFileOrFolder:I$,renameFileOrFolder:E$})),JL=Gt({});function KL(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 v3(t){const e=K.c(4);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const o=n;let r;return e[2]!==o?(r={multiple:!0,maxSize:104857600,onError:tF,onDropRejected:ZL,onDrop:XL,...o},e[2]=o,e[3]=r):r=e[3],A$(r)}async function XL(t){for(const e of t){const n=oF(nF(e));let o="";n&&(o=kc.guessDeliminator(n).dirname(n));const r=(await KL(e)).split(",")[1];await op({path:o,type:"file",name:e.name,contents:r})}await async function(){await ct.get(w3).refreshAll([])}()}function ZL(t){ut({title:"File upload failed",description:u.jsx("div",{className:"flex flex-col gap-1",children:t.map(QL)}),variant:"danger"})}function QL(t){return u.jsxs("div",{children:[t.file.name," (",t.errors.map(eF).join(", "),")"]},t.file.name)}function eF(t){return t.message}function tF(t){Dt.error(t),ut({title:"File upload failed",description:t.message,variant:"danger"})}function nF(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 oF(t){if(t)return t.replace(/^\/+/,"")}const k3=J.createContext(null),rF=t=>{const e=K.c(60),{height:n}=t,o=T.useRef(null),[r]=an(w3);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const[i,a]=T.useState(s),[l,c]=T.useState(null),{openPrompt:d}=qn(),[h,f]=an(JL);let m,_;e[1]!==r?(m=()=>r.initialize(a),e[1]=r,e[2]=m):m=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(_=[],e[3]=_):_=e[3];const{isPending:g,error:p}=Gn(m,_);let b;e[4]!==h||e[5]!==r?(b=()=>{r.refreshAll(Object.keys(h).filter(S=>h[S]))},e[4]=h,e[5]=r,e[6]=b):b=e[6];const y=nt(b);let x;e[7]!==d||e[8]!==r?(x=async()=>{d({title:"Folder name",onConfirm:async S=>{r.createFolder(S,null)}})},e[7]=d,e[8]=r,e[9]=x):x=e[9];const k=nt(x);let C;e[10]!==d||e[11]!==r?(C=async()=>{d({title:"File name",onConfirm:async S=>{r.createFile(S,null)}})},e[10]=d,e[11]=r,e[12]=C):C=e[12];const v=nt(C);let E;e[13]!==f?(E=()=>{var S;(S=o.current)==null||S.closeAll(),f({})},e[13]=f,e[14]=E):E=e[14];const N=nt(E);if(g){let S;return e[15]===Symbol.for("react.memo_cache_sentinel")?(S=u.jsx(Kn,{size:"medium",centered:!0}),e[15]=S):S=e[15],S}if(p){let S;return e[16]!==p?(S=u.jsx(Vr,{error:p}),e[16]=p,e[17]=S):S=e[17],S}if(l){let S,$,j,W,X,Y;return e[18]===Symbol.for("react.memo_cache_sentinel")?(S=()=>c(null),e[18]=S):S=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?($=u.jsx(De,{onClick:S,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:u.jsx(Et,{size:16})}),e[19]=$):$=e[19],e[20]!==l.name?(j=u.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[$,u.jsx("span",{className:"font-bold",children:l.name})]}),e[20]=l.name,e[21]=j):j=e[21],e[22]!==l.path||e[23]!==r?(W=q=>S3(q,r.relativeFromRoot(l.path)),e[22]=l.path,e[23]=r,e[24]=W):W=e[24],e[25]!==l||e[26]!==W?(X=u.jsx(T.Suspense,{children:u.jsx(YL,{onOpenNotebook:W,file:l})}),e[25]=l,e[26]=W,e[27]=X):X=e[27],e[28]!==j||e[29]!==X?(Y=u.jsxs(u.Fragment,{children:[j,X]}),e[28]=j,e[29]=X,e[30]=Y):Y=e[30],Y}let I;e[31]!==N||e[32]!==v||e[33]!==k||e[34]!==y||e[35]!==r?(I=u.jsx(iF,{onRefresh:y,onCreateFile:v,onCreateFolder:k,onCollapseAll:N,tree:r}),e[31]=N,e[32]=v,e[33]=k,e[34]=y,e[35]=r,e[36]=I):I=e[36];const A=n-33;let M,R,z,D,F,B,U,O;return e[37]!==r?(M=async S=>{const{ids:$}=S;for(const j of $)await r.delete(j)},R=async S=>{const{id:$,name:j}=S;await r.rename($,j)},z=async S=>{const{dragIds:$,parentId:j}=S;await r.move($,j)},e[37]=r,e[38]=M,e[39]=R,e[40]=z):(M=e[38],R=e[39],z=e[40]),e[41]===Symbol.for("react.memo_cache_sentinel")?(D=S=>{const $=S[0];$&&($.data.isDirectory||c($.data))},e[41]=D):D=e[41],e[42]!==h||e[43]!==f||e[44]!==r?(F=async S=>{if(await r.expand(S)){const $=h[S]??!1;f({...h,[S]:!$})}},e[42]=h,e[43]=f,e[44]=r,e[45]=F):F=e[45],e[46]!==i||e[47]!==h||e[48]!==M||e[49]!==R||e[50]!==z||e[51]!==F||e[52]!==A?(B=u.jsx(yH,{width:"100%",ref:o,height:A,className:"h-full",data:i,initialOpenState:h,openByDefault:!1,renderCursor:uF,disableDrop:hF,onDelete:M,onRename:R,onMove:z,onSelect:D,onToggle:F,padding:15,rowHeight:30,indent:sF,overscanCount:1e3,disableMultiSelection:!0,children:cF}),e[46]=i,e[47]=h,e[48]=M,e[49]=R,e[50]=z,e[51]=F,e[52]=A,e[53]=B):B=e[53],e[54]!==B||e[55]!==r?(U=u.jsx(k3,{value:r,children:B}),e[54]=B,e[55]=r,e[56]=U):U=e[56],e[57]!==U||e[58]!==I?(O=u.jsxs(u.Fragment,{children:[I,U]}),e[57]=U,e[58]=I,e[59]=O):O=e[59],O},sF=15,iF=t=>{const e=K.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}=v3(i);let c,d,h,f,m,_,g,p,b,y,x,k,C,v,E;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(Ia,{size:16}),e[1]=c):c=e[1],e[2]!==o?(d=u.jsx(Te,{content:"Add file",children:u.jsx(De,{"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(id,{size:16}),e[4]=h):h=e[4],e[5]!==r?(f=u.jsx(Te,{content:"Add folder",children:u.jsx(De,{"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")?(_=T$({variant:"text",size:"xs"}),g=u.jsx(O$,{size:16}),e[9]=_,e[10]=g):(_=e[9],g=e[10]),e[11]!==m?(p=u.jsx(Te,{content:"Upload file",children:u.jsx("button",{"data-testid":"file-explorer-upload-button",...m,className:_,children:g})}),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")?(x=u.jsx(Z4,{size:16}),e[17]=x):x=e[17],e[18]!==n?(k=u.jsx(Te,{content:"Refresh",children:u.jsx(De,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:x})}),e[18]=n,e[19]=k):k=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(C=u.jsx(kp,{size:16}),e[20]=C):C=e[20],e[21]!==s?(v=u.jsx(Te,{content:"Collapse all folders",children:u.jsx(De,{"data-testid":"file-explorer-collapse-button",onClick:s,variant:"text",size:"xs",children:C})}),e[21]=s,e[22]=v):v=e[22],e[23]!==y||e[24]!==k||e[25]!==v||e[26]!==d||e[27]!==f||e[28]!==p?(E=u.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[d,f,p,y,k,v]}),e[23]=y,e[24]=k,e[25]=v,e[26]=d,e[27]=f,e[28]=p,e[29]=E):E=e[29],E},aF=t=>{const e=K.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&&!In()&&u.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",u.jsx(Nc,{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},lF=t=>{const e=K.c(10),{node:n}=t,o=T.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]),T.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:fF,onBlur:i,onKeyDown:a}),e[6]=n.data.name,e[7]=i,e[8]=a,e[9]=l):l=e[9],l},cF=({node:t,style:e,dragHandle:n})=>{const o=t.data.isDirectory?"directory":y4(t.data.name),r=x4[o],{openConfirm:s,openPrompt:i}=qn(),{createNewCell:a}=Ot(),l=Br(),c=T.use(k3),d=async g=>{S3(g,c?c.relativeFromRoot(t.data.path):t.data.path)},h=async g=>{g.stopPropagation(),g.preventDefault(),s({title:"Delete file",description:`Are you sure you want to delete ${t.data.name}?`,confirmAction:u.jsx(m4,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},f=nt(async()=>{t.open(),i({title:"Folder name",onConfirm:async g=>{c==null||c.createFolder(g,t.id)}})}),m=nt(async()=>{t.open(),i({title:"File name",onConfirm:async g=>{c==null||c.createFile(g,t.id)}})}),_=nt(async()=>{var y;if(!c||t.data.isDirectory)return;const[g,p]=M$(t.data.name),b=`${g}_copy${p}`;try{const x=await np({path:t.data.path}),k=((y=t.parent)==null?void 0:y.data.path)||"";await op({path:k,type:"file",name:b,contents:x.contents?btoa(x.contents):void 0}),await c.refreshAll([k])}catch{ut({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:Ae("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),draggable:!0,onClick:g=>{g.stopPropagation(),t.data.isDirectory&&t.toggle()},children:[u.jsx(dF,{node:t}),u.jsxs("span",{className:Ae("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:"./favicon.ico",className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):u.jsx(r,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),t.isEditing?u.jsx(lF,{node:t}):u.jsx(aF,{node:t,onOpenMarimoFile:d}),u.jsxs(Hs,{modal:!1,children:[u.jsx(Ws,{asChild:!0,tabIndex:-1,onClick:g=>g.stopPropagation(),children:u.jsx(De,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:u.jsx(sd,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),(()=>{const g={size:14,strokeWidth:1.5,className:"mr-2"};return u.jsxs(qs,{align:"end",className:"no-print w-[220px]",onClick:p=>p.stopPropagation(),onCloseAutoFocus:p=>p.preventDefault(),children:[!t.data.isDirectory&&u.jsxs(Yt,{onSelect:()=>t.select(),children:[u.jsx(sg,{...g}),"Open file"]}),!t.data.isDirectory&&!In()&&u.jsxs(Yt,{onSelect:()=>{D$({path:t.data.path})},children:[u.jsx(Nc,{...g}),"Open file in external editor"]}),t.data.isDirectory&&u.jsxs(u.Fragment,{children:[u.jsxs(Yt,{onSelect:()=>m(),children:[u.jsx(Ia,{...g}),"Create file"]}),u.jsxs(Yt,{onSelect:()=>f(),children:[u.jsx(id,{...g}),"Create folder"]}),u.jsx(_o,{})]}),u.jsxs(Yt,{onSelect:()=>t.edit(),children:[u.jsx(Wp,{...g}),"Rename"]}),!t.data.isDirectory&&u.jsxs(Yt,{onSelect:_,children:[u.jsx(ra,{...g}),"Duplicate"]}),u.jsxs(Yt,{onSelect:async()=>{await xn(t.data.path),ut({title:"Copied to clipboard"})},children:[u.jsx(cd,{...g}),"Copy path"]}),c&&u.jsxs(Yt,{onSelect:async()=>{await xn(c.relativeFromRoot(t.data.path)),ut({title:"Copied to clipboard"})},children:[u.jsx(cd,{...g}),"Copy relative path"]}),u.jsx(_o,{}),u.jsxs(Yt,{onSelect:()=>{const{path:p}=t.data;(b=>{a({code:b,before:!1,cellId:l??"__end__"})})(jS[o](p))},children:[u.jsx(Wr,{...g}),"Insert snippet for reading file"]}),u.jsxs(Yt,{onSelect:async()=>{ut({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:p}=t.data,b=jS[o](p);await xn(b)},children:[u.jsx(R$,{...g}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!In()&&u.jsxs(u.Fragment,{children:[u.jsx(_o,{}),u.jsxs(Yt,{onSelect:d,children:[u.jsx(eg,{...g}),"Open notebook"]})]}),u.jsx(_o,{}),!t.data.isDirectory&&u.jsxs(u.Fragment,{children:[u.jsxs(Yt,{onSelect:async()=>{const p=(await np({path:t.data.path})).contents||"";ua(new Blob([p]),t.data.name)},children:[u.jsx(Em,{...g}),"Download"]}),u.jsx(_o,{})]}),u.jsxs(Yt,{onSelect:h,variant:"danger",children:[u.jsx(bm,{...g}),"Delete"]})]})})()]})]})]})},dF=t=>{const e=K.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 flex-shrink-0"}),e[0]=r):r=e[0],r}let o;return e[1]!==n.isOpen?(o=n.isOpen?u.jsx(Vs,{className:"w-5 h-5 flex-shrink-0"}):u.jsx(ia,{className:"w-5 h-5 flex-shrink-0"}),e[1]=n.isOpen,e[2]=o):o=e[2],o};function S3(t,e){t.stopPropagation(),t.preventDefault(),window.open(`/?file=${e}`,"_blank")}function uF(){return null}function hF(t){const{parentNode:e}=t;return!e.data.isDirectory}function fF(t){return t.stopPropagation()}let C3,N3,j3;C3=()=>{const t=K.c(20),{ref:e,height:n}=pp(),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}=v3(r);let l,c,d,h,f,m,_,g;return t[1]!==s?(l=s(),t[1]=s,t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=Ae("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(rF,{height:o}),t[10]=o,t[11]=m):m=t[11],t[12]!==e||t[13]!==m?(_=u.jsx("div",{ref:e,className:"flex flex-col flex-1 overflow-hidden",children:m}),t[12]=e,t[13]=m,t[14]=_):_=t[14],t[15]!==l||t[16]!==h||t[17]!==f||t[18]!==_?(g=u.jsxs("div",{...l,className:c,children:[h,f,_]}),t[15]=l,t[16]=h,t[17]=f,t[18]=_,t[19]=g):g=t[19],g},mp=t=>{const e=K.c(6),n=t.dataTestId;let o,r;return e[0]!==t.className?(o=Ae("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},N3=()=>{const t=K.c(9),e=P$(),{clearLogs:n}=Ot();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(vn,{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(mm,{})}),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(mp,{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(j3,{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},j3=t=>{const e=K.c(10),{logs:n,className:o}=t;let r,s,i,a,l;return e[0]!==o?(r=Ae("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(gF),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 mF(t){const e=L$(t.timestamp),n=pF[t.level],o=t.level.toUpperCase();return u.jsxs(u.Fragment,{children:[u.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",e,"]"]}),u.jsx("span",{className:Ae("flex-shrink-0",n),children:o}),u.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",u.jsx(_r,{cellId:t.cellId}),")"]}),t.message]})}const pF={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"};function gF(t,e){return u.jsxs("div",{className:"contents group",children:[u.jsx("span",{className:Ae("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),u.jsx("span",{className:Ae("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:mF(t)})]},e)}const _F=()=>{const t=K.c(7),{items:e}=$e(F$);let n,o;t[0]!==e?(o=zH(e),t[0]=e,t[1]=o):o=t[1],n=o;const r=n,{activeHeaderId:s,activeOccurrences:i}=BH(r);if(e.length===0){let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsx(vn,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:u.jsx(fd,{})}),t[2]=l):l=t[2],l}let a;return t[3]!==s||t[4]!==i||t[5]!==e?(a=u.jsx(UH,{items:e,activeHeaderId:s,activeOccurrences:i}),t[3]=s,t[4]=i,t[5]=e,t[6]=a):a=t[6],a},E3=Gt(null),I3=t=>{const e=K.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=Ae("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=Hn.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},bF=()=>{var k,C;const t=K.c(27),[e]=$s(),n=e.package_management.manager,[o,r]=J.useState(null);let s;t[0]!==n?(s=[n],t[0]=n,t[1]=s):s=t[1];const{data:i,error:a,refetch:l,isPending:c}=Gn(vF,s);if(c){let v;return t[2]===Symbol.for("react.memo_cache_sentinel")?(v=u.jsx(Kn,{size:"medium",centered:!0}),t[2]=v):v=t[2],v}if(a){let v;return t[3]!==a?(v=u.jsx(Vr,{error:a}),t[3]=a,t[4]=v):v=t[4],v}const d=i.tree!=null;let h;t[5]!==d||t[6]!==o?(h=function(v,E){return v==="list"?"list":E?v||"tree":"list"}(o,d),t[5]=d,t[6]=o,t[7]=h):h=t[7];const f=h,m=(k=i.tree)==null?void 0:k.name,_=(C=i==null?void 0:i.tree)==null?void 0:C.version,g=m==="<root>";let p,b,y,x;return t[8]!==n||t[9]!==l?(p=u.jsx(yF,{packageManager:n,onSuccess:l}),t[8]=n,t[9]=l,t[10]=p):p=t[10],t[11]!==g||t[12]!==d||t[13]!==m||t[14]!==_||t[15]!==f?(b=d&&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:Ae("px-2 py-1 text-xs rounded",f==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("list"),children:"List"}),u.jsx("button",{type:"button",className:Ae("px-2 py-1 text-xs rounded",f==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r("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-none 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:g?"sandbox":"project",children:g?"sandbox":"project"}),m&&!g&&u.jsxs("span",{className:"text-xs text-muted-foreground",children:[m,_&&` v${_}`]})]})]}),t[11]=g,t[12]=d,t[13]=m,t[14]=_,t[15]=f,t[16]=b):b=t[16],t[17]!==i.list||t[18]!==i.tree||t[19]!==a||t[20]!==l||t[21]!==f?(y=f==="list"?u.jsx(xF,{packages:i.list,onSuccess:l}):u.jsx(wF,{tree:i.tree,error:a,onSuccess:l}),t[17]=i.list,t[18]=i.tree,t[19]=a,t[20]=l,t[21]=f,t[22]=y):y=t[22],t[23]!==p||t[24]!==b||t[25]!==y?(x=u.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p,b,y]}),t[23]=p,t[24]=b,t[25]=y,t[26]=x):x=t[26],x},yF=t=>{const e=K.c(40),{onSuccess:n,packageManager:o}=t,[r,s]=J.useState(""),{handleClick:i}=Sa(),a=$e(E3),l=en(E3);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]),J.useEffect(c,d);const{loading:h,handleInstallPackages:f}=U$();let m;e[4]!==n?(m=()=>{n(),s("")},e[4]=n,e[5]=m):m=e[5];const _=m;let g;e[6]!==f||e[7]!==r||e[8]!==_?(g=()=>{f(r.split(",").map(kF),_)},e[6]=f,e[7]=r,e[8]=_,e[9]=g):g=e[9];const p=g,b=`Install packages with ${o}...`;let y,x,k,C,v,E,N,I,A,M,R,z,D,F;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(Te,{content:"Change package manager",children:u.jsx(si,{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?(x=j=>{j.key==="Enter"&&(j.preventDefault(),p())},e[13]=p,e[14]=x):x=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(k=j=>s(j.target.value),e[15]=k):k=e[15],e[16]!==r||e[17]!==b||e[18]!==y||e[19]!==x?(C=u.jsx(ES,{placeholder:b,id:z1,icon:y,rootClassName:"flex-1 border-none",value:r,onKeyDown:x,onChange:k}),e[16]=r,e[17]=b,e[18]=y,e[19]=x,e[20]=C):C=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(v=u.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=v):v=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(E=u.jsxs("div",{children:[v," A package name; this will install the latest version.",u.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),N=u.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=E,e[23]=N):(E=e[22],N=e[23]),e[24]===Symbol.for("react.memo_cache_sentinel")?(I=u.jsxs("div",{children:[N," ","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"})]}),A=u.jsx("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=I,e[25]=A):(I=e[24],A=e[25]),e[26]===Symbol.for("react.memo_cache_sentinel")?(M=u.jsxs("div",{children:[A," 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]=M,e[27]=R):(M=e[26],R=e[27]),e[28]===Symbol.for("react.memo_cache_sentinel")?(z=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"})]}),D=u.jsx("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=z,e[29]=D):(z=e[28],D=e[29]),e[30]===Symbol.for("react.memo_cache_sentinel")?(F=u.jsx(Te,{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:[E,I,M,z,u.jsxs("div",{children:[D," 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(Xm,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=F):F=e[30];const B=r&&"bg-accent text-accent-foreground";let U;e[31]!==B?(U=Ae("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",B,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=B,e[32]=U):U=e[32];const O=!r;let S,$;return e[33]!==p||e[34]!==U||e[35]!==O?(S=u.jsx("button",{type:"button",className:U,onClick:p,disabled:O,children:"Add"}),e[33]=p,e[34]=U,e[35]=O,e[36]=S):S=e[36],e[37]!==S||e[38]!==C?($=u.jsxs("div",{className:"flex items-center w-full border-b",children:[C,F,S]}),e[37]=S,e[38]=C,e[39]=$):$=e[39],$},xF=t=>{const e=K.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(vn,{title:"No packages",description:"No packages are installed in this environment.",icon:u.jsx(si,{})}),e[0]=a):a=e[0],a}let r,s,i;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(rp,{children:u.jsxs(ri,{children:[u.jsx($r,{children:"Name"}),u.jsx($r,{children:"Version"}),u.jsx($r,{})]})}),e[1]=r):r=e[1],e[2]!==n||e[3]!==o){let a;e[5]!==n?(a=l=>u.jsxs(ri,{className:"group",onClick:async()=>{await xn(`${l.name}==${l.version}`),ut({title:"Copied to clipboard"})},children:[u.jsx(Hr,{children:l.name}),u.jsx(Hr,{children:l.version}),u.jsxs(Hr,{className:"flex justify-end",children:[u.jsx(A3,{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(sp,{className:"overflow-auto flex-1",children:[r,u.jsx(ip,{children:s})]}),e[7]=s,e[8]=i):i=e[8],i},A3=({packageName:t,onSuccess:e})=>{const[n,o]=J.useState(!1);return In()?null:u.jsx(I3,{onClick:async()=>{try{o(!0);const r=await V$({package:t,upgrade:!0});r.success?(e(),IS(t)):IS(t,r.error)}finally{o(!1)}},loading:n,children:"Upgrade"})},T3=({packageName:t,onSuccess:e})=>{const[n,o]=J.useState(!1);return u.jsx(I3,{onClick:async()=>{try{o(!0);const r=await $$({package:t});r.success?(e(),AS(t)):AS(t,r.error)}finally{o(!1)}},loading:n,children:"Remove"})},wF=t=>{const e=K.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]=J.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],J.useEffect(l,c),o){let _;return e[4]!==o?(_=u.jsx(Vr,{error:o}),e[4]=o,e[5]=_):_=e[5],_}if(!n){let _;return e[6]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(Kn,{size:"medium",centered:!0}),e[6]=_):_=e[6],_}if(n.dependencies.length===0){let _;return e[7]===Symbol.for("react.memo_cache_sentinel")?(_=u.jsx(vn,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:u.jsx(si,{})}),e[7]=_):_=e[7],_}e[8]===Symbol.for("react.memo_cache_sentinel")?(d=_=>{a(g=>{const p=new Set(g);return p.has(_)?p.delete(_):p.add(_),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 _;e[13]!==i||e[14]!==r?(_=(g,p)=>u.jsx("div",{className:"border-b",children:u.jsx(M3,{nodeId:`root-${p}`,node:g,level:0,isTopLevel:!0,expandedNodes:i,onToggle:h,onSuccess:r})},`${g.name}-${p}`),e[13]=i,e[14]=r,e[15]=_):_=e[15],f=n.dependencies.map(_),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},M3=t=>{const e=K.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 _;e[3]!==d||e[4]!==n||e[5]!==a?(_=U=>{U.key!=="Enter"&&U.key!==" "||(U.preventDefault(),d&&a(n))},e[3]=d,e[4]=n,e[5]=a,e[6]=_):_=e[6];const g=_;let p;e[7]!==d||e[8]!==n||e[9]!==a?(p=U=>{U.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",x=c?"px-2 py-0.5":"";let k,C;e[11]!==y||e[12]!==x?(k=Ae("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-[var(--slate-2)] focus:bg-[var(--slate-2)] focus:outline-none",y,x),e[11]=y,e[12]=x,e[13]=k):k=e[13],e[14]!==m||e[15]!==c?(C=c?{}:{paddingLeft:`${m}px`},e[14]=m,e[15]=c,e[16]=C):C=e[16];const v=d?f:void 0;let E,N,I,A,M,R,z,D,F,B;return e[17]!==d||e[18]!==f?(E=d?f?u.jsx(Vs,{className:"w-4 h-4 mr-2 flex-shrink-0"}):u.jsx(ia,{className:"w-4 h-4 mr-2 flex-shrink-0"}):u.jsx("div",{className:"w-4 mr-2 flex-shrink-0"}),e[17]=d,e[18]=f,e[19]=E):E=e[19],e[20]!==o.name?(N=u.jsx("span",{className:"font-medium truncate",children:o.name}),e[20]=o.name,e[21]=N):N=e[21],e[22]!==o.version?(I=o.version&&u.jsxs("span",{className:"text-muted-foreground text-xs",children:["v",o.version]}),e[22]=o.version,e[23]=I):I=e[23],e[24]!==N||e[25]!==I?(A=u.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[N,I]}),e[24]=N,e[25]=I,e[26]=A):A=e[26],e[27]!==o.tags?(M=o.tags.map(SF),e[27]=o.tags,e[28]=M):M=e[28],e[29]!==M?(R=u.jsx("div",{className:"flex items-center gap-1 ml-2",children:M}),e[29]=M,e[30]=R):R=e[30],e[31]!==c||e[32]!==o.name||e[33]!==l?(z=c&&u.jsxs("div",{className:"flex gap-1 invisible group-hover:visible",children:[u.jsx(A3,{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]=z):z=e[34],e[35]!==b||e[36]!==g||e[37]!==E||e[38]!==A||e[39]!==R||e[40]!==z||e[41]!==k||e[42]!==C||e[43]!==v?(D=u.jsxs("div",{className:k,style:C,onClick:b,onKeyDown:g,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":v,children:[E,A,R,z]}),e[35]=b,e[36]=g,e[37]=E,e[38]=A,e[39]=R,e[40]=z,e[41]=k,e[42]=C,e[43]=v,e[44]=D):D=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?(F=d&&f&&u.jsx("div",{role:"group",children:o.dependencies.map((U,O)=>u.jsx(M3,{nodeId:`${n}-${O}`,node:U,level:r+1,isTopLevel:!1,expandedNodes:i,onToggle:a,onSuccess:l},`${U.name}-${O}`))}),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]=F):F=e[53],e[54]!==D||e[55]!==F?(B=u.jsxs("div",{children:[D,F]}),e[54]=D,e[55]=F,e[56]=B):B=e[56],B};async function vF(){const[t,e]=await Promise.all([z$(),B$()]);return{list:t.packages,tree:e.tree}}function kF(t){return t.trim()}function SF(t,e){return t.kind==="cycle"?u.jsx("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-none 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-none 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-none 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 im=J3("marimo:scratchpadHistory:v1",[]),CF=Gt(!1),NF=Gt(null,(t,e,n)=>{if(!(n=n.trim()))return;const o=t(im),r=[n,...o.filter(s=>s!==n)].slice(0,15);e(im,r)}),jF={hide_code:!1,disabled:!1},EF=()=>{const t=K.c(69),e=Ac(),[n]=$s(),{theme:o}=gr(),r=T.useRef(null),s=Br(),{createNewCell:i,updateCellCode:a}=Ot(),l=e.cellRuntime[br],c=l==null?void 0:l.output,d=l==null?void 0:l.status,h=l==null?void 0:l.consoleOutputs,f=e.cellData[br],m=(f==null?void 0:f.code)??"",_=en(NF),[g,p]=an(CF),b=$e(im);let y;t[0]!==_||t[1]!==m?(y=()=>{TS({code:m}),_(m)},t[0]=_,t[1]=m,t[2]=y):y=t[2];const x=nt(y);let k;t[3]!==m||t[4]!==i||t[5]!==s?(k=()=>{m.trim()&&i({code:m,before:!1,cellId:s??"__end__"})},t[3]=m,t[4]=i,t[5]=s,t[6]=k):k=t[6];const C=nt(k);let v;t[7]!==a?(v=()=>{a({cellId:br,code:"",formattingChange:!1}),TS({code:""});const se=r.current;se&&se.dispatch({changes:{from:0,to:se.state.doc.length,insert:""}})},t[7]=a,t[8]=v):v=t[8];const E=nt(v);let N;t[9]!==p||t[10]!==a?(N=se=>{p(!1),a({cellId:br,code:se,formattingChange:!1});const Ie=r.current;Ie&&Ie.dispatch({changes:{from:0,to:Ie.state.doc.length,insert:se}})},t[9]=p,t[10]=a,t[11]=N):N=t[11];const I=nt(N),[A,M]=T.useState();let R;t[12]!==m||t[13]!==h||t[14]!==x||t[15]!==A||t[16]!==c||t[17]!==o||t[18]!==n?(R=()=>u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:u.jsx(eh,{theme:o,showPlaceholder:!1,id:br,code:m,config:jF,status:"idle",serializedEditorState:null,runCell:x,userConfig:n,editorViewRef:r,setEditorView:se=>{r.current=se},hidden:!1,temporarilyShowCode:An.NOOP,languageAdapter:A,setLanguageAdapter:M})}),u.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:u.jsx(Wc,{allowExpand:!1,output:c,className:"output-area",cellId:br,stale:!1,loading:!1})}),u.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:u.jsx(up,{consoleOutputs:h,className:"overflow-auto",stale:!1,cellName:K3,onSubmitDebugger:An.NOOP,cellId:br,debuggerActive:!1})})]}),t[12]=m,t[13]=h,t[14]=x,t[15]=A,t[16]=c,t[17]=o,t[18]=n,t[19]=R):R=t[19];const z=R;let D;t[20]!==I||t[21]!==b||t[22]!==g||t[23]!==o?(D=()=>g?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:b.map((se,Ie)=>u.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>I(se),children:u.jsx(T.Suspense,{children:u.jsx(va,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:se.trim(),editable:!1,readOnly:!0})})},Ie))})}):null,t[20]=I,t[21]=b,t[22]=g,t[23]=o,t[24]=D):D=t[24];const F=D;let B,U,O,S,$,j,W,X,Y,q,ne;t[25]===Symbol.for("react.memo_cache_sentinel")?(B=zs.create(br),U=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[25]=B,t[26]=U):(B=t[25],U=t[26]),t[27]===Symbol.for("react.memo_cache_sentinel")?(O=pn("cell.run"),t[27]=O):O=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(S=u.jsx(ii,{color:"var(--grass-11)",size:16}),t[28]=S):S=t[28],t[29]!==x||t[30]!==g?($=u.jsx(Te,{content:O,children:u.jsx(De,{"data-testid":"scratchpad-run-button",onClick:x,disabled:g,variant:"text",size:"xs",children:S})}),t[29]=x,t[30]=g,t[31]=$):$=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx(Cp,{size:16}),t[32]=j):j=t[32],t[33]!==E||t[34]!==g?(W=u.jsx(Te,{content:"Clear code and outputs",children:u.jsx(De,{disabled:g,size:"xs",variant:"text",onClick:E,children:j})}),t[33]=E,t[34]=g,t[35]=W):W=t[35],t[36]===Symbol.for("react.memo_cache_sentinel")?(X=u.jsx(Wr,{size:16}),t[36]=X):X=t[36],t[37]!==C||t[38]!==g?(Y=u.jsx(di,{children:u.jsx(Te,{content:"Insert code",children:u.jsx(De,{disabled:g,size:"xs",variant:"text",onClick:C,children:X})})}),t[37]=C,t[38]=g,t[39]=Y):Y=t[39],t[40]!==d?(q=(d==="running"||d==="queued")&&u.jsx(Kn,{className:"inline",size:"small"}),t[40]=d,t[41]=q):q=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(ne=u.jsx("div",{className:"flex-1"}),t[42]=ne):ne=t[42];const re=g&&"bg-[var(--sky-3)] rounded-none";let ae,Z;t[43]!==re?(ae=Ae(re),t[43]=re,t[44]=ae):ae=t[44],t[45]!==g||t[46]!==p?(Z=()=>p(!g),t[45]=g,t[46]=p,t[47]=Z):Z=t[47];const Q=b.length===0;let he,pe,ce,fe,de,Ce,Ne;return t[48]===Symbol.for("react.memo_cache_sentinel")?(he=u.jsx(Mp,{size:16}),t[48]=he):he=t[48],t[49]!==ae||t[50]!==Z||t[51]!==Q?(pe=u.jsx(Te,{content:"Toggle history",children:u.jsx(De,{size:"xs",variant:"text",className:ae,onClick:Z,disabled:Q,children:he})}),t[49]=ae,t[50]=Z,t[51]=Q,t[52]=pe):pe=t[52],t[53]!==$||t[54]!==W||t[55]!==Y||t[56]!==q||t[57]!==pe?(ce=u.jsxs("div",{className:"flex items-center flex-shrink-0",children:[$,W,Y,q,ne,pe]}),t[53]=$,t[54]=W,t[55]=Y,t[56]=q,t[57]=pe,t[58]=ce):ce=t[58],t[59]!==z?(fe=z(),t[59]=z,t[60]=fe):fe=t[60],t[61]!==F?(de=F(),t[61]=F,t[62]=de):de=t[62],t[63]!==fe||t[64]!==de?(Ce=u.jsxs("div",{className:"flex-1 divide-y relative overflow-hidden flex flex-col",children:[fe,de]}),t[63]=fe,t[64]=de,t[65]=Ce):Ce=t[65],t[66]!==ce||t[67]!==Ce?(Ne=u.jsxs("div",{className:"flex flex-col h-full overflow-hidden divide-y",id:B,children:[U,ce,Ce]}),t[66]=ce,t[67]=Ce,t[68]=Ne):Ne=t[68],Ne},IF=()=>{const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(EF,{}),t[0]=e):e=t[0],e},AF=()=>{const t=K.c(23),{openModal:e,closeModal:n}=qn();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}=Gn(MF,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(Vr,{error:i}),t[2]=i,t[3]=b):b=t[3],b}let l;t[4]!==r?(l=r.filter(OF).map(DF),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(vn,{title:"No environment variables",description:"No environment variables are available in this notebook.",icon:u.jsx(ad,{})}),t[6]=b):b=t[6],b}let d,h,f,m,_,g,p;return t[7]!==n||t[8]!==e||t[9]!==c||t[10]!==a?(d=()=>e(u.jsx(Og,{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(pr,{className:"h-4 w-4"}),t[12]=h):h=t[12],t[13]!==d?(f=u.jsx("div",{className:"flex justify-end h-8 border-b",children:u.jsx("button",{type:"button",className:"float-right border-l px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:d,children:h})}),t[13]=d,t[14]=f):f=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(m=u.jsx(rp,{children:u.jsxs(ri,{children:[u.jsx($r,{children:"Environment Variable"}),u.jsx($r,{children:"Source"}),u.jsx($r,{})]})}),t[15]=m):m=t[15],t[16]!==r?(_=r.map(RF),t[16]=r,t[17]=_):_=t[17],t[18]!==_?(g=u.jsxs(sp,{className:"overflow-auto flex-1 mb-16",children:[m,u.jsx(ip,{children:_})]}),t[18]=_,t[19]=g):g=t[19],t[20]!==f||t[21]!==g?(p=u.jsxs("div",{className:"flex flex-col h-full",children:[f,g]}),t[20]=f,t[21]=g,t[22]=p):p=t[22],p},TF=t=>{const e=K.c(9),{className:n,ariaLabel:o,onCopy:r}=t,[s,i]=J.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(Cc,{className:"w-3 h-3 text-green-700 rounded"}):u.jsx(ra,{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 MF(){return Mg((await $S.request({})).secrets)}function OF(t){return t.provider!=="env"}function DF(t){return t.name}function RF(t){return t.keys.map(e=>u.jsxs(ri,{className:"group",children:[u.jsx(Hr,{children:e}),u.jsx(Hr,{children:t.provider!=="env"&&u.jsx(mS,{variant:"outline",className:"select-none",children:t.name})}),u.jsx(Hr,{children:u.jsx(TF,{ariaLabel:`Copy ${e}`,onCopy:async()=>{await xn(`os.environ["${e}"]`),ut({title:"Copied to clipboard",description:`os.environ["${e}"] has been copied to your clipboard.`})},className:Ae("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible")})})]},`${t.name}-${e}`))}const PF=t=>{const e=K.c(6),{children:n}=t,{openModal:o,closeModal:r}=qn();let s,i;return e[0]!==r||e[1]!==o?(s=()=>o(u.jsx(FF,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(i=u.jsx(uS,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=i):i=e[5],i},LF=[st.lineWrapping],FF=t=>{const e=K.c(23),{onClose:n}=t,[o,r]=T.useState(""),{theme:s}=gr();let i,a,l,c,d,h;e[0]!==n?(i=async x=>{x.preventDefault();const k=new FormData(x.target),C=k.get("title"),v=k.get("description"),E=k.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:C,description:v,code:E})}),n(),ut({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(ar,{children:"Contribute a Snippet"}),e[2]=a):a=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(l=u.jsxs(Ls,{children:[a,u.jsxs(Fs,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",u.jsx("a",{href:no.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(lr,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),d=u.jsx(H$,{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,p,b,y;return e[8]!==o||e[9]!==f?(m=u.jsx(va,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:LF,value:o,onChange:r}),e[8]=o,e[9]=f,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(_=u.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[c,d,h,m]}),e[11]=h,e[12]=m,e[13]=_):_=e[13],e[14]!==n?(g=u.jsx(De,{"data-testid":"snippet-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=g):g=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(p=u.jsx(De,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),e[16]=p):p=e[16],e[17]!==g?(b=u.jsxs(oa,{children:[g,p]}),e[17]=g,e[18]=b):b=e[18],e[19]!==i||e[20]!==b||e[21]!==_?(y=u.jsx(cr,{className:"w-fit",children:u.jsxs("form",{onSubmit:i,children:[l,_,b]})}),e[19]=i,e[20]=b,e[21]=_,e[22]=y):y=e[22],y},zF=[st.lineWrapping],BF=()=>{const t=K.c(20),[e,n]=J.useState();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const{data:r,error:s,isPending:i}=Gn($F,o);if(s){let b;return t[1]!==s?(b=u.jsx(Vr,{error:s}),t[1]=s,t[2]=b):b=t[2],b}if(i||!r){let b;return t[3]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(Kn,{size:"medium",centered:!0}),t[3]=b):b=t[3],b}const a=e?"h-1/3":"h-full";let l,c,d,h,f,m,_,g,p;return t[4]!==a?(l=Ae("border-b rounded-none",a),t[4]=a,t[5]=l):l=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(c=u.jsx(aa,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=c):c=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsxs("div",{className:"flex items-center w-full",children:[c,u.jsx(PF,{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(pr,{className:"h-4 w-4"})})})]}),h=u.jsx(gc,{children:"No results"}),t[7]=d,t[8]=h):(d=t[7],h=t[8]),t[9]===Symbol.for("react.memo_cache_sentinel")?(f=b=>n(b),t[9]=f):f=t[9],t[10]!==r.snippets?(m=u.jsx(VF,{onSelect:f,snippets:r.snippets}),t[10]=r.snippets,t[11]=m):m=t[11],t[12]!==l||t[13]!==m?(_=u.jsxs(Ec,{className:l,children:[d,h,m]}),t[12]=l,t[13]=m,t[14]=_):_=t[14],t[15]!==e?(g=u.jsx(T.Suspense,{children:u.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:e?u.jsx(UF,{snippet:e},e.title):u.jsx(vn,{title:"",description:"Click on a snippet to view its content."})})}),t[15]=e,t[16]=g):g=t[16],t[17]!==_||t[18]!==g?(p=u.jsxs("div",{className:"flex-1 overflow-hidden",children:[_,g]}),t[17]=_,t[18]=g,t[19]=p):p=t[19],p},UF=t=>{const e=K.c(27),{snippet:n}=t,{theme:o}=gr(),{createNewCell:r}=Ot(),s=Br();let i;e[0]!==r||e[1]!==s||e[2]!==n.sections?(i=()=>{for(const p of[...n.sections].reverse())p.code&&r({code:p.code,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},e[0]=r,e[1]=s,e[2]=n.sections,e[3]=i):i=e[3];const a=i;let l;e[4]!==r||e[5]!==s?(l=p=>{r({code:p,before:!1,cellId:s??"__end__"})},e[4]=r,e[5]=s,e[6]=l):l=e[6];const c=l;let d,h,f,m,_,g;if(e[7]!==n.title?(d=u.jsx("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1",children:n.title}),e[7]=n.title,e[8]=d):d=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(h=u.jsx(Wr,{className:"ml-2 h-4 w-4"}),e[9]=h):h=e[9],e[10]!==a?(f=u.jsx("div",{className:"flex justify-end",children:u.jsx(di,{children:u.jsxs(De,{className:"float-right",size:"xs",variant:"outline",onClick:a,children:["Insert snippet",h]})})}),e[10]=a,e[11]=f):f=e[11],e[12]!==c||e[13]!==n.sections||e[14]!==n.title||e[15]!==o){let p;e[17]!==c||e[18]!==n.title||e[19]!==o?(p=b=>{const{code:y,html:x,id:k}=b;return x?u.jsx("div",{children:ep({html:x})},`${n.title}-${k}`):y?u.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[u.jsx(di,{children:u.jsx(Te,{content:"Insert snippet",children:u.jsx(De,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{c(y)},children:u.jsx(Wr,{className:"h-5 w-5"})})})}),u.jsx(T.Suspense,{children:u.jsx(va,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:zF,value:y,readOnly:!0},`${n.title}-${k}`)})]},`${n.title}-${k}`):null},e[17]=c,e[18]=n.title,e[19]=o,e[20]=p):p=e[20],m=n.sections.map(p),e[12]=c,e[13]=n.sections,e[14]=n.title,e[15]=o,e[16]=m}else m=e[16];return e[21]!==f||e[22]!==m?(_=u.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[f,m]}),e[21]=f,e[22]=m,e[23]=_):_=e[23],e[24]!==d||e[25]!==_?(g=u.jsxs(u.Fragment,{children:[d,_]}),e[24]=d,e[25]=_,e[26]=g):g=e[26],g},VF=t=>{const e=K.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(go,{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(Vm,{className:"flex flex-col overflow-auto",children:r}),e[5]=r,e[6]=s):s=e[6],s};function $F(){return W$()}const HF=J.lazy(()=>$m(()=>import("./tracing-rL3XguKu.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]),import.meta.url).then(t=>({default:t.Tracing}))),WF=()=>{const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=u.jsx(J.Suspense,{fallback:u.jsx(qF,{}),children:u.jsx(HF,{})}),t[0]=e):e=t[0],e},qF=()=>{const t=K.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",D3="type-value",am="defs-refs",GF=[{id:O3,accessorFn:t=>[t.name,t.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>u.jsx(ap,{header:"Name",column:t}),cell:({getValue:t})=>{const[e,n]=t();return u.jsx(yf,{name:e,declaredBy:n})}},{id:D3,accessorFn:t=>[t.dataType,t.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:t})=>u.jsx(ap,{header:u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx("span",{children:"Type"}),u.jsx("span",{children:"Value"})]}),column:t}),cell:({getValue:t})=>{const[e,n]=t();return u.jsxs("div",{className:"max-w-[150px]",children:[u.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),u.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:am,accessorFn:t=>[t.declaredBy,t.usedBy,t.name,t.declaredByNames,t.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:t})=>u.jsx(ap,{header:u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx("span",{children:"Declared By"}),u.jsx("span",{children:"Used By"})]}),column:t}),cell:({getValue:t})=>{const[e,n,o]=t(),r=s=>{const i=uc(s);i&&tp(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(Zp,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?u.jsx(_r,{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(_r,{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(nk,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}],R3=T.memo(({className:t,cellIds:e,variables:n})=>{const[o,r]=J.useState([]),[s,i]=J.useState(""),a=q$(),l=T.useMemo(()=>{const h=f=>{const m=a[f];return X$(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=T.useMemo(()=>{const h=new Map;return e.forEach((f,m)=>h.set(f,m)),function(f,m,_){m||(m={id:am,desc:!1});let g=[];switch(m.id){case O3:g=Ca(f,p=>p.name);break;case D3:g=Ca(f,p=>p.dataType);break;case am:g=Ca(f,p=>_.get(p.declaredBy[0]))}return m.desc?g.reverse():g}(l,o[0],h)},[l,o,e]),d=G$({data:c,columns:GF,getCoreRowModel:K$(),onGlobalFilterChange:i,getFilteredRowModel:J$(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter:h=>h.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:r,getSortedRowModel:Y$(),state:{sorting:o,globalFilter:s}});return u.jsxs(u.Fragment,{children:[u.jsx(ES,{className:"w-full",placeholder:"Search",value:s,onChange:h=>i(h.target.value)}),u.jsxs(sp,{className:Ae("w-full text-sm flex-1 border-separate border-spacing-0",t),children:[u.jsx(rp,{children:u.jsx(ri,{className:"whitespace-nowrap text-xs",children:d.getFlatHeaders().map(h=>u.jsx($r,{className:"sticky top-0 bg-background border-b",children:MS(h.column.columnDef.header,h.getContext())},h.id))})}),u.jsx(ip,{children:d.getRowModel().rows.map(h=>u.jsx(ri,{className:"hover:bg-accent",children:h.getVisibleCells().map(f=>u.jsx(Hr,{className:"border-b",children:MS(f.column.columnDef.cell,f.getContext())},f.id))},h.id))})]})]})});R3.displayName="VariableTable";const YF=()=>{const t=K.c(4),e=gS(),n=Jc();if(Object.keys(e).length===0){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=u.jsx(vn,{title:"No variables",description:"Global variables will appear here.",icon:u.jsx(cc,{})}),t[0]=r):r=t[0],r}let o;return t[1]!==n.inOrderIds||t[2]!==e?(o=u.jsx(R3,{className:"flex-1",cellIds:n.inOrderIds,variables:e}),t[1]=n.inOrderIds,t[2]=e,t[3]=o):o=t[3],o},JF=J.lazy(()=>$m(()=>import("./terminal-C5ASsGX3.js"),__vite__mapDeps([123,1,2,124]),import.meta.url)),KF=t=>{const e=K.c(121),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=Sc(),{setIsSidebarOpen:i,setIsTerminalOpen:a}=da(),l=J.useRef(null),c=J.useRef(null);let d,h,f,m,_;e[0]!==o?(d=()=>{if(!l.current)return;const le=l.current.isCollapsed();o&&le&&l.current.expand(),o||le||l.current.collapse(),requestAnimationFrame(ZF)},h=[o],e[0]=o,e[1]=d,e[2]=h):(d=e[1],h=e[2]),T.useEffect(d,h),e[3]!==r?(f=()=>{if(!c.current)return;const le=c.current.isCollapsed();r&&le&&c.current.expand(),r||le||c.current.collapse(),requestAnimationFrame(ez)},m=[r],e[3]=r,e[4]=f,e[5]=m):(f=e[4],m=e[5]),T.useEffect(f,m),e[6]!==n?(_=u.jsx(Xc,{id:"app",className:"relative h-full",children:u.jsx(T.Suspense,{children:n})},"app"),e[6]=n,e[7]=_):_=e[7];const g=_,p=o?"resize-handle":"resize-handle-collapsed";let b,y;e[8]!==p?(b=Ae("border-border no-print z-10",p,"vertical"),e[8]=p,e[9]=b):b=e[9],e[10]!==b?(y=u.jsx(OS,{onDragging:DS,className:b}),e[10]=b,e[11]=y):y=e[11];const x=y,k=r?"resize-handle":"resize-handle-collapsed";let C,v;e[12]!==k?(C=Ae("border-border no-print z-20",k,"horizontal"),e[12]=k,e[13]=C):C=e[13],e[14]!==C?(v=u.jsx(OS,{onDragging:DS,className:C}),e[14]=C,e[15]=v):v=e[15];const E=v;let N,I,A,M,R,z,D,F,B,U,O,S,$,j,W,X,Y,q,ne,re,ae;e[16]!==s?(N=u.jsx("div",{className:"text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=N):N=e[17],e[18]!==i?(I=()=>i(!1),e[18]=i,e[19]=I):I=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(A=u.jsx(oo,{className:"w-4 h-4"}),e[20]=A):A=e[20],e[21]!==I?(M=u.jsx(De,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:I,children:A}),e[21]=I,e[22]=M):M=e[22],e[23]!==N||e[24]!==M?(R=u.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[N,M]}),e[23]=N,e[24]=M,e[25]=R):R=e[25],e[26]!==s?(z=s==="files"&&u.jsx(C3,{}),e[26]=s,e[27]=z):z=e[27],e[28]!==s?(D=s==="errors"&&u.jsx(qL,{}),e[28]=s,e[29]=D):D=e[29],e[30]!==s?(F=s==="variables"&&u.jsx(YF,{}),e[30]=s,e[31]=F):F=e[31],e[32]!==s?(B=s==="dependencies"&&u.jsx(TL,{}),e[32]=s,e[33]=B):B=e[33],e[34]!==s?(U=s==="packages"&&u.jsx(bF,{}),e[34]=s,e[35]=U):U=e[35],e[36]!==s?(O=s==="outline"&&u.jsx(_F,{}),e[36]=s,e[37]=O):O=e[37],e[38]!==s?(S=s==="datasources"&&u.jsx(HL,{}),e[38]=s,e[39]=S):S=e[39],e[40]!==s?($=s==="documentation"&&u.jsx(WL,{}),e[40]=s,e[41]=$):$=e[41],e[42]!==s?(j=s==="snippets"&&u.jsx(BF,{}),e[42]=s,e[43]=j):j=e[43],e[44]!==s?(W=s==="scratchpad"&&u.jsx(IF,{}),e[44]=s,e[45]=W):W=e[45],e[46]!==s?(X=s==="chat"&&u.jsx(eR,{}),e[46]=s,e[47]=X):X=e[47],e[48]!==s?(Y=s==="logs"&&u.jsx(N3,{}),e[48]=s,e[49]=Y):Y=e[49],e[50]!==s?(q=s==="tracing"&&u.jsx(WF,{}),e[50]=s,e[51]=q):q=e[51],e[52]!==s?(ne=s==="secrets"&&u.jsx(AF,{}),e[52]=s,e[53]=ne):ne=e[53],e[54]!==z||e[55]!==D||e[56]!==F||e[57]!==B||e[58]!==U||e[59]!==O||e[60]!==S||e[61]!==$||e[62]!==j||e[63]!==W||e[64]!==X||e[65]!==Y||e[66]!==q||e[67]!==ne?(re=u.jsx(T.Suspense,{children:u.jsxs(Gc,{children:[z,D,F,B,U,O,S,$,j,W,X,Y,q,ne]})}),e[54]=z,e[55]=D,e[56]=F,e[57]=B,e[58]=U,e[59]=O,e[60]=S,e[61]=$,e[62]=j,e[63]=W,e[64]=X,e[65]=Y,e[66]=q,e[67]=ne,e[68]=re):re=e[68],e[69]!==R||e[70]!==re?(ae=u.jsx(Ic,{children:u.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[R,re]})}),e[69]=R,e[70]=re,e[71]=ae):ae=e[71];const Z=ae,Q=o&&"border-r border-l border-[var(--slate-7)]";let he,pe,ce,fe,de,Ce;e[72]!==Q?(he=Ae("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",Q),e[72]=Q,e[73]=he):he=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(pe=(le,Ve)=>{var Fe;Ve===0&&le===10&&((Fe=l.current)==null||Fe.resize(30))},e[74]=pe):pe=e[74],e[75]!==i?(ce=()=>i(!1),fe=()=>i(!0),e[75]=i,e[76]=ce,e[77]=fe):(ce=e[76],fe=e[77]),e[78]!==Z||e[79]!==x?(de=u.jsxs("span",{className:"flex flex-row h-full",children:[Z," ",x]}),e[78]=Z,e[79]=x,e[80]=de):de=e[80],e[81]!==he||e[82]!==ce||e[83]!==fe||e[84]!==de?(Ce=u.jsx(Xc,{ref:l,id:"helper",collapsedSize:0,collapsible:!0,className:he,minSize:10,defaultSize:0,maxSize:75,onResize:pe,onCollapse:ce,onExpand:fe,children:de},"helper"),e[81]=he,e[82]=ce,e[83]=fe,e[84]=de,e[85]=Ce):Ce=e[85];const Ne=Ce,se=r&&"border-[var(--slate-7)]";let Ie,be,Oe,ze,Ge,Je,Le,et,Qe;e[86]!==se?(Ie=Ae("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",se),e[86]=se,e[87]=Ie):Ie=e[87],e[88]===Symbol.for("react.memo_cache_sentinel")?(be=(le,Ve)=>{var Fe;Ve===0&&le===10&&((Fe=c.current)==null||Fe.resize(30))},e[88]=be):be=e[88],e[89]!==a?(Oe=()=>a(!1),ze=()=>a(!0),e[89]=a,e[90]=Oe,e[91]=ze):(Oe=e[90],ze=e[91]),e[92]===Symbol.for("react.memo_cache_sentinel")?(Ge=u.jsx("div",{}),e[92]=Ge):Ge=e[92],e[93]!==a?(Je=()=>a(!1),e[93]=a,e[94]=Je):Je=e[94],e[95]!==r||e[96]!==Je?(Le=u.jsx(T.Suspense,{fallback:Ge,children:u.jsx(JF,{visible:r,onClose:Je})}),e[95]=r,e[96]=Je,e[97]=Le):Le=e[97],e[98]!==r||e[99]!==Le?(et=u.jsx(ML,{isOpen:r,children:Le}),e[98]=r,e[99]=Le,e[100]=et):et=e[100],e[101]!==Ie||e[102]!==Oe||e[103]!==ze||e[104]!==et||e[105]!==E?(Qe=u.jsxs(Xc,{ref:c,id:"terminal",collapsedSize:0,collapsible:!0,className:Ie,minSize:10,defaultSize:0,maxSize:75,onResize:be,onCollapse:Oe,onExpand:ze,children:[E,et]},"terminal"),e[101]=Ie,e[102]=Oe,e[103]=ze,e[104]=et,e[105]=E,e[106]=Qe):Qe=e[106];const tt=Qe;let te,ye,ke,Me,G,ge,_e,me;return e[107]===Symbol.for("react.memo_cache_sentinel")?(te=VH(),e[107]=te):te=e[107],e[108]===Symbol.for("react.memo_cache_sentinel")?(ye=u.jsx(Gc,{children:u.jsx(PO,{})}),e[108]=ye):ye=e[108],e[109]!==tt?(ke=u.jsx(Jx,{capability:"terminal",children:tt}),e[109]=tt,e[110]=ke):ke=e[110],e[111]!==g||e[112]!==ke?(Me=u.jsx(Xc,{children:u.jsxs(RS,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,ke]})}),e[111]=g,e[112]=ke,e[113]=Me):Me=e[113],e[114]===Symbol.for("react.memo_cache_sentinel")?(G=u.jsx(Z$,{}),e[114]=G):G=e[114],e[115]!==Ne||e[116]!==Me?(ge=u.jsxs(RS,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:te,children:[ye,Ne,Me,G]}),e[115]=Ne,e[116]=Me,e[117]=ge):ge=e[117],e[118]===Symbol.for("react.memo_cache_sentinel")?(_e=u.jsx(Ic,{children:u.jsx(Gc,{children:u.jsx(TO,{})})}),e[118]=_e):_e=e[118],e[119]!==ge?(me=u.jsxs($H,{children:[ge,_e]}),e[119]=ge,e[120]=me):me=e[120],me};function XF(){window.dispatchEvent(new Event("resize"))}function ZF(){requestAnimationFrame(XF)}function QF(){window.dispatchEvent(new Event("resize"))}function ez(){requestAnimationFrame(QF)}let P3;P3=new URL(window.location.href).searchParams.get(Q$.showChrome)==="false",QS=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=K.c(10);if(P3){let s,i,a;return e[0]!==t?(s=u.jsx(Yx,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(i=u.jsx(hg,{}),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(Yx,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=u.jsx(hg,{}),e[7]=o):o=e[7],e[8]!==n?(r=u.jsxs(KF,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{mp as C,ed as E,vn as P,GH as __tla,td as a,QS as e,Na as f,pp as u};
|