@marimo-team/frontend 0.10.10-dev2 → 0.10.10-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.
Files changed (83) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-C2FAt_uL.js → ConnectedDataExplorerComponent-DSD7I-Cn.js} +1 -1
  2. package/dist/assets/{VegaLite-CQYBLaWt.js → VegaLite-D9tGE7Oi.js} +1 -1
  3. package/dist/assets/{_baseEach-B3hi12ys.js → _baseEach-BaGfHLEn.js} +1 -1
  4. package/dist/assets/_baseMap-3zu2JebJ.js +1 -0
  5. package/dist/assets/{_baseUniq-DqPpeVEt.js → _baseUniq-DHiYESbH.js} +1 -1
  6. package/dist/assets/{any-language-editor-urlqYaxH.js → any-language-editor-DrJB1-gY.js} +1 -1
  7. package/dist/assets/{architectureDiagram-IFBEXTG3-Dj2t3EnA.js → architectureDiagram-IFBEXTG3-V3JxkKzM.js} +1 -1
  8. package/dist/assets/{blockDiagram-TCMKQVZ6-C6AeSiWp.js → blockDiagram-TCMKQVZ6-DrXVbRSW.js} +1 -1
  9. package/dist/assets/{c4Diagram-ZCSEYPFN-BfFLReBK.js → c4Diagram-ZCSEYPFN-GdKvZDAy.js} +1 -1
  10. package/dist/assets/channel-gcEmcNrN.js +1 -0
  11. package/dist/assets/{chunk-4LC2V6XN-CK39CPaw.js → chunk-4LC2V6XN-WacrQ4tO.js} +1 -1
  12. package/dist/assets/{chunk-5RIWM3LS-B5yFrSfS.js → chunk-5RIWM3LS-D5ZtxTbN.js} +1 -1
  13. package/dist/assets/{chunk-6JKP7OK7-BQIiTgBs.js → chunk-6JKP7OK7-wfAOsR7h.js} +1 -1
  14. package/dist/assets/{chunk-NGC4727B-BTcZFn4_.js → chunk-NGC4727B-BOlaG8N2.js} +1 -1
  15. package/dist/assets/{chunk-REEJFE46-BkhkcyOx.js → chunk-REEJFE46-nS4FnYbd.js} +1 -1
  16. package/dist/assets/{chunk-RYO7GUH3-CauX_CY0.js → chunk-RYO7GUH3-BFuVxyXQ.js} +1 -1
  17. package/dist/assets/{chunk-V35ELUW5-C1lgVDqg.js → chunk-V35ELUW5-urlKMlUu.js} +1 -1
  18. package/dist/assets/{classDiagram-Q73GJZWF-BaVTQx5l.js → classDiagram-Q73GJZWF-BafmcjEh.js} +1 -1
  19. package/dist/assets/{classDiagram-v2-C6QPLPW4-COhmKuEB.js → classDiagram-v2-C6QPLPW4-Da2MmPW2.js} +1 -1
  20. package/dist/assets/clone-ZE8hFKVw.js +1 -0
  21. package/dist/assets/{compile-DQ14jaCl.js → compile-Bjnzh7ua.js} +1 -1
  22. package/dist/assets/{createWsUrl-zgrhlYTE.js → createWsUrl-DqiYXZua.js} +1 -1
  23. package/dist/assets/{dagre-7KT5K2WU-TBadA12E.js → dagre-7KT5K2WU-BlJlR7fx.js} +1 -1
  24. package/dist/assets/{data-editor-CZ2ffy2r.js → data-editor-V6sbOXxA.js} +1 -1
  25. package/dist/assets/{diagram-AVGMFHF7-DFnsB1AY.js → diagram-AVGMFHF7-2J6I-Mqi.js} +1 -1
  26. package/dist/assets/edit-page-DdW4umRW.js +14 -0
  27. package/dist/assets/{erDiagram-DKC2X5TE-gWLV64ld.js → erDiagram-DKC2X5TE-C1quT74r.js} +1 -1
  28. package/dist/assets/{flowDiagram-NWEUNK3L-BR2Jp66l.js → flowDiagram-NWEUNK3L-DzPP85Kd.js} +1 -1
  29. package/dist/assets/{ganttDiagram-HLVPPPRE-1W4qOSJA.js → ganttDiagram-HLVPPPRE-C0C_unwJ.js} +1 -1
  30. package/dist/assets/{gitGraph-YCYPL57B-DcUEWj7t.js → gitGraph-YCYPL57B-BV_J8ESP.js} +1 -1
  31. package/dist/assets/{gitGraphDiagram-JPZ3KUXI-DKz3V4Fo.js → gitGraphDiagram-JPZ3KUXI-CF7IZNvU.js} +1 -1
  32. package/dist/assets/{graph-CFa9UCy9.js → graph-ycnepRs2.js} +1 -1
  33. package/dist/assets/{home-page-CuOlsKNb.js → home-page-BF7M1YE5.js} +1 -1
  34. package/dist/assets/{index-InxjuO9N.js → index-4ZDi4gd0.js} +1 -1
  35. package/dist/assets/{index-Dni8Jnkd.js → index-79xyYxYm.js} +1 -1
  36. package/dist/assets/{index-BWfZxyoz.js → index-Bf2pMOOT.js} +4 -4
  37. package/dist/assets/{index-DRW2-qnq.js → index-Bv4YJpan.js} +1 -1
  38. package/dist/assets/{index-DfBmNyR_.js → index-C1FTKjJ7.js} +1 -1
  39. package/dist/assets/{index--ZDWu7hA.js → index-CxBdwaAe.js} +1 -1
  40. package/dist/assets/{index-_eSbw_2H.js → index-DDtKY_XZ.js} +1 -1
  41. package/dist/assets/{index-DscVoZ66.js → index-DGC4uSiV.js} +1 -1
  42. package/dist/assets/{index-S31-0Tgx.js → index-DHmA1Pd6.js} +1 -1
  43. package/dist/assets/{index-CAk8lEEA.js → index-DZIdIzRI.js} +1 -1
  44. package/dist/assets/{index-zSxFvn0j.js → index-DZKflPoB.js} +1 -1
  45. package/dist/assets/{index-Dngo0RdO.js → index-DvUhPCUR.js} +1 -1
  46. package/dist/assets/{index-BjKIHx_p.js → index-Jx98P38k.js} +1 -1
  47. package/dist/assets/{index-C5zTLUvD.js → index-U_5EJtqC.js} +1 -1
  48. package/dist/assets/{index-PrVDgaS6.js → index-_-mQAJ0A.js} +1 -1
  49. package/dist/assets/{index-ChD22_I7.js → index-lQjWV99m.js} +1 -1
  50. package/dist/assets/{index-BoVv3o3Y.js → index-n_D4ztRZ.js} +1 -1
  51. package/dist/assets/{infoDiagram-RZZSJVI2-DLyqtySq.js → infoDiagram-RZZSJVI2-CyVCcLr0.js} +1 -1
  52. package/dist/assets/{journeyDiagram-BLD6N6MZ-DSYXTjyZ.js → journeyDiagram-BLD6N6MZ-CmUubhfh.js} +1 -1
  53. package/dist/assets/{json-DkQnIdDS.js → json-DwE-kUdb.js} +1 -1
  54. package/dist/assets/{layout-CVD5I9XP.js → layout-CpGNzhWA.js} +1 -1
  55. package/dist/assets/{linear-D1oJeWfN.js → linear-CdX237oB.js} +1 -1
  56. package/dist/assets/{mermaid-DDrAQ3fQ.js → mermaid-C6JBGKmH.js} +3 -3
  57. package/dist/assets/{min-DmzNl1px.js → min-BZKrdoJ3.js} +1 -1
  58. package/dist/assets/{mindmap-definition-OEB2RXX2-BkLEwdbI.js → mindmap-definition-OEB2RXX2-COLvVGoV.js} +1 -1
  59. package/dist/assets/{pieDiagram-X7YZ5ZEZ-DozgZ7rr.js → pieDiagram-X7YZ5ZEZ-qRHx0Cpc.js} +1 -1
  60. package/dist/assets/{quadrantDiagram-F36EZAVT-DrUgDRbR.js → quadrantDiagram-F36EZAVT-B2KxDqCV.js} +1 -1
  61. package/dist/assets/{react-plotly-CCMm161W.js → react-plotly-AZXzFZU7.js} +1 -1
  62. package/dist/assets/{requirementDiagram-JG2LMPGF-iSQNUgny.js → requirementDiagram-JG2LMPGF-BG_7CD_G.js} +1 -1
  63. package/dist/assets/{run-page-CMhItSEg.js → run-page-4KlfZ22O.js} +1 -1
  64. package/dist/assets/{sankeyDiagram-ATFNWWW6-DVqz7GPw.js → sankeyDiagram-ATFNWWW6-CTOBaN2L.js} +1 -1
  65. package/dist/assets/{sequenceDiagram-WK7YDQ3N-Q-rsL0Zs.js → sequenceDiagram-WK7YDQ3N-D08e3abF.js} +1 -1
  66. package/dist/assets/{slides-component-BmZaifz_.js → slides-component-CeUn4ZcK.js} +1 -1
  67. package/dist/assets/{sortBy-CKbtRcB_.js → sortBy-B4AqvAcS.js} +1 -1
  68. package/dist/assets/{stateDiagram-4JV6CC6H-m1xv8VNa.js → stateDiagram-4JV6CC6H-Ce4LO4hg.js} +1 -1
  69. package/dist/assets/stateDiagram-v2-7KT6RKTD-BcV-LDct.js +1 -0
  70. package/dist/assets/{terminal-DT3AvaZJ.js → terminal-Da1fo44C.js} +1 -1
  71. package/dist/assets/{time-C-yMQf4t.js → time-C8bABbtL.js} +1 -1
  72. package/dist/assets/{timeline-definition-3ZMEY6HS-5pW0f1CE.js → timeline-definition-3ZMEY6HS-wWxsvPYR.js} +1 -1
  73. package/dist/assets/{tree-DMcdA2fD.js → tree-tH8rEcno.js} +1 -1
  74. package/dist/assets/{useMarimoWebSocket-CADIAjgs.js → useMarimoWebSocket-CRDO40qR.js} +3 -3
  75. package/dist/assets/{vega-component-CkIOEpt7.js → vega-component-DbRSYKWd.js} +1 -1
  76. package/dist/assets/{xychartDiagram-KECQ2H5Q-DZjHyqO-.js → xychartDiagram-KECQ2H5Q-CLNZY3AB.js} +1 -1
  77. package/dist/index.html +1 -1
  78. package/package.json +1 -1
  79. package/dist/assets/_baseMap-DOaHhKS7.js +0 -1
  80. package/dist/assets/channel-zqiP4DLt.js +0 -1
  81. package/dist/assets/clone-CZi7pO_I.js +0 -1
  82. package/dist/assets/edit-page-D-xlcKL4.js +0 -14
  83. package/dist/assets/stateDiagram-v2-7KT6RKTD-KDWY2PWN.js +0 -1
@@ -1,14 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-InxjuO9N.js","./VegaLite-CQYBLaWt.js","./index-BWfZxyoz.js","./index-C7Hj70vM.css","./compile-DQ14jaCl.js","./time-C-yMQf4t.js","./step-DY8hpDjU.js","./linear-D1oJeWfN.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./arc-y9WbYkJu.js","./index-DfBmNyR_.js","./terminal-DT3AvaZJ.js","./createWsUrl-zgrhlYTE.js","./terminal-Bylkn-Y1.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{aD as o,J as r,hn as a,ho as i,hp as s,hq as l,hr as c,hs as d,R as u,ht as h,hu as f,hv as m,hw as p,hx as g,hy as y,hz as v,hA as x,ep as b,hB as w,d9 as k,G as S,a9 as N,P as C,eB as E,eC as j,eD as _,eF as I,ez as T,eA as A,eE as M,hC as O,hD as D,dF as P,ar as R,H as L,hE as z,dg as F,eW as B,hF as U,ax as V,ey as H,cm as $,$ as W,hG as G,dH as q,hH as Y,hI as X,a5 as K,hJ as J,dL as Z,hK as Q,M as ee,b9 as te,aM as ne,hL as oe,hM as re,hN as ae,dA as ie,hO as se,dD as le,hP as ce,hQ as de,hR as ue,d8 as he,hS as fe,hT as me,bb as pe,hU as ge,hV as ye,aO as ve,hW as xe,hX as be,hY as we,a0 as ke,a1 as Se,a2 as Ne,b1 as Ce,hZ as Ee,ac as je,dB as _e,fA as Ie,f7 as Te,fD as Ae,aJ as Me,f8 as Oe,ay as De,h_ as Pe,h$ as Re,i0 as Le,f9 as ze,i1 as Fe,i2 as Be,fd as Ue,i3 as Ve,i4 as He,i5 as $e,i6 as We,dq as Ge,Y as qe,a3 as Ye,a$ as Xe,i7 as Ke,a4 as Je,av as Ze,a6 as Qe,az as et,el as tt,bf as nt,dN as ot,i8 as rt,eb as at,i9 as it,df as st,dG as lt,eH as ct,ia as dt,ba as ut,ib as ht,dx as ft,ic as mt,id as pt,b5 as gt,ie as yt,ig as vt,ih as xt,ii as bt,ij as wt,ik as kt,fc as St,da as Nt,aQ as Ct,il as Et,a8 as jt,bc as _t,im as It,io as Tt,fE as At,ip as Mt,a7 as Ot,dr as Dt,iq as Pt,X as Rt,ir as Lt,aW as zt,bd as Ft,is as Bt,it as Ut,iu as Vt,iv as Ht,dE as $t,aR as Wt,aS as Gt,iw as qt,e0 as Yt,dn as Xt,ix as Kt,eV as Jt,k as Zt,j as Qt,iy as en,iz as tn,iA as nn,eR as on,iB as rn,iC as an,de as sn,iD as ln,iE as cn,ap as dn,aN as un,ad as hn,iF as fn,b4 as mn,iG as pn,fH as gn,fG as yn,iH as vn,iI as xn,iJ as bn,dI as wn,iK as kn,iL as Sn,iM as Nn,iN as Cn,iO as En,dJ as jn,iP as _n,iQ as In,iR as Tn,iS as An,iT as Mn,aE as On,eZ as Dn,iU as Pn,iV as Rn,f4 as Ln,iW as zn,eQ as Fn,iX as Bn,iY as Un,iZ as Vn,i_ as Hn,i$ as $n,j0 as Wn,m as Gn,j1 as qn,j2 as Yn,j3 as Xn,t as Kn,j4 as Jn,j5 as Zn,j6 as Qn,j7 as eo,j8 as to,j9 as no,ja as oo,jb as ro,jc as ao,jd as io,je as so,jf as lo,jg as co,jh as uo,ji as ho,jj as fo,jk as mo,jl as po,jm as go,jn as yo,jo as vo,jp as xo,jq as bo,jr as wo,js as ko,jt as So,ju as No,jv as Co,jw as Eo,jx as jo,jy as _o,jz as Io,jA as To,jB as Ao,jC as Mo,jD as Oo,jE as Do,fI as Po,jF as Ro,jG as Lo,jH as zo,jI as Fo,jJ as Bo,jK as Uo,jL as Vo,jM as Ho,jN as $o,jO as Wo,jP as Go,jQ as qo,jR as Yo,jS as Xo,dO as Ko,jT as Jo,jU as Zo,dR as Qo,jV as er,jW as tr,jX as nr,jY as or,jZ as rr,j_ as ar,j$ as ir,ae as sr,dw as lr,k0 as cr,dV as dr,k1 as ur,k2 as hr,k3 as fr,k4 as mr,k5 as pr,k6 as gr,k7 as yr,k8 as vr,k9 as xr,ka as br,aa as wr,kb as kr,kc as Sr,e9 as Nr,kd as Cr,ke as Er,kf as jr,kg as _r,kh as Ir,ki as Tr,kj as Ar,kk as Mr,kl as Or,km as Dr,kn as Pr,ko as Rr,kp as Lr,kq as zr,kr as Fr,fF as Br,ks as Ur,kt as Vr,ku as Hr,a_ as $r,f2 as Wr,kv as Gr,kw as qr,kx as Yr,ky as Xr,kz as Kr,kA as Jr,kB as Zr,eT as Qr,kC as ea,aV as ta,kD as na,b$ as oa,aF as ra,an as aa,ea as ia,kE as sa,d6 as la,aK as ca,kF as da,e3 as ua,c4 as ha,kG as fa,b0 as ma,kH as pa,kI as ga,kJ as ya,kK as va,kL as xa,kM as ba,kN as wa,kO as ka,kP as Sa,b2 as Na,aP as Ca,kQ as Ea,dv as ja,kR as _a,kS as Ia,kT as Ta,kU as Aa,kV as Ma,eL as Oa,dz as Da,kW as Pa,kX as Ra,db as La,aZ as za,kY as Fa,er as Ba,fh as Ua,fi as Va,fj as Ha,fn as $a,fl as Wa,fo as Ga,fq as qa,ft as Ya,fw as Xa,fr as Ka,kZ as Ja,k_ as Za,e1 as Qa,k$ as ei,l0 as ti,em as ni,fu as oi,l1 as ri,l2 as ai,l3 as ii,O as si,Q as li,l4 as ci,l5 as di,T as ui,l6 as hi,l7 as fi,eP as mi,aL as pi,l8 as gi,l9 as yi,la as vi,lb as xi,e8 as bi,lc as wi,ld as ki,du as Si,le as Ni,lf as Ci,lg as Ei,lh as ji,eK as _i,li as Ii,lj as Ti,dM as Ai,lk as Mi,ll as Oi,lm as Di,ln as Pi,lo as Ri,lp as Li,lq as zi,lr as Fi,ls as Bi,lt as Ui,lu as Vi,lv as Hi,lw as $i,lx as Wi,ly as Gi,di as qi,lz as Yi,lA as Xi,lB as Ki,lC as Ji,lD as Zi,aw as Qi,b6 as es,lE as ts,lF as ns,lG as os,lH as rs,lI as as,lJ as is,lK as ss,lL as ls,lM as cs,lN as ds,lO as us,lP as hs,eY as fs,lQ as ms,lR as ps,lS as gs,fv as ys,lT as vs,lU as xs,ek as bs,d1 as ws,lV as ks,aI as Ss,lW as Ns,lX as Cs,lY as Es,lZ as js,aA as _s,l_ as Is,l$ as Ts,m0 as As,m1 as Ms,g as Os,m2 as Ds,ed as Ps,aH as Rs}from"./index-BWfZxyoz.js";import{G as Ls,g as zs,M as Fs,b as Bs,c as Us,d as Vs,A as Hs,s as $s,k as Ws,B as Gs,e as qs,u as Ys,a as Xs,S as Ks,K as Js,f as Zs,h as Qs,i as el,j as tl,l as nl,L as ol,m as rl,n as al,o as il,p as sl,q as ll,r as cl,P as dl,t as ul,v as hl,T as fl,C as ml}from"./tree-DMcdA2fD.js";import{b as pl,c as gl,L as yl,I as vl,N as xl,V as bl,F as wl,d as kl,M as Sl,l as Nl,g as Cl,E as El,e as jl,f as _l,h as Il,i as Tl,j as Al,k as Ml,m as Ol,n as Dl,o as Pl,p as Rl,u as Ll,C as zl,R as Fl,a as Bl,A as Ul,q as Vl,r as Hl,O as $l,T as Wl,s as Gl,t as ql}from"./useMarimoWebSocket-CADIAjgs.js";import{s as Yl,i as Xl,T as Kl,a as Jl}from"./transform-C6EuPmuu.js";import{W as Zl}from"./step-DY8hpDjU.js";import{V as Ql,c as ec}from"./compile-DQ14jaCl.js";import{s as tc}from"./sortBy-CKbtRcB_.js";import"./main-cdvIQCIX.js";import"./createWsUrl-zgrhlYTE.js";import"./index-DfBmNyR_.js";import"./time-C-yMQf4t.js";import"./linear-D1oJeWfN.js";import"./init-DLRA0X12.js";import"./range-CtcPcB_L.js";import"./ordinal-DDUp3AbE.js";import"./colors-bszWmPJw.js";import"./arc-y9WbYkJu.js";import"./_baseEach-B3hi12ys.js";import"./_baseMap-DOaHhKS7.js";
3
- /**
4
- * @license lucide-react v0.428.0 - ISC
5
- *
6
- * This source code is licensed under the ISC license.
7
- * See the LICENSE file in the root directory of this source tree.
8
- */const nc=o("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),oc=o("ArrowRightFromLine",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M21 12H7",key:"13ipq5"}],["path",{d:"m15 18 6-6-6-6",key:"6tx3qv"}]]),rc=o("ArrowRightToLine",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]),ac=o("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),ic=o("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),sc=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"}]]),lc=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"}]]),cc=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"}]]),dc=o("ChevronsDown",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),uc=o("ChevronsUp",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),hc=o("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),fc=o("CircleEllipsis",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]),mc=o("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),pc=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"}]]),gc=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"}]]),yc=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"}]]),vc=o("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]),xc=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"}]]),bc=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"}]]),wc=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"}]]),kc=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"}]]),Sc=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"}]]),Nc=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"}]]),Cc=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"}]]),Ec=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"}]]),jc=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"}]]),_c=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"}]]),Ic=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"}]]),Tc=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"}]]),Ac=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"}]]),Mc=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"}]]),Oc=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"}]]),Dc=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"}]]),Pc=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"}]]),Rc=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"}]]),Lc=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"}]]),zc=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"}]]),Fc=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"}]]),Bc=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"}]]),Uc=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"}]]),Vc=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"}]]),Hc=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"}]]),$c=o("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Wc=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"}]]),Gc=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"}]]),qc=o("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),Yc=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"}]]),Xc=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"}]]),Kc=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"}]]),Jc=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"}]]),Zc=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"}]]),Qc=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"}]]),ed=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"}]]),td=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"}]]),nd=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"}]]),od=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"}]]),rd=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"}]]),ad=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"}]]),id=o("SquareM",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),sd=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"}]]),ld=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"}]]),cd=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"}]]),dd=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"}]]),ud=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"}]]),hd=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"}]]),fd=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"}]]),md=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"}]]),pd=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"}]]),gd=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"}]]),yd=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"}]]),vd=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
- /**
10
- * @license lucide-react v0.428.0 - ISC
11
- *
12
- * This source code is licensed under the ISC license.
13
- * See the LICENSE file in the root directory of this source tree.
14
- */const xd=r.createContext({});function bd(e,t){[e,t]=c(e,t,xd);let{toolbarProps:n}=function(e,t){const{"aria-label":n,"aria-labelledby":o,orientation:c="horizontal"}=e;let[d,u]=r.useState(!1);a((()=>{var e;u(!(!t.current||!(null===(e=t.current.parentElement)||void 0===e?void 0:e.closest('[role="toolbar"]'))))}));const{direction:h}=i(),f="rtl"===h&&"horizontal"===c;let m=l(t);const p=r.useRef(null);return{toolbarProps:{...s(e,{labelable:!0}),role:d?"group":"toolbar","aria-orientation":c,"aria-label":n,"aria-labelledby":null==n?o:void 0,onKeyDownCapture:d?void 0:e=>{if(e.currentTarget.contains(e.target)){if("horizontal"===c&&"ArrowRight"===e.key||"vertical"===c&&"ArrowDown"===e.key)f?m.focusPrevious():m.focusNext();else{if(!("horizontal"===c&&"ArrowLeft"===e.key||"vertical"===c&&"ArrowUp"===e.key))return"Tab"===e.key?(e.stopPropagation(),p.current=document.activeElement,void(e.shiftKey?m.focusFirst():m.focusLast())):void 0;f?m.focusNext():m.focusPrevious()}e.stopPropagation(),e.preventDefault()}},onFocusCapture:d?void 0:e=>{var n,o;p.current&&!e.currentTarget.contains(e.relatedTarget)&&(null===(n=t.current)||void 0===n?void 0:n.contains(e.target))&&(null===(o=p.current)||void 0===o||o.focus(),p.current=null)},onBlurCapture:d?void 0:e=>{e.currentTarget.contains(e.relatedTarget)||p.current||(p.current=e.target)}}}}(e,t),o=d({...e,values:{orientation:e.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),f=s(e);return delete f.id,u.createElement("div",{...h(n,f),...o,ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||"horizontal"},o.children)}const wd=r.forwardRef(bd);function kd(e,t){const n=f(e),o=f(t),r=n.getTime()-o.getTime();return r<0?-1:r>0?1:r}function Sd(e){const t=f(e);return+function(e){const t=f(e);return t.setHours(23,59,59,999),t}(t)==+function(e){const t=f(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}(t)}function Nd(e,t){const n=f(e),o=f(t),r=kd(n,o),a=Math.abs(function(e,t){const n=f(e),o=f(t);return 12*(n.getFullYear()-o.getFullYear())+(n.getMonth()-o.getMonth())}(n,o));let i;if(a<1)i=0;else{1===n.getMonth()&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-r*a);let t=kd(n,o)===-r;Sd(f(e))&&1===a&&1===kd(e,o)&&(t=!1),i=r*(a-Number(t))}return 0===i?0:i}function Cd(e,t,n){const o=function(e,t){return+f(e)-+f(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 Ed(e,t){return function(e,t,n){const o=x(),r=(null==n?void 0:n.locale)??o.locale??p,a=kd(e,t);if(isNaN(a))throw new RangeError("Invalid time value");const i=Object.assign({},n,{addSuffix:null==n?void 0:n.addSuffix,comparison:a});let s,l;a>0?(s=f(t),l=f(e)):(s=f(e),l=f(t));const c=Cd(l,s),d=(g(l)-g(s))/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,i):c<10?r.formatDistance("lessThanXSeconds",10,i):c<20?r.formatDistance("lessThanXSeconds",20,i):c<40?r.formatDistance("halfAMinute",0,i):c<60?r.formatDistance("lessThanXMinutes",1,i):r.formatDistance("xMinutes",1,i):0===u?r.formatDistance("lessThanXMinutes",1,i):r.formatDistance("xMinutes",u,i);if(u<45)return r.formatDistance("xMinutes",u,i);if(u<90)return r.formatDistance("aboutXHours",1,i);if(u<y){const e=Math.round(u/60);return r.formatDistance("aboutXHours",e,i)}if(u<2520)return r.formatDistance("xDays",1,i);if(u<v){const e=Math.round(u/y);return r.formatDistance("xDays",e,i)}if(u<2*v)return h=Math.round(u/v),r.formatDistance("aboutXMonths",h,i);if(h=Nd(l,s),h<12){const e=Math.round(u/v);return r.formatDistance("xMonths",e,i)}{const e=h%12,t=Math.trunc(h/12);return e<3?r.formatDistance("aboutXYears",t,i):e<9?r.formatDistance("overXYears",t,i):r.formatDistance("almostXYears",t+1,i)}}(e,function(e){return m(e,Date.now())}(e),t)}const jd=()=>{const e=S(7),{selectedLayout:t}=pl(),{setLayoutView:n}=gl();if(N()&&!zs("wasm_layouts"))return null;let o,r,a,i;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=C.jsx(T,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:C.jsx(A,{placeholder:"Select a view"})}),e[2]=r):r=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(a=C.jsx(E,{children:C.jsxs(j,{children:[C.jsx(_,{children:"View as"}),yl.map(Ad)]})}),e[3]=a):a=e[3],e[4]!==t||e[5]!==o?(i=C.jsxs(M,{"data-testid":"layout-select",value:t,onValueChange:o,children:[r,a]}),e[4]=t,e[5]=o,e[6]=i):i=e[6],i};function _d(e){const t=Id(e);return C.jsx(t,{className:"h-4 w-4"})}function Id(e){switch(e){case"vertical":return Pc;case"grid":return Ls;case"slides":return Yc;default:return b(e),w}}function Td(e){return k(e)}function Ad(e){return C.jsx(I,{value:e,children:C.jsxs("div",{className:"flex items-center gap-1.5 leading-5",children:[_d(e),C.jsx("span",{children:Td(e)})]})},e)}function Md(){const e=S(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=S(10);let o;n[0]!==e||n[1]!==t?(o=new O(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const a=o;let i;n[3]!==a?(i=()=>a.get(),n[3]=a,n[4]=i):i=n[4];const[s,l]=r.useState(i);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]!==s||n[8]!==d?(u=[s,d],n[7]=s,n[8]=d,n[9]=u):u=n[9],u}("marimo:commands",t);let a,i;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?(i={recentCommands:n,addRecentCommand:a},e[4]=n,e[5]=a,e[6]=i):i=e[6],i}function Od(e){return void 0!==e.dropdown}function Dd(e,t=""){return e.flatMap((e=>e.label?Od(e)?Dd(e.dropdown,`${t+e.label} > `):{...e,label:t+e.label}:[]))}const Pd=e=>{const t=S(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[i,s]=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]!==s?(c=C.jsx("div",{className:l,children:s}),t[2]=l,t[3]=s,t[4]=c):c=t[4],t[5]!==i||t[6]!==c?(d=C.jsxs("div",{className:"multi-icon relative w-fit",children:[i,c]}),t[5]=i,t[6]=c,t[7]=d):d=t[7],d};function Rd(){const e=S(2),{prepareForRun:t}=L();let n;e[0]!==t?(n=async e=>{if(0===e.length)return;const{cellHandles:n,cellData:o}=F(),r=[];for(const a of e){const e=n[a];e.current?(r.push(B(e.current.editorView)),e.current.registerRun()):(t({cellId:a}),r.push(o[a].code))}await U({cellIds:e,codes:r}).catch((e=>{V.error(e)}))},e[0]=t,e[1]=n):n=e[1];return R(n)}const Ld=H(null),zd=H(!1),Fd=H({chats:[],activeChatId:null}),Bd=H((e=>{const t=e(Fd);return t.chats.find((e=>e.id===t.activeChatId))}),((e,t,n)=>{t(Fd,(e=>({...e,activeChatId:n})))})),Ud=e=>{const t=S(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],$(window,"keydown",n,o);const r=e.children??"Undo";let a,i;return t[3]===Symbol.for("react.memo_cache_sentinel")?(a=C.jsx(G,{className:"ml-2",shortcut:"cmd-z"}),t[3]=a):a=t[3],t[4]!==e||t[5]!==r?(i=C.jsxs(W,{"data-testid":"undo-button",size:"sm",variant:"outline",...e,children:[r," ",a]}),t[4]=e,t[5]=r,t[6]=i):i=t[6],i};function Vd(){const e=S(3),{deleteCell:t,undoDeleteCell:n}=L();let o;return e[0]!==t||e[1]!==n?(o=e=>{if(q.get(Y))return;const{cellId:o}=e;t({cellId:o}),X({cellId:o}).catch((()=>{n()}));const{dismiss:r}=K({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:C.jsx(Ud,{"data-testid":"undo-delete-button",onClick:()=>{n(),a()}})}),a=r},e[0]=t,e[1]=n,e[2]=o):o=e[2],R(o)}function Hd(e,t,n,o=q){if(t in o.get(J))return!1;const{cellData:r,cellIds:a}=o.get(Z),i=new RegExp(`import[ \t]+${e}[ \t]+as[ \t]+${t}`,"g");for(const s of a.inOrderIds)if(i.test(r[s].code))return!1;return n(`import ${e} as ${t}`),!0}function $d(e,t,n){return Hd("marimo","mo",(o=>{const r=Q.create();t({cellId:n??"__end__",before:!1,code:o,lastCodeRun:e?o:void 0,newCellId:r,autoFocus:!1}),e&&U({cellIds:[r],codes:[o]})}))}function Wd(e){const t=S(52),{cell:n}=e,{createNewCell:o,updateCellConfig:r,updateCellCode:a,updateCellName:i,moveCell:s,sendToTop:l,sendToBottom:c,addColumnBreakpoint:d,clearCellOutput:u}=L(),h=function(e){const t=S(3),n=Rd();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],R(o)}(null==n?void 0:n.cellId),f=!ee(Y),m=Vd(),{openModal:p}=te(),g=ne(Ld),y=ee(oe),v=ee(re),x=ae(),b=ee(ie),w=ee(se);if(!n||b){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0],e}const{cellId:k,config:N,getEditorView:E,name:j,hasOutput:_,status:I}=n;let T;t[1]!==x.inOrderIds||t[2]!==k?(T=x.inOrderIds.indexOf(k),t[1]=x.inOrderIds,t[2]=k,t[3]=T):T=t[3];const A=T;let M;t[4]!==N.disabled||t[5]!==k||t[6]!==r?(M=async()=>{const e={disabled:!N.disabled};await we({configs:{[k]:e}}),r({cellId:k,config:e})},t[4]=N.disabled,t[5]=k,t[6]=r,t[7]=M):M=t[7];const O=M;let z;t[8]!==N.hide_code||t[9]!==k||t[10]!==r||t[11]!==E?(z=async()=>{const e={hide_code:!N.hide_code};await we({configs:{[k]:e}}),r({cellId:k,config:e});const t=E();t&&(e.hide_code?t.contentDOM.blur():t.focus())},t[8]=N.hide_code,t[9]=k,t[10]=r,t[11]=E,t[12]=z):z=t[12];const F=z;let B,U;t[13]===Symbol.for("react.memo_cache_sentinel")?(B=C.jsx(ud,{size:13,strokeWidth:1.5}),t[13]=B):B=t[13],t[14]!==p||t[15]!==A||t[16]!==j||t[17]!==i||t[18]!==k?(U=()=>{p(C.jsxs(ke,{children:[C.jsx(Se,{children:C.jsx(Ne,{children:"Rename cell"})}),C.jsxs("div",{className:"flex items-center justify-between",children:[C.jsx(Ce,{htmlFor:"cell-name",children:"Cell name"}),C.jsx(xl,{placeholder:`cell_${A}`,value:j,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),p(null))},onChange:e=>i({cellId:k,name:e})})]})]}))},t[14]=p,t[15]=A,t[16]=j,t[17]=i,t[18]=k,t[19]=U):U=t[19];const V=`cell_${A}`;let H,$,W;if(t[20]!==i||t[21]!==k?(H=e=>i({cellId:k,name:e}),t[20]=i,t[21]=k,t[22]=H):H=t[22],t[23]!==V||t[24]!==j||t[25]!==H?($=C.jsx(xl,{placeholder:V,value:j,onChange:H}),t[23]=V,t[24]=j,t[25]=H,t[26]=$):$=t[26],t[27]!==U||t[28]!==$||t[29]!==I||t[30]!==N.disabled||t[31]!==N.hide_code||t[32]!==h||t[33]!==y||t[34]!==g||t[35]!==k||t[36]!==_||t[37]!==E||t[38]!==a||t[39]!==F||t[40]!==O||t[41]!==u||t[42]!==v||t[43]!==o||t[44]!==s||t[45]!==l||t[46]!==c||t[47]!==w||t[48]!==d||t[49]!==f||t[50]!==m){W=[[{icon:B,label:"Name",disableClick:!0,handle:Xd,handleHeadless:U,rightElement:$},{icon:C.jsx(qc,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:"running"===I||"queued"===I||"disabled-transitively"===I||N.disabled,handle:()=>h()},{icon:C.jsx(nd,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!y,handle:()=>{g((e=>(null==e?void 0:e.cellId)===k?null:{cellId:k}))},hotkey:"cell.aiCompletion"},{icon:C.jsx(vl,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!_,handle:()=>function(e){const t=document.getElementById(D.create(e));t&&(t.classList.add("printing-output"),P(t,"result.png").finally((()=>{t.classList.remove("printing-output")})))}(k)},{icon:C.jsx(le,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const e=E();e&&ce({[k]:e},a)}},{icon:N.hide_code?C.jsx(de,{size:13,strokeWidth:1.5}):C.jsx(ue,{size:13,strokeWidth:1.5}),label:N.hide_code?"Show code":"Hide code",handle:F,hotkey:"cell.hideCode"},{icon:N.disabled?C.jsx(yd,{size:13,strokeWidth:1.5}):C.jsx(vd,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:C.jsx(he,{"data-testid":"cell-disable-switch",checked:!N.disabled,size:"sm",onCheckedChange:O}),handle:O},{icon:C.jsx(fe,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!_,handle:()=>{u({cellId:k})}}],[{icon:C.jsx(Fs,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const e=E();e&&($d(v,o),me(e,"markdown",{keepCodeAsIs:!0}))}},{icon:C.jsx(pe,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const e=E();e&&($d(v,o),me(e,"sql",{keepCodeAsIs:!0}))}},{icon:C.jsx(Bs,{}),label:"Toggle as Python",handle:()=>{const e=E();e&&($d(v,o),ge(e,"python",{force:!0}))}}],[{icon:C.jsxs(Pd,{children:[C.jsx(mc,{size:13,strokeWidth:1.5}),C.jsx(ye,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:k,before:!0})},{icon:C.jsxs(Pd,{children:[C.jsx(mc,{size:13,strokeWidth:1.5}),C.jsx(ve,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:k,before:!1})},{icon:C.jsx(ye,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>s({cellId:k,before:!0})},{icon:C.jsx(ve,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>s({cellId:k,before:!1})},{icon:C.jsx(uc,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>l({cellId:k})},{icon:C.jsx(dc,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>c({cellId:k})},{icon:C.jsx(xe,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:"columns"!==w,handle:()=>d({cellId:k})}],[{label:"Delete",hidden:!f,variant:"danger",icon:C.jsx(be,{size:13,strokeWidth:1.5}),handle:()=>{m({cellId:k})}}]].map(qd).filter(Gd),t[27]=U,t[28]=$,t[29]=I,t[30]=N.disabled,t[31]=N.hide_code,t[32]=h,t[33]=y,t[34]=g,t[35]=k,t[36]=_,t[37]=E,t[38]=a,t[39]=F,t[40]=O,t[41]=u,t[42]=v,t[43]=o,t[44]=s,t[45]=l,t[46]=c,t[47]=w,t[48]=d,t[49]=f,t[50]=m,t[51]=W}else W=t[51];return W}function Gd(e){return e.length>0}function qd(e){return e.filter(Yd)}function Yd(e){return!e.hidden}function Xd(e){null==e||e.stopPropagation(),null==e||e.preventDefault()}const Kd=H(null);function Jd(){return ee(Kd)}const Zd=H((e=>{const t=e(Kd);return t?t===Ee?null:Qd(t,e(Z)):null}));function Qd(e,t){var n;const{cellData:o,cellHandles:r,cellRuntime:a}=t,i=o[e],s=a[e],l=null==(n=r[e])?void 0:n.current;if(!i||!l)return null;return{cellId:e,name:i.name,config:i.config,status:s?s.status:"idle",getEditorView:()=>l.editorView,hasOutput:null!=(null==s?void 0:s.output)}}function eu(e){return!e.hidden}const tu=H(!1),nu=()=>{const e=S(32),[t,n]=Me(tu),o=Vs(),r=ee(Zd),a=ee(Oe);let i;e[0]!==r?(i={cell:r},e[0]=r,e[1]=i):i=e[1];let s=Wd(i).flat();s=Dd(s);const l=function(){const e=S(46),{theme:t}=je(),[n,o]=_e(),[r,a]=Ie();let i;e[0]!==o?(i=async e=>{await Te({config:e}).then((()=>{o(e)}))},e[0]=o,e[1]=i):i=e[1];const s=i;let l;e[2]!==a?(l=async e=>{await Ae({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=Us().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]!==s||e[10]!==n||e[11]!==t?(u={label:"Config > Toggle dark mode",handle:()=>{s({...n,display:{...n.display,theme:"dark"===t?"light":"dark"}})}},e[9]=s,e[10]=n,e[11]=t,e[12]=u):u=e[12];const h="vim"===n.keymap.preset;let f,m;e[13]!==s||e[14]!==n?(f=()=>{s({...n,keymap:{...n.keymap,preset:"vim"}})},e[13]=s,e[14]=n,e[15]=f):f=e[15],e[16]!==h||e[17]!==f?(m={label:"Config > Switch keymap to VIM",hidden:h,handle:f},e[16]=h,e[17]=f,e[18]=m):m=e[18];const p="default"===n.keymap.preset;let g,y,v;e[19]!==s||e[20]!==n?(g=()=>{s({...n,keymap:{...n.keymap,preset:"default"}})},e[19]=s,e[20]=n,e[21]=g):g=e[21],e[22]!==p||e[23]!==g?(y={label:"Config > Switch keymap to default (current: VIM)",hidden:p,handle:g},e[22]=p,e[23]=g,e[24]=y):y=e[24],e[25]!==s||e[26]!==n?(v=()=>{s({...n,completion:{...n.completion,copilot:!1}})},e[25]=s,e[26]=n,e[27]=v):v=e[27];const x="github"!==n.completion.copilot;let b,w;e[28]!==v||e[29]!==x?(b={label:"Config > Disable GitHub Copilot",handle:v,hidden:x},e[28]=v,e[29]=x,e[30]=b):b=e[30],e[31]!==s||e[32]!==n?(w=()=>{s({...n,completion:{...n.completion,copilot:"github"}})},e[31]=s,e[32]=n,e[33]=w):w=e[33];const k="github"===n.completion.copilot;let N,C;e[34]!==w||e[35]!==k?(N={label:"Config > Enable GitHub Copilot",handle:w,hidden:k},e[34]=w,e[35]=k,e[36]=N):N=e[36],e[37]!==d||e[38]!==u||e[39]!==m||e[40]!==y||e[41]!==b||e[42]!==N?(C=[...d,u,m,y,b,N],e[37]=d,e[38]=u,e[39]=m,e[40]=y,e[41]=b,e[42]=N,e[43]=C):C=e[43];const E=C;let j;return e[44]!==E?(j=E.filter(eu),e[44]=E,e[45]=j):j=e[45],j}();let c=xu();c=[...Dd(c),...Dd(l)];const d=c.filter(ou),u=De.keyBy(d,ru),{recentCommands:h,addRecentCommand:f}=Md(),m=new Set(h);let p,g;e[2]!==a||e[3]!==n?(p=e=>{ze(a.getHotkey("global.commandPalette").key)(e)&&(e.preventDefault(),n((e=>!e)))},e[2]=a,e[3]=n,e[4]=p):p=e[4],$(document,"keydown",p),e[5]!==o||e[6]!==a||e[7]!==f||e[8]!==n?(g=(e,t)=>{const r=o[e];if(!r)return null;const i=a.getHotkey(e);return C.jsxs(Fe,{disabled:t.disabled,onSelect:()=>{f(e),n(!1),requestAnimationFrame((()=>{r()}))},value:i.name,children:[C.jsxs("span",{children:[i.name,t.tooltip&&C.jsx("span",{className:"ml-2",children:t.tooltip})]}),C.jsx(Be,{children:C.jsx(Ue,{shortcut:i.key})})]},e)},e[5]=o,e[6]=a,e[7]=f,e[8]=n,e[9]=g):g=e[9];const y=g;let v;e[10]!==f||e[11]!==n||e[12]!==a?(v=(e,t,o,r)=>{const i=void 0===o?{}:o;return C.jsxs(Fe,{disabled:i.disabled,onSelect:()=>{f(e),n(!1),requestAnimationFrame((()=>{t()}))},value:e,children:[C.jsxs("span",{children:[e,i.tooltip&&C.jsxs("span",{className:"ml-2",children:["(",i.tooltip,")"]})]}),r&&C.jsx(Be,{children:C.jsx(Ue,{shortcut:a.getHotkey(r).key})})]},e)},e[10]=f,e[11]=n,e[12]=a,e[13]=v):v=e[13];const x=v,b=Ve;let w;e[14]===Symbol.for("react.memo_cache_sentinel")?(w=C.jsx(He,{placeholder:"Type to search..."}),e[14]=w):w=e[14];const k=$e;let N;e[15]===Symbol.for("react.memo_cache_sentinel")?(N=C.jsx(We,{children:"No results found."}),e[15]=N):N=e[15];const E=h.length>0&&C.jsxs(C.Fragment,{children:[C.jsx(Pe,{heading:"Recently Used",children:h.map((e=>{const t=u[e];return Re(e)?y(e,{disabled:null==t?void 0:t.disabled,tooltip:null==t?void 0:t.tooltip}):t&&!Od(t)?x(t.label,t.handleHeadless||t.handle,{disabled:t.disabled,tooltip:t.tooltip}):null}))}),C.jsx(Le,{})]}),j=Pe,_=a.iterate().map((e=>{if(m.has(e))return null;const t=u[e];return y(e,{disabled:null==t?void 0:t.disabled,tooltip:null==t?void 0:t.tooltip})})),I=d.map((e=>m.has(e.label)?null:x(e.label,e.handleHeadless||e.handle,{disabled:e.disabled,tooltip:e.tooltip}))),T=s.map((e=>m.has(e.label)?null:x(`Cell > ${e.label}`,e.handleHeadless||e.handle,{disabled:e.disabled,tooltip:e.tooltip})));let A,M,O;return e[16]!==j||e[17]!==_||e[18]!==I||e[19]!==T?(A=C.jsxs(j,{heading:"Commands",children:[_,I,T]}),e[16]=j,e[17]=_,e[18]=I,e[19]=T,e[20]=A):A=e[20],e[21]!==k||e[22]!==N||e[23]!==E||e[24]!==A?(M=C.jsxs(k,{children:[N,E,A]}),e[21]=k,e[22]=N,e[23]=E,e[24]=A,e[25]=M):M=e[25],e[26]!==b||e[27]!==t||e[28]!==n||e[29]!==w||e[30]!==M?(O=C.jsxs(b,{open:t,onOpenChange:n,children:[w,M]}),e[26]=b,e[27]=t,e[28]=n,e[29]=w,e[30]=M,e[31]=O):O=e[31],O};function ou(e){return!e.hotkey}function ru(e){return e.label}const au="https://static.marimo.app",iu=({onClose:e})=>{const[t,n]=r.useState(""),o=`${t}-${r.useRef(Math.random().toString(36).slice(2,6)).current}`,a=`${au}/static/${o}`;return C.jsx(ke,{className:"w-fit",children:C.jsxs("form",{onSubmit:async t=>{t.preventDefault(),e();const n=await Ge({download:!1,includeCode:!0,files:bl.INSTANCE.filenames()}),r=K({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${au}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:n,path:o})}).catch((()=>{r.dismiss(),K({title:"Error uploading static page",description:C.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",C.jsx("a",{href:qe.issuesPage,target:"_blank",rel:"noreferrer",className:"underline",children:"GitHub"}),"."]})})})),r.dismiss(),K({title:"Static page uploaded!",description:C.jsxs("div",{children:["The URL has been copied to your clipboard.",C.jsx("br",{}),"You can share it with anyone."]})})},children:[C.jsxs(Se,{children:[C.jsx(Ne,{children:"Share static notebook"}),C.jsxs(Ye,{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"," ",C.jsx("a",{href:au,target:"_blank",rel:"noreferrer",children:au}),"."]})]}),C.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[C.jsx(Xe,{"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"}),C.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:",C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx(su,{text:a}),C.jsx("span",{className:"text-primary",children:a})]})]})]}),C.jsxs(Ke,{children:[C.jsx(W,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:e,children:"Cancel"}),C.jsx(W,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await Je(a)},children:"Create"})]})]})})},su=e=>{const t=S(8),[n,o]=u.useState(!1);let r;t[0]!==e.text?(r=Ze.stopPropagation((async t=>{t.preventDefault(),await Je(e.text),o(!0),setTimeout((()=>o(!1)),2e3)})),t[0]=e.text,t[1]=r):r=t[1];const a=r;let i,s,l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(i=C.jsx(Qe,{size:14,strokeWidth:1.5}),t[2]=i):i=t[2],t[3]!==a?(s=C.jsx(W,{"data-testid":"copy-static-notebook-url-button",onClick:a,size:"xs",variant:"secondary",children:i}),t[3]=a,t[4]=s):s=t[4],t[5]!==n||t[6]!==s?(l=C.jsx(et,{content:"Copied!",open:n,children:s}),t[5]=n,t[6]=s,t[7]=l):l=t[7],l};function lu(){const e=S(3),{openConfirm:t}=te(),n=ne(tt);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:C.jsx(nt,{onClick:async()=>{n({state:ot.CLOSING}),await rt(),at()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=n,e[2]=o):o=e[2],o}const cu=new it("marimo:sidebar",st.object({selectedPanel:st.string().optional().transform((e=>e)),isSidebarOpen:st.boolean(),isTerminalOpen:st.boolean()}),(function(){return{selectedPanel:"variables",isSidebarOpen:!1,isTerminalOpen:!1}}));const{reducer:du,createActions:uu,valueAtom:hu,useActions:fu}=lt((()=>cu.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)=>cu.set(t)]),mu=()=>{const e=S(2),t=ee(hu);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 pu(){return fu()}const gu=[{type:"files",Icon:jc,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:ct,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:pe,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:Fc,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:cc,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:ed,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:dt,tooltip:"Chat with AI",position:"sidebar",hidden:!zs("chat_sidebar")},{type:"documentation",Icon:hd,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:ut,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:Hs,tooltip:"Tracing",position:"sidebar",hidden:!zs("tracing")},{type:"snippets",Icon:rd,tooltip:"Snippets",position:"sidebar"},{type:"scratchpad",Icon:Bc,hidden:!zs("scratchpad"),tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:fe,tooltip:"View errors",position:"footer"}];function yu(){const e=S(2),t=ne(ht);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=ft.parse(t.parentNode.id);break}}t((e=>({mode:mt(e.mode),cellAnchor:o}))),requestAnimationFrame((()=>{var e;null!==o&&(null==(e=document.getElementById(ft.create(o)))||e.scrollIntoView())}))},e[0]=t,e[1]=n):n=e[1];return n}const vu=e=>{null==e||e.preventDefault(),null==e||e.stopPropagation()};function xu(){const e=S(120),t=vt(),{openModal:n,closeModal:o}=te(),{openApplication:r}=pu(),{selectedPanel:a}=mu(),[i]=Me(ht),s=ee(ie),{updateCellConfig:l,undoDeleteCell:c,clearAllCellOutputs:d}=L(),u=lu(),h=function(e){const t=S(4),{openPrompt:n,closeModal:o}=te();let r;return t[0]!==e||t[1]!==n||t[2]!==o?(r=()=>{if(!e)return null;const t=pt.guessDeliminator(e),r=gt.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(gt.dirname(e),n);yt({source:e,destination:r}).then((()=>{o(),K({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}(t),f=ne(tu),m=ne($s),p=ne(Ws),g=ee(xt),y=ee(bt),v=ee(wt),{selectedLayout:x}=pl(),{setLayoutView:b}=gl(),w=yu(),E=Tu;let j,_,I,T,A,M,O,D,P,R,z,B,U;e[0]===Symbol.for("react.memo_cache_sentinel")?(j=C.jsx(td,{size:14,strokeWidth:1.5}),e[0]=j):j=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(_=C.jsx(Et,{size:14,strokeWidth:1.5}),e[1]=_):_=e[1],e[2]!==n||e[3]!==o?(I={icon:_,label:"Publish HTML to web",handle:async()=>{n(C.jsx(iu,{onClose:o}))}},e[2]=n,e[3]=o,e[4]=I):I=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(T={icon:C.jsx(Dc,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",handle:Iu},e[5]=T):T=e[5],e[6]!==I?(A={icon:j,label:"Share",handle:vu,dropdown:[I,T]},e[6]=I,e[7]=A):A=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(M=C.jsx(jt,{size:14,strokeWidth:1.5}),e[8]=M):M=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(O=C.jsx(wl,{size:14,strokeWidth:1.5}),e[9]=O):O=e[9],e[10]!==t?(D={icon:O,label:"Download as HTML",handle:async()=>{t?await kl({filename:t,includeCode:!0}):K({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},e[10]=t,e[11]=D):D=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(P=C.jsx(wl,{size:14,strokeWidth:1.5}),e[12]=P):P=e[12],e[13]!==t?(R={icon:P,label:"Download as HTML (exclude code)",handle:async()=>{t?await kl({filename:t,includeCode:!1}):K({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},e[13]=t,e[14]=R):R=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(z={icon:C.jsx(Fs,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:_u},B={icon:C.jsx(vc,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:ju},e[15]=z,e[16]=B):(z=e[15],B=e[16]),e[17]===Symbol.for("react.memo_cache_sentinel")?(U=C.jsx(vl,{size:14,strokeWidth:1.5}),e[17]=U):U=e[17];const V="present"!==i.mode;let H,$,W;e[18]!==i.mode?(H="present"===i.mode?void 0:C.jsxs("span",{children:["Only available in app view. ",C.jsx("br",{}),"Toggle with: ",kt("global.hideCode",!1)]}),e[18]=i.mode,e[19]=H):H=e[19],e[20]!==V||e[21]!==H?($={divider:!0,icon:U,label:"Download as PNG",disabled:V,tooltip:H,handle:Eu},e[20]=V,e[21]=H,e[22]=$):$=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(W=C.jsx(_t,{size:14,strokeWidth:1.5}),e[23]=W):W=e[23];const G="present"!==i.mode;let q,Y,X,J,Z,Q,oe,re,ae,se,le,ce,de,ue,he,me;e[24]!==i.mode?(q="present"===i.mode?void 0:C.jsxs("span",{children:["Only available in app view. ",C.jsx("br",{}),"Toggle with: ",kt("global.hideCode",!1)]}),e[24]=i.mode,e[25]=q):q=e[25],e[26]!==G||e[27]!==q?(Y={icon:W,label:"Download as PDF",disabled:G,tooltip:q,handle:Cu},e[26]=G,e[27]=q,e[28]=Y):Y=e[28],e[29]!==D||e[30]!==R||e[31]!==$||e[32]!==Y?(X={icon:M,label:"Download",handle:vu,dropdown:[D,R,z,B,$,Y]},e[29]=D,e[30]=R,e[31]=$,e[32]=Y,e[33]=X):X=e[33],e[34]===Symbol.for("react.memo_cache_sentinel")?(J=C.jsx($c,{size:14,strokeWidth:1.5}),e[34]=J):J=e[34],e[35]!==a||e[36]!==r?(Z=gu.flatMap((e=>{const{type:t,Icon:n,hidden:o}=e;return o?[]:{label:k(t),rightElement:E(a===t),icon:C.jsx(n,{size:14,strokeWidth:1.5}),handle:()=>r(t)}})),e[35]=a,e[36]=r,e[37]=Z):Z=e[37],e[38]!==Z?(Q={divider:!0,icon:J,label:"Helper panel",handle:vu,dropdown:Z},e[38]=Z,e[39]=Q):Q=e[39],e[40]===Symbol.for("react.memo_cache_sentinel")?(oe=C.jsx(Yc,{size:14,strokeWidth:1.5}),e[40]=oe):oe=e[40],e[41]!==i.mode?(re="present"===i.mode?C.jsx(St,{size:14,strokeWidth:1.5}):C.jsx(Oc,{size:14,strokeWidth:1.5}),e[41]=i.mode,e[42]=re):re=e[42],e[43]!==w?(ae=()=>{w()},e[43]=w,e[44]=ae):ae=e[44],e[45]!==re||e[46]!==ae?(se={icon:re,label:"Toggle app view",hotkey:"global.hideCode",handle:ae},e[45]=re,e[46]=ae,e[47]=se):se=e[47],e[48]!==x||e[49]!==b||e[50]!==i.mode||e[51]!==w?(le=yl.map(((e,t)=>{const n=Id(e);return{divider:0===t,label:Td(e),icon:C.jsx(n,{size:14,strokeWidth:1.5}),rightElement:C.jsx("div",{className:"w-8 flex justify-end",children:x===e&&C.jsx(Nt,{size:14})}),handle:()=>{b(e),"edit"===i.mode&&w()}}})),e[48]=x,e[49]=b,e[50]=i.mode,e[51]=w,e[52]=le):le=e[52],e[53]!==se||e[54]!==le?(ce={icon:oe,label:"Present as",handle:vu,dropdown:[se,...le]},e[53]=se,e[54]=le,e[55]=ce):ce=e[55],e[56]===Symbol.for("react.memo_cache_sentinel")?(de=C.jsx(Cc,{size:14,strokeWidth:1.5}),e[56]=de):de=e[56],e[57]!==t?(ue=!t||N(),e[57]=t,e[58]=ue):ue=e[58],e[59]!==ue||e[60]!==h?(he={icon:de,label:"Create notebook copy",hidden:ue,handle:h},e[59]=ue,e[60]=h,e[61]=he):he=e[61],e[62]===Symbol.for("react.memo_cache_sentinel")?(me=C.jsx(pc,{size:14,strokeWidth:1.5}),e[62]=me):me=e[62];const pe=!t;let ge,ye;e[63]!==pe?(ge={icon:me,label:"Copy code to clipboard",hidden:pe,handle:Nu},e[63]=pe,e[64]=ge):ge=e[64],e[65]===Symbol.for("react.memo_cache_sentinel")?(ye=C.jsx(vd,{size:14,strokeWidth:1.5}),e[65]=ye):ye=e[65];const ve=!g||s;let xe,be,ke;e[66]!==l?(xe=async()=>{const e=F(),t=It(e),n=De.fromEntries(t.map((e=>[e,{disabled:!1}])));await we({configs:n});for(const o of t)l({cellId:o,config:{disabled:!1}})},e[66]=l,e[67]=xe):xe=e[67],e[68]!==ve||e[69]!==xe?(be={icon:ye,label:"Enable all cells",hidden:ve,handle:xe},e[68]=ve,e[69]=xe,e[70]=be):be=e[70],e[71]===Symbol.for("react.memo_cache_sentinel")?(ke=C.jsx(yd,{size:14,strokeWidth:1.5}),e[71]=ke):ke=e[71];const Se=!y||s;let Ne,Ce,Ee,je,_e;e[72]!==l?(Ne=async()=>{const e=F(),t=Tt(e),n=De.fromEntries(t.map((e=>[e,{disabled:!0}])));await we({configs:n});for(const o of t)l({cellId:o,config:{disabled:!0}})},e[72]=l,e[73]=Ne):Ne=e[73],e[74]!==Se||e[75]!==Ne?(Ce={icon:ke,label:"Disable all cells",hidden:Se,handle:Ne},e[74]=Se,e[75]=Ne,e[76]=Ce):Ce=e[76],e[77]===Symbol.for("react.memo_cache_sentinel")?(Ee=C.jsx(fe,{size:14,strokeWidth:1.5}),e[77]=Ee):Ee=e[77],e[78]!==d?(je={icon:Ee,label:"Clear all outputs",handle:()=>{d()}},e[78]=d,e[79]=je):je=e[79],e[80]===Symbol.for("react.memo_cache_sentinel")?(_e=C.jsx(fd,{size:14,strokeWidth:1.5}),e[80]=_e):_e=e[80];const Ie=!v||s;let Te,Ae,Oe,Pe,Re,Le,ze,Fe,Be,Ue,Ve,He,$e,We,Ge,qe;e[81]!==c?(Te=()=>{c()},e[81]=c,e[82]=Te):Te=e[82],e[83]!==Ie||e[84]!==Te?(Ae={icon:_e,label:"Undo cell deletion",hidden:Ie,handle:Te},e[83]=Ie,e[84]=Te,e[85]=Ae):Ae=e[85],e[86]===Symbol.for("react.memo_cache_sentinel")?(Oe=C.jsx(xc,{size:14,strokeWidth:1.5}),e[86]=Oe):Oe=e[86],e[87]!==f?(Pe={divider:!0,icon:Oe,label:"Command palette",hotkey:"global.commandPalette",handle:()=>f((e=>!e))},e[87]=f,e[88]=Pe):Pe=e[88],e[89]===Symbol.for("react.memo_cache_sentinel")?(Re=C.jsx(At,{size:14,strokeWidth:1.5}),e[89]=Re):Re=e[89],e[90]!==m?(Le={icon:Re,label:"User settings",handle:()=>m((e=>!e))},e[90]=m,e[91]=Le):Le=e[91],e[92]===Symbol.for("react.memo_cache_sentinel")?(ze=C.jsx(Mc,{size:14,strokeWidth:1.5}),e[92]=ze):ze=e[92],e[93]!==p?(Fe={icon:ze,label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>p((e=>!e))},e[93]=p,e[94]=Fe):Fe=e[94],e[95]===Symbol.for("react.memo_cache_sentinel")?(Be={icon:C.jsx(lc,{size:14,strokeWidth:1.5}),label:"Open documentation",handle:Su},e[95]=Be):Be=e[95],e[96]===Symbol.for("react.memo_cache_sentinel")?(Ue=C.jsx(Ac,{size:14,strokeWidth:1.5}),e[96]=Ue):Ue=e[96],e[97]===Symbol.for("react.memo_cache_sentinel")?(Ve={divider:!0,icon:Ue,label:"Return home",hidden:!location.search.includes("file"),handle:ku},He=C.jsx(Nc,{size:14,strokeWidth:1.5}),e[97]=Ve,e[98]=He):(Ve=e[97],He=e[98]),e[99]===Symbol.for("react.memo_cache_sentinel")?($e={icon:He,label:"New notebook",hidden:!location.search.includes("file"),handle:wu},We=C.jsx(cd,{size:14,strokeWidth:1.5}),e[99]=$e,e[100]=We):($e=e[99],We=e[100]),e[101]!==u?(Ge={icon:We,label:"Restart kernel",variant:"danger",handle:u},e[101]=u,e[102]=Ge):Ge=e[102],e[103]!==A||e[104]!==X||e[105]!==Q||e[106]!==ce||e[107]!==he||e[108]!==ge||e[109]!==be||e[110]!==Ce||e[111]!==je||e[112]!==Ae||e[113]!==Pe||e[114]!==Le||e[115]!==Fe||e[116]!==Ge?(qe=[A,X,Q,ce,he,ge,be,Ce,je,Ae,Pe,Le,Fe,Be,Ve,$e,Ge],e[103]=A,e[104]=X,e[105]=Q,e[106]=ce,e[107]=he,e[108]=ge,e[109]=be,e[110]=Ce,e[111]=je,e[112]=Ae,e[113]=Pe,e[114]=Le,e[115]=Fe,e[116]=Ge,e[117]=qe):qe=e[117];const Ye=qe;let Xe;return e[118]!==Ye?(Xe=Ye.filter(bu),e[118]=Ye,e[119]=Xe):Xe=e[119],Xe}function bu(e){return!e.hidden}function wu(){const e=Ct();window.open(e,"_blank")}function ku(){const e=document.baseURI.split("?")[0];window.open(e,"_self")}function Su(){window.open("https://docs.marimo.io","_blank")}async function Nu(){const e=await Mt();await Je(e.contents),K({title:"Copied",description:"Code copied to clipboard."})}async function Cu(){const e=new Event("export-beforeprint"),t=new Event("export-afterprint");window.dispatchEvent(e),setTimeout((()=>window.print()),0),setTimeout((()=>window.dispatchEvent(t)),0)}async function Eu(){const e=document.getElementById("App");e&&await P(e,document.title)}async function ju(){const e=await Mt();Ot(new Blob([e.contents],{type:"text/plain"}),Dt.toPY(document.title))}async function _u(){const e=await Pt({download:!1});Ot(new Blob([e],{type:"text/plain"}),Dt.toMarkdown(document.title))}async function Iu(){const e=await Mt(),t=Rt({code:e.contents});await Je(t),K({title:"Copied",description:"Link copied to clipboard."})}function Tu(e){return C.jsx("div",{className:"w-8 flex justify-end",children:e&&C.jsx(Nt,{size:14})})}const Au=()=>{const e=S(10),t=xu();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=C.jsx(Gs,{"aria-label":"Config",shape:"circle",size:"small",className:"h-[27px] w-[27px]","data-testid":"notebook-menu-dropdown",color:"hint-green",children:C.jsx(Sl,{strokeWidth:1.8})}),e[0]=n):n=e[0];const o=n,r=Mu;let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a=e=>{const t=C.jsx(zt,{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?C.jsx(et,{content:e.tooltip,side:"left",delayDuration:100,children:C.jsx("span",{children:t})},e.label):t},e[1]=a):a=e[1];const i=a;let s,l,c,d,h;if(e[2]===Symbol.for("react.memo_cache_sentinel")?(s=C.jsx(Ft,{asChild:!0,children:o}),e[2]=s):s=e[2],e[3]!==t){let n;e[5]===Symbol.for("react.memo_cache_sentinel")?(n=e=>e.hidden?null:e.dropdown?C.jsxs(Bt,{children:[C.jsx(Ut,{"data-testid":`notebook-menu-dropdown-${e.label}`,children:r(e)}),C.jsx(Vt,{children:C.jsx(Ht,{children:e.dropdown.map((e=>C.jsxs(u.Fragment,{children:[e.divider&&C.jsx($t,{}),i(e)]},e.label)))})})]},e.label):C.jsxs(u.Fragment,{children:[e.divider&&C.jsx($t,{}),i(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=C.jsx($t,{}),e[6]=c):c=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(d=C.jsx("div",{className:"flex-1 px-2 text-xs text-muted-foreground",children:C.jsxs("span",{children:["Version: ",Lt()]})}),e[7]=d):d=e[7],e[8]!==l?(h=C.jsxs(Wt,{modal:!1,children:[s,C.jsxs(Gt,{align:"end",className:"no-print w-[240px]",children:[l,c,d]})]}),e[8]=l,e[9]=h):h=e[9],h};function Mu(e){return C.jsxs(C.Fragment,{children:[e.icon&&C.jsx("span",{className:"flex-0 mr-2",children:e.icon}),C.jsx("span",{className:"flex-1",children:e.labelElement||e.label}),e.hotkey&&C.jsx(qt,{shortcut:e.hotkey,className:"ml-4"}),e.rightElement]})}const Ou=Yt({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 Du(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?(q.set(Ou,{type:"setFind",find:n}),q.set(Ou,{type:"setCurrentView",view:e,range:{from:t.from,to:t.to}})):q.set(Ou,{type:"setCurrentView",view:e,range:{from:0,to:0}})}return q.get(Ou).isOpen?(q.set(Ou,{type:"setIsOpen",isOpen:!1}),requestAnimationFrame((()=>{q.set(Ou,{type:"setIsOpen",isOpen:!0})})),!0):(q.set(Ou,{type:"setIsOpen",isOpen:!0}),!0)}function Pu(){return!!q.get(Ou).isOpen&&(q.set(Ou,{type:"setIsOpen",isOpen:!1}),!0)}function Ru(e){return Xt("create"in e,'Expected query to have a "create" method'),e}function Lu(e){return()=>{const t=q.get(Ou),n=new Kt({search:t.findText,caseSensitive:t.caseSensitive,regexp:t.regexp,replace:t.replaceText,wholeWord:t.wholeWord});return!!n.valid&&e({query:Ru(n).create(),search:n})}}const zu=e=>Lu((({query:t})=>{const n=Jt(),o=q.get(Ou).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 i=[...n,...n].slice(a);for(const s of i){const n="next"===e?t.nextMatch(s.state,0,r??0):t.prevMatch(s.state,r??s.state.doc.length,s.state.doc.length);if(!n){r=null,s.dispatch({selection:Zt.single(0)});continue}const o=Zt.single(n.from,n.to);return s.dispatch({selection:o,effects:[Qt.scrollIntoView(o.main,{y:"center"})],userEvent:"select.search"}),q.set(Ou,{type:"setCurrentView",view:s,range:{from:n.from,to:n.to}}),n}return!1})),Fu=zu("next"),Bu=zu("prev"),Uu=Lu((({query:e})=>{var t;const n=Jt(),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()}})),Vu=Lu((({query:e})=>{const t=Jt(),n=q.get(Ou).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 i of a){const t=e.nextMatch(i.state,0,o??0);if(!t){o=null,i.dispatch({selection:Zt.single(0)});continue}const n=i.state.toText(e.getReplacement(t));return i.dispatch({changes:[{from:t.from,to:t.to,insert:n}],userEvent:"input.replace"}),Fu()}return!1})),Hu=Lu((({query:e})=>{const t=Jt();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,i=o.get(r)||new Map;i.set(`${t}:${a}`,n++),o.set(r,i)}}return{count:n,position:o}})),$u=en.define();function Wu(){const e=Jt();for(const t of e)t.state.readOnly||t.dispatch({effects:$u.of(new Kt({search:""}))})}const Gu=tn.define({create(){const e=q.get(Ou);return Ru(new Kt({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($u)&&(e=Ru(n.value).create());return e}}),qu=nn.mark({class:"cm-searchMatch"}),Yu=nn.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Xu=on.fromClass(class{constructor(e){this.view=e,this.decorations=void 0,this.decorations=this.highlight(e.state.field(Gu))}update(e){const t=e.state.field(Gu);(t!==e.startState.field(Gu)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight(e){if(!e.spec.valid)return nn.none;const{view:t}=this,n=new rn,o=t.visibleRanges,r=o.length;for(let a=0;a<r;a++){let{to:i}=o[a];const{from:s}=o[a];for(;a<r-1&&i>o[a+1].from-500;)i=o[++a].to;e.highlight(t.state,s,i,((e,o)=>{const r=t.state.selection.ranges.some((t=>t.from===e&&t.to===o));n.add(e,o,r?Yu:qu)}))}return n.finish()}},{decorations:e=>e.decorations}),Ku=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"}}),Ju=()=>{var e;const t=S(99),[n,o]=r.useState(!1),[a,i]=Me(Ou),[s,l]=r.useState(),c=r.useRef(null),d=ee(Oe);let u,h,f,m,p;if(t[0]!==n||t[1]!==a.isOpen?(u=()=>(!n||!a.isOpen)&&Du(),t[0]=n,t[1]=a.isOpen,t[2]=u):u=t[2],qs("cell.findAndReplace",u),t[3]!==a.isOpen?(h=()=>{a.isOpen&&c.current&&(c.current.focus(),c.current.select())},f=[a.isOpen],t[3]=a.isOpen,t[4]=h,t[5]=f):(h=t[4],f=t[5]),r.useEffect(h,f),t[6]!==a.isOpen||t[7]!==a.findText?(m=()=>{if(!a.isOpen)return void Wu();if(""===a.findText)return l(void 0),void Wu();const e=Hu();l(!1===e?void 0:e),function(){const e=q.get(Ou),t=Jt();for(const n of t)n.state.readOnly||n.dispatch({effects:$u.of(new Kt({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]=m):m=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(m,p),!a.isOpen)return null;const g=a.currentView;let y;t[15]!==g||t[16]!==s?(y=g&&s?null==(e=s.position.get(g.view))?void 0:e.get(`${g.range.from}:${g.range.to}`):void 0,t[15]=g,t[16]=s,t[17]=y):y=t[17];const v=y;let x,b,w,k,N,E,j,_,I,T,A;t[18]===Symbol.for("react.memo_cache_sentinel")?(x=()=>o(!0),t[18]=x):x=t[18],t[19]===Symbol.for("react.memo_cache_sentinel")?(b=()=>o(!1),t[19]=b):b=t[19],t[20]!==i?(w=e=>{"Escape"===e.key&&i({type:"setIsOpen",isOpen:!1})},t[20]=i,t[21]=w):w=t[21],t[22]!==i?(k=()=>i({type:"setIsOpen",isOpen:!1}),t[22]=i,t[23]=k):k=t[23],t[24]===Symbol.for("react.memo_cache_sentinel")?(N=C.jsx(sn,{className:"w-4 h-4"}),t[24]=N):N=t[24],t[25]!==k?(E=C.jsx("div",{className:"absolute top-0 right-0",children:C.jsx(W,{"data-testid":"close-find-replace-button",onClick:k,size:"xs",variant:"text",children:N})}),t[25]=k,t[26]=E):E=t[26],t[27]!==i?(j=e=>{i({type:"setFind",find:e.target.value})},t[27]=i,t[28]=j):j=t[28],t[29]!==a.findText||t[30]!==j?(_=C.jsx(Xe,{ref:c,"data-testid":"find-input",value:a.findText,autoFocus:!0,className:"mr-2 mb-0",placeholder:"Find",onKeyDown:Qu,onChange:j}),t[29]=a.findText,t[30]=j,t[31]=_):_=t[31],t[32]!==i?(I=e=>{i({type:"setReplace",replace:e.target.value})},t[32]=i,t[33]=I):I=t[33],t[34]!==a.replaceText||t[35]!==I?(T=C.jsx(Xe,{"data-testid":"replace-input",value:a.replaceText,placeholder:"Replace",onChange:I}),t[34]=a.replaceText,t[35]=I,t[36]=T):T=t[36],t[37]!==_||t[38]!==T?(A=C.jsxs("div",{className:"flex flex-col flex-2 gap-2 w-[55%]",children:[_,T]}),t[37]=_,t[38]=T,t[39]=A):A=t[39];const M=a.caseSensitive?"on":"off";let O,D,P;t[40]!==i?(O=e=>i({type:"setCaseSensitive",caseSensitive:e}),t[40]=i,t[41]=O):O=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(D=C.jsx(ln,{className:"w-4 h-4"}),t[42]=D):D=t[42],t[43]!==a.caseSensitive||t[44]!==M||t[45]!==O?(P=C.jsx(et,{content:"Case Sensitive",children:C.jsx(an,{size:"sm",pressed:a.caseSensitive,"data-state":M,onPressedChange:O,children:D})}),t[43]=a.caseSensitive,t[44]=M,t[45]=O,t[46]=P):P=t[46];const R=a.wholeWord?"on":"off";let L,z,F;t[47]!==i?(L=e=>i({type:"setWholeWord",wholeWord:e}),t[47]=i,t[48]=L):L=t[48],t[49]===Symbol.for("react.memo_cache_sentinel")?(z=C.jsx(pd,{className:"w-4 h-4"}),t[49]=z):z=t[49],t[50]!==a.wholeWord||t[51]!==R||t[52]!==L?(F=C.jsx(et,{content:"Match Whole Word",children:C.jsx(an,{size:"sm",pressed:a.wholeWord,"data-state":R,onPressedChange:L,children:z})}),t[50]=a.wholeWord,t[51]=R,t[52]=L,t[53]=F):F=t[53];const B=a.regexp?"on":"off";let U,V,H,$;t[54]!==i?(U=e=>i({type:"setRegex",regexp:e}),t[54]=i,t[55]=U):U=t[55],t[56]===Symbol.for("react.memo_cache_sentinel")?(V=C.jsx(Xc,{className:"w-4 h-4"}),t[56]=V):V=t[56],t[57]!==a.regexp||t[58]!==B||t[59]!==U?(H=C.jsx(et,{content:"Use Regular Expression",children:C.jsx(an,{size:"sm",pressed:a.regexp,"data-state":B,onPressedChange:U,children:V})}),t[57]=a.regexp,t[58]=B,t[59]=U,t[60]=H):H=t[60],t[61]!==P||t[62]!==F||t[63]!==H?($=C.jsxs("div",{className:"flex items-center gap-[2px]",children:[P,F,H]}),t[61]=P,t[62]=F,t[63]=H,t[64]=$):$=t[64];const G=""===a.findText||""===a.replaceText;let Y;t[65]!==G?(Y=C.jsx(W,{"data-testid":"replace-next-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:eh,disabled:G,children:"Replace Next"}),t[65]=G,t[66]=Y):Y=t[66];const X=""===a.findText||""===a.replaceText;let K,J,Z,Q,te,ne,oe,re,ae,ie,se,le;return t[67]!==X?(K=C.jsx(W,{"data-testid":"replace-all-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:th,disabled:X,children:"Replace All"}),t[67]=X,t[68]=K):K=t[68],t[69]!==Y||t[70]!==K?(J=C.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]!==$||t[73]!==J?(Z=C.jsxs("div",{className:"flex flex-col gap-2",children:[$,J]}),t[72]=$,t[73]=J,t[74]=Z):Z=t[74],t[75]!==A||t[76]!==Z?(Q=C.jsxs("div",{className:"flex items-center gap-3",children:[A,Z]}),t[75]=A,t[76]=Z,t[77]=Q):Q=t[77],t[78]===Symbol.for("react.memo_cache_sentinel")?(te=C.jsx(et,{content:"Find Previous",children:C.jsx(W,{"data-testid":"find-prev-button",size:"xs",variant:"secondary",onClick:nh,children:C.jsx(nc,{className:"w-4 h-4"})})}),t[78]=te):te=t[78],t[79]===Symbol.for("react.memo_cache_sentinel")?(ne=C.jsx(et,{content:"Find Next",children:C.jsx(W,{"data-testid":"find-next-button",size:"xs",variant:"secondary",onClick:oh,children:C.jsx(ac,{className:"w-4 h-4"})})}),t[79]=ne):ne=t[79],t[80]!==s||t[81]!==v?(oe=null!=s&&null==v&&C.jsxs("span",{className:"text-sm",children:[s.count," matches"]}),t[80]=s,t[81]=v,t[82]=oe):oe=t[82],t[83]!==s||t[84]!==v?(re=null!=s&&null!=v&&C.jsxs("span",{className:"text-sm",children:[v+1," of ",s.count]}),t[83]=s,t[84]=v,t[85]=re):re=t[85],t[86]!==oe||t[87]!==re?(ae=C.jsxs("div",{className:"flex items-center gap-2",children:[te,ne,oe,re]}),t[86]=oe,t[87]=re,t[88]=ae):ae=t[88],t[89]!==d?(ie=d.getHotkey("cell.findAndReplace"),t[89]=d,t[90]=ie):ie=t[90],t[91]!==ie.key?(se=C.jsxs("div",{className:"text-xs text-muted-foreground flex gap-1 mt-2",children:["Press"," ",C.jsx(Ue,{shortcut:ie.key})," ","again to open the native browser search."]}),t[91]=ie.key,t[92]=se):se=t[92],t[93]!==w||t[94]!==E||t[95]!==Q||t[96]!==ae||t[97]!==se?(le=C.jsx(cn,{restoreFocus:!0,autoFocus:!0,children:C.jsxs("div",{onFocus:x,onClick:Zu,onBlur:b,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:w,children:[E,Q,ae,se]})}),t[93]=w,t[94]=E,t[95]=Q,t[96]=ae,t[97]=se,t[98]=le):le=t[98],le};function Zu(e){e.stopPropagation(),e.preventDefault()}function Qu(e){"Enter"===e.key&&(e.shiftKey?Bu():Fu())}function eh(){return Vu()}function th(){const e=Uu();if(!e)return;const{dismiss:t}=K({title:"Replaced all occurrences",action:C.jsx(Ud,{"data-testid":"undo-replace-all-button",onClick:()=>{e(),n()}})}),n=t}function nh(){return Bu()}function oh(){return Fu()}function rh(e){const t=S(3),[n,o]=r.useState(!1);let a,i;return t[0]!==e?(a=()=>{if(!e)return;o(!1);const t=setTimeout((()=>{o(!0)}),200);return()=>clearTimeout(t)},i=[e],t[0]=e,t[1]=a,t[2]=i):(a=t[1],i=t[2]),r.useEffect(a,i),e&&n}const ah=()=>{const e=S(6),t=ne(tu);let n;e[0]!==t?(n=()=>t((e=>!e)),e[0]=t,e[1]=n):n=e[1];const o=n;let r,a,i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=kt("global.commandPalette"),e[2]=r):r=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(a=C.jsx(xc,{strokeWidth:1.5,size:18}),e[3]=a):a=e[3],e[4]!==o?(i=C.jsx(et,{content:r,children:C.jsx(Gs,{"data-testid":"command-palette-button",onClick:o,shape:"rectangle",color:"hint-green",children:a})}),e[4]=o,e[5]=i):i=e[5],i},ih=e=>{const{children:t}=e;return ee(ie)?null:t},sh=e=>{const{children:t}=e;return ee(ie)?t:null},lh=e=>{const t=S(35),{resetOnBlur:n,placeholderText:o,initialValue:a,flexibleWidth:i,onNameChange:s,className:l}=e,c=void 0!==n&&n,d=void 0===a?null:a,u=void 0!==i&&i,[h,f]=r.useState(d);let m;t[0]===Symbol.for("react.memo_cache_sentinel")?(m=[],t[0]=m):m=t[0];const[p,g]=r.useState(m),[y,v]=r.useState(!1),x=r.useRef(null),b=r.useRef(!1);let w,k,N;t[1]!==d?(w=()=>{f(d)},k=[d],t[1]=d,t[2]=w,t[3]=k):(w=t[2],k=t[3]),r.useEffect(w,k),t[4]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{v(!0)},t[4]=N):N=t[4];const E=N;let j;t[5]!==c||t[6]!==d?(j=e=>{var t;(null==(t=e.relatedTarget)?void 0:t.closest(".filename-input"))||(v(!1),c&&f(d))},t[5]=c,t[6]=d,t[7]=j):j=t[7];const _=j;let I;t[8]!==h?(I=gt.dirname(h||""),t[8]=h,t[9]=I):I=t[9];const T=I,A=gt.basename(h||""),M=p.filter((e=>gt.basename(e.path).startsWith(A)));let O,D;t[10]!==y||t[11]!==T?(O=async()=>{if(!y)return void g([]);const e=await fn({path:T});g(e.files)},D=[T,y],t[10]=y,t[11]=T,t[12]=O,t[13]=D):(O=t[12],D=t[13]);const{loading:P}=dn(O,D),R=function(e,t,n){if(!e)return;if(e.endsWith("/"))return;(zs("markdown")?new Set(["py","md","markdown","qmd"]):new Set(["py"])).has(gt.extension(e))||(e=e.endsWith(".")?`${e}py`:e.endsWith(".p")?`${e}y`:`${e}.py`);if(t.some((t=>t.path===e||gt.basename(t.path)===e)))return;if(n&&(n===e||gt.basename(n)===e))return;return e}(h,p,d),L=(R||M.length>0)&&C.jsxs($e,{className:"font-mono",children:[!P&&C.jsx(We,{children:"No files"}),R&&C.jsxs(Fe,{variant:"success",className:"py-2 px-3",onSelect:()=>{var e;R&&(b.current=!0,s(R),null==(e=x.current)||e.blur())},children:[C.jsx(Sc,{className:"w-4 h-4 mr-2"})," ",C.jsxs("span",{className:"text-sm",children:[d?"Rename to: ":"Save as: ",C.jsx("span",{className:"font-medium text-sm",children:gt.basename(R)})]})]},"_rename_"),M.map((e=>{const t=e.isDirectory?"directory":un(e.path),n=mn[t];return C.jsxs(Fe,{variant:e.isDirectory?"default":"muted",className:"py-2 px-3",onSelect:()=>{e.isDirectory?f(`${e.path}/`):f(e.path)},children:[C.jsx(n,{className:"w-4 h-4 mr-2"})," ",gt.basename(e.path)]},e.path)}))]}),z=10*Math.max(20,(null==h?void 0:h.length)||(null==o?void 0:o.length)||0),F=y?h||"":d||"";let B,U,V;t[14]!==u||t[15]!==z?(B=u?{maxWidth:z}:void 0,t[14]=u,t[15]=z,t[16]=B):B=t[16],t[17]!==l?(U=hn(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]!==F||t[20]!==o||t[21]!==B||t[22]!==U?(V=C.jsx(pn,{children:C.jsx(He,{"data-testid":"dir-completion-input",tabIndex:-1,rootClassName:"border-none justify-center px-1",spellCheck:"false",value:F,onKeyDown:ch,icon:null,ref:x,onValueChange:f,placeholder:o,autoComplete:"off",style:B,className:U})}),t[19]=F,t[20]=o,t[21]=B,t[22]=U,t[23]=V):V=t[23];const H=L&&"group-focus-within:block";let $,W,G,q;return t[24]!==H?($=hn("p-0 w-full min-w-80 max-w-80vw hidden",H),t[24]=H,t[25]=$):$=t[25],t[26]!==$||t[27]!==L?(W=C.jsx(gn,{side:"bottom",className:$,portal:!1,children:L}),t[26]=$,t[27]=L,t[28]=W):W=t[28],t[29]!==V||t[30]!==W?(G=C.jsxs($e,{children:[V,W]}),t[29]=V,t[30]=W,t[31]=G):G=t[31],t[32]!==_||t[33]!==G?(q=C.jsx(yn,{open:!0,modal:!1,children:C.jsx(vn,{onFocus:E,onBlur:_,shouldFilter:!1,className:"bg-transparent group filename-input",children:G})}),t[32]=_,t[33]=G,t[34]=q):q=t[34],q};function ch(e){"Escape"===e.key&&e.currentTarget.blur()}function dh(e){return JSON.stringify(e)}const uh=H(void 0),hh=H((e=>{const t=e(uh);return function(e,t,n){if(!n)return!1;const{cellIds:o,cellData:r}=e,a=o.inOrderIds.map((e=>r[e])),i=a.map((e=>e.code)),s=a.map((e=>e.config)),l=a.map((e=>e.name));return!(xn(i,n.codes)&&xn(l,n.names)&&bn(s,n.configs)&&bn(t.selectedLayout,n.layout.selectedLayout)&&bn(t.layoutData,n.layout.layoutData))}(e(Z),e(Nl),t)}));const fh=e=>{const t=S(35),n=vt(),o=()=>{Ot(new Blob([a()],{type:"text/plain"}),`${e.proposedName}.json`)};let r;t[0]!==n?(r=()=>{const e=F(),t=wn(e);return JSON.stringify({filename:n,cells:t.map((e=>({name:e.name,code:e.code})))},null,2)},t[0]=n,t[1]=r):r=t[1];const a=R(r);let i,s,l,c,d,u,h,f,m,p,g,y,v,x,b,w,k;return t[2]!==o||t[3]!==e?(i=t=>{t.preventDefault(),o(),e.closeModal()},t[2]=o,t[3]=e,t[4]=i):i=t[4],t[5]!==e?(s=t=>{"Escape"===t.key&&e.closeModal()},t[5]=e,t[6]=s):s=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(l=C.jsx(Ne,{className:"text-accent-foreground mb-6",children:"Download unsaved changes?"}),t[7]=l):l=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(c={wordBreak:"break-word"},t[8]=c):c=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(d=C.jsx("p",{children:"This app has unsaved changes. To recover:"}),u={paddingBottom:"10px"},t[9]=d,t[10]=u):(d=t[9],u=t[10]),t[11]!==e.proposedName?(h=C.jsxs("li",{style:u,children:['Click the "Download" button. This will download a file called ',C.jsxs("code",{children:[e.proposedName,".json"]}),". This file contains your code."]}),t[11]=e.proposedName,t[12]=h):h=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(f={paddingBottom:"10px"},t[13]=f):f=t[13],t[14]===Symbol.for("react.memo_cache_sentinel")?(m={display:"block",padding:"10px"},t[14]=m):m=t[14],t[15]!==e.proposedName?(p=C.jsxs("code",{style:m,children:["marimo recover ",e.proposedName,".json ",">"," ",e.proposedName,".py"]}),t[15]=e.proposedName,t[16]=p):p=t[16],t[17]!==e.proposedName?(g=C.jsxs("code",{children:[e.proposedName,".py"]}),t[17]=e.proposedName,t[18]=g):g=t[18],t[19]!==p||t[20]!==g?(y=C.jsxs("li",{style:f,children:["In your terminal, type",p,"to overwrite ",g," with the recovered changes."]}),t[19]=p,t[20]=g,t[21]=y):y=t[21],t[22]!==h||t[23]!==y?(v=C.jsx(Ye,{className:"markdown break-words",style:c,children:C.jsxs("div",{className:"prose dark:prose-invert",children:[d,C.jsxs("ol",{children:[h,y]})]})}),t[22]=h,t[23]=y,t[24]=v):v=t[24],t[25]!==e.closeModal?(x=C.jsx(W,{"aria-label":"Cancel",variant:"secondary","data-testid":"cancel-recovery-button",onClick:e.closeModal,children:"Cancel"}),t[25]=e.closeModal,t[26]=x):x=t[26],t[27]===Symbol.for("react.memo_cache_sentinel")?(b=C.jsx(W,{"data-testid":"download-recovery-button","aria-label":"Download",variant:"default",type:"submit",children:"Download"}),t[27]=b):b=t[27],t[28]!==x?(w=C.jsxs(Ke,{children:[x,b]}),t[28]=x,t[29]=w):w=t[29],t[30]!==i||t[31]!==s||t[32]!==v||t[33]!==w?(k=C.jsx(ke,{className:"w-fit",children:C.jsxs("form",{onSubmit:i,onKeyDown:s,children:[l,v,w]})}),t[30]=i,t[31]=s,t[32]=v,t[33]=w,t[34]=k):k=t[34],k},mh=e=>{const t=S(12),{filename:n,needsSave:o}=e,{openModal:r,closeModal:a}=te();let i;t[0]!==n?(i=null===n?"app":n.slice(0,-3),t[0]=n,t[1]=i):i=t[1];const s=i;let l;t[2]!==o||t[3]!==r||t[4]!==s||t[5]!==a?(l=()=>{o&&r(C.jsx(fh,{proposedName:s,closeModal:a}))},t[2]=o,t[3]=r,t[4]=s,t[5]=a,t[6]=l):l=t[6];const c=l;let d;qs("global.save",c),t[7]===Symbol.for("react.memo_cache_sentinel")?(d=kt("global.save"),t[7]=d):d=t[7];const u=o?"yellow":"gray";let h,f;return t[8]===Symbol.for("react.memo_cache_sentinel")?(h=C.jsx(Zc,{strokeWidth:1.5,size:18}),t[8]=h):h=t[8],t[9]!==c||t[10]!==u?(f=C.jsx(et,{content:d,children:C.jsx(Gs,{onClick:c,id:"save-button","aria-label":"Save",className:"rectangle",color:u,children:h})}),t[9]=c,t[10]=u,t[11]=f):f=t[11],f},ph=5e3;async function gh(){await Sn({download:!1})}async function yh(){await Nn({download:!1,includeCode:!0,files:bl.INSTANCE.filenames()})}async function vh(){await Cn({download:!1})}const xh=e=>{const t=S(13),{kioskMode:n,appConfig:o}=e,a=vt();let i;t[0]!==o||t[1]!==n?(i={appConfig:o,kioskMode:n},t[0]=o,t[1]=n,t[2]=i):i=t[2];const{saveOrNameNotebook:s,needsSave:l,closed:c}=function(e){const t=S(41),{kioskMode:n}=e,o=ee(En),{updateCellCode:a}=L(),i=jn(),[s]=Me(tt),l=vt(),{openModal:c,closeModal:d,openAlert:u}=te(),h=ne(uh),f=_n(),m=ee(hh),p=pl();let g;t[0]!==i||t[1]!==n||t[2]!==s.state||t[3]!==u||t[4]!==o.format_on_save||t[5]!==a||t[6]!==h||t[7]!==p?(g=(e,t)=>{const r=wn(i),l=r.map((e=>e.id)),c=r.map((e=>e.code)),d=r.map((e=>e.name)),f=In(i);n||0!==c.length&&(s.state===ot.OPEN?(V.log("saving to ",e),Tn({cellIds:l,codes:c,names:d,filename:e,configs:f,layout:Cl(),persist:!0}).then((()=>{t&&(K({title:"Notebook saved"}),o.format_on_save&&An(a)),h({names:d,codes:c,configs:f,layout:p})}))):u("Failed to save notebook: not connected to a kernel."))},t[0]=i,t[1]=n,t[2]=s.state,t[3]=u,t[4]=o.format_on_save,t[5]=a,t[6]=h,t[7]=p,t[8]=g):g=t[8];const y=R(g);let v;t[9]!==l||t[10]!==s.state||t[11]!==y?(v=e=>{const t=void 0!==e&&e;null!==l&&s.state===ot.OPEN&&y(l,t)},t[9]=l,t[10]=s.state,t[11]=y,t[12]=v):v=t[12];const x=R(v);let b;t[13]!==f||t[14]!==y?(b=e=>{f(e).then((e=>{null!==e&&y(e,!0)}))},t[13]=f,t[14]=y,t[15]=b):b=t[15];const w=b;let k;t[16]!==x||t[17]!==l||t[18]!==s.state||t[19]!==c||t[20]!==d||t[21]!==w?(k=()=>{x(!0),null===l&&s.state!==ot.CLOSED&&c(C.jsx(kh,{onClose:d,onSave:w}))},t[16]=x,t[17]=l,t[18]=s.state,t[19]=c,t[20]=d,t[21]=w,t[22]=k):k=t[22];const N=R(k);let E,j;if(t[23]!==i){const e=wn(i);j=e.map(wh),E=e.map(bh),t[23]=i,t[24]=E,t[25]=j}else E=t[24],j=t[25];const _=E;let I;t[26]!==i?(I=In(i),t[26]=i,t[27]=I):I=t[27];const T=I;let A;t[28]!==x||t[29]!==m||t[30]!==j||t[31]!==T||t[32]!==_||t[33]!==s||t[34]!==o||t[35]!==n?(A={onSave:x,needsSave:m,codes:j,cellConfigs:T,cellNames:_,connStatus:s,config:o,kioskMode:n},t[28]=x,t[29]=m,t[30]=j,t[31]=T,t[32]=_,t[33]=s,t[34]=o,t[35]=n,t[36]=A):A=t[36];!function(e){const t=S(22),{codes:n,cellConfigs:o,config:a,connStatus:i,cellNames:s,needsSave:l,kioskMode:c,onSave:d}=e,u=r.useRef(null);let h;t[0]!==n?(h=n.join(":"),t[0]=n,t[1]=h):h=t[1];const f=h;let m;t[2]!==o?(m=o.map(dh).join(":"),t[2]=o,t[3]=m):m=t[3];const p=m;let g;t[4]!==s?(g=s.join(":"),t[4]=s,t[5]=g):g=t[5];const y=g;let v,x;t[6]!==c||t[7]!==a.autosave||t[8]!==a.autosave_delay||t[9]!==l||t[10]!==i.state||t[11]!==d?(v=()=>{if(!c)return"after_delay"===a.autosave&&(null!==u.current&&clearTimeout(u.current),l&&i.state===ot.OPEN&&(u.current=setTimeout(d,a.autosave_delay))),()=>{null!==u.current&&clearTimeout(u.current)}},t[6]=c,t[7]=a.autosave,t[8]=a.autosave_delay,t[9]=l,t[10]=i.state,t[11]=d,t[12]=v):v=t[12],t[13]!==f||t[14]!==p||t[15]!==y||t[16]!==a||t[17]!==i.state||t[18]!==d||t[19]!==c||t[20]!==l?(x=[f,p,y,a,i.state,d,c,l],t[13]=f,t[14]=p,t[15]=y,t[16]=a,t[17]=i.state,t[18]=d,t[19]=c,t[20]=l,t[21]=x):x=t[21],r.useEffect(v,x)}(A);const M=s.state===ot.CLOSED;let O;t[37]!==N||t[38]!==m||t[39]!==M?(O={saveOrNameNotebook:N,needsSave:m,closed:M},t[37]=N,t[38]=m,t[39]=M,t[40]=O):O=t[40];return O}(i);let d;!function(){const e=S(6),t=ee(kn),{state:n}=ee(tt),o=t.auto_download.includes("markdown"),r=t.auto_download.includes("html"),a=t.auto_download.includes("ipynb"),i=!o||n!==ot.OPEN,s=!r||n!==ot.OPEN,l=!a||n!==ot.OPEN;let c,d,u;e[0]!==i?(c={delayMs:ph,whenVisible:!0,disabled:i},e[0]=i,e[1]=c):c=e[1],Ys(vh,c),e[2]!==s?(d={delayMs:ph,whenVisible:!0,disabled:s},e[2]=s,e[3]=d):d=e[3],Ys(yh,d),e[4]!==l?(u={delayMs:ph,whenVisible:!0,disabled:l},e[4]=l,e[5]=u):u=e[5],Ys(gh,u)}(),t[3]!==s?(d=e=>{e.preventDefault(),e.stopPropagation(),s()},t[3]=s,t[4]=d):d=t[4];const u=d;if(qs("global.save",s),c){let e;return t[5]!==a||t[6]!==l?(e=C.jsx(mh,{filename:a,needsSave:l}),t[5]=a,t[6]=l,t[7]=e):e=t[7],e}let h;t[8]===Symbol.for("react.memo_cache_sentinel")?(h=kt("global.save"),t[8]=h):h=t[8];const f=l?"yellow":"hint-green";let m,p;return t[9]===Symbol.for("react.memo_cache_sentinel")?(m=C.jsx(Zc,{strokeWidth:1.5,size:18}),t[9]=m):m=t[9],t[10]!==f||t[11]!==u?(p=C.jsx(et,{content:h,children:C.jsx(Gs,{"data-testid":"save-button",id:"save-button",shape:"rectangle",color:f,onClick:u,children:m})}),t[10]=f,t[11]=u,t[12]=p):p=t[12],p};function bh(e){return e.name}function wh(e){return e.code}const kh=e=>{const t=S(17),{onClose:n,onSave:o}=e,[a,i]=r.useState();let s;t[0]!==o||t[1]!==n?(s=e=>{i(e),e.trim()&&(o(e),n())},t[0]=o,t[1]=n,t[2]=s):s=t[2];const l=s;let c,d,u,h;t[3]===Symbol.for("react.memo_cache_sentinel")?(c=C.jsx(Ne,{children:"Save notebook"}),t[3]=c):c=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(d=C.jsx(Ce,{className:"text-md pt-6 px-1",children:"Save as"}),t[4]=d):d=t[4],t[5]!==l?(u=C.jsxs("div",{className:"flex flex-col",children:[d,C.jsx(lh,{onNameChange:l,placeholderText:"filename",className:"missing-filename"})]}),t[5]=l,t[6]=u):u=t[6],t[7]!==n?(h=C.jsx(W,{"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 f=!a;let m,p,g;return t[9]!==f?(m=C.jsx(W,{"data-testid":"submit-save-dialog-button","aria-label":"Save",variant:"default",disabled:f,type:"submit",children:"Save"}),t[9]=f,t[10]=m):m=t[10],t[11]!==h||t[12]!==m?(p=C.jsxs(Ke,{children:[h,m]}),t[11]=h,t[12]=m,t[13]=p):p=t[13],t[14]!==u||t[15]!==p?(g=C.jsxs(ke,{children:[c,u,p]}),t[14]=u,t[15]=p,t[16]=g):g=t[16],g},Sh=e=>{const t=S(42),{presenting:n,onTogglePresenting:o,onInterrupt:r,onRun:a,closed:i,running:s,appConfig:l}=e,c=l.width,d=ee(wt),u=ee(Mn),{undoDeleteCell:h}=L();let f,m,p=null;if(!i&&d){let e,n;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=C.jsx(fd,{size:16,strokeWidth:1.5}),t[0]=e):e=t[0],t[1]!==h?(n=C.jsx(et,{content:"Undo cell deletion",children:C.jsx(Gs,{"data-testid":"undo-delete-cell",size:"medium",color:"hint-green",shape:"circle",onClick:h,children:e})}),t[1]=h,t[2]=n):n=t[2],p=n}t[3]!==n?(f=!n&&C.jsx(Ju,{}),t[3]=n,t[4]=f):f=t[4],t[5]!==i||t[6]!==n?(m=!i&&C.jsxs("div",{className:Eh,children:[n&&C.jsx(jd,{}),C.jsx(Au,{}),C.jsx(Xs,{}),C.jsx(Ks,{description:"This will terminate the Python kernel. You'll lose all data that's in memory."})]}),t[5]=i,t[6]=n,t[7]=m):m=t[7];const g="compact"===c&&"xl:flex-row items-end";let y,v,x,b,w,k,N,E,j,_,I,T,A;return t[8]!==g?(y=hn(jh,g),t[8]=g,t[9]=y):y=t[9],t[10]!==l?(v=C.jsx(ih,{children:C.jsx(xh,{kioskMode:!1,appConfig:l})}),t[10]=l,t[11]=v):v=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(x=kt("global.hideCode"),t[12]=x):x=t[12],t[13]!==n?(b=n?C.jsx(St,{strokeWidth:1.5,size:18}):C.jsx(Oc,{strokeWidth:1.5,size:18}),t[13]=n,t[14]=b):b=t[14],t[15]!==o||t[16]!==b?(w=C.jsx(et,{content:x,children:C.jsx(Gs,{"data-testid":"hide-code-button",id:"preview-button",shape:"rectangle",color:"hint-green",onClick:o,children:b})}),t[15]=o,t[16]=b,t[17]=w):w=t[17],t[18]===Symbol.for("react.memo_cache_sentinel")?(k=C.jsx(ah,{}),N=C.jsx(Js,{}),E=C.jsx("div",{}),t[18]=k,t[19]=N,t[20]=E):(k=t[18],N=t[19],E=t[20]),t[21]!==i||t[22]!==s||t[23]!==r?(j=!i&&C.jsx(Ch,{running:s,onInterrupt:r}),t[21]=i,t[22]=s,t[23]=r,t[24]=j):j=t[24],t[25]!==i||t[26]!==u||t[27]!==a?(_=!i&&C.jsx(Nh,{needsRun:u,onRun:a}),t[25]=i,t[26]=u,t[27]=a,t[28]=_):_=t[28],t[29]!==p||t[30]!==j||t[31]!==_?(I=C.jsx(ih,{children:C.jsxs("div",{className:"flex flex-col gap-2 items-center",children:[p,j,_]})}),t[29]=p,t[30]=j,t[31]=_,t[32]=I):I=t[32],t[33]!==y||t[34]!==v||t[35]!==w||t[36]!==I?(T=C.jsxs("div",{className:y,children:[v,w,k,N,E,I]}),t[33]=y,t[34]=v,t[35]=w,t[36]=I,t[37]=T):T=t[37],t[38]!==f||t[39]!==m||t[40]!==T?(A=C.jsxs(C.Fragment,{children:[f,m,T]}),t[38]=f,t[39]=m,t[40]=T,t[41]=A):A=t[41],A},Nh=e=>{const t=S(5),{needsRun:n,onRun:o}=e;if(n){let e,n,r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=kt("global.runStale"),t[0]=e):e=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(n=C.jsx(qc,{strokeWidth:1.5,size:16}),t[1]=n):n=t[1],t[2]!==o?(r=C.jsx(et,{content:e,children:C.jsx(Gs,{"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=C.jsx(et,{content:"Nothing to run",children:C.jsx(Gs,{"data-testid":"run-button",className:"inactive-button",color:"disabled",size:"medium",shape:"circle",children:C.jsx(qc,{strokeWidth:1.5,size:16})})}),t[4]=r):r=t[4],r},Ch=e=>{const t=S(8),{running:n,onInterrupt:o}=e,r=rh(n);let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=kt("global.interrupt"),t[0]=a):a=t[0];const i=!r&&"inactive-button active:shadow-xsSolid";let s;t[1]!==i?(s=hn(i),t[1]=i,t[2]=s):s=t[2];const l=r?"yellow":"disabled",c=r?o:On.NOOP;let d,u;return t[3]===Symbol.for("react.memo_cache_sentinel")?(d=C.jsx(w,{strokeWidth:1.5,size:16}),t[3]=d):d=t[3],t[4]!==s||t[5]!==l||t[6]!==c?(u=C.jsx(et,{content:a,children:C.jsx(Gs,{className:s,"data-testid":"interrupt-button",size:"medium",color:l,shape:"circle",onClick:c,children:d})}),t[4]=s,t[5]=l,t[6]=c,t[7]=u):u=t[7],u},Eh="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",jh="absolute bottom-5 right-5 flex flex-col gap-2 items-center no-print pointer-events-auto z-30 print:hidden",_h=e=>{const t=S(7),{filename:n}=e,o=_n();let r;t[0]!==n?(r=n?gt.basename(n):"untitled marimo app",t[0]=n,t[1]=r):r=t[1];const a=null===n?"missing-filename":"filename";let i;return t[2]!==r||t[3]!==n||t[4]!==o||t[5]!==a?(i=C.jsx(lh,{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]=i):i=t[6],i};function Ih(e){return[Dn.of([{key:"Escape",preventDefault:!1,run:Pu},{key:e.getHotkey("cell.selectNextOccurrence").key,preventDefault:!0,run:Pn},{key:e.getHotkey("cell.findAndReplace").key,preventDefault:!0,run:Du}]),Rn(),Xu,Gu,Ku]}var Th=Object.defineProperty,Ah=(e,t,n)=>(((e,t,n)=>{t in e?Th(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);const Mh=tn.define({create:()=>({suggestion:null}),update(e,t){const n=t.effects.find((e=>e.is(Oh)));return t.state.doc&&n&&t.state.doc==n.value.doc?{suggestion:n.value.text}:{suggestion:null}}}),Oh=en.define();class Dh extends zn{constructor(e){super(),Ah(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 Ph=e=>on.fromClass(class{async update(t){const n=t.state.doc;if(!t.docChanged)return;const o=await e(t.state);t.view.dispatch({effects:Oh.of({text:o,doc:n})})}}),Rh=on.fromClass(class{constructor(){Ah(this,"decorations"),this.decorations=nn.none}update(e){var t;const n=null==(t=e.state.field(Mh))?void 0:t.suggestion;this.decorations=n?function(e,t){const n=e.state.selection.main.head,o=[],r=nn.widget({widget:new Dh(t),side:1});return o.push(r.range(n)),nn.set(o)}(e.view,n):nn.none}},{decorations:e=>e.decorations}),Lh=Ln.highest(Dn.of([{key:"Tab",run:e=>{var t;const n=null==(t=e.state.field(Mh))?void 0:t.suggestion;return!!n&&(e.dispatch({...zh(e.state,n,e.state.selection.main.head,e.state.selection.main.head)}),!0)}}]));function zh(e,t,n,o){return{...e.changeByRange((r=>{if(r==e.selection.main)return{changes:{from:n,to:o,insert:t},range:Zt.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:Zt.cursor(r.from-a+t.length)}})),userEvent:"input.complete"}}function Fh(e){const{delay:t=500}=e,n=function(e,t,n){let o=()=>{};return(...r)=>(o(),new Promise(((a,i)=>{const s=setTimeout((()=>a(e(...r))),t);o=()=>{clearTimeout(s),void 0!==n&&i(n)}})))}(e.fetchFn,t);return[Mh,Ph(n),Rh,Lh]}const Bh=en.define(),Uh=en.define(),Vh=en.define();function Hh(e,t){if(!e)throw new Error(t)}function $h(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 Wh(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 Gh(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 qh=Symbol("@bufbuild/protobuf/enum-type");function Yh(e){const t=e[qh];return Hh(t,"missing enum type on enum object"),t}function Xh(e,t,n,o){e[qh]=Kh(t,n.map((t=>({no:t.no,name:t.name,localName:e[t.no]}))))}function Kh(e,t,n){const o=Object.create(null),r=Object.create(null),a=[];for(const i of t){const e=Zh(i);a.push(e),o[i.name]=e,r[i.no]=e}return{typeName:e,values:a,findName:e=>o[e],findNumber:e=>r[e]}}function Jh(e,t,n){const o={};for(const r of t){const e=Zh(r);o[e.localName]=e.no,o[e.no]=e.localName}return Xh(o,e,t),o}function Zh(e){return"localName"in e?e:Object.assign(Object.assign({},e),{localName:e.name})}class Qh{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 ef(){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 tf(e,t,n){for(let a=0;a<28;a+=7){const o=e>>>a,r=!(o>>>7==0&&0==t),i=255&(r?128|o:o);if(n.push(i),!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 nf=4294967296;function of(e){const t="-"===e[0];t&&(e=e.slice(1));const n=1e6;let o=0,r=0;function a(t,a){const i=Number(e.slice(t,a));r*=n,o=o*n+i,o>=nf&&(r+=o/nf|0,o%=nf)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?sf(o,r):af(o,r)}function rf(e,t){if(({lo:e,hi:t}=function(e,t){return{lo:e>>>0,hi:t>>>0}}(e,t)),t<=2097151)return String(nf*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,i=2*o;const s=1e7;return r>=s&&(a+=Math.floor(r/s),r%=s),a>=s&&(i+=Math.floor(a/s),a%=s),i.toString()+lf(a)+lf(r)}function af(e,t){return{lo:0|e,hi:0|t}}function sf(e,t){return t=~t,e?e=1+~e:t+=1,af(e,t)}const lf=e=>{const t=String(e);return"0000000".slice(t.length)+t};function cf(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 df(){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 uf={};const hf=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"!==uf.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=>Hh(/^-?[0-9]+$/.test(e),`int64 invalid: ${e}`),n=e=>Hh(/^[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),of(e)),uEnc:e=>("string"!=typeof e&&(e=e.toString()),n(e),of(e)),dec:(e,t)=>function(e,t){let n=af(e,t);const o=2147483648&n.hi;o&&(n=sf(n.lo,n.hi));const r=rf(n.lo,n.hi);return o?"-"+r:r}(e,t),uDec:(e,t)=>rf(e,t)}}();var ff,mf,pf,gf,yf,vf;function xf(e,t,n){if(t===n)return!0;if(e==ff.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 ff.UINT64:case ff.FIXED64:case ff.INT64:case ff.SFIXED64:case ff.SINT64:return t==n}return!1}function bf(e,t){switch(e){case ff.BOOL:return!1;case ff.UINT64:case ff.FIXED64:case ff.INT64:case ff.SFIXED64:case ff.SINT64:return 0==t?hf.zero:"0";case ff.DOUBLE:case ff.FLOAT:return 0;case ff.BYTES:return new Uint8Array(0);case ff.STRING:return"";default:return 0}}function wf(e,t){switch(e){case ff.BOOL:return!1===t;case ff.STRING:return""===t;case ff.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return 0==t}}(mf=ff||(ff={}))[mf.DOUBLE=1]="DOUBLE",mf[mf.FLOAT=2]="FLOAT",mf[mf.INT64=3]="INT64",mf[mf.UINT64=4]="UINT64",mf[mf.INT32=5]="INT32",mf[mf.FIXED64=6]="FIXED64",mf[mf.FIXED32=7]="FIXED32",mf[mf.BOOL=8]="BOOL",mf[mf.STRING=9]="STRING",mf[mf.BYTES=12]="BYTES",mf[mf.UINT32=13]="UINT32",mf[mf.SFIXED32=15]="SFIXED32",mf[mf.SFIXED64=16]="SFIXED64",mf[mf.SINT32=17]="SINT32",mf[mf.SINT64=18]="SINT64",(gf=pf||(pf={}))[gf.BIGINT=0]="BIGINT",gf[gf.STRING=1]="STRING",(vf=yf||(yf={}))[vf.Varint=0]="Varint",vf[vf.Bit64=1]="Bit64",vf[vf.LengthDelimited=2]="LengthDelimited",vf[vf.StartGroup=3]="StartGroup",vf[vf.EndGroup=4]="EndGroup",vf[vf.Bit32=5]="Bit32";class kf{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(Wh(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return $h(e),cf(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){Gh(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){Wh(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){$h(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return $h(e),cf(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),o=hf.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=hf.uEnc(e);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(t)}int64(e){let t=hf.enc(e);return tf(t.lo,t.hi,this.buf),this}sint64(e){let t=hf.enc(e),n=t.hi>>31;return tf(t.lo<<1^n,(t.hi<<1|t.lo>>>31)^n,this.buf),this}uint64(e){let t=hf.uEnc(e);return tf(t.lo,t.hi,this.buf),this}}class Sf{constructor(e,t){this.varint64=ef,this.uint32=df,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 yf.Varint:for(;128&this.buf[this.pos++];);break;case yf.Bit64:this.pos+=4;case yf.Bit32:this.pos+=4;break;case yf.LengthDelimited:let n=this.uint32();this.pos+=n;break;case yf.StartGroup:for(;;){const[e,n]=this.tag();if(n===yf.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 hf.dec(...this.varint64())}uint64(){return hf.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(1&e);return e=(e>>>1|(1&t)<<31)^n,t=t>>>1^n,hf.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 hf.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return hf.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 Nf(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 bf(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 Cf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Ef=[];for(let cB=0;cB<Cf.length;cB++)Ef[Cf[cB].charCodeAt(0)]=cB;Ef["-".charCodeAt(0)]=Cf.indexOf("+"),Ef["_".charCodeAt(0)]=Cf.indexOf("/");const jf={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,i=0;for(let s=0;s<e.length;s++){if(n=Ef[e.charCodeAt(s)],void 0===n)switch(e[s]){case"=":a=0;case"\n":case"\r":case"\t":case" ":continue;default:throw Error("invalid base64 string.")}switch(a){case 0:i=n,a=1;break;case 1:o[r++]=i<<2|(48&n)>>4,i=n,a=2;break;case 2:o[r++]=(15&i)<<4|(60&n)>>2,i=n,a=3;break;case 3:o[r++]=(3&i)<<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+=Cf[t>>2],r=(3&t)<<4,o=1;break;case 1:n+=Cf[r|t>>4],r=(15&t)<<2,o=2;break;case 2:n+=Cf[r|t>>6],n+=Cf[63&t],o=0}return o&&(n+=Cf[r],n+="=",1==o&&(n+="=")),n}};function _f(e,t,n){Af(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,i]=Nf(t);for(const s of r)t.runtime.bin.readField(a,o.readerFactory(s.data),t.field,s.wireType,o);return i()}function If(e,t,n,o){Af(t,e);const r=t.runtime.bin.makeReadOptions(o),a=t.runtime.bin.makeWriteOptions(o);if(Tf(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 i=a.writerFactory();let s=t.field;s.opt||s.repeated||"enum"!=s.kind&&"scalar"!=s.kind||(s=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(s,n,i,a);const l=r.readerFactory(i.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 Tf(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 Af(e,t){Hh(e.extendee.typeName==t.getType().typeName,`extension ${e.typeName} can only be applied to message ${e.extendee.typeName}`)}function Mf(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:!wf(e.T,t[n]);case"message":return void 0!==t[n];case"map":return Object.keys(t[n]).length>0}}function Of(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?bf(e.T,e.L):void 0;break;case"message":t[n]=void 0}}function Df(e,t){if(null===e||"object"!=typeof e)return!1;if(!Object.getOwnPropertyNames(Qh.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 Pf(e,t){return Df(t)||!e.fieldWrapper?t:e.fieldWrapper.wrapField(t)}ff.DOUBLE,ff.FLOAT,ff.INT64,ff.UINT64,ff.INT32,ff.UINT32,ff.BOOL,ff.STRING,ff.BYTES;const Rf={ignoreUnknownFields:!1},Lf={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function zf(e){return e?Object.assign(Object.assign({},Rf),e):Rf}function Ff(e){return e?Object.assign(Object.assign({},Lf),e):Lf}const Bf=Symbol(),Uf=Symbol();function Vf(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 Hf(e,t,n,o,r){let a=n.localName;if(n.repeated){if(Hh("map"!=n.kind),null===t)return;if(!Array.isArray(t))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Vf(t)}`);const s=e[a];for(const e of t){if(null===e)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${Vf(e)}`);switch(n.kind){case"message":s.push(n.T.fromJson(e,o));break;case"enum":const t=Gf(n.T,e,o.ignoreUnknownFields,!0);t!==Uf&&s.push(t);break;case"scalar":try{s.push(Wf(n.T,e,n.L,!0))}catch(i){let t=`cannot decode field ${r.typeName}.${n.name} from JSON: ${Vf(e)}`;throw i instanceof Error&&i.message.length>0&&(t+=`: ${i.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: ${Vf(t)}`);const s=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=$f(n.K,e)}catch(i){let e=`cannot decode map key for field ${r.typeName}.${n.name} from JSON: ${Vf(t)}`;throw i instanceof Error&&i.message.length>0&&(e+=`: ${i.message}`),new Error(e)}switch(n.V.kind){case"message":s[l]=n.V.T.fromJson(a,o);break;case"enum":const e=Gf(n.V.T,a,o.ignoreUnknownFields,!0);e!==Uf&&(s[l]=e);break;case"scalar":try{s[l]=Wf(n.V.T,a,pf.BIGINT,!0)}catch(i){let e=`cannot decode map value for field ${r.typeName}.${n.name} from JSON: ${Vf(t)}`;throw i instanceof Error&&i.message.length>0&&(e+=`: ${i.message}`),new Error(e)}}}}else switch(n.oneof&&(e=e[n.oneof.localName]={case:a},a="value"),n.kind){case"message":const s=n.T;if(null===t&&"google.protobuf.Value"!=s.typeName)return;let l=e[a];Df(l)?l.fromJson(t,o):(e[a]=l=s.fromJson(t,o),s.fieldWrapper&&!n.oneof&&(e[a]=s.fieldWrapper.unwrapField(l)));break;case"enum":const c=Gf(n.T,t,o.ignoreUnknownFields,!1);switch(c){case Bf:Of(n,e);break;case Uf:break;default:e[a]=c}break;case"scalar":try{const o=Wf(n.T,t,n.L,!1);if(o===Bf)Of(n,e);else e[a]=o}catch(i){let e=`cannot decode field ${r.typeName}.${n.name} from JSON: ${Vf(t)}`;throw i instanceof Error&&i.message.length>0&&(e+=`: ${i.message}`),new Error(e)}}}function $f(e,t){if(e===ff.BOOL)switch(t){case"true":t=!0;break;case"false":t=!1}return Wf(e,t,pf.BIGINT,!0).toString()}function Wf(e,t,n,o){if(null===t)return o?bf(e,n):Bf;switch(e){case ff.DOUBLE:case ff.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==ff.FLOAT&&Gh(o),o;case ff.INT32:case ff.FIXED32:case ff.SFIXED32:case ff.SINT32:case ff.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==ff.UINT32||e==ff.FIXED32?Wh(a):$h(a),a;case ff.INT64:case ff.SFIXED64:case ff.SINT64:if("number"!=typeof t&&"string"!=typeof t)break;const i=hf.parse(t);return n?i.toString():i;case ff.FIXED64:case ff.UINT64:if("number"!=typeof t&&"string"!=typeof t)break;const s=hf.uParse(t);return n?s.toString():s;case ff.BOOL:if("boolean"!=typeof t)break;return t;case ff.STRING:if("string"!=typeof t)break;try{encodeURIComponent(t)}catch(r){throw new Error("invalid UTF8")}return t;case ff.BYTES:if(""===t)return new Uint8Array(0);if("string"!=typeof t)break;return jf.dec(t)}throw new Error}function Gf(e,t,n,o){if(null===t)return"google.protobuf.NullValue"==e.typeName?0:o?e.values[0].no:Bf;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 Uf}throw new Error(`cannot decode enum ${e.typeName} from JSON: ${Vf(t)}`)}function qf(e){return!(!e.repeated&&"map"!=e.kind)||!e.oneof&&("message"!=e.kind&&(!e.opt&&!e.req))}function Yf(e,t,n){if("map"==e.kind){Hh("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()]=Kf(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()]=Xf(t,a,n.enumAsInteger)}return n.emitDefaultValues||r.length>0?o:void 0}if(e.repeated){Hh(Array.isArray(t));const o=[];switch(e.kind){case"scalar":for(let n=0;n<t.length;n++)o.push(Kf(e.T,t[n]));break;case"enum":for(let r=0;r<t.length;r++)o.push(Xf(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 Kf(e.T,t);case"enum":return Xf(e.T,t,n.enumAsInteger);case"message":return Pf(e.T,t).toJson(n)}}function Xf(e,t,n){var o;if(Hh("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 Kf(e,t){switch(e){case ff.INT32:case ff.SFIXED32:case ff.SINT32:case ff.FIXED32:case ff.UINT32:return Hh("number"==typeof t),t;case ff.FLOAT:case ff.DOUBLE:return Hh("number"==typeof t),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t;case ff.STRING:return Hh("string"==typeof t),t;case ff.BOOL:return Hh("boolean"==typeof t),t;case ff.UINT64:case ff.FIXED64:case ff.INT64:case ff.SFIXED64:case ff.SINT64:return Hh("bigint"==typeof t||"string"==typeof t||"number"==typeof t),t.toString();case ff.BYTES:return Hh(t instanceof Uint8Array),jf.enc(t)}}const Jf=Symbol("@bufbuild/protobuf/unknown-fields"),Zf={readUnknownFields:!0,readerFactory:e=>new Sf(e)},Qf={writeUnknownFields:!0,writerFactory:()=>new kf};function em(e){return e?Object.assign(Object.assign({},Zf),e):Zf}function tm(e){return e?Object.assign(Object.assign({},Qf),e):Qf}function nm(e,t,n,o,r){let{repeated:a,localName:i}=n;switch(n.oneof&&((e=e[n.oneof.localName]).case!=i&&delete e.value,e.case=i,i="value"),n.kind){case"scalar":case"enum":const s="enum"==n.kind?ff.INT32:n.T;let l=am;if("scalar"==n.kind&&n.L>0&&(l=rm),a){let n=e[i];if(o==yf.LengthDelimited&&s!=ff.STRING&&s!=ff.BYTES){let e=t.uint32()+t.pos;for(;t.pos<e;)n.push(l(t,s))}else n.push(l(t,s))}else e[i]=l(t,s);break;case"message":const c=n.T;a?e[i].push(om(t,new c,r,n)):Df(e[i])?om(t,e[i],r,n):(e[i]=om(t,new c,r,n),!c.fieldWrapper||n.oneof||n.repeated||(e[i]=c.fieldWrapper.unwrapField(e[i])));break;case"map":let[d,u]=function(e,t,n){const o=t.uint32(),r=t.pos+o;let a,i;for(;t.pos<r;){const[o]=t.tag();switch(o){case 1:a=am(t,e.K);break;case 2:switch(e.V.kind){case"scalar":i=am(t,e.V.T);break;case"enum":i=t.int32();break;case"message":i=om(t,new e.V.T,n,void 0)}}}void 0===a&&(a=bf(e.K,pf.BIGINT));"string"!=typeof a&&"number"!=typeof a&&(a=a.toString());if(void 0===i)switch(e.V.kind){case"scalar":i=bf(e.V.T,pf.BIGINT);break;case"enum":i=e.V.T.values[0].no;break;case"message":i=new e.V.T}return[a,i]}(n,t,r);e[i][d]=u}}function om(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 rm(e,t){const n=am(e,t);return"bigint"==typeof n?n.toString():n}function am(e,t){switch(t){case ff.STRING:return e.string();case ff.BOOL:return e.bool();case ff.DOUBLE:return e.double();case ff.FLOAT:return e.float();case ff.INT32:return e.int32();case ff.INT64:return e.int64();case ff.UINT64:return e.uint64();case ff.FIXED64:return e.fixed64();case ff.BYTES:return e.bytes();case ff.FIXED32:return e.fixed32();case ff.SFIXED32:return e.sfixed32();case ff.SFIXED64:return e.sfixed64();case ff.SINT64:return e.sint64();case ff.UINT32:return e.uint32();case ff.SINT32:return e.sint32()}}function im(e,t,n,o){Hh(void 0!==t);const r=e.repeated;switch(e.kind){case"scalar":case"enum":let a="enum"==e.kind?ff.INT32:e.T;if(r)if(Hh(Array.isArray(t)),e.packed)!function(e,t,n,o){if(!o.length)return;e.tag(n,yf.LengthDelimited).fork();let[,r]=dm(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)cm(n,a,e.no,o);else cm(n,a,e.no,t);break;case"message":if(r){Hh(Array.isArray(t));for(const r of t)lm(n,o,e,r)}else lm(n,o,e,t);break;case"map":Hh("object"==typeof t&&null!=t);for(const[r,i]of Object.entries(t))sm(n,o,e,r,i)}}function sm(e,t,n,o,r){e.tag(n.no,yf.LengthDelimited),e.fork();let a=o;switch(n.K){case ff.INT32:case ff.FIXED32:case ff.UINT32:case ff.SFIXED32:case ff.SINT32:a=Number.parseInt(o);break;case ff.BOOL:Hh("true"==o||"false"==o),a="true"==o}switch(cm(e,n.K,1,a),n.V.kind){case"scalar":cm(e,n.V.T,2,r);break;case"enum":cm(e,ff.INT32,2,r);break;case"message":Hh(void 0!==r),e.tag(2,yf.LengthDelimited).bytes(r.toBinary(t))}e.join()}function lm(e,t,n,o){const r=Pf(n.T,o);n.delimited?e.tag(n.no,yf.StartGroup).raw(r.toBinary(t)).tag(n.no,yf.EndGroup):e.tag(n.no,yf.LengthDelimited).bytes(r.toBinary(t))}function cm(e,t,n,o){Hh(void 0!==o);let[r,a]=dm(t);e.tag(n,r)[a](o)}function dm(e){let t=yf.Varint;switch(e){case ff.BYTES:case ff.STRING:t=yf.LengthDelimited;break;case ff.DOUBLE:case ff.FIXED64:case ff.SFIXED64:t=yf.Bit64;break;case ff.FIXED32:case ff.SFIXED32:case ff.FLOAT:t=yf.Bit32}return[t,ff[e].toLowerCase()]}function um(e){if(void 0===e)return e;if(Df(e))return e.clone();if(e instanceof Uint8Array){const t=new Uint8Array(e.byteLength);return t.set(e),t}return e}function hm(e){return e instanceof Uint8Array?e:new Uint8Array(e)}class fm{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 mm(e,t){const n=gm(e);return t?n:wm(bm(n))}const pm=gm;function gm(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 ym=new Set(["constructor","toString","toJSON","valueOf"]),vm=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),xm=e=>`${e}$`,bm=e=>vm.has(e)?xm(e):e,wm=e=>ym.has(e)?xm(e):e;class km{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=mm(e,!1)}addField(e){Hh(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 Sm=(Nm=e=>new fm(e,(e=>function(e){var t,n,o,r,a,i;const s=[];let l;for(const c of"function"==typeof e?e():e){const e=c;if(e.localName=mm(c.name,void 0!==c.oneof),e.jsonName=null!==(t=c.jsonName)&&void 0!==t?t:pm(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:pf.BIGINT),e.delimited=null!==(r=c.delimited)&&void 0!==r&&r,e.req=null!==(a=c.req)&&void 0!==a&&a,e.opt=null!==(i=c.opt)&&void 0!==i&&i,void 0===c.packed&&(e.packed="enum"==c.kind||"scalar"==c.kind&&c.T!=ff.BYTES&&c.T!=ff.STRING),void 0!==c.oneof){const t="string"==typeof c.oneof?c.oneof:c.oneof.name;l&&l.name==t||(l=new km(t)),e.oneof=l,l.addField(e)}s.push(e)}return s}(e))),Cm=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]=bf(t.T,t.L)}}},{syntax:"proto3",json:{makeReadOptions:zf,makeWriteOptions:Ff,readMessage(e,t,n,o){if(null==t||Array.isArray(t)||"object"!=typeof t)throw new Error(`cannot decode message ${e.typeName} from JSON: ${Vf(t)}`);o=null!=o?o:new e;const r=new Map,a=n.typeRegistry;for(const[i,s]of Object.entries(t)){const t=e.fields.findJsonName(i);if(t){if(t.oneof){if(null===s&&"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}", "${i}"`);r.set(t.oneof,i)}Hf(o,s,t,n,e)}else{let t=!1;if((null==a?void 0:a.findExtension)&&i.startsWith("[")&&i.endsWith("]")){const r=a.findExtension(i.substring(1,i.length-1));if(r&&r.extendee.typeName==e.typeName){t=!0;const[e,a]=Nf(r);Hf(e,s,r.field,n,r),If(o,r,a(),n)}}if(!t&&!n.ignoreUnknownFields)throw new Error(`cannot decode message ${e.typeName} from JSON: key "${i}" is unknown`)}}return o},writeMessage(e,t){const n=e.getType(),o={};let r;try{for(r of n.fields.byNumber()){if(!Mf(r,e)){if(r.req)throw"required field not set";if(!t.emitDefaultValues)continue;if(!qf(r))continue}const n=Yf(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 i=a.findExtensionFor(n.typeName,r.no);if(i&&Tf(e,i)){const n=_f(e,i,t),r=Yf(i.field,n,t);void 0!==r&&(o[i.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)=>Wf(e,t,null!=n?n:pf.BIGINT,!0),writeScalar(e,t,n){if(void 0!==t)return n||wf(e,t)?Kf(e,t):void 0},debug:Vf},bin:{makeReadOptions:em,makeWriteOptions:tm,listUnknownFields(e){var t;return null!==(t=e[Jf])&&void 0!==t?t:[]},discardUnknownFields(e){delete e[Jf]},writeUnknownFields(e,t){const n=e[Jf];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[Jf])||(r[Jf]=[]),r[Jf].push({no:t,wireType:n,data:o})},readMessage(e,t,n,o,r){const a=e.getType(),i=r?t.len:t.pos+n;let s,l;for(;t.pos<i&&([s,l]=t.tag(),!0!==r||l!=yf.EndGroup);){const n=a.fields.find(s);if(n)nm(e,t,n,l,o);else{const n=t.skip(l,s);o.readUnknownFields&&this.onUnknownField(e,s,l,n)}}if(r&&(l!=yf.EndGroup||s!==n))throw new Error("invalid end group tag")},readField:nm,writeMessage(e,t,n){const o=e.getType();for(const r of o.fields.byNumber())if(Mf(r,e))im(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&&im(e,t,n,o)}},util:Object.assign(Object.assign({},{setEnumType:Xh,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 i=a[n].value;t&&"message"==t.kind&&!Df(i,t.T)?i=new t.T(i):t&&"scalar"===t.kind&&t.T===ff.BYTES&&(i=hm(i)),r[n]={case:e,value:i};break;case"scalar":case"enum":let s=a[n];o.T===ff.BYTES&&(s=o.repeated?s.map(hm):hm(s)),r[n]=s;break;case"map":switch(o.V.kind){case"scalar":case"enum":if(o.V.T===ff.BYTES)for(const[t,o]of Object.entries(a[n]))r[n][t]=hm(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=>Df(e,l)?e:new l(e)));else{const e=a[n];l.fieldWrapper?"google.protobuf.BytesValue"===l.typeName?r[n]=hm(e):r[n]=e:r[n]=Df(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)=>xf(e.T,t,r[n])));case"enum":return o.every(((e,t)=>xf(ff.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 xf(ff.INT32,o,r);case"scalar":return xf(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 xf(ff.INT32,o.value,r.value);case"scalar":return xf(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=>xf(ff.INT32,o[e],r[e])));case"scalar":const a=e.V.T;return n.every((e=>xf(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(um);else if("map"==r.kind){n=o[r.localName];for(const[e,o]of Object.entries(t))n[e]=um(o)}else n="oneof"==r.kind?r.findField(t.case)?{case:t.case,value:um(t.value)}:{case:void 0}:um(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:Nm,initFields:Cm}),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),i={[a]:function(t){e.util.initFields(this),e.util.initPartial(t,this)}}[a];return Object.setPrototypeOf(i.prototype,new Qh),Object.assign(i,{runtime:e,typeName:t,fields:e.util.newFieldList(n),fromBinary:(e,t)=>(new i).fromBinary(e,t),fromJson:(e,t)=>(new i).fromJson(e,t),fromJsonString:(e,t)=>(new i).fromJsonString(e,t),equals:(t,n)=>e.util.equals(i,t,n)}),i}(this,e,t,n)},makeEnum:Jh,makeEnumType:Kh,getEnumType:Yh,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 Nm,Cm,Em,jm,_m,Im,Tm,Am,Mm,Om,Dm,Pm,Rm,Lm,zm,Fm;(jm=Em||(Em={}))[jm.Unary=0]="Unary",jm[jm.ServerStreaming=1]="ServerStreaming",jm[jm.ClientStreaming=2]="ClientStreaming",jm[jm.BiDiStreaming=3]="BiDiStreaming",(Im=_m||(_m={}))[Im.NoSideEffects=1]="NoSideEffects",Im[Im.Idempotent=2]="Idempotent",(Am=Tm||(Tm={}))[Am.UNSPECIFIED=0]="UNSPECIFIED",Am[Am.JUPYTER_FORMAT=77]="JUPYTER_FORMAT",Sm.util.setEnumType(Tm,"exa.codeium_common_pb.ExperimentKey",[{no:0,name:"UNSPECIFIED"},{no:77,name:"JUPYTER_FORMAT"}]),(Om=Mm||(Mm={}))[Om.CODEIUM=0]="CODEIUM",Sm.util.setEnumType(Mm,"exa.codeium_common_pb.AuthSource",[{no:0,name:"AUTH_SOURCE_CODEIUM"}]),(Pm=Dm||(Dm={}))[Pm.UNSPECIFIED=0]="UNSPECIFIED",Pm[Pm.ENABLE_CODEIUM=1]="ENABLE_CODEIUM",Pm[Pm.DISABLE_CODEIUM=2]="DISABLE_CODEIUM",Pm[Pm.SHOW_PREVIOUS_COMPLETION=3]="SHOW_PREVIOUS_COMPLETION",Pm[Pm.SHOW_NEXT_COMPLETION=4]="SHOW_NEXT_COMPLETION",Sm.util.setEnumType(Dm,"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"}]),(Lm=Rm||(Rm={}))[Lm.UNSPECIFIED=0]="UNSPECIFIED",Lm[Lm.TYPING_AS_SUGGESTED=1]="TYPING_AS_SUGGESTED",Lm[Lm.CACHE=2]="CACHE",Lm[Lm.NETWORK=3]="NETWORK",Sm.util.setEnumType(Rm,"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"}]),(Fm=zm||(zm={}))[Fm.UNSPECIFIED=0]="UNSPECIFIED",Fm[Fm.C=1]="C",Fm[Fm.CLOJURE=2]="CLOJURE",Fm[Fm.COFFEESCRIPT=3]="COFFEESCRIPT",Fm[Fm.CPP=4]="CPP",Fm[Fm.CSHARP=5]="CSHARP",Fm[Fm.CSS=6]="CSS",Fm[Fm.CUDACPP=7]="CUDACPP",Fm[Fm.DOCKERFILE=8]="DOCKERFILE",Fm[Fm.GO=9]="GO",Fm[Fm.GROOVY=10]="GROOVY",Fm[Fm.HANDLEBARS=11]="HANDLEBARS",Fm[Fm.HASKELL=12]="HASKELL",Fm[Fm.HCL=13]="HCL",Fm[Fm.HTML=14]="HTML",Fm[Fm.INI=15]="INI",Fm[Fm.JAVA=16]="JAVA",Fm[Fm.JAVASCRIPT=17]="JAVASCRIPT",Fm[Fm.JSON=18]="JSON",Fm[Fm.JULIA=19]="JULIA",Fm[Fm.KOTLIN=20]="KOTLIN",Fm[Fm.LATEX=21]="LATEX",Fm[Fm.LESS=22]="LESS",Fm[Fm.LUA=23]="LUA",Fm[Fm.MAKEFILE=24]="MAKEFILE",Fm[Fm.MARKDOWN=25]="MARKDOWN",Fm[Fm.OBJECTIVEC=26]="OBJECTIVEC",Fm[Fm.OBJECTIVECPP=27]="OBJECTIVECPP",Fm[Fm.PERL=28]="PERL",Fm[Fm.PHP=29]="PHP",Fm[Fm.PLAINTEXT=30]="PLAINTEXT",Fm[Fm.PROTOBUF=31]="PROTOBUF",Fm[Fm.PBTXT=32]="PBTXT",Fm[Fm.PYTHON=33]="PYTHON",Fm[Fm.R=34]="R",Fm[Fm.RUBY=35]="RUBY",Fm[Fm.RUST=36]="RUST",Fm[Fm.SASS=37]="SASS",Fm[Fm.SCALA=38]="SCALA",Fm[Fm.SCSS=39]="SCSS",Fm[Fm.SHELL=40]="SHELL",Fm[Fm.SQL=41]="SQL",Fm[Fm.STARLARK=42]="STARLARK",Fm[Fm.SWIFT=43]="SWIFT",Fm[Fm.TSX=44]="TSX",Fm[Fm.TYPESCRIPT=45]="TYPESCRIPT",Fm[Fm.VISUALBASIC=46]="VISUALBASIC",Fm[Fm.VUE=47]="VUE",Fm[Fm.XML=48]="XML",Fm[Fm.XSL=49]="XSL",Fm[Fm.YAML=50]="YAML",Fm[Fm.SVELTE=51]="SVELTE",Fm[Fm.TOML=52]="TOML",Fm[Fm.DART=53]="DART",Fm[Fm.RST=54]="RST",Fm[Fm.OCAML=55]="OCAML",Fm[Fm.CMAKE=56]="CMAKE",Fm[Fm.PASCAL=57]="PASCAL",Fm[Fm.ELIXIR=58]="ELIXIR",Fm[Fm.FSHARP=59]="FSHARP",Fm[Fm.LISP=60]="LISP",Fm[Fm.MATLAB=61]="MATLAB",Fm[Fm.POWERSHELL=62]="POWERSHELL",Fm[Fm.SOLIDITY=63]="SOLIDITY",Fm[Fm.ADA=64]="ADA",Fm[Fm.OCAML_INTERFACE=65]="OCAML_INTERFACE",Sm.util.setEnumType(zm,"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 Bm=class e extends Qh{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",hf.zero),Sm.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 Sm.util.equals(e,t,n)}};n(Bm,"runtime",Sm),n(Bm,"typeName","exa.codeium_common_pb.Completion"),n(Bm,"fields",Sm.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 Um=Bm;const Vm=class e extends Qh{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",hf.zero),n(this,"userAgent",""),n(this,"url",""),n(this,"authSource",Mm.CODEIUM),Sm.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 Sm.util.equals(e,t,n)}};n(Vm,"runtime",Sm),n(Vm,"typeName","exa.codeium_common_pb.Metadata"),n(Vm,"fields",Sm.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:Sm.getEnumType(Mm)}])));let Hm=Vm;const $m=class e extends Qh{constructor(e){super(),n(this,"tabSize",hf.zero),n(this,"insertSpaces",!1),Sm.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 Sm.util.equals(e,t,n)}};n($m,"runtime",Sm),n($m,"typeName","exa.codeium_common_pb.EditorOptions"),n($m,"fields",Sm.util.newFieldList((()=>[{no:1,name:"tab_size",kind:"scalar",T:4},{no:2,name:"insert_spaces",kind:"scalar",T:8}])));let Wm=$m;e=class extends Qh{constructor(e){super(),n(this,"eventType",Dm.UNSPECIFIED),n(this,"eventJson",""),n(this,"timestampUnixMs",hf.zero),Sm.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 Sm.util.equals(e,t,n)}},n(e,"runtime",Sm),n(e,"typeName","exa.codeium_common_pb.Event"),n(e,"fields",Sm.util.newFieldList((()=>[{no:1,name:"event_type",kind:"enum",T:Sm.getEnumType(Dm)},{no:2,name:"event_json",kind:"scalar",T:9},{no:3,name:"timestamp_unix_ms",kind:"scalar",T:3}])));class Gm extends zn{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=Fn.define({combine:e=>Bn(e,{language:zm.TYPESCRIPT,timeout:150,widgetClass:Gm,alwaysOn:!0},{})}),Ym=Fn.define({combine:e=>Bn(e,{override:()=>[]},{})}),Xm=nn.mark({class:"cm-ghostText"}),Km=tn.define({create:e=>null,update(e,t){var n;const o=t.state.facet(qm);for(const r of t.effects){if(r.is(Bh)){const{changeSpecs:e,index:t}=r.value,a=e[t].map((e=>Xm.range(e.absoluteStartPos,e.absoluteEndPos))),i=null==(n=a.at(-1))?void 0:n.to;return{index:t,decorations:nn.set([...a,...void 0!==i&&e.length>1&&o.widgetClass?[nn.widget({widget:new o.widgetClass(t,e.length),side:1}).range(i)]:[]]),changeSpecs:e,reverseChangeSet:r.value.reverseChangeSet}}if(r.is(Uh))return null;if(r.is(Vh))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)||nn.none))}),Jm=Un.define(),Zm=Un.define();var Qm,ep;function tp(e){const t=Qm[e];return"string"!=typeof t?e.toString():t[0].toLowerCase()+t.substring(1).replace(/[A-Z]/g,(e=>"_"+e.toLowerCase()))}let np;(ep=Qm||(Qm={}))[ep.Canceled=1]="Canceled",ep[ep.Unknown=2]="Unknown",ep[ep.InvalidArgument=3]="InvalidArgument",ep[ep.DeadlineExceeded=4]="DeadlineExceeded",ep[ep.NotFound=5]="NotFound",ep[ep.AlreadyExists=6]="AlreadyExists",ep[ep.PermissionDenied=7]="PermissionDenied",ep[ep.ResourceExhausted=8]="ResourceExhausted",ep[ep.FailedPrecondition=9]="FailedPrecondition",ep[ep.Aborted=10]="Aborted",ep[ep.OutOfRange=11]="OutOfRange",ep[ep.Unimplemented=12]="Unimplemented",ep[ep.Internal=13]="Internal",ep[ep.Unavailable=14]="Unavailable",ep[ep.DataLoss=15]="DataLoss",ep[ep.Unauthenticated=16]="Unauthenticated";class op extends Error{constructor(e,t=Qm.Unknown,n,o,r){super(function(e,t){return e.length?`[${tp(t)}] ${e}`:`[${tp(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=Qm.Unknown){return e instanceof op?e:e instanceof Error?"AbortError"==e.name?new op(e.message,Qm.Canceled):new op(e.message,t,void 0,void 0,e):new op(String(e),t,void 0,void 0,e)}static[Symbol.hasInstance](e){return e instanceof Error&&(Object.getPrototypeOf(e)===op.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 rp=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)}))}}},ap=function(e){return this instanceof ap?(this.v=e,this):new ap(e)},ip=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={},i("next"),i("throw"),i("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),o[Symbol.asyncIterator]=function(){return this},o;function i(e,t){r[e]&&(o[e]=function(t){return new Promise((function(n,o){a.push([e,t,n,o])>1||s(e,t)}))},t&&(o[e]=t(o[e])))}function s(e,t){try{(n=r[e](t)).value instanceof ap?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){s("next",e)}function c(e){s("throw",e)}function d(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}};function sp(e){return ip(this,arguments,(function*(){yield ap(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:ap(e[o](t)),done:!1}:r?r(t):t}:r}}(rp(e)))}))}var lp=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)}))}}},cp=function(e){return this instanceof cp?(this.v=e,this):new cp(e)},dp=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={},i("next"),i("throw"),i("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),o[Symbol.asyncIterator]=function(){return this},o;function i(e,t){r[e]&&(o[e]=function(t){return new Promise((function(n,o){a.push([e,t,n,o])>1||s(e,t)}))},t&&(o[e]=t(o[e])))}function s(e,t){try{(n=r[e](t)).value instanceof cp?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){s("next",e)}function c(e){s("throw",e)}function d(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}};function up(e,t){const n=function(){var n,o;return dp(this,arguments,(function*(){const r=yield cp(e);null===(n=null==t?void 0:t.onHeader)||void 0===n||n.call(t,r.header),yield cp(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:cp(e[o](t)),done:!1}:r?r(t):t}:r}}(lp(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 hp(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 fp(){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 mp(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 pp(e,t){return t instanceof e?t:new e(t)}function gp(e,t){function n(t){return!0===t.done?t:{done:t.done,value:pp(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 yp(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 vp(e){var t;const n=Object.assign({},e);return null!==(t=n.ignoreUnknownFields)&&void 0!==t||(n.ignoreUnknownFields=!0),n}function xp(e,t,n,o){const r=t?bp(e.I,o):wp(e.I,n);return{parse:(t?bp(e.O,o):wp(e.O,n)).parse,serialize:r.serialize}}function bp(e,t){return{parse(n){try{return e.fromBinary(n,t)}catch(o){const e=o instanceof Error?o.message:String(o);throw new op(`parse binary: ${e}`,Qm.InvalidArgument)}},serialize(e){try{return e.toBinary(t)}catch(n){const e=n instanceof Error?n.message:String(n);throw new op(`serialize binary: ${e}`,Qm.Internal)}}}}function wp(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,i=vp(t);return{parse(t){try{const n=a.decode(t);return e.fromJsonString(n,i)}catch(n){throw op.from(n,Qm.InvalidArgument)}},serialize(e){try{const t=e.toJsonString(i);return r.encode(t)}catch(t){throw op.from(t,Qm.Internal)}}}}const kp=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i;function Sp(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(!np){np={};for(const e of Object.values(Qm))"string"!=typeof e&&(np[tp(e)]=e)}return np[e]}(e.code);if(void 0===o)throw n;const r=e.message;if(null!=r&&"string"!=typeof r)throw n;const a=new op(null!=r?r:"",o,t);if("details"in e&&Array.isArray(e.details))for(const s of e.details){if(null===s||"object"!=typeof s||Array.isArray(s)||"string"!=typeof s.type||"string"!=typeof s.value||"debug"in s&&"object"!=typeof s.debug)throw n;try{a.details.push({type:s.type,value:jf.dec(s.value),debug:s.debug})}catch(i){throw n}}return a}function Np(e){const t=new op("invalid end stream",Qm.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?Sp(n.error,o,t):void 0}}const Cp="Content-Type",Ep="Content-Length",jp="Content-Encoding",_p="Accept-Encoding",Ip="Connect-Protocol-Version";function Tp(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 Ap(e,t,n,o,r){const a=new Headers(null!=o?o:{});return void 0!==n&&a.set("Connect-Timeout-Ms",`${n}`),a.set(Cp,e==Em.Unary?t?"application/proto":"application/json":t?"application/connect+proto":"application/connect+json"),a.set(Ip,"1"),a}function Mp(e,t,n){const o=function(e){const t=null==e?void 0:e.match(kp);if(!t)return;return{stream:!!t[1],binary:!!t[3]}}(n.get("Content-Type"));if(200!==t){const r=new op(`HTTP ${t}`,function(e){switch(e){case 400:return Qm.InvalidArgument;case 401:return Qm.Unauthenticated;case 403:return Qm.PermissionDenied;case 404:return Qm.Unimplemented;case 408:return Qm.DeadlineExceeded;case 409:return Qm.Aborted;case 412:return Qm.FailedPrecondition;case 413:case 431:return Qm.ResourceExhausted;case 415:return Qm.Internal;case 429:case 502:case 503:case 504:return Qm.Unavailable;default:return Qm.Unknown}}(t),n);if(e==Em.Unary&&o&&!o.binary)return{isUnaryError:!0,unaryError:r};throw r}return{isUnaryError:!1}}const Op="application/";function Dp(e,t,n){let o="?connect=v1";const r=e.header.get(Cp);0===(null==r?void 0:r.indexOf(Op))&&(o+="&encoding="+encodeURIComponent(r.slice(12)));const a=e.header.get(jp);null!==a&&"identity"!==a&&(o+="&compression="+encodeURIComponent(a),n=!0),n&&(o+="&base64=1"),o+="&message="+function(e,t){return t?jf.enc(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):encodeURIComponent((new TextDecoder).decode(e))}(t,n);const i=e.url+o,s=new Headers(e.header);return[Ip,Cp,Ep,jp,_p].forEach((e=>s.delete(e))),Object.assign(Object.assign({},e),{init:Object.assign(Object.assign({},e.init),{method:"GET"}),url:i,header:s})}function Pp(e){const{signal:t,cleanup:n}=function(e){const t=new AbortController,n=()=>{t.abort(new op("the operation timed out",Qm.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(hp(this));for(const e of n)e.removeEventListener("abort",o)}return t}(e.signal,t);return[o.signal,function(e){const r=op.from(t.aborted?hp(t):e);return o.abort(r),n(),Promise.reject(r)},function(){n(),o.abort()}]}var Rp,Lp,zp,Fp,Bp,Up;(Lp=Rp||(Rp={}))[Lp.UNSPECIFIED=0]="UNSPECIFIED",Lp[Lp.INACTIVE=1]="INACTIVE",Lp[Lp.PROCESSING=2]="PROCESSING",Lp[Lp.SUCCESS=3]="SUCCESS",Lp[Lp.WARNING=4]="WARNING",Lp[Lp.ERROR=5]="ERROR",Sm.util.setEnumType(Rp,"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"}]),(Fp=zp||(zp={}))[Fp.UNSPECIFIED=0]="UNSPECIFIED",Fp[Fp.SINGLE=1]="SINGLE",Fp[Fp.MULTI=2]="MULTI",Sm.util.setEnumType(zp,"exa.language_server_pb.LineType",[{no:0,name:"LINE_TYPE_UNSPECIFIED"},{no:1,name:"LINE_TYPE_SINGLE"},{no:2,name:"LINE_TYPE_MULTI"}]),(Up=Bp||(Bp={}))[Up.UNSPECIFIED=0]="UNSPECIFIED",Up[Up.INLINE=1]="INLINE",Up[Up.BLOCK=2]="BLOCK",Up[Up.INLINE_MASK=3]="INLINE_MASK",Sm.util.setEnumType(Bp,"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 Vp=class e extends Qh{constructor(e){super(),n(this,"threshold",0),Sm.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 Sm.util.equals(e,t,n)}};n(Vp,"runtime",Sm),n(Vp,"typeName","exa.language_server_pb.MultilineConfig"),n(Vp,"fields",Sm.util.newFieldList((()=>[{no:1,name:"threshold",kind:"scalar",T:2}])));let Hp=Vp;const $p=class e extends Qh{constructor(e){super(),n(this,"metadata"),n(this,"document"),n(this,"editorOptions"),n(this,"otherDocuments",[]),n(this,"experimentConfig"),n(this,"modelName",""),n(this,"multilineConfig"),Sm.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 Sm.util.equals(e,t,n)}};n($p,"runtime",Sm),n($p,"typeName","exa.language_server_pb.GetCompletionsRequest"),n($p,"fields",Sm.util.newFieldList((()=>[{no:1,name:"metadata",kind:"message",T:Hm},{no:2,name:"document",kind:"message",T:ag},{no:3,name:"editor_options",kind:"message",T:Wm},{no:5,name:"other_documents",kind:"message",T:ag,repeated:!0},{no:7,name:"experiment_config",kind:"message",T:sg},{no:10,name:"model_name",kind:"scalar",T:9},{no:13,name:"multiline_config",kind:"message",T:Hp}])));let Wp=$p;const Gp=class e extends Qh{constructor(e){super(),n(this,"state"),n(this,"completionItems",[]),Sm.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 Sm.util.equals(e,t,n)}};n(Gp,"runtime",Sm),n(Gp,"typeName","exa.language_server_pb.GetCompletionsResponse"),n(Gp,"fields",Sm.util.newFieldList((()=>[{no:1,name:"state",kind:"message",T:cg},{no:2,name:"completion_items",kind:"message",T:yg,repeated:!0}])));let qp=Gp;const Yp=class e extends Qh{constructor(e){super(),n(this,"metadata"),n(this,"completionId",""),Sm.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 Sm.util.equals(e,t,n)}};n(Yp,"runtime",Sm),n(Yp,"typeName","exa.language_server_pb.AcceptCompletionRequest"),n(Yp,"fields",Sm.util.newFieldList((()=>[{no:1,name:"metadata",kind:"message",T:Hm},{no:2,name:"completion_id",kind:"scalar",T:9}])));let Xp=Yp;const Kp=class e extends Qh{constructor(e){super(),Sm.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 Sm.util.equals(e,t,n)}};n(Kp,"runtime",Sm),n(Kp,"typeName","exa.language_server_pb.AcceptCompletionResponse"),n(Kp,"fields",Sm.util.newFieldList((()=>[])));let Jp=Kp;const Zp=class e extends Qh{constructor(e){super(),Sm.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 Sm.util.equals(e,t,n)}};n(Zp,"runtime",Sm),n(Zp,"typeName","exa.language_server_pb.GetAuthTokenRequest"),n(Zp,"fields",Sm.util.newFieldList((()=>[])));let Qp=Zp;const eg=class e extends Qh{constructor(e){super(),n(this,"authToken",""),n(this,"uuid",""),Sm.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 Sm.util.equals(e,t,n)}};n(eg,"runtime",Sm),n(eg,"typeName","exa.language_server_pb.GetAuthTokenResponse"),n(eg,"fields",Sm.util.newFieldList((()=>[{no:1,name:"auth_token",kind:"scalar",T:9},{no:2,name:"uuid",kind:"scalar",T:9}])));let tg=eg;const ng=class e extends Qh{constructor(e){super(),n(this,"row",hf.zero),n(this,"col",hf.zero),Sm.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 Sm.util.equals(e,t,n)}};n(ng,"runtime",Sm),n(ng,"typeName","exa.language_server_pb.DocumentPosition"),n(ng,"fields",Sm.util.newFieldList((()=>[{no:1,name:"row",kind:"scalar",T:4},{no:2,name:"col",kind:"scalar",T:4}])));let og=ng;const rg=class e extends Qh{constructor(e){super(),n(this,"absolutePath",""),n(this,"relativePath",""),n(this,"text",""),n(this,"editorLanguage",""),n(this,"language",zm.UNSPECIFIED),n(this,"cursorOffset",hf.zero),n(this,"cursorPosition"),n(this,"lineEnding",""),Sm.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 Sm.util.equals(e,t,n)}};n(rg,"runtime",Sm),n(rg,"typeName","exa.language_server_pb.Document"),n(rg,"fields",Sm.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:Sm.getEnumType(zm)},{no:6,name:"cursor_offset",kind:"scalar",T:4},{no:8,name:"cursor_position",kind:"message",T:og},{no:7,name:"line_ending",kind:"scalar",T:9}])));let ag=rg;const ig=class e extends Qh{constructor(e){super(),n(this,"forceEnableExperiments",[]),Sm.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 Sm.util.equals(e,t,n)}};n(ig,"runtime",Sm),n(ig,"typeName","exa.language_server_pb.ExperimentConfig"),n(ig,"fields",Sm.util.newFieldList((()=>[{no:1,name:"force_enable_experiments",kind:"enum",T:Sm.getEnumType(Tm),repeated:!0}])));let sg=ig;const lg=class e extends Qh{constructor(e){super(),n(this,"state",Rp.UNSPECIFIED),n(this,"message",""),Sm.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 Sm.util.equals(e,t,n)}};n(lg,"runtime",Sm),n(lg,"typeName","exa.language_server_pb.State"),n(lg,"fields",Sm.util.newFieldList((()=>[{no:1,name:"state",kind:"enum",T:Sm.getEnumType(Rp)},{no:2,name:"message",kind:"scalar",T:9}])));let cg=lg;const dg=class e extends Qh{constructor(e){super(),n(this,"startOffset",hf.zero),n(this,"endOffset",hf.zero),n(this,"startPosition"),n(this,"endPosition"),Sm.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 Sm.util.equals(e,t,n)}};n(dg,"runtime",Sm),n(dg,"typeName","exa.language_server_pb.Range"),n(dg,"fields",Sm.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:og},{no:4,name:"end_position",kind:"message",T:og}])));let ug=dg;const hg=class e extends Qh{constructor(e){super(),n(this,"text",""),n(this,"deltaCursorOffset",hf.zero),Sm.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 Sm.util.equals(e,t,n)}};n(hg,"runtime",Sm),n(hg,"typeName","exa.language_server_pb.Suffix"),n(hg,"fields",Sm.util.newFieldList((()=>[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"delta_cursor_offset",kind:"scalar",T:3}])));let fg=hg;const mg=class e extends Qh{constructor(e){super(),n(this,"text",""),n(this,"offset",hf.zero),n(this,"type",Bp.UNSPECIFIED),n(this,"prefix",""),n(this,"line",hf.zero),Sm.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 Sm.util.equals(e,t,n)}};n(mg,"runtime",Sm),n(mg,"typeName","exa.language_server_pb.CompletionPart"),n(mg,"fields",Sm.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:Sm.getEnumType(Bp)},{no:4,name:"prefix",kind:"scalar",T:9},{no:5,name:"line",kind:"scalar",T:4}])));let pg=mg;const gg=class e extends Qh{constructor(e){super(),n(this,"completion"),n(this,"suffix"),n(this,"range"),n(this,"source",Rm.UNSPECIFIED),n(this,"completionParts",[]),Sm.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 Sm.util.equals(e,t,n)}};n(gg,"runtime",Sm),n(gg,"typeName","exa.language_server_pb.CompletionItem"),n(gg,"fields",Sm.util.newFieldList((()=>[{no:1,name:"completion",kind:"message",T:Um},{no:5,name:"suffix",kind:"message",T:fg},{no:2,name:"range",kind:"message",T:ug},{no:3,name:"source",kind:"enum",T:Sm.getEnumType(Rm)},{no:8,name:"completion_parts",kind:"message",T:pg,repeated:!0}])));let yg=gg;const vg={typeName:"exa.language_server_pb.LanguageServerService",methods:{getCompletions:{name:"GetCompletions",I:Wp,O:qp,kind:Em.Unary},acceptCompletion:{name:"AcceptCompletion",I:Xp,O:Jp,kind:Em.Unary},getAuthToken:{name:"GetAuthToken",I:Qp,O:tg,kind:Em.Unary}}};var xg=function(e){return this instanceof xg?(this.v=e,this):new xg(e)},bg=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={},i("next"),i("throw"),i("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),o[Symbol.asyncIterator]=function(){return this},o;function i(e,t){r[e]&&(o[e]=function(t){return new Promise((function(n,o){a.push([e,t,n,o])>1||s(e,t)}))},t&&(o[e]=t(o[e])))}function s(e,t){try{(n=r[e](t)).value instanceof xg?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){s("next",e)}function c(e){s("throw",e)}function d(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}};const wg=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,i,s,l){var c;const{serialize:d,parse:u}=xp(o,n,e.jsonOptions,e.binaryOptions);return a=void 0===a?e.defaultTimeoutMs:a<=0?void 0:a,await function(e){const t=yp(e.next,e.interceptors),[n,o,r]=Pp(e);return t(Object.assign(Object.assign({},e.req),{message:pp(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:mp(e.baseUrl,t,o),init:{method:"POST",credentials:null!==(c=e.credentials)&&void 0!==c?c:"same-origin",redirect:"error",mode:"cors"},header:Ap(o.kind,n,a,i),contextValues:null!=l?l:fp(),message:s},next:async r=>{var a;let i=null;!0===e.useHttpGet&&o.idempotency===_m.NoSideEffects?r=Dp(r,d(r.message),n):i=d(r.message);const s=null!==(a=e.fetch)&&void 0!==a?a:globalThis.fetch,l=await s(r.url,Object.assign(Object.assign({},r.init),{headers:r.header,signal:r.signal,body:i})),{isUnaryError:c,unaryError:h}=Mp(o.kind,l.status,l.headers);if(c)throw Sp(await l.json(),function(...e){const t=new Headers;for(const n of e)n.forEach(((e,n)=>{t.append(n,e)}));return t}(...Tp(l.headers)),h);const[f,m]=Tp(l.headers);return{stream:!1,service:t,method:o,header:f,message:n?u(new Uint8Array(await l.arrayBuffer())):o.O.fromJson(await l.json(),vp(e.jsonOptions)),trailer:m}}})},async stream(t,o,r,a,i,s,l){var c;const{serialize:d,parse:u}=xp(o,n,e.jsonOptions,e.binaryOptions);function h(e,t,n){return bg(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 op("premature end of stream",Qm.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 xg(o.read());if(e.done)break;const{flags:a,data:i}=e.value;if(2&~a)yield yield xg(u(i));else{r=!0;const e=Np(i);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 f(e){if(o.kind!=Em.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=yp(e.next,e.interceptors),[n,o,r]=Pp(e),a=Object.assign(Object.assign({},e.req),{message:gp(e.req.method.I,e.req.message),signal:n});let i=!1;return n.addEventListener("abort",(function(){var t,n;const o=e.req.message[Symbol.asyncIterator]();i||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&&(i=!0,r()),e)),o)}}}})),o)}({interceptors:e.interceptors,timeoutMs:a,signal:r,req:{stream:!0,service:t,method:o,url:mp(e.baseUrl,t,o),init:{method:"POST",credentials:null!==(c=e.credentials)&&void 0!==c?c:"same-origin",redirect:"error",mode:"cors"},header:Ap(o.kind,n,a,i),contextValues:null!=l?l:fp(),message:s},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 f(t.message)}));if(Mp(o.kind,a.status,a.headers),null===a.body)throw"missing response body";const i=new Headers;return Object.assign(Object.assign({},t),{header:a.headers,trailer:i,message:h(a.body,i,a.headers)})}})}}}({baseUrl:"https://web-backend.codeium.com",useBinaryFormat:!0}),kg=(Ng=wg,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}(Sg=vg,(e=>{switch(e.kind){case Em.Unary:return function(e,t,n){return async function(o,r){var a,i;const s=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,s.header),null===(i=null==r?void 0:r.onTrailer)||void 0===i||i.call(r,s.trailer),s.message}}(Ng,Sg,e);case Em.ServerStreaming:return function(e,t,n){return function(o,r){return up(e.stream(t,n,null==r?void 0:r.signal,null==r?void 0:r.timeoutMs,null==r?void 0:r.headers,sp([o]),null==r?void 0:r.contextValues),r)}}(Ng,Sg,e);case Em.ClientStreaming:return function(e,t,n){return async function(o,r){var a,i,s,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 f,m=!0,p=lp(u.message);!(a=(f=await p.next()).done);m=!0)l=f.value,m=!1,h=l}catch(g){i={error:g}}finally{try{m||a||!(s=p.return)||await s.call(p)}finally{if(i)throw i.error}}if(!h)throw new op("protocol error: missing response message",Qm.Internal);return null===(d=null==r?void 0:r.onTrailer)||void 0===d||d.call(r,u.trailer),h}}(Ng,Sg,e);case Em.BiDiStreaming:return function(e,t,n){return function(o,r){return up(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)}}(Ng,Sg,e);default:return null}})));var Sg,Ng;let Cg;try{Cg=crypto.randomUUID()}catch{Cg=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 Eg(e,t){const n=e.state.facet(qm),{override:o}=e.state.facet(Ym),r=await o(),a=e.state,i=a.selection.main.head,s=a.doc.toString();try{const o=await async function({text:e,cursorOffset:t,config:n,otherDocuments:o}){return await kg.getCompletions({metadata:{ideName:"web",ideVersion:"0.0.5",extensionName:"@valtown/codemirror-codeium",extensionVersion:"1.0.0",apiKey:n.apiKey,sessionId:Cg,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}-${Cg}`}})}({text:s,cursorOffset:i,config:n,otherDocuments:r});if(!o||0===o.completionItems.length)return;if(void 0!==t&&i!==t||"active"===Vn(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=Hn.of(d,a.doc.length),h=u.invert(a.doc);e.dispatch({changes:u,effects:Bh.of({index:c,reverseChangeSet:h,changeSpecs:l}),annotations:[Zm.of(null),Jm.of(null),$n.addToHistory.of(!1)]})}catch(l){console.warn("copilot completion failed",l),await new Promise((e=>setTimeout(e,300)))}}function jg(){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(Uh)||e.is(Vh)))))}(n))return;if(e&&clearTimeout(e),function(e){if(!e.view.hasFocus)return!0;if(e.state.field(Km))return!0;if("active"===Vn(e.state))return!0;for(const t of e.transactions)if(void 0!==t.annotation(Jm))return!0}(n))return;const r=n.state.selection.main.head;o.shouldComplete&&!o.shouldComplete(new Wn(n.view.state,r,!1))||(e=setTimeout((async()=>{r===t&&await Eg(n.view,t)}),o.timeout),t=r)}))}function _g(e){var t;const n=e.state.field(Km);if(!n)return!1;const o=null==(t=n.reverseChangeSet)?void 0:t.invert(e.state.doc);e.dispatch({changes:n.reverseChangeSet,effects:Uh.of(null),annotations:[Zm.of(null),Jm.of(null),$n.addToHistory.of(!1)]});let r=0;return null==o||o.iterChangedRanges(((e,t,n,o)=>{r=o})),e.dispatch({changes:o,selection:Zt.cursor(r),annotations:[Jm.of(null),$n.addToHistory.of(!0)]}),!0}const Ig=e=>{const{state:t}=e,n=t.field(Km);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 i=n.reverseChangeSet.apply(t.doc),s=Hn.of(n.reverseChangeSet,t.doc.length).compose(Hn.of(a,i.length)),l=Hn.of(a,i.length).invert(i);return e.dispatch({changes:s,effects:Bh.of({index:r,reverseChangeSet:l,changeSpecs:o}),annotations:[Zm.of(null),Jm.of(null),$n.addToHistory.of(!1)]}),!0};function Tg(e){const t=e.state.field(Km);return!!t&&(e.dispatch({changes:t.reverseChangeSet,effects:Vh.of(null),annotations:[Zm.of(null),Jm.of(null),$n.addToHistory.of(!1)]}),!1)}function Ag(){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(Km)&&("Tab"===t?_g(e):Tg(e))}(t,e.key)),mouseup(e,t){const n=e.target;return"BUTTON"===n.nodeName&&"codeium-cycle"===n.dataset.action?(Ig(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(Km);return!(void 0===r||!a)&&(null==(n=a.decorations)||n.between(r,r,(()=>{o=!0})),o)}(t)?_g(t):Tg(t)}})}const Mg=e=>{const t=[];return"codeium"===e.copilot&&e.codeium_api_key&&t.push(function(e){return[qm.of(e),Km,Ln.highest(Dn.of([{key:"Ctrl-]",run:Ig}])),Ln.highest(Qt.updateListener.of((e=>{e.focusChanged&&Tg(e.view)}))),Ln.high(Ag()),jg()]}({apiKey:e.codeium_api_key,language:zm.PYTHON}),Ym.of({override:async()=>[{text:Zs(""),language:zm.PYTHON,editorLanguage:"python"}]})),"github"===e.copilot&&t.push(Fh({delay:500,fetchFn:async e=>{if(!el())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:nl,version:"replace_me",uri:`file://${nl}`,relativePath:nl,languageId:ol,position:r}}}(e,Zs(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,i=a<0?o.slice(-a):o,s=n.doc.sliceString(n.selection.main.head,n.doc.length);for(let l=0;l<i.length;l++){const e=i.slice(l);if(s.startsWith(e))return i.slice(0,l)}return i}(await tl().getCompletion(n),n.doc.position,e);return o&&V.debug("Copilot suggestion:",o),o}})),[...t,Qs().slice(0,-2)]};const Og=nn.mark({class:"underline"}),Dg=en.define(),Pg=en.define(),Rg=tn.define({create:()=>nn.none,update(e,t){let n=e.map(t.changes);for(const o of t.effects)o.is(Dg)?n=e.update({add:[Og.range(o.value.from,o.value.to)]}):o.is(Pg)&&(n=nn.none);return n},provide:e=>Qt.decorations.from(e)});class Lg{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=Gn(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:Dg.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:Pg.of(null)}),this.hoveredRange=null)}}const zg=({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=Yn.define(n);return[o,Xn(r)]};zg({variant:"dark",settings:{background:"#200020",foreground:"#D0D0FF",caret:"#7070FF",selection:"#80000080",gutterBackground:"#200020",gutterForeground:"#C080C0",lineHighlight:"#80000040"},styles:[{tag:Kn.comment,color:"#404080"},{tag:[Kn.string,Kn.regexp],color:"#999999"},{tag:Kn.number,color:"#7090B0"},{tag:[Kn.bool,Kn.null],color:"#8080A0"},{tag:[Kn.punctuation,Kn.derefOperator],color:"#805080"},{tag:Kn.keyword,color:"#60B0FF"},{tag:Kn.definitionKeyword,color:"#B0FFF0"},{tag:Kn.moduleKeyword,color:"#60B0FF"},{tag:Kn.operator,color:"#A0A0FF"},{tag:[Kn.variableName,Kn.self],color:"#008080"},{tag:Kn.operatorKeyword,color:"#A0A0FF"},{tag:Kn.controlKeyword,color:"#80A0FF"},{tag:Kn.className,color:"#70E080"},{tag:[Kn.function(Kn.propertyName),Kn.propertyName],color:"#50A0A0"},{tag:Kn.tagName,color:"#009090"},{tag:Kn.modifier,color:"#B0FFF0"},{tag:[Kn.squareBracket,Kn.attributeName],color:"#D0D0FF"}]}),zg({variant:"light",settings:{background:"#fcfcfc",foreground:"#5c6166",caret:"#ffaa33",selection:"#036dd626",gutterBackground:"#fcfcfc",gutterForeground:"#8a919966",lineHighlight:"#8a91991a"},styles:[{tag:Kn.comment,color:"#787b8099"},{tag:Kn.string,color:"#86b300"},{tag:Kn.regexp,color:"#4cbf99"},{tag:[Kn.number,Kn.bool,Kn.null],color:"#ffaa33"},{tag:Kn.variableName,color:"#5c6166"},{tag:[Kn.definitionKeyword,Kn.modifier],color:"#fa8d3e"},{tag:[Kn.keyword,Kn.special(Kn.brace)],color:"#fa8d3e"},{tag:Kn.operator,color:"#ed9366"},{tag:Kn.separator,color:"#5c6166b3"},{tag:Kn.punctuation,color:"#5c6166"},{tag:[Kn.definition(Kn.propertyName),Kn.function(Kn.variableName)],color:"#f2ae49"},{tag:[Kn.className,Kn.definition(Kn.typeName)],color:"#22a4e6"},{tag:[Kn.tagName,Kn.typeName,Kn.self,Kn.labelName],color:"#55b4d4"},{tag:Kn.angleBracket,color:"#55b4d480"},{tag:Kn.attributeName,color:"#f2ae49"}]}),zg({variant:"dark",settings:{background:"#15191EFA",foreground:"#EEF2F7",caret:"#C4C4C4",selection:"#90B2D557",gutterBackground:"#15191EFA",gutterForeground:"#aaaaaa95",lineHighlight:"#57575712"},styles:[{tag:Kn.comment,color:"#6E6E6E"},{tag:[Kn.string,Kn.regexp,Kn.special(Kn.brace)],color:"#5C81B3"},{tag:Kn.number,color:"#C1E1B8"},{tag:Kn.bool,color:"#53667D"},{tag:[Kn.definitionKeyword,Kn.modifier,Kn.function(Kn.propertyName)],color:"#A3D295",fontWeight:"bold"},{tag:[Kn.keyword,Kn.moduleKeyword,Kn.operatorKeyword,Kn.operator],color:"#697A8E",fontWeight:"bold"},{tag:[Kn.variableName,Kn.attributeName],color:"#708E67"},{tag:[Kn.function(Kn.variableName),Kn.definition(Kn.propertyName),Kn.derefOperator],color:"#fff"},{tag:Kn.tagName,color:"#A3D295"}]}),zg({variant:"dark",settings:{background:"#2e241d",foreground:"#BAAE9E",caret:"#A7A7A7",selection:"#DDF0FF33",gutterBackground:"#28211C",gutterForeground:"#BAAE9E90",lineHighlight:"#FFFFFF08"},styles:[{tag:Kn.comment,color:"#666666"},{tag:[Kn.string,Kn.special(Kn.brace)],color:"#54BE0D"},{tag:Kn.regexp,color:"#E9C062"},{tag:Kn.number,color:"#CF6A4C"},{tag:[Kn.keyword,Kn.operator],color:"#5EA6EA"},{tag:Kn.variableName,color:"#7587A6"},{tag:[Kn.definitionKeyword,Kn.modifier],color:"#F9EE98"},{tag:[Kn.propertyName,Kn.function(Kn.variableName)],color:"#937121"},{tag:[Kn.typeName,Kn.angleBracket,Kn.tagName],color:"#9B859D"}]}),zg({variant:"dark",settings:{background:"#3b2627",foreground:"#E6E1C4",caret:"#E6E1C4",selection:"#16120E",gutterBackground:"#3b2627",gutterForeground:"#E6E1C490",lineHighlight:"#1F1611"},styles:[{tag:Kn.comment,color:"#6B4E32"},{tag:[Kn.keyword,Kn.operator,Kn.derefOperator],color:"#EF5D32"},{tag:Kn.className,color:"#EFAC32",fontWeight:"bold"},{tag:[Kn.typeName,Kn.propertyName,Kn.function(Kn.variableName),Kn.definition(Kn.variableName)],color:"#EFAC32"},{tag:Kn.definition(Kn.typeName),color:"#EFAC32",fontWeight:"bold"},{tag:Kn.labelName,color:"#EFAC32",fontWeight:"bold"},{tag:[Kn.number,Kn.bool],color:"#6C99BB"},{tag:[Kn.variableName,Kn.self],color:"#7DAF9C"},{tag:[Kn.string,Kn.special(Kn.brace),Kn.regexp],color:"#D9D762"},{tag:[Kn.angleBracket,Kn.tagName,Kn.attributeName],color:"#EFCB43"}]}),zg({variant:"dark",settings:{background:"#000205",foreground:"#FFFFFF",caret:"#E60065",selection:"#E60C6559",gutterBackground:"#000205",gutterForeground:"#ffffff90",lineHighlight:"#4DD7FC1A"},styles:[{tag:Kn.comment,color:"#404040"},{tag:[Kn.string,Kn.special(Kn.brace),Kn.regexp],color:"#00D8FF"},{tag:Kn.number,color:"#E62286"},{tag:[Kn.variableName,Kn.attributeName,Kn.self],color:"#E62286",fontWeight:"bold"},{tag:Kn.function(Kn.variableName),color:"#fff",fontWeight:"bold"}]}),zg({variant:"light",settings:{background:"#fff",foreground:"#000",caret:"#000",selection:"#BDD5FC",gutterBackground:"#fff",gutterForeground:"#00000070",lineHighlight:"#FFFBD1"},styles:[{tag:Kn.comment,color:"#BCC8BA"},{tag:[Kn.string,Kn.special(Kn.brace),Kn.regexp],color:"#5D90CD"},{tag:[Kn.number,Kn.bool,Kn.null],color:"#46A609"},{tag:Kn.keyword,color:"#AF956F"},{tag:[Kn.definitionKeyword,Kn.modifier],color:"#C52727"},{tag:[Kn.angleBracket,Kn.tagName,Kn.attributeName],color:"#606060"},{tag:Kn.self,color:"#000"}]}),zg({variant:"dark",settings:{background:"#00254b",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#B36539BF",gutterBackground:"#00254b",gutterForeground:"#FFFFFF70",lineHighlight:"#00000059"},styles:[{tag:Kn.comment,color:"#0088FF"},{tag:Kn.string,color:"#3AD900"},{tag:Kn.regexp,color:"#80FFC2"},{tag:[Kn.number,Kn.bool,Kn.null],color:"#FF628C"},{tag:[Kn.definitionKeyword,Kn.modifier],color:"#FFEE80"},{tag:Kn.variableName,color:"#CCCCCC"},{tag:Kn.self,color:"#FF80E1"},{tag:[Kn.className,Kn.definition(Kn.propertyName),Kn.function(Kn.variableName),Kn.definition(Kn.typeName),Kn.labelName],color:"#FFDD00"},{tag:[Kn.keyword,Kn.operator],color:"#FF9D00"},{tag:[Kn.propertyName,Kn.typeName],color:"#80FFBB"},{tag:Kn.special(Kn.brace),color:"#EDEF7D"},{tag:Kn.attributeName,color:"#9EFFFF"},{tag:Kn.derefOperator,color:"#fff"}]}),zg({variant:"dark",settings:{background:"#060521",foreground:"#E0E0E0",caret:"#FFFFFFA6",selection:"#122BBB",gutterBackground:"#060521",gutterForeground:"#E0E0E090",lineHighlight:"#FFFFFF0F"},styles:[{tag:Kn.comment,color:"#AEAEAE"},{tag:[Kn.string,Kn.special(Kn.brace),Kn.regexp],color:"#8DFF8E"},{tag:[Kn.className,Kn.definition(Kn.propertyName),Kn.function(Kn.variableName),Kn.function(Kn.definition(Kn.variableName)),Kn.definition(Kn.typeName)],color:"#A3EBFF"},{tag:[Kn.number,Kn.bool,Kn.null],color:"#62E9BD"},{tag:[Kn.keyword,Kn.operator],color:"#2BF1DC"},{tag:[Kn.definitionKeyword,Kn.modifier],color:"#F8FBB1"},{tag:[Kn.variableName,Kn.self],color:"#B683CA"},{tag:[Kn.angleBracket,Kn.tagName,Kn.typeName,Kn.propertyName],color:"#60A4F1"},{tag:Kn.derefOperator,color:"#E0E0E0"},{tag:Kn.attributeName,color:"#7BACCA"}]}),zg({variant:"dark",settings:{background:"#2d2f3f",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"#44475a",gutterBackground:"#282a36",gutterForeground:"rgb(144, 145, 148)",lineHighlight:"#44475a"},styles:[{tag:Kn.comment,color:"#6272a4"},{tag:[Kn.string,Kn.special(Kn.brace)],color:"#f1fa8c"},{tag:[Kn.number,Kn.self,Kn.bool,Kn.null],color:"#bd93f9"},{tag:[Kn.keyword,Kn.operator],color:"#ff79c6"},{tag:[Kn.definitionKeyword,Kn.typeName],color:"#8be9fd"},{tag:Kn.definition(Kn.typeName),color:"#f8f8f2"},{tag:[Kn.className,Kn.definition(Kn.propertyName),Kn.function(Kn.variableName),Kn.attributeName],color:"#50fa7b"}]}),zg({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#80C7FF",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#C1E2F8"},styles:[{tag:Kn.comment,color:"#AAAAAA"},{tag:[Kn.keyword,Kn.operator,Kn.typeName,Kn.tagName,Kn.propertyName],color:"#2F6F9F",fontWeight:"bold"},{tag:[Kn.attributeName,Kn.definition(Kn.propertyName)],color:"#4F9FD0"},{tag:[Kn.className,Kn.string,Kn.special(Kn.brace)],color:"#CF4F5F"},{tag:Kn.number,color:"#CF4F5F",fontWeight:"bold"},{tag:Kn.variableName,fontWeight:"bold"}]}),zg({variant:"light",settings:{background:"#f2f1f8",foreground:"#0c006b",caret:"#5c49e9",selection:"#d5d1f2",gutterBackground:"#f2f1f8",gutterForeground:"#0c006b70",lineHighlight:"#e1def3"},styles:[{tag:Kn.comment,color:"#9995b7"},{tag:Kn.keyword,color:"#ff5792",fontWeight:"bold"},{tag:[Kn.definitionKeyword,Kn.modifier],color:"#ff5792"},{tag:[Kn.className,Kn.tagName,Kn.definition(Kn.typeName)],color:"#0094f0"},{tag:[Kn.number,Kn.bool,Kn.null,Kn.special(Kn.brace)],color:"#5842ff"},{tag:[Kn.definition(Kn.propertyName),Kn.function(Kn.variableName)],color:"#0095a8"},{tag:Kn.typeName,color:"#b3694d"},{tag:[Kn.propertyName,Kn.variableName],color:"#fa8900"},{tag:Kn.operator,color:"#ff5792"},{tag:Kn.self,color:"#e64100"},{tag:[Kn.string,Kn.regexp],color:"#00b368"},{tag:[Kn.paren,Kn.bracket],color:"#0431fa"},{tag:Kn.labelName,color:"#00bdd6"},{tag:Kn.attributeName,color:"#e64100"},{tag:Kn.angleBracket,color:"#9995b7"}]}),zg({variant:"light",settings:{background:"#faf4ed",foreground:"#575279",caret:"#575279",selection:"#6e6a8614",gutterBackground:"#faf4ed",gutterForeground:"#57527970",lineHighlight:"#6e6a860d"},styles:[{tag:Kn.comment,color:"#9893a5"},{tag:[Kn.bool,Kn.null],color:"#286983"},{tag:Kn.number,color:"#d7827e"},{tag:Kn.className,color:"#d7827e"},{tag:[Kn.angleBracket,Kn.tagName,Kn.typeName],color:"#56949f"},{tag:Kn.attributeName,color:"#907aa9"},{tag:Kn.punctuation,color:"#797593"},{tag:[Kn.keyword,Kn.modifier],color:"#286983"},{tag:[Kn.string,Kn.regexp],color:"#ea9d34"},{tag:Kn.variableName,color:"#d7827e"}]}),zg({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#FFFD0054",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#00000008"},styles:[{tag:Kn.comment,color:"#CFCFCF"},{tag:[Kn.number,Kn.bool,Kn.null],color:"#E66C29"},{tag:[Kn.className,Kn.definition(Kn.propertyName),Kn.function(Kn.variableName),Kn.labelName,Kn.definition(Kn.typeName)],color:"#2EB43B"},{tag:Kn.keyword,color:"#D8B229"},{tag:Kn.operator,color:"#4EA44E",fontWeight:"bold"},{tag:[Kn.definitionKeyword,Kn.modifier],color:"#925A47"},{tag:Kn.string,color:"#704D3D"},{tag:Kn.typeName,color:"#2F8996"},{tag:[Kn.variableName,Kn.propertyName],color:"#77ACB0"},{tag:Kn.self,color:"#77ACB0",fontWeight:"bold"},{tag:Kn.regexp,color:"#E3965E"},{tag:[Kn.tagName,Kn.angleBracket],color:"#BAA827"},{tag:Kn.attributeName,color:"#B06520"},{tag:Kn.derefOperator,color:"#000"}]}),zg({variant:"light",settings:{background:"#fef7e5",foreground:"#586E75",caret:"#000000",selection:"#073642",gutterBackground:"#fef7e5",gutterForeground:"#586E7580",lineHighlight:"#EEE8D5"},styles:[{tag:Kn.comment,color:"#93A1A1"},{tag:Kn.string,color:"#2AA198"},{tag:Kn.regexp,color:"#D30102"},{tag:Kn.number,color:"#D33682"},{tag:Kn.variableName,color:"#268BD2"},{tag:[Kn.keyword,Kn.operator,Kn.punctuation],color:"#859900"},{tag:[Kn.definitionKeyword,Kn.modifier],color:"#073642",fontWeight:"bold"},{tag:[Kn.className,Kn.self,Kn.definition(Kn.propertyName)],color:"#268BD2"},{tag:Kn.function(Kn.variableName),color:"#268BD2"},{tag:[Kn.bool,Kn.null],color:"#B58900"},{tag:Kn.tagName,color:"#268BD2",fontWeight:"bold"},{tag:Kn.angleBracket,color:"#93A1A1"},{tag:Kn.attributeName,color:"#93A1A1"},{tag:Kn.typeName,color:"#859900"}]}),zg({variant:"light",settings:{background:"#FFFFFF",foreground:"#4D4D4C",caret:"#AEAFAD",selection:"#D6D6D6",gutterBackground:"#FFFFFF",gutterForeground:"#4D4D4C80",lineHighlight:"#EFEFEF"},styles:[{tag:Kn.comment,color:"#8E908C"},{tag:[Kn.variableName,Kn.self,Kn.propertyName,Kn.attributeName,Kn.regexp],color:"#C82829"},{tag:[Kn.number,Kn.bool,Kn.null],color:"#F5871F"},{tag:[Kn.className,Kn.typeName,Kn.definition(Kn.typeName)],color:"#C99E00"},{tag:[Kn.string,Kn.special(Kn.brace)],color:"#718C00"},{tag:Kn.operator,color:"#3E999F"},{tag:[Kn.definition(Kn.propertyName),Kn.function(Kn.variableName)],color:"#4271AE"},{tag:Kn.keyword,color:"#8959A8"},{tag:Kn.derefOperator,color:"#4D4D4C"}]});const Fg=zg({variant:"light",settings:{background:"#ffffff",foreground:"#000000",caret:"#000000",selection:"#d7d4f0",lineHighlight:"#cceeff44",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:Kn.comment,color:"#708090"},{tag:Kn.variableName,color:"#000000"},{tag:[Kn.string,Kn.special(Kn.brace)],color:"#a11"},{tag:Kn.number,color:"#164"},{tag:Kn.bool,color:"#219"},{tag:Kn.null,color:"#219"},{tag:Kn.keyword,color:"#708",fontWeight:500},{tag:Kn.className,color:"#00f"},{tag:Kn.definition(Kn.typeName),color:"#00f"},{tag:Kn.typeName,color:"#085"},{tag:Kn.angleBracket,color:"#000000"},{tag:Kn.tagName,color:"#170"},{tag:Kn.attributeName,color:"#00c"},{tag:Kn.operator,color:"#a2f",fontWeight:500},{tag:[Kn.function(Kn.variableName)],color:"#00c"},{tag:[Kn.propertyName],color:"#05a"}]});const Bg="packages-install-input";function Ug(){const e=async e=>{const t=q.get(Qn),n={...t,runtime:{...t.runtime,auto_reload:e}};await Te({config:n}).then((()=>q.set(Qn,n)))},t=()=>{requestAnimationFrame((()=>{const e=document.getElementById(Bg);e&&e.focus()}))},n=[{match:"!pip install",onMatch:()=>{q.set(hu,(e=>({...e,isSidebarOpen:!0,selectedPanel:"packages"}))),t()},title:"Package Installation",description:C.jsxs(C.Fragment,{children:["The package manager sidebar has been opened.",C.jsx("br",{}),"Install packages directly from there instead."]})},{match:"!uv pip install",onMatch:()=>{q.set(hu,(e=>({...e,isSidebarOpen:!0,selectedPanel:"packages"}))),t()},title:"Package Installation",description:C.jsxs(C.Fragment,{children:["The package manager sidebar has been opened.",C.jsx("br",{}),"Install packages directly from there instead."]})},{match:"%load_ext autoreload 2",onMatch:async()=>{await e("autorun")},title:"Module reload",description:C.jsxs(C.Fragment,{children:["Module reload mode set to ",C.jsx("b",{children:"autorun"})," - module changes will re-run the cells that import them."]})},{match:"%load_ext autoreload 1",onMatch:async()=>{await e("lazy")},title:"Module reload",description:C.jsxs(C.Fragment,{children:["Module reload mode set to ",C.jsx("b",{children:"lazy"})," - module changes will mark the cells that import them as stale."]})},{match:"%load_ext autoreload 0",onMatch:async()=>{await e("off")},title:"Module reload",description:C.jsx(C.Fragment,{children:"Module reload disabled - module changes will not be detected."})},{match:"!ls",onMatch:()=>{},title:"Listing files",description:C.jsxs(C.Fragment,{children:["Shell commands are not directly supported.",C.jsx("br",{}),"Use ",C.jsx("code",{children:"import subprocess; subprocess.run(['ls'])"})," instead."]})}],o=new Map(n.map((e=>[e.match,e])));return Qt.updateListener.of((e=>{if(e.docChanged){const t=e.state.selection.main,n=e.state.doc,r=n.lineAt(t.head),a=n.sliceString(r.from,t.anchor).trim(),i=o.get(a);i&&(i.onMatch(),K({title:i.title,description:i.description}))}}))}function Vg(){return[Qt.domEventHandlers({paste:(e,t)=>{var n;const o=null==(n=e.clipboardData)?void 0:n.getData("text/plain");if(!(null==o?void 0:o.includes("@app.cell")))return!1;const r=function(e){if(!e.includes("@app.cell"))return[];const t=[],n=e.split("\n");let o=[],r=!1,a=0,i=!1,s=!1,l=0;const c=/\(/g,d=/\)/g,u=new Set(["@"]);function h(e){return(e.match(c)||[]).length-(e.match(d)||[]).length}function f(){if(0!==o.length){for(;o.length>0&&o[o.length-1].trim().startsWith("return");)o.pop();o.some((e=>""!==e.trim()))&&t.push(function(e){const t=e.split("\n");if(0===t.length)return"";const n=t.filter((e=>e.trim().length>0));if(0===n.length)return"";const o=/^\s*/,r=Math.min(...n.map((e=>{var t;return(null==(t=e.match(o))?void 0:t[0].length)??Number.POSITIVE_INFINITY})));return 0===r?e.trim():t.map((e=>e.slice(r))).join("\n").trim()}(o.join("\n"))),o=[]}}for(const m of n){const e=m.trim();(e||r)&&(e.startsWith("@app.cell")?(f(),r=!0,a=1):a>0?(e.startsWith("def")&&e.includes("(")&&!e.includes("):")&&(i=!0,l=h(e)),a--):i?(l+=h(e),0===l&&(i=!1)):r&&(u.has(e[0])||e.startsWith("if __name__")?(f(),r=e.startsWith("@")):e.startsWith("return")?e.includes("(")&&!e.endsWith(")")&&(s=!0,l=h(e)):s?(l+=h(e),0===l&&(s=!1)):o.push(m)))}return f(),t}(o);if(0===r.length)return!1;return t.state.facet(eo).createManyBelow(r),!0}})]}const Hg=e=>{const{theme:t,hotkeys:n,completionConfig:o}=e;return[Qt.lineWrapping,oo(),ro(),ao(),io(),so(),lo(),co(),uo({position:"fixed",parent:document.querySelector("#App")??void 0}),ho(),"dark"===t?fo:Fg,mo(),Mg(o),po(),go(),Ln.high(Dn.of(yo)),vo(),xo(),bo.of(" "),Xn(wo,{fallback:!0}),Dn.of(ko),So(e),No.of(Co()),Eo.allowMultipleSelections.of(!0),Ih(n),Dn.of([{key:"Tab",run:e=>jo(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()&&Ao(e)})(e)||_o(e),preventDefault:!0}]),Dn.of([...Io,To])]};function $g(e){const t=e.current;if(null===t)throw new ReferenceError("Attempting to dereference null object.");return t}const Wg="ContextMenu",[Gg,qg]=Mo(Wg,[Oo]),Yg=Oo(),[Xg,Kg]=Gg(Wg),Jg=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,disabled:o=!1,...a}=e,i=Kg("ContextMenuTrigger",n),s=Yg(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},i.onOpenChange(!0)};return r.useEffect((()=>u),[u]),r.useEffect((()=>{o&&u()}),[o,u]),r.createElement(r.Fragment,null,r.createElement(Go,Po({},s,{virtualRef:c})),r.createElement(qo.span,Po({"data-state":i.open?"open":"closed","data-disabled":o?"":void 0},a,{ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:o?e.onContextMenu:Yo(e.onContextMenu,(e=>{u(),h(e),e.preventDefault()})),onPointerDown:o?e.onPointerDown:Yo(e.onPointerDown,Zg((e=>{u(),d.current=window.setTimeout((()=>h(e)),700)}))),onPointerMove:o?e.onPointerMove:Yo(e.onPointerMove,Zg(u)),onPointerCancel:o?e.onPointerCancel:Yo(e.onPointerCancel,Zg(u)),onPointerUp:o?e.onPointerUp:Yo(e.onPointerUp,Zg(u))})))}));function Zg(e){return t=>"mouse"!==t.pointerType?e(t):void 0}const Qg=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Kg("ContextMenuContent",n),i=Yg(n),s=r.useRef(!1);return r.createElement(Ro,Po({},i,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&&s.current&&t.preventDefault(),s.current=!1},onInteractOutside:t=>{var n;null===(n=e.onInteractOutside)||void 0===n||n.call(e,t),t.defaultPrevented||a.modal||(s.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)"}}))})),ey=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Yg(n);return r.createElement(Lo,Po({},a,o,{ref:t}))})),ty=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Yg(n);return r.createElement(zo,Po({},a,o,{ref:t}))})),ny=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Yg(n);return r.createElement(Fo,Po({},a,o,{ref:t}))})),oy=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Yg(n);return r.createElement(Bo,Po({},a,o,{ref:t}))})),ry=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Yg(n);return r.createElement(Xo,Po({},a,o,{ref:t}))})),ay=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Yg(n);return r.createElement(Uo,Po({},a,o,{ref:t}))})),iy=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Yg(n);return r.createElement(Vo,Po({},a,o,{ref:t}))})),sy=r.forwardRef(((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=Yg(n);return r.createElement(Ho,Po({},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)"}}))})),ly=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:o,dir:a,modal:i=!0}=e,[s,l]=r.useState(!1),c=Yg(t),d=$o(o),u=r.useCallback((e=>{l(e),d(e)}),[d]);return r.createElement(Xg,{scope:t,open:s,onOpenChange:u,modal:i},r.createElement(Wo,Po({},c,{dir:a,open:s,onOpenChange:u,modal:i}),n))},cy=Jg,dy=Ko((e=>{const{__scopeContextMenu:t,...n}=e,o=Yg(t);return r.createElement(Do,Po({},o,n))}));r.forwardRef(((e,t)=>{const n=S(14);let o,r,a,i,s,l,c;return n[0]!==e?(({className:o,inset:r,children:i,...a}=e),n[0]=e,n[1]=o,n[2]=r,n[3]=a,n[4]=i):(o=n[1],r=n[2],a=n[3],i=n[4]),n[5]!==o||n[6]!==r?(s=Jo({className:o,inset:r}),n[5]=o,n[6]=r,n[7]=s):s=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=C.jsx(rr,{className:"ml-auto h-4 w-4"}),n[8]=l):l=n[8],n[9]!==t||n[10]!==s||n[11]!==a||n[12]!==i?(c=C.jsxs(iy,{ref:t,className:s,...a,children:[i,l]}),n[9]=t,n[10]=s,n[11]=a,n[12]=i,n[13]=c):c=n[13],c})).displayName=iy.displayName;const uy="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=S(9);let o,r,a,i;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=hn(Zo({subcontent:!0}),uy,o),n[3]=o,n[4]=a):a=n[4],n[5]!==t||n[6]!==a||n[7]!==r?(i=C.jsx(sy,{ref:t,className:a,...r}),n[5]=t,n[6]=a,n[7]=r,n[8]=i):i=n[8],i})).displayName=sy.displayName;const hy=r.forwardRef(((e,t)=>{const n=S(9);let o,r,a,i;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=hn(Zo(),uy,o),n[3]=o,n[4]=a):a=n[4],n[5]!==t||n[6]!==a||n[7]!==r?(i=C.jsx(dy,{children:C.jsx(Qo,{children:C.jsx(Qg,{ref:t,className:a,...r})})}),n[5]=t,n[6]=a,n[7]=r,n[8]=i):i=n[8],i}));hy.displayName=Qg.displayName;const fy=r.forwardRef(((e,t)=>{const n=S(13);let o,r,a,i,s,l;return n[0]!==e?(({className:o,inset:r,variant:a,...i}=e),n[0]=e,n[1]=o,n[2]=r,n[3]=a,n[4]=i):(o=n[1],r=n[2],a=n[3],i=n[4]),n[5]!==o||n[6]!==r||n[7]!==a?(s=er({className:o,inset:r,variant:a}),n[5]=o,n[6]=r,n[7]=a,n[8]=s):s=n[8],n[9]!==t||n[10]!==s||n[11]!==i?(l=C.jsx(ty,{ref:t,className:s,...i}),n[9]=t,n[10]=s,n[11]=i,n[12]=l):l=n[12],l}));fy.displayName=ty.displayName;r.forwardRef(((e,t)=>{const n=S(15);let o,r,a,i,s,l,c,d;return n[0]!==e?(({className:o,children:i,checked:r,...a}=e),n[0]=e,n[1]=o,n[2]=r,n[3]=a,n[4]=i):(o=n[1],r=n[2],a=n[3],i=n[4]),n[5]!==o?(s=tr({className:o}),n[5]=o,n[6]=s):s=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=tr(),n[7]=l):l=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(c=C.jsx("span",{className:l,children:C.jsx(ry,{children:C.jsx(ar,{className:"h-4 w-4"})})}),n[8]=c):c=n[8],n[9]!==t||n[10]!==s||n[11]!==r||n[12]!==a||n[13]!==i?(d=C.jsxs(ny,{ref:t,className:s,checked:r,...a,children:[c,i]}),n[9]=t,n[10]=s,n[11]=r,n[12]=a,n[13]=i,n[14]=d):d=n[14],d})).displayName=ny.displayName;r.forwardRef(((e,t)=>{const n=S(13);let o,r,a,i,s,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?(i=tr({className:o}),n[4]=o,n[5]=i):i=n[5],n[6]===Symbol.for("react.memo_cache_sentinel")?(s=tr(),n[6]=s):s=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(l=C.jsx("span",{className:s,children:C.jsx(ry,{children:C.jsx(ir,{className:"h-4 w-4 fill-current"})})}),n[7]=l):l=n[7],n[8]!==t||n[9]!==i||n[10]!==r||n[11]!==a?(c=C.jsxs(oy,{ref:t,className:i,...r,children:[l,a]}),n[8]=t,n[9]=i,n[10]=r,n[11]=a,n[12]=c):c=n[12],c})).displayName=oy.displayName;r.forwardRef(((e,t)=>{const n=S(11);let o,r,a,i,s;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?(i=nr({className:o,inset:r}),n[4]=o,n[5]=r,n[6]=i):i=n[6],n[7]!==t||n[8]!==i||n[9]!==a?(s=C.jsx(ey,{ref:t,className:i,...a}),n[7]=t,n[8]=i,n[9]=a,n[10]=s):s=n[10],s})).displayName=ey.displayName;const my=r.forwardRef(((e,t)=>{const n=S(9);let o,r,a,i;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=hn(or({className:o})),n[3]=o,n[4]=a):a=n[4],n[5]!==t||n[6]!==a||n[7]!==r?(i=C.jsx(ay,{ref:t,className:a,...r}),n[5]=t,n[6]=a,n[7]=r,n[8]=i):i=n[8],i}));my.displayName=ay.displayName;const py=e=>{const t=S(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 i=n&&" inactive-button";let s,l,c,d,u;return t[2]!==i?(s=hn("shoulder-button hover-action",i),t[2]=i,t[3]=s):s=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(l=C.jsx(sr,{strokeWidth:1.8}),t[4]=l):l=t[4],t[5]!==a||t[6]!==s?(c=C.jsx(Gs,{onClick:a,className:s,onMouseDown:Ze.preventFocus,shape:"circle",size:"small",color:"hint-green","data-testid":"create-cell-button",children:l}),t[5]=a,t[6]=s,t[7]=c):c=t[7],t[8]!==r||t[9]!==c?(d=C.jsx(et,{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=C.jsx(gy,{onClick:o,children:d}),t[11]=o,t[12]=d,t[13]=u):u=t[13],u},gy=e=>{const t=S(24),{children:n,onClick:o}=e;if(!o)return n;let r,a,i,s,l,c,d,u,h,f,m,p;return t[0]!==n?(r=C.jsx(cy,{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")?(i=C.jsx("div",{className:"mr-3 text-muted-foreground",children:C.jsx(Bs,{})}),t[4]=i):i=t[4],t[5]!==a?(s=C.jsxs(fy,{onSelect:a,children:[i,"Python cell"]},"python"),t[5]=a,t[6]=s):s=t[6],t[7]!==o?(l=e=>{e.stopPropagation(),o({code:(new lr).defaultCode})},t[7]=o,t[8]=l):l=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(c=C.jsx("div",{className:"mr-3 text-muted-foreground",children:C.jsx(Fs,{})}),t[9]=c):c=t[9],t[10]!==l?(d=C.jsxs(fy,{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 cr).defaultCode})},t[12]=o,t[13]=u):u=t[13],t[14]===Symbol.for("react.memo_cache_sentinel")?(h=C.jsx("div",{className:"mr-3 text-muted-foreground",children:C.jsx(pe,{size:13,strokeWidth:1.5})}),t[14]=h):h=t[14],t[15]!==u?(f=C.jsxs(fy,{onSelect:u,children:[h,"SQL cell"]},"sql"),t[15]=u,t[16]=f):f=t[16],t[17]!==s||t[18]!==d||t[19]!==f?(m=C.jsxs(hy,{children:[s,d,f]}),t[17]=s,t[18]=d,t[19]=f,t[20]=m):m=t[20],t[21]!==r||t[22]!==m?(p=C.jsxs(ly,{children:[r,m]}),t[21]=r,t[22]=m,t[23]=p):p=t[23],p},yy=dr("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"}}),vy=e=>{const t=S(21);let n,o,r,a,i;t[0]!==e?(({children:a,tooltip:i,disabled:n,variant:r,...o}=e),t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=a,t[5]=i):(n=t[1],o=t[2],r=t[3],a=t[4],i=t[5]);const s=void 0!==n&&n;let l,c,d;t[6]!==s||t[7]!==o.onClick?(l=e=>{var t;s||null==(t=o.onClick)||t.call(o,e)},t[6]=s,t[7]=o.onClick,t[8]=l):l=t[8],t[9]!==r||t[10]!==o.className?(c=hn(yy({variant:r}),o.className),t[9]=r,t[10]=o.className,t[11]=c):c=t[11],t[12]!==s||t[13]!==o||t[14]!==l||t[15]!==c||t[16]!==a?(d=C.jsx("button",{disabled:s,...o,onClick:l,onMouseDown:Ze.preventFocus,className:c,children:a}),t[12]=s,t[13]=o,t[14]=l,t[15]=c,t[16]=a,t[17]=d):d=t[17];const u=d;if(i){let e;return t[18]!==i||t[19]!==u?(e=C.jsx(et,{content:i,side:"top",delayDuration:200,usePortal:!1,children:u}),t[18]=i,t[19]=u,t[20]=e):e=t[20],e}return u},xy=({children:e,className:t})=>C.jsx(wd,{className:hn("flex items-center gap-1 bg-background m-[2px] rounded-full",t),children:e});const by=e=>{const t=S(22),{onClick:n,appClosed:o,needsRun:r,status:a,config:i,edited:s}=e,l="disabled-transitively"===a,c="running"===a||"queued"===a,d=o||c||!i.disabled&&l&&!s;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(i.disabled){let e,o;return t[5]===Symbol.for("react.memo_cache_sentinel")?(e=C.jsx(Ic,{}),t[5]=e):e=t[5],t[6]!==d||t[7]!==n||t[8]!==h?(o=C.jsx(vy,{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(!i.disabled&&l&&!s){let e,o;return t[10]===Symbol.for("react.memo_cache_sentinel")?(e=C.jsx(qc,{strokeWidth:1.2}),t[10]=e):e=t[10],t[11]!==d||t[12]!==n||t[13]!==h?(o=C.jsx(vy,{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 f,m,p;if(o)f="App disconnected";else if("queued"===a)f="This cell is already queued to run";else if("running"===a)f="This cell is already running.";else{let e;t[15]===Symbol.for("react.memo_cache_sentinel")?(e=kt("cell.run"),t[15]=e):e=t[15],f=e}return t[16]===Symbol.for("react.memo_cache_sentinel")?(m=C.jsx(qc,{strokeWidth:1.2}),t[16]=m):m=t[16],t[17]!==f||t[18]!==d||t[19]!==n||t[20]!==h?(p=C.jsx(vy,{tooltip:f,disabled:d,onClick:n,variant:h,"data-testid":"run-button",children:m}),t[17]=f,t[18]=d,t[19]=n,t[20]=h,t[21]=p):p=t[21],p},wy=e=>{const t=S(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 i=a,s=(o||("running"===n||"queued"===n))&&"inactive-button";let l,c,d,u,h;return t[0]!==s?(l=hn("hover:bg-transparent text-destructive/60 hover:text-destructive",s),t[0]=s,t[1]=l):l=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(c={boxShadow:"none"},d=C.jsx(be,{size:14}),t[2]=c,t[3]=d):(c=t[2],d=t[3]),t[4]!==r||t[5]!==l?(u=C.jsx(W,{variant:"ghost",size:"icon",onClick:r,"data-testid":"delete-button",onMouseDown:Ze.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=C.jsx(et,{content:i,usePortal:!1,children:u}),t[7]=a,t[8]=u,t[9]=h):h=t[9],h};const ky=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),Sy=new Intl.DateTimeFormat("en-US",{month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),Ny=e=>{const t=S(79),{editing:n,status:o,disabled:r,staleInputs:a,edited:i,interrupted:s,elapsedTime:l,runStartTimestamp:c,lastRunStartTimestamp:d,uninstantiated:u}=e;if(!n)return null;const h=c??d;let f;t[0]!==h?(f=h?C.jsx(Ey,{lastRanTime:h}):null,t[0]=h,t[1]=f):f=t[1];const m=f;if(r&&"running"===o)return V.error("CellStatusComponent: disabled and running"),null;if(r&&a){let e,n,o,r;return t[2]===Symbol.for("react.memo_cache_sentinel")?(e=C.jsx("span",{children:"This cell is stale, but it's disabled and can't be run"}),t[2]=e):e=t[2],t[3]!==m?(n=C.jsxs("div",{className:"flex flex-col gap-1",children:[e,m]}),t[3]=m,t[4]=n):n=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(o=C.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:C.jsxs(Pd,{children:[C.jsx(ic,{className:"h-5 w-5",strokeWidth:1.5}),C.jsx(hr,{className:"h-3 w-3",strokeWidth:2.5})]})}),t[5]=o):o=t[5],t[6]!==n?(r=C.jsx(et,{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=C.jsx("span",{children:"This cell is disabled"}),t[8]=e):e=t[8],t[9]!==m?(n=C.jsxs("div",{className:"flex flex-col gap-1",children:[e,m]}),t[9]=m,t[10]=n):n=t[10],t[11]===Symbol.for("react.memo_cache_sentinel")?(o=C.jsx("div",{className:"cell-status-icon cell-status-disabled","data-testid":"cell-status","data-status":"disabled",children:C.jsx(ic,{className:"h-5 w-5",strokeWidth:1.5})}),t[11]=o):o=t[11],t[12]!==n?(r=C.jsx(et,{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=C.jsx("span",{children:"An ancestor of this cell is disabled, so it can't be run"}),t[14]=e):e=t[14],t[15]!==m?(n=C.jsxs("div",{className:"flex flex-col gap-1",children:[e,m]}),t[15]=m,t[16]=n):n=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(o=C.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"disabled-transitively",children:C.jsxs(Pd,{layerTop:!0,children:[C.jsx(gd,{className:"h-5 w-5",strokeWidth:1.5}),C.jsx(ic,{className:"h-3 w-3",strokeWidth:2.5})]})}),t[17]=o):o=t[17],t[18]!==n?(r=C.jsx(et,{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=C.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]!==m?(n=C.jsxs("div",{className:"flex flex-col gap-1",children:[e,m]}),t[21]=m,t[22]=n):n=t[22],t[23]===Symbol.for("react.memo_cache_sentinel")?(o=C.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:C.jsxs(Pd,{children:[C.jsx(hr,{className:"h-5 w-5",strokeWidth:1}),C.jsx(ic,{className:"h-3 w-3",strokeWidth:2.5})]})}),t[23]=o):o=t[23],t[24]!==n?(r=C.jsx(et,{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=C.jsx("span",{children:"This cell is running"}),t[26]=e):e=t[26],t[27]!==m?(n=C.jsxs("div",{className:"flex flex-col gap-1",children:[e,m]}),t[27]=m,t[28]=n):n=t[28],t[29]!==c?(o=ur.fromSeconds(c)||ur.now(),t[29]=c,t[30]=o):o=t[30],t[31]!==o?(r=C.jsx("div",{className:"cell-status-icon elapsed-time running","data-testid":"cell-status","data-status":"running",children:C.jsx(_y,{startTime:o})}),t[31]=o,t[32]=r):r=t[32],t[33]!==n||t[34]!==r?(a=C.jsx(et,{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=C.jsx("span",{children:"This cell is queued to run"}),t[36]=e):e=t[36],t[37]!==m?(n=C.jsxs("div",{className:"flex flex-col gap-1",children:[e,m]}),t[37]=m,t[38]=n):n=t[38],t[39]===Symbol.for("react.memo_cache_sentinel")?(o=C.jsx("div",{className:"cell-status-icon cell-status-queued","data-testid":"cell-status","data-status":"queued",children:C.jsx(El,{className:"h-5 w-5",strokeWidth:1.5})}),t[39]=o):o=t[39],t[40]!==n?(r=C.jsx(et,{content:n,usePortal:!1,children:o}),t[40]=n,t[41]=r):r=t[41],r}if(i||s||a||u){let e;t[42]!==l?(e=jy(l),t[42]=l,t[43]=e):e=t[43];const n=e;let o;t[44]!==l||t[45]!==n?(o=l?C.jsx(Cy,{elapsedTime:n}):null,t[44]=l,t[45]=n,t[46]=o):o=t[46];const r=o;let a,c,d,h,f,p="";if(u)a="This cell has not yet been run";else if(s){let e;a="This cell was interrupted when it was last run",t[47]!==r?(e=C.jsxs("span",{children:["This cell ran for ",r," before being interrupted"]}),t[47]=r,t[48]=e):e=t[48],p=e}else if(i){let e;a="This cell has been modified since it was last run",t[49]!==r?(e=C.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=C.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=C.jsx("div",{className:"cell-status-stale","data-testid":"cell-status","data-status":"outdated",children:C.jsx(hr,{className:"h-5 w-5",strokeWidth:1.5})}),t[53]=c):c=t[53],t[54]!==a?(d=C.jsx(et,{content:a,usePortal:!1,children:c}),t[54]=a,t[55]=d):d=t[55],t[56]!==l||t[57]!==p||t[58]!==m||t[59]!==n?(h=l&&C.jsx(et,{content:C.jsxs("div",{className:"flex flex-col gap-1",children:[p,m]}),usePortal:!1,children:C.jsx("div",{className:"elapsed-time hover-action","data-testid":"cell-status","data-status":"outdated",children:C.jsx("span",{children:n})})}),t[56]=l,t[57]=p,t[58]=m,t[59]=n,t[60]=h):h=t[60],t[61]!==d||t[62]!==h?(f=C.jsxs("div",{className:"cell-status-icon flex items-center gap-2",children:[d,h]}),t[61]=d,t[62]=h,t[63]=f):f=t[63],f}if(null!==l){let e;t[64]!==l?(e=jy(l),t[64]=l,t[65]=e):e=t[65];const n=e;let o;t[66]!==l||t[67]!==n?(o=l?C.jsx(Cy,{elapsedTime:n}):null,t[66]=l,t[67]=n,t[68]=o):o=t[68];const r=o;let a,i,s,c;return t[69]!==r?(a=C.jsxs("span",{children:["This cell took ",r," to run"]}),t[69]=r,t[70]=a):a=t[70],t[71]!==a||t[72]!==m?(i=C.jsxs("div",{className:"flex flex-col gap-1",children:[a,m]}),t[71]=a,t[72]=m,t[73]=i):i=t[73],t[74]!==n?(s=C.jsx("div",{className:"cell-status-icon elapsed-time hover-action","data-testid":"cell-status","data-status":"idle",children:C.jsx("span",{children:n})}),t[74]=n,t[75]=s):s=t[75],t[76]!==i||t[77]!==s?(c=C.jsx(et,{content:i,usePortal:!1,children:s}),t[76]=i,t[77]=s,t[78]=c):c=t[78],c}return null},Cy=e=>{const t=S(2);let n;return t[0]!==e.elapsedTime?(n=C.jsx("span",{className:"tracking-wide font-semibold",children:e.elapsedTime}),t[0]=e.elapsedTime,t[1]=n):n=t[1],n},Ey=e=>{const t=S(18),n=1e3*e.lastRanTime;let o,r,a,i,s,l,c,d,u;if(t[0]!==n){const e=new Date(n),d=new Date,u=e.toDateString()===d.toDateString()?ky:Sy;i="Ran at",s=" ",l=C.jsx("strong",{className:"tracking-wide font-semibold",children:u.format(e)}),c=" ",o="text-muted-foreground",r="(",a=Ed(e),t[0]=n,t[1]=o,t[2]=r,t[3]=a,t[4]=i,t[5]=s,t[6]=l,t[7]=c}else o=t[1],r=t[2],a=t[3],i=t[4],s=t[5],l=t[6],c=t[7];return t[8]!==o||t[9]!==r||t[10]!==a?(d=C.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]!==i||t[13]!==s||t[14]!==l||t[15]!==c||t[16]!==d?(u=C.jsxs("span",{children:[i,s,l,c,d]}),t[12]=i,t[13]=s,t[14]=l,t[15]=c,t[16]=d,t[17]=u):u=t[17],u};function jy(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 _y=e=>{const t=S(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(ur.now().toMilliseconds())}),17);return()=>clearInterval(e)}),[]),n-t.current}(n);let a,i;return t[2]!==o?(a=jy(o),t[2]=o,t[3]=a):a=t[3],t[4]!==a?(i=C.jsx("span",{children:a}),t[4]=a,t[5]=i):i=t[5],i},Iy={display:"none"};function Ty(e){let{id:t,value:n}=e;return u.createElement("div",{id:t,style:Iy},n)}function Ay(e){let{id:t,announcement:n,ariaLiveType:o="assertive"}=e;return u.createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":o,"aria-atomic":!0},n)}const My=r.createContext(null);const Oy={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 "},Dy={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 Py(e){let{announcements:t=Dy,container:n,hiddenTextDescribedById:o,screenReaderInstructions:a=Oy}=e;const{announce:i,announcement:s}=function(){const[e,t]=r.useState("");return{announce:r.useCallback((e=>{null!=e&&t(e)}),[]),announcement:e}}(),l=xr("DndLiveRegion"),[c,d]=r.useState(!1);if(r.useEffect((()=>{d(!0)}),[]),function(e){const t=r.useContext(My);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;i(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:o}=e;t.onDragMove&&i(t.onDragMove({active:n,over:o}))},onDragOver(e){let{active:n,over:o}=e;i(t.onDragOver({active:n,over:o}))},onDragEnd(e){let{active:n,over:o}=e;i(t.onDragEnd({active:n,over:o}))},onDragCancel(e){let{active:n,over:o}=e;i(t.onDragCancel({active:n,over:o}))}})),[i,t])),!c)return null;const h=u.createElement(u.Fragment,null,u.createElement(Ty,{id:o,value:a.draggable}),u.createElement(Ay,{id:l,announcement:s}));return n?wr.createPortal(h,n):h}var Ry,Ly;function zy(){}function Fy(e,t){return r.useMemo((()=>({sensor:e,options:null!=t?t:{}})),[e,t])}(Ly=Ry||(Ry={})).DragStart="dragStart",Ly.DragMove="dragMove",Ly.DragEnd="dragEnd",Ly.DragCancel="dragCancel",Ly.DragOver="dragOver",Ly.RegisterDroppable="registerDroppable",Ly.SetDroppableDisabled="setDroppableDisabled",Ly.UnregisterDroppable="unregisterDroppable";const By=Object.freeze({x:0,y:0});function Uy(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Vy(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function Hy(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function $y(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 Wy(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function Gy(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 qy=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e;const r=Gy(t,t.left,t.top),a=[];for(const i of o){const{id:e}=i,t=n.get(e);if(t){const n=Uy(Gy(t),r);a.push({id:e,data:{droppableContainer:i,value:n}})}}return a.sort(Vy)};function Yy(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),i=r-o,s=a-n;if(o<r&&n<a){const n=t.width*t.height,o=e.width*e.height,r=i*s;return Number((r/(n+o-r)).toFixed(4))}return 0}const Xy=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=Yy(o,t);n>0&&r.push({id:e,data:{droppableContainer:a,value:n}})}}return r.sort(Hy)};function Ky(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 Jy(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:By}function Zy(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 Qy=Zy(1);const ev={ignoreTransform:!1};function tv(e,t){void 0===t&&(t=ev);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:o}=fr(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:i,y:s}=o,l=e.left-i-(1-r)*parseFloat(n),c=e.top-s-(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:i,bottom:s,right:l}=n;return{top:o,left:r,width:a,height:i,bottom:s,right:l}}function nv(e){return tv(e,{ignoreTransform:!0})}function ov(e,t){const n=[];return e?function o(r){if(null!=t&&n.length>=t)return n;if(!r)return n;if(Tr(r)&&null!=r.scrollingElement&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!jr(r)||Ar(r))return n;if(n.includes(r))return n;const a=fr(e).getComputedStyle(r);return r!==e&&function(e,t){void 0===t&&(t=fr(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=fr(e).getComputedStyle(e)),"fixed"===t.position}(r,a)?n:o(r.parentNode)}(e):n}function rv(e){const[t]=ov(e,1);return null!=t?t:null}function av(e){return Er&&e?Mr(e)?e:Or(e)?Tr(e)||e===mr(e).scrollingElement?window:jr(e)?e:null:null:null}function iv(e){return Mr(e)?e.scrollX:e.scrollLeft}function sv(e){return Mr(e)?e.scrollY:e.scrollTop}function lv(e){return{x:iv(e),y:sv(e)}}var cv,dv;function uv(e){return!(!Er||!e)&&e===document.scrollingElement}function hv(e){const t={x:0,y:0},n=uv(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}}(dv=cv||(cv={}))[dv.Forward=1]="Forward",dv[dv.Backward=-1]="Backward";const fv={x:.2,y:.2};function mv(e,t,n,o,r){let{top:a,left:i,right:s,bottom:l}=n;void 0===o&&(o=10),void 0===r&&(r=fv);const{isTop:c,isBottom:d,isLeft:u,isRight:h}=hv(e),f={x:0,y:0},m={x:0,y:0},p=t.height*r.y,g=t.width*r.x;return!c&&a<=t.top+p?(f.y=cv.Backward,m.y=o*Math.abs((t.top+p-a)/p)):!d&&l>=t.bottom-p&&(f.y=cv.Forward,m.y=o*Math.abs((t.bottom-p-l)/p)),!h&&s>=t.right-g?(f.x=cv.Forward,m.x=o*Math.abs((t.right-g-s)/g)):!u&&i<=t.left+g&&(f.x=cv.Backward,m.x=o*Math.abs((t.left+g-i)/g)),{direction:f,speed:m}}function pv(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 gv(e){return e.reduce(((e,t)=>yr(e,lv(t))),By)}const yv=[["x",["left","right"],function(e){return e.reduce(((e,t)=>e+iv(t)),0)}],["y",["top","bottom"],function(e){return e.reduce(((e,t)=>e+sv(t)),0)}]];class vv{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=ov(t),o=gv(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[r,a,i]of yv)for(const e of a)Object.defineProperty(this,e,{get:()=>{const t=i(n),a=o[r]-t;return this.rect[e]+a},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class xv{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 bv(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 wv,kv,Sv,Nv;function Cv(e){e.preventDefault()}function Ev(e){e.stopPropagation()}(kv=wv||(wv={})).Click="click",kv.DragStart="dragstart",kv.Keydown="keydown",kv.ContextMenu="contextmenu",kv.Resize="resize",kv.SelectionChange="selectionchange",kv.VisibilityChange="visibilitychange",(Nv=Sv||(Sv={})).Space="Space",Nv.Down="ArrowDown",Nv.Right="ArrowRight",Nv.Left="ArrowLeft",Nv.Up="ArrowUp",Nv.Esc="Escape",Nv.Enter="Enter";const jv={start:[Sv.Space,Sv.Enter],cancel:[Sv.Esc],end:[Sv.Space,Sv.Enter]},_v=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Sv.Right:return{...n,x:n.x+25};case Sv.Left:return{...n,x:n.x-25};case Sv.Down:return{...n,y:n.y+25};case Sv.Up:return{...n,y:n.y-25}}};class Iv{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 xv(mr(t)),this.windowListeners=new xv(fr(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(wv.Resize,this.handleCancel),this.windowListeners.add(wv.VisibilityChange,this.handleCancel),setTimeout((()=>this.listeners.add(wv.Keydown,this.handleKeyDown)))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=tv),!e)return;const{top:n,left:o,bottom:r,right:a}=t(e);rv(e)&&(r<=0||a<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(By)}handleKeyDown(e){if(pr(e)){const{active:t,context:n,options:o}=this.props,{keyboardCodes:r=jv,coordinateGetter:a=_v,scrollBehavior:i="smooth"}=o,{code:s}=e;if(r.end.includes(s))return void this.handleEnd(e);if(r.cancel.includes(s))return void this.handleCancel(e);const{collisionRect:l}=n.current,c=l?{x:l.left,y:l.top}:By;this.referenceCoordinates||(this.referenceCoordinates=c);const d=a(e,{active:t,context:n.current,currentCoordinates:c});if(d){const t=gr(d,c),o={x:0,y:0},{scrollableAncestors:r}=n.current;for(const n of r){const r=e.code,{isTop:a,isRight:s,isLeft:l,isBottom:c,maxScroll:u,minScroll:h}=hv(n),f=pv(n),m={x:Math.min(r===Sv.Right?f.right-f.width/2:f.right,Math.max(r===Sv.Right?f.left:f.left+f.width/2,d.x)),y:Math.min(r===Sv.Down?f.bottom-f.height/2:f.bottom,Math.max(r===Sv.Down?f.top:f.top+f.height/2,d.y))},p=r===Sv.Right&&!s||r===Sv.Left&&!l,g=r===Sv.Down&&!c||r===Sv.Up&&!a;if(p&&m.x!==d.x){const e=n.scrollLeft+t.x,a=r===Sv.Right&&e<=u.x||r===Sv.Left&&e>=h.x;if(a&&!t.y)return void n.scrollTo({left:e,behavior:i});o.x=a?n.scrollLeft-e:r===Sv.Right?n.scrollLeft-u.x:n.scrollLeft-h.x,o.x&&n.scrollBy({left:-o.x,behavior:i});break}if(g&&m.y!==d.y){const e=n.scrollTop+t.y,a=r===Sv.Down&&e<=u.y||r===Sv.Up&&e>=h.y;if(a&&!t.x)return void n.scrollTo({top:e,behavior:i});o.y=a?n.scrollTop-e:r===Sv.Down?n.scrollTop-u.y:n.scrollTop-h.y,o.y&&n.scrollBy({top:-o.y,behavior:i});break}}this.handleMove(e,yr(gr(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 Tv(e){return Boolean(e&&"distance"in e)}function Av(e){return Boolean(e&&"delay"in e)}Iv.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:o=jv,onActivation:r}=t,{active:a}=n;const{code:i}=e.nativeEvent;if(o.start.includes(i)){const t=a.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==r||r({event:e.nativeEvent}),!0)}return!1}}];class Mv{constructor(e,t,n){var o;void 0===n&&(n=function(e){const{EventTarget:t}=fr(e);return e instanceof t?e:mr(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=mr(a),this.documentListeners=new xv(this.document),this.listeners=new xv(n),this.windowListeners=new xv(fr(a)),this.initialCoordinates=null!=(o=br(r))?o:By,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),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(wv.Resize,this.handleCancel),this.windowListeners.add(wv.DragStart,Cv),this.windowListeners.add(wv.VisibilityChange,this.handleCancel),this.windowListeners.add(wv.ContextMenu,Cv),this.documentListeners.add(wv.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Av(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay));if(Tv(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(wv.Click,Ev,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(wv.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:o,props:r}=this,{onMove:a,options:{activationConstraint:i}}=r;if(!o)return;const s=null!=(t=br(e))?t:By,l=gr(o,s);if(!n&&i){if(Tv(i)){if(null!=i.tolerance&&bv(l,i.tolerance))return this.handleCancel();if(bv(l,i.distance))return this.handleStart()}return Av(i)&&bv(l,i.tolerance)?this.handleCancel():void 0}e.cancelable&&e.preventDefault(),a(s)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===Sv.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const Ov={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Dv extends Mv{constructor(e){const{event:t}=e,n=mr(t.target);super(e,Ov,n)}}Dv.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 Pv={move:{name:"mousemove"},end:{name:"mouseup"}};var Rv,Lv;(Lv=Rv||(Rv={}))[Lv.RightClick=2]="RightClick";(class extends Mv{constructor(e){super(e,Pv,mr(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button!==Rv.RightClick&&(null==o||o({event:n}),!0)}}];const zv={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var Fv,Bv,Uv,Vv;function Hv(e){let{acceleration:t,activator:n=Fv.Pointer,canScroll:o,draggingRect:a,enabled:i,interval:s=5,order:l=Uv.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:h,threshold:f}=e;const m=function(e){let{delta:t,disabled:n}=e;const o=Nr(t);return Cr((e=>{if(n||!o||!e)return $v;const r={x:Math.sign(t.x-o.x),y:Math.sign(t.y-o.y)};return{x:{[cv.Backward]:e.x[cv.Backward]||-1===r.x,[cv.Forward]:e.x[cv.Forward]||1===r.x},y:{[cv.Backward]:e.y[cv.Backward]||-1===r.y,[cv.Forward]:e.y[cv.Forward]||1===r.y}}}),[n,t,o])}({delta:h,disabled:!i}),[p,g]=Sr(),y=r.useRef({x:0,y:0}),v=r.useRef({x:0,y:0}),x=r.useMemo((()=>{switch(n){case Fv.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Fv.DraggableRect:return a}}),[n,a,c]),b=r.useRef(null),w=r.useCallback((()=>{const e=b.current;if(!e)return;const t=y.current.x*v.current.x,n=y.current.y*v.current.y;e.scrollBy(t,n)}),[]),k=r.useMemo((()=>l===Uv.TreeOrder?[...d].reverse():d),[l,d]);r.useEffect((()=>{if(i&&d.length&&x){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:i}=mv(e,r,x,t,f);for(const e of["x","y"])m[e][a[e]]||(i[e]=0,a[e]=0);if(i.x>0||i.y>0)return g(),b.current=e,p(w,s),y.current=i,void(v.current=a)}y.current={x:0,y:0},v.current={x:0,y:0},g()}else g()}),[t,w,o,g,i,s,JSON.stringify(x),JSON.stringify(m),p,d,k,u,JSON.stringify(f)])}(class extends Mv{constructor(e){super(e,zv)}static setup(){return window.addEventListener(zv.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(zv.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)}}],(Bv=Fv||(Fv={}))[Bv.Pointer=0]="Pointer",Bv[Bv.DraggableRect=1]="DraggableRect",(Vv=Uv||(Uv={}))[Vv.TreeOrder=0]="TreeOrder",Vv[Vv.ReversedTreeOrder=1]="ReversedTreeOrder";const $v={x:{[cv.Backward]:!1,[cv.Forward]:!1},y:{[cv.Backward]:!1,[cv.Forward]:!1}};var Wv,Gv,qv;(Gv=Wv||(Wv={}))[Gv.Always=0]="Always",Gv[Gv.BeforeDragging=1]="BeforeDragging",Gv[Gv.WhileDragging=2]="WhileDragging",(qv||(qv={})).Optimized="optimized";const Yv=new Map;function Xv(e,t){return Cr((n=>e?n||("function"==typeof t?t(e):e):null),[t,e])}function Kv(e){let{callback:t,disabled:n}=e;const o=Dr(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 Jv(e){return new vv(tv(e),e)}function Zv(e,t,n){void 0===t&&(t=Jv);const[o,a]=r.useState(null);function i(){a((o=>{if(!e)return null;var r;if(!1===e.isConnected)return null!=(r=null!=o?o:n)?r:null;const a=t(e);return JSON.stringify(o)===JSON.stringify(a)?o:a}))}const s=function(e){let{callback:t,disabled:n}=e;const o=Dr(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)){i();break}}}}),l=Kv({callback:i});return kr((()=>{i(),e?(null==l||l.observe(e),null==s||s.observe(document.body,{childList:!0,subtree:!0})):(null==l||l.disconnect(),null==s||s.disconnect())}),[e]),o}const Qv=[];function ex(e,t){void 0===t&&(t=[]);const n=r.useRef(null);return r.useEffect((()=>{n.current=null}),t),r.useEffect((()=>{const t=e!==By;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)}),[e]),n.current?gr(e,n.current):By}function tx(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 nx=[];function ox(e){let{measure:t}=e;const[n,o]=r.useState(null),a=Kv({callback:r.useCallback((e=>{for(const{target:n}of e)if(jr(n)){o((e=>{const o=t(n);return e?{...e,width:o.width,height:o.height}:o}));break}}),[t])}),i=r.useCallback((e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return jr(t)?t:e}(e);null==a||a.disconnect(),n&&(null==a||a.observe(n)),o(n?t(n):null)}),[t,a]),[s,l]=_r(i);return r.useMemo((()=>({nodeRef:s,rect:n,setRef:l})),[n,s,l])}const rx=[{sensor:Dv,options:{}},{sensor:Iv,options:{}}],ax={current:{}},ix={draggable:{measure:nv},droppable:{measure:nv,strategy:Wv.WhileDragging,frequency:qv.Optimized},dragOverlay:{measure:tv}};class sx 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 lx={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new sx,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:zy},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ix,measureDroppableContainers:zy,windowRect:null,measuringScheduled:!1},cx={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:zy,draggableNodes:new Map,over:null,measureDroppableContainers:zy},dx=r.createContext(cx),ux=r.createContext(lx);function hx(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new sx}}}function fx(e,t){switch(t.type){case Ry.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ry.DragMove:return null==e.draggable.active?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Ry.DragEnd:case Ry.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ry.RegisterDroppable:{const{element:n}=t,{id:o}=n,r=new sx(e.droppable.containers);return r.set(o,n),{...e,droppable:{...e.droppable,containers:r}}}case Ry.SetDroppableDisabled:{const{id:n,key:o,disabled:r}=t,a=e.droppable.containers.get(n);if(!a||o!==a.key)return e;const i=new sx(e.droppable.containers);return i.set(n,{...a,disabled:r}),{...e,droppable:{...e.droppable,containers:i}}}case Ry.UnregisterDroppable:{const{id:n,key:o}=t,r=e.droppable.containers.get(n);if(!r||o!==r.key)return e;const a=new sx(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function mx(e){let{disabled:t}=e;const{active:n,activatorEvent:o,draggableNodes:a}=r.useContext(dx),i=Nr(o),s=Nr(null==n?void 0:n.id);return r.useEffect((()=>{if(!t&&!o&&i&&null!=s){if(!pr(i))return;if(document.activeElement===i.target)return;const e=a.get(s);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,s,i]),null}const px=r.createContext({...By,scaleX:1,scaleY:1});var gx,yx;(yx=gx||(gx={}))[yx.Uninitialized=0]="Uninitialized",yx[yx.Initializing=1]="Initializing",yx[yx.Initialized=2]="Initialized";const vx=r.memo((function(e){var t,n,o,a;let{id:i,accessibility:s,autoScroll:l=!0,children:c,sensors:d=rx,collisionDetection:h=Xy,measuring:f,modifiers:m,...p}=e;const g=r.useReducer(fx,void 0,hx),[y,v]=g,[x,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(gx.Uninitialized),S=w===gx.Initialized,{draggable:{active:N,nodes:C,translate:E},droppable:{containers:j}}=y,_=null!=N?C.get(N):null,I=r.useRef({initial:null,translated:null}),T=r.useMemo((()=>{var e;return null!=N?{id:N,data:null!=(e=null==_?void 0:_.data)?e:ax,rect:I}:null}),[N,_]),A=r.useRef(null),[M,O]=r.useState(null),[D,P]=r.useState(null),R=vr(p,Object.values(p)),L=xr("DndDescribedBy",i),z=r.useMemo((()=>j.getEnabled()),[j]),F=(B=f,r.useMemo((()=>({draggable:{...ix.draggable,...null==B?void 0:B.draggable},droppable:{...ix.droppable,...null==B?void 0:B.droppable},dragOverlay:{...ix.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:H}=function(e,t){let{dragging:n,dependencies:o,config:a}=t;const[i,s]=r.useState(null),{frequency:l,measure:c,strategy:d}=a,u=r.useRef(e),h=function(){switch(d){case Wv.Always:return!1;case Wv.BeforeDragging:return n;default:return!n}}(),f=vr(h),m=r.useCallback((function(e){void 0===e&&(e=[]),f.current||s((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[f]),p=r.useRef(null),g=Cr((t=>{if(h&&!n)return Yv;if(!t||t===Yv||u.current!==e||null!=i){const t=new Map;for(let n of e){if(!n)continue;if(i&&i.length>0&&!i.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,o=e?new vv(c(e),e):null;n.rect.current=o,o&&t.set(n.id,o)}return t}return t}),[e,i,n,h,c]);return r.useEffect((()=>{u.current=e}),[e]),r.useEffect((()=>{h||m()}),[n,h]),r.useEffect((()=>{i&&i.length>0&&s(null)}),[JSON.stringify(i)]),r.useEffect((()=>{h||"number"!=typeof l||null!==p.current||(p.current=setTimeout((()=>{m(),p.current=null}),l))}),[l,h,m,...o]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:null!=i}}(z,{dragging:S,dependencies:[E.x,E.y],config:F.droppable}),$=function(e,t){const n=null!=t?e.get(t):void 0,o=n?n.node.current:null;return Cr((e=>{var n;return null==t?null:null!=(n=null!=o?o:e)?n:null}),[o,t])}(C,N),W=r.useMemo((()=>D?br(D):null),[D]),G=function(){const e=!1===(null==M?void 0:M.autoScrollEnabled),t="object"==typeof l?!1===l.enabled:!1===l,n=S&&!e&&!t;if("object"==typeof l)return{...l,enabled:n};return{enabled:n}}(),q=function(e,t){return Xv(e,t)}($,F.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:o,config:a=!0}=e;const i=r.useRef(!1),{x:s,y:l}="boolean"==typeof a?{x:a,y:a}:a;kr((()=>{if(!s&&!l||!t)return void(i.current=!1);if(i.current||!o)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const r=Jy(n(e),o);if(s||(r.x=0),l||(r.y=0),i.current=!0,Math.abs(r.x)>0||Math.abs(r.y)>0){const t=rv(e);t&&t.scrollBy({top:r.y,left:r.x})}}),[t,s,l,o,n])}({activeNode:null!=N?C.get(N):null,config:G.layoutShiftCompensation,initialRect:q,measure:F.draggable.measure});const Y=Zv($,F.draggable.measure,q),X=Zv($?$.parentElement:null),K=r.useRef({activatorEvent:null,active:null,activeNode:$,collisionRect:null,collisions:null,droppableRects:U,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:j,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),J=j.getNodeFor(null==(t=K.current.over)?void 0:t.id),Z=ox({measure:F.dragOverlay.measure}),Q=null!=(n=Z.nodeRef.current)?n:$,ee=S?null!=(o=Z.rect)?o:Y:null,te=Boolean(Z.nodeRef.current&&Z.rect),ne=Jy(oe=te?null:Y,Xv(oe));var oe;const re=tx(Q?fr(Q):null),ae=function(e){const t=r.useRef(e),n=Cr((n=>e?n&&n!==Qv&&e&&t.current&&e.parentNode===t.current.parentNode?n:ov(e):Qv),[e]);return r.useEffect((()=>{t.current=e}),[e]),n}(S?null!=J?J:$:null),ie=function(e,t){void 0===t&&(t=tv);const[n]=e,o=tx(n?fr(n):null),[a,i]=r.useState(nx);function s(){i((()=>e.length?e.map((e=>uv(e)?o:new vv(t(e),e))):nx))}const l=Kv({callback:s});return kr((()=>{null==l||l.disconnect(),s(),e.forEach((e=>null==l?void 0:l.observe(e)))}),[e]),a}(ae),se=function(e,t){let{transform:n,...o}=t;return null!=e&&e.length?e.reduce(((e,t)=>t({transform:e,...o})),n):n}(m,{transform:{x:E.x-ne.x,y:E.y-ne.y,scaleX:1,scaleY:1},activatorEvent:D,active:T,activeNodeRect:Y,containerNodeRect:X,draggingNodeRect:ee,over:K.current.over,overlayNodeRect:Z.rect,scrollableAncestors:ae,scrollableAncestorRects:ie,windowRect:re}),le=W?yr(W,E):null,ce=function(e){const[t,n]=r.useState(null),o=r.useRef(e),a=r.useCallback((e=>{const t=av(e.target);t&&n((e=>e?(e.set(t,lv(t)),new Map(e)):null))}),[]);return r.useEffect((()=>{const t=o.current;if(e!==t){r(t);const i=e.map((e=>{const t=av(e);return t?(t.addEventListener("scroll",a,{passive:!0}),[t,lv(t)]):null})).filter((e=>null!=e));n(i.length?new Map(i):null),o.current=e}return()=>{r(e),r(t)};function r(e){e.forEach((e=>{const t=av(e);null==t||t.removeEventListener("scroll",a)}))}}),[a,e]),r.useMemo((()=>e.length?t?Array.from(t.values()).reduce(((e,t)=>yr(e,t)),By):gv(e):By),[e,t])}(ae),de=ex(ce),ue=ex(ce,[Y]),he=yr(se,de),fe=ee?Qy(ee,se):null,me=T&&fe?h({active:T,collisionRect:fe,droppableRects:U,droppableContainers:z,pointerCoordinates:le}):null,pe=Wy(me,"id"),[ge,ye]=r.useState(null),ve=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(te?se:yr(se,ue),null!=(a=null==ge?void 0:ge.rect)?a:null,Y),xe=r.useRef(null),be=r.useCallback(((e,t)=>{let{sensor:n,options:o}=t;if(null==A.current)return;const r=C.get(A.current);if(!r)return;const a=e.nativeEvent,i=new n({active:A.current,activeNode:r,event:a,options:o,context:K,onStart(e){const t=A.current;if(null==t)return;const n=C.get(t);if(!n)return;const{onDragStart:o}=R.current,r={activatorEvent:a,active:{id:t,data:n.data,rect:I}};wr.unstable_batchedUpdates((()=>{null==o||o(r),k(gx.Initializing),v({type:Ry.DragStart,initialCoordinates:e,active:t}),x({type:"onDragStart",event:r}),O(xe.current),P(a)}))},onMove(e){v({type:Ry.DragMove,coordinates:e})},onEnd:s(Ry.DragEnd),onCancel:s(Ry.DragCancel)});function s(e){return async function(){const{active:t,collisions:n,over:o,scrollAdjustedTranslate:r}=K.current;let i=null;if(t&&r){const{cancelDrop:s}=R.current;if(i={activatorEvent:a,active:t,collisions:n,delta:r,over:o},e===Ry.DragEnd&&"function"==typeof s){await Promise.resolve(s(i))&&(e=Ry.DragCancel)}}A.current=null,wr.unstable_batchedUpdates((()=>{v({type:e}),k(gx.Uninitialized),ye(null),O(null),P(null),xe.current=null;const t=e===Ry.DragEnd?"onDragEnd":"onDragCancel";if(i){const e=R.current[t];null==e||e(i),x({type:t,event:i})}}))}}xe.current=i}),[C]),we=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=C.get(o);if(null!==A.current||!a||r.dndKit||r.defaultPrevented)return;const i={active:a};!0===e(n,t.options,i)&&(r.dndKit={capturedBy:t.sensor},A.current=o,be(n,t))}),[C,be]));!function(e){r.useEffect((()=>{if(!Er)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),kr((()=>{Y&&w===gx.Initializing&&k(gx.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};wr.unstable_batchedUpdates((()=>{null==e||e(a),x({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==A.current||!t||!r)return;const{onDragOver:a}=R.current,i=o.get(pe),s=i&&i.rect.current?{id:i.id,rect:i.rect.current,data:i.data,disabled:i.disabled}:null,l={active:e,activatorEvent:t,collisions:n,delta:{x:r.x,y:r.y},over:s};wr.unstable_batchedUpdates((()=>{ye(s),null==a||a(l),x({type:"onDragOver",event:l})}))}),[pe]),kr((()=>{K.current={activatorEvent:D,active:T,activeNode:$,collisionRect:fe,collisions:me,droppableRects:U,draggableNodes:C,draggingNode:Q,draggingNodeRect:ee,droppableContainers:j,over:ge,scrollableAncestors:ae,scrollAdjustedTranslate:he},I.current={initial:ee,translated:fe}}),[T,$,me,fe,C,Q,ee,U,j,ge,ae,he]),Hv({...G,delta:E,draggingRect:fe,pointerCoordinates:le,scrollableAncestors:ae,scrollableAncestorRects:ie});const ke=r.useMemo((()=>({active:T,activeNode:$,activeNodeRect:Y,activatorEvent:D,collisions:me,containerNodeRect:X,dragOverlay:Z,draggableNodes:C,droppableContainers:j,droppableRects:U,over:ge,measureDroppableContainers:V,scrollableAncestors:ae,scrollableAncestorRects:ie,measuringConfiguration:F,measuringScheduled:H,windowRect:re})),[T,$,Y,D,me,X,Z,C,j,U,ge,V,ae,ie,F,H,re]),Se=r.useMemo((()=>({activatorEvent:D,activators:we,active:T,activeNodeRect:Y,ariaDescribedById:{draggable:L},dispatch:v,draggableNodes:C,over:ge,measureDroppableContainers:V})),[D,we,T,Y,v,L,C,ge,V]);return u.createElement(My.Provider,{value:b},u.createElement(dx.Provider,{value:Se},u.createElement(ux.Provider,{value:ke},u.createElement(px.Provider,{value:ve},c)),u.createElement(mx,{disabled:!1===(null==s?void 0:s.restoreFocus)})),u.createElement(Py,{...s,hiddenTextDescribedById:L}))})),xx=r.createContext(null),bx="button";function wx(e){let{id:t,data:n,disabled:o=!1,attributes:a}=e;const i=xr("Draggable"),{activators:s,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:h,over:f}=r.useContext(dx),{role:m=bx,roleDescription:p="draggable",tabIndex:g=0}=null!=a?a:{},y=(null==c?void 0:c.id)===t,v=r.useContext(y?px:xx),[x,b]=_r(),[w,k]=_r(),S=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])}(s,t),N=vr(n);kr((()=>(h.set(t,{id:t,key:i,node:x,activatorNode:w,data:N}),()=>{const e=h.get(t);e&&e.key===i&&h.delete(t)})),[h,t]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:r.useMemo((()=>({role:m,tabIndex:g,"aria-disabled":o,"aria-pressed":!(!y||m!==bx)||void 0,"aria-roledescription":p,"aria-describedby":u.draggable})),[o,m,g,y,p,u.draggable]),isDragging:y,listeners:o?void 0:S,node:x,over:f,setNodeRef:b,setActivatorNodeRef:k,transform:v}}const kx={timeout:25};function Sx(e,t,n){const o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function Nx(e,t){return e.reduce(((e,n,o)=>{const r=t.get(n);return r&&(e[o]=r),e}),Array(e.length))}function Cx(e){return null!==e&&e>=0}const Ex={scaleX:1,scaleY:1},jx=e=>{var t;let{rects:n,activeNodeRect:o,activeIndex:r,overIndex:a,index:i}=e;const s=null!=(t=n[r])?t:o;if(!s)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,i,r);if(i===r){const e=n[a];return e?{x:r<a?e.left+e.width-(s.left+s.width):e.left-s.left,y:0,...Ex}:null}return i>r&&i<=a?{x:-s.width-l,y:0,...Ex}:i<r&&i>=a?{x:s.width+l,y:0,...Ex}:{x:0,y:0,...Ex}};const _x=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e;const a=Sx(t,o,n),i=t[r],s=a[r];return s&&i?{x:s.left-i.left,y:s.top-i.top,scaleX:s.width/i.width,scaleY:s.height/i.height}:null},Ix={scaleX:1,scaleY:1},Tx=e=>{var t;let{activeIndex:n,activeNodeRect:o,index:r,rects:a,overIndex:i}=e;const s=null!=(t=a[n])?t:o;if(!s)return null;if(r===n){const e=a[i];return e?{x:0,y:n<i?e.top+e.height-(s.top+s.height):e.top-s.top,...Ix}: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<=i?{x:0,y:-s.height-l,...Ix}:r<n&&r>=i?{x:0,y:s.height+l,...Ix}:{x:0,y:0,...Ix}};const Ax="Sortable",Mx=u.createContext({activeIndex:-1,containerId:Ax,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:_x,disabled:{draggable:!1,droppable:!1}});function Ox(e){let{children:t,id:n,items:o,strategy:a=_x,disabled:i=!1}=e;const{active:s,dragOverlay:l,droppableRects:c,over:d,measureDroppableContainers:h}=r.useContext(ux),f=xr(Ax,n),m=Boolean(null!==l.rect),p=r.useMemo((()=>o.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[o]),g=null!=s,y=s?p.indexOf(s.id):-1,v=d?p.indexOf(d.id):-1,x=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,x.current),w=-1!==v&&-1===y||b,k=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(i);kr((()=>{b&&g&&h(p)}),[b,p,g,h]),r.useEffect((()=>{x.current=p}),[p]);const S=r.useMemo((()=>({activeIndex:y,containerId:f,disabled:k,disableTransforms:w,items:p,overIndex:v,useDragOverlay:m,sortedRects:Nx(p,c),strategy:a})),[y,f,k.draggable,k.droppable,w,p,v,c,m,a]);return u.createElement(Mx.Provider,{value:S},t)}const Dx=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return Sx(n,o,r).indexOf(t)},Px=e=>{let{containerId:t,isSorting:n,wasDragging:o,index:r,items:a,newIndex:i,previousItems:s,previousContainerId:l,transition:c}=e;return!(!c||!o)&&((s===a||r!==i)&&(!!n||i!==r&&t===l))},Rx={duration:200,easing:"ease"},Lx="transform",zx=Rr.Transition.toString({property:Lx,duration:0,easing:"linear"}),Fx={roleDescription:"sortable"};function Bx(e){let{animateLayoutChanges:t=Px,attributes:n,disabled:o,data:a,getNewIndex:i=Dx,id:s,strategy:l,resizeObserverConfig:c,transition:d=Rx}=e;const{items:u,containerId:h,activeIndex:f,disabled:m,disableTransforms:p,sortedRects:g,overIndex:y,useDragOverlay:v,strategy:x}=r.useContext(Mx),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,m),w=u.indexOf(s),k=r.useMemo((()=>({sortable:{containerId:h,index:w,items:u},...a})),[h,a,w,u]),S=r.useMemo((()=>u.slice(u.indexOf(s))),[u,s]),{rect:N,node:C,isOver:E,setNodeRef:j}=function(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:a}=e;const i=xr("Droppable"),{active:s,dispatch:l,over:c,measureDroppableContainers:d}=r.useContext(dx),u=r.useRef({disabled:n}),h=r.useRef(!1),f=r.useRef(null),m=r.useRef(null),{disabled:p,updateMeasurementsFor:g,timeout:y}={...kx,...a},v=vr(null!=g?g:o),x=Kv({callback:r.useCallback((()=>{h.current?(null!=m.current&&clearTimeout(m.current),m.current=setTimeout((()=>{d(Array.isArray(v.current)?v.current:[v.current]),m.current=null}),y)):h.current=!0}),[y]),disabled:p||!s}),b=r.useCallback(((e,t)=>{x&&(t&&(x.unobserve(t),h.current=!1),e&&x.observe(e))}),[x]),[w,k]=_r(b),S=vr(t);return r.useEffect((()=>{x&&w.current&&(x.disconnect(),h.current=!1,x.observe(w.current))}),[w,x]),r.useEffect((()=>(l({type:Ry.RegisterDroppable,element:{id:o,key:i,disabled:n,node:w,rect:f,data:S}}),()=>l({type:Ry.UnregisterDroppable,key:i,id:o}))),[o]),r.useEffect((()=>{n!==u.current.disabled&&(l({type:Ry.SetDroppableDisabled,id:o,key:i,disabled:n}),u.current.disabled=n)}),[o,i,n,l]),{active:s,rect:f,isOver:(null==c?void 0:c.id)===o,node:w,over:c,setNodeRef:k}}({id:s,data:k,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:_,activatorEvent:I,activeNodeRect:T,attributes:A,setNodeRef:M,listeners:O,isDragging:D,over:P,setActivatorNodeRef:R,transform:L}=wx({id:s,data:k,attributes:{...Fx,...n},disabled:b.draggable}),z=Pr(j,M),F=Boolean(_),B=F&&!p&&Cx(f)&&Cx(y),U=!v&&D,V=U&&B?L:null,H=B?null!=V?V:(null!=l?l:x)({rects:g,activeNodeRect:T,activeIndex:f,overIndex:y,index:w}):null,$=Cx(f)&&Cx(y)?i({id:s,items:u,activeIndex:f,overIndex:y}):w,W=null==_?void 0:_.id,G=r.useRef({activeId:W,items:u,newIndex:$,containerId:h}),q=u!==G.current.items,Y=t({active:_,containerId:h,isDragging:D,isSorting:F,id:s,index:w,items:u,newIndex:G.current.newIndex,previousItems:G.current.items,previousContainerId:G.current.containerId,transition:d,wasDragging:null!=G.current.activeId}),X=function(e){let{disabled:t,index:n,node:o,rect:a}=e;const[i,s]=r.useState(null),l=r.useRef(n);return kr((()=>{if(!t&&n!==l.current&&o.current){const e=a.current;if(e){const t=tv(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)&&s(n)}}n!==l.current&&(l.current=n)}),[t,n,o,a]),r.useEffect((()=>{i&&s(null)}),[i]),i}({disabled:!Y,index:w,node:C,rect:N});return r.useEffect((()=>{F&&G.current.newIndex!==$&&(G.current.newIndex=$),h!==G.current.containerId&&(G.current.containerId=h),u!==G.current.items&&(G.current.items=u)}),[F,$,h,u]),r.useEffect((()=>{if(W===G.current.activeId)return;if(null!=W&&null==G.current.activeId)return void(G.current.activeId=W);const e=setTimeout((()=>{G.current.activeId=W}),50);return()=>clearTimeout(e)}),[W]),{active:_,activeIndex:f,attributes:A,data:k,rect:N,index:w,newIndex:$,items:u,isOver:E,isSorting:F,isDragging:D,listeners:O,node:C,overIndex:y,over:P,setNodeRef:z,setActivatorNodeRef:R,setDroppableNodeRef:j,setDraggableNodeRef:M,transform:null!=X?X:H,transition:function(){if(X||q&&G.current.newIndex===w)return zx;if(U&&!pr(I)||!d)return;if(F||Y)return Rr.Transition.toString({...d,property:Lx});return}()}}function Ux(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 Vx=[Sv.Down,Sv.Right,Sv.Up,Sv.Left],Hx=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:a,over:i,scrollableAncestors:s}}=t;if(Vx.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 Sv.Down:o.top<a.top&&t.push(n);break;case Sv.Up:o.top>a.top&&t.push(n);break;case Sv.Left:o.left>a.left&&t.push(n);break;case Sv.Right:o.left<a.left&&t.push(n)}}));const l=(e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e;const r=$y(t),a=[];for(const i of o){const{id:e}=i,t=n.get(e);if(t){const n=$y(t),o=r.reduce(((e,t,o)=>e+Uy(n[o],t)),0),s=Number((o/4).toFixed(4));a.push({id:e,data:{droppableContainer:i,value:s}})}}return a.sort(Vy)})({active:n,collisionRect:o,droppableRects:r,droppableContainers:t,pointerCoordinates:null});let c=Wy(l,"id");if(c===(null==i?void 0:i.id)&&l.length>1&&(c=l[1].id),null!=c){const e=a.get(n.id),t=a.get(c),i=t?r.get(t.id):null,l=null==t?void 0:t.node.current;if(l&&i&&e&&t){const n=ov(l).some(((e,t)=>s[t]!==e)),r=$x(e,t),a=function(e,t){if(!Ux(e)||!Ux(t))return!1;if(!$x(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-i.width:0,y:a?o.height-i.height:0},d={x:i.left,y:i.top};return c.x&&c.y?d:gr(d,c)}}}};function $x(e,t){return!(!Ux(e)||!Ux(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Wx(...e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}const Gx=u.createContext(null),qx=r.memo((()=>r.useContext(Gx)));qx.displayName="DragHandle";const Yx=u.forwardRef(((e,t)=>{const n=S(35);let o,r,a,i,s;n[0]!==e?(({cellId:o,canMoveX: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?(i=o.toString(),n[4]=o,n[5]=i):i=n[5],n[6]!==i?(s={id:i},n[6]=i,n[7]=s):s=n[7];const{attributes:l,listeners:c,setNodeRef:d,transform:u,transition:h,isDragging:f}=Bx(s);let m;n[8]!==u||n[9]!==r?(m=u?Rr.Transform.toString({x:r?u.x:0,y:u.y,scaleX:1,scaleY:1}):void 0,n[8]=u,n[9]=r,n[10]=m):m=n[10];const p=f?2:void 0;let g;n[11]!==m||n[12]!==h||n[13]!==p?(g={transform:m,transition:h,zIndex:p,position:"relative"},n[11]=m,n[12]=h,n[13]=p,n[14]=g):g=n[14];const y=g;let v,x;n[15]===Symbol.for("react.memo_cache_sentinel")?(v=C.jsx(_c,{strokeWidth:1,size:20}),n[15]=v):v=n[15],n[16]!==l||n[17]!==c?(x=C.jsx("div",{...l,...c,onMouseDown:Ze.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:v}),n[16]=l,n[17]=c,n[18]=x):x=n[18];const b=x,w=Boolean(u);let k;n[19]!==t||n[20]!==d?(k=e=>{Wx(t,d)(e)},n[19]=t,n[20]=d,n[21]=k):k=n[21];const N=w&&"is-moving";let E,j,_;return n[22]!==a.className||n[23]!==N?(E=hn(a.className,N,"outline-offset-4 outline-primary/40 rounded-lg"),n[22]=a.className,n[23]=N,n[24]=E):E=n[24],n[25]!==b||n[26]!==a.children?(j=C.jsx(Gx.Provider,{value:b,children:a.children}),n[25]=b,n[26]=a.children,n[27]=j):j=n[27],n[28]!==k||n[29]!==a||n[30]!==f||n[31]!==E||n[32]!==y||n[33]!==j?(_=C.jsx("div",{tabIndex:-1,ref:k,...a,"data-is-dragging":f,className:E,style:y,children:j}),n[28]=k,n[29]=a,n[30]=f,n[31]=E,n[32]=y,n[33]=j,n[34]=_):_=n[34],_}));Yx.displayName="SortableCell";const Xx=r.memo(Yx),Kx=u.memo(u.forwardRef(((e,t)=>{const n=S(34);let o,a,i;n[0]!==e?(({children:i,showTooltip:o,...a}=e),n[0]=e,n[1]=o,n[2]=a,n[3]=i):(o=n[1],a=n[2],i=n[3]);const s=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=Wd(d),h=Lr();let f,m,p,g,y,v;if(n[6]===Symbol.for("react.memo_cache_sentinel")?(f=()=>({toggle:()=>c((e=>!e))}),n[6]=f):f=n[6],r.useImperativeHandle(t,f),n[7]===Symbol.for("react.memo_cache_sentinel")?(m=C.jsx(He,{placeholder:"Search actions...",className:"h-6 m-1"}),n[7]=m):m=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(p=C.jsx(We,{children:"No results"}),n[8]=p):p=n[8],n[9]!==u){let e;n[11]!==u.length?(e=(e,t)=>C.jsxs(r.Fragment,{children:[C.jsx(Pe,{children:e.map((e=>C.jsx(Fe,{onSelect:()=>{e.disableClick||(e.handle(),c(!1))},variant:e.variant,children:C.jsxs("div",{className:"flex items-center flex-1",children:[e.icon&&C.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:e.icon}),C.jsx("div",{className:"flex-1",children:e.label}),C.jsxs("div",{className:"flex-shrink-0 text-sm",children:[e.hotkey&&zr(e.hotkey),e.rightElement]})]})},e.label)))},t),t<u.length-1&&C.jsx(Le,{})]},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?(y=C.jsxs(vn,{children:[m,C.jsxs(Fr,{children:[p,g]})]}),n[13]=g,n[14]=y):y=n[14],n[15]!==h||n[16]!==y?(v=C.jsx(gn,{className:"w-[300px] p-0 pt-1",...h,children:y}),n[15]=h,n[16]=y,n[17]=v):v=n[17];const x=v;if(!s){let e,t;return n[18]!==i?(e=C.jsx(Br,{asChild:!0,children:i}),n[18]=i,n[19]=e):e=n[19],n[20]!==l||n[21]!==e||n[22]!==x?(t=C.jsxs(yn,{open:l,onOpenChange:c,children:[e,x]}),n[20]=l,n[21]=e,n[22]=x,n[23]=t):t=n[23],t}let b;n[24]===Symbol.for("react.memo_cache_sentinel")?(b=C.jsx(Ur,{tabIndex:-1,children:kt("cell.cellActions")}),n[24]=b):b=n[24];const w=!l&&b;let k,N,E;return n[25]!==i?(k=C.jsx(Vr,{children:C.jsx(Br,{className:"flex",children:i})}),n[25]=i,n[26]=k):k=n[26],n[27]!==w||n[28]!==k?(N=C.jsxs(Hr,{delayDuration:200,disableHoverableContent:!0,children:[w,k]}),n[27]=w,n[28]=k,n[29]=N):N=n[29],n[30]!==l||n[31]!==N||n[32]!==x?(E=C.jsxs(yn,{open:l,onOpenChange:c,children:[N,x]}),n[30]=l,n[31]=N,n[32]=x,n[33]=E):E=n[33],E}))),Jx=u.memo((e=>{const t=S(5),{children:n,cellId:o}=e;let r,a;t[0]!==o?(a=function(e){return H((t=>Qd(e,t(Z))))}(o),t[0]=o,t[1]=a):a=t[1],r=a;const i=ee(r);if(!i)return null;let s;return t[2]!==i||t[3]!==n?(s=C.jsx(Kx,{showTooltip:!1,...i,children:n}),t[2]=i,t[3]=n,t[4]=s):s=t[4],s}));Jx.displayName="ConnectionCellActionsDropdown";const Zx=({children:e,...t})=>{const n=Wd({cell:t}),[o,a]=u.useState(),i=[{label:"Copy",hidden:Boolean(o),icon:C.jsx(Qe,{size:13,strokeWidth:1.5}),handle:async()=>{var e;if(null==(e=window.getSelection())?void 0:e.toString())return void document.execCommand("copy");const n=document.getElementById(D.create(t.cellId));n?await Je(n.textContent??""):V.warn("cell-context-menu: output not found")}},{label:"Cut",hidden:Boolean(o),icon:C.jsx(Qc,{size:13,strokeWidth:1.5}),handle:()=>{document.execCommand("cut")}},{label:"Paste",hidden:Boolean(o),icon:C.jsx(gc,{size:13,strokeWidth:1.5}),handle:async()=>{const{getEditorView:e}=t,n=e();if(!n)return;const o=await navigator.clipboard.readText();if(o){const{from:e,to:t}=n.state.selection.main,r=n.state.update({changes:{from:e,to:t,insert:o}});n.dispatch(r)}}},{label:"Copy image",hidden:!o,icon:C.jsx(pc,{size:13,strokeWidth:1.5}),handle:async()=>{if(o){const e=await fetch(o.src),t=await e.blob(),n=new ClipboardItem({[t.type]:t});await navigator.clipboard.write([n]).then((()=>{K({title:"Copied image to clipboard"})})).catch((e=>{K({title:"Failed to copy image to clipboard. Try downloading instead.",description:e.message}),V.error("Failed to copy image to clipboard",e)}))}}},{icon:C.jsx(vl,{size:13,strokeWidth:1.5}),label:"Download image",hidden:!o,handle:()=>{if(o){const e=document.createElement("a");e.download="image.png",e.href=o.src,e.click()}}},{label:"Go to Definition",icon:C.jsx($r,{size:13,strokeWidth:1.5}),handle:()=>{const{getEditorView:e}=t,n=e();n&&Wr(n)}}];return C.jsxs(ly,{children:[C.jsx(cy,{onContextMenu:e=>{e.target instanceof HTMLImageElement?a(e.target):a(void 0)},asChild:!0,children:e}),C.jsx(hy,{className:"w-[300px]",children:[i,...n].map(((e,t)=>C.jsxs(r.Fragment,{children:[e.map((e=>e.hidden?null:C.jsx(fy,{onSelect:t=>{e.handle(t)},variant:e.variant,children:C.jsxs("div",{className:"flex items-center flex-1",children:[e.icon&&C.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:e.icon}),C.jsx("div",{className:"flex-1",children:e.label}),C.jsxs("div",{className:"flex-shrink-0 text-sm",children:[e.hotkey&&zr(e.hotkey),e.rightElement]})]})},e.label))),t<e.length-1&&C.jsx(my,{})]},t)))})]})},Qx=e=>{const t=S(24),{editorView:n,code:o,currentLanguageAdapter:r,onAfterToggle:a}=e;let i,s;t[0]!==o?(s=(new lr).isSupported(o)||""===o.trim(),t[0]=o,t[1]=s):s=t[1],i=s;const l=i;let c,d;t[2]!==o?(d=(new cr).isSupported(o)||""===o.trim(),t[2]=o,t[3]=d):d=t[3],c=d;const u=c&&"python"===r;let h,f;t[4]===Symbol.for("react.memo_cache_sentinel")?(h=C.jsx(pe,{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?(f=C.jsx(eb,{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]=f):f=t[9];const m=l&&"python"===r;let p,g,y,v,x;return t[10]===Symbol.for("react.memo_cache_sentinel")?(p=C.jsx(Fs,{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]!==m||t[14]!==a?(g=C.jsx(eb,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:m,icon:p,toType:"markdown",displayName:"Markdown",onAfterToggle:a}),t[11]=n,t[12]=r,t[13]=m,t[14]=a,t[15]=g):g=t[15],t[16]===Symbol.for("react.memo_cache_sentinel")?(y=C.jsx(Bs,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),t[16]=y):y=t[16],t[17]!==n||t[18]!==r?(v=C.jsx(eb,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:!0,icon:y,toType:"python",displayName:"Python",onAfterToggle:On.NOOP}),t[17]=n,t[18]=r,t[19]=v):v=t[19],t[20]!==f||t[21]!==g||t[22]!==v?(x=C.jsxs("div",{className:"absolute right-3 top-2 z-20 flex hover-action gap-1",children:[f,g,v]}),t[20]=f,t[21]=g,t[22]=v,t[23]=x):x=t[23],x},eb=e=>{const t=S(10),{editorView:n,currentLanguageAdapter:o,canSwitchToLanguage:r,icon:a,toType:i,displayName:s,onAfterToggle:l}=e;if(!r)return null;if(o===i)return null;const c=`View as ${s}`;let d,u,h;return t[0]!==n||t[1]!==i||t[2]!==l?(d=()=>{n&&(me(n,i),l())},t[0]=n,t[1]=i,t[2]=l,t[3]=d):d=t[3],t[4]!==d||t[5]!==a?(u=C.jsx(W,{"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=C.jsx(et,{content:c,children:u}),t[7]=c,t[8]=u,t[9]=h):h=t[9],h};var tb={modified:{doc:""},original:{doc:""}},nb=r.createContext(tb);function ob(e,t){return Po({},e,t,{modified:Po({},e.modified,t.modified),original:Po({},e.original,t.original)})}var rb=()=>r.useContext(nb),ab=e=>{var{children:t,theme:n}=e,[o,a]=r.useReducer(ob,Po({},tb,{theme:n}));return r.useEffect((()=>a({theme:n})),[n]),C.jsx(nb.Provider,{value:Po({},o,{dispatch:a}),children:t})},ib=["extensions","value","selection","onChange"],sb=e=>{var{extensions:t=[],value:n,selection:o,onChange:a}=e,i=Gr(e,ib),{theme:s,dispatch:l}=rb(),c=qr(Po({},i,{theme:s}));return r.useEffect((()=>l({original:{doc:n,selection:o,extensions:[...c,...t]},originalExtension:{onChange:a,option:i,extension:[t]}})),[e]),null};sb.displayName="CodeMirrorMerge.Original";var lb=["extensions","value","selection","onChange"],cb=e=>{var{extensions:t=[],value:n,selection:o,onChange:a}=e,i=Gr(e,lb),{theme:s,dispatch:l}=rb(),c=qr(Po({},i,{theme:s}));return r.useEffect((()=>{l({modified:{doc:n,selection:o,extensions:[...c,...t]},modifiedExtension:{onChange:a,option:i,extension:[t]}})}),[e]),null};cb.displayName="CodeMirrorMerge.Modified";class db{constructor(e,t,n,o){this.fromA=e,this.toA=t,this.fromB=n,this.toB=o}offset(e,t){return new db(this.fromA+e,this.toA+e,this.fromB+t,this.toB+t)}}function ub(e,t,n,o,r,a){if(e==o)return[];let i=vb(e,t,n,o,r,a),s=xb(e,t+i,n,o,r+i,a),l=(n-=s)-(t+=i),c=(a-=s)-(r+=i);if(!l||!c)return[new db(t,n,r,a)];if(l>c){let i=e.slice(t,n).indexOf(o.slice(r,a));if(i>-1)return[new db(t,t+i,r,r),new db(t+i+c,n,a,a)]}else if(c>l){let i=o.slice(r,a).indexOf(e.slice(t,n));if(i>-1)return[new db(t,t,r,r+i),new db(n,n,r+i+l,a)]}if(1==l||1==c)return[new db(t,n,r,a)];let d=wb(e,t,n,o,r,a);if(d){let[i,s,l]=d;return ub(e,t,i,o,r,s).concat(ub(e,i+l,n,o,s+l,a))}return function(e,t,n,o,r,a){let i=n-t,s=a-r;if(hb<1e9&&Math.min(i,s)>16*hb)return Math.min(i,s)>64*hb?[new db(t,n,r,a)]:kb(e,t,n,o,r,a);let l=Math.ceil((i+s)/2);mb.reset(l),pb.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=(i-s)%2!=0?pb:null,h=u?null:mb;for(let f=0;f<l;f++){if(f>hb)return kb(e,t,n,o,r,a);let m=mb.advance(f,i,s,l,u,!1,c)||pb.advance(f,i,s,l,h,!0,d);if(m)return gb(e,t,n,t+m[0],o,r,a,r+m[1])}return[new db(t,n,r,a)]}(e,t,n,o,r,a)}let hb=1e9;class fb{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,i){for(let s=-e+this.start;s<=e-this.end;s+=2){let l=o+s,c=s==-e||s!=e&&this.vec[l-1]<this.vec[l+1]?this.vec[l+1]:this.vec[l-1]+1,d=c-s;for(;c<t&&d<n&&i(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)-s;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 mb=new fb,pb=new fb;function gb(e,t,n,o,r,a,i,s){let l=!1;return Ob(e,o)||++o!=n||(l=!0),Ob(r,s)||++s!=i||(l=!0),l?[new db(t,n,a,i)]:ub(e,t,o,r,a,s).concat(ub(e,o,n,r,s,i))}function yb(e,t){let n=1,o=Math.min(e,t);for(;n<o;)n<<=1;return n}function vb(e,t,n,o,r,a){if(t==n||t==a||e.charCodeAt(t)!=o.charCodeAt(r))return 0;let i=yb(n-t,a-r);for(let s=t,l=r;;){let r=s+i,c=l+i;if(r>n||c>a||e.slice(s,r)!=o.slice(l,c)){if(1==i)return s-t-(Ob(e,s)?0:1);i>>=1}else{if(r==n||c==a)return r-t;s=r,l=c}}}function xb(e,t,n,o,r,a){if(t==n||r==a||e.charCodeAt(n-1)!=o.charCodeAt(a-1))return 0;let i=yb(n-t,a-r);for(let s=n,l=a;;){let a=s-i,c=l-i;if(a<t||c<r||e.slice(a,s)!=o.slice(c,l)){if(1==i)return n-s-(Ob(e,s)?0:1);i>>=1}else{if(a==t||c==r)return n-a;s=a,l=c}}}function bb(e,t,n,o,r,a,i,s){let l=o.slice(r,a),c=null;for(;;){if(c||i<s)return c;for(let s=t+i;;){Ob(e,s)||s++;let d=s+i;if(Ob(e,d)||(d+=d==s+1?1:-1),d>=n)break;let u=e.slice(s,d),h=-1;for(;-1!=(h=l.indexOf(u,h+1));){let i=vb(e,d,n,o,r+h+u.length,a),l=xb(e,t,s,o,r,r+h),f=u.length+i+l;(!c||c[2]<f)&&(c=[s-l,r+h-l,f])}s=d}if(s<0)return c;i>>=1}}function wb(e,t,n,o,r,a){let i=n-t,s=a-r;if(i<s){let i=wb(o,r,a,e,t,n);return i&&[i[1],i[0],i[2]]}return i<4||2*s<i?null:bb(e,t,n,o,r,a,Math.floor(i/4),-1)}function kb(e,t,n,o,r,a){let i,s=n-t,l=a-r;if(s<l){let l=bb(o,r,a,e,t,n,Math.floor(s/6),50);i=l&&[l[1],l[0],l[2]]}else i=bb(e,t,n,o,r,a,Math.floor(l/6),50);if(!i)return[new db(t,n,r,a)];let[c,d,u]=i;return ub(e,t,c,o,r,d).concat(ub(e,c+u,n,o,d+u,a))}function Sb(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 db(o.fromA,r.toA,o.fromB,r.toB),e.splice(n--,1))}}let Nb;try{Nb=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch(lB){}function Cb(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function Eb(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?Cb(n)?1:0:Nb?Ab(n)&&t!=e.length-1?Nb.test(e.slice(t,t+2))?2:0:Nb.test(String.fromCharCode(n))?1:0:0}function jb(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?Cb(n)?1:0:Nb?Mb(n)&&1!=t?Nb.test(e.slice(t-2,t))?2:0:Nb.test(String.fromCharCode(n))?1:0:0}function _b(e,t,n){if(t==e.length||!jb(e,t))return t;for(let o=t,r=t+n;;){let n=Eb(e,o);if(!n)return o;if(o+=n,o>r)return t}}function Ib(e,t,n){if(!t||!Eb(e,t))return t;for(let o=t,r=t-n;;){let n=jb(e,o);if(!n)return o;if(o-=n,o<r)return t}}function Tb(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 Ab=e=>e>=55296&&e<=56319,Mb=e=>e>=56320&&e<=57343;function Ob(e,t){return!t||t==e.length||!Ab(e.charCodeAt(t-1))||!Mb(e.charCodeAt(t))}function Db(e,t,n){var o;return hb=(null!==(o=null==n?void 0:n.scanLimit)&&void 0!==o?o:1e9)>>1,function(e,t,n){for(;;){Sb(n,1);let o=!1;for(let r=0;r<n.length;r++){let a,i,s=n[r];(a=vb(e,s.fromA,s.toA,t,s.fromB,s.toB))&&(s=n[r]=new db(s.fromA+a,s.toA,s.fromB+a,s.toB)),(i=xb(e,s.fromA,s.toA,t,s.fromB,s.toB))&&(s=n[r]=new db(s.fromA,s.toA-i,s.fromB,s.toB-i));let l=s.toA-s.fromA,c=s.toB-s.fromB;if(l&&c)continue;let d=s.fromA-(r?n[r-1].toA:0),u=(r<n.length-1?n[r+1].fromA:e.length)-s.toA;if(!d||!u)continue;let h=l?e.slice(s.fromA,s.toA):t.slice(s.fromB,s.toB);d<=h.length&&e.slice(s.fromA-d,s.fromA)==h.slice(h.length-d)?(n[r]=new db(s.fromA-d,s.toA-d,s.fromB-d,s.toB-d),o=!0):u<=h.length&&e.slice(s.toA,s.toA+u)==h.slice(0,u)&&(n[r]=new db(s.fromA+u,s.toA+u,s.fromB+u,s.toB+u),o=!0)}if(!o)break}return n}(e,t,ub(e,0,e.length,t,0,t.length))}function Pb(e,t,n){return function(e,t,n){for(let o=0,r=0;r<e.length;r++){let a=e[r],i=a.toA-a.fromA,s=a.toB-a.fromB;if(i&&s||i>3||s>3){let l=r==e.length-1?t.length:e[r+1].fromA,c=a.fromA-o,d=l-a.toA,u=Ib(t,a.fromA,Math.min(c,5)),h=_b(t,a.toA,Math.min(d,5)),f=a.fromA-u,m=h-a.toA;if(!i||!s){let d,p,g=Math.max(i,s),[y,v,x]=i?[t,a.fromA,a.toA]:[n,a.fromB,a.toB];f&&m?(g>f&&t.slice(u,a.fromA)==y.slice(x-f,x)?(a=e[r]=new db(u,u+i,a.fromB-f,a.toB-f),u=a.fromA,h=_b(t,a.toA,Math.min(l-a.toA,5))):g>m&&t.slice(a.toA,h)==y.slice(v,v+m)&&(a=e[r]=new db(h-i,h,a.fromB+m,a.toB+m),h=a.toA,u=Ib(t,a.fromA,Math.min(a.fromA-o,5))),f=a.fromA-u,m=h-a.toA):f||m||!(p=a.fromA-(d=Tb(t,a.fromA,c)))||t.slice(d,a.fromA)!=y.slice(x-p,x)||(a=e[r]=new db(d,d+i,a.fromB-p,a.toB-p))}(f||m)&&(a=e[r]=new db(a.fromA-f,a.toA+m,a.fromB-f,a.toB+m)),o=a.toA}}return Sb(e,3),e}(Db(e,t,n),e,t)}const Rb=Fn.define({combine:e=>e[0]}),Lb=en.define(),zb=tn.define({create:e=>null,update(e,t){for(let n of t.effects)n.is(Lb)&&(e=n.value);return e}});class Fb{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 Fb(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 Vb(Pb(e.toString(),t.toString(),n),e,t,0,0)}static updateA(e,t,n,o,r){return Gb(Wb(e,o,!0,n.length),e,t,n,r)}static updateB(e,t,n,o,r){return Gb(Wb(e,o,!1,t.length),e,t,n,r)}}function Bb(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 Ub(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 Vb(e,t,n,o,r){let a=[];for(let i=0;i<e.length;i++){let s=e[i],[l,c]=Bb(s.fromA+o,s.fromB+r,t,n),[d,u]=Ub(s.toA+o,s.toB+r,t,n),h=[s.offset(-l+o,-c+r)];for(;i<e.length-1;){let a=e[i+1],[s,f]=Bb(a.fromA+o,a.fromB+r,t,n);if(s>d+1&&f>u+1)break;h.push(a.offset(-l+o,-c+r)),[d,u]=Ub(a.toA+o,a.toB+r,t,n),i++}a.push(new Fb(h,l,Math.max(l,d),c,Math.max(c,u)))}return a}const Hb=1e3;function $b(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 i=t-(n?o:a);return[o+i,a+i]}let i=r+a>>1,s=e[i],[l,c]=n?[s.fromA,s.toA]:[s.fromB,s.toB];if(l>t)a=i;else{if(!(c<=t))return o?[s.fromA,s.fromB]:[s.toA,s.toB];r=i+1}}}function Wb(e,t,n,o){let r=[];return t.iterChangedRanges(((a,i,s,l)=>{let c=0,d=n?t.length:o,u=0,h=n?o:t.length;a>Hb&&([c,u]=$b(e,a-Hb,n,!0)),i<t.length-Hb&&([d,h]=$b(e,i+Hb,n,!1));let f,m=l-s-(i-a),[p,g]=n?[m,0]:[0,m];r.length&&(f=r[r.length-1]).toA>=c?r[r.length-1]={fromA:f.fromA,fromB:f.fromB,toA:d,toB:h,diffA:f.diffA+p,diffB:f.diffB+g}:r.push({fromA:c,toA:d,fromB:u,toB:h,diffA:p,diffB:g})})),r}function Gb(e,t,n,o,r){if(!e.length)return t;let a=0,i=0,s=0,l=[];for(let c of e){let e=c.fromA+i,d=c.toA+i+c.diffA,u=c.fromB+s,h=c.toB+s+c.diffB;for(;a<t.length;){let n=t[a];if(n.toA+i<=e&&n.toB+s<=u)l.push(n.offset(i,s));else if(n.fromA+i>d)break;a++}for(let t of Vb(Pb(n.sliceString(e,d),o.sliceString(u,h),r),n,o,e,u))l.push(t);for(i+=c.diffA,s+=c.diffB;a<t.length;){let e=t[a];if(e.fromA>d+i&&e.fromB>h+s)break;a++}}for(;a<t.length;)l.push(t[a++].offset(i,s));return l}const qb=on.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=tw(e))}update(e){var t,n;(e.docChanged||e.viewportChanged||(t=e.startState,n=e.state,t.field(zb,!1)!=n.field(zb,!1))||function(e,t){return e.facet(Rb)!=t.facet(Rb)}(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=tw(e.view))}},{decorations:e=>e.deco}),Yb=Ln.low(Yr({class:"cm-changeGutter",markers:e=>{var t;return(null===(t=e.plugin(qb))||void 0===t?void 0:t.gutter)||Xr.empty}}));const Xb=nn.line({class:"cm-changedLine"}),Kb=nn.mark({class:"cm-changedText"}),Jb=nn.mark({tagName:"ins",class:"cm-insertedLine"}),Zb=nn.mark({tagName:"del",class:"cm-deletedLine"}),Qb=new class extends Zr{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function ew(e,t,n,o,r,a){let i=n?e.fromA:e.fromB,s=n?e.toA:e.toB,l=0;if(i!=s){r.add(i,i,Xb),r.add(i,s,n?Zb:Jb),a&&a.add(i,i,Qb);for(let c=t.iterRange(i,s-1),d=i;!c.next().done;){if(c.lineBreak){d++,r.add(d,d,Xb),a&&a.add(d,d,Qb);continue}let t=d+c.value.length;if(o)for(;l<e.changes.length;){let o=e.changes[l],a=i+(n?o.fromA:o.fromB),s=i+(n?o.toA:o.toB),c=Math.max(d,a),u=Math.min(t,s);if(c<u&&r.add(c,u,Kb),!(s<t))break;l++}d=t}}}function tw(e){let t=e.state.field(zb),{side:n,highlightChanges:o,markGutter:r}=e.state.facet(Rb),a="a"==n,i=new rn,s=r?new rn: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&&ew(d,e.state.doc,a,o,i,s)}return{deco:i.finish(),gutter:s&&s.finish()}}class nw extends zn{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 ow=en.define({map:(e,t)=>e.map(t)}),rw=tn.define({create:()=>nn.none,update:(e,t)=>{for(let n of t.effects)if(n.is(ow))return n.value;return e.map(t.changes)},provide:e=>Qt.decorations.from(e)}),aw=.01;const iw=en.define({map:(e,t)=>t.mapPos(e)});class sw extends zn{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:iw.of(n)});let{side:o,sibling:r}=e.state.facet(Rb);r&&r().dispatch({effects:iw.of(lw(n,e.state.field(zb),"a"==o))})})),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}}function lw(e,t,n){let o=0,r=0;for(let a=0;;a++){let i=a<t.length?t[a]:null;if(!i||(n?i.fromA:i.fromB)>=e)return r+(e-o);[o,r]=n?[i.toA,i.toB]:[i.toB,i.toA]}}const cw=tn.define({create:e=>nn.none,update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(iw)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>Qt.decorations.from(e)});function dw({margin:e=3,minSize:t=4}){return cw.init((n=>function(e,t,n){let o=new rn,r="a"==e.facet(Rb).side,a=e.field(zb),i=1;for(let s=0;;s++){let l=s<a.length?a[s]:null,c=s?i+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,nn.replace({widget:new sw(u),block:!0})),!l)break;i=e.doc.lineAt(Math.min(e.doc.length,r?l.toA:l.toB)).number}return o.finish()}(n,e,t)))}const uw=Qt.styleModule.of(new Kr({".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"}})),hw=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"}}),fw=new Jr,mw=new Jr;class pw{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig;let t=[Ln.low(qb),hw,uw,rw,Qt.updateListener.of((e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some((e=>e.effects.some((e=>e.is(ow)))))&&this.measure()}))],n=[Rb.of({side:"a",sibling:()=>this.b,highlightChanges:!1!==e.highlightChanges,markGutter:!1!==e.gutter})];!1!==e.gutter&&n.push(Yb);let o=Eo.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Qt.editorAttributes.of({class:"cm-merge-a"}),mw.of(n),t]}),r=[Rb.of({side:"b",sibling:()=>this.a,highlightChanges:!1!==e.highlightChanges,markGutter:!1!==e.gutter})];!1!==e.gutter&&r.push(Yb);let a=Eo.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Qt.editorAttributes.of({class:"cm-merge-b"}),mw.of(r),t]});this.chunks=Fb.build(o.doc,a.doc,this.diffConf);let i=[zb.init((()=>this.chunks)),fw.of(e.collapseUnchanged?dw(e.collapseUnchanged):[])];o=o.update({effects:en.appendConfig.of(i)}).state,a=a.update({effects:en.appendConfig.of(i)}).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 s=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"==s?l:c),this.editorDOM.appendChild("a-b"==s?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)),Hn.empty(e[0].startState.doc.length));this.chunks=t==this.a?Fb.updateA(this.chunks,n.newDoc,this.b.state.doc,o,this.diffConf):Fb.updateB(this.chunks,this.a.state.doc,n.newDoc,o,this.diffConf),t.update([...e,n.state.update({effects:Lb.of(this.chunks)})]);let r=t==this.a?this.b:this.a;r.update([r.state.update({effects:Lb.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(Rb),i=n?!1!==e.gutter:o.markGutter,s=t?!1!==e.highlightChanges:o.highlightChanges;r.push(mw.reconfigure([Rb.of({side:"a",sibling:()=>this.b,highlightChanges:s,markGutter:i}),i?Yb:[]])),a.push(mw.reconfigure([Rb.of({side:"b",sibling:()=>this.a,highlightChanges:s,markGutter:i}),i?Yb:[]]))}if(o){let t=fw.reconfigure(e.collapseUnchanged?dw(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 rn,r=new rn,a=e.state.field(rw).iter(),i=t.state.field(rw).iter(),s=0,l=0,c=0,d=0;for(let m=0;;m++){let u=m<n.length?n[m]:null;if(s<(u?u.fromA:e.state.doc.length)){let n=e.lineBlockAt(s).top+c-(t.lineBlockAt(l).top+d);n<-.01?(c-=n,o.add(s,s,nn.widget({widget:new nw(-n),block:!0,side:-1}))):n>aw&&(d+=n,r.add(l,l,nn.widget({widget:new nw(n),block:!0,side:-1})))}if(!u)break;for(s=u.toA,l=u.toB;a.value&&a.from<s;)c-=a.value.spec.widget.height,a.next();for(;i.value&&i.from<l;)d-=i.value.spec.widget.height,i.next()}for(;a.value;)c-=a.value.spec.widget.height,a.next();for(;i.value;)d-=i.value.spec.widget.height,i.next();let u=e.contentHeight+c-(t.contentHeight+d);u<aw?o.add(e.state.doc.length,e.state.doc.length,nn.widget({widget:new nw(-u),block:!0,side:1})):u>aw&&r.add(t.state.doc.length,t.state.doc.length,nn.widget({widget:new nw(u),block:!0,side:1}));let h=o.finish(),f=r.finish();Xr.eq([h],[e.state.field(rw)])||e.dispatch({effects:ow.of(h)}),Xr.eq([f],[t.state.field(rw)])||t.dispatch({effects:ow.of(f)})}(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 i=this.a.lineBlockAt(a.fromA).top+"px";for(;t&&+t.dataset.chunk<r;)t=gw(t);t&&t.dataset.chunk==String(r)?(t.style.top!=i&&(t.style.top=i),t=t.nextSibling):e.insertBefore(this.renderRevertButton(i,r),t)}for(;t;)t=gw(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,i,s]=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&&s<=o.state.doc.length&&(l+=n.state.lineBreak),o.dispatch({changes:{from:i,to:Math.min(o.state.doc.length,s),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 gw(e){let t=e.nextSibling;return e.remove(),t}var yw=["className","children","orientation","revertControls","highlightChanges","gutter","collapseUnchanged","destroyRerender","renderRevertControl"],vw=["modified","modifiedExtension","original","originalExtension","theme","dispatch"],xw=u.forwardRef(((e,t)=>{var{className:n,children:o,orientation:a,revertControls:i,highlightChanges:s,gutter:l,collapseUnchanged:c,destroyRerender:d=!0,renderRevertControl:u}=e,h=Gr(e,yw),f=rb(),{modified:m,modifiedExtension:p,original:g,originalExtension:y,theme:v,dispatch:x}=f,b=Gr(f,vw),w=r.useRef(null),k=r.useRef(),S={orientation:a,revertControls:i,highlightChanges:s,gutter:l,collapseUnchanged:c,renderRevertControl:u};r.useImperativeHandle(t,(()=>({container:w.current,view:k.current,modified:m,original:g,config:Po({a:g,b:m,parent:w.current},S)})),[w,k,m,g,S]);var N=Qt.updateListener.of((e=>{if(e.docChanged&&"function"==typeof(null==y?void 0:y.onChange)){var t=e.state.doc.toString();null==y||y.onChange(t,e)}})),E=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((()=>{!k.current&&w.current&&y&&p&&(k.current=new pw(Po({a:Po({},g,{extensions:[...(null==y?void 0:y.extension)||[],...qr(Po({},null==y?void 0:y.option,{theme:v})),N]}),b:Po({},m,{extensions:[...(null==p?void 0:p.extension)||[],...qr(Po({},null==p?void 0:p.option,{theme:v})),E]}),parent:w.current},S)),x({view:k.current}))}),[k,w,y,p]),r.useEffect((()=>{if(g&&g.doc&&k.current){var e,t,n=null==(e=k.current)?void 0:e.a.state.doc.toString();if(n!==g.doc)null==(t=k.current)||t.a.dispatch({changes:{from:0,to:n.length,insert:g.doc||""}})}if(m&&m.doc&&k.current){var o,r,a=null==(o=k.current)?void 0:o.b.state.doc.toString();if(a!==m.doc)null==(r=k.current)||r.b.dispatch({changes:{from:0,to:a.length,insert:m.doc||""}})}if(d&&k.current){var i=k.current.a.state.selection.ranges[0].from,s=k.current.b.state.selection.ranges[0].from;k.current.destroy(),k.current=new pw(Po({a:Po({},g,{extensions:[...(null==y?void 0:y.extension)||[],...qr(Po({},null==y?void 0:y.option,{theme:v}))]}),b:Po({},m,{extensions:[...(null==p?void 0:p.extension)||[],...qr(Po({},null==p?void 0:p.option,{theme:v}))]}),parent:w.current},S)),i&&(k.current.a.focus(),k.current.a.dispatch({selection:{anchor:i,head:i}})),s&&(k.current.b.focus(),k.current.b.dispatch({selection:{anchor:s,head:s}}))}}),[k,v,w.current,g,m,y,p,d]),r.useEffect((()=>()=>k.current&&k.current.destroy()),[]),r.useEffect((()=>{if(k.current){var e={};b.orientation!==a&&(e.orientation=a),b.revertControls!==i&&(e.revertControls=i),b.highlightChanges!==s&&(e.highlightChanges=s),b.gutter!==l&&(e.gutter=l),b.collapseUnchanged!==c&&(e.collapseUnchanged=c),b.renderRevertControl!==u&&(e.collapseUnchanged=c),Object.keys(e).length&&x&&k.current&&(k.current.reconfigure(Po({},e)),x(Po({},e)))}}),[x,k,a,i,s,l,c,u]);return C.jsx("div",Po({ref:w,className:"cm-merge-theme"+(n?" "+n:"")},h,{children:o}))}));xw.displayName="CodeMirrorMerge.Internal";var bw=["theme"],ww=u.forwardRef(((e,t)=>{var{theme:n}=e,o=Gr(e,bw);return C.jsx(ab,{theme:n,children:C.jsx(xw,Po({},o,{ref:t}))})}));function kw(e){return void 0===e&&(e=[]),Qr({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 Sw(e){const t=function(e){const t=q.get(ea),n=ta.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 V.debug("Included datasets",t),{includeOtherCode:Zs(""),context:{schema:t.map((e=>({name:e.name,columns:e.columns.map((e=>({name:e.name,type:e.type,sampleValues:e.sample_values})))})))}}}ww.Original=sb,ww.Modified=cb,ww.displayName="CodeMirrorMerge",kw();const Nw=[na(),Qt.lineWrapping],Cw=[oa(),Qt.lineWrapping],Ew=ra("marimo:ai-language","python"),jw=e=>{const t=S(65),{onClose:n}=e,{createNewCell:o}=L();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a={},t[0]=a):a=t[0];const[i,s]=r.useState(a),[l,c]=Me(Ew),{theme:d}=je();let u,h,f;t[1]===Symbol.for("react.memo_cache_sentinel")?(u=aa("api/ai/completion").toString(),h=ia.headers(),t[1]=u,t[2]=h):(u=t[1],h=t[2]),t[3]!==i||t[4]!==l?(f={api:u,headers:h,streamMode:"text",body:{...i,language:l,code:""},onError:Iw},t[3]=i,t[4]=l,t[5]=f):f=t[5];const{completion:m,input:p,stop:g,isLoading:y,setCompletion:v,setInput:x,handleSubmit:b}=sa(f);let w;t[6]===Symbol.for("react.memo_cache_sentinel")?(w=C.jsx(nd,{className:"size-4 text-[var(--blue-11)]"}),t[6]=w):w=t[6];const k="python"===l?"Python":"SQL";let N,E,j,_,I,T,A,M,O,D,P,R,z,F,B;t[7]===Symbol.for("react.memo_cache_sentinel")?(N=C.jsx(da,{className:"ml-1 h-3.5 w-3.5 text-muted-foreground/70"}),t[7]=N):N=t[7],t[8]!==k?(E=C.jsx(Ft,{asChild:!0,children:C.jsxs(W,{variant:"text",className:"ml-2",size:"xs","data-testid":"language-button",children:[k,N]})}),t[8]=k,t[9]=E):E=t[9],t[10]!==c?(j=C.jsx(zt,{onClick:()=>c("python"),children:"Python"}),t[10]=c,t[11]=j):j=t[11],t[12]!==c?(_=C.jsx(zt,{onClick:()=>c("sql"),children:"SQL"}),t[12]=c,t[13]=_):_=t[13],t[14]!==j||t[15]!==_?(I=C.jsxs(Gt,{align:"center",children:[j,_]}),t[14]=j,t[15]=_,t[16]=I):I=t[16],t[17]!==E||t[18]!==I?(T=C.jsxs(Wt,{modal:!1,children:[E,I]}),t[17]=E,t[18]=I,t[19]=T):T=t[19],t[20]!==v||t[21]!==n?(A=()=>{v(""),n()},t[20]=v,t[21]=n,t[22]=A):A=t[22],t[23]!==x?(M=e=>{x(e),s(Sw(e))},t[23]=x,t[24]=M):M=t[24],t[25]!==y||t[26]!==b?(O=()=>{y||b()},t[25]=y,t[26]=b,t[27]=O):O=t[27],t[28]!==d||t[29]!==A||t[30]!==p||t[31]!==M||t[32]!==O?(D=C.jsx(_w,{theme:d,onClose:A,value:p,onChange:M,onSubmit:O}),t[28]=d,t[29]=A,t[30]=p,t[31]=M,t[32]=O,t[33]=D):D=t[33],t[34]!==y||t[35]!==g?(P=y&&C.jsxs(W,{"data-testid":"stop-completion-button",variant:"text",size:"sm",className:"mb-0",onClick:g,children:[C.jsx(ua,{className:"animate-spin mr-1",size:14}),"Stop"]}),t[34]=y,t[35]=g,t[36]=P):P=t[36],t[37]!==y||t[38]!==m||t[39]!==o||t[40]!==l||t[41]!==v||t[42]!==n?(R=!y&&m&&C.jsx(W,{"data-testid":"accept-completion-button",variant:"text",size:"sm",className:"mb-0",disabled:y,onClick:()=>{o({cellId:"__end__",before:!1,code:"python"===l?m:cr.fromQuery(m)}),v(""),n()},children:C.jsx("span",{className:"text-[var(--grass-11)] opacity-100",children:"Accept"})}),t[37]=y,t[38]=m,t[39]=o,t[40]=l,t[41]=v,t[42]=n,t[43]=R):R=t[43],t[44]===Symbol.for("react.memo_cache_sentinel")?(z=C.jsx(sn,{className:"size-4"}),t[44]=z):z=t[44],t[45]!==n?(F=C.jsx(W,{variant:"text",size:"sm",className:"mb-0",onClick:n,children:z}),t[45]=n,t[46]=F):F=t[46],t[47]!==T||t[48]!==D||t[49]!==P||t[50]!==R||t[51]!==F?(B=C.jsxs("div",{className:"flex items-center px-3",children:[w,T,D,P,R,F]}),t[47]=T,t[48]=D,t[49]=P,t[50]=R,t[51]=F,t[52]=B):B=t[52];const U=B;let V,H,$,G;return t[53]===Symbol.for("react.memo_cache_sentinel")?(V=hn("flex flex-col w-full gap-2 py-2"),t[53]=V):V=t[53],t[54]!==m?(H=!m&&C.jsxs("span",{className:"text-xs text-muted-foreground px-3 flex flex-col gap-1",children:[C.jsxs("span",{children:["You can mention"," ",C.jsx("span",{className:"text-[var(--cyan-11)]",children:"@dataframe"})," or"," ",C.jsx("span",{className:"text-[var(--cyan-11)]",children:"@sql_table"})," to pull additional context such as column names."]}),C.jsx("span",{children:"Code from other cells is automatically included."})]}),t[54]=m,t[55]=H):H=t[55],t[56]!==m||t[57]!==d||t[58]!==l||t[59]!==v?($=m&&C.jsx(ha,{value:m,className:"cm border-t",onChange:v,theme:"dark"===d?"dark":"light",extensions:"python"===l?Nw:Cw}),t[56]=m,t[57]=d,t[58]=l,t[59]=v,t[60]=$):$=t[60],t[61]!==U||t[62]!==H||t[63]!==$?(G=C.jsxs("div",{className:V,children:[U,H,$]}),t[61]=U,t[62]=H,t[63]=$,t[64]=G):G=t[64],G},_w=e=>{const t=S(24),{value:n,placeholder:o,inputRef:r,className:a,onChange:i,onSubmit:s,onClose:l,theme:c}=e,d=s,u=l,h=ee(ea);let f,m,p,g,y,v,x,b;if(t[0]!==h){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];m=kw(h.map(e)),t[0]=h,t[1]=m}else m=t[1];t[3]===Symbol.for("react.memo_cache_sentinel")?(p=la(),t[3]=p):p=t[3],t[4]!==d?(g=Ln.highest(Dn.of([{preventDefault:!0,stopPropagation:!0,any:(e,t)=>{const n=t.metaKey||t.ctrlKey||t.shiftKey;if("Enter"===t.key&&!n)return d(t,e.state.doc.toString()),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]=d,t[5]=g):g=t[5],t[6]!==u?(y=Dn.of([{key:"Escape",preventDefault:!0,stopPropagation:!0,run:()=>(u(),!0)}]),t[6]=u,t[7]=y):y=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(v=Dn.of([{key:"ArrowUp",preventDefault:!0,stopPropagation:!0}]),x=Dn.of([{key:"ArrowDown",preventDefault:!0,stopPropagation:!0}]),t[8]=v,t[9]=x):(v=t[8],x=t[9]),t[10]!==m||t[11]!==g||t[12]!==y?(b=[m,Qt.lineWrapping,p,g,y,v,x],t[10]=m,t[11]=g,t[12]=y,t[13]=b):b=t[13],f=b;const w=f;let k;t[14]!==a?(k=hn("flex-1 font-sans overflow-auto my-1",a),t[14]=a,t[15]=k):k=t[15];const N="dark"===c?"dark":"light",E=o||"Generate with AI";let j;return t[16]!==r||t[17]!==k||t[18]!==n||t[19]!==w||t[20]!==i||t[21]!==N||t[22]!==E?(j=C.jsx(ha,{ref:r,className:k,autoFocus:!0,width:"100%",value:n,basicSetup:!1,extensions:w,onChange:i,theme:N,placeholder:E}),t[16]=r,t[17]=k,t[18]=n,t[19]=w,t[20]=i,t[21]=N,t[22]=E,t[23]=j):j=t[23],j};function Iw(e){K({title:"Generate with AI failed",description:ca(e)})}const Tw=ww.Original,Aw=ww.Modified,Mw=[na(),Qt.lineWrapping],Ow=e=>{const t=S(56),{className:n,onChange:o,initialPrompt:a,currentLanguageAdapter:i,currentCode:s,declineChange:l,acceptChange:c,enabled:d,children:h}=e;let f;t[0]===Symbol.for("react.memo_cache_sentinel")?(f={},t[0]=f):f=t[0];const[m,p]=r.useState(f),[g,y]=Me(zd);let v,x,b,w,k;t[1]===Symbol.for("react.memo_cache_sentinel")?(v=aa("api/ai/completion").toString(),x=ia.headers(),t[1]=v,t[2]=x):(v=t[1],x=t[2]),t[3]!==g||t[4]!==s?(b=g?Zs(s):"",t[3]=g,t[4]=s,t[5]=b):b=t[5],t[6]!==m||t[7]!==b||t[8]!==s||t[9]!==i?(w={...m,includeOtherCode:b,code:s,language:i},t[6]=m,t[7]=b,t[8]=s,t[9]=i,t[10]=w):w=t[10],t[11]!==a||t[12]!==w?(k={api:v,headers:x,initialInput:a,streamMode:"text",body:w,onError:Dw},t[11]=a,t[12]=w,t[13]=k):k=t[13];const{completion:N,input:E,stop:j,isLoading:_,setCompletion:I,setInput:T,handleSubmit:A}=sa(k),M=u.useRef(null);let O,D,P,R;t[14]!==d?(O=()=>{const e=M.current;d&&e&&(requestAnimationFrame((()=>{var t;null==(t=e.view)||t.focus()})),fa(M.current.view))},D=[d],t[14]=d,t[15]=O,t[16]=D):(O=t[15],D=t[16]),r.useEffect(O,D),t[17]!==d||t[18]!==T||t[19]!==a?(P=()=>{d&&T(a||"")},R=[d,a,T],t[17]=d,t[18]=T,t[19]=a,t[20]=P,t[21]=R):(P=t[20],R=t[21]),r.useEffect(P,R);const{theme:L}=je();let z;t[22]!==n?(z=hn("flex flex-col w-full rounded-[inherit] overflow-hidden",n),t[22]=n,t[23]=z):z=t[23];const F=d&&"max-h-[400px] min-h-11 visible",B=!d&&"max-h-0 min-h-0 invisible";let U,V,H,$;t[24]!==F||t[25]!==B?(U=hn("flex items-center gap-2 border-b px-3 transition-all rounded-[inherit] rounded-b-none duration-300 overflow-hidden",F,B),t[24]=F,t[25]=B,t[26]=U):U=t[26],t[27]!==d||t[28]!==l||t[29]!==I||t[30]!==T||t[31]!==_||t[32]!==A||t[33]!==M||t[34]!==L||t[35]!==E||t[36]!==j||t[37]!==N||t[38]!==c||t[39]!==y||t[40]!==g?(V=d&&C.jsxs(C.Fragment,{children:[C.jsx(nd,{className:"text-[var(--blue-10)] flex-shrink-0",size:16}),C.jsx(_w,{inputRef:M,theme:L,onClose:()=>{l(),I("")},value:E,onChange:e=>{T(e),p(Sw(e))},onSubmit:()=>{_||A()}}),_&&C.jsxs(W,{"data-testid":"stop-completion-button",variant:"text",size:"xs",className:"mb-0",onClick:j,children:[C.jsx(ua,{className:"animate-spin mr-1",size:14}),"Stop"]}),!_&&N&&C.jsx(W,{"data-testid":"accept-completion-button",variant:"text",size:"xs",className:"mb-0",disabled:_,onClick:()=>{c(N),I("")},children:C.jsx("span",{className:"text-[var(--grass-11)] opacity-100",children:"Accept"})}),C.jsx("div",{className:"h-full w-px bg-border mx-2"}),C.jsx(et,{content:"Include code from other cells",children:C.jsxs("div",{className:"flex flex-row items-start gap-1 overflow-hidden",children:[C.jsx(ma,{"data-testid":"include-other-cells-checkbox",id:"include-other-cells",checked:g,onCheckedChange:e=>y(Boolean(e))}),C.jsx(Ce,{htmlFor:"include-other-cells",className:"text-muted-foreground text-xs whitespace-nowrap ellipsis",children:"Include all code"})]})}),C.jsx(W,{"data-testid":"decline-completion-button",variant:"text",size:"icon",disabled:_,onClick:()=>{j(),l(),I("")},children:C.jsx(sn,{className:"text-[var(--red-10)]",size:16})})]}),t[27]=d,t[28]=l,t[29]=I,t[30]=T,t[31]=_,t[32]=A,t[33]=M,t[34]=L,t[35]=E,t[36]=j,t[37]=N,t[38]=c,t[39]=y,t[40]=g,t[41]=V):V=t[41],t[42]!==U||t[43]!==V?(H=C.jsx("div",{className:U,children:V}),t[42]=U,t[43]=V,t[44]=H):H=t[44],t[45]!==N||t[46]!==d||t[47]!==o||t[48]!==s||t[49]!==L?($=N&&d&&C.jsxs(ww,{className:"cm",theme:L,children:[C.jsx(Tw,{onChange:o,value:s,extensions:Mw}),C.jsx(Aw,{value:N,editable:!1,readOnly:!0,extensions:Mw})]}),t[45]=N,t[46]=d,t[47]=o,t[48]=s,t[49]=L,t[50]=$):$=t[50];const G=(!N||!d)&&h;let q;return t[51]!==z||t[52]!==H||t[53]!==$||t[54]!==G?(q=C.jsxs("div",{className:z,children:[H,$,G]}),t[51]=z,t[52]=H,t[53]=$,t[54]=G,t[55]=q):q=t[55],q};function Dw(e){K({title:"Completion failed",description:ca(e)})}const Pw=u.forwardRef(((e,t)=>{const n=S(10),{className:o,editorView:a}=e,i=r.useRef(null);let s,l,c,d,u;return n[0]!==a?(s=()=>{null!==a&&null!==i.current&&0===i.current.children.length&&i.current.append(a.dom)},l=[a,i],n[0]=a,n[1]=s,n[2]=l):(s=n[1],l=n[2]),r.useEffect(s,l),n[3]!==o?(c=hn("cm",o),n[3]=o,n[4]=c):c=n[4],n[5]!==t?(d=e=>{t?Wx(t,i)(e):Wx(i)(e)},n[5]=t,n[6]=d):d=n[6],n[7]!==c||n[8]!==d?(u=C.jsx("div",{className:c,ref:d,"data-testid":"cell-editor"}),n[7]=c,n[8]=d,n[9]=u):u=n[9],u}));Pw.displayName="CellCodeMirrorEditor";const Rw=r.memo((({theme:e,showPlaceholder:t,allowFocus:n,id:o,config:a,code:i,status:s,serializedEditorState:l,setEditorView:c,runCell:d,updateCellCode:u,createNewCell:h,deleteCell:f,focusCell:m,moveCell:p,moveToNextCell:g,updateCellConfig:y,clearSerializedEditorState:v,userConfig:x,editorViewRef:b,editorViewParentRef:w,hidden:k,temporarilyShowCode:N,languageAdapter:E,setLanguageAdapter:j})=>{var _;const[I,T]=Me(Ld),A=function(){const e=S(2),t=ne(Kd);let n;return e[0]!==t?(n=e=>{Ee!==e&&t(e)},e[0]=t,e[1]=n):n=e[1],n}(),M="running"===s||"queued"===s,{sendToTop:O,sendToBottom:D}=L(),P=function(){const e=S(3),{splitCell:t,undoSplitCell:n}=L();let o;return e[0]!==t||e[1]!==n?(o=e=>{const o=pa(e.cellId),r=(null==o?void 0:o.state.doc.toString())??"";t(e);const{dismiss:a}=K({title:"Cell split",action:C.jsx(Ud,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...e,snapshot:r}),i()},children:"Undo"})}),i=a},e[0]=t,e[1]=n,e[2]=o):o=e[2],R(o)}(),z="markdown"===E,F=R((()=>!M&&(f({cellId:o}),!0))),B=r.useCallback((()=>h({cellId:o,before:!1})),[o,h]),U=r.useCallback((()=>h({cellId:o,before:!0})),[o,h]),V=r.useCallback((()=>p({cellId:o,before:!1})),[o,p]),H=r.useCallback((()=>p({cellId:o,before:!0})),[o,p]),$=r.useCallback((()=>m({cellId:o,before:!1})),[o,m]),W=r.useCallback((()=>m({cellId:o,before:!0})),[o,m]),G=R((()=>{const e=!a.hide_code;return we({configs:{[o]:{hide_code:e}}}),y({cellId:o,config:{hide_code:e}}),e})),q=ee(re),Y=R((()=>{$d(q,h)})),X=ga(x),J=r.useMemo((()=>{const n=(e=>{const{cellId:t,cellMovementCallbacks:n,cellCodeCallbacks:o,keymapConfig:r,hotkeys:a}=e;return[rl(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(),Jn(t,r),!0;if(null==r?void 0:r.type.startsWith("image/"))return e.preventDefault(),Zn(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()}})],Vg(),Ug(),to(t,n,a),no(t,o,a),Hg(e),[Rg,(i=(e,t)=>{qn(e,t)},on.define((e=>new Lg(e,i)))),Qt.baseTheme({".underline":{textDecoration:"underline",cursor:"pointer",color:"var(--link)"}})]];var i})({cellId:o,showPlaceholder:t,enableAI:X,cellCodeCallbacks:{updateCellCode:u,afterToggleMarkdown:Y},cellMovementCallbacks:{onRun:d,deleteCell:F,createAbove:U,createBelow:B,createManyBelow:e=>{for(const t of[...e].reverse())h({code:t,before:!1,cellId:o,skipIfCodeExists:!0})},moveUp:H,moveDown:V,focusUp:W,focusDown:$,sendToTop:O,sendToBottom:D,splitCell:P,moveToNextCell:g,toggleHideCode:G,aiCellCompletion:()=>{let e=!1;return T((t=>(null==t?void 0:t.cellId)===o?(e=!0,null):{cellId:o})),e}},completionConfig:x.completion,keymapConfig:x.keymap,theme:e,hotkeys:new ya(x.keymap.overrides??{})});return n.push(on.define((e=>{const t=e.state.field(va);return j(t.type),{update(e){const t=e.state.field(va);j(t.type)}}}))),n}),[o,x.keymap,x.completion,X,e,t,U,B,W,$,H,V,g,O,D,P,G,u,F,d,T,Y,j]),Z=R((()=>{const e=new Qt({state:Eo.create({doc:i,extensions:J})});c(e),me(e,xa(e.state).type)})),Q=R((()=>{Xt(null!==b.current,"Editor view is not initialized"),b.current.dispatch({effects:[en.reconfigure.of([J]),ba(b.current,x.completion,new ya(x.keymap.overrides??{}))]})})),te=R((()=>{Xt(l,"Editor view is not initialized");const e=new Qt({state:Eo.fromJSON(l,{doc:i,extensions:J},{history:wa})});me(e,xa(e.state).type),c(e),v({cellId:o})}));r.useEffect((()=>{null===l?null===b.current?Z():Q():te(),null!==b.current&&w&&null!==w.current&&w.current.replaceChildren(b.current.dom)}),[Z,Q,te,b,w,l,J]);const oe=null===b.current||null!==l;return r.useEffect((()=>{oe&&n&&requestAnimationFrame((()=>{var e,t;null==(e=b.current)||e.focus(),null==(t=b.current)||t.dom.scrollIntoView({behavior:"smooth",block:"nearest"})}))}),[oe,n,b]),r.useEffect((()=>{const e=b.current;return()=>{null==e||e.destroy()}}),[b]),C.jsx(Ow,{enabled:(null==I?void 0:I.cellId)===o,initialPrompt:null==I?void 0:I.initialPrompt,currentCode:(null==(_=b.current)?void 0:_.state.doc.toString())??i,currentLanguageAdapter:E,declineChange:R((()=>{var e;T(null),null==(e=b.current)||e.focus()})),onChange:R((e=>{var t;null==(t=b.current)||t.dispatch({changes:{from:0,to:b.current.state.doc.length,insert:e}})})),acceptChange:R((e=>{var t,n;null==(t=b.current)||t.dispatch({changes:{from:0,to:b.current.state.doc.length,insert:e}}),null==(n=b.current)||n.focus(),T(null)})),children:C.jsxs("div",{className:"relative w-full",onFocus:()=>A(o),children:[!z&&k&&C.jsx(ka,{tooltip:"Edit code",className:"absolute inset-0 z-10",onClick:N}),C.jsx(Pw,{className:hn(z&&k?"h-0 overflow-hidden":k&&"opacity-20 h-8 overflow-hidden"),editorView:b.current,ref:w}),!k&&C.jsx("div",{className:"absolute top-1 right-5",children:C.jsx(Qx,{code:i,editorView:b.current,currentLanguageAdapter:E,onAfterToggle:Y})})]})})})),Lw=e=>{const t=S(10);let n,o,r,a;return t[0]!==e.left?(n=C.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=C.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=C.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=C.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},zw=e=>{const t=S(8);if(!e.canCollapse&&!e.isCollapsed)return null;const n=e.isCollapsed?"Expand":"Collapse";let o,r,a;return t[0]!==e.isCollapsed?(o=C.jsx(Fw,{isCollapsed:e.isCollapsed}),t[0]=e.isCollapsed,t[1]=o):o=t[1],t[2]!==n||t[3]!==o?(r=C.jsx(et,{content:n,children:o}),t[2]=n,t[3]=o,t[4]=r):r=t[4],t[5]!==e.onClick||t[6]!==r?(a=C.jsx(W,{variant:"text",size:"icon",onClick:e.onClick,children:r}),t[5]=e.onClick,t[6]=r,t[7]=a):a=t[7],a},Fw=e=>{const t=S(2),{isCollapsed:n}=e;let o;return t[0]!==n?(o=n?C.jsx(Ca,{className:"w-5 h-5 flex-shrink-0"}):C.jsx(ve,{className:"w-5 h-5 flex-shrink-0"}),t[0]=n,t[1]=o):o=t[1],o},Bw=r.memo((e=>{const t=S(24),{onClick:n,count:o,cellId:r}=e,a=jn();let i;t[0]!==a||t[1]!==r?(i=Sa(a,r),t[0]=a,t[1]=r,t[2]=i):i=t[2];const s=i;let l,c;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=hn("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=C.jsx(da,{className:"w-4 h-4 flex-shrink-0"}),t[4]=c):c=t[4];const d=1===o?"cell":"cells";let u,h,f,m,p,g,y;return t[5]!==o||t[6]!==d?(u=C.jsxs(C.Fragment,{children:[c,C.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]!==s.errored?(h=s.errored&&C.jsx(et,{content:"Has errors",delayDuration:100,children:C.jsx(Uc,{className:"w-4 h-4 flex-shrink-0 text-destructive"})}),t[8]=s.errored,t[9]=h):h=t[9],t[10]!==s.stale?(f=s.stale&&C.jsx(et,{content:"Has stale cells",delayDuration:100,children:C.jsx(Na,{className:"w-4 h-4 flex-shrink-0 text-[var(--yellow-11)]"})}),t[10]=s.stale,t[11]=f):f=t[11],t[12]!==s.runningOrQueued?(m=s.runningOrQueued&&C.jsx(et,{content:"Running",delayDuration:100,children:C.jsx(ua,{className:"w-4 h-4 flex-shrink-0 animate-spin"})}),t[12]=s.runningOrQueued,t[13]=m):m=t[13],t[14]!==h||t[15]!==f||t[16]!==m?(p=C.jsxs(C.Fragment,{children:[h,f,m]}),t[14]=h,t[15]=f,t[16]=m,t[17]=p):p=t[17],t[18]!==u||t[19]!==p?(g=C.jsx(Lw,{center:u,right:p}),t[18]=u,t[19]=p,t[20]=g):g=t[20],t[21]!==n||t[22]!==g?(y=C.jsx("div",{onClick:n,className:l,children:g}),t[21]=n,t[22]=g,t[23]=y):y=t[23],y}));Bw.displayName="CollapsedCellBanner";const Uw=e=>{const t=S(6),{appClosed:n,status:o}=e,r=rh("running"===o);let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=kt("global.interrupt"),t[0]=a):a=t[0];const i=n||!r,s=r?Ea:On.NOOP,l=r?"stale":"disabled";let c,d;return t[1]===Symbol.for("react.memo_cache_sentinel")?(c=C.jsx(w,{strokeWidth:1.5}),t[1]=c):c=t[1],t[2]!==i||t[3]!==s||t[4]!==l?(d=C.jsx(vy,{tooltip:a,disabled:i,onClick:s,variant:l,"data-testid":"run-button",children:c}),t[2]=i,t[3]=s,t[4]=l,t[5]=d):d=t[5],d},Vw={width:void 0,height:void 0};function Hw(e,t,n){return e[t]?Array.isArray(e[t])?e[t][0][n]:e[t][n]:"contentBoxSize"===t?e.contentRect["inlineSize"===n?"width":"height"]:void 0}const $w=e=>{const t=S(26),{edited:n,appClosed:o,status:r,cellConfig:a,needsRun:i,hasOutput:s,onRun:l,cellActionDropdownRef:c,cellId:d,getEditorView:u,name:h}=e,f=!i&&"hover-action";let m;t[0]!==f?(m=hn(f),t[0]=f,t[1]=m):m=t[1];const p=o?On.NOOP:l;let g,y,v,x,b;return t[2]!==n||t[3]!==p||t[4]!==o||t[5]!==r||t[6]!==a||t[7]!==i?(g=C.jsx(by,{edited:n,onClick:p,appClosed:o,status:r,config:a,needsRun:i}),t[2]=n,t[3]=p,t[4]=o,t[5]=r,t[6]=a,t[7]=i,t[8]=g):g=t[8],t[9]!==r||t[10]!==o?(y=C.jsx(Uw,{status:r,appClosed:o}),t[9]=r,t[10]=o,t[11]=y):y=t[11],t[12]===Symbol.for("react.memo_cache_sentinel")?(v=C.jsx(vy,{variant:"green",tooltip:null,"data-testid":"cell-actions-button",children:C.jsx(El,{strokeWidth:1.5})}),t[12]=v):v=t[12],t[13]!==c||t[14]!==d||t[15]!==r||t[16]!==u||t[17]!==h||t[18]!==a||t[19]!==s?(x=C.jsx(Kx,{ref:c,cellId:d,status:r,getEditorView:u,name:h,config:a,hasOutput:s,children:v}),t[13]=c,t[14]=d,t[15]=r,t[16]=u,t[17]=h,t[18]=a,t[19]=s,t[20]=x):x=t[20],t[21]!==m||t[22]!==g||t[23]!==y||t[24]!==x?(b=C.jsxs(xy,{className:m,children:[g,y,x]}),t[21]=m,t[22]=g,t[23]=y,t[24]=x,t[25]=b):b=t[25],b},Ww=r.memo(r.forwardRef((({theme:e,showPlaceholder:t,allowFocus:n,id:o,code:a,output:i,consoleOutputs:s,status:l,runStartTimestamp:c,lastRunStartTimestamp:d,runElapsedTimeMs:u,edited:h,interrupted:f,errored:m,stopped:p,staleInputs:g,serializedEditorState:y,mode:v,debuggerActive:x,appClosed:b,canDelete:w,updateCellCode:k,prepareForRun:S,createNewCell:N,deleteCell:E,focusCell:j,moveCell:_,setStdinResponse:I,moveToNextCell:T,updateCellConfig:A,clearSerializedEditorState:M,sendToBottom:O,sendToTop:D,collapseCell:P,expandCell:L,userConfig:z,outline:F,isCollapsed:H,collapseCount:$,config:W,canMoveX:G,name:q},Y)=>{V.debug("Rendering Cell",o);const X=r.useRef(null),K=r.useRef(null),J=r.useRef(null),Z=ne(Ld),[Q,ee]=r.useState(!1),[te,oe]=r.useState(),re=W.disabled||"disabled-transitively"===l,ae=Ra({executionTime:u,status:l,errored:m,interrupted:f,stopped:p}),ie=h||f||g&&!re,se="running"===l||"queued"===l,le=ja({status:l,output:i,runStartTimestamp:c,interrupted:f,staleInputs:g},h),ce=("queued"===l||h||g)&&!f,de="edit"===v,ue=r.useCallback((()=>{const e=$g(J),t=B(e);return"markdown"!==_a(e)&&Ia(e),S({cellId:o}),t}),[o,J,S]);r.useImperativeHandle(Y,(()=>({get editorView(){return $g(J)},registerRun:ue})),[J,ue]);const he=r.useCallback((()=>J.current),[J]),fe=R((async()=>{if(se)return;const e=ue();await U({cellIds:[o],codes:[e]}).catch((e=>{V.error("Error running cell",e)}))})),me=r.useCallback(((e={})=>N({cellId:o,before:!1,...e})),[o,N]),pe=r.useCallback(((e={})=>N({cellId:o,before:!0,...e})),[o,N]),ge=r.useCallback((e=>{null===X.current||X.current.contains(e.relatedTarget)||null===J.current||Ia(J.current)}),[]),ye=r.useCallback((e=>{if(X.current===document.activeElement&&null!==J.current&&"active"===Vn(J.current.state)){for(const t of Ta)if(e.key===t.key&&t.run){t.run(J.current),e.preventDefault(),e.stopPropagation();break}J.current.focus()}}),[X,J]),ve=!W.hide_code||Q,xe="markdown"===te,be=xe&&!ve,ke=r.useRef(null),Se=Aa(F),[Ne,Ce]=r.useState(!1),[Ee,je]=r.useState(!1);!function(e){const{ref:t,box:n="content-box",skip:o}=e,a=r.useRef({...Vw}),i=r.useRef(void 0);i.current=e.onResize,r.useEffect((()=>{if(!t.current||o)return;if("undefined"==typeof window||!("ResizeObserver"in window))return;const e=new ResizeObserver((([e])=>{const t="border-box"===n?"borderBoxSize":"device-pixel-content-box"===n?"devicePixelContentBoxSize":"contentBoxSize",o=Hw(e,t,"inlineSize"),r=Hw(e,t,"blockSize");if(a.current.width!==o||a.current.height!==r){const e={width:o,height:r};a.current.width=o,a.current.height=r,i.current&&i.current(e)}}));return e.observe(t.current,{box:n}),()=>{e.disconnect()}}),[n,t,o])}({ref:ke,skip:!xe,onResize:e=>{const t=e.height&&e.height<68,n=be&&(t||"below"===Re);Ce(n),Se&&n?je(!0):Ee&&je(!1)}});const _e=r.useRef(null),Ie=r.useCallback((()=>{var e,t;if(!ve){ee(!0),null==(e=J.current)||e.focus();const n=null==(t=_e.current)?void 0:t.parentElement,o=()=>{requestAnimationFrame((()=>{var e;(null==n?void 0:n.contains(document.activeElement))||(ee(!1),null==(e=J.current)||e.dom.blur(),null==n||n.removeEventListener("focusout",o))}))};null==n||n.addEventListener("focusout",o)}}),[ve,J]),Te=()=>{be&&Ie()},Ae=!Ma(i),Me=Ae&&C.jsxs("div",{className:"relative",onDoubleClick:Te,children:[C.jsx("div",{className:"absolute top-5 -left-8 z-10 print:hidden",children:C.jsx(zw,{isCollapsed:H,onClick:()=>{H?L({cellId:o}):P({cellId:o})},canCollapse:Se})}),C.jsx(La,{allowExpand:de,forceExpand:be,output:i,className:"output-area",cellId:o,stale:le}),be&&C.jsx(ka,{tooltip:"Edit markdown",className:"z-20 relative -top-3",onClick:Ie})]}),Oe=Oa("Cell","hover-actions-parent z-10",{published:!de,interactive:de,"needs-run":ie,"has-error":m,stopped:p,disabled:W.disabled,stale:"disabled-transitively"===l,borderless:be&&de}),De=ft.create(o);if(al(de?X:null,{"cell.run":fe,"cell.runAndNewBelow":()=>{fe(),T({cellId:o,before:!1})},"cell.runAndNewAbove":()=>{fe(),T({cellId:o,before:!0})},"cell.createAbove":pe,"cell.createBelow":me,"cell.moveUp":()=>_({cellId:o,before:!0}),"cell.moveDown":()=>_({cellId:o,before:!1}),"cell.hideCode":()=>{var e,t,n;const r=!W.hide_code;we({configs:{[o]:{hide_code:r}}}),A({cellId:o,config:{hide_code:r}}),r?(null==(e=J.current)||e.contentDOM.blur(),null==(t=X.current)||t.focus()):null==(n=J.current)||n.focus()},"cell.focusDown":()=>T({cellId:o,before:!1}),"cell.focusUp":()=>T({cellId:o,before:!0}),"cell.sendToBottom":()=>O({cellId:o}),"cell.sendToTop":()=>D({cellId:o}),"cell.aiCompletion":()=>{let e=!1;Z((t=>(null==t?void 0:t.cellId)===o?(e=!0,null):{cellId:o})),e&&$g(J).focus()},"cell.cellActions":()=>{var e;null==(e=K.current)||e.toggle()}}),il(de?X:null,{ArrowDown:e=>(!e||!Ze.fromInput(e))&&(T({cellId:o,before:!1,noCreate:!0}),!0),ArrowUp:e=>(!e||!Ze.fromInput(e))&&(T({cellId:o,before:!0,noCreate:!0}),!0),Enter:()=>(Te(),!1),..."vim"!==z.keymap.preset||ve?{}:{j:e=>(!e||!Ze.fromInput(e))&&(T({cellId:o,before:!1,noCreate:!0}),!0),k:e=>(!e||!Ze.fromInput(e))&&(T({cellId:o,before:!0,noCreate:!0}),!0)}}),!de){const e=Da(null==i?void 0:i.mimetype);return m||f||p||e?null:C.jsx("div",{tabIndex:-1,id:De,ref:X,className:Oe,children:Me})}const Pe=C.jsx(Ny,{status:l,staleInputs:g,interrupted:f,editing:de,edited:h,disabled:W.disabled??!1,elapsedTime:u,runStartTimestamp:c,uninstantiated:ae,lastRunStartTimestamp:d}),Re=z.display.cell_output;return C.jsx(Zx,{cellId:o,config:W,status:l,getEditorView:he,hasOutput:Ae,name:q,children:C.jsxs(Xx,{tabIndex:-1,ref:X,"data-status":l,onBlur:ge,onKeyDown:ye,cellId:o,canMoveX:G,title:W.disabled?"This cell is disabled":"disabled-transitively"===l?"This cell has a disabled ancestor":void 0,children:[C.jsxs("div",{className:Oe,id:De,ref:ke,children:["above"===Re&&Me,C.jsxs("div",{className:hn("tray"),"data-hidden":be,children:[C.jsx("div",{className:"absolute right-2 -top-4 z-10",children:C.jsx($w,{edited:h,appClosed:b,status:l,cellConfig:W,needsRun:ie,hasOutput:Ae,cellActionDropdownRef:K,cellId:o,name:q,getEditorView:he,onRun:fe})}),C.jsxs("div",{className:hn("absolute flex flex-col gap-[2px] justify-center h-full left-[-34px] z-20",be&&"above"===Re&&"-top-7",be&&"below"===Re&&"-bottom-8",be&&Ee&&"-left-[3.8rem]"),children:[C.jsx(py,{tooltipContent:kt("cell.createAbove"),appClosed:b,onClick:b?void 0:pe}),C.jsx("div",{className:"flex-1"}),C.jsx(py,{tooltipContent:kt("cell.createBelow"),appClosed:b,onClick:b?void 0:me})]}),C.jsx(Rw,{theme:e,showPlaceholder:t,allowFocus:n,id:o,code:a,config:W,status:l,serializedEditorState:y,runCell:fe,updateCellCode:k,setEditorView:e=>{J.current=e},createNewCell:N,deleteCell:E,focusCell:j,moveCell:_,moveToNextCell:T,updateCellConfig:A,clearSerializedEditorState:M,userConfig:z,editorViewRef:J,editorViewParentRef:_e,hidden:!ve,temporarilyShowCode:Ie,languageAdapter:te,setLanguageAdapter:oe}),C.jsxs("div",{className:hn("shoulder-right z-20",be&&"below"===Re&&"top-14"),children:[!Ne&&Pe,C.jsxs("div",{className:"flex gap-2 items-end",children:[C.jsx(qx,{}),Ne&&Pe]})]}),C.jsx("div",{className:"shoulder-bottom hover-action",children:w&&ve&&C.jsx(wy,{appClosed:b,status:l,onClick:()=>{se||b||E({cellId:o})}})})]}),"below"===Re&&Me,C.jsx(jl,{consoleOutputs:s,stale:ce,cellName:q,onRefactorWithAI:e=>{Z({cellId:o,initialPrompt:e.prompt})},onSubmitDebugger:(e,t)=>{I({cellId:o,response:e,outputIndex:t}),Pa({text:e})},cellId:o,debuggerActive:x})]}),H&&C.jsx(Bw,{onClick:()=>L({cellId:o}),count:$,cellId:o})]})})}))),Gw=e=>{const t=S(10),{width:n}=e,{banners:o}=_l(),{removeBanner:r}=Il();if(0===o.length)return null;const a="columns"===n&&"sticky left-12 w-full max-w-[80vw]";let i,s,l;if(t[0]!==a?(i=hn("flex flex-col gap-4 mb-5 print:hidden",a),t[0]=a,t[1]=i):i=t[1],t[2]!==r||t[3]!==o){let e;t[5]!==r?(e=e=>C.jsxs(za,{kind:e.variant||"info",className:"flex flex-col rounded p-3",children:[C.jsxs("div",{className:"flex justify-between",children:[C.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[C.jsx(Fa,{className:"w-5 h-5 inline-block mr-2"}),e.title]}),C.jsx(W,{"data-testid":"remove-banner-button",variant:"text",size:"icon",onClick:()=>r(e.id),children:C.jsx(sn,{className:"w-5 h-5"})})]}),C.jsxs("div",{className:"flex justify-between items-end",children:[C.jsx("span",{children:Ba({html:e.description})}),"restart"===e.action&&C.jsx(qw,{})]})]},e.id),t[5]=r,t[6]=e):e=t[6],s=o.map(e),t[2]=r,t[3]=o,t[4]=s}else s=t[4];return t[7]!==i||t[8]!==s?(l=C.jsx("div",{className:i,children:s}),t[7]=i,t[8]=s,t[9]=l):l=t[9],l},qw=()=>{const e=S(3),t=lu();let n,o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=C.jsx(Kc,{className:"w-3 h-3 mr-2"}),e[0]=n):n=e[0],e[1]!==t?(o=C.jsxs(W,{"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 Yw=(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,i]=t;return{major:Number.parseInt(o,10),minor:Number.parseInt(r,10),patch:Number.parseInt(a,10),preRelease:i||""}};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 Xw=()=>{const e=S(64),{packageAlert:t}=Tl(),{clearPackageAlert:n}=Al(),[o]=_e();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];const[i,s]=r.useState(a);if(null===t)return null;const l="pixi"!==o.package_management.manager;if(Ml(t)){let r,a,c,d,u,h,f,m,p,g;if(e[1]===Symbol.for("react.memo_cache_sentinel")?(r=C.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[C.jsx(Hc,{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=C.jsx(sn,{className:"w-5 h-5"}),e[5]=c):c=e[5],e[6]!==a?(d=C.jsxs("div",{className:"flex justify-between",children:[r,C.jsx(W,{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=C.jsx("p",{children:"The following packages were not found:"}),e[8]=u):u=e[8],e[9]!==l||e[10]!==i||e[11]!==t.packages){let n;e[13]!==l||e[14]!==i?(n=(e,t)=>C.jsxs("li",{className:"flex items-center gap-1 font-mono text-sm",children:[C.jsx(cc,{size:"1rem"}),e,l&&C.jsx(Qw,{value:i[e]??"latest",onChange:t=>s((n=>({...n,[e]:t}))),packageName:e})]},t),e[13]=l,e[14]=i,e[15]=n):n=e[15],h=t.packages.map(n),e[9]=l,e[10]=i,e[11]=t.packages,e[12]=h}else h=e[12];return e[16]!==h?(f=C.jsxs("div",{children:[u,C.jsx("ul",{className:"list-disc ml-4 mt-1",children:h})]}),e[16]=h,e[17]=f):f=e[17],e[18]!==t||e[19]!==n||e[20]!==o||e[21]!==i?(m=C.jsx("div",{className:"ml-auto flex flex-row items-baseline",children:t.isolated?C.jsxs(C.Fragment,{children:[C.jsx(Jw,{manager:o.package_management.manager,packages:t.packages,versions:i,clearPackageAlert:()=>n(t.id)}),!N()&&C.jsxs(C.Fragment,{children:[C.jsx("span",{className:"px-2 text-sm",children:"with"})," ",C.jsx(Zw,{})]})]}):C.jsxs("p",{children:["If you set up a"," ",C.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]=i,e[22]=m):m=e[22],e[23]!==f||e[24]!==m?(p=C.jsxs("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:[f,m]}),e[23]=f,e[24]=m,e[25]=p):p=e[25],e[26]!==d||e[27]!==p?(g=C.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:C.jsxs(za,{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(Ol(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:C.jsx(yc,{className:"w-5 h-5 inline-block mr-2"}),description:"Installing packages:"};if("installed"===n)return{status:"installed",title:"All packages installed!",titleIcon:C.jsx(Vc,{className:"w-5 h-5 inline-block mr-2"}),description:"Installed packages:"};return{status:"failed",title:"Some packages failed to install",titleIcon:C.jsx(Hc,{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:i,description:s}=o;"installed"===r&&setTimeout((()=>n(t.id)),1e4);const l="failed"===r?"danger":"info";let c,d,u,h,f;e[31]!==i||e[32]!==a?(c=C.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[i,a]}),e[31]=i,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=C.jsx(sn,{className:"w-5 h-5"}),e[37]=u):u=e[37],e[38]!==d?(h=C.jsx(W,{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?(f=C.jsxs("div",{className:"flex justify-between",children:[c,h]}),e[40]=c,e[41]=h,e[42]=f):f=e[42];const m="installed"===r&&"text-accent-foreground";let p,g,y,v,x,b,w;if(e[43]!==m?(p=hn("flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",m),e[43]=m,e[44]=p):p=e[44],e[45]!==s?(g=C.jsx("p",{children:s}),e[45]=s,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 C.jsxs("li",{className:hn("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:[C.jsx(Kw,{status:o}),n]},t)},e[50]=r,e[51]=n):n=e[51],y=Object.entries(t.packages).map(n),e[47]=t.packages,e[48]=r,e[49]=y}else y=e[49];return e[52]!==y?(v=C.jsx("ul",{className:"list-disc ml-4 mt-1",children:y}),e[52]=y,e[53]=v):v=e[53],e[54]!==g||e[55]!==v?(x=C.jsxs("div",{children:[g,v]}),e[54]=g,e[55]=v,e[56]=x):x=e[56],e[57]!==p||e[58]!==x?(b=C.jsx("div",{className:p,children:x}),e[57]=p,e[58]=x,e[59]=b):b=e[59],e[60]!==l||e[61]!==f||e[62]!==b?(w=C.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-[200] opacity-95",children:C.jsxs(za,{kind:l,className:"flex flex-col rounded pt-3 pb-4 px-5",children:[f,b]})}),e[60]=l,e[61]=f,e[62]=b,e[63]=w):w=e[63],w}return b(t),null};const Kw=e=>{const t=S(4),{status:n}=e;switch(n){case"queued":{let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=C.jsx(cc,{size:"1rem"}),t[0]=e):e=t[0],e}case"installing":{let e;return t[1]===Symbol.for("react.memo_cache_sentinel")?(e=C.jsx(yc,{size:"1rem"}),t[1]=e):e=t[1],e}case"installed":{let e;return t[2]===Symbol.for("react.memo_cache_sentinel")?(e=C.jsx(Nt,{size:"1rem"}),t[2]=e):e=t[2],e}case"failed":{let e;return t[3]===Symbol.for("react.memo_cache_sentinel")?(e=C.jsx(sn,{size:"1rem"}),t[3]=e):e=t[3],e}default:return b(n),null}},Jw=e=>{const t=S(9),{manager:n,packages:o,versions:r,clearPackageAlert:a}=e;let i,s,l,c;return t[0]!==a||t[1]!==r||t[2]!==o||t[3]!==n?(i=async()=>{a();const e={...r};for(const t of o)e[t]=e[t]??"";await Ja({manager:n,versions:e}).catch((e=>{V.error(e)}))},t[0]=a,t[1]=r,t[2]=o,t[3]=n,t[4]=i):i=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(s=C.jsx(yc,{className:"w-4 h-4 mr-2"}),l=C.jsx("span",{className:"font-semibold",children:"Install"}),t[5]=s,t[6]=l):(s=t[5],l=t[6]),t[7]!==i?(c=C.jsxs(W,{variant:"outline","data-testid":"install-packages-button",size:"sm",onClick:i,children:[s,l]}),t[7]=i,t[8]=c):c=t[8],c},Zw=()=>{const e=S(16),[t,n]=_e();let o,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=Ua(Va),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=Ha(r);let i;e[3]!==n?(i=async e=>{await Te({config:e}).then((()=>{n(e)}))},e[3]=n,e[4]=i):i=e[4];const s=i;let l,c,d,u;return e[5]!==a||e[6]!==s?(l=a.handleSubmit(s),e[5]=a,e[6]=s,e[7]=l):l=e[7],e[8]!==a.control?(c=C.jsx("div",{className:"flex flex-col gap-3",children:C.jsx($a,{control:a.control,name:"package_management.manager",render:tk})}),e[8]=a.control,e[9]=c):c=e[9],e[10]!==l||e[11]!==c?(d=C.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=C.jsx(Wa,{...a,children:d}),e[13]=a,e[14]=d,e[15]=u):u=e[15],u},Qw=e=>{const t=S(21),{value:n,onChange:o,packageName:r}=e;let a,i;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(Yw).slice(0,100)]},i=[r],t[0]=r,t[1]=a,t[2]=i):(a=t[1],i=t[2]);const{data:s,loading:l,error:c}=dn(a,i);let d;t[3]!==s?(d=void 0===s?[]:s,t[3]=s,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=C.jsx("option",{value:"latest",children:"latest"}),t[7]=r):r=t[7],t[8]!==n||t[9]!==e?(a=C.jsx(et,{content:"Failed to fetch package versions",children:C.jsx(Ya,{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,f,m;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?(f=l?C.jsx("option",{value:"latest",children:"latest"}):u.map(nk),t[13]=l,t[14]=u,t[15]=f):f=t[15],t[16]!==n||t[17]!==h||t[18]!==l||t[19]!==f?(m=C.jsx(Ya,{value:n,onChange:h,disabled:l,className:"inline-flex ml-2",children:f}),t[16]=n,t[17]=h,t[18]=l,t[19]=f,t[20]=m):m=t[20],m};function ek(e){return C.jsx("option",{value:e,children:e},e)}function tk(e){const{field:t}=e;return C.jsxs(Ga,{children:[C.jsx(qa,{children:C.jsx(Ya,{"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:Xa.map(ek)})}),C.jsx(Ka,{})]})}function nk(e){return C.jsx("option",{value:e,children:e},e)}const ok=e=>{let{transform:t}=e;return{...t,x:0}},rk={threshold:{x:0,y:.1}},ak=u.memo((e=>{const t=S(23),{children:n,multiColumn:o}=e,{dropCellOverCell:a,dropCellOverColumn:i,moveColumn:s,compactColumns:l}=L(),[c,d]=r.useState(null),[u,h]=r.useState(null),[f]=Ie();let m;e:{if("columns"===f.width){m=Za.EMPTY;break e}let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[ok],t[0]=e):e=t[0],m=e}const p=m;let g,y;t[1]===Symbol.for("react.memo_cache_sentinel")?(g={activationConstraint:{distance:8}},t[1]=g):g=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(y={coordinateGetter:Hx},t[2]=y):y=t[2];const v=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])}(Fy(Dv,g),Fy(Iv,y));let x;t[3]===Symbol.for("react.memo_cache_sentinel")?(x=e=>{d(e.active.id);const t=F();h(t.cellIds)},t[3]=x):x=t[3];const b=R(x);let w;t[4]!==u?(w=()=>{d(null),h(null)},t[4]=u,t[5]=w):w=t[5];const k=R(w);let N;t[6]!==c?(N=e=>{const t=e.droppableContainers.filter((e=>sk(e.id)));if(c&&sk(c))return qy({...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&&Ky(o,t)){const n=$y(t).reduce(((e,t)=>e+Uy(o,t)),0),i=Number((n/4).toFixed(4));r.push({id:e,data:{droppableContainer:a,value:i}})}}return r.sort(Vy)})({...e,droppableContainers:t}),o=Wy(n.length>0?n:Xy({...e,droppableContainers:t}),"id");if(!o)return[];Xt(sk(o),`Expected column id. Got: ${o}`);const r=F().cellIds.get(o);if(Xt(r,`Expected column. Got: ${o}`),r&&0===r.topLevelIds.length)return[{id:o}];const a=new Set(r.topLevelIds),i=qy({...e,droppableContainers:e.droppableContainers.filter((e=>e.id!==o&&a.has(e.id)))});if(i.length>0){const e=i[0].id;return Xt(ik(e),`Expected cell id. Got: ${e}`),[{id:e}]}return[]},t[6]=c,t[7]=N):N=t[7];const E=N;let j;t[8]!==i||t[9]!==a||t[10]!==s?(j=e=>{const{active:t,over:n}=e,o=null==n?void 0:n.id;if(null!=o&&t.id!==o){if(ik(t.id)){if(sk(o))return void i({cellId:t.id,columnId:o});if(ik(o))return void a({cellId:t.id,overCellId:o})}sk(t.id)&&sk(o)&&s({column:t.id,overColumn:o})}},t[8]=i,t[9]=a,t[10]=s,t[11]=j):j=t[11];const _=R(j);let I;t[12]!==l?(I=e=>{const{active:t,over:n}=e;null!==n&&t.id!==n.id&&l()},t[12]=l,t[13]=I):I=t[13];const T=R(I),A=o?E:qy;let M;return t[14]!==v||t[15]!==A||t[16]!==p||t[17]!==T||t[18]!==b||t[19]!==k||t[20]!==_||t[21]!==n?(M=C.jsx(vx,{autoScroll:rk,sensors:v,collisionDetection:A,modifiers:p,onDragEnd:T,onDragStart:b,onDragCancel:k,onDragOver:_,children:n}),t[14]=v,t[15]=A,t[16]=p,t[17]=T,t[18]=b,t[19]=k,t[20]=_,t[21]=n,t[22]=M):M=t[22],M}));function ik(e){return"string"==typeof e&&!e.startsWith("tree_")}function sk(e){return"string"==typeof e&&e.startsWith("tree_")}const lk=u.forwardRef(((e,t)=>{const n=S(62);let o,r,a,i,s,l;n[0]!==e?(({columnId:o,canDelete:i,canMoveLeft:r,canMoveRight:a,...s}=e),n[0]=e,n[1]=o,n[2]=r,n[3]=a,n[4]=i,n[5]=s):(o=n[1],r=n[2],a=n[3],i=n[4],s=n[5]),n[6]!==o?(l={id:o},n[6]=o,n[7]=l):l=n[7];const{attributes:c,listeners:d,setNodeRef:u,transform:h,transition:f,isDragging:m,isOver:p}=Bx(l);let g;n[8]!==h?(g=h?Rr.Transform.toString({x:h.x,y:0,scaleX:1,scaleY:1}):void 0,n[8]=h,n[9]=g):g=n[9];const y=m?2:void 0;let v;n[10]!==g||n[11]!==f||n[12]!==y?(v={transform:g,transition:f,zIndex:y,position:"relative","--gutter-width":"50px"},n[10]=g,n[11]=f,n[12]=y,n[13]=v):v=n[13];const x=v,{deleteColumn:b,moveColumn:w,addColumn:k}=L();let N;n[14]===Symbol.for("react.memo_cache_sentinel")?(N=hn("h-full hover:bg-muted rounded-none"),n[14]=N):N=n[14];const E=N,j=dk;let _;n[15]!==w||n[16]!==o?(_=()=>w({column:o,overColumn:"_left_"}),n[15]=w,n[16]=o,n[17]=_):_=n[17];const I=!r;let T,A,M;n[18]===Symbol.for("react.memo_cache_sentinel")?(T=C.jsx(Qa,{className:"size-4"}),n[18]=T):T=n[18],n[19]!==_||n[20]!==I?(A=C.jsx(et,{content:"Move column left",side:"top",delayDuration:300,children:C.jsx(W,{variant:"text",size:"sm",className:E,onClick:_,disabled:I,children:T})}),n[19]=_,n[20]=I,n[21]=A):A=n[21],n[22]!==w||n[23]!==o?(M=()=>w({column:o,overColumn:"_right_"}),n[22]=w,n[23]=o,n[24]=M):M=n[24];const O=!a;let D,P,R,z,F,B,U,V;n[25]===Symbol.for("react.memo_cache_sentinel")?(D=C.jsx(Ca,{className:"size-4"}),n[25]=D):D=n[25],n[26]!==M||n[27]!==O?(P=C.jsx(et,{content:"Move column right",side:"top",delayDuration:300,children:C.jsx(W,{variant:"text",size:"sm",className:E,onClick:M,disabled:O,children:D})}),n[26]=M,n[27]=O,n[28]=P):P=n[28],n[29]!==c||n[30]!==d?(R=C.jsx("div",{className:"flex gap-2 h-full flex-grow active:bg-accent cursor-grab",...c,...d,"data-testid":"column-drag-button"}),n[29]=c,n[30]=d,n[31]=R):R=n[31],n[32]!==i||n[33]!==b||n[34]!==o?(z=i&&C.jsx(et,{content:"Delete column",side:"top",delayDuration:300,children:C.jsx(W,{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:()=>b({columnId:o}),children:C.jsx(sn,{className:"size-4"})})}),n[32]=i,n[33]=b,n[34]=o,n[35]=z):z=n[35],n[36]!==k||n[37]!==o?(F=()=>{k({columnId:o}),requestAnimationFrame(j)},n[36]=k,n[37]=o,n[38]=F):F=n[38],n[39]===Symbol.for("react.memo_cache_sentinel")?(B=C.jsx(sr,{className:"size-4"}),n[39]=B):B=n[39],n[40]!==F?(U=C.jsx(et,{content:"Add column",side:"top",delayDuration:300,children:C.jsx(W,{variant:"text",size:"sm",className:E,onClick:F,children:B})}),n[40]=F,n[41]=U):U=n[41],n[42]!==A||n[43]!==P||n[44]!==R||n[45]!==z||n[46]!==U?(V=C.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:[A,P,R,z,U]}),n[42]=A,n[43]=P,n[44]=R,n[45]=z,n[46]=U,n[47]=V):V=n[47];const H=V;let $;n[48]!==t||n[49]!==u?($=e=>{Wx(t,u)(e)},n[48]=t,n[49]=u,n[50]=$):$=n[50];const G=m?"":s.className,q=m?"z-20":"z-1 hover:z-10 focus-within:z-10",Y=p&&"bg-accent/20";let X,K;return n[51]!==G||n[52]!==q||n[53]!==Y?(X=hn(G,q,Y),n[51]=G,n[52]=q,n[53]=Y,n[54]=X):X=n[54],n[55]!==$||n[56]!==s||n[57]!==x||n[58]!==m||n[59]!==X||n[60]!==H?(K=C.jsxs("div",{tabIndex:-1,ref:$,...s,style:x,"data-is-dragging":m,className:X,children:[H,s.children]}),n[55]=$,n[56]=s,n[57]=x,n[58]=m,n[59]=X,n[60]=H,n[61]=K):K=n[61],K}));lk.displayName="SortableColumn";const ck=r.memo(lk);function dk(){const e=document.getElementById("App");e&&e.scrollTo({left:e.scrollLeft+1e3,behavior:"smooth"})}const uk=r.memo((e=>{const t=S(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,i;t[0]!==o?(a=hn("flex flex-col gap-5",o),t[0]=o,t[1]=a):a=t[1],t[2]!==a||t[3]!==e.children?(i=C.jsx("div",{className:a,children:e.children}),t[2]=a,t[3]=e.children,t[4]=i):i=t[4];const s=i;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]!==s?(o=C.jsxs(ck,{tabIndex:-1,ref:n,canDelete:e.canDelete,columnId:e.columnId,canMoveLeft:e.canMoveLeft,canMoveRight:e.canMoveRight,className:"group/column",children:[s,e.footer]}),t[5]=e.canDelete,t[6]=e.columnId,t[7]=e.canMoveLeft,t[8]=e.canMoveRight,t[9]=e.footer,t[10]=s,t[11]=o):o=t[11],o}let l;return t[12]!==s||t[13]!==e.footer?(l=C.jsxs(C.Fragment,{children:[s,e.footer]}),t[12]=s,t[13]=e.footer,t[14]=l):l=t[14],l}));uk.displayName="Column";const hk=e=>{const t=S(8),n=ee(ei),o="columns"===e.appConfig.width;let r,a,i;return t[0]!==e?(r=C.jsx(fk,{...e}),t[0]=e,t[1]=r):r=t[1],t[2]!==n||t[3]!==r?(a=C.jsx(Ox,{id:"column-container",items:n,strategy:jx,children:r}),t[2]=n,t[3]=r,t[4]=a):a=t[4],t[5]!==o||t[6]!==a?(i=C.jsx(ak,{multiColumn:o,children:a}),t[5]=o,t[6]=a,t[7]=i):i=t[7],i},fk=e=>{const t=S(47),{mode:n,userConfig:o,appConfig:a,connStatus:i}=e,s=jn(),l=L(),{theme:c}=je(),{toggleSidebarPanel:d}=pu(),{invisible:u}=Dl(s.cellIds.idLength,n);let h;qs("global.focusTop",l.focusTopCell),qs("global.focusBottom",l.focusBottomCell),qs("global.toggleSidebar",d),qs("global.foldCode",l.foldAll),qs("global.unfoldCode",l.unfoldAll),t[0]!==l.updateCellCode?(h=()=>{An(l.updateCellCode)},t[0]=l.updateCellCode,t[1]=h):h=t[1],qs("global.formatAll",h),qs("cell.hideCode",On.NOOP),qs("cell.format",On.NOOP);const f=Vd(),m=l.scrollToTarget;let p,g,y,v,x,b,w,k,N,E,j,_,I,T;if(t[2]!==s.scrollKey||t[3]!==m?(p=()=>{null!==s.scrollKey&&m()},t[2]=s.scrollKey,t[3]=m,t[4]=p):p=t[4],t[5]!==s.cellIds||t[6]!==s.scrollKey||t[7]!==m?(g=[s.cellIds,s.scrollKey,m],t[5]=s.cellIds,t[6]=s.scrollKey,t[7]=m,t[8]=g):g=t[8],r.useEffect(p,g),t[9]!==s||t[10]!==u||t[11]!==a||t[12]!==n||t[13]!==o||t[14]!==i||t[15]!==l||t[16]!==c||t[17]!==f){const e=s.cellIds.getColumns();let r;t[27]!==s.cellIds?(r=s.cellIds.hasOnlyOneId(),t[27]=s.cellIds,t[28]=r):r=t[28];const d=r;x=Pl,b="pb-[40vh]",w=u,k=a,N="pr-4",t[29]===Symbol.for("react.memo_cache_sentinel")?(E=C.jsx(Xw,{}),t[29]=E):E=t[29],t[30]!==a.width?(j=C.jsx(Gw,{width:a.width}),t[30]=a.width,t[31]=j):j=t[31];const h="columns"===a.width&&"grid grid-flow-col auto-cols-min gap-6";t[32]!==h?(y=hn(h),t[32]=h,t[33]=y):y=t[33],v=e.map(((t,r)=>C.jsx(mk,{column:t,index:r,columnsLength:e.length,appConfig:a,notebook:s,mode:n,userConfig:o,connStatus:i,actions:l,theme:c,hasOnlyOneCell:d,invisible:u,onDeleteCell:f},t.id))),t[9]=s,t[10]=u,t[11]=a,t[12]=n,t[13]=o,t[14]=i,t[15]=l,t[16]=c,t[17]=f,t[18]=y,t[19]=v,t[20]=x,t[21]=b,t[22]=w,t[23]=k,t[24]=N,t[25]=E,t[26]=j}else y=t[18],v=t[19],x=t[20],b=t[21],w=t[22],k=t[23],N=t[24],E=t[25],j=t[26];return t[34]!==y||t[35]!==v?(_=C.jsx("div",{className:y,children:v}),t[34]=y,t[35]=v,t[36]=_):_=t[36],t[37]===Symbol.for("react.memo_cache_sentinel")?(I=C.jsx(Rl,{}),t[37]=I):I=t[37],t[38]!==x||t[39]!==b||t[40]!==w||t[41]!==k||t[42]!==N||t[43]!==E||t[44]!==j||t[45]!==_?(T=C.jsxs(x,{className:b,invisible:w,appConfig:k,innerClassName:N,children:[E,j,_,I]}),t[38]=x,t[39]=b,t[40]=w,t[41]=k,t[42]=N,t[43]=E,t[44]=j,t[45]=_,t[46]=T):T=t[46],T},mk=e=>{const t=S(32),{column:n,index:o,columnsLength:r,appConfig:a,notebook:i,mode:s,userConfig:l,connStatus:c,actions:d,theme:u,hasOnlyOneCell:h,invisible:f,onDeleteCell:m}=e,p=n.id,g=o>0,y=o<r-1,v=a.width,x=r>1,b=n.id,w="columns"===a.width&&"opacity-0 group-hover/column:opacity-100";let k,N;t[0]!==w?(k=hn(w),t[0]=w,t[1]=k):k=t[1],t[2]!==n.id||t[3]!==k?(N=C.jsx(pk,{columnId:b,className:k}),t[2]=n.id,t[3]=k,t[4]=N):N=t[4];const E=`column-${o+1}`,j=n.topLevelIds;let _,I,T;return t[5]!==i.cellData||t[6]!==i.cellRuntime||t[7]!==i.scrollKey||t[8]!==i.cellHandles||t[9]!==u||t[10]!==h||t[11]!==f||t[12]!==s||t[13]!==c.state||t[14]!==l||t[15]!==n||t[16]!==a.width||t[17]!==d||t[18]!==m?(_=n.topLevelIds.map((e=>{const t=i.cellData[e],o=i.cellRuntime[e];return C.jsx(Ww,{theme:u,showPlaceholder:h,allowFocus:!f&&!i.scrollKey,id:t.id,code:t.code,outline:o.outline,output:o.output,consoleOutputs:o.consoleOutputs,status:o.status,edited:t.edited,interrupted:o.interrupted,errored:o.errored,stopped:o.stopped,staleInputs:o.staleInputs,runStartTimestamp:o.runStartTimestamp,lastRunStartTimestamp:o.lastRunStartTimestamp,runElapsedTimeMs:o.runElapsedTimeMs??t.lastExecutionTime,serializedEditorState:t.serializedEditorState,canDelete:!h,mode:s,appClosed:c.state!==ot.OPEN,ref:i.cellHandles[e],userConfig:l,debuggerActive:o.debuggerActive,config:t.config,name:t.name,isCollapsed:n.isCollapsed(e),collapseCount:n.getCount(e),canMoveX:"columns"===a.width,...d,deleteCell:m},t.id.toString())})),t[5]=i.cellData,t[6]=i.cellRuntime,t[7]=i.scrollKey,t[8]=i.cellHandles,t[9]=u,t[10]=h,t[11]=f,t[12]=s,t[13]=c.state,t[14]=l,t[15]=n,t[16]=a.width,t[17]=d,t[18]=m,t[19]=_):_=t[19],t[20]!==E||t[21]!==n.topLevelIds||t[22]!==_?(I=C.jsx(Ox,{id:E,items:j,strategy:Tx,children:_}),t[20]=E,t[21]=n.topLevelIds,t[22]=_,t[23]=I):I=t[23],t[24]!==n.id||t[25]!==g||t[26]!==y||t[27]!==a.width||t[28]!==x||t[29]!==N||t[30]!==I?(T=C.jsx(uk,{columnId:p,canMoveLeft:g,canMoveRight:y,width:v,canDelete:x,footer:N,children:I}),t[24]=n.id,t[25]=g,t[26]=y,t[27]=a.width,t[28]=x,t[29]=N,t[30]=I,t[31]=T):T=t[31],T},pk=e=>{const t=S(18),{columnId:n,className:o}=e,{createNewCell:r}=L(),a=ee(re),[i,s]=ti(!1),l=ee(oe),c=ee(ni).sql;let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d=hn("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]!==i||t[2]!==s.toggle||t[3]!==r||t[4]!==n||t[5]!==a||t[6]!==c||t[7]!==l?(h=()=>i?C.jsx(jw,{onClose:s.toggle}):C.jsxs(C.Fragment,{children:[C.jsxs(W,{className:u,variant:"text",size:"sm",onClick:()=>r({cellId:{type:"__end__",columnId:n},before:!1}),children:[C.jsx(od,{className:"mr-2 size-4 flex-shrink-0"}),"Python"]}),C.jsxs(W,{className:u,variant:"text",size:"sm",onClick:()=>{$d(a,r),r({cellId:{type:"__end__",columnId:n},before:!1,code:(new lr).defaultCode})},children:[C.jsx(id,{className:"mr-2 size-4 flex-shrink-0"}),"Markdown"]}),C.jsx(et,{content:c?null:C.jsxs("div",{className:"flex flex-col",children:[C.jsxs("span",{children:["Additional dependencies required:",C.jsx(oi,{className:"inline",children:"pip install 'marimo[sql]'"}),"."]}),C.jsx("span",{children:"You will need to restart the notebook after installing."})]}),delayDuration:100,asChild:!1,children:C.jsxs(W,{className:u,variant:"text",size:"sm",disabled:!c,onClick:()=>{$d(a,r),r({cellId:{type:"__end__",columnId:n},before:!1,code:(new cr).defaultCode})},children:[C.jsx(pe,{className:"mr-2 size-4 flex-shrink-0"}),"SQL"]})}),C.jsx(et,{content:l?null:C.jsx("span",{children:"Enable via settings under AI Assist"}),delayDuration:100,asChild:!1,children:C.jsxs(W,{className:u,variant:"text",size:"sm",disabled:!l,onClick:s.toggle,children:[C.jsx(nd,{className:"mr-2 size-4 flex-shrink-0"}),"Generate with AI"]})})]}),t[1]=i,t[2]=s.toggle,t[3]=r,t[4]=n,t[5]=a,t[6]=c,t[7]=l,t[8]=h):h=t[8];const f=h,m=!i&&"w-fit",p=i&&"opacity-100 w-full max-w-4xl shadow-lg shadow-[var(--blue-3)]";let g,y,v;return t[9]!==m||t[10]!==p||t[11]!==o?(g=hn("shadow-sm border border-border rounded transition-all duration-200 overflow-hidden divide-x divide-border flex",m,p,o),t[9]=m,t[10]=p,t[11]=o,t[12]=g):g=t[12],t[13]!==f?(y=f(),t[13]=f,t[14]=y):y=t[14],t[15]!==g||t[16]!==y?(v=C.jsx("div",{className:"flex justify-center mt-4 pt-6 pb-32 group gap-4 w-full print:hidden",children:C.jsx("div",{className:g,children:y})}),t[15]=g,t[16]=y,t[17]=v):v=t[17],v},gk=e=>{const t=S(58),{userConfig:n,appConfig:o}=e;ri(di,ci.onCellIdsChange);const{setCells:a,mergeAllColumns:i}=L(),s=ee(ht),l=ee(ai),c=ee(ii),d=vt(),u=ne(uh),h="edit"===s.mode,f="present"===s.mode,m=ee(si);let p;t[0]===Symbol.for("react.memo_cache_sentinel")?(p=[],t[0]=p):p=t[0],r.useEffect(vk,p);const g=n.runtime.auto_instantiate;let y,v,x;t[1]!==a||t[2]!==u?(y=(e,t)=>{a(e);const n=e.map((e=>e.name)),o=e.map((e=>e.code)),r=e.map((e=>e.config));u({names:n,codes:o,configs:r,layout:t})},t[1]=a,t[2]=u,t[3]=y):y=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(v=ui(),t[4]=v):v=t[4],t[5]!==n.runtime.auto_instantiate||t[6]!==y?(x={autoInstantiate:g,setCells:y,sessionId:v},t[5]=n.runtime.auto_instantiate,t[6]=y,t[7]=x):x=t[7];const{connection:b}=Ll(x);let w,k;t[8]!==o.app_title||t[9]!==d?(w=()=>{document.title=o.app_title||gt.basename(d??"")||"Untitled Notebook"},k=[o.app_title,d],t[8]=o.app_title,t[9]=d,t[10]=w,t[11]=k):(w=t[10],k=t[11]),r.useEffect(w,k);const N=Nr(o.width);let E,j;t[12]!==N||t[13]!==o.width||t[14]!==i?(E=()=>{"columns"===N&&"columns"!==o.width&&i()},t[12]=N,t[13]=o.width,t[14]=i,t[15]=E):E=t[15],t[16]!==o.width||t[17]!==N||t[18]!==i||t[19]!==l?(j=[o.width,N,i,l],t[16]=o.width,t[17]=N,t[18]=i,t[19]=l,t[20]=j):j=t[20],r.useEffect(E,j);const _=function(){const e=S(2),t=Rd();let n;return e[0]!==t?(n=()=>t(z(F())),e[0]=t,e[1]=n):n=e[1],R(n)}(),I=yu();let T,A,M;t[21]!==_?(T=()=>{_()},t[21]=_,t[22]=T):T=t[22],qs("global.runStale",T),qs("global.interrupt",xk),t[23]!==I?(A=()=>{I()},t[23]=I,t[24]=A):A=t[24],qs("global.hideCode",A),t[25]!==b||t[26]!==s.mode||t[27]!==n||t[28]!==o?(M=C.jsx(hk,{connStatus:b,mode:s.mode,userConfig:n,appConfig:o}),t[25]=b,t[26]=s.mode,t[27]=n,t[28]=o,t[29]=M):M=t[29];const O=M,D=o.width;let P,B,U,V,H;t[30]===Symbol.for("react.memo_cache_sentinel")?(P=hn("pt-4 sm:pt-12 pb-2 mb-4 print:hidden z-50","sticky left-0"),t[30]=P):P=t[30],t[31]!==h||t[32]!==d?(B=h&&C.jsx("div",{className:"flex items-center justify-center container",children:C.jsx(_h,{filename:d})}),t[31]=h,t[32]=d,t[33]=B):B=t[33],t[34]!==b||t[35]!==B?(U=C.jsx(Bl,{connection:b,className:P,children:B}),t[34]=b,t[35]=B,t[36]=U):U=t[36],t[37]!==c||t[38]!==o||t[39]!==s||t[40]!==O?(V=c&&C.jsx(zl,{appConfig:o,mode:s.mode,children:O}),t[37]=c,t[38]=o,t[39]=s,t[40]=O,t[41]=V):V=t[41],t[42]!==b||t[43]!==m||t[44]!==o.width||t[45]!==U||t[46]!==V?(H=C.jsxs(Ul,{connection:b,isRunning:m,width:D,children:[U,V]}),t[42]=b,t[43]=m,t[44]=o.width,t[45]=U,t[46]=V,t[47]=H):H=t[47];const $=b.state===ot.CLOSED;let W,G;return t[48]!==f||t[49]!==I||t[50]!==_||t[51]!==$||t[52]!==m||t[53]!==o?(W=C.jsx(hi,{children:C.jsx(Sh,{presenting:f,onTogglePresenting:I,onInterrupt:Ea,onRun:_,closed:$,running:m,appConfig:o})}),t[48]=f,t[49]=I,t[50]=_,t[51]=$,t[52]=m,t[53]=o,t[54]=W):W=t[54],t[55]!==H||t[56]!==W?(G=C.jsxs(C.Fragment,{children:[H,W]}),t[55]=H,t[56]=W,t[57]=G):G=t[57],G};function yk(){Fl.INSTANCE.stop()}function vk(){return Fl.INSTANCE.start(li),yk}function xk(){Ea()}const{createElement:bk,createContext:wk,createRef:kk,forwardRef:Sk,useCallback:Nk,useContext:Ck,useEffect:Ek,useImperativeHandle:jk,useLayoutEffect:_k,useMemo:Ik,useRef:Tk,useState:Ak}=fi,Mk=fi["useId".toString()],Ok=_k,Dk=wk(null);Dk.displayName="PanelGroupContext";const Pk=Ok,Rk="function"==typeof Mk?Mk:()=>null;let Lk=0;function zk(e=null){const t=Rk(),n=Tk(e||t||null);return null===n.current&&(n.current=""+Lk++),null!=e?e:n.current}function Fk({children:e,className:t="",collapsedSize:n,collapsible:o,defaultSize:r,forwardedRef:a,id:i,maxSize:s,minSize:l,onCollapse:c,onExpand:d,onResize:u,order:h,style:f,tagName:m="div",...p}){const g=Ck(Dk);if(null===g)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:y,expandPanel:v,getPanelSize:x,getPanelStyle:b,groupId:w,isPanelCollapsed:k,reevaluatePanelConstraints:S,registerPanel:N,resizePanel:C,unregisterPanel:E}=g,j=zk(i),_=Tk({callbacks:{onCollapse:c,onExpand:d,onResize:u},constraints:{collapsedSize:n,collapsible:o,defaultSize:r,maxSize:s,minSize:l},id:j,idIsFromProps:void 0!==i,order:h});Tk({didLogMissingDefaultSizeWarning:!1}),Pk((()=>{const{callbacks:e,constraints:t}=_.current,a={...t};_.current.id=j,_.current.idIsFromProps=void 0!==i,_.current.order=h,e.onCollapse=c,e.onExpand=d,e.onResize=u,t.collapsedSize=n,t.collapsible=o,t.defaultSize=r,t.maxSize=s,t.minSize=l,a.collapsedSize===t.collapsedSize&&a.collapsible===t.collapsible&&a.maxSize===t.maxSize&&a.minSize===t.minSize||S(_.current,a)})),Pk((()=>{const e=_.current;return N(e),()=>{E(e)}}),[h,j,N,E]),jk(a,(()=>({collapse:()=>{y(_.current)},expand:e=>{v(_.current,e)},getId:()=>j,getSize:()=>x(_.current),isCollapsed:()=>k(_.current),isExpanded:()=>!k(_.current),resize:e=>{C(_.current,e)}})),[y,v,x,k,j,C]);const I=b(_.current,r);return bk(m,{...p,children:e,className:t,id:i,style:{...I,...f},"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 Bk=Sk(((e,t)=>bk(Fk,{...e,forwardedRef:t})));Fk.displayName="Panel",Bk.displayName="forwardRef(Panel)";let Uk=null,Vk=null;function Hk(e,t){const n=function(e,t){if(t){const e=!!(t&nS),n=!!(t&oS);if(t&eS)return e?"se-resize":n?"ne-resize":"e-resize";if(t&tS)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);Uk!==n&&(Uk=n,null===Vk&&(Vk=document.createElement("style"),document.head.appendChild(Vk)),Vk.innerHTML=`*{cursor: ${n}!important;}`)}function $k(e){return"keydown"===e.type}function Wk(e){return e.type.startsWith("pointer")}function Gk(e){return e.type.startsWith("mouse")}function qk(e){if(Wk(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(Gk(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}const Yk=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Xk(e){const t=getComputedStyle(e);return"fixed"===t.position||(!("auto"===t.zIndex||"static"===t.position&&!function(e){var t;const n=getComputedStyle(null!==(t=Qk(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||(!!Yk.test(t.willChange)||"touch"===t.webkitOverflowScrolling)))))))))}function Kk(e){let t=e.length;for(;t--;){const n=e[t];if(vS(n,"Missing node"),Xk(n))return n}return null}function Jk(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Zk(e){const t=[];for(;e;)t.push(e),e=Qk(e);return t}function Qk(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const eS=1,tS=2,nS=4,oS=8,rS="coarse"===function(){if("function"==typeof matchMedia)return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}();let aS=[],iS=!1,sS=new Map,lS=new Map;const cS=new Set;function dS(e){const{target:t}=e,{x:n,y:o}=qk(e);iS=!0,fS({target:t,x:n,y:o}),gS(),aS.length>0&&(yS("down",e),e.preventDefault(),e.stopPropagation())}function uS(e){const{x:t,y:n}=qk(e);if(!iS){const{target:o}=e;fS({target:o,x:t,y:n})}yS("move",e),pS(),aS.length>0&&e.preventDefault()}function hS(e){const{target:t}=e,{x:n,y:o}=qk(e);lS.clear(),iS=!1,aS.length>0&&e.preventDefault(),yS("up",e),fS({target:t,x:n,y:o}),pS(),gS()}function fS({target:e,x:t,y:n}){aS.splice(0);let o=null;e instanceof HTMLElement&&(o=e),cS.forEach((e=>{const{element:r,hitAreaMargins:a}=e,i=r.getBoundingClientRect(),{bottom:s,left:l,right:c,top:d}=i,u=rS?a.coarse:a.fine;if(t>=l-u&&t<=c+u&&n>=d-u&&n<=s+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:Zk(e),b:Zk(t)};let o;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),o=e;vS(o,"Stacking order can only be calculated for elements with a common ancestor");const r=Jk(Kk(n.a)),a=Jk(Kk(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(),f=i,h.x<f.x+f.width&&h.x+h.width>f.x&&h.y<f.y+f.height&&h.y+h.height>f.y){t=!0;break}e=e.parentElement}if(t)return}aS.push(e)}var h,f}))}function mS(e,t){lS.set(e,t)}function pS(){let e=!1,t=!1;aS.forEach((n=>{const{direction:o}=n;"horizontal"===o?e=!0:t=!0}));let n=0;lS.forEach((e=>{n|=e})),e&&t?Hk("intersection",n):e?Hk("horizontal",n):t?Hk("vertical",n):null!==Vk&&(document.head.removeChild(Vk),Uk=null,Vk=null)}function gS(){sS.forEach(((e,t)=>{const{body:n}=t;n.removeEventListener("contextmenu",hS),n.removeEventListener("pointerdown",dS),n.removeEventListener("pointerleave",uS),n.removeEventListener("pointermove",uS)})),window.removeEventListener("pointerup",hS),window.removeEventListener("pointercancel",hS),cS.size>0&&(iS?(aS.length>0&&sS.forEach(((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("contextmenu",hS),n.addEventListener("pointerleave",uS),n.addEventListener("pointermove",uS))})),window.addEventListener("pointerup",hS),window.addEventListener("pointercancel",hS)):sS.forEach(((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("pointerdown",dS,{capture:!0}),n.addEventListener("pointermove",uS))})))}function yS(e,t){cS.forEach((n=>{const{setResizeHandlerState:o}=n,r=aS.includes(n);o(e,r,t)}))}function vS(e,t){if(!e)throw console.error(t),Error(t)}function xS(e,t,n=10){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function bS(e,t,n=10){return 0===xS(e,t,n)}function wS(e,t,n){return 0===xS(e,t,n)}function kS({panelConstraints:e,panelIndex:t,size:n}){const o=e[t];vS(null!=o,`Panel constraints not found for index ${t}`);let{collapsedSize:r=0,collapsible:a,maxSize:i=100,minSize:s=0}=o;if(xS(n,s)<0)if(a){n=xS(n,(r+s)/2)<0?r:s}else n=s;return n=Math.min(i,n),n=parseFloat(n.toFixed(10))}function SS({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:o,prevLayout:r,trigger:a}){if(wS(e,0))return t;const i=[...t],[s,l]=o;vS(null!=s,"Invalid first pivot index"),vS(null!=l,"Invalid second pivot index");let c=0;if("keyboard"===a){{const o=e<0?l:s,r=n[o];vS(r,`Panel constraints not found for index ${o}`);const{collapsedSize:a=0,collapsible:i,minSize:c=0}=r;if(i){const n=t[o];if(vS(null!=n,`Previous layout not found for panel index ${o}`),wS(n,a)){const t=c-n;xS(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{const o=e<0?s:l,r=n[o];vS(r,`No panel constraints found for index ${o}`);const{collapsedSize:a=0,collapsible:i,minSize:c=0}=r;if(i){const n=t[o];if(vS(null!=n,`Previous layout not found for panel index ${o}`),wS(n,c)){const t=n-a;xS(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}{const o=e<0?1:-1;let r=e<0?l:s,a=0;for(;;){const e=t[r];vS(null!=e,`Previous layout not found for panel index ${r}`);if(a+=kS({panelConstraints:n,panelIndex:r,size:100})-e,r+=o,r<0||r>=n.length)break}const i=Math.min(Math.abs(e),Math.abs(a));e=e<0?0-i:i}{let o=e<0?s:l;for(;o>=0&&o<n.length;){const r=Math.abs(e)-Math.abs(c),a=t[o];vS(null!=a,`Previous layout not found for panel index ${o}`);const s=kS({panelConstraints:n,panelIndex:o,size:a-r});if(!wS(a,s)&&(c+=a-s,i[o]=s,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(!wS(e[o],t[o],n))return!1;return!0}(r,i))return r;{const o=e<0?l:s,r=t[o];vS(null!=r,`Previous layout not found for panel index ${o}`);const a=r+c,d=kS({panelConstraints:n,panelIndex:o,size:a});if(i[o]=d,!wS(d,a)){let t=a-d;let o=e<0?l:s;for(;o>=0&&o<n.length;){const r=i[o];vS(null!=r,`Previous layout not found for panel index ${o}`);const a=kS({panelConstraints:n,panelIndex:o,size:r+t});if(wS(r,a)||(t-=a-r,i[o]=a),wS(t,0))break;e>0?o--:o++}}}return wS(i.reduce(((e,t)=>t+e),0),100)?i:r}function NS({layout:e,panelsArray:t,pivotIndices:n}){let o=0,r=100,a=0,i=0;const s=n[0];vS(null!=s,"No pivot index found"),t.forEach(((e,t)=>{const{constraints:n}=e,{maxSize:l=100,minSize:c=0}=n;t===s?(o=c,r=l):(a+=c,i+=l)}));return{valueMax:Math.min(r,100-a),valueMin:Math.max(o,100-i),valueNow:e[s]}}function CS(e,t=document){return Array.from(t.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function ES(e,t,n=document){const o=CS(e,n).findIndex((e=>e.getAttribute("data-panel-resize-handle-id")===t));return null!=o?o:null}function jS(e,t,n){const o=ES(e,t,n);return null!=o?[o,o+1]:[-1,-1]}function _S(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 IS(e,t=document){const n=t.querySelector(`[data-panel-resize-handle-id="${e}"]`);return n||null}function TS({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:o,panelDataArray:r,panelGroupElement:a,setLayout:i}){Tk({didWarnAboutMissingResizeHandle:!1}),Pk((()=>{if(!a)return;const e=CS(n,a);for(let t=0;t<r.length-1;t++){const{valueMax:n,valueMin:a,valueNow:i}=NS({layout:o,panelsArray:r,pivotIndices:[t,t+1]}),s=e[t];if(null==s);else{const e=r[t];vS(e,`No panel data found for index "${t}"`),s.setAttribute("aria-controls",e.id),s.setAttribute("aria-valuemax",""+Math.round(n)),s.setAttribute("aria-valuemin",""+Math.round(a)),s.setAttribute("aria-valuenow",null!=i?""+Math.round(i):"")}}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]),Ek((()=>{if(!a)return;const e=t.current;vS(e,"Eager values not found");const{panelDataArray:r}=e;vS(null!=_S(n,a),`No group found for id "${n}"`);const s=CS(n,a);vS(s,`No resize handles found for group id "${n}"`);const l=s.map((e=>{const t=e.getAttribute("data-panel-resize-handle-id");vS(t,"Resize handle element has no handle id attribute");const[s,l]=function(e,t,n,o=document){var r,a,i,s;const l=IS(t,o),c=CS(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!==(i=null===(s=n[d+1])||void 0===s?void 0:s.id)&&void 0!==i?i:null]}(n,t,r,a);if(null==s||null==l)return()=>{};const c=e=>{if(!e.defaultPrevented)switch(e.key){case"Enter":{e.preventDefault();const l=r.findIndex((e=>e.id===s));if(l>=0){const e=r[l];vS(e,`No panel data found for index ${l}`);const s=o[l],{collapsedSize:c=0,collapsible:d,minSize:u=0}=e.constraints;if(null!=s&&d){const e=SS({delta:wS(s,c)?u-c:c-s,initialLayout:o,panelConstraints:r.map((e=>e.constraints)),pivotIndices:jS(n,t,a),prevLayout:o,trigger:"keyboard"});o!==e&&i(e)}}break}}};return e.addEventListener("keydown",c),()=>{e.removeEventListener("keydown",c)}}));return()=>{l.forEach((e=>e()))}}),[a,e,t,n,o,r,i])}function AS(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 MS(e,t){const n="horizontal"===e,{x:o,y:r}=qk(t);return n?o:r}function OS(e,t,n,o,r,a){if($k(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,i=IS(t,r);vS(i,`No resize handle element found for id "${t}"`);const s=i.getAttribute("data-panel-group-id");vS(s,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=o;const c=MS(n,e),d=_S(s,r);vS(d,`No group element found for id "${s}"`);const u=d.getBoundingClientRect();return(c-l)/(a?u.width:u.height)*100}(e,t,n,o,a)}function DS(e,t,n){t.forEach(((t,o)=>{const r=e[o];vS(r,`Panel data not found for index ${o}`);const{callbacks:a,constraints:i,id:s}=r,{collapsedSize:l=0,collapsible:c}=i,d=n[s];if(null==d||t!==d){n[s]=t;const{onCollapse:e,onExpand:o,onResize:r}=a;r&&r(t,d),c&&(e||o)&&(!o||null!=d&&!bS(d,l)||bS(t,l)||o(),!e||null!=d&&bS(d,l)||!bS(t,l)||e())}}))}function PS(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 RS(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 LS(e){return`react-resizable-panels:${e}`}function zS(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 FS(e,t){try{const n=LS(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 BS(e,t,n,o,r){var a;const i=LS(e),s=zS(t),l=null!==(a=FS(e,r))&&void 0!==a?a:{};l[s]={expandToSizes:Object.fromEntries(n.entries()),layout:o};try{r.setItem(i,JSON.stringify(l))}catch(c){console.error(c)}}function US({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(!wS(o,100))for(let a=0;a<t.length;a++){const e=n[a];vS(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];vS(null!=e,`No layout data found for index ${a}`);const o=kS({panelConstraints:t,panelIndex:a,size:e});e!=o&&(r+=e-o,n[a]=o)}if(!wS(r,0))for(let a=0;a<t.length;a++){const e=n[a];vS(null!=e,`No layout data found for index ${a}`);const o=kS({panelConstraints:t,panelIndex:a,size:e+r});if(e!==o&&(r-=o-e,n[a]=o,wS(r,0)))break}return n}const VS={getItem:e=>(RS(VS),VS.getItem(e)),setItem:(e,t)=>{RS(VS),VS.setItem(e,t)}},HS={};function $S({autoSaveId:e=null,children:t,className:n="",direction:o,forwardedRef:r,id:a=null,onLayout:i=null,keyboardResizeBy:s=null,storage:l=VS,style:c,tagName:d="div",...u}){const h=zk(a),f=Tk(null),[m,p]=Ak(null),[g,y]=Ak([]),v=Tk({}),x=Tk(new Map),b=Tk(0),w=Tk({autoSaveId:e,direction:o,dragState:m,id:h,keyboardResizeBy:s,onLayout:i,storage:l}),k=Tk({layout:g,panelDataArray:[],panelDataArrayChanged:!1});Tk({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),jk(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=US({layout:e,panelConstraints:o.map((e=>e.constraints))});AS(n,r)||(y(r),k.current.layout=r,t&&t(r),DS(o,r,v.current))}})),[]),Pk((()=>{w.current.autoSaveId=e,w.current.direction=o,w.current.dragState=m,w.current.id=h,w.current.onLayout=i,w.current.storage=l})),TS({committedValuesRef:w,eagerValuesRef:k,groupId:h,layout:g,panelDataArray:k.current.panelDataArray,setLayout:y,panelGroupElement:f.current}),Ek((()=>{const{panelDataArray:t}=k.current;if(e){if(0===g.length||g.length!==t.length)return;let n=HS[e];null==n&&(n=function(e,t=10){let n=null;return(...o)=>{null!==n&&clearTimeout(n),n=setTimeout((()=>{e(...o)}),t)}}(BS,100),HS[e]=n);const o=[...t],r=new Map(x.current);n(e,o,r,g,l)}}),[e,g,l]),Ek((()=>{}));const S=Nk((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:i,pivotIndices:s}=qS(o,e,n);if(vS(null!=i,`Panel size not found for panel "${e.id}"`),!bS(i,a)){x.current.set(e.id,i);const l=SS({delta:GS(o,e)===o.length-1?i-a:a-i,initialLayout:n,panelConstraints:r,pivotIndices:s,prevLayout:n,trigger:"imperative-api"});PS(n,l)||(y(l),k.current.layout=l,t&&t(l),DS(o,l,v.current))}}}),[]),N=Nk(((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:i=0,panelSize:s=0,minSize:l=0,pivotIndices:c}=qS(r,e,o),d=null!=t?t:l;if(bS(s,i)){const t=x.current.get(e.id),i=null!=t&&t>=d?t:d,l=SS({delta:GS(r,e)===r.length-1?s-i:i-s,initialLayout:o,panelConstraints:a,pivotIndices:c,prevLayout:o,trigger:"imperative-api"});PS(o,l)||(y(l),k.current.layout=l,n&&n(l),DS(r,l,v.current))}}}),[]),C=Nk((e=>{const{layout:t,panelDataArray:n}=k.current,{panelSize:o}=qS(n,e,t);return vS(null!=o,`Panel size not found for panel "${e.id}"`),o}),[]),E=Nk(((e,t)=>{const{panelDataArray:n}=k.current,o=GS(n,e);return function({defaultSize:e,dragState:t,layout:n,panelData:o,panelIndex:r,precision:a=3}){const i=n[r];let s;return s=null==i?null!=e?e.toPrecision(a):"1":1===o.length?"1":i.toPrecision(a),{flexBasis:0,flexGrow:s,flexShrink:1,overflow:"hidden",pointerEvents:null!==t?"none":void 0}}({defaultSize:t,dragState:m,layout:g,panelData:n,panelIndex:o})}),[m,g]),j=Nk((e=>{const{layout:t,panelDataArray:n}=k.current,{collapsedSize:o=0,collapsible:r,panelSize:a}=qS(n,e,t);return vS(null!=a,`Panel size not found for panel "${e.id}"`),!0===r&&bS(a,o)}),[]),_=Nk((e=>{const{layout:t,panelDataArray:n}=k.current,{collapsedSize:o=0,collapsible:r,panelSize:a}=qS(n,e,t);return vS(null!=a,`Panel size not found for panel "${e.id}"`),!r||xS(a,o)>0}),[]),I=Nk((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}),[]);Pk((()=>{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=FS(e,n))&&void 0!==o?o:{})[zS(t)])&&void 0!==r?r:null}(e,r,n);t&&(x.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];vS(e,`Panel constraints not found for index ${a}`);const{defaultSize:i}=e;null!=i&&(o++,t[a]=i,r-=i)}for(let a=0;a<e.length;a++){const i=n[a];vS(i,`Panel constraints not found for index ${a}`);const{defaultSize:s}=i;if(null!=s)continue;const l=r/(e.length-o);o++,t[a]=l,r-=l}return t}({panelDataArray:r}));const i=US({layout:a,panelConstraints:r.map((e=>e.constraints))});AS(o,i)||(y(i),k.current.layout=i,t&&t(i),DS(r,i,v.current))}})),Pk((()=>{const e=k.current;return()=>{e.layout=[]}}),[]);const T=Nk((e=>function(t){t.preventDefault();const n=f.current;if(!n)return()=>null;const{direction:o,dragState:r,id:a,keyboardResizeBy:i,onLayout:s}=w.current,{layout:l,panelDataArray:c}=k.current,{initialLayout:d}=null!=r?r:{},u=jS(a,e,n);let h=OS(t,e,o,r,i,n);if(0===h)return;const m="horizontal"===o;"rtl"===document.dir&&m&&(h=-h);const p=SS({delta:h,initialLayout:null!=d?d:l,panelConstraints:c.map((e=>e.constraints)),pivotIndices:u,prevLayout:l,trigger:$k(t)?"keyboard":"mouse-or-touch"}),g=!PS(l,p);(Wk(t)||Gk(t))&&b.current!=h&&(b.current=h,mS(e,g?0:m?h<0?eS:tS:h<0?nS:oS)),g&&(y(p),k.current.layout=p,s&&s(p),DS(c,p,v.current))}),[]),A=Nk(((e,t)=>{const{onLayout:n}=w.current,{layout:o,panelDataArray:r}=k.current,a=r.map((e=>e.constraints)),{panelSize:i,pivotIndices:s}=qS(r,e,o);vS(null!=i,`Panel size not found for panel "${e.id}"`);const l=SS({delta:GS(r,e)===r.length-1?i-t:t-i,initialLayout:o,panelConstraints:a,pivotIndices:s,prevLayout:o,trigger:"imperative-api"});PS(o,l)||(y(l),k.current.layout=l,n&&n(l),DS(r,l,v.current))}),[]),M=Nk(((e,t)=>{const{layout:n,panelDataArray:o}=k.current,{collapsedSize:r=0,collapsible:a}=t,{collapsedSize:i=0,collapsible:s,maxSize:l=100,minSize:c=0}=e.constraints,{panelSize:d}=qS(o,e,n);null!=d&&(a&&s&&bS(d,r)?bS(r,i)||A(e,i):d<c?A(e,c):d>l&&A(e,l))}),[A]),O=Nk(((e,t)=>{const{direction:n}=w.current,{layout:o}=k.current;if(!f.current)return;const r=IS(e,f.current);vS(r,`Drag handle element not found for id "${e}"`);const a=MS(n,t);p({dragHandleId:e,dragHandleRect:r.getBoundingClientRect(),initialCursorPosition:a,initialLayout:o})}),[]),D=Nk((()=>{p(null)}),[]),P=Nk((e=>{const{panelDataArray:t}=k.current,n=GS(t,e);n>=0&&(t.splice(n,1),delete v.current[e.id],k.current.panelDataArrayChanged=!0)}),[]),R=Ik((()=>({collapsePanel:S,direction:o,dragState:m,expandPanel:N,getPanelSize:C,getPanelStyle:E,groupId:h,isPanelCollapsed:j,isPanelExpanded:_,reevaluatePanelConstraints:M,registerPanel:I,registerResizeHandle:T,resizePanel:A,startDragging:O,stopDragging:D,unregisterPanel:P,panelGroupElement:f.current})),[S,m,o,N,C,E,h,j,_,M,I,T,A,O,D,P]),L={display:"flex",flexDirection:"horizontal"===o?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return bk(Dk.Provider,{value:R},bk(d,{...u,children:t,className:n,id:a,ref:f,style:{...L,...c},"data-panel-group":"","data-panel-group-direction":o,"data-panel-group-id":h}))}const WS=Sk(((e,t)=>bk($S,{...e,forwardedRef:t})));function GS(e,t){return e.findIndex((e=>e===t||e.id===t.id))}function qS(e,t,n){const o=GS(e,t),r=o===e.length-1?[o-1,o]:[o,o+1],a=n[o];return{...t.constraints,panelSize:a,pivotIndices:r}}function YS({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:o,id:r,onDragging:a,style:i={},tabIndex:s=0,tagName:l="div",...c}){var d,u;const h=Tk(null),f=Tk({onDragging:a});Ek((()=>{f.current.onDragging=a}));const m=Ck(Dk);if(null===m)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:p,groupId:g,registerResizeHandle:y,startDragging:v,stopDragging:x,panelGroupElement:b}=m,w=zk(r),[k,S]=Ak("inactive"),[N,C]=Ak(!1),[E,j]=Ak(null),_=Tk({state:k});Pk((()=>{_.current.state=k})),Ek((()=>{if(n)j(null);else{const e=y(w);j((()=>e))}}),[n,w,y]);const I=null!==(d=null==o?void 0:o.coarse)&&void 0!==d?d:15,T=null!==(u=null==o?void 0:o.fine)&&void 0!==u?u:5;Ek((()=>{if(n||null==E)return;const e=h.current;vS(e,"Element ref not attached");return function(e,t,n,o,r){var a;const{ownerDocument:i}=t,s={direction:n,element:t,hitAreaMargins:o,setResizeHandlerState:r},l=null!==(a=sS.get(i))&&void 0!==a?a:0;return sS.set(i,l+1),cS.add(s),gS(),function(){var t;lS.delete(e),cS.delete(s);const n=null!==(t=sS.get(i))&&void 0!==t?t:1;sS.set(i,n-1),gS(),1===n&&sS.delete(i)}}(w,e,p,{coarse:I,fine:T},((e,t,n)=>{if(t)switch(e){case"down":{S("drag"),v(w,n);const{onDragging:e}=f.current;e&&e(!0);break}case"move":{const{state:e}=_.current;"drag"!==e&&S("hover"),E(n);break}case"up":{S("hover"),x();const{onDragging:e}=f.current;e&&e(!1);break}}else S("inactive")}))}),[I,p,n,T,y,w,E,v,x]),function({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:o}){Ek((()=>{if(e||null==n||null==o)return;const r=IS(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");vS(n,`No group element found for id "${n}"`);const a=CS(n,o),i=ES(n,t,o);vS(null!==i,`No resize element found for id "${t}"`),a[e.shiftKey?i>0?i-1:a.length-1:i+1<a.length?i+1:0].focus();break}}};return r.addEventListener("keydown",a),()=>{r.removeEventListener("keydown",a)}}),[o,e,t,n])}({disabled:n,handleId:w,resizeHandler:E,panelGroupElement:b});return bk(l,{...c,children:e,className:t,id:r,onBlur:()=>C(!1),onFocus:()=>C(!0),ref:h,role:"separator",style:{touchAction:"none",userSelect:"none",...i},tabIndex:s,"data-panel-group-direction":p,"data-panel-group-id":g,"data-resize-handle":"","data-resize-handle-active":"drag"===k?"pointer":N?"keyboard":void 0,"data-resize-handle-state":k,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":w})}$S.displayName="PanelGroup",WS.displayName="forwardRef(PanelGroup)",YS.displayName="PanelResizeHandle";const XS=e=>{const t=S(3);let n,o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=C.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=C.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},KS=e=>{const t=S(17);let n,o,r,a,i;t[0]!==e?(({children:a,tooltip:i,selected:n,className:o,...r}=e),t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=a,t[5]=i):(n=t[1],o=t[2],r=t[3],a=t[4],i=t[5]);const s=!n&&"hover:bg-[var(--sage-3)]",l=n&&"bg-[var(--sage-4)]";let c,d;t[6]!==s||t[7]!==l||t[8]!==o?(c=hn("h-full flex items-center p-2 text-sm shadow-inset font-mono cursor-pointer rounded",s,l,o),t[6]=s,t[7]=l,t[8]=o,t[9]=c):c=t[9],t[10]!==c||t[11]!==r||t[12]!==a?(d=C.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(i){let e;return t[14]!==i||t[15]!==u?(e=C.jsx(et,{content:i,side:"top",delayDuration:200,children:u}),t[14]=i,t[15]=u,t[16]=e):e=t[16],e}return u},JS=()=>{var e;const t=S(10),n=ee(QS),o=ee(oe),r=(null==(e=null==n?void 0:n.open_ai)?void 0:e.model)||"gpt-4-turbo",{handleClick:a}=eN();if(!o){let e,n;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=C.jsx(nd,{className:"h-4 w-4 opacity-60"}),t[0]=e):e=t[0],t[1]!==a?(n=C.jsx(KS,{tooltip:"Assist is disabled",selected:!1,onClick:a,children:e}),t[1]=a,t[2]=n):n=t[2],n}let i,s,l,c;return t[3]===Symbol.for("react.memo_cache_sentinel")?(i=C.jsx("b",{children:"Assist model:"}),t[3]=i):i=t[3],t[4]!==r?(s=C.jsxs(C.Fragment,{children:[i," ",r]}),t[4]=r,t[5]=s):s=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(l=C.jsx(nd,{className:"h-4 w-4"}),t[6]=l):l=t[6],t[7]!==s||t[8]!==a?(c=C.jsx(KS,{tooltip:s,onClick:a,selected:!1,children:l}),t[7]=s,t[8]=a,t[9]=c):c=t[9],c},ZS=H((e=>e(mi).completion.copilot)),QS=H((e=>e(mi).ai));function eN(){const e=S(5),t=ne(sl),n=ne($s);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 tN=()=>{const e=S(1);if("github"===ee(ZS)){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=C.jsx(nN,{}),e[0]=t):t=e[0],t}return null},nN=()=>{const e=S(10),t=ee(ll),n=null!==ee(cl),{handleClick:o}=eN(),r=t?"Ready":"Not connected";let a,i,s,l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=C.jsx("b",{children:"GitHub Copilot:"}),e[0]=a):a=e[0],e[1]!==r?(i=C.jsxs(C.Fragment,{children:[a," ",r]}),e[1]=r,e[2]=i):i=e[2],e[3]!==n||e[4]!==t?(s=C.jsx("span",{children:n?C.jsx(pi,{className:"h-4 w-4"}):C.jsx(XS,{className:hn("h-4 w-4",!t&&"opacity-60")})}),e[3]=n,e[4]=t,e[5]=s):s=e[5],e[6]!==i||e[7]!==o||e[8]!==s?(l=C.jsx(KS,{tooltip:i,selected:!1,onClick:o,children:s}),e[6]=i,e[7]=o,e[8]=s,e[9]=l):l=e[9],l},oN=e=>{const t=S(18),[n,o]=r.useState(0),a=ee(tt);let i,s,l,c;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>o((e=>e+1)),s={delayMs:1e4,whenVisible:!0},t[0]=i,t[1]=s):(i=t[0],s=t[1]),Ys(i,s),t[2]!==a.state?(l=async()=>N()||a.state!==ot.OPEN?null:gi(),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}=dn(l,c);let u,h,f,m,p;return t[7]!==d?(u=d&&C.jsx(aN,{memory:d.memory,kernel:d.kernel,server:d.server}),t[7]=d,t[8]=u):u=t[8],t[9]!==d?(h=d&&C.jsx(iN,{cpu:d.cpu}),t[9]=d,t[10]=h):h=t[10],t[11]===Symbol.for("react.memo_cache_sentinel")?(f=C.jsxs("div",{className:"flex items-center",children:[C.jsx(JS,{}),C.jsx(tN,{})]}),t[11]=f):f=t[11],t[12]!==a.state?(m=C.jsx(rN,{connection:a.state}),t[12]=a.state,t[13]=m):m=t[13],t[14]!==u||t[15]!==h||t[16]!==m?(p=C.jsxs("div",{className:"flex gap-2 items-center",children:[u,h,f,m]}),t[14]=u,t[15]=h,t[16]=m,t[17]=p):p=t[17],p},rN=e=>{const t=S(18),{connection:n}=e;let o,r,a,i,s,l,c;return t[0]!==n?(o=k(n.toLowerCase()),t[0]=n,t[1]=o):o=t[1],t[2]!==n?(r=n===ot.OPEN&&C.jsx(hc,{className:"w-4 h-4"}),t[2]=n,t[3]=r):r=t[3],t[4]!==n?(a=n===ot.CLOSED&&C.jsx(dl,{className:"w-4 h-4"}),t[4]=n,t[5]=a):a=t[5],t[6]!==n?(i=n===ot.CONNECTING&&C.jsx(pi,{size:"small"}),t[6]=n,t[7]=i):i=t[7],t[8]!==n?(s=n===ot.CLOSING&&C.jsx(pi,{className:"text-destructive",size:"small"}),t[8]=n,t[9]=s):s=t[9],t[10]!==r||t[11]!==a||t[12]!==i||t[13]!==s?(l=C.jsxs("div",{children:[r,a,i,s]}),t[10]=r,t[11]=a,t[12]=i,t[13]=s,t[14]=l):l=t[14],t[15]!==o||t[16]!==l?(c=C.jsx(et,{delayDuration:200,content:o,children:l}),t[15]=o,t[16]=l,t[17]=c):c=t[17],c},aN=e=>{const t=S(25),{memory:n,kernel:o,server:r}=e,{percent:a,total:i,used:s}=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,f,m,p,g,y,v,x;return t[2]===Symbol.for("react.memo_cache_sentinel")?(d=C.jsx("b",{children:"computer memory:"}),t[2]=d):d=t[2],t[3]!==s?(u=cN(s),t[3]=s,t[4]=u):u=t[4],t[5]!==i?(h=cN(i),t[5]=i,t[6]=h):h=t[6],t[7]!==u||t[8]!==h||t[9]!==c?(f=C.jsxs("span",{children:[d," ",u," / ",h," GB (",c,"%)"]}),t[7]=u,t[8]=h,t[9]=c,t[10]=f):f=t[10],t[11]!==(null==r?void 0:r.memory)?(m=(null==r?void 0:r.memory)&&C.jsxs("span",{children:[C.jsx("b",{children:"marimo server:"})," ",lN(r.memory)]}),t[11]=null==r?void 0:r.memory,t[12]=m):m=t[12],t[13]!==(null==o?void 0:o.memory)?(p=(null==o?void 0:o.memory)&&C.jsxs("span",{children:[C.jsx("b",{children:"kernel:"})," ",lN(o.memory)]}),t[13]=null==o?void 0:o.memory,t[14]=p):p=t[14],t[15]!==f||t[16]!==m||t[17]!==p?(g=C.jsxs("div",{className:"flex flex-col gap-1",children:[f,m,p]}),t[15]=f,t[16]=m,t[17]=p,t[18]=g):g=t[18],t[19]===Symbol.for("react.memo_cache_sentinel")?(y=C.jsx(Lc,{className:"w-4 h-4"}),t[19]=y):y=t[19],t[20]!==c?(v=C.jsxs("div",{className:"flex items-center gap-1",children:[y,C.jsx(sN,{percent:c})]}),t[20]=c,t[21]=v):v=t[21],t[22]!==g||t[23]!==v?(x=C.jsx(et,{delayDuration:200,content:g,children:v}),t[22]=g,t[23]=v,t[24]=x):x=t[24],x},iN=e=>{const t=S(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 i,s,l,c,d;return t[2]===Symbol.for("react.memo_cache_sentinel")?(i=C.jsx("b",{children:"CPU:"}),t[2]=i):i=t[2],t[3]!==a?(s=C.jsxs("span",{children:[i," ",a,"%"]}),t[3]=a,t[4]=s):s=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(l=C.jsx(ul,{className:"w-4 h-4"}),t[5]=l):l=t[5],t[6]!==a?(c=C.jsxs("div",{className:"flex items-center gap-1",children:[l,C.jsx(sN,{percent:a})]}),t[6]=a,t[7]=c):c=t[7],t[8]!==s||t[9]!==c?(d=C.jsx(et,{delayDuration:200,content:s,children:c}),t[8]=s,t[9]=c,t[10]=d):d=t[10],d},sN=e=>{const t=S(2),{percent:n}=e,o=`${n}%`;let r;return t[0]!==o?(r=C.jsx("div",{className:"h-3 w-20 bg-[var(--slate-4)] rounded-lg overflow-hidden border",children:C.jsx("div",{className:"h-full bg-primary",style:{width:o}})}),t[0]=o,t[1]=r):r=t[1],r};function lN(e){return e>1073741824?`${cN(e)} GB`:`${function(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(e/1048576)}(e)} MB`}function cN(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e/1073741824)}const dN=e=>ee(ni)[e.capability]?e.children:null,uN=()=>{const e=S(56),{selectedPanel:t,isTerminalOpen:n}=mu(),{openApplication:o,toggleTerminal:r}=pu(),[a,i]=_e(),s=ee(yi),l=hN,c=gu.find(fN);let d;Xt(c,"Error panel not found"),e[0]!==r?(d=()=>{r()},e[0]=r,e[1]=d):d=e[1],qs("global.toggleTerminal",d);const u=KS,h=c.tooltip,f=t===c.type,m=()=>o(c.type),p=l(c,s>0?"text-destructive":"");let g,y,v,x,b;e[2]!==s?(g=C.jsx("span",{className:"ml-1 font-mono mt-[0.125rem]",children:s}),e[2]=s,e[3]=g):g=e[3],e[4]!==u||e[5]!==c.tooltip||e[6]!==f||e[7]!==m||e[8]!==p||e[9]!==g?(y=C.jsxs(u,{tooltip:h,selected:f,onClick:m,children:[p,g]}),e[4]=u,e[5]=c.tooltip,e[6]=f,e[7]=m,e[8]=p,e[9]=g,e[10]=y):y=e[10],e[11]!==r?(v=()=>r(),e[11]=r,e[12]=v):v=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(x=C.jsx(dd,{className:"h-5 w-5"}),e[13]=x):x=e[13],e[14]!==n||e[15]!==v?(b=C.jsx(dN,{capability:"terminal",children:C.jsx(KS,{tooltip:"Open terminal",selected:n,onClick:v,children:x})}),e[14]=n,e[15]=v,e[16]=b):b=e[16];const w=a.runtime.auto_instantiate?"Disable autorun on startup":"Enable autorun on startup";let k,E,j;e[17]!==a||e[18]!==i?(k=async()=>{const e={...a,runtime:{...a.runtime,auto_instantiate:!a.runtime.auto_instantiate}};await Te({config:e}).then((()=>i(e)))},e[17]=a,e[18]=i,e[19]=k):k=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(E=C.jsx("span",{children:"on startup: "}),e[20]=E):E=e[20],e[21]!==a.runtime.auto_instantiate?(j=a.runtime.auto_instantiate?C.jsx(vd,{size:14}):C.jsx(yd,{size:14}),e[21]=a.runtime.auto_instantiate,e[22]=j):j=e[22];const _=a.runtime.auto_instantiate?"autorun":"lazy";let I,T,A,M;e[23]!==_?(I=C.jsx("span",{children:_}),e[23]=_,e[24]=I):I=e[24],e[25]!==j||e[26]!==I?(T=C.jsxs("div",{className:"font-prose text-sm flex items-center gap-1",children:[E,j,I]}),e[25]=j,e[26]=I,e[27]=T):T=e[27],e[28]!==w||e[29]!==k||e[30]!==T?(A=C.jsx(KS,{tooltip:w,selected:!1,onClick:k,children:T}),e[28]=w,e[29]=k,e[30]=T,e[31]=A):A=e[31],e[32]===Symbol.for("react.memo_cache_sentinel")?(M=C.jsx("div",{className:"border-r border-border h-6 mx-1"}),e[32]=M):M=e[32];const O="autorun"===a.runtime.on_cell_change?"Disable autorun":"Enable autorun";let D,P,R,L,z,F,B,U,V,H;return e[33]!==a||e[34]!==i?(D=async()=>{const e={...a,runtime:{...a.runtime,on_cell_change:"autorun"===a.runtime.on_cell_change?"lazy":"autorun"}};await Te({config:e}).then((()=>i(e)))},e[33]=a,e[34]=i,e[35]=D):D=e[35],e[36]===Symbol.for("react.memo_cache_sentinel")?(P=C.jsx("span",{children:"on cell change: "}),e[36]=P):P=e[36],e[37]!==a.runtime.on_cell_change?(R=C.jsxs("div",{className:"font-prose text-sm flex items-center gap-1",children:[P,"autorun"===a.runtime.on_cell_change?C.jsx(vd,{size:14}):C.jsx(yd,{size:14}),C.jsx("span",{children:a.runtime.on_cell_change})]}),e[37]=a.runtime.on_cell_change,e[38]=R):R=e[38],e[39]!==O||e[40]!==D||e[41]!==R?(L=C.jsx(KS,{tooltip:O,selected:!1,onClick:D,children:R}),e[39]=O,e[40]=D,e[41]=R,e[42]=L):L=e[42],e[43]===Symbol.for("react.memo_cache_sentinel")?(z=C.jsx("div",{className:"border-r border-border h-6 mx-1"}),e[43]=z):z=e[43],e[44]!==a||e[45]!==i?(F=!N()&&C.jsx(KS,{tooltip:null,selected:!1,children:C.jsxs(Wt,{children:[C.jsxs(Ft,{className:"font-prose text-sm flex items-center gap-1",children:[C.jsx("span",{children:"on module change: "}),"off"===a.runtime.auto_reload&&C.jsx(dl,{size:14}),"lazy"===a.runtime.auto_reload&&C.jsx(yd,{size:14}),"autorun"===a.runtime.auto_reload&&C.jsx(vd,{size:14}),C.jsx("span",{children:a.runtime.auto_reload}),C.jsx(ve,{size:14})]}),C.jsx(Gt,{children:["off","lazy","autorun"].map((e=>C.jsxs(zt,{onClick:async()=>{const t={...a,runtime:{...a.runtime,auto_reload:e}};await Te({config:t}).then((()=>i(t)))},children:["off"===e&&C.jsx(dl,{size:14,className:"mr-2 text-muted-foreground"}),"lazy"===e&&C.jsx(yd,{size:14,className:"mr-2 text-muted-foreground"}),"autorun"===e&&C.jsx(vd,{size:14,className:"mr-2 text-muted-foreground"}),e]},e)))})]})}),e[44]=a,e[45]=i,e[46]=F):F=e[46],e[47]===Symbol.for("react.memo_cache_sentinel")?(B=C.jsx("div",{className:"mx-auto"}),e[47]=B):B=e[47],e[48]===Symbol.for("react.memo_cache_sentinel")?(U=C.jsx(sh,{children:C.jsx(et,{content:C.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:C.jsx("span",{className:"text-muted-foreground text-sm mr-4",children:"kiosk mode"})})}),V=C.jsx(oN,{}),e[48]=U,e[49]=V):(U=e[48],V=e[49]),e[50]!==y||e[51]!==b||e[52]!==A||e[53]!==L||e[54]!==F?(H=C.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:[y,b,A,M,L,z,F,B,U,V]}),e[50]=y,e[51]=b,e[52]=A,e[53]=L,e[54]=F,e[55]=H):H=e[55],H};function hN(e,t){const{Icon:n}=e;return C.jsx(n,{className:hn("h-5 w-5",t)})}function fN(e){return"errors"===e.type}const mN=e=>{const t=S(6),{children:n}=e,{openModal:o,closeModal:r}=te();let a,i;return t[0]!==o||t[1]!==r?(a=()=>o(C.jsx(pN,{onClose:r})),t[0]=o,t[1]=r,t[2]=a):a=t[2],t[3]!==a||t[4]!==n?(i=C.jsx(vi,{onClick:a,children:n}),t[3]=a,t[4]=n,t[5]=i):i=t[5],i},pN=e=>{const t=S(9),{onClose:n}=e;let o,r,a,i,s,l,c;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(),K({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=C.jsx(Ne,{children:"Send Feedback"}),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(a=C.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We want to hear from you — from minor bug reports to wishlist features and everything in between. Here are some ways you can get in touch:"}),t[3]=a):a=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(i=C.jsxs("li",{className:"my-0",children:["Take our"," ",C.jsx("a",{href:qe.feedbackForm,target:"_blank",rel:"noreferrer",className:"underline",children:"two-minute survey."})]}),t[4]=i):i=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(s=C.jsxs("li",{className:"my-0",children:["File a"," ",C.jsx("a",{href:qe.issuesPage,target:"_blank",rel:"noreferrer",className:"underline",children:"GitHub issue."})]}),t[5]=s):s=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(l=C.jsxs(Se,{children:[r,C.jsxs(Ye,{children:[a,C.jsxs("ul",{className:"list-disc ml-8 my-2 prose dark:prose-invert",children:[i,s,C.jsxs("li",{className:"my-0",children:["Chat with us on"," ",C.jsx("a",{href:qe.discordLink,target:"_blank",rel:"noreferrer",className:"underline",children:"Discord."})]})]}),C.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We're excited you're here as we build the future of Python data tooling. Thanks for being part of our community!"})]})]}),t[6]=l):l=t[6],t[7]!==o?(c=C.jsx(ke,{className:"w-fit",children:C.jsx("form",{onSubmit:o,children:l})}),t[7]=o,t[8]=c):c=t[8],c},gN=()=>{const e=S(10),{selectedPanel:t}=mu(),{openApplication:n}=pu(),o=xN;let r,a,i,s,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=gu.filter(bN).map((e=>C.jsx(vN,{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")?(i=C.jsx(mN,{children:C.jsx(vN,{tooltip:"Send feedback!",selected:!1,children:C.jsx(zc,{className:"h-5 w-5"})})}),s=C.jsx("div",{className:"flex-1"}),l=C.jsx(yN,{}),e[4]=i,e[5]=s,e[6]=l):(i=e[4],s=e[5],l=e[6]),e[7]!==r||e[8]!==a?(c=C.jsxs("div",{className:r,children:[a,i,s,l]}),e[7]=r,e[8]=a,e[9]=c):c=e[9],c},yN=()=>{const e=S(9),t=ee(xi);let n,o,r,a;return e[0]!==t?(n=t>0?C.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(wN),e[2]=t,e[3]=o):o=e[3],e[4]!==o?(r=C.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=C.jsx(et,{content:n,side:"right",delayDuration:200,children:r}),e[6]=n,e[7]=r,e[8]=a):a=e[8],a},vN=e=>{const t=S(17);let n,o,r,a,i;t[0]!==e?(({children:a,tooltip:i,selected:n,className:o,...r}=e),t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=a,t[5]=i):(n=t[1],o=t[2],r=t[3],a=t[4],i=t[5]);const s=!n&&"hover:bg-[var(--sage-3)]",l=n&&"bg-[var(--sage-4)]";let c,d,u;return t[6]!==s||t[7]!==l||t[8]!==o?(c=hn("flex items-center p-2 text-sm mx-[1px] shadow-inset font-mono cursor-pointer rounded",s,l,o),t[6]=s,t[7]=l,t[8]=o,t[9]=c):c=t[9],t[10]!==c||t[11]!==r||t[12]!==a?(d=C.jsx("div",{className:c,...r,children:a}),t[10]=c,t[11]=r,t[12]=a,t[13]=d):d=t[13],t[14]!==i||t[15]!==d?(u=C.jsx(et,{content:i,side:"right",delayDuration:200,children:d}),t[14]=i,t[15]=d,t[16]=u):u=t[16],u};function xN(e,t){const{Icon:n}=e;return C.jsx(n,{className:hn("h-5 w-5",t)})}function bN(e){return!e.hidden&&"sidebar"===e.position}function wN(e,t){return C.jsx("div",{className:"flex-shrink-0 h-1 w-2 bg-[var(--grass-6)] border border-[var(--grass-7)]"},t.toString())}st.record(st.tuple([st.number(),st.number()]));let kN=null;const SN=e=>{const t=S(12),{title:n,description:o,icon:r}=e;let a,i,s,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?(i=C.jsx("span",{className:"mt-1 text-accent-foreground",children:n}),t[2]=n,t[3]=i):i=t[3],t[4]!==a||t[5]!==i?(s=C.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[a,i]}),t[4]=a,t[5]=i,t[6]=s):s=t[6],t[7]!==o?(l=C.jsx("span",{className:"text-muted-foreground text-sm",children:o}),t[7]=o,t[8]=l):l=t[8],t[9]!==s||t[10]!==l?(c=C.jsxs("div",{className:"mx-6 my-6 flex flex-col gap-2",children:[s,l]}),t[9]=s,t[10]=l,t[11]=c):c=t[11],c},NN=()=>{const e=S(5),t=bi();if(0===t.length){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=C.jsx(SN,{title:"No errors!",icon:C.jsx(Wc,{})}),e[0]=t):t=e[0],t}let n,o;return e[1]!==t?(n=t.map(CN),e[1]=t,e[2]=n):n=e[2],e[3]!==n?(o=C.jsx("div",{className:"flex flex-col overflow-auto",children:n}),e[3]=n,e[4]=o):o=e[4],o};function CN(e){return C.jsxs("div",{children:[C.jsx("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:C.jsx(wi,{cellId:e.cellId})}),C.jsx("div",{className:"px-2",children:C.jsx(ki,{errors:e.output.data},e.cellId)},e.cellId)]},e.cellId)}const EN=()=>{const e=S(6),{items:t}=ee(Si);let n,o;e[0]!==t?(o=Vl(t),e[0]=t,e[1]=o):o=e[1],n=o;const r=n,{activeHeaderId:a}=Hl(r);if(0===t.length){let t;return e[2]===Symbol.for("react.memo_cache_sentinel")?(t=C.jsx(SN,{title:"No outline",description:"Add markdown headings to your notebook to create an outline.",icon:C.jsx(ed,{})}),e[2]=t):t=e[2],t}let i;return e[3]!==t||e[4]!==a?(i=C.jsx($l,{items:t,activeHeaderId:a}),e[3]=t,e[4]=a,e[5]=i):i=e[5],i};function jN(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=jN(e[o]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}const{useDebugValue:_N}=u,{useSyncExternalStoreWithSelector:IN}=Ni,TN=e=>e;function AN(e,t=TN,n){const o=IN(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return _N(o),o}const MN=(e,t)=>{const n=Ci(e),o=(e,o=t)=>AN(n,e,o);return Object.assign(o,n),o};function ON(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 DN(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 PN={passive:!1},RN={capture:!0,passive:!1};function LN(e){e.stopImmediatePropagation()}function zN(e){e.preventDefault(),e.stopImmediatePropagation()}function FN(e){var t=e.document.documentElement,n=Yl(e).on("dragstart.drag",zN,RN);"onselectstart"in t?n.on("selectstart.drag",zN,RN):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function BN(e,t){var n=e.document.documentElement,o=Yl(e).on("dragstart.drag",null);t&&(o.on("click.drag",zN,RN),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 UN=e=>()=>e;function VN(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:a,x:i,y:s,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:i,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}function HN(e){return!e.ctrlKey&&!e.button}function $N(){return this.parentNode}function WN(e,t){return null==t?{x:e.x,y:e.y}:t}function GN(){return navigator.maxTouchPoints||"ontouchstart"in this}VN.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};const qN=e=>()=>e;function YN(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 XN(e){e.stopImmediatePropagation()}function KN(e){e.preventDefault(),e.stopImmediatePropagation()}function JN(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function ZN(){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 QN(){return this.__zoom||Xl}function eC(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function tC(){return navigator.maxTouchPoints||"ontouchstart"in this}function nC(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],i=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>a?(a+i)/2:Math.min(0,a)||Math.max(0,i))}const oC=r.createContext(null),rC=oC.Provider,aC=e=>`Node type "${e}" not found. Using fallback type "default".`,iC=()=>"The React Flow parent container needs a width and a height to render the graph.",sC=()=>"Only child nodes can use a parent extent.",lC=e=>`Marker type "${e}" doesn't exist.`,cC=(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,dC=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",uC=e=>`Edge type "${e}" not found. Using fallback type "default".`,hC=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.`,fC=(()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001")();function mC(e,t){const n=r.useContext(oC);if(null===n)throw new Error(fC);return AN(n,e,t)}const pC=()=>{const e=r.useContext(oC);if(null===e)throw new Error(fC);return r.useMemo((()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy})),[e])},gC=e=>e.userSelectionActive?"none":"all";function yC({position:e,children:t,className:n,style:o,...r}){const a=mC(gC),i=`${e}`.split("-");return u.createElement("div",{className:jN(["react-flow__panel",n,...i]),style:{...o,pointerEvents:a},...r},t)}function vC({proOptions:e,position:t="bottom-right"}){return(null==e?void 0:e.hideAttribution)?null:u.createElement(yC,{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 xC=r.memo((({x:e,y:t,label:n,labelStyle:o={},labelShowBg:a=!0,labelBgStyle:i={},labelBgPadding:s=[2,4],labelBgBorderRadius:l=2,children:c,className:d,...h})=>{const f=r.useRef(null),[m,p]=r.useState({x:0,y:0,width:0,height:0}),g=jN(["react-flow__edge-textwrapper",d]);return r.useEffect((()=>{if(f.current){const e=f.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-m.width/2} ${t-m.height/2})`,className:g,visibility:m.width?"visible":"hidden",...h},a&&u.createElement("rect",{width:m.width+2*s[0],x:-s[0],y:-s[1],height:m.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),u.createElement("text",{className:"react-flow__edge-text",y:m.height/2,dy:"0.3em",ref:f,style:o},n),c):null}));const bC=e=>({width:e.offsetWidth,height:e.offsetHeight}),wC=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),kC=(e={x:0,y:0},t)=>({x:wC(e.x,t[0][0],t[1][0]),y:wC(e.y,t[0][1],t[1][1])}),SC=(e,t,n)=>e<t?wC(Math.abs(e-t),1,50)/50:e>n?-wC(Math.abs(e-n),1,50)/50:0,NC=(e,t)=>[20*SC(e.x,35,t.width-35),20*SC(e.y,35,t.height-35)],CC=e=>{var t;return(null==(t=e.getRootNode)?void 0:t.call(e))||(null==window?void 0:window.document)},EC=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),jC=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),_C=(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)},IC=e=>!isNaN(e)&&isFinite(e),TC=Symbol.for("internals"),AC=["Enter"," ","Escape"];function MC(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 OC=e=>"clientX"in e,DC=(e,t)=>{var n,o;const r=OC(e),a=r?e.clientX:null==(n=e.touches)?void 0:n[0].clientX,i=r?e.clientY:null==(o=e.touches)?void 0:o[0].clientY;return{x:a-((null==t?void 0:t.left)??0),y:i-((null==t?void 0:t.top)??0)}},PC=()=>{var e;return"undefined"!=typeof navigator&&(null==(e=null==navigator?void 0:navigator.userAgent)?void 0:e.indexOf("Mac"))>=0},RC=({id:e,path:t,labelX:n,labelY:o,label:r,labelStyle:a,labelShowBg:i,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:f,interactionWidth:m=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:f}),m&&u.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:m,className:"react-flow__edge-interaction"}),r&&IC(n)&&IC(o)?u.createElement(xC,{x:n,y:o,label:r,labelStyle:a,labelShowBg:i,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:c}):null);function LC(e,t,n){return void 0===n?n:o=>{const r=t().edges.find((t=>t.id===e));r&&n(o,{...r})}}function zC({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,a=n<e?n+r:n-r,i=Math.abs(o-t)/2;return[a,o<t?o+i:o-i,r,i]}function FC({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:a,targetControlX:i,targetControlY:s}){const l=.125*e+.375*r+.375*i+.125*n,c=.125*t+.375*a+.375*s+.125*o;return[l,c,Math.abs(l-e),Math.abs(c-t)]}var BC,UC,VC,HC,$C,WC,GC,qC,YC,XC,KC,JC;function ZC({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===KC.Left||e===KC.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function QC({sourceX:e,sourceY:t,sourcePosition:n=KC.Bottom,targetX:o,targetY:r,targetPosition:a=KC.Top}){const[i,s]=ZC({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=ZC({pos:a,x1:o,y1:r,x2:e,y2:t}),[d,u,h,f]=FC({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:i,sourceControlY:s,targetControlX:l,targetControlY:c});return[`M${e},${t} C${i},${s} ${l},${c} ${o},${r}`,d,u,h,f]}RC.displayName="BaseEdge",(UC=BC||(BC={})).Strict="strict",UC.Loose="loose",(HC=VC||(VC={})).Free="free",HC.Vertical="vertical",HC.Horizontal="horizontal",(WC=$C||($C={})).Partial="partial",WC.Full="full",(qC=GC||(GC={})).Bezier="default",qC.Straight="straight",qC.Step="step",qC.SmoothStep="smoothstep",qC.SimpleBezier="simplebezier",(XC=YC||(YC={})).Arrow="arrow",XC.ArrowClosed="arrowclosed",(JC=KC||(KC={})).Left="left",JC.Top="top",JC.Right="right",JC.Bottom="bottom";const eE=r.memo((({sourceX:e,sourceY:t,targetX:n,targetY:o,sourcePosition:r=KC.Bottom,targetPosition:a=KC.Top,label:i,labelStyle:s,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:p,interactionWidth:g})=>{const[y,v,x]=QC({sourceX:e,sourceY:t,sourcePosition:r,targetX:n,targetY:o,targetPosition:a});return u.createElement(RC,{path:y,labelX:v,labelY:x,label:i,labelStyle:s,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:p,interactionWidth:g})}));eE.displayName="SimpleBezierEdge";const tE={[KC.Left]:{x:-1,y:0},[KC.Right]:{x:1,y:0},[KC.Top]:{x:0,y:-1},[KC.Bottom]:{x:0,y:1}},nE=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function oE({source:e,sourcePosition:t=KC.Bottom,target:n,targetPosition:o=KC.Top,center:r,offset:a}){const i=tE[t],s=tE[o],l={x:e.x+i.x*a,y:e.y+i.y*a},c={x:n.x+s.x*a,y:n.y+s.y*a},d=(({source:e,sourcePosition:t=KC.Bottom,target:n})=>t===KC.Left||t===KC.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 f,m,p=[];const g={x:0,y:0},y={x:0,y:0},[v,x,b,w]=zC({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(i[u]*s[u]==-1){f=r.x??v,m=r.y??x;const e=[{x:f,y:l.y},{x:f,y:c.y}],t=[{x:l.x,y:m},{x:c.x,y:m}];p=i[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?i.x===h?d:r:i.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);i[u]===h?g[u]=(l[u]>e[u]?-1:1)*o:y[u]=(c[u]>n[u]?-1:1)*o}}if(t!==o){const e="x"===u?"y":"x",t=i[u]===s[e],n=l[e]>c[e],o=l[e]<c[e];(1===i[u]&&(!t&&n||t&&o)||1!==i[u]&&(!t&&o||t&&n))&&(p="x"===u?r:d)}const v={x:l.x+g.x,y:l.y+g.y},x={x:c.x+y.x,y:c.y+y.y};Math.max(Math.abs(v.x-p[0].x),Math.abs(x.x-p[0].x))>=Math.max(Math.abs(v.y-p[0].y),Math.abs(x.y-p[0].y))?(f=(v.x+x.x)/2,m=p[0].y):(f=p[0].x,m=(v.y+x.y)/2)}return[[e,{x:l.x+g.x,y:l.y+g.y},...p,{x:c.x+y.x,y:c.y+y.y},n],f,m,b,w]}function rE({sourceX:e,sourceY:t,sourcePosition:n=KC.Bottom,targetX:o,targetY:r,targetPosition:a=KC.Top,borderRadius:i=5,centerX:s,centerY:l,offset:c=20}){const[d,u,h,f,m]=oE({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:a,center:{x:s,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(nE(e,t)/2,nE(t,n)/2,o),{x:a,y:i}=t;if(e.x===a&&a===n.x||e.y===i&&i===n.y)return`L${a} ${i}`;if(e.y===i)return`L ${a+r*(e.x<n.x?-1:1)},${i}Q ${a},${i} ${a},${i+r*(e.y<n.y?1:-1)}`;const s=e.x<n.x?1:-1;return`L ${a},${i+r*(e.y<n.y?-1:1)}Q ${a},${i} ${a+r*s},${i}`}(d[n-1],t,d[n+1],i):`${0===n?"M":"L"}${t.x} ${t.y}`,e+=o}),""),u,h,f,m]}const aE=r.memo((({sourceX:e,sourceY:t,targetX:n,targetY:o,label:r,labelStyle:a,labelShowBg:i,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:c,style:d,sourcePosition:h=KC.Bottom,targetPosition:f=KC.Top,markerEnd:m,markerStart:p,pathOptions:g,interactionWidth:y})=>{const[v,x,b]=rE({sourceX:e,sourceY:t,sourcePosition:h,targetX:n,targetY:o,targetPosition:f,borderRadius:null==g?void 0:g.borderRadius,offset:null==g?void 0:g.offset});return u.createElement(RC,{path:v,labelX:x,labelY:b,label:r,labelStyle:a,labelShowBg:i,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:m,markerStart:p,interactionWidth:y})}));aE.displayName="SmoothStepEdge";const iE=r.memo((e=>{var t;return u.createElement(aE,{...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])})}));iE.displayName="StepEdge";const sE=r.memo((({sourceX:e,sourceY:t,targetX:n,targetY:o,label:r,labelStyle:a,labelShowBg:i,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:f,interactionWidth:m})=>{const[p,g,y]=function({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,a,i,s]=zC({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,a,i,s]}({sourceX:e,sourceY:t,targetX:n,targetY:o});return u.createElement(RC,{path:p,labelX:g,labelY:y,label:r,labelStyle:a,labelShowBg:i,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:f,interactionWidth:m})}));function lE(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function cE({pos:e,x1:t,y1:n,x2:o,y2:r,c:a}){switch(e){case KC.Left:return[t-lE(t-o,a),n];case KC.Right:return[t+lE(o-t,a),n];case KC.Top:return[t,n-lE(n-r,a)];case KC.Bottom:return[t,n+lE(r-n,a)]}}function dE({sourceX:e,sourceY:t,sourcePosition:n=KC.Bottom,targetX:o,targetY:r,targetPosition:a=KC.Top,curvature:i=.25}){const[s,l]=cE({pos:n,x1:e,y1:t,x2:o,y2:r,c:i}),[c,d]=cE({pos:a,x1:o,y1:r,x2:e,y2:t,c:i}),[u,h,f,m]=FC({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${e},${t} C${s},${l} ${c},${d} ${o},${r}`,u,h,f,m]}sE.displayName="StraightEdge";const uE=r.memo((({sourceX:e,sourceY:t,targetX:n,targetY:o,sourcePosition:r=KC.Bottom,targetPosition:a=KC.Top,label:i,labelStyle:s,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:p,pathOptions:g,interactionWidth:y})=>{const[v,x,b]=dE({sourceX:e,sourceY:t,sourcePosition:r,targetX:n,targetY:o,targetPosition:a,curvature:null==g?void 0:g.curvature});return u.createElement(RC,{path:v,labelX:x,labelY:b,label:i,labelStyle:s,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:p,interactionWidth:y})}));uE.displayName="BezierEdge";const hE=r.createContext(null),fE=hE.Provider;hE.Consumer;const mE=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`reactflow__edge-${e}${t||""}-${n}${o||""}`,pE=(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("&")}`},gE=({x:e,y:t},[n,o,r],a,[i,s])=>{const l={x:(e-n)/r,y:(t-o)/r};return a?{x:i*Math.round(l.x/i),y:s*Math.round(l.y/s)}:l},yE=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o}),vE=(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}},xE=(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}=vE(n,t).positionAbsolute;return a=e,i=EC({x:o,y:r,width:n.width||0,height:n.height||0}),{x:Math.min(a.x,i.x),y:Math.min(a.y,i.y),x2:Math.max(a.x2,i.x2),y2:Math.max(a.y2,i.y2)};var a,i}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0}))},bE=(e,t,[n,o,r]=[0,0,1],a=!1,i=!1,s=[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(i&&!o||r)return!1;const{positionAbsolute:d}=vE(e,s),u={x:d.x,y:d.y,width:t||0,height:n||0},h=_C(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},wE=(e,t)=>{const n=e.map((e=>e.id));return t.filter((e=>n.includes(e.source)||n.includes(e.target)))},kE=(e,t,n,o,r,a=.1)=>{const i=t/(e.width*(1+a)),s=n/(e.height*(1+a)),l=Math.min(i,s),c=wC(l,o,r);return{x:t/2-(e.x+e.width/2)*c,y:n/2-(e.y+e.height/2)*c,zoom:c}},SE=(e,t=0)=>e.transition().duration(t);function NE(e,t,n,o){return(t[n]||[]).reduce(((t,r)=>{var a,i;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==(i=e.positionAbsolute)?void 0:i.y)??0)+r.y+r.height/2}),t}),[])}const CE={source:null,target:null,sourceHandle:null,targetHandle:null},EE=()=>({handleDomNode:null,isValid:!1,connection:CE,endHandle:null});function jE(e,t,n,o,r,a,i){const s="target"===r,l=i.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={...EE(),handleDomNode:l};if(l){const e=_E(void 0,l),r=l.getAttribute("data-nodeid"),i=l.getAttribute("data-handleid"),d=l.classList.contains("connectable"),u=l.classList.contains("connectableend"),h={source:s?r:n,sourceHandle:s?i:o,target:s?n:r,targetHandle:s?o:i};c.connection=h;d&&u&&(t===BC.Strict?s&&"source"===e||!s&&"target"===e:r!==n||i!==o)&&(c.endHandle={nodeId:r,handleId:i,type:e},c.isValid=a(h))}return c}function _E(e,t){return e||((null==t?void 0:t.classList.contains("target"))?"target":(null==t?void 0:t.classList.contains("source"))?"source":null)}function IE(e){null==e||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function TE(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function AE({event:e,handleId:t,nodeId:n,onConnect:o,isTarget:r,getState:a,setState:i,isValidConnection:s,edgeUpdaterType:l,onReconnectEnd:c}){const d=CC(e.target),{connectionMode:u,domNode:h,autoPanOnConnect:f,connectionRadius:m,onConnectStart:p,panBy:g,getNodes:y,cancelConnection:v}=a();let x,b=0;const{x:w,y:k}=DC(e),S=null==d?void 0:d.elementFromPoint(w,k),N=_E(l,S),C=null==h?void 0:h.getBoundingClientRect();if(!C||!N)return;let E,j=DC(e,C),_=!1,I=null,T=!1,A=null;const M=function({nodes:e,nodeId:t,handleId:n,handleType:o}){return e.reduce(((e,r)=>{if(r[TC]){const{handleBounds:a}=r[TC];let i=[],s=[];a&&(i=NE(r,a,"source",`${t}-${n}-${o}`),s=NE(r,a,"target",`${t}-${n}-${o}`)),e.push(...i,...s)}return e}),[])}({nodes:y(),nodeId:n,handleId:t,handleType:N}),O=()=>{if(!f)return;const[e,t]=NC(j,C);g({x:e,y:t}),b=requestAnimationFrame(O)};function D(e){const{transform:o}=a();j=DC(e,C);const{handle:l,validHandleResult:c}=function(e,t,n,o,r,a){const{x:i,y:s}=DC(e),l=t.elementsFromPoint(i,s).find((e=>e.classList.contains("react-flow__handle")));if(l){const e=l.getAttribute("data-nodeid");if(e){const t=_E(void 0,l),o=l.getAttribute("data-handleid"),i=a({nodeId:e,id:o,type:t});if(i){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:i}}}}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:EE()};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,gE(j,o,!1,[1,1]),m,M,(e=>jE(e,u,n,t,r?"target":"source",s,d)));if(x=l,_||(O(),_=!0),A=c.handleDomNode,I=c.connection,T=c.isValid,i({connectionPosition:x&&T?yE({x:x.x,y:x.y},o):j,connectionStatus:TE(!!x,T),connectionEndHandle:c.endHandle}),!x&&!T&&!A)return IE(E);I.source!==I.target&&A&&(IE(E),E=A,A.classList.add("connecting","react-flow__handle-connecting"),A.classList.toggle("valid",T),A.classList.toggle("react-flow__handle-valid",T))}function P(e){var t,n;(x||A)&&I&&T&&(null==o||o(I)),null==(n=(t=a()).onConnectEnd)||n.call(t,e),l&&(null==c||c(e)),IE(E),v(),cancelAnimationFrame(b),_=!1,T=!1,I=null,A=null,d.removeEventListener("mousemove",D),d.removeEventListener("mouseup",P),d.removeEventListener("touchmove",D),d.removeEventListener("touchend",P)}i({connectionPosition:j,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:N,connectionStartHandle:{nodeId:n,handleId:t,type:N},connectionEndHandle:null}),null==p||p(e,{nodeId:n,handleId:t,handleType:N}),d.addEventListener("mousemove",D),d.addEventListener("mouseup",P),d.addEventListener("touchmove",D),d.addEventListener("touchend",P)}const ME=()=>!0,OE=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),DE=r.forwardRef((({type:e="source",position:t=KC.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:a=!0,isConnectableEnd:i=!0,id:s,onConnect:l,children:c,className:d,onMouseDown:h,onTouchStart:f,...m},p)=>{var g,y;const v=s||null,x="target"===e,b=pC(),w=r.useContext(hE),{connectOnClick:k,noPanClassName:S}=mC(OE,ON),{connecting:N,clickConnecting:C}=mC(((e,t,n)=>o=>{const{connectionStartHandle:r,connectionEndHandle:a,connectionClickStartHandle:i}=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==i?void 0:i.nodeId)===e&&(null==i?void 0:i.handleId)===t&&(null==i?void 0:i.type)===n}})(w,v,e),ON);w||null==(y=(g=b.getState()).onError)||y.call(g,"010",dC());const E=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:mE(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=OC(e);a&&(t&&0===e.button||!t)&&AE({event:e,handleId:v,nodeId:w,onConnect:E,isTarget:x,getState:b.getState,setState:b.setState,isValidConnection:n||b.getState().isValidConnection||ME}),t?null==h||h(e):null==f||f(e)};return u.createElement("div",{"data-handleid":v,"data-nodeid":w,"data-handlepos":t,"data-id":`${w}-${v}-${e}`,className:jN(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",S,d,{source:!x,target:x,connectable:o,connectablestart:a,connectableend:i,connecting:C,connectionindicator:o&&(a&&!N||i&&N)}]),onMouseDown:j,onTouchStart:j,onClick:k?t=>{const{onClickConnectStart:o,onClickConnectEnd:r,connectionClickStartHandle:i,connectionMode:s,isValidConnection:l}=b.getState();if(!w||!i&&!a)return;if(!i)return null==o||o(t,{nodeId:w,handleId:v,handleType:e}),void b.setState({connectionClickStartHandle:{nodeId:w,type:e,handleId:v}});const c=CC(t.target),d=n||l||ME,{connection:u,isValid:h}=jE({nodeId:w,id:v,type:e},s,i.nodeId,i.handleId||null,i.type,d,c);h&&E(u),null==r||r(t),b.setState({connectionClickStartHandle:null})}:void 0,ref:p,...m},c)}));DE.displayName="Handle";var PE=r.memo(DE);const RE=({data:e,isConnectable:t,targetPosition:n=KC.Top,sourcePosition:o=KC.Bottom})=>u.createElement(u.Fragment,null,u.createElement(PE,{type:"target",position:n,isConnectable:t}),null==e?void 0:e.label,u.createElement(PE,{type:"source",position:o,isConnectable:t}));RE.displayName="DefaultNode";var LE=r.memo(RE);const zE=({data:e,isConnectable:t,sourcePosition:n=KC.Bottom})=>u.createElement(u.Fragment,null,null==e?void 0:e.label,u.createElement(PE,{type:"source",position:n,isConnectable:t}));zE.displayName="InputNode";var FE=r.memo(zE);const BE=({data:e,isConnectable:t,targetPosition:n=KC.Top})=>u.createElement(u.Fragment,null,u.createElement(PE,{type:"target",position:n,isConnectable:t}),null==e?void 0:e.label);BE.displayName="OutputNode";var UE=r.memo(BE);const VE=()=>null;VE.displayName="GroupNode";const HE=e=>({selectedNodes:e.getNodes().filter((e=>e.selected)),selectedEdges:e.edges.filter((e=>e.selected)).map((e=>({...e})))}),$E=e=>e.id;function WE(e,t){return ON(e.selectedNodes.map($E),t.selectedNodes.map($E))&&ON(e.selectedEdges.map($E),t.selectedEdges.map($E))}const GE=r.memo((({onSelectionChange:e})=>{const t=pC(),{selectedNodes:n,selectedEdges:o}=mC(HE,WE);return r.useEffect((()=>{const r={nodes:n,edges:o};null==e||e(r),t.getState().onSelectionChange.forEach((e=>e(r)))}),[n,o,e]),null}));GE.displayName="SelectionListener";const qE=e=>!!e.onSelectionChange;function YE({onSelectionChange:e}){const t=mC(qE);return e||t?u.createElement(GE,{onSelectionChange:e}):null}const XE=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 KE(e,t){r.useEffect((()=>{void 0!==e&&t(e)}),[e])}function JE(e,t,n){r.useEffect((()=>{void 0!==t&&n({[e]:t})}),[t])}const ZE=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:a,onConnectStart:i,onConnectEnd:s,onClickConnectStart:l,onClickConnectEnd:c,nodesDraggable:d,nodesConnectable:u,nodesFocusable:h,edgesFocusable:f,edgesUpdatable:m,elevateNodesOnSelect:p,minZoom:g,maxZoom:y,nodeExtent:v,onNodesChange:x,onEdgesChange:b,elementsSelectable:w,connectionMode:k,snapGrid:S,snapToGrid:N,translateExtent:C,connectOnClick:E,defaultEdgeOptions:j,fitView:_,fitViewOptions:I,onNodesDelete:T,onEdgesDelete:A,onNodeDrag:M,onNodeDragStart:O,onNodeDragStop:D,onSelectionDrag:P,onSelectionDragStart:R,onSelectionDragStop:L,noPanClassName:z,nodeOrigin:F,rfId:B,autoPanOnConnect:U,autoPanOnNodeDrag:V,onError:H,connectionRadius:$,isValidConnection:W,nodeDragThreshold:G})=>{const{setNodes:q,setEdges:Y,setDefaultNodesAndEdges:X,setMinZoom:K,setMaxZoom:J,setTranslateExtent:Z,setNodeExtent:Q,reset:ee}=mC(XE,ON),te=pC();return r.useEffect((()=>{const e=null==o?void 0:o.map((e=>({...e,...j})));return X(n,e),()=>{ee()}}),[]),JE("defaultEdgeOptions",j,te.setState),JE("connectionMode",k,te.setState),JE("onConnect",a,te.setState),JE("onConnectStart",i,te.setState),JE("onConnectEnd",s,te.setState),JE("onClickConnectStart",l,te.setState),JE("onClickConnectEnd",c,te.setState),JE("nodesDraggable",d,te.setState),JE("nodesConnectable",u,te.setState),JE("nodesFocusable",h,te.setState),JE("edgesFocusable",f,te.setState),JE("edgesUpdatable",m,te.setState),JE("elementsSelectable",w,te.setState),JE("elevateNodesOnSelect",p,te.setState),JE("snapToGrid",N,te.setState),JE("snapGrid",S,te.setState),JE("onNodesChange",x,te.setState),JE("onEdgesChange",b,te.setState),JE("connectOnClick",E,te.setState),JE("fitViewOnInit",_,te.setState),JE("fitViewOnInitOptions",I,te.setState),JE("onNodesDelete",T,te.setState),JE("onEdgesDelete",A,te.setState),JE("onNodeDrag",M,te.setState),JE("onNodeDragStart",O,te.setState),JE("onNodeDragStop",D,te.setState),JE("onSelectionDrag",P,te.setState),JE("onSelectionDragStart",R,te.setState),JE("onSelectionDragStop",L,te.setState),JE("noPanClassName",z,te.setState),JE("nodeOrigin",F,te.setState),JE("rfId",B,te.setState),JE("autoPanOnConnect",U,te.setState),JE("autoPanOnNodeDrag",V,te.setState),JE("onError",H,te.setState),JE("connectionRadius",$,te.setState),JE("isValidConnection",W,te.setState),JE("nodeDragThreshold",G,te.setState),KE(e,q),KE(t,Y),KE(g,K),KE(y,J),KE(C,Z),KE(v,Q),null},QE={display:"none"},ej={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},tj="react-flow__node-desc",nj="react-flow__edge-desc",oj=e=>e.ariaLiveMessage;function rj({rfId:e}){const t=mC(oj);return u.createElement("div",{id:`react-flow__aria-live-${e}`,"aria-live":"assertive","aria-atomic":"true",style:ej},t)}function aj({rfId:e,disableKeyboardA11y:t}){return u.createElement(u.Fragment,null,u.createElement("div",{id:`${tj}-${e}`,style:QE},"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:`${nj}-${e}`,style:QE},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&u.createElement(rj,{rfId:e}))}var ij=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,o]=r.useState(!1),a=r.useRef(!1),i=r.useRef(new Set([])),[s,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)&&MC(e))return!1;const n=lj(e.code,l);i.current.add(e[n]),sj(s,i.current,!1)&&(e.preventDefault(),o(!0))},n=e=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&MC(e))return!1;const n=lj(e.code,l);sj(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(e[n]),"Meta"===e.key&&i.current.clear(),a.current=!1},c=()=>{i.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 sj(e,t,n){return e.filter((e=>n||e.length===t.size)).some((e=>e.every((e=>t.has(e)))))}function lj(e,t){return t.includes(e)?"code":"key"}function cj(e,t,n,o){var r,a;const i=e.parentNode||e.parentId;if(!i)return n;const s=t.get(i),l=vE(s,o);return cj(s,t,{x:(n.x??0)+l.x,y:(n.y??0)+l.y,z:((null==(r=s[TC])?void 0:r.z)??0)>(n.z??0)?(null==(a=s[TC])?void 0:a.z)??0:n.z??0},o)}function dj(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:i,z:s}=cj(o,e,{...o.position,z:(null==(r=o[TC])?void 0:r.z)??0},t);o.positionAbsolute={x:a,y:i},o[TC].z=s,(null==n?void 0:n[o.id])&&(o[TC].isParent=!0)}}))}function uj(e,t,n,o){const r=new Map,a={},i=o?1e3:0;return e.forEach((e=>{var n;const o=(IC(e.zIndex)?e.zIndex:0)+(e.selected?i:0),s=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==s?void 0:s.type)&&(null==s?void 0:s.type)!==e.type;Object.defineProperty(l,TC,{enumerable:!1,value:{handleBounds:d||null==(n=null==s?void 0:s[TC])?void 0:n.handleBounds,z:o}}),r.set(e.id,l)})),dj(r,n,a),r}function hj(e,t={}){const{getNodes:n,width:o,height:r,minZoom:a,maxZoom:i,d3Zoom:s,d3Selection:l,fitViewOnInitDone:c,fitViewOnInit:d,nodeOrigin:u}=e(),h=t.initial&&!c&&d;if(s&&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=xE(e,u),{x:c,y:d,zoom:h}=kE(n,o,r,t.minZoom??a,t.maxZoom??i,t.padding??.1),f=Xl.translate(c,d).scale(h);return"number"==typeof t.duration&&t.duration>0?s.transform(SE(l,t.duration),f):s.transform(l,f),!0}}return!1}function fj(e,t){return e.forEach((e=>{const n=t.get(e.id);n&&t.set(n.id,{...n,[TC]:n[TC],selected:e.selected})})),new Map(t)}function mj(e,t){return t.map((t=>{const n=e.find((e=>e.id===t.id));return n&&(t.selected=n.selected),t}))}function pj({changedNodes:e,changedEdges:t,get:n,set:o}){const{nodeInternals:r,edges:a,onNodesChange:i,onEdgesChange:s,hasDefaultNodes:l,hasDefaultEdges:c}=n();(null==e?void 0:e.length)&&(l&&o({nodeInternals:fj(e,r)}),null==i||i(e)),(null==t?void 0:t.length)&&(c&&o({edges:mj(t,a)}),null==s||s(t))}const gj=()=>{},yj={zoomIn:gj,zoomOut:gj,zoomTo:gj,getZoom:()=>1,setViewport:gj,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:gj,fitBounds:gj,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},vj=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection});function xj(){const e=(()=>{const e=pC(),{d3Zoom:t,d3Selection:n}=mC(vj,ON);return r.useMemo((()=>n&&t?{zoomIn:e=>t.scaleBy(SE(n,null==e?void 0:e.duration),1.2),zoomOut:e=>t.scaleBy(SE(n,null==e?void 0:e.duration),1/1.2),zoomTo:(e,o)=>t.scaleTo(SE(n,null==o?void 0:o.duration),e),getZoom:()=>e.getState().transform[2],setViewport:(o,r)=>{const[a,i,s]=e.getState().transform,l=Xl.translate(o.x??a,o.y??i).scale(o.zoom??s);t.transform(SE(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=>hj(e.getState,t),setCenter:(o,r,a)=>{const{width:i,height:s,maxZoom:l}=e.getState(),c=void 0!==(null==a?void 0:a.zoom)?a.zoom:l,d=i/2-o*c,u=s/2-r*c,h=Xl.translate(d,u).scale(c);t.transform(SE(n,null==a?void 0:a.duration),h)},fitBounds:(o,r)=>{const{width:a,height:i,minZoom:s,maxZoom:l}=e.getState(),{x:c,y:d,zoom:u}=kE(o,a,i,s,l,(null==r?void 0:r.padding)??.1),h=Xl.translate(c,d).scale(u);t.transform(SE(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"),gE(t,n,o,r)},screenToFlowPosition:t=>{const{transform:n,snapToGrid:o,snapGrid:r,domNode:a}=e.getState();if(!a)return t;const{x:i,y:s}=a.getBoundingClientRect(),l={x:t.x-i,y:t.y-s};return gE(l,n,o,r)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:a}=o.getBoundingClientRect(),i=yE(t,n);return{x:i.x+r,y:i.y+a}},viewportInitialized:!0}:yj),[t,n])})(),t=pC(),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})))}),[]),i=r.useCallback((e=>{const{edges:n=[]}=t.getState();return n.find((t=>t.id===e))}),[]),s=r.useCallback((e=>{const{getNodes:n,setNodes:o,hasDefaultNodes:r,onNodesChange:a}=t.getState(),i=n(),s="function"==typeof e?e(i):e;if(r)o(s);else if(a){a(0===s.length?i.map((e=>({type:"remove",id:e.id}))):s.map((e=>({item:e,type:"reset"}))))}}),[]),l=r.useCallback((e=>{const{edges:n=[],setEdges:o,hasDefaultEdges:r,onEdgesChange:a}=t.getState(),i="function"==typeof e?e(n):e;if(r)o(i);else if(a){a(0===i.length?n.map((e=>({type:"remove",id:e.id}))):i.map((e=>({item:e,type:"reset"}))))}}),[]),c=r.useCallback((e=>{const n=Array.isArray(e)?e:[e],{getNodes:o,setNodes:r,hasDefaultNodes:a,onNodesChange:i}=t.getState();if(a){r([...o(),...n])}else if(i){i(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:i}=t.getState();if(a)r([...o,...n]);else if(i){i(n.map((e=>({item:e,type:"add"}))))}}),[]),u=r.useCallback((()=>{const{getNodes:e,edges:n=[],transform:o}=t.getState(),[r,a,i]=o;return{nodes:e().map((e=>({...e}))),edges:n.map((e=>({...e}))),viewport:{x:r,y:a,zoom:i}}}),[]),h=r.useCallback((({nodes:e,edges:n})=>{const{nodeInternals:o,getNodes:r,edges:a,hasDefaultNodes:i,hasDefaultEdges:s,onNodesDelete:l,onEdgesDelete:c,onNodesChange:d,onEdgesChange:u}=t.getState(),h=(e||[]).map((e=>e.id)),f=(n||[]).map((e=>e.id)),m=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=>f.includes(e.id)));if(m||g){const e=wE(m,p),n=[...g,...e],r=n.reduce(((e,t)=>(e.includes(t.id)||e.push(t.id),e)),[]);if((s||i)&&(s&&t.setState({edges:a.filter((e=>!r.includes(e.id)))}),i&&(m.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"}))))),m.length>0&&(null==l||l(m),d)){d(m.map((e=>({id:e.id,type:"remove"}))))}}}),[]),f=r.useCallback((e=>{const n=IC((o=e).width)&&IC(o.height)&&IC(o.x)&&IC(o.y);var o;const r=n?null:t.getState().nodeInternals.get(e.id);if(!n&&!r)return[null,null,n];return[n?e:jC(r),r,n]}),[]),m=r.useCallback(((e,n=!0,o)=>{const[r,a,i]=f(e);return r?(o||t.getState().getNodes()).filter((e=>{if(!(i||e.id!==a.id&&e.positionAbsolute))return!1;const t=jC(e),o=_C(t,r);return n&&o>0||o>=r.width*r.height})):[]}),[]),p=r.useCallback(((e,t,n=!0)=>{const[o]=f(e);if(!o)return!1;const r=_C(o,t);return n&&r>0||r>=o.width*o.height}),[]);return r.useMemo((()=>({...e,getNodes:n,getNode:o,getEdges:a,getEdge:i,setNodes:s,setEdges:l,addNodes:c,addEdges:d,toObject:u,deleteElements:h,getIntersectingNodes:m,isNodeIntersecting:p})),[e,n,o,a,i,s,l,c,d,u,h,m,p])}const bj={actInsideInputWithModifier:!1};const wj={position:"absolute",width:"100%",height:"100%",top:0,left:0},kj=e=>({x:e.x,y:e.y,zoom:e.k}),Sj=(e,t)=>e.target.closest(`.${t}`),Nj=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),Cj=e=>{const t=e.ctrlKey&&PC()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t},Ej=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),jj=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:a=!0,zoomOnPinch:i=!0,panOnScroll:s=!1,panOnScrollSpeed:l=.5,panOnScrollMode:c=VC.Free,zoomOnDoubleClick:d=!0,elementsSelectable:h,panOnDrag:f=!0,defaultViewport:m,translateExtent:p,minZoom:g,maxZoom:y,zoomActivationKeyCode:v,preventScrolling:x=!0,children:b,noWheelClassName:w,noPanClassName:k})=>{const S=r.useRef(),N=pC(),C=r.useRef(!1),E=r.useRef(!1),j=r.useRef(null),_=r.useRef({x:0,y:0,zoom:0}),{d3Zoom:I,d3Selection:T,d3ZoomHandler:A,userSelectionActive:M}=mC(Ej,ON),O=ij(v),D=r.useRef(0),P=r.useRef(!1),R=r.useRef();return function(e){const t=pC();r.useEffect((()=>{let n;const o=()=>{var n,o;if(!e.current)return;const r=bC(e.current);0!==r.height&&0!==r.width||null==(o=(n=t.getState()).onError)||o.call(n,"004",iC()),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=JN,r=ZN,a=nC,i=eC,s=tC,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],d=250,u=Ql,h=Zl("start","zoom","end"),f=0,m=10;function p(e){e.property("__zoom",QN).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",S).on("dblclick.zoom",N).filter(s).on("touchstart.zoom",C).on("touchmove.zoom",E).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 Kl(t,e.x,e.y)}function y(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 Kl(e.k,o,r)}function v(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(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,i=b(e,a).event(o),s=r.apply(e,a),l=null==n?v(s):"function"==typeof n?n.apply(e,a):n,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,h="function"==typeof t?t.apply(e,a):t,f=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=f(e),n=c/t[2];e=new Kl(n,l[0]-t[0]*n,l[1]-t[1]*n)}i.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,s=Math.max(l[0],Math.min(l[1],r.k*Math.pow(2,i.apply(this,arguments)))),d=DN(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===s)return;n.mouse=[d,r.invert(d)],Jl(this),n.start()}KN(e),n.wheel=setTimeout((function(){n.wheel=null,n.end()}),150),n.zoom("mouse",a(y(g(r,s),n.mouse[0],n.mouse[1]),n.extent,c))}}function S(e,...t){if(!n&&o.apply(this,arguments)){var r=e.currentTarget,i=b(this,t,!0).event(e),s=Yl(e.view).on("mousemove.zoom",(function(e){if(KN(e),!i.moved){var t=e.clientX-d,n=e.clientY-u;i.moved=t*t+n*n>f}i.event(e).zoom("mouse",a(y(i.that.__zoom,i.mouse[0]=DN(e,r),i.mouse[1]),i.extent,c))}),!0).on("mouseup.zoom",(function(e){s.on("mousemove.zoom mouseup.zoom",null),BN(e.view,i.moved),KN(e),i.event(e).end()}),!0),l=DN(e,r),d=e.clientX,u=e.clientY;FN(e.view),XN(e),i.mouse=[l,this.__zoom.invert(l)],Jl(this),i.start()}}function N(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,i=DN(e.changedTouches?e.changedTouches[0]:e,this),s=n.invert(i),l=n.k*(e.shiftKey?.5:2),u=a(y(g(n,l),i,s),r.apply(this,t),c);KN(e),d>0?Yl(this).transition().duration(d).call(x,u,i,e):Yl(this).call(p.transform,u,i,e)}}function C(n,...r){if(o.apply(this,arguments)){var a,i,s,l,c=n.touches,d=c.length,u=b(this,r,n.changedTouches.length===d).event(n);for(XN(n),i=0;i<d;++i)l=[l=DN(s=c[i],this),this.__zoom.invert(l),s.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)),Jl(this),u.start())}}function E(e,...t){if(this.__zooming){var n,o,r,i,s=b(this,t).event(e),l=e.changedTouches,d=l.length;for(KN(e),n=0;n<d;++n)r=DN(o=l[n],this),s.touch0&&s.touch0[2]===o.identifier?s.touch0[0]=r:s.touch1&&s.touch1[2]===o.identifier&&(s.touch1[0]=r);if(o=s.that.__zoom,s.touch1){var u=s.touch0[0],h=s.touch0[1],f=s.touch1[0],m=s.touch1[1],p=(p=f[0]-u[0])*p+(p=f[1]-u[1])*p,v=(v=m[0]-h[0])*v+(v=m[1]-h[1])*v;o=g(o,Math.sqrt(p/v)),r=[(u[0]+f[0])/2,(u[1]+f[1])/2],i=[(h[0]+m[0])/2,(h[1]+m[1])/2]}else{if(!s.touch0)return;r=s.touch0[0],i=s.touch0[1]}s.zoom("touch",a(y(o,r,i),s.extent,c))}}function j(e,...o){if(this.__zooming){var r,a,i=b(this,o).event(e),s=e.changedTouches,l=s.length;for(XN(e),n&&clearTimeout(n),n=setTimeout((function(){n=null}),500),r=0;r<l;++r)a=s[r],i.touch0&&i.touch0[2]===a.identifier?delete i.touch0:i.touch1&&i.touch1[2]===a.identifier&&delete i.touch1;if(i.touch1&&!i.touch0&&(i.touch0=i.touch1,delete i.touch1),i.touch0)i.touch0[1]=this.__zoom.invert(i.touch0[0]);else if(i.end(),2===i.taps&&(a=DN(a,this),Math.hypot(t[0]-a[0],t[1]-a[1])<m)){var c=Yl(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",QN),e!==r?x(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,i=null==n?v(e):"function"==typeof n?n.apply(this,arguments):n,s=o.invert(i),l="function"==typeof t?t.apply(this,arguments):t;return a(y(g(o,l),i,s),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,i){p.transform(e,(function(){var e=r.apply(this,arguments),i=this.__zoom,s=null==o?v(e):"function"==typeof o?o.apply(this,arguments):o;return a(Xl.translate(s[0],s[1]).scale(i.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,c)}),o,i)},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=Yl(this.that).datum();h.call(e,this.that,new YN(e,{sourceEvent:this.sourceEvent,target:p,type:e,transform:this.that.__zoom,dispatch:h}),t)}},p.wheelDelta=function(e){return arguments.length?(i="function"==typeof e?e:qN(+e),p):i},p.filter=function(e){return arguments.length?(o="function"==typeof e?e:qN(!!e),p):o},p.touchable=function(e){return arguments.length?(s="function"==typeof e?e:qN(!!e),p):s},p.extent=function(e){return arguments.length?(r="function"==typeof e?e:qN([[+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?(f=(e=+e)*e,p):Math.sqrt(f)},p.tapDistance=function(e){return arguments.length?(m=+e,p):m},p}().scaleExtent([g,y]).translateExtent(p),n=Yl(j.current).call(t),o=Xl.translate(m.x,m.y).scale(wC(m.zoom,g,y)),r=[[0,0],[e.width,e.height]],a=t.constrain()(o,r,p);t.transform(n,a),t.wheelDelta(Cj),N.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((()=>{T&&I&&(!s||O||M?void 0!==A&&T.on("wheel.zoom",(function(e,t){if(!x&&"wheel"===e.type&&!e.ctrlKey||Sj(e,w))return null;e.preventDefault(),A.call(this,e,t)}),{passive:!1}):T.on("wheel.zoom",(o=>{if(Sj(o,w))return!1;o.preventDefault(),o.stopImmediatePropagation();const r=T.property("__zoom").k||1;if(o.ctrlKey&&i){const e=DN(o),t=Cj(o),n=r*Math.pow(2,t);return void I.scaleTo(T,n,e,o)}const a=1===o.deltaMode?20:1;let s=c===VC.Vertical?0:o.deltaX*a,d=c===VC.Horizontal?0:o.deltaY*a;!PC()&&o.shiftKey&&c!==VC.Vertical&&(s=o.deltaY*a,d=0),I.translateBy(T,-s/r*l,-d/r*l,{internal:!0});const u=kj(T.property("__zoom")),{onViewportChangeStart:h,onViewportChange:f,onViewportChangeEnd:m}=N.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==f||f(u),R.current=setTimeout((()=>{null==n||n(o,u),null==m||m(u),P.current=!1}),150))}),{passive:!1}))}),[M,s,c,T,I,A,O,i,x,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}=N.getState(),a=kj(e.transform);C.current=!0,_.current=a,"mousedown"===(null==(o=e.sourceEvent)?void 0:o.type)&&N.setState({paneDragging:!0}),null==r||r(a),null==t||t(e.sourceEvent,a)}))}),[I,t]),r.useEffect((()=>{I&&(M&&!C.current?I.on("zoom",null):M||I.on("zoom",(t=>{var n;const{onViewportChange:r}=N.getState();if(N.setState({transform:[t.transform.x,t.transform.y,t.transform.k]}),E.current=!(!o||!Nj(f,D.current??0)),(e||r)&&!(null==(n=t.sourceEvent)?void 0:n.internal)){const n=kj(t.transform);null==r||r(n),null==e||e(t.sourceEvent,n)}})))}),[M,I,e,f,o]),r.useEffect((()=>{I&&I.on("end",(e=>{if(!e.sourceEvent||e.sourceEvent.internal)return null;const{onViewportChangeEnd:t}=N.getState();if(C.current=!1,N.setState({paneDragging:!1}),o&&Nj(f,D.current??0)&&!E.current&&o(e.sourceEvent),E.current=!1,(n||t)&&(r=_.current,a=e.transform,r.x!==a.x||r.y!==a.y||r.zoom!==a.k)){const o=kj(e.transform);_.current=o,clearTimeout(S.current),S.current=setTimeout((()=>{null==t||t(o),null==n||n(e.sourceEvent,o)}),s?150:0)}var r,a}))}),[I,s,f,n,o]),r.useEffect((()=>{I&&I.filter((e=>{const t=O||a,n=i&&e.ctrlKey;if((!0===f||Array.isArray(f)&&f.includes(1))&&1===e.button&&"mousedown"===e.type&&(Sj(e,"react-flow__node")||Sj(e,"react-flow__edge")))return!0;if(!(f||t||s||d||i))return!1;if(M)return!1;if(!d&&"dblclick"===e.type)return!1;if(Sj(e,w)&&"wheel"===e.type)return!1;if(Sj(e,k)&&("wheel"!==e.type||s&&"wheel"===e.type&&!O))return!1;if(!i&&e.ctrlKey&&"wheel"===e.type)return!1;if(!t&&!s&&!n&&"wheel"===e.type)return!1;if(!f&&("mousedown"===e.type||"touchstart"===e.type))return!1;if(Array.isArray(f)&&!f.includes(e.button)&&"mousedown"===e.type)return!1;const o=Array.isArray(f)&&f.includes(e.button)||!e.button||e.button<=1;return(!e.ctrlKey||"wheel"===e.type)&&o}))}),[M,I,a,i,s,d,f,h,O]),u.createElement("div",{className:"react-flow__renderer",ref:j,style:wj},b)},_j=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Ij(){const{userSelectionActive:e,userSelectionRect:t}=mC(_j,ON);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 Tj(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 Aj(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&&Tj(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&&Tj(t,r);break;case"remove":return t}return t.push(r),t}),n)}function Mj(e,t){return Aj(e,t)}const Oj=(e,t)=>({id:e,type:"select",selected:t});function Dj(e,t){return e.reduce(((e,n)=>{const o=t.includes(n.id);return!n.selected&&o?(n.selected=!0,e.push(Oj(n.id,!0))):n.selected&&!o&&(n.selected=!1,e.push(Oj(n.id,!1))),e}),[])}const Pj=(e,t)=>n=>{n.target===t.current&&(null==e||e(n))},Rj=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),Lj=r.memo((({isSelecting:e,selectionMode:t=$C.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:a,onPaneClick:i,onPaneContextMenu:s,onPaneScroll:l,onPaneMouseEnter:c,onPaneMouseMove:d,onPaneMouseLeave:h,children:f})=>{const m=r.useRef(null),p=pC(),g=r.useRef(0),y=r.useRef(0),v=r.useRef(),{userSelectionActive:x,elementsSelectable:b,dragging:w}=mC(Rj,ON),k=()=>{p.setState({userSelectionActive:!1,userSelectionRect:null}),g.current=0,y.current=0},S=e=>{null==i||i(e),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},N=l?e=>l(e):void 0,C=b&&(e||x);return u.createElement("div",{className:jN(["react-flow__pane",{dragging:w,selection:e}]),onClick:C?void 0:Pj(S,m),onContextMenu:Pj((e=>{Array.isArray(n)&&(null==n?void 0:n.includes(2))?e.preventDefault():null==s||s(e)}),m),onWheel:Pj(N,m),onMouseEnter:C?void 0:c,onMouseDown:C?t=>{const{resetSelectedElements:n,domNode:r}=p.getState();if(v.current=null==r?void 0:r.getBoundingClientRect(),!b||!e||0!==t.button||t.target!==m.current||!v.current)return;const{x:a,y:i}=DC(t,v.current);n(),p.setState({userSelectionRect:{width:0,height:0,startX:a,startY:i,x:a,y:i}}),null==o||o(t)}:void 0,onMouseMove:C?n=>{const{userSelectionRect:o,nodeInternals:r,edges:a,transform:i,onNodesChange:s,onEdgesChange:l,nodeOrigin:c,getNodes:d}=p.getState();if(!e||!v.current||!o)return;p.setState({userSelectionActive:!0,nodesSelectionActive:!1});const u=DC(n,v.current),h=o.startX??0,f=o.startY??0,m={...o,x:u.x<h?u.x:h,y:u.y<f?u.y:f,width:Math.abs(u.x-h),height:Math.abs(u.y-f)},x=d(),b=bE(r,m,i,t===$C.Partial,!0,c),w=wE(b,a).map((e=>e.id)),k=b.map((e=>e.id));if(g.current!==k.length){g.current=k.length;const e=Dj(x,k);e.length&&(null==s||s(e))}if(y.current!==w.length){y.current=w.length;const e=Dj(a,w);e.length&&(null==l||l(e))}p.setState({userSelectionRect:m})}:d,onMouseUp:C?e=>{if(0!==e.button)return;const{userSelectionRect:t}=p.getState();!x&&t&&e.target===m.current&&(null==S||S(e)),p.setState({nodesSelectionActive:g.current>0}),k(),null==a||a(e)}:void 0,onMouseLeave:C?e=>{x&&(p.setState({nodesSelectionActive:g.current>0}),null==a||a(e)),k()}:h,ref:m,style:wj},f,u.createElement(Ij,null))}));function zj(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const o=t.get(n);return!!o&&(!!o.selected||zj(o,t))}function Fj(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 Bj(e,t,n,o){return Array.from(e.values()).filter((n=>(n.selected||n.id===o)&&(!n.parentNode||n.parentId||!zj(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 Uj(e,t,n,o,r=[0,0],a){const i=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 s=i;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}=vE(t,r).positionAbsolute;s=[[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}=vE(t,r).positionAbsolute;s=t&&IC(o)&&IC(a)&&IC(t.width)&&IC(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]]]:s}else null==a||a("005",sC()),s=i;let c={x:0,y:0};if(l){const e=n.get(l);c=vE(e,r).positionAbsolute}const d=s&&"parent"!==s?kC(t,s):t;return{position:{x:d.x-c.x,y:d.y-c.y},positionAbsolute:d}}function Vj({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]}Lj.displayName="Pane";const Hj=(e,t,n,o)=>{const r=t.querySelectorAll(e);if(!r||!r.length)return null;const a=Array.from(r),i=t.getBoundingClientRect(),s=i.width*o[0],l=i.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-i.left-s)/n,y:(t.top-i.top-l)/n,...bC(e)}}))};function $j(e,t,n){return void 0===n?n:o=>{const r=t().nodeInternals.get(e);r&&n(o,{...r})}}function Wj({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:a,multiSelectionActive:i,nodeInternals:s,onError:l}=t.getState(),c=s.get(e);c?(t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&i)&&(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",hC(e))}function Gj(e){return(t,n,o)=>null==e?void 0:e(t,o)}function qj({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:a,isSelectable:i,selectNodesOnDrag:s}){const l=pC(),[c,d]=r.useState(!1),u=r.useRef([]),h=r.useRef({x:null,y:null}),f=r.useRef(0),m=r.useRef(null),p=r.useRef({x:0,y:0}),g=r.useRef(null),y=r.useRef(!1),v=r.useRef(!1),x=r.useRef(!1),b=function(){const e=pC();return r.useCallback((({sourceEvent:t})=>{const{transform:n,snapGrid:o,snapToGrid:r}=e.getState(),a=t.touches?t.touches[0].clientX:t.clientX,i=t.touches?t.touches[0].clientY:t.clientY,s={x:(a-n[0])/n[2],y:(i-n[1])/n[2]};return{xSnapped:r?o[0]*Math.round(s.x/o[0]):s.x,ySnapped:r?o[1]*Math.round(s.y/o[1]):s.y,...s}}),[])}();return r.useEffect((()=>{if(null==e?void 0:e.current){const r=Yl(e.current),c=({x:e,y:t})=>{const{nodeInternals:n,onNodeDrag:o,onSelectionDrag:r,updateNodePositions:i,nodeExtent:s,snapGrid:c,snapToGrid:f,nodeOrigin:m,onError:p}=l.getState();h.current={x:e,y:t};let y=!1,v={x:0,y:0,x2:0,y2:0};if(u.current.length>1&&s){const e=xE(u.current,m);v=EC(e)}if(u.current=u.current.map((o=>{const r={x:e-o.distance.x,y:t-o.distance.y};f&&(r.x=c[0]*Math.round(r.x/c[0]),r.y=c[1]*Math.round(r.y/c[1]));const a=[[s[0][0],s[0][1]],[s[1][0],s[1][1]]];u.current.length>1&&s&&!o.extent&&(a[0][0]=o.positionAbsolute.x-v.x+s[0][0],a[1][0]=o.positionAbsolute.x+(o.width??0)-v.x2+s[1][0],a[0][1]=o.positionAbsolute.y-v.y+s[0][1],a[1][1]=o.positionAbsolute.y+(o.height??0)-v.y2+s[1][1]);const i=Uj(o,r,n,a,m,p);return y=y||o.position.x!==i.position.x||o.position.y!==i.position.y,o.position=i.position,o.positionAbsolute=i.positionAbsolute,o})),!y)return;i(u.current,!0,!0),d(!0);const x=a?o:Gj(r);if(x&&g.current){const[e,t]=Vj({nodeId:a,dragItems:u.current,nodeInternals:n});x(g.current,e,t)}},w=()=>{if(!m.current)return;const[e,t]=NC(p.current,m.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)}f.current=requestAnimationFrame(w)},k=t=>{var n;const{nodeInternals:o,multiSelectionActive:r,nodesDraggable:c,unselectNodesAndEdges:d,onNodeDragStart:f,onSelectionDragStart:m}=l.getState();v.current=!0;const p=a?f:Gj(m);s&&i||r||!a||(null==(n=o.get(a))?void 0:n.selected)||d(),a&&i&&s&&Wj({id:a,store:l,nodeRef:e});const g=b(t);if(h.current=g,u.current=Bj(o,c,g,a),p&&u.current){const[e,n]=Vj({nodeId:a,dragItems:u.current,nodeInternals:o});p(t.sourceEvent,e,n)}};if(!t){const t=function(){var e,t,n,o,r=HN,a=$N,i=WN,s=GN,l={},c=Zl("start","drag","end"),d=0,u=0;function h(e){e.on("mousedown.drag",f).filter(s).on("touchstart.drag",g).on("touchmove.drag",y,PN).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(i,s){if(!o&&r.call(this,i,s)){var l=x(this,a.call(this,i,s),i,s,"mouse");l&&(Yl(i.view).on("mousemove.drag",m,RN).on("mouseup.drag",p,RN),FN(i.view),LN(i),n=!1,e=i.clientX,t=i.clientY,l("start",i))}}function m(o){if(zN(o),!n){var r=o.clientX-e,a=o.clientY-t;n=r*r+a*a>u}l.mouse("drag",o)}function p(e){Yl(e.view).on("mousemove.drag mouseup.drag",null),BN(e.view,n),zN(e),l.mouse("end",e)}function g(e,t){if(r.call(this,e,t)){var n,o,i=e.changedTouches,s=a.call(this,e,t),l=i.length;for(n=0;n<l;++n)(o=x(this,s,e,t,i[n].identifier,i[n]))&&(LN(e),o("start",e,i[n]))}}function y(e){var t,n,o=e.changedTouches,r=o.length;for(t=0;t<r;++t)(n=l[o[t].identifier])&&(zN(e),n("drag",e,o[t]))}function v(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])&&(LN(e),n("end",e,r[t]))}function x(e,t,n,o,r,a){var s,u,f,m=c.copy(),p=DN(a||n,t);if(null!=(f=i.call(e,new VN("beforestart",{sourceEvent:n,target:h,identifier:r,active:d,x:p[0],y:p[1],dx:0,dy:0,dispatch:m}),o)))return s=f.x-p[0]||0,u=f.y-p[1]||0,function n(a,i,c){var g,y=p;switch(a){case"start":l[r]=n,g=d++;break;case"end":delete l[r],--d;case"drag":p=DN(c||i,t),g=d}m.call(a,e,new VN(a,{sourceEvent:i,subject:f,target:h,identifier:r,active:g,x:p[0]+s,y:p[1]+u,dx:p[0]-y[0],dy:p[1]-y[1],dispatch:m}),o)}}return h.filter=function(e){return arguments.length?(r="function"==typeof e?e:UN(!!e),h):r},h.container=function(e){return arguments.length?(a="function"==typeof e?e:UN(e),h):a},h.subject=function(e){return arguments.length?(i="function"==typeof e?e:UN(e),h):i},h.touchable=function(e){return arguments.length?(s="function"==typeof e?e:UN(!!e),h):s},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),x.current=!1;const o=b(e);h.current=o,m.current=(null==t?void 0:t.getBoundingClientRect())||null,p.current=DC(e.sourceEvent,m.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&&(x.current=!0),!x.current){if(!y.current&&v.current&&r&&(y.current=!0,w()),!v.current){const r=o.xSnapped-((null==(t=null==h?void 0:h.current)?void 0:t.x)??0),i=o.ySnapped-((null==(n=null==h?void 0:h.current)?void 0:n.y)??0);Math.sqrt(r*r+i*i)>a&&k(e)}(h.current.x!==o.xSnapped||h.current.y!==o.ySnapped)&&u.current&&v.current&&(g.current=e.sourceEvent,p.current=DC(e.sourceEvent,m.current),c(o))}})).on("end",(e=>{if(v.current&&!x.current&&(d(!1),y.current=!1,v.current=!1,cancelAnimationFrame(f.current),u.current)){const{updateNodePositions:t,nodeInternals:n,onNodeDragStop:o,onSelectionDragStop:r}=l.getState(),i=a?o:Gj(r);if(t(u.current,!1,!1),i){const[t,o]=Vj({nodeId:a,dragItems:u.current,nodeInternals:n});i(e.sourceEvent,t,o)}}})).filter((t=>{const r=t.target;return!t.button&&(!n||!Fj(r,`.${n}`,e))&&(!o||Fj(r,o,e))}));return r.call(t),()=>{r.on(".drag",null)}}r.on(".drag",null)}}),[e,t,n,o,i,l,a,s,b]),c}function Yj(){const e=pC();return r.useCallback((t=>{const{nodeInternals:n,nodeExtent:o,updateNodePositions:r,getNodes:a,snapToGrid:i,snapGrid:s,onError:l,nodesDraggable:c}=e.getState(),d=a().filter((e=>e.selected&&(e.draggable||c&&void 0===e.draggable))),u=i?s[0]:5,h=i?s[1]:5,f=t.isShiftPressed?4:1,m=t.x*u*f,p=t.y*h*f;r(d.map((e=>{if(e.positionAbsolute){const t={x:e.positionAbsolute.x+m,y:e.positionAbsolute.y+p};i&&(t.x=s[0]*Math.round(t.x/s[0]),t.y=s[1]*Math.round(t.y/s[1]));const{positionAbsolute:r,position:a}=Uj(e,t,n,o,void 0,l);e.position=a,e.positionAbsolute=r}return e})),!0,!1)}),[])}const Xj={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Kj=e=>{const t=({id:t,type:n,data:o,xPos:a,yPos:i,xPosOrigin:s,yPosOrigin:l,selected:c,onClick:d,onMouseEnter:h,onMouseMove:f,onMouseLeave:m,onContextMenu:p,onDoubleClick:g,style:y,className:v,isDraggable:x,isSelectable:b,isConnectable:w,isFocusable:k,selectNodesOnDrag:S,sourcePosition:N,targetPosition:C,hidden:E,resizeObserver:j,dragHandle:_,zIndex:I,isParent:T,noDragClassName:A,noPanClassName:M,initialized:O,disableKeyboardA11y:D,ariaLabel:P,rfId:R,hasHandleBounds:L})=>{const z=pC(),F=r.useRef(null),B=r.useRef(null),U=r.useRef(N),V=r.useRef(C),H=r.useRef(n),$=b||x||d||h||f||m,W=Yj(),G=$j(t,z.getState,h),q=$j(t,z.getState,f),Y=$j(t,z.getState,m),X=$j(t,z.getState,p),K=$j(t,z.getState,g);r.useEffect((()=>()=>{B.current&&(null==j||j.unobserve(B.current),B.current=null)}),[]),r.useEffect((()=>{if(F.current&&!E){const e=F.current;O&&L&&B.current===e||(B.current&&(null==j||j.unobserve(B.current)),null==j||j.observe(e),B.current=e)}}),[E,O,L]),r.useEffect((()=>{const e=H.current!==n,o=U.current!==N,r=V.current!==C;F.current&&(e||o||r)&&(e&&(H.current=n),o&&(U.current=N),r&&(V.current=C),z.getState().updateNodeDimensions([{id:t,nodeElement:F.current,forceUpdate:!0}]))}),[t,n,N,C]);const J=qj({nodeRef:F,disabled:E||!x,noDragClassName:A,handleSelector:_,nodeId:t,isSelectable:b,selectNodesOnDrag:S});return E?null:u.createElement("div",{className:jN(["react-flow__node",`react-flow__node-${n}`,{[M]:x},v,{selected:c,selectable:b,parent:T,dragging:J}]),ref:F,style:{zIndex:I,transform:`translate(${s}px,${l}px)`,pointerEvents:$?"all":"none",visibility:O?"visible":"hidden",...y},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:G,onMouseMove:q,onMouseLeave:Y,onContextMenu:X,onClick:e=>{const{nodeDragThreshold:n}=z.getState();if(b&&(!S||!x||n>0)&&Wj({id:t,store:z,nodeRef:F}),d){const n=z.getState().nodeInternals.get(t);n&&d(e,{...n})}},onDoubleClick:K,onKeyDown:k?e=>{if(!MC(e)&&!D)if(AC.includes(e.key)&&b){const n="Escape"===e.key;Wj({id:t,store:z,unselect:n,nodeRef:F})}else x&&c&&Object.prototype.hasOwnProperty.call(Xj,e.key)&&(z.setState({ariaLiveMessage:`Moved selected node ${e.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~i}`}),W({x:Xj[e.key].x,y:Xj[e.key].y,isShiftPressed:e.shiftKey}))}:void 0,tabIndex:k?0:void 0,role:k?"button":void 0,"aria-describedby":D?void 0:`${tj}-${R}`,"aria-label":P},u.createElement(fE,{value:t},u.createElement(e,{id:t,data:o,type:n,xPos:a,yPos:i,selected:c,isConnectable:w,sourcePosition:N,targetPosition:C,dragging:J,dragHandle:_,zIndex:I})))};return t.displayName="NodeWrapper",r.memo(t)};const Jj=e=>{const t=e.getNodes().filter((e=>e.selected));return{...xE(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};var Zj=r.memo((function({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=pC(),{width:a,height:i,x:s,y:l,transformString:c,userSelectionActive:d}=mC(Jj,ON),h=Yj(),f=r.useRef(null);if(r.useEffect((()=>{var e;n||null==(e=f.current)||e.focus({preventScroll:!0})}),[n]),qj({nodeRef:f}),d||!a||!i)return null;const m=e?t=>{const n=o.getState().getNodes().filter((e=>e.selected));e(t,n)}:void 0;return u.createElement("div",{className:jN(["react-flow__nodesselection","react-flow__container",t]),style:{transform:c}},u.createElement("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:m,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(Xj,e.key)&&h({x:Xj[e.key].x,y:Xj[e.key].y,isShiftPressed:e.shiftKey})},style:{width:a,height:i,top:l,left:s}}))}));const Qj=e=>e.nodesSelectionActive,e_=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:s,deleteKeyCode:l,onMove:c,onMoveStart:d,onMoveEnd:h,selectionKeyCode:f,selectionOnDrag:m,selectionMode:p,onSelectionStart:g,onSelectionEnd:y,multiSelectionKeyCode:v,panActivationKeyCode:x,zoomActivationKeyCode:b,elementsSelectable:w,zoomOnScroll:k,zoomOnPinch:S,panOnScroll:N,panOnScrollSpeed:C,panOnScrollMode:E,zoomOnDoubleClick:j,panOnDrag:_,defaultViewport:I,translateExtent:T,minZoom:A,maxZoom:M,preventScrolling:O,onSelectionContextMenu:D,noWheelClassName:P,noPanClassName:R,disableKeyboardA11y:L})=>{const z=mC(Qj),F=ij(f),B=ij(x),U=B||_,V=B||N,H=F||m&&!0!==U;return(({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=pC(),{deleteElements:o}=xj(),a=ij(e,bj),i=ij(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:i})}),[i])})({deleteKeyCode:l,multiSelectionKeyCode:v}),u.createElement(jj,{onMove:c,onMoveStart:d,onMoveEnd:h,onPaneContextMenu:i,elementsSelectable:w,zoomOnScroll:k,zoomOnPinch:S,panOnScroll:V,panOnScrollSpeed:C,panOnScrollMode:E,zoomOnDoubleClick:j,panOnDrag:!F&&U,defaultViewport:I,translateExtent:T,minZoom:A,maxZoom:M,zoomActivationKeyCode:b,preventScrolling:O,noWheelClassName:P,noPanClassName:R},u.createElement(Lj,{onSelectionStart:g,onSelectionEnd:y,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:U,isSelecting:!!H,selectionMode:p},e,z&&u.createElement(Zj,{onSelectionContextMenu:D,noPanClassName:R,disableKeyboardA11y:L})))};e_.displayName="FlowRenderer";var t_=r.memo(e_);function n_(e){return{...{input:Kj(e.input||FE),default:Kj(e.default||LE),output:Kj(e.output||UE),group:Kj(e.group||VE)},...Object.keys(e).filter((e=>!["input","default","output","group"].includes(e))).reduce(((t,n)=>(t[n]=Kj(e[n]||LE),t)),{})}}const o_=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),r_=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:a,updateNodeDimensions:i,onError:s}=mC(o_,ON),l=(c=e.onlyRenderVisibleElements,mC(r.useCallback((e=>c?bE(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})));i(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:wj},l.map((r=>{var i,l,c;let d=r.type||"default";e.nodeTypes[d]||(null==s||s("003",aC(d)),d="default");const f=e.nodeTypes[d]||e.nodeTypes.default,m=!!(r.draggable||t&&void 0===r.draggable),p=!!(r.selectable||a&&void 0===r.selectable),g=!!(r.connectable||n&&void 0===r.connectable),y=!!(r.focusable||o&&void 0===r.focusable),v=e.nodeExtent?kC(r.positionAbsolute,e.nodeExtent):r.positionAbsolute,x=(null==v?void 0:v.x)??0,b=(null==v?void 0:v.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:x,y:b,width:r.width??0,height:r.height??0,origin:e.nodeOrigin});return u.createElement(f,{key:r.id,id:r.id,className:r.className,style:r.style,type:d,data:r.data,sourcePosition:r.sourcePosition||KC.Bottom,targetPosition:r.targetPosition||KC.Top,hidden:r.hidden,xPos:x,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:m,isSelectable:p,isConnectable:g,isFocusable:y,resizeObserver:h,dragHandle:r.dragHandle,zIndex:(null==(i=r[TC])?void 0:i.z)??0,isParent:!!(null==(l=r[TC])?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[TC])?void 0:c.handleBounds)})})))};r_.displayName="NodeRenderer";var a_=r.memo(r_);const i_=(e,t,n)=>n===KC.Left?e-t:n===KC.Right?e+t:e,s_=(e,t,n)=>n===KC.Top?e-t:n===KC.Bottom?e+t:e,l_="react-flow__edgeupdater",c_=({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:a,onMouseOut:i,type:s})=>u.createElement("circle",{onMouseDown:r,onMouseEnter:a,onMouseOut:i,className:jN([l_,`${l_}-${s}`]),cx:i_(t,o,e),cy:s_(n,o,e),r:o,stroke:"transparent",fill:"transparent"}),d_=()=>!0;var u_=e=>{const t=({id:t,className:n,type:o,data:a,onClick:i,onEdgeDoubleClick:s,selected:l,animated:c,label:d,labelStyle:h,labelShowBg:f,labelBgStyle:m,labelBgPadding:p,labelBgBorderRadius:g,style:y,source:v,target:x,sourceX:b,sourceY:w,targetX:k,targetY:S,sourcePosition:N,targetPosition:C,elementsSelectable:E,hidden:j,sourceHandleId:_,targetHandleId:I,onContextMenu:T,onMouseEnter:A,onMouseMove:M,onMouseLeave:O,reconnectRadius:D,onReconnect:P,onReconnectStart:R,onReconnectEnd:L,markerEnd:z,markerStart:F,rfId:B,ariaLabel:U,isFocusable:V,isReconnectable:H,pathOptions:$,interactionWidth:W,disableKeyboardA11y:G})=>{const q=r.useRef(null),[Y,X]=r.useState(!1),[K,J]=r.useState(!1),Z=pC(),Q=r.useMemo((()=>`url('#${pE(F,B)}')`),[F,B]),ee=r.useMemo((()=>`url('#${pE(z,B)}')`),[z,B]);if(j)return null;const te=LC(t,Z.getState,s),ne=LC(t,Z.getState,T),oe=LC(t,Z.getState,A),re=LC(t,Z.getState,M),ae=LC(t,Z.getState,O),ie=(e,n)=>{if(0!==e.button)return;const{edges:o,isValidConnection:r}=Z.getState(),a=n?x:v,i=(n?I:_)||null,s=n?"target":"source",l=r||d_,c=n,d=o.find((e=>e.id===t));J(!0),null==R||R(e,d,s);AE({event:e,handleId:i,nodeId:a,onConnect:e=>null==P?void 0:P(d,e),isTarget:c,getState:Z.getState,setState:Z.setState,isValidConnection:l,edgeUpdaterType:s,onReconnectEnd:e=>{J(!1),null==L||L(e,d,s)}})},se=()=>X(!0),le=()=>X(!1),ce=!E&&!i;return u.createElement("g",{className:jN(["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:s}=Z.getState(),l=o.find((e=>e.id===t));l&&(E&&(Z.setState({nodesSelectionActive:!1}),l.selected&&s?(a({nodes:[],edges:[l]}),null==(n=q.current)||n.blur()):r([t])),i&&i(e,l))},onDoubleClick:te,onContextMenu:ne,onMouseEnter:oe,onMouseMove:re,onMouseLeave:ae,onKeyDown:V?e=>{var n;if(!G&&AC.includes(e.key)&&E){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 ${v} to ${x}`,"aria-describedby":V?`${nj}-${B}`:void 0,ref:q},!K&&u.createElement(e,{id:t,source:v,target:x,selected:l,animated:c,label:d,labelStyle:h,labelShowBg:f,labelBgStyle:m,labelBgPadding:p,labelBgBorderRadius:g,data:a,style:y,sourceX:b,sourceY:w,targetX:k,targetY:S,sourcePosition:N,targetPosition:C,sourceHandleId:_,targetHandleId:I,markerStart:Q,markerEnd:ee,pathOptions:$,interactionWidth:W}),H&&u.createElement(u.Fragment,null,("source"===H||!0===H)&&u.createElement(c_,{position:N,centerX:b,centerY:w,radius:D,onMouseDown:e=>ie(e,!0),onMouseEnter:se,onMouseOut:le,type:"source"}),("target"===H||!0===H)&&u.createElement(c_,{position:C,centerX:k,centerY:S,radius:D,onMouseDown:e=>ie(e,!1),onMouseEnter:se,onMouseOut:le,type:"target"})))};return t.displayName="EdgeWrapper",r.memo(t)};function h_(e){return{...{default:u_(e.default||uE),straight:u_(e.bezier||sE),step:u_(e.step||iE),smoothstep:u_(e.step||aE),simplebezier:u_(e.simplebezier||eE)},...Object.keys(e).filter((e=>!["default","bezier"].includes(e))).reduce(((t,n)=>(t[n]=u_(e[n]||uE),t)),{})}}function f_(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,i=(null==n?void 0:n.height)||t.height;switch(e){case KC.Top:return{x:o+a/2,y:r};case KC.Right:return{x:o+a,y:r+i/2};case KC.Bottom:return{x:o+a/2,y:r+i};case KC.Left:return{x:o,y:r+i/2}}}function m_(e,t){return e?1!==e.length&&t?t&&e.find((e=>e.id===t))||null:e[0]:null}function p_(e){var t,n,o,r,a;const i=(null==(t=null==e?void 0:e[TC])?void 0:t.handleBounds)||null,s=i&&(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},i,!!s]}const g_=[{level:0,isMaxLevel:!0,edges:[]}];function y_(e,t,n){return function(e,t,n=!1){let o=-1;const r=e.reduce(((e,r)=>{var a,i;const s=IC(r.zIndex);let l=s?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[TC])?void 0:a.z)||0,(null==(i=null==e?void 0:e[TC])?void 0:i.z)||0,1e3);l=(s?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?g_:a}(mC(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:i,height:s,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=EC({x:(0-l[0])/l[2],y:(0-l[1])/l[2],width:i/l[2],height:s/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 v_={[YC.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"}),[YC.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 x_=({id:e,type:t,color:n,width:o=12.5,height:a=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:l="auto-start-reverse"})=>{const c=function(e){const t=pC();return r.useMemo((()=>{var n,o;return Object.prototype.hasOwnProperty.call(v_,e)?v_[e]:(null==(o=(n=t.getState()).onError)||o.call(n,"009",lC(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:i,orient:l,refX:"0",refY:"0"},u.createElement(c,{color:n,strokeWidth:s})):null},b_=({defaultColor:e,rfId:t})=>{const n=mC(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=pE(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(x_,{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}))))};b_.displayName="MarkerDefinitions";var w_=r.memo(b_);const k_=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}),S_=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:o,edgeTypes:r,noPanClassName:a,onEdgeContextMenu:i,onEdgeMouseEnter:s,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:d,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:m,onReconnectEnd:p,reconnectRadius:g,children:y,disableKeyboardA11y:v})=>{const{edgesFocusable:x,edgesUpdatable:b,elementsSelectable:w,width:k,height:S,connectionMode:N,nodeInternals:C,onError:E}=mC(k_,ON),j=y_(t,C,n);return k?u.createElement(u.Fragment,null,j.map((({level:t,edges:n,isMaxLevel:y})=>u.createElement("svg",{key:t,style:{zIndex:t},width:k,height:S,className:"react-flow__edges react-flow__container"},y&&u.createElement(w_,{defaultColor:e,rfId:o}),u.createElement("g",null,n.map((e=>{const[t,n,y]=p_(C.get(e.source)),[k,S,j]=p_(C.get(e.target));if(!y||!j)return null;let _=e.type||"default";r[_]||(null==E||E("011",uC(_)),_="default");const I=r[_]||r.default,T=N===BC.Strict?S.target:(S.target??[]).concat(S.source??[]),A=m_(n.source,e.sourceHandle),M=m_(T,e.targetHandle),O=(null==A?void 0:A.position)||KC.Bottom,D=(null==M?void 0:M.position)||KC.Top,P=!!(e.focusable||x&&void 0===e.focusable),R=e.reconnectable||e.updatable,L=void 0!==f&&(R||b&&void 0===R);if(!A||!M)return null==E||E("008",cC(A,e)),null;const{sourceX:z,sourceY:F,targetX:B,targetY:U}=((e,t,n,o,r,a)=>{const i=f_(n,e,t),s=f_(a,o,r);return{sourceX:i.x,sourceY:i.y,targetX:s.x,targetY:s.y}})(t,A,O,k,M,D);return u.createElement(I,{key:e.id,id:e.id,className:jN([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:z,sourceY:F,targetX:B,targetY:U,sourcePosition:O,targetPosition:D,elementsSelectable:w,onContextMenu:i,onMouseEnter:s,onMouseMove:l,onMouseLeave:c,onClick:d,onEdgeDoubleClick:h,onReconnect:f,onReconnectStart:m,onReconnectEnd:p,reconnectRadius:g,rfId:o,ariaLabel:e.ariaLabel,isFocusable:P,isReconnectable:L,pathOptions:"pathOptions"in e?e.pathOptions:void 0,interactionWidth:e.interactionWidth,disableKeyboardA11y:v})})))))),y):null};S_.displayName="EdgeRenderer";var N_=r.memo(S_);const C_=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function E_({children:e}){const t=mC(C_);return u.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}const j_={[KC.Left]:KC.Right,[KC.Right]:KC.Left,[KC.Top]:KC.Bottom,[KC.Bottom]:KC.Top},__=({nodeId:e,handleType:t,style:n,type:o=GC.Bezier,CustomComponent:a,connectionStatus:i})=>{var s,l,c;const{fromNode:d,handleId:h,toX:f,toY:m,connectionMode:p}=mC(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]),ON),g=null==(s=null==d?void 0:d[TC])?void 0:s.handleBounds;let y=null==g?void 0:g[t];if(p===BC.Loose&&(y=y||(null==g?void 0:g["source"===t?"target":"source"])),!d||!y)return null;const v=h?y.find((e=>e.id===h)):y[0],x=v?v.x+v.width/2:(d.width??0)/2,b=v?v.y+v.height/2:d.height??0,w=((null==(l=d.positionAbsolute)?void 0:l.x)??0)+x,k=((null==(c=d.positionAbsolute)?void 0:c.y)??0)+b,S=null==v?void 0:v.position,N=S?j_[S]:null;if(!S||!N)return null;if(a)return u.createElement(a,{connectionLineType:o,connectionLineStyle:n,fromNode:d,fromHandle:v,fromX:w,fromY:k,toX:f,toY:m,fromPosition:S,toPosition:N,connectionStatus:i});let C="";const E={sourceX:w,sourceY:k,sourcePosition:S,targetX:f,targetY:m,targetPosition:N};return o===GC.Bezier?[C]=dE(E):o===GC.Step?[C]=rE({...E,borderRadius:0}):o===GC.SmoothStep?[C]=rE(E):o===GC.SimpleBezier?[C]=QC(E):C=`M${w},${k} ${f},${m}`,u.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};__.displayName="ConnectionLine";const I_=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function T_({containerStyle:e,style:t,type:n,component:o}){const{nodeId:r,handleType:a,nodesConnectable:i,width:s,height:l,connectionStatus:c}=mC(I_,ON);return!!(r&&a&&s&&i)?u.createElement("svg",{style:e,width:s,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},u.createElement("g",{className:jN(["react-flow__connection",c])},u.createElement(__,{nodeId:r,handleType:a,style:t,type:n,CustomComponent:o,connectionStatus:c}))):null}function A_(e,t){r.useRef(null),pC();return r.useMemo((()=>t(e)),[e])}const M_=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:o,onMoveEnd:a,onInit:i,onNodeClick:s,onEdgeClick:l,onNodeDoubleClick:c,onEdgeDoubleClick:d,onNodeMouseEnter:h,onNodeMouseMove:f,onNodeMouseLeave:m,onNodeContextMenu:p,onSelectionContextMenu:g,onSelectionStart:y,onSelectionEnd:v,connectionLineType:x,connectionLineStyle:b,connectionLineComponent:w,connectionLineContainerStyle:k,selectionKeyCode:S,selectionOnDrag:N,selectionMode:C,multiSelectionKeyCode:E,panActivationKeyCode:j,zoomActivationKeyCode:_,deleteKeyCode:I,onlyRenderVisibleElements:T,elementsSelectable:A,selectNodesOnDrag:M,defaultViewport:O,translateExtent:D,minZoom:P,maxZoom:R,preventScrolling:L,defaultMarkerColor:z,zoomOnScroll:F,zoomOnPinch:B,panOnScroll:U,panOnScrollSpeed:V,panOnScrollMode:H,zoomOnDoubleClick:$,panOnDrag:W,onPaneClick:G,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:ie,noWheelClassName:se,noPanClassName:le,elevateEdgesOnSelect:ce,disableKeyboardA11y:de,nodeOrigin:ue,nodeExtent:he,rfId:fe})=>{const me=A_(e,n_),pe=A_(t,h_);return function(e){const t=xj(),n=r.useRef(!1);r.useEffect((()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout((()=>e(t)),1),n.current=!0)}),[e,t.viewportInitialized])}(i),u.createElement(t_,{onPaneClick:G,onPaneMouseEnter:q,onPaneMouseMove:Y,onPaneMouseLeave:X,onPaneContextMenu:J,onPaneScroll:K,deleteKeyCode:I,selectionKeyCode:S,selectionOnDrag:N,selectionMode:C,onSelectionStart:y,onSelectionEnd:v,multiSelectionKeyCode:E,panActivationKeyCode:j,zoomActivationKeyCode:_,elementsSelectable:A,onMove:n,onMoveStart:o,onMoveEnd:a,zoomOnScroll:F,zoomOnPinch:B,zoomOnDoubleClick:$,panOnScroll:U,panOnScrollSpeed:V,panOnScrollMode:H,panOnDrag:W,defaultViewport:O,translateExtent:D,minZoom:P,maxZoom:R,onSelectionContextMenu:g,preventScrolling:L,noDragClassName:ie,noWheelClassName:se,noPanClassName:le,disableKeyboardA11y:de},u.createElement(E_,null,u.createElement(N_,{edgeTypes:pe,onEdgeClick:l,onEdgeDoubleClick:d,onlyRenderVisibleElements:T,onEdgeContextMenu:Z,onEdgeMouseEnter:Q,onEdgeMouseMove:ee,onEdgeMouseLeave:te,onReconnect:ne,onReconnectStart:oe,onReconnectEnd:re,reconnectRadius:ae,defaultMarkerColor:z,noPanClassName:le,elevateEdgesOnSelect:!!ce,disableKeyboardA11y:de,rfId:fe},u.createElement(T_,{style:b,type:x,component:w,containerStyle:k})),u.createElement("div",{className:"react-flow__edgelabel-renderer"}),u.createElement(a_,{nodeTypes:me,onNodeClick:s,onNodeDoubleClick:c,onNodeMouseEnter:h,onNodeMouseMove:f,onNodeMouseLeave:m,onNodeContextMenu:p,selectNodesOnDrag:M,onlyRenderVisibleElements:T,noPanClassName:le,noDragClassName:ie,disableKeyboardA11y:de,nodeOrigin:ue,nodeExtent:he,rfId:fe})))};M_.displayName="GraphView";var O_=r.memo(M_);const D_=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],P_={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:D_,nodeExtent:D_,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:BC.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},R_=()=>{return e=(e,t)=>({...P_,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:a}=t();e({nodeInternals:uj(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,i=r?uj(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:i,edges:a?o:[],hasDefaultNodes:r,hasDefaultEdges:a})},updateNodeDimensions:n=>{const{onNodesChange:o,nodeInternals:r,fitViewOnInit:a,fitViewOnInitDone:i,fitViewOnInitOptions:s,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),f=n.reduce(((e,t)=>{const n=r.get(t.id);if(null==n?void 0:n.hidden)r.set(n.id,{...n,[TC]:{...n[TC],handleBounds:void 0}});else if(n){const o=bC(t.nodeElement);o.width&&o.height&&(n.width!==o.width||n.height!==o.height||t.forceUpdate)&&(r.set(n.id,{...n,[TC]:{...n[TC],handleBounds:{source:Hj(".source",t.nodeElement,h,c),target:Hj(".target",t.nodeElement,h,c)}},...o}),e.push({id:n.id,type:"dimensions",dimensions:o}))}return e}),[]);dj(r,c);const m=i||a&&!i&&hj(t,{initial:!0,...s});e({nodeInternals:new Map(r),fitViewOnInitDone:m}),(null==f?void 0:f.length)>0&&(null==o||o(f))},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:i,getNodes:s,elevateNodesOnSelect:l}=t();if(null==n?void 0:n.length){if(a){const t=uj(Mj(n,s()),r,i,l);e({nodeInternals:t})}null==o||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:r,getNodes:a}=t();let i,s=null;o?i=n.map((e=>Oj(e,!0))):(i=Dj(a(),n),s=Dj(r,[])),pj({changedNodes:i,changedEdges:s,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:o,edges:r,getNodes:a}=t();let i,s=null;o?i=n.map((e=>Oj(e,!0))):(i=Dj(r,n),s=Dj(a(),[])),pj({changedNodes:s,changedEdges:i,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:a}=t(),i=o||r;pj({changedNodes:(n||a()).map((e=>(e.selected=!1,Oj(e.id,!1)))),changedEdges:i.map((e=>Oj(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();pj({changedNodes:o().filter((e=>e.selected)).map((e=>Oj(e.id,!1))),changedEdges:n.filter((e=>e.selected)).map((e=>Oj(e.id,!1))),get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:o}=t();o.forEach((e=>{e.positionAbsolute=kC(e.position,n)})),e({nodeExtent:n,nodeInternals:new Map(o)})},panBy:e=>{const{transform:n,width:o,height:r,d3Zoom:a,d3Selection:i,translateExtent:s}=t();if(!a||!i||!e.x&&!e.y)return!1;const l=Xl.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,s);return a.transform(i,d),n[0]!==d.x||n[1]!==d.y||n[2]!==d.k},cancelConnection:()=>e({connectionNodeId:P_.connectionNodeId,connectionHandleId:P_.connectionHandleId,connectionHandleType:P_.connectionHandleType,connectionStatus:P_.connectionStatus,connectionStartHandle:P_.connectionStartHandle,connectionEndHandle:P_.connectionEndHandle}),reset:()=>e({...P_})}),t=Object.is,e?MN(e,t):MN;var e,t},L_=({children:e})=>{const t=r.useRef(null);return t.current||(t.current=R_()),u.createElement(rC,{value:t.current},e)};L_.displayName="ReactFlowProvider";const z_=({children:e})=>r.useContext(oC)?u.createElement(u.Fragment,null,e):u.createElement(L_,null,e);z_.displayName="ReactFlowWrapper";const F_={input:FE,default:LE,output:UE,group:VE},B_={default:uE,straight:sE,step:iE,smoothstep:aE,simplebezier:eE},U_=[0,0],V_=[15,15],H_={x:0,y:0,zoom:1},$_={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},W_=r.forwardRef((({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:a=F_,edgeTypes:i=B_,onNodeClick:s,onEdgeClick:l,onInit:c,onMove:d,onMoveStart:h,onMoveEnd:f,onConnect:m,onConnectStart:p,onConnectEnd:g,onClickConnectStart:y,onClickConnectEnd:v,onNodeMouseEnter:x,onNodeMouseMove:b,onNodeMouseLeave:w,onNodeContextMenu:k,onNodeDoubleClick:S,onNodeDragStart:N,onNodeDrag:C,onNodeDragStop:E,onNodesDelete:j,onEdgesDelete:_,onSelectionChange:I,onSelectionDragStart:T,onSelectionDrag:A,onSelectionDragStop:M,onSelectionContextMenu:O,onSelectionStart:D,onSelectionEnd:P,connectionMode:R=BC.Strict,connectionLineType:L=GC.Bezier,connectionLineStyle:z,connectionLineComponent:F,connectionLineContainerStyle:B,deleteKeyCode:U="Backspace",selectionKeyCode:V="Shift",selectionOnDrag:H=!1,selectionMode:$=$C.Full,panActivationKeyCode:W="Space",multiSelectionKeyCode:G=(PC()?"Meta":"Control"),zoomActivationKeyCode:q=(PC()?"Meta":"Control"),snapToGrid:Y=!1,snapGrid:X=V_,onlyRenderVisibleElements:K=!1,selectNodesOnDrag:J=!0,nodesDraggable:Z,nodesConnectable:Q,nodesFocusable:ee,nodeOrigin:te=U_,edgesFocusable:ne,edgesUpdatable:oe,elementsSelectable:re,defaultViewport:ae=H_,minZoom:ie=.5,maxZoom:se=2,translateExtent:le=D_,preventScrolling:ce=!0,nodeExtent:de,defaultMarkerColor:ue="#b1b1b7",zoomOnScroll:he=!0,zoomOnPinch:fe=!0,panOnScroll:me=!1,panOnScrollSpeed:pe=.5,panOnScrollMode:ge=VC.Free,zoomOnDoubleClick:ye=!0,panOnDrag:ve=!0,onPaneClick:xe,onPaneMouseEnter:be,onPaneMouseMove:we,onPaneMouseLeave:ke,onPaneScroll:Se,onPaneContextMenu:Ne,children:Ce,onEdgeContextMenu:Ee,onEdgeDoubleClick:je,onEdgeMouseEnter:_e,onEdgeMouseMove:Ie,onEdgeMouseLeave:Te,onEdgeUpdate:Ae,onEdgeUpdateStart:Me,onEdgeUpdateEnd:Oe,onReconnect:De,onReconnectStart:Pe,onReconnectEnd:Re,reconnectRadius:Le=10,edgeUpdaterRadius:ze=10,onNodesChange:Fe,onEdgesChange:Be,noDragClassName:Ue="nodrag",noWheelClassName:Ve="nowheel",noPanClassName:He="nopan",fitView:$e=!1,fitViewOptions:We,connectOnClick:Ge=!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:it,...st},lt)=>{const ct=at||"1";return u.createElement("div",{...st,style:{...rt,...$_},ref:lt,className:jN(["react-flow",r]),"data-testid":"rf__wrapper",id:at},u.createElement(z_,null,u.createElement(O_,{onInit:c,onMove:d,onMoveStart:h,onMoveEnd:f,onNodeClick:s,onEdgeClick:l,onNodeMouseEnter:x,onNodeMouseMove:b,onNodeMouseLeave:w,onNodeContextMenu:k,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:i,connectionLineType:L,connectionLineStyle:z,connectionLineComponent:F,connectionLineContainerStyle:B,selectionKeyCode:V,selectionOnDrag:H,selectionMode:$,deleteKeyCode:U,multiSelectionKeyCode:G,panActivationKeyCode:W,zoomActivationKeyCode:q,onlyRenderVisibleElements:K,selectNodesOnDrag:J,defaultViewport:ae,translateExtent:le,minZoom:ie,maxZoom:se,preventScrolling:ce,zoomOnScroll:he,zoomOnPinch:fe,zoomOnDoubleClick:ye,panOnScroll:me,panOnScrollSpeed:pe,panOnScrollMode:ge,panOnDrag:ve,onPaneClick:xe,onPaneMouseEnter:be,onPaneMouseMove:we,onPaneMouseLeave:ke,onPaneScroll:Se,onPaneContextMenu:Ne,onSelectionContextMenu:O,onSelectionStart:D,onSelectionEnd:P,onEdgeContextMenu:Ee,onEdgeDoubleClick:je,onEdgeMouseEnter:_e,onEdgeMouseMove:Ie,onEdgeMouseLeave:Te,onReconnect:De??Ae,onReconnectStart:Pe??Me,onReconnectEnd:Re??Oe,reconnectRadius:Le??ze,defaultMarkerColor:ue,noDragClassName:Ue,noWheelClassName:Ve,noPanClassName:He,elevateEdgesOnSelect:Je,rfId:ct,disableKeyboardA11y:Ze,nodeOrigin:te,nodeExtent:de}),u.createElement(ZE,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:m,onConnectStart:p,onConnectEnd:g,onClickConnectStart:y,onClickConnectEnd:v,nodesDraggable:Z,nodesConnectable:Q,nodesFocusable:ee,edgesFocusable:ne,edgesUpdatable:oe,elementsSelectable:re,elevateNodesOnSelect:Ke,minZoom:ie,maxZoom:se,nodeExtent:de,onNodesChange:Fe,onEdgesChange:Be,snapToGrid:Y,snapGrid:X,connectionMode:R,translateExtent:le,connectOnClick:Ge,defaultEdgeOptions:Xe,fitView:$e,fitViewOptions:We,onNodesDelete:j,onEdgesDelete:_,onNodeDragStart:N,onNodeDrag:C,onNodeDragStop:E,onSelectionDrag:A,onSelectionDragStart:T,onSelectionDragStop:M,noPanClassName:He,nodeOrigin:te,rfId:ct,autoPanOnConnect:Qe,autoPanOnNodeDrag:et,onError:ot,connectionRadius:tt,isValidConnection:nt,nodeDragThreshold:it}),u.createElement(YE,{onSelectionChange:I}),Ce,u.createElement(vC,{proOptions:Ye,position:qe}),u.createElement(aj,{rfId:ct,disableKeyboardA11y:Ze})))}));function G_(e){return t=>{const[n,o]=r.useState(t),a=r.useCallback((t=>o((n=>e(t,n)))),[]);return[n,o,a]}}W_.displayName="ReactFlow";const q_=G_(Mj),Y_=G_((function(e,t){return Aj(e,t)}));function X_(){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 K_(){return u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},u.createElement("path",{d:"M0 0h32v4.2H0z"}))}function J_(){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 Z_(){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 Q_(){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 eI=({children:e,className:t,...n})=>u.createElement("button",{type:"button",className:jN(["react-flow__controls-button",t]),...n},e);eI.displayName="ControlButton";const tI=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),nI=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:a,onZoomIn:i,onZoomOut:s,onFitView:l,onInteractiveChange:c,className:d,children:h,position:f="bottom-left"})=>{const m=pC(),[p,g]=r.useState(!1),{isInteractive:y,minZoomReached:v,maxZoomReached:x}=mC(tI,ON),{zoomIn:b,zoomOut:w,fitView:k}=xj();if(r.useEffect((()=>{g(!0)}),[]),!p)return null;return u.createElement(yC,{className:jN(["react-flow__controls",d]),position:f,style:e,"data-testid":"rf__controls"},t&&u.createElement(u.Fragment,null,u.createElement(eI,{onClick:()=>{b(),null==i||i()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:x},u.createElement(X_,null)),u.createElement(eI,{onClick:()=>{w(),null==s||s()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:v},u.createElement(K_,null))),n&&u.createElement(eI,{className:"react-flow__controls-fitview",onClick:()=>{k(a),null==l||l()},title:"fit view","aria-label":"fit view"},u.createElement(J_,null)),o&&u.createElement(eI,{className:"react-flow__controls-interactive",onClick:()=>{m.setState({nodesDraggable:!y,nodesConnectable:!y,elementsSelectable:!y}),null==c||c(!y)},title:"toggle interactivity","aria-label":"toggle interactivity"},y?u.createElement(Q_,null):u.createElement(Z_,null)),h)};nI.displayName="Controls";var oI,rI,aI=r.memo(nI);function iI({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 sI({color:e,radius:t}){return u.createElement("circle",{cx:t,cy:t,r:t,fill:e})}(rI=oI||(oI={})).Lines="lines",rI.Dots="dots",rI.Cross="cross";const lI={[oI.Dots]:"#91919a",[oI.Lines]:"#eee",[oI.Cross]:"#e2e2e2"},cI={[oI.Dots]:1,[oI.Lines]:1,[oI.Cross]:6},dI=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function uI({id:e,variant:t=oI.Dots,gap:n=20,size:o,lineWidth:a=1,offset:i=2,color:s,style:l,className:c}){const d=r.useRef(null),{transform:h,patternId:f}=mC(dI,ON),m=s||lI[t],p=o||cI[t],g=t===oI.Dots,y=t===oI.Cross,v=Array.isArray(n)?n:[n,n],x=[v[0]*h[2]||1,v[1]*h[2]||1],b=p*h[2],w=y?[b,b]:x,k=g?[b/i,b/i]:[w[0]/i,w[1]/i];return u.createElement("svg",{className:jN(["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:f+e,x:h[0]%x[0],y:h[1]%x[1],width:x[0],height:x[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`},g?u.createElement(sI,{color:m,radius:b/i}):u.createElement(iI,{dimensions:w,color:m,lineWidth:a})),u.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${f+e})`}))}uI.displayName="Background";var hI=r.memo(uI);function fI(e){return Math.min(11*e+35,200)}const mI=u.createContext("LR"),pI=r.memo((e=>{const t=S(51),{data:n,selected:o}=e,a=ee(n.atom),i=ae().inOrderIds.indexOf(a.id),s=o?"var(--gray-9)":"var(--gray-3)",l=mC(yI),c=r.useContext(mI);let d,u,h,f,m;if(t[0]!==a.code||t[1]!==c||t[2]!==s||t[3]!==o){const e=a.code.split("\n").length,n="LR"===c?KC.Left:KC.Top;let r;t[8]!==s?(r={background:s},t[8]=s,t[9]=r):r=t[9],t[10]!==n||t[11]!==r?(h=C.jsx(PE,{type:"target",id:"inputs",position:n,style:r}),t[10]=n,t[11]=r,t[12]=h):h=t[12];const i="LR"===c?KC.Left:KC.Top;let l;t[13]!==s?(l={background:s},t[13]=s,t[14]=l):l=t[14],t[15]!==i||t[16]!==l?(f=C.jsx(PE,{type:"source",id:"inputs",position:i,style:l}),t[15]=i,t[16]=l,t[17]=f):f=t[17];const m=o&&"border-primary";t[18]!==m?(u=hn("flex flex-col bg-card border border-input/50 rounded-md mx-[2px] overflow-hidden",m),t[18]=m,t[19]=u):u=t[19],d=fI(e),t[0]=a.code,t[1]=c,t[2]=s,t[3]=o,t[4]=d,t[5]=u,t[6]=h,t[7]=f}else d=t[4],u=t[5],h=t[6],f=t[7];var p;let g;t[20]!==n.forceWidth||t[21]!==l?(m=n.forceWidth||(p=l,Math.min(Math.max(p-100,100),400)),t[20]=n.forceWidth,t[21]=l,t[22]=m):m=t[22],t[23]!==d||t[24]!==m?(g={height:d,width:m},t[23]=d,t[24]=m,t[25]=g):g=t[25];const y=Ei(a.name,i);let v,x,b;t[26]!==y?(v=C.jsx("div",{className:"text-muted-foreground font-semibold text-xs py-1 px-2 bg-muted border-b",children:y}),t[26]=y,t[27]=v):v=t[27],t[28]!==a.code?(x=C.jsx(Wl,{code:a.code}),t[28]=a.code,t[29]=x):x=t[29],t[30]!==u||t[31]!==g||t[32]!==v||t[33]!==x?(b=C.jsxs("div",{className:u,style:g,children:[v,x]}),t[30]=u,t[31]=g,t[32]=v,t[33]=x,t[34]=b):b=t[34];const w="LR"===c?KC.Right:KC.Bottom;let k,N;t[35]!==s?(k={background:s},t[35]=s,t[36]=k):k=t[36],t[37]!==w||t[38]!==k?(N=C.jsx(PE,{type:"source",id:"outputs",position:w,style:k}),t[37]=w,t[38]=k,t[39]=N):N=t[39];const E="LR"===c?KC.Right:KC.Bottom;let j,_,I;return t[40]!==s?(j={background:s},t[40]=s,t[41]=j):j=t[41],t[42]!==E||t[43]!==j?(_=C.jsx(PE,{type:"target",id:"outputs",position:E,style:j}),t[42]=E,t[43]=j,t[44]=_):_=t[44],t[45]!==h||t[46]!==f||t[47]!==b||t[48]!==N||t[49]!==_?(I=C.jsxs("div",{children:[h,f,b,N,_]}),t[45]=h,t[46]=f,t[47]=b,t[48]=N,t[49]=_,t[50]=I):I=t[50],I}),((e,t)=>["data","selected","id"].every((n=>e[n]===t[n]))));pI.displayName="CustomNode";const gI={custom:pI};function yI(e){const{width:t}=e;return t}const vI=e=>{const t=S(18),{maxCount:n,cellIds:o,onClick:r,skipScroll:a}=e,i=ae();let s,l,c,d;if(t[0]!==o||t[1]!==i.inOrderIds||t[2]!==n||t[3]!==a||t[4]!==r){c=Symbol.for("react.early_return_sentinel");e:{let e;t[8]!==i.inOrderIds?(e=(e,t)=>i.inOrderIds.indexOf(e)-i.inOrderIds.indexOf(t),t[8]=i.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=C.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)=>C.jsxs("span",{className:"truncate",children:[C.jsx(ji,{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],s=d.slice(0,n).map(u),l=o.length>n&&C.jsxs(yn,{children:[C.jsx(Br,{asChild:!0,children:C.jsxs("span",{className:"whitespace-nowrap text-muted-foreground text-xs hover:underline cursor-pointer",children:["+",o.length-n," more"]})}),C.jsx(gn,{className:"w-auto",children:C.jsx("div",{className:"flex flex-col gap-1 py-1",children:d.slice(n).map((e=>C.jsx(ji,{variant:"focus",cellId:e,className:"whitespace-nowrap",onClick:r?()=>r(e):void 0},e)))})})]})}t[0]=o,t[1]=i.inOrderIds,t[2]=n,t[3]=a,t[4]=r,t[5]=s,t[6]=l,t[7]=c}else s=t[5],l=t[6],c=t[7];return c!==Symbol.for("react.early_return_sentinel")?c:(t[15]!==s||t[16]!==l?(d=C.jsxs(C.Fragment,{children:[s,l]}),t[15]=s,t[16]=l,t[17]=d):d=t[17],d)},xI=e=>{const t=S(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 i=n.length>1?"destructive":"outline";let s,l,c;return t[5]!==o||t[6]!==r?(s=async e=>{o?o(e):(await Je(r),K({title:"Copied to clipboard"}))},t[5]=o,t[6]=r,t[7]=s):s=t[7],t[8]!==r||t[9]!==i||t[10]!==s?(l=C.jsx(_i,{title:r,variant:i,className:"rounded-sm text-ellipsis block overflow-hidden max-w-fit cursor-pointer font-medium",onClick:s,children:r}),t[8]=r,t[9]=i,t[10]=s,t[11]=l):l=t[11],t[12]!==a||t[13]!==l?(c=C.jsx("div",{className:"max-w-[130px]",...a,children:l}),t[12]=a,t[13]=l,t[14]=c):c=t[14],c},bI=r.memo((e=>{const t=S(38),{onChange:n,view:o,settings:r,onSettingsChange:a}=e;let i;t[0]!==a||t[1]!==r?(i=(e,t)=>{a({...r,[e]:t})},t[0]=a,t[1]=r,t[2]=i):i=t[2];const s=i;let l,c,d,u,h,f;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=C.jsx(Br,{asChild:!0,children:C.jsx(W,{variant:"text",size:"xs",children:C.jsx(At,{className:"w-4 h-4"})})}),t[3]=l):l=t[3],t[4]===Symbol.for("react.memo_cache_sentinel")?(c=C.jsx("div",{className:"font-semibold pb-4",children:"Settings"}),t[4]=c):c=t[4],t[5]!==s?(d=e=>s("hidePureMarkdown",Boolean(e)),t[5]=s,t[6]=d):d=t[6],t[7]!==r.hidePureMarkdown||t[8]!==d?(u=C.jsx(ma,{"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=C.jsx(Ce,{htmlFor:"hide-pure-markdown",children:"Hide pure markdown"}),t[10]=h):h=t[10],t[11]!==u?(f=C.jsxs(yn,{children:[l,C.jsxs(gn,{className:"w-auto p-2 text-muted-foreground",children:[c,C.jsxs("div",{className:"flex items-center gap-2",children:[u,h]})]})]}),t[11]=u,t[12]=f):f=t[12];const m=f,p="_minimap_"===o;let g,y,v;t[13]!==n?(g=()=>n("_minimap_"),t[13]=n,t[14]=g):g=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(y=C.jsx(Jc,{className:"w-4 h-4 mr-1"}),t[15]=y):y=t[15],t[16]!==p||t[17]!==g?(v=C.jsxs(W,{variant:"outline",className:"bg-background","aria-selected":p,size:"xs",onClick:g,children:[y,"Mini Map"]}),t[16]=p,t[17]=g,t[18]=v):v=t[18];const x="TB"===o;let b,w,k;t[19]!==n?(b=()=>n("TB"),t[19]=n,t[20]=b):b=t[20],t[21]===Symbol.for("react.memo_cache_sentinel")?(w=C.jsx(Fc,{className:"w-4 h-4 mr-1"}),t[21]=w):w=t[21],t[22]!==x||t[23]!==b?(k=C.jsxs(W,{variant:"outline",className:"bg-background","aria-selected":x,size:"xs",onClick:b,children:[w,"Vertical Tree"]}),t[22]=x,t[23]=b,t[24]=k):k=t[24];const N="LR"===o;let E,j,_,I;t[25]!==n?(E=()=>n("LR"),t[25]=n,t[26]=E):E=t[26],t[27]===Symbol.for("react.memo_cache_sentinel")?(j=C.jsx(Fc,{className:"w-4 h-4 mr-1 transform -rotate-90"}),t[27]=j):j=t[27],t[28]!==N||t[29]!==E?(_=C.jsxs(W,{variant:"outline",className:"bg-background","aria-selected":N,size:"xs",onClick:E,children:[j," ","Horizontal Tree"]}),t[28]=N,t[29]=E,t[30]=_):_=t[30],t[31]!==v||t[32]!==k||t[33]!==_?(I=C.jsxs("div",{className:"flex gap-2",children:[v,k,_]}),t[31]=v,t[32]=k,t[33]=_,t[34]=I):I=t[34];const T="_minimap_"!==o&&m;let A;return t[35]!==I||t[36]!==T?(A=C.jsxs(yC,{position:"top-right",className:"flex flex-col items-end gap-2",children:[I,T]}),t[35]=I,t[36]=T,t[37]=A):A=t[37],A}));bI.displayName="GraphToolbar";const wI=r.memo((e=>{const t=S(11),{selection:n,variables:o,onClearSelection:r}=e;if(!n)return null;const a=kI;let i;t[0]!==n.type||t[1]!==n.id||t[2]!==n.source||t[3]!==n.target||t[4]!==o||t[5]!==r?(i=()=>{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))),i=(e,t)=>C.jsxs(C.Fragment,{children:[0===e.length&&C.jsx("div",{className:"text-muted-foreground text-sm text-center",children:"--"}),C.jsx("div",{className:"grid grid-cols-5 gap-3 items-center text-sm py-1 flex-1 empty:hidden",children:e.map((e=>C.jsxs(u.Fragment,{children:[C.jsx(xI,{declaredBy:e.declaredBy,name:e.name}),C.jsxs("div",{className:"truncate col-span-2",title:e.value??"",children:[e.value,C.jsxs("span",{className:"ml-1 truncate text-foreground/60 font-mono",children:["(",e.dataType,")"]})]}),C.jsx("div",{className:"truncate col-span-2 gap-1 items-center",children:C.jsx(vI,{skipScroll:!0,onClick:()=>a("in"===t?e.declaredBy[0]:e.usedBy[0],e.name),maxCount:3,cellIds:e.usedBy})})]},e.name)))})]});return C.jsxs(C.Fragment,{children:[C.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[C.jsx(ct,{className:"w-5 h-5"}),C.jsx(ji,{cellId:n.id}),C.jsx("div",{className:"flex-1"}),C.jsx(Jx,{cellId:n.id,children:C.jsx(W,{variant:"ghost",size:"icon",children:C.jsx(wc,{className:"w-4 h-4"})})}),C.jsx(W,{variant:"text",size:"icon",onClick:()=>{r()},children:C.jsx(sn,{className:"w-4 h-4"})})]}),C.jsxs("div",{className:"text-sm flex flex-col py-3 pl-2 pr-4 flex-1 justify-center",children:[C.jsxs("div",{className:"flex flex-col gap-2",children:[C.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[C.jsx(oc,{className:"w-4 h-4"}),"Outputs"]}),i(t,"out")]}),C.jsx("hr",{className:"border-divider my-3"}),C.jsxs("div",{className:"flex flex-col gap-2",children:[C.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[C.jsx(rc,{className:"w-4 h-4"}),"Inputs"]}),i(e,"in")]})]})]})}if("edge"===n.type){const e=Object.values(o).filter((e=>e.declaredBy.includes(n.source)&&e.usedBy.includes(n.target)));return C.jsxs(C.Fragment,{children:[C.jsxs("div",{className:"font-bold py-2 flex items-center gap-2 border-b px-3",children:[C.jsx(gd,{className:"w-4 h-4"}),C.jsx(ji,{cellId:n.source}),C.jsx(ac,{className:"w-4 h-4"}),C.jsx(ji,{cellId:n.target})]}),C.jsx("div",{className:"grid grid-cols-4 gap-3 max-w-[350px] items-center text-sm p-3 flex-1",children:e.map((e=>C.jsxs(u.Fragment,{children:[C.jsx(xI,{declaredBy:e.declaredBy,name:e.name,onClick:()=>{a(e.declaredBy[0],e.name)}}),C.jsx("div",{className:"truncate text-foreground/60 font-mono",children:e.dataType}),C.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]=i):i=t[6];const s=i;let l,c;return t[7]!==s?(l=s(),t[7]=s,t[8]=l):l=t[8],t[9]!==l?(c=C.jsx(yC,{position:"bottom-left",className:"max-h-[90%] flex flex-col w-[calc(100%-5rem)]",children:C.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 kI(e,t){const n=pa(e);n&&Ii(n,t)}function SI(){const e=S(7),t=xj(),n=mC(CI),o=mC(NI);let a;e[0]!==t?(a=()=>{t.fitView({duration:100})},e[0]=t,e[1]=a):a=e[1];const i=Ti(a,100);let s,l;e[2]!==n||e[3]!==o||e[4]!==i?(s=()=>{n&&o&&i()},l=[n,o,i],e[2]=n,e[3]=o,e[4]=i,e[5]=s,e[6]=l):(s=e[5],l=e[6]),r.useEffect(s,l)}function NI(e){const{height:t}=e;return t}function CI(e){const{width:t}=e;return t}wI.displayName="GraphSelectionPanel";const EI=new class{createEdge(e,t,n){return{type:"smoothstep",pathOptions:{offset:20,borderRadius:100},data:{direction:n},markerEnd:{type:YC.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:fI(q.get(t).code.trim().split("\n").length),position:{x:0,y:n+20}}}createElements(e,t,n,o){let r=0;const a=[],i=[];for(const[l,c]of Za.zip(e,t)){const e=this.createNode(l,c,r);a.push(e),r=e.position.y+(e.height||0)}const s=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}`;s.has(t)||(s.add(t),i.push(this.createEdge(n,e,"inputs"),this.createEdge(n,e,"outputs")))}}return{nodes:a,edges:i}}},jI=e=>{const t=S(37),{cellIds:n,variables:o,cellAtoms:a,children:i}=e;let s;t[0]!==n||t[1]!==a||t[2]!==o?(s=EI.createElements(n,a,o,!1),t[0]=n,t[1]=a,t[2]=o,t[3]=s):s=t[3];const{nodes:l,edges:c}=s;let d;t[4]===Symbol.for("react.memo_cache_sentinel")?(d=[],t[4]=d):d=t[4];const[u,h]=Y_(d),[f,m]=q_(l),[p,g]=r.useState(),[y,v]=r.useState(),x=r.useRef(!1);SI();const b=mC(_I);let w;t[5]!==m||t[6]!==h?(w=e=>{m(e.nodes),h([])},t[5]=m,t[6]=h,t[7]=w):w=t[7];const k=R(w);let N,E,j,_;t[8]!==k||t[9]!==n||t[10]!==a||t[11]!==o?(N=()=>{x.current?k(EI.createElements(n,a,o,!1)):x.current=!0},E=[n,o,a,k],t[8]=k,t[9]=n,t[10]=a,t[11]=o,t[12]=N,t[13]=E):(N=t[12],E=t[13]),r.useEffect(N,E),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=S(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 i;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],i=e.reduce(o,Number.NEGATIVE_INFINITY),n[5]=t,n[6]=e,n[7]=i}else i=n[7];const s=i;let l,c,d;n[10]!==a?(l=[Number.NEGATIVE_INFINITY,a],n[10]=a,n[11]=l):l=n[11];n[12]!==s?(c=[Number.POSITIVE_INFINITY,s],n[12]=s,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}(f,b);let T;t[19]===Symbol.for("react.memo_cache_sentinel")?(T=()=>{g(void 0),v(void 0)},t[19]=T):T=t[19];const A=T;let M;t[20]!==y||t[21]!==o||t[22]!==u||t[23]!==p?(M=()=>y?C.jsx(wI,{selection:{type:"edge",source:y.source,target:y.target},onClearSelection:A,variables:o,edges:u}):p?C.jsx(wI,{selection:{type:"node",id:p},variables:o,edges:u,onClearSelection:A}):null,t[20]=y,t[21]=o,t[22]=u,t[23]=p,t[24]=M):M=t[24];const O=M;let D,P,L,z;return t[25]!==h?(D=(e,t)=>{const n=t.id;g(n),v(void 0),h([])},t[25]=h,t[26]=D):D=t[26],t[27]===Symbol.for("react.memo_cache_sentinel")?(P=(e,t)=>{v(t)},t[27]=P):P=t[27],t[28]!==O?(L=O(),t[28]=O,t[29]=L):L=t[29],t[30]!==f||t[31]!==u||t[32]!==I||t[33]!==D||t[34]!==L||t[35]!==i?(z=C.jsxs(W_,{nodes:f,edges:u,nodeTypes:gI,translateExtent:I,onNodeClick:D,onNodeDoubleClick:II,onEdgeClick:P,snapToGrid:!0,fitView:!0,elementsSelectable:!0,minZoom:1,maxZoom:1,draggable:!1,panOnScrollMode:VC.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:[L,i]}),t[30]=f,t[31]=u,t[32]=I,t[33]=D,t[34]=L,t[35]=i,t[36]=z):z=t[36],z};function _I(e){const{height:t}=e;return t}function II(e,t){Ai(t.id,"focus")}var TI="\0";function AI(e,t){e[t]?e[t]++:e[t]=1}function MI(e,t){--e[t]||delete e[t]}function OI(e,t,n,o){var r=""+t,a=""+n;if(!e&&r>a){var i=r;r=a,a=i}return r+""+a+""+(void 0===o?"\0":o)}function DI(e,t){return OI(e,t.v,t.w,t.name)}var PI=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[TI]={})}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]=TI,this._children[e]={},this._children[TI][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=TI;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!==TI)return t}}children(e=TI){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else{if(e===TI)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 i=OI(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,i))return r&&(this._edgeLabels[i]=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[i]=r?o:this._defaultEdgeLabelFn(e,t,n);var s=function(e,t,n,o){var r=""+t,a=""+n;if(!e&&r>a){var i=r;r=a,a=i}var s={v:r,w:a};o&&(s.name=o);return s}(this._isDirected,e,t,n);return e=s.v,t=s.w,Object.freeze(s),this._edgeObjs[i]=s,AI(this._preds[t],e),AI(this._sucs[e],t),this._in[t][i]=s,this._out[e][i]=s,this._edgeCount++,this}edge(e,t,n){var o=1===arguments.length?DI(this._isDirected,arguments[0]):OI(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?DI(this._isDirected,arguments[0]):OI(this._isDirected,e,t,n);return Object.hasOwn(this._edgeLabels,o)}removeEdge(e,t,n){var o=1===arguments.length?DI(this._isDirected,arguments[0]):OI(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],MI(this._preds[t],e),MI(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))}},RI={Graph:PI,version:"2.2.4"},LI=PI,zI={write:function(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:FI(e),edges:BI(e)};void 0!==e.graph()&&(t.value=structuredClone(e.graph()));return t},read:function(e){var t=new LI(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 FI(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 BI(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 UI=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 VI=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}},HI=VI,$I=function(e,t,n,o){return function(e,t,n,o){var r,a,i={},s=new HI,l=function(e){var t=e.v!==r?e.v:e.w,o=i[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,s.decrease(t,c))};e.nodes().forEach((function(e){var n=e===t?0:Number.POSITIVE_INFINITY;i[e]={distance:n},s.add(e,n)}));for(;s.size()>0&&(r=s.removeMin(),(a=i[r]).distance!==Number.POSITIVE_INFINITY);)o(r).forEach(l);return i}(e,String(t),n||WI,o||function(t){return e.outEdges(t)})},WI=()=>1;var GI=$I,qI=function(e,t,n){return e.nodes().reduce((function(o,r){return o[r]=GI(e,r,t,n),o}),{})};var YI=function(e){var t=0,n=[],o={},r=[];function a(i){var s=o[i]={onStack:!0,lowlink:t,index:t++};if(n.push(i),e.successors(i).forEach((function(e){Object.hasOwn(o,e)?o[e].onStack&&(s.lowlink=Math.min(s.lowlink,o[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,o[e].lowlink))})),s.lowlink===s.index){var l,c=[];do{l=n.pop(),o[l].onStack=!1,c.push(l)}while(i!==l);r.push(c)}}return e.nodes().forEach((function(e){Object.hasOwn(o,e)||a(e)})),r};var XI=YI,KI=function(e){return XI(e).filter((function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])}))};var JI=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],i=a[n],s=o.distance+r.distance;s<i.distance&&(i.distance=s,i.predecessor=r.predecessor)}))}))})),o}(e,t||ZI,n||function(t){return e.outEdges(t)})},ZI=()=>1;function QI(e){var t={},n={},o=[];if(e.sinks().forEach((function r(a){if(Object.hasOwn(n,a))throw new eT;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 eT;return o}class eT extends Error{constructor(){super(...arguments)}}var tT=QI;QI.CycleException=eT;var nT=tT;var oT=function(e,t,n){Array.isArray(t)||(t=[t]);var o=e.isDirected()?t=>e.successors(t):t=>e.neighbors(t),r="post"===n?rT:aT,a=[],i={};return t.forEach((t=>{if(!e.hasNode(t))throw new Error("Graph does not have node: "+t);r(t,o,i,a)})),a};function rT(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]),iT(t(a[0]),(e=>r.push([e,!1]))))}}function aT(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),iT(t(a),(e=>r.push(e))))}}function iT(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}var sT=oT;var lT=oT;var cT=PI,dT=VI;var uT={Graph:RI.Graph,json:zI,alg:{components:UI,dijkstra:$I,dijkstraAll:qI,findCycles:KI,floydWarshall:JI,isAcyclic:function(e){try{nT(e)}catch(t){if(t instanceof nT.CycleException)return!1;throw t}return!0},postorder:function(e,t){return sT(e,t,"post")},preorder:function(e,t){return lT(e,t,"pre")},prim:function(e,t){var n,o=new cT,r={},a=new dT;function i(e){var o=e.v===n?e.w:e.v,i=a.priority(o);if(void 0!==i){var s=t(e);s<i&&(r[o]=n,a.decrease(o,s))}}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 s=!1;for(;a.size()>0;){if(n=a.removeMin(),Object.hasOwn(r,n))o.setEdge(n,r[n]);else{if(s)throw new Error("Input graph is not connected: "+e);s=!0}e.nodeEdges(n).forEach(i)}return o},tarjan:YI,topsort:tT},version:RI.version};function hT(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function fT(e,t){if("_next"!==e&&"_prev"!==e)return t}let mT=uT.Graph,pT=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return hT(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&hT(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,fT)),n=n._prev;return"["+e.join(", ")+"]"}};var gT=function(e,t){if(e.nodeCount()<=1)return[];let n=function(e,t){let n=new mT,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,i=t(e),s=a+i;n.setEdge(e.v,e.w,s),r=Math.max(r,n.node(e.v).out+=i),o=Math.max(o,n.node(e.w).in+=i)}));let a=function(e){const t=[];for(let n=0;n<e;n++)t.push(n);return t}(r+o+3).map((()=>new pT)),i=o+1;return n.nodes().forEach((e=>{xT(a,i,n.node(e))})),{graph:n,buckets:a,zeroIdx:i}}(e,t||yT);return function(e,t,n){let o,r=[],a=t[t.length-1],i=t[0];for(;e.nodeCount();){for(;o=i.dequeue();)vT(e,t,n,o);for(;o=a.dequeue();)vT(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(vT(e,t,n,o,!0));break}}return r}(n.graph,n.buckets,n.zeroIdx).flatMap((t=>e.outEdges(t.v,t.w)))};let yT=()=>1;function vT(e,t,n,o,r){let a=r?[]:void 0;return e.inEdges(o.v).forEach((o=>{let i=e.edge(o),s=e.node(o.v);r&&a.push({v:o.v,w:o.w}),s.out-=i,xT(t,n,s)})),e.outEdges(o.v).forEach((o=>{let r=e.edge(o),a=o.w,i=e.node(a);i.in-=r,xT(t,n,i)})),e.removeNode(o.v),a}function xT(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 bT=uT.Graph;var wT={addBorderNode:function(e,t,n,o){let r={width:0,height:0};arguments.length>=4&&(r.rank=n,r.order=o);return kT(e,"border",r,t)},addDummyNode:kT,applyWithChunking:NT,asNonCompoundGraph:function(e){let t=new bT({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=_T(CT(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,i=t.x-r,s=t.y-a,l=e.width/2,c=e.height/2;if(!i&&!s)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(s)*l>Math.abs(i)*c?(s<0&&(c=-c),n=c*i/s,o=c):(i<0&&(l=-l),n=l,o=l*s/i);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:CT,normalizeRanks:function(e){let t=e.nodes().map((t=>{let n=e.node(t).rank;return void 0===n?Number.MAX_VALUE:n})),n=NT(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 IT(e.nodes(),t)},range:_T,removeEmptyRanks:function(e){let t=e.nodes().map((t=>e.node(t).rank)),n=NT(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 bT).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 IT(e.nodes(),t)},time:function(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}},uniqueId:jT,zipObject:IT};function kT(e,t,n,o){let r;do{r=jT(o)}while(e.hasNode(r));return n.dummy=t,e.setNode(r,n),r}const ST=65535;function NT(e,t){if(t.length>ST){const n=function(e,t=ST){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 CT(e){const t=e.nodes().map((t=>{let n=e.node(t).rank;return void 0===n?Number.MIN_VALUE:n}));return NT(Math.max,t)}let ET=0;function jT(e){var t=++ET;return toString(e)+t}function _T(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 IT(e,t){return e.reduce(((e,n,o)=>(e[n]=t[o],e)),{})}let TT=gT,AT=wT.uniqueId;var MT={run:function(e){("greedy"===e.graph().acyclicer?TT(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,AT("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 OT=wT;var DT={run:function(e){e.graph().dummyChains=[],e.edges().forEach((t=>function(e,t){let n,o,r,a=t.v,i=e.node(a).rank,s=t.w,l=e.node(s).rank,c=t.name,d=e.edge(t),u=d.labelRank;if(l===i+1)return;for(e.removeEdge(t),r=0,++i;i<l;++r,++i)d.points=[],o={width:0,height:0,edgeLabel:d,edgeObj:t,rank:i},n=OT.addDummyNode(e,"edge",o,"_d"),i===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,s,{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:PT}=wT;var RT={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 i=PT(Math.min,a);return i===Number.POSITIVE_INFINITY&&(i=0),r.rank=i}))},slack:function(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}};var LT=uT.Graph,zT=RT.slack,FT=function(e){var t,n,o=new LT({directed:!1}),r=e.nodes()[0],a=e.nodeCount();o.setNode(r,{});for(;BT(o,e)<a;)t=UT(o,e),n=o.hasNode(t.v)?zT(e,t):-zT(e,t),VT(o,e,n);return o};function BT(e,t){return e.nodes().forEach((function n(o){t.nodeEdges(o).forEach((r=>{var a=r.v,i=o===a?r.w:a;e.hasNode(i)||zT(t,r)||(e.setNode(i,{}),e.setEdge(o,i,{}),n(i))}))})),e.nodeCount()}function UT(e,t){return t.edges().reduce(((n,o)=>{let r=Number.POSITIVE_INFINITY;return e.hasNode(o.v)!==e.hasNode(o.w)&&(r=zT(t,o)),r<n[0]?[r,o]:n}),[Number.POSITIVE_INFINITY,null])[1]}function VT(e,t,n){e.nodes().forEach((e=>t.node(e).rank+=n))}var HT=FT,$T=RT.slack,WT=RT.longestPath,GT=uT.alg.preorder,qT=uT.alg.postorder,YT=wT.simplify,XT=KT;function KT(e){e=YT(e),WT(e);var t,n=HT(e);for(QT(n),JT(n,e);t=tA(n);)oA(n,e,t,nA(n,e,t))}function JT(e,t){var n=qT(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=ZT(e,t,n)}(e,t,n)))}function ZT(e,t,n){var o=e.node(n).parent,r=!0,a=t.edge(n,o),i=0;return a||(r=!1,a=t.edge(o,n)),i=a.weight,t.nodeEdges(n).forEach((a=>{var s,l,c=a.v===n,d=c?a.w:a.v;if(d!==o){var u=c===r,h=t.edge(a).weight;if(i+=u?h:-h,s=n,l=d,e.hasEdge(s,l)){var f=e.edge(n,d).cutvalue;i+=u?-f:f}}})),i}function QT(e,t){arguments.length<2&&(t=e.nodes()[0]),eA(e,{},1,t)}function eA(e,t,n,o,r){var a=n,i=e.node(o);return t[o]=!0,e.neighbors(o).forEach((r=>{Object.hasOwn(t,r)||(n=eA(e,t,n,r,o))})),i.low=a,i.lim=n++,r?i.parent=r:delete i.parent,n}function tA(e){return e.edges().find((t=>e.edge(t).cutvalue<0))}function nA(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),i=e.node(r),s=a,l=!1;return a.lim>i.lim&&(s=i,l=!0),t.edges().filter((t=>l===rA(e,e.node(t.v),s)&&l!==rA(e,e.node(t.w),s))).reduce(((e,n)=>$T(t,n)<$T(t,e)?n:e))}function oA(e,t,n,o){var r=n.v,a=n.w;e.removeEdge(r,a),e.setEdge(o.v,o.w,{}),QT(e),JT(e,t),function(e,t){var n=e.nodes().find((e=>!t.node(e).parent)),o=GT(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 rA(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}KT.initLowLimValues=QT,KT.initCutValues=JT,KT.calcCutValue=ZT,KT.leaveEdge=tA,KT.enterEdge=nA,KT.exchangeEdges=oA;var aA=RT.longestPath,iA=FT,sA=XT,lA=function(e){switch(e.graph().ranker){case"network-simplex":default:dA(e);break;case"tight-tree":!function(e){aA(e),iA(e)}(e);break;case"longest-path":cA(e)}};var cA=aA;function dA(e){sA(e)}let uA=wT;function hA(e,t,n,o,r,a,i){let s=e.children(i);if(!s.length)return void(i!==t&&e.setEdge(t,i,{weight:0,minlen:n}));let l=uA.addBorderNode(e,"_bt"),c=uA.addBorderNode(e,"_bb"),d=e.node(i);e.setParent(l,i),d.borderTop=l,e.setParent(c,i),d.borderBottom=c,s.forEach((s=>{hA(e,t,n,o,r,a,s);let d=e.node(s),u=d.borderTop?d.borderTop:s,h=d.borderBottom?d.borderBottom:s,f=d.borderTop?o:2*o,m=u!==h?1:r-a[i]+1;e.setEdge(l,u,{weight:f,minlen:m,nestingEdge:!0}),e.setEdge(h,c,{weight:f,minlen:m,nestingEdge:!0})})),e.parent(i)||e.setEdge(t,l,{weight:0,minlen:r+a[i]})}let fA=wT;function mA(e,t,n,o,r,a){let i={width:0,height:0,rank:a,borderType:t},s=r[t][a-1],l=fA.addDummyNode(e,"border",i,n);r[t][a]=l,e.setParent(l,o),s&&e.setEdge(s,l,{weight:1})}function pA(e){e.nodes().forEach((t=>gA(e.node(t)))),e.edges().forEach((t=>gA(e.edge(t))))}function gA(e){let t=e.width;e.width=e.height,e.height=t}function yA(e){e.y=-e.y}function vA(e){let t=e.x;e.x=e.y,e.y=t}let xA=wT;let bA=wT.zipObject;function wA(e,t,n){let o=bA(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 i=2*a-1;a-=1;let s=new Array(i).fill(0),l=0;return r.forEach((e=>{let t=e.pos+a;s[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;l+=e.weight*n})),l}let kA=wT;let SA=wT;function NA(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 CA=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}}))},EA=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=>kA.pick(e,["vs","i","barycenter","weight"])))}(Object.values(n).filter((e=>!e.indegree)))},jA=function(e,t){let n=SA.partition(e,(e=>Object.hasOwn(e,"barycenter"))),o=n.lhs,r=n.rhs.sort(((e,t)=>t.i-e.i)),a=[],i=0,s=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=NA(a,r,l),o.forEach((e=>{l+=e.vs.length,a.push(e.vs),i+=e.barycenter*e.weight,s+=e.weight,l=NA(a,r,l)}));var c;let d={vs:a.flat(!0)};s&&(d.barycenter=i/s,d.weight=s);return d};var _A=function e(t,n,o,r){let a=t.children(n),i=t.node(n),s=i?i.borderLeft:void 0,l=i?i.borderRight:void 0,c={};s&&(a=a.filter((e=>e!==s&&e!==l)));let d=CA(t,a);d.forEach((n=>{if(t.children(n.v).length){let s=e(t,n.v,o,r);c[n.v]=s,Object.hasOwn(s,"barycenter")&&(i=s,void 0!==(a=n).barycenter?(a.barycenter=(a.barycenter*a.weight+i.barycenter*i.weight)/(a.weight+i.weight),a.weight+=i.weight):(a.barycenter=i.barycenter,a.weight=i.weight))}var a,i}));let u=EA(d,o);!function(e,t){e.forEach((e=>{e.vs=e.vs.flatMap((e=>t[e]?t[e].vs:e))}))}(u,c);let h=jA(u,r);if(s&&(h.vs=[s,h.vs,l].flat(!0),t.predecessors(s).length)){let e=t.node(t.predecessors(s)[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 IA=uT.Graph,TA=wT;let AA=function(e){let t={},n=e.nodes().filter((t=>!e.children(t).length)),o=n.map((t=>e.node(t).rank)),r=xA.applyWithChunking(Math.max,o),a=xA.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},MA=function(e,t){let n=0;for(let o=1;o<t.length;++o)n+=wA(e,t[o-1],t[o]);return n},OA=_A,DA=function(e,t,n){let o=function(e){var t;for(;e.hasNode(t=TA.uniqueId("_root")););return t}(e),r=new IA({compound:!0}).setGraph({root:o}).setDefaultNodeLabel((t=>e.node(t)));return e.nodes().forEach((a=>{let i=e.node(a),s=e.parent(a);(i.rank===t||i.minRank<=t&&t<=i.maxRank)&&(r.setNode(a),r.setParent(a,s||o),e[n](a).forEach((t=>{let n=t.v===a?t.w:t.v,o=r.edge(n,a),i=void 0!==o?o.weight:0;r.setEdge(n,a,{weight:e.edge(t).weight+i})})),Object.hasOwn(i,"minRank")&&r.setNode(a,{borderLeft:i.borderLeft[t],borderRight:i.borderRight[t]}))})),r},PA=function(e,t,n){let o,r={};n.forEach((n=>{let a,i,s=e.parent(n);for(;s;){if(a=e.parent(s),a?(i=r[a],r[a]=s):(i=o,o=s),i&&i!==s)return void t.setEdge(i,s);s=a}}))},RA=uT.Graph,LA=wT;var zA=function e(t,n){if(n&&"function"==typeof n.customOrder)return void n.customOrder(t,e);let o=LA.maxRank(t),r=FA(t,LA.range(1,o+1),"inEdges"),a=FA(t,LA.range(o-1,-1,-1),"outEdges"),i=AA(t);if(UA(t,i),n&&n.disableOptimalOrderHeuristic)return;let s,l=Number.POSITIVE_INFINITY;for(let c=0,d=0;d<4;++c,++d){BA(c%2?r:a,c%4>=2),i=LA.buildLayerMatrix(t);let e=MA(t,i);e<l&&(d=0,s=Object.assign({},i),l=e)}UA(t,s)};function FA(e,t,n){return t.map((function(t){return DA(e,t,n)}))}function BA(e,t){let n=new RA;e.forEach((function(e){let o=e.graph().root,r=OA(e,o,n,t);r.vs.forEach(((t,n)=>e.node(t).order=n)),PA(e,n,r.vs)}))}function UA(e,t){Object.values(t).forEach((t=>t.forEach(((t,n)=>e.node(t).order=n))))}let VA=uT.Graph,HA=wT;var $A=function(e){let t,n=HA.buildLayerMatrix(e),o=Object.assign(WA(e,n),GA(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 i=("u"===a?e.predecessors:e.successors).bind(e),s=XA(e,t,o,i),l=KA(e,t,s.root,s.align,"r"===n);"r"===n&&(l=HA.mapValues(l,(e=>-e))),r[a+n]=l}))}));let a=JA(e,r);return ZA(r,a),QA(r,e.graph().align)};function WA(e,t){let n={};return t.length&&t.reduce((function(t,o){let r=0,a=0,i=t.length,s=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:i;(c||t===s)&&(o.slice(a,l+1).forEach((t=>{e.predecessors(t).forEach((o=>{let a=e.node(o),i=a.order;!(i<r||d<i)||a.dummy&&e.node(t).dummy||qA(n,o,t)}))})),a=l+1,r=d)})),o})),n}function GA(e,t){let n={};function o(t,o,r,a,i){let s;HA.range(o,r).forEach((o=>{s=t[o],e.node(s).dummy&&e.predecessors(s).forEach((t=>{let o=e.node(t);o.dummy&&(o.order<a||o.order>i)&&qA(n,t,s)}))}))}return t.length&&t.reduce((function(t,n){let r,a=-1,i=0;return n.forEach(((s,l)=>{if("border"===e.node(s).dummy){let t=e.predecessors(s);t.length&&(r=e.node(t[0]).order,o(n,i,l,a,r),i=l,a=r)}o(n,i,n.length,r,t.length)})),n})),n}function qA(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 YA(e,t,n){if(t>n){let e=t;t=n,n=e}return!!e[t]&&Object.hasOwn(e[t],n)}function XA(e,t,n,o){let r={},a={},i={};return t.forEach((e=>{e.forEach(((e,t)=>{r[e]=e,a[e]=e,i[e]=t}))})),t.forEach((e=>{let t=-1;e.forEach((e=>{let s=o(e);if(s.length){s=s.sort(((e,t)=>i[e]-i[t]));let o=(s.length-1)/2;for(let l=Math.floor(o),c=Math.ceil(o);l<=c;++l){let o=s[l];a[e]===e&&t<i[o]&&!YA(n,e,o)&&(a[o]=e,a[e]=r[e]=r[o],t=i[o])}}}))})),{root:r,align:a}}function KA(e,t,n,o,r){let a={},i=function(e,t,n,o){let r=new VA,a=e.graph(),i=function(e,t,n){return(o,r,a)=>{let i,s=o.node(r),l=o.node(a),c=0;if(c+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":i=-s.width/2;break;case"r":i=s.width/2}if(i&&(c+=n?i:-i),i=0,c+=(s.dummy?t:e)/2,c+=(l.dummy?t:e)/2,c+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":i=l.width/2;break;case"r":i=-l.width/2}return i&&(c+=n?i:-i),i=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 s=n[o],l=r.edge(s,a);r.setEdge(s,a,Math.max(i(e,t,o),l||0))}o=t}))})),r}(e,t,n,r),s=r?"borderLeft":"borderRight";function l(e,t){let n=i.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]=i.inEdges(e).reduce(((e,t)=>Math.max(e,a[t.v]+i.edge(t))),0)}),i.predecessors.bind(i)),l((function(t){let n=i.outEdges(t).reduce(((e,t)=>Math.min(e,a[t.w]-i.edge(t))),Number.POSITIVE_INFINITY),o=e.node(t);n!==Number.POSITIVE_INFINITY&&o.borderType!==s&&(a[t]=Math.max(a[t],n))}),i.successors.bind(i)),Object.keys(o).forEach((e=>a[e]=a[n[e]])),a}function JA(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 ZA(e,t){let n=Object.values(t),o=HA.applyWithChunking(Math.min,n),r=HA.applyWithChunking(Math.max,n);["u","d"].forEach((n=>{["l","r"].forEach((a=>{let i=n+a,s=e[i];if(s===t)return;let l=Object.values(s),c=o-HA.applyWithChunking(Math.min,l);"l"!==a&&(c=r-HA.applyWithChunking(Math.max,l)),c&&(e[i]=HA.mapValues(s,(e=>e+c)))}))}))}function QA(e,t){return HA.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 eM=wT,tM=$A;let nM=MT,oM=DT,rM=lA,aM=wT.normalizeRanks,iM=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,i=[],s=[],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),i.push(r)}while(r&&(t[r].low>l||c>t[r].lim));a=r,r=o;for(;(r=e.parent(r))!==a;)s.push(r);return{path:i.concat(s.reverse()),lca:a}}(e,t,r.v,r.w),i=a.path,s=a.lca,l=0,c=i[l],d=!0;for(;n!==r.w;){if(o=e.node(n),d){for(;(c=i[l])!==s&&e.node(c).maxRank<o.rank;)l++;c===s&&(d=!1)}if(!d){for(;l<i.length-1&&e.node(c=i[l+1]).minRank<=o.rank;)l++;c=i[l]}e.setParent(n,c),n=e.successors(n)[0]}}))},sM=wT.removeEmptyRanks,lM={run:function(e){let t=uA.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=uA.applyWithChunking(Math.max,o)-1,a=2*r+1;e.graph().nestingRoot=t,e.edges().forEach((t=>e.edge(t).minlen*=a));let i=function(e){return e.edges().reduce(((t,n)=>t+e.edge(n).weight),0)}(e)+1;e.children().forEach((o=>hA(e,t,a,i,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)}))}},cM=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)mA(e,"borderLeft","_bl",n,r,t),mA(e,"borderRight","_br",n,r,t)}}))},dM={adjust:function(e){let t=e.graph().rankdir.toLowerCase();"lr"!==t&&"rl"!==t||pA(e)},undo:function(e){let t=e.graph().rankdir.toLowerCase();"bt"!==t&&"rl"!==t||function(e){e.nodes().forEach((t=>yA(e.node(t)))),e.edges().forEach((t=>{let n=e.edge(t);n.points.forEach(yA),Object.hasOwn(n,"y")&&yA(n)}))}(e);"lr"!==t&&"rl"!==t||(!function(e){e.nodes().forEach((t=>vA(e.node(t)))),e.edges().forEach((t=>{let n=e.edge(t);n.points.forEach(vA),Object.hasOwn(n,"x")&&vA(n)}))}(e),pA(e))}},uM=zA,hM=function(e){(function(e){let t=eM.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=eM.asNonCompoundGraph(e)),Object.entries(tM(e)).forEach((([t,n])=>e.node(t).x=n))},fM=wT,mM=uT.Graph;var pM=function(e,t){let n=t&&t.debugTiming?fM.time:fM.notime;n("layout",(()=>{let o=n(" buildLayoutGraph",(()=>function(e){let t=new mM({multigraph:!0,compound:!0}),n=CM(e.graph());return t.setGraph(Object.assign({},yM,NM(n,gM),fM.pick(n,vM))),e.nodes().forEach((n=>{const o=NM(CM(e.node(n)),xM);Object.keys(bM).forEach((e=>{void 0===o[e]&&(o[e]=bM[e])})),t.setNode(n,o),t.setParent(n,e.parent(n))})),e.edges().forEach((n=>{let o=CM(e.edge(n));t.setEdge(n,Object.assign({},kM,NM(o,wM),fM.pick(o,SM)))})),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",(()=>nM.run(e))),t(" nestingGraph.run",(()=>lM.run(e))),t(" rank",(()=>rM(fM.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};fM.addDummyNode(e,"edge-proxy",o,"_ep")}}))}(e))),t(" removeEmptyRanks",(()=>sM(e))),t(" nestingGraph.cleanup",(()=>lM.cleanup(e))),t(" normalizeRanks",(()=>aM(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",(()=>oM.run(e))),t(" parentDummyChains",(()=>iM(e))),t(" addBorderSegments",(()=>cM(e))),t(" order",(()=>uM(e,n))),t(" insertSelfEdges",(()=>function(e){var t=fM.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=>{fM.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",(()=>dM.adjust(e))),t(" position",(()=>hM(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,i=n.x-r,s=o.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:r+2*i/3,y:a-s},{x:r+5*i/6,y:a-s},{x:r+i,y:a},{x:r+5*i/6,y:a+s},{x:r+2*i/3,y:a+s}],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]),i=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(i.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",(()=>oM.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",(()=>dM.undo(e))),t(" translateGraph",(()=>function(e){let t=Number.POSITIVE_INFINITY,n=0,o=Number.POSITIVE_INFINITY,r=0,a=e.graph(),i=a.marginx||0,s=a.marginy||0;function l(e){let a=e.x,i=e.y,s=e.width,l=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),o=Math.min(o,i-l/2),r=Math.max(r,i+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-=i,o-=s,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+i,a.height=r-o+s}(e))),t(" assignNodeIntersects",(()=>function(e){e.edges().forEach((t=>{let n,o,r=e.edge(t),a=e.node(t.v),i=e.node(t.w);r.points?(n=r.points[0],o=r.points[r.points.length-1]):(r.points=[],n=i,o=a),r.points.unshift(fM.intersectRect(a,n)),r.points.push(fM.intersectRect(i,o))}))}(e))),t(" reversePoints",(()=>function(e){e.edges().forEach((t=>{let n=e.edge(t);n.reversed&&n.points.reverse()}))}(e))),t(" acyclic.undo",(()=>nM.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 gM=["nodesep","edgesep","ranksep","marginx","marginy"],yM={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},vM=["acyclicer","ranker","rankdir","align"],xM=["width","height"],bM={width:0,height:0},wM=["minlen","weight","width","height","labeloffset"],kM={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},SM=["labelpos"];function NM(e,t){return fM.mapValues(fM.pick(e,t),Number)}function CM(e){var t={};return e&&Object.entries(e).forEach((([e,n])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=n})),t}let EM=wT,jM=uT.Graph;var _M={graphlib:uT,layout:pM,debug:{debugOrdering:function(e){let t=EM.buildLayerMatrix(e),n=new jM({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:wT.time,notime:wT.notime},version:"1.1.4"};const IM=(new _M.graphlib.Graph).setDefaultEdgeLabel((()=>({}))),TM=(e,t,n)=>(IM.setGraph({rankdir:n.direction,nodesep:150,ranksep:200,ranker:"longest-path"}),t.forEach((e=>IM.setEdge(e.source,e.target))),e.forEach((e=>IM.setNode(e.id,{...e,width:e.width??0,height:e.height??0}))),_M.layout(IM),{nodes:e.map((e=>{const{x:t,y:n}=IM.node(e.id);return{...e,position:{x:t,y:n}}})),edges:t}),AM=new class{createEdge(e,t){return{animated:!0,markerEnd:{type:YC.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:fI(q.get(t).code.trim().split("\n").length),position:{x:0,y:0}}}createElements(e,t,n,o){const r=[],a=[],i=new Set,s=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}`;s.has(t)||(s.add(t),i.add(n),i.add(e),a.push(this.createEdge(n,e)))}}for(const[l,c]of Za.zip(e,t)){o||r.push(this.createNode(l,c));const e=i.has(l),t=q.get(c).code.trim().startsWith("mo.md");!e&&t||r.push(this.createNode(l,c))}return{nodes:r,edges:a}}},MM=e=>{const t=S(43),{cellIds:n,variables:o,cellAtoms:a,children:i,layoutDirection:s,settings:l}=e;let c;t[0]!==n||t[1]!==a||t[2]!==o||t[3]!==l.hidePureMarkdown||t[4]!==s?(c=()=>{let e=AM.createElements(n,a,o,l.hidePureMarkdown);return e=TM(e.nodes,e.edges,{direction:s}),e},t[0]=n,t[1]=a,t[2]=o,t[3]=l.hidePureMarkdown,t[4]=s,t[5]=c):c=t[5];const[d]=r.useState(c),[u,h,f]=q_(d.nodes),[m,p,g]=Y_(d.edges),y=xj();let v;t[6]!==s||t[7]!==h||t[8]!==p?(v=e=>{const t=TM(e.nodes,e.edges,{direction:s});h(t.nodes),p(t.edges)},t[6]=s,t[7]=h,t[8]=p,t[9]=v):v=t[9];const x=R(v);let b,w;t[10]!==x||t[11]!==n||t[12]!==a||t[13]!==o||t[14]!==l.hidePureMarkdown?(b=()=>{x(AM.createElements(n,a,o,l.hidePureMarkdown))},w=[n,o,a,x,l.hidePureMarkdown],t[10]=x,t[11]=n,t[12]=a,t[13]=o,t[14]=l.hidePureMarkdown,t[15]=b,t[16]=w):(b=t[15],w=t[16]),r.useEffect(b,w);const[k,N]=r.useState();let E;SI(),t[17]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{N(void 0)},t[17]=E):E=t[17];const j=E;let _,I,T,A,M,O,D,P,L,z;return t[18]===Symbol.for("react.memo_cache_sentinel")?(_={minZoom:.5,maxZoom:1.5},I=(e,t)=>{N({type:"node",id:t.id})},T=(e,t)=>{const{source:n,target:o}=t;N({type:"edge",source:n,target:o})},t[18]=_,t[19]=I,t[20]=T):(_=t[18],I=t[19],T=t[20]),t[21]===Symbol.for("react.memo_cache_sentinel")?(A=C.jsx(hI,{color:"#ccc",variant:oI.Dots}),t[21]=A):A=t[21],t[22]!==u||t[23]!==y?(M=()=>{const e=q.get(Kd);if(e){const t=u.find((t=>t.id===e));t&&(y.fitView({padding:1,duration:600,nodes:[t]}),N({type:"node",id:e}))}},t[22]=u,t[23]=y,t[24]=M):M=t[24],t[25]===Symbol.for("react.memo_cache_sentinel")?(O=C.jsx(Rc,{className:"size-4"}),t[25]=O):O=t[25],t[26]!==M?(D=C.jsx(aI,{position:"bottom-right",showInteractive:!1,children:C.jsx(et,{content:"Jump to focused cell",delayDuration:200,side:"left",asChild:!1,children:C.jsx(eI,{onMouseDown:Ze.preventFocus,onClick:M,children:O})})}),t[26]=M,t[27]=D):D=t[27],t[28]!==k||t[29]!==o||t[30]!==m?(P=C.jsx(wI,{selection:k,variables:o,edges:m,onClearSelection:j}),t[28]=k,t[29]=o,t[30]=m,t[31]=P):P=t[31],t[32]!==u||t[33]!==m||t[34]!==f||t[35]!==g||t[36]!==D||t[37]!==P||t[38]!==i?(L=C.jsxs(W_,{nodes:u,edges:m,nodeTypes:gI,minZoom:.2,fitViewOptions:_,onNodeClick:I,onEdgeClick:T,onNodeDoubleClick:OM,fitView:!0,onNodesChange:f,onEdgesChange:g,zoomOnDoubleClick:!1,nodesConnectable:!1,children:[A,D,P,i]}),t[32]=u,t[33]=m,t[34]=f,t[35]=g,t[36]=D,t[37]=P,t[38]=i,t[39]=L):L=t[39],t[40]!==s||t[41]!==L?(z=C.jsx(mI.Provider,{value:s,children:L}),t[40]=s,t[41]=L,t[42]=z):z=t[42],z};function OM(e,t){Ai(t.id,"focus")}const DM=H("_minimap_"),PM=H({hidePureMarkdown:!0}),RM=e=>{const t=S(11),[n,o]=Me(DM),[r,a]=Me(PM);let i;t[0]!==n||t[1]!==e||t[2]!==r||t[3]!==a||t[4]!==o?(i=()=>"_minimap_"===n?C.jsx(jI,{...e,children:C.jsx(bI,{settings:r,onSettingsChange:a,view:n,onChange:o})}):C.jsx(MM,{...e,settings:r,layoutDirection:n,children:C.jsx(bI,{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]=i):i=t[5];const s=i;let l,c;return t[6]!==s?(l=s(),t[6]=s,t[7]=l):l=t[7],t[8]!==n||t[9]!==l?(c=C.jsx(L_,{children:l},n),t[8]=n,t[9]=l,t[10]=c):c=t[10],c},LM=()=>{const e=S(5),t=Mi(),n=ae(),[o]=Oi();let r,a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=hn("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=C.jsx("div",{className:r,children:C.jsx(RM,{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 zM="name",FM="type-value",BM="defs-refs",UM=[{id:zM,accessorFn:e=>[e.name,e.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:e})=>C.jsx(Yi,{header:"Name",column:e}),cell:({getValue:e})=>{const[t,n]=e();return C.jsx(xI,{name:t,declaredBy:n})}},{id:FM,accessorFn:e=>[e.dataType,e.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:e})=>C.jsx(Yi,{header:C.jsxs("div",{className:"flex flex-col gap-1",children:[C.jsx("span",{children:"Type"}),C.jsx("span",{children:"Value"})]}),column:e}),cell:({getValue:e})=>{const[t,n]=e();return C.jsxs("div",{className:"max-w-[150px]",children:[C.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:t}),C.jsx("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:n??"",children:n})]})}},{id:BM,accessorFn:e=>[e.declaredBy,e.usedBy,e.name,e.declaredByNames,e.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:e})=>C.jsx(Yi,{header:C.jsxs("div",{className:"flex flex-col gap-1",children:[C.jsx("span",{children:"Declared By"}),C.jsx("span",{children:"Used By"})]}),column:e}),cell:({getValue:e})=>{const[t,n,o]=e(),r=e=>{const t=pa(e);t&&Ii(t,o)};return C.jsxs("div",{className:"flex flex-col gap-1 py-1",children:[C.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[C.jsx("span",{title:"Declared by",children:C.jsx(ad,{className:"w-3.5 h-3.5 text-muted-foreground"})}),1===t.length?C.jsx(ji,{variant:"focus",cellId:t[0],skipScroll:!0,onClick:()=>r(t[0])}):C.jsx("div",{className:"text-destructive flex flex-row gap-2",children:t.slice(0,3).map(((e,n)=>C.jsxs("span",{className:"flex",children:[C.jsx(ji,{variant:"focus",cellId:e,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(e)},e),n<t.length-1&&", "]},e)))})]}),C.jsxs("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[C.jsx("span",{title:"Used by",children:C.jsx(gd,{className:"w-3.5 h-3.5 text-muted-foreground"})}),C.jsx(vI,{maxCount:3,cellIds:n,skipScroll:!0,onClick:r})]})]})}}];const VM=r.memo((({className:e,cellIds:t,variables:n})=>{const[o,a]=u.useState([]),[i,s]=u.useState(""),l=Di(),c=r.useMemo((()=>{const e=e=>{const n=l[e];return qi(n)?`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:BM,desc:!1});let o=[];switch(t.id){case zM:o=tc(e,(e=>e.name));break;case FM:o=tc(e,(e=>e.dataType));break;case BM:o=tc(e,(e=>n.get(e.declaredBy[0])))}return t.desc?o.reverse():o}(c,o[0],e)}),[c,o,t]),h=Pi({data:d,columns:UM,getCoreRowModel:Ri(),onGlobalFilterChange:s,getFilteredRowModel:Li(),enableFilters:!0,enableGlobalFilter:!0,getColumnCanGlobalFilter:e=>e.columnDef.enableGlobalFilter??!0,globalFilterFn:"auto",manualSorting:!0,onSortingChange:a,getSortedRowModel:zi(),state:{sorting:o,globalFilter:i}});return C.jsxs(C.Fragment,{children:[C.jsx(Fi,{className:"w-full",placeholder:"Search",value:i,onChange:e=>s(e.target.value)}),C.jsxs(Bi,{className:hn("w-full text-sm flex-1 border-separate border-spacing-0",e),children:[C.jsx(Ui,{children:C.jsx(Vi,{className:"whitespace-nowrap text-xs",children:h.getFlatHeaders().map((e=>C.jsx(Hi,{className:"sticky top-0 bg-background border-b",children:$i(e.column.columnDef.header,e.getContext())},e.id)))})}),C.jsx(Wi,{children:h.getRowModel().rows.map((e=>C.jsx(Vi,{className:"hover:bg-accent",children:e.getVisibleCells().map((e=>C.jsx(Gi,{className:"border-b",children:$i(e.column.columnDef.cell,e.getContext())},e.id)))},e.id)))})]})]})}));VM.displayName="VariableTable";const HM=()=>{const e=S(4),t=Mi(),n=ae();if(0===Object.keys(t).length){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=C.jsx(SN,{title:"No variables",description:"Global variables will appear here.",icon:C.jsx(ct,{})}),e[0]=t):t=e[0],t}let o;return e[1]!==n.inOrderIds||e[2]!==t?(o=C.jsx(VM,{className:"flex-1",cellIds:n.inOrderIds,variables:t}),e[1]=n.inOrderIds,e[2]=t,e[3]=o):o=e[3],o},$M=e=>C.jsx("button",{type:"button","data-testid":e.dataTestId,className:hn("text-xs font-semibold text-accent-foreground",e.className),onClick:e.onClick,children:"Clear"}),WM=()=>{const e=S(9),t=Xi(),{clearLogs:n}=L();if(0===t.length){let t,n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=C.jsx("code",{className:"border rounded px-1",children:"stdout"}),e[0]=t):t=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(n=C.jsx(SN,{title:"No logs",description:C.jsxs("span",{children:[t," and"," ",C.jsx("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:C.jsx(ut,{})}),e[1]=n):n=e[1],n}let o,r,a;return e[2]!==n?(o=C.jsx("div",{className:"flex flex-row justify-end px-2 py-1",children:C.jsx($M,{dataTestId:"clear-logs-button",onClick:n})}),e[2]=n,e[3]=o):o=e[3],e[4]!==t?(r=C.jsx("div",{className:"overflow-auto flex-1",children:C.jsx(GM,{logs:t,className:"min-w-[300px]"})}),e[4]=t,e[5]=r):r=e[5],e[6]!==o||e[7]!==r?(a=C.jsxs(C.Fragment,{children:[o,r]}),e[6]=o,e[7]=r,e[8]=a):a=e[8],a},GM=e=>{const t=S(11),{logs:n,className:o}=e;let r,a,i,s,l;if(t[0]!==o?(r=hn("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)=>C.jsxs("div",{className:"contents group",children:[C.jsx("span",{className:hn("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:t+1}),C.jsx("span",{className:hn("opacity-70 group-hover:bg-[var(--gray-3)] group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:qM(e)})]},t),t[5]=e):e=t[5],i=n.map(e),t[3]=n,t[4]=i}else i=t[4];return t[6]!==i?(s=C.jsx("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:C.jsx("div",{className:"grid grid-cols-[30px,1fr]",style:a,children:i})}),t[6]=i,t[7]=s):s=t[7],t[8]!==r||t[9]!==s?(l=C.jsx("div",{className:r,children:s}),t[8]=r,t[9]=s,t[10]=l):l=t[10],l};function qM(e){const t=Ki(e.timestamp),n=YM[e.level],o=e.level.toUpperCase();return C.jsxs(C.Fragment,{children:[C.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",t,"]"]}),C.jsx("span",{className:hn("flex-shrink-0",n),children:o}),C.jsxs("span",{className:"flex-shrink-0 text-[var(--gray-10)]",children:["(",C.jsx(ji,{cellId:e.cellId}),")"]}),e.message]})}const YM={stdout:"text-[var(--grass-9)]",stderr:"text-[var(--red-9)]"},XM=()=>{const e=S(5),{documentation:t}=ee(Ji);if(!t){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=C.jsx(SN,{title:"View docs as you type",description:"Move your text cursor over a symbol to see its documentation.",icon:C.jsx(hd,{})}),e[0]=t):t=e[0],t}let n,o;return e[1]!==t?(n=Ba({html:t}),e[1]=t,e[2]=n):n=e[2],e[3]!==n?(o=C.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 KM(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 JM(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(),i=r.useState({width:void 0,height:void 0}),s=i[0],l=i[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(){i()}));var i=r.useCallback((function(){var t=a.current,r=o.current,i=t||(r?r instanceof Element?r:r.current:null);n.current&&n.current.element===i&&n.current.subscriber===e||(n.current&&n.current.cleanup&&n.current.cleanup(),n.current={element:i,subscriber:e,cleanup:i?e(i):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,i()}),[i])}(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",i=KM(r,a,"inlineSize"),s=KM(r,a,"blockSize"),u=i?o(i):void 0,h=s?o(s):void 0;if(d.current.width!==u||d.current.height!==h){var f={width:u,height:h};d.current.width=u,d.current.height=h,n.current?n.current(f):c.current||l(f)}}))}),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:s.width,height:s.height}}),[u,s.width,s.height])}const ZM=new Map,QM=({file:e,onOpenNotebook:t})=>{const{theme:n}=je(),o=ee(Oe),[a,i]=r.useState(""),{data:s,loading:l,error:c,setData:d}=dn((async()=>{const t=await Zi({path:e.path}),n=t.contents||"";return i(ZM.get(e.path)||n),t}),[e.path]),u=async()=>{a!==(null==s?void 0:s.contents)&&await is({path:e.path,contents:a}).then((e=>{e.success&&(d((e=>e?{...e,contents:a}:void 0)),i(a))}))},h=r.useRef(a);if(h.current=a,r.useEffect((()=>()=>{if(!(null==s?void 0:s.contents))return;const t=h.current;t===s.contents?ZM.delete(e.path):ZM.set(e.path,t)}),[e.path,null==s?void 0:s.contents]),c)return C.jsx(Qi,{error:c});if(l||!s)return null;const f=s.mimeType||"text/plain",m=f in tO;if(!s.contents&&!m)return C.jsxs("div",{className:"grid grid-cols-2 gap-2 p-6",children:[C.jsx("div",{className:"font-bold text-muted-foreground",children:"Name"}),C.jsx("div",{children:s.file.name}),C.jsx("div",{className:"font-bold text-muted-foreground",children:"Type"}),C.jsx("div",{children:f})]});const p=C.jsxs("div",{className:"text-xs text-muted-foreground p-1 flex justify-end gap-2 border-b",children:[e.isMarimoFile&&!N()&&C.jsx(et,{content:"Open notebook",children:C.jsx(Gs,{size:"small",onClick:e=>t(e),children:C.jsx(es,{})})}),C.jsx(et,{content:"Download",children:C.jsx(Gs,{size:"small",onClick:()=>{if(eO(f)){const e=ss(s.contents,f);ls(e,s.file.name)}else Ot(new Blob([s.contents||a],{type:f}),s.file.name)},children:C.jsx(jt,{})})}),!eO(f)&&C.jsxs(C.Fragment,{children:[C.jsx(et,{content:"Copy contents to clipboard",children:C.jsx(Gs,{size:"small",onClick:async()=>{await Je(a)},children:C.jsx(Qe,{})})}),C.jsx(et,{content:kt("global.save"),children:C.jsx(Gs,{size:"small",color:a===s.contents?void 0:"green",onClick:u,disabled:a===s.contents,children:C.jsx(Zc,{})})})]})]});return f.startsWith("image/")?C.jsxs(C.Fragment,{children:[p,C.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:C.jsx(ts,{base64:s.contents,mime:f})})]}):"text/csv"===f&&s.contents?C.jsxs(C.Fragment,{children:[p,C.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:C.jsx(ns,{contents:s.contents})})]}):f.startsWith("audio/")?C.jsxs(C.Fragment,{children:[p,C.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:C.jsx(os,{base64:s.contents,mime:f})})]}):f.startsWith("video/")?C.jsxs(C.Fragment,{children:[p,C.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:C.jsx(rs,{base64:s.contents,mime:f})})]}):C.jsxs(C.Fragment,{children:[p,C.jsx("div",{className:"flex-1 overflow-auto",children:C.jsx(as,{theme:"dark"===n?"dark":"light",language:tO[f]||tO.default,className:"border-b",extensions:[Qt.lineWrapping,Dn.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>a!==s.contents&&(u(),!0)}])],value:a,onChange:i})})]})},eO=e=>!!e&&(e.startsWith("image/")||e.startsWith("audio/")||e.startsWith("video/")),tO={"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 nO=H(new class{constructor(e){this.callbacks=e,this.delegate=new hl([]),this.rootPath="",this.onChange=On.NOOP,this.path=new pt("/"),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 hl(e.files),this.rootPath=e.root,this.path=pt.guessDeliminator(e.root)}catch(t){K({title:"Failed",description:ca(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 hl(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:(K({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:fn,createFileOrFolder:cs,deleteFileOrFolder:ds,renameFileOrFolder:us})),oO=H({});function rO(e){return new Promise(((t,n)=>{const o=new FileReader;o.onload=e=>{var n;t(null==(n=e.target)?void 0:n.result)},o.onerror=e=>{n(new Error(`Failed to read blob: ${e.type}`))},o.readAsDataURL(e)}))}function aO(e){const t=S(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:dO,onDropRejected:sO,onDrop:iO,...o},t[2]=o,t[3]=r):r=t[3],hs(r)}async function iO(e){for(const t of e){const e=(await rO(t)).split(",")[1];await cs({path:"",type:"file",name:t.name,contents:e})}await async function(){await q.get(nO).refreshAll([])}()}function sO(e){K({title:"File upload failed",description:C.jsx("div",{className:"flex flex-col gap-1",children:e.map(lO)}),variant:"danger"})}function lO(e){return C.jsxs("div",{children:[e.file.name," (",e.errors.map(cO).join(", "),")"]},e.file.name)}function cO(e){return e.message}function dO(e){V.error(e),K({title:"File upload failed",description:e.message,variant:"danger"})}const uO=u.createContext(null),hO=e=>{const t=S(60),{height:n}=e,o=r.useRef(null),[a]=Me(nO);let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=[],t[0]=i):i=t[0];const[s,l]=r.useState(i),[c,d]=r.useState(null),{openPrompt:u}=te(),[h,f]=Me(oO);let m,p;t[1]!==a?(m=()=>a.initialize(l),t[1]=a,t[2]=m):m=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(p=[],t[3]=p):p=t[3];const{loading:g,error:y}=dn(m,p);let v;t[4]!==a||t[5]!==h?(v=()=>{a.refreshAll(Object.keys(h).filter((e=>h[e])))},t[4]=a,t[5]=h,t[6]=v):v=t[6];const x=R(v);let b;t[7]!==u||t[8]!==a?(b=async()=>{u({title:"Folder name",onConfirm:async e=>{a.createFolder(e,null)}})},t[7]=u,t[8]=a,t[9]=b):b=t[9];const w=R(b);let k;t[10]!==u||t[11]!==a?(k=async()=>{u({title:"File name",onConfirm:async e=>{a.createFile(e,null)}})},t[10]=u,t[11]=a,t[12]=k):k=t[12];const N=R(k);let E;t[13]!==f?(E=()=>{var e;null==(e=o.current)||e.closeAll(),f({})},t[13]=f,t[14]=E):E=t[14];const j=R(E);if(g){let e;return t[15]===Symbol.for("react.memo_cache_sentinel")?(e=C.jsx(pi,{size:"medium",centered:!0}),t[15]=e):e=t[15],e}if(y){let e;return t[16]!==y?(e=C.jsx(Qi,{error:y}),t[16]=y,t[17]=e):e=t[17],e}if(c){let e,n,o,i,s,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=C.jsx(W,{onClick:e,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:C.jsx(nc,{size:16})}),t[19]=n):n=t[19],t[20]!==c.name?(o=C.jsxs("div",{className:"flex items-center pl-1 pr-3 flex-shrink-0 border-b justify-between",children:[n,C.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?(i=e=>xO(e,a.relativeFromRoot(c.path)),t[22]=a,t[23]=c.path,t[24]=i):i=t[24],t[25]!==i||t[26]!==c?(s=C.jsx(r.Suspense,{children:C.jsx(QM,{onOpenNotebook:i,file:c})}),t[25]=i,t[26]=c,t[27]=s):s=t[27],t[28]!==o||t[29]!==s?(l=C.jsxs(C.Fragment,{children:[o,s]}),t[28]=o,t[29]=s,t[30]=l):l=t[30],l}let _;t[31]!==x||t[32]!==N||t[33]!==w||t[34]!==j||t[35]!==a?(_=C.jsx(mO,{onRefresh:x,onCreateFile:N,onCreateFolder:w,onCollapseAll:j,tree:a}),t[31]=x,t[32]=N,t[33]=w,t[34]=j,t[35]=a,t[36]=_):_=t[36];const I=n-33;let T,A,M,O,D,P,L,z;return t[37]!==a?(T=async e=>{const{ids:t}=e;for(const n of t)await a.delete(n)},A=async e=>{const{id:t,name:n}=e;await a.rename(t,n)},M=async e=>{const{dragIds:t,parentId:n}=e;await a.move(t,n)},t[37]=a,t[38]=T,t[39]=A,t[40]=M):(T=t[38],A=t[39],M=t[40]),t[41]===Symbol.for("react.memo_cache_sentinel")?(O=e=>{const t=e[0];t&&(t.data.isDirectory||d(t.data))},t[41]=O):O=t[41],t[42]!==a||t[43]!==h||t[44]!==f?(D=async e=>{if(await a.expand(e)){const t=h[e]??!1;f({...h,[e]:!t})}},t[42]=a,t[43]=h,t[44]=f,t[45]=D):D=t[45],t[46]!==I||t[47]!==s||t[48]!==h||t[49]!==T||t[50]!==A||t[51]!==M||t[52]!==D?(P=C.jsx(fl,{width:"100%",ref:o,height:I,className:"h-full",data:s,initialOpenState:h,openByDefault:!1,renderCursor:bO,disableDrop:wO,onDelete:T,onRename:A,onMove:M,onSelect:O,onToggle:D,padding:15,rowHeight:30,indent:fO,overscanCount:1e3,disableMultiSelection:!0,children:yO}),t[46]=I,t[47]=s,t[48]=h,t[49]=T,t[50]=A,t[51]=M,t[52]=D,t[53]=P):P=t[53],t[54]!==a||t[55]!==P?(L=C.jsx(uO.Provider,{value:a,children:P}),t[54]=a,t[55]=P,t[56]=L):L=t[56],t[57]!==_||t[58]!==L?(z=C.jsxs(C.Fragment,{children:[_,L]}),t[57]=_,t[58]=L,t[59]=z):z=t[59],z},fO=15,mO=e=>{const t=S(30),{onRefresh:n,onCreateFile:o,onCreateFolder:r,onCollapseAll:a}=e;let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={noDrag:!0,noDragEventsBubbling:!0},t[0]=i):i=t[0];const{getRootProps:s,getInputProps:l}=aO(i);let c,d,u,h,f,m,p,g,y,v,x,b,w,k,N;return t[1]===Symbol.for("react.memo_cache_sentinel")?(c=C.jsx(Nc,{size:16}),t[1]=c):c=t[1],t[2]!==o?(d=C.jsx(et,{content:"Add file",children:C.jsx(W,{"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=C.jsx(Ec,{size:16}),t[4]=u):u=t[4],t[5]!==r?(h=C.jsx(et,{content:"Add folder",children:C.jsx(W,{"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]!==s?(f=s({}),t[7]=s,t[8]=f):f=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(m=fs({variant:"text",size:"xs"}),p=C.jsx(ms,{size:16}),t[9]=m,t[10]=p):(m=t[9],p=t[10]),t[11]!==f?(g=C.jsx(et,{content:"Upload file",children:C.jsx("button",{"data-testid":"file-explorer-upload-button",...f,className:m,children:p})}),t[11]=f,t[12]=g):g=t[12],t[13]!==l?(y=l({}),t[13]=l,t[14]=y):y=t[14],t[15]!==y?(v=C.jsx("input",{...y,type:"file"}),t[15]=y,t[16]=v):v=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(x=C.jsx(Na,{size:16}),t[17]=x):x=t[17],t[18]!==n?(b=C.jsx(et,{content:"Refresh",children:C.jsx(W,{"data-testid":"file-explorer-refresh-button",onClick:n,variant:"text",size:"xs",children:x})}),t[18]=n,t[19]=b):b=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(w=C.jsx(bc,{size:16}),t[20]=w):w=t[20],t[21]!==a?(k=C.jsx(et,{content:"Collapse all folders",children:C.jsx(W,{"data-testid":"file-explorer-collapse-button",onClick:a,variant:"text",size:"xs",children:w})}),t[21]=a,t[22]=k):k=t[22],t[23]!==d||t[24]!==h||t[25]!==g||t[26]!==v||t[27]!==b||t[28]!==k?(N=C.jsxs("div",{className:"flex items-center justify-end px-2 flex-shrink-0 border-b",children:[d,h,g,v,b,k]}),t[23]=d,t[24]=h,t[25]=g,t[26]=v,t[27]=b,t[28]=k,t[29]=N):N=t[29],N},pO=e=>{const t=S(9),{node:n,onOpenMarimoFile:o}=e;let r,a,i;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&&!N()&&C.jsxs("span",{className:"flex-shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:o,children:["open ",C.jsx(es,{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?(i=C.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]=i):i=t[8],i},gO=e=>{const t=S(10),{node:n}=e,o=r.useRef(null);let a,i,s,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("."))},i=[n.data.name],t[0]=n.data.name,t[1]=a,t[2]=i):(a=t[1],i=t[2]),r.useEffect(a,i),t[3]!==n?(s=()=>n.reset(),l=e=>{"Escape"===e.key&&n.reset(),"Enter"===e.key&&n.submit(e.currentTarget.value)},t[3]=n,t[4]=s,t[5]=l):(s=t[4],l=t[5]),t[6]!==n.data.name||t[7]!==s||t[8]!==l?(c=C.jsx("input",{ref:o,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:kO,onBlur:s,onKeyDown:l}),t[6]=n.data.name,t[7]=s,t[8]=l,t[9]=c):c=t[9],c},yO=e=>{const t=S(52),{node:n,style:o,dragHandle:a}=e;let i;t[0]!==n.data?(i=n.data.isDirectory?"directory":un(n.data.name),t[0]=n.data,t[1]=i):i=t[1];const s=i,l=mn[s],{openConfirm:c,openPrompt:d}=te(),u=r.useContext(uO);let h;t[2]!==u||t[3]!==n.data.path?(h=async e=>{xO(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 f=h;let m;t[5]!==c||t[6]!==n.data.name||t[7]!==n.tree||t[8]!==n.id?(m=async e=>{e.stopPropagation(),e.preventDefault(),c({title:"Delete file",description:`Are you sure you want to delete ${n.data.name}?`,confirmAction:C.jsx(nt,{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]=m):m=t[9];const p=m;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 y=R(g);let v;t[14]!==n||t[15]!==d||t[16]!==u?(v=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]=v):v=t[17];const x=R(v);let b;t[18]!==n||t[19]!==x||t[20]!==y||t[21]!==u||t[22]!==s||t[23]!==f||t[24]!==p?(b=()=>{const e={size:14,strokeWidth:1.5,className:"mr-2"};return C.jsxs(Gt,{align:"end",className:"no-print w-[220px]",onClick:e=>e.stopPropagation(),onCloseAutoFocus:e=>e.preventDefault(),children:[!n.data.isDirectory&&C.jsxs(zt,{onSelect:()=>n.select(),children:[C.jsx(md,{...e}),"Open file"]}),n.data.isDirectory&&C.jsxs(C.Fragment,{children:[C.jsxs(zt,{onSelect:()=>x(),children:[C.jsx(Nc,{...e}),"Create file"]}),C.jsxs(zt,{onSelect:()=>y(),children:[C.jsx(Ec,{...e}),"Create folder"]}),C.jsx($t,{})]}),C.jsxs(zt,{onSelect:()=>n.edit(),children:[C.jsx(Gc,{...e}),"Rename"]}),C.jsxs(zt,{onSelect:async()=>{await Je(n.data.path),K({title:"Copied to clipboard"})},children:[C.jsx(Qe,{...e}),"Copy path"]}),u&&C.jsxs(zt,{onSelect:async()=>{await Je(u.relativeFromRoot(n.data.path)),K({title:"Copied to clipboard"})},children:[C.jsx(Qe,{...e}),"Copy relative path"]}),C.jsxs(zt,{onSelect:async()=>{K({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=ps[s](e);await Je(t)},children:[C.jsx(gs,{...e}),"Copy snippet for reading file"]}),n.data.isMarimoFile&&!N()&&C.jsxs(C.Fragment,{children:[C.jsx($t,{}),C.jsxs(zt,{onSelect:f,children:[C.jsx(sd,{...e}),"Open notebook"]})]}),C.jsx($t,{}),!n.data.isDirectory&&C.jsxs(C.Fragment,{children:[C.jsxs(zt,{onSelect:async()=>{const e=(await Zi({path:n.data.path})).contents||"";Ot(new Blob([e]),n.data.name)},children:[C.jsx(jt,{...e}),"Download"]}),C.jsx($t,{})]}),C.jsxs(zt,{onSelect:p,variant:"danger",children:[C.jsx(be,{...e}),"Delete"]})]})},t[18]=n,t[19]=x,t[20]=y,t[21]=u,t[22]=s,t[23]=f,t[24]=p,t[25]=b):b=t[25];const w=b;let k,E,j;t[26]===Symbol.for("react.memo_cache_sentinel")?(k=hn("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),t[26]=k):k=t[26],t[27]!==n?(E=e=>{e.stopPropagation(),n.data.isDirectory&&n.toggle()},j=C.jsx(vO,{node:n}),t[27]=n,t[28]=E,t[29]=j):(E=t[28],j=t[29]);const _=n.willReceiveDrop&&n.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground";let I,T,A,M,O,D,P;return t[30]!==_?(I=hn("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",_),t[30]=_,t[31]=I):I=t[31],t[32]!==n.data.isMarimoFile||t[33]!==l?(T=n.data.isMarimoFile?C.jsx("img",{src:"./favicon.ico",className:"w-5 h-5 flex-shrink-0 mr-2 filter grayscale",alt:"Marimo"}):C.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]!==f?(A=n.isEditing?C.jsx(gO,{node:n}):C.jsx(pO,{node:n,onOpenMarimoFile:f}),t[35]=n,t[36]=f,t[37]=A):A=t[37],t[38]===Symbol.for("react.memo_cache_sentinel")?(M=C.jsx(Ft,{asChild:!0,tabIndex:-1,onClick:SO,children:C.jsx(W,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:C.jsx(wc,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),t[38]=M):M=t[38],t[39]!==w?(O=C.jsxs(Wt,{modal:!1,children:[M,w()]}),t[39]=w,t[40]=O):O=t[40],t[41]!==I||t[42]!==T||t[43]!==A||t[44]!==O?(D=C.jsxs("span",{className:I,children:[T,A,O]}),t[41]=I,t[42]=T,t[43]=A,t[44]=O,t[45]=D):D=t[45],t[46]!==o||t[47]!==a||t[48]!==E||t[49]!==j||t[50]!==D?(P=C.jsxs("div",{style:o,ref:a,className:k,draggable:!0,onClick:E,children:[j,D]}),t[46]=o,t[47]=a,t[48]=E,t[49]=j,t[50]=D,t[51]=P):P=t[51],P},vO=e=>{const t=S(3),{node:n}=e;if(!n.data.isDirectory){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=C.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?C.jsx(ve,{className:"w-5 h-5 flex-shrink-0"}):C.jsx(Ca,{className:"w-5 h-5 flex-shrink-0"}),t[1]=n.isOpen,t[2]=o):o=t[2],o};function xO(e,t){e.stopPropagation(),e.preventDefault(),window.open(`/?file=${t}`,"_blank")}function bO(){return null}function wO(e){const{parentNode:t}=e;return!t.data.isDirectory}function kO(e){return e.stopPropagation()}function SO(e){return e.stopPropagation()}const NO=()=>{const e=S(20),{ref:t,height:n}=JM(),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:i,isDragActive:s}=aO(r);let l,c,d,u,h,f,m,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=hn("flex flex-col flex-1 overflow-hidden relative"),e[3]=c):c=e[3],e[4]!==i?(d=i(),e[4]=i,e[5]=d):d=e[5],e[6]!==d?(u=C.jsx("input",{...d}),e[6]=d,e[7]=u):u=e[7],e[8]!==s?(h=s&&C.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]=s,e[9]=h):h=e[9],e[10]!==o?(f=C.jsx(hO,{height:o}),e[10]=o,e[11]=f):f=e[11],e[12]!==t||e[13]!==f?(m=C.jsx("div",{ref:t,className:"flex flex-col flex-1 overflow-hidden",children:f}),e[12]=t,e[13]=f,e[14]=m):m=e[14],e[15]!==l||e[16]!==u||e[17]!==h||e[18]!==m?(p=C.jsxs("div",{...l,className:c,children:[u,h,m]}),e[15]=l,e[16]=u,e[17]=h,e[18]=m,e[19]=p):p=e[19],p},CO=e=>{const t=S(6),{children:n}=e,{openModal:o,closeModal:r}=te();let a,i;return t[0]!==o||t[1]!==r?(a=()=>o(C.jsx(jO,{onClose:r})),t[0]=o,t[1]=r,t[2]=a):a=t[2],t[3]!==a||t[4]!==n?(i=C.jsx(vi,{onClick:a,children:n}),t[3]=a,t[4]=n,t[5]=i):i=t[5],i},EO=[Qt.lineWrapping],jO=e=>{const t=S(23),{onClose:n}=e,[o,a]=r.useState(""),{theme:i}=je();let s,l,c,d,u,h;t[0]!==n?(s=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(),K({title:"Snippet Submitted",description:"Thank you for contributing! We will review your snippet shortly."})},t[0]=n,t[1]=s):s=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(l=C.jsx(Ne,{children:"Contribute a Snippet"}),t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=C.jsxs(Se,{children:[l,C.jsxs(Ye,{children:["Have a useful snippet you want to share with the community? Submit it here or make a pull request"," ",C.jsx("a",{href:qe.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=C.jsx(Xe,{id:"title",name:"title",autoFocus:!0,placeholder:"Title",required:!0,autoComplete:"off"}),u=C.jsx(ys,{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=C.jsx("input",{type:"hidden",name:"code",value:o}),t[6]=o,t[7]=h):h=t[7];const f="dark"===i?"dark":"light";let m,p,g,y,v,x;return t[8]!==f||t[9]!==o?(m=C.jsx(as,{theme:f,language:"python",className:"cm border rounded overflow-hidden",extensions:EO,value:o,onChange:a}),t[8]=f,t[9]=o,t[10]=m):m=t[10],t[11]!==h||t[12]!==m?(p=C.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[d,u,h,m]}),t[11]=h,t[12]=m,t[13]=p):p=t[13],t[14]!==n?(g=C.jsx(W,{"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")?(y=C.jsx(W,{"data-testid":"snippet-send-button","aria-label":"Save",variant:"default",type:"submit",children:"Send"}),t[16]=y):y=t[16],t[17]!==g?(v=C.jsxs(Ke,{children:[g,y]}),t[17]=g,t[18]=v):v=t[18],t[19]!==s||t[20]!==p||t[21]!==v?(x=C.jsx(ke,{className:"w-fit",children:C.jsxs("form",{onSubmit:s,children:[c,p,v]})}),t[19]=s,t[20]=p,t[21]=v,t[22]=x):x=t[22],x},_O=[Qt.lineWrapping],IO=()=>{const e=S(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:i,loading:s}=dn(MO,o);if(i){let t;return e[1]!==i?(t=C.jsx(Qi,{error:i}),e[1]=i,e[2]=t):t=e[2],t}if(s||!a){let t;return e[3]===Symbol.for("react.memo_cache_sentinel")?(t=C.jsx(pi,{size:"medium",centered:!0}),e[3]=t):t=e[3],t}const l=t?"h-1/3":"h-full";let c,d,h,f,m,p,g,y,v;return e[4]!==l?(c=hn("border-b rounded-none",l),e[4]=l,e[5]=c):c=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(d=C.jsx(He,{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=C.jsxs("div",{className:"flex items-center w-full",children:[d,C.jsx(CO,{children:C.jsx("button",{className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:C.jsx(sr,{className:"h-4 w-4"})})})]}),f=C.jsx(We,{children:"No results"}),e[7]=h,e[8]=f):(h=e[7],f=e[8]),e[9]===Symbol.for("react.memo_cache_sentinel")?(m=e=>n(e),e[9]=m):m=e[9],e[10]!==a.snippets?(p=C.jsx(AO,{onSelect:m,snippets:a.snippets}),e[10]=a.snippets,e[11]=p):p=e[11],e[12]!==c||e[13]!==p?(g=C.jsxs(vn,{className:c,children:[h,f,p]}),e[12]=c,e[13]=p,e[14]=g):g=e[14],e[15]!==t?(y=C.jsx(r.Suspense,{children:C.jsx("div",{className:"h-2/3 snippet-viewer flex flex-col",children:t?C.jsx(TO,{snippet:t},t.title):C.jsx(SN,{title:"",description:"Click on a snippet to view its content."})})}),e[15]=t,e[16]=y):y=e[16],e[17]!==g||e[18]!==y?(v=C.jsxs("div",{className:"flex-1 overflow-hidden",children:[g,y]}),e[17]=g,e[18]=y,e[19]=v):v=e[19],v},TO=e=>{const t=S(27),{snippet:n}=e,{theme:o}=je(),{createNewCell:r}=L(),a=Jd();let i;t[0]!==n.sections||t[1]!==r||t[2]!==a?(i=()=>{for(const e of[...n.sections].reverse())e.code&&r({code:e.code,before:!1,cellId:a??"__end__",skipIfCodeExists:!0})},t[0]=n.sections,t[1]=r,t[2]=a,t[3]=i):i=t[3];const s=i;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,f,m,p;if(t[7]!==n.title?(d=C.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=C.jsx(sc,{className:"ml-2 h-4 w-4"}),t[9]=u):u=t[9],t[10]!==s?(h=C.jsx("div",{className:"flex justify-end",children:C.jsx(ih,{children:C.jsxs(W,{className:"float-right",size:"xs",variant:"outline",onClick:s,children:["Insert snippet",u]})})}),t[10]=s,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?C.jsx("div",{children:Ba({html:r})},`${n.title}-${a}`):t?C.jsxs("div",{className:"relative hover-actions-parent pr-2",children:[C.jsx(ih,{children:C.jsx(et,{content:"Insert snippet",children:C.jsx(W,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{c(t)},children:C.jsx(sc,{className:"h-5 w-5"})})})}),C.jsx(as,{theme:"dark"===o?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:_O,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],f=n.sections.map(e),t[12]=n.title,t[13]=n.sections,t[14]=c,t[15]=o,t[16]=f}else f=t[16];return t[21]!==h||t[22]!==f?(m=C.jsxs("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[h,f]}),t[21]=h,t[22]=f,t[23]=m):m=t[23],t[24]!==d||t[25]!==m?(p=C.jsxs(C.Fragment,{children:[d,m]}),t[24]=d,t[25]=m,t[26]=p):p=t[26],p},AO=e=>{const t=S(7),{snippets:n,onSelect:o}=e;let r,a;if(t[0]!==o||t[1]!==n){let e;t[3]!==o?(e=e=>C.jsx(Fe,{className:"rounded-none",onSelect:()=>o(e),children:C.jsx("div",{className:"flex flex-row gap-2 items-center",children:C.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=C.jsx(Fr,{className:"flex flex-col overflow-auto",children:r}),t[5]=r,t[6]=a):a=t[6],a};function MO(){return vs()}const OO=e=>{const t=S(11),{value:n,className:o,tooltip:a}=e,[i,s]=r.useState(!1);let l;t[0]!==n?(l=Ze.stopPropagation((async()=>{await Je(n).then((()=>{s(!0),setTimeout((()=>s(!1)),2e3)}))})),t[0]=n,t[1]=l):l=t[1];const c=l;let d,u;t[2]!==i||t[3]!==o?(d=i?C.jsx(Nt,{className:hn(o,"text-[var(--grass-11)]")}):C.jsx(Qe,{className:o}),t[2]=i,t[3]=o,t[4]=d):d=t[4],t[5]!==c||t[6]!==d?(u=C.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 f=i?"Copied!":a??"Copy to clipboard";let m;return t[8]!==f||t[9]!==h?(m=C.jsx(et,{content:f,delayDuration:400,children:h}),t[8]=f,t[9]=h,t[10]=m):m=t[10],m},DO=H((e=>{const t=e(ea),n=e(J),o=e(di);return tc(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}))})),PO=()=>{const e=S(43),[t,n]=u.useState(""),o=ee(re),r=Jd(),{expandedColumns:a,expandedTables:i,columnsPreviews:s}=xs(),{toggleTable:l,toggleColumn:c,closeAllColumns:d}=bs(),{createNewCell:h}=L(),f=ee(DO);if(0===f.length){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=C.jsx(SN,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",icon:C.jsx(pe,{})}),e[0]=t):t=e[0],t}let m;e[1]!==o||e[2]!==h||e[3]!==r?(m=e=>{e.includes("alt")&&function(e,t,n){Hd("altair","alt",(o=>{const r=Q.create();t({cellId:n??"__end__",before:!1,code:o,lastCodeRun:e?o:void 0,newCellId:r,autoFocus:!1}),e&&U({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]=m):m=e[4];const p=m;let g;e[5]!==o||e[6]!==h||e[7]!==r?(g=e=>{$d(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:b(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 y=g,v=!!t.trim();let x,w,k,N,E,j,_,I,T,A,M;return e[9]===Symbol.for("react.memo_cache_sentinel")?(x=hn("border-b bg-background rounded-none","h-full"),e[9]=x):x=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?(k=C.jsx(He,{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]=k):k=e[14],e[15]!==v?(N=v&&C.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:C.jsx(sn,{className:"h-4 w-4"})}),e[15]=v,e[16]=N):N=e[16],e[17]!==k||e[18]!==N?(E=C.jsxs("div",{className:"flex items-center w-full",children:[k,N]}),e[17]=k,e[18]=N,e[19]=E):E=e[19],e[20]!==c||e[21]!==s?(j=(e,t)=>{const n=`${e.name}:${t.name}`;c({table:e.name,column:t.name}),s.has(n)||ks({source:e.source,tableName:e.name,columnName:t.name,sourceType:e.source_type})},e[20]=c,e[21]=s,e[22]=j):j=e[22],e[23]!==l?(_=e=>{l(e.name)},e[23]=l,e[24]=_):_=e[24],e[25]!==v||e[26]!==i?(I=e=>!!v||i.has(e.name),e[25]=v,e[26]=i,e[27]=I):I=e[27],e[28]!==a?(T=(e,t)=>{const n=`${e.name}:${t.name}`;return a.has(n)},e[28]=a,e[29]=T):T=e[29],e[30]!==p||e[31]!==y||e[32]!==j||e[33]!==_||e[34]!==s||e[35]!==f||e[36]!==v||e[37]!==I||e[38]!==T?(A=C.jsx(RO,{onAddColumnChart:p,onAddTable:y,onExpandColumn:j,onExpandTable:_,columnPreviews:s,tables:f,isSearching:v,isTableExpanded:I,isColumnExpanded:T}),e[30]=p,e[31]=y,e[32]=j,e[33]=_,e[34]=s,e[35]=f,e[36]=v,e[37]=I,e[38]=T,e[39]=A):A=e[39],e[40]!==E||e[41]!==A?(M=C.jsx("div",{className:"flex-1 overflow-hidden",children:C.jsxs(vn,{className:x,children:[E,A]})}),e[40]=E,e[41]=A,e[42]=M):M=e[42],M},RO=e=>{const t=S(25),{tables:n,isSearching:o,columnPreviews:r,onAddColumnChart:a,onAddTable:i,onExpandTable:s,onExpandColumn:l,isTableExpanded:c,isColumnExpanded:d}=e;let h,f,m,p;if(t[0]!==n||t[1]!==c||t[2]!==o||t[3]!==s||t[4]!==i||t[5]!==l||t[6]!==d||t[7]!==a||t[8]!==r){let e,p;e=Object.entries(De.groupBy(n,UO,VO)),e=tc(e,HO),t[12]!==c||t[13]!==o||t[14]!==s||t[15]!==i||t[16]!==l||t[17]!==d||t[18]!==a||t[19]!==r?(p=e=>{const t=c(e),n=[C.jsx(LO,{table:e,forceMount:o,onExpand:()=>s(e),onAddTable:()=>i(e),isExpanded:t},e.name)];return t&&n.push(...e.columns.map((t=>C.jsxs(u.Fragment,{children:[C.jsx(zO,{table:e,column:t,onExpandColumn:l,isExpanded:d(e,t)},`${e.name}.${t.name}`),d(e,t)&&C.jsx("div",{className:"pl-10 pr-2 py-2 bg-[var(--slate-1)] shadow-inner border-b",children:C.jsx(Ss,{children:C.jsx(BO,{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]=s,t[15]=i,t[16]=l,t[17]=d,t[18]=a,t[19]=r,t[20]=p):p=t[20];const g=p;h=Fr,f="flex flex-col overflow-auto",m=(()=>0===e.length?null:1===e.length?e[0][1].flatMap(g):e.flatMap(((e,t)=>{const[n,o]=e;return[C.jsx("div",{className:hn("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]=s,t[4]=i,t[5]=l,t[6]=d,t[7]=a,t[8]=r,t[9]=h,t[10]=f,t[11]=m}else h=t[9],f=t[10],m=t[11];return t[21]!==h||t[22]!==f||t[23]!==m?(p=C.jsx(h,{className:f,children:m}),t[21]=h,t[22]=f,t[23]=m,t[24]=p):p=t[24],p},LO=e=>{const t=S(27),{table:n,onExpand:o,onAddTable:r,isExpanded:a}=e;let i;t[0]!==n.num_rows||t[1]!==n.num_columns?(i=()=>{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:C.jsx("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:C.jsx("span",{className:"text-xs text-muted-foreground",children:e.join(", ")})})},t[0]=n.num_rows,t[1]=n.num_columns,t[2]=i):i=t[2];const s=i,l=n.name,c=a&&"rotate-90";let d,u,h,f,m,p,g,y,v;return t[3]!==c?(d=hn("h-3 w-3 transition-transform",c),t[3]=c,t[4]=d):d=t[4],t[5]!==d?(u=C.jsx(Ca,{className:d}),t[5]=d,t[6]=u):u=t[6],t[7]!==n.name?(h=C.jsx("span",{className:"text-sm",children:n.name}),t[7]=n.name,t[8]=h):h=t[8],t[9]!==u||t[10]!==h?(f=C.jsxs("div",{className:"flex gap-1 items-center flex-1",children:[u,h]}),t[9]=u,t[10]=h,t[11]=f):f=t[11],t[12]!==s?(m=s(),t[12]=s,t[13]=m):m=t[13],t[14]!==r||t[15]!==n?(p=Ze.stopPropagation((()=>r(n))),t[14]=r,t[15]=n,t[16]=p):p=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(g=C.jsx(ld,{className:"h-3 w-3"}),t[17]=g):g=t[17],t[18]!==p?(y=C.jsx(et,{content:"Add table to notebook",delayDuration:400,children:C.jsx(W,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:p,children:g})}),t[18]=p,t[19]=y):y=t[19],t[20]!==n.name||t[21]!==a||t[22]!==o||t[23]!==f||t[24]!==m||t[25]!==y?(v=C.jsxs(Fe,{className:"rounded-none py-1 group min-h-9 border-t",value:l,"aria-selected":a,forceMount:!0,onSelect:o,children:[f,m,y]}),t[20]=n.name,t[21]=a,t[22]=o,t[23]=f,t[24]=m,t[25]=y,t[26]=v):v=t[26],v},zO=e=>{const t=S(22),{table:n,column:o,onExpandColumn:r}=e,a=Ns[o.type],i=`${n.name}.${o.name}`,s=`${n.name}.${o.name}`;let l,c,d,u,h,f,m;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=C.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=C.jsx("span",{children:o.name}),t[6]=o.name,t[7]=d):d=t[7],t[8]!==c||t[9]!==d?(u=C.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=C.jsx(et,{content:"Copy column name",delayDuration:400,children:C.jsx(W,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:C.jsx(OO,{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?(f=C.jsx("span",{className:"text-xs text-muted-foreground",children:o.external_type}),t[13]=o.external_type,t[14]=f):f=t[14],t[15]!==i||t[16]!==s||t[17]!==l||t[18]!==u||t[19]!==h||t[20]!==f?(m=C.jsxs(Fe,{className:"rounded-none py-1 group",value:s,onSelect:l,children:[u,h,f]},i),t[15]=i,t[16]=s,t[17]=l,t[18]=u,t[19]=h,t[20]=f,t[21]=m):m=t[21],m},FO=u.lazy((()=>ws((()=>import("./index-InxjuO9N.js")),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]),import.meta.url).then((e=>({default:e.VegaLite}))))),BO=e=>{const t=S(26),{table:n,column:o,preview:r,onAddColumnChart:a}=e,{theme:i}=je();if(!r){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=C.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading..."}),t[0]=e):e=t[0],e}let s;t[1]!==r.error?(s=r.error&&C.jsx("span",{className:"text-xs text-muted-foreground",children:r.error}),t[1]=r.error,t[2]=s):s=t[2];const l=s;let c;t[3]!==r.summary?(c=r.summary&&C.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($O)}),t[3]=r.summary,t[4]=c):c=t[4];const d=c,u=WO;let h;t[5]!==r.chart_spec||t[6]!==i?(h=r.chart_spec&&C.jsx(FO,{spec:u(JSON.parse(r.chart_spec)),width:"container",height:100,actions:!1,theme:"dark"===i?"dark":"vox"}),t[5]=r.chart_spec,t[6]=i,t[7]=h):h=t[7];const f=h;let m;t[8]!==r.chart_code||t[9]!==n||t[10]!==a?(m=r.chart_code&&"local"===n.source_type&&C.jsx(et,{content:"Add chart to notebook",delayDuration:400,children:C.jsx(W,{variant:"outline",size:"icon",className:"z-10 bg-background absolute right-1 -top-1",onClick:Ze.stopPropagation((()=>a(r.chart_code||""))),children:C.jsx(ld,{className:"h-3 w-3"})})}),t[8]=r.chart_code,t[9]=n,t[10]=a,t[11]=m):m=t[11];const p=m;let g;t[12]!==n||t[13]!==o||t[14]!==a?(g="duckdb"===n.source_type&&C.jsx(et,{content:"Add SQL cell",delayDuration:400,children:C.jsx(W,{variant:"outline",size:"icon",className:"z-10 bg-background absolute right-1 -top-1",onClick:Ze.stopPropagation((()=>{const e=`_df = mo.sql(f'SELECT "${o.name}" FROM ${n.name} LIMIT 100')`;a(e)})),children:C.jsx(ld,{className:"h-3 w-3"})})}),t[12]=n,t[13]=o,t[14]=a,t[15]=g):g=t[15];const y=g;let v;t[16]!==r.chart_max_rows_errors?(v=r.chart_max_rows_errors&&C.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]=v):v=t[17];const x=v;if(!(l||d||f||x)){let e;return t[18]===Symbol.for("react.memo_cache_sentinel")?(e=C.jsx("span",{className:"text-xs text-muted-foreground",children:"No data"}),t[18]=e):e=t[18],e}let b;return t[19]!==l||t[20]!==p||t[21]!==y||t[22]!==x||t[23]!==f||t[24]!==d?(b=C.jsxs("div",{className:"flex flex-col gap-2 relative",children:[l,p,y,x,f,d]}),t[19]=l,t[20]=p,t[21]=y,t[22]=x,t[23]=f,t[24]=d,t[25]=b):b=t[25],b};function UO(e){return e.source}function VO(e){return e}function HO(e){const[t]=e;return"memory"===t?0:1}function $O(e){const[t,n]=e;return null==n?null:C.jsxs("div",{className:"flex items-center gap-1 group",children:[C.jsx(OO,{className:"h-3 w-3 invisible group-hover:visible",value:String(n)}),C.jsx("span",{className:"text-xs min-w-[60px] uppercase",children:t}),C.jsx("span",{className:"text-xs font-bold text-muted-foreground tracking-wide",children:Cs(n)})]},t)}function WO(e){return{...e,config:{...e.config,background:"transparent"}}}const GO=e=>{const t=S(4),{isOpen:n,children:o}=e,[r,a]=u.useState(!1);let i,s;return t[0]!==n||t[1]!==r?(i=()=>{n&&!r&&a(!0)},s=[n,r],t[0]=n,t[1]=r,t[2]=i,t[3]=s):(i=t[2],s=t[3]),u.useEffect(i,s),r?o:null},qO=ra("marimo:scratchpadHistory:v1",[]),YO=H(!1),XO=H(null,((e,t,n)=>{if(!(n=n.trim()))return;const o=e(qO),r=[n,...o.filter((e=>e!==n))].slice(0,15);t(qO,r)})),KO={hide_code:!1,disabled:!1},JO=()=>{const e=S(80),t=jn(),[n]=_e(),{theme:o}=je(),a=r.useRef(null),i=Jd(),{createNewCell:s,updateCellCode:l}=L(),c=t.cellRuntime[Ee],d=null==c?void 0:c.output,u=null==c?void 0:c.status,h=null==c?void 0:c.consoleOutputs,f=t.cellData[Ee],m=(null==f?void 0:f.code)??"",p=ne(XO),[g,y]=Me(YO),v=ee(qO);let x;e[0]!==m||e[1]!==p?(x=()=>{Es({code:m}),p(m)},e[0]=m,e[1]=p,e[2]=x):x=e[2];const b=R(x);let w;e[3]!==m||e[4]!==s||e[5]!==i?(w=()=>{m.trim()&&s({code:m,before:!1,cellId:i??"__end__"})},e[3]=m,e[4]=s,e[5]=i,e[6]=w):w=e[6];const k=R(w);let N;e[7]!==l?(N=()=>{l({cellId:Ee,code:"",formattingChange:!1}),Es({code:""});const e=a.current;e&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:""}})},e[7]=l,e[8]=N):N=e[8];const E=R(N);let j;e[9]!==y||e[10]!==l?(j=e=>{y(!1),l({cellId:Ee,code:e,formattingChange:!1});const t=a.current;t&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},e[9]=y,e[10]=l,e[11]=j):j=e[11];const _=R(j),[I,T]=r.useState();let A,M,O,D,P,z,F,B;if(e[12]!==o||e[13]!==m||e[14]!==b||e[15]!==l||e[16]!==n||e[17]!==I||e[18]!==d||e[19]!==h||e[20]!==g||e[21]!==v||e[22]!==_||e[23]!==E||e[24]!==k||e[25]!==u||e[26]!==y){const t=()=>C.jsxs(C.Fragment,{children:[C.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[40%]",children:C.jsx(Rw,{theme:o,allowFocus:!1,showPlaceholder:!1,id:Ee,code:m,config:KO,status:"idle",serializedEditorState:null,runCell:b,updateCellCode:l,createNewCell:On.NOOP,deleteCell:On.NOOP,focusCell:On.NOOP,moveCell:On.NOOP,moveToNextCell:void 0,updateCellConfig:On.NOOP,clearSerializedEditorState:On.NOOP,userConfig:n,editorViewRef:a,setEditorView:e=>{a.current=e},hidden:!1,temporarilyShowCode:On.NOOP,languageAdapter:I,setLanguageAdapter:T})}),C.jsx("div",{className:"flex-1 overflow-auto flex-shrink-0",children:C.jsx(La,{allowExpand:!1,output:d,className:"output-area",cellId:Ee,stale:!1})}),C.jsx("div",{className:"overflow-auto flex-shrink-0 max-h-[35%]",children:C.jsx(jl,{consoleOutputs:h,className:"overflow-auto",stale:!1,cellName:js,onSubmitDebugger:On.NOOP,cellId:Ee,debuggerActive:!1})})]});let r;e[33]!==g||e[34]!==v||e[35]!==_||e[36]!==o?(r=()=>g?C.jsx("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:C.jsx("div",{className:"overflow-auto flex flex-col gap-3",children:v.map(((e,t)=>C.jsx("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>_(e),children:C.jsx(as,{language:"python",theme:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:e.trim(),editable:!1,readOnly:!0})},t)))})}):null,e[33]=g,e[34]=v,e[35]=_,e[36]=o,e[37]=r):r=e[37];const i=r;let s,c,f,p,x,w,S,N,j;O="flex flex-col h-full overflow-hidden divide-y",e[38]===Symbol.for("react.memo_cache_sentinel")?(D=ft.create(Ee),e[38]=D):D=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(s=kt("cell.run"),e[39]=s):s=e[39],e[40]===Symbol.for("react.memo_cache_sentinel")?(c=C.jsx(qc,{color:"var(--grass-11)",size:16}),e[40]=c):c=e[40],e[41]!==b||e[42]!==g?(f=C.jsx(et,{content:s,children:C.jsx(W,{"data-testid":"scratchpad-run-button",onClick:b,disabled:g,variant:"text",size:"xs",children:c})}),e[41]=b,e[42]=g,e[43]=f):f=e[43],e[44]===Symbol.for("react.memo_cache_sentinel")?(p=C.jsx(kc,{size:16}),e[44]=p):p=e[44],e[45]!==g||e[46]!==E?(x=C.jsx(et,{content:"Clear code and outputs",children:C.jsx(W,{disabled:g,size:"xs",variant:"text",onClick:E,children:p})}),e[45]=g,e[46]=E,e[47]=x):x=e[47],e[48]===Symbol.for("react.memo_cache_sentinel")?(w=C.jsx(sc,{size:16}),e[48]=w):w=e[48],e[49]!==g||e[50]!==k?(S=C.jsx(ih,{children:C.jsx(et,{content:"Insert code",children:C.jsx(W,{disabled:g,size:"xs",variant:"text",onClick:k,children:w})})}),e[49]=g,e[50]=k,e[51]=S):S=e[51],e[52]!==u?(N=("running"===u||"queued"===u)&&C.jsx(pi,{className:"inline",size:"small"}),e[52]=u,e[53]=N):N=e[53],e[54]===Symbol.for("react.memo_cache_sentinel")?(j=C.jsx("div",{className:"flex-1"}),e[54]=j):j=e[54];const R=g&&"bg-[var(--sky-3)] rounded-none";let L,F;e[55]!==R?(L=hn(R),e[55]=R,e[56]=L):L=e[56],e[57]!==y||e[58]!==g?(F=()=>y(!g),e[57]=y,e[58]=g,e[59]=F):F=e[59];const B=0===v.length;let U,V;e[60]===Symbol.for("react.memo_cache_sentinel")?(U=C.jsx(Tc,{size:16}),e[60]=U):U=e[60],e[61]!==L||e[62]!==F||e[63]!==B?(V=C.jsx(et,{content:"Toggle history",children:C.jsx(W,{size:"xs",variant:"text",className:L,onClick:F,disabled:B,children:U})}),e[61]=L,e[62]=F,e[63]=B,e[64]=V):V=e[64],e[65]!==f||e[66]!==x||e[67]!==S||e[68]!==N||e[69]!==V?(P=C.jsxs("div",{className:"flex items-center flex-shrink-0",children:[f,x,S,N,j,V]}),e[65]=f,e[66]=x,e[67]=S,e[68]=N,e[69]=V,e[70]=P):P=e[70],A="flex-1 divide-y relative overflow-hidden flex flex-col",M=t(),z=i(),e[12]=o,e[13]=m,e[14]=b,e[15]=l,e[16]=n,e[17]=I,e[18]=d,e[19]=h,e[20]=g,e[21]=v,e[22]=_,e[23]=E,e[24]=k,e[25]=u,e[26]=y,e[27]=A,e[28]=M,e[29]=O,e[30]=D,e[31]=P,e[32]=z}else A=e[27],M=e[28],O=e[29],D=e[30],P=e[31],z=e[32];return e[71]!==A||e[72]!==M||e[73]!==z?(F=C.jsxs("div",{className:A,children:[M,z]}),e[71]=A,e[72]=M,e[73]=z,e[74]=F):F=e[74],e[75]!==O||e[76]!==D||e[77]!==P||e[78]!==F?(B=C.jsxs("div",{className:O,id:D,children:[P,F]}),e[75]=O,e[76]=D,e[77]=P,e[78]=F,e[79]=B):B=e[79],B},ZO=()=>{const e=S(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=C.jsx(JO,{}),e[0]=t):t=e[0],t},QO=()=>{const e=S(16),[t]=_e(),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:i,reload:s}=dn(oD,o);if(a&&!r){let t;return e[2]===Symbol.for("react.memo_cache_sentinel")?(t=C.jsx(pi,{size:"medium",centered:!0}),e[2]=t):t=e[2],t}if(i){let t;return e[3]!==i?(t=C.jsx(Qi,{error:i}),e[3]=i,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]!==s?(d=C.jsx(eD,{packageManager:n,onSuccess:s}),e[7]=n,e[8]=s,e[9]=d):d=e[9],e[10]!==c||e[11]!==s?(u=C.jsx(tD,{packages:c,onSuccess:s}),e[10]=c,e[11]=s,e[12]=u):u=e[12],e[13]!==d||e[14]!==u?(h=C.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},eD=({onSuccess:e,packageManager:t})=>{const[n,o]=u.useState(""),[r,a]=u.useState(!1),i=async()=>{try{a(!0);const t=await Ts({package:n});t.success?(e(),K({title:"Package added",description:C.jsxs("span",{children:["The package ",C.jsx(oi,{className:"inline",children:n})," and its dependencies has been added to your environment."]})})):K({title:"Failed to add package",description:t.error,variant:"danger"})}finally{o(""),a(!1)}};return C.jsxs("div",{className:"flex items-center w-full border-b",children:[C.jsx(Fi,{placeholder:`Install packages with ${t}...`,id:Bg,icon:r?C.jsx(pi,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):C.jsx(cc,{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(),i())},onChange:e=>o(e.target.value)}),C.jsx(et,{delayDuration:300,side:"left",align:"start",content:C.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:",C.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[C.jsxs("div",{children:[C.jsx("span",{className:"font-bold tracking-wide",children:"Package name:"})," A package name; this will install the latest version.",C.jsx("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),C.jsxs("div",{children:[C.jsx("span",{className:"font-bold tracking-wide",children:"Package and version:"})," ","A package with a specific version or version range.",C.jsx("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),C.jsxs("div",{children:[C.jsx("span",{className:"font-bold tracking-wide",children:"Git:"})," A Git repository",C.jsx("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),C.jsxs("div",{children:[C.jsx("span",{className:"font-bold tracking-wide",children:"URL:"})," A remote wheel or source distribution.",C.jsx("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),C.jsxs("div",{children:[C.jsx("span",{className:"font-bold tracking-wide",children:"Path:"})," A local wheel, source distribution, or project directory.",C.jsx("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:C.jsx(_s,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),C.jsx("button",{type:"button",className:hn("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:i,disabled:!n,children:"Add"})]})},tD=e=>{const t=S(9),{onSuccess:n,packages:o}=e;if(0===o.length){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=C.jsx(SN,{title:"No packages",description:"No packages are installed in this environment.",icon:C.jsx(cc,{})}),t[0]=e):e=t[0],e}let r,a,i;if(t[1]===Symbol.for("react.memo_cache_sentinel")?(r=C.jsx(Ui,{children:C.jsxs(Vi,{children:[C.jsx(Hi,{children:"Name"}),C.jsx(Hi,{children:"Version"}),C.jsx(Hi,{})]})}),t[1]=r):r=t[1],t[2]!==n||t[3]!==o){let e;t[5]!==n?(e=e=>C.jsxs(Vi,{className:"group",onClick:async()=>{await Je(`${e.name}==${e.version}`),K({title:"Copied to clipboard"})},children:[C.jsx(Gi,{children:e.name}),C.jsx(Gi,{children:e.version}),C.jsx(Gi,{children:C.jsx(nD,{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?(i=C.jsxs(Bi,{className:"overflow-auto flex-1",children:[r,C.jsx(Wi,{children:a})]}),t[7]=a,t[8]=i):i=t[8],i},nD=({packageName:e,onSuccess:t})=>{const[n,o]=u.useState(!1);return n?C.jsx(pi,{size:"small",className:"float-right mr-2 h-4 w-4 shrink-0 opacity-50"}):C.jsx("button",{type:"button",className:hn("float-right px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible"),onClick:Ze.stopPropagation((async()=>{try{o(!0);const n=await As({package:e});n.success?(t(),K({title:"Package removed",description:C.jsxs("span",{children:["The package ",C.jsx(oi,{className:"inline",children:e})," has been removed from your environment."]})})):K({title:"Failed to add package",description:n.error,variant:"danger"})}finally{o(!1)}})),children:"Remove"})};function oD(){return Is()}function rD(...e){return t=>e.forEach((e=>function(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}(e,t)))}function aD(...e){return r.useCallback(rD(...e),e)}var iD=r.forwardRef(((e,t)=>{const{children:n,...o}=e,a=r.Children.toArray(n),i=a.find(cD);if(i){const e=i.props.children,n=a.map((t=>t===i?r.Children.count(e)>1?r.Children.only(null):r.isValidElement(e)?e.props.children:null:t));return C.jsx(sD,{...o,ref:t,children:r.isValidElement(e)?r.cloneElement(e,void 0,n):null})}return C.jsx(sD,{...o,ref:t,children:n})}));iD.displayName="Slot";var sD=r.forwardRef(((e,t)=>{const{children:n,...o}=e;if(r.isValidElement(n)){const e=function(e){var t,n;let o=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,r=o&&"isReactWarning"in o&&o.isReactWarning;if(r)return e.ref;if(o=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,r=o&&"isReactWarning"in o&&o.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(n);return r.cloneElement(n,{...dD(o,n.props),ref:t?rD(t,e):e})}return r.Children.count(n)>1?r.Children.only(null):null}));sD.displayName="SlotClone";var lD=({children:e})=>C.jsx(C.Fragment,{children:e});function cD(e){return r.isValidElement(e)&&e.type===lD}function dD(e,t){const n={...t};for(const o in t){const r=e[o],a=t[o];/^on[A-Z]/.test(o)?r&&a?n[o]=(...e)=>{a(...e),r(...e)}:r&&(n[o]=r):"style"===o?n[o]={...r,...a}:"className"===o&&(n[o]=[r,a].filter(Boolean).join(" "))}return{...e,...n}}var uD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce(((e,t)=>{const n=r.forwardRef(((e,n)=>{const{asChild:o,...r}=e,a=o?iD:t;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),C.jsx(a,{...r,ref:n})}));return n.displayName=`Primitive.${t}`,{...e,[t]:n}}),{}),hD=Boolean(null==globalThis?void 0:globalThis.document)?r.useLayoutEffect:()=>{};var fD=e=>{const{present:t,children:n}=e,o=function(e){const[t,n]=r.useState(),o=r.useRef({}),a=r.useRef(e),i=r.useRef("none"),s=e?"mounted":"unmounted",[l,c]=function(e,t){return r.useReducer(((e,n)=>t[e][n]??e),e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return r.useEffect((()=>{const e=mD(o.current);i.current="mounted"===l?e:"none"}),[l]),hD((()=>{const t=o.current,n=a.current;if(n!==e){const o=i.current,r=mD(t);if(e)c("MOUNT");else if("none"===r||"none"===(null==t?void 0:t.display))c("UNMOUNT");else{c(n&&o!==r?"ANIMATION_OUT":"UNMOUNT")}a.current=e}}),[e,c]),hD((()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,r=r=>{const i=mD(o.current).includes(r.animationName);if(r.target===t&&i&&(c("ANIMATION_END"),!a.current)){const o=t.style.animationFillMode;t.style.animationFillMode="forwards",e=n.setTimeout((()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=o)}))}},s=e=>{e.target===t&&(i.current=mD(o.current))};return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",r),t.addEventListener("animationend",r),()=>{n.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",r),t.removeEventListener("animationend",r)}}c("ANIMATION_END")}),[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:r.useCallback((e=>{e&&(o.current=getComputedStyle(e)),n(e)}),[])}}(t),a="function"==typeof n?n({present:o.isPresent}):r.Children.only(n),i=aD(o.ref,function(e){var t,n;let o=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,r=o&&"isReactWarning"in o&&o.isReactWarning;if(r)return e.ref;if(o=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,r=o&&"isReactWarning"in o&&o.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(a));return"function"==typeof n||o.isPresent?r.cloneElement(a,{ref:i}):null};function mD(e){return(null==e?void 0:e.animationName)||"none"}function pD(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const o=n.reduce(((t,{useScope:n,scopeName:o})=>({...t,...n(e)[`__scope${o}`]})),{});return r.useMemo((()=>({[`__scope${t.scopeName}`]:o})),[o])}};return n.scopeName=t.scopeName,n}function gD(e){const t=r.useRef(e);return r.useEffect((()=>{t.current=e})),r.useMemo((()=>(...e)=>{var n;return null==(n=t.current)?void 0:n.call(t,...e)}),[])}fD.displayName="Presence";var yD=r.createContext(void 0);function vD(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(null==e||e(o),!1===n||!o.defaultPrevented)return null==t?void 0:t(o)}}var xD="ScrollArea",[bD,wD]=function(e,t=[]){let n=[];const o=()=>{const t=n.map((e=>r.createContext(e)));return function(n){const o=(null==n?void 0:n[e])||t;return r.useMemo((()=>({[`__scope${e}`]:{...n,[e]:o}})),[n,o])}};return o.scopeName=e,[function(t,o){const a=r.createContext(o),i=n.length;n=[...n,o];const s=t=>{var n;const{scope:o,children:s,...l}=t,c=(null==(n=null==o?void 0:o[e])?void 0:n[i])||a,d=r.useMemo((()=>l),Object.values(l));return C.jsx(c.Provider,{value:d,children:s})};return s.displayName=t+"Provider",[s,function(n,s){var l;const c=(null==(l=null==s?void 0:s[e])?void 0:l[i])||a,d=r.useContext(c);if(d)return d;if(void 0!==o)return o;throw new Error(`\`${n}\` must be used within \`${t}\``)}]},pD(o,...t)]}(xD),[kD,SD]=bD(xD),ND=r.forwardRef(((e,t)=>{const{__scopeScrollArea:n,type:o="hover",dir:a,scrollHideDelay:i=600,...s}=e,[l,c]=r.useState(null),[d,u]=r.useState(null),[h,f]=r.useState(null),[m,p]=r.useState(null),[g,y]=r.useState(null),[v,x]=r.useState(0),[b,w]=r.useState(0),[k,S]=r.useState(!1),[N,E]=r.useState(!1),j=aD(t,(e=>c(e))),_=function(e){const t=r.useContext(yD);return e||t||"ltr"}(a);return C.jsx(kD,{scope:n,type:o,dir:_,scrollHideDelay:i,scrollArea:l,viewport:d,onViewportChange:u,content:h,onContentChange:f,scrollbarX:m,onScrollbarXChange:p,scrollbarXEnabled:k,onScrollbarXEnabledChange:S,scrollbarY:g,onScrollbarYChange:y,scrollbarYEnabled:N,onScrollbarYEnabledChange:E,onCornerWidthChange:x,onCornerHeightChange:w,children:C.jsx(uD.div,{dir:_,...s,ref:j,style:{position:"relative","--radix-scroll-area-corner-width":v+"px","--radix-scroll-area-corner-height":b+"px",...e.style}})})}));ND.displayName=xD;var CD="ScrollAreaViewport",ED=r.forwardRef(((e,t)=>{const{__scopeScrollArea:n,children:o,nonce:a,...i}=e,s=SD(CD,n),l=aD(t,r.useRef(null),s.onViewportChange);return C.jsxs(C.Fragment,{children:[C.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),C.jsx(uD.div,{"data-radix-scroll-area-viewport":"",...i,ref:l,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style},children:C.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})}));ED.displayName=CD;var jD="ScrollAreaScrollbar",_D=r.forwardRef(((e,t)=>{const{forceMount:n,...o}=e,a=SD(jD,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=a,l="horizontal"===e.orientation;return r.useEffect((()=>(l?i(!0):s(!0),()=>{l?i(!1):s(!1)})),[l,i,s]),"hover"===a.type?C.jsx(ID,{...o,ref:t,forceMount:n}):"scroll"===a.type?C.jsx(TD,{...o,ref:t,forceMount:n}):"auto"===a.type?C.jsx(AD,{...o,ref:t,forceMount:n}):"always"===a.type?C.jsx(MD,{...o,ref:t}):null}));_D.displayName=jD;var ID=r.forwardRef(((e,t)=>{const{forceMount:n,...o}=e,a=SD(jD,e.__scopeScrollArea),[i,s]=r.useState(!1);return r.useEffect((()=>{const e=a.scrollArea;let t=0;if(e){const n=()=>{window.clearTimeout(t),s(!0)},o=()=>{t=window.setTimeout((()=>s(!1)),a.scrollHideDelay)};return e.addEventListener("pointerenter",n),e.addEventListener("pointerleave",o),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",n),e.removeEventListener("pointerleave",o)}}}),[a.scrollArea,a.scrollHideDelay]),C.jsx(fD,{present:n||i,children:C.jsx(AD,{"data-state":i?"visible":"hidden",...o,ref:t})})})),TD=r.forwardRef(((e,t)=>{const{forceMount:n,...o}=e,a=SD(jD,e.__scopeScrollArea),i="horizontal"===e.orientation,s=JD((()=>c("SCROLL_END")),100),[l,c]=(d="hidden",u={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},r.useReducer(((e,t)=>u[e][t]??e),d));var d,u;return r.useEffect((()=>{if("idle"===l){const e=window.setTimeout((()=>c("HIDE")),a.scrollHideDelay);return()=>window.clearTimeout(e)}}),[l,a.scrollHideDelay,c]),r.useEffect((()=>{const e=a.viewport,t=i?"scrollLeft":"scrollTop";if(e){let n=e[t];const o=()=>{const o=e[t];n!==o&&(c("SCROLL"),s()),n=o};return e.addEventListener("scroll",o),()=>e.removeEventListener("scroll",o)}}),[a.viewport,i,c,s]),C.jsx(fD,{present:n||"hidden"!==l,children:C.jsx(MD,{"data-state":"hidden"===l?"hidden":"visible",...o,ref:t,onPointerEnter:vD(e.onPointerEnter,(()=>c("POINTER_ENTER"))),onPointerLeave:vD(e.onPointerLeave,(()=>c("POINTER_LEAVE")))})})})),AD=r.forwardRef(((e,t)=>{const n=SD(jD,e.__scopeScrollArea),{forceMount:o,...a}=e,[i,s]=r.useState(!1),l="horizontal"===e.orientation,c=JD((()=>{if(n.viewport){const e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;s(l?e:t)}}),10);return ZD(n.viewport,c),ZD(n.content,c),C.jsx(fD,{present:o||i,children:C.jsx(MD,{"data-state":i?"visible":"hidden",...a,ref:t})})})),MD=r.forwardRef(((e,t)=>{const{orientation:n="vertical",...o}=e,a=SD(jD,e.__scopeScrollArea),i=r.useRef(null),s=r.useRef(0),[l,c]=r.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=WD(l.viewport,l.content),u={...o,sizes:l,onSizesChange:c,hasThumb:Boolean(d>0&&d<1),onThumbChange:e=>i.current=e,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:e=>s.current=e};function h(e,t){return function(e,t,n,o="ltr"){const r=GD(n),a=r/2,i=t||a,s=r-i,l=n.scrollbar.paddingStart+i,c=n.scrollbar.size-n.scrollbar.paddingEnd-s,d=n.content-n.viewport,u="ltr"===o?[0,d]:[-1*d,0];return YD([l,c],u)(e)}(e,s.current,l,t)}return"horizontal"===n?C.jsx(OD,{...u,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const e=qD(a.viewport.scrollLeft,l,a.dir);i.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{a.viewport&&(a.viewport.scrollLeft=e)},onDragScroll:e=>{a.viewport&&(a.viewport.scrollLeft=h(e,a.dir))}}):"vertical"===n?C.jsx(DD,{...u,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const e=qD(a.viewport.scrollTop,l);i.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{a.viewport&&(a.viewport.scrollTop=e)},onDragScroll:e=>{a.viewport&&(a.viewport.scrollTop=h(e))}}):null})),OD=r.forwardRef(((e,t)=>{const{sizes:n,onSizesChange:o,...a}=e,i=SD(jD,e.__scopeScrollArea),[s,l]=r.useState(),c=r.useRef(null),d=aD(t,c,i.onScrollbarXChange);return r.useEffect((()=>{c.current&&l(getComputedStyle(c.current))}),[c]),C.jsx(LD,{"data-orientation":"horizontal",...a,ref:d,sizes:n,style:{bottom:0,left:"rtl"===i.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===i.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":GD(n)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(i.viewport){const o=i.viewport.scrollLeft+t.deltaX;e.onWheelScroll(o),XD(o,n)&&t.preventDefault()}},onResize:()=>{c.current&&i.viewport&&s&&o({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:$D(s.paddingLeft),paddingEnd:$D(s.paddingRight)}})}})})),DD=r.forwardRef(((e,t)=>{const{sizes:n,onSizesChange:o,...a}=e,i=SD(jD,e.__scopeScrollArea),[s,l]=r.useState(),c=r.useRef(null),d=aD(t,c,i.onScrollbarYChange);return r.useEffect((()=>{c.current&&l(getComputedStyle(c.current))}),[c]),C.jsx(LD,{"data-orientation":"vertical",...a,ref:d,sizes:n,style:{top:0,right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":GD(n)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(i.viewport){const o=i.viewport.scrollTop+t.deltaY;e.onWheelScroll(o),XD(o,n)&&t.preventDefault()}},onResize:()=>{c.current&&i.viewport&&s&&o({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:$D(s.paddingTop),paddingEnd:$D(s.paddingBottom)}})}})})),[PD,RD]=bD(jD),LD=r.forwardRef(((e,t)=>{const{__scopeScrollArea:n,sizes:o,hasThumb:a,onThumbChange:i,onThumbPointerUp:s,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:d,onWheelScroll:u,onResize:h,...f}=e,m=SD(jD,n),[p,g]=r.useState(null),y=aD(t,(e=>g(e))),v=r.useRef(null),x=r.useRef(""),b=m.viewport,w=o.content-o.viewport,k=gD(u),S=gD(c),N=JD(h,10);function E(e){if(v.current){const t=e.clientX-v.current.left,n=e.clientY-v.current.top;d({x:t,y:n})}}return r.useEffect((()=>{const e=e=>{const t=e.target;(null==p?void 0:p.contains(t))&&k(e,w)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})}),[b,p,w,k]),r.useEffect(S,[o,S]),ZD(p,N),ZD(m.content,N),C.jsx(PD,{scope:n,scrollbar:p,hasThumb:a,onThumbChange:gD(i),onThumbPointerUp:gD(s),onThumbPositionChange:S,onThumbPointerDown:gD(l),children:C.jsx(uD.div,{...f,ref:y,style:{position:"absolute",...f.style},onPointerDown:vD(e.onPointerDown,(e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),v.current=p.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),E(e)}})),onPointerMove:vD(e.onPointerMove,E),onPointerUp:vD(e.onPointerUp,(e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=x.current,m.viewport&&(m.viewport.style.scrollBehavior=""),v.current=null}))})})})),zD="ScrollAreaThumb",FD=r.forwardRef(((e,t)=>{const{forceMount:n,...o}=e,r=RD(zD,e.__scopeScrollArea);return C.jsx(fD,{present:n||r.hasThumb,children:C.jsx(BD,{ref:t,...o})})})),BD=r.forwardRef(((e,t)=>{const{__scopeScrollArea:n,style:o,...a}=e,i=SD(zD,n),s=RD(zD,n),{onThumbPositionChange:l}=s,c=aD(t,(e=>s.onThumbChange(e))),d=r.useRef(),u=JD((()=>{d.current&&(d.current(),d.current=void 0)}),100);return r.useEffect((()=>{const e=i.viewport;if(e){const t=()=>{if(u(),!d.current){const t=KD(e,l);d.current=t,l()}};return l(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}}),[i.viewport,u,l]),C.jsx(uD.div,{"data-state":s.hasThumb?"visible":"hidden",...a,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:vD(e.onPointerDownCapture,(e=>{const t=e.target.getBoundingClientRect(),n=e.clientX-t.left,o=e.clientY-t.top;s.onThumbPointerDown({x:n,y:o})})),onPointerUp:vD(e.onPointerUp,s.onThumbPointerUp)})}));FD.displayName=zD;var UD="ScrollAreaCorner",VD=r.forwardRef(((e,t)=>{const n=SD(UD,e.__scopeScrollArea),o=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&o?C.jsx(HD,{...e,ref:t}):null}));VD.displayName=UD;var HD=r.forwardRef(((e,t)=>{const{__scopeScrollArea:n,...o}=e,a=SD(UD,n),[i,s]=r.useState(0),[l,c]=r.useState(0),d=Boolean(i&&l);return ZD(a.scrollbarX,(()=>{var e;const t=(null==(e=a.scrollbarX)?void 0:e.offsetHeight)||0;a.onCornerHeightChange(t),c(t)})),ZD(a.scrollbarY,(()=>{var e;const t=(null==(e=a.scrollbarY)?void 0:e.offsetWidth)||0;a.onCornerWidthChange(t),s(t)})),d?C.jsx(uD.div,{...o,ref:t,style:{width:i,height:l,position:"absolute",right:"ltr"===a.dir?0:void 0,left:"rtl"===a.dir?0:void 0,bottom:0,...e.style}}):null}));function $D(e){return e?parseInt(e,10):0}function WD(e,t){const n=e/t;return isNaN(n)?0:n}function GD(e){const t=WD(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=(e.scrollbar.size-n)*t;return Math.max(o,18)}function qD(e,t,n="ltr"){const o=GD(t),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-r,i=t.content-t.viewport,s=a-o,l=function(e,[t,n]){return Math.min(n,Math.max(t,e))}(e,"ltr"===n?[0,i]:[-1*i,0]);return YD([0,i],[0,s])(l)}function YD(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const o=(t[1]-t[0])/(e[1]-e[0]);return t[0]+o*(n-e[0])}}function XD(e,t){return e>0&&e<t}var KD=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},o=0;return function r(){const a={left:e.scrollLeft,top:e.scrollTop},i=n.left!==a.left,s=n.top!==a.top;(i||s)&&t(),n=a,o=window.requestAnimationFrame(r)}(),()=>window.cancelAnimationFrame(o)};function JD(e,t){const n=gD(e),o=r.useRef(0);return r.useEffect((()=>()=>window.clearTimeout(o.current)),[]),r.useCallback((()=>{window.clearTimeout(o.current),o.current=window.setTimeout(n,t)}),[n,t])}function ZD(e,t){const n=gD(t);hD((()=>{let t=0;if(e){const o=new ResizeObserver((()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)}));return o.observe(e),()=>{window.cancelAnimationFrame(t),o.unobserve(e)}}}),[e,n])}var QD=ND,eP=ED,tP=VD;const nP=r.forwardRef(((e,t)=>{const n=S(15);let o,r,a,i,s,l,c,d;return n[0]!==e?(({className:o,children: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?(i=hn("relative overflow-hidden",o),n[4]=o,n[5]=i):i=n[5],n[6]!==r?(s=C.jsx(eP,{className:"h-full w-full rounded-[inherit]",children:r}),n[6]=r,n[7]=s):s=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(l=C.jsx(oP,{}),c=C.jsx(tP,{}),n[8]=l,n[9]=c):(l=n[8],c=n[9]),n[10]!==t||n[11]!==i||n[12]!==a||n[13]!==s?(d=C.jsxs(QD,{ref:t,className:i,...a,children:[s,l,c]}),n[10]=t,n[11]=i,n[12]=a,n[13]=s,n[14]=d):d=n[14],d}));nP.displayName=QD.displayName;const oP=r.forwardRef(((e,t)=>{const n=S(14);let o,r,a;n[0]!==e?(({className:r,orientation:o,...a}=e),n[0]=e,n[1]=o,n[2]=r,n[3]=a):(o=n[1],r=n[2],a=n[3]);const i=void 0===o?"vertical":o,s="vertical"===i&&"h-full w-2.5 border-l border-l-transparent p-[1px]",l="horizontal"===i&&"h-2.5 flex-col border-t border-t-transparent p-[1px]";let c,d,u;return n[4]!==s||n[5]!==l||n[6]!==r?(c=hn("flex touch-none select-none transition-colors",s,l,r),n[4]=s,n[5]=l,n[6]=r,n[7]=c):c=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(d=C.jsx(FD,{className:"relative flex-1 rounded-full bg-border"}),n[8]=d):d=n[8],n[9]!==t||n[10]!==i||n[11]!==c||n[12]!==a?(u=C.jsx(_D,{ref:t,orientation:i,className:c,...a,children:d}),n[9]=t,n[10]=i,n[11]=c,n[12]=a,n[13]=u):u=n[13],u}));oP.displayName=_D.displayName;const rP=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,aP=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,iP={};function sP(e,t){return(iP.jsx?aP:rP).test(e)}const lP=/[ \t\n\f\r]/g;function cP(e){return""===e.replace(lP,"")}class dP{constructor(e,t,n){this.property=e,this.normal=t,n&&(this.space=n)}}function uP(e,t){const n={},o={};let r=-1;for(;++r<e.length;)Object.assign(n,e[r].property),Object.assign(o,e[r].normal);return new dP(n,o,t)}function hP(e){return e.toLowerCase()}dP.prototype.property={},dP.prototype.normal={},dP.prototype.space=null;class fP{constructor(e,t){this.property=e,this.attribute=t}}fP.prototype.space=null,fP.prototype.boolean=!1,fP.prototype.booleanish=!1,fP.prototype.overloadedBoolean=!1,fP.prototype.number=!1,fP.prototype.commaSeparated=!1,fP.prototype.spaceSeparated=!1,fP.prototype.commaOrSpaceSeparated=!1,fP.prototype.mustUseProperty=!1,fP.prototype.defined=!1;let mP=0;const pP=kP(),gP=kP(),yP=kP(),vP=kP(),xP=kP(),bP=kP(),wP=kP();function kP(){return 2**++mP}const SP=Object.freeze(Object.defineProperty({__proto__:null,boolean:pP,booleanish:gP,commaOrSpaceSeparated:wP,commaSeparated:bP,number:vP,overloadedBoolean:yP,spaceSeparated:xP},Symbol.toStringTag,{value:"Module"})),NP=Object.keys(SP);class CP extends fP{constructor(e,t,n,o){let r=-1;if(super(e,t),EP(this,"space",o),"number"==typeof n)for(;++r<NP.length;){const e=NP[r];EP(this,NP[r],(n&SP[e])===SP[e])}}}function EP(e,t,n){n&&(e[t]=n)}CP.prototype.defined=!0;const jP={}.hasOwnProperty;function _P(e){const t={},n={};let o;for(o in e.properties)if(jP.call(e.properties,o)){const r=e.properties[o],a=new CP(o,e.transform(e.attributes||{},o),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(o)&&(a.mustUseProperty=!0),t[o]=a,n[hP(o)]=o,n[hP(a.attribute)]=o}return new dP(t,n,e.space)}const IP=_P({space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase(),properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),TP=_P({space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase(),properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function AP(e,t){return t in e?e[t]:t}function MP(e,t){return AP(e,t.toLowerCase())}const OP=_P({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:MP,properties:{xmlns:null,xmlnsXLink:null}}),DP=_P({transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase(),properties:{ariaActiveDescendant:null,ariaAtomic:gP,ariaAutoComplete:null,ariaBusy:gP,ariaChecked:gP,ariaColCount:vP,ariaColIndex:vP,ariaColSpan:vP,ariaControls:xP,ariaCurrent:null,ariaDescribedBy:xP,ariaDetails:null,ariaDisabled:gP,ariaDropEffect:xP,ariaErrorMessage:null,ariaExpanded:gP,ariaFlowTo:xP,ariaGrabbed:gP,ariaHasPopup:null,ariaHidden:gP,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:xP,ariaLevel:vP,ariaLive:null,ariaModal:gP,ariaMultiLine:gP,ariaMultiSelectable:gP,ariaOrientation:null,ariaOwns:xP,ariaPlaceholder:null,ariaPosInSet:vP,ariaPressed:gP,ariaReadOnly:gP,ariaRelevant:null,ariaRequired:gP,ariaRoleDescription:xP,ariaRowCount:vP,ariaRowIndex:vP,ariaRowSpan:vP,ariaSelected:gP,ariaSetSize:vP,ariaSort:null,ariaValueMax:vP,ariaValueMin:vP,ariaValueNow:vP,ariaValueText:null,role:null}}),PP=_P({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:MP,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:bP,acceptCharset:xP,accessKey:xP,action:null,allow:null,allowFullScreen:pP,allowPaymentRequest:pP,allowUserMedia:pP,alt:null,as:null,async:pP,autoCapitalize:null,autoComplete:xP,autoFocus:pP,autoPlay:pP,blocking:xP,capture:null,charSet:null,checked:pP,cite:null,className:xP,cols:vP,colSpan:null,content:null,contentEditable:gP,controls:pP,controlsList:xP,coords:vP|bP,crossOrigin:null,data:null,dateTime:null,decoding:null,default:pP,defer:pP,dir:null,dirName:null,disabled:pP,download:yP,draggable:gP,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:pP,formTarget:null,headers:xP,height:vP,hidden:pP,high:vP,href:null,hrefLang:null,htmlFor:xP,httpEquiv:xP,id:null,imageSizes:null,imageSrcSet:null,inert:pP,inputMode:null,integrity:null,is:null,isMap:pP,itemId:null,itemProp:xP,itemRef:xP,itemScope:pP,itemType:xP,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:pP,low:vP,manifest:null,max:null,maxLength:vP,media:null,method:null,min:null,minLength:vP,multiple:pP,muted:pP,name:null,nonce:null,noModule:pP,noValidate:pP,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:pP,optimum:vP,pattern:null,ping:xP,placeholder:null,playsInline:pP,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:pP,referrerPolicy:null,rel:xP,required:pP,reversed:pP,rows:vP,rowSpan:vP,sandbox:xP,scope:null,scoped:pP,seamless:pP,selected:pP,shadowRootClonable:pP,shadowRootDelegatesFocus:pP,shadowRootMode:null,shape:null,size:vP,sizes:null,slot:null,span:vP,spellCheck:gP,src:null,srcDoc:null,srcLang:null,srcSet:null,start:vP,step:null,style:null,tabIndex:vP,target:null,title:null,translate:null,type:null,typeMustMatch:pP,useMap:null,value:gP,width:vP,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:xP,axis:null,background:null,bgColor:null,border:vP,borderColor:null,bottomMargin:vP,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:pP,declare:pP,event:null,face:null,frame:null,frameBorder:null,hSpace:vP,leftMargin:vP,link:null,longDesc:null,lowSrc:null,marginHeight:vP,marginWidth:vP,noResize:pP,noHref:pP,noShade:pP,noWrap:pP,object:null,profile:null,prompt:null,rev:null,rightMargin:vP,rules:null,scheme:null,scrolling:gP,standby:null,summary:null,text:null,topMargin:vP,valueType:null,version:null,vAlign:null,vLink:null,vSpace:vP,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:pP,disableRemotePlayback:pP,prefix:null,property:null,results:vP,security:null,unselectable:null}}),RP=_P({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:AP,properties:{about:wP,accentHeight:vP,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:vP,amplitude:vP,arabicForm:null,ascent:vP,attributeName:null,attributeType:null,azimuth:vP,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:vP,by:null,calcMode:null,capHeight:vP,className:xP,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:vP,diffuseConstant:vP,direction:null,display:null,dur:null,divisor:vP,dominantBaseline:null,download:pP,dx:null,dy:null,edgeMode:null,editable:null,elevation:vP,enableBackground:null,end:null,event:null,exponent:vP,externalResourcesRequired:null,fill:null,fillOpacity:vP,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:bP,g2:bP,glyphName:bP,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:vP,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:vP,horizOriginX:vP,horizOriginY:vP,id:null,ideographic:vP,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:vP,k:vP,k1:vP,k2:vP,k3:vP,k4:vP,kernelMatrix:wP,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:vP,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:vP,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:vP,overlineThickness:vP,paintOrder:null,panose1:null,path:null,pathLength:vP,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:xP,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:vP,pointsAtY:vP,pointsAtZ:vP,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:wP,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:wP,rev:wP,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:wP,requiredFeatures:wP,requiredFonts:wP,requiredFormats:wP,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:vP,specularExponent:vP,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:vP,strikethroughThickness:vP,string:null,stroke:null,strokeDashArray:wP,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:vP,strokeOpacity:vP,strokeWidth:null,style:null,surfaceScale:vP,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:wP,tabIndex:vP,tableValues:null,target:null,targetX:vP,targetY:vP,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:wP,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:vP,underlineThickness:vP,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:vP,values:null,vAlphabetic:vP,vMathematical:vP,vectorEffect:null,vHanging:vP,vIdeographic:vP,version:null,vertAdvY:vP,vertOriginX:vP,vertOriginY:vP,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:vP,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),LP=/^data[-\w.:]+$/i,zP=/-[a-z]/g,FP=/[A-Z]/g;function BP(e){return"-"+e.toLowerCase()}function UP(e){return e.charAt(1).toUpperCase()}const VP={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},HP=uP([TP,IP,OP,DP,PP],"html"),$P=uP([TP,IP,OP,DP,RP],"svg");const WP=Ms.default||Ms,GP=YP("end"),qP=YP("start");function YP(e){return function(t){const n=t&&t.position&&t.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function XP(e){return e&&"object"==typeof e?"position"in e||"type"in e?JP(e.position):"start"in e||"end"in e?JP(e):"line"in e||"column"in e?KP(e):"":""}function KP(e){return ZP(e&&e.line)+":"+ZP(e&&e.column)}function JP(e){return KP(e&&e.start)+"-"+KP(e&&e.end)}function ZP(e){return e&&"number"==typeof e?e:1}class QP extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let o="",r={},a=!1;if(t&&(r="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?o=e:!r.cause&&e&&(a=!0,o=e.message,r.cause=e),!r.ruleId&&!r.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?r.ruleId=n:(r.source=n.slice(0,e),r.ruleId=n.slice(e+1))}if(!r.place&&r.ancestors&&r.ancestors){const e=r.ancestors[r.ancestors.length-1];e&&(r.place=e.position)}const i=r.place&&"start"in r.place?r.place.start:r.place;this.ancestors=r.ancestors||void 0,this.cause=r.cause||void 0,this.column=i?i.column:void 0,this.fatal=void 0,this.file,this.message=o,this.line=i?i.line:void 0,this.name=XP(r.place)||"1:1",this.place=r.place||void 0,this.reason=this.message,this.ruleId=r.ruleId||void 0,this.source=r.source||void 0,this.stack=a&&r.cause&&"string"==typeof r.cause.stack?r.cause.stack:"",this.actual,this.expected,this.note,this.url}}QP.prototype.file="",QP.prototype.name="",QP.prototype.reason="",QP.prototype.message="",QP.prototype.stack="",QP.prototype.column=void 0,QP.prototype.line=void 0,QP.prototype.ancestors=void 0,QP.prototype.cause=void 0,QP.prototype.fatal=void 0,QP.prototype.place=void 0,QP.prototype.ruleId=void 0,QP.prototype.source=void 0;const eR={}.hasOwnProperty,tR=new Map,nR=/[A-Z]/g,oR=/-([a-z])/g,rR=new Set(["table","tbody","thead","tfoot","tr"]),aR=new Set(["td","th"]),iR="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function sR(e,t){if(!t||void 0===t.Fragment)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let o;if(t.development){if("function"!=typeof t.jsxDEV)throw new TypeError("Expected `jsxDEV` in options when `development: true`");o=function(e,t){return n;function n(n,o,r,a){const i=Array.isArray(r.children),s=qP(n);return t(o,r,a,i,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}(n,t.jsxDEV)}else{if("function"!=typeof t.jsx)throw new TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw new TypeError("Expected `jsxs` in production options");o=function(e,t,n){return o;function o(e,o,r,a){const i=Array.isArray(r.children)?n:t;return a?i(o,r,a):i(o,r)}}(0,t.jsx,t.jsxs)}const r={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:o,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?$P:HP,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},a=lR(r,e,void 0);return a&&"string"!=typeof a?a:r.create(e,r.Fragment,{children:a||void 0},void 0)}function lR(e,t,n){return"element"===t.type?function(e,t,n){const o=e.schema;let r=o;"svg"===t.tagName.toLowerCase()&&"html"===o.space&&(r=$P,e.schema=r);e.ancestors.push(t);const a=fR(e,t.tagName,!1),i=function(e,t){const n={};let o,r;for(r in t.properties)if("children"!==r&&eR.call(t.properties,r)){const a=hR(e,r,t.properties[r]);if(a){const[r,i]=a;e.tableCellAlignToStyle&&"align"===r&&"string"==typeof i&&aR.has(t.tagName)?o=i:n[r]=i}}if(o){(n.style||(n.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=o}return n}(e,t);let s=uR(e,t);rR.has(t.tagName)&&(s=s.filter((function(e){return"string"!=typeof e||!("object"==typeof(t=e)?"text"===t.type&&cP(t.value):cP(t));var t})));return cR(e,i,a,t),dR(i,s),e.ancestors.pop(),e.schema=o,e.create(t,a,i,n)}(e,t,n):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}mR(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?function(e,t,n){const o=e.schema;let r=o;"svg"===t.name&&"html"===o.space&&(r=$P,e.schema=r);e.ancestors.push(t);const a=null===t.name?e.Fragment:fR(e,t.name,!0),i=function(e,t){const n={};for(const o of t.attributes)if("mdxJsxExpressionAttribute"===o.type)if(o.data&&o.data.estree&&e.evaluater){const t=o.data.estree.body[0];t.type;const r=t.expression;r.type;const a=r.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else mR(e,t.position);else{const r=o.name;let a;if(o.value&&"object"==typeof o.value)if(o.value.data&&o.value.data.estree&&e.evaluater){const t=o.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else mR(e,t.position);else a=null===o.value||o.value;n[r]=a}return n}(e,t),s=uR(e,t);return cR(e,i,a,t),dR(i,s),e.ancestors.pop(),e.schema=o,e.create(t,a,i,n)}(e,t,n):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);mR(e,t.position)}(e,t):"root"===t.type?function(e,t,n){const o={};return dR(o,uR(e,t)),e.create(t,e.Fragment,o,n)}(e,t,n):"text"===t.type?function(e,t){return t.value}(0,t):void 0}function cR(e,t,n,o){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=o)}function dR(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function uR(e,t){const n=[];let o=-1;const r=e.passKeys?new Map:tR;for(;++o<t.children.length;){const a=t.children[o];let i;if(e.passKeys){const e="element"===a.type?a.tagName:"mdxJsxFlowElement"===a.type||"mdxJsxTextElement"===a.type?a.name:void 0;if(e){const t=r.get(e)||0;i=e+"-"+t,r.set(e,t+1)}}const s=lR(e,a,i);void 0!==s&&n.push(s)}return n}function hR(e,t,n){const o=function(e,t){const n=hP(t);let o=t,r=fP;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&LP.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(zP,UP);o="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!zP.test(e)){let n=e.replace(FP,BP);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}r=CP}return new r(o,t)}(e.schema,t);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){if(Array.isArray(n)&&(n=o.commaSeparated?function(e){const t={};return(""===e[e.length-1]?[...e,""]:e).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()}(n):n.join(" ").trim()),"style"===o.property){let t="object"==typeof n?n:function(e,t){const n={};try{WP(t,o)}catch(r){if(!e.ignoreInvalidStyle){const t=r,n=new QP("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:t,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=iR+"#cannot-parse-style-attribute",n}}return n;function o(e,t){let o=e;"--"!==o.slice(0,2)&&("-ms-"===o.slice(0,4)&&(o="ms-"+o.slice(4)),o=o.replace(oR,gR)),n[o]=t}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){const t={};let n;for(n in e)eR.call(e,n)&&(t[pR(n)]=e[n]);return t}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&o.space?VP[o.property]||o.property:o.attribute,n]}}function fR(e,t,n){let o;if(n)if(t.includes(".")){const e=t.split(".");let n,r=-1;for(;++r<e.length;){const t=sP(e[r])?{type:"Identifier",name:e[r]}:{type:"Literal",value:e[r]};n=n?{type:"MemberExpression",object:n,property:t,computed:Boolean(r&&"Literal"===t.type),optional:!1}:t}o=n}else o=sP(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else o={type:"Literal",value:t};if("Literal"===o.type){const t=o.value;return eR.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(o);mR(e)}function mR(e,t){const n=new QP("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=iR+"#cannot-handle-mdx-estrees-without-createevaluater",n}function pR(e){let t=e.replace(nR,yR);return"ms-"===t.slice(0,3)&&(t="-"+t),t}function gR(e,t){return t.toUpperCase()}function yR(e){return"-"+e.toLowerCase()}const vR={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},xR={};function bR(e,t,n){if(function(e){return Boolean(e&&"object"==typeof e)}(e)){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return wR(e.children,t,n)}return Array.isArray(e)?wR(e,t,n):""}function wR(e,t,n){const o=[];let r=-1;for(;++r<e.length;)o[r]=bR(e[r],t,n);return o.join("")}const kR=document.createElement("i");function SR(e){const t="&"+e+";";kR.innerHTML=t;const n=kR.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&(n!==t&&n)}function NR(e,t,n,o){const r=e.length;let a,i=0;if(t=t<0?-t>r?0:r+t:t>r?r:t,n=n>0?n:0,o.length<1e4)a=Array.from(o),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);i<o.length;)a=o.slice(i,i+1e4),a.unshift(t,0),e.splice(...a),i+=1e4,t+=1e4}function CR(e,t){return e.length>0?(NR(e,e.length,0,t),e):t}const ER={}.hasOwnProperty;function jR(e,t){let n;for(n in t){const o=(ER.call(e,n)?e[n]:void 0)||(e[n]={}),r=t[n];let a;if(r)for(a in r){ER.call(o,a)||(o[a]=[]);const e=r[a];_R(o[a],Array.isArray(e)?e:e?[e]:[])}}}function _R(e,t){let n=-1;const o=[];for(;++n<t.length;)("after"===t[n].add?e:o).push(t[n]);NR(e,0,0,o)}function IR(e,t){const n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||65534==(65535&n)||n>1114111?"�":String.fromCodePoint(n)}function TR(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const AR=HR(/[A-Za-z]/),MR=HR(/[\dA-Za-z]/),OR=HR(/[#-'*+\--9=?A-Z^-~]/);function DR(e){return null!==e&&(e<32||127===e)}const PR=HR(/\d/),RR=HR(/[\dA-Fa-f]/),LR=HR(/[!-/:-@[-`{-~]/);function zR(e){return null!==e&&e<-2}function FR(e){return null!==e&&(e<0||32===e)}function BR(e){return-2===e||-1===e||32===e}const UR=HR(new RegExp("\\p{P}|\\p{S}","u")),VR=HR(/\s/);function HR(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function $R(e){const t=[];let n=-1,o=0,r=0;for(;++n<e.length;){const a=e.charCodeAt(n);let i="";if(37===a&&MR(e.charCodeAt(n+1))&&MR(e.charCodeAt(n+2)))r=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(i=String.fromCharCode(a));else if(a>55295&&a<57344){const t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(i=String.fromCharCode(a,t),r=1):i="�"}else i=String.fromCharCode(a);i&&(t.push(e.slice(o,n),encodeURIComponent(i)),o=n+r+1,i=""),r&&(n+=r,r=0)}return t.join("")+e.slice(o)}function WR(e,t,n,o){const r=o?o-1:Number.POSITIVE_INFINITY;let a=0;return function(o){if(BR(o))return e.enter(n),i(o);return t(o)};function i(o){return BR(o)&&a++<r?(e.consume(o),i):(e.exit(n),t(o))}}const GR={tokenize:function(e){const t=e.attempt(this.parser.constructs.contentInitial,(function(n){if(null===n)return void e.consume(n);return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),WR(e,t,"linePrefix")}),(function(t){return e.enter("paragraph"),o(t)}));let n;return t;function o(t){const o=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=o),n=o,r(t)}function r(t){return null===t?(e.exit("chunkText"),e.exit("paragraph"),void e.consume(t)):zR(t)?(e.consume(t),e.exit("chunkText"),o):(e.consume(t),r)}}};const qR={tokenize:function(e){const t=this,n=[];let o,r,a,i=0;return s;function s(o){if(i<n.length){const r=n[i];return t.containerState=r[1],e.attempt(r[0].continuation,l,c)(o)}return c(o)}function l(e){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&v();const n=t.events.length;let r,a=n;for(;a--;)if("exit"===t.events[a][0]&&"chunkFlow"===t.events[a][1].type){r=t.events[a][1].end;break}y(i);let s=n;for(;s<t.events.length;)t.events[s][1].end={...r},s++;return NR(t.events,a+1,0,t.events.slice(n)),t.events.length=s,c(e)}return s(e)}function c(r){if(i===n.length){if(!o)return h(r);if(o.currentConstruct&&o.currentConstruct.concrete)return m(r);t.interrupt=Boolean(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(YR,d,u)(r)}function d(e){return o&&v(),y(i),h(e)}function u(e){return t.parser.lazy[t.now().line]=i!==n.length,a=t.now().offset,m(e)}function h(n){return t.containerState={},e.attempt(YR,f,m)(n)}function f(e){return i++,n.push([t.currentConstruct,t.containerState]),h(e)}function m(n){return null===n?(o&&v(),y(0),void e.consume(n)):(o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:r}),p(n))}function p(n){return null===n?(g(e.exit("chunkFlow"),!0),y(0),void e.consume(n)):zR(n)?(e.consume(n),g(e.exit("chunkFlow")),i=0,t.interrupt=void 0,s):(e.consume(n),p)}function g(e,n){const s=t.sliceStream(e);if(n&&s.push(null),e.previous=r,r&&(r.next=e),r=e,o.defineSkip(e.start),o.write(s),t.parser.lazy[e.start.line]){let e=o.events.length;for(;e--;)if(o.events[e][1].start.offset<a&&(!o.events[e][1].end||o.events[e][1].end.offset>a))return;const n=t.events.length;let r,s,l=n;for(;l--;)if("exit"===t.events[l][0]&&"chunkFlow"===t.events[l][1].type){if(r){s=t.events[l][1].end;break}r=!0}for(y(i),e=n;e<t.events.length;)t.events[e][1].end={...s},e++;NR(t.events,l+1,0,t.events.slice(n)),t.events.length=e}}function y(o){let r=n.length;for(;r-- >o;){const o=n[r];t.containerState=o[1],o[0].exit.call(t,e)}n.length=o}function v(){o.write([null]),r=void 0,o=void 0,t.containerState._closeFlow=void 0}}},YR={tokenize:function(e,t,n){return WR(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function XR(e){return null===e||FR(e)||VR(e)?1:UR(e)?2:void 0}function KR(e,t,n){const o=[];let r=-1;for(;++r<e.length;){const a=e[r].resolveAll;a&&!o.includes(a)&&(t=a(t,n),o.push(a))}return t}const JR={name:"attention",resolveAll:function(e,t){let n,o,r,a,i,s,l,c,d=-1;for(;++d<e.length;)if("enter"===e[d][0]&&"attentionSequence"===e[d][1].type&&e[d][1]._close)for(n=d;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[d][1]).charCodeAt(0)){if((e[n][1]._close||e[d][1]._open)&&(e[d][1].end.offset-e[d][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[d][1].end.offset-e[d][1].start.offset)%3))continue;s=e[n][1].end.offset-e[n][1].start.offset>1&&e[d][1].end.offset-e[d][1].start.offset>1?2:1;const u={...e[n][1].end},h={...e[d][1].start};ZR(u,-s),ZR(h,s),a={type:s>1?"strongSequence":"emphasisSequence",start:u,end:{...e[n][1].end}},i={type:s>1?"strongSequence":"emphasisSequence",start:{...e[d][1].start},end:h},r={type:s>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[d][1].start}},o={type:s>1?"strong":"emphasis",start:{...a.start},end:{...i.end}},e[n][1].end={...a.start},e[d][1].start={...i.end},l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=CR(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=CR(l,[["enter",o,t],["enter",a,t],["exit",a,t],["enter",r,t]]),l=CR(l,KR(t.parser.constructs.insideSpan.null,e.slice(n+1,d),t)),l=CR(l,[["exit",r,t],["enter",i,t],["exit",i,t],["exit",o,t]]),e[d][1].end.offset-e[d][1].start.offset?(c=2,l=CR(l,[["enter",e[d][1],t],["exit",e[d][1],t]])):c=0,NR(e,n-1,d-n+3,l),d=n+l.length-c-2;break}d=-1;for(;++d<e.length;)"attentionSequence"===e[d][1].type&&(e[d][1].type="data");return e},tokenize:function(e,t){const n=this.parser.constructs.attentionMarkers.null,o=this.previous,r=XR(o);let a;return function(t){return a=t,e.enter("attentionSequence"),i(t)};function i(s){if(s===a)return e.consume(s),i;const l=e.exit("attentionSequence"),c=XR(s),d=!c||2===c&&r||n.includes(s),u=!r||2===r&&c||n.includes(o);return l._open=Boolean(42===a?d:d&&(r||!u)),l._close=Boolean(42===a?u:u&&(c||!d)),t(s)}}};function ZR(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const QR={name:"autolink",tokenize:function(e,t,n){let o=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),r};function r(t){return AR(t)?(e.consume(t),a):64===t?n(t):l(t)}function a(e){return 43===e||45===e||46===e||MR(e)?(o=1,i(e)):l(e)}function i(t){return 58===t?(e.consume(t),o=0,s):(43===t||45===t||46===t||MR(t))&&o++<32?(e.consume(t),i):(o=0,l(t))}function s(o){return 62===o?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(o),e.exit("autolinkMarker"),e.exit("autolink"),t):null===o||32===o||60===o||DR(o)?n(o):(e.consume(o),s)}function l(t){return 64===t?(e.consume(t),c):OR(t)?(e.consume(t),l):n(t)}function c(e){return MR(e)?d(e):n(e)}function d(n){return 46===n?(e.consume(n),o=0,c):62===n?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):u(n)}function u(t){if((45===t||MR(t))&&o++<63){const n=45===t?u:d;return e.consume(t),n}return n(t)}}};const eL={partial:!0,tokenize:function(e,t,n){return function(t){return BR(t)?WR(e,o,"linePrefix")(t):o(t)};function o(e){return null===e||zR(e)?t(e):n(e)}}};const tL={continuation:{tokenize:function(e,t,n){const o=this;return function(t){if(BR(t))return WR(e,r,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t);return r(t)};function r(o){return e.attempt(tL,t,n)(o)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){const o=this;return function(t){if(62===t){const n=o.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),r}return n(t)};function r(n){return BR(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}};const nL={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),o};function o(o){return LR(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}};const oL={name:"characterReference",tokenize:function(e,t,n){const o=this;let r,a,i=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),s};function s(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),r=31,a=MR,c(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),r=6,a=RR,c):(e.enter("characterReferenceValue"),r=7,a=PR,c(t))}function c(s){if(59===s&&i){const r=e.exit("characterReferenceValue");return a!==MR||SR(o.sliceSerialize(r))?(e.enter("characterReferenceMarker"),e.consume(s),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(s)}return a(s)&&i++<r?(e.consume(s),c):n(s)}}};const rL={partial:!0,tokenize:function(e,t,n){const o=this;return function(t){if(null===t)return n(t);return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),r};function r(e){return o.parser.lazy[o.now().line]?n(e):t(e)}}},aL={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){const o=this,r={partial:!0,tokenize:function(e,t,n){let r=0;return i;function i(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),l}function l(t){return e.enter("codeFencedFence"),BR(t)?WR(e,c,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):c(t)}function c(t){return t===a?(e.enter("codeFencedFenceSequence"),d(t)):n(t)}function d(t){return t===a?(r++,e.consume(t),d):r>=s?(e.exit("codeFencedFenceSequence"),BR(t)?WR(e,u,"whitespace")(t):u(t)):n(t)}function u(o){return null===o||zR(o)?(e.exit("codeFencedFence"),t(o)):n(o)}}};let a,i=0,s=0;return function(t){return function(t){const n=o.events[o.events.length-1];return i=n&&"linePrefix"===n[1].type?n[2].sliceSerialize(n[1],!0).length:0,a=t,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),l(t)}(t)};function l(t){return t===a?(s++,e.consume(t),l):s<3?n(t):(e.exit("codeFencedFenceSequence"),BR(t)?WR(e,c,"whitespace")(t):c(t))}function c(n){return null===n||zR(n)?(e.exit("codeFencedFence"),o.interrupt?t(n):e.check(rL,f,v)(n)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),d(n))}function d(t){return null===t||zR(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(t)):BR(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),WR(e,u,"whitespace")(t)):96===t&&t===a?n(t):(e.consume(t),d)}function u(t){return null===t||zR(t)?c(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),h(t))}function h(t){return null===t||zR(t)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(t)):96===t&&t===a?n(t):(e.consume(t),h)}function f(t){return e.attempt(r,v,m)(t)}function m(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),p}function p(t){return i>0&&BR(t)?WR(e,g,"linePrefix",i+1)(t):g(t)}function g(t){return null===t||zR(t)?e.check(rL,f,v)(t):(e.enter("codeFlowValue"),y(t))}function y(t){return null===t||zR(t)?(e.exit("codeFlowValue"),g(t)):(e.consume(t),y)}function v(n){return e.exit("codeFenced"),t(n)}}};const iL={name:"codeIndented",tokenize:function(e,t,n){const o=this;return function(t){return e.enter("codeIndented"),WR(e,r,"linePrefix",5)(t)};function r(e){const t=o.events[o.events.length-1];return t&&"linePrefix"===t[1].type&&t[2].sliceSerialize(t[1],!0).length>=4?a(e):n(e)}function a(t){return null===t?s(t):zR(t)?e.attempt(sL,a,s)(t):(e.enter("codeFlowValue"),i(t))}function i(t){return null===t||zR(t)?(e.exit("codeFlowValue"),a(t)):(e.consume(t),i)}function s(n){return e.exit("codeIndented"),t(n)}}},sL={partial:!0,tokenize:function(e,t,n){const o=this;return r;function r(t){return o.parser.lazy[o.now().line]?n(t):zR(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),r):WR(e,a,"linePrefix",5)(t)}function a(e){const a=o.events[o.events.length-1];return a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):zR(e)?r(e):n(e)}}};const lL={name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,o=e.length-4,r=3;if(!("lineEnding"!==e[r][1].type&&"space"!==e[r][1].type||"lineEnding"!==e[o][1].type&&"space"!==e[o][1].type))for(t=r;++t<o;)if("codeTextData"===e[t][1].type){e[r][1].type="codeTextPadding",e[o][1].type="codeTextPadding",r+=2,o-=2;break}t=r-1,o++;for(;++t<=o;)void 0===n?t!==o&&"lineEnding"!==e[t][1].type&&(n=t):t!==o&&"lineEnding"!==e[t][1].type||(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),o-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let o,r,a=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),i(t)};function i(t){return 96===t?(e.consume(t),a++,i):(e.exit("codeTextSequence"),s(t))}function s(t){return null===t?n(t):32===t?(e.enter("space"),e.consume(t),e.exit("space"),s):96===t?(r=e.enter("codeTextSequence"),o=0,c(t)):zR(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),s):(e.enter("codeTextData"),l(t))}function l(t){return null===t||32===t||96===t||zR(t)?(e.exit("codeTextData"),s(t)):(e.consume(t),l)}function c(n){return 96===n?(e.consume(n),o++,c):o===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(n)):(r.type="codeTextData",l(n))}}};class cL{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){const n=null==t?Number.POSITIVE_INFINITY:t;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){const o=t||0;this.setCursor(Math.trunc(e));const r=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return n&&dL(this.left,n),r.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),dL(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),dL(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&0===this.right.length||e<0&&0===this.left.length))if(e<this.left.length){const t=this.left.splice(e,Number.POSITIVE_INFINITY);dL(this.right,t.reverse())}else{const t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);dL(this.left,t.reverse())}}}function dL(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function uL(e){const t={};let n,o,r,a,i,s,l,c=-1;const d=new cL(e);for(;++c<d.length;){for(;c in t;)c=t[c];if(n=d.get(c),c&&"chunkFlow"===n[1].type&&"listItemPrefix"===d.get(c-1)[1].type&&(s=n[1]._tokenizer.events,r=0,r<s.length&&"lineEndingBlank"===s[r][1].type&&(r+=2),r<s.length&&"content"===s[r][1].type))for(;++r<s.length&&"content"!==s[r][1].type;)"chunkText"===s[r][1].type&&(s[r][1]._isInFirstContentOfListItem=!0,r++);if("enter"===n[0])n[1].contentType&&(Object.assign(t,hL(d,c)),c=t[c],l=!0);else if(n[1]._container){for(r=c,o=void 0;r--&&(a=d.get(r),"lineEnding"===a[1].type||"lineEndingBlank"===a[1].type);)"enter"===a[0]&&(o&&(d.get(o)[1].type="lineEndingBlank"),a[1].type="lineEnding",o=r);o&&(n[1].end={...d.get(o)[1].start},i=d.slice(o,c),i.unshift(n),d.splice(o,c-o+1,i))}}return NR(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!l}function hL(e,t){const n=e.get(t)[1],o=e.get(t)[2];let r=t-1;const a=[],i=n._tokenizer||o.parser[n.contentType](n.start),s=i.events,l=[],c={};let d,u,h=-1,f=n,m=0,p=0;const g=[p];for(;f;){for(;e.get(++r)[1]!==f;);a.push(r),f._tokenizer||(d=o.sliceStream(f),f.next||d.push(null),u&&i.defineSkip(f.start),f._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(d),f._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),u=f,f=f.next}for(f=n;++h<s.length;)"exit"===s[h][0]&&"enter"===s[h-1][0]&&s[h][1].type===s[h-1][1].type&&s[h][1].start.line!==s[h][1].end.line&&(p=h+1,g.push(p),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(i.events=[],f?(f._tokenizer=void 0,f.previous=void 0):g.pop(),h=g.length;h--;){const t=s.slice(g[h],g[h+1]),n=a.pop();l.push([n,n+t.length-1]),e.splice(n,2,t)}for(l.reverse(),h=-1;++h<l.length;)c[m+l[h][0]]=m+l[h][1],m+=l[h][1]-l[h][0]-1;return c}const fL={resolve:function(e){return uL(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(t)};function o(t){return null===t?r(t):zR(t)?e.check(mL,a,r)(t):(e.consume(t),o)}function r(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function a(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}},mL={partial:!0,tokenize:function(e,t,n){const o=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),WR(e,r,"linePrefix")};function r(r){if(null===r||zR(r))return n(r);const a=o.events[o.events.length-1];return!o.parser.constructs.disable.null.includes("codeIndented")&&a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(r):e.interrupt(o.parser.constructs.flow,n,t)(r)}}};function pL(e,t,n,o,r,a,i,s,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return function(t){if(60===t)return e.enter(o),e.enter(r),e.enter(a),e.consume(t),e.exit(a),u;if(null===t||32===t||41===t||DR(t))return n(t);return e.enter(o),e.enter(i),e.enter(s),e.enter("chunkString",{contentType:"string"}),m(t)};function u(n){return 62===n?(e.enter(a),e.consume(n),e.exit(a),e.exit(r),e.exit(o),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),h(n))}function h(t){return 62===t?(e.exit("chunkString"),e.exit(s),u(t)):null===t||60===t||zR(t)?n(t):(e.consume(t),92===t?f:h)}function f(t){return 60===t||62===t||92===t?(e.consume(t),h):h(t)}function m(r){return d||null!==r&&41!==r&&!FR(r)?d<c&&40===r?(e.consume(r),d++,m):41===r?(e.consume(r),d--,m):null===r||32===r||40===r||DR(r)?n(r):(e.consume(r),92===r?p:m):(e.exit("chunkString"),e.exit(s),e.exit(i),e.exit(o),t(r))}function p(t){return 40===t||41===t||92===t?(e.consume(t),m):m(t)}}function gL(e,t,n,o,r,a){const i=this;let s,l=0;return function(t){return e.enter(o),e.enter(r),e.consume(t),e.exit(r),e.enter(a),c};function c(u){return l>999||null===u||91===u||93===u&&!s||94===u&&!l&&"_hiddenFootnoteSupport"in i.parser.constructs?n(u):93===u?(e.exit(a),e.enter(r),e.consume(u),e.exit(r),e.exit(o),t):zR(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),d(u))}function d(t){return null===t||91===t||93===t||zR(t)||l++>999?(e.exit("chunkString"),c(t)):(e.consume(t),s||(s=!BR(t)),92===t?u:d)}function u(t){return 91===t||92===t||93===t?(e.consume(t),l++,d):d(t)}}function yL(e,t,n,o,r,a){let i;return function(t){if(34===t||39===t||40===t)return e.enter(o),e.enter(r),e.consume(t),e.exit(r),i=40===t?41:t,s;return n(t)};function s(n){return n===i?(e.enter(r),e.consume(n),e.exit(r),e.exit(o),t):(e.enter(a),l(n))}function l(t){return t===i?(e.exit(a),s(i)):null===t?n(t):zR(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),WR(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return t===i||null===t||zR(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?d:c)}function d(t){return t===i||92===t?(e.consume(t),c):c(t)}}function vL(e,t){let n;return function o(r){if(zR(r))return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),n=!0,o;if(BR(r))return WR(e,o,n?"linePrefix":"lineSuffix")(r);return t(r)}}const xL={name:"definition",tokenize:function(e,t,n){const o=this;let r;return function(t){return e.enter("definition"),function(t){return gL.call(o,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(t)}(t)};function a(t){return r=TR(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)),58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),i):n(t)}function i(t){return FR(t)?vL(e,s)(t):s(t)}function s(t){return pL(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(bL,c,c)(t)}function c(t){return BR(t)?WR(e,d,"whitespace")(t):d(t)}function d(a){return null===a||zR(a)?(e.exit("definition"),o.parser.defined.push(r),t(a)):n(a)}}},bL={partial:!0,tokenize:function(e,t,n){return function(t){return FR(t)?vL(e,o)(t):n(t)};function o(t){return yL(e,r,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function r(t){return BR(t)?WR(e,a,"whitespace")(t):a(t)}function a(e){return null===e||zR(e)?t(e):n(e)}}};const wL={name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),o};function o(o){return zR(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}};const kL={name:"headingAtx",resolve:function(e,t){let n,o,r=e.length-2,a=3;"whitespace"===e[a][1].type&&(a+=2);r-2>a&&"whitespace"===e[r][1].type&&(r-=2);"atxHeadingSequence"===e[r][1].type&&(a===r-1||r-4>a&&"whitespace"===e[r-2][1].type)&&(r-=a+1===r?2:4);r>a&&(n={type:"atxHeadingText",start:e[a][1].start,end:e[r][1].end},o={type:"chunkText",start:e[a][1].start,end:e[r][1].end,contentType:"text"},NR(e,a,r-a+1,[["enter",n,t],["enter",o,t],["exit",o,t],["exit",n,t]]));return e},tokenize:function(e,t,n){let o=0;return function(t){return e.enter("atxHeading"),function(t){return e.enter("atxHeadingSequence"),r(t)}(t)};function r(t){return 35===t&&o++<6?(e.consume(t),r):null===t||FR(t)?(e.exit("atxHeadingSequence"),a(t)):n(t)}function a(n){return 35===n?(e.enter("atxHeadingSequence"),i(n)):null===n||zR(n)?(e.exit("atxHeading"),t(n)):BR(n)?WR(e,a,"whitespace")(n):(e.enter("atxHeadingText"),s(n))}function i(t){return 35===t?(e.consume(t),i):(e.exit("atxHeadingSequence"),a(t))}function s(t){return null===t||35===t||FR(t)?(e.exit("atxHeadingText"),a(t)):(e.consume(t),s)}}};const SL=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],NL=["pre","script","style","textarea"],CL={concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2));return e},tokenize:function(e,t,n){const o=this;let r,a,i,s,l;return function(t){return function(t){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(t),c}(t)};function c(s){return 33===s?(e.consume(s),d):47===s?(e.consume(s),a=!0,f):63===s?(e.consume(s),r=3,o.interrupt?t:D):AR(s)?(e.consume(s),i=String.fromCharCode(s),m):n(s)}function d(a){return 45===a?(e.consume(a),r=2,u):91===a?(e.consume(a),r=5,s=0,h):AR(a)?(e.consume(a),r=4,o.interrupt?t:D):n(a)}function u(r){return 45===r?(e.consume(r),o.interrupt?t:D):n(r)}function h(r){const a="CDATA[";return r===a.charCodeAt(s++)?(e.consume(r),6===s?o.interrupt?t:E:h):n(r)}function f(t){return AR(t)?(e.consume(t),i=String.fromCharCode(t),m):n(t)}function m(s){if(null===s||47===s||62===s||FR(s)){const l=47===s,c=i.toLowerCase();return l||a||!NL.includes(c)?SL.includes(i.toLowerCase())?(r=6,l?(e.consume(s),p):o.interrupt?t(s):E(s)):(r=7,o.interrupt&&!o.parser.lazy[o.now().line]?n(s):a?g(s):y(s)):(r=1,o.interrupt?t(s):E(s))}return 45===s||MR(s)?(e.consume(s),i+=String.fromCharCode(s),m):n(s)}function p(r){return 62===r?(e.consume(r),o.interrupt?t:E):n(r)}function g(t){return BR(t)?(e.consume(t),g):N(t)}function y(t){return 47===t?(e.consume(t),N):58===t||95===t||AR(t)?(e.consume(t),v):BR(t)?(e.consume(t),y):N(t)}function v(t){return 45===t||46===t||58===t||95===t||MR(t)?(e.consume(t),v):x(t)}function x(t){return 61===t?(e.consume(t),b):BR(t)?(e.consume(t),x):y(t)}function b(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),l=t,w):BR(t)?(e.consume(t),b):k(t)}function w(t){return t===l?(e.consume(t),l=null,S):null===t||zR(t)?n(t):(e.consume(t),w)}function k(t){return null===t||34===t||39===t||47===t||60===t||61===t||62===t||96===t||FR(t)?x(t):(e.consume(t),k)}function S(e){return 47===e||62===e||BR(e)?y(e):n(e)}function N(t){return 62===t?(e.consume(t),C):n(t)}function C(t){return null===t||zR(t)?E(t):BR(t)?(e.consume(t),C):n(t)}function E(t){return 45===t&&2===r?(e.consume(t),T):60===t&&1===r?(e.consume(t),A):62===t&&4===r?(e.consume(t),P):63===t&&3===r?(e.consume(t),D):93===t&&5===r?(e.consume(t),O):!zR(t)||6!==r&&7!==r?null===t||zR(t)?(e.exit("htmlFlowData"),j(t)):(e.consume(t),E):(e.exit("htmlFlowData"),e.check(EL,R,j)(t))}function j(t){return e.check(jL,_,R)(t)}function _(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),I}function I(t){return null===t||zR(t)?j(t):(e.enter("htmlFlowData"),E(t))}function T(t){return 45===t?(e.consume(t),D):E(t)}function A(t){return 47===t?(e.consume(t),i="",M):E(t)}function M(t){if(62===t){const n=i.toLowerCase();return NL.includes(n)?(e.consume(t),P):E(t)}return AR(t)&&i.length<8?(e.consume(t),i+=String.fromCharCode(t),M):E(t)}function O(t){return 93===t?(e.consume(t),D):E(t)}function D(t){return 62===t?(e.consume(t),P):45===t&&2===r?(e.consume(t),D):E(t)}function P(t){return null===t||zR(t)?(e.exit("htmlFlowData"),R(t)):(e.consume(t),P)}function R(n){return e.exit("htmlFlow"),t(n)}}},EL={partial:!0,tokenize:function(e,t,n){return function(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(eL,t,n)}}},jL={partial:!0,tokenize:function(e,t,n){const o=this;return function(t){if(zR(t))return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),r;return n(t)};function r(e){return o.parser.lazy[o.now().line]?n(e):t(e)}}};const _L={name:"htmlText",tokenize:function(e,t,n){const o=this;let r,a,i;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),s};function s(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),b):63===t?(e.consume(t),v):AR(t)?(e.consume(t),S):n(t)}function l(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),a=0,f):AR(t)?(e.consume(t),y):n(t)}function c(t){return 45===t?(e.consume(t),h):n(t)}function d(t){return null===t?n(t):45===t?(e.consume(t),u):zR(t)?(i=d,M(t)):(e.consume(t),d)}function u(t){return 45===t?(e.consume(t),h):d(t)}function h(e){return 62===e?A(e):45===e?u(e):d(e)}function f(t){const o="CDATA[";return t===o.charCodeAt(a++)?(e.consume(t),6===a?m:f):n(t)}function m(t){return null===t?n(t):93===t?(e.consume(t),p):zR(t)?(i=m,M(t)):(e.consume(t),m)}function p(t){return 93===t?(e.consume(t),g):m(t)}function g(t){return 62===t?A(t):93===t?(e.consume(t),g):m(t)}function y(t){return null===t||62===t?A(t):zR(t)?(i=y,M(t)):(e.consume(t),y)}function v(t){return null===t?n(t):63===t?(e.consume(t),x):zR(t)?(i=v,M(t)):(e.consume(t),v)}function x(e){return 62===e?A(e):v(e)}function b(t){return AR(t)?(e.consume(t),w):n(t)}function w(t){return 45===t||MR(t)?(e.consume(t),w):k(t)}function k(t){return zR(t)?(i=k,M(t)):BR(t)?(e.consume(t),k):A(t)}function S(t){return 45===t||MR(t)?(e.consume(t),S):47===t||62===t||FR(t)?N(t):n(t)}function N(t){return 47===t?(e.consume(t),A):58===t||95===t||AR(t)?(e.consume(t),C):zR(t)?(i=N,M(t)):BR(t)?(e.consume(t),N):A(t)}function C(t){return 45===t||46===t||58===t||95===t||MR(t)?(e.consume(t),C):E(t)}function E(t){return 61===t?(e.consume(t),j):zR(t)?(i=E,M(t)):BR(t)?(e.consume(t),E):N(t)}function j(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),r=t,_):zR(t)?(i=j,M(t)):BR(t)?(e.consume(t),j):(e.consume(t),I)}function _(t){return t===r?(e.consume(t),r=void 0,T):null===t?n(t):zR(t)?(i=_,M(t)):(e.consume(t),_)}function I(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||FR(t)?N(t):(e.consume(t),I)}function T(e){return 47===e||62===e||FR(e)?N(e):n(e)}function A(o){return 62===o?(e.consume(o),e.exit("htmlTextData"),e.exit("htmlText"),t):n(o)}function M(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),O}function O(t){return BR(t)?WR(e,D,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):D(t)}function D(t){return e.enter("htmlTextData"),i(t)}}};const IL={name:"labelEnd",resolveAll:function(e){let t=-1;const n=[];for(;++t<e.length;){const o=e[t][1];if(n.push(e[t]),"labelImage"===o.type||"labelLink"===o.type||"labelEnd"===o.type){const e="labelImage"===o.type?4:2;o.type="data",t+=e}}e.length!==n.length&&NR(e,0,e.length,n);return e},resolveTo:function(e,t){let n,o,r,a,i=e.length,s=0;for(;i--;)if(n=e[i][1],o){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[i][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(r){if("enter"===e[i][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(o=i,"labelLink"!==n.type)){s=2;break}}else"labelEnd"===n.type&&(r=i);const l={type:"labelLink"===e[o][1].type?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[o][1].start},end:{...e[r][1].end}},d={type:"labelText",start:{...e[o+s+2][1].end},end:{...e[r-2][1].start}};return a=[["enter",l,t],["enter",c,t]],a=CR(a,e.slice(o+1,o+s+3)),a=CR(a,[["enter",d,t]]),a=CR(a,KR(t.parser.constructs.insideSpan.null,e.slice(o+s+4,r-3),t)),a=CR(a,[["exit",d,t],e[r-2],e[r-1],["exit",c,t]]),a=CR(a,e.slice(r+1)),a=CR(a,[["exit",l,t]]),NR(e,o,e.length,a),e},tokenize:function(e,t,n){const o=this;let r,a,i=o.events.length;for(;i--;)if(("labelImage"===o.events[i][1].type||"labelLink"===o.events[i][1].type)&&!o.events[i][1]._balanced){r=o.events[i][1];break}return function(t){if(!r)return n(t);if(r._inactive)return d(t);return a=o.parser.defined.includes(TR(o.sliceSerialize({start:r.end,end:o.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),s};function s(t){return 40===t?e.attempt(TL,c,a?c:d)(t):91===t?e.attempt(AL,c,a?l:d)(t):a?c(t):d(t)}function l(t){return e.attempt(ML,c,d)(t)}function c(e){return t(e)}function d(e){return r._balanced=!0,n(e)}}},TL={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),o};function o(t){return FR(t)?vL(e,r)(t):r(t)}function r(t){return 41===t?c(t):pL(e,a,i,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function a(t){return FR(t)?vL(e,s)(t):c(t)}function i(e){return n(e)}function s(t){return 34===t||39===t||40===t?yL(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function l(t){return FR(t)?vL(e,c)(t):c(t)}function c(o){return 41===o?(e.enter("resourceMarker"),e.consume(o),e.exit("resourceMarker"),e.exit("resource"),t):n(o)}}},AL={tokenize:function(e,t,n){const o=this;return function(t){return gL.call(o,e,r,a,"reference","referenceMarker","referenceString")(t)};function r(e){return o.parser.defined.includes(TR(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function a(e){return n(e)}}},ML={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),o};function o(o){return 93===o?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}};const OL={name:"labelStartImage",resolveAll:IL.resolveAll,tokenize:function(e,t,n){const o=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),r};function r(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),a):n(t)}function a(e){return 94===e&&"_hiddenFootnoteSupport"in o.parser.constructs?n(e):t(e)}}};const DL={name:"labelStartLink",resolveAll:IL.resolveAll,tokenize:function(e,t,n){const o=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),r};function r(e){return 94===e&&"_hiddenFootnoteSupport"in o.parser.constructs?n(e):t(e)}}};const PL={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),WR(e,t,"linePrefix")}}};const RL={name:"thematicBreak",tokenize:function(e,t,n){let o,r=0;return function(t){return e.enter("thematicBreak"),function(e){return o=e,a(e)}(t)};function a(a){return a===o?(e.enter("thematicBreakSequence"),i(a)):r>=3&&(null===a||zR(a))?(e.exit("thematicBreak"),t(a)):n(a)}function i(t){return t===o?(e.consume(t),r++,i):(e.exit("thematicBreakSequence"),BR(t)?WR(e,a,"whitespace")(t):a(t))}}};const LL={continuation:{tokenize:function(e,t,n){const o=this;return o.containerState._closeFlow=void 0,e.check(eL,(function(n){return o.containerState.furtherBlankLines=o.containerState.furtherBlankLines||o.containerState.initialBlankLine,WR(e,t,"listItemIndent",o.containerState.size+1)(n)}),(function(n){if(o.containerState.furtherBlankLines||!BR(n))return o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,r(n);return o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,e.attempt(FL,t,r)(n)}));function r(r){return o.containerState._closeFlow=!0,o.interrupt=void 0,WR(e,e.attempt(LL,t,n),"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(r)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){const o=this,r=o.events[o.events.length-1];let a=r&&"linePrefix"===r[1].type?r[2].sliceSerialize(r[1],!0).length:0,i=0;return function(t){const r=o.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===r?!o.containerState.marker||t===o.containerState.marker:PR(t)){if(o.containerState.type||(o.containerState.type=r,e.enter(r,{_container:!0})),"listUnordered"===r)return e.enter("listItemPrefix"),42===t||45===t?e.check(RL,n,l)(t):l(t);if(!o.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),s(t)}return n(t)};function s(t){return PR(t)&&++i<10?(e.consume(t),s):(!o.interrupt||i<2)&&(o.containerState.marker?t===o.containerState.marker:41===t||46===t)?(e.exit("listItemValue"),l(t)):n(t)}function l(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),o.containerState.marker=o.containerState.marker||t,e.check(eL,o.interrupt?n:c,e.attempt(zL,u,d))}function c(e){return o.containerState.initialBlankLine=!0,a++,u(e)}function d(t){return BR(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),u):n(t)}function u(n){return o.containerState.size=a+o.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},zL={partial:!0,tokenize:function(e,t,n){const o=this;return WR(e,(function(e){const r=o.events[o.events.length-1];return!BR(e)&&r&&"listItemPrefixWhitespace"===r[1].type?t(e):n(e)}),"listItemPrefixWhitespace",o.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},FL={partial:!0,tokenize:function(e,t,n){const o=this;return WR(e,(function(e){const r=o.events[o.events.length-1];return r&&"listItemIndent"===r[1].type&&r[2].sliceSerialize(r[1],!0).length===o.containerState.size?t(e):n(e)}),"listItemIndent",o.containerState.size+1)}};const BL={name:"setextUnderline",resolveTo:function(e,t){let n,o,r,a=e.length;for(;a--;)if("enter"===e[a][0]){if("content"===e[a][1].type){n=a;break}"paragraph"===e[a][1].type&&(o=a)}else"content"===e[a][1].type&&e.splice(a,1),r||"definition"!==e[a][1].type||(r=a);const i={type:"setextHeading",start:{...e[o][1].start},end:{...e[e.length-1][1].end}};e[o][1].type="setextHeadingText",r?(e.splice(o,0,["enter",i,t]),e.splice(r+1,0,["exit",e[n][1],t]),e[n][1].end={...e[r][1].end}):e[n][1]=i;return e.push(["exit",i,t]),e},tokenize:function(e,t,n){const o=this;let r;return function(t){let i,s=o.events.length;for(;s--;)if("lineEnding"!==o.events[s][1].type&&"linePrefix"!==o.events[s][1].type&&"content"!==o.events[s][1].type){i="paragraph"===o.events[s][1].type;break}if(!o.parser.lazy[o.now().line]&&(o.interrupt||i))return e.enter("setextHeadingLine"),r=t,function(t){return e.enter("setextHeadingLineSequence"),a(t)}(t);return n(t)};function a(t){return t===r?(e.consume(t),a):(e.exit("setextHeadingLineSequence"),BR(t)?WR(e,i,"lineSuffix")(t):i(t))}function i(o){return null===o||zR(o)?(e.exit("setextHeadingLine"),t(o)):n(o)}}};const UL={tokenize:function(e){const t=this,n=e.attempt(eL,(function(o){if(null===o)return void e.consume(o);return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}),e.attempt(this.parser.constructs.flowInitial,o,WR(e,e.attempt(this.parser.constructs.flow,o,e.attempt(fL,o)),"linePrefix")));return n;function o(o){if(null!==o)return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n;e.consume(o)}}};const VL={resolveAll:GL()},HL=WL("string"),$L=WL("text");function WL(e){return{resolveAll:GL("text"===e?qL:void 0),tokenize:function(t){const n=this,o=this.parser.constructs[e],r=t.attempt(o,a,i);return a;function a(e){return l(e)?r(e):i(e)}function i(e){if(null!==e)return t.enter("data"),t.consume(e),s;t.consume(e)}function s(e){return l(e)?(t.exit("data"),r(e)):(t.consume(e),s)}function l(e){if(null===e)return!0;const t=o[e];let r=-1;if(t)for(;++r<t.length;){const e=t[r];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function GL(e){return function(t,n){let o,r=-1;for(;++r<=t.length;)void 0===o?t[r]&&"data"===t[r][1].type&&(o=r,r++):t[r]&&"data"===t[r][1].type||(r!==o+2&&(t[o][1].end=t[r-1][1].end,t.splice(o+2,r-o-2),r=o+2),o=void 0);return e?e(t,n):t}}function qL(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){const o=e[n-1][1],r=t.sliceStream(o);let a,i=r.length,s=-1,l=0;for(;i--;){const e=r[i];if("string"==typeof e){for(s=e.length;32===e.charCodeAt(s-1);)l++,s--;if(s)break;s=-1}else if(-2===e)a=!0,l++;else if(-1!==e){i++;break}}if(l){const r={type:n===e.length||a||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?s:o.start._bufferIndex+s,_index:o.start._index+i,line:o.end.line,column:o.end.column-l,offset:o.end.offset-l},end:{...o.end}};o.end={...r.start},o.start.offset===o.end.offset?Object.assign(o,r):(e.splice(n,0,["enter",r,t],["exit",r,t]),n+=2)}n++}return e}const YL={42:LL,43:LL,45:LL,48:LL,49:LL,50:LL,51:LL,52:LL,53:LL,54:LL,55:LL,56:LL,57:LL,62:tL},XL={91:xL},KL={[-2]:iL,[-1]:iL,32:iL},JL={35:kL,42:RL,45:[BL,RL],60:CL,61:BL,95:RL,96:aL,126:aL},ZL={38:oL,92:nL},QL={[-5]:PL,[-4]:PL,[-3]:PL,33:OL,38:oL,42:JR,60:[QR,_L],91:DL,92:[wL,nL],93:IL,95:JR,96:lL},ez={null:[JR,VL]},tz=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:XL,disable:{null:[]},document:YL,flow:JL,flowInitial:KL,insideSpan:ez,string:ZL,text:QL},Symbol.toStringTag,{value:"Module"}));function nz(e,t,n){let o={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const r={},a=[];let i=[],s=[];const l={attempt:g((function(e,t){y(e,t.from)})),check:g(p),consume:function(e){zR(e)?(o.line++,o.column=1,o.offset+=-3===e?2:1,v()):-1!==e&&(o.column++,o.offset++);o._bufferIndex<0?o._index++:(o._bufferIndex++,o._bufferIndex===i[o._index].length&&(o._bufferIndex=-1,o._index++));c.previous=e},enter:function(e,t){const n=t||{};return n.type=e,n.start=h(),c.events.push(["enter",n,c]),s.push(n),n},exit:function(e){const t=s.pop();return t.end=h(),c.events.push(["exit",t,c]),t},interrupt:g(p,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(e){r[e.line]=e.column,v()},events:[],now:h,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n=-1;const o=[];let r;for(;++n<e.length;){const a=e[n];let i;if("string"==typeof a)i=a;else switch(a){case-5:i="\r";break;case-4:i="\n";break;case-3:i="\r\n";break;case-2:i=t?" ":"\t";break;case-1:if(!t&&r)continue;i=" ";break;default:i=String.fromCharCode(a)}r=-2===a,o.push(i)}return o.join("")}(u(e),t)},sliceStream:u,write:function(e){if(i=CR(i,e),f(),null!==i[i.length-1])return[];return y(t,0),c.events=KR(a,c.events,c),c.events}};let d=t.tokenize.call(c,l);return t.resolveAll&&a.push(t),c;function u(e){return function(e,t){const n=t.start._index,o=t.start._bufferIndex,r=t.end._index,a=t.end._bufferIndex;let i;if(n===r)i=[e[n].slice(o,a)];else{if(i=e.slice(n,r),o>-1){const e=i[0];"string"==typeof e?i[0]=e.slice(o):i.shift()}a>0&&i.push(e[r].slice(0,a))}return i}(i,e)}function h(){const{_bufferIndex:e,_index:t,line:n,column:r,offset:a}=o;return{_bufferIndex:e,_index:t,line:n,column:r,offset:a}}function f(){let e;for(;o._index<i.length;){const t=i[o._index];if("string"==typeof t)for(e=o._index,o._bufferIndex<0&&(o._bufferIndex=0);o._index===e&&o._bufferIndex<t.length;)m(t.charCodeAt(o._bufferIndex));else m(t)}}function m(e){d=d(e)}function p(e,t){t.restore()}function g(e,t){return function(n,r,a){let i,d,u,f;return Array.isArray(n)?m(n):"tokenize"in n?m([n]):function(e){return t;function t(t){const n=null!==t&&e[t],o=null!==t&&e.null;return m([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(o)?o:o?[o]:[]])(t)}}(n);function m(e){return i=e,d=0,0===e.length?a:p(e[d])}function p(e){return function(n){f=function(){const e=h(),t=c.previous,n=c.currentConstruct,r=c.events.length,a=Array.from(s);return{from:r,restore:i};function i(){o=e,c.previous=t,c.currentConstruct=n,c.events.length=r,s=a,v()}}(),u=e,e.partial||(c.currentConstruct=e);if(e.name&&c.parser.constructs.disable.null.includes(e.name))return y();return e.tokenize.call(t?Object.assign(Object.create(c),t):c,l,g,y)(n)}}function g(t){return e(u,f),r}function y(e){return f.restore(),++d<i.length?p(i[d]):a}}}function y(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&NR(c.events,t,c.events.length-t,e.resolve(c.events.slice(t),c)),e.resolveTo&&(c.events=e.resolveTo(c.events,c))}function v(){o.line in r&&o.column<2&&(o.column=r[o.line],o.offset+=r[o.line]-1)}}function oz(e){const t={constructs:function(e){const t={};let n=-1;for(;++n<e.length;)jR(t,e[n]);return t}([tz,...(e||{}).extensions||[]]),content:n(GR),defined:[],document:n(qR),flow:n(UL),lazy:{},string:n(HL),text:n($L)};return t;function n(e){return function(n){return nz(t,e,n)}}}const rz=/[\0\t\n\r]/g;const az=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function iz(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){const e=n.charCodeAt(1),t=120===e||88===e;return IR(n.slice(t?2:1),t?16:10)}return SR(n)||e}const sz={}.hasOwnProperty;function lz(e,t,n){return"string"!=typeof t&&(n=t,t=void 0),function(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(te),autolinkProtocol:C,autolinkEmail:C,atxHeading:a(J),blockQuote:a(G),characterEscape:C,characterReference:C,codeFenced:a(q),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:a(q,i),codeText:a(Y,i),codeTextData:C,data:C,codeFlowValue:C,definition:a(X),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:a(K),hardBreakEscape:a(Z),hardBreakTrailing:a(Z),htmlFlow:a(Q,i),htmlFlowData:C,htmlText:a(Q,i),htmlTextData:C,image:a(ee),label:i,link:a(te),listItem:a(oe),listItemValue:h,listOrdered:a(ne,u),listUnordered:a(ne),paragraph:a(re),reference:F,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:a(J),strong:a(ae),thematicBreak:a(se)},exit:{atxHeading:l(),atxHeadingSequence:w,autolink:l(),autolinkEmail:W,autolinkProtocol:$,blockQuote:l(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:U,characterReferenceMarkerNumeric:U,characterReferenceValue:V,characterReference:H,codeFenced:l(g),codeFencedFence:p,codeFencedFenceInfo:f,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:l(y),codeText:l(A),codeTextData:E,data:E,definition:l(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:x,emphasis:l(),hardBreakEscape:l(_),hardBreakTrailing:l(_),htmlFlow:l(I),htmlFlowData:E,htmlText:l(T),htmlTextData:E,image:l(O),label:P,labelText:D,lineEnding:j,link:l(M),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:B,resourceDestinationString:R,resourceTitleString:L,resource:z,setextHeading:l(N),setextHeadingLineSequence:S,setextHeadingText:k,strong:l(),thematicBreak:l()}};dz(t,(e||{}).mdastExtensions||[]);const n={};return o;function o(e){let o={type:"root",children:[]};const a={stack:[o],tokenStack:[],config:t,enter:s,exit:c,buffer:i,resume:d,data:n},l=[];let u=-1;for(;++u<e.length;)if("listOrdered"===e[u][1].type||"listUnordered"===e[u][1].type)if("enter"===e[u][0])l.push(u);else{u=r(e,l.pop(),u)}for(u=-1;++u<e.length;){const n=t[e[u][0]];sz.call(n,e[u][1].type)&&n[e[u][1].type].call(Object.assign({sliceSerialize:e[u][2].sliceSerialize},a),e[u][1])}if(a.tokenStack.length>0){const e=a.tokenStack[a.tokenStack.length-1];(e[1]||hz).call(a,void 0,e[0])}for(o.position={start:cz(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:cz(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},u=-1;++u<t.transforms.length;)o=t.transforms[u](o)||o;return o}function r(e,t,n){let o,r,a,i,s=t-1,l=-1,c=!1;for(;++s<=n;){const t=e[s];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,i=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!o||i||l||a||(a=s),i=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:i=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(o){let i=s;for(r=void 0;i--;){const t=e[i];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;r&&(e[r][1].type="lineEndingBlank",c=!0),t[1].type="lineEnding",r=i}else if("linePrefix"!==t[1].type&&"blockQuotePrefix"!==t[1].type&&"blockQuotePrefixWhitespace"!==t[1].type&&"blockQuoteMarker"!==t[1].type&&"listItemIndent"!==t[1].type)break}a&&(!r||a<r)&&(o._spread=!0),o.end=Object.assign({},r?e[r][1].start:t[1].end),e.splice(r||s,0,["exit",o,t[2]]),s++,n++}if("listItemPrefix"===t[1].type){const r={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=r,e.splice(s,0,["enter",r,t[2]]),s++,n++,a=void 0,i=!0}}}return e[t][1]._spread=c,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function i(){this.stack.push({type:"fragment",children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:cz(t.start),end:void 0}}function l(e){return t;function t(t){e&&e.call(this,t),c.call(this,t)}}function c(e,t){const n=this.stack.pop(),o=this.tokenStack.pop();if(!o)throw new Error("Cannot close `"+e.type+"` ("+XP({start:e.start,end:e.end})+"): it’s not open");if(o[0].type!==e.type)if(t)t.call(this,e,o[0]);else{(o[1]||hz).call(this,e,o[0])}n.position.end=cz(e.end)}function d(){return function(e){return bR(e,"boolean"!=typeof xR.includeImageAlt||xR.includeImageAlt,"boolean"!=typeof xR.includeHtml||xR.includeHtml)}(this.stack.pop())}function u(){this.data.expectingFirstListItemValue=!0}function h(e){if(this.data.expectingFirstListItemValue){this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function f(){const e=this.resume();this.stack[this.stack.length-1].lang=e}function m(){const e=this.resume();this.stack[this.stack.length-1].meta=e}function p(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}function v(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=TR(this.sliceSerialize(e)).toLowerCase()}function x(){const e=this.resume();this.stack[this.stack.length-1].title=e}function b(){const e=this.resume();this.stack[this.stack.length-1].url=e}function w(e){const t=this.stack[this.stack.length-1];if(!t.depth){const n=this.sliceSerialize(e).length;t.depth=n}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function S(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2}function N(){this.data.setextHeadingSlurpLineEnding=void 0}function C(e){const t=this.stack[this.stack.length-1].children;let n=t[t.length-1];n&&"text"===n.type||(n=ie(),n.position={start:cz(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){const t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=cz(e.end)}function j(e){const n=this.stack[this.stack.length-1];if(this.data.atHardBreak){return n.children[n.children.length-1].position.end=cz(e.end),void(this.data.atHardBreak=void 0)}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(C.call(this,e),E.call(this,e))}function _(){this.data.atHardBreak=!0}function I(){const e=this.resume();this.stack[this.stack.length-1].value=e}function T(){const e=this.resume();this.stack[this.stack.length-1].value=e}function A(){const e=this.resume();this.stack[this.stack.length-1].value=e}function M(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function O(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function D(e){const t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=function(e){return e.replace(az,iz)}(t),n.identifier=TR(t).toLowerCase()}function P(){const e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];if(this.data.inReference=!0,"link"===n.type){const t=e.children;n.children=t}else n.alt=t}function R(){const e=this.resume();this.stack[this.stack.length-1].url=e}function L(){const e=this.resume();this.stack[this.stack.length-1].title=e}function z(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function B(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=TR(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"}function U(e){this.data.characterReferenceType=e.type}function V(e){const t=this.sliceSerialize(e),n=this.data.characterReferenceType;let o;if(n)o=IR(t,"characterReferenceMarkerNumeric"===n?10:16),this.data.characterReferenceType=void 0;else{o=SR(t)}this.stack[this.stack.length-1].value+=o}function H(e){this.stack.pop().position.end=cz(e.end)}function $(e){E.call(this,e);this.stack[this.stack.length-1].url=this.sliceSerialize(e)}function W(e){E.call(this,e);this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)}function G(){return{type:"blockquote",children:[]}}function q(){return{type:"code",lang:null,meta:null,value:""}}function Y(){return{type:"inlineCode",value:""}}function X(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function K(){return{type:"emphasis",children:[]}}function J(){return{type:"heading",depth:0,children:[]}}function Z(){return{type:"break"}}function Q(){return{type:"html",value:""}}function ee(){return{type:"image",title:null,url:"",alt:null}}function te(){return{type:"link",title:null,url:"",children:[]}}function ne(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}function oe(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}function re(){return{type:"paragraph",children:[]}}function ae(){return{type:"strong",children:[]}}function ie(){return{type:"text",value:""}}function se(){return{type:"thematicBreak"}}}(n)(function(e){for(;!uL(e););return e}(oz(n).document().write(function(){let e,t=1,n="",o=!0;return function(r,a,i){const s=[];let l,c,d,u,h;for(r=n+("string"==typeof r?r.toString():new TextDecoder(a||void 0).decode(r)),d=0,n="",o&&(65279===r.charCodeAt(0)&&d++,o=void 0);d<r.length;){if(rz.lastIndex=d,l=rz.exec(r),u=l&&void 0!==l.index?l.index:r.length,h=r.charCodeAt(u),!l){n=r.slice(d);break}if(10===h&&d===u&&e)s.push(-3),e=void 0;else switch(e&&(s.push(-5),e=void 0),d<u&&(s.push(r.slice(d,u)),t+=u-d),h){case 0:s.push(65533),t++;break;case 9:for(c=4*Math.ceil(t/4),s.push(-2);t++<c;)s.push(-1);break;case 10:s.push(-4),t=1;break;default:e=!0,t=1}d=u+1}return i&&(e&&s.push(-5),n&&s.push(n),s.push(null)),s}}()(e,t,!0))))}function cz(e){return{line:e.line,column:e.column,offset:e.offset}}function dz(e,t){let n=-1;for(;++n<t.length;){const o=t[n];Array.isArray(o)?dz(e,o):uz(e,o)}}function uz(e,t){let n;for(n in t)if(sz.call(t,n))switch(n){case"canContainEols":{const o=t[n];o&&e[n].push(...o);break}case"transforms":{const o=t[n];o&&e[n].push(...o);break}case"enter":case"exit":{const o=t[n];o&&Object.assign(e[n],o);break}}}function hz(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+XP({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+XP({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+XP({start:t.start,end:t.end})+") is still open")}function fz(e){const t=this;t.parser=function(n){return lz(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function mz(e,t){const n=t.referenceType;let o="]";if("collapsed"===n?o+="[]":"full"===n&&(o+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+o}];const r=e.all(t),a=r[0];a&&"text"===a.type?a.value="["+a.value:r.unshift({type:"text",value:"["});const i=r[r.length-1];return i&&"text"===i.type?i.value+=o:r.push({type:"text",value:o}),r}function pz(e){const t=e.spread;return null==t?e.children.length>1:t}function gz(e){const t=String(e),n=/\r?\n|\r/g;let o=n.exec(t),r=0;const a=[];for(;o;)a.push(yz(t.slice(r,o.index),r>0,!0),o[0]),r=o.index+o[0].length,o=n.exec(t);return a.push(yz(t.slice(r),r>0,!1)),a.join("")}function yz(e,t,n){let o=0,r=e.length;if(t){let t=e.codePointAt(o);for(;9===t||32===t;)o++,t=e.codePointAt(o)}if(n){let t=e.codePointAt(r-1);for(;9===t||32===t;)r--,t=e.codePointAt(r-1)}return r>o?e.slice(o,r):""}const vz={blockquote:function(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){const n=t.value?t.value+"\n":"",o={};t.lang&&(o.className=["language-"+t.lang]);let r={type:"element",tagName:"code",properties:o,children:[{type:"text",value:n}]};return t.meta&&(r.data={meta:t.meta}),e.patch(t,r),r=e.applyData(t,r),r={type:"element",tagName:"pre",properties:{},children:[r]},e.patch(t,r),r},delete:function(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){const n="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",o=String(t.identifier).toUpperCase(),r=$R(o.toLowerCase()),a=e.footnoteOrder.indexOf(o);let i,s=e.footnoteCounts.get(o);void 0===s?(s=0,e.footnoteOrder.push(o),i=e.footnoteOrder.length):i=a+1,s+=1,e.footnoteCounts.set(o,s);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+r,id:n+"fnref-"+r+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)},heading:function(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){const n=String(t.identifier).toUpperCase(),o=e.definitionById.get(n);if(!o)return mz(e,t);const r={src:$R(o.url||""),alt:t.alt};null!==o.title&&void 0!==o.title&&(r.title=o.title);const a={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,a),e.applyData(t,a)},image:function(e,t){const n={src:$R(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);const o={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,o),e.applyData(t,o)},inlineCode:function(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const o={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,o),e.applyData(t,o)},linkReference:function(e,t){const n=String(t.identifier).toUpperCase(),o=e.definitionById.get(n);if(!o)return mz(e,t);const r={href:$R(o.url||"")};null!==o.title&&void 0!==o.title&&(r.title=o.title);const a={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)},link:function(e,t){const n={href:$R(t.url)};null!==t.title&&void 0!==t.title&&(n.title=t.title);const o={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)},listItem:function(e,t,n){const o=e.all(t),r=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;const n=e.children;let o=-1;for(;!t&&++o<n.length;)t=pz(n[o])}return t}(n):pz(t),a={},i=[];if("boolean"==typeof t.checked){const e=o[0];let n;e&&"element"===e.type&&"p"===e.tagName?n=e:(n={type:"element",tagName:"p",properties:{},children:[]},o.unshift(n)),n.children.length>0&&n.children.unshift({type:"text",value:" "}),n.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let s=-1;for(;++s<o.length;){const e=o[s];(r||0!==s||"element"!==e.type||"p"!==e.tagName)&&i.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||r?i.push(e):i.push(...e.children)}const l=o[o.length-1];l&&(r||"element"!==l.type||"p"!==l.tagName)&&i.push({type:"text",value:"\n"});const c={type:"element",tagName:"li",properties:a,children:i};return e.patch(t,c),e.applyData(t,c)},list:function(e,t){const n={},o=e.all(t);let r=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++r<o.length;){const e=o[r];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const a={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(o,!0)};return e.patch(t,a),e.applyData(t,a)},paragraph:function(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(e,t){const n=e.all(t),o=n.shift(),r=[];if(o){const n={type:"element",tagName:"thead",properties:{},children:e.wrap([o],!0)};e.patch(t.children[0],n),r.push(n)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=qP(t.children[1]),i=GP(t.children[t.children.length-1]);a&&i&&(o.position={start:a,end:i}),r.push(o)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)},tableCell:function(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){const o=n?n.children:void 0,r=0===(o?o.indexOf(t):1)?"th":"td",a=n&&"table"===n.type?n.align:void 0,i=a?a.length:t.children.length;let s=-1;const l=[];for(;++s<i;){const n=t.children[s],o={},i=a?a[s]:void 0;i&&(o.align=i);let c={type:"element",tagName:r,properties:o,children:[]};n&&(c.children=e.all(n),e.patch(n,c),c=e.applyData(n,c)),l.push(c)}const c={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,c),e.applyData(t,c)},text:function(e,t){const n={type:"text",value:gz(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:xz,yaml:xz,definition:xz,footnoteDefinition:xz};function xz(){}const bz="object"==typeof self?self:globalThis,wz=e=>((e,t)=>{const n=(t,n)=>(e.set(n,t),t),o=r=>{if(e.has(r))return e.get(r);const[a,i]=t[r];switch(a){case 0:case-1:return n(i,r);case 1:{const e=n([],r);for(const t of i)e.push(o(t));return e}case 2:{const e=n({},r);for(const[t,n]of i)e[o(t)]=o(n);return e}case 3:return n(new Date(i),r);case 4:{const{source:e,flags:t}=i;return n(new RegExp(e,t),r)}case 5:{const e=n(new Map,r);for(const[t,n]of i)e.set(o(t),o(n));return e}case 6:{const e=n(new Set,r);for(const t of i)e.add(o(t));return e}case 7:{const{name:e,message:t}=i;return n(new bz[e](t),r)}case 8:return n(BigInt(i),r);case"BigInt":return n(Object(BigInt(i)),r)}return n(new bz[a](i),r)};return o})(new Map,e)(0),kz="",{toString:Sz}={},{keys:Nz}=Object,Cz=e=>{const t=typeof e;if("object"!==t||!e)return[0,t];const n=Sz.call(e).slice(8,-1);switch(n){case"Array":return[1,kz];case"Object":return[2,kz];case"Date":return[3,kz];case"RegExp":return[4,kz];case"Map":return[5,kz];case"Set":return[6,kz]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},Ez=([e,t])=>0===e&&("function"===t||"symbol"===t),jz=(e,{json:t,lossy:n}={})=>{const o=[];return((e,t,n,o)=>{const r=(e,t)=>{const r=o.push(e)-1;return n.set(t,r),r},a=o=>{if(n.has(o))return n.get(o);let[i,s]=Cz(o);switch(i){case 0:{let t=o;switch(s){case"bigint":i=8,t=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+s);t=null;break;case"undefined":return r([-1],o)}return r([i,t],o)}case 1:{if(s)return r([s,[...o]],o);const e=[],t=r([i,e],o);for(const n of o)e.push(a(n));return t}case 2:{if(s)switch(s){case"BigInt":return r([s,o.toString()],o);case"Boolean":case"Number":case"String":return r([s,o.valueOf()],o)}if(t&&"toJSON"in o)return a(o.toJSON());const n=[],l=r([i,n],o);for(const t of Nz(o))!e&&Ez(Cz(o[t]))||n.push([a(t),a(o[t])]);return l}case 3:return r([i,o.toISOString()],o);case 4:{const{source:e,flags:t}=o;return r([i,{source:e,flags:t}],o)}case 5:{const t=[],n=r([i,t],o);for(const[r,i]of o)(e||!Ez(Cz(r))&&!Ez(Cz(i)))&&t.push([a(r),a(i)]);return n}case 6:{const t=[],n=r([i,t],o);for(const r of o)!e&&Ez(Cz(r))||t.push(a(r));return n}}const{message:l}=o;return r([i,{name:s,message:l}],o)};return a})(!(t||n),!!t,new Map,o)(e),o},_z="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?wz(jz(e,t)):structuredClone(e):(e,t)=>wz(jz(e,t));function Iz(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function Tz(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}const Az=function(e){if(null==e)return Oz;if("function"==typeof e)return Mz(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Az(e[n]);return Mz(o);function o(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}(e):function(e){const t=e;return Mz(n);function n(n){const o=n;let r;for(r in e)if(o[r]!==t[r])return!1;return!0}}(e);if("string"==typeof e)return function(e){return Mz(t);function t(t){return t&&t.type===e}}(e);throw new Error("Expected function, string, or object as test")};function Mz(e){return function(t,n,o){return Boolean(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,o||void 0))}}function Oz(){return!0}const Dz=[],Pz=!0,Rz=!1;function Lz(e,t,n,o){let r;"function"==typeof t&&"function"!=typeof n?(o=n,n=t):r=t;const a=Az(r),i=o?-1:1;!function e(r,s,l){const c=r&&"object"==typeof r?r:{};if("string"==typeof c.type){const e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(d,"name",{value:"node ("+r.type+(e?"<"+e+">":"")+")"})}return d;function d(){let c,d,u,h=Dz;if((!t||a(r,s,l[l.length-1]||void 0))&&(h=function(e){if(Array.isArray(e))return e;if("number"==typeof e)return[Pz,e];return null==e?Dz:[e]}(n(r,l)),h[0]===Rz))return h;if("children"in r&&r.children){const t=r;if(t.children&&"skip"!==h[0])for(d=(o?t.children.length:-1)+i,u=l.concat(t);d>-1&&d<t.children.length;){const n=t.children[d];if(c=e(n,d,u)(),c[0]===Rz)return c;d="number"==typeof c[1]?c[1]:d+i}}return h}}(e,void 0,[])()}function zz(e,t,n,o){let r,a,i;"function"==typeof t&&"function"!=typeof n?(a=void 0,i=t,r=n):(a=t,i=n,r=o),Lz(e,a,(function(e,t){const n=t[t.length-1],o=n?n.children.indexOf(e):void 0;return i(e,o,n)}),r)}const Fz={}.hasOwnProperty,Bz={};function Uz(e,t){e.position&&(t.position=function(e){const t=qP(e),n=GP(e);if(t&&n)return{start:t,end:n}}(e))}function Vz(e,t){let n=t;if(e&&e.data){const t=e.data.hName,o=e.data.hChildren,r=e.data.hProperties;if("string"==typeof t)if("element"===n.type)n.tagName=t;else{n={type:"element",tagName:t,properties:{},children:"children"in n?n.children:[n]}}"element"===n.type&&r&&Object.assign(n.properties,_z(r)),"children"in n&&n.children&&null!=o&&(n.children=o)}return n}function Hz(e,t){const n=t.data||{},o=!("value"in t)||Fz.call(n,"hProperties")||Fz.call(n,"hChildren")?{type:"element",tagName:"div",properties:{},children:e.all(t)}:{type:"text",value:t.value};return e.patch(t,o),e.applyData(t,o)}function $z(e,t){const n=[];let o=-1;for(t&&n.push({type:"text",value:"\n"});++o<e.length;)o&&n.push({type:"text",value:"\n"}),n.push(e[o]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function Wz(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function Gz(e,t){const n=function(e,t){const n=t||Bz,o=new Map,r=new Map,a=new Map,i={...vz,...n.handlers},s={all:function(e){const t=[];if("children"in e){const n=e.children;let o=-1;for(;++o<n.length;){const r=s.one(n[o],e);if(r){if(o&&"break"===n[o-1].type&&(Array.isArray(r)||"text"!==r.type||(r.value=Wz(r.value)),!Array.isArray(r)&&"element"===r.type)){const e=r.children[0];e&&"text"===e.type&&(e.value=Wz(e.value))}Array.isArray(r)?t.push(...r):t.push(r)}}}return t},applyData:Vz,definitionById:o,footnoteById:r,footnoteCounts:a,footnoteOrder:[],handlers:i,one:function(e,t){const n=e.type,o=s.handlers[n];if(Fz.call(s.handlers,n)&&o)return o(s,e,t);if(s.options.passThrough&&s.options.passThrough.includes(n)){if("children"in e){const{children:t,...n}=e,o=_z(n);return o.children=s.all(e),o}return _z(e)}return(s.options.unknownHandler||Hz)(s,e,t)},options:n,patch:Uz,wrap:$z};return zz(e,(function(e){if("definition"===e.type||"footnoteDefinition"===e.type){const t="definition"===e.type?o:r,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}})),s}(e,t),o=n.one(e,void 0),r=function(e){const t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Iz,o=e.options.footnoteBackLabel||Tz,r=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",i=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[];let l=-1;for(;++l<e.footnoteOrder.length;){const r=e.footnoteById.get(e.footnoteOrder[l]);if(!r)continue;const a=e.all(r),i=String(r.identifier).toUpperCase(),c=$R(i.toLowerCase());let d=0;const u=[],h=e.footnoteCounts.get(i);for(;void 0!==h&&++d<=h;){u.length>0&&u.push({type:"text",value:" "});let e="string"==typeof n?n:n(l,d);"string"==typeof e&&(e={type:"text",value:e}),u.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+c+(d>1?"-"+d:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof o?o:o(l,d),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}const f=a[a.length-1];if(f&&"element"===f.type&&"p"===f.tagName){const e=f.children[f.children.length-1];e&&"text"===e.type?e.value+=" ":f.children.push({type:"text",value:" "}),f.children.push(...u)}else a.push(...u);const m={type:"element",tagName:"li",properties:{id:t+"fn-"+c},children:e.wrap(a,!0)};e.patch(r,m),s.push(m)}if(0!==s.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{..._z(i),id:"footnote-label"},children:[{type:"text",value:r}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!0)},{type:"text",value:"\n"}]}}(n),a=Array.isArray(o)?{type:"root",children:o}:o||{type:"root",children:[]};return r&&a.children.push({type:"text",value:"\n"},r),a}function qz(e,t){return e&&"run"in e?async function(n,o){const r=Gz(n,{file:o,...t});await e.run(r,o)}:function(n,o){return Gz(n,{file:o,...e||t})}}function Yz(e){if(e)throw e}var Xz=Object.prototype.hasOwnProperty,Kz=Object.prototype.toString,Jz=Object.defineProperty,Zz=Object.getOwnPropertyDescriptor,Qz=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===Kz.call(e)},eF=function(e){if(!e||"[object Object]"!==Kz.call(e))return!1;var t,n=Xz.call(e,"constructor"),o=e.constructor&&e.constructor.prototype&&Xz.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!o)return!1;for(t in e);return void 0===t||Xz.call(e,t)},tF=function(e,t){Jz&&"__proto__"===t.name?Jz(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},nF=function(e,t){if("__proto__"===t){if(!Xz.call(e,t))return;if(Zz)return Zz(e,t).value}return e[t]};const oF=Os((function e(){var t,n,o,r,a,i,s=arguments[0],l=1,c=arguments.length,d=!1;for("boolean"==typeof s&&(d=s,s=arguments[1]||{},l=2),(null==s||"object"!=typeof s&&"function"!=typeof s)&&(s={});l<c;++l)if(null!=(t=arguments[l]))for(n in t)o=nF(s,n),s!==(r=nF(t,n))&&(d&&r&&(eF(r)||(a=Qz(r)))?(a?(a=!1,i=o&&Qz(o)?o:[]):i=o&&eF(o)?o:{},tF(s,{name:n,newValue:e(d,i,r)})):void 0!==r&&tF(s,{name:n,newValue:r}));return s}));function rF(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}function aF(){const e=[],t={run:function(...t){let n=-1;const o=t.pop();if("function"!=typeof o)throw new TypeError("Expected function as last argument, not "+o);!function r(a,...i){const s=e[++n];let l=-1;if(a)o(a);else{for(;++l<t.length;)null!==i[l]&&void 0!==i[l]||(i[l]=t[l]);t=i,s?function(e,t){let n;return o;function o(...t){const o=e.length>t.length;let s;o&&t.push(r);try{s=e.apply(this,t)}catch(a){if(o&&n)throw a;return r(a)}o||(s&&s.then&&"function"==typeof s.then?s.then(i,r):s instanceof Error?r(s):i(s))}function r(e,...o){n||(n=!0,t(e,...o))}function i(e){r(null,e)}}(s,r)(...i):o(null,...i)}}(null,...t)},use:function(n){if("function"!=typeof n)throw new TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}const iF={basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');sF(e);let n,o=0,r=-1,a=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;a--;)if(47===e.codePointAt(a)){if(n){o=a+1;break}}else r<0&&(n=!0,r=a+1);return r<0?"":e.slice(o,r)}if(t===e)return"";let i=-1,s=t.length-1;for(;a--;)if(47===e.codePointAt(a)){if(n){o=a+1;break}}else i<0&&(n=!0,i=a+1),s>-1&&(e.codePointAt(a)===t.codePointAt(s--)?s<0&&(r=a):(s=-1,r=i));o===r?r=i:r<0&&(r=e.length);return e.slice(o,r)},dirname:function(e){if(sF(e),0===e.length)return".";let t,n=-1,o=e.length;for(;--o;)if(47===e.codePointAt(o)){if(t){n=o;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},extname:function(e){sF(e);let t,n=e.length,o=-1,r=0,a=-1,i=0;for(;n--;){const s=e.codePointAt(n);if(47!==s)o<0&&(t=!0,o=n+1),46===s?a<0?a=n:1!==i&&(i=1):a>-1&&(i=-1);else if(t){r=n+1;break}}if(a<0||o<0||0===i||1===i&&a===o-1&&a===r+1)return"";return e.slice(a,o)},join:function(...e){let t,n=-1;for(;++n<e.length;)sF(e[n]),e[n]&&(t=void 0===t?e[n]:t+"/"+e[n]);return void 0===t?".":function(e){sF(e);const t=47===e.codePointAt(0);let n=function(e,t){let n,o,r="",a=0,i=-1,s=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.codePointAt(l);else{if(47===n)break;n=47}if(47===n){if(i===l-1||1===s);else if(i!==l-1&&2===s){if(r.length<2||2!==a||46!==r.codePointAt(r.length-1)||46!==r.codePointAt(r.length-2))if(r.length>2){if(o=r.lastIndexOf("/"),o!==r.length-1){o<0?(r="",a=0):(r=r.slice(0,o),a=r.length-1-r.lastIndexOf("/")),i=l,s=0;continue}}else if(r.length>0){r="",a=0,i=l,s=0;continue}t&&(r=r.length>0?r+"/..":"..",a=2)}else r.length>0?r+="/"+e.slice(i+1,l):r=e.slice(i+1,l),a=l-i-1;i=l,s=0}else 46===n&&s>-1?s++:s=-1}return r}(e,!t);0!==n.length||t||(n=".");n.length>0&&47===e.codePointAt(e.length-1)&&(n+="/");return t?"/"+n:n}(t)},sep:"/"};function sF(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const lF={cwd:function(){return"/"}};function cF(e){return Boolean(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}function dF(e){if("string"==typeof e)e=new URL(e);else if(!cF(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){const e=new TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}const t=e.pathname;let n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){const e=t.codePointAt(n+2);if(70===e||102===e){const e=new TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}const uF=["history","path","basename","stem","extname","dirname"];class hF{constructor(e){let t;t=e?cF(e)?{path:e}:"string"==typeof e||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":lF.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n,o=-1;for(;++o<uF.length;){const e=uF[o];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)uF.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?iF.basename(this.path):void 0}set basename(e){mF(e,"basename"),fF(e,"basename"),this.path=iF.join(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?iF.dirname(this.path):void 0}set dirname(e){pF(this.basename,"dirname"),this.path=iF.join(e||"",this.basename)}get extname(){return"string"==typeof this.path?iF.extname(this.path):void 0}set extname(e){if(fF(e,"extname"),pF(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=iF.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){cF(e)&&(e=dF(e)),mF(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?iF.basename(this.path,this.extname):void 0}set stem(e){mF(e,"stem"),fF(e,"stem"),this.path=iF.join(this.dirname||"",e+(this.extname||""))}fail(e,t,n){const o=this.message(e,t,n);throw o.fatal=!0,o}info(e,t,n){const o=this.message(e,t,n);return o.fatal=void 0,o}message(e,t,n){const o=new QP(e,t,n);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(e){if(void 0===this.value)return"";if("string"==typeof this.value)return this.value;return new TextDecoder(e||void 0).decode(this.value)}}function fF(e,t){if(e&&e.includes(iF.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+iF.sep+"`")}function mF(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function pF(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}const gF=function(e){const t=this.constructor.prototype,n=t[e],o=function(){return n.apply(o,arguments)};return Object.setPrototypeOf(o,t),o},yF={}.hasOwnProperty;class vF extends gF{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=aF()}copy(){const e=new vF;let t=-1;for(;++t<this.attachers.length;){const n=this.attachers[t];e.use(...n)}return e.data(oF(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2===arguments.length?(kF("data",this.frozen),this.namespace[e]=t,this):yF.call(this.namespace,e)&&this.namespace[e]||void 0:e?(kF("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...n]=this.attachers[this.freezeIndex];if(!1===n[0])continue;!0===n[0]&&(n[0]=void 0);const o=t.call(e,...n);"function"==typeof o&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const t=CF(e),n=this.parser||this.Parser;return bF("parse",n),n(String(t),t)}process(e,t){const n=this;return this.freeze(),bF("process",this.parser||this.Parser),wF("process",this.compiler||this.Compiler),t?o(void 0,t):new Promise(o);function o(o,r){const a=CF(e),i=n.parse(a);function s(e,n){e||!n?r(e):o?o(n):t(void 0,n)}n.run(i,a,(function(e,t,o){if(e||!t||!o)return s(e);const r=t,a=n.stringify(r,o);var i;"string"==typeof(i=a)||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(i)?o.value=a:o.result=a,s(e,o)}))}}processSync(e){let t,n=!1;return this.freeze(),bF("processSync",this.parser||this.Parser),wF("processSync",this.compiler||this.Compiler),this.process(e,(function(e,o){n=!0,Yz(e),t=o})),NF("processSync","process",n),t}run(e,t,n){SF(e),this.freeze();const o=this.transformers;return n||"function"!=typeof t||(n=t,t=void 0),n?r(void 0,n):new Promise(r);function r(r,a){const i=CF(t);o.run(e,i,(function(t,o,i){const s=o||e;t?a(t):r?r(s):n(void 0,s,i)}))}}runSync(e,t){let n,o=!1;return this.run(e,t,(function(e,t){Yz(e),n=t,o=!0})),NF("runSync","run",o),n}stringify(e,t){this.freeze();const n=CF(t),o=this.compiler||this.Compiler;return wF("stringify",o),SF(e),o(e,n)}use(e,...t){const n=this.attachers,o=this.namespace;if(kF("use",this.frozen),null==e);else if("function"==typeof e)s(e,t);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?i(e):a(e)}return this;function r(e){if("function"==typeof e)s(e,[]);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");if(Array.isArray(e)){const[t,...n]=e;s(t,n)}else a(e)}}function a(e){if(!("plugins"in e)&&!("settings"in e))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");i(e.plugins),e.settings&&(o.settings=oF(!0,o.settings,e.settings))}function i(e){let t=-1;if(null==e);else{if(!Array.isArray(e))throw new TypeError("Expected a list of plugins, not `"+e+"`");for(;++t<e.length;){r(e[t])}}}function s(e,t){let o=-1,r=-1;for(;++o<n.length;)if(n[o][0]===e){r=o;break}if(-1===r)n.push([e,...t]);else if(t.length>0){let[o,...a]=t;const i=n[r][1];rF(i)&&rF(o)&&(o=oF(!0,i,o)),n[r]=[e,o,...a]}}}}const xF=(new vF).freeze();function bF(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `parser`")}function wF(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `compiler`")}function kF(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function SF(e){if(!rF(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function NF(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function CF(e){return function(e){return Boolean(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new hF(e)}const EF=[],jF={allowDangerousHtml:!0},_F=/^(https?|ircs?|mailto|xmpp)$/i,IF=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function TF(e){const t=e.allowedElements,n=e.allowElement,o=e.children||"",r=e.className,a=e.components,i=e.disallowedElements,s=e.rehypePlugins||EF,l=e.remarkPlugins||EF,c=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...jF}:jF,d=e.skipHtml,u=e.unwrapDisallowed,h=e.urlTransform||AF,f=xF().use(fz).use(l).use(qz,c).use(s),m=new hF;"string"==typeof o&&(m.value=o);for(const y of IF)Object.hasOwn(e,y.from)&&(y.from,y.to&&y.to,y.id);const p=f.parse(m);let g=f.runSync(p,m);return r&&(g={type:"element",tagName:"div",properties:{className:r},children:"root"===g.type?g.children:[g]}),zz(g,(function(e,o,r){if("raw"===e.type&&r&&"number"==typeof o)return d?r.children.splice(o,1):r.children[o]={type:"text",value:e.value},o;if("element"===e.type){let t;for(t in vR)if(Object.hasOwn(vR,t)&&Object.hasOwn(e.properties,t)){const n=e.properties[t],o=vR[t];(null===o||o.includes(e.tagName))&&(e.properties[t]=h(String(n||""),t,e))}}if("element"===e.type){let a=t?!t.includes(e.tagName):!!i&&i.includes(e.tagName);if(!a&&n&&"number"==typeof o&&(a=!n(e,o,r)),a&&r&&"number"==typeof o)return u&&e.children?r.children.splice(o,1,...e.children):r.children.splice(o,1),o}})),sR(g,{Fragment:C.Fragment,components:a,ignoreInvalidStyle:!0,jsx:C.jsx,jsxs:C.jsxs,passKeys:!0,passNode:!0})}function AF(e){const t=e.indexOf(":"),n=e.indexOf("?"),o=e.indexOf("#"),r=e.indexOf("/");return t<0||r>-1&&t>r||n>-1&&t>n||o>-1&&t>o||_F.test(e.slice(0,t))?e:""}const MF=[Qt.lineWrapping],OF=new Set(["python","markdown","sql","json","yaml","toml","shell","javascript","typescript","jsx","tsx","css","html"]);const DF=e=>{const t=S(26),{code:n,language:o}=e,{theme:a}=je(),{createNewCell:i}=L(),s=Jd(),l=ee(re),[c,d]=r.useState(n);let u,h,f;t[0]!==n?(u=()=>{d(n)},h=[n],t[0]=n,t[1]=u,t[2]=h):(u=t[1],h=t[2]),r.useEffect(u,h),t[3]!==o||t[4]!==c||t[5]!==l||t[6]!==i||t[7]!==s?(f=()=>{const e=function(e,t){return e?"python"===e?{language:e,code:t}:"sql"===e?{language:"python",code:cr.fromQuery(t)}:"markdown"===e?{language:"python",code:lr.fromMarkdown(t)}:"shell"===e||"bash"===e?{language:"python",code:`import subprocess\nsubprocess.run("${t}")`}:{language:"python",code:`_${e} = """\n${t}\n"""`}:{language:"python",code:t}}(o,c);"sql"===o&&$d(l,i,s),i({code:e.code,before:!1,cellId:s??"__end__"})},t[3]=o,t[4]=c,t[5]=l,t[6]=i,t[7]=s,t[8]=f):f=t[8];const m=f;let p;t[9]!==c?(p=async()=>{await Je(c)},t[9]=c,t[10]=p):p=t[10];const g=p,y="dark"===a?"dark":"light",v=o&&OF.has(o)?o:void 0;let x,b,w,k,N,E;return t[11]!==y||t[12]!==v||t[13]!==c?(x=C.jsx(as,{theme:y,language:v,className:"cm border rounded overflow-hidden",extensions:MF,value:c,onChange:d}),t[11]=y,t[12]=v,t[13]=c,t[14]=x):x=t[14],t[15]!==g?(b=C.jsx(W,{size:"xs",variant:"outline",onClick:g,children:"Copy"}),t[15]=g,t[16]=b):b=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(w=C.jsx(sc,{className:"ml-2 h-4 w-4"}),t[17]=w):w=t[17],t[18]!==m?(k=C.jsxs(W,{size:"xs",variant:"outline",onClick:m,children:["Add to Notebook",w]}),t[18]=m,t[19]=k):k=t[19],t[20]!==b||t[21]!==k?(N=C.jsxs("div",{className:"flex justify-end mt-2 space-x-2",children:[b,k]}),t[20]=b,t[21]=k,t[22]=N):N=t[22],t[23]!==x||t[24]!==N?(E=C.jsxs("div",{className:"relative",children:[x,N]}),t[23]=x,t[24]=N,t[25]=E):E=t[25],E},PF={code:({children:e,className:t})=>{const n=null==t?void 0:t.replace("language-","");return n&&"string"==typeof e?C.jsxs("div",{children:[C.jsx("div",{className:"text-xs text-muted-foreground pl-1",children:n}),C.jsx(DF,{code:e.trim(),language:n})]}):C.jsx("code",{className:t,children:e})}},RF=e=>{const t=S(2),{content:n}=e;let o;return t[0]!==n?(o=C.jsx(TF,{components:PF,className:"prose dark:prose-invert max-w-none prose-pre:pl-0",children:n}),t[0]=n,t[1]=o):o=t[1],o},LF=(e,t,n,o)=>t?{...e,chats:e.chats.map((e=>e.id===t?{...e,messages:[...e.messages,{role:n,content:o,timestamp:Date.now()}],updatedAt:Date.now()}:e))}:e,zF=()=>{var e;const t=S(92),[n,o]=Me(Fd),[a,i]=Me(Bd);let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={},t[0]=s):s=t[0];const[l,c]=r.useState(s),[d,u]=r.useState(""),h=r.useRef(null),f=r.useRef(null),m=r.useRef(null),{theme:p}=je();let g,y,v,x,b,w;t[1]===Symbol.for("react.memo_cache_sentinel")?(g=aa("api/ai/chat").toString(),y=ia.headers(),t[1]=g,t[2]=y):(g=t[1],y=t[2]),t[3]===Symbol.for("react.memo_cache_sentinel")?(v=Zs(""),t[3]=v):v=t[3],t[4]!==l?(x={...l,includeOtherCode:v},t[4]=l,t[5]=x):x=t[5],t[6]!==n.activeChatId||t[7]!==o?(b=e=>{n.activeChatId?o((t=>LF(t,t.activeChatId,"assistant",e.content))):V.warn("No active chat")},t[6]=n.activeChatId,t[7]=o,t[8]=b):b=t[8],t[9]!==x||t[10]!==b?(w={keepLastMessageOnError:!0,api:g,headers:y,body:x,streamProtocol:"text",onFinish:b,onError:FF,onResponse:BF},t[9]=x,t[10]=b,t[11]=w):w=t[11];const{messages:k,input:N,setInput:E,setMessages:j,append:_,handleSubmit:I,error:T,isLoading:A,reload:M}=Ds(w);let O;t[12]!==E||t[13]!==k?(O=e=>{E(e);const t=k.map((e=>e.content)).join("\n");c(Sw(`${t}\n\n${e}`))},t[12]=E,t[13]=k,t[14]=O):O=t[14];const D=O;let P;t[15]!==k?(P=null==(e=k.at(-1))?void 0:e.content,t[15]=k,t[16]=P):P=t[16];const R=P;let L,z,F;t[17]!==A?(L=()=>{var e;A&&(null==(e=m.current)||e.scrollIntoView({behavior:"smooth"}))},t[17]=A,t[18]=L):L=t[18],t[19]!==k||t[20]!==A||t[21]!==R?(z=[k,A,R],t[19]=k,t[20]=A,t[21]=R,t[22]=z):z=t[22],r.useEffect(L,z),t[23]!==o||t[24]!==j||t[25]!==D||t[26]!==_?(F=e=>{const t={id:Ps(),title:`${e.slice(0,30)}...`,messages:[{role:"user",content:e,timestamp:Date.now()}],createdAt:Date.now(),updatedAt:Date.now()};o((e=>({chats:[...e.chats,t],activeChatId:t.id})));const n=Sw(e);c(n),j([]),D(""),_({role:"user",content:e},{body:{...n,includeOtherCode:Zs("")}})},t[23]=o,t[24]=j,t[25]=D,t[26]=_,t[27]=F):F=t[27];const B=F;let U,H,$,G,q,Y,X,K,J,Z,Q,ee,te,ne,oe;if(t[28]!==i||t[29]!==j||t[30]!==D?(U=()=>{i(null),j([]),D(""),u("")},t[28]=i,t[29]=j,t[30]=D,t[31]=U):U=t[31],t[32]===Symbol.for("react.memo_cache_sentinel")?(H=C.jsx(sr,{className:"h-4 w-4"}),t[32]=H):H=t[32],t[33]!==U?($=C.jsx(et,{content:"New chat",children:C.jsx(W,{variant:"text",size:"icon",onClick:U,children:H})}),t[33]=U,t[34]=$):$=t[34],t[35]===Symbol.for("react.memo_cache_sentinel")?(G=C.jsx(et,{content:"Previous chats",children:C.jsx(Br,{asChild:!0,children:C.jsx(W,{variant:"text",size:"icon",children:C.jsx(Rs,{className:"h-4 w-4"})})})}),t[35]=G):G=t[35],t[36]!==a||t[37]!==i||t[38]!==j||t[39]!==n.chats){let e;t[41]!==a||t[42]!==i||t[43]!==j?(e=e=>C.jsxs("div",{className:hn("p-3 rounded-md cursor-pointer hover:bg-accent",e.id===(null==a?void 0:a.id)&&"bg-accent"),onClick:()=>{i(e.id),j(e.messages.map((e=>{const{role:t,content:n,timestamp:o}=e;return{role:t,content:n,id:o.toString()}})))},children:[C.jsx("div",{className:"font-medium",children:e.title}),C.jsx("div",{className:"text-sm text-muted-foreground",children:new Date(e.updatedAt).toLocaleString()})]},e.id),t[41]=a,t[42]=i,t[43]=j,t[44]=e):e=t[44],q=n.chats.map(e),t[36]=a,t[37]=i,t[38]=j,t[39]=n.chats,t[40]=q}else q=t[40];if(t[45]!==q?(Y=C.jsxs(yn,{children:[G,C.jsx(gn,{className:"w-[520px] p-0",align:"start",side:"right",children:C.jsx(nP,{className:"h-[500px] p-4",children:C.jsx("div",{className:"space-y-4",children:q})})})]}),t[45]=q,t[46]=Y):Y=t[46],t[47]!==$||t[48]!==Y?(X=C.jsxs("div",{className:"flex border-b px-2 py-1 justify-between flex-shrink-0",children:[$,Y]}),t[47]=$,t[48]=Y,t[49]=X):X=t[49],t[50]!==k||t[51]!==d||t[52]!==B||t[53]!==p?(K=(!k||0===k.length)&&C.jsx("div",{className:"flex rounded-md border px-1 bg-background",children:C.jsx(_w,{value:d,placeholder:"Ask anything, @ to include context",theme:p,onClose:()=>{var e,t;return null==(t=null==(e=h.current)?void 0:e.editor)?void 0:t.blur()},onChange:u,onSubmit:()=>d.trim()&&B(d.trim())},"new-thread-input")}),t[50]=k,t[51]=d,t[52]=B,t[53]=p,t[54]=K):K=t[54],t[55]!==p||t[56]!==j||t[57]!==_||t[58]!==n.activeChatId||t[59]!==o||t[60]!==k){let e;t[62]!==p||t[63]!==j||t[64]!==_||t[65]!==n.activeChatId||t[66]!==o?(e=(e,t)=>C.jsx("div",{className:hn("flex","user"===e.role?"justify-end":"justify-start"),children:"user"===e.role?C.jsx("div",{className:"w-[95%] bg-background border p-1 rounded-sm",children:C.jsx(_w,{value:e.content,theme:p,placeholder:"Type your message...",onChange:()=>{},onSubmit:(e,r)=>{r.trim()&&(j((e=>e.slice(0,t))),c(Sw(r)),_({role:"user",content:r}),n.activeChatId&&o((e=>LF(e,n.activeChatId,"user",r))))},onClose:()=>{}},e.id)}):C.jsx("div",{className:"w-[95%]",children:C.jsx(RF,{content:e.content})})},t),t[62]=p,t[63]=j,t[64]=_,t[65]=n.activeChatId,t[66]=o,t[67]=e):e=t[67],J=k.map(e),t[55]=p,t[56]=j,t[57]=_,t[58]=n.activeChatId,t[59]=o,t[60]=k,t[61]=J}else J=t[61];return t[68]!==A?(Z=A&&C.jsx("div",{className:"flex justify-center py-4",children:C.jsx(ua,{className:"h-4 w-4 animate-spin"})}),t[68]=A,t[69]=Z):Z=t[69],t[70]!==T||t[71]!==M?(Q=T&&C.jsxs("div",{className:"flex items-center justify-center space-x-2 mb-4",children:[C.jsx(Qi,{error:T}),C.jsx(W,{variant:"outline",size:"sm",onClick:()=>M(),children:"Retry"})]}),t[70]=T,t[71]=M,t[72]=Q):Q=t[72],t[73]===Symbol.for("react.memo_cache_sentinel")?(ee=C.jsx("div",{ref:m}),t[73]=ee):ee=t[73],t[74]!==K||t[75]!==J||t[76]!==Z||t[77]!==Q?(te=C.jsxs("div",{className:"flex-1 px-3 bg-[var(--slate-1)] gap-4 py-3 flex flex-col overflow-y-auto",children:[K,J,Z,Q,ee]}),t[74]=K,t[75]=J,t[76]=Z,t[77]=Q,t[78]=te):te=t[78],t[79]!==k||t[80]!==A||t[81]!==I||t[82]!==n||t[83]!==o||t[84]!==N||t[85]!==D||t[86]!==p?(ne=k&&k.length>0&&C.jsxs("div",{className:"px-2 py-3 border-t relative flex-shrink-0 min-h-[80px]",children:[A&&C.jsx("div",{className:"flex justify-center mb-2 absolute -top-10 left-0 right-0",children:C.jsx(W,{variant:"secondary",size:"xs",onClick:UF,className:"text-muted-foreground hover:text-foreground",children:"Cancel"})}),C.jsx(_w,{value:N,onChange:D,onSubmit:(e,t)=>{t.trim()&&(I(e),n.activeChatId&&o((e=>LF(e,n.activeChatId,"user",t))))},onClose:()=>{var e,t;return null==(t=null==(e=f.current)?void 0:e.editor)?void 0:t.blur()},theme:p,placeholder:"Type your message..."})]}),t[79]=k,t[80]=A,t[81]=I,t[82]=n,t[83]=o,t[84]=N,t[85]=D,t[86]=p,t[87]=ne):ne=t[87],t[88]!==X||t[89]!==te||t[90]!==ne?(oe=C.jsxs("div",{className:"flex flex-col h-[calc(100%-53px)]",children:[X,te,ne]}),t[88]=X,t[89]=te,t[90]=ne,t[91]=oe):oe=t[91],oe};function FF(e){V.error("An error occurred:",e)}function BF(e){V.debug("Received HTTP response from server:",e)}function UF(){return stop()}const VF="hoveredCellId",HF="cellHover",$F="cellNum",WF="startTimestamp",GF="endTimestamp";const qF=H(new Map),YF=()=>{const e=S(28),{runIds:t,runMap:n}=ee(Gl),o=ee(qF),{clearRuns:a}=ql(),{theme:i}=je(),[s,l]=r.useState("above");let c;e[0]!==s?(c=()=>{l("above"===s?"sideBySide":"above")},e[0]=s,e[1]=c):c=e[1];const d=c;if(0===t.length){let t;return e[2]===Symbol.for("react.memo_cache_sentinel")?(t=C.jsx(SN,{title:"No traces",description:C.jsx("span",{children:"Cells that have ran will appear here."}),icon:C.jsx(Hs,{})}),e[2]=t):t=e[2],t}let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=C.jsx("label",{htmlFor:"chartPosition",className:"text-xs",children:"Inline chart"}),e[3]=u):u=e[3];const h="sideBySide"===s;let f,m,p,g,y,v;if(e[4]!==d||e[5]!==h?(f=C.jsxs("div",{className:"flex flex-row gap-1 items-center",children:[u,C.jsx("input",{type:"checkbox",name:"chartPosition",id:"chartPosition",onClick:d,defaultChecked:h,className:"h-3 cursor-pointer"})]}),e[4]=d,e[5]=h,e[6]=f):f=e[6],e[7]!==a?(m=C.jsx($M,{dataTestId:"clear-traces-button",onClick:a}),e[7]=a,e[8]=m):m=e[8],e[9]!==f||e[10]!==m?(p=C.jsxs("div",{className:"flex flex-row justify-end gap-3",children:[f,m]}),e[9]=f,e[10]=m,e[11]=p):p=e[11],e[12]!==n||e[13]!==o||e[14]!==s||e[15]!==i||e[16]!==t){let r;e[18]!==n||e[19]!==o||e[20]!==s||e[21]!==i?(r=(e,t)=>{const r=n.get(e);if(r)return C.jsx(JF,{run:r,isExpanded:o.get(r.runId),isMostRecentRun:0===t,chartPosition:s,theme:i},r.runId)},e[18]=n,e[19]=o,e[20]=s,e[21]=i,e[22]=r):r=e[22],g=t.map(r),e[12]=n,e[13]=o,e[14]=s,e[15]=i,e[16]=t,e[17]=g}else g=e[17];return e[23]!==g?(y=C.jsx("div",{className:"flex flex-col gap-3",children:g}),e[23]=g,e[24]=y):y=e[24],e[25]!==p||e[26]!==y?(v=C.jsxs("div",{className:"py-1 px-2 overflow-y-scroll",children:[p,y]}),e[25]=p,e[26]=y,e[27]=v):v=e[27],v},XF=u.lazy((()=>ws((()=>import("./index-InxjuO9N.js")),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]),import.meta.url).then((e=>({default:e.Vega}))))),KF=e=>{const t=S(10),{ref:n,width:o}=JM(),r=void 0===o?300:o,a="dark"===e.theme?"dark":void 0,i=r-50;let s,l;return t[0]!==e.vegaSpec||t[1]!==e.height||t[2]!==e.signalListeners||t[3]!==a||t[4]!==i?(s=C.jsx(XF,{spec:e.vegaSpec,theme:a,width:i,height:e.height,signalListeners:e.signalListeners,actions:!1}),t[0]=e.vegaSpec,t[1]=e.height,t[2]=e.signalListeners,t[3]=a,t[4]=i,t[5]=s):s=t[5],t[6]!==e.className||t[7]!==n||t[8]!==s?(l=C.jsx("div",{className:e.className,ref:n,children:s}),t[6]=e.className,t[7]=n,t[8]=s,t[9]=l):l=t[9],l},JF=({run:e,isMostRecentRun:t,chartPosition:n,isExpanded:o,theme:r})=>{const a=ne(qF),i=(o=o??t)?ve:Ca,s=C.jsx(i,{height:16,className:"inline"}),l=C.jsxs("span",{className:"text-sm cursor-pointer",onClick:()=>{a((t=>{const n=new Map(t);return n.set(e.runId,!o),n}))},children:["Run - ",Ki(e.runStartTime),s]});return o?C.jsx(ZF,{run:e,chartPosition:n,theme:r,title:l},e.runId):C.jsx("div",{className:"flex flex-col",children:C.jsx("pre",{className:"font-mono font-semibold",children:l})},e.runId)},ZF=e=>{const t=S(34),{run:n,chartPosition:o,theme:a,title:i}=e,[s,l]=r.useState();let c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c={[HF]:(e,t)=>{var n;const o=null==(n=t.cell)?void 0:n[0];l(o??null)}},t[0]=c):c=t[0];const d=c,u=ae();let h,f;if(t[1]!==u.inOrderIds||t[2]!==n.cellRuns||t[3]!==n.runId||t[4]!==o||t[5]!==a){let e;t[8]!==u.inOrderIds?(e=e=>{const t=e.elapsedTime??0;return{cell:e.cellId,cellNum:u.inOrderIds.indexOf(e.cellId),startTimestamp:nB(e.startTime),endTimestamp:nB(e.startTime+t),elapsedTime:jy(1e3*t),status:e.status}},t[8]=u.inOrderIds,t[9]=e):e=t[9];const r=n.cellRuns.map(e);f=`hiddenInputElement-${n.runId}`,h=ec(function(e,t,n,o){return{$schema:"https://vega.github.io/schema/vega-lite/v5.json",background:"dark"===o?"black":void 0,mark:{type:"bar",cornerRadius:2},params:[{name:VF,bind:{element:`#${t}`}},{name:HF,select:{type:"point",on:"mouseover",fields:["cell"],clear:"mouseout"}}],height:{step:23},encoding:{y:{field:$F,scale:{paddingInner:.2},sort:{field:$F},title:"cell",axis:"sideBySide"===n?null:void 0},x:{field:WF,type:"temporal",axis:{orient:"top",title:null}},x2:{field:GF,type:"temporal"},tooltip:[{field:WF,type:"temporal",timeUnit:"dayhoursminutesseconds",title:"Start"},{field:GF,type:"temporal",timeUnit:"dayhoursminutesseconds",title:"End"}],size:{value:{expr:`${VF} == toString(datum.cell) ? 19.5 : 18`}},color:{field:"status",scale:{domain:["success","error"],range:["#37BE5F","red"]},legend:null}},data:{values:e},config:{view:{stroke:"transparent"}}}}(r,f,o,a)),t[1]=u.inOrderIds,t[2]=n.cellRuns,t[3]=n.runId,t[4]=o,t[5]=a,t[6]=h,t[7]=f}else h=t[6],f=t[7];const m=h.spec;let p;t[10]!==n||t[11]!==s||t[12]!==f?(p=C.jsx(QF,{run:n,hoveredCellId:s,hiddenInputElementId:f}),t[10]=n,t[11]=s,t[12]=f,t[13]=p):p=t[13];const g=p;if("above"===o){let e,o,r;return t[14]!==m||t[15]!==a?(e=C.jsx(KF,{vegaSpec:m,height:120,signalListeners:d,theme:a}),t[14]=m,t[15]=a,t[16]=e):e=t[16],t[17]!==i||t[18]!==e||t[19]!==g?(o=C.jsxs("pre",{className:"font-mono font-semibold",children:[i,e,g]}),t[17]=i,t[18]=e,t[19]=g,t[20]=o):o=t[20],t[21]!==n.runId||t[22]!==o?(r=C.jsx("div",{className:"flex flex-col",children:o},n.runId),t[21]=n.runId,t[22]=o,t[23]=r):r=t[23],r}let y,v,x;return t[24]!==i||t[25]!==g?(y=C.jsxs("pre",{className:"font-mono font-semibold",children:[i,g]}),t[24]=i,t[25]=g,t[26]=y):y=t[26],t[27]!==m||t[28]!==a?(v=C.jsx(KF,{className:"-mt-0.5 flex-1",vegaSpec:m,height:100,signalListeners:d,theme:a}),t[27]=m,t[28]=a,t[29]=v):v=t[29],t[30]!==n.runId||t[31]!==y||t[32]!==v?(x=C.jsxs("div",{className:"flex flex-row",children:[y,v]},n.runId),t[30]=n.runId,t[31]=y,t[32]=v,t[33]=x):x=t[33],x},QF=e=>{const t=S(12),{run:n,hoveredCellId:o,hiddenInputElementId:a}=e,i=r.useRef(null);let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=e=>{i.current&&(i.current.value=String(e),i.current.dispatchEvent(new Event("input",{bubbles:!0})))},t[0]=s):s=t[0];const l=s,c=o||"";let d,u,h;if(t[1]!==a||t[2]!==c?(d=C.jsx("input",{type:"text",id:a,defaultValue:c,hidden:!0,ref:i}),t[1]=a,t[2]=c,t[3]=d):d=t[3],t[4]!==o||t[5]!==n.cellRuns){let e;t[7]!==o?(e=e=>C.jsx(tB,{cellRun:e,hovered:e.cellId===o,dispatchHoverEvent:l},e.cellId),t[7]=o,t[8]=e):e=t[8],u=n.cellRuns.map(e),t[4]=o,t[5]=n.cellRuns,t[6]=u}else u=t[6];return t[9]!==d||t[10]!==u?(h=C.jsxs("div",{className:"text-xs mt-0.5 ml-3 flex flex-col gap-0.5",children:[d,u]}),t[9]=d,t[10]=u,t[11]=h):h=t[11],h},eB={success:C.jsx(hc,{color:"green",size:14}),running:C.jsx(ml,{color:"var(--blue-10)",size:14}),error:C.jsx(fe,{color:"red",size:14}),queued:C.jsx(fc,{color:"grey",size:14})},tB=e=>{const t=S(39),{cellRun:n,hovered:o,dispatchHoverEvent:r}=e;let a;t[0]!==n.elapsedTime?(a=n.elapsedTime?jy(1e3*n.elapsedTime):"-",t[0]=n.elapsedTime,t[1]=a):a=t[1];const i=a;let s;t[2]!==n.elapsedTime||t[3]!==i?(s=n.elapsedTime?C.jsxs("span",{children:["This cell took ",C.jsx(Cy,{elapsedTime:i})," to run"]}):C.jsx("span",{children:"This cell has not been run"}),t[2]=n.elapsedTime,t[3]=i,t[4]=s):s=t[4];const l=s;let c;t[5]!==r||t[6]!==n.cellId?(c=()=>{r(n.cellId)},t[5]=r,t[6]=n.cellId,t[7]=c):c=t[7];const d=c;let u;t[8]!==r?(u=()=>{r(null)},t[8]=r,t[9]=u):u=t[9];const h=u,f=o&&"bg-[var(--gray-3)] opacity-100";let m,p,g,y,v,x,b;t[10]!==f?(m=hn("flex flex-row gap-2 py-1 px-1 opacity-70 hover:bg-[var(--gray-3)] hover:opacity-100",f),t[10]=f,t[11]=m):m=t[11],t[12]!==n.startTime?(p=Ki(n.startTime),t[12]=n.startTime,t[13]=p):p=t[13],t[14]!==p?(g=C.jsxs("span",{className:"text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",p,"]"]}),t[14]=p,t[15]=g):g=t[15],t[16]!==n.cellId?(y=C.jsxs("span",{className:"text-[var(--gray-10)] w-16",children:["(",C.jsx(ji,{cellId:n.cellId}),")"]}),t[16]=n.cellId,t[17]=y):y=t[17],t[18]!==n.code?(v=C.jsx("span",{className:"w-40 truncate -ml-1",children:n.code}),t[18]=n.code,t[19]=v):v=t[19],t[20]!==i?(x=C.jsx("span",{className:"text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:i}),t[20]=i,t[21]=x):x=t[21],t[22]!==l||t[23]!==x?(b=C.jsx(et,{content:l,children:x}),t[22]=l,t[23]=x,t[24]=b):b=t[24];const w=eB[n.status];let k,N,E;return t[25]!==n.status||t[26]!==w?(k=C.jsx(et,{content:n.status,children:w}),t[25]=n.status,t[26]=w,t[27]=k):k=t[27],t[28]!==b||t[29]!==k?(N=C.jsxs("div",{className:"flex flex-row gap-1 w-16 justify-end -ml-2",children:[b,k]}),t[28]=b,t[29]=k,t[30]=N):N=t[30],t[31]!==m||t[32]!==d||t[33]!==h||t[34]!==g||t[35]!==y||t[36]!==v||t[37]!==N?(E=C.jsxs("div",{className:m,onMouseEnter:d,onMouseLeave:h,children:[g,y,v,N]}),t[31]=m,t[32]=d,t[33]=h,t[34]=g,t[35]=y,t[36]=v,t[37]=N,t[38]=E):E=t[38],E};function nB(e){try{const t=new Date(1e3*e),n=t.getFullYear(),o=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),a=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),s=String(t.getSeconds()).padStart(2,"0");return`${n}-${o}-${r} ${a}:${i}:${s}.${String(t.getMilliseconds()).padStart(3,"0")}`}catch{return""}}const oB=()=>{const e=S(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=C.jsx(YF,{}),e[0]=t):t=e[0],t},rB=u.lazy((()=>ws((()=>import("./terminal-DT3AvaZJ.js")),__vite__mapDeps([14,2,3,15,16]),import.meta.url))),aB=e=>{const t=S(118),{children:n}=e,{isSidebarOpen:o,isTerminalOpen:a,selectedPanel:i}=mu(),{setIsSidebarOpen:s,setIsTerminalOpen:l}=pu(),c=u.useRef(null),d=u.useRef(null);let h,f,m,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"))}))}))},f=[o],t[0]=o,t[1]=h,t[2]=f):(h=t[1],f=t[2]),r.useEffect(h,f),t[3]!==a?(m=()=>{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]=m,t[5]=p):(m=t[4],p=t[5]),r.useEffect(m,p),t[6]!==n?(g=C.jsx(Bk,{id:"app",className:"relative h-full",children:C.jsx(r.Suspense,{children:n})},"app"),t[6]=n,t[7]=g):g=t[7];const y=g,v=iB,x=o?"resize-handle":"resize-handle-collapsed";let b,w;t[8]!==x?(b=hn("border-border no-print z-10",x,"vertical"),t[8]=x,t[9]=b):b=t[9],t[10]!==b?(w=C.jsx(YS,{onDragging:v,className:b}),t[10]=b,t[11]=w):w=t[11];const k=w,N=a?"resize-handle":"resize-handle-collapsed";let E,j;t[12]!==N?(E=hn("border-border no-print z-20",N,"horizontal"),t[12]=N,t[13]=E):E=t[13],t[14]!==E?(j=C.jsx(YS,{onDragging:v,className:E}),t[14]=E,t[15]=j):j=t[15];const _=j;let I,T,A,M,O,D,P,R,L,z,F,B,U,V,H,$,G,q,Y,X;t[16]!==i?(I=C.jsx("div",{className:"text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1",children:i}),t[16]=i,t[17]=I):I=t[17],t[18]!==s?(T=()=>s(!1),t[18]=s,t[19]=T):T=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(A=C.jsx(sn,{className:"w-4 h-4"}),t[20]=A):A=t[20],t[21]!==T?(M=C.jsx(W,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:T,children:A}),t[21]=T,t[22]=M):M=t[22],t[23]!==I||t[24]!==M?(O=C.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[I,M]}),t[23]=I,t[24]=M,t[25]=O):O=t[25],t[26]!==i?(D="files"===i&&C.jsx(NO,{}),t[26]=i,t[27]=D):D=t[27],t[28]!==i?(P="errors"===i&&C.jsx(NN,{}),t[28]=i,t[29]=P):P=t[29],t[30]!==i?(R="variables"===i&&C.jsx(HM,{}),t[30]=i,t[31]=R):R=t[31],t[32]!==i?(L="dependencies"===i&&C.jsx(LM,{}),t[32]=i,t[33]=L):L=t[33],t[34]!==i?(z="packages"===i&&C.jsx(QO,{}),t[34]=i,t[35]=z):z=t[35],t[36]!==i?(F="outline"===i&&C.jsx(EN,{}),t[36]=i,t[37]=F):F=t[37],t[38]!==i?(B="datasources"===i&&C.jsx(PO,{}),t[38]=i,t[39]=B):B=t[39],t[40]!==i?(U="documentation"===i&&C.jsx(XM,{}),t[40]=i,t[41]=U):U=t[41],t[42]!==i?(V="snippets"===i&&C.jsx(IO,{}),t[42]=i,t[43]=V):V=t[43],t[44]!==i?(H="scratchpad"===i&&C.jsx(ZO,{}),t[44]=i,t[45]=H):H=t[45],t[46]!==i?($="chat"===i&&C.jsx(zF,{}),t[46]=i,t[47]=$):$=t[47],t[48]!==i?(G="logs"===i&&C.jsx(WM,{}),t[48]=i,t[49]=G):G=t[49],t[50]!==i?(q="tracing"===i&&C.jsx(oB,{}),t[50]=i,t[51]=q):q=t[51],t[52]!==D||t[53]!==P||t[54]!==R||t[55]!==L||t[56]!==z||t[57]!==F||t[58]!==B||t[59]!==U||t[60]!==V||t[61]!==H||t[62]!==$||t[63]!==G||t[64]!==q?(Y=C.jsxs(hi,{children:[D,P,R,L,z,F,B,U,V,H,$,G,q]}),t[52]=D,t[53]=P,t[54]=R,t[55]=L,t[56]=z,t[57]=F,t[58]=B,t[59]=U,t[60]=V,t[61]=H,t[62]=$,t[63]=G,t[64]=q,t[65]=Y):Y=t[65],t[66]!==O||t[67]!==Y?(X=C.jsx(Ss,{children:C.jsx(r.Suspense,{children:C.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[O,Y]})})}),t[66]=O,t[67]=Y,t[68]=X):X=t[68];const K=X,J=o&&"border-r border-l border-[var(--slate-7)]";let Z,Q,ee,te,ne,oe;t[69]!==J?(Z=hn("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",J),t[69]=J,t[70]=Z):Z=t[70],t[71]===Symbol.for("react.memo_cache_sentinel")?(Q=(e,t)=>{var n;0===t&&10===e&&(null==(n=c.current)||n.resize(30))},t[71]=Q):Q=t[71],t[72]!==s?(ee=()=>s(!1),te=()=>s(!0),t[72]=s,t[73]=ee,t[74]=te):(ee=t[73],te=t[74]),t[75]!==K||t[76]!==k?(ne=C.jsxs("span",{className:"flex flex-row h-full",children:[K," ",k]}),t[75]=K,t[76]=k,t[77]=ne):ne=t[77],t[78]!==c||t[79]!==Z||t[80]!==ee||t[81]!==te||t[82]!==ne?(oe=C.jsx(Bk,{ref:c,id:"helper",collapsedSize:0,collapsible:!0,className:Z,minSize:10,defaultSize:0,maxSize:75,onResize:Q,onCollapse:ee,onExpand:te,children:ne},"helper"),t[78]=c,t[79]=Z,t[80]=ee,t[81]=te,t[82]=ne,t[83]=oe):oe=t[83];const re=oe,ae=a&&"border-[var(--slate-7)]";let ie,se,le,ce,de,ue,he,fe;t[84]!==ae?(ie=hn("dark:bg-[var(--slate-1)] no-print print:hidden hide-on-fullscreen",ae),t[84]=ae,t[85]=ie):ie=t[85],t[86]===Symbol.for("react.memo_cache_sentinel")?(se=(e,t)=>{var n;0===t&&10===e&&(null==(n=d.current)||n.resize(30))},t[86]=se):se=t[86],t[87]!==l?(le=()=>l(!1),ce=()=>l(!0),t[87]=l,t[88]=le,t[89]=ce):(le=t[88],ce=t[89]),t[90]!==l?(de=()=>l(!1),t[90]=l,t[91]=de):de=t[91],t[92]!==a||t[93]!==de?(ue=C.jsx(rB,{visible:a,onClose:de}),t[92]=a,t[93]=de,t[94]=ue):ue=t[94],t[95]!==a||t[96]!==ue?(he=C.jsx(GO,{isOpen:a,children:ue}),t[95]=a,t[96]=ue,t[97]=he):he=t[97],t[98]!==d||t[99]!==ie||t[100]!==le||t[101]!==ce||t[102]!==_||t[103]!==he?(fe=C.jsxs(Bk,{ref:d,id:"terminal",collapsedSize:0,collapsible:!0,className:ie,minSize:10,defaultSize:0,maxSize:75,onResize:se,onCollapse:le,onExpand:ce,children:[_,he]},"terminal"),t[98]=d,t[99]=ie,t[100]=le,t[101]=ce,t[102]=_,t[103]=he,t[104]=fe):fe=t[104];const me=fe;let pe,ge,ye,ve,xe,be,we;return t[105]===Symbol.for("react.memo_cache_sentinel")?(pe={getItem:e=>kN||(kN??null),setItem(e,t){kN=t||null}},t[105]=pe):pe=t[105],t[106]===Symbol.for("react.memo_cache_sentinel")?(ge=C.jsx(hi,{children:C.jsx(gN,{})}),t[106]=ge):ge=t[106],t[107]!==me?(ye=C.jsx(dN,{capability:"terminal",children:me}),t[107]=me,t[108]=ye):ye=t[108],t[109]!==y||t[110]!==ye?(ve=C.jsx(Bk,{children:C.jsxs(WS,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[y,ye]})}),t[109]=y,t[110]=ye,t[111]=ve):ve=t[111],t[112]!==re||t[113]!==ve?(xe=C.jsxs(WS,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:pe,children:[ge,re,ve]}),t[112]=re,t[113]=ve,t[114]=xe):xe=t[114],t[115]===Symbol.for("react.memo_cache_sentinel")?(be=C.jsx(Ss,{children:C.jsx(hi,{children:C.jsx(uN,{})})}),t[115]=be):be=t[115],t[116]!==xe?(we=C.jsxs("div",{className:"flex flex-col flex-1 overflow-hidden absolute inset-0 print:relative",children:[xe,be]}),t[116]=xe,t[117]=we):we=t[117],we};function iB(e){e||window.dispatchEvent(new Event("resize"))}const sB=e=>{const t=S(5);let n,o,r;return t[0]!==e?(n=C.jsx(gk,{...e}),t[0]=e,t[1]=n):n=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(o=C.jsx(nu,{}),t[2]=o):o=t[2],t[3]!==n?(r=C.jsxs(aB,{children:[n,o]}),t[3]=n,t[4]=r):r=t[4],r};export{sB as default};