@marimo-team/frontend 0.9.26-dev2 → 0.9.26-dev3
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-ByRcN8hn.js → ConnectedDataExplorerComponent-DpCwGZnb.js} +3 -3
- package/dist/assets/{VegaLite-DTYf9-qU.js → VegaLite-DHctWB8g.js} +1 -1
- package/dist/assets/{_baseEach-DkFBMH6G.js → _baseEach-BA5TokeH.js} +1 -1
- package/dist/assets/_baseMap-D5LoP0WE.js +1 -0
- package/dist/assets/{_baseUniq-wgKcmAB-.js → _baseUniq-CLBLmENk.js} +1 -1
- package/dist/assets/{any-language-editor-Dj3altQF.js → any-language-editor-KEFhZBeA.js} +1 -1
- package/dist/assets/{architectureDiagram-IFBEXTG3-D1wXN50i.js → architectureDiagram-IFBEXTG3-DXxkGaEJ.js} +1 -1
- package/dist/assets/{blockDiagram-TCMKQVZ6-DGAZ0uwI.js → blockDiagram-TCMKQVZ6-DFgHdKNQ.js} +1 -1
- package/dist/assets/{c4Diagram-ZCSEYPFN-DN48-xmu.js → c4Diagram-ZCSEYPFN-CRnw6W3_.js} +1 -1
- package/dist/assets/channel-CBHEg9zZ.js +1 -0
- package/dist/assets/{chunk-4LC2V6XN-BfVm0Jz9.js → chunk-4LC2V6XN-Dz31r9Ev.js} +1 -1
- package/dist/assets/{chunk-5RIWM3LS-yW6e0SlL.js → chunk-5RIWM3LS-DMcndX08.js} +1 -1
- package/dist/assets/{chunk-6JKP7OK7-Dwjprrl-.js → chunk-6JKP7OK7-BOk6HK-j.js} +1 -1
- package/dist/assets/{chunk-NGC4727B-DEgi_c7j.js → chunk-NGC4727B-DG8mxRFR.js} +1 -1
- package/dist/assets/{chunk-REEJFE46-CTvICcQR.js → chunk-REEJFE46-Ccu6YFO3.js} +1 -1
- package/dist/assets/{chunk-RYO7GUH3-DjO4ZxFm.js → chunk-RYO7GUH3-2KMQqnbY.js} +1 -1
- package/dist/assets/{chunk-V35ELUW5-kIf_-vkg.js → chunk-V35ELUW5-BLoLA7up.js} +1 -1
- package/dist/assets/{classDiagram-Q73GJZWF-DY5sIeIU.js → classDiagram-Q73GJZWF-Ci1er14E.js} +1 -1
- package/dist/assets/{classDiagram-v2-C6QPLPW4-BkMMxkQ3.js → classDiagram-v2-C6QPLPW4-Cp-M3Py-.js} +1 -1
- package/dist/assets/clone-J5PoiK0v.js +1 -0
- package/dist/assets/{dagre-7KT5K2WU-BKKEvCYD.js → dagre-7KT5K2WU-v2L1xGda.js} +1 -1
- package/dist/assets/{data-editor-Czp4wpPO.js → data-editor-C-npVi-4.js} +1 -1
- package/dist/assets/{diagram-AVGMFHF7-gsj6CxbA.js → diagram-AVGMFHF7-B46FqhPv.js} +1 -1
- package/dist/assets/{edit-page-Bs8VtrwQ.js → edit-page-Bg2HOODu.js} +4 -4
- package/dist/assets/{erDiagram-DKC2X5TE-SVZpEOQu.js → erDiagram-DKC2X5TE-BpW935uz.js} +1 -1
- package/dist/assets/{flowDiagram-NWEUNK3L-BurqG83R.js → flowDiagram-NWEUNK3L-BZT3LszP.js} +1 -1
- package/dist/assets/{ganttDiagram-HLVPPPRE-DsFrWkib.js → ganttDiagram-HLVPPPRE-CYwaXR-v.js} +1 -1
- package/dist/assets/{gitGraph-YCYPL57B-S6rXbXmA.js → gitGraph-YCYPL57B-NsW_2a8Y.js} +1 -1
- package/dist/assets/{gitGraphDiagram-JPZ3KUXI-BwZeIkQr.js → gitGraphDiagram-JPZ3KUXI-BAO_eNgs.js} +1 -1
- package/dist/assets/{graph-D2CsR2qE.js → graph-sB3NrlXF.js} +1 -1
- package/dist/assets/{home-page-8L26Bvva.js → home-page-GazYKcJ0.js} +2 -2
- package/dist/assets/{index-D-IbRBwu.js → index--WXSEDvE.js} +1 -1
- package/dist/assets/{index-DC9aiuOH.js → index-B3yZFukN.js} +1 -1
- package/dist/assets/{index-BqiUjQxr.js → index-BU6FTfQ1.js} +1 -1
- package/dist/assets/{index-BTv3h9oi.js → index-CJkg_QOp.js} +1 -1
- package/dist/assets/{index--9hMfZCj.js → index-CaP9TKs5.js} +1 -1
- package/dist/assets/{index-BW5DXhLK.js → index-CfznlpKx.js} +1 -1
- package/dist/assets/{index-CXI7HbVY.js → index-Cg9ndfQN.js} +1 -1
- package/dist/assets/{index-BG58Oqzc.js → index-Cjr6ZBgw.js} +1 -1
- package/dist/assets/{index-BXjgZPQF.js → index-Cuskp2Nz.js} +1 -1
- package/dist/assets/{index-CF3UZl46.js → index-D5p7-QDx.js} +1 -1
- package/dist/assets/{index-BU_LCaO8.js → index-DAQtKVpm.js} +1 -1
- package/dist/assets/{index-B-uy4kZK.js → index-DIn66g6k.js} +1 -1
- package/dist/assets/{index-CY_tVZUZ.js → index-DVkxN62p.js} +1 -1
- package/dist/assets/{index-Dnh53x5a.js → index-DeYX8Sho.js} +6 -6
- package/dist/assets/{index-5FiejPOb.js → index-F_iIDumR.js} +1 -1
- package/dist/assets/{index-BDGT3PhF.js → index-LSqVAppn.js} +1 -1
- package/dist/assets/{index-BsInXnWu.js → index-pkoPtURg.js} +1 -1
- package/dist/assets/{infoDiagram-RZZSJVI2-aj2VZ7HV.js → infoDiagram-RZZSJVI2-DLsmb87X.js} +1 -1
- package/dist/assets/{journeyDiagram-BLD6N6MZ-BbFaFLXv.js → journeyDiagram-BLD6N6MZ-C_rQj3NS.js} +1 -1
- package/dist/assets/{json-DDD1nWXK.js → json-BUz08a_7.js} +1 -1
- package/dist/assets/{layout-BYQh9U9h.js → layout-Gn28sCUn.js} +1 -1
- package/dist/assets/{linear-D5TACywe.js → linear-DYvM-GXe.js} +1 -1
- package/dist/assets/{mermaid-eUja6FUZ.js → mermaid-B7kbgG0A.js} +3 -3
- package/dist/assets/{min-DWbU79HU.js → min-Ctg7TPls.js} +1 -1
- package/dist/assets/{mindmap-definition-OEB2RXX2-BUEuoOhY.js → mindmap-definition-OEB2RXX2-SalXN6lJ.js} +1 -1
- package/dist/assets/{pieDiagram-X7YZ5ZEZ-P6ibo1uP.js → pieDiagram-X7YZ5ZEZ-DeSc8cFl.js} +1 -1
- package/dist/assets/{quadrantDiagram-F36EZAVT-ZGKqoBTu.js → quadrantDiagram-F36EZAVT-D_kg7e9L.js} +1 -1
- package/dist/assets/{react-plotly-BDPnB2kR.js → react-plotly-DPLvCUaE.js} +1 -1
- package/dist/assets/{requirementDiagram-JG2LMPGF-BvITHFsw.js → requirementDiagram-JG2LMPGF-h_PqVyPE.js} +1 -1
- package/dist/assets/{run-page-e2Xpsmm7.js → run-page-CoNUxRpj.js} +1 -1
- package/dist/assets/{sankeyDiagram-ATFNWWW6-jZvhr82T.js → sankeyDiagram-ATFNWWW6-DmFq6lYM.js} +1 -1
- package/dist/assets/{sequenceDiagram-WK7YDQ3N-B1Yh1BBT.js → sequenceDiagram-WK7YDQ3N-D8fjiBwM.js} +1 -1
- package/dist/assets/{slides-component-g6bddeCC.js → slides-component-BFllfXMk.js} +1 -1
- package/dist/assets/{sortBy-B_Ofj-Jm.js → sortBy--C1QRN5d.js} +1 -1
- package/dist/assets/{stateDiagram-4JV6CC6H-DoK_aXs5.js → stateDiagram-4JV6CC6H-COPgV3En.js} +1 -1
- package/dist/assets/stateDiagram-v2-7KT6RKTD-BkZAm5s3.js +1 -0
- package/dist/assets/terminal-D98esyXa.js +1 -0
- package/dist/assets/{time-CGfshExe.js → time-By-fz8D3.js} +1 -1
- package/dist/assets/{timeline-definition-3ZMEY6HS-beva68Dj.js → timeline-definition-3ZMEY6HS-BfwYccqk.js} +1 -1
- package/dist/assets/{transform-DNg_607D.js → transform-l3cAeImL.js} +1 -1
- package/dist/assets/tree-CgZHB2cO.js +13 -0
- package/dist/assets/{useMarimoWebSocket-BdgAZSAv.js → useMarimoWebSocket-CtoY9d6J.js} +4 -4
- package/dist/assets/{vega-component-0uyg4fRd.js → vega-component-fmWKhRux.js} +1 -1
- package/dist/assets/{xychartDiagram-KECQ2H5Q-DthO9wU4.js → xychartDiagram-KECQ2H5Q-D5wsmVEM.js} +1 -1
- package/dist/index.html +1 -2
- package/package.json +1 -1
- package/dist/assets/_baseMap-B_-xysie.js +0 -1
- package/dist/assets/channel-BhQe-xN1.js +0 -1
- package/dist/assets/clone-BQki3cZ-.js +0 -1
- package/dist/assets/stateDiagram-v2-7KT6RKTD-B0MIySjV.js +0 -1
- package/dist/assets/terminal-BYpKKYsN.js +0 -1
- package/dist/assets/tree-TOCl7D2I.js +0 -13
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-
|
|
2
|
-
var e,t=Object.defineProperty,n=(e,n,o)=>((e,n,o)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o)(e,"symbol"!=typeof n?n+"":n,o);import{
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-DVkxN62p.js","./VegaLite-DHctWB8g.js","./index-DeYX8Sho.js","./index-CwO3Nrt7.css","./time-By-fz8D3.js","./timer-CK-RIWfW.js","./linear-DYvM-GXe.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./zoom-COrs4lFh.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./arc-lt4NHaVr.js","./step-CNn2V7Th.js","./index-F_iIDumR.js","./terminal-D98esyXa.js","./terminal-DMtZkNnb.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var e,t=Object.defineProperty,n=(e,n,o)=>((e,n,o)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o)(e,"symbol"!=typeof n?n+"":n,o);import{b0 as o,G as r,fp as a,fq as s,fr as i,fs as l,ft as c,fu as d,R as u,fv as h,fw as m,fx as f,fy as p,fz as g,fA as v,fB as x,fC as y,D as b,by as w,K as k,fD as N,at as C,W as E,a2 as S,Z as j,_,fE as I,X as A,e7 as M,fF as T,cU as O,dl as D,ei as R,ej as P,ek as F,em as L,eg as z,eh as B,el as U,fG as V,fH as G,dp as $,dt as H,al as W,F as q,fI as Y,eD as X,fJ as K,ar as J,dX as Z,cd as Q,fK as ee,dr as te,fL as ne,fM as oe,a0 as re,fN as ae,dv as se,fO as ie,H as le,b9 as ce,fP as de,fQ as ue,fR as he,di as me,fS as fe,dm as pe,fT as ge,fU as ve,fV as xe,cT as ye,fW as be,fX as we,bA as ke,fY as Ne,fZ as Ce,bb as Ee,f_ as Se,f$ as je,g0 as _e,Y as Ie,bq as Ae,g1 as Me,a6 as Te,dj as Oe,ff as De,eQ as Re,fi as Pe,b6 as Fe,eR as Le,as as ze,g2 as Be,g3 as Ue,g4 as Ve,eS as Ge,g5 as $e,g6 as He,eW as We,g7 as qe,g8 as Ye,g9 as Xe,ga as Ke,d8 as Je,gb as Ze,bo as Qe,$ as et,ap as tt,a1 as nt,bE as ot,gc as rt,dW as at,gd as st,c_ as it,dq as lt,eo as ct,bz as dt,ge as ut,de as ht,gf as mt,gg as ft,bu as pt,gh as gt,gi as vt,gj as xt,gk as yt,gl as bt,gm as wt,T as kt,a3 as Nt,gn as Ct,d9 as Et,bB as St,eV as jt,cV as _t,go as It,fj as At,gp as Mt,bj as Tt,bC as Ot,gq as Dt,gr as Rt,gs as Pt,gt as Ft,dn as Lt,be as zt,bf as Bt,gu as Ut,dL as Vt,d6 as Gt,gv as $t,eC as Ht,k as Wt,j as qt,gw as Yt,gx as Xt,gy as Kt,ey as Jt,gz as Zt,gA as Qt,cZ as en,gB as tn,gC as nn,a7 as on,b1 as rn,aj as an,ba as sn,gD as ln,bt as cn,gE as dn,fm as un,fl as hn,gF as mn,eG as fn,gG as pn,gH as gn,eN as vn,gI as xn,ex as yn,gJ as bn,gK as wn,gL as kn,gM as Nn,gN as Cn,gO as En,m as Sn,gP as jn,gQ as _n,gR as In,t as An,gS as Mn,gT as Tn,gU as On,gV as Dn,gW as Rn,gX as Pn,gY as Fn,gZ as Ln,g_ as zn,g$ as Bn,h0 as Un,h1 as Vn,h2 as Gn,h3 as $n,h4 as Hn,h5 as Wn,h6 as qn,h7 as Yn,h8 as Xn,h9 as Kn,ha as Jn,hb as Zn,hc as Qn,hd as eo,he as to,hf as no,hg as oo,hh as ro,hi as ao,hj as so,hk as io,hl as lo,hm as co,hn as uo,ho,fn as mo,hp as fo,hq as po,hr as go,hs as vo,ht as xo,hu as yo,hv as bo,hw as wo,hx as ko,hy as No,hz as Co,hA as Eo,hB as So,hC as jo,dx as _o,hD as Io,hE as Ao,dA as Mo,hF as To,hG as Oo,hH as Do,hI as Ro,hJ as Po,hK as Fo,hL as Lo,a8 as zo,df as Bo,hM as Uo,dE as Vo,hN as Go,hO as $o,hP as Ho,hQ as Wo,hR as qo,hS as Yo,hT as Xo,hU as Ko,hV as Jo,hW as Zo,a4 as Qo,hX as er,hY as tr,dU as nr,hZ as or,h_ as rr,h$ as ar,i0 as sr,i1 as ir,i2 as lr,i3 as cr,i4 as dr,i5 as ur,i6 as hr,i7 as mr,i8 as fr,i9 as pr,ia as gr,ib as vr,fk as xr,ic as yr,id as br,ie as wr,bn as kr,eL as Nr,ig as Cr,ih as Er,ii as Sr,ij as jr,ik as _r,il as Ir,im as Ar,eA as Mr,io as Tr,bi as Or,ip as Dr,bT as Rr,b2 as Pr,ah as Fr,dV as Lr,iq as zr,cR as Br,b7 as Ur,ir as Vr,dO as Gr,bY as $r,is as Hr,bp as Wr,it as qr,iu as Yr,iv as Xr,iw as Kr,ix as Jr,iy as Zr,iz as Qr,iA as ea,iB as ta,br as na,bc as oa,iC as ra,iD as aa,dd as sa,iE as ia,iF as la,iG as ca,iH as da,iI as ua,cW as ha,es as ma,dh as fa,iJ as pa,bm as ga,iK as va,e9 as xa,eZ as ya,e_ as ba,e$ as wa,f3 as ka,f1 as Na,f4 as Ca,f6 as Ea,f9 as Sa,fc as ja,f7 as _a,iL as Ia,iM as Aa,dM as Ma,iN as Ta,e5 as Oa,iO as Da,fa as Ra,iP as Pa,iQ as Fa,iR as La,iS as za,J as Ba,ds as Ua,iT as Va,iU as Ga,iV as $a,M as Ha,iW as Wa,iX as qa,O as Ya,iY as Xa,dk as Ka,iZ as Ja,i_ as Za,P as Qa,i$ as es,ew as ts,b8 as ns,j0 as os,j1 as rs,j2 as as,fb as ss,j3 as is,dT as ls,j4 as cs,j5 as ds,dc as us,j6 as hs,j7 as ms,j8 as fs,j9 as ps,er as gs,ja as vs,jb as xs,dw as ys,jc as bs,jd as ws,je as ks,jf as Ns,jg as Cs,jh as Es,ji as Ss,jj as js,jk as _s,jl as Is,jm as As,jn as Ms,jo as Ts,jp as Os,jq as Ds,d1 as Rs,jr as Ps,js as Fs,jt as Ls,ju as zs,jv as Bs,aq as Us,bv as Vs,jw as Gs,jx as $s,jy as Hs,jz as Ws,jA as qs,jB as Ys,jC as Xs,jD as Ks,jE as Js,jF as Zs,jG as Qs,jH as ei,jI as ti,eF as ni,jJ as oi,jK as ri,jL as ai,jM as si,jN as ii,e4 as li,cM as ci,jO as di,b5 as ui,jP as hi,jQ as mi,jR as fi,au as pi,jS as gi,jT as vi,jU as xi}from"./index-DeYX8Sho.js";import{a as yi,B as bi,G as wi,g as ki,M as Ni,b as Ci,c as Ei,d as Si,s as ji,k as _i,C as Ii,S as Ai,K as Mi,e as Ti,f as Oi,i as Di,h as Ri,j as Pi,L as Fi,l as Li,m as zi,n as Bi,u as Ui,o as Vi,p as Gi,q as $i,P as Hi,r as Wi,t as qi,T as Yi}from"./tree-CgZHB2cO.js";import{b as Xi,c as Ki,L as Ji,I as Zi,N as Qi,V as el,d as tl,W as nl,F as ol,e as rl,M as al,E as sl,f as il,g as ll,h as cl,i as dl,j as ul,k as hl,l as ml,m as fl,n as pl,o as gl,u as vl,C as xl,R as yl,p as bl,a as wl,A as kl,q as Nl,r as Cl,O as El,T as Sl}from"./useMarimoWebSocket-CtoY9d6J.js";import{s as jl,i as _l,T as Il,c as Al}from"./transform-l3cAeImL.js";import{g as Ml}from"./timer-CK-RIWfW.js";import{i as Tl}from"./zoom-COrs4lFh.js";import{s as Ol}from"./sortBy--C1QRN5d.js";import"./main-cdvIQCIX.js";import"./index-F_iIDumR.js";import"./_baseEach-BA5TokeH.js";import"./_baseMap-D5LoP0WE.js";
|
|
3
3
|
/**
|
|
4
4
|
* @license lucide-react v0.428.0 - ISC
|
|
5
5
|
*
|
|
6
6
|
* This source code is licensed under the ISC license.
|
|
7
7
|
* See the LICENSE file in the root directory of this source tree.
|
|
8
|
-
*/const Dl=o("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),Pl=o("ArrowRightFromLine",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M21 12H7",key:"13ipq5"}],["path",{d:"m15 18 6-6-6-6",key:"6tx3qv"}]]),Rl=o("ArrowRightToLine",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]),Fl=o("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),Ll=o("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),zl=o("BetweenHorizontalStart",[["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"}]]),Bl=o("BookMarked",[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]),Ul=o("Box",[["path",{d:"M21 8a2 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 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]),Vl=o("ChevronsDown",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),Gl=o("ChevronsUp",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),$l=o("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Hl=o("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Wl=o("ClipboardCopy",[["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"}]]),ql=o("ClipboardPaste",[["path",{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",key:"1pp7kr"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10",key:"2ik1ml"}],["path",{d:"m17 10 4 4-4 4",key:"vp2hj1"}]]),Yl=o("CloudDownload",[["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"}]]),Xl=o("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]),Kl=o("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"}]]),Jl=o("CopyMinus",[["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"}]]),Zl=o("EllipsisVertical",[["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"}]]),Ql=o("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"}]]),ec=o("FilePen",[["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"}]]),tc=o("FilePlus2",[["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"}]]),nc=o("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"}]]),oc=o("FolderPlus",[["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"}]]),rc=o("FolderTree",[["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"}]]),ac=o("GripVertical",[["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"}]]),sc=o("HardDriveDownload",[["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"}]]),ic=o("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"}]]),lc=o("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"}]]),cc=o("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"}]]),dc=o("LayoutTemplate",[["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"}]]),uc=o("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),hc=o("List",[["line",{x1:"8",x2:"21",y1:"6",y2:"6",key:"7ey8pc"}],["line",{x1:"8",x2:"21",y1:"12",y2:"12",key:"rjfblc"}],["line",{x1:"8",x2:"21",y1:"18",y2:"18",key:"c3b1m8"}],["line",{x1:"3",x2:"3.01",y1:"6",y2:"6",key:"1g7gq3"}],["line",{x1:"3",x2:"3.01",y1:"12",y2:"12",key:"1pjlvk"}],["line",{x1:"3",x2:"3.01",y1:"18",y2:"18",key:"28t2mc"}]]),mc=o("MapPin",[["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"}]]),fc=o("MemoryStick",[["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"}]]),pc=o("MessageCircleQuestion",[["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"}]]),gc=o("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"}]]),vc=o("NotebookPen",[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.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:"pqwjuv"}]]),xc=o("OctagonAlert",[["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"}]]),yc=o("PackageCheck",[["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"}]]),bc=o("PackageX",[["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"}]]),wc=o("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),kc=o("PartyPopper",[["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"}]]),Nc=o("PenLine",[["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"}]]),Cc=o("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),Ec=o("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"}]]),Sc=o("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"}]]),jc=o("RotateCcw",[["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"}]]),_c=o("Rows3",[["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"}]]),Ic=o("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"}]]),Ac=o("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"}]]),Mc=o("ScrollText",[["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"}]]),Tc=o("Share2",[["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"}]]),Oc=o("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]),Dc=o("SquareCode",[["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"}]]),Pc=o("SquareDashedBottomCode",[["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"}]]),Rc=o("SquareEqual",[["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"}]]),Fc=o("SquareM",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),Lc=o("SquarePlay",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 8 6 4-6 4Z",key:"f1r3lt"}]]),zc=o("SquarePlus",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Bc=o("SquarePower",[["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"}]]),Uc=o("SquareTerminal",[["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"}]]),Vc=o("TextCursorInput",[["path",{d:"M5 4h1a3 3 0 0 1 3 3 3 3 0 0 1 3-3h1",key:"18xjzo"}],["path",{d:"M13 20h-1a3 3 0 0 1-3-3 3 3 0 0 1-3 3H5",key:"fj48gi"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M9 7v10",key:"1vc8ob"}]]),Gc=o("TextSearch",[["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"}]]),$c=o("Undo2",[["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"}]]),Hc=o("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"}]]),Wc=o("WholeWord",[["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"}]]),qc=o("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"}]]),Yc=o("ZapOff",[["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"}]]),Xc=o("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"}]]);
|
|
8
|
+
*/const Dl=o("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),Rl=o("ArrowRightFromLine",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M21 12H7",key:"13ipq5"}],["path",{d:"m15 18 6-6-6-6",key:"6tx3qv"}]]),Pl=o("ArrowRightToLine",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]),Fl=o("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),Ll=o("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),zl=o("BetweenHorizontalStart",[["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"}]]),Bl=o("BookMarked",[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]),Ul=o("Box",[["path",{d:"M21 8a2 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 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]),Vl=o("ChevronsDown",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),Gl=o("ChevronsUp",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),$l=o("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Hl=o("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Wl=o("ClipboardCopy",[["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"}]]),ql=o("ClipboardPaste",[["path",{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",key:"1pp7kr"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10",key:"2ik1ml"}],["path",{d:"m17 10 4 4-4 4",key:"vp2hj1"}]]),Yl=o("CloudDownload",[["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"}]]),Xl=o("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]),Kl=o("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"}]]),Jl=o("CopyMinus",[["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"}]]),Zl=o("EllipsisVertical",[["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"}]]),Ql=o("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"}]]),ec=o("FilePen",[["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"}]]),tc=o("FilePlus2",[["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"}]]),nc=o("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"}]]),oc=o("FolderPlus",[["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"}]]),rc=o("FolderTree",[["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"}]]),ac=o("GripVertical",[["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"}]]),sc=o("HardDriveDownload",[["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"}]]),ic=o("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"}]]),lc=o("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"}]]),cc=o("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"}]]),dc=o("LayoutTemplate",[["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"}]]),uc=o("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),hc=o("List",[["line",{x1:"8",x2:"21",y1:"6",y2:"6",key:"7ey8pc"}],["line",{x1:"8",x2:"21",y1:"12",y2:"12",key:"rjfblc"}],["line",{x1:"8",x2:"21",y1:"18",y2:"18",key:"c3b1m8"}],["line",{x1:"3",x2:"3.01",y1:"6",y2:"6",key:"1g7gq3"}],["line",{x1:"3",x2:"3.01",y1:"12",y2:"12",key:"1pjlvk"}],["line",{x1:"3",x2:"3.01",y1:"18",y2:"18",key:"28t2mc"}]]),mc=o("MapPin",[["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"}]]),fc=o("MemoryStick",[["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"}]]),pc=o("MessageCircleQuestion",[["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"}]]),gc=o("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"}]]),vc=o("NotebookPen",[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.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:"pqwjuv"}]]),xc=o("OctagonAlert",[["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"}]]),yc=o("PackageCheck",[["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"}]]),bc=o("PackageX",[["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"}]]),wc=o("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),kc=o("PartyPopper",[["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"}]]),Nc=o("PenLine",[["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"}]]),Cc=o("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),Ec=o("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"}]]),Sc=o("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"}]]),jc=o("RotateCcw",[["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"}]]),_c=o("Rows3",[["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"}]]),Ic=o("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"}]]),Ac=o("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"}]]),Mc=o("ScrollText",[["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"}]]),Tc=o("Share2",[["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"}]]),Oc=o("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]),Dc=o("SquareCode",[["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"}]]),Rc=o("SquareDashedBottomCode",[["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"}]]),Pc=o("SquareEqual",[["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"}]]),Fc=o("SquareM",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),Lc=o("SquarePlay",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 8 6 4-6 4Z",key:"f1r3lt"}]]),zc=o("SquarePlus",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Bc=o("SquarePower",[["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"}]]),Uc=o("SquareTerminal",[["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"}]]),Vc=o("TextCursorInput",[["path",{d:"M5 4h1a3 3 0 0 1 3 3 3 3 0 0 1 3-3h1",key:"18xjzo"}],["path",{d:"M13 20h-1a3 3 0 0 1-3-3 3 3 0 0 1-3 3H5",key:"fj48gi"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M9 7v10",key:"1vc8ob"}]]),Gc=o("TextSearch",[["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"}]]),$c=o("Undo2",[["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"}]]),Hc=o("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"}]]),Wc=o("WholeWord",[["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"}]]),qc=o("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"}]]),Yc=o("ZapOff",[["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"}]]),Xc=o("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"}]]);
|
|
9
9
|
/**
|
|
10
10
|
* @license lucide-react v0.428.0 - ISC
|
|
11
11
|
*
|
|
12
12
|
* This source code is licensed under the ISC license.
|
|
13
13
|
* See the LICENSE file in the root directory of this source tree.
|
|
14
|
-
*/const Kc=r.createContext({});function Jc(e,t){[e,t]=l(e,t,Kc);let{toolbarProps:n}=function(e,t){const{"aria-label":n,"aria-labelledby":o,orientation:l="horizontal"}=e;let[c,d]=r.useState(!1);a((()=>{var e;d(!(!t.current||!(null===(e=t.current.parentElement)||void 0===e?void 0:e.closest('[role="toolbar"]'))))}));const{direction:u}=s(),h="rtl"===u&&"horizontal"===l;let m=i(t);const f=r.useRef(null);return{toolbarProps:{role:c?"group":"toolbar","aria-orientation":l,"aria-label":n,"aria-labelledby":null==n?o:void 0,onKeyDownCapture:c?void 0:e=>{if(e.currentTarget.contains(e.target)){if("horizontal"===l&&"ArrowRight"===e.key||"vertical"===l&&"ArrowDown"===e.key)h?m.focusPrevious():m.focusNext();else{if(!("horizontal"===l&&"ArrowLeft"===e.key||"vertical"===l&&"ArrowUp"===e.key))return"Tab"===e.key?(e.stopPropagation(),f.current=document.activeElement,void(e.shiftKey?m.focusFirst():m.focusLast())):void 0;h?m.focusNext():m.focusPrevious()}e.stopPropagation(),e.preventDefault()}},onFocusCapture:c?void 0:e=>{var n,o;f.current&&!e.currentTarget.contains(e.relatedTarget)&&(null===(n=t.current)||void 0===n?void 0:n.contains(e.target))&&(null===(o=f.current)||void 0===o||o.focus(),f.current=null)},onBlurCapture:c?void 0:e=>{e.currentTarget.contains(e.relatedTarget)||f.current||(f.current=e.target)}}}}(e,t),o=c({...e,values:{orientation:e.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),m=d(e);return delete m.id,u.createElement("div",{...h(n,m),...o,ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||"horizontal"},o.children)}const Zc=r.forwardRef(Jc);function Qc(e,t){const n=m(e),o=m(t),r=n.getTime()-o.getTime();return r<0?-1:r>0?1:r}function ed(e){const t=m(e);return+function(e){const t=m(e);return t.setHours(23,59,59,999),t}(t)==+function(e){const t=m(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}(t)}function td(e,t){const n=m(e),o=m(t),r=Qc(n,o),a=Math.abs(function(e,t){const n=m(e),o=m(t);return 12*(n.getFullYear()-o.getFullYear())+(n.getMonth()-o.getMonth())}(n,o));let s;if(a<1)s=0;else{1===n.getMonth()&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-r*a);let t=Qc(n,o)===-r;ed(m(e))&&1===a&&1===Qc(e,o)&&(t=!1),s=r*(a-Number(t))}return 0===s?0:s}function nd(e,t,n){const o=function(e,t){return+m(e)-+m(t)}(e,t)/1e3;return(r=null==n?void 0:n.roundingMethod,e=>{const t=(r?Math[r]:Math.trunc)(e);return 0===t?0:t})(o);var r}function od(e,t){return function(e,t,n){const o=y(),r=(null==n?void 0:n.locale)??o.locale??p,a=Qc(e,t);if(isNaN(a))throw new RangeError("Invalid time value");const s=Object.assign({},n,{addSuffix:null==n?void 0:n.addSuffix,comparison:a});let i,l;a>0?(i=m(t),l=m(e)):(i=m(e),l=m(t));const c=nd(l,i),d=(g(l)-g(i))/1e3,u=Math.round((c-d)/60);let h;if(u<2)return(null==n?void 0:n.includeSeconds)?c<5?r.formatDistance("lessThanXSeconds",5,s):c<10?r.formatDistance("lessThanXSeconds",10,s):c<20?r.formatDistance("lessThanXSeconds",20,s):c<40?r.formatDistance("halfAMinute",0,s):c<60?r.formatDistance("lessThanXMinutes",1,s):r.formatDistance("xMinutes",1,s):0===u?r.formatDistance("lessThanXMinutes",1,s):r.formatDistance("xMinutes",u,s);if(u<45)return r.formatDistance("xMinutes",u,s);if(u<90)return r.formatDistance("aboutXHours",1,s);if(u<v){const e=Math.round(u/60);return r.formatDistance("aboutXHours",e,s)}if(u<2520)return r.formatDistance("xDays",1,s);if(u<x){const e=Math.round(u/v);return r.formatDistance("xDays",e,s)}if(u<2*x)return h=Math.round(u/x),r.formatDistance("aboutXMonths",h,s);if(h=td(l,i),h<12){const e=Math.round(u/x);return r.formatDistance("xMonths",e,s)}{const e=h%12,t=Math.trunc(h/12);return e<3?r.formatDistance("aboutXYears",t,s):e<9?r.formatDistance("overXYears",t,s):r.formatDistance("almostXYears",t+1,s)}}(e,function(e){return f(e,Date.now())}(e),t)}const rd=e=>{const t=b(35);let n;t[0]!==e?(n=()=>{S(new Blob([e.getCellsAsJSON()],{type:"text/plain"}),`${e.proposedName}.json`)},t[0]=e,t[1]=n):n=t[1];const o=n;let r,a,s,i,l,c,d,u,h,m,f,p,g,v,x,y,w;return t[2]!==o||t[3]!==e?(r=t=>{t.preventDefault(),o(),e.closeModal()},t[2]=o,t[3]=e,t[4]=r):r=t[4],t[5]!==e?(a=t=>{"Escape"===t.key&&e.closeModal()},t[5]=e,t[6]=a):a=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(s=k.jsx(j,{className:"text-accent mb-6",children:"Download unsaved changes?"}),t[7]=s):s=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(i={wordBreak:"break-word"},l=k.jsx("p",{children:"This app has unsaved changes. To recover:"}),c={paddingBottom:"10px"},t[8]=i,t[9]=l,t[10]=c):(i=t[8],l=t[9],c=t[10]),t[11]!==e.proposedName?(d=k.jsxs("li",{style:c,children:['Click the "Download" button. This will download a file called ',k.jsxs("code",{children:[e.proposedName,".json"]}),". This file contains your code."]}),t[11]=e.proposedName,t[12]=d):d=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(u={paddingBottom:"10px"},t[13]=u):u=t[13],t[14]===Symbol.for("react.memo_cache_sentinel")?(h={display:"block",padding:"10px"},t[14]=h):h=t[14],t[15]!==e.proposedName?(m=k.jsxs("code",{style:h,children:["marimo recover ",e.proposedName,".json ",">"," ",e.proposedName,".py"]}),t[15]=e.proposedName,t[16]=m):m=t[16],t[17]!==e.proposedName?(f=k.jsxs("code",{children:[e.proposedName,".py"]}),t[17]=e.proposedName,t[18]=f):f=t[18],t[19]!==m||t[20]!==f?(p=k.jsxs("li",{style:u,children:["In your terminal, type",m,"to overwrite ",f," with the recovered changes."]}),t[19]=m,t[20]=f,t[21]=p):p=t[21],t[22]!==d||t[23]!==p?(g=k.jsxs(_,{className:"markdown break-words",style:i,children:[l,k.jsxs("ol",{children:[d,p]})]}),t[22]=d,t[23]=p,t[24]=g):g=t[24],t[25]!==e.closeModal?(v=k.jsx(E,{"aria-label":"Cancel",variant:"secondary","data-testid":"cancel-recovery-button",onClick:e.closeModal,children:"Cancel"}),t[25]=e.closeModal,t[26]=v):v=t[26],t[27]===Symbol.for("react.memo_cache_sentinel")?(x=k.jsx(E,{"data-testid":"download-recovery-button","aria-label":"Download",variant:"default",type:"submit",children:"Download"}),t[27]=x):x=t[27],t[28]!==v?(y=k.jsxs(I,{children:[v,x]}),t[28]=v,t[29]=y):y=t[29],t[30]!==r||t[31]!==a||t[32]!==g||t[33]!==y?(w=k.jsx(A,{className:"w-fit",children:k.jsxs("form",{onSubmit:r,onKeyDown:a,children:[s,g,y]})}),t[30]=r,t[31]=a,t[32]=g,t[33]=y,t[34]=w):w=t[34],w},ad=e=>{const t=b(13),{filename:n,needsSave:o,getCellsAsJSON:r}=e,{openModal:a,closeModal:s}=w();let i;t[0]!==n?(i=null===n?"app":n.slice(0,-3),t[0]=n,t[1]=i):i=t[1];const l=i;let c;t[2]!==o||t[3]!==a||t[4]!==r||t[5]!==l||t[6]!==s?(c=()=>{o&&a(k.jsx(rd,{getCellsAsJSON:r,proposedName:l,closeModal:s}))},t[2]=o,t[3]=a,t[4]=r,t[5]=l,t[6]=s,t[7]=c):c=t[7];const d=c;let u;yi("global.save",d),t[8]===Symbol.for("react.memo_cache_sentinel")?(u=N("global.save"),t[8]=u):u=t[8];const h=o?"yellow":"gray";let m,f;return t[9]===Symbol.for("react.memo_cache_sentinel")?(m=k.jsx(Ic,{strokeWidth:1.5,size:18}),t[9]=m):m=t[9],t[10]!==d||t[11]!==h?(f=k.jsx(C,{content:u,children:k.jsx(bi,{onClick:d,id:"save-button","aria-label":"Save",className:"rectangle",color:h,children:m})}),t[10]=d,t[11]=h,t[12]=f):f=t[12],f},sd=()=>{const e=b(7),{selectedLayout:t}=Xi(),{setLayoutView:n}=Ki();if(D()&&!ki("wasm_layouts"))return null;let o,r,a,s;return e[0]!==n?(o=e=>n(e),e[0]=n,e[1]=o):o=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(r=k.jsx(z,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:k.jsx(B,{placeholder:"Select a view"})}),e[2]=r):r=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(a=k.jsx(P,{children:k.jsxs(R,{children:[k.jsx(F,{children:"View as"}),Ji.map(dd)]})}),e[3]=a):a=e[3],e[4]!==t||e[5]!==o?(s=k.jsxs(U,{"data-testid":"layout-select",value:t,onValueChange:o,children:[r,a]}),e[4]=t,e[5]=o,e[6]=s):s=e[6],s};function id(e){const t=ld(e);return k.jsx(t,{className:"h-4 w-4"})}function ld(e){switch(e){case"vertical":return hc;case"grid":return wi;case"slides":return Ec;default:return M(e),T}}function cd(e){return O(e)}function dd(e){return k.jsx(L,{value:e,children:k.jsxs("div",{className:"flex items-center gap-1.5 leading-5",children:[id(e),k.jsx("span",{children:cd(e)})]})},e)}function ud(){const e=b(7);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0];const[n,o]=function(e,t){const n=b(10);let o;n[0]!==e||n[1]!==t?(o=new V(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const a=o;let s;n[3]!==a?(s=()=>a.get(),n[3]=a,n[4]=s):s=n[4];const[i,l]=r.useState(s);let c;n[5]!==a?(c=e=>{l(e),a.set(e)},n[5]=a,n[6]=c):c=n[6];const d=c;let u;return n[7]!==i||n[8]!==d?(u=[i,d],n[7]=i,n[8]=d,n[9]=u):u=n[9],u}("marimo:commands",t);let a,s;return e[1]!==n||e[2]!==o?(a=e=>{const t=(r=[e,...n],[...new Set(r)]);var r;o(t.slice(0,3))},e[1]=n,e[2]=o,e[3]=a):a=e[3],e[4]!==n||e[5]!==a?(s={recentCommands:n,addRecentCommand:a},e[4]=n,e[5]=a,e[6]=s):s=e[6],s}function hd(e){return void 0!==e.dropdown}function md(e,t=""){return e.flatMap((e=>e.label?hd(e)?md(e.dropdown,`${t+e.label} > `):{...e,label:t+e.label}:[]))}const fd=e=>{const t=b(8),{children:n,layerTop:o}=e,r=void 0!==o&&o;let a;t[0]!==n?(a=u.Children.toArray(n),t[0]=n,t[1]=a):a=t[1];const[s,i]=a,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let c,d;return t[2]!==l||t[3]!==i?(c=k.jsx("div",{className:l,children:i}),t[2]=l,t[3]=i,t[4]=c):c=t[4],t[5]!==s||t[6]!==c?(d=k.jsxs("div",{className:"multi-icon relative w-fit",children:[s,c]}),t[5]=s,t[6]=c,t[7]=d):d=t[7],d};function pd(){const e=b(3),t=H(),{prepareForRun:n}=q();let o;e[0]!==t||e[1]!==n?(o=async e=>{if(0===e.length)return;const{cellHandles:o,cellData:r}=t,a=[];for(const t of e){const e=o[t];e.current?(a.push(X(e.current.editorView)),e.current.registerRun()):(n({cellId:t}),a.push(r[t].code))}await K({cellIds:e,codes:a}).catch((e=>{J.error(e)}))},e[0]=t,e[1]=n,e[2]=o):o=e[2];return W(o)}const gd=Z(null),vd=Z(!1),xd=e=>{const t=b(7);let n,o;t[0]!==e.onClick?(n=t=>{var n;(t.ctrlKey||t.metaKey)&&"z"===t.key&&(t.preventDefault(),t.stopPropagation(),null==(n=e.onClick)||n.call(e,t))},t[0]=e.onClick,t[1]=n):n=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(o={capture:!0},t[2]=o):o=t[2],Q(window,"keydown",n,o);const r=e.children??"Undo";let a,s;return t[3]===Symbol.for("react.memo_cache_sentinel")?(a=k.jsx(ee,{className:"ml-2",shortcut:"cmd-z"}),t[3]=a):a=t[3],t[4]!==e||t[5]!==r?(s=k.jsxs(E,{"data-testid":"undo-button",size:"sm",variant:"outline",...e,children:[r," ",a]}),t[4]=e,t[5]=r,t[6]=s):s=t[6],s};function yd(){const e=b(3),{deleteCell:t,undoDeleteCell:n}=q();let o;return e[0]!==t||e[1]!==n?(o=e=>{if(te.get(ne))return;const{cellId:o}=e;t({cellId:o}),oe({cellId:o}).catch((()=>{n()}));const{dismiss:r}=re({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:k.jsx(xd,{"data-testid":"undo-delete-button",onClick:()=>{n(),a()}})}),a=r},e[0]=t,e[1]=n,e[2]=o):o=e[2],W(o)}function bd(e,t,n,o=te){if(t in o.get(ae))return!1;const{cellData:r,cellIds:a}=o.get(se),s=new RegExp(`import[ \t]+${e}[ \t]+as[ \t]+${t}`,"g");for(const i of a.inOrderIds)if(s.test(r[i].code))return!1;return n(`import ${e} as ${t}`),!0}function wd(e,t,n){return bd("marimo","mo",(o=>{const r=ie.create();t({cellId:n??"__end__",before:!1,code:o,lastCodeRun:e?o:void 0,newCellId:r,autoFocus:!1}),e&&K({cellIds:[r],codes:[o]})}))}function kd(e){const t=b(52),{cell:n}=e,{createNewCell:o,updateCellConfig:r,updateCellCode:a,updateCellName:s,moveCell:i,sendToTop:l,sendToBottom:c,addColumnBreakpoint:d,clearCellOutput:u}=q(),h=function(e){const t=b(3),n=pd();let o;return t[0]!==e||t[1]!==n?(o=()=>{void 0!==e&&n([e])},t[0]=e,t[1]=n,t[2]=o):o=t[2],W(o)}(null==n?void 0:n.cellId),m=!le(ne),f=yd(),{openModal:p}=w(),g=ce(gd),v=le(de),x=le(ue),y=he(),N=le(me),C=le(fe);if(!n||N){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0],e}const{cellId:E,config:S,getEditorView:_,name:I,hasOutput:M,status:T}=n;let O;t[1]!==y.inOrderIds||t[2]!==E?(O=y.inOrderIds.indexOf(E),t[1]=y.inOrderIds,t[2]=E,t[3]=O):O=t[3];const D=O;let P;t[4]!==S.disabled||t[5]!==E||t[6]!==r?(P=async()=>{const e={disabled:!S.disabled};await _e({configs:{[E]:e}}),r({cellId:E,config:e})},t[4]=S.disabled,t[5]=E,t[6]=r,t[7]=P):P=t[7];const R=P;let F;t[8]!==S.hide_code||t[9]!==E||t[10]!==r||t[11]!==_?(F=async()=>{const e={hide_code:!S.hide_code};await _e({configs:{[E]:e}}),r({cellId:E,config:e});const t=_();t&&(e.hide_code?t.contentDOM.blur():t.focus())},t[8]=S.hide_code,t[9]=E,t[10]=r,t[11]=_,t[12]=F):F=t[12];const L=F;let z,B;t[13]===Symbol.for("react.memo_cache_sentinel")?(z=k.jsx(Vc,{size:13,strokeWidth:1.5}),t[13]=z):z=t[13],t[14]!==p||t[15]!==D||t[16]!==I||t[17]!==s||t[18]!==E?(B=()=>{p(k.jsxs(A,{children:[k.jsx(Ie,{children:k.jsx(j,{children:"Rename cell"})}),k.jsxs("div",{className:"flex items-center justify-between",children:[k.jsx(Ae,{htmlFor:"cell-name",children:"Cell name"}),k.jsx(Qi,{placeholder:`cell_${D}`,value:I,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),p(null))},onChange:e=>s({cellId:E,name:e})})]})]}))},t[14]=p,t[15]=D,t[16]=I,t[17]=s,t[18]=E,t[19]=B):B=t[19];const U=`cell_${D}`;let V,H,Y;if(t[20]!==s||t[21]!==E?(V=e=>s({cellId:E,name:e}),t[20]=s,t[21]=E,t[22]=V):V=t[22],t[23]!==U||t[24]!==I||t[25]!==V?(H=k.jsx(Qi,{placeholder:U,value:I,onChange:V}),t[23]=U,t[24]=I,t[25]=V,t[26]=H):H=t[26],t[27]!==B||t[28]!==H||t[29]!==T||t[30]!==S.disabled||t[31]!==S.hide_code||t[32]!==h||t[33]!==v||t[34]!==g||t[35]!==E||t[36]!==M||t[37]!==_||t[38]!==a||t[39]!==L||t[40]!==R||t[41]!==u||t[42]!==x||t[43]!==o||t[44]!==i||t[45]!==l||t[46]!==c||t[47]!==C||t[48]!==d||t[49]!==m||t[50]!==f){Y=[[{icon:z,label:"Name",disableClick:!0,handle:Sd,handleHeadless:B,rightElement:H},{icon:k.jsx(Cc,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:"running"===T||"queued"===T||"disabled-transitively"===T||S.disabled,handle:()=>h()},{icon:k.jsx(Oc,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!v,handle:()=>{g((e=>(null==e?void 0:e.cellId)===E?null:{cellId:E}))},hotkey:"cell.aiCompletion"},{icon:k.jsx(Zi,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!M,handle:()=>function(e){const t=document.getElementById(G.create(e));t&&(t.classList.add("printing-output"),$(t,"result.png").finally((()=>{t.classList.remove("printing-output")})))}(E)},{icon:k.jsx(pe,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const e=_();e&&ge({[E]:e},a)}},{icon:S.hide_code?k.jsx(ve,{size:13,strokeWidth:1.5}):k.jsx(xe,{size:13,strokeWidth:1.5}),label:S.hide_code?"Show code":"Hide code",handle:L,hotkey:"cell.hideCode"},{icon:S.disabled?k.jsx(Yc,{size:13,strokeWidth:1.5}):k.jsx(Xc,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:k.jsx(ye,{"data-testid":"cell-disable-switch",checked:!S.disabled,size:"sm",onCheckedChange:R}),handle:R},{icon:k.jsx(be,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!M,handle:()=>{u({cellId:E})}}],[{icon:k.jsx(Ni,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const e=_();e&&(wd(x,o),we(e,"markdown",{keepCodeAsIs:!0}))}},{icon:k.jsx(ke,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const e=_();e&&(wd(x,o),we(e,"sql",{keepCodeAsIs:!0}))}},{icon:k.jsx(Ci,{}),label:"Toggle as Python",handle:()=>{const e=_();e&&(wd(x,o),Ne(e,"python",{force:!0}))}}],[{icon:k.jsxs(fd,{children:[k.jsx(Hl,{size:13,strokeWidth:1.5}),k.jsx(Ce,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:E,before:!0})},{icon:k.jsxs(fd,{children:[k.jsx(Hl,{size:13,strokeWidth:1.5}),k.jsx(Ee,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:E,before:!1})},{icon:k.jsx(Ce,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>i({cellId:E,before:!0})},{icon:k.jsx(Ee,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>i({cellId:E,before:!1})},{icon:k.jsx(Gl,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>l({cellId:E})},{icon:k.jsx(Vl,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>c({cellId:E})},{icon:k.jsx(Se,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:"columns"!==C,handle:()=>d({cellId:E})}],[{label:"Delete",hidden:!m,variant:"danger",icon:k.jsx(je,{size:13,strokeWidth:1.5}),handle:()=>{f({cellId:E})}}]].map(Cd).filter(Nd),t[27]=B,t[28]=H,t[29]=T,t[30]=S.disabled,t[31]=S.hide_code,t[32]=h,t[33]=v,t[34]=g,t[35]=E,t[36]=M,t[37]=_,t[38]=a,t[39]=L,t[40]=R,t[41]=u,t[42]=x,t[43]=o,t[44]=i,t[45]=l,t[46]=c,t[47]=C,t[48]=d,t[49]=m,t[50]=f,t[51]=Y}else Y=t[51];return Y}function Nd(e){return e.length>0}function Cd(e){return e.filter(Ed)}function Ed(e){return!e.hidden}function Sd(e){null==e||e.stopPropagation(),null==e||e.preventDefault()}const jd=Z(null);function _d(){return le(jd)}const Id=Z((e=>{const t=e(jd);return t?t===Me?null:Ad(t,e(se)):null}));function Ad(e,t){var n;const{cellData:o,cellHandles:r,cellRuntime:a}=t,s=o[e],i=a[e],l=null==(n=r[e])?void 0:n.current;if(!s||!l)return null;return{cellId:e,name:s.name,config:s.config,status:i?i.status:"idle",getEditorView:()=>l.editorView,hasOutput:null!=(null==i?void 0:i.output)}}function Md(e){return!e.hidden}const Td=Z(!1),Od=()=>{const e=b(32),[t,n]=Fe(Td),o=Si(),r=le(Id),a=le(Le);let s;e[0]!==r?(s={cell:r},e[0]=r,e[1]=s):s=e[1];let i=kd(s).flat();i=md(i);const l=function(){const e=b(46),{theme:t}=Te(),[n,o]=Oe(),[r,a]=De();let s;e[0]!==o?(s=async e=>{await Pe({config:e}).then((()=>{o(e)}))},e[0]=o,e[1]=s):s=e[1];const i=s;let l;e[2]!==a?(l=async e=>{await Re({config:e}).then((()=>{a(e)}))},e[2]=a,e[3]=l):l=e[3];const c=l;let d,u;if(e[4]!==r||e[5]!==c){let t;e[7]!==r.width?(t=e=>e!==r.width,e[7]=r.width,e[8]=t):t=e[8],d=Ei().filter(t).map((e=>({label:`App config > Set width=${e}`,handle:()=>{c({...r,width:e})}}))),e[4]=r,e[5]=c,e[6]=d}else d=e[6];e[9]!==i||e[10]!==n||e[11]!==t?(u={label:"Config > Toggle dark mode",handle:()=>{i({...n,display:{...n.display,theme:"dark"===t?"light":"dark"}})}},e[9]=i,e[10]=n,e[11]=t,e[12]=u):u=e[12];const h="vim"===n.keymap.preset;let m,f;e[13]!==i||e[14]!==n?(m=()=>{i({...n,keymap:{...n.keymap,preset:"vim"}})},e[13]=i,e[14]=n,e[15]=m):m=e[15],e[16]!==h||e[17]!==m?(f={label:"Config > Switch keymap to VIM",hidden:h,handle:m},e[16]=h,e[17]=m,e[18]=f):f=e[18];const p="default"===n.keymap.preset;let g,v,x;e[19]!==i||e[20]!==n?(g=()=>{i({...n,keymap:{...n.keymap,preset:"default"}})},e[19]=i,e[20]=n,e[21]=g):g=e[21],e[22]!==p||e[23]!==g?(v={label:"Config > Switch keymap to default (current: VIM)",hidden:p,handle:g},e[22]=p,e[23]=g,e[24]=v):v=e[24],e[25]!==i||e[26]!==n?(x=()=>{i({...n,completion:{...n.completion,copilot:!1}})},e[25]=i,e[26]=n,e[27]=x):x=e[27];const y="github"!==n.completion.copilot;let w,k;e[28]!==x||e[29]!==y?(w={label:"Config > Disable GitHub Copilot",handle:x,hidden:y},e[28]=x,e[29]=y,e[30]=w):w=e[30],e[31]!==i||e[32]!==n?(k=()=>{i({...n,completion:{...n.completion,copilot:"github"}})},e[31]=i,e[32]=n,e[33]=k):k=e[33];const N="github"===n.completion.copilot;let C,E;e[34]!==k||e[35]!==N?(C={label:"Config > Enable GitHub Copilot",handle:k,hidden:N},e[34]=k,e[35]=N,e[36]=C):C=e[36],e[37]!==d||e[38]!==u||e[39]!==f||e[40]!==v||e[41]!==w||e[42]!==C?(E=[...d,u,f,v,w,C],e[37]=d,e[38]=u,e[39]=f,e[40]=v,e[41]=w,e[42]=C,e[43]=E):E=e[43];const S=E;let j;return e[44]!==S?(j=S.filter(Md),e[44]=S,e[45]=j):j=e[45],j}();let c=Kd();c=[...md(c),...md(l)];const d=c.filter(Dd),u=ze.keyBy(d,Pd),{recentCommands:h,addRecentCommand:m}=ud(),f=new Set(h);let p,g;e[2]!==a||e[3]!==n?(p=e=>{Ge(a.getHotkey("global.commandPalette").key)(e)&&(e.preventDefault(),n((e=>!e)))},e[2]=a,e[3]=n,e[4]=p):p=e[4],Q(document,"keydown",p),e[5]!==o||e[6]!==a||e[7]!==m||e[8]!==n?(g=(e,t)=>{const r=o[e];if(!r)return null;const s=a.getHotkey(e);return k.jsxs($e,{disabled:t.disabled,onSelect:()=>{m(e),n(!1),requestAnimationFrame((()=>{r()}))},value:s.name,children:[k.jsxs("span",{children:[s.name,t.tooltip&&k.jsx("span",{className:"ml-2",children:t.tooltip})]}),k.jsx(He,{children:k.jsx(We,{shortcut:s.key})})]},e)},e[5]=o,e[6]=a,e[7]=m,e[8]=n,e[9]=g):g=e[9];const v=g;let x;e[10]!==m||e[11]!==n||e[12]!==a?(x=(e,t,o,r)=>{const s=void 0===o?{}:o;return k.jsxs($e,{disabled:s.disabled,onSelect:()=>{m(e),n(!1),requestAnimationFrame((()=>{t()}))},value:e,children:[k.jsxs("span",{children:[e,s.tooltip&&k.jsxs("span",{className:"ml-2",children:["(",s.tooltip,")"]})]}),r&&k.jsx(He,{children:k.jsx(We,{shortcut:a.getHotkey(r).key})})]},e)},e[10]=m,e[11]=n,e[12]=a,e[13]=x):x=e[13];const y=x,w=qe;let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=k.jsx(Ye,{placeholder:"Type to search..."}),e[14]=N):N=e[14];const C=Xe;let E;e[15]===Symbol.for("react.memo_cache_sentinel")?(E=k.jsx(Ke,{children:"No results found."}),e[15]=E):E=e[15];const S=h.length>0&&k.jsxs(k.Fragment,{children:[k.jsx(Be,{heading:"Recently Used",children:h.map((e=>{const t=u[e];return Ue(e)?v(e,{disabled:null==t?void 0:t.disabled,tooltip:null==t?void 0:t.tooltip}):t&&!hd(t)?y(t.label,t.handleHeadless||t.handle,{disabled:t.disabled,tooltip:t.tooltip}):null}))}),k.jsx(Ve,{})]}),j=Be,_=a.iterate().map((e=>{if(f.has(e))return null;const t=u[e];return v(e,{disabled:null==t?void 0:t.disabled,tooltip:null==t?void 0:t.tooltip})})),I=d.map((e=>f.has(e.label)?null:y(e.label,e.handleHeadless||e.handle,{disabled:e.disabled,tooltip:e.tooltip}))),A=i.map((e=>f.has(e.label)?null:y(`Cell > ${e.label}`,e.handleHeadless||e.handle,{disabled:e.disabled,tooltip:e.tooltip})));let M,T,O;return e[16]!==j||e[17]!==_||e[18]!==I||e[19]!==A?(M=k.jsxs(j,{heading:"Commands",children:[_,I,A]}),e[16]=j,e[17]=_,e[18]=I,e[19]=A,e[20]=M):M=e[20],e[21]!==C||e[22]!==E||e[23]!==S||e[24]!==M?(T=k.jsxs(C,{children:[E,S,M]}),e[21]=C,e[22]=E,e[23]=S,e[24]=M,e[25]=T):T=e[25],e[26]!==w||e[27]!==t||e[28]!==n||e[29]!==N||e[30]!==T?(O=k.jsxs(w,{open:t,onOpenChange:n,children:[N,T]}),e[26]=w,e[27]=t,e[28]=n,e[29]=N,e[30]=T,e[31]=O):O=e[31],O};function Dd(e){return!e.hotkey}function Pd(e){return e.label}const Rd="https://static.marimo.app",Fd=({onClose:e})=>{const[t,n]=r.useState(""),o=`${t}-${r.useRef(Math.random().toString(36).slice(2,6)).current}`,a=`${Rd}/static/${o}`;return k.jsx(A,{className:"w-fit",children:k.jsxs("form",{onSubmit:async t=>{t.preventDefault(),e();const n=await Je({download:!1,includeCode:!0,files:el.INSTANCE.filenames()}),r=re({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Rd}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:n,path:o})}).catch((()=>{r.dismiss(),re({title:"Error uploading static page",description:k.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",k.jsx("a",{href:Ze.issuesPage,target:"_blank",rel:"noreferrer",className:"underline",children:"GitHub"}),"."]})})})),r.dismiss(),re({title:"Static page uploaded!",description:k.jsxs("div",{children:["The URL has been copied to your clipboard.",k.jsx("br",{}),"You can share it with anyone."]})})},children:[k.jsxs(Ie,{children:[k.jsx(j,{children:"Share static notebook"}),k.jsxs(_,{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"," ",k.jsx("a",{href:Rd,target:"_blank",rel:"noreferrer",children:Rd}),"."]})]}),k.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[k.jsx(Qe,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:t,placeholder:"Notebook slug",onChange:e=>{const t=e.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");n(t)},required:!0,autoComplete:"off"}),k.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:",k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx(Ld,{text:a}),k.jsx("span",{className:"text-primary",children:a})]})]})]}),k.jsxs(I,{children:[k.jsx(E,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:e,children:"Cancel"}),k.jsx(E,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await et(a)},children:"Create"})]})]})})},Ld=e=>{const t=b(8),[n,o]=u.useState(!1);let r;t[0]!==e.text?(r=tt.stopPropagation((async t=>{t.preventDefault(),await et(e.text),o(!0),setTimeout((()=>o(!1)),2e3)})),t[0]=e.text,t[1]=r):r=t[1];const a=r;let s,i,l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(s=k.jsx(nt,{size:14,strokeWidth:1.5}),t[2]=s):s=t[2],t[3]!==a?(i=k.jsx(E,{"data-testid":"copy-static-notebook-url-button",onClick:a,size:"xs",variant:"secondary",children:s}),t[3]=a,t[4]=i):i=t[4],t[5]!==n||t[6]!==i?(l=k.jsx(C,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=l):l=t[7],l};function zd(){const e=b(3),{openConfirm:t}=w(),n=ce(tl);let o;return e[0]!==t||e[1]!==n?(o=()=>{t({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:k.jsx(ot,{onClick:async()=>{n({state:nl.CLOSING}),await rt(),at()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=n,e[2]=o):o=e[2],o}const Bd=new st("marimo:sidebar",it.object({selectedPanel:it.string().optional().transform((e=>e)),isSidebarOpen:it.boolean(),isTerminalOpen:it.boolean()}),(function(){return{selectedPanel:"variables",isSidebarOpen:!1,isTerminalOpen:!1}}));const{reducer:Ud,createActions:Vd,valueAtom:Gd,useActions:$d}=lt((()=>Bd.get()),{openApplication:(e,t)=>({...e,selectedPanel:t,isSidebarOpen:!e.isSidebarOpen||e.selectedPanel!==t}),toggleSidebarPanel:e=>({...e,isSidebarOpen:!e.isSidebarOpen}),setIsSidebarOpen:(e,t)=>({...e,isSidebarOpen:t}),toggleTerminal:e=>({...e,isTerminalOpen:!e.isTerminalOpen}),setIsTerminalOpen:(e,t)=>({...e,isTerminalOpen:t})},[(e,t)=>Bd.set(t)]),Hd=()=>{const e=b(2),t=le(Gd);if(t.isSidebarOpen)return t;let n;return e[0]!==t?(n={...t,selectedPanel:void 0},e[0]=t,e[1]=n):n=e[1],n};function Wd(){return $d()}const qd=[{type:"files",Icon:rc,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:ct,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:ke,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:gc,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:Ul,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:Mc,tooltip:"View outline",position:"sidebar"},{type:"documentation",Icon:Gc,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:dt,tooltip:"Notebook logs",position:"sidebar"},{type:"snippets",Icon:Pc,tooltip:"Snippets",position:"sidebar"},{type:"scratchpad",Icon:vc,hidden:!ki("scratchpad"),tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:be,tooltip:"View errors",position:"footer"}];function Yd(){const e=b(2),t=ce(ut);let n;e[0]!==t?(n=()=>{const e=document.getElementsByClassName("output-area"),n=window.innerHeight||document.documentElement.clientHeight;let o;o=null;for(const t of Array.from(e)){const e=t.getBoundingClientRect();if(e.top>=0&&e.top<=n||e.bottom>=0&&e.bottom<=n){o=ht.parse(t.parentNode.id);break}}t((e=>({mode:mt(e.mode),cellAnchor:o}))),requestAnimationFrame((()=>{var e;null!==o&&(null==(e=document.getElementById(ht.create(o)))||e.scrollIntoView())}))},e[0]=t,e[1]=n):n=e[1];return n}const Xd=e=>{null==e||e.preventDefault(),null==e||e.stopPropagation()};function Kd(){const[e]=vt(),{openModal:t,closeModal:n}=w(),{openApplication:o}=Wd(),{selectedPanel:r}=Hd(),[a]=Fe(ut),s=le(me),i=H(),{updateCellConfig:l,undoDeleteCell:c,clearAllCellOutputs:d}=q(),u=zd(),h=function(e){const t=b(4),{openPrompt:n,closeModal:o}=w();let r;return t[0]!==e||t[1]!==n||t[2]!==o?(r=()=>{if(!e)return null;const t=ft.guessDeliminator(e),r=pt.basename(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${r}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:n=>{const r=t.join(pt.dirname(e),n);gt({source:e,destination:r}).then((()=>{o(),re({title:"Notebook copied",description:"A copy of the notebook has been created."}),window.open(`/?file=${r}`,"_blank")}))}})},t[0]=e,t[1]=n,t[2]=o,t[3]=r):r=t[3],r}(e),m=ce(Td),f=ce(ji),p=ce(_i),g=xt(i),v=yt(i),{selectedLayout:x}=Xi(),{setLayoutView:y}=Ki(),C=Yd();return[{icon:k.jsx(Tc,{size:14,strokeWidth:1.5}),label:"Share",handle:Xd,dropdown:[{icon:k.jsx(bt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",handle:async()=>{t(k.jsx(Fd,{onClose:n}))}},{icon:k.jsx(uc,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",handle:async()=>{const e=await wt(),t=kt({code:e.contents});await et(t),re({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:k.jsx(Nt,{size:14,strokeWidth:1.5}),label:"Download",handle:Xd,dropdown:[{icon:k.jsx(ol,{size:14,strokeWidth:1.5}),label:"Download as HTML",handle:async()=>{e?await rl({filename:e,includeCode:!0}):re({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:k.jsx(ol,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{e?await rl({filename:e,includeCode:!1}):re({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:k.jsx(Ni,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{const e=await Ct({download:!1});S(new Blob([e],{type:"text/plain"}),Et.toMarkdown(document.title))}},{icon:k.jsx(Xl,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{const e=await wt();S(new Blob([e.contents],{type:"text/plain"}),Et.toPY(document.title))}},{divider:!0,icon:k.jsx(Zi,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:"present"!==a.mode,tooltip:"present"===a.mode?void 0:k.jsxs("span",{children:["Only available in app view. ",k.jsx("br",{}),"Toggle with: ",N("global.hideCode",!1)]}),handle:async()=>{const e=document.getElementById("App");e&&await $(e,document.title)}},{icon:k.jsx(St,{size:14,strokeWidth:1.5}),label:"Download as PDF",disabled:"present"!==a.mode,tooltip:"present"===a.mode?void 0:k.jsxs("span",{children:["Only available in app view. ",k.jsx("br",{}),"Toggle with: ",N("global.hideCode",!1)]}),handle:async()=>{const e=new Event("export-beforeprint"),t=new Event("export-afterprint");window.dispatchEvent(e),setTimeout((()=>window.print()),0),setTimeout((()=>window.dispatchEvent(t)),0)}}]},{divider:!0,icon:k.jsx(wc,{size:14,strokeWidth:1.5}),label:"Helper panel",handle:Xd,dropdown:qd.flatMap((({type:e,Icon:t,hidden:n})=>{return n?[]:{label:O(e),rightElement:(a=r===e,k.jsx("div",{className:"w-8 flex justify-end",children:a&&k.jsx(_t,{size:14})})),icon:k.jsx(t,{size:14,strokeWidth:1.5}),handle:()=>o(e)};var a}))},{icon:k.jsx(Ec,{size:14,strokeWidth:1.5}),label:"Present as",handle:Xd,dropdown:[{icon:"present"===a.mode?k.jsx(jt,{size:14,strokeWidth:1.5}):k.jsx(dc,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{C()}},...Ji.map(((e,t)=>{const n=ld(e);return{divider:0===t,label:cd(e),icon:k.jsx(n,{size:14,strokeWidth:1.5}),rightElement:k.jsx("div",{className:"w-8 flex justify-end",children:x===e&&k.jsx(_t,{size:14})}),handle:()=>{y(e),"edit"===a.mode&&C()}}}))]},{icon:k.jsx(nc,{size:14,strokeWidth:1.5}),label:"Create notebook copy",hidden:!e||D(),handle:h},{icon:k.jsx(Wl,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:async()=>{const e=await wt();await et(e.contents),re({title:"Copied",description:"Code copied to clipboard."})}},{icon:k.jsx(Xc,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:0===g.length||s,handle:async()=>{const e=g.map((e=>e.id)),t=ze.fromEntries(e.map((e=>[e,{disabled:!1}])));await _e({configs:t});for(const n of e)l({cellId:n,config:{disabled:!1}})}},{icon:k.jsx(Yc,{size:14,strokeWidth:1.5}),label:"Disable all cells",hidden:0===v.length||s,handle:async()=>{const e=v.map((e=>e.id)),t=ze.fromEntries(e.map((e=>[e,{disabled:!0}])));await _e({configs:t});for(const n of e)l({cellId:n,config:{disabled:!0}})}},{icon:k.jsx(be,{size:14,strokeWidth:1.5}),label:"Clear all outputs",handle:()=>{d()}},{icon:k.jsx($c,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!It(i)||s,handle:()=>{c()}},{divider:!0,icon:k.jsx(Kl,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>m((e=>!e))},{icon:k.jsx(At,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>f((e=>!e))},{icon:k.jsx(cc,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>p((e=>!e))},{icon:k.jsx(Bl,{size:14,strokeWidth:1.5}),label:"Open documentation",handle:()=>{window.open("https://docs.marimo.io","_blank")}},{divider:!0,icon:k.jsx(lc,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:()=>{window.location.href=document.baseURI}},{icon:k.jsx(Bc,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:u}].filter((e=>!e.hidden))}const Jd=()=>{const e=b(10),t=Kd();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=k.jsx(bi,{"aria-label":"Config",shape:"circle",size:"small",className:"h-[27px] w-[27px]","data-testid":"notebook-menu-dropdown",color:"hint-green",children:k.jsx(al,{strokeWidth:1.8})}),e[0]=n):n=e[0];const o=n,r=Zd;let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a=e=>{const t=k.jsx(Tt,{variant:e.variant,disabled:e.disabled,onSelect:t=>e.handle(t),"data-testid":`notebook-menu-dropdown-${e.label}`,children:r(e)},e.label);return e.tooltip?k.jsx(C,{content:e.tooltip,side:"left",delayDuration:100,children:k.jsx("span",{children:t})},e.label):t},e[1]=a):a=e[1];const s=a;let i,l,c,d,h;if(e[2]===Symbol.for("react.memo_cache_sentinel")?(i=k.jsx(Ot,{asChild:!0,children:o}),e[2]=i):i=e[2],e[3]!==t){let n;e[5]===Symbol.for("react.memo_cache_sentinel")?(n=e=>e.hidden?null:e.dropdown?k.jsxs(Dt,{children:[k.jsx(Pt,{"data-testid":`notebook-menu-dropdown-${e.label}`,children:r(e)}),k.jsx(Rt,{children:k.jsx(Ft,{children:e.dropdown.map((e=>k.jsxs(u.Fragment,{children:[e.divider&&k.jsx(Lt,{}),s(e)]},e.label)))})})]},e.label):k.jsxs(u.Fragment,{children:[e.divider&&k.jsx(Lt,{}),s(e)]},e.label),e[5]=n):n=e[5],l=t.map(n),e[3]=t,e[4]=l}else l=e[4];return e[6]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx(Lt,{}),e[6]=c):c=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(d=k.jsx("div",{className:"flex-1 px-2 text-xs text-muted-foreground",children:k.jsxs("span",{children:["Version: ",Mt()]})}),e[7]=d):d=e[7],e[8]!==l?(h=k.jsxs(zt,{modal:!1,children:[i,k.jsxs(Bt,{align:"end",className:"no-print w-[240px]",children:[l,c,d]})]}),e[8]=l,e[9]=h):h=e[9],h};function Zd(e){return k.jsxs(k.Fragment,{children:[e.icon&&k.jsx("span",{className:"flex-0 mr-2",children:e.icon}),k.jsx("span",{className:"flex-1",children:e.labelElement||e.label}),e.hotkey&&k.jsx(Ut,{shortcut:e.hotkey,className:"ml-4"}),e.rightElement]})}const Qd=Vt({findText:"",replaceText:"",caseSensitive:!1,wholeWord:!1,regexp:!1,isOpen:!1,currentView:void 0},((e,t)=>{if(void 0===t)return e;switch(t.type){case"setFind":return{...e,findText:t.find};case"setReplace":return{...e,replaceText:t.replace};case"setCaseSensitive":return{...e,caseSensitive:t.caseSensitive};case"setWholeWord":return{...e,wholeWord:t.wholeWord};case"setRegex":return{...e,regexp:t.regexp};case"setIsOpen":return{...e,isOpen:t.isOpen};case"setCurrentView":return{...e,currentView:{view:t.view,range:t.range}};case"clearCurrentView":return{...e,currentView:void 0}}}));function eu(e){if([...document.querySelectorAll('[role="dialog"][data-state="open"]')].some((e=>e instanceof HTMLElement&&e.childNodes.length>0)))return!1;if(e){const t=e.state.selection.main,n=e.state.sliceDoc(t.from,t.to);n?(te.set(Qd,{type:"setFind",find:n}),te.set(Qd,{type:"setCurrentView",view:e,range:{from:t.from,to:t.to}})):te.set(Qd,{type:"setCurrentView",view:e,range:{from:0,to:0}})}return te.get(Qd).isOpen?(te.set(Qd,{type:"setIsOpen",isOpen:!1}),requestAnimationFrame((()=>{te.set(Qd,{type:"setIsOpen",isOpen:!0})})),!0):(te.set(Qd,{type:"setIsOpen",isOpen:!0}),!0)}function tu(){return!!te.get(Qd).isOpen&&(te.set(Qd,{type:"setIsOpen",isOpen:!1}),!0)}function nu(e){return Gt("create"in e,'Expected query to have a "create" method'),e}function ou(e){return()=>{const t=te.get(Qd),n=new $t({search:t.findText,caseSensitive:t.caseSensitive,regexp:t.regexp,replace:t.replaceText,wholeWord:t.wholeWord});return!!n.valid&&e({query:nu(n).create(),search:n})}}const ru=e=>ou((({query:t})=>{const n=Ht(),o=te.get(Qd).currentView||{view:n[0],range:{from:0,to:0}};let r=o.range.to;"prev"===e&&(n.reverse(),r=o.range.from);let a=n.indexOf(o.view);a<0&&(a=0);const s=[...n,...n].slice(a);for(const i of s){const n="next"===e?t.nextMatch(i.state,0,r??0):t.prevMatch(i.state,r??i.state.doc.length,i.state.doc.length);if(!n){r=null,i.dispatch({selection:Wt.single(0)});continue}const o=Wt.single(n.from,n.to);return i.dispatch({selection:o,effects:[qt.scrollIntoView(o.main,{y:"center"})],userEvent:"select.search"}),te.set(Qd,{type:"setCurrentView",view:i,range:{from:n.from,to:n.to}}),n}return!1})),au=ru("next"),su=ru("prev"),iu=ou((({query:e})=>{var t;const n=Ht(),o=[];for(const r of n){if(r.state.readOnly)continue;const n=null==(t=e.matchAll(r.state,1e9))?void 0:t.map((t=>{const{from:n,to:o}=t;return{from:n,to:o,insert:e.getReplacement(t)}}));if(!n||0===n.length)continue;const a=r.state.doc.toString();o.push((()=>{r.dispatch({changes:[{from:0,to:r.state.doc.length,insert:a}],userEvent:"input.replace.all"})})),r.dispatch({changes:n,userEvent:"input.replace.all"})}return()=>{for(const e of o)e()}})),lu=ou((({query:e})=>{const t=Ht(),n=te.get(Qd).currentView||{view:t[0],range:{from:0,to:0}};let o=n.range.from,r=t.indexOf(n.view);r<0&&(r=0);const a=[...t,...t].slice(r);for(const s of a){const t=e.nextMatch(s.state,0,o??0);if(!t){o=null,s.dispatch({selection:Wt.single(0)});continue}const n=s.state.toText(e.getReplacement(t));return s.dispatch({changes:[{from:t.from,to:t.to,insert:n}],userEvent:"input.replace"}),au()}return!1})),cu=ou((({query:e})=>{const t=Ht();let n=0;const o=new Map;for(const r of t){const t=e.matchAll(r.state,1e9)||[];for(const e of t){const{from:t,to:a}=e,s=o.get(r)||new Map;s.set(`${t}:${a}`,n++),o.set(r,s)}}return{count:n,position:o}})),du=Yt.define();function uu(){const e=Ht();for(const t of e)t.state.readOnly||t.dispatch({effects:du.of(new $t({search:""}))})}const hu=Xt.define({create(){const e=te.get(Qd);return nu(new $t({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord})).create()},update(e,t){for(const n of t.effects)n.is(du)&&(e=nu(n.value).create());return e}}),mu=Kt.mark({class:"cm-searchMatch"}),fu=Kt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),pu=Jt.fromClass(class{constructor(e){this.view=e,this.decorations=void 0,this.decorations=this.highlight(e.state.field(hu))}update(e){const t=e.state.field(hu);(t!==e.startState.field(hu)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight(e){if(!e.spec.valid)return Kt.none;const{view:t}=this,n=new Zt,o=t.visibleRanges,r=o.length;for(let a=0;a<r;a++){let{to:s}=o[a];const{from:i}=o[a];for(;a<r-1&&s>o[a+1].from-500;)s=o[++a].to;e.highlight(t.state,i,s,((e,o)=>{const r=t.state.selection.ranges.some((t=>t.from===e&&t.to===o));n.add(e,o,r?fu:mu)}))}return n.finish()}},{decorations:e=>e.decorations}),gu=qt.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"}}),vu=()=>{var e;const t=b(99),[n,o]=r.useState(!1),[a,s]=Fe(Qd),[i,l]=r.useState(),c=r.useRef(null),d=le(Le);let u,h,m,f,p;if(t[0]!==n||t[1]!==a.isOpen?(u=()=>(!n||!a.isOpen)&&eu(),t[0]=n,t[1]=a.isOpen,t[2]=u):u=t[2],yi("cell.findAndReplace",u),t[3]!==a.isOpen?(h=()=>{a.isOpen&&c.current&&(c.current.focus(),c.current.select())},m=[a.isOpen],t[3]=a.isOpen,t[4]=h,t[5]=m):(h=t[4],m=t[5]),r.useEffect(h,m),t[6]!==a.isOpen||t[7]!==a.findText?(f=()=>{if(!a.isOpen)return void uu();if(""===a.findText)return l(void 0),void uu();const e=cu();l(!1===e?void 0:e),function(){const e=te.get(Qd),t=Ht();for(const n of t)n.state.readOnly||n.dispatch({effects:du.of(new $t({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord}))})}()},t[6]=a.isOpen,t[7]=a.findText,t[8]=f):f=t[8],t[9]!==a.findText||t[10]!==a.isOpen||t[11]!==a.caseSensitive||t[12]!==a.regexp||t[13]!==a.wholeWord?(p=[a.findText,a.isOpen,a.caseSensitive,a.regexp,a.wholeWord],t[9]=a.findText,t[10]=a.isOpen,t[11]=a.caseSensitive,t[12]=a.regexp,t[13]=a.wholeWord,t[14]=p):p=t[14],r.useEffect(f,p),!a.isOpen)return null;const g=a.currentView;let v;t[15]!==g||t[16]!==i?(v=g&&i?null==(e=i.position.get(g.view))?void 0:e.get(`${g.range.from}:${g.range.to}`):void 0,t[15]=g,t[16]=i,t[17]=v):v=t[17];const x=v;let y,w,N,S,j,_,I,A,M,T,O;t[18]===Symbol.for("react.memo_cache_sentinel")?(y=()=>o(!0),t[18]=y):y=t[18],t[19]===Symbol.for("react.memo_cache_sentinel")?(w=()=>o(!1),t[19]=w):w=t[19],t[20]!==s?(N=e=>{"Escape"===e.key&&s({type:"setIsOpen",isOpen:!1})},t[20]=s,t[21]=N):N=t[21],t[22]!==s?(S=()=>s({type:"setIsOpen",isOpen:!1}),t[22]=s,t[23]=S):S=t[23],t[24]===Symbol.for("react.memo_cache_sentinel")?(j=k.jsx(en,{className:"w-4 h-4"}),t[24]=j):j=t[24],t[25]!==S?(_=k.jsx("div",{className:"absolute top-0 right-0",children:k.jsx(E,{"data-testid":"close-find-replace-button",onClick:S,size:"xs",variant:"text",children:j})}),t[25]=S,t[26]=_):_=t[26],t[27]!==s?(I=e=>{s({type:"setFind",find:e.target.value})},t[27]=s,t[28]=I):I=t[28],t[29]!==a.findText||t[30]!==I?(A=k.jsx(Qe,{ref:c,"data-testid":"find-input",value:a.findText,autoFocus:!0,className:"mr-2 mb-0",placeholder:"Find",onKeyDown:yu,onChange:I}),t[29]=a.findText,t[30]=I,t[31]=A):A=t[31],t[32]!==s?(M=e=>{s({type:"setReplace",replace:e.target.value})},t[32]=s,t[33]=M):M=t[33],t[34]!==a.replaceText||t[35]!==M?(T=k.jsx(Qe,{"data-testid":"replace-input",value:a.replaceText,placeholder:"Replace",onChange:M}),t[34]=a.replaceText,t[35]=M,t[36]=T):T=t[36],t[37]!==A||t[38]!==T?(O=k.jsxs("div",{className:"flex flex-col flex-2 gap-2 w-[55%]",children:[A,T]}),t[37]=A,t[38]=T,t[39]=O):O=t[39];const D=a.caseSensitive?"on":"off";let P,R,F;t[40]!==s?(P=e=>s({type:"setCaseSensitive",caseSensitive:e}),t[40]=s,t[41]=P):P=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(R=k.jsx(tn,{className:"w-4 h-4"}),t[42]=R):R=t[42],t[43]!==a.caseSensitive||t[44]!==D||t[45]!==P?(F=k.jsx(C,{content:"Case Sensitive",children:k.jsx(Qt,{size:"sm",pressed:a.caseSensitive,"data-state":D,onPressedChange:P,children:R})}),t[43]=a.caseSensitive,t[44]=D,t[45]=P,t[46]=F):F=t[46];const L=a.wholeWord?"on":"off";let z,B,U;t[47]!==s?(z=e=>s({type:"setWholeWord",wholeWord:e}),t[47]=s,t[48]=z):z=t[48],t[49]===Symbol.for("react.memo_cache_sentinel")?(B=k.jsx(Wc,{className:"w-4 h-4"}),t[49]=B):B=t[49],t[50]!==a.wholeWord||t[51]!==L||t[52]!==z?(U=k.jsx(C,{content:"Match Whole Word",children:k.jsx(Qt,{size:"sm",pressed:a.wholeWord,"data-state":L,onPressedChange:z,children:B})}),t[50]=a.wholeWord,t[51]=L,t[52]=z,t[53]=U):U=t[53];const V=a.regexp?"on":"off";let G,$,H,W;t[54]!==s?(G=e=>s({type:"setRegex",regexp:e}),t[54]=s,t[55]=G):G=t[55],t[56]===Symbol.for("react.memo_cache_sentinel")?($=k.jsx(Sc,{className:"w-4 h-4"}),t[56]=$):$=t[56],t[57]!==a.regexp||t[58]!==V||t[59]!==G?(H=k.jsx(C,{content:"Use Regular Expression",children:k.jsx(Qt,{size:"sm",pressed:a.regexp,"data-state":V,onPressedChange:G,children:$})}),t[57]=a.regexp,t[58]=V,t[59]=G,t[60]=H):H=t[60],t[61]!==F||t[62]!==U||t[63]!==H?(W=k.jsxs("div",{className:"flex items-center gap-[2px]",children:[F,U,H]}),t[61]=F,t[62]=U,t[63]=H,t[64]=W):W=t[64];const q=""===a.findText||""===a.replaceText;let Y;t[65]!==q?(Y=k.jsx(E,{"data-testid":"replace-next-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:bu,disabled:q,children:"Replace Next"}),t[65]=q,t[66]=Y):Y=t[66];const X=""===a.findText||""===a.replaceText;let K,J,Z,Q,ee,ne,oe,re,ae,se,ie,ce;return t[67]!==X?(K=k.jsx(E,{"data-testid":"replace-all-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:wu,disabled:X,children:"Replace All"}),t[67]=X,t[68]=K):K=t[68],t[69]!==Y||t[70]!==K?(J=k.jsxs("div",{className:"flex items-center gap-[2px]",children:[Y,K]}),t[69]=Y,t[70]=K,t[71]=J):J=t[71],t[72]!==W||t[73]!==J?(Z=k.jsxs("div",{className:"flex flex-col gap-2",children:[W,J]}),t[72]=W,t[73]=J,t[74]=Z):Z=t[74],t[75]!==O||t[76]!==Z?(Q=k.jsxs("div",{className:"flex items-center gap-3",children:[O,Z]}),t[75]=O,t[76]=Z,t[77]=Q):Q=t[77],t[78]===Symbol.for("react.memo_cache_sentinel")?(ee=k.jsx(C,{content:"Find Previous",children:k.jsx(E,{"data-testid":"find-prev-button",size:"xs",variant:"secondary",onClick:ku,children:k.jsx(Dl,{className:"w-4 h-4"})})}),t[78]=ee):ee=t[78],t[79]===Symbol.for("react.memo_cache_sentinel")?(ne=k.jsx(C,{content:"Find Next",children:k.jsx(E,{"data-testid":"find-next-button",size:"xs",variant:"secondary",onClick:Nu,children:k.jsx(Fl,{className:"w-4 h-4"})})}),t[79]=ne):ne=t[79],t[80]!==i||t[81]!==x?(oe=null!=i&&null==x&&k.jsxs("span",{className:"text-sm",children:[i.count," matches"]}),t[80]=i,t[81]=x,t[82]=oe):oe=t[82],t[83]!==i||t[84]!==x?(re=null!=i&&null!=x&&k.jsxs("span",{className:"text-sm",children:[x+1," of ",i.count]}),t[83]=i,t[84]=x,t[85]=re):re=t[85],t[86]!==oe||t[87]!==re?(ae=k.jsxs("div",{className:"flex items-center gap-2",children:[ee,ne,oe,re]}),t[86]=oe,t[87]=re,t[88]=ae):ae=t[88],t[89]!==d?(se=d.getHotkey("cell.findAndReplace"),t[89]=d,t[90]=se):se=t[90],t[91]!==se.key?(ie=k.jsxs("div",{className:"text-xs text-muted-foreground flex gap-1 mt-2",children:["Press"," ",k.jsx(We,{shortcut:se.key})," ","again to open the native browser search."]}),t[91]=se.key,t[92]=ie):ie=t[92],t[93]!==N||t[94]!==_||t[95]!==Q||t[96]!==ae||t[97]!==ie?(ce=k.jsx(nn,{restoreFocus:!0,autoFocus:!0,children:k.jsxs("div",{onFocus:y,onClick:xu,onBlur:w,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:N,children:[_,Q,ae,ie]})}),t[93]=N,t[94]=_,t[95]=Q,t[96]=ae,t[97]=ie,t[98]=ce):ce=t[98],ce};function xu(e){e.stopPropagation(),e.preventDefault()}function yu(e){"Enter"===e.key&&(e.shiftKey?su():au())}function bu(){return lu()}function wu(){const e=iu();if(!e)return;const{dismiss:t}=re({title:"Replaced all occurrences",action:k.jsx(xd,{"data-testid":"undo-replace-all-button",onClick:()=>{e(),n()}})}),n=t}function ku(){return su()}function Nu(){return au()}function Cu(e){const t=b(3),[n,o]=r.useState(!1);let a,s;return t[0]!==e?(a=()=>{if(!e)return;o(!1);const t=setTimeout((()=>{o(!0)}),200);return()=>clearTimeout(t)},s=[e],t[0]=e,t[1]=a,t[2]=s):(a=t[1],s=t[2]),r.useEffect(a,s),e&&n}const Eu=()=>{const e=b(6),t=ce(Td);let n;e[0]!==t?(n=()=>t((e=>!e)),e[0]=t,e[1]=n):n=e[1];const o=n;let r,a,s;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=N("global.commandPalette"),e[2]=r):r=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(a=k.jsx(Kl,{strokeWidth:1.5,size:18}),e[3]=a):a=e[3],e[4]!==o?(s=k.jsx(C,{content:r,children:k.jsx(bi,{"data-testid":"command-palette-button",onClick:o,shape:"rectangle",color:"hint-green",children:a})}),e[4]=o,e[5]=s):s=e[5],s},Su=e=>{const{children:t}=e;return le(me)?null:t},ju=e=>{const{children:t}=e;return le(me)?t:null},_u=e=>{const t=b(48),{filename:n,needsSave:o,onSaveNotebook:r,getCellsAsJSON:a,presenting:s,onTogglePresenting:i,onInterrupt:l,onRun:c,closed:d,running:u,needsRun:h,undoAvailable:m,appWidth:f}=e,{undoDeleteCell:p}=q();let g;t[0]!==r?(g=e=>{e.preventDefault(),e.stopPropagation(),r()},t[0]=r,t[1]=g):g=t[1];const v=g;let x,y,w=null;if(!d&&m){let e,n;t[2]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx($c,{size:16,strokeWidth:1.5}),t[2]=e):e=t[2],t[3]!==p?(n=k.jsx(C,{content:"Undo cell deletion",children:k.jsx(bi,{"data-testid":"undo-delete-cell",size:"medium",color:"hint-green",shape:"circle",onClick:p,children:e})}),t[3]=p,t[4]=n):n=t[4],w=n}t[5]!==s?(x=!s&&k.jsx(vu,{}),t[5]=s,t[6]=x):x=t[6],t[7]!==d||t[8]!==s?(y=!d&&k.jsxs("div",{className:Mu,children:[s&&k.jsx(sd,{}),k.jsx(Jd,{}),k.jsx(Ii,{}),k.jsx(Ai,{description:"This will terminate the Python kernel. You'll lose all data that's in memory."})]}),t[7]=d,t[8]=s,t[9]=y):y=t[9];const E="compact"===f&&"xl:flex-row items-end";let S,j,_,I,A,M,T,O,D,P,R,F,L;return t[10]!==E?(S=on(Tu,E),t[10]=E,t[11]=S):S=t[11],t[12]!==d||t[13]!==n||t[14]!==a||t[15]!==o||t[16]!==v?(j=k.jsx(Su,{children:d?k.jsx(ad,{filename:n,getCellsAsJSON:a,needsSave:o}):k.jsx(C,{content:N("global.save"),children:k.jsx(bi,{"data-testid":"save-button",id:"save-button",shape:"rectangle",color:o?"yellow":"hint-green",onClick:v,children:k.jsx(Ic,{strokeWidth:1.5,size:18})})})}),t[12]=d,t[13]=n,t[14]=a,t[15]=o,t[16]=v,t[17]=j):j=t[17],t[18]===Symbol.for("react.memo_cache_sentinel")?(_=N("global.hideCode"),t[18]=_):_=t[18],t[19]!==s?(I=s?k.jsx(jt,{strokeWidth:1.5,size:18}):k.jsx(dc,{strokeWidth:1.5,size:18}),t[19]=s,t[20]=I):I=t[20],t[21]!==i||t[22]!==I?(A=k.jsx(C,{content:_,children:k.jsx(bi,{"data-testid":"hide-code-button",id:"preview-button",shape:"rectangle",color:"hint-green",onClick:i,children:I})}),t[21]=i,t[22]=I,t[23]=A):A=t[23],t[24]===Symbol.for("react.memo_cache_sentinel")?(M=k.jsx(Eu,{}),T=k.jsx(Mi,{}),O=k.jsx("div",{}),t[24]=M,t[25]=T,t[26]=O):(M=t[24],T=t[25],O=t[26]),t[27]!==d||t[28]!==u||t[29]!==l?(D=!d&&k.jsx(Au,{running:u,onInterrupt:l}),t[27]=d,t[28]=u,t[29]=l,t[30]=D):D=t[30],t[31]!==d||t[32]!==h||t[33]!==c?(P=!d&&k.jsx(Iu,{needsRun:h,onRun:c}),t[31]=d,t[32]=h,t[33]=c,t[34]=P):P=t[34],t[35]!==w||t[36]!==D||t[37]!==P?(R=k.jsx(Su,{children:k.jsxs("div",{className:"flex flex-col gap-2 items-center",children:[w,D,P]})}),t[35]=w,t[36]=D,t[37]=P,t[38]=R):R=t[38],t[39]!==S||t[40]!==j||t[41]!==A||t[42]!==R?(F=k.jsxs("div",{className:S,children:[j,A,M,T,O,R]}),t[39]=S,t[40]=j,t[41]=A,t[42]=R,t[43]=F):F=t[43],t[44]!==x||t[45]!==y||t[46]!==F?(L=k.jsxs(k.Fragment,{children:[x,y,F]}),t[44]=x,t[45]=y,t[46]=F,t[47]=L):L=t[47],L},Iu=e=>{const t=b(5),{needsRun:n,onRun:o}=e;if(n){let e,n,r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=N("global.runStale"),t[0]=e):e=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(n=k.jsx(Cc,{strokeWidth:1.5,size:16}),t[1]=n):n=t[1],t[2]!==o?(r=k.jsx(C,{content:e,children:k.jsx(bi,{"data-testid":"run-button",size:"medium",color:"yellow",shape:"circle",onClick:o,children:n})}),t[2]=o,t[3]=r):r=t[3],r}let r;return t[4]===Symbol.for("react.memo_cache_sentinel")?(r=k.jsx(C,{content:"Nothing to run",children:k.jsx(bi,{"data-testid":"run-button",className:"inactive-button",color:"disabled",size:"medium",shape:"circle",children:k.jsx(Cc,{strokeWidth:1.5,size:16})})}),t[4]=r):r=t[4],r},Au=e=>{const t=b(8),{running:n,onInterrupt:o}=e,r=Cu(n);let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=N("global.interrupt"),t[0]=a):a=t[0];const s=!r&&"inactive-button active:shadow-xsSolid";let i;t[1]!==s?(i=on(s),t[1]=s,t[2]=i):i=t[2];const l=r?"yellow":"disabled",c=r?o:rn.NOOP;let d,u;return t[3]===Symbol.for("react.memo_cache_sentinel")?(d=k.jsx(T,{strokeWidth:1.5,size:16}),t[3]=d):d=t[3],t[4]!==i||t[5]!==l||t[6]!==c?(u=k.jsx(C,{content:a,children:k.jsx(bi,{className:i,"data-testid":"interrupt-button",size:"medium",color:l,shape:"circle",onClick:c,children:d})}),t[4]=i,t[5]=l,t[6]=c,t[7]=u):u=t[7],u},Mu="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",Tu="absolute bottom-5 right-5 flex flex-col gap-2 items-center no-print pointer-events-auto z-30 print:hidden",Ou=e=>{const t=b(35),{resetOnBlur:n,placeholderText:o,initialValue:a,flexibleWidth:s,onNameChange:i,className:l}=e,c=void 0!==n&&n,d=void 0===a?null:a,u=void 0!==s&&s,[h,m]=r.useState(d);let f;t[0]===Symbol.for("react.memo_cache_sentinel")?(f=[],t[0]=f):f=t[0];const[p,g]=r.useState(f),[v,x]=r.useState(!1),y=r.useRef(null),w=r.useRef(!1);let N,C,E;t[1]!==d?(N=()=>{m(d)},C=[d],t[1]=d,t[2]=N,t[3]=C):(N=t[2],C=t[3]),r.useEffect(N,C),t[4]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{x(!0)},t[4]=E):E=t[4];const S=E;let j;t[5]!==c||t[6]!==d?(j=e=>{var t;(null==(t=e.relatedTarget)?void 0:t.closest(".filename-input"))||(x(!1),c&&m(d))},t[5]=c,t[6]=d,t[7]=j):j=t[7];const _=j;let I;t[8]!==h?(I=pt.dirname(h||""),t[8]=h,t[9]=I):I=t[9];const A=I,M=pt.basename(h||""),T=p.filter((e=>pt.basename(e.path).startsWith(M)));let O,D;t[10]!==v||t[11]!==A?(O=async()=>{if(!v)return void g([]);const e=await ln({path:A});g(e.files)},D=[A,v],t[10]=v,t[11]=A,t[12]=O,t[13]=D):(O=t[12],D=t[13]);const{loading:P}=an(O,D),R=function(e,t,n){if(!e)return;if(e.endsWith("/"))return;(ki("markdown")?new Set(["py","md","markdown","qmd"]):new Set(["py"])).has(pt.extension(e))||(e=e.endsWith(".")?`${e}py`:e.endsWith(".p")?`${e}y`:`${e}.py`);if(t.some((t=>t.path===e||pt.basename(t.path)===e)))return;if(n&&(n===e||pt.basename(n)===e))return;return e}(h,p,d),F=(R||T.length>0)&&k.jsxs(Xe,{className:"font-mono",children:[!P&&k.jsx(Ke,{children:"No files"}),R&&k.jsxs($e,{variant:"success",className:"py-2 px-3",onSelect:()=>{var e;R&&(w.current=!0,i(R),null==(e=y.current)||e.blur())},children:[k.jsx(ec,{className:"w-4 h-4 mr-2"})," ",k.jsxs("span",{className:"text-sm",children:[d?"Rename to: ":"Save as: ",k.jsx("span",{className:"font-medium text-sm",children:pt.basename(R)})]})]},"_rename_"),T.map((e=>{const t=e.isDirectory?"directory":sn(e.path),n=cn[t];return k.jsxs($e,{variant:e.isDirectory?"default":"muted",className:"py-2 px-3",onSelect:()=>{e.isDirectory?m(`${e.path}/`):m(e.path)},children:[k.jsx(n,{className:"w-4 h-4 mr-2"})," ",pt.basename(e.path)]},e.path)}))]}),L=10*Math.max(20,(null==h?void 0:h.length)||(null==o?void 0:o.length)||0),z=v?h||"":d||"";let B,U,V;t[14]!==u||t[15]!==L?(B=u?{maxWidth:L}:void 0,t[14]=u,t[15]=L,t[16]=B):B=t[16],t[17]!==l?(U=on(l,"w-full px-4 py-1 my-1 h-9 font-mono text-foreground/60"),t[17]=l,t[18]=U):U=t[18],t[19]!==z||t[20]!==o||t[21]!==B||t[22]!==U?(V=k.jsx(dn,{children:k.jsx(Ye,{"data-testid":"dir-completion-input",tabIndex:-1,rootClassName:"border-none justify-center px-1",spellCheck:"false",value:z,onKeyDown:Du,icon:null,ref:y,onValueChange:m,placeholder:o,autoComplete:"off",style:B,className:U})}),t[19]=z,t[20]=o,t[21]=B,t[22]=U,t[23]=V):V=t[23];const G=F&&"group-focus-within:block";let $,H,W,q;return t[24]!==G?($=on("p-0 w-full min-w-80 max-w-80vw hidden",G),t[24]=G,t[25]=$):$=t[25],t[26]!==$||t[27]!==F?(H=k.jsx(un,{side:"bottom",className:$,portal:!1,children:F}),t[26]=$,t[27]=F,t[28]=H):H=t[28],t[29]!==V||t[30]!==H?(W=k.jsxs(Xe,{children:[V,H]}),t[29]=V,t[30]=H,t[31]=W):W=t[31],t[32]!==_||t[33]!==W?(q=k.jsx(hn,{open:!0,modal:!1,children:k.jsx(mn,{onFocus:S,onBlur:_,shouldFilter:!1,className:"bg-transparent group filename-input",children:W})}),t[32]=_,t[33]=W,t[34]=q):q=t[34],q};function Du(e){"Escape"===e.key&&e.currentTarget.blur()}const Pu=e=>{const t=b(7),{filename:n,setFilename:o}=e;let r;t[0]!==n?(r=n?pt.basename(n):"untitled marimo app",t[0]=n,t[1]=r):r=t[1];const a=null===n?"missing-filename":"filename";let s;return t[2]!==r||t[3]!==n||t[4]!==o||t[5]!==a?(s=k.jsx(Ou,{placeholderText:r,initialValue:n,onNameChange:o,flexibleWidth:!0,resetOnBlur:!0,"data-testid":"filename-input",className:a}),t[2]=r,t[3]=n,t[4]=o,t[5]=a,t[6]=s):s=t[6],s};function Ru(e){return[fn.of([{key:"Escape",preventDefault:!1,run:tu},{key:e.getHotkey("cell.selectNextOccurrence").key,preventDefault:!0,run:pn},{key:e.getHotkey("cell.findAndReplace").key,preventDefault:!0,run:eu}]),gn(),pu,hu,gu]}var Fu=Object.defineProperty,Lu=(e,t,n)=>(((e,t,n)=>{t in e?Fu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);const zu=Xt.define({create:()=>({suggestion:null}),update(e,t){const n=t.effects.find((e=>e.is(Bu)));return t.state.doc&&n&&t.state.doc==n.value.doc?{suggestion:n.value.text}:{suggestion:null}}}),Bu=Yt.define();class Uu extends xn{constructor(e){super(),Lu(this,"suggestion"),this.suggestion=e}toDOM(){const e=document.createElement("span");return e.style.opacity="0.4",e.className="cm-inline-suggestion",e.textContent=this.suggestion,e}get lineBreaks(){return this.suggestion.split("\n").length-1}}const Vu=e=>Jt.fromClass(class{async update(t){const n=t.state.doc;if(!t.docChanged)return;const o=await e(t.state);t.view.dispatch({effects:Bu.of({text:o,doc:n})})}}),Gu=Jt.fromClass(class{constructor(){Lu(this,"decorations"),this.decorations=Kt.none}update(e){var t;const n=null==(t=e.state.field(zu))?void 0:t.suggestion;this.decorations=n?function(e,t){const n=e.state.selection.main.head,o=[],r=Kt.widget({widget:new Uu(t),side:1});return o.push(r.range(n)),Kt.set(o)}(e.view,n):Kt.none}},{decorations:e=>e.decorations}),$u=vn.highest(fn.of([{key:"Tab",run:e=>{var t;const n=null==(t=e.state.field(zu))?void 0:t.suggestion;return!!n&&(e.dispatch({...Hu(e.state,n,e.state.selection.main.head,e.state.selection.main.head)}),!0)}}]));function Hu(e,t,n,o){return{...e.changeByRange((r=>{if(r==e.selection.main)return{changes:{from:n,to:o,insert:t},range:Wt.cursor(n+t.length)};const a=o-n;return!r.empty||a&&e.sliceDoc(r.from-a,r.from)!=e.sliceDoc(n,o)?{range:r}:{changes:{from:r.from-a,to:r.from,insert:t},range:Wt.cursor(r.from-a+t.length)}})),userEvent:"input.complete"}}function Wu(e){const{delay:t=500}=e,n=function(e,t,n){let o=()=>{};return(...r)=>(o(),new Promise(((a,s)=>{const i=setTimeout((()=>a(e(...r))),t);o=()=>{clearTimeout(i),void 0!==n&&s(n)}})))}(e.fetchFn,t);return[zu,Vu(n),Gu,$u]}const qu=Yt.define(),Yu=Yt.define(),Xu=Yt.define();function Ku(e,t){if(!e)throw new Error(t)}function Ju(e){if("number"!=typeof e)throw new Error("invalid int 32: "+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw new Error("invalid int 32: "+e)}function Zu(e){if("number"!=typeof e)throw new Error("invalid uint 32: "+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw new Error("invalid uint 32: "+e)}function Qu(e){if("number"!=typeof e)throw new Error("invalid float 32: "+typeof e);if(Number.isFinite(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw new Error("invalid float 32: "+e)}const eh=Symbol("@bufbuild/protobuf/enum-type");function th(e){const t=e[eh];return Ku(t,"missing enum type on enum object"),t}function nh(e,t,n,o){e[eh]=oh(t,n.map((t=>({no:t.no,name:t.name,localName:e[t.no]}))))}function oh(e,t,n){const o=Object.create(null),r=Object.create(null),a=[];for(const s of t){const e=ah(s);a.push(e),o[s.name]=e,r[s.no]=e}return{typeName:e,values:a,findName:e=>o[e],findNumber:e=>r[e]}}function rh(e,t,n){const o={};for(const r of t){const e=ah(r);o[e.localName]=e.no,o[e.no]=e.localName}return nh(o,e,t),o}function ah(e){return"localName"in e?e:Object.assign(Object.assign({},e),{localName:e.name})}class sh{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,t){const n=this.getType().runtime.bin,o=n.makeReadOptions(t);return n.readMessage(this,o.readerFactory(e),e.byteLength,o),this}fromJson(e,t){const n=this.getType(),o=n.runtime.json,r=o.makeReadOptions(t);return o.readMessage(n,e,r,this),this}fromJsonString(e,t){let n;try{n=JSON.parse(e)}catch(o){throw new Error(`cannot decode ${this.getType().typeName} from JSON: ${o instanceof Error?o.message:String(o)}`)}return this.fromJson(n,t)}toBinary(e){const t=this.getType().runtime.bin,n=t.makeWriteOptions(e),o=n.writerFactory();return t.writeMessage(this,o,n),o.finish()}toJson(e){const t=this.getType().runtime.json,n=t.makeWriteOptions(e);return t.writeMessage(this,n)}toJsonString(e){var t;const n=this.toJson(e);return JSON.stringify(n,null,null!==(t=null==e?void 0:e.prettySpaces)&&void 0!==t?t:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function ih(){let e=0,t=0;for(let o=0;o<28;o+=7){let n=this.buf[this.pos++];if(e|=(127&n)<<o,!(128&n))return this.assertBounds(),[e,t]}let n=this.buf[this.pos++];if(e|=(15&n)<<28,t=(112&n)>>4,!(128&n))return this.assertBounds(),[e,t];for(let o=3;o<=31;o+=7){let n=this.buf[this.pos++];if(t|=(127&n)<<o,!(128&n))return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function lh(e,t,n){for(let a=0;a<28;a+=7){const o=e>>>a,r=!(o>>>7==0&&0==t),s=255&(r?128|o:o);if(n.push(s),!r)return}const o=e>>>28&15|(7&t)<<4,r=!!(t>>3);if(n.push(255&(r?128|o:o)),r){for(let e=3;e<31;e+=7){const o=t>>>e,r=!(o>>>7==0),a=255&(r?128|o:o);if(n.push(a),!r)return}n.push(t>>>31&1)}}const ch=4294967296;function dh(e){const t="-"===e[0];t&&(e=e.slice(1));const n=1e6;let o=0,r=0;function a(t,a){const s=Number(e.slice(t,a));r*=n,o=o*n+s,o>=ch&&(r+=o/ch|0,o%=ch)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?mh(o,r):hh(o,r)}function uh(e,t){if(({lo:e,hi:t}=function(e,t){return{lo:e>>>0,hi:t>>>0}}(e,t)),t<=2097151)return String(ch*t+e);const n=16777215&(e>>>24|t<<8),o=t>>16&65535;let r=(16777215&e)+6777216*n+6710656*o,a=n+8147497*o,s=2*o;const i=1e7;return r>=i&&(a+=Math.floor(r/i),r%=i),a>=i&&(s+=Math.floor(a/i),a%=i),s.toString()+fh(a)+fh(r)}function hh(e,t){return{lo:0|e,hi:0|t}}function mh(e,t){return t=~t,e?e=1+~e:t+=1,hh(e,t)}const fh=e=>{const t=String(e);return"0000000".slice(t.length)+t};function ph(e,t){if(e>=0){for(;e>127;)t.push(127&e|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(127&e|128),e>>=7;t.push(1)}}function gh(){let e=this.buf[this.pos++],t=127&e;if(!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<7,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<14,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<21,!(128&e))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(15&e)<<28;for(let n=5;128&e&&n<10;n++)e=this.buf[this.pos++];if(128&e)throw new Error("invalid varint");return this.assertBounds(),t>>>0}var vh={};const xh=function(){const e=new DataView(new ArrayBuffer(8));if("function"==typeof BigInt&&"function"==typeof e.getBigInt64&&"function"==typeof e.getBigUint64&&"function"==typeof e.setBigInt64&&"function"==typeof e.setBigUint64&&("object"!=typeof process||"1"!==vh.BUF_BIGINT_DISABLE)){const t=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),r=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(e){const o="bigint"==typeof e?e:BigInt(e);if(o>n||o<t)throw new Error(`int64 invalid: ${e}`);return o},uParse(e){const t="bigint"==typeof e?e:BigInt(e);if(t>r||t<o)throw new Error(`uint64 invalid: ${e}`);return t},enc(t){return e.setBigInt64(0,this.parse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(t){return e.setBigInt64(0,this.uParse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec:(t,n)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigInt64(0,!0)),uDec:(t,n)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigUint64(0,!0))}}const t=e=>Ku(/^-?[0-9]+$/.test(e),`int64 invalid: ${e}`),n=e=>Ku(/^[0-9]+$/.test(e),`uint64 invalid: ${e}`);return{zero:"0",supported:!1,parse:e=>("string"!=typeof e&&(e=e.toString()),t(e),e),uParse:e=>("string"!=typeof e&&(e=e.toString()),n(e),e),enc:e=>("string"!=typeof e&&(e=e.toString()),t(e),dh(e)),uEnc:e=>("string"!=typeof e&&(e=e.toString()),n(e),dh(e)),dec:(e,t)=>function(e,t){let n=hh(e,t);const o=2147483648&n.hi;o&&(n=mh(n.lo,n.hi));const r=uh(n.lo,n.hi);return o?"-"+r:r}(e,t),uDec:(e,t)=>uh(e,t)}}();var yh,bh,wh,kh,Nh,Ch;function Eh(e,t,n){if(t===n)return!0;if(e==yh.BYTES){if(!(t instanceof Uint8Array&&n instanceof Uint8Array))return!1;if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==n[e])return!1;return!0}switch(e){case yh.UINT64:case yh.FIXED64:case yh.INT64:case yh.SFIXED64:case yh.SINT64:return t==n}return!1}function Sh(e,t){switch(e){case yh.BOOL:return!1;case yh.UINT64:case yh.FIXED64:case yh.INT64:case yh.SFIXED64:case yh.SINT64:return 0==t?xh.zero:"0";case yh.DOUBLE:case yh.FLOAT:return 0;case yh.BYTES:return new Uint8Array(0);case yh.STRING:return"";default:return 0}}function jh(e,t){switch(e){case yh.BOOL:return!1===t;case yh.STRING:return""===t;case yh.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return 0==t}}(bh=yh||(yh={}))[bh.DOUBLE=1]="DOUBLE",bh[bh.FLOAT=2]="FLOAT",bh[bh.INT64=3]="INT64",bh[bh.UINT64=4]="UINT64",bh[bh.INT32=5]="INT32",bh[bh.FIXED64=6]="FIXED64",bh[bh.FIXED32=7]="FIXED32",bh[bh.BOOL=8]="BOOL",bh[bh.STRING=9]="STRING",bh[bh.BYTES=12]="BYTES",bh[bh.UINT32=13]="UINT32",bh[bh.SFIXED32=15]="SFIXED32",bh[bh.SFIXED64=16]="SFIXED64",bh[bh.SINT32=17]="SINT32",bh[bh.SINT64=18]="SINT64",(kh=wh||(wh={}))[kh.BIGINT=0]="BIGINT",kh[kh.STRING=1]="STRING",(Ch=Nh||(Nh={}))[Ch.Varint=0]="Varint",Ch[Ch.Bit64=1]="Bit64",Ch[Ch.LengthDelimited=2]="LengthDelimited",Ch[Ch.StartGroup=3]="StartGroup",Ch[Ch.EndGroup=4]="EndGroup",Ch[Ch.Bit32=5]="Bit32";class _h{constructor(e){this.stack=[],this.textEncoder=null!=e?e:new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let o=0;o<this.chunks.length;o++)e+=this.chunks[o].length;let t=new Uint8Array(e),n=0;for(let o=0;o<this.chunks.length;o++)t.set(this.chunks[o],n),n+=this.chunks[o].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(Zu(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return Ju(e),ph(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 t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){Qu(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){Zu(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){Ju(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return Ju(e),ph(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),o=xh.enc(e);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),o=xh.uEnc(e);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(t)}int64(e){let t=xh.enc(e);return lh(t.lo,t.hi,this.buf),this}sint64(e){let t=xh.enc(e),n=t.hi>>31;return lh(t.lo<<1^n,(t.hi<<1|t.lo>>>31)^n,this.buf),this}uint64(e){let t=xh.uEnc(e);return lh(t.lo,t.hi,this.buf),this}}class Ih{constructor(e,t){this.varint64=ih,this.uint32=gh,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=null!=t?t:new TextDecoder}tag(){let e=this.uint32(),t=e>>>3,n=7&e;if(t<=0||n<0||n>5)throw new Error("illegal tag: field no "+t+" wire type "+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case Nh.Varint:for(;128&this.buf[this.pos++];);break;case Nh.Bit64:this.pos+=4;case Nh.Bit32:this.pos+=4;break;case Nh.LengthDelimited:let n=this.uint32();this.pos+=n;break;case Nh.StartGroup:for(;;){const[e,n]=this.tag();if(n===Nh.EndGroup){if(void 0!==t&&e!==t)throw new Error("invalid end group tag");break}this.skip(n,e)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(n,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 xh.dec(...this.varint64())}uint64(){return xh.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(1&e);return e=(e>>>1|(1&t)<<31)^n,t=t>>>1^n,xh.dec(e,t)}bool(){let[e,t]=this.varint64();return 0!==e||0!==t}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return xh.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return xh.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(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}}function Ah(e){const t=e.field.localName,n=Object.create(null);return n[t]=function(e){const t=e.field;if(t.repeated)return[];if(void 0!==t.default)return t.default;switch(t.kind){case"enum":return t.T.values[0].no;case"scalar":return Sh(t.T,t.L);case"message":const e=t.T,n=new e;return e.fieldWrapper?e.fieldWrapper.unwrapField(n):n;case"map":throw"map fields are not allowed to be extensions"}}(e),[n,()=>n[t]]}let Mh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Th=[];for(let vO=0;vO<Mh.length;vO++)Th[Mh[vO].charCodeAt(0)]=vO;Th["-".charCodeAt(0)]=Mh.indexOf("+"),Th["_".charCodeAt(0)]=Mh.indexOf("/");const Oh={dec(e){let t=3*e.length/4;"="==e[e.length-2]?t-=2:"="==e[e.length-1]&&(t-=1);let n,o=new Uint8Array(t),r=0,a=0,s=0;for(let i=0;i<e.length;i++){if(n=Th[e.charCodeAt(i)],void 0===n)switch(e[i]){case"=":a=0;case"\n":case"\r":case"\t":case" ":continue;default:throw Error("invalid base64 string.")}switch(a){case 0:s=n,a=1;break;case 1:o[r++]=s<<2|(48&n)>>4,s=n,a=2;break;case 2:o[r++]=(15&s)<<4|(60&n)>>2,s=n,a=3;break;case 3:o[r++]=(3&s)<<6|n,a=0}}if(1==a)throw Error("invalid base64 string.");return o.subarray(0,r)},enc(e){let t,n="",o=0,r=0;for(let a=0;a<e.length;a++)switch(t=e[a],o){case 0:n+=Mh[t>>2],r=(3&t)<<4,o=1;break;case 1:n+=Mh[r|t>>4],r=(15&t)<<2,o=2;break;case 2:n+=Mh[r|t>>6],n+=Mh[63&t],o=0}return o&&(n+=Mh[r],n+="=",1==o&&(n+="=")),n}};function Dh(e,t,n){Fh(t,e);const o=t.runtime.bin.makeReadOptions(n),r=function(e,t){if(!t.repeated&&("enum"==t.kind||"scalar"==t.kind)){for(let n=e.length-1;n>=0;--n)if(e[n].no==t.no)return[e[n]];return[]}return e.filter((e=>e.no===t.no))}(e.getType().runtime.bin.listUnknownFields(e),t.field),[a,s]=Ah(t);for(const i of r)t.runtime.bin.readField(a,o.readerFactory(i.data),t.field,i.wireType,o);return s()}function Ph(e,t,n,o){Fh(t,e);const r=t.runtime.bin.makeReadOptions(o),a=t.runtime.bin.makeWriteOptions(o);if(Rh(e,t)){const n=e.getType().runtime.bin.listUnknownFields(e).filter((e=>e.no!=t.field.no));e.getType().runtime.bin.discardUnknownFields(e);for(const t of n)e.getType().runtime.bin.onUnknownField(e,t.no,t.wireType,t.data)}const s=a.writerFactory();let i=t.field;i.opt||i.repeated||"enum"!=i.kind&&"scalar"!=i.kind||(i=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(i,n,s,a);const l=r.readerFactory(s.finish());for(;l.pos<l.len;){const[t,n]=l.tag(),o=l.skip(n,t);e.getType().runtime.bin.onUnknownField(e,t,n,o)}}function Rh(e,t){const n=e.getType();return t.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(e).find((e=>e.no==t.field.no))}function Fh(e,t){Ku(e.extendee.typeName==t.getType().typeName,`extension ${e.typeName} can only be applied to message ${e.extendee.typeName}`)}function Lh(e,t){const n=e.localName;if(e.repeated)return t[n].length>0;if(e.oneof)return t[e.oneof.localName].case===n;switch(e.kind){case"enum":case"scalar":return e.opt||e.req?void 0!==t[n]:"enum"==e.kind?t[n]!==e.T.values[0].no:!jh(e.T,t[n]);case"message":return void 0!==t[n];case"map":return Object.keys(t[n]).length>0}}function zh(e,t){const n=e.localName,o=!e.opt&&!e.req;if(e.repeated)t[n]=[];else if(e.oneof)t[e.oneof.localName]={case:void 0};else switch(e.kind){case"map":t[n]={};break;case"enum":t[n]=o?e.T.values[0].no:void 0;break;case"scalar":t[n]=o?Sh(e.T,e.L):void 0;break;case"message":t[n]=void 0}}function Bh(e,t){if(null===e||"object"!=typeof e)return!1;if(!Object.getOwnPropertyNames(sh.prototype).every((t=>t in e&&"function"==typeof e[t])))return!1;const n=e.getType();return null!==n&&"function"==typeof n&&"typeName"in n&&"string"==typeof n.typeName&&(void 0===t||n.typeName==t.typeName)}function Uh(e,t){return Bh(t)||!e.fieldWrapper?t:e.fieldWrapper.wrapField(t)}yh.DOUBLE,yh.FLOAT,yh.INT64,yh.UINT64,yh.INT32,yh.UINT32,yh.BOOL,yh.STRING,yh.BYTES;const Vh={ignoreUnknownFields:!1},Gh={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function $h(e){return e?Object.assign(Object.assign({},Vh),e):Vh}function Hh(e){return e?Object.assign(Object.assign({},Gh),e):Gh}const Wh=Symbol(),qh=Symbol();function Yh(e){if(null===e)return"null";switch(typeof e){case"object":return Array.isArray(e)?"array":"object";case"string":return e.length>100?"string":`"${e.split('"').join('\\"')}"`;default:return String(e)}}function Xh(e,t,n,o,r){let a=n.localName;if(n.repeated){if(Ku("map"!=n.kind),null===t)return;if(!Array.isArray(t))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Yh(t)}`);const i=e[a];for(const e of t){if(null===e)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Yh(e)}`);switch(n.kind){case"message":i.push(n.T.fromJson(e,o));break;case"enum":const t=Zh(n.T,e,o.ignoreUnknownFields,!0);t!==qh&&i.push(t);break;case"scalar":try{i.push(Jh(n.T,e,n.L,!0))}catch(s){let t=`cannot decode field ${r.typeName}.${n.name} from JSON: ${Yh(e)}`;throw s instanceof Error&&s.message.length>0&&(t+=`: ${s.message}`),new Error(t)}}}}else if("map"==n.kind){if(null===t)return;if("object"!=typeof t||Array.isArray(t))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Yh(t)}`);const i=e[a];for(const[e,a]of Object.entries(t)){if(null===a)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: map value null`);let l;try{l=Kh(n.K,e)}catch(s){let e=`cannot decode map key for field ${r.typeName}.${n.name} from JSON: ${Yh(t)}`;throw s instanceof Error&&s.message.length>0&&(e+=`: ${s.message}`),new Error(e)}switch(n.V.kind){case"message":i[l]=n.V.T.fromJson(a,o);break;case"enum":const e=Zh(n.V.T,a,o.ignoreUnknownFields,!0);e!==qh&&(i[l]=e);break;case"scalar":try{i[l]=Jh(n.V.T,a,wh.BIGINT,!0)}catch(s){let e=`cannot decode map value for field ${r.typeName}.${n.name} from JSON: ${Yh(t)}`;throw s instanceof Error&&s.message.length>0&&(e+=`: ${s.message}`),new Error(e)}}}}else switch(n.oneof&&(e=e[n.oneof.localName]={case:a},a="value"),n.kind){case"message":const i=n.T;if(null===t&&"google.protobuf.Value"!=i.typeName)return;let l=e[a];Bh(l)?l.fromJson(t,o):(e[a]=l=i.fromJson(t,o),i.fieldWrapper&&!n.oneof&&(e[a]=i.fieldWrapper.unwrapField(l)));break;case"enum":const c=Zh(n.T,t,o.ignoreUnknownFields,!1);switch(c){case Wh:zh(n,e);break;case qh:break;default:e[a]=c}break;case"scalar":try{const o=Jh(n.T,t,n.L,!1);if(o===Wh)zh(n,e);else e[a]=o}catch(s){let e=`cannot decode field ${r.typeName}.${n.name} from JSON: ${Yh(t)}`;throw s instanceof Error&&s.message.length>0&&(e+=`: ${s.message}`),new Error(e)}}}function Kh(e,t){if(e===yh.BOOL)switch(t){case"true":t=!0;break;case"false":t=!1}return Jh(e,t,wh.BIGINT,!0).toString()}function Jh(e,t,n,o){if(null===t)return o?Sh(e,n):Wh;switch(e){case yh.DOUBLE:case yh.FLOAT:if("NaN"===t)return Number.NaN;if("Infinity"===t)return Number.POSITIVE_INFINITY;if("-Infinity"===t)return Number.NEGATIVE_INFINITY;if(""===t)break;if("string"==typeof t&&t.trim().length!==t.length)break;if("string"!=typeof t&&"number"!=typeof t)break;const o=Number(t);if(Number.isNaN(o))break;if(!Number.isFinite(o))break;return e==yh.FLOAT&&Qu(o),o;case yh.INT32:case yh.FIXED32:case yh.SFIXED32:case yh.SINT32:case yh.UINT32:let a;if("number"==typeof t?a=t:"string"==typeof t&&t.length>0&&t.trim().length===t.length&&(a=Number(t)),void 0===a)break;return e==yh.UINT32||e==yh.FIXED32?Zu(a):Ju(a),a;case yh.INT64:case yh.SFIXED64:case yh.SINT64:if("number"!=typeof t&&"string"!=typeof t)break;const s=xh.parse(t);return n?s.toString():s;case yh.FIXED64:case yh.UINT64:if("number"!=typeof t&&"string"!=typeof t)break;const i=xh.uParse(t);return n?i.toString():i;case yh.BOOL:if("boolean"!=typeof t)break;return t;case yh.STRING:if("string"!=typeof t)break;try{encodeURIComponent(t)}catch(r){throw new Error("invalid UTF8")}return t;case yh.BYTES:if(""===t)return new Uint8Array(0);if("string"!=typeof t)break;return Oh.dec(t)}throw new Error}function Zh(e,t,n,o){if(null===t)return"google.protobuf.NullValue"==e.typeName?0:o?e.values[0].no:Wh;switch(typeof t){case"number":if(Number.isInteger(t))return t;break;case"string":const o=e.findName(t);if(void 0!==o)return o.no;if(n)return qh}throw new Error(`cannot decode enum ${e.typeName} from JSON: ${Yh(t)}`)}function Qh(e){return!(!e.repeated&&"map"!=e.kind)||!e.oneof&&("message"!=e.kind&&(!e.opt&&!e.req))}function em(e,t,n){if("map"==e.kind){Ku("object"==typeof t&&null!=t);const o={},r=Object.entries(t);switch(e.V.kind){case"scalar":for(const[n,a]of r)o[n.toString()]=nm(e.V.T,a);break;case"message":for(const[e,a]of r)o[e.toString()]=a.toJson(n);break;case"enum":const t=e.V.T;for(const[e,a]of r)o[e.toString()]=tm(t,a,n.enumAsInteger)}return n.emitDefaultValues||r.length>0?o:void 0}if(e.repeated){Ku(Array.isArray(t));const o=[];switch(e.kind){case"scalar":for(let n=0;n<t.length;n++)o.push(nm(e.T,t[n]));break;case"enum":for(let r=0;r<t.length;r++)o.push(tm(e.T,t[r],n.enumAsInteger));break;case"message":for(let e=0;e<t.length;e++)o.push(t[e].toJson(n))}return n.emitDefaultValues||o.length>0?o:void 0}switch(e.kind){case"scalar":return nm(e.T,t);case"enum":return tm(e.T,t,n.enumAsInteger);case"message":return Uh(e.T,t).toJson(n)}}function tm(e,t,n){var o;if(Ku("number"==typeof t),"google.protobuf.NullValue"==e.typeName)return null;if(n)return t;const r=e.findNumber(t);return null!==(o=null==r?void 0:r.name)&&void 0!==o?o:t}function nm(e,t){switch(e){case yh.INT32:case yh.SFIXED32:case yh.SINT32:case yh.FIXED32:case yh.UINT32:return Ku("number"==typeof t),t;case yh.FLOAT:case yh.DOUBLE:return Ku("number"==typeof t),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t;case yh.STRING:return Ku("string"==typeof t),t;case yh.BOOL:return Ku("boolean"==typeof t),t;case yh.UINT64:case yh.FIXED64:case yh.INT64:case yh.SFIXED64:case yh.SINT64:return Ku("bigint"==typeof t||"string"==typeof t||"number"==typeof t),t.toString();case yh.BYTES:return Ku(t instanceof Uint8Array),Oh.enc(t)}}const om=Symbol("@bufbuild/protobuf/unknown-fields"),rm={readUnknownFields:!0,readerFactory:e=>new Ih(e)},am={writeUnknownFields:!0,writerFactory:()=>new _h};function sm(e){return e?Object.assign(Object.assign({},rm),e):rm}function im(e){return e?Object.assign(Object.assign({},am),e):am}function lm(e,t,n,o,r){let{repeated:a,localName:s}=n;switch(n.oneof&&((e=e[n.oneof.localName]).case!=s&&delete e.value,e.case=s,s="value"),n.kind){case"scalar":case"enum":const i="enum"==n.kind?yh.INT32:n.T;let l=um;if("scalar"==n.kind&&n.L>0&&(l=dm),a){let n=e[s];if(o==Nh.LengthDelimited&&i!=yh.STRING&&i!=yh.BYTES){let e=t.uint32()+t.pos;for(;t.pos<e;)n.push(l(t,i))}else n.push(l(t,i))}else e[s]=l(t,i);break;case"message":const c=n.T;a?e[s].push(cm(t,new c,r,n)):Bh(e[s])?cm(t,e[s],r,n):(e[s]=cm(t,new c,r,n),!c.fieldWrapper||n.oneof||n.repeated||(e[s]=c.fieldWrapper.unwrapField(e[s])));break;case"map":let[d,u]=function(e,t,n){const o=t.uint32(),r=t.pos+o;let a,s;for(;t.pos<r;){const[o]=t.tag();switch(o){case 1:a=um(t,e.K);break;case 2:switch(e.V.kind){case"scalar":s=um(t,e.V.T);break;case"enum":s=t.int32();break;case"message":s=cm(t,new e.V.T,n,void 0)}}}void 0===a&&(a=Sh(e.K,wh.BIGINT));"string"!=typeof a&&"number"!=typeof a&&(a=a.toString());if(void 0===s)switch(e.V.kind){case"scalar":s=Sh(e.V.T,wh.BIGINT);break;case"enum":s=e.V.T.values[0].no;break;case"message":s=new e.V.T}return[a,s]}(n,t,r);e[s][d]=u}}function cm(e,t,n,o){const r=t.getType().runtime.bin,a=null==o?void 0:o.delimited;return r.readMessage(t,e,a?o.no:e.uint32(),n,a),t}function dm(e,t){const n=um(e,t);return"bigint"==typeof n?n.toString():n}function um(e,t){switch(t){case yh.STRING:return e.string();case yh.BOOL:return e.bool();case yh.DOUBLE:return e.double();case yh.FLOAT:return e.float();case yh.INT32:return e.int32();case yh.INT64:return e.int64();case yh.UINT64:return e.uint64();case yh.FIXED64:return e.fixed64();case yh.BYTES:return e.bytes();case yh.FIXED32:return e.fixed32();case yh.SFIXED32:return e.sfixed32();case yh.SFIXED64:return e.sfixed64();case yh.SINT64:return e.sint64();case yh.UINT32:return e.uint32();case yh.SINT32:return e.sint32()}}function hm(e,t,n,o){Ku(void 0!==t);const r=e.repeated;switch(e.kind){case"scalar":case"enum":let a="enum"==e.kind?yh.INT32:e.T;if(r)if(Ku(Array.isArray(t)),e.packed)!function(e,t,n,o){if(!o.length)return;e.tag(n,Nh.LengthDelimited).fork();let[,r]=gm(t);for(let a=0;a<o.length;a++)e[r](o[a]);e.join()}(n,a,e.no,t);else for(const o of t)pm(n,a,e.no,o);else pm(n,a,e.no,t);break;case"message":if(r){Ku(Array.isArray(t));for(const r of t)fm(n,o,e,r)}else fm(n,o,e,t);break;case"map":Ku("object"==typeof t&&null!=t);for(const[r,s]of Object.entries(t))mm(n,o,e,r,s)}}function mm(e,t,n,o,r){e.tag(n.no,Nh.LengthDelimited),e.fork();let a=o;switch(n.K){case yh.INT32:case yh.FIXED32:case yh.UINT32:case yh.SFIXED32:case yh.SINT32:a=Number.parseInt(o);break;case yh.BOOL:Ku("true"==o||"false"==o),a="true"==o}switch(pm(e,n.K,1,a),n.V.kind){case"scalar":pm(e,n.V.T,2,r);break;case"enum":pm(e,yh.INT32,2,r);break;case"message":Ku(void 0!==r),e.tag(2,Nh.LengthDelimited).bytes(r.toBinary(t))}e.join()}function fm(e,t,n,o){const r=Uh(n.T,o);n.delimited?e.tag(n.no,Nh.StartGroup).raw(r.toBinary(t)).tag(n.no,Nh.EndGroup):e.tag(n.no,Nh.LengthDelimited).bytes(r.toBinary(t))}function pm(e,t,n,o){Ku(void 0!==o);let[r,a]=gm(t);e.tag(n,r)[a](o)}function gm(e){let t=Nh.Varint;switch(e){case yh.BYTES:case yh.STRING:t=Nh.LengthDelimited;break;case yh.DOUBLE:case yh.FIXED64:case yh.SFIXED64:t=Nh.Bit64;break;case yh.FIXED32:case yh.SFIXED32:case yh.FLOAT:t=Nh.Bit32}return[t,yh[e].toLowerCase()]}function vm(e){if(void 0===e)return e;if(Bh(e))return e.clone();if(e instanceof Uint8Array){const t=new Uint8Array(e.byteLength);return t.set(e),t}return e}function xm(e){return e instanceof Uint8Array?e:new Uint8Array(e)}class ym{constructor(e,t){this._fields=e,this._normalizer=t}findJsonName(e){if(!this.jsonNames){const e={};for(const t of this.list())e[t.jsonName]=e[t.name]=t;this.jsonNames=e}return this.jsonNames[e]}find(e){if(!this.numbers){const e={};for(const t of this.list())e[t.no]=t;this.numbers=e}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,t)=>e.no-t.no))),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let t;for(const n of this.list())n.oneof?n.oneof!==t&&(t=n.oneof,e.push(t)):e.push(n)}return this.members}}function bm(e,t){const n=km(e);return t?n:jm(Sm(n))}const wm=km;function km(e){let t=!1;const n=[];for(let o=0;o<e.length;o++){let r=e.charAt(o);switch(r){case"_":t=!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),t=!1;break;default:t&&(t=!1,r=r.toUpperCase()),n.push(r)}}return n.join("")}const Nm=new Set(["constructor","toString","toJSON","valueOf"]),Cm=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),Em=e=>`${e}$`,Sm=e=>Cm.has(e)?Em(e):e,jm=e=>Nm.has(e)?Em(e):e;class _m{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=bm(e,!1)}addField(e){Ku(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 e=0;e<this.fields.length;e++)this._lookup[this.fields[e].localName]=this.fields[e]}return this._lookup[e]}}const Im=(Am=e=>new ym(e,(e=>function(e){var t,n,o,r,a,s;const i=[];let l;for(const c of"function"==typeof e?e():e){const e=c;if(e.localName=bm(c.name,void 0!==c.oneof),e.jsonName=null!==(t=c.jsonName)&&void 0!==t?t:wm(c.name),e.repeated=null!==(n=c.repeated)&&void 0!==n&&n,"scalar"==c.kind&&(e.L=null!==(o=c.L)&&void 0!==o?o:wh.BIGINT),e.delimited=null!==(r=c.delimited)&&void 0!==r&&r,e.req=null!==(a=c.req)&&void 0!==a&&a,e.opt=null!==(s=c.opt)&&void 0!==s&&s,void 0===c.packed&&(e.packed="enum"==c.kind||"scalar"==c.kind&&c.T!=yh.BYTES&&c.T!=yh.STRING),void 0!==c.oneof){const t="string"==typeof c.oneof?c.oneof:c.oneof.name;l&&l.name==t||(l=new _m(t)),e.oneof=l,l.addField(e)}i.push(e)}return i}(e))),Mm=e=>{for(const t of e.getType().fields.byMember()){if(t.opt)continue;const n=t.localName,o=e;if(t.repeated)o[n]=[];else switch(t.kind){case"oneof":o[n]={case:void 0};break;case"enum":o[n]=0;break;case"map":o[n]={};break;case"scalar":o[n]=Sh(t.T,t.L)}}},{syntax:"proto3",json:{makeReadOptions:$h,makeWriteOptions:Hh,readMessage(e,t,n,o){if(null==t||Array.isArray(t)||"object"!=typeof t)throw new Error(`cannot decode message ${e.typeName} from JSON: ${Yh(t)}`);o=null!=o?o:new e;const r=new Map,a=n.typeRegistry;for(const[s,i]of Object.entries(t)){const t=e.fields.findJsonName(s);if(t){if(t.oneof){if(null===i&&"scalar"==t.kind)continue;const n=r.get(t.oneof);if(void 0!==n)throw new Error(`cannot decode message ${e.typeName} from JSON: multiple keys for oneof "${t.oneof.name}" present: "${n}", "${s}"`);r.set(t.oneof,s)}Xh(o,i,t,n,e)}else{let t=!1;if((null==a?void 0:a.findExtension)&&s.startsWith("[")&&s.endsWith("]")){const r=a.findExtension(s.substring(1,s.length-1));if(r&&r.extendee.typeName==e.typeName){t=!0;const[e,a]=Ah(r);Xh(e,i,r.field,n,r),Ph(o,r,a(),n)}}if(!t&&!n.ignoreUnknownFields)throw new Error(`cannot decode message ${e.typeName} from JSON: key "${s}" is unknown`)}}return o},writeMessage(e,t){const n=e.getType(),o={};let r;try{for(r of n.fields.byNumber()){if(!Lh(r,e)){if(r.req)throw"required field not set";if(!t.emitDefaultValues)continue;if(!Qh(r))continue}const n=em(r,r.oneof?e[r.oneof.localName].value:e[r.localName],t);void 0!==n&&(o[t.useProtoFieldName?r.name:r.jsonName]=n)}const a=t.typeRegistry;if(null==a?void 0:a.findExtensionFor)for(const r of n.runtime.bin.listUnknownFields(e)){const s=a.findExtensionFor(n.typeName,r.no);if(s&&Rh(e,s)){const n=Dh(e,s,t),r=em(s.field,n,t);void 0!==r&&(o[s.field.jsonName]=r)}}}catch(a){const e=r?`cannot encode field ${n.typeName}.${r.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,t=a instanceof Error?a.message:String(a);throw new Error(e+(t.length>0?`: ${t}`:""))}return o},readScalar:(e,t,n)=>Jh(e,t,null!=n?n:wh.BIGINT,!0),writeScalar(e,t,n){if(void 0!==t)return n||jh(e,t)?nm(e,t):void 0},debug:Yh},bin:{makeReadOptions:sm,makeWriteOptions:im,listUnknownFields(e){var t;return null!==(t=e[om])&&void 0!==t?t:[]},discardUnknownFields(e){delete e[om]},writeUnknownFields(e,t){const n=e[om];if(n)for(const o of n)t.tag(o.no,o.wireType).raw(o.data)},onUnknownField(e,t,n,o){const r=e;Array.isArray(r[om])||(r[om]=[]),r[om].push({no:t,wireType:n,data:o})},readMessage(e,t,n,o,r){const a=e.getType(),s=r?t.len:t.pos+n;let i,l;for(;t.pos<s&&([i,l]=t.tag(),!0!==r||l!=Nh.EndGroup);){const n=a.fields.find(i);if(n)lm(e,t,n,l,o);else{const n=t.skip(l,i);o.readUnknownFields&&this.onUnknownField(e,i,l,n)}}if(r&&(l!=Nh.EndGroup||i!==n))throw new Error("invalid end group tag")},readField:lm,writeMessage(e,t,n){const o=e.getType();for(const r of o.fields.byNumber())if(Lh(r,e))hm(r,r.oneof?e[r.oneof.localName].value:e[r.localName],t,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(e,t),t},writeField(e,t,n,o){void 0!==t&&hm(e,t,n,o)}},util:Object.assign(Object.assign({},{setEnumType:nh,initPartial(e,t){if(void 0===e)return;const n=t.getType();for(const o of n.fields.byMember()){const n=o.localName,r=t,a=e;if(null!=a[n])switch(o.kind){case"oneof":const e=a[n].case;if(void 0===e)continue;const t=o.findField(e);let s=a[n].value;t&&"message"==t.kind&&!Bh(s,t.T)?s=new t.T(s):t&&"scalar"===t.kind&&t.T===yh.BYTES&&(s=xm(s)),r[n]={case:e,value:s};break;case"scalar":case"enum":let i=a[n];o.T===yh.BYTES&&(i=o.repeated?i.map(xm):xm(i)),r[n]=i;break;case"map":switch(o.V.kind){case"scalar":case"enum":if(o.V.T===yh.BYTES)for(const[t,o]of Object.entries(a[n]))r[n][t]=xm(o);else Object.assign(r[n],a[n]);break;case"message":const e=o.V.T;for(const t of Object.keys(a[n])){let o=a[n][t];e.fieldWrapper||(o=new e(o)),r[n][t]=o}}break;case"message":const l=o.T;if(o.repeated)r[n]=a[n].map((e=>Bh(e,l)?e:new l(e)));else{const e=a[n];l.fieldWrapper?"google.protobuf.BytesValue"===l.typeName?r[n]=xm(e):r[n]=e:r[n]=Bh(e,l)?e:new l(e)}}}},equals:(e,t,n)=>t===n||!(!t||!n)&&e.fields.byMember().every((e=>{const o=t[e.localName],r=n[e.localName];if(e.repeated){if(o.length!==r.length)return!1;switch(e.kind){case"message":return o.every(((t,n)=>e.T.equals(t,r[n])));case"scalar":return o.every(((t,n)=>Eh(e.T,t,r[n])));case"enum":return o.every(((e,t)=>Eh(yh.INT32,e,r[t])))}throw new Error(`repeated cannot contain ${e.kind}`)}switch(e.kind){case"message":return e.T.equals(o,r);case"enum":return Eh(yh.INT32,o,r);case"scalar":return Eh(e.T,o,r);case"oneof":if(o.case!==r.case)return!1;const t=e.findField(o.case);if(void 0===t)return!0;switch(t.kind){case"message":return t.T.equals(o.value,r.value);case"enum":return Eh(yh.INT32,o.value,r.value);case"scalar":return Eh(t.T,o.value,r.value)}throw new Error(`oneof cannot contain ${t.kind}`);case"map":const n=Object.keys(o).concat(Object.keys(r));switch(e.V.kind){case"message":const t=e.V.T;return n.every((e=>t.equals(o[e],r[e])));case"enum":return n.every((e=>Eh(yh.INT32,o[e],r[e])));case"scalar":const a=e.V.T;return n.every((e=>Eh(a,o[e],r[e])))}}})),clone(e){const t=e.getType(),n=new t,o=n;for(const r of t.fields.byMember()){const t=e[r.localName];let n;if(r.repeated)n=t.map(vm);else if("map"==r.kind){n=o[r.localName];for(const[e,o]of Object.entries(t))n[e]=vm(o)}else n="oneof"==r.kind?r.findField(t.case)?{case:t.case,value:vm(t.value)}:{case:void 0}:vm(t);o[r.localName]=n}for(const r of t.runtime.bin.listUnknownFields(e))t.runtime.bin.onUnknownField(o,r.no,r.wireType,r.data);return n}}),{newFieldList:Am,initFields:Mm}),makeMessageType(e,t,n){return function(e,t,n,o){var r;const a=null!==(r=null==o?void 0:o.localName)&&void 0!==r?r:t.substring(t.lastIndexOf(".")+1),s={[a]:function(t){e.util.initFields(this),e.util.initPartial(t,this)}}[a];return Object.setPrototypeOf(s.prototype,new sh),Object.assign(s,{runtime:e,typeName:t,fields:e.util.newFieldList(n),fromBinary:(e,t)=>(new s).fromBinary(e,t),fromJson:(e,t)=>(new s).fromJson(e,t),fromJsonString:(e,t)=>(new s).fromJsonString(e,t),equals:(t,n)=>e.util.equals(s,t,n)}),s}(this,e,t,n)},makeEnum:rh,makeEnumType:oh,getEnumType:th,makeExtension(e,t,n){return function(e,t,n,o){let r;return{typeName:t,extendee:n,get field(){if(!r){const n="function"==typeof o?o():o;n.name=t.split(".").pop(),n.jsonName=`[${t}]`,r=e.util.newFieldList([n]).list()[0]}return r},runtime:e}}(this,e,t,n)}});var Am,Mm,Tm,Om,Dm,Pm,Rm,Fm,Lm,zm,Bm,Um,Vm,Gm,$m,Hm;(Om=Tm||(Tm={}))[Om.Unary=0]="Unary",Om[Om.ServerStreaming=1]="ServerStreaming",Om[Om.ClientStreaming=2]="ClientStreaming",Om[Om.BiDiStreaming=3]="BiDiStreaming",(Pm=Dm||(Dm={}))[Pm.NoSideEffects=1]="NoSideEffects",Pm[Pm.Idempotent=2]="Idempotent",(Fm=Rm||(Rm={}))[Fm.UNSPECIFIED=0]="UNSPECIFIED",Fm[Fm.JUPYTER_FORMAT=77]="JUPYTER_FORMAT",Im.util.setEnumType(Rm,"exa.codeium_common_pb.ExperimentKey",[{no:0,name:"UNSPECIFIED"},{no:77,name:"JUPYTER_FORMAT"}]),(zm=Lm||(Lm={}))[zm.CODEIUM=0]="CODEIUM",Im.util.setEnumType(Lm,"exa.codeium_common_pb.AuthSource",[{no:0,name:"AUTH_SOURCE_CODEIUM"}]),(Um=Bm||(Bm={}))[Um.UNSPECIFIED=0]="UNSPECIFIED",Um[Um.ENABLE_CODEIUM=1]="ENABLE_CODEIUM",Um[Um.DISABLE_CODEIUM=2]="DISABLE_CODEIUM",Um[Um.SHOW_PREVIOUS_COMPLETION=3]="SHOW_PREVIOUS_COMPLETION",Um[Um.SHOW_NEXT_COMPLETION=4]="SHOW_NEXT_COMPLETION",Im.util.setEnumType(Bm,"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"}]),(Gm=Vm||(Vm={}))[Gm.UNSPECIFIED=0]="UNSPECIFIED",Gm[Gm.TYPING_AS_SUGGESTED=1]="TYPING_AS_SUGGESTED",Gm[Gm.CACHE=2]="CACHE",Gm[Gm.NETWORK=3]="NETWORK",Im.util.setEnumType(Vm,"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"}]),(Hm=$m||($m={}))[Hm.UNSPECIFIED=0]="UNSPECIFIED",Hm[Hm.C=1]="C",Hm[Hm.CLOJURE=2]="CLOJURE",Hm[Hm.COFFEESCRIPT=3]="COFFEESCRIPT",Hm[Hm.CPP=4]="CPP",Hm[Hm.CSHARP=5]="CSHARP",Hm[Hm.CSS=6]="CSS",Hm[Hm.CUDACPP=7]="CUDACPP",Hm[Hm.DOCKERFILE=8]="DOCKERFILE",Hm[Hm.GO=9]="GO",Hm[Hm.GROOVY=10]="GROOVY",Hm[Hm.HANDLEBARS=11]="HANDLEBARS",Hm[Hm.HASKELL=12]="HASKELL",Hm[Hm.HCL=13]="HCL",Hm[Hm.HTML=14]="HTML",Hm[Hm.INI=15]="INI",Hm[Hm.JAVA=16]="JAVA",Hm[Hm.JAVASCRIPT=17]="JAVASCRIPT",Hm[Hm.JSON=18]="JSON",Hm[Hm.JULIA=19]="JULIA",Hm[Hm.KOTLIN=20]="KOTLIN",Hm[Hm.LATEX=21]="LATEX",Hm[Hm.LESS=22]="LESS",Hm[Hm.LUA=23]="LUA",Hm[Hm.MAKEFILE=24]="MAKEFILE",Hm[Hm.MARKDOWN=25]="MARKDOWN",Hm[Hm.OBJECTIVEC=26]="OBJECTIVEC",Hm[Hm.OBJECTIVECPP=27]="OBJECTIVECPP",Hm[Hm.PERL=28]="PERL",Hm[Hm.PHP=29]="PHP",Hm[Hm.PLAINTEXT=30]="PLAINTEXT",Hm[Hm.PROTOBUF=31]="PROTOBUF",Hm[Hm.PBTXT=32]="PBTXT",Hm[Hm.PYTHON=33]="PYTHON",Hm[Hm.R=34]="R",Hm[Hm.RUBY=35]="RUBY",Hm[Hm.RUST=36]="RUST",Hm[Hm.SASS=37]="SASS",Hm[Hm.SCALA=38]="SCALA",Hm[Hm.SCSS=39]="SCSS",Hm[Hm.SHELL=40]="SHELL",Hm[Hm.SQL=41]="SQL",Hm[Hm.STARLARK=42]="STARLARK",Hm[Hm.SWIFT=43]="SWIFT",Hm[Hm.TSX=44]="TSX",Hm[Hm.TYPESCRIPT=45]="TYPESCRIPT",Hm[Hm.VISUALBASIC=46]="VISUALBASIC",Hm[Hm.VUE=47]="VUE",Hm[Hm.XML=48]="XML",Hm[Hm.XSL=49]="XSL",Hm[Hm.YAML=50]="YAML",Hm[Hm.SVELTE=51]="SVELTE",Hm[Hm.TOML=52]="TOML",Hm[Hm.DART=53]="DART",Hm[Hm.RST=54]="RST",Hm[Hm.OCAML=55]="OCAML",Hm[Hm.CMAKE=56]="CMAKE",Hm[Hm.PASCAL=57]="PASCAL",Hm[Hm.ELIXIR=58]="ELIXIR",Hm[Hm.FSHARP=59]="FSHARP",Hm[Hm.LISP=60]="LISP",Hm[Hm.MATLAB=61]="MATLAB",Hm[Hm.POWERSHELL=62]="POWERSHELL",Hm[Hm.SOLIDITY=63]="SOLIDITY",Hm[Hm.ADA=64]="ADA",Hm[Hm.OCAML_INTERFACE=65]="OCAML_INTERFACE",Im.util.setEnumType($m,"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 Wm=class e extends sh{constructor(e){super(),n(this,"completionId",""),n(this,"text",""),n(this,"prefix",""),n(this,"stop",""),n(this,"score",0),n(this,"tokens",[]),n(this,"decodedTokens",[]),n(this,"probabilities",[]),n(this,"adjustedProbabilities",[]),n(this,"generatedLength",xh.zero),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(Wm,"runtime",Im),n(Wm,"typeName","exa.codeium_common_pb.Completion"),n(Wm,"fields",Im.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 qm=Wm;const Ym=class e extends sh{constructor(e){super(),n(this,"ideName",""),n(this,"ideVersion",""),n(this,"extensionName",""),n(this,"extensionVersion",""),n(this,"apiKey",""),n(this,"locale",""),n(this,"sessionId",""),n(this,"requestId",xh.zero),n(this,"userAgent",""),n(this,"url",""),n(this,"authSource",Lm.CODEIUM),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(Ym,"runtime",Im),n(Ym,"typeName","exa.codeium_common_pb.Metadata"),n(Ym,"fields",Im.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:Im.getEnumType(Lm)}])));let Xm=Ym;const Km=class e extends sh{constructor(e){super(),n(this,"tabSize",xh.zero),n(this,"insertSpaces",!1),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(Km,"runtime",Im),n(Km,"typeName","exa.codeium_common_pb.EditorOptions"),n(Km,"fields",Im.util.newFieldList((()=>[{no:1,name:"tab_size",kind:"scalar",T:4},{no:2,name:"insert_spaces",kind:"scalar",T:8}])));let Jm=Km;e=class extends sh{constructor(e){super(),n(this,"eventType",Bm.UNSPECIFIED),n(this,"eventJson",""),n(this,"timestampUnixMs",xh.zero),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}},n(e,"runtime",Im),n(e,"typeName","exa.codeium_common_pb.Event"),n(e,"fields",Im.util.newFieldList((()=>[{no:1,name:"event_type",kind:"enum",T:Im.getEnumType(Bm)},{no:2,name:"event_json",kind:"scalar",T:9},{no:3,name:"timestamp_unix_ms",kind:"scalar",T:3}])));class Zm extends xn{constructor(e,t){super(),n(this,"index"),n(this,"total"),this.index=e,this.total=t}toDOM(){const e=document.createElement("span");e.setAttribute("aria-hidden","true"),e.className="cm-codeium-cycle";const t=e.appendChild(document.createElement("span"));t.className="cm-codeium-cycle-explanation",t.innerText=`${this.index+1}/${this.total}`;const n=e.appendChild(document.createElement("button"));return n.className="cm-codeium-cycle-key",n.innerText="→ (Ctrl ])",n.dataset.action="codeium-cycle",e}ignoreEvent(){return!1}}const Qm=yn.define({combine:e=>bn(e,{language:$m.TYPESCRIPT,timeout:150,widgetClass:Zm,alwaysOn:!0},{})}),ef=yn.define({combine:e=>bn(e,{override:()=>[]},{})}),tf=Kt.mark({class:"cm-ghostText"}),nf=Xt.define({create:e=>null,update(e,t){var n;const o=t.state.facet(Qm);for(const r of t.effects){if(r.is(qu)){const{changeSpecs:e,index:t}=r.value,a=e[t].map((e=>tf.range(e.absoluteStartPos,e.absoluteEndPos))),s=null==(n=a.at(-1))?void 0:n.to;return{index:t,decorations:Kt.set([...a,...void 0!==s&&e.length>1&&o.widgetClass?[Kt.widget({widget:new o.widgetClass(t,e.length),side:1}).range(s)]:[]]),changeSpecs:e,reverseChangeSet:r.value.reverseChangeSet}}if(r.is(Yu))return null;if(r.is(Xu))return null}return e?{...e,decorations:e.decorations.map(t.changes),reverseChangeSet:e.reverseChangeSet.map(t.changes)}:e},provide:e=>qt.decorations.from(e,(e=>(null==e?void 0:e.decorations)||Kt.none))}),of=wn.define(),rf=wn.define();var af,sf;function lf(e){const t=af[e];return"string"!=typeof t?e.toString():t[0].toLowerCase()+t.substring(1).replace(/[A-Z]/g,(e=>"_"+e.toLowerCase()))}let cf;(sf=af||(af={}))[sf.Canceled=1]="Canceled",sf[sf.Unknown=2]="Unknown",sf[sf.InvalidArgument=3]="InvalidArgument",sf[sf.DeadlineExceeded=4]="DeadlineExceeded",sf[sf.NotFound=5]="NotFound",sf[sf.AlreadyExists=6]="AlreadyExists",sf[sf.PermissionDenied=7]="PermissionDenied",sf[sf.ResourceExhausted=8]="ResourceExhausted",sf[sf.FailedPrecondition=9]="FailedPrecondition",sf[sf.Aborted=10]="Aborted",sf[sf.OutOfRange=11]="OutOfRange",sf[sf.Unimplemented=12]="Unimplemented",sf[sf.Internal=13]="Internal",sf[sf.Unavailable=14]="Unavailable",sf[sf.DataLoss=15]="DataLoss",sf[sf.Unauthenticated=16]="Unauthenticated";class df extends Error{constructor(e,t=af.Unknown,n,o,r){super(function(e,t){return e.length?`[${lf(t)}] ${e}`:`[${lf(t)}]`}(e,t)),this.name="ConnectError",Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=e,this.code=t,this.metadata=new Headers(null!=n?n:{}),this.details=null!=o?o:[],this.cause=r}static from(e,t=af.Unknown){return e instanceof df?e:e instanceof Error?"AbortError"==e.name?new df(e.message,af.Canceled):new df(e.message,t,void 0,void 0,e):new df(String(e),t,void 0,void 0,e)}static[Symbol.hasInstance](e){return e instanceof Error&&(Object.getPrototypeOf(e)===df.prototype||"ConnectError"===e.name&&"code"in e&&"number"==typeof e.code&&"metadata"in e&&"details"in e&&Array.isArray(e.details)&&"rawMessage"in e&&"string"==typeof e.rawMessage&&"cause"in e)}findDetails(e){const t="typeName"in e?{findMessage:t=>t===e.typeName?e:void 0}:e,n=[];for(const r of this.details){if("getType"in r){t.findMessage(r.getType().typeName)&&n.push(r);continue}const e=t.findMessage(r.type);if(e)try{n.push(e.fromBinary(r.value))}catch(o){}}return n}}var uf=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(n){t[n]=e[n]&&function(t){return new Promise((function(o,r){(function(e,t,n,o){Promise.resolve(o).then((function(t){e({value:t,done:n})}),t)})(o,r,(t=e[n](t)).done,t.value)}))}}},hf=function(e){return this instanceof hf?(this.v=e,this):new hf(e)},mf=function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(e,t||[]),a=[];return o={},s("next"),s("throw"),s("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),o[Symbol.asyncIterator]=function(){return this},o;function s(e,t){r[e]&&(o[e]=function(t){return new Promise((function(n,o){a.push([e,t,n,o])>1||i(e,t)}))},t&&(o[e]=t(o[e])))}function i(e,t){try{(n=r[e](t)).value instanceof hf?Promise.resolve(n.value.v).then(l,c):d(a[0][2],n)}catch(o){d(a[0][3],o)}var n}function l(e){i("next",e)}function c(e){i("throw",e)}function d(e,t){e(t),a.shift(),a.length&&i(a[0][0],a[0][1])}};function ff(e){return mf(this,arguments,(function*(){yield hf(yield*function(e){var t,n;return t={},o("next"),o("throw",(function(e){throw e})),o("return"),t[Symbol.iterator]=function(){return this},t;function o(o,r){t[o]=e[o]?function(t){return(n=!n)?{value:hf(e[o](t)),done:!1}:r?r(t):t}:r}}(uf(e)))}))}var pf=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(n){t[n]=e[n]&&function(t){return new Promise((function(o,r){(function(e,t,n,o){Promise.resolve(o).then((function(t){e({value:t,done:n})}),t)})(o,r,(t=e[n](t)).done,t.value)}))}}},gf=function(e){return this instanceof gf?(this.v=e,this):new gf(e)},vf=function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(e,t||[]),a=[];return o={},s("next"),s("throw"),s("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),o[Symbol.asyncIterator]=function(){return this},o;function s(e,t){r[e]&&(o[e]=function(t){return new Promise((function(n,o){a.push([e,t,n,o])>1||i(e,t)}))},t&&(o[e]=t(o[e])))}function i(e,t){try{(n=r[e](t)).value instanceof gf?Promise.resolve(n.value.v).then(l,c):d(a[0][2],n)}catch(o){d(a[0][3],o)}var n}function l(e){i("next",e)}function c(e){i("throw",e)}function d(e,t){e(t),a.shift(),a.length&&i(a[0][0],a[0][1])}};function xf(e,t){const n=function(){var n,o;return vf(this,arguments,(function*(){const r=yield gf(e);null===(n=null==t?void 0:t.onHeader)||void 0===n||n.call(t,r.header),yield gf(yield*function(e){var t,n;return t={},o("next"),o("throw",(function(e){throw e})),o("return"),t[Symbol.iterator]=function(){return this},t;function o(o,r){t[o]=e[o]?function(t){return(n=!n)?{value:gf(e[o](t)),done:!1}:r?r(t):t}:r}}(pf(r.message))),null===(o=null==t?void 0:t.onTrailer)||void 0===o||o.call(t,r.trailer)}))}()[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({next:()=>n.next()})}}function yf(e){if(!e.aborted)return;if(void 0!==e.reason)return e.reason;const t=new Error("This operation was aborted");return t.name="AbortError",t}function bf(){return{get(e){return e.id in this?this[e.id]:e.defaultValue},set(e,t){return this[e.id]=t,this},delete(e){return delete this[e.id],this}}}function wf(e,t,n){const o="string"==typeof t?t:t.typeName,r="string"==typeof n?n:n.name;return e.toString().replace(/\/?$/,`/${o}/${r}`)}function kf(e,t){return t instanceof e?t:new e(t)}function Nf(e,t){function n(t){return!0===t.done?t:{done:t.done,value:kf(e,t.value)}}return{[Symbol.asyncIterator](){const e=t[Symbol.asyncIterator](),o={next:()=>e.next().then(n)};return void 0!==e.throw&&(o.throw=t=>e.throw(t).then(n)),void 0!==e.return&&(o.return=t=>e.return(t).then(n)),o}}}function Cf(e,t){var n;return null!==(n=null==t?void 0:t.concat().reverse().reduce(((e,t)=>t(e)),e))&&void 0!==n?n:e}function Ef(e){var t;const n=Object.assign({},e);return null!==(t=n.ignoreUnknownFields)&&void 0!==t||(n.ignoreUnknownFields=!0),n}function Sf(e,t,n,o){const r=t?jf(e.I,o):_f(e.I,n);return{parse:(t?jf(e.O,o):_f(e.O,n)).parse,serialize:r.serialize}}function jf(e,t){return{parse(n){try{return e.fromBinary(n,t)}catch(o){const e=o instanceof Error?o.message:String(o);throw new df(`parse binary: ${e}`,af.InvalidArgument)}},serialize(e){try{return e.toBinary(t)}catch(n){const e=n instanceof Error?n.message:String(n);throw new df(`serialize binary: ${e}`,af.Internal)}}}}function _f(e,t){var n,o;const r=null!==(n=null==t?void 0:t.textEncoder)&&void 0!==n?n:new TextEncoder,a=null!==(o=null==t?void 0:t.textDecoder)&&void 0!==o?o:new TextDecoder,s=Ef(t);return{parse(t){try{const n=a.decode(t);return e.fromJsonString(n,s)}catch(n){throw df.from(n,af.InvalidArgument)}},serialize(e){try{const t=e.toJsonString(s);return r.encode(t)}catch(t){throw df.from(t,af.Internal)}}}}const If=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i;function Af(e,t,n){if(t&&new Headers(t).forEach(((e,t)=>n.metadata.append(t,e))),"object"!=typeof e||null==e||Array.isArray(e)||!("code"in e)||"string"!=typeof e.code)throw n;const o=function(e){if(!cf){cf={};for(const e of Object.values(af))"string"!=typeof e&&(cf[lf(e)]=e)}return cf[e]}(e.code);if(void 0===o)throw n;const r=e.message;if(null!=r&&"string"!=typeof r)throw n;const a=new df(null!=r?r:"",o,t);if("details"in e&&Array.isArray(e.details))for(const i of e.details){if(null===i||"object"!=typeof i||Array.isArray(i)||"string"!=typeof i.type||"string"!=typeof i.value||"debug"in i&&"object"!=typeof i.debug)throw n;try{a.details.push({type:i.type,value:Oh.dec(i.value),debug:i.debug})}catch(s){throw n}}return a}function Mf(e){const t=new df("invalid end stream",af.InvalidArgument);let n;try{n=JSON.parse("string"==typeof e?e:(new TextDecoder).decode(e))}catch(r){throw t}if("object"!=typeof n||null==n||Array.isArray(n))throw t;const o=new Headers;if("metadata"in n){if("object"!=typeof n.metadata||null==n.metadata||Array.isArray(n.metadata))throw t;for(const[e,r]of Object.entries(n.metadata)){if(!Array.isArray(r)||r.some((e=>"string"!=typeof e)))throw t;for(const t of r)o.append(e,t)}}return{metadata:o,error:"error"in n?Af(n.error,o,t):void 0}}const Tf="Content-Type",Of="Content-Length",Df="Content-Encoding",Pf="Accept-Encoding",Rf="Connect-Protocol-Version";function Ff(e){const t=new Headers,n=new Headers;return e.forEach(((e,o)=>{o.toLowerCase().startsWith("trailer-")?n.set(o.substring(8),e):t.set(o,e)})),[t,n]}function Lf(e,t,n,o,r){const a=new Headers(null!=o?o:{});return void 0!==n&&a.set("Connect-Timeout-Ms",`${n}`),a.set(Tf,e==Tm.Unary?t?"application/proto":"application/json":t?"application/connect+proto":"application/connect+json"),a.set(Rf,"1"),a}function zf(e,t,n){const o=function(e){const t=null==e?void 0:e.match(If);if(!t)return;return{stream:!!t[1],binary:!!t[3]}}(n.get("Content-Type"));if(200!==t){const r=new df(`HTTP ${t}`,function(e){switch(e){case 400:return af.InvalidArgument;case 401:return af.Unauthenticated;case 403:return af.PermissionDenied;case 404:return af.Unimplemented;case 408:return af.DeadlineExceeded;case 409:return af.Aborted;case 412:return af.FailedPrecondition;case 413:case 431:return af.ResourceExhausted;case 415:return af.Internal;case 429:case 502:case 503:case 504:return af.Unavailable;default:return af.Unknown}}(t),n);if(e==Tm.Unary&&o&&!o.binary)return{isUnaryError:!0,unaryError:r};throw r}return{isUnaryError:!1}}const Bf="application/";function Uf(e,t,n){let o="?connect=v1";const r=e.header.get(Tf);0===(null==r?void 0:r.indexOf(Bf))&&(o+="&encoding="+encodeURIComponent(r.slice(12)));const a=e.header.get(Df);null!==a&&"identity"!==a&&(o+="&compression="+encodeURIComponent(a),n=!0),n&&(o+="&base64=1"),o+="&message="+function(e,t){return t?Oh.enc(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):encodeURIComponent((new TextDecoder).decode(e))}(t,n);const s=e.url+o,i=new Headers(e.header);return[Rf,Tf,Of,Df,Pf].forEach((e=>i.delete(e))),Object.assign(Object.assign({},e),{init:Object.assign(Object.assign({},e.init),{method:"GET"}),url:s,header:i})}function Vf(e){const{signal:t,cleanup:n}=function(e){const t=new AbortController,n=()=>{t.abort(new df("the operation timed out",af.DeadlineExceeded))};let o;return void 0!==e&&(e<=0?n():o=setTimeout(n,e)),{signal:t.signal,cleanup:()=>clearTimeout(o)}}(e.timeoutMs),o=function(...e){const t=new AbortController,n=e.filter((e=>void 0!==e)).concat(t.signal);for(const r of n){if(r.aborted){o.apply(r);break}r.addEventListener("abort",o)}function o(){t.signal.aborted||t.abort(yf(this));for(const e of n)e.removeEventListener("abort",o)}return t}(e.signal,t);return[o.signal,function(e){const r=df.from(t.aborted?yf(t):e);return o.abort(r),n(),Promise.reject(r)},function(){n(),o.abort()}]}var Gf,$f,Hf,Wf,qf,Yf;($f=Gf||(Gf={}))[$f.UNSPECIFIED=0]="UNSPECIFIED",$f[$f.INACTIVE=1]="INACTIVE",$f[$f.PROCESSING=2]="PROCESSING",$f[$f.SUCCESS=3]="SUCCESS",$f[$f.WARNING=4]="WARNING",$f[$f.ERROR=5]="ERROR",Im.util.setEnumType(Gf,"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"}]),(Wf=Hf||(Hf={}))[Wf.UNSPECIFIED=0]="UNSPECIFIED",Wf[Wf.SINGLE=1]="SINGLE",Wf[Wf.MULTI=2]="MULTI",Im.util.setEnumType(Hf,"exa.language_server_pb.LineType",[{no:0,name:"LINE_TYPE_UNSPECIFIED"},{no:1,name:"LINE_TYPE_SINGLE"},{no:2,name:"LINE_TYPE_MULTI"}]),(Yf=qf||(qf={}))[Yf.UNSPECIFIED=0]="UNSPECIFIED",Yf[Yf.INLINE=1]="INLINE",Yf[Yf.BLOCK=2]="BLOCK",Yf[Yf.INLINE_MASK=3]="INLINE_MASK",Im.util.setEnumType(qf,"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 Xf=class e extends sh{constructor(e){super(),n(this,"threshold",0),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(Xf,"runtime",Im),n(Xf,"typeName","exa.language_server_pb.MultilineConfig"),n(Xf,"fields",Im.util.newFieldList((()=>[{no:1,name:"threshold",kind:"scalar",T:2}])));let Kf=Xf;const Jf=class e extends sh{constructor(e){super(),n(this,"metadata"),n(this,"document"),n(this,"editorOptions"),n(this,"otherDocuments",[]),n(this,"experimentConfig"),n(this,"modelName",""),n(this,"multilineConfig"),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(Jf,"runtime",Im),n(Jf,"typeName","exa.language_server_pb.GetCompletionsRequest"),n(Jf,"fields",Im.util.newFieldList((()=>[{no:1,name:"metadata",kind:"message",T:Xm},{no:2,name:"document",kind:"message",T:hp},{no:3,name:"editor_options",kind:"message",T:Jm},{no:5,name:"other_documents",kind:"message",T:hp,repeated:!0},{no:7,name:"experiment_config",kind:"message",T:fp},{no:10,name:"model_name",kind:"scalar",T:9},{no:13,name:"multiline_config",kind:"message",T:Kf}])));let Zf=Jf;const Qf=class e extends sh{constructor(e){super(),n(this,"state"),n(this,"completionItems",[]),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(Qf,"runtime",Im),n(Qf,"typeName","exa.language_server_pb.GetCompletionsResponse"),n(Qf,"fields",Im.util.newFieldList((()=>[{no:1,name:"state",kind:"message",T:gp},{no:2,name:"completion_items",kind:"message",T:Cp,repeated:!0}])));let ep=Qf;const tp=class e extends sh{constructor(e){super(),n(this,"metadata"),n(this,"completionId",""),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(tp,"runtime",Im),n(tp,"typeName","exa.language_server_pb.AcceptCompletionRequest"),n(tp,"fields",Im.util.newFieldList((()=>[{no:1,name:"metadata",kind:"message",T:Xm},{no:2,name:"completion_id",kind:"scalar",T:9}])));let np=tp;const op=class e extends sh{constructor(e){super(),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(op,"runtime",Im),n(op,"typeName","exa.language_server_pb.AcceptCompletionResponse"),n(op,"fields",Im.util.newFieldList((()=>[])));let rp=op;const ap=class e extends sh{constructor(e){super(),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(ap,"runtime",Im),n(ap,"typeName","exa.language_server_pb.GetAuthTokenRequest"),n(ap,"fields",Im.util.newFieldList((()=>[])));let sp=ap;const ip=class e extends sh{constructor(e){super(),n(this,"authToken",""),n(this,"uuid",""),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(ip,"runtime",Im),n(ip,"typeName","exa.language_server_pb.GetAuthTokenResponse"),n(ip,"fields",Im.util.newFieldList((()=>[{no:1,name:"auth_token",kind:"scalar",T:9},{no:2,name:"uuid",kind:"scalar",T:9}])));let lp=ip;const cp=class e extends sh{constructor(e){super(),n(this,"row",xh.zero),n(this,"col",xh.zero),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(cp,"runtime",Im),n(cp,"typeName","exa.language_server_pb.DocumentPosition"),n(cp,"fields",Im.util.newFieldList((()=>[{no:1,name:"row",kind:"scalar",T:4},{no:2,name:"col",kind:"scalar",T:4}])));let dp=cp;const up=class e extends sh{constructor(e){super(),n(this,"absolutePath",""),n(this,"relativePath",""),n(this,"text",""),n(this,"editorLanguage",""),n(this,"language",$m.UNSPECIFIED),n(this,"cursorOffset",xh.zero),n(this,"cursorPosition"),n(this,"lineEnding",""),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(up,"runtime",Im),n(up,"typeName","exa.language_server_pb.Document"),n(up,"fields",Im.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:Im.getEnumType($m)},{no:6,name:"cursor_offset",kind:"scalar",T:4},{no:8,name:"cursor_position",kind:"message",T:dp},{no:7,name:"line_ending",kind:"scalar",T:9}])));let hp=up;const mp=class e extends sh{constructor(e){super(),n(this,"forceEnableExperiments",[]),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(mp,"runtime",Im),n(mp,"typeName","exa.language_server_pb.ExperimentConfig"),n(mp,"fields",Im.util.newFieldList((()=>[{no:1,name:"force_enable_experiments",kind:"enum",T:Im.getEnumType(Rm),repeated:!0}])));let fp=mp;const pp=class e extends sh{constructor(e){super(),n(this,"state",Gf.UNSPECIFIED),n(this,"message",""),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(pp,"runtime",Im),n(pp,"typeName","exa.language_server_pb.State"),n(pp,"fields",Im.util.newFieldList((()=>[{no:1,name:"state",kind:"enum",T:Im.getEnumType(Gf)},{no:2,name:"message",kind:"scalar",T:9}])));let gp=pp;const vp=class e extends sh{constructor(e){super(),n(this,"startOffset",xh.zero),n(this,"endOffset",xh.zero),n(this,"startPosition"),n(this,"endPosition"),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(vp,"runtime",Im),n(vp,"typeName","exa.language_server_pb.Range"),n(vp,"fields",Im.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:dp},{no:4,name:"end_position",kind:"message",T:dp}])));let xp=vp;const yp=class e extends sh{constructor(e){super(),n(this,"text",""),n(this,"deltaCursorOffset",xh.zero),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(yp,"runtime",Im),n(yp,"typeName","exa.language_server_pb.Suffix"),n(yp,"fields",Im.util.newFieldList((()=>[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"delta_cursor_offset",kind:"scalar",T:3}])));let bp=yp;const wp=class e extends sh{constructor(e){super(),n(this,"text",""),n(this,"offset",xh.zero),n(this,"type",qf.UNSPECIFIED),n(this,"prefix",""),n(this,"line",xh.zero),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(wp,"runtime",Im),n(wp,"typeName","exa.language_server_pb.CompletionPart"),n(wp,"fields",Im.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:Im.getEnumType(qf)},{no:4,name:"prefix",kind:"scalar",T:9},{no:5,name:"line",kind:"scalar",T:4}])));let kp=wp;const Np=class e extends sh{constructor(e){super(),n(this,"completion"),n(this,"suffix"),n(this,"range"),n(this,"source",Vm.UNSPECIFIED),n(this,"completionParts",[]),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(Np,"runtime",Im),n(Np,"typeName","exa.language_server_pb.CompletionItem"),n(Np,"fields",Im.util.newFieldList((()=>[{no:1,name:"completion",kind:"message",T:qm},{no:5,name:"suffix",kind:"message",T:bp},{no:2,name:"range",kind:"message",T:xp},{no:3,name:"source",kind:"enum",T:Im.getEnumType(Vm)},{no:8,name:"completion_parts",kind:"message",T:kp,repeated:!0}])));let Cp=Np;const Ep={typeName:"exa.language_server_pb.LanguageServerService",methods:{getCompletions:{name:"GetCompletions",I:Zf,O:ep,kind:Tm.Unary},acceptCompletion:{name:"AcceptCompletion",I:np,O:rp,kind:Tm.Unary},getAuthToken:{name:"GetAuthToken",I:sp,O:lp,kind:Tm.Unary}}};var Sp=function(e){return this instanceof Sp?(this.v=e,this):new Sp(e)},jp=function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(e,t||[]),a=[];return o={},s("next"),s("throw"),s("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),o[Symbol.asyncIterator]=function(){return this},o;function s(e,t){r[e]&&(o[e]=function(t){return new Promise((function(n,o){a.push([e,t,n,o])>1||i(e,t)}))},t&&(o[e]=t(o[e])))}function i(e,t){try{(n=r[e](t)).value instanceof Sp?Promise.resolve(n.value.v).then(l,c):d(a[0][2],n)}catch(o){d(a[0][3],o)}var n}function l(e){i("next",e)}function c(e){i("throw",e)}function d(e,t){e(t),a.shift(),a.length&&i(a[0][0],a[0][1])}};const _p=function(e){var t;!function(){try{new Headers}catch(e){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=null!==(t=e.useBinaryFormat)&&void 0!==t&&t;return{async unary(t,o,r,a,s,i,l){var c;const{serialize:d,parse:u}=Sf(o,n,e.jsonOptions,e.binaryOptions);return a=void 0===a?e.defaultTimeoutMs:a<=0?void 0:a,await function(e){const t=Cf(e.next,e.interceptors),[n,o,r]=Vf(e);return t(Object.assign(Object.assign({},e.req),{message:kf(e.req.method.I,e.req.message),signal:n})).then((e=>(r(),e)),o)}({interceptors:e.interceptors,signal:r,timeoutMs:a,req:{stream:!1,service:t,method:o,url:wf(e.baseUrl,t,o),init:{method:"POST",credentials:null!==(c=e.credentials)&&void 0!==c?c:"same-origin",redirect:"error",mode:"cors"},header:Lf(o.kind,n,a,s),contextValues:null!=l?l:bf(),message:i},next:async r=>{var a;let s=null;!0===e.useHttpGet&&o.idempotency===Dm.NoSideEffects?r=Uf(r,d(r.message),n):s=d(r.message);const i=null!==(a=e.fetch)&&void 0!==a?a:globalThis.fetch,l=await i(r.url,Object.assign(Object.assign({},r.init),{headers:r.header,signal:r.signal,body:s})),{isUnaryError:c,unaryError:h}=zf(o.kind,l.status,l.headers);if(c)throw Af(await l.json(),function(...e){const t=new Headers;for(const n of e)n.forEach(((e,n)=>{t.append(n,e)}));return t}(...Ff(l.headers)),h);const[m,f]=Ff(l.headers);return{stream:!1,service:t,method:o,header:m,message:n?u(new Uint8Array(await l.arrayBuffer())):o.O.fromJson(await l.json(),Ef(e.jsonOptions)),trailer:f}}})},async stream(t,o,r,a,s,i,l){var c;const{serialize:d,parse:u}=Sf(o,n,e.jsonOptions,e.binaryOptions);function h(e,t,n){return jp(this,arguments,(function*(){const o=function(e){let t,n=new Uint8Array(0);function o(e){const t=new Uint8Array(n.length+e.length);t.set(n),t.set(e,n.length),n=t}return new ReadableStream({start(){t=e.getReader()},async pull(e){let r;for(;;){if(void 0===r&&n.byteLength>=5){let e=0;for(let t=1;t<5;t++)e=(e<<8)+n[t];r={flags:n[0],length:e}}if(void 0!==r&&n.byteLength>=r.length+5)break;const e=await t.read();if(e.done)break;o(e.value)}if(void 0===r)return 0==n.byteLength?void e.close():void e.error(new df("premature end of stream",af.DataLoss));const a=n.subarray(5,5+r.length);n=n.subarray(5+r.length),e.enqueue({flags:r.flags,data:a})}})}(e).getReader();let r=!1;for(;;){const e=yield Sp(o.read());if(e.done)break;const{flags:a,data:s}=e.value;if(2&~a)yield yield Sp(u(s));else{r=!0;const e=Mf(s);if(e.error){const t=e.error;throw n.forEach(((e,n)=>{t.metadata.append(n,e)})),t}e.metadata.forEach(((e,n)=>t.set(n,e)))}}if(!r)throw"missing EndStreamResponse"}))}async function m(e){if(o.kind!=Tm.ServerStreaming)throw"The fetch API does not support streaming request bodies";const t=await e[Symbol.asyncIterator]().next();if(1==t.done)throw"missing request message";return function(e,t){const n=new Uint8Array(t.length+5);n.set(t,5);const o=new DataView(n.buffer,n.byteOffset,n.byteLength);return o.setUint8(0,e),o.setUint32(1,t.length),n}(0,d(t.value))}return a=void 0===a?e.defaultTimeoutMs:a<=0?void 0:a,await function(e){const t=Cf(e.next,e.interceptors),[n,o,r]=Vf(e),a=Object.assign(Object.assign({},e.req),{message:Nf(e.req.method.I,e.req.message),signal:n});let s=!1;return n.addEventListener("abort",(function(){var t,n;const o=e.req.message[Symbol.asyncIterator]();s||null===(t=o.throw)||void 0===t||t.call(o,this.reason).catch((()=>{})),null===(n=o.return)||void 0===n||n.call(o).catch((()=>{}))})),t(a).then((e=>Object.assign(Object.assign({},e),{message:{[Symbol.asyncIterator](){const t=e.message[Symbol.asyncIterator]();return{next:()=>t.next().then((e=>(1==e.done&&(s=!0,r()),e)),o)}}}})),o)}({interceptors:e.interceptors,timeoutMs:a,signal:r,req:{stream:!0,service:t,method:o,url:wf(e.baseUrl,t,o),init:{method:"POST",credentials:null!==(c=e.credentials)&&void 0!==c?c:"same-origin",redirect:"error",mode:"cors"},header:Lf(o.kind,n,a,s),contextValues:null!=l?l:bf(),message:i},next:async t=>{var n;const r=null!==(n=e.fetch)&&void 0!==n?n:globalThis.fetch,a=await r(t.url,Object.assign(Object.assign({},t.init),{headers:t.header,signal:t.signal,body:await m(t.message)}));if(zf(o.kind,a.status,a.headers),null===a.body)throw"missing response body";const s=new Headers;return Object.assign(Object.assign({},t),{header:a.headers,trailer:s,message:h(a.body,s,a.headers)})}})}}}({baseUrl:"https://web-backend.codeium.com",useBinaryFormat:!0}),Ip=(Mp=_p,function(e,t){const n={};for(const[o,r]of Object.entries(e.methods)){const a=t(Object.assign(Object.assign({},r),{localName:o,service:e}));null!=a&&(n[o]=a)}return n}(Ap=Ep,(e=>{switch(e.kind){case Tm.Unary:return function(e,t,n){return async function(o,r){var a,s;const i=await e.unary(t,n,null==r?void 0:r.signal,null==r?void 0:r.timeoutMs,null==r?void 0:r.headers,o,null==r?void 0:r.contextValues);return null===(a=null==r?void 0:r.onHeader)||void 0===a||a.call(r,i.header),null===(s=null==r?void 0:r.onTrailer)||void 0===s||s.call(r,i.trailer),i.message}}(Mp,Ap,e);case Tm.ServerStreaming:return function(e,t,n){return function(o,r){return xf(e.stream(t,n,null==r?void 0:r.signal,null==r?void 0:r.timeoutMs,null==r?void 0:r.headers,ff([o]),null==r?void 0:r.contextValues),r)}}(Mp,Ap,e);case Tm.ClientStreaming:return function(e,t,n){return async function(o,r){var a,s,i,l,c,d;const u=await e.stream(t,n,null==r?void 0:r.signal,null==r?void 0:r.timeoutMs,null==r?void 0:r.headers,o,null==r?void 0:r.contextValues);let h;null===(c=null==r?void 0:r.onHeader)||void 0===c||c.call(r,u.header);try{for(var m,f=!0,p=pf(u.message);!(a=(m=await p.next()).done);f=!0)l=m.value,f=!1,h=l}catch(g){s={error:g}}finally{try{f||a||!(i=p.return)||await i.call(p)}finally{if(s)throw s.error}}if(!h)throw new df("protocol error: missing response message",af.Internal);return null===(d=null==r?void 0:r.onTrailer)||void 0===d||d.call(r,u.trailer),h}}(Mp,Ap,e);case Tm.BiDiStreaming:return function(e,t,n){return function(o,r){return xf(e.stream(t,n,null==r?void 0:r.signal,null==r?void 0:r.timeoutMs,null==r?void 0:r.headers,o,null==r?void 0:r.contextValues),r)}}(Mp,Ap,e);default:return null}})));var Ap,Mp;let Tp;try{Tp=crypto.randomUUID()}catch{Tp=function(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(+e^(crypto.getRandomValues(new Uint8Array(1))[0]??0)&15>>+e/4).toString(16)))}()}async function Op(e,t){const n=e.state.facet(Qm),{override:o}=e.state.facet(ef),r=await o(),a=e.state,s=a.selection.main.head,i=a.doc.toString();try{const o=await async function({text:e,cursorOffset:t,config:n,otherDocuments:o}){return await Ip.getCompletions({metadata:{ideName:"web",ideVersion:"0.0.5",extensionName:"@valtown/codemirror-codeium",extensionVersion:"1.0.0",apiKey:n.apiKey,sessionId:Tp,authSource:n.authSource},document:{text:e,cursorOffset:BigInt(t),language:n.language,editorLanguage:"typescript",lineEnding:"\n"},editorOptions:{tabSize:2n,insertSpaces:!0},otherDocuments:o,multilineConfig:void 0},{headers:{Authorization:`Basic ${n.apiKey}-${Tp}`}})}({text:i,cursorOffset:s,config:n,otherDocuments:r});if(!o||0===o.completionItems.length)return;if(void 0!==t&&s!==t||"active"===kn(e.state)||!e.hasFocus)return;const l=o.completionItems.map((e=>{let t=0;return e.completionParts.filter((e=>3!==e.type)).map((e=>{const n=Number(e.offset),o=2===e.type?`\n${e.text}`:e.text,r={absoluteStartPos:t+n,absoluteEndPos:t+n+o.length,from:n,to:n,insert:o};return t+=o.length,r}))})),c=0,d=l.at(c);if(!d)return;const u=Nn.of(d,a.doc.length),h=u.invert(a.doc);e.dispatch({changes:u,effects:qu.of({index:c,reverseChangeSet:h,changeSpecs:l}),annotations:[rf.of(null),of.of(null),Cn.addToHistory.of(!1)]})}catch(l){console.warn("copilot completion failed",l),await new Promise((e=>setTimeout(e,300)))}}function Dp(){let e=null,t=0;return qt.updateListener.of((n=>{const o=n.view.state.facet(Qm);if(!o.alwaysOn)return;if(!function(e){return e.docChanged&&!e.transactions.some((e=>e.effects.some((e=>e.is(Yu)||e.is(Xu)))))}(n))return;if(e&&clearTimeout(e),function(e){if(!e.view.hasFocus)return!0;if(e.state.field(nf))return!0;if("active"===kn(e.state))return!0;for(const t of e.transactions)if(void 0!==t.annotation(of))return!0}(n))return;const r=n.state.selection.main.head;o.shouldComplete&&!o.shouldComplete(new En(n.view.state,r,!1))||(e=setTimeout((async()=>{r===t&&await Op(n.view,t)}),o.timeout),t=r)}))}function Pp(e){var t;const n=e.state.field(nf);if(!n)return!1;const o=null==(t=n.reverseChangeSet)?void 0:t.invert(e.state.doc);e.dispatch({changes:n.reverseChangeSet,effects:Yu.of(null),annotations:[rf.of(null),of.of(null),Cn.addToHistory.of(!1)]});let r=0;return null==o||o.iterChangedRanges(((e,t,n,o)=>{r=o})),e.dispatch({changes:o,selection:Wt.cursor(r),annotations:[of.of(null),Cn.addToHistory.of(!0)]}),!0}const Rp=e=>{const{state:t}=e,n=t.field(nf);if(!n)return!1;const{changeSpecs:o}=n;if(o.length<2)return!1;const r=(n.index+1)%o.length,a=o.at(r);if(!a)return!1;const s=n.reverseChangeSet.apply(t.doc),i=Nn.of(n.reverseChangeSet,t.doc.length).compose(Nn.of(a,s.length)),l=Nn.of(a,s.length).invert(s);return e.dispatch({changes:i,effects:qu.of({index:r,reverseChangeSet:l,changeSpecs:o}),annotations:[rf.of(null),of.of(null),Cn.addToHistory.of(!1)]}),!0};function Fp(e){const t=e.state.field(nf);return!!t&&(e.dispatch({changes:t.reverseChangeSet,effects:Xu.of(null),annotations:[rf.of(null),of.of(null),Cn.addToHistory.of(!1)]}),!1)}function Lp(){return qt.domEventHandlers({keydown:(e,t)=>("]"!==e.key||!e.ctrlKey)&&("Shift"!==e.key&&"Control"!==e.key&&"Alt"!==e.key&&"Meta"!==e.key&&function(e,t){return!!e.state.field(nf)&&("Tab"===t?Pp(e):Fp(e))}(t,e.key)),mouseup(e,t){const n=e.target;return"BUTTON"===n.nodeName&&"codeium-cycle"===n.dataset.action?(Rp(t),e.stopPropagation(),e.preventDefault(),!0):function(e){var t,n;let o=!1;const r=null==(t=e.state.selection.asSingle().ranges.at(0))?void 0:t.head,a=e.state.field(nf);return!(void 0===r||!a)&&(null==(n=a.decorations)||n.between(r,r,(()=>{o=!0})),o)}(t)?Pp(t):Fp(t)}})}const zp=e=>{const t=[];return"codeium"===e.copilot&&e.codeium_api_key&&t.push(function(e){return[Qm.of(e),nf,vn.highest(fn.of([{key:"Ctrl-]",run:Rp}])),vn.highest(qt.updateListener.of((e=>{e.focusChanged&&Fp(e.view)}))),vn.high(Lp()),Dp()]}({apiKey:e.codeium_api_key,language:$m.PYTHON}),ef.of({override:async()=>[{text:Ti(""),language:$m.PYTHON,editorLanguage:"python"}]})),"github"===e.copilot&&t.push(Wu({delay:500,fetchFn:async e=>{if(!Di())return"";if(0===e.doc.length)return"";await new Promise((e=>setTimeout(e,20)));const t=e.doc.toString(),n=function(e,t){const n=e.doc.toString(),o=t.split("\n").length-n.split("\n").length,r=function(e,t){const n=e.lineAt(t);return{line:n.number-1,character:t-n.from}}(e.doc,e.selection.main.head);return r.line+=o,{doc:{source:t,tabSize:e.tabSize,indentSize:1,insertSpaces:!0,path:Ri,version:"replace_me",uri:`file://${Ri}`,relativePath:Ri,languageId:Fi,position:r}}}(e,Ti(t)),o=function(e,t,n){if(0===e.completions.length)return"";const{displayText:o,position:r}=e.completions[0],a=r.character-t.character,s=a<0?o.slice(-a):o,i=n.doc.sliceString(n.selection.main.head,n.doc.length);for(let l=0;l<s.length;l++){const e=s.slice(l);if(i.startsWith(e))return s.slice(0,l)}return s}(await Pi().getCompletion(n),n.doc.position,e);return o&&J.debug("Copilot suggestion:",o),o}})),[...t,Oi().slice(0,-2)]};const Bp=Kt.mark({class:"underline"}),Up=Yt.define(),Vp=Yt.define(),Gp=Xt.define({create:()=>Kt.none,update(e,t){let n=e.map(t.changes);for(const o of t.effects)o.is(Up)?n=e.update({add:[Bp.range(o.value.from,o.value.to)]}):o.is(Vp)&&(n=Kt.none);return n},provide:e=>qt.decorations.from(e)});class $p{constructor(e,t){this.view=void 0,this.commandClickMode=void 0,this.hoveredRange=void 0,this.onClick=void 0,this.keydown=e=>{"Meta"!==e.key&&"Control"!==e.key||(this.commandClickMode=!0,this.view.dom.addEventListener("mousemove",this.mousemove),this.view.dom.addEventListener("click",this.click))},this.keyup=e=>{"Meta"!==e.key&&"Control"!==e.key||this.exitCommandClickMode()},this.windowBlur=()=>{this.commandClickMode&&this.exitCommandClickMode()},this.mousemove=e=>{if(!e.metaKey&&!e.ctrlKey)return void this.exitCommandClickMode();if(!this.commandClickMode)return void this.clearUnderline();const t=this.view.posAtCoords({x:e.clientX,y:e.clientY});if(null==t)return void this.clearUnderline();const n=Sn(this.view.state).cursorAt(t);if("VariableName"===n.name){const{from:e,to:o}=n;if(this.hoveredRange&&this.hoveredRange.from===e&&this.hoveredRange.to===o)return;this.clearUnderline(),this.hoveredRange={from:e,to:o,position:t},this.view.dispatch({effects:Up.of(this.hoveredRange)})}else this.clearUnderline()},this.click=e=>{if(this.hoveredRange){const t=this.view.state.doc.sliceString(this.hoveredRange.from,this.hoveredRange.to);e.preventDefault(),e.stopPropagation(),this.onClick(this.view,t),this.view.dispatch({selection:{head:this.hoveredRange.position,anchor:this.hoveredRange.position}})}},this.view=e,this.commandClickMode=!1,this.hoveredRange=null,this.onClick=t,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:Vp.of(null)}),this.hoveredRange=null)}}const Hp=({variant:e,settings:t,styles:n})=>{const o=qt.theme({"&":{backgroundColor:t.background,color:t.foreground},".cm-content":{caretColor:t.caret},".cm-cursor, .cm-dropCursor":{borderLeftColor:t.caret},"&.cm-focused .cm-selectionBackgroundm .cm-selectionBackground, .cm-content ::selection":{backgroundColor:t.selection},".cm-activeLine":{backgroundColor:t.lineHighlight},".cm-gutters":{backgroundColor:t.gutterBackground,color:t.gutterForeground},".cm-activeLineGutter":{backgroundColor:t.lineHighlight}},{dark:"dark"===e}),r=_n.define(n);return[o,In(r)]};Hp({variant:"dark",settings:{background:"#200020",foreground:"#D0D0FF",caret:"#7070FF",selection:"#80000080",gutterBackground:"#200020",gutterForeground:"#C080C0",lineHighlight:"#80000040"},styles:[{tag:An.comment,color:"#404080"},{tag:[An.string,An.regexp],color:"#999999"},{tag:An.number,color:"#7090B0"},{tag:[An.bool,An.null],color:"#8080A0"},{tag:[An.punctuation,An.derefOperator],color:"#805080"},{tag:An.keyword,color:"#60B0FF"},{tag:An.definitionKeyword,color:"#B0FFF0"},{tag:An.moduleKeyword,color:"#60B0FF"},{tag:An.operator,color:"#A0A0FF"},{tag:[An.variableName,An.self],color:"#008080"},{tag:An.operatorKeyword,color:"#A0A0FF"},{tag:An.controlKeyword,color:"#80A0FF"},{tag:An.className,color:"#70E080"},{tag:[An.function(An.propertyName),An.propertyName],color:"#50A0A0"},{tag:An.tagName,color:"#009090"},{tag:An.modifier,color:"#B0FFF0"},{tag:[An.squareBracket,An.attributeName],color:"#D0D0FF"}]}),Hp({variant:"light",settings:{background:"#fcfcfc",foreground:"#5c6166",caret:"#ffaa33",selection:"#036dd626",gutterBackground:"#fcfcfc",gutterForeground:"#8a919966",lineHighlight:"#8a91991a"},styles:[{tag:An.comment,color:"#787b8099"},{tag:An.string,color:"#86b300"},{tag:An.regexp,color:"#4cbf99"},{tag:[An.number,An.bool,An.null],color:"#ffaa33"},{tag:An.variableName,color:"#5c6166"},{tag:[An.definitionKeyword,An.modifier],color:"#fa8d3e"},{tag:[An.keyword,An.special(An.brace)],color:"#fa8d3e"},{tag:An.operator,color:"#ed9366"},{tag:An.separator,color:"#5c6166b3"},{tag:An.punctuation,color:"#5c6166"},{tag:[An.definition(An.propertyName),An.function(An.variableName)],color:"#f2ae49"},{tag:[An.className,An.definition(An.typeName)],color:"#22a4e6"},{tag:[An.tagName,An.typeName,An.self,An.labelName],color:"#55b4d4"},{tag:An.angleBracket,color:"#55b4d480"},{tag:An.attributeName,color:"#f2ae49"}]}),Hp({variant:"dark",settings:{background:"#15191EFA",foreground:"#EEF2F7",caret:"#C4C4C4",selection:"#90B2D557",gutterBackground:"#15191EFA",gutterForeground:"#aaaaaa95",lineHighlight:"#57575712"},styles:[{tag:An.comment,color:"#6E6E6E"},{tag:[An.string,An.regexp,An.special(An.brace)],color:"#5C81B3"},{tag:An.number,color:"#C1E1B8"},{tag:An.bool,color:"#53667D"},{tag:[An.definitionKeyword,An.modifier,An.function(An.propertyName)],color:"#A3D295",fontWeight:"bold"},{tag:[An.keyword,An.moduleKeyword,An.operatorKeyword,An.operator],color:"#697A8E",fontWeight:"bold"},{tag:[An.variableName,An.attributeName],color:"#708E67"},{tag:[An.function(An.variableName),An.definition(An.propertyName),An.derefOperator],color:"#fff"},{tag:An.tagName,color:"#A3D295"}]}),Hp({variant:"dark",settings:{background:"#2e241d",foreground:"#BAAE9E",caret:"#A7A7A7",selection:"#DDF0FF33",gutterBackground:"#28211C",gutterForeground:"#BAAE9E90",lineHighlight:"#FFFFFF08"},styles:[{tag:An.comment,color:"#666666"},{tag:[An.string,An.special(An.brace)],color:"#54BE0D"},{tag:An.regexp,color:"#E9C062"},{tag:An.number,color:"#CF6A4C"},{tag:[An.keyword,An.operator],color:"#5EA6EA"},{tag:An.variableName,color:"#7587A6"},{tag:[An.definitionKeyword,An.modifier],color:"#F9EE98"},{tag:[An.propertyName,An.function(An.variableName)],color:"#937121"},{tag:[An.typeName,An.angleBracket,An.tagName],color:"#9B859D"}]}),Hp({variant:"dark",settings:{background:"#3b2627",foreground:"#E6E1C4",caret:"#E6E1C4",selection:"#16120E",gutterBackground:"#3b2627",gutterForeground:"#E6E1C490",lineHighlight:"#1F1611"},styles:[{tag:An.comment,color:"#6B4E32"},{tag:[An.keyword,An.operator,An.derefOperator],color:"#EF5D32"},{tag:An.className,color:"#EFAC32",fontWeight:"bold"},{tag:[An.typeName,An.propertyName,An.function(An.variableName),An.definition(An.variableName)],color:"#EFAC32"},{tag:An.definition(An.typeName),color:"#EFAC32",fontWeight:"bold"},{tag:An.labelName,color:"#EFAC32",fontWeight:"bold"},{tag:[An.number,An.bool],color:"#6C99BB"},{tag:[An.variableName,An.self],color:"#7DAF9C"},{tag:[An.string,An.special(An.brace),An.regexp],color:"#D9D762"},{tag:[An.angleBracket,An.tagName,An.attributeName],color:"#EFCB43"}]}),Hp({variant:"dark",settings:{background:"#000205",foreground:"#FFFFFF",caret:"#E60065",selection:"#E60C6559",gutterBackground:"#000205",gutterForeground:"#ffffff90",lineHighlight:"#4DD7FC1A"},styles:[{tag:An.comment,color:"#404040"},{tag:[An.string,An.special(An.brace),An.regexp],color:"#00D8FF"},{tag:An.number,color:"#E62286"},{tag:[An.variableName,An.attributeName,An.self],color:"#E62286",fontWeight:"bold"},{tag:An.function(An.variableName),color:"#fff",fontWeight:"bold"}]}),Hp({variant:"light",settings:{background:"#fff",foreground:"#000",caret:"#000",selection:"#BDD5FC",gutterBackground:"#fff",gutterForeground:"#00000070",lineHighlight:"#FFFBD1"},styles:[{tag:An.comment,color:"#BCC8BA"},{tag:[An.string,An.special(An.brace),An.regexp],color:"#5D90CD"},{tag:[An.number,An.bool,An.null],color:"#46A609"},{tag:An.keyword,color:"#AF956F"},{tag:[An.definitionKeyword,An.modifier],color:"#C52727"},{tag:[An.angleBracket,An.tagName,An.attributeName],color:"#606060"},{tag:An.self,color:"#000"}]}),Hp({variant:"dark",settings:{background:"#00254b",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#B36539BF",gutterBackground:"#00254b",gutterForeground:"#FFFFFF70",lineHighlight:"#00000059"},styles:[{tag:An.comment,color:"#0088FF"},{tag:An.string,color:"#3AD900"},{tag:An.regexp,color:"#80FFC2"},{tag:[An.number,An.bool,An.null],color:"#FF628C"},{tag:[An.definitionKeyword,An.modifier],color:"#FFEE80"},{tag:An.variableName,color:"#CCCCCC"},{tag:An.self,color:"#FF80E1"},{tag:[An.className,An.definition(An.propertyName),An.function(An.variableName),An.definition(An.typeName),An.labelName],color:"#FFDD00"},{tag:[An.keyword,An.operator],color:"#FF9D00"},{tag:[An.propertyName,An.typeName],color:"#80FFBB"},{tag:An.special(An.brace),color:"#EDEF7D"},{tag:An.attributeName,color:"#9EFFFF"},{tag:An.derefOperator,color:"#fff"}]}),Hp({variant:"dark",settings:{background:"#060521",foreground:"#E0E0E0",caret:"#FFFFFFA6",selection:"#122BBB",gutterBackground:"#060521",gutterForeground:"#E0E0E090",lineHighlight:"#FFFFFF0F"},styles:[{tag:An.comment,color:"#AEAEAE"},{tag:[An.string,An.special(An.brace),An.regexp],color:"#8DFF8E"},{tag:[An.className,An.definition(An.propertyName),An.function(An.variableName),An.function(An.definition(An.variableName)),An.definition(An.typeName)],color:"#A3EBFF"},{tag:[An.number,An.bool,An.null],color:"#62E9BD"},{tag:[An.keyword,An.operator],color:"#2BF1DC"},{tag:[An.definitionKeyword,An.modifier],color:"#F8FBB1"},{tag:[An.variableName,An.self],color:"#B683CA"},{tag:[An.angleBracket,An.tagName,An.typeName,An.propertyName],color:"#60A4F1"},{tag:An.derefOperator,color:"#E0E0E0"},{tag:An.attributeName,color:"#7BACCA"}]}),Hp({variant:"dark",settings:{background:"#2d2f3f",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"#44475a",gutterBackground:"#282a36",gutterForeground:"rgb(144, 145, 148)",lineHighlight:"#44475a"},styles:[{tag:An.comment,color:"#6272a4"},{tag:[An.string,An.special(An.brace)],color:"#f1fa8c"},{tag:[An.number,An.self,An.bool,An.null],color:"#bd93f9"},{tag:[An.keyword,An.operator],color:"#ff79c6"},{tag:[An.definitionKeyword,An.typeName],color:"#8be9fd"},{tag:An.definition(An.typeName),color:"#f8f8f2"},{tag:[An.className,An.definition(An.propertyName),An.function(An.variableName),An.attributeName],color:"#50fa7b"}]}),Hp({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#80C7FF",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#C1E2F8"},styles:[{tag:An.comment,color:"#AAAAAA"},{tag:[An.keyword,An.operator,An.typeName,An.tagName,An.propertyName],color:"#2F6F9F",fontWeight:"bold"},{tag:[An.attributeName,An.definition(An.propertyName)],color:"#4F9FD0"},{tag:[An.className,An.string,An.special(An.brace)],color:"#CF4F5F"},{tag:An.number,color:"#CF4F5F",fontWeight:"bold"},{tag:An.variableName,fontWeight:"bold"}]}),Hp({variant:"light",settings:{background:"#f2f1f8",foreground:"#0c006b",caret:"#5c49e9",selection:"#d5d1f2",gutterBackground:"#f2f1f8",gutterForeground:"#0c006b70",lineHighlight:"#e1def3"},styles:[{tag:An.comment,color:"#9995b7"},{tag:An.keyword,color:"#ff5792",fontWeight:"bold"},{tag:[An.definitionKeyword,An.modifier],color:"#ff5792"},{tag:[An.className,An.tagName,An.definition(An.typeName)],color:"#0094f0"},{tag:[An.number,An.bool,An.null,An.special(An.brace)],color:"#5842ff"},{tag:[An.definition(An.propertyName),An.function(An.variableName)],color:"#0095a8"},{tag:An.typeName,color:"#b3694d"},{tag:[An.propertyName,An.variableName],color:"#fa8900"},{tag:An.operator,color:"#ff5792"},{tag:An.self,color:"#e64100"},{tag:[An.string,An.regexp],color:"#00b368"},{tag:[An.paren,An.bracket],color:"#0431fa"},{tag:An.labelName,color:"#00bdd6"},{tag:An.attributeName,color:"#e64100"},{tag:An.angleBracket,color:"#9995b7"}]}),Hp({variant:"light",settings:{background:"#faf4ed",foreground:"#575279",caret:"#575279",selection:"#6e6a8614",gutterBackground:"#faf4ed",gutterForeground:"#57527970",lineHighlight:"#6e6a860d"},styles:[{tag:An.comment,color:"#9893a5"},{tag:[An.bool,An.null],color:"#286983"},{tag:An.number,color:"#d7827e"},{tag:An.className,color:"#d7827e"},{tag:[An.angleBracket,An.tagName,An.typeName],color:"#56949f"},{tag:An.attributeName,color:"#907aa9"},{tag:An.punctuation,color:"#797593"},{tag:[An.keyword,An.modifier],color:"#286983"},{tag:[An.string,An.regexp],color:"#ea9d34"},{tag:An.variableName,color:"#d7827e"}]}),Hp({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#FFFD0054",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#00000008"},styles:[{tag:An.comment,color:"#CFCFCF"},{tag:[An.number,An.bool,An.null],color:"#E66C29"},{tag:[An.className,An.definition(An.propertyName),An.function(An.variableName),An.labelName,An.definition(An.typeName)],color:"#2EB43B"},{tag:An.keyword,color:"#D8B229"},{tag:An.operator,color:"#4EA44E",fontWeight:"bold"},{tag:[An.definitionKeyword,An.modifier],color:"#925A47"},{tag:An.string,color:"#704D3D"},{tag:An.typeName,color:"#2F8996"},{tag:[An.variableName,An.propertyName],color:"#77ACB0"},{tag:An.self,color:"#77ACB0",fontWeight:"bold"},{tag:An.regexp,color:"#E3965E"},{tag:[An.tagName,An.angleBracket],color:"#BAA827"},{tag:An.attributeName,color:"#B06520"},{tag:An.derefOperator,color:"#000"}]}),Hp({variant:"light",settings:{background:"#fef7e5",foreground:"#586E75",caret:"#000000",selection:"#073642",gutterBackground:"#fef7e5",gutterForeground:"#586E7580",lineHighlight:"#EEE8D5"},styles:[{tag:An.comment,color:"#93A1A1"},{tag:An.string,color:"#2AA198"},{tag:An.regexp,color:"#D30102"},{tag:An.number,color:"#D33682"},{tag:An.variableName,color:"#268BD2"},{tag:[An.keyword,An.operator,An.punctuation],color:"#859900"},{tag:[An.definitionKeyword,An.modifier],color:"#073642",fontWeight:"bold"},{tag:[An.className,An.self,An.definition(An.propertyName)],color:"#268BD2"},{tag:An.function(An.variableName),color:"#268BD2"},{tag:[An.bool,An.null],color:"#B58900"},{tag:An.tagName,color:"#268BD2",fontWeight:"bold"},{tag:An.angleBracket,color:"#93A1A1"},{tag:An.attributeName,color:"#93A1A1"},{tag:An.typeName,color:"#859900"}]}),Hp({variant:"light",settings:{background:"#FFFFFF",foreground:"#4D4D4C",caret:"#AEAFAD",selection:"#D6D6D6",gutterBackground:"#FFFFFF",gutterForeground:"#4D4D4C80",lineHighlight:"#EFEFEF"},styles:[{tag:An.comment,color:"#8E908C"},{tag:[An.variableName,An.self,An.propertyName,An.attributeName,An.regexp],color:"#C82829"},{tag:[An.number,An.bool,An.null],color:"#F5871F"},{tag:[An.className,An.typeName,An.definition(An.typeName)],color:"#C99E00"},{tag:[An.string,An.special(An.brace)],color:"#718C00"},{tag:An.operator,color:"#3E999F"},{tag:[An.definition(An.propertyName),An.function(An.variableName)],color:"#4271AE"},{tag:An.keyword,color:"#8959A8"},{tag:An.derefOperator,color:"#4D4D4C"}]});const Wp=Hp({variant:"light",settings:{background:"#ffffff",foreground:"#000000",caret:"#000000",selection:"#d7d4f0",lineHighlight:"#cceeff44",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:An.comment,color:"#708090"},{tag:An.variableName,color:"#000000"},{tag:[An.string,An.special(An.brace)],color:"#a11"},{tag:An.number,color:"#164"},{tag:An.bool,color:"#219"},{tag:An.null,color:"#219"},{tag:An.keyword,color:"#708",fontWeight:500},{tag:An.className,color:"#00f"},{tag:An.definition(An.typeName),color:"#00f"},{tag:An.typeName,color:"#085"},{tag:An.angleBracket,color:"#000000"},{tag:An.tagName,color:"#170"},{tag:An.attributeName,color:"#00c"},{tag:An.operator,color:"#a2f",fontWeight:500},{tag:[An.function(An.variableName)],color:"#00c"},{tag:[An.propertyName],color:"#05a"}]});const qp=e=>{const{theme:t,hotkeys:n,completionConfig:o}=e;return[qt.lineWrapping,Pn(),Rn(),Fn(),Ln(),zn(),Bn(),Un(),Vn({position:"fixed",parent:document.querySelector("#App")??void 0}),Gn(),"dark"===t?$n:Wp,Hn(),zp(o),Wn(),qn(),vn.high(fn.of(Yn)),Xn(),Kn(),Jn.of(" "),In(Zn,{fallback:!0}),fn.of(Qn),eo(e),to.of(no()),oo.allowMultipleSelections.of(!0),Ru(n),fn.of([{key:"Tab",run:e=>ro(e)||(e=>{const{from:t,to:n}=e.state.selection.main;if(t!==n)return!1;const o=e.state.doc.lineAt(n);return""!==o.text.slice(0,n-o.from).trim()&&lo(e)})(e)||ao(e),preventDefault:!0}]),fn.of([...so,io])]};function Yp(e){const t=e.current;if(null===t)throw new ReferenceError("Attempting to dereference null object.");return t}const Xp="ContextMenu",[Kp,Jp]=co(Xp,[uo]),Zp=uo(),[Qp,eg]=Kp(Xp),tg=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,disabled:o=!1,...a}=e,s=eg("ContextMenuTrigger",n),i=Zp(n),l=r.useRef({x:0,y:0}),c=r.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),d=r.useRef(0),u=r.useCallback((()=>window.clearTimeout(d.current)),[]),h=e=>{l.current={x:e.clientX,y:e.clientY},s.onOpenChange(!0)};return r.useEffect((()=>u),[u]),r.useEffect((()=>{o&&u()}),[o,u]),r.createElement(r.Fragment,null,r.createElement(Eo,mo({},i,{virtualRef:c})),r.createElement(So.span,mo({"data-state":s.open?"open":"closed","data-disabled":o?"":void 0},a,{ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:o?e.onContextMenu:jo(e.onContextMenu,(e=>{u(),h(e),e.preventDefault()})),onPointerDown:o?e.onPointerDown:jo(e.onPointerDown,ng((e=>{u(),d.current=window.setTimeout((()=>h(e)),700)}))),onPointerMove:o?e.onPointerMove:jo(e.onPointerMove,ng(u)),onPointerCancel:o?e.onPointerCancel:jo(e.onPointerCancel,ng(u)),onPointerUp:o?e.onPointerUp:jo(e.onPointerUp,ng(u))})))}));function ng(e){return t=>"mouse"!==t.pointerType?e(t):void 0}const og=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=eg("ContextMenuContent",n),s=Zp(n),i=r.useRef(!1);return r.createElement(fo,mo({},s,o,{ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:t=>{var n;null===(n=e.onCloseAutoFocus)||void 0===n||n.call(e,t),!t.defaultPrevented&&i.current&&t.preventDefault(),i.current=!1},onInteractOutside:t=>{var n;null===(n=e.onInteractOutside)||void 0===n||n.call(e,t),t.defaultPrevented||a.modal||(i.current=!0)},style:{...e.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)"}}))})),rg=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Zp(n);return r.createElement(po,mo({},a,o,{ref:t}))})),ag=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Zp(n);return r.createElement(go,mo({},a,o,{ref:t}))})),sg=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Zp(n);return r.createElement(vo,mo({},a,o,{ref:t}))})),ig=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Zp(n);return r.createElement(xo,mo({},a,o,{ref:t}))})),lg=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Zp(n);return r.createElement(ko,mo({},a,o,{ref:t}))})),cg=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Zp(n);return r.createElement(yo,mo({},a,o,{ref:t}))})),dg=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Zp(n);return r.createElement(bo,mo({},a,o,{ref:t}))})),ug=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Zp(n);return r.createElement(wo,mo({},a,o,{ref:t,style:{...e.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)"}}))})),hg=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:o,dir:a,modal:s=!0}=e,[i,l]=r.useState(!1),c=Zp(t),d=No(o),u=r.useCallback((e=>{l(e),d(e)}),[d]);return r.createElement(Qp,{scope:t,open:i,onOpenChange:u,modal:s},r.createElement(Co,mo({},c,{dir:a,open:i,onOpenChange:u,modal:s}),n))},mg=tg,fg=_o((e=>{const{__scopeContextMenu:t,...n}=e,o=Zp(t);return r.createElement(ho,mo({},o,n))}));r.forwardRef(((e,t)=>{const n=b(14);let o,r,a,s,i,l,c;return n[0]!==e?(({className:o,inset:r,children:s,...a}=e),n[0]=e,n[1]=o,n[2]=r,n[3]=a,n[4]=s):(o=n[1],r=n[2],a=n[3],s=n[4]),n[5]!==o||n[6]!==r?(i=Io({className:o,inset:r}),n[5]=o,n[6]=r,n[7]=i):i=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=k.jsx(Ro,{className:"ml-auto h-4 w-4"}),n[8]=l):l=n[8],n[9]!==t||n[10]!==i||n[11]!==a||n[12]!==s?(c=k.jsxs(dg,{ref:t,className:i,...a,children:[s,l]}),n[9]=t,n[10]=i,n[11]=a,n[12]=s,n[13]=c):c=n[13],c})).displayName=dg.displayName;const pg="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";r.forwardRef(((e,t)=>{const n=b(9);let o,r,a,s;return n[0]!==e?(({className:o,...r}=e),n[0]=e,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(a=on(Ao({subcontent:!0}),pg,o),n[3]=o,n[4]=a):a=n[4],n[5]!==t||n[6]!==a||n[7]!==r?(s=k.jsx(ug,{ref:t,className:a,...r}),n[5]=t,n[6]=a,n[7]=r,n[8]=s):s=n[8],s})).displayName=ug.displayName;const gg=r.forwardRef(((e,t)=>{const n=b(9);let o,r,a,s;return n[0]!==e?(({className:o,...r}=e),n[0]=e,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(a=on(Ao(),pg,o),n[3]=o,n[4]=a):a=n[4],n[5]!==t||n[6]!==a||n[7]!==r?(s=k.jsx(fg,{children:k.jsx(Mo,{children:k.jsx(og,{ref:t,className:a,...r})})}),n[5]=t,n[6]=a,n[7]=r,n[8]=s):s=n[8],s}));gg.displayName=og.displayName;const vg=r.forwardRef(((e,t)=>{const n=b(13);let o,r,a,s,i,l;return n[0]!==e?(({className:o,inset:r,variant:a,...s}=e),n[0]=e,n[1]=o,n[2]=r,n[3]=a,n[4]=s):(o=n[1],r=n[2],a=n[3],s=n[4]),n[5]!==o||n[6]!==r||n[7]!==a?(i=To({className:o,inset:r,variant:a}),n[5]=o,n[6]=r,n[7]=a,n[8]=i):i=n[8],n[9]!==t||n[10]!==i||n[11]!==s?(l=k.jsx(ag,{ref:t,className:i,...s}),n[9]=t,n[10]=i,n[11]=s,n[12]=l):l=n[12],l}));vg.displayName=ag.displayName;r.forwardRef(((e,t)=>{const n=b(15);let o,r,a,s,i,l,c,d;return n[0]!==e?(({className:o,children:s,checked:r,...a}=e),n[0]=e,n[1]=o,n[2]=r,n[3]=a,n[4]=s):(o=n[1],r=n[2],a=n[3],s=n[4]),n[5]!==o?(i=Oo({className:o}),n[5]=o,n[6]=i):i=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=Oo(),n[7]=l):l=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx("span",{className:l,children:k.jsx(lg,{children:k.jsx(Fo,{className:"h-4 w-4"})})}),n[8]=c):c=n[8],n[9]!==t||n[10]!==i||n[11]!==r||n[12]!==a||n[13]!==s?(d=k.jsxs(sg,{ref:t,className:i,checked:r,...a,children:[c,s]}),n[9]=t,n[10]=i,n[11]=r,n[12]=a,n[13]=s,n[14]=d):d=n[14],d})).displayName=sg.displayName;r.forwardRef(((e,t)=>{const n=b(13);let o,r,a,s,i,l,c;return n[0]!==e?(({className:o,children:a,...r}=e),n[0]=e,n[1]=o,n[2]=r,n[3]=a):(o=n[1],r=n[2],a=n[3]),n[4]!==o?(s=Oo({className:o}),n[4]=o,n[5]=s):s=n[5],n[6]===Symbol.for("react.memo_cache_sentinel")?(i=Oo(),n[6]=i):i=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=k.jsx("span",{className:i,children:k.jsx(lg,{children:k.jsx(Lo,{className:"h-4 w-4 fill-current"})})}),n[7]=l):l=n[7],n[8]!==t||n[9]!==s||n[10]!==r||n[11]!==a?(c=k.jsxs(ig,{ref:t,className:s,...r,children:[l,a]}),n[8]=t,n[9]=s,n[10]=r,n[11]=a,n[12]=c):c=n[12],c})).displayName=ig.displayName;r.forwardRef(((e,t)=>{const n=b(11);let o,r,a,s,i;return n[0]!==e?(({className:o,inset:r,...a}=e),n[0]=e,n[1]=o,n[2]=r,n[3]=a):(o=n[1],r=n[2],a=n[3]),n[4]!==o||n[5]!==r?(s=Do({className:o,inset:r}),n[4]=o,n[5]=r,n[6]=s):s=n[6],n[7]!==t||n[8]!==s||n[9]!==a?(i=k.jsx(rg,{ref:t,className:s,...a}),n[7]=t,n[8]=s,n[9]=a,n[10]=i):i=n[10],i})).displayName=rg.displayName;const xg=r.forwardRef(((e,t)=>{const n=b(9);let o,r,a,s;return n[0]!==e?(({className:o,...r}=e),n[0]=e,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(a=on(Po({className:o})),n[3]=o,n[4]=a):a=n[4],n[5]!==t||n[6]!==a||n[7]!==r?(s=k.jsx(cg,{ref:t,className:a,...r}),n[5]=t,n[6]=a,n[7]=r,n[8]=s):s=n[8],s}));xg.displayName=cg.displayName;const yg=e=>{const t=b(14),{appClosed:n,onClick:o,tooltipContent:r}=e;let a;t[0]!==o?(a=()=>null==o?void 0:o({code:""}),t[0]=o,t[1]=a):a=t[1];const s=n&&" inactive-button";let i,l,c,d,u;return t[2]!==s?(i=on("shoulder-button hover-action",s),t[2]=s,t[3]=i):i=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(l=k.jsx(zo,{strokeWidth:1.8}),t[4]=l):l=t[4],t[5]!==a||t[6]!==i?(c=k.jsx(bi,{onClick:a,className:i,onMouseDown:tt.preventFocus,shape:"circle",size:"small",color:"hint-green","data-testid":"create-cell-button",children:l}),t[5]=a,t[6]=i,t[7]=c):c=t[7],t[8]!==r||t[9]!==c?(d=k.jsx(C,{content:r,usePortal:!1,children:c}),t[8]=r,t[9]=c,t[10]=d):d=t[10],t[11]!==o||t[12]!==d?(u=k.jsx(bg,{onClick:o,children:d}),t[11]=o,t[12]=d,t[13]=u):u=t[13],u},bg=e=>{const t=b(24),{children:n,onClick:o}=e;if(!o)return n;let r,a,s,i,l,c,d,u,h,m,f,p;return t[0]!==n?(r=k.jsx(mg,{children:n}),t[0]=n,t[1]=r):r=t[1],t[2]!==o?(a=e=>{e.stopPropagation(),o({code:""})},t[2]=o,t[3]=a):a=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(s=k.jsx("div",{className:"mr-3 text-muted-foreground",children:k.jsx(Ci,{})}),t[4]=s):s=t[4],t[5]!==a?(i=k.jsxs(vg,{onSelect:a,children:[s,"Python cell"]},"python"),t[5]=a,t[6]=i):i=t[6],t[7]!==o?(l=e=>{e.stopPropagation(),o({code:(new Bo).defaultCode})},t[7]=o,t[8]=l):l=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx("div",{className:"mr-3 text-muted-foreground",children:k.jsx(Ni,{})}),t[9]=c):c=t[9],t[10]!==l?(d=k.jsxs(vg,{onSelect:l,children:[c,"Markdown cell"]},"markdown"),t[10]=l,t[11]=d):d=t[11],t[12]!==o?(u=e=>{e.stopPropagation(),o({code:(new Uo).defaultCode})},t[12]=o,t[13]=u):u=t[13],t[14]===Symbol.for("react.memo_cache_sentinel")?(h=k.jsx("div",{className:"mr-3 text-muted-foreground",children:k.jsx(ke,{size:13,strokeWidth:1.5})}),t[14]=h):h=t[14],t[15]!==u?(m=k.jsxs(vg,{onSelect:u,children:[h,"SQL cell"]},"sql"),t[15]=u,t[16]=m):m=t[16],t[17]!==i||t[18]!==d||t[19]!==m?(f=k.jsxs(gg,{children:[i,d,m]}),t[17]=i,t[18]=d,t[19]=m,t[20]=f):f=t[20],t[21]!==r||t[22]!==f?(p=k.jsxs(hg,{children:[r,f]}),t[21]=r,t[22]=f,t[23]=p):p=t[23],p},wg=Vo("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"}}),kg=e=>{const t=b(21);let n,o,r,a,s;t[0]!==e?(({children:a,tooltip:s,disabled:n,variant:r,...o}=e),t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=a,t[5]=s):(n=t[1],o=t[2],r=t[3],a=t[4],s=t[5]);const i=void 0!==n&&n;let l,c,d;t[6]!==i||t[7]!==o.onClick?(l=e=>{var t;i||null==(t=o.onClick)||t.call(o,e)},t[6]=i,t[7]=o.onClick,t[8]=l):l=t[8],t[9]!==r||t[10]!==o.className?(c=on(wg({variant:r}),o.className),t[9]=r,t[10]=o.className,t[11]=c):c=t[11],t[12]!==i||t[13]!==o||t[14]!==l||t[15]!==c||t[16]!==a?(d=k.jsx("button",{disabled:i,...o,onClick:l,onMouseDown:tt.preventFocus,className:c,children:a}),t[12]=i,t[13]=o,t[14]=l,t[15]=c,t[16]=a,t[17]=d):d=t[17];const u=d;if(s){let e;return t[18]!==s||t[19]!==u?(e=k.jsx(C,{content:s,side:"top",delayDuration:200,usePortal:!1,children:u}),t[18]=s,t[19]=u,t[20]=e):e=t[20],e}return u},Ng=({children:e,className:t})=>k.jsx(Zc,{className:on("flex items-center gap-1 bg-background m-[2px] rounded-full",t),children:e});const Cg=e=>{const t=b(22),{onClick:n,appClosed:o,needsRun:r,status:a,config:s,edited:i}=e,l="disabled-transitively"===a,c="running"===a||"queued"===a,d=o||c||!s.disabled&&l&&!i;let u;t[0]!==o||t[1]!==r||t[2]!==c||t[3]!==d?(u=function(e,t,n,o){return e?"disabled":t&&!n?"stale":n||o?"disabled":"green"}(o,r,c,d),t[0]=o,t[1]=r,t[2]=c,t[3]=d,t[4]=u):u=t[4];const h=u;if(s.disabled){let e,o;return t[5]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx(sc,{}),t[5]=e):e=t[5],t[6]!==d||t[7]!==n||t[8]!==h?(o=k.jsx(kg,{tooltip:"Add code to notebook",disabled:d,onClick:n,variant:h,"data-testid":"run-button",children:e}),t[6]=d,t[7]=n,t[8]=h,t[9]=o):o=t[9],o}if(!s.disabled&&l&&!i){let e,o;return t[10]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx(Cc,{strokeWidth:1.2}),t[10]=e):e=t[10],t[11]!==d||t[12]!==n||t[13]!==h?(o=k.jsx(kg,{disabled:d,tooltip:"This cell can't be run because it has a disabled ancestor",onClick:n,variant:h,"data-testid":"run-button",children:e}),t[11]=d,t[12]=n,t[13]=h,t[14]=o):o=t[14],o}let m,f,p;if(o)m="App disconnected";else if("queued"===a)m="This cell is already queued to run";else if("running"===a)m="This cell is already running.";else{let e;t[15]===Symbol.for("react.memo_cache_sentinel")?(e=N("cell.run"),t[15]=e):e=t[15],m=e}return t[16]===Symbol.for("react.memo_cache_sentinel")?(f=k.jsx(Cc,{strokeWidth:1.2}),t[16]=f):f=t[16],t[17]!==m||t[18]!==d||t[19]!==n||t[20]!==h?(p=k.jsx(kg,{tooltip:m,disabled:d,onClick:n,variant:h,"data-testid":"run-button",children:f}),t[17]=m,t[18]=d,t[19]=n,t[20]=h,t[21]=p):p=t[21],p},Eg=e=>{const t=b(10),{status:n,appClosed:o,onClick:r}=e;let a;a=o?"App disconnected":"running"===n?"A cell can't be deleted when it's running":"queued"===n?"A cell can't be deleted when it's queued to run":"Delete";const s=a,i=(o||("running"===n||"queued"===n))&&"inactive-button";let l,c,d,u,h;return t[0]!==i?(l=on("hover:bg-transparent text-destructive/60 hover:text-destructive",i),t[0]=i,t[1]=l):l=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(c={boxShadow:"none"},d=k.jsx(je,{size:14}),t[2]=c,t[3]=d):(c=t[2],d=t[3]),t[4]!==r||t[5]!==l?(u=k.jsx(E,{variant:"ghost",size:"icon",onClick:r,"data-testid":"delete-button",onMouseDown:tt.preventFocus,className:l,style:c,children:d}),t[4]=r,t[5]=l,t[6]=u):u=t[6],t[7]!==a||t[8]!==u?(h=k.jsx(C,{content:s,usePortal:!1,children:u}),t[7]=a,t[8]=u,t[9]=h):h=t[9],h};const Sg=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),jg=new Intl.DateTimeFormat("en-US",{month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),_g=e=>{const t=b(79),{editing:n,status:o,disabled:r,staleInputs:a,edited:s,interrupted:i,elapsedTime:l,runStartTimestamp:c,lastRunStartTimestamp:d,uninstantiated:u}=e;if(!n)return null;const h=c??d;let m;t[0]!==h?(m=h?k.jsx(Ag,{lastRanTime:h}):null,t[0]=h,t[1]=m):m=t[1];const f=m;if(r&&"running"===o)return J.error("CellStatusComponent: disabled and running"),null;if(r&&a){let e,n,o,r;return t[2]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx("span",{children:"This cell is stale, but it's disabled and can't be run"}),t[2]=e):e=t[2],t[3]!==f?(n=k.jsxs("div",{className:"flex flex-col gap-1",children:[e,f]}),t[3]=f,t[4]=n):n=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(o=k.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:k.jsxs(fd,{children:[k.jsx(Ll,{className:"h-5 w-5",strokeWidth:1.5}),k.jsx($o,{className:"h-3 w-3",strokeWidth:2.5})]})}),t[5]=o):o=t[5],t[6]!==n?(r=k.jsx(C,{content:n,usePortal:!1,children:o}),t[6]=n,t[7]=r):r=t[7],r}if(r){let e,n,o,r;return t[8]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx("span",{children:"This cell is disabled"}),t[8]=e):e=t[8],t[9]!==f?(n=k.jsxs("div",{className:"flex flex-col gap-1",children:[e,f]}),t[9]=f,t[10]=n):n=t[10],t[11]===Symbol.for("react.memo_cache_sentinel")?(o=k.jsx("div",{className:"cell-status-icon cell-status-disabled","data-testid":"cell-status","data-status":"disabled",children:k.jsx(Ll,{className:"h-5 w-5",strokeWidth:1.5})}),t[11]=o):o=t[11],t[12]!==n?(r=k.jsx(C,{content:n,usePortal:!1,children:o}),t[12]=n,t[13]=r):r=t[13],r}if(!a&&"disabled-transitively"===o){let e,n,o,r;return t[14]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx("span",{children:"An ancestor of this cell is disabled, so it can't be run"}),t[14]=e):e=t[14],t[15]!==f?(n=k.jsxs("div",{className:"flex flex-col gap-1",children:[e,f]}),t[15]=f,t[16]=n):n=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(o=k.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"disabled-transitively",children:k.jsxs(fd,{layerTop:!0,children:[k.jsx(qc,{className:"h-5 w-5",strokeWidth:1.5}),k.jsx(Ll,{className:"h-3 w-3",strokeWidth:2.5})]})}),t[17]=o):o=t[17],t[18]!==n?(r=k.jsx(C,{content:n,usePortal:!1,children:o}),t[18]=n,t[19]=r):r=t[19],r}if(a&&"disabled-transitively"===o){let e,n,o,r;return t[20]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx("span",{children:"This cell is stale, but an ancestor is disabled so it can't be run"}),t[20]=e):e=t[20],t[21]!==f?(n=k.jsxs("div",{className:"flex flex-col gap-1",children:[e,f]}),t[21]=f,t[22]=n):n=t[22],t[23]===Symbol.for("react.memo_cache_sentinel")?(o=k.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:k.jsxs(fd,{children:[k.jsx($o,{className:"h-5 w-5",strokeWidth:1}),k.jsx(Ll,{className:"h-3 w-3",strokeWidth:2.5})]})}),t[23]=o):o=t[23],t[24]!==n?(r=k.jsx(C,{content:n,usePortal:!1,children:o}),t[24]=n,t[25]=r):r=t[25],r}if("running"===o){let e,n,o,r,a;return t[26]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx("span",{children:"This cell is running"}),t[26]=e):e=t[26],t[27]!==f?(n=k.jsxs("div",{className:"flex flex-col gap-1",children:[e,f]}),t[27]=f,t[28]=n):n=t[28],t[29]!==c?(o=Go.fromSeconds(c)||Go.now(),t[29]=c,t[30]=o):o=t[30],t[31]!==o?(r=k.jsx("div",{className:"cell-status-icon elapsed-time running","data-testid":"cell-status","data-status":"running",children:k.jsx(Tg,{startTime:o})}),t[31]=o,t[32]=r):r=t[32],t[33]!==n||t[34]!==r?(a=k.jsx(C,{content:n,usePortal:!1,children:r}),t[33]=n,t[34]=r,t[35]=a):a=t[35],a}if("queued"===o){let e,n,o,r;return t[36]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx("span",{children:"This cell is queued to run"}),t[36]=e):e=t[36],t[37]!==f?(n=k.jsxs("div",{className:"flex flex-col gap-1",children:[e,f]}),t[37]=f,t[38]=n):n=t[38],t[39]===Symbol.for("react.memo_cache_sentinel")?(o=k.jsx("div",{className:"cell-status-icon cell-status-queued","data-testid":"cell-status","data-status":"queued",children:k.jsx(sl,{className:"h-5 w-5",strokeWidth:1.5})}),t[39]=o):o=t[39],t[40]!==n?(r=k.jsx(C,{content:n,usePortal:!1,children:o}),t[40]=n,t[41]=r):r=t[41],r}if(s||i||a||u){let e;t[42]!==l?(e=Mg(l),t[42]=l,t[43]=e):e=t[43];const n=e;let o;t[44]!==l||t[45]!==n?(o=l?k.jsx(Ig,{elapsedTime:n}):null,t[44]=l,t[45]=n,t[46]=o):o=t[46];const r=o;let a,c,d,h,m,p="";if(u)a="This cell has not yet been run";else if(i){let e;a="This cell was interrupted when it was last run",t[47]!==r?(e=k.jsxs("span",{children:["This cell ran for ",r," before being interrupted"]}),t[47]=r,t[48]=e):e=t[48],p=e}else if(s){let e;a="This cell has been modified since it was last run",t[49]!==r?(e=k.jsxs("span",{children:["This cell took ",r," to run"]}),t[49]=r,t[50]=e):e=t[50],p=e}else{let e;a="This cell has not been run with the latest inputs",t[51]!==r?(e=k.jsxs("span",{children:["This cell took ",r," to run"]}),t[51]=r,t[52]=e):e=t[52],p=e}return t[53]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx("div",{className:"cell-status-stale","data-testid":"cell-status","data-status":"outdated",children:k.jsx($o,{className:"h-5 w-5",strokeWidth:1.5})}),t[53]=c):c=t[53],t[54]!==a?(d=k.jsx(C,{content:a,usePortal:!1,children:c}),t[54]=a,t[55]=d):d=t[55],t[56]!==l||t[57]!==p||t[58]!==f||t[59]!==n?(h=l&&k.jsx(C,{content:k.jsxs("div",{className:"flex flex-col gap-1",children:[p,f]}),usePortal:!1,children:k.jsx("div",{className:"elapsed-time hover-action","data-testid":"cell-status","data-status":"outdated",children:k.jsx("span",{children:n})})}),t[56]=l,t[57]=p,t[58]=f,t[59]=n,t[60]=h):h=t[60],t[61]!==d||t[62]!==h?(m=k.jsxs("div",{className:"cell-status-icon flex items-center gap-2",children:[d,h]}),t[61]=d,t[62]=h,t[63]=m):m=t[63],m}if(null!==l){let e;t[64]!==l?(e=Mg(l),t[64]=l,t[65]=e):e=t[65];const n=e;let o;t[66]!==l||t[67]!==n?(o=l?k.jsx(Ig,{elapsedTime:n}):null,t[66]=l,t[67]=n,t[68]=o):o=t[68];const r=o;let a,s,i,c;return t[69]!==r?(a=k.jsxs("span",{children:["This cell took ",r," to run"]}),t[69]=r,t[70]=a):a=t[70],t[71]!==a||t[72]!==f?(s=k.jsxs("div",{className:"flex flex-col gap-1",children:[a,f]}),t[71]=a,t[72]=f,t[73]=s):s=t[73],t[74]!==n?(i=k.jsx("div",{className:"cell-status-icon elapsed-time hover-action","data-testid":"cell-status","data-status":"idle",children:k.jsx("span",{children:n})}),t[74]=n,t[75]=i):i=t[75],t[76]!==s||t[77]!==i?(c=k.jsx(C,{content:s,usePortal:!1,children:i}),t[76]=s,t[77]=i,t[78]=c):c=t[78],c}return null},Ig=e=>{const t=b(2);let n;return t[0]!==e.elapsedTime?(n=k.jsx("span",{className:"tracking-wide font-semibold",children:e.elapsedTime}),t[0]=e.elapsedTime,t[1]=n):n=t[1],n},Ag=e=>{const t=b(18),n=1e3*e.lastRanTime;let o,r,a,s,i,l,c,d,u;if(t[0]!==n){const e=new Date(n),d=new Date,u=e.toDateString()===d.toDateString()?Sg:jg;s="Ran at",i=" ",l=k.jsx("strong",{className:"tracking-wide font-semibold",children:u.format(e)}),c=" ",o="text-muted-foreground",r="(",a=od(e),t[0]=n,t[1]=o,t[2]=r,t[3]=a,t[4]=s,t[5]=i,t[6]=l,t[7]=c}else o=t[1],r=t[2],a=t[3],s=t[4],i=t[5],l=t[6],c=t[7];return t[8]!==o||t[9]!==r||t[10]!==a?(d=k.jsxs("span",{className:o,children:[r,a," ago)"]}),t[8]=o,t[9]=r,t[10]=a,t[11]=d):d=t[11],t[12]!==s||t[13]!==i||t[14]!==l||t[15]!==c||t[16]!==d?(u=k.jsxs("span",{children:[s,i,l,c,d]}),t[12]=s,t[13]=i,t[14]=l,t[15]=c,t[16]=d,t[17]=u):u=t[17],u};function Mg(e){if(null===e)return"";if(e>6e4){const t=(e/6e4).toFixed(0),n=(e%6e4/1e3).toFixed(0);return`${t.toString()}m${n.toString()}s`}return e>1e3?`${(e/1e3).toFixed(2).toString()}s`:`${e.toFixed(0).toString()}ms`}const Tg=e=>{const t=b(6);let n;t[0]!==e.startTime?(n=e.startTime.toMilliseconds(),t[0]=e.startTime,t[1]=n):n=t[1];const o=function(e){const t=r.useRef(e),[n,o]=r.useState(e);return r.useEffect((()=>{const e=setInterval((()=>{o(Go.now().toMilliseconds())}),17);return()=>clearInterval(e)}),[]),n-t.current}(n);let a,s;return t[2]!==o?(a=Mg(o),t[2]=o,t[3]=a):a=t[3],t[4]!==a?(s=k.jsx("span",{children:a}),t[4]=a,t[5]=s):s=t[5],s};function Og(...e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}const Dg={display:"none"};function Pg(e){let{id:t,value:n}=e;return u.createElement("div",{id:t,style:Dg},n)}function Rg(e){let{id:t,announcement:n,ariaLiveType:o="assertive"}=e;return u.createElement("div",{id:t,style:{position:"fixed",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 Fg=r.createContext(null);const Lg={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},zg={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Bg(e){let{announcements:t=zg,container:n,hiddenTextDescribedById:o,screenReaderInstructions:a=Lg}=e;const{announce:s,announcement:i}=function(){const[e,t]=r.useState("");return{announce:r.useCallback((e=>{null!=e&&t(e)}),[]),announcement:e}}(),l=Jo("DndLiveRegion"),[c,d]=r.useState(!1);if(r.useEffect((()=>{d(!0)}),[]),function(e){const t=r.useContext(Fg);r.useEffect((()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)}),[e,t])}(r.useMemo((()=>({onDragStart(e){let{active:n}=e;s(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:o}=e;t.onDragMove&&s(t.onDragMove({active:n,over:o}))},onDragOver(e){let{active:n,over:o}=e;s(t.onDragOver({active:n,over:o}))},onDragEnd(e){let{active:n,over:o}=e;s(t.onDragEnd({active:n,over:o}))},onDragCancel(e){let{active:n,over:o}=e;s(t.onDragCancel({active:n,over:o}))}})),[s,t])),!c)return null;const h=u.createElement(u.Fragment,null,u.createElement(Pg,{id:o,value:a.draggable}),u.createElement(Rg,{id:l,announcement:i}));return n?Qo.createPortal(h,n):h}var Ug,Vg;function Gg(){}function $g(e,t){return r.useMemo((()=>({sensor:e,options:null!=t?t:{}})),[e,t])}(Vg=Ug||(Ug={})).DragStart="dragStart",Vg.DragMove="dragMove",Vg.DragEnd="dragEnd",Vg.DragCancel="dragCancel",Vg.DragOver="dragOver",Vg.RegisterDroppable="registerDroppable",Vg.SetDroppableDisabled="setDroppableDisabled",Vg.UnregisterDroppable="unregisterDroppable";const Hg=Object.freeze({x:0,y:0});function Wg(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function qg(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function Yg(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function Xg(e){let{left:t,top:n,height:o,width:r}=e;return[{x:t,y:n},{x:t+r,y:n},{x:t,y:n+o},{x:t+r,y:n+o}]}function Kg(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function Jg(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const Zg=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e;const r=Jg(t,t.left,t.top),a=[];for(const s of o){const{id:e}=s,t=n.get(e);if(t){const n=Wg(Jg(t),r);a.push({id:e,data:{droppableContainer:s,value:n}})}}return a.sort(qg)};function Qg(e,t){const n=Math.max(t.top,e.top),o=Math.max(t.left,e.left),r=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),s=r-o,i=a-n;if(o<r&&n<a){const n=t.width*t.height,o=e.width*e.height,r=s*i;return Number((r/(n+o-r)).toFixed(4))}return 0}const ev=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e;const r=[];for(const a of o){const{id:e}=a,o=n.get(e);if(o){const n=Qg(o,t);n>0&&r.push({id:e,data:{droppableContainer:a,value:n}})}}return r.sort(Yg)};function tv(e,t){const{top:n,left:o,bottom:r,right:a}=t;return n<=e.y&&e.y<=r&&o<=e.x&&e.x<=a}function nv(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Hg}function ov(e){return function(t){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(((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x})),{...t})}}const rv=ov(1);const av={ignoreTransform:!1};function sv(e,t){void 0===t&&(t=av);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:o}=Ho(e).getComputedStyle(e);t&&(n=function(e,t,n){const o=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!o)return e;const{scaleX:r,scaleY:a,x:s,y:i}=o,l=e.left-s-(1-r)*parseFloat(n),c=e.top-i-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),d=r?e.width/r:e.width,u=a?e.height/a:e.height;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l}}(n,t,o))}const{top:o,left:r,width:a,height:s,bottom:i,right:l}=n;return{top:o,left:r,width:a,height:s,bottom:i,right:l}}function iv(e){return sv(e,{ignoreTransform:!0})}function lv(e,t){const n=[];return e?function o(r){if(null!=t&&n.length>=t)return n;if(!r)return n;if(lr(r)&&null!=r.scrollingElement&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!ar(r)||cr(r))return n;if(n.includes(r))return n;const a=Ho(e).getComputedStyle(r);return r!==e&&function(e,t){void 0===t&&(t=Ho(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some((e=>{const o=t[e];return"string"==typeof o&&n.test(o)}))}(r,a)&&n.push(r),function(e,t){return void 0===t&&(t=Ho(e).getComputedStyle(e)),"fixed"===t.position}(r,a)?n:o(r.parentNode)}(e):n}function cv(e){const[t]=lv(e,1);return null!=t?t:null}function dv(e){return rr&&e?dr(e)?e:ur(e)?lr(e)||e===Wo(e).scrollingElement?window:ar(e)?e:null:null:null}function uv(e){return dr(e)?e.scrollX:e.scrollLeft}function hv(e){return dr(e)?e.scrollY:e.scrollTop}function mv(e){return{x:uv(e),y:hv(e)}}var fv,pv;function gv(e){return!(!rr||!e)&&e===document.scrollingElement}function vv(e){const t={x:0,y:0},n=gv(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},o={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=o.y,isRight:e.scrollLeft>=o.x,maxScroll:o,minScroll:t}}(pv=fv||(fv={}))[pv.Forward=1]="Forward",pv[pv.Backward=-1]="Backward";const xv={x:.2,y:.2};function yv(e,t,n,o,r){let{top:a,left:s,right:i,bottom:l}=n;void 0===o&&(o=10),void 0===r&&(r=xv);const{isTop:c,isBottom:d,isLeft:u,isRight:h}=vv(e),m={x:0,y:0},f={x:0,y:0},p=t.height*r.y,g=t.width*r.x;return!c&&a<=t.top+p?(m.y=fv.Backward,f.y=o*Math.abs((t.top+p-a)/p)):!d&&l>=t.bottom-p&&(m.y=fv.Forward,f.y=o*Math.abs((t.bottom-p-l)/p)),!h&&i>=t.right-g?(m.x=fv.Forward,f.x=o*Math.abs((t.right-g-i)/g)):!u&&s<=t.left+g&&(m.x=fv.Backward,f.x=o*Math.abs((t.left+g-s)/g)),{direction:m,speed:f}}function bv(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:o,bottom:r}=e.getBoundingClientRect();return{top:t,left:n,right:o,bottom:r,width:e.clientWidth,height:e.clientHeight}}function wv(e){return e.reduce(((e,t)=>Xo(e,mv(t))),Hg)}const kv=[["x",["left","right"],function(e){return e.reduce(((e,t)=>e+uv(t)),0)}],["y",["top","bottom"],function(e){return e.reduce(((e,t)=>e+hv(t)),0)}]];class Nv{constructor(e,t){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 n=lv(t),o=wv(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[r,a,s]of kv)for(const e of a)Object.defineProperty(this,e,{get:()=>{const t=s(n),a=o[r]-t;return this.rect[e]+a},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Cv{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach((e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)}))},this.target=e}add(e,t,n){var o;null==(o=this.target)||o.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function Ev(e,t){const n=Math.abs(e.x),o=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+o**2)>t:"x"in t&&"y"in t?n>t.x&&o>t.y:"x"in t?n>t.x:"y"in t&&o>t.y}var Sv,jv,_v,Iv;function Av(e){e.preventDefault()}function Mv(e){e.stopPropagation()}(jv=Sv||(Sv={})).Click="click",jv.DragStart="dragstart",jv.Keydown="keydown",jv.ContextMenu="contextmenu",jv.Resize="resize",jv.SelectionChange="selectionchange",jv.VisibilityChange="visibilitychange",(Iv=_v||(_v={})).Space="Space",Iv.Down="ArrowDown",Iv.Right="ArrowRight",Iv.Left="ArrowLeft",Iv.Up="ArrowUp",Iv.Esc="Escape",Iv.Enter="Enter";const Tv={start:[_v.Space,_v.Enter],cancel:[_v.Esc],end:[_v.Space,_v.Enter]},Ov=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case _v.Right:return{...n,x:n.x+25};case _v.Left:return{...n,x:n.x-25};case _v.Down:return{...n,y:n.y+25};case _v.Up:return{...n,y:n.y-25}}};class Dv{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:t}}=e;this.props=e,this.listeners=new Cv(Wo(t)),this.windowListeners=new Cv(Ho(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Sv.Resize,this.handleCancel),this.windowListeners.add(Sv.VisibilityChange,this.handleCancel),setTimeout((()=>this.listeners.add(Sv.Keydown,this.handleKeyDown)))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=sv),!e)return;const{top:n,left:o,bottom:r,right:a}=t(e);cv(e)&&(r<=0||a<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(Hg)}handleKeyDown(e){if(qo(e)){const{active:t,context:n,options:o}=this.props,{keyboardCodes:r=Tv,coordinateGetter:a=Ov,scrollBehavior:s="smooth"}=o,{code:i}=e;if(r.end.includes(i))return void this.handleEnd(e);if(r.cancel.includes(i))return void this.handleCancel(e);const{collisionRect:l}=n.current,c=l?{x:l.left,y:l.top}:Hg;this.referenceCoordinates||(this.referenceCoordinates=c);const d=a(e,{active:t,context:n.current,currentCoordinates:c});if(d){const t=Yo(d,c),o={x:0,y:0},{scrollableAncestors:r}=n.current;for(const n of r){const r=e.code,{isTop:a,isRight:i,isLeft:l,isBottom:c,maxScroll:u,minScroll:h}=vv(n),m=bv(n),f={x:Math.min(r===_v.Right?m.right-m.width/2:m.right,Math.max(r===_v.Right?m.left:m.left+m.width/2,d.x)),y:Math.min(r===_v.Down?m.bottom-m.height/2:m.bottom,Math.max(r===_v.Down?m.top:m.top+m.height/2,d.y))},p=r===_v.Right&&!i||r===_v.Left&&!l,g=r===_v.Down&&!c||r===_v.Up&&!a;if(p&&f.x!==d.x){const e=n.scrollLeft+t.x,a=r===_v.Right&&e<=u.x||r===_v.Left&&e>=h.x;if(a&&!t.y)return void n.scrollTo({left:e,behavior:s});o.x=a?n.scrollLeft-e:r===_v.Right?n.scrollLeft-u.x:n.scrollLeft-h.x,o.x&&n.scrollBy({left:-o.x,behavior:s});break}if(g&&f.y!==d.y){const e=n.scrollTop+t.y,a=r===_v.Down&&e<=u.y||r===_v.Up&&e>=h.y;if(a&&!t.x)return void n.scrollTo({top:e,behavior:s});o.y=a?n.scrollTop-e:r===_v.Down?n.scrollTop-u.y:n.scrollTop-h.y,o.y&&n.scrollBy({top:-o.y,behavior:s});break}}this.handleMove(e,Xo(Yo(d,this.referenceCoordinates),o))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function Pv(e){return Boolean(e&&"distance"in e)}function Rv(e){return Boolean(e&&"delay"in e)}Dv.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:o=Tv,onActivation:r}=t,{active:a}=n;const{code:s}=e.nativeEvent;if(o.start.includes(s)){const t=a.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==r||r({event:e.nativeEvent}),!0)}return!1}}];class Fv{constructor(e,t,n){var o;void 0===n&&(n=function(e){const{EventTarget:t}=Ho(e);return e instanceof t?e:Wo(e)}(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=t;const{event:r}=e,{target:a}=r;this.props=e,this.events=t,this.document=Wo(a),this.documentListeners=new Cv(this.document),this.listeners=new Cv(n),this.windowListeners=new Cv(Ho(a)),this.initialCoordinates=null!=(o=Zo(r))?o:Hg,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:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(Sv.Resize,this.handleCancel),this.windowListeners.add(Sv.DragStart,Av),this.windowListeners.add(Sv.VisibilityChange,this.handleCancel),this.windowListeners.add(Sv.ContextMenu,Av),this.documentListeners.add(Sv.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Rv(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay));if(Pv(t))return}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Sv.Click,Mv,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Sv.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:o,props:r}=this,{onMove:a,options:{activationConstraint:s}}=r;if(!o)return;const i=null!=(t=Zo(e))?t:Hg,l=Yo(o,i);if(!n&&s){if(Pv(s)){if(null!=s.tolerance&&Ev(l,s.tolerance))return this.handleCancel();if(Ev(l,s.distance))return this.handleStart()}return Rv(s)&&Ev(l,s.tolerance)?this.handleCancel():void 0}e.cancelable&&e.preventDefault(),a(i)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===_v.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const Lv={move:{name:"pointermove"},end:{name:"pointerup"}};class zv extends Fv{constructor(e){const{event:t}=e,n=Wo(t.target);super(e,Lv,n)}}zv.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return!(!n.isPrimary||0!==n.button)&&(null==o||o({event:n}),!0)}}];const Bv={move:{name:"mousemove"},end:{name:"mouseup"}};var Uv,Vv;(Vv=Uv||(Uv={}))[Vv.RightClick=2]="RightClick";(class extends Fv{constructor(e){super(e,Bv,Wo(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button!==Uv.RightClick&&(null==o||o({event:n}),!0)}}];const Gv={move:{name:"touchmove"},end:{name:"touchend"}};var $v,Hv,Wv,qv;function Yv(e){let{acceleration:t,activator:n=$v.Pointer,canScroll:o,draggingRect:a,enabled:s,interval:i=5,order:l=Wv.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:h,threshold:m}=e;const f=function(e){let{delta:t,disabled:n}=e;const o=nr(t);return or((e=>{if(n||!o||!e)return Xv;const r={x:Math.sign(t.x-o.x),y:Math.sign(t.y-o.y)};return{x:{[fv.Backward]:e.x[fv.Backward]||-1===r.x,[fv.Forward]:e.x[fv.Forward]||1===r.x},y:{[fv.Backward]:e.y[fv.Backward]||-1===r.y,[fv.Forward]:e.y[fv.Forward]||1===r.y}}}),[n,t,o])}({delta:h,disabled:!s}),[p,g]=tr(),v=r.useRef({x:0,y:0}),x=r.useRef({x:0,y:0}),y=r.useMemo((()=>{switch(n){case $v.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case $v.DraggableRect:return a}}),[n,a,c]),b=r.useRef(null),w=r.useCallback((()=>{const e=b.current;if(!e)return;const t=v.current.x*x.current.x,n=v.current.y*x.current.y;e.scrollBy(t,n)}),[]),k=r.useMemo((()=>l===Wv.TreeOrder?[...d].reverse():d),[l,d]);r.useEffect((()=>{if(s&&d.length&&y){for(const e of k){if(!1===(null==o?void 0:o(e)))continue;const n=d.indexOf(e),r=u[n];if(!r)continue;const{direction:a,speed:s}=yv(e,r,y,t,m);for(const e of["x","y"])f[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0)return g(),b.current=e,p(w,i),v.current=s,void(x.current=a)}v.current={x:0,y:0},x.current={x:0,y:0},g()}else g()}),[t,w,o,g,s,i,JSON.stringify(y),JSON.stringify(f),p,d,k,u,JSON.stringify(m)])}(class extends Fv{constructor(e){super(e,Gv)}static setup(){return window.addEventListener(Gv.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Gv.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;const{touches:r}=n;return!(r.length>1)&&(null==o||o({event:n}),!0)}}],(Hv=$v||($v={}))[Hv.Pointer=0]="Pointer",Hv[Hv.DraggableRect=1]="DraggableRect",(qv=Wv||(Wv={}))[qv.TreeOrder=0]="TreeOrder",qv[qv.ReversedTreeOrder=1]="ReversedTreeOrder";const Xv={x:{[fv.Backward]:!1,[fv.Forward]:!1},y:{[fv.Backward]:!1,[fv.Forward]:!1}};var Kv,Jv,Zv;(Jv=Kv||(Kv={}))[Jv.Always=0]="Always",Jv[Jv.BeforeDragging=1]="BeforeDragging",Jv[Jv.WhileDragging=2]="WhileDragging",(Zv||(Zv={})).Optimized="optimized";const Qv=new Map;function ex(e,t){return or((n=>e?n||("function"==typeof t?t(e):e):null),[t,e])}function tx(e){let{callback:t,disabled:n}=e;const o=hr(t),a=r.useMemo((()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(o)}),[n]);return r.useEffect((()=>()=>null==a?void 0:a.disconnect()),[a]),a}function nx(e){return new Nv(sv(e),e)}function ox(e,t,n){void 0===t&&(t=nx);const[o,a]=r.useReducer((function(o){if(!e)return null;var r;if(!1===e.isConnected)return null!=(r=null!=o?o:n)?r:null;const a=t(e);if(JSON.stringify(o)===JSON.stringify(a))return o;return a}),null),s=function(e){let{callback:t,disabled:n}=e;const o=hr(t),a=r.useMemo((()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(o)}),[o,n]);return r.useEffect((()=>()=>null==a?void 0:a.disconnect()),[a]),a}({callback(t){if(e)for(const n of t){const{type:t,target:o}=n;if("childList"===t&&o instanceof HTMLElement&&o.contains(e)){a();break}}}}),i=tx({callback:a});return er((()=>{a(),e?(null==i||i.observe(e),null==s||s.observe(document.body,{childList:!0,subtree:!0})):(null==i||i.disconnect(),null==s||s.disconnect())}),[e]),o}const rx=[];function ax(e,t){void 0===t&&(t=[]);const n=r.useRef(null);return r.useEffect((()=>{n.current=null}),t),r.useEffect((()=>{const t=e!==Hg;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)}),[e]),n.current?Yo(e,n.current):Hg}function sx(e){return r.useMemo((()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null),[e])}const ix=[];function lx(e){let{measure:t}=e;const[n,o]=r.useState(null),a=tx({callback:r.useCallback((e=>{for(const{target:n}of e)if(ar(n)){o((e=>{const o=t(n);return e?{...e,width:o.width,height:o.height}:o}));break}}),[t])}),s=r.useCallback((e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ar(t)?t:e}(e);null==a||a.disconnect(),n&&(null==a||a.observe(n)),o(n?t(n):null)}),[t,a]),[i,l]=sr(s);return r.useMemo((()=>({nodeRef:i,rect:n,setRef:l})),[n,i,l])}const cx=[{sensor:zv,options:{}},{sensor:Dv,options:{}}],dx={current:{}},ux={draggable:{measure:iv},droppable:{measure:iv,strategy:Kv.WhileDragging,frequency:Zv.Optimized},dragOverlay:{measure:sv}};class hx extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter((e=>{let{disabled:t}=e;return!t}))}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const mx={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new hx,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Gg},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ux,measureDroppableContainers:Gg,windowRect:null,measuringScheduled:!1},fx={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Gg,draggableNodes:new Map,over:null,measureDroppableContainers:Gg},px=r.createContext(fx),gx=r.createContext(mx);function vx(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new hx}}}function xx(e,t){switch(t.type){case Ug.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ug.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case Ug.DragEnd:case Ug.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ug.RegisterDroppable:{const{element:n}=t,{id:o}=n,r=new hx(e.droppable.containers);return r.set(o,n),{...e,droppable:{...e.droppable,containers:r}}}case Ug.SetDroppableDisabled:{const{id:n,key:o,disabled:r}=t,a=e.droppable.containers.get(n);if(!a||o!==a.key)return e;const s=new hx(e.droppable.containers);return s.set(n,{...a,disabled:r}),{...e,droppable:{...e.droppable,containers:s}}}case Ug.UnregisterDroppable:{const{id:n,key:o}=t,r=e.droppable.containers.get(n);if(!r||o!==r.key)return e;const a=new hx(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function yx(e){let{disabled:t}=e;const{active:n,activatorEvent:o,draggableNodes:a}=r.useContext(px),s=nr(o),i=nr(null==n?void 0:n.id);return r.useEffect((()=>{if(!t&&!o&&s&&null!=i){if(!qo(s))return;if(document.activeElement===s.target)return;const e=a.get(i);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame((()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=ir(e);if(t){t.focus();break}}}))}}),[o,t,a,i,s]),null}const bx=r.createContext({...Hg,scaleX:1,scaleY:1});var wx,kx;(kx=wx||(wx={}))[kx.Uninitialized=0]="Uninitialized",kx[kx.Initializing=1]="Initializing",kx[kx.Initialized=2]="Initialized";const Nx=r.memo((function(e){var t,n,o,a;let{id:s,accessibility:i,autoScroll:l=!0,children:c,sensors:d=cx,collisionDetection:h=ev,measuring:m,modifiers:f,...p}=e;const g=r.useReducer(xx,void 0,vx),[v,x]=g,[y,b]=function(){const[e]=r.useState((()=>new Set)),t=r.useCallback((t=>(e.add(t),()=>e.delete(t))),[e]);return[r.useCallback((t=>{let{type:n,event:o}=t;e.forEach((e=>{var t;return null==(t=e[n])?void 0:t.call(e,o)}))}),[e]),t]}(),[w,k]=r.useState(wx.Uninitialized),N=w===wx.Initialized,{draggable:{active:C,nodes:E,translate:S},droppable:{containers:j}}=v,_=C?E.get(C):null,I=r.useRef({initial:null,translated:null}),A=r.useMemo((()=>{var e;return null!=C?{id:C,data:null!=(e=null==_?void 0:_.data)?e:dx,rect:I}:null}),[C,_]),M=r.useRef(null),[T,O]=r.useState(null),[D,P]=r.useState(null),R=Ko(p,Object.values(p)),F=Jo("DndDescribedBy",s),L=r.useMemo((()=>j.getEnabled()),[j]),z=(B=m,r.useMemo((()=>({draggable:{...ux.draggable,...null==B?void 0:B.draggable},droppable:{...ux.droppable,...null==B?void 0:B.droppable},dragOverlay:{...ux.dragOverlay,...null==B?void 0:B.dragOverlay}})),[null==B?void 0:B.draggable,null==B?void 0:B.droppable,null==B?void 0:B.dragOverlay]));var B;const{droppableRects:U,measureDroppableContainers:V,measuringScheduled:G}=function(e,t){let{dragging:n,dependencies:o,config:a}=t;const[s,i]=r.useState(null),{frequency:l,measure:c,strategy:d}=a,u=r.useRef(e),h=function(){switch(d){case Kv.Always:return!1;case Kv.BeforeDragging:return n;default:return!n}}(),m=Ko(h),f=r.useCallback((function(e){void 0===e&&(e=[]),m.current||i((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[m]),p=r.useRef(null),g=or((t=>{if(h&&!n)return Qv;if(!t||t===Qv||u.current!==e||null!=s){const t=new Map;for(let n of e){if(!n)continue;if(s&&s.length>0&&!s.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,o=e?new Nv(c(e),e):null;n.rect.current=o,o&&t.set(n.id,o)}return t}return t}),[e,s,n,h,c]);return r.useEffect((()=>{u.current=e}),[e]),r.useEffect((()=>{h||f()}),[n,h]),r.useEffect((()=>{s&&s.length>0&&i(null)}),[JSON.stringify(s)]),r.useEffect((()=>{h||"number"!=typeof l||null!==p.current||(p.current=setTimeout((()=>{f(),p.current=null}),l))}),[l,h,f,...o]),{droppableRects:g,measureDroppableContainers:f,measuringScheduled:null!=s}}(L,{dragging:N,dependencies:[S.x,S.y],config:z.droppable}),$=function(e,t){const n=null!==t?e.get(t):void 0,o=n?n.node.current:null;return or((e=>{var n;return null===t?null:null!=(n=null!=o?o:e)?n:null}),[o,t])}(E,C),H=r.useMemo((()=>D?Zo(D):null),[D]),W=function(){const e=!1===(null==T?void 0:T.autoScrollEnabled),t="object"==typeof l?!1===l.enabled:!1===l,n=N&&!e&&!t;if("object"==typeof l)return{...l,enabled:n};return{enabled:n}}(),q=function(e,t){return ex(e,t)}($,z.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:o,config:a=!0}=e;const s=r.useRef(!1),{x:i,y:l}="boolean"==typeof a?{x:a,y:a}:a;er((()=>{if(!i&&!l||!t)return void(s.current=!1);if(s.current||!o)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const r=nv(n(e),o);if(i||(r.x=0),l||(r.y=0),s.current=!0,Math.abs(r.x)>0||Math.abs(r.y)>0){const t=cv(e);t&&t.scrollBy({top:r.y,left:r.x})}}),[t,i,l,o,n])}({activeNode:C?E.get(C):null,config:W.layoutShiftCompensation,initialRect:q,measure:z.draggable.measure});const Y=ox($,z.draggable.measure,q),X=ox($?$.parentElement:null),K=r.useRef({activatorEvent:null,active:null,activeNode:$,collisionRect:null,collisions:null,droppableRects:U,draggableNodes:E,draggingNode:null,draggingNodeRect:null,droppableContainers:j,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),J=j.getNodeFor(null==(t=K.current.over)?void 0:t.id),Z=lx({measure:z.dragOverlay.measure}),Q=null!=(n=Z.nodeRef.current)?n:$,ee=N?null!=(o=Z.rect)?o:Y:null,te=Boolean(Z.nodeRef.current&&Z.rect),ne=nv(oe=te?null:Y,ex(oe));var oe;const re=sx(Q?Ho(Q):null),ae=function(e){const t=r.useRef(e),n=or((n=>e?n&&n!==rx&&e&&t.current&&e.parentNode===t.current.parentNode?n:lv(e):rx),[e]);return r.useEffect((()=>{t.current=e}),[e]),n}(N?null!=J?J:$:null),se=function(e,t){void 0===t&&(t=sv);const[n]=e,o=sx(n?Ho(n):null),[a,s]=r.useReducer((function(){return e.length?e.map((e=>gv(e)?o:new Nv(t(e),e))):ix}),ix),i=tx({callback:s});return e.length>0&&a===ix&&s(),er((()=>{e.length?e.forEach((e=>null==i?void 0:i.observe(e))):(null==i||i.disconnect(),s())}),[e]),a}(ae),ie=function(e,t){let{transform:n,...o}=t;return null!=e&&e.length?e.reduce(((e,t)=>t({transform:e,...o})),n):n}(f,{transform:{x:S.x-ne.x,y:S.y-ne.y,scaleX:1,scaleY:1},activatorEvent:D,active:A,activeNodeRect:Y,containerNodeRect:X,draggingNodeRect:ee,over:K.current.over,overlayNodeRect:Z.rect,scrollableAncestors:ae,scrollableAncestorRects:se,windowRect:re}),le=H?Xo(H,S):null,ce=function(e){const[t,n]=r.useState(null),o=r.useRef(e),a=r.useCallback((e=>{const t=dv(e.target);t&&n((e=>e?(e.set(t,mv(t)),new Map(e)):null))}),[]);return r.useEffect((()=>{const t=o.current;if(e!==t){r(t);const s=e.map((e=>{const t=dv(e);return t?(t.addEventListener("scroll",a,{passive:!0}),[t,mv(t)]):null})).filter((e=>null!=e));n(s.length?new Map(s):null),o.current=e}return()=>{r(e),r(t)};function r(e){e.forEach((e=>{const t=dv(e);null==t||t.removeEventListener("scroll",a)}))}}),[a,e]),r.useMemo((()=>e.length?t?Array.from(t.values()).reduce(((e,t)=>Xo(e,t)),Hg):wv(e):Hg),[e,t])}(ae),de=ax(ce),ue=ax(ce,[Y]),he=Xo(ie,de),me=ee?rv(ee,ie):null,fe=A&&me?h({active:A,collisionRect:me,droppableRects:U,droppableContainers:L,pointerCoordinates:le}):null,pe=Kg(fe,"id"),[ge,ve]=r.useState(null),xe=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(te?ie:Xo(ie,ue),null!=(a=null==ge?void 0:ge.rect)?a:null,Y),ye=r.useCallback(((e,t)=>{let{sensor:n,options:o}=t;if(null==M.current)return;const r=E.get(M.current);if(!r)return;const a=e.nativeEvent,s=new n({active:M.current,activeNode:r,event:a,options:o,context:K,onStart(e){const t=M.current;if(null==t)return;const n=E.get(t);if(!n)return;const{onDragStart:o}=R.current,r={active:{id:t,data:n.data,rect:I}};Qo.unstable_batchedUpdates((()=>{null==o||o(r),k(wx.Initializing),x({type:Ug.DragStart,initialCoordinates:e,active:t}),y({type:"onDragStart",event:r})}))},onMove(e){x({type:Ug.DragMove,coordinates:e})},onEnd:i(Ug.DragEnd),onCancel:i(Ug.DragCancel)});function i(e){return async function(){const{active:t,collisions:n,over:o,scrollAdjustedTranslate:r}=K.current;let s=null;if(t&&r){const{cancelDrop:i}=R.current;if(s={activatorEvent:a,active:t,collisions:n,delta:r,over:o},e===Ug.DragEnd&&"function"==typeof i){await Promise.resolve(i(s))&&(e=Ug.DragCancel)}}M.current=null,Qo.unstable_batchedUpdates((()=>{x({type:e}),k(wx.Uninitialized),ve(null),O(null),P(null);const t=e===Ug.DragEnd?"onDragEnd":"onDragCancel";if(s){const e=R.current[t];null==e||e(s),y({type:t,event:s})}}))}}Qo.unstable_batchedUpdates((()=>{O(s),P(e.nativeEvent)}))}),[E]),be=function(e,t){return r.useMemo((()=>e.reduce(((e,n)=>{const{sensor:o}=n;return[...e,...o.activators.map((e=>({eventName:e.eventName,handler:t(e.handler,n)})))]}),[])),[e,t])}(d,r.useCallback(((e,t)=>(n,o)=>{const r=n.nativeEvent,a=E.get(o);if(null!==M.current||!a||r.dndKit||r.defaultPrevented)return;const s={active:a};!0===e(n,t.options,s)&&(r.dndKit={capturedBy:t.sensor},M.current=o,ye(n,t))}),[E,ye]));!function(e){r.useEffect((()=>{if(!rr)return;const t=e.map((e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()}));return()=>{for(const e of t)null==e||e()}}),e.map((e=>{let{sensor:t}=e;return t})))}(d),er((()=>{Y&&w===wx.Initializing&&k(wx.Initialized)}),[Y,w]),r.useEffect((()=>{const{onDragMove:e}=R.current,{active:t,activatorEvent:n,collisions:o,over:r}=K.current;if(!t||!n)return;const a={active:t,activatorEvent:n,collisions:o,delta:{x:he.x,y:he.y},over:r};Qo.unstable_batchedUpdates((()=>{null==e||e(a),y({type:"onDragMove",event:a})}))}),[he.x,he.y]),r.useEffect((()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:o,scrollAdjustedTranslate:r}=K.current;if(!e||null==M.current||!t||!r)return;const{onDragOver:a}=R.current,s=o.get(pe),i=s&&s.rect.current?{id:s.id,rect:s.rect.current,data:s.data,disabled:s.disabled}:null,l={active:e,activatorEvent:t,collisions:n,delta:{x:r.x,y:r.y},over:i};Qo.unstable_batchedUpdates((()=>{ve(i),null==a||a(l),y({type:"onDragOver",event:l})}))}),[pe]),er((()=>{K.current={activatorEvent:D,active:A,activeNode:$,collisionRect:me,collisions:fe,droppableRects:U,draggableNodes:E,draggingNode:Q,draggingNodeRect:ee,droppableContainers:j,over:ge,scrollableAncestors:ae,scrollAdjustedTranslate:he},I.current={initial:ee,translated:me}}),[A,$,fe,me,E,Q,ee,U,j,ge,ae,he]),Yv({...W,delta:S,draggingRect:me,pointerCoordinates:le,scrollableAncestors:ae,scrollableAncestorRects:se});const we=r.useMemo((()=>({active:A,activeNode:$,activeNodeRect:Y,activatorEvent:D,collisions:fe,containerNodeRect:X,dragOverlay:Z,draggableNodes:E,droppableContainers:j,droppableRects:U,over:ge,measureDroppableContainers:V,scrollableAncestors:ae,scrollableAncestorRects:se,measuringConfiguration:z,measuringScheduled:G,windowRect:re})),[A,$,Y,D,fe,X,Z,E,j,U,ge,V,ae,se,z,G,re]),ke=r.useMemo((()=>({activatorEvent:D,activators:be,active:A,activeNodeRect:Y,ariaDescribedById:{draggable:F},dispatch:x,draggableNodes:E,over:ge,measureDroppableContainers:V})),[D,be,A,Y,x,F,E,ge,V]);return u.createElement(Fg.Provider,{value:b},u.createElement(px.Provider,{value:ke},u.createElement(gx.Provider,{value:we},u.createElement(bx.Provider,{value:xe},c)),u.createElement(yx,{disabled:!1===(null==i?void 0:i.restoreFocus)})),u.createElement(Bg,{...i,hiddenTextDescribedById:F}))})),Cx=r.createContext(null),Ex="button";function Sx(e){let{id:t,data:n,disabled:o=!1,attributes:a}=e;const s=Jo("Droppable"),{activators:i,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:h,over:m}=r.useContext(px),{role:f=Ex,roleDescription:p="draggable",tabIndex:g=0}=null!=a?a:{},v=(null==c?void 0:c.id)===t,x=r.useContext(v?bx:Cx),[y,b]=sr(),[w,k]=sr(),N=function(e,t){return r.useMemo((()=>e.reduce(((e,n)=>{let{eventName:o,handler:r}=n;return e[o]=e=>{r(e,t)},e}),{})),[e,t])}(i,t),C=Ko(n);er((()=>(h.set(t,{id:t,key:s,node:y,activatorNode:w,data:C}),()=>{const e=h.get(t);e&&e.key===s&&h.delete(t)})),[h,t]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:r.useMemo((()=>({role:f,tabIndex:g,"aria-disabled":o,"aria-pressed":!(!v||f!==Ex)||void 0,"aria-roledescription":p,"aria-describedby":u.draggable})),[o,f,g,v,p,u.draggable]),isDragging:v,listeners:o?void 0:N,node:y,over:m,setNodeRef:b,setActivatorNodeRef:k,transform:x}}const jx={timeout:25};function _x(e,t,n){const o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function Ix(e,t){return e.reduce(((e,n,o)=>{const r=t.get(n);return r&&(e[o]=r),e}),Array(e.length))}function Ax(e){return null!==e&&e>=0}const Mx={scaleX:1,scaleY:1},Tx=e=>{var t;let{rects:n,activeNodeRect:o,activeIndex:r,overIndex:a,index:s}=e;const i=null!=(t=n[r])?t:o;if(!i)return null;const l=function(e,t,n){const o=e[t],r=e[t-1],a=e[t+1];if(!o||!r&&!a)return 0;if(n<t)return r?o.left-(r.left+r.width):a.left-(o.left+o.width);return a?a.left-(o.left+o.width):o.left-(r.left+r.width)}(n,s,r);if(s===r){const e=n[a];return e?{x:r<a?e.left+e.width-(i.left+i.width):e.left-i.left,y:0,...Mx}:null}return s>r&&s<=a?{x:-i.width-l,y:0,...Mx}:s<r&&s>=a?{x:i.width+l,y:0,...Mx}:{x:0,y:0,...Mx}};const Ox=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e;const a=_x(t,o,n),s=t[r],i=a[r];return i&&s?{x:i.left-s.left,y:i.top-s.top,scaleX:i.width/s.width,scaleY:i.height/s.height}:null},Dx={scaleX:1,scaleY:1},Px=e=>{var t;let{activeIndex:n,activeNodeRect:o,index:r,rects:a,overIndex:s}=e;const i=null!=(t=a[n])?t:o;if(!i)return null;if(r===n){const e=a[s];return e?{x:0,y:n<s?e.top+e.height-(i.top+i.height):e.top-i.top,...Dx}:null}const l=function(e,t,n){const o=e[t],r=e[t-1],a=e[t+1];if(!o)return 0;if(n<t)return r?o.top-(r.top+r.height):a?a.top-(o.top+o.height):0;return a?a.top-(o.top+o.height):r?o.top-(r.top+r.height):0}(a,r,n);return r>n&&r<=s?{x:0,y:-i.height-l,...Dx}:r<n&&r>=s?{x:0,y:i.height+l,...Dx}:{x:0,y:0,...Dx}};const Rx="Sortable",Fx=u.createContext({activeIndex:-1,containerId:Rx,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Ox,disabled:{draggable:!1,droppable:!1}});function Lx(e){let{children:t,id:n,items:o,strategy:a=Ox,disabled:s=!1}=e;const{active:i,dragOverlay:l,droppableRects:c,over:d,measureDroppableContainers:h}=r.useContext(gx),m=Jo(Rx,n),f=Boolean(null!==l.rect),p=r.useMemo((()=>o.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[o]),g=null!=i,v=i?p.indexOf(i.id):-1,x=d?p.indexOf(d.id):-1,y=r.useRef(p),b=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(p,y.current),w=-1!==x&&-1===v||b,k=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(s);er((()=>{b&&g&&h(p)}),[b,p,g,h]),r.useEffect((()=>{y.current=p}),[p]);const N=r.useMemo((()=>({activeIndex:v,containerId:m,disabled:k,disableTransforms:w,items:p,overIndex:x,useDragOverlay:f,sortedRects:Ix(p,c),strategy:a})),[v,m,k.draggable,k.droppable,w,p,x,c,f,a]);return u.createElement(Fx.Provider,{value:N},t)}const zx=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return _x(n,o,r).indexOf(t)},Bx=e=>{let{containerId:t,isSorting:n,wasDragging:o,index:r,items:a,newIndex:s,previousItems:i,previousContainerId:l,transition:c}=e;return!(!c||!o)&&((i===a||r!==s)&&(!!n||s!==r&&t===l))},Ux={duration:200,easing:"ease"},Vx="transform",Gx=fr.Transition.toString({property:Vx,duration:0,easing:"linear"}),$x={roleDescription:"sortable"};function Hx(e){let{animateLayoutChanges:t=Bx,attributes:n,disabled:o,data:a,getNewIndex:s=zx,id:i,strategy:l,resizeObserverConfig:c,transition:d=Ux}=e;const{items:u,containerId:h,activeIndex:m,disabled:f,disableTransforms:p,sortedRects:g,overIndex:v,useDragOverlay:x,strategy:y}=r.useContext(Fx),b=function(e,t){var n,o;if("boolean"==typeof e)return{draggable:e,droppable:!1};return{draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,droppable:null!=(o=null==e?void 0:e.droppable)?o:t.droppable}}(o,f),w=u.indexOf(i),k=r.useMemo((()=>({sortable:{containerId:h,index:w,items:u},...a})),[h,a,w,u]),N=r.useMemo((()=>u.slice(u.indexOf(i))),[u,i]),{rect:C,node:E,isOver:S,setNodeRef:j}=function(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:a}=e;const s=Jo("Droppable"),{active:i,dispatch:l,over:c,measureDroppableContainers:d}=r.useContext(px),u=r.useRef({disabled:n}),h=r.useRef(!1),m=r.useRef(null),f=r.useRef(null),{disabled:p,updateMeasurementsFor:g,timeout:v}={...jx,...a},x=Ko(null!=g?g:o),y=tx({callback:r.useCallback((()=>{h.current?(null!=f.current&&clearTimeout(f.current),f.current=setTimeout((()=>{d(Array.isArray(x.current)?x.current:[x.current]),f.current=null}),v)):h.current=!0}),[v]),disabled:p||!i}),b=r.useCallback(((e,t)=>{y&&(t&&(y.unobserve(t),h.current=!1),e&&y.observe(e))}),[y]),[w,k]=sr(b),N=Ko(t);return r.useEffect((()=>{y&&w.current&&(y.disconnect(),h.current=!1,y.observe(w.current))}),[w,y]),er((()=>(l({type:Ug.RegisterDroppable,element:{id:o,key:s,disabled:n,node:w,rect:m,data:N}}),()=>l({type:Ug.UnregisterDroppable,key:s,id:o}))),[o]),r.useEffect((()=>{n!==u.current.disabled&&(l({type:Ug.SetDroppableDisabled,id:o,key:s,disabled:n}),u.current.disabled=n)}),[o,s,n,l]),{active:i,rect:m,isOver:(null==c?void 0:c.id)===o,node:w,over:c,setNodeRef:k}}({id:i,data:k,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...c}}),{active:_,activatorEvent:I,activeNodeRect:A,attributes:M,setNodeRef:T,listeners:O,isDragging:D,over:P,setActivatorNodeRef:R,transform:F}=Sx({id:i,data:k,attributes:{...$x,...n},disabled:b.draggable}),L=mr(j,T),z=Boolean(_),B=z&&!p&&Ax(m)&&Ax(v),U=!x&&D,V=U&&B?F:null,G=B?null!=V?V:(null!=l?l:y)({rects:g,activeNodeRect:A,activeIndex:m,overIndex:v,index:w}):null,$=Ax(m)&&Ax(v)?s({id:i,items:u,activeIndex:m,overIndex:v}):w,H=null==_?void 0:_.id,W=r.useRef({activeId:H,items:u,newIndex:$,containerId:h}),q=u!==W.current.items,Y=t({active:_,containerId:h,isDragging:D,isSorting:z,id:i,index:w,items:u,newIndex:W.current.newIndex,previousItems:W.current.items,previousContainerId:W.current.containerId,transition:d,wasDragging:null!=W.current.activeId}),X=function(e){let{disabled:t,index:n,node:o,rect:a}=e;const[s,i]=r.useState(null),l=r.useRef(n);return er((()=>{if(!t&&n!==l.current&&o.current){const e=a.current;if(e){const t=sv(o.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&i(n)}}n!==l.current&&(l.current=n)}),[t,n,o,a]),r.useEffect((()=>{s&&i(null)}),[s]),s}({disabled:!Y,index:w,node:E,rect:C});return r.useEffect((()=>{z&&W.current.newIndex!==$&&(W.current.newIndex=$),h!==W.current.containerId&&(W.current.containerId=h),u!==W.current.items&&(W.current.items=u)}),[z,$,h,u]),r.useEffect((()=>{if(H===W.current.activeId)return;if(H&&!W.current.activeId)return void(W.current.activeId=H);const e=setTimeout((()=>{W.current.activeId=H}),50);return()=>clearTimeout(e)}),[H]),{active:_,activeIndex:m,attributes:M,data:k,rect:C,index:w,newIndex:$,items:u,isOver:S,isSorting:z,isDragging:D,listeners:O,node:E,overIndex:v,over:P,setNodeRef:L,setActivatorNodeRef:R,setDroppableNodeRef:j,setDraggableNodeRef:T,transform:null!=X?X:G,transition:function(){if(X||q&&W.current.newIndex===w)return Gx;if(U&&!qo(I)||!d)return;if(z||Y)return fr.Transition.toString({...d,property:Vx});return}()}}function Wx(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const qx=[_v.Down,_v.Right,_v.Up,_v.Left],Yx=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:a,over:s,scrollableAncestors:i}}=t;if(qx.includes(e.code)){if(e.preventDefault(),!n||!o)return;const t=[];a.getEnabled().forEach((n=>{if(!n||null!=n&&n.disabled)return;const a=r.get(n.id);if(a)switch(e.code){case _v.Down:o.top<a.top&&t.push(n);break;case _v.Up:o.top>a.top&&t.push(n);break;case _v.Left:o.left>a.left&&t.push(n);break;case _v.Right:o.left<a.left&&t.push(n)}}));const l=(e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e;const r=Xg(t),a=[];for(const s of o){const{id:e}=s,t=n.get(e);if(t){const n=Xg(t),o=r.reduce(((e,t,o)=>e+Wg(n[o],t)),0),i=Number((o/4).toFixed(4));a.push({id:e,data:{droppableContainer:s,value:i}})}}return a.sort(qg)})({active:n,collisionRect:o,droppableRects:r,droppableContainers:t,pointerCoordinates:null});let c=Kg(l,"id");if(c===(null==s?void 0:s.id)&&l.length>1&&(c=l[1].id),null!=c){const e=a.get(n.id),t=a.get(c),s=t?r.get(t.id):null,l=null==t?void 0:t.node.current;if(l&&s&&e&&t){const n=lv(l).some(((e,t)=>i[t]!==e)),r=Xx(e,t),a=function(e,t){if(!Wx(e)||!Wx(t))return!1;if(!Xx(e,t))return!1;return e.data.current.sortable.index<t.data.current.sortable.index}(e,t),c=n||!r?{x:0,y:0}:{x:a?o.width-s.width:0,y:a?o.height-s.height:0},d={x:s.left,y:s.top};return c.x&&c.y?d:Yo(d,c)}}}};function Xx(e,t){return!(!Wx(e)||!Wx(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}const Kx=u.createContext(null),Jx=r.memo((()=>r.useContext(Kx)));Jx.displayName="DragHandle";const Zx=u.forwardRef((({cellId:e,canMoveX:t,...n},o)=>{const{attributes:r,listeners:a,setNodeRef:s,transform:i,transition:l,isDragging:c}=Hx({id:e.toString()}),d={transform:i?fr.Transform.toString({x:t?i.x:0,y:i.y,scaleX:1,scaleY:1}):void 0,transition:l,zIndex:c?2:void 0,position:"relative"},u=Og(o,s),h=k.jsx("div",{...r,...a,onMouseDown:tt.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:k.jsx(ac,{strokeWidth:1,size:20})}),m=Boolean(i);return k.jsx("div",{tabIndex:-1,ref:u,...n,"data-is-dragging":c,className:on(n.className,m&&"is-moving","outline-offset-4 outline-primary/40 rounded-lg"),style:d,children:k.jsx(Kx.Provider,{value:h,children:n.children})})}));Zx.displayName="SortableCell";const Qx=r.memo(Zx),ey=u.memo(u.forwardRef(((e,t)=>{const n=b(34);let o,a,s;n[0]!==e?(({children:s,showTooltip:o,...a}=e),n[0]=e,n[1]=o,n[2]=a,n[3]=s):(o=n[1],a=n[2],s=n[3]);const i=void 0===o||o,[l,c]=r.useState(!1);let d;n[4]!==a?(d={cell:a},n[4]=a,n[5]=d):d=n[5];const u=kd(d),h=pr();let m,f,p,g,v,x;if(n[6]===Symbol.for("react.memo_cache_sentinel")?(m=()=>({toggle:()=>c((e=>!e))}),n[6]=m):m=n[6],r.useImperativeHandle(t,m),n[7]===Symbol.for("react.memo_cache_sentinel")?(f=k.jsx(Ye,{placeholder:"Search actions...",className:"h-6 m-1"}),n[7]=f):f=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(p=k.jsx(Ke,{children:"No results"}),n[8]=p):p=n[8],n[9]!==u){let e;n[11]!==u.length?(e=(e,t)=>k.jsxs(r.Fragment,{children:[k.jsx(Be,{children:e.map((e=>k.jsx($e,{onSelect:()=>{e.disableClick||(e.handle(),c(!1))},variant:e.variant,children:k.jsxs("div",{className:"flex items-center flex-1",children:[e.icon&&k.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:e.icon}),k.jsx("div",{className:"flex-1",children:e.label}),k.jsxs("div",{className:"flex-shrink-0 text-sm",children:[e.hotkey&&gr(e.hotkey),e.rightElement]})]})},e.label)))},t),t<u.length-1&&k.jsx(Ve,{})]},t),n[11]=u.length,n[12]=e):e=n[12],g=u.map(e),n[9]=u,n[10]=g}else g=n[10];n[13]!==g?(v=k.jsxs(mn,{children:[f,k.jsxs(vr,{children:[p,g]})]}),n[13]=g,n[14]=v):v=n[14],n[15]!==h||n[16]!==v?(x=k.jsx(un,{className:"w-[300px] p-0 pt-1",...h,children:v}),n[15]=h,n[16]=v,n[17]=x):x=n[17];const y=x;if(!i){let e,t;return n[18]!==s?(e=k.jsx(xr,{asChild:!0,children:s}),n[18]=s,n[19]=e):e=n[19],n[20]!==l||n[21]!==e||n[22]!==y?(t=k.jsxs(hn,{open:l,onOpenChange:c,children:[e,y]}),n[20]=l,n[21]=e,n[22]=y,n[23]=t):t=n[23],t}let w;n[24]===Symbol.for("react.memo_cache_sentinel")?(w=k.jsx(yr,{tabIndex:-1,children:N("cell.cellActions")}),n[24]=w):w=n[24];const C=!l&&w;let E,S,j;return n[25]!==s?(E=k.jsx(br,{children:k.jsx(xr,{className:"flex",children:s})}),n[25]=s,n[26]=E):E=n[26],n[27]!==C||n[28]!==E?(S=k.jsxs(wr,{delayDuration:200,disableHoverableContent:!0,children:[C,E]}),n[27]=C,n[28]=E,n[29]=S):S=n[29],n[30]!==l||n[31]!==S||n[32]!==y?(j=k.jsxs(hn,{open:l,onOpenChange:c,children:[S,y]}),n[30]=l,n[31]=S,n[32]=y,n[33]=j):j=n[33],j}))),ty=u.memo((e=>{const t=b(5),{children:n,cellId:o}=e;let r,a;t[0]!==o?(a=function(e){return Z((t=>Ad(e,t(se))))}(o),t[0]=o,t[1]=a):a=t[1],r=a;const s=le(r);if(!s)return null;let i;return t[2]!==s||t[3]!==n?(i=k.jsx(ey,{showTooltip:!1,...s,children:n}),t[2]=s,t[3]=n,t[4]=i):i=t[4],i}));ty.displayName="ConnectionCellActionsDropdown";const ny=e=>{const t=b(29);let n,o,r;t[0]!==e?(({children:o,...n}=e),t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),t[3]!==n?(r={cell:n},t[3]=n,t[4]=r):r=t[4];const a=kd(r),[s,i]=u.useState();let l,c,d,h,m,f,p,g,v;if(t[5]===Symbol.for("react.memo_cache_sentinel")?(l=k.jsx(nt,{size:13,strokeWidth:1.5}),t[5]=l):l=t[5],t[6]!==n.cellId?(c=()=>{var e;if(null==(e=window.getSelection())?void 0:e.toString())return void document.execCommand("copy");const t=document.getElementById(G.create(n.cellId));t?navigator.clipboard.writeText(t.textContent??""):J.warn("cell-context-menu: output not found")},t[6]=n.cellId,t[7]=c):c=t[7],t[8]!==c||t[9]!==n||t[10]!==s||t[11]!==o||t[12]!==a){const e=[{label:"Copy",icon:l,handle:c},{label:"Cut",icon:k.jsx(Ac,{size:13,strokeWidth:1.5}),handle:oy},{label:"Paste",icon:k.jsx(ql,{size:13,strokeWidth:1.5}),handle:async()=>{const{getEditorView:e}=n,t=e();if(!t)return;const o=await navigator.clipboard.readText();if(o){const{from:e,to:n}=t.state.selection.main,r=t.state.update({changes:{from:e,to:n,insert:o}});t.dispatch(r)}}},{icon:k.jsx(Zi,{size:13,strokeWidth:1.5}),label:"Download image",hidden:!s,handle:()=>{if(s){const e=document.createElement("a");e.download="image.png",e.href=s.src,e.click()}}},{label:"Go to Definition",icon:k.jsx(kr,{size:13,strokeWidth:1.5}),handle:()=>{const{getEditorView:e}=n,t=e();t&&Nr(t)}}];let r;f=hg,t[18]===Symbol.for("react.memo_cache_sentinel")?(r=e=>{e.target instanceof HTMLImageElement?i(e.target):i(void 0)},t[18]=r):r=t[18],t[19]!==o?(p=k.jsx(mg,{onContextMenu:r,asChild:!0,children:o}),t[19]=o,t[20]=p):p=t[20],d=gg,h="w-[300px]",m=[e,...a].map(ay),t[8]=c,t[9]=n,t[10]=s,t[11]=o,t[12]=a,t[13]=d,t[14]=h,t[15]=m,t[16]=f,t[17]=p}else d=t[13],h=t[14],m=t[15],f=t[16],p=t[17];return t[21]!==d||t[22]!==h||t[23]!==m?(g=k.jsx(d,{className:h,children:m}),t[21]=d,t[22]=h,t[23]=m,t[24]=g):g=t[24],t[25]!==f||t[26]!==p||t[27]!==g?(v=k.jsxs(f,{children:[p,g]}),t[25]=f,t[26]=p,t[27]=g,t[28]=v):v=t[28],v};function oy(){document.execCommand("cut")}function ry(e){return e.hidden?null:k.jsx(vg,{onSelect:t=>{e.handle(t)},variant:e.variant,children:k.jsxs("div",{className:"flex items-center flex-1",children:[e.icon&&k.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:e.icon}),k.jsx("div",{className:"flex-1",children:e.label}),k.jsxs("div",{className:"flex-shrink-0 text-sm",children:[e.hotkey&&gr(e.hotkey),e.rightElement]})]})},e.label)}function ay(e,t){return k.jsxs(r.Fragment,{children:[e.map(ry),t<e.length-1&&k.jsx(xg,{})]},t)}const sy=e=>{const t=b(24),{editorView:n,code:o,currentLanguageAdapter:r,onAfterToggle:a}=e;let s,i;t[0]!==o?(i=(new Bo).isSupported(o)||""===o.trim(),t[0]=o,t[1]=i):i=t[1],s=i;const l=s;let c,d;t[2]!==o?(d=(new Uo).isSupported(o)||""===o.trim(),t[2]=o,t[3]=d):d=t[3],c=d;const u=c&&"python"===r;let h,m;t[4]===Symbol.for("react.memo_cache_sentinel")?(h=k.jsx(ke,{color:"var(--sky-11)",strokeWidth:2.5,className:"w-4 h-4"}),t[4]=h):h=t[4],t[5]!==n||t[6]!==r||t[7]!==u||t[8]!==a?(m=k.jsx(iy,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:u,icon:h,toType:"sql",displayName:"SQL",onAfterToggle:a}),t[5]=n,t[6]=r,t[7]=u,t[8]=a,t[9]=m):m=t[9];const f=l&&"python"===r;let p,g,v,x,y;return t[10]===Symbol.for("react.memo_cache_sentinel")?(p=k.jsx(Ni,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),t[10]=p):p=t[10],t[11]!==n||t[12]!==r||t[13]!==f||t[14]!==a?(g=k.jsx(iy,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:f,icon:p,toType:"markdown",displayName:"Markdown",onAfterToggle:a}),t[11]=n,t[12]=r,t[13]=f,t[14]=a,t[15]=g):g=t[15],t[16]===Symbol.for("react.memo_cache_sentinel")?(v=k.jsx(Ci,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),t[16]=v):v=t[16],t[17]!==n||t[18]!==r?(x=k.jsx(iy,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:!0,icon:v,toType:"python",displayName:"Python",onAfterToggle:rn.NOOP}),t[17]=n,t[18]=r,t[19]=x):x=t[19],t[20]!==m||t[21]!==g||t[22]!==x?(y=k.jsxs("div",{className:"absolute right-3 top-2 z-20 flex hover-action gap-1",children:[m,g,x]}),t[20]=m,t[21]=g,t[22]=x,t[23]=y):y=t[23],y},iy=e=>{const t=b(10),{editorView:n,currentLanguageAdapter:o,canSwitchToLanguage:r,icon:a,toType:s,displayName:i,onAfterToggle:l}=e;if(!r)return null;if(o===s)return null;const c=`View as ${i}`;let d,u,h;return t[0]!==n||t[1]!==s||t[2]!==l?(d=()=>{n&&(we(n,s),l())},t[0]=n,t[1]=s,t[2]=l,t[3]=d):d=t[3],t[4]!==d||t[5]!==a?(u=k.jsx(E,{"data-testid":"language-toggle-button",variant:"text",size:"xs",className:"opacity-80 px-1",onClick:d,children:a}),t[4]=d,t[5]=a,t[6]=u):u=t[6],t[7]!==c||t[8]!==u?(h=k.jsx(C,{content:c,children:u}),t[7]=c,t[8]=u,t[9]=h):h=t[9],h};var ly={modified:{doc:""},original:{doc:""}},cy=r.createContext(ly);function dy(e,t){return mo({},e,t,{modified:mo({},e.modified,t.modified),original:mo({},e.original,t.original)})}var uy=()=>r.useContext(cy),hy=e=>{var{children:t,theme:n}=e,[o,a]=r.useReducer(dy,mo({},ly,{theme:n}));return r.useEffect((()=>a({theme:n})),[n]),k.jsx(cy.Provider,{value:mo({},o,{dispatch:a}),children:t})},my=["extensions","value","selection","onChange"],fy=e=>{var{extensions:t=[],value:n,selection:o,onChange:a}=e,s=Cr(e,my),{theme:i,dispatch:l}=uy(),c=Er(mo({},s,{theme:i}));return r.useEffect((()=>l({original:{doc:n,selection:o,extensions:[...c,...t]},originalExtension:{onChange:a,option:s,extension:[t]}})),[e]),null};fy.displayName="CodeMirrorMerge.Original";var py=["extensions","value","selection","onChange"],gy=e=>{var{extensions:t=[],value:n,selection:o,onChange:a}=e,s=Cr(e,py),{theme:i,dispatch:l}=uy(),c=Er(mo({},s,{theme:i}));return r.useEffect((()=>{l({modified:{doc:n,selection:o,extensions:[...c,...t]},modifiedExtension:{onChange:a,option:s,extension:[t]}})}),[e]),null};gy.displayName="CodeMirrorMerge.Modified";class vy{constructor(e,t,n,o){this.fromA=e,this.toA=t,this.fromB=n,this.toB=o}offset(e,t){return new vy(this.fromA+e,this.toA+e,this.fromB+t,this.toB+t)}}function xy(e,t,n,o,r,a){if(e==o)return[];let s=Ey(e,t,n,o,r,a),i=Sy(e,t+s,n,o,r+s,a),l=(n-=i)-(t+=s),c=(a-=i)-(r+=s);if(!l||!c)return[new vy(t,n,r,a)];if(l>c){let s=e.slice(t,n).indexOf(o.slice(r,a));if(s>-1)return[new vy(t,t+s,r,r),new vy(t+s+c,n,a,a)]}else if(c>l){let s=o.slice(r,a).indexOf(e.slice(t,n));if(s>-1)return[new vy(t,t,r,r+s),new vy(n,n,r+s+l,a)]}if(1==l||1==c)return[new vy(t,n,r,a)];let d=_y(e,t,n,o,r,a);if(d){let[s,i,l]=d;return xy(e,t,s,o,r,i).concat(xy(e,s+l,n,o,i+l,a))}return function(e,t,n,o,r,a){let s=n-t,i=a-r;if(yy<1e9&&Math.min(s,i)>16*yy)return Math.min(s,i)>64*yy?[new vy(t,n,r,a)]:Iy(e,t,n,o,r,a);let l=Math.ceil((s+i)/2);wy.reset(l),ky.reset(l);let c=(n,a)=>e.charCodeAt(t+n)==o.charCodeAt(r+a),d=(t,r)=>e.charCodeAt(n-t-1)==o.charCodeAt(a-r-1),u=(s-i)%2!=0?ky:null,h=u?null:wy;for(let m=0;m<l;m++){if(m>yy)return Iy(e,t,n,o,r,a);let f=wy.advance(m,s,i,l,u,!1,c)||ky.advance(m,s,i,l,h,!0,d);if(f)return Ny(e,t,n,t+f[0],o,r,a,r+f[1])}return[new vy(t,n,r,a)]}(e,t,n,o,r,a)}let yy=1e9;class by{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let t=0;t<this.len;t++)this.vec[t]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,o,r,a,s){for(let i=-e+this.start;i<=e-this.end;i+=2){let l=o+i,c=i==-e||i!=e&&this.vec[l-1]<this.vec[l+1]?this.vec[l+1]:this.vec[l-1]+1,d=c-i;for(;c<t&&d<n&&s(c,d);)c++,d++;if(this.vec[l]=c,c>t)this.end+=2;else if(d>n)this.start+=2;else if(r){let e=o+(t-n)-i;if(e>=0&&e<this.len&&-1!=r.vec[e])if(a){let n=r.vec[e];if(n>=t-c)return[n,o+n-e]}else{if(c>=t-r.vec[e])return[c,d]}}}return null}}const wy=new by,ky=new by;function Ny(e,t,n,o,r,a,s,i){let l=!1;return By(e,o)||++o!=n||(l=!0),By(r,i)||++i!=s||(l=!0),l?[new vy(t,n,a,s)]:xy(e,t,o,r,a,i).concat(xy(e,o,n,r,i,s))}function Cy(e,t){let n=1,o=Math.min(e,t);for(;n<o;)n<<=1;return n}function Ey(e,t,n,o,r,a){if(t==n||t==a||e.charCodeAt(t)!=o.charCodeAt(r))return 0;let s=Cy(n-t,a-r);for(let i=t,l=r;;){let r=i+s,c=l+s;if(r>n||c>a||e.slice(i,r)!=o.slice(l,c)){if(1==s)return i-t-(By(e,i)?0:1);s>>=1}else{if(r==n||c==a)return r-t;i=r,l=c}}}function Sy(e,t,n,o,r,a){if(t==n||r==a||e.charCodeAt(n-1)!=o.charCodeAt(a-1))return 0;let s=Cy(n-t,a-r);for(let i=n,l=a;;){let a=i-s,c=l-s;if(a<t||c<r||e.slice(a,i)!=o.slice(c,l)){if(1==s)return n-i-(By(e,i)?0:1);s>>=1}else{if(a==t||c==r)return n-a;i=a,l=c}}}function jy(e,t,n,o,r,a,s,i){let l=o.slice(r,a),c=null;for(;;){if(c||s<i)return c;for(let i=t+s;;){By(e,i)||i++;let d=i+s;if(By(e,d)||(d+=d==i+1?1:-1),d>=n)break;let u=e.slice(i,d),h=-1;for(;-1!=(h=l.indexOf(u,h+1));){let s=Ey(e,d,n,o,r+h+u.length,a),l=Sy(e,t,i,o,r,r+h),m=u.length+s+l;(!c||c[2]<m)&&(c=[i-l,r+h-l,m])}i=d}if(i<0)return c;s>>=1}}function _y(e,t,n,o,r,a){let s=n-t,i=a-r;if(s<i){let s=_y(o,r,a,e,t,n);return s&&[s[1],s[0],s[2]]}return s<4||2*i<s?null:jy(e,t,n,o,r,a,Math.floor(s/4),-1)}function Iy(e,t,n,o,r,a){let s,i=n-t,l=a-r;if(i<l){let l=jy(o,r,a,e,t,n,Math.floor(i/6),50);s=l&&[l[1],l[0],l[2]]}else s=jy(e,t,n,o,r,a,Math.floor(l/6),50);if(!s)return[new vy(t,n,r,a)];let[c,d,u]=s;return xy(e,t,c,o,r,d).concat(xy(e,c+u,n,o,d+u,a))}function Ay(e,t){for(let n=1;n<e.length;n++){let o=e[n-1],r=e[n];o.toA>r.fromA-t&&o.toB>r.fromB-t&&(e[n-1]=new vy(o.fromA,r.toA,o.fromB,r.toB),e.splice(n--,1))}}let My;try{My=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch(gO){}function Ty(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function Oy(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?Ty(n)?1:0:My?Ly(n)&&t!=e.length-1?My.test(e.slice(t,t+2))?2:0:My.test(String.fromCharCode(n))?1:0:0}function Dy(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?Ty(n)?1:0:My?zy(n)&&1!=t?My.test(e.slice(t-2,t))?2:0:My.test(String.fromCharCode(n))?1:0:0}function Py(e,t,n){if(t==e.length||!Dy(e,t))return t;for(let o=t,r=t+n;;){let n=Oy(e,o);if(!n)return o;if(o+=n,o>r)return t}}function Ry(e,t,n){if(!t||!Oy(e,t))return t;for(let o=t,r=t-n;;){let n=Dy(e,o);if(!n)return o;if(o-=n,o<r)return t}}function Fy(e,t,n){for(let o=t,r=t-n;;){let n=o?e.charCodeAt(o-1):10;if(10==n)return o;if(o--,o<r||32!=n&&9!=n)return t}}const Ly=e=>e>=55296&&e<=56319,zy=e=>e>=56320&&e<=57343;function By(e,t){return!t||t==e.length||!Ly(e.charCodeAt(t-1))||!zy(e.charCodeAt(t))}function Uy(e,t,n){var o;return yy=(null!==(o=null==n?void 0:n.scanLimit)&&void 0!==o?o:1e9)>>1,function(e,t,n){for(;;){Ay(n,1);let o=!1;for(let r=0;r<n.length;r++){let a,s,i=n[r];(a=Ey(e,i.fromA,i.toA,t,i.fromB,i.toB))&&(i=n[r]=new vy(i.fromA+a,i.toA,i.fromB+a,i.toB)),(s=Sy(e,i.fromA,i.toA,t,i.fromB,i.toB))&&(i=n[r]=new vy(i.fromA,i.toA-s,i.fromB,i.toB-s));let l=i.toA-i.fromA,c=i.toB-i.fromB;if(l&&c)continue;let d=i.fromA-(r?n[r-1].toA:0),u=(r<n.length-1?n[r+1].fromA:e.length)-i.toA;if(!d||!u)continue;let h=l?e.slice(i.fromA,i.toA):t.slice(i.fromB,i.toB);d<=h.length&&e.slice(i.fromA-d,i.fromA)==h.slice(h.length-d)?(n[r]=new vy(i.fromA-d,i.toA-d,i.fromB-d,i.toB-d),o=!0):u<=h.length&&e.slice(i.toA,i.toA+u)==h.slice(0,u)&&(n[r]=new vy(i.fromA+u,i.toA+u,i.fromB+u,i.toB+u),o=!0)}if(!o)break}return n}(e,t,xy(e,0,e.length,t,0,t.length))}function Vy(e,t,n){return function(e,t,n){for(let o=0,r=0;r<e.length;r++){let a=e[r],s=a.toA-a.fromA,i=a.toB-a.fromB;if(s&&i||s>3||i>3){let l=r==e.length-1?t.length:e[r+1].fromA,c=a.fromA-o,d=l-a.toA,u=Ry(t,a.fromA,Math.min(c,5)),h=Py(t,a.toA,Math.min(d,5)),m=a.fromA-u,f=h-a.toA;if(!s||!i){let d,p,g=Math.max(s,i),[v,x,y]=s?[t,a.fromA,a.toA]:[n,a.fromB,a.toB];m&&f?(g>m&&t.slice(u,a.fromA)==v.slice(y-m,y)?(a=e[r]=new vy(u,u+s,a.fromB-m,a.toB-m),u=a.fromA,h=Py(t,a.toA,Math.min(l-a.toA,5))):g>f&&t.slice(a.toA,h)==v.slice(x,x+f)&&(a=e[r]=new vy(h-s,h,a.fromB+f,a.toB+f),h=a.toA,u=Ry(t,a.fromA,Math.min(a.fromA-o,5))),m=a.fromA-u,f=h-a.toA):m||f||!(p=a.fromA-(d=Fy(t,a.fromA,c)))||t.slice(d,a.fromA)!=v.slice(y-p,y)||(a=e[r]=new vy(d,d+s,a.fromB-p,a.toB-p))}(m||f)&&(a=e[r]=new vy(a.fromA-m,a.toA+f,a.fromB-m,a.toB+f)),o=a.toA}}return Ay(e,3),e}(Uy(e,t,n),e,t)}const Gy=yn.define({combine:e=>e[0]}),$y=Yt.define(),Hy=Xt.define({create:e=>null,update(e,t){for(let n of t.effects)n.is($y)&&(e=n.value);return e}});class Wy{constructor(e,t,n,o,r){this.changes=e,this.fromA=t,this.toA=n,this.fromB=o,this.toB=r}offset(e,t){return e||t?new Wy(this.changes,this.fromA+e,this.toA+e,this.fromB+t,this.toB+t):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,t,n){return Xy(Vy(e.toString(),t.toString(),n),e,t,0,0)}static updateA(e,t,n,o,r){return Qy(Zy(e,o,!0,n.length),e,t,n,r)}static updateB(e,t,n,o,r){return Qy(Zy(e,o,!1,t.length),e,t,n,r)}}function qy(e,t,n,o){let r=n.lineAt(e),a=o.lineAt(t);return r.to==e&&a.to==t&&e<n.length&&t<o.length?[e+1,t+1]:[r.from,a.from]}function Yy(e,t,n,o){let r=n.lineAt(e),a=o.lineAt(t);return r.from==e&&a.from==t?[e,t]:[r.to+1,a.to+1]}function Xy(e,t,n,o,r){let a=[];for(let s=0;s<e.length;s++){let i=e[s],[l,c]=qy(i.fromA+o,i.fromB+r,t,n),[d,u]=Yy(i.toA+o,i.toB+r,t,n),h=[i.offset(-l+o,-c+r)];for(;s<e.length-1;){let a=e[s+1],[i,m]=qy(a.fromA+o,a.fromB+r,t,n);if(i>d+1&&m>u+1)break;h.push(a.offset(-l+o,-c+r)),[d,u]=Yy(a.toA+o,a.toB+r,t,n),s++}a.push(new Wy(h,l,Math.max(l,d),c,Math.max(c,u)))}return a}const Ky=1e3;function Jy(e,t,n,o){let r=0,a=e.length;for(;;){if(r==a){let o=0,a=0;r&&({toA:o,toB:a}=e[r-1]);let s=t-(n?o:a);return[o+s,a+s]}let s=r+a>>1,i=e[s],[l,c]=n?[i.fromA,i.toA]:[i.fromB,i.toB];if(l>t)a=s;else{if(!(c<=t))return o?[i.fromA,i.fromB]:[i.toA,i.toB];r=s+1}}}function Zy(e,t,n,o){let r=[];return t.iterChangedRanges(((a,s,i,l)=>{let c=0,d=n?t.length:o,u=0,h=n?o:t.length;a>Ky&&([c,u]=Jy(e,a-Ky,n,!0)),s<t.length-Ky&&([d,h]=Jy(e,s+Ky,n,!1));let m,f=l-i-(s-a),[p,g]=n?[f,0]:[0,f];r.length&&(m=r[r.length-1]).toA>=c?r[r.length-1]={fromA:m.fromA,fromB:m.fromB,toA:d,toB:h,diffA:m.diffA+p,diffB:m.diffB+g}:r.push({fromA:c,toA:d,fromB:u,toB:h,diffA:p,diffB:g})})),r}function Qy(e,t,n,o,r){if(!e.length)return t;let a=0,s=0,i=0,l=[];for(let c of e){let e=c.fromA+s,d=c.toA+s+c.diffA,u=c.fromB+i,h=c.toB+i+c.diffB;for(;a<t.length;){let n=t[a];if(n.toA+s<=e&&n.toB+i<=u)l.push(n.offset(s,i));else if(n.fromA+s>d)break;a++}for(let t of Xy(Vy(n.sliceString(e,d),o.sliceString(u,h),r),n,o,e,u))l.push(t);for(s+=c.diffA,i+=c.diffB;a<t.length;){let e=t[a];if(e.fromA>d+s&&e.fromB>h+i)break;a++}}for(;a<t.length;)l.push(t[a++].offset(s,i));return l}const eb=Jt.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=lb(e))}update(e){var t,n;(e.docChanged||e.viewportChanged||(t=e.startState,n=e.state,t.field(Hy,!1)!=n.field(Hy,!1))||function(e,t){return e.facet(Gy)!=t.facet(Gy)}(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=lb(e.view))}},{decorations:e=>e.deco}),tb=vn.low(Sr({class:"cm-changeGutter",markers:e=>{var t;return(null===(t=e.plugin(eb))||void 0===t?void 0:t.gutter)||jr.empty}}));const nb=Kt.line({class:"cm-changedLine"}),ob=Kt.mark({class:"cm-changedText"}),rb=Kt.mark({tagName:"ins",class:"cm-insertedLine"}),ab=Kt.mark({tagName:"del",class:"cm-deletedLine"}),sb=new class extends Ar{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function ib(e,t,n,o,r,a){let s=n?e.fromA:e.fromB,i=n?e.toA:e.toB,l=0;if(s!=i){r.add(s,s,nb),r.add(s,i,n?ab:rb),a&&a.add(s,s,sb);for(let c=t.iterRange(s,i-1),d=s;!c.next().done;){if(c.lineBreak){d++,r.add(d,d,nb),a&&a.add(d,d,sb);continue}let t=d+c.value.length;if(o)for(;l<e.changes.length;){let o=e.changes[l],a=s+(n?o.fromA:o.fromB),i=s+(n?o.toA:o.toB),c=Math.max(d,a),u=Math.min(t,i);if(c<u&&r.add(c,u,ob),!(i<t))break;l++}d=t}}}function lb(e){let t=e.state.field(Hy),{side:n,highlightChanges:o,markGutter:r}=e.state.facet(Gy),a="a"==n,s=new Zt,i=r?new Zt:null,{from:l,to:c}=e.viewport;for(let d of t){if((a?d.fromA:d.fromB)>=c)break;(a?d.toA:d.toB)>l&&ib(d,e.state.doc,a,o,s,i)}return{deco:s.finish(),gutter:i&&i.finish()}}class cb extends xn{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 db=Yt.define({map:(e,t)=>e.map(t)}),ub=Xt.define({create:()=>Kt.none,update:(e,t)=>{for(let n of t.effects)if(n.is(db))return n.value;return e.map(t.changes)},provide:e=>qt.decorations.from(e)}),hb=.01;const mb=Yt.define({map:(e,t)=>t.mapPos(e)});class fb extends xn{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let t=document.createElement("div");return t.className="cm-collapsedLines",t.textContent="⦚ "+e.state.phrase("$ unchanged lines",this.lines)+" ⦚",t.addEventListener("click",(t=>{let n=e.posAtDOM(t.target);e.dispatch({effects:mb.of(n)});let{side:o,sibling:r}=e.state.facet(Gy);r&&r().dispatch({effects:mb.of(pb(n,e.state.field(Hy),"a"==o))})})),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}}function pb(e,t,n){let o=0,r=0;for(let a=0;;a++){let s=a<t.length?t[a]:null;if(!s||(n?s.fromA:s.fromB)>=e)return r+(e-o);[o,r]=n?[s.toA,s.toB]:[s.toB,s.toA]}}const gb=Xt.define({create:e=>Kt.none,update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(mb)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>qt.decorations.from(e)});function vb({margin:e=3,minSize:t=4}){return gb.init((n=>function(e,t,n){let o=new Zt,r="a"==e.facet(Gy).side,a=e.field(Hy),s=1;for(let i=0;;i++){let l=i<a.length?a[i]:null,c=i?s+t:1,d=l?e.doc.lineAt(r?l.fromA:l.fromB).number-1-t:e.doc.lines,u=d-c+1;if(u>=n&&o.add(e.doc.line(c).from,e.doc.line(d).to,Kt.replace({widget:new fb(u),block:!0})),!l)break;s=e.doc.lineAt(Math.min(e.doc.length,r?l.toA:l.toB)).number}return o.finish()}(n,e,t)))}const xb=qt.styleModule.of(new _r({".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"}})),yb=qt.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"}}),bb=new Ir,wb=new Ir;class kb{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig;let t=[vn.low(eb),yb,xb,ub,qt.updateListener.of((e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some((e=>e.effects.some((e=>e.is(db)))))&&this.measure()}))],n=[Gy.of({side:"a",sibling:()=>this.b,highlightChanges:!1!==e.highlightChanges,markGutter:!1!==e.gutter})];!1!==e.gutter&&n.push(tb);let o=oo.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],qt.editorAttributes.of({class:"cm-merge-a"}),wb.of(n),t]}),r=[Gy.of({side:"b",sibling:()=>this.a,highlightChanges:!1!==e.highlightChanges,markGutter:!1!==e.gutter})];!1!==e.gutter&&r.push(tb);let a=oo.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],qt.editorAttributes.of({class:"cm-merge-b"}),wb.of(r),t]});this.chunks=Wy.build(o.doc,a.doc,this.diffConf);let s=[Hy.init((()=>this.chunks)),bb.of(e.collapseUnchanged?vb(e.collapseUnchanged):[])];o=o.update({effects:Yt.appendConfig.of(s)}).state,a=a.update({effects:Yt.appendConfig.of(s)}).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 i=e.orientation||"a-b",l=document.createElement("div");l.className="cm-mergeViewEditor";let c=document.createElement("div");c.className="cm-mergeViewEditor",this.editorDOM.appendChild("a-b"==i?l:c),this.editorDOM.appendChild("a-b"==i?c:l),this.a=new qt({state:o,parent:l,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new qt({state:a,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.b)}),this.setupRevertControls(!!e.revertControls,"b-to-a"==e.revertControls,e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,t){if(e.some((e=>e.docChanged))){let n=e[e.length-1],o=e.reduce(((e,t)=>e.compose(t.changes)),Nn.empty(e[0].startState.doc.length));this.chunks=t==this.a?Wy.updateA(this.chunks,n.newDoc,this.b.state.doc,o,this.diffConf):Wy.updateB(this.chunks,this.a.state.doc,n.newDoc,o,this.diffConf),t.update([...e,n.state.update({effects:$y.of(this.chunks)})]);let r=t==this.a?this.b:this.a;r.update([r.state.update({effects:$y.of(this.chunks)})]),this.scheduleMeasure()}else t.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let t="b-a"!=e.orientation;if(t!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let e=this.a.dom.parentNode,n=this.b.dom.parentNode;e.remove(),n.remove(),this.editorDOM.insertBefore(t?e:n,this.editorDOM.firstChild),this.editorDOM.appendChild(t?n:e),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let t=!!this.revertDOM,n=this.revertToA,o=this.renderRevert;"revertControls"in e&&(t=!!e.revertControls,n="b-to-a"==e.revertControls),"renderRevertControl"in e&&(o=e.renderRevertControl),this.setupRevertControls(t,n,o)}let t="highlightChanges"in e,n="gutter"in e,o="collapseUnchanged"in e;if(t||n||o){let r=[],a=[];if(t||n){let o=this.a.state.facet(Gy),s=n?!1!==e.gutter:o.markGutter,i=t?!1!==e.highlightChanges:o.highlightChanges;r.push(wb.reconfigure([Gy.of({side:"a",sibling:()=>this.b,highlightChanges:i,markGutter:s}),s?tb:[]])),a.push(wb.reconfigure([Gy.of({side:"b",sibling:()=>this.a,highlightChanges:i,markGutter:s}),s?tb:[]]))}if(o){let t=bb.reconfigure(e.collapseUnchanged?vb(e.collapseUnchanged):[]);r.push(t),a.push(t)}this.a.dispatch({effects:r}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,t,n){this.revertToA=t,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!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",(e=>this.revertClicked(e))),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,t,n){let o=new Zt,r=new Zt,a=e.state.field(ub).iter(),s=t.state.field(ub).iter(),i=0,l=0,c=0,d=0;for(let f=0;;f++){let u=f<n.length?n[f]:null;if(i<(u?u.fromA:e.state.doc.length)){let n=e.lineBlockAt(i).top+c-(t.lineBlockAt(l).top+d);n<-.01?(c-=n,o.add(i,i,Kt.widget({widget:new cb(-n),block:!0,side:-1}))):n>hb&&(d+=n,r.add(l,l,Kt.widget({widget:new cb(n),block:!0,side:-1})))}if(!u)break;for(i=u.toA,l=u.toB;a.value&&a.from<i;)c-=a.value.spec.widget.height,a.next();for(;s.value&&s.from<l;)d-=s.value.spec.widget.height,s.next()}for(;a.value;)c-=a.value.spec.widget.height,a.next();for(;s.value;)d-=s.value.spec.widget.height,s.next();let u=e.contentHeight+c-(t.contentHeight+d);u<hb?o.add(e.state.doc.length,e.state.doc.length,Kt.widget({widget:new cb(-u),block:!0,side:1})):u>hb&&r.add(t.state.doc.length,t.state.doc.length,Kt.widget({widget:new cb(u),block:!0,side:1}));let h=o.finish(),m=r.finish();jr.eq([h],[e.state.field(ub)])||e.dispatch({effects:db.of(h)}),jr.eq([m],[t.state.field(ub)])||t.dispatch({effects:db.of(m)})}(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,t=e.firstChild,n=this.a.viewport,o=this.b.viewport;for(let r=0;r<this.chunks.length;r++){let a=this.chunks[r];if(a.fromA>n.to||a.fromB>o.to)break;if(a.fromA<n.from||a.fromB<o.from)continue;let s=this.a.lineBlockAt(a.fromA).top+"px";for(;t&&+t.dataset.chunk<r;)t=Nb(t);t&&t.dataset.chunk==String(r)?(t.style.top!=s&&(t.style.top=s),t=t.nextSibling):e.insertBefore(this.renderRevertButton(s,r),t)}for(;t;)t=Nb(t)}renderRevertButton(e,t){let n;if(this.renderRevert)n=this.renderRevert();else{n=document.createElement("button");let e=this.a.state.phrase("Revert this chunk");n.setAttribute("aria-label",e),n.setAttribute("title",e),n.textContent=this.revertToLeft?"⇜":"⇝"}return n.style.top=e,n.setAttribute("data-chunk",String(t)),n}revertClicked(e){let t,n=e.target;for(;n&&n.parentNode!=this.revertDOM;)n=n.parentNode;if(n&&(t=this.chunks[n.dataset.chunk])){let[n,o,r,a,s,i]=this.revertToA?[this.b,this.a,t.fromB,t.toB,t.fromA,t.toA]:[this.a,this.b,t.fromA,t.toA,t.fromB,t.toB],l=n.state.sliceDoc(r,Math.max(r,a-1));r!=a&&i<=o.state.doc.length&&(l+=n.state.lineBreak),o.dispatch({changes:{from:s,to:Math.min(o.state.doc.length,i),insert:l},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 Nb(e){let t=e.nextSibling;return e.remove(),t}var Cb=["className","children","orientation","revertControls","highlightChanges","gutter","collapseUnchanged","destroyRerender","renderRevertControl"],Eb=["modified","modifiedExtension","original","originalExtension","theme","dispatch"],Sb=u.forwardRef(((e,t)=>{var{className:n,children:o,orientation:a,revertControls:s,highlightChanges:i,gutter:l,collapseUnchanged:c,destroyRerender:d=!0,renderRevertControl:u}=e,h=Cr(e,Cb),m=uy(),{modified:f,modifiedExtension:p,original:g,originalExtension:v,theme:x,dispatch:y}=m,b=Cr(m,Eb),w=r.useRef(null),N=r.useRef(),C={orientation:a,revertControls:s,highlightChanges:i,gutter:l,collapseUnchanged:c,renderRevertControl:u};r.useImperativeHandle(t,(()=>({container:w.current,view:N.current,modified:f,original:g,config:mo({a:g,b:f,parent:w.current},C)})),[w,N,f,g,C]);var E=qt.updateListener.of((e=>{if(e.docChanged&&"function"==typeof(null==v?void 0:v.onChange)){var t=e.state.doc.toString();null==v||v.onChange(t,e)}})),S=qt.updateListener.of((e=>{if(e.docChanged&&"function"==typeof(null==p?void 0:p.onChange)){var t=e.state.doc.toString();null==p||p.onChange(t,e)}}));r.useEffect((()=>{!N.current&&w.current&&v&&p&&(N.current=new kb(mo({a:mo({},g,{extensions:[...(null==v?void 0:v.extension)||[],...Er(mo({},null==v?void 0:v.option,{theme:x})),E]}),b:mo({},f,{extensions:[...(null==p?void 0:p.extension)||[],...Er(mo({},null==p?void 0:p.option,{theme:x})),S]}),parent:w.current},C)),y({view:N.current}))}),[N,w,v,p]),r.useEffect((()=>{if(g&&g.doc&&N.current){var e,t,n=null==(e=N.current)?void 0:e.a.state.doc.toString();if(n!==g.doc)null==(t=N.current)||t.a.dispatch({changes:{from:0,to:n.length,insert:g.doc||""}})}if(f&&f.doc&&N.current){var o,r,a=null==(o=N.current)?void 0:o.b.state.doc.toString();if(a!==f.doc)null==(r=N.current)||r.b.dispatch({changes:{from:0,to:a.length,insert:f.doc||""}})}if(d&&N.current){var s=N.current.a.state.selection.ranges[0].from,i=N.current.b.state.selection.ranges[0].from;N.current.destroy(),N.current=new kb(mo({a:mo({},g,{extensions:[...(null==v?void 0:v.extension)||[],...Er(mo({},null==v?void 0:v.option,{theme:x}))]}),b:mo({},f,{extensions:[...(null==p?void 0:p.extension)||[],...Er(mo({},null==p?void 0:p.option,{theme:x}))]}),parent:w.current},C)),s&&(N.current.a.focus(),N.current.a.dispatch({selection:{anchor:s,head:s}})),i&&(N.current.b.focus(),N.current.b.dispatch({selection:{anchor:i,head:i}}))}}),[N,x,w.current,g,f,v,p,d]),r.useEffect((()=>()=>N.current&&N.current.destroy()),[]),r.useEffect((()=>{if(N.current){var e={};b.orientation!==a&&(e.orientation=a),b.revertControls!==s&&(e.revertControls=s),b.highlightChanges!==i&&(e.highlightChanges=i),b.gutter!==l&&(e.gutter=l),b.collapseUnchanged!==c&&(e.collapseUnchanged=c),b.renderRevertControl!==u&&(e.collapseUnchanged=c),Object.keys(e).length&&y&&N.current&&(N.current.reconfigure(mo({},e)),y(mo({},e)))}}),[y,N,a,s,i,l,c,u]);return k.jsx("div",mo({ref:w,className:"cm-merge-theme"+(n?" "+n:"")},h,{children:o}))}));Sb.displayName="CodeMirrorMerge.Internal";var jb=["theme"],_b=u.forwardRef(((e,t)=>{var{theme:n}=e,o=Cr(e,jb);return k.jsx(hy,{theme:n,children:k.jsx(Sb,mo({},o,{ref:t}))})}));function Ib(e){return void 0===e&&(e=[]),Mr({override:[t=>{var n=t.matchBefore(/@(\w+)?/);return n?n&&n.from==n.to&&!t.explicit?null:{from:null==n?void 0:n.from,options:[...e]}:null}]})}function Ab(e){const t=function(e){const t=te.get(Tr),n=Or.keyBy(t,(e=>e.name)),o=e.match(/@([\w.]+)/g)||[];return o.map((e=>e.slice(1))).map((e=>n.get(e))).filter(Boolean)}(e);return J.debug("Included datasets",t),{includeOtherCode:Ti(""),context:{schema:t.map((e=>({name:e.name,columns:e.columns.map((e=>({name:e.name,type:e.type})))})))},code:""}}_b.Original=fy,_b.Modified=gy,_b.displayName="CodeMirrorMerge",Ib();const Mb=[Dr(),qt.lineWrapping],Tb=[Pr(),qt.lineWrapping],Ob=Rr("marimo:ai-language","python"),Db=e=>{const t=b(65),{onClose:n}=e,{createNewCell:o}=q();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a={},t[0]=a):a=t[0];const[s,i]=r.useState(a),[l,c]=Fe(Ob),{theme:d}=Te();let u,h,m;t[1]===Symbol.for("react.memo_cache_sentinel")?(u=Fr("api/ai/completion").toString(),h=Lr.headers(),t[1]=u,t[2]=h):(u=t[1],h=t[2]),t[3]!==s||t[4]!==l?(m={api:u,headers:h,streamMode:"text",body:{...s,language:l},onError:Rb},t[3]=s,t[4]=l,t[5]=m):m=t[5];const{completion:f,input:p,stop:g,isLoading:v,setCompletion:x,setInput:y,handleSubmit:w}=zr(m);let N;t[6]===Symbol.for("react.memo_cache_sentinel")?(N=k.jsx(Oc,{className:"size-4 text-[var(--blue-11)]"}),t[6]=N):N=t[6];const C="python"===l?"Python":"SQL";let S,j,_,I,A,M,T,O,D,P,R,F,L,z,B;t[7]===Symbol.for("react.memo_cache_sentinel")?(S=k.jsx(Vr,{className:"ml-1 h-3.5 w-3.5 text-muted-foreground/70"}),t[7]=S):S=t[7],t[8]!==C?(j=k.jsx(Ot,{asChild:!0,children:k.jsxs(E,{variant:"text",className:"ml-2",size:"xs","data-testid":"language-button",children:[C,S]})}),t[8]=C,t[9]=j):j=t[9],t[10]!==c?(_=k.jsx(Tt,{onClick:()=>c("python"),children:"Python"}),t[10]=c,t[11]=_):_=t[11],t[12]!==c?(I=k.jsx(Tt,{onClick:()=>c("sql"),children:"SQL"}),t[12]=c,t[13]=I):I=t[13],t[14]!==_||t[15]!==I?(A=k.jsxs(Bt,{align:"center",children:[_,I]}),t[14]=_,t[15]=I,t[16]=A):A=t[16],t[17]!==j||t[18]!==A?(M=k.jsxs(zt,{modal:!1,children:[j,A]}),t[17]=j,t[18]=A,t[19]=M):M=t[19],t[20]!==x||t[21]!==n?(T=()=>{x(""),n()},t[20]=x,t[21]=n,t[22]=T):T=t[22],t[23]!==y?(O=e=>{y(e),i(Ab(e))},t[23]=y,t[24]=O):O=t[24],t[25]!==v||t[26]!==w?(D=()=>{v||w()},t[25]=v,t[26]=w,t[27]=D):D=t[27],t[28]!==d||t[29]!==T||t[30]!==p||t[31]!==O||t[32]!==D?(P=k.jsx(Pb,{theme:d,onClose:T,value:p,onChange:O,onSubmit:D}),t[28]=d,t[29]=T,t[30]=p,t[31]=O,t[32]=D,t[33]=P):P=t[33],t[34]!==v||t[35]!==g?(R=v&&k.jsxs(E,{"data-testid":"stop-completion-button",variant:"text",size:"sm",className:"mb-0",onClick:g,children:[k.jsx(Gr,{className:"animate-spin mr-1",size:14}),"Stop"]}),t[34]=v,t[35]=g,t[36]=R):R=t[36],t[37]!==v||t[38]!==f||t[39]!==o||t[40]!==l||t[41]!==x||t[42]!==n?(F=!v&&f&&k.jsx(E,{"data-testid":"accept-completion-button",variant:"text",size:"sm",className:"mb-0",disabled:v,onClick:()=>{o({cellId:"__end__",before:!1,code:"python"===l?f:Uo.fromQuery(f)}),x(""),n()},children:k.jsx("span",{className:"text-[var(--grass-11)] opacity-100",children:"Accept"})}),t[37]=v,t[38]=f,t[39]=o,t[40]=l,t[41]=x,t[42]=n,t[43]=F):F=t[43],t[44]===Symbol.for("react.memo_cache_sentinel")?(L=k.jsx(en,{className:"size-4"}),t[44]=L):L=t[44],t[45]!==n?(z=k.jsx(E,{variant:"text",size:"sm",className:"mb-0",onClick:n,children:L}),t[45]=n,t[46]=z):z=t[46],t[47]!==M||t[48]!==P||t[49]!==R||t[50]!==F||t[51]!==z?(B=k.jsxs("div",{className:"flex items-center px-3",children:[N,M,P,R,F,z]}),t[47]=M,t[48]=P,t[49]=R,t[50]=F,t[51]=z,t[52]=B):B=t[52];const U=B;let V,G,$,H;return t[53]===Symbol.for("react.memo_cache_sentinel")?(V=on("flex flex-col w-full gap-2 py-2"),t[53]=V):V=t[53],t[54]!==f?(G=!f&&k.jsxs("span",{className:"text-xs text-muted-foreground px-3 flex flex-col gap-1",children:[k.jsxs("span",{children:["You can mention"," ",k.jsx("span",{className:"text-[var(--cyan-11)]",children:"@dataframe"})," or"," ",k.jsx("span",{className:"text-[var(--cyan-11)]",children:"@sql_table"})," to pull additional context such as column names."]}),k.jsx("span",{children:"Code from other cells is automatically included."})]}),t[54]=f,t[55]=G):G=t[55],t[56]!==f||t[57]!==d||t[58]!==l||t[59]!==x?($=f&&k.jsx($r,{value:f,className:"cm border-t",onChange:x,theme:"dark"===d?"dark":"light",extensions:"python"===l?Mb:Tb}),t[56]=f,t[57]=d,t[58]=l,t[59]=x,t[60]=$):$=t[60],t[61]!==U||t[62]!==G||t[63]!==$?(H=k.jsxs("div",{className:V,children:[U,G,$]}),t[61]=U,t[62]=G,t[63]=$,t[64]=H):H=t[64],H},Pb=e=>{const t=b(20),{value:n,inputRef:o,onChange:r,onSubmit:a,onClose:s,theme:i}=e,l=a,c=s,d=le(Tr);let u,h,m,f,p,g,v,x;if(t[0]!==d){let e;t[2]===Symbol.for("react.memo_cache_sentinel")?(e=e=>({label:`@${e.name}`,info:()=>{const t=[null==e.num_rows?void 0:`${e.num_rows} rows`,null==e.num_columns?void 0:`${e.num_columns} columns`].filter(Boolean).join(", "),n=document.createElement("div");if(n.classList.add("prose","prose-sm","dark:prose-invert"),t){const e=document.createElement("div");e.textContent=t,e.style.fontWeight="bold",n.append(e)}if(e.source){const t=document.createElement("figcaption");t.textContent=`Source: ${e.source}`,n.append(t)}if(e.columns){const t=document.createElement("table"),o=t.insertRow(),r=o.insertCell();r.textContent="Column",r.style.fontWeight="bold";const a=o.insertCell();a.textContent="Type",a.style.fontWeight="bold",e.columns.forEach((e=>{const n=t.insertRow();n.insertCell().textContent=e.name;n.insertCell().textContent=e.type})),n.append(t)}return n}}),t[2]=e):e=t[2];h=Ib(d.map(e)),t[0]=d,t[1]=h}else h=t[1];t[3]===Symbol.for("react.memo_cache_sentinel")?(m=Br(),t[3]=m):m=t[3],t[4]!==l?(f=vn.highest(fn.of([{preventDefault:!0,stopPropagation:!0,any:(e,t)=>{const n=t.metaKey||t.ctrlKey||t.shiftKey;if("Enter"===t.key&&!n)return l(),t.preventDefault(),t.stopPropagation(),!0;if("Enter"===t.key&&t.shiftKey){const n=e.state.selection.main.from;return e.dispatch({changes:{from:n,to:n,insert:"\n"},selection:{anchor:n+1,head:n+1}}),t.preventDefault(),t.stopPropagation(),!0}return!1}}])),t[4]=l,t[5]=f):f=t[5],t[6]!==c?(p=fn.of([{key:"Escape",preventDefault:!0,stopPropagation:!0,run:()=>(c(),!0)}]),t[6]=c,t[7]=p):p=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(g=fn.of([{key:"ArrowUp",preventDefault:!0,stopPropagation:!0}]),v=fn.of([{key:"ArrowDown",preventDefault:!0,stopPropagation:!0}]),t[8]=g,t[9]=v):(g=t[8],v=t[9]),t[10]!==h||t[11]!==f||t[12]!==p?(x=[h,qt.lineWrapping,m,f,p,g,v],t[10]=h,t[11]=f,t[12]=p,t[13]=x):x=t[13],u=x;const y=u,w="dark"===i?"dark":"light";let N;return t[14]!==o||t[15]!==n||t[16]!==y||t[17]!==r||t[18]!==w?(N=k.jsx($r,{ref:o,className:"flex-1 font-sans overflow-auto my-1",autoFocus:!0,width:"100%",value:n,basicSetup:!1,extensions:y,onChange:r,theme:w,placeholder:"Generate with AI"}),t[14]=o,t[15]=n,t[16]=y,t[17]=r,t[18]=w,t[19]=N):N=t[19],N};function Rb(e){re({title:"Generate with AI failed",description:Ur(e)})}const Fb=_b.Original,Lb=_b.Modified,zb=[Dr(),qt.lineWrapping],Bb=e=>{const t=b(53),{onChange:n,initialPrompt:o,currentLanguageAdapter:a,currentCode:s,declineChange:i,acceptChange:l,enabled:c,children:d}=e;let h;t[0]===Symbol.for("react.memo_cache_sentinel")?(h={},t[0]=h):h=t[0];const[m,f]=r.useState(h),[p,g]=Fe(vd);let v,x,y,w,N;t[1]===Symbol.for("react.memo_cache_sentinel")?(v=Fr("api/ai/completion").toString(),x=Lr.headers(),t[1]=v,t[2]=x):(v=t[1],x=t[2]),t[3]!==p||t[4]!==s?(y=p?Ti(s):"",t[3]=p,t[4]=s,t[5]=y):y=t[5],t[6]!==m||t[7]!==y||t[8]!==s||t[9]!==a?(w={...m,includeOtherCode:y,code:s,language:a},t[6]=m,t[7]=y,t[8]=s,t[9]=a,t[10]=w):w=t[10],t[11]!==o||t[12]!==w?(N={api:v,headers:x,initialInput:o,streamMode:"text",body:w,onError:Ub},t[11]=o,t[12]=w,t[13]=N):N=t[13];const{completion:S,input:j,stop:_,isLoading:I,setCompletion:A,setInput:M,handleSubmit:T}=zr(N),O=u.useRef(null);let D,P,R,F;t[14]!==c?(D=()=>{const e=O.current;c&&e&&(requestAnimationFrame((()=>{var t;null==(t=e.view)||t.focus()})),Hr(O.current.view))},P=[c],t[14]=c,t[15]=D,t[16]=P):(D=t[15],P=t[16]),r.useEffect(D,P),t[17]!==c||t[18]!==M||t[19]!==o?(R=()=>{c&&M(o||"")},F=[c,o,M],t[17]=c,t[18]=M,t[19]=o,t[20]=R,t[21]=F):(R=t[20],F=t[21]),r.useEffect(R,F);const{theme:L}=Te(),z=c&&"max-h-[400px] min-h-11 visible",B=!c&&"max-h-0 min-h-0 invisible";let U,V,G,$;t[22]!==z||t[23]!==B?(U=on("flex items-center gap-2 border-b px-3 transition-all rounded-[inherit] rounded-b-none duration-300 overflow-hidden",z,B),t[22]=z,t[23]=B,t[24]=U):U=t[24],t[25]!==c||t[26]!==i||t[27]!==A||t[28]!==M||t[29]!==I||t[30]!==T||t[31]!==O||t[32]!==L||t[33]!==j||t[34]!==_||t[35]!==S||t[36]!==l||t[37]!==g||t[38]!==p?(V=c&&k.jsxs(k.Fragment,{children:[k.jsx(Oc,{className:"text-[var(--blue-10)] flex-shrink-0",size:16}),k.jsx(Pb,{inputRef:O,theme:L,onClose:()=>{i(),A("")},value:j,onChange:e=>{M(e),f(Ab(e))},onSubmit:()=>{I||T()}}),I&&k.jsxs(E,{"data-testid":"stop-completion-button",variant:"text",size:"xs",className:"mb-0",onClick:_,children:[k.jsx(Gr,{className:"animate-spin mr-1",size:14}),"Stop"]}),!I&&S&&k.jsx(E,{"data-testid":"accept-completion-button",variant:"text",size:"xs",className:"mb-0",disabled:I,onClick:()=>{l(S),A("")},children:k.jsx("span",{className:"text-[var(--grass-11)] opacity-100",children:"Accept"})}),k.jsx("div",{className:"h-full w-px bg-border mx-2"}),k.jsx(C,{content:"Include code from other cells",children:k.jsxs("div",{className:"flex flex-row items-start gap-1 overflow-hidden",children:[k.jsx(Wr,{"data-testid":"include-other-cells-checkbox",id:"include-other-cells",checked:p,onCheckedChange:e=>g(Boolean(e))}),k.jsx(Ae,{htmlFor:"include-other-cells",className:"text-muted-foreground text-xs whitespace-nowrap ellipsis",children:"Include all code"})]})}),k.jsx(E,{"data-testid":"decline-completion-button",variant:"text",size:"icon",disabled:I,onClick:()=>{_(),i(),A("")},children:k.jsx(en,{className:"text-[var(--red-10)]",size:16})})]}),t[25]=c,t[26]=i,t[27]=A,t[28]=M,t[29]=I,t[30]=T,t[31]=O,t[32]=L,t[33]=j,t[34]=_,t[35]=S,t[36]=l,t[37]=g,t[38]=p,t[39]=V):V=t[39],t[40]!==U||t[41]!==V?(G=k.jsx("div",{className:U,children:V}),t[40]=U,t[41]=V,t[42]=G):G=t[42],t[43]!==S||t[44]!==c||t[45]!==n||t[46]!==s||t[47]!==L?($=S&&c&&k.jsxs(_b,{className:"cm",theme:L,children:[k.jsx(Fb,{onChange:n,value:s,extensions:zb}),k.jsx(Lb,{value:S,editable:!1,readOnly:!0,extensions:zb})]}),t[43]=S,t[44]=c,t[45]=n,t[46]=s,t[47]=L,t[48]=$):$=t[48];const H=(!S||!c)&&d;let W;return t[49]!==G||t[50]!==$||t[51]!==H?(W=k.jsxs("div",{className:"flex flex-col w-full rounded-[inherit] overflow-hidden",children:[G,$,H]}),t[49]=G,t[50]=$,t[51]=H,t[52]=W):W=t[52],W};function Ub(e){re({title:"Completion failed",description:Ur(e)})}const Vb=u.forwardRef(((e,t)=>{const{className:n,editorView:o}=e,a=r.useRef(null);return r.useEffect((()=>{null!==o&&null!==a.current&&0===a.current.children.length&&a.current.append(o.dom)}),[o,a]),k.jsx("div",{className:on("cm",n),ref:Og(t,a),"data-testid":"cell-editor"})}));Vb.displayName="CellCodeMirrorEditor";const Gb=r.memo((({theme:e,showPlaceholder:t,allowFocus:n,id:o,config:a,code:s,status:i,serializedEditorState:l,runCell:c,updateCellCode:d,createNewCell:u,deleteCell:h,focusCell:m,moveCell:f,moveToNextCell:p,updateCellConfig:g,clearSerializedEditorState:v,userConfig:x,editorViewRef:y,hidden:w,setTemporarilyVisible:N})=>{var C;const[E,S]=Fe(gd),[j,_]=r.useState(),I=function(){const e=b(2),t=ce(jd);let n;return e[0]!==t?(n=e=>{Me!==e&&t(e)},e[0]=t,e[1]=n):n=e[1],n}(),A=r.useRef(null),M="running"===i||"queued"===i,{sendToTop:T,sendToBottom:O}=q(),D=function(){const e=b(3),{splitCell:t,undoSplitCell:n}=q();let o;return e[0]!==t||e[1]!==n?(o=e=>{const o=qr(e.cellId),r=(null==o?void 0:o.state.doc.toString())??"";t(e);const{dismiss:a}=re({title:"Cell split",action:k.jsx(xd,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...e,snapshot:r}),s()},children:"Undo"})}),s=a},e[0]=t,e[1]=n,e[2]=o):o=e[2],W(o)}(),P=W((()=>!M&&(h({cellId:o}),!0))),R=r.useCallback((()=>u({cellId:o,before:!1})),[o,u]),F=r.useCallback((()=>u({cellId:o,before:!0})),[o,u]),L=r.useCallback((()=>f({cellId:o,before:!1})),[o,f]),z=r.useCallback((()=>f({cellId:o,before:!0})),[o,f]),B=r.useCallback((()=>m({cellId:o,before:!1})),[o,m]),U=r.useCallback((()=>m({cellId:o,before:!0})),[o,m]),V=W((()=>{const e=!a.hide_code;return _e({configs:{[o]:{hide_code:e}}}),g({cellId:o,config:{hide_code:e}}),e})),G=le(ue),$=W((()=>{wd(G,u)})),H=Yr(x),Y=r.useMemo((()=>{const n=(e=>{const{cellId:t,cellMovementCallbacks:n,cellCodeCallbacks:o,keymapConfig:r,hotkeys:a}=e;return[Li(r,n),[qt.domEventHandlers({drop:(e,t)=>{var n,o;const r=null==(n=e.dataTransfer)?void 0:n.files[0];if(null==r?void 0:r.type.startsWith("text/"))return e.preventDefault(),Mn(t,r),!0;if(null==r?void 0:r.type.startsWith("image/"))return e.preventDefault(),Tn(t,r),!0;const a=null==(o=e.dataTransfer)?void 0:o.getData("text/plain");if(a){e.preventDefault();const n=t.posAtCoords({x:e.clientX,y:e.clientY});return null!==n&&t.dispatch({changes:{from:n,to:n,insert:a},scrollIntoView:!0}),!0}return!1},dragover:e=>{e.preventDefault()}})],On(t,n,a),Dn(t,o,a),qp(e),[Gp,(s=(e,t)=>{jn(e,t)},Jt.define((e=>new $p(e,s)))),qt.baseTheme({".underline":{textDecoration:"underline",cursor:"pointer",color:"var(--link)"}})]];var s})({cellId:o,showPlaceholder:t,enableAI:H,cellCodeCallbacks:{updateCellCode:d,afterToggleMarkdown:$},cellMovementCallbacks:{onRun:c,deleteCell:P,createAbove:F,createBelow:R,moveUp:z,moveDown:L,focusUp:U,focusDown:B,sendToTop:T,sendToBottom:O,splitCell:D,moveToNextCell:p,toggleHideCode:V,aiCellCompletion:()=>{let e=!1;return S((t=>(null==t?void 0:t.cellId)===o?(e=!0,null):{cellId:o})),e}},completionConfig:x.completion,keymapConfig:x.keymap,theme:e,hotkeys:new Xr(x.keymap.overrides??{})});return n.push(Jt.define((e=>{const t=e.state.field(Kr);return _(t.type),{update(e){const t=e.state.field(Kr);_(t.type)}}}))),n}),[o,x.keymap,x.completion,H,e,t,F,R,U,B,z,L,p,T,O,D,V,d,P,c,S,$]);r.useEffect((()=>{let e;null===l?null===y.current?(y.current=new qt({state:oo.create({doc:s,extensions:Y})}),e=!0,we(y.current,Jr(y.current.state).type)):(y.current.dispatch({effects:[Yt.reconfigure.of([Y]),Zr(y.current,x.completion,new Xr(x.keymap.overrides??{}))]}),e=!1):(y.current=new qt({state:oo.fromJSON(l,{doc:s,extensions:Y},{history:Qr})}),we(y.current,Jr(y.current.state).type),e=!0,v({cellId:o})),null!==y.current&&null!==A.current&&A.current.replaceChildren(y.current.dom),e&&n&&requestAnimationFrame((()=>{var e,t;null==(e=y.current)||e.focus(),null==(t=y.current)||t.dom.scrollIntoView({behavior:"smooth",block:"nearest"})}))}),[y,Y,x.completion,x.keymap,v,o,l]),r.useEffect((()=>()=>{var e;null==(e=y.current)||e.destroy()}),[y]);const X=r.useCallback((async()=>{var e,t;if(w&&void 0!==N){N(!0),null==(e=y.current)||e.focus();const n=null==(t=A.current)?void 0:t.parentElement,o=new AbortController;null==n||n.addEventListener("focusout",(()=>{requestAnimationFrame((()=>{var e;const t=document.activeElement;(null==n?void 0:n.contains(t))||(N(!1),null==(e=y.current)||e.dom.blur(),o.abort())}))}),{signal:o.signal})}}),[w,N,y,A]);return k.jsx(Bb,{enabled:(null==E?void 0:E.cellId)===o,initialPrompt:null==E?void 0:E.initialPrompt,currentCode:(null==(C=y.current)?void 0:C.state.doc.toString())??s,currentLanguageAdapter:j,declineChange:()=>{var e;S(null),null==(e=y.current)||e.focus()},onChange:e=>{var t;null==(t=y.current)||t.dispatch({changes:{from:0,to:y.current.state.doc.length,insert:e}})},acceptChange:e=>{var t,n;null==(t=y.current)||t.dispatch({changes:{from:0,to:y.current.state.doc.length,insert:e}}),null==(n=y.current)||n.focus(),S(null)},children:k.jsxs("div",{className:"relative w-full",onFocus:()=>I(o),children:[w&&k.jsx(ea,{onClick:X}),k.jsx(Vb,{className:on(w&&"opacity-20 h-8 overflow-hidden"),editorView:y.current,ref:A}),!w&&k.jsx("div",{className:"absolute top-1 right-5",children:k.jsx(sy,{code:s,editorView:y.current,currentLanguageAdapter:j,onAfterToggle:$})})]})})})),$b=e=>{const t=b(10);let n,o,r,a;return t[0]!==e.left?(n=k.jsx("div",{className:"flex-1 flex item-center gap-2",children:e.left}),t[0]=e.left,t[1]=n):n=t[1],t[2]!==e.center?(o=k.jsx("div",{className:"flex-1 flex item-center gap-2 justify-center",children:e.center}),t[2]=e.center,t[3]=o):o=t[3],t[4]!==e.right?(r=k.jsx("div",{className:"flex-1 flex item-center gap-2 justify-end",children:e.right}),t[4]=e.right,t[5]=r):r=t[5],t[6]!==n||t[7]!==o||t[8]!==r?(a=k.jsxs("div",{className:"flex items-center gap-2 w-full px-3",children:[n,o,r]}),t[6]=n,t[7]=o,t[8]=r,t[9]=a):a=t[9],a},Hb=e=>{const t=b(8);if(!e.canCollapse&&!e.isCollapsed)return null;const n=e.isCollapsed?"Expand":"Collapse";let o,r,a;return t[0]!==e.isCollapsed?(o=k.jsx(Wb,{isCollapsed:e.isCollapsed}),t[0]=e.isCollapsed,t[1]=o):o=t[1],t[2]!==n||t[3]!==o?(r=k.jsx(C,{content:n,children:o}),t[2]=n,t[3]=o,t[4]=r):r=t[4],t[5]!==e.onClick||t[6]!==r?(a=k.jsx(E,{variant:"text",size:"icon",onClick:e.onClick,children:r}),t[5]=e.onClick,t[6]=r,t[7]=a):a=t[7],a},Wb=e=>{const t=b(2),{isCollapsed:n}=e;let o;return t[0]!==n?(o=n?k.jsx(oa,{className:"w-5 h-5 flex-shrink-0"}):k.jsx(Ee,{className:"w-5 h-5 flex-shrink-0"}),t[0]=n,t[1]=o):o=t[1],o},qb=r.memo((e=>{const t=b(24),{onClick:n,count:o,cellId:r}=e,a=H();let s;t[0]!==a||t[1]!==r?(s=ta(a,r),t[0]=a,t[1]=r,t[2]=s):s=t[2];const i=s;let l,c;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=on("flex items-center justify-between w-[calc(100%-2rem)] h-9 bg-muted rounded-b mx-4 opacity-80 hover:opacity-100 cursor-pointer"),t[3]=l):l=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx(Vr,{className:"w-4 h-4 flex-shrink-0"}),t[4]=c):c=t[4];const d=1===o?"cell":"cells";let u,h,m,f,p,g,v;return t[5]!==o||t[6]!==d?(u=k.jsxs(k.Fragment,{children:[c,k.jsxs("span",{className:"text-sm text-gray-500",children:[o," ",d," collapsed"]})]}),t[5]=o,t[6]=d,t[7]=u):u=t[7],t[8]!==i.errored?(h=i.errored&&k.jsx(C,{content:"Has errors",delayDuration:100,children:k.jsx(xc,{className:"w-4 h-4 flex-shrink-0 text-destructive"})}),t[8]=i.errored,t[9]=h):h=t[9],t[10]!==i.stale?(m=i.stale&&k.jsx(C,{content:"Has stale cells",delayDuration:100,children:k.jsx(na,{className:"w-4 h-4 flex-shrink-0 text-[var(--yellow-11)]"})}),t[10]=i.stale,t[11]=m):m=t[11],t[12]!==i.runningOrQueued?(f=i.runningOrQueued&&k.jsx(C,{content:"Running",delayDuration:100,children:k.jsx(Gr,{className:"w-4 h-4 flex-shrink-0 animate-spin"})}),t[12]=i.runningOrQueued,t[13]=f):f=t[13],t[14]!==h||t[15]!==m||t[16]!==f?(p=k.jsxs(k.Fragment,{children:[h,m,f]}),t[14]=h,t[15]=m,t[16]=f,t[17]=p):p=t[17],t[18]!==u||t[19]!==p?(g=k.jsx($b,{center:u,right:p}),t[18]=u,t[19]=p,t[20]=g):g=t[20],t[21]!==n||t[22]!==g?(v=k.jsx("div",{onClick:n,className:l,children:g}),t[21]=n,t[22]=g,t[23]=v):v=t[23],v}));qb.displayName="CollapsedCellBanner";const Yb=e=>{const t=b(6),{appClosed:n,status:o}=e,r=Cu("running"===o);let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=N("global.interrupt"),t[0]=a):a=t[0];const s=n||!r,i=r?ra:rn.NOOP,l=r?"stale":"disabled";let c,d;return t[1]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx(T,{strokeWidth:1.5}),t[1]=c):c=t[1],t[2]!==s||t[3]!==i||t[4]!==l?(d=k.jsx(kg,{tooltip:a,disabled:s,onClick:i,variant:l,"data-testid":"run-button",children:c}),t[2]=s,t[3]=i,t[4]=l,t[5]=d):d=t[5],d},Xb=e=>{const t=b(26),{edited:n,appClosed:o,status:r,cellConfig:a,needsRun:s,hasOutput:i,onRun:l,cellActionDropdownRef:c,cellId:d,getEditorView:u,name:h}=e,m=!s&&"hover-action";let f;t[0]!==m?(f=on(m),t[0]=m,t[1]=f):f=t[1];const p=o?rn.NOOP:l;let g,v,x,y,w;return t[2]!==n||t[3]!==p||t[4]!==o||t[5]!==r||t[6]!==a||t[7]!==s?(g=k.jsx(Cg,{edited:n,onClick:p,appClosed:o,status:r,config:a,needsRun:s}),t[2]=n,t[3]=p,t[4]=o,t[5]=r,t[6]=a,t[7]=s,t[8]=g):g=t[8],t[9]!==r||t[10]!==o?(v=k.jsx(Yb,{status:r,appClosed:o}),t[9]=r,t[10]=o,t[11]=v):v=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(x=k.jsx(kg,{variant:"green",tooltip:null,children:k.jsx(sl,{strokeWidth:1.5})}),t[12]=x):x=t[12],t[13]!==c||t[14]!==d||t[15]!==r||t[16]!==u||t[17]!==h||t[18]!==a||t[19]!==i?(y=k.jsx(ey,{ref:c,cellId:d,status:r,getEditorView:u,name:h,config:a,hasOutput:i,children:x}),t[13]=c,t[14]=d,t[15]=r,t[16]=u,t[17]=h,t[18]=a,t[19]=i,t[20]=y):y=t[20],t[21]!==f||t[22]!==g||t[23]!==v||t[24]!==y?(w=k.jsxs(Ng,{className:f,children:[g,v,y]}),t[21]=f,t[22]=g,t[23]=v,t[24]=y,t[25]=w):w=t[25],w},Kb=r.memo(r.forwardRef((({theme:e,showPlaceholder:t,allowFocus:n,id:o,code:a,output:s,consoleOutputs:i,status:l,runStartTimestamp:c,lastRunStartTimestamp:d,runElapsedTimeMs:u,edited:h,interrupted:m,errored:f,stopped:p,staleInputs:g,serializedEditorState:v,mode:x,debuggerActive:y,appClosed:b,canDelete:w,updateCellCode:C,prepareForRun:E,createNewCell:S,deleteCell:j,focusCell:_,moveCell:I,setStdinResponse:A,moveToNextCell:M,updateCellConfig:T,clearSerializedEditorState:O,sendToBottom:D,sendToTop:P,collapseCell:R,expandCell:F,userConfig:L,outline:z,isCollapsed:B,collapseCount:U,config:V,canMoveX:G,name:$},H)=>{J.debug("Rendering Cell",o);const q=r.useRef(null),Y=r.useRef(null),Z=r.useRef(null),Q=ce(gd),[ee,te]=r.useState(!1),ne=V.disabled||"disabled-transitively"===l,oe=aa(L.runtime.auto_instantiate,u,l,f,m,p),re=oe||h||m||g&&!ne,ae="running"===l||"queued"===l,se=sa({status:l,output:s,runStartTimestamp:c,interrupted:m,staleInputs:g},h),ie=("queued"===l||h||g)&&!m,le="edit"===x,de=r.useCallback((()=>{const e=Yp(Z),t=X(e);return"markdown"!==ia(e)&&la(e),E({cellId:o}),t}),[o,Z,E]);r.useImperativeHandle(H,(()=>({get editorView(){return Yp(Z)},registerRun:de})),[Z,de]);const ue=r.useCallback((()=>Z.current),[Z]),he=W((async()=>{if(ae)return;const e=de();await K({cellIds:[o],codes:[e]}).catch((e=>{J.error("Error running cell",e)}))})),me=r.useCallback(((e={})=>S({cellId:o,before:!1,...e})),[o,S]),fe=r.useCallback(((e={})=>S({cellId:o,before:!0,...e})),[o,S]),pe=r.useCallback((e=>{null===q.current||q.current.contains(e.relatedTarget)||null===Z.current||la(Z.current)}),[]),ge=r.useCallback((e=>{if(q.current===document.activeElement&&null!==Z.current&&"active"===kn(Z.current.state)){for(const t of ca)if(e.key===t.key&&t.run){t.run(Z.current),e.preventDefault(),e.stopPropagation();break}Z.current.focus()}}),[q,Z]),ve=!da(s),xe=ve&&k.jsxs("div",{className:"relative",children:[k.jsx("div",{className:"absolute top-5 -left-8 z-10 print:hidden",children:k.jsx(Hb,{isCollapsed:B,onClick:()=>{B?F({cellId:o}):R({cellId:o})},canCollapse:ua(z)})}),k.jsx(ha,{allowExpand:le,output:s,className:"output-area",cellId:o,stale:se})]}),ye=ma("Cell","hover-actions-parent z-10",{published:!le,interactive:le,"needs-run":re,"has-error":f,stopped:p,disabled:V.disabled,stale:"disabled-transitively"===l}),be=ht.create(o),we=!V.hide_code||ee;if(zi(le?q:null,{"cell.run":he,"cell.runAndNewBelow":()=>{he(),M({cellId:o,before:!1})},"cell.runAndNewAbove":()=>{he(),M({cellId:o,before:!0})},"cell.createAbove":fe,"cell.createBelow":me,"cell.moveUp":()=>I({cellId:o,before:!0}),"cell.moveDown":()=>I({cellId:o,before:!1}),"cell.hideCode":()=>{var e,t,n;const r=!V.hide_code;_e({configs:{[o]:{hide_code:r}}}),T({cellId:o,config:{hide_code:r}}),r?(null==(e=Z.current)||e.contentDOM.blur(),null==(t=q.current)||t.focus()):null==(n=Z.current)||n.focus()},"cell.focusDown":()=>M({cellId:o,before:!1}),"cell.focusUp":()=>M({cellId:o,before:!0}),"cell.sendToBottom":()=>D({cellId:o}),"cell.sendToTop":()=>P({cellId:o}),"cell.aiCompletion":()=>{let e=!1;Q((t=>(null==t?void 0:t.cellId)===o?(e=!0,null):{cellId:o})),e&&Yp(Z).focus()},"cell.cellActions":()=>{var e;null==(e=Y.current)||e.toggle()}}),Bi(le?q:null,{ArrowDown:()=>(M({cellId:o,before:!1,noCreate:!0}),!0),ArrowUp:()=>(M({cellId:o,before:!0,noCreate:!0}),!0),..."vim"!==L.keymap.preset||we?{}:{j:()=>(M({cellId:o,before:!1,noCreate:!0}),!0),k:()=>(M({cellId:o,before:!0,noCreate:!0}),!0)}}),!le){const e=fa(null==s?void 0:s.mimetype);return f||m||p||e?null:k.jsx("div",{tabIndex:-1,id:be,ref:q,className:ye,children:xe})}return k.jsx(ny,{cellId:o,config:V,status:l,getEditorView:ue,hasOutput:ve,name:$,children:k.jsxs(Qx,{tabIndex:-1,ref:q,"data-status":l,onBlur:pe,onKeyDown:ge,cellId:o,canMoveX:G,title:V.disabled?"This cell is disabled":"disabled-transitively"===l?"This cell has a disabled ancestor":void 0,children:[k.jsxs("div",{className:ye,id:be,children:["above"===L.display.cell_output&&xe,k.jsxs("div",{className:"tray",children:[k.jsx("div",{className:"absolute right-2 -top-4 z-10",children:k.jsx(Xb,{edited:h,appClosed:b,status:l,cellConfig:V,needsRun:re,hasOutput:ve,cellActionDropdownRef:Y,cellId:o,name:$,getEditorView:ue,onRun:he})}),k.jsxs("div",{className:"absolute flex flex-col gap-[2px] justify-center h-full left-[-34px] z-20",children:[k.jsx(yg,{tooltipContent:N("cell.createAbove"),appClosed:b,onClick:b?void 0:fe}),k.jsx("div",{className:"flex-1"}),k.jsx(yg,{tooltipContent:N("cell.createBelow"),appClosed:b,onClick:b?void 0:me})]}),k.jsx(Gb,{theme:e,showPlaceholder:t,allowFocus:n,id:o,code:a,config:V,status:l,serializedEditorState:v,runCell:he,updateCellCode:C,createNewCell:S,deleteCell:j,focusCell:_,moveCell:I,moveToNextCell:M,updateCellConfig:T,clearSerializedEditorState:O,userConfig:L,editorViewRef:Z,hidden:!we,setTemporarilyVisible:te}),k.jsxs("div",{className:"shoulder-right z-20",children:[k.jsx(_g,{status:l,staleInputs:g,interrupted:m,editing:le,edited:h,disabled:V.disabled??!1,elapsedTime:u,runStartTimestamp:c,uninstantiated:oe,lastRunStartTimestamp:d}),k.jsx("div",{className:"flex gap-2 items-end",children:k.jsx(Jx,{})})]}),k.jsx("div",{className:"shoulder-bottom hover-action",children:w&&we&&k.jsx(Eg,{appClosed:b,status:l,onClick:()=>{ae||b||j({cellId:o})}})})]}),"below"===L.display.cell_output&&xe,k.jsx(il,{consoleOutputs:i,stale:ie,cellName:$,onRefactorWithAI:e=>{Q({cellId:o,initialPrompt:e.prompt})},onSubmitDebugger:(e,t)=>{A({cellId:o,response:e,outputIndex:t}),pa({text:e})},cellId:o,debuggerActive:y})]}),B&&k.jsx(qb,{onClick:()=>F({cellId:o}),count:U,cellId:o})]})})}))),Jb=e=>{const t=b(10),{width:n}=e,{banners:o}=ll(),{removeBanner:r}=cl();if(0===o.length)return null;const a="columns"===n&&"sticky left-12 w-full max-w-[80vw]";let s,i,l;if(t[0]!==a?(s=on("flex flex-col gap-4 mb-5 print:hidden",a),t[0]=a,t[1]=s):s=t[1],t[2]!==r||t[3]!==o){let e;t[5]!==r?(e=e=>k.jsxs(ga,{kind:e.variant||"info",className:"flex flex-col rounded p-3",children:[k.jsxs("div",{className:"flex justify-between",children:[k.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[k.jsx(va,{className:"w-5 h-5 inline-block mr-2"}),e.title]}),k.jsx(E,{"data-testid":"remove-banner-button",variant:"text",size:"icon",onClick:()=>r(e.id),children:k.jsx(en,{className:"w-5 h-5"})})]}),k.jsxs("div",{className:"flex justify-between items-end",children:[k.jsx("span",{children:xa({html:e.description})}),"restart"===e.action&&k.jsx(Zb,{})]})]},e.id),t[5]=r,t[6]=e):e=t[6],i=o.map(e),t[2]=r,t[3]=o,t[4]=i}else i=t[4];return t[7]!==s||t[8]!==i?(l=k.jsx("div",{className:s,children:i}),t[7]=s,t[8]=i,t[9]=l):l=t[9],l},Zb=()=>{const e=b(3),t=zd();let n,o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=k.jsx(jc,{className:"w-3 h-3 mr-2"}),e[0]=n):n=e[0],e[1]!==t?(o=k.jsxs(E,{"data-testid":"restart-session-button",variant:"link",size:"xs",onClick:t,children:[n,"Restart"]}),e[1]=t,e[2]=o):o=e[2],o};const Qb=(e,t)=>function(e,t){const n=/^(\d+)\.(\d+)\.(\d+)(?:-([\w.-]+))?(?:\+([\w.-]+))?$/,o=e=>{const t=e.match(n);if(!t)return null;const[,o,r,a,s]=t;return{major:Number.parseInt(o,10),minor:Number.parseInt(r,10),patch:Number.parseInt(a,10),preRelease:s||""}};try{const n=o(e),r=o(t);return n&&r?n.major!==r.major?n.major-r.major:n.minor!==r.minor?n.minor-r.minor:n.patch!==r.patch?n.patch-r.patch:""===n.preRelease&&""!==r.preRelease?1:""!==n.preRelease&&""===r.preRelease?-1:n.preRelease.localeCompare(r.preRelease):e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}catch{return e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}}(t,e);const ew=()=>{const e=b(64),{packageAlert:t}=dl(),{clearPackageAlert:n}=ul(),[o]=Oe();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];const[s,i]=r.useState(a);if(null===t)return null;const l="pixi"!==o.package_management.manager;if(hl(t)){let r,a,c,d,u,h,m,f,p,g;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=k.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[k.jsx(bc,{className:"w-5 h-5 inline-block mr-2"}),"Missing packages"]}),e[1]=r):r=e[1],e[2]!==n||e[3]!==t.id?(a=()=>n(t.id),e[2]=n,e[3]=t.id,e[4]=a):a=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx(en,{className:"w-5 h-5"}),e[5]=c):c=e[5],e[6]!==a?(d=k.jsxs("div",{className:"flex justify-between",children:[r,k.jsx(E,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:a,children:c})]}),e[6]=a,e[7]=d):d=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(u=k.jsx("p",{children:"The following packages were not found:"}),e[8]=u):u=e[8],e[9]!==l||e[10]!==s||e[11]!==t.packages){let n;e[13]!==l||e[14]!==s?(n=(e,t)=>k.jsxs("li",{className:"flex items-center gap-1 font-mono text-sm",children:[k.jsx(Ul,{size:"1rem"}),e,l&&k.jsx(rw,{value:s[e]??"latest",onChange:t=>i((n=>({...n,[e]:t}))),packageName:e})]},t),e[13]=l,e[14]=s,e[15]=n):n=e[15],h=t.packages.map(n),e[9]=l,e[10]=s,e[11]=t.packages,e[12]=h}else h=e[12];return e[16]!==h?(m=k.jsxs("div",{children:[u,k.jsx("ul",{className:"list-disc ml-4 mt-1",children:h})]}),e[16]=h,e[17]=m):m=e[17],e[18]!==t||e[19]!==n||e[20]!==o||e[21]!==s?(f=k.jsx("div",{className:"ml-auto flex flex-row items-baseline",children:t.isolated?k.jsxs(k.Fragment,{children:[k.jsx(nw,{manager:o.package_management.manager,versions:s,clearPackageAlert:()=>n(t.id)}),!D()&&k.jsxs(k.Fragment,{children:[k.jsx("span",{className:"px-2 text-sm",children:"with"})," ",k.jsx(ow,{})]})]}):k.jsxs("p",{children:["If you set up a"," ",k.jsx("a",{href:"https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments",className:"text-accent-foreground hover:underline",target:"_blank",rel:"noreferrer",children:"virtual environment"}),", marimo can install these packages for you."]})}),e[18]=t,e[19]=n,e[20]=o,e[21]=s,e[22]=f):f=e[22],e[23]!==m||e[24]!==f?(p=k.jsxs("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:[m,f]}),e[23]=m,e[24]=f,e[25]=p):p=e[25],e[26]!==d||e[27]!==p?(g=k.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:k.jsxs(ga,{kind:"danger",className:"flex flex-col rounded py-3 px-5 animate-in slide-in-from-left",children:[d,p]})}),e[26]=d,e[27]=p,e[28]=g):g=e[28],g}if(ml(t)){let o;e[29]!==t.packages?(o=function(e){const t=new Set(Object.values(e)),n=t.has("queued")||t.has("installing")?"installing":t.has("failed")?"failed":"installed";if("installing"===n)return{status:"installing",title:"Installing packages",titleIcon:k.jsx(Yl,{className:"w-5 h-5 inline-block mr-2"}),description:"Installing packages:"};if("installed"===n)return{status:"installed",title:"All packages installed!",titleIcon:k.jsx(yc,{className:"w-5 h-5 inline-block mr-2"}),description:"Installed packages:"};return{status:"failed",title:"Some packages failed to install",titleIcon:k.jsx(bc,{className:"w-5 h-5 inline-block mr-2"}),description:"See terminal for error logs."}}(t.packages),e[29]=t.packages,e[30]=o):o=e[30];const{status:r,title:a,titleIcon:s,description:i}=o;"installed"===r&&setTimeout((()=>n(t.id)),1e4);const l="failed"===r?"danger":"info";let c,d,u,h,m;e[31]!==s||e[32]!==a?(c=k.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[s,a]}),e[31]=s,e[32]=a,e[33]=c):c=e[33],e[34]!==n||e[35]!==t.id?(d=()=>n(t.id),e[34]=n,e[35]=t.id,e[36]=d):d=e[36],e[37]===Symbol.for("react.memo_cache_sentinel")?(u=k.jsx(en,{className:"w-5 h-5"}),e[37]=u):u=e[37],e[38]!==d?(h=k.jsx(E,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:d,children:u}),e[38]=d,e[39]=h):h=e[39],e[40]!==c||e[41]!==h?(m=k.jsxs("div",{className:"flex justify-between",children:[c,h]}),e[40]=c,e[41]=h,e[42]=m):m=e[42];const f="installed"===r&&"text-accent-foreground";let p,g,v,x,y,b,w;if(e[43]!==f?(p=on("flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",f),e[43]=f,e[44]=p):p=e[44],e[45]!==i?(g=k.jsx("p",{children:i}),e[45]=i,e[46]=g):g=e[46],e[47]!==t.packages||e[48]!==r){let n;e[50]!==r?(n=(e,t)=>{const[n,o]=e;return k.jsxs("li",{className:on("flex items-center gap-1 font-mono text-sm","installing"===o&&"font-semibold","failed"===o&&"text-destructive","installed"===o&&"text-accent-foreground","installed"===o&&"failed"===r&&"text-muted-foreground"),children:[k.jsx(tw,{status:o}),n]},t)},e[50]=r,e[51]=n):n=e[51],v=Object.entries(t.packages).map(n),e[47]=t.packages,e[48]=r,e[49]=v}else v=e[49];return e[52]!==v?(x=k.jsx("ul",{className:"list-disc ml-4 mt-1",children:v}),e[52]=v,e[53]=x):x=e[53],e[54]!==g||e[55]!==x?(y=k.jsxs("div",{children:[g,x]}),e[54]=g,e[55]=x,e[56]=y):y=e[56],e[57]!==p||e[58]!==y?(b=k.jsx("div",{className:p,children:y}),e[57]=p,e[58]=y,e[59]=b):b=e[59],e[60]!==l||e[61]!==m||e[62]!==b?(w=k.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:k.jsxs(ga,{kind:l,className:"flex flex-col rounded pt-3 pb-4 px-5",children:[m,b]})}),e[60]=l,e[61]=m,e[62]=b,e[63]=w):w=e[63],w}return M(t),null};const tw=e=>{const t=b(4),{status:n}=e;switch(n){case"queued":{let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx(Ul,{size:"1rem"}),t[0]=e):e=t[0],e}case"installing":{let e;return t[1]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx(Yl,{size:"1rem"}),t[1]=e):e=t[1],e}case"installed":{let e;return t[2]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx(_t,{size:"1rem"}),t[2]=e):e=t[2],e}case"failed":{let e;return t[3]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx(en,{size:"1rem"}),t[3]=e):e=t[3],e}default:return M(n),null}},nw=e=>{const t=b(8),{manager:n,versions:o,clearPackageAlert:r}=e;let a,s,i,l;return t[0]!==r||t[1]!==n||t[2]!==o?(a=async()=>{r(),await Ia({manager:n,versions:o}).catch((e=>{J.error(e)}))},t[0]=r,t[1]=n,t[2]=o,t[3]=a):a=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(s=k.jsx(Yl,{className:"w-4 h-4 mr-2"}),i=k.jsx("span",{className:"font-semibold",children:"Install"}),t[4]=s,t[5]=i):(s=t[4],i=t[5]),t[6]!==a?(l=k.jsxs(E,{variant:"outline","data-testid":"install-packages-button",size:"sm",onClick:a,children:[s,i]}),t[6]=a,t[7]=l):l=t[7],l},ow=()=>{const e=b(16),[t,n]=Oe();let o,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=ya(ba),e[0]=o):o=e[0],e[1]!==t?(r={resolver:o,defaultValues:t},e[1]=t,e[2]=r):r=e[2];const a=wa(r);let s;e[3]!==n?(s=async e=>{await Pe({config:e}).then((()=>{n(e)}))},e[3]=n,e[4]=s):s=e[4];const i=s;let l,c,d,u;return e[5]!==a||e[6]!==i?(l=a.handleSubmit(i),e[5]=a,e[6]=i,e[7]=l):l=e[7],e[8]!==a.control?(c=k.jsx("div",{className:"flex flex-col gap-3",children:k.jsx(ka,{control:a.control,name:"package_management.manager",render:sw})}),e[8]=a.control,e[9]=c):c=e[9],e[10]!==l||e[11]!==c?(d=k.jsx("form",{onChange:l,className:"flex flex-col gap-5",children:c}),e[10]=l,e[11]=c,e[12]=d):d=e[12],e[13]!==a||e[14]!==d?(u=k.jsx(Na,{...a,children:d}),e[13]=a,e[14]=d,e[15]=u):u=e[15],u},rw=e=>{const t=b(21),{value:n,onChange:o,packageName:r}=e;let a,s;t[0]!==r?(a=async()=>{const e=await fetch(`https://pypi.org/pypi/${t=r,t.replaceAll(/\[.*]/g,"").trim()}/json`,{method:"GET",signal:AbortSignal.timeout(5e3)});var t;const n=await e.json();return["latest",...Object.keys(n.releases).sort(Qb).slice(0,100)]},s=[r],t[0]=r,t[1]=a,t[2]=s):(a=t[1],s=t[2]);const{data:i,loading:l,error:c}=an(a,s);let d;t[3]!==i?(d=void 0===i?[]:i,t[3]=i,t[4]=d):d=t[4];const u=d;if(c){let e,r,a;return t[5]!==o?(e=e=>o(e.target.value),t[5]=o,t[6]=e):e=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(r=k.jsx("option",{value:"latest",children:"latest"}),t[7]=r):r=t[7],t[8]!==n||t[9]!==e?(a=k.jsx(C,{content:"Failed to fetch package versions",children:k.jsx(Sa,{value:n,onChange:e,disabled:!0,className:"inline-flex ml-2",children:r})}),t[8]=n,t[9]=e,t[10]=a):a=t[10],a}let h,m,f;return t[11]!==o?(h=e=>o(e.target.value),t[11]=o,t[12]=h):h=t[12],t[13]!==l||t[14]!==u?(m=l?k.jsx("option",{value:"latest",children:"latest"}):u.map(iw),t[13]=l,t[14]=u,t[15]=m):m=t[15],t[16]!==n||t[17]!==h||t[18]!==l||t[19]!==m?(f=k.jsx(Sa,{value:n,onChange:h,disabled:l,className:"inline-flex ml-2",children:m}),t[16]=n,t[17]=h,t[18]=l,t[19]=m,t[20]=f):f=t[20],f};function aw(e){return k.jsx("option",{value:e,children:e},e)}function sw(e){const{field:t}=e;return k.jsxs(Ca,{children:[k.jsx(Ea,{children:k.jsx(Sa,{"data-testid":"install-package-manager-select",onChange:e=>t.onChange(e.target.value),value:t.value,disabled:t.disabled,className:"inline-flex mr-2",children:ja.map(aw)})}),k.jsx(_a,{})]})}function iw(e){return k.jsx("option",{value:e,children:e},e)}const lw=e=>{let{transform:t}=e;return{...t,x:0}},cw={threshold:{x:0,y:.1}},dw=u.memo((e=>{const t=b(25),{children:n,multiColumn:o}=e,{cellIds:a}=H(),{dropCellOverCell:s,dropCellOverColumn:i,moveColumn:l,compactColumns:c}=q(),[d,u]=r.useState(null),[h,m]=r.useState(null),[f]=De();let p;e:{if("columns"===f.width){p=Aa.EMPTY;break e}let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[lw],t[0]=e):e=t[0],p=e}const g=p;let v,x;t[1]===Symbol.for("react.memo_cache_sentinel")?(v={activationConstraint:{distance:8}},t[1]=v):v=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(x={coordinateGetter:Yx},t[2]=x):x=t[2];const y=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.useMemo((()=>[...t].filter((e=>null!=e))),[...t])}($g(zv,v),$g(Dv,x));let w;t[3]!==a?(w=e=>{u(e.active.id),m(a)},t[3]=a,t[4]=w):w=t[4];const N=W(w);let C;t[5]!==h?(C=()=>{u(null),m(null)},t[5]=h,t[6]=C):C=t[6];const E=W(C);let S;t[7]!==d||t[8]!==a?(S=e=>{const t=e.droppableContainers.filter((e=>hw(e.id)));if(d&&hw(d))return Zg({...e,droppableContainers:t});const n=(e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:o}=e;if(!o)return[];const r=[];for(const a of t){const{id:e}=a,t=n.get(e);if(t&&tv(o,t)){const n=Xg(t).reduce(((e,t)=>e+Wg(o,t)),0),s=Number((n/4).toFixed(4));r.push({id:e,data:{droppableContainer:a,value:s}})}}return r.sort(qg)})({...e,droppableContainers:t}),o=Kg(n.length>0?n:ev({...e,droppableContainers:t}),"id");if(!o)return[];Gt(hw(o),`Expected column id. Got: ${o}`);const r=a.get(o);if(Gt(r,`Expected column. Got: ${o}`),r&&0===r.topLevelIds.length)return[{id:o}];const s=new Set(r.topLevelIds),i=Zg({...e,droppableContainers:e.droppableContainers.filter((e=>e.id!==o&&s.has(e.id)))});if(i.length>0){const e=i[0].id;return Gt(uw(e),`Expected cell id. Got: ${e}`),[{id:e}]}return[]},t[7]=d,t[8]=a,t[9]=S):S=t[9];const j=S;let _;t[10]!==i||t[11]!==s||t[12]!==l?(_=e=>{const{active:t,over:n}=e,o=null==n?void 0:n.id;if(null!=o&&t.id!==o){if(uw(t.id)){if(hw(o))return void i({cellId:t.id,columnId:o});if(uw(o))return void s({cellId:t.id,overCellId:o})}hw(t.id)&&hw(o)&&l({column:t.id,overColumn:o})}},t[10]=i,t[11]=s,t[12]=l,t[13]=_):_=t[13];const I=W(_);let A;t[14]!==c?(A=e=>{const{active:t,over:n}=e;null!==n&&t.id!==n.id&&c()},t[14]=c,t[15]=A):A=t[15];const M=W(A),T=o?j:Zg;let O;return t[16]!==y||t[17]!==T||t[18]!==g||t[19]!==M||t[20]!==N||t[21]!==E||t[22]!==I||t[23]!==n?(O=k.jsx(Nx,{autoScroll:cw,sensors:y,collisionDetection:T,modifiers:g,onDragEnd:M,onDragStart:N,onDragCancel:E,onDragOver:I,children:n}),t[16]=y,t[17]=T,t[18]=g,t[19]=M,t[20]=N,t[21]=E,t[22]=I,t[23]=n,t[24]=O):O=t[24],O}));function uw(e){return"string"==typeof e&&!e.startsWith("tree_")}function hw(e){return"string"==typeof e&&e.startsWith("tree_")}const mw=u.forwardRef((({columnId:e,canDelete:t,canMoveLeft:n,canMoveRight:o,...r},a)=>{const{attributes:s,listeners:i,setNodeRef:l,transform:c,transition:d,isDragging:u,isOver:h}=Hx({id:e}),m={transform:c?fr.Transform.toString({x:c.x,y:0,scaleX:1,scaleY:1}):void 0,transition:d,zIndex:u?2:void 0,position:"relative","--gutter-width":"50px"},f=Og(a,l),{deleteColumn:p,moveColumn:g,addColumn:v}=q(),x=on("h-full hover:bg-muted rounded-none"),y=()=>{const e=document.getElementById("App");e&&e.scrollTo({left:e.scrollLeft+1e3,behavior:"smooth"})},b=k.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:[k.jsx(C,{content:"Move column left",side:"top",delayDuration:300,children:k.jsx(E,{variant:"text",size:"sm",className:x,onClick:()=>g({column:e,overColumn:"_left_"}),disabled:!n,children:k.jsx(Ma,{className:"size-4"})})}),k.jsx(C,{content:"Move column right",side:"top",delayDuration:300,children:k.jsx(E,{variant:"text",size:"sm",className:x,onClick:()=>g({column:e,overColumn:"_right_"}),disabled:!o,children:k.jsx(oa,{className:"size-4"})})}),k.jsx("div",{className:"flex gap-2 h-full flex-grow active:bg-accent cursor-grab",...s,...i,"data-testid":"column-drag-button"}),t&&k.jsx(C,{content:"Delete column",side:"top",delayDuration:300,children:k.jsx(E,{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:()=>p({columnId:e}),children:k.jsx(en,{className:"size-4"})})}),k.jsx(C,{content:"Add column",side:"top",delayDuration:300,children:k.jsx(E,{variant:"text",size:"sm",className:x,onClick:()=>{v({columnId:e}),requestAnimationFrame(y)},children:k.jsx(zo,{className:"size-4"})})})]});return k.jsxs("div",{tabIndex:-1,ref:f,...r,style:m,"data-is-dragging":u,className:on(u?"":r.className,u?"z-20":"z-1 hover:z-10 focus-within:z-10",h&&"bg-accent/20"),children:[b,r.children]})}));mw.displayName="SortableColumn";const fw=r.memo(mw),pw=r.memo((e=>{const t=b(15),n=r.useRef(null),o="columns"===e.width&&"w-contentWidth box-content\t min-h-[100px] border border-t-0 border-[var(--slate-3)] rounded-b-lg px-11 py-6 bg-[var(--slate-2)]";let a,s;t[0]!==o?(a=on("flex flex-col gap-5",o),t[0]=o,t[1]=a):a=t[1],t[2]!==a||t[3]!==e.children?(s=k.jsx("div",{className:a,children:e.children}),t[2]=a,t[3]=e.children,t[4]=s):s=t[4];const i=s;if("columns"===e.width){let o;return t[5]!==e.canDelete||t[6]!==e.columnId||t[7]!==e.canMoveLeft||t[8]!==e.canMoveRight||t[9]!==e.footer||t[10]!==i?(o=k.jsxs(fw,{tabIndex:-1,ref:n,canDelete:e.canDelete,columnId:e.columnId,canMoveLeft:e.canMoveLeft,canMoveRight:e.canMoveRight,className:"group/column",children:[i,e.footer]}),t[5]=e.canDelete,t[6]=e.columnId,t[7]=e.canMoveLeft,t[8]=e.canMoveRight,t[9]=e.footer,t[10]=i,t[11]=o):o=t[11],o}let l;return t[12]!==i||t[13]!==e.footer?(l=k.jsxs(k.Fragment,{children:[i,e.footer]}),t[12]=i,t[13]=e.footer,t[14]=l):l=t[14],l}));pw.displayName="Column";const gw=e=>{const t=b(67),{notebook:n,mode:o,userConfig:a,appConfig:s,connStatus:i}=e,l=q(),{theme:c}=Te(),{toggleSidebarPanel:d}=Wd(),{invisible:u}=fl(n.cellIds.idLength,o);let h;yi("global.focusTop",l.focusTopCell),yi("global.focusBottom",l.focusBottomCell),yi("global.toggleSidebar",d),yi("global.foldCode",l.foldAll),yi("global.unfoldCode",l.unfoldAll),t[0]!==l.updateCellCode?(h=()=>{Da(l.updateCellCode)},t[0]=l.updateCellCode,t[1]=h):h=t[1],yi("global.formatAll",h),yi("cell.hideCode",rn.NOOP),yi("cell.format",rn.NOOP);const m=yd(),f=l.scrollToTarget;let p,g,v,x,y,w,N,C,E,S,j,_,I,A,M,T,O,D,P,R,F,L;if(t[2]!==n.scrollKey||t[3]!==f?(p=()=>{null!==n.scrollKey&&f()},t[2]=n.scrollKey,t[3]=f,t[4]=p):p=t[4],t[5]!==n.cellIds||t[6]!==n.scrollKey||t[7]!==f?(g=[n.cellIds,n.scrollKey,f],t[5]=n.cellIds,t[6]=n.scrollKey,t[7]=f,t[8]=g):g=t[8],r.useEffect(p,g),t[9]!==n.cellIds||t[10]!==n.cellData||t[11]!==n.cellRuntime||t[12]!==n.scrollKey||t[13]!==n.cellHandles||t[14]!==u||t[15]!==s||t[16]!==c||t[17]!==o||t[18]!==i.state||t[19]!==a||t[20]!==l||t[21]!==m){const e=n.cellIds.getColumns();let r;t[37]!==n.cellIds?(r=n.cellIds.hasOnlyOneId(),t[37]=n.cellIds,t[38]=r):r=t[38];const d=r;j=pl,_="pb-[40vh]",I=u,A=s,M="pr-4",t[39]===Symbol.for("react.memo_cache_sentinel")?(T=k.jsx(ew,{}),t[39]=T):T=t[39],t[40]!==s.width?(O=k.jsx(Jb,{width:s.width}),t[40]=s.width,t[41]=O):O=t[41],E=dw,S="columns"===s.width,y=Lx,w="column-container",N=e.map(xw),C=Tx;const h="columns"===s.width&&"grid grid-flow-col auto-cols-min gap-6";t[42]!==h?(v=on(h),t[42]=h,t[43]=v):v=t[43],x=e.map(((t,r)=>k.jsx(pw,{columnId:t.id,canMoveLeft:r>0,canMoveRight:r<e.length-1,width:s.width,canDelete:e.length>1,footer:k.jsx(vw,{columnId:t.id,className:on("columns"===s.width&&"opacity-0 group-hover/column:opacity-100")}),children:k.jsx(Lx,{id:`column-${r+1}`,items:t.topLevelIds,strategy:Px,children:t.topLevelIds.map((e=>{const r=n.cellData[e],h=n.cellRuntime[e];return k.jsx(Kb,{theme:c,showPlaceholder:d,allowFocus:!u&&!n.scrollKey,id:r.id,code:r.code,outline:h.outline,output:h.output,consoleOutputs:h.consoleOutputs,status:h.status,edited:r.edited,interrupted:h.interrupted,errored:h.errored,stopped:h.stopped,staleInputs:h.staleInputs,runStartTimestamp:h.runStartTimestamp,lastRunStartTimestamp:h.lastRunStartTimestamp,runElapsedTimeMs:h.runElapsedTimeMs??r.lastExecutionTime,serializedEditorState:r.serializedEditorState,canDelete:!d,mode:o,appClosed:i.state!==nl.OPEN,ref:n.cellHandles[e],userConfig:a,debuggerActive:h.debuggerActive,config:r.config,name:r.name,isCollapsed:t.isCollapsed(e),collapseCount:t.getCount(e),canMoveX:"columns"===s.width,...l,deleteCell:m},r.id.toString())}))})},t.id))),t[9]=n.cellIds,t[10]=n.cellData,t[11]=n.cellRuntime,t[12]=n.scrollKey,t[13]=n.cellHandles,t[14]=u,t[15]=s,t[16]=c,t[17]=o,t[18]=i.state,t[19]=a,t[20]=l,t[21]=m,t[22]=v,t[23]=x,t[24]=y,t[25]=w,t[26]=N,t[27]=C,t[28]=E,t[29]=S,t[30]=j,t[31]=_,t[32]=I,t[33]=A,t[34]=M,t[35]=T,t[36]=O}else v=t[22],x=t[23],y=t[24],w=t[25],N=t[26],C=t[27],E=t[28],S=t[29],j=t[30],_=t[31],I=t[32],A=t[33],M=t[34],T=t[35],O=t[36];return t[44]!==v||t[45]!==x?(D=k.jsx("div",{className:v,children:x}),t[44]=v,t[45]=x,t[46]=D):D=t[46],t[47]!==y||t[48]!==w||t[49]!==N||t[50]!==C||t[51]!==D?(P=k.jsx(y,{id:w,items:N,strategy:C,children:D}),t[47]=y,t[48]=w,t[49]=N,t[50]=C,t[51]=D,t[52]=P):P=t[52],t[53]!==E||t[54]!==S||t[55]!==P?(R=k.jsx(E,{multiColumn:S,children:P}),t[53]=E,t[54]=S,t[55]=P,t[56]=R):R=t[56],t[57]===Symbol.for("react.memo_cache_sentinel")?(F=k.jsx(gl,{}),t[57]=F):F=t[57],t[58]!==j||t[59]!==_||t[60]!==I||t[61]!==A||t[62]!==M||t[63]!==T||t[64]!==O||t[65]!==R?(L=k.jsxs(j,{className:_,invisible:I,appConfig:A,innerClassName:M,children:[T,O,R,F]}),t[58]=j,t[59]=_,t[60]=I,t[61]=A,t[62]=M,t[63]=T,t[64]=O,t[65]=R,t[66]=L):L=t[66],L},vw=e=>{const t=b(18),{columnId:n,className:o}=e,{createNewCell:r}=q(),a=le(ue),[s,i]=Ta(!1),l=le(de),c=le(Oa).sql;let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d=on("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"),t[0]=d):d=t[0];const u=d;let h;t[1]!==s||t[2]!==i.toggle||t[3]!==r||t[4]!==n||t[5]!==a||t[6]!==c||t[7]!==l?(h=()=>s?k.jsx(Db,{onClose:i.toggle}):k.jsxs(k.Fragment,{children:[k.jsxs(E,{className:u,variant:"text",size:"sm",onClick:()=>r({cellId:{type:"__end__",columnId:n},before:!1}),children:[k.jsx(Dc,{className:"mr-2 size-4 flex-shrink-0"}),"Python"]}),k.jsxs(E,{className:u,variant:"text",size:"sm",onClick:()=>{wd(a,r),r({cellId:{type:"__end__",columnId:n},before:!1,code:(new Bo).defaultCode})},children:[k.jsx(Fc,{className:"mr-2 size-4 flex-shrink-0"}),"Markdown"]}),k.jsx(C,{content:c?null:k.jsxs("div",{className:"flex flex-col",children:[k.jsxs("span",{children:["Additional dependencies required:",k.jsx(Pa,{className:"inline",children:"pip install 'marimo[sql]'"}),"."]}),k.jsx("span",{children:"You will need to restart the notebook after installing."})]}),delayDuration:100,asChild:!1,children:k.jsxs(E,{className:u,variant:"text",size:"sm",disabled:!c,onClick:()=>{wd(a,r),r({cellId:{type:"__end__",columnId:n},before:!1,code:(new Uo).defaultCode})},children:[k.jsx(ke,{className:"mr-2 size-4 flex-shrink-0"}),"SQL"]})}),k.jsx(C,{content:l?null:k.jsx("span",{children:"Enable via settings under AI Assist"}),delayDuration:100,asChild:!1,children:k.jsxs(E,{className:u,variant:"text",size:"sm",disabled:!l,onClick:i.toggle,children:[k.jsx(Oc,{className:"mr-2 size-4 flex-shrink-0"}),"Generate with AI"]})})]}),t[1]=s,t[2]=i.toggle,t[3]=r,t[4]=n,t[5]=a,t[6]=c,t[7]=l,t[8]=h):h=t[8];const m=h,f=!s&&"w-fit",p=s&&"opacity-100 w-full max-w-4xl shadow-lg shadow-[var(--blue-3)]";let g,v,x;return t[9]!==f||t[10]!==p||t[11]!==o?(g=on("shadow-sm border border-border rounded transition-all duration-200 overflow-hidden divide-x divide-border flex",f,p,o),t[9]=f,t[10]=p,t[11]=o,t[12]=g):g=t[12],t[13]!==m?(v=m(),t[13]=m,t[14]=v):v=t[14],t[15]!==g||t[16]!==v?(x=k.jsx("div",{className:"flex justify-center mt-4 pt-6 pb-32 group gap-4 w-full print:hidden",children:k.jsx("div",{className:g,children:v})}),t[15]=g,t[16]=v,t[17]=x):x=t[17],x};function xw(e){return e.id}async function yw(){await Fa({download:!1,includeCode:!0,files:el.INSTANCE.filenames()})}async function bw(){await La({download:!1})}const ww=e=>{const t=b(117),{userConfig:n,appConfig:o}=e,a=H();za(qa,Wa.onCellIdsChange);const{setCells:s,updateCellCode:i,mergeAllColumns:l}=q(),c=le(ut),[d,u]=vt(),[h,m]=r.useState(),f=Xi(),{openModal:p,closeModal:g,openAlert:v}=w(),x="edit"===c.mode,y="present"===c.mode,N=le(Ba),C=le(me);let E;t[0]!==v?(E=function(){v("Failed to save notebook: not connected to a kernel.")},t[0]=v,t[1]=E):E=t[1];const S=E;let j;t[2]===Symbol.for("react.memo_cache_sentinel")?(j=[],t[2]=j):j=t[2],r.useEffect(Cw,j);const _=n.runtime.auto_instantiate;let I,A,M;t[3]!==s?(I=(e,t)=>{s(e);const n=e.map((e=>e.name)),o=e.map((e=>e.code)),r=e.map((e=>e.config));m({names:n,codes:o,configs:r,layout:t})},t[3]=s,t[4]=I):I=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(A=Ya(),t[5]=A):A=t[5],t[6]!==n.runtime.auto_instantiate||t[7]!==I?(M={autoInstantiate:_,setCells:I,sessionId:A},t[6]=n.runtime.auto_instantiate,t[7]=I,t[8]=M):M=t[8];const{connection:T}=vl(M);let O;t[9]!==T.state||t[10]!==S||t[11]!==u||t[12]!==o.app_title||t[13]!==v?(O=async e=>T.state!==nl.OPEN?(S(),null):(Xa((t=>{null===e?t.delete(Ka.filePath):t.set(Ka.filePath,e)})),Ja({filename:e}).then((()=>(u(e),document.title=o.app_title||pt.basename(e)||"Untitled Notebook",e))).catch((e=>(v(e.message),null)))),t[9]=T.state,t[10]=S,t[11]=u,t[12]=o.app_title,t[13]=v,t[14]=O):O=t[14];const D=W(O);let P,R;t[15]!==o.app_title||t[16]!==d?(P=()=>{document.title=o.app_title||pt.basename(d??"")||"Untitled Notebook"},R=[o.app_title,d],t[15]=o.app_title,t[16]=d,t[17]=P,t[18]=R):(P=t[17],R=t[18]),r.useEffect(P,R);const F=a.cellIds.colLength,L=nr(o.width);let z,B,U,V,G,$;t[19]!==L||t[20]!==o.width||t[21]!==l?(z=()=>{"columns"===L&&"columns"!==o.width&&l()},t[19]=L,t[20]=o.width,t[21]=l,t[22]=z):z=t[22],t[23]!==o.width||t[24]!==L||t[25]!==l||t[26]!==F?(B=[o.width,L,l,F],t[23]=o.width,t[24]=L,t[25]=l,t[26]=F,t[27]=B):B=t[27],r.useEffect(z,B),t[28]!==a?($=Ua(a),G=$.map(Ew),V=$.map(Sw),U=$.map(jw),t[28]=a,t[29]=U,t[30]=V,t[31]=G,t[32]=$):(U=t[29],V=t[30],G=t[31],$=t[32]);const X=U;let K;t[33]!==a?(K=Va(a),t[33]=a,t[34]=K):K=t[34];const Z=K;let ee;t[35]!==a||t[36]!==f||t[37]!==h?(ee=Ga(a,f,h),t[35]=a,t[36]=f,t[37]=h,t[38]=ee):ee=t[38];const te=ee;let ne;t[39]!==C||t[40]!==V||t[41]!==T.state||t[42]!==S||t[43]!==G||t[44]!==X||t[45]!==Z||t[46]!==n.save.format_on_save||t[47]!==i||t[48]!==f?(ne=(e,t)=>{C||0!==V.length&&(T.state===nl.OPEN?(J.log("saving to ",e),Za({cellIds:G,codes:V,names:X,filename:e,configs:Z,layout:bl(),persist:!0}).then((()=>{t&&(re({title:"Notebook saved"}),n.save.format_on_save&&Da(i)),m({names:X,codes:V,configs:Z,layout:f})}))):S())},t[39]=C,t[40]=V,t[41]=T.state,t[42]=S,t[43]=G,t[44]=X,t[45]=Z,t[46]=n.save.format_on_save,t[47]=i,t[48]=f,t[49]=ne):ne=t[49];const oe=W(ne);let ae;t[50]!==d||t[51]!==T.state||t[52]!==oe?(ae=e=>{const t=void 0!==e&&e;null!==d&&T.state===nl.OPEN&&oe(d,t)},t[50]=d,t[51]=T.state,t[52]=oe,t[53]=ae):ae=t[53];const se=W(ae),ie=W((()=>{se(!0),null===d&&T.state!==nl.CLOSED&&p(k.jsx(kw,{onClose:g,onSave:ue}))}));let ce,de;t[54]!==se||t[55]!==te||t[56]!==V||t[57]!==Z||t[58]!==X||t[59]!==T||t[60]!==n||t[61]!==C?(ce={onSave:se,needsSave:te,codes:V,cellConfigs:Z,cellNames:X,connStatus:T,config:n,kioskMode:C},t[54]=se,t[55]=te,t[56]=V,t[57]=Z,t[58]=X,t[59]=T,t[60]=n,t[61]=C,t[62]=ce):ce=t[62],function(e){const t=b(16),{codes:n,cellConfigs:o,config:a,connStatus:s,cellNames:i,needsSave:l,kioskMode:c,onSave:d}=e,u=r.useRef(null);let h,m;t[0]!==c||t[1]!==a.save.autosave||t[2]!==a.save.autosave_delay||t[3]!==l||t[4]!==s.state||t[5]!==d?(h=()=>{if(!c)return"after_delay"===a.save.autosave&&(null!==u.current&&clearTimeout(u.current),l&&s.state===nl.OPEN&&(u.current=setTimeout(d,a.save.autosave_delay))),()=>{null!==u.current&&clearTimeout(u.current)}},t[0]=c,t[1]=a.save.autosave,t[2]=a.save.autosave_delay,t[3]=l,t[4]=s.state,t[5]=d,t[6]=h):h=t[6],t[7]!==n||t[8]!==o||t[9]!==i||t[10]!==a.save||t[11]!==s.state||t[12]!==d||t[13]!==c||t[14]!==l?(m=[n,o,i,a.save,s.state,d,c,l],t[7]=n,t[8]=o,t[9]=i,t[10]=a.save,t[11]=s.state,t[12]=d,t[13]=c,t[14]=l,t[15]=m):m=t[15],r.useEffect(h,m)}(ce),function(){const e=b(4),t=le(Ra),{state:n}=le(tl),o=t.auto_download.includes("markdown"),r=t.auto_download.includes("html"),a=!o||n!==nl.OPEN,s=!r||n!==nl.OPEN;let i,l;e[0]!==a?(i={delayMs:5e3,whenVisible:!0,disabled:a},e[0]=a,e[1]=i):i=e[1],Ui(bw,i),e[2]!==s?(l={delayMs:5e3,whenVisible:!0,disabled:s},e[2]=s,e[3]=l):l=e[3],Ui(yw,l)}(),t[63]!==te?(de=e=>{if(!Qa())return te?(e.preventDefault(),e.returnValue="You have unsaved changes. Are you sure you want to quit?"):void 0},t[63]=te,t[64]=de):de=t[64],Q(window,"beforeunload",de);const ue=e=>{D(e).then((e=>{null!==e&&oe(e,!0)}))},he=function(){const e=b(3),t=H(),n=pd();let o;return e[0]!==n||e[1]!==t?(o=()=>n(Y(t)),e[0]=n,e[1]=t,e[2]=o):o=e[2],W(o)}(),fe=Yd();let pe,ge,ve;t[65]!==he?(pe=()=>{he()},t[65]=he,t[66]=pe):pe=t[66],yi("global.runStale",pe),yi("global.save",ie),yi("global.interrupt",_w),t[67]!==fe?(ge=()=>{fe()},t[67]=fe,t[68]=ge):ge=t[68],yi("global.hideCode",ge),t[69]!==d||t[70]!==$?(ve=()=>JSON.stringify({filename:d,cells:$.map((e=>({name:e.name,code:e.code})))},null,2),t[69]=d,t[70]=$,t[71]=ve):ve=t[71];const xe=W(ve);let ye;t[72]!==a||t[73]!==T||t[74]!==c.mode||t[75]!==n||t[76]!==o?(ye=k.jsx(gw,{notebook:a,connStatus:T,mode:c.mode,userConfig:n,appConfig:o}),t[72]=a,t[73]=T,t[74]=c.mode,t[75]=n,t[76]=o,t[77]=ye):ye=t[77];const be=ye,we=o.width;let ke,Ne,Ce,Ee,Se;t[78]===Symbol.for("react.memo_cache_sentinel")?(ke=on("pt-4 sm:pt-12 pb-2 mb-4 print:hidden z-50","sticky left-0"),t[78]=ke):ke=t[78],t[79]!==x||t[80]!==d||t[81]!==D?(Ne=x&&k.jsx("div",{className:"flex items-center justify-center container",children:k.jsx(Pu,{filename:d,setFilename:D})}),t[79]=x,t[80]=d,t[81]=D,t[82]=Ne):Ne=t[82],t[83]!==T||t[84]!==Ne?(Ce=k.jsx(wl,{connection:T,className:ke,children:Ne}),t[83]=T,t[84]=Ne,t[85]=Ce):Ce=t[85],t[86]!==$.length||t[87]!==o||t[88]!==c||t[89]!==be?(Ee=$.length>0&&k.jsx(xl,{appConfig:o,mode:c.mode,children:be}),t[86]=$.length,t[87]=o,t[88]=c,t[89]=be,t[90]=Ee):Ee=t[90],t[91]!==T||t[92]!==N||t[93]!==o.width||t[94]!==Ce||t[95]!==Ee?(Se=k.jsxs(kl,{connection:T,isRunning:N,width:we,children:[Ce,Ee]}),t[91]=T,t[92]=N,t[93]=o.width,t[94]=Ce,t[95]=Ee,t[96]=Se):Se=t[96];const je=T.state===nl.CLOSED;let _e,Ie,Ae,Me;return t[97]!==a?(_e=$a(a),t[97]=a,t[98]=_e):_e=t[98],t[99]!==a?(Ie=It(a),t[99]=a,t[100]=Ie):Ie=t[100],t[101]!==d||t[102]!==te||t[103]!==ie||t[104]!==xe||t[105]!==y||t[106]!==fe||t[107]!==he||t[108]!==je||t[109]!==N||t[110]!==_e||t[111]!==Ie||t[112]!==o.width?(Ae=k.jsx(_u,{filename:d,needsSave:te,onSaveNotebook:ie,getCellsAsJSON:xe,presenting:y,onTogglePresenting:fe,onInterrupt:ra,onRun:he,closed:je,running:N,needsRun:_e,undoAvailable:Ie,appWidth:o.width}),t[101]=d,t[102]=te,t[103]=ie,t[104]=xe,t[105]=y,t[106]=fe,t[107]=he,t[108]=je,t[109]=N,t[110]=_e,t[111]=Ie,t[112]=o.width,t[113]=Ae):Ae=t[113],t[114]!==Se||t[115]!==Ae?(Me=k.jsxs(k.Fragment,{children:[Se,Ae]}),t[114]=Se,t[115]=Ae,t[116]=Me):Me=t[116],Me},kw=e=>{const t=b(17),{onClose:n,onSave:o}=e,[a,s]=r.useState();let i;t[0]!==o||t[1]!==n?(i=e=>{s(e),e.trim()&&(o(e),n())},t[0]=o,t[1]=n,t[2]=i):i=t[2];const l=i;let c,d,u,h;t[3]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx(j,{children:"Save notebook"}),t[3]=c):c=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(d=k.jsx(Ae,{className:"text-md pt-6 px-1",children:"Save as"}),t[4]=d):d=t[4],t[5]!==l?(u=k.jsxs("div",{className:"flex flex-col",children:[d,k.jsx(Ou,{onNameChange:l,placeholderText:"filename",className:"missing-filename"})]}),t[5]=l,t[6]=u):u=t[6],t[7]!==n?(h=k.jsx(E,{"data-testid":"cancel-save-dialog-button","aria-label":"Cancel",variant:"secondary",onClick:n,children:"Cancel"}),t[7]=n,t[8]=h):h=t[8];const m=!a;let f,p,g;return t[9]!==m?(f=k.jsx(E,{"data-testid":"submit-save-dialog-button","aria-label":"Save",variant:"default",disabled:m,type:"submit",children:"Save"}),t[9]=m,t[10]=f):f=t[10],t[11]!==h||t[12]!==f?(p=k.jsxs(I,{children:[h,f]}),t[11]=h,t[12]=f,t[13]=p):p=t[13],t[14]!==u||t[15]!==p?(g=k.jsxs(A,{children:[c,u,p]}),t[14]=u,t[15]=p,t[16]=g):g=t[16],g};function Nw(){yl.INSTANCE.stop()}function Cw(){return yl.INSTANCE.start(Ha),Nw}function Ew(e){return e.id}function Sw(e){return e.code}function jw(e){return e.name}function _w(){ra()}const{createElement:Iw,createContext:Aw,createRef:Mw,forwardRef:Tw,useCallback:Ow,useContext:Dw,useEffect:Pw,useImperativeHandle:Rw,useLayoutEffect:Fw,useMemo:Lw,useRef:zw,useState:Bw}=es,Uw=es["useId".toString()],Vw=Fw,Gw=Aw(null);Gw.displayName="PanelGroupContext";const $w=Vw,Hw="function"==typeof Uw?Uw:()=>null;let Ww=0;function qw(e=null){const t=Hw(),n=zw(e||t||null);return null===n.current&&(n.current=""+Ww++),null!=e?e:n.current}function Yw({children:e,className:t="",collapsedSize:n,collapsible:o,defaultSize:r,forwardedRef:a,id:s,maxSize:i,minSize:l,onCollapse:c,onExpand:d,onResize:u,order:h,style:m,tagName:f="div",...p}){const g=Dw(Gw);if(null===g)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:v,expandPanel:x,getPanelSize:y,getPanelStyle:b,groupId:w,isPanelCollapsed:k,reevaluatePanelConstraints:N,registerPanel:C,resizePanel:E,unregisterPanel:S}=g,j=qw(s),_=zw({callbacks:{onCollapse:c,onExpand:d,onResize:u},constraints:{collapsedSize:n,collapsible:o,defaultSize:r,maxSize:i,minSize:l},id:j,idIsFromProps:void 0!==s,order:h});zw({didLogMissingDefaultSizeWarning:!1}),$w((()=>{const{callbacks:e,constraints:t}=_.current,a={...t};_.current.id=j,_.current.idIsFromProps=void 0!==s,_.current.order=h,e.onCollapse=c,e.onExpand=d,e.onResize=u,t.collapsedSize=n,t.collapsible=o,t.defaultSize=r,t.maxSize=i,t.minSize=l,a.collapsedSize===t.collapsedSize&&a.collapsible===t.collapsible&&a.maxSize===t.maxSize&&a.minSize===t.minSize||N(_.current,a)})),$w((()=>{const e=_.current;return C(e),()=>{S(e)}}),[h,j,C,S]),Rw(a,(()=>({collapse:()=>{v(_.current)},expand:e=>{x(_.current,e)},getId:()=>j,getSize:()=>y(_.current),isCollapsed:()=>k(_.current),isExpanded:()=>!k(_.current),resize:e=>{E(_.current,e)}})),[v,x,y,k,j,E]);const I=b(_.current,r);return Iw(f,{...p,children:e,className:t,id:s,style:{...I,...m},"data-panel":"","data-panel-collapsible":o||void 0,"data-panel-group-id":w,"data-panel-id":j,"data-panel-size":parseFloat(""+I.flexGrow).toFixed(1)})}const Xw=Tw(((e,t)=>Iw(Yw,{...e,forwardedRef:t})));Yw.displayName="Panel",Xw.displayName="forwardRef(Panel)";let Kw=null,Jw=null;function Zw(e,t){const n=function(e,t){if(t){const e=!!(t&uk),n=!!(t&hk);if(t&ck)return e?"se-resize":n?"ne-resize":"e-resize";if(t&dk)return e?"sw-resize":n?"nw-resize":"w-resize";if(e)return"s-resize";if(n)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}(e,t);Kw!==n&&(Kw=n,null===Jw&&(Jw=document.createElement("style"),document.head.appendChild(Jw)),Jw.innerHTML=`*{cursor: ${n}!important;}`)}function Qw(e){return"keydown"===e.type}function ek(e){return e.type.startsWith("pointer")}function tk(e){return e.type.startsWith("mouse")}function nk(e){if(ek(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(tk(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}const ok=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function rk(e){const t=getComputedStyle(e);return"fixed"===t.position||(!("auto"===t.zIndex||"static"===t.position&&!function(e){var t;const n=getComputedStyle(null!==(t=lk(e))&&void 0!==t?t:e).display;return"flex"===n||"inline-flex"===n}(e))||(+t.opacity<1||("transform"in t&&"none"!==t.transform||("webkitTransform"in t&&"none"!==t.webkitTransform||("mixBlendMode"in t&&"normal"!==t.mixBlendMode||("filter"in t&&"none"!==t.filter||("webkitFilter"in t&&"none"!==t.webkitFilter||("isolation"in t&&"isolate"===t.isolation||(!!ok.test(t.willChange)||"touch"===t.webkitOverflowScrolling)))))))))}function ak(e){let t=e.length;for(;t--;){const n=e[t];if(jk(n,"Missing node"),rk(n))return n}return null}function sk(e){return e&&Number(getComputedStyle(e).zIndex)||0}function ik(e){const t=[];for(;e;)t.push(e),e=lk(e);return t}function lk(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const ck=1,dk=2,uk=4,hk=8,mk="coarse"===function(){if("function"==typeof matchMedia)return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}();let fk=[],pk=!1,gk=new Map,vk=new Map;const xk=new Set;function yk(e){const{target:t}=e,{x:n,y:o}=nk(e);pk=!0,kk({target:t,x:n,y:o}),Ek(),fk.length>0&&(Sk("down",e),e.preventDefault(),e.stopPropagation())}function bk(e){const{x:t,y:n}=nk(e);if(!pk){const{target:o}=e;kk({target:o,x:t,y:n})}Sk("move",e),Ck(),fk.length>0&&e.preventDefault()}function wk(e){const{target:t}=e,{x:n,y:o}=nk(e);vk.clear(),pk=!1,fk.length>0&&e.preventDefault(),Sk("up",e),kk({target:t,x:n,y:o}),Ck(),Ek()}function kk({target:e,x:t,y:n}){fk.splice(0);let o=null;e instanceof HTMLElement&&(o=e),xk.forEach((e=>{const{element:r,hitAreaMargins:a}=e,s=r.getBoundingClientRect(),{bottom:i,left:l,right:c,top:d}=s,u=mk?a.coarse:a.fine;if(t>=l-u&&t<=c+u&&n>=d-u&&n<=i+u){if(null!==o&&r!==o&&!r.contains(o)&&!o.contains(r)&&function(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:ik(e),b:ik(t)};let o;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),o=e;jk(o,"Stacking order can only be calculated for elements with a common ancestor");const r=sk(ak(n.a)),a=sk(ak(n.b));if(r===a){const e=o.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)};let r=e.length;for(;r--;){const n=e[r];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(r-a)}(o,r)>0){let e=o,t=!1;for(;e&&!e.contains(r);){if(h=e.getBoundingClientRect(),m=s,h.x<m.x+m.width&&h.x+h.width>m.x&&h.y<m.y+m.height&&h.y+h.height>m.y){t=!0;break}e=e.parentElement}if(t)return}fk.push(e)}var h,m}))}function Nk(e,t){vk.set(e,t)}function Ck(){let e=!1,t=!1;fk.forEach((n=>{const{direction:o}=n;"horizontal"===o?e=!0:t=!0}));let n=0;vk.forEach((e=>{n|=e})),e&&t?Zw("intersection",n):e?Zw("horizontal",n):t?Zw("vertical",n):null!==Jw&&(document.head.removeChild(Jw),Kw=null,Jw=null)}function Ek(){gk.forEach(((e,t)=>{const{body:n}=t;n.removeEventListener("contextmenu",wk),n.removeEventListener("pointerdown",yk),n.removeEventListener("pointerleave",bk),n.removeEventListener("pointermove",bk)})),window.removeEventListener("pointerup",wk),window.removeEventListener("pointercancel",wk),xk.size>0&&(pk?(fk.length>0&&gk.forEach(((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("contextmenu",wk),n.addEventListener("pointerleave",bk),n.addEventListener("pointermove",bk))})),window.addEventListener("pointerup",wk),window.addEventListener("pointercancel",wk)):gk.forEach(((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("pointerdown",yk,{capture:!0}),n.addEventListener("pointermove",bk))})))}function Sk(e,t){xk.forEach((n=>{const{setResizeHandlerState:o}=n,r=fk.includes(n);o(e,r,t)}))}function jk(e,t){if(!e)throw console.error(t),Error(t)}function _k(e,t,n=10){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function Ik(e,t,n=10){return 0===_k(e,t,n)}function Ak(e,t,n){return 0===_k(e,t,n)}function Mk({panelConstraints:e,panelIndex:t,size:n}){const o=e[t];jk(null!=o,`Panel constraints not found for index ${t}`);let{collapsedSize:r=0,collapsible:a,maxSize:s=100,minSize:i=0}=o;if(_k(n,i)<0)if(a){n=_k(n,(r+i)/2)<0?r:i}else n=i;return n=Math.min(s,n),n=parseFloat(n.toFixed(10))}function Tk({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:o,prevLayout:r,trigger:a}){if(Ak(e,0))return t;const s=[...t],[i,l]=o;jk(null!=i,"Invalid first pivot index"),jk(null!=l,"Invalid second pivot index");let c=0;if("keyboard"===a){{const o=e<0?l:i,r=n[o];jk(r,`Panel constraints not found for index ${o}`);const{collapsedSize:a=0,collapsible:s,minSize:c=0}=r;if(s){const n=t[o];if(jk(null!=n,`Previous layout not found for panel index ${o}`),Ak(n,a)){const t=c-n;_k(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{const o=e<0?i:l,r=n[o];jk(r,`No panel constraints found for index ${o}`);const{collapsedSize:a=0,collapsible:s,minSize:c=0}=r;if(s){const n=t[o];if(jk(null!=n,`Previous layout not found for panel index ${o}`),Ak(n,c)){const t=n-a;_k(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}{const o=e<0?1:-1;let r=e<0?l:i,a=0;for(;;){const e=t[r];jk(null!=e,`Previous layout not found for panel index ${r}`);if(a+=Mk({panelConstraints:n,panelIndex:r,size:100})-e,r+=o,r<0||r>=n.length)break}const s=Math.min(Math.abs(e),Math.abs(a));e=e<0?0-s:s}{let o=e<0?i:l;for(;o>=0&&o<n.length;){const r=Math.abs(e)-Math.abs(c),a=t[o];jk(null!=a,`Previous layout not found for panel index ${o}`);const i=Mk({panelConstraints:n,panelIndex:o,size:a-r});if(!Ak(a,i)&&(c+=a-i,s[o]=i,c.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?o--:o++}}if(function(e,t,n){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(!Ak(e[o],t[o],n))return!1;return!0}(r,s))return r;{const o=e<0?l:i,r=t[o];jk(null!=r,`Previous layout not found for panel index ${o}`);const a=r+c,d=Mk({panelConstraints:n,panelIndex:o,size:a});if(s[o]=d,!Ak(d,a)){let t=a-d;let o=e<0?l:i;for(;o>=0&&o<n.length;){const r=s[o];jk(null!=r,`Previous layout not found for panel index ${o}`);const a=Mk({panelConstraints:n,panelIndex:o,size:r+t});if(Ak(r,a)||(t-=a-r,s[o]=a),Ak(t,0))break;e>0?o--:o++}}}return Ak(s.reduce(((e,t)=>t+e),0),100)?s:r}function Ok({layout:e,panelsArray:t,pivotIndices:n}){let o=0,r=100,a=0,s=0;const i=n[0];jk(null!=i,"No pivot index found"),t.forEach(((e,t)=>{const{constraints:n}=e,{maxSize:l=100,minSize:c=0}=n;t===i?(o=c,r=l):(a+=c,s+=l)}));return{valueMax:Math.min(r,100-a),valueMin:Math.max(o,100-s),valueNow:e[i]}}function Dk(e,t=document){return Array.from(t.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function Pk(e,t,n=document){const o=Dk(e,n).findIndex((e=>e.getAttribute("data-panel-resize-handle-id")===t));return null!=o?o:null}function Rk(e,t,n){const o=Pk(e,t,n);return null!=o?[o,o+1]:[-1,-1]}function Fk(e,t=document){var n;if(t instanceof HTMLElement&&(null==t||null===(n=t.dataset)||void 0===n?void 0:n.panelGroupId)==e)return t;const o=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return o||null}function Lk(e,t=document){const n=t.querySelector(`[data-panel-resize-handle-id="${e}"]`);return n||null}function zk({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:o,panelDataArray:r,panelGroupElement:a,setLayout:s}){zw({didWarnAboutMissingResizeHandle:!1}),$w((()=>{if(!a)return;const e=Dk(n,a);for(let t=0;t<r.length-1;t++){const{valueMax:n,valueMin:a,valueNow:s}=Ok({layout:o,panelsArray:r,pivotIndices:[t,t+1]}),i=e[t];if(null==i);else{const e=r[t];jk(e,`No panel data found for index "${t}"`),i.setAttribute("aria-controls",e.id),i.setAttribute("aria-valuemax",""+Math.round(n)),i.setAttribute("aria-valuemin",""+Math.round(a)),i.setAttribute("aria-valuenow",null!=s?""+Math.round(s):"")}}return()=>{e.forEach(((e,t)=>{e.removeAttribute("aria-controls"),e.removeAttribute("aria-valuemax"),e.removeAttribute("aria-valuemin"),e.removeAttribute("aria-valuenow")}))}}),[n,o,r,a]),Pw((()=>{if(!a)return;const e=t.current;jk(e,"Eager values not found");const{panelDataArray:r}=e;jk(null!=Fk(n,a),`No group found for id "${n}"`);const i=Dk(n,a);jk(i,`No resize handles found for group id "${n}"`);const l=i.map((e=>{const t=e.getAttribute("data-panel-resize-handle-id");jk(t,"Resize handle element has no handle id attribute");const[i,l]=function(e,t,n,o=document){var r,a,s,i;const l=Lk(t,o),c=Dk(e,o),d=l?c.indexOf(l):-1;return[null!==(r=null===(a=n[d])||void 0===a?void 0:a.id)&&void 0!==r?r:null,null!==(s=null===(i=n[d+1])||void 0===i?void 0:i.id)&&void 0!==s?s:null]}(n,t,r,a);if(null==i||null==l)return()=>{};const c=e=>{if(!e.defaultPrevented)switch(e.key){case"Enter":{e.preventDefault();const l=r.findIndex((e=>e.id===i));if(l>=0){const e=r[l];jk(e,`No panel data found for index ${l}`);const i=o[l],{collapsedSize:c=0,collapsible:d,minSize:u=0}=e.constraints;if(null!=i&&d){const e=Tk({delta:Ak(i,c)?u-c:c-i,initialLayout:o,panelConstraints:r.map((e=>e.constraints)),pivotIndices:Rk(n,t,a),prevLayout:o,trigger:"keyboard"});o!==e&&s(e)}}break}}};return e.addEventListener("keydown",c),()=>{e.removeEventListener("keydown",c)}}));return()=>{l.forEach((e=>e()))}}),[a,e,t,n,o,r,s])}function Bk(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Uk(e,t){const n="horizontal"===e,{x:o,y:r}=nk(t);return n?o:r}function Vk(e,t,n,o,r,a){if(Qw(e)){const t="horizontal"===n;let o=0;o=e.shiftKey?100:null!=r?r:10;let a=0;switch(e.key){case"ArrowDown":a=t?0:o;break;case"ArrowLeft":a=t?-o:0;break;case"ArrowRight":a=t?o:0;break;case"ArrowUp":a=t?0:-o;break;case"End":a=100;break;case"Home":a=-100}return a}return null==o?0:function(e,t,n,o,r){const a="horizontal"===n,s=Lk(t,r);jk(s,`No resize handle element found for id "${t}"`);const i=s.getAttribute("data-panel-group-id");jk(i,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=o;const c=Uk(n,e),d=Fk(i,r);jk(d,`No group element found for id "${i}"`);const u=d.getBoundingClientRect();return(c-l)/(a?u.width:u.height)*100}(e,t,n,o,a)}function Gk(e,t,n){t.forEach(((t,o)=>{const r=e[o];jk(r,`Panel data not found for index ${o}`);const{callbacks:a,constraints:s,id:i}=r,{collapsedSize:l=0,collapsible:c}=s,d=n[i];if(null==d||t!==d){n[i]=t;const{onCollapse:e,onExpand:o,onResize:r}=a;r&&r(t,d),c&&(e||o)&&(!o||null!=d&&!Ik(d,l)||Ik(t,l)||o(),!e||null!=d&&Ik(d,l)||!Ik(t,l)||e())}}))}function $k(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Hk(e){try{if("undefined"==typeof localStorage)throw new Error("localStorage not supported in this environment");e.getItem=e=>localStorage.getItem(e),e.setItem=(e,t)=>{localStorage.setItem(e,t)}}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function Wk(e){return`react-resizable-panels:${e}`}function qk(e){return e.map((e=>{const{constraints:t,id:n,idIsFromProps:o,order:r}=e;return o?n:r?`${r}:${JSON.stringify(t)}`:JSON.stringify(t)})).sort(((e,t)=>e.localeCompare(t))).join(",")}function Yk(e,t){try{const n=Wk(e),o=t.getItem(n);if(o){const e=JSON.parse(o);if("object"==typeof e&&null!=e)return e}}catch(n){}return null}function Xk(e,t,n,o,r){var a;const s=Wk(e),i=qk(t),l=null!==(a=Yk(e,r))&&void 0!==a?a:{};l[i]={expandToSizes:Object.fromEntries(n.entries()),layout:o};try{r.setItem(s,JSON.stringify(l))}catch(c){console.error(c)}}function Kk({layout:e,panelConstraints:t}){const n=[...e],o=n.reduce(((e,t)=>e+t),0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map((e=>`${e}%`)).join(", ")}`);if(!Ak(o,100))for(let a=0;a<t.length;a++){const e=n[a];jk(null!=e,`No layout data found for index ${a}`);const t=100/o*e;n[a]=t}let r=0;for(let a=0;a<t.length;a++){const e=n[a];jk(null!=e,`No layout data found for index ${a}`);const o=Mk({panelConstraints:t,panelIndex:a,size:e});e!=o&&(r+=e-o,n[a]=o)}if(!Ak(r,0))for(let a=0;a<t.length;a++){const e=n[a];jk(null!=e,`No layout data found for index ${a}`);const o=Mk({panelConstraints:t,panelIndex:a,size:e+r});if(e!==o&&(r-=o-e,n[a]=o,Ak(r,0)))break}return n}const Jk={getItem:e=>(Hk(Jk),Jk.getItem(e)),setItem:(e,t)=>{Hk(Jk),Jk.setItem(e,t)}},Zk={};function Qk({autoSaveId:e=null,children:t,className:n="",direction:o,forwardedRef:r,id:a=null,onLayout:s=null,keyboardResizeBy:i=null,storage:l=Jk,style:c,tagName:d="div",...u}){const h=qw(a),m=zw(null),[f,p]=Bw(null),[g,v]=Bw([]),x=zw({}),y=zw(new Map),b=zw(0),w=zw({autoSaveId:e,direction:o,dragState:f,id:h,keyboardResizeBy:i,onLayout:s,storage:l}),k=zw({layout:g,panelDataArray:[],panelDataArrayChanged:!1});zw({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),Rw(r,(()=>({getId:()=>w.current.id,getLayout:()=>{const{layout:e}=k.current;return e},setLayout:e=>{const{onLayout:t}=w.current,{layout:n,panelDataArray:o}=k.current,r=Kk({layout:e,panelConstraints:o.map((e=>e.constraints))});Bk(n,r)||(v(r),k.current.layout=r,t&&t(r),Gk(o,r,x.current))}})),[]),$w((()=>{w.current.autoSaveId=e,w.current.direction=o,w.current.dragState=f,w.current.id=h,w.current.onLayout=s,w.current.storage=l})),zk({committedValuesRef:w,eagerValuesRef:k,groupId:h,layout:g,panelDataArray:k.current.panelDataArray,setLayout:v,panelGroupElement:m.current}),Pw((()=>{const{panelDataArray:t}=k.current;if(e){if(0===g.length||g.length!==t.length)return;let n=Zk[e];null==n&&(n=function(e,t=10){let n=null;return(...o)=>{null!==n&&clearTimeout(n),n=setTimeout((()=>{e(...o)}),t)}}(Xk,100),Zk[e]=n);const o=[...t],r=new Map(y.current);n(e,o,r,g,l)}}),[e,g,l]),Pw((()=>{}));const N=Ow((e=>{const{onLayout:t}=w.current,{layout:n,panelDataArray:o}=k.current;if(e.constraints.collapsible){const r=o.map((e=>e.constraints)),{collapsedSize:a=0,panelSize:s,pivotIndices:i}=nN(o,e,n);if(jk(null!=s,`Panel size not found for panel "${e.id}"`),!Ik(s,a)){y.current.set(e.id,s);const l=Tk({delta:tN(o,e)===o.length-1?s-a:a-s,initialLayout:n,panelConstraints:r,pivotIndices:i,prevLayout:n,trigger:"imperative-api"});$k(n,l)||(v(l),k.current.layout=l,t&&t(l),Gk(o,l,x.current))}}}),[]),C=Ow(((e,t)=>{const{onLayout:n}=w.current,{layout:o,panelDataArray:r}=k.current;if(e.constraints.collapsible){const a=r.map((e=>e.constraints)),{collapsedSize:s=0,panelSize:i=0,minSize:l=0,pivotIndices:c}=nN(r,e,o),d=null!=t?t:l;if(Ik(i,s)){const t=y.current.get(e.id),s=null!=t&&t>=d?t:d,l=Tk({delta:tN(r,e)===r.length-1?i-s:s-i,initialLayout:o,panelConstraints:a,pivotIndices:c,prevLayout:o,trigger:"imperative-api"});$k(o,l)||(v(l),k.current.layout=l,n&&n(l),Gk(r,l,x.current))}}}),[]),E=Ow((e=>{const{layout:t,panelDataArray:n}=k.current,{panelSize:o}=nN(n,e,t);return jk(null!=o,`Panel size not found for panel "${e.id}"`),o}),[]),S=Ow(((e,t)=>{const{panelDataArray:n}=k.current,o=tN(n,e);return function({defaultSize:e,dragState:t,layout:n,panelData:o,panelIndex:r,precision:a=3}){const s=n[r];let i;return i=null==s?null!=e?e.toPrecision(a):"1":1===o.length?"1":s.toPrecision(a),{flexBasis:0,flexGrow:i,flexShrink:1,overflow:"hidden",pointerEvents:null!==t?"none":void 0}}({defaultSize:t,dragState:f,layout:g,panelData:n,panelIndex:o})}),[f,g]),j=Ow((e=>{const{layout:t,panelDataArray:n}=k.current,{collapsedSize:o=0,collapsible:r,panelSize:a}=nN(n,e,t);return jk(null!=a,`Panel size not found for panel "${e.id}"`),!0===r&&Ik(a,o)}),[]),_=Ow((e=>{const{layout:t,panelDataArray:n}=k.current,{collapsedSize:o=0,collapsible:r,panelSize:a}=nN(n,e,t);return jk(null!=a,`Panel size not found for panel "${e.id}"`),!r||_k(a,o)>0}),[]),I=Ow((e=>{const{panelDataArray:t}=k.current;t.push(e),t.sort(((e,t)=>{const n=e.order,o=t.order;return null==n&&null==o?0:null==n?-1:null==o?1:n-o})),k.current.panelDataArrayChanged=!0}),[]);$w((()=>{if(k.current.panelDataArrayChanged){k.current.panelDataArrayChanged=!1;const{autoSaveId:e,onLayout:t,storage:n}=w.current,{layout:o,panelDataArray:r}=k.current;let a=null;if(e){const t=function(e,t,n){var o,r;return null!==(r=(null!==(o=Yk(e,n))&&void 0!==o?o:{})[qk(t)])&&void 0!==r?r:null}(e,r,n);t&&(y.current=new Map(Object.entries(t.expandToSizes)),a=t.layout)}null==a&&(a=function({panelDataArray:e}){const t=Array(e.length),n=e.map((e=>e.constraints));let o=0,r=100;for(let a=0;a<e.length;a++){const e=n[a];jk(e,`Panel constraints not found for index ${a}`);const{defaultSize:s}=e;null!=s&&(o++,t[a]=s,r-=s)}for(let a=0;a<e.length;a++){const s=n[a];jk(s,`Panel constraints not found for index ${a}`);const{defaultSize:i}=s;if(null!=i)continue;const l=r/(e.length-o);o++,t[a]=l,r-=l}return t}({panelDataArray:r}));const s=Kk({layout:a,panelConstraints:r.map((e=>e.constraints))});Bk(o,s)||(v(s),k.current.layout=s,t&&t(s),Gk(r,s,x.current))}})),$w((()=>{const e=k.current;return()=>{e.layout=[]}}),[]);const A=Ow((e=>function(t){t.preventDefault();const n=m.current;if(!n)return()=>null;const{direction:o,dragState:r,id:a,keyboardResizeBy:s,onLayout:i}=w.current,{layout:l,panelDataArray:c}=k.current,{initialLayout:d}=null!=r?r:{},u=Rk(a,e,n);let h=Vk(t,e,o,r,s,n);if(0===h)return;const f="horizontal"===o;"rtl"===document.dir&&f&&(h=-h);const p=Tk({delta:h,initialLayout:null!=d?d:l,panelConstraints:c.map((e=>e.constraints)),pivotIndices:u,prevLayout:l,trigger:Qw(t)?"keyboard":"mouse-or-touch"}),g=!$k(l,p);(ek(t)||tk(t))&&b.current!=h&&(b.current=h,Nk(e,g?0:f?h<0?ck:dk:h<0?uk:hk)),g&&(v(p),k.current.layout=p,i&&i(p),Gk(c,p,x.current))}),[]),M=Ow(((e,t)=>{const{onLayout:n}=w.current,{layout:o,panelDataArray:r}=k.current,a=r.map((e=>e.constraints)),{panelSize:s,pivotIndices:i}=nN(r,e,o);jk(null!=s,`Panel size not found for panel "${e.id}"`);const l=Tk({delta:tN(r,e)===r.length-1?s-t:t-s,initialLayout:o,panelConstraints:a,pivotIndices:i,prevLayout:o,trigger:"imperative-api"});$k(o,l)||(v(l),k.current.layout=l,n&&n(l),Gk(r,l,x.current))}),[]),T=Ow(((e,t)=>{const{layout:n,panelDataArray:o}=k.current,{collapsedSize:r=0,collapsible:a}=t,{collapsedSize:s=0,collapsible:i,maxSize:l=100,minSize:c=0}=e.constraints,{panelSize:d}=nN(o,e,n);null!=d&&(a&&i&&Ik(d,r)?Ik(r,s)||M(e,s):d<c?M(e,c):d>l&&M(e,l))}),[M]),O=Ow(((e,t)=>{const{direction:n}=w.current,{layout:o}=k.current;if(!m.current)return;const r=Lk(e,m.current);jk(r,`Drag handle element not found for id "${e}"`);const a=Uk(n,t);p({dragHandleId:e,dragHandleRect:r.getBoundingClientRect(),initialCursorPosition:a,initialLayout:o})}),[]),D=Ow((()=>{p(null)}),[]),P=Ow((e=>{const{panelDataArray:t}=k.current,n=tN(t,e);n>=0&&(t.splice(n,1),delete x.current[e.id],k.current.panelDataArrayChanged=!0)}),[]),R=Lw((()=>({collapsePanel:N,direction:o,dragState:f,expandPanel:C,getPanelSize:E,getPanelStyle:S,groupId:h,isPanelCollapsed:j,isPanelExpanded:_,reevaluatePanelConstraints:T,registerPanel:I,registerResizeHandle:A,resizePanel:M,startDragging:O,stopDragging:D,unregisterPanel:P,panelGroupElement:m.current})),[N,f,o,C,E,S,h,j,_,T,I,A,M,O,D,P]),F={display:"flex",flexDirection:"horizontal"===o?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return Iw(Gw.Provider,{value:R},Iw(d,{...u,children:t,className:n,id:a,ref:m,style:{...F,...c},"data-panel-group":"","data-panel-group-direction":o,"data-panel-group-id":h}))}const eN=Tw(((e,t)=>Iw(Qk,{...e,forwardedRef:t})));function tN(e,t){return e.findIndex((e=>e===t||e.id===t.id))}function nN(e,t,n){const o=tN(e,t),r=o===e.length-1?[o-1,o]:[o,o+1],a=n[o];return{...t.constraints,panelSize:a,pivotIndices:r}}function oN({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:o,id:r,onDragging:a,style:s={},tabIndex:i=0,tagName:l="div",...c}){var d,u;const h=zw(null),m=zw({onDragging:a});Pw((()=>{m.current.onDragging=a}));const f=Dw(Gw);if(null===f)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:p,groupId:g,registerResizeHandle:v,startDragging:x,stopDragging:y,panelGroupElement:b}=f,w=qw(r),[k,N]=Bw("inactive"),[C,E]=Bw(!1),[S,j]=Bw(null),_=zw({state:k});$w((()=>{_.current.state=k})),Pw((()=>{if(n)j(null);else{const e=v(w);j((()=>e))}}),[n,w,v]);const I=null!==(d=null==o?void 0:o.coarse)&&void 0!==d?d:15,A=null!==(u=null==o?void 0:o.fine)&&void 0!==u?u:5;Pw((()=>{if(n||null==S)return;const e=h.current;jk(e,"Element ref not attached");return function(e,t,n,o,r){var a;const{ownerDocument:s}=t,i={direction:n,element:t,hitAreaMargins:o,setResizeHandlerState:r},l=null!==(a=gk.get(s))&&void 0!==a?a:0;return gk.set(s,l+1),xk.add(i),Ek(),function(){var t;vk.delete(e),xk.delete(i);const n=null!==(t=gk.get(s))&&void 0!==t?t:1;gk.set(s,n-1),Ek(),1===n&&gk.delete(s)}}(w,e,p,{coarse:I,fine:A},((e,t,n)=>{if(t)switch(e){case"down":{N("drag"),x(w,n);const{onDragging:e}=m.current;e&&e(!0);break}case"move":{const{state:e}=_.current;"drag"!==e&&N("hover"),S(n);break}case"up":{N("hover"),y();const{onDragging:e}=m.current;e&&e(!1);break}}else N("inactive")}))}),[I,p,n,A,v,w,S,x,y]),function({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:o}){Pw((()=>{if(e||null==n||null==o)return;const r=Lk(t,o);if(null==r)return;const a=e=>{if(!e.defaultPrevented)switch(e.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":e.preventDefault(),n(e);break;case"F6":{e.preventDefault();const n=r.getAttribute("data-panel-group-id");jk(n,`No group element found for id "${n}"`);const a=Dk(n,o),s=Pk(n,t,o);jk(null!==s,`No resize element found for id "${t}"`),a[e.shiftKey?s>0?s-1:a.length-1:s+1<a.length?s+1:0].focus();break}}};return r.addEventListener("keydown",a),()=>{r.removeEventListener("keydown",a)}}),[o,e,t,n])}({disabled:n,handleId:w,resizeHandler:S,panelGroupElement:b});return Iw(l,{...c,children:e,className:t,id:r,onBlur:()=>E(!1),onFocus:()=>E(!0),ref:h,role:"separator",style:{touchAction:"none",userSelect:"none",...s},tabIndex:i,"data-panel-group-direction":p,"data-panel-group-id":g,"data-resize-handle":"","data-resize-handle-active":"drag"===k?"pointer":C?"keyboard":void 0,"data-resize-handle-state":k,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":w})}Qk.displayName="PanelGroup",eN.displayName="forwardRef(PanelGroup)",oN.displayName="PanelResizeHandle";const rN=e=>{const t=b(3);let n,o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=k.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"}),t[0]=n):n=t[0],t[1]!==e?(o=k.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.24em",height:"1em",viewBox:"0 0 256 208",fill:"currentColor",...e,children:n}),t[1]=e,t[2]=o):o=t[2],o},aN=e=>{const t=b(17);let n,o,r,a,s;t[0]!==e?(({children:a,tooltip:s,selected:n,className:o,...r}=e),t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=a,t[5]=s):(n=t[1],o=t[2],r=t[3],a=t[4],s=t[5]);const i=!n&&"hover:bg-[var(--sage-3)]",l=n&&"bg-[var(--sage-4)]";let c,d;t[6]!==i||t[7]!==l||t[8]!==o?(c=on("h-full flex items-center p-2 text-sm shadow-inset font-mono cursor-pointer rounded",i,l,o),t[6]=i,t[7]=l,t[8]=o,t[9]=c):c=t[9],t[10]!==c||t[11]!==r||t[12]!==a?(d=k.jsx("div",{className:c,...r,children:a}),t[10]=c,t[11]=r,t[12]=a,t[13]=d):d=t[13];const u=d;if(s){let e;return t[14]!==s||t[15]!==u?(e=k.jsx(C,{content:s,side:"top",delayDuration:200,children:u}),t[14]=s,t[15]=u,t[16]=e):e=t[16],e}return u},sN=()=>{var e;const t=b(10),n=le(lN),o=le(de),r=(null==(e=null==n?void 0:n.open_ai)?void 0:e.model)||"gpt-4-turbo",{handleClick:a}=cN();if(!o){let e,n;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx(Oc,{className:"h-4 w-4 opacity-60"}),t[0]=e):e=t[0],t[1]!==a?(n=k.jsx(aN,{tooltip:"Assist is disabled",selected:!1,onClick:a,children:e}),t[1]=a,t[2]=n):n=t[2],n}let s,i,l,c;return t[3]===Symbol.for("react.memo_cache_sentinel")?(s=k.jsx("b",{children:"Assist model:"}),t[3]=s):s=t[3],t[4]!==r?(i=k.jsxs(k.Fragment,{children:[s," ",r]}),t[4]=r,t[5]=i):i=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(l=k.jsx(Oc,{className:"h-4 w-4"}),t[6]=l):l=t[6],t[7]!==i||t[8]!==a?(c=k.jsx(aN,{tooltip:i,onClick:a,selected:!1,children:l}),t[7]=i,t[8]=a,t[9]=c):c=t[9],c},iN=Z((e=>e(ts).completion.copilot)),lN=Z((e=>e(ts).ai));function cN(){const e=b(5),t=ce(Vi),n=ce(ji);let o;e[0]!==t||e[1]!==n?(o=()=>{t("ai"),n(!0)},e[0]=t,e[1]=n,e[2]=o):o=e[2];const r=o;let a;return e[3]!==r?(a={handleClick:r},e[3]=r,e[4]=a):a=e[4],a}const dN=()=>{const e=b(1);if("github"===le(iN)){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=k.jsx(uN,{}),e[0]=t):t=e[0],t}return null},uN=()=>{const e=b(10),t=le(Gi),n=null!==le($i),{handleClick:o}=cN(),r=t?"Ready":"Not connected";let a,s,i,l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=k.jsx("b",{children:"GitHub Copilot:"}),e[0]=a):a=e[0],e[1]!==r?(s=k.jsxs(k.Fragment,{children:[a," ",r]}),e[1]=r,e[2]=s):s=e[2],e[3]!==n||e[4]!==t?(i=k.jsx("span",{children:n?k.jsx(ns,{className:"h-4 w-4"}):k.jsx(rN,{className:on("h-4 w-4",!t&&"opacity-60")})}),e[3]=n,e[4]=t,e[5]=i):i=e[5],e[6]!==s||e[7]!==o||e[8]!==i?(l=k.jsx(aN,{tooltip:s,selected:!1,onClick:o,children:i}),e[6]=s,e[7]=o,e[8]=i,e[9]=l):l=e[9],l},hN=e=>{const t=b(18),[n,o]=r.useState(0),a=le(tl);let s,i,l,c;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>o((e=>e+1)),i={delayMs:1e4,whenVisible:!0},t[0]=s,t[1]=i):(s=t[0],i=t[1]),Ui(s,i),t[2]!==a.state?(l=async()=>D()||a.state!==nl.OPEN?null:os(),t[2]=a.state,t[3]=l):l=t[3],t[4]!==n||t[5]!==a.state?(c=[n,a.state],t[4]=n,t[5]=a.state,t[6]=c):c=t[6];const{data:d}=an(l,c);let u,h,m,f,p;return t[7]!==d?(u=d&&k.jsx(fN,{memory:d.memory,kernel:d.kernel,server:d.server}),t[7]=d,t[8]=u):u=t[8],t[9]!==d?(h=d&&k.jsx(pN,{cpu:d.cpu}),t[9]=d,t[10]=h):h=t[10],t[11]===Symbol.for("react.memo_cache_sentinel")?(m=k.jsxs("div",{className:"flex items-center",children:[k.jsx(sN,{}),k.jsx(dN,{})]}),t[11]=m):m=t[11],t[12]!==a.state?(f=k.jsx(mN,{connection:a.state}),t[12]=a.state,t[13]=f):f=t[13],t[14]!==u||t[15]!==h||t[16]!==f?(p=k.jsxs("div",{className:"flex gap-2 items-center",children:[u,h,m,f]}),t[14]=u,t[15]=h,t[16]=f,t[17]=p):p=t[17],p},mN=e=>{const t=b(18),{connection:n}=e;let o,r,a,s,i,l,c;return t[0]!==n?(o=O(n.toLowerCase()),t[0]=n,t[1]=o):o=t[1],t[2]!==n?(r=n===nl.OPEN&&k.jsx($l,{className:"w-4 h-4"}),t[2]=n,t[3]=r):r=t[3],t[4]!==n?(a=n===nl.CLOSED&&k.jsx(Hi,{className:"w-4 h-4"}),t[4]=n,t[5]=a):a=t[5],t[6]!==n?(s=n===nl.CONNECTING&&k.jsx(ns,{size:"small"}),t[6]=n,t[7]=s):s=t[7],t[8]!==n?(i=n===nl.CLOSING&&k.jsx(ns,{className:"text-destructive",size:"small"}),t[8]=n,t[9]=i):i=t[9],t[10]!==r||t[11]!==a||t[12]!==s||t[13]!==i?(l=k.jsxs("div",{children:[r,a,s,i]}),t[10]=r,t[11]=a,t[12]=s,t[13]=i,t[14]=l):l=t[14],t[15]!==o||t[16]!==l?(c=k.jsx(C,{delayDuration:200,content:o,children:l}),t[15]=o,t[16]=l,t[17]=c):c=t[17],c},fN=e=>{const t=b(25),{memory:n,kernel:o,server:r}=e,{percent:a,total:s,used:i}=n;let l;t[0]!==a?(l=Math.round(a),t[0]=a,t[1]=l):l=t[1];const c=l;let d,u,h,m,f,p,g,v,x,y;return t[2]===Symbol.for("react.memo_cache_sentinel")?(d=k.jsx("b",{children:"computer memory:"}),t[2]=d):d=t[2],t[3]!==i?(u=xN(i),t[3]=i,t[4]=u):u=t[4],t[5]!==s?(h=xN(s),t[5]=s,t[6]=h):h=t[6],t[7]!==u||t[8]!==h||t[9]!==c?(m=k.jsxs("span",{children:[d," ",u," / ",h," GB (",c,"%)"]}),t[7]=u,t[8]=h,t[9]=c,t[10]=m):m=t[10],t[11]!==(null==r?void 0:r.memory)?(f=(null==r?void 0:r.memory)&&k.jsxs("span",{children:[k.jsx("b",{children:"marimo server:"})," ",vN(r.memory)]}),t[11]=null==r?void 0:r.memory,t[12]=f):f=t[12],t[13]!==(null==o?void 0:o.memory)?(p=(null==o?void 0:o.memory)&&k.jsxs("span",{children:[k.jsx("b",{children:"kernel:"})," ",vN(o.memory)]}),t[13]=null==o?void 0:o.memory,t[14]=p):p=t[14],t[15]!==m||t[16]!==f||t[17]!==p?(g=k.jsxs("div",{className:"flex flex-col gap-1",children:[m,f,p]}),t[15]=m,t[16]=f,t[17]=p,t[18]=g):g=t[18],t[19]===Symbol.for("react.memo_cache_sentinel")?(v=k.jsx(fc,{className:"w-4 h-4"}),t[19]=v):v=t[19],t[20]!==c?(x=k.jsxs("div",{className:"flex items-center gap-1",children:[v,k.jsx(gN,{percent:c})]}),t[20]=c,t[21]=x):x=t[21],t[22]!==g||t[23]!==x?(y=k.jsx(C,{delayDuration:200,content:g,children:x}),t[22]=g,t[23]=x,t[24]=y):y=t[24],y},pN=e=>{const t=b(11),{cpu:n}=e,{percent:o}=n;let r;t[0]!==o?(r=Math.round(o),t[0]=o,t[1]=r):r=t[1];const a=r;let s,i,l,c,d;return t[2]===Symbol.for("react.memo_cache_sentinel")?(s=k.jsx("b",{children:"CPU:"}),t[2]=s):s=t[2],t[3]!==a?(i=k.jsxs("span",{children:[s," ",a,"%"]}),t[3]=a,t[4]=i):i=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(l=k.jsx(Wi,{className:"w-4 h-4"}),t[5]=l):l=t[5],t[6]!==a?(c=k.jsxs("div",{className:"flex items-center gap-1",children:[l,k.jsx(gN,{percent:a})]}),t[6]=a,t[7]=c):c=t[7],t[8]!==i||t[9]!==c?(d=k.jsx(C,{delayDuration:200,content:i,children:c}),t[8]=i,t[9]=c,t[10]=d):d=t[10],d},gN=e=>{const t=b(2),{percent:n}=e,o=`${n}%`;let r;return t[0]!==o?(r=k.jsx("div",{className:"h-3 w-20 bg-[var(--slate-4)] rounded-lg overflow-hidden border",children:k.jsx("div",{className:"h-full bg-primary",style:{width:o}})}),t[0]=o,t[1]=r):r=t[1],r};function vN(e){return e>1073741824?`${xN(e)} GB`:`${function(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(e/1048576)}(e)} MB`}function xN(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e/1073741824)}const yN=e=>le(Oa)[e.capability]?e.children:null,bN=()=>{const e=b(56),{selectedPanel:t,isTerminalOpen:n}=Hd(),{openApplication:o,toggleTerminal:r}=Wd(),[a,s]=Oe(),i=le(rs),l=wN,c=qd.find(kN);let d;Gt(c,"Error panel not found"),e[0]!==r?(d=()=>{r()},e[0]=r,e[1]=d):d=e[1],yi("global.toggleTerminal",d);const u=aN,h=c.tooltip,m=t===c.type,f=()=>o(c.type),p=l(c,i>0?"text-destructive":"");let g,v,x,y,w;e[2]!==i?(g=k.jsx("span",{className:"ml-1 font-mono mt-[0.125rem]",children:i}),e[2]=i,e[3]=g):g=e[3],e[4]!==u||e[5]!==c.tooltip||e[6]!==m||e[7]!==f||e[8]!==p||e[9]!==g?(v=k.jsxs(u,{tooltip:h,selected:m,onClick:f,children:[p,g]}),e[4]=u,e[5]=c.tooltip,e[6]=m,e[7]=f,e[8]=p,e[9]=g,e[10]=v):v=e[10],e[11]!==r?(x=()=>r(),e[11]=r,e[12]=x):x=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(y=k.jsx(Uc,{className:"h-5 w-5"}),e[13]=y):y=e[13],e[14]!==n||e[15]!==x?(w=k.jsx(yN,{capability:"terminal",children:k.jsx(aN,{tooltip:"Open terminal",selected:n,onClick:x,children:y})}),e[14]=n,e[15]=x,e[16]=w):w=e[16];const N=a.runtime.auto_instantiate?"Disable autorun on startup":"Enable autorun on startup";let E,S,j;e[17]!==a||e[18]!==s?(E=async()=>{const e={...a,runtime:{...a.runtime,auto_instantiate:!a.runtime.auto_instantiate}};await Pe({config:e}).then((()=>s(e)))},e[17]=a,e[18]=s,e[19]=E):E=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(S=k.jsx("span",{children:"on startup: "}),e[20]=S):S=e[20],e[21]!==a.runtime.auto_instantiate?(j=a.runtime.auto_instantiate?k.jsx(Xc,{size:14}):k.jsx(Yc,{size:14}),e[21]=a.runtime.auto_instantiate,e[22]=j):j=e[22];const _=a.runtime.auto_instantiate?"autorun":"lazy";let I,A,M,T;e[23]!==_?(I=k.jsx("span",{children:_}),e[23]=_,e[24]=I):I=e[24],e[25]!==j||e[26]!==I?(A=k.jsxs("div",{className:"font-prose text-sm flex items-center gap-1",children:[S,j,I]}),e[25]=j,e[26]=I,e[27]=A):A=e[27],e[28]!==N||e[29]!==E||e[30]!==A?(M=k.jsx(aN,{tooltip:N,selected:!1,onClick:E,children:A}),e[28]=N,e[29]=E,e[30]=A,e[31]=M):M=e[31],e[32]===Symbol.for("react.memo_cache_sentinel")?(T=k.jsx("div",{className:"border-r border-border h-6 mx-1"}),e[32]=T):T=e[32];const O="autorun"===a.runtime.on_cell_change?"Disable autorun":"Enable autorun";let P,R,F,L,z,B,U,V,G,$;return e[33]!==a||e[34]!==s?(P=async()=>{const e={...a,runtime:{...a.runtime,on_cell_change:"autorun"===a.runtime.on_cell_change?"lazy":"autorun"}};await Pe({config:e}).then((()=>s(e)))},e[33]=a,e[34]=s,e[35]=P):P=e[35],e[36]===Symbol.for("react.memo_cache_sentinel")?(R=k.jsx("span",{children:"on cell change: "}),e[36]=R):R=e[36],e[37]!==a.runtime.on_cell_change?(F=k.jsxs("div",{className:"font-prose text-sm flex items-center gap-1",children:[R,"autorun"===a.runtime.on_cell_change?k.jsx(Xc,{size:14}):k.jsx(Yc,{size:14}),k.jsx("span",{children:a.runtime.on_cell_change})]}),e[37]=a.runtime.on_cell_change,e[38]=F):F=e[38],e[39]!==O||e[40]!==P||e[41]!==F?(L=k.jsx(aN,{tooltip:O,selected:!1,onClick:P,children:F}),e[39]=O,e[40]=P,e[41]=F,e[42]=L):L=e[42],e[43]===Symbol.for("react.memo_cache_sentinel")?(z=k.jsx("div",{className:"border-r border-border h-6 mx-1"}),e[43]=z):z=e[43],e[44]!==a||e[45]!==s?(B=!D()&&k.jsx(aN,{tooltip:null,selected:!1,children:k.jsxs(zt,{children:[k.jsxs(Ot,{className:"font-prose text-sm flex items-center gap-1",children:[k.jsx("span",{children:"on module change: "}),"off"===a.runtime.auto_reload&&k.jsx(Hi,{size:14}),"lazy"===a.runtime.auto_reload&&k.jsx(Yc,{size:14}),"autorun"===a.runtime.auto_reload&&k.jsx(Xc,{size:14}),k.jsx("span",{children:a.runtime.auto_reload}),k.jsx(Ee,{size:14})]}),k.jsx(Bt,{children:["off","lazy","autorun"].map((e=>k.jsxs(Tt,{onClick:async()=>{const t={...a,runtime:{...a.runtime,auto_reload:e}};await Pe({config:t}).then((()=>s(t)))},children:["off"===e&&k.jsx(Hi,{size:14,className:"mr-2 text-muted-foreground"}),"lazy"===e&&k.jsx(Yc,{size:14,className:"mr-2 text-muted-foreground"}),"autorun"===e&&k.jsx(Xc,{size:14,className:"mr-2 text-muted-foreground"}),e]},e)))})]})}),e[44]=a,e[45]=s,e[46]=B):B=e[46],e[47]===Symbol.for("react.memo_cache_sentinel")?(U=k.jsx("div",{className:"mx-auto"}),e[47]=U):U=e[47],e[48]===Symbol.for("react.memo_cache_sentinel")?(V=k.jsx(ju,{children:k.jsx(C,{content:k.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:k.jsx("span",{className:"text-muted-foreground text-sm mr-4",children:"kiosk mode"})})}),G=k.jsx(hN,{}),e[48]=V,e[49]=G):(V=e[48],G=e[49]),e[50]!==v||e[51]!==w||e[52]!==M||e[53]!==L||e[54]!==B?($=k.jsxs("footer",{className:"h-10 py-2 bg-background flex items-center text-muted-foreground text-md pl-1 pr-4 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:[v,w,M,T,L,z,B,U,V,G]}),e[50]=v,e[51]=w,e[52]=M,e[53]=L,e[54]=B,e[55]=$):$=e[55],$};function wN(e,t){const{Icon:n}=e;return k.jsx(n,{className:on("h-5 w-5",t)})}function kN(e){return"errors"===e.type}const NN=e=>{const t=b(6),{children:n}=e,{openModal:o,closeModal:r}=w();let a,s;return t[0]!==o||t[1]!==r?(a=()=>o(k.jsx(EN,{onClose:r})),t[0]=o,t[1]=r,t[2]=a):a=t[2],t[3]!==a||t[4]!==n?(s=k.jsx(as,{onClick:a,children:n}),t[3]=a,t[4]=n,t[5]=s):s=t[5],s},CN={"😡":1,"🙁":2,"😐":3,"🙂":4,"😍":5},EN=e=>{const t=b(13),{onClose:n}=e;let o,r,a,s,i,l,c,d;return t[0]!==n?(o=async e=>{e.preventDefault();const t=new FormData(e.target),o=t.get("rating"),r=t.get("message");fetch("https://marimo.io/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rating:o,message:r})}),n(),re({title:"Feedback sent!",description:"Thank you for your feedback!"})},t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=k.jsx(j,{children:"Send Feedback"}),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(a=k.jsxs(Ie,{children:[r,k.jsxs(_,{children:["Let us know what you think about marimo! If you have a bug that you would like to report, please use the"," ",k.jsx("a",{href:Ze.issuesPage,target:"_blank",rel:"noreferrer",className:"underline",children:"GitHub issue tracker"}),"."]}),k.jsx(_,{children:"Your feedback is anonymous and will help us improve marimo. Thank you!"})]}),t[3]=a):a=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(s=k.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[k.jsx("div",{className:"flex gap-5 justify-center",children:Object.entries(CN).map(SN)}),k.jsx(ss,{id:"message",name:"message",autoFocus:!0,placeholder:"Your feedback; if you'd like us to respond, please include your email!",rows:5,required:!0,autoComplete:"off"})]}),t[4]=s):s=t[4],t[5]!==n?(i=k.jsx(E,{"data-testid":"feedback-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),t[5]=n,t[6]=i):i=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(l=k.jsx(E,{"data-testid":"feedback-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),t[7]=l):l=t[7],t[8]!==i?(c=k.jsxs(I,{children:[i,l]}),t[8]=i,t[9]=c):c=t[9],t[10]!==o||t[11]!==c?(d=k.jsx(A,{className:"w-fit",children:k.jsxs("form",{onSubmit:o,children:[a,s,c]})}),t[10]=o,t[11]=c,t[12]=d):d=t[12],d};function SN(e){const[t,n]=e;return k.jsxs("label",{className:"flex flex-col items-center select-none",children:[k.jsx("input",{type:"radio",className:"peer hidden",name:"rating",value:n,"aria-label":t},t),k.jsx("span",{className:"text-4xl peer-checked:opacity-100 opacity-40 cursor-pointer",children:t})]},t)}const jN=()=>{const e=b(10),{selectedPanel:t}=Hd(),{openApplication:n}=Wd(),o=AN;let r,a,s,i,l,c;if(e[0]!==t||e[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",a=qd.filter(MN).map((e=>k.jsx(IN,{tooltip:e.tooltip,selected:t===e.type,onClick:()=>n(e.type),children:o(e)},e.type))),e[0]=t,e[1]=n,e[2]=r,e[3]=a}else r=e[2],a=e[3];return e[4]===Symbol.for("react.memo_cache_sentinel")?(s=k.jsx(NN,{children:k.jsx(IN,{tooltip:"Send feedback!",selected:!1,children:k.jsx(pc,{className:"h-5 w-5"})})}),i=k.jsx("div",{className:"flex-1"}),l=k.jsx(_N,{}),e[4]=s,e[5]=i,e[6]=l):(s=e[4],i=e[5],l=e[6]),e[7]!==r||e[8]!==a?(c=k.jsxs("div",{className:r,children:[a,s,i,l]}),e[7]=r,e[8]=a,e[9]=c):c=e[9],c},_N=()=>{const e=b(9),t=le(is);let n,o,r,a;return e[0]!==t?(n=t>0?k.jsxs("span",{children:[t," cell",t>1?"s":""," queued or running"]}):"No cells queued or running",e[0]=t,e[1]=n):n=e[1],e[2]!==t?(o=Array.from({length:t}).map(TN),e[2]=t,e[3]=o):o=e[3],e[4]!==o?(r=k.jsx("div",{className:"flex flex-col-reverse gap-[1px] overflow-hidden",children:o}),e[4]=o,e[5]=r):r=e[5],e[6]!==n||e[7]!==r?(a=k.jsx(C,{content:n,side:"right",delayDuration:200,children:r}),e[6]=n,e[7]=r,e[8]=a):a=e[8],a},IN=e=>{const t=b(17);let n,o,r,a,s;t[0]!==e?(({children:a,tooltip:s,selected:n,className:o,...r}=e),t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=a,t[5]=s):(n=t[1],o=t[2],r=t[3],a=t[4],s=t[5]);const i=!n&&"hover:bg-[var(--sage-3)]",l=n&&"bg-[var(--sage-4)]";let c,d,u;return t[6]!==i||t[7]!==l||t[8]!==o?(c=on("flex items-center p-2 text-sm mx-[1px] shadow-inset font-mono cursor-pointer rounded",i,l,o),t[6]=i,t[7]=l,t[8]=o,t[9]=c):c=t[9],t[10]!==c||t[11]!==r||t[12]!==a?(d=k.jsx("div",{className:c,...r,children:a}),t[10]=c,t[11]=r,t[12]=a,t[13]=d):d=t[13],t[14]!==s||t[15]!==d?(u=k.jsx(C,{content:s,side:"right",delayDuration:200,children:d}),t[14]=s,t[15]=d,t[16]=u):u=t[16],u};function AN(e,t){const{Icon:n}=e;return k.jsx(n,{className:on("h-5 w-5",t)})}function MN(e){return!e.hidden&&"sidebar"===e.position}function TN(e,t){return k.jsx("div",{className:"flex-shrink-0 h-1 w-2 bg-[var(--grass-6)] border border-[var(--grass-7)]"},t.toString())}it.record(it.tuple([it.number(),it.number()]));let ON=null;const DN=e=>{const t=b(12),{title:n,description:o,icon:r}=e;let a,s,i,l,c;return t[0]!==r?(a=r&&u.cloneElement(r,{className:"text-accent-foreground"}),t[0]=r,t[1]=a):a=t[1],t[2]!==n?(s=k.jsx("span",{className:"mt-1 text-accent-foreground",children:n}),t[2]=n,t[3]=s):s=t[3],t[4]!==a||t[5]!==s?(i=k.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[a,s]}),t[4]=a,t[5]=s,t[6]=i):i=t[6],t[7]!==o?(l=k.jsx("span",{className:"text-muted-foreground text-sm",children:o}),t[7]=o,t[8]=l):l=t[8],t[9]!==i||t[10]!==l?(c=k.jsxs("div",{className:"mx-6 my-6 flex flex-col gap-2",children:[i,l]}),t[9]=i,t[10]=l,t[11]=c):c=t[11],c},PN=()=>{const e=b(5),t=ls();if(0===t.length){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=k.jsx(DN,{title:"No errors!",icon:k.jsx(kc,{})}),e[0]=t):t=e[0],t}let n,o;return e[1]!==t?(n=t.map(RN),e[1]=t,e[2]=n):n=e[2],e[3]!==n?(o=k.jsx("div",{className:"flex flex-col overflow-auto",children:n}),e[3]=n,e[4]=o):o=e[4],o};function RN(e){return k.jsxs("div",{children:[k.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:k.jsx(cs,{cellId:e.cellId})}),k.jsx("div",{className:"px-2",children:k.jsx(ds,{errors:e.output.data},e.cellId)},e.cellId)]},e.cellId)}const FN=()=>{const e=b(6),{items:t}=le(us);let n,o;e[0]!==t?(o=Nl(t),e[0]=t,e[1]=o):o=e[1],n=o;const r=n,{activeHeaderId:a}=Cl(r);if(0===t.length){let t;return e[2]===Symbol.for("react.memo_cache_sentinel")?(t=k.jsx(DN,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:k.jsx(Mc,{})}),e[2]=t):t=e[2],t}let s;return e[3]!==t||e[4]!==a?(s=k.jsx(El,{items:t,activeHeaderId:a}),e[3]=t,e[4]=a,e[5]=s):s=e[5],s};function LN(e){if("string"==typeof e||"number"==typeof e)return""+e;let t="";if(Array.isArray(e))for(let n,o=0;o<e.length;o++)""!==(n=LN(e[o]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}const{useDebugValue:zN}=u,{useSyncExternalStoreWithSelector:BN}=hs,UN=e=>e;function VN(e,t=UN,n){const o=BN(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return zN(o),o}const GN=(e,t)=>{const n=ms(e),o=(e,o=t)=>VN(n,e,o);return Object.assign(o,n),o};function $N(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,o]of e)if(!Object.is(o,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}function HN(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,[(o=o.matrixTransform(t.getScreenCTM().inverse())).x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const WN={passive:!1},qN={capture:!0,passive:!1};function YN(e){e.stopImmediatePropagation()}function XN(e){e.preventDefault(),e.stopImmediatePropagation()}function KN(e){var t=e.document.documentElement,n=jl(e).on("dragstart.drag",XN,qN);"onselectstart"in t?n.on("selectstart.drag",XN,qN):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function JN(e,t){var n=e.document.documentElement,o=jl(e).on("dragstart.drag",null);t&&(o.on("click.drag",XN,qN),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 ZN=e=>()=>e;function QN(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:a,x:s,y:i,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,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:a,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:i,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}function eC(e){return!e.ctrlKey&&!e.button}function tC(){return this.parentNode}function nC(e,t){return null==t?{x:e.x,y:e.y}:t}function oC(){return navigator.maxTouchPoints||"ontouchstart"in this}QN.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};const rC=e=>()=>e;function aC(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function sC(e){e.stopImmediatePropagation()}function iC(e){e.preventDefault(),e.stopImmediatePropagation()}function lC(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function cC(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function dC(){return this.__zoom||_l}function uC(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function hC(){return navigator.maxTouchPoints||"ontouchstart"in this}function mC(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>a?(a+s)/2:Math.min(0,a)||Math.max(0,s))}const fC=r.createContext(null),pC=fC.Provider,gC=e=>`Node type "${e}" not found. Using fallback type "default".`,vC=()=>"The React Flow parent container needs a width and a height to render the graph.",xC=()=>"Only child nodes can use a parent extent.",yC=e=>`Marker type "${e}" doesn't exist.`,bC=(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,wC=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",kC=e=>`Edge type "${e}" not found. Using fallback type "default".`,NC=e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,CC=(()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001")();function EC(e,t){const n=r.useContext(fC);if(null===n)throw new Error(CC);return VN(n,e,t)}const SC=()=>{const e=r.useContext(fC);if(null===e)throw new Error(CC);return r.useMemo((()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy})),[e])},jC=e=>e.userSelectionActive?"none":"all";function _C({position:e,children:t,className:n,style:o,...r}){const a=EC(jC),s=`${e}`.split("-");return u.createElement("div",{className:LN(["react-flow__panel",n,...s]),style:{...o,pointerEvents:a},...r},t)}function IC({proOptions:e,position:t="bottom-right"}){return(null==e?void 0:e.hideAttribution)?null:u.createElement(_C,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},u.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var AC=r.memo((({x:e,y:t,label:n,labelStyle:o={},labelShowBg:a=!0,labelBgStyle:s={},labelBgPadding:i=[2,4],labelBgBorderRadius:l=2,children:c,className:d,...h})=>{const m=r.useRef(null),[f,p]=r.useState({x:0,y:0,width:0,height:0}),g=LN(["react-flow__edge-textwrapper",d]);return r.useEffect((()=>{if(m.current){const e=m.current.getBBox();p({x:e.x,y:e.y,width:e.width,height:e.height})}}),[n]),void 0!==n&&n?u.createElement("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:g,visibility:f.width?"visible":"hidden",...h},a&&u.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:l,ry:l}),u.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:m,style:o},n),c):null}));const MC=e=>({width:e.offsetWidth,height:e.offsetHeight}),TC=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),OC=(e={x:0,y:0},t)=>({x:TC(e.x,t[0][0],t[1][0]),y:TC(e.y,t[0][1],t[1][1])}),DC=(e,t,n)=>e<t?TC(Math.abs(e-t),1,50)/50:e>n?-TC(Math.abs(e-n),1,50)/50:0,PC=(e,t)=>[20*DC(e.x,35,t.width-35),20*DC(e.y,35,t.height-35)],RC=e=>{var t;return(null==(t=e.getRootNode)?void 0:t.call(e))||(null==window?void 0:window.document)},FC=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),LC=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),zC=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},BC=e=>!isNaN(e)&&isFinite(e),UC=Symbol.for("internals"),VC=["Enter"," ","Escape"];function GC(e){var t,n;const o=(e=>"nativeEvent"in e)(e)?e.nativeEvent:e,r=(null==(n=null==(t=o.composedPath)?void 0:t.call(o))?void 0:n[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(null==r?void 0:r.nodeName)||(null==r?void 0:r.hasAttribute("contenteditable"))||!!(null==r?void 0:r.closest(".nokey"))}const $C=e=>"clientX"in e,HC=(e,t)=>{var n,o;const r=$C(e),a=r?e.clientX:null==(n=e.touches)?void 0:n[0].clientX,s=r?e.clientY:null==(o=e.touches)?void 0:o[0].clientY;return{x:a-((null==t?void 0:t.left)??0),y:s-((null==t?void 0:t.top)??0)}},WC=()=>{var e;return"undefined"!=typeof navigator&&(null==(e=null==navigator?void 0:navigator.userAgent)?void 0:e.indexOf("Mac"))>=0},qC=({id:e,path:t,labelX:n,labelY:o,label:r,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:m,interactionWidth:f=20})=>u.createElement(u.Fragment,null,u.createElement("path",{id:e,style:d,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:h,markerStart:m}),f&&u.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}),r&&BC(n)&&BC(o)?u.createElement(AC,{x:n,y:o,label:r,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:c}):null);function YC(e,t,n){return void 0===n?n:o=>{const r=t().edges.find((t=>t.id===e));r&&n(o,{...r})}}function XC({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,a=n<e?n+r:n-r,s=Math.abs(o-t)/2;return[a,o<t?o+s:o-s,r,s]}function KC({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:a,targetControlX:s,targetControlY:i}){const l=.125*e+.375*r+.375*s+.125*n,c=.125*t+.375*a+.375*i+.125*o;return[l,c,Math.abs(l-e),Math.abs(c-t)]}var JC,ZC,QC,eE,tE,nE,oE,rE,aE,sE,iE,lE;function cE({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===iE.Left||e===iE.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function dE({sourceX:e,sourceY:t,sourcePosition:n=iE.Bottom,targetX:o,targetY:r,targetPosition:a=iE.Top}){const[s,i]=cE({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=cE({pos:a,x1:o,y1:r,x2:e,y2:t}),[d,u,h,m]=KC({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${i} ${l},${c} ${o},${r}`,d,u,h,m]}qC.displayName="BaseEdge",(ZC=JC||(JC={})).Strict="strict",ZC.Loose="loose",(eE=QC||(QC={})).Free="free",eE.Vertical="vertical",eE.Horizontal="horizontal",(nE=tE||(tE={})).Partial="partial",nE.Full="full",(rE=oE||(oE={})).Bezier="default",rE.Straight="straight",rE.Step="step",rE.SmoothStep="smoothstep",rE.SimpleBezier="simplebezier",(sE=aE||(aE={})).Arrow="arrow",sE.ArrowClosed="arrowclosed",(lE=iE||(iE={})).Left="left",lE.Top="top",lE.Right="right",lE.Bottom="bottom";const uE=r.memo((({sourceX:e,sourceY:t,targetX:n,targetY:o,sourcePosition:r=iE.Bottom,targetPosition:a=iE.Top,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:m,markerEnd:f,markerStart:p,interactionWidth:g})=>{const[v,x,y]=dE({sourceX:e,sourceY:t,sourcePosition:r,targetX:n,targetY:o,targetPosition:a});return u.createElement(qC,{path:v,labelX:x,labelY:y,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:m,markerEnd:f,markerStart:p,interactionWidth:g})}));uE.displayName="SimpleBezierEdge";const hE={[iE.Left]:{x:-1,y:0},[iE.Right]:{x:1,y:0},[iE.Top]:{x:0,y:-1},[iE.Bottom]:{x:0,y:1}},mE=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function fE({source:e,sourcePosition:t=iE.Bottom,target:n,targetPosition:o=iE.Top,center:r,offset:a}){const s=hE[t],i=hE[o],l={x:e.x+s.x*a,y:e.y+s.y*a},c={x:n.x+i.x*a,y:n.y+i.y*a},d=(({source:e,sourcePosition:t=iE.Bottom,target:n})=>t===iE.Left||t===iE.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1})({source:l,sourcePosition:t,target:c}),u=0!==d.x?"x":"y",h=d[u];let m,f,p=[];const g={x:0,y:0},v={x:0,y:0},[x,y,b,w]=XC({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[u]*i[u]==-1){m=r.x??x,f=r.y??y;const e=[{x:m,y:l.y},{x:m,y:c.y}],t=[{x:l.x,y:f},{x:c.x,y:f}];p=s[u]===h?"x"===u?e:t:"x"===u?t:e}else{const r=[{x:l.x,y:c.y}],d=[{x:c.x,y:l.y}];if(p="x"===u?s.x===h?d:r:s.y===h?r:d,t===o){const t=Math.abs(e[u]-n[u]);if(t<=a){const o=Math.min(a-1,a-t);s[u]===h?g[u]=(l[u]>e[u]?-1:1)*o:v[u]=(c[u]>n[u]?-1:1)*o}}if(t!==o){const e="x"===u?"y":"x",t=s[u]===i[e],n=l[e]>c[e],o=l[e]<c[e];(1===s[u]&&(!t&&n||t&&o)||1!==s[u]&&(!t&&o||t&&n))&&(p="x"===u?r:d)}const x={x:l.x+g.x,y:l.y+g.y},y={x:c.x+v.x,y:c.y+v.y};Math.max(Math.abs(x.x-p[0].x),Math.abs(y.x-p[0].x))>=Math.max(Math.abs(x.y-p[0].y),Math.abs(y.y-p[0].y))?(m=(x.x+y.x)/2,f=p[0].y):(m=p[0].x,f=(x.y+y.y)/2)}return[[e,{x:l.x+g.x,y:l.y+g.y},...p,{x:c.x+v.x,y:c.y+v.y},n],m,f,b,w]}function pE({sourceX:e,sourceY:t,sourcePosition:n=iE.Bottom,targetX:o,targetY:r,targetPosition:a=iE.Top,borderRadius:s=5,centerX:i,centerY:l,offset:c=20}){const[d,u,h,m,f]=fE({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:a,center:{x:i,y:l},offset:c});return[d.reduce(((e,t,n)=>{let o="";return o=n>0&&n<d.length-1?function(e,t,n,o){const r=Math.min(mE(e,t)/2,mE(t,n)/2,o),{x:a,y:s}=t;if(e.x===a&&a===n.x||e.y===s&&s===n.y)return`L${a} ${s}`;if(e.y===s)return`L ${a+r*(e.x<n.x?-1:1)},${s}Q ${a},${s} ${a},${s+r*(e.y<n.y?1:-1)}`;const i=e.x<n.x?1:-1;return`L ${a},${s+r*(e.y<n.y?-1:1)}Q ${a},${s} ${a+r*i},${s}`}(d[n-1],t,d[n+1],s):`${0===n?"M":"L"}${t.x} ${t.y}`,e+=o}),""),u,h,m,f]}const gE=r.memo((({sourceX:e,sourceY:t,targetX:n,targetY:o,label:r,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:c,style:d,sourcePosition:h=iE.Bottom,targetPosition:m=iE.Top,markerEnd:f,markerStart:p,pathOptions:g,interactionWidth:v})=>{const[x,y,b]=pE({sourceX:e,sourceY:t,sourcePosition:h,targetX:n,targetY:o,targetPosition:m,borderRadius:null==g?void 0:g.borderRadius,offset:null==g?void 0:g.offset});return u.createElement(qC,{path:x,labelX:y,labelY:b,label:r,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:f,markerStart:p,interactionWidth:v})}));gE.displayName="SmoothStepEdge";const vE=r.memo((e=>{var t;return u.createElement(gE,{...e,pathOptions:r.useMemo((()=>{var t;return{borderRadius:0,offset:null==(t=e.pathOptions)?void 0:t.offset}}),[null==(t=e.pathOptions)?void 0:t.offset])})}));vE.displayName="StepEdge";const xE=r.memo((({sourceX:e,sourceY:t,targetX:n,targetY:o,label:r,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:m,interactionWidth:f})=>{const[p,g,v]=function({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,a,s,i]=XC({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,a,s,i]}({sourceX:e,sourceY:t,targetX:n,targetY:o});return u.createElement(qC,{path:p,labelX:g,labelY:v,label:r,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:m,interactionWidth:f})}));function yE(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function bE({pos:e,x1:t,y1:n,x2:o,y2:r,c:a}){switch(e){case iE.Left:return[t-yE(t-o,a),n];case iE.Right:return[t+yE(o-t,a),n];case iE.Top:return[t,n-yE(n-r,a)];case iE.Bottom:return[t,n+yE(r-n,a)]}}function wE({sourceX:e,sourceY:t,sourcePosition:n=iE.Bottom,targetX:o,targetY:r,targetPosition:a=iE.Top,curvature:s=.25}){const[i,l]=bE({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,d]=bE({pos:a,x1:o,y1:r,x2:e,y2:t,c:s}),[u,h,m,f]=KC({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:i,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${e},${t} C${i},${l} ${c},${d} ${o},${r}`,u,h,m,f]}xE.displayName="StraightEdge";const kE=r.memo((({sourceX:e,sourceY:t,targetX:n,targetY:o,sourcePosition:r=iE.Bottom,targetPosition:a=iE.Top,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:m,markerEnd:f,markerStart:p,pathOptions:g,interactionWidth:v})=>{const[x,y,b]=wE({sourceX:e,sourceY:t,sourcePosition:r,targetX:n,targetY:o,targetPosition:a,curvature:null==g?void 0:g.curvature});return u.createElement(qC,{path:x,labelX:y,labelY:b,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:m,markerEnd:f,markerStart:p,interactionWidth:v})}));kE.displayName="BezierEdge";const NE=r.createContext(null),CE=NE.Provider;NE.Consumer;const EE=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`reactflow__edge-${e}${t||""}-${n}${o||""}`,SE=(e,t)=>{if(void 0===e)return"";if("string"==typeof e)return e;return`${t?`${t}__`:""}${Object.keys(e).sort().map((t=>`${t}=${e[t]}`)).join("&")}`},jE=({x:e,y:t},[n,o,r],a,[s,i])=>{const l={x:(e-n)/r,y:(t-o)/r};return a?{x:s*Math.round(l.x/s),y:i*Math.round(l.y/i)}:l},_E=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o}),IE=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],o=(e.height??0)*t[1],r={x:e.position.x-n,y:e.position.y-o};return{...r,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-o}:r}},AE=(e,t=[0,0])=>{if(0===e.length)return{x:0,y:0,width:0,height:0};return(({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}))(e.reduce(((e,n)=>{const{x:o,y:r}=IE(n,t).positionAbsolute;return a=e,s=FC({x:o,y:r,width:n.width||0,height:n.height||0}),{x:Math.min(a.x,s.x),y:Math.min(a.y,s.y),x2:Math.max(a.x2,s.x2),y2:Math.max(a.y2,s.y2)};var a,s}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0}))},ME=(e,t,[n,o,r]=[0,0,1],a=!1,s=!1,i=[0,0])=>{const l={x:(t.x-n)/r,y:(t.y-o)/r,width:t.width/r,height:t.height/r},c=[];return e.forEach((e=>{const{width:t,height:n,selectable:o=!0,hidden:r=!1}=e;if(s&&!o||r)return!1;const{positionAbsolute:d}=IE(e,i),u={x:d.x,y:d.y,width:t||0,height:n||0},h=zC(l,u);(void 0===t||void 0===n||null===t||null===n||a&&h>0||h>=(t||0)*(n||0)||e.dragging)&&c.push(e)})),c},TE=(e,t)=>{const n=e.map((e=>e.id));return t.filter((e=>n.includes(e.source)||n.includes(e.target)))},OE=(e,t,n,o,r,a=.1)=>{const s=t/(e.width*(1+a)),i=n/(e.height*(1+a)),l=Math.min(s,i),c=TC(l,o,r);return{x:t/2-(e.x+e.width/2)*c,y:n/2-(e.y+e.height/2)*c,zoom:c}},DE=(e,t=0)=>e.transition().duration(t);function PE(e,t,n,o){return(t[n]||[]).reduce(((t,r)=>{var a,s;return`${e.id}-${r.id}-${n}`!==o&&t.push({id:r.id||null,type:n,nodeId:e.id,x:((null==(a=e.positionAbsolute)?void 0:a.x)??0)+r.x+r.width/2,y:((null==(s=e.positionAbsolute)?void 0:s.y)??0)+r.y+r.height/2}),t}),[])}const RE={source:null,target:null,sourceHandle:null,targetHandle:null},FE=()=>({handleDomNode:null,isValid:!1,connection:RE,endHandle:null});function LE(e,t,n,o,r,a,s){const i="target"===r,l=s.querySelector(`.react-flow__handle[data-id="${null==e?void 0:e.nodeId}-${null==e?void 0:e.id}-${null==e?void 0:e.type}"]`),c={...FE(),handleDomNode:l};if(l){const e=zE(void 0,l),r=l.getAttribute("data-nodeid"),s=l.getAttribute("data-handleid"),d=l.classList.contains("connectable"),u=l.classList.contains("connectableend"),h={source:i?r:n,sourceHandle:i?s:o,target:i?n:r,targetHandle:i?o:s};c.connection=h;d&&u&&(t===JC.Strict?i&&"source"===e||!i&&"target"===e:r!==n||s!==o)&&(c.endHandle={nodeId:r,handleId:s,type:e},c.isValid=a(h))}return c}function zE(e,t){return e||((null==t?void 0:t.classList.contains("target"))?"target":(null==t?void 0:t.classList.contains("source"))?"source":null)}function BE(e){null==e||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function UE(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function VE({event:e,handleId:t,nodeId:n,onConnect:o,isTarget:r,getState:a,setState:s,isValidConnection:i,edgeUpdaterType:l,onReconnectEnd:c}){const d=RC(e.target),{connectionMode:u,domNode:h,autoPanOnConnect:m,connectionRadius:f,onConnectStart:p,panBy:g,getNodes:v,cancelConnection:x}=a();let y,b=0;const{x:w,y:k}=HC(e),N=null==d?void 0:d.elementFromPoint(w,k),C=zE(l,N),E=null==h?void 0:h.getBoundingClientRect();if(!E||!C)return;let S,j=HC(e,E),_=!1,I=null,A=!1,M=null;const T=function({nodes:e,nodeId:t,handleId:n,handleType:o}){return e.reduce(((e,r)=>{if(r[UC]){const{handleBounds:a}=r[UC];let s=[],i=[];a&&(s=PE(r,a,"source",`${t}-${n}-${o}`),i=PE(r,a,"target",`${t}-${n}-${o}`)),e.push(...s,...i)}return e}),[])}({nodes:v(),nodeId:n,handleId:t,handleType:C}),O=()=>{if(!m)return;const[e,t]=PC(j,E);g({x:e,y:t}),b=requestAnimationFrame(O)};function D(e){const{transform:o}=a();j=HC(e,E);const{handle:l,validHandleResult:c}=function(e,t,n,o,r,a){const{x:s,y:i}=HC(e),l=t.elementsFromPoint(s,i).find((e=>e.classList.contains("react-flow__handle")));if(l){const e=l.getAttribute("data-nodeid");if(e){const t=zE(void 0,l),o=l.getAttribute("data-handleid"),s=a({nodeId:e,id:o,type:t});if(s){const a=r.find((n=>n.nodeId===e&&n.type===t&&n.id===o));return{handle:{id:o,type:t,nodeId:e,x:(null==a?void 0:a.x)||n.x,y:(null==a?void 0:a.y)||n.y},validHandleResult:s}}}}let c=[],d=1/0;if(r.forEach((e=>{const t=Math.sqrt((e.x-n.x)**2+(e.y-n.y)**2);if(t<=o){const n=a(e);t<=d&&(t<d?c=[{handle:e,validHandleResult:n}]:t===d&&c.push({handle:e,validHandleResult:n}),d=t)}})),!c.length)return{handle:null,validHandleResult:FE()};if(1===c.length)return c[0];const u=c.some((({validHandleResult:e})=>e.isValid)),h=c.some((({handle:e})=>"target"===e.type));return c.find((({handle:e,validHandleResult:t})=>h?"target"===e.type:!u||t.isValid))||c[0]}(e,d,jE(j,o,!1,[1,1]),f,T,(e=>LE(e,u,n,t,r?"target":"source",i,d)));if(y=l,_||(O(),_=!0),M=c.handleDomNode,I=c.connection,A=c.isValid,s({connectionPosition:y&&A?_E({x:y.x,y:y.y},o):j,connectionStatus:UE(!!y,A),connectionEndHandle:c.endHandle}),!y&&!A&&!M)return BE(S);I.source!==I.target&&M&&(BE(S),S=M,M.classList.add("connecting","react-flow__handle-connecting"),M.classList.toggle("valid",A),M.classList.toggle("react-flow__handle-valid",A))}function P(e){var t,n;(y||M)&&I&&A&&(null==o||o(I)),null==(n=(t=a()).onConnectEnd)||n.call(t,e),l&&(null==c||c(e)),BE(S),x(),cancelAnimationFrame(b),_=!1,A=!1,I=null,M=null,d.removeEventListener("mousemove",D),d.removeEventListener("mouseup",P),d.removeEventListener("touchmove",D),d.removeEventListener("touchend",P)}s({connectionPosition:j,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:C,connectionStartHandle:{nodeId:n,handleId:t,type:C},connectionEndHandle:null}),null==p||p(e,{nodeId:n,handleId:t,handleType:C}),d.addEventListener("mousemove",D),d.addEventListener("mouseup",P),d.addEventListener("touchmove",D),d.addEventListener("touchend",P)}const GE=()=>!0,$E=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),HE=r.forwardRef((({type:e="source",position:t=iE.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:a=!0,isConnectableEnd:s=!0,id:i,onConnect:l,children:c,className:d,onMouseDown:h,onTouchStart:m,...f},p)=>{var g,v;const x=i||null,y="target"===e,b=SC(),w=r.useContext(NE),{connectOnClick:k,noPanClassName:N}=EC($E,$N),{connecting:C,clickConnecting:E}=EC(((e,t,n)=>o=>{const{connectionStartHandle:r,connectionEndHandle:a,connectionClickStartHandle:s}=o;return{connecting:(null==r?void 0:r.nodeId)===e&&(null==r?void 0:r.handleId)===t&&(null==r?void 0:r.type)===n||(null==a?void 0:a.nodeId)===e&&(null==a?void 0:a.handleId)===t&&(null==a?void 0:a.type)===n,clickConnecting:(null==s?void 0:s.nodeId)===e&&(null==s?void 0:s.handleId)===t&&(null==s?void 0:s.type)===n}})(w,x,e),$N);w||null==(v=(g=b.getState()).onError)||v.call(g,"010",wC());const S=e=>{const{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:o}=b.getState(),r={...t,...e};if(o){const{edges:e,setEdges:t}=b.getState();t(((e,t)=>{if(!e.source||!e.target)return t;let n;var o;return n="id"in(o=e)&&"source"in o&&"target"in o?{...e}:{...e,id:EE(e)},((e,t)=>t.some((t=>!(t.source!==e.source||t.target!==e.target||t.sourceHandle!==e.sourceHandle&&(t.sourceHandle||e.sourceHandle)||t.targetHandle!==e.targetHandle&&(t.targetHandle||e.targetHandle)))))(n,t)?t:t.concat(n)})(r,e))}null==n||n(r),null==l||l(r)},j=e=>{if(!w)return;const t=$C(e);a&&(t&&0===e.button||!t)&&VE({event:e,handleId:x,nodeId:w,onConnect:S,isTarget:y,getState:b.getState,setState:b.setState,isValidConnection:n||b.getState().isValidConnection||GE}),t?null==h||h(e):null==m||m(e)};return u.createElement("div",{"data-handleid":x,"data-nodeid":w,"data-handlepos":t,"data-id":`${w}-${x}-${e}`,className:LN(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",N,d,{source:!y,target:y,connectable:o,connectablestart:a,connectableend:s,connecting:E,connectionindicator:o&&(a&&!C||s&&C)}]),onMouseDown:j,onTouchStart:j,onClick:k?t=>{const{onClickConnectStart:o,onClickConnectEnd:r,connectionClickStartHandle:s,connectionMode:i,isValidConnection:l}=b.getState();if(!w||!s&&!a)return;if(!s)return null==o||o(t,{nodeId:w,handleId:x,handleType:e}),void b.setState({connectionClickStartHandle:{nodeId:w,type:e,handleId:x}});const c=RC(t.target),d=n||l||GE,{connection:u,isValid:h}=LE({nodeId:w,id:x,type:e},i,s.nodeId,s.handleId||null,s.type,d,c);h&&S(u),null==r||r(t),b.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f},c)}));HE.displayName="Handle";var WE=r.memo(HE);const qE=({data:e,isConnectable:t,targetPosition:n=iE.Top,sourcePosition:o=iE.Bottom})=>u.createElement(u.Fragment,null,u.createElement(WE,{type:"target",position:n,isConnectable:t}),null==e?void 0:e.label,u.createElement(WE,{type:"source",position:o,isConnectable:t}));qE.displayName="DefaultNode";var YE=r.memo(qE);const XE=({data:e,isConnectable:t,sourcePosition:n=iE.Bottom})=>u.createElement(u.Fragment,null,null==e?void 0:e.label,u.createElement(WE,{type:"source",position:n,isConnectable:t}));XE.displayName="InputNode";var KE=r.memo(XE);const JE=({data:e,isConnectable:t,targetPosition:n=iE.Top})=>u.createElement(u.Fragment,null,u.createElement(WE,{type:"target",position:n,isConnectable:t}),null==e?void 0:e.label);JE.displayName="OutputNode";var ZE=r.memo(JE);const QE=()=>null;QE.displayName="GroupNode";const eS=e=>({selectedNodes:e.getNodes().filter((e=>e.selected)),selectedEdges:e.edges.filter((e=>e.selected)).map((e=>({...e})))}),tS=e=>e.id;function nS(e,t){return $N(e.selectedNodes.map(tS),t.selectedNodes.map(tS))&&$N(e.selectedEdges.map(tS),t.selectedEdges.map(tS))}const oS=r.memo((({onSelectionChange:e})=>{const t=SC(),{selectedNodes:n,selectedEdges:o}=EC(eS,nS);return r.useEffect((()=>{const r={nodes:n,edges:o};null==e||e(r),t.getState().onSelectionChange.forEach((e=>e(r)))}),[n,o,e]),null}));oS.displayName="SelectionListener";const rS=e=>!!e.onSelectionChange;function aS({onSelectionChange:e}){const t=EC(rS);return e||t?u.createElement(oS,{onSelectionChange:e}):null}const sS=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function iS(e,t){r.useEffect((()=>{void 0!==e&&t(e)}),[e])}function lS(e,t,n){r.useEffect((()=>{void 0!==t&&n({[e]:t})}),[t])}const cS=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:a,onConnectStart:s,onConnectEnd:i,onClickConnectStart:l,onClickConnectEnd:c,nodesDraggable:d,nodesConnectable:u,nodesFocusable:h,edgesFocusable:m,edgesUpdatable:f,elevateNodesOnSelect:p,minZoom:g,maxZoom:v,nodeExtent:x,onNodesChange:y,onEdgesChange:b,elementsSelectable:w,connectionMode:k,snapGrid:N,snapToGrid:C,translateExtent:E,connectOnClick:S,defaultEdgeOptions:j,fitView:_,fitViewOptions:I,onNodesDelete:A,onEdgesDelete:M,onNodeDrag:T,onNodeDragStart:O,onNodeDragStop:D,onSelectionDrag:P,onSelectionDragStart:R,onSelectionDragStop:F,noPanClassName:L,nodeOrigin:z,rfId:B,autoPanOnConnect:U,autoPanOnNodeDrag:V,onError:G,connectionRadius:$,isValidConnection:H,nodeDragThreshold:W})=>{const{setNodes:q,setEdges:Y,setDefaultNodesAndEdges:X,setMinZoom:K,setMaxZoom:J,setTranslateExtent:Z,setNodeExtent:Q,reset:ee}=EC(sS,$N),te=SC();return r.useEffect((()=>{const e=null==o?void 0:o.map((e=>({...e,...j})));return X(n,e),()=>{ee()}}),[]),lS("defaultEdgeOptions",j,te.setState),lS("connectionMode",k,te.setState),lS("onConnect",a,te.setState),lS("onConnectStart",s,te.setState),lS("onConnectEnd",i,te.setState),lS("onClickConnectStart",l,te.setState),lS("onClickConnectEnd",c,te.setState),lS("nodesDraggable",d,te.setState),lS("nodesConnectable",u,te.setState),lS("nodesFocusable",h,te.setState),lS("edgesFocusable",m,te.setState),lS("edgesUpdatable",f,te.setState),lS("elementsSelectable",w,te.setState),lS("elevateNodesOnSelect",p,te.setState),lS("snapToGrid",C,te.setState),lS("snapGrid",N,te.setState),lS("onNodesChange",y,te.setState),lS("onEdgesChange",b,te.setState),lS("connectOnClick",S,te.setState),lS("fitViewOnInit",_,te.setState),lS("fitViewOnInitOptions",I,te.setState),lS("onNodesDelete",A,te.setState),lS("onEdgesDelete",M,te.setState),lS("onNodeDrag",T,te.setState),lS("onNodeDragStart",O,te.setState),lS("onNodeDragStop",D,te.setState),lS("onSelectionDrag",P,te.setState),lS("onSelectionDragStart",R,te.setState),lS("onSelectionDragStop",F,te.setState),lS("noPanClassName",L,te.setState),lS("nodeOrigin",z,te.setState),lS("rfId",B,te.setState),lS("autoPanOnConnect",U,te.setState),lS("autoPanOnNodeDrag",V,te.setState),lS("onError",G,te.setState),lS("connectionRadius",$,te.setState),lS("isValidConnection",H,te.setState),lS("nodeDragThreshold",W,te.setState),iS(e,q),iS(t,Y),iS(g,K),iS(v,J),iS(E,Z),iS(x,Q),null},dS={display:"none"},uS={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},hS="react-flow__node-desc",mS="react-flow__edge-desc",fS=e=>e.ariaLiveMessage;function pS({rfId:e}){const t=EC(fS);return u.createElement("div",{id:`react-flow__aria-live-${e}`,"aria-live":"assertive","aria-atomic":"true",style:uS},t)}function gS({rfId:e,disableKeyboardA11y:t}){return u.createElement(u.Fragment,null,u.createElement("div",{id:`${hS}-${e}`,style:dS},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),u.createElement("div",{id:`${mS}-${e}`,style:dS},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&u.createElement(pS,{rfId:e}))}var vS=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,o]=r.useState(!1),a=r.useRef(!1),s=r.useRef(new Set([])),[i,l]=r.useMemo((()=>{if(null!==e){const t=(Array.isArray(e)?e:[e]).filter((e=>"string"==typeof e)).map((e=>e.split("+"))),n=t.reduce(((e,t)=>e.concat(...t)),[]);return[t,n]}return[[],[]]}),[e]);return r.useEffect((()=>{const n="undefined"!=typeof document?document:null,r=(null==t?void 0:t.target)||n;if(null!==e){const e=e=>{a.current=e.ctrlKey||e.metaKey||e.shiftKey;if((!a.current||a.current&&!t.actInsideInputWithModifier)&&GC(e))return!1;const n=yS(e.code,l);s.current.add(e[n]),xS(i,s.current,!1)&&(e.preventDefault(),o(!0))},n=e=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&GC(e))return!1;const n=yS(e.code,l);xS(i,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(e[n]),"Meta"===e.key&&s.current.clear(),a.current=!1},c=()=>{s.current.clear(),o(!1)};return null==r||r.addEventListener("keydown",e),null==r||r.addEventListener("keyup",n),window.addEventListener("blur",c),()=>{null==r||r.removeEventListener("keydown",e),null==r||r.removeEventListener("keyup",n),window.removeEventListener("blur",c)}}}),[e,o]),n};function xS(e,t,n){return e.filter((e=>n||e.length===t.size)).some((e=>e.every((e=>t.has(e)))))}function yS(e,t){return t.includes(e)?"code":"key"}function bS(e,t,n,o){var r,a;const s=e.parentNode||e.parentId;if(!s)return n;const i=t.get(s),l=IE(i,o);return bS(i,t,{x:(n.x??0)+l.x,y:(n.y??0)+l.y,z:((null==(r=i[UC])?void 0:r.z)??0)>(n.z??0)?(null==(a=i[UC])?void 0:a.z)??0:n.z??0},o)}function wS(e,t,n){e.forEach((o=>{var r;const a=o.parentNode||o.parentId;if(a&&!e.has(a))throw new Error(`Parent node ${a} not found`);if(a||(null==n?void 0:n[o.id])){const{x:a,y:s,z:i}=bS(o,e,{...o.position,z:(null==(r=o[UC])?void 0:r.z)??0},t);o.positionAbsolute={x:a,y:s},o[UC].z=i,(null==n?void 0:n[o.id])&&(o[UC].isParent=!0)}}))}function kS(e,t,n,o){const r=new Map,a={},s=o?1e3:0;return e.forEach((e=>{var n;const o=(BC(e.zIndex)?e.zIndex:0)+(e.selected?s:0),i=t.get(e.id),l={...e,positionAbsolute:{x:e.position.x,y:e.position.y}},c=e.parentNode||e.parentId;c&&(a[c]=!0);const d=(null==i?void 0:i.type)&&(null==i?void 0:i.type)!==e.type;Object.defineProperty(l,UC,{enumerable:!1,value:{handleBounds:d||null==(n=null==i?void 0:i[UC])?void 0:n.handleBounds,z:o}}),r.set(e.id,l)})),wS(r,n,a),r}function NS(e,t={}){const{getNodes:n,width:o,height:r,minZoom:a,maxZoom:s,d3Zoom:i,d3Selection:l,fitViewOnInitDone:c,fitViewOnInit:d,nodeOrigin:u}=e(),h=t.initial&&!c&&d;if(i&&l&&(h||!t.initial)){const e=n().filter((e=>{var n;const o=t.includeHiddenNodes?e.width&&e.height:!e.hidden;return(null==(n=t.nodes)?void 0:n.length)?o&&t.nodes.some((t=>t.id===e.id)):o})),c=e.every((e=>e.width&&e.height));if(e.length>0&&c){const n=AE(e,u),{x:c,y:d,zoom:h}=OE(n,o,r,t.minZoom??a,t.maxZoom??s,t.padding??.1),m=_l.translate(c,d).scale(h);return"number"==typeof t.duration&&t.duration>0?i.transform(DE(l,t.duration),m):i.transform(l,m),!0}}return!1}function CS(e,t){return e.forEach((e=>{const n=t.get(e.id);n&&t.set(n.id,{...n,[UC]:n[UC],selected:e.selected})})),new Map(t)}function ES(e,t){return t.map((t=>{const n=e.find((e=>e.id===t.id));return n&&(t.selected=n.selected),t}))}function SS({changedNodes:e,changedEdges:t,get:n,set:o}){const{nodeInternals:r,edges:a,onNodesChange:s,onEdgesChange:i,hasDefaultNodes:l,hasDefaultEdges:c}=n();(null==e?void 0:e.length)&&(l&&o({nodeInternals:CS(e,r)}),null==s||s(e)),(null==t?void 0:t.length)&&(c&&o({edges:ES(t,a)}),null==i||i(t))}const jS=()=>{},_S={zoomIn:jS,zoomOut:jS,zoomTo:jS,getZoom:()=>1,setViewport:jS,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:jS,fitBounds:jS,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},IS=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection});function AS(){const e=(()=>{const e=SC(),{d3Zoom:t,d3Selection:n}=EC(IS,$N);return r.useMemo((()=>n&&t?{zoomIn:e=>t.scaleBy(DE(n,null==e?void 0:e.duration),1.2),zoomOut:e=>t.scaleBy(DE(n,null==e?void 0:e.duration),1/1.2),zoomTo:(e,o)=>t.scaleTo(DE(n,null==o?void 0:o.duration),e),getZoom:()=>e.getState().transform[2],setViewport:(o,r)=>{const[a,s,i]=e.getState().transform,l=_l.translate(o.x??a,o.y??s).scale(o.zoom??i);t.transform(DE(n,null==r?void 0:r.duration),l)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},fitView:t=>NS(e.getState,t),setCenter:(o,r,a)=>{const{width:s,height:i,maxZoom:l}=e.getState(),c=void 0!==(null==a?void 0:a.zoom)?a.zoom:l,d=s/2-o*c,u=i/2-r*c,h=_l.translate(d,u).scale(c);t.transform(DE(n,null==a?void 0:a.duration),h)},fitBounds:(o,r)=>{const{width:a,height:s,minZoom:i,maxZoom:l}=e.getState(),{x:c,y:d,zoom:u}=OE(o,a,s,i,l,(null==r?void 0:r.padding)??.1),h=_l.translate(c,d).scale(u);t.transform(DE(n,null==r?void 0:r.duration),h)},project:t=>{const{transform:n,snapToGrid:o,snapGrid:r}=e.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"),jE(t,n,o,r)},screenToFlowPosition:t=>{const{transform:n,snapToGrid:o,snapGrid:r,domNode:a}=e.getState();if(!a)return t;const{x:s,y:i}=a.getBoundingClientRect(),l={x:t.x-s,y:t.y-i};return jE(l,n,o,r)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:a}=o.getBoundingClientRect(),s=_E(t,n);return{x:s.x+r,y:s.y+a}},viewportInitialized:!0}:_S),[t,n])})(),t=SC(),n=r.useCallback((()=>t.getState().getNodes().map((e=>({...e})))),[]),o=r.useCallback((e=>t.getState().nodeInternals.get(e)),[]),a=r.useCallback((()=>{const{edges:e=[]}=t.getState();return e.map((e=>({...e})))}),[]),s=r.useCallback((e=>{const{edges:n=[]}=t.getState();return n.find((t=>t.id===e))}),[]),i=r.useCallback((e=>{const{getNodes:n,setNodes:o,hasDefaultNodes:r,onNodesChange:a}=t.getState(),s=n(),i="function"==typeof e?e(s):e;if(r)o(i);else if(a){a(0===i.length?s.map((e=>({type:"remove",id:e.id}))):i.map((e=>({item:e,type:"reset"}))))}}),[]),l=r.useCallback((e=>{const{edges:n=[],setEdges:o,hasDefaultEdges:r,onEdgesChange:a}=t.getState(),s="function"==typeof e?e(n):e;if(r)o(s);else if(a){a(0===s.length?n.map((e=>({type:"remove",id:e.id}))):s.map((e=>({item:e,type:"reset"}))))}}),[]),c=r.useCallback((e=>{const n=Array.isArray(e)?e:[e],{getNodes:o,setNodes:r,hasDefaultNodes:a,onNodesChange:s}=t.getState();if(a){r([...o(),...n])}else if(s){s(n.map((e=>({item:e,type:"add"}))))}}),[]),d=r.useCallback((e=>{const n=Array.isArray(e)?e:[e],{edges:o=[],setEdges:r,hasDefaultEdges:a,onEdgesChange:s}=t.getState();if(a)r([...o,...n]);else if(s){s(n.map((e=>({item:e,type:"add"}))))}}),[]),u=r.useCallback((()=>{const{getNodes:e,edges:n=[],transform:o}=t.getState(),[r,a,s]=o;return{nodes:e().map((e=>({...e}))),edges:n.map((e=>({...e}))),viewport:{x:r,y:a,zoom:s}}}),[]),h=r.useCallback((({nodes:e,edges:n})=>{const{nodeInternals:o,getNodes:r,edges:a,hasDefaultNodes:s,hasDefaultEdges:i,onNodesDelete:l,onEdgesDelete:c,onNodesChange:d,onEdgesChange:u}=t.getState(),h=(e||[]).map((e=>e.id)),m=(n||[]).map((e=>e.id)),f=r().reduce(((e,t)=>{const n=t.parentNode||t.parentId,o=!h.includes(t.id)&&n&&e.find((e=>e.id===n));return("boolean"!=typeof t.deletable||t.deletable)&&(h.includes(t.id)||o)&&e.push(t),e}),[]),p=a.filter((e=>"boolean"!=typeof e.deletable||e.deletable)),g=p.filter((e=>m.includes(e.id)));if(f||g){const e=TE(f,p),n=[...g,...e],r=n.reduce(((e,t)=>(e.includes(t.id)||e.push(t.id),e)),[]);if((i||s)&&(i&&t.setState({edges:a.filter((e=>!r.includes(e.id)))}),s&&(f.forEach((e=>{o.delete(e.id)})),t.setState({nodeInternals:new Map(o)}))),r.length>0&&(null==c||c(n),u&&u(r.map((e=>({id:e,type:"remove"}))))),f.length>0&&(null==l||l(f),d)){d(f.map((e=>({id:e.id,type:"remove"}))))}}}),[]),m=r.useCallback((e=>{const n=BC((o=e).width)&&BC(o.height)&&BC(o.x)&&BC(o.y);var o;const r=n?null:t.getState().nodeInternals.get(e.id);if(!n&&!r)return[null,null,n];return[n?e:LC(r),r,n]}),[]),f=r.useCallback(((e,n=!0,o)=>{const[r,a,s]=m(e);return r?(o||t.getState().getNodes()).filter((e=>{if(!(s||e.id!==a.id&&e.positionAbsolute))return!1;const t=LC(e),o=zC(t,r);return n&&o>0||o>=r.width*r.height})):[]}),[]),p=r.useCallback(((e,t,n=!0)=>{const[o]=m(e);if(!o)return!1;const r=zC(o,t);return n&&r>0||r>=o.width*o.height}),[]);return r.useMemo((()=>({...e,getNodes:n,getNode:o,getEdges:a,getEdge:s,setNodes:i,setEdges:l,addNodes:c,addEdges:d,toObject:u,deleteElements:h,getIntersectingNodes:f,isNodeIntersecting:p})),[e,n,o,a,s,i,l,c,d,u,h,f,p])}const MS={actInsideInputWithModifier:!1};const TS={position:"absolute",width:"100%",height:"100%",top:0,left:0},OS=e=>({x:e.x,y:e.y,zoom:e.k}),DS=(e,t)=>e.target.closest(`.${t}`),PS=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),RS=e=>{const t=e.ctrlKey&&WC()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t},FS=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),LS=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:a=!0,zoomOnPinch:s=!0,panOnScroll:i=!1,panOnScrollSpeed:l=.5,panOnScrollMode:c=QC.Free,zoomOnDoubleClick:d=!0,elementsSelectable:h,panOnDrag:m=!0,defaultViewport:f,translateExtent:p,minZoom:g,maxZoom:v,zoomActivationKeyCode:x,preventScrolling:y=!0,children:b,noWheelClassName:w,noPanClassName:k})=>{const N=r.useRef(),C=SC(),E=r.useRef(!1),S=r.useRef(!1),j=r.useRef(null),_=r.useRef({x:0,y:0,zoom:0}),{d3Zoom:I,d3Selection:A,d3ZoomHandler:M,userSelectionActive:T}=EC(FS,$N),O=vS(x),D=r.useRef(0),P=r.useRef(!1),R=r.useRef();return function(e){const t=SC();r.useEffect((()=>{let n;const o=()=>{var n,o;if(!e.current)return;const r=MC(e.current);0!==r.height&&0!==r.width||null==(o=(n=t.getState()).onError)||o.call(n,"004",vC()),t.setState({width:r.width||500,height:r.height||500})};return o(),window.addEventListener("resize",o),e.current&&(n=new ResizeObserver((()=>o())),n.observe(e.current)),()=>{window.removeEventListener("resize",o),n&&e.current&&n.unobserve(e.current)}}),[])}(j),r.useEffect((()=>{if(j.current){const e=j.current.getBoundingClientRect(),t=function(){var e,t,n,o=lC,r=cC,a=mC,s=uC,i=hC,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],d=250,u=Tl,h=Ml("start","zoom","end"),m=0,f=10;function p(e){e.property("__zoom",dC).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",N).on("dblclick.zoom",C).filter(i).on("touchstart.zoom",E).on("touchmove.zoom",S).on("touchend.zoom touchcancel.zoom",j).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(e,t){return(t=Math.max(l[0],Math.min(l[1],t)))===e.k?e:new Il(t,e.x,e.y)}function v(e,t,n){var o=t[0]-n[0]*e.k,r=t[1]-n[1]*e.k;return o===e.x&&r===e.y?e:new Il(e.k,o,r)}function x(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function y(e,t,n,o){e.on("start.zoom",(function(){b(this,arguments).event(o).start()})).on("interrupt.zoom end.zoom",(function(){b(this,arguments).event(o).end()})).tween("zoom",(function(){var e=this,a=arguments,s=b(e,a).event(o),i=r.apply(e,a),l=null==n?x(i):"function"==typeof n?n.apply(e,a):n,c=Math.max(i[1][0]-i[0][0],i[1][1]-i[0][1]),d=e.__zoom,h="function"==typeof t?t.apply(e,a):t,m=u(d.invert(l).concat(c/d.k),h.invert(l).concat(c/h.k));return function(e){if(1===e)e=h;else{var t=m(e),n=c/t[2];e=new Il(n,l[0]-t[0]*n,l[1]-t[1]*n)}s.zoom(null,e)}}))}function b(e,t,n){return!n&&e.__zooming||new w(e,t)}function w(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=r.apply(e,t),this.taps=0}function k(e,...t){if(o.apply(this,arguments)){var n=b(this,t).event(e),r=this.__zoom,i=Math.max(l[0],Math.min(l[1],r.k*Math.pow(2,s.apply(this,arguments)))),d=HN(e);if(n.wheel)n.mouse[0][0]===d[0]&&n.mouse[0][1]===d[1]||(n.mouse[1]=r.invert(n.mouse[0]=d)),clearTimeout(n.wheel);else{if(r.k===i)return;n.mouse=[d,r.invert(d)],Al(this),n.start()}iC(e),n.wheel=setTimeout((function(){n.wheel=null,n.end()}),150),n.zoom("mouse",a(v(g(r,i),n.mouse[0],n.mouse[1]),n.extent,c))}}function N(e,...t){if(!n&&o.apply(this,arguments)){var r=e.currentTarget,s=b(this,t,!0).event(e),i=jl(e.view).on("mousemove.zoom",(function(e){if(iC(e),!s.moved){var t=e.clientX-d,n=e.clientY-u;s.moved=t*t+n*n>m}s.event(e).zoom("mouse",a(v(s.that.__zoom,s.mouse[0]=HN(e,r),s.mouse[1]),s.extent,c))}),!0).on("mouseup.zoom",(function(e){i.on("mousemove.zoom mouseup.zoom",null),JN(e.view,s.moved),iC(e),s.event(e).end()}),!0),l=HN(e,r),d=e.clientX,u=e.clientY;KN(e.view),sC(e),s.mouse=[l,this.__zoom.invert(l)],Al(this),s.start()}}function C(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,s=HN(e.changedTouches?e.changedTouches[0]:e,this),i=n.invert(s),l=n.k*(e.shiftKey?.5:2),u=a(v(g(n,l),s,i),r.apply(this,t),c);iC(e),d>0?jl(this).transition().duration(d).call(y,u,s,e):jl(this).call(p.transform,u,s,e)}}function E(n,...r){if(o.apply(this,arguments)){var a,s,i,l,c=n.touches,d=c.length,u=b(this,r,n.changedTouches.length===d).event(n);for(sC(n),s=0;s<d;++s)l=[l=HN(i=c[s],this),this.__zoom.invert(l),i.identifier],u.touch0?u.touch1||u.touch0[2]===l[2]||(u.touch1=l,u.taps=0):(u.touch0=l,a=!0,u.taps=1+!!e);e&&(e=clearTimeout(e)),a&&(u.taps<2&&(t=l[0],e=setTimeout((function(){e=null}),500)),Al(this),u.start())}}function S(e,...t){if(this.__zooming){var n,o,r,s,i=b(this,t).event(e),l=e.changedTouches,d=l.length;for(iC(e),n=0;n<d;++n)r=HN(o=l[n],this),i.touch0&&i.touch0[2]===o.identifier?i.touch0[0]=r:i.touch1&&i.touch1[2]===o.identifier&&(i.touch1[0]=r);if(o=i.that.__zoom,i.touch1){var u=i.touch0[0],h=i.touch0[1],m=i.touch1[0],f=i.touch1[1],p=(p=m[0]-u[0])*p+(p=m[1]-u[1])*p,x=(x=f[0]-h[0])*x+(x=f[1]-h[1])*x;o=g(o,Math.sqrt(p/x)),r=[(u[0]+m[0])/2,(u[1]+m[1])/2],s=[(h[0]+f[0])/2,(h[1]+f[1])/2]}else{if(!i.touch0)return;r=i.touch0[0],s=i.touch0[1]}i.zoom("touch",a(v(o,r,s),i.extent,c))}}function j(e,...o){if(this.__zooming){var r,a,s=b(this,o).event(e),i=e.changedTouches,l=i.length;for(sC(e),n&&clearTimeout(n),n=setTimeout((function(){n=null}),500),r=0;r<l;++r)a=i[r],s.touch0&&s.touch0[2]===a.identifier?delete s.touch0:s.touch1&&s.touch1[2]===a.identifier&&delete s.touch1;if(s.touch1&&!s.touch0&&(s.touch0=s.touch1,delete s.touch1),s.touch0)s.touch0[1]=this.__zoom.invert(s.touch0[0]);else if(s.end(),2===s.taps&&(a=HN(a,this),Math.hypot(t[0]-a[0],t[1]-a[1])<f)){var c=jl(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return p.transform=function(e,t,n,o){var r=e.selection?e.selection():e;r.property("__zoom",dC),e!==r?y(e,t,n,o):r.interrupt().each((function(){b(this,arguments).event(o).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()}))},p.scaleBy=function(e,t,n,o){p.scaleTo(e,(function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)}),n,o)},p.scaleTo=function(e,t,n,o){p.transform(e,(function(){var e=r.apply(this,arguments),o=this.__zoom,s=null==n?x(e):"function"==typeof n?n.apply(this,arguments):n,i=o.invert(s),l="function"==typeof t?t.apply(this,arguments):t;return a(v(g(o,l),s,i),e,c)}),n,o)},p.translateBy=function(e,t,n,o){p.transform(e,(function(){return a(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),r.apply(this,arguments),c)}),null,o)},p.translateTo=function(e,t,n,o,s){p.transform(e,(function(){var e=r.apply(this,arguments),s=this.__zoom,i=null==o?x(e):"function"==typeof o?o.apply(this,arguments):o;return a(_l.translate(i[0],i[1]).scale(s.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,c)}),o,s)},w.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=jl(this.that).datum();h.call(e,this.that,new aC(e,{sourceEvent:this.sourceEvent,target:p,type:e,transform:this.that.__zoom,dispatch:h}),t)}},p.wheelDelta=function(e){return arguments.length?(s="function"==typeof e?e:rC(+e),p):s},p.filter=function(e){return arguments.length?(o="function"==typeof e?e:rC(!!e),p):o},p.touchable=function(e){return arguments.length?(i="function"==typeof e?e:rC(!!e),p):i},p.extent=function(e){return arguments.length?(r="function"==typeof e?e:rC([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),p):r},p.scaleExtent=function(e){return arguments.length?(l[0]=+e[0],l[1]=+e[1],p):[l[0],l[1]]},p.translateExtent=function(e){return arguments.length?(c[0][0]=+e[0][0],c[1][0]=+e[1][0],c[0][1]=+e[0][1],c[1][1]=+e[1][1],p):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},p.constrain=function(e){return arguments.length?(a=e,p):a},p.duration=function(e){return arguments.length?(d=+e,p):d},p.interpolate=function(e){return arguments.length?(u=e,p):u},p.on=function(){var e=h.on.apply(h,arguments);return e===h?p:e},p.clickDistance=function(e){return arguments.length?(m=(e=+e)*e,p):Math.sqrt(m)},p.tapDistance=function(e){return arguments.length?(f=+e,p):f},p}().scaleExtent([g,v]).translateExtent(p),n=jl(j.current).call(t),o=_l.translate(f.x,f.y).scale(TC(f.zoom,g,v)),r=[[0,0],[e.width,e.height]],a=t.constrain()(o,r,p);t.transform(n,a),t.wheelDelta(RS),C.setState({d3Zoom:t,d3Selection:n,d3ZoomHandler:n.on("wheel.zoom"),transform:[a.x,a.y,a.k],domNode:j.current.closest(".react-flow")})}}),[]),r.useEffect((()=>{A&&I&&(!i||O||T?void 0!==M&&A.on("wheel.zoom",(function(e,t){if(!y&&"wheel"===e.type&&!e.ctrlKey||DS(e,w))return null;e.preventDefault(),M.call(this,e,t)}),{passive:!1}):A.on("wheel.zoom",(o=>{if(DS(o,w))return!1;o.preventDefault(),o.stopImmediatePropagation();const r=A.property("__zoom").k||1;if(o.ctrlKey&&s){const e=HN(o),t=RS(o),n=r*Math.pow(2,t);return void I.scaleTo(A,n,e,o)}const a=1===o.deltaMode?20:1;let i=c===QC.Vertical?0:o.deltaX*a,d=c===QC.Horizontal?0:o.deltaY*a;!WC()&&o.shiftKey&&c!==QC.Vertical&&(i=o.deltaY*a,d=0),I.translateBy(A,-i/r*l,-d/r*l,{internal:!0});const u=OS(A.property("__zoom")),{onViewportChangeStart:h,onViewportChange:m,onViewportChangeEnd:f}=C.getState();clearTimeout(R.current),P.current||(P.current=!0,null==t||t(o,u),null==h||h(u)),P.current&&(null==e||e(o,u),null==m||m(u),R.current=setTimeout((()=>{null==n||n(o,u),null==f||f(u),P.current=!1}),150))}),{passive:!1}))}),[T,i,c,A,I,M,O,s,y,w,t,e,n]),r.useEffect((()=>{I&&I.on("start",(e=>{var n,o;if(!e.sourceEvent||e.sourceEvent.internal)return null;D.current=null==(n=e.sourceEvent)?void 0:n.button;const{onViewportChangeStart:r}=C.getState(),a=OS(e.transform);E.current=!0,_.current=a,"mousedown"===(null==(o=e.sourceEvent)?void 0:o.type)&&C.setState({paneDragging:!0}),null==r||r(a),null==t||t(e.sourceEvent,a)}))}),[I,t]),r.useEffect((()=>{I&&(T&&!E.current?I.on("zoom",null):T||I.on("zoom",(t=>{var n;const{onViewportChange:r}=C.getState();if(C.setState({transform:[t.transform.x,t.transform.y,t.transform.k]}),S.current=!(!o||!PS(m,D.current??0)),(e||r)&&!(null==(n=t.sourceEvent)?void 0:n.internal)){const n=OS(t.transform);null==r||r(n),null==e||e(t.sourceEvent,n)}})))}),[T,I,e,m,o]),r.useEffect((()=>{I&&I.on("end",(e=>{if(!e.sourceEvent||e.sourceEvent.internal)return null;const{onViewportChangeEnd:t}=C.getState();if(E.current=!1,C.setState({paneDragging:!1}),o&&PS(m,D.current??0)&&!S.current&&o(e.sourceEvent),S.current=!1,(n||t)&&(r=_.current,a=e.transform,r.x!==a.x||r.y!==a.y||r.zoom!==a.k)){const o=OS(e.transform);_.current=o,clearTimeout(N.current),N.current=setTimeout((()=>{null==t||t(o),null==n||n(e.sourceEvent,o)}),i?150:0)}var r,a}))}),[I,i,m,n,o]),r.useEffect((()=>{I&&I.filter((e=>{const t=O||a,n=s&&e.ctrlKey;if((!0===m||Array.isArray(m)&&m.includes(1))&&1===e.button&&"mousedown"===e.type&&(DS(e,"react-flow__node")||DS(e,"react-flow__edge")))return!0;if(!(m||t||i||d||s))return!1;if(T)return!1;if(!d&&"dblclick"===e.type)return!1;if(DS(e,w)&&"wheel"===e.type)return!1;if(DS(e,k)&&("wheel"!==e.type||i&&"wheel"===e.type&&!O))return!1;if(!s&&e.ctrlKey&&"wheel"===e.type)return!1;if(!t&&!i&&!n&&"wheel"===e.type)return!1;if(!m&&("mousedown"===e.type||"touchstart"===e.type))return!1;if(Array.isArray(m)&&!m.includes(e.button)&&"mousedown"===e.type)return!1;const o=Array.isArray(m)&&m.includes(e.button)||!e.button||e.button<=1;return(!e.ctrlKey||"wheel"===e.type)&&o}))}),[T,I,a,s,i,d,m,h,O]),u.createElement("div",{className:"react-flow__renderer",ref:j,style:TS},b)},zS=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function BS(){const{userSelectionActive:e,userSelectionRect:t}=EC(zS,$N);return e&&t?u.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function US(e,t){const n=t.parentNode||t.parentId,o=e.find((e=>e.id===n));if(o){const e=t.position.x+t.width-o.width,n=t.position.y+t.height-o.height;if(e>0||n>0||t.position.x<0||t.position.y<0){if(o.style={...o.style},o.style.width=o.style.width??o.width,o.style.height=o.style.height??o.height,e>0&&(o.style.width+=e),n>0&&(o.style.height+=n),t.position.x<0){const e=Math.abs(t.position.x);o.position.x=o.position.x-e,o.style.width+=e,t.position.x=0}if(t.position.y<0){const e=Math.abs(t.position.y);o.position.y=o.position.y-e,o.style.height+=e,t.position.y=0}o.width=o.style.width,o.height=o.style.height}}}function VS(e,t){if(e.some((e=>"reset"===e.type)))return e.filter((e=>"reset"===e.type)).map((e=>e.item));const n=e.filter((e=>"add"===e.type)).map((e=>e.item));return t.reduce(((t,n)=>{const o=e.filter((e=>e.id===n.id));if(0===o.length)return t.push(n),t;const r={...n};for(const e of o)if(e)switch(e.type){case"select":r.selected=e.selected;break;case"position":void 0!==e.position&&(r.position=e.position),void 0!==e.positionAbsolute&&(r.positionAbsolute=e.positionAbsolute),void 0!==e.dragging&&(r.dragging=e.dragging),r.expandParent&&US(t,r);break;case"dimensions":void 0!==e.dimensions&&(r.width=e.dimensions.width,r.height=e.dimensions.height),void 0!==e.updateStyle&&(r.style={...r.style||{},...e.dimensions}),"boolean"==typeof e.resizing&&(r.resizing=e.resizing),r.expandParent&&US(t,r);break;case"remove":return t}return t.push(r),t}),n)}function GS(e,t){return VS(e,t)}const $S=(e,t)=>({id:e,type:"select",selected:t});function HS(e,t){return e.reduce(((e,n)=>{const o=t.includes(n.id);return!n.selected&&o?(n.selected=!0,e.push($S(n.id,!0))):n.selected&&!o&&(n.selected=!1,e.push($S(n.id,!1))),e}),[])}const WS=(e,t)=>n=>{n.target===t.current&&(null==e||e(n))},qS=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),YS=r.memo((({isSelecting:e,selectionMode:t=tE.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:a,onPaneClick:s,onPaneContextMenu:i,onPaneScroll:l,onPaneMouseEnter:c,onPaneMouseMove:d,onPaneMouseLeave:h,children:m})=>{const f=r.useRef(null),p=SC(),g=r.useRef(0),v=r.useRef(0),x=r.useRef(),{userSelectionActive:y,elementsSelectable:b,dragging:w}=EC(qS,$N),k=()=>{p.setState({userSelectionActive:!1,userSelectionRect:null}),g.current=0,v.current=0},N=e=>{null==s||s(e),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},C=l?e=>l(e):void 0,E=b&&(e||y);return u.createElement("div",{className:LN(["react-flow__pane",{dragging:w,selection:e}]),onClick:E?void 0:WS(N,f),onContextMenu:WS((e=>{Array.isArray(n)&&(null==n?void 0:n.includes(2))?e.preventDefault():null==i||i(e)}),f),onWheel:WS(C,f),onMouseEnter:E?void 0:c,onMouseDown:E?t=>{const{resetSelectedElements:n,domNode:r}=p.getState();if(x.current=null==r?void 0:r.getBoundingClientRect(),!b||!e||0!==t.button||t.target!==f.current||!x.current)return;const{x:a,y:s}=HC(t,x.current);n(),p.setState({userSelectionRect:{width:0,height:0,startX:a,startY:s,x:a,y:s}}),null==o||o(t)}:void 0,onMouseMove:E?n=>{const{userSelectionRect:o,nodeInternals:r,edges:a,transform:s,onNodesChange:i,onEdgesChange:l,nodeOrigin:c,getNodes:d}=p.getState();if(!e||!x.current||!o)return;p.setState({userSelectionActive:!0,nodesSelectionActive:!1});const u=HC(n,x.current),h=o.startX??0,m=o.startY??0,f={...o,x:u.x<h?u.x:h,y:u.y<m?u.y:m,width:Math.abs(u.x-h),height:Math.abs(u.y-m)},y=d(),b=ME(r,f,s,t===tE.Partial,!0,c),w=TE(b,a).map((e=>e.id)),k=b.map((e=>e.id));if(g.current!==k.length){g.current=k.length;const e=HS(y,k);e.length&&(null==i||i(e))}if(v.current!==w.length){v.current=w.length;const e=HS(a,w);e.length&&(null==l||l(e))}p.setState({userSelectionRect:f})}:d,onMouseUp:E?e=>{if(0!==e.button)return;const{userSelectionRect:t}=p.getState();!y&&t&&e.target===f.current&&(null==N||N(e)),p.setState({nodesSelectionActive:g.current>0}),k(),null==a||a(e)}:void 0,onMouseLeave:E?e=>{y&&(p.setState({nodesSelectionActive:g.current>0}),null==a||a(e)),k()}:h,ref:f,style:TS},m,u.createElement(BS,null))}));function XS(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const o=t.get(n);return!!o&&(!!o.selected||XS(o,t))}function KS(e,t,n){let o=e;do{if(null==o?void 0:o.matches(t))return!0;if(o===n.current)return!1;o=o.parentElement}while(o);return!1}function JS(e,t,n,o){return Array.from(e.values()).filter((n=>(n.selected||n.id===o)&&(!n.parentNode||n.parentId||!XS(n,e))&&(n.draggable||t&&void 0===n.draggable))).map((e=>{var t,o;return{id:e.id,position:e.position||{x:0,y:0},positionAbsolute:e.positionAbsolute||{x:0,y:0},distance:{x:n.x-((null==(t=e.positionAbsolute)?void 0:t.x)??0),y:n.y-((null==(o=e.positionAbsolute)?void 0:o.y)??0)},delta:{x:0,y:0},extent:e.extent,parentNode:e.parentNode||e.parentId,parentId:e.parentNode||e.parentId,width:e.width,height:e.height,expandParent:e.expandParent}}))}function ZS(e,t,n,o,r=[0,0],a){const s=function(e,t){return t&&"parent"!==t?[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]:t}(e,e.extent||o);let i=s;const l=e.parentNode||e.parentId;if("parent"!==e.extent||e.expandParent){if(e.extent&&l&&"parent"!==e.extent){const t=n.get(l),{x:o,y:a}=IE(t,r).positionAbsolute;i=[[e.extent[0][0]+o,e.extent[0][1]+a],[e.extent[1][0]+o,e.extent[1][1]+a]]}}else if(l&&e.width&&e.height){const t=n.get(l),{x:o,y:a}=IE(t,r).positionAbsolute;i=t&&BC(o)&&BC(a)&&BC(t.width)&&BC(t.height)?[[o+e.width*r[0],a+e.height*r[1]],[o+t.width-e.width+e.width*r[0],a+t.height-e.height+e.height*r[1]]]:i}else null==a||a("005",xC()),i=s;let c={x:0,y:0};if(l){const e=n.get(l);c=IE(e,r).positionAbsolute}const d=i&&"parent"!==i?OC(t,i):t;return{position:{x:d.x-c.x,y:d.y-c.y},positionAbsolute:d}}function QS({nodeId:e,dragItems:t,nodeInternals:n}){const o=t.map((e=>({...n.get(e.id),position:e.position,positionAbsolute:e.positionAbsolute})));return[e?o.find((t=>t.id===e)):o[0],o]}YS.displayName="Pane";const ej=(e,t,n,o)=>{const r=t.querySelectorAll(e);if(!r||!r.length)return null;const a=Array.from(r),s=t.getBoundingClientRect(),i=s.width*o[0],l=s.height*o[1];return a.map((e=>{const t=e.getBoundingClientRect();return{id:e.getAttribute("data-handleid"),position:e.getAttribute("data-handlepos"),x:(t.left-s.left-i)/n,y:(t.top-s.top-l)/n,...MC(e)}}))};function tj(e,t,n){return void 0===n?n:o=>{const r=t().nodeInternals.get(e);r&&n(o,{...r})}}function nj({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:a,multiSelectionActive:s,nodeInternals:i,onError:l}=t.getState(),c=i.get(e);c?(t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&s)&&(a({nodes:[c],edges:[]}),requestAnimationFrame((()=>{var e;return null==(e=null==o?void 0:o.current)?void 0:e.blur()}))):r([e])):null==l||l("012",NC(e))}function oj(e){return(t,n,o)=>null==e?void 0:e(t,o)}function rj({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:a,isSelectable:s,selectNodesOnDrag:i}){const l=SC(),[c,d]=r.useState(!1),u=r.useRef([]),h=r.useRef({x:null,y:null}),m=r.useRef(0),f=r.useRef(null),p=r.useRef({x:0,y:0}),g=r.useRef(null),v=r.useRef(!1),x=r.useRef(!1),y=r.useRef(!1),b=function(){const e=SC();return r.useCallback((({sourceEvent:t})=>{const{transform:n,snapGrid:o,snapToGrid:r}=e.getState(),a=t.touches?t.touches[0].clientX:t.clientX,s=t.touches?t.touches[0].clientY:t.clientY,i={x:(a-n[0])/n[2],y:(s-n[1])/n[2]};return{xSnapped:r?o[0]*Math.round(i.x/o[0]):i.x,ySnapped:r?o[1]*Math.round(i.y/o[1]):i.y,...i}}),[])}();return r.useEffect((()=>{if(null==e?void 0:e.current){const r=jl(e.current),c=({x:e,y:t})=>{const{nodeInternals:n,onNodeDrag:o,onSelectionDrag:r,updateNodePositions:s,nodeExtent:i,snapGrid:c,snapToGrid:m,nodeOrigin:f,onError:p}=l.getState();h.current={x:e,y:t};let v=!1,x={x:0,y:0,x2:0,y2:0};if(u.current.length>1&&i){const e=AE(u.current,f);x=FC(e)}if(u.current=u.current.map((o=>{const r={x:e-o.distance.x,y:t-o.distance.y};m&&(r.x=c[0]*Math.round(r.x/c[0]),r.y=c[1]*Math.round(r.y/c[1]));const a=[[i[0][0],i[0][1]],[i[1][0],i[1][1]]];u.current.length>1&&i&&!o.extent&&(a[0][0]=o.positionAbsolute.x-x.x+i[0][0],a[1][0]=o.positionAbsolute.x+(o.width??0)-x.x2+i[1][0],a[0][1]=o.positionAbsolute.y-x.y+i[0][1],a[1][1]=o.positionAbsolute.y+(o.height??0)-x.y2+i[1][1]);const s=ZS(o,r,n,a,f,p);return v=v||o.position.x!==s.position.x||o.position.y!==s.position.y,o.position=s.position,o.positionAbsolute=s.positionAbsolute,o})),!v)return;s(u.current,!0,!0),d(!0);const y=a?o:oj(r);if(y&&g.current){const[e,t]=QS({nodeId:a,dragItems:u.current,nodeInternals:n});y(g.current,e,t)}},w=()=>{if(!f.current)return;const[e,t]=PC(p.current,f.current);if(0!==e||0!==t){const{transform:n,panBy:o}=l.getState();h.current.x=(h.current.x??0)-e/n[2],h.current.y=(h.current.y??0)-t/n[2],o({x:e,y:t})&&c(h.current)}m.current=requestAnimationFrame(w)},k=t=>{var n;const{nodeInternals:o,multiSelectionActive:r,nodesDraggable:c,unselectNodesAndEdges:d,onNodeDragStart:m,onSelectionDragStart:f}=l.getState();x.current=!0;const p=a?m:oj(f);i&&s||r||!a||(null==(n=o.get(a))?void 0:n.selected)||d(),a&&s&&i&&nj({id:a,store:l,nodeRef:e});const g=b(t);if(h.current=g,u.current=JS(o,c,g,a),p&&u.current){const[e,n]=QS({nodeId:a,dragItems:u.current,nodeInternals:o});p(t.sourceEvent,e,n)}};if(!t){const t=function(){var e,t,n,o,r=eC,a=tC,s=nC,i=oC,l={},c=Ml("start","drag","end"),d=0,u=0;function h(e){e.on("mousedown.drag",m).filter(i).on("touchstart.drag",g).on("touchmove.drag",v,WN).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(s,i){if(!o&&r.call(this,s,i)){var l=y(this,a.call(this,s,i),s,i,"mouse");l&&(jl(s.view).on("mousemove.drag",f,qN).on("mouseup.drag",p,qN),KN(s.view),YN(s),n=!1,e=s.clientX,t=s.clientY,l("start",s))}}function f(o){if(XN(o),!n){var r=o.clientX-e,a=o.clientY-t;n=r*r+a*a>u}l.mouse("drag",o)}function p(e){jl(e.view).on("mousemove.drag mouseup.drag",null),JN(e.view,n),XN(e),l.mouse("end",e)}function g(e,t){if(r.call(this,e,t)){var n,o,s=e.changedTouches,i=a.call(this,e,t),l=s.length;for(n=0;n<l;++n)(o=y(this,i,e,t,s[n].identifier,s[n]))&&(YN(e),o("start",e,s[n]))}}function v(e){var t,n,o=e.changedTouches,r=o.length;for(t=0;t<r;++t)(n=l[o[t].identifier])&&(XN(e),n("drag",e,o[t]))}function x(e){var t,n,r=e.changedTouches,a=r.length;for(o&&clearTimeout(o),o=setTimeout((function(){o=null}),500),t=0;t<a;++t)(n=l[r[t].identifier])&&(YN(e),n("end",e,r[t]))}function y(e,t,n,o,r,a){var i,u,m,f=c.copy(),p=HN(a||n,t);if(null!=(m=s.call(e,new QN("beforestart",{sourceEvent:n,target:h,identifier:r,active:d,x:p[0],y:p[1],dx:0,dy:0,dispatch:f}),o)))return i=m.x-p[0]||0,u=m.y-p[1]||0,function n(a,s,c){var g,v=p;switch(a){case"start":l[r]=n,g=d++;break;case"end":delete l[r],--d;case"drag":p=HN(c||s,t),g=d}f.call(a,e,new QN(a,{sourceEvent:s,subject:m,target:h,identifier:r,active:g,x:p[0]+i,y:p[1]+u,dx:p[0]-v[0],dy:p[1]-v[1],dispatch:f}),o)}}return h.filter=function(e){return arguments.length?(r="function"==typeof e?e:ZN(!!e),h):r},h.container=function(e){return arguments.length?(a="function"==typeof e?e:ZN(e),h):a},h.subject=function(e){return arguments.length?(s="function"==typeof e?e:ZN(e),h):s},h.touchable=function(e){return arguments.length?(i="function"==typeof e?e:ZN(!!e),h):i},h.on=function(){var e=c.on.apply(c,arguments);return e===c?h:e},h.clickDistance=function(e){return arguments.length?(u=(e=+e)*e,h):Math.sqrt(u)},h}().on("start",(e=>{const{domNode:t,nodeDragThreshold:n}=l.getState();0===n&&k(e),y.current=!1;const o=b(e);h.current=o,f.current=(null==t?void 0:t.getBoundingClientRect())||null,p.current=HC(e.sourceEvent,f.current)})).on("drag",(e=>{var t,n;const o=b(e),{autoPanOnNodeDrag:r,nodeDragThreshold:a}=l.getState();if("touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1&&(y.current=!0),!y.current){if(!v.current&&x.current&&r&&(v.current=!0,w()),!x.current){const r=o.xSnapped-((null==(t=null==h?void 0:h.current)?void 0:t.x)??0),s=o.ySnapped-((null==(n=null==h?void 0:h.current)?void 0:n.y)??0);Math.sqrt(r*r+s*s)>a&&k(e)}(h.current.x!==o.xSnapped||h.current.y!==o.ySnapped)&&u.current&&x.current&&(g.current=e.sourceEvent,p.current=HC(e.sourceEvent,f.current),c(o))}})).on("end",(e=>{if(x.current&&!y.current&&(d(!1),v.current=!1,x.current=!1,cancelAnimationFrame(m.current),u.current)){const{updateNodePositions:t,nodeInternals:n,onNodeDragStop:o,onSelectionDragStop:r}=l.getState(),s=a?o:oj(r);if(t(u.current,!1,!1),s){const[t,o]=QS({nodeId:a,dragItems:u.current,nodeInternals:n});s(e.sourceEvent,t,o)}}})).filter((t=>{const r=t.target;return!t.button&&(!n||!KS(r,`.${n}`,e))&&(!o||KS(r,o,e))}));return r.call(t),()=>{r.on(".drag",null)}}r.on(".drag",null)}}),[e,t,n,o,s,l,a,i,b]),c}function aj(){const e=SC();return r.useCallback((t=>{const{nodeInternals:n,nodeExtent:o,updateNodePositions:r,getNodes:a,snapToGrid:s,snapGrid:i,onError:l,nodesDraggable:c}=e.getState(),d=a().filter((e=>e.selected&&(e.draggable||c&&void 0===e.draggable))),u=s?i[0]:5,h=s?i[1]:5,m=t.isShiftPressed?4:1,f=t.x*u*m,p=t.y*h*m;r(d.map((e=>{if(e.positionAbsolute){const t={x:e.positionAbsolute.x+f,y:e.positionAbsolute.y+p};s&&(t.x=i[0]*Math.round(t.x/i[0]),t.y=i[1]*Math.round(t.y/i[1]));const{positionAbsolute:r,position:a}=ZS(e,t,n,o,void 0,l);e.position=a,e.positionAbsolute=r}return e})),!0,!1)}),[])}const sj={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var ij=e=>{const t=({id:t,type:n,data:o,xPos:a,yPos:s,xPosOrigin:i,yPosOrigin:l,selected:c,onClick:d,onMouseEnter:h,onMouseMove:m,onMouseLeave:f,onContextMenu:p,onDoubleClick:g,style:v,className:x,isDraggable:y,isSelectable:b,isConnectable:w,isFocusable:k,selectNodesOnDrag:N,sourcePosition:C,targetPosition:E,hidden:S,resizeObserver:j,dragHandle:_,zIndex:I,isParent:A,noDragClassName:M,noPanClassName:T,initialized:O,disableKeyboardA11y:D,ariaLabel:P,rfId:R,hasHandleBounds:F})=>{const L=SC(),z=r.useRef(null),B=r.useRef(null),U=r.useRef(C),V=r.useRef(E),G=r.useRef(n),$=b||y||d||h||m||f,H=aj(),W=tj(t,L.getState,h),q=tj(t,L.getState,m),Y=tj(t,L.getState,f),X=tj(t,L.getState,p),K=tj(t,L.getState,g);r.useEffect((()=>()=>{B.current&&(null==j||j.unobserve(B.current),B.current=null)}),[]),r.useEffect((()=>{if(z.current&&!S){const e=z.current;O&&F&&B.current===e||(B.current&&(null==j||j.unobserve(B.current)),null==j||j.observe(e),B.current=e)}}),[S,O,F]),r.useEffect((()=>{const e=G.current!==n,o=U.current!==C,r=V.current!==E;z.current&&(e||o||r)&&(e&&(G.current=n),o&&(U.current=C),r&&(V.current=E),L.getState().updateNodeDimensions([{id:t,nodeElement:z.current,forceUpdate:!0}]))}),[t,n,C,E]);const J=rj({nodeRef:z,disabled:S||!y,noDragClassName:M,handleSelector:_,nodeId:t,isSelectable:b,selectNodesOnDrag:N});return S?null:u.createElement("div",{className:LN(["react-flow__node",`react-flow__node-${n}`,{[T]:y},x,{selected:c,selectable:b,parent:A,dragging:J}]),ref:z,style:{zIndex:I,transform:`translate(${i}px,${l}px)`,pointerEvents:$?"all":"none",visibility:O?"visible":"hidden",...v},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:W,onMouseMove:q,onMouseLeave:Y,onContextMenu:X,onClick:e=>{const{nodeDragThreshold:n}=L.getState();if(b&&(!N||!y||n>0)&&nj({id:t,store:L,nodeRef:z}),d){const n=L.getState().nodeInternals.get(t);n&&d(e,{...n})}},onDoubleClick:K,onKeyDown:k?e=>{if(!GC(e)&&!D)if(VC.includes(e.key)&&b){const n="Escape"===e.key;nj({id:t,store:L,unselect:n,nodeRef:z})}else y&&c&&Object.prototype.hasOwnProperty.call(sj,e.key)&&(L.setState({ariaLiveMessage:`Moved selected node ${e.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~s}`}),H({x:sj[e.key].x,y:sj[e.key].y,isShiftPressed:e.shiftKey}))}:void 0,tabIndex:k?0:void 0,role:k?"button":void 0,"aria-describedby":D?void 0:`${hS}-${R}`,"aria-label":P},u.createElement(CE,{value:t},u.createElement(e,{id:t,data:o,type:n,xPos:a,yPos:s,selected:c,isConnectable:w,sourcePosition:C,targetPosition:E,dragging:J,dragHandle:_,zIndex:I})))};return t.displayName="NodeWrapper",r.memo(t)};const lj=e=>{const t=e.getNodes().filter((e=>e.selected));return{...AE(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};var cj=r.memo((function({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=SC(),{width:a,height:s,x:i,y:l,transformString:c,userSelectionActive:d}=EC(lj,$N),h=aj(),m=r.useRef(null);if(r.useEffect((()=>{var e;n||null==(e=m.current)||e.focus({preventScroll:!0})}),[n]),rj({nodeRef:m}),d||!a||!s)return null;const f=e?t=>{const n=o.getState().getNodes().filter((e=>e.selected));e(t,n)}:void 0;return u.createElement("div",{className:LN(["react-flow__nodesselection","react-flow__container",t]),style:{transform:c}},u.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(sj,e.key)&&h({x:sj[e.key].x,y:sj[e.key].y,isShiftPressed:e.shiftKey})},style:{width:a,height:s,top:l,left:i}}))}));const dj=e=>e.nodesSelectionActive,uj=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:i,deleteKeyCode:l,onMove:c,onMoveStart:d,onMoveEnd:h,selectionKeyCode:m,selectionOnDrag:f,selectionMode:p,onSelectionStart:g,onSelectionEnd:v,multiSelectionKeyCode:x,panActivationKeyCode:y,zoomActivationKeyCode:b,elementsSelectable:w,zoomOnScroll:k,zoomOnPinch:N,panOnScroll:C,panOnScrollSpeed:E,panOnScrollMode:S,zoomOnDoubleClick:j,panOnDrag:_,defaultViewport:I,translateExtent:A,minZoom:M,maxZoom:T,preventScrolling:O,onSelectionContextMenu:D,noWheelClassName:P,noPanClassName:R,disableKeyboardA11y:F})=>{const L=EC(dj),z=vS(m),B=vS(y),U=B||_,V=B||C,G=z||f&&!0!==U;return(({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=SC(),{deleteElements:o}=AS(),a=vS(e,MS),s=vS(t);r.useEffect((()=>{if(a){const{edges:e,getNodes:t}=n.getState(),r=t().filter((e=>e.selected)),a=e.filter((e=>e.selected));o({nodes:r,edges:a}),n.setState({nodesSelectionActive:!1})}}),[a]),r.useEffect((()=>{n.setState({multiSelectionActive:s})}),[s])})({deleteKeyCode:l,multiSelectionKeyCode:x}),u.createElement(LS,{onMove:c,onMoveStart:d,onMoveEnd:h,onPaneContextMenu:s,elementsSelectable:w,zoomOnScroll:k,zoomOnPinch:N,panOnScroll:V,panOnScrollSpeed:E,panOnScrollMode:S,zoomOnDoubleClick:j,panOnDrag:!z&&U,defaultViewport:I,translateExtent:A,minZoom:M,maxZoom:T,zoomActivationKeyCode:b,preventScrolling:O,noWheelClassName:P,noPanClassName:R},u.createElement(YS,{onSelectionStart:g,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:U,isSelecting:!!G,selectionMode:p},e,L&&u.createElement(cj,{onSelectionContextMenu:D,noPanClassName:R,disableKeyboardA11y:F})))};uj.displayName="FlowRenderer";var hj=r.memo(uj);function mj(e){return{...{input:ij(e.input||KE),default:ij(e.default||YE),output:ij(e.output||ZE),group:ij(e.group||QE)},...Object.keys(e).filter((e=>!["input","default","output","group"].includes(e))).reduce(((t,n)=>(t[n]=ij(e[n]||YE),t)),{})}}const fj=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),pj=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:a,updateNodeDimensions:s,onError:i}=EC(fj,$N),l=(c=e.onlyRenderVisibleElements,EC(r.useCallback((e=>c?ME(e.nodeInternals,{x:0,y:0,width:e.width,height:e.height},e.transform,!0):e.getNodes()),[c])));var c;const d=r.useRef(),h=r.useMemo((()=>{if("undefined"==typeof ResizeObserver)return null;const e=new ResizeObserver((e=>{const t=e.map((e=>({id:e.target.getAttribute("data-id"),nodeElement:e.target,forceUpdate:!0})));s(t)}));return d.current=e,e}),[]);return r.useEffect((()=>()=>{var e;null==(e=null==d?void 0:d.current)||e.disconnect()}),[]),u.createElement("div",{className:"react-flow__nodes",style:TS},l.map((r=>{var s,l,c;let d=r.type||"default";e.nodeTypes[d]||(null==i||i("003",gC(d)),d="default");const m=e.nodeTypes[d]||e.nodeTypes.default,f=!!(r.draggable||t&&void 0===r.draggable),p=!!(r.selectable||a&&void 0===r.selectable),g=!!(r.connectable||n&&void 0===r.connectable),v=!!(r.focusable||o&&void 0===r.focusable),x=e.nodeExtent?OC(r.positionAbsolute,e.nodeExtent):r.positionAbsolute,y=(null==x?void 0:x.x)??0,b=(null==x?void 0:x.y)??0,w=(({x:e,y:t,width:n,height:o,origin:r})=>n&&o?r[0]<0||r[1]<0||r[0]>1||r[1]>1?{x:e,y:t}:{x:e-n*r[0],y:t-o*r[1]}:{x:e,y:t})({x:y,y:b,width:r.width??0,height:r.height??0,origin:e.nodeOrigin});return u.createElement(m,{key:r.id,id:r.id,className:r.className,style:r.style,type:d,data:r.data,sourcePosition:r.sourcePosition||iE.Bottom,targetPosition:r.targetPosition||iE.Top,hidden:r.hidden,xPos:y,yPos:b,xPosOrigin:w.x,yPosOrigin:w.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!r.selected,isDraggable:f,isSelectable:p,isConnectable:g,isFocusable:v,resizeObserver:h,dragHandle:r.dragHandle,zIndex:(null==(s=r[UC])?void 0:s.z)??0,isParent:!!(null==(l=r[UC])?void 0:l.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!r.width&&!!r.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:r.ariaLabel,hasHandleBounds:!!(null==(c=r[UC])?void 0:c.handleBounds)})})))};pj.displayName="NodeRenderer";var gj=r.memo(pj);const vj=(e,t,n)=>n===iE.Left?e-t:n===iE.Right?e+t:e,xj=(e,t,n)=>n===iE.Top?e-t:n===iE.Bottom?e+t:e,yj="react-flow__edgeupdater",bj=({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:a,onMouseOut:s,type:i})=>u.createElement("circle",{onMouseDown:r,onMouseEnter:a,onMouseOut:s,className:LN([yj,`${yj}-${i}`]),cx:vj(t,o,e),cy:xj(n,o,e),r:o,stroke:"transparent",fill:"transparent"}),wj=()=>!0;var kj=e=>{const t=({id:t,className:n,type:o,data:a,onClick:s,onEdgeDoubleClick:i,selected:l,animated:c,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:g,style:v,source:x,target:y,sourceX:b,sourceY:w,targetX:k,targetY:N,sourcePosition:C,targetPosition:E,elementsSelectable:S,hidden:j,sourceHandleId:_,targetHandleId:I,onContextMenu:A,onMouseEnter:M,onMouseMove:T,onMouseLeave:O,reconnectRadius:D,onReconnect:P,onReconnectStart:R,onReconnectEnd:F,markerEnd:L,markerStart:z,rfId:B,ariaLabel:U,isFocusable:V,isReconnectable:G,pathOptions:$,interactionWidth:H,disableKeyboardA11y:W})=>{const q=r.useRef(null),[Y,X]=r.useState(!1),[K,J]=r.useState(!1),Z=SC(),Q=r.useMemo((()=>`url('#${SE(z,B)}')`),[z,B]),ee=r.useMemo((()=>`url('#${SE(L,B)}')`),[L,B]);if(j)return null;const te=YC(t,Z.getState,i),ne=YC(t,Z.getState,A),oe=YC(t,Z.getState,M),re=YC(t,Z.getState,T),ae=YC(t,Z.getState,O),se=(e,n)=>{if(0!==e.button)return;const{edges:o,isValidConnection:r}=Z.getState(),a=n?y:x,s=(n?I:_)||null,i=n?"target":"source",l=r||wj,c=n,d=o.find((e=>e.id===t));J(!0),null==R||R(e,d,i);VE({event:e,handleId:s,nodeId:a,onConnect:e=>null==P?void 0:P(d,e),isTarget:c,getState:Z.getState,setState:Z.setState,isValidConnection:l,edgeUpdaterType:i,onReconnectEnd:e=>{J(!1),null==F||F(e,d,i)}})},ie=()=>X(!0),le=()=>X(!1),ce=!S&&!s;return u.createElement("g",{className:LN(["react-flow__edge",`react-flow__edge-${o}`,n,{selected:l,animated:c,inactive:ce,updating:Y}]),onClick:e=>{var n;const{edges:o,addSelectedEdges:r,unselectNodesAndEdges:a,multiSelectionActive:i}=Z.getState(),l=o.find((e=>e.id===t));l&&(S&&(Z.setState({nodesSelectionActive:!1}),l.selected&&i?(a({nodes:[],edges:[l]}),null==(n=q.current)||n.blur()):r([t])),s&&s(e,l))},onDoubleClick:te,onContextMenu:ne,onMouseEnter:oe,onMouseMove:re,onMouseLeave:ae,onKeyDown:V?e=>{var n;if(!W&&VC.includes(e.key)&&S){const{unselectNodesAndEdges:o,addSelectedEdges:r,edges:a}=Z.getState();"Escape"===e.key?(null==(n=q.current)||n.blur(),o({edges:[a.find((e=>e.id===t))]})):r([t])}}:void 0,tabIndex:V?0:void 0,role:V?"button":"img","data-testid":`rf__edge-${t}`,"aria-label":null===U?void 0:U||`Edge from ${x} to ${y}`,"aria-describedby":V?`${mS}-${B}`:void 0,ref:q},!K&&u.createElement(e,{id:t,source:x,target:y,selected:l,animated:c,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:g,data:a,style:v,sourceX:b,sourceY:w,targetX:k,targetY:N,sourcePosition:C,targetPosition:E,sourceHandleId:_,targetHandleId:I,markerStart:Q,markerEnd:ee,pathOptions:$,interactionWidth:H}),G&&u.createElement(u.Fragment,null,("source"===G||!0===G)&&u.createElement(bj,{position:C,centerX:b,centerY:w,radius:D,onMouseDown:e=>se(e,!0),onMouseEnter:ie,onMouseOut:le,type:"source"}),("target"===G||!0===G)&&u.createElement(bj,{position:E,centerX:k,centerY:N,radius:D,onMouseDown:e=>se(e,!1),onMouseEnter:ie,onMouseOut:le,type:"target"})))};return t.displayName="EdgeWrapper",r.memo(t)};function Nj(e){return{...{default:kj(e.default||kE),straight:kj(e.bezier||xE),step:kj(e.step||vE),smoothstep:kj(e.step||gE),simplebezier:kj(e.simplebezier||uE)},...Object.keys(e).filter((e=>!["default","bezier"].includes(e))).reduce(((t,n)=>(t[n]=kj(e[n]||kE),t)),{})}}function Cj(e,t,n=null){const o=((null==n?void 0:n.x)||0)+t.x,r=((null==n?void 0:n.y)||0)+t.y,a=(null==n?void 0:n.width)||t.width,s=(null==n?void 0:n.height)||t.height;switch(e){case iE.Top:return{x:o+a/2,y:r};case iE.Right:return{x:o+a,y:r+s/2};case iE.Bottom:return{x:o+a/2,y:r+s};case iE.Left:return{x:o,y:r+s/2}}}function Ej(e,t){return e?1!==e.length&&t?t&&e.find((e=>e.id===t))||null:e[0]:null}function Sj(e){var t,n,o,r,a;const s=(null==(t=null==e?void 0:e[UC])?void 0:t.handleBounds)||null,i=s&&(null==e?void 0:e.width)&&(null==e?void 0:e.height)&&void 0!==(null==(n=null==e?void 0:e.positionAbsolute)?void 0:n.x)&&void 0!==(null==(o=null==e?void 0:e.positionAbsolute)?void 0:o.y);return[{x:(null==(r=null==e?void 0:e.positionAbsolute)?void 0:r.x)||0,y:(null==(a=null==e?void 0:e.positionAbsolute)?void 0:a.y)||0,width:(null==e?void 0:e.width)||0,height:(null==e?void 0:e.height)||0},s,!!i]}const jj=[{level:0,isMaxLevel:!0,edges:[]}];function _j(e,t,n){return function(e,t,n=!1){let o=-1;const r=e.reduce(((e,r)=>{var a,s;const i=BC(r.zIndex);let l=i?r.zIndex:0;if(n){const e=t.get(r.target),n=t.get(r.source),o=r.selected||(null==e?void 0:e.selected)||(null==n?void 0:n.selected),c=Math.max((null==(a=null==n?void 0:n[UC])?void 0:a.z)||0,(null==(s=null==e?void 0:e[UC])?void 0:s.z)||0,1e3);l=(i?r.zIndex:0)+(o?c:0)}return e[l]?e[l].push(r):e[l]=[r],o=l>o?l:o,e}),{}),a=Object.entries(r).map((([e,t])=>{const n=+e;return{edges:t,level:n,isMaxLevel:n===o}}));return 0===a.length?jj:a}(EC(r.useCallback((n=>e?n.edges.filter((e=>{const o=t.get(e.source),r=t.get(e.target);return(null==o?void 0:o.width)&&(null==o?void 0:o.height)&&(null==r?void 0:r.width)&&(null==r?void 0:r.height)&&function({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:r,targetHeight:a,width:s,height:i,transform:l}){const c={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+r),y2:Math.max(e.y+o,t.y+a)};c.x===c.x2&&(c.x2+=1),c.y===c.y2&&(c.y2+=1);const d=FC({x:(0-l[0])/l[2],y:(0-l[1])/l[2],width:s/l[2],height:i/l[2]}),u=Math.max(0,Math.min(d.x2,c.x2)-Math.max(d.x,c.x)),h=Math.max(0,Math.min(d.y2,c.y2)-Math.max(d.y,c.y));return Math.ceil(u*h)>0}({sourcePos:o.positionAbsolute||{x:0,y:0},targetPos:r.positionAbsolute||{x:0,y:0},sourceWidth:o.width,sourceHeight:o.height,targetWidth:r.width,targetHeight:r.height,width:n.width,height:n.height,transform:n.transform})})):n.edges),[e,t])),t,n)}const Ij={[aE.Arrow]:({color:e="none",strokeWidth:t=1})=>u.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[aE.ArrowClosed]:({color:e="none",strokeWidth:t=1})=>u.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})};const Aj=({id:e,type:t,color:n,width:o=12.5,height:a=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:l="auto-start-reverse"})=>{const c=function(e){const t=SC();return r.useMemo((()=>{var n,o;return Object.prototype.hasOwnProperty.call(Ij,e)?Ij[e]:(null==(o=(n=t.getState()).onError)||o.call(n,"009",yC(e)),null)}),[e])}(t);return c?u.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:l,refX:"0",refY:"0"},u.createElement(c,{color:n,strokeWidth:i})):null},Mj=({defaultColor:e,rfId:t})=>{const n=EC(r.useCallback((({defaultColor:e,rfId:t})=>n=>{const o=[];return n.edges.reduce(((n,r)=>([r.markerStart,r.markerEnd].forEach((r=>{if(r&&"object"==typeof r){const a=SE(r,t);o.includes(a)||(n.push({id:a,color:r.color||e,...r}),o.push(a))}})),n)),[]).sort(((e,t)=>e.id.localeCompare(t.id)))})({defaultColor:e,rfId:t}),[e,t]),((e,t)=>!(e.length!==t.length||e.some(((e,n)=>e.id!==t[n].id)))));return u.createElement("defs",null,n.map((e=>u.createElement(Aj,{id:e.id,key:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient}))))};Mj.displayName="MarkerDefinitions";var Tj=r.memo(Mj);const Oj=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),Dj=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:o,edgeTypes:r,noPanClassName:a,onEdgeContextMenu:s,onEdgeMouseEnter:i,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:d,onEdgeDoubleClick:h,onReconnect:m,onReconnectStart:f,onReconnectEnd:p,reconnectRadius:g,children:v,disableKeyboardA11y:x})=>{const{edgesFocusable:y,edgesUpdatable:b,elementsSelectable:w,width:k,height:N,connectionMode:C,nodeInternals:E,onError:S}=EC(Oj,$N),j=_j(t,E,n);return k?u.createElement(u.Fragment,null,j.map((({level:t,edges:n,isMaxLevel:v})=>u.createElement("svg",{key:t,style:{zIndex:t},width:k,height:N,className:"react-flow__edges react-flow__container"},v&&u.createElement(Tj,{defaultColor:e,rfId:o}),u.createElement("g",null,n.map((e=>{const[t,n,v]=Sj(E.get(e.source)),[k,N,j]=Sj(E.get(e.target));if(!v||!j)return null;let _=e.type||"default";r[_]||(null==S||S("011",kC(_)),_="default");const I=r[_]||r.default,A=C===JC.Strict?N.target:(N.target??[]).concat(N.source??[]),M=Ej(n.source,e.sourceHandle),T=Ej(A,e.targetHandle),O=(null==M?void 0:M.position)||iE.Bottom,D=(null==T?void 0:T.position)||iE.Top,P=!!(e.focusable||y&&void 0===e.focusable),R=e.reconnectable||e.updatable,F=void 0!==m&&(R||b&&void 0===R);if(!M||!T)return null==S||S("008",bC(M,e)),null;const{sourceX:L,sourceY:z,targetX:B,targetY:U}=((e,t,n,o,r,a)=>{const s=Cj(n,e,t),i=Cj(a,o,r);return{sourceX:s.x,sourceY:s.y,targetX:i.x,targetY:i.y}})(t,M,O,k,T,D);return u.createElement(I,{key:e.id,id:e.id,className:LN([e.className,a]),type:_,data:e.data,selected:!!e.selected,animated:!!e.animated,hidden:!!e.hidden,label:e.label,labelStyle:e.labelStyle,labelShowBg:e.labelShowBg,labelBgStyle:e.labelBgStyle,labelBgPadding:e.labelBgPadding,labelBgBorderRadius:e.labelBgBorderRadius,style:e.style,source:e.source,target:e.target,sourceHandleId:e.sourceHandle,targetHandleId:e.targetHandle,markerEnd:e.markerEnd,markerStart:e.markerStart,sourceX:L,sourceY:z,targetX:B,targetY:U,sourcePosition:O,targetPosition:D,elementsSelectable:w,onContextMenu:s,onMouseEnter:i,onMouseMove:l,onMouseLeave:c,onClick:d,onEdgeDoubleClick:h,onReconnect:m,onReconnectStart:f,onReconnectEnd:p,reconnectRadius:g,rfId:o,ariaLabel:e.ariaLabel,isFocusable:P,isReconnectable:F,pathOptions:"pathOptions"in e?e.pathOptions:void 0,interactionWidth:e.interactionWidth,disableKeyboardA11y:x})})))))),v):null};Dj.displayName="EdgeRenderer";var Pj=r.memo(Dj);const Rj=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Fj({children:e}){const t=EC(Rj);return u.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}const Lj={[iE.Left]:iE.Right,[iE.Right]:iE.Left,[iE.Top]:iE.Bottom,[iE.Bottom]:iE.Top},zj=({nodeId:e,handleType:t,style:n,type:o=oE.Bezier,CustomComponent:a,connectionStatus:s})=>{var i,l,c;const{fromNode:d,handleId:h,toX:m,toY:f,connectionMode:p}=EC(r.useCallback((t=>({fromNode:t.nodeInternals.get(e),handleId:t.connectionHandleId,toX:(t.connectionPosition.x-t.transform[0])/t.transform[2],toY:(t.connectionPosition.y-t.transform[1])/t.transform[2],connectionMode:t.connectionMode})),[e]),$N),g=null==(i=null==d?void 0:d[UC])?void 0:i.handleBounds;let v=null==g?void 0:g[t];if(p===JC.Loose&&(v=v||(null==g?void 0:g["source"===t?"target":"source"])),!d||!v)return null;const x=h?v.find((e=>e.id===h)):v[0],y=x?x.x+x.width/2:(d.width??0)/2,b=x?x.y+x.height/2:d.height??0,w=((null==(l=d.positionAbsolute)?void 0:l.x)??0)+y,k=((null==(c=d.positionAbsolute)?void 0:c.y)??0)+b,N=null==x?void 0:x.position,C=N?Lj[N]:null;if(!N||!C)return null;if(a)return u.createElement(a,{connectionLineType:o,connectionLineStyle:n,fromNode:d,fromHandle:x,fromX:w,fromY:k,toX:m,toY:f,fromPosition:N,toPosition:C,connectionStatus:s});let E="";const S={sourceX:w,sourceY:k,sourcePosition:N,targetX:m,targetY:f,targetPosition:C};return o===oE.Bezier?[E]=wE(S):o===oE.Step?[E]=pE({...S,borderRadius:0}):o===oE.SmoothStep?[E]=pE(S):o===oE.SimpleBezier?[E]=dE(S):E=`M${w},${k} ${m},${f}`,u.createElement("path",{d:E,fill:"none",className:"react-flow__connection-path",style:n})};zj.displayName="ConnectionLine";const Bj=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function Uj({containerStyle:e,style:t,type:n,component:o}){const{nodeId:r,handleType:a,nodesConnectable:s,width:i,height:l,connectionStatus:c}=EC(Bj,$N);return!!(r&&a&&i&&s)?u.createElement("svg",{style:e,width:i,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},u.createElement("g",{className:LN(["react-flow__connection",c])},u.createElement(zj,{nodeId:r,handleType:a,style:t,type:n,CustomComponent:o,connectionStatus:c}))):null}function Vj(e,t){r.useRef(null),SC();return r.useMemo((()=>t(e)),[e])}const Gj=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:o,onMoveEnd:a,onInit:s,onNodeClick:i,onEdgeClick:l,onNodeDoubleClick:c,onEdgeDoubleClick:d,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:f,onNodeContextMenu:p,onSelectionContextMenu:g,onSelectionStart:v,onSelectionEnd:x,connectionLineType:y,connectionLineStyle:b,connectionLineComponent:w,connectionLineContainerStyle:k,selectionKeyCode:N,selectionOnDrag:C,selectionMode:E,multiSelectionKeyCode:S,panActivationKeyCode:j,zoomActivationKeyCode:_,deleteKeyCode:I,onlyRenderVisibleElements:A,elementsSelectable:M,selectNodesOnDrag:T,defaultViewport:O,translateExtent:D,minZoom:P,maxZoom:R,preventScrolling:F,defaultMarkerColor:L,zoomOnScroll:z,zoomOnPinch:B,panOnScroll:U,panOnScrollSpeed:V,panOnScrollMode:G,zoomOnDoubleClick:$,panOnDrag:H,onPaneClick:W,onPaneMouseEnter:q,onPaneMouseMove:Y,onPaneMouseLeave:X,onPaneScroll:K,onPaneContextMenu:J,onEdgeContextMenu:Z,onEdgeMouseEnter:Q,onEdgeMouseMove:ee,onEdgeMouseLeave:te,onReconnect:ne,onReconnectStart:oe,onReconnectEnd:re,reconnectRadius:ae,noDragClassName:se,noWheelClassName:ie,noPanClassName:le,elevateEdgesOnSelect:ce,disableKeyboardA11y:de,nodeOrigin:ue,nodeExtent:he,rfId:me})=>{const fe=Vj(e,mj),pe=Vj(t,Nj);return function(e){const t=AS(),n=r.useRef(!1);r.useEffect((()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout((()=>e(t)),1),n.current=!0)}),[e,t.viewportInitialized])}(s),u.createElement(hj,{onPaneClick:W,onPaneMouseEnter:q,onPaneMouseMove:Y,onPaneMouseLeave:X,onPaneContextMenu:J,onPaneScroll:K,deleteKeyCode:I,selectionKeyCode:N,selectionOnDrag:C,selectionMode:E,onSelectionStart:v,onSelectionEnd:x,multiSelectionKeyCode:S,panActivationKeyCode:j,zoomActivationKeyCode:_,elementsSelectable:M,onMove:n,onMoveStart:o,onMoveEnd:a,zoomOnScroll:z,zoomOnPinch:B,zoomOnDoubleClick:$,panOnScroll:U,panOnScrollSpeed:V,panOnScrollMode:G,panOnDrag:H,defaultViewport:O,translateExtent:D,minZoom:P,maxZoom:R,onSelectionContextMenu:g,preventScrolling:F,noDragClassName:se,noWheelClassName:ie,noPanClassName:le,disableKeyboardA11y:de},u.createElement(Fj,null,u.createElement(Pj,{edgeTypes:pe,onEdgeClick:l,onEdgeDoubleClick:d,onlyRenderVisibleElements:A,onEdgeContextMenu:Z,onEdgeMouseEnter:Q,onEdgeMouseMove:ee,onEdgeMouseLeave:te,onReconnect:ne,onReconnectStart:oe,onReconnectEnd:re,reconnectRadius:ae,defaultMarkerColor:L,noPanClassName:le,elevateEdgesOnSelect:!!ce,disableKeyboardA11y:de,rfId:me},u.createElement(Uj,{style:b,type:y,component:w,containerStyle:k})),u.createElement("div",{className:"react-flow__edgelabel-renderer"}),u.createElement(gj,{nodeTypes:fe,onNodeClick:i,onNodeDoubleClick:c,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:f,onNodeContextMenu:p,selectNodesOnDrag:T,onlyRenderVisibleElements:A,noPanClassName:le,noDragClassName:se,disableKeyboardA11y:de,nodeOrigin:ue,nodeExtent:he,rfId:me})))};Gj.displayName="GraphView";var $j=r.memo(Gj);const Hj=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Wj={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:Hj,nodeExtent:Hj,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:JC.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:(e,t)=>{},isValidConnection:void 0},qj=()=>{return e=(e,t)=>({...Wj,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:a}=t();e({nodeInternals:kS(n,o,r,a)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:o={}}=t();e({edges:n.map((e=>({...o,...e})))})},setDefaultNodesAndEdges:(n,o)=>{const r=void 0!==n,a=void 0!==o,s=r?kS(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:s,edges:a?o:[],hasDefaultNodes:r,hasDefaultEdges:a})},updateNodeDimensions:n=>{const{onNodesChange:o,nodeInternals:r,fitViewOnInit:a,fitViewOnInitDone:s,fitViewOnInitOptions:i,domNode:l,nodeOrigin:c}=t(),d=null==l?void 0:l.querySelector(".react-flow__viewport");if(!d)return;const u=window.getComputedStyle(d),{m22:h}=new window.DOMMatrixReadOnly(u.transform),m=n.reduce(((e,t)=>{const n=r.get(t.id);if(null==n?void 0:n.hidden)r.set(n.id,{...n,[UC]:{...n[UC],handleBounds:void 0}});else if(n){const o=MC(t.nodeElement);o.width&&o.height&&(n.width!==o.width||n.height!==o.height||t.forceUpdate)&&(r.set(n.id,{...n,[UC]:{...n[UC],handleBounds:{source:ej(".source",t.nodeElement,h,c),target:ej(".target",t.nodeElement,h,c)}},...o}),e.push({id:n.id,type:"dimensions",dimensions:o}))}return e}),[]);wS(r,c);const f=s||a&&!s&&NS(t,{initial:!0,...i});e({nodeInternals:new Map(r),fitViewOnInitDone:f}),(null==m?void 0:m.length)>0&&(null==o||o(m))},updateNodePositions:(e,n=!0,o=!1)=>{const{triggerNodeChanges:r}=t();r(e.map((e=>{const t={id:e.id,type:"position",dragging:o};return n&&(t.positionAbsolute=e.positionAbsolute,t.position=e.position),t})))},triggerNodeChanges:n=>{const{onNodesChange:o,nodeInternals:r,hasDefaultNodes:a,nodeOrigin:s,getNodes:i,elevateNodesOnSelect:l}=t();if(null==n?void 0:n.length){if(a){const t=kS(GS(n,i()),r,s,l);e({nodeInternals:t})}null==o||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:r,getNodes:a}=t();let s,i=null;o?s=n.map((e=>$S(e,!0))):(s=HS(a(),n),i=HS(r,[])),SS({changedNodes:s,changedEdges:i,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:o,edges:r,getNodes:a}=t();let s,i=null;o?s=n.map((e=>$S(e,!0))):(s=HS(r,n),i=HS(a(),[])),SS({changedNodes:i,changedEdges:s,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:a}=t(),s=o||r;SS({changedNodes:(n||a()).map((e=>(e.selected=!1,$S(e.id,!1)))),changedEdges:s.map((e=>$S(e.id,!1))),get:t,set:e})},setMinZoom:n=>{const{d3Zoom:o,maxZoom:r}=t();null==o||o.scaleExtent([n,r]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:o,minZoom:r}=t();null==o||o.scaleExtent([r,n]),e({maxZoom:n})},setTranslateExtent:n=>{var o;null==(o=t().d3Zoom)||o.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:o}=t();SS({changedNodes:o().filter((e=>e.selected)).map((e=>$S(e.id,!1))),changedEdges:n.filter((e=>e.selected)).map((e=>$S(e.id,!1))),get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:o}=t();o.forEach((e=>{e.positionAbsolute=OC(e.position,n)})),e({nodeExtent:n,nodeInternals:new Map(o)})},panBy:e=>{const{transform:n,width:o,height:r,d3Zoom:a,d3Selection:s,translateExtent:i}=t();if(!a||!s||!e.x&&!e.y)return!1;const l=_l.translate(n[0]+e.x,n[1]+e.y).scale(n[2]),c=[[0,0],[o,r]],d=null==a?void 0:a.constrain()(l,c,i);return a.transform(s,d),n[0]!==d.x||n[1]!==d.y||n[2]!==d.k},cancelConnection:()=>e({connectionNodeId:Wj.connectionNodeId,connectionHandleId:Wj.connectionHandleId,connectionHandleType:Wj.connectionHandleType,connectionStatus:Wj.connectionStatus,connectionStartHandle:Wj.connectionStartHandle,connectionEndHandle:Wj.connectionEndHandle}),reset:()=>e({...Wj})}),t=Object.is,e?GN(e,t):GN;var e,t},Yj=({children:e})=>{const t=r.useRef(null);return t.current||(t.current=qj()),u.createElement(pC,{value:t.current},e)};Yj.displayName="ReactFlowProvider";const Xj=({children:e})=>r.useContext(fC)?u.createElement(u.Fragment,null,e):u.createElement(Yj,null,e);Xj.displayName="ReactFlowWrapper";const Kj={input:KE,default:YE,output:ZE,group:QE},Jj={default:kE,straight:xE,step:vE,smoothstep:gE,simplebezier:uE},Zj=[0,0],Qj=[15,15],e_={x:0,y:0,zoom:1},t_={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},n_=r.forwardRef((({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:a=Kj,edgeTypes:s=Jj,onNodeClick:i,onEdgeClick:l,onInit:c,onMove:d,onMoveStart:h,onMoveEnd:m,onConnect:f,onConnectStart:p,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:x,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:w,onNodeContextMenu:k,onNodeDoubleClick:N,onNodeDragStart:C,onNodeDrag:E,onNodeDragStop:S,onNodesDelete:j,onEdgesDelete:_,onSelectionChange:I,onSelectionDragStart:A,onSelectionDrag:M,onSelectionDragStop:T,onSelectionContextMenu:O,onSelectionStart:D,onSelectionEnd:P,connectionMode:R=JC.Strict,connectionLineType:F=oE.Bezier,connectionLineStyle:L,connectionLineComponent:z,connectionLineContainerStyle:B,deleteKeyCode:U="Backspace",selectionKeyCode:V="Shift",selectionOnDrag:G=!1,selectionMode:$=tE.Full,panActivationKeyCode:H="Space",multiSelectionKeyCode:W=(WC()?"Meta":"Control"),zoomActivationKeyCode:q=(WC()?"Meta":"Control"),snapToGrid:Y=!1,snapGrid:X=Qj,onlyRenderVisibleElements:K=!1,selectNodesOnDrag:J=!0,nodesDraggable:Z,nodesConnectable:Q,nodesFocusable:ee,nodeOrigin:te=Zj,edgesFocusable:ne,edgesUpdatable:oe,elementsSelectable:re,defaultViewport:ae=e_,minZoom:se=.5,maxZoom:ie=2,translateExtent:le=Hj,preventScrolling:ce=!0,nodeExtent:de,defaultMarkerColor:ue="#b1b1b7",zoomOnScroll:he=!0,zoomOnPinch:me=!0,panOnScroll:fe=!1,panOnScrollSpeed:pe=.5,panOnScrollMode:ge=QC.Free,zoomOnDoubleClick:ve=!0,panOnDrag:xe=!0,onPaneClick:ye,onPaneMouseEnter:be,onPaneMouseMove:we,onPaneMouseLeave:ke,onPaneScroll:Ne,onPaneContextMenu:Ce,children:Ee,onEdgeContextMenu:Se,onEdgeDoubleClick:je,onEdgeMouseEnter:_e,onEdgeMouseMove:Ie,onEdgeMouseLeave:Ae,onEdgeUpdate:Me,onEdgeUpdateStart:Te,onEdgeUpdateEnd:Oe,onReconnect:De,onReconnectStart:Pe,onReconnectEnd:Re,reconnectRadius:Fe=10,edgeUpdaterRadius:Le=10,onNodesChange:ze,onEdgesChange:Be,noDragClassName:Ue="nodrag",noWheelClassName:Ve="nowheel",noPanClassName:Ge="nopan",fitView:$e=!1,fitViewOptions:He,connectOnClick:We=!0,attributionPosition:qe,proOptions:Ye,defaultEdgeOptions:Xe,elevateNodesOnSelect:Ke=!0,elevateEdgesOnSelect:Je=!1,disableKeyboardA11y:Ze=!1,autoPanOnConnect:Qe=!0,autoPanOnNodeDrag:et=!0,connectionRadius:tt=20,isValidConnection:nt,onError:ot,style:rt,id:at,nodeDragThreshold:st,...it},lt)=>{const ct=at||"1";return u.createElement("div",{...it,style:{...rt,...t_},ref:lt,className:LN(["react-flow",r]),"data-testid":"rf__wrapper",id:at},u.createElement(Xj,null,u.createElement($j,{onInit:c,onMove:d,onMoveStart:h,onMoveEnd:m,onNodeClick:i,onEdgeClick:l,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:w,onNodeContextMenu:k,onNodeDoubleClick:N,nodeTypes:a,edgeTypes:s,connectionLineType:F,connectionLineStyle:L,connectionLineComponent:z,connectionLineContainerStyle:B,selectionKeyCode:V,selectionOnDrag:G,selectionMode:$,deleteKeyCode:U,multiSelectionKeyCode:W,panActivationKeyCode:H,zoomActivationKeyCode:q,onlyRenderVisibleElements:K,selectNodesOnDrag:J,defaultViewport:ae,translateExtent:le,minZoom:se,maxZoom:ie,preventScrolling:ce,zoomOnScroll:he,zoomOnPinch:me,zoomOnDoubleClick:ve,panOnScroll:fe,panOnScrollSpeed:pe,panOnScrollMode:ge,panOnDrag:xe,onPaneClick:ye,onPaneMouseEnter:be,onPaneMouseMove:we,onPaneMouseLeave:ke,onPaneScroll:Ne,onPaneContextMenu:Ce,onSelectionContextMenu:O,onSelectionStart:D,onSelectionEnd:P,onEdgeContextMenu:Se,onEdgeDoubleClick:je,onEdgeMouseEnter:_e,onEdgeMouseMove:Ie,onEdgeMouseLeave:Ae,onReconnect:De??Me,onReconnectStart:Pe??Te,onReconnectEnd:Re??Oe,reconnectRadius:Fe??Le,defaultMarkerColor:ue,noDragClassName:Ue,noWheelClassName:Ve,noPanClassName:Ge,elevateEdgesOnSelect:Je,rfId:ct,disableKeyboardA11y:Ze,nodeOrigin:te,nodeExtent:de}),u.createElement(cS,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:f,onConnectStart:p,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:x,nodesDraggable:Z,nodesConnectable:Q,nodesFocusable:ee,edgesFocusable:ne,edgesUpdatable:oe,elementsSelectable:re,elevateNodesOnSelect:Ke,minZoom:se,maxZoom:ie,nodeExtent:de,onNodesChange:ze,onEdgesChange:Be,snapToGrid:Y,snapGrid:X,connectionMode:R,translateExtent:le,connectOnClick:We,defaultEdgeOptions:Xe,fitView:$e,fitViewOptions:He,onNodesDelete:j,onEdgesDelete:_,onNodeDragStart:C,onNodeDrag:E,onNodeDragStop:S,onSelectionDrag:M,onSelectionDragStart:A,onSelectionDragStop:T,noPanClassName:Ge,nodeOrigin:te,rfId:ct,autoPanOnConnect:Qe,autoPanOnNodeDrag:et,onError:ot,connectionRadius:tt,isValidConnection:nt,nodeDragThreshold:st}),u.createElement(aS,{onSelectionChange:I}),Ee,u.createElement(IC,{proOptions:Ye,position:qe}),u.createElement(gS,{rfId:ct,disableKeyboardA11y:Ze})))}));function o_(e){return t=>{const[n,o]=r.useState(t),a=r.useCallback((t=>o((n=>e(t,n)))),[]);return[n,o,a]}}n_.displayName="ReactFlow";const r_=o_(GS),a_=o_((function(e,t){return VS(e,t)}));function s_(){return u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},u.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function i_(){return u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},u.createElement("path",{d:"M0 0h32v4.2H0z"}))}function l_(){return u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},u.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 c_(){return u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},u.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 d_(){return u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},u.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 u_=({children:e,className:t,...n})=>u.createElement("button",{type:"button",className:LN(["react-flow__controls-button",t]),...n},e);u_.displayName="ControlButton";const h_=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),m_=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:a,onZoomIn:s,onZoomOut:i,onFitView:l,onInteractiveChange:c,className:d,children:h,position:m="bottom-left"})=>{const f=SC(),[p,g]=r.useState(!1),{isInteractive:v,minZoomReached:x,maxZoomReached:y}=EC(h_,$N),{zoomIn:b,zoomOut:w,fitView:k}=AS();if(r.useEffect((()=>{g(!0)}),[]),!p)return null;return u.createElement(_C,{className:LN(["react-flow__controls",d]),position:m,style:e,"data-testid":"rf__controls"},t&&u.createElement(u.Fragment,null,u.createElement(u_,{onClick:()=>{b(),null==s||s()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:y},u.createElement(s_,null)),u.createElement(u_,{onClick:()=>{w(),null==i||i()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:x},u.createElement(i_,null))),n&&u.createElement(u_,{className:"react-flow__controls-fitview",onClick:()=>{k(a),null==l||l()},title:"fit view","aria-label":"fit view"},u.createElement(l_,null)),o&&u.createElement(u_,{className:"react-flow__controls-interactive",onClick:()=>{f.setState({nodesDraggable:!v,nodesConnectable:!v,elementsSelectable:!v}),null==c||c(!v)},title:"toggle interactivity","aria-label":"toggle interactivity"},v?u.createElement(d_,null):u.createElement(c_,null)),h)};m_.displayName="Controls";var f_,p_,g_=r.memo(m_);function v_({color:e,dimensions:t,lineWidth:n}){return u.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function x_({color:e,radius:t}){return u.createElement("circle",{cx:t,cy:t,r:t,fill:e})}(p_=f_||(f_={})).Lines="lines",p_.Dots="dots",p_.Cross="cross";const y_={[f_.Dots]:"#91919a",[f_.Lines]:"#eee",[f_.Cross]:"#e2e2e2"},b_={[f_.Dots]:1,[f_.Lines]:1,[f_.Cross]:6},w_=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function k_({id:e,variant:t=f_.Dots,gap:n=20,size:o,lineWidth:a=1,offset:s=2,color:i,style:l,className:c}){const d=r.useRef(null),{transform:h,patternId:m}=EC(w_,$N),f=i||y_[t],p=o||b_[t],g=t===f_.Dots,v=t===f_.Cross,x=Array.isArray(n)?n:[n,n],y=[x[0]*h[2]||1,x[1]*h[2]||1],b=p*h[2],w=v?[b,b]:y,k=g?[b/s,b/s]:[w[0]/s,w[1]/s];return u.createElement("svg",{className:LN(["react-flow__background",c]),style:{...l,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:d,"data-testid":"rf__background"},u.createElement("pattern",{id:m+e,x:h[0]%y[0],y:h[1]%y[1],width:y[0],height:y[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`},g?u.createElement(x_,{color:f,radius:b/s}):u.createElement(v_,{dimensions:w,color:f,lineWidth:a})),u.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}k_.displayName="Background";var N_=r.memo(k_);function C_(e){return Math.min(11*e+35,200)}const E_=u.createContext("LR"),S_=r.memo((e=>{const t=b(51),{data:n,selected:o}=e,a=le(n.atom),s=he().inOrderIds.indexOf(a.id),i=o?"var(--gray-9)":"var(--gray-3)",l=EC(__),c=r.useContext(E_);let d,u,h,m,f;if(t[0]!==a.code||t[1]!==c||t[2]!==i||t[3]!==o){const e=a.code.split("\n").length,n="LR"===c?iE.Left:iE.Top;let r;t[8]!==i?(r={background:i},t[8]=i,t[9]=r):r=t[9],t[10]!==n||t[11]!==r?(h=k.jsx(WE,{type:"target",id:"inputs",position:n,style:r}),t[10]=n,t[11]=r,t[12]=h):h=t[12];const s="LR"===c?iE.Left:iE.Top;let l;t[13]!==i?(l={background:i},t[13]=i,t[14]=l):l=t[14],t[15]!==s||t[16]!==l?(m=k.jsx(WE,{type:"source",id:"inputs",position:s,style:l}),t[15]=s,t[16]=l,t[17]=m):m=t[17];const f=o&&"border-primary";t[18]!==f?(u=on("flex flex-col bg-card border border-input/50 rounded-md mx-[2px] overflow-hidden",f),t[18]=f,t[19]=u):u=t[19],d=C_(e),t[0]=a.code,t[1]=c,t[2]=i,t[3]=o,t[4]=d,t[5]=u,t[6]=h,t[7]=m}else d=t[4],u=t[5],h=t[6],m=t[7];var p;let g;t[20]!==n.forceWidth||t[21]!==l?(f=n.forceWidth||(p=l,Math.min(Math.max(p-100,100),400)),t[20]=n.forceWidth,t[21]=l,t[22]=f):f=t[22],t[23]!==d||t[24]!==f?(g={height:d,width:f},t[23]=d,t[24]=f,t[25]=g):g=t[25];const v=fs(a.name,s);let x,y,w;t[26]!==v?(x=k.jsx("div",{className:"text-muted-foreground font-semibold text-xs py-1 px-2 bg-muted border-b",children:v}),t[26]=v,t[27]=x):x=t[27],t[28]!==a.code?(y=k.jsx(Sl,{code:a.code}),t[28]=a.code,t[29]=y):y=t[29],t[30]!==u||t[31]!==g||t[32]!==x||t[33]!==y?(w=k.jsxs("div",{className:u,style:g,children:[x,y]}),t[30]=u,t[31]=g,t[32]=x,t[33]=y,t[34]=w):w=t[34];const N="LR"===c?iE.Right:iE.Bottom;let C,E;t[35]!==i?(C={background:i},t[35]=i,t[36]=C):C=t[36],t[37]!==N||t[38]!==C?(E=k.jsx(WE,{type:"source",id:"outputs",position:N,style:C}),t[37]=N,t[38]=C,t[39]=E):E=t[39];const S="LR"===c?iE.Right:iE.Bottom;let j,_,I;return t[40]!==i?(j={background:i},t[40]=i,t[41]=j):j=t[41],t[42]!==S||t[43]!==j?(_=k.jsx(WE,{type:"target",id:"outputs",position:S,style:j}),t[42]=S,t[43]=j,t[44]=_):_=t[44],t[45]!==h||t[46]!==m||t[47]!==w||t[48]!==E||t[49]!==_?(I=k.jsxs("div",{children:[h,m,w,E,_]}),t[45]=h,t[46]=m,t[47]=w,t[48]=E,t[49]=_,t[50]=I):I=t[50],I}),((e,t)=>["data","selected","id"].every((n=>e[n]===t[n]))));S_.displayName="CustomNode";const j_={custom:S_};function __(e){const{width:t}=e;return t}const I_=e=>{const t=b(18),{maxCount:n,cellIds:o,onClick:r,skipScroll:a}=e,s=he();let i,l,c,d;if(t[0]!==o||t[1]!==s.inOrderIds||t[2]!==n||t[3]!==a||t[4]!==r){c=Symbol.for("react.early_return_sentinel");e:{let e;t[8]!==s.inOrderIds?(e=(e,t)=>s.inOrderIds.indexOf(e)-s.inOrderIds.indexOf(t),t[8]=s.inOrderIds,t[9]=e):e=t[9];const d=[...o].sort(e);if(0===o.length){let e;t[10]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx("div",{className:"text-muted-foreground",children:"--"}),t[10]=e):e=t[10],c=e;break e}let u;t[11]!==a||t[12]!==r||t[13]!==o.length?(u=(e,t)=>k.jsxs("span",{className:"truncate",children:[k.jsx(ps,{variant:"focus",cellId:e,skipScroll:a,className:"whitespace-nowrap",onClick:r?()=>r(e):void 0},e),t<o.length-1&&", "]},e),t[11]=a,t[12]=r,t[13]=o.length,t[14]=u):u=t[14],i=d.slice(0,n).map(u),l=o.length>n&&k.jsxs(hn,{children:[k.jsx(xr,{asChild:!0,children:k.jsxs("span",{className:"whitespace-nowrap text-muted-foreground text-xs hover:underline cursor-pointer",children:["+",o.length-n," more"]})}),k.jsx(un,{className:"w-auto",children:k.jsx("div",{className:"flex flex-col gap-1 py-1",children:d.slice(n).map((e=>k.jsx(ps,{variant:"focus",cellId:e,className:"whitespace-nowrap",onClick:r?()=>r(e):void 0},e)))})})]})}t[0]=o,t[1]=s.inOrderIds,t[2]=n,t[3]=a,t[4]=r,t[5]=i,t[6]=l,t[7]=c}else i=t[5],l=t[6],c=t[7];return c!==Symbol.for("react.early_return_sentinel")?c:(t[15]!==i||t[16]!==l?(d=k.jsxs(k.Fragment,{children:[i,l]}),t[15]=i,t[16]=l,t[17]=d):d=t[17],d)},A_=e=>{const t=b(15);let n,o,r,a;t[0]!==e?(({name:r,declaredBy:n,onClick:o,...a}=e),t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=a):(n=t[1],o=t[2],r=t[3],a=t[4]);const s=n.length>1?"destructive":"outline";let i,l,c;return t[5]!==o||t[6]!==r?(i=async e=>{o?o(e):(await et(r),re({title:"Copied to clipboard"}))},t[5]=o,t[6]=r,t[7]=i):i=t[7],t[8]!==r||t[9]!==s||t[10]!==i?(l=k.jsx(gs,{title:r,variant:s,className:"rounded-sm text-ellipsis block overflow-hidden max-w-fit cursor-pointer font-medium",onClick:i,children:r}),t[8]=r,t[9]=s,t[10]=i,t[11]=l):l=t[11],t[12]!==a||t[13]!==l?(c=k.jsx("div",{className:"max-w-[130px]",...a,children:l}),t[12]=a,t[13]=l,t[14]=c):c=t[14],c},M_=r.memo((e=>{const t=b(38),{onChange:n,view:o,settings:r,onSettingsChange:a}=e;let s;t[0]!==a||t[1]!==r?(s=(e,t)=>{a({...r,[e]:t})},t[0]=a,t[1]=r,t[2]=s):s=t[2];const i=s;let l,c,d,u,h,m;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=k.jsx(xr,{asChild:!0,children:k.jsx(E,{variant:"text",size:"xs",children:k.jsx(At,{className:"w-4 h-4"})})}),t[3]=l):l=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx("div",{className:"font-semibold pb-4",children:"Settings"}),t[4]=c):c=t[4],t[5]!==i?(d=e=>i("hidePureMarkdown",Boolean(e)),t[5]=i,t[6]=d):d=t[6],t[7]!==r.hidePureMarkdown||t[8]!==d?(u=k.jsx(Wr,{"data-testid":"hide-pure-markdown-checkbox",id:"hide-pure-markdown",checked:r.hidePureMarkdown,onCheckedChange:d}),t[7]=r.hidePureMarkdown,t[8]=d,t[9]=u):u=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(h=k.jsx(Ae,{htmlFor:"hide-pure-markdown",children:"Hide pure markdown"}),t[10]=h):h=t[10],t[11]!==u?(m=k.jsxs(hn,{children:[l,k.jsxs(un,{className:"w-auto p-2 text-muted-foreground",children:[c,k.jsxs("div",{className:"flex items-center gap-2",children:[u,h]})]})]}),t[11]=u,t[12]=m):m=t[12];const f=m,p="_minimap_"===o;let g,v,x;t[13]!==n?(g=()=>n("_minimap_"),t[13]=n,t[14]=g):g=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(v=k.jsx(_c,{className:"w-4 h-4 mr-1"}),t[15]=v):v=t[15],t[16]!==p||t[17]!==g?(x=k.jsxs(E,{variant:"outline",className:"bg-background","aria-selected":p,size:"xs",onClick:g,children:[v,"Mini Map"]}),t[16]=p,t[17]=g,t[18]=x):x=t[18];const y="TB"===o;let w,N,C;t[19]!==n?(w=()=>n("TB"),t[19]=n,t[20]=w):w=t[20],t[21]===Symbol.for("react.memo_cache_sentinel")?(N=k.jsx(gc,{className:"w-4 h-4 mr-1"}),t[21]=N):N=t[21],t[22]!==y||t[23]!==w?(C=k.jsxs(E,{variant:"outline",className:"bg-background","aria-selected":y,size:"xs",onClick:w,children:[N,"Vertical Tree"]}),t[22]=y,t[23]=w,t[24]=C):C=t[24];const S="LR"===o;let j,_,I,A;t[25]!==n?(j=()=>n("LR"),t[25]=n,t[26]=j):j=t[26],t[27]===Symbol.for("react.memo_cache_sentinel")?(_=k.jsx(gc,{className:"w-4 h-4 mr-1 transform -rotate-90"}),t[27]=_):_=t[27],t[28]!==S||t[29]!==j?(I=k.jsxs(E,{variant:"outline",className:"bg-background","aria-selected":S,size:"xs",onClick:j,children:[_," ","Horizontal Tree"]}),t[28]=S,t[29]=j,t[30]=I):I=t[30],t[31]!==x||t[32]!==C||t[33]!==I?(A=k.jsxs("div",{className:"flex gap-2",children:[x,C,I]}),t[31]=x,t[32]=C,t[33]=I,t[34]=A):A=t[34];const M="_minimap_"!==o&&f;let T;return t[35]!==A||t[36]!==M?(T=k.jsxs(_C,{position:"top-right",className:"flex flex-col items-end gap-2",children:[A,M]}),t[35]=A,t[36]=M,t[37]=T):T=t[37],T}));M_.displayName="GraphToolbar";const T_=r.memo((e=>{const t=b(11),{selection:n,variables:o,onClearSelection:r}=e;if(!n)return null;const a=O_;let s;t[0]!==n.type||t[1]!==n.id||t[2]!==n.source||t[3]!==n.target||t[4]!==o||t[5]!==r?(s=()=>{if("node"===n.type){const e=Object.values(o).filter((e=>e.usedBy.includes(n.id))),t=Object.values(o).filter((e=>e.declaredBy.includes(n.id))),s=(e,t)=>k.jsxs(k.Fragment,{children:[0===e.length&&k.jsx("div",{className:"text-muted-foreground text-sm text-center",children:"--"}),k.jsx("div",{className:"grid grid-cols-5 gap-3 items-center text-sm py-1 flex-1 empty:hidden",children:e.map((e=>k.jsxs(u.Fragment,{children:[k.jsx(A_,{declaredBy:e.declaredBy,name:e.name}),k.jsxs("div",{className:"truncate col-span-2",title:e.value??"",children:[e.value,k.jsxs("span",{className:"ml-1 truncate text-foreground/60 font-mono",children:["(",e.dataType,")"]})]}),k.jsx("div",{className:"truncate col-span-2 gap-1 items-center",children:k.jsx(I_,{skipScroll:!0,onClick:()=>a("in"===t?e.declaredBy[0]:e.usedBy[0],e.name),maxCount:3,cellIds:e.usedBy})})]},e.name)))})]});return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[k.jsx(ct,{className:"w-5 h-5"}),k.jsx(ps,{cellId:n.id}),k.jsx("div",{className:"flex-1"}),k.jsx(ty,{cellId:n.id,children:k.jsx(E,{variant:"ghost",size:"icon",children:k.jsx(Zl,{className:"w-4 h-4"})})}),k.jsx(E,{variant:"text",size:"icon",onClick:()=>{r()},children:k.jsx(en,{className:"w-4 h-4"})})]}),k.jsxs("div",{className:"text-sm flex flex-col py-3 pl-2 pr-4 flex-1 justify-center",children:[k.jsxs("div",{className:"flex flex-col gap-2",children:[k.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[k.jsx(Pl,{className:"w-4 h-4"}),"Outputs"]}),s(t,"out")]}),k.jsx("hr",{className:"border-divider my-3"}),k.jsxs("div",{className:"flex flex-col gap-2",children:[k.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[k.jsx(Rl,{className:"w-4 h-4"}),"Inputs"]}),s(e,"in")]})]})]})}if("edge"===n.type){const e=Object.values(o).filter((e=>e.declaredBy.includes(n.source)&&e.usedBy.includes(n.target)));return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[k.jsx(qc,{className:"w-4 h-4"}),k.jsx(ps,{cellId:n.source}),k.jsx(Fl,{className:"w-4 h-4"}),k.jsx(ps,{cellId:n.target})]}),k.jsx("div",{className:"grid grid-cols-4 gap-3 max-w-[350px] items-center text-sm p-3 flex-1",children:e.map((e=>k.jsxs(u.Fragment,{children:[k.jsx(A_,{declaredBy:e.declaredBy,name:e.name,onClick:()=>{a(e.declaredBy[0],e.name)}}),k.jsx("div",{className:"truncate text-foreground/60 font-mono",children:e.dataType}),k.jsx("div",{className:"truncate col-span-2",title:e.value??"",children:e.value})]},e.name)))})]})}},t[0]=n.type,t[1]=n.id,t[2]=n.source,t[3]=n.target,t[4]=o,t[5]=r,t[6]=s):s=t[6];const i=s;let l,c;return t[7]!==i?(l=i(),t[7]=i,t[8]=l):l=t[8],t[9]!==l?(c=k.jsx(_C,{position:"bottom-left",className:"max-h-[90%] flex flex-col w-[calc(100%-5rem)]",children:k.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})}),t[9]=l,t[10]=c):c=t[10],c}));function O_(e,t){const n=qr(e);n&&vs(n,t)}function D_(){const e=b(7),t=AS(),n=EC(R_),o=EC(P_);let a;e[0]!==t?(a=()=>{t.fitView({duration:100})},e[0]=t,e[1]=a):a=e[1];const s=xs(a,100);let i,l;e[2]!==n||e[3]!==o||e[4]!==s?(i=()=>{n&&o&&s()},l=[n,o,s],e[2]=n,e[3]=o,e[4]=s,e[5]=i,e[6]=l):(i=e[5],l=e[6]),r.useEffect(i,l)}function P_(e){const{height:t}=e;return t}function R_(e){const{width:t}=e;return t}T_.displayName="GraphSelectionPanel";const F_=new class{createEdge(e,t,n){return{type:"smoothstep",pathOptions:{offset:20,borderRadius:100},data:{direction:n},markerEnd:{type:aE.Arrow},id:`${e}-${t}-${n}`,source:e,sourceHandle:n,targetHandle:n,target:t}}createNode(e,t,n){return{id:e,data:{atom:t},width:250,type:"custom",height:C_(te.get(t).code.trim().split("\n").length),position:{x:0,y:n+20}}}createElements(e,t,n,o){let r=0;const a=[],s=[];for(const[l,c]of Aa.zip(e,t)){const e=this.createNode(l,c,r);a.push(e),r=e.position.y+(e.height||0)}const i=new Set;for(const l of Object.values(n)){const{declaredBy:e,usedBy:t}=l;for(const n of e)for(const e of t){const t=`${n}-${e}`;i.has(t)||(i.add(t),s.push(this.createEdge(n,e,"inputs"),this.createEdge(n,e,"outputs")))}}return{nodes:a,edges:s}}},L_=e=>{const t=b(37),{cellIds:n,variables:o,cellAtoms:a,children:s}=e;let i;t[0]!==n||t[1]!==a||t[2]!==o?(i=F_.createElements(n,a,o,!1),t[0]=n,t[1]=a,t[2]=o,t[3]=i):i=t[3];const{nodes:l,edges:c}=i;let d;t[4]===Symbol.for("react.memo_cache_sentinel")?(d=[],t[4]=d):d=t[4];const[u,h]=a_(d),[m,f]=r_(l),[p,g]=r.useState(),[v,x]=r.useState(),y=r.useRef(!1);D_();const w=EC(z_);let N;t[5]!==f||t[6]!==h?(N=e=>{f(e.nodes),h([])},t[5]=f,t[6]=h,t[7]=N):N=t[7];const C=W(N);let E,S,j,_;t[8]!==C||t[9]!==n||t[10]!==a||t[11]!==o?(E=()=>{y.current?C(F_.createElements(n,a,o,!1)):y.current=!0},S=[n,o,a,C],t[8]=C,t[9]=n,t[10]=a,t[11]=o,t[12]=E,t[13]=S):(E=t[12],S=t[13]),r.useEffect(E,S),t[14]!==p||t[15]!==c||t[16]!==h?(j=()=>{if(p){const e=c.filter((e=>{const{source:t,target:n,data:o}=e;return t===p&&"outputs"===o.direction||n===p&&"inputs"===o.direction}));h(e)}},_=[p,h,c],t[14]=p,t[15]=c,t[16]=h,t[17]=j,t[18]=_):(j=t[17],_=t[18]),r.useEffect(j,_);const I=function(e,t){const n=b(17);let o,r;if(n[0]!==t||n[1]!==e){let o;n[3]!==t?(o=(e,n)=>{const{position:o}=n;return Math.min(e,o.y-t/2-10)},n[3]=t,n[4]=o):o=n[4],r=e.reduce(o,Number.POSITIVE_INFINITY),n[0]=t,n[1]=e,n[2]=r}else r=n[2];const a=r;let s;if(n[5]!==t||n[6]!==e){let o;n[8]!==t?(o=(e,n)=>{const{position:o}=n;return Math.max(e,o.y+t/2+10)},n[8]=t,n[9]=o):o=n[9],s=e.reduce(o,Number.NEGATIVE_INFINITY),n[5]=t,n[6]=e,n[7]=s}else s=n[7];const i=s;let l,c,d;n[10]!==a?(l=[Number.NEGATIVE_INFINITY,a],n[10]=a,n[11]=l):l=n[11];n[12]!==i?(c=[Number.POSITIVE_INFINITY,i],n[12]=i,n[13]=c):c=n[13];n[14]!==l||n[15]!==c?(d=[l,c],n[14]=l,n[15]=c,n[16]=d):d=n[16];return o=d,o}(m,w);let A;t[19]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{g(void 0),x(void 0)},t[19]=A):A=t[19];const M=A;let T;t[20]!==v||t[21]!==o||t[22]!==u||t[23]!==p?(T=()=>v?k.jsx(T_,{selection:{type:"edge",source:v.source,target:v.target},onClearSelection:M,variables:o,edges:u}):p?k.jsx(T_,{selection:{type:"node",id:p},variables:o,edges:u,onClearSelection:M}):null,t[20]=v,t[21]=o,t[22]=u,t[23]=p,t[24]=T):T=t[24];const O=T;let D,P,R,F;return t[25]!==h?(D=(e,t)=>{const n=t.id;g(n),x(void 0),h([])},t[25]=h,t[26]=D):D=t[26],t[27]===Symbol.for("react.memo_cache_sentinel")?(P=(e,t)=>{x(t)},t[27]=P):P=t[27],t[28]!==O?(R=O(),t[28]=O,t[29]=R):R=t[29],t[30]!==m||t[31]!==u||t[32]!==I||t[33]!==D||t[34]!==R||t[35]!==s?(F=k.jsxs(n_,{nodes:m,edges:u,nodeTypes:j_,translateExtent:I,onNodeClick:D,onNodeDoubleClick:B_,onEdgeClick:P,snapToGrid:!0,fitView:!0,elementsSelectable:!0,minZoom:1,maxZoom:1,draggable:!1,panOnScrollMode:QC.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:[R,s]}),t[30]=m,t[31]=u,t[32]=I,t[33]=D,t[34]=R,t[35]=s,t[36]=F):F=t[36],F};function z_(e){const{height:t}=e;return t}function B_(e,t){ys(t.id,"focus")}var U_="\0";function V_(e,t){e[t]?e[t]++:e[t]=1}function G_(e,t){--e[t]||delete e[t]}function $_(e,t,n,o){var r=""+t,a=""+n;if(!e&&r>a){var s=r;r=a,a=s}return r+""+a+""+(void 0===o?"\0":o)}function H_(e,t){return $_(e,t.v,t.w,t.name)}var W_=class{constructor(e){n(this,"_isDirected",!0),n(this,"_isMultigraph",!1),n(this,"_isCompound",!1),n(this,"_label"),n(this,"_defaultNodeLabelFn",(()=>{})),n(this,"_defaultEdgeLabelFn",(()=>{})),n(this,"_nodes",{}),n(this,"_in",{}),n(this,"_preds",{}),n(this,"_out",{}),n(this,"_sucs",{}),n(this,"_edgeObjs",{}),n(this,"_edgeLabels",{}),n(this,"_nodeCount",0),n(this,"_edgeCount",0),n(this,"_parent"),n(this,"_children"),e&&(this._isDirected=!Object.hasOwn(e,"directed")||e.directed,this._isMultigraph=!!Object.hasOwn(e,"multigraph")&&e.multigraph,this._isCompound=!!Object.hasOwn(e,"compound")&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children[U_]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=e,"function"!=typeof e&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter((t=>0===Object.keys(e._in[t]).length))}sinks(){var e=this;return this.nodes().filter((t=>0===Object.keys(e._out[t]).length))}setNodes(e,t){var n=arguments,o=this;return e.forEach((function(e){n.length>1?o.setNode(e,t):o.setNode(e)})),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=U_,this._children[e]={},this._children[U_][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var n=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach((function(e){t.setParent(e)})),delete this._children[e]),Object.keys(this._in[e]).forEach(n),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(void 0===t)t=U_;else{for(var n=t+="";void 0!==n;n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==U_)return t}}children(e=U_){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else{if(e===U_)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){const o=new Set(t);for(var n of this.successors(e))o.add(n);return Array.from(o.values())}}isLeaf(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;Object.entries(this._nodes).forEach((function([n,o]){e(n)&&t.setNode(n,o)})),Object.values(this._edgeObjs).forEach((function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))}));var o={};function r(e){var a=n.parent(e);return void 0===a||t.hasNode(a)?(o[e]=a,a):a in o?o[a]:r(a)}return this._isCompound&&t.nodes().forEach((e=>t.setParent(e,r(e)))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,"function"!=typeof e&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var n=this,o=arguments;return e.reduce((function(e,r){return o.length>1?n.setEdge(e,r,t):n.setEdge(e,r),r})),this}setEdge(){var e,t,n,o,r=!1,a=arguments[0];"object"==typeof a&&null!==a&&"v"in a?(e=a.v,t=a.w,n=a.name,2===arguments.length&&(o=arguments[1],r=!0)):(e=a,t=arguments[1],n=arguments[3],arguments.length>2&&(o=arguments[2],r=!0)),e=""+e,t=""+t,void 0!==n&&(n=""+n);var s=$_(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,s))return r&&(this._edgeLabels[s]=o),this;if(void 0!==n&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[s]=r?o:this._defaultEdgeLabelFn(e,t,n);var i=function(e,t,n,o){var r=""+t,a=""+n;if(!e&&r>a){var s=r;r=a,a=s}var i={v:r,w:a};o&&(i.name=o);return i}(this._isDirected,e,t,n);return e=i.v,t=i.w,Object.freeze(i),this._edgeObjs[s]=i,V_(this._preds[t],e),V_(this._sucs[e],t),this._in[t][s]=i,this._out[e][s]=i,this._edgeCount++,this}edge(e,t,n){var o=1===arguments.length?H_(this._isDirected,arguments[0]):$_(this._isDirected,e,t,n);return this._edgeLabels[o]}edgeAsObj(){const e=this.edge(...arguments);return"object"!=typeof e?{label:e}:e}hasEdge(e,t,n){var o=1===arguments.length?H_(this._isDirected,arguments[0]):$_(this._isDirected,e,t,n);return Object.hasOwn(this._edgeLabels,o)}removeEdge(e,t,n){var o=1===arguments.length?H_(this._isDirected,arguments[0]):$_(this._isDirected,e,t,n),r=this._edgeObjs[o];return r&&(e=r.v,t=r.w,delete this._edgeLabels[o],delete this._edgeObjs[o],G_(this._preds[t],e),G_(this._sucs[e],t),delete this._in[t][o],delete this._out[e][o],this._edgeCount--),this}inEdges(e,t){var n=this._in[e];if(n){var o=Object.values(n);return t?o.filter((e=>e.v===t)):o}}outEdges(e,t){var n=this._out[e];if(n){var o=Object.values(n);return t?o.filter((e=>e.w===t)):o}}nodeEdges(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}},q_={Graph:W_,version:"2.2.4"},Y_=W_,X_={write:function(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:K_(e),edges:J_(e)};void 0!==e.graph()&&(t.value=structuredClone(e.graph()));return t},read:function(e){var t=new Y_(e.options).setGraph(e.value);return e.nodes.forEach((function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)})),e.edges.forEach((function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)})),t}};function K_(e){return e.nodes().map((function(t){var n=e.node(t),o=e.parent(t),r={v:t};return void 0!==n&&(r.value=n),void 0!==o&&(r.parent=o),r}))}function J_(e){return e.edges().map((function(t){var n=e.edge(t),o={v:t.v,w:t.w};return void 0!==t.name&&(o.name=t.name),void 0!==n&&(o.value=n),o}))}var Z_=function(e){var t,n={},o=[];function r(o){Object.hasOwn(n,o)||(n[o]=!0,t.push(o),e.successors(o).forEach(r),e.predecessors(o).forEach(r))}return e.nodes().forEach((function(e){t=[],r(e),t.length&&o.push(t)})),o};var Q_=class{constructor(){n(this,"_arr",[]),n(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map((function(e){return e.key}))}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var t=this._keyIndices[e];if(void 0!==t)return this._arr[t].priority}min(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key}add(e,t){var n=this._keyIndices;if(e=String(e),!Object.hasOwn(n,e)){var o=this._arr,r=o.length;return n[e]=r,o.push({key:e,priority:t}),this._decrease(r),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[n].priority+" New: "+t);this._arr[n].priority=t,this._decrease(n)}_heapify(e){var t=this._arr,n=2*e,o=n+1,r=e;n<t.length&&(r=t[n].priority<t[r].priority?n:r,o<t.length&&(r=t[o].priority<t[r].priority?o:r),r!==e&&(this._swap(e,r),this._heapify(r)))}_decrease(e){for(var t,n=this._arr,o=n[e].priority;0!==e&&!(n[t=e>>1].priority<o);)this._swap(e,t),e=t}_swap(e,t){var n=this._arr,o=this._keyIndices,r=n[e],a=n[t];n[e]=a,n[t]=r,o[a.key]=e,o[r.key]=t}},eI=Q_,tI=function(e,t,n,o){return function(e,t,n,o){var r,a,s={},i=new eI,l=function(e){var t=e.v!==r?e.v:e.w,o=s[t],l=n(e),c=a.distance+l;if(l<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+l);c<o.distance&&(o.distance=c,o.predecessor=r,i.decrease(t,c))};e.nodes().forEach((function(e){var n=e===t?0:Number.POSITIVE_INFINITY;s[e]={distance:n},i.add(e,n)}));for(;i.size()>0&&(r=i.removeMin(),(a=s[r]).distance!==Number.POSITIVE_INFINITY);)o(r).forEach(l);return s}(e,String(t),n||nI,o||function(t){return e.outEdges(t)})},nI=()=>1;var oI=tI,rI=function(e,t,n){return e.nodes().reduce((function(o,r){return o[r]=oI(e,r,t,n),o}),{})};var aI=function(e){var t=0,n=[],o={},r=[];function a(s){var i=o[s]={onStack:!0,lowlink:t,index:t++};if(n.push(s),e.successors(s).forEach((function(e){Object.hasOwn(o,e)?o[e].onStack&&(i.lowlink=Math.min(i.lowlink,o[e].index)):(a(e),i.lowlink=Math.min(i.lowlink,o[e].lowlink))})),i.lowlink===i.index){var l,c=[];do{l=n.pop(),o[l].onStack=!1,c.push(l)}while(s!==l);r.push(c)}}return e.nodes().forEach((function(e){Object.hasOwn(o,e)||a(e)})),r};var sI=aI,iI=function(e){return sI(e).filter((function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])}))};var lI=function(e,t,n){return function(e,t,n){var o={},r=e.nodes();return r.forEach((function(e){o[e]={},o[e][e]={distance:0},r.forEach((function(t){e!==t&&(o[e][t]={distance:Number.POSITIVE_INFINITY})})),n(e).forEach((function(n){var r=n.v===e?n.w:n.v,a=t(n);o[e][r]={distance:a,predecessor:e}}))})),r.forEach((function(e){var t=o[e];r.forEach((function(n){var a=o[n];r.forEach((function(n){var o=a[e],r=t[n],s=a[n],i=o.distance+r.distance;i<s.distance&&(s.distance=i,s.predecessor=r.predecessor)}))}))})),o}(e,t||cI,n||function(t){return e.outEdges(t)})},cI=()=>1;function dI(e){var t={},n={},o=[];if(e.sinks().forEach((function r(a){if(Object.hasOwn(n,a))throw new uI;Object.hasOwn(t,a)||(n[a]=!0,t[a]=!0,e.predecessors(a).forEach(r),delete n[a],o.push(a))})),Object.keys(t).length!==e.nodeCount())throw new uI;return o}class uI extends Error{constructor(){super(...arguments)}}var hI=dI;dI.CycleException=uI;var mI=hI;var fI=function(e,t,n){Array.isArray(t)||(t=[t]);var o=e.isDirected()?t=>e.successors(t):t=>e.neighbors(t),r="post"===n?pI:gI,a=[],s={};return t.forEach((t=>{if(!e.hasNode(t))throw new Error("Graph does not have node: "+t);r(t,o,s,a)})),a};function pI(e,t,n,o){for(var r=[[e,!1]];r.length>0;){var a=r.pop();a[1]?o.push(a[0]):Object.hasOwn(n,a[0])||(n[a[0]]=!0,r.push([a[0],!0]),vI(t(a[0]),(e=>r.push([e,!1]))))}}function gI(e,t,n,o){for(var r=[e];r.length>0;){var a=r.pop();Object.hasOwn(n,a)||(n[a]=!0,o.push(a),vI(t(a),(e=>r.push(e))))}}function vI(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}var xI=fI;var yI=fI;var bI=W_,wI=Q_;var kI={Graph:q_.Graph,json:X_,alg:{components:Z_,dijkstra:tI,dijkstraAll:rI,findCycles:iI,floydWarshall:lI,isAcyclic:function(e){try{mI(e)}catch(t){if(t instanceof mI.CycleException)return!1;throw t}return!0},postorder:function(e,t){return xI(e,t,"post")},preorder:function(e,t){return yI(e,t,"pre")},prim:function(e,t){var n,o=new bI,r={},a=new wI;function s(e){var o=e.v===n?e.w:e.v,s=a.priority(o);if(void 0!==s){var i=t(e);i<s&&(r[o]=n,a.decrease(o,i))}}if(0===e.nodeCount())return o;e.nodes().forEach((function(e){a.add(e,Number.POSITIVE_INFINITY),o.setNode(e)})),a.decrease(e.nodes()[0],0);var i=!1;for(;a.size()>0;){if(n=a.removeMin(),Object.hasOwn(r,n))o.setEdge(n,r[n]);else{if(i)throw new Error("Input graph is not connected: "+e);i=!0}e.nodeEdges(n).forEach(s)}return o},tarjan:aI,topsort:hI},version:q_.version};function NI(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function CI(e,t){if("_next"!==e&&"_prev"!==e)return t}let EI=kI.Graph,SI=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return NI(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&NI(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,CI)),n=n._prev;return"["+e.join(", ")+"]"}};var jI=function(e,t){if(e.nodeCount()<=1)return[];let n=function(e,t){let n=new EI,o=0,r=0;e.nodes().forEach((e=>{n.setNode(e,{v:e,in:0,out:0})})),e.edges().forEach((e=>{let a=n.edge(e.v,e.w)||0,s=t(e),i=a+s;n.setEdge(e.v,e.w,i),r=Math.max(r,n.node(e.v).out+=s),o=Math.max(o,n.node(e.w).in+=s)}));let a=function(e){const t=[];for(let n=0;n<e;n++)t.push(n);return t}(r+o+3).map((()=>new SI)),s=o+1;return n.nodes().forEach((e=>{AI(a,s,n.node(e))})),{graph:n,buckets:a,zeroIdx:s}}(e,t||_I);return function(e,t,n){let o,r=[],a=t[t.length-1],s=t[0];for(;e.nodeCount();){for(;o=s.dequeue();)II(e,t,n,o);for(;o=a.dequeue();)II(e,t,n,o);if(e.nodeCount())for(let a=t.length-2;a>0;--a)if(o=t[a].dequeue(),o){r=r.concat(II(e,t,n,o,!0));break}}return r}(n.graph,n.buckets,n.zeroIdx).flatMap((t=>e.outEdges(t.v,t.w)))};let _I=()=>1;function II(e,t,n,o,r){let a=r?[]:void 0;return e.inEdges(o.v).forEach((o=>{let s=e.edge(o),i=e.node(o.v);r&&a.push({v:o.v,w:o.w}),i.out-=s,AI(t,n,i)})),e.outEdges(o.v).forEach((o=>{let r=e.edge(o),a=o.w,s=e.node(a);s.in-=r,AI(t,n,s)})),e.removeNode(o.v),a}function AI(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}let MI=kI.Graph;var TI={addBorderNode:function(e,t,n,o){let r={width:0,height:0};arguments.length>=4&&(r.rank=n,r.order=o);return OI(e,"border",r,t)},addDummyNode:OI,applyWithChunking:PI,asNonCompoundGraph:function(e){let t=new MI({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach((n=>{e.children(n).length||t.setNode(n,e.node(n))})),e.edges().forEach((n=>{t.setEdge(n,e.edge(n))})),t},buildLayerMatrix:function(e){let t=zI(RI(e)+1).map((()=>[]));return e.nodes().forEach((n=>{let o=e.node(n),r=o.rank;void 0!==r&&(t[r][o.order]=n)})),t},intersectRect:function(e,t){let n,o,r=e.x,a=e.y,s=t.x-r,i=t.y-a,l=e.width/2,c=e.height/2;if(!s&&!i)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(i)*l>Math.abs(s)*c?(i<0&&(c=-c),n=c*s/i,o=c):(s<0&&(l=-l),n=l,o=l*i/s);return{x:r+n,y:a+o}},mapValues:function(e,t){let n=t;"string"==typeof t&&(n=e=>e[t]);return Object.entries(e).reduce(((e,[t,o])=>(e[t]=n(o,t),e)),{})},maxRank:RI,normalizeRanks:function(e){let t=e.nodes().map((t=>{let n=e.node(t).rank;return void 0===n?Number.MAX_VALUE:n})),n=PI(Math.min,t);e.nodes().forEach((t=>{let o=e.node(t);Object.hasOwn(o,"rank")&&(o.rank-=n)}))},notime:function(e,t){return t()},partition:function(e,t){let n={lhs:[],rhs:[]};return e.forEach((e=>{t(e)?n.lhs.push(e):n.rhs.push(e)})),n},pick:function(e,t){const n={};for(const o of t)void 0!==e[o]&&(n[o]=e[o]);return n},predecessorWeights:function(e){let t=e.nodes().map((t=>{let n={};return e.inEdges(t).forEach((t=>{n[t.v]=(n[t.v]||0)+e.edge(t).weight})),n}));return BI(e.nodes(),t)},range:zI,removeEmptyRanks:function(e){let t=e.nodes().map((t=>e.node(t).rank)),n=PI(Math.min,t),o=[];e.nodes().forEach((t=>{let r=e.node(t).rank-n;o[r]||(o[r]=[]),o[r].push(t)}));let r=0,a=e.graph().nodeRankFactor;Array.from(o).forEach(((t,n)=>{void 0===t&&n%a!=0?--r:void 0!==t&&r&&t.forEach((t=>e.node(t).rank+=r))}))},simplify:function(e){let t=(new MI).setGraph(e.graph());return e.nodes().forEach((n=>t.setNode(n,e.node(n)))),e.edges().forEach((n=>{let o=t.edge(n.v,n.w)||{weight:0,minlen:1},r=e.edge(n);t.setEdge(n.v,n.w,{weight:o.weight+r.weight,minlen:Math.max(o.minlen,r.minlen)})})),t},successorWeights:function(e){let t=e.nodes().map((t=>{let n={};return e.outEdges(t).forEach((t=>{n[t.w]=(n[t.w]||0)+e.edge(t).weight})),n}));return BI(e.nodes(),t)},time:function(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}},uniqueId:LI,zipObject:BI};function OI(e,t,n,o){let r;do{r=LI(o)}while(e.hasNode(r));return n.dummy=t,e.setNode(r,n),r}const DI=65535;function PI(e,t){if(t.length>DI){const n=function(e,t=DI){const n=[];for(let o=0;o<e.length;o+=t){const r=e.slice(o,o+t);n.push(r)}return n}(t);return e.apply(null,n.map((t=>e.apply(null,t))))}return e.apply(null,t)}function RI(e){const t=e.nodes().map((t=>{let n=e.node(t).rank;return void 0===n?Number.MIN_VALUE:n}));return PI(Math.max,t)}let FI=0;function LI(e){var t=++FI;return toString(e)+t}function zI(e,t,n=1){null==t&&(t=e,e=0);let o=e=>e<t;n<0&&(o=e=>t<e);const r=[];for(let a=e;o(a);a+=n)r.push(a);return r}function BI(e,t){return e.reduce(((e,n,o)=>(e[n]=t[o],e)),{})}let UI=jI,VI=TI.uniqueId;var GI={run:function(e){("greedy"===e.graph().acyclicer?UI(e,(t=e,e=>t.edge(e).weight)):function(e){let t=[],n={},o={};function r(a){Object.hasOwn(o,a)||(o[a]=!0,n[a]=!0,e.outEdges(a).forEach((e=>{Object.hasOwn(n,e.w)?t.push(e):r(e.w)})),delete n[a])}return e.nodes().forEach(r),t}(e)).forEach((t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,VI("rev"))}));var t},undo:function(e){e.edges().forEach((t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let o=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,o)}}))}};let $I=TI;var HI={run:function(e){e.graph().dummyChains=[],e.edges().forEach((t=>function(e,t){let n,o,r,a=t.v,s=e.node(a).rank,i=t.w,l=e.node(i).rank,c=t.name,d=e.edge(t),u=d.labelRank;if(l===s+1)return;for(e.removeEdge(t),r=0,++s;s<l;++r,++s)d.points=[],o={width:0,height:0,edgeLabel:d,edgeObj:t,rank:s},n=$I.addDummyNode(e,"edge",o,"_d"),s===u&&(o.width=d.width,o.height=d.height,o.dummy="edge-label",o.labelpos=d.labelpos),e.setEdge(a,n,{weight:d.weight},c),0===r&&e.graph().dummyChains.push(n),a=n;e.setEdge(a,i,{weight:d.weight},c)}(e,t)))},undo:function(e){e.graph().dummyChains.forEach((t=>{let n,o=e.node(t),r=o.edgeLabel;for(e.setEdge(o.edgeObj,r);o.dummy;)n=e.successors(t)[0],e.removeNode(t),r.points.push({x:o.x,y:o.y}),"edge-label"===o.dummy&&(r.x=o.x,r.y=o.y,r.width=o.width,r.height=o.height),t=n,o=e.node(t)}))}};const{applyWithChunking:WI}=TI;var qI={longestPath:function(e){var t={};e.sources().forEach((function n(o){var r=e.node(o);if(Object.hasOwn(t,o))return r.rank;t[o]=!0;let a=e.outEdges(o).map((t=>null==t?Number.POSITIVE_INFINITY:n(t.w)-e.edge(t).minlen));var s=WI(Math.min,a);return s===Number.POSITIVE_INFINITY&&(s=0),r.rank=s}))},slack:function(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}};var YI=kI.Graph,XI=qI.slack,KI=function(e){var t,n,o=new YI({directed:!1}),r=e.nodes()[0],a=e.nodeCount();o.setNode(r,{});for(;JI(o,e)<a;)t=ZI(o,e),n=o.hasNode(t.v)?XI(e,t):-XI(e,t),QI(o,e,n);return o};function JI(e,t){return e.nodes().forEach((function n(o){t.nodeEdges(o).forEach((r=>{var a=r.v,s=o===a?r.w:a;e.hasNode(s)||XI(t,r)||(e.setNode(s,{}),e.setEdge(o,s,{}),n(s))}))})),e.nodeCount()}function ZI(e,t){return t.edges().reduce(((n,o)=>{let r=Number.POSITIVE_INFINITY;return e.hasNode(o.v)!==e.hasNode(o.w)&&(r=XI(t,o)),r<n[0]?[r,o]:n}),[Number.POSITIVE_INFINITY,null])[1]}function QI(e,t,n){e.nodes().forEach((e=>t.node(e).rank+=n))}var eA=KI,tA=qI.slack,nA=qI.longestPath,oA=kI.alg.preorder,rA=kI.alg.postorder,aA=TI.simplify,sA=iA;function iA(e){e=aA(e),nA(e);var t,n=eA(e);for(dA(n),lA(n,e);t=hA(n);)fA(n,e,t,mA(n,e,t))}function lA(e,t){var n=rA(e,e.nodes());(n=n.slice(0,n.length-1)).forEach((n=>function(e,t,n){var o=e.node(n),r=o.parent;e.edge(n,r).cutvalue=cA(e,t,n)}(e,t,n)))}function cA(e,t,n){var o=e.node(n).parent,r=!0,a=t.edge(n,o),s=0;return a||(r=!1,a=t.edge(o,n)),s=a.weight,t.nodeEdges(n).forEach((a=>{var i,l,c=a.v===n,d=c?a.w:a.v;if(d!==o){var u=c===r,h=t.edge(a).weight;if(s+=u?h:-h,i=n,l=d,e.hasEdge(i,l)){var m=e.edge(n,d).cutvalue;s+=u?-m:m}}})),s}function dA(e,t){arguments.length<2&&(t=e.nodes()[0]),uA(e,{},1,t)}function uA(e,t,n,o,r){var a=n,s=e.node(o);return t[o]=!0,e.neighbors(o).forEach((r=>{Object.hasOwn(t,r)||(n=uA(e,t,n,r,o))})),s.low=a,s.lim=n++,r?s.parent=r:delete s.parent,n}function hA(e){return e.edges().find((t=>e.edge(t).cutvalue<0))}function mA(e,t,n){var o=n.v,r=n.w;t.hasEdge(o,r)||(o=n.w,r=n.v);var a=e.node(o),s=e.node(r),i=a,l=!1;return a.lim>s.lim&&(i=s,l=!0),t.edges().filter((t=>l===pA(e,e.node(t.v),i)&&l!==pA(e,e.node(t.w),i))).reduce(((e,n)=>tA(t,n)<tA(t,e)?n:e))}function fA(e,t,n,o){var r=n.v,a=n.w;e.removeEdge(r,a),e.setEdge(o.v,o.w,{}),dA(e),lA(e,t),function(e,t){var n=e.nodes().find((e=>!t.node(e).parent)),o=oA(e,n);(o=o.slice(1)).forEach((n=>{var o=e.node(n).parent,r=t.edge(n,o),a=!1;r||(r=t.edge(o,n),a=!0),t.node(n).rank=t.node(o).rank+(a?r.minlen:-r.minlen)}))}(e,t)}function pA(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}iA.initLowLimValues=dA,iA.initCutValues=lA,iA.calcCutValue=cA,iA.leaveEdge=hA,iA.enterEdge=mA,iA.exchangeEdges=fA;var gA=qI.longestPath,vA=KI,xA=sA,yA=function(e){switch(e.graph().ranker){case"network-simplex":default:wA(e);break;case"tight-tree":!function(e){gA(e),vA(e)}(e);break;case"longest-path":bA(e)}};var bA=gA;function wA(e){xA(e)}let kA=TI;function NA(e,t,n,o,r,a,s){let i=e.children(s);if(!i.length)return void(s!==t&&e.setEdge(t,s,{weight:0,minlen:n}));let l=kA.addBorderNode(e,"_bt"),c=kA.addBorderNode(e,"_bb"),d=e.node(s);e.setParent(l,s),d.borderTop=l,e.setParent(c,s),d.borderBottom=c,i.forEach((i=>{NA(e,t,n,o,r,a,i);let d=e.node(i),u=d.borderTop?d.borderTop:i,h=d.borderBottom?d.borderBottom:i,m=d.borderTop?o:2*o,f=u!==h?1:r-a[s]+1;e.setEdge(l,u,{weight:m,minlen:f,nestingEdge:!0}),e.setEdge(h,c,{weight:m,minlen:f,nestingEdge:!0})})),e.parent(s)||e.setEdge(t,l,{weight:0,minlen:r+a[s]})}let CA=TI;function EA(e,t,n,o,r,a){let s={width:0,height:0,rank:a,borderType:t},i=r[t][a-1],l=CA.addDummyNode(e,"border",s,n);r[t][a]=l,e.setParent(l,o),i&&e.setEdge(i,l,{weight:1})}function SA(e){e.nodes().forEach((t=>jA(e.node(t)))),e.edges().forEach((t=>jA(e.edge(t))))}function jA(e){let t=e.width;e.width=e.height,e.height=t}function _A(e){e.y=-e.y}function IA(e){let t=e.x;e.x=e.y,e.y=t}let AA=TI;let MA=TI.zipObject;function TA(e,t,n){let o=MA(n,n.map(((e,t)=>t))),r=t.flatMap((t=>e.outEdges(t).map((t=>({pos:o[t.w],weight:e.edge(t).weight}))).sort(((e,t)=>e.pos-t.pos)))),a=1;for(;a<n.length;)a<<=1;let s=2*a-1;a-=1;let i=new Array(s).fill(0),l=0;return r.forEach((e=>{let t=e.pos+a;i[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=i[t+1]),t=t-1>>1,i[t]+=e.weight;l+=e.weight*n})),l}let OA=TI;let DA=TI;function PA(e,t,n){let o;for(;t.length&&(o=t[t.length-1]).i<=n;)t.pop(),e.push(o.vs),n++;return n}let RA=function(e,t=[]){return t.map((t=>{let n=e.inEdges(t);if(n.length){let o=n.reduce(((t,n)=>{let o=e.edge(n),r=e.node(n.v);return{sum:t.sum+o.weight*r.order,weight:t.weight+o.weight}}),{sum:0,weight:0});return{v:t,barycenter:o.sum/o.weight,weight:o.weight}}return{v:t}}))},FA=function(e,t){let n={};return e.forEach(((e,t)=>{let o=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};void 0!==e.barycenter&&(o.barycenter=e.barycenter,o.weight=e.weight)})),t.edges().forEach((e=>{let t=n[e.v],o=n[e.w];void 0!==t&&void 0!==o&&(o.indegree++,t.out.push(n[e.w]))})),function(e){let t=[];function n(e){return t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&function(e,t){let n=0,o=0;e.weight&&(n+=e.barycenter*e.weight,o+=e.weight);t.weight&&(n+=t.barycenter*t.weight,o+=t.weight);e.vs=t.vs.concat(e.vs),e.barycenter=n/o,e.weight=o,e.i=Math.min(t.i,e.i),t.merged=!0}(e,t)}}function o(t){return n=>{n.in.push(t),0==--n.indegree&&e.push(n)}}for(;e.length;){let r=e.pop();t.push(r),r.in.reverse().forEach(n(r)),r.out.forEach(o(r))}return t.filter((e=>!e.merged)).map((e=>OA.pick(e,["vs","i","barycenter","weight"])))}(Object.values(n).filter((e=>!e.indegree)))},LA=function(e,t){let n=DA.partition(e,(e=>Object.hasOwn(e,"barycenter"))),o=n.lhs,r=n.rhs.sort(((e,t)=>t.i-e.i)),a=[],s=0,i=0,l=0;o.sort((c=!!t,(e,t)=>e.barycenter<t.barycenter?-1:e.barycenter>t.barycenter?1:c?t.i-e.i:e.i-t.i)),l=PA(a,r,l),o.forEach((e=>{l+=e.vs.length,a.push(e.vs),s+=e.barycenter*e.weight,i+=e.weight,l=PA(a,r,l)}));var c;let d={vs:a.flat(!0)};i&&(d.barycenter=s/i,d.weight=i);return d};var zA=function e(t,n,o,r){let a=t.children(n),s=t.node(n),i=s?s.borderLeft:void 0,l=s?s.borderRight:void 0,c={};i&&(a=a.filter((e=>e!==i&&e!==l)));let d=RA(t,a);d.forEach((n=>{if(t.children(n.v).length){let i=e(t,n.v,o,r);c[n.v]=i,Object.hasOwn(i,"barycenter")&&(s=i,void 0!==(a=n).barycenter?(a.barycenter=(a.barycenter*a.weight+s.barycenter*s.weight)/(a.weight+s.weight),a.weight+=s.weight):(a.barycenter=s.barycenter,a.weight=s.weight))}var a,s}));let u=FA(d,o);!function(e,t){e.forEach((e=>{e.vs=e.vs.flatMap((e=>t[e]?t[e].vs:e))}))}(u,c);let h=LA(u,r);if(i&&(h.vs=[i,h.vs,l].flat(!0),t.predecessors(i).length)){let e=t.node(t.predecessors(i)[0]),n=t.node(t.predecessors(l)[0]);Object.hasOwn(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+e.order+n.order)/(h.weight+2),h.weight+=2}return h};let BA=kI.Graph,UA=TI;let VA=function(e){let t={},n=e.nodes().filter((t=>!e.children(t).length)),o=n.map((t=>e.node(t).rank)),r=AA.applyWithChunking(Math.max,o),a=AA.range(r+1).map((()=>[]));return n.sort(((t,n)=>e.node(t).rank-e.node(n).rank)).forEach((function n(o){if(t[o])return;t[o]=!0;let r=e.node(o);a[r.rank].push(o),e.successors(o).forEach(n)})),a},GA=function(e,t){let n=0;for(let o=1;o<t.length;++o)n+=TA(e,t[o-1],t[o]);return n},$A=zA,HA=function(e,t,n){let o=function(e){var t;for(;e.hasNode(t=UA.uniqueId("_root")););return t}(e),r=new BA({compound:!0}).setGraph({root:o}).setDefaultNodeLabel((t=>e.node(t)));return e.nodes().forEach((a=>{let s=e.node(a),i=e.parent(a);(s.rank===t||s.minRank<=t&&t<=s.maxRank)&&(r.setNode(a),r.setParent(a,i||o),e[n](a).forEach((t=>{let n=t.v===a?t.w:t.v,o=r.edge(n,a),s=void 0!==o?o.weight:0;r.setEdge(n,a,{weight:e.edge(t).weight+s})})),Object.hasOwn(s,"minRank")&&r.setNode(a,{borderLeft:s.borderLeft[t],borderRight:s.borderRight[t]}))})),r},WA=function(e,t,n){let o,r={};n.forEach((n=>{let a,s,i=e.parent(n);for(;i;){if(a=e.parent(i),a?(s=r[a],r[a]=i):(s=o,o=i),s&&s!==i)return void t.setEdge(s,i);i=a}}))},qA=kI.Graph,YA=TI;var XA=function e(t,n){if(n&&"function"==typeof n.customOrder)return void n.customOrder(t,e);let o=YA.maxRank(t),r=KA(t,YA.range(1,o+1),"inEdges"),a=KA(t,YA.range(o-1,-1,-1),"outEdges"),s=VA(t);if(ZA(t,s),n&&n.disableOptimalOrderHeuristic)return;let i,l=Number.POSITIVE_INFINITY;for(let c=0,d=0;d<4;++c,++d){JA(c%2?r:a,c%4>=2),s=YA.buildLayerMatrix(t);let e=GA(t,s);e<l&&(d=0,i=Object.assign({},s),l=e)}ZA(t,i)};function KA(e,t,n){return t.map((function(t){return HA(e,t,n)}))}function JA(e,t){let n=new qA;e.forEach((function(e){let o=e.graph().root,r=$A(e,o,n,t);r.vs.forEach(((t,n)=>e.node(t).order=n)),WA(e,n,r.vs)}))}function ZA(e,t){Object.values(t).forEach((t=>t.forEach(((t,n)=>e.node(t).order=n))))}let QA=kI.Graph,eM=TI;var tM=function(e){let t,n=eM.buildLayerMatrix(e),o=Object.assign(nM(e,n),oM(e,n)),r={};["u","d"].forEach((a=>{t="u"===a?n:Object.values(n).reverse(),["l","r"].forEach((n=>{"r"===n&&(t=t.map((e=>Object.values(e).reverse())));let s=("u"===a?e.predecessors:e.successors).bind(e),i=sM(e,t,o,s),l=iM(e,t,i.root,i.align,"r"===n);"r"===n&&(l=eM.mapValues(l,(e=>-e))),r[a+n]=l}))}));let a=lM(e,r);return cM(r,a),dM(r,e.graph().align)};function nM(e,t){let n={};return t.length&&t.reduce((function(t,o){let r=0,a=0,s=t.length,i=o[o.length-1];return o.forEach(((t,l)=>{let c=function(e,t){if(e.node(t).dummy)return e.predecessors(t).find((t=>e.node(t).dummy))}(e,t),d=c?e.node(c).order:s;(c||t===i)&&(o.slice(a,l+1).forEach((t=>{e.predecessors(t).forEach((o=>{let a=e.node(o),s=a.order;!(s<r||d<s)||a.dummy&&e.node(t).dummy||rM(n,o,t)}))})),a=l+1,r=d)})),o})),n}function oM(e,t){let n={};function o(t,o,r,a,s){let i;eM.range(o,r).forEach((o=>{i=t[o],e.node(i).dummy&&e.predecessors(i).forEach((t=>{let o=e.node(t);o.dummy&&(o.order<a||o.order>s)&&rM(n,t,i)}))}))}return t.length&&t.reduce((function(t,n){let r,a=-1,s=0;return n.forEach(((i,l)=>{if("border"===e.node(i).dummy){let t=e.predecessors(i);t.length&&(r=e.node(t[0]).order,o(n,s,l,a,r),s=l,a=r)}o(n,s,n.length,r,t.length)})),n})),n}function rM(e,t,n){if(t>n){let e=t;t=n,n=e}let o=e[t];o||(e[t]=o={}),o[n]=!0}function aM(e,t,n){if(t>n){let e=t;t=n,n=e}return!!e[t]&&Object.hasOwn(e[t],n)}function sM(e,t,n,o){let r={},a={},s={};return t.forEach((e=>{e.forEach(((e,t)=>{r[e]=e,a[e]=e,s[e]=t}))})),t.forEach((e=>{let t=-1;e.forEach((e=>{let i=o(e);if(i.length){i=i.sort(((e,t)=>s[e]-s[t]));let o=(i.length-1)/2;for(let l=Math.floor(o),c=Math.ceil(o);l<=c;++l){let o=i[l];a[e]===e&&t<s[o]&&!aM(n,e,o)&&(a[o]=e,a[e]=r[e]=r[o],t=s[o])}}}))})),{root:r,align:a}}function iM(e,t,n,o,r){let a={},s=function(e,t,n,o){let r=new QA,a=e.graph(),s=function(e,t,n){return(o,r,a)=>{let s,i=o.node(r),l=o.node(a),c=0;if(c+=i.width/2,Object.hasOwn(i,"labelpos"))switch(i.labelpos.toLowerCase()){case"l":s=-i.width/2;break;case"r":s=i.width/2}if(s&&(c+=n?s:-s),s=0,c+=(i.dummy?t:e)/2,c+=(l.dummy?t:e)/2,c+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":s=l.width/2;break;case"r":s=-l.width/2}return s&&(c+=n?s:-s),s=0,c}}(a.nodesep,a.edgesep,o);return t.forEach((t=>{let o;t.forEach((t=>{let a=n[t];if(r.setNode(a),o){var i=n[o],l=r.edge(i,a);r.setEdge(i,a,Math.max(s(e,t,o),l||0))}o=t}))})),r}(e,t,n,r),i=r?"borderLeft":"borderRight";function l(e,t){let n=s.nodes(),o=n.pop(),r={};for(;o;)r[o]?e(o):(r[o]=!0,n.push(o),n=n.concat(t(o))),o=n.pop()}return l((function(e){a[e]=s.inEdges(e).reduce(((e,t)=>Math.max(e,a[t.v]+s.edge(t))),0)}),s.predecessors.bind(s)),l((function(t){let n=s.outEdges(t).reduce(((e,t)=>Math.min(e,a[t.w]-s.edge(t))),Number.POSITIVE_INFINITY),o=e.node(t);n!==Number.POSITIVE_INFINITY&&o.borderType!==i&&(a[t]=Math.max(a[t],n))}),s.successors.bind(s)),Object.keys(o).forEach((e=>a[e]=a[n[e]])),a}function lM(e,t){return Object.values(t).reduce(((t,n)=>{let o=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;Object.entries(n).forEach((([t,n])=>{let a=function(e,t){return e.node(t).width}(e,t)/2;o=Math.max(n+a,o),r=Math.min(n-a,r)}));const a=o-r;return a<t[0]&&(t=[a,n]),t}),[Number.POSITIVE_INFINITY,null])[1]}function cM(e,t){let n=Object.values(t),o=eM.applyWithChunking(Math.min,n),r=eM.applyWithChunking(Math.max,n);["u","d"].forEach((n=>{["l","r"].forEach((a=>{let s=n+a,i=e[s];if(i===t)return;let l=Object.values(i),c=o-eM.applyWithChunking(Math.min,l);"l"!==a&&(c=r-eM.applyWithChunking(Math.max,l)),c&&(e[s]=eM.mapValues(i,(e=>e+c)))}))}))}function dM(e,t){return eM.mapValues(e.ul,((n,o)=>{if(t)return e[t.toLowerCase()][o];{let t=Object.values(e).map((e=>e[o])).sort(((e,t)=>e-t));return(t[1]+t[2])/2}}))}let uM=TI,hM=tM;let mM=GI,fM=HI,pM=yA,gM=TI.normalizeRanks,vM=function(e){let t=function(e){let t={},n=0;function o(r){let a=n;e.children(r).forEach(o),t[r]={low:a,lim:n++}}return e.children().forEach(o),t}(e);e.graph().dummyChains.forEach((n=>{let o=e.node(n),r=o.edgeObj,a=function(e,t,n,o){let r,a,s=[],i=[],l=Math.min(t[n].low,t[o].low),c=Math.max(t[n].lim,t[o].lim);r=n;do{r=e.parent(r),s.push(r)}while(r&&(t[r].low>l||c>t[r].lim));a=r,r=o;for(;(r=e.parent(r))!==a;)i.push(r);return{path:s.concat(i.reverse()),lca:a}}(e,t,r.v,r.w),s=a.path,i=a.lca,l=0,c=s[l],d=!0;for(;n!==r.w;){if(o=e.node(n),d){for(;(c=s[l])!==i&&e.node(c).maxRank<o.rank;)l++;c===i&&(d=!1)}if(!d){for(;l<s.length-1&&e.node(c=s[l+1]).minRank<=o.rank;)l++;c=s[l]}e.setParent(n,c),n=e.successors(n)[0]}}))},xM=TI.removeEmptyRanks,yM={run:function(e){let t=kA.addDummyNode(e,"root",{},"_root"),n=function(e){var t={};function n(o,r){var a=e.children(o);a&&a.length&&a.forEach((e=>n(e,r+1))),t[o]=r}return e.children().forEach((e=>n(e,1))),t}(e),o=Object.values(n),r=kA.applyWithChunking(Math.max,o)-1,a=2*r+1;e.graph().nestingRoot=t,e.edges().forEach((t=>e.edge(t).minlen*=a));let s=function(e){return e.edges().reduce(((t,n)=>t+e.edge(n).weight),0)}(e)+1;e.children().forEach((o=>NA(e,t,a,s,r,n,o))),e.graph().nodeRankFactor=a},cleanup:function(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach((t=>{e.edge(t).nestingEdge&&e.removeEdge(t)}))}},bM=function(e){e.children().forEach((function t(n){let o=e.children(n),r=e.node(n);if(o.length&&o.forEach(t),Object.hasOwn(r,"minRank")){r.borderLeft=[],r.borderRight=[];for(let t=r.minRank,o=r.maxRank+1;t<o;++t)EA(e,"borderLeft","_bl",n,r,t),EA(e,"borderRight","_br",n,r,t)}}))},wM={adjust:function(e){let t=e.graph().rankdir.toLowerCase();"lr"!==t&&"rl"!==t||SA(e)},undo:function(e){let t=e.graph().rankdir.toLowerCase();"bt"!==t&&"rl"!==t||function(e){e.nodes().forEach((t=>_A(e.node(t)))),e.edges().forEach((t=>{let n=e.edge(t);n.points.forEach(_A),Object.hasOwn(n,"y")&&_A(n)}))}(e);"lr"!==t&&"rl"!==t||(!function(e){e.nodes().forEach((t=>IA(e.node(t)))),e.edges().forEach((t=>{let n=e.edge(t);n.points.forEach(IA),Object.hasOwn(n,"x")&&IA(n)}))}(e),SA(e))}},kM=XA,NM=function(e){(function(e){let t=uM.buildLayerMatrix(e),n=e.graph().ranksep,o=0;t.forEach((t=>{const r=t.reduce(((t,n)=>{const o=e.node(n).height;return t>o?t:o}),0);t.forEach((t=>e.node(t).y=o+r/2)),o+=r+n}))})(e=uM.asNonCompoundGraph(e)),Object.entries(hM(e)).forEach((([t,n])=>e.node(t).x=n))},CM=TI,EM=kI.Graph;var SM=function(e,t){let n=t&&t.debugTiming?CM.time:CM.notime;n("layout",(()=>{let o=n(" buildLayoutGraph",(()=>function(e){let t=new EM({multigraph:!0,compound:!0}),n=RM(e.graph());return t.setGraph(Object.assign({},_M,PM(n,jM),CM.pick(n,IM))),e.nodes().forEach((n=>{const o=PM(RM(e.node(n)),AM);Object.keys(MM).forEach((e=>{void 0===o[e]&&(o[e]=MM[e])})),t.setNode(n,o),t.setParent(n,e.parent(n))})),e.edges().forEach((n=>{let o=RM(e.edge(n));t.setEdge(n,Object.assign({},OM,PM(o,TM),CM.pick(o,DM)))})),t}(e)));n(" runLayout",(()=>function(e,t,n){t(" makeSpaceForEdgeLabels",(()=>function(e){let t=e.graph();t.ranksep/=2,e.edges().forEach((n=>{let o=e.edge(n);o.minlen*=2,"c"!==o.labelpos.toLowerCase()&&("TB"===t.rankdir||"BT"===t.rankdir?o.width+=o.labeloffset:o.height+=o.labeloffset)}))}(e))),t(" removeSelfEdges",(()=>function(e){e.edges().forEach((t=>{if(t.v===t.w){var n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}}))}(e))),t(" acyclic",(()=>mM.run(e))),t(" nestingGraph.run",(()=>yM.run(e))),t(" rank",(()=>pM(CM.asNonCompoundGraph(e)))),t(" injectEdgeLabelProxies",(()=>function(e){e.edges().forEach((t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v),o={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};CM.addDummyNode(e,"edge-proxy",o,"_ep")}}))}(e))),t(" removeEmptyRanks",(()=>xM(e))),t(" nestingGraph.cleanup",(()=>yM.cleanup(e))),t(" normalizeRanks",(()=>gM(e))),t(" assignRankMinMax",(()=>function(e){let t=0;e.nodes().forEach((n=>{let o=e.node(n);o.borderTop&&(o.minRank=e.node(o.borderTop).rank,o.maxRank=e.node(o.borderBottom).rank,t=Math.max(t,o.maxRank))})),e.graph().maxRank=t}(e))),t(" removeEdgeLabelProxies",(()=>function(e){e.nodes().forEach((t=>{let n=e.node(t);"edge-proxy"===n.dummy&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))}))}(e))),t(" normalize.run",(()=>fM.run(e))),t(" parentDummyChains",(()=>vM(e))),t(" addBorderSegments",(()=>bM(e))),t(" order",(()=>kM(e,n))),t(" insertSelfEdges",(()=>function(e){var t=CM.buildLayerMatrix(e);t.forEach((t=>{var n=0;t.forEach(((t,o)=>{var r=e.node(t);r.order=o+n,(r.selfEdges||[]).forEach((t=>{CM.addDummyNode(e,"selfedge",{width:t.label.width,height:t.label.height,rank:r.rank,order:o+ ++n,e:t.e,label:t.label},"_se")})),delete r.selfEdges}))}))}(e))),t(" adjustCoordinateSystem",(()=>wM.adjust(e))),t(" position",(()=>NM(e))),t(" positionSelfEdges",(()=>function(e){e.nodes().forEach((t=>{var n=e.node(t);if("selfedge"===n.dummy){var o=e.node(n.e.v),r=o.x+o.width/2,a=o.y,s=n.x-r,i=o.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:r+2*s/3,y:a-i},{x:r+5*s/6,y:a-i},{x:r+s,y:a},{x:r+5*s/6,y:a+i},{x:r+2*s/3,y:a+i}],n.label.x=n.x,n.label.y=n.y}}))}(e))),t(" removeBorderNodes",(()=>function(e){e.nodes().forEach((t=>{if(e.children(t).length){let n=e.node(t),o=e.node(n.borderTop),r=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),s=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(s.x-a.x),n.height=Math.abs(r.y-o.y),n.x=a.x+n.width/2,n.y=o.y+n.height/2}})),e.nodes().forEach((t=>{"border"===e.node(t).dummy&&e.removeNode(t)}))}(e))),t(" normalize.undo",(()=>fM.undo(e))),t(" fixupEdgeLabelCoords",(()=>function(e){e.edges().forEach((t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}}))}(e))),t(" undoCoordinateSystem",(()=>wM.undo(e))),t(" translateGraph",(()=>function(e){let t=Number.POSITIVE_INFINITY,n=0,o=Number.POSITIVE_INFINITY,r=0,a=e.graph(),s=a.marginx||0,i=a.marginy||0;function l(e){let a=e.x,s=e.y,i=e.width,l=e.height;t=Math.min(t,a-i/2),n=Math.max(n,a+i/2),o=Math.min(o,s-l/2),r=Math.max(r,s+l/2)}e.nodes().forEach((t=>l(e.node(t)))),e.edges().forEach((t=>{let n=e.edge(t);Object.hasOwn(n,"x")&&l(n)})),t-=s,o-=i,e.nodes().forEach((n=>{let r=e.node(n);r.x-=t,r.y-=o})),e.edges().forEach((n=>{let r=e.edge(n);r.points.forEach((e=>{e.x-=t,e.y-=o})),Object.hasOwn(r,"x")&&(r.x-=t),Object.hasOwn(r,"y")&&(r.y-=o)})),a.width=n-t+s,a.height=r-o+i}(e))),t(" assignNodeIntersects",(()=>function(e){e.edges().forEach((t=>{let n,o,r=e.edge(t),a=e.node(t.v),s=e.node(t.w);r.points?(n=r.points[0],o=r.points[r.points.length-1]):(r.points=[],n=s,o=a),r.points.unshift(CM.intersectRect(a,n)),r.points.push(CM.intersectRect(s,o))}))}(e))),t(" reversePoints",(()=>function(e){e.edges().forEach((t=>{let n=e.edge(t);n.reversed&&n.points.reverse()}))}(e))),t(" acyclic.undo",(()=>mM.undo(e)))}(o,n,t))),n(" updateInputGraph",(()=>function(e,t){e.nodes().forEach((n=>{let o=e.node(n),r=t.node(n);o&&(o.x=r.x,o.y=r.y,o.rank=r.rank,t.children(n).length&&(o.width=r.width,o.height=r.height))})),e.edges().forEach((n=>{let o=e.edge(n),r=t.edge(n);o.points=r.points,Object.hasOwn(r,"x")&&(o.x=r.x,o.y=r.y)})),e.graph().width=t.graph().width,e.graph().height=t.graph().height}(e,o)))}))};let jM=["nodesep","edgesep","ranksep","marginx","marginy"],_M={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},IM=["acyclicer","ranker","rankdir","align"],AM=["width","height"],MM={width:0,height:0},TM=["minlen","weight","width","height","labeloffset"],OM={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},DM=["labelpos"];function PM(e,t){return CM.mapValues(CM.pick(e,t),Number)}function RM(e){var t={};return e&&Object.entries(e).forEach((([e,n])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=n})),t}let FM=TI,LM=kI.Graph;var zM={graphlib:kI,layout:SM,debug:{debugOrdering:function(e){let t=FM.buildLayerMatrix(e),n=new LM({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach((t=>{n.setNode(t,{label:t}),n.setParent(t,"layer"+e.node(t).rank)})),e.edges().forEach((e=>n.setEdge(e.v,e.w,{},e.name))),t.forEach(((e,t)=>{let o="layer"+t;n.setNode(o,{rank:"same"}),e.reduce(((e,t)=>(n.setEdge(e,t,{style:"invis"}),t)))})),n}},util:{time:TI.time,notime:TI.notime},version:"1.1.4"};const BM=(new zM.graphlib.Graph).setDefaultEdgeLabel((()=>({}))),UM=(e,t,n)=>(BM.setGraph({rankdir:n.direction,nodesep:150,ranksep:200,ranker:"longest-path"}),t.forEach((e=>BM.setEdge(e.source,e.target))),e.forEach((e=>BM.setNode(e.id,{...e,width:e.width??0,height:e.height??0}))),zM.layout(BM),{nodes:e.map((e=>{const{x:t,y:n}=BM.node(e.id);return{...e,position:{x:t,y:n}}})),edges:t}),VM=new class{createEdge(e,t){return{animated:!0,markerEnd:{type:aE.ArrowClosed},id:`${e}-${t}`,style:{strokeWidth:2},source:e,sourceHandle:"outputs",targetHandle:"inputs",target:t}}createNode(e,t){return{id:e,data:{atom:t,forceWidth:300},width:300,type:"custom",height:C_(te.get(t).code.trim().split("\n").length),position:{x:0,y:0}}}createElements(e,t,n,o){const r=[],a=[],s=new Set,i=new Set;for(const l of Object.values(n)){if("marimo"===l.value&&"mo"===l.name)continue;const{declaredBy:e,usedBy:t}=l;for(const n of e)for(const e of t){const t=`${n}-${e}`;i.has(t)||(i.add(t),s.add(n),s.add(e),a.push(this.createEdge(n,e)))}}for(const[l,c]of Aa.zip(e,t)){o||r.push(this.createNode(l,c));const e=s.has(l),t=te.get(c).code.trim().startsWith("mo.md");!e&&t||r.push(this.createNode(l,c))}return{nodes:r,edges:a}}},GM=({cellIds:e,variables:t,cellAtoms:n,children:o,layoutDirection:a,settings:s})=>{const i=r.useMemo((()=>{let o=VM.createElements(e,n,t,s.hidePureMarkdown);return o=UM(o.nodes,o.edges,{direction:a}),o}),[]),[l,c,d]=r_(i.nodes),[u,h,m]=a_(i.edges),f=AS(),p=W((e=>{const t=UM(e.nodes,e.edges,{direction:a});c(t.nodes),h(t.edges)}));r.useEffect((()=>{p(VM.createElements(e,n,t,s.hidePureMarkdown))}),[e,t,n,p,s.hidePureMarkdown]);const[g,v]=r.useState();D_();return k.jsx(E_.Provider,{value:a,children:k.jsxs(n_,{nodes:l,edges:u,nodeTypes:j_,minZoom:.2,fitViewOptions:{minZoom:.5,maxZoom:1.5},onNodeClick:(e,t)=>{v({type:"node",id:t.id})},onEdgeClick:(e,t)=>{const{source:n,target:o}=t;v({type:"edge",source:n,target:o})},onNodeDoubleClick:(e,t)=>{ys(t.id,"focus")},fitView:!0,onNodesChange:d,onEdgesChange:m,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[k.jsx(N_,{color:"#ccc",variant:f_.Dots}),k.jsx(g_,{position:"bottom-right",showInteractive:!1,children:k.jsx(C,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:k.jsx(u_,{onMouseDown:tt.preventFocus,onClick:()=>{const e=te.get(jd);if(e){const t=l.find((t=>t.id===e));t&&(f.fitView({padding:1,duration:600,nodes:[t]}),v({type:"node",id:e}))}},children:k.jsx(mc,{className:"size-4"})})})}),k.jsx(T_,{selection:g,variables:t,edges:u,onClearSelection:()=>{v(void 0)}}),o]})})},$M=Z("_minimap_"),HM=Z({hidePureMarkdown:!0}),WM=e=>{const t=b(11),[n,o]=Fe($M),[r,a]=Fe(HM);let s;t[0]!==n||t[1]!==e||t[2]!==r||t[3]!==a||t[4]!==o?(s=()=>"_minimap_"===n?k.jsx(L_,{...e,children:k.jsx(M_,{settings:r,onSettingsChange:a,view:n,onChange:o})}):k.jsx(GM,{...e,settings:r,layoutDirection:n,children:k.jsx(M_,{settings:r,onSettingsChange:a,view:n,onChange:o})}),t[0]=n,t[1]=e,t[2]=r,t[3]=a,t[4]=o,t[5]=s):s=t[5];const i=s;let l,c;return t[6]!==i?(l=i(),t[6]=i,t[7]=l):l=t[7],t[8]!==n||t[9]!==l?(c=k.jsx(Yj,{children:l},n),t[8]=n,t[9]=l,t[10]=c):c=t[10],c},qM=()=>{const e=b(5),t=bs(),n=he(),[o]=ws();let r,a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=on("w-full h-full flex-1 mx-auto -mb-4 relative"),e[0]=r):r=e[0],e[1]!==o||e[2]!==t||e[3]!==n.inOrderIds?(a=k.jsx("div",{className:r,children:k.jsx(WM,{cellAtoms:o,variables:t,cellIds:n.inOrderIds})}),e[1]=o,e[2]=t,e[3]=n.inOrderIds,e[4]=a):a=e[4],a};const YM="name",XM="type-value",KM="defs-refs",JM=[{id:YM,accessorFn:e=>[e.name,e.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:e})=>k.jsx(Rs,{header:"Name",column:e}),cell:({getValue:e})=>{const[t,n]=e();return k.jsx(A_,{name:t,declaredBy:n})}},{id:XM,accessorFn:e=>[e.dataType,e.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:e})=>k.jsx(Rs,{header:k.jsxs("div",{className:"flex flex-col gap-1",children:[k.jsx("span",{children:"Type"}),k.jsx("span",{children:"Value"})]}),column:e}),cell:({getValue:e})=>{const[t,n]=e();return k.jsxs("div",{className:"max-w-[150px]",children:[k.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:t}),k.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:KM,accessorFn:e=>[e.declaredBy,e.usedBy,e.name,e.declaredByNames,e.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:e})=>k.jsx(Rs,{header:k.jsxs("div",{className:"flex flex-col gap-1",children:[k.jsx("span",{children:"Declared By"}),k.jsx("span",{children:"Used By"})]}),column:e}),cell:({getValue:e})=>{const[t,n,o]=e(),r=e=>{const t=qr(e);t&&vs(t,o)};return k.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[k.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[k.jsx("span",{title:"Declared by",children:k.jsx(Rc,{className:"w-3.5 h-3.5 text-muted-foreground"})}),1===t.length?k.jsx(ps,{variant:"focus",cellId:t[0],skipScroll:!0,onClick:()=>r(t[0])}):k.jsx("div",{className:"text-destructive flex flex-row gap-2",children:t.slice(0,3).map(((e,n)=>k.jsxs("span",{className:"flex",children:[k.jsx(ps,{variant:"focus",cellId:e,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(e)},e),n<t.length-1&&", "]},e)))})]}),k.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[k.jsx("span",{title:"Used by",children:k.jsx(qc,{className:"w-3.5 h-3.5 text-muted-foreground"})}),k.jsx(I_,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}];const ZM=r.memo((({className:e,cellIds:t,variables:n})=>{const[o,a]=u.useState([]),[s,i]=u.useState(""),l=ks(),c=r.useMemo((()=>{const e=e=>{const n=l[e];return n===Ps?`cell-${t.indexOf(e)}`:n??`cell-${t.indexOf(e)}`};return Object.values(n).map((t=>({...t,declaredByNames:t.declaredBy.map(e),usedByNames:t.usedBy.map(e)})))}),[n,l,t]),d=r.useMemo((()=>{const e=new Map;return t.forEach(((t,n)=>e.set(t,n))),function(e,t,n){t||(t={id:KM,desc:!1});let o=[];switch(t.id){case YM:o=Ol(e,(e=>e.name));break;case XM:o=Ol(e,(e=>e.dataType));break;case KM:o=Ol(e,(e=>n.get(e.declaredBy[0])))}return t.desc?o.reverse():o}(c,o[0],e)}),[c,o,t]),h=Ns({data:d,columns:JM,getCoreRowModel:Cs(),onGlobalFilterChange:i,getFilteredRowModel:Es(),enableFilters:!0,enableGlobalFilter:!0,getColumnCanGlobalFilter:e=>e.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:a,getSortedRowModel:Ss(),state:{sorting:o,globalFilter:s}});return k.jsxs(k.Fragment,{children:[k.jsx(js,{className:"w-full",placeholder:"Search",value:s,onChange:e=>i(e.target.value)}),k.jsxs(_s,{className:on("w-full text-sm flex-1 border-separate border-spacing-0",e),children:[k.jsx(Is,{children:k.jsx(As,{className:"whitespace-nowrap text-xs",children:h.getFlatHeaders().map((e=>k.jsx(Ms,{className:"sticky top-0 bg-background border-b",children:Ts(e.column.columnDef.header,e.getContext())},e.id)))})}),k.jsx(Os,{children:h.getRowModel().rows.map((e=>k.jsx(As,{className:"hover:bg-accent",children:e.getVisibleCells().map((e=>k.jsx(Ds,{className:"border-b",children:Ts(e.column.columnDef.cell,e.getContext())},e.id)))},e.id)))})]})]})}));ZM.displayName="VariableTable";const QM=()=>{const e=b(4),t=bs(),n=he();if(0===Object.keys(t).length){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=k.jsx(DN,{title:"No variables",description:"Global variables will appear here.",icon:k.jsx(ct,{})}),e[0]=t):t=e[0],t}let o;return e[1]!==n.inOrderIds||e[2]!==t?(o=k.jsx(ZM,{className:"flex-1",cellIds:n.inOrderIds,variables:t}),e[1]=n.inOrderIds,e[2]=t,e[3]=o):o=e[3],o},eT=()=>{const e=b(9),t=Fs(),{clearLogs:n}=q();if(0===t.length){let t,n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=k.jsx("code",{className:"border rounded px-1",children:"stdout"}),e[0]=t):t=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(n=k.jsx(DN,{title:"No logs",description:k.jsxs("span",{children:[t," and"," ",k.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:k.jsx(dt,{})}),e[1]=n):n=e[1],n}let o,r,a;return e[2]!==n?(o=k.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:k.jsx("button",{"data-testid":"clear-logs-button",className:"text-xs font-semibold text-accent-foreground",onClick:n,children:"Clear"})}),e[2]=n,e[3]=o):o=e[3],e[4]!==t?(r=k.jsx("div",{className:"overflow-auto flex-1",children:k.jsx(tT,{logs:t,className:"min-w-[300px]"})}),e[4]=t,e[5]=r):r=e[5],e[6]!==o||e[7]!==r?(a=k.jsxs(k.Fragment,{children:[o,r]}),e[6]=o,e[7]=r,e[8]=a):a=e[8],a},tT=e=>{const t=b(11),{logs:n,className:o}=e;let r,a,s,i,l;if(t[0]!==o?(r=on("flex flex-col",o),t[0]=o,t[1]=r):r=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(a={whiteSpace:"pre-wrap"},t[2]=a):a=t[2],t[3]!==n){let e;t[5]===Symbol.for("react.memo_cache_sentinel")?(e=(e,t)=>k.jsxs("div",{className:"contents group",children:[k.jsx("span",{className:on("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:t+1}),k.jsx("span",{className:on("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:nT(e)})]},t),t[5]=e):e=t[5],s=n.map(e),t[3]=n,t[4]=s}else s=t[4];return t[6]!==s?(i=k.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:k.jsx("div",{className:"grid grid-cols-[30px,1fr]",style:a,children:s})}),t[6]=s,t[7]=i):i=t[7],t[8]!==r||t[9]!==i?(l=k.jsx("div",{className:r,children:i}),t[8]=r,t[9]=i,t[10]=l):l=t[10],l};function nT(e){const t=Ls(e.timestamp),n=oT[e.level],o=e.level.toUpperCase();return k.jsxs(k.Fragment,{children:[k.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["[",t,"]"]}),k.jsx("span",{className:on("flex-shrink-0",n),children:o}),k.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",k.jsx(ps,{cellId:e.cellId}),")"]}),e.message]})}const oT={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"},rT=()=>{const e=b(5),{documentation:t}=le(zs);if(!t){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=k.jsx(DN,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:k.jsx(Gc,{})}),e[0]=t):t=e[0],t}let n,o;return e[1]!==t?(n=xa({html:t}),e[1]=t,e[2]=n):n=e[2],e[3]!==n?(o=k.jsx("div",{className:"p-3 overflow-y-auto overflow-x-hidden h-full docs-documentation flex flex-col gap-4",children:n}),e[3]=n,e[4]=o):o=e[4],o};function aT(e,t,n){return e[t]?e[t][0]?e[t][0][n]:e[t][n]:"contentBoxSize"===t?e.contentRect["inlineSize"===n?"width":"height"]:void 0}function sT(e){void 0===e&&(e={});var t=e.onResize,n=r.useRef(void 0);n.current=t;var o=e.round||Math.round,a=r.useRef(),s=r.useState({width:void 0,height:void 0}),i=s[0],l=s[1],c=r.useRef(!1);r.useEffect((function(){return c.current=!1,function(){c.current=!0}}),[]);var d=r.useRef({width:void 0,height:void 0}),u=function(e,t){var n=r.useRef(null),o=r.useRef(null);o.current=t;var a=r.useRef(null);r.useEffect((function(){s()}));var s=r.useCallback((function(){var t=a.current,r=o.current,s=t||(r?r instanceof Element?r:r.current:null);n.current&&n.current.element===s&&n.current.subscriber===e||(n.current&&n.current.cleanup&&n.current.cleanup(),n.current={element:s,subscriber:e,cleanup:s?e(s):void 0})}),[e]);return r.useEffect((function(){return function(){n.current&&n.current.cleanup&&(n.current.cleanup(),n.current=null)}}),[]),r.useCallback((function(e){a.current=e,s()}),[s])}(r.useCallback((function(t){return a.current&&a.current.box===e.box&&a.current.round===o||(a.current={box:e.box,round:o,instance:new ResizeObserver((function(t){var r=t[0],a="border-box"===e.box?"borderBoxSize":"device-pixel-content-box"===e.box?"devicePixelContentBoxSize":"contentBoxSize",s=aT(r,a,"inlineSize"),i=aT(r,a,"blockSize"),u=s?o(s):void 0,h=i?o(i):void 0;if(d.current.width!==u||d.current.height!==h){var m={width:u,height:h};d.current.width=u,d.current.height=h,n.current?n.current(m):c.current||l(m)}}))}),a.current.instance.observe(t,{box:e.box}),function(){a.current&&a.current.instance.unobserve(t)}}),[e.box,o]),e.ref);return r.useMemo((function(){return{ref:u,width:i.width,height:i.height}}),[u,i.width,i.height])}const iT=new Map,lT=({file:e,onOpenNotebook:t})=>{const{theme:n}=Te(),o=le(Le),[a,s]=r.useState(""),{data:i,loading:l,error:c,setData:d}=an((async()=>{const t=await Bs({path:e.path}),n=t.contents||"";return s(iT.get(e.path)||n),t}),[e.path]),u=async()=>{a!==(null==i?void 0:i.contents)&&await Ys({path:e.path,contents:a}).then((e=>{e.success&&(d((e=>e?{...e,contents:a}:void 0)),s(a))}))},h=r.useRef(a);if(h.current=a,r.useEffect((()=>()=>{if(!i)return;const t=h.current;t===i.contents?iT.delete(e.path):iT.set(e.path,t)}),[e.path,null==i?void 0:i.contents]),c)return k.jsx(Us,{error:c});if(l||!i)return null;const m=i.mimeType||"text/plain",f=m in dT;if(!i.contents&&!f)return k.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[k.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),k.jsx("div",{children:i.file.name}),k.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),k.jsx("div",{children:m})]});const p=k.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[e.isMarimoFile&&!D()&&k.jsx(C,{content:"Open notebook",children:k.jsx(bi,{size:"small",onClick:e=>t(e),children:k.jsx(Vs,{})})}),k.jsx(C,{content:"Download",children:k.jsx(bi,{size:"small",onClick:()=>{if(cT(m)){const e=Xs(i.contents,m);Ks(e,i.file.name)}else S(new Blob([i.contents||a],{type:m}),i.file.name)},children:k.jsx(Nt,{})})}),!cT(m)&&k.jsxs(k.Fragment,{children:[k.jsx(C,{content:"Copy contents to clipboard",children:k.jsx(bi,{size:"small",onClick:async()=>{await et(a)},children:k.jsx(nt,{})})}),k.jsx(C,{content:N("global.save"),children:k.jsx(bi,{size:"small",color:a===i.contents?void 0:"green",onClick:u,disabled:a===i.contents,children:k.jsx(Ic,{})})})]})]});return m.startsWith("image/")?k.jsxs(k.Fragment,{children:[p,k.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:k.jsx(Gs,{base64:i.contents,mime:m})})]}):"text/csv"===m&&i.contents?k.jsxs(k.Fragment,{children:[p,k.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:k.jsx($s,{contents:i.contents})})]}):m.startsWith("audio/")?k.jsxs(k.Fragment,{children:[p,k.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:k.jsx(Hs,{base64:i.contents,mime:m})})]}):m.startsWith("video/")?k.jsxs(k.Fragment,{children:[p,k.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:k.jsx(Ws,{base64:i.contents,mime:m})})]}):k.jsxs(k.Fragment,{children:[p,k.jsx("div",{className:"flex-1 overflow-auto",children:k.jsx(qs,{theme:"dark"===n?"dark":"light",language:dT[m]||dT.default,className:"border-b",extensions:[qt.lineWrapping,fn.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>a!==i.contents&&(u(),!0)}])],value:a,onChange:s})})]})},cT=e=>!!e&&(e.startsWith("image/")||e.startsWith("audio/")||e.startsWith("video/")),dT={"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"};const uT=Z(new class{constructor(e){this.callbacks=e,this.delegate=new qi([]),this.rootPath="",this.onChange=rn.NOOP,this.path=new ft("/"),this.initialize=async e=>{if(this.onChange=e,0===this.delegate.data.length)try{const e=await this.callbacks.listFiles({path:this.rootPath});this.delegate=new qi(e.files),this.rootPath=e.root,this.path=ft.guessDeliminator(e.root)}catch(t){re({title:"Failed",description:Ur(t)})}this.onChange(this.delegate.data)},this.refreshAll=async e=>{const t=[this.rootPath,...e.map((e=>{var t;return null==(t=this.delegate.find(e))?void 0:t.data.path}))].filter(Boolean),n=await Promise.all(t.map((e=>this.callbacks.listFiles({path:e}).catch((()=>({files:[]}))))));for(const[o,r]of t.entries()){const e=n[o];r===this.rootPath?this.delegate=new qi(e.files):this.delegate.update({id:r,changes:{children:e.files}})}this.onChange(this.delegate.data)},this.relativeFromRoot=e=>{const t=function(e){return e.endsWith("/")?e:`${e}/`}(this.rootPath);return e.startsWith(t)?e.slice(t.length):e},this.handleResponse=e=>e.success?e:(re({title:"Failed",description:e.message}),null)}async expand(e){const t=this.delegate.find(e);if(!t)return!1;if(!t.data.isDirectory)return!1;if(t.children&&t.children.length>0)return!0;const n=await this.callbacks.listFiles({path:t.data.path});return this.delegate.update({id:e,changes:{children:n.files}}),this.onChange(this.delegate.data),!0}async rename(e,t){const n=this.delegate.find(e);if(!n)return;const o=n.data.path,r=this.path.join(this.path.dirname(o),t);await this.callbacks.renameFileOrFolder({path:o,newPath:r}).then(this.handleResponse),this.delegate.update({id:e,changes:{name:t,path:r}}),this.onChange(this.delegate.data),await this.refreshAll([r])}async move(e,t){var n;const o=t?(null==(n=this.delegate.find(t))?void 0:n.data.path)??t:this.rootPath;await Promise.all(e.map((e=>{this.delegate.move({id:e,parentId:t,index:0});const n=this.delegate.find(e);if(!n)return Promise.resolve();const r=this.path.join(o,this.path.basename(n.data.path));return this.delegate.update({id:e,changes:{path:r}}),this.callbacks.renameFileOrFolder({path:n.data.path,newPath:r}).then(this.handleResponse)}))),this.onChange(this.delegate.data),await this.refreshAll([o])}async createFile(e,t){var n;const o=t?(null==(n=this.delegate.find(t))?void 0:n.data.path)??t:this.rootPath,r=await this.callbacks.createFileOrFolder({path:o,type:"file",name:e}).then(this.handleResponse);(null==r?void 0:r.info)&&(this.delegate.create({parentId:t,index:0,data:r.info}),this.onChange(this.delegate.data),await this.refreshAll([o]))}async createFolder(e,t){var n;const o=t?(null==(n=this.delegate.find(t))?void 0:n.data.path)??t:this.rootPath,r=await this.callbacks.createFileOrFolder({path:o,type:"directory",name:e}).then(this.handleResponse);(null==r?void 0:r.info)&&(this.delegate.create({parentId:t,index:0,data:r.info}),this.onChange(this.delegate.data),await this.refreshAll([o]))}async delete(e){const t=this.delegate.find(e);t&&(await this.callbacks.deleteFileOrFolder({path:t.data.path}).then(this.handleResponse),this.delegate.drop({id:e}),this.onChange(this.delegate.data))}}({listFiles:ln,createFileOrFolder:Js,deleteFileOrFolder:Zs,renameFileOrFolder:Qs})),hT=Z({});function mT(e){const t=b(4);let n;t[0]!==e?(n=void 0===e?{}:e,t[0]=e,t[1]=n):n=t[1];const o=n;let r;return t[2]!==o?(r={multiple:!0,maxSize:104857600,onError:xT,onDropRejected:pT,onDrop:fT,...o},t[2]=o,t[3]=r):r=t[3],ei(r)}async function fT(e){for(const t of e){const e=(await ti(t)).split(",")[1];await Js({path:"",type:"file",name:t.name,contents:e})}await async function(){await te.get(uT).refreshAll([])}()}function pT(e){re({title:"File upload failed",description:k.jsx("div",{className:"flex flex-col gap-1",children:e.map(gT)}),variant:"danger"})}function gT(e){return k.jsxs("div",{children:[e.file.name," (",e.errors.map(vT).join(", "),")"]},e.file.name)}function vT(e){return e.message}function xT(e){J.error(e),re({title:"File upload failed",description:e.message,variant:"danger"})}const yT=u.createContext(null),bT=e=>{const t=b(60),{height:n}=e,o=r.useRef(null),[a]=Fe(uT);let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],t[0]=s):s=t[0];const[i,l]=r.useState(s),[c,d]=r.useState(null),{openPrompt:u}=w(),[h,m]=Fe(hT);let f,p;t[1]!==a?(f=()=>a.initialize(l),t[1]=a,t[2]=f):f=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(p=[],t[3]=p):p=t[3];const{loading:g,error:v}=an(f,p);let x;t[4]!==a||t[5]!==h?(x=()=>{a.refreshAll(Object.keys(h).filter((e=>h[e])))},t[4]=a,t[5]=h,t[6]=x):x=t[6];const y=W(x);let N;t[7]!==u||t[8]!==a?(N=async()=>{u({title:"Folder name",onConfirm:async e=>{a.createFolder(e,null)}})},t[7]=u,t[8]=a,t[9]=N):N=t[9];const C=W(N);let S;t[10]!==u||t[11]!==a?(S=async()=>{u({title:"File name",onConfirm:async e=>{a.createFile(e,null)}})},t[10]=u,t[11]=a,t[12]=S):S=t[12];const j=W(S);let _;t[13]!==m?(_=()=>{var e;null==(e=o.current)||e.closeAll(),m({})},t[13]=m,t[14]=_):_=t[14];const I=W(_);if(g){let e;return t[15]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx(ns,{size:"medium",centered:!0}),t[15]=e):e=t[15],e}if(v){let e;return t[16]!==v?(e=k.jsx(Us,{error:v}),t[16]=v,t[17]=e):e=t[17],e}if(c){let e,n,o,s,i,l;return t[18]===Symbol.for("react.memo_cache_sentinel")?(e=()=>d(null),t[18]=e):e=t[18],t[19]===Symbol.for("react.memo_cache_sentinel")?(n=k.jsx(E,{onClick:e,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:k.jsx(Dl,{size:16})}),t[19]=n):n=t[19],t[20]!==c.name?(o=k.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[n,k.jsx("span",{className:"font-bold",children:c.name})]}),t[20]=c.name,t[21]=o):o=t[21],t[22]!==a||t[23]!==c.path?(s=e=>jT(e,a.relativeFromRoot(c.path)),t[22]=a,t[23]=c.path,t[24]=s):s=t[24],t[25]!==s||t[26]!==c?(i=k.jsx(r.Suspense,{children:k.jsx(lT,{onOpenNotebook:s,file:c})}),t[25]=s,t[26]=c,t[27]=i):i=t[27],t[28]!==o||t[29]!==i?(l=k.jsxs(k.Fragment,{children:[o,i]}),t[28]=o,t[29]=i,t[30]=l):l=t[30],l}let A;t[31]!==y||t[32]!==j||t[33]!==C||t[34]!==I||t[35]!==a?(A=k.jsx(kT,{onRefresh:y,onCreateFile:j,onCreateFolder:C,onCollapseAll:I,tree:a}),t[31]=y,t[32]=j,t[33]=C,t[34]=I,t[35]=a,t[36]=A):A=t[36];const M=n-33;let T,O,D,P,R,F,L,z;return t[37]!==a?(T=async e=>{const{ids:t}=e;for(const n of t)await a.delete(n)},O=async e=>{const{id:t,name:n}=e;await a.rename(t,n)},D=async e=>{const{dragIds:t,parentId:n}=e;await a.move(t,n)},t[37]=a,t[38]=T,t[39]=O,t[40]=D):(T=t[38],O=t[39],D=t[40]),t[41]===Symbol.for("react.memo_cache_sentinel")?(P=e=>{const t=e[0];t&&(t.data.isDirectory||d(t.data))},t[41]=P):P=t[41],t[42]!==a||t[43]!==h||t[44]!==m?(R=async e=>{if(await a.expand(e)){const t=h[e]??!1;m({...h,[e]:!t})}},t[42]=a,t[43]=h,t[44]=m,t[45]=R):R=t[45],t[46]!==M||t[47]!==i||t[48]!==h||t[49]!==T||t[50]!==O||t[51]!==D||t[52]!==R?(F=k.jsx(Yi,{width:"100%",ref:o,height:M,className:"h-full",data:i,initialOpenState:h,openByDefault:!1,renderCursor:_T,disableDrop:IT,onDelete:T,onRename:O,onMove:D,onSelect:P,onToggle:R,padding:15,rowHeight:30,indent:wT,overscanCount:1e3,disableMultiSelection:!0,children:ET}),t[46]=M,t[47]=i,t[48]=h,t[49]=T,t[50]=O,t[51]=D,t[52]=R,t[53]=F):F=t[53],t[54]!==a||t[55]!==F?(L=k.jsx(yT.Provider,{value:a,children:F}),t[54]=a,t[55]=F,t[56]=L):L=t[56],t[57]!==A||t[58]!==L?(z=k.jsxs(k.Fragment,{children:[A,L]}),t[57]=A,t[58]=L,t[59]=z):z=t[59],z},wT=15,kT=e=>{const t=b(30),{onRefresh:n,onCreateFile:o,onCreateFolder:r,onCollapseAll:a}=e;let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={noDrag:!0,noDragEventsBubbling:!0},t[0]=s):s=t[0];const{getRootProps:i,getInputProps:l}=mT(s);let c,d,u,h,m,f,p,g,v,x,y,w,N,S,j;return t[1]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx(tc,{size:16}),t[1]=c):c=t[1],t[2]!==o?(d=k.jsx(C,{content:"Add file",children:k.jsx(E,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:c})}),t[2]=o,t[3]=d):d=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(u=k.jsx(oc,{size:16}),t[4]=u):u=t[4],t[5]!==r?(h=k.jsx(C,{content:"Add folder",children:k.jsx(E,{"data-testid":"file-explorer-add-folder-button",onClick:r,variant:"text",size:"xs",children:u})}),t[5]=r,t[6]=h):h=t[6],t[7]!==i?(m=i({}),t[7]=i,t[8]=m):m=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(f=ni({variant:"text",size:"xs"}),p=k.jsx(oi,{size:16}),t[9]=f,t[10]=p):(f=t[9],p=t[10]),t[11]!==m?(g=k.jsx(C,{content:"Upload file",children:k.jsx("button",{"data-testid":"file-explorer-upload-button",...m,className:f,children:p})}),t[11]=m,t[12]=g):g=t[12],t[13]!==l?(v=l({}),t[13]=l,t[14]=v):v=t[14],t[15]!==v?(x=k.jsx("input",{...v,type:"file"}),t[15]=v,t[16]=x):x=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(y=k.jsx(na,{size:16}),t[17]=y):y=t[17],t[18]!==n?(w=k.jsx(C,{content:"Refresh",children:k.jsx(E,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:y})}),t[18]=n,t[19]=w):w=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(N=k.jsx(Jl,{size:16}),t[20]=N):N=t[20],t[21]!==a?(S=k.jsx(C,{content:"Collapse all folders",children:k.jsx(E,{"data-testid":"file-explorer-collapse-button",onClick:a,variant:"text",size:"xs",children:N})}),t[21]=a,t[22]=S):S=t[22],t[23]!==d||t[24]!==h||t[25]!==g||t[26]!==x||t[27]!==w||t[28]!==S?(j=k.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[d,h,g,x,w,S]}),t[23]=d,t[24]=h,t[25]=g,t[26]=x,t[27]=w,t[28]=S,t[29]=j):j=t[29],j},NT=e=>{const t=b(9),{node:n,onOpenMarimoFile:o}=e;let r,a,s;return t[0]!==n?(r=e=>{n.data.isDirectory||(e.stopPropagation(),n.select())},t[0]=n,t[1]=r):r=t[1],t[2]!==n.data.isMarimoFile||t[3]!==o?(a=n.data.isMarimoFile&&!D()&&k.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",k.jsx(Vs,{className:"inline ml-1",size:12})]}),t[2]=n.data.isMarimoFile,t[3]=o,t[4]=a):a=t[4],t[5]!==r||t[6]!==n.data.name||t[7]!==a?(s=k.jsxs("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:r,children:[n.data.name,a]}),t[5]=r,t[6]=n.data.name,t[7]=a,t[8]=s):s=t[8],s},CT=e=>{const t=b(10),{node:n}=e,o=r.useRef(null);let a,s,i,l,c;return t[0]!==n.data.name?(a=()=>{var e,t;null==(e=o.current)||e.focus(),null==(t=o.current)||t.setSelectionRange(0,n.data.name.lastIndexOf("."))},s=[n.data.name],t[0]=n.data.name,t[1]=a,t[2]=s):(a=t[1],s=t[2]),r.useEffect(a,s),t[3]!==n?(i=()=>n.reset(),l=e=>{"Escape"===e.key&&n.reset(),"Enter"===e.key&&n.submit(e.currentTarget.value)},t[3]=n,t[4]=i,t[5]=l):(i=t[4],l=t[5]),t[6]!==n.data.name||t[7]!==i||t[8]!==l?(c=k.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:AT,onBlur:i,onKeyDown:l}),t[6]=n.data.name,t[7]=i,t[8]=l,t[9]=c):c=t[9],c},ET=e=>{const t=b(52),{node:n,style:o,dragHandle:a}=e;let s;t[0]!==n.data?(s=n.data.isDirectory?"directory":sn(n.data.name),t[0]=n.data,t[1]=s):s=t[1];const i=s,l=cn[i],{openConfirm:c,openPrompt:d}=w(),u=r.useContext(yT);let h;t[2]!==u||t[3]!==n.data.path?(h=async e=>{jT(e,u?u.relativeFromRoot(n.data.path):n.data.path)},t[2]=u,t[3]=n.data.path,t[4]=h):h=t[4];const m=h;let f;t[5]!==c||t[6]!==n.data.name||t[7]!==n.tree||t[8]!==n.id?(f=async e=>{e.stopPropagation(),e.preventDefault(),c({title:"Delete file",description:`Are you sure you want to delete ${n.data.name}?`,confirmAction:k.jsx(ot,{onClick:async()=>{await n.tree.delete(n.id)},"aria-label":"Confirm",children:"Delete"})})},t[5]=c,t[6]=n.data.name,t[7]=n.tree,t[8]=n.id,t[9]=f):f=t[9];const p=f;let g;t[10]!==n||t[11]!==d||t[12]!==u?(g=async()=>{n.open(),d({title:"Folder name",onConfirm:async e=>{null==u||u.createFolder(e,n.id)}})},t[10]=n,t[11]=d,t[12]=u,t[13]=g):g=t[13];const v=W(g);let x;t[14]!==n||t[15]!==d||t[16]!==u?(x=async()=>{n.open(),d({title:"File name",onConfirm:async e=>{null==u||u.createFile(e,n.id)}})},t[14]=n,t[15]=d,t[16]=u,t[17]=x):x=t[17];const y=W(x);let N;t[18]!==n||t[19]!==y||t[20]!==v||t[21]!==u||t[22]!==i||t[23]!==m||t[24]!==p?(N=()=>{const e={size:14,strokeWidth:1.5,className:"mr-2"};return k.jsxs(Bt,{align:"end",className:"no-print w-[220px]",onClick:e=>e.stopPropagation(),onCloseAutoFocus:e=>e.preventDefault(),children:[!n.data.isDirectory&&k.jsxs(Tt,{onSelect:()=>n.select(),children:[k.jsx(Hc,{...e}),"Open file"]}),n.data.isDirectory&&k.jsxs(k.Fragment,{children:[k.jsxs(Tt,{onSelect:()=>y(),children:[k.jsx(tc,{...e}),"Create file"]}),k.jsxs(Tt,{onSelect:()=>v(),children:[k.jsx(oc,{...e}),"Create folder"]}),k.jsx(Lt,{})]}),k.jsxs(Tt,{onSelect:()=>n.edit(),children:[k.jsx(Nc,{...e}),"Rename"]}),k.jsxs(Tt,{onSelect:async()=>{await et(n.data.path),re({title:"Copied to clipboard"})},children:[k.jsx(nt,{...e}),"Copy path"]}),u&&k.jsxs(Tt,{onSelect:async()=>{await et(u.relativeFromRoot(n.data.path)),re({title:"Copied to clipboard"})},children:[k.jsx(nt,{...e}),"Copy relative path"]}),k.jsxs(Tt,{onSelect:async()=>{re({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:e}=n.data,t=ri[i](e);await et(t)},children:[k.jsx(ai,{...e}),"Copy snippet for reading file"]}),n.data.isMarimoFile&&!D()&&k.jsxs(k.Fragment,{children:[k.jsx(Lt,{}),k.jsxs(Tt,{onSelect:m,children:[k.jsx(Lc,{...e}),"Open notebook"]})]}),k.jsx(Lt,{}),!n.data.isDirectory&&k.jsxs(k.Fragment,{children:[k.jsxs(Tt,{onSelect:async()=>{const e=(await Bs({path:n.data.path})).contents||"";S(new Blob([e]),n.data.name)},children:[k.jsx(Nt,{...e}),"Download"]}),k.jsx(Lt,{})]}),k.jsxs(Tt,{onSelect:p,variant:"danger",children:[k.jsx(je,{...e}),"Delete"]})]})},t[18]=n,t[19]=y,t[20]=v,t[21]=u,t[22]=i,t[23]=m,t[24]=p,t[25]=N):N=t[25];const C=N;let j,_,I;t[26]===Symbol.for("react.memo_cache_sentinel")?(j=on("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),t[26]=j):j=t[26],t[27]!==n?(_=e=>{e.stopPropagation(),n.data.isDirectory&&n.toggle()},I=k.jsx(ST,{node:n}),t[27]=n,t[28]=_,t[29]=I):(_=t[28],I=t[29]);const A=n.willReceiveDrop&&n.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground";let M,T,O,P,R,F,L;return t[30]!==A?(M=on("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",A),t[30]=A,t[31]=M):M=t[31],t[32]!==n.data.isMarimoFile||t[33]!==l?(T=n.data.isMarimoFile?k.jsx("img",{src:"/favicon.ico",className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):k.jsx(l,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),t[32]=n.data.isMarimoFile,t[33]=l,t[34]=T):T=t[34],t[35]!==n||t[36]!==m?(O=n.isEditing?k.jsx(CT,{node:n}):k.jsx(NT,{node:n,onOpenMarimoFile:m}),t[35]=n,t[36]=m,t[37]=O):O=t[37],t[38]===Symbol.for("react.memo_cache_sentinel")?(P=k.jsx(Ot,{asChild:!0,tabIndex:-1,onClick:MT,children:k.jsx(E,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:k.jsx(Zl,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),t[38]=P):P=t[38],t[39]!==C?(R=k.jsxs(zt,{modal:!1,children:[P,C()]}),t[39]=C,t[40]=R):R=t[40],t[41]!==M||t[42]!==T||t[43]!==O||t[44]!==R?(F=k.jsxs("span",{className:M,children:[T,O,R]}),t[41]=M,t[42]=T,t[43]=O,t[44]=R,t[45]=F):F=t[45],t[46]!==o||t[47]!==a||t[48]!==_||t[49]!==I||t[50]!==F?(L=k.jsxs("div",{style:o,ref:a,className:j,draggable:!0,onClick:_,children:[I,F]}),t[46]=o,t[47]=a,t[48]=_,t[49]=I,t[50]=F,t[51]=L):L=t[51],L},ST=e=>{const t=b(3),{node:n}=e;if(!n.data.isDirectory){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx("span",{className:"w-5 h-5 flex-shrink-0"}),t[0]=e):e=t[0],e}let o;return t[1]!==n.isOpen?(o=n.isOpen?k.jsx(Ee,{className:"w-5 h-5 flex-shrink-0"}):k.jsx(oa,{className:"w-5 h-5 flex-shrink-0"}),t[1]=n.isOpen,t[2]=o):o=t[2],o};function jT(e,t){e.stopPropagation(),e.preventDefault(),window.open(`/?file=${t}`,"_blank")}function _T(){return null}function IT(e){const{parentNode:t}=e;return!t.data.isDirectory}function AT(e){return e.stopPropagation()}function MT(e){return e.stopPropagation()}const TT=()=>{const e=b(20),{ref:t,height:n}=sT(),o=void 0===n?1:n;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={noClick:!0,noKeyboard:!0},e[0]=r):r=e[0];const{getRootProps:a,getInputProps:s,isDragActive:i}=mT(r);let l,c,d,u,h,m,f,p;return e[1]!==a?(l=a(),e[1]=a,e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(c=on("flex flex-col flex-1 overflow-hidden relative"),e[3]=c):c=e[3],e[4]!==s?(d=s(),e[4]=s,e[5]=d):d=e[5],e[6]!==d?(u=k.jsx("input",{...d}),e[6]=d,e[7]=u):u=e[7],e[8]!==i?(h=i&&k.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"}),e[8]=i,e[9]=h):h=e[9],e[10]!==o?(m=k.jsx(bT,{height:o}),e[10]=o,e[11]=m):m=e[11],e[12]!==t||e[13]!==m?(f=k.jsx("div",{ref:t,className:"flex flex-col flex-1 overflow-hidden",children:m}),e[12]=t,e[13]=m,e[14]=f):f=e[14],e[15]!==l||e[16]!==u||e[17]!==h||e[18]!==f?(p=k.jsxs("div",{...l,className:c,children:[u,h,f]}),e[15]=l,e[16]=u,e[17]=h,e[18]=f,e[19]=p):p=e[19],p},OT=e=>{const t=b(6),{children:n}=e,{openModal:o,closeModal:r}=w();let a,s;return t[0]!==o||t[1]!==r?(a=()=>o(k.jsx(PT,{onClose:r})),t[0]=o,t[1]=r,t[2]=a):a=t[2],t[3]!==a||t[4]!==n?(s=k.jsx(as,{onClick:a,children:n}),t[3]=a,t[4]=n,t[5]=s):s=t[5],s},DT=[qt.lineWrapping],PT=e=>{const t=b(23),{onClose:n}=e,[o,a]=r.useState(""),{theme:s}=Te();let i,l,c,d,u,h;t[0]!==n?(i=async e=>{e.preventDefault();const t=new FormData(e.target),o=t.get("title"),r=t.get("description"),a=t.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:o,description:r,code:a})}),n(),re({title:"Snippet Submitted",description:"Thank you for contributing! We will review your snippet shortly."})},t[0]=n,t[1]=i):i=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(l=k.jsx(j,{children:"Contribute a Snippet"}),t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsxs(Ie,{children:[l,k.jsxs(_,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",k.jsx("a",{href:Ze.githubPage,target:"_blank",rel:"noreferrer",className:"underline",children:"on GitHub"}),"."]})]}),t[3]=c):c=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(d=k.jsx(Qe,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),u=k.jsx(ss,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),t[4]=d,t[5]=u):(d=t[4],u=t[5]),t[6]!==o?(h=k.jsx("input",{type:"hidden",name:"code",value:o}),t[6]=o,t[7]=h):h=t[7];const m="dark"===s?"dark":"light";let f,p,g,v,x,y;return t[8]!==m||t[9]!==o?(f=k.jsx(qs,{theme:m,language:"python",className:"cm border rounded overflow-hidden",extensions:DT,value:o,onChange:a}),t[8]=m,t[9]=o,t[10]=f):f=t[10],t[11]!==h||t[12]!==f?(p=k.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[d,u,h,f]}),t[11]=h,t[12]=f,t[13]=p):p=t[13],t[14]!==n?(g=k.jsx(E,{"data-testid":"snippet-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=g):g=t[15],t[16]===Symbol.for("react.memo_cache_sentinel")?(v=k.jsx(E,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),t[16]=v):v=t[16],t[17]!==g?(x=k.jsxs(I,{children:[g,v]}),t[17]=g,t[18]=x):x=t[18],t[19]!==i||t[20]!==p||t[21]!==x?(y=k.jsx(A,{className:"w-fit",children:k.jsxs("form",{onSubmit:i,children:[c,p,x]})}),t[19]=i,t[20]=p,t[21]=x,t[22]=y):y=t[22],y},RT=[qt.lineWrapping],FT=()=>{const e=b(20),[t,n]=u.useState();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0];const{data:a,error:s,loading:i}=an(BT,o);if(s){let t;return e[1]!==s?(t=k.jsx(Us,{error:s}),e[1]=s,e[2]=t):t=e[2],t}if(i||!a){let t;return e[3]===Symbol.for("react.memo_cache_sentinel")?(t=k.jsx(ns,{size:"medium",centered:!0}),e[3]=t):t=e[3],t}const l=t?"h-1/3":"h-full";let c,d,h,m,f,p,g,v,x;return e[4]!==l?(c=on("border-b rounded-none",l),e[4]=l,e[5]=c):c=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(d=k.jsx(Ye,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),e[6]=d):d=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(h=k.jsxs("div",{className:"flex items-center w-full",children:[d,k.jsx(OT,{children:k.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:k.jsx(zo,{className:"h-4 w-4"})})})]}),m=k.jsx(Ke,{children:"No results"}),e[7]=h,e[8]=m):(h=e[7],m=e[8]),e[9]===Symbol.for("react.memo_cache_sentinel")?(f=e=>n(e),e[9]=f):f=e[9],e[10]!==a.snippets?(p=k.jsx(zT,{onSelect:f,snippets:a.snippets}),e[10]=a.snippets,e[11]=p):p=e[11],e[12]!==c||e[13]!==p?(g=k.jsxs(mn,{className:c,children:[h,m,p]}),e[12]=c,e[13]=p,e[14]=g):g=e[14],e[15]!==t?(v=k.jsx(r.Suspense,{children:k.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:t?k.jsx(LT,{snippet:t},t.title):k.jsx(DN,{title:"",description:"Click on a snippet to view its content."})})}),e[15]=t,e[16]=v):v=e[16],e[17]!==g||e[18]!==v?(x=k.jsxs("div",{className:"flex-1 overflow-hidden",children:[g,v]}),e[17]=g,e[18]=v,e[19]=x):x=e[19],x},LT=e=>{const t=b(27),{snippet:n}=e,{theme:o}=Te(),{createNewCell:r}=q(),a=_d();let s;t[0]!==n.sections||t[1]!==r||t[2]!==a?(s=()=>{for(const e of[...n.sections].reverse())e.code&&r({code:e.code,before:!1,cellId:a??"__end__"})},t[0]=n.sections,t[1]=r,t[2]=a,t[3]=s):s=t[3];const i=s;let l;t[4]!==r||t[5]!==a?(l=e=>{r({code:e,before:!1,cellId:a??"__end__"})},t[4]=r,t[5]=a,t[6]=l):l=t[6];const c=l;let d,u,h,m,f,p;if(t[7]!==n.title?(d=k.jsx("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1",children:n.title}),t[7]=n.title,t[8]=d):d=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(u=k.jsx(zl,{className:"ml-2 h-4 w-4"}),t[9]=u):u=t[9],t[10]!==i?(h=k.jsx("div",{className:"flex justify-end",children:k.jsx(Su,{children:k.jsxs(E,{className:"float-right",size:"xs",variant:"outline",onClick:i,children:["Insert snippet",u]})})}),t[10]=i,t[11]=h):h=t[11],t[12]!==n.title||t[13]!==n.sections||t[14]!==c||t[15]!==o){let e;t[17]!==n.title||t[18]!==c||t[19]!==o?(e=e=>{const{code:t,html:r,id:a}=e;return r?k.jsx("div",{children:xa({html:r})},`${n.title}-${a}`):t?k.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[k.jsx(Su,{children:k.jsx(C,{content:"Insert snippet",children:k.jsx(E,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{c(t)},children:k.jsx(zl,{className:"h-5 w-5"})})})}),k.jsx(qs,{theme:"dark"===o?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:RT,value:t,readOnly:!0},`${n.title}-${a}`)]},`${n.title}-${a}`):null},t[17]=n.title,t[18]=c,t[19]=o,t[20]=e):e=t[20],m=n.sections.map(e),t[12]=n.title,t[13]=n.sections,t[14]=c,t[15]=o,t[16]=m}else m=t[16];return t[21]!==h||t[22]!==m?(f=k.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[h,m]}),t[21]=h,t[22]=m,t[23]=f):f=t[23],t[24]!==d||t[25]!==f?(p=k.jsxs(k.Fragment,{children:[d,f]}),t[24]=d,t[25]=f,t[26]=p):p=t[26],p},zT=e=>{const t=b(7),{snippets:n,onSelect:o}=e;let r,a;if(t[0]!==o||t[1]!==n){let e;t[3]!==o?(e=e=>k.jsx($e,{className:"rounded-none",onSelect:()=>o(e),children:k.jsx("div",{className:"flex flex-row gap-2 items-center",children:k.jsx("span",{className:"mt-1 text-accent-foreground",children:e.title})})},e.title),t[3]=o,t[4]=e):e=t[4],r=n.map(e),t[0]=o,t[1]=n,t[2]=r}else r=t[2];return t[5]!==r?(a=k.jsx(vr,{className:"flex flex-col overflow-auto",children:r}),t[5]=r,t[6]=a):a=t[6],a};function BT(){return si()}const UT=e=>{const t=b(11),{value:n,className:o,tooltip:a}=e,[s,i]=r.useState(!1);let l;t[0]!==n?(l=tt.stopPropagation((async()=>{await et(n).then((()=>{i(!0),setTimeout((()=>i(!1)),2e3)}))})),t[0]=n,t[1]=l):l=t[1];const c=l;let d,u;t[2]!==s||t[3]!==o?(d=s?k.jsx(_t,{className:on(o,"text-[var(--grass-11)]")}):k.jsx(nt,{className:o}),t[2]=s,t[3]=o,t[4]=d):d=t[4],t[5]!==c||t[6]!==d?(u=k.jsx("span",{onClick:c,children:d}),t[5]=c,t[6]=d,t[7]=u):u=t[7];const h=u;if(!1===a)return h;const m=s?"Copied!":a??"Copy to clipboard";let f;return t[8]!==m||t[9]!==h?(f=k.jsx(C,{content:m,delayDuration:400,children:h}),t[8]=m,t[9]=h,t[10]=f):f=t[10],f},VT=Z((e=>{const t=e(Tr),n=e(ae),o=e(qa);return Ol(t,(e=>{if(!e.variable_name)return-1;const t=Object.values(n).find((t=>t.name===e.variable_name));if(!t)return 0;const r=o.inOrderIds.indexOf(t.declaredBy[0]);return-1===r?0:r}))})),GT=()=>{const e=b(43),[t,n]=u.useState(""),o=le(ue),r=_d(),{expandedColumns:a,expandedTables:s,columnsPreviews:i}=ii(),{toggleTable:l,toggleColumn:c,closeAllColumns:d}=li(),{createNewCell:h}=q(),m=le(VT);if(0===m.length){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=k.jsx(DN,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",icon:k.jsx(ke,{})}),e[0]=t):t=e[0],t}let f;e[1]!==o||e[2]!==h||e[3]!==r?(f=e=>{e.includes("alt")&&function(e,t,n){bd("altair","alt",(o=>{const r=ie.create();t({cellId:n??"__end__",before:!1,code:o,lastCodeRun:e?o:void 0,newCellId:r,autoFocus:!1}),e&&K({cellIds:[r],codes:[o]})}))}(o,h,r),h({code:e,before:!1,cellId:r??"__end__"})},e[1]=o,e[2]=h,e[3]=r,e[4]=f):f=e[4];const p=f;let g;e[5]!==o||e[6]!==h||e[7]!==r?(g=e=>{wd(o,h,r);let t="";e:switch(e.source_type){case"local":t=`mo.ui.table(${e.name})`;break e;case"duckdb":t=`_df = mo.sql(f"SELECT * FROM ${e.name} LIMIT 100")`;break e;default:M(e.source_type)}h({code:t,before:!1,cellId:r??"__end__"})},e[5]=o,e[6]=h,e[7]=r,e[8]=g):g=e[8];const v=g,x=!!t.trim();let y,w,N,C,E,S,j,_,I,A,T;return e[9]===Symbol.for("react.memo_cache_sentinel")?(y=on("border-b bg-background rounded-none","h-full"),e[9]=y):y=e[9],e[10]!==d?(w=e=>{e.length>0&&d(),n(e)},e[10]=d,e[11]=w):w=e[11],e[12]!==t||e[13]!==w?(N=k.jsx(Ye,{placeholder:"Search tables...",className:"h-6 m-1",value:t,onValueChange:w,rootClassName:"flex-1 border-r"}),e[12]=t,e[13]=w,e[14]=N):N=e[14],e[15]!==x?(C=x&&k.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:k.jsx(en,{className:"h-4 w-4"})}),e[15]=x,e[16]=C):C=e[16],e[17]!==N||e[18]!==C?(E=k.jsxs("div",{className:"flex items-center w-full",children:[N,C]}),e[17]=N,e[18]=C,e[19]=E):E=e[19],e[20]!==c||e[21]!==i?(S=(e,t)=>{const n=`${e.name}:${t.name}`;c({table:e.name,column:t.name}),i.has(n)||di({source:e.source,tableName:e.name,columnName:t.name,sourceType:e.source_type})},e[20]=c,e[21]=i,e[22]=S):S=e[22],e[23]!==l?(j=e=>{l(e.name)},e[23]=l,e[24]=j):j=e[24],e[25]!==x||e[26]!==s?(_=e=>!!x||s.has(e.name),e[25]=x,e[26]=s,e[27]=_):_=e[27],e[28]!==a?(I=(e,t)=>{const n=`${e.name}:${t.name}`;return a.has(n)},e[28]=a,e[29]=I):I=e[29],e[30]!==p||e[31]!==v||e[32]!==S||e[33]!==j||e[34]!==i||e[35]!==m||e[36]!==x||e[37]!==_||e[38]!==I?(A=k.jsx($T,{onAddColumnChart:p,onAddTable:v,onExpandColumn:S,onExpandTable:j,columnPreviews:i,tables:m,isSearching:x,isTableExpanded:_,isColumnExpanded:I}),e[30]=p,e[31]=v,e[32]=S,e[33]=j,e[34]=i,e[35]=m,e[36]=x,e[37]=_,e[38]=I,e[39]=A):A=e[39],e[40]!==E||e[41]!==A?(T=k.jsx("div",{className:"flex-1 overflow-hidden",children:k.jsxs(mn,{className:y,children:[E,A]})}),e[40]=E,e[41]=A,e[42]=T):T=e[42],T},$T=e=>{const t=b(25),{tables:n,isSearching:o,columnPreviews:r,onAddColumnChart:a,onAddTable:s,onExpandTable:i,onExpandColumn:l,isTableExpanded:c,isColumnExpanded:d}=e;let h,m,f,p;if(t[0]!==n||t[1]!==c||t[2]!==o||t[3]!==i||t[4]!==s||t[5]!==l||t[6]!==d||t[7]!==a||t[8]!==r){let e,p;e=Object.entries(ze.groupBy(n,XT,KT)),e=Ol(e,JT),t[12]!==c||t[13]!==o||t[14]!==i||t[15]!==s||t[16]!==l||t[17]!==d||t[18]!==a||t[19]!==r?(p=e=>{const t=c(e),n=[k.jsx(HT,{table:e,forceMount:o,onExpand:()=>i(e),onAddTable:()=>s(e),isExpanded:t},e.name)];return t&&n.push(...e.columns.map((t=>k.jsxs(u.Fragment,{children:[k.jsx(WT,{table:e,column:t,onExpandColumn:l,isExpanded:d(e,t)},`${e.name}.${t.name}`),d(e,t)&&k.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:k.jsx(ui,{children:k.jsx(YT,{table:e,column:t,onAddColumnChart:a,preview:r.get(`${e.name}:${t.name}`)})})})]},`${e.name}.${t.name}`)))),n},t[12]=c,t[13]=o,t[14]=i,t[15]=s,t[16]=l,t[17]=d,t[18]=a,t[19]=r,t[20]=p):p=t[20];const g=p;h=vr,m="flex flex-col overflow-auto",f=(()=>0===e.length?null:1===e.length?e[0][1].flatMap(g):e.flatMap(((e,t)=>{const[n,o]=e;return[k.jsx("div",{className:on("font-bold px-2 py-1 text-muted-foreground bg-[var(--slate-2)] border-t text-sm",t>0&&"border-t"),children:"memory"===n?"In-Memory":n},n),...o.flatMap(g)]})))(),t[0]=n,t[1]=c,t[2]=o,t[3]=i,t[4]=s,t[5]=l,t[6]=d,t[7]=a,t[8]=r,t[9]=h,t[10]=m,t[11]=f}else h=t[9],m=t[10],f=t[11];return t[21]!==h||t[22]!==m||t[23]!==f?(p=k.jsx(h,{className:m,children:f}),t[21]=h,t[22]=m,t[23]=f,t[24]=p):p=t[24],p},HT=e=>{const t=b(27),{table:n,onExpand:o,onAddTable:r,isExpanded:a}=e;let s;t[0]!==n.num_rows||t[1]!==n.num_columns?(s=()=>{const e=[];return null!=n.num_rows&&e.push(`${n.num_rows} rows`),null!=n.num_columns&&e.push(`${n.num_columns} columns`),0===e.length?null:k.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:k.jsx("span",{className:"text-xs text-muted-foreground",children:e.join(", ")})})},t[0]=n.num_rows,t[1]=n.num_columns,t[2]=s):s=t[2];const i=s,l=n.name,c=a&&"rotate-90";let d,u,h,m,f,p,g,v,x;return t[3]!==c?(d=on("h-3 w-3 transition-transform",c),t[3]=c,t[4]=d):d=t[4],t[5]!==d?(u=k.jsx(oa,{className:d}),t[5]=d,t[6]=u):u=t[6],t[7]!==n.name?(h=k.jsx("span",{className:"text-sm",children:n.name}),t[7]=n.name,t[8]=h):h=t[8],t[9]!==u||t[10]!==h?(m=k.jsxs("div",{className:"flex gap-1 items-center flex-1",children:[u,h]}),t[9]=u,t[10]=h,t[11]=m):m=t[11],t[12]!==i?(f=i(),t[12]=i,t[13]=f):f=t[13],t[14]!==r||t[15]!==n?(p=tt.stopPropagation((()=>r(n))),t[14]=r,t[15]=n,t[16]=p):p=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(g=k.jsx(zc,{className:"h-3 w-3"}),t[17]=g):g=t[17],t[18]!==p?(v=k.jsx(C,{content:"Add table to notebook",delayDuration:400,children:k.jsx(E,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:p,children:g})}),t[18]=p,t[19]=v):v=t[19],t[20]!==n.name||t[21]!==a||t[22]!==o||t[23]!==m||t[24]!==f||t[25]!==v?(x=k.jsxs($e,{className:"rounded-none py-1 group min-h-9 border-t",value:l,"aria-selected":a,forceMount:!0,onSelect:o,children:[m,f,v]}),t[20]=n.name,t[21]=a,t[22]=o,t[23]=m,t[24]=f,t[25]=v,t[26]=x):x=t[26],x},WT=e=>{const t=b(22),{table:n,column:o,onExpandColumn:r}=e,a=hi[o.type],s=`${n.name}.${o.name}`,i=`${n.name}.${o.name}`;let l,c,d,u,h,m,f;return t[0]!==r||t[1]!==n||t[2]!==o?(l=()=>r(n,o),t[0]=r,t[1]=n,t[2]=o,t[3]=l):l=t[3],t[4]!==a?(c=k.jsx(a,{className:"flex-shrink-0 h-3 w-3",strokeWidth:1.5}),t[4]=a,t[5]=c):c=t[5],t[6]!==o.name?(d=k.jsx("span",{children:o.name}),t[6]=o.name,t[7]=d):d=t[7],t[8]!==c||t[9]!==d?(u=k.jsxs("div",{className:"flex flex-row gap-2 items-center pl-6 flex-1",children:[c,d]}),t[8]=c,t[9]=d,t[10]=u):u=t[10],t[11]!==o.name?(h=k.jsx(C,{content:"Copy column name",delayDuration:400,children:k.jsx(E,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:k.jsx(UT,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),t[11]=o.name,t[12]=h):h=t[12],t[13]!==o.external_type?(m=k.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),t[13]=o.external_type,t[14]=m):m=t[14],t[15]!==s||t[16]!==i||t[17]!==l||t[18]!==u||t[19]!==h||t[20]!==m?(f=k.jsxs($e,{className:"rounded-none py-1 group",value:i,onSelect:l,children:[u,h,m]},s),t[15]=s,t[16]=i,t[17]=l,t[18]=u,t[19]=h,t[20]=m,t[21]=f):f=t[21],f},qT=u.lazy((()=>ci((()=>import("./index-CY_tVZUZ.js")),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]),import.meta.url).then((e=>({default:e.VegaLite}))))),YT=e=>{const t=b(26),{table:n,column:o,preview:r,onAddColumnChart:a}=e,{theme:s}=Te();if(!r){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading..."}),t[0]=e):e=t[0],e}let i;t[1]!==r.error?(i=r.error&&k.jsx("span",{className:"text-xs text-muted-foreground",children:r.error}),t[1]=r.error,t[2]=i):i=t[2];const l=i;let c;t[3]!==r.summary?(c=r.summary&&k.jsx("div",{className:"gap-x-16 gap-y-1 grid grid-cols-2-fit border rounded p-2 empty:hidden",children:Object.entries(r.summary).map(ZT)}),t[3]=r.summary,t[4]=c):c=t[4];const d=c,u=QT;let h;t[5]!==r.chart_spec||t[6]!==s?(h=r.chart_spec&&k.jsx(qT,{spec:u(JSON.parse(r.chart_spec)),width:"container",height:100,actions:!1,theme:"dark"===s?"dark":"vox"}),t[5]=r.chart_spec,t[6]=s,t[7]=h):h=t[7];const m=h;let f;t[8]!==r.chart_code||t[9]!==n||t[10]!==a?(f=r.chart_code&&"local"===n.source_type&&k.jsx(C,{content:"Add chart to notebook",delayDuration:400,children:k.jsx(E,{variant:"outline",size:"icon",className:"z-10 bg-background absolute right-1 -top-1",onClick:tt.stopPropagation((()=>a(r.chart_code||""))),children:k.jsx(zc,{className:"h-3 w-3"})})}),t[8]=r.chart_code,t[9]=n,t[10]=a,t[11]=f):f=t[11];const p=f;let g;t[12]!==n||t[13]!==o||t[14]!==a?(g="duckdb"===n.source_type&&k.jsx(C,{content:"Add SQL cell",delayDuration:400,children:k.jsx(E,{variant:"outline",size:"icon",className:"z-10 bg-background absolute right-1 -top-1",onClick:tt.stopPropagation((()=>{const e=`_df = mo.sql(f'SELECT "${o.name}" FROM ${n.name} LIMIT 100')`;a(e)})),children:k.jsx(zc,{className:"h-3 w-3"})})}),t[12]=n,t[13]=o,t[14]=a,t[15]=g):g=t[15];const v=g;let x;t[16]!==r.chart_max_rows_errors?(x=r.chart_max_rows_errors&&k.jsx("span",{className:"text-xs text-muted-foreground",children:"Too many rows to render the chart."}),t[16]=r.chart_max_rows_errors,t[17]=x):x=t[17];const y=x;if(!(l||d||m||y)){let e;return t[18]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx("span",{className:"text-xs text-muted-foreground",children:"No data"}),t[18]=e):e=t[18],e}let w;return t[19]!==l||t[20]!==p||t[21]!==v||t[22]!==y||t[23]!==m||t[24]!==d?(w=k.jsxs("div",{className:"flex flex-col gap-2 relative",children:[l,p,v,y,m,d]}),t[19]=l,t[20]=p,t[21]=v,t[22]=y,t[23]=m,t[24]=d,t[25]=w):w=t[25],w};function XT(e){return e.source}function KT(e){return e}function JT(e){const[t]=e;return"memory"===t?0:1}function ZT(e){const[t,n]=e;return null==n?null:k.jsxs("div",{className:"flex items-center gap-1 group",children:[k.jsx(UT,{className:"h-3 w-3 invisible group-hover:visible",value:String(n)}),k.jsx("span",{className:"text-xs min-w-[60px] uppercase",children:t}),k.jsx("span",{className:"text-xs font-bold text-muted-foreground tracking-wide",children:mi(n)})]},t)}function QT(e){return{...e,config:{...e.config,background:"transparent"}}}const eO=e=>{const t=b(4),{isOpen:n,children:o}=e,[r,a]=u.useState(!1);let s,i;return t[0]!==n||t[1]!==r?(s=()=>{n&&!r&&a(!0)},i=[n,r],t[0]=n,t[1]=r,t[2]=s,t[3]=i):(s=t[2],i=t[3]),u.useEffect(s,i),r?o:null},tO=Rr("marimo:scratchpadHistory:v1",[]),nO=Z(!1),oO=Z(null,((e,t,n)=>{if(!(n=n.trim()))return;const o=e(tO),r=[n,...o.filter((e=>e!==n))].slice(0,15);t(tO,r)})),rO={hide_code:!1,disabled:!1},aO=()=>{const e=b(79),t=H(),[n]=Oe(),{theme:o}=Te(),a=r.useRef(null),s=_d(),{createNewCell:i,updateCellCode:l}=q(),c=t.cellRuntime[Me],d=null==c?void 0:c.output,u=null==c?void 0:c.status,h=null==c?void 0:c.consoleOutputs,m=t.cellData[Me],f=(null==m?void 0:m.code)??"",p=ce(oO),[g,v]=Fe(nO),x=le(tO);let y;e[0]!==f||e[1]!==p?(y=()=>{fi({code:f}),p(f)},e[0]=f,e[1]=p,e[2]=y):y=e[2];const w=W(y);let S;e[3]!==f||e[4]!==i||e[5]!==s?(S=()=>{f.trim()&&i({code:f,before:!1,cellId:s??"__end__"})},e[3]=f,e[4]=i,e[5]=s,e[6]=S):S=e[6];const j=W(S);let _;e[7]!==l?(_=()=>{l({cellId:Me,code:"",formattingChange:!1}),fi({code:""});const e=a.current;e&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:""}})},e[7]=l,e[8]=_):_=e[8];const I=W(_);let A;e[9]!==v||e[10]!==l?(A=e=>{v(!1),l({cellId:Me,code:e,formattingChange:!1});const t=a.current;t&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},e[9]=v,e[10]=l,e[11]=A):A=e[11];const M=W(A);let T,O,D,P,R,F,L,z;if(e[12]!==o||e[13]!==f||e[14]!==w||e[15]!==l||e[16]!==n||e[17]!==d||e[18]!==h||e[19]!==g||e[20]!==x||e[21]!==M||e[22]!==I||e[23]!==j||e[24]!==u||e[25]!==v){const t=()=>k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:k.jsx(Gb,{theme:o,allowFocus:!1,showPlaceholder:!1,id:Me,code:f,config:rO,status:"idle",serializedEditorState:null,runCell:w,updateCellCode:l,createNewCell:rn.NOOP,deleteCell:rn.NOOP,focusCell:rn.NOOP,moveCell:rn.NOOP,moveToNextCell:void 0,updateCellConfig:rn.NOOP,clearSerializedEditorState:rn.NOOP,userConfig:n,editorViewRef:a,hidden:!1})}),k.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:k.jsx(ha,{allowExpand:!1,output:d,className:"output-area",cellId:Me,stale:!1})}),k.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:k.jsx(il,{consoleOutputs:h,className:"overflow-auto",stale:!1,cellName:Ps,onSubmitDebugger:rn.NOOP,cellId:Me,debuggerActive:!1})})]});let r;e[32]!==g||e[33]!==x||e[34]!==M||e[35]!==o?(r=()=>g?k.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:k.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:x.map(((e,t)=>k.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>M(e),children:k.jsx(qs,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:e.trim(),editable:!1,readOnly:!0})},t)))})}):null,e[32]=g,e[33]=x,e[34]=M,e[35]=o,e[36]=r):r=e[36];const s=r;let i,c,m,p,y,b,S,_,A;D="flex flex-col h-full overflow-hidden divide-y",e[37]===Symbol.for("react.memo_cache_sentinel")?(P=ht.create(Me),e[37]=P):P=e[37],e[38]===Symbol.for("react.memo_cache_sentinel")?(i=N("cell.run"),e[38]=i):i=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx(Cc,{color:"var(--grass-11)",size:16}),e[39]=c):c=e[39],e[40]!==w||e[41]!==g?(m=k.jsx(C,{content:i,children:k.jsx(E,{"data-testid":"scratchpad-run-button",onClick:w,disabled:g,variant:"text",size:"xs",children:c})}),e[40]=w,e[41]=g,e[42]=m):m=e[42],e[43]===Symbol.for("react.memo_cache_sentinel")?(p=k.jsx(Ql,{size:16}),e[43]=p):p=e[43],e[44]!==g||e[45]!==I?(y=k.jsx(C,{content:"Clear code and outputs",children:k.jsx(E,{disabled:g,size:"xs",variant:"text",onClick:I,children:p})}),e[44]=g,e[45]=I,e[46]=y):y=e[46],e[47]===Symbol.for("react.memo_cache_sentinel")?(b=k.jsx(zl,{size:16}),e[47]=b):b=e[47],e[48]!==g||e[49]!==j?(S=k.jsx(Su,{children:k.jsx(C,{content:"Insert code",children:k.jsx(E,{disabled:g,size:"xs",variant:"text",onClick:j,children:b})})}),e[48]=g,e[49]=j,e[50]=S):S=e[50],e[51]!==u?(_=("running"===u||"queued"===u)&&k.jsx(ns,{className:"inline",size:"small"}),e[51]=u,e[52]=_):_=e[52],e[53]===Symbol.for("react.memo_cache_sentinel")?(A=k.jsx("div",{className:"flex-1"}),e[53]=A):A=e[53];const L=g&&"bg-[var(--sky-3)] rounded-none";let z,B;e[54]!==L?(z=on(L),e[54]=L,e[55]=z):z=e[55],e[56]!==v||e[57]!==g?(B=()=>v(!g),e[56]=v,e[57]=g,e[58]=B):B=e[58];const U=0===x.length;let V,G;e[59]===Symbol.for("react.memo_cache_sentinel")?(V=k.jsx(ic,{size:16}),e[59]=V):V=e[59],e[60]!==z||e[61]!==B||e[62]!==U?(G=k.jsx(C,{content:"Toggle history",children:k.jsx(E,{size:"xs",variant:"text",className:z,onClick:B,disabled:U,children:V})}),e[60]=z,e[61]=B,e[62]=U,e[63]=G):G=e[63],e[64]!==m||e[65]!==y||e[66]!==S||e[67]!==_||e[68]!==G?(R=k.jsxs("div",{className:"flex items-center flex-shrink-0",children:[m,y,S,_,A,G]}),e[64]=m,e[65]=y,e[66]=S,e[67]=_,e[68]=G,e[69]=R):R=e[69],T="flex-1 divide-y relative",O=t(),F=s(),e[12]=o,e[13]=f,e[14]=w,e[15]=l,e[16]=n,e[17]=d,e[18]=h,e[19]=g,e[20]=x,e[21]=M,e[22]=I,e[23]=j,e[24]=u,e[25]=v,e[26]=T,e[27]=O,e[28]=D,e[29]=P,e[30]=R,e[31]=F}else T=e[26],O=e[27],D=e[28],P=e[29],R=e[30],F=e[31];return e[70]!==T||e[71]!==O||e[72]!==F?(L=k.jsxs("div",{className:T,children:[O,F]}),e[70]=T,e[71]=O,e[72]=F,e[73]=L):L=e[73],e[74]!==D||e[75]!==P||e[76]!==R||e[77]!==L?(z=k.jsxs("div",{className:D,id:P,children:[R,L]}),e[74]=D,e[75]=P,e[76]=R,e[77]=L,e[78]=z):z=e[78],z},sO=()=>{const e=b(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=k.jsx(aO,{}),e[0]=t):t=e[0],t},iO=()=>{const e=b(16),[t]=Oe(),n=t.package_management.manager;let o;e[0]!==n?(o=[n],e[0]=n,e[1]=o):o=e[1];const{data:r,loading:a,error:s,reload:i}=an(uO,o);if(a&&!r){let t;return e[2]===Symbol.for("react.memo_cache_sentinel")?(t=k.jsx(ns,{size:"medium",centered:!0}),e[2]=t):t=e[2],t}if(s){let t;return e[3]!==s?(t=k.jsx(Us,{error:s}),e[3]=s,e[4]=t):t=e[4],t}let l;e[5]!==(null==r?void 0:r.packages)?(l=(null==r?void 0:r.packages)||[],e[5]=null==r?void 0:r.packages,e[6]=l):l=e[6];const c=l;let d,u,h;return e[7]!==n||e[8]!==i?(d=k.jsx(lO,{packageManager:n,onSuccess:i}),e[7]=n,e[8]=i,e[9]=d):d=e[9],e[10]!==c||e[11]!==i?(u=k.jsx(cO,{packages:c,onSuccess:i}),e[10]=c,e[11]=i,e[12]=u):u=e[12],e[13]!==d||e[14]!==u?(h=k.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[d,u]}),e[13]=d,e[14]=u,e[15]=h):h=e[15],h},lO=({onSuccess:e,packageManager:t})=>{const[n,o]=u.useState(""),[r,a]=u.useState(!1),s=async()=>{try{a(!0);const t=await vi({package:n});t.success?(e(),re({title:"Package added",description:k.jsxs("span",{children:["The package ",k.jsx(Pa,{className:"inline",children:n})," and its dependencies has been added to your environment."]})})):re({title:"Failed to add package",description:t.error,variant:"danger"})}finally{o(""),a(!1)}};return k.jsxs("div",{className:"flex items-center w-full border-b",children:[k.jsx(js,{placeholder:`Install packages with ${t}...`,icon:r?k.jsx(ns,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):k.jsx(Ul,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),rootClassName:"flex-1 border-none",value:n,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),s())},onChange:e=>o(e.target.value)}),k.jsx(C,{delayDuration:300,side:"left",align:"start",content:k.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:",k.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[k.jsxs("div",{children:[k.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"})," A package name; this will install the latest version.",k.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),k.jsxs("div",{children:[k.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"})," ","A package with a specific version or version range.",k.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),k.jsxs("div",{children:[k.jsx("span",{className:"font-bold tracking-wide",children:"Git:"})," A Git repository",k.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),k.jsxs("div",{children:[k.jsx("span",{className:"font-bold tracking-wide",children:"URL:"})," A remote wheel or source distribution.",k.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),k.jsxs("div",{children:[k.jsx("span",{className:"font-bold tracking-wide",children:"Path:"})," A local wheel, source distribution, or project directory.",k.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:k.jsx(pi,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),k.jsx("button",{type:"button",className:on("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",n&&"bg-accent text-accent-foreground","disabled:cursor-not-allowed disabled:opacity-50"),onClick:s,disabled:!n,children:"Add"})]})},cO=e=>{const t=b(9),{onSuccess:n,packages:o}=e;if(0===o.length){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx(DN,{title:"No packages",description:"No packages are installed in this environment.",icon:k.jsx(Ul,{})}),t[0]=e):e=t[0],e}let r,a,s;if(t[1]===Symbol.for("react.memo_cache_sentinel")?(r=k.jsx(Is,{children:k.jsxs(As,{children:[k.jsx(Ms,{children:"Name"}),k.jsx(Ms,{children:"Version"}),k.jsx(Ms,{})]})}),t[1]=r):r=t[1],t[2]!==n||t[3]!==o){let e;t[5]!==n?(e=e=>k.jsxs(As,{className:"group",onClick:async()=>{await et(`${e.name}==${e.version}`),re({title:"Copied to clipboard"})},children:[k.jsx(Ds,{children:e.name}),k.jsx(Ds,{children:e.version}),k.jsx(Ds,{children:k.jsx(dO,{packageName:e.name,onSuccess:n})})]},e.name),t[5]=n,t[6]=e):e=t[6],a=o.map(e),t[2]=n,t[3]=o,t[4]=a}else a=t[4];return t[7]!==a?(s=k.jsxs(_s,{className:"overflow-auto flex-1",children:[r,k.jsx(Os,{children:a})]}),t[7]=a,t[8]=s):s=t[8],s},dO=({packageName:e,onSuccess:t})=>{const[n,o]=u.useState(!1);return n?k.jsx(ns,{size:"small",className:"float-right mr-2 h-4 w-4 shrink-0 opacity-50"}):k.jsx("button",{type:"button",className:on("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible"),onClick:tt.stopPropagation((async()=>{try{o(!0);const n=await xi({package:e});n.success?(t(),re({title:"Package removed",description:k.jsxs("span",{children:["The package ",k.jsx(Pa,{className:"inline",children:e})," has been removed from your environment."]})})):re({title:"Failed to add package",description:n.error,variant:"danger"})}finally{o(!1)}})),children:"Remove"})};function uO(){return gi()}const hO=u.lazy((()=>ci((()=>import("./terminal-BYpKKYsN.js")),__vite__mapDeps([15,2,3,16]),import.meta.url))),mO=e=>{const t=b(110),{children:n}=e,{isSidebarOpen:o,isTerminalOpen:a,selectedPanel:s}=Hd(),{setIsSidebarOpen:i,setIsTerminalOpen:l}=Wd(),c=u.useRef(null),d=u.useRef(null);let h,m,f,p,g;t[0]!==o?(h=()=>{if(!c.current)return;const e=c.current.isCollapsed();o&&e&&c.current.expand(),o||e||c.current.collapse(),requestAnimationFrame((()=>{requestAnimationFrame((()=>{window.dispatchEvent(new Event("resize"))}))}))},m=[o],t[0]=o,t[1]=h,t[2]=m):(h=t[1],m=t[2]),r.useEffect(h,m),t[3]!==a?(f=()=>{if(!d.current)return;const e=d.current.isCollapsed();a&&e&&d.current.expand(),a||e||d.current.collapse(),requestAnimationFrame((()=>{requestAnimationFrame((()=>{window.dispatchEvent(new Event("resize"))}))}))},p=[a],t[3]=a,t[4]=f,t[5]=p):(f=t[4],p=t[5]),r.useEffect(f,p),t[6]!==n?(g=k.jsx(Xw,{id:"app",className:"relative h-full",children:k.jsx(r.Suspense,{children:n})},"app"),t[6]=n,t[7]=g):g=t[7];const v=g,x=fO,y=o?"resize-handle":"resize-handle-collapsed";let w,N;t[8]!==y?(w=on("border-border no-print z-10",y,"vertical"),t[8]=y,t[9]=w):w=t[9],t[10]!==w?(N=k.jsx(oN,{onDragging:x,className:w}),t[10]=w,t[11]=N):N=t[11];const C=N,S=a?"resize-handle":"resize-handle-collapsed";let j,_;t[12]!==S?(j=on("border-border no-print z-20",S,"horizontal"),t[12]=S,t[13]=j):j=t[13],t[14]!==j?(_=k.jsx(oN,{onDragging:x,className:j}),t[14]=j,t[15]=_):_=t[15];const I=_;let A,M,T,O,D,P,R,F,L,z,B,U,V,G,$,H,W;t[16]!==s?(A=k.jsx("div",{className:"text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1",children:s}),t[16]=s,t[17]=A):A=t[17],t[18]!==i?(M=()=>i(!1),t[18]=i,t[19]=M):M=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(T=k.jsx(en,{className:"w-4 h-4"}),t[20]=T):T=t[20],t[21]!==M?(O=k.jsx(E,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:M,children:T}),t[21]=M,t[22]=O):O=t[22],t[23]!==A||t[24]!==O?(D=k.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[A,O]}),t[23]=A,t[24]=O,t[25]=D):D=t[25],t[26]!==s?(P="files"===s&&k.jsx(TT,{}),t[26]=s,t[27]=P):P=t[27],t[28]!==s?(R="errors"===s&&k.jsx(PN,{}),t[28]=s,t[29]=R):R=t[29],t[30]!==s?(F="variables"===s&&k.jsx(QM,{}),t[30]=s,t[31]=F):F=t[31],t[32]!==s?(L="dependencies"===s&&k.jsx(qM,{}),t[32]=s,t[33]=L):L=t[33],t[34]!==s?(z="packages"===s&&k.jsx(iO,{}),t[34]=s,t[35]=z):z=t[35],t[36]!==s?(B="outline"===s&&k.jsx(FN,{}),t[36]=s,t[37]=B):B=t[37],t[38]!==s?(U="datasources"===s&&k.jsx(GT,{}),t[38]=s,t[39]=U):U=t[39],t[40]!==s?(V="documentation"===s&&k.jsx(rT,{}),t[40]=s,t[41]=V):V=t[41],t[42]!==s?(G="snippets"===s&&k.jsx(FT,{}),t[42]=s,t[43]=G):G=t[43],t[44]!==s?($="scratchpad"===s&&k.jsx(sO,{}),t[44]=s,t[45]=$):$=t[45],t[46]!==s?(H="logs"===s&&k.jsx(eT,{}),t[46]=s,t[47]=H):H=t[47],t[48]!==D||t[49]!==P||t[50]!==R||t[51]!==F||t[52]!==L||t[53]!==z||t[54]!==B||t[55]!==U||t[56]!==V||t[57]!==G||t[58]!==$||t[59]!==H?(W=k.jsx(ui,{children:k.jsx(r.Suspense,{children:k.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[D,P,R,F,L,z,B,U,V,G,$,H]})})}),t[48]=D,t[49]=P,t[50]=R,t[51]=F,t[52]=L,t[53]=z,t[54]=B,t[55]=U,t[56]=V,t[57]=G,t[58]=$,t[59]=H,t[60]=W):W=t[60];const q=W,Y=o&&"border-r border-l border-[var(--slate-7)]";let X,K,J,Z,Q,ee;t[61]!==Y?(X=on("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",Y),t[61]=Y,t[62]=X):X=t[62],t[63]===Symbol.for("react.memo_cache_sentinel")?(K=(e,t)=>{var n;0===t&&10===e&&(null==(n=c.current)||n.resize(30))},t[63]=K):K=t[63],t[64]!==i?(J=()=>i(!1),Z=()=>i(!0),t[64]=i,t[65]=J,t[66]=Z):(J=t[65],Z=t[66]),t[67]!==q||t[68]!==C?(Q=k.jsxs("span",{className:"flex flex-row h-full",children:[q," ",C]}),t[67]=q,t[68]=C,t[69]=Q):Q=t[69],t[70]!==c||t[71]!==X||t[72]!==J||t[73]!==Z||t[74]!==Q?(ee=k.jsx(Xw,{ref:c,id:"helper",collapsedSize:0,collapsible:!0,className:X,minSize:10,defaultSize:0,maxSize:75,onResize:K,onCollapse:J,onExpand:Z,children:Q},"helper"),t[70]=c,t[71]=X,t[72]=J,t[73]=Z,t[74]=Q,t[75]=ee):ee=t[75];const te=ee,ne=a&&"border-[var(--slate-7)]";let oe,re,ae,se,ie,le,ce,de;t[76]!==ne?(oe=on("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ne),t[76]=ne,t[77]=oe):oe=t[77],t[78]===Symbol.for("react.memo_cache_sentinel")?(re=(e,t)=>{var n;0===t&&10===e&&(null==(n=d.current)||n.resize(30))},t[78]=re):re=t[78],t[79]!==l?(ae=()=>l(!1),se=()=>l(!0),t[79]=l,t[80]=ae,t[81]=se):(ae=t[80],se=t[81]),t[82]!==l?(ie=()=>l(!1),t[82]=l,t[83]=ie):ie=t[83],t[84]!==a||t[85]!==ie?(le=k.jsx(hO,{visible:a,onClose:ie}),t[84]=a,t[85]=ie,t[86]=le):le=t[86],t[87]!==a||t[88]!==le?(ce=k.jsx(eO,{isOpen:a,children:le}),t[87]=a,t[88]=le,t[89]=ce):ce=t[89],t[90]!==d||t[91]!==oe||t[92]!==ae||t[93]!==se||t[94]!==I||t[95]!==ce?(de=k.jsxs(Xw,{ref:d,id:"terminal",collapsedSize:0,collapsible:!0,className:oe,minSize:10,defaultSize:0,maxSize:75,onResize:re,onCollapse:ae,onExpand:se,children:[I,ce]},"terminal"),t[90]=d,t[91]=oe,t[92]=ae,t[93]=se,t[94]=I,t[95]=ce,t[96]=de):de=t[96];const ue=de;let he,me,fe,pe,ge,ve,xe;return t[97]===Symbol.for("react.memo_cache_sentinel")?(he={getItem:e=>ON||(ON??null),setItem(e,t){ON=t||null}},me=k.jsx(jN,{}),t[97]=he,t[98]=me):(he=t[97],me=t[98]),t[99]!==ue?(fe=k.jsx(yN,{capability:"terminal",children:ue}),t[99]=ue,t[100]=fe):fe=t[100],t[101]!==v||t[102]!==fe?(pe=k.jsx(Xw,{children:k.jsxs(eN,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[v,fe]})}),t[101]=v,t[102]=fe,t[103]=pe):pe=t[103],t[104]!==te||t[105]!==pe?(ge=k.jsxs(eN,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:he,children:[me,te,pe]}),t[104]=te,t[105]=pe,t[106]=ge):ge=t[106],t[107]===Symbol.for("react.memo_cache_sentinel")?(ve=k.jsx(ui,{children:k.jsx(bN,{})}),t[107]=ve):ve=t[107],t[108]!==ge?(xe=k.jsxs("div",{className:"flex flex-col flex-1 overflow-hidden absolute inset-0 print:relative",children:[ge,ve]}),t[108]=ge,t[109]=xe):xe=t[109],xe};function fO(e){e||window.dispatchEvent(new Event("resize"))}const pO=e=>{const t=b(5);let n,o,r;return t[0]!==e?(n=k.jsx(ww,{...e}),t[0]=e,t[1]=n):n=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(o=k.jsx(Od,{}),t[2]=o):o=t[2],t[3]!==n?(r=k.jsxs(mO,{children:[n,o]}),t[3]=n,t[4]=r):r=t[4],r};export{pO as default};
|
|
14
|
+
*/const Kc=r.createContext({});function Jc(e,t){[e,t]=l(e,t,Kc);let{toolbarProps:n}=function(e,t){const{"aria-label":n,"aria-labelledby":o,orientation:l="horizontal"}=e;let[c,d]=r.useState(!1);a((()=>{var e;d(!(!t.current||!(null===(e=t.current.parentElement)||void 0===e?void 0:e.closest('[role="toolbar"]'))))}));const{direction:u}=s(),h="rtl"===u&&"horizontal"===l;let m=i(t);const f=r.useRef(null);return{toolbarProps:{role:c?"group":"toolbar","aria-orientation":l,"aria-label":n,"aria-labelledby":null==n?o:void 0,onKeyDownCapture:c?void 0:e=>{if(e.currentTarget.contains(e.target)){if("horizontal"===l&&"ArrowRight"===e.key||"vertical"===l&&"ArrowDown"===e.key)h?m.focusPrevious():m.focusNext();else{if(!("horizontal"===l&&"ArrowLeft"===e.key||"vertical"===l&&"ArrowUp"===e.key))return"Tab"===e.key?(e.stopPropagation(),f.current=document.activeElement,void(e.shiftKey?m.focusFirst():m.focusLast())):void 0;h?m.focusNext():m.focusPrevious()}e.stopPropagation(),e.preventDefault()}},onFocusCapture:c?void 0:e=>{var n,o;f.current&&!e.currentTarget.contains(e.relatedTarget)&&(null===(n=t.current)||void 0===n?void 0:n.contains(e.target))&&(null===(o=f.current)||void 0===o||o.focus(),f.current=null)},onBlurCapture:c?void 0:e=>{e.currentTarget.contains(e.relatedTarget)||f.current||(f.current=e.target)}}}}(e,t),o=c({...e,values:{orientation:e.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),m=d(e);return delete m.id,u.createElement("div",{...h(n,m),...o,ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||"horizontal"},o.children)}const Zc=r.forwardRef(Jc);function Qc(e,t){const n=m(e),o=m(t),r=n.getTime()-o.getTime();return r<0?-1:r>0?1:r}function ed(e){const t=m(e);return+function(e){const t=m(e);return t.setHours(23,59,59,999),t}(t)==+function(e){const t=m(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}(t)}function td(e,t){const n=m(e),o=m(t),r=Qc(n,o),a=Math.abs(function(e,t){const n=m(e),o=m(t);return 12*(n.getFullYear()-o.getFullYear())+(n.getMonth()-o.getMonth())}(n,o));let s;if(a<1)s=0;else{1===n.getMonth()&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-r*a);let t=Qc(n,o)===-r;ed(m(e))&&1===a&&1===Qc(e,o)&&(t=!1),s=r*(a-Number(t))}return 0===s?0:s}function nd(e,t,n){const o=function(e,t){return+m(e)-+m(t)}(e,t)/1e3;return(r=null==n?void 0:n.roundingMethod,e=>{const t=(r?Math[r]:Math.trunc)(e);return 0===t?0:t})(o);var r}function od(e,t){return function(e,t,n){const o=y(),r=(null==n?void 0:n.locale)??o.locale??p,a=Qc(e,t);if(isNaN(a))throw new RangeError("Invalid time value");const s=Object.assign({},n,{addSuffix:null==n?void 0:n.addSuffix,comparison:a});let i,l;a>0?(i=m(t),l=m(e)):(i=m(e),l=m(t));const c=nd(l,i),d=(g(l)-g(i))/1e3,u=Math.round((c-d)/60);let h;if(u<2)return(null==n?void 0:n.includeSeconds)?c<5?r.formatDistance("lessThanXSeconds",5,s):c<10?r.formatDistance("lessThanXSeconds",10,s):c<20?r.formatDistance("lessThanXSeconds",20,s):c<40?r.formatDistance("halfAMinute",0,s):c<60?r.formatDistance("lessThanXMinutes",1,s):r.formatDistance("xMinutes",1,s):0===u?r.formatDistance("lessThanXMinutes",1,s):r.formatDistance("xMinutes",u,s);if(u<45)return r.formatDistance("xMinutes",u,s);if(u<90)return r.formatDistance("aboutXHours",1,s);if(u<v){const e=Math.round(u/60);return r.formatDistance("aboutXHours",e,s)}if(u<2520)return r.formatDistance("xDays",1,s);if(u<x){const e=Math.round(u/v);return r.formatDistance("xDays",e,s)}if(u<2*x)return h=Math.round(u/x),r.formatDistance("aboutXMonths",h,s);if(h=td(l,i),h<12){const e=Math.round(u/x);return r.formatDistance("xMonths",e,s)}{const e=h%12,t=Math.trunc(h/12);return e<3?r.formatDistance("aboutXYears",t,s):e<9?r.formatDistance("overXYears",t,s):r.formatDistance("almostXYears",t+1,s)}}(e,function(e){return f(e,Date.now())}(e),t)}const rd=e=>{const t=b(35);let n;t[0]!==e?(n=()=>{S(new Blob([e.getCellsAsJSON()],{type:"text/plain"}),`${e.proposedName}.json`)},t[0]=e,t[1]=n):n=t[1];const o=n;let r,a,s,i,l,c,d,u,h,m,f,p,g,v,x,y,w;return t[2]!==o||t[3]!==e?(r=t=>{t.preventDefault(),o(),e.closeModal()},t[2]=o,t[3]=e,t[4]=r):r=t[4],t[5]!==e?(a=t=>{"Escape"===t.key&&e.closeModal()},t[5]=e,t[6]=a):a=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(s=k.jsx(j,{className:"text-accent mb-6",children:"Download unsaved changes?"}),t[7]=s):s=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(i={wordBreak:"break-word"},l=k.jsx("p",{children:"This app has unsaved changes. To recover:"}),c={paddingBottom:"10px"},t[8]=i,t[9]=l,t[10]=c):(i=t[8],l=t[9],c=t[10]),t[11]!==e.proposedName?(d=k.jsxs("li",{style:c,children:['Click the "Download" button. This will download a file called ',k.jsxs("code",{children:[e.proposedName,".json"]}),". This file contains your code."]}),t[11]=e.proposedName,t[12]=d):d=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(u={paddingBottom:"10px"},t[13]=u):u=t[13],t[14]===Symbol.for("react.memo_cache_sentinel")?(h={display:"block",padding:"10px"},t[14]=h):h=t[14],t[15]!==e.proposedName?(m=k.jsxs("code",{style:h,children:["marimo recover ",e.proposedName,".json ",">"," ",e.proposedName,".py"]}),t[15]=e.proposedName,t[16]=m):m=t[16],t[17]!==e.proposedName?(f=k.jsxs("code",{children:[e.proposedName,".py"]}),t[17]=e.proposedName,t[18]=f):f=t[18],t[19]!==m||t[20]!==f?(p=k.jsxs("li",{style:u,children:["In your terminal, type",m,"to overwrite ",f," with the recovered changes."]}),t[19]=m,t[20]=f,t[21]=p):p=t[21],t[22]!==d||t[23]!==p?(g=k.jsxs(_,{className:"markdown break-words",style:i,children:[l,k.jsxs("ol",{children:[d,p]})]}),t[22]=d,t[23]=p,t[24]=g):g=t[24],t[25]!==e.closeModal?(v=k.jsx(E,{"aria-label":"Cancel",variant:"secondary","data-testid":"cancel-recovery-button",onClick:e.closeModal,children:"Cancel"}),t[25]=e.closeModal,t[26]=v):v=t[26],t[27]===Symbol.for("react.memo_cache_sentinel")?(x=k.jsx(E,{"data-testid":"download-recovery-button","aria-label":"Download",variant:"default",type:"submit",children:"Download"}),t[27]=x):x=t[27],t[28]!==v?(y=k.jsxs(I,{children:[v,x]}),t[28]=v,t[29]=y):y=t[29],t[30]!==r||t[31]!==a||t[32]!==g||t[33]!==y?(w=k.jsx(A,{className:"w-fit",children:k.jsxs("form",{onSubmit:r,onKeyDown:a,children:[s,g,y]})}),t[30]=r,t[31]=a,t[32]=g,t[33]=y,t[34]=w):w=t[34],w},ad=e=>{const t=b(13),{filename:n,needsSave:o,getCellsAsJSON:r}=e,{openModal:a,closeModal:s}=w();let i;t[0]!==n?(i=null===n?"app":n.slice(0,-3),t[0]=n,t[1]=i):i=t[1];const l=i;let c;t[2]!==o||t[3]!==a||t[4]!==r||t[5]!==l||t[6]!==s?(c=()=>{o&&a(k.jsx(rd,{getCellsAsJSON:r,proposedName:l,closeModal:s}))},t[2]=o,t[3]=a,t[4]=r,t[5]=l,t[6]=s,t[7]=c):c=t[7];const d=c;let u;yi("global.save",d),t[8]===Symbol.for("react.memo_cache_sentinel")?(u=N("global.save"),t[8]=u):u=t[8];const h=o?"yellow":"gray";let m,f;return t[9]===Symbol.for("react.memo_cache_sentinel")?(m=k.jsx(Ic,{strokeWidth:1.5,size:18}),t[9]=m):m=t[9],t[10]!==d||t[11]!==h?(f=k.jsx(C,{content:u,children:k.jsx(bi,{onClick:d,id:"save-button","aria-label":"Save",className:"rectangle",color:h,children:m})}),t[10]=d,t[11]=h,t[12]=f):f=t[12],f},sd=()=>{const e=b(7),{selectedLayout:t}=Xi(),{setLayoutView:n}=Ki();if(D()&&!ki("wasm_layouts"))return null;let o,r,a,s;return e[0]!==n?(o=e=>n(e),e[0]=n,e[1]=o):o=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(r=k.jsx(z,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:k.jsx(B,{placeholder:"Select a view"})}),e[2]=r):r=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(a=k.jsx(R,{children:k.jsxs(P,{children:[k.jsx(F,{children:"View as"}),Ji.map(dd)]})}),e[3]=a):a=e[3],e[4]!==t||e[5]!==o?(s=k.jsxs(U,{"data-testid":"layout-select",value:t,onValueChange:o,children:[r,a]}),e[4]=t,e[5]=o,e[6]=s):s=e[6],s};function id(e){const t=ld(e);return k.jsx(t,{className:"h-4 w-4"})}function ld(e){switch(e){case"vertical":return hc;case"grid":return wi;case"slides":return Ec;default:return M(e),T}}function cd(e){return O(e)}function dd(e){return k.jsx(L,{value:e,children:k.jsxs("div",{className:"flex items-center gap-1.5 leading-5",children:[id(e),k.jsx("span",{children:cd(e)})]})},e)}function ud(){const e=b(7);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0];const[n,o]=function(e,t){const n=b(10);let o;n[0]!==e||n[1]!==t?(o=new V(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const a=o;let s;n[3]!==a?(s=()=>a.get(),n[3]=a,n[4]=s):s=n[4];const[i,l]=r.useState(s);let c;n[5]!==a?(c=e=>{l(e),a.set(e)},n[5]=a,n[6]=c):c=n[6];const d=c;let u;return n[7]!==i||n[8]!==d?(u=[i,d],n[7]=i,n[8]=d,n[9]=u):u=n[9],u}("marimo:commands",t);let a,s;return e[1]!==n||e[2]!==o?(a=e=>{const t=(r=[e,...n],[...new Set(r)]);var r;o(t.slice(0,3))},e[1]=n,e[2]=o,e[3]=a):a=e[3],e[4]!==n||e[5]!==a?(s={recentCommands:n,addRecentCommand:a},e[4]=n,e[5]=a,e[6]=s):s=e[6],s}function hd(e){return void 0!==e.dropdown}function md(e,t=""){return e.flatMap((e=>e.label?hd(e)?md(e.dropdown,`${t+e.label} > `):{...e,label:t+e.label}:[]))}const fd=e=>{const t=b(8),{children:n,layerTop:o}=e,r=void 0!==o&&o;let a;t[0]!==n?(a=u.Children.toArray(n),t[0]=n,t[1]=a):a=t[1];const[s,i]=a,l=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let c,d;return t[2]!==l||t[3]!==i?(c=k.jsx("div",{className:l,children:i}),t[2]=l,t[3]=i,t[4]=c):c=t[4],t[5]!==s||t[6]!==c?(d=k.jsxs("div",{className:"multi-icon relative w-fit",children:[s,c]}),t[5]=s,t[6]=c,t[7]=d):d=t[7],d};function pd(){const e=b(3),t=H(),{prepareForRun:n}=q();let o;e[0]!==t||e[1]!==n?(o=async e=>{if(0===e.length)return;const{cellHandles:o,cellData:r}=t,a=[];for(const t of e){const e=o[t];e.current?(a.push(X(e.current.editorView)),e.current.registerRun()):(n({cellId:t}),a.push(r[t].code))}await K({cellIds:e,codes:a}).catch((e=>{J.error(e)}))},e[0]=t,e[1]=n,e[2]=o):o=e[2];return W(o)}const gd=Z(null),vd=Z(!1),xd=e=>{const t=b(7);let n,o;t[0]!==e.onClick?(n=t=>{var n;(t.ctrlKey||t.metaKey)&&"z"===t.key&&(t.preventDefault(),t.stopPropagation(),null==(n=e.onClick)||n.call(e,t))},t[0]=e.onClick,t[1]=n):n=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(o={capture:!0},t[2]=o):o=t[2],Q(window,"keydown",n,o);const r=e.children??"Undo";let a,s;return t[3]===Symbol.for("react.memo_cache_sentinel")?(a=k.jsx(ee,{className:"ml-2",shortcut:"cmd-z"}),t[3]=a):a=t[3],t[4]!==e||t[5]!==r?(s=k.jsxs(E,{"data-testid":"undo-button",size:"sm",variant:"outline",...e,children:[r," ",a]}),t[4]=e,t[5]=r,t[6]=s):s=t[6],s};function yd(){const e=b(3),{deleteCell:t,undoDeleteCell:n}=q();let o;return e[0]!==t||e[1]!==n?(o=e=>{if(te.get(ne))return;const{cellId:o}=e;t({cellId:o}),oe({cellId:o}).catch((()=>{n()}));const{dismiss:r}=re({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:k.jsx(xd,{"data-testid":"undo-delete-button",onClick:()=>{n(),a()}})}),a=r},e[0]=t,e[1]=n,e[2]=o):o=e[2],W(o)}function bd(e,t,n,o=te){if(t in o.get(ae))return!1;const{cellData:r,cellIds:a}=o.get(se),s=new RegExp(`import[ \t]+${e}[ \t]+as[ \t]+${t}`,"g");for(const i of a.inOrderIds)if(s.test(r[i].code))return!1;return n(`import ${e} as ${t}`),!0}function wd(e,t,n){return bd("marimo","mo",(o=>{const r=ie.create();t({cellId:n??"__end__",before:!1,code:o,lastCodeRun:e?o:void 0,newCellId:r,autoFocus:!1}),e&&K({cellIds:[r],codes:[o]})}))}function kd(e){const t=b(52),{cell:n}=e,{createNewCell:o,updateCellConfig:r,updateCellCode:a,updateCellName:s,moveCell:i,sendToTop:l,sendToBottom:c,addColumnBreakpoint:d,clearCellOutput:u}=q(),h=function(e){const t=b(3),n=pd();let o;return t[0]!==e||t[1]!==n?(o=()=>{void 0!==e&&n([e])},t[0]=e,t[1]=n,t[2]=o):o=t[2],W(o)}(null==n?void 0:n.cellId),m=!le(ne),f=yd(),{openModal:p}=w(),g=ce(gd),v=le(de),x=le(ue),y=he(),N=le(me),C=le(fe);if(!n||N){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0],e}const{cellId:E,config:S,getEditorView:_,name:I,hasOutput:M,status:T}=n;let O;t[1]!==y.inOrderIds||t[2]!==E?(O=y.inOrderIds.indexOf(E),t[1]=y.inOrderIds,t[2]=E,t[3]=O):O=t[3];const D=O;let R;t[4]!==S.disabled||t[5]!==E||t[6]!==r?(R=async()=>{const e={disabled:!S.disabled};await _e({configs:{[E]:e}}),r({cellId:E,config:e})},t[4]=S.disabled,t[5]=E,t[6]=r,t[7]=R):R=t[7];const P=R;let F;t[8]!==S.hide_code||t[9]!==E||t[10]!==r||t[11]!==_?(F=async()=>{const e={hide_code:!S.hide_code};await _e({configs:{[E]:e}}),r({cellId:E,config:e});const t=_();t&&(e.hide_code?t.contentDOM.blur():t.focus())},t[8]=S.hide_code,t[9]=E,t[10]=r,t[11]=_,t[12]=F):F=t[12];const L=F;let z,B;t[13]===Symbol.for("react.memo_cache_sentinel")?(z=k.jsx(Vc,{size:13,strokeWidth:1.5}),t[13]=z):z=t[13],t[14]!==p||t[15]!==D||t[16]!==I||t[17]!==s||t[18]!==E?(B=()=>{p(k.jsxs(A,{children:[k.jsx(Ie,{children:k.jsx(j,{children:"Rename cell"})}),k.jsxs("div",{className:"flex items-center justify-between",children:[k.jsx(Ae,{htmlFor:"cell-name",children:"Cell name"}),k.jsx(Qi,{placeholder:`cell_${D}`,value:I,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),p(null))},onChange:e=>s({cellId:E,name:e})})]})]}))},t[14]=p,t[15]=D,t[16]=I,t[17]=s,t[18]=E,t[19]=B):B=t[19];const U=`cell_${D}`;let V,H,Y;if(t[20]!==s||t[21]!==E?(V=e=>s({cellId:E,name:e}),t[20]=s,t[21]=E,t[22]=V):V=t[22],t[23]!==U||t[24]!==I||t[25]!==V?(H=k.jsx(Qi,{placeholder:U,value:I,onChange:V}),t[23]=U,t[24]=I,t[25]=V,t[26]=H):H=t[26],t[27]!==B||t[28]!==H||t[29]!==T||t[30]!==S.disabled||t[31]!==S.hide_code||t[32]!==h||t[33]!==v||t[34]!==g||t[35]!==E||t[36]!==M||t[37]!==_||t[38]!==a||t[39]!==L||t[40]!==P||t[41]!==u||t[42]!==x||t[43]!==o||t[44]!==i||t[45]!==l||t[46]!==c||t[47]!==C||t[48]!==d||t[49]!==m||t[50]!==f){Y=[[{icon:z,label:"Name",disableClick:!0,handle:Sd,handleHeadless:B,rightElement:H},{icon:k.jsx(Cc,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:"running"===T||"queued"===T||"disabled-transitively"===T||S.disabled,handle:()=>h()},{icon:k.jsx(Oc,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!v,handle:()=>{g((e=>(null==e?void 0:e.cellId)===E?null:{cellId:E}))},hotkey:"cell.aiCompletion"},{icon:k.jsx(Zi,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!M,handle:()=>function(e){const t=document.getElementById(G.create(e));t&&(t.classList.add("printing-output"),$(t,"result.png").finally((()=>{t.classList.remove("printing-output")})))}(E)},{icon:k.jsx(pe,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const e=_();e&&ge({[E]:e},a)}},{icon:S.hide_code?k.jsx(ve,{size:13,strokeWidth:1.5}):k.jsx(xe,{size:13,strokeWidth:1.5}),label:S.hide_code?"Show code":"Hide code",handle:L,hotkey:"cell.hideCode"},{icon:S.disabled?k.jsx(Yc,{size:13,strokeWidth:1.5}):k.jsx(Xc,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:k.jsx(ye,{"data-testid":"cell-disable-switch",checked:!S.disabled,size:"sm",onCheckedChange:P}),handle:P},{icon:k.jsx(be,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!M,handle:()=>{u({cellId:E})}}],[{icon:k.jsx(Ni,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const e=_();e&&(wd(x,o),we(e,"markdown",{keepCodeAsIs:!0}))}},{icon:k.jsx(ke,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const e=_();e&&(wd(x,o),we(e,"sql",{keepCodeAsIs:!0}))}},{icon:k.jsx(Ci,{}),label:"Toggle as Python",handle:()=>{const e=_();e&&(wd(x,o),Ne(e,"python",{force:!0}))}}],[{icon:k.jsxs(fd,{children:[k.jsx(Hl,{size:13,strokeWidth:1.5}),k.jsx(Ce,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:E,before:!0})},{icon:k.jsxs(fd,{children:[k.jsx(Hl,{size:13,strokeWidth:1.5}),k.jsx(Ee,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:E,before:!1})},{icon:k.jsx(Ce,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>i({cellId:E,before:!0})},{icon:k.jsx(Ee,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>i({cellId:E,before:!1})},{icon:k.jsx(Gl,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>l({cellId:E})},{icon:k.jsx(Vl,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>c({cellId:E})},{icon:k.jsx(Se,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:"columns"!==C,handle:()=>d({cellId:E})}],[{label:"Delete",hidden:!m,variant:"danger",icon:k.jsx(je,{size:13,strokeWidth:1.5}),handle:()=>{f({cellId:E})}}]].map(Cd).filter(Nd),t[27]=B,t[28]=H,t[29]=T,t[30]=S.disabled,t[31]=S.hide_code,t[32]=h,t[33]=v,t[34]=g,t[35]=E,t[36]=M,t[37]=_,t[38]=a,t[39]=L,t[40]=P,t[41]=u,t[42]=x,t[43]=o,t[44]=i,t[45]=l,t[46]=c,t[47]=C,t[48]=d,t[49]=m,t[50]=f,t[51]=Y}else Y=t[51];return Y}function Nd(e){return e.length>0}function Cd(e){return e.filter(Ed)}function Ed(e){return!e.hidden}function Sd(e){null==e||e.stopPropagation(),null==e||e.preventDefault()}const jd=Z(null);function _d(){return le(jd)}const Id=Z((e=>{const t=e(jd);return t?t===Me?null:Ad(t,e(se)):null}));function Ad(e,t){var n;const{cellData:o,cellHandles:r,cellRuntime:a}=t,s=o[e],i=a[e],l=null==(n=r[e])?void 0:n.current;if(!s||!l)return null;return{cellId:e,name:s.name,config:s.config,status:i?i.status:"idle",getEditorView:()=>l.editorView,hasOutput:null!=(null==i?void 0:i.output)}}function Md(e){return!e.hidden}const Td=Z(!1),Od=()=>{const e=b(32),[t,n]=Fe(Td),o=Si(),r=le(Id),a=le(Le);let s;e[0]!==r?(s={cell:r},e[0]=r,e[1]=s):s=e[1];let i=kd(s).flat();i=md(i);const l=function(){const e=b(46),{theme:t}=Te(),[n,o]=Oe(),[r,a]=De();let s;e[0]!==o?(s=async e=>{await Re({config:e}).then((()=>{o(e)}))},e[0]=o,e[1]=s):s=e[1];const i=s;let l;e[2]!==a?(l=async e=>{await Pe({config:e}).then((()=>{a(e)}))},e[2]=a,e[3]=l):l=e[3];const c=l;let d,u;if(e[4]!==r||e[5]!==c){let t;e[7]!==r.width?(t=e=>e!==r.width,e[7]=r.width,e[8]=t):t=e[8],d=Ei().filter(t).map((e=>({label:`App config > Set width=${e}`,handle:()=>{c({...r,width:e})}}))),e[4]=r,e[5]=c,e[6]=d}else d=e[6];e[9]!==i||e[10]!==n||e[11]!==t?(u={label:"Config > Toggle dark mode",handle:()=>{i({...n,display:{...n.display,theme:"dark"===t?"light":"dark"}})}},e[9]=i,e[10]=n,e[11]=t,e[12]=u):u=e[12];const h="vim"===n.keymap.preset;let m,f;e[13]!==i||e[14]!==n?(m=()=>{i({...n,keymap:{...n.keymap,preset:"vim"}})},e[13]=i,e[14]=n,e[15]=m):m=e[15],e[16]!==h||e[17]!==m?(f={label:"Config > Switch keymap to VIM",hidden:h,handle:m},e[16]=h,e[17]=m,e[18]=f):f=e[18];const p="default"===n.keymap.preset;let g,v,x;e[19]!==i||e[20]!==n?(g=()=>{i({...n,keymap:{...n.keymap,preset:"default"}})},e[19]=i,e[20]=n,e[21]=g):g=e[21],e[22]!==p||e[23]!==g?(v={label:"Config > Switch keymap to default (current: VIM)",hidden:p,handle:g},e[22]=p,e[23]=g,e[24]=v):v=e[24],e[25]!==i||e[26]!==n?(x=()=>{i({...n,completion:{...n.completion,copilot:!1}})},e[25]=i,e[26]=n,e[27]=x):x=e[27];const y="github"!==n.completion.copilot;let w,k;e[28]!==x||e[29]!==y?(w={label:"Config > Disable GitHub Copilot",handle:x,hidden:y},e[28]=x,e[29]=y,e[30]=w):w=e[30],e[31]!==i||e[32]!==n?(k=()=>{i({...n,completion:{...n.completion,copilot:"github"}})},e[31]=i,e[32]=n,e[33]=k):k=e[33];const N="github"===n.completion.copilot;let C,E;e[34]!==k||e[35]!==N?(C={label:"Config > Enable GitHub Copilot",handle:k,hidden:N},e[34]=k,e[35]=N,e[36]=C):C=e[36],e[37]!==d||e[38]!==u||e[39]!==f||e[40]!==v||e[41]!==w||e[42]!==C?(E=[...d,u,f,v,w,C],e[37]=d,e[38]=u,e[39]=f,e[40]=v,e[41]=w,e[42]=C,e[43]=E):E=e[43];const S=E;let j;return e[44]!==S?(j=S.filter(Md),e[44]=S,e[45]=j):j=e[45],j}();let c=Kd();c=[...md(c),...md(l)];const d=c.filter(Dd),u=ze.keyBy(d,Rd),{recentCommands:h,addRecentCommand:m}=ud(),f=new Set(h);let p,g;e[2]!==a||e[3]!==n?(p=e=>{Ge(a.getHotkey("global.commandPalette").key)(e)&&(e.preventDefault(),n((e=>!e)))},e[2]=a,e[3]=n,e[4]=p):p=e[4],Q(document,"keydown",p),e[5]!==o||e[6]!==a||e[7]!==m||e[8]!==n?(g=(e,t)=>{const r=o[e];if(!r)return null;const s=a.getHotkey(e);return k.jsxs($e,{disabled:t.disabled,onSelect:()=>{m(e),n(!1),requestAnimationFrame((()=>{r()}))},value:s.name,children:[k.jsxs("span",{children:[s.name,t.tooltip&&k.jsx("span",{className:"ml-2",children:t.tooltip})]}),k.jsx(He,{children:k.jsx(We,{shortcut:s.key})})]},e)},e[5]=o,e[6]=a,e[7]=m,e[8]=n,e[9]=g):g=e[9];const v=g;let x;e[10]!==m||e[11]!==n||e[12]!==a?(x=(e,t,o,r)=>{const s=void 0===o?{}:o;return k.jsxs($e,{disabled:s.disabled,onSelect:()=>{m(e),n(!1),requestAnimationFrame((()=>{t()}))},value:e,children:[k.jsxs("span",{children:[e,s.tooltip&&k.jsxs("span",{className:"ml-2",children:["(",s.tooltip,")"]})]}),r&&k.jsx(He,{children:k.jsx(We,{shortcut:a.getHotkey(r).key})})]},e)},e[10]=m,e[11]=n,e[12]=a,e[13]=x):x=e[13];const y=x,w=qe;let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=k.jsx(Ye,{placeholder:"Type to search..."}),e[14]=N):N=e[14];const C=Xe;let E;e[15]===Symbol.for("react.memo_cache_sentinel")?(E=k.jsx(Ke,{children:"No results found."}),e[15]=E):E=e[15];const S=h.length>0&&k.jsxs(k.Fragment,{children:[k.jsx(Be,{heading:"Recently Used",children:h.map((e=>{const t=u[e];return Ue(e)?v(e,{disabled:null==t?void 0:t.disabled,tooltip:null==t?void 0:t.tooltip}):t&&!hd(t)?y(t.label,t.handleHeadless||t.handle,{disabled:t.disabled,tooltip:t.tooltip}):null}))}),k.jsx(Ve,{})]}),j=Be,_=a.iterate().map((e=>{if(f.has(e))return null;const t=u[e];return v(e,{disabled:null==t?void 0:t.disabled,tooltip:null==t?void 0:t.tooltip})})),I=d.map((e=>f.has(e.label)?null:y(e.label,e.handleHeadless||e.handle,{disabled:e.disabled,tooltip:e.tooltip}))),A=i.map((e=>f.has(e.label)?null:y(`Cell > ${e.label}`,e.handleHeadless||e.handle,{disabled:e.disabled,tooltip:e.tooltip})));let M,T,O;return e[16]!==j||e[17]!==_||e[18]!==I||e[19]!==A?(M=k.jsxs(j,{heading:"Commands",children:[_,I,A]}),e[16]=j,e[17]=_,e[18]=I,e[19]=A,e[20]=M):M=e[20],e[21]!==C||e[22]!==E||e[23]!==S||e[24]!==M?(T=k.jsxs(C,{children:[E,S,M]}),e[21]=C,e[22]=E,e[23]=S,e[24]=M,e[25]=T):T=e[25],e[26]!==w||e[27]!==t||e[28]!==n||e[29]!==N||e[30]!==T?(O=k.jsxs(w,{open:t,onOpenChange:n,children:[N,T]}),e[26]=w,e[27]=t,e[28]=n,e[29]=N,e[30]=T,e[31]=O):O=e[31],O};function Dd(e){return!e.hotkey}function Rd(e){return e.label}const Pd="https://static.marimo.app",Fd=({onClose:e})=>{const[t,n]=r.useState(""),o=`${t}-${r.useRef(Math.random().toString(36).slice(2,6)).current}`,a=`${Pd}/static/${o}`;return k.jsx(A,{className:"w-fit",children:k.jsxs("form",{onSubmit:async t=>{t.preventDefault(),e();const n=await Je({download:!1,includeCode:!0,files:el.INSTANCE.filenames()}),r=re({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Pd}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:n,path:o})}).catch((()=>{r.dismiss(),re({title:"Error uploading static page",description:k.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",k.jsx("a",{href:Ze.issuesPage,target:"_blank",rel:"noreferrer",className:"underline",children:"GitHub"}),"."]})})})),r.dismiss(),re({title:"Static page uploaded!",description:k.jsxs("div",{children:["The URL has been copied to your clipboard.",k.jsx("br",{}),"You can share it with anyone."]})})},children:[k.jsxs(Ie,{children:[k.jsx(j,{children:"Share static notebook"}),k.jsxs(_,{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"," ",k.jsx("a",{href:Pd,target:"_blank",rel:"noreferrer",children:Pd}),"."]})]}),k.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[k.jsx(Qe,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:t,placeholder:"Notebook slug",onChange:e=>{const t=e.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");n(t)},required:!0,autoComplete:"off"}),k.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:",k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx(Ld,{text:a}),k.jsx("span",{className:"text-primary",children:a})]})]})]}),k.jsxs(I,{children:[k.jsx(E,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:e,children:"Cancel"}),k.jsx(E,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await et(a)},children:"Create"})]})]})})},Ld=e=>{const t=b(8),[n,o]=u.useState(!1);let r;t[0]!==e.text?(r=tt.stopPropagation((async t=>{t.preventDefault(),await et(e.text),o(!0),setTimeout((()=>o(!1)),2e3)})),t[0]=e.text,t[1]=r):r=t[1];const a=r;let s,i,l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(s=k.jsx(nt,{size:14,strokeWidth:1.5}),t[2]=s):s=t[2],t[3]!==a?(i=k.jsx(E,{"data-testid":"copy-static-notebook-url-button",onClick:a,size:"xs",variant:"secondary",children:s}),t[3]=a,t[4]=i):i=t[4],t[5]!==n||t[6]!==i?(l=k.jsx(C,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=l):l=t[7],l};function zd(){const e=b(3),{openConfirm:t}=w(),n=ce(tl);let o;return e[0]!==t||e[1]!==n?(o=()=>{t({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:k.jsx(ot,{onClick:async()=>{n({state:nl.CLOSING}),await rt(),at()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=n,e[2]=o):o=e[2],o}const Bd=new st("marimo:sidebar",it.object({selectedPanel:it.string().optional().transform((e=>e)),isSidebarOpen:it.boolean(),isTerminalOpen:it.boolean()}),(function(){return{selectedPanel:"variables",isSidebarOpen:!1,isTerminalOpen:!1}}));const{reducer:Ud,createActions:Vd,valueAtom:Gd,useActions:$d}=lt((()=>Bd.get()),{openApplication:(e,t)=>({...e,selectedPanel:t,isSidebarOpen:!e.isSidebarOpen||e.selectedPanel!==t}),toggleSidebarPanel:e=>({...e,isSidebarOpen:!e.isSidebarOpen}),setIsSidebarOpen:(e,t)=>({...e,isSidebarOpen:t}),toggleTerminal:e=>({...e,isTerminalOpen:!e.isTerminalOpen}),setIsTerminalOpen:(e,t)=>({...e,isTerminalOpen:t})},[(e,t)=>Bd.set(t)]),Hd=()=>{const e=b(2),t=le(Gd);if(t.isSidebarOpen)return t;let n;return e[0]!==t?(n={...t,selectedPanel:void 0},e[0]=t,e[1]=n):n=e[1],n};function Wd(){return $d()}const qd=[{type:"files",Icon:rc,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:ct,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:ke,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:gc,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:Ul,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:Mc,tooltip:"View outline",position:"sidebar"},{type:"documentation",Icon:Gc,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:dt,tooltip:"Notebook logs",position:"sidebar"},{type:"snippets",Icon:Rc,tooltip:"Snippets",position:"sidebar"},{type:"scratchpad",Icon:vc,hidden:!ki("scratchpad"),tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:be,tooltip:"View errors",position:"footer"}];function Yd(){const e=b(2),t=ce(ut);let n;e[0]!==t?(n=()=>{const e=document.getElementsByClassName("output-area"),n=window.innerHeight||document.documentElement.clientHeight;let o;o=null;for(const t of Array.from(e)){const e=t.getBoundingClientRect();if(e.top>=0&&e.top<=n||e.bottom>=0&&e.bottom<=n){o=ht.parse(t.parentNode.id);break}}t((e=>({mode:mt(e.mode),cellAnchor:o}))),requestAnimationFrame((()=>{var e;null!==o&&(null==(e=document.getElementById(ht.create(o)))||e.scrollIntoView())}))},e[0]=t,e[1]=n):n=e[1];return n}const Xd=e=>{null==e||e.preventDefault(),null==e||e.stopPropagation()};function Kd(){const[e]=vt(),{openModal:t,closeModal:n}=w(),{openApplication:o}=Wd(),{selectedPanel:r}=Hd(),[a]=Fe(ut),s=le(me),i=H(),{updateCellConfig:l,undoDeleteCell:c,clearAllCellOutputs:d}=q(),u=zd(),h=function(e){const t=b(4),{openPrompt:n,closeModal:o}=w();let r;return t[0]!==e||t[1]!==n||t[2]!==o?(r=()=>{if(!e)return null;const t=ft.guessDeliminator(e),r=pt.basename(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${r}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:n=>{const r=t.join(pt.dirname(e),n);gt({source:e,destination:r}).then((()=>{o(),re({title:"Notebook copied",description:"A copy of the notebook has been created."}),window.open(`/?file=${r}`,"_blank")}))}})},t[0]=e,t[1]=n,t[2]=o,t[3]=r):r=t[3],r}(e),m=ce(Td),f=ce(ji),p=ce(_i),g=xt(i),v=yt(i),{selectedLayout:x}=Xi(),{setLayoutView:y}=Ki(),C=Yd();return[{icon:k.jsx(Tc,{size:14,strokeWidth:1.5}),label:"Share",handle:Xd,dropdown:[{icon:k.jsx(bt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",handle:async()=>{t(k.jsx(Fd,{onClose:n}))}},{icon:k.jsx(uc,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",handle:async()=>{const e=await wt(),t=kt({code:e.contents});await et(t),re({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:k.jsx(Nt,{size:14,strokeWidth:1.5}),label:"Download",handle:Xd,dropdown:[{icon:k.jsx(ol,{size:14,strokeWidth:1.5}),label:"Download as HTML",handle:async()=>{e?await rl({filename:e,includeCode:!0}):re({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:k.jsx(ol,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{e?await rl({filename:e,includeCode:!1}):re({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:k.jsx(Ni,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{const e=await Ct({download:!1});S(new Blob([e],{type:"text/plain"}),Et.toMarkdown(document.title))}},{icon:k.jsx(Xl,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{const e=await wt();S(new Blob([e.contents],{type:"text/plain"}),Et.toPY(document.title))}},{divider:!0,icon:k.jsx(Zi,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:"present"!==a.mode,tooltip:"present"===a.mode?void 0:k.jsxs("span",{children:["Only available in app view. ",k.jsx("br",{}),"Toggle with: ",N("global.hideCode",!1)]}),handle:async()=>{const e=document.getElementById("App");e&&await $(e,document.title)}},{icon:k.jsx(St,{size:14,strokeWidth:1.5}),label:"Download as PDF",disabled:"present"!==a.mode,tooltip:"present"===a.mode?void 0:k.jsxs("span",{children:["Only available in app view. ",k.jsx("br",{}),"Toggle with: ",N("global.hideCode",!1)]}),handle:async()=>{const e=new Event("export-beforeprint"),t=new Event("export-afterprint");window.dispatchEvent(e),setTimeout((()=>window.print()),0),setTimeout((()=>window.dispatchEvent(t)),0)}}]},{divider:!0,icon:k.jsx(wc,{size:14,strokeWidth:1.5}),label:"Helper panel",handle:Xd,dropdown:qd.flatMap((({type:e,Icon:t,hidden:n})=>{return n?[]:{label:O(e),rightElement:(a=r===e,k.jsx("div",{className:"w-8 flex justify-end",children:a&&k.jsx(_t,{size:14})})),icon:k.jsx(t,{size:14,strokeWidth:1.5}),handle:()=>o(e)};var a}))},{icon:k.jsx(Ec,{size:14,strokeWidth:1.5}),label:"Present as",handle:Xd,dropdown:[{icon:"present"===a.mode?k.jsx(jt,{size:14,strokeWidth:1.5}):k.jsx(dc,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{C()}},...Ji.map(((e,t)=>{const n=ld(e);return{divider:0===t,label:cd(e),icon:k.jsx(n,{size:14,strokeWidth:1.5}),rightElement:k.jsx("div",{className:"w-8 flex justify-end",children:x===e&&k.jsx(_t,{size:14})}),handle:()=>{y(e),"edit"===a.mode&&C()}}}))]},{icon:k.jsx(nc,{size:14,strokeWidth:1.5}),label:"Create notebook copy",hidden:!e||D(),handle:h},{icon:k.jsx(Wl,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:async()=>{const e=await wt();await et(e.contents),re({title:"Copied",description:"Code copied to clipboard."})}},{icon:k.jsx(Xc,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:0===g.length||s,handle:async()=>{const e=g.map((e=>e.id)),t=ze.fromEntries(e.map((e=>[e,{disabled:!1}])));await _e({configs:t});for(const n of e)l({cellId:n,config:{disabled:!1}})}},{icon:k.jsx(Yc,{size:14,strokeWidth:1.5}),label:"Disable all cells",hidden:0===v.length||s,handle:async()=>{const e=v.map((e=>e.id)),t=ze.fromEntries(e.map((e=>[e,{disabled:!0}])));await _e({configs:t});for(const n of e)l({cellId:n,config:{disabled:!0}})}},{icon:k.jsx(be,{size:14,strokeWidth:1.5}),label:"Clear all outputs",handle:()=>{d()}},{icon:k.jsx($c,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!It(i)||s,handle:()=>{c()}},{divider:!0,icon:k.jsx(Kl,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>m((e=>!e))},{icon:k.jsx(At,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>f((e=>!e))},{icon:k.jsx(cc,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>p((e=>!e))},{icon:k.jsx(Bl,{size:14,strokeWidth:1.5}),label:"Open documentation",handle:()=>{window.open("https://docs.marimo.io","_blank")}},{divider:!0,icon:k.jsx(lc,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:()=>{window.location.href=document.baseURI}},{icon:k.jsx(Bc,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:u}].filter((e=>!e.hidden))}const Jd=()=>{const e=b(10),t=Kd();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=k.jsx(bi,{"aria-label":"Config",shape:"circle",size:"small",className:"h-[27px] w-[27px]","data-testid":"notebook-menu-dropdown",color:"hint-green",children:k.jsx(al,{strokeWidth:1.8})}),e[0]=n):n=e[0];const o=n,r=Zd;let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a=e=>{const t=k.jsx(Tt,{variant:e.variant,disabled:e.disabled,onSelect:t=>e.handle(t),"data-testid":`notebook-menu-dropdown-${e.label}`,children:r(e)},e.label);return e.tooltip?k.jsx(C,{content:e.tooltip,side:"left",delayDuration:100,children:k.jsx("span",{children:t})},e.label):t},e[1]=a):a=e[1];const s=a;let i,l,c,d,h;if(e[2]===Symbol.for("react.memo_cache_sentinel")?(i=k.jsx(Ot,{asChild:!0,children:o}),e[2]=i):i=e[2],e[3]!==t){let n;e[5]===Symbol.for("react.memo_cache_sentinel")?(n=e=>e.hidden?null:e.dropdown?k.jsxs(Dt,{children:[k.jsx(Rt,{"data-testid":`notebook-menu-dropdown-${e.label}`,children:r(e)}),k.jsx(Pt,{children:k.jsx(Ft,{children:e.dropdown.map((e=>k.jsxs(u.Fragment,{children:[e.divider&&k.jsx(Lt,{}),s(e)]},e.label)))})})]},e.label):k.jsxs(u.Fragment,{children:[e.divider&&k.jsx(Lt,{}),s(e)]},e.label),e[5]=n):n=e[5],l=t.map(n),e[3]=t,e[4]=l}else l=e[4];return e[6]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx(Lt,{}),e[6]=c):c=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(d=k.jsx("div",{className:"flex-1 px-2 text-xs text-muted-foreground",children:k.jsxs("span",{children:["Version: ",Mt()]})}),e[7]=d):d=e[7],e[8]!==l?(h=k.jsxs(zt,{modal:!1,children:[i,k.jsxs(Bt,{align:"end",className:"no-print w-[240px]",children:[l,c,d]})]}),e[8]=l,e[9]=h):h=e[9],h};function Zd(e){return k.jsxs(k.Fragment,{children:[e.icon&&k.jsx("span",{className:"flex-0 mr-2",children:e.icon}),k.jsx("span",{className:"flex-1",children:e.labelElement||e.label}),e.hotkey&&k.jsx(Ut,{shortcut:e.hotkey,className:"ml-4"}),e.rightElement]})}const Qd=Vt({findText:"",replaceText:"",caseSensitive:!1,wholeWord:!1,regexp:!1,isOpen:!1,currentView:void 0},((e,t)=>{if(void 0===t)return e;switch(t.type){case"setFind":return{...e,findText:t.find};case"setReplace":return{...e,replaceText:t.replace};case"setCaseSensitive":return{...e,caseSensitive:t.caseSensitive};case"setWholeWord":return{...e,wholeWord:t.wholeWord};case"setRegex":return{...e,regexp:t.regexp};case"setIsOpen":return{...e,isOpen:t.isOpen};case"setCurrentView":return{...e,currentView:{view:t.view,range:t.range}};case"clearCurrentView":return{...e,currentView:void 0}}}));function eu(e){if([...document.querySelectorAll('[role="dialog"][data-state="open"]')].some((e=>e instanceof HTMLElement&&e.childNodes.length>0)))return!1;if(e){const t=e.state.selection.main,n=e.state.sliceDoc(t.from,t.to);n?(te.set(Qd,{type:"setFind",find:n}),te.set(Qd,{type:"setCurrentView",view:e,range:{from:t.from,to:t.to}})):te.set(Qd,{type:"setCurrentView",view:e,range:{from:0,to:0}})}return te.get(Qd).isOpen?(te.set(Qd,{type:"setIsOpen",isOpen:!1}),requestAnimationFrame((()=>{te.set(Qd,{type:"setIsOpen",isOpen:!0})})),!0):(te.set(Qd,{type:"setIsOpen",isOpen:!0}),!0)}function tu(){return!!te.get(Qd).isOpen&&(te.set(Qd,{type:"setIsOpen",isOpen:!1}),!0)}function nu(e){return Gt("create"in e,'Expected query to have a "create" method'),e}function ou(e){return()=>{const t=te.get(Qd),n=new $t({search:t.findText,caseSensitive:t.caseSensitive,regexp:t.regexp,replace:t.replaceText,wholeWord:t.wholeWord});return!!n.valid&&e({query:nu(n).create(),search:n})}}const ru=e=>ou((({query:t})=>{const n=Ht(),o=te.get(Qd).currentView||{view:n[0],range:{from:0,to:0}};let r=o.range.to;"prev"===e&&(n.reverse(),r=o.range.from);let a=n.indexOf(o.view);a<0&&(a=0);const s=[...n,...n].slice(a);for(const i of s){const n="next"===e?t.nextMatch(i.state,0,r??0):t.prevMatch(i.state,r??i.state.doc.length,i.state.doc.length);if(!n){r=null,i.dispatch({selection:Wt.single(0)});continue}const o=Wt.single(n.from,n.to);return i.dispatch({selection:o,effects:[qt.scrollIntoView(o.main,{y:"center"})],userEvent:"select.search"}),te.set(Qd,{type:"setCurrentView",view:i,range:{from:n.from,to:n.to}}),n}return!1})),au=ru("next"),su=ru("prev"),iu=ou((({query:e})=>{var t;const n=Ht(),o=[];for(const r of n){if(r.state.readOnly)continue;const n=null==(t=e.matchAll(r.state,1e9))?void 0:t.map((t=>{const{from:n,to:o}=t;return{from:n,to:o,insert:e.getReplacement(t)}}));if(!n||0===n.length)continue;const a=r.state.doc.toString();o.push((()=>{r.dispatch({changes:[{from:0,to:r.state.doc.length,insert:a}],userEvent:"input.replace.all"})})),r.dispatch({changes:n,userEvent:"input.replace.all"})}return()=>{for(const e of o)e()}})),lu=ou((({query:e})=>{const t=Ht(),n=te.get(Qd).currentView||{view:t[0],range:{from:0,to:0}};let o=n.range.from,r=t.indexOf(n.view);r<0&&(r=0);const a=[...t,...t].slice(r);for(const s of a){const t=e.nextMatch(s.state,0,o??0);if(!t){o=null,s.dispatch({selection:Wt.single(0)});continue}const n=s.state.toText(e.getReplacement(t));return s.dispatch({changes:[{from:t.from,to:t.to,insert:n}],userEvent:"input.replace"}),au()}return!1})),cu=ou((({query:e})=>{const t=Ht();let n=0;const o=new Map;for(const r of t){const t=e.matchAll(r.state,1e9)||[];for(const e of t){const{from:t,to:a}=e,s=o.get(r)||new Map;s.set(`${t}:${a}`,n++),o.set(r,s)}}return{count:n,position:o}})),du=Yt.define();function uu(){const e=Ht();for(const t of e)t.state.readOnly||t.dispatch({effects:du.of(new $t({search:""}))})}const hu=Xt.define({create(){const e=te.get(Qd);return nu(new $t({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord})).create()},update(e,t){for(const n of t.effects)n.is(du)&&(e=nu(n.value).create());return e}}),mu=Kt.mark({class:"cm-searchMatch"}),fu=Kt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),pu=Jt.fromClass(class{constructor(e){this.view=e,this.decorations=void 0,this.decorations=this.highlight(e.state.field(hu))}update(e){const t=e.state.field(hu);(t!==e.startState.field(hu)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight(e){if(!e.spec.valid)return Kt.none;const{view:t}=this,n=new Zt,o=t.visibleRanges,r=o.length;for(let a=0;a<r;a++){let{to:s}=o[a];const{from:i}=o[a];for(;a<r-1&&s>o[a+1].from-500;)s=o[++a].to;e.highlight(t.state,i,s,((e,o)=>{const r=t.state.selection.ranges.some((t=>t.from===e&&t.to===o));n.add(e,o,r?fu:mu)}))}return n.finish()}},{decorations:e=>e.decorations}),gu=qt.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"}}),vu=()=>{var e;const t=b(99),[n,o]=r.useState(!1),[a,s]=Fe(Qd),[i,l]=r.useState(),c=r.useRef(null),d=le(Le);let u,h,m,f,p;if(t[0]!==n||t[1]!==a.isOpen?(u=()=>(!n||!a.isOpen)&&eu(),t[0]=n,t[1]=a.isOpen,t[2]=u):u=t[2],yi("cell.findAndReplace",u),t[3]!==a.isOpen?(h=()=>{a.isOpen&&c.current&&(c.current.focus(),c.current.select())},m=[a.isOpen],t[3]=a.isOpen,t[4]=h,t[5]=m):(h=t[4],m=t[5]),r.useEffect(h,m),t[6]!==a.isOpen||t[7]!==a.findText?(f=()=>{if(!a.isOpen)return void uu();if(""===a.findText)return l(void 0),void uu();const e=cu();l(!1===e?void 0:e),function(){const e=te.get(Qd),t=Ht();for(const n of t)n.state.readOnly||n.dispatch({effects:du.of(new $t({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord}))})}()},t[6]=a.isOpen,t[7]=a.findText,t[8]=f):f=t[8],t[9]!==a.findText||t[10]!==a.isOpen||t[11]!==a.caseSensitive||t[12]!==a.regexp||t[13]!==a.wholeWord?(p=[a.findText,a.isOpen,a.caseSensitive,a.regexp,a.wholeWord],t[9]=a.findText,t[10]=a.isOpen,t[11]=a.caseSensitive,t[12]=a.regexp,t[13]=a.wholeWord,t[14]=p):p=t[14],r.useEffect(f,p),!a.isOpen)return null;const g=a.currentView;let v;t[15]!==g||t[16]!==i?(v=g&&i?null==(e=i.position.get(g.view))?void 0:e.get(`${g.range.from}:${g.range.to}`):void 0,t[15]=g,t[16]=i,t[17]=v):v=t[17];const x=v;let y,w,N,S,j,_,I,A,M,T,O;t[18]===Symbol.for("react.memo_cache_sentinel")?(y=()=>o(!0),t[18]=y):y=t[18],t[19]===Symbol.for("react.memo_cache_sentinel")?(w=()=>o(!1),t[19]=w):w=t[19],t[20]!==s?(N=e=>{"Escape"===e.key&&s({type:"setIsOpen",isOpen:!1})},t[20]=s,t[21]=N):N=t[21],t[22]!==s?(S=()=>s({type:"setIsOpen",isOpen:!1}),t[22]=s,t[23]=S):S=t[23],t[24]===Symbol.for("react.memo_cache_sentinel")?(j=k.jsx(en,{className:"w-4 h-4"}),t[24]=j):j=t[24],t[25]!==S?(_=k.jsx("div",{className:"absolute top-0 right-0",children:k.jsx(E,{"data-testid":"close-find-replace-button",onClick:S,size:"xs",variant:"text",children:j})}),t[25]=S,t[26]=_):_=t[26],t[27]!==s?(I=e=>{s({type:"setFind",find:e.target.value})},t[27]=s,t[28]=I):I=t[28],t[29]!==a.findText||t[30]!==I?(A=k.jsx(Qe,{ref:c,"data-testid":"find-input",value:a.findText,autoFocus:!0,className:"mr-2 mb-0",placeholder:"Find",onKeyDown:yu,onChange:I}),t[29]=a.findText,t[30]=I,t[31]=A):A=t[31],t[32]!==s?(M=e=>{s({type:"setReplace",replace:e.target.value})},t[32]=s,t[33]=M):M=t[33],t[34]!==a.replaceText||t[35]!==M?(T=k.jsx(Qe,{"data-testid":"replace-input",value:a.replaceText,placeholder:"Replace",onChange:M}),t[34]=a.replaceText,t[35]=M,t[36]=T):T=t[36],t[37]!==A||t[38]!==T?(O=k.jsxs("div",{className:"flex flex-col flex-2 gap-2 w-[55%]",children:[A,T]}),t[37]=A,t[38]=T,t[39]=O):O=t[39];const D=a.caseSensitive?"on":"off";let R,P,F;t[40]!==s?(R=e=>s({type:"setCaseSensitive",caseSensitive:e}),t[40]=s,t[41]=R):R=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(P=k.jsx(tn,{className:"w-4 h-4"}),t[42]=P):P=t[42],t[43]!==a.caseSensitive||t[44]!==D||t[45]!==R?(F=k.jsx(C,{content:"Case Sensitive",children:k.jsx(Qt,{size:"sm",pressed:a.caseSensitive,"data-state":D,onPressedChange:R,children:P})}),t[43]=a.caseSensitive,t[44]=D,t[45]=R,t[46]=F):F=t[46];const L=a.wholeWord?"on":"off";let z,B,U;t[47]!==s?(z=e=>s({type:"setWholeWord",wholeWord:e}),t[47]=s,t[48]=z):z=t[48],t[49]===Symbol.for("react.memo_cache_sentinel")?(B=k.jsx(Wc,{className:"w-4 h-4"}),t[49]=B):B=t[49],t[50]!==a.wholeWord||t[51]!==L||t[52]!==z?(U=k.jsx(C,{content:"Match Whole Word",children:k.jsx(Qt,{size:"sm",pressed:a.wholeWord,"data-state":L,onPressedChange:z,children:B})}),t[50]=a.wholeWord,t[51]=L,t[52]=z,t[53]=U):U=t[53];const V=a.regexp?"on":"off";let G,$,H,W;t[54]!==s?(G=e=>s({type:"setRegex",regexp:e}),t[54]=s,t[55]=G):G=t[55],t[56]===Symbol.for("react.memo_cache_sentinel")?($=k.jsx(Sc,{className:"w-4 h-4"}),t[56]=$):$=t[56],t[57]!==a.regexp||t[58]!==V||t[59]!==G?(H=k.jsx(C,{content:"Use Regular Expression",children:k.jsx(Qt,{size:"sm",pressed:a.regexp,"data-state":V,onPressedChange:G,children:$})}),t[57]=a.regexp,t[58]=V,t[59]=G,t[60]=H):H=t[60],t[61]!==F||t[62]!==U||t[63]!==H?(W=k.jsxs("div",{className:"flex items-center gap-[2px]",children:[F,U,H]}),t[61]=F,t[62]=U,t[63]=H,t[64]=W):W=t[64];const q=""===a.findText||""===a.replaceText;let Y;t[65]!==q?(Y=k.jsx(E,{"data-testid":"replace-next-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:bu,disabled:q,children:"Replace Next"}),t[65]=q,t[66]=Y):Y=t[66];const X=""===a.findText||""===a.replaceText;let K,J,Z,Q,ee,ne,oe,re,ae,se,ie,ce;return t[67]!==X?(K=k.jsx(E,{"data-testid":"replace-all-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:wu,disabled:X,children:"Replace All"}),t[67]=X,t[68]=K):K=t[68],t[69]!==Y||t[70]!==K?(J=k.jsxs("div",{className:"flex items-center gap-[2px]",children:[Y,K]}),t[69]=Y,t[70]=K,t[71]=J):J=t[71],t[72]!==W||t[73]!==J?(Z=k.jsxs("div",{className:"flex flex-col gap-2",children:[W,J]}),t[72]=W,t[73]=J,t[74]=Z):Z=t[74],t[75]!==O||t[76]!==Z?(Q=k.jsxs("div",{className:"flex items-center gap-3",children:[O,Z]}),t[75]=O,t[76]=Z,t[77]=Q):Q=t[77],t[78]===Symbol.for("react.memo_cache_sentinel")?(ee=k.jsx(C,{content:"Find Previous",children:k.jsx(E,{"data-testid":"find-prev-button",size:"xs",variant:"secondary",onClick:ku,children:k.jsx(Dl,{className:"w-4 h-4"})})}),t[78]=ee):ee=t[78],t[79]===Symbol.for("react.memo_cache_sentinel")?(ne=k.jsx(C,{content:"Find Next",children:k.jsx(E,{"data-testid":"find-next-button",size:"xs",variant:"secondary",onClick:Nu,children:k.jsx(Fl,{className:"w-4 h-4"})})}),t[79]=ne):ne=t[79],t[80]!==i||t[81]!==x?(oe=null!=i&&null==x&&k.jsxs("span",{className:"text-sm",children:[i.count," matches"]}),t[80]=i,t[81]=x,t[82]=oe):oe=t[82],t[83]!==i||t[84]!==x?(re=null!=i&&null!=x&&k.jsxs("span",{className:"text-sm",children:[x+1," of ",i.count]}),t[83]=i,t[84]=x,t[85]=re):re=t[85],t[86]!==oe||t[87]!==re?(ae=k.jsxs("div",{className:"flex items-center gap-2",children:[ee,ne,oe,re]}),t[86]=oe,t[87]=re,t[88]=ae):ae=t[88],t[89]!==d?(se=d.getHotkey("cell.findAndReplace"),t[89]=d,t[90]=se):se=t[90],t[91]!==se.key?(ie=k.jsxs("div",{className:"text-xs text-muted-foreground flex gap-1 mt-2",children:["Press"," ",k.jsx(We,{shortcut:se.key})," ","again to open the native browser search."]}),t[91]=se.key,t[92]=ie):ie=t[92],t[93]!==N||t[94]!==_||t[95]!==Q||t[96]!==ae||t[97]!==ie?(ce=k.jsx(nn,{restoreFocus:!0,autoFocus:!0,children:k.jsxs("div",{onFocus:y,onClick:xu,onBlur:w,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:N,children:[_,Q,ae,ie]})}),t[93]=N,t[94]=_,t[95]=Q,t[96]=ae,t[97]=ie,t[98]=ce):ce=t[98],ce};function xu(e){e.stopPropagation(),e.preventDefault()}function yu(e){"Enter"===e.key&&(e.shiftKey?su():au())}function bu(){return lu()}function wu(){const e=iu();if(!e)return;const{dismiss:t}=re({title:"Replaced all occurrences",action:k.jsx(xd,{"data-testid":"undo-replace-all-button",onClick:()=>{e(),n()}})}),n=t}function ku(){return su()}function Nu(){return au()}function Cu(e){const t=b(3),[n,o]=r.useState(!1);let a,s;return t[0]!==e?(a=()=>{if(!e)return;o(!1);const t=setTimeout((()=>{o(!0)}),200);return()=>clearTimeout(t)},s=[e],t[0]=e,t[1]=a,t[2]=s):(a=t[1],s=t[2]),r.useEffect(a,s),e&&n}const Eu=()=>{const e=b(6),t=ce(Td);let n;e[0]!==t?(n=()=>t((e=>!e)),e[0]=t,e[1]=n):n=e[1];const o=n;let r,a,s;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=N("global.commandPalette"),e[2]=r):r=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(a=k.jsx(Kl,{strokeWidth:1.5,size:18}),e[3]=a):a=e[3],e[4]!==o?(s=k.jsx(C,{content:r,children:k.jsx(bi,{"data-testid":"command-palette-button",onClick:o,shape:"rectangle",color:"hint-green",children:a})}),e[4]=o,e[5]=s):s=e[5],s},Su=e=>{const{children:t}=e;return le(me)?null:t},ju=e=>{const{children:t}=e;return le(me)?t:null},_u=e=>{const t=b(48),{filename:n,needsSave:o,onSaveNotebook:r,getCellsAsJSON:a,presenting:s,onTogglePresenting:i,onInterrupt:l,onRun:c,closed:d,running:u,needsRun:h,undoAvailable:m,appWidth:f}=e,{undoDeleteCell:p}=q();let g;t[0]!==r?(g=e=>{e.preventDefault(),e.stopPropagation(),r()},t[0]=r,t[1]=g):g=t[1];const v=g;let x,y,w=null;if(!d&&m){let e,n;t[2]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx($c,{size:16,strokeWidth:1.5}),t[2]=e):e=t[2],t[3]!==p?(n=k.jsx(C,{content:"Undo cell deletion",children:k.jsx(bi,{"data-testid":"undo-delete-cell",size:"medium",color:"hint-green",shape:"circle",onClick:p,children:e})}),t[3]=p,t[4]=n):n=t[4],w=n}t[5]!==s?(x=!s&&k.jsx(vu,{}),t[5]=s,t[6]=x):x=t[6],t[7]!==d||t[8]!==s?(y=!d&&k.jsxs("div",{className:Mu,children:[s&&k.jsx(sd,{}),k.jsx(Jd,{}),k.jsx(Ii,{}),k.jsx(Ai,{description:"This will terminate the Python kernel. You'll lose all data that's in memory."})]}),t[7]=d,t[8]=s,t[9]=y):y=t[9];const E="compact"===f&&"xl:flex-row items-end";let S,j,_,I,A,M,T,O,D,R,P,F,L;return t[10]!==E?(S=on(Tu,E),t[10]=E,t[11]=S):S=t[11],t[12]!==d||t[13]!==n||t[14]!==a||t[15]!==o||t[16]!==v?(j=k.jsx(Su,{children:d?k.jsx(ad,{filename:n,getCellsAsJSON:a,needsSave:o}):k.jsx(C,{content:N("global.save"),children:k.jsx(bi,{"data-testid":"save-button",id:"save-button",shape:"rectangle",color:o?"yellow":"hint-green",onClick:v,children:k.jsx(Ic,{strokeWidth:1.5,size:18})})})}),t[12]=d,t[13]=n,t[14]=a,t[15]=o,t[16]=v,t[17]=j):j=t[17],t[18]===Symbol.for("react.memo_cache_sentinel")?(_=N("global.hideCode"),t[18]=_):_=t[18],t[19]!==s?(I=s?k.jsx(jt,{strokeWidth:1.5,size:18}):k.jsx(dc,{strokeWidth:1.5,size:18}),t[19]=s,t[20]=I):I=t[20],t[21]!==i||t[22]!==I?(A=k.jsx(C,{content:_,children:k.jsx(bi,{"data-testid":"hide-code-button",id:"preview-button",shape:"rectangle",color:"hint-green",onClick:i,children:I})}),t[21]=i,t[22]=I,t[23]=A):A=t[23],t[24]===Symbol.for("react.memo_cache_sentinel")?(M=k.jsx(Eu,{}),T=k.jsx(Mi,{}),O=k.jsx("div",{}),t[24]=M,t[25]=T,t[26]=O):(M=t[24],T=t[25],O=t[26]),t[27]!==d||t[28]!==u||t[29]!==l?(D=!d&&k.jsx(Au,{running:u,onInterrupt:l}),t[27]=d,t[28]=u,t[29]=l,t[30]=D):D=t[30],t[31]!==d||t[32]!==h||t[33]!==c?(R=!d&&k.jsx(Iu,{needsRun:h,onRun:c}),t[31]=d,t[32]=h,t[33]=c,t[34]=R):R=t[34],t[35]!==w||t[36]!==D||t[37]!==R?(P=k.jsx(Su,{children:k.jsxs("div",{className:"flex flex-col gap-2 items-center",children:[w,D,R]})}),t[35]=w,t[36]=D,t[37]=R,t[38]=P):P=t[38],t[39]!==S||t[40]!==j||t[41]!==A||t[42]!==P?(F=k.jsxs("div",{className:S,children:[j,A,M,T,O,P]}),t[39]=S,t[40]=j,t[41]=A,t[42]=P,t[43]=F):F=t[43],t[44]!==x||t[45]!==y||t[46]!==F?(L=k.jsxs(k.Fragment,{children:[x,y,F]}),t[44]=x,t[45]=y,t[46]=F,t[47]=L):L=t[47],L},Iu=e=>{const t=b(5),{needsRun:n,onRun:o}=e;if(n){let e,n,r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=N("global.runStale"),t[0]=e):e=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(n=k.jsx(Cc,{strokeWidth:1.5,size:16}),t[1]=n):n=t[1],t[2]!==o?(r=k.jsx(C,{content:e,children:k.jsx(bi,{"data-testid":"run-button",size:"medium",color:"yellow",shape:"circle",onClick:o,children:n})}),t[2]=o,t[3]=r):r=t[3],r}let r;return t[4]===Symbol.for("react.memo_cache_sentinel")?(r=k.jsx(C,{content:"Nothing to run",children:k.jsx(bi,{"data-testid":"run-button",className:"inactive-button",color:"disabled",size:"medium",shape:"circle",children:k.jsx(Cc,{strokeWidth:1.5,size:16})})}),t[4]=r):r=t[4],r},Au=e=>{const t=b(8),{running:n,onInterrupt:o}=e,r=Cu(n);let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=N("global.interrupt"),t[0]=a):a=t[0];const s=!r&&"inactive-button active:shadow-xsSolid";let i;t[1]!==s?(i=on(s),t[1]=s,t[2]=i):i=t[2];const l=r?"yellow":"disabled",c=r?o:rn.NOOP;let d,u;return t[3]===Symbol.for("react.memo_cache_sentinel")?(d=k.jsx(T,{strokeWidth:1.5,size:16}),t[3]=d):d=t[3],t[4]!==i||t[5]!==l||t[6]!==c?(u=k.jsx(C,{content:a,children:k.jsx(bi,{className:i,"data-testid":"interrupt-button",size:"medium",color:l,shape:"circle",onClick:c,children:d})}),t[4]=i,t[5]=l,t[6]=c,t[7]=u):u=t[7],u},Mu="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",Tu="absolute bottom-5 right-5 flex flex-col gap-2 items-center no-print pointer-events-auto z-30 print:hidden",Ou=e=>{const t=b(35),{resetOnBlur:n,placeholderText:o,initialValue:a,flexibleWidth:s,onNameChange:i,className:l}=e,c=void 0!==n&&n,d=void 0===a?null:a,u=void 0!==s&&s,[h,m]=r.useState(d);let f;t[0]===Symbol.for("react.memo_cache_sentinel")?(f=[],t[0]=f):f=t[0];const[p,g]=r.useState(f),[v,x]=r.useState(!1),y=r.useRef(null),w=r.useRef(!1);let N,C,E;t[1]!==d?(N=()=>{m(d)},C=[d],t[1]=d,t[2]=N,t[3]=C):(N=t[2],C=t[3]),r.useEffect(N,C),t[4]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{x(!0)},t[4]=E):E=t[4];const S=E;let j;t[5]!==c||t[6]!==d?(j=e=>{var t;(null==(t=e.relatedTarget)?void 0:t.closest(".filename-input"))||(x(!1),c&&m(d))},t[5]=c,t[6]=d,t[7]=j):j=t[7];const _=j;let I;t[8]!==h?(I=pt.dirname(h||""),t[8]=h,t[9]=I):I=t[9];const A=I,M=pt.basename(h||""),T=p.filter((e=>pt.basename(e.path).startsWith(M)));let O,D;t[10]!==v||t[11]!==A?(O=async()=>{if(!v)return void g([]);const e=await ln({path:A});g(e.files)},D=[A,v],t[10]=v,t[11]=A,t[12]=O,t[13]=D):(O=t[12],D=t[13]);const{loading:R}=an(O,D),P=function(e,t,n){if(!e)return;if(e.endsWith("/"))return;(ki("markdown")?new Set(["py","md","markdown","qmd"]):new Set(["py"])).has(pt.extension(e))||(e=e.endsWith(".")?`${e}py`:e.endsWith(".p")?`${e}y`:`${e}.py`);if(t.some((t=>t.path===e||pt.basename(t.path)===e)))return;if(n&&(n===e||pt.basename(n)===e))return;return e}(h,p,d),F=(P||T.length>0)&&k.jsxs(Xe,{className:"font-mono",children:[!R&&k.jsx(Ke,{children:"No files"}),P&&k.jsxs($e,{variant:"success",className:"py-2 px-3",onSelect:()=>{var e;P&&(w.current=!0,i(P),null==(e=y.current)||e.blur())},children:[k.jsx(ec,{className:"w-4 h-4 mr-2"})," ",k.jsxs("span",{className:"text-sm",children:[d?"Rename to: ":"Save as: ",k.jsx("span",{className:"font-medium text-sm",children:pt.basename(P)})]})]},"_rename_"),T.map((e=>{const t=e.isDirectory?"directory":sn(e.path),n=cn[t];return k.jsxs($e,{variant:e.isDirectory?"default":"muted",className:"py-2 px-3",onSelect:()=>{e.isDirectory?m(`${e.path}/`):m(e.path)},children:[k.jsx(n,{className:"w-4 h-4 mr-2"})," ",pt.basename(e.path)]},e.path)}))]}),L=10*Math.max(20,(null==h?void 0:h.length)||(null==o?void 0:o.length)||0),z=v?h||"":d||"";let B,U,V;t[14]!==u||t[15]!==L?(B=u?{maxWidth:L}:void 0,t[14]=u,t[15]=L,t[16]=B):B=t[16],t[17]!==l?(U=on(l,"w-full px-4 py-1 my-1 h-9 font-mono text-foreground/60"),t[17]=l,t[18]=U):U=t[18],t[19]!==z||t[20]!==o||t[21]!==B||t[22]!==U?(V=k.jsx(dn,{children:k.jsx(Ye,{"data-testid":"dir-completion-input",tabIndex:-1,rootClassName:"border-none justify-center px-1",spellCheck:"false",value:z,onKeyDown:Du,icon:null,ref:y,onValueChange:m,placeholder:o,autoComplete:"off",style:B,className:U})}),t[19]=z,t[20]=o,t[21]=B,t[22]=U,t[23]=V):V=t[23];const G=F&&"group-focus-within:block";let $,H,W,q;return t[24]!==G?($=on("p-0 w-full min-w-80 max-w-80vw hidden",G),t[24]=G,t[25]=$):$=t[25],t[26]!==$||t[27]!==F?(H=k.jsx(un,{side:"bottom",className:$,portal:!1,children:F}),t[26]=$,t[27]=F,t[28]=H):H=t[28],t[29]!==V||t[30]!==H?(W=k.jsxs(Xe,{children:[V,H]}),t[29]=V,t[30]=H,t[31]=W):W=t[31],t[32]!==_||t[33]!==W?(q=k.jsx(hn,{open:!0,modal:!1,children:k.jsx(mn,{onFocus:S,onBlur:_,shouldFilter:!1,className:"bg-transparent group filename-input",children:W})}),t[32]=_,t[33]=W,t[34]=q):q=t[34],q};function Du(e){"Escape"===e.key&&e.currentTarget.blur()}const Ru=e=>{const t=b(7),{filename:n,setFilename:o}=e;let r;t[0]!==n?(r=n?pt.basename(n):"untitled marimo app",t[0]=n,t[1]=r):r=t[1];const a=null===n?"missing-filename":"filename";let s;return t[2]!==r||t[3]!==n||t[4]!==o||t[5]!==a?(s=k.jsx(Ou,{placeholderText:r,initialValue:n,onNameChange:o,flexibleWidth:!0,resetOnBlur:!0,"data-testid":"filename-input",className:a}),t[2]=r,t[3]=n,t[4]=o,t[5]=a,t[6]=s):s=t[6],s};function Pu(e){return[fn.of([{key:"Escape",preventDefault:!1,run:tu},{key:e.getHotkey("cell.selectNextOccurrence").key,preventDefault:!0,run:pn},{key:e.getHotkey("cell.findAndReplace").key,preventDefault:!0,run:eu}]),gn(),pu,hu,gu]}var Fu=Object.defineProperty,Lu=(e,t,n)=>(((e,t,n)=>{t in e?Fu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);const zu=Xt.define({create:()=>({suggestion:null}),update(e,t){const n=t.effects.find((e=>e.is(Bu)));return t.state.doc&&n&&t.state.doc==n.value.doc?{suggestion:n.value.text}:{suggestion:null}}}),Bu=Yt.define();class Uu extends xn{constructor(e){super(),Lu(this,"suggestion"),this.suggestion=e}toDOM(){const e=document.createElement("span");return e.style.opacity="0.4",e.className="cm-inline-suggestion",e.textContent=this.suggestion,e}get lineBreaks(){return this.suggestion.split("\n").length-1}}const Vu=e=>Jt.fromClass(class{async update(t){const n=t.state.doc;if(!t.docChanged)return;const o=await e(t.state);t.view.dispatch({effects:Bu.of({text:o,doc:n})})}}),Gu=Jt.fromClass(class{constructor(){Lu(this,"decorations"),this.decorations=Kt.none}update(e){var t;const n=null==(t=e.state.field(zu))?void 0:t.suggestion;this.decorations=n?function(e,t){const n=e.state.selection.main.head,o=[],r=Kt.widget({widget:new Uu(t),side:1});return o.push(r.range(n)),Kt.set(o)}(e.view,n):Kt.none}},{decorations:e=>e.decorations}),$u=vn.highest(fn.of([{key:"Tab",run:e=>{var t;const n=null==(t=e.state.field(zu))?void 0:t.suggestion;return!!n&&(e.dispatch({...Hu(e.state,n,e.state.selection.main.head,e.state.selection.main.head)}),!0)}}]));function Hu(e,t,n,o){return{...e.changeByRange((r=>{if(r==e.selection.main)return{changes:{from:n,to:o,insert:t},range:Wt.cursor(n+t.length)};const a=o-n;return!r.empty||a&&e.sliceDoc(r.from-a,r.from)!=e.sliceDoc(n,o)?{range:r}:{changes:{from:r.from-a,to:r.from,insert:t},range:Wt.cursor(r.from-a+t.length)}})),userEvent:"input.complete"}}function Wu(e){const{delay:t=500}=e,n=function(e,t,n){let o=()=>{};return(...r)=>(o(),new Promise(((a,s)=>{const i=setTimeout((()=>a(e(...r))),t);o=()=>{clearTimeout(i),void 0!==n&&s(n)}})))}(e.fetchFn,t);return[zu,Vu(n),Gu,$u]}const qu=Yt.define(),Yu=Yt.define(),Xu=Yt.define();function Ku(e,t){if(!e)throw new Error(t)}function Ju(e){if("number"!=typeof e)throw new Error("invalid int 32: "+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw new Error("invalid int 32: "+e)}function Zu(e){if("number"!=typeof e)throw new Error("invalid uint 32: "+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw new Error("invalid uint 32: "+e)}function Qu(e){if("number"!=typeof e)throw new Error("invalid float 32: "+typeof e);if(Number.isFinite(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw new Error("invalid float 32: "+e)}const eh=Symbol("@bufbuild/protobuf/enum-type");function th(e){const t=e[eh];return Ku(t,"missing enum type on enum object"),t}function nh(e,t,n,o){e[eh]=oh(t,n.map((t=>({no:t.no,name:t.name,localName:e[t.no]}))))}function oh(e,t,n){const o=Object.create(null),r=Object.create(null),a=[];for(const s of t){const e=ah(s);a.push(e),o[s.name]=e,r[s.no]=e}return{typeName:e,values:a,findName:e=>o[e],findNumber:e=>r[e]}}function rh(e,t,n){const o={};for(const r of t){const e=ah(r);o[e.localName]=e.no,o[e.no]=e.localName}return nh(o,e,t),o}function ah(e){return"localName"in e?e:Object.assign(Object.assign({},e),{localName:e.name})}class sh{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,t){const n=this.getType().runtime.bin,o=n.makeReadOptions(t);return n.readMessage(this,o.readerFactory(e),e.byteLength,o),this}fromJson(e,t){const n=this.getType(),o=n.runtime.json,r=o.makeReadOptions(t);return o.readMessage(n,e,r,this),this}fromJsonString(e,t){let n;try{n=JSON.parse(e)}catch(o){throw new Error(`cannot decode ${this.getType().typeName} from JSON: ${o instanceof Error?o.message:String(o)}`)}return this.fromJson(n,t)}toBinary(e){const t=this.getType().runtime.bin,n=t.makeWriteOptions(e),o=n.writerFactory();return t.writeMessage(this,o,n),o.finish()}toJson(e){const t=this.getType().runtime.json,n=t.makeWriteOptions(e);return t.writeMessage(this,n)}toJsonString(e){var t;const n=this.toJson(e);return JSON.stringify(n,null,null!==(t=null==e?void 0:e.prettySpaces)&&void 0!==t?t:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function ih(){let e=0,t=0;for(let o=0;o<28;o+=7){let n=this.buf[this.pos++];if(e|=(127&n)<<o,!(128&n))return this.assertBounds(),[e,t]}let n=this.buf[this.pos++];if(e|=(15&n)<<28,t=(112&n)>>4,!(128&n))return this.assertBounds(),[e,t];for(let o=3;o<=31;o+=7){let n=this.buf[this.pos++];if(t|=(127&n)<<o,!(128&n))return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function lh(e,t,n){for(let a=0;a<28;a+=7){const o=e>>>a,r=!(o>>>7==0&&0==t),s=255&(r?128|o:o);if(n.push(s),!r)return}const o=e>>>28&15|(7&t)<<4,r=!!(t>>3);if(n.push(255&(r?128|o:o)),r){for(let e=3;e<31;e+=7){const o=t>>>e,r=!(o>>>7==0),a=255&(r?128|o:o);if(n.push(a),!r)return}n.push(t>>>31&1)}}const ch=4294967296;function dh(e){const t="-"===e[0];t&&(e=e.slice(1));const n=1e6;let o=0,r=0;function a(t,a){const s=Number(e.slice(t,a));r*=n,o=o*n+s,o>=ch&&(r+=o/ch|0,o%=ch)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?mh(o,r):hh(o,r)}function uh(e,t){if(({lo:e,hi:t}=function(e,t){return{lo:e>>>0,hi:t>>>0}}(e,t)),t<=2097151)return String(ch*t+e);const n=16777215&(e>>>24|t<<8),o=t>>16&65535;let r=(16777215&e)+6777216*n+6710656*o,a=n+8147497*o,s=2*o;const i=1e7;return r>=i&&(a+=Math.floor(r/i),r%=i),a>=i&&(s+=Math.floor(a/i),a%=i),s.toString()+fh(a)+fh(r)}function hh(e,t){return{lo:0|e,hi:0|t}}function mh(e,t){return t=~t,e?e=1+~e:t+=1,hh(e,t)}const fh=e=>{const t=String(e);return"0000000".slice(t.length)+t};function ph(e,t){if(e>=0){for(;e>127;)t.push(127&e|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(127&e|128),e>>=7;t.push(1)}}function gh(){let e=this.buf[this.pos++],t=127&e;if(!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<7,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<14,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<21,!(128&e))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(15&e)<<28;for(let n=5;128&e&&n<10;n++)e=this.buf[this.pos++];if(128&e)throw new Error("invalid varint");return this.assertBounds(),t>>>0}var vh={};const xh=function(){const e=new DataView(new ArrayBuffer(8));if("function"==typeof BigInt&&"function"==typeof e.getBigInt64&&"function"==typeof e.getBigUint64&&"function"==typeof e.setBigInt64&&"function"==typeof e.setBigUint64&&("object"!=typeof process||"1"!==vh.BUF_BIGINT_DISABLE)){const t=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),r=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(e){const o="bigint"==typeof e?e:BigInt(e);if(o>n||o<t)throw new Error(`int64 invalid: ${e}`);return o},uParse(e){const t="bigint"==typeof e?e:BigInt(e);if(t>r||t<o)throw new Error(`uint64 invalid: ${e}`);return t},enc(t){return e.setBigInt64(0,this.parse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(t){return e.setBigInt64(0,this.uParse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec:(t,n)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigInt64(0,!0)),uDec:(t,n)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigUint64(0,!0))}}const t=e=>Ku(/^-?[0-9]+$/.test(e),`int64 invalid: ${e}`),n=e=>Ku(/^[0-9]+$/.test(e),`uint64 invalid: ${e}`);return{zero:"0",supported:!1,parse:e=>("string"!=typeof e&&(e=e.toString()),t(e),e),uParse:e=>("string"!=typeof e&&(e=e.toString()),n(e),e),enc:e=>("string"!=typeof e&&(e=e.toString()),t(e),dh(e)),uEnc:e=>("string"!=typeof e&&(e=e.toString()),n(e),dh(e)),dec:(e,t)=>function(e,t){let n=hh(e,t);const o=2147483648&n.hi;o&&(n=mh(n.lo,n.hi));const r=uh(n.lo,n.hi);return o?"-"+r:r}(e,t),uDec:(e,t)=>uh(e,t)}}();var yh,bh,wh,kh,Nh,Ch;function Eh(e,t,n){if(t===n)return!0;if(e==yh.BYTES){if(!(t instanceof Uint8Array&&n instanceof Uint8Array))return!1;if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==n[e])return!1;return!0}switch(e){case yh.UINT64:case yh.FIXED64:case yh.INT64:case yh.SFIXED64:case yh.SINT64:return t==n}return!1}function Sh(e,t){switch(e){case yh.BOOL:return!1;case yh.UINT64:case yh.FIXED64:case yh.INT64:case yh.SFIXED64:case yh.SINT64:return 0==t?xh.zero:"0";case yh.DOUBLE:case yh.FLOAT:return 0;case yh.BYTES:return new Uint8Array(0);case yh.STRING:return"";default:return 0}}function jh(e,t){switch(e){case yh.BOOL:return!1===t;case yh.STRING:return""===t;case yh.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return 0==t}}(bh=yh||(yh={}))[bh.DOUBLE=1]="DOUBLE",bh[bh.FLOAT=2]="FLOAT",bh[bh.INT64=3]="INT64",bh[bh.UINT64=4]="UINT64",bh[bh.INT32=5]="INT32",bh[bh.FIXED64=6]="FIXED64",bh[bh.FIXED32=7]="FIXED32",bh[bh.BOOL=8]="BOOL",bh[bh.STRING=9]="STRING",bh[bh.BYTES=12]="BYTES",bh[bh.UINT32=13]="UINT32",bh[bh.SFIXED32=15]="SFIXED32",bh[bh.SFIXED64=16]="SFIXED64",bh[bh.SINT32=17]="SINT32",bh[bh.SINT64=18]="SINT64",(kh=wh||(wh={}))[kh.BIGINT=0]="BIGINT",kh[kh.STRING=1]="STRING",(Ch=Nh||(Nh={}))[Ch.Varint=0]="Varint",Ch[Ch.Bit64=1]="Bit64",Ch[Ch.LengthDelimited=2]="LengthDelimited",Ch[Ch.StartGroup=3]="StartGroup",Ch[Ch.EndGroup=4]="EndGroup",Ch[Ch.Bit32=5]="Bit32";class _h{constructor(e){this.stack=[],this.textEncoder=null!=e?e:new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let o=0;o<this.chunks.length;o++)e+=this.chunks[o].length;let t=new Uint8Array(e),n=0;for(let o=0;o<this.chunks.length;o++)t.set(this.chunks[o],n),n+=this.chunks[o].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(Zu(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return Ju(e),ph(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 t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){Qu(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){Zu(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){Ju(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return Ju(e),ph(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),o=xh.enc(e);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),o=xh.uEnc(e);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(t)}int64(e){let t=xh.enc(e);return lh(t.lo,t.hi,this.buf),this}sint64(e){let t=xh.enc(e),n=t.hi>>31;return lh(t.lo<<1^n,(t.hi<<1|t.lo>>>31)^n,this.buf),this}uint64(e){let t=xh.uEnc(e);return lh(t.lo,t.hi,this.buf),this}}class Ih{constructor(e,t){this.varint64=ih,this.uint32=gh,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=null!=t?t:new TextDecoder}tag(){let e=this.uint32(),t=e>>>3,n=7&e;if(t<=0||n<0||n>5)throw new Error("illegal tag: field no "+t+" wire type "+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case Nh.Varint:for(;128&this.buf[this.pos++];);break;case Nh.Bit64:this.pos+=4;case Nh.Bit32:this.pos+=4;break;case Nh.LengthDelimited:let n=this.uint32();this.pos+=n;break;case Nh.StartGroup:for(;;){const[e,n]=this.tag();if(n===Nh.EndGroup){if(void 0!==t&&e!==t)throw new Error("invalid end group tag");break}this.skip(n,e)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(n,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 xh.dec(...this.varint64())}uint64(){return xh.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(1&e);return e=(e>>>1|(1&t)<<31)^n,t=t>>>1^n,xh.dec(e,t)}bool(){let[e,t]=this.varint64();return 0!==e||0!==t}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return xh.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return xh.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(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}}function Ah(e){const t=e.field.localName,n=Object.create(null);return n[t]=function(e){const t=e.field;if(t.repeated)return[];if(void 0!==t.default)return t.default;switch(t.kind){case"enum":return t.T.values[0].no;case"scalar":return Sh(t.T,t.L);case"message":const e=t.T,n=new e;return e.fieldWrapper?e.fieldWrapper.unwrapField(n):n;case"map":throw"map fields are not allowed to be extensions"}}(e),[n,()=>n[t]]}let Mh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Th=[];for(let vO=0;vO<Mh.length;vO++)Th[Mh[vO].charCodeAt(0)]=vO;Th["-".charCodeAt(0)]=Mh.indexOf("+"),Th["_".charCodeAt(0)]=Mh.indexOf("/");const Oh={dec(e){let t=3*e.length/4;"="==e[e.length-2]?t-=2:"="==e[e.length-1]&&(t-=1);let n,o=new Uint8Array(t),r=0,a=0,s=0;for(let i=0;i<e.length;i++){if(n=Th[e.charCodeAt(i)],void 0===n)switch(e[i]){case"=":a=0;case"\n":case"\r":case"\t":case" ":continue;default:throw Error("invalid base64 string.")}switch(a){case 0:s=n,a=1;break;case 1:o[r++]=s<<2|(48&n)>>4,s=n,a=2;break;case 2:o[r++]=(15&s)<<4|(60&n)>>2,s=n,a=3;break;case 3:o[r++]=(3&s)<<6|n,a=0}}if(1==a)throw Error("invalid base64 string.");return o.subarray(0,r)},enc(e){let t,n="",o=0,r=0;for(let a=0;a<e.length;a++)switch(t=e[a],o){case 0:n+=Mh[t>>2],r=(3&t)<<4,o=1;break;case 1:n+=Mh[r|t>>4],r=(15&t)<<2,o=2;break;case 2:n+=Mh[r|t>>6],n+=Mh[63&t],o=0}return o&&(n+=Mh[r],n+="=",1==o&&(n+="=")),n}};function Dh(e,t,n){Fh(t,e);const o=t.runtime.bin.makeReadOptions(n),r=function(e,t){if(!t.repeated&&("enum"==t.kind||"scalar"==t.kind)){for(let n=e.length-1;n>=0;--n)if(e[n].no==t.no)return[e[n]];return[]}return e.filter((e=>e.no===t.no))}(e.getType().runtime.bin.listUnknownFields(e),t.field),[a,s]=Ah(t);for(const i of r)t.runtime.bin.readField(a,o.readerFactory(i.data),t.field,i.wireType,o);return s()}function Rh(e,t,n,o){Fh(t,e);const r=t.runtime.bin.makeReadOptions(o),a=t.runtime.bin.makeWriteOptions(o);if(Ph(e,t)){const n=e.getType().runtime.bin.listUnknownFields(e).filter((e=>e.no!=t.field.no));e.getType().runtime.bin.discardUnknownFields(e);for(const t of n)e.getType().runtime.bin.onUnknownField(e,t.no,t.wireType,t.data)}const s=a.writerFactory();let i=t.field;i.opt||i.repeated||"enum"!=i.kind&&"scalar"!=i.kind||(i=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(i,n,s,a);const l=r.readerFactory(s.finish());for(;l.pos<l.len;){const[t,n]=l.tag(),o=l.skip(n,t);e.getType().runtime.bin.onUnknownField(e,t,n,o)}}function Ph(e,t){const n=e.getType();return t.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(e).find((e=>e.no==t.field.no))}function Fh(e,t){Ku(e.extendee.typeName==t.getType().typeName,`extension ${e.typeName} can only be applied to message ${e.extendee.typeName}`)}function Lh(e,t){const n=e.localName;if(e.repeated)return t[n].length>0;if(e.oneof)return t[e.oneof.localName].case===n;switch(e.kind){case"enum":case"scalar":return e.opt||e.req?void 0!==t[n]:"enum"==e.kind?t[n]!==e.T.values[0].no:!jh(e.T,t[n]);case"message":return void 0!==t[n];case"map":return Object.keys(t[n]).length>0}}function zh(e,t){const n=e.localName,o=!e.opt&&!e.req;if(e.repeated)t[n]=[];else if(e.oneof)t[e.oneof.localName]={case:void 0};else switch(e.kind){case"map":t[n]={};break;case"enum":t[n]=o?e.T.values[0].no:void 0;break;case"scalar":t[n]=o?Sh(e.T,e.L):void 0;break;case"message":t[n]=void 0}}function Bh(e,t){if(null===e||"object"!=typeof e)return!1;if(!Object.getOwnPropertyNames(sh.prototype).every((t=>t in e&&"function"==typeof e[t])))return!1;const n=e.getType();return null!==n&&"function"==typeof n&&"typeName"in n&&"string"==typeof n.typeName&&(void 0===t||n.typeName==t.typeName)}function Uh(e,t){return Bh(t)||!e.fieldWrapper?t:e.fieldWrapper.wrapField(t)}yh.DOUBLE,yh.FLOAT,yh.INT64,yh.UINT64,yh.INT32,yh.UINT32,yh.BOOL,yh.STRING,yh.BYTES;const Vh={ignoreUnknownFields:!1},Gh={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function $h(e){return e?Object.assign(Object.assign({},Vh),e):Vh}function Hh(e){return e?Object.assign(Object.assign({},Gh),e):Gh}const Wh=Symbol(),qh=Symbol();function Yh(e){if(null===e)return"null";switch(typeof e){case"object":return Array.isArray(e)?"array":"object";case"string":return e.length>100?"string":`"${e.split('"').join('\\"')}"`;default:return String(e)}}function Xh(e,t,n,o,r){let a=n.localName;if(n.repeated){if(Ku("map"!=n.kind),null===t)return;if(!Array.isArray(t))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Yh(t)}`);const i=e[a];for(const e of t){if(null===e)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Yh(e)}`);switch(n.kind){case"message":i.push(n.T.fromJson(e,o));break;case"enum":const t=Zh(n.T,e,o.ignoreUnknownFields,!0);t!==qh&&i.push(t);break;case"scalar":try{i.push(Jh(n.T,e,n.L,!0))}catch(s){let t=`cannot decode field ${r.typeName}.${n.name} from JSON: ${Yh(e)}`;throw s instanceof Error&&s.message.length>0&&(t+=`: ${s.message}`),new Error(t)}}}}else if("map"==n.kind){if(null===t)return;if("object"!=typeof t||Array.isArray(t))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Yh(t)}`);const i=e[a];for(const[e,a]of Object.entries(t)){if(null===a)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: map value null`);let l;try{l=Kh(n.K,e)}catch(s){let e=`cannot decode map key for field ${r.typeName}.${n.name} from JSON: ${Yh(t)}`;throw s instanceof Error&&s.message.length>0&&(e+=`: ${s.message}`),new Error(e)}switch(n.V.kind){case"message":i[l]=n.V.T.fromJson(a,o);break;case"enum":const e=Zh(n.V.T,a,o.ignoreUnknownFields,!0);e!==qh&&(i[l]=e);break;case"scalar":try{i[l]=Jh(n.V.T,a,wh.BIGINT,!0)}catch(s){let e=`cannot decode map value for field ${r.typeName}.${n.name} from JSON: ${Yh(t)}`;throw s instanceof Error&&s.message.length>0&&(e+=`: ${s.message}`),new Error(e)}}}}else switch(n.oneof&&(e=e[n.oneof.localName]={case:a},a="value"),n.kind){case"message":const i=n.T;if(null===t&&"google.protobuf.Value"!=i.typeName)return;let l=e[a];Bh(l)?l.fromJson(t,o):(e[a]=l=i.fromJson(t,o),i.fieldWrapper&&!n.oneof&&(e[a]=i.fieldWrapper.unwrapField(l)));break;case"enum":const c=Zh(n.T,t,o.ignoreUnknownFields,!1);switch(c){case Wh:zh(n,e);break;case qh:break;default:e[a]=c}break;case"scalar":try{const o=Jh(n.T,t,n.L,!1);if(o===Wh)zh(n,e);else e[a]=o}catch(s){let e=`cannot decode field ${r.typeName}.${n.name} from JSON: ${Yh(t)}`;throw s instanceof Error&&s.message.length>0&&(e+=`: ${s.message}`),new Error(e)}}}function Kh(e,t){if(e===yh.BOOL)switch(t){case"true":t=!0;break;case"false":t=!1}return Jh(e,t,wh.BIGINT,!0).toString()}function Jh(e,t,n,o){if(null===t)return o?Sh(e,n):Wh;switch(e){case yh.DOUBLE:case yh.FLOAT:if("NaN"===t)return Number.NaN;if("Infinity"===t)return Number.POSITIVE_INFINITY;if("-Infinity"===t)return Number.NEGATIVE_INFINITY;if(""===t)break;if("string"==typeof t&&t.trim().length!==t.length)break;if("string"!=typeof t&&"number"!=typeof t)break;const o=Number(t);if(Number.isNaN(o))break;if(!Number.isFinite(o))break;return e==yh.FLOAT&&Qu(o),o;case yh.INT32:case yh.FIXED32:case yh.SFIXED32:case yh.SINT32:case yh.UINT32:let a;if("number"==typeof t?a=t:"string"==typeof t&&t.length>0&&t.trim().length===t.length&&(a=Number(t)),void 0===a)break;return e==yh.UINT32||e==yh.FIXED32?Zu(a):Ju(a),a;case yh.INT64:case yh.SFIXED64:case yh.SINT64:if("number"!=typeof t&&"string"!=typeof t)break;const s=xh.parse(t);return n?s.toString():s;case yh.FIXED64:case yh.UINT64:if("number"!=typeof t&&"string"!=typeof t)break;const i=xh.uParse(t);return n?i.toString():i;case yh.BOOL:if("boolean"!=typeof t)break;return t;case yh.STRING:if("string"!=typeof t)break;try{encodeURIComponent(t)}catch(r){throw new Error("invalid UTF8")}return t;case yh.BYTES:if(""===t)return new Uint8Array(0);if("string"!=typeof t)break;return Oh.dec(t)}throw new Error}function Zh(e,t,n,o){if(null===t)return"google.protobuf.NullValue"==e.typeName?0:o?e.values[0].no:Wh;switch(typeof t){case"number":if(Number.isInteger(t))return t;break;case"string":const o=e.findName(t);if(void 0!==o)return o.no;if(n)return qh}throw new Error(`cannot decode enum ${e.typeName} from JSON: ${Yh(t)}`)}function Qh(e){return!(!e.repeated&&"map"!=e.kind)||!e.oneof&&("message"!=e.kind&&(!e.opt&&!e.req))}function em(e,t,n){if("map"==e.kind){Ku("object"==typeof t&&null!=t);const o={},r=Object.entries(t);switch(e.V.kind){case"scalar":for(const[n,a]of r)o[n.toString()]=nm(e.V.T,a);break;case"message":for(const[e,a]of r)o[e.toString()]=a.toJson(n);break;case"enum":const t=e.V.T;for(const[e,a]of r)o[e.toString()]=tm(t,a,n.enumAsInteger)}return n.emitDefaultValues||r.length>0?o:void 0}if(e.repeated){Ku(Array.isArray(t));const o=[];switch(e.kind){case"scalar":for(let n=0;n<t.length;n++)o.push(nm(e.T,t[n]));break;case"enum":for(let r=0;r<t.length;r++)o.push(tm(e.T,t[r],n.enumAsInteger));break;case"message":for(let e=0;e<t.length;e++)o.push(t[e].toJson(n))}return n.emitDefaultValues||o.length>0?o:void 0}switch(e.kind){case"scalar":return nm(e.T,t);case"enum":return tm(e.T,t,n.enumAsInteger);case"message":return Uh(e.T,t).toJson(n)}}function tm(e,t,n){var o;if(Ku("number"==typeof t),"google.protobuf.NullValue"==e.typeName)return null;if(n)return t;const r=e.findNumber(t);return null!==(o=null==r?void 0:r.name)&&void 0!==o?o:t}function nm(e,t){switch(e){case yh.INT32:case yh.SFIXED32:case yh.SINT32:case yh.FIXED32:case yh.UINT32:return Ku("number"==typeof t),t;case yh.FLOAT:case yh.DOUBLE:return Ku("number"==typeof t),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t;case yh.STRING:return Ku("string"==typeof t),t;case yh.BOOL:return Ku("boolean"==typeof t),t;case yh.UINT64:case yh.FIXED64:case yh.INT64:case yh.SFIXED64:case yh.SINT64:return Ku("bigint"==typeof t||"string"==typeof t||"number"==typeof t),t.toString();case yh.BYTES:return Ku(t instanceof Uint8Array),Oh.enc(t)}}const om=Symbol("@bufbuild/protobuf/unknown-fields"),rm={readUnknownFields:!0,readerFactory:e=>new Ih(e)},am={writeUnknownFields:!0,writerFactory:()=>new _h};function sm(e){return e?Object.assign(Object.assign({},rm),e):rm}function im(e){return e?Object.assign(Object.assign({},am),e):am}function lm(e,t,n,o,r){let{repeated:a,localName:s}=n;switch(n.oneof&&((e=e[n.oneof.localName]).case!=s&&delete e.value,e.case=s,s="value"),n.kind){case"scalar":case"enum":const i="enum"==n.kind?yh.INT32:n.T;let l=um;if("scalar"==n.kind&&n.L>0&&(l=dm),a){let n=e[s];if(o==Nh.LengthDelimited&&i!=yh.STRING&&i!=yh.BYTES){let e=t.uint32()+t.pos;for(;t.pos<e;)n.push(l(t,i))}else n.push(l(t,i))}else e[s]=l(t,i);break;case"message":const c=n.T;a?e[s].push(cm(t,new c,r,n)):Bh(e[s])?cm(t,e[s],r,n):(e[s]=cm(t,new c,r,n),!c.fieldWrapper||n.oneof||n.repeated||(e[s]=c.fieldWrapper.unwrapField(e[s])));break;case"map":let[d,u]=function(e,t,n){const o=t.uint32(),r=t.pos+o;let a,s;for(;t.pos<r;){const[o]=t.tag();switch(o){case 1:a=um(t,e.K);break;case 2:switch(e.V.kind){case"scalar":s=um(t,e.V.T);break;case"enum":s=t.int32();break;case"message":s=cm(t,new e.V.T,n,void 0)}}}void 0===a&&(a=Sh(e.K,wh.BIGINT));"string"!=typeof a&&"number"!=typeof a&&(a=a.toString());if(void 0===s)switch(e.V.kind){case"scalar":s=Sh(e.V.T,wh.BIGINT);break;case"enum":s=e.V.T.values[0].no;break;case"message":s=new e.V.T}return[a,s]}(n,t,r);e[s][d]=u}}function cm(e,t,n,o){const r=t.getType().runtime.bin,a=null==o?void 0:o.delimited;return r.readMessage(t,e,a?o.no:e.uint32(),n,a),t}function dm(e,t){const n=um(e,t);return"bigint"==typeof n?n.toString():n}function um(e,t){switch(t){case yh.STRING:return e.string();case yh.BOOL:return e.bool();case yh.DOUBLE:return e.double();case yh.FLOAT:return e.float();case yh.INT32:return e.int32();case yh.INT64:return e.int64();case yh.UINT64:return e.uint64();case yh.FIXED64:return e.fixed64();case yh.BYTES:return e.bytes();case yh.FIXED32:return e.fixed32();case yh.SFIXED32:return e.sfixed32();case yh.SFIXED64:return e.sfixed64();case yh.SINT64:return e.sint64();case yh.UINT32:return e.uint32();case yh.SINT32:return e.sint32()}}function hm(e,t,n,o){Ku(void 0!==t);const r=e.repeated;switch(e.kind){case"scalar":case"enum":let a="enum"==e.kind?yh.INT32:e.T;if(r)if(Ku(Array.isArray(t)),e.packed)!function(e,t,n,o){if(!o.length)return;e.tag(n,Nh.LengthDelimited).fork();let[,r]=gm(t);for(let a=0;a<o.length;a++)e[r](o[a]);e.join()}(n,a,e.no,t);else for(const o of t)pm(n,a,e.no,o);else pm(n,a,e.no,t);break;case"message":if(r){Ku(Array.isArray(t));for(const r of t)fm(n,o,e,r)}else fm(n,o,e,t);break;case"map":Ku("object"==typeof t&&null!=t);for(const[r,s]of Object.entries(t))mm(n,o,e,r,s)}}function mm(e,t,n,o,r){e.tag(n.no,Nh.LengthDelimited),e.fork();let a=o;switch(n.K){case yh.INT32:case yh.FIXED32:case yh.UINT32:case yh.SFIXED32:case yh.SINT32:a=Number.parseInt(o);break;case yh.BOOL:Ku("true"==o||"false"==o),a="true"==o}switch(pm(e,n.K,1,a),n.V.kind){case"scalar":pm(e,n.V.T,2,r);break;case"enum":pm(e,yh.INT32,2,r);break;case"message":Ku(void 0!==r),e.tag(2,Nh.LengthDelimited).bytes(r.toBinary(t))}e.join()}function fm(e,t,n,o){const r=Uh(n.T,o);n.delimited?e.tag(n.no,Nh.StartGroup).raw(r.toBinary(t)).tag(n.no,Nh.EndGroup):e.tag(n.no,Nh.LengthDelimited).bytes(r.toBinary(t))}function pm(e,t,n,o){Ku(void 0!==o);let[r,a]=gm(t);e.tag(n,r)[a](o)}function gm(e){let t=Nh.Varint;switch(e){case yh.BYTES:case yh.STRING:t=Nh.LengthDelimited;break;case yh.DOUBLE:case yh.FIXED64:case yh.SFIXED64:t=Nh.Bit64;break;case yh.FIXED32:case yh.SFIXED32:case yh.FLOAT:t=Nh.Bit32}return[t,yh[e].toLowerCase()]}function vm(e){if(void 0===e)return e;if(Bh(e))return e.clone();if(e instanceof Uint8Array){const t=new Uint8Array(e.byteLength);return t.set(e),t}return e}function xm(e){return e instanceof Uint8Array?e:new Uint8Array(e)}class ym{constructor(e,t){this._fields=e,this._normalizer=t}findJsonName(e){if(!this.jsonNames){const e={};for(const t of this.list())e[t.jsonName]=e[t.name]=t;this.jsonNames=e}return this.jsonNames[e]}find(e){if(!this.numbers){const e={};for(const t of this.list())e[t.no]=t;this.numbers=e}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,t)=>e.no-t.no))),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let t;for(const n of this.list())n.oneof?n.oneof!==t&&(t=n.oneof,e.push(t)):e.push(n)}return this.members}}function bm(e,t){const n=km(e);return t?n:jm(Sm(n))}const wm=km;function km(e){let t=!1;const n=[];for(let o=0;o<e.length;o++){let r=e.charAt(o);switch(r){case"_":t=!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),t=!1;break;default:t&&(t=!1,r=r.toUpperCase()),n.push(r)}}return n.join("")}const Nm=new Set(["constructor","toString","toJSON","valueOf"]),Cm=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),Em=e=>`${e}$`,Sm=e=>Cm.has(e)?Em(e):e,jm=e=>Nm.has(e)?Em(e):e;class _m{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=bm(e,!1)}addField(e){Ku(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 e=0;e<this.fields.length;e++)this._lookup[this.fields[e].localName]=this.fields[e]}return this._lookup[e]}}const Im=(Am=e=>new ym(e,(e=>function(e){var t,n,o,r,a,s;const i=[];let l;for(const c of"function"==typeof e?e():e){const e=c;if(e.localName=bm(c.name,void 0!==c.oneof),e.jsonName=null!==(t=c.jsonName)&&void 0!==t?t:wm(c.name),e.repeated=null!==(n=c.repeated)&&void 0!==n&&n,"scalar"==c.kind&&(e.L=null!==(o=c.L)&&void 0!==o?o:wh.BIGINT),e.delimited=null!==(r=c.delimited)&&void 0!==r&&r,e.req=null!==(a=c.req)&&void 0!==a&&a,e.opt=null!==(s=c.opt)&&void 0!==s&&s,void 0===c.packed&&(e.packed="enum"==c.kind||"scalar"==c.kind&&c.T!=yh.BYTES&&c.T!=yh.STRING),void 0!==c.oneof){const t="string"==typeof c.oneof?c.oneof:c.oneof.name;l&&l.name==t||(l=new _m(t)),e.oneof=l,l.addField(e)}i.push(e)}return i}(e))),Mm=e=>{for(const t of e.getType().fields.byMember()){if(t.opt)continue;const n=t.localName,o=e;if(t.repeated)o[n]=[];else switch(t.kind){case"oneof":o[n]={case:void 0};break;case"enum":o[n]=0;break;case"map":o[n]={};break;case"scalar":o[n]=Sh(t.T,t.L)}}},{syntax:"proto3",json:{makeReadOptions:$h,makeWriteOptions:Hh,readMessage(e,t,n,o){if(null==t||Array.isArray(t)||"object"!=typeof t)throw new Error(`cannot decode message ${e.typeName} from JSON: ${Yh(t)}`);o=null!=o?o:new e;const r=new Map,a=n.typeRegistry;for(const[s,i]of Object.entries(t)){const t=e.fields.findJsonName(s);if(t){if(t.oneof){if(null===i&&"scalar"==t.kind)continue;const n=r.get(t.oneof);if(void 0!==n)throw new Error(`cannot decode message ${e.typeName} from JSON: multiple keys for oneof "${t.oneof.name}" present: "${n}", "${s}"`);r.set(t.oneof,s)}Xh(o,i,t,n,e)}else{let t=!1;if((null==a?void 0:a.findExtension)&&s.startsWith("[")&&s.endsWith("]")){const r=a.findExtension(s.substring(1,s.length-1));if(r&&r.extendee.typeName==e.typeName){t=!0;const[e,a]=Ah(r);Xh(e,i,r.field,n,r),Rh(o,r,a(),n)}}if(!t&&!n.ignoreUnknownFields)throw new Error(`cannot decode message ${e.typeName} from JSON: key "${s}" is unknown`)}}return o},writeMessage(e,t){const n=e.getType(),o={};let r;try{for(r of n.fields.byNumber()){if(!Lh(r,e)){if(r.req)throw"required field not set";if(!t.emitDefaultValues)continue;if(!Qh(r))continue}const n=em(r,r.oneof?e[r.oneof.localName].value:e[r.localName],t);void 0!==n&&(o[t.useProtoFieldName?r.name:r.jsonName]=n)}const a=t.typeRegistry;if(null==a?void 0:a.findExtensionFor)for(const r of n.runtime.bin.listUnknownFields(e)){const s=a.findExtensionFor(n.typeName,r.no);if(s&&Ph(e,s)){const n=Dh(e,s,t),r=em(s.field,n,t);void 0!==r&&(o[s.field.jsonName]=r)}}}catch(a){const e=r?`cannot encode field ${n.typeName}.${r.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,t=a instanceof Error?a.message:String(a);throw new Error(e+(t.length>0?`: ${t}`:""))}return o},readScalar:(e,t,n)=>Jh(e,t,null!=n?n:wh.BIGINT,!0),writeScalar(e,t,n){if(void 0!==t)return n||jh(e,t)?nm(e,t):void 0},debug:Yh},bin:{makeReadOptions:sm,makeWriteOptions:im,listUnknownFields(e){var t;return null!==(t=e[om])&&void 0!==t?t:[]},discardUnknownFields(e){delete e[om]},writeUnknownFields(e,t){const n=e[om];if(n)for(const o of n)t.tag(o.no,o.wireType).raw(o.data)},onUnknownField(e,t,n,o){const r=e;Array.isArray(r[om])||(r[om]=[]),r[om].push({no:t,wireType:n,data:o})},readMessage(e,t,n,o,r){const a=e.getType(),s=r?t.len:t.pos+n;let i,l;for(;t.pos<s&&([i,l]=t.tag(),!0!==r||l!=Nh.EndGroup);){const n=a.fields.find(i);if(n)lm(e,t,n,l,o);else{const n=t.skip(l,i);o.readUnknownFields&&this.onUnknownField(e,i,l,n)}}if(r&&(l!=Nh.EndGroup||i!==n))throw new Error("invalid end group tag")},readField:lm,writeMessage(e,t,n){const o=e.getType();for(const r of o.fields.byNumber())if(Lh(r,e))hm(r,r.oneof?e[r.oneof.localName].value:e[r.localName],t,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(e,t),t},writeField(e,t,n,o){void 0!==t&&hm(e,t,n,o)}},util:Object.assign(Object.assign({},{setEnumType:nh,initPartial(e,t){if(void 0===e)return;const n=t.getType();for(const o of n.fields.byMember()){const n=o.localName,r=t,a=e;if(null!=a[n])switch(o.kind){case"oneof":const e=a[n].case;if(void 0===e)continue;const t=o.findField(e);let s=a[n].value;t&&"message"==t.kind&&!Bh(s,t.T)?s=new t.T(s):t&&"scalar"===t.kind&&t.T===yh.BYTES&&(s=xm(s)),r[n]={case:e,value:s};break;case"scalar":case"enum":let i=a[n];o.T===yh.BYTES&&(i=o.repeated?i.map(xm):xm(i)),r[n]=i;break;case"map":switch(o.V.kind){case"scalar":case"enum":if(o.V.T===yh.BYTES)for(const[t,o]of Object.entries(a[n]))r[n][t]=xm(o);else Object.assign(r[n],a[n]);break;case"message":const e=o.V.T;for(const t of Object.keys(a[n])){let o=a[n][t];e.fieldWrapper||(o=new e(o)),r[n][t]=o}}break;case"message":const l=o.T;if(o.repeated)r[n]=a[n].map((e=>Bh(e,l)?e:new l(e)));else{const e=a[n];l.fieldWrapper?"google.protobuf.BytesValue"===l.typeName?r[n]=xm(e):r[n]=e:r[n]=Bh(e,l)?e:new l(e)}}}},equals:(e,t,n)=>t===n||!(!t||!n)&&e.fields.byMember().every((e=>{const o=t[e.localName],r=n[e.localName];if(e.repeated){if(o.length!==r.length)return!1;switch(e.kind){case"message":return o.every(((t,n)=>e.T.equals(t,r[n])));case"scalar":return o.every(((t,n)=>Eh(e.T,t,r[n])));case"enum":return o.every(((e,t)=>Eh(yh.INT32,e,r[t])))}throw new Error(`repeated cannot contain ${e.kind}`)}switch(e.kind){case"message":return e.T.equals(o,r);case"enum":return Eh(yh.INT32,o,r);case"scalar":return Eh(e.T,o,r);case"oneof":if(o.case!==r.case)return!1;const t=e.findField(o.case);if(void 0===t)return!0;switch(t.kind){case"message":return t.T.equals(o.value,r.value);case"enum":return Eh(yh.INT32,o.value,r.value);case"scalar":return Eh(t.T,o.value,r.value)}throw new Error(`oneof cannot contain ${t.kind}`);case"map":const n=Object.keys(o).concat(Object.keys(r));switch(e.V.kind){case"message":const t=e.V.T;return n.every((e=>t.equals(o[e],r[e])));case"enum":return n.every((e=>Eh(yh.INT32,o[e],r[e])));case"scalar":const a=e.V.T;return n.every((e=>Eh(a,o[e],r[e])))}}})),clone(e){const t=e.getType(),n=new t,o=n;for(const r of t.fields.byMember()){const t=e[r.localName];let n;if(r.repeated)n=t.map(vm);else if("map"==r.kind){n=o[r.localName];for(const[e,o]of Object.entries(t))n[e]=vm(o)}else n="oneof"==r.kind?r.findField(t.case)?{case:t.case,value:vm(t.value)}:{case:void 0}:vm(t);o[r.localName]=n}for(const r of t.runtime.bin.listUnknownFields(e))t.runtime.bin.onUnknownField(o,r.no,r.wireType,r.data);return n}}),{newFieldList:Am,initFields:Mm}),makeMessageType(e,t,n){return function(e,t,n,o){var r;const a=null!==(r=null==o?void 0:o.localName)&&void 0!==r?r:t.substring(t.lastIndexOf(".")+1),s={[a]:function(t){e.util.initFields(this),e.util.initPartial(t,this)}}[a];return Object.setPrototypeOf(s.prototype,new sh),Object.assign(s,{runtime:e,typeName:t,fields:e.util.newFieldList(n),fromBinary:(e,t)=>(new s).fromBinary(e,t),fromJson:(e,t)=>(new s).fromJson(e,t),fromJsonString:(e,t)=>(new s).fromJsonString(e,t),equals:(t,n)=>e.util.equals(s,t,n)}),s}(this,e,t,n)},makeEnum:rh,makeEnumType:oh,getEnumType:th,makeExtension(e,t,n){return function(e,t,n,o){let r;return{typeName:t,extendee:n,get field(){if(!r){const n="function"==typeof o?o():o;n.name=t.split(".").pop(),n.jsonName=`[${t}]`,r=e.util.newFieldList([n]).list()[0]}return r},runtime:e}}(this,e,t,n)}});var Am,Mm,Tm,Om,Dm,Rm,Pm,Fm,Lm,zm,Bm,Um,Vm,Gm,$m,Hm;(Om=Tm||(Tm={}))[Om.Unary=0]="Unary",Om[Om.ServerStreaming=1]="ServerStreaming",Om[Om.ClientStreaming=2]="ClientStreaming",Om[Om.BiDiStreaming=3]="BiDiStreaming",(Rm=Dm||(Dm={}))[Rm.NoSideEffects=1]="NoSideEffects",Rm[Rm.Idempotent=2]="Idempotent",(Fm=Pm||(Pm={}))[Fm.UNSPECIFIED=0]="UNSPECIFIED",Fm[Fm.JUPYTER_FORMAT=77]="JUPYTER_FORMAT",Im.util.setEnumType(Pm,"exa.codeium_common_pb.ExperimentKey",[{no:0,name:"UNSPECIFIED"},{no:77,name:"JUPYTER_FORMAT"}]),(zm=Lm||(Lm={}))[zm.CODEIUM=0]="CODEIUM",Im.util.setEnumType(Lm,"exa.codeium_common_pb.AuthSource",[{no:0,name:"AUTH_SOURCE_CODEIUM"}]),(Um=Bm||(Bm={}))[Um.UNSPECIFIED=0]="UNSPECIFIED",Um[Um.ENABLE_CODEIUM=1]="ENABLE_CODEIUM",Um[Um.DISABLE_CODEIUM=2]="DISABLE_CODEIUM",Um[Um.SHOW_PREVIOUS_COMPLETION=3]="SHOW_PREVIOUS_COMPLETION",Um[Um.SHOW_NEXT_COMPLETION=4]="SHOW_NEXT_COMPLETION",Im.util.setEnumType(Bm,"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"}]),(Gm=Vm||(Vm={}))[Gm.UNSPECIFIED=0]="UNSPECIFIED",Gm[Gm.TYPING_AS_SUGGESTED=1]="TYPING_AS_SUGGESTED",Gm[Gm.CACHE=2]="CACHE",Gm[Gm.NETWORK=3]="NETWORK",Im.util.setEnumType(Vm,"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"}]),(Hm=$m||($m={}))[Hm.UNSPECIFIED=0]="UNSPECIFIED",Hm[Hm.C=1]="C",Hm[Hm.CLOJURE=2]="CLOJURE",Hm[Hm.COFFEESCRIPT=3]="COFFEESCRIPT",Hm[Hm.CPP=4]="CPP",Hm[Hm.CSHARP=5]="CSHARP",Hm[Hm.CSS=6]="CSS",Hm[Hm.CUDACPP=7]="CUDACPP",Hm[Hm.DOCKERFILE=8]="DOCKERFILE",Hm[Hm.GO=9]="GO",Hm[Hm.GROOVY=10]="GROOVY",Hm[Hm.HANDLEBARS=11]="HANDLEBARS",Hm[Hm.HASKELL=12]="HASKELL",Hm[Hm.HCL=13]="HCL",Hm[Hm.HTML=14]="HTML",Hm[Hm.INI=15]="INI",Hm[Hm.JAVA=16]="JAVA",Hm[Hm.JAVASCRIPT=17]="JAVASCRIPT",Hm[Hm.JSON=18]="JSON",Hm[Hm.JULIA=19]="JULIA",Hm[Hm.KOTLIN=20]="KOTLIN",Hm[Hm.LATEX=21]="LATEX",Hm[Hm.LESS=22]="LESS",Hm[Hm.LUA=23]="LUA",Hm[Hm.MAKEFILE=24]="MAKEFILE",Hm[Hm.MARKDOWN=25]="MARKDOWN",Hm[Hm.OBJECTIVEC=26]="OBJECTIVEC",Hm[Hm.OBJECTIVECPP=27]="OBJECTIVECPP",Hm[Hm.PERL=28]="PERL",Hm[Hm.PHP=29]="PHP",Hm[Hm.PLAINTEXT=30]="PLAINTEXT",Hm[Hm.PROTOBUF=31]="PROTOBUF",Hm[Hm.PBTXT=32]="PBTXT",Hm[Hm.PYTHON=33]="PYTHON",Hm[Hm.R=34]="R",Hm[Hm.RUBY=35]="RUBY",Hm[Hm.RUST=36]="RUST",Hm[Hm.SASS=37]="SASS",Hm[Hm.SCALA=38]="SCALA",Hm[Hm.SCSS=39]="SCSS",Hm[Hm.SHELL=40]="SHELL",Hm[Hm.SQL=41]="SQL",Hm[Hm.STARLARK=42]="STARLARK",Hm[Hm.SWIFT=43]="SWIFT",Hm[Hm.TSX=44]="TSX",Hm[Hm.TYPESCRIPT=45]="TYPESCRIPT",Hm[Hm.VISUALBASIC=46]="VISUALBASIC",Hm[Hm.VUE=47]="VUE",Hm[Hm.XML=48]="XML",Hm[Hm.XSL=49]="XSL",Hm[Hm.YAML=50]="YAML",Hm[Hm.SVELTE=51]="SVELTE",Hm[Hm.TOML=52]="TOML",Hm[Hm.DART=53]="DART",Hm[Hm.RST=54]="RST",Hm[Hm.OCAML=55]="OCAML",Hm[Hm.CMAKE=56]="CMAKE",Hm[Hm.PASCAL=57]="PASCAL",Hm[Hm.ELIXIR=58]="ELIXIR",Hm[Hm.FSHARP=59]="FSHARP",Hm[Hm.LISP=60]="LISP",Hm[Hm.MATLAB=61]="MATLAB",Hm[Hm.POWERSHELL=62]="POWERSHELL",Hm[Hm.SOLIDITY=63]="SOLIDITY",Hm[Hm.ADA=64]="ADA",Hm[Hm.OCAML_INTERFACE=65]="OCAML_INTERFACE",Im.util.setEnumType($m,"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 Wm=class e extends sh{constructor(e){super(),n(this,"completionId",""),n(this,"text",""),n(this,"prefix",""),n(this,"stop",""),n(this,"score",0),n(this,"tokens",[]),n(this,"decodedTokens",[]),n(this,"probabilities",[]),n(this,"adjustedProbabilities",[]),n(this,"generatedLength",xh.zero),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(Wm,"runtime",Im),n(Wm,"typeName","exa.codeium_common_pb.Completion"),n(Wm,"fields",Im.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 qm=Wm;const Ym=class e extends sh{constructor(e){super(),n(this,"ideName",""),n(this,"ideVersion",""),n(this,"extensionName",""),n(this,"extensionVersion",""),n(this,"apiKey",""),n(this,"locale",""),n(this,"sessionId",""),n(this,"requestId",xh.zero),n(this,"userAgent",""),n(this,"url",""),n(this,"authSource",Lm.CODEIUM),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(Ym,"runtime",Im),n(Ym,"typeName","exa.codeium_common_pb.Metadata"),n(Ym,"fields",Im.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:Im.getEnumType(Lm)}])));let Xm=Ym;const Km=class e extends sh{constructor(e){super(),n(this,"tabSize",xh.zero),n(this,"insertSpaces",!1),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(Km,"runtime",Im),n(Km,"typeName","exa.codeium_common_pb.EditorOptions"),n(Km,"fields",Im.util.newFieldList((()=>[{no:1,name:"tab_size",kind:"scalar",T:4},{no:2,name:"insert_spaces",kind:"scalar",T:8}])));let Jm=Km;e=class extends sh{constructor(e){super(),n(this,"eventType",Bm.UNSPECIFIED),n(this,"eventJson",""),n(this,"timestampUnixMs",xh.zero),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}},n(e,"runtime",Im),n(e,"typeName","exa.codeium_common_pb.Event"),n(e,"fields",Im.util.newFieldList((()=>[{no:1,name:"event_type",kind:"enum",T:Im.getEnumType(Bm)},{no:2,name:"event_json",kind:"scalar",T:9},{no:3,name:"timestamp_unix_ms",kind:"scalar",T:3}])));class Zm extends xn{constructor(e,t){super(),n(this,"index"),n(this,"total"),this.index=e,this.total=t}toDOM(){const e=document.createElement("span");e.setAttribute("aria-hidden","true"),e.className="cm-codeium-cycle";const t=e.appendChild(document.createElement("span"));t.className="cm-codeium-cycle-explanation",t.innerText=`${this.index+1}/${this.total}`;const n=e.appendChild(document.createElement("button"));return n.className="cm-codeium-cycle-key",n.innerText="→ (Ctrl ])",n.dataset.action="codeium-cycle",e}ignoreEvent(){return!1}}const Qm=yn.define({combine:e=>bn(e,{language:$m.TYPESCRIPT,timeout:150,widgetClass:Zm,alwaysOn:!0},{})}),ef=yn.define({combine:e=>bn(e,{override:()=>[]},{})}),tf=Kt.mark({class:"cm-ghostText"}),nf=Xt.define({create:e=>null,update(e,t){var n;const o=t.state.facet(Qm);for(const r of t.effects){if(r.is(qu)){const{changeSpecs:e,index:t}=r.value,a=e[t].map((e=>tf.range(e.absoluteStartPos,e.absoluteEndPos))),s=null==(n=a.at(-1))?void 0:n.to;return{index:t,decorations:Kt.set([...a,...void 0!==s&&e.length>1&&o.widgetClass?[Kt.widget({widget:new o.widgetClass(t,e.length),side:1}).range(s)]:[]]),changeSpecs:e,reverseChangeSet:r.value.reverseChangeSet}}if(r.is(Yu))return null;if(r.is(Xu))return null}return e?{...e,decorations:e.decorations.map(t.changes),reverseChangeSet:e.reverseChangeSet.map(t.changes)}:e},provide:e=>qt.decorations.from(e,(e=>(null==e?void 0:e.decorations)||Kt.none))}),of=wn.define(),rf=wn.define();var af,sf;function lf(e){const t=af[e];return"string"!=typeof t?e.toString():t[0].toLowerCase()+t.substring(1).replace(/[A-Z]/g,(e=>"_"+e.toLowerCase()))}let cf;(sf=af||(af={}))[sf.Canceled=1]="Canceled",sf[sf.Unknown=2]="Unknown",sf[sf.InvalidArgument=3]="InvalidArgument",sf[sf.DeadlineExceeded=4]="DeadlineExceeded",sf[sf.NotFound=5]="NotFound",sf[sf.AlreadyExists=6]="AlreadyExists",sf[sf.PermissionDenied=7]="PermissionDenied",sf[sf.ResourceExhausted=8]="ResourceExhausted",sf[sf.FailedPrecondition=9]="FailedPrecondition",sf[sf.Aborted=10]="Aborted",sf[sf.OutOfRange=11]="OutOfRange",sf[sf.Unimplemented=12]="Unimplemented",sf[sf.Internal=13]="Internal",sf[sf.Unavailable=14]="Unavailable",sf[sf.DataLoss=15]="DataLoss",sf[sf.Unauthenticated=16]="Unauthenticated";class df extends Error{constructor(e,t=af.Unknown,n,o,r){super(function(e,t){return e.length?`[${lf(t)}] ${e}`:`[${lf(t)}]`}(e,t)),this.name="ConnectError",Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=e,this.code=t,this.metadata=new Headers(null!=n?n:{}),this.details=null!=o?o:[],this.cause=r}static from(e,t=af.Unknown){return e instanceof df?e:e instanceof Error?"AbortError"==e.name?new df(e.message,af.Canceled):new df(e.message,t,void 0,void 0,e):new df(String(e),t,void 0,void 0,e)}static[Symbol.hasInstance](e){return e instanceof Error&&(Object.getPrototypeOf(e)===df.prototype||"ConnectError"===e.name&&"code"in e&&"number"==typeof e.code&&"metadata"in e&&"details"in e&&Array.isArray(e.details)&&"rawMessage"in e&&"string"==typeof e.rawMessage&&"cause"in e)}findDetails(e){const t="typeName"in e?{findMessage:t=>t===e.typeName?e:void 0}:e,n=[];for(const r of this.details){if("getType"in r){t.findMessage(r.getType().typeName)&&n.push(r);continue}const e=t.findMessage(r.type);if(e)try{n.push(e.fromBinary(r.value))}catch(o){}}return n}}var uf=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(n){t[n]=e[n]&&function(t){return new Promise((function(o,r){(function(e,t,n,o){Promise.resolve(o).then((function(t){e({value:t,done:n})}),t)})(o,r,(t=e[n](t)).done,t.value)}))}}},hf=function(e){return this instanceof hf?(this.v=e,this):new hf(e)},mf=function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(e,t||[]),a=[];return o={},s("next"),s("throw"),s("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),o[Symbol.asyncIterator]=function(){return this},o;function s(e,t){r[e]&&(o[e]=function(t){return new Promise((function(n,o){a.push([e,t,n,o])>1||i(e,t)}))},t&&(o[e]=t(o[e])))}function i(e,t){try{(n=r[e](t)).value instanceof hf?Promise.resolve(n.value.v).then(l,c):d(a[0][2],n)}catch(o){d(a[0][3],o)}var n}function l(e){i("next",e)}function c(e){i("throw",e)}function d(e,t){e(t),a.shift(),a.length&&i(a[0][0],a[0][1])}};function ff(e){return mf(this,arguments,(function*(){yield hf(yield*function(e){var t,n;return t={},o("next"),o("throw",(function(e){throw e})),o("return"),t[Symbol.iterator]=function(){return this},t;function o(o,r){t[o]=e[o]?function(t){return(n=!n)?{value:hf(e[o](t)),done:!1}:r?r(t):t}:r}}(uf(e)))}))}var pf=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(n){t[n]=e[n]&&function(t){return new Promise((function(o,r){(function(e,t,n,o){Promise.resolve(o).then((function(t){e({value:t,done:n})}),t)})(o,r,(t=e[n](t)).done,t.value)}))}}},gf=function(e){return this instanceof gf?(this.v=e,this):new gf(e)},vf=function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(e,t||[]),a=[];return o={},s("next"),s("throw"),s("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),o[Symbol.asyncIterator]=function(){return this},o;function s(e,t){r[e]&&(o[e]=function(t){return new Promise((function(n,o){a.push([e,t,n,o])>1||i(e,t)}))},t&&(o[e]=t(o[e])))}function i(e,t){try{(n=r[e](t)).value instanceof gf?Promise.resolve(n.value.v).then(l,c):d(a[0][2],n)}catch(o){d(a[0][3],o)}var n}function l(e){i("next",e)}function c(e){i("throw",e)}function d(e,t){e(t),a.shift(),a.length&&i(a[0][0],a[0][1])}};function xf(e,t){const n=function(){var n,o;return vf(this,arguments,(function*(){const r=yield gf(e);null===(n=null==t?void 0:t.onHeader)||void 0===n||n.call(t,r.header),yield gf(yield*function(e){var t,n;return t={},o("next"),o("throw",(function(e){throw e})),o("return"),t[Symbol.iterator]=function(){return this},t;function o(o,r){t[o]=e[o]?function(t){return(n=!n)?{value:gf(e[o](t)),done:!1}:r?r(t):t}:r}}(pf(r.message))),null===(o=null==t?void 0:t.onTrailer)||void 0===o||o.call(t,r.trailer)}))}()[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({next:()=>n.next()})}}function yf(e){if(!e.aborted)return;if(void 0!==e.reason)return e.reason;const t=new Error("This operation was aborted");return t.name="AbortError",t}function bf(){return{get(e){return e.id in this?this[e.id]:e.defaultValue},set(e,t){return this[e.id]=t,this},delete(e){return delete this[e.id],this}}}function wf(e,t,n){const o="string"==typeof t?t:t.typeName,r="string"==typeof n?n:n.name;return e.toString().replace(/\/?$/,`/${o}/${r}`)}function kf(e,t){return t instanceof e?t:new e(t)}function Nf(e,t){function n(t){return!0===t.done?t:{done:t.done,value:kf(e,t.value)}}return{[Symbol.asyncIterator](){const e=t[Symbol.asyncIterator](),o={next:()=>e.next().then(n)};return void 0!==e.throw&&(o.throw=t=>e.throw(t).then(n)),void 0!==e.return&&(o.return=t=>e.return(t).then(n)),o}}}function Cf(e,t){var n;return null!==(n=null==t?void 0:t.concat().reverse().reduce(((e,t)=>t(e)),e))&&void 0!==n?n:e}function Ef(e){var t;const n=Object.assign({},e);return null!==(t=n.ignoreUnknownFields)&&void 0!==t||(n.ignoreUnknownFields=!0),n}function Sf(e,t,n,o){const r=t?jf(e.I,o):_f(e.I,n);return{parse:(t?jf(e.O,o):_f(e.O,n)).parse,serialize:r.serialize}}function jf(e,t){return{parse(n){try{return e.fromBinary(n,t)}catch(o){const e=o instanceof Error?o.message:String(o);throw new df(`parse binary: ${e}`,af.InvalidArgument)}},serialize(e){try{return e.toBinary(t)}catch(n){const e=n instanceof Error?n.message:String(n);throw new df(`serialize binary: ${e}`,af.Internal)}}}}function _f(e,t){var n,o;const r=null!==(n=null==t?void 0:t.textEncoder)&&void 0!==n?n:new TextEncoder,a=null!==(o=null==t?void 0:t.textDecoder)&&void 0!==o?o:new TextDecoder,s=Ef(t);return{parse(t){try{const n=a.decode(t);return e.fromJsonString(n,s)}catch(n){throw df.from(n,af.InvalidArgument)}},serialize(e){try{const t=e.toJsonString(s);return r.encode(t)}catch(t){throw df.from(t,af.Internal)}}}}const If=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i;function Af(e,t,n){if(t&&new Headers(t).forEach(((e,t)=>n.metadata.append(t,e))),"object"!=typeof e||null==e||Array.isArray(e)||!("code"in e)||"string"!=typeof e.code)throw n;const o=function(e){if(!cf){cf={};for(const e of Object.values(af))"string"!=typeof e&&(cf[lf(e)]=e)}return cf[e]}(e.code);if(void 0===o)throw n;const r=e.message;if(null!=r&&"string"!=typeof r)throw n;const a=new df(null!=r?r:"",o,t);if("details"in e&&Array.isArray(e.details))for(const i of e.details){if(null===i||"object"!=typeof i||Array.isArray(i)||"string"!=typeof i.type||"string"!=typeof i.value||"debug"in i&&"object"!=typeof i.debug)throw n;try{a.details.push({type:i.type,value:Oh.dec(i.value),debug:i.debug})}catch(s){throw n}}return a}function Mf(e){const t=new df("invalid end stream",af.InvalidArgument);let n;try{n=JSON.parse("string"==typeof e?e:(new TextDecoder).decode(e))}catch(r){throw t}if("object"!=typeof n||null==n||Array.isArray(n))throw t;const o=new Headers;if("metadata"in n){if("object"!=typeof n.metadata||null==n.metadata||Array.isArray(n.metadata))throw t;for(const[e,r]of Object.entries(n.metadata)){if(!Array.isArray(r)||r.some((e=>"string"!=typeof e)))throw t;for(const t of r)o.append(e,t)}}return{metadata:o,error:"error"in n?Af(n.error,o,t):void 0}}const Tf="Content-Type",Of="Content-Length",Df="Content-Encoding",Rf="Accept-Encoding",Pf="Connect-Protocol-Version";function Ff(e){const t=new Headers,n=new Headers;return e.forEach(((e,o)=>{o.toLowerCase().startsWith("trailer-")?n.set(o.substring(8),e):t.set(o,e)})),[t,n]}function Lf(e,t,n,o,r){const a=new Headers(null!=o?o:{});return void 0!==n&&a.set("Connect-Timeout-Ms",`${n}`),a.set(Tf,e==Tm.Unary?t?"application/proto":"application/json":t?"application/connect+proto":"application/connect+json"),a.set(Pf,"1"),a}function zf(e,t,n){const o=function(e){const t=null==e?void 0:e.match(If);if(!t)return;return{stream:!!t[1],binary:!!t[3]}}(n.get("Content-Type"));if(200!==t){const r=new df(`HTTP ${t}`,function(e){switch(e){case 400:return af.InvalidArgument;case 401:return af.Unauthenticated;case 403:return af.PermissionDenied;case 404:return af.Unimplemented;case 408:return af.DeadlineExceeded;case 409:return af.Aborted;case 412:return af.FailedPrecondition;case 413:case 431:return af.ResourceExhausted;case 415:return af.Internal;case 429:case 502:case 503:case 504:return af.Unavailable;default:return af.Unknown}}(t),n);if(e==Tm.Unary&&o&&!o.binary)return{isUnaryError:!0,unaryError:r};throw r}return{isUnaryError:!1}}const Bf="application/";function Uf(e,t,n){let o="?connect=v1";const r=e.header.get(Tf);0===(null==r?void 0:r.indexOf(Bf))&&(o+="&encoding="+encodeURIComponent(r.slice(12)));const a=e.header.get(Df);null!==a&&"identity"!==a&&(o+="&compression="+encodeURIComponent(a),n=!0),n&&(o+="&base64=1"),o+="&message="+function(e,t){return t?Oh.enc(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):encodeURIComponent((new TextDecoder).decode(e))}(t,n);const s=e.url+o,i=new Headers(e.header);return[Pf,Tf,Of,Df,Rf].forEach((e=>i.delete(e))),Object.assign(Object.assign({},e),{init:Object.assign(Object.assign({},e.init),{method:"GET"}),url:s,header:i})}function Vf(e){const{signal:t,cleanup:n}=function(e){const t=new AbortController,n=()=>{t.abort(new df("the operation timed out",af.DeadlineExceeded))};let o;return void 0!==e&&(e<=0?n():o=setTimeout(n,e)),{signal:t.signal,cleanup:()=>clearTimeout(o)}}(e.timeoutMs),o=function(...e){const t=new AbortController,n=e.filter((e=>void 0!==e)).concat(t.signal);for(const r of n){if(r.aborted){o.apply(r);break}r.addEventListener("abort",o)}function o(){t.signal.aborted||t.abort(yf(this));for(const e of n)e.removeEventListener("abort",o)}return t}(e.signal,t);return[o.signal,function(e){const r=df.from(t.aborted?yf(t):e);return o.abort(r),n(),Promise.reject(r)},function(){n(),o.abort()}]}var Gf,$f,Hf,Wf,qf,Yf;($f=Gf||(Gf={}))[$f.UNSPECIFIED=0]="UNSPECIFIED",$f[$f.INACTIVE=1]="INACTIVE",$f[$f.PROCESSING=2]="PROCESSING",$f[$f.SUCCESS=3]="SUCCESS",$f[$f.WARNING=4]="WARNING",$f[$f.ERROR=5]="ERROR",Im.util.setEnumType(Gf,"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"}]),(Wf=Hf||(Hf={}))[Wf.UNSPECIFIED=0]="UNSPECIFIED",Wf[Wf.SINGLE=1]="SINGLE",Wf[Wf.MULTI=2]="MULTI",Im.util.setEnumType(Hf,"exa.language_server_pb.LineType",[{no:0,name:"LINE_TYPE_UNSPECIFIED"},{no:1,name:"LINE_TYPE_SINGLE"},{no:2,name:"LINE_TYPE_MULTI"}]),(Yf=qf||(qf={}))[Yf.UNSPECIFIED=0]="UNSPECIFIED",Yf[Yf.INLINE=1]="INLINE",Yf[Yf.BLOCK=2]="BLOCK",Yf[Yf.INLINE_MASK=3]="INLINE_MASK",Im.util.setEnumType(qf,"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 Xf=class e extends sh{constructor(e){super(),n(this,"threshold",0),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(Xf,"runtime",Im),n(Xf,"typeName","exa.language_server_pb.MultilineConfig"),n(Xf,"fields",Im.util.newFieldList((()=>[{no:1,name:"threshold",kind:"scalar",T:2}])));let Kf=Xf;const Jf=class e extends sh{constructor(e){super(),n(this,"metadata"),n(this,"document"),n(this,"editorOptions"),n(this,"otherDocuments",[]),n(this,"experimentConfig"),n(this,"modelName",""),n(this,"multilineConfig"),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(Jf,"runtime",Im),n(Jf,"typeName","exa.language_server_pb.GetCompletionsRequest"),n(Jf,"fields",Im.util.newFieldList((()=>[{no:1,name:"metadata",kind:"message",T:Xm},{no:2,name:"document",kind:"message",T:hp},{no:3,name:"editor_options",kind:"message",T:Jm},{no:5,name:"other_documents",kind:"message",T:hp,repeated:!0},{no:7,name:"experiment_config",kind:"message",T:fp},{no:10,name:"model_name",kind:"scalar",T:9},{no:13,name:"multiline_config",kind:"message",T:Kf}])));let Zf=Jf;const Qf=class e extends sh{constructor(e){super(),n(this,"state"),n(this,"completionItems",[]),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(Qf,"runtime",Im),n(Qf,"typeName","exa.language_server_pb.GetCompletionsResponse"),n(Qf,"fields",Im.util.newFieldList((()=>[{no:1,name:"state",kind:"message",T:gp},{no:2,name:"completion_items",kind:"message",T:Cp,repeated:!0}])));let ep=Qf;const tp=class e extends sh{constructor(e){super(),n(this,"metadata"),n(this,"completionId",""),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(tp,"runtime",Im),n(tp,"typeName","exa.language_server_pb.AcceptCompletionRequest"),n(tp,"fields",Im.util.newFieldList((()=>[{no:1,name:"metadata",kind:"message",T:Xm},{no:2,name:"completion_id",kind:"scalar",T:9}])));let np=tp;const op=class e extends sh{constructor(e){super(),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(op,"runtime",Im),n(op,"typeName","exa.language_server_pb.AcceptCompletionResponse"),n(op,"fields",Im.util.newFieldList((()=>[])));let rp=op;const ap=class e extends sh{constructor(e){super(),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(ap,"runtime",Im),n(ap,"typeName","exa.language_server_pb.GetAuthTokenRequest"),n(ap,"fields",Im.util.newFieldList((()=>[])));let sp=ap;const ip=class e extends sh{constructor(e){super(),n(this,"authToken",""),n(this,"uuid",""),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(ip,"runtime",Im),n(ip,"typeName","exa.language_server_pb.GetAuthTokenResponse"),n(ip,"fields",Im.util.newFieldList((()=>[{no:1,name:"auth_token",kind:"scalar",T:9},{no:2,name:"uuid",kind:"scalar",T:9}])));let lp=ip;const cp=class e extends sh{constructor(e){super(),n(this,"row",xh.zero),n(this,"col",xh.zero),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(cp,"runtime",Im),n(cp,"typeName","exa.language_server_pb.DocumentPosition"),n(cp,"fields",Im.util.newFieldList((()=>[{no:1,name:"row",kind:"scalar",T:4},{no:2,name:"col",kind:"scalar",T:4}])));let dp=cp;const up=class e extends sh{constructor(e){super(),n(this,"absolutePath",""),n(this,"relativePath",""),n(this,"text",""),n(this,"editorLanguage",""),n(this,"language",$m.UNSPECIFIED),n(this,"cursorOffset",xh.zero),n(this,"cursorPosition"),n(this,"lineEnding",""),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(up,"runtime",Im),n(up,"typeName","exa.language_server_pb.Document"),n(up,"fields",Im.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:Im.getEnumType($m)},{no:6,name:"cursor_offset",kind:"scalar",T:4},{no:8,name:"cursor_position",kind:"message",T:dp},{no:7,name:"line_ending",kind:"scalar",T:9}])));let hp=up;const mp=class e extends sh{constructor(e){super(),n(this,"forceEnableExperiments",[]),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(mp,"runtime",Im),n(mp,"typeName","exa.language_server_pb.ExperimentConfig"),n(mp,"fields",Im.util.newFieldList((()=>[{no:1,name:"force_enable_experiments",kind:"enum",T:Im.getEnumType(Pm),repeated:!0}])));let fp=mp;const pp=class e extends sh{constructor(e){super(),n(this,"state",Gf.UNSPECIFIED),n(this,"message",""),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(pp,"runtime",Im),n(pp,"typeName","exa.language_server_pb.State"),n(pp,"fields",Im.util.newFieldList((()=>[{no:1,name:"state",kind:"enum",T:Im.getEnumType(Gf)},{no:2,name:"message",kind:"scalar",T:9}])));let gp=pp;const vp=class e extends sh{constructor(e){super(),n(this,"startOffset",xh.zero),n(this,"endOffset",xh.zero),n(this,"startPosition"),n(this,"endPosition"),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(vp,"runtime",Im),n(vp,"typeName","exa.language_server_pb.Range"),n(vp,"fields",Im.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:dp},{no:4,name:"end_position",kind:"message",T:dp}])));let xp=vp;const yp=class e extends sh{constructor(e){super(),n(this,"text",""),n(this,"deltaCursorOffset",xh.zero),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(yp,"runtime",Im),n(yp,"typeName","exa.language_server_pb.Suffix"),n(yp,"fields",Im.util.newFieldList((()=>[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"delta_cursor_offset",kind:"scalar",T:3}])));let bp=yp;const wp=class e extends sh{constructor(e){super(),n(this,"text",""),n(this,"offset",xh.zero),n(this,"type",qf.UNSPECIFIED),n(this,"prefix",""),n(this,"line",xh.zero),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(wp,"runtime",Im),n(wp,"typeName","exa.language_server_pb.CompletionPart"),n(wp,"fields",Im.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:Im.getEnumType(qf)},{no:4,name:"prefix",kind:"scalar",T:9},{no:5,name:"line",kind:"scalar",T:4}])));let kp=wp;const Np=class e extends sh{constructor(e){super(),n(this,"completion"),n(this,"suffix"),n(this,"range"),n(this,"source",Vm.UNSPECIFIED),n(this,"completionParts",[]),Im.util.initPartial(e,this)}static fromBinary(t,n){return(new e).fromBinary(t,n)}static fromJson(t,n){return(new e).fromJson(t,n)}static fromJsonString(t,n){return(new e).fromJsonString(t,n)}static equals(t,n){return Im.util.equals(e,t,n)}};n(Np,"runtime",Im),n(Np,"typeName","exa.language_server_pb.CompletionItem"),n(Np,"fields",Im.util.newFieldList((()=>[{no:1,name:"completion",kind:"message",T:qm},{no:5,name:"suffix",kind:"message",T:bp},{no:2,name:"range",kind:"message",T:xp},{no:3,name:"source",kind:"enum",T:Im.getEnumType(Vm)},{no:8,name:"completion_parts",kind:"message",T:kp,repeated:!0}])));let Cp=Np;const Ep={typeName:"exa.language_server_pb.LanguageServerService",methods:{getCompletions:{name:"GetCompletions",I:Zf,O:ep,kind:Tm.Unary},acceptCompletion:{name:"AcceptCompletion",I:np,O:rp,kind:Tm.Unary},getAuthToken:{name:"GetAuthToken",I:sp,O:lp,kind:Tm.Unary}}};var Sp=function(e){return this instanceof Sp?(this.v=e,this):new Sp(e)},jp=function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(e,t||[]),a=[];return o={},s("next"),s("throw"),s("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),o[Symbol.asyncIterator]=function(){return this},o;function s(e,t){r[e]&&(o[e]=function(t){return new Promise((function(n,o){a.push([e,t,n,o])>1||i(e,t)}))},t&&(o[e]=t(o[e])))}function i(e,t){try{(n=r[e](t)).value instanceof Sp?Promise.resolve(n.value.v).then(l,c):d(a[0][2],n)}catch(o){d(a[0][3],o)}var n}function l(e){i("next",e)}function c(e){i("throw",e)}function d(e,t){e(t),a.shift(),a.length&&i(a[0][0],a[0][1])}};const _p=function(e){var t;!function(){try{new Headers}catch(e){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=null!==(t=e.useBinaryFormat)&&void 0!==t&&t;return{async unary(t,o,r,a,s,i,l){var c;const{serialize:d,parse:u}=Sf(o,n,e.jsonOptions,e.binaryOptions);return a=void 0===a?e.defaultTimeoutMs:a<=0?void 0:a,await function(e){const t=Cf(e.next,e.interceptors),[n,o,r]=Vf(e);return t(Object.assign(Object.assign({},e.req),{message:kf(e.req.method.I,e.req.message),signal:n})).then((e=>(r(),e)),o)}({interceptors:e.interceptors,signal:r,timeoutMs:a,req:{stream:!1,service:t,method:o,url:wf(e.baseUrl,t,o),init:{method:"POST",credentials:null!==(c=e.credentials)&&void 0!==c?c:"same-origin",redirect:"error",mode:"cors"},header:Lf(o.kind,n,a,s),contextValues:null!=l?l:bf(),message:i},next:async r=>{var a;let s=null;!0===e.useHttpGet&&o.idempotency===Dm.NoSideEffects?r=Uf(r,d(r.message),n):s=d(r.message);const i=null!==(a=e.fetch)&&void 0!==a?a:globalThis.fetch,l=await i(r.url,Object.assign(Object.assign({},r.init),{headers:r.header,signal:r.signal,body:s})),{isUnaryError:c,unaryError:h}=zf(o.kind,l.status,l.headers);if(c)throw Af(await l.json(),function(...e){const t=new Headers;for(const n of e)n.forEach(((e,n)=>{t.append(n,e)}));return t}(...Ff(l.headers)),h);const[m,f]=Ff(l.headers);return{stream:!1,service:t,method:o,header:m,message:n?u(new Uint8Array(await l.arrayBuffer())):o.O.fromJson(await l.json(),Ef(e.jsonOptions)),trailer:f}}})},async stream(t,o,r,a,s,i,l){var c;const{serialize:d,parse:u}=Sf(o,n,e.jsonOptions,e.binaryOptions);function h(e,t,n){return jp(this,arguments,(function*(){const o=function(e){let t,n=new Uint8Array(0);function o(e){const t=new Uint8Array(n.length+e.length);t.set(n),t.set(e,n.length),n=t}return new ReadableStream({start(){t=e.getReader()},async pull(e){let r;for(;;){if(void 0===r&&n.byteLength>=5){let e=0;for(let t=1;t<5;t++)e=(e<<8)+n[t];r={flags:n[0],length:e}}if(void 0!==r&&n.byteLength>=r.length+5)break;const e=await t.read();if(e.done)break;o(e.value)}if(void 0===r)return 0==n.byteLength?void e.close():void e.error(new df("premature end of stream",af.DataLoss));const a=n.subarray(5,5+r.length);n=n.subarray(5+r.length),e.enqueue({flags:r.flags,data:a})}})}(e).getReader();let r=!1;for(;;){const e=yield Sp(o.read());if(e.done)break;const{flags:a,data:s}=e.value;if(2&~a)yield yield Sp(u(s));else{r=!0;const e=Mf(s);if(e.error){const t=e.error;throw n.forEach(((e,n)=>{t.metadata.append(n,e)})),t}e.metadata.forEach(((e,n)=>t.set(n,e)))}}if(!r)throw"missing EndStreamResponse"}))}async function m(e){if(o.kind!=Tm.ServerStreaming)throw"The fetch API does not support streaming request bodies";const t=await e[Symbol.asyncIterator]().next();if(1==t.done)throw"missing request message";return function(e,t){const n=new Uint8Array(t.length+5);n.set(t,5);const o=new DataView(n.buffer,n.byteOffset,n.byteLength);return o.setUint8(0,e),o.setUint32(1,t.length),n}(0,d(t.value))}return a=void 0===a?e.defaultTimeoutMs:a<=0?void 0:a,await function(e){const t=Cf(e.next,e.interceptors),[n,o,r]=Vf(e),a=Object.assign(Object.assign({},e.req),{message:Nf(e.req.method.I,e.req.message),signal:n});let s=!1;return n.addEventListener("abort",(function(){var t,n;const o=e.req.message[Symbol.asyncIterator]();s||null===(t=o.throw)||void 0===t||t.call(o,this.reason).catch((()=>{})),null===(n=o.return)||void 0===n||n.call(o).catch((()=>{}))})),t(a).then((e=>Object.assign(Object.assign({},e),{message:{[Symbol.asyncIterator](){const t=e.message[Symbol.asyncIterator]();return{next:()=>t.next().then((e=>(1==e.done&&(s=!0,r()),e)),o)}}}})),o)}({interceptors:e.interceptors,timeoutMs:a,signal:r,req:{stream:!0,service:t,method:o,url:wf(e.baseUrl,t,o),init:{method:"POST",credentials:null!==(c=e.credentials)&&void 0!==c?c:"same-origin",redirect:"error",mode:"cors"},header:Lf(o.kind,n,a,s),contextValues:null!=l?l:bf(),message:i},next:async t=>{var n;const r=null!==(n=e.fetch)&&void 0!==n?n:globalThis.fetch,a=await r(t.url,Object.assign(Object.assign({},t.init),{headers:t.header,signal:t.signal,body:await m(t.message)}));if(zf(o.kind,a.status,a.headers),null===a.body)throw"missing response body";const s=new Headers;return Object.assign(Object.assign({},t),{header:a.headers,trailer:s,message:h(a.body,s,a.headers)})}})}}}({baseUrl:"https://web-backend.codeium.com",useBinaryFormat:!0}),Ip=(Mp=_p,function(e,t){const n={};for(const[o,r]of Object.entries(e.methods)){const a=t(Object.assign(Object.assign({},r),{localName:o,service:e}));null!=a&&(n[o]=a)}return n}(Ap=Ep,(e=>{switch(e.kind){case Tm.Unary:return function(e,t,n){return async function(o,r){var a,s;const i=await e.unary(t,n,null==r?void 0:r.signal,null==r?void 0:r.timeoutMs,null==r?void 0:r.headers,o,null==r?void 0:r.contextValues);return null===(a=null==r?void 0:r.onHeader)||void 0===a||a.call(r,i.header),null===(s=null==r?void 0:r.onTrailer)||void 0===s||s.call(r,i.trailer),i.message}}(Mp,Ap,e);case Tm.ServerStreaming:return function(e,t,n){return function(o,r){return xf(e.stream(t,n,null==r?void 0:r.signal,null==r?void 0:r.timeoutMs,null==r?void 0:r.headers,ff([o]),null==r?void 0:r.contextValues),r)}}(Mp,Ap,e);case Tm.ClientStreaming:return function(e,t,n){return async function(o,r){var a,s,i,l,c,d;const u=await e.stream(t,n,null==r?void 0:r.signal,null==r?void 0:r.timeoutMs,null==r?void 0:r.headers,o,null==r?void 0:r.contextValues);let h;null===(c=null==r?void 0:r.onHeader)||void 0===c||c.call(r,u.header);try{for(var m,f=!0,p=pf(u.message);!(a=(m=await p.next()).done);f=!0)l=m.value,f=!1,h=l}catch(g){s={error:g}}finally{try{f||a||!(i=p.return)||await i.call(p)}finally{if(s)throw s.error}}if(!h)throw new df("protocol error: missing response message",af.Internal);return null===(d=null==r?void 0:r.onTrailer)||void 0===d||d.call(r,u.trailer),h}}(Mp,Ap,e);case Tm.BiDiStreaming:return function(e,t,n){return function(o,r){return xf(e.stream(t,n,null==r?void 0:r.signal,null==r?void 0:r.timeoutMs,null==r?void 0:r.headers,o,null==r?void 0:r.contextValues),r)}}(Mp,Ap,e);default:return null}})));var Ap,Mp;let Tp;try{Tp=crypto.randomUUID()}catch{Tp=function(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(+e^(crypto.getRandomValues(new Uint8Array(1))[0]??0)&15>>+e/4).toString(16)))}()}async function Op(e,t){const n=e.state.facet(Qm),{override:o}=e.state.facet(ef),r=await o(),a=e.state,s=a.selection.main.head,i=a.doc.toString();try{const o=await async function({text:e,cursorOffset:t,config:n,otherDocuments:o}){return await Ip.getCompletions({metadata:{ideName:"web",ideVersion:"0.0.5",extensionName:"@valtown/codemirror-codeium",extensionVersion:"1.0.0",apiKey:n.apiKey,sessionId:Tp,authSource:n.authSource},document:{text:e,cursorOffset:BigInt(t),language:n.language,editorLanguage:"typescript",lineEnding:"\n"},editorOptions:{tabSize:2n,insertSpaces:!0},otherDocuments:o,multilineConfig:void 0},{headers:{Authorization:`Basic ${n.apiKey}-${Tp}`}})}({text:i,cursorOffset:s,config:n,otherDocuments:r});if(!o||0===o.completionItems.length)return;if(void 0!==t&&s!==t||"active"===kn(e.state)||!e.hasFocus)return;const l=o.completionItems.map((e=>{let t=0;return e.completionParts.filter((e=>3!==e.type)).map((e=>{const n=Number(e.offset),o=2===e.type?`\n${e.text}`:e.text,r={absoluteStartPos:t+n,absoluteEndPos:t+n+o.length,from:n,to:n,insert:o};return t+=o.length,r}))})),c=0,d=l.at(c);if(!d)return;const u=Nn.of(d,a.doc.length),h=u.invert(a.doc);e.dispatch({changes:u,effects:qu.of({index:c,reverseChangeSet:h,changeSpecs:l}),annotations:[rf.of(null),of.of(null),Cn.addToHistory.of(!1)]})}catch(l){console.warn("copilot completion failed",l),await new Promise((e=>setTimeout(e,300)))}}function Dp(){let e=null,t=0;return qt.updateListener.of((n=>{const o=n.view.state.facet(Qm);if(!o.alwaysOn)return;if(!function(e){return e.docChanged&&!e.transactions.some((e=>e.effects.some((e=>e.is(Yu)||e.is(Xu)))))}(n))return;if(e&&clearTimeout(e),function(e){if(!e.view.hasFocus)return!0;if(e.state.field(nf))return!0;if("active"===kn(e.state))return!0;for(const t of e.transactions)if(void 0!==t.annotation(of))return!0}(n))return;const r=n.state.selection.main.head;o.shouldComplete&&!o.shouldComplete(new En(n.view.state,r,!1))||(e=setTimeout((async()=>{r===t&&await Op(n.view,t)}),o.timeout),t=r)}))}function Rp(e){var t;const n=e.state.field(nf);if(!n)return!1;const o=null==(t=n.reverseChangeSet)?void 0:t.invert(e.state.doc);e.dispatch({changes:n.reverseChangeSet,effects:Yu.of(null),annotations:[rf.of(null),of.of(null),Cn.addToHistory.of(!1)]});let r=0;return null==o||o.iterChangedRanges(((e,t,n,o)=>{r=o})),e.dispatch({changes:o,selection:Wt.cursor(r),annotations:[of.of(null),Cn.addToHistory.of(!0)]}),!0}const Pp=e=>{const{state:t}=e,n=t.field(nf);if(!n)return!1;const{changeSpecs:o}=n;if(o.length<2)return!1;const r=(n.index+1)%o.length,a=o.at(r);if(!a)return!1;const s=n.reverseChangeSet.apply(t.doc),i=Nn.of(n.reverseChangeSet,t.doc.length).compose(Nn.of(a,s.length)),l=Nn.of(a,s.length).invert(s);return e.dispatch({changes:i,effects:qu.of({index:r,reverseChangeSet:l,changeSpecs:o}),annotations:[rf.of(null),of.of(null),Cn.addToHistory.of(!1)]}),!0};function Fp(e){const t=e.state.field(nf);return!!t&&(e.dispatch({changes:t.reverseChangeSet,effects:Xu.of(null),annotations:[rf.of(null),of.of(null),Cn.addToHistory.of(!1)]}),!1)}function Lp(){return qt.domEventHandlers({keydown:(e,t)=>("]"!==e.key||!e.ctrlKey)&&("Shift"!==e.key&&"Control"!==e.key&&"Alt"!==e.key&&"Meta"!==e.key&&function(e,t){return!!e.state.field(nf)&&("Tab"===t?Rp(e):Fp(e))}(t,e.key)),mouseup(e,t){const n=e.target;return"BUTTON"===n.nodeName&&"codeium-cycle"===n.dataset.action?(Pp(t),e.stopPropagation(),e.preventDefault(),!0):function(e){var t,n;let o=!1;const r=null==(t=e.state.selection.asSingle().ranges.at(0))?void 0:t.head,a=e.state.field(nf);return!(void 0===r||!a)&&(null==(n=a.decorations)||n.between(r,r,(()=>{o=!0})),o)}(t)?Rp(t):Fp(t)}})}const zp=e=>{const t=[];return"codeium"===e.copilot&&e.codeium_api_key&&t.push(function(e){return[Qm.of(e),nf,vn.highest(fn.of([{key:"Ctrl-]",run:Pp}])),vn.highest(qt.updateListener.of((e=>{e.focusChanged&&Fp(e.view)}))),vn.high(Lp()),Dp()]}({apiKey:e.codeium_api_key,language:$m.PYTHON}),ef.of({override:async()=>[{text:Ti(""),language:$m.PYTHON,editorLanguage:"python"}]})),"github"===e.copilot&&t.push(Wu({delay:500,fetchFn:async e=>{if(!Di())return"";if(0===e.doc.length)return"";await new Promise((e=>setTimeout(e,20)));const t=e.doc.toString(),n=function(e,t){const n=e.doc.toString(),o=t.split("\n").length-n.split("\n").length,r=function(e,t){const n=e.lineAt(t);return{line:n.number-1,character:t-n.from}}(e.doc,e.selection.main.head);return r.line+=o,{doc:{source:t,tabSize:e.tabSize,indentSize:1,insertSpaces:!0,path:Pi,version:"replace_me",uri:`file://${Pi}`,relativePath:Pi,languageId:Fi,position:r}}}(e,Ti(t)),o=function(e,t,n){if(0===e.completions.length)return"";const{displayText:o,position:r}=e.completions[0],a=r.character-t.character,s=a<0?o.slice(-a):o,i=n.doc.sliceString(n.selection.main.head,n.doc.length);for(let l=0;l<s.length;l++){const e=s.slice(l);if(i.startsWith(e))return s.slice(0,l)}return s}(await Ri().getCompletion(n),n.doc.position,e);return o&&J.debug("Copilot suggestion:",o),o}})),[...t,Oi().slice(0,-2)]};const Bp=Kt.mark({class:"underline"}),Up=Yt.define(),Vp=Yt.define(),Gp=Xt.define({create:()=>Kt.none,update(e,t){let n=e.map(t.changes);for(const o of t.effects)o.is(Up)?n=e.update({add:[Bp.range(o.value.from,o.value.to)]}):o.is(Vp)&&(n=Kt.none);return n},provide:e=>qt.decorations.from(e)});class $p{constructor(e,t){this.view=void 0,this.commandClickMode=void 0,this.hoveredRange=void 0,this.onClick=void 0,this.keydown=e=>{"Meta"!==e.key&&"Control"!==e.key||(this.commandClickMode=!0,this.view.dom.addEventListener("mousemove",this.mousemove),this.view.dom.addEventListener("click",this.click))},this.keyup=e=>{"Meta"!==e.key&&"Control"!==e.key||this.exitCommandClickMode()},this.windowBlur=()=>{this.commandClickMode&&this.exitCommandClickMode()},this.mousemove=e=>{if(!e.metaKey&&!e.ctrlKey)return void this.exitCommandClickMode();if(!this.commandClickMode)return void this.clearUnderline();const t=this.view.posAtCoords({x:e.clientX,y:e.clientY});if(null==t)return void this.clearUnderline();const n=Sn(this.view.state).cursorAt(t);if("VariableName"===n.name){const{from:e,to:o}=n;if(this.hoveredRange&&this.hoveredRange.from===e&&this.hoveredRange.to===o)return;this.clearUnderline(),this.hoveredRange={from:e,to:o,position:t},this.view.dispatch({effects:Up.of(this.hoveredRange)})}else this.clearUnderline()},this.click=e=>{if(this.hoveredRange){const t=this.view.state.doc.sliceString(this.hoveredRange.from,this.hoveredRange.to);e.preventDefault(),e.stopPropagation(),this.onClick(this.view,t),this.view.dispatch({selection:{head:this.hoveredRange.position,anchor:this.hoveredRange.position}})}},this.view=e,this.commandClickMode=!1,this.hoveredRange=null,this.onClick=t,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:Vp.of(null)}),this.hoveredRange=null)}}const Hp=({variant:e,settings:t,styles:n})=>{const o=qt.theme({"&":{backgroundColor:t.background,color:t.foreground},".cm-content":{caretColor:t.caret},".cm-cursor, .cm-dropCursor":{borderLeftColor:t.caret},"&.cm-focused .cm-selectionBackgroundm .cm-selectionBackground, .cm-content ::selection":{backgroundColor:t.selection},".cm-activeLine":{backgroundColor:t.lineHighlight},".cm-gutters":{backgroundColor:t.gutterBackground,color:t.gutterForeground},".cm-activeLineGutter":{backgroundColor:t.lineHighlight}},{dark:"dark"===e}),r=_n.define(n);return[o,In(r)]};Hp({variant:"dark",settings:{background:"#200020",foreground:"#D0D0FF",caret:"#7070FF",selection:"#80000080",gutterBackground:"#200020",gutterForeground:"#C080C0",lineHighlight:"#80000040"},styles:[{tag:An.comment,color:"#404080"},{tag:[An.string,An.regexp],color:"#999999"},{tag:An.number,color:"#7090B0"},{tag:[An.bool,An.null],color:"#8080A0"},{tag:[An.punctuation,An.derefOperator],color:"#805080"},{tag:An.keyword,color:"#60B0FF"},{tag:An.definitionKeyword,color:"#B0FFF0"},{tag:An.moduleKeyword,color:"#60B0FF"},{tag:An.operator,color:"#A0A0FF"},{tag:[An.variableName,An.self],color:"#008080"},{tag:An.operatorKeyword,color:"#A0A0FF"},{tag:An.controlKeyword,color:"#80A0FF"},{tag:An.className,color:"#70E080"},{tag:[An.function(An.propertyName),An.propertyName],color:"#50A0A0"},{tag:An.tagName,color:"#009090"},{tag:An.modifier,color:"#B0FFF0"},{tag:[An.squareBracket,An.attributeName],color:"#D0D0FF"}]}),Hp({variant:"light",settings:{background:"#fcfcfc",foreground:"#5c6166",caret:"#ffaa33",selection:"#036dd626",gutterBackground:"#fcfcfc",gutterForeground:"#8a919966",lineHighlight:"#8a91991a"},styles:[{tag:An.comment,color:"#787b8099"},{tag:An.string,color:"#86b300"},{tag:An.regexp,color:"#4cbf99"},{tag:[An.number,An.bool,An.null],color:"#ffaa33"},{tag:An.variableName,color:"#5c6166"},{tag:[An.definitionKeyword,An.modifier],color:"#fa8d3e"},{tag:[An.keyword,An.special(An.brace)],color:"#fa8d3e"},{tag:An.operator,color:"#ed9366"},{tag:An.separator,color:"#5c6166b3"},{tag:An.punctuation,color:"#5c6166"},{tag:[An.definition(An.propertyName),An.function(An.variableName)],color:"#f2ae49"},{tag:[An.className,An.definition(An.typeName)],color:"#22a4e6"},{tag:[An.tagName,An.typeName,An.self,An.labelName],color:"#55b4d4"},{tag:An.angleBracket,color:"#55b4d480"},{tag:An.attributeName,color:"#f2ae49"}]}),Hp({variant:"dark",settings:{background:"#15191EFA",foreground:"#EEF2F7",caret:"#C4C4C4",selection:"#90B2D557",gutterBackground:"#15191EFA",gutterForeground:"#aaaaaa95",lineHighlight:"#57575712"},styles:[{tag:An.comment,color:"#6E6E6E"},{tag:[An.string,An.regexp,An.special(An.brace)],color:"#5C81B3"},{tag:An.number,color:"#C1E1B8"},{tag:An.bool,color:"#53667D"},{tag:[An.definitionKeyword,An.modifier,An.function(An.propertyName)],color:"#A3D295",fontWeight:"bold"},{tag:[An.keyword,An.moduleKeyword,An.operatorKeyword,An.operator],color:"#697A8E",fontWeight:"bold"},{tag:[An.variableName,An.attributeName],color:"#708E67"},{tag:[An.function(An.variableName),An.definition(An.propertyName),An.derefOperator],color:"#fff"},{tag:An.tagName,color:"#A3D295"}]}),Hp({variant:"dark",settings:{background:"#2e241d",foreground:"#BAAE9E",caret:"#A7A7A7",selection:"#DDF0FF33",gutterBackground:"#28211C",gutterForeground:"#BAAE9E90",lineHighlight:"#FFFFFF08"},styles:[{tag:An.comment,color:"#666666"},{tag:[An.string,An.special(An.brace)],color:"#54BE0D"},{tag:An.regexp,color:"#E9C062"},{tag:An.number,color:"#CF6A4C"},{tag:[An.keyword,An.operator],color:"#5EA6EA"},{tag:An.variableName,color:"#7587A6"},{tag:[An.definitionKeyword,An.modifier],color:"#F9EE98"},{tag:[An.propertyName,An.function(An.variableName)],color:"#937121"},{tag:[An.typeName,An.angleBracket,An.tagName],color:"#9B859D"}]}),Hp({variant:"dark",settings:{background:"#3b2627",foreground:"#E6E1C4",caret:"#E6E1C4",selection:"#16120E",gutterBackground:"#3b2627",gutterForeground:"#E6E1C490",lineHighlight:"#1F1611"},styles:[{tag:An.comment,color:"#6B4E32"},{tag:[An.keyword,An.operator,An.derefOperator],color:"#EF5D32"},{tag:An.className,color:"#EFAC32",fontWeight:"bold"},{tag:[An.typeName,An.propertyName,An.function(An.variableName),An.definition(An.variableName)],color:"#EFAC32"},{tag:An.definition(An.typeName),color:"#EFAC32",fontWeight:"bold"},{tag:An.labelName,color:"#EFAC32",fontWeight:"bold"},{tag:[An.number,An.bool],color:"#6C99BB"},{tag:[An.variableName,An.self],color:"#7DAF9C"},{tag:[An.string,An.special(An.brace),An.regexp],color:"#D9D762"},{tag:[An.angleBracket,An.tagName,An.attributeName],color:"#EFCB43"}]}),Hp({variant:"dark",settings:{background:"#000205",foreground:"#FFFFFF",caret:"#E60065",selection:"#E60C6559",gutterBackground:"#000205",gutterForeground:"#ffffff90",lineHighlight:"#4DD7FC1A"},styles:[{tag:An.comment,color:"#404040"},{tag:[An.string,An.special(An.brace),An.regexp],color:"#00D8FF"},{tag:An.number,color:"#E62286"},{tag:[An.variableName,An.attributeName,An.self],color:"#E62286",fontWeight:"bold"},{tag:An.function(An.variableName),color:"#fff",fontWeight:"bold"}]}),Hp({variant:"light",settings:{background:"#fff",foreground:"#000",caret:"#000",selection:"#BDD5FC",gutterBackground:"#fff",gutterForeground:"#00000070",lineHighlight:"#FFFBD1"},styles:[{tag:An.comment,color:"#BCC8BA"},{tag:[An.string,An.special(An.brace),An.regexp],color:"#5D90CD"},{tag:[An.number,An.bool,An.null],color:"#46A609"},{tag:An.keyword,color:"#AF956F"},{tag:[An.definitionKeyword,An.modifier],color:"#C52727"},{tag:[An.angleBracket,An.tagName,An.attributeName],color:"#606060"},{tag:An.self,color:"#000"}]}),Hp({variant:"dark",settings:{background:"#00254b",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#B36539BF",gutterBackground:"#00254b",gutterForeground:"#FFFFFF70",lineHighlight:"#00000059"},styles:[{tag:An.comment,color:"#0088FF"},{tag:An.string,color:"#3AD900"},{tag:An.regexp,color:"#80FFC2"},{tag:[An.number,An.bool,An.null],color:"#FF628C"},{tag:[An.definitionKeyword,An.modifier],color:"#FFEE80"},{tag:An.variableName,color:"#CCCCCC"},{tag:An.self,color:"#FF80E1"},{tag:[An.className,An.definition(An.propertyName),An.function(An.variableName),An.definition(An.typeName),An.labelName],color:"#FFDD00"},{tag:[An.keyword,An.operator],color:"#FF9D00"},{tag:[An.propertyName,An.typeName],color:"#80FFBB"},{tag:An.special(An.brace),color:"#EDEF7D"},{tag:An.attributeName,color:"#9EFFFF"},{tag:An.derefOperator,color:"#fff"}]}),Hp({variant:"dark",settings:{background:"#060521",foreground:"#E0E0E0",caret:"#FFFFFFA6",selection:"#122BBB",gutterBackground:"#060521",gutterForeground:"#E0E0E090",lineHighlight:"#FFFFFF0F"},styles:[{tag:An.comment,color:"#AEAEAE"},{tag:[An.string,An.special(An.brace),An.regexp],color:"#8DFF8E"},{tag:[An.className,An.definition(An.propertyName),An.function(An.variableName),An.function(An.definition(An.variableName)),An.definition(An.typeName)],color:"#A3EBFF"},{tag:[An.number,An.bool,An.null],color:"#62E9BD"},{tag:[An.keyword,An.operator],color:"#2BF1DC"},{tag:[An.definitionKeyword,An.modifier],color:"#F8FBB1"},{tag:[An.variableName,An.self],color:"#B683CA"},{tag:[An.angleBracket,An.tagName,An.typeName,An.propertyName],color:"#60A4F1"},{tag:An.derefOperator,color:"#E0E0E0"},{tag:An.attributeName,color:"#7BACCA"}]}),Hp({variant:"dark",settings:{background:"#2d2f3f",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"#44475a",gutterBackground:"#282a36",gutterForeground:"rgb(144, 145, 148)",lineHighlight:"#44475a"},styles:[{tag:An.comment,color:"#6272a4"},{tag:[An.string,An.special(An.brace)],color:"#f1fa8c"},{tag:[An.number,An.self,An.bool,An.null],color:"#bd93f9"},{tag:[An.keyword,An.operator],color:"#ff79c6"},{tag:[An.definitionKeyword,An.typeName],color:"#8be9fd"},{tag:An.definition(An.typeName),color:"#f8f8f2"},{tag:[An.className,An.definition(An.propertyName),An.function(An.variableName),An.attributeName],color:"#50fa7b"}]}),Hp({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#80C7FF",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#C1E2F8"},styles:[{tag:An.comment,color:"#AAAAAA"},{tag:[An.keyword,An.operator,An.typeName,An.tagName,An.propertyName],color:"#2F6F9F",fontWeight:"bold"},{tag:[An.attributeName,An.definition(An.propertyName)],color:"#4F9FD0"},{tag:[An.className,An.string,An.special(An.brace)],color:"#CF4F5F"},{tag:An.number,color:"#CF4F5F",fontWeight:"bold"},{tag:An.variableName,fontWeight:"bold"}]}),Hp({variant:"light",settings:{background:"#f2f1f8",foreground:"#0c006b",caret:"#5c49e9",selection:"#d5d1f2",gutterBackground:"#f2f1f8",gutterForeground:"#0c006b70",lineHighlight:"#e1def3"},styles:[{tag:An.comment,color:"#9995b7"},{tag:An.keyword,color:"#ff5792",fontWeight:"bold"},{tag:[An.definitionKeyword,An.modifier],color:"#ff5792"},{tag:[An.className,An.tagName,An.definition(An.typeName)],color:"#0094f0"},{tag:[An.number,An.bool,An.null,An.special(An.brace)],color:"#5842ff"},{tag:[An.definition(An.propertyName),An.function(An.variableName)],color:"#0095a8"},{tag:An.typeName,color:"#b3694d"},{tag:[An.propertyName,An.variableName],color:"#fa8900"},{tag:An.operator,color:"#ff5792"},{tag:An.self,color:"#e64100"},{tag:[An.string,An.regexp],color:"#00b368"},{tag:[An.paren,An.bracket],color:"#0431fa"},{tag:An.labelName,color:"#00bdd6"},{tag:An.attributeName,color:"#e64100"},{tag:An.angleBracket,color:"#9995b7"}]}),Hp({variant:"light",settings:{background:"#faf4ed",foreground:"#575279",caret:"#575279",selection:"#6e6a8614",gutterBackground:"#faf4ed",gutterForeground:"#57527970",lineHighlight:"#6e6a860d"},styles:[{tag:An.comment,color:"#9893a5"},{tag:[An.bool,An.null],color:"#286983"},{tag:An.number,color:"#d7827e"},{tag:An.className,color:"#d7827e"},{tag:[An.angleBracket,An.tagName,An.typeName],color:"#56949f"},{tag:An.attributeName,color:"#907aa9"},{tag:An.punctuation,color:"#797593"},{tag:[An.keyword,An.modifier],color:"#286983"},{tag:[An.string,An.regexp],color:"#ea9d34"},{tag:An.variableName,color:"#d7827e"}]}),Hp({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#FFFD0054",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#00000008"},styles:[{tag:An.comment,color:"#CFCFCF"},{tag:[An.number,An.bool,An.null],color:"#E66C29"},{tag:[An.className,An.definition(An.propertyName),An.function(An.variableName),An.labelName,An.definition(An.typeName)],color:"#2EB43B"},{tag:An.keyword,color:"#D8B229"},{tag:An.operator,color:"#4EA44E",fontWeight:"bold"},{tag:[An.definitionKeyword,An.modifier],color:"#925A47"},{tag:An.string,color:"#704D3D"},{tag:An.typeName,color:"#2F8996"},{tag:[An.variableName,An.propertyName],color:"#77ACB0"},{tag:An.self,color:"#77ACB0",fontWeight:"bold"},{tag:An.regexp,color:"#E3965E"},{tag:[An.tagName,An.angleBracket],color:"#BAA827"},{tag:An.attributeName,color:"#B06520"},{tag:An.derefOperator,color:"#000"}]}),Hp({variant:"light",settings:{background:"#fef7e5",foreground:"#586E75",caret:"#000000",selection:"#073642",gutterBackground:"#fef7e5",gutterForeground:"#586E7580",lineHighlight:"#EEE8D5"},styles:[{tag:An.comment,color:"#93A1A1"},{tag:An.string,color:"#2AA198"},{tag:An.regexp,color:"#D30102"},{tag:An.number,color:"#D33682"},{tag:An.variableName,color:"#268BD2"},{tag:[An.keyword,An.operator,An.punctuation],color:"#859900"},{tag:[An.definitionKeyword,An.modifier],color:"#073642",fontWeight:"bold"},{tag:[An.className,An.self,An.definition(An.propertyName)],color:"#268BD2"},{tag:An.function(An.variableName),color:"#268BD2"},{tag:[An.bool,An.null],color:"#B58900"},{tag:An.tagName,color:"#268BD2",fontWeight:"bold"},{tag:An.angleBracket,color:"#93A1A1"},{tag:An.attributeName,color:"#93A1A1"},{tag:An.typeName,color:"#859900"}]}),Hp({variant:"light",settings:{background:"#FFFFFF",foreground:"#4D4D4C",caret:"#AEAFAD",selection:"#D6D6D6",gutterBackground:"#FFFFFF",gutterForeground:"#4D4D4C80",lineHighlight:"#EFEFEF"},styles:[{tag:An.comment,color:"#8E908C"},{tag:[An.variableName,An.self,An.propertyName,An.attributeName,An.regexp],color:"#C82829"},{tag:[An.number,An.bool,An.null],color:"#F5871F"},{tag:[An.className,An.typeName,An.definition(An.typeName)],color:"#C99E00"},{tag:[An.string,An.special(An.brace)],color:"#718C00"},{tag:An.operator,color:"#3E999F"},{tag:[An.definition(An.propertyName),An.function(An.variableName)],color:"#4271AE"},{tag:An.keyword,color:"#8959A8"},{tag:An.derefOperator,color:"#4D4D4C"}]});const Wp=Hp({variant:"light",settings:{background:"#ffffff",foreground:"#000000",caret:"#000000",selection:"#d7d4f0",lineHighlight:"#cceeff44",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:An.comment,color:"#708090"},{tag:An.variableName,color:"#000000"},{tag:[An.string,An.special(An.brace)],color:"#a11"},{tag:An.number,color:"#164"},{tag:An.bool,color:"#219"},{tag:An.null,color:"#219"},{tag:An.keyword,color:"#708",fontWeight:500},{tag:An.className,color:"#00f"},{tag:An.definition(An.typeName),color:"#00f"},{tag:An.typeName,color:"#085"},{tag:An.angleBracket,color:"#000000"},{tag:An.tagName,color:"#170"},{tag:An.attributeName,color:"#00c"},{tag:An.operator,color:"#a2f",fontWeight:500},{tag:[An.function(An.variableName)],color:"#00c"},{tag:[An.propertyName],color:"#05a"}]});const qp=e=>{const{theme:t,hotkeys:n,completionConfig:o}=e;return[qt.lineWrapping,Rn(),Pn(),Fn(),Ln(),zn(),Bn(),Un(),Vn({position:"fixed",parent:document.querySelector("#App")??void 0}),Gn(),"dark"===t?$n:Wp,Hn(),zp(o),Wn(),qn(),vn.high(fn.of(Yn)),Xn(),Kn(),Jn.of(" "),In(Zn,{fallback:!0}),fn.of(Qn),eo(e),to.of(no()),oo.allowMultipleSelections.of(!0),Pu(n),fn.of([{key:"Tab",run:e=>ro(e)||(e=>{const{from:t,to:n}=e.state.selection.main;if(t!==n)return!1;const o=e.state.doc.lineAt(n);return""!==o.text.slice(0,n-o.from).trim()&&lo(e)})(e)||ao(e),preventDefault:!0}]),fn.of([...so,io])]};function Yp(e){const t=e.current;if(null===t)throw new ReferenceError("Attempting to dereference null object.");return t}const Xp="ContextMenu",[Kp,Jp]=co(Xp,[uo]),Zp=uo(),[Qp,eg]=Kp(Xp),tg=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,disabled:o=!1,...a}=e,s=eg("ContextMenuTrigger",n),i=Zp(n),l=r.useRef({x:0,y:0}),c=r.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),d=r.useRef(0),u=r.useCallback((()=>window.clearTimeout(d.current)),[]),h=e=>{l.current={x:e.clientX,y:e.clientY},s.onOpenChange(!0)};return r.useEffect((()=>u),[u]),r.useEffect((()=>{o&&u()}),[o,u]),r.createElement(r.Fragment,null,r.createElement(Eo,mo({},i,{virtualRef:c})),r.createElement(So.span,mo({"data-state":s.open?"open":"closed","data-disabled":o?"":void 0},a,{ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:o?e.onContextMenu:jo(e.onContextMenu,(e=>{u(),h(e),e.preventDefault()})),onPointerDown:o?e.onPointerDown:jo(e.onPointerDown,ng((e=>{u(),d.current=window.setTimeout((()=>h(e)),700)}))),onPointerMove:o?e.onPointerMove:jo(e.onPointerMove,ng(u)),onPointerCancel:o?e.onPointerCancel:jo(e.onPointerCancel,ng(u)),onPointerUp:o?e.onPointerUp:jo(e.onPointerUp,ng(u))})))}));function ng(e){return t=>"mouse"!==t.pointerType?e(t):void 0}const og=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=eg("ContextMenuContent",n),s=Zp(n),i=r.useRef(!1);return r.createElement(fo,mo({},s,o,{ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:t=>{var n;null===(n=e.onCloseAutoFocus)||void 0===n||n.call(e,t),!t.defaultPrevented&&i.current&&t.preventDefault(),i.current=!1},onInteractOutside:t=>{var n;null===(n=e.onInteractOutside)||void 0===n||n.call(e,t),t.defaultPrevented||a.modal||(i.current=!0)},style:{...e.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)"}}))})),rg=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Zp(n);return r.createElement(po,mo({},a,o,{ref:t}))})),ag=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Zp(n);return r.createElement(go,mo({},a,o,{ref:t}))})),sg=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Zp(n);return r.createElement(vo,mo({},a,o,{ref:t}))})),ig=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Zp(n);return r.createElement(xo,mo({},a,o,{ref:t}))})),lg=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Zp(n);return r.createElement(ko,mo({},a,o,{ref:t}))})),cg=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Zp(n);return r.createElement(yo,mo({},a,o,{ref:t}))})),dg=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Zp(n);return r.createElement(bo,mo({},a,o,{ref:t}))})),ug=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Zp(n);return r.createElement(wo,mo({},a,o,{ref:t,style:{...e.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)"}}))})),hg=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:o,dir:a,modal:s=!0}=e,[i,l]=r.useState(!1),c=Zp(t),d=No(o),u=r.useCallback((e=>{l(e),d(e)}),[d]);return r.createElement(Qp,{scope:t,open:i,onOpenChange:u,modal:s},r.createElement(Co,mo({},c,{dir:a,open:i,onOpenChange:u,modal:s}),n))},mg=tg,fg=_o((e=>{const{__scopeContextMenu:t,...n}=e,o=Zp(t);return r.createElement(ho,mo({},o,n))}));r.forwardRef(((e,t)=>{const n=b(14);let o,r,a,s,i,l,c;return n[0]!==e?(({className:o,inset:r,children:s,...a}=e),n[0]=e,n[1]=o,n[2]=r,n[3]=a,n[4]=s):(o=n[1],r=n[2],a=n[3],s=n[4]),n[5]!==o||n[6]!==r?(i=Io({className:o,inset:r}),n[5]=o,n[6]=r,n[7]=i):i=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=k.jsx(Po,{className:"ml-auto h-4 w-4"}),n[8]=l):l=n[8],n[9]!==t||n[10]!==i||n[11]!==a||n[12]!==s?(c=k.jsxs(dg,{ref:t,className:i,...a,children:[s,l]}),n[9]=t,n[10]=i,n[11]=a,n[12]=s,n[13]=c):c=n[13],c})).displayName=dg.displayName;const pg="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";r.forwardRef(((e,t)=>{const n=b(9);let o,r,a,s;return n[0]!==e?(({className:o,...r}=e),n[0]=e,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(a=on(Ao({subcontent:!0}),pg,o),n[3]=o,n[4]=a):a=n[4],n[5]!==t||n[6]!==a||n[7]!==r?(s=k.jsx(ug,{ref:t,className:a,...r}),n[5]=t,n[6]=a,n[7]=r,n[8]=s):s=n[8],s})).displayName=ug.displayName;const gg=r.forwardRef(((e,t)=>{const n=b(9);let o,r,a,s;return n[0]!==e?(({className:o,...r}=e),n[0]=e,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(a=on(Ao(),pg,o),n[3]=o,n[4]=a):a=n[4],n[5]!==t||n[6]!==a||n[7]!==r?(s=k.jsx(fg,{children:k.jsx(Mo,{children:k.jsx(og,{ref:t,className:a,...r})})}),n[5]=t,n[6]=a,n[7]=r,n[8]=s):s=n[8],s}));gg.displayName=og.displayName;const vg=r.forwardRef(((e,t)=>{const n=b(13);let o,r,a,s,i,l;return n[0]!==e?(({className:o,inset:r,variant:a,...s}=e),n[0]=e,n[1]=o,n[2]=r,n[3]=a,n[4]=s):(o=n[1],r=n[2],a=n[3],s=n[4]),n[5]!==o||n[6]!==r||n[7]!==a?(i=To({className:o,inset:r,variant:a}),n[5]=o,n[6]=r,n[7]=a,n[8]=i):i=n[8],n[9]!==t||n[10]!==i||n[11]!==s?(l=k.jsx(ag,{ref:t,className:i,...s}),n[9]=t,n[10]=i,n[11]=s,n[12]=l):l=n[12],l}));vg.displayName=ag.displayName;r.forwardRef(((e,t)=>{const n=b(15);let o,r,a,s,i,l,c,d;return n[0]!==e?(({className:o,children:s,checked:r,...a}=e),n[0]=e,n[1]=o,n[2]=r,n[3]=a,n[4]=s):(o=n[1],r=n[2],a=n[3],s=n[4]),n[5]!==o?(i=Oo({className:o}),n[5]=o,n[6]=i):i=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=Oo(),n[7]=l):l=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx("span",{className:l,children:k.jsx(lg,{children:k.jsx(Fo,{className:"h-4 w-4"})})}),n[8]=c):c=n[8],n[9]!==t||n[10]!==i||n[11]!==r||n[12]!==a||n[13]!==s?(d=k.jsxs(sg,{ref:t,className:i,checked:r,...a,children:[c,s]}),n[9]=t,n[10]=i,n[11]=r,n[12]=a,n[13]=s,n[14]=d):d=n[14],d})).displayName=sg.displayName;r.forwardRef(((e,t)=>{const n=b(13);let o,r,a,s,i,l,c;return n[0]!==e?(({className:o,children:a,...r}=e),n[0]=e,n[1]=o,n[2]=r,n[3]=a):(o=n[1],r=n[2],a=n[3]),n[4]!==o?(s=Oo({className:o}),n[4]=o,n[5]=s):s=n[5],n[6]===Symbol.for("react.memo_cache_sentinel")?(i=Oo(),n[6]=i):i=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=k.jsx("span",{className:i,children:k.jsx(lg,{children:k.jsx(Lo,{className:"h-4 w-4 fill-current"})})}),n[7]=l):l=n[7],n[8]!==t||n[9]!==s||n[10]!==r||n[11]!==a?(c=k.jsxs(ig,{ref:t,className:s,...r,children:[l,a]}),n[8]=t,n[9]=s,n[10]=r,n[11]=a,n[12]=c):c=n[12],c})).displayName=ig.displayName;r.forwardRef(((e,t)=>{const n=b(11);let o,r,a,s,i;return n[0]!==e?(({className:o,inset:r,...a}=e),n[0]=e,n[1]=o,n[2]=r,n[3]=a):(o=n[1],r=n[2],a=n[3]),n[4]!==o||n[5]!==r?(s=Do({className:o,inset:r}),n[4]=o,n[5]=r,n[6]=s):s=n[6],n[7]!==t||n[8]!==s||n[9]!==a?(i=k.jsx(rg,{ref:t,className:s,...a}),n[7]=t,n[8]=s,n[9]=a,n[10]=i):i=n[10],i})).displayName=rg.displayName;const xg=r.forwardRef(((e,t)=>{const n=b(9);let o,r,a,s;return n[0]!==e?(({className:o,...r}=e),n[0]=e,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(a=on(Ro({className:o})),n[3]=o,n[4]=a):a=n[4],n[5]!==t||n[6]!==a||n[7]!==r?(s=k.jsx(cg,{ref:t,className:a,...r}),n[5]=t,n[6]=a,n[7]=r,n[8]=s):s=n[8],s}));xg.displayName=cg.displayName;const yg=e=>{const t=b(14),{appClosed:n,onClick:o,tooltipContent:r}=e;let a;t[0]!==o?(a=()=>null==o?void 0:o({code:""}),t[0]=o,t[1]=a):a=t[1];const s=n&&" inactive-button";let i,l,c,d,u;return t[2]!==s?(i=on("shoulder-button hover-action",s),t[2]=s,t[3]=i):i=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(l=k.jsx(zo,{strokeWidth:1.8}),t[4]=l):l=t[4],t[5]!==a||t[6]!==i?(c=k.jsx(bi,{onClick:a,className:i,onMouseDown:tt.preventFocus,shape:"circle",size:"small",color:"hint-green","data-testid":"create-cell-button",children:l}),t[5]=a,t[6]=i,t[7]=c):c=t[7],t[8]!==r||t[9]!==c?(d=k.jsx(C,{content:r,usePortal:!1,children:c}),t[8]=r,t[9]=c,t[10]=d):d=t[10],t[11]!==o||t[12]!==d?(u=k.jsx(bg,{onClick:o,children:d}),t[11]=o,t[12]=d,t[13]=u):u=t[13],u},bg=e=>{const t=b(24),{children:n,onClick:o}=e;if(!o)return n;let r,a,s,i,l,c,d,u,h,m,f,p;return t[0]!==n?(r=k.jsx(mg,{children:n}),t[0]=n,t[1]=r):r=t[1],t[2]!==o?(a=e=>{e.stopPropagation(),o({code:""})},t[2]=o,t[3]=a):a=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(s=k.jsx("div",{className:"mr-3 text-muted-foreground",children:k.jsx(Ci,{})}),t[4]=s):s=t[4],t[5]!==a?(i=k.jsxs(vg,{onSelect:a,children:[s,"Python cell"]},"python"),t[5]=a,t[6]=i):i=t[6],t[7]!==o?(l=e=>{e.stopPropagation(),o({code:(new Bo).defaultCode})},t[7]=o,t[8]=l):l=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx("div",{className:"mr-3 text-muted-foreground",children:k.jsx(Ni,{})}),t[9]=c):c=t[9],t[10]!==l?(d=k.jsxs(vg,{onSelect:l,children:[c,"Markdown cell"]},"markdown"),t[10]=l,t[11]=d):d=t[11],t[12]!==o?(u=e=>{e.stopPropagation(),o({code:(new Uo).defaultCode})},t[12]=o,t[13]=u):u=t[13],t[14]===Symbol.for("react.memo_cache_sentinel")?(h=k.jsx("div",{className:"mr-3 text-muted-foreground",children:k.jsx(ke,{size:13,strokeWidth:1.5})}),t[14]=h):h=t[14],t[15]!==u?(m=k.jsxs(vg,{onSelect:u,children:[h,"SQL cell"]},"sql"),t[15]=u,t[16]=m):m=t[16],t[17]!==i||t[18]!==d||t[19]!==m?(f=k.jsxs(gg,{children:[i,d,m]}),t[17]=i,t[18]=d,t[19]=m,t[20]=f):f=t[20],t[21]!==r||t[22]!==f?(p=k.jsxs(hg,{children:[r,f]}),t[21]=r,t[22]=f,t[23]=p):p=t[23],p},wg=Vo("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"}}),kg=e=>{const t=b(21);let n,o,r,a,s;t[0]!==e?(({children:a,tooltip:s,disabled:n,variant:r,...o}=e),t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=a,t[5]=s):(n=t[1],o=t[2],r=t[3],a=t[4],s=t[5]);const i=void 0!==n&&n;let l,c,d;t[6]!==i||t[7]!==o.onClick?(l=e=>{var t;i||null==(t=o.onClick)||t.call(o,e)},t[6]=i,t[7]=o.onClick,t[8]=l):l=t[8],t[9]!==r||t[10]!==o.className?(c=on(wg({variant:r}),o.className),t[9]=r,t[10]=o.className,t[11]=c):c=t[11],t[12]!==i||t[13]!==o||t[14]!==l||t[15]!==c||t[16]!==a?(d=k.jsx("button",{disabled:i,...o,onClick:l,onMouseDown:tt.preventFocus,className:c,children:a}),t[12]=i,t[13]=o,t[14]=l,t[15]=c,t[16]=a,t[17]=d):d=t[17];const u=d;if(s){let e;return t[18]!==s||t[19]!==u?(e=k.jsx(C,{content:s,side:"top",delayDuration:200,usePortal:!1,children:u}),t[18]=s,t[19]=u,t[20]=e):e=t[20],e}return u},Ng=({children:e,className:t})=>k.jsx(Zc,{className:on("flex items-center gap-1 bg-background m-[2px] rounded-full",t),children:e});const Cg=e=>{const t=b(22),{onClick:n,appClosed:o,needsRun:r,status:a,config:s,edited:i}=e,l="disabled-transitively"===a,c="running"===a||"queued"===a,d=o||c||!s.disabled&&l&&!i;let u;t[0]!==o||t[1]!==r||t[2]!==c||t[3]!==d?(u=function(e,t,n,o){return e?"disabled":t&&!n?"stale":n||o?"disabled":"green"}(o,r,c,d),t[0]=o,t[1]=r,t[2]=c,t[3]=d,t[4]=u):u=t[4];const h=u;if(s.disabled){let e,o;return t[5]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx(sc,{}),t[5]=e):e=t[5],t[6]!==d||t[7]!==n||t[8]!==h?(o=k.jsx(kg,{tooltip:"Add code to notebook",disabled:d,onClick:n,variant:h,"data-testid":"run-button",children:e}),t[6]=d,t[7]=n,t[8]=h,t[9]=o):o=t[9],o}if(!s.disabled&&l&&!i){let e,o;return t[10]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx(Cc,{strokeWidth:1.2}),t[10]=e):e=t[10],t[11]!==d||t[12]!==n||t[13]!==h?(o=k.jsx(kg,{disabled:d,tooltip:"This cell can't be run because it has a disabled ancestor",onClick:n,variant:h,"data-testid":"run-button",children:e}),t[11]=d,t[12]=n,t[13]=h,t[14]=o):o=t[14],o}let m,f,p;if(o)m="App disconnected";else if("queued"===a)m="This cell is already queued to run";else if("running"===a)m="This cell is already running.";else{let e;t[15]===Symbol.for("react.memo_cache_sentinel")?(e=N("cell.run"),t[15]=e):e=t[15],m=e}return t[16]===Symbol.for("react.memo_cache_sentinel")?(f=k.jsx(Cc,{strokeWidth:1.2}),t[16]=f):f=t[16],t[17]!==m||t[18]!==d||t[19]!==n||t[20]!==h?(p=k.jsx(kg,{tooltip:m,disabled:d,onClick:n,variant:h,"data-testid":"run-button",children:f}),t[17]=m,t[18]=d,t[19]=n,t[20]=h,t[21]=p):p=t[21],p},Eg=e=>{const t=b(10),{status:n,appClosed:o,onClick:r}=e;let a;a=o?"App disconnected":"running"===n?"A cell can't be deleted when it's running":"queued"===n?"A cell can't be deleted when it's queued to run":"Delete";const s=a,i=(o||("running"===n||"queued"===n))&&"inactive-button";let l,c,d,u,h;return t[0]!==i?(l=on("hover:bg-transparent text-destructive/60 hover:text-destructive",i),t[0]=i,t[1]=l):l=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(c={boxShadow:"none"},d=k.jsx(je,{size:14}),t[2]=c,t[3]=d):(c=t[2],d=t[3]),t[4]!==r||t[5]!==l?(u=k.jsx(E,{variant:"ghost",size:"icon",onClick:r,"data-testid":"delete-button",onMouseDown:tt.preventFocus,className:l,style:c,children:d}),t[4]=r,t[5]=l,t[6]=u):u=t[6],t[7]!==a||t[8]!==u?(h=k.jsx(C,{content:s,usePortal:!1,children:u}),t[7]=a,t[8]=u,t[9]=h):h=t[9],h};const Sg=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),jg=new Intl.DateTimeFormat("en-US",{month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),_g=e=>{const t=b(79),{editing:n,status:o,disabled:r,staleInputs:a,edited:s,interrupted:i,elapsedTime:l,runStartTimestamp:c,lastRunStartTimestamp:d,uninstantiated:u}=e;if(!n)return null;const h=c??d;let m;t[0]!==h?(m=h?k.jsx(Ag,{lastRanTime:h}):null,t[0]=h,t[1]=m):m=t[1];const f=m;if(r&&"running"===o)return J.error("CellStatusComponent: disabled and running"),null;if(r&&a){let e,n,o,r;return t[2]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx("span",{children:"This cell is stale, but it's disabled and can't be run"}),t[2]=e):e=t[2],t[3]!==f?(n=k.jsxs("div",{className:"flex flex-col gap-1",children:[e,f]}),t[3]=f,t[4]=n):n=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(o=k.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:k.jsxs(fd,{children:[k.jsx(Ll,{className:"h-5 w-5",strokeWidth:1.5}),k.jsx($o,{className:"h-3 w-3",strokeWidth:2.5})]})}),t[5]=o):o=t[5],t[6]!==n?(r=k.jsx(C,{content:n,usePortal:!1,children:o}),t[6]=n,t[7]=r):r=t[7],r}if(r){let e,n,o,r;return t[8]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx("span",{children:"This cell is disabled"}),t[8]=e):e=t[8],t[9]!==f?(n=k.jsxs("div",{className:"flex flex-col gap-1",children:[e,f]}),t[9]=f,t[10]=n):n=t[10],t[11]===Symbol.for("react.memo_cache_sentinel")?(o=k.jsx("div",{className:"cell-status-icon cell-status-disabled","data-testid":"cell-status","data-status":"disabled",children:k.jsx(Ll,{className:"h-5 w-5",strokeWidth:1.5})}),t[11]=o):o=t[11],t[12]!==n?(r=k.jsx(C,{content:n,usePortal:!1,children:o}),t[12]=n,t[13]=r):r=t[13],r}if(!a&&"disabled-transitively"===o){let e,n,o,r;return t[14]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx("span",{children:"An ancestor of this cell is disabled, so it can't be run"}),t[14]=e):e=t[14],t[15]!==f?(n=k.jsxs("div",{className:"flex flex-col gap-1",children:[e,f]}),t[15]=f,t[16]=n):n=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(o=k.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"disabled-transitively",children:k.jsxs(fd,{layerTop:!0,children:[k.jsx(qc,{className:"h-5 w-5",strokeWidth:1.5}),k.jsx(Ll,{className:"h-3 w-3",strokeWidth:2.5})]})}),t[17]=o):o=t[17],t[18]!==n?(r=k.jsx(C,{content:n,usePortal:!1,children:o}),t[18]=n,t[19]=r):r=t[19],r}if(a&&"disabled-transitively"===o){let e,n,o,r;return t[20]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx("span",{children:"This cell is stale, but an ancestor is disabled so it can't be run"}),t[20]=e):e=t[20],t[21]!==f?(n=k.jsxs("div",{className:"flex flex-col gap-1",children:[e,f]}),t[21]=f,t[22]=n):n=t[22],t[23]===Symbol.for("react.memo_cache_sentinel")?(o=k.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:k.jsxs(fd,{children:[k.jsx($o,{className:"h-5 w-5",strokeWidth:1}),k.jsx(Ll,{className:"h-3 w-3",strokeWidth:2.5})]})}),t[23]=o):o=t[23],t[24]!==n?(r=k.jsx(C,{content:n,usePortal:!1,children:o}),t[24]=n,t[25]=r):r=t[25],r}if("running"===o){let e,n,o,r,a;return t[26]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx("span",{children:"This cell is running"}),t[26]=e):e=t[26],t[27]!==f?(n=k.jsxs("div",{className:"flex flex-col gap-1",children:[e,f]}),t[27]=f,t[28]=n):n=t[28],t[29]!==c?(o=Go.fromSeconds(c)||Go.now(),t[29]=c,t[30]=o):o=t[30],t[31]!==o?(r=k.jsx("div",{className:"cell-status-icon elapsed-time running","data-testid":"cell-status","data-status":"running",children:k.jsx(Tg,{startTime:o})}),t[31]=o,t[32]=r):r=t[32],t[33]!==n||t[34]!==r?(a=k.jsx(C,{content:n,usePortal:!1,children:r}),t[33]=n,t[34]=r,t[35]=a):a=t[35],a}if("queued"===o){let e,n,o,r;return t[36]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx("span",{children:"This cell is queued to run"}),t[36]=e):e=t[36],t[37]!==f?(n=k.jsxs("div",{className:"flex flex-col gap-1",children:[e,f]}),t[37]=f,t[38]=n):n=t[38],t[39]===Symbol.for("react.memo_cache_sentinel")?(o=k.jsx("div",{className:"cell-status-icon cell-status-queued","data-testid":"cell-status","data-status":"queued",children:k.jsx(sl,{className:"h-5 w-5",strokeWidth:1.5})}),t[39]=o):o=t[39],t[40]!==n?(r=k.jsx(C,{content:n,usePortal:!1,children:o}),t[40]=n,t[41]=r):r=t[41],r}if(s||i||a||u){let e;t[42]!==l?(e=Mg(l),t[42]=l,t[43]=e):e=t[43];const n=e;let o;t[44]!==l||t[45]!==n?(o=l?k.jsx(Ig,{elapsedTime:n}):null,t[44]=l,t[45]=n,t[46]=o):o=t[46];const r=o;let a,c,d,h,m,p="";if(u)a="This cell has not yet been run";else if(i){let e;a="This cell was interrupted when it was last run",t[47]!==r?(e=k.jsxs("span",{children:["This cell ran for ",r," before being interrupted"]}),t[47]=r,t[48]=e):e=t[48],p=e}else if(s){let e;a="This cell has been modified since it was last run",t[49]!==r?(e=k.jsxs("span",{children:["This cell took ",r," to run"]}),t[49]=r,t[50]=e):e=t[50],p=e}else{let e;a="This cell has not been run with the latest inputs",t[51]!==r?(e=k.jsxs("span",{children:["This cell took ",r," to run"]}),t[51]=r,t[52]=e):e=t[52],p=e}return t[53]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx("div",{className:"cell-status-stale","data-testid":"cell-status","data-status":"outdated",children:k.jsx($o,{className:"h-5 w-5",strokeWidth:1.5})}),t[53]=c):c=t[53],t[54]!==a?(d=k.jsx(C,{content:a,usePortal:!1,children:c}),t[54]=a,t[55]=d):d=t[55],t[56]!==l||t[57]!==p||t[58]!==f||t[59]!==n?(h=l&&k.jsx(C,{content:k.jsxs("div",{className:"flex flex-col gap-1",children:[p,f]}),usePortal:!1,children:k.jsx("div",{className:"elapsed-time hover-action","data-testid":"cell-status","data-status":"outdated",children:k.jsx("span",{children:n})})}),t[56]=l,t[57]=p,t[58]=f,t[59]=n,t[60]=h):h=t[60],t[61]!==d||t[62]!==h?(m=k.jsxs("div",{className:"cell-status-icon flex items-center gap-2",children:[d,h]}),t[61]=d,t[62]=h,t[63]=m):m=t[63],m}if(null!==l){let e;t[64]!==l?(e=Mg(l),t[64]=l,t[65]=e):e=t[65];const n=e;let o;t[66]!==l||t[67]!==n?(o=l?k.jsx(Ig,{elapsedTime:n}):null,t[66]=l,t[67]=n,t[68]=o):o=t[68];const r=o;let a,s,i,c;return t[69]!==r?(a=k.jsxs("span",{children:["This cell took ",r," to run"]}),t[69]=r,t[70]=a):a=t[70],t[71]!==a||t[72]!==f?(s=k.jsxs("div",{className:"flex flex-col gap-1",children:[a,f]}),t[71]=a,t[72]=f,t[73]=s):s=t[73],t[74]!==n?(i=k.jsx("div",{className:"cell-status-icon elapsed-time hover-action","data-testid":"cell-status","data-status":"idle",children:k.jsx("span",{children:n})}),t[74]=n,t[75]=i):i=t[75],t[76]!==s||t[77]!==i?(c=k.jsx(C,{content:s,usePortal:!1,children:i}),t[76]=s,t[77]=i,t[78]=c):c=t[78],c}return null},Ig=e=>{const t=b(2);let n;return t[0]!==e.elapsedTime?(n=k.jsx("span",{className:"tracking-wide font-semibold",children:e.elapsedTime}),t[0]=e.elapsedTime,t[1]=n):n=t[1],n},Ag=e=>{const t=b(18),n=1e3*e.lastRanTime;let o,r,a,s,i,l,c,d,u;if(t[0]!==n){const e=new Date(n),d=new Date,u=e.toDateString()===d.toDateString()?Sg:jg;s="Ran at",i=" ",l=k.jsx("strong",{className:"tracking-wide font-semibold",children:u.format(e)}),c=" ",o="text-muted-foreground",r="(",a=od(e),t[0]=n,t[1]=o,t[2]=r,t[3]=a,t[4]=s,t[5]=i,t[6]=l,t[7]=c}else o=t[1],r=t[2],a=t[3],s=t[4],i=t[5],l=t[6],c=t[7];return t[8]!==o||t[9]!==r||t[10]!==a?(d=k.jsxs("span",{className:o,children:[r,a," ago)"]}),t[8]=o,t[9]=r,t[10]=a,t[11]=d):d=t[11],t[12]!==s||t[13]!==i||t[14]!==l||t[15]!==c||t[16]!==d?(u=k.jsxs("span",{children:[s,i,l,c,d]}),t[12]=s,t[13]=i,t[14]=l,t[15]=c,t[16]=d,t[17]=u):u=t[17],u};function Mg(e){if(null===e)return"";if(e>6e4){const t=(e/6e4).toFixed(0),n=(e%6e4/1e3).toFixed(0);return`${t.toString()}m${n.toString()}s`}return e>1e3?`${(e/1e3).toFixed(2).toString()}s`:`${e.toFixed(0).toString()}ms`}const Tg=e=>{const t=b(6);let n;t[0]!==e.startTime?(n=e.startTime.toMilliseconds(),t[0]=e.startTime,t[1]=n):n=t[1];const o=function(e){const t=r.useRef(e),[n,o]=r.useState(e);return r.useEffect((()=>{const e=setInterval((()=>{o(Go.now().toMilliseconds())}),17);return()=>clearInterval(e)}),[]),n-t.current}(n);let a,s;return t[2]!==o?(a=Mg(o),t[2]=o,t[3]=a):a=t[3],t[4]!==a?(s=k.jsx("span",{children:a}),t[4]=a,t[5]=s):s=t[5],s};function Og(...e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}const Dg={display:"none"};function Rg(e){let{id:t,value:n}=e;return u.createElement("div",{id:t,style:Dg},n)}function Pg(e){let{id:t,announcement:n,ariaLiveType:o="assertive"}=e;return u.createElement("div",{id:t,style:{position:"fixed",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 Fg=r.createContext(null);const Lg={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},zg={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Bg(e){let{announcements:t=zg,container:n,hiddenTextDescribedById:o,screenReaderInstructions:a=Lg}=e;const{announce:s,announcement:i}=function(){const[e,t]=r.useState("");return{announce:r.useCallback((e=>{null!=e&&t(e)}),[]),announcement:e}}(),l=Jo("DndLiveRegion"),[c,d]=r.useState(!1);if(r.useEffect((()=>{d(!0)}),[]),function(e){const t=r.useContext(Fg);r.useEffect((()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)}),[e,t])}(r.useMemo((()=>({onDragStart(e){let{active:n}=e;s(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:o}=e;t.onDragMove&&s(t.onDragMove({active:n,over:o}))},onDragOver(e){let{active:n,over:o}=e;s(t.onDragOver({active:n,over:o}))},onDragEnd(e){let{active:n,over:o}=e;s(t.onDragEnd({active:n,over:o}))},onDragCancel(e){let{active:n,over:o}=e;s(t.onDragCancel({active:n,over:o}))}})),[s,t])),!c)return null;const h=u.createElement(u.Fragment,null,u.createElement(Rg,{id:o,value:a.draggable}),u.createElement(Pg,{id:l,announcement:i}));return n?Qo.createPortal(h,n):h}var Ug,Vg;function Gg(){}function $g(e,t){return r.useMemo((()=>({sensor:e,options:null!=t?t:{}})),[e,t])}(Vg=Ug||(Ug={})).DragStart="dragStart",Vg.DragMove="dragMove",Vg.DragEnd="dragEnd",Vg.DragCancel="dragCancel",Vg.DragOver="dragOver",Vg.RegisterDroppable="registerDroppable",Vg.SetDroppableDisabled="setDroppableDisabled",Vg.UnregisterDroppable="unregisterDroppable";const Hg=Object.freeze({x:0,y:0});function Wg(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function qg(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function Yg(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function Xg(e){let{left:t,top:n,height:o,width:r}=e;return[{x:t,y:n},{x:t+r,y:n},{x:t,y:n+o},{x:t+r,y:n+o}]}function Kg(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function Jg(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const Zg=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e;const r=Jg(t,t.left,t.top),a=[];for(const s of o){const{id:e}=s,t=n.get(e);if(t){const n=Wg(Jg(t),r);a.push({id:e,data:{droppableContainer:s,value:n}})}}return a.sort(qg)};function Qg(e,t){const n=Math.max(t.top,e.top),o=Math.max(t.left,e.left),r=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),s=r-o,i=a-n;if(o<r&&n<a){const n=t.width*t.height,o=e.width*e.height,r=s*i;return Number((r/(n+o-r)).toFixed(4))}return 0}const ev=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e;const r=[];for(const a of o){const{id:e}=a,o=n.get(e);if(o){const n=Qg(o,t);n>0&&r.push({id:e,data:{droppableContainer:a,value:n}})}}return r.sort(Yg)};function tv(e,t){const{top:n,left:o,bottom:r,right:a}=t;return n<=e.y&&e.y<=r&&o<=e.x&&e.x<=a}function nv(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Hg}function ov(e){return function(t){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(((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x})),{...t})}}const rv=ov(1);const av={ignoreTransform:!1};function sv(e,t){void 0===t&&(t=av);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:o}=Ho(e).getComputedStyle(e);t&&(n=function(e,t,n){const o=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!o)return e;const{scaleX:r,scaleY:a,x:s,y:i}=o,l=e.left-s-(1-r)*parseFloat(n),c=e.top-i-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),d=r?e.width/r:e.width,u=a?e.height/a:e.height;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l}}(n,t,o))}const{top:o,left:r,width:a,height:s,bottom:i,right:l}=n;return{top:o,left:r,width:a,height:s,bottom:i,right:l}}function iv(e){return sv(e,{ignoreTransform:!0})}function lv(e,t){const n=[];return e?function o(r){if(null!=t&&n.length>=t)return n;if(!r)return n;if(lr(r)&&null!=r.scrollingElement&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!ar(r)||cr(r))return n;if(n.includes(r))return n;const a=Ho(e).getComputedStyle(r);return r!==e&&function(e,t){void 0===t&&(t=Ho(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some((e=>{const o=t[e];return"string"==typeof o&&n.test(o)}))}(r,a)&&n.push(r),function(e,t){return void 0===t&&(t=Ho(e).getComputedStyle(e)),"fixed"===t.position}(r,a)?n:o(r.parentNode)}(e):n}function cv(e){const[t]=lv(e,1);return null!=t?t:null}function dv(e){return rr&&e?dr(e)?e:ur(e)?lr(e)||e===Wo(e).scrollingElement?window:ar(e)?e:null:null:null}function uv(e){return dr(e)?e.scrollX:e.scrollLeft}function hv(e){return dr(e)?e.scrollY:e.scrollTop}function mv(e){return{x:uv(e),y:hv(e)}}var fv,pv;function gv(e){return!(!rr||!e)&&e===document.scrollingElement}function vv(e){const t={x:0,y:0},n=gv(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},o={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=o.y,isRight:e.scrollLeft>=o.x,maxScroll:o,minScroll:t}}(pv=fv||(fv={}))[pv.Forward=1]="Forward",pv[pv.Backward=-1]="Backward";const xv={x:.2,y:.2};function yv(e,t,n,o,r){let{top:a,left:s,right:i,bottom:l}=n;void 0===o&&(o=10),void 0===r&&(r=xv);const{isTop:c,isBottom:d,isLeft:u,isRight:h}=vv(e),m={x:0,y:0},f={x:0,y:0},p=t.height*r.y,g=t.width*r.x;return!c&&a<=t.top+p?(m.y=fv.Backward,f.y=o*Math.abs((t.top+p-a)/p)):!d&&l>=t.bottom-p&&(m.y=fv.Forward,f.y=o*Math.abs((t.bottom-p-l)/p)),!h&&i>=t.right-g?(m.x=fv.Forward,f.x=o*Math.abs((t.right-g-i)/g)):!u&&s<=t.left+g&&(m.x=fv.Backward,f.x=o*Math.abs((t.left+g-s)/g)),{direction:m,speed:f}}function bv(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:o,bottom:r}=e.getBoundingClientRect();return{top:t,left:n,right:o,bottom:r,width:e.clientWidth,height:e.clientHeight}}function wv(e){return e.reduce(((e,t)=>Xo(e,mv(t))),Hg)}const kv=[["x",["left","right"],function(e){return e.reduce(((e,t)=>e+uv(t)),0)}],["y",["top","bottom"],function(e){return e.reduce(((e,t)=>e+hv(t)),0)}]];class Nv{constructor(e,t){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 n=lv(t),o=wv(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[r,a,s]of kv)for(const e of a)Object.defineProperty(this,e,{get:()=>{const t=s(n),a=o[r]-t;return this.rect[e]+a},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Cv{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach((e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)}))},this.target=e}add(e,t,n){var o;null==(o=this.target)||o.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function Ev(e,t){const n=Math.abs(e.x),o=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+o**2)>t:"x"in t&&"y"in t?n>t.x&&o>t.y:"x"in t?n>t.x:"y"in t&&o>t.y}var Sv,jv,_v,Iv;function Av(e){e.preventDefault()}function Mv(e){e.stopPropagation()}(jv=Sv||(Sv={})).Click="click",jv.DragStart="dragstart",jv.Keydown="keydown",jv.ContextMenu="contextmenu",jv.Resize="resize",jv.SelectionChange="selectionchange",jv.VisibilityChange="visibilitychange",(Iv=_v||(_v={})).Space="Space",Iv.Down="ArrowDown",Iv.Right="ArrowRight",Iv.Left="ArrowLeft",Iv.Up="ArrowUp",Iv.Esc="Escape",Iv.Enter="Enter";const Tv={start:[_v.Space,_v.Enter],cancel:[_v.Esc],end:[_v.Space,_v.Enter]},Ov=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case _v.Right:return{...n,x:n.x+25};case _v.Left:return{...n,x:n.x-25};case _v.Down:return{...n,y:n.y+25};case _v.Up:return{...n,y:n.y-25}}};class Dv{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:t}}=e;this.props=e,this.listeners=new Cv(Wo(t)),this.windowListeners=new Cv(Ho(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Sv.Resize,this.handleCancel),this.windowListeners.add(Sv.VisibilityChange,this.handleCancel),setTimeout((()=>this.listeners.add(Sv.Keydown,this.handleKeyDown)))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=sv),!e)return;const{top:n,left:o,bottom:r,right:a}=t(e);cv(e)&&(r<=0||a<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(Hg)}handleKeyDown(e){if(qo(e)){const{active:t,context:n,options:o}=this.props,{keyboardCodes:r=Tv,coordinateGetter:a=Ov,scrollBehavior:s="smooth"}=o,{code:i}=e;if(r.end.includes(i))return void this.handleEnd(e);if(r.cancel.includes(i))return void this.handleCancel(e);const{collisionRect:l}=n.current,c=l?{x:l.left,y:l.top}:Hg;this.referenceCoordinates||(this.referenceCoordinates=c);const d=a(e,{active:t,context:n.current,currentCoordinates:c});if(d){const t=Yo(d,c),o={x:0,y:0},{scrollableAncestors:r}=n.current;for(const n of r){const r=e.code,{isTop:a,isRight:i,isLeft:l,isBottom:c,maxScroll:u,minScroll:h}=vv(n),m=bv(n),f={x:Math.min(r===_v.Right?m.right-m.width/2:m.right,Math.max(r===_v.Right?m.left:m.left+m.width/2,d.x)),y:Math.min(r===_v.Down?m.bottom-m.height/2:m.bottom,Math.max(r===_v.Down?m.top:m.top+m.height/2,d.y))},p=r===_v.Right&&!i||r===_v.Left&&!l,g=r===_v.Down&&!c||r===_v.Up&&!a;if(p&&f.x!==d.x){const e=n.scrollLeft+t.x,a=r===_v.Right&&e<=u.x||r===_v.Left&&e>=h.x;if(a&&!t.y)return void n.scrollTo({left:e,behavior:s});o.x=a?n.scrollLeft-e:r===_v.Right?n.scrollLeft-u.x:n.scrollLeft-h.x,o.x&&n.scrollBy({left:-o.x,behavior:s});break}if(g&&f.y!==d.y){const e=n.scrollTop+t.y,a=r===_v.Down&&e<=u.y||r===_v.Up&&e>=h.y;if(a&&!t.x)return void n.scrollTo({top:e,behavior:s});o.y=a?n.scrollTop-e:r===_v.Down?n.scrollTop-u.y:n.scrollTop-h.y,o.y&&n.scrollBy({top:-o.y,behavior:s});break}}this.handleMove(e,Xo(Yo(d,this.referenceCoordinates),o))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function Rv(e){return Boolean(e&&"distance"in e)}function Pv(e){return Boolean(e&&"delay"in e)}Dv.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:o=Tv,onActivation:r}=t,{active:a}=n;const{code:s}=e.nativeEvent;if(o.start.includes(s)){const t=a.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==r||r({event:e.nativeEvent}),!0)}return!1}}];class Fv{constructor(e,t,n){var o;void 0===n&&(n=function(e){const{EventTarget:t}=Ho(e);return e instanceof t?e:Wo(e)}(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=t;const{event:r}=e,{target:a}=r;this.props=e,this.events=t,this.document=Wo(a),this.documentListeners=new Cv(this.document),this.listeners=new Cv(n),this.windowListeners=new Cv(Ho(a)),this.initialCoordinates=null!=(o=Zo(r))?o:Hg,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:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(Sv.Resize,this.handleCancel),this.windowListeners.add(Sv.DragStart,Av),this.windowListeners.add(Sv.VisibilityChange,this.handleCancel),this.windowListeners.add(Sv.ContextMenu,Av),this.documentListeners.add(Sv.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Pv(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay));if(Rv(t))return}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Sv.Click,Mv,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Sv.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:o,props:r}=this,{onMove:a,options:{activationConstraint:s}}=r;if(!o)return;const i=null!=(t=Zo(e))?t:Hg,l=Yo(o,i);if(!n&&s){if(Rv(s)){if(null!=s.tolerance&&Ev(l,s.tolerance))return this.handleCancel();if(Ev(l,s.distance))return this.handleStart()}return Pv(s)&&Ev(l,s.tolerance)?this.handleCancel():void 0}e.cancelable&&e.preventDefault(),a(i)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===_v.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const Lv={move:{name:"pointermove"},end:{name:"pointerup"}};class zv extends Fv{constructor(e){const{event:t}=e,n=Wo(t.target);super(e,Lv,n)}}zv.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return!(!n.isPrimary||0!==n.button)&&(null==o||o({event:n}),!0)}}];const Bv={move:{name:"mousemove"},end:{name:"mouseup"}};var Uv,Vv;(Vv=Uv||(Uv={}))[Vv.RightClick=2]="RightClick";(class extends Fv{constructor(e){super(e,Bv,Wo(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button!==Uv.RightClick&&(null==o||o({event:n}),!0)}}];const Gv={move:{name:"touchmove"},end:{name:"touchend"}};var $v,Hv,Wv,qv;function Yv(e){let{acceleration:t,activator:n=$v.Pointer,canScroll:o,draggingRect:a,enabled:s,interval:i=5,order:l=Wv.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:h,threshold:m}=e;const f=function(e){let{delta:t,disabled:n}=e;const o=nr(t);return or((e=>{if(n||!o||!e)return Xv;const r={x:Math.sign(t.x-o.x),y:Math.sign(t.y-o.y)};return{x:{[fv.Backward]:e.x[fv.Backward]||-1===r.x,[fv.Forward]:e.x[fv.Forward]||1===r.x},y:{[fv.Backward]:e.y[fv.Backward]||-1===r.y,[fv.Forward]:e.y[fv.Forward]||1===r.y}}}),[n,t,o])}({delta:h,disabled:!s}),[p,g]=tr(),v=r.useRef({x:0,y:0}),x=r.useRef({x:0,y:0}),y=r.useMemo((()=>{switch(n){case $v.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case $v.DraggableRect:return a}}),[n,a,c]),b=r.useRef(null),w=r.useCallback((()=>{const e=b.current;if(!e)return;const t=v.current.x*x.current.x,n=v.current.y*x.current.y;e.scrollBy(t,n)}),[]),k=r.useMemo((()=>l===Wv.TreeOrder?[...d].reverse():d),[l,d]);r.useEffect((()=>{if(s&&d.length&&y){for(const e of k){if(!1===(null==o?void 0:o(e)))continue;const n=d.indexOf(e),r=u[n];if(!r)continue;const{direction:a,speed:s}=yv(e,r,y,t,m);for(const e of["x","y"])f[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0)return g(),b.current=e,p(w,i),v.current=s,void(x.current=a)}v.current={x:0,y:0},x.current={x:0,y:0},g()}else g()}),[t,w,o,g,s,i,JSON.stringify(y),JSON.stringify(f),p,d,k,u,JSON.stringify(m)])}(class extends Fv{constructor(e){super(e,Gv)}static setup(){return window.addEventListener(Gv.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Gv.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;const{touches:r}=n;return!(r.length>1)&&(null==o||o({event:n}),!0)}}],(Hv=$v||($v={}))[Hv.Pointer=0]="Pointer",Hv[Hv.DraggableRect=1]="DraggableRect",(qv=Wv||(Wv={}))[qv.TreeOrder=0]="TreeOrder",qv[qv.ReversedTreeOrder=1]="ReversedTreeOrder";const Xv={x:{[fv.Backward]:!1,[fv.Forward]:!1},y:{[fv.Backward]:!1,[fv.Forward]:!1}};var Kv,Jv,Zv;(Jv=Kv||(Kv={}))[Jv.Always=0]="Always",Jv[Jv.BeforeDragging=1]="BeforeDragging",Jv[Jv.WhileDragging=2]="WhileDragging",(Zv||(Zv={})).Optimized="optimized";const Qv=new Map;function ex(e,t){return or((n=>e?n||("function"==typeof t?t(e):e):null),[t,e])}function tx(e){let{callback:t,disabled:n}=e;const o=hr(t),a=r.useMemo((()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(o)}),[n]);return r.useEffect((()=>()=>null==a?void 0:a.disconnect()),[a]),a}function nx(e){return new Nv(sv(e),e)}function ox(e,t,n){void 0===t&&(t=nx);const[o,a]=r.useReducer((function(o){if(!e)return null;var r;if(!1===e.isConnected)return null!=(r=null!=o?o:n)?r:null;const a=t(e);if(JSON.stringify(o)===JSON.stringify(a))return o;return a}),null),s=function(e){let{callback:t,disabled:n}=e;const o=hr(t),a=r.useMemo((()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(o)}),[o,n]);return r.useEffect((()=>()=>null==a?void 0:a.disconnect()),[a]),a}({callback(t){if(e)for(const n of t){const{type:t,target:o}=n;if("childList"===t&&o instanceof HTMLElement&&o.contains(e)){a();break}}}}),i=tx({callback:a});return er((()=>{a(),e?(null==i||i.observe(e),null==s||s.observe(document.body,{childList:!0,subtree:!0})):(null==i||i.disconnect(),null==s||s.disconnect())}),[e]),o}const rx=[];function ax(e,t){void 0===t&&(t=[]);const n=r.useRef(null);return r.useEffect((()=>{n.current=null}),t),r.useEffect((()=>{const t=e!==Hg;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)}),[e]),n.current?Yo(e,n.current):Hg}function sx(e){return r.useMemo((()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null),[e])}const ix=[];function lx(e){let{measure:t}=e;const[n,o]=r.useState(null),a=tx({callback:r.useCallback((e=>{for(const{target:n}of e)if(ar(n)){o((e=>{const o=t(n);return e?{...e,width:o.width,height:o.height}:o}));break}}),[t])}),s=r.useCallback((e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ar(t)?t:e}(e);null==a||a.disconnect(),n&&(null==a||a.observe(n)),o(n?t(n):null)}),[t,a]),[i,l]=sr(s);return r.useMemo((()=>({nodeRef:i,rect:n,setRef:l})),[n,i,l])}const cx=[{sensor:zv,options:{}},{sensor:Dv,options:{}}],dx={current:{}},ux={draggable:{measure:iv},droppable:{measure:iv,strategy:Kv.WhileDragging,frequency:Zv.Optimized},dragOverlay:{measure:sv}};class hx extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter((e=>{let{disabled:t}=e;return!t}))}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const mx={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new hx,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Gg},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ux,measureDroppableContainers:Gg,windowRect:null,measuringScheduled:!1},fx={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Gg,draggableNodes:new Map,over:null,measureDroppableContainers:Gg},px=r.createContext(fx),gx=r.createContext(mx);function vx(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new hx}}}function xx(e,t){switch(t.type){case Ug.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ug.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case Ug.DragEnd:case Ug.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ug.RegisterDroppable:{const{element:n}=t,{id:o}=n,r=new hx(e.droppable.containers);return r.set(o,n),{...e,droppable:{...e.droppable,containers:r}}}case Ug.SetDroppableDisabled:{const{id:n,key:o,disabled:r}=t,a=e.droppable.containers.get(n);if(!a||o!==a.key)return e;const s=new hx(e.droppable.containers);return s.set(n,{...a,disabled:r}),{...e,droppable:{...e.droppable,containers:s}}}case Ug.UnregisterDroppable:{const{id:n,key:o}=t,r=e.droppable.containers.get(n);if(!r||o!==r.key)return e;const a=new hx(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function yx(e){let{disabled:t}=e;const{active:n,activatorEvent:o,draggableNodes:a}=r.useContext(px),s=nr(o),i=nr(null==n?void 0:n.id);return r.useEffect((()=>{if(!t&&!o&&s&&null!=i){if(!qo(s))return;if(document.activeElement===s.target)return;const e=a.get(i);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame((()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=ir(e);if(t){t.focus();break}}}))}}),[o,t,a,i,s]),null}const bx=r.createContext({...Hg,scaleX:1,scaleY:1});var wx,kx;(kx=wx||(wx={}))[kx.Uninitialized=0]="Uninitialized",kx[kx.Initializing=1]="Initializing",kx[kx.Initialized=2]="Initialized";const Nx=r.memo((function(e){var t,n,o,a;let{id:s,accessibility:i,autoScroll:l=!0,children:c,sensors:d=cx,collisionDetection:h=ev,measuring:m,modifiers:f,...p}=e;const g=r.useReducer(xx,void 0,vx),[v,x]=g,[y,b]=function(){const[e]=r.useState((()=>new Set)),t=r.useCallback((t=>(e.add(t),()=>e.delete(t))),[e]);return[r.useCallback((t=>{let{type:n,event:o}=t;e.forEach((e=>{var t;return null==(t=e[n])?void 0:t.call(e,o)}))}),[e]),t]}(),[w,k]=r.useState(wx.Uninitialized),N=w===wx.Initialized,{draggable:{active:C,nodes:E,translate:S},droppable:{containers:j}}=v,_=C?E.get(C):null,I=r.useRef({initial:null,translated:null}),A=r.useMemo((()=>{var e;return null!=C?{id:C,data:null!=(e=null==_?void 0:_.data)?e:dx,rect:I}:null}),[C,_]),M=r.useRef(null),[T,O]=r.useState(null),[D,R]=r.useState(null),P=Ko(p,Object.values(p)),F=Jo("DndDescribedBy",s),L=r.useMemo((()=>j.getEnabled()),[j]),z=(B=m,r.useMemo((()=>({draggable:{...ux.draggable,...null==B?void 0:B.draggable},droppable:{...ux.droppable,...null==B?void 0:B.droppable},dragOverlay:{...ux.dragOverlay,...null==B?void 0:B.dragOverlay}})),[null==B?void 0:B.draggable,null==B?void 0:B.droppable,null==B?void 0:B.dragOverlay]));var B;const{droppableRects:U,measureDroppableContainers:V,measuringScheduled:G}=function(e,t){let{dragging:n,dependencies:o,config:a}=t;const[s,i]=r.useState(null),{frequency:l,measure:c,strategy:d}=a,u=r.useRef(e),h=function(){switch(d){case Kv.Always:return!1;case Kv.BeforeDragging:return n;default:return!n}}(),m=Ko(h),f=r.useCallback((function(e){void 0===e&&(e=[]),m.current||i((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[m]),p=r.useRef(null),g=or((t=>{if(h&&!n)return Qv;if(!t||t===Qv||u.current!==e||null!=s){const t=new Map;for(let n of e){if(!n)continue;if(s&&s.length>0&&!s.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,o=e?new Nv(c(e),e):null;n.rect.current=o,o&&t.set(n.id,o)}return t}return t}),[e,s,n,h,c]);return r.useEffect((()=>{u.current=e}),[e]),r.useEffect((()=>{h||f()}),[n,h]),r.useEffect((()=>{s&&s.length>0&&i(null)}),[JSON.stringify(s)]),r.useEffect((()=>{h||"number"!=typeof l||null!==p.current||(p.current=setTimeout((()=>{f(),p.current=null}),l))}),[l,h,f,...o]),{droppableRects:g,measureDroppableContainers:f,measuringScheduled:null!=s}}(L,{dragging:N,dependencies:[S.x,S.y],config:z.droppable}),$=function(e,t){const n=null!==t?e.get(t):void 0,o=n?n.node.current:null;return or((e=>{var n;return null===t?null:null!=(n=null!=o?o:e)?n:null}),[o,t])}(E,C),H=r.useMemo((()=>D?Zo(D):null),[D]),W=function(){const e=!1===(null==T?void 0:T.autoScrollEnabled),t="object"==typeof l?!1===l.enabled:!1===l,n=N&&!e&&!t;if("object"==typeof l)return{...l,enabled:n};return{enabled:n}}(),q=function(e,t){return ex(e,t)}($,z.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:o,config:a=!0}=e;const s=r.useRef(!1),{x:i,y:l}="boolean"==typeof a?{x:a,y:a}:a;er((()=>{if(!i&&!l||!t)return void(s.current=!1);if(s.current||!o)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const r=nv(n(e),o);if(i||(r.x=0),l||(r.y=0),s.current=!0,Math.abs(r.x)>0||Math.abs(r.y)>0){const t=cv(e);t&&t.scrollBy({top:r.y,left:r.x})}}),[t,i,l,o,n])}({activeNode:C?E.get(C):null,config:W.layoutShiftCompensation,initialRect:q,measure:z.draggable.measure});const Y=ox($,z.draggable.measure,q),X=ox($?$.parentElement:null),K=r.useRef({activatorEvent:null,active:null,activeNode:$,collisionRect:null,collisions:null,droppableRects:U,draggableNodes:E,draggingNode:null,draggingNodeRect:null,droppableContainers:j,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),J=j.getNodeFor(null==(t=K.current.over)?void 0:t.id),Z=lx({measure:z.dragOverlay.measure}),Q=null!=(n=Z.nodeRef.current)?n:$,ee=N?null!=(o=Z.rect)?o:Y:null,te=Boolean(Z.nodeRef.current&&Z.rect),ne=nv(oe=te?null:Y,ex(oe));var oe;const re=sx(Q?Ho(Q):null),ae=function(e){const t=r.useRef(e),n=or((n=>e?n&&n!==rx&&e&&t.current&&e.parentNode===t.current.parentNode?n:lv(e):rx),[e]);return r.useEffect((()=>{t.current=e}),[e]),n}(N?null!=J?J:$:null),se=function(e,t){void 0===t&&(t=sv);const[n]=e,o=sx(n?Ho(n):null),[a,s]=r.useReducer((function(){return e.length?e.map((e=>gv(e)?o:new Nv(t(e),e))):ix}),ix),i=tx({callback:s});return e.length>0&&a===ix&&s(),er((()=>{e.length?e.forEach((e=>null==i?void 0:i.observe(e))):(null==i||i.disconnect(),s())}),[e]),a}(ae),ie=function(e,t){let{transform:n,...o}=t;return null!=e&&e.length?e.reduce(((e,t)=>t({transform:e,...o})),n):n}(f,{transform:{x:S.x-ne.x,y:S.y-ne.y,scaleX:1,scaleY:1},activatorEvent:D,active:A,activeNodeRect:Y,containerNodeRect:X,draggingNodeRect:ee,over:K.current.over,overlayNodeRect:Z.rect,scrollableAncestors:ae,scrollableAncestorRects:se,windowRect:re}),le=H?Xo(H,S):null,ce=function(e){const[t,n]=r.useState(null),o=r.useRef(e),a=r.useCallback((e=>{const t=dv(e.target);t&&n((e=>e?(e.set(t,mv(t)),new Map(e)):null))}),[]);return r.useEffect((()=>{const t=o.current;if(e!==t){r(t);const s=e.map((e=>{const t=dv(e);return t?(t.addEventListener("scroll",a,{passive:!0}),[t,mv(t)]):null})).filter((e=>null!=e));n(s.length?new Map(s):null),o.current=e}return()=>{r(e),r(t)};function r(e){e.forEach((e=>{const t=dv(e);null==t||t.removeEventListener("scroll",a)}))}}),[a,e]),r.useMemo((()=>e.length?t?Array.from(t.values()).reduce(((e,t)=>Xo(e,t)),Hg):wv(e):Hg),[e,t])}(ae),de=ax(ce),ue=ax(ce,[Y]),he=Xo(ie,de),me=ee?rv(ee,ie):null,fe=A&&me?h({active:A,collisionRect:me,droppableRects:U,droppableContainers:L,pointerCoordinates:le}):null,pe=Kg(fe,"id"),[ge,ve]=r.useState(null),xe=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(te?ie:Xo(ie,ue),null!=(a=null==ge?void 0:ge.rect)?a:null,Y),ye=r.useCallback(((e,t)=>{let{sensor:n,options:o}=t;if(null==M.current)return;const r=E.get(M.current);if(!r)return;const a=e.nativeEvent,s=new n({active:M.current,activeNode:r,event:a,options:o,context:K,onStart(e){const t=M.current;if(null==t)return;const n=E.get(t);if(!n)return;const{onDragStart:o}=P.current,r={active:{id:t,data:n.data,rect:I}};Qo.unstable_batchedUpdates((()=>{null==o||o(r),k(wx.Initializing),x({type:Ug.DragStart,initialCoordinates:e,active:t}),y({type:"onDragStart",event:r})}))},onMove(e){x({type:Ug.DragMove,coordinates:e})},onEnd:i(Ug.DragEnd),onCancel:i(Ug.DragCancel)});function i(e){return async function(){const{active:t,collisions:n,over:o,scrollAdjustedTranslate:r}=K.current;let s=null;if(t&&r){const{cancelDrop:i}=P.current;if(s={activatorEvent:a,active:t,collisions:n,delta:r,over:o},e===Ug.DragEnd&&"function"==typeof i){await Promise.resolve(i(s))&&(e=Ug.DragCancel)}}M.current=null,Qo.unstable_batchedUpdates((()=>{x({type:e}),k(wx.Uninitialized),ve(null),O(null),R(null);const t=e===Ug.DragEnd?"onDragEnd":"onDragCancel";if(s){const e=P.current[t];null==e||e(s),y({type:t,event:s})}}))}}Qo.unstable_batchedUpdates((()=>{O(s),R(e.nativeEvent)}))}),[E]),be=function(e,t){return r.useMemo((()=>e.reduce(((e,n)=>{const{sensor:o}=n;return[...e,...o.activators.map((e=>({eventName:e.eventName,handler:t(e.handler,n)})))]}),[])),[e,t])}(d,r.useCallback(((e,t)=>(n,o)=>{const r=n.nativeEvent,a=E.get(o);if(null!==M.current||!a||r.dndKit||r.defaultPrevented)return;const s={active:a};!0===e(n,t.options,s)&&(r.dndKit={capturedBy:t.sensor},M.current=o,ye(n,t))}),[E,ye]));!function(e){r.useEffect((()=>{if(!rr)return;const t=e.map((e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()}));return()=>{for(const e of t)null==e||e()}}),e.map((e=>{let{sensor:t}=e;return t})))}(d),er((()=>{Y&&w===wx.Initializing&&k(wx.Initialized)}),[Y,w]),r.useEffect((()=>{const{onDragMove:e}=P.current,{active:t,activatorEvent:n,collisions:o,over:r}=K.current;if(!t||!n)return;const a={active:t,activatorEvent:n,collisions:o,delta:{x:he.x,y:he.y},over:r};Qo.unstable_batchedUpdates((()=>{null==e||e(a),y({type:"onDragMove",event:a})}))}),[he.x,he.y]),r.useEffect((()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:o,scrollAdjustedTranslate:r}=K.current;if(!e||null==M.current||!t||!r)return;const{onDragOver:a}=P.current,s=o.get(pe),i=s&&s.rect.current?{id:s.id,rect:s.rect.current,data:s.data,disabled:s.disabled}:null,l={active:e,activatorEvent:t,collisions:n,delta:{x:r.x,y:r.y},over:i};Qo.unstable_batchedUpdates((()=>{ve(i),null==a||a(l),y({type:"onDragOver",event:l})}))}),[pe]),er((()=>{K.current={activatorEvent:D,active:A,activeNode:$,collisionRect:me,collisions:fe,droppableRects:U,draggableNodes:E,draggingNode:Q,draggingNodeRect:ee,droppableContainers:j,over:ge,scrollableAncestors:ae,scrollAdjustedTranslate:he},I.current={initial:ee,translated:me}}),[A,$,fe,me,E,Q,ee,U,j,ge,ae,he]),Yv({...W,delta:S,draggingRect:me,pointerCoordinates:le,scrollableAncestors:ae,scrollableAncestorRects:se});const we=r.useMemo((()=>({active:A,activeNode:$,activeNodeRect:Y,activatorEvent:D,collisions:fe,containerNodeRect:X,dragOverlay:Z,draggableNodes:E,droppableContainers:j,droppableRects:U,over:ge,measureDroppableContainers:V,scrollableAncestors:ae,scrollableAncestorRects:se,measuringConfiguration:z,measuringScheduled:G,windowRect:re})),[A,$,Y,D,fe,X,Z,E,j,U,ge,V,ae,se,z,G,re]),ke=r.useMemo((()=>({activatorEvent:D,activators:be,active:A,activeNodeRect:Y,ariaDescribedById:{draggable:F},dispatch:x,draggableNodes:E,over:ge,measureDroppableContainers:V})),[D,be,A,Y,x,F,E,ge,V]);return u.createElement(Fg.Provider,{value:b},u.createElement(px.Provider,{value:ke},u.createElement(gx.Provider,{value:we},u.createElement(bx.Provider,{value:xe},c)),u.createElement(yx,{disabled:!1===(null==i?void 0:i.restoreFocus)})),u.createElement(Bg,{...i,hiddenTextDescribedById:F}))})),Cx=r.createContext(null),Ex="button";function Sx(e){let{id:t,data:n,disabled:o=!1,attributes:a}=e;const s=Jo("Droppable"),{activators:i,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:h,over:m}=r.useContext(px),{role:f=Ex,roleDescription:p="draggable",tabIndex:g=0}=null!=a?a:{},v=(null==c?void 0:c.id)===t,x=r.useContext(v?bx:Cx),[y,b]=sr(),[w,k]=sr(),N=function(e,t){return r.useMemo((()=>e.reduce(((e,n)=>{let{eventName:o,handler:r}=n;return e[o]=e=>{r(e,t)},e}),{})),[e,t])}(i,t),C=Ko(n);er((()=>(h.set(t,{id:t,key:s,node:y,activatorNode:w,data:C}),()=>{const e=h.get(t);e&&e.key===s&&h.delete(t)})),[h,t]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:r.useMemo((()=>({role:f,tabIndex:g,"aria-disabled":o,"aria-pressed":!(!v||f!==Ex)||void 0,"aria-roledescription":p,"aria-describedby":u.draggable})),[o,f,g,v,p,u.draggable]),isDragging:v,listeners:o?void 0:N,node:y,over:m,setNodeRef:b,setActivatorNodeRef:k,transform:x}}const jx={timeout:25};function _x(e,t,n){const o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function Ix(e,t){return e.reduce(((e,n,o)=>{const r=t.get(n);return r&&(e[o]=r),e}),Array(e.length))}function Ax(e){return null!==e&&e>=0}const Mx={scaleX:1,scaleY:1},Tx=e=>{var t;let{rects:n,activeNodeRect:o,activeIndex:r,overIndex:a,index:s}=e;const i=null!=(t=n[r])?t:o;if(!i)return null;const l=function(e,t,n){const o=e[t],r=e[t-1],a=e[t+1];if(!o||!r&&!a)return 0;if(n<t)return r?o.left-(r.left+r.width):a.left-(o.left+o.width);return a?a.left-(o.left+o.width):o.left-(r.left+r.width)}(n,s,r);if(s===r){const e=n[a];return e?{x:r<a?e.left+e.width-(i.left+i.width):e.left-i.left,y:0,...Mx}:null}return s>r&&s<=a?{x:-i.width-l,y:0,...Mx}:s<r&&s>=a?{x:i.width+l,y:0,...Mx}:{x:0,y:0,...Mx}};const Ox=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e;const a=_x(t,o,n),s=t[r],i=a[r];return i&&s?{x:i.left-s.left,y:i.top-s.top,scaleX:i.width/s.width,scaleY:i.height/s.height}:null},Dx={scaleX:1,scaleY:1},Rx=e=>{var t;let{activeIndex:n,activeNodeRect:o,index:r,rects:a,overIndex:s}=e;const i=null!=(t=a[n])?t:o;if(!i)return null;if(r===n){const e=a[s];return e?{x:0,y:n<s?e.top+e.height-(i.top+i.height):e.top-i.top,...Dx}:null}const l=function(e,t,n){const o=e[t],r=e[t-1],a=e[t+1];if(!o)return 0;if(n<t)return r?o.top-(r.top+r.height):a?a.top-(o.top+o.height):0;return a?a.top-(o.top+o.height):r?o.top-(r.top+r.height):0}(a,r,n);return r>n&&r<=s?{x:0,y:-i.height-l,...Dx}:r<n&&r>=s?{x:0,y:i.height+l,...Dx}:{x:0,y:0,...Dx}};const Px="Sortable",Fx=u.createContext({activeIndex:-1,containerId:Px,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Ox,disabled:{draggable:!1,droppable:!1}});function Lx(e){let{children:t,id:n,items:o,strategy:a=Ox,disabled:s=!1}=e;const{active:i,dragOverlay:l,droppableRects:c,over:d,measureDroppableContainers:h}=r.useContext(gx),m=Jo(Px,n),f=Boolean(null!==l.rect),p=r.useMemo((()=>o.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[o]),g=null!=i,v=i?p.indexOf(i.id):-1,x=d?p.indexOf(d.id):-1,y=r.useRef(p),b=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(p,y.current),w=-1!==x&&-1===v||b,k=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(s);er((()=>{b&&g&&h(p)}),[b,p,g,h]),r.useEffect((()=>{y.current=p}),[p]);const N=r.useMemo((()=>({activeIndex:v,containerId:m,disabled:k,disableTransforms:w,items:p,overIndex:x,useDragOverlay:f,sortedRects:Ix(p,c),strategy:a})),[v,m,k.draggable,k.droppable,w,p,x,c,f,a]);return u.createElement(Fx.Provider,{value:N},t)}const zx=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return _x(n,o,r).indexOf(t)},Bx=e=>{let{containerId:t,isSorting:n,wasDragging:o,index:r,items:a,newIndex:s,previousItems:i,previousContainerId:l,transition:c}=e;return!(!c||!o)&&((i===a||r!==s)&&(!!n||s!==r&&t===l))},Ux={duration:200,easing:"ease"},Vx="transform",Gx=fr.Transition.toString({property:Vx,duration:0,easing:"linear"}),$x={roleDescription:"sortable"};function Hx(e){let{animateLayoutChanges:t=Bx,attributes:n,disabled:o,data:a,getNewIndex:s=zx,id:i,strategy:l,resizeObserverConfig:c,transition:d=Ux}=e;const{items:u,containerId:h,activeIndex:m,disabled:f,disableTransforms:p,sortedRects:g,overIndex:v,useDragOverlay:x,strategy:y}=r.useContext(Fx),b=function(e,t){var n,o;if("boolean"==typeof e)return{draggable:e,droppable:!1};return{draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,droppable:null!=(o=null==e?void 0:e.droppable)?o:t.droppable}}(o,f),w=u.indexOf(i),k=r.useMemo((()=>({sortable:{containerId:h,index:w,items:u},...a})),[h,a,w,u]),N=r.useMemo((()=>u.slice(u.indexOf(i))),[u,i]),{rect:C,node:E,isOver:S,setNodeRef:j}=function(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:a}=e;const s=Jo("Droppable"),{active:i,dispatch:l,over:c,measureDroppableContainers:d}=r.useContext(px),u=r.useRef({disabled:n}),h=r.useRef(!1),m=r.useRef(null),f=r.useRef(null),{disabled:p,updateMeasurementsFor:g,timeout:v}={...jx,...a},x=Ko(null!=g?g:o),y=tx({callback:r.useCallback((()=>{h.current?(null!=f.current&&clearTimeout(f.current),f.current=setTimeout((()=>{d(Array.isArray(x.current)?x.current:[x.current]),f.current=null}),v)):h.current=!0}),[v]),disabled:p||!i}),b=r.useCallback(((e,t)=>{y&&(t&&(y.unobserve(t),h.current=!1),e&&y.observe(e))}),[y]),[w,k]=sr(b),N=Ko(t);return r.useEffect((()=>{y&&w.current&&(y.disconnect(),h.current=!1,y.observe(w.current))}),[w,y]),er((()=>(l({type:Ug.RegisterDroppable,element:{id:o,key:s,disabled:n,node:w,rect:m,data:N}}),()=>l({type:Ug.UnregisterDroppable,key:s,id:o}))),[o]),r.useEffect((()=>{n!==u.current.disabled&&(l({type:Ug.SetDroppableDisabled,id:o,key:s,disabled:n}),u.current.disabled=n)}),[o,s,n,l]),{active:i,rect:m,isOver:(null==c?void 0:c.id)===o,node:w,over:c,setNodeRef:k}}({id:i,data:k,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...c}}),{active:_,activatorEvent:I,activeNodeRect:A,attributes:M,setNodeRef:T,listeners:O,isDragging:D,over:R,setActivatorNodeRef:P,transform:F}=Sx({id:i,data:k,attributes:{...$x,...n},disabled:b.draggable}),L=mr(j,T),z=Boolean(_),B=z&&!p&&Ax(m)&&Ax(v),U=!x&&D,V=U&&B?F:null,G=B?null!=V?V:(null!=l?l:y)({rects:g,activeNodeRect:A,activeIndex:m,overIndex:v,index:w}):null,$=Ax(m)&&Ax(v)?s({id:i,items:u,activeIndex:m,overIndex:v}):w,H=null==_?void 0:_.id,W=r.useRef({activeId:H,items:u,newIndex:$,containerId:h}),q=u!==W.current.items,Y=t({active:_,containerId:h,isDragging:D,isSorting:z,id:i,index:w,items:u,newIndex:W.current.newIndex,previousItems:W.current.items,previousContainerId:W.current.containerId,transition:d,wasDragging:null!=W.current.activeId}),X=function(e){let{disabled:t,index:n,node:o,rect:a}=e;const[s,i]=r.useState(null),l=r.useRef(n);return er((()=>{if(!t&&n!==l.current&&o.current){const e=a.current;if(e){const t=sv(o.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&i(n)}}n!==l.current&&(l.current=n)}),[t,n,o,a]),r.useEffect((()=>{s&&i(null)}),[s]),s}({disabled:!Y,index:w,node:E,rect:C});return r.useEffect((()=>{z&&W.current.newIndex!==$&&(W.current.newIndex=$),h!==W.current.containerId&&(W.current.containerId=h),u!==W.current.items&&(W.current.items=u)}),[z,$,h,u]),r.useEffect((()=>{if(H===W.current.activeId)return;if(H&&!W.current.activeId)return void(W.current.activeId=H);const e=setTimeout((()=>{W.current.activeId=H}),50);return()=>clearTimeout(e)}),[H]),{active:_,activeIndex:m,attributes:M,data:k,rect:C,index:w,newIndex:$,items:u,isOver:S,isSorting:z,isDragging:D,listeners:O,node:E,overIndex:v,over:R,setNodeRef:L,setActivatorNodeRef:P,setDroppableNodeRef:j,setDraggableNodeRef:T,transform:null!=X?X:G,transition:function(){if(X||q&&W.current.newIndex===w)return Gx;if(U&&!qo(I)||!d)return;if(z||Y)return fr.Transition.toString({...d,property:Vx});return}()}}function Wx(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const qx=[_v.Down,_v.Right,_v.Up,_v.Left],Yx=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:a,over:s,scrollableAncestors:i}}=t;if(qx.includes(e.code)){if(e.preventDefault(),!n||!o)return;const t=[];a.getEnabled().forEach((n=>{if(!n||null!=n&&n.disabled)return;const a=r.get(n.id);if(a)switch(e.code){case _v.Down:o.top<a.top&&t.push(n);break;case _v.Up:o.top>a.top&&t.push(n);break;case _v.Left:o.left>a.left&&t.push(n);break;case _v.Right:o.left<a.left&&t.push(n)}}));const l=(e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e;const r=Xg(t),a=[];for(const s of o){const{id:e}=s,t=n.get(e);if(t){const n=Xg(t),o=r.reduce(((e,t,o)=>e+Wg(n[o],t)),0),i=Number((o/4).toFixed(4));a.push({id:e,data:{droppableContainer:s,value:i}})}}return a.sort(qg)})({active:n,collisionRect:o,droppableRects:r,droppableContainers:t,pointerCoordinates:null});let c=Kg(l,"id");if(c===(null==s?void 0:s.id)&&l.length>1&&(c=l[1].id),null!=c){const e=a.get(n.id),t=a.get(c),s=t?r.get(t.id):null,l=null==t?void 0:t.node.current;if(l&&s&&e&&t){const n=lv(l).some(((e,t)=>i[t]!==e)),r=Xx(e,t),a=function(e,t){if(!Wx(e)||!Wx(t))return!1;if(!Xx(e,t))return!1;return e.data.current.sortable.index<t.data.current.sortable.index}(e,t),c=n||!r?{x:0,y:0}:{x:a?o.width-s.width:0,y:a?o.height-s.height:0},d={x:s.left,y:s.top};return c.x&&c.y?d:Yo(d,c)}}}};function Xx(e,t){return!(!Wx(e)||!Wx(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}const Kx=u.createContext(null),Jx=r.memo((()=>r.useContext(Kx)));Jx.displayName="DragHandle";const Zx=u.forwardRef((({cellId:e,canMoveX:t,...n},o)=>{const{attributes:r,listeners:a,setNodeRef:s,transform:i,transition:l,isDragging:c}=Hx({id:e.toString()}),d={transform:i?fr.Transform.toString({x:t?i.x:0,y:i.y,scaleX:1,scaleY:1}):void 0,transition:l,zIndex:c?2:void 0,position:"relative"},u=Og(o,s),h=k.jsx("div",{...r,...a,onMouseDown:tt.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:k.jsx(ac,{strokeWidth:1,size:20})}),m=Boolean(i);return k.jsx("div",{tabIndex:-1,ref:u,...n,"data-is-dragging":c,className:on(n.className,m&&"is-moving","outline-offset-4 outline-primary/40 rounded-lg"),style:d,children:k.jsx(Kx.Provider,{value:h,children:n.children})})}));Zx.displayName="SortableCell";const Qx=r.memo(Zx),ey=u.memo(u.forwardRef(((e,t)=>{const n=b(34);let o,a,s;n[0]!==e?(({children:s,showTooltip:o,...a}=e),n[0]=e,n[1]=o,n[2]=a,n[3]=s):(o=n[1],a=n[2],s=n[3]);const i=void 0===o||o,[l,c]=r.useState(!1);let d;n[4]!==a?(d={cell:a},n[4]=a,n[5]=d):d=n[5];const u=kd(d),h=pr();let m,f,p,g,v,x;if(n[6]===Symbol.for("react.memo_cache_sentinel")?(m=()=>({toggle:()=>c((e=>!e))}),n[6]=m):m=n[6],r.useImperativeHandle(t,m),n[7]===Symbol.for("react.memo_cache_sentinel")?(f=k.jsx(Ye,{placeholder:"Search actions...",className:"h-6 m-1"}),n[7]=f):f=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(p=k.jsx(Ke,{children:"No results"}),n[8]=p):p=n[8],n[9]!==u){let e;n[11]!==u.length?(e=(e,t)=>k.jsxs(r.Fragment,{children:[k.jsx(Be,{children:e.map((e=>k.jsx($e,{onSelect:()=>{e.disableClick||(e.handle(),c(!1))},variant:e.variant,children:k.jsxs("div",{className:"flex items-center flex-1",children:[e.icon&&k.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:e.icon}),k.jsx("div",{className:"flex-1",children:e.label}),k.jsxs("div",{className:"flex-shrink-0 text-sm",children:[e.hotkey&&gr(e.hotkey),e.rightElement]})]})},e.label)))},t),t<u.length-1&&k.jsx(Ve,{})]},t),n[11]=u.length,n[12]=e):e=n[12],g=u.map(e),n[9]=u,n[10]=g}else g=n[10];n[13]!==g?(v=k.jsxs(mn,{children:[f,k.jsxs(vr,{children:[p,g]})]}),n[13]=g,n[14]=v):v=n[14],n[15]!==h||n[16]!==v?(x=k.jsx(un,{className:"w-[300px] p-0 pt-1",...h,children:v}),n[15]=h,n[16]=v,n[17]=x):x=n[17];const y=x;if(!i){let e,t;return n[18]!==s?(e=k.jsx(xr,{asChild:!0,children:s}),n[18]=s,n[19]=e):e=n[19],n[20]!==l||n[21]!==e||n[22]!==y?(t=k.jsxs(hn,{open:l,onOpenChange:c,children:[e,y]}),n[20]=l,n[21]=e,n[22]=y,n[23]=t):t=n[23],t}let w;n[24]===Symbol.for("react.memo_cache_sentinel")?(w=k.jsx(yr,{tabIndex:-1,children:N("cell.cellActions")}),n[24]=w):w=n[24];const C=!l&&w;let E,S,j;return n[25]!==s?(E=k.jsx(br,{children:k.jsx(xr,{className:"flex",children:s})}),n[25]=s,n[26]=E):E=n[26],n[27]!==C||n[28]!==E?(S=k.jsxs(wr,{delayDuration:200,disableHoverableContent:!0,children:[C,E]}),n[27]=C,n[28]=E,n[29]=S):S=n[29],n[30]!==l||n[31]!==S||n[32]!==y?(j=k.jsxs(hn,{open:l,onOpenChange:c,children:[S,y]}),n[30]=l,n[31]=S,n[32]=y,n[33]=j):j=n[33],j}))),ty=u.memo((e=>{const t=b(5),{children:n,cellId:o}=e;let r,a;t[0]!==o?(a=function(e){return Z((t=>Ad(e,t(se))))}(o),t[0]=o,t[1]=a):a=t[1],r=a;const s=le(r);if(!s)return null;let i;return t[2]!==s||t[3]!==n?(i=k.jsx(ey,{showTooltip:!1,...s,children:n}),t[2]=s,t[3]=n,t[4]=i):i=t[4],i}));ty.displayName="ConnectionCellActionsDropdown";const ny=e=>{const t=b(29);let n,o,r;t[0]!==e?(({children:o,...n}=e),t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),t[3]!==n?(r={cell:n},t[3]=n,t[4]=r):r=t[4];const a=kd(r),[s,i]=u.useState();let l,c,d,h,m,f,p,g,v;if(t[5]===Symbol.for("react.memo_cache_sentinel")?(l=k.jsx(nt,{size:13,strokeWidth:1.5}),t[5]=l):l=t[5],t[6]!==n.cellId?(c=()=>{var e;if(null==(e=window.getSelection())?void 0:e.toString())return void document.execCommand("copy");const t=document.getElementById(G.create(n.cellId));t?navigator.clipboard.writeText(t.textContent??""):J.warn("cell-context-menu: output not found")},t[6]=n.cellId,t[7]=c):c=t[7],t[8]!==c||t[9]!==n||t[10]!==s||t[11]!==o||t[12]!==a){const e=[{label:"Copy",icon:l,handle:c},{label:"Cut",icon:k.jsx(Ac,{size:13,strokeWidth:1.5}),handle:oy},{label:"Paste",icon:k.jsx(ql,{size:13,strokeWidth:1.5}),handle:async()=>{const{getEditorView:e}=n,t=e();if(!t)return;const o=await navigator.clipboard.readText();if(o){const{from:e,to:n}=t.state.selection.main,r=t.state.update({changes:{from:e,to:n,insert:o}});t.dispatch(r)}}},{icon:k.jsx(Zi,{size:13,strokeWidth:1.5}),label:"Download image",hidden:!s,handle:()=>{if(s){const e=document.createElement("a");e.download="image.png",e.href=s.src,e.click()}}},{label:"Go to Definition",icon:k.jsx(kr,{size:13,strokeWidth:1.5}),handle:()=>{const{getEditorView:e}=n,t=e();t&&Nr(t)}}];let r;f=hg,t[18]===Symbol.for("react.memo_cache_sentinel")?(r=e=>{e.target instanceof HTMLImageElement?i(e.target):i(void 0)},t[18]=r):r=t[18],t[19]!==o?(p=k.jsx(mg,{onContextMenu:r,asChild:!0,children:o}),t[19]=o,t[20]=p):p=t[20],d=gg,h="w-[300px]",m=[e,...a].map(ay),t[8]=c,t[9]=n,t[10]=s,t[11]=o,t[12]=a,t[13]=d,t[14]=h,t[15]=m,t[16]=f,t[17]=p}else d=t[13],h=t[14],m=t[15],f=t[16],p=t[17];return t[21]!==d||t[22]!==h||t[23]!==m?(g=k.jsx(d,{className:h,children:m}),t[21]=d,t[22]=h,t[23]=m,t[24]=g):g=t[24],t[25]!==f||t[26]!==p||t[27]!==g?(v=k.jsxs(f,{children:[p,g]}),t[25]=f,t[26]=p,t[27]=g,t[28]=v):v=t[28],v};function oy(){document.execCommand("cut")}function ry(e){return e.hidden?null:k.jsx(vg,{onSelect:t=>{e.handle(t)},variant:e.variant,children:k.jsxs("div",{className:"flex items-center flex-1",children:[e.icon&&k.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:e.icon}),k.jsx("div",{className:"flex-1",children:e.label}),k.jsxs("div",{className:"flex-shrink-0 text-sm",children:[e.hotkey&&gr(e.hotkey),e.rightElement]})]})},e.label)}function ay(e,t){return k.jsxs(r.Fragment,{children:[e.map(ry),t<e.length-1&&k.jsx(xg,{})]},t)}const sy=e=>{const t=b(24),{editorView:n,code:o,currentLanguageAdapter:r,onAfterToggle:a}=e;let s,i;t[0]!==o?(i=(new Bo).isSupported(o)||""===o.trim(),t[0]=o,t[1]=i):i=t[1],s=i;const l=s;let c,d;t[2]!==o?(d=(new Uo).isSupported(o)||""===o.trim(),t[2]=o,t[3]=d):d=t[3],c=d;const u=c&&"python"===r;let h,m;t[4]===Symbol.for("react.memo_cache_sentinel")?(h=k.jsx(ke,{color:"var(--sky-11)",strokeWidth:2.5,className:"w-4 h-4"}),t[4]=h):h=t[4],t[5]!==n||t[6]!==r||t[7]!==u||t[8]!==a?(m=k.jsx(iy,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:u,icon:h,toType:"sql",displayName:"SQL",onAfterToggle:a}),t[5]=n,t[6]=r,t[7]=u,t[8]=a,t[9]=m):m=t[9];const f=l&&"python"===r;let p,g,v,x,y;return t[10]===Symbol.for("react.memo_cache_sentinel")?(p=k.jsx(Ni,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),t[10]=p):p=t[10],t[11]!==n||t[12]!==r||t[13]!==f||t[14]!==a?(g=k.jsx(iy,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:f,icon:p,toType:"markdown",displayName:"Markdown",onAfterToggle:a}),t[11]=n,t[12]=r,t[13]=f,t[14]=a,t[15]=g):g=t[15],t[16]===Symbol.for("react.memo_cache_sentinel")?(v=k.jsx(Ci,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),t[16]=v):v=t[16],t[17]!==n||t[18]!==r?(x=k.jsx(iy,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:!0,icon:v,toType:"python",displayName:"Python",onAfterToggle:rn.NOOP}),t[17]=n,t[18]=r,t[19]=x):x=t[19],t[20]!==m||t[21]!==g||t[22]!==x?(y=k.jsxs("div",{className:"absolute right-3 top-2 z-20 flex hover-action gap-1",children:[m,g,x]}),t[20]=m,t[21]=g,t[22]=x,t[23]=y):y=t[23],y},iy=e=>{const t=b(10),{editorView:n,currentLanguageAdapter:o,canSwitchToLanguage:r,icon:a,toType:s,displayName:i,onAfterToggle:l}=e;if(!r)return null;if(o===s)return null;const c=`View as ${i}`;let d,u,h;return t[0]!==n||t[1]!==s||t[2]!==l?(d=()=>{n&&(we(n,s),l())},t[0]=n,t[1]=s,t[2]=l,t[3]=d):d=t[3],t[4]!==d||t[5]!==a?(u=k.jsx(E,{"data-testid":"language-toggle-button",variant:"text",size:"xs",className:"opacity-80 px-1",onClick:d,children:a}),t[4]=d,t[5]=a,t[6]=u):u=t[6],t[7]!==c||t[8]!==u?(h=k.jsx(C,{content:c,children:u}),t[7]=c,t[8]=u,t[9]=h):h=t[9],h};var ly={modified:{doc:""},original:{doc:""}},cy=r.createContext(ly);function dy(e,t){return mo({},e,t,{modified:mo({},e.modified,t.modified),original:mo({},e.original,t.original)})}var uy=()=>r.useContext(cy),hy=e=>{var{children:t,theme:n}=e,[o,a]=r.useReducer(dy,mo({},ly,{theme:n}));return r.useEffect((()=>a({theme:n})),[n]),k.jsx(cy.Provider,{value:mo({},o,{dispatch:a}),children:t})},my=["extensions","value","selection","onChange"],fy=e=>{var{extensions:t=[],value:n,selection:o,onChange:a}=e,s=Cr(e,my),{theme:i,dispatch:l}=uy(),c=Er(mo({},s,{theme:i}));return r.useEffect((()=>l({original:{doc:n,selection:o,extensions:[...c,...t]},originalExtension:{onChange:a,option:s,extension:[t]}})),[e]),null};fy.displayName="CodeMirrorMerge.Original";var py=["extensions","value","selection","onChange"],gy=e=>{var{extensions:t=[],value:n,selection:o,onChange:a}=e,s=Cr(e,py),{theme:i,dispatch:l}=uy(),c=Er(mo({},s,{theme:i}));return r.useEffect((()=>{l({modified:{doc:n,selection:o,extensions:[...c,...t]},modifiedExtension:{onChange:a,option:s,extension:[t]}})}),[e]),null};gy.displayName="CodeMirrorMerge.Modified";class vy{constructor(e,t,n,o){this.fromA=e,this.toA=t,this.fromB=n,this.toB=o}offset(e,t){return new vy(this.fromA+e,this.toA+e,this.fromB+t,this.toB+t)}}function xy(e,t,n,o,r,a){if(e==o)return[];let s=Ey(e,t,n,o,r,a),i=Sy(e,t+s,n,o,r+s,a),l=(n-=i)-(t+=s),c=(a-=i)-(r+=s);if(!l||!c)return[new vy(t,n,r,a)];if(l>c){let s=e.slice(t,n).indexOf(o.slice(r,a));if(s>-1)return[new vy(t,t+s,r,r),new vy(t+s+c,n,a,a)]}else if(c>l){let s=o.slice(r,a).indexOf(e.slice(t,n));if(s>-1)return[new vy(t,t,r,r+s),new vy(n,n,r+s+l,a)]}if(1==l||1==c)return[new vy(t,n,r,a)];let d=_y(e,t,n,o,r,a);if(d){let[s,i,l]=d;return xy(e,t,s,o,r,i).concat(xy(e,s+l,n,o,i+l,a))}return function(e,t,n,o,r,a){let s=n-t,i=a-r;if(yy<1e9&&Math.min(s,i)>16*yy)return Math.min(s,i)>64*yy?[new vy(t,n,r,a)]:Iy(e,t,n,o,r,a);let l=Math.ceil((s+i)/2);wy.reset(l),ky.reset(l);let c=(n,a)=>e.charCodeAt(t+n)==o.charCodeAt(r+a),d=(t,r)=>e.charCodeAt(n-t-1)==o.charCodeAt(a-r-1),u=(s-i)%2!=0?ky:null,h=u?null:wy;for(let m=0;m<l;m++){if(m>yy)return Iy(e,t,n,o,r,a);let f=wy.advance(m,s,i,l,u,!1,c)||ky.advance(m,s,i,l,h,!0,d);if(f)return Ny(e,t,n,t+f[0],o,r,a,r+f[1])}return[new vy(t,n,r,a)]}(e,t,n,o,r,a)}let yy=1e9;class by{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let t=0;t<this.len;t++)this.vec[t]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,o,r,a,s){for(let i=-e+this.start;i<=e-this.end;i+=2){let l=o+i,c=i==-e||i!=e&&this.vec[l-1]<this.vec[l+1]?this.vec[l+1]:this.vec[l-1]+1,d=c-i;for(;c<t&&d<n&&s(c,d);)c++,d++;if(this.vec[l]=c,c>t)this.end+=2;else if(d>n)this.start+=2;else if(r){let e=o+(t-n)-i;if(e>=0&&e<this.len&&-1!=r.vec[e])if(a){let n=r.vec[e];if(n>=t-c)return[n,o+n-e]}else{if(c>=t-r.vec[e])return[c,d]}}}return null}}const wy=new by,ky=new by;function Ny(e,t,n,o,r,a,s,i){let l=!1;return By(e,o)||++o!=n||(l=!0),By(r,i)||++i!=s||(l=!0),l?[new vy(t,n,a,s)]:xy(e,t,o,r,a,i).concat(xy(e,o,n,r,i,s))}function Cy(e,t){let n=1,o=Math.min(e,t);for(;n<o;)n<<=1;return n}function Ey(e,t,n,o,r,a){if(t==n||t==a||e.charCodeAt(t)!=o.charCodeAt(r))return 0;let s=Cy(n-t,a-r);for(let i=t,l=r;;){let r=i+s,c=l+s;if(r>n||c>a||e.slice(i,r)!=o.slice(l,c)){if(1==s)return i-t-(By(e,i)?0:1);s>>=1}else{if(r==n||c==a)return r-t;i=r,l=c}}}function Sy(e,t,n,o,r,a){if(t==n||r==a||e.charCodeAt(n-1)!=o.charCodeAt(a-1))return 0;let s=Cy(n-t,a-r);for(let i=n,l=a;;){let a=i-s,c=l-s;if(a<t||c<r||e.slice(a,i)!=o.slice(c,l)){if(1==s)return n-i-(By(e,i)?0:1);s>>=1}else{if(a==t||c==r)return n-a;i=a,l=c}}}function jy(e,t,n,o,r,a,s,i){let l=o.slice(r,a),c=null;for(;;){if(c||s<i)return c;for(let i=t+s;;){By(e,i)||i++;let d=i+s;if(By(e,d)||(d+=d==i+1?1:-1),d>=n)break;let u=e.slice(i,d),h=-1;for(;-1!=(h=l.indexOf(u,h+1));){let s=Ey(e,d,n,o,r+h+u.length,a),l=Sy(e,t,i,o,r,r+h),m=u.length+s+l;(!c||c[2]<m)&&(c=[i-l,r+h-l,m])}i=d}if(i<0)return c;s>>=1}}function _y(e,t,n,o,r,a){let s=n-t,i=a-r;if(s<i){let s=_y(o,r,a,e,t,n);return s&&[s[1],s[0],s[2]]}return s<4||2*i<s?null:jy(e,t,n,o,r,a,Math.floor(s/4),-1)}function Iy(e,t,n,o,r,a){let s,i=n-t,l=a-r;if(i<l){let l=jy(o,r,a,e,t,n,Math.floor(i/6),50);s=l&&[l[1],l[0],l[2]]}else s=jy(e,t,n,o,r,a,Math.floor(l/6),50);if(!s)return[new vy(t,n,r,a)];let[c,d,u]=s;return xy(e,t,c,o,r,d).concat(xy(e,c+u,n,o,d+u,a))}function Ay(e,t){for(let n=1;n<e.length;n++){let o=e[n-1],r=e[n];o.toA>r.fromA-t&&o.toB>r.fromB-t&&(e[n-1]=new vy(o.fromA,r.toA,o.fromB,r.toB),e.splice(n--,1))}}let My;try{My=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch(gO){}function Ty(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function Oy(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?Ty(n)?1:0:My?Ly(n)&&t!=e.length-1?My.test(e.slice(t,t+2))?2:0:My.test(String.fromCharCode(n))?1:0:0}function Dy(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?Ty(n)?1:0:My?zy(n)&&1!=t?My.test(e.slice(t-2,t))?2:0:My.test(String.fromCharCode(n))?1:0:0}function Ry(e,t,n){if(t==e.length||!Dy(e,t))return t;for(let o=t,r=t+n;;){let n=Oy(e,o);if(!n)return o;if(o+=n,o>r)return t}}function Py(e,t,n){if(!t||!Oy(e,t))return t;for(let o=t,r=t-n;;){let n=Dy(e,o);if(!n)return o;if(o-=n,o<r)return t}}function Fy(e,t,n){for(let o=t,r=t-n;;){let n=o?e.charCodeAt(o-1):10;if(10==n)return o;if(o--,o<r||32!=n&&9!=n)return t}}const Ly=e=>e>=55296&&e<=56319,zy=e=>e>=56320&&e<=57343;function By(e,t){return!t||t==e.length||!Ly(e.charCodeAt(t-1))||!zy(e.charCodeAt(t))}function Uy(e,t,n){var o;return yy=(null!==(o=null==n?void 0:n.scanLimit)&&void 0!==o?o:1e9)>>1,function(e,t,n){for(;;){Ay(n,1);let o=!1;for(let r=0;r<n.length;r++){let a,s,i=n[r];(a=Ey(e,i.fromA,i.toA,t,i.fromB,i.toB))&&(i=n[r]=new vy(i.fromA+a,i.toA,i.fromB+a,i.toB)),(s=Sy(e,i.fromA,i.toA,t,i.fromB,i.toB))&&(i=n[r]=new vy(i.fromA,i.toA-s,i.fromB,i.toB-s));let l=i.toA-i.fromA,c=i.toB-i.fromB;if(l&&c)continue;let d=i.fromA-(r?n[r-1].toA:0),u=(r<n.length-1?n[r+1].fromA:e.length)-i.toA;if(!d||!u)continue;let h=l?e.slice(i.fromA,i.toA):t.slice(i.fromB,i.toB);d<=h.length&&e.slice(i.fromA-d,i.fromA)==h.slice(h.length-d)?(n[r]=new vy(i.fromA-d,i.toA-d,i.fromB-d,i.toB-d),o=!0):u<=h.length&&e.slice(i.toA,i.toA+u)==h.slice(0,u)&&(n[r]=new vy(i.fromA+u,i.toA+u,i.fromB+u,i.toB+u),o=!0)}if(!o)break}return n}(e,t,xy(e,0,e.length,t,0,t.length))}function Vy(e,t,n){return function(e,t,n){for(let o=0,r=0;r<e.length;r++){let a=e[r],s=a.toA-a.fromA,i=a.toB-a.fromB;if(s&&i||s>3||i>3){let l=r==e.length-1?t.length:e[r+1].fromA,c=a.fromA-o,d=l-a.toA,u=Py(t,a.fromA,Math.min(c,5)),h=Ry(t,a.toA,Math.min(d,5)),m=a.fromA-u,f=h-a.toA;if(!s||!i){let d,p,g=Math.max(s,i),[v,x,y]=s?[t,a.fromA,a.toA]:[n,a.fromB,a.toB];m&&f?(g>m&&t.slice(u,a.fromA)==v.slice(y-m,y)?(a=e[r]=new vy(u,u+s,a.fromB-m,a.toB-m),u=a.fromA,h=Ry(t,a.toA,Math.min(l-a.toA,5))):g>f&&t.slice(a.toA,h)==v.slice(x,x+f)&&(a=e[r]=new vy(h-s,h,a.fromB+f,a.toB+f),h=a.toA,u=Py(t,a.fromA,Math.min(a.fromA-o,5))),m=a.fromA-u,f=h-a.toA):m||f||!(p=a.fromA-(d=Fy(t,a.fromA,c)))||t.slice(d,a.fromA)!=v.slice(y-p,y)||(a=e[r]=new vy(d,d+s,a.fromB-p,a.toB-p))}(m||f)&&(a=e[r]=new vy(a.fromA-m,a.toA+f,a.fromB-m,a.toB+f)),o=a.toA}}return Ay(e,3),e}(Uy(e,t,n),e,t)}const Gy=yn.define({combine:e=>e[0]}),$y=Yt.define(),Hy=Xt.define({create:e=>null,update(e,t){for(let n of t.effects)n.is($y)&&(e=n.value);return e}});class Wy{constructor(e,t,n,o,r){this.changes=e,this.fromA=t,this.toA=n,this.fromB=o,this.toB=r}offset(e,t){return e||t?new Wy(this.changes,this.fromA+e,this.toA+e,this.fromB+t,this.toB+t):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,t,n){return Xy(Vy(e.toString(),t.toString(),n),e,t,0,0)}static updateA(e,t,n,o,r){return Qy(Zy(e,o,!0,n.length),e,t,n,r)}static updateB(e,t,n,o,r){return Qy(Zy(e,o,!1,t.length),e,t,n,r)}}function qy(e,t,n,o){let r=n.lineAt(e),a=o.lineAt(t);return r.to==e&&a.to==t&&e<n.length&&t<o.length?[e+1,t+1]:[r.from,a.from]}function Yy(e,t,n,o){let r=n.lineAt(e),a=o.lineAt(t);return r.from==e&&a.from==t?[e,t]:[r.to+1,a.to+1]}function Xy(e,t,n,o,r){let a=[];for(let s=0;s<e.length;s++){let i=e[s],[l,c]=qy(i.fromA+o,i.fromB+r,t,n),[d,u]=Yy(i.toA+o,i.toB+r,t,n),h=[i.offset(-l+o,-c+r)];for(;s<e.length-1;){let a=e[s+1],[i,m]=qy(a.fromA+o,a.fromB+r,t,n);if(i>d+1&&m>u+1)break;h.push(a.offset(-l+o,-c+r)),[d,u]=Yy(a.toA+o,a.toB+r,t,n),s++}a.push(new Wy(h,l,Math.max(l,d),c,Math.max(c,u)))}return a}const Ky=1e3;function Jy(e,t,n,o){let r=0,a=e.length;for(;;){if(r==a){let o=0,a=0;r&&({toA:o,toB:a}=e[r-1]);let s=t-(n?o:a);return[o+s,a+s]}let s=r+a>>1,i=e[s],[l,c]=n?[i.fromA,i.toA]:[i.fromB,i.toB];if(l>t)a=s;else{if(!(c<=t))return o?[i.fromA,i.fromB]:[i.toA,i.toB];r=s+1}}}function Zy(e,t,n,o){let r=[];return t.iterChangedRanges(((a,s,i,l)=>{let c=0,d=n?t.length:o,u=0,h=n?o:t.length;a>Ky&&([c,u]=Jy(e,a-Ky,n,!0)),s<t.length-Ky&&([d,h]=Jy(e,s+Ky,n,!1));let m,f=l-i-(s-a),[p,g]=n?[f,0]:[0,f];r.length&&(m=r[r.length-1]).toA>=c?r[r.length-1]={fromA:m.fromA,fromB:m.fromB,toA:d,toB:h,diffA:m.diffA+p,diffB:m.diffB+g}:r.push({fromA:c,toA:d,fromB:u,toB:h,diffA:p,diffB:g})})),r}function Qy(e,t,n,o,r){if(!e.length)return t;let a=0,s=0,i=0,l=[];for(let c of e){let e=c.fromA+s,d=c.toA+s+c.diffA,u=c.fromB+i,h=c.toB+i+c.diffB;for(;a<t.length;){let n=t[a];if(n.toA+s<=e&&n.toB+i<=u)l.push(n.offset(s,i));else if(n.fromA+s>d)break;a++}for(let t of Xy(Vy(n.sliceString(e,d),o.sliceString(u,h),r),n,o,e,u))l.push(t);for(s+=c.diffA,i+=c.diffB;a<t.length;){let e=t[a];if(e.fromA>d+s&&e.fromB>h+i)break;a++}}for(;a<t.length;)l.push(t[a++].offset(s,i));return l}const eb=Jt.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=lb(e))}update(e){var t,n;(e.docChanged||e.viewportChanged||(t=e.startState,n=e.state,t.field(Hy,!1)!=n.field(Hy,!1))||function(e,t){return e.facet(Gy)!=t.facet(Gy)}(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=lb(e.view))}},{decorations:e=>e.deco}),tb=vn.low(Sr({class:"cm-changeGutter",markers:e=>{var t;return(null===(t=e.plugin(eb))||void 0===t?void 0:t.gutter)||jr.empty}}));const nb=Kt.line({class:"cm-changedLine"}),ob=Kt.mark({class:"cm-changedText"}),rb=Kt.mark({tagName:"ins",class:"cm-insertedLine"}),ab=Kt.mark({tagName:"del",class:"cm-deletedLine"}),sb=new class extends Ar{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function ib(e,t,n,o,r,a){let s=n?e.fromA:e.fromB,i=n?e.toA:e.toB,l=0;if(s!=i){r.add(s,s,nb),r.add(s,i,n?ab:rb),a&&a.add(s,s,sb);for(let c=t.iterRange(s,i-1),d=s;!c.next().done;){if(c.lineBreak){d++,r.add(d,d,nb),a&&a.add(d,d,sb);continue}let t=d+c.value.length;if(o)for(;l<e.changes.length;){let o=e.changes[l],a=s+(n?o.fromA:o.fromB),i=s+(n?o.toA:o.toB),c=Math.max(d,a),u=Math.min(t,i);if(c<u&&r.add(c,u,ob),!(i<t))break;l++}d=t}}}function lb(e){let t=e.state.field(Hy),{side:n,highlightChanges:o,markGutter:r}=e.state.facet(Gy),a="a"==n,s=new Zt,i=r?new Zt:null,{from:l,to:c}=e.viewport;for(let d of t){if((a?d.fromA:d.fromB)>=c)break;(a?d.toA:d.toB)>l&&ib(d,e.state.doc,a,o,s,i)}return{deco:s.finish(),gutter:i&&i.finish()}}class cb extends xn{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 db=Yt.define({map:(e,t)=>e.map(t)}),ub=Xt.define({create:()=>Kt.none,update:(e,t)=>{for(let n of t.effects)if(n.is(db))return n.value;return e.map(t.changes)},provide:e=>qt.decorations.from(e)}),hb=.01;const mb=Yt.define({map:(e,t)=>t.mapPos(e)});class fb extends xn{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let t=document.createElement("div");return t.className="cm-collapsedLines",t.textContent="⦚ "+e.state.phrase("$ unchanged lines",this.lines)+" ⦚",t.addEventListener("click",(t=>{let n=e.posAtDOM(t.target);e.dispatch({effects:mb.of(n)});let{side:o,sibling:r}=e.state.facet(Gy);r&&r().dispatch({effects:mb.of(pb(n,e.state.field(Hy),"a"==o))})})),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}}function pb(e,t,n){let o=0,r=0;for(let a=0;;a++){let s=a<t.length?t[a]:null;if(!s||(n?s.fromA:s.fromB)>=e)return r+(e-o);[o,r]=n?[s.toA,s.toB]:[s.toB,s.toA]}}const gb=Xt.define({create:e=>Kt.none,update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(mb)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>qt.decorations.from(e)});function vb({margin:e=3,minSize:t=4}){return gb.init((n=>function(e,t,n){let o=new Zt,r="a"==e.facet(Gy).side,a=e.field(Hy),s=1;for(let i=0;;i++){let l=i<a.length?a[i]:null,c=i?s+t:1,d=l?e.doc.lineAt(r?l.fromA:l.fromB).number-1-t:e.doc.lines,u=d-c+1;if(u>=n&&o.add(e.doc.line(c).from,e.doc.line(d).to,Kt.replace({widget:new fb(u),block:!0})),!l)break;s=e.doc.lineAt(Math.min(e.doc.length,r?l.toA:l.toB)).number}return o.finish()}(n,e,t)))}const xb=qt.styleModule.of(new _r({".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"}})),yb=qt.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"}}),bb=new Ir,wb=new Ir;class kb{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig;let t=[vn.low(eb),yb,xb,ub,qt.updateListener.of((e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some((e=>e.effects.some((e=>e.is(db)))))&&this.measure()}))],n=[Gy.of({side:"a",sibling:()=>this.b,highlightChanges:!1!==e.highlightChanges,markGutter:!1!==e.gutter})];!1!==e.gutter&&n.push(tb);let o=oo.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],qt.editorAttributes.of({class:"cm-merge-a"}),wb.of(n),t]}),r=[Gy.of({side:"b",sibling:()=>this.a,highlightChanges:!1!==e.highlightChanges,markGutter:!1!==e.gutter})];!1!==e.gutter&&r.push(tb);let a=oo.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],qt.editorAttributes.of({class:"cm-merge-b"}),wb.of(r),t]});this.chunks=Wy.build(o.doc,a.doc,this.diffConf);let s=[Hy.init((()=>this.chunks)),bb.of(e.collapseUnchanged?vb(e.collapseUnchanged):[])];o=o.update({effects:Yt.appendConfig.of(s)}).state,a=a.update({effects:Yt.appendConfig.of(s)}).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 i=e.orientation||"a-b",l=document.createElement("div");l.className="cm-mergeViewEditor";let c=document.createElement("div");c.className="cm-mergeViewEditor",this.editorDOM.appendChild("a-b"==i?l:c),this.editorDOM.appendChild("a-b"==i?c:l),this.a=new qt({state:o,parent:l,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new qt({state:a,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.b)}),this.setupRevertControls(!!e.revertControls,"b-to-a"==e.revertControls,e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,t){if(e.some((e=>e.docChanged))){let n=e[e.length-1],o=e.reduce(((e,t)=>e.compose(t.changes)),Nn.empty(e[0].startState.doc.length));this.chunks=t==this.a?Wy.updateA(this.chunks,n.newDoc,this.b.state.doc,o,this.diffConf):Wy.updateB(this.chunks,this.a.state.doc,n.newDoc,o,this.diffConf),t.update([...e,n.state.update({effects:$y.of(this.chunks)})]);let r=t==this.a?this.b:this.a;r.update([r.state.update({effects:$y.of(this.chunks)})]),this.scheduleMeasure()}else t.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let t="b-a"!=e.orientation;if(t!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let e=this.a.dom.parentNode,n=this.b.dom.parentNode;e.remove(),n.remove(),this.editorDOM.insertBefore(t?e:n,this.editorDOM.firstChild),this.editorDOM.appendChild(t?n:e),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let t=!!this.revertDOM,n=this.revertToA,o=this.renderRevert;"revertControls"in e&&(t=!!e.revertControls,n="b-to-a"==e.revertControls),"renderRevertControl"in e&&(o=e.renderRevertControl),this.setupRevertControls(t,n,o)}let t="highlightChanges"in e,n="gutter"in e,o="collapseUnchanged"in e;if(t||n||o){let r=[],a=[];if(t||n){let o=this.a.state.facet(Gy),s=n?!1!==e.gutter:o.markGutter,i=t?!1!==e.highlightChanges:o.highlightChanges;r.push(wb.reconfigure([Gy.of({side:"a",sibling:()=>this.b,highlightChanges:i,markGutter:s}),s?tb:[]])),a.push(wb.reconfigure([Gy.of({side:"b",sibling:()=>this.a,highlightChanges:i,markGutter:s}),s?tb:[]]))}if(o){let t=bb.reconfigure(e.collapseUnchanged?vb(e.collapseUnchanged):[]);r.push(t),a.push(t)}this.a.dispatch({effects:r}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,t,n){this.revertToA=t,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!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",(e=>this.revertClicked(e))),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,t,n){let o=new Zt,r=new Zt,a=e.state.field(ub).iter(),s=t.state.field(ub).iter(),i=0,l=0,c=0,d=0;for(let f=0;;f++){let u=f<n.length?n[f]:null;if(i<(u?u.fromA:e.state.doc.length)){let n=e.lineBlockAt(i).top+c-(t.lineBlockAt(l).top+d);n<-.01?(c-=n,o.add(i,i,Kt.widget({widget:new cb(-n),block:!0,side:-1}))):n>hb&&(d+=n,r.add(l,l,Kt.widget({widget:new cb(n),block:!0,side:-1})))}if(!u)break;for(i=u.toA,l=u.toB;a.value&&a.from<i;)c-=a.value.spec.widget.height,a.next();for(;s.value&&s.from<l;)d-=s.value.spec.widget.height,s.next()}for(;a.value;)c-=a.value.spec.widget.height,a.next();for(;s.value;)d-=s.value.spec.widget.height,s.next();let u=e.contentHeight+c-(t.contentHeight+d);u<hb?o.add(e.state.doc.length,e.state.doc.length,Kt.widget({widget:new cb(-u),block:!0,side:1})):u>hb&&r.add(t.state.doc.length,t.state.doc.length,Kt.widget({widget:new cb(u),block:!0,side:1}));let h=o.finish(),m=r.finish();jr.eq([h],[e.state.field(ub)])||e.dispatch({effects:db.of(h)}),jr.eq([m],[t.state.field(ub)])||t.dispatch({effects:db.of(m)})}(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,t=e.firstChild,n=this.a.viewport,o=this.b.viewport;for(let r=0;r<this.chunks.length;r++){let a=this.chunks[r];if(a.fromA>n.to||a.fromB>o.to)break;if(a.fromA<n.from||a.fromB<o.from)continue;let s=this.a.lineBlockAt(a.fromA).top+"px";for(;t&&+t.dataset.chunk<r;)t=Nb(t);t&&t.dataset.chunk==String(r)?(t.style.top!=s&&(t.style.top=s),t=t.nextSibling):e.insertBefore(this.renderRevertButton(s,r),t)}for(;t;)t=Nb(t)}renderRevertButton(e,t){let n;if(this.renderRevert)n=this.renderRevert();else{n=document.createElement("button");let e=this.a.state.phrase("Revert this chunk");n.setAttribute("aria-label",e),n.setAttribute("title",e),n.textContent=this.revertToLeft?"⇜":"⇝"}return n.style.top=e,n.setAttribute("data-chunk",String(t)),n}revertClicked(e){let t,n=e.target;for(;n&&n.parentNode!=this.revertDOM;)n=n.parentNode;if(n&&(t=this.chunks[n.dataset.chunk])){let[n,o,r,a,s,i]=this.revertToA?[this.b,this.a,t.fromB,t.toB,t.fromA,t.toA]:[this.a,this.b,t.fromA,t.toA,t.fromB,t.toB],l=n.state.sliceDoc(r,Math.max(r,a-1));r!=a&&i<=o.state.doc.length&&(l+=n.state.lineBreak),o.dispatch({changes:{from:s,to:Math.min(o.state.doc.length,i),insert:l},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 Nb(e){let t=e.nextSibling;return e.remove(),t}var Cb=["className","children","orientation","revertControls","highlightChanges","gutter","collapseUnchanged","destroyRerender","renderRevertControl"],Eb=["modified","modifiedExtension","original","originalExtension","theme","dispatch"],Sb=u.forwardRef(((e,t)=>{var{className:n,children:o,orientation:a,revertControls:s,highlightChanges:i,gutter:l,collapseUnchanged:c,destroyRerender:d=!0,renderRevertControl:u}=e,h=Cr(e,Cb),m=uy(),{modified:f,modifiedExtension:p,original:g,originalExtension:v,theme:x,dispatch:y}=m,b=Cr(m,Eb),w=r.useRef(null),N=r.useRef(),C={orientation:a,revertControls:s,highlightChanges:i,gutter:l,collapseUnchanged:c,renderRevertControl:u};r.useImperativeHandle(t,(()=>({container:w.current,view:N.current,modified:f,original:g,config:mo({a:g,b:f,parent:w.current},C)})),[w,N,f,g,C]);var E=qt.updateListener.of((e=>{if(e.docChanged&&"function"==typeof(null==v?void 0:v.onChange)){var t=e.state.doc.toString();null==v||v.onChange(t,e)}})),S=qt.updateListener.of((e=>{if(e.docChanged&&"function"==typeof(null==p?void 0:p.onChange)){var t=e.state.doc.toString();null==p||p.onChange(t,e)}}));r.useEffect((()=>{!N.current&&w.current&&v&&p&&(N.current=new kb(mo({a:mo({},g,{extensions:[...(null==v?void 0:v.extension)||[],...Er(mo({},null==v?void 0:v.option,{theme:x})),E]}),b:mo({},f,{extensions:[...(null==p?void 0:p.extension)||[],...Er(mo({},null==p?void 0:p.option,{theme:x})),S]}),parent:w.current},C)),y({view:N.current}))}),[N,w,v,p]),r.useEffect((()=>{if(g&&g.doc&&N.current){var e,t,n=null==(e=N.current)?void 0:e.a.state.doc.toString();if(n!==g.doc)null==(t=N.current)||t.a.dispatch({changes:{from:0,to:n.length,insert:g.doc||""}})}if(f&&f.doc&&N.current){var o,r,a=null==(o=N.current)?void 0:o.b.state.doc.toString();if(a!==f.doc)null==(r=N.current)||r.b.dispatch({changes:{from:0,to:a.length,insert:f.doc||""}})}if(d&&N.current){var s=N.current.a.state.selection.ranges[0].from,i=N.current.b.state.selection.ranges[0].from;N.current.destroy(),N.current=new kb(mo({a:mo({},g,{extensions:[...(null==v?void 0:v.extension)||[],...Er(mo({},null==v?void 0:v.option,{theme:x}))]}),b:mo({},f,{extensions:[...(null==p?void 0:p.extension)||[],...Er(mo({},null==p?void 0:p.option,{theme:x}))]}),parent:w.current},C)),s&&(N.current.a.focus(),N.current.a.dispatch({selection:{anchor:s,head:s}})),i&&(N.current.b.focus(),N.current.b.dispatch({selection:{anchor:i,head:i}}))}}),[N,x,w.current,g,f,v,p,d]),r.useEffect((()=>()=>N.current&&N.current.destroy()),[]),r.useEffect((()=>{if(N.current){var e={};b.orientation!==a&&(e.orientation=a),b.revertControls!==s&&(e.revertControls=s),b.highlightChanges!==i&&(e.highlightChanges=i),b.gutter!==l&&(e.gutter=l),b.collapseUnchanged!==c&&(e.collapseUnchanged=c),b.renderRevertControl!==u&&(e.collapseUnchanged=c),Object.keys(e).length&&y&&N.current&&(N.current.reconfigure(mo({},e)),y(mo({},e)))}}),[y,N,a,s,i,l,c,u]);return k.jsx("div",mo({ref:w,className:"cm-merge-theme"+(n?" "+n:"")},h,{children:o}))}));Sb.displayName="CodeMirrorMerge.Internal";var jb=["theme"],_b=u.forwardRef(((e,t)=>{var{theme:n}=e,o=Cr(e,jb);return k.jsx(hy,{theme:n,children:k.jsx(Sb,mo({},o,{ref:t}))})}));function Ib(e){return void 0===e&&(e=[]),Mr({override:[t=>{var n=t.matchBefore(/@(\w+)?/);return n?n&&n.from==n.to&&!t.explicit?null:{from:null==n?void 0:n.from,options:[...e]}:null}]})}function Ab(e){const t=function(e){const t=te.get(Tr),n=Or.keyBy(t,(e=>e.name)),o=e.match(/@([\w.]+)/g)||[];return o.map((e=>e.slice(1))).map((e=>n.get(e))).filter(Boolean)}(e);return J.debug("Included datasets",t),{includeOtherCode:Ti(""),context:{schema:t.map((e=>({name:e.name,columns:e.columns.map((e=>({name:e.name,type:e.type})))})))},code:""}}_b.Original=fy,_b.Modified=gy,_b.displayName="CodeMirrorMerge",Ib();const Mb=[Dr(),qt.lineWrapping],Tb=[Rr(),qt.lineWrapping],Ob=Pr("marimo:ai-language","python"),Db=e=>{const t=b(65),{onClose:n}=e,{createNewCell:o}=q();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a={},t[0]=a):a=t[0];const[s,i]=r.useState(a),[l,c]=Fe(Ob),{theme:d}=Te();let u,h,m;t[1]===Symbol.for("react.memo_cache_sentinel")?(u=Fr("api/ai/completion").toString(),h=Lr.headers(),t[1]=u,t[2]=h):(u=t[1],h=t[2]),t[3]!==s||t[4]!==l?(m={api:u,headers:h,streamMode:"text",body:{...s,language:l},onError:Pb},t[3]=s,t[4]=l,t[5]=m):m=t[5];const{completion:f,input:p,stop:g,isLoading:v,setCompletion:x,setInput:y,handleSubmit:w}=zr(m);let N;t[6]===Symbol.for("react.memo_cache_sentinel")?(N=k.jsx(Oc,{className:"size-4 text-[var(--blue-11)]"}),t[6]=N):N=t[6];const C="python"===l?"Python":"SQL";let S,j,_,I,A,M,T,O,D,R,P,F,L,z,B;t[7]===Symbol.for("react.memo_cache_sentinel")?(S=k.jsx(Vr,{className:"ml-1 h-3.5 w-3.5 text-muted-foreground/70"}),t[7]=S):S=t[7],t[8]!==C?(j=k.jsx(Ot,{asChild:!0,children:k.jsxs(E,{variant:"text",className:"ml-2",size:"xs","data-testid":"language-button",children:[C,S]})}),t[8]=C,t[9]=j):j=t[9],t[10]!==c?(_=k.jsx(Tt,{onClick:()=>c("python"),children:"Python"}),t[10]=c,t[11]=_):_=t[11],t[12]!==c?(I=k.jsx(Tt,{onClick:()=>c("sql"),children:"SQL"}),t[12]=c,t[13]=I):I=t[13],t[14]!==_||t[15]!==I?(A=k.jsxs(Bt,{align:"center",children:[_,I]}),t[14]=_,t[15]=I,t[16]=A):A=t[16],t[17]!==j||t[18]!==A?(M=k.jsxs(zt,{modal:!1,children:[j,A]}),t[17]=j,t[18]=A,t[19]=M):M=t[19],t[20]!==x||t[21]!==n?(T=()=>{x(""),n()},t[20]=x,t[21]=n,t[22]=T):T=t[22],t[23]!==y?(O=e=>{y(e),i(Ab(e))},t[23]=y,t[24]=O):O=t[24],t[25]!==v||t[26]!==w?(D=()=>{v||w()},t[25]=v,t[26]=w,t[27]=D):D=t[27],t[28]!==d||t[29]!==T||t[30]!==p||t[31]!==O||t[32]!==D?(R=k.jsx(Rb,{theme:d,onClose:T,value:p,onChange:O,onSubmit:D}),t[28]=d,t[29]=T,t[30]=p,t[31]=O,t[32]=D,t[33]=R):R=t[33],t[34]!==v||t[35]!==g?(P=v&&k.jsxs(E,{"data-testid":"stop-completion-button",variant:"text",size:"sm",className:"mb-0",onClick:g,children:[k.jsx(Gr,{className:"animate-spin mr-1",size:14}),"Stop"]}),t[34]=v,t[35]=g,t[36]=P):P=t[36],t[37]!==v||t[38]!==f||t[39]!==o||t[40]!==l||t[41]!==x||t[42]!==n?(F=!v&&f&&k.jsx(E,{"data-testid":"accept-completion-button",variant:"text",size:"sm",className:"mb-0",disabled:v,onClick:()=>{o({cellId:"__end__",before:!1,code:"python"===l?f:Uo.fromQuery(f)}),x(""),n()},children:k.jsx("span",{className:"text-[var(--grass-11)] opacity-100",children:"Accept"})}),t[37]=v,t[38]=f,t[39]=o,t[40]=l,t[41]=x,t[42]=n,t[43]=F):F=t[43],t[44]===Symbol.for("react.memo_cache_sentinel")?(L=k.jsx(en,{className:"size-4"}),t[44]=L):L=t[44],t[45]!==n?(z=k.jsx(E,{variant:"text",size:"sm",className:"mb-0",onClick:n,children:L}),t[45]=n,t[46]=z):z=t[46],t[47]!==M||t[48]!==R||t[49]!==P||t[50]!==F||t[51]!==z?(B=k.jsxs("div",{className:"flex items-center px-3",children:[N,M,R,P,F,z]}),t[47]=M,t[48]=R,t[49]=P,t[50]=F,t[51]=z,t[52]=B):B=t[52];const U=B;let V,G,$,H;return t[53]===Symbol.for("react.memo_cache_sentinel")?(V=on("flex flex-col w-full gap-2 py-2"),t[53]=V):V=t[53],t[54]!==f?(G=!f&&k.jsxs("span",{className:"text-xs text-muted-foreground px-3 flex flex-col gap-1",children:[k.jsxs("span",{children:["You can mention"," ",k.jsx("span",{className:"text-[var(--cyan-11)]",children:"@dataframe"})," or"," ",k.jsx("span",{className:"text-[var(--cyan-11)]",children:"@sql_table"})," to pull additional context such as column names."]}),k.jsx("span",{children:"Code from other cells is automatically included."})]}),t[54]=f,t[55]=G):G=t[55],t[56]!==f||t[57]!==d||t[58]!==l||t[59]!==x?($=f&&k.jsx($r,{value:f,className:"cm border-t",onChange:x,theme:"dark"===d?"dark":"light",extensions:"python"===l?Mb:Tb}),t[56]=f,t[57]=d,t[58]=l,t[59]=x,t[60]=$):$=t[60],t[61]!==U||t[62]!==G||t[63]!==$?(H=k.jsxs("div",{className:V,children:[U,G,$]}),t[61]=U,t[62]=G,t[63]=$,t[64]=H):H=t[64],H},Rb=e=>{const t=b(20),{value:n,inputRef:o,onChange:r,onSubmit:a,onClose:s,theme:i}=e,l=a,c=s,d=le(Tr);let u,h,m,f,p,g,v,x;if(t[0]!==d){let e;t[2]===Symbol.for("react.memo_cache_sentinel")?(e=e=>({label:`@${e.name}`,info:()=>{const t=[null==e.num_rows?void 0:`${e.num_rows} rows`,null==e.num_columns?void 0:`${e.num_columns} columns`].filter(Boolean).join(", "),n=document.createElement("div");if(n.classList.add("prose","prose-sm","dark:prose-invert"),t){const e=document.createElement("div");e.textContent=t,e.style.fontWeight="bold",n.append(e)}if(e.source){const t=document.createElement("figcaption");t.textContent=`Source: ${e.source}`,n.append(t)}if(e.columns){const t=document.createElement("table"),o=t.insertRow(),r=o.insertCell();r.textContent="Column",r.style.fontWeight="bold";const a=o.insertCell();a.textContent="Type",a.style.fontWeight="bold",e.columns.forEach((e=>{const n=t.insertRow();n.insertCell().textContent=e.name;n.insertCell().textContent=e.type})),n.append(t)}return n}}),t[2]=e):e=t[2];h=Ib(d.map(e)),t[0]=d,t[1]=h}else h=t[1];t[3]===Symbol.for("react.memo_cache_sentinel")?(m=Br(),t[3]=m):m=t[3],t[4]!==l?(f=vn.highest(fn.of([{preventDefault:!0,stopPropagation:!0,any:(e,t)=>{const n=t.metaKey||t.ctrlKey||t.shiftKey;if("Enter"===t.key&&!n)return l(),t.preventDefault(),t.stopPropagation(),!0;if("Enter"===t.key&&t.shiftKey){const n=e.state.selection.main.from;return e.dispatch({changes:{from:n,to:n,insert:"\n"},selection:{anchor:n+1,head:n+1}}),t.preventDefault(),t.stopPropagation(),!0}return!1}}])),t[4]=l,t[5]=f):f=t[5],t[6]!==c?(p=fn.of([{key:"Escape",preventDefault:!0,stopPropagation:!0,run:()=>(c(),!0)}]),t[6]=c,t[7]=p):p=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(g=fn.of([{key:"ArrowUp",preventDefault:!0,stopPropagation:!0}]),v=fn.of([{key:"ArrowDown",preventDefault:!0,stopPropagation:!0}]),t[8]=g,t[9]=v):(g=t[8],v=t[9]),t[10]!==h||t[11]!==f||t[12]!==p?(x=[h,qt.lineWrapping,m,f,p,g,v],t[10]=h,t[11]=f,t[12]=p,t[13]=x):x=t[13],u=x;const y=u,w="dark"===i?"dark":"light";let N;return t[14]!==o||t[15]!==n||t[16]!==y||t[17]!==r||t[18]!==w?(N=k.jsx($r,{ref:o,className:"flex-1 font-sans overflow-auto my-1",autoFocus:!0,width:"100%",value:n,basicSetup:!1,extensions:y,onChange:r,theme:w,placeholder:"Generate with AI"}),t[14]=o,t[15]=n,t[16]=y,t[17]=r,t[18]=w,t[19]=N):N=t[19],N};function Pb(e){re({title:"Generate with AI failed",description:Ur(e)})}const Fb=_b.Original,Lb=_b.Modified,zb=[Dr(),qt.lineWrapping],Bb=e=>{const t=b(53),{onChange:n,initialPrompt:o,currentLanguageAdapter:a,currentCode:s,declineChange:i,acceptChange:l,enabled:c,children:d}=e;let h;t[0]===Symbol.for("react.memo_cache_sentinel")?(h={},t[0]=h):h=t[0];const[m,f]=r.useState(h),[p,g]=Fe(vd);let v,x,y,w,N;t[1]===Symbol.for("react.memo_cache_sentinel")?(v=Fr("api/ai/completion").toString(),x=Lr.headers(),t[1]=v,t[2]=x):(v=t[1],x=t[2]),t[3]!==p||t[4]!==s?(y=p?Ti(s):"",t[3]=p,t[4]=s,t[5]=y):y=t[5],t[6]!==m||t[7]!==y||t[8]!==s||t[9]!==a?(w={...m,includeOtherCode:y,code:s,language:a},t[6]=m,t[7]=y,t[8]=s,t[9]=a,t[10]=w):w=t[10],t[11]!==o||t[12]!==w?(N={api:v,headers:x,initialInput:o,streamMode:"text",body:w,onError:Ub},t[11]=o,t[12]=w,t[13]=N):N=t[13];const{completion:S,input:j,stop:_,isLoading:I,setCompletion:A,setInput:M,handleSubmit:T}=zr(N),O=u.useRef(null);let D,R,P,F;t[14]!==c?(D=()=>{const e=O.current;c&&e&&(requestAnimationFrame((()=>{var t;null==(t=e.view)||t.focus()})),Hr(O.current.view))},R=[c],t[14]=c,t[15]=D,t[16]=R):(D=t[15],R=t[16]),r.useEffect(D,R),t[17]!==c||t[18]!==M||t[19]!==o?(P=()=>{c&&M(o||"")},F=[c,o,M],t[17]=c,t[18]=M,t[19]=o,t[20]=P,t[21]=F):(P=t[20],F=t[21]),r.useEffect(P,F);const{theme:L}=Te(),z=c&&"max-h-[400px] min-h-11 visible",B=!c&&"max-h-0 min-h-0 invisible";let U,V,G,$;t[22]!==z||t[23]!==B?(U=on("flex items-center gap-2 border-b px-3 transition-all rounded-[inherit] rounded-b-none duration-300 overflow-hidden",z,B),t[22]=z,t[23]=B,t[24]=U):U=t[24],t[25]!==c||t[26]!==i||t[27]!==A||t[28]!==M||t[29]!==I||t[30]!==T||t[31]!==O||t[32]!==L||t[33]!==j||t[34]!==_||t[35]!==S||t[36]!==l||t[37]!==g||t[38]!==p?(V=c&&k.jsxs(k.Fragment,{children:[k.jsx(Oc,{className:"text-[var(--blue-10)] flex-shrink-0",size:16}),k.jsx(Rb,{inputRef:O,theme:L,onClose:()=>{i(),A("")},value:j,onChange:e=>{M(e),f(Ab(e))},onSubmit:()=>{I||T()}}),I&&k.jsxs(E,{"data-testid":"stop-completion-button",variant:"text",size:"xs",className:"mb-0",onClick:_,children:[k.jsx(Gr,{className:"animate-spin mr-1",size:14}),"Stop"]}),!I&&S&&k.jsx(E,{"data-testid":"accept-completion-button",variant:"text",size:"xs",className:"mb-0",disabled:I,onClick:()=>{l(S),A("")},children:k.jsx("span",{className:"text-[var(--grass-11)] opacity-100",children:"Accept"})}),k.jsx("div",{className:"h-full w-px bg-border mx-2"}),k.jsx(C,{content:"Include code from other cells",children:k.jsxs("div",{className:"flex flex-row items-start gap-1 overflow-hidden",children:[k.jsx(Wr,{"data-testid":"include-other-cells-checkbox",id:"include-other-cells",checked:p,onCheckedChange:e=>g(Boolean(e))}),k.jsx(Ae,{htmlFor:"include-other-cells",className:"text-muted-foreground text-xs whitespace-nowrap ellipsis",children:"Include all code"})]})}),k.jsx(E,{"data-testid":"decline-completion-button",variant:"text",size:"icon",disabled:I,onClick:()=>{_(),i(),A("")},children:k.jsx(en,{className:"text-[var(--red-10)]",size:16})})]}),t[25]=c,t[26]=i,t[27]=A,t[28]=M,t[29]=I,t[30]=T,t[31]=O,t[32]=L,t[33]=j,t[34]=_,t[35]=S,t[36]=l,t[37]=g,t[38]=p,t[39]=V):V=t[39],t[40]!==U||t[41]!==V?(G=k.jsx("div",{className:U,children:V}),t[40]=U,t[41]=V,t[42]=G):G=t[42],t[43]!==S||t[44]!==c||t[45]!==n||t[46]!==s||t[47]!==L?($=S&&c&&k.jsxs(_b,{className:"cm",theme:L,children:[k.jsx(Fb,{onChange:n,value:s,extensions:zb}),k.jsx(Lb,{value:S,editable:!1,readOnly:!0,extensions:zb})]}),t[43]=S,t[44]=c,t[45]=n,t[46]=s,t[47]=L,t[48]=$):$=t[48];const H=(!S||!c)&&d;let W;return t[49]!==G||t[50]!==$||t[51]!==H?(W=k.jsxs("div",{className:"flex flex-col w-full rounded-[inherit] overflow-hidden",children:[G,$,H]}),t[49]=G,t[50]=$,t[51]=H,t[52]=W):W=t[52],W};function Ub(e){re({title:"Completion failed",description:Ur(e)})}const Vb=u.forwardRef(((e,t)=>{const{className:n,editorView:o}=e,a=r.useRef(null);return r.useEffect((()=>{null!==o&&null!==a.current&&0===a.current.children.length&&a.current.append(o.dom)}),[o,a]),k.jsx("div",{className:on("cm",n),ref:Og(t,a),"data-testid":"cell-editor"})}));Vb.displayName="CellCodeMirrorEditor";const Gb=r.memo((({theme:e,showPlaceholder:t,allowFocus:n,id:o,config:a,code:s,status:i,serializedEditorState:l,runCell:c,updateCellCode:d,createNewCell:u,deleteCell:h,focusCell:m,moveCell:f,moveToNextCell:p,updateCellConfig:g,clearSerializedEditorState:v,userConfig:x,editorViewRef:y,hidden:w,setTemporarilyVisible:N})=>{var C;const[E,S]=Fe(gd),[j,_]=r.useState(),I=function(){const e=b(2),t=ce(jd);let n;return e[0]!==t?(n=e=>{Me!==e&&t(e)},e[0]=t,e[1]=n):n=e[1],n}(),A=r.useRef(null),M="running"===i||"queued"===i,{sendToTop:T,sendToBottom:O}=q(),D=function(){const e=b(3),{splitCell:t,undoSplitCell:n}=q();let o;return e[0]!==t||e[1]!==n?(o=e=>{const o=qr(e.cellId),r=(null==o?void 0:o.state.doc.toString())??"";t(e);const{dismiss:a}=re({title:"Cell split",action:k.jsx(xd,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...e,snapshot:r}),s()},children:"Undo"})}),s=a},e[0]=t,e[1]=n,e[2]=o):o=e[2],W(o)}(),R=W((()=>!M&&(h({cellId:o}),!0))),P=r.useCallback((()=>u({cellId:o,before:!1})),[o,u]),F=r.useCallback((()=>u({cellId:o,before:!0})),[o,u]),L=r.useCallback((()=>f({cellId:o,before:!1})),[o,f]),z=r.useCallback((()=>f({cellId:o,before:!0})),[o,f]),B=r.useCallback((()=>m({cellId:o,before:!1})),[o,m]),U=r.useCallback((()=>m({cellId:o,before:!0})),[o,m]),V=W((()=>{const e=!a.hide_code;return _e({configs:{[o]:{hide_code:e}}}),g({cellId:o,config:{hide_code:e}}),e})),G=le(ue),$=W((()=>{wd(G,u)})),H=Yr(x),Y=r.useMemo((()=>{const n=(e=>{const{cellId:t,cellMovementCallbacks:n,cellCodeCallbacks:o,keymapConfig:r,hotkeys:a}=e;return[Li(r,n),[qt.domEventHandlers({drop:(e,t)=>{var n,o;const r=null==(n=e.dataTransfer)?void 0:n.files[0];if(null==r?void 0:r.type.startsWith("text/"))return e.preventDefault(),Mn(t,r),!0;if(null==r?void 0:r.type.startsWith("image/"))return e.preventDefault(),Tn(t,r),!0;const a=null==(o=e.dataTransfer)?void 0:o.getData("text/plain");if(a){e.preventDefault();const n=t.posAtCoords({x:e.clientX,y:e.clientY});return null!==n&&t.dispatch({changes:{from:n,to:n,insert:a},scrollIntoView:!0}),!0}return!1},dragover:e=>{e.preventDefault()}})],On(t,n,a),Dn(t,o,a),qp(e),[Gp,(s=(e,t)=>{jn(e,t)},Jt.define((e=>new $p(e,s)))),qt.baseTheme({".underline":{textDecoration:"underline",cursor:"pointer",color:"var(--link)"}})]];var s})({cellId:o,showPlaceholder:t,enableAI:H,cellCodeCallbacks:{updateCellCode:d,afterToggleMarkdown:$},cellMovementCallbacks:{onRun:c,deleteCell:R,createAbove:F,createBelow:P,moveUp:z,moveDown:L,focusUp:U,focusDown:B,sendToTop:T,sendToBottom:O,splitCell:D,moveToNextCell:p,toggleHideCode:V,aiCellCompletion:()=>{let e=!1;return S((t=>(null==t?void 0:t.cellId)===o?(e=!0,null):{cellId:o})),e}},completionConfig:x.completion,keymapConfig:x.keymap,theme:e,hotkeys:new Xr(x.keymap.overrides??{})});return n.push(Jt.define((e=>{const t=e.state.field(Kr);return _(t.type),{update(e){const t=e.state.field(Kr);_(t.type)}}}))),n}),[o,x.keymap,x.completion,H,e,t,F,P,U,B,z,L,p,T,O,D,V,d,R,c,S,$]);r.useEffect((()=>{let e;null===l?null===y.current?(y.current=new qt({state:oo.create({doc:s,extensions:Y})}),e=!0,we(y.current,Jr(y.current.state).type)):(y.current.dispatch({effects:[Yt.reconfigure.of([Y]),Zr(y.current,x.completion,new Xr(x.keymap.overrides??{}))]}),e=!1):(y.current=new qt({state:oo.fromJSON(l,{doc:s,extensions:Y},{history:Qr})}),we(y.current,Jr(y.current.state).type),e=!0,v({cellId:o})),null!==y.current&&null!==A.current&&A.current.replaceChildren(y.current.dom),e&&n&&requestAnimationFrame((()=>{var e,t;null==(e=y.current)||e.focus(),null==(t=y.current)||t.dom.scrollIntoView({behavior:"smooth",block:"nearest"})}))}),[y,Y,x.completion,x.keymap,v,o,l]),r.useEffect((()=>()=>{var e;null==(e=y.current)||e.destroy()}),[y]);const X=r.useCallback((async()=>{var e,t;if(w&&void 0!==N){N(!0),null==(e=y.current)||e.focus();const n=null==(t=A.current)?void 0:t.parentElement,o=new AbortController;null==n||n.addEventListener("focusout",(()=>{requestAnimationFrame((()=>{var e;const t=document.activeElement;(null==n?void 0:n.contains(t))||(N(!1),null==(e=y.current)||e.dom.blur(),o.abort())}))}),{signal:o.signal})}}),[w,N,y,A]);return k.jsx(Bb,{enabled:(null==E?void 0:E.cellId)===o,initialPrompt:null==E?void 0:E.initialPrompt,currentCode:(null==(C=y.current)?void 0:C.state.doc.toString())??s,currentLanguageAdapter:j,declineChange:()=>{var e;S(null),null==(e=y.current)||e.focus()},onChange:e=>{var t;null==(t=y.current)||t.dispatch({changes:{from:0,to:y.current.state.doc.length,insert:e}})},acceptChange:e=>{var t,n;null==(t=y.current)||t.dispatch({changes:{from:0,to:y.current.state.doc.length,insert:e}}),null==(n=y.current)||n.focus(),S(null)},children:k.jsxs("div",{className:"relative w-full",onFocus:()=>I(o),children:[w&&k.jsx(ea,{onClick:X}),k.jsx(Vb,{className:on(w&&"opacity-20 h-8 overflow-hidden"),editorView:y.current,ref:A}),!w&&k.jsx("div",{className:"absolute top-1 right-5",children:k.jsx(sy,{code:s,editorView:y.current,currentLanguageAdapter:j,onAfterToggle:$})})]})})})),$b=e=>{const t=b(10);let n,o,r,a;return t[0]!==e.left?(n=k.jsx("div",{className:"flex-1 flex item-center gap-2",children:e.left}),t[0]=e.left,t[1]=n):n=t[1],t[2]!==e.center?(o=k.jsx("div",{className:"flex-1 flex item-center gap-2 justify-center",children:e.center}),t[2]=e.center,t[3]=o):o=t[3],t[4]!==e.right?(r=k.jsx("div",{className:"flex-1 flex item-center gap-2 justify-end",children:e.right}),t[4]=e.right,t[5]=r):r=t[5],t[6]!==n||t[7]!==o||t[8]!==r?(a=k.jsxs("div",{className:"flex items-center gap-2 w-full px-3",children:[n,o,r]}),t[6]=n,t[7]=o,t[8]=r,t[9]=a):a=t[9],a},Hb=e=>{const t=b(8);if(!e.canCollapse&&!e.isCollapsed)return null;const n=e.isCollapsed?"Expand":"Collapse";let o,r,a;return t[0]!==e.isCollapsed?(o=k.jsx(Wb,{isCollapsed:e.isCollapsed}),t[0]=e.isCollapsed,t[1]=o):o=t[1],t[2]!==n||t[3]!==o?(r=k.jsx(C,{content:n,children:o}),t[2]=n,t[3]=o,t[4]=r):r=t[4],t[5]!==e.onClick||t[6]!==r?(a=k.jsx(E,{variant:"text",size:"icon",onClick:e.onClick,children:r}),t[5]=e.onClick,t[6]=r,t[7]=a):a=t[7],a},Wb=e=>{const t=b(2),{isCollapsed:n}=e;let o;return t[0]!==n?(o=n?k.jsx(oa,{className:"w-5 h-5 flex-shrink-0"}):k.jsx(Ee,{className:"w-5 h-5 flex-shrink-0"}),t[0]=n,t[1]=o):o=t[1],o},qb=r.memo((e=>{const t=b(24),{onClick:n,count:o,cellId:r}=e,a=H();let s;t[0]!==a||t[1]!==r?(s=ta(a,r),t[0]=a,t[1]=r,t[2]=s):s=t[2];const i=s;let l,c;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=on("flex items-center justify-between w-[calc(100%-2rem)] h-9 bg-muted rounded-b mx-4 opacity-80 hover:opacity-100 cursor-pointer"),t[3]=l):l=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx(Vr,{className:"w-4 h-4 flex-shrink-0"}),t[4]=c):c=t[4];const d=1===o?"cell":"cells";let u,h,m,f,p,g,v;return t[5]!==o||t[6]!==d?(u=k.jsxs(k.Fragment,{children:[c,k.jsxs("span",{className:"text-sm text-gray-500",children:[o," ",d," collapsed"]})]}),t[5]=o,t[6]=d,t[7]=u):u=t[7],t[8]!==i.errored?(h=i.errored&&k.jsx(C,{content:"Has errors",delayDuration:100,children:k.jsx(xc,{className:"w-4 h-4 flex-shrink-0 text-destructive"})}),t[8]=i.errored,t[9]=h):h=t[9],t[10]!==i.stale?(m=i.stale&&k.jsx(C,{content:"Has stale cells",delayDuration:100,children:k.jsx(na,{className:"w-4 h-4 flex-shrink-0 text-[var(--yellow-11)]"})}),t[10]=i.stale,t[11]=m):m=t[11],t[12]!==i.runningOrQueued?(f=i.runningOrQueued&&k.jsx(C,{content:"Running",delayDuration:100,children:k.jsx(Gr,{className:"w-4 h-4 flex-shrink-0 animate-spin"})}),t[12]=i.runningOrQueued,t[13]=f):f=t[13],t[14]!==h||t[15]!==m||t[16]!==f?(p=k.jsxs(k.Fragment,{children:[h,m,f]}),t[14]=h,t[15]=m,t[16]=f,t[17]=p):p=t[17],t[18]!==u||t[19]!==p?(g=k.jsx($b,{center:u,right:p}),t[18]=u,t[19]=p,t[20]=g):g=t[20],t[21]!==n||t[22]!==g?(v=k.jsx("div",{onClick:n,className:l,children:g}),t[21]=n,t[22]=g,t[23]=v):v=t[23],v}));qb.displayName="CollapsedCellBanner";const Yb=e=>{const t=b(6),{appClosed:n,status:o}=e,r=Cu("running"===o);let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=N("global.interrupt"),t[0]=a):a=t[0];const s=n||!r,i=r?ra:rn.NOOP,l=r?"stale":"disabled";let c,d;return t[1]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx(T,{strokeWidth:1.5}),t[1]=c):c=t[1],t[2]!==s||t[3]!==i||t[4]!==l?(d=k.jsx(kg,{tooltip:a,disabled:s,onClick:i,variant:l,"data-testid":"run-button",children:c}),t[2]=s,t[3]=i,t[4]=l,t[5]=d):d=t[5],d},Xb=e=>{const t=b(26),{edited:n,appClosed:o,status:r,cellConfig:a,needsRun:s,hasOutput:i,onRun:l,cellActionDropdownRef:c,cellId:d,getEditorView:u,name:h}=e,m=!s&&"hover-action";let f;t[0]!==m?(f=on(m),t[0]=m,t[1]=f):f=t[1];const p=o?rn.NOOP:l;let g,v,x,y,w;return t[2]!==n||t[3]!==p||t[4]!==o||t[5]!==r||t[6]!==a||t[7]!==s?(g=k.jsx(Cg,{edited:n,onClick:p,appClosed:o,status:r,config:a,needsRun:s}),t[2]=n,t[3]=p,t[4]=o,t[5]=r,t[6]=a,t[7]=s,t[8]=g):g=t[8],t[9]!==r||t[10]!==o?(v=k.jsx(Yb,{status:r,appClosed:o}),t[9]=r,t[10]=o,t[11]=v):v=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(x=k.jsx(kg,{variant:"green",tooltip:null,children:k.jsx(sl,{strokeWidth:1.5})}),t[12]=x):x=t[12],t[13]!==c||t[14]!==d||t[15]!==r||t[16]!==u||t[17]!==h||t[18]!==a||t[19]!==i?(y=k.jsx(ey,{ref:c,cellId:d,status:r,getEditorView:u,name:h,config:a,hasOutput:i,children:x}),t[13]=c,t[14]=d,t[15]=r,t[16]=u,t[17]=h,t[18]=a,t[19]=i,t[20]=y):y=t[20],t[21]!==f||t[22]!==g||t[23]!==v||t[24]!==y?(w=k.jsxs(Ng,{className:f,children:[g,v,y]}),t[21]=f,t[22]=g,t[23]=v,t[24]=y,t[25]=w):w=t[25],w},Kb=r.memo(r.forwardRef((({theme:e,showPlaceholder:t,allowFocus:n,id:o,code:a,output:s,consoleOutputs:i,status:l,runStartTimestamp:c,lastRunStartTimestamp:d,runElapsedTimeMs:u,edited:h,interrupted:m,errored:f,stopped:p,staleInputs:g,serializedEditorState:v,mode:x,debuggerActive:y,appClosed:b,canDelete:w,updateCellCode:C,prepareForRun:E,createNewCell:S,deleteCell:j,focusCell:_,moveCell:I,setStdinResponse:A,moveToNextCell:M,updateCellConfig:T,clearSerializedEditorState:O,sendToBottom:D,sendToTop:R,collapseCell:P,expandCell:F,userConfig:L,outline:z,isCollapsed:B,collapseCount:U,config:V,canMoveX:G,name:$},H)=>{J.debug("Rendering Cell",o);const q=r.useRef(null),Y=r.useRef(null),Z=r.useRef(null),Q=ce(gd),[ee,te]=r.useState(!1),ne=V.disabled||"disabled-transitively"===l,oe=aa(L.runtime.auto_instantiate,u,l,f,m,p),re=oe||h||m||g&&!ne,ae="running"===l||"queued"===l,se=sa({status:l,output:s,runStartTimestamp:c,interrupted:m,staleInputs:g},h),ie=("queued"===l||h||g)&&!m,le="edit"===x,de=r.useCallback((()=>{const e=Yp(Z),t=X(e);return"markdown"!==ia(e)&&la(e),E({cellId:o}),t}),[o,Z,E]);r.useImperativeHandle(H,(()=>({get editorView(){return Yp(Z)},registerRun:de})),[Z,de]);const ue=r.useCallback((()=>Z.current),[Z]),he=W((async()=>{if(ae)return;const e=de();await K({cellIds:[o],codes:[e]}).catch((e=>{J.error("Error running cell",e)}))})),me=r.useCallback(((e={})=>S({cellId:o,before:!1,...e})),[o,S]),fe=r.useCallback(((e={})=>S({cellId:o,before:!0,...e})),[o,S]),pe=r.useCallback((e=>{null===q.current||q.current.contains(e.relatedTarget)||null===Z.current||la(Z.current)}),[]),ge=r.useCallback((e=>{if(q.current===document.activeElement&&null!==Z.current&&"active"===kn(Z.current.state)){for(const t of ca)if(e.key===t.key&&t.run){t.run(Z.current),e.preventDefault(),e.stopPropagation();break}Z.current.focus()}}),[q,Z]),ve=!da(s),xe=ve&&k.jsxs("div",{className:"relative",children:[k.jsx("div",{className:"absolute top-5 -left-8 z-10 print:hidden",children:k.jsx(Hb,{isCollapsed:B,onClick:()=>{B?F({cellId:o}):P({cellId:o})},canCollapse:ua(z)})}),k.jsx(ha,{allowExpand:le,output:s,className:"output-area",cellId:o,stale:se})]}),ye=ma("Cell","hover-actions-parent z-10",{published:!le,interactive:le,"needs-run":re,"has-error":f,stopped:p,disabled:V.disabled,stale:"disabled-transitively"===l}),be=ht.create(o),we=!V.hide_code||ee;if(zi(le?q:null,{"cell.run":he,"cell.runAndNewBelow":()=>{he(),M({cellId:o,before:!1})},"cell.runAndNewAbove":()=>{he(),M({cellId:o,before:!0})},"cell.createAbove":fe,"cell.createBelow":me,"cell.moveUp":()=>I({cellId:o,before:!0}),"cell.moveDown":()=>I({cellId:o,before:!1}),"cell.hideCode":()=>{var e,t,n;const r=!V.hide_code;_e({configs:{[o]:{hide_code:r}}}),T({cellId:o,config:{hide_code:r}}),r?(null==(e=Z.current)||e.contentDOM.blur(),null==(t=q.current)||t.focus()):null==(n=Z.current)||n.focus()},"cell.focusDown":()=>M({cellId:o,before:!1}),"cell.focusUp":()=>M({cellId:o,before:!0}),"cell.sendToBottom":()=>D({cellId:o}),"cell.sendToTop":()=>R({cellId:o}),"cell.aiCompletion":()=>{let e=!1;Q((t=>(null==t?void 0:t.cellId)===o?(e=!0,null):{cellId:o})),e&&Yp(Z).focus()},"cell.cellActions":()=>{var e;null==(e=Y.current)||e.toggle()}}),Bi(le?q:null,{ArrowDown:()=>(M({cellId:o,before:!1,noCreate:!0}),!0),ArrowUp:()=>(M({cellId:o,before:!0,noCreate:!0}),!0),..."vim"!==L.keymap.preset||we?{}:{j:()=>(M({cellId:o,before:!1,noCreate:!0}),!0),k:()=>(M({cellId:o,before:!0,noCreate:!0}),!0)}}),!le){const e=fa(null==s?void 0:s.mimetype);return f||m||p||e?null:k.jsx("div",{tabIndex:-1,id:be,ref:q,className:ye,children:xe})}return k.jsx(ny,{cellId:o,config:V,status:l,getEditorView:ue,hasOutput:ve,name:$,children:k.jsxs(Qx,{tabIndex:-1,ref:q,"data-status":l,onBlur:pe,onKeyDown:ge,cellId:o,canMoveX:G,title:V.disabled?"This cell is disabled":"disabled-transitively"===l?"This cell has a disabled ancestor":void 0,children:[k.jsxs("div",{className:ye,id:be,children:["above"===L.display.cell_output&&xe,k.jsxs("div",{className:"tray",children:[k.jsx("div",{className:"absolute right-2 -top-4 z-10",children:k.jsx(Xb,{edited:h,appClosed:b,status:l,cellConfig:V,needsRun:re,hasOutput:ve,cellActionDropdownRef:Y,cellId:o,name:$,getEditorView:ue,onRun:he})}),k.jsxs("div",{className:"absolute flex flex-col gap-[2px] justify-center h-full left-[-34px] z-20",children:[k.jsx(yg,{tooltipContent:N("cell.createAbove"),appClosed:b,onClick:b?void 0:fe}),k.jsx("div",{className:"flex-1"}),k.jsx(yg,{tooltipContent:N("cell.createBelow"),appClosed:b,onClick:b?void 0:me})]}),k.jsx(Gb,{theme:e,showPlaceholder:t,allowFocus:n,id:o,code:a,config:V,status:l,serializedEditorState:v,runCell:he,updateCellCode:C,createNewCell:S,deleteCell:j,focusCell:_,moveCell:I,moveToNextCell:M,updateCellConfig:T,clearSerializedEditorState:O,userConfig:L,editorViewRef:Z,hidden:!we,setTemporarilyVisible:te}),k.jsxs("div",{className:"shoulder-right z-20",children:[k.jsx(_g,{status:l,staleInputs:g,interrupted:m,editing:le,edited:h,disabled:V.disabled??!1,elapsedTime:u,runStartTimestamp:c,uninstantiated:oe,lastRunStartTimestamp:d}),k.jsx("div",{className:"flex gap-2 items-end",children:k.jsx(Jx,{})})]}),k.jsx("div",{className:"shoulder-bottom hover-action",children:w&&we&&k.jsx(Eg,{appClosed:b,status:l,onClick:()=>{ae||b||j({cellId:o})}})})]}),"below"===L.display.cell_output&&xe,k.jsx(il,{consoleOutputs:i,stale:ie,cellName:$,onRefactorWithAI:e=>{Q({cellId:o,initialPrompt:e.prompt})},onSubmitDebugger:(e,t)=>{A({cellId:o,response:e,outputIndex:t}),pa({text:e})},cellId:o,debuggerActive:y})]}),B&&k.jsx(qb,{onClick:()=>F({cellId:o}),count:U,cellId:o})]})})}))),Jb=e=>{const t=b(10),{width:n}=e,{banners:o}=ll(),{removeBanner:r}=cl();if(0===o.length)return null;const a="columns"===n&&"sticky left-12 w-full max-w-[80vw]";let s,i,l;if(t[0]!==a?(s=on("flex flex-col gap-4 mb-5 print:hidden",a),t[0]=a,t[1]=s):s=t[1],t[2]!==r||t[3]!==o){let e;t[5]!==r?(e=e=>k.jsxs(ga,{kind:e.variant||"info",className:"flex flex-col rounded p-3",children:[k.jsxs("div",{className:"flex justify-between",children:[k.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[k.jsx(va,{className:"w-5 h-5 inline-block mr-2"}),e.title]}),k.jsx(E,{"data-testid":"remove-banner-button",variant:"text",size:"icon",onClick:()=>r(e.id),children:k.jsx(en,{className:"w-5 h-5"})})]}),k.jsxs("div",{className:"flex justify-between items-end",children:[k.jsx("span",{children:xa({html:e.description})}),"restart"===e.action&&k.jsx(Zb,{})]})]},e.id),t[5]=r,t[6]=e):e=t[6],i=o.map(e),t[2]=r,t[3]=o,t[4]=i}else i=t[4];return t[7]!==s||t[8]!==i?(l=k.jsx("div",{className:s,children:i}),t[7]=s,t[8]=i,t[9]=l):l=t[9],l},Zb=()=>{const e=b(3),t=zd();let n,o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=k.jsx(jc,{className:"w-3 h-3 mr-2"}),e[0]=n):n=e[0],e[1]!==t?(o=k.jsxs(E,{"data-testid":"restart-session-button",variant:"link",size:"xs",onClick:t,children:[n,"Restart"]}),e[1]=t,e[2]=o):o=e[2],o};const Qb=(e,t)=>function(e,t){const n=/^(\d+)\.(\d+)\.(\d+)(?:-([\w.-]+))?(?:\+([\w.-]+))?$/,o=e=>{const t=e.match(n);if(!t)return null;const[,o,r,a,s]=t;return{major:Number.parseInt(o,10),minor:Number.parseInt(r,10),patch:Number.parseInt(a,10),preRelease:s||""}};try{const n=o(e),r=o(t);return n&&r?n.major!==r.major?n.major-r.major:n.minor!==r.minor?n.minor-r.minor:n.patch!==r.patch?n.patch-r.patch:""===n.preRelease&&""!==r.preRelease?1:""!==n.preRelease&&""===r.preRelease?-1:n.preRelease.localeCompare(r.preRelease):e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}catch{return e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}}(t,e);const ew=()=>{const e=b(64),{packageAlert:t}=dl(),{clearPackageAlert:n}=ul(),[o]=Oe();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];const[s,i]=r.useState(a);if(null===t)return null;const l="pixi"!==o.package_management.manager;if(hl(t)){let r,a,c,d,u,h,m,f,p,g;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=k.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[k.jsx(bc,{className:"w-5 h-5 inline-block mr-2"}),"Missing packages"]}),e[1]=r):r=e[1],e[2]!==n||e[3]!==t.id?(a=()=>n(t.id),e[2]=n,e[3]=t.id,e[4]=a):a=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx(en,{className:"w-5 h-5"}),e[5]=c):c=e[5],e[6]!==a?(d=k.jsxs("div",{className:"flex justify-between",children:[r,k.jsx(E,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:a,children:c})]}),e[6]=a,e[7]=d):d=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(u=k.jsx("p",{children:"The following packages were not found:"}),e[8]=u):u=e[8],e[9]!==l||e[10]!==s||e[11]!==t.packages){let n;e[13]!==l||e[14]!==s?(n=(e,t)=>k.jsxs("li",{className:"flex items-center gap-1 font-mono text-sm",children:[k.jsx(Ul,{size:"1rem"}),e,l&&k.jsx(rw,{value:s[e]??"latest",onChange:t=>i((n=>({...n,[e]:t}))),packageName:e})]},t),e[13]=l,e[14]=s,e[15]=n):n=e[15],h=t.packages.map(n),e[9]=l,e[10]=s,e[11]=t.packages,e[12]=h}else h=e[12];return e[16]!==h?(m=k.jsxs("div",{children:[u,k.jsx("ul",{className:"list-disc ml-4 mt-1",children:h})]}),e[16]=h,e[17]=m):m=e[17],e[18]!==t||e[19]!==n||e[20]!==o||e[21]!==s?(f=k.jsx("div",{className:"ml-auto flex flex-row items-baseline",children:t.isolated?k.jsxs(k.Fragment,{children:[k.jsx(nw,{manager:o.package_management.manager,versions:s,clearPackageAlert:()=>n(t.id)}),!D()&&k.jsxs(k.Fragment,{children:[k.jsx("span",{className:"px-2 text-sm",children:"with"})," ",k.jsx(ow,{})]})]}):k.jsxs("p",{children:["If you set up a"," ",k.jsx("a",{href:"https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments",className:"text-accent-foreground hover:underline",target:"_blank",rel:"noreferrer",children:"virtual environment"}),", marimo can install these packages for you."]})}),e[18]=t,e[19]=n,e[20]=o,e[21]=s,e[22]=f):f=e[22],e[23]!==m||e[24]!==f?(p=k.jsxs("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:[m,f]}),e[23]=m,e[24]=f,e[25]=p):p=e[25],e[26]!==d||e[27]!==p?(g=k.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:k.jsxs(ga,{kind:"danger",className:"flex flex-col rounded py-3 px-5 animate-in slide-in-from-left",children:[d,p]})}),e[26]=d,e[27]=p,e[28]=g):g=e[28],g}if(ml(t)){let o;e[29]!==t.packages?(o=function(e){const t=new Set(Object.values(e)),n=t.has("queued")||t.has("installing")?"installing":t.has("failed")?"failed":"installed";if("installing"===n)return{status:"installing",title:"Installing packages",titleIcon:k.jsx(Yl,{className:"w-5 h-5 inline-block mr-2"}),description:"Installing packages:"};if("installed"===n)return{status:"installed",title:"All packages installed!",titleIcon:k.jsx(yc,{className:"w-5 h-5 inline-block mr-2"}),description:"Installed packages:"};return{status:"failed",title:"Some packages failed to install",titleIcon:k.jsx(bc,{className:"w-5 h-5 inline-block mr-2"}),description:"See terminal for error logs."}}(t.packages),e[29]=t.packages,e[30]=o):o=e[30];const{status:r,title:a,titleIcon:s,description:i}=o;"installed"===r&&setTimeout((()=>n(t.id)),1e4);const l="failed"===r?"danger":"info";let c,d,u,h,m;e[31]!==s||e[32]!==a?(c=k.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[s,a]}),e[31]=s,e[32]=a,e[33]=c):c=e[33],e[34]!==n||e[35]!==t.id?(d=()=>n(t.id),e[34]=n,e[35]=t.id,e[36]=d):d=e[36],e[37]===Symbol.for("react.memo_cache_sentinel")?(u=k.jsx(en,{className:"w-5 h-5"}),e[37]=u):u=e[37],e[38]!==d?(h=k.jsx(E,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:d,children:u}),e[38]=d,e[39]=h):h=e[39],e[40]!==c||e[41]!==h?(m=k.jsxs("div",{className:"flex justify-between",children:[c,h]}),e[40]=c,e[41]=h,e[42]=m):m=e[42];const f="installed"===r&&"text-accent-foreground";let p,g,v,x,y,b,w;if(e[43]!==f?(p=on("flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",f),e[43]=f,e[44]=p):p=e[44],e[45]!==i?(g=k.jsx("p",{children:i}),e[45]=i,e[46]=g):g=e[46],e[47]!==t.packages||e[48]!==r){let n;e[50]!==r?(n=(e,t)=>{const[n,o]=e;return k.jsxs("li",{className:on("flex items-center gap-1 font-mono text-sm","installing"===o&&"font-semibold","failed"===o&&"text-destructive","installed"===o&&"text-accent-foreground","installed"===o&&"failed"===r&&"text-muted-foreground"),children:[k.jsx(tw,{status:o}),n]},t)},e[50]=r,e[51]=n):n=e[51],v=Object.entries(t.packages).map(n),e[47]=t.packages,e[48]=r,e[49]=v}else v=e[49];return e[52]!==v?(x=k.jsx("ul",{className:"list-disc ml-4 mt-1",children:v}),e[52]=v,e[53]=x):x=e[53],e[54]!==g||e[55]!==x?(y=k.jsxs("div",{children:[g,x]}),e[54]=g,e[55]=x,e[56]=y):y=e[56],e[57]!==p||e[58]!==y?(b=k.jsx("div",{className:p,children:y}),e[57]=p,e[58]=y,e[59]=b):b=e[59],e[60]!==l||e[61]!==m||e[62]!==b?(w=k.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:k.jsxs(ga,{kind:l,className:"flex flex-col rounded pt-3 pb-4 px-5",children:[m,b]})}),e[60]=l,e[61]=m,e[62]=b,e[63]=w):w=e[63],w}return M(t),null};const tw=e=>{const t=b(4),{status:n}=e;switch(n){case"queued":{let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx(Ul,{size:"1rem"}),t[0]=e):e=t[0],e}case"installing":{let e;return t[1]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx(Yl,{size:"1rem"}),t[1]=e):e=t[1],e}case"installed":{let e;return t[2]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx(_t,{size:"1rem"}),t[2]=e):e=t[2],e}case"failed":{let e;return t[3]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx(en,{size:"1rem"}),t[3]=e):e=t[3],e}default:return M(n),null}},nw=e=>{const t=b(8),{manager:n,versions:o,clearPackageAlert:r}=e;let a,s,i,l;return t[0]!==r||t[1]!==n||t[2]!==o?(a=async()=>{r(),await Ia({manager:n,versions:o}).catch((e=>{J.error(e)}))},t[0]=r,t[1]=n,t[2]=o,t[3]=a):a=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(s=k.jsx(Yl,{className:"w-4 h-4 mr-2"}),i=k.jsx("span",{className:"font-semibold",children:"Install"}),t[4]=s,t[5]=i):(s=t[4],i=t[5]),t[6]!==a?(l=k.jsxs(E,{variant:"outline","data-testid":"install-packages-button",size:"sm",onClick:a,children:[s,i]}),t[6]=a,t[7]=l):l=t[7],l},ow=()=>{const e=b(16),[t,n]=Oe();let o,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=ya(ba),e[0]=o):o=e[0],e[1]!==t?(r={resolver:o,defaultValues:t},e[1]=t,e[2]=r):r=e[2];const a=wa(r);let s;e[3]!==n?(s=async e=>{await Re({config:e}).then((()=>{n(e)}))},e[3]=n,e[4]=s):s=e[4];const i=s;let l,c,d,u;return e[5]!==a||e[6]!==i?(l=a.handleSubmit(i),e[5]=a,e[6]=i,e[7]=l):l=e[7],e[8]!==a.control?(c=k.jsx("div",{className:"flex flex-col gap-3",children:k.jsx(ka,{control:a.control,name:"package_management.manager",render:sw})}),e[8]=a.control,e[9]=c):c=e[9],e[10]!==l||e[11]!==c?(d=k.jsx("form",{onChange:l,className:"flex flex-col gap-5",children:c}),e[10]=l,e[11]=c,e[12]=d):d=e[12],e[13]!==a||e[14]!==d?(u=k.jsx(Na,{...a,children:d}),e[13]=a,e[14]=d,e[15]=u):u=e[15],u},rw=e=>{const t=b(21),{value:n,onChange:o,packageName:r}=e;let a,s;t[0]!==r?(a=async()=>{const e=await fetch(`https://pypi.org/pypi/${t=r,t.replaceAll(/\[.*]/g,"").trim()}/json`,{method:"GET",signal:AbortSignal.timeout(5e3)});var t;const n=await e.json();return["latest",...Object.keys(n.releases).sort(Qb).slice(0,100)]},s=[r],t[0]=r,t[1]=a,t[2]=s):(a=t[1],s=t[2]);const{data:i,loading:l,error:c}=an(a,s);let d;t[3]!==i?(d=void 0===i?[]:i,t[3]=i,t[4]=d):d=t[4];const u=d;if(c){let e,r,a;return t[5]!==o?(e=e=>o(e.target.value),t[5]=o,t[6]=e):e=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(r=k.jsx("option",{value:"latest",children:"latest"}),t[7]=r):r=t[7],t[8]!==n||t[9]!==e?(a=k.jsx(C,{content:"Failed to fetch package versions",children:k.jsx(Sa,{value:n,onChange:e,disabled:!0,className:"inline-flex ml-2",children:r})}),t[8]=n,t[9]=e,t[10]=a):a=t[10],a}let h,m,f;return t[11]!==o?(h=e=>o(e.target.value),t[11]=o,t[12]=h):h=t[12],t[13]!==l||t[14]!==u?(m=l?k.jsx("option",{value:"latest",children:"latest"}):u.map(iw),t[13]=l,t[14]=u,t[15]=m):m=t[15],t[16]!==n||t[17]!==h||t[18]!==l||t[19]!==m?(f=k.jsx(Sa,{value:n,onChange:h,disabled:l,className:"inline-flex ml-2",children:m}),t[16]=n,t[17]=h,t[18]=l,t[19]=m,t[20]=f):f=t[20],f};function aw(e){return k.jsx("option",{value:e,children:e},e)}function sw(e){const{field:t}=e;return k.jsxs(Ca,{children:[k.jsx(Ea,{children:k.jsx(Sa,{"data-testid":"install-package-manager-select",onChange:e=>t.onChange(e.target.value),value:t.value,disabled:t.disabled,className:"inline-flex mr-2",children:ja.map(aw)})}),k.jsx(_a,{})]})}function iw(e){return k.jsx("option",{value:e,children:e},e)}const lw=e=>{let{transform:t}=e;return{...t,x:0}},cw={threshold:{x:0,y:.1}},dw=u.memo((e=>{const t=b(25),{children:n,multiColumn:o}=e,{cellIds:a}=H(),{dropCellOverCell:s,dropCellOverColumn:i,moveColumn:l,compactColumns:c}=q(),[d,u]=r.useState(null),[h,m]=r.useState(null),[f]=De();let p;e:{if("columns"===f.width){p=Aa.EMPTY;break e}let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[lw],t[0]=e):e=t[0],p=e}const g=p;let v,x;t[1]===Symbol.for("react.memo_cache_sentinel")?(v={activationConstraint:{distance:8}},t[1]=v):v=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(x={coordinateGetter:Yx},t[2]=x):x=t[2];const y=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.useMemo((()=>[...t].filter((e=>null!=e))),[...t])}($g(zv,v),$g(Dv,x));let w;t[3]!==a?(w=e=>{u(e.active.id),m(a)},t[3]=a,t[4]=w):w=t[4];const N=W(w);let C;t[5]!==h?(C=()=>{u(null),m(null)},t[5]=h,t[6]=C):C=t[6];const E=W(C);let S;t[7]!==d||t[8]!==a?(S=e=>{const t=e.droppableContainers.filter((e=>hw(e.id)));if(d&&hw(d))return Zg({...e,droppableContainers:t});const n=(e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:o}=e;if(!o)return[];const r=[];for(const a of t){const{id:e}=a,t=n.get(e);if(t&&tv(o,t)){const n=Xg(t).reduce(((e,t)=>e+Wg(o,t)),0),s=Number((n/4).toFixed(4));r.push({id:e,data:{droppableContainer:a,value:s}})}}return r.sort(qg)})({...e,droppableContainers:t}),o=Kg(n.length>0?n:ev({...e,droppableContainers:t}),"id");if(!o)return[];Gt(hw(o),`Expected column id. Got: ${o}`);const r=a.get(o);if(Gt(r,`Expected column. Got: ${o}`),r&&0===r.topLevelIds.length)return[{id:o}];const s=new Set(r.topLevelIds),i=Zg({...e,droppableContainers:e.droppableContainers.filter((e=>e.id!==o&&s.has(e.id)))});if(i.length>0){const e=i[0].id;return Gt(uw(e),`Expected cell id. Got: ${e}`),[{id:e}]}return[]},t[7]=d,t[8]=a,t[9]=S):S=t[9];const j=S;let _;t[10]!==i||t[11]!==s||t[12]!==l?(_=e=>{const{active:t,over:n}=e,o=null==n?void 0:n.id;if(null!=o&&t.id!==o){if(uw(t.id)){if(hw(o))return void i({cellId:t.id,columnId:o});if(uw(o))return void s({cellId:t.id,overCellId:o})}hw(t.id)&&hw(o)&&l({column:t.id,overColumn:o})}},t[10]=i,t[11]=s,t[12]=l,t[13]=_):_=t[13];const I=W(_);let A;t[14]!==c?(A=e=>{const{active:t,over:n}=e;null!==n&&t.id!==n.id&&c()},t[14]=c,t[15]=A):A=t[15];const M=W(A),T=o?j:Zg;let O;return t[16]!==y||t[17]!==T||t[18]!==g||t[19]!==M||t[20]!==N||t[21]!==E||t[22]!==I||t[23]!==n?(O=k.jsx(Nx,{autoScroll:cw,sensors:y,collisionDetection:T,modifiers:g,onDragEnd:M,onDragStart:N,onDragCancel:E,onDragOver:I,children:n}),t[16]=y,t[17]=T,t[18]=g,t[19]=M,t[20]=N,t[21]=E,t[22]=I,t[23]=n,t[24]=O):O=t[24],O}));function uw(e){return"string"==typeof e&&!e.startsWith("tree_")}function hw(e){return"string"==typeof e&&e.startsWith("tree_")}const mw=u.forwardRef((({columnId:e,canDelete:t,canMoveLeft:n,canMoveRight:o,...r},a)=>{const{attributes:s,listeners:i,setNodeRef:l,transform:c,transition:d,isDragging:u,isOver:h}=Hx({id:e}),m={transform:c?fr.Transform.toString({x:c.x,y:0,scaleX:1,scaleY:1}):void 0,transition:d,zIndex:u?2:void 0,position:"relative","--gutter-width":"50px"},f=Og(a,l),{deleteColumn:p,moveColumn:g,addColumn:v}=q(),x=on("h-full hover:bg-muted rounded-none"),y=()=>{const e=document.getElementById("App");e&&e.scrollTo({left:e.scrollLeft+1e3,behavior:"smooth"})},b=k.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:[k.jsx(C,{content:"Move column left",side:"top",delayDuration:300,children:k.jsx(E,{variant:"text",size:"sm",className:x,onClick:()=>g({column:e,overColumn:"_left_"}),disabled:!n,children:k.jsx(Ma,{className:"size-4"})})}),k.jsx(C,{content:"Move column right",side:"top",delayDuration:300,children:k.jsx(E,{variant:"text",size:"sm",className:x,onClick:()=>g({column:e,overColumn:"_right_"}),disabled:!o,children:k.jsx(oa,{className:"size-4"})})}),k.jsx("div",{className:"flex gap-2 h-full flex-grow active:bg-accent cursor-grab",...s,...i,"data-testid":"column-drag-button"}),t&&k.jsx(C,{content:"Delete column",side:"top",delayDuration:300,children:k.jsx(E,{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:()=>p({columnId:e}),children:k.jsx(en,{className:"size-4"})})}),k.jsx(C,{content:"Add column",side:"top",delayDuration:300,children:k.jsx(E,{variant:"text",size:"sm",className:x,onClick:()=>{v({columnId:e}),requestAnimationFrame(y)},children:k.jsx(zo,{className:"size-4"})})})]});return k.jsxs("div",{tabIndex:-1,ref:f,...r,style:m,"data-is-dragging":u,className:on(u?"":r.className,u?"z-20":"z-1 hover:z-10 focus-within:z-10",h&&"bg-accent/20"),children:[b,r.children]})}));mw.displayName="SortableColumn";const fw=r.memo(mw),pw=r.memo((e=>{const t=b(15),n=r.useRef(null),o="columns"===e.width&&"w-contentWidth box-content\t min-h-[100px] border border-t-0 border-[var(--slate-3)] rounded-b-lg px-11 py-6 bg-[var(--slate-2)]";let a,s;t[0]!==o?(a=on("flex flex-col gap-5",o),t[0]=o,t[1]=a):a=t[1],t[2]!==a||t[3]!==e.children?(s=k.jsx("div",{className:a,children:e.children}),t[2]=a,t[3]=e.children,t[4]=s):s=t[4];const i=s;if("columns"===e.width){let o;return t[5]!==e.canDelete||t[6]!==e.columnId||t[7]!==e.canMoveLeft||t[8]!==e.canMoveRight||t[9]!==e.footer||t[10]!==i?(o=k.jsxs(fw,{tabIndex:-1,ref:n,canDelete:e.canDelete,columnId:e.columnId,canMoveLeft:e.canMoveLeft,canMoveRight:e.canMoveRight,className:"group/column",children:[i,e.footer]}),t[5]=e.canDelete,t[6]=e.columnId,t[7]=e.canMoveLeft,t[8]=e.canMoveRight,t[9]=e.footer,t[10]=i,t[11]=o):o=t[11],o}let l;return t[12]!==i||t[13]!==e.footer?(l=k.jsxs(k.Fragment,{children:[i,e.footer]}),t[12]=i,t[13]=e.footer,t[14]=l):l=t[14],l}));pw.displayName="Column";const gw=e=>{const t=b(67),{notebook:n,mode:o,userConfig:a,appConfig:s,connStatus:i}=e,l=q(),{theme:c}=Te(),{toggleSidebarPanel:d}=Wd(),{invisible:u}=fl(n.cellIds.idLength,o);let h;yi("global.focusTop",l.focusTopCell),yi("global.focusBottom",l.focusBottomCell),yi("global.toggleSidebar",d),yi("global.foldCode",l.foldAll),yi("global.unfoldCode",l.unfoldAll),t[0]!==l.updateCellCode?(h=()=>{Da(l.updateCellCode)},t[0]=l.updateCellCode,t[1]=h):h=t[1],yi("global.formatAll",h),yi("cell.hideCode",rn.NOOP),yi("cell.format",rn.NOOP);const m=yd(),f=l.scrollToTarget;let p,g,v,x,y,w,N,C,E,S,j,_,I,A,M,T,O,D,R,P,F,L;if(t[2]!==n.scrollKey||t[3]!==f?(p=()=>{null!==n.scrollKey&&f()},t[2]=n.scrollKey,t[3]=f,t[4]=p):p=t[4],t[5]!==n.cellIds||t[6]!==n.scrollKey||t[7]!==f?(g=[n.cellIds,n.scrollKey,f],t[5]=n.cellIds,t[6]=n.scrollKey,t[7]=f,t[8]=g):g=t[8],r.useEffect(p,g),t[9]!==n.cellIds||t[10]!==n.cellData||t[11]!==n.cellRuntime||t[12]!==n.scrollKey||t[13]!==n.cellHandles||t[14]!==u||t[15]!==s||t[16]!==c||t[17]!==o||t[18]!==i.state||t[19]!==a||t[20]!==l||t[21]!==m){const e=n.cellIds.getColumns();let r;t[37]!==n.cellIds?(r=n.cellIds.hasOnlyOneId(),t[37]=n.cellIds,t[38]=r):r=t[38];const d=r;j=pl,_="pb-[40vh]",I=u,A=s,M="pr-4",t[39]===Symbol.for("react.memo_cache_sentinel")?(T=k.jsx(ew,{}),t[39]=T):T=t[39],t[40]!==s.width?(O=k.jsx(Jb,{width:s.width}),t[40]=s.width,t[41]=O):O=t[41],E=dw,S="columns"===s.width,y=Lx,w="column-container",N=e.map(xw),C=Tx;const h="columns"===s.width&&"grid grid-flow-col auto-cols-min gap-6";t[42]!==h?(v=on(h),t[42]=h,t[43]=v):v=t[43],x=e.map(((t,r)=>k.jsx(pw,{columnId:t.id,canMoveLeft:r>0,canMoveRight:r<e.length-1,width:s.width,canDelete:e.length>1,footer:k.jsx(vw,{columnId:t.id,className:on("columns"===s.width&&"opacity-0 group-hover/column:opacity-100")}),children:k.jsx(Lx,{id:`column-${r+1}`,items:t.topLevelIds,strategy:Rx,children:t.topLevelIds.map((e=>{const r=n.cellData[e],h=n.cellRuntime[e];return k.jsx(Kb,{theme:c,showPlaceholder:d,allowFocus:!u&&!n.scrollKey,id:r.id,code:r.code,outline:h.outline,output:h.output,consoleOutputs:h.consoleOutputs,status:h.status,edited:r.edited,interrupted:h.interrupted,errored:h.errored,stopped:h.stopped,staleInputs:h.staleInputs,runStartTimestamp:h.runStartTimestamp,lastRunStartTimestamp:h.lastRunStartTimestamp,runElapsedTimeMs:h.runElapsedTimeMs??r.lastExecutionTime,serializedEditorState:r.serializedEditorState,canDelete:!d,mode:o,appClosed:i.state!==nl.OPEN,ref:n.cellHandles[e],userConfig:a,debuggerActive:h.debuggerActive,config:r.config,name:r.name,isCollapsed:t.isCollapsed(e),collapseCount:t.getCount(e),canMoveX:"columns"===s.width,...l,deleteCell:m},r.id.toString())}))})},t.id))),t[9]=n.cellIds,t[10]=n.cellData,t[11]=n.cellRuntime,t[12]=n.scrollKey,t[13]=n.cellHandles,t[14]=u,t[15]=s,t[16]=c,t[17]=o,t[18]=i.state,t[19]=a,t[20]=l,t[21]=m,t[22]=v,t[23]=x,t[24]=y,t[25]=w,t[26]=N,t[27]=C,t[28]=E,t[29]=S,t[30]=j,t[31]=_,t[32]=I,t[33]=A,t[34]=M,t[35]=T,t[36]=O}else v=t[22],x=t[23],y=t[24],w=t[25],N=t[26],C=t[27],E=t[28],S=t[29],j=t[30],_=t[31],I=t[32],A=t[33],M=t[34],T=t[35],O=t[36];return t[44]!==v||t[45]!==x?(D=k.jsx("div",{className:v,children:x}),t[44]=v,t[45]=x,t[46]=D):D=t[46],t[47]!==y||t[48]!==w||t[49]!==N||t[50]!==C||t[51]!==D?(R=k.jsx(y,{id:w,items:N,strategy:C,children:D}),t[47]=y,t[48]=w,t[49]=N,t[50]=C,t[51]=D,t[52]=R):R=t[52],t[53]!==E||t[54]!==S||t[55]!==R?(P=k.jsx(E,{multiColumn:S,children:R}),t[53]=E,t[54]=S,t[55]=R,t[56]=P):P=t[56],t[57]===Symbol.for("react.memo_cache_sentinel")?(F=k.jsx(gl,{}),t[57]=F):F=t[57],t[58]!==j||t[59]!==_||t[60]!==I||t[61]!==A||t[62]!==M||t[63]!==T||t[64]!==O||t[65]!==P?(L=k.jsxs(j,{className:_,invisible:I,appConfig:A,innerClassName:M,children:[T,O,P,F]}),t[58]=j,t[59]=_,t[60]=I,t[61]=A,t[62]=M,t[63]=T,t[64]=O,t[65]=P,t[66]=L):L=t[66],L},vw=e=>{const t=b(18),{columnId:n,className:o}=e,{createNewCell:r}=q(),a=le(ue),[s,i]=Ta(!1),l=le(de),c=le(Oa).sql;let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d=on("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"),t[0]=d):d=t[0];const u=d;let h;t[1]!==s||t[2]!==i.toggle||t[3]!==r||t[4]!==n||t[5]!==a||t[6]!==c||t[7]!==l?(h=()=>s?k.jsx(Db,{onClose:i.toggle}):k.jsxs(k.Fragment,{children:[k.jsxs(E,{className:u,variant:"text",size:"sm",onClick:()=>r({cellId:{type:"__end__",columnId:n},before:!1}),children:[k.jsx(Dc,{className:"mr-2 size-4 flex-shrink-0"}),"Python"]}),k.jsxs(E,{className:u,variant:"text",size:"sm",onClick:()=>{wd(a,r),r({cellId:{type:"__end__",columnId:n},before:!1,code:(new Bo).defaultCode})},children:[k.jsx(Fc,{className:"mr-2 size-4 flex-shrink-0"}),"Markdown"]}),k.jsx(C,{content:c?null:k.jsxs("div",{className:"flex flex-col",children:[k.jsxs("span",{children:["Additional dependencies required:",k.jsx(Ra,{className:"inline",children:"pip install 'marimo[sql]'"}),"."]}),k.jsx("span",{children:"You will need to restart the notebook after installing."})]}),delayDuration:100,asChild:!1,children:k.jsxs(E,{className:u,variant:"text",size:"sm",disabled:!c,onClick:()=>{wd(a,r),r({cellId:{type:"__end__",columnId:n},before:!1,code:(new Uo).defaultCode})},children:[k.jsx(ke,{className:"mr-2 size-4 flex-shrink-0"}),"SQL"]})}),k.jsx(C,{content:l?null:k.jsx("span",{children:"Enable via settings under AI Assist"}),delayDuration:100,asChild:!1,children:k.jsxs(E,{className:u,variant:"text",size:"sm",disabled:!l,onClick:i.toggle,children:[k.jsx(Oc,{className:"mr-2 size-4 flex-shrink-0"}),"Generate with AI"]})})]}),t[1]=s,t[2]=i.toggle,t[3]=r,t[4]=n,t[5]=a,t[6]=c,t[7]=l,t[8]=h):h=t[8];const m=h,f=!s&&"w-fit",p=s&&"opacity-100 w-full max-w-4xl shadow-lg shadow-[var(--blue-3)]";let g,v,x;return t[9]!==f||t[10]!==p||t[11]!==o?(g=on("shadow-sm border border-border rounded transition-all duration-200 overflow-hidden divide-x divide-border flex",f,p,o),t[9]=f,t[10]=p,t[11]=o,t[12]=g):g=t[12],t[13]!==m?(v=m(),t[13]=m,t[14]=v):v=t[14],t[15]!==g||t[16]!==v?(x=k.jsx("div",{className:"flex justify-center mt-4 pt-6 pb-32 group gap-4 w-full print:hidden",children:k.jsx("div",{className:g,children:v})}),t[15]=g,t[16]=v,t[17]=x):x=t[17],x};function xw(e){return e.id}async function yw(){await Fa({download:!1,includeCode:!0,files:el.INSTANCE.filenames()})}async function bw(){await La({download:!1})}const ww=e=>{const t=b(117),{userConfig:n,appConfig:o}=e,a=H();za(qa,Wa.onCellIdsChange);const{setCells:s,updateCellCode:i,mergeAllColumns:l}=q(),c=le(ut),[d,u]=vt(),[h,m]=r.useState(),f=Xi(),{openModal:p,closeModal:g,openAlert:v}=w(),x="edit"===c.mode,y="present"===c.mode,N=le(Ba),C=le(me);let E;t[0]!==v?(E=function(){v("Failed to save notebook: not connected to a kernel.")},t[0]=v,t[1]=E):E=t[1];const S=E;let j;t[2]===Symbol.for("react.memo_cache_sentinel")?(j=[],t[2]=j):j=t[2],r.useEffect(Cw,j);const _=n.runtime.auto_instantiate;let I,A,M;t[3]!==s?(I=(e,t)=>{s(e);const n=e.map((e=>e.name)),o=e.map((e=>e.code)),r=e.map((e=>e.config));m({names:n,codes:o,configs:r,layout:t})},t[3]=s,t[4]=I):I=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(A=Ya(),t[5]=A):A=t[5],t[6]!==n.runtime.auto_instantiate||t[7]!==I?(M={autoInstantiate:_,setCells:I,sessionId:A},t[6]=n.runtime.auto_instantiate,t[7]=I,t[8]=M):M=t[8];const{connection:T}=vl(M);let O;t[9]!==T.state||t[10]!==S||t[11]!==u||t[12]!==o.app_title||t[13]!==v?(O=async e=>T.state!==nl.OPEN?(S(),null):(Xa((t=>{null===e?t.delete(Ka.filePath):t.set(Ka.filePath,e)})),Ja({filename:e}).then((()=>(u(e),document.title=o.app_title||pt.basename(e)||"Untitled Notebook",e))).catch((e=>(v(e.message),null)))),t[9]=T.state,t[10]=S,t[11]=u,t[12]=o.app_title,t[13]=v,t[14]=O):O=t[14];const D=W(O);let R,P;t[15]!==o.app_title||t[16]!==d?(R=()=>{document.title=o.app_title||pt.basename(d??"")||"Untitled Notebook"},P=[o.app_title,d],t[15]=o.app_title,t[16]=d,t[17]=R,t[18]=P):(R=t[17],P=t[18]),r.useEffect(R,P);const F=a.cellIds.colLength,L=nr(o.width);let z,B,U,V,G,$;t[19]!==L||t[20]!==o.width||t[21]!==l?(z=()=>{"columns"===L&&"columns"!==o.width&&l()},t[19]=L,t[20]=o.width,t[21]=l,t[22]=z):z=t[22],t[23]!==o.width||t[24]!==L||t[25]!==l||t[26]!==F?(B=[o.width,L,l,F],t[23]=o.width,t[24]=L,t[25]=l,t[26]=F,t[27]=B):B=t[27],r.useEffect(z,B),t[28]!==a?($=Ua(a),G=$.map(Ew),V=$.map(Sw),U=$.map(jw),t[28]=a,t[29]=U,t[30]=V,t[31]=G,t[32]=$):(U=t[29],V=t[30],G=t[31],$=t[32]);const X=U;let K;t[33]!==a?(K=Va(a),t[33]=a,t[34]=K):K=t[34];const Z=K;let ee;t[35]!==a||t[36]!==f||t[37]!==h?(ee=Ga(a,f,h),t[35]=a,t[36]=f,t[37]=h,t[38]=ee):ee=t[38];const te=ee;let ne;t[39]!==C||t[40]!==V||t[41]!==T.state||t[42]!==S||t[43]!==G||t[44]!==X||t[45]!==Z||t[46]!==n.save.format_on_save||t[47]!==i||t[48]!==f?(ne=(e,t)=>{C||0!==V.length&&(T.state===nl.OPEN?(J.log("saving to ",e),Za({cellIds:G,codes:V,names:X,filename:e,configs:Z,layout:bl(),persist:!0}).then((()=>{t&&(re({title:"Notebook saved"}),n.save.format_on_save&&Da(i)),m({names:X,codes:V,configs:Z,layout:f})}))):S())},t[39]=C,t[40]=V,t[41]=T.state,t[42]=S,t[43]=G,t[44]=X,t[45]=Z,t[46]=n.save.format_on_save,t[47]=i,t[48]=f,t[49]=ne):ne=t[49];const oe=W(ne);let ae;t[50]!==d||t[51]!==T.state||t[52]!==oe?(ae=e=>{const t=void 0!==e&&e;null!==d&&T.state===nl.OPEN&&oe(d,t)},t[50]=d,t[51]=T.state,t[52]=oe,t[53]=ae):ae=t[53];const se=W(ae),ie=W((()=>{se(!0),null===d&&T.state!==nl.CLOSED&&p(k.jsx(kw,{onClose:g,onSave:ue}))}));let ce,de;t[54]!==se||t[55]!==te||t[56]!==V||t[57]!==Z||t[58]!==X||t[59]!==T||t[60]!==n||t[61]!==C?(ce={onSave:se,needsSave:te,codes:V,cellConfigs:Z,cellNames:X,connStatus:T,config:n,kioskMode:C},t[54]=se,t[55]=te,t[56]=V,t[57]=Z,t[58]=X,t[59]=T,t[60]=n,t[61]=C,t[62]=ce):ce=t[62],function(e){const t=b(16),{codes:n,cellConfigs:o,config:a,connStatus:s,cellNames:i,needsSave:l,kioskMode:c,onSave:d}=e,u=r.useRef(null);let h,m;t[0]!==c||t[1]!==a.save.autosave||t[2]!==a.save.autosave_delay||t[3]!==l||t[4]!==s.state||t[5]!==d?(h=()=>{if(!c)return"after_delay"===a.save.autosave&&(null!==u.current&&clearTimeout(u.current),l&&s.state===nl.OPEN&&(u.current=setTimeout(d,a.save.autosave_delay))),()=>{null!==u.current&&clearTimeout(u.current)}},t[0]=c,t[1]=a.save.autosave,t[2]=a.save.autosave_delay,t[3]=l,t[4]=s.state,t[5]=d,t[6]=h):h=t[6],t[7]!==n||t[8]!==o||t[9]!==i||t[10]!==a.save||t[11]!==s.state||t[12]!==d||t[13]!==c||t[14]!==l?(m=[n,o,i,a.save,s.state,d,c,l],t[7]=n,t[8]=o,t[9]=i,t[10]=a.save,t[11]=s.state,t[12]=d,t[13]=c,t[14]=l,t[15]=m):m=t[15],r.useEffect(h,m)}(ce),function(){const e=b(4),t=le(Pa),{state:n}=le(tl),o=t.auto_download.includes("markdown"),r=t.auto_download.includes("html"),a=!o||n!==nl.OPEN,s=!r||n!==nl.OPEN;let i,l;e[0]!==a?(i={delayMs:5e3,whenVisible:!0,disabled:a},e[0]=a,e[1]=i):i=e[1],Ui(bw,i),e[2]!==s?(l={delayMs:5e3,whenVisible:!0,disabled:s},e[2]=s,e[3]=l):l=e[3],Ui(yw,l)}(),t[63]!==te?(de=e=>{if(!Qa())return te?(e.preventDefault(),e.returnValue="You have unsaved changes. Are you sure you want to quit?"):void 0},t[63]=te,t[64]=de):de=t[64],Q(window,"beforeunload",de);const ue=e=>{D(e).then((e=>{null!==e&&oe(e,!0)}))},he=function(){const e=b(3),t=H(),n=pd();let o;return e[0]!==n||e[1]!==t?(o=()=>n(Y(t)),e[0]=n,e[1]=t,e[2]=o):o=e[2],W(o)}(),fe=Yd();let pe,ge,ve;t[65]!==he?(pe=()=>{he()},t[65]=he,t[66]=pe):pe=t[66],yi("global.runStale",pe),yi("global.save",ie),yi("global.interrupt",_w),t[67]!==fe?(ge=()=>{fe()},t[67]=fe,t[68]=ge):ge=t[68],yi("global.hideCode",ge),t[69]!==d||t[70]!==$?(ve=()=>JSON.stringify({filename:d,cells:$.map((e=>({name:e.name,code:e.code})))},null,2),t[69]=d,t[70]=$,t[71]=ve):ve=t[71];const xe=W(ve);let ye;t[72]!==a||t[73]!==T||t[74]!==c.mode||t[75]!==n||t[76]!==o?(ye=k.jsx(gw,{notebook:a,connStatus:T,mode:c.mode,userConfig:n,appConfig:o}),t[72]=a,t[73]=T,t[74]=c.mode,t[75]=n,t[76]=o,t[77]=ye):ye=t[77];const be=ye,we=o.width;let ke,Ne,Ce,Ee,Se;t[78]===Symbol.for("react.memo_cache_sentinel")?(ke=on("pt-4 sm:pt-12 pb-2 mb-4 print:hidden z-50","sticky left-0"),t[78]=ke):ke=t[78],t[79]!==x||t[80]!==d||t[81]!==D?(Ne=x&&k.jsx("div",{className:"flex items-center justify-center container",children:k.jsx(Ru,{filename:d,setFilename:D})}),t[79]=x,t[80]=d,t[81]=D,t[82]=Ne):Ne=t[82],t[83]!==T||t[84]!==Ne?(Ce=k.jsx(wl,{connection:T,className:ke,children:Ne}),t[83]=T,t[84]=Ne,t[85]=Ce):Ce=t[85],t[86]!==$.length||t[87]!==o||t[88]!==c||t[89]!==be?(Ee=$.length>0&&k.jsx(xl,{appConfig:o,mode:c.mode,children:be}),t[86]=$.length,t[87]=o,t[88]=c,t[89]=be,t[90]=Ee):Ee=t[90],t[91]!==T||t[92]!==N||t[93]!==o.width||t[94]!==Ce||t[95]!==Ee?(Se=k.jsxs(kl,{connection:T,isRunning:N,width:we,children:[Ce,Ee]}),t[91]=T,t[92]=N,t[93]=o.width,t[94]=Ce,t[95]=Ee,t[96]=Se):Se=t[96];const je=T.state===nl.CLOSED;let _e,Ie,Ae,Me;return t[97]!==a?(_e=$a(a),t[97]=a,t[98]=_e):_e=t[98],t[99]!==a?(Ie=It(a),t[99]=a,t[100]=Ie):Ie=t[100],t[101]!==d||t[102]!==te||t[103]!==ie||t[104]!==xe||t[105]!==y||t[106]!==fe||t[107]!==he||t[108]!==je||t[109]!==N||t[110]!==_e||t[111]!==Ie||t[112]!==o.width?(Ae=k.jsx(_u,{filename:d,needsSave:te,onSaveNotebook:ie,getCellsAsJSON:xe,presenting:y,onTogglePresenting:fe,onInterrupt:ra,onRun:he,closed:je,running:N,needsRun:_e,undoAvailable:Ie,appWidth:o.width}),t[101]=d,t[102]=te,t[103]=ie,t[104]=xe,t[105]=y,t[106]=fe,t[107]=he,t[108]=je,t[109]=N,t[110]=_e,t[111]=Ie,t[112]=o.width,t[113]=Ae):Ae=t[113],t[114]!==Se||t[115]!==Ae?(Me=k.jsxs(k.Fragment,{children:[Se,Ae]}),t[114]=Se,t[115]=Ae,t[116]=Me):Me=t[116],Me},kw=e=>{const t=b(17),{onClose:n,onSave:o}=e,[a,s]=r.useState();let i;t[0]!==o||t[1]!==n?(i=e=>{s(e),e.trim()&&(o(e),n())},t[0]=o,t[1]=n,t[2]=i):i=t[2];const l=i;let c,d,u,h;t[3]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx(j,{children:"Save notebook"}),t[3]=c):c=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(d=k.jsx(Ae,{className:"text-md pt-6 px-1",children:"Save as"}),t[4]=d):d=t[4],t[5]!==l?(u=k.jsxs("div",{className:"flex flex-col",children:[d,k.jsx(Ou,{onNameChange:l,placeholderText:"filename",className:"missing-filename"})]}),t[5]=l,t[6]=u):u=t[6],t[7]!==n?(h=k.jsx(E,{"data-testid":"cancel-save-dialog-button","aria-label":"Cancel",variant:"secondary",onClick:n,children:"Cancel"}),t[7]=n,t[8]=h):h=t[8];const m=!a;let f,p,g;return t[9]!==m?(f=k.jsx(E,{"data-testid":"submit-save-dialog-button","aria-label":"Save",variant:"default",disabled:m,type:"submit",children:"Save"}),t[9]=m,t[10]=f):f=t[10],t[11]!==h||t[12]!==f?(p=k.jsxs(I,{children:[h,f]}),t[11]=h,t[12]=f,t[13]=p):p=t[13],t[14]!==u||t[15]!==p?(g=k.jsxs(A,{children:[c,u,p]}),t[14]=u,t[15]=p,t[16]=g):g=t[16],g};function Nw(){yl.INSTANCE.stop()}function Cw(){return yl.INSTANCE.start(Ha),Nw}function Ew(e){return e.id}function Sw(e){return e.code}function jw(e){return e.name}function _w(){ra()}const{createElement:Iw,createContext:Aw,createRef:Mw,forwardRef:Tw,useCallback:Ow,useContext:Dw,useEffect:Rw,useImperativeHandle:Pw,useLayoutEffect:Fw,useMemo:Lw,useRef:zw,useState:Bw}=es,Uw=es["useId".toString()],Vw=Fw,Gw=Aw(null);Gw.displayName="PanelGroupContext";const $w=Vw,Hw="function"==typeof Uw?Uw:()=>null;let Ww=0;function qw(e=null){const t=Hw(),n=zw(e||t||null);return null===n.current&&(n.current=""+Ww++),null!=e?e:n.current}function Yw({children:e,className:t="",collapsedSize:n,collapsible:o,defaultSize:r,forwardedRef:a,id:s,maxSize:i,minSize:l,onCollapse:c,onExpand:d,onResize:u,order:h,style:m,tagName:f="div",...p}){const g=Dw(Gw);if(null===g)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:v,expandPanel:x,getPanelSize:y,getPanelStyle:b,groupId:w,isPanelCollapsed:k,reevaluatePanelConstraints:N,registerPanel:C,resizePanel:E,unregisterPanel:S}=g,j=qw(s),_=zw({callbacks:{onCollapse:c,onExpand:d,onResize:u},constraints:{collapsedSize:n,collapsible:o,defaultSize:r,maxSize:i,minSize:l},id:j,idIsFromProps:void 0!==s,order:h});zw({didLogMissingDefaultSizeWarning:!1}),$w((()=>{const{callbacks:e,constraints:t}=_.current,a={...t};_.current.id=j,_.current.idIsFromProps=void 0!==s,_.current.order=h,e.onCollapse=c,e.onExpand=d,e.onResize=u,t.collapsedSize=n,t.collapsible=o,t.defaultSize=r,t.maxSize=i,t.minSize=l,a.collapsedSize===t.collapsedSize&&a.collapsible===t.collapsible&&a.maxSize===t.maxSize&&a.minSize===t.minSize||N(_.current,a)})),$w((()=>{const e=_.current;return C(e),()=>{S(e)}}),[h,j,C,S]),Pw(a,(()=>({collapse:()=>{v(_.current)},expand:e=>{x(_.current,e)},getId:()=>j,getSize:()=>y(_.current),isCollapsed:()=>k(_.current),isExpanded:()=>!k(_.current),resize:e=>{E(_.current,e)}})),[v,x,y,k,j,E]);const I=b(_.current,r);return Iw(f,{...p,children:e,className:t,id:s,style:{...I,...m},"data-panel":"","data-panel-collapsible":o||void 0,"data-panel-group-id":w,"data-panel-id":j,"data-panel-size":parseFloat(""+I.flexGrow).toFixed(1)})}const Xw=Tw(((e,t)=>Iw(Yw,{...e,forwardedRef:t})));Yw.displayName="Panel",Xw.displayName="forwardRef(Panel)";let Kw=null,Jw=null;function Zw(e,t){const n=function(e,t){if(t){const e=!!(t&uk),n=!!(t&hk);if(t&ck)return e?"se-resize":n?"ne-resize":"e-resize";if(t&dk)return e?"sw-resize":n?"nw-resize":"w-resize";if(e)return"s-resize";if(n)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}(e,t);Kw!==n&&(Kw=n,null===Jw&&(Jw=document.createElement("style"),document.head.appendChild(Jw)),Jw.innerHTML=`*{cursor: ${n}!important;}`)}function Qw(e){return"keydown"===e.type}function ek(e){return e.type.startsWith("pointer")}function tk(e){return e.type.startsWith("mouse")}function nk(e){if(ek(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(tk(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}const ok=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function rk(e){const t=getComputedStyle(e);return"fixed"===t.position||(!("auto"===t.zIndex||"static"===t.position&&!function(e){var t;const n=getComputedStyle(null!==(t=lk(e))&&void 0!==t?t:e).display;return"flex"===n||"inline-flex"===n}(e))||(+t.opacity<1||("transform"in t&&"none"!==t.transform||("webkitTransform"in t&&"none"!==t.webkitTransform||("mixBlendMode"in t&&"normal"!==t.mixBlendMode||("filter"in t&&"none"!==t.filter||("webkitFilter"in t&&"none"!==t.webkitFilter||("isolation"in t&&"isolate"===t.isolation||(!!ok.test(t.willChange)||"touch"===t.webkitOverflowScrolling)))))))))}function ak(e){let t=e.length;for(;t--;){const n=e[t];if(jk(n,"Missing node"),rk(n))return n}return null}function sk(e){return e&&Number(getComputedStyle(e).zIndex)||0}function ik(e){const t=[];for(;e;)t.push(e),e=lk(e);return t}function lk(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const ck=1,dk=2,uk=4,hk=8,mk="coarse"===function(){if("function"==typeof matchMedia)return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}();let fk=[],pk=!1,gk=new Map,vk=new Map;const xk=new Set;function yk(e){const{target:t}=e,{x:n,y:o}=nk(e);pk=!0,kk({target:t,x:n,y:o}),Ek(),fk.length>0&&(Sk("down",e),e.preventDefault(),e.stopPropagation())}function bk(e){const{x:t,y:n}=nk(e);if(!pk){const{target:o}=e;kk({target:o,x:t,y:n})}Sk("move",e),Ck(),fk.length>0&&e.preventDefault()}function wk(e){const{target:t}=e,{x:n,y:o}=nk(e);vk.clear(),pk=!1,fk.length>0&&e.preventDefault(),Sk("up",e),kk({target:t,x:n,y:o}),Ck(),Ek()}function kk({target:e,x:t,y:n}){fk.splice(0);let o=null;e instanceof HTMLElement&&(o=e),xk.forEach((e=>{const{element:r,hitAreaMargins:a}=e,s=r.getBoundingClientRect(),{bottom:i,left:l,right:c,top:d}=s,u=mk?a.coarse:a.fine;if(t>=l-u&&t<=c+u&&n>=d-u&&n<=i+u){if(null!==o&&r!==o&&!r.contains(o)&&!o.contains(r)&&function(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:ik(e),b:ik(t)};let o;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),o=e;jk(o,"Stacking order can only be calculated for elements with a common ancestor");const r=sk(ak(n.a)),a=sk(ak(n.b));if(r===a){const e=o.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)};let r=e.length;for(;r--;){const n=e[r];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(r-a)}(o,r)>0){let e=o,t=!1;for(;e&&!e.contains(r);){if(h=e.getBoundingClientRect(),m=s,h.x<m.x+m.width&&h.x+h.width>m.x&&h.y<m.y+m.height&&h.y+h.height>m.y){t=!0;break}e=e.parentElement}if(t)return}fk.push(e)}var h,m}))}function Nk(e,t){vk.set(e,t)}function Ck(){let e=!1,t=!1;fk.forEach((n=>{const{direction:o}=n;"horizontal"===o?e=!0:t=!0}));let n=0;vk.forEach((e=>{n|=e})),e&&t?Zw("intersection",n):e?Zw("horizontal",n):t?Zw("vertical",n):null!==Jw&&(document.head.removeChild(Jw),Kw=null,Jw=null)}function Ek(){gk.forEach(((e,t)=>{const{body:n}=t;n.removeEventListener("contextmenu",wk),n.removeEventListener("pointerdown",yk),n.removeEventListener("pointerleave",bk),n.removeEventListener("pointermove",bk)})),window.removeEventListener("pointerup",wk),window.removeEventListener("pointercancel",wk),xk.size>0&&(pk?(fk.length>0&&gk.forEach(((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("contextmenu",wk),n.addEventListener("pointerleave",bk),n.addEventListener("pointermove",bk))})),window.addEventListener("pointerup",wk),window.addEventListener("pointercancel",wk)):gk.forEach(((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("pointerdown",yk,{capture:!0}),n.addEventListener("pointermove",bk))})))}function Sk(e,t){xk.forEach((n=>{const{setResizeHandlerState:o}=n,r=fk.includes(n);o(e,r,t)}))}function jk(e,t){if(!e)throw console.error(t),Error(t)}function _k(e,t,n=10){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function Ik(e,t,n=10){return 0===_k(e,t,n)}function Ak(e,t,n){return 0===_k(e,t,n)}function Mk({panelConstraints:e,panelIndex:t,size:n}){const o=e[t];jk(null!=o,`Panel constraints not found for index ${t}`);let{collapsedSize:r=0,collapsible:a,maxSize:s=100,minSize:i=0}=o;if(_k(n,i)<0)if(a){n=_k(n,(r+i)/2)<0?r:i}else n=i;return n=Math.min(s,n),n=parseFloat(n.toFixed(10))}function Tk({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:o,prevLayout:r,trigger:a}){if(Ak(e,0))return t;const s=[...t],[i,l]=o;jk(null!=i,"Invalid first pivot index"),jk(null!=l,"Invalid second pivot index");let c=0;if("keyboard"===a){{const o=e<0?l:i,r=n[o];jk(r,`Panel constraints not found for index ${o}`);const{collapsedSize:a=0,collapsible:s,minSize:c=0}=r;if(s){const n=t[o];if(jk(null!=n,`Previous layout not found for panel index ${o}`),Ak(n,a)){const t=c-n;_k(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{const o=e<0?i:l,r=n[o];jk(r,`No panel constraints found for index ${o}`);const{collapsedSize:a=0,collapsible:s,minSize:c=0}=r;if(s){const n=t[o];if(jk(null!=n,`Previous layout not found for panel index ${o}`),Ak(n,c)){const t=n-a;_k(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}{const o=e<0?1:-1;let r=e<0?l:i,a=0;for(;;){const e=t[r];jk(null!=e,`Previous layout not found for panel index ${r}`);if(a+=Mk({panelConstraints:n,panelIndex:r,size:100})-e,r+=o,r<0||r>=n.length)break}const s=Math.min(Math.abs(e),Math.abs(a));e=e<0?0-s:s}{let o=e<0?i:l;for(;o>=0&&o<n.length;){const r=Math.abs(e)-Math.abs(c),a=t[o];jk(null!=a,`Previous layout not found for panel index ${o}`);const i=Mk({panelConstraints:n,panelIndex:o,size:a-r});if(!Ak(a,i)&&(c+=a-i,s[o]=i,c.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?o--:o++}}if(function(e,t,n){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(!Ak(e[o],t[o],n))return!1;return!0}(r,s))return r;{const o=e<0?l:i,r=t[o];jk(null!=r,`Previous layout not found for panel index ${o}`);const a=r+c,d=Mk({panelConstraints:n,panelIndex:o,size:a});if(s[o]=d,!Ak(d,a)){let t=a-d;let o=e<0?l:i;for(;o>=0&&o<n.length;){const r=s[o];jk(null!=r,`Previous layout not found for panel index ${o}`);const a=Mk({panelConstraints:n,panelIndex:o,size:r+t});if(Ak(r,a)||(t-=a-r,s[o]=a),Ak(t,0))break;e>0?o--:o++}}}return Ak(s.reduce(((e,t)=>t+e),0),100)?s:r}function Ok({layout:e,panelsArray:t,pivotIndices:n}){let o=0,r=100,a=0,s=0;const i=n[0];jk(null!=i,"No pivot index found"),t.forEach(((e,t)=>{const{constraints:n}=e,{maxSize:l=100,minSize:c=0}=n;t===i?(o=c,r=l):(a+=c,s+=l)}));return{valueMax:Math.min(r,100-a),valueMin:Math.max(o,100-s),valueNow:e[i]}}function Dk(e,t=document){return Array.from(t.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function Rk(e,t,n=document){const o=Dk(e,n).findIndex((e=>e.getAttribute("data-panel-resize-handle-id")===t));return null!=o?o:null}function Pk(e,t,n){const o=Rk(e,t,n);return null!=o?[o,o+1]:[-1,-1]}function Fk(e,t=document){var n;if(t instanceof HTMLElement&&(null==t||null===(n=t.dataset)||void 0===n?void 0:n.panelGroupId)==e)return t;const o=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return o||null}function Lk(e,t=document){const n=t.querySelector(`[data-panel-resize-handle-id="${e}"]`);return n||null}function zk({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:o,panelDataArray:r,panelGroupElement:a,setLayout:s}){zw({didWarnAboutMissingResizeHandle:!1}),$w((()=>{if(!a)return;const e=Dk(n,a);for(let t=0;t<r.length-1;t++){const{valueMax:n,valueMin:a,valueNow:s}=Ok({layout:o,panelsArray:r,pivotIndices:[t,t+1]}),i=e[t];if(null==i);else{const e=r[t];jk(e,`No panel data found for index "${t}"`),i.setAttribute("aria-controls",e.id),i.setAttribute("aria-valuemax",""+Math.round(n)),i.setAttribute("aria-valuemin",""+Math.round(a)),i.setAttribute("aria-valuenow",null!=s?""+Math.round(s):"")}}return()=>{e.forEach(((e,t)=>{e.removeAttribute("aria-controls"),e.removeAttribute("aria-valuemax"),e.removeAttribute("aria-valuemin"),e.removeAttribute("aria-valuenow")}))}}),[n,o,r,a]),Rw((()=>{if(!a)return;const e=t.current;jk(e,"Eager values not found");const{panelDataArray:r}=e;jk(null!=Fk(n,a),`No group found for id "${n}"`);const i=Dk(n,a);jk(i,`No resize handles found for group id "${n}"`);const l=i.map((e=>{const t=e.getAttribute("data-panel-resize-handle-id");jk(t,"Resize handle element has no handle id attribute");const[i,l]=function(e,t,n,o=document){var r,a,s,i;const l=Lk(t,o),c=Dk(e,o),d=l?c.indexOf(l):-1;return[null!==(r=null===(a=n[d])||void 0===a?void 0:a.id)&&void 0!==r?r:null,null!==(s=null===(i=n[d+1])||void 0===i?void 0:i.id)&&void 0!==s?s:null]}(n,t,r,a);if(null==i||null==l)return()=>{};const c=e=>{if(!e.defaultPrevented)switch(e.key){case"Enter":{e.preventDefault();const l=r.findIndex((e=>e.id===i));if(l>=0){const e=r[l];jk(e,`No panel data found for index ${l}`);const i=o[l],{collapsedSize:c=0,collapsible:d,minSize:u=0}=e.constraints;if(null!=i&&d){const e=Tk({delta:Ak(i,c)?u-c:c-i,initialLayout:o,panelConstraints:r.map((e=>e.constraints)),pivotIndices:Pk(n,t,a),prevLayout:o,trigger:"keyboard"});o!==e&&s(e)}}break}}};return e.addEventListener("keydown",c),()=>{e.removeEventListener("keydown",c)}}));return()=>{l.forEach((e=>e()))}}),[a,e,t,n,o,r,s])}function Bk(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Uk(e,t){const n="horizontal"===e,{x:o,y:r}=nk(t);return n?o:r}function Vk(e,t,n,o,r,a){if(Qw(e)){const t="horizontal"===n;let o=0;o=e.shiftKey?100:null!=r?r:10;let a=0;switch(e.key){case"ArrowDown":a=t?0:o;break;case"ArrowLeft":a=t?-o:0;break;case"ArrowRight":a=t?o:0;break;case"ArrowUp":a=t?0:-o;break;case"End":a=100;break;case"Home":a=-100}return a}return null==o?0:function(e,t,n,o,r){const a="horizontal"===n,s=Lk(t,r);jk(s,`No resize handle element found for id "${t}"`);const i=s.getAttribute("data-panel-group-id");jk(i,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=o;const c=Uk(n,e),d=Fk(i,r);jk(d,`No group element found for id "${i}"`);const u=d.getBoundingClientRect();return(c-l)/(a?u.width:u.height)*100}(e,t,n,o,a)}function Gk(e,t,n){t.forEach(((t,o)=>{const r=e[o];jk(r,`Panel data not found for index ${o}`);const{callbacks:a,constraints:s,id:i}=r,{collapsedSize:l=0,collapsible:c}=s,d=n[i];if(null==d||t!==d){n[i]=t;const{onCollapse:e,onExpand:o,onResize:r}=a;r&&r(t,d),c&&(e||o)&&(!o||null!=d&&!Ik(d,l)||Ik(t,l)||o(),!e||null!=d&&Ik(d,l)||!Ik(t,l)||e())}}))}function $k(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Hk(e){try{if("undefined"==typeof localStorage)throw new Error("localStorage not supported in this environment");e.getItem=e=>localStorage.getItem(e),e.setItem=(e,t)=>{localStorage.setItem(e,t)}}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function Wk(e){return`react-resizable-panels:${e}`}function qk(e){return e.map((e=>{const{constraints:t,id:n,idIsFromProps:o,order:r}=e;return o?n:r?`${r}:${JSON.stringify(t)}`:JSON.stringify(t)})).sort(((e,t)=>e.localeCompare(t))).join(",")}function Yk(e,t){try{const n=Wk(e),o=t.getItem(n);if(o){const e=JSON.parse(o);if("object"==typeof e&&null!=e)return e}}catch(n){}return null}function Xk(e,t,n,o,r){var a;const s=Wk(e),i=qk(t),l=null!==(a=Yk(e,r))&&void 0!==a?a:{};l[i]={expandToSizes:Object.fromEntries(n.entries()),layout:o};try{r.setItem(s,JSON.stringify(l))}catch(c){console.error(c)}}function Kk({layout:e,panelConstraints:t}){const n=[...e],o=n.reduce(((e,t)=>e+t),0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map((e=>`${e}%`)).join(", ")}`);if(!Ak(o,100))for(let a=0;a<t.length;a++){const e=n[a];jk(null!=e,`No layout data found for index ${a}`);const t=100/o*e;n[a]=t}let r=0;for(let a=0;a<t.length;a++){const e=n[a];jk(null!=e,`No layout data found for index ${a}`);const o=Mk({panelConstraints:t,panelIndex:a,size:e});e!=o&&(r+=e-o,n[a]=o)}if(!Ak(r,0))for(let a=0;a<t.length;a++){const e=n[a];jk(null!=e,`No layout data found for index ${a}`);const o=Mk({panelConstraints:t,panelIndex:a,size:e+r});if(e!==o&&(r-=o-e,n[a]=o,Ak(r,0)))break}return n}const Jk={getItem:e=>(Hk(Jk),Jk.getItem(e)),setItem:(e,t)=>{Hk(Jk),Jk.setItem(e,t)}},Zk={};function Qk({autoSaveId:e=null,children:t,className:n="",direction:o,forwardedRef:r,id:a=null,onLayout:s=null,keyboardResizeBy:i=null,storage:l=Jk,style:c,tagName:d="div",...u}){const h=qw(a),m=zw(null),[f,p]=Bw(null),[g,v]=Bw([]),x=zw({}),y=zw(new Map),b=zw(0),w=zw({autoSaveId:e,direction:o,dragState:f,id:h,keyboardResizeBy:i,onLayout:s,storage:l}),k=zw({layout:g,panelDataArray:[],panelDataArrayChanged:!1});zw({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),Pw(r,(()=>({getId:()=>w.current.id,getLayout:()=>{const{layout:e}=k.current;return e},setLayout:e=>{const{onLayout:t}=w.current,{layout:n,panelDataArray:o}=k.current,r=Kk({layout:e,panelConstraints:o.map((e=>e.constraints))});Bk(n,r)||(v(r),k.current.layout=r,t&&t(r),Gk(o,r,x.current))}})),[]),$w((()=>{w.current.autoSaveId=e,w.current.direction=o,w.current.dragState=f,w.current.id=h,w.current.onLayout=s,w.current.storage=l})),zk({committedValuesRef:w,eagerValuesRef:k,groupId:h,layout:g,panelDataArray:k.current.panelDataArray,setLayout:v,panelGroupElement:m.current}),Rw((()=>{const{panelDataArray:t}=k.current;if(e){if(0===g.length||g.length!==t.length)return;let n=Zk[e];null==n&&(n=function(e,t=10){let n=null;return(...o)=>{null!==n&&clearTimeout(n),n=setTimeout((()=>{e(...o)}),t)}}(Xk,100),Zk[e]=n);const o=[...t],r=new Map(y.current);n(e,o,r,g,l)}}),[e,g,l]),Rw((()=>{}));const N=Ow((e=>{const{onLayout:t}=w.current,{layout:n,panelDataArray:o}=k.current;if(e.constraints.collapsible){const r=o.map((e=>e.constraints)),{collapsedSize:a=0,panelSize:s,pivotIndices:i}=nN(o,e,n);if(jk(null!=s,`Panel size not found for panel "${e.id}"`),!Ik(s,a)){y.current.set(e.id,s);const l=Tk({delta:tN(o,e)===o.length-1?s-a:a-s,initialLayout:n,panelConstraints:r,pivotIndices:i,prevLayout:n,trigger:"imperative-api"});$k(n,l)||(v(l),k.current.layout=l,t&&t(l),Gk(o,l,x.current))}}}),[]),C=Ow(((e,t)=>{const{onLayout:n}=w.current,{layout:o,panelDataArray:r}=k.current;if(e.constraints.collapsible){const a=r.map((e=>e.constraints)),{collapsedSize:s=0,panelSize:i=0,minSize:l=0,pivotIndices:c}=nN(r,e,o),d=null!=t?t:l;if(Ik(i,s)){const t=y.current.get(e.id),s=null!=t&&t>=d?t:d,l=Tk({delta:tN(r,e)===r.length-1?i-s:s-i,initialLayout:o,panelConstraints:a,pivotIndices:c,prevLayout:o,trigger:"imperative-api"});$k(o,l)||(v(l),k.current.layout=l,n&&n(l),Gk(r,l,x.current))}}}),[]),E=Ow((e=>{const{layout:t,panelDataArray:n}=k.current,{panelSize:o}=nN(n,e,t);return jk(null!=o,`Panel size not found for panel "${e.id}"`),o}),[]),S=Ow(((e,t)=>{const{panelDataArray:n}=k.current,o=tN(n,e);return function({defaultSize:e,dragState:t,layout:n,panelData:o,panelIndex:r,precision:a=3}){const s=n[r];let i;return i=null==s?null!=e?e.toPrecision(a):"1":1===o.length?"1":s.toPrecision(a),{flexBasis:0,flexGrow:i,flexShrink:1,overflow:"hidden",pointerEvents:null!==t?"none":void 0}}({defaultSize:t,dragState:f,layout:g,panelData:n,panelIndex:o})}),[f,g]),j=Ow((e=>{const{layout:t,panelDataArray:n}=k.current,{collapsedSize:o=0,collapsible:r,panelSize:a}=nN(n,e,t);return jk(null!=a,`Panel size not found for panel "${e.id}"`),!0===r&&Ik(a,o)}),[]),_=Ow((e=>{const{layout:t,panelDataArray:n}=k.current,{collapsedSize:o=0,collapsible:r,panelSize:a}=nN(n,e,t);return jk(null!=a,`Panel size not found for panel "${e.id}"`),!r||_k(a,o)>0}),[]),I=Ow((e=>{const{panelDataArray:t}=k.current;t.push(e),t.sort(((e,t)=>{const n=e.order,o=t.order;return null==n&&null==o?0:null==n?-1:null==o?1:n-o})),k.current.panelDataArrayChanged=!0}),[]);$w((()=>{if(k.current.panelDataArrayChanged){k.current.panelDataArrayChanged=!1;const{autoSaveId:e,onLayout:t,storage:n}=w.current,{layout:o,panelDataArray:r}=k.current;let a=null;if(e){const t=function(e,t,n){var o,r;return null!==(r=(null!==(o=Yk(e,n))&&void 0!==o?o:{})[qk(t)])&&void 0!==r?r:null}(e,r,n);t&&(y.current=new Map(Object.entries(t.expandToSizes)),a=t.layout)}null==a&&(a=function({panelDataArray:e}){const t=Array(e.length),n=e.map((e=>e.constraints));let o=0,r=100;for(let a=0;a<e.length;a++){const e=n[a];jk(e,`Panel constraints not found for index ${a}`);const{defaultSize:s}=e;null!=s&&(o++,t[a]=s,r-=s)}for(let a=0;a<e.length;a++){const s=n[a];jk(s,`Panel constraints not found for index ${a}`);const{defaultSize:i}=s;if(null!=i)continue;const l=r/(e.length-o);o++,t[a]=l,r-=l}return t}({panelDataArray:r}));const s=Kk({layout:a,panelConstraints:r.map((e=>e.constraints))});Bk(o,s)||(v(s),k.current.layout=s,t&&t(s),Gk(r,s,x.current))}})),$w((()=>{const e=k.current;return()=>{e.layout=[]}}),[]);const A=Ow((e=>function(t){t.preventDefault();const n=m.current;if(!n)return()=>null;const{direction:o,dragState:r,id:a,keyboardResizeBy:s,onLayout:i}=w.current,{layout:l,panelDataArray:c}=k.current,{initialLayout:d}=null!=r?r:{},u=Pk(a,e,n);let h=Vk(t,e,o,r,s,n);if(0===h)return;const f="horizontal"===o;"rtl"===document.dir&&f&&(h=-h);const p=Tk({delta:h,initialLayout:null!=d?d:l,panelConstraints:c.map((e=>e.constraints)),pivotIndices:u,prevLayout:l,trigger:Qw(t)?"keyboard":"mouse-or-touch"}),g=!$k(l,p);(ek(t)||tk(t))&&b.current!=h&&(b.current=h,Nk(e,g?0:f?h<0?ck:dk:h<0?uk:hk)),g&&(v(p),k.current.layout=p,i&&i(p),Gk(c,p,x.current))}),[]),M=Ow(((e,t)=>{const{onLayout:n}=w.current,{layout:o,panelDataArray:r}=k.current,a=r.map((e=>e.constraints)),{panelSize:s,pivotIndices:i}=nN(r,e,o);jk(null!=s,`Panel size not found for panel "${e.id}"`);const l=Tk({delta:tN(r,e)===r.length-1?s-t:t-s,initialLayout:o,panelConstraints:a,pivotIndices:i,prevLayout:o,trigger:"imperative-api"});$k(o,l)||(v(l),k.current.layout=l,n&&n(l),Gk(r,l,x.current))}),[]),T=Ow(((e,t)=>{const{layout:n,panelDataArray:o}=k.current,{collapsedSize:r=0,collapsible:a}=t,{collapsedSize:s=0,collapsible:i,maxSize:l=100,minSize:c=0}=e.constraints,{panelSize:d}=nN(o,e,n);null!=d&&(a&&i&&Ik(d,r)?Ik(r,s)||M(e,s):d<c?M(e,c):d>l&&M(e,l))}),[M]),O=Ow(((e,t)=>{const{direction:n}=w.current,{layout:o}=k.current;if(!m.current)return;const r=Lk(e,m.current);jk(r,`Drag handle element not found for id "${e}"`);const a=Uk(n,t);p({dragHandleId:e,dragHandleRect:r.getBoundingClientRect(),initialCursorPosition:a,initialLayout:o})}),[]),D=Ow((()=>{p(null)}),[]),R=Ow((e=>{const{panelDataArray:t}=k.current,n=tN(t,e);n>=0&&(t.splice(n,1),delete x.current[e.id],k.current.panelDataArrayChanged=!0)}),[]),P=Lw((()=>({collapsePanel:N,direction:o,dragState:f,expandPanel:C,getPanelSize:E,getPanelStyle:S,groupId:h,isPanelCollapsed:j,isPanelExpanded:_,reevaluatePanelConstraints:T,registerPanel:I,registerResizeHandle:A,resizePanel:M,startDragging:O,stopDragging:D,unregisterPanel:R,panelGroupElement:m.current})),[N,f,o,C,E,S,h,j,_,T,I,A,M,O,D,R]),F={display:"flex",flexDirection:"horizontal"===o?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return Iw(Gw.Provider,{value:P},Iw(d,{...u,children:t,className:n,id:a,ref:m,style:{...F,...c},"data-panel-group":"","data-panel-group-direction":o,"data-panel-group-id":h}))}const eN=Tw(((e,t)=>Iw(Qk,{...e,forwardedRef:t})));function tN(e,t){return e.findIndex((e=>e===t||e.id===t.id))}function nN(e,t,n){const o=tN(e,t),r=o===e.length-1?[o-1,o]:[o,o+1],a=n[o];return{...t.constraints,panelSize:a,pivotIndices:r}}function oN({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:o,id:r,onDragging:a,style:s={},tabIndex:i=0,tagName:l="div",...c}){var d,u;const h=zw(null),m=zw({onDragging:a});Rw((()=>{m.current.onDragging=a}));const f=Dw(Gw);if(null===f)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:p,groupId:g,registerResizeHandle:v,startDragging:x,stopDragging:y,panelGroupElement:b}=f,w=qw(r),[k,N]=Bw("inactive"),[C,E]=Bw(!1),[S,j]=Bw(null),_=zw({state:k});$w((()=>{_.current.state=k})),Rw((()=>{if(n)j(null);else{const e=v(w);j((()=>e))}}),[n,w,v]);const I=null!==(d=null==o?void 0:o.coarse)&&void 0!==d?d:15,A=null!==(u=null==o?void 0:o.fine)&&void 0!==u?u:5;Rw((()=>{if(n||null==S)return;const e=h.current;jk(e,"Element ref not attached");return function(e,t,n,o,r){var a;const{ownerDocument:s}=t,i={direction:n,element:t,hitAreaMargins:o,setResizeHandlerState:r},l=null!==(a=gk.get(s))&&void 0!==a?a:0;return gk.set(s,l+1),xk.add(i),Ek(),function(){var t;vk.delete(e),xk.delete(i);const n=null!==(t=gk.get(s))&&void 0!==t?t:1;gk.set(s,n-1),Ek(),1===n&&gk.delete(s)}}(w,e,p,{coarse:I,fine:A},((e,t,n)=>{if(t)switch(e){case"down":{N("drag"),x(w,n);const{onDragging:e}=m.current;e&&e(!0);break}case"move":{const{state:e}=_.current;"drag"!==e&&N("hover"),S(n);break}case"up":{N("hover"),y();const{onDragging:e}=m.current;e&&e(!1);break}}else N("inactive")}))}),[I,p,n,A,v,w,S,x,y]),function({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:o}){Rw((()=>{if(e||null==n||null==o)return;const r=Lk(t,o);if(null==r)return;const a=e=>{if(!e.defaultPrevented)switch(e.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":e.preventDefault(),n(e);break;case"F6":{e.preventDefault();const n=r.getAttribute("data-panel-group-id");jk(n,`No group element found for id "${n}"`);const a=Dk(n,o),s=Rk(n,t,o);jk(null!==s,`No resize element found for id "${t}"`),a[e.shiftKey?s>0?s-1:a.length-1:s+1<a.length?s+1:0].focus();break}}};return r.addEventListener("keydown",a),()=>{r.removeEventListener("keydown",a)}}),[o,e,t,n])}({disabled:n,handleId:w,resizeHandler:S,panelGroupElement:b});return Iw(l,{...c,children:e,className:t,id:r,onBlur:()=>E(!1),onFocus:()=>E(!0),ref:h,role:"separator",style:{touchAction:"none",userSelect:"none",...s},tabIndex:i,"data-panel-group-direction":p,"data-panel-group-id":g,"data-resize-handle":"","data-resize-handle-active":"drag"===k?"pointer":C?"keyboard":void 0,"data-resize-handle-state":k,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":w})}Qk.displayName="PanelGroup",eN.displayName="forwardRef(PanelGroup)",oN.displayName="PanelResizeHandle";const rN=e=>{const t=b(3);let n,o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=k.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"}),t[0]=n):n=t[0],t[1]!==e?(o=k.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.24em",height:"1em",viewBox:"0 0 256 208",fill:"currentColor",...e,children:n}),t[1]=e,t[2]=o):o=t[2],o},aN=e=>{const t=b(17);let n,o,r,a,s;t[0]!==e?(({children:a,tooltip:s,selected:n,className:o,...r}=e),t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=a,t[5]=s):(n=t[1],o=t[2],r=t[3],a=t[4],s=t[5]);const i=!n&&"hover:bg-[var(--sage-3)]",l=n&&"bg-[var(--sage-4)]";let c,d;t[6]!==i||t[7]!==l||t[8]!==o?(c=on("h-full flex items-center p-2 text-sm shadow-inset font-mono cursor-pointer rounded",i,l,o),t[6]=i,t[7]=l,t[8]=o,t[9]=c):c=t[9],t[10]!==c||t[11]!==r||t[12]!==a?(d=k.jsx("div",{className:c,...r,children:a}),t[10]=c,t[11]=r,t[12]=a,t[13]=d):d=t[13];const u=d;if(s){let e;return t[14]!==s||t[15]!==u?(e=k.jsx(C,{content:s,side:"top",delayDuration:200,children:u}),t[14]=s,t[15]=u,t[16]=e):e=t[16],e}return u},sN=()=>{var e;const t=b(10),n=le(lN),o=le(de),r=(null==(e=null==n?void 0:n.open_ai)?void 0:e.model)||"gpt-4-turbo",{handleClick:a}=cN();if(!o){let e,n;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx(Oc,{className:"h-4 w-4 opacity-60"}),t[0]=e):e=t[0],t[1]!==a?(n=k.jsx(aN,{tooltip:"Assist is disabled",selected:!1,onClick:a,children:e}),t[1]=a,t[2]=n):n=t[2],n}let s,i,l,c;return t[3]===Symbol.for("react.memo_cache_sentinel")?(s=k.jsx("b",{children:"Assist model:"}),t[3]=s):s=t[3],t[4]!==r?(i=k.jsxs(k.Fragment,{children:[s," ",r]}),t[4]=r,t[5]=i):i=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(l=k.jsx(Oc,{className:"h-4 w-4"}),t[6]=l):l=t[6],t[7]!==i||t[8]!==a?(c=k.jsx(aN,{tooltip:i,onClick:a,selected:!1,children:l}),t[7]=i,t[8]=a,t[9]=c):c=t[9],c},iN=Z((e=>e(ts).completion.copilot)),lN=Z((e=>e(ts).ai));function cN(){const e=b(5),t=ce(Vi),n=ce(ji);let o;e[0]!==t||e[1]!==n?(o=()=>{t("ai"),n(!0)},e[0]=t,e[1]=n,e[2]=o):o=e[2];const r=o;let a;return e[3]!==r?(a={handleClick:r},e[3]=r,e[4]=a):a=e[4],a}const dN=()=>{const e=b(1);if("github"===le(iN)){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=k.jsx(uN,{}),e[0]=t):t=e[0],t}return null},uN=()=>{const e=b(10),t=le(Gi),n=null!==le($i),{handleClick:o}=cN(),r=t?"Ready":"Not connected";let a,s,i,l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=k.jsx("b",{children:"GitHub Copilot:"}),e[0]=a):a=e[0],e[1]!==r?(s=k.jsxs(k.Fragment,{children:[a," ",r]}),e[1]=r,e[2]=s):s=e[2],e[3]!==n||e[4]!==t?(i=k.jsx("span",{children:n?k.jsx(ns,{className:"h-4 w-4"}):k.jsx(rN,{className:on("h-4 w-4",!t&&"opacity-60")})}),e[3]=n,e[4]=t,e[5]=i):i=e[5],e[6]!==s||e[7]!==o||e[8]!==i?(l=k.jsx(aN,{tooltip:s,selected:!1,onClick:o,children:i}),e[6]=s,e[7]=o,e[8]=i,e[9]=l):l=e[9],l},hN=e=>{const t=b(18),[n,o]=r.useState(0),a=le(tl);let s,i,l,c;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>o((e=>e+1)),i={delayMs:1e4,whenVisible:!0},t[0]=s,t[1]=i):(s=t[0],i=t[1]),Ui(s,i),t[2]!==a.state?(l=async()=>D()||a.state!==nl.OPEN?null:os(),t[2]=a.state,t[3]=l):l=t[3],t[4]!==n||t[5]!==a.state?(c=[n,a.state],t[4]=n,t[5]=a.state,t[6]=c):c=t[6];const{data:d}=an(l,c);let u,h,m,f,p;return t[7]!==d?(u=d&&k.jsx(fN,{memory:d.memory,kernel:d.kernel,server:d.server}),t[7]=d,t[8]=u):u=t[8],t[9]!==d?(h=d&&k.jsx(pN,{cpu:d.cpu}),t[9]=d,t[10]=h):h=t[10],t[11]===Symbol.for("react.memo_cache_sentinel")?(m=k.jsxs("div",{className:"flex items-center",children:[k.jsx(sN,{}),k.jsx(dN,{})]}),t[11]=m):m=t[11],t[12]!==a.state?(f=k.jsx(mN,{connection:a.state}),t[12]=a.state,t[13]=f):f=t[13],t[14]!==u||t[15]!==h||t[16]!==f?(p=k.jsxs("div",{className:"flex gap-2 items-center",children:[u,h,m,f]}),t[14]=u,t[15]=h,t[16]=f,t[17]=p):p=t[17],p},mN=e=>{const t=b(18),{connection:n}=e;let o,r,a,s,i,l,c;return t[0]!==n?(o=O(n.toLowerCase()),t[0]=n,t[1]=o):o=t[1],t[2]!==n?(r=n===nl.OPEN&&k.jsx($l,{className:"w-4 h-4"}),t[2]=n,t[3]=r):r=t[3],t[4]!==n?(a=n===nl.CLOSED&&k.jsx(Hi,{className:"w-4 h-4"}),t[4]=n,t[5]=a):a=t[5],t[6]!==n?(s=n===nl.CONNECTING&&k.jsx(ns,{size:"small"}),t[6]=n,t[7]=s):s=t[7],t[8]!==n?(i=n===nl.CLOSING&&k.jsx(ns,{className:"text-destructive",size:"small"}),t[8]=n,t[9]=i):i=t[9],t[10]!==r||t[11]!==a||t[12]!==s||t[13]!==i?(l=k.jsxs("div",{children:[r,a,s,i]}),t[10]=r,t[11]=a,t[12]=s,t[13]=i,t[14]=l):l=t[14],t[15]!==o||t[16]!==l?(c=k.jsx(C,{delayDuration:200,content:o,children:l}),t[15]=o,t[16]=l,t[17]=c):c=t[17],c},fN=e=>{const t=b(25),{memory:n,kernel:o,server:r}=e,{percent:a,total:s,used:i}=n;let l;t[0]!==a?(l=Math.round(a),t[0]=a,t[1]=l):l=t[1];const c=l;let d,u,h,m,f,p,g,v,x,y;return t[2]===Symbol.for("react.memo_cache_sentinel")?(d=k.jsx("b",{children:"computer memory:"}),t[2]=d):d=t[2],t[3]!==i?(u=xN(i),t[3]=i,t[4]=u):u=t[4],t[5]!==s?(h=xN(s),t[5]=s,t[6]=h):h=t[6],t[7]!==u||t[8]!==h||t[9]!==c?(m=k.jsxs("span",{children:[d," ",u," / ",h," GB (",c,"%)"]}),t[7]=u,t[8]=h,t[9]=c,t[10]=m):m=t[10],t[11]!==(null==r?void 0:r.memory)?(f=(null==r?void 0:r.memory)&&k.jsxs("span",{children:[k.jsx("b",{children:"marimo server:"})," ",vN(r.memory)]}),t[11]=null==r?void 0:r.memory,t[12]=f):f=t[12],t[13]!==(null==o?void 0:o.memory)?(p=(null==o?void 0:o.memory)&&k.jsxs("span",{children:[k.jsx("b",{children:"kernel:"})," ",vN(o.memory)]}),t[13]=null==o?void 0:o.memory,t[14]=p):p=t[14],t[15]!==m||t[16]!==f||t[17]!==p?(g=k.jsxs("div",{className:"flex flex-col gap-1",children:[m,f,p]}),t[15]=m,t[16]=f,t[17]=p,t[18]=g):g=t[18],t[19]===Symbol.for("react.memo_cache_sentinel")?(v=k.jsx(fc,{className:"w-4 h-4"}),t[19]=v):v=t[19],t[20]!==c?(x=k.jsxs("div",{className:"flex items-center gap-1",children:[v,k.jsx(gN,{percent:c})]}),t[20]=c,t[21]=x):x=t[21],t[22]!==g||t[23]!==x?(y=k.jsx(C,{delayDuration:200,content:g,children:x}),t[22]=g,t[23]=x,t[24]=y):y=t[24],y},pN=e=>{const t=b(11),{cpu:n}=e,{percent:o}=n;let r;t[0]!==o?(r=Math.round(o),t[0]=o,t[1]=r):r=t[1];const a=r;let s,i,l,c,d;return t[2]===Symbol.for("react.memo_cache_sentinel")?(s=k.jsx("b",{children:"CPU:"}),t[2]=s):s=t[2],t[3]!==a?(i=k.jsxs("span",{children:[s," ",a,"%"]}),t[3]=a,t[4]=i):i=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(l=k.jsx(Wi,{className:"w-4 h-4"}),t[5]=l):l=t[5],t[6]!==a?(c=k.jsxs("div",{className:"flex items-center gap-1",children:[l,k.jsx(gN,{percent:a})]}),t[6]=a,t[7]=c):c=t[7],t[8]!==i||t[9]!==c?(d=k.jsx(C,{delayDuration:200,content:i,children:c}),t[8]=i,t[9]=c,t[10]=d):d=t[10],d},gN=e=>{const t=b(2),{percent:n}=e,o=`${n}%`;let r;return t[0]!==o?(r=k.jsx("div",{className:"h-3 w-20 bg-[var(--slate-4)] rounded-lg overflow-hidden border",children:k.jsx("div",{className:"h-full bg-primary",style:{width:o}})}),t[0]=o,t[1]=r):r=t[1],r};function vN(e){return e>1073741824?`${xN(e)} GB`:`${function(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(e/1048576)}(e)} MB`}function xN(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e/1073741824)}const yN=e=>le(Oa)[e.capability]?e.children:null,bN=()=>{const e=b(56),{selectedPanel:t,isTerminalOpen:n}=Hd(),{openApplication:o,toggleTerminal:r}=Wd(),[a,s]=Oe(),i=le(rs),l=wN,c=qd.find(kN);let d;Gt(c,"Error panel not found"),e[0]!==r?(d=()=>{r()},e[0]=r,e[1]=d):d=e[1],yi("global.toggleTerminal",d);const u=aN,h=c.tooltip,m=t===c.type,f=()=>o(c.type),p=l(c,i>0?"text-destructive":"");let g,v,x,y,w;e[2]!==i?(g=k.jsx("span",{className:"ml-1 font-mono mt-[0.125rem]",children:i}),e[2]=i,e[3]=g):g=e[3],e[4]!==u||e[5]!==c.tooltip||e[6]!==m||e[7]!==f||e[8]!==p||e[9]!==g?(v=k.jsxs(u,{tooltip:h,selected:m,onClick:f,children:[p,g]}),e[4]=u,e[5]=c.tooltip,e[6]=m,e[7]=f,e[8]=p,e[9]=g,e[10]=v):v=e[10],e[11]!==r?(x=()=>r(),e[11]=r,e[12]=x):x=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(y=k.jsx(Uc,{className:"h-5 w-5"}),e[13]=y):y=e[13],e[14]!==n||e[15]!==x?(w=k.jsx(yN,{capability:"terminal",children:k.jsx(aN,{tooltip:"Open terminal",selected:n,onClick:x,children:y})}),e[14]=n,e[15]=x,e[16]=w):w=e[16];const N=a.runtime.auto_instantiate?"Disable autorun on startup":"Enable autorun on startup";let E,S,j;e[17]!==a||e[18]!==s?(E=async()=>{const e={...a,runtime:{...a.runtime,auto_instantiate:!a.runtime.auto_instantiate}};await Re({config:e}).then((()=>s(e)))},e[17]=a,e[18]=s,e[19]=E):E=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(S=k.jsx("span",{children:"on startup: "}),e[20]=S):S=e[20],e[21]!==a.runtime.auto_instantiate?(j=a.runtime.auto_instantiate?k.jsx(Xc,{size:14}):k.jsx(Yc,{size:14}),e[21]=a.runtime.auto_instantiate,e[22]=j):j=e[22];const _=a.runtime.auto_instantiate?"autorun":"lazy";let I,A,M,T;e[23]!==_?(I=k.jsx("span",{children:_}),e[23]=_,e[24]=I):I=e[24],e[25]!==j||e[26]!==I?(A=k.jsxs("div",{className:"font-prose text-sm flex items-center gap-1",children:[S,j,I]}),e[25]=j,e[26]=I,e[27]=A):A=e[27],e[28]!==N||e[29]!==E||e[30]!==A?(M=k.jsx(aN,{tooltip:N,selected:!1,onClick:E,children:A}),e[28]=N,e[29]=E,e[30]=A,e[31]=M):M=e[31],e[32]===Symbol.for("react.memo_cache_sentinel")?(T=k.jsx("div",{className:"border-r border-border h-6 mx-1"}),e[32]=T):T=e[32];const O="autorun"===a.runtime.on_cell_change?"Disable autorun":"Enable autorun";let R,P,F,L,z,B,U,V,G,$;return e[33]!==a||e[34]!==s?(R=async()=>{const e={...a,runtime:{...a.runtime,on_cell_change:"autorun"===a.runtime.on_cell_change?"lazy":"autorun"}};await Re({config:e}).then((()=>s(e)))},e[33]=a,e[34]=s,e[35]=R):R=e[35],e[36]===Symbol.for("react.memo_cache_sentinel")?(P=k.jsx("span",{children:"on cell change: "}),e[36]=P):P=e[36],e[37]!==a.runtime.on_cell_change?(F=k.jsxs("div",{className:"font-prose text-sm flex items-center gap-1",children:[P,"autorun"===a.runtime.on_cell_change?k.jsx(Xc,{size:14}):k.jsx(Yc,{size:14}),k.jsx("span",{children:a.runtime.on_cell_change})]}),e[37]=a.runtime.on_cell_change,e[38]=F):F=e[38],e[39]!==O||e[40]!==R||e[41]!==F?(L=k.jsx(aN,{tooltip:O,selected:!1,onClick:R,children:F}),e[39]=O,e[40]=R,e[41]=F,e[42]=L):L=e[42],e[43]===Symbol.for("react.memo_cache_sentinel")?(z=k.jsx("div",{className:"border-r border-border h-6 mx-1"}),e[43]=z):z=e[43],e[44]!==a||e[45]!==s?(B=!D()&&k.jsx(aN,{tooltip:null,selected:!1,children:k.jsxs(zt,{children:[k.jsxs(Ot,{className:"font-prose text-sm flex items-center gap-1",children:[k.jsx("span",{children:"on module change: "}),"off"===a.runtime.auto_reload&&k.jsx(Hi,{size:14}),"lazy"===a.runtime.auto_reload&&k.jsx(Yc,{size:14}),"autorun"===a.runtime.auto_reload&&k.jsx(Xc,{size:14}),k.jsx("span",{children:a.runtime.auto_reload}),k.jsx(Ee,{size:14})]}),k.jsx(Bt,{children:["off","lazy","autorun"].map((e=>k.jsxs(Tt,{onClick:async()=>{const t={...a,runtime:{...a.runtime,auto_reload:e}};await Re({config:t}).then((()=>s(t)))},children:["off"===e&&k.jsx(Hi,{size:14,className:"mr-2 text-muted-foreground"}),"lazy"===e&&k.jsx(Yc,{size:14,className:"mr-2 text-muted-foreground"}),"autorun"===e&&k.jsx(Xc,{size:14,className:"mr-2 text-muted-foreground"}),e]},e)))})]})}),e[44]=a,e[45]=s,e[46]=B):B=e[46],e[47]===Symbol.for("react.memo_cache_sentinel")?(U=k.jsx("div",{className:"mx-auto"}),e[47]=U):U=e[47],e[48]===Symbol.for("react.memo_cache_sentinel")?(V=k.jsx(ju,{children:k.jsx(C,{content:k.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:k.jsx("span",{className:"text-muted-foreground text-sm mr-4",children:"kiosk mode"})})}),G=k.jsx(hN,{}),e[48]=V,e[49]=G):(V=e[48],G=e[49]),e[50]!==v||e[51]!==w||e[52]!==M||e[53]!==L||e[54]!==B?($=k.jsxs("footer",{className:"h-10 py-2 bg-background flex items-center text-muted-foreground text-md pl-1 pr-4 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:[v,w,M,T,L,z,B,U,V,G]}),e[50]=v,e[51]=w,e[52]=M,e[53]=L,e[54]=B,e[55]=$):$=e[55],$};function wN(e,t){const{Icon:n}=e;return k.jsx(n,{className:on("h-5 w-5",t)})}function kN(e){return"errors"===e.type}const NN=e=>{const t=b(6),{children:n}=e,{openModal:o,closeModal:r}=w();let a,s;return t[0]!==o||t[1]!==r?(a=()=>o(k.jsx(EN,{onClose:r})),t[0]=o,t[1]=r,t[2]=a):a=t[2],t[3]!==a||t[4]!==n?(s=k.jsx(as,{onClick:a,children:n}),t[3]=a,t[4]=n,t[5]=s):s=t[5],s},CN={"😡":1,"🙁":2,"😐":3,"🙂":4,"😍":5},EN=e=>{const t=b(13),{onClose:n}=e;let o,r,a,s,i,l,c,d;return t[0]!==n?(o=async e=>{e.preventDefault();const t=new FormData(e.target),o=t.get("rating"),r=t.get("message");fetch("https://marimo.io/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rating:o,message:r})}),n(),re({title:"Feedback sent!",description:"Thank you for your feedback!"})},t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=k.jsx(j,{children:"Send Feedback"}),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(a=k.jsxs(Ie,{children:[r,k.jsxs(_,{children:["Let us know what you think about marimo! If you have a bug that you would like to report, please use the"," ",k.jsx("a",{href:Ze.issuesPage,target:"_blank",rel:"noreferrer",className:"underline",children:"GitHub issue tracker"}),"."]}),k.jsx(_,{children:"Your feedback is anonymous and will help us improve marimo. Thank you!"})]}),t[3]=a):a=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(s=k.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[k.jsx("div",{className:"flex gap-5 justify-center",children:Object.entries(CN).map(SN)}),k.jsx(ss,{id:"message",name:"message",autoFocus:!0,placeholder:"Your feedback; if you'd like us to respond, please include your email!",rows:5,required:!0,autoComplete:"off"})]}),t[4]=s):s=t[4],t[5]!==n?(i=k.jsx(E,{"data-testid":"feedback-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),t[5]=n,t[6]=i):i=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(l=k.jsx(E,{"data-testid":"feedback-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),t[7]=l):l=t[7],t[8]!==i?(c=k.jsxs(I,{children:[i,l]}),t[8]=i,t[9]=c):c=t[9],t[10]!==o||t[11]!==c?(d=k.jsx(A,{className:"w-fit",children:k.jsxs("form",{onSubmit:o,children:[a,s,c]})}),t[10]=o,t[11]=c,t[12]=d):d=t[12],d};function SN(e){const[t,n]=e;return k.jsxs("label",{className:"flex flex-col items-center select-none",children:[k.jsx("input",{type:"radio",className:"peer hidden",name:"rating",value:n,"aria-label":t},t),k.jsx("span",{className:"text-4xl peer-checked:opacity-100 opacity-40 cursor-pointer",children:t})]},t)}const jN=()=>{const e=b(10),{selectedPanel:t}=Hd(),{openApplication:n}=Wd(),o=AN;let r,a,s,i,l,c;if(e[0]!==t||e[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",a=qd.filter(MN).map((e=>k.jsx(IN,{tooltip:e.tooltip,selected:t===e.type,onClick:()=>n(e.type),children:o(e)},e.type))),e[0]=t,e[1]=n,e[2]=r,e[3]=a}else r=e[2],a=e[3];return e[4]===Symbol.for("react.memo_cache_sentinel")?(s=k.jsx(NN,{children:k.jsx(IN,{tooltip:"Send feedback!",selected:!1,children:k.jsx(pc,{className:"h-5 w-5"})})}),i=k.jsx("div",{className:"flex-1"}),l=k.jsx(_N,{}),e[4]=s,e[5]=i,e[6]=l):(s=e[4],i=e[5],l=e[6]),e[7]!==r||e[8]!==a?(c=k.jsxs("div",{className:r,children:[a,s,i,l]}),e[7]=r,e[8]=a,e[9]=c):c=e[9],c},_N=()=>{const e=b(9),t=le(is);let n,o,r,a;return e[0]!==t?(n=t>0?k.jsxs("span",{children:[t," cell",t>1?"s":""," queued or running"]}):"No cells queued or running",e[0]=t,e[1]=n):n=e[1],e[2]!==t?(o=Array.from({length:t}).map(TN),e[2]=t,e[3]=o):o=e[3],e[4]!==o?(r=k.jsx("div",{className:"flex flex-col-reverse gap-[1px] overflow-hidden",children:o}),e[4]=o,e[5]=r):r=e[5],e[6]!==n||e[7]!==r?(a=k.jsx(C,{content:n,side:"right",delayDuration:200,children:r}),e[6]=n,e[7]=r,e[8]=a):a=e[8],a},IN=e=>{const t=b(17);let n,o,r,a,s;t[0]!==e?(({children:a,tooltip:s,selected:n,className:o,...r}=e),t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=a,t[5]=s):(n=t[1],o=t[2],r=t[3],a=t[4],s=t[5]);const i=!n&&"hover:bg-[var(--sage-3)]",l=n&&"bg-[var(--sage-4)]";let c,d,u;return t[6]!==i||t[7]!==l||t[8]!==o?(c=on("flex items-center p-2 text-sm mx-[1px] shadow-inset font-mono cursor-pointer rounded",i,l,o),t[6]=i,t[7]=l,t[8]=o,t[9]=c):c=t[9],t[10]!==c||t[11]!==r||t[12]!==a?(d=k.jsx("div",{className:c,...r,children:a}),t[10]=c,t[11]=r,t[12]=a,t[13]=d):d=t[13],t[14]!==s||t[15]!==d?(u=k.jsx(C,{content:s,side:"right",delayDuration:200,children:d}),t[14]=s,t[15]=d,t[16]=u):u=t[16],u};function AN(e,t){const{Icon:n}=e;return k.jsx(n,{className:on("h-5 w-5",t)})}function MN(e){return!e.hidden&&"sidebar"===e.position}function TN(e,t){return k.jsx("div",{className:"flex-shrink-0 h-1 w-2 bg-[var(--grass-6)] border border-[var(--grass-7)]"},t.toString())}it.record(it.tuple([it.number(),it.number()]));let ON=null;const DN=e=>{const t=b(12),{title:n,description:o,icon:r}=e;let a,s,i,l,c;return t[0]!==r?(a=r&&u.cloneElement(r,{className:"text-accent-foreground"}),t[0]=r,t[1]=a):a=t[1],t[2]!==n?(s=k.jsx("span",{className:"mt-1 text-accent-foreground",children:n}),t[2]=n,t[3]=s):s=t[3],t[4]!==a||t[5]!==s?(i=k.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[a,s]}),t[4]=a,t[5]=s,t[6]=i):i=t[6],t[7]!==o?(l=k.jsx("span",{className:"text-muted-foreground text-sm",children:o}),t[7]=o,t[8]=l):l=t[8],t[9]!==i||t[10]!==l?(c=k.jsxs("div",{className:"mx-6 my-6 flex flex-col gap-2",children:[i,l]}),t[9]=i,t[10]=l,t[11]=c):c=t[11],c},RN=()=>{const e=b(5),t=ls();if(0===t.length){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=k.jsx(DN,{title:"No errors!",icon:k.jsx(kc,{})}),e[0]=t):t=e[0],t}let n,o;return e[1]!==t?(n=t.map(PN),e[1]=t,e[2]=n):n=e[2],e[3]!==n?(o=k.jsx("div",{className:"flex flex-col overflow-auto",children:n}),e[3]=n,e[4]=o):o=e[4],o};function PN(e){return k.jsxs("div",{children:[k.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:k.jsx(cs,{cellId:e.cellId})}),k.jsx("div",{className:"px-2",children:k.jsx(ds,{errors:e.output.data},e.cellId)},e.cellId)]},e.cellId)}const FN=()=>{const e=b(6),{items:t}=le(us);let n,o;e[0]!==t?(o=Nl(t),e[0]=t,e[1]=o):o=e[1],n=o;const r=n,{activeHeaderId:a}=Cl(r);if(0===t.length){let t;return e[2]===Symbol.for("react.memo_cache_sentinel")?(t=k.jsx(DN,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:k.jsx(Mc,{})}),e[2]=t):t=e[2],t}let s;return e[3]!==t||e[4]!==a?(s=k.jsx(El,{items:t,activeHeaderId:a}),e[3]=t,e[4]=a,e[5]=s):s=e[5],s};function LN(e){if("string"==typeof e||"number"==typeof e)return""+e;let t="";if(Array.isArray(e))for(let n,o=0;o<e.length;o++)""!==(n=LN(e[o]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}const{useDebugValue:zN}=u,{useSyncExternalStoreWithSelector:BN}=hs,UN=e=>e;function VN(e,t=UN,n){const o=BN(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return zN(o),o}const GN=(e,t)=>{const n=ms(e),o=(e,o=t)=>VN(n,e,o);return Object.assign(o,n),o};function $N(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,o]of e)if(!Object.is(o,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}function HN(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,[(o=o.matrixTransform(t.getScreenCTM().inverse())).x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const WN={passive:!1},qN={capture:!0,passive:!1};function YN(e){e.stopImmediatePropagation()}function XN(e){e.preventDefault(),e.stopImmediatePropagation()}function KN(e){var t=e.document.documentElement,n=jl(e).on("dragstart.drag",XN,qN);"onselectstart"in t?n.on("selectstart.drag",XN,qN):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function JN(e,t){var n=e.document.documentElement,o=jl(e).on("dragstart.drag",null);t&&(o.on("click.drag",XN,qN),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 ZN=e=>()=>e;function QN(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:a,x:s,y:i,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,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:a,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:i,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}function eC(e){return!e.ctrlKey&&!e.button}function tC(){return this.parentNode}function nC(e,t){return null==t?{x:e.x,y:e.y}:t}function oC(){return navigator.maxTouchPoints||"ontouchstart"in this}QN.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};const rC=e=>()=>e;function aC(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function sC(e){e.stopImmediatePropagation()}function iC(e){e.preventDefault(),e.stopImmediatePropagation()}function lC(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function cC(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function dC(){return this.__zoom||_l}function uC(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function hC(){return navigator.maxTouchPoints||"ontouchstart"in this}function mC(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>a?(a+s)/2:Math.min(0,a)||Math.max(0,s))}const fC=r.createContext(null),pC=fC.Provider,gC=e=>`Node type "${e}" not found. Using fallback type "default".`,vC=()=>"The React Flow parent container needs a width and a height to render the graph.",xC=()=>"Only child nodes can use a parent extent.",yC=e=>`Marker type "${e}" doesn't exist.`,bC=(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,wC=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",kC=e=>`Edge type "${e}" not found. Using fallback type "default".`,NC=e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,CC=(()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001")();function EC(e,t){const n=r.useContext(fC);if(null===n)throw new Error(CC);return VN(n,e,t)}const SC=()=>{const e=r.useContext(fC);if(null===e)throw new Error(CC);return r.useMemo((()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy})),[e])},jC=e=>e.userSelectionActive?"none":"all";function _C({position:e,children:t,className:n,style:o,...r}){const a=EC(jC),s=`${e}`.split("-");return u.createElement("div",{className:LN(["react-flow__panel",n,...s]),style:{...o,pointerEvents:a},...r},t)}function IC({proOptions:e,position:t="bottom-right"}){return(null==e?void 0:e.hideAttribution)?null:u.createElement(_C,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},u.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var AC=r.memo((({x:e,y:t,label:n,labelStyle:o={},labelShowBg:a=!0,labelBgStyle:s={},labelBgPadding:i=[2,4],labelBgBorderRadius:l=2,children:c,className:d,...h})=>{const m=r.useRef(null),[f,p]=r.useState({x:0,y:0,width:0,height:0}),g=LN(["react-flow__edge-textwrapper",d]);return r.useEffect((()=>{if(m.current){const e=m.current.getBBox();p({x:e.x,y:e.y,width:e.width,height:e.height})}}),[n]),void 0!==n&&n?u.createElement("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:g,visibility:f.width?"visible":"hidden",...h},a&&u.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:l,ry:l}),u.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:m,style:o},n),c):null}));const MC=e=>({width:e.offsetWidth,height:e.offsetHeight}),TC=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),OC=(e={x:0,y:0},t)=>({x:TC(e.x,t[0][0],t[1][0]),y:TC(e.y,t[0][1],t[1][1])}),DC=(e,t,n)=>e<t?TC(Math.abs(e-t),1,50)/50:e>n?-TC(Math.abs(e-n),1,50)/50:0,RC=(e,t)=>[20*DC(e.x,35,t.width-35),20*DC(e.y,35,t.height-35)],PC=e=>{var t;return(null==(t=e.getRootNode)?void 0:t.call(e))||(null==window?void 0:window.document)},FC=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),LC=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),zC=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},BC=e=>!isNaN(e)&&isFinite(e),UC=Symbol.for("internals"),VC=["Enter"," ","Escape"];function GC(e){var t,n;const o=(e=>"nativeEvent"in e)(e)?e.nativeEvent:e,r=(null==(n=null==(t=o.composedPath)?void 0:t.call(o))?void 0:n[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(null==r?void 0:r.nodeName)||(null==r?void 0:r.hasAttribute("contenteditable"))||!!(null==r?void 0:r.closest(".nokey"))}const $C=e=>"clientX"in e,HC=(e,t)=>{var n,o;const r=$C(e),a=r?e.clientX:null==(n=e.touches)?void 0:n[0].clientX,s=r?e.clientY:null==(o=e.touches)?void 0:o[0].clientY;return{x:a-((null==t?void 0:t.left)??0),y:s-((null==t?void 0:t.top)??0)}},WC=()=>{var e;return"undefined"!=typeof navigator&&(null==(e=null==navigator?void 0:navigator.userAgent)?void 0:e.indexOf("Mac"))>=0},qC=({id:e,path:t,labelX:n,labelY:o,label:r,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:m,interactionWidth:f=20})=>u.createElement(u.Fragment,null,u.createElement("path",{id:e,style:d,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:h,markerStart:m}),f&&u.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}),r&&BC(n)&&BC(o)?u.createElement(AC,{x:n,y:o,label:r,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:c}):null);function YC(e,t,n){return void 0===n?n:o=>{const r=t().edges.find((t=>t.id===e));r&&n(o,{...r})}}function XC({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,a=n<e?n+r:n-r,s=Math.abs(o-t)/2;return[a,o<t?o+s:o-s,r,s]}function KC({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:a,targetControlX:s,targetControlY:i}){const l=.125*e+.375*r+.375*s+.125*n,c=.125*t+.375*a+.375*i+.125*o;return[l,c,Math.abs(l-e),Math.abs(c-t)]}var JC,ZC,QC,eE,tE,nE,oE,rE,aE,sE,iE,lE;function cE({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===iE.Left||e===iE.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function dE({sourceX:e,sourceY:t,sourcePosition:n=iE.Bottom,targetX:o,targetY:r,targetPosition:a=iE.Top}){const[s,i]=cE({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=cE({pos:a,x1:o,y1:r,x2:e,y2:t}),[d,u,h,m]=KC({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${i} ${l},${c} ${o},${r}`,d,u,h,m]}qC.displayName="BaseEdge",(ZC=JC||(JC={})).Strict="strict",ZC.Loose="loose",(eE=QC||(QC={})).Free="free",eE.Vertical="vertical",eE.Horizontal="horizontal",(nE=tE||(tE={})).Partial="partial",nE.Full="full",(rE=oE||(oE={})).Bezier="default",rE.Straight="straight",rE.Step="step",rE.SmoothStep="smoothstep",rE.SimpleBezier="simplebezier",(sE=aE||(aE={})).Arrow="arrow",sE.ArrowClosed="arrowclosed",(lE=iE||(iE={})).Left="left",lE.Top="top",lE.Right="right",lE.Bottom="bottom";const uE=r.memo((({sourceX:e,sourceY:t,targetX:n,targetY:o,sourcePosition:r=iE.Bottom,targetPosition:a=iE.Top,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:m,markerEnd:f,markerStart:p,interactionWidth:g})=>{const[v,x,y]=dE({sourceX:e,sourceY:t,sourcePosition:r,targetX:n,targetY:o,targetPosition:a});return u.createElement(qC,{path:v,labelX:x,labelY:y,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:m,markerEnd:f,markerStart:p,interactionWidth:g})}));uE.displayName="SimpleBezierEdge";const hE={[iE.Left]:{x:-1,y:0},[iE.Right]:{x:1,y:0},[iE.Top]:{x:0,y:-1},[iE.Bottom]:{x:0,y:1}},mE=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function fE({source:e,sourcePosition:t=iE.Bottom,target:n,targetPosition:o=iE.Top,center:r,offset:a}){const s=hE[t],i=hE[o],l={x:e.x+s.x*a,y:e.y+s.y*a},c={x:n.x+i.x*a,y:n.y+i.y*a},d=(({source:e,sourcePosition:t=iE.Bottom,target:n})=>t===iE.Left||t===iE.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1})({source:l,sourcePosition:t,target:c}),u=0!==d.x?"x":"y",h=d[u];let m,f,p=[];const g={x:0,y:0},v={x:0,y:0},[x,y,b,w]=XC({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[u]*i[u]==-1){m=r.x??x,f=r.y??y;const e=[{x:m,y:l.y},{x:m,y:c.y}],t=[{x:l.x,y:f},{x:c.x,y:f}];p=s[u]===h?"x"===u?e:t:"x"===u?t:e}else{const r=[{x:l.x,y:c.y}],d=[{x:c.x,y:l.y}];if(p="x"===u?s.x===h?d:r:s.y===h?r:d,t===o){const t=Math.abs(e[u]-n[u]);if(t<=a){const o=Math.min(a-1,a-t);s[u]===h?g[u]=(l[u]>e[u]?-1:1)*o:v[u]=(c[u]>n[u]?-1:1)*o}}if(t!==o){const e="x"===u?"y":"x",t=s[u]===i[e],n=l[e]>c[e],o=l[e]<c[e];(1===s[u]&&(!t&&n||t&&o)||1!==s[u]&&(!t&&o||t&&n))&&(p="x"===u?r:d)}const x={x:l.x+g.x,y:l.y+g.y},y={x:c.x+v.x,y:c.y+v.y};Math.max(Math.abs(x.x-p[0].x),Math.abs(y.x-p[0].x))>=Math.max(Math.abs(x.y-p[0].y),Math.abs(y.y-p[0].y))?(m=(x.x+y.x)/2,f=p[0].y):(m=p[0].x,f=(x.y+y.y)/2)}return[[e,{x:l.x+g.x,y:l.y+g.y},...p,{x:c.x+v.x,y:c.y+v.y},n],m,f,b,w]}function pE({sourceX:e,sourceY:t,sourcePosition:n=iE.Bottom,targetX:o,targetY:r,targetPosition:a=iE.Top,borderRadius:s=5,centerX:i,centerY:l,offset:c=20}){const[d,u,h,m,f]=fE({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:a,center:{x:i,y:l},offset:c});return[d.reduce(((e,t,n)=>{let o="";return o=n>0&&n<d.length-1?function(e,t,n,o){const r=Math.min(mE(e,t)/2,mE(t,n)/2,o),{x:a,y:s}=t;if(e.x===a&&a===n.x||e.y===s&&s===n.y)return`L${a} ${s}`;if(e.y===s)return`L ${a+r*(e.x<n.x?-1:1)},${s}Q ${a},${s} ${a},${s+r*(e.y<n.y?1:-1)}`;const i=e.x<n.x?1:-1;return`L ${a},${s+r*(e.y<n.y?-1:1)}Q ${a},${s} ${a+r*i},${s}`}(d[n-1],t,d[n+1],s):`${0===n?"M":"L"}${t.x} ${t.y}`,e+=o}),""),u,h,m,f]}const gE=r.memo((({sourceX:e,sourceY:t,targetX:n,targetY:o,label:r,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:c,style:d,sourcePosition:h=iE.Bottom,targetPosition:m=iE.Top,markerEnd:f,markerStart:p,pathOptions:g,interactionWidth:v})=>{const[x,y,b]=pE({sourceX:e,sourceY:t,sourcePosition:h,targetX:n,targetY:o,targetPosition:m,borderRadius:null==g?void 0:g.borderRadius,offset:null==g?void 0:g.offset});return u.createElement(qC,{path:x,labelX:y,labelY:b,label:r,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:f,markerStart:p,interactionWidth:v})}));gE.displayName="SmoothStepEdge";const vE=r.memo((e=>{var t;return u.createElement(gE,{...e,pathOptions:r.useMemo((()=>{var t;return{borderRadius:0,offset:null==(t=e.pathOptions)?void 0:t.offset}}),[null==(t=e.pathOptions)?void 0:t.offset])})}));vE.displayName="StepEdge";const xE=r.memo((({sourceX:e,sourceY:t,targetX:n,targetY:o,label:r,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:m,interactionWidth:f})=>{const[p,g,v]=function({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,a,s,i]=XC({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,a,s,i]}({sourceX:e,sourceY:t,targetX:n,targetY:o});return u.createElement(qC,{path:p,labelX:g,labelY:v,label:r,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:m,interactionWidth:f})}));function yE(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function bE({pos:e,x1:t,y1:n,x2:o,y2:r,c:a}){switch(e){case iE.Left:return[t-yE(t-o,a),n];case iE.Right:return[t+yE(o-t,a),n];case iE.Top:return[t,n-yE(n-r,a)];case iE.Bottom:return[t,n+yE(r-n,a)]}}function wE({sourceX:e,sourceY:t,sourcePosition:n=iE.Bottom,targetX:o,targetY:r,targetPosition:a=iE.Top,curvature:s=.25}){const[i,l]=bE({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,d]=bE({pos:a,x1:o,y1:r,x2:e,y2:t,c:s}),[u,h,m,f]=KC({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:i,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${e},${t} C${i},${l} ${c},${d} ${o},${r}`,u,h,m,f]}xE.displayName="StraightEdge";const kE=r.memo((({sourceX:e,sourceY:t,targetX:n,targetY:o,sourcePosition:r=iE.Bottom,targetPosition:a=iE.Top,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:m,markerEnd:f,markerStart:p,pathOptions:g,interactionWidth:v})=>{const[x,y,b]=wE({sourceX:e,sourceY:t,sourcePosition:r,targetX:n,targetY:o,targetPosition:a,curvature:null==g?void 0:g.curvature});return u.createElement(qC,{path:x,labelX:y,labelY:b,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:m,markerEnd:f,markerStart:p,interactionWidth:v})}));kE.displayName="BezierEdge";const NE=r.createContext(null),CE=NE.Provider;NE.Consumer;const EE=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`reactflow__edge-${e}${t||""}-${n}${o||""}`,SE=(e,t)=>{if(void 0===e)return"";if("string"==typeof e)return e;return`${t?`${t}__`:""}${Object.keys(e).sort().map((t=>`${t}=${e[t]}`)).join("&")}`},jE=({x:e,y:t},[n,o,r],a,[s,i])=>{const l={x:(e-n)/r,y:(t-o)/r};return a?{x:s*Math.round(l.x/s),y:i*Math.round(l.y/i)}:l},_E=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o}),IE=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],o=(e.height??0)*t[1],r={x:e.position.x-n,y:e.position.y-o};return{...r,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-o}:r}},AE=(e,t=[0,0])=>{if(0===e.length)return{x:0,y:0,width:0,height:0};return(({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}))(e.reduce(((e,n)=>{const{x:o,y:r}=IE(n,t).positionAbsolute;return a=e,s=FC({x:o,y:r,width:n.width||0,height:n.height||0}),{x:Math.min(a.x,s.x),y:Math.min(a.y,s.y),x2:Math.max(a.x2,s.x2),y2:Math.max(a.y2,s.y2)};var a,s}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0}))},ME=(e,t,[n,o,r]=[0,0,1],a=!1,s=!1,i=[0,0])=>{const l={x:(t.x-n)/r,y:(t.y-o)/r,width:t.width/r,height:t.height/r},c=[];return e.forEach((e=>{const{width:t,height:n,selectable:o=!0,hidden:r=!1}=e;if(s&&!o||r)return!1;const{positionAbsolute:d}=IE(e,i),u={x:d.x,y:d.y,width:t||0,height:n||0},h=zC(l,u);(void 0===t||void 0===n||null===t||null===n||a&&h>0||h>=(t||0)*(n||0)||e.dragging)&&c.push(e)})),c},TE=(e,t)=>{const n=e.map((e=>e.id));return t.filter((e=>n.includes(e.source)||n.includes(e.target)))},OE=(e,t,n,o,r,a=.1)=>{const s=t/(e.width*(1+a)),i=n/(e.height*(1+a)),l=Math.min(s,i),c=TC(l,o,r);return{x:t/2-(e.x+e.width/2)*c,y:n/2-(e.y+e.height/2)*c,zoom:c}},DE=(e,t=0)=>e.transition().duration(t);function RE(e,t,n,o){return(t[n]||[]).reduce(((t,r)=>{var a,s;return`${e.id}-${r.id}-${n}`!==o&&t.push({id:r.id||null,type:n,nodeId:e.id,x:((null==(a=e.positionAbsolute)?void 0:a.x)??0)+r.x+r.width/2,y:((null==(s=e.positionAbsolute)?void 0:s.y)??0)+r.y+r.height/2}),t}),[])}const PE={source:null,target:null,sourceHandle:null,targetHandle:null},FE=()=>({handleDomNode:null,isValid:!1,connection:PE,endHandle:null});function LE(e,t,n,o,r,a,s){const i="target"===r,l=s.querySelector(`.react-flow__handle[data-id="${null==e?void 0:e.nodeId}-${null==e?void 0:e.id}-${null==e?void 0:e.type}"]`),c={...FE(),handleDomNode:l};if(l){const e=zE(void 0,l),r=l.getAttribute("data-nodeid"),s=l.getAttribute("data-handleid"),d=l.classList.contains("connectable"),u=l.classList.contains("connectableend"),h={source:i?r:n,sourceHandle:i?s:o,target:i?n:r,targetHandle:i?o:s};c.connection=h;d&&u&&(t===JC.Strict?i&&"source"===e||!i&&"target"===e:r!==n||s!==o)&&(c.endHandle={nodeId:r,handleId:s,type:e},c.isValid=a(h))}return c}function zE(e,t){return e||((null==t?void 0:t.classList.contains("target"))?"target":(null==t?void 0:t.classList.contains("source"))?"source":null)}function BE(e){null==e||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function UE(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function VE({event:e,handleId:t,nodeId:n,onConnect:o,isTarget:r,getState:a,setState:s,isValidConnection:i,edgeUpdaterType:l,onReconnectEnd:c}){const d=PC(e.target),{connectionMode:u,domNode:h,autoPanOnConnect:m,connectionRadius:f,onConnectStart:p,panBy:g,getNodes:v,cancelConnection:x}=a();let y,b=0;const{x:w,y:k}=HC(e),N=null==d?void 0:d.elementFromPoint(w,k),C=zE(l,N),E=null==h?void 0:h.getBoundingClientRect();if(!E||!C)return;let S,j=HC(e,E),_=!1,I=null,A=!1,M=null;const T=function({nodes:e,nodeId:t,handleId:n,handleType:o}){return e.reduce(((e,r)=>{if(r[UC]){const{handleBounds:a}=r[UC];let s=[],i=[];a&&(s=RE(r,a,"source",`${t}-${n}-${o}`),i=RE(r,a,"target",`${t}-${n}-${o}`)),e.push(...s,...i)}return e}),[])}({nodes:v(),nodeId:n,handleId:t,handleType:C}),O=()=>{if(!m)return;const[e,t]=RC(j,E);g({x:e,y:t}),b=requestAnimationFrame(O)};function D(e){const{transform:o}=a();j=HC(e,E);const{handle:l,validHandleResult:c}=function(e,t,n,o,r,a){const{x:s,y:i}=HC(e),l=t.elementsFromPoint(s,i).find((e=>e.classList.contains("react-flow__handle")));if(l){const e=l.getAttribute("data-nodeid");if(e){const t=zE(void 0,l),o=l.getAttribute("data-handleid"),s=a({nodeId:e,id:o,type:t});if(s){const a=r.find((n=>n.nodeId===e&&n.type===t&&n.id===o));return{handle:{id:o,type:t,nodeId:e,x:(null==a?void 0:a.x)||n.x,y:(null==a?void 0:a.y)||n.y},validHandleResult:s}}}}let c=[],d=1/0;if(r.forEach((e=>{const t=Math.sqrt((e.x-n.x)**2+(e.y-n.y)**2);if(t<=o){const n=a(e);t<=d&&(t<d?c=[{handle:e,validHandleResult:n}]:t===d&&c.push({handle:e,validHandleResult:n}),d=t)}})),!c.length)return{handle:null,validHandleResult:FE()};if(1===c.length)return c[0];const u=c.some((({validHandleResult:e})=>e.isValid)),h=c.some((({handle:e})=>"target"===e.type));return c.find((({handle:e,validHandleResult:t})=>h?"target"===e.type:!u||t.isValid))||c[0]}(e,d,jE(j,o,!1,[1,1]),f,T,(e=>LE(e,u,n,t,r?"target":"source",i,d)));if(y=l,_||(O(),_=!0),M=c.handleDomNode,I=c.connection,A=c.isValid,s({connectionPosition:y&&A?_E({x:y.x,y:y.y},o):j,connectionStatus:UE(!!y,A),connectionEndHandle:c.endHandle}),!y&&!A&&!M)return BE(S);I.source!==I.target&&M&&(BE(S),S=M,M.classList.add("connecting","react-flow__handle-connecting"),M.classList.toggle("valid",A),M.classList.toggle("react-flow__handle-valid",A))}function R(e){var t,n;(y||M)&&I&&A&&(null==o||o(I)),null==(n=(t=a()).onConnectEnd)||n.call(t,e),l&&(null==c||c(e)),BE(S),x(),cancelAnimationFrame(b),_=!1,A=!1,I=null,M=null,d.removeEventListener("mousemove",D),d.removeEventListener("mouseup",R),d.removeEventListener("touchmove",D),d.removeEventListener("touchend",R)}s({connectionPosition:j,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:C,connectionStartHandle:{nodeId:n,handleId:t,type:C},connectionEndHandle:null}),null==p||p(e,{nodeId:n,handleId:t,handleType:C}),d.addEventListener("mousemove",D),d.addEventListener("mouseup",R),d.addEventListener("touchmove",D),d.addEventListener("touchend",R)}const GE=()=>!0,$E=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),HE=r.forwardRef((({type:e="source",position:t=iE.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:a=!0,isConnectableEnd:s=!0,id:i,onConnect:l,children:c,className:d,onMouseDown:h,onTouchStart:m,...f},p)=>{var g,v;const x=i||null,y="target"===e,b=SC(),w=r.useContext(NE),{connectOnClick:k,noPanClassName:N}=EC($E,$N),{connecting:C,clickConnecting:E}=EC(((e,t,n)=>o=>{const{connectionStartHandle:r,connectionEndHandle:a,connectionClickStartHandle:s}=o;return{connecting:(null==r?void 0:r.nodeId)===e&&(null==r?void 0:r.handleId)===t&&(null==r?void 0:r.type)===n||(null==a?void 0:a.nodeId)===e&&(null==a?void 0:a.handleId)===t&&(null==a?void 0:a.type)===n,clickConnecting:(null==s?void 0:s.nodeId)===e&&(null==s?void 0:s.handleId)===t&&(null==s?void 0:s.type)===n}})(w,x,e),$N);w||null==(v=(g=b.getState()).onError)||v.call(g,"010",wC());const S=e=>{const{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:o}=b.getState(),r={...t,...e};if(o){const{edges:e,setEdges:t}=b.getState();t(((e,t)=>{if(!e.source||!e.target)return t;let n;var o;return n="id"in(o=e)&&"source"in o&&"target"in o?{...e}:{...e,id:EE(e)},((e,t)=>t.some((t=>!(t.source!==e.source||t.target!==e.target||t.sourceHandle!==e.sourceHandle&&(t.sourceHandle||e.sourceHandle)||t.targetHandle!==e.targetHandle&&(t.targetHandle||e.targetHandle)))))(n,t)?t:t.concat(n)})(r,e))}null==n||n(r),null==l||l(r)},j=e=>{if(!w)return;const t=$C(e);a&&(t&&0===e.button||!t)&&VE({event:e,handleId:x,nodeId:w,onConnect:S,isTarget:y,getState:b.getState,setState:b.setState,isValidConnection:n||b.getState().isValidConnection||GE}),t?null==h||h(e):null==m||m(e)};return u.createElement("div",{"data-handleid":x,"data-nodeid":w,"data-handlepos":t,"data-id":`${w}-${x}-${e}`,className:LN(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",N,d,{source:!y,target:y,connectable:o,connectablestart:a,connectableend:s,connecting:E,connectionindicator:o&&(a&&!C||s&&C)}]),onMouseDown:j,onTouchStart:j,onClick:k?t=>{const{onClickConnectStart:o,onClickConnectEnd:r,connectionClickStartHandle:s,connectionMode:i,isValidConnection:l}=b.getState();if(!w||!s&&!a)return;if(!s)return null==o||o(t,{nodeId:w,handleId:x,handleType:e}),void b.setState({connectionClickStartHandle:{nodeId:w,type:e,handleId:x}});const c=PC(t.target),d=n||l||GE,{connection:u,isValid:h}=LE({nodeId:w,id:x,type:e},i,s.nodeId,s.handleId||null,s.type,d,c);h&&S(u),null==r||r(t),b.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f},c)}));HE.displayName="Handle";var WE=r.memo(HE);const qE=({data:e,isConnectable:t,targetPosition:n=iE.Top,sourcePosition:o=iE.Bottom})=>u.createElement(u.Fragment,null,u.createElement(WE,{type:"target",position:n,isConnectable:t}),null==e?void 0:e.label,u.createElement(WE,{type:"source",position:o,isConnectable:t}));qE.displayName="DefaultNode";var YE=r.memo(qE);const XE=({data:e,isConnectable:t,sourcePosition:n=iE.Bottom})=>u.createElement(u.Fragment,null,null==e?void 0:e.label,u.createElement(WE,{type:"source",position:n,isConnectable:t}));XE.displayName="InputNode";var KE=r.memo(XE);const JE=({data:e,isConnectable:t,targetPosition:n=iE.Top})=>u.createElement(u.Fragment,null,u.createElement(WE,{type:"target",position:n,isConnectable:t}),null==e?void 0:e.label);JE.displayName="OutputNode";var ZE=r.memo(JE);const QE=()=>null;QE.displayName="GroupNode";const eS=e=>({selectedNodes:e.getNodes().filter((e=>e.selected)),selectedEdges:e.edges.filter((e=>e.selected)).map((e=>({...e})))}),tS=e=>e.id;function nS(e,t){return $N(e.selectedNodes.map(tS),t.selectedNodes.map(tS))&&$N(e.selectedEdges.map(tS),t.selectedEdges.map(tS))}const oS=r.memo((({onSelectionChange:e})=>{const t=SC(),{selectedNodes:n,selectedEdges:o}=EC(eS,nS);return r.useEffect((()=>{const r={nodes:n,edges:o};null==e||e(r),t.getState().onSelectionChange.forEach((e=>e(r)))}),[n,o,e]),null}));oS.displayName="SelectionListener";const rS=e=>!!e.onSelectionChange;function aS({onSelectionChange:e}){const t=EC(rS);return e||t?u.createElement(oS,{onSelectionChange:e}):null}const sS=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function iS(e,t){r.useEffect((()=>{void 0!==e&&t(e)}),[e])}function lS(e,t,n){r.useEffect((()=>{void 0!==t&&n({[e]:t})}),[t])}const cS=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:a,onConnectStart:s,onConnectEnd:i,onClickConnectStart:l,onClickConnectEnd:c,nodesDraggable:d,nodesConnectable:u,nodesFocusable:h,edgesFocusable:m,edgesUpdatable:f,elevateNodesOnSelect:p,minZoom:g,maxZoom:v,nodeExtent:x,onNodesChange:y,onEdgesChange:b,elementsSelectable:w,connectionMode:k,snapGrid:N,snapToGrid:C,translateExtent:E,connectOnClick:S,defaultEdgeOptions:j,fitView:_,fitViewOptions:I,onNodesDelete:A,onEdgesDelete:M,onNodeDrag:T,onNodeDragStart:O,onNodeDragStop:D,onSelectionDrag:R,onSelectionDragStart:P,onSelectionDragStop:F,noPanClassName:L,nodeOrigin:z,rfId:B,autoPanOnConnect:U,autoPanOnNodeDrag:V,onError:G,connectionRadius:$,isValidConnection:H,nodeDragThreshold:W})=>{const{setNodes:q,setEdges:Y,setDefaultNodesAndEdges:X,setMinZoom:K,setMaxZoom:J,setTranslateExtent:Z,setNodeExtent:Q,reset:ee}=EC(sS,$N),te=SC();return r.useEffect((()=>{const e=null==o?void 0:o.map((e=>({...e,...j})));return X(n,e),()=>{ee()}}),[]),lS("defaultEdgeOptions",j,te.setState),lS("connectionMode",k,te.setState),lS("onConnect",a,te.setState),lS("onConnectStart",s,te.setState),lS("onConnectEnd",i,te.setState),lS("onClickConnectStart",l,te.setState),lS("onClickConnectEnd",c,te.setState),lS("nodesDraggable",d,te.setState),lS("nodesConnectable",u,te.setState),lS("nodesFocusable",h,te.setState),lS("edgesFocusable",m,te.setState),lS("edgesUpdatable",f,te.setState),lS("elementsSelectable",w,te.setState),lS("elevateNodesOnSelect",p,te.setState),lS("snapToGrid",C,te.setState),lS("snapGrid",N,te.setState),lS("onNodesChange",y,te.setState),lS("onEdgesChange",b,te.setState),lS("connectOnClick",S,te.setState),lS("fitViewOnInit",_,te.setState),lS("fitViewOnInitOptions",I,te.setState),lS("onNodesDelete",A,te.setState),lS("onEdgesDelete",M,te.setState),lS("onNodeDrag",T,te.setState),lS("onNodeDragStart",O,te.setState),lS("onNodeDragStop",D,te.setState),lS("onSelectionDrag",R,te.setState),lS("onSelectionDragStart",P,te.setState),lS("onSelectionDragStop",F,te.setState),lS("noPanClassName",L,te.setState),lS("nodeOrigin",z,te.setState),lS("rfId",B,te.setState),lS("autoPanOnConnect",U,te.setState),lS("autoPanOnNodeDrag",V,te.setState),lS("onError",G,te.setState),lS("connectionRadius",$,te.setState),lS("isValidConnection",H,te.setState),lS("nodeDragThreshold",W,te.setState),iS(e,q),iS(t,Y),iS(g,K),iS(v,J),iS(E,Z),iS(x,Q),null},dS={display:"none"},uS={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},hS="react-flow__node-desc",mS="react-flow__edge-desc",fS=e=>e.ariaLiveMessage;function pS({rfId:e}){const t=EC(fS);return u.createElement("div",{id:`react-flow__aria-live-${e}`,"aria-live":"assertive","aria-atomic":"true",style:uS},t)}function gS({rfId:e,disableKeyboardA11y:t}){return u.createElement(u.Fragment,null,u.createElement("div",{id:`${hS}-${e}`,style:dS},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),u.createElement("div",{id:`${mS}-${e}`,style:dS},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&u.createElement(pS,{rfId:e}))}var vS=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,o]=r.useState(!1),a=r.useRef(!1),s=r.useRef(new Set([])),[i,l]=r.useMemo((()=>{if(null!==e){const t=(Array.isArray(e)?e:[e]).filter((e=>"string"==typeof e)).map((e=>e.split("+"))),n=t.reduce(((e,t)=>e.concat(...t)),[]);return[t,n]}return[[],[]]}),[e]);return r.useEffect((()=>{const n="undefined"!=typeof document?document:null,r=(null==t?void 0:t.target)||n;if(null!==e){const e=e=>{a.current=e.ctrlKey||e.metaKey||e.shiftKey;if((!a.current||a.current&&!t.actInsideInputWithModifier)&&GC(e))return!1;const n=yS(e.code,l);s.current.add(e[n]),xS(i,s.current,!1)&&(e.preventDefault(),o(!0))},n=e=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&GC(e))return!1;const n=yS(e.code,l);xS(i,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(e[n]),"Meta"===e.key&&s.current.clear(),a.current=!1},c=()=>{s.current.clear(),o(!1)};return null==r||r.addEventListener("keydown",e),null==r||r.addEventListener("keyup",n),window.addEventListener("blur",c),()=>{null==r||r.removeEventListener("keydown",e),null==r||r.removeEventListener("keyup",n),window.removeEventListener("blur",c)}}}),[e,o]),n};function xS(e,t,n){return e.filter((e=>n||e.length===t.size)).some((e=>e.every((e=>t.has(e)))))}function yS(e,t){return t.includes(e)?"code":"key"}function bS(e,t,n,o){var r,a;const s=e.parentNode||e.parentId;if(!s)return n;const i=t.get(s),l=IE(i,o);return bS(i,t,{x:(n.x??0)+l.x,y:(n.y??0)+l.y,z:((null==(r=i[UC])?void 0:r.z)??0)>(n.z??0)?(null==(a=i[UC])?void 0:a.z)??0:n.z??0},o)}function wS(e,t,n){e.forEach((o=>{var r;const a=o.parentNode||o.parentId;if(a&&!e.has(a))throw new Error(`Parent node ${a} not found`);if(a||(null==n?void 0:n[o.id])){const{x:a,y:s,z:i}=bS(o,e,{...o.position,z:(null==(r=o[UC])?void 0:r.z)??0},t);o.positionAbsolute={x:a,y:s},o[UC].z=i,(null==n?void 0:n[o.id])&&(o[UC].isParent=!0)}}))}function kS(e,t,n,o){const r=new Map,a={},s=o?1e3:0;return e.forEach((e=>{var n;const o=(BC(e.zIndex)?e.zIndex:0)+(e.selected?s:0),i=t.get(e.id),l={...e,positionAbsolute:{x:e.position.x,y:e.position.y}},c=e.parentNode||e.parentId;c&&(a[c]=!0);const d=(null==i?void 0:i.type)&&(null==i?void 0:i.type)!==e.type;Object.defineProperty(l,UC,{enumerable:!1,value:{handleBounds:d||null==(n=null==i?void 0:i[UC])?void 0:n.handleBounds,z:o}}),r.set(e.id,l)})),wS(r,n,a),r}function NS(e,t={}){const{getNodes:n,width:o,height:r,minZoom:a,maxZoom:s,d3Zoom:i,d3Selection:l,fitViewOnInitDone:c,fitViewOnInit:d,nodeOrigin:u}=e(),h=t.initial&&!c&&d;if(i&&l&&(h||!t.initial)){const e=n().filter((e=>{var n;const o=t.includeHiddenNodes?e.width&&e.height:!e.hidden;return(null==(n=t.nodes)?void 0:n.length)?o&&t.nodes.some((t=>t.id===e.id)):o})),c=e.every((e=>e.width&&e.height));if(e.length>0&&c){const n=AE(e,u),{x:c,y:d,zoom:h}=OE(n,o,r,t.minZoom??a,t.maxZoom??s,t.padding??.1),m=_l.translate(c,d).scale(h);return"number"==typeof t.duration&&t.duration>0?i.transform(DE(l,t.duration),m):i.transform(l,m),!0}}return!1}function CS(e,t){return e.forEach((e=>{const n=t.get(e.id);n&&t.set(n.id,{...n,[UC]:n[UC],selected:e.selected})})),new Map(t)}function ES(e,t){return t.map((t=>{const n=e.find((e=>e.id===t.id));return n&&(t.selected=n.selected),t}))}function SS({changedNodes:e,changedEdges:t,get:n,set:o}){const{nodeInternals:r,edges:a,onNodesChange:s,onEdgesChange:i,hasDefaultNodes:l,hasDefaultEdges:c}=n();(null==e?void 0:e.length)&&(l&&o({nodeInternals:CS(e,r)}),null==s||s(e)),(null==t?void 0:t.length)&&(c&&o({edges:ES(t,a)}),null==i||i(t))}const jS=()=>{},_S={zoomIn:jS,zoomOut:jS,zoomTo:jS,getZoom:()=>1,setViewport:jS,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:jS,fitBounds:jS,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},IS=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection});function AS(){const e=(()=>{const e=SC(),{d3Zoom:t,d3Selection:n}=EC(IS,$N);return r.useMemo((()=>n&&t?{zoomIn:e=>t.scaleBy(DE(n,null==e?void 0:e.duration),1.2),zoomOut:e=>t.scaleBy(DE(n,null==e?void 0:e.duration),1/1.2),zoomTo:(e,o)=>t.scaleTo(DE(n,null==o?void 0:o.duration),e),getZoom:()=>e.getState().transform[2],setViewport:(o,r)=>{const[a,s,i]=e.getState().transform,l=_l.translate(o.x??a,o.y??s).scale(o.zoom??i);t.transform(DE(n,null==r?void 0:r.duration),l)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},fitView:t=>NS(e.getState,t),setCenter:(o,r,a)=>{const{width:s,height:i,maxZoom:l}=e.getState(),c=void 0!==(null==a?void 0:a.zoom)?a.zoom:l,d=s/2-o*c,u=i/2-r*c,h=_l.translate(d,u).scale(c);t.transform(DE(n,null==a?void 0:a.duration),h)},fitBounds:(o,r)=>{const{width:a,height:s,minZoom:i,maxZoom:l}=e.getState(),{x:c,y:d,zoom:u}=OE(o,a,s,i,l,(null==r?void 0:r.padding)??.1),h=_l.translate(c,d).scale(u);t.transform(DE(n,null==r?void 0:r.duration),h)},project:t=>{const{transform:n,snapToGrid:o,snapGrid:r}=e.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"),jE(t,n,o,r)},screenToFlowPosition:t=>{const{transform:n,snapToGrid:o,snapGrid:r,domNode:a}=e.getState();if(!a)return t;const{x:s,y:i}=a.getBoundingClientRect(),l={x:t.x-s,y:t.y-i};return jE(l,n,o,r)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:a}=o.getBoundingClientRect(),s=_E(t,n);return{x:s.x+r,y:s.y+a}},viewportInitialized:!0}:_S),[t,n])})(),t=SC(),n=r.useCallback((()=>t.getState().getNodes().map((e=>({...e})))),[]),o=r.useCallback((e=>t.getState().nodeInternals.get(e)),[]),a=r.useCallback((()=>{const{edges:e=[]}=t.getState();return e.map((e=>({...e})))}),[]),s=r.useCallback((e=>{const{edges:n=[]}=t.getState();return n.find((t=>t.id===e))}),[]),i=r.useCallback((e=>{const{getNodes:n,setNodes:o,hasDefaultNodes:r,onNodesChange:a}=t.getState(),s=n(),i="function"==typeof e?e(s):e;if(r)o(i);else if(a){a(0===i.length?s.map((e=>({type:"remove",id:e.id}))):i.map((e=>({item:e,type:"reset"}))))}}),[]),l=r.useCallback((e=>{const{edges:n=[],setEdges:o,hasDefaultEdges:r,onEdgesChange:a}=t.getState(),s="function"==typeof e?e(n):e;if(r)o(s);else if(a){a(0===s.length?n.map((e=>({type:"remove",id:e.id}))):s.map((e=>({item:e,type:"reset"}))))}}),[]),c=r.useCallback((e=>{const n=Array.isArray(e)?e:[e],{getNodes:o,setNodes:r,hasDefaultNodes:a,onNodesChange:s}=t.getState();if(a){r([...o(),...n])}else if(s){s(n.map((e=>({item:e,type:"add"}))))}}),[]),d=r.useCallback((e=>{const n=Array.isArray(e)?e:[e],{edges:o=[],setEdges:r,hasDefaultEdges:a,onEdgesChange:s}=t.getState();if(a)r([...o,...n]);else if(s){s(n.map((e=>({item:e,type:"add"}))))}}),[]),u=r.useCallback((()=>{const{getNodes:e,edges:n=[],transform:o}=t.getState(),[r,a,s]=o;return{nodes:e().map((e=>({...e}))),edges:n.map((e=>({...e}))),viewport:{x:r,y:a,zoom:s}}}),[]),h=r.useCallback((({nodes:e,edges:n})=>{const{nodeInternals:o,getNodes:r,edges:a,hasDefaultNodes:s,hasDefaultEdges:i,onNodesDelete:l,onEdgesDelete:c,onNodesChange:d,onEdgesChange:u}=t.getState(),h=(e||[]).map((e=>e.id)),m=(n||[]).map((e=>e.id)),f=r().reduce(((e,t)=>{const n=t.parentNode||t.parentId,o=!h.includes(t.id)&&n&&e.find((e=>e.id===n));return("boolean"!=typeof t.deletable||t.deletable)&&(h.includes(t.id)||o)&&e.push(t),e}),[]),p=a.filter((e=>"boolean"!=typeof e.deletable||e.deletable)),g=p.filter((e=>m.includes(e.id)));if(f||g){const e=TE(f,p),n=[...g,...e],r=n.reduce(((e,t)=>(e.includes(t.id)||e.push(t.id),e)),[]);if((i||s)&&(i&&t.setState({edges:a.filter((e=>!r.includes(e.id)))}),s&&(f.forEach((e=>{o.delete(e.id)})),t.setState({nodeInternals:new Map(o)}))),r.length>0&&(null==c||c(n),u&&u(r.map((e=>({id:e,type:"remove"}))))),f.length>0&&(null==l||l(f),d)){d(f.map((e=>({id:e.id,type:"remove"}))))}}}),[]),m=r.useCallback((e=>{const n=BC((o=e).width)&&BC(o.height)&&BC(o.x)&&BC(o.y);var o;const r=n?null:t.getState().nodeInternals.get(e.id);if(!n&&!r)return[null,null,n];return[n?e:LC(r),r,n]}),[]),f=r.useCallback(((e,n=!0,o)=>{const[r,a,s]=m(e);return r?(o||t.getState().getNodes()).filter((e=>{if(!(s||e.id!==a.id&&e.positionAbsolute))return!1;const t=LC(e),o=zC(t,r);return n&&o>0||o>=r.width*r.height})):[]}),[]),p=r.useCallback(((e,t,n=!0)=>{const[o]=m(e);if(!o)return!1;const r=zC(o,t);return n&&r>0||r>=o.width*o.height}),[]);return r.useMemo((()=>({...e,getNodes:n,getNode:o,getEdges:a,getEdge:s,setNodes:i,setEdges:l,addNodes:c,addEdges:d,toObject:u,deleteElements:h,getIntersectingNodes:f,isNodeIntersecting:p})),[e,n,o,a,s,i,l,c,d,u,h,f,p])}const MS={actInsideInputWithModifier:!1};const TS={position:"absolute",width:"100%",height:"100%",top:0,left:0},OS=e=>({x:e.x,y:e.y,zoom:e.k}),DS=(e,t)=>e.target.closest(`.${t}`),RS=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),PS=e=>{const t=e.ctrlKey&&WC()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t},FS=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),LS=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:a=!0,zoomOnPinch:s=!0,panOnScroll:i=!1,panOnScrollSpeed:l=.5,panOnScrollMode:c=QC.Free,zoomOnDoubleClick:d=!0,elementsSelectable:h,panOnDrag:m=!0,defaultViewport:f,translateExtent:p,minZoom:g,maxZoom:v,zoomActivationKeyCode:x,preventScrolling:y=!0,children:b,noWheelClassName:w,noPanClassName:k})=>{const N=r.useRef(),C=SC(),E=r.useRef(!1),S=r.useRef(!1),j=r.useRef(null),_=r.useRef({x:0,y:0,zoom:0}),{d3Zoom:I,d3Selection:A,d3ZoomHandler:M,userSelectionActive:T}=EC(FS,$N),O=vS(x),D=r.useRef(0),R=r.useRef(!1),P=r.useRef();return function(e){const t=SC();r.useEffect((()=>{let n;const o=()=>{var n,o;if(!e.current)return;const r=MC(e.current);0!==r.height&&0!==r.width||null==(o=(n=t.getState()).onError)||o.call(n,"004",vC()),t.setState({width:r.width||500,height:r.height||500})};return o(),window.addEventListener("resize",o),e.current&&(n=new ResizeObserver((()=>o())),n.observe(e.current)),()=>{window.removeEventListener("resize",o),n&&e.current&&n.unobserve(e.current)}}),[])}(j),r.useEffect((()=>{if(j.current){const e=j.current.getBoundingClientRect(),t=function(){var e,t,n,o=lC,r=cC,a=mC,s=uC,i=hC,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],d=250,u=Tl,h=Ml("start","zoom","end"),m=0,f=10;function p(e){e.property("__zoom",dC).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",N).on("dblclick.zoom",C).filter(i).on("touchstart.zoom",E).on("touchmove.zoom",S).on("touchend.zoom touchcancel.zoom",j).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(e,t){return(t=Math.max(l[0],Math.min(l[1],t)))===e.k?e:new Il(t,e.x,e.y)}function v(e,t,n){var o=t[0]-n[0]*e.k,r=t[1]-n[1]*e.k;return o===e.x&&r===e.y?e:new Il(e.k,o,r)}function x(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function y(e,t,n,o){e.on("start.zoom",(function(){b(this,arguments).event(o).start()})).on("interrupt.zoom end.zoom",(function(){b(this,arguments).event(o).end()})).tween("zoom",(function(){var e=this,a=arguments,s=b(e,a).event(o),i=r.apply(e,a),l=null==n?x(i):"function"==typeof n?n.apply(e,a):n,c=Math.max(i[1][0]-i[0][0],i[1][1]-i[0][1]),d=e.__zoom,h="function"==typeof t?t.apply(e,a):t,m=u(d.invert(l).concat(c/d.k),h.invert(l).concat(c/h.k));return function(e){if(1===e)e=h;else{var t=m(e),n=c/t[2];e=new Il(n,l[0]-t[0]*n,l[1]-t[1]*n)}s.zoom(null,e)}}))}function b(e,t,n){return!n&&e.__zooming||new w(e,t)}function w(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=r.apply(e,t),this.taps=0}function k(e,...t){if(o.apply(this,arguments)){var n=b(this,t).event(e),r=this.__zoom,i=Math.max(l[0],Math.min(l[1],r.k*Math.pow(2,s.apply(this,arguments)))),d=HN(e);if(n.wheel)n.mouse[0][0]===d[0]&&n.mouse[0][1]===d[1]||(n.mouse[1]=r.invert(n.mouse[0]=d)),clearTimeout(n.wheel);else{if(r.k===i)return;n.mouse=[d,r.invert(d)],Al(this),n.start()}iC(e),n.wheel=setTimeout((function(){n.wheel=null,n.end()}),150),n.zoom("mouse",a(v(g(r,i),n.mouse[0],n.mouse[1]),n.extent,c))}}function N(e,...t){if(!n&&o.apply(this,arguments)){var r=e.currentTarget,s=b(this,t,!0).event(e),i=jl(e.view).on("mousemove.zoom",(function(e){if(iC(e),!s.moved){var t=e.clientX-d,n=e.clientY-u;s.moved=t*t+n*n>m}s.event(e).zoom("mouse",a(v(s.that.__zoom,s.mouse[0]=HN(e,r),s.mouse[1]),s.extent,c))}),!0).on("mouseup.zoom",(function(e){i.on("mousemove.zoom mouseup.zoom",null),JN(e.view,s.moved),iC(e),s.event(e).end()}),!0),l=HN(e,r),d=e.clientX,u=e.clientY;KN(e.view),sC(e),s.mouse=[l,this.__zoom.invert(l)],Al(this),s.start()}}function C(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,s=HN(e.changedTouches?e.changedTouches[0]:e,this),i=n.invert(s),l=n.k*(e.shiftKey?.5:2),u=a(v(g(n,l),s,i),r.apply(this,t),c);iC(e),d>0?jl(this).transition().duration(d).call(y,u,s,e):jl(this).call(p.transform,u,s,e)}}function E(n,...r){if(o.apply(this,arguments)){var a,s,i,l,c=n.touches,d=c.length,u=b(this,r,n.changedTouches.length===d).event(n);for(sC(n),s=0;s<d;++s)l=[l=HN(i=c[s],this),this.__zoom.invert(l),i.identifier],u.touch0?u.touch1||u.touch0[2]===l[2]||(u.touch1=l,u.taps=0):(u.touch0=l,a=!0,u.taps=1+!!e);e&&(e=clearTimeout(e)),a&&(u.taps<2&&(t=l[0],e=setTimeout((function(){e=null}),500)),Al(this),u.start())}}function S(e,...t){if(this.__zooming){var n,o,r,s,i=b(this,t).event(e),l=e.changedTouches,d=l.length;for(iC(e),n=0;n<d;++n)r=HN(o=l[n],this),i.touch0&&i.touch0[2]===o.identifier?i.touch0[0]=r:i.touch1&&i.touch1[2]===o.identifier&&(i.touch1[0]=r);if(o=i.that.__zoom,i.touch1){var u=i.touch0[0],h=i.touch0[1],m=i.touch1[0],f=i.touch1[1],p=(p=m[0]-u[0])*p+(p=m[1]-u[1])*p,x=(x=f[0]-h[0])*x+(x=f[1]-h[1])*x;o=g(o,Math.sqrt(p/x)),r=[(u[0]+m[0])/2,(u[1]+m[1])/2],s=[(h[0]+f[0])/2,(h[1]+f[1])/2]}else{if(!i.touch0)return;r=i.touch0[0],s=i.touch0[1]}i.zoom("touch",a(v(o,r,s),i.extent,c))}}function j(e,...o){if(this.__zooming){var r,a,s=b(this,o).event(e),i=e.changedTouches,l=i.length;for(sC(e),n&&clearTimeout(n),n=setTimeout((function(){n=null}),500),r=0;r<l;++r)a=i[r],s.touch0&&s.touch0[2]===a.identifier?delete s.touch0:s.touch1&&s.touch1[2]===a.identifier&&delete s.touch1;if(s.touch1&&!s.touch0&&(s.touch0=s.touch1,delete s.touch1),s.touch0)s.touch0[1]=this.__zoom.invert(s.touch0[0]);else if(s.end(),2===s.taps&&(a=HN(a,this),Math.hypot(t[0]-a[0],t[1]-a[1])<f)){var c=jl(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return p.transform=function(e,t,n,o){var r=e.selection?e.selection():e;r.property("__zoom",dC),e!==r?y(e,t,n,o):r.interrupt().each((function(){b(this,arguments).event(o).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()}))},p.scaleBy=function(e,t,n,o){p.scaleTo(e,(function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)}),n,o)},p.scaleTo=function(e,t,n,o){p.transform(e,(function(){var e=r.apply(this,arguments),o=this.__zoom,s=null==n?x(e):"function"==typeof n?n.apply(this,arguments):n,i=o.invert(s),l="function"==typeof t?t.apply(this,arguments):t;return a(v(g(o,l),s,i),e,c)}),n,o)},p.translateBy=function(e,t,n,o){p.transform(e,(function(){return a(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),r.apply(this,arguments),c)}),null,o)},p.translateTo=function(e,t,n,o,s){p.transform(e,(function(){var e=r.apply(this,arguments),s=this.__zoom,i=null==o?x(e):"function"==typeof o?o.apply(this,arguments):o;return a(_l.translate(i[0],i[1]).scale(s.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,c)}),o,s)},w.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=jl(this.that).datum();h.call(e,this.that,new aC(e,{sourceEvent:this.sourceEvent,target:p,type:e,transform:this.that.__zoom,dispatch:h}),t)}},p.wheelDelta=function(e){return arguments.length?(s="function"==typeof e?e:rC(+e),p):s},p.filter=function(e){return arguments.length?(o="function"==typeof e?e:rC(!!e),p):o},p.touchable=function(e){return arguments.length?(i="function"==typeof e?e:rC(!!e),p):i},p.extent=function(e){return arguments.length?(r="function"==typeof e?e:rC([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),p):r},p.scaleExtent=function(e){return arguments.length?(l[0]=+e[0],l[1]=+e[1],p):[l[0],l[1]]},p.translateExtent=function(e){return arguments.length?(c[0][0]=+e[0][0],c[1][0]=+e[1][0],c[0][1]=+e[0][1],c[1][1]=+e[1][1],p):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},p.constrain=function(e){return arguments.length?(a=e,p):a},p.duration=function(e){return arguments.length?(d=+e,p):d},p.interpolate=function(e){return arguments.length?(u=e,p):u},p.on=function(){var e=h.on.apply(h,arguments);return e===h?p:e},p.clickDistance=function(e){return arguments.length?(m=(e=+e)*e,p):Math.sqrt(m)},p.tapDistance=function(e){return arguments.length?(f=+e,p):f},p}().scaleExtent([g,v]).translateExtent(p),n=jl(j.current).call(t),o=_l.translate(f.x,f.y).scale(TC(f.zoom,g,v)),r=[[0,0],[e.width,e.height]],a=t.constrain()(o,r,p);t.transform(n,a),t.wheelDelta(PS),C.setState({d3Zoom:t,d3Selection:n,d3ZoomHandler:n.on("wheel.zoom"),transform:[a.x,a.y,a.k],domNode:j.current.closest(".react-flow")})}}),[]),r.useEffect((()=>{A&&I&&(!i||O||T?void 0!==M&&A.on("wheel.zoom",(function(e,t){if(!y&&"wheel"===e.type&&!e.ctrlKey||DS(e,w))return null;e.preventDefault(),M.call(this,e,t)}),{passive:!1}):A.on("wheel.zoom",(o=>{if(DS(o,w))return!1;o.preventDefault(),o.stopImmediatePropagation();const r=A.property("__zoom").k||1;if(o.ctrlKey&&s){const e=HN(o),t=PS(o),n=r*Math.pow(2,t);return void I.scaleTo(A,n,e,o)}const a=1===o.deltaMode?20:1;let i=c===QC.Vertical?0:o.deltaX*a,d=c===QC.Horizontal?0:o.deltaY*a;!WC()&&o.shiftKey&&c!==QC.Vertical&&(i=o.deltaY*a,d=0),I.translateBy(A,-i/r*l,-d/r*l,{internal:!0});const u=OS(A.property("__zoom")),{onViewportChangeStart:h,onViewportChange:m,onViewportChangeEnd:f}=C.getState();clearTimeout(P.current),R.current||(R.current=!0,null==t||t(o,u),null==h||h(u)),R.current&&(null==e||e(o,u),null==m||m(u),P.current=setTimeout((()=>{null==n||n(o,u),null==f||f(u),R.current=!1}),150))}),{passive:!1}))}),[T,i,c,A,I,M,O,s,y,w,t,e,n]),r.useEffect((()=>{I&&I.on("start",(e=>{var n,o;if(!e.sourceEvent||e.sourceEvent.internal)return null;D.current=null==(n=e.sourceEvent)?void 0:n.button;const{onViewportChangeStart:r}=C.getState(),a=OS(e.transform);E.current=!0,_.current=a,"mousedown"===(null==(o=e.sourceEvent)?void 0:o.type)&&C.setState({paneDragging:!0}),null==r||r(a),null==t||t(e.sourceEvent,a)}))}),[I,t]),r.useEffect((()=>{I&&(T&&!E.current?I.on("zoom",null):T||I.on("zoom",(t=>{var n;const{onViewportChange:r}=C.getState();if(C.setState({transform:[t.transform.x,t.transform.y,t.transform.k]}),S.current=!(!o||!RS(m,D.current??0)),(e||r)&&!(null==(n=t.sourceEvent)?void 0:n.internal)){const n=OS(t.transform);null==r||r(n),null==e||e(t.sourceEvent,n)}})))}),[T,I,e,m,o]),r.useEffect((()=>{I&&I.on("end",(e=>{if(!e.sourceEvent||e.sourceEvent.internal)return null;const{onViewportChangeEnd:t}=C.getState();if(E.current=!1,C.setState({paneDragging:!1}),o&&RS(m,D.current??0)&&!S.current&&o(e.sourceEvent),S.current=!1,(n||t)&&(r=_.current,a=e.transform,r.x!==a.x||r.y!==a.y||r.zoom!==a.k)){const o=OS(e.transform);_.current=o,clearTimeout(N.current),N.current=setTimeout((()=>{null==t||t(o),null==n||n(e.sourceEvent,o)}),i?150:0)}var r,a}))}),[I,i,m,n,o]),r.useEffect((()=>{I&&I.filter((e=>{const t=O||a,n=s&&e.ctrlKey;if((!0===m||Array.isArray(m)&&m.includes(1))&&1===e.button&&"mousedown"===e.type&&(DS(e,"react-flow__node")||DS(e,"react-flow__edge")))return!0;if(!(m||t||i||d||s))return!1;if(T)return!1;if(!d&&"dblclick"===e.type)return!1;if(DS(e,w)&&"wheel"===e.type)return!1;if(DS(e,k)&&("wheel"!==e.type||i&&"wheel"===e.type&&!O))return!1;if(!s&&e.ctrlKey&&"wheel"===e.type)return!1;if(!t&&!i&&!n&&"wheel"===e.type)return!1;if(!m&&("mousedown"===e.type||"touchstart"===e.type))return!1;if(Array.isArray(m)&&!m.includes(e.button)&&"mousedown"===e.type)return!1;const o=Array.isArray(m)&&m.includes(e.button)||!e.button||e.button<=1;return(!e.ctrlKey||"wheel"===e.type)&&o}))}),[T,I,a,s,i,d,m,h,O]),u.createElement("div",{className:"react-flow__renderer",ref:j,style:TS},b)},zS=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function BS(){const{userSelectionActive:e,userSelectionRect:t}=EC(zS,$N);return e&&t?u.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function US(e,t){const n=t.parentNode||t.parentId,o=e.find((e=>e.id===n));if(o){const e=t.position.x+t.width-o.width,n=t.position.y+t.height-o.height;if(e>0||n>0||t.position.x<0||t.position.y<0){if(o.style={...o.style},o.style.width=o.style.width??o.width,o.style.height=o.style.height??o.height,e>0&&(o.style.width+=e),n>0&&(o.style.height+=n),t.position.x<0){const e=Math.abs(t.position.x);o.position.x=o.position.x-e,o.style.width+=e,t.position.x=0}if(t.position.y<0){const e=Math.abs(t.position.y);o.position.y=o.position.y-e,o.style.height+=e,t.position.y=0}o.width=o.style.width,o.height=o.style.height}}}function VS(e,t){if(e.some((e=>"reset"===e.type)))return e.filter((e=>"reset"===e.type)).map((e=>e.item));const n=e.filter((e=>"add"===e.type)).map((e=>e.item));return t.reduce(((t,n)=>{const o=e.filter((e=>e.id===n.id));if(0===o.length)return t.push(n),t;const r={...n};for(const e of o)if(e)switch(e.type){case"select":r.selected=e.selected;break;case"position":void 0!==e.position&&(r.position=e.position),void 0!==e.positionAbsolute&&(r.positionAbsolute=e.positionAbsolute),void 0!==e.dragging&&(r.dragging=e.dragging),r.expandParent&&US(t,r);break;case"dimensions":void 0!==e.dimensions&&(r.width=e.dimensions.width,r.height=e.dimensions.height),void 0!==e.updateStyle&&(r.style={...r.style||{},...e.dimensions}),"boolean"==typeof e.resizing&&(r.resizing=e.resizing),r.expandParent&&US(t,r);break;case"remove":return t}return t.push(r),t}),n)}function GS(e,t){return VS(e,t)}const $S=(e,t)=>({id:e,type:"select",selected:t});function HS(e,t){return e.reduce(((e,n)=>{const o=t.includes(n.id);return!n.selected&&o?(n.selected=!0,e.push($S(n.id,!0))):n.selected&&!o&&(n.selected=!1,e.push($S(n.id,!1))),e}),[])}const WS=(e,t)=>n=>{n.target===t.current&&(null==e||e(n))},qS=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),YS=r.memo((({isSelecting:e,selectionMode:t=tE.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:a,onPaneClick:s,onPaneContextMenu:i,onPaneScroll:l,onPaneMouseEnter:c,onPaneMouseMove:d,onPaneMouseLeave:h,children:m})=>{const f=r.useRef(null),p=SC(),g=r.useRef(0),v=r.useRef(0),x=r.useRef(),{userSelectionActive:y,elementsSelectable:b,dragging:w}=EC(qS,$N),k=()=>{p.setState({userSelectionActive:!1,userSelectionRect:null}),g.current=0,v.current=0},N=e=>{null==s||s(e),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},C=l?e=>l(e):void 0,E=b&&(e||y);return u.createElement("div",{className:LN(["react-flow__pane",{dragging:w,selection:e}]),onClick:E?void 0:WS(N,f),onContextMenu:WS((e=>{Array.isArray(n)&&(null==n?void 0:n.includes(2))?e.preventDefault():null==i||i(e)}),f),onWheel:WS(C,f),onMouseEnter:E?void 0:c,onMouseDown:E?t=>{const{resetSelectedElements:n,domNode:r}=p.getState();if(x.current=null==r?void 0:r.getBoundingClientRect(),!b||!e||0!==t.button||t.target!==f.current||!x.current)return;const{x:a,y:s}=HC(t,x.current);n(),p.setState({userSelectionRect:{width:0,height:0,startX:a,startY:s,x:a,y:s}}),null==o||o(t)}:void 0,onMouseMove:E?n=>{const{userSelectionRect:o,nodeInternals:r,edges:a,transform:s,onNodesChange:i,onEdgesChange:l,nodeOrigin:c,getNodes:d}=p.getState();if(!e||!x.current||!o)return;p.setState({userSelectionActive:!0,nodesSelectionActive:!1});const u=HC(n,x.current),h=o.startX??0,m=o.startY??0,f={...o,x:u.x<h?u.x:h,y:u.y<m?u.y:m,width:Math.abs(u.x-h),height:Math.abs(u.y-m)},y=d(),b=ME(r,f,s,t===tE.Partial,!0,c),w=TE(b,a).map((e=>e.id)),k=b.map((e=>e.id));if(g.current!==k.length){g.current=k.length;const e=HS(y,k);e.length&&(null==i||i(e))}if(v.current!==w.length){v.current=w.length;const e=HS(a,w);e.length&&(null==l||l(e))}p.setState({userSelectionRect:f})}:d,onMouseUp:E?e=>{if(0!==e.button)return;const{userSelectionRect:t}=p.getState();!y&&t&&e.target===f.current&&(null==N||N(e)),p.setState({nodesSelectionActive:g.current>0}),k(),null==a||a(e)}:void 0,onMouseLeave:E?e=>{y&&(p.setState({nodesSelectionActive:g.current>0}),null==a||a(e)),k()}:h,ref:f,style:TS},m,u.createElement(BS,null))}));function XS(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const o=t.get(n);return!!o&&(!!o.selected||XS(o,t))}function KS(e,t,n){let o=e;do{if(null==o?void 0:o.matches(t))return!0;if(o===n.current)return!1;o=o.parentElement}while(o);return!1}function JS(e,t,n,o){return Array.from(e.values()).filter((n=>(n.selected||n.id===o)&&(!n.parentNode||n.parentId||!XS(n,e))&&(n.draggable||t&&void 0===n.draggable))).map((e=>{var t,o;return{id:e.id,position:e.position||{x:0,y:0},positionAbsolute:e.positionAbsolute||{x:0,y:0},distance:{x:n.x-((null==(t=e.positionAbsolute)?void 0:t.x)??0),y:n.y-((null==(o=e.positionAbsolute)?void 0:o.y)??0)},delta:{x:0,y:0},extent:e.extent,parentNode:e.parentNode||e.parentId,parentId:e.parentNode||e.parentId,width:e.width,height:e.height,expandParent:e.expandParent}}))}function ZS(e,t,n,o,r=[0,0],a){const s=function(e,t){return t&&"parent"!==t?[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]:t}(e,e.extent||o);let i=s;const l=e.parentNode||e.parentId;if("parent"!==e.extent||e.expandParent){if(e.extent&&l&&"parent"!==e.extent){const t=n.get(l),{x:o,y:a}=IE(t,r).positionAbsolute;i=[[e.extent[0][0]+o,e.extent[0][1]+a],[e.extent[1][0]+o,e.extent[1][1]+a]]}}else if(l&&e.width&&e.height){const t=n.get(l),{x:o,y:a}=IE(t,r).positionAbsolute;i=t&&BC(o)&&BC(a)&&BC(t.width)&&BC(t.height)?[[o+e.width*r[0],a+e.height*r[1]],[o+t.width-e.width+e.width*r[0],a+t.height-e.height+e.height*r[1]]]:i}else null==a||a("005",xC()),i=s;let c={x:0,y:0};if(l){const e=n.get(l);c=IE(e,r).positionAbsolute}const d=i&&"parent"!==i?OC(t,i):t;return{position:{x:d.x-c.x,y:d.y-c.y},positionAbsolute:d}}function QS({nodeId:e,dragItems:t,nodeInternals:n}){const o=t.map((e=>({...n.get(e.id),position:e.position,positionAbsolute:e.positionAbsolute})));return[e?o.find((t=>t.id===e)):o[0],o]}YS.displayName="Pane";const ej=(e,t,n,o)=>{const r=t.querySelectorAll(e);if(!r||!r.length)return null;const a=Array.from(r),s=t.getBoundingClientRect(),i=s.width*o[0],l=s.height*o[1];return a.map((e=>{const t=e.getBoundingClientRect();return{id:e.getAttribute("data-handleid"),position:e.getAttribute("data-handlepos"),x:(t.left-s.left-i)/n,y:(t.top-s.top-l)/n,...MC(e)}}))};function tj(e,t,n){return void 0===n?n:o=>{const r=t().nodeInternals.get(e);r&&n(o,{...r})}}function nj({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:a,multiSelectionActive:s,nodeInternals:i,onError:l}=t.getState(),c=i.get(e);c?(t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&s)&&(a({nodes:[c],edges:[]}),requestAnimationFrame((()=>{var e;return null==(e=null==o?void 0:o.current)?void 0:e.blur()}))):r([e])):null==l||l("012",NC(e))}function oj(e){return(t,n,o)=>null==e?void 0:e(t,o)}function rj({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:a,isSelectable:s,selectNodesOnDrag:i}){const l=SC(),[c,d]=r.useState(!1),u=r.useRef([]),h=r.useRef({x:null,y:null}),m=r.useRef(0),f=r.useRef(null),p=r.useRef({x:0,y:0}),g=r.useRef(null),v=r.useRef(!1),x=r.useRef(!1),y=r.useRef(!1),b=function(){const e=SC();return r.useCallback((({sourceEvent:t})=>{const{transform:n,snapGrid:o,snapToGrid:r}=e.getState(),a=t.touches?t.touches[0].clientX:t.clientX,s=t.touches?t.touches[0].clientY:t.clientY,i={x:(a-n[0])/n[2],y:(s-n[1])/n[2]};return{xSnapped:r?o[0]*Math.round(i.x/o[0]):i.x,ySnapped:r?o[1]*Math.round(i.y/o[1]):i.y,...i}}),[])}();return r.useEffect((()=>{if(null==e?void 0:e.current){const r=jl(e.current),c=({x:e,y:t})=>{const{nodeInternals:n,onNodeDrag:o,onSelectionDrag:r,updateNodePositions:s,nodeExtent:i,snapGrid:c,snapToGrid:m,nodeOrigin:f,onError:p}=l.getState();h.current={x:e,y:t};let v=!1,x={x:0,y:0,x2:0,y2:0};if(u.current.length>1&&i){const e=AE(u.current,f);x=FC(e)}if(u.current=u.current.map((o=>{const r={x:e-o.distance.x,y:t-o.distance.y};m&&(r.x=c[0]*Math.round(r.x/c[0]),r.y=c[1]*Math.round(r.y/c[1]));const a=[[i[0][0],i[0][1]],[i[1][0],i[1][1]]];u.current.length>1&&i&&!o.extent&&(a[0][0]=o.positionAbsolute.x-x.x+i[0][0],a[1][0]=o.positionAbsolute.x+(o.width??0)-x.x2+i[1][0],a[0][1]=o.positionAbsolute.y-x.y+i[0][1],a[1][1]=o.positionAbsolute.y+(o.height??0)-x.y2+i[1][1]);const s=ZS(o,r,n,a,f,p);return v=v||o.position.x!==s.position.x||o.position.y!==s.position.y,o.position=s.position,o.positionAbsolute=s.positionAbsolute,o})),!v)return;s(u.current,!0,!0),d(!0);const y=a?o:oj(r);if(y&&g.current){const[e,t]=QS({nodeId:a,dragItems:u.current,nodeInternals:n});y(g.current,e,t)}},w=()=>{if(!f.current)return;const[e,t]=RC(p.current,f.current);if(0!==e||0!==t){const{transform:n,panBy:o}=l.getState();h.current.x=(h.current.x??0)-e/n[2],h.current.y=(h.current.y??0)-t/n[2],o({x:e,y:t})&&c(h.current)}m.current=requestAnimationFrame(w)},k=t=>{var n;const{nodeInternals:o,multiSelectionActive:r,nodesDraggable:c,unselectNodesAndEdges:d,onNodeDragStart:m,onSelectionDragStart:f}=l.getState();x.current=!0;const p=a?m:oj(f);i&&s||r||!a||(null==(n=o.get(a))?void 0:n.selected)||d(),a&&s&&i&&nj({id:a,store:l,nodeRef:e});const g=b(t);if(h.current=g,u.current=JS(o,c,g,a),p&&u.current){const[e,n]=QS({nodeId:a,dragItems:u.current,nodeInternals:o});p(t.sourceEvent,e,n)}};if(!t){const t=function(){var e,t,n,o,r=eC,a=tC,s=nC,i=oC,l={},c=Ml("start","drag","end"),d=0,u=0;function h(e){e.on("mousedown.drag",m).filter(i).on("touchstart.drag",g).on("touchmove.drag",v,WN).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(s,i){if(!o&&r.call(this,s,i)){var l=y(this,a.call(this,s,i),s,i,"mouse");l&&(jl(s.view).on("mousemove.drag",f,qN).on("mouseup.drag",p,qN),KN(s.view),YN(s),n=!1,e=s.clientX,t=s.clientY,l("start",s))}}function f(o){if(XN(o),!n){var r=o.clientX-e,a=o.clientY-t;n=r*r+a*a>u}l.mouse("drag",o)}function p(e){jl(e.view).on("mousemove.drag mouseup.drag",null),JN(e.view,n),XN(e),l.mouse("end",e)}function g(e,t){if(r.call(this,e,t)){var n,o,s=e.changedTouches,i=a.call(this,e,t),l=s.length;for(n=0;n<l;++n)(o=y(this,i,e,t,s[n].identifier,s[n]))&&(YN(e),o("start",e,s[n]))}}function v(e){var t,n,o=e.changedTouches,r=o.length;for(t=0;t<r;++t)(n=l[o[t].identifier])&&(XN(e),n("drag",e,o[t]))}function x(e){var t,n,r=e.changedTouches,a=r.length;for(o&&clearTimeout(o),o=setTimeout((function(){o=null}),500),t=0;t<a;++t)(n=l[r[t].identifier])&&(YN(e),n("end",e,r[t]))}function y(e,t,n,o,r,a){var i,u,m,f=c.copy(),p=HN(a||n,t);if(null!=(m=s.call(e,new QN("beforestart",{sourceEvent:n,target:h,identifier:r,active:d,x:p[0],y:p[1],dx:0,dy:0,dispatch:f}),o)))return i=m.x-p[0]||0,u=m.y-p[1]||0,function n(a,s,c){var g,v=p;switch(a){case"start":l[r]=n,g=d++;break;case"end":delete l[r],--d;case"drag":p=HN(c||s,t),g=d}f.call(a,e,new QN(a,{sourceEvent:s,subject:m,target:h,identifier:r,active:g,x:p[0]+i,y:p[1]+u,dx:p[0]-v[0],dy:p[1]-v[1],dispatch:f}),o)}}return h.filter=function(e){return arguments.length?(r="function"==typeof e?e:ZN(!!e),h):r},h.container=function(e){return arguments.length?(a="function"==typeof e?e:ZN(e),h):a},h.subject=function(e){return arguments.length?(s="function"==typeof e?e:ZN(e),h):s},h.touchable=function(e){return arguments.length?(i="function"==typeof e?e:ZN(!!e),h):i},h.on=function(){var e=c.on.apply(c,arguments);return e===c?h:e},h.clickDistance=function(e){return arguments.length?(u=(e=+e)*e,h):Math.sqrt(u)},h}().on("start",(e=>{const{domNode:t,nodeDragThreshold:n}=l.getState();0===n&&k(e),y.current=!1;const o=b(e);h.current=o,f.current=(null==t?void 0:t.getBoundingClientRect())||null,p.current=HC(e.sourceEvent,f.current)})).on("drag",(e=>{var t,n;const o=b(e),{autoPanOnNodeDrag:r,nodeDragThreshold:a}=l.getState();if("touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1&&(y.current=!0),!y.current){if(!v.current&&x.current&&r&&(v.current=!0,w()),!x.current){const r=o.xSnapped-((null==(t=null==h?void 0:h.current)?void 0:t.x)??0),s=o.ySnapped-((null==(n=null==h?void 0:h.current)?void 0:n.y)??0);Math.sqrt(r*r+s*s)>a&&k(e)}(h.current.x!==o.xSnapped||h.current.y!==o.ySnapped)&&u.current&&x.current&&(g.current=e.sourceEvent,p.current=HC(e.sourceEvent,f.current),c(o))}})).on("end",(e=>{if(x.current&&!y.current&&(d(!1),v.current=!1,x.current=!1,cancelAnimationFrame(m.current),u.current)){const{updateNodePositions:t,nodeInternals:n,onNodeDragStop:o,onSelectionDragStop:r}=l.getState(),s=a?o:oj(r);if(t(u.current,!1,!1),s){const[t,o]=QS({nodeId:a,dragItems:u.current,nodeInternals:n});s(e.sourceEvent,t,o)}}})).filter((t=>{const r=t.target;return!t.button&&(!n||!KS(r,`.${n}`,e))&&(!o||KS(r,o,e))}));return r.call(t),()=>{r.on(".drag",null)}}r.on(".drag",null)}}),[e,t,n,o,s,l,a,i,b]),c}function aj(){const e=SC();return r.useCallback((t=>{const{nodeInternals:n,nodeExtent:o,updateNodePositions:r,getNodes:a,snapToGrid:s,snapGrid:i,onError:l,nodesDraggable:c}=e.getState(),d=a().filter((e=>e.selected&&(e.draggable||c&&void 0===e.draggable))),u=s?i[0]:5,h=s?i[1]:5,m=t.isShiftPressed?4:1,f=t.x*u*m,p=t.y*h*m;r(d.map((e=>{if(e.positionAbsolute){const t={x:e.positionAbsolute.x+f,y:e.positionAbsolute.y+p};s&&(t.x=i[0]*Math.round(t.x/i[0]),t.y=i[1]*Math.round(t.y/i[1]));const{positionAbsolute:r,position:a}=ZS(e,t,n,o,void 0,l);e.position=a,e.positionAbsolute=r}return e})),!0,!1)}),[])}const sj={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var ij=e=>{const t=({id:t,type:n,data:o,xPos:a,yPos:s,xPosOrigin:i,yPosOrigin:l,selected:c,onClick:d,onMouseEnter:h,onMouseMove:m,onMouseLeave:f,onContextMenu:p,onDoubleClick:g,style:v,className:x,isDraggable:y,isSelectable:b,isConnectable:w,isFocusable:k,selectNodesOnDrag:N,sourcePosition:C,targetPosition:E,hidden:S,resizeObserver:j,dragHandle:_,zIndex:I,isParent:A,noDragClassName:M,noPanClassName:T,initialized:O,disableKeyboardA11y:D,ariaLabel:R,rfId:P,hasHandleBounds:F})=>{const L=SC(),z=r.useRef(null),B=r.useRef(null),U=r.useRef(C),V=r.useRef(E),G=r.useRef(n),$=b||y||d||h||m||f,H=aj(),W=tj(t,L.getState,h),q=tj(t,L.getState,m),Y=tj(t,L.getState,f),X=tj(t,L.getState,p),K=tj(t,L.getState,g);r.useEffect((()=>()=>{B.current&&(null==j||j.unobserve(B.current),B.current=null)}),[]),r.useEffect((()=>{if(z.current&&!S){const e=z.current;O&&F&&B.current===e||(B.current&&(null==j||j.unobserve(B.current)),null==j||j.observe(e),B.current=e)}}),[S,O,F]),r.useEffect((()=>{const e=G.current!==n,o=U.current!==C,r=V.current!==E;z.current&&(e||o||r)&&(e&&(G.current=n),o&&(U.current=C),r&&(V.current=E),L.getState().updateNodeDimensions([{id:t,nodeElement:z.current,forceUpdate:!0}]))}),[t,n,C,E]);const J=rj({nodeRef:z,disabled:S||!y,noDragClassName:M,handleSelector:_,nodeId:t,isSelectable:b,selectNodesOnDrag:N});return S?null:u.createElement("div",{className:LN(["react-flow__node",`react-flow__node-${n}`,{[T]:y},x,{selected:c,selectable:b,parent:A,dragging:J}]),ref:z,style:{zIndex:I,transform:`translate(${i}px,${l}px)`,pointerEvents:$?"all":"none",visibility:O?"visible":"hidden",...v},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:W,onMouseMove:q,onMouseLeave:Y,onContextMenu:X,onClick:e=>{const{nodeDragThreshold:n}=L.getState();if(b&&(!N||!y||n>0)&&nj({id:t,store:L,nodeRef:z}),d){const n=L.getState().nodeInternals.get(t);n&&d(e,{...n})}},onDoubleClick:K,onKeyDown:k?e=>{if(!GC(e)&&!D)if(VC.includes(e.key)&&b){const n="Escape"===e.key;nj({id:t,store:L,unselect:n,nodeRef:z})}else y&&c&&Object.prototype.hasOwnProperty.call(sj,e.key)&&(L.setState({ariaLiveMessage:`Moved selected node ${e.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~s}`}),H({x:sj[e.key].x,y:sj[e.key].y,isShiftPressed:e.shiftKey}))}:void 0,tabIndex:k?0:void 0,role:k?"button":void 0,"aria-describedby":D?void 0:`${hS}-${P}`,"aria-label":R},u.createElement(CE,{value:t},u.createElement(e,{id:t,data:o,type:n,xPos:a,yPos:s,selected:c,isConnectable:w,sourcePosition:C,targetPosition:E,dragging:J,dragHandle:_,zIndex:I})))};return t.displayName="NodeWrapper",r.memo(t)};const lj=e=>{const t=e.getNodes().filter((e=>e.selected));return{...AE(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};var cj=r.memo((function({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=SC(),{width:a,height:s,x:i,y:l,transformString:c,userSelectionActive:d}=EC(lj,$N),h=aj(),m=r.useRef(null);if(r.useEffect((()=>{var e;n||null==(e=m.current)||e.focus({preventScroll:!0})}),[n]),rj({nodeRef:m}),d||!a||!s)return null;const f=e?t=>{const n=o.getState().getNodes().filter((e=>e.selected));e(t,n)}:void 0;return u.createElement("div",{className:LN(["react-flow__nodesselection","react-flow__container",t]),style:{transform:c}},u.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(sj,e.key)&&h({x:sj[e.key].x,y:sj[e.key].y,isShiftPressed:e.shiftKey})},style:{width:a,height:s,top:l,left:i}}))}));const dj=e=>e.nodesSelectionActive,uj=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:i,deleteKeyCode:l,onMove:c,onMoveStart:d,onMoveEnd:h,selectionKeyCode:m,selectionOnDrag:f,selectionMode:p,onSelectionStart:g,onSelectionEnd:v,multiSelectionKeyCode:x,panActivationKeyCode:y,zoomActivationKeyCode:b,elementsSelectable:w,zoomOnScroll:k,zoomOnPinch:N,panOnScroll:C,panOnScrollSpeed:E,panOnScrollMode:S,zoomOnDoubleClick:j,panOnDrag:_,defaultViewport:I,translateExtent:A,minZoom:M,maxZoom:T,preventScrolling:O,onSelectionContextMenu:D,noWheelClassName:R,noPanClassName:P,disableKeyboardA11y:F})=>{const L=EC(dj),z=vS(m),B=vS(y),U=B||_,V=B||C,G=z||f&&!0!==U;return(({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=SC(),{deleteElements:o}=AS(),a=vS(e,MS),s=vS(t);r.useEffect((()=>{if(a){const{edges:e,getNodes:t}=n.getState(),r=t().filter((e=>e.selected)),a=e.filter((e=>e.selected));o({nodes:r,edges:a}),n.setState({nodesSelectionActive:!1})}}),[a]),r.useEffect((()=>{n.setState({multiSelectionActive:s})}),[s])})({deleteKeyCode:l,multiSelectionKeyCode:x}),u.createElement(LS,{onMove:c,onMoveStart:d,onMoveEnd:h,onPaneContextMenu:s,elementsSelectable:w,zoomOnScroll:k,zoomOnPinch:N,panOnScroll:V,panOnScrollSpeed:E,panOnScrollMode:S,zoomOnDoubleClick:j,panOnDrag:!z&&U,defaultViewport:I,translateExtent:A,minZoom:M,maxZoom:T,zoomActivationKeyCode:b,preventScrolling:O,noWheelClassName:R,noPanClassName:P},u.createElement(YS,{onSelectionStart:g,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:U,isSelecting:!!G,selectionMode:p},e,L&&u.createElement(cj,{onSelectionContextMenu:D,noPanClassName:P,disableKeyboardA11y:F})))};uj.displayName="FlowRenderer";var hj=r.memo(uj);function mj(e){return{...{input:ij(e.input||KE),default:ij(e.default||YE),output:ij(e.output||ZE),group:ij(e.group||QE)},...Object.keys(e).filter((e=>!["input","default","output","group"].includes(e))).reduce(((t,n)=>(t[n]=ij(e[n]||YE),t)),{})}}const fj=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),pj=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:a,updateNodeDimensions:s,onError:i}=EC(fj,$N),l=(c=e.onlyRenderVisibleElements,EC(r.useCallback((e=>c?ME(e.nodeInternals,{x:0,y:0,width:e.width,height:e.height},e.transform,!0):e.getNodes()),[c])));var c;const d=r.useRef(),h=r.useMemo((()=>{if("undefined"==typeof ResizeObserver)return null;const e=new ResizeObserver((e=>{const t=e.map((e=>({id:e.target.getAttribute("data-id"),nodeElement:e.target,forceUpdate:!0})));s(t)}));return d.current=e,e}),[]);return r.useEffect((()=>()=>{var e;null==(e=null==d?void 0:d.current)||e.disconnect()}),[]),u.createElement("div",{className:"react-flow__nodes",style:TS},l.map((r=>{var s,l,c;let d=r.type||"default";e.nodeTypes[d]||(null==i||i("003",gC(d)),d="default");const m=e.nodeTypes[d]||e.nodeTypes.default,f=!!(r.draggable||t&&void 0===r.draggable),p=!!(r.selectable||a&&void 0===r.selectable),g=!!(r.connectable||n&&void 0===r.connectable),v=!!(r.focusable||o&&void 0===r.focusable),x=e.nodeExtent?OC(r.positionAbsolute,e.nodeExtent):r.positionAbsolute,y=(null==x?void 0:x.x)??0,b=(null==x?void 0:x.y)??0,w=(({x:e,y:t,width:n,height:o,origin:r})=>n&&o?r[0]<0||r[1]<0||r[0]>1||r[1]>1?{x:e,y:t}:{x:e-n*r[0],y:t-o*r[1]}:{x:e,y:t})({x:y,y:b,width:r.width??0,height:r.height??0,origin:e.nodeOrigin});return u.createElement(m,{key:r.id,id:r.id,className:r.className,style:r.style,type:d,data:r.data,sourcePosition:r.sourcePosition||iE.Bottom,targetPosition:r.targetPosition||iE.Top,hidden:r.hidden,xPos:y,yPos:b,xPosOrigin:w.x,yPosOrigin:w.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!r.selected,isDraggable:f,isSelectable:p,isConnectable:g,isFocusable:v,resizeObserver:h,dragHandle:r.dragHandle,zIndex:(null==(s=r[UC])?void 0:s.z)??0,isParent:!!(null==(l=r[UC])?void 0:l.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!r.width&&!!r.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:r.ariaLabel,hasHandleBounds:!!(null==(c=r[UC])?void 0:c.handleBounds)})})))};pj.displayName="NodeRenderer";var gj=r.memo(pj);const vj=(e,t,n)=>n===iE.Left?e-t:n===iE.Right?e+t:e,xj=(e,t,n)=>n===iE.Top?e-t:n===iE.Bottom?e+t:e,yj="react-flow__edgeupdater",bj=({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:a,onMouseOut:s,type:i})=>u.createElement("circle",{onMouseDown:r,onMouseEnter:a,onMouseOut:s,className:LN([yj,`${yj}-${i}`]),cx:vj(t,o,e),cy:xj(n,o,e),r:o,stroke:"transparent",fill:"transparent"}),wj=()=>!0;var kj=e=>{const t=({id:t,className:n,type:o,data:a,onClick:s,onEdgeDoubleClick:i,selected:l,animated:c,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:g,style:v,source:x,target:y,sourceX:b,sourceY:w,targetX:k,targetY:N,sourcePosition:C,targetPosition:E,elementsSelectable:S,hidden:j,sourceHandleId:_,targetHandleId:I,onContextMenu:A,onMouseEnter:M,onMouseMove:T,onMouseLeave:O,reconnectRadius:D,onReconnect:R,onReconnectStart:P,onReconnectEnd:F,markerEnd:L,markerStart:z,rfId:B,ariaLabel:U,isFocusable:V,isReconnectable:G,pathOptions:$,interactionWidth:H,disableKeyboardA11y:W})=>{const q=r.useRef(null),[Y,X]=r.useState(!1),[K,J]=r.useState(!1),Z=SC(),Q=r.useMemo((()=>`url('#${SE(z,B)}')`),[z,B]),ee=r.useMemo((()=>`url('#${SE(L,B)}')`),[L,B]);if(j)return null;const te=YC(t,Z.getState,i),ne=YC(t,Z.getState,A),oe=YC(t,Z.getState,M),re=YC(t,Z.getState,T),ae=YC(t,Z.getState,O),se=(e,n)=>{if(0!==e.button)return;const{edges:o,isValidConnection:r}=Z.getState(),a=n?y:x,s=(n?I:_)||null,i=n?"target":"source",l=r||wj,c=n,d=o.find((e=>e.id===t));J(!0),null==P||P(e,d,i);VE({event:e,handleId:s,nodeId:a,onConnect:e=>null==R?void 0:R(d,e),isTarget:c,getState:Z.getState,setState:Z.setState,isValidConnection:l,edgeUpdaterType:i,onReconnectEnd:e=>{J(!1),null==F||F(e,d,i)}})},ie=()=>X(!0),le=()=>X(!1),ce=!S&&!s;return u.createElement("g",{className:LN(["react-flow__edge",`react-flow__edge-${o}`,n,{selected:l,animated:c,inactive:ce,updating:Y}]),onClick:e=>{var n;const{edges:o,addSelectedEdges:r,unselectNodesAndEdges:a,multiSelectionActive:i}=Z.getState(),l=o.find((e=>e.id===t));l&&(S&&(Z.setState({nodesSelectionActive:!1}),l.selected&&i?(a({nodes:[],edges:[l]}),null==(n=q.current)||n.blur()):r([t])),s&&s(e,l))},onDoubleClick:te,onContextMenu:ne,onMouseEnter:oe,onMouseMove:re,onMouseLeave:ae,onKeyDown:V?e=>{var n;if(!W&&VC.includes(e.key)&&S){const{unselectNodesAndEdges:o,addSelectedEdges:r,edges:a}=Z.getState();"Escape"===e.key?(null==(n=q.current)||n.blur(),o({edges:[a.find((e=>e.id===t))]})):r([t])}}:void 0,tabIndex:V?0:void 0,role:V?"button":"img","data-testid":`rf__edge-${t}`,"aria-label":null===U?void 0:U||`Edge from ${x} to ${y}`,"aria-describedby":V?`${mS}-${B}`:void 0,ref:q},!K&&u.createElement(e,{id:t,source:x,target:y,selected:l,animated:c,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:g,data:a,style:v,sourceX:b,sourceY:w,targetX:k,targetY:N,sourcePosition:C,targetPosition:E,sourceHandleId:_,targetHandleId:I,markerStart:Q,markerEnd:ee,pathOptions:$,interactionWidth:H}),G&&u.createElement(u.Fragment,null,("source"===G||!0===G)&&u.createElement(bj,{position:C,centerX:b,centerY:w,radius:D,onMouseDown:e=>se(e,!0),onMouseEnter:ie,onMouseOut:le,type:"source"}),("target"===G||!0===G)&&u.createElement(bj,{position:E,centerX:k,centerY:N,radius:D,onMouseDown:e=>se(e,!1),onMouseEnter:ie,onMouseOut:le,type:"target"})))};return t.displayName="EdgeWrapper",r.memo(t)};function Nj(e){return{...{default:kj(e.default||kE),straight:kj(e.bezier||xE),step:kj(e.step||vE),smoothstep:kj(e.step||gE),simplebezier:kj(e.simplebezier||uE)},...Object.keys(e).filter((e=>!["default","bezier"].includes(e))).reduce(((t,n)=>(t[n]=kj(e[n]||kE),t)),{})}}function Cj(e,t,n=null){const o=((null==n?void 0:n.x)||0)+t.x,r=((null==n?void 0:n.y)||0)+t.y,a=(null==n?void 0:n.width)||t.width,s=(null==n?void 0:n.height)||t.height;switch(e){case iE.Top:return{x:o+a/2,y:r};case iE.Right:return{x:o+a,y:r+s/2};case iE.Bottom:return{x:o+a/2,y:r+s};case iE.Left:return{x:o,y:r+s/2}}}function Ej(e,t){return e?1!==e.length&&t?t&&e.find((e=>e.id===t))||null:e[0]:null}function Sj(e){var t,n,o,r,a;const s=(null==(t=null==e?void 0:e[UC])?void 0:t.handleBounds)||null,i=s&&(null==e?void 0:e.width)&&(null==e?void 0:e.height)&&void 0!==(null==(n=null==e?void 0:e.positionAbsolute)?void 0:n.x)&&void 0!==(null==(o=null==e?void 0:e.positionAbsolute)?void 0:o.y);return[{x:(null==(r=null==e?void 0:e.positionAbsolute)?void 0:r.x)||0,y:(null==(a=null==e?void 0:e.positionAbsolute)?void 0:a.y)||0,width:(null==e?void 0:e.width)||0,height:(null==e?void 0:e.height)||0},s,!!i]}const jj=[{level:0,isMaxLevel:!0,edges:[]}];function _j(e,t,n){return function(e,t,n=!1){let o=-1;const r=e.reduce(((e,r)=>{var a,s;const i=BC(r.zIndex);let l=i?r.zIndex:0;if(n){const e=t.get(r.target),n=t.get(r.source),o=r.selected||(null==e?void 0:e.selected)||(null==n?void 0:n.selected),c=Math.max((null==(a=null==n?void 0:n[UC])?void 0:a.z)||0,(null==(s=null==e?void 0:e[UC])?void 0:s.z)||0,1e3);l=(i?r.zIndex:0)+(o?c:0)}return e[l]?e[l].push(r):e[l]=[r],o=l>o?l:o,e}),{}),a=Object.entries(r).map((([e,t])=>{const n=+e;return{edges:t,level:n,isMaxLevel:n===o}}));return 0===a.length?jj:a}(EC(r.useCallback((n=>e?n.edges.filter((e=>{const o=t.get(e.source),r=t.get(e.target);return(null==o?void 0:o.width)&&(null==o?void 0:o.height)&&(null==r?void 0:r.width)&&(null==r?void 0:r.height)&&function({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:r,targetHeight:a,width:s,height:i,transform:l}){const c={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+r),y2:Math.max(e.y+o,t.y+a)};c.x===c.x2&&(c.x2+=1),c.y===c.y2&&(c.y2+=1);const d=FC({x:(0-l[0])/l[2],y:(0-l[1])/l[2],width:s/l[2],height:i/l[2]}),u=Math.max(0,Math.min(d.x2,c.x2)-Math.max(d.x,c.x)),h=Math.max(0,Math.min(d.y2,c.y2)-Math.max(d.y,c.y));return Math.ceil(u*h)>0}({sourcePos:o.positionAbsolute||{x:0,y:0},targetPos:r.positionAbsolute||{x:0,y:0},sourceWidth:o.width,sourceHeight:o.height,targetWidth:r.width,targetHeight:r.height,width:n.width,height:n.height,transform:n.transform})})):n.edges),[e,t])),t,n)}const Ij={[aE.Arrow]:({color:e="none",strokeWidth:t=1})=>u.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[aE.ArrowClosed]:({color:e="none",strokeWidth:t=1})=>u.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})};const Aj=({id:e,type:t,color:n,width:o=12.5,height:a=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:l="auto-start-reverse"})=>{const c=function(e){const t=SC();return r.useMemo((()=>{var n,o;return Object.prototype.hasOwnProperty.call(Ij,e)?Ij[e]:(null==(o=(n=t.getState()).onError)||o.call(n,"009",yC(e)),null)}),[e])}(t);return c?u.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:l,refX:"0",refY:"0"},u.createElement(c,{color:n,strokeWidth:i})):null},Mj=({defaultColor:e,rfId:t})=>{const n=EC(r.useCallback((({defaultColor:e,rfId:t})=>n=>{const o=[];return n.edges.reduce(((n,r)=>([r.markerStart,r.markerEnd].forEach((r=>{if(r&&"object"==typeof r){const a=SE(r,t);o.includes(a)||(n.push({id:a,color:r.color||e,...r}),o.push(a))}})),n)),[]).sort(((e,t)=>e.id.localeCompare(t.id)))})({defaultColor:e,rfId:t}),[e,t]),((e,t)=>!(e.length!==t.length||e.some(((e,n)=>e.id!==t[n].id)))));return u.createElement("defs",null,n.map((e=>u.createElement(Aj,{id:e.id,key:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient}))))};Mj.displayName="MarkerDefinitions";var Tj=r.memo(Mj);const Oj=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),Dj=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:o,edgeTypes:r,noPanClassName:a,onEdgeContextMenu:s,onEdgeMouseEnter:i,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:d,onEdgeDoubleClick:h,onReconnect:m,onReconnectStart:f,onReconnectEnd:p,reconnectRadius:g,children:v,disableKeyboardA11y:x})=>{const{edgesFocusable:y,edgesUpdatable:b,elementsSelectable:w,width:k,height:N,connectionMode:C,nodeInternals:E,onError:S}=EC(Oj,$N),j=_j(t,E,n);return k?u.createElement(u.Fragment,null,j.map((({level:t,edges:n,isMaxLevel:v})=>u.createElement("svg",{key:t,style:{zIndex:t},width:k,height:N,className:"react-flow__edges react-flow__container"},v&&u.createElement(Tj,{defaultColor:e,rfId:o}),u.createElement("g",null,n.map((e=>{const[t,n,v]=Sj(E.get(e.source)),[k,N,j]=Sj(E.get(e.target));if(!v||!j)return null;let _=e.type||"default";r[_]||(null==S||S("011",kC(_)),_="default");const I=r[_]||r.default,A=C===JC.Strict?N.target:(N.target??[]).concat(N.source??[]),M=Ej(n.source,e.sourceHandle),T=Ej(A,e.targetHandle),O=(null==M?void 0:M.position)||iE.Bottom,D=(null==T?void 0:T.position)||iE.Top,R=!!(e.focusable||y&&void 0===e.focusable),P=e.reconnectable||e.updatable,F=void 0!==m&&(P||b&&void 0===P);if(!M||!T)return null==S||S("008",bC(M,e)),null;const{sourceX:L,sourceY:z,targetX:B,targetY:U}=((e,t,n,o,r,a)=>{const s=Cj(n,e,t),i=Cj(a,o,r);return{sourceX:s.x,sourceY:s.y,targetX:i.x,targetY:i.y}})(t,M,O,k,T,D);return u.createElement(I,{key:e.id,id:e.id,className:LN([e.className,a]),type:_,data:e.data,selected:!!e.selected,animated:!!e.animated,hidden:!!e.hidden,label:e.label,labelStyle:e.labelStyle,labelShowBg:e.labelShowBg,labelBgStyle:e.labelBgStyle,labelBgPadding:e.labelBgPadding,labelBgBorderRadius:e.labelBgBorderRadius,style:e.style,source:e.source,target:e.target,sourceHandleId:e.sourceHandle,targetHandleId:e.targetHandle,markerEnd:e.markerEnd,markerStart:e.markerStart,sourceX:L,sourceY:z,targetX:B,targetY:U,sourcePosition:O,targetPosition:D,elementsSelectable:w,onContextMenu:s,onMouseEnter:i,onMouseMove:l,onMouseLeave:c,onClick:d,onEdgeDoubleClick:h,onReconnect:m,onReconnectStart:f,onReconnectEnd:p,reconnectRadius:g,rfId:o,ariaLabel:e.ariaLabel,isFocusable:R,isReconnectable:F,pathOptions:"pathOptions"in e?e.pathOptions:void 0,interactionWidth:e.interactionWidth,disableKeyboardA11y:x})})))))),v):null};Dj.displayName="EdgeRenderer";var Rj=r.memo(Dj);const Pj=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Fj({children:e}){const t=EC(Pj);return u.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}const Lj={[iE.Left]:iE.Right,[iE.Right]:iE.Left,[iE.Top]:iE.Bottom,[iE.Bottom]:iE.Top},zj=({nodeId:e,handleType:t,style:n,type:o=oE.Bezier,CustomComponent:a,connectionStatus:s})=>{var i,l,c;const{fromNode:d,handleId:h,toX:m,toY:f,connectionMode:p}=EC(r.useCallback((t=>({fromNode:t.nodeInternals.get(e),handleId:t.connectionHandleId,toX:(t.connectionPosition.x-t.transform[0])/t.transform[2],toY:(t.connectionPosition.y-t.transform[1])/t.transform[2],connectionMode:t.connectionMode})),[e]),$N),g=null==(i=null==d?void 0:d[UC])?void 0:i.handleBounds;let v=null==g?void 0:g[t];if(p===JC.Loose&&(v=v||(null==g?void 0:g["source"===t?"target":"source"])),!d||!v)return null;const x=h?v.find((e=>e.id===h)):v[0],y=x?x.x+x.width/2:(d.width??0)/2,b=x?x.y+x.height/2:d.height??0,w=((null==(l=d.positionAbsolute)?void 0:l.x)??0)+y,k=((null==(c=d.positionAbsolute)?void 0:c.y)??0)+b,N=null==x?void 0:x.position,C=N?Lj[N]:null;if(!N||!C)return null;if(a)return u.createElement(a,{connectionLineType:o,connectionLineStyle:n,fromNode:d,fromHandle:x,fromX:w,fromY:k,toX:m,toY:f,fromPosition:N,toPosition:C,connectionStatus:s});let E="";const S={sourceX:w,sourceY:k,sourcePosition:N,targetX:m,targetY:f,targetPosition:C};return o===oE.Bezier?[E]=wE(S):o===oE.Step?[E]=pE({...S,borderRadius:0}):o===oE.SmoothStep?[E]=pE(S):o===oE.SimpleBezier?[E]=dE(S):E=`M${w},${k} ${m},${f}`,u.createElement("path",{d:E,fill:"none",className:"react-flow__connection-path",style:n})};zj.displayName="ConnectionLine";const Bj=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function Uj({containerStyle:e,style:t,type:n,component:o}){const{nodeId:r,handleType:a,nodesConnectable:s,width:i,height:l,connectionStatus:c}=EC(Bj,$N);return!!(r&&a&&i&&s)?u.createElement("svg",{style:e,width:i,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},u.createElement("g",{className:LN(["react-flow__connection",c])},u.createElement(zj,{nodeId:r,handleType:a,style:t,type:n,CustomComponent:o,connectionStatus:c}))):null}function Vj(e,t){r.useRef(null),SC();return r.useMemo((()=>t(e)),[e])}const Gj=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:o,onMoveEnd:a,onInit:s,onNodeClick:i,onEdgeClick:l,onNodeDoubleClick:c,onEdgeDoubleClick:d,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:f,onNodeContextMenu:p,onSelectionContextMenu:g,onSelectionStart:v,onSelectionEnd:x,connectionLineType:y,connectionLineStyle:b,connectionLineComponent:w,connectionLineContainerStyle:k,selectionKeyCode:N,selectionOnDrag:C,selectionMode:E,multiSelectionKeyCode:S,panActivationKeyCode:j,zoomActivationKeyCode:_,deleteKeyCode:I,onlyRenderVisibleElements:A,elementsSelectable:M,selectNodesOnDrag:T,defaultViewport:O,translateExtent:D,minZoom:R,maxZoom:P,preventScrolling:F,defaultMarkerColor:L,zoomOnScroll:z,zoomOnPinch:B,panOnScroll:U,panOnScrollSpeed:V,panOnScrollMode:G,zoomOnDoubleClick:$,panOnDrag:H,onPaneClick:W,onPaneMouseEnter:q,onPaneMouseMove:Y,onPaneMouseLeave:X,onPaneScroll:K,onPaneContextMenu:J,onEdgeContextMenu:Z,onEdgeMouseEnter:Q,onEdgeMouseMove:ee,onEdgeMouseLeave:te,onReconnect:ne,onReconnectStart:oe,onReconnectEnd:re,reconnectRadius:ae,noDragClassName:se,noWheelClassName:ie,noPanClassName:le,elevateEdgesOnSelect:ce,disableKeyboardA11y:de,nodeOrigin:ue,nodeExtent:he,rfId:me})=>{const fe=Vj(e,mj),pe=Vj(t,Nj);return function(e){const t=AS(),n=r.useRef(!1);r.useEffect((()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout((()=>e(t)),1),n.current=!0)}),[e,t.viewportInitialized])}(s),u.createElement(hj,{onPaneClick:W,onPaneMouseEnter:q,onPaneMouseMove:Y,onPaneMouseLeave:X,onPaneContextMenu:J,onPaneScroll:K,deleteKeyCode:I,selectionKeyCode:N,selectionOnDrag:C,selectionMode:E,onSelectionStart:v,onSelectionEnd:x,multiSelectionKeyCode:S,panActivationKeyCode:j,zoomActivationKeyCode:_,elementsSelectable:M,onMove:n,onMoveStart:o,onMoveEnd:a,zoomOnScroll:z,zoomOnPinch:B,zoomOnDoubleClick:$,panOnScroll:U,panOnScrollSpeed:V,panOnScrollMode:G,panOnDrag:H,defaultViewport:O,translateExtent:D,minZoom:R,maxZoom:P,onSelectionContextMenu:g,preventScrolling:F,noDragClassName:se,noWheelClassName:ie,noPanClassName:le,disableKeyboardA11y:de},u.createElement(Fj,null,u.createElement(Rj,{edgeTypes:pe,onEdgeClick:l,onEdgeDoubleClick:d,onlyRenderVisibleElements:A,onEdgeContextMenu:Z,onEdgeMouseEnter:Q,onEdgeMouseMove:ee,onEdgeMouseLeave:te,onReconnect:ne,onReconnectStart:oe,onReconnectEnd:re,reconnectRadius:ae,defaultMarkerColor:L,noPanClassName:le,elevateEdgesOnSelect:!!ce,disableKeyboardA11y:de,rfId:me},u.createElement(Uj,{style:b,type:y,component:w,containerStyle:k})),u.createElement("div",{className:"react-flow__edgelabel-renderer"}),u.createElement(gj,{nodeTypes:fe,onNodeClick:i,onNodeDoubleClick:c,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:f,onNodeContextMenu:p,selectNodesOnDrag:T,onlyRenderVisibleElements:A,noPanClassName:le,noDragClassName:se,disableKeyboardA11y:de,nodeOrigin:ue,nodeExtent:he,rfId:me})))};Gj.displayName="GraphView";var $j=r.memo(Gj);const Hj=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Wj={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:Hj,nodeExtent:Hj,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:JC.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:(e,t)=>{},isValidConnection:void 0},qj=()=>{return e=(e,t)=>({...Wj,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:a}=t();e({nodeInternals:kS(n,o,r,a)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:o={}}=t();e({edges:n.map((e=>({...o,...e})))})},setDefaultNodesAndEdges:(n,o)=>{const r=void 0!==n,a=void 0!==o,s=r?kS(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:s,edges:a?o:[],hasDefaultNodes:r,hasDefaultEdges:a})},updateNodeDimensions:n=>{const{onNodesChange:o,nodeInternals:r,fitViewOnInit:a,fitViewOnInitDone:s,fitViewOnInitOptions:i,domNode:l,nodeOrigin:c}=t(),d=null==l?void 0:l.querySelector(".react-flow__viewport");if(!d)return;const u=window.getComputedStyle(d),{m22:h}=new window.DOMMatrixReadOnly(u.transform),m=n.reduce(((e,t)=>{const n=r.get(t.id);if(null==n?void 0:n.hidden)r.set(n.id,{...n,[UC]:{...n[UC],handleBounds:void 0}});else if(n){const o=MC(t.nodeElement);o.width&&o.height&&(n.width!==o.width||n.height!==o.height||t.forceUpdate)&&(r.set(n.id,{...n,[UC]:{...n[UC],handleBounds:{source:ej(".source",t.nodeElement,h,c),target:ej(".target",t.nodeElement,h,c)}},...o}),e.push({id:n.id,type:"dimensions",dimensions:o}))}return e}),[]);wS(r,c);const f=s||a&&!s&&NS(t,{initial:!0,...i});e({nodeInternals:new Map(r),fitViewOnInitDone:f}),(null==m?void 0:m.length)>0&&(null==o||o(m))},updateNodePositions:(e,n=!0,o=!1)=>{const{triggerNodeChanges:r}=t();r(e.map((e=>{const t={id:e.id,type:"position",dragging:o};return n&&(t.positionAbsolute=e.positionAbsolute,t.position=e.position),t})))},triggerNodeChanges:n=>{const{onNodesChange:o,nodeInternals:r,hasDefaultNodes:a,nodeOrigin:s,getNodes:i,elevateNodesOnSelect:l}=t();if(null==n?void 0:n.length){if(a){const t=kS(GS(n,i()),r,s,l);e({nodeInternals:t})}null==o||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:r,getNodes:a}=t();let s,i=null;o?s=n.map((e=>$S(e,!0))):(s=HS(a(),n),i=HS(r,[])),SS({changedNodes:s,changedEdges:i,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:o,edges:r,getNodes:a}=t();let s,i=null;o?s=n.map((e=>$S(e,!0))):(s=HS(r,n),i=HS(a(),[])),SS({changedNodes:i,changedEdges:s,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:a}=t(),s=o||r;SS({changedNodes:(n||a()).map((e=>(e.selected=!1,$S(e.id,!1)))),changedEdges:s.map((e=>$S(e.id,!1))),get:t,set:e})},setMinZoom:n=>{const{d3Zoom:o,maxZoom:r}=t();null==o||o.scaleExtent([n,r]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:o,minZoom:r}=t();null==o||o.scaleExtent([r,n]),e({maxZoom:n})},setTranslateExtent:n=>{var o;null==(o=t().d3Zoom)||o.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:o}=t();SS({changedNodes:o().filter((e=>e.selected)).map((e=>$S(e.id,!1))),changedEdges:n.filter((e=>e.selected)).map((e=>$S(e.id,!1))),get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:o}=t();o.forEach((e=>{e.positionAbsolute=OC(e.position,n)})),e({nodeExtent:n,nodeInternals:new Map(o)})},panBy:e=>{const{transform:n,width:o,height:r,d3Zoom:a,d3Selection:s,translateExtent:i}=t();if(!a||!s||!e.x&&!e.y)return!1;const l=_l.translate(n[0]+e.x,n[1]+e.y).scale(n[2]),c=[[0,0],[o,r]],d=null==a?void 0:a.constrain()(l,c,i);return a.transform(s,d),n[0]!==d.x||n[1]!==d.y||n[2]!==d.k},cancelConnection:()=>e({connectionNodeId:Wj.connectionNodeId,connectionHandleId:Wj.connectionHandleId,connectionHandleType:Wj.connectionHandleType,connectionStatus:Wj.connectionStatus,connectionStartHandle:Wj.connectionStartHandle,connectionEndHandle:Wj.connectionEndHandle}),reset:()=>e({...Wj})}),t=Object.is,e?GN(e,t):GN;var e,t},Yj=({children:e})=>{const t=r.useRef(null);return t.current||(t.current=qj()),u.createElement(pC,{value:t.current},e)};Yj.displayName="ReactFlowProvider";const Xj=({children:e})=>r.useContext(fC)?u.createElement(u.Fragment,null,e):u.createElement(Yj,null,e);Xj.displayName="ReactFlowWrapper";const Kj={input:KE,default:YE,output:ZE,group:QE},Jj={default:kE,straight:xE,step:vE,smoothstep:gE,simplebezier:uE},Zj=[0,0],Qj=[15,15],e_={x:0,y:0,zoom:1},t_={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},n_=r.forwardRef((({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:a=Kj,edgeTypes:s=Jj,onNodeClick:i,onEdgeClick:l,onInit:c,onMove:d,onMoveStart:h,onMoveEnd:m,onConnect:f,onConnectStart:p,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:x,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:w,onNodeContextMenu:k,onNodeDoubleClick:N,onNodeDragStart:C,onNodeDrag:E,onNodeDragStop:S,onNodesDelete:j,onEdgesDelete:_,onSelectionChange:I,onSelectionDragStart:A,onSelectionDrag:M,onSelectionDragStop:T,onSelectionContextMenu:O,onSelectionStart:D,onSelectionEnd:R,connectionMode:P=JC.Strict,connectionLineType:F=oE.Bezier,connectionLineStyle:L,connectionLineComponent:z,connectionLineContainerStyle:B,deleteKeyCode:U="Backspace",selectionKeyCode:V="Shift",selectionOnDrag:G=!1,selectionMode:$=tE.Full,panActivationKeyCode:H="Space",multiSelectionKeyCode:W=(WC()?"Meta":"Control"),zoomActivationKeyCode:q=(WC()?"Meta":"Control"),snapToGrid:Y=!1,snapGrid:X=Qj,onlyRenderVisibleElements:K=!1,selectNodesOnDrag:J=!0,nodesDraggable:Z,nodesConnectable:Q,nodesFocusable:ee,nodeOrigin:te=Zj,edgesFocusable:ne,edgesUpdatable:oe,elementsSelectable:re,defaultViewport:ae=e_,minZoom:se=.5,maxZoom:ie=2,translateExtent:le=Hj,preventScrolling:ce=!0,nodeExtent:de,defaultMarkerColor:ue="#b1b1b7",zoomOnScroll:he=!0,zoomOnPinch:me=!0,panOnScroll:fe=!1,panOnScrollSpeed:pe=.5,panOnScrollMode:ge=QC.Free,zoomOnDoubleClick:ve=!0,panOnDrag:xe=!0,onPaneClick:ye,onPaneMouseEnter:be,onPaneMouseMove:we,onPaneMouseLeave:ke,onPaneScroll:Ne,onPaneContextMenu:Ce,children:Ee,onEdgeContextMenu:Se,onEdgeDoubleClick:je,onEdgeMouseEnter:_e,onEdgeMouseMove:Ie,onEdgeMouseLeave:Ae,onEdgeUpdate:Me,onEdgeUpdateStart:Te,onEdgeUpdateEnd:Oe,onReconnect:De,onReconnectStart:Re,onReconnectEnd:Pe,reconnectRadius:Fe=10,edgeUpdaterRadius:Le=10,onNodesChange:ze,onEdgesChange:Be,noDragClassName:Ue="nodrag",noWheelClassName:Ve="nowheel",noPanClassName:Ge="nopan",fitView:$e=!1,fitViewOptions:He,connectOnClick:We=!0,attributionPosition:qe,proOptions:Ye,defaultEdgeOptions:Xe,elevateNodesOnSelect:Ke=!0,elevateEdgesOnSelect:Je=!1,disableKeyboardA11y:Ze=!1,autoPanOnConnect:Qe=!0,autoPanOnNodeDrag:et=!0,connectionRadius:tt=20,isValidConnection:nt,onError:ot,style:rt,id:at,nodeDragThreshold:st,...it},lt)=>{const ct=at||"1";return u.createElement("div",{...it,style:{...rt,...t_},ref:lt,className:LN(["react-flow",r]),"data-testid":"rf__wrapper",id:at},u.createElement(Xj,null,u.createElement($j,{onInit:c,onMove:d,onMoveStart:h,onMoveEnd:m,onNodeClick:i,onEdgeClick:l,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:w,onNodeContextMenu:k,onNodeDoubleClick:N,nodeTypes:a,edgeTypes:s,connectionLineType:F,connectionLineStyle:L,connectionLineComponent:z,connectionLineContainerStyle:B,selectionKeyCode:V,selectionOnDrag:G,selectionMode:$,deleteKeyCode:U,multiSelectionKeyCode:W,panActivationKeyCode:H,zoomActivationKeyCode:q,onlyRenderVisibleElements:K,selectNodesOnDrag:J,defaultViewport:ae,translateExtent:le,minZoom:se,maxZoom:ie,preventScrolling:ce,zoomOnScroll:he,zoomOnPinch:me,zoomOnDoubleClick:ve,panOnScroll:fe,panOnScrollSpeed:pe,panOnScrollMode:ge,panOnDrag:xe,onPaneClick:ye,onPaneMouseEnter:be,onPaneMouseMove:we,onPaneMouseLeave:ke,onPaneScroll:Ne,onPaneContextMenu:Ce,onSelectionContextMenu:O,onSelectionStart:D,onSelectionEnd:R,onEdgeContextMenu:Se,onEdgeDoubleClick:je,onEdgeMouseEnter:_e,onEdgeMouseMove:Ie,onEdgeMouseLeave:Ae,onReconnect:De??Me,onReconnectStart:Re??Te,onReconnectEnd:Pe??Oe,reconnectRadius:Fe??Le,defaultMarkerColor:ue,noDragClassName:Ue,noWheelClassName:Ve,noPanClassName:Ge,elevateEdgesOnSelect:Je,rfId:ct,disableKeyboardA11y:Ze,nodeOrigin:te,nodeExtent:de}),u.createElement(cS,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:f,onConnectStart:p,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:x,nodesDraggable:Z,nodesConnectable:Q,nodesFocusable:ee,edgesFocusable:ne,edgesUpdatable:oe,elementsSelectable:re,elevateNodesOnSelect:Ke,minZoom:se,maxZoom:ie,nodeExtent:de,onNodesChange:ze,onEdgesChange:Be,snapToGrid:Y,snapGrid:X,connectionMode:P,translateExtent:le,connectOnClick:We,defaultEdgeOptions:Xe,fitView:$e,fitViewOptions:He,onNodesDelete:j,onEdgesDelete:_,onNodeDragStart:C,onNodeDrag:E,onNodeDragStop:S,onSelectionDrag:M,onSelectionDragStart:A,onSelectionDragStop:T,noPanClassName:Ge,nodeOrigin:te,rfId:ct,autoPanOnConnect:Qe,autoPanOnNodeDrag:et,onError:ot,connectionRadius:tt,isValidConnection:nt,nodeDragThreshold:st}),u.createElement(aS,{onSelectionChange:I}),Ee,u.createElement(IC,{proOptions:Ye,position:qe}),u.createElement(gS,{rfId:ct,disableKeyboardA11y:Ze})))}));function o_(e){return t=>{const[n,o]=r.useState(t),a=r.useCallback((t=>o((n=>e(t,n)))),[]);return[n,o,a]}}n_.displayName="ReactFlow";const r_=o_(GS),a_=o_((function(e,t){return VS(e,t)}));function s_(){return u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},u.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function i_(){return u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},u.createElement("path",{d:"M0 0h32v4.2H0z"}))}function l_(){return u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},u.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 c_(){return u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},u.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 d_(){return u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},u.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 u_=({children:e,className:t,...n})=>u.createElement("button",{type:"button",className:LN(["react-flow__controls-button",t]),...n},e);u_.displayName="ControlButton";const h_=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),m_=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:a,onZoomIn:s,onZoomOut:i,onFitView:l,onInteractiveChange:c,className:d,children:h,position:m="bottom-left"})=>{const f=SC(),[p,g]=r.useState(!1),{isInteractive:v,minZoomReached:x,maxZoomReached:y}=EC(h_,$N),{zoomIn:b,zoomOut:w,fitView:k}=AS();if(r.useEffect((()=>{g(!0)}),[]),!p)return null;return u.createElement(_C,{className:LN(["react-flow__controls",d]),position:m,style:e,"data-testid":"rf__controls"},t&&u.createElement(u.Fragment,null,u.createElement(u_,{onClick:()=>{b(),null==s||s()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:y},u.createElement(s_,null)),u.createElement(u_,{onClick:()=>{w(),null==i||i()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:x},u.createElement(i_,null))),n&&u.createElement(u_,{className:"react-flow__controls-fitview",onClick:()=>{k(a),null==l||l()},title:"fit view","aria-label":"fit view"},u.createElement(l_,null)),o&&u.createElement(u_,{className:"react-flow__controls-interactive",onClick:()=>{f.setState({nodesDraggable:!v,nodesConnectable:!v,elementsSelectable:!v}),null==c||c(!v)},title:"toggle interactivity","aria-label":"toggle interactivity"},v?u.createElement(d_,null):u.createElement(c_,null)),h)};m_.displayName="Controls";var f_,p_,g_=r.memo(m_);function v_({color:e,dimensions:t,lineWidth:n}){return u.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function x_({color:e,radius:t}){return u.createElement("circle",{cx:t,cy:t,r:t,fill:e})}(p_=f_||(f_={})).Lines="lines",p_.Dots="dots",p_.Cross="cross";const y_={[f_.Dots]:"#91919a",[f_.Lines]:"#eee",[f_.Cross]:"#e2e2e2"},b_={[f_.Dots]:1,[f_.Lines]:1,[f_.Cross]:6},w_=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function k_({id:e,variant:t=f_.Dots,gap:n=20,size:o,lineWidth:a=1,offset:s=2,color:i,style:l,className:c}){const d=r.useRef(null),{transform:h,patternId:m}=EC(w_,$N),f=i||y_[t],p=o||b_[t],g=t===f_.Dots,v=t===f_.Cross,x=Array.isArray(n)?n:[n,n],y=[x[0]*h[2]||1,x[1]*h[2]||1],b=p*h[2],w=v?[b,b]:y,k=g?[b/s,b/s]:[w[0]/s,w[1]/s];return u.createElement("svg",{className:LN(["react-flow__background",c]),style:{...l,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:d,"data-testid":"rf__background"},u.createElement("pattern",{id:m+e,x:h[0]%y[0],y:h[1]%y[1],width:y[0],height:y[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`},g?u.createElement(x_,{color:f,radius:b/s}):u.createElement(v_,{dimensions:w,color:f,lineWidth:a})),u.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}k_.displayName="Background";var N_=r.memo(k_);function C_(e){return Math.min(11*e+35,200)}const E_=u.createContext("LR"),S_=r.memo((e=>{const t=b(51),{data:n,selected:o}=e,a=le(n.atom),s=he().inOrderIds.indexOf(a.id),i=o?"var(--gray-9)":"var(--gray-3)",l=EC(__),c=r.useContext(E_);let d,u,h,m,f;if(t[0]!==a.code||t[1]!==c||t[2]!==i||t[3]!==o){const e=a.code.split("\n").length,n="LR"===c?iE.Left:iE.Top;let r;t[8]!==i?(r={background:i},t[8]=i,t[9]=r):r=t[9],t[10]!==n||t[11]!==r?(h=k.jsx(WE,{type:"target",id:"inputs",position:n,style:r}),t[10]=n,t[11]=r,t[12]=h):h=t[12];const s="LR"===c?iE.Left:iE.Top;let l;t[13]!==i?(l={background:i},t[13]=i,t[14]=l):l=t[14],t[15]!==s||t[16]!==l?(m=k.jsx(WE,{type:"source",id:"inputs",position:s,style:l}),t[15]=s,t[16]=l,t[17]=m):m=t[17];const f=o&&"border-primary";t[18]!==f?(u=on("flex flex-col bg-card border border-input/50 rounded-md mx-[2px] overflow-hidden",f),t[18]=f,t[19]=u):u=t[19],d=C_(e),t[0]=a.code,t[1]=c,t[2]=i,t[3]=o,t[4]=d,t[5]=u,t[6]=h,t[7]=m}else d=t[4],u=t[5],h=t[6],m=t[7];var p;let g;t[20]!==n.forceWidth||t[21]!==l?(f=n.forceWidth||(p=l,Math.min(Math.max(p-100,100),400)),t[20]=n.forceWidth,t[21]=l,t[22]=f):f=t[22],t[23]!==d||t[24]!==f?(g={height:d,width:f},t[23]=d,t[24]=f,t[25]=g):g=t[25];const v=fs(a.name,s);let x,y,w;t[26]!==v?(x=k.jsx("div",{className:"text-muted-foreground font-semibold text-xs py-1 px-2 bg-muted border-b",children:v}),t[26]=v,t[27]=x):x=t[27],t[28]!==a.code?(y=k.jsx(Sl,{code:a.code}),t[28]=a.code,t[29]=y):y=t[29],t[30]!==u||t[31]!==g||t[32]!==x||t[33]!==y?(w=k.jsxs("div",{className:u,style:g,children:[x,y]}),t[30]=u,t[31]=g,t[32]=x,t[33]=y,t[34]=w):w=t[34];const N="LR"===c?iE.Right:iE.Bottom;let C,E;t[35]!==i?(C={background:i},t[35]=i,t[36]=C):C=t[36],t[37]!==N||t[38]!==C?(E=k.jsx(WE,{type:"source",id:"outputs",position:N,style:C}),t[37]=N,t[38]=C,t[39]=E):E=t[39];const S="LR"===c?iE.Right:iE.Bottom;let j,_,I;return t[40]!==i?(j={background:i},t[40]=i,t[41]=j):j=t[41],t[42]!==S||t[43]!==j?(_=k.jsx(WE,{type:"target",id:"outputs",position:S,style:j}),t[42]=S,t[43]=j,t[44]=_):_=t[44],t[45]!==h||t[46]!==m||t[47]!==w||t[48]!==E||t[49]!==_?(I=k.jsxs("div",{children:[h,m,w,E,_]}),t[45]=h,t[46]=m,t[47]=w,t[48]=E,t[49]=_,t[50]=I):I=t[50],I}),((e,t)=>["data","selected","id"].every((n=>e[n]===t[n]))));S_.displayName="CustomNode";const j_={custom:S_};function __(e){const{width:t}=e;return t}const I_=e=>{const t=b(18),{maxCount:n,cellIds:o,onClick:r,skipScroll:a}=e,s=he();let i,l,c,d;if(t[0]!==o||t[1]!==s.inOrderIds||t[2]!==n||t[3]!==a||t[4]!==r){c=Symbol.for("react.early_return_sentinel");e:{let e;t[8]!==s.inOrderIds?(e=(e,t)=>s.inOrderIds.indexOf(e)-s.inOrderIds.indexOf(t),t[8]=s.inOrderIds,t[9]=e):e=t[9];const d=[...o].sort(e);if(0===o.length){let e;t[10]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx("div",{className:"text-muted-foreground",children:"--"}),t[10]=e):e=t[10],c=e;break e}let u;t[11]!==a||t[12]!==r||t[13]!==o.length?(u=(e,t)=>k.jsxs("span",{className:"truncate",children:[k.jsx(ps,{variant:"focus",cellId:e,skipScroll:a,className:"whitespace-nowrap",onClick:r?()=>r(e):void 0},e),t<o.length-1&&", "]},e),t[11]=a,t[12]=r,t[13]=o.length,t[14]=u):u=t[14],i=d.slice(0,n).map(u),l=o.length>n&&k.jsxs(hn,{children:[k.jsx(xr,{asChild:!0,children:k.jsxs("span",{className:"whitespace-nowrap text-muted-foreground text-xs hover:underline cursor-pointer",children:["+",o.length-n," more"]})}),k.jsx(un,{className:"w-auto",children:k.jsx("div",{className:"flex flex-col gap-1 py-1",children:d.slice(n).map((e=>k.jsx(ps,{variant:"focus",cellId:e,className:"whitespace-nowrap",onClick:r?()=>r(e):void 0},e)))})})]})}t[0]=o,t[1]=s.inOrderIds,t[2]=n,t[3]=a,t[4]=r,t[5]=i,t[6]=l,t[7]=c}else i=t[5],l=t[6],c=t[7];return c!==Symbol.for("react.early_return_sentinel")?c:(t[15]!==i||t[16]!==l?(d=k.jsxs(k.Fragment,{children:[i,l]}),t[15]=i,t[16]=l,t[17]=d):d=t[17],d)},A_=e=>{const t=b(15);let n,o,r,a;t[0]!==e?(({name:r,declaredBy:n,onClick:o,...a}=e),t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=a):(n=t[1],o=t[2],r=t[3],a=t[4]);const s=n.length>1?"destructive":"outline";let i,l,c;return t[5]!==o||t[6]!==r?(i=async e=>{o?o(e):(await et(r),re({title:"Copied to clipboard"}))},t[5]=o,t[6]=r,t[7]=i):i=t[7],t[8]!==r||t[9]!==s||t[10]!==i?(l=k.jsx(gs,{title:r,variant:s,className:"rounded-sm text-ellipsis block overflow-hidden max-w-fit cursor-pointer font-medium",onClick:i,children:r}),t[8]=r,t[9]=s,t[10]=i,t[11]=l):l=t[11],t[12]!==a||t[13]!==l?(c=k.jsx("div",{className:"max-w-[130px]",...a,children:l}),t[12]=a,t[13]=l,t[14]=c):c=t[14],c},M_=r.memo((e=>{const t=b(38),{onChange:n,view:o,settings:r,onSettingsChange:a}=e;let s;t[0]!==a||t[1]!==r?(s=(e,t)=>{a({...r,[e]:t})},t[0]=a,t[1]=r,t[2]=s):s=t[2];const i=s;let l,c,d,u,h,m;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=k.jsx(xr,{asChild:!0,children:k.jsx(E,{variant:"text",size:"xs",children:k.jsx(At,{className:"w-4 h-4"})})}),t[3]=l):l=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx("div",{className:"font-semibold pb-4",children:"Settings"}),t[4]=c):c=t[4],t[5]!==i?(d=e=>i("hidePureMarkdown",Boolean(e)),t[5]=i,t[6]=d):d=t[6],t[7]!==r.hidePureMarkdown||t[8]!==d?(u=k.jsx(Wr,{"data-testid":"hide-pure-markdown-checkbox",id:"hide-pure-markdown",checked:r.hidePureMarkdown,onCheckedChange:d}),t[7]=r.hidePureMarkdown,t[8]=d,t[9]=u):u=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(h=k.jsx(Ae,{htmlFor:"hide-pure-markdown",children:"Hide pure markdown"}),t[10]=h):h=t[10],t[11]!==u?(m=k.jsxs(hn,{children:[l,k.jsxs(un,{className:"w-auto p-2 text-muted-foreground",children:[c,k.jsxs("div",{className:"flex items-center gap-2",children:[u,h]})]})]}),t[11]=u,t[12]=m):m=t[12];const f=m,p="_minimap_"===o;let g,v,x;t[13]!==n?(g=()=>n("_minimap_"),t[13]=n,t[14]=g):g=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(v=k.jsx(_c,{className:"w-4 h-4 mr-1"}),t[15]=v):v=t[15],t[16]!==p||t[17]!==g?(x=k.jsxs(E,{variant:"outline",className:"bg-background","aria-selected":p,size:"xs",onClick:g,children:[v,"Mini Map"]}),t[16]=p,t[17]=g,t[18]=x):x=t[18];const y="TB"===o;let w,N,C;t[19]!==n?(w=()=>n("TB"),t[19]=n,t[20]=w):w=t[20],t[21]===Symbol.for("react.memo_cache_sentinel")?(N=k.jsx(gc,{className:"w-4 h-4 mr-1"}),t[21]=N):N=t[21],t[22]!==y||t[23]!==w?(C=k.jsxs(E,{variant:"outline",className:"bg-background","aria-selected":y,size:"xs",onClick:w,children:[N,"Vertical Tree"]}),t[22]=y,t[23]=w,t[24]=C):C=t[24];const S="LR"===o;let j,_,I,A;t[25]!==n?(j=()=>n("LR"),t[25]=n,t[26]=j):j=t[26],t[27]===Symbol.for("react.memo_cache_sentinel")?(_=k.jsx(gc,{className:"w-4 h-4 mr-1 transform -rotate-90"}),t[27]=_):_=t[27],t[28]!==S||t[29]!==j?(I=k.jsxs(E,{variant:"outline",className:"bg-background","aria-selected":S,size:"xs",onClick:j,children:[_," ","Horizontal Tree"]}),t[28]=S,t[29]=j,t[30]=I):I=t[30],t[31]!==x||t[32]!==C||t[33]!==I?(A=k.jsxs("div",{className:"flex gap-2",children:[x,C,I]}),t[31]=x,t[32]=C,t[33]=I,t[34]=A):A=t[34];const M="_minimap_"!==o&&f;let T;return t[35]!==A||t[36]!==M?(T=k.jsxs(_C,{position:"top-right",className:"flex flex-col items-end gap-2",children:[A,M]}),t[35]=A,t[36]=M,t[37]=T):T=t[37],T}));M_.displayName="GraphToolbar";const T_=r.memo((e=>{const t=b(11),{selection:n,variables:o,onClearSelection:r}=e;if(!n)return null;const a=O_;let s;t[0]!==n.type||t[1]!==n.id||t[2]!==n.source||t[3]!==n.target||t[4]!==o||t[5]!==r?(s=()=>{if("node"===n.type){const e=Object.values(o).filter((e=>e.usedBy.includes(n.id))),t=Object.values(o).filter((e=>e.declaredBy.includes(n.id))),s=(e,t)=>k.jsxs(k.Fragment,{children:[0===e.length&&k.jsx("div",{className:"text-muted-foreground text-sm text-center",children:"--"}),k.jsx("div",{className:"grid grid-cols-5 gap-3 items-center text-sm py-1 flex-1 empty:hidden",children:e.map((e=>k.jsxs(u.Fragment,{children:[k.jsx(A_,{declaredBy:e.declaredBy,name:e.name}),k.jsxs("div",{className:"truncate col-span-2",title:e.value??"",children:[e.value,k.jsxs("span",{className:"ml-1 truncate text-foreground/60 font-mono",children:["(",e.dataType,")"]})]}),k.jsx("div",{className:"truncate col-span-2 gap-1 items-center",children:k.jsx(I_,{skipScroll:!0,onClick:()=>a("in"===t?e.declaredBy[0]:e.usedBy[0],e.name),maxCount:3,cellIds:e.usedBy})})]},e.name)))})]});return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[k.jsx(ct,{className:"w-5 h-5"}),k.jsx(ps,{cellId:n.id}),k.jsx("div",{className:"flex-1"}),k.jsx(ty,{cellId:n.id,children:k.jsx(E,{variant:"ghost",size:"icon",children:k.jsx(Zl,{className:"w-4 h-4"})})}),k.jsx(E,{variant:"text",size:"icon",onClick:()=>{r()},children:k.jsx(en,{className:"w-4 h-4"})})]}),k.jsxs("div",{className:"text-sm flex flex-col py-3 pl-2 pr-4 flex-1 justify-center",children:[k.jsxs("div",{className:"flex flex-col gap-2",children:[k.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[k.jsx(Rl,{className:"w-4 h-4"}),"Outputs"]}),s(t,"out")]}),k.jsx("hr",{className:"border-divider my-3"}),k.jsxs("div",{className:"flex flex-col gap-2",children:[k.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[k.jsx(Pl,{className:"w-4 h-4"}),"Inputs"]}),s(e,"in")]})]})]})}if("edge"===n.type){const e=Object.values(o).filter((e=>e.declaredBy.includes(n.source)&&e.usedBy.includes(n.target)));return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[k.jsx(qc,{className:"w-4 h-4"}),k.jsx(ps,{cellId:n.source}),k.jsx(Fl,{className:"w-4 h-4"}),k.jsx(ps,{cellId:n.target})]}),k.jsx("div",{className:"grid grid-cols-4 gap-3 max-w-[350px] items-center text-sm p-3 flex-1",children:e.map((e=>k.jsxs(u.Fragment,{children:[k.jsx(A_,{declaredBy:e.declaredBy,name:e.name,onClick:()=>{a(e.declaredBy[0],e.name)}}),k.jsx("div",{className:"truncate text-foreground/60 font-mono",children:e.dataType}),k.jsx("div",{className:"truncate col-span-2",title:e.value??"",children:e.value})]},e.name)))})]})}},t[0]=n.type,t[1]=n.id,t[2]=n.source,t[3]=n.target,t[4]=o,t[5]=r,t[6]=s):s=t[6];const i=s;let l,c;return t[7]!==i?(l=i(),t[7]=i,t[8]=l):l=t[8],t[9]!==l?(c=k.jsx(_C,{position:"bottom-left",className:"max-h-[90%] flex flex-col w-[calc(100%-5rem)]",children:k.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})}),t[9]=l,t[10]=c):c=t[10],c}));function O_(e,t){const n=qr(e);n&&vs(n,t)}function D_(){const e=b(7),t=AS(),n=EC(P_),o=EC(R_);let a;e[0]!==t?(a=()=>{t.fitView({duration:100})},e[0]=t,e[1]=a):a=e[1];const s=xs(a,100);let i,l;e[2]!==n||e[3]!==o||e[4]!==s?(i=()=>{n&&o&&s()},l=[n,o,s],e[2]=n,e[3]=o,e[4]=s,e[5]=i,e[6]=l):(i=e[5],l=e[6]),r.useEffect(i,l)}function R_(e){const{height:t}=e;return t}function P_(e){const{width:t}=e;return t}T_.displayName="GraphSelectionPanel";const F_=new class{createEdge(e,t,n){return{type:"smoothstep",pathOptions:{offset:20,borderRadius:100},data:{direction:n},markerEnd:{type:aE.Arrow},id:`${e}-${t}-${n}`,source:e,sourceHandle:n,targetHandle:n,target:t}}createNode(e,t,n){return{id:e,data:{atom:t},width:250,type:"custom",height:C_(te.get(t).code.trim().split("\n").length),position:{x:0,y:n+20}}}createElements(e,t,n,o){let r=0;const a=[],s=[];for(const[l,c]of Aa.zip(e,t)){const e=this.createNode(l,c,r);a.push(e),r=e.position.y+(e.height||0)}const i=new Set;for(const l of Object.values(n)){const{declaredBy:e,usedBy:t}=l;for(const n of e)for(const e of t){const t=`${n}-${e}`;i.has(t)||(i.add(t),s.push(this.createEdge(n,e,"inputs"),this.createEdge(n,e,"outputs")))}}return{nodes:a,edges:s}}},L_=e=>{const t=b(37),{cellIds:n,variables:o,cellAtoms:a,children:s}=e;let i;t[0]!==n||t[1]!==a||t[2]!==o?(i=F_.createElements(n,a,o,!1),t[0]=n,t[1]=a,t[2]=o,t[3]=i):i=t[3];const{nodes:l,edges:c}=i;let d;t[4]===Symbol.for("react.memo_cache_sentinel")?(d=[],t[4]=d):d=t[4];const[u,h]=a_(d),[m,f]=r_(l),[p,g]=r.useState(),[v,x]=r.useState(),y=r.useRef(!1);D_();const w=EC(z_);let N;t[5]!==f||t[6]!==h?(N=e=>{f(e.nodes),h([])},t[5]=f,t[6]=h,t[7]=N):N=t[7];const C=W(N);let E,S,j,_;t[8]!==C||t[9]!==n||t[10]!==a||t[11]!==o?(E=()=>{y.current?C(F_.createElements(n,a,o,!1)):y.current=!0},S=[n,o,a,C],t[8]=C,t[9]=n,t[10]=a,t[11]=o,t[12]=E,t[13]=S):(E=t[12],S=t[13]),r.useEffect(E,S),t[14]!==p||t[15]!==c||t[16]!==h?(j=()=>{if(p){const e=c.filter((e=>{const{source:t,target:n,data:o}=e;return t===p&&"outputs"===o.direction||n===p&&"inputs"===o.direction}));h(e)}},_=[p,h,c],t[14]=p,t[15]=c,t[16]=h,t[17]=j,t[18]=_):(j=t[17],_=t[18]),r.useEffect(j,_);const I=function(e,t){const n=b(17);let o,r;if(n[0]!==t||n[1]!==e){let o;n[3]!==t?(o=(e,n)=>{const{position:o}=n;return Math.min(e,o.y-t/2-10)},n[3]=t,n[4]=o):o=n[4],r=e.reduce(o,Number.POSITIVE_INFINITY),n[0]=t,n[1]=e,n[2]=r}else r=n[2];const a=r;let s;if(n[5]!==t||n[6]!==e){let o;n[8]!==t?(o=(e,n)=>{const{position:o}=n;return Math.max(e,o.y+t/2+10)},n[8]=t,n[9]=o):o=n[9],s=e.reduce(o,Number.NEGATIVE_INFINITY),n[5]=t,n[6]=e,n[7]=s}else s=n[7];const i=s;let l,c,d;n[10]!==a?(l=[Number.NEGATIVE_INFINITY,a],n[10]=a,n[11]=l):l=n[11];n[12]!==i?(c=[Number.POSITIVE_INFINITY,i],n[12]=i,n[13]=c):c=n[13];n[14]!==l||n[15]!==c?(d=[l,c],n[14]=l,n[15]=c,n[16]=d):d=n[16];return o=d,o}(m,w);let A;t[19]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{g(void 0),x(void 0)},t[19]=A):A=t[19];const M=A;let T;t[20]!==v||t[21]!==o||t[22]!==u||t[23]!==p?(T=()=>v?k.jsx(T_,{selection:{type:"edge",source:v.source,target:v.target},onClearSelection:M,variables:o,edges:u}):p?k.jsx(T_,{selection:{type:"node",id:p},variables:o,edges:u,onClearSelection:M}):null,t[20]=v,t[21]=o,t[22]=u,t[23]=p,t[24]=T):T=t[24];const O=T;let D,R,P,F;return t[25]!==h?(D=(e,t)=>{const n=t.id;g(n),x(void 0),h([])},t[25]=h,t[26]=D):D=t[26],t[27]===Symbol.for("react.memo_cache_sentinel")?(R=(e,t)=>{x(t)},t[27]=R):R=t[27],t[28]!==O?(P=O(),t[28]=O,t[29]=P):P=t[29],t[30]!==m||t[31]!==u||t[32]!==I||t[33]!==D||t[34]!==P||t[35]!==s?(F=k.jsxs(n_,{nodes:m,edges:u,nodeTypes:j_,translateExtent:I,onNodeClick:D,onNodeDoubleClick:B_,onEdgeClick:R,snapToGrid:!0,fitView:!0,elementsSelectable:!0,minZoom:1,maxZoom:1,draggable:!1,panOnScrollMode:QC.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:[P,s]}),t[30]=m,t[31]=u,t[32]=I,t[33]=D,t[34]=P,t[35]=s,t[36]=F):F=t[36],F};function z_(e){const{height:t}=e;return t}function B_(e,t){ys(t.id,"focus")}var U_="\0";function V_(e,t){e[t]?e[t]++:e[t]=1}function G_(e,t){--e[t]||delete e[t]}function $_(e,t,n,o){var r=""+t,a=""+n;if(!e&&r>a){var s=r;r=a,a=s}return r+""+a+""+(void 0===o?"\0":o)}function H_(e,t){return $_(e,t.v,t.w,t.name)}var W_=class{constructor(e){n(this,"_isDirected",!0),n(this,"_isMultigraph",!1),n(this,"_isCompound",!1),n(this,"_label"),n(this,"_defaultNodeLabelFn",(()=>{})),n(this,"_defaultEdgeLabelFn",(()=>{})),n(this,"_nodes",{}),n(this,"_in",{}),n(this,"_preds",{}),n(this,"_out",{}),n(this,"_sucs",{}),n(this,"_edgeObjs",{}),n(this,"_edgeLabels",{}),n(this,"_nodeCount",0),n(this,"_edgeCount",0),n(this,"_parent"),n(this,"_children"),e&&(this._isDirected=!Object.hasOwn(e,"directed")||e.directed,this._isMultigraph=!!Object.hasOwn(e,"multigraph")&&e.multigraph,this._isCompound=!!Object.hasOwn(e,"compound")&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children[U_]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=e,"function"!=typeof e&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter((t=>0===Object.keys(e._in[t]).length))}sinks(){var e=this;return this.nodes().filter((t=>0===Object.keys(e._out[t]).length))}setNodes(e,t){var n=arguments,o=this;return e.forEach((function(e){n.length>1?o.setNode(e,t):o.setNode(e)})),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=U_,this._children[e]={},this._children[U_][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var n=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach((function(e){t.setParent(e)})),delete this._children[e]),Object.keys(this._in[e]).forEach(n),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(void 0===t)t=U_;else{for(var n=t+="";void 0!==n;n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==U_)return t}}children(e=U_){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else{if(e===U_)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){const o=new Set(t);for(var n of this.successors(e))o.add(n);return Array.from(o.values())}}isLeaf(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;Object.entries(this._nodes).forEach((function([n,o]){e(n)&&t.setNode(n,o)})),Object.values(this._edgeObjs).forEach((function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))}));var o={};function r(e){var a=n.parent(e);return void 0===a||t.hasNode(a)?(o[e]=a,a):a in o?o[a]:r(a)}return this._isCompound&&t.nodes().forEach((e=>t.setParent(e,r(e)))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,"function"!=typeof e&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var n=this,o=arguments;return e.reduce((function(e,r){return o.length>1?n.setEdge(e,r,t):n.setEdge(e,r),r})),this}setEdge(){var e,t,n,o,r=!1,a=arguments[0];"object"==typeof a&&null!==a&&"v"in a?(e=a.v,t=a.w,n=a.name,2===arguments.length&&(o=arguments[1],r=!0)):(e=a,t=arguments[1],n=arguments[3],arguments.length>2&&(o=arguments[2],r=!0)),e=""+e,t=""+t,void 0!==n&&(n=""+n);var s=$_(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,s))return r&&(this._edgeLabels[s]=o),this;if(void 0!==n&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[s]=r?o:this._defaultEdgeLabelFn(e,t,n);var i=function(e,t,n,o){var r=""+t,a=""+n;if(!e&&r>a){var s=r;r=a,a=s}var i={v:r,w:a};o&&(i.name=o);return i}(this._isDirected,e,t,n);return e=i.v,t=i.w,Object.freeze(i),this._edgeObjs[s]=i,V_(this._preds[t],e),V_(this._sucs[e],t),this._in[t][s]=i,this._out[e][s]=i,this._edgeCount++,this}edge(e,t,n){var o=1===arguments.length?H_(this._isDirected,arguments[0]):$_(this._isDirected,e,t,n);return this._edgeLabels[o]}edgeAsObj(){const e=this.edge(...arguments);return"object"!=typeof e?{label:e}:e}hasEdge(e,t,n){var o=1===arguments.length?H_(this._isDirected,arguments[0]):$_(this._isDirected,e,t,n);return Object.hasOwn(this._edgeLabels,o)}removeEdge(e,t,n){var o=1===arguments.length?H_(this._isDirected,arguments[0]):$_(this._isDirected,e,t,n),r=this._edgeObjs[o];return r&&(e=r.v,t=r.w,delete this._edgeLabels[o],delete this._edgeObjs[o],G_(this._preds[t],e),G_(this._sucs[e],t),delete this._in[t][o],delete this._out[e][o],this._edgeCount--),this}inEdges(e,t){var n=this._in[e];if(n){var o=Object.values(n);return t?o.filter((e=>e.v===t)):o}}outEdges(e,t){var n=this._out[e];if(n){var o=Object.values(n);return t?o.filter((e=>e.w===t)):o}}nodeEdges(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}},q_={Graph:W_,version:"2.2.4"},Y_=W_,X_={write:function(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:K_(e),edges:J_(e)};void 0!==e.graph()&&(t.value=structuredClone(e.graph()));return t},read:function(e){var t=new Y_(e.options).setGraph(e.value);return e.nodes.forEach((function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)})),e.edges.forEach((function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)})),t}};function K_(e){return e.nodes().map((function(t){var n=e.node(t),o=e.parent(t),r={v:t};return void 0!==n&&(r.value=n),void 0!==o&&(r.parent=o),r}))}function J_(e){return e.edges().map((function(t){var n=e.edge(t),o={v:t.v,w:t.w};return void 0!==t.name&&(o.name=t.name),void 0!==n&&(o.value=n),o}))}var Z_=function(e){var t,n={},o=[];function r(o){Object.hasOwn(n,o)||(n[o]=!0,t.push(o),e.successors(o).forEach(r),e.predecessors(o).forEach(r))}return e.nodes().forEach((function(e){t=[],r(e),t.length&&o.push(t)})),o};var Q_=class{constructor(){n(this,"_arr",[]),n(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map((function(e){return e.key}))}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var t=this._keyIndices[e];if(void 0!==t)return this._arr[t].priority}min(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key}add(e,t){var n=this._keyIndices;if(e=String(e),!Object.hasOwn(n,e)){var o=this._arr,r=o.length;return n[e]=r,o.push({key:e,priority:t}),this._decrease(r),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[n].priority+" New: "+t);this._arr[n].priority=t,this._decrease(n)}_heapify(e){var t=this._arr,n=2*e,o=n+1,r=e;n<t.length&&(r=t[n].priority<t[r].priority?n:r,o<t.length&&(r=t[o].priority<t[r].priority?o:r),r!==e&&(this._swap(e,r),this._heapify(r)))}_decrease(e){for(var t,n=this._arr,o=n[e].priority;0!==e&&!(n[t=e>>1].priority<o);)this._swap(e,t),e=t}_swap(e,t){var n=this._arr,o=this._keyIndices,r=n[e],a=n[t];n[e]=a,n[t]=r,o[a.key]=e,o[r.key]=t}},eI=Q_,tI=function(e,t,n,o){return function(e,t,n,o){var r,a,s={},i=new eI,l=function(e){var t=e.v!==r?e.v:e.w,o=s[t],l=n(e),c=a.distance+l;if(l<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+l);c<o.distance&&(o.distance=c,o.predecessor=r,i.decrease(t,c))};e.nodes().forEach((function(e){var n=e===t?0:Number.POSITIVE_INFINITY;s[e]={distance:n},i.add(e,n)}));for(;i.size()>0&&(r=i.removeMin(),(a=s[r]).distance!==Number.POSITIVE_INFINITY);)o(r).forEach(l);return s}(e,String(t),n||nI,o||function(t){return e.outEdges(t)})},nI=()=>1;var oI=tI,rI=function(e,t,n){return e.nodes().reduce((function(o,r){return o[r]=oI(e,r,t,n),o}),{})};var aI=function(e){var t=0,n=[],o={},r=[];function a(s){var i=o[s]={onStack:!0,lowlink:t,index:t++};if(n.push(s),e.successors(s).forEach((function(e){Object.hasOwn(o,e)?o[e].onStack&&(i.lowlink=Math.min(i.lowlink,o[e].index)):(a(e),i.lowlink=Math.min(i.lowlink,o[e].lowlink))})),i.lowlink===i.index){var l,c=[];do{l=n.pop(),o[l].onStack=!1,c.push(l)}while(s!==l);r.push(c)}}return e.nodes().forEach((function(e){Object.hasOwn(o,e)||a(e)})),r};var sI=aI,iI=function(e){return sI(e).filter((function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])}))};var lI=function(e,t,n){return function(e,t,n){var o={},r=e.nodes();return r.forEach((function(e){o[e]={},o[e][e]={distance:0},r.forEach((function(t){e!==t&&(o[e][t]={distance:Number.POSITIVE_INFINITY})})),n(e).forEach((function(n){var r=n.v===e?n.w:n.v,a=t(n);o[e][r]={distance:a,predecessor:e}}))})),r.forEach((function(e){var t=o[e];r.forEach((function(n){var a=o[n];r.forEach((function(n){var o=a[e],r=t[n],s=a[n],i=o.distance+r.distance;i<s.distance&&(s.distance=i,s.predecessor=r.predecessor)}))}))})),o}(e,t||cI,n||function(t){return e.outEdges(t)})},cI=()=>1;function dI(e){var t={},n={},o=[];if(e.sinks().forEach((function r(a){if(Object.hasOwn(n,a))throw new uI;Object.hasOwn(t,a)||(n[a]=!0,t[a]=!0,e.predecessors(a).forEach(r),delete n[a],o.push(a))})),Object.keys(t).length!==e.nodeCount())throw new uI;return o}class uI extends Error{constructor(){super(...arguments)}}var hI=dI;dI.CycleException=uI;var mI=hI;var fI=function(e,t,n){Array.isArray(t)||(t=[t]);var o=e.isDirected()?t=>e.successors(t):t=>e.neighbors(t),r="post"===n?pI:gI,a=[],s={};return t.forEach((t=>{if(!e.hasNode(t))throw new Error("Graph does not have node: "+t);r(t,o,s,a)})),a};function pI(e,t,n,o){for(var r=[[e,!1]];r.length>0;){var a=r.pop();a[1]?o.push(a[0]):Object.hasOwn(n,a[0])||(n[a[0]]=!0,r.push([a[0],!0]),vI(t(a[0]),(e=>r.push([e,!1]))))}}function gI(e,t,n,o){for(var r=[e];r.length>0;){var a=r.pop();Object.hasOwn(n,a)||(n[a]=!0,o.push(a),vI(t(a),(e=>r.push(e))))}}function vI(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}var xI=fI;var yI=fI;var bI=W_,wI=Q_;var kI={Graph:q_.Graph,json:X_,alg:{components:Z_,dijkstra:tI,dijkstraAll:rI,findCycles:iI,floydWarshall:lI,isAcyclic:function(e){try{mI(e)}catch(t){if(t instanceof mI.CycleException)return!1;throw t}return!0},postorder:function(e,t){return xI(e,t,"post")},preorder:function(e,t){return yI(e,t,"pre")},prim:function(e,t){var n,o=new bI,r={},a=new wI;function s(e){var o=e.v===n?e.w:e.v,s=a.priority(o);if(void 0!==s){var i=t(e);i<s&&(r[o]=n,a.decrease(o,i))}}if(0===e.nodeCount())return o;e.nodes().forEach((function(e){a.add(e,Number.POSITIVE_INFINITY),o.setNode(e)})),a.decrease(e.nodes()[0],0);var i=!1;for(;a.size()>0;){if(n=a.removeMin(),Object.hasOwn(r,n))o.setEdge(n,r[n]);else{if(i)throw new Error("Input graph is not connected: "+e);i=!0}e.nodeEdges(n).forEach(s)}return o},tarjan:aI,topsort:hI},version:q_.version};function NI(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function CI(e,t){if("_next"!==e&&"_prev"!==e)return t}let EI=kI.Graph,SI=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return NI(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&NI(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,CI)),n=n._prev;return"["+e.join(", ")+"]"}};var jI=function(e,t){if(e.nodeCount()<=1)return[];let n=function(e,t){let n=new EI,o=0,r=0;e.nodes().forEach((e=>{n.setNode(e,{v:e,in:0,out:0})})),e.edges().forEach((e=>{let a=n.edge(e.v,e.w)||0,s=t(e),i=a+s;n.setEdge(e.v,e.w,i),r=Math.max(r,n.node(e.v).out+=s),o=Math.max(o,n.node(e.w).in+=s)}));let a=function(e){const t=[];for(let n=0;n<e;n++)t.push(n);return t}(r+o+3).map((()=>new SI)),s=o+1;return n.nodes().forEach((e=>{AI(a,s,n.node(e))})),{graph:n,buckets:a,zeroIdx:s}}(e,t||_I);return function(e,t,n){let o,r=[],a=t[t.length-1],s=t[0];for(;e.nodeCount();){for(;o=s.dequeue();)II(e,t,n,o);for(;o=a.dequeue();)II(e,t,n,o);if(e.nodeCount())for(let a=t.length-2;a>0;--a)if(o=t[a].dequeue(),o){r=r.concat(II(e,t,n,o,!0));break}}return r}(n.graph,n.buckets,n.zeroIdx).flatMap((t=>e.outEdges(t.v,t.w)))};let _I=()=>1;function II(e,t,n,o,r){let a=r?[]:void 0;return e.inEdges(o.v).forEach((o=>{let s=e.edge(o),i=e.node(o.v);r&&a.push({v:o.v,w:o.w}),i.out-=s,AI(t,n,i)})),e.outEdges(o.v).forEach((o=>{let r=e.edge(o),a=o.w,s=e.node(a);s.in-=r,AI(t,n,s)})),e.removeNode(o.v),a}function AI(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}let MI=kI.Graph;var TI={addBorderNode:function(e,t,n,o){let r={width:0,height:0};arguments.length>=4&&(r.rank=n,r.order=o);return OI(e,"border",r,t)},addDummyNode:OI,applyWithChunking:RI,asNonCompoundGraph:function(e){let t=new MI({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach((n=>{e.children(n).length||t.setNode(n,e.node(n))})),e.edges().forEach((n=>{t.setEdge(n,e.edge(n))})),t},buildLayerMatrix:function(e){let t=zI(PI(e)+1).map((()=>[]));return e.nodes().forEach((n=>{let o=e.node(n),r=o.rank;void 0!==r&&(t[r][o.order]=n)})),t},intersectRect:function(e,t){let n,o,r=e.x,a=e.y,s=t.x-r,i=t.y-a,l=e.width/2,c=e.height/2;if(!s&&!i)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(i)*l>Math.abs(s)*c?(i<0&&(c=-c),n=c*s/i,o=c):(s<0&&(l=-l),n=l,o=l*i/s);return{x:r+n,y:a+o}},mapValues:function(e,t){let n=t;"string"==typeof t&&(n=e=>e[t]);return Object.entries(e).reduce(((e,[t,o])=>(e[t]=n(o,t),e)),{})},maxRank:PI,normalizeRanks:function(e){let t=e.nodes().map((t=>{let n=e.node(t).rank;return void 0===n?Number.MAX_VALUE:n})),n=RI(Math.min,t);e.nodes().forEach((t=>{let o=e.node(t);Object.hasOwn(o,"rank")&&(o.rank-=n)}))},notime:function(e,t){return t()},partition:function(e,t){let n={lhs:[],rhs:[]};return e.forEach((e=>{t(e)?n.lhs.push(e):n.rhs.push(e)})),n},pick:function(e,t){const n={};for(const o of t)void 0!==e[o]&&(n[o]=e[o]);return n},predecessorWeights:function(e){let t=e.nodes().map((t=>{let n={};return e.inEdges(t).forEach((t=>{n[t.v]=(n[t.v]||0)+e.edge(t).weight})),n}));return BI(e.nodes(),t)},range:zI,removeEmptyRanks:function(e){let t=e.nodes().map((t=>e.node(t).rank)),n=RI(Math.min,t),o=[];e.nodes().forEach((t=>{let r=e.node(t).rank-n;o[r]||(o[r]=[]),o[r].push(t)}));let r=0,a=e.graph().nodeRankFactor;Array.from(o).forEach(((t,n)=>{void 0===t&&n%a!=0?--r:void 0!==t&&r&&t.forEach((t=>e.node(t).rank+=r))}))},simplify:function(e){let t=(new MI).setGraph(e.graph());return e.nodes().forEach((n=>t.setNode(n,e.node(n)))),e.edges().forEach((n=>{let o=t.edge(n.v,n.w)||{weight:0,minlen:1},r=e.edge(n);t.setEdge(n.v,n.w,{weight:o.weight+r.weight,minlen:Math.max(o.minlen,r.minlen)})})),t},successorWeights:function(e){let t=e.nodes().map((t=>{let n={};return e.outEdges(t).forEach((t=>{n[t.w]=(n[t.w]||0)+e.edge(t).weight})),n}));return BI(e.nodes(),t)},time:function(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}},uniqueId:LI,zipObject:BI};function OI(e,t,n,o){let r;do{r=LI(o)}while(e.hasNode(r));return n.dummy=t,e.setNode(r,n),r}const DI=65535;function RI(e,t){if(t.length>DI){const n=function(e,t=DI){const n=[];for(let o=0;o<e.length;o+=t){const r=e.slice(o,o+t);n.push(r)}return n}(t);return e.apply(null,n.map((t=>e.apply(null,t))))}return e.apply(null,t)}function PI(e){const t=e.nodes().map((t=>{let n=e.node(t).rank;return void 0===n?Number.MIN_VALUE:n}));return RI(Math.max,t)}let FI=0;function LI(e){var t=++FI;return toString(e)+t}function zI(e,t,n=1){null==t&&(t=e,e=0);let o=e=>e<t;n<0&&(o=e=>t<e);const r=[];for(let a=e;o(a);a+=n)r.push(a);return r}function BI(e,t){return e.reduce(((e,n,o)=>(e[n]=t[o],e)),{})}let UI=jI,VI=TI.uniqueId;var GI={run:function(e){("greedy"===e.graph().acyclicer?UI(e,(t=e,e=>t.edge(e).weight)):function(e){let t=[],n={},o={};function r(a){Object.hasOwn(o,a)||(o[a]=!0,n[a]=!0,e.outEdges(a).forEach((e=>{Object.hasOwn(n,e.w)?t.push(e):r(e.w)})),delete n[a])}return e.nodes().forEach(r),t}(e)).forEach((t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,VI("rev"))}));var t},undo:function(e){e.edges().forEach((t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let o=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,o)}}))}};let $I=TI;var HI={run:function(e){e.graph().dummyChains=[],e.edges().forEach((t=>function(e,t){let n,o,r,a=t.v,s=e.node(a).rank,i=t.w,l=e.node(i).rank,c=t.name,d=e.edge(t),u=d.labelRank;if(l===s+1)return;for(e.removeEdge(t),r=0,++s;s<l;++r,++s)d.points=[],o={width:0,height:0,edgeLabel:d,edgeObj:t,rank:s},n=$I.addDummyNode(e,"edge",o,"_d"),s===u&&(o.width=d.width,o.height=d.height,o.dummy="edge-label",o.labelpos=d.labelpos),e.setEdge(a,n,{weight:d.weight},c),0===r&&e.graph().dummyChains.push(n),a=n;e.setEdge(a,i,{weight:d.weight},c)}(e,t)))},undo:function(e){e.graph().dummyChains.forEach((t=>{let n,o=e.node(t),r=o.edgeLabel;for(e.setEdge(o.edgeObj,r);o.dummy;)n=e.successors(t)[0],e.removeNode(t),r.points.push({x:o.x,y:o.y}),"edge-label"===o.dummy&&(r.x=o.x,r.y=o.y,r.width=o.width,r.height=o.height),t=n,o=e.node(t)}))}};const{applyWithChunking:WI}=TI;var qI={longestPath:function(e){var t={};e.sources().forEach((function n(o){var r=e.node(o);if(Object.hasOwn(t,o))return r.rank;t[o]=!0;let a=e.outEdges(o).map((t=>null==t?Number.POSITIVE_INFINITY:n(t.w)-e.edge(t).minlen));var s=WI(Math.min,a);return s===Number.POSITIVE_INFINITY&&(s=0),r.rank=s}))},slack:function(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}};var YI=kI.Graph,XI=qI.slack,KI=function(e){var t,n,o=new YI({directed:!1}),r=e.nodes()[0],a=e.nodeCount();o.setNode(r,{});for(;JI(o,e)<a;)t=ZI(o,e),n=o.hasNode(t.v)?XI(e,t):-XI(e,t),QI(o,e,n);return o};function JI(e,t){return e.nodes().forEach((function n(o){t.nodeEdges(o).forEach((r=>{var a=r.v,s=o===a?r.w:a;e.hasNode(s)||XI(t,r)||(e.setNode(s,{}),e.setEdge(o,s,{}),n(s))}))})),e.nodeCount()}function ZI(e,t){return t.edges().reduce(((n,o)=>{let r=Number.POSITIVE_INFINITY;return e.hasNode(o.v)!==e.hasNode(o.w)&&(r=XI(t,o)),r<n[0]?[r,o]:n}),[Number.POSITIVE_INFINITY,null])[1]}function QI(e,t,n){e.nodes().forEach((e=>t.node(e).rank+=n))}var eA=KI,tA=qI.slack,nA=qI.longestPath,oA=kI.alg.preorder,rA=kI.alg.postorder,aA=TI.simplify,sA=iA;function iA(e){e=aA(e),nA(e);var t,n=eA(e);for(dA(n),lA(n,e);t=hA(n);)fA(n,e,t,mA(n,e,t))}function lA(e,t){var n=rA(e,e.nodes());(n=n.slice(0,n.length-1)).forEach((n=>function(e,t,n){var o=e.node(n),r=o.parent;e.edge(n,r).cutvalue=cA(e,t,n)}(e,t,n)))}function cA(e,t,n){var o=e.node(n).parent,r=!0,a=t.edge(n,o),s=0;return a||(r=!1,a=t.edge(o,n)),s=a.weight,t.nodeEdges(n).forEach((a=>{var i,l,c=a.v===n,d=c?a.w:a.v;if(d!==o){var u=c===r,h=t.edge(a).weight;if(s+=u?h:-h,i=n,l=d,e.hasEdge(i,l)){var m=e.edge(n,d).cutvalue;s+=u?-m:m}}})),s}function dA(e,t){arguments.length<2&&(t=e.nodes()[0]),uA(e,{},1,t)}function uA(e,t,n,o,r){var a=n,s=e.node(o);return t[o]=!0,e.neighbors(o).forEach((r=>{Object.hasOwn(t,r)||(n=uA(e,t,n,r,o))})),s.low=a,s.lim=n++,r?s.parent=r:delete s.parent,n}function hA(e){return e.edges().find((t=>e.edge(t).cutvalue<0))}function mA(e,t,n){var o=n.v,r=n.w;t.hasEdge(o,r)||(o=n.w,r=n.v);var a=e.node(o),s=e.node(r),i=a,l=!1;return a.lim>s.lim&&(i=s,l=!0),t.edges().filter((t=>l===pA(e,e.node(t.v),i)&&l!==pA(e,e.node(t.w),i))).reduce(((e,n)=>tA(t,n)<tA(t,e)?n:e))}function fA(e,t,n,o){var r=n.v,a=n.w;e.removeEdge(r,a),e.setEdge(o.v,o.w,{}),dA(e),lA(e,t),function(e,t){var n=e.nodes().find((e=>!t.node(e).parent)),o=oA(e,n);(o=o.slice(1)).forEach((n=>{var o=e.node(n).parent,r=t.edge(n,o),a=!1;r||(r=t.edge(o,n),a=!0),t.node(n).rank=t.node(o).rank+(a?r.minlen:-r.minlen)}))}(e,t)}function pA(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}iA.initLowLimValues=dA,iA.initCutValues=lA,iA.calcCutValue=cA,iA.leaveEdge=hA,iA.enterEdge=mA,iA.exchangeEdges=fA;var gA=qI.longestPath,vA=KI,xA=sA,yA=function(e){switch(e.graph().ranker){case"network-simplex":default:wA(e);break;case"tight-tree":!function(e){gA(e),vA(e)}(e);break;case"longest-path":bA(e)}};var bA=gA;function wA(e){xA(e)}let kA=TI;function NA(e,t,n,o,r,a,s){let i=e.children(s);if(!i.length)return void(s!==t&&e.setEdge(t,s,{weight:0,minlen:n}));let l=kA.addBorderNode(e,"_bt"),c=kA.addBorderNode(e,"_bb"),d=e.node(s);e.setParent(l,s),d.borderTop=l,e.setParent(c,s),d.borderBottom=c,i.forEach((i=>{NA(e,t,n,o,r,a,i);let d=e.node(i),u=d.borderTop?d.borderTop:i,h=d.borderBottom?d.borderBottom:i,m=d.borderTop?o:2*o,f=u!==h?1:r-a[s]+1;e.setEdge(l,u,{weight:m,minlen:f,nestingEdge:!0}),e.setEdge(h,c,{weight:m,minlen:f,nestingEdge:!0})})),e.parent(s)||e.setEdge(t,l,{weight:0,minlen:r+a[s]})}let CA=TI;function EA(e,t,n,o,r,a){let s={width:0,height:0,rank:a,borderType:t},i=r[t][a-1],l=CA.addDummyNode(e,"border",s,n);r[t][a]=l,e.setParent(l,o),i&&e.setEdge(i,l,{weight:1})}function SA(e){e.nodes().forEach((t=>jA(e.node(t)))),e.edges().forEach((t=>jA(e.edge(t))))}function jA(e){let t=e.width;e.width=e.height,e.height=t}function _A(e){e.y=-e.y}function IA(e){let t=e.x;e.x=e.y,e.y=t}let AA=TI;let MA=TI.zipObject;function TA(e,t,n){let o=MA(n,n.map(((e,t)=>t))),r=t.flatMap((t=>e.outEdges(t).map((t=>({pos:o[t.w],weight:e.edge(t).weight}))).sort(((e,t)=>e.pos-t.pos)))),a=1;for(;a<n.length;)a<<=1;let s=2*a-1;a-=1;let i=new Array(s).fill(0),l=0;return r.forEach((e=>{let t=e.pos+a;i[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=i[t+1]),t=t-1>>1,i[t]+=e.weight;l+=e.weight*n})),l}let OA=TI;let DA=TI;function RA(e,t,n){let o;for(;t.length&&(o=t[t.length-1]).i<=n;)t.pop(),e.push(o.vs),n++;return n}let PA=function(e,t=[]){return t.map((t=>{let n=e.inEdges(t);if(n.length){let o=n.reduce(((t,n)=>{let o=e.edge(n),r=e.node(n.v);return{sum:t.sum+o.weight*r.order,weight:t.weight+o.weight}}),{sum:0,weight:0});return{v:t,barycenter:o.sum/o.weight,weight:o.weight}}return{v:t}}))},FA=function(e,t){let n={};return e.forEach(((e,t)=>{let o=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};void 0!==e.barycenter&&(o.barycenter=e.barycenter,o.weight=e.weight)})),t.edges().forEach((e=>{let t=n[e.v],o=n[e.w];void 0!==t&&void 0!==o&&(o.indegree++,t.out.push(n[e.w]))})),function(e){let t=[];function n(e){return t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&function(e,t){let n=0,o=0;e.weight&&(n+=e.barycenter*e.weight,o+=e.weight);t.weight&&(n+=t.barycenter*t.weight,o+=t.weight);e.vs=t.vs.concat(e.vs),e.barycenter=n/o,e.weight=o,e.i=Math.min(t.i,e.i),t.merged=!0}(e,t)}}function o(t){return n=>{n.in.push(t),0==--n.indegree&&e.push(n)}}for(;e.length;){let r=e.pop();t.push(r),r.in.reverse().forEach(n(r)),r.out.forEach(o(r))}return t.filter((e=>!e.merged)).map((e=>OA.pick(e,["vs","i","barycenter","weight"])))}(Object.values(n).filter((e=>!e.indegree)))},LA=function(e,t){let n=DA.partition(e,(e=>Object.hasOwn(e,"barycenter"))),o=n.lhs,r=n.rhs.sort(((e,t)=>t.i-e.i)),a=[],s=0,i=0,l=0;o.sort((c=!!t,(e,t)=>e.barycenter<t.barycenter?-1:e.barycenter>t.barycenter?1:c?t.i-e.i:e.i-t.i)),l=RA(a,r,l),o.forEach((e=>{l+=e.vs.length,a.push(e.vs),s+=e.barycenter*e.weight,i+=e.weight,l=RA(a,r,l)}));var c;let d={vs:a.flat(!0)};i&&(d.barycenter=s/i,d.weight=i);return d};var zA=function e(t,n,o,r){let a=t.children(n),s=t.node(n),i=s?s.borderLeft:void 0,l=s?s.borderRight:void 0,c={};i&&(a=a.filter((e=>e!==i&&e!==l)));let d=PA(t,a);d.forEach((n=>{if(t.children(n.v).length){let i=e(t,n.v,o,r);c[n.v]=i,Object.hasOwn(i,"barycenter")&&(s=i,void 0!==(a=n).barycenter?(a.barycenter=(a.barycenter*a.weight+s.barycenter*s.weight)/(a.weight+s.weight),a.weight+=s.weight):(a.barycenter=s.barycenter,a.weight=s.weight))}var a,s}));let u=FA(d,o);!function(e,t){e.forEach((e=>{e.vs=e.vs.flatMap((e=>t[e]?t[e].vs:e))}))}(u,c);let h=LA(u,r);if(i&&(h.vs=[i,h.vs,l].flat(!0),t.predecessors(i).length)){let e=t.node(t.predecessors(i)[0]),n=t.node(t.predecessors(l)[0]);Object.hasOwn(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+e.order+n.order)/(h.weight+2),h.weight+=2}return h};let BA=kI.Graph,UA=TI;let VA=function(e){let t={},n=e.nodes().filter((t=>!e.children(t).length)),o=n.map((t=>e.node(t).rank)),r=AA.applyWithChunking(Math.max,o),a=AA.range(r+1).map((()=>[]));return n.sort(((t,n)=>e.node(t).rank-e.node(n).rank)).forEach((function n(o){if(t[o])return;t[o]=!0;let r=e.node(o);a[r.rank].push(o),e.successors(o).forEach(n)})),a},GA=function(e,t){let n=0;for(let o=1;o<t.length;++o)n+=TA(e,t[o-1],t[o]);return n},$A=zA,HA=function(e,t,n){let o=function(e){var t;for(;e.hasNode(t=UA.uniqueId("_root")););return t}(e),r=new BA({compound:!0}).setGraph({root:o}).setDefaultNodeLabel((t=>e.node(t)));return e.nodes().forEach((a=>{let s=e.node(a),i=e.parent(a);(s.rank===t||s.minRank<=t&&t<=s.maxRank)&&(r.setNode(a),r.setParent(a,i||o),e[n](a).forEach((t=>{let n=t.v===a?t.w:t.v,o=r.edge(n,a),s=void 0!==o?o.weight:0;r.setEdge(n,a,{weight:e.edge(t).weight+s})})),Object.hasOwn(s,"minRank")&&r.setNode(a,{borderLeft:s.borderLeft[t],borderRight:s.borderRight[t]}))})),r},WA=function(e,t,n){let o,r={};n.forEach((n=>{let a,s,i=e.parent(n);for(;i;){if(a=e.parent(i),a?(s=r[a],r[a]=i):(s=o,o=i),s&&s!==i)return void t.setEdge(s,i);i=a}}))},qA=kI.Graph,YA=TI;var XA=function e(t,n){if(n&&"function"==typeof n.customOrder)return void n.customOrder(t,e);let o=YA.maxRank(t),r=KA(t,YA.range(1,o+1),"inEdges"),a=KA(t,YA.range(o-1,-1,-1),"outEdges"),s=VA(t);if(ZA(t,s),n&&n.disableOptimalOrderHeuristic)return;let i,l=Number.POSITIVE_INFINITY;for(let c=0,d=0;d<4;++c,++d){JA(c%2?r:a,c%4>=2),s=YA.buildLayerMatrix(t);let e=GA(t,s);e<l&&(d=0,i=Object.assign({},s),l=e)}ZA(t,i)};function KA(e,t,n){return t.map((function(t){return HA(e,t,n)}))}function JA(e,t){let n=new qA;e.forEach((function(e){let o=e.graph().root,r=$A(e,o,n,t);r.vs.forEach(((t,n)=>e.node(t).order=n)),WA(e,n,r.vs)}))}function ZA(e,t){Object.values(t).forEach((t=>t.forEach(((t,n)=>e.node(t).order=n))))}let QA=kI.Graph,eM=TI;var tM=function(e){let t,n=eM.buildLayerMatrix(e),o=Object.assign(nM(e,n),oM(e,n)),r={};["u","d"].forEach((a=>{t="u"===a?n:Object.values(n).reverse(),["l","r"].forEach((n=>{"r"===n&&(t=t.map((e=>Object.values(e).reverse())));let s=("u"===a?e.predecessors:e.successors).bind(e),i=sM(e,t,o,s),l=iM(e,t,i.root,i.align,"r"===n);"r"===n&&(l=eM.mapValues(l,(e=>-e))),r[a+n]=l}))}));let a=lM(e,r);return cM(r,a),dM(r,e.graph().align)};function nM(e,t){let n={};return t.length&&t.reduce((function(t,o){let r=0,a=0,s=t.length,i=o[o.length-1];return o.forEach(((t,l)=>{let c=function(e,t){if(e.node(t).dummy)return e.predecessors(t).find((t=>e.node(t).dummy))}(e,t),d=c?e.node(c).order:s;(c||t===i)&&(o.slice(a,l+1).forEach((t=>{e.predecessors(t).forEach((o=>{let a=e.node(o),s=a.order;!(s<r||d<s)||a.dummy&&e.node(t).dummy||rM(n,o,t)}))})),a=l+1,r=d)})),o})),n}function oM(e,t){let n={};function o(t,o,r,a,s){let i;eM.range(o,r).forEach((o=>{i=t[o],e.node(i).dummy&&e.predecessors(i).forEach((t=>{let o=e.node(t);o.dummy&&(o.order<a||o.order>s)&&rM(n,t,i)}))}))}return t.length&&t.reduce((function(t,n){let r,a=-1,s=0;return n.forEach(((i,l)=>{if("border"===e.node(i).dummy){let t=e.predecessors(i);t.length&&(r=e.node(t[0]).order,o(n,s,l,a,r),s=l,a=r)}o(n,s,n.length,r,t.length)})),n})),n}function rM(e,t,n){if(t>n){let e=t;t=n,n=e}let o=e[t];o||(e[t]=o={}),o[n]=!0}function aM(e,t,n){if(t>n){let e=t;t=n,n=e}return!!e[t]&&Object.hasOwn(e[t],n)}function sM(e,t,n,o){let r={},a={},s={};return t.forEach((e=>{e.forEach(((e,t)=>{r[e]=e,a[e]=e,s[e]=t}))})),t.forEach((e=>{let t=-1;e.forEach((e=>{let i=o(e);if(i.length){i=i.sort(((e,t)=>s[e]-s[t]));let o=(i.length-1)/2;for(let l=Math.floor(o),c=Math.ceil(o);l<=c;++l){let o=i[l];a[e]===e&&t<s[o]&&!aM(n,e,o)&&(a[o]=e,a[e]=r[e]=r[o],t=s[o])}}}))})),{root:r,align:a}}function iM(e,t,n,o,r){let a={},s=function(e,t,n,o){let r=new QA,a=e.graph(),s=function(e,t,n){return(o,r,a)=>{let s,i=o.node(r),l=o.node(a),c=0;if(c+=i.width/2,Object.hasOwn(i,"labelpos"))switch(i.labelpos.toLowerCase()){case"l":s=-i.width/2;break;case"r":s=i.width/2}if(s&&(c+=n?s:-s),s=0,c+=(i.dummy?t:e)/2,c+=(l.dummy?t:e)/2,c+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":s=l.width/2;break;case"r":s=-l.width/2}return s&&(c+=n?s:-s),s=0,c}}(a.nodesep,a.edgesep,o);return t.forEach((t=>{let o;t.forEach((t=>{let a=n[t];if(r.setNode(a),o){var i=n[o],l=r.edge(i,a);r.setEdge(i,a,Math.max(s(e,t,o),l||0))}o=t}))})),r}(e,t,n,r),i=r?"borderLeft":"borderRight";function l(e,t){let n=s.nodes(),o=n.pop(),r={};for(;o;)r[o]?e(o):(r[o]=!0,n.push(o),n=n.concat(t(o))),o=n.pop()}return l((function(e){a[e]=s.inEdges(e).reduce(((e,t)=>Math.max(e,a[t.v]+s.edge(t))),0)}),s.predecessors.bind(s)),l((function(t){let n=s.outEdges(t).reduce(((e,t)=>Math.min(e,a[t.w]-s.edge(t))),Number.POSITIVE_INFINITY),o=e.node(t);n!==Number.POSITIVE_INFINITY&&o.borderType!==i&&(a[t]=Math.max(a[t],n))}),s.successors.bind(s)),Object.keys(o).forEach((e=>a[e]=a[n[e]])),a}function lM(e,t){return Object.values(t).reduce(((t,n)=>{let o=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;Object.entries(n).forEach((([t,n])=>{let a=function(e,t){return e.node(t).width}(e,t)/2;o=Math.max(n+a,o),r=Math.min(n-a,r)}));const a=o-r;return a<t[0]&&(t=[a,n]),t}),[Number.POSITIVE_INFINITY,null])[1]}function cM(e,t){let n=Object.values(t),o=eM.applyWithChunking(Math.min,n),r=eM.applyWithChunking(Math.max,n);["u","d"].forEach((n=>{["l","r"].forEach((a=>{let s=n+a,i=e[s];if(i===t)return;let l=Object.values(i),c=o-eM.applyWithChunking(Math.min,l);"l"!==a&&(c=r-eM.applyWithChunking(Math.max,l)),c&&(e[s]=eM.mapValues(i,(e=>e+c)))}))}))}function dM(e,t){return eM.mapValues(e.ul,((n,o)=>{if(t)return e[t.toLowerCase()][o];{let t=Object.values(e).map((e=>e[o])).sort(((e,t)=>e-t));return(t[1]+t[2])/2}}))}let uM=TI,hM=tM;let mM=GI,fM=HI,pM=yA,gM=TI.normalizeRanks,vM=function(e){let t=function(e){let t={},n=0;function o(r){let a=n;e.children(r).forEach(o),t[r]={low:a,lim:n++}}return e.children().forEach(o),t}(e);e.graph().dummyChains.forEach((n=>{let o=e.node(n),r=o.edgeObj,a=function(e,t,n,o){let r,a,s=[],i=[],l=Math.min(t[n].low,t[o].low),c=Math.max(t[n].lim,t[o].lim);r=n;do{r=e.parent(r),s.push(r)}while(r&&(t[r].low>l||c>t[r].lim));a=r,r=o;for(;(r=e.parent(r))!==a;)i.push(r);return{path:s.concat(i.reverse()),lca:a}}(e,t,r.v,r.w),s=a.path,i=a.lca,l=0,c=s[l],d=!0;for(;n!==r.w;){if(o=e.node(n),d){for(;(c=s[l])!==i&&e.node(c).maxRank<o.rank;)l++;c===i&&(d=!1)}if(!d){for(;l<s.length-1&&e.node(c=s[l+1]).minRank<=o.rank;)l++;c=s[l]}e.setParent(n,c),n=e.successors(n)[0]}}))},xM=TI.removeEmptyRanks,yM={run:function(e){let t=kA.addDummyNode(e,"root",{},"_root"),n=function(e){var t={};function n(o,r){var a=e.children(o);a&&a.length&&a.forEach((e=>n(e,r+1))),t[o]=r}return e.children().forEach((e=>n(e,1))),t}(e),o=Object.values(n),r=kA.applyWithChunking(Math.max,o)-1,a=2*r+1;e.graph().nestingRoot=t,e.edges().forEach((t=>e.edge(t).minlen*=a));let s=function(e){return e.edges().reduce(((t,n)=>t+e.edge(n).weight),0)}(e)+1;e.children().forEach((o=>NA(e,t,a,s,r,n,o))),e.graph().nodeRankFactor=a},cleanup:function(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach((t=>{e.edge(t).nestingEdge&&e.removeEdge(t)}))}},bM=function(e){e.children().forEach((function t(n){let o=e.children(n),r=e.node(n);if(o.length&&o.forEach(t),Object.hasOwn(r,"minRank")){r.borderLeft=[],r.borderRight=[];for(let t=r.minRank,o=r.maxRank+1;t<o;++t)EA(e,"borderLeft","_bl",n,r,t),EA(e,"borderRight","_br",n,r,t)}}))},wM={adjust:function(e){let t=e.graph().rankdir.toLowerCase();"lr"!==t&&"rl"!==t||SA(e)},undo:function(e){let t=e.graph().rankdir.toLowerCase();"bt"!==t&&"rl"!==t||function(e){e.nodes().forEach((t=>_A(e.node(t)))),e.edges().forEach((t=>{let n=e.edge(t);n.points.forEach(_A),Object.hasOwn(n,"y")&&_A(n)}))}(e);"lr"!==t&&"rl"!==t||(!function(e){e.nodes().forEach((t=>IA(e.node(t)))),e.edges().forEach((t=>{let n=e.edge(t);n.points.forEach(IA),Object.hasOwn(n,"x")&&IA(n)}))}(e),SA(e))}},kM=XA,NM=function(e){(function(e){let t=uM.buildLayerMatrix(e),n=e.graph().ranksep,o=0;t.forEach((t=>{const r=t.reduce(((t,n)=>{const o=e.node(n).height;return t>o?t:o}),0);t.forEach((t=>e.node(t).y=o+r/2)),o+=r+n}))})(e=uM.asNonCompoundGraph(e)),Object.entries(hM(e)).forEach((([t,n])=>e.node(t).x=n))},CM=TI,EM=kI.Graph;var SM=function(e,t){let n=t&&t.debugTiming?CM.time:CM.notime;n("layout",(()=>{let o=n(" buildLayoutGraph",(()=>function(e){let t=new EM({multigraph:!0,compound:!0}),n=PM(e.graph());return t.setGraph(Object.assign({},_M,RM(n,jM),CM.pick(n,IM))),e.nodes().forEach((n=>{const o=RM(PM(e.node(n)),AM);Object.keys(MM).forEach((e=>{void 0===o[e]&&(o[e]=MM[e])})),t.setNode(n,o),t.setParent(n,e.parent(n))})),e.edges().forEach((n=>{let o=PM(e.edge(n));t.setEdge(n,Object.assign({},OM,RM(o,TM),CM.pick(o,DM)))})),t}(e)));n(" runLayout",(()=>function(e,t,n){t(" makeSpaceForEdgeLabels",(()=>function(e){let t=e.graph();t.ranksep/=2,e.edges().forEach((n=>{let o=e.edge(n);o.minlen*=2,"c"!==o.labelpos.toLowerCase()&&("TB"===t.rankdir||"BT"===t.rankdir?o.width+=o.labeloffset:o.height+=o.labeloffset)}))}(e))),t(" removeSelfEdges",(()=>function(e){e.edges().forEach((t=>{if(t.v===t.w){var n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}}))}(e))),t(" acyclic",(()=>mM.run(e))),t(" nestingGraph.run",(()=>yM.run(e))),t(" rank",(()=>pM(CM.asNonCompoundGraph(e)))),t(" injectEdgeLabelProxies",(()=>function(e){e.edges().forEach((t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v),o={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};CM.addDummyNode(e,"edge-proxy",o,"_ep")}}))}(e))),t(" removeEmptyRanks",(()=>xM(e))),t(" nestingGraph.cleanup",(()=>yM.cleanup(e))),t(" normalizeRanks",(()=>gM(e))),t(" assignRankMinMax",(()=>function(e){let t=0;e.nodes().forEach((n=>{let o=e.node(n);o.borderTop&&(o.minRank=e.node(o.borderTop).rank,o.maxRank=e.node(o.borderBottom).rank,t=Math.max(t,o.maxRank))})),e.graph().maxRank=t}(e))),t(" removeEdgeLabelProxies",(()=>function(e){e.nodes().forEach((t=>{let n=e.node(t);"edge-proxy"===n.dummy&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))}))}(e))),t(" normalize.run",(()=>fM.run(e))),t(" parentDummyChains",(()=>vM(e))),t(" addBorderSegments",(()=>bM(e))),t(" order",(()=>kM(e,n))),t(" insertSelfEdges",(()=>function(e){var t=CM.buildLayerMatrix(e);t.forEach((t=>{var n=0;t.forEach(((t,o)=>{var r=e.node(t);r.order=o+n,(r.selfEdges||[]).forEach((t=>{CM.addDummyNode(e,"selfedge",{width:t.label.width,height:t.label.height,rank:r.rank,order:o+ ++n,e:t.e,label:t.label},"_se")})),delete r.selfEdges}))}))}(e))),t(" adjustCoordinateSystem",(()=>wM.adjust(e))),t(" position",(()=>NM(e))),t(" positionSelfEdges",(()=>function(e){e.nodes().forEach((t=>{var n=e.node(t);if("selfedge"===n.dummy){var o=e.node(n.e.v),r=o.x+o.width/2,a=o.y,s=n.x-r,i=o.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:r+2*s/3,y:a-i},{x:r+5*s/6,y:a-i},{x:r+s,y:a},{x:r+5*s/6,y:a+i},{x:r+2*s/3,y:a+i}],n.label.x=n.x,n.label.y=n.y}}))}(e))),t(" removeBorderNodes",(()=>function(e){e.nodes().forEach((t=>{if(e.children(t).length){let n=e.node(t),o=e.node(n.borderTop),r=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),s=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(s.x-a.x),n.height=Math.abs(r.y-o.y),n.x=a.x+n.width/2,n.y=o.y+n.height/2}})),e.nodes().forEach((t=>{"border"===e.node(t).dummy&&e.removeNode(t)}))}(e))),t(" normalize.undo",(()=>fM.undo(e))),t(" fixupEdgeLabelCoords",(()=>function(e){e.edges().forEach((t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}}))}(e))),t(" undoCoordinateSystem",(()=>wM.undo(e))),t(" translateGraph",(()=>function(e){let t=Number.POSITIVE_INFINITY,n=0,o=Number.POSITIVE_INFINITY,r=0,a=e.graph(),s=a.marginx||0,i=a.marginy||0;function l(e){let a=e.x,s=e.y,i=e.width,l=e.height;t=Math.min(t,a-i/2),n=Math.max(n,a+i/2),o=Math.min(o,s-l/2),r=Math.max(r,s+l/2)}e.nodes().forEach((t=>l(e.node(t)))),e.edges().forEach((t=>{let n=e.edge(t);Object.hasOwn(n,"x")&&l(n)})),t-=s,o-=i,e.nodes().forEach((n=>{let r=e.node(n);r.x-=t,r.y-=o})),e.edges().forEach((n=>{let r=e.edge(n);r.points.forEach((e=>{e.x-=t,e.y-=o})),Object.hasOwn(r,"x")&&(r.x-=t),Object.hasOwn(r,"y")&&(r.y-=o)})),a.width=n-t+s,a.height=r-o+i}(e))),t(" assignNodeIntersects",(()=>function(e){e.edges().forEach((t=>{let n,o,r=e.edge(t),a=e.node(t.v),s=e.node(t.w);r.points?(n=r.points[0],o=r.points[r.points.length-1]):(r.points=[],n=s,o=a),r.points.unshift(CM.intersectRect(a,n)),r.points.push(CM.intersectRect(s,o))}))}(e))),t(" reversePoints",(()=>function(e){e.edges().forEach((t=>{let n=e.edge(t);n.reversed&&n.points.reverse()}))}(e))),t(" acyclic.undo",(()=>mM.undo(e)))}(o,n,t))),n(" updateInputGraph",(()=>function(e,t){e.nodes().forEach((n=>{let o=e.node(n),r=t.node(n);o&&(o.x=r.x,o.y=r.y,o.rank=r.rank,t.children(n).length&&(o.width=r.width,o.height=r.height))})),e.edges().forEach((n=>{let o=e.edge(n),r=t.edge(n);o.points=r.points,Object.hasOwn(r,"x")&&(o.x=r.x,o.y=r.y)})),e.graph().width=t.graph().width,e.graph().height=t.graph().height}(e,o)))}))};let jM=["nodesep","edgesep","ranksep","marginx","marginy"],_M={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},IM=["acyclicer","ranker","rankdir","align"],AM=["width","height"],MM={width:0,height:0},TM=["minlen","weight","width","height","labeloffset"],OM={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},DM=["labelpos"];function RM(e,t){return CM.mapValues(CM.pick(e,t),Number)}function PM(e){var t={};return e&&Object.entries(e).forEach((([e,n])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=n})),t}let FM=TI,LM=kI.Graph;var zM={graphlib:kI,layout:SM,debug:{debugOrdering:function(e){let t=FM.buildLayerMatrix(e),n=new LM({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach((t=>{n.setNode(t,{label:t}),n.setParent(t,"layer"+e.node(t).rank)})),e.edges().forEach((e=>n.setEdge(e.v,e.w,{},e.name))),t.forEach(((e,t)=>{let o="layer"+t;n.setNode(o,{rank:"same"}),e.reduce(((e,t)=>(n.setEdge(e,t,{style:"invis"}),t)))})),n}},util:{time:TI.time,notime:TI.notime},version:"1.1.4"};const BM=(new zM.graphlib.Graph).setDefaultEdgeLabel((()=>({}))),UM=(e,t,n)=>(BM.setGraph({rankdir:n.direction,nodesep:150,ranksep:200,ranker:"longest-path"}),t.forEach((e=>BM.setEdge(e.source,e.target))),e.forEach((e=>BM.setNode(e.id,{...e,width:e.width??0,height:e.height??0}))),zM.layout(BM),{nodes:e.map((e=>{const{x:t,y:n}=BM.node(e.id);return{...e,position:{x:t,y:n}}})),edges:t}),VM=new class{createEdge(e,t){return{animated:!0,markerEnd:{type:aE.ArrowClosed},id:`${e}-${t}`,style:{strokeWidth:2},source:e,sourceHandle:"outputs",targetHandle:"inputs",target:t}}createNode(e,t){return{id:e,data:{atom:t,forceWidth:300},width:300,type:"custom",height:C_(te.get(t).code.trim().split("\n").length),position:{x:0,y:0}}}createElements(e,t,n,o){const r=[],a=[],s=new Set,i=new Set;for(const l of Object.values(n)){if("marimo"===l.value&&"mo"===l.name)continue;const{declaredBy:e,usedBy:t}=l;for(const n of e)for(const e of t){const t=`${n}-${e}`;i.has(t)||(i.add(t),s.add(n),s.add(e),a.push(this.createEdge(n,e)))}}for(const[l,c]of Aa.zip(e,t)){o||r.push(this.createNode(l,c));const e=s.has(l),t=te.get(c).code.trim().startsWith("mo.md");!e&&t||r.push(this.createNode(l,c))}return{nodes:r,edges:a}}},GM=({cellIds:e,variables:t,cellAtoms:n,children:o,layoutDirection:a,settings:s})=>{const i=r.useMemo((()=>{let o=VM.createElements(e,n,t,s.hidePureMarkdown);return o=UM(o.nodes,o.edges,{direction:a}),o}),[]),[l,c,d]=r_(i.nodes),[u,h,m]=a_(i.edges),f=AS(),p=W((e=>{const t=UM(e.nodes,e.edges,{direction:a});c(t.nodes),h(t.edges)}));r.useEffect((()=>{p(VM.createElements(e,n,t,s.hidePureMarkdown))}),[e,t,n,p,s.hidePureMarkdown]);const[g,v]=r.useState();D_();return k.jsx(E_.Provider,{value:a,children:k.jsxs(n_,{nodes:l,edges:u,nodeTypes:j_,minZoom:.2,fitViewOptions:{minZoom:.5,maxZoom:1.5},onNodeClick:(e,t)=>{v({type:"node",id:t.id})},onEdgeClick:(e,t)=>{const{source:n,target:o}=t;v({type:"edge",source:n,target:o})},onNodeDoubleClick:(e,t)=>{ys(t.id,"focus")},fitView:!0,onNodesChange:d,onEdgesChange:m,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[k.jsx(N_,{color:"#ccc",variant:f_.Dots}),k.jsx(g_,{position:"bottom-right",showInteractive:!1,children:k.jsx(C,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:k.jsx(u_,{onMouseDown:tt.preventFocus,onClick:()=>{const e=te.get(jd);if(e){const t=l.find((t=>t.id===e));t&&(f.fitView({padding:1,duration:600,nodes:[t]}),v({type:"node",id:e}))}},children:k.jsx(mc,{className:"size-4"})})})}),k.jsx(T_,{selection:g,variables:t,edges:u,onClearSelection:()=>{v(void 0)}}),o]})})},$M=Z("_minimap_"),HM=Z({hidePureMarkdown:!0}),WM=e=>{const t=b(11),[n,o]=Fe($M),[r,a]=Fe(HM);let s;t[0]!==n||t[1]!==e||t[2]!==r||t[3]!==a||t[4]!==o?(s=()=>"_minimap_"===n?k.jsx(L_,{...e,children:k.jsx(M_,{settings:r,onSettingsChange:a,view:n,onChange:o})}):k.jsx(GM,{...e,settings:r,layoutDirection:n,children:k.jsx(M_,{settings:r,onSettingsChange:a,view:n,onChange:o})}),t[0]=n,t[1]=e,t[2]=r,t[3]=a,t[4]=o,t[5]=s):s=t[5];const i=s;let l,c;return t[6]!==i?(l=i(),t[6]=i,t[7]=l):l=t[7],t[8]!==n||t[9]!==l?(c=k.jsx(Yj,{children:l},n),t[8]=n,t[9]=l,t[10]=c):c=t[10],c},qM=()=>{const e=b(5),t=bs(),n=he(),[o]=ws();let r,a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=on("w-full h-full flex-1 mx-auto -mb-4 relative"),e[0]=r):r=e[0],e[1]!==o||e[2]!==t||e[3]!==n.inOrderIds?(a=k.jsx("div",{className:r,children:k.jsx(WM,{cellAtoms:o,variables:t,cellIds:n.inOrderIds})}),e[1]=o,e[2]=t,e[3]=n.inOrderIds,e[4]=a):a=e[4],a};const YM="name",XM="type-value",KM="defs-refs",JM=[{id:YM,accessorFn:e=>[e.name,e.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:e})=>k.jsx(Ps,{header:"Name",column:e}),cell:({getValue:e})=>{const[t,n]=e();return k.jsx(A_,{name:t,declaredBy:n})}},{id:XM,accessorFn:e=>[e.dataType,e.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:e})=>k.jsx(Ps,{header:k.jsxs("div",{className:"flex flex-col gap-1",children:[k.jsx("span",{children:"Type"}),k.jsx("span",{children:"Value"})]}),column:e}),cell:({getValue:e})=>{const[t,n]=e();return k.jsxs("div",{className:"max-w-[150px]",children:[k.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:t}),k.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:KM,accessorFn:e=>[e.declaredBy,e.usedBy,e.name,e.declaredByNames,e.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:e})=>k.jsx(Ps,{header:k.jsxs("div",{className:"flex flex-col gap-1",children:[k.jsx("span",{children:"Declared By"}),k.jsx("span",{children:"Used By"})]}),column:e}),cell:({getValue:e})=>{const[t,n,o]=e(),r=e=>{const t=qr(e);t&&vs(t,o)};return k.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[k.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[k.jsx("span",{title:"Declared by",children:k.jsx(Pc,{className:"w-3.5 h-3.5 text-muted-foreground"})}),1===t.length?k.jsx(ps,{variant:"focus",cellId:t[0],skipScroll:!0,onClick:()=>r(t[0])}):k.jsx("div",{className:"text-destructive flex flex-row gap-2",children:t.slice(0,3).map(((e,n)=>k.jsxs("span",{className:"flex",children:[k.jsx(ps,{variant:"focus",cellId:e,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(e)},e),n<t.length-1&&", "]},e)))})]}),k.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[k.jsx("span",{title:"Used by",children:k.jsx(qc,{className:"w-3.5 h-3.5 text-muted-foreground"})}),k.jsx(I_,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}];const ZM=r.memo((({className:e,cellIds:t,variables:n})=>{const[o,a]=u.useState([]),[s,i]=u.useState(""),l=ks(),c=r.useMemo((()=>{const e=e=>{const n=l[e];return n===Rs?`cell-${t.indexOf(e)}`:n??`cell-${t.indexOf(e)}`};return Object.values(n).map((t=>({...t,declaredByNames:t.declaredBy.map(e),usedByNames:t.usedBy.map(e)})))}),[n,l,t]),d=r.useMemo((()=>{const e=new Map;return t.forEach(((t,n)=>e.set(t,n))),function(e,t,n){t||(t={id:KM,desc:!1});let o=[];switch(t.id){case YM:o=Ol(e,(e=>e.name));break;case XM:o=Ol(e,(e=>e.dataType));break;case KM:o=Ol(e,(e=>n.get(e.declaredBy[0])))}return t.desc?o.reverse():o}(c,o[0],e)}),[c,o,t]),h=Ns({data:d,columns:JM,getCoreRowModel:Cs(),onGlobalFilterChange:i,getFilteredRowModel:Es(),enableFilters:!0,enableGlobalFilter:!0,getColumnCanGlobalFilter:e=>e.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:a,getSortedRowModel:Ss(),state:{sorting:o,globalFilter:s}});return k.jsxs(k.Fragment,{children:[k.jsx(js,{className:"w-full",placeholder:"Search",value:s,onChange:e=>i(e.target.value)}),k.jsxs(_s,{className:on("w-full text-sm flex-1 border-separate border-spacing-0",e),children:[k.jsx(Is,{children:k.jsx(As,{className:"whitespace-nowrap text-xs",children:h.getFlatHeaders().map((e=>k.jsx(Ms,{className:"sticky top-0 bg-background border-b",children:Ts(e.column.columnDef.header,e.getContext())},e.id)))})}),k.jsx(Os,{children:h.getRowModel().rows.map((e=>k.jsx(As,{className:"hover:bg-accent",children:e.getVisibleCells().map((e=>k.jsx(Ds,{className:"border-b",children:Ts(e.column.columnDef.cell,e.getContext())},e.id)))},e.id)))})]})]})}));ZM.displayName="VariableTable";const QM=()=>{const e=b(4),t=bs(),n=he();if(0===Object.keys(t).length){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=k.jsx(DN,{title:"No variables",description:"Global variables will appear here.",icon:k.jsx(ct,{})}),e[0]=t):t=e[0],t}let o;return e[1]!==n.inOrderIds||e[2]!==t?(o=k.jsx(ZM,{className:"flex-1",cellIds:n.inOrderIds,variables:t}),e[1]=n.inOrderIds,e[2]=t,e[3]=o):o=e[3],o},eT=()=>{const e=b(9),t=Fs(),{clearLogs:n}=q();if(0===t.length){let t,n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=k.jsx("code",{className:"border rounded px-1",children:"stdout"}),e[0]=t):t=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(n=k.jsx(DN,{title:"No logs",description:k.jsxs("span",{children:[t," and"," ",k.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:k.jsx(dt,{})}),e[1]=n):n=e[1],n}let o,r,a;return e[2]!==n?(o=k.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:k.jsx("button",{"data-testid":"clear-logs-button",className:"text-xs font-semibold text-accent-foreground",onClick:n,children:"Clear"})}),e[2]=n,e[3]=o):o=e[3],e[4]!==t?(r=k.jsx("div",{className:"overflow-auto flex-1",children:k.jsx(tT,{logs:t,className:"min-w-[300px]"})}),e[4]=t,e[5]=r):r=e[5],e[6]!==o||e[7]!==r?(a=k.jsxs(k.Fragment,{children:[o,r]}),e[6]=o,e[7]=r,e[8]=a):a=e[8],a},tT=e=>{const t=b(11),{logs:n,className:o}=e;let r,a,s,i,l;if(t[0]!==o?(r=on("flex flex-col",o),t[0]=o,t[1]=r):r=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(a={whiteSpace:"pre-wrap"},t[2]=a):a=t[2],t[3]!==n){let e;t[5]===Symbol.for("react.memo_cache_sentinel")?(e=(e,t)=>k.jsxs("div",{className:"contents group",children:[k.jsx("span",{className:on("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:t+1}),k.jsx("span",{className:on("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:nT(e)})]},t),t[5]=e):e=t[5],s=n.map(e),t[3]=n,t[4]=s}else s=t[4];return t[6]!==s?(i=k.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:k.jsx("div",{className:"grid grid-cols-[30px,1fr]",style:a,children:s})}),t[6]=s,t[7]=i):i=t[7],t[8]!==r||t[9]!==i?(l=k.jsx("div",{className:r,children:i}),t[8]=r,t[9]=i,t[10]=l):l=t[10],l};function nT(e){const t=Ls(e.timestamp),n=oT[e.level],o=e.level.toUpperCase();return k.jsxs(k.Fragment,{children:[k.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["[",t,"]"]}),k.jsx("span",{className:on("flex-shrink-0",n),children:o}),k.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",k.jsx(ps,{cellId:e.cellId}),")"]}),e.message]})}const oT={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"},rT=()=>{const e=b(5),{documentation:t}=le(zs);if(!t){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=k.jsx(DN,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:k.jsx(Gc,{})}),e[0]=t):t=e[0],t}let n,o;return e[1]!==t?(n=xa({html:t}),e[1]=t,e[2]=n):n=e[2],e[3]!==n?(o=k.jsx("div",{className:"p-3 overflow-y-auto overflow-x-hidden h-full docs-documentation flex flex-col gap-4",children:n}),e[3]=n,e[4]=o):o=e[4],o};function aT(e,t,n){return e[t]?e[t][0]?e[t][0][n]:e[t][n]:"contentBoxSize"===t?e.contentRect["inlineSize"===n?"width":"height"]:void 0}function sT(e){void 0===e&&(e={});var t=e.onResize,n=r.useRef(void 0);n.current=t;var o=e.round||Math.round,a=r.useRef(),s=r.useState({width:void 0,height:void 0}),i=s[0],l=s[1],c=r.useRef(!1);r.useEffect((function(){return c.current=!1,function(){c.current=!0}}),[]);var d=r.useRef({width:void 0,height:void 0}),u=function(e,t){var n=r.useRef(null),o=r.useRef(null);o.current=t;var a=r.useRef(null);r.useEffect((function(){s()}));var s=r.useCallback((function(){var t=a.current,r=o.current,s=t||(r?r instanceof Element?r:r.current:null);n.current&&n.current.element===s&&n.current.subscriber===e||(n.current&&n.current.cleanup&&n.current.cleanup(),n.current={element:s,subscriber:e,cleanup:s?e(s):void 0})}),[e]);return r.useEffect((function(){return function(){n.current&&n.current.cleanup&&(n.current.cleanup(),n.current=null)}}),[]),r.useCallback((function(e){a.current=e,s()}),[s])}(r.useCallback((function(t){return a.current&&a.current.box===e.box&&a.current.round===o||(a.current={box:e.box,round:o,instance:new ResizeObserver((function(t){var r=t[0],a="border-box"===e.box?"borderBoxSize":"device-pixel-content-box"===e.box?"devicePixelContentBoxSize":"contentBoxSize",s=aT(r,a,"inlineSize"),i=aT(r,a,"blockSize"),u=s?o(s):void 0,h=i?o(i):void 0;if(d.current.width!==u||d.current.height!==h){var m={width:u,height:h};d.current.width=u,d.current.height=h,n.current?n.current(m):c.current||l(m)}}))}),a.current.instance.observe(t,{box:e.box}),function(){a.current&&a.current.instance.unobserve(t)}}),[e.box,o]),e.ref);return r.useMemo((function(){return{ref:u,width:i.width,height:i.height}}),[u,i.width,i.height])}const iT=new Map,lT=({file:e,onOpenNotebook:t})=>{const{theme:n}=Te(),o=le(Le),[a,s]=r.useState(""),{data:i,loading:l,error:c,setData:d}=an((async()=>{const t=await Bs({path:e.path}),n=t.contents||"";return s(iT.get(e.path)||n),t}),[e.path]),u=async()=>{a!==(null==i?void 0:i.contents)&&await Ys({path:e.path,contents:a}).then((e=>{e.success&&(d((e=>e?{...e,contents:a}:void 0)),s(a))}))},h=r.useRef(a);if(h.current=a,r.useEffect((()=>()=>{if(!i)return;const t=h.current;t===i.contents?iT.delete(e.path):iT.set(e.path,t)}),[e.path,null==i?void 0:i.contents]),c)return k.jsx(Us,{error:c});if(l||!i)return null;const m=i.mimeType||"text/plain",f=m in dT;if(!i.contents&&!f)return k.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[k.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),k.jsx("div",{children:i.file.name}),k.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),k.jsx("div",{children:m})]});const p=k.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[e.isMarimoFile&&!D()&&k.jsx(C,{content:"Open notebook",children:k.jsx(bi,{size:"small",onClick:e=>t(e),children:k.jsx(Vs,{})})}),k.jsx(C,{content:"Download",children:k.jsx(bi,{size:"small",onClick:()=>{if(cT(m)){const e=Xs(i.contents,m);Ks(e,i.file.name)}else S(new Blob([i.contents||a],{type:m}),i.file.name)},children:k.jsx(Nt,{})})}),!cT(m)&&k.jsxs(k.Fragment,{children:[k.jsx(C,{content:"Copy contents to clipboard",children:k.jsx(bi,{size:"small",onClick:async()=>{await et(a)},children:k.jsx(nt,{})})}),k.jsx(C,{content:N("global.save"),children:k.jsx(bi,{size:"small",color:a===i.contents?void 0:"green",onClick:u,disabled:a===i.contents,children:k.jsx(Ic,{})})})]})]});return m.startsWith("image/")?k.jsxs(k.Fragment,{children:[p,k.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:k.jsx(Gs,{base64:i.contents,mime:m})})]}):"text/csv"===m&&i.contents?k.jsxs(k.Fragment,{children:[p,k.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:k.jsx($s,{contents:i.contents})})]}):m.startsWith("audio/")?k.jsxs(k.Fragment,{children:[p,k.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:k.jsx(Hs,{base64:i.contents,mime:m})})]}):m.startsWith("video/")?k.jsxs(k.Fragment,{children:[p,k.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:k.jsx(Ws,{base64:i.contents,mime:m})})]}):k.jsxs(k.Fragment,{children:[p,k.jsx("div",{className:"flex-1 overflow-auto",children:k.jsx(qs,{theme:"dark"===n?"dark":"light",language:dT[m]||dT.default,className:"border-b",extensions:[qt.lineWrapping,fn.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>a!==i.contents&&(u(),!0)}])],value:a,onChange:s})})]})},cT=e=>!!e&&(e.startsWith("image/")||e.startsWith("audio/")||e.startsWith("video/")),dT={"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"};const uT=Z(new class{constructor(e){this.callbacks=e,this.delegate=new qi([]),this.rootPath="",this.onChange=rn.NOOP,this.path=new ft("/"),this.initialize=async e=>{if(this.onChange=e,0===this.delegate.data.length)try{const e=await this.callbacks.listFiles({path:this.rootPath});this.delegate=new qi(e.files),this.rootPath=e.root,this.path=ft.guessDeliminator(e.root)}catch(t){re({title:"Failed",description:Ur(t)})}this.onChange(this.delegate.data)},this.refreshAll=async e=>{const t=[this.rootPath,...e.map((e=>{var t;return null==(t=this.delegate.find(e))?void 0:t.data.path}))].filter(Boolean),n=await Promise.all(t.map((e=>this.callbacks.listFiles({path:e}).catch((()=>({files:[]}))))));for(const[o,r]of t.entries()){const e=n[o];r===this.rootPath?this.delegate=new qi(e.files):this.delegate.update({id:r,changes:{children:e.files}})}this.onChange(this.delegate.data)},this.relativeFromRoot=e=>{const t=function(e){return e.endsWith("/")?e:`${e}/`}(this.rootPath);return e.startsWith(t)?e.slice(t.length):e},this.handleResponse=e=>e.success?e:(re({title:"Failed",description:e.message}),null)}async expand(e){const t=this.delegate.find(e);if(!t)return!1;if(!t.data.isDirectory)return!1;if(t.children&&t.children.length>0)return!0;const n=await this.callbacks.listFiles({path:t.data.path});return this.delegate.update({id:e,changes:{children:n.files}}),this.onChange(this.delegate.data),!0}async rename(e,t){const n=this.delegate.find(e);if(!n)return;const o=n.data.path,r=this.path.join(this.path.dirname(o),t);await this.callbacks.renameFileOrFolder({path:o,newPath:r}).then(this.handleResponse),this.delegate.update({id:e,changes:{name:t,path:r}}),this.onChange(this.delegate.data),await this.refreshAll([r])}async move(e,t){var n;const o=t?(null==(n=this.delegate.find(t))?void 0:n.data.path)??t:this.rootPath;await Promise.all(e.map((e=>{this.delegate.move({id:e,parentId:t,index:0});const n=this.delegate.find(e);if(!n)return Promise.resolve();const r=this.path.join(o,this.path.basename(n.data.path));return this.delegate.update({id:e,changes:{path:r}}),this.callbacks.renameFileOrFolder({path:n.data.path,newPath:r}).then(this.handleResponse)}))),this.onChange(this.delegate.data),await this.refreshAll([o])}async createFile(e,t){var n;const o=t?(null==(n=this.delegate.find(t))?void 0:n.data.path)??t:this.rootPath,r=await this.callbacks.createFileOrFolder({path:o,type:"file",name:e}).then(this.handleResponse);(null==r?void 0:r.info)&&(this.delegate.create({parentId:t,index:0,data:r.info}),this.onChange(this.delegate.data),await this.refreshAll([o]))}async createFolder(e,t){var n;const o=t?(null==(n=this.delegate.find(t))?void 0:n.data.path)??t:this.rootPath,r=await this.callbacks.createFileOrFolder({path:o,type:"directory",name:e}).then(this.handleResponse);(null==r?void 0:r.info)&&(this.delegate.create({parentId:t,index:0,data:r.info}),this.onChange(this.delegate.data),await this.refreshAll([o]))}async delete(e){const t=this.delegate.find(e);t&&(await this.callbacks.deleteFileOrFolder({path:t.data.path}).then(this.handleResponse),this.delegate.drop({id:e}),this.onChange(this.delegate.data))}}({listFiles:ln,createFileOrFolder:Js,deleteFileOrFolder:Zs,renameFileOrFolder:Qs})),hT=Z({});function mT(e){const t=b(4);let n;t[0]!==e?(n=void 0===e?{}:e,t[0]=e,t[1]=n):n=t[1];const o=n;let r;return t[2]!==o?(r={multiple:!0,maxSize:104857600,onError:xT,onDropRejected:pT,onDrop:fT,...o},t[2]=o,t[3]=r):r=t[3],ei(r)}async function fT(e){for(const t of e){const e=(await ti(t)).split(",")[1];await Js({path:"",type:"file",name:t.name,contents:e})}await async function(){await te.get(uT).refreshAll([])}()}function pT(e){re({title:"File upload failed",description:k.jsx("div",{className:"flex flex-col gap-1",children:e.map(gT)}),variant:"danger"})}function gT(e){return k.jsxs("div",{children:[e.file.name," (",e.errors.map(vT).join(", "),")"]},e.file.name)}function vT(e){return e.message}function xT(e){J.error(e),re({title:"File upload failed",description:e.message,variant:"danger"})}const yT=u.createContext(null),bT=e=>{const t=b(60),{height:n}=e,o=r.useRef(null),[a]=Fe(uT);let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],t[0]=s):s=t[0];const[i,l]=r.useState(s),[c,d]=r.useState(null),{openPrompt:u}=w(),[h,m]=Fe(hT);let f,p;t[1]!==a?(f=()=>a.initialize(l),t[1]=a,t[2]=f):f=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(p=[],t[3]=p):p=t[3];const{loading:g,error:v}=an(f,p);let x;t[4]!==a||t[5]!==h?(x=()=>{a.refreshAll(Object.keys(h).filter((e=>h[e])))},t[4]=a,t[5]=h,t[6]=x):x=t[6];const y=W(x);let N;t[7]!==u||t[8]!==a?(N=async()=>{u({title:"Folder name",onConfirm:async e=>{a.createFolder(e,null)}})},t[7]=u,t[8]=a,t[9]=N):N=t[9];const C=W(N);let S;t[10]!==u||t[11]!==a?(S=async()=>{u({title:"File name",onConfirm:async e=>{a.createFile(e,null)}})},t[10]=u,t[11]=a,t[12]=S):S=t[12];const j=W(S);let _;t[13]!==m?(_=()=>{var e;null==(e=o.current)||e.closeAll(),m({})},t[13]=m,t[14]=_):_=t[14];const I=W(_);if(g){let e;return t[15]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx(ns,{size:"medium",centered:!0}),t[15]=e):e=t[15],e}if(v){let e;return t[16]!==v?(e=k.jsx(Us,{error:v}),t[16]=v,t[17]=e):e=t[17],e}if(c){let e,n,o,s,i,l;return t[18]===Symbol.for("react.memo_cache_sentinel")?(e=()=>d(null),t[18]=e):e=t[18],t[19]===Symbol.for("react.memo_cache_sentinel")?(n=k.jsx(E,{onClick:e,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:k.jsx(Dl,{size:16})}),t[19]=n):n=t[19],t[20]!==c.name?(o=k.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[n,k.jsx("span",{className:"font-bold",children:c.name})]}),t[20]=c.name,t[21]=o):o=t[21],t[22]!==a||t[23]!==c.path?(s=e=>jT(e,a.relativeFromRoot(c.path)),t[22]=a,t[23]=c.path,t[24]=s):s=t[24],t[25]!==s||t[26]!==c?(i=k.jsx(r.Suspense,{children:k.jsx(lT,{onOpenNotebook:s,file:c})}),t[25]=s,t[26]=c,t[27]=i):i=t[27],t[28]!==o||t[29]!==i?(l=k.jsxs(k.Fragment,{children:[o,i]}),t[28]=o,t[29]=i,t[30]=l):l=t[30],l}let A;t[31]!==y||t[32]!==j||t[33]!==C||t[34]!==I||t[35]!==a?(A=k.jsx(kT,{onRefresh:y,onCreateFile:j,onCreateFolder:C,onCollapseAll:I,tree:a}),t[31]=y,t[32]=j,t[33]=C,t[34]=I,t[35]=a,t[36]=A):A=t[36];const M=n-33;let T,O,D,R,P,F,L,z;return t[37]!==a?(T=async e=>{const{ids:t}=e;for(const n of t)await a.delete(n)},O=async e=>{const{id:t,name:n}=e;await a.rename(t,n)},D=async e=>{const{dragIds:t,parentId:n}=e;await a.move(t,n)},t[37]=a,t[38]=T,t[39]=O,t[40]=D):(T=t[38],O=t[39],D=t[40]),t[41]===Symbol.for("react.memo_cache_sentinel")?(R=e=>{const t=e[0];t&&(t.data.isDirectory||d(t.data))},t[41]=R):R=t[41],t[42]!==a||t[43]!==h||t[44]!==m?(P=async e=>{if(await a.expand(e)){const t=h[e]??!1;m({...h,[e]:!t})}},t[42]=a,t[43]=h,t[44]=m,t[45]=P):P=t[45],t[46]!==M||t[47]!==i||t[48]!==h||t[49]!==T||t[50]!==O||t[51]!==D||t[52]!==P?(F=k.jsx(Yi,{width:"100%",ref:o,height:M,className:"h-full",data:i,initialOpenState:h,openByDefault:!1,renderCursor:_T,disableDrop:IT,onDelete:T,onRename:O,onMove:D,onSelect:R,onToggle:P,padding:15,rowHeight:30,indent:wT,overscanCount:1e3,disableMultiSelection:!0,children:ET}),t[46]=M,t[47]=i,t[48]=h,t[49]=T,t[50]=O,t[51]=D,t[52]=P,t[53]=F):F=t[53],t[54]!==a||t[55]!==F?(L=k.jsx(yT.Provider,{value:a,children:F}),t[54]=a,t[55]=F,t[56]=L):L=t[56],t[57]!==A||t[58]!==L?(z=k.jsxs(k.Fragment,{children:[A,L]}),t[57]=A,t[58]=L,t[59]=z):z=t[59],z},wT=15,kT=e=>{const t=b(30),{onRefresh:n,onCreateFile:o,onCreateFolder:r,onCollapseAll:a}=e;let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={noDrag:!0,noDragEventsBubbling:!0},t[0]=s):s=t[0];const{getRootProps:i,getInputProps:l}=mT(s);let c,d,u,h,m,f,p,g,v,x,y,w,N,S,j;return t[1]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx(tc,{size:16}),t[1]=c):c=t[1],t[2]!==o?(d=k.jsx(C,{content:"Add file",children:k.jsx(E,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:c})}),t[2]=o,t[3]=d):d=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(u=k.jsx(oc,{size:16}),t[4]=u):u=t[4],t[5]!==r?(h=k.jsx(C,{content:"Add folder",children:k.jsx(E,{"data-testid":"file-explorer-add-folder-button",onClick:r,variant:"text",size:"xs",children:u})}),t[5]=r,t[6]=h):h=t[6],t[7]!==i?(m=i({}),t[7]=i,t[8]=m):m=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(f=ni({variant:"text",size:"xs"}),p=k.jsx(oi,{size:16}),t[9]=f,t[10]=p):(f=t[9],p=t[10]),t[11]!==m?(g=k.jsx(C,{content:"Upload file",children:k.jsx("button",{"data-testid":"file-explorer-upload-button",...m,className:f,children:p})}),t[11]=m,t[12]=g):g=t[12],t[13]!==l?(v=l({}),t[13]=l,t[14]=v):v=t[14],t[15]!==v?(x=k.jsx("input",{...v,type:"file"}),t[15]=v,t[16]=x):x=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(y=k.jsx(na,{size:16}),t[17]=y):y=t[17],t[18]!==n?(w=k.jsx(C,{content:"Refresh",children:k.jsx(E,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:y})}),t[18]=n,t[19]=w):w=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(N=k.jsx(Jl,{size:16}),t[20]=N):N=t[20],t[21]!==a?(S=k.jsx(C,{content:"Collapse all folders",children:k.jsx(E,{"data-testid":"file-explorer-collapse-button",onClick:a,variant:"text",size:"xs",children:N})}),t[21]=a,t[22]=S):S=t[22],t[23]!==d||t[24]!==h||t[25]!==g||t[26]!==x||t[27]!==w||t[28]!==S?(j=k.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[d,h,g,x,w,S]}),t[23]=d,t[24]=h,t[25]=g,t[26]=x,t[27]=w,t[28]=S,t[29]=j):j=t[29],j},NT=e=>{const t=b(9),{node:n,onOpenMarimoFile:o}=e;let r,a,s;return t[0]!==n?(r=e=>{n.data.isDirectory||(e.stopPropagation(),n.select())},t[0]=n,t[1]=r):r=t[1],t[2]!==n.data.isMarimoFile||t[3]!==o?(a=n.data.isMarimoFile&&!D()&&k.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",k.jsx(Vs,{className:"inline ml-1",size:12})]}),t[2]=n.data.isMarimoFile,t[3]=o,t[4]=a):a=t[4],t[5]!==r||t[6]!==n.data.name||t[7]!==a?(s=k.jsxs("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:r,children:[n.data.name,a]}),t[5]=r,t[6]=n.data.name,t[7]=a,t[8]=s):s=t[8],s},CT=e=>{const t=b(10),{node:n}=e,o=r.useRef(null);let a,s,i,l,c;return t[0]!==n.data.name?(a=()=>{var e,t;null==(e=o.current)||e.focus(),null==(t=o.current)||t.setSelectionRange(0,n.data.name.lastIndexOf("."))},s=[n.data.name],t[0]=n.data.name,t[1]=a,t[2]=s):(a=t[1],s=t[2]),r.useEffect(a,s),t[3]!==n?(i=()=>n.reset(),l=e=>{"Escape"===e.key&&n.reset(),"Enter"===e.key&&n.submit(e.currentTarget.value)},t[3]=n,t[4]=i,t[5]=l):(i=t[4],l=t[5]),t[6]!==n.data.name||t[7]!==i||t[8]!==l?(c=k.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:AT,onBlur:i,onKeyDown:l}),t[6]=n.data.name,t[7]=i,t[8]=l,t[9]=c):c=t[9],c},ET=e=>{const t=b(52),{node:n,style:o,dragHandle:a}=e;let s;t[0]!==n.data?(s=n.data.isDirectory?"directory":sn(n.data.name),t[0]=n.data,t[1]=s):s=t[1];const i=s,l=cn[i],{openConfirm:c,openPrompt:d}=w(),u=r.useContext(yT);let h;t[2]!==u||t[3]!==n.data.path?(h=async e=>{jT(e,u?u.relativeFromRoot(n.data.path):n.data.path)},t[2]=u,t[3]=n.data.path,t[4]=h):h=t[4];const m=h;let f;t[5]!==c||t[6]!==n.data.name||t[7]!==n.tree||t[8]!==n.id?(f=async e=>{e.stopPropagation(),e.preventDefault(),c({title:"Delete file",description:`Are you sure you want to delete ${n.data.name}?`,confirmAction:k.jsx(ot,{onClick:async()=>{await n.tree.delete(n.id)},"aria-label":"Confirm",children:"Delete"})})},t[5]=c,t[6]=n.data.name,t[7]=n.tree,t[8]=n.id,t[9]=f):f=t[9];const p=f;let g;t[10]!==n||t[11]!==d||t[12]!==u?(g=async()=>{n.open(),d({title:"Folder name",onConfirm:async e=>{null==u||u.createFolder(e,n.id)}})},t[10]=n,t[11]=d,t[12]=u,t[13]=g):g=t[13];const v=W(g);let x;t[14]!==n||t[15]!==d||t[16]!==u?(x=async()=>{n.open(),d({title:"File name",onConfirm:async e=>{null==u||u.createFile(e,n.id)}})},t[14]=n,t[15]=d,t[16]=u,t[17]=x):x=t[17];const y=W(x);let N;t[18]!==n||t[19]!==y||t[20]!==v||t[21]!==u||t[22]!==i||t[23]!==m||t[24]!==p?(N=()=>{const e={size:14,strokeWidth:1.5,className:"mr-2"};return k.jsxs(Bt,{align:"end",className:"no-print w-[220px]",onClick:e=>e.stopPropagation(),onCloseAutoFocus:e=>e.preventDefault(),children:[!n.data.isDirectory&&k.jsxs(Tt,{onSelect:()=>n.select(),children:[k.jsx(Hc,{...e}),"Open file"]}),n.data.isDirectory&&k.jsxs(k.Fragment,{children:[k.jsxs(Tt,{onSelect:()=>y(),children:[k.jsx(tc,{...e}),"Create file"]}),k.jsxs(Tt,{onSelect:()=>v(),children:[k.jsx(oc,{...e}),"Create folder"]}),k.jsx(Lt,{})]}),k.jsxs(Tt,{onSelect:()=>n.edit(),children:[k.jsx(Nc,{...e}),"Rename"]}),k.jsxs(Tt,{onSelect:async()=>{await et(n.data.path),re({title:"Copied to clipboard"})},children:[k.jsx(nt,{...e}),"Copy path"]}),u&&k.jsxs(Tt,{onSelect:async()=>{await et(u.relativeFromRoot(n.data.path)),re({title:"Copied to clipboard"})},children:[k.jsx(nt,{...e}),"Copy relative path"]}),k.jsxs(Tt,{onSelect:async()=>{re({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:e}=n.data,t=ri[i](e);await et(t)},children:[k.jsx(ai,{...e}),"Copy snippet for reading file"]}),n.data.isMarimoFile&&!D()&&k.jsxs(k.Fragment,{children:[k.jsx(Lt,{}),k.jsxs(Tt,{onSelect:m,children:[k.jsx(Lc,{...e}),"Open notebook"]})]}),k.jsx(Lt,{}),!n.data.isDirectory&&k.jsxs(k.Fragment,{children:[k.jsxs(Tt,{onSelect:async()=>{const e=(await Bs({path:n.data.path})).contents||"";S(new Blob([e]),n.data.name)},children:[k.jsx(Nt,{...e}),"Download"]}),k.jsx(Lt,{})]}),k.jsxs(Tt,{onSelect:p,variant:"danger",children:[k.jsx(je,{...e}),"Delete"]})]})},t[18]=n,t[19]=y,t[20]=v,t[21]=u,t[22]=i,t[23]=m,t[24]=p,t[25]=N):N=t[25];const C=N;let j,_,I;t[26]===Symbol.for("react.memo_cache_sentinel")?(j=on("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),t[26]=j):j=t[26],t[27]!==n?(_=e=>{e.stopPropagation(),n.data.isDirectory&&n.toggle()},I=k.jsx(ST,{node:n}),t[27]=n,t[28]=_,t[29]=I):(_=t[28],I=t[29]);const A=n.willReceiveDrop&&n.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground";let M,T,O,R,P,F,L;return t[30]!==A?(M=on("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",A),t[30]=A,t[31]=M):M=t[31],t[32]!==n.data.isMarimoFile||t[33]!==l?(T=n.data.isMarimoFile?k.jsx("img",{src:"/favicon.ico",className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):k.jsx(l,{className:"w-5 h-5 flex-shrink-0 mr-2",strokeWidth:1.5}),t[32]=n.data.isMarimoFile,t[33]=l,t[34]=T):T=t[34],t[35]!==n||t[36]!==m?(O=n.isEditing?k.jsx(CT,{node:n}):k.jsx(NT,{node:n,onOpenMarimoFile:m}),t[35]=n,t[36]=m,t[37]=O):O=t[37],t[38]===Symbol.for("react.memo_cache_sentinel")?(R=k.jsx(Ot,{asChild:!0,tabIndex:-1,onClick:MT,children:k.jsx(E,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:k.jsx(Zl,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),t[38]=R):R=t[38],t[39]!==C?(P=k.jsxs(zt,{modal:!1,children:[R,C()]}),t[39]=C,t[40]=P):P=t[40],t[41]!==M||t[42]!==T||t[43]!==O||t[44]!==P?(F=k.jsxs("span",{className:M,children:[T,O,P]}),t[41]=M,t[42]=T,t[43]=O,t[44]=P,t[45]=F):F=t[45],t[46]!==o||t[47]!==a||t[48]!==_||t[49]!==I||t[50]!==F?(L=k.jsxs("div",{style:o,ref:a,className:j,draggable:!0,onClick:_,children:[I,F]}),t[46]=o,t[47]=a,t[48]=_,t[49]=I,t[50]=F,t[51]=L):L=t[51],L},ST=e=>{const t=b(3),{node:n}=e;if(!n.data.isDirectory){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx("span",{className:"w-5 h-5 flex-shrink-0"}),t[0]=e):e=t[0],e}let o;return t[1]!==n.isOpen?(o=n.isOpen?k.jsx(Ee,{className:"w-5 h-5 flex-shrink-0"}):k.jsx(oa,{className:"w-5 h-5 flex-shrink-0"}),t[1]=n.isOpen,t[2]=o):o=t[2],o};function jT(e,t){e.stopPropagation(),e.preventDefault(),window.open(`/?file=${t}`,"_blank")}function _T(){return null}function IT(e){const{parentNode:t}=e;return!t.data.isDirectory}function AT(e){return e.stopPropagation()}function MT(e){return e.stopPropagation()}const TT=()=>{const e=b(20),{ref:t,height:n}=sT(),o=void 0===n?1:n;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={noClick:!0,noKeyboard:!0},e[0]=r):r=e[0];const{getRootProps:a,getInputProps:s,isDragActive:i}=mT(r);let l,c,d,u,h,m,f,p;return e[1]!==a?(l=a(),e[1]=a,e[2]=l):l=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(c=on("flex flex-col flex-1 overflow-hidden relative"),e[3]=c):c=e[3],e[4]!==s?(d=s(),e[4]=s,e[5]=d):d=e[5],e[6]!==d?(u=k.jsx("input",{...d}),e[6]=d,e[7]=u):u=e[7],e[8]!==i?(h=i&&k.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"}),e[8]=i,e[9]=h):h=e[9],e[10]!==o?(m=k.jsx(bT,{height:o}),e[10]=o,e[11]=m):m=e[11],e[12]!==t||e[13]!==m?(f=k.jsx("div",{ref:t,className:"flex flex-col flex-1 overflow-hidden",children:m}),e[12]=t,e[13]=m,e[14]=f):f=e[14],e[15]!==l||e[16]!==u||e[17]!==h||e[18]!==f?(p=k.jsxs("div",{...l,className:c,children:[u,h,f]}),e[15]=l,e[16]=u,e[17]=h,e[18]=f,e[19]=p):p=e[19],p},OT=e=>{const t=b(6),{children:n}=e,{openModal:o,closeModal:r}=w();let a,s;return t[0]!==o||t[1]!==r?(a=()=>o(k.jsx(RT,{onClose:r})),t[0]=o,t[1]=r,t[2]=a):a=t[2],t[3]!==a||t[4]!==n?(s=k.jsx(as,{onClick:a,children:n}),t[3]=a,t[4]=n,t[5]=s):s=t[5],s},DT=[qt.lineWrapping],RT=e=>{const t=b(23),{onClose:n}=e,[o,a]=r.useState(""),{theme:s}=Te();let i,l,c,d,u,h;t[0]!==n?(i=async e=>{e.preventDefault();const t=new FormData(e.target),o=t.get("title"),r=t.get("description"),a=t.get("code");fetch("https://marimo.io/api/suggest-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:o,description:r,code:a})}),n(),re({title:"Snippet Submitted",description:"Thank you for contributing! We will review your snippet shortly."})},t[0]=n,t[1]=i):i=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(l=k.jsx(j,{children:"Contribute a Snippet"}),t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsxs(Ie,{children:[l,k.jsxs(_,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",k.jsx("a",{href:Ze.githubPage,target:"_blank",rel:"noreferrer",className:"underline",children:"on GitHub"}),"."]})]}),t[3]=c):c=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(d=k.jsx(Qe,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),u=k.jsx(ss,{id:"description",name:"description",autoFocus:!0,placeholder:"Description",rows:5,required:!0,autoComplete:"off"}),t[4]=d,t[5]=u):(d=t[4],u=t[5]),t[6]!==o?(h=k.jsx("input",{type:"hidden",name:"code",value:o}),t[6]=o,t[7]=h):h=t[7];const m="dark"===s?"dark":"light";let f,p,g,v,x,y;return t[8]!==m||t[9]!==o?(f=k.jsx(qs,{theme:m,language:"python",className:"cm border rounded overflow-hidden",extensions:DT,value:o,onChange:a}),t[8]=m,t[9]=o,t[10]=f):f=t[10],t[11]!==h||t[12]!==f?(p=k.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[d,u,h,f]}),t[11]=h,t[12]=f,t[13]=p):p=t[13],t[14]!==n?(g=k.jsx(E,{"data-testid":"snippet-cancel-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=g):g=t[15],t[16]===Symbol.for("react.memo_cache_sentinel")?(v=k.jsx(E,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),t[16]=v):v=t[16],t[17]!==g?(x=k.jsxs(I,{children:[g,v]}),t[17]=g,t[18]=x):x=t[18],t[19]!==i||t[20]!==p||t[21]!==x?(y=k.jsx(A,{className:"w-fit",children:k.jsxs("form",{onSubmit:i,children:[c,p,x]})}),t[19]=i,t[20]=p,t[21]=x,t[22]=y):y=t[22],y},PT=[qt.lineWrapping],FT=()=>{const e=b(20),[t,n]=u.useState();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0];const{data:a,error:s,loading:i}=an(BT,o);if(s){let t;return e[1]!==s?(t=k.jsx(Us,{error:s}),e[1]=s,e[2]=t):t=e[2],t}if(i||!a){let t;return e[3]===Symbol.for("react.memo_cache_sentinel")?(t=k.jsx(ns,{size:"medium",centered:!0}),e[3]=t):t=e[3],t}const l=t?"h-1/3":"h-full";let c,d,h,m,f,p,g,v,x;return e[4]!==l?(c=on("border-b rounded-none",l),e[4]=l,e[5]=c):c=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(d=k.jsx(Ye,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),e[6]=d):d=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(h=k.jsxs("div",{className:"flex items-center w-full",children:[d,k.jsx(OT,{children:k.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:k.jsx(zo,{className:"h-4 w-4"})})})]}),m=k.jsx(Ke,{children:"No results"}),e[7]=h,e[8]=m):(h=e[7],m=e[8]),e[9]===Symbol.for("react.memo_cache_sentinel")?(f=e=>n(e),e[9]=f):f=e[9],e[10]!==a.snippets?(p=k.jsx(zT,{onSelect:f,snippets:a.snippets}),e[10]=a.snippets,e[11]=p):p=e[11],e[12]!==c||e[13]!==p?(g=k.jsxs(mn,{className:c,children:[h,m,p]}),e[12]=c,e[13]=p,e[14]=g):g=e[14],e[15]!==t?(v=k.jsx(r.Suspense,{children:k.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:t?k.jsx(LT,{snippet:t},t.title):k.jsx(DN,{title:"",description:"Click on a snippet to view its content."})})}),e[15]=t,e[16]=v):v=e[16],e[17]!==g||e[18]!==v?(x=k.jsxs("div",{className:"flex-1 overflow-hidden",children:[g,v]}),e[17]=g,e[18]=v,e[19]=x):x=e[19],x},LT=e=>{const t=b(27),{snippet:n}=e,{theme:o}=Te(),{createNewCell:r}=q(),a=_d();let s;t[0]!==n.sections||t[1]!==r||t[2]!==a?(s=()=>{for(const e of[...n.sections].reverse())e.code&&r({code:e.code,before:!1,cellId:a??"__end__"})},t[0]=n.sections,t[1]=r,t[2]=a,t[3]=s):s=t[3];const i=s;let l;t[4]!==r||t[5]!==a?(l=e=>{r({code:e,before:!1,cellId:a??"__end__"})},t[4]=r,t[5]=a,t[6]=l):l=t[6];const c=l;let d,u,h,m,f,p;if(t[7]!==n.title?(d=k.jsx("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1",children:n.title}),t[7]=n.title,t[8]=d):d=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(u=k.jsx(zl,{className:"ml-2 h-4 w-4"}),t[9]=u):u=t[9],t[10]!==i?(h=k.jsx("div",{className:"flex justify-end",children:k.jsx(Su,{children:k.jsxs(E,{className:"float-right",size:"xs",variant:"outline",onClick:i,children:["Insert snippet",u]})})}),t[10]=i,t[11]=h):h=t[11],t[12]!==n.title||t[13]!==n.sections||t[14]!==c||t[15]!==o){let e;t[17]!==n.title||t[18]!==c||t[19]!==o?(e=e=>{const{code:t,html:r,id:a}=e;return r?k.jsx("div",{children:xa({html:r})},`${n.title}-${a}`):t?k.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[k.jsx(Su,{children:k.jsx(C,{content:"Insert snippet",children:k.jsx(E,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{c(t)},children:k.jsx(zl,{className:"h-5 w-5"})})})}),k.jsx(qs,{theme:"dark"===o?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:PT,value:t,readOnly:!0},`${n.title}-${a}`)]},`${n.title}-${a}`):null},t[17]=n.title,t[18]=c,t[19]=o,t[20]=e):e=t[20],m=n.sections.map(e),t[12]=n.title,t[13]=n.sections,t[14]=c,t[15]=o,t[16]=m}else m=t[16];return t[21]!==h||t[22]!==m?(f=k.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[h,m]}),t[21]=h,t[22]=m,t[23]=f):f=t[23],t[24]!==d||t[25]!==f?(p=k.jsxs(k.Fragment,{children:[d,f]}),t[24]=d,t[25]=f,t[26]=p):p=t[26],p},zT=e=>{const t=b(7),{snippets:n,onSelect:o}=e;let r,a;if(t[0]!==o||t[1]!==n){let e;t[3]!==o?(e=e=>k.jsx($e,{className:"rounded-none",onSelect:()=>o(e),children:k.jsx("div",{className:"flex flex-row gap-2 items-center",children:k.jsx("span",{className:"mt-1 text-accent-foreground",children:e.title})})},e.title),t[3]=o,t[4]=e):e=t[4],r=n.map(e),t[0]=o,t[1]=n,t[2]=r}else r=t[2];return t[5]!==r?(a=k.jsx(vr,{className:"flex flex-col overflow-auto",children:r}),t[5]=r,t[6]=a):a=t[6],a};function BT(){return si()}const UT=e=>{const t=b(11),{value:n,className:o,tooltip:a}=e,[s,i]=r.useState(!1);let l;t[0]!==n?(l=tt.stopPropagation((async()=>{await et(n).then((()=>{i(!0),setTimeout((()=>i(!1)),2e3)}))})),t[0]=n,t[1]=l):l=t[1];const c=l;let d,u;t[2]!==s||t[3]!==o?(d=s?k.jsx(_t,{className:on(o,"text-[var(--grass-11)]")}):k.jsx(nt,{className:o}),t[2]=s,t[3]=o,t[4]=d):d=t[4],t[5]!==c||t[6]!==d?(u=k.jsx("span",{onClick:c,children:d}),t[5]=c,t[6]=d,t[7]=u):u=t[7];const h=u;if(!1===a)return h;const m=s?"Copied!":a??"Copy to clipboard";let f;return t[8]!==m||t[9]!==h?(f=k.jsx(C,{content:m,delayDuration:400,children:h}),t[8]=m,t[9]=h,t[10]=f):f=t[10],f},VT=Z((e=>{const t=e(Tr),n=e(ae),o=e(qa);return Ol(t,(e=>{if(!e.variable_name)return-1;const t=Object.values(n).find((t=>t.name===e.variable_name));if(!t)return 0;const r=o.inOrderIds.indexOf(t.declaredBy[0]);return-1===r?0:r}))})),GT=()=>{const e=b(43),[t,n]=u.useState(""),o=le(ue),r=_d(),{expandedColumns:a,expandedTables:s,columnsPreviews:i}=ii(),{toggleTable:l,toggleColumn:c,closeAllColumns:d}=li(),{createNewCell:h}=q(),m=le(VT);if(0===m.length){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=k.jsx(DN,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",icon:k.jsx(ke,{})}),e[0]=t):t=e[0],t}let f;e[1]!==o||e[2]!==h||e[3]!==r?(f=e=>{e.includes("alt")&&function(e,t,n){bd("altair","alt",(o=>{const r=ie.create();t({cellId:n??"__end__",before:!1,code:o,lastCodeRun:e?o:void 0,newCellId:r,autoFocus:!1}),e&&K({cellIds:[r],codes:[o]})}))}(o,h,r),h({code:e,before:!1,cellId:r??"__end__"})},e[1]=o,e[2]=h,e[3]=r,e[4]=f):f=e[4];const p=f;let g;e[5]!==o||e[6]!==h||e[7]!==r?(g=e=>{wd(o,h,r);let t="";e:switch(e.source_type){case"local":t=`mo.ui.table(${e.name})`;break e;case"duckdb":t=`_df = mo.sql(f"SELECT * FROM ${e.name} LIMIT 100")`;break e;default:M(e.source_type)}h({code:t,before:!1,cellId:r??"__end__"})},e[5]=o,e[6]=h,e[7]=r,e[8]=g):g=e[8];const v=g,x=!!t.trim();let y,w,N,C,E,S,j,_,I,A,T;return e[9]===Symbol.for("react.memo_cache_sentinel")?(y=on("border-b bg-background rounded-none","h-full"),e[9]=y):y=e[9],e[10]!==d?(w=e=>{e.length>0&&d(),n(e)},e[10]=d,e[11]=w):w=e[11],e[12]!==t||e[13]!==w?(N=k.jsx(Ye,{placeholder:"Search tables...",className:"h-6 m-1",value:t,onValueChange:w,rootClassName:"flex-1 border-r"}),e[12]=t,e[13]=w,e[14]=N):N=e[14],e[15]!==x?(C=x&&k.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:k.jsx(en,{className:"h-4 w-4"})}),e[15]=x,e[16]=C):C=e[16],e[17]!==N||e[18]!==C?(E=k.jsxs("div",{className:"flex items-center w-full",children:[N,C]}),e[17]=N,e[18]=C,e[19]=E):E=e[19],e[20]!==c||e[21]!==i?(S=(e,t)=>{const n=`${e.name}:${t.name}`;c({table:e.name,column:t.name}),i.has(n)||di({source:e.source,tableName:e.name,columnName:t.name,sourceType:e.source_type})},e[20]=c,e[21]=i,e[22]=S):S=e[22],e[23]!==l?(j=e=>{l(e.name)},e[23]=l,e[24]=j):j=e[24],e[25]!==x||e[26]!==s?(_=e=>!!x||s.has(e.name),e[25]=x,e[26]=s,e[27]=_):_=e[27],e[28]!==a?(I=(e,t)=>{const n=`${e.name}:${t.name}`;return a.has(n)},e[28]=a,e[29]=I):I=e[29],e[30]!==p||e[31]!==v||e[32]!==S||e[33]!==j||e[34]!==i||e[35]!==m||e[36]!==x||e[37]!==_||e[38]!==I?(A=k.jsx($T,{onAddColumnChart:p,onAddTable:v,onExpandColumn:S,onExpandTable:j,columnPreviews:i,tables:m,isSearching:x,isTableExpanded:_,isColumnExpanded:I}),e[30]=p,e[31]=v,e[32]=S,e[33]=j,e[34]=i,e[35]=m,e[36]=x,e[37]=_,e[38]=I,e[39]=A):A=e[39],e[40]!==E||e[41]!==A?(T=k.jsx("div",{className:"flex-1 overflow-hidden",children:k.jsxs(mn,{className:y,children:[E,A]})}),e[40]=E,e[41]=A,e[42]=T):T=e[42],T},$T=e=>{const t=b(25),{tables:n,isSearching:o,columnPreviews:r,onAddColumnChart:a,onAddTable:s,onExpandTable:i,onExpandColumn:l,isTableExpanded:c,isColumnExpanded:d}=e;let h,m,f,p;if(t[0]!==n||t[1]!==c||t[2]!==o||t[3]!==i||t[4]!==s||t[5]!==l||t[6]!==d||t[7]!==a||t[8]!==r){let e,p;e=Object.entries(ze.groupBy(n,XT,KT)),e=Ol(e,JT),t[12]!==c||t[13]!==o||t[14]!==i||t[15]!==s||t[16]!==l||t[17]!==d||t[18]!==a||t[19]!==r?(p=e=>{const t=c(e),n=[k.jsx(HT,{table:e,forceMount:o,onExpand:()=>i(e),onAddTable:()=>s(e),isExpanded:t},e.name)];return t&&n.push(...e.columns.map((t=>k.jsxs(u.Fragment,{children:[k.jsx(WT,{table:e,column:t,onExpandColumn:l,isExpanded:d(e,t)},`${e.name}.${t.name}`),d(e,t)&&k.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:k.jsx(ui,{children:k.jsx(YT,{table:e,column:t,onAddColumnChart:a,preview:r.get(`${e.name}:${t.name}`)})})})]},`${e.name}.${t.name}`)))),n},t[12]=c,t[13]=o,t[14]=i,t[15]=s,t[16]=l,t[17]=d,t[18]=a,t[19]=r,t[20]=p):p=t[20];const g=p;h=vr,m="flex flex-col overflow-auto",f=(()=>0===e.length?null:1===e.length?e[0][1].flatMap(g):e.flatMap(((e,t)=>{const[n,o]=e;return[k.jsx("div",{className:on("font-bold px-2 py-1 text-muted-foreground bg-[var(--slate-2)] border-t text-sm",t>0&&"border-t"),children:"memory"===n?"In-Memory":n},n),...o.flatMap(g)]})))(),t[0]=n,t[1]=c,t[2]=o,t[3]=i,t[4]=s,t[5]=l,t[6]=d,t[7]=a,t[8]=r,t[9]=h,t[10]=m,t[11]=f}else h=t[9],m=t[10],f=t[11];return t[21]!==h||t[22]!==m||t[23]!==f?(p=k.jsx(h,{className:m,children:f}),t[21]=h,t[22]=m,t[23]=f,t[24]=p):p=t[24],p},HT=e=>{const t=b(27),{table:n,onExpand:o,onAddTable:r,isExpanded:a}=e;let s;t[0]!==n.num_rows||t[1]!==n.num_columns?(s=()=>{const e=[];return null!=n.num_rows&&e.push(`${n.num_rows} rows`),null!=n.num_columns&&e.push(`${n.num_columns} columns`),0===e.length?null:k.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:k.jsx("span",{className:"text-xs text-muted-foreground",children:e.join(", ")})})},t[0]=n.num_rows,t[1]=n.num_columns,t[2]=s):s=t[2];const i=s,l=n.name,c=a&&"rotate-90";let d,u,h,m,f,p,g,v,x;return t[3]!==c?(d=on("h-3 w-3 transition-transform",c),t[3]=c,t[4]=d):d=t[4],t[5]!==d?(u=k.jsx(oa,{className:d}),t[5]=d,t[6]=u):u=t[6],t[7]!==n.name?(h=k.jsx("span",{className:"text-sm",children:n.name}),t[7]=n.name,t[8]=h):h=t[8],t[9]!==u||t[10]!==h?(m=k.jsxs("div",{className:"flex gap-1 items-center flex-1",children:[u,h]}),t[9]=u,t[10]=h,t[11]=m):m=t[11],t[12]!==i?(f=i(),t[12]=i,t[13]=f):f=t[13],t[14]!==r||t[15]!==n?(p=tt.stopPropagation((()=>r(n))),t[14]=r,t[15]=n,t[16]=p):p=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(g=k.jsx(zc,{className:"h-3 w-3"}),t[17]=g):g=t[17],t[18]!==p?(v=k.jsx(C,{content:"Add table to notebook",delayDuration:400,children:k.jsx(E,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:p,children:g})}),t[18]=p,t[19]=v):v=t[19],t[20]!==n.name||t[21]!==a||t[22]!==o||t[23]!==m||t[24]!==f||t[25]!==v?(x=k.jsxs($e,{className:"rounded-none py-1 group min-h-9 border-t",value:l,"aria-selected":a,forceMount:!0,onSelect:o,children:[m,f,v]}),t[20]=n.name,t[21]=a,t[22]=o,t[23]=m,t[24]=f,t[25]=v,t[26]=x):x=t[26],x},WT=e=>{const t=b(22),{table:n,column:o,onExpandColumn:r}=e,a=hi[o.type],s=`${n.name}.${o.name}`,i=`${n.name}.${o.name}`;let l,c,d,u,h,m,f;return t[0]!==r||t[1]!==n||t[2]!==o?(l=()=>r(n,o),t[0]=r,t[1]=n,t[2]=o,t[3]=l):l=t[3],t[4]!==a?(c=k.jsx(a,{className:"flex-shrink-0 h-3 w-3",strokeWidth:1.5}),t[4]=a,t[5]=c):c=t[5],t[6]!==o.name?(d=k.jsx("span",{children:o.name}),t[6]=o.name,t[7]=d):d=t[7],t[8]!==c||t[9]!==d?(u=k.jsxs("div",{className:"flex flex-row gap-2 items-center pl-6 flex-1",children:[c,d]}),t[8]=c,t[9]=d,t[10]=u):u=t[10],t[11]!==o.name?(h=k.jsx(C,{content:"Copy column name",delayDuration:400,children:k.jsx(E,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:k.jsx(UT,{tooltip:!1,value:o.name,className:"h-3 w-3"})})}),t[11]=o.name,t[12]=h):h=t[12],t[13]!==o.external_type?(m=k.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),t[13]=o.external_type,t[14]=m):m=t[14],t[15]!==s||t[16]!==i||t[17]!==l||t[18]!==u||t[19]!==h||t[20]!==m?(f=k.jsxs($e,{className:"rounded-none py-1 group",value:i,onSelect:l,children:[u,h,m]},s),t[15]=s,t[16]=i,t[17]=l,t[18]=u,t[19]=h,t[20]=m,t[21]=f):f=t[21],f},qT=u.lazy((()=>ci((()=>import("./index-DVkxN62p.js")),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]),import.meta.url).then((e=>({default:e.VegaLite}))))),YT=e=>{const t=b(26),{table:n,column:o,preview:r,onAddColumnChart:a}=e,{theme:s}=Te();if(!r){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading..."}),t[0]=e):e=t[0],e}let i;t[1]!==r.error?(i=r.error&&k.jsx("span",{className:"text-xs text-muted-foreground",children:r.error}),t[1]=r.error,t[2]=i):i=t[2];const l=i;let c;t[3]!==r.summary?(c=r.summary&&k.jsx("div",{className:"gap-x-16 gap-y-1 grid grid-cols-2-fit border rounded p-2 empty:hidden",children:Object.entries(r.summary).map(ZT)}),t[3]=r.summary,t[4]=c):c=t[4];const d=c,u=QT;let h;t[5]!==r.chart_spec||t[6]!==s?(h=r.chart_spec&&k.jsx(qT,{spec:u(JSON.parse(r.chart_spec)),width:"container",height:100,actions:!1,theme:"dark"===s?"dark":"vox"}),t[5]=r.chart_spec,t[6]=s,t[7]=h):h=t[7];const m=h;let f;t[8]!==r.chart_code||t[9]!==n||t[10]!==a?(f=r.chart_code&&"local"===n.source_type&&k.jsx(C,{content:"Add chart to notebook",delayDuration:400,children:k.jsx(E,{variant:"outline",size:"icon",className:"z-10 bg-background absolute right-1 -top-1",onClick:tt.stopPropagation((()=>a(r.chart_code||""))),children:k.jsx(zc,{className:"h-3 w-3"})})}),t[8]=r.chart_code,t[9]=n,t[10]=a,t[11]=f):f=t[11];const p=f;let g;t[12]!==n||t[13]!==o||t[14]!==a?(g="duckdb"===n.source_type&&k.jsx(C,{content:"Add SQL cell",delayDuration:400,children:k.jsx(E,{variant:"outline",size:"icon",className:"z-10 bg-background absolute right-1 -top-1",onClick:tt.stopPropagation((()=>{const e=`_df = mo.sql(f'SELECT "${o.name}" FROM ${n.name} LIMIT 100')`;a(e)})),children:k.jsx(zc,{className:"h-3 w-3"})})}),t[12]=n,t[13]=o,t[14]=a,t[15]=g):g=t[15];const v=g;let x;t[16]!==r.chart_max_rows_errors?(x=r.chart_max_rows_errors&&k.jsx("span",{className:"text-xs text-muted-foreground",children:"Too many rows to render the chart."}),t[16]=r.chart_max_rows_errors,t[17]=x):x=t[17];const y=x;if(!(l||d||m||y)){let e;return t[18]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx("span",{className:"text-xs text-muted-foreground",children:"No data"}),t[18]=e):e=t[18],e}let w;return t[19]!==l||t[20]!==p||t[21]!==v||t[22]!==y||t[23]!==m||t[24]!==d?(w=k.jsxs("div",{className:"flex flex-col gap-2 relative",children:[l,p,v,y,m,d]}),t[19]=l,t[20]=p,t[21]=v,t[22]=y,t[23]=m,t[24]=d,t[25]=w):w=t[25],w};function XT(e){return e.source}function KT(e){return e}function JT(e){const[t]=e;return"memory"===t?0:1}function ZT(e){const[t,n]=e;return null==n?null:k.jsxs("div",{className:"flex items-center gap-1 group",children:[k.jsx(UT,{className:"h-3 w-3 invisible group-hover:visible",value:String(n)}),k.jsx("span",{className:"text-xs min-w-[60px] uppercase",children:t}),k.jsx("span",{className:"text-xs font-bold text-muted-foreground tracking-wide",children:mi(n)})]},t)}function QT(e){return{...e,config:{...e.config,background:"transparent"}}}const eO=e=>{const t=b(4),{isOpen:n,children:o}=e,[r,a]=u.useState(!1);let s,i;return t[0]!==n||t[1]!==r?(s=()=>{n&&!r&&a(!0)},i=[n,r],t[0]=n,t[1]=r,t[2]=s,t[3]=i):(s=t[2],i=t[3]),u.useEffect(s,i),r?o:null},tO=Pr("marimo:scratchpadHistory:v1",[]),nO=Z(!1),oO=Z(null,((e,t,n)=>{if(!(n=n.trim()))return;const o=e(tO),r=[n,...o.filter((e=>e!==n))].slice(0,15);t(tO,r)})),rO={hide_code:!1,disabled:!1},aO=()=>{const e=b(79),t=H(),[n]=Oe(),{theme:o}=Te(),a=r.useRef(null),s=_d(),{createNewCell:i,updateCellCode:l}=q(),c=t.cellRuntime[Me],d=null==c?void 0:c.output,u=null==c?void 0:c.status,h=null==c?void 0:c.consoleOutputs,m=t.cellData[Me],f=(null==m?void 0:m.code)??"",p=ce(oO),[g,v]=Fe(nO),x=le(tO);let y;e[0]!==f||e[1]!==p?(y=()=>{fi({code:f}),p(f)},e[0]=f,e[1]=p,e[2]=y):y=e[2];const w=W(y);let S;e[3]!==f||e[4]!==i||e[5]!==s?(S=()=>{f.trim()&&i({code:f,before:!1,cellId:s??"__end__"})},e[3]=f,e[4]=i,e[5]=s,e[6]=S):S=e[6];const j=W(S);let _;e[7]!==l?(_=()=>{l({cellId:Me,code:"",formattingChange:!1}),fi({code:""});const e=a.current;e&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:""}})},e[7]=l,e[8]=_):_=e[8];const I=W(_);let A;e[9]!==v||e[10]!==l?(A=e=>{v(!1),l({cellId:Me,code:e,formattingChange:!1});const t=a.current;t&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},e[9]=v,e[10]=l,e[11]=A):A=e[11];const M=W(A);let T,O,D,R,P,F,L,z;if(e[12]!==o||e[13]!==f||e[14]!==w||e[15]!==l||e[16]!==n||e[17]!==d||e[18]!==h||e[19]!==g||e[20]!==x||e[21]!==M||e[22]!==I||e[23]!==j||e[24]!==u||e[25]!==v){const t=()=>k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:k.jsx(Gb,{theme:o,allowFocus:!1,showPlaceholder:!1,id:Me,code:f,config:rO,status:"idle",serializedEditorState:null,runCell:w,updateCellCode:l,createNewCell:rn.NOOP,deleteCell:rn.NOOP,focusCell:rn.NOOP,moveCell:rn.NOOP,moveToNextCell:void 0,updateCellConfig:rn.NOOP,clearSerializedEditorState:rn.NOOP,userConfig:n,editorViewRef:a,hidden:!1})}),k.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:k.jsx(ha,{allowExpand:!1,output:d,className:"output-area",cellId:Me,stale:!1})}),k.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:k.jsx(il,{consoleOutputs:h,className:"overflow-auto",stale:!1,cellName:Rs,onSubmitDebugger:rn.NOOP,cellId:Me,debuggerActive:!1})})]});let r;e[32]!==g||e[33]!==x||e[34]!==M||e[35]!==o?(r=()=>g?k.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:k.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:x.map(((e,t)=>k.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>M(e),children:k.jsx(qs,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:e.trim(),editable:!1,readOnly:!0})},t)))})}):null,e[32]=g,e[33]=x,e[34]=M,e[35]=o,e[36]=r):r=e[36];const s=r;let i,c,m,p,y,b,S,_,A;D="flex flex-col h-full overflow-hidden divide-y",e[37]===Symbol.for("react.memo_cache_sentinel")?(R=ht.create(Me),e[37]=R):R=e[37],e[38]===Symbol.for("react.memo_cache_sentinel")?(i=N("cell.run"),e[38]=i):i=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(c=k.jsx(Cc,{color:"var(--grass-11)",size:16}),e[39]=c):c=e[39],e[40]!==w||e[41]!==g?(m=k.jsx(C,{content:i,children:k.jsx(E,{"data-testid":"scratchpad-run-button",onClick:w,disabled:g,variant:"text",size:"xs",children:c})}),e[40]=w,e[41]=g,e[42]=m):m=e[42],e[43]===Symbol.for("react.memo_cache_sentinel")?(p=k.jsx(Ql,{size:16}),e[43]=p):p=e[43],e[44]!==g||e[45]!==I?(y=k.jsx(C,{content:"Clear code and outputs",children:k.jsx(E,{disabled:g,size:"xs",variant:"text",onClick:I,children:p})}),e[44]=g,e[45]=I,e[46]=y):y=e[46],e[47]===Symbol.for("react.memo_cache_sentinel")?(b=k.jsx(zl,{size:16}),e[47]=b):b=e[47],e[48]!==g||e[49]!==j?(S=k.jsx(Su,{children:k.jsx(C,{content:"Insert code",children:k.jsx(E,{disabled:g,size:"xs",variant:"text",onClick:j,children:b})})}),e[48]=g,e[49]=j,e[50]=S):S=e[50],e[51]!==u?(_=("running"===u||"queued"===u)&&k.jsx(ns,{className:"inline",size:"small"}),e[51]=u,e[52]=_):_=e[52],e[53]===Symbol.for("react.memo_cache_sentinel")?(A=k.jsx("div",{className:"flex-1"}),e[53]=A):A=e[53];const L=g&&"bg-[var(--sky-3)] rounded-none";let z,B;e[54]!==L?(z=on(L),e[54]=L,e[55]=z):z=e[55],e[56]!==v||e[57]!==g?(B=()=>v(!g),e[56]=v,e[57]=g,e[58]=B):B=e[58];const U=0===x.length;let V,G;e[59]===Symbol.for("react.memo_cache_sentinel")?(V=k.jsx(ic,{size:16}),e[59]=V):V=e[59],e[60]!==z||e[61]!==B||e[62]!==U?(G=k.jsx(C,{content:"Toggle history",children:k.jsx(E,{size:"xs",variant:"text",className:z,onClick:B,disabled:U,children:V})}),e[60]=z,e[61]=B,e[62]=U,e[63]=G):G=e[63],e[64]!==m||e[65]!==y||e[66]!==S||e[67]!==_||e[68]!==G?(P=k.jsxs("div",{className:"flex items-center flex-shrink-0",children:[m,y,S,_,A,G]}),e[64]=m,e[65]=y,e[66]=S,e[67]=_,e[68]=G,e[69]=P):P=e[69],T="flex-1 divide-y relative",O=t(),F=s(),e[12]=o,e[13]=f,e[14]=w,e[15]=l,e[16]=n,e[17]=d,e[18]=h,e[19]=g,e[20]=x,e[21]=M,e[22]=I,e[23]=j,e[24]=u,e[25]=v,e[26]=T,e[27]=O,e[28]=D,e[29]=R,e[30]=P,e[31]=F}else T=e[26],O=e[27],D=e[28],R=e[29],P=e[30],F=e[31];return e[70]!==T||e[71]!==O||e[72]!==F?(L=k.jsxs("div",{className:T,children:[O,F]}),e[70]=T,e[71]=O,e[72]=F,e[73]=L):L=e[73],e[74]!==D||e[75]!==R||e[76]!==P||e[77]!==L?(z=k.jsxs("div",{className:D,id:R,children:[P,L]}),e[74]=D,e[75]=R,e[76]=P,e[77]=L,e[78]=z):z=e[78],z},sO=()=>{const e=b(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=k.jsx(aO,{}),e[0]=t):t=e[0],t},iO=()=>{const e=b(16),[t]=Oe(),n=t.package_management.manager;let o;e[0]!==n?(o=[n],e[0]=n,e[1]=o):o=e[1];const{data:r,loading:a,error:s,reload:i}=an(uO,o);if(a&&!r){let t;return e[2]===Symbol.for("react.memo_cache_sentinel")?(t=k.jsx(ns,{size:"medium",centered:!0}),e[2]=t):t=e[2],t}if(s){let t;return e[3]!==s?(t=k.jsx(Us,{error:s}),e[3]=s,e[4]=t):t=e[4],t}let l;e[5]!==(null==r?void 0:r.packages)?(l=(null==r?void 0:r.packages)||[],e[5]=null==r?void 0:r.packages,e[6]=l):l=e[6];const c=l;let d,u,h;return e[7]!==n||e[8]!==i?(d=k.jsx(lO,{packageManager:n,onSuccess:i}),e[7]=n,e[8]=i,e[9]=d):d=e[9],e[10]!==c||e[11]!==i?(u=k.jsx(cO,{packages:c,onSuccess:i}),e[10]=c,e[11]=i,e[12]=u):u=e[12],e[13]!==d||e[14]!==u?(h=k.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[d,u]}),e[13]=d,e[14]=u,e[15]=h):h=e[15],h},lO=({onSuccess:e,packageManager:t})=>{const[n,o]=u.useState(""),[r,a]=u.useState(!1),s=async()=>{try{a(!0);const t=await vi({package:n});t.success?(e(),re({title:"Package added",description:k.jsxs("span",{children:["The package ",k.jsx(Ra,{className:"inline",children:n})," and its dependencies has been added to your environment."]})})):re({title:"Failed to add package",description:t.error,variant:"danger"})}finally{o(""),a(!1)}};return k.jsxs("div",{className:"flex items-center w-full border-b",children:[k.jsx(js,{placeholder:`Install packages with ${t}...`,icon:r?k.jsx(ns,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):k.jsx(Ul,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),rootClassName:"flex-1 border-none",value:n,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),s())},onChange:e=>o(e.target.value)}),k.jsx(C,{delayDuration:300,side:"left",align:"start",content:k.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:",k.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[k.jsxs("div",{children:[k.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"})," A package name; this will install the latest version.",k.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),k.jsxs("div",{children:[k.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"})," ","A package with a specific version or version range.",k.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),k.jsxs("div",{children:[k.jsx("span",{className:"font-bold tracking-wide",children:"Git:"})," A Git repository",k.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),k.jsxs("div",{children:[k.jsx("span",{className:"font-bold tracking-wide",children:"URL:"})," A remote wheel or source distribution.",k.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),k.jsxs("div",{children:[k.jsx("span",{className:"font-bold tracking-wide",children:"Path:"})," A local wheel, source distribution, or project directory.",k.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:k.jsx(pi,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),k.jsx("button",{type:"button",className:on("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",n&&"bg-accent text-accent-foreground","disabled:cursor-not-allowed disabled:opacity-50"),onClick:s,disabled:!n,children:"Add"})]})},cO=e=>{const t=b(9),{onSuccess:n,packages:o}=e;if(0===o.length){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=k.jsx(DN,{title:"No packages",description:"No packages are installed in this environment.",icon:k.jsx(Ul,{})}),t[0]=e):e=t[0],e}let r,a,s;if(t[1]===Symbol.for("react.memo_cache_sentinel")?(r=k.jsx(Is,{children:k.jsxs(As,{children:[k.jsx(Ms,{children:"Name"}),k.jsx(Ms,{children:"Version"}),k.jsx(Ms,{})]})}),t[1]=r):r=t[1],t[2]!==n||t[3]!==o){let e;t[5]!==n?(e=e=>k.jsxs(As,{className:"group",onClick:async()=>{await et(`${e.name}==${e.version}`),re({title:"Copied to clipboard"})},children:[k.jsx(Ds,{children:e.name}),k.jsx(Ds,{children:e.version}),k.jsx(Ds,{children:k.jsx(dO,{packageName:e.name,onSuccess:n})})]},e.name),t[5]=n,t[6]=e):e=t[6],a=o.map(e),t[2]=n,t[3]=o,t[4]=a}else a=t[4];return t[7]!==a?(s=k.jsxs(_s,{className:"overflow-auto flex-1",children:[r,k.jsx(Os,{children:a})]}),t[7]=a,t[8]=s):s=t[8],s},dO=({packageName:e,onSuccess:t})=>{const[n,o]=u.useState(!1);return n?k.jsx(ns,{size:"small",className:"float-right mr-2 h-4 w-4 shrink-0 opacity-50"}):k.jsx("button",{type:"button",className:on("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible"),onClick:tt.stopPropagation((async()=>{try{o(!0);const n=await xi({package:e});n.success?(t(),re({title:"Package removed",description:k.jsxs("span",{children:["The package ",k.jsx(Ra,{className:"inline",children:e})," has been removed from your environment."]})})):re({title:"Failed to add package",description:n.error,variant:"danger"})}finally{o(!1)}})),children:"Remove"})};function uO(){return gi()}const hO=u.lazy((()=>ci((()=>import("./terminal-D98esyXa.js")),__vite__mapDeps([15,2,3,16]),import.meta.url))),mO=e=>{const t=b(110),{children:n}=e,{isSidebarOpen:o,isTerminalOpen:a,selectedPanel:s}=Hd(),{setIsSidebarOpen:i,setIsTerminalOpen:l}=Wd(),c=u.useRef(null),d=u.useRef(null);let h,m,f,p,g;t[0]!==o?(h=()=>{if(!c.current)return;const e=c.current.isCollapsed();o&&e&&c.current.expand(),o||e||c.current.collapse(),requestAnimationFrame((()=>{requestAnimationFrame((()=>{window.dispatchEvent(new Event("resize"))}))}))},m=[o],t[0]=o,t[1]=h,t[2]=m):(h=t[1],m=t[2]),r.useEffect(h,m),t[3]!==a?(f=()=>{if(!d.current)return;const e=d.current.isCollapsed();a&&e&&d.current.expand(),a||e||d.current.collapse(),requestAnimationFrame((()=>{requestAnimationFrame((()=>{window.dispatchEvent(new Event("resize"))}))}))},p=[a],t[3]=a,t[4]=f,t[5]=p):(f=t[4],p=t[5]),r.useEffect(f,p),t[6]!==n?(g=k.jsx(Xw,{id:"app",className:"relative h-full",children:k.jsx(r.Suspense,{children:n})},"app"),t[6]=n,t[7]=g):g=t[7];const v=g,x=fO,y=o?"resize-handle":"resize-handle-collapsed";let w,N;t[8]!==y?(w=on("border-border no-print z-10",y,"vertical"),t[8]=y,t[9]=w):w=t[9],t[10]!==w?(N=k.jsx(oN,{onDragging:x,className:w}),t[10]=w,t[11]=N):N=t[11];const C=N,S=a?"resize-handle":"resize-handle-collapsed";let j,_;t[12]!==S?(j=on("border-border no-print z-20",S,"horizontal"),t[12]=S,t[13]=j):j=t[13],t[14]!==j?(_=k.jsx(oN,{onDragging:x,className:j}),t[14]=j,t[15]=_):_=t[15];const I=_;let A,M,T,O,D,R,P,F,L,z,B,U,V,G,$,H,W;t[16]!==s?(A=k.jsx("div",{className:"text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1",children:s}),t[16]=s,t[17]=A):A=t[17],t[18]!==i?(M=()=>i(!1),t[18]=i,t[19]=M):M=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(T=k.jsx(en,{className:"w-4 h-4"}),t[20]=T):T=t[20],t[21]!==M?(O=k.jsx(E,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:M,children:T}),t[21]=M,t[22]=O):O=t[22],t[23]!==A||t[24]!==O?(D=k.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[A,O]}),t[23]=A,t[24]=O,t[25]=D):D=t[25],t[26]!==s?(R="files"===s&&k.jsx(TT,{}),t[26]=s,t[27]=R):R=t[27],t[28]!==s?(P="errors"===s&&k.jsx(RN,{}),t[28]=s,t[29]=P):P=t[29],t[30]!==s?(F="variables"===s&&k.jsx(QM,{}),t[30]=s,t[31]=F):F=t[31],t[32]!==s?(L="dependencies"===s&&k.jsx(qM,{}),t[32]=s,t[33]=L):L=t[33],t[34]!==s?(z="packages"===s&&k.jsx(iO,{}),t[34]=s,t[35]=z):z=t[35],t[36]!==s?(B="outline"===s&&k.jsx(FN,{}),t[36]=s,t[37]=B):B=t[37],t[38]!==s?(U="datasources"===s&&k.jsx(GT,{}),t[38]=s,t[39]=U):U=t[39],t[40]!==s?(V="documentation"===s&&k.jsx(rT,{}),t[40]=s,t[41]=V):V=t[41],t[42]!==s?(G="snippets"===s&&k.jsx(FT,{}),t[42]=s,t[43]=G):G=t[43],t[44]!==s?($="scratchpad"===s&&k.jsx(sO,{}),t[44]=s,t[45]=$):$=t[45],t[46]!==s?(H="logs"===s&&k.jsx(eT,{}),t[46]=s,t[47]=H):H=t[47],t[48]!==D||t[49]!==R||t[50]!==P||t[51]!==F||t[52]!==L||t[53]!==z||t[54]!==B||t[55]!==U||t[56]!==V||t[57]!==G||t[58]!==$||t[59]!==H?(W=k.jsx(ui,{children:k.jsx(r.Suspense,{children:k.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[D,R,P,F,L,z,B,U,V,G,$,H]})})}),t[48]=D,t[49]=R,t[50]=P,t[51]=F,t[52]=L,t[53]=z,t[54]=B,t[55]=U,t[56]=V,t[57]=G,t[58]=$,t[59]=H,t[60]=W):W=t[60];const q=W,Y=o&&"border-r border-l border-[var(--slate-7)]";let X,K,J,Z,Q,ee;t[61]!==Y?(X=on("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",Y),t[61]=Y,t[62]=X):X=t[62],t[63]===Symbol.for("react.memo_cache_sentinel")?(K=(e,t)=>{var n;0===t&&10===e&&(null==(n=c.current)||n.resize(30))},t[63]=K):K=t[63],t[64]!==i?(J=()=>i(!1),Z=()=>i(!0),t[64]=i,t[65]=J,t[66]=Z):(J=t[65],Z=t[66]),t[67]!==q||t[68]!==C?(Q=k.jsxs("span",{className:"flex flex-row h-full",children:[q," ",C]}),t[67]=q,t[68]=C,t[69]=Q):Q=t[69],t[70]!==c||t[71]!==X||t[72]!==J||t[73]!==Z||t[74]!==Q?(ee=k.jsx(Xw,{ref:c,id:"helper",collapsedSize:0,collapsible:!0,className:X,minSize:10,defaultSize:0,maxSize:75,onResize:K,onCollapse:J,onExpand:Z,children:Q},"helper"),t[70]=c,t[71]=X,t[72]=J,t[73]=Z,t[74]=Q,t[75]=ee):ee=t[75];const te=ee,ne=a&&"border-[var(--slate-7)]";let oe,re,ae,se,ie,le,ce,de;t[76]!==ne?(oe=on("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ne),t[76]=ne,t[77]=oe):oe=t[77],t[78]===Symbol.for("react.memo_cache_sentinel")?(re=(e,t)=>{var n;0===t&&10===e&&(null==(n=d.current)||n.resize(30))},t[78]=re):re=t[78],t[79]!==l?(ae=()=>l(!1),se=()=>l(!0),t[79]=l,t[80]=ae,t[81]=se):(ae=t[80],se=t[81]),t[82]!==l?(ie=()=>l(!1),t[82]=l,t[83]=ie):ie=t[83],t[84]!==a||t[85]!==ie?(le=k.jsx(hO,{visible:a,onClose:ie}),t[84]=a,t[85]=ie,t[86]=le):le=t[86],t[87]!==a||t[88]!==le?(ce=k.jsx(eO,{isOpen:a,children:le}),t[87]=a,t[88]=le,t[89]=ce):ce=t[89],t[90]!==d||t[91]!==oe||t[92]!==ae||t[93]!==se||t[94]!==I||t[95]!==ce?(de=k.jsxs(Xw,{ref:d,id:"terminal",collapsedSize:0,collapsible:!0,className:oe,minSize:10,defaultSize:0,maxSize:75,onResize:re,onCollapse:ae,onExpand:se,children:[I,ce]},"terminal"),t[90]=d,t[91]=oe,t[92]=ae,t[93]=se,t[94]=I,t[95]=ce,t[96]=de):de=t[96];const ue=de;let he,me,fe,pe,ge,ve,xe;return t[97]===Symbol.for("react.memo_cache_sentinel")?(he={getItem:e=>ON||(ON??null),setItem(e,t){ON=t||null}},me=k.jsx(jN,{}),t[97]=he,t[98]=me):(he=t[97],me=t[98]),t[99]!==ue?(fe=k.jsx(yN,{capability:"terminal",children:ue}),t[99]=ue,t[100]=fe):fe=t[100],t[101]!==v||t[102]!==fe?(pe=k.jsx(Xw,{children:k.jsxs(eN,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[v,fe]})}),t[101]=v,t[102]=fe,t[103]=pe):pe=t[103],t[104]!==te||t[105]!==pe?(ge=k.jsxs(eN,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:he,children:[me,te,pe]}),t[104]=te,t[105]=pe,t[106]=ge):ge=t[106],t[107]===Symbol.for("react.memo_cache_sentinel")?(ve=k.jsx(ui,{children:k.jsx(bN,{})}),t[107]=ve):ve=t[107],t[108]!==ge?(xe=k.jsxs("div",{className:"flex flex-col flex-1 overflow-hidden absolute inset-0 print:relative",children:[ge,ve]}),t[108]=ge,t[109]=xe):xe=t[109],xe};function fO(e){e||window.dispatchEvent(new Event("resize"))}const pO=e=>{const t=b(5);let n,o,r;return t[0]!==e?(n=k.jsx(ww,{...e}),t[0]=e,t[1]=n):n=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(o=k.jsx(Od,{}),t[2]=o):o=t[2],t[3]!==n?(r=k.jsxs(mO,{children:[n,o]}),t[3]=n,t[4]=r):r=t[4],r};export{pO as default};
|